More tiny optimizations I guess

git-svn-id: https://svn.eduke32.com/eduke32@433 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
terminx 2006-12-21 09:33:26 +00:00
parent bc4139356a
commit 8d6eef5b0f
8 changed files with 158 additions and 194 deletions

View file

@ -749,8 +749,6 @@ extern MATTGAMEVAR aDefaultGameVars[MAXGAMEVARS];
extern int iGameVarCount; extern int iGameVarCount;
extern int spriteflags[MAXTILES], actorspriteflags[MAXSPRITES]; extern int spriteflags[MAXTILES], actorspriteflags[MAXSPRITES];
extern inline int checkspriteflags(short sActor, int iType);
extern inline int checkspriteflagsp(short sPicnum, int iType);
enum spriteflags { enum spriteflags {
SPRITE_FLAG_SHADOW = 1, SPRITE_FLAG_SHADOW = 1,

View file

@ -133,9 +133,9 @@ extern void getpackets(void);
extern void check_fta_sounds(short i); extern void check_fta_sounds(short i);
extern inline short inventory(spritetype *s); extern inline short inventory(spritetype *s);
extern inline int badguy(spritetype *s); extern inline int badguy(spritetype *s);
extern int badguypic(short pn); extern int badguypic(int pn);
extern void myos(long x,long y,short tilenum,signed char shade,char orientation); extern void myos(long x,long y,int tilenum,int shade,int orientation);
extern void myospal(long x,long y,short tilenum,signed char shade,char orientation,char p); extern void myospal(long x,long y,int tilenum,int shade,int orientation,int p);
extern void displayfragbar(void); extern void displayfragbar(void);
extern void FTA(short q,struct player_struct *p); extern void FTA(short q,struct player_struct *p);
extern void gameexit(char *t); 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 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 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 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 myosx(long x,long y,int tilenum,int shade,int orientation);
extern void myospalx(long x,long y,short tilenum,signed char shade,char orientation,char p); extern void myospalx(long x,long y,int tilenum,int shade,int orientation,int p);
extern void ResetGameVars(void); extern void ResetGameVars(void);
extern void ResetActorGameVars(int iActor); extern void ResetActorGameVars(int iActor);
@ -244,4 +244,7 @@ extern void adduserquote(char *daquote);
extern char *stripcolorcodes(char *t); extern char *stripcolorcodes(char *t);
extern void mpchangemap(char volume, char level); 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__ #endif // __funct_h__

View file

@ -48,7 +48,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#ifdef _WIN32 #ifdef _WIN32
#include <shellapi.h> #include <shellapi.h>
extern int getversionfromwebsite(char *buffer); extern int getversionfromwebsite(char *buffer);
#define BUILDDATE 20061214 #define BUILDDATE 20061220
#define UPDATEINTERVAL 86400 // 24h #define UPDATEINTERVAL 86400 // 24h
#endif #endif
@ -1432,22 +1432,22 @@ short inventory(spritetype *s)
return 0; return 0;
} }
int checkspriteflags(short sActor, int iType) int checkspriteflags(int iActor, int iType)
{ {
int i; int i;
i = (spriteflags[sprite[sActor].picnum]^actorspriteflags[sActor]); i = (spriteflags[sprite[iActor].picnum]^actorspriteflags[iActor]);
if (i & iType) return 1; if (i & iType) return 1;
return 0; 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; return 0;
} }
int badguypic(short pn) int badguypic(int pn)
{ {
//this case can't be handled by the dynamictostatic system because it adds //this case can't be handled by the dynamictostatic system because it adds
//stuff to the value from names.h so handling separately //stuff to the value from names.h so handling separately
@ -1506,7 +1506,7 @@ inline int badguy(spritetype *s)
return(badguypic(s->picnum)); 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; 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); 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; 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); 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; 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); 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; int a = 0;
@ -1884,12 +1884,10 @@ void displayfragbar(void)
static void coolgaugetext(int snum) static void coolgaugetext(int snum)
{ {
struct player_struct *p; struct player_struct *p = &ps[snum];
long i, j, o, ss, u; long i, j, o, ss, u;
int permbit; int permbit;
p = &ps[snum];
if (p->invdisptime > 0) displayinventory(p); if (p->invdisptime > 0) displayinventory(p);
if (ps[snum].gm&MODE_MENU) 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 cposx,cposy,cposz,dst,j,fz,cz;
long tposx,tposy,i; long tposx,tposy,i;
short sect, cang, k, choriz; short sect, cang, k, choriz;
struct player_struct *p; struct player_struct *p = &ps[snum];
short tang; short tang;
long tiltcx,tiltcy,tiltcs=0; // JBF 20030807 long tiltcx,tiltcy,tiltcs=0; // JBF 20030807
#ifdef POLYMOST #ifdef POLYMOST
extern long rendmode; extern long rendmode;
#endif #endif
p = &ps[snum];
if (pub > 0 || getrendermode() >= 3) // JBF 20040101: redraw background always if (pub > 0 || getrendermode() >= 3) // JBF 20040101: redraw background always
{ {
if (ud.screen_size > 8 || (ud.screen_size == 8 && ud.statusbarscale<100)) drawbackground(); 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) if (ud.camerasprite >= 0)
{ {
spritetype *s; spritetype *s = &sprite[ud.camerasprite];
s = &sprite[ud.camerasprite];
if (s->yvel < 0) s->yvel = -100; if (s->yvel < 0) s->yvel = -100;
else if (s->yvel > 199) s->yvel = 300; 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 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; long p;
spritetype *s; spritetype *s;
i = insertsprite(whatsect,s_ss);
if (i < 0) if (i < 0)
{ {
dumpdebugdata(); dumpdebugdata();

View file

@ -1879,8 +1879,6 @@ static char parsecommand(void)
} }
tempbuf[j+1] = '\0'; tempbuf[j+1] = '\0';
Bcorrectfilename(tempbuf,0);
if (music_fn[k][i] == NULL) if (music_fn[k][i] == NULL)
music_fn[k][i] = Bcalloc(Bstrlen(tempbuf)+1,sizeof(char)); music_fn[k][i] = Bcalloc(Bstrlen(tempbuf)+1,sizeof(char));
else if ((Bstrlen(tempbuf)+1) > sizeof(music_fn[k][i])) else if ((Bstrlen(tempbuf)+1) > sizeof(music_fn[k][i]))

View file

@ -824,7 +824,10 @@ static void DoThisProjectile(int iSet, int lVar1, int lLabelID, int lVar2)
proj=GetGameVarID(lVar1, g_i, g_p); proj=GetGameVarID(lVar1, g_i, g_p);
if (proj < 0 || proj >= MAXSPRITES) if (proj < 0 || proj >= MAXSPRITES)
{
OSD_Printf("DoThisProjectile(): invalid projectile (%d)\n",proj);
return; return;
}
lValue=GetGameVarID(lVar2, g_i, g_p); 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); iActor=GetGameVarID(lVar1, g_i, g_p);
if (iActor < 0 || iActor >= MAXSPRITES) if (iActor < 0 || iActor >= MAXSPRITES)
{
OSD_Printf("DoActor(): invalid sprite (%d)\n",iActor);
return; return;
}
lValue=GetGameVarID(lVar2, g_i, g_p); 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) 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; return;
}
lValue=GetGameVarID(lVar2, g_i, g_p); 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: case PROJ_WORKSLIKE:
if (iSet) if (iSet)
projectile[proj].workslike=lValue; projectile[lVar1].workslike=lValue;
else else
SetGameVarID(lVar2, projectile[proj].workslike, g_i, g_p); SetGameVarID(lVar2, projectile[lVar1].workslike, g_i, g_p);
break; break;
case PROJ_SPAWNS: case PROJ_SPAWNS:
if (iSet) if (iSet)
projectile[proj].spawns=lValue; projectile[lVar1].spawns=lValue;
else else
SetGameVarID(lVar2, projectile[proj].spawns, g_i, g_p); SetGameVarID(lVar2, projectile[lVar1].spawns, g_i, g_p);
break; break;
case PROJ_SXREPEAT: case PROJ_SXREPEAT:
if (iSet) if (iSet)
projectile[proj].sxrepeat=lValue; projectile[lVar1].sxrepeat=lValue;
else else
SetGameVarID(lVar2, projectile[proj].sxrepeat, g_i, g_p); SetGameVarID(lVar2, projectile[lVar1].sxrepeat, g_i, g_p);
break; break;
case PROJ_SYREPEAT: case PROJ_SYREPEAT:
if (iSet) if (iSet)
projectile[proj].syrepeat=lValue; projectile[lVar1].syrepeat=lValue;
else else
SetGameVarID(lVar2, projectile[proj].syrepeat, g_i, g_p); SetGameVarID(lVar2, projectile[lVar1].syrepeat, g_i, g_p);
break; break;
case PROJ_SOUND: case PROJ_SOUND:
if (iSet) if (iSet)
projectile[proj].sound=lValue; projectile[lVar1].sound=lValue;
else else
SetGameVarID(lVar2, projectile[proj].sound, g_i, g_p); SetGameVarID(lVar2, projectile[lVar1].sound, g_i, g_p);
break; break;
case PROJ_ISOUND: case PROJ_ISOUND:
if (iSet) if (iSet)
projectile[proj].isound=lValue; projectile[lVar1].isound=lValue;
else else
SetGameVarID(lVar2, projectile[proj].isound, g_i, g_p); SetGameVarID(lVar2, projectile[lVar1].isound, g_i, g_p);
break; break;
case PROJ_VEL: case PROJ_VEL:
if (iSet) if (iSet)
projectile[proj].vel=lValue; projectile[lVar1].vel=lValue;
else else
SetGameVarID(lVar2, projectile[proj].vel, g_i, g_p); SetGameVarID(lVar2, projectile[lVar1].vel, g_i, g_p);
break; break;
case PROJ_EXTRA: case PROJ_EXTRA:
if (iSet) if (iSet)
projectile[proj].extra=lValue; projectile[lVar1].extra=lValue;
else else
SetGameVarID(lVar2, projectile[proj].extra, g_i, g_p); SetGameVarID(lVar2, projectile[lVar1].extra, g_i, g_p);
break; break;
case PROJ_DECAL: case PROJ_DECAL:
if (iSet) if (iSet)
projectile[proj].decal=lValue; projectile[lVar1].decal=lValue;
else else
SetGameVarID(lVar2, projectile[proj].decal, g_i, g_p); SetGameVarID(lVar2, projectile[lVar1].decal, g_i, g_p);
break; break;
case PROJ_TRAIL: case PROJ_TRAIL:
if (iSet) if (iSet)
projectile[proj].trail=lValue; projectile[lVar1].trail=lValue;
else else
SetGameVarID(lVar2, projectile[proj].trail, g_i, g_p); SetGameVarID(lVar2, projectile[lVar1].trail, g_i, g_p);
break; break;
case PROJ_TXREPEAT: case PROJ_TXREPEAT:
if (iSet) if (iSet)
projectile[proj].txrepeat=lValue; projectile[lVar1].txrepeat=lValue;
else else
SetGameVarID(lVar2, projectile[proj].txrepeat, g_i, g_p); SetGameVarID(lVar2, projectile[lVar1].txrepeat, g_i, g_p);
break; break;
case PROJ_TYREPEAT: case PROJ_TYREPEAT:
if (iSet) if (iSet)
projectile[proj].tyrepeat=lValue; projectile[lVar1].tyrepeat=lValue;
else else
SetGameVarID(lVar2, projectile[proj].tyrepeat, g_i, g_p); SetGameVarID(lVar2, projectile[lVar1].tyrepeat, g_i, g_p);
break; break;
case PROJ_TOFFSET: case PROJ_TOFFSET:
if (iSet) if (iSet)
projectile[proj].toffset=lValue; projectile[lVar1].toffset=lValue;
else else
SetGameVarID(lVar2, projectile[proj].toffset, g_i, g_p); SetGameVarID(lVar2, projectile[lVar1].toffset, g_i, g_p);
break; break;
case PROJ_TNUM: case PROJ_TNUM:
if (iSet) if (iSet)
projectile[proj].tnum=lValue; projectile[lVar1].tnum=lValue;
else else
SetGameVarID(lVar2, projectile[proj].tnum, g_i, g_p); SetGameVarID(lVar2, projectile[lVar1].tnum, g_i, g_p);
break; break;
case PROJ_DROP: case PROJ_DROP:
if (iSet) if (iSet)
projectile[proj].drop=lValue; projectile[lVar1].drop=lValue;
else else
SetGameVarID(lVar2, projectile[proj].drop, g_i, g_p); SetGameVarID(lVar2, projectile[lVar1].drop, g_i, g_p);
break; break;
case PROJ_CSTAT: case PROJ_CSTAT:
if (iSet) if (iSet)
projectile[proj].cstat=lValue; projectile[lVar1].cstat=lValue;
else else
SetGameVarID(lVar2, projectile[proj].cstat, g_i, g_p); SetGameVarID(lVar2, projectile[lVar1].cstat, g_i, g_p);
break; break;
case PROJ_CLIPDIST: case PROJ_CLIPDIST:
if (iSet) if (iSet)
projectile[proj].clipdist=lValue; projectile[lVar1].clipdist=lValue;
else else
SetGameVarID(lVar2, projectile[proj].clipdist, g_i, g_p); SetGameVarID(lVar2, projectile[lVar1].clipdist, g_i, g_p);
break; break;
case PROJ_SHADE: case PROJ_SHADE:
if (iSet) if (iSet)
projectile[proj].shade=lValue; projectile[lVar1].shade=lValue;
else else
SetGameVarID(lVar2, projectile[proj].shade, g_i, g_p); SetGameVarID(lVar2, projectile[lVar1].shade, g_i, g_p);
break; break;
case PROJ_XREPEAT: case PROJ_XREPEAT:
if (iSet) if (iSet)
projectile[proj].xrepeat=lValue; projectile[lVar1].xrepeat=lValue;
else else
SetGameVarID(lVar2, projectile[proj].xrepeat, g_i, g_p); SetGameVarID(lVar2, projectile[lVar1].xrepeat, g_i, g_p);
break; break;
case PROJ_YREPEAT: case PROJ_YREPEAT:
if (iSet) if (iSet)
projectile[proj].yrepeat=lValue; projectile[lVar1].yrepeat=lValue;
else else
SetGameVarID(lVar2, projectile[proj].yrepeat, g_i, g_p); SetGameVarID(lVar2, projectile[lVar1].yrepeat, g_i, g_p);
break; break;
case PROJ_PAL: case PROJ_PAL:
if (iSet) if (iSet)
projectile[proj].pal=lValue; projectile[lVar1].pal=lValue;
else else
SetGameVarID(lVar2, projectile[proj].pal, g_i, g_p); SetGameVarID(lVar2, projectile[lVar1].pal, g_i, g_p);
break; break;
case PROJ_EXTRA_RAND: case PROJ_EXTRA_RAND:
if (iSet) if (iSet)
projectile[proj].extra_rand=lValue; projectile[lVar1].extra_rand=lValue;
else else
SetGameVarID(lVar2, projectile[proj].extra_rand, g_i, g_p); SetGameVarID(lVar2, projectile[lVar1].extra_rand, g_i, g_p);
break; break;
case PROJ_HITRADIUS: case PROJ_HITRADIUS:
if (iSet) if (iSet)
projectile[proj].hitradius=lValue; projectile[lVar1].hitradius=lValue;
else else
SetGameVarID(lVar2, projectile[proj].hitradius, g_i, g_p); SetGameVarID(lVar2, projectile[lVar1].hitradius, g_i, g_p);
break; break;
case PROJ_VEL_MULT: case PROJ_VEL_MULT:
if (iSet) if (iSet)
projectile[proj].velmult=lValue; projectile[lVar1].velmult=lValue;
else else
SetGameVarID(lVar2, projectile[proj].velmult, g_i, g_p); SetGameVarID(lVar2, projectile[lVar1].velmult, g_i, g_p);
break; break;
case PROJ_OFFSET: case PROJ_OFFSET:
if (iSet) if (iSet)
projectile[proj].offset=lValue; projectile[lVar1].offset=lValue;
else else
SetGameVarID(lVar2, projectile[proj].offset, g_i, g_p); SetGameVarID(lVar2, projectile[lVar1].offset, g_i, g_p);
break; break;
case PROJ_BOUNCES: case PROJ_BOUNCES:
if (iSet) if (iSet)
projectile[proj].bounces=lValue; projectile[lVar1].bounces=lValue;
else else
SetGameVarID(lVar2, projectile[proj].bounces, g_i, g_p); SetGameVarID(lVar2, projectile[lVar1].bounces, g_i, g_p);
break; break;
case PROJ_BSOUND: case PROJ_BSOUND:
if (iSet) if (iSet)
projectile[proj].bsound=lValue; projectile[lVar1].bsound=lValue;
else else
SetGameVarID(lVar2, projectile[proj].bsound, g_i, g_p); SetGameVarID(lVar2, projectile[lVar1].bsound, g_i, g_p);
break; break;
case PROJ_RANGE: case PROJ_RANGE:
if (iSet) if (iSet)
projectile[proj].range=lValue; projectile[lVar1].range=lValue;
else else
SetGameVarID(lVar2, projectile[proj].range, g_i, g_p); SetGameVarID(lVar2, projectile[lVar1].range, g_i, g_p);
break; break;
default: default:
@ -3005,16 +3014,6 @@ static int parse(void);
void OnEvent(int iEventID, int iActor, int iPlayer, long lDist) 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) if (apScriptGameEvent[iEventID] == 0)
{ {
//Bsprintf(g_szBuf,"No event found for %d",iEventID); //Bsprintf(g_szBuf,"No event found for %d",iEventID);
@ -3022,14 +3021,16 @@ void OnEvent(int iEventID, int iActor, int iPlayer, long lDist)
return; return;
} }
// save current values... if (iEventID >= MAXGAMEEVENTS)
og_i=g_i; {
og_p=g_p; AddLog("Invalid Event ID");
og_x=g_x; return;
og_sp=g_sp; }
og_t=g_t;
okillit_flag=killit_flag; {
oinsptr=insptr; 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_i = iActor; // current sprite ID
g_p = iPlayer; // current player ID g_p = iPlayer; // current player ID
@ -3067,19 +3068,17 @@ void OnEvent(int iEventID, int iActor, int iPlayer, long lDist)
//AddLog("End of Execution"); //AddLog("End of Execution");
} }
}
static long ifsquished(short i, short p) static long ifsquished(int i, int p)
{ {
sectortype *sc; sectortype *sc = &sector[SECT];
char squishme; int squishme;
long floorceildist; long floorceildist = sc->floorz - sc->ceilingz;
if (PN == APLAYER && ud.clipping) if (PN == APLAYER && ud.clipping)
return 0; return 0;
sc = &sector[SECT];
floorceildist = sc->floorz - sc->ceilingz;
if (sc->lotag != 23) if (sc->lotag != 23)
{ {
squishme = floorceildist < (12<<8); // && (sc->lotag&32768) == 0; squishme = floorceildist < (12<<8); // && (sc->lotag&32768) == 0;
@ -3789,12 +3788,10 @@ static int parse(void)
break; break;
case CON_IFDEAD: case CON_IFDEAD:
{
j = g_sp->extra; j = g_sp->extra;
if (g_sp->picnum == APLAYER) if (g_sp->picnum == APLAYER)
j--; j--;
parseifelse(j < 0); parseifelse(j < 0);
}
break; break;
case CON_AI: 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); int volnume=GetGameVarID(*insptr++,g_i,g_p), levnume=GetGameVarID(*insptr++,g_i,g_p);
if (volnume > MAXVOLUMES-1 || volnume < 0) if (volnume > MAXVOLUMES-1 || volnume < 0)
{
OSD_Printf("parse():CON_STARTLEVEL: invalid volume (%d)\n",volnume);
break; break;
}
if (levnume > MAXLEVELS-1 || levnume < 0) if (levnume > MAXLEVELS-1 || levnume < 0)
{
OSD_Printf("parse():CON_STARTLEVEL: invalid level (%d)\n",levnume);
break; break;
}
ud.m_volume_number = ud.volume_number = volnume; ud.m_volume_number = ud.volume_number = volnume;
ud.m_level_number = ud.level_number = levnume; ud.m_level_number = ud.level_number = levnume;

View file

@ -2068,16 +2068,11 @@ void displayweapon(int snum)
{ {
long gun_pos, looking_arc, cw; long gun_pos, looking_arc, cw;
long weapon_xoffset, i, j; long weapon_xoffset, i, j;
int o,pal; int o = 0,pal;
struct player_struct *p; struct player_struct *p = &ps[snum];
short *kb; short *kb = &p->kickback_pic;
int gs; int gs;
p = &ps[snum];
kb = &p->kickback_pic;
o = 0;
looking_arc = klabs(p->look_ang)/9; looking_arc = klabs(p->look_ang)/9;
gs = sprite[p->i].shade; gs = sprite[p->i].shade;
@ -2669,11 +2664,8 @@ void getinput(int snum)
boolean running; boolean running;
int32 turnamount; int32 turnamount;
int32 keymove; int32 keymove;
int32 momx,momy; int32 momx = 0,momy = 0;
struct player_struct *p; struct player_struct *p = &ps[snum];
momx = momy = 0;
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 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; int pi = p->i;
spritetype *s = &sprite[pi]; spritetype *s = &sprite[pi];
p = &ps[snum];
pi = p->i;
s = &sprite[pi];
kb = &p->kickback_pic; kb = &p->kickback_pic;
p->player_par++; p->player_par++;
@ -5180,10 +5168,9 @@ void computergetinput(long snum, input *syn)
long dist, daang, zang, fightdist, damyang, damysect; long dist, daang, zang, fightdist, damyang, damysect;
long startsect, endsect, splc, send, startwall, endwall; long startsect, endsect, splc, send, startwall, endwall;
short dasect, dawall, daspr; short dasect, dawall, daspr;
struct player_struct *p; struct player_struct *p = &ps[snum];
walltype *wal; walltype *wal;
p = &ps[snum];
syn->fvel = 0; syn->fvel = 0;
syn->svel = 0; syn->svel = 0;
syn->avel = 0; syn->avel = 0;

View file

@ -525,12 +525,10 @@ void vscrn(void)
void pickrandomspot(int snum) void pickrandomspot(int snum)
{ {
struct player_struct *p; struct player_struct *p = &ps[snum];
int i=snum,j,k; int i=snum,j,k;
unsigned long dist,pdist = -1; unsigned long dist,pdist = -1;
p = &ps[snum];
if (ud.multimode > 1 && !(gametype_flags[ud.coop] & GAMETYPE_FLAG_FIXEDRESPAWN)) if (ud.multimode > 1 && !(gametype_flags[ud.coop] & GAMETYPE_FLAG_FIXEDRESPAWN))
{ {
i = TRAND%numplayersprites; i = TRAND%numplayersprites;
@ -561,9 +559,7 @@ void pickrandomspot(int snum)
static void resetplayerstats(int snum) static void resetplayerstats(int snum)
{ {
struct player_struct *p; struct player_struct *p = &ps[snum];
p = &ps[snum];
ud.show_help = 0; ud.show_help = 0;
ud.showallmap = 0; ud.showallmap = 0;
@ -672,9 +668,7 @@ static void resetplayerstats(int snum)
void resetweapons(int snum) void resetweapons(int snum)
{ {
int weapon; int weapon;
struct player_struct *p; struct player_struct *p = &ps[snum];
p = &ps[snum];
for (weapon = PISTOL_WEAPON; weapon < MAX_WEAPONS; weapon++) for (weapon = PISTOL_WEAPON; weapon < MAX_WEAPONS; weapon++)
p->gotweapon[weapon] = 0; p->gotweapon[weapon] = 0;
@ -698,9 +692,7 @@ void resetweapons(int snum)
void resetinventory(int snum) void resetinventory(int snum)
{ {
struct player_struct *p; struct player_struct *p = &ps[snum];
p = &ps[snum];
p->inven_icon = 0; p->inven_icon = 0;
p->boot_amount = 0; p->boot_amount = 0;
@ -721,11 +713,9 @@ void resetinventory(int snum)
static void resetprestat(int snum,int g) static void resetprestat(int snum,int g)
{ {
struct player_struct *p; struct player_struct *p = &ps[snum];
int i; int i;
p = &ps[snum];
spriteqloc = 0; spriteqloc = 0;
for (i=0;i<spriteqamount;i++) spriteq[i] = -1; for (i=0;i<spriteqamount;i++) spriteq[i] = -1;

View file

@ -2494,9 +2494,8 @@ void checkhitsprite(short i,short sn)
void allignwarpelevators(void) void allignwarpelevators(void)
{ {
short i, j; int j, i = headspritestat[3];
i = headspritestat[3];
while (i >= 0) while (i >= 0)
{ {
if (SLT == 17 && SS > 16) if (SLT == 17 && SS > 16)
@ -2522,13 +2521,9 @@ void allignwarpelevators(void)
void sharedkeys(int snum) void sharedkeys(int snum)
{ {
int i, k; int i, k, dainv;
char dainv; unsigned long sb_snum = sync[snum].bits, j;
unsigned long sb_snum, j; struct player_struct *p = &ps[snum];
struct player_struct *p;
sb_snum = sync[snum].bits;
p = &ps[snum];
if (p->cheat_phase == 1) return; if (p->cheat_phase == 1) return;
@ -3214,11 +3209,9 @@ static long hitawall(struct player_struct *p,short *hitw)
void checksectors(int snum) void checksectors(int snum)
{ {
long i = -1,oldz; long i = -1,oldz;
struct player_struct *p; struct player_struct *p = &ps[snum];
short j,hitscanwall; short j,hitscanwall;
p = &ps[snum];
switch (sector[p->cursectnum].lotag) switch (sector[p->cursectnum].lotag)
{ {