*/
void os_beep (int number)
{
-
beep();
-
}/* os_beep */
+
/*
* os_prepare_sample
*
* the same operation. This function therefore does nothing.
*
*/
-
void os_prepare_sample (int number)
{
return;
} else {
/* Something else was presented as an audio chunk. Ignore it. */
}
-
}/* os_start_sample */
+
/*
* os_stop_sample
*
* Turn off the current sample.
*
*/
-
void os_stop_sample (int number)
{
if (bleep_playing && number == bleepnum) {
return;
}/* os_stop_sample */
+
/*
* os_finish_with_sample
*
* Remove the current sample from memory (if any).
*
*/
-
void os_finish_with_sample (int number)
{
os_stop_sample(number);
}/* os_finish_with_sample */
+
/*
* os_wait_sample
*
* Stop repeating the current sample and wait until it finishes.
*
*/
-
void os_wait_sample (void)
{
/*
+ **********************************************
* These functions are internal to ux_audio.c
*
+ **********************************************
*/
/*
* Data presented to the mixer must be floats at 44100hz
*
*/
-
static void *mixer(void *arg)
{
short *shortbuffer;
/* Convert the buffer to floats. (before resampling) */
-void pcm16tofloat(float *outbuf, short *inbuf, int length)
+static void pcm16tofloat(float *outbuf, short *inbuf, int length)
{
int count;
}
}
+
/*
* playaiff
*
return(2);
}
+
/*
* getfiledata
*
fclose(fp);
fp = NULL;
-
/* Check if foo.blb is there. */
if ((blorb_fp = fopen(mystring, "rb")) == NULL) {
p = rindex(mystring, '.');
return blorb_err;
}
+
/*
* ux_blorb_stop
*
blorb_fp = NULL;
}
-
+/*
+ **********************************************
+ * These functions are internal to ux_blorb.c
+ *
+ **********************************************
+ */
/*
* isblorb
return 1;
}
+
static char *findchunk(char *data, char *string, int length)
{
char *mydata = data+12;
static void redraw(void);
static FILE *pathopen(const char *, const char *, const char *, char *);
+
/*
* os_fatal
*
* Display error message and exit program.
*
*/
-
void os_fatal (const char *s, ...)
{
-
if (u_setup.curses_active) {
/* Solaris 2.6's cc complains if the below cast is missing */
os_display_string((zchar *)"\n\n");
fputs ("\n\n", stderr);
exit (1);
-
}/* os_fatal */
/* extern char script_name[]; */
/* extern char save_name[];*/
/*extern char auxilary_name[];*/
+
/*
* os_process_arguments
*
*
*
*/
-
void os_process_arguments (int argc, char *argv[])
{
int c;
exit(1);
}
+
/*
* It doesn't look like Frotz can reliably be resized given its current
* screen-handling code. While playing with Nitfol, I noticed that it
if (signal(SIGTTOU, SIG_IGN) != SIG_IGN)
signal(SIGTTOU, SIG_IGN);
-
/* First check for a "$HOME/.frotzrc". */
/* If not found, look for CONFIG_DIR/frotz.conf */
/* $HOME/.frotzrc overrides CONFIG_DIR/frotz.conf */
}
/* Parse the options */
-
do {
c = zgetopt(argc, argv, "aAb:c:def:Fh:il:oOpPQqr:s:S:tu:w:xZ:");
switch(c) {
}/* os_process_arguments */
+
/*
* os_init_screen
*
* ugly hacks, neener neener neener. --GH :)
*
*/
-
void os_init_screen (void)
{
-
/*trace(TRACE_CALLS);*/
if (initscr() == NULL) { /* Set up curses */
os_erase_area(1, 1, h_screen_rows, h_screen_cols, 0);
}/* os_init_screen */
+
/*
* os_reset_screen
*
* Reset the screen before the program stops.
*
*/
-
void os_reset_screen (void)
{
-
os_stop_sample(0);
os_set_text_style(0);
print_string("[Hit any key to exit.]\n");
os_read_key(0, FALSE);
scrollok(stdscr, TRUE); scroll(stdscr);
refresh(); endwin();
-
}/* os_reset_screen */
+
/*
* os_restart_game
*
* RESTART_END - restart is complete
*
*/
-
void os_restart_game (int stage)
{
}
+
/*
* os_random_seed
*
* 32767, possibly by using the current system time.
*
*/
-
int os_random_seed (void)
{
* path where the file was found in fullname.
*
*/
-
static FILE *pathopen(const char *name, const char *p, const char *mode, char *fullname)
{
FILE *fp;
char varname[LINELEN + 1];
char value[LINELEN + 1];
-
/*
* We shouldn't care if the config file is unreadable or not
* present. Just use the defaults.
/* The big nasty if-else thingy is finished */
} /* while */
-
return TRUE;
} /* getconfig() */
* cleanly resize the window.
*
*/
-
void sigwinch_handler(int sig)
{
/*
}
+
/*
* sigint_handler
* Sometimes the screen will be left in a weird state if the following
void os_init_setup(void)
{
-
f_setup.attribute_assignment = 0;
f_setup.attribute_testing = 0;
f_setup.context_lines = 0;
}
-/* A unix-like getopt, but with the names changed to avoid any problems.
-*/
+
+/* A unix-like getopt, but with the names changed to avoid any problems. */
static int zgetopt (int argc, char *argv[], const char *options)
{
static int pos = 1;
fputc ('\n', stderr);
return '?';
}/* zgetopt */
-
* equals global_timeout, boom.
*
*/
-
static void unix_set_global_timeout(int timeout)
{
if (!timeout) global_timeout.tv_sec = 0;
return;
}
-/* This returns the number of milliseconds until the input timeout
+
+/*
+ * timeout_to_ms
+ *
+ * This returns the number of milliseconds until the input timeout
* elapses or zero if it has already elapsed. -1 is returned if no
* timeout is in effect, otherwise the return value is non-negative.
*/
return diff.tv_sec * 1000 + diff.tv_usec / 1000;
}
+
/*
* unix_read_char
*
case MOD_META | 'd': return ZC_HKEY_DEBUG;
case MOD_META | 'h': return ZC_HKEY_HELP;
-/* these are the emacs-editing characters */
+ /* these are the emacs-editing characters */
case MOD_CTRL ^ 'B': return ZC_ARROW_LEFT;
case MOD_CTRL ^ 'F': return ZC_ARROW_RIGHT;
case MOD_CTRL ^ 'P': return ZC_ARROW_UP;
* Add the given string to the next available history buffer slot.
*
*/
-
static void unix_add_to_history(zchar *str)
{
return;
}
+
/*
* unix_history_back
*
return 1;
}
+
/*
* unix_history_forward
*
return 1;
}
+
/*
* scrnmove
*
* In the row of the cursor, move n characters starting at src to dest.
*
*/
-
static void scrnmove(int dest, int src, int n)
{
int col, x, y;
return;
}
+
/*
* scrnset
*
* In the row of the cursor, set n characters starting at start to c.
*
*/
-
static void scrnset(int start, int c, int n)
{
int y, x;
return;
}
+
/*
* os_read_line
*
* to implement word completion (similar to tcsh under Unix).
*
*/
-
zchar os_read_line (int max, zchar *buf, int timeout, int width, int continued)
{
int ch, y, x, len = strlen( (char *)buf);
}
}/* os_read_line */
+
/*
* os_read_key
*
* return it. Input aborts after timeout/10 seconds.
*
*/
-
zchar os_read_key (int timeout, int cursor)
{
zchar c;
}/* os_read_key */
+
/*
* os_read_file_name
*
} *pict_info;
static int num_pictures = 0;
+
static unsigned char lookupb(unsigned char *p, int n)
{
return p[n];
}
+
static unsigned short lookupw(unsigned char *p, int n)
{
return (p[n + 1] << 8) | p[n];
}
+
/*
* Do a rounding division, rounding to even if fraction part is 1/2.
* We assume x and y are nonnegative.
return success;
}
+
/* Convert a Z picture number to an index into pict_info. */
static int z_num_to_index(int n)
{
return -1;
}
+
/*
* os_picture_data
*
return TRUE;
}
+
/*
* Do a mvaddch if the coordinates aren't too large.
*
mvaddch(y, x, ch);
}
+
/*
* Set n chars starting at (x, y), doing bounds checking.
*
}
}
+
/*
* os_draw_picture
*
* Display a picture at the given coordinates. Top left is (1,1).
*
*/
-
/* TODO: handle truncation correctly. Spec 8.8.3 says all graphics should
* be clipped to the current window. To do that, we should probably
* modify z_draw_picture in the frotz core to pass some extra parameters.
*/
-
void os_draw_picture (int num, int row, int col)
{
int width, height, r, c;
* v
*/
-
-
-
-
-
if ((height == 1) && (width == 1))
safe_mvaddch(row, col, plus);
else if (height == 1) {
move(saved_y, saved_x);
}
+
/*
* os_peek_colour
*
* instead.
*
*/
-
int os_peek_colour (void)
{
if (u_setup.color_enabled) {
bb_map_t *blorb_map;
+
/*
* ux_getresource
*
return st;
}
+
/*
* ux_freeresource
*
* Destroys a myresource struct and returns the memory to the heap.
*
*/
-
int ux_freeresource(myresource *res)
{
if (res == NULL)
#include "ux_frotz.h"
+
/*
* os_erase_area
*
* being erased. This is not relevant for the curses interface.
*
*/
-
void os_erase_area (int top, int left, int bottom, int right, int win)
{
int y, x, i, j;
}
}/* os_erase_area */
+
/*
* os_scroll_area
*
* colour. Top left coordinates are (1,1). The cursor stays put.
*
*/
-
void os_scroll_area (int top, int left, int bottom, int right, int units)
{
top--; left--; bottom--; right--;
"Th N O O O O Oe * O U U U Ue Y Th ss "
"a a a a ae a ae c e e e e i i i i "
"th n o o o o oe : o u u u ue y th y ";
+
+
/*
* os_font_data
*
* be changed.
*
*/
-
int os_font_data (int font, int *height, int *width)
{
}/* os_font_data */
+
#ifdef COLOR_SUPPORT
/*
* unix_convert
* Converts frotz's (and Infocom's) color values to ncurses color values.
*
*/
-
static int unix_convert(int color)
{
switch(color) {
}
#endif
+
/*
* os_set_colour
*
* remarks on os_peek_colour.
*
*/
-
void os_set_colour (int new_foreground, int new_background)
{
if (new_foreground == 1) new_foreground = h_default_foreground;
os_set_text_style(u_setup.current_text_style);
}/* os_set_colour */
+
/*
* os_set_text_style
*
* FIXED_WIDTH_STYLE
*
*/
-
void os_set_text_style (int new_style)
{
int temp = 0;
attrset(temp ^ u_setup.current_color);
}/* os_set_text_style */
+
/*
* os_set_font
*
* choose fonts which aren't supported by the interface.
*
*/
-
void os_set_font (int new_font)
{
}/* os_set_font */
+
/*
* os_display_char
*
* bottom right corner.
*
*/
-
void os_display_char (zchar c)
{
-
if (c >= ZC_LATIN1_MIN && c <= ZC_LATIN1_MAX) {
if (u_setup.plain_ascii) {
addch(' '); addch(' ');
return;
}
-
}/* os_display_char */
+
/*
* os_display_string
*
* Pass a string of characters to os_display_char.
*
*/
-
void os_display_string (const zchar *s)
{
-
zchar c;
while ((c = (unsigned char) *s++) != 0)
}/* os_display_string */
+
/*
* os_char_width
*
* Return the width of the character in screen units.
*
*/
-
int os_char_width (zchar c)
{
-
if (c >= ZC_LATIN1_MIN && c <= ZC_LATIN1_MAX && u_setup.plain_ascii) {
int width = 0;
}/* os_char_width*/
+
/*
* os_string_width
*
* NEW_FONT - next character is a new font
*
*/
-
int os_string_width (const zchar *s)
{
int width = 0;
} else width += os_char_width(c);
return width;
-
}/* os_string_width */
+
/*
* os_set_cursor
*
* Place the text cursor at the given coordinates. Top left is (1,1).
*
*/
-
void os_set_cursor (int y, int x)
{
}/* os_set_cursor */
+
/*
* os_more_prompt
*
* prompt from the screen.
*
*/
-
void os_more_prompt (void)
{
int saved_style, saved_x, saved_y;