diff --git a/polymer/eduke32/source/duke3d.h b/polymer/eduke32/source/duke3d.h index 917a42bb8..3142cf92b 100644 --- a/polymer/eduke32/source/duke3d.h +++ b/polymer/eduke32/source/duke3d.h @@ -749,8 +749,6 @@ extern MATTGAMEVAR aDefaultGameVars[MAXGAMEVARS]; extern int iGameVarCount; extern int spriteflags[MAXTILES], actorspriteflags[MAXSPRITES]; -extern inline int checkspriteflags(short sActor, int iType); -extern inline int checkspriteflagsp(short sPicnum, int iType); enum spriteflags { SPRITE_FLAG_SHADOW = 1, diff --git a/polymer/eduke32/source/funct.h b/polymer/eduke32/source/funct.h index ec5c8a5e2..7444e55e4 100644 --- a/polymer/eduke32/source/funct.h +++ b/polymer/eduke32/source/funct.h @@ -133,9 +133,9 @@ extern void getpackets(void); extern void check_fta_sounds(short i); extern inline short inventory(spritetype *s); extern inline int badguy(spritetype *s); -extern int badguypic(short pn); -extern void myos(long x,long y,short tilenum,signed char shade,char orientation); -extern void myospal(long x,long y,short tilenum,signed char shade,char orientation,char p); +extern int badguypic(int pn); +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); @@ -204,8 +204,8 @@ 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 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,short tilenum,signed char shade,char orientation); -extern void myospalx(long x,long y,short tilenum,signed char shade,char orientation,char p); +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); extern void ResetGameVars(void); extern void ResetActorGameVars(int iActor); @@ -244,4 +244,7 @@ extern void adduserquote(char *daquote); extern char *stripcolorcodes(char *t); extern void mpchangemap(char volume, char level); +extern inline int checkspriteflags(int iActor, int iType); +extern inline int checkspriteflagsp(int iPicnum, int iType); + #endif // __funct_h__ diff --git a/polymer/eduke32/source/game.c b/polymer/eduke32/source/game.c index bb6731f1b..6bfa85bfd 100644 --- a/polymer/eduke32/source/game.c +++ b/polymer/eduke32/source/game.c @@ -48,7 +48,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #ifdef _WIN32 #include extern int getversionfromwebsite(char *buffer); -#define BUILDDATE 20061214 +#define BUILDDATE 20061220 #define UPDATEINTERVAL 86400 // 24h #endif @@ -1432,22 +1432,22 @@ short inventory(spritetype *s) return 0; } -int checkspriteflags(short sActor, int iType) +int checkspriteflags(int iActor, int iType) { int i; - i = (spriteflags[sprite[sActor].picnum]^actorspriteflags[sActor]); + i = (spriteflags[sprite[iActor].picnum]^actorspriteflags[iActor]); if (i & iType) return 1; return 0; } -inline int checkspriteflagsp(short sPicnum, int iType) +inline int checkspriteflagsp(int iPicnum, int iType) { - if (spriteflags[sPicnum] & iType) return 1; + if (spriteflags[iPicnum] & iType) return 1; return 0; } -int badguypic(short pn) +int badguypic(int pn) { //this case can't be handled by the dynamictostatic system because it adds //stuff to the value from names.h so handling separately @@ -1506,7 +1506,7 @@ inline int badguy(spritetype *s) return(badguypic(s->picnum)); } -void myos(long x, long y, short tilenum, signed char shade, char orientation) +void myos(long x, long y, int tilenum, int shade, int orientation) { int p = sector[ps[screenpeek].cursectnum].floorpal, a = 0; @@ -1516,7 +1516,7 @@ void myos(long x, long y, short tilenum, signed char shade, char orientation) rotatesprite(x<<16,y<<16,65536L,a,tilenum,shade,p,2|orientation,windowx1,windowy1,windowx2,windowy2); } -void myospal(long x, long y, short tilenum, signed char shade, char orientation, char p) +void myospal(long x, long y, int tilenum, int shade, int orientation, int p) { int a = 0; @@ -1526,7 +1526,7 @@ void myospal(long x, long y, short tilenum, signed char shade, char orientation, rotatesprite(x<<16,y<<16,65536L,a,tilenum,shade,p,2|orientation,windowx1,windowy1,windowx2,windowy2); } -void myosx(long x, long y, short tilenum, signed char shade, char orientation) +void myosx(long x, long y, int tilenum, int shade, int orientation) { int p = sector[ps[screenpeek].cursectnum].floorpal, a = 0; @@ -1536,7 +1536,7 @@ void myosx(long x, long y, short tilenum, signed char shade, char orientation) rotatesprite(x<<16,y<<16,32768L,a,tilenum,shade,p,2|orientation,windowx1,windowy1,windowx2,windowy2); } -void myospalx(long x, long y, short tilenum, signed char shade, char orientation, char p) +void myospalx(long x, long y, int tilenum, int shade, int orientation, int p) { int a = 0; @@ -1884,12 +1884,10 @@ void displayfragbar(void) static void coolgaugetext(int snum) { - struct player_struct *p; + struct player_struct *p = &ps[snum]; long i, j, o, ss, u; int permbit; - p = &ps[snum]; - if (p->invdisptime > 0) displayinventory(p); if (ps[snum].gm&MODE_MENU) @@ -3843,15 +3841,13 @@ void displayrooms(int snum,long smoothratio) long cposx,cposy,cposz,dst,j,fz,cz; long tposx,tposy,i; short sect, cang, k, choriz; - struct player_struct *p; + struct player_struct *p = &ps[snum]; short tang; long tiltcx,tiltcy,tiltcs=0; // JBF 20030807 #ifdef POLYMOST extern long rendmode; #endif - p = &ps[snum]; - if (pub > 0 || getrendermode() >= 3) // JBF 20040101: redraw background always { if (ud.screen_size > 8 || (ud.screen_size == 8 && ud.statusbarscale<100)) drawbackground(); @@ -3884,9 +3880,7 @@ void displayrooms(int snum,long smoothratio) if (ud.camerasprite >= 0) { - spritetype *s; - - s = &sprite[ud.camerasprite]; + spritetype *s = &sprite[ud.camerasprite]; if (s->yvel < 0) s->yvel = -100; else if (s->yvel > 199) s->yvel = 300; @@ -4166,12 +4160,10 @@ static void dumpdebugdata(void) 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) { - int i; + int i = insertsprite(whatsect,s_ss); long p; spritetype *s; - i = insertsprite(whatsect,s_ss); - if (i < 0) { dumpdebugdata(); diff --git a/polymer/eduke32/source/gamedef.c b/polymer/eduke32/source/gamedef.c index 27d5b312b..1ecbaaf0c 100644 --- a/polymer/eduke32/source/gamedef.c +++ b/polymer/eduke32/source/gamedef.c @@ -1879,8 +1879,6 @@ static char parsecommand(void) } tempbuf[j+1] = '\0'; - Bcorrectfilename(tempbuf,0); - if (music_fn[k][i] == NULL) music_fn[k][i] = Bcalloc(Bstrlen(tempbuf)+1,sizeof(char)); else if ((Bstrlen(tempbuf)+1) > sizeof(music_fn[k][i])) diff --git a/polymer/eduke32/source/gameexec.c b/polymer/eduke32/source/gameexec.c index d1dc5d83d..12a3199d0 100644 --- a/polymer/eduke32/source/gameexec.c +++ b/polymer/eduke32/source/gameexec.c @@ -824,7 +824,10 @@ static void DoThisProjectile(int iSet, int lVar1, int lLabelID, int lVar2) proj=GetGameVarID(lVar1, g_i, g_p); if (proj < 0 || proj >= MAXSPRITES) + { + OSD_Printf("DoThisProjectile(): invalid projectile (%d)\n",proj); return; + } lValue=GetGameVarID(lVar2, g_i, g_p); @@ -2446,7 +2449,10 @@ static void DoActor(int iSet, int lVar1, int lLabelID, int lVar2, int lParm2) iActor=GetGameVarID(lVar1, g_i, g_p); if (iActor < 0 || iActor >= MAXSPRITES) + { + OSD_Printf("DoActor(): invalid sprite (%d)\n",iActor); return; + } lValue=GetGameVarID(lVar2, g_i, g_p); @@ -2790,10 +2796,13 @@ static void DoActor(int iSet, int lVar1, int lLabelID, int lVar2, int lParm2) static void DoProjectile(int iSet, int lVar1, int lLabelID, int lVar2) { - long lValue,proj=lVar1; + long lValue; - if (proj < 0 || proj >= MAXTILES) + if (lVar1 < 0 || lVar1 >= MAXTILES) + { + OSD_Printf("DoProjectile(): invalid tile (%d)\n",lVar1); return; + } lValue=GetGameVarID(lVar2, g_i, g_p); @@ -2801,198 +2810,198 @@ static void DoProjectile(int iSet, int lVar1, int lLabelID, int lVar2) { case PROJ_WORKSLIKE: if (iSet) - projectile[proj].workslike=lValue; + projectile[lVar1].workslike=lValue; else - SetGameVarID(lVar2, projectile[proj].workslike, g_i, g_p); + SetGameVarID(lVar2, projectile[lVar1].workslike, g_i, g_p); break; case PROJ_SPAWNS: if (iSet) - projectile[proj].spawns=lValue; + projectile[lVar1].spawns=lValue; else - SetGameVarID(lVar2, projectile[proj].spawns, g_i, g_p); + SetGameVarID(lVar2, projectile[lVar1].spawns, g_i, g_p); break; case PROJ_SXREPEAT: if (iSet) - projectile[proj].sxrepeat=lValue; + projectile[lVar1].sxrepeat=lValue; else - SetGameVarID(lVar2, projectile[proj].sxrepeat, g_i, g_p); + SetGameVarID(lVar2, projectile[lVar1].sxrepeat, g_i, g_p); break; case PROJ_SYREPEAT: if (iSet) - projectile[proj].syrepeat=lValue; + projectile[lVar1].syrepeat=lValue; else - SetGameVarID(lVar2, projectile[proj].syrepeat, g_i, g_p); + SetGameVarID(lVar2, projectile[lVar1].syrepeat, g_i, g_p); break; case PROJ_SOUND: if (iSet) - projectile[proj].sound=lValue; + projectile[lVar1].sound=lValue; else - SetGameVarID(lVar2, projectile[proj].sound, g_i, g_p); + SetGameVarID(lVar2, projectile[lVar1].sound, g_i, g_p); break; case PROJ_ISOUND: if (iSet) - projectile[proj].isound=lValue; + projectile[lVar1].isound=lValue; else - SetGameVarID(lVar2, projectile[proj].isound, g_i, g_p); + SetGameVarID(lVar2, projectile[lVar1].isound, g_i, g_p); break; case PROJ_VEL: if (iSet) - projectile[proj].vel=lValue; + projectile[lVar1].vel=lValue; else - SetGameVarID(lVar2, projectile[proj].vel, g_i, g_p); + SetGameVarID(lVar2, projectile[lVar1].vel, g_i, g_p); break; case PROJ_EXTRA: if (iSet) - projectile[proj].extra=lValue; + projectile[lVar1].extra=lValue; else - SetGameVarID(lVar2, projectile[proj].extra, g_i, g_p); + SetGameVarID(lVar2, projectile[lVar1].extra, g_i, g_p); break; case PROJ_DECAL: if (iSet) - projectile[proj].decal=lValue; + projectile[lVar1].decal=lValue; else - SetGameVarID(lVar2, projectile[proj].decal, g_i, g_p); + SetGameVarID(lVar2, projectile[lVar1].decal, g_i, g_p); break; case PROJ_TRAIL: if (iSet) - projectile[proj].trail=lValue; + projectile[lVar1].trail=lValue; else - SetGameVarID(lVar2, projectile[proj].trail, g_i, g_p); + SetGameVarID(lVar2, projectile[lVar1].trail, g_i, g_p); break; case PROJ_TXREPEAT: if (iSet) - projectile[proj].txrepeat=lValue; + projectile[lVar1].txrepeat=lValue; else - SetGameVarID(lVar2, projectile[proj].txrepeat, g_i, g_p); + SetGameVarID(lVar2, projectile[lVar1].txrepeat, g_i, g_p); break; case PROJ_TYREPEAT: if (iSet) - projectile[proj].tyrepeat=lValue; + projectile[lVar1].tyrepeat=lValue; else - SetGameVarID(lVar2, projectile[proj].tyrepeat, g_i, g_p); + SetGameVarID(lVar2, projectile[lVar1].tyrepeat, g_i, g_p); break; case PROJ_TOFFSET: if (iSet) - projectile[proj].toffset=lValue; + projectile[lVar1].toffset=lValue; else - SetGameVarID(lVar2, projectile[proj].toffset, g_i, g_p); + SetGameVarID(lVar2, projectile[lVar1].toffset, g_i, g_p); break; case PROJ_TNUM: if (iSet) - projectile[proj].tnum=lValue; + projectile[lVar1].tnum=lValue; else - SetGameVarID(lVar2, projectile[proj].tnum, g_i, g_p); + SetGameVarID(lVar2, projectile[lVar1].tnum, g_i, g_p); break; case PROJ_DROP: if (iSet) - projectile[proj].drop=lValue; + projectile[lVar1].drop=lValue; else - SetGameVarID(lVar2, projectile[proj].drop, g_i, g_p); + SetGameVarID(lVar2, projectile[lVar1].drop, g_i, g_p); break; case PROJ_CSTAT: if (iSet) - projectile[proj].cstat=lValue; + projectile[lVar1].cstat=lValue; else - SetGameVarID(lVar2, projectile[proj].cstat, g_i, g_p); + SetGameVarID(lVar2, projectile[lVar1].cstat, g_i, g_p); break; case PROJ_CLIPDIST: if (iSet) - projectile[proj].clipdist=lValue; + projectile[lVar1].clipdist=lValue; else - SetGameVarID(lVar2, projectile[proj].clipdist, g_i, g_p); + SetGameVarID(lVar2, projectile[lVar1].clipdist, g_i, g_p); break; case PROJ_SHADE: if (iSet) - projectile[proj].shade=lValue; + projectile[lVar1].shade=lValue; else - SetGameVarID(lVar2, projectile[proj].shade, g_i, g_p); + SetGameVarID(lVar2, projectile[lVar1].shade, g_i, g_p); break; case PROJ_XREPEAT: if (iSet) - projectile[proj].xrepeat=lValue; + projectile[lVar1].xrepeat=lValue; else - SetGameVarID(lVar2, projectile[proj].xrepeat, g_i, g_p); + SetGameVarID(lVar2, projectile[lVar1].xrepeat, g_i, g_p); break; case PROJ_YREPEAT: if (iSet) - projectile[proj].yrepeat=lValue; + projectile[lVar1].yrepeat=lValue; else - SetGameVarID(lVar2, projectile[proj].yrepeat, g_i, g_p); + SetGameVarID(lVar2, projectile[lVar1].yrepeat, g_i, g_p); break; case PROJ_PAL: if (iSet) - projectile[proj].pal=lValue; + projectile[lVar1].pal=lValue; else - SetGameVarID(lVar2, projectile[proj].pal, g_i, g_p); + SetGameVarID(lVar2, projectile[lVar1].pal, g_i, g_p); break; case PROJ_EXTRA_RAND: if (iSet) - projectile[proj].extra_rand=lValue; + projectile[lVar1].extra_rand=lValue; else - SetGameVarID(lVar2, projectile[proj].extra_rand, g_i, g_p); + SetGameVarID(lVar2, projectile[lVar1].extra_rand, g_i, g_p); break; case PROJ_HITRADIUS: if (iSet) - projectile[proj].hitradius=lValue; + projectile[lVar1].hitradius=lValue; else - SetGameVarID(lVar2, projectile[proj].hitradius, g_i, g_p); + SetGameVarID(lVar2, projectile[lVar1].hitradius, g_i, g_p); break; case PROJ_VEL_MULT: if (iSet) - projectile[proj].velmult=lValue; + projectile[lVar1].velmult=lValue; else - SetGameVarID(lVar2, projectile[proj].velmult, g_i, g_p); + SetGameVarID(lVar2, projectile[lVar1].velmult, g_i, g_p); break; case PROJ_OFFSET: if (iSet) - projectile[proj].offset=lValue; + projectile[lVar1].offset=lValue; else - SetGameVarID(lVar2, projectile[proj].offset, g_i, g_p); + SetGameVarID(lVar2, projectile[lVar1].offset, g_i, g_p); break; case PROJ_BOUNCES: if (iSet) - projectile[proj].bounces=lValue; + projectile[lVar1].bounces=lValue; else - SetGameVarID(lVar2, projectile[proj].bounces, g_i, g_p); + SetGameVarID(lVar2, projectile[lVar1].bounces, g_i, g_p); break; case PROJ_BSOUND: if (iSet) - projectile[proj].bsound=lValue; + projectile[lVar1].bsound=lValue; else - SetGameVarID(lVar2, projectile[proj].bsound, g_i, g_p); + SetGameVarID(lVar2, projectile[lVar1].bsound, g_i, g_p); break; case PROJ_RANGE: if (iSet) - projectile[proj].range=lValue; + projectile[lVar1].range=lValue; else - SetGameVarID(lVar2, projectile[proj].range, g_i, g_p); + SetGameVarID(lVar2, projectile[lVar1].range, g_i, g_p); break; default: @@ -3005,16 +3014,6 @@ static int parse(void); void OnEvent(int iEventID, int iActor, int iPlayer, long lDist) { - int og_i, og_p, okillit_flag; - long og_x, *og_t, *oinsptr; - spritetype *og_sp; - - if (iEventID >= MAXGAMEEVENTS) - { - AddLog("Invalid Event ID"); - return; - } - if (apScriptGameEvent[iEventID] == 0) { //Bsprintf(g_szBuf,"No event found for %d",iEventID); @@ -3022,64 +3021,64 @@ void OnEvent(int iEventID, int iActor, int iPlayer, long lDist) return; } - // save current values... - og_i=g_i; - og_p=g_p; - og_x=g_x; - og_sp=g_sp; - og_t=g_t; - okillit_flag=killit_flag; - oinsptr=insptr; - - g_i = iActor; // current sprite ID - g_p = iPlayer; // current player ID - g_x = lDist; // ? - g_sp = &sprite[g_i]; - g_t = &hittype[g_i].temp_data[0]; - - insptr = (apScriptGameEvent[iEventID]); - //Bsprintf(g_szBuf,"Executing event for %d at %lX",iEventID, insptr); - //AddLog(g_szBuf); - - killit_flag = 0; - - while (1) if (parse()) break; - - if (killit_flag == 1) + if (iEventID >= MAXGAMEEVENTS) { - // if player was set to squish, first stop that... - if (g_p >= 0) - { - if (ps[g_p].actorsqu == g_i) - ps[g_p].actorsqu = -1; - } - deletesprite(g_i); + AddLog("Invalid Event ID"); + return; } - // restore old values... - g_i=og_i; - g_p=og_p; - g_x=og_x; - g_sp=og_sp; - g_t=og_t; - killit_flag=okillit_flag; - insptr=oinsptr; + { + int og_i=g_i, og_p=g_p, okillit_flag=killit_flag; + long og_x=g_x, *og_t=g_t, *oinsptr=insptr; + spritetype *og_sp=g_sp; + + g_i = iActor; // current sprite ID + g_p = iPlayer; // current player ID + g_x = lDist; // ? + g_sp = &sprite[g_i]; + g_t = &hittype[g_i].temp_data[0]; - //AddLog("End of Execution"); + insptr = (apScriptGameEvent[iEventID]); + //Bsprintf(g_szBuf,"Executing event for %d at %lX",iEventID, insptr); + //AddLog(g_szBuf); + + killit_flag = 0; + + while (1) if (parse()) break; + + if (killit_flag == 1) + { + // if player was set to squish, first stop that... + if (g_p >= 0) + { + if (ps[g_p].actorsqu == g_i) + ps[g_p].actorsqu = -1; + } + deletesprite(g_i); + } + + // restore old values... + g_i=og_i; + g_p=og_p; + g_x=og_x; + g_sp=og_sp; + g_t=og_t; + killit_flag=okillit_flag; + insptr=oinsptr; + + //AddLog("End of Execution"); + } } -static long ifsquished(short i, short p) +static long ifsquished(int i, int p) { - sectortype *sc; - char squishme; - long floorceildist; + sectortype *sc = §or[SECT]; + int squishme; + long floorceildist = sc->floorz - sc->ceilingz; if (PN == APLAYER && ud.clipping) return 0; - sc = §or[SECT]; - floorceildist = sc->floorz - sc->ceilingz; - if (sc->lotag != 23) { squishme = floorceildist < (12<<8); // && (sc->lotag&32768) == 0; @@ -3789,12 +3788,10 @@ static int parse(void) break; case CON_IFDEAD: - { j = g_sp->extra; if (g_sp->picnum == APLAYER) j--; parseifelse(j < 0); - } break; case CON_AI: @@ -4389,10 +4386,16 @@ static int parse(void) int volnume=GetGameVarID(*insptr++,g_i,g_p), levnume=GetGameVarID(*insptr++,g_i,g_p); if (volnume > MAXVOLUMES-1 || volnume < 0) + { + OSD_Printf("parse():CON_STARTLEVEL: invalid volume (%d)\n",volnume); break; + } if (levnume > MAXLEVELS-1 || levnume < 0) + { + OSD_Printf("parse():CON_STARTLEVEL: invalid level (%d)\n",levnume); break; + } ud.m_volume_number = ud.volume_number = volnume; ud.m_level_number = ud.level_number = levnume; diff --git a/polymer/eduke32/source/player.c b/polymer/eduke32/source/player.c index 46444ee77..1f4f675c7 100644 --- a/polymer/eduke32/source/player.c +++ b/polymer/eduke32/source/player.c @@ -2068,16 +2068,11 @@ void displayweapon(int snum) { long gun_pos, looking_arc, cw; long weapon_xoffset, i, j; - int o,pal; - struct player_struct *p; - short *kb; + int o = 0,pal; + struct player_struct *p = &ps[snum]; + short *kb = &p->kickback_pic; int gs; - p = &ps[snum]; - kb = &p->kickback_pic; - - o = 0; - looking_arc = klabs(p->look_ang)/9; gs = sprite[p->i].shade; @@ -2669,11 +2664,8 @@ void getinput(int snum) boolean running; int32 turnamount; int32 keymove; - int32 momx,momy; - struct player_struct *p; - - momx = momy = 0; - p = &ps[snum]; + int32 momx = 0,momy = 0; + struct player_struct *p = &ps[snum]; if ((p->gm&MODE_MENU) || (p->gm&MODE_TYPE) || (ud.pause_on && !KB_KeyPressed(sc_Pause)) || (numplayers > 1 && totalclock < 10)) // HACK: kill getinput() for the first 10 tics of a new map in multi { @@ -3216,10 +3208,6 @@ void processinput(int snum) int pi = p->i; spritetype *s = &sprite[pi]; - p = &ps[snum]; - pi = p->i; - s = &sprite[pi]; - kb = &p->kickback_pic; p->player_par++; @@ -5180,10 +5168,9 @@ void computergetinput(long snum, input *syn) long dist, daang, zang, fightdist, damyang, damysect; long startsect, endsect, splc, send, startwall, endwall; short dasect, dawall, daspr; - struct player_struct *p; + struct player_struct *p = &ps[snum]; walltype *wal; - p = &ps[snum]; syn->fvel = 0; syn->svel = 0; syn->avel = 0; diff --git a/polymer/eduke32/source/premap.c b/polymer/eduke32/source/premap.c index 21fef1d2e..db5bfe104 100644 --- a/polymer/eduke32/source/premap.c +++ b/polymer/eduke32/source/premap.c @@ -525,12 +525,10 @@ void vscrn(void) void pickrandomspot(int snum) { - struct player_struct *p; + struct player_struct *p = &ps[snum]; int i=snum,j,k; unsigned long dist,pdist = -1; - p = &ps[snum]; - if (ud.multimode > 1 && !(gametype_flags[ud.coop] & GAMETYPE_FLAG_FIXEDRESPAWN)) { i = TRAND%numplayersprites; @@ -561,9 +559,7 @@ void pickrandomspot(int snum) static void resetplayerstats(int snum) { - struct player_struct *p; - - p = &ps[snum]; + struct player_struct *p = &ps[snum]; ud.show_help = 0; ud.showallmap = 0; @@ -672,9 +668,7 @@ static void resetplayerstats(int snum) void resetweapons(int snum) { int weapon; - struct player_struct *p; - - p = &ps[snum]; + struct player_struct *p = &ps[snum]; for (weapon = PISTOL_WEAPON; weapon < MAX_WEAPONS; weapon++) p->gotweapon[weapon] = 0; @@ -698,9 +692,7 @@ void resetweapons(int snum) void resetinventory(int snum) { - struct player_struct *p; - - p = &ps[snum]; + struct player_struct *p = &ps[snum]; p->inven_icon = 0; p->boot_amount = 0; @@ -721,11 +713,9 @@ void resetinventory(int snum) static void resetprestat(int snum,int g) { - struct player_struct *p; + struct player_struct *p = &ps[snum]; int i; - p = &ps[snum]; - spriteqloc = 0; for (i=0;i= 0) { if (SLT == 17 && SS > 16) @@ -2522,13 +2521,9 @@ void allignwarpelevators(void) void sharedkeys(int snum) { - int i, k; - char dainv; - unsigned long sb_snum, j; - struct player_struct *p; - - sb_snum = sync[snum].bits; - p = &ps[snum]; + int i, k, dainv; + unsigned long sb_snum = sync[snum].bits, j; + struct player_struct *p = &ps[snum]; if (p->cheat_phase == 1) return; @@ -3214,11 +3209,9 @@ static long hitawall(struct player_struct *p,short *hitw) void checksectors(int snum) { long i = -1,oldz; - struct player_struct *p; + struct player_struct *p = &ps[snum]; short j,hitscanwall; - p = &ps[snum]; - switch (sector[p->cursectnum].lotag) {