shithub: duke3d

Download patch

ref: 95b30272099666a5b34d15b0437d70948379dcc1
parent: 6a1e6c5279b0978dd20a35921097b1874747ab0b
author: fabien sanglard <[email protected]>
date: Sat Dec 22 12:57:59 EST 2012

Removed usage of global tempbug in favor of localschar text[512].

--- a/Engine/src/display.c
+++ b/Engine/src/display.c
@@ -1326,9 +1326,9 @@
     int32_t max_w;
     int32_t max_h;
     int i;
-
+ 
     get_max_screen_res(&max_w, &max_h);
-    printf("Setting resolution ceiling to (%ldx%ld).\n", max_w, max_h);
+    printf("Setting resolution ceiling to (%dx%d).\n", max_w, max_h);
 
     for (i = 0; i < validmodecnt; i++)
     {
--- a/Engine/src/engine.c
+++ b/Engine/src/engine.c
@@ -3564,8 +3564,8 @@
 extern uint8_t lastPalette[768];
 static void loadpalette(void)
 {
-    int32_t i, j, k, dist, fil;
-    uint8_t  *ptr;
+    int32_t k, fil;
+    
 
     if (paletteloaded != 0)
         return;
@@ -8099,7 +8099,7 @@
 void makepalookup(int32_t palnum, uint8_t  *remapbuf, int8_t r,
                   int8_t g, int8_t b, uint8_t  dastat)
 {
-    int32_t i, j, dist, palscale;
+    int32_t i, j, palscale;
     uint8_t  *ptr, *ptr2;
 
     if (paletteloaded == 0)
@@ -8149,8 +8149,9 @@
 
 void setbrightness(uint8_t  dabrightness, uint8_t  *dapal)
 {
-    int32_t i, j, k;
-
+    int32_t i, k;
+    uint8_t newPalette[256*3];
+    
     //Clamp bightness to [0-15]
     curbrightness = min(max(dabrightness,0),15);
 
@@ -8157,14 +8158,14 @@
     k = 0;
    
     for(i=0; i<256; i++){
-        tempbuf[k++] = britable[curbrightness][dapal[i*3+2]];
-        tempbuf[k++] = britable[curbrightness][dapal[i*3+1]];
-        tempbuf[k++] = britable[curbrightness][dapal[i*3+0]];
-        tempbuf[k++] = 0;
+        newPalette[k++] = britable[curbrightness][dapal[i*3+2]];
+        newPalette[k++] = britable[curbrightness][dapal[i*3+1]];
+        newPalette[k++] = britable[curbrightness][dapal[i*3+0]];
+        newPalette[k++] = 0;
     }
     
 
-    VBE_setPalette(tempbuf);
+    VBE_setPalette(newPalette);
 }
 
 //This is only used by drawmapview.
--- a/Engine/src/engine.h
+++ b/Engine/src/engine.h
@@ -137,6 +137,21 @@
 #include "display.h"
 #include "fixedPoint_math.h"
 #include "tiles.h"
+    
+    
+//Exported for tile module
+    extern int32_t setviewcnt;
+    extern int32_t bakvidoption[4];
+    extern int32_t bakframeplace[4], bakxsiz[4], bakysiz[4];
+    extern int32_t bakwindowx1[4], bakwindowy1[4];
+    extern int32_t bakwindowx2[4], bakwindowy2[4];
+    extern uint8_t  picsiz[MAXTILES], tilefilenum[MAXTILES];
+    extern int16_t bakumost[MAXXDIM+1], bakdmost[MAXXDIM+1];
+    extern int32_t numtilefiles, artfil , artfilnum, artfilplc;
+    extern int32_t pow2long[32];
+    extern int32_t artsize , cachesize ;
+    extern int32_t tilefileoffs[MAXTILES];
+    extern int32_t totalclocklock;
 
 #ifdef __cplusplus
 }
--- a/Engine/src/tiles.c
+++ b/Engine/src/tiles.c
@@ -20,25 +20,8 @@
 
 uint8_t  *pic = NULL;
 
-//Those are from engine.c
-extern int32_t setviewcnt;
-extern int32_t bakvidoption[4];
-extern int32_t bakframeplace[4], bakxsiz[4], bakysiz[4];
-extern int32_t bakwindowx1[4], bakwindowy1[4];
-extern int32_t bakwindowx2[4], bakwindowy2[4];
-extern uint8_t  picsiz[MAXTILES], tilefilenum[MAXTILES];
-extern int16_t bakumost[MAXXDIM+1], bakdmost[MAXXDIM+1];
-extern int32_t numtilefiles, artfil , artfilnum, artfilplc;
-extern int32_t pow2long[32];
-extern int32_t artsize , cachesize ;
-extern int32_t tilefileoffs[MAXTILES];
-extern int32_t totalclocklock;
+uint8_t  gotpic[(MAXTILES+7)>>3];
 
-
-
-
-
-
 void setviewtotile(short tilenume, int32_t tileWidth, int32_t tileHeight)
 {
     int32_t i, j;
@@ -270,6 +253,7 @@
     }
     while (k != numtilefiles);
     printf("Art files loaded\n");
+    
     clearbuf(&gotpic[0],(int32_t)((MAXTILES+31)>>5),0L);
     
     /* try dpmi_DETERMINEMAXREALALLOC! */
--- a/Engine/src/tiles.h
+++ b/Engine/src/tiles.h
@@ -47,7 +47,7 @@
 } tile_t;
 
 
-EXTERN tile_t tiles[MAXTILES];
+extern tile_t tiles[MAXTILES];
 
 void setviewtotile(short tilenume, int32_t tileWidth, int32_t tileHeight);
 void squarerotatetile(short tilenume);
@@ -59,7 +59,7 @@
 
 
 //Bitvector marking picture used for rendition.
-EXTERN uint8_t  gotpic[(MAXTILES+7)>>3];
+extern uint8_t  gotpic[(MAXTILES+7)>>3];
 void setgotpic(int32_t tilenume);
 
 
@@ -66,6 +66,6 @@
 
 int animateoffs(int16_t tilenum);
 
-EXTERN uint8_t  *pic ;
+extern uint8_t  *pic ;
 
 #endif
--- a/Game/src/duke3d.h
+++ b/Game/src/duke3d.h
@@ -431,7 +431,7 @@
 
 
 extern uint8_t  numplayersprites;
-extern uint8_t  picsiz[MAXTILES];
+
 
 typedef struct
 {
--- a/Game/src/funct.h
+++ b/Game/src/funct.h
@@ -228,7 +228,7 @@
 //#line "menues.c" 18
 extern void cmenu(short cm);
 //#line "menues.c" 38
-extern void savetemp(char  *fn,int32_t daptr,int32_t dasiz);
+extern void savetemp(char  *fn,uint8_t* daptr,int32_t dasiz);
 //#line "menues.c" 49
 extern void getangplayers(short snum);
 //#line "menues.c" 67
--- a/Game/src/game.c
+++ b/Game/src/game.c
@@ -1107,13 +1107,14 @@
 void caches(void)
 {
      short i,k;
-
+    char text[512];
+    
      k = 0;
      for(i=0;i<cacnum;i++)
           if ((*cac[i].lock) >= 200)
           {
-                sprintf(tempbuf,"Locked- %d: Leng:%d, Lock:%d",i,cac[i].leng,*cac[i].lock);
-                printext256(0L,k,31,-1,tempbuf,1); k += 6;
+                sprintf(text,"Locked- %d: Leng:%d, Lock:%d",i,cac[i].leng,*cac[i].lock);
+                printext256(0L,k,31,-1,text,1); k += 6;
           }
 
      k += 6;
@@ -1121,8 +1122,8 @@
      for(i=1;i<11;i++)
           if (lumplockbyte[i] >= 200)
           {
-                sprintf(tempbuf,"RTS Locked %hd:",i);
-                printext256(0L,k,31,-1,tempbuf,1); k += 6;
+                sprintf(text,"RTS Locked %hd:",i);
+                printext256(0L,k,31,-1,text,1); k += 6;
           }
 
 
@@ -1134,7 +1135,8 @@
 {	
 	int i;
 	int offx, offy, stepx, stepy;
-
+    char text[512];
+    
 	offx = 21; offy = 30;
 	stepx = 73; stepy = 20;
 
@@ -1147,15 +1149,15 @@
 	for(i=connecthead;i>=0;i=connectpoint2[i])
 	{	
 		// Disp name
-		sprintf(tempbuf,"%s", ud.user_name[i]);
-		minitext(offx+(stepx*(i&3)),offy+0+((i&4)>>2)*stepy, tempbuf, sprite[ps[i].i].pal, 2+8+16);
+		sprintf(text,"%s", ud.user_name[i]);
+		minitext(offx+(stepx*(i&3)),offy+0+((i&4)>>2)*stepy, text, sprite[ps[i].i].pal, 2+8+16);
 
 		// Disp MAP CRC
 		if(ps[i].fakeplayer)
-			sprintf(tempbuf,"MAP CRC: (bot)");
+			sprintf(text,"MAP CRC: (bot)");
 		else
-			sprintf(tempbuf,"MAP CRC: %X", ud.mapCRC[i]);
-		minitext(offx+(stepx*(i&3)),offy+7+((i&4)>>2)*stepy, tempbuf, COLOR_ON,2+8+16);
+			sprintf(text,"MAP CRC: %X", ud.mapCRC[i]);
+		minitext(offx+(stepx*(i&3)),offy+7+((i&4)>>2)*stepy, text, COLOR_ON,2+8+16);
 
 	}
 }
@@ -1770,7 +1772,8 @@
 void displayfragbar(void)
 {
     short i, j;
-
+    char text[512];
+    
     j = 0;
 
     for(i=connecthead;i>=0;i=connectpoint2[i])
@@ -1784,8 +1787,8 @@
     for(i=connecthead;i>=0;i=connectpoint2[i])
     {
         minitext(21+(73*(i&3)),2+((i&28)<<1),&ud.user_name[i][0],sprite[ps[i].i].pal,2+8+16+128);
-        sprintf(tempbuf,"%d",ps[i].frag-ps[i].fraggedself);
-        minitext(17+50+(73*(i&3)),2+((i&28)<<1),tempbuf,sprite[ps[i].i].pal,2+8+16+128);
+        sprintf(text,"%d",ps[i].frag-ps[i].fraggedself);
+        minitext(17+50+(73*(i&3)),2+((i&28)<<1),text,sprite[ps[i].i].pal,2+8+16+128);
     }
 }
 
@@ -1822,7 +1825,8 @@
 	float t = 60000;
 	int s;
 	float offsetx, offsety;
-
+    
+    
 	switch(weapon)
 	{	
 		case  KNEE_WEAPON			: s=0;					break;
@@ -1892,7 +1896,8 @@
     int32_t i, j, o, ss, u;
     uint8_t  permbit;
 	short offx = 3, offy = 3, stepx=60, stepy=6;
-
+    char text[512];
+    
     p = &ps[snum];
 
     if (p->invdisptime > 0) 
@@ -1941,10 +1946,10 @@
 		{
 			offx = 5; offy = 160;
 
-			sprintf(tempbuf,"%d", ps[screenpeek].ammo_amount[ps[screenpeek].curr_weapon]);
-			minitext(offx+26,offy+21,tempbuf,COLOR_ON,2+8+16); //minitext: 2 red light, 23 yellow
-			sprintf(tempbuf,"%d", ps[screenpeek].last_extra); 
-			gametext(offx,offy+20,tempbuf,ps[screenpeek].last_extra<=50?15:0,2+8+16); //minitext: 2 red light, 23 yellow
+			sprintf(text,"%d", ps[screenpeek].ammo_amount[ps[screenpeek].curr_weapon]);
+			minitext(offx+26,offy+21,text,COLOR_ON,2+8+16); //minitext: 2 red light, 23 yellow
+			sprintf(text,"%d", ps[screenpeek].last_extra); 
+			gametext(offx,offy+20,text,ps[screenpeek].last_extra<=50?15:0,2+8+16); //minitext: 2 red light, 23 yellow
 			rotatesprite((offx+0*10)<<16,(offy+28)<<16,20000,0,SHIELD,ps[screenpeek].shield_amount?25:100,0,2+8+16,0,0,xdim-1,ydim-1);
 			rotatesprite((offx+0*10)<<16,(offy+28)<<16,ksqrt(ps[screenpeek].shield_amount)*20000/10,0,SHIELD,0,0,2+8+16,0,0,xdim-1,ydim-1);
 			rotatesprite((offx+1*10)<<16,(offy+28)<<16,35000,0,JETPACK_ICON,ps[screenpeek].jetpack_amount?25:100,0,2+8+16,0,0,xdim-1,ydim-1);
@@ -2171,7 +2176,8 @@
 	int32_t currentFps;
 	static int32_t fpsAvg = 0, savedFps = 0;
 	static boolean toggle = true;
-
+    char text[512];
+    
 	strcpy(mapname,boardfilename);
 	for(i=0;i<512;i++)
 		if(mapname[i]=='.')
@@ -2178,10 +2184,10 @@
 			mapname[i]=0;
 
 	if( mapname[0] != 0 && ud.m_level_number == 7 && ud.m_volume_number == 0 )
-		sprintf(tempbuf, "%s", mapname);
+		sprintf(text, "%s", mapname);
     else
 		//sprintf(tempbuf, "%s", level_names[ud.volume_number*11 + ud.level_number]);
-		sprintf(tempbuf, "e%dl%d", ud.volume_number+1, ud.level_number+1);
+		sprintf(text, "e%dl%d", ud.volume_number+1, ud.level_number+1);
 		
 
     i = totalclock;
@@ -2216,14 +2222,15 @@
 		savedFps = fpsAvg;
 
 	sprintf(fps," %d", savedFps);
-	strcat(tempbuf, fps);
+	strcat(text, fps);
 
-	minitext(offx,offy,tempbuf,color,2+8+16+128);
+	minitext(offx,offy,text,color,2+8+16+128);
 }
 
 void coords(short snum)
 {
     short x = 200, y = 0;
+    char text[512];
     // x = 250 is too much on the right and
     // will make the text going out of the screen 
     // if screen <= (320x200)
@@ -2238,28 +2245,28 @@
             y = 16;
     }
 
-    sprintf(tempbuf,"X= %d",ps[snum].posx);
-    printext256(x,y,31,-1,tempbuf,1);
-    sprintf(tempbuf,"Y= %d",ps[snum].posy);
-    printext256(x,y+7L,31,-1,tempbuf,1);
-    sprintf(tempbuf,"Z= %d",ps[snum].posz);
-    printext256(x,y+14L,31,-1,tempbuf,1);
-    sprintf(tempbuf,"A= %d",ps[snum].ang);
-    printext256(x,y+21L,31,-1,tempbuf,1);
-    sprintf(tempbuf,"ZV= %d",ps[snum].poszv);
-    printext256(x,y+28L,31,-1,tempbuf,1);
-    sprintf(tempbuf,"OG= %d",ps[snum].on_ground);
-    printext256(x,y+35L,31,-1,tempbuf,1);
-    sprintf(tempbuf,"AM= %d",ps[snum].ammo_amount[GROW_WEAPON]);
-    printext256(x,y+43L,31,-1,tempbuf,1);
-    sprintf(tempbuf,"LFW= %d",ps[snum].last_full_weapon);
-    printext256(x,y+50L,31,-1,tempbuf,1);
-    sprintf(tempbuf,"SECTL= %d",sector[ps[snum].cursectnum].lotag);
-    printext256(x,y+57L,31,-1,tempbuf,1);
-    sprintf(tempbuf,"SEED= %d",randomseed);
-    printext256(x,y+64L,31,-1,tempbuf,1);
-    sprintf(tempbuf,"THOLD= %d",ps[snum].transporter_hold);
-    printext256(x,y+64L+7,31,-1,tempbuf,1);
+    sprintf(text,"X= %d",ps[snum].posx);
+    printext256(x,y,31,-1,text,1);
+    sprintf(text,"Y= %d",ps[snum].posy);
+    printext256(x,y+7L,31,-1,text,1);
+    sprintf(text,"Z= %d",ps[snum].posz);
+    printext256(x,y+14L,31,-1,text,1);
+    sprintf(text,"A= %d",ps[snum].ang);
+    printext256(x,y+21L,31,-1,text,1);
+    sprintf(text,"ZV= %d",ps[snum].poszv);
+    printext256(x,y+28L,31,-1,text,1);
+    sprintf(text,"OG= %d",ps[snum].on_ground);
+    printext256(x,y+35L,31,-1,text,1);
+    sprintf(text,"AM= %d",ps[snum].ammo_amount[GROW_WEAPON]);
+    printext256(x,y+43L,31,-1,text,1);
+    sprintf(text,"LFW= %d",ps[snum].last_full_weapon);
+    printext256(x,y+50L,31,-1,text,1);
+    sprintf(text,"SECTL= %d",sector[ps[snum].cursectnum].lotag);
+    printext256(x,y+57L,31,-1,text,1);
+    sprintf(text,"SEED= %d",randomseed);
+    printext256(x,y+64L,31,-1,text,1);
+    sprintf(text,"THOLD= %d",ps[snum].transporter_hold);
+    printext256(x,y+64L+7,31,-1,text,1);
 }
 
 void operatefta(void)
@@ -3590,6 +3597,7 @@
     short i, s, startwall, endwall, sect, clostest;
     int32_t x, y, d;
     spritetype *sp;
+    char text[512];
 
     if(j >= 0)
     {
@@ -5167,8 +5175,8 @@
                             }
                             if(j == MAXSPRITES)
                             {
-                                sprintf(tempbuf,"Found lonely Sector Effector (lotag 0) at (%d,%d)\n",sp->x,sp->y);
-                                gameexit(tempbuf);
+                                sprintf(text,"Found lonely Sector Effector (lotag 0) at (%d,%d)\n",sp->x,sp->y);
+                                gameexit(text);
                             }
                             sp->owner = j;
                         }
@@ -5184,8 +5192,8 @@
                             tempwallptr++;
                             if(tempwallptr > 2047)
                             {
-                                sprintf(tempbuf,"Too many moving sectors at (%d,%d).\n",wall[s].x,wall[s].y);
-                                gameexit(tempbuf);
+                                sprintf(text,"Too many moving sectors at (%d,%d).\n",wall[s].x,wall[s].y);
+                                gameexit(text);
                             }
                         }
                         if( sp->lotag == 30 || sp->lotag == 6 || sp->lotag == 14 || sp->lotag == 5 )
@@ -5216,8 +5224,8 @@
 
                             if(j == 0)
                             {
-                                sprintf(tempbuf,"Subway found no zero'd sectors with locators\nat (%d,%d).\n",sp->x,sp->y);
-                                gameexit(tempbuf);
+                                sprintf(text,"Subway found no zero'd sectors with locators\nat (%d,%d).\n",sp->x,sp->y);
+                                gameexit(text);
                             }
 
                             sp->owner = -1;
@@ -7515,6 +7523,9 @@
 	    nextpage(); 
 		for(i=63;i>0;i-=7) 
 			palto(0,0,0,i);
+        
+        
+        
 	    totalclock = 0;
 	    while( totalclock < (120*7) && !KB_KeyWaiting() )
 	        getpackets();
@@ -9701,6 +9712,7 @@
     short t, tinc,gfx_offset;
     int32_t i, y,xfragtotal,yfragtotal;
     short bonuscnt;
+    char text[512];
 
     int32_t breathe[] =
     {
@@ -9970,16 +9982,16 @@
         minitext(23,80,"   NAME                                           KILLS",8,2+8+16+128);
         for(i=0;i<playerswhenstarted;i++)
         {
-            sprintf(tempbuf,"%-4d",i+1);
-            minitext(92+(i*23),80,tempbuf,3,2+8+16+128);
+            sprintf(text,"%-4d",i+1);
+            minitext(92+(i*23),80,text,3,2+8+16+128);
         }
 
         for(i=0;i<playerswhenstarted;i++)
         {
             xfragtotal = 0;
-            sprintf(tempbuf,"%d",i+1);
+            sprintf(text,"%d",i+1);
 
-            minitext(30,90+t,tempbuf,0,2+8+16+128);
+            minitext(30,90+t,text,0,2+8+16+128);
             minitext(38,90+t,ud.user_name[i],ps[i].palookup,2+8+16+128);
 
             for(y=0;y<playerswhenstarted;y++)
@@ -9986,26 +9998,26 @@
             {
                 if(i == y)
                 {
-                    sprintf(tempbuf,"%-4d",ps[y].fraggedself);
-                    minitext(92+(y*23),90+t,tempbuf,2,2+8+16+128);
+                    sprintf(text,"%-4d",ps[y].fraggedself);
+                    minitext(92+(y*23),90+t,text,2,2+8+16+128);
                     xfragtotal -= ps[y].fraggedself;
                 }
                 else
                 {
-                    sprintf(tempbuf,"%-4d",frags[i][y]);
-                    minitext(92+(y*23),90+t,tempbuf,0,2+8+16+128);
+                    sprintf(text,"%-4d",frags[i][y]);
+                    minitext(92+(y*23),90+t,text,0,2+8+16+128);
                     xfragtotal += frags[i][y];
                 }
 
                 if(myconnectindex == connecthead)
                 {
-                    sprintf(tempbuf,"stats %d killed %d %d\n",i+1,y+1,frags[i][y]);
-                    sendscore(tempbuf);
+                    sprintf(text,"stats %d killed %d %d\n",i+1,y+1,frags[i][y]);
+                    sendscore(text);
                 }
             }
 
-            sprintf(tempbuf,"%-4d",xfragtotal);
-            minitext(101+(8*23),90+t,tempbuf,2,2+8+16+128);
+            sprintf(text,"%-4d",xfragtotal);
+            minitext(101+(8*23),90+t,text,2,2+8+16+128);
 
             t += 7;
         }
@@ -10019,8 +10031,8 @@
                     yfragtotal += ps[i].fraggedself;
                 yfragtotal += frags[i][y];
             }
-            sprintf(tempbuf,"%-4d",yfragtotal);
-            minitext(92+(y*23),96+(8*7),tempbuf,2,2+8+16+128);
+            sprintf(text,"%-4d",yfragtotal);
+            minitext(92+(y*23),96+(8*7),text,2,2+8+16+128);
         }
 
         minitext(45,96+(8*7),"DEATHS",8,2+8+16+128);
@@ -10149,20 +10161,20 @@
                         bonuscnt++;
                         sound(PIPEBOMB_EXPLODE);
                     }
-                    sprintf(tempbuf,"%02d:%02d",
+                    sprintf(text,"%02d:%02d",
                         (ps[myconnectindex].player_par/(26*60))%60,
                         (ps[myconnectindex].player_par/26)%60);
-                    gametext((320>>2)+71,60+9,tempbuf,0,2+8+16);
+                    gametext((320>>2)+71,60+9,text,0,2+8+16);
 
-                    sprintf(tempbuf,"%02d:%02d",
+                    sprintf(text,"%02d:%02d",
                         (partime[ud.volume_number*11+ud.last_level-1]/(26*60))%60,
                         (partime[ud.volume_number*11+ud.last_level-1]/26)%60);
-                    gametext((320>>2)+71,69+9,tempbuf,0,2+8+16);
+                    gametext((320>>2)+71,69+9,text,0,2+8+16);
 
-                    sprintf(tempbuf,"%02d:%02d",
+                    sprintf(text,"%02d:%02d",
                         (designertime[ud.volume_number*11+ud.last_level-1]/(26*60))%60,
                         (designertime[ud.volume_number*11+ud.last_level-1]/26)%60);
-                    gametext((320>>2)+71,78+9,tempbuf,0,2+8+16);
+                    gametext((320>>2)+71,78+9,text,0,2+8+16);
 
                 }
             }
@@ -10184,19 +10196,19 @@
                         bonuscnt++;
                         sound(PIPEBOMB_EXPLODE);
                     }
-                    sprintf(tempbuf,"%-3hhd",ps[myconnectindex].actors_killed);
-                    gametext((320>>2)+70,93+9,tempbuf,0,2+8+16);
+                    sprintf(text,"%-3hhd",ps[myconnectindex].actors_killed);
+                    gametext((320>>2)+70,93+9,text,0,2+8+16);
                     if(ud.player_skill > 3 )
                     {
-                        sprintf(tempbuf,"N/A");
-                        gametext((320>>2)+70,99+4+9,tempbuf,0,2+8+16);
+                        sprintf(text,"N/A");
+                        gametext((320>>2)+70,99+4+9,text,0,2+8+16);
                     }
                     else
                     {
                         if( (ps[myconnectindex].max_actors_killed-ps[myconnectindex].actors_killed) < 0 )
-                            sprintf(tempbuf,"%-3d",0);
-                        else sprintf(tempbuf,"%-3d",ps[myconnectindex].max_actors_killed-ps[myconnectindex].actors_killed);
-                        gametext((320>>2)+70,99+4+9,tempbuf,0,2+8+16);
+                            sprintf(text,"%-3d",0);
+                        else sprintf(text,"%-3d",ps[myconnectindex].max_actors_killed-ps[myconnectindex].actors_killed);
+                        gametext((320>>2)+70,99+4+9,text,0,2+8+16);
                     }
                 }
             }
@@ -10213,12 +10225,12 @@
                         bonuscnt++;
                         sound(PIPEBOMB_EXPLODE);
                     }
-                    sprintf(tempbuf,"%-3d",ps[myconnectindex].secret_rooms);
-                    gametext((320>>2)+70,120+9,tempbuf,0,2+8+16);
+                    sprintf(text,"%-3d",ps[myconnectindex].secret_rooms);
+                    gametext((320>>2)+70,120+9,text,0,2+8+16);
                     if( ps[myconnectindex].secret_rooms > 0 )
-                        sprintf(tempbuf,"%-3d",(100*ps[myconnectindex].secret_rooms/ps[myconnectindex].max_secret_rooms));
-                    sprintf(tempbuf,"%-3d",ps[myconnectindex].max_secret_rooms-ps[myconnectindex].secret_rooms);
-                    gametext((320>>2)+70,130+9,tempbuf,0,2+8+16);
+                        sprintf(text,"%-3d",(100*ps[myconnectindex].secret_rooms/ps[myconnectindex].max_secret_rooms));
+                    sprintf(text,"%-3d",ps[myconnectindex].max_secret_rooms-ps[myconnectindex].secret_rooms);
+                    gametext((320>>2)+70,130+9,text,0,2+8+16);
                 }
             }
 
@@ -10558,7 +10570,7 @@
 	char  score[20];
 	time_t time4file;
 	struct tm *tmHMS;
-    
+    char text[512];
 
 	// xduke: Build a nice name w/ date and players name if in multi mode.
 	time(&time4file);
@@ -10576,29 +10588,29 @@
 
 	if(ud.multimode>1) // if more than 1 player, we add name. Then add score if DM
 	{
-        tempbuf[0] = '\0';
-		strcat((char *)tempbuf, " [");
+        text[0] = '\0';
+		strcat((char *)text, " [");
 		for(i=connecthead;i>=0;i=connectpoint2[i])
 		{
 			if(!ud.user_name[i][0])
-				strcat(tempbuf, "NoName");
+				strcat(text, "NoName");
 			else
-				strcat(tempbuf, &ud.user_name[i][0]);
+				strcat(text, &ud.user_name[i][0]);
 
 			if(ud.m_coop==0 || ud.m_coop==2)  // if DM or DM No spawn. Add Score as well
 			{
-				strcat(tempbuf, "(");
+				strcat(text, "(");
                 snprintf(score, sizeof(score), "%d",ps[i].frag-ps[i].fraggedself);
-				strcat(tempbuf, score);
-				strcat(tempbuf, ") vs ");
+				strcat(text, score);
+				strcat(text, ") vs ");
 			}
 			else
-				strcat(tempbuf, " vs ");
+				strcat(text, " vs ");
 		}	
-		tempbuf[strlen(tempbuf)-4]=0; // remove last vs
-		strcat(tempbuf, "]");
+		tempbuf[strlen(text)-4]=0; // remove last vs
+		strcat(text, "]");
 	}
-	strcat(tempbuf, ".bmp");
+	strcat(text, ".bmp");
 
 
 	// If this is a TC save it to the TC's directory
--- a/Game/src/menues.c
+++ b/Game/src/menues.c
@@ -150,7 +150,7 @@
 }
 
 
-void savetemp(char  *fn,int32_t daptr,int32_t dasiz)
+void savetemp(char  *fn,uint8_t* daptr,int32_t dasiz)
 {
     int fp;
 
@@ -325,7 +325,7 @@
      tiles[MAXTILES-3].dim.width = 100;
     tiles[MAXTILES-3].dim.height = 160;
     
-     kdfread((uint8_t  *)tiles[MAXTILES-3].data,160,100,fil);
+     kdfread(tiles[MAXTILES-3].data,160,100,fil);
 
          kdfread(&numwalls,2,1,fil);
      kdfread(&wall[0],sizeof(walltype),MAXWALLS,fil);
@@ -1430,7 +1430,8 @@
 	static int lastkeysetup = 0;
 	static int waiting4key = false;
 	static int current_resolution = 0;
-
+    char text[512];
+    
     getpackets();
 
     if(((ControllerType == controltype_keyboardandmouse)||
@@ -1512,39 +1513,7 @@
 
             if( x >= -1 ) cmenu(100);
             break;
-// CTW - REMOVED
-/*      case 20001:
-            x = probe(188,80+32+32,0,0);
-            gametext(160,86-8,"You must be in Windows 95 to",0,2+8+16);
-            gametext(160,86,"play on TEN",0,2+8+16);
-            gametext(160,86+32,"PRESS ANY KEY...",0,2+8+16);
-            if(x >= -1) cmenu(0);
-            break;
 
-        case 20002:
-            x = probe(188,80+32+32+32,0,0);
-            gametext(160,86-8,"MISSING FILE: TENGAME.INI.  PLEASE",0,2+8+16);
-            gametext(160,86,"CONNECT TO TEN BY LAUNCHING THE",0,2+8+16);
-            gametext(160,86+8,"CONNECT TO TEN SHORTCUT OR CONTACT",0,2+8+16);
-            gametext(160,86+8+8,"CUSTOMER SUPPORT AT 1-800-8040-TEN.",0,2+8+16);
-            gametext(160,86+8+8+32,"PRESS ANY KEY...",0,2+8+16);
-            if(x >= -1) cmenu(0);
-            break;
-        case 20003:
-            x = probe(188,80+32+32,0,0);
-            gametext(160,86-8,"BAD TEN INSTALL:  PLEASE RE-INSTALL",0,2+8+16);
-            gametext(160,86,"BAD TEN INSTALL:  PLEASE RE-INSTALL TEN",0,2+8+16);
-            gametext(160,86+32,"PRESS ANY KEY...",0,2+8+16);
-            if(x >= -1) cmenu(0);
-            break;
-        case 20005:
-            x = probe(188,80+32+32,0,0);
-            gametext(160,86-8,"GET THE LATEST TEN SOFTWARE AT",0,2+8+16);
-            gametext(160,86,"HTTP://WWW.TEN.NET",0,2+8+16);
-            gametext(160,86+32,"PRESS ANY KEY...",0,2+8+16);
-            if(x >= -1) cmenu(0);
-            break;*/
-// CTW END - REMOVED
 
         case 15001:
         case 15000:
@@ -1551,8 +1520,8 @@
 
             gametext(160,90,"LOAD last game:",0,2+8+16);
 
-            sprintf(tempbuf,"\"%s\"",ud.savegame[lastsavedpos]);
-            gametext(160,99,tempbuf,0,2+8+16);
+            sprintf(text,"\"%s\"",ud.savegame[lastsavedpos]);
+            gametext(160,99,text,0,2+8+16);
 
             gametext(160,99+9,"(Y/N)",0,2+8+16);
 
@@ -1860,11 +1829,11 @@
             menutext(160,24,0,0,"SAVE GAME");
 
             rotatesprite(101<<16,97<<16,65536L,512,MAXTILES-3,-32,0,4+10+64,0,0,xdim-1,ydim-1);
-            sprintf(tempbuf,"PLAYERS: %-2d                      ",ud.multimode);
-            gametext(160,158,tempbuf,0,2+8+16);
+            sprintf(text,"PLAYERS: %-2d                      ",ud.multimode);
+            gametext(160,158,text,0,2+8+16);
 
-            sprintf(tempbuf,"EPISODE: %-2d / LEVEL: %-2d / SKILL: %-2d",1+ud.volume_number,1+ud.level_number,ud.player_skill);
-            gametext(160,170,tempbuf,0,2+8+16);
+            sprintf(text,"EPISODE: %-2d / LEVEL: %-2d / SKILL: %-2d",1+ud.volume_number,1+ud.level_number,ud.player_skill);
+            gametext(160,170,text,0,2+8+16);
 
             dispnames();
 
@@ -3031,30 +3000,30 @@
 			// display the button list
 			for(i=0; i<MAXMOUSEBUTTONS; i++)
 			{
-				sprintf(tempbuf, "#%d",i);
+				sprintf(text, "#%d",i);
 				switch(i)
 				{
 					case 0:
-						strcat(tempbuf, " Left");
+						strcat(text, " Left");
 						break;
 					case 1:
-						strcat(tempbuf, " Right");
+						strcat(text, " Right");
 						break;
 					case 2:
-						strcat(tempbuf, " Middle");
+						strcat(text, " Middle");
 						break;
 					case 3:
-						strcat(tempbuf, " Wheel up");
+						strcat(text, " Wheel up");
 						break;
 					case 4:
-						strcat(tempbuf, " Wheel down");
+						strcat(text, " Wheel down");
 						break;
 					default:
-						strcat(tempbuf, " (Extra)");
+						strcat(text, " (Extra)");
 						break;
 				}
 				
-				gametext(c,47+i*8,tempbuf,0,2+8+16);
+				gametext(c,47+i*8,text,0,2+8+16);
 				gametext(c+121,47+i*8,(MouseMapping[i]!=-1)?CONFIG_FunctionNumToName(MouseMapping[i]):"...",0,2+8+16);
 			}
 
@@ -3131,22 +3100,22 @@
 				switch(i)
 				{
 					case 0:
-						strcat(tempbuf, "X left");
+						strcat(text, "X left");
 						break;
 					case 1:
-						strcat(tempbuf, "X right");
+						strcat(text, "X right");
 						break;
 					case 2:
-						strcat(tempbuf, "Y up");
+						strcat(text, "Y up");
 						break;
 					case 3:
-						strcat(tempbuf, "Y down");
+						strcat(text, "Y down");
 						break;
 					default:
 						break;
 				}
 				
-				gametext(c,47+i*8,tempbuf,0,2+8+16);
+				gametext(c,47+i*8,text,0,2+8+16);
 				gametext(c+121,47+i*8,(MouseDigitalAxeMapping[i>>1][i&1]!=-1)?CONFIG_FunctionNumToName(MouseDigitalAxeMapping[i>>1][i&1]):"...",0,2+8+16);
 			}
 
@@ -3233,11 +3202,11 @@
 			}
 				
 			menutext(c,43,0,0,"RESOLUTION");
-			sprintf(tempbuf, "%d x %d", validmodexdim[current_resolution],validmodeydim[current_resolution]);
+			sprintf(text, "%d x %d", validmodexdim[current_resolution],validmodeydim[current_resolution]);
 			if (lastkeysetup == 0 || (totalclock%64 < 32)) // blink color after change
-				menutext(c+150,43,0,0,tempbuf);
+				menutext(c+150,43,0,0,text);
 			else
-				menutext(c+150,43,0,1,tempbuf);
+				menutext(c+150,43,0,1,text);
 
 			menutext(c,43+16*1,SHX(-3),PHX(-3),"FULLSCREEN");
 			menutext(c+160+40,43+16*1,0,0,BFullScreen?"ON":"OFF");
@@ -3314,10 +3283,10 @@
 
             if(current_menu >= 360 && current_menu <= 369 )
             {
-                sprintf(tempbuf,"PLAYERS: %-2d                      ",ud.multimode);
-                gametext(160,158,tempbuf,0,2+8+16);
-                sprintf(tempbuf,"EPISODE: %-2d / LEVEL: %-2d / SKILL: %-2d",1+ud.volume_number,1+ud.level_number,ud.player_skill);
-                gametext(160,170,tempbuf,0,2+8+16);
+                sprintf(text,"PLAYERS: %-2d                      ",ud.multimode);
+                gametext(160,158,text,0,2+8+16);
+                sprintf(text,"EPISODE: %-2d / LEVEL: %-2d / SKILL: %-2d",1+ud.volume_number,1+ud.level_number,ud.player_skill);
+                gametext(160,170,text,0,2+8+16);
 
                 x = strget((320>>1),184,&ud.savegame[current_menu-360][0],19, 999 );
 
@@ -3379,10 +3348,10 @@
                   }
 
                   rotatesprite(101<<16,97<<16,65536L,512,MAXTILES-3,-32,0,4+10+64,0,0,xdim-1,ydim-1);
-                  sprintf(tempbuf,"PLAYERS: %-2d                      ",numplr);
-                  gametext(160,158,tempbuf,0,2+8+16);
-                  sprintf(tempbuf,"EPISODE: %-2d / LEVEL: %-2d / SKILL: %-2d",1+volnum,1+levnum,plrskl);
-                  gametext(160,170,tempbuf,0,2+8+16);
+                  sprintf(text,"PLAYERS: %-2d                      ",numplr);
+                  gametext(160,158,text,0,2+8+16);
+                  sprintf(text,"EPISODE: %-2d / LEVEL: %-2d / SKILL: %-2d",1+volnum,1+levnum,plrskl);
+                  gametext(160,170,text,0,2+8+16);
               }
               else menutext(69,70,0,0,"EMPTY");
           }
@@ -3396,10 +3365,10 @@
                   rotatesprite(101<<16,97<<16,65536L,512,MAXTILES-3,-32,0,4+10+64,0,0,xdim-1,ydim-1);
               }
               else menutext(69,70,0,0,"EMPTY");
-              sprintf(tempbuf,"PLAYERS: %-2d                      ",ud.multimode);
-              gametext(160,158,tempbuf,0,2+8+16);
-              sprintf(tempbuf,"EPISODE: %-2d / LEVEL: %-2d / SKILL: %-2d",1+ud.volume_number,1+ud.level_number,ud.player_skill);
-              gametext(160,170,tempbuf,0,2+8+16);
+              sprintf(text,"PLAYERS: %-2d                      ",ud.multimode);
+              gametext(160,158,text,0,2+8+16);
+              sprintf(text,"EPISODE: %-2d / LEVEL: %-2d / SKILL: %-2d",1+ud.volume_number,1+ud.level_number,ud.player_skill);
+              gametext(160,170,text,0,2+8+16);
           }
 
             switch( x )
@@ -4130,21 +4099,21 @@
             menutext(c,57-9,SHX(-2),PHX(-2),"GAME TYPE");
 
 if (VOLUMEONE)
-{            sprintf(tempbuf,"EPISODE %d",ud.m_volume_number+1);
-            menutext(c,57+16-9,SHX(-3),1,tempbuf);
+{            sprintf(text,"EPISODE %d",ud.m_volume_number+1);
+            menutext(c,57+16-9,SHX(-3),1,text);
 } 
 else 
 {
-            sprintf(tempbuf,"EPISODE %d",ud.m_volume_number+1);
-            menutext(c,57+16-9,SHX(-3),PHX(-3),tempbuf);
+            sprintf(text,"EPISODE %d",ud.m_volume_number+1);
+            menutext(c,57+16-9,SHX(-3),PHX(-3),text);
 }
 
 #ifndef ONELEVELDEMO
-            sprintf(tempbuf,"LEVEL %d",ud.m_level_number+1);
-            menutext(c,57+16+16-9,SHX(-4),PHX(-4),tempbuf);
+            sprintf(text,"LEVEL %d",ud.m_level_number+1);
+            menutext(c,57+16+16-9,SHX(-4),PHX(-4),text);
 #else
-            sprintf(tempbuf,"LEVEL %d",ud.m_level_number+1);
-            menutext(c,57+16+16-9,SHX(-4),1,tempbuf);
+            sprintf(text,"LEVEL %d",ud.m_level_number+1);
+            menutext(c,57+16+16-9,SHX(-4),1,text);
 #endif
             menutext(c,57+16+16+16-9,SHX(-5),PHX(-5),"MONSTERS");
 
@@ -4656,9 +4625,9 @@
     tiles[MAXTILES-3-t].lock = 219+t;
 
     if(anim == 0 || lastanimhack != (MAXTILES-3-t))
-        allocache((int32_t *)&anim,length+sizeof(anim_t),&tiles[MAXTILES-3-t].lock);
+        allocache((uint8_t**)&anim,length+sizeof(anim_t),&tiles[MAXTILES-3-t].lock);
 
-    animbuf = (uint8_t  *)(FP_OFF(anim)+sizeof(anim_t));
+    animbuf = (uint8_t  *)(anim)+sizeof(anim_t);
 
     lastanimhack = (MAXTILES-3-t);
 
@@ -4704,7 +4673,7 @@
        else if(ud.volume_number == 1) ototalclock += 18;
        else                           ototalclock += 10;
 
-       tiles[MAXTILES-3-t].data = FP_OFF(ANIM_DrawFrame(i));
+       tiles[MAXTILES-3-t].data = ANIM_DrawFrame(i);
        rotatesprite(0<<16,0<<16,65536L,512,MAXTILES-3-t,0,0,2+4+8+16+64, 0,0,xdim-1,ydim-1);
        nextpage();
 
--- a/Game/src/player.c
+++ b/Game/src/player.c
@@ -2522,27 +2522,7 @@
             return;
         }
     }
-/*
-    if(p->select_dir)
-    {
-        if(psectlotag != 15 || (sb_snum&(1<<31)) )
-            p->select_dir = 0;
-        else
-        {
-            if(sync[snum].fvel > 127)
-            {
-                p->select_dir = 0;
-                activatewarpelevators(pi,-1);
-            }
-            else if(sync[snum].fvel <= -127)
-            {
-                p->select_dir = 0;
-                activatewarpelevators(pi,1);
-            }
-            return;
-        }
-    }
-  */
+
     if(p->pals_time > 0)
         p->pals_time--;
 
--- a/Game/src/premap.c
+++ b/Game/src/premap.c
@@ -28,6 +28,7 @@
 #include "filesystem.h"
 #include "game.h"
 
+
 extern uint8_t  everyothertime;
 short which_palookup = 9;
 
@@ -1453,8 +1454,8 @@
     int32_t l;
     char  levname[256];
 	char  fulllevelfilename[512];
+    char text[512];
 
-
 	KB_ClearKeyDown(sc_Pause); // avoid entering in pause mode.
 	
     if( (g&MODE_DEMO) != MODE_DEMO ) ud.recstat = ud.m_recstat;
@@ -1481,6 +1482,7 @@
 
 if (!VOLUMEONE)
 {
+    
     if( boardfilename[0] != 0 && ud.m_level_number == 7 && ud.m_volume_number == 0 )
     {
 		sprintf(fulllevelfilename, "%s\\%s",  getGameDir(), boardfilename);
@@ -1491,8 +1493,8 @@
 
         if ( loadboard( fulllevelfilename,&ps[0].posx, &ps[0].posy, &ps[0].posz, &ps[0].ang,&ps[0].cursectnum ) == -1 )
         {
-            sprintf(tempbuf,"User Map %s not found!\n",fulllevelfilename);
-            gameexit(tempbuf);
+            sprintf(text,"User Map %s not found!\n",fulllevelfilename);
+            gameexit(text);
         }
     }
     else
@@ -1505,8 +1507,8 @@
 		printf("filename=%s\n",fulllevelfilename );
 		if ( loadboard(fulllevelfilename ,&ps[0].posx, &ps[0].posy, &ps[0].posz, &ps[0].ang,&ps[0].cursectnum ) == -1)
         {
-			sprintf(tempbuf,"Internal Map %s not found! Not using the right grp file?\n",level_file_names[(ud.volume_number*11)+ud.level_number]);
-			gameexit(tempbuf);
+			sprintf(text,"Internal Map %s not found! Not using the right grp file?\n",level_file_names[(ud.volume_number*11)+ud.level_number]);
+			gameexit(text);
 		}
     }
 
@@ -1520,8 +1522,8 @@
 
     if ( (ud.volume_number > 1) || loadboard( levname,&ps[0].posx, &ps[0].posy, &ps[0].posz, &ps[0].ang,&ps[0].cursectnum ) == -1)
     {
-        sprintf(tempbuf,"Internal Map %s not found in Shareware grp pack!\n",level_file_names[(ud.volume_number*11)+ud.level_number]);
-        gameexit(tempbuf);
+        sprintf(text,"Internal Map %s not found in Shareware grp pack!\n",level_file_names[(ud.volume_number*11)+ud.level_number]);
+        gameexit(text);
     }
 }