return 0;
return 1;
-}
+} /* isblorb */
/*
}
return blorb_err;
-}
+} /* gen_blorb_init */
/*
fseek(fp, blorb_res.data.startpos, SEEK_SET);
return fp;
-}
+} /* os_load_story */
/*
} else {
return fseek(fp, offset, whence);
}
-}
+} /* os_storyfile_seek */
/*
} else {
return ftell(fp);
}
-}
+} /* os_storyfile_tell */
static void print_c_string(const char *s)
while ((c = *s++) != 0) {
os_display_char(c);
}
-}
+} /* print_c_string */
/*
print_c_string("(truncated)\n");
new_line();
os_set_text_style(style);
-}
+} /* os_warn */
size_t zcharstrlen(zchar * str)
ret++;
}
return ret;
-}
+} /* zcharstrlen */
zchar *zcharstrcpy(zchar * dest, zchar * src)
dest[i] = 0;
return dest;
-}
+} /* zcharstrcpy */
int zcharstrncmp(zchar * s1, zchar * s2, size_t n)
return 0;
}
return 0;
-}
+} /* zcharstrncmp */
zchar *zcharstrdup(zchar * src)
if (dest)
zcharstrcpy(dest, src);
return dest;
-}
+} /* zcharstrdup */
/* These are useful for circular buffers.
history_view = history_next; /* Reset user frame after each line */
return;
-}
+} /* gen_add_to_history */
/**
void gen_history_reset()
{
history_view = history_next;
-}
+} /* gen_history_reset */
/**
&& zcharstrncmp(str, *history_view, searchlen)));
zcharstrcpy(str + searchlen, *history_view + searchlen);
return 1;
-}
+} /* gen_history_back */
/**
&& zcharstrncmp(str, *history_view, searchlen)));
zcharstrcpy(str + searchlen, *history_view + searchlen);
return 1;
-}
+} /* gen_history_forward */
memmove(&(myglyph.bitmap[0]),src,8);
myglyph.h = 8;
return (SF_glyph *)&myglyph;
-}
+} /* mygetglyph */
static SFONT myfont3 = {
}
myglyph.h = 16;
return (SF_glyph *)&myglyph;
-}
+} /* mygetglyph2 */
static SFONT myfont3dbl = {
FT_Done_Face(f->face);
free(s);
}
-}
+} /* bdestroy */
static int bheight(SFONT * s)
if (s)
return ((MYFONT *) s)->height;
return 0;
-}
+} /* bheight */
static int bascent(SFONT * s)
if (s)
return ((MYFONT *) s)->ascent;
return 0;
-}
+} /* bascent */
static int bdescent(SFONT * s)
if (s)
return ((MYFONT *) s)->descent;
return 0;
-}
+} /* bdescent */
static int bminchar(SFONT * s)
if (s)
return ((MYFONT *) s)->minchar;
return 0;
-}
+} /* bminchar */
static int bmaxchar(SFONT * s)
if (s)
return ((MYFONT *) s)->maxchar;
return 0;
-}
+} /* bmaxchar */
static void setglyph(MYFONT * f, FT_Face face, int ch);
return f->glyphs[c];
}
return NULL;
-}
+} /* getglyph */
static int hasglyph(SFONT * fo, zword c, int allowdef)
{
return (getglyph(fo, c, allowdef) != NULL);
-}
+} /* hasglyph */
static int inited = 0, initerr = 0;
return;
FT_Done_FreeType(library);
inited = 0;
-}
+} /* libfinish */
static void libinit()
inited = 1;
atexit(libfinish);
}
-}
+} /* libinit */
static MYFONT *makefont(int totglyphs)
res->totglyphs = totglyphs;
res->maxchar = totglyphs - 1;
return res;
-}
+} /* makefont */
#define MAXUNI 0xffff
res->yof = slot->bitmap_top - bitmap->rows + 1;
f->glyphs[ch] = res;
-}
+} /* setglyph */
static SFONT *loadftype(char *fname, int size, SFONT * like, int *err)
setglyph(res, face, 0x153);
return (SFONT *) res;
-}
+} /* loadftype */
#ifdef WIN32
return NULL;
return loadftype(fn, size, like, err);
-}
+} /* sf_loadftype */
/****************************************/
void sf_initloader()
{
ttfontloader = sf_loadftype;
-}
+} /* sf_initloader */
[(toLinear[s & 0xff] * a +
toLinear[d & 0xff] * (256 - a)) >> 8]) << 16;
return r;
-}
+} /* sf_blend */
/* Set the screen gamma and build gamma correction tables */
gamma = 1.0 / gamma;
for (i = 0; i < 256; i++)
fromLinear[i] = (int)((pow(i / 255.0, gamma) * 255.0) + 0.5);
-}
+} /* sf_setgamma */
/****************************************************************************
* Loader for PNG images
PNGData *pngData = (PNGData *) png_get_io_ptr(png_ptr);
memmove(data, pngData->gfxData + pngData->offset, length);
pngData->offset += length;
-}
+} /* readPNGData */
static int loadpng(zbyte * data, int length, sf_picture * graphic)
free(rowPointers);
return 1;
-} /* loadpng */
+} /* loadpng * /
+
/****************************************************************************
* Loader for JPEG images
struct JPEGErrorInfo *error = (struct JPEGErrorInfo *)cinfo->err;
(*cinfo->err->output_message) (cinfo);
longjmp(error->errorJump, 1);
-}
+} /* errorJPEGExit */
static void outputJPEGMessage(j_common_ptr cinfo)
{
char buffer[JMSG_LENGTH_MAX];
(*cinfo->err->format_message) (cinfo, buffer);
-}
+} /* outputJPEGMessage */
/* Memory Data Source */
static void memJPEGInit(j_decompress_ptr unused)
{
/* Nothing here */
-}
+} /* memJPEGInit */
static int memJPEGFillInput(j_decompress_ptr unused)
{
return 0;
-}
+} /* memJPEGFillInput */
static void memJPEGSkipInput(j_decompress_ptr cinfo, long num_bytes)
cinfo->src->next_input_byte += num_bytes;
cinfo->src->bytes_in_buffer -= num_bytes;
}
-}
+} /* memJPEGSkipInput */
static void memJPEGTerm(j_decompress_ptr unused)
{
/* Nothing here */
-}
+} /* memJPEGTerm */
static int loadjpeg(zbyte * data, int length, sf_picture * graphic)
jpeg_destroy_decompress(&info);
return 1;
-}
+} /* loadjpeg */
/****************************************************************************
* Loader for simple rectangles
(data[4] << 24) | (data[5] << 16) | (data[6] << 8) | data[7];
graphic->pixels = NULL;
return 1;
-}
+} /* loadrect */
/*****************************/
cached[i].pixels = NULL;
}
cacheinited = 0;
-}
+} /* cacheflush */
static void cacheinit()
cached[i].pixels = NULL;
}
cacheinited = 1;
-}
+} /* cacheinit */
static sf_picture *cachefind(int n)
return (cached + 0);
}
return NULL;
-}
+} /* cachefind */
sf_picture *sf_getpic(int num)
if (sf_loadpic(num, res))
return res;
return NULL;
-}
+} /* sf_getpic */
}
return p;
-}
+} /* sf_msgstring */
First = 0;
selected = NULL;
drawlist();
-}
+} /* updatelist */
STATIC void goright();
STATIC void goleft();
updatelist();
} else
strcat(lastdir, "/");
-}
+} /* goup */
typedef struct {
int x, y, w, h; /* internal */
v = O_GRAY1;
sf_chline(x, y + h, v, w--);
sf_cvline(x + w, y, v, h);
-}
+} /* frame_upframe */
STATIC void frame_downframe(int x, int y, int w, int h)
v = O_GRAY3;
sf_chline(x, y + h, v, w--);
sf_cvline(x + w, y, v, h);
-}
+} /* frame_downframe */
/* internal coords */
STATIC int addarea(int x, int y, int w, int h, zword(*click) (int, int))
a->click = click;
a->back = O_GRAY2;
return nbareas++;
-}
+} /* addarea */
STATIC void clarea(int n)
{
BAREA *a = bareas + n;
sf_fillrect(a->back, a->x, a->y, a->w, a->h);
-}
+} /* clarea */
#ifdef USE_UTF8
}
*out = ch;
return idx;
-}
+} /* utf8_to_zchar */
STATIC size_t utf8_len(const char *str)
ret++;
}
return ret;
-}
+} /* utf8_len */
#endif /* USE_UTF8 */
}
#endif
sf_setclip(ox, oy, ow, oh);
-}
+} /* writetext */
STATIC int addbutton(int x, int y, int w, int h, char *text,
if (text)
writetext(0, text, x, y, w, 1);
return b;
-}
+} /* addbutton */
static int B_up, B_ok, B_cancel;
static int A_dir, A_filter, A_entry, A_list;
os_font_data(0, &height, &width);
sf_cvline(a->x + width * pos, a->y, O_BLACK, height);
}
-}
+} /* showfilename */
STATIC void clicked(BAREA * a)
sf_sleep(100);
frame_upframe(a->x - 2, a->y - 2, a->w + 4, a->h + 4);
sf_flushdisplay();
-}
+} /* clicked */
STATIC zword checkmouse(int i0)
}
}
return 0;
-}
+} /* checkmouse */
STATIC zword Zup(int x, int y)
{
goup();
return 0;
-}
+} /* Zup */
STATIC zword Zok(int x, int y)
{
return ZC_RETURN;
-}
+} /* Zok */
STATIC zword Zcanc(int x, int y)
{
return ZC_ESCAPE;
-}
+} /* Zcanc */
STATIC zword Zselect(int x, int y);
STATIC zword yesnoover(int xc, int yc);
}
}
return c;
-}
+} /* inputkey */
int (*sf_sysdialog)(bool existing, const char *def, const char *filt,
const char *tit, char **res) = NULL;
}
return SF_NOTIMP;
-}
+} /* myosdialog */
void sf_setdialog(void)
{
sf_osdialog = myosdialog;
-}
+} /* sf_setdialog */
/*********************************/
if (lp < lpat)
return 1; /* too short */
return strcmp(pattern, p + lp - lpat);
-}
+} /* myfnmatch */
STATIC void cleanlist(ENTRY * t)
free(t);
t = n;
}
-}
+} /* cleanlist */
STATIC ENTRY *newentry(char *s)
}
}
return r;
-}
+} /* newentry */
STATIC void addentry(char *s, ENTRY ** ae)
}
}
}
-}
+} /* addentry */
STATIC char *resolvedir(char *dir, char *res, int size)
}
}
return p;
-}
+} /* resolvedir */
static void exhaust(ENTRY * e, ENTRY ** resp, int *n)
*resp = e;
(*n)++;
exhaust(e->right, resp, n);
-}
+} /* exhaust */
STATIC ENTRY *dodir(char *dirname, char *pattern, char *resdir, int size,
}
return res;
-}
+} /* dodir */
#ifdef USE_UTF8
idx++;
}
return cpos;
-}
+} /* utf8_char_pos */
#endif
} else
color = O_BLACK;
writetext(color, s, x, y, w, 0);
-}
+} /* drawit */
static int Nrows, Ncols, Ewid, Fh;
ewid, i < nsub);
files = files->right;
}
-}
+} /* drawnames */
STATIC void drawlist()
drawnames(a->x, a->y, a->w, a->h, curdir, First, Numdirs, Numtot,
21 * 8);
-}
+} /* drawlist */
STATIC void goright()
return;
First += Nrows;
drawlist();
-}
+} /* goright */
STATIC void goleft()
return;
First -= Nrows;
drawlist();
-}
+} /* goleft */
STATIC ENTRY *filesat(int n)
e = e->right;
}
return e;
-}
+} /* filesat */
STATIC zword Zselect(int x, int y)
showfilename(-1);
drawlist();
return 0;
-}
+} /* Zselect */
extern void sf_videodata(zlong ** sb, int *sp, int *ew, int *eh);
nbareas = nsav;
return c;
-}
+} /* sf_yesnooverlay */
STATIC zword yesnoover(int xc, int yc)
drawlist();
return c;
-}
+} /* yesnoover */
/* this is needed for overlapping source and dest in Zentry
static void mystrcpy(char *d, const char *s)
{
while ((*d++ = *s++)) ;
-}
+} /* mystrcpy */
STATIC zword Zentry(int x, int y)
}
showfilename(-1);
return c;
-}
+} /* Zentry */
if ((reso->py) && (reso->py >= AcHeight))
AcHeight = reso->py;
}
-}
+} /* checkwidths */
static void sf_cleanup_resources(void)
if (blorb_fp)
fclose(blorb_fp);
blorb_fp = NULL;
-}
+} /* sf_cleanup_resources */
static void load_local_resources(void);
load_local_resources();
return 0;
-}
+} /* sf_load_resources */
/*
*height = 0;
*width = 0;
return 0;
-}
+} /* os_picture_data */
/*
theWnd->RemoveMenu(menu);
break;
}*/
-}
+} /* os_menu */
/*
return ((int)(time(NULL))) & 32767;
}
return m_random_seed;
-}
+} /* os_random_seed */
/* The following assumes Unicode */
putchar(0x80 + (c & 0x3f));
}
}
-}
+} /* os_scrollback_char */
/*
if (option_scrollback_buffer)
while (erase--)
putchar(8);
-}
+} /* os_scrollback_erase */
/*
sf_read_key(0, false, false, false);
}
}
-}
+} /* os_restart_game */
#define DEFAULT_GAMMA 2.2
m_nonStdColours[i] = 0xFFFFFFFF;
m_nonStdIndex = 0;
-}
+} /* sf_initcolours */
/* Read in settings */
}
sf_FinishProfile();
-}
+} /* sf_readsettings */
/* Get a colour */
return m_nonStdColours[colour - 18];
}
return m_colours[0];
-}
+} /* sf_GetColour */
/* Get a default colour */
if (m_IsInfocomV6)
return sf_GetColour(fore ? WHITE_COLOUR : BLACK_COLOUR);
return fore ? m_defaultFore : m_defaultBack;
-}
+} /* sf_GetColour */
/* Get an index for a non-standard colour */
m_nonStdIndex = 0;
}
return index;
-}
+} /* sf_GetColourIndex */
/*
ts->back = sf_GetColour(new_background);
ts->backDefault = (new_background == 1);
ts->backTransparent = (new_background == 15);
-}
+} /* os_set_colour */
/*
int os_from_true_colour(zword colour)
{
return sf_GetColourIndex(RGB5ToTrue(colour));
-}
+} /* os_from_true_colour */
/*
zword os_to_true_colour(int index)
{
return TrueToRGB5(sf_GetColour(index));
-}
+} /* os_to_true_colour */
/*
hx_fore_colour = TrueToRGB5(sf_GetDefaultColour(true));
hx_back_colour = TrueToRGB5(sf_GetDefaultColour(false));
}
-}
+} /* os_init_screen */
static void print_c_string (const char *s)
}
sf_cleanup_all();
os_quit(EXIT_FAILURE);
-}
+} /* os_fatal */
/* If true, running one of Infocom's V6 games */
break;
}
return false;
-}
+} /* sf_IsInfocomV6 */
/* If true, this picture has an adaptive palette */
}
bb_unload_chunk(blorb_map, result.chunknum);
return adaptive;
-}
+} /* sf_IsAdaptive */
#define LOCAL_MEM -1
if ((blorb_map) && (cnu >= 0))
bb_unload_chunk(blorb_map, cnu);
-}
+} /* sf_freeresource */
static FILE *findlocal(int ispic, int num, int *size)
*size = ftell(f);
fseek(f, 0, SEEK_SET);
return f;
-}
+} /* findlocal */
static FILE *findfromlist(int ispic, int num, int *size);
}
return bb_err_None;
-}
+} /* loadlocal */
int sf_getresource(int num, int ispic, int method, myresource * res)
res->file = blorb_fp;
}
return st;
-}
+} /* sf_getresource */
+
/***************/
free(e);
e = n;
}
-}
+} /* cleanLLENTRY */
static void cleanlocallist()
Lpics = NULL;
cleanLLENTRY(Lsnds);
Lsnds = NULL;
-}
+} /* cleanlocal */
static int parseline(char *s)
return -1;
p_name = p;
return 1;
-}
+} /* parseline */
static void load_local_resources(void)
if (numlocal)
m_localfiles = 1;
fclose(f);
-}
+} /* load_local_resources */
static FILE *findfromlist(int ispic, int num, int *size)
*size = ftell(f);
fseek(f, 0, SEEK_SET);
return f;
-}
+} /* findfromlist */
void os_init_setup(void)
sf_setdialog();
sf_initloader();
sdl_active = FALSE;
-}
+} /* os_init_setup */
signal(SIGINT, SIG_DFL);
signal(SIGFPE, SIG_DFL);
signal(SIGSEGV, SIG_DFL);
-}
+} /* resethandlers */
+
static const char *signame(int sig)
{
default:
return "";
}
-}
+} /* signame */
+
static void myhandler(int s)
{
resethandlers();
os_fatal("Signal %d received %s", s, signame(s));
-}
+} /* myhandler */
+
void sf_installhandlers()
{
signal(SIGINT, myhandler);
signal(SIGFPE, myhandler);
signal(SIGSEGV, myhandler);
-}
+} /* sf_installhandlers */
#else
i++;
}
return NULL;
-}
+} /* getsigname */
static void bt_sighandler(int sig, siginfo_t * info, void *secret)
{
}
os_quit(EXIT_SUCCESS);
-}
+} /* bt_sighandler */
+
void sf_installhandlers()
{
sigaction(SIGINT, &sa, NULL);
sigaction(SIGILL, &sa, NULL);
-}
+} /* sf_installhandlers */
#endif
e_sfx = e_mod = NULL;
Mix_CloseAudio();
-}
+} /* finishaudio */
+
static void music_finished(void);
static void channel_finished(int channel);
*/
void os_init_sound()
{
-}
+} /* os_init_sound */
+
int sf_initsound()
{
Mix_AllocateChannels(1);
CLEANREG(finishaudio);
return 1;
-}
+} /* sf_initsound */
static void baredestroy(EFFECT * r)
Mix_FreeChunk(r->sam);
free(r);
}
-}
+} /* baredestroy */
static EFFECT *new_effect(int type, int num)
reader->destroy = baredestroy;
}
return (EFFECT *) reader;
-}
+} /* new_effect */
/* According to specs, this is only called when music ends "naturally",
return;
e_mod->active = 0;
e_mod->ended = 1;
-}
+} /* music_finished */
/* This may be called also via a Mix_Haltetc. */
return;
e_sfx->active = 0;
e_sfx->ended = 1; /* stopsample will take care of this... */
-}
+} /* channel_finished */
static void stopsample()
e_sfx->active = 0;
Mix_HaltChannel(0);
e_sfx->ended = 0;
-}
+} /* stopsample */
static void stopmodule()
e_mod->active = 0;
Mix_HaltMusic();
e_mod->ended = 0;
-}
+} /* stopmodule */
static void startsample()
Mix_PlayChannel(0, e_sfx->sam, e_sfx->repeats);
Mix_Volume(0, e_sfx->volume);
e_sfx->active = 1;
-}
+} /* startsample */
static void startmodule()
Mix_PlayMusic(e_mod->mod, e_mod->repeats);
Mix_VolumeMusic(e_mod->volume);
e_mod->active = 1;
-}
+} /* startmodule */
static EFFECT *getaiff(FILE * f, size_t pos, int len, int num)
return NULL;
}
return res;
-}
+} /* getaiff */
static EFFECT *getmodule(FILE * f, size_t pos, int len, int num)
return NULL;
}
return res;
-}
+} /* getmodule */
static EFFECT *geteffect(int num)
sf_freeresource(&res);
return result;
-}
+} /* geteffect */
+
/* sound handling */
return;
/* theWnd->FlushDisplay();
::MessageBeep(MB_ICONEXCLAMATION);*/
-}
+} /* os_beep */
/*
if (!SFaudiorunning)
return;
os_stop_sample(number);
-}
+} /* os_finish_with_sample */
/*
{
if (!SFaudiorunning)
return;
-}
+} /* os_prepare_sample */
/*
e_mod = e;
startmodule();
}
-}
+} /* os_start_sample */
/*
stopsample();
if ((e_mod) && (e_mod->number == number))
stopmodule();
-}
+} /* os_stop_sample */
void sf_checksound()
end_of_sound();
}
}
-}
+} /* sf_checksound */
/*************************************/
n->next = cflist;
cflist = n;
}
-}
+} /* sf_regcleanfunc */
void sf_cleanup_all()
free(cflist);
cflist = n;
}
-}
+} /* sf_cleanup_all */
/*
}
sf_cleanup_all();
-}
+} /* os_reset_screen */
+
+
/*
* os_quit
*
exit(status);
} /* os_quit */
+
int user_background = -1;
int user_foreground = -1;
int user_emphasis = -1;
puts(info_footer);
puts(footer);
-}
+} /* usage */
/*
if (v > M)
return M;
return v;
-}
+} /* limit */
static void parse_options(int argc, char **argv)
printf(" The core and SDL port are maintained by David Griffith.\n");
printf(" Frotz's homepage is https://661.org/proj/if/frotz/\n\n");
os_quit(EXIT_SUCCESS);
-}
+} /* print_version */
/**
char *p = strdup(path), *p2 = strdup(dirname(p));
free(p);
return p2;
-}
+} /* new_dirname */
/**
char *p = strdup(path), *p2 = strdup(basename(p));
free(p);
return p2;
-}
+} /* new_basename */
/*
void sf_sleep(int msecs)
{
SDL_Delay(msecs);
-}
+} /* sf_sleep */
+
#ifdef WIN32
zlong sf_ticks(void)
(now.tv_sec - start.tv_sec) * 1000 + (now.tv_usec -
start.tv_usec) / 1000;
return ticks;
-}
+} /* sf_ticks */
#endif
ext = EXT_COMMAND;
return ext;
-}
+} /* getextension */
static bool newfile(int flag)
if (flag == FILE_SAVE || flag == FILE_SAVE_AUX || flag == FILE_RECORD)
return true;
return false;
-}
+} /* newfile */
static char buf[FILENAME_MAX];
break;
}
return buf;
-}
+} /* getnumbername */
static const char *getdatename(const char *def, char *ext)
tm->tm_year + 1900, tm->tm_mon + 1, tm->tm_mday,
tm->tm_hour, tm->tm_min, ext);
return buf;
-}
+} /* getdatename */
static int ingame_read_file_name(char *file_name, const char *default_name,
}
return strdup(file_name);
-}
+} /* os_read_file_name */
static int ingame_read_file_name(char *file_name, const char *default_name,
ostream_record = saved_record;
return result;
-} /* os_read_file_name */
+} /* ingame_read_file_name */
static int dialog_read_file_name(char *file_name, const char *default_name,
return 1;
}
return 0;
-}
+} /* dialog_read_file_name */
static char *rc = NULL;
return;
free(rc);
rc = NULL;
-}
+} /* sf_FinishProfile */
void sf_InitProfile(const char *fn)
*d = 0;
CLEANREG(sf_FinishProfile);
-}
+} /* sf_InitProfile */
static char *findsect(const char *sect)
return (r + ns);
}
return NULL;
-}
+} /* findsect */
static char *findid(const char *sect, const char *id)
if (sav)
*sav = '[';
return fnd;
-}
+} /* findid */
int sf_GetProfileInt(const char *sect, const char *id, int def)
def = atoi(p);
}
return def;
-}
+} /* sf_GetProfileInt */
double sf_GetProfileDouble(const char *sect, const char *id, double def)
def = atof(p);
}
return def;
-}
+} /* sf_GetProfileDouble */
char *sf_GetProfileString(const char *sect, const char *id, char *def)
if (sav)
*q = sav;
return def;
-}
+} /* sf_GetProfileString */
/* A. Local file header:
static unsigned myin(void *d, zbyte ** b)
{
return 0;
-}
+} /* myin */
static int myout(void *udata, zbyte * b, unsigned n)
memmove(udata, b, n);
udata += n;
return 0;
-}
+} /* myout */
static int myunzip(int csize, zbyte * cdata, zbyte * udata)
st = inflateBackEnd(&z);
return st;
-}
+} /* myunzip */
int sf_pkread(FILE * f, int foffs, void **out, int *size)
*out = (void *)data;
*size = usize;
return st;
-}
+} /* sf_pkread */
/*
xmax = x + w;
ymin = y;
ymax = y + h;
-}
+} /* sf_setclip */
void sf_getclip(int *x, int *y, int *w, int *h)
*y = ymin;
*w = xmax - xmin;
*h = ymax - ymin;
-}
+} /* sf_getclip */
static int mywcslen(zchar * b)
while (*b++)
n++;
return n;
-}
+} /* mywcslen */
static void myGrefresh()
SDL_RenderClear(renderer);
SDL_RenderCopy(renderer, texture, NULL, NULL);
SDL_RenderPresent(renderer);
-}
+} /* myGrefresh */
void sf_wpixel(int x, int y, zlong c)
return;
sbuffer[x + sbpitch * y] = c;
dirty = 1;
-}
+} /* sf_wpixel */
zlong sf_rpixel(int x, int y)
if (x < 0 || x >= ewidth || y < 0 || y >= eheight)
return 0;
return sbuffer[x + sbpitch * y];
-}
+} /* sf_rpixel */
#define MAXCUR 64
static zlong savedcur[MAXCUR];
sf_wpixel(x, y + i, savedcur[i]);
}
}
-}
+} /* drawthecursor */
bool sf_IsValidChar(zword c)
if (c >= 0x100)
return true;
return false;
-}
+} /* sf_IsValidChar */
void sf_drawcursor(bool c)
{
SF_textsetting *ts = sf_curtextsetting();
drawthecursor(ts->cx, ts->cy, c);
-}
+} /* sf_drawcursor */
void sf_chline(int x, int y, zlong c, int n)
while (n--)
*s++ = c;
dirty = 1;
-}
+} /* sf_chline */
void sf_cvline(int x, int y, zlong c, int n)
s += sbpitch;
}
dirty = 1;
-}
+} /* sf_cvline */
zlong sf_blendlinear(int a, zlong s, zlong d)
d >>= 8;
r |= (((s & 0xff) * a + (d & 0xff) * (256 - a)) >> 8) << 16;
return r;
-}
+} /* sf_blendlinear */
void sf_writeglyph(SF_glyph * g)
ts->cx += (w);
ts->oh = (weff > w) ? weff - w : 0;
-}
+} /* sf_writeglyph */
void sf_fillrect(zlong color, int x, int y, int w, int h)
dst += sbpitch;
}
dirty = 1;
-}
+} /* sf_fillrect */
void sf_rect(zlong color, int x, int y, int w, int h)
sf_chline(x, y + h - 1, color, w);
sf_cvline(x, y, color, h);
sf_cvline(x + w - 1, y, color, h);
-}
+} /* sf_rect */
void sf_flushtext()
SF_textsetting *ts = sf_curtextsetting();
ts->cx += ts->oh;
ts->oh = 0;
-}
+} /* sf_flushtext */
/*
sf_flushtext();
sf_fillrect((sf_curtextsetting())->back, left - 1, top - 1,
right - left + 1, bottom - top + 1);
-}
+} /* os_erase_area */
/*
SF_textsetting *ts = sf_curtextsetting();
sf_flushtext();
return sf_GetColourIndex(sf_rpixel(ts->cx, ts->cy));
-}
+} /* os_peek_colour */
static void scroll(int x, int y, int w, int h, int n)
}
dirty = 1;
}
-}
+} /* scroll */
/**
return true;
} else
return false;
-}
+} /* sf_flushdisplay */
/*
else if (units < 0)
sf_fillrect((sf_curtextsetting())->back, left - 1, top - 1,
right - left + 1, units);
-}
+} /* os_scroll_area */
bool os_repaint_window(int win, int ypos_old, int ypos_new, int xpos,
{
/* TODO */
return FALSE;
-}
+} /* os_repaint_window */
int SFdticks = 200;
event.user.type = refreshEventType;
SDL_PushEvent(&event);
return inter;
-}
+} /* mytimer */
static void cleanvideo()
if (timerid)
SDL_RemoveTimer(timerid);
SDL_Quit();
-}
+} /* cleanvideo */
#define RM 0x0000ff
#define GM 0x00ff00
SDL_SetWindowSize(window, AcWidth, AcHeight);
myGrefresh();
}
-}
+} /* sf_toggle_fullscreen */
void sf_initvideo(int W, int H, int full)
ymax = eheight = H;
sbpitch = W;
dirty = 1;
-}
+} /* sf_initvideo */
/*
}
dirty = 1;
-}
+} /* os_draw_picture */
static zlong mytimeout;
* SDL maps mouse events to logical coordinates. */
mouse_x = x + 1;
mouse_y = y + 1;
-}
+} /* set_mouse_xy */
/**
res |= (str[i] & 077);
}
return res;
-}
+} /* decode_utf8 */
static void handle_window_event(SDL_Event * e)
case SDL_WINDOWEVENT_EXPOSED:
myGrefresh();
}
-}
+} /* handle_window_event */
static zword goodzkey(SDL_Event * e, int allowed)
handle_window_event(e);
}
return 0;
-}
+} /* goodzkey */
zword sf_read_key(int timeout, bool cursor, bool allowed, bool text)
sf_drawcursor(false);
return inch;
-}
+} /* sf_read_key */
/*
zchar os_read_key(int timeout, int cursor)
{
return sf_read_key(timeout, cursor, false, true);
-}
+} /* os_read_key */
/*
sf_checksound();
sf_sleep(10);
}
-}
+} /* os_read_line */
/* Draw the current input line */
void sf_DrawInput(zchar * buffer, int pos, int ptx, int pty, int width,
/* Update the window */
sf_flushdisplay();
-}
+} /* sf_DrawInput */
/*
btn |= 4;
return btn;
-}
+} /* os_read_mouse */
/*
/* Restore the current text position */
sf_poptextsettings();
}
-}
+} /* os_more_prompt */
zlong *sf_savearea(int x, int y, int w, int h)
s += sbpitch;
}
return r;
-}
+} /* sf_savearea */
void sf_restoreareaandfree(zlong * s)
free(s);
dirty = 1;
sf_flushdisplay();
-}
+} /* sf_restoreareaandfree */
int (*sf_osdialog)(bool ex, const char *def, const char *filt, const char *tit,
sbuffer, sbpitch, ewidth, eheight,
isfullscreen);
return SF_NOTIMP;
-}
+} /* sf_user_fdialog */
void sf_videodata(zlong ** sb, int *sp, int *ew, int *eh)
*sp = sbpitch;
*ew = ewidth;
*eh = eheight;
-}
+} /* sf_videodata */
extern zword sf_yesnooverlay(int xc, int yc, char *t, int sr);
SDL_Quit();
os_quit(EXIT_SUCCESS);
}
-}
+} /* sf_quitconf */
void os_tick()
handle_window_event(&ev);
}
}
-}
+} /* os_tick */
/* Apply the picture's palette to the screen palette. */
}
}
return changed;
-}
+} /* ApplyPalette */