Remove commented-out old code and debugging printf()s.
authorDavid Griffith <dave@661.org>
Tue, 24 Sep 2019 01:31:43 +0000 (18:31 -0700)
committerDavid Griffith <dave@661.org>
Tue, 24 Sep 2019 01:31:43 +0000 (18:31 -0700)
src/sdl/sf_fonts.c
src/sdl/sf_frotz.h
src/sdl/sf_ftype.c
src/sdl/sf_images.c
src/sdl/sf_osfdlg.c
src/sdl/sf_resource.c

index c8caaba4c4a9e6831d4a0081b882c79e8a60041b..0cd05b79be57542ed9dabfe1ef3904c0f7e097ba 100644 (file)
@@ -5,21 +5,7 @@
 #include <string.h>
 #include <unistd.h>
 
-// font handling
-
-/*
-struct sfontstruct {
-  int refcount;
-  void (*destroy)(SFONT *);
-  int (*height)(SFONT *);
-  int (*ascent)(SFONT *);
-  int (*descent)(SFONT *);
-  int (*minchar)(SFONT *);
-  int (*maxchar)(SFONT *);
-  int (*hasglyph)(SFONT *,int,int);
-  SF_glyph *(*getglyph)(SFONT *,int,int);
-  };
-*/
+/* font handling */
 
 typedef struct {
        int refcount;
@@ -160,7 +146,6 @@ static SF_bdffont *sBDXload(FILE * f, int *err, int *size, int MAXCHAR)
                        if (!hasenc)
                                ERRET(-10)
                                sscanf(p, "%d %d", wh, wh + 1);
-/* printf("c%d %d\n",k,((wh[0]+7)/8)*wh[1] + sizeof(SF_glyph)); */
                        if (k <= MAXCHAR) {
                                totb +=
                                    ((wh[0] + 7) / 8) * wh[1] +
@@ -170,34 +155,20 @@ static SF_bdffont *sBDXload(FILE * f, int *err, int *size, int MAXCHAR)
                        hasenc = 0;
                }
        }
-//printf("nchars=%d minch=%d maxch=%d\n",nchars,minch,maxch);
-//printf("sizeof(SF_glyph)=%d\n",sizeof(SF_glyph));
-//  printf("<%s>\n",fontname);
-//  printf("<%s>\n",copyright);
-//  printf("dc%d a%d d%d %d..%d exp%d read%d totb%d\n",
-//      defchar,ascent,descent,minch,maxch,nchars,i,totb);
        if (ascent < 0 || descent < 0 || nchars != i)
                ERRET(-2)
-//    errorexit(99,"??? dc%d a%d d%d %d..%d exp%d read%d\n",
-//      defchar,ascent,descent,minch,maxch,nchars,k);
                if (defchar < minch || defchar > maxch) {
-//      printf("WARNING: defchar=%d, set to",defchar);
                        if (defchar < minch)
                                defchar = minch;
                        if (defchar > maxch)
                                defchar = maxch;
-//      printf(" %d\n",defchar);
                }
-//  nchars = i;
        totb +=
            (maxch - minch + 1) * sizeof(int) + sizeof(SF_bdffont) +
            strlen(fontname) + strlen(copyright) + 2;
-//  printf("totb %d\n",totb);
        font = calloc(1, totb);
        if (!font)
-               ERRET(-3)       // errorexit(99,"malloc()\n");
-//printf("allocated: %p-%p\n",font,((byte *)font)+totb);
-//  memmove(&(font->magic[0]),"gBDX",4);
+               ERRET(-3)
        font->minchar = minch;
        font->maxchar = maxch;
        font->defchar = defchar;
@@ -230,7 +201,7 @@ static SF_bdffont *sBDXload(FILE * f, int *err, int *size, int MAXCHAR)
                for (;;) {
                        fgets(s, 1024, f);
                        if (feof(f))
-                               ERRET(-81) /* errorexit(99,"unexpected EOF c=%d\n",i); */
+                               ERRET(-81)
                                if ((p = starts(s, "ENCODING "))) {
                                        i = atoi(p);
                                        i &= 0xffff;
@@ -264,16 +235,14 @@ static SF_bdffont *sBDXload(FILE * f, int *err, int *size, int MAXCHAR)
                                bg->xof = wh[2];
                                bg->yof = wh[3];
                                po = (byte *) (&(bg->bitmap[0]));
-//printf("k=%d ch=%d delta=%d\n",k,i,po-(byte *)bg);
                                for (j = 0; j < h; j++) {
                                        fgets(s, 1024, f);
                                        if (feof(f))
-                                               ERRET(-91)      // errorexit(99,"unexpected EOF c=%d (B)\n",i);
+                                               ERRET(-91)
                                                    gethex(s, po, w);
                                        po += w;
                                }
                        }
-//printf("used %d nextpo %p\n",po-pbeg-font->glyphs[i-minch],po);
        }
        *err = 0;
        *size = totb;
@@ -434,18 +403,19 @@ static SFONT *loadfont(char *fname, int *err, int *size)
 }
 
 
-// these are the 8 fonts needed
-// PROPORTIONAL FONT
-//   ROMAN
-//   ROMAN BOLD
-//   ITALIC
-//   ITALIC BOLD
-// FIXED FONT
-//   ROMAN
-//   ROMAN BOLD
-//   ITALIC
-//   ITALIC BOLD
-
+/*
+ * these are the 8 fonts needed
+ * PROPORTIONAL FONT
+ *   ROMAN
+ *   ROMAN BOLD
+ *   ITALIC
+ *   ITALIC BOLD
+ * FIXED FONT
+ *   ROMAN
+ *   ROMAN BOLD
+ *   ITALIC
+ *   ITALIC BOLD
+ */
 #define NUMFONTS 9
 
 static SFONT *myfonts[9] =
@@ -573,10 +543,7 @@ int os_char_width(zchar c)
 static void setfont(int zfont)
 {
        int k = styleidx(zfont, current.style);
-//printf("%d.",k);
        current.font = myfonts[k];
-//  if (k < 4) zfont = TEXT_FONT;
-//  else zfont = FIXED_WIDTH_FONT;
        current.zfontnum = zfont;
        current.proportional = (k < 4);
 }
@@ -638,7 +605,6 @@ int os_font_data(int font, int *height, int *width)
  */
 void os_set_font(int new_font)
 {
-//printf("os_set_font(%d)\n",new_font);
        sf_flushtext();
        setfont(new_font);
 }
@@ -740,9 +706,7 @@ void os_display_char(zchar c)
                SF_glyph *g;
                setfont(current.zfontnum);
                g = current.font->getglyph(current.font, c, 1);
-//printf("{%c}%d.%p/%p",c,current.zfontnum,current.font,g);
                if (g) {
-//printf("[%c]\n",c); fflush(stdout);
                        sf_writeglyph(g);
                        m_exitPause = true;
                }
@@ -800,7 +764,6 @@ void os_window_height(int win, int height)
 void os_set_cursor(int row, int col)
 {
        sf_flushtext();
-//      theWnd->ResetOverhang();
        current.cx = col - 1;
        current.cy = row - 1;
 }
@@ -871,16 +834,15 @@ void sf_initfonts()
        SFONT *Norm, *Emph = NULL, *Bold = NULL, *Bemp = NULL;
 
        norm = SF_defaultfont;
-//dumpfont(norm);
        sf_VGA_SFONT = Norm = makefont(norm);
        if (!Norm)
                os_fatal("malloc() failure in initfonts()");
        Norm->destroy = destroySFonly;
 
-       // get size of default font
+       /* get size of default font */
        size = SF_defaultfontsize;
 
-       // copy norm to emphasized
+       /* copy norm to emphasized */
        emph = malloc(size);
        if (!emph)
                os_fatal("malloc() failure in initfonts()");
@@ -888,7 +850,7 @@ void sf_initfonts()
        if (!Emph)
                os_fatal("malloc() failure in initfonts()");
        memmove(emph, norm, size);
-       // emphasize (underline)...
+       /* emphasize (underline)... */
        cfont = (byte *) emph;
        for (i = norm->minchar; i <= norm->maxchar; i++) {
                int m = norm->glyphs[i - norm->minchar];
@@ -898,7 +860,7 @@ void sf_initfonts()
                bmp = (byte *) (&(g->bitmap[0]));
                bmp[g->h - 2] = 0xff;
        }
-       // make a copy for bold
+       /* make a copy for bold */
        bold = malloc(size);
        if (!bold)
                os_fatal("malloc() failure in initfonts()");
@@ -906,7 +868,7 @@ void sf_initfonts()
        if (!Bold)
                os_fatal("malloc() failure in initfonts()");
        memmove(bold, norm, size);
-       // boldify...
+       /* boldify... */
        cfont = (byte *) bold;
        for (i = norm->minchar; i <= norm->maxchar; i++) {
                int h, m = norm->glyphs[i - norm->minchar];
@@ -948,9 +910,6 @@ void sf_initfonts()
        myfonts[3] = myfonts[7] = Bemp;
        bemp->refcount = 2;
 
-//  for (i=0;i<8;i++) myfonts[i] = SF_defaultfont;
-//  SF_defaultfont->refcount = 9;
-
        CLEANREG(cleanfonts);
 
        if (!m_vga_fonts) {
@@ -979,8 +938,6 @@ void sf_initfonts()
                else
                        myfonts[8] = SF_font3double;
        }
-//for (i=0;i<8;i++){ SFONT *s = myfonts[i]; printf("%d %p %d %d %d %d %d\n",
-//i,s,s->minchar(s),s->maxchar(s),s->ascent(s),s->descent(s),s->height(s));}
 }
 
 
@@ -1010,7 +967,6 @@ char *sf_searchfile(char *fn, int fnlen, char *buf, char *paths)
                plen = strlen(buf);
                strncpy(buf + plen, fn, fnlen);
                buf[plen + fnlen] = 0;
-//printf("try[%s]\n",buf);
                if (access(buf, F_OK) == 0)
                        return buf;
                if (p)
index 0f862a344eff97e8e4d2de990c0ad436643e68fd..b2c7305893ff5e8fb06f19139c3b4600a7dbc046 100644 (file)
@@ -4,13 +4,9 @@
 #include "../common/frotz.h"
 #include "../blorb/blorb.h"
 
-// typedef unsigned char byte;
-// typedef unsigned short word;
-// typedef unsigned long ulong;
 #include <stdint.h>
 typedef uint8_t byte;
 typedef uint16_t word;
-// typedef uint32_t ulong;
 #define ulong uint32_t
 
 typedef struct {
@@ -57,10 +53,6 @@ int colour_in_use(zword colour);
 
 /*  various data */
 extern bool m_tandy;
-//      CRect m_wndSize;
-//      CString m_propFontName;
-//      CString m_fixedFontName;
-//      int m_fontSize;
 extern int m_v6scale;
 extern int m_gfxScale;
 extern ulong m_defaultFore;
@@ -70,14 +62,7 @@ extern ulong m_nonStdColours[NON_STD_COLS];
 extern int m_nonStdIndex;
 extern bool m_exitPause;
 extern bool m_lineInput;
-//extern bool   m_IsInfocomV6;
-//      bool m_fastScroll;
 extern bool m_morePrompts;
-//      int m_leftMargin;
-//      int m_rightMargin;
-//      FILE* m_blorbFile;
-//      bb_map_t* m_blorbMap;
-//      GameInfo m_gameInfo;
 extern int AcWidth;
 extern int AcHeight;
 extern int m_random_seed;
@@ -97,13 +82,13 @@ extern double m_gamma;
 
 extern bool sdl_active;
 
-// sf_resource.c
+/* sf_resource.c */
 
-// must be called as soon as possible (i.e. by os_process_arguments())
+/* must be called as soon as possible (i.e. by os_process_arguments()) */
 int sf_load_resources(char *givenfn);
 
 typedef struct {
-       int number;             // 0 means unallocated
+       int number;     /* 0 means unallocated */
        int width, height;
        byte *pixels;
        ulong palette[16];
@@ -117,7 +102,6 @@ typedef struct {
 
 void sf_setgamma(double gamma);
 
-//int sf_loadpic( int num, sf_picture *gfx);
 
 /* get pointer from cache */
 sf_picture *sf_getpic(int num);
@@ -286,27 +270,3 @@ struct CONVstruct {
 };
 
 #endif
-
-/*** screen window ***/
-/*
-typedef struct {
-    zword y_pos;
-    zword x_pos;
-    zword y_size;
-    zword x_size;
-    zword y_cursor;
-    zword x_cursor;
-    zword left;
-    zword right;
-    zword nl_routine;
-    zword nl_countdown;
-    zword style;
-    zword colour;
-    zword font;
-    zword font_size;
-    zword attribute;
-    zword line_count;
-    zword true_fore;
-    zword true_back;
-} Zwindow;
-*/
index 3b3f169a5ef657a857790a758232536890c210a9..d7fa95a08b9bd9c2e246d810933b744726f33070 100644 (file)
@@ -189,19 +189,13 @@ static void setglyph(MYFONT * f, FT_Face face, int ch)
        res = calloc(1, sizeof(SF_glyph) + nbypr * bitmap->rows);
        if (!res)
                return;
-       for (i = 0; i < bitmap->rows; i++)
-               for (j = 0; j < nbypr; j++)
+       for (i = 0; i < bitmap->rows; i++) {
+               for (j = 0; j < nbypr; j++) {
                        res->bitmap[i * nbypr + j] =
                            bitmap->buffer[i * bitmap->pitch + j];
+               }
+       }
 
-//printf("%c %d %p  w%d\n",ch,bitmap->pitch,res,bitmap->width);
-//{
-//int i,j; unsigned char *p = &(res->bitmap[0]);
-//for (i=0;i<bitmap->rows;i++){
-//  for (j=0;j<nbypr;j++) printf("%02x",*p++);
-//  printf("\n");
-//  }
-//}
        res->w = bitmap->width;
        res->h = bitmap->rows;
        res->dx = slot->advance.x / 64;
index 37435f4e602b7c037a99e65fc2010487a171ab12..f609bbecfe59f6481567ffbfd5c0308229fcb8a6 100644 (file)
@@ -13,7 +13,6 @@
 
 #include "../blorb/blorblow.h"
 
-// static double m_gamma = DEFAULT_GAMMA;
 static byte toLinear[256];
 static byte fromLinear[256];
 
@@ -201,6 +200,7 @@ struct JPEGErrorInfo {
        jmp_buf errorJump;
 };
 
+
 static void errorJPEGExit(j_common_ptr cinfo)
 {
        struct JPEGErrorInfo *error = (struct JPEGErrorInfo *)cinfo->err;
@@ -208,16 +208,18 @@ static void errorJPEGExit(j_common_ptr cinfo)
        longjmp(error->errorJump, 1);
 }
 
+
 static void outputJPEGMessage(j_common_ptr cinfo)
 {
        char buffer[JMSG_LENGTH_MAX];
        (*cinfo->err->format_message) (cinfo, buffer);
-//  TRACE("JPEG: %s\n",buffer);
 }
 
+
 /* Memory Data Source */
 static void memJPEGInit(j_decompress_ptr unused)
 {
+       /* Nothing here */
 }
 
 
@@ -241,6 +243,7 @@ static void memJPEGSkipInput(j_decompress_ptr cinfo, long num_bytes)
 
 static void memJPEGTerm(j_decompress_ptr unused)
 {
+       /* Nothing here */
 }
 
 
index 55d4b658616303b026ee4c7386d00532e81389f6..42402a6a2e1fcf4f3bd36c402914d7da33a9cfc5 100644 (file)
@@ -204,14 +204,12 @@ STATIC void writetext(ulong color, const char *s, int x, int y, int w,
        int ox, oy, ow, oh;
        int wtext, htext;
        os_font_data(0, &htext, &wtext);
-//printf("W %p [%s]\n",s,s ? s : "??");
        if (!s)
                return;
        if (!s[0])
                return;
        sf_getclip(&ox, &oy, &ow, &oh);
        sf_setclip(x, y, w, htext);
-//printf("1\n");
        if (center) {
 #ifdef USE_UTF8
                int wt = wtext * utf8_len(s);
@@ -220,11 +218,9 @@ STATIC void writetext(ulong color, const char *s, int x, int y, int w,
 #endif
                x += (w - wt) / 2;
        }
-//printf("2 ts %p\n",ts); fflush(stdout); if (ts < 1000){sf_flushdisplay(); getchar();}
        ts->cx = x;
        ts->cy = y;
        ts->fore = color;
-//printf("3\n"); fflush(stdout);
 #ifndef USE_UTF8
        while (*s)
                sf_writeglyph(ts->font->
@@ -236,9 +232,7 @@ STATIC void writetext(ulong color, const char *s, int x, int y, int w,
                sf_writeglyph(ts->font->getglyph(ts->font, ch, 1));
        }
 #endif
-//printf("4\n");
        sf_setclip(ox, oy, ow, oh);
-//printf("5\n");
 }
 
 
@@ -360,7 +354,7 @@ STATIC int myosdialog(bool existing, const char *def, const char *filt,
        zword c = 0;
        int wtext, htext, buttw;
 
-       // allow system-specific dialog if not fullscreen
+       /* Allow system-specific dialog if not fullscreen */
        if (isfull == 0)
                if (sf_sysdialog)
                        return sf_sysdialog(existing, def, filt, tit, res);
@@ -369,8 +363,6 @@ STATIC int myosdialog(bool existing, const char *def, const char *filt,
        if (!ts)
                return SF_NOTIMP;
 
-//printf("0 ts %p (%p)\n",ts,&ts);
-
        if (!def)
                def = "";
        strcpy(filename, def);
@@ -423,7 +415,7 @@ STATIC int myosdialog(bool existing, const char *def, const char *filt,
        X = (ew - W) / 2;
        Y = (eh - H) / 2;
 
-       // internal!!
+       /* Internal!! */
        xdlg = X + SPC + 2 * BFRAME;
        ydlg = Y + 2 * SPC + 4 * BFRAME + htext + htext;
 
@@ -433,7 +425,6 @@ STATIC int myosdialog(bool existing, const char *def, const char *filt,
        if (!saved)
                return SF_NOTIMP;
 
-//printf("saved: %p %d %d %d %d\n",saved,saved[0],saved[1],saved[2],saved[3]);
        sf_pushtextsettings();
 #ifndef USE_UTF8
        ts->font = sf_VGA_SFONT;
@@ -446,7 +437,6 @@ STATIC int myosdialog(bool existing, const char *def, const char *filt,
        ts->backTransparent = 1;
 
        sf_fillrect(O_GRAY2, X, Y, W, H);
-//  frame_upframe(X,Y,W,H);
        sf_rect(FRAMECOLOR, X, Y, W, H);
        sf_rect(FRAMECOLOR, X + 1, Y + 1, W - 2, H - 2);
        sf_fillrect(FRAMECOLOR, X, Y + 2, W, htext);
@@ -510,7 +500,6 @@ STATIC int myosdialog(bool existing, const char *def, const char *filt,
        cleanlist(curdir);
        curdir = NULL;
 
-//printf("2saved: %p %d %d %d %d\n",saved,saved[0],saved[1],saved[2],saved[3]);
        sf_restoreareaandfree(saved);
 
        if (c == ZC_ESCAPE)
@@ -526,6 +515,7 @@ STATIC int myosdialog(bool existing, const char *def, const char *filt,
        return SF_NOTIMP;
 }
 
+
 void sf_setdialog(void)
 {
        sf_osdialog = myosdialog;
@@ -544,7 +534,6 @@ void sf_setdialog(void)
 #endif
 #include <unistd.h>
 #include <dirent.h>
-//#include <fnmatch.h>
 #include <sys/stat.h>
 
 
@@ -675,13 +664,10 @@ STATIC ENTRY *dodir(char *dirname, char *pattern, char *resdir, int size,
        struct stat fst;
        int n;
 
-//printf("\ndodir\n");
        if (!resolvedir(dirname, resdir, size))
                return NULL;
        resdend = resdir + strlen(resdir);
 
-//printf("[%s]\n",resdir);
-       // MinGW opendir() does not like the final slash
 #ifdef WIN32
        n = strlen(resdir);
        if (n > 2 && (resdir[n - 2] != ':'))
@@ -694,7 +680,6 @@ STATIC ENTRY *dodir(char *dirname, char *pattern, char *resdir, int size,
        if (!dir)
                return NULL;
 
-//printf("opened [%s]\n",resdir);
        for (;;) {
                d = readdir(dir);
                if (!d)
@@ -705,14 +690,11 @@ STATIC ENTRY *dodir(char *dirname, char *pattern, char *resdir, int size,
                if (strcmp(p, "..") == 0)
                        continue;
                strcpy(resdend, p);
-//printf("-%s\n",resdir);
                if (stat(resdir, &fst))
                        continue;
-//printf("--mode %x\n",fst.st_mode);
                if (S_ISDIR(fst.st_mode))
                        addentry(p, &dirs);
                else {
-//printf("--fnmatch: %d\n",fnmatch(pattern,p,0));
                        if (myfnmatch(pattern, p, 0) == 0)
                                addentry(p, &files);
                }
index 6a4831e71db5354189703023b39e767e6f3fd285..40e982edcf304a05e1b6dcdd32b2ee1405ed5700 100644 (file)
@@ -4,7 +4,7 @@
 #include <stdlib.h>
 #include <string.h>
 
-// for access()
+/* for access() */
 #include <unistd.h>
 
 #include <stdarg.h>
@@ -18,13 +18,8 @@ zword hx_flags;
 zword hx_fore_colour;
 zword hx_back_colour;
 
-// various data
-
+/* various data */
 bool m_tandy = 0;
-//      CRect m_wndSize;
-//      CString m_propFontName;
-//      CString m_fixedFontName;
-//      int m_fontSize;
 int m_v6scale;
 int m_gfxScale = 1;
 ulong m_defaultFore;
@@ -35,13 +30,7 @@ int m_nonStdIndex;
 bool m_exitPause = 0;
 bool m_lineInput = 0;
 bool m_IsInfocomV6 = false;
-//      bool m_fastScroll;
 bool m_morePrompts = 1;
-//      int m_leftMargin;
-//      int m_rightMargin;
-//      FILE* m_blorbFile;
-//      bb_map_t* m_blorbMap;
-//      GameInfo m_gameInfo;
 bool m_localfiles = false;
 char *m_fontdir = NULL;
 bool m_aafonts = 0;
@@ -76,8 +65,7 @@ static void checkwidths()
        bb_resolution_t *reso;
        reso = bb_get_resolution(bmap);
        if (reso) {
-//printf("get_resolution: %dx%d\n",reso->px,reso->py);
-               // ignore small resolution hints
+               /* ignore small resolution hints */
                if ((reso->px) && (reso->px >= AcWidth))
                        AcWidth = reso->px;
                if ((reso->py) && (reso->py >= AcHeight))
@@ -150,10 +138,9 @@ static int checkfile(char *fn, char *ofn)
 }
 
 
-// must be called as soon as possible (i.e. by os_process_arguments())
+/* must be called as soon as possible (i.e. by os_process_arguments()) */
 static int load_resources(char *givenfn)
 {
-
        char buf[FILENAME_MAX + 1], *p;
        int st;
        FILE *f;
@@ -161,31 +148,32 @@ static int load_resources(char *givenfn)
 
        CLEANREG(sf_cleanup_resources);
 
-       // first check whether file exists
+       /* first check whether file exists */
        st = checkfile(givenfn, buf);
        if (st)
                os_fatal("File not found");
 
-       // check whether it is a story file
+       /* check whether it is a story file */
        f = fopen(buf, "rb");
        if (!f)
                os_fatal("File open failed");
 
        fread(hd2, 1, 2, f);
 
-       // blorb file ?
+       /* blorb file ? */
        if (hd2[0] == 'F' && hd2[1] == 'O') {
                bb_result_t result;
                fclose(f);
                if (tryloadblorb(buf))
                        os_fatal("File is neither Zcode nor Blorb");
-               // Look for an executable chunk
+               /* Look for an executable chunk */
                if (bb_load_resource
                    (bmap, bb_method_FilePos, &result, bb_ID_Exec, 0)
                    == bb_err_None) {
                        unsigned int id = bmap->chunks[result.chunknum].type;
                        if (id == bb_ID_ZCOD) {
-                               // If this is a Z-code game, set the file pointer and return
+                               /* If this is a Z-code game,
+                                * set the file pointer and return */
                                zoffset = result.data.startpos;
                                zsize = result.length;
                                zcodeinblorb = 1;
@@ -194,25 +182,25 @@ static int load_resources(char *givenfn)
                                os_fatal(sf_msgstring(IDS_BLORB_GLULX));
                        }
                }
-               // we are given a blorb file with no executable chunck
-               // Tell the user that there was no game in the Blorb file
+               /* we are given a blorb file with no executable chunck
+                * Tell the user that there was no game in the Blorb file */
                os_fatal(sf_msgstring(IDS_BLORB_NOEXEC));
        }
-       // check if possibly Zcode
+       /* check if possibly Zcode */
        if (hd2[0] < 1 || hd2[0] > 8)
                os_fatal("Not a Zcode file (or wrong version)");
 
-       // OK, assume a bona fide Z code file
+       /* OK, assume a bona fide Z code file */
        zfile = f;
        fseek(f, 0, SEEK_END);
        zsize = ftell(f);
        zoffset = 0;
 
-       // See if the user explicitly provided a blorb file
+       /* See if the user explicitly provided a blorb file */
        if (f_setup.blorb_file != NULL) {
                tryloadblorb(f_setup.blorb_file);
        } else {
-               // No?  Let's see if we can find one.
+               /* No?  Let's see if we can find one. */
                p = malloc(strlen(f_setup.story_name) +
                           strlen(EXT_BLORB4) * sizeof(char));
                strncpy(p, f_setup.story_name, strlen(f_setup.story_name) + 1);
@@ -234,7 +222,7 @@ static int load_resources(char *givenfn)
 
 static void load_local_resources();
 
-// must be called as soon as possible (i.e. by os_process_arguments())
+/* must be called as soon as possible (i.e. by os_process_arguments()) */
 int sf_load_resources(char *givenfn)
 {
        int st;
@@ -257,12 +245,12 @@ int sf_load_resources(char *givenfn)
 }
 
 
-// this routine is only used for the Z code, so we can safely
-// ignore its args
-// NOTE that there is an extra argument (as in WindowsFrotz version)
+/* this routine is only used for the Z code, so we can safely
+ * ignore its args
+ * NOTE that there is an extra argument (as in WindowsFrotz version)
+ */
 FILE *os_path_open(const char *name, const char *mode, long *size)
 {
-
        FILE *f = NULL;
 
        *size = zsize;
@@ -305,7 +293,6 @@ int os_picture_data(int picture, int *height, int *width)
                        }
                }
        }
-
        *height = 0;
        *width = 0;
        return 0;
@@ -344,21 +331,19 @@ void os_menu(int action, int menu, const zword * text)
  * Return an appropriate random seed value in the range from 0 to
  * 32767, possibly by using the current system time.
  *
+ * this is a provisional workaround (time granularity is at best 1s)
  */
-// this is a provisional workaround (time granularity is at best 1s)
 #include <time.h>
 int os_random_seed(void)
 {
-//  return ::GetTickCount() & 32767;
        if (m_random_seed == -1) {
                return ((int)(time(NULL))) & 32767;
        }
        return m_random_seed;
 }
 
-// The following assumes Unicode
-
 
+/* The following assumes Unicode */
 /*
  * os_scrollback_char
  *
@@ -367,17 +352,15 @@ int os_random_seed(void)
  */
 void os_scrollback_char(zword c)
 {
-//      theApp.ScrollbackChar(c);
        if (option_scrollback_buffer == 0)
                return;
        if (c == 13)
                c = 10;
-       if (option_scrollback_buffer == 1)      // latin-1
-       {
+       if (option_scrollback_buffer == 1) {    /* Latin-1 */
                if (c > 255)
                        c = '?';
                putchar(c);
-       } else {                // UTF8
+       } else {                /* UTF8 */
                if (c < 0x80)
                        putchar(c);
                else {
@@ -399,7 +382,6 @@ void os_scrollback_erase(int erase)
        if (option_scrollback_buffer)
                while (erase--)
                        putchar(8);
-//      theApp.ScrollbackRemove(erase);
 }
 
 
@@ -416,7 +398,7 @@ void os_scrollback_erase(int erase)
  */
 void os_restart_game(int stage)
 {
-       // Show Beyond Zork's title screen
+       /* Show Beyond Zork's title screen */
        if ((stage == RESTART_END) && (story_id == BEYOND_ZORK)) {
                int w, h;
                if (os_picture_data(1, &h, &w)) {
@@ -437,18 +419,18 @@ void sf_initcolours()
 
        sf_setgamma(m_gamma);
 
-       // Standard Z-Machine colours
-       m_colours[0] = RGB5ToTrue(0x0000);      // black
-       m_colours[1] = RGB5ToTrue(0x001D);      // red
-       m_colours[2] = RGB5ToTrue(0x0340);      // green
-       m_colours[3] = RGB5ToTrue(0x03BD);      // yellow
-       m_colours[4] = RGB5ToTrue(0x59A0);      // blue
-       m_colours[5] = RGB5ToTrue(0x7C1F);      // magenta
-       m_colours[6] = RGB5ToTrue(0x77A0);      // cyan
-       m_colours[7] = RGB5ToTrue(0x7FFF);      // white
-       m_colours[8] = RGB5ToTrue(0x5AD6);      // light grey
-       m_colours[9] = RGB5ToTrue(0x4631);      // medium grey
-       m_colours[10] = RGB5ToTrue(0x2D6B);     // dark grey
+       /* Standard Z-Machine colours */
+       m_colours[0]  = RGB5ToTrue(0x0000);     /* black */
+       m_colours[1]  = RGB5ToTrue(0x001D);     /* red */
+       m_colours[2]  = RGB5ToTrue(0x0340);     /* green */
+       m_colours[3]  = RGB5ToTrue(0x03BD);     /* yellow */
+       m_colours[4]  = RGB5ToTrue(0x59A0);     /* blue */
+       m_colours[5]  = RGB5ToTrue(0x7C1F);     /* magenta */
+       m_colours[6]  = RGB5ToTrue(0x77A0);     /* cyan */
+       m_colours[7]  = RGB5ToTrue(0x7FFF);     /* white */
+       m_colours[8]  = RGB5ToTrue(0x5AD6);     /* light grey */
+       m_colours[9]  = RGB5ToTrue(0x4631);     /* medium grey */
+       m_colours[10] = RGB5ToTrue(0x2D6B);     /* dark grey */
 
        for (i = 0; i < NON_STD_COLS; i++)
                m_nonStdColours[i] = 0xFFFFFFFF;
@@ -457,7 +439,7 @@ void sf_initcolours()
 }
 
 
-// Read in settings
+/* Read in settings */
 void sf_readsettings(void)
 {
        char *p;
@@ -480,11 +462,10 @@ void sf_readsettings(void)
        ResPict = sf_GetProfileString("Resources", "Pict", ResPict);
        ResSnd = sf_GetProfileString("Resources", "Snd", ResSnd);
 
-//printf("sf_readsettings\n");
-       if (f_setup.interpreter_number == 0)
+       if (f_setup.interpreter_number == 0) {
                h_interpreter_number =
                    sf_GetProfileInt("Interpreter", "Number", INTERP_AMIGA);
-       else
+       else
                h_interpreter_number = f_setup.interpreter_number;
 
        f_setup.err_report_mode =
@@ -505,58 +486,33 @@ void sf_readsettings(void)
        AcHeight = sf_GetProfileInt("Window", "AcHeight", AcHeight);
 
        m_frequency = sf_GetProfileInt("Audio", "Frequency", m_frequency);
-
-//  m_filename = sf_GetProfileString("Files","Initial Game","");
-//  m_register = sf_GetProfileInt("Files","Register File Types",0) ? true : false;
-
-/*     m_wndSize.left = sf_GetProfileInt("Window","Left",0);
-       m_wndSize.top = sf_GetProfileInt("Window","Top",0);
-       m_wndSize.right = sf_GetProfileInt("Window","Right",0);
-       m_wndSize.bottom = sf_GetProfileInt("Window","Bottom",0);
-       m_wndState = sf_GetProfileInt("Window","State",SW_SHOWNORMAL);
-
-       m_toolBar = sf_GetProfileInt("Window","Toolbar",1) ? true : false;
-       m_statusBar = sf_GetProfileInt("Window","Status Bar",1) ? true : false;
-       m_notifyFull = sf_GetProfileInt("Window","Notify Full Screen",1) ? true : false;
-
-       m_propFontName = sf_GetProfileString("Display","Proportional Font Name",
-               GetDefaultFont());
-       m_fixedFontName = sf_GetProfileString("Display","Fixed Font Name",
-               "Courier New");
-       m_fontSize = sf_GetProfileInt("Display","Font Size",10);*/
-
        m_v6scale = sf_GetProfileInt("Display", "Infocom V6 Scaling", 2);
        m_gfxScale = 1;
        m_defaultFore = (sf_GetProfileInt("Display", "Foreground", 0xffffff));
        m_defaultBack = (sf_GetProfileInt("Display", "Background", 0x800000));
-//printf("mdff%d mdfb%d\n",m_defaultFore,m_defaultBack);
-//  m_fastScroll = sf_GetProfileInt("Display","Fast Scrolling",0) ? true : false;
        m_morePrompts =
            sf_GetProfileInt("Display", "Show More Prompts", 1) ? true : false;
-//  m_leftMargin = sf_GetProfileInt("Display","Left Margin",0);
-//  m_rightMargin = sf_GetProfileInt("Display","Right Margin",0);
        m_gamma = sf_GetProfileDouble("Display", "Gamma", DEFAULT_GAMMA);
        sf_initcolours();
 
        sf_FinishProfile();
-
 }
 
 
-// Get a colour
+/* Get a colour */
 ulong sf_GetColour(int colour)
 {
-       // Standard colours
+       /* Standard colours */
        if ((colour >= BLACK_COLOUR) && (colour <= DARKGREY_COLOUR))
                return m_colours[colour - BLACK_COLOUR];
 
-       // Default colours
+       /* Default colours */
        if (colour == 16)
                return m_defaultFore;
        if (colour == 17)
                return m_defaultBack;
 
-       // Non standard colours
+       /* Non standard colours */
        if ((colour >= 18) && (colour < 256)) {
                if (m_nonStdColours[colour - 18] != 0xFFFFFFFF)
                        return m_nonStdColours[colour - 18];
@@ -565,7 +521,7 @@ ulong sf_GetColour(int colour)
 }
 
 
-// Get a default colour
+/* Get a default colour */
 ulong sf_GetDefaultColour(bool fore)
 {
        if (m_IsInfocomV6)
@@ -574,29 +530,29 @@ ulong sf_GetDefaultColour(bool fore)
 }
 
 
-// Get an index for a non-standard colour
+/* Get an index for a non-standard colour */
 int sf_GetColourIndex(ulong colour)
 {
        int i, index = -1;
-       // Is this a standard colour?
+       /* Is this a standard colour? */
        for (i = 0; i < 11; i++) {
                if (m_colours[i] == colour)
                        return i + BLACK_COLOUR;
        }
 
-       // Is this a default colour?
+       /* Is this a default colour? */
        if (m_defaultFore == colour)
                return 16;
        if (m_defaultBack == colour)
                return 17;
 
-       // Is this colour already in the table?
+       /* Is this colour already in the table? */
        for (i = 0; i < NON_STD_COLS; i++) {
                if (m_nonStdColours[i] == colour)
                        return i + 18;
        }
 
-       // Find a free colour index
+       /* Find a free colour index */
        while (index == -1) {
                if (colour_in_use(m_nonStdIndex + 18) == 0) {
                        m_nonStdColours[m_nonStdIndex] = colour;
@@ -641,8 +597,6 @@ void os_set_colour(int new_foreground, int new_background)
 {
        SF_textsetting *ts = sf_curtextsetting();
        sf_flushtext();
-//      theWnd->ResetOverhang();
-//printf("os_set_colour %d %d\n",new_foreground,new_background);
        if (new_foreground == 1)
                ts->fore = sf_GetDefaultColour(true);
        else if (new_foreground < 256)
@@ -655,9 +609,6 @@ void os_set_colour(int new_foreground, int new_background)
                ts->back = sf_GetColour(new_background);
        ts->backDefault = (new_background == 1);
        ts->backTransparent = (new_background == 15);
-
-//printf("os_set_colour %d %d %x %x\n",new_foreground,new_background,ts->fore,ts->back);
-//      theWnd->ApplyTextSettings();
 }
 
 
@@ -715,13 +666,13 @@ void os_init_screen(void)
 
        sf_initvideo(AcWidth, AcHeight, (m_fullscreen != -1));
 
-       // Set the graphics scaling
+       /* Set the graphics scaling */
        if (sf_IsInfocomV6() || (story_id == BEYOND_ZORK))
                m_gfxScale = m_v6scale;
        else
                m_gfxScale = 1;
 
-       // Set the configuration
+       /* Set the configuration */
        if (h_version == V3) {
                h_config |= CONFIG_SPLITSCREEN;
                h_config |= CONFIG_PROPORTIONAL;
@@ -759,8 +710,6 @@ void os_init_screen(void)
        os_set_font(FIXED_WIDTH_FONT);
        os_set_text_style(0);
 
-/*     theWnd->ApplyTextSettings(
-               FrotzWnd::TextSettings(0,FIXED_WIDTH_FONT));*/
        {
                int H, W;
                os_font_data(FIXED_WIDTH_FONT, &H, &W);
@@ -773,7 +722,7 @@ void os_init_screen(void)
        h_screen_cols = (zbyte) (h_screen_width / h_font_width);
        h_screen_rows = (zbyte) (h_screen_height / h_font_height);
 
-       // Check for sound
+       /* Check for sound */
        if ((h_version == V3) && (h_flags & OLD_SOUND_FLAG)) {
                if (((bmap == NULL) && (m_localfiles == 0))
                    || (!sf_initsound()))
@@ -789,7 +738,7 @@ void os_init_screen(void)
                if (h_version == V6)
                        mask |= TRANSPARENT_FLAG;
 
-               // Mask out any unsupported bits in the extended flags
+               /* Mask out any unsupported bits in the extended flags */
                hx_flags &= mask;
 
                hx_fore_colour = TrueToRGB5(sf_GetDefaultColour(true));
@@ -807,8 +756,6 @@ void os_init_screen(void)
 void os_fatal(const char *s, ...)
 {
        va_list m;
-//      if (theWnd != NULL)
-//              theWnd->FlushDisplay();
 
        fprintf(stderr, "\n%s: ", sf_msgstring(IDS_FATAL));
        va_start(m, s);
@@ -846,13 +793,10 @@ void os_fatal(const char *s, ...)
        }
        sf_cleanup_all();
        exit(EXIT_FAILURE);
-
-//      ::MessageBox(AfxGetMainWnd()->GetSafeHwnd(),s,CResString(IDS_FATAL),MB_ICONERROR|MB_OK);
-//      throw FrotzApp::AbortFrotz();
 }
 
 
-// If true, running one of Infocom's V6 games
+/* If true, running one of Infocom's V6 games */
 bool sf_IsInfocomV6()
 {
        switch (story_id) {
@@ -868,7 +812,7 @@ bool sf_IsInfocomV6()
 }
 
 
-// If true, this picture has an adaptive palette
+/* If true, this picture has an adaptive palette */
 bool sf_IsAdaptive(int picture)
 {
        bb_result_t result;
@@ -1014,7 +958,7 @@ int sf_getresource(int num, int ispic, int method, myresource * res)
                usage = bb_ID_Pict;
        else
                usage = bb_ID_Snd;
-       //XXX Should use bb_load_resource_{pict,snd} with auxdata?
+       /* XXX Should use bb_load_resource_{pict,snd} with auxdata? */
        st = bb_load_resource(bmap, method, (bb_result_t *) res, usage, num);
        if (st == bb_err_None) {
                res->type = bmap->chunks[res->bbres.chunknum].type;
@@ -1024,7 +968,7 @@ int sf_getresource(int num, int ispic, int method, myresource * res)
        return st;
 }
 
-/////////////////
+/***************/
 
 typedef struct {
        void *next;