diff --git a/polymer/eduke32/source/anim.c b/polymer/eduke32/source/anim.c
index 87a9d067d..e4c1ad913 100644
--- a/polymer/eduke32/source/anim.c
+++ b/polymer/eduke32/source/anim.c
@@ -197,7 +197,7 @@ void endanimvol43(long fr)
     }
 }
 
-void playanm(char *fn,char t)
+void playanm(const char *fn,char t)
 {
     char *animbuf;
     unsigned char *palptr;
@@ -216,7 +216,7 @@ void playanm(char *fn,char t)
         goto ENDOFANIMLOOP;
     }
 
-    handle = kopen4load(fn,0);
+    handle = kopen4load((char *)fn,0);
     if (handle == -1) return;
     length = kfilelength(handle);
 
diff --git a/polymer/eduke32/source/config.c b/polymer/eduke32/source/config.c
index 25d33006f..a54d8ebca 100644
--- a/polymer/eduke32/source/config.c
+++ b/polymer/eduke32/source/config.c
@@ -142,13 +142,8 @@ int32 CONFIG_FunctionNameToNum(char * func)
 char * CONFIG_FunctionNumToName(int32 func)
 {
     if ((unsigned)func >= (unsigned)NUMGAMEFUNCTIONS)
-    {
         return NULL;
-    }
-    else
-    {
-        return gamefunctions[func];
-    }
+    return gamefunctions[func];
 }
 
 /*
diff --git a/polymer/eduke32/source/funct.h b/polymer/eduke32/source/funct.h
index 7444e55e4..12c8b41aa 100644
--- a/polymer/eduke32/source/funct.h
+++ b/polymer/eduke32/source/funct.h
@@ -30,14 +30,14 @@ Modifications for JonoF's port by Jonathon Fowler (jonof@edgenetwk.com)
 
 struct player_struct;     // JBF: duke3d.h defines this later
 
-extern void sendscore(char *s);
+extern void sendscore(const char *s);
 extern void SoundStartup(void);
 extern void SoundShutdown(void);
 extern void MusicStartup(void);
 extern void MusicShutdown(void);
 extern void intomenusounds(void);
-extern void playmusic(char *fn);
-extern char loadsound(unsigned short num);
+extern void playmusic(const char *fn);
+extern int loadsound(unsigned short num);
 extern int xyzsound(short num,short i,long x,long y,long z);
 extern void sound(short num);
 extern int spritesound(unsigned short num,short i);
@@ -61,26 +61,26 @@ extern int getanimationgoal(long *animptr);
 extern int setanimation(short animsect,long *animptr,long thegoal,long thevel);
 extern void animatecamsprite(void);
 extern void animatewalls(void);
-extern char activatewarpelevators(short s,short d);
+extern int activatewarpelevators(short s,short d);
 extern void operatesectors(short sn,short ii);
 extern void operaterespawns(int low);
 extern void operateactivators(int low,int snum);
 extern void operatemasterswitches(int low);
 extern void operateforcefields(short s,int low);
-extern char checkhitswitch(int snum,long w,int switchtype);
+extern int checkhitswitch(int snum,long w,int switchtype);
 extern void activatebysector(short sect,short j);
 extern void checkhitwall(short spr,short dawallnum,long x,long y,long z,short atwith);
 extern void checkplayerhurt(struct player_struct *p,short j);
-extern char checkhitceiling(short sn);
+extern int checkhitceiling(short sn);
 extern void checkhitsprite(short i,short sn);
 extern void allignwarpelevators(void);
 extern void sharedkeys(int snum);
 extern void checksectors(int snum);
-extern int32 RTS_AddFile(char *filename);
-extern void RTS_Init(char *filename);
+extern int32 RTS_AddFile(const char *filename);
+extern void RTS_Init(const char *filename);
 extern int32 RTS_NumSounds(void);
 extern int32 RTS_SoundLength(int32 lump);
-extern char *RTS_GetSoundName(int32 i);
+extern const char *RTS_GetSoundName(int32 i);
 extern void RTS_ReadLump(int32 lump,void *dest);
 extern void *RTS_GetSound(int32 lump);
 extern void docacheit(void);
@@ -108,25 +108,25 @@ extern void getinput(int snum);
 extern void checkweapons(struct player_struct *p);
 extern void processinput(int snum);
 extern void cmenu(int cm);
-extern void savetemp(char *fn,long daptr,long dasiz);
+extern void savetemp(const char *fn,long daptr,long dasiz);
 // extern int loadpheader(char spot,int32 *vn,int32 *ln,int32 *psk,int32 *numplr);
 extern int loadplayer(signed char spot);
 extern int saveplayer(signed char spot);
-extern inline int menutext(int x,int y,short s,short p,char *t);
-extern int getfilenames(char *path, char kind[]);
+extern inline int menutext(int x,int y,short s,short p,const char *t);
+extern int getfilenames(const char *path, char kind[]);
 extern void menus(void);
 extern void palto(char r,char g,char b,long e);
-extern void playanm(char *fn,char);
+extern void playanm(const char *fn,char);
 extern int getincangle(int a,int na);
 extern void getglobalz(int iActor);
 extern void makeitfall(int iActor);
-extern void loadefs(char *fn);
+extern void loadefs(const char *fn);
 extern int furthestangle(int iActor,int angs);
 extern void execute(int iActor,int iPlayer,long lDist);
 extern void overwritesprite(long thex,long they,short tilenum,signed char shade,char stat,char dapalnum);
-extern inline int gametext(int x,int y,char *t,char s,short dabits);
-extern inline int gametextpal(int x,int y,char *t,char s,char p);
-extern inline int minitext(int x,int y,char *t,char p,short sb);
+extern inline int gametext(int x,int y,const char *t,char s,short dabits);
+extern inline int gametextpal(int x,int y,const char *t,char s,char p);
+extern inline int minitext(int x,int y,const char *t,char p,short sb);
 extern void gamenumber(long x,long y,long n,char s);
 extern void Shutdown(void);
 extern void getpackets(void);
@@ -138,14 +138,14 @@ extern void myos(long x,long y,int tilenum,int shade,int orientation);
 extern void myospal(long x,long y,int tilenum,int shade,int orientation,int p);
 extern void displayfragbar(void);
 extern void FTA(short q,struct player_struct *p);
-extern void gameexit(char *t);
+extern void gameexit(const char *t);
 extern inline int strget(short x,short y,char *t,short dalen,short c);
 extern void displayrest(long smoothratio);
 extern void updatesectorz(long x,long y,long z,short *sectnum);
 extern void drawbackground(void);
 extern void displayrooms(int snum,long smoothratio);
 extern int EGS(int whatsect,long s_x,long s_y,long s_z,int s_pn,int s_s,int s_xr,int s_yr,int s_a,int s_ve,long s_zv,int s_ow,int s_ss);
-extern char wallswitchcheck(short i);
+extern int wallswitchcheck(short i);
 extern int spawn(int j,int pn);
 extern void animatesprites(long x,long y,short a,long smoothratio);
 extern int main(int argc,char **argv);
@@ -201,8 +201,8 @@ extern inline void setstatusbarscale(long sc);
 extern void setgamepalette(struct player_struct *player, char *pal, int set);
 extern void fadepal(int r, int g, int b, int start, int end, int step);
 
-extern inline int minitextshade(int x,int y,char *t,char s,char p,short sb);
-extern inline int gametext_(int small, int starttile, int x,int y,char *t,char s,char p,short orientation,long x1, long y1, long x2, long y2);
+extern inline int minitextshade(int x,int y,const char *t,char s,char p,short sb);
+extern inline int gametext_(int small, int starttile, int x,int y,const char *t,char s,char p,short orientation,long x1, long y1, long x2, long y2);
 extern void txdigitalnumber(short starttile, long x,long y,long n,char s,char pal,char cs,long x1, long y1, long x2, long y2);
 extern void myosx(long x,long y,int tilenum,int shade,int orientation);
 extern void myospalx(long x,long y,int tilenum,int shade,int orientation,int p);
@@ -210,13 +210,13 @@ extern void ResetGameVars(void);
 extern void ResetActorGameVars(int iActor);
 
 extern void setupdynamictostatic();
-extern void processnames(char *szLabel, long lValue);
+extern void processnames(const char *szLabel, long lValue);
 
 extern void LoadActor(long sActor);
 
-extern long GetGameVar(char *szGameLabel, long lDefault, int iActor, int iPlayer);
+extern long GetGameVar(const char *szGameLabel, long lDefault, int iActor, int iPlayer);
 extern void DumpGameVars(FILE *fp);
-extern void AddLog(char *psz);
+extern void AddLog(const char *psz);
 
 extern void ResetSystemDefaults(void);
 extern void InitGameVarPointers(void);
@@ -226,7 +226,7 @@ extern int ReadGameVars(long fil);
 
 extern long GetGameVarID(int id, int iActor, int iPlayer);
 extern void SetGameVarID(int id, long lValue, int iActor, int iPlayer);
-extern char AddGameVar(char *pszLabel, long lValue, unsigned long dwFlags);
+extern int AddGameVar(const char *pszLabel, long lValue, unsigned long dwFlags);
 extern void ReportError(int iError);
 
 extern void onvideomodechange(int newmode);
@@ -240,8 +240,8 @@ extern void updateplayer(void);
 extern void sendboardname(void);
 extern void sendquit(void);
 
-extern void adduserquote(char *daquote);
-extern char *stripcolorcodes(char *t);
+extern void adduserquote(const char *daquote);
+extern const char *stripcolorcodes(const char *t);
 extern void mpchangemap(char volume, char level);
 
 extern inline int checkspriteflags(int iActor, int iType);
diff --git a/polymer/eduke32/source/game.c b/polymer/eduke32/source/game.c
index 6bfa85bfd..3b522070c 100644
--- a/polymer/eduke32/source/game.c
+++ b/polymer/eduke32/source/game.c
@@ -134,11 +134,11 @@ long tempwallptr;
 long nonsharedtimer;
 
 static void cameratext(short i);
-static char moveloop(void);
+static int moveloop(void);
 static void doorders(void);
 static void fakedomovethings(void);
 static void fakedomovethingscorrect(void);
-static char domovethings(void);
+static int domovethings(void);
 static long playback(void);
 
 enum
@@ -258,7 +258,7 @@ void setgamepalette(struct player_struct *player, char *pal, int set)
 
 #define TEXTWRAPLEN (scale(35,ScreenWidth,320))
 
-char *stripcolorcodes(char *t)
+const char *stripcolorcodes(const char *t)
 {
     int i = 0;
 
@@ -278,14 +278,14 @@ char *stripcolorcodes(char *t)
     return(colstrip);
 }
 
-int gametext_(int small, int starttile, int x,int y,char *t,char s,char p,short orientation,long x1, long y1, long x2, long y2)
+int gametext_(int small, int starttile, int x,int y,const char *t,char s,char p,short orientation,long x1, long y1, long x2, long y2)
 {
     short ac,newx,oldx=x;
     char centre, *oldt;
 
     centre = (x == (320>>1));
     newx = 0;
-    oldt = t;
+    oldt = (char *)t;
 
     if (t == NULL)
         return -1;
@@ -356,31 +356,31 @@ int gametext_(int small, int starttile, int x,int y,char *t,char s,char p,short
         if ((*t >= '0' && *t <= '9'))
             x += 8;
         else x += tilesizx[ac];//(tilesizx[ac]>>small);
-        if (t-oldt >= (signed)TEXTWRAPLEN-!small) oldt = t, x = oldx, y+=8;
+        if (t-oldt >= (signed)TEXTWRAPLEN-!small) oldt = (char *)t, x = oldx, y+=8;
         t++;
     }
 
     return (x);
 }
 
-inline int gametext(int x,int y,char *t,char s,short dabits)
+inline int gametext(int x,int y,const char *t,char s,short dabits)
 {
     return(gametext_(0,STARTALPHANUM, x,y,t,s,0,dabits,0, 0, xdim-1, ydim-1));
 }
 
-inline int gametextpal(int x,int y,char *t,char s,char p)
+inline int gametextpal(int x,int y,const char *t,char s,char p)
 {
     return(gametext_(0,STARTALPHANUM, x,y,t,s,p,26,0, 0, xdim-1, ydim-1));
 }
 
-inline int mpgametext(int y,char *t,char s,short dabits)
+inline int mpgametext(int y,const char *t,char s,short dabits)
 {
     if (xdim >= 640 && ydim >= 480)
         return(gametext_(1,STARTALPHANUM, 5,y,t,s,0,dabits,0, 0, xdim-1, ydim-1));
     return(gametext_(0,STARTALPHANUM, 5,y,t,s,0,dabits,0, 0, xdim-1, ydim-1));
 }
 
-static int minitext_(int x,int y,char *t,char s,char p,short sb)
+static int minitext_(int x,int y,const char *t,char s,char p,short sb)
 {
     short ac;
     char ch,cmode;
@@ -408,12 +408,12 @@ static int minitext_(int x,int y,char *t,char s,char p,short sb)
     return (x);
 }
 
-inline int minitextshade(int x,int y,char *t,char s,char p,short sb)
+inline int minitextshade(int x,int y,const char *t,char s,char p,short sb)
 {
     return (minitext_(x,y,(char *)stripcolorcodes(t),s,p,sb));
 }
 
-inline int minitext(int x,int y,char *t,char p,short sb)
+inline int minitext(int x,int y,const char *t,char p,short sb)
 {
     return (minitext_(x,y,(char *)stripcolorcodes(t),0,p,sb));
 }
@@ -455,7 +455,7 @@ static void allowtimetocorrecterrorswhenquitting(void)
     }
 }
 
-void adduserquote(char *daquote)
+void adduserquote(const char *daquote)
 {
     long i;
 
@@ -2329,7 +2329,7 @@ static void tics(void)
                 if (ud.multimode > 4)
                     k += 8;
             }
-            Bsprintf(b,"%ld",j>0?j:0);
+            Bsprintf(b,"%ld",max(j,0));
             minitext(320-strlen(b)*4,k+1,b,(timer*AVERAGEFRAMES)/(i-frameval[framecnt]) < 40?2:0,26);
 
             if (numplayers > 1)
@@ -2396,8 +2396,8 @@ static void operatefta(void)
     j = quotebot;
     for (i=0;i<MAXUSERQUOTES;i++)
     {
+        if (user_quote_time[i] <= 0) break;    
         k = user_quote_time[i];
-        if (k <= 0) break;
         l = Bstrlen(user_quote[i]);
         while (l > TEXTWRAPLEN)
         {
@@ -2418,6 +2418,13 @@ static void operatefta(void)
 
     if (ps[screenpeek].fta <= 1) return;
 
+    if (fta_quotes[ps[screenpeek].ftq] == NULL)
+    {
+        OSD_Printf("%s %d null quote %d\n",__FILE__,__LINE__,ps[screenpeek].ftq);
+        return;
+    }
+
+    k = 0;
     if (GTFLAGS(GAMETYPE_FLAG_FRAGBAR) && ud.screen_size > 0 && ud.multimode > 1)
     {
         j = 0;
@@ -2429,11 +2436,10 @@ static void operatefta(void)
         else if (j > 8 && j <= 12) k += 16;
         else if (j > 12) k += 24;
     }
-    else k = 0;
 
     if (ps[screenpeek].ftq == 115 || ps[screenpeek].ftq == 116 || ps[screenpeek].ftq == 117)
     {
-        k = quotebot-8;
+        k = quotebot-8-4;
         /*        for(i=0;i<MAXUSERQUOTES;i++)
                 {
                     if (user_quote_time[i] <= 0) break;
@@ -2444,14 +2450,8 @@ static void operatefta(void)
                         l -= TEXTWRAPLEN;
                         k -= 8;
                     }
-                } */
-        k -= 4;
-    }
-
-    if (fta_quotes[ps[screenpeek].ftq] == NULL)
-    {
-        OSD_Printf("%s %d null quote %d\n",__FILE__,__LINE__,ps[screenpeek].ftq);
-        return;
+                }
+                k -= 4; */
     }
 
     j = ps[screenpeek].fta;
@@ -2465,29 +2465,31 @@ static void operatefta(void)
 
 void FTA(short q,struct player_struct *p)
 {
-    if (fta_quotes[p->ftq] != NULL)
+    if (fta_quotes[p->ftq] == NULL)
     {
-        if (ud.fta_on == 1)
-        {
-            if (p->fta > 0 && q != 115 && q != 116)
-                if (p->ftq == 115 || p->ftq == 116) return;
-
-            p->fta = 100;
-
-            //            if(p->ftq != q || q == 26)
-            // || q == 26 || q == 115 || q ==116 || q == 117 || q == 122)
-            {
-                if (p->ftq != q)
-                    if (p == &ps[screenpeek])
-                        OSD_Printf("%s\n",stripcolorcodes(fta_quotes[q]));
-
-                p->ftq = q;
-                pub = NUMPAGES;
-                pus = NUMPAGES;
-            }
-        }
+        OSD_Printf("%s %d null quote %d\n",__FILE__,__LINE__,p->ftq);
+        return;
+    }
+
+    if (ud.fta_on == 0)
+        return;
+        
+    if (p->fta > 0 && q != 115 && q != 116)
+        if (p->ftq == 115 || p->ftq == 116) return;
+
+    p->fta = 100;
+
+    //            if(p->ftq != q || q == 26)
+    // || q == 26 || q == 115 || q ==116 || q == 117 || q == 122)
+    {
+        if (p->ftq != q)
+            if (p == &ps[screenpeek])
+                OSD_Printf("%s\n",stripcolorcodes(fta_quotes[q]));
+
+        p->ftq = q;
+        pub = NUMPAGES;
+        pus = NUMPAGES;
     }
-    else OSD_Printf("%s %d null quote %d\n",__FILE__,__LINE__,p->ftq);
 }
 
 void fadepal(int r, int g, int b, int start, int end, int step)
@@ -2531,7 +2533,7 @@ static void showtwoscreens(void)
 
 extern long qsetmode;
 
-void gameexit(char *t)
+void gameexit(const char *t)
 {
     if (*t != 0) ps[myconnectindex].palette = (char *) &palette[0];
 
@@ -2569,7 +2571,7 @@ void gameexit(char *t)
         //printf("\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n");
         if (!(t[0] == ' ' && t[1] == 0))
         {
-            wm_msgbox(HEAD2, t);
+            wm_msgbox(HEAD2, (char *)t);
         }
     }
 
@@ -3160,12 +3162,10 @@ void displayrest(long smoothratio)
     long a, i, j;
     char fader=0,fadeg=0,fadeb=0,fadef=0,tintr=0,tintg=0,tintb=0,tintf=0,dotint=0;
 
-    struct player_struct *pp;
+    struct player_struct *pp = &ps[screenpeek];
     walltype *wal;
     long cposx,cposy,cang;
 
-    pp = &ps[screenpeek];
-
 #if defined(USE_OPENGL) && defined(POLYMOST)
     // this takes care of fullscreen tint for OpenGL
     if (getrendermode() >= 3)
@@ -3467,17 +3467,14 @@ void displayrest(long smoothratio)
 
 static void view(struct player_struct *pp, long *vx, long *vy,long *vz,short *vsectnum, short ang, short horiz)
 {
-    spritetype *sp;
-    long i, nx, ny, nz, hx, hy, hitx, hity, hitz;
-    short bakcstat, hitsect, hitwall, hitsprite, daang;
+    spritetype *sp = &sprite[pp->i];
+    long i, hx, hy, hitx, hity, hitz;
+    long nx = (sintable[(ang+1536)&2047]>>4);
+    long ny = (sintable[(ang+1024)&2047]>>4);
+    long nz = (horiz-100)*128;
+    short hitsect, hitwall, hitsprite, daang;
+    short bakcstat = sp->cstat;
 
-    nx = (sintable[(ang+1536)&2047]>>4);
-    ny = (sintable[(ang+1024)&2047]>>4);
-    nz = (horiz-100)*128;
-
-    sp = &sprite[pp->i];
-
-    bakcstat = sp->cstat;
     sp->cstat &= (short)~0x101;
 
     updatesectorz(*vx,*vy,*vz,vsectnum);
@@ -4162,7 +4159,7 @@ int EGS(int whatsect,long s_x,long s_y,long s_z,int s_pn,int s_s,int s_xr,int s_
 {
     int i = insertsprite(whatsect,s_ss);
     long p;
-    spritetype *s;
+    spritetype *s = &sprite[i];
 
     if (i < 0)
     {
@@ -4175,8 +4172,6 @@ int EGS(int whatsect,long s_x,long s_y,long s_z,int s_pn,int s_s,int s_xr,int s_
     hittype[i].bposy = s_y;
     hittype[i].bposz = s_z;
 
-    s = &sprite[i];
-
     s->x = s_x;
     s->y = s_y;
     s->z = s_z;
@@ -4250,7 +4245,7 @@ int EGS(int whatsect,long s_x,long s_y,long s_z,int s_pn,int s_s,int s_xr,int s_
     return(i);
 }
 
-char wallswitchcheck(short i)
+int wallswitchcheck(short i)
 {
     int j;
     //MULTISWITCH has 4 states so deal with it separately
@@ -7128,7 +7123,7 @@ signed char cheatbuf[MAXCHEATLEN],cheatbuflen;
 static void cheats(void)
 {
     short ch, i, j, k=0, weapon;
-    static char z=0;
+    static int z=0;
     char consolecheat = 0;  // JBF 20030914
 
     if (osdcmd_cheatsinfo_stat.cheatnum != -1)
@@ -8097,17 +8092,17 @@ FAKE_F3:
     if (KB_KeyPressed(sc_F11))
     {
         KB_ClearKeyDown(sc_F11);
-        if (SHIFTS_IS_PRESSED) ud.brightness-=4;
-        else ud.brightness+=4;
+        if (SHIFTS_IS_PRESSED) ud.brightness-=8;
+        else ud.brightness+=8;
 
-        if (ud.brightness > (7<<2))
+        if (ud.brightness > (7<<3))
             ud.brightness = 0;
         else if (ud.brightness < 0)
-            ud.brightness = (7<<2);
+            ud.brightness = (7<<3);
 
         setbrightness(ud.brightness>>2,&ps[myconnectindex].palette[0],0);
-        if (ud.brightness < 20) FTA(29 + (ud.brightness>>2) ,&ps[myconnectindex]);
-        else if (ud.brightness < 40) FTA(96 + (ud.brightness>>2) - 5,&ps[myconnectindex]);
+        if (ud.brightness < 40) FTA(29 + (ud.brightness>>3) ,&ps[myconnectindex]);
+        else if (ud.brightness < 80) FTA(96 + (ud.brightness>>3) - 5,&ps[myconnectindex]);
     }
 }
 
@@ -9349,10 +9344,10 @@ static void Startup(long argc, char **argv)
         networkmode = 1;
 }
 
-void sendscore(char *s)
+void sendscore(const char *s)
 {
     if (numplayers > 1)
-        genericmultifunction(-1,s,strlen(s)+1,5);
+        genericmultifunction(-1,(char *)s,strlen(s)+1,5);
 }
 
 void sendwchoice(void)
@@ -10177,7 +10172,7 @@ MAIN_LOOP_RESTART:
 
 char demo_version;
 
-static char opendemoread(char which_demo) // 0 = mine
+static int opendemoread(char which_demo) // 0 = mine
 {
     char d[13];
     char ver;
@@ -10600,7 +10595,7 @@ RECHECK:
     return 1;
 }
 
-static char moveloop()
+static int moveloop()
 {
     long i;
 
@@ -11099,7 +11094,7 @@ ENDFAKEPROCESSINPUT:
     sprite[p->i].cstat = backcstat;
 }
 
-static char domovethings(void)
+static int domovethings(void)
 {
     int i, j;
     char ch;
diff --git a/polymer/eduke32/source/gamedef.c b/polymer/eduke32/source/gamedef.c
index 1ecbaaf0c..2def21d82 100644
--- a/polymer/eduke32/source/gamedef.c
+++ b/polymer/eduke32/source/gamedef.c
@@ -98,7 +98,7 @@ enum labeltypes
     LABEL_MOVE   = 32,
 };
 
-static char *labeltypenames[] =
+static const char *labeltypenames[] =
     {
         "define",
         "state",
@@ -108,7 +108,7 @@ static char *labeltypenames[] =
         "move"
     };
 
-static char *translatelabeltype(long type)
+static const char *translatelabeltype(long type)
 {
     int i;
     char x[64];
@@ -125,7 +125,7 @@ static char *translatelabeltype(long type)
 
 #define NUMKEYWORDS (signed int)(sizeof(keyw)/sizeof(keyw[0]))
 
-char *keyw[] = {
+static const char *keyw[] = {
                    "definelevelname",          // 0  defines level name
                    "actor",                    // 1  defines an actor
                    "addammo",                  // 2  adds ammo to a weapon
@@ -838,6 +838,7 @@ LABELS inputlabels[]= {
 static void skipcomments(void)
 {
     char c;
+    
     while ((c = *textptr))
     {
         if (c == ' ' || c == '\t' || c == '\r')
@@ -1041,7 +1042,7 @@ char CheckEventSync(int iEventID)
     return 1;
 }
 
-void AddLog(char *psz)
+void AddLog(const char *psz)
 {
     Bstrcpy(tempbuf,psz);
     if (tempbuf[Bstrlen(psz)] != '\n')
@@ -1050,7 +1051,7 @@ void AddLog(char *psz)
     else initprintf(tempbuf);
 }
 
-static long GetDefID(char *szGameLabel)
+static long GetDefID(const char *szGameLabel)
 {
     int i;
     for (i=0;i<iGameVarCount;i++)
@@ -1066,7 +1067,7 @@ static long GetDefID(char *szGameLabel)
     return -1;
 }
 
-static char ispecial(char c)
+static int ispecial(char c)
 {
     if (c == 0x0a)
     {
@@ -1085,7 +1086,7 @@ static inline int isaltok(char c)
     return (isalnum(c) || c == '{' || c == '}' || c == '/' || c == '*' || c == '-' || c == '_' || c == '.');
 }
 
-static long getlabelid(LABELS *pLabel, char *psz)
+static long getlabelid(LABELS *pLabel, const char *psz)
 {
     // find the label psz in the table pLabel.
     // returns the ID for the label, or -1
@@ -1104,7 +1105,7 @@ static long getlabelid(LABELS *pLabel, char *psz)
     return l;
 }
 
-static long getlabeloffset(LABELS *pLabel, char *psz)
+static long getlabeloffset(LABELS *pLabel, const char *psz)
 {
     // find the label psz in the table pLabel.
     // returns the offset in the array for the label, or -1
@@ -1293,13 +1294,10 @@ static void transvartype(int type)
             textptr++;
             return;
         }
-        else
-        {
-            error++;
-            ReportError(ERROR_NOTAGAMEVAR);
-            textptr++;
-            return;
-        }
+        error++;
+        ReportError(ERROR_NOTAGAMEVAR);
+        textptr++;
+        return;
     }
     if (type == GAMEVAR_FLAG_READONLY && aGameVars[i].dwFlags & GAMEVAR_FLAG_READONLY)
     {
@@ -1329,14 +1327,14 @@ static inline void transvar(void)
     transvartype(0);
 }
 
-static inline void transmultvarstype(int type, char num)
+static inline void transmultvarstype(int type, int num)
 {
-    char i;
+    int i;
     for (i=0;i<num;i++)
         transvartype(type);
 }
 
-static inline void transmultvars(char num)
+static inline void transmultvars(int num)
 {
     transmultvarstype(0,num);
 }
@@ -1382,7 +1380,7 @@ static long transnum(long type)
             {
                 if (!(error || warning) && condebug > 1)
                 {
-                    gl = translatelabeltype(labeltype[i]);
+                    gl = (char *)translatelabeltype(labeltype[i]);
                     initprintf("%s:%ld: debug: accepted %s label `%s'.\n",compilefile,line_number,gl,label+(i<<6));
                     Bfree(gl);
                 }
@@ -1392,8 +1390,8 @@ static long transnum(long type)
             }
             *(scriptptr++) = 0;
             textptr += l;
-            el = translatelabeltype(type);
-            gl = translatelabeltype(labeltype[i]);
+            el = (char *)translatelabeltype(type);
+            gl = (char *)translatelabeltype(labeltype[i]);
             ReportError(-1);
             initprintf("%s:%ld: warning: expected a %s, found a %s.\n",compilefile,line_number,el,gl);
             Bfree(el);
@@ -1425,22 +1423,17 @@ static long transnum(long type)
     return 0;   // literal value
 }
 
-static char parsecommand(void);
+static int parsecommand(void);
 
 static long CountCaseStatements()
 {
     long lCount;
-    char *temptextptr;
-    long *savescript;
-    long *savecase;
-    short temp_line_number;
-
-    temp_line_number=line_number;
+    char *temptextptr = textptr;
+    long *savescript = scriptptr;
+    long *savecase = casescriptptr;
+    int temp_line_number = line_number;
 
     casecount=0;
-    temptextptr=textptr;
-    savescript=scriptptr;
-    savecase=casescriptptr;
     casescriptptr=NULL;
     //Bsprintf(g_szBuf,"CSS: %.12s",textptr);
     //AddLog(g_szBuf);
@@ -1464,12 +1457,10 @@ static long CountCaseStatements()
     return lCount;
 }
 
-static char parsecommand(void)
+static int parsecommand(void)
 {
-    long i, j=0, k=0, *tempscrptr;
-    char done, *temptextptr;
-
-    long tw;
+    long i, j=0, k=0, *tempscrptr, done, tw;
+    char *temptextptr;
 
     if (((unsigned)(scriptptr-script) > MAXSCRIPTSIZE) && error == 0)
     {
@@ -1538,7 +1529,7 @@ static char parsecommand(void)
                 else
                 {
                     char *gl;
-                    gl = translatelabeltype(labeltype[j]);
+                    gl = (char *)translatelabeltype(labeltype[j]);
                     ReportError(-1);
                     initprintf("%s:%ld: warning: expected a state, found a %s.\n",compilefile,line_number,gl);
                     Bfree(gl);
@@ -1936,8 +1927,8 @@ static char parsecommand(void)
         tempbuf[j] = '\0';
 
         {
-            short temp_line_number;
-            char  temp_ifelse_check;
+            int temp_line_number;
+            int  temp_ifelse_check;
             char *origtptr, *mptr;
             char parentcompilefile[255];
             int fp;
@@ -3186,7 +3177,7 @@ static char parsecommand(void)
 
     case CON_DEFINEPROJECTILE:
     {
-        short y;
+        int y;
         signed long z;
 
         if (parsing_state || parsing_actor)
@@ -4455,7 +4446,7 @@ static void passone(void)
 }
 
 #define NUM_DEFAULT_CONS    4
-static char *defaultcons[NUM_DEFAULT_CONS] =
+static const char *defaultcons[NUM_DEFAULT_CONS] =
     {
         "EDUKE.CON",
         "GAME.CON",
@@ -4470,10 +4461,10 @@ void copydefaultcons(void)
 
     for (i=0;i<NUM_DEFAULT_CONS;i++)
     {
-        fpi = kopen4load(defaultcons[i] , 1);
+        fpi = kopen4load((char *)defaultcons[i] , 1);
         if (fpi < 0) continue;
 
-        fpo = fopenfrompath(defaultcons[i],"wb");
+        fpo = fopenfrompath((char *)defaultcons[i],"wb");
 
         if (fpo == NULL)
         {
@@ -4493,7 +4484,7 @@ void copydefaultcons(void)
 
 /* Anything added with AddDefinition cannot be overwritten in the CONs */
 
-static void AddDefinition(char *lLabel,long lValue,long lType)
+static void AddDefinition(const char *lLabel,long lValue,long lType)
 {
     Bstrcpy(label+(labelcnt<<6),lLabel);
     labeltype[labelcnt] = lType;
@@ -4647,7 +4638,7 @@ static void InitProjectiles(void)
     Bmemcpy(&defaultprojectile, &projectile, sizeof(projectile));
 }
 
-void loadefs(char *filenam)
+void loadefs(const char *filenam)
 {
     char *mptr;
     int i;
@@ -4675,7 +4666,7 @@ void loadefs(char *filenam)
         }
     }
     */
-    fp = kopen4load(filenam,loadfromgrouponly);
+    fp = kopen4load((char *)filenam,loadfromgrouponly);
     if (fp == -1) // JBF: was 0
     {
         if (loadfromgrouponly == 1)
diff --git a/polymer/eduke32/source/gamedef.h b/polymer/eduke32/source/gamedef.h
index 83cac6f76..c142475af 100644
--- a/polymer/eduke32/source/gamedef.h
+++ b/polymer/eduke32/source/gamedef.h
@@ -50,7 +50,6 @@ extern long g_kb;
 extern long g_looking_angSR1;
 extern int display_bonus_screen;
 extern long lastvisinc;
-extern void adduserquote(char *daquote);
 extern char cheatquotes[][MAXCHEATLEN];
 extern char compilefile[BMAX_PATH];
 extern int total_lines,line_number;
diff --git a/polymer/eduke32/source/gameexec.c b/polymer/eduke32/source/gameexec.c
index 12a3199d0..c753dc0d1 100644
--- a/polymer/eduke32/source/gameexec.c
+++ b/polymer/eduke32/source/gameexec.c
@@ -2450,7 +2450,7 @@ static void DoActor(int iSet, int lVar1, int lLabelID, int lVar2, int lParm2)
 
     if (iActor < 0 || iActor >= MAXSPRITES)
     {
-        OSD_Printf("DoActor(): invalid sprite (%d)\n",iActor);
+        OSD_Printf("DoActor(): invalid target sprite (%d) %d %d\n",iActor,g_i,g_sp->picnum);
         return;
     }
 
@@ -3014,6 +3014,12 @@ static int parse(void);
 
 void OnEvent(int iEventID, int iActor, int iPlayer, long lDist)
 {
+    if (iEventID >= MAXGAMEEVENTS)
+    {
+        AddLog("Invalid Event ID");
+        return;
+    }
+
     if (apScriptGameEvent[iEventID] == 0)
     {
         //Bsprintf(g_szBuf,"No event found for %d",iEventID);
@@ -3021,12 +3027,6 @@ void OnEvent(int iEventID, int iActor, int iPlayer, long lDist)
         return;
     }
 
-    if (iEventID >= MAXGAMEEVENTS)
-    {
-        AddLog("Invalid Event ID");
-        return;
-    }
-
     {
         int og_i=g_i, og_p=g_p, okillit_flag=killit_flag;
         long og_x=g_x, *og_t=g_t, *oinsptr=insptr;
@@ -3070,21 +3070,20 @@ void OnEvent(int iEventID, int iActor, int iPlayer, long lDist)
     }
 }
 
-static long ifsquished(int i, int p)
+static int ifsquished(int i, int p)
 {
     sectortype *sc = &sector[SECT];
     int squishme;
-    long floorceildist = sc->floorz - sc->ceilingz;
 
     if (PN == APLAYER && ud.clipping)
         return 0;
 
     if (sc->lotag != 23)
     {
-        squishme = floorceildist < (12<<8); // && (sc->lotag&32768) == 0;
+        squishme = (sc->floorz - sc->ceilingz < (12<<8)); // && (sc->lotag&32768) == 0;
 
         if (sprite[i].pal == 1)
-            squishme = floorceildist < (32<<8) && (sc->lotag&32768) == 0;
+            squishme = (sc->floorz - sc->ceilingz < (32<<8) && (sc->lotag&32768) == 0);
     }
     else squishme = 0;
 
@@ -3212,13 +3211,11 @@ int furthestcanseepoint(int iActor,spritetype *ts,long *dax,long *day)
 
 void getglobalz(int iActor)
 {
-    long hz,lz,zr;
-
     spritetype *s = &sprite[iActor];
 
     if (s->statnum == 10 || s->statnum == 6 || s->statnum == 2 || s->statnum == 1 || s->statnum == 4)
     {
-        zr = 127L;
+        long hz,lz,zr = 127L;
 
         if (s->statnum == 4)
             zr = 4L;
@@ -3261,7 +3258,7 @@ void getglobalz(int iActor)
 void makeitfall(int iActor)
 {
     spritetype *s = &sprite[iActor];
-    long hz,lz,c;
+    long hz,lz,c = gc;
 
     if (floorspace(s->sectnum))
         c = 0;
@@ -3269,7 +3266,6 @@ void makeitfall(int iActor)
     {
         if (ceilingspace(s->sectnum) || sector[s->sectnum].lotag == 2)
             c = gc/6;
-        else c = gc;
     }
 
     if ((s->statnum == 1 || s->statnum == 10 || s->statnum == 2 || s->statnum == 6))
@@ -3314,23 +3310,15 @@ int getincangle(int a,int na)
 
 static void alterang(int a)
 {
-    short aang, angdif, goalang;
-    long ticselapsed, *moveptr;
-    int j;
-
-    moveptr = (long *)g_t[1];
-
-    ticselapsed = (g_t[0])&31;
-
-    aang = g_sp->ang;
+    int aang = g_sp->ang, angdif, goalang;
+    long ticselapsed = (g_t[0])&31, *moveptr = (long *)g_t[1];
+    int j = ps[g_p].holoduke_on;
 
     g_sp->xvel += (*moveptr-g_sp->xvel)/5;
     if (g_sp->zvel < 648) g_sp->zvel += ((*(moveptr+1)<<4)-g_sp->zvel)/5;
 
     if (a&seekplayer)
     {
-        j = ps[g_p].holoduke_on;
-
         // NOTE: looks like 'owner' is set to target sprite ID...
 
         if (j >= 0 && cansee(sprite[j].x,sprite[j].y,sprite[j].z,sprite[j].sectnum,g_sp->x,g_sp->y,g_sp->z,g_sp->sectnum))
@@ -3386,11 +3374,9 @@ static void alterang(int a)
 static void move(void)
 {
     long l, *moveptr;
-    short a, goalang, angdif;
+    int a = g_sp->hitag, goalang, angdif;
     long daxvel;
 
-    a = g_sp->hitag;
-
     if (a == -1) a = 0;
 
     g_t[0]++;
@@ -3617,7 +3603,7 @@ static int parse(void)
     tw = *insptr;
 
     instruction = tw;
-
+//    initprintf("instruction %ld\n",tw);
     switch (tw)
     {
     case CON_REDEFINEQUOTE:
@@ -4971,11 +4957,9 @@ static int parse(void)
         break;
 
     case CON_DEBRIS:
+    insptr++;
     {
-        short dnum;
-
-        insptr++;
-        dnum = *insptr++;
+        int dnum = *insptr++;
 
         if (g_sp->sectnum >= 0 && g_sp->sectnum < MAXSECTORS)
             for (j=(*insptr)-1;j>=0;j--)
@@ -5674,7 +5658,6 @@ static int parse(void)
         // that is of <type> into <getvar>
         // -1 for none found
         // <type> <maxdistvarid> <varid>
-        short j=0;
         long var1 = *insptr++, d;
 
         if (tw == CON_FINDPLAYER) j=findplayer(&sprite[g_i],&d);
@@ -5844,8 +5827,10 @@ static int parse(void)
         j = g_p;
 
         if (*insptr != g_iThisActorID)
-            j=GetGameVarID(*insptr++, g_i, g_p);
+            j=GetGameVarID(*insptr, g_i, g_p);
             
+        insptr++;
+        
         if (j < MAXPLAYERS)
         {
             if (tw == CON_CHECKAVAILWEAPON)
@@ -6302,24 +6287,25 @@ static int parse(void)
 
     case CON_QUOTE:
         insptr++;
-        if (fta_quotes[*insptr] != NULL)
-            FTA(*insptr++,&ps[g_p]);
-        else
+        
+        if (fta_quotes[*insptr] == NULL)
         {
             OSD_Printf("%s %d null quote %d\n",__FILE__,__LINE__,*insptr);
             insptr++;
+            break;
         }
+        FTA(*insptr++,&ps[g_p]);
         break;
 
     case CON_USERQUOTE:
         insptr++;
-        if (fta_quotes[*insptr] != NULL)
-            adduserquote(fta_quotes[*insptr++]);
-        else
+        if (fta_quotes[*insptr] == NULL)
         {
             OSD_Printf("%s %d null quote %d\n",__FILE__,__LINE__,*insptr);
             insptr++;
+            break;
         }
+        adduserquote(fta_quotes[*insptr++]);        
         break;
 
     case CON_IFINOUTERSPACE:
diff --git a/polymer/eduke32/source/gamevars.c b/polymer/eduke32/source/gamevars.c
index 5e9c92a48..20d73d8ae 100755
--- a/polymer/eduke32/source/gamevars.c
+++ b/polymer/eduke32/source/gamevars.c
@@ -271,10 +271,9 @@ void ResetGameVars(void)
     }
 }
 
-char AddGameVar(char *pszLabel, long lValue, unsigned long dwFlags)
+int AddGameVar(const char *pszLabel, long lValue, unsigned long dwFlags)
 {
-    int i;
-    int j;
+    int i, j;
 
     //Bsprintf(g_szBuf,"AddGameVar(%s, %d, %X)",pszLabel, lValue, dwFlags);
     //AddLog(g_szBuf);
@@ -394,7 +393,7 @@ void ResetActorGameVars(int iActor)
         }
 }
 
-static int GetGameID(char *szGameLabel)
+static int GetGameID(const char *szGameLabel)
 {
     int i;
 
@@ -463,7 +462,7 @@ long GetGameVarID(int id, int iActor, int iPlayer)
     
     if (aGameVars[id].dwFlags & GAMEVAR_FLAG_PLONG)
     {
-        if (inv) return -(*((long*)aGameVars[id].lValue));
+        if (inv) return (-(*((long*)aGameVars[id].lValue)));
         return(*((long*)aGameVars[id].lValue));
     }
     
@@ -504,7 +503,7 @@ void SetGameVarID(int id, long lValue, int iActor, int iPlayer)
     aGameVars[id].lValue=lValue;
 }
 
-long GetGameVar(char *szGameLabel, long lDefault, int iActor, int iPlayer)
+long GetGameVar(const char *szGameLabel, long lDefault, int iActor, int iPlayer)
 {
     int i=0;
     for (;i<iGameVarCount;i++)
@@ -520,7 +519,7 @@ long GetGameVar(char *szGameLabel, long lDefault, int iActor, int iPlayer)
     return lDefault;
 }
 
-static long *GetGameValuePtr(char *szGameLabel)
+static long *GetGameValuePtr(const char *szGameLabel)
 {
     int i;
     for (i=0;i<iGameVarCount;i++)
diff --git a/polymer/eduke32/source/menus.c b/polymer/eduke32/source/menus.c
index 1b570fd63..a380ec51e 100644
--- a/polymer/eduke32/source/menus.c
+++ b/polymer/eduke32/source/menus.c
@@ -309,9 +309,9 @@ static int menutext_(int x,int y,short s,short p,char *t)
     return (x);
 }
 
-inline int menutext(int x,int y,short s,short p,char *t)
+inline int menutext(int x,int y,short s,short p,const char *t)
 {
-    return(menutext_(x,y,s,p,stripcolorcodes(t)));
+    return(menutext_(x,y,s,p,(char *)stripcolorcodes(t)));
 }
 
 static void bar_(int type, int x,int y,short *p,short dainc,char damodify,short s, short pa)
@@ -501,7 +501,7 @@ static void clearfilenames(void)
     numfiles = numdirs = 0;
 }
 
-int getfilenames(char *path, char kind[])
+int getfilenames(const char *path, char kind[])
 {
     CACHE1D_FIND_REC *r;
 
diff --git a/polymer/eduke32/source/namesdyn.c b/polymer/eduke32/source/namesdyn.c
index cf41418ce..d934ece3a 100644
--- a/polymer/eduke32/source/namesdyn.c
+++ b/polymer/eduke32/source/namesdyn.c
@@ -766,7 +766,7 @@ unsigned short RESERVEDSLOT12 = 6143;
 
 unsigned short dynamictostatic[MAXTILES];
 
-void processnames(char *szLabel, long lValue)
+void processnames(const char *szLabel, long lValue)
 {
     switch (szLabel[0])
     {
diff --git a/polymer/eduke32/source/premap.c b/polymer/eduke32/source/premap.c
index db5bfe104..84e4fdc3c 100644
--- a/polymer/eduke32/source/premap.c
+++ b/polymer/eduke32/source/premap.c
@@ -1521,8 +1521,6 @@ void resetmys(void)
     myreturntocenter = ps[myconnectindex].return_to_center;
 }
 
-extern void adduserquote(char *daquote);
-
 extern int gotvote[MAXPLAYERS], votes[MAXPLAYERS], voting, vote_map, vote_episode;
 
 static void getlevelfromfilename(const char *fn, char *volume, char *level)
diff --git a/polymer/eduke32/source/rts.c b/polymer/eduke32/source/rts.c
index 93a4435cc..24900d21e 100644
--- a/polymer/eduke32/source/rts.c
+++ b/polymer/eduke32/source/rts.c
@@ -58,7 +58,7 @@ char lumplockbyte[11];
 ====================
 */
 
-int32 RTS_AddFile(char *filename)
+int32 RTS_AddFile(const char *filename)
 {
     wadinfo_t  header;
     lumpinfo_t *lump_p;
@@ -140,7 +140,7 @@ int32 RTS_AddFile(char *filename)
 ====================
 */
 
-void RTS_Init(char *filename)
+void RTS_Init(const char *filename)
 {
     int32 length;
     //
@@ -203,7 +203,7 @@ int32 RTS_SoundLength(int32 lump)
 ====================
 */
 
-char * RTS_GetSoundName(int32 i)
+const char * RTS_GetSoundName(int32 i)
 {
     i++;
     if (i>=numlumps)
diff --git a/polymer/eduke32/source/rts.h b/polymer/eduke32/source/rts.h
index 588c29ee4..f55ef83f7 100644
--- a/polymer/eduke32/source/rts.h
+++ b/polymer/eduke32/source/rts.h
@@ -44,7 +44,7 @@ Modifications for JonoF's port by Jonathon Fowler (jonof@edgenetwk.com)
 ====================
 */
 
-void RTS_Init (char *filename);
+void RTS_Init (const char *filename);
 /*
 ====================
 =
@@ -73,7 +73,7 @@ int32 RTS_SoundLength (int32 lump);
 ====================
 */
 
-char * RTS_GetSoundName (int32 i);
+const char * RTS_GetSoundName (int32 i);
 /*
 ====================
 =
diff --git a/polymer/eduke32/source/sector.c b/polymer/eduke32/source/sector.c
index 037603ef9..f93deb02e 100644
--- a/polymer/eduke32/source/sector.c
+++ b/polymer/eduke32/source/sector.c
@@ -491,15 +491,10 @@ void animatewalls(void)
     }
 }
 
-char activatewarpelevators(short s,short d) //Parm = sectoreffectornum
+int activatewarpelevators(short s,short d) //Parm = sectoreffectornum
 {
-    short i, sn;
+    int i = headspritestat[3], sn = sprite[s].sectnum;
 
-    sn = sprite[s].sectnum;
-
-    // See if the sector exists
-
-    i = headspritestat[3];
     while (i >= 0)
     {
         if (SLT == 17)
@@ -540,12 +535,8 @@ char activatewarpelevators(short s,short d) //Parm = sectoreffectornum
 void operatesectors(short sn,short ii)
 {
     long j=0, l, q, startwall, endwall;
-    short i;
-    char sect_error;
-    sectortype *sptr;
-
-    sect_error = 0;
-    sptr = &sector[sn];
+    int i;
+    sectortype *sptr = &sector[sn];
 
     switch (sptr->lotag&(0xffff-49152))
     {
@@ -1136,12 +1127,11 @@ void operateforcefields(short s, int low)
     }
 }
 
-char checkhitswitch(int snum,long w,int switchtype)
+int checkhitswitch(int snum,long w,int switchtype)
 {
-    char switchpal;
+    int switchpal, switchpicnum;
     int i, x, lotag,hitag,picnum,correctdips,numdips;
     long sx,sy;
-    int switchpicnum;
 
     if (w < 0) return 0;
     correctdips = 1;
@@ -1947,9 +1937,9 @@ void checkplayerhurt(struct player_struct *p,short j)
     }
 }
 
-char checkhitceiling(short sn)
+int checkhitceiling(short sn)
 {
-    short i, j;
+    int i, j;
 
     switch (dynamictostatic[sector[sn].ceilingpicnum])
     {
diff --git a/polymer/eduke32/source/sounds.c b/polymer/eduke32/source/sounds.c
index 22c8dfb83..2c32d4531 100644
--- a/polymer/eduke32/source/sounds.c
+++ b/polymer/eduke32/source/sounds.c
@@ -185,7 +185,7 @@ void intomenusounds(void)
     menunum %= 17;
 }
 
-void playmusic(char *fn)
+void playmusic(const char *fn)
 {
 #if defined(_WIN32)
     short      fp;
@@ -196,7 +196,7 @@ void playmusic(char *fn)
     if (MusicToggle == 0) return;
     if (MusicDevice < 0) return;
 
-    fp = kopen4load(fn,0);
+    fp = kopen4load((char *)fn,0);
 
     if (fp == -1) return;
 
@@ -224,7 +224,7 @@ void playmusic(char *fn)
 #endif
 }
 
-char loadsound(unsigned short num)
+int loadsound(unsigned short num)
 {
     long   fp, l;