From 8e86c02364949d8dbef8da3401c9c9e5cdde34cb Mon Sep 17 00:00:00 2001
From: terminx <terminx@1a8010ca-5511-0410-912e-c29ae57300e0>
Date: Thu, 1 Mar 2007 00:50:59 +0000
Subject: [PATCH] git-svn-id: https://svn.eduke32.com/eduke32@511
 1a8010ca-5511-0410-912e-c29ae57300e0

---
 polymer/build/src/build.c         |  5 ++--
 polymer/build/src/config.c        | 31 +++++++++++++++++++--
 polymer/eduke32/source/actors.c   | 46 ++++++++++++++++++-------------
 polymer/eduke32/source/astub.c    | 21 ++++++--------
 polymer/eduke32/source/funct.h    |  8 +++---
 polymer/eduke32/source/game.c     |  4 +--
 polymer/eduke32/source/gameexec.c | 10 +++----
 polymer/eduke32/source/menus.c    | 16 +++++------
 polymer/eduke32/source/player.c   |  4 +--
 polymer/eduke32/source/premap.c   | 13 ++++++++-
 polymer/eduke32/source/sector.c   | 18 ++++++------
 polymer/eduke32/source/sounds.c   |  8 +++---
 12 files changed, 112 insertions(+), 72 deletions(-)

diff --git a/polymer/build/src/build.c b/polymer/build/src/build.c
index 5ace7c5ec..c884fbc1a 100644
--- a/polymer/build/src/build.c
+++ b/polymer/build/src/build.c
@@ -4283,6 +4283,7 @@ void overheadeditor(void)
         if (((keystatus[buildkeys[8]] > 0) || (bstatus&16)) && (zoom < 16384))
         {
             zoom += synctics*(zoom>>4);
+            if (zoom < 24) zoom += 2;
             if (bstatus&16 && (keystatus[0x38] || keystatus[0xb8]))
             {
                 searchx = halfxdim16;
@@ -4291,7 +4292,7 @@ void overheadeditor(void)
                 posy = mousyplc;
             }            
         }    
-        if (((keystatus[buildkeys[9]] > 0) || (bstatus&32)) && (zoom > 24))
+        if (((keystatus[buildkeys[9]] > 0) || (bstatus&32)) && (zoom > 8))
         {
             zoom -= synctics*(zoom>>4);
             if (bstatus&32 && (keystatus[0x38] || keystatus[0xb8]))
@@ -4302,7 +4303,7 @@ void overheadeditor(void)
                 posy = mousyplc;
             }
         }
-        if (zoom < 24) zoom = 24;
+        if (zoom < 8) zoom = 8;
         if (zoom > 16384) zoom = 16384;
 
         if (keystatus[0x22] > 0)  // G (grid on/off)
diff --git a/polymer/build/src/config.c b/polymer/build/src/config.c
index d28c83a45..c2ff88d6f 100644
--- a/polymer/build/src/config.c
+++ b/polymer/build/src/config.c
@@ -59,6 +59,7 @@ extern long fullscreen;
 extern char option[8];
 extern char keys[NUMBUILDKEYS];
 extern double msens;
+extern long editorgridextent;
 
 /*
  * SETUP.DAT
@@ -125,6 +126,7 @@ if (readconfig(fp, "fullscreen", val, VL) > 0) { if (Batoi(val) != 0) fullscreen
 if (readconfig(fp, "music", val, VL) > 0) { if (Batoi(val) != 0) option[2] = 1; else option[2] = 0; }
 if (readconfig(fp, "mouse", val, VL) > 0) { if (Batoi(val) != 0) option[3] = 1; else option[3] = 0; }
     if (readconfig(fp, "bpp", val, VL) > 0) bppgame = Batoi(val);
+    if (readconfig(fp, "editorgridextent", val, VL) > 0) editorgridextent = max(min(524288,Batoi(val)),65536);
 if (readconfig(fp, "renderer", val, VL) > 0) { i = Batoi(val); setrendermode(i); }
     if (readconfig(fp, "brightness", val, VL) > 0) brightness = min(max(Batoi(val),0),15);
 
@@ -144,6 +146,9 @@ if (readconfig(fp, "renderer", val, VL) > 0) { i = Batoi(val); setrendermode(i);
     if (readconfig(fp, "gltexfiltermode", val, VL) > 0) {
         gltexfiltermode = Batoi(val);
     }
+    if (readconfig(fp, "glanisotropy", val, VL) > 0) {
+        glanisotropy = Batoi(val);
+    }
 #endif
 
     option[0] = 1;	// vesa all the way...
@@ -151,6 +156,7 @@ if (readconfig(fp, "renderer", val, VL) > 0) { i = Batoi(val); setrendermode(i);
     option[4] = 0;	// no multiplayer
     option[5] = 0;
 
+#if 0
     if (readconfig(fp, "keyforward", val, VL) > 0) keys[0] = Bstrtol(val, NULL, 16);
     if (readconfig(fp, "keybackward", val, VL) > 0) keys[1] = Bstrtol(val, NULL, 16);
     if (readconfig(fp, "keyturnleft", val, VL) > 0) keys[2] = Bstrtol(val, NULL, 16);
@@ -170,6 +176,8 @@ if (readconfig(fp, "renderer", val, VL) > 0) { i = Batoi(val); setrendermode(i);
     if (readconfig(fp, "key2dzoomin", val, VL) > 0) keys[16] = Bstrtol(val, NULL, 16);
     if (readconfig(fp, "key2dzoomout", val, VL) > 0) keys[17] = Bstrtol(val, NULL, 16);
     if (readconfig(fp, "keychat", val, VL) > 0) keys[18] = Bstrtol(val, NULL, 16);
+#endif
+    
 if (readconfig(fp, "keyconsole", val, VL) > 0) { keys[19] = Bstrtol(val, NULL, 16); OSD_CaptureKey(keys[19]); }
 
     if (readconfig(fp, "mousesensitivity", val, VL) > 0) msens = Bstrtod(val, NULL);
@@ -205,13 +213,18 @@ int writesetup(const char *fn)
              "; 3D-mode colour depth\n"
              "bpp = %ld\n"
              "\n"
+             "; Grid limits\n"
+             "editorgridextent = %ld\n"
+             "\n"
 #if defined(POLYMOST) && defined(USE_OPENGL)
              "; OpenGL mode options\n"
              "glusetexcache = %ld\n"
              "glusetexcachecompression = %ld\n"
              "gltexfiltermode = %ld\n"
+             "glanisotropy = %ld\n"
              "\n"
 #endif
+
 #ifdef RENDERTYPEWIN
              "; Maximum OpenGL mode refresh rate (Windows only, in Hertz)\n"
              "maxrefreshfreq = %d\n"
@@ -222,6 +235,7 @@ int writesetup(const char *fn)
              ";   15 - highest\n"
              "brightness = %d\n"
              "\n"
+#if 0             
              "; Sound sample frequency\n"
              ";   0 - 6 KHz\n"
              ";   1 - 8 KHz\n"
@@ -237,6 +251,7 @@ int writesetup(const char *fn)
              ";   1 - On\n"
              "music = %d\n"
              "\n"
+#endif             
              "; Enable mouse\n"
              ";   0 - No\n"
              ";   1 - Yes\n"
@@ -245,6 +260,7 @@ int writesetup(const char *fn)
              "; Mouse sensitivity\n"
              "mousesensitivity = %g\n"
              "\n"
+#if 0             
              "; Key Settings\n"
              ";  Here's a map of all the keyboard scan codes: NOTE: values are listed in hex!\n"
              "; +---------------------------------------------------------------------------------------------+\n"
@@ -286,22 +302,31 @@ int writesetup(const char *fn)
              "key2dzoomin = %X\n"
              "key2dzoomout = %X\n"
              "keychat = %X\n"
+#endif
+             "; Console key scancode, in hex\n"
              "keyconsole = %X\n"
              "\n",
 
              forcesetup, fullscreen, xdim2d, ydim2d, xdimgame, ydimgame, bppgame,
+             editorgridextent,
 #if defined(POLYMOST) && defined(USE_OPENGL)
-             glusetexcache, glusetexcachecompression, gltexfiltermode,
+             glusetexcache, glusetexcachecompression, gltexfiltermode, glanisotropy,
 #endif
 #ifdef RENDERTYPEWIN
              maxrefreshfreq,
 #endif
-             brightness, option[7]>>4, option[2],
+             brightness, 
+#if 0
+             option[7]>>4, option[2],
+#endif             
              option[3], msens,
+#if 0             
              keys[0], keys[1], keys[2], keys[3], keys[4], keys[5],
              keys[6], keys[7], keys[8], keys[9], keys[10], keys[11],
              keys[12], keys[13], keys[14], keys[15], keys[16], keys[17],
-             keys[18], keys[19]
+             keys[18],
+#endif             
+             keys[19]
             );
 
     Bfclose(fp);
diff --git a/polymer/eduke32/source/actors.c b/polymer/eduke32/source/actors.c
index dd3796544..83c3a2653 100644
--- a/polymer/eduke32/source/actors.c
+++ b/polymer/eduke32/source/actors.c
@@ -578,40 +578,47 @@ void insertspriteq(int i)
     else deletesprite(i);
 }
 
-void lotsofmoney(spritetype *s, int n)
+void lotsofmoney(int sp, int n)
 {
     int i ,j;
+    spritetype *s = &sprite[sp];
+        
     for (i=n;i>0;i--)
     {
-        j = EGS(s->sectnum,s->x,s->y,s->z-(TRAND%(47<<8)),MONEY,-32,8,8,TRAND&2047,0,0,0,5);
+        j = EGS(s->sectnum,s->x,s->y,s->z-(TRAND%(47<<8)),MONEY,-32,8,8,TRAND&2047,0,0,sp,5);
         sprite[j].cstat = TRAND&12;
     }
 }
 
-void lotsofmail(spritetype *s, int n)
+void lotsofmail(int sp, int n)
 {
     int i ,j;
+    spritetype *s = &sprite[sp];
+        
     for (i=n;i>0;i--)
     {
-        j = EGS(s->sectnum,s->x,s->y,s->z-(TRAND%(47<<8)),MAIL,-32,8,8,TRAND&2047,0,0,0,5);
+        j = EGS(s->sectnum,s->x,s->y,s->z-(TRAND%(47<<8)),MAIL,-32,8,8,TRAND&2047,0,0,sp,5);
         sprite[j].cstat = TRAND&12;
     }
 }
 
-void lotsofpaper(spritetype *s, int n)
+void lotsofpaper(int sp, int n)
 {
     int i ,j;
+    spritetype *s = &sprite[sp];
+        
     for (i=n;i>0;i--)
     {
-        j = EGS(s->sectnum,s->x,s->y,s->z-(TRAND%(47<<8)),PAPER,-32,8,8,TRAND&2047,0,0,0,5);
+        j = EGS(s->sectnum,s->x,s->y,s->z-(TRAND%(47<<8)),PAPER,-32,8,8,TRAND&2047,0,0,sp,5);
         sprite[j].cstat = TRAND&12;
     }
 }
 
-void guts(spritetype *s,int gtype, int n, int p)
+void guts(int sp, int gtype, int n, int p)
 {
     long gutz,floorz;
     int i,a,j,sx,sy,pal;
+    spritetype *s = &sprite[sp];
 
     if (badguy(s) && s->xrepeat < 16)
         sx = sy = 8;
@@ -633,7 +640,7 @@ void guts(spritetype *s,int gtype, int n, int p)
     for (j=0;j<n;j++)
     {
         a = TRAND&2047;
-        i = EGS(s->sectnum,s->x+(TRAND&255)-128,s->y+(TRAND&255)-128,gutz-(TRAND&8191),gtype,-32,sx,sy,a,48+(TRAND&31),-512-(TRAND&2047),ps[p].i,5);
+        i = EGS(s->sectnum,s->x+(TRAND&255)-128,s->y+(TRAND&255)-128,gutz-(TRAND&8191),gtype,-32,sx,sy,a,48+(TRAND&31),-512-(TRAND&2047),sp,5);
         if (PN == JIBS2)
         {
             sprite[i].xrepeat >>= 2;
@@ -644,11 +651,12 @@ void guts(spritetype *s,int gtype, int n, int p)
     }
 }
 
-void gutsdir(spritetype *s,int gtype, int n, int p)
+void gutsdir(int sp, int gtype, int n, int p)
 {
     long gutz,floorz;
     int i,a,j,sx,sy;
-
+    spritetype *s = &sprite[sp];
+    
     if (badguy(s) && s->xrepeat < 16)
         sx = sy = 8;
     else sx = sy = 32;
@@ -665,7 +673,7 @@ void gutsdir(spritetype *s,int gtype, int n, int p)
     for (j=0;j<n;j++)
     {
         a = TRAND&2047;
-        i = EGS(s->sectnum,s->x,s->y,gutz,gtype,-32,sx,sy,a,256+(TRAND&127),-512-(TRAND&2047),ps[p].i,5);
+        i = EGS(s->sectnum,s->x,s->y,gutz,gtype,-32,sx,sy,a,256+(TRAND&127),-512-(TRAND&2047),sp,5);
     }
 }
 
@@ -692,7 +700,7 @@ void setsectinterpolate(int i)
 void clearsectinterpolate(int i)
 {
     int j = sector[SECT].wallptr,endwall = j+sector[SECT].wallnum;
-    
+
     for (;j<endwall;j++)
     {
         stopinterpolation(&wall[j].x);
@@ -718,7 +726,7 @@ static void ms(int i)
 
     {
         int x = sector[s->sectnum].wallptr, endwall = x+sector[s->sectnum].wallnum;
-        
+
         for (;x<endwall;x++)
         {
             rotatepoint(0,0,msx[j],msy[j],k&2047,&tx,&ty);
@@ -2302,7 +2310,7 @@ static void bounce(int i)
     int hitsect = s->sectnum;
     long k = sector[hitsect].wallptr;
     long l = wall[k].point2;
-    
+
     xvect = mulscale10(s->xvel,sintable[(s->ang+512)&2047]);
     yvect = mulscale10(s->xvel,sintable[s->ang&2047]);
     zvect = s->zvel;
@@ -3450,7 +3458,7 @@ BOLT:
 static short LocateTheLocator(int n,int sn)
 {
     int i = headspritestat[7];
-    
+
     while (i >= 0)
     {
         if ((sn == -1 || sn == SECT) && n == SLT)
@@ -3466,7 +3474,7 @@ static void moveactors(void)
     int a, j, nexti, nextj, sect, p, switchpicnum, k;
     spritetype *s;
     int i = headspritestat[1];
-    
+
     while (i >= 0)
     {
         nexti = nextspritestat[i];
@@ -5751,7 +5759,7 @@ static void moveeffectors(void)   //STATNUM 3
                             updatesector(sprite[j].x,sprite[j].y,&k);
                             if (sprite[j].extra >= 0 && k == s->sectnum)
                             {
-                                gutsdir(&sprite[j],JIBS6,72,myconnectindex);
+                                gutsdir(j,JIBS6,72,myconnectindex);
                                 spritesound(SQUISHED,i);
                                 deletesprite(j);
                             }
@@ -5925,7 +5933,7 @@ static void moveeffectors(void)   //STATNUM 3
                                 updatesector(sprite[j].x,sprite[j].y,&k);
                                 if (sprite[j].extra >= 0 && k == s->sectnum)
                                 {
-                                    gutsdir(&sprite[j],JIBS6,24,myconnectindex);
+                                    gutsdir(j,JIBS6,24,myconnectindex);
                                     spritesound(SQUISHED,j);
                                     deletesprite(j);
                                 }
@@ -6300,7 +6308,7 @@ static void moveeffectors(void)   //STATNUM 3
             if (t[4])
             {
                 int endwall = sc->wallptr+sc->wallnum;
-                
+
                 for (j=sc->wallptr;j<endwall;j++)
                 {
                     k = headspritestat[1];
diff --git a/polymer/eduke32/source/astub.c b/polymer/eduke32/source/astub.c
index d9020e739..475ce0c03 100644
--- a/polymer/eduke32/source/astub.c
+++ b/polymer/eduke32/source/astub.c
@@ -39,7 +39,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 
 #define VERSION " 1.1.0 svn"
 
-short floor_over_floor;
+static int floor_over_floor;
 
 static char *startwin_labeltext = "Starting Mapster32...";
 static char setupfilename[BMAX_PATH]= "mapster32.cfg";
@@ -4069,7 +4069,7 @@ static void Keys2d(void)
 
 void ExtSetupSpecialSpriteCols(void)
 {
-    short i;
+    int i;
     for (i=0;i<MAXTILES;i++)
 
         switch (i)
@@ -4207,7 +4207,7 @@ void ExtPreSaveMap(void)
 {
     if (fixmapbeforesaving)
     {
-        short i, startwall, j, endwall;
+        int i, startwall, j, endwall;
 
         for (i=0;i<numsectors;i++)
         {
@@ -4705,8 +4705,7 @@ void ExtAnalyzeSprites(void)
 {
     long i, k;
     spritetype *tspr;
-    char frames=0;
-    signed char l;
+    int frames=0, l;
 
     for (i=0,tspr=&tsprite[0];i<spritesortcnt;i++,tspr++)
     {
@@ -5109,9 +5108,8 @@ static void EditSectorData(short sectnum)
 {
     char disptext[80];
     char edittext[80];
-    unsigned char col=1, row=0, rowmax = 6, dispwidth = 24, editval = 0;
+    int col=1, row=0, rowmax = 6, dispwidth = 24, editval = 0, i = -1;
     long xpos = 200, ypos = ydim-STATUS2DSIZ+48;
-    int i = -1;
 
     disptext[dispwidth] = 0;
     clearmidstatbar16();
@@ -5348,9 +5346,8 @@ static void EditWallData(short wallnum)
 {
     char disptext[80];
     char edittext[80];
-    unsigned char row=0, dispwidth = 24, editval = 0;
+    int row=0, dispwidth = 24, editval = 0, i = -1;
     long xpos = 200, ypos = ydim-STATUS2DSIZ+48;
-    int i = -1;
 
     disptext[dispwidth] = 0;
     clearmidstatbar16();
@@ -5482,9 +5479,8 @@ static void EditSpriteData(short spritenum)
 {
     char disptext[80];
     char edittext[80];
-    unsigned char col=0, row=0, rowmax=4, dispwidth = 24, editval = 0;
+    int col=0, row=0, rowmax=4, dispwidth = 24, editval = 0, i = -1;
     long xpos = 8, ypos = ydim-STATUS2DSIZ+48;
-    int i = -1;
 
     disptext[dispwidth] = 0;
     clearmidstatbar16();
@@ -5893,9 +5889,8 @@ static void FuncMenuOpts(void)
 static void FuncMenu(void)
 {
     char disptext[80];
-    unsigned char col=0, row=0, rowmax=7, dispwidth = 24, editval = 0;
+    int col=0, row=0, rowmax=7, dispwidth = 24, editval = 0, i = -1, j;
     long xpos = 8, ypos = ydim-STATUS2DSIZ+48;
-    int i = -1, j;
 
     disptext[dispwidth] = 0;
     clearmidstatbar16();
diff --git a/polymer/eduke32/source/funct.h b/polymer/eduke32/source/funct.h
index 9a3360a12..ce98ccb6c 100644
--- a/polymer/eduke32/source/funct.h
+++ b/polymer/eduke32/source/funct.h
@@ -179,10 +179,10 @@ extern void hitradius(int i,long r,long hp1,long hp2,long hp3,long hp4);
 extern int movesprite(int spritenum,long xchange,long ychange,long zchange,unsigned long cliptype);
 extern int ssp(int i,unsigned long cliptype);
 extern void insertspriteq(int i);
-extern void lotsofmoney(spritetype *s,int n);
-extern void lotsofmail(spritetype *s, int n);
-extern void lotsofpaper(spritetype *s, int n);
-extern void guts(spritetype *s,int gtype,int n,int p);
+extern void lotsofmoney(int sp,int n);
+extern void lotsofmail(int sp, int n);
+extern void lotsofpaper(int sp, int n);
+extern void guts(int sp,int gtype,int n,int p);
 extern void setsectinterpolate(int i);
 extern void clearsectinterpolate(int i);
 extern int ifhitsectors(int sectnum);
diff --git a/polymer/eduke32/source/game.c b/polymer/eduke32/source/game.c
index 6f00c872e..7c78ecb1b 100644
--- a/polymer/eduke32/source/game.c
+++ b/polymer/eduke32/source/game.c
@@ -7587,7 +7587,7 @@ FOUNDCHEAT:
             {
                 KB_ClearKeyDown((unsigned char)cheatkey[0]);
                 ps[myconnectindex].cheat_phase = -1;
-            }    
+            }
         }
 
         if (KB_KeyPressed((unsigned char)cheatkey[1]))
@@ -12235,7 +12235,7 @@ void lotsofglass(int i,int wallnum,int n)
     long j, xv, yv, z, x1, y1;
     short sect;
     int a;
-    
+
     sect = -1;
 
     if (wallnum < 0)
diff --git a/polymer/eduke32/source/gameexec.c b/polymer/eduke32/source/gameexec.c
index a8b97e762..a73fb2d5c 100644
--- a/polymer/eduke32/source/gameexec.c
+++ b/polymer/eduke32/source/gameexec.c
@@ -3850,7 +3850,7 @@ static int parse(void)
                         {
                             if (!(g_sp->picnum == APLAYER && g_sp->extra > 0))
                             {
-                                guts(g_sp,JIBS6,15,g_p);
+                                guts(g_i,JIBS6,15,g_p);
                                 spritesound(SQUISHED,g_i);
                                 spawn(g_i,BLOODPOOL);
                             }
@@ -3916,12 +3916,12 @@ static int parse(void)
 
     case CON_MONEY:
         insptr++;
-        lotsofmoney(g_sp,*insptr++);
+        lotsofmoney(g_i,*insptr++);
         break;
 
     case CON_MAIL:
         insptr++;
-        lotsofmail(g_sp,*insptr++);
+        lotsofmail(g_i,*insptr++);
         break;
 
     case CON_SLEEPTIME:
@@ -3931,7 +3931,7 @@ static int parse(void)
 
     case CON_PAPER:
         insptr++;
-        lotsofpaper(g_sp,*insptr++);
+        lotsofpaper(g_i,*insptr++);
         break;
 
     case CON_ADDKILLS:
@@ -5179,7 +5179,7 @@ static int parse(void)
 
     case CON_GUTS:
         insptr += 2;
-        guts(g_sp,*(insptr-1),*insptr,g_p);
+        guts(g_i,*(insptr-1),*insptr,g_p);
         insptr++;
         break;
 
diff --git a/polymer/eduke32/source/menus.c b/polymer/eduke32/source/menus.c
index 4d4795cbe..5c379dac1 100644
--- a/polymer/eduke32/source/menus.c
+++ b/polymer/eduke32/source/menus.c
@@ -421,10 +421,10 @@ static void modval(int min, int max,int *p,int dainc,int damodify)
                 *p -= dainc;
                 if (*p < min)
                 {
-                    *p = max;                
+                    *p = max;
                     if (damodify == 2)
                         *p = min;
-                }        
+                }
                 sound(PISTOL_BODYHIT);
             }
             if (KB_KeyPressed(sc_RightArrow) || KB_KeyPressed(sc_kpad_6) || ((buttonstat&1) && minfo.dyaw > 256))       //&& onbar) )
@@ -435,10 +435,10 @@ static void modval(int min, int max,int *p,int dainc,int damodify)
                 *p += dainc;
                 if (*p > max)
                 {
-                    *p = min;                
+                    *p = min;
                     if (damodify == 2)
                         *p = max;
-                }        
+                }
                 sound(PISTOL_BODYHIT);
             }
         }
@@ -452,10 +452,10 @@ static void modval(int min, int max,int *p,int dainc,int damodify)
                 *p -= dainc;
                 if (*p < min)
                 {
-                    *p = max;                
+                    *p = max;
                     if (damodify == 2)
                         *p = min;
-                }        
+                }
                 sound(PISTOL_BODYHIT);
             }
             if (KB_KeyPressed(sc_LeftArrow) || KB_KeyPressed(sc_kpad_4) || ((buttonstat&1) && minfo.dyaw < -256))      // && onbar) )
@@ -466,10 +466,10 @@ static void modval(int min, int max,int *p,int dainc,int damodify)
                 *p += dainc;
                 if (*p > max)
                 {
-                    *p = min;                
+                    *p = min;
                     if (damodify == 2)
                         *p = max;
-                }        
+                }
                 sound(PISTOL_BODYHIT);
             }
         }
diff --git a/polymer/eduke32/source/player.c b/polymer/eduke32/source/player.c
index 8206ca28e..b80be2e7f 100644
--- a/polymer/eduke32/source/player.c
+++ b/polymer/eduke32/source/player.c
@@ -103,7 +103,7 @@ void quickkill(struct player_struct *p)
 
     sprite[p->i].extra = 0;
     sprite[p->i].cstat |= 32768;
-    if (ud.god == 0) guts(&sprite[p->i],JIBS6,8,myconnectindex);
+    if (ud.god == 0) guts(p->i,JIBS6,8,myconnectindex);
     return;
 }
 
@@ -4578,7 +4578,7 @@ HORIZONLY:
                 p->weapon_pos = -p->weapon_pos;
             if (p->actorsqu >= 0 && dist(&sprite[pi],&sprite[p->actorsqu]) < 1400 && sprite[p->actorsqu].statnum != MAXSTATUS)
             {
-                guts(&sprite[p->actorsqu],JIBS6,7,myconnectindex);
+                guts(p->actorsqu,JIBS6,7,myconnectindex);
                 spawn(p->actorsqu,BLOODPOOL);
                 spritesound(SQUISHED,p->actorsqu);
                 switch (dynamictostatic[sprite[p->actorsqu].picnum])
diff --git a/polymer/eduke32/source/premap.c b/polymer/eduke32/source/premap.c
index 22e97d12e..b45955dbb 100644
--- a/polymer/eduke32/source/premap.c
+++ b/polymer/eduke32/source/premap.c
@@ -240,12 +240,23 @@ static void cachegoodsprites(void)
 
     for (i = EXPLOSION2; i < EXPLOSION2+21 ; i++) tloadtile(i,1);
 
+    for (i = COOLEXPLOSION1; i < COOLEXPLOSION1+21 ; i++) tloadtile(i,1);
+
     tloadtile(BULLETHOLE,1);
+    tloadtile(BLOODPOOL,1);
+    for (i = TRANSPORTERBEAM; i < (TRANSPORTERBEAM+6); i++) tloadtile(i,1);
+    
     for (i = SMALLSMOKE; i < (SMALLSMOKE+4); i++) tloadtile(i,1);
 
+    for (i = BLOOD; i < (BLOOD+4); i++) tloadtile(i,1);
     for (i = JIBS1; i < (JIBS5+5); i++) tloadtile(i,1);
-    for (i = SCRAP1; i < (SCRAP1+19); i++) tloadtile(i,1);
+    for (i = SCRAP1; i < (SCRAP1+29); i++) tloadtile(i,1);
 
+    tloadtile(FIRELASER,1);
+    for (i=FORCERIPPLE; i<(FORCERIPPLE+9); i++) tloadtile(i,1);
+
+    for (i=MENUSCREEN; i<DUKECAR; i++) tloadtile(i,1);
+    
     for (i=RPG; i<RPG+7; i++) tloadtile(i,1);
     for (i=FREEZEBLAST; i<FREEZEBLAST+3; i++) tloadtile(i,1);
     for (i=SHRINKSPARK; i<SHRINKSPARK+4; i++) tloadtile(i,1);
diff --git a/polymer/eduke32/source/sector.c b/polymer/eduke32/source/sector.c
index 6aac73644..e3687fea0 100644
--- a/polymer/eduke32/source/sector.c
+++ b/polymer/eduke32/source/sector.c
@@ -1809,7 +1809,7 @@ void checkhitwall(int spr,int dawallnum,long x,long y,long z,int atwith)
 
     case ATM__STATIC:
         wal->picnum = ATMBROKE;
-        lotsofmoney(&sprite[spr],1+(TRAND&7));
+        lotsofmoney(spr,1+(TRAND&7));
         spritesound(GLASS_HEAVYBREAK,spr);
         break;
 
@@ -2194,7 +2194,7 @@ void checkhitsprite(int i,int sn)
     case STATUEFLASH__STATIC:
     case STATUE__STATIC:
         if (PN == BOTTLE10)
-            lotsofmoney(&sprite[i],4+(TRAND&3));
+            lotsofmoney(i,4+(TRAND&3));
         else if (PN == STATUE || PN == STATUEFLASH)
         {
             lotsofcolourglass(i,-1,40);
@@ -2357,12 +2357,12 @@ void checkhitsprite(int i,int sn)
         shoot(i,BLOODSPLAT3);
         SA = TRAND&2047;
         shoot(i,BLOODSPLAT4);
-        guts(&sprite[i],JIBS1,1,myconnectindex);
-        guts(&sprite[i],JIBS2,2,myconnectindex);
-        guts(&sprite[i],JIBS3,3,myconnectindex);
-        guts(&sprite[i],JIBS4,4,myconnectindex);
-        guts(&sprite[i],JIBS5,1,myconnectindex);
-        guts(&sprite[i],JIBS3,6,myconnectindex);
+        guts(i,JIBS1,1,myconnectindex);
+        guts(i,JIBS2,2,myconnectindex);
+        guts(i,JIBS3,3,myconnectindex);
+        guts(i,JIBS4,4,myconnectindex);
+        guts(i,JIBS5,1,myconnectindex);
+        guts(i,JIBS3,6,myconnectindex);
         sound(SQUISHED);
         deletesprite(i);
         break;
@@ -3262,7 +3262,7 @@ void checksectors(int snum)
     }
 
     if (ud.cashman && sync[snum].bits&(1<<29))
-        lotsofmoney(&sprite[p->i],2);
+        lotsofmoney(p->i,2);
 
     if (p->newowner >= 0)
     {
diff --git a/polymer/eduke32/source/sounds.c b/polymer/eduke32/source/sounds.c
index de3eed9d8..a9597204b 100644
--- a/polymer/eduke32/source/sounds.c
+++ b/polymer/eduke32/source/sounds.c
@@ -217,11 +217,11 @@ void playmusic(const char *fn)
 
     if (fn == NULL) return;
 
-    if(MusicToggle == 0) return;
-    if(MusicDevice < 0) return;
+    if (MusicToggle == 0) return;
+    if (MusicDevice < 0) return;
 
-     // FIXME: I need this to get the music volume initialized (not sure why) -- Jim Bentler
-    MUSIC_SetVolume( MusicVolume );
+    // FIXME: I need this to get the music volume initialized (not sure why) -- Jim Bentler
+    MUSIC_SetVolume(MusicVolume);
     PlayMusic((char *)fn);
 #endif
 }