Prefer passing things between functions as int rather than short or char to avoid the overhead of converting back and forth between formats

git-svn-id: https://svn.eduke32.com/eduke32@432 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
terminx 2006-12-20 03:27:25 +00:00
parent 2705563578
commit bc4139356a
13 changed files with 260 additions and 285 deletions

View file

@ -153,8 +153,7 @@ void addweaponnoswitch(struct player_struct *p, short weapon)
void addweapon(struct player_struct *p,short weapon) void addweapon(struct player_struct *p,short weapon)
{ {
short snum; int snum = sprite[p->i].yvel;
snum = sprite[p->i].yvel;
addweaponnoswitch(p,weapon); addweaponnoswitch(p,weapon);
@ -549,7 +548,7 @@ int movesprite(short spritenum, long xchange, long ychange, long zchange, unsign
return(retval); return(retval);
} }
short ssp(short i,unsigned long cliptype) //The set sprite function int ssp(int i,unsigned long cliptype) //The set sprite function
{ {
spritetype *s; spritetype *s;
long movetype; long movetype;
@ -834,11 +833,9 @@ static void movefta(void)
} }
} }
short ifhitsectors(short sectnum) int ifhitsectors(int sectnum)
{ {
short i; int i = headspritestat[5];
i = headspritestat[5];
while (i >= 0) while (i >= 0)
{ {
if (PN == EXPLOSION2 && sectnum == SECT) if (PN == EXPLOSION2 && sectnum == SECT)
@ -848,9 +845,9 @@ short ifhitsectors(short sectnum)
return -1; return -1;
} }
short ifhitbyweapon(short sn) int ifhitbyweapon(int sn)
{ {
short j,p; int j,p;
spritetype *npc; spritetype *npc;
if (hittype[sn].extra >= 0) if (hittype[sn].extra >= 0)

View file

@ -322,7 +322,8 @@ long tag;
extern struct animwalltype animwall[MAXANIMWALLS]; extern struct animwalltype animwall[MAXANIMWALLS];
extern short numanimwalls,probey,lastprobey; extern short numanimwalls;
extern int probey,lastprobey;
extern char typebuflen,typebuf[141]; extern char typebuflen,typebuf[141];
extern char MusicPtr[72000*2]; extern char MusicPtr[72000*2];
@ -468,7 +469,7 @@ extern char sounds[NUM_SOUNDS][BMAX_PATH];
// JBF 20040531: adding 16 extra to the script so we have some leeway // JBF 20040531: adding 16 extra to the script so we have some leeway
// to (hopefully) safely abort when hitting the limit // to (hopefully) safely abort when hitting the limit
extern long script[MAXSCRIPTSIZE+16],*scriptptr,*insptr,*labelcode,labelcnt,defaultlabelcnt,*labeltype; extern long script[MAXSCRIPTSIZE+16],*scriptptr,*insptr,*labelcode,labelcnt,defaultlabelcnt,*labeltype;
extern char *label,*textptr,error,warning,killit_flag; extern char *label;
extern long *actorscrptr[MAXTILES],*parsing_actor; extern long *actorscrptr[MAXTILES],*parsing_actor;
extern long *actorLoadEventScrptr[MAXTILES]; extern long *actorLoadEventScrptr[MAXTILES];
extern char actortype[MAXTILES]; extern char actortype[MAXTILES];
@ -567,10 +568,10 @@ extern char *level_file_names[MAXVOLUMES*MAXLEVELS];
extern char num_volumes; extern char num_volumes;
extern int32 SoundToggle,MusicToggle; extern int32 SoundToggle,MusicToggle;
extern short last_threehundred,lastsavedpos; extern int last_threehundred,lastsavedpos;
extern char restorepalette; extern char restorepalette;
extern short buttonstat; extern int buttonstat;
extern long cachecount; extern long cachecount;
extern char boardfilename[BMAX_PATH],waterpal[768],slimepal[768],titlepal[768],drealms[768],endingpal[768],animpal[768]; extern char boardfilename[BMAX_PATH],waterpal[768],slimepal[768],titlepal[768],drealms[768],endingpal[768],animpal[768];
extern char cachedebug,earthquaketime; extern char cachedebug,earthquaketime;

View file

@ -46,16 +46,16 @@ extern void stopenvsound(short num,short i);
extern void pan3dsound(void); extern void pan3dsound(void);
extern void testcallback(unsigned long num); extern void testcallback(unsigned long num);
extern void clearsoundlocks(void); extern void clearsoundlocks(void);
extern short callsound(short sn,short whatsprite); extern int callsound(int sn,int whatsprite);
extern short check_activator_motion(short lotag); extern int check_activator_motion(int lotag);
extern char isadoorwall(short dapic); extern int isadoorwall(int dapic);
extern char isanunderoperator(short lotag); extern int isanunderoperator(int lotag);
extern char isanearoperator(short lotag); extern int isanearoperator(int lotag);
extern short checkcursectnums(short sect); extern int checkcursectnums(int sect);
extern long ldist(spritetype *s1,spritetype *s2); extern long ldist(spritetype *s1,spritetype *s2);
extern long dist(spritetype *s1,spritetype *s2); extern long dist(spritetype *s1,spritetype *s2);
extern short findplayer(spritetype *s,long *d); extern int findplayer(spritetype *s,long *d);
extern short findotherplayer(short p,long *d); extern int findotherplayer(int p,long *d);
extern void doanimations(void); extern void doanimations(void);
extern int getanimationgoal(long *animptr); extern int getanimationgoal(long *animptr);
extern int setanimation(short animsect,long *animptr,long thegoal,long thevel); extern int setanimation(short animsect,long *animptr,long thegoal,long thevel);
@ -63,19 +63,19 @@ extern void animatecamsprite(void);
extern void animatewalls(void); extern void animatewalls(void);
extern char activatewarpelevators(short s,short d); extern char activatewarpelevators(short s,short d);
extern void operatesectors(short sn,short ii); extern void operatesectors(short sn,short ii);
extern void operaterespawns(short low); extern void operaterespawns(int low);
extern void operateactivators(short low,short snum); extern void operateactivators(int low,int snum);
extern void operatemasterswitches(short low); extern void operatemasterswitches(int low);
extern void operateforcefields(short s,short low); extern void operateforcefields(short s,int low);
extern char checkhitswitch(short snum,long w,char switchtype); extern char checkhitswitch(int snum,long w,int switchtype);
extern void activatebysector(short sect,short j); extern void activatebysector(short sect,short j);
extern void checkhitwall(short spr,short dawallnum,long x,long y,long z,short atwith); extern void checkhitwall(short spr,short dawallnum,long x,long y,long z,short atwith);
extern void checkplayerhurt(struct player_struct *p,short j); extern void checkplayerhurt(struct player_struct *p,short j);
extern char checkhitceiling(short sn); extern char checkhitceiling(short sn);
extern void checkhitsprite(short i,short sn); extern void checkhitsprite(short i,short sn);
extern void allignwarpelevators(void); extern void allignwarpelevators(void);
extern void sharedkeys(short snum); extern void sharedkeys(int snum);
extern void checksectors(short snum); extern void checksectors(int snum);
extern int32 RTS_AddFile(char *filename); extern int32 RTS_AddFile(char *filename);
extern void RTS_Init(char *filename); extern void RTS_Init(char *filename);
extern int32 RTS_NumSounds(void); extern int32 RTS_NumSounds(void);
@ -86,9 +86,9 @@ extern void *RTS_GetSound(int32 lump);
extern void docacheit(void); extern void docacheit(void);
extern void xyzmirror(short i,short wn); extern void xyzmirror(short i,short wn);
extern void vscrn(void); extern void vscrn(void);
extern void pickrandomspot(short snum); extern void pickrandomspot(int snum);
extern void resetweapons(short snum); extern void resetweapons(int snum);
extern void resetinventory(short snum); extern void resetinventory(int snum);
extern void newgame(char vn,char ln,char sk); extern void newgame(char vn,char ln,char sk);
extern void resettimevars(void); extern void resettimevars(void);
extern void waitforeverybody(void); extern void waitforeverybody(void);
@ -101,13 +101,13 @@ extern void setpal(struct player_struct *p);
extern void quickkill(struct player_struct *p); extern void quickkill(struct player_struct *p);
extern long hits(short i); extern long hits(short i);
extern long hitasprite(short i,short *hitsp); extern long hitasprite(short i,short *hitsp);
extern short shoot(short i,short atwith); extern int shoot(int i,int atwith);
extern void displaymasks(short snum); extern void displaymasks(int snum);
extern void displayweapon(short snum); extern void displayweapon(int snum);
extern void getinput(short snum); extern void getinput(int snum);
extern void checkweapons(struct player_struct *p); extern void checkweapons(struct player_struct *p);
extern void processinput(short snum); extern void processinput(int snum);
extern void cmenu(short cm); extern void cmenu(int cm);
extern void savetemp(char *fn,long daptr,long dasiz); extern void savetemp(char *fn,long daptr,long dasiz);
// extern int loadpheader(char spot,int32 *vn,int32 *ln,int32 *psk,int32 *numplr); // extern int loadpheader(char spot,int32 *vn,int32 *ln,int32 *psk,int32 *numplr);
extern int loadplayer(signed char spot); extern int loadplayer(signed char spot);
@ -117,11 +117,11 @@ extern int getfilenames(char *path, char kind[]);
extern void menus(void); extern void menus(void);
extern void palto(char r,char g,char b,long e); extern void palto(char r,char g,char b,long e);
extern void playanm(char *fn,char); extern void playanm(char *fn,char);
extern short getincangle(short a,short na); extern int getincangle(int a,int na);
extern void getglobalz(short sActor); extern void getglobalz(int iActor);
extern void makeitfall(short sActor); extern void makeitfall(int iActor);
extern void loadefs(char *fn); extern void loadefs(char *fn);
extern short furthestangle(short sActor,short angs); extern int furthestangle(int iActor,int angs);
extern void execute(int iActor,int iPlayer,long lDist); extern void execute(int iActor,int iPlayer,long lDist);
extern void overwritesprite(long thex,long they,short tilenum,signed char shade,char stat,char dapalnum); extern void overwritesprite(long thex,long they,short tilenum,signed char shade,char stat,char dapalnum);
extern inline int gametext(int x,int y,char *t,char s,short dabits); extern inline int gametext(int x,int y,char *t,char s,short dabits);
@ -143,10 +143,10 @@ extern inline int strget(short x,short y,char *t,short dalen,short c);
extern void displayrest(long smoothratio); extern void displayrest(long smoothratio);
extern void updatesectorz(long x,long y,long z,short *sectnum); extern void updatesectorz(long x,long y,long z,short *sectnum);
extern void drawbackground(void); extern void drawbackground(void);
extern void displayrooms(short snum,long smoothratio); extern void displayrooms(int snum,long smoothratio);
extern short EGS(short whatsect,long s_x,long s_y,long s_z,short s_pn,signed char s_s,signed char s_xr,signed char s_yr,short s_a,short s_ve,long s_zv,short s_ow,signed char s_ss); extern int EGS(int whatsect,long s_x,long s_y,long s_z,int s_pn,int s_s,int s_xr,int s_yr,int s_a,int s_ve,long s_zv,int s_ow,int s_ss);
extern char wallswitchcheck(short i); extern char wallswitchcheck(short i);
extern short spawn(short j,short pn); extern int spawn(int j,int pn);
extern void animatesprites(long x,long y,short a,long smoothratio); extern void animatesprites(long x,long y,short a,long smoothratio);
extern int main(int argc,char **argv); extern int main(int argc,char **argv);
extern void opendemowrite(void); extern void opendemowrite(void);
@ -181,7 +181,7 @@ extern void checkavailinven(struct player_struct *p);
extern void checkavailweapon(struct player_struct *p); extern void checkavailweapon(struct player_struct *p);
extern void hitradius(short i,long r,long hp1,long hp2,long hp3,long hp4); extern void hitradius(short i,long r,long hp1,long hp2,long hp3,long hp4);
extern int movesprite(short spritenum,long xchange,long ychange,long zchange,unsigned long cliptype); extern int movesprite(short spritenum,long xchange,long ychange,long zchange,unsigned long cliptype);
extern short ssp(short i,unsigned long cliptype); extern int ssp(int i,unsigned long cliptype);
extern void insertspriteq(short i); extern void insertspriteq(short i);
extern void lotsofmoney(spritetype *s,short n); extern void lotsofmoney(spritetype *s,short n);
extern void lotsofmail(spritetype *s, short n); extern void lotsofmail(spritetype *s, short n);
@ -189,8 +189,8 @@ extern void lotsofpaper(spritetype *s, short n);
extern void guts(spritetype *s,short gtype,short n,short p); extern void guts(spritetype *s,short gtype,short n,short p);
extern void setsectinterpolate(short i); extern void setsectinterpolate(short i);
extern void clearsectinterpolate(short i); extern void clearsectinterpolate(short i);
extern short ifhitsectors(short sectnum); extern int ifhitsectors(int sectnum);
extern short ifhitbyweapon(short sn); extern int ifhitbyweapon(int sn);
extern void moveobjects(void); extern void moveobjects(void);
extern void movecyclers(void); extern void movecyclers(void);
extern void movedummyplayers(void); extern void movedummyplayers(void);
@ -207,14 +207,14 @@ extern void txdigitalnumber(short starttile, long x,long y,long n,char s,char pa
extern void myosx(long x,long y,short tilenum,signed char shade,char orientation); 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 myospalx(long x,long y,short tilenum,signed char shade,char orientation,char p);
extern void ResetGameVars(void); extern void ResetGameVars(void);
extern void ResetActorGameVars(short sActor); extern void ResetActorGameVars(int iActor);
extern void setupdynamictostatic(); extern void setupdynamictostatic();
extern void processnames(char *szLabel, long lValue); extern void processnames(char *szLabel, long lValue);
extern void LoadActor(long sActor); extern void LoadActor(long sActor);
extern long GetGameVar(char *szGameLabel, long lDefault, short sActor, short sPlayer); extern long GetGameVar(char *szGameLabel, long lDefault, int iActor, int iPlayer);
extern void DumpGameVars(FILE *fp); extern void DumpGameVars(FILE *fp);
extern void AddLog(char *psz); extern void AddLog(char *psz);
@ -224,14 +224,14 @@ extern void InitGameVars(void);
extern void SaveGameVars(FILE *fil); extern void SaveGameVars(FILE *fil);
extern int ReadGameVars(long fil); extern int ReadGameVars(long fil);
extern long GetGameVarID(int id, short sActor, short sPlayer); extern long GetGameVarID(int id, int iActor, int iPlayer);
extern void SetGameVarID(int id, long lValue, short sActor, short sPlayer); extern void SetGameVarID(int id, long lValue, int iActor, int iPlayer);
extern char AddGameVar(char *pszLabel, long lValue, unsigned long dwFlags); extern char AddGameVar(char *pszLabel, long lValue, unsigned long dwFlags);
extern void ReportError(int iError); extern void ReportError(int iError);
extern void onvideomodechange(int newmode); extern void onvideomodechange(int newmode);
extern void OnEvent(int iEventID, short sActor,short sPlayer,long lDist); extern void OnEvent(int iEventID, int sActor, int sPlayer, long lDist);
extern int isspritemakingsound(short i, int num); extern int isspritemakingsound(short i, int num);
extern int issoundplaying(short i, int num); extern int issoundplaying(short i, int num);

View file

@ -1882,11 +1882,11 @@ void displayfragbar(void)
#define SBY (200-tilesizy[BOTTOMSTATUSBAR]) #define SBY (200-tilesizy[BOTTOMSTATUSBAR])
static void coolgaugetext(short snum) static void coolgaugetext(int snum)
{ {
struct player_struct *p; struct player_struct *p;
long i, j, o, ss, u; long i, j, o, ss, u;
char permbit; int permbit;
p = &ps[snum]; p = &ps[snum];
@ -2348,9 +2348,9 @@ static void tics(void)
framecnt = ((framecnt+1)&(AVERAGEFRAMES-1)); framecnt = ((framecnt+1)&(AVERAGEFRAMES-1));
} }
static void coords(short snum) static void coords(int snum)
{ {
short y = 8; int y = 8;
if ((gametype_flags[ud.coop] & GAMETYPE_FLAG_FRAGBAR)) if ((gametype_flags[ud.coop] & GAMETYPE_FLAG_FRAGBAR))
{ {
@ -3838,12 +3838,12 @@ static void se40code(long x,long y,long z,long a,long h, long smoothratio)
static long oyrepeat=-1; static long oyrepeat=-1;
void displayrooms(short snum,long smoothratio) 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;
short sect, cang, k, choriz; short sect, cang, k, choriz;
struct player_struct *p; struct player_struct *p;
long tposx,tposy,i;
short tang; short tang;
long tiltcx,tiltcy,tiltcs=0; // JBF 20030807 long tiltcx,tiltcy,tiltcs=0; // JBF 20030807
#ifdef POLYMOST #ifdef POLYMOST
@ -4164,9 +4164,9 @@ static void dumpdebugdata(void)
saveboard("debug.map",&ps[myconnectindex].posx,&ps[myconnectindex].posy,&ps[myconnectindex].posz,&ps[myconnectindex].ang,&ps[myconnectindex].cursectnum); saveboard("debug.map",&ps[myconnectindex].posx,&ps[myconnectindex].posy,&ps[myconnectindex].posz,&ps[myconnectindex].ang,&ps[myconnectindex].cursectnum);
} }
short EGS(short whatsect,long s_x,long s_y,long s_z,short s_pn,signed char s_s,signed char s_xr,signed char s_yr,short s_a,short s_ve,long s_zv,short s_ow,signed char 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)
{ {
short i; int i;
long p; long p;
spritetype *s; spritetype *s;
@ -4316,9 +4316,9 @@ char wallswitchcheck(short i)
return 0; return 0;
} }
short spawn(short j, short pn) int spawn(int j, int pn)
{ {
short i, s, startwall, endwall, sect, clostest=0; int i, s, startwall, endwall, sect, clostest=0;
long x, y, d, p; long x, y, d, p;
spritetype *sp; spritetype *sp;
@ -5036,7 +5036,7 @@ short spawn(short j, short pn)
case SHOTGUNSHELL__STATIC: case SHOTGUNSHELL__STATIC:
if (j >= 0) if (j >= 0)
{ {
short snum,a; int snum,a;
if (sprite[j].picnum == APLAYER) if (sprite[j].picnum == APLAYER)
{ {

View file

@ -30,16 +30,16 @@ int conversion = 13;
char compilefile[BMAX_PATH] = "(none)"; // file we're currently compiling char compilefile[BMAX_PATH] = "(none)"; // file we're currently compiling
static char parsing_item_name[MAXVARLABEL] = "(none)", previous_item_name[MAXVARLABEL] = "NULL"; static char parsing_item_name[MAXVARLABEL] = "(none)", previous_item_name[MAXVARLABEL] = "NULL";
short total_lines,line_number; int total_lines,line_number;
static short checking_ifelse,parsing_state; static int checking_ifelse,parsing_state;
char g_szBuf[1024]; char g_szBuf[1024];
long *casescriptptr=NULL; // the pointer to the start of the case table in a switch statement long *casescriptptr=NULL; // the pointer to the start of the case table in a switch statement
// first entry is 'default' code. // first entry is 'default' code.
int casecount = 0; static int casecount = 0;
signed short checking_switch = 0, current_event = -1; static int checking_switch = 0, current_event = -1;
char labelsonly = 0, nokeywordcheck = 0, dynamicremap = 0; static int labelsonly = 0, nokeywordcheck = 0, dynamicremap = 0;
static short num_braces = 0; // init to some sensible defaults static int num_braces = 0; // init to some sensible defaults
int redefined_quote_count = 0; int redefined_quote_count = 0;
@ -84,6 +84,9 @@ MATTGAMEVAR aDefaultGameVars[MAXGAMEVARS]; // the 'original' values
extern long qsetmode; extern long qsetmode;
char *textptr;
int error,warning;
enum labeltypes enum labeltypes
{ {
LABEL_ANY = -1, LABEL_ANY = -1,

View file

@ -53,8 +53,8 @@ extern long lastvisinc;
extern void adduserquote(char *daquote); extern void adduserquote(char *daquote);
extern char cheatquotes[][MAXCHEATLEN]; extern char cheatquotes[][MAXCHEATLEN];
extern char compilefile[BMAX_PATH]; extern char compilefile[BMAX_PATH];
extern short total_lines,line_number; extern int total_lines,line_number;
extern int error,warning;
typedef struct _labels { typedef struct _labels {
char *name; char *name;
long lId; long lId;

View file

@ -28,9 +28,10 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "osd.h" #include "osd.h"
static short g_i,g_p; static int g_i,g_p;
static long g_x,*g_t; static long g_x,*g_t;
static spritetype *g_sp; static spritetype *g_sp;
int killit_flag;
extern int32 scripthandle; extern int32 scripthandle;
@ -3002,16 +3003,11 @@ static void DoProjectile(int iSet, int lVar1, int lLabelID, int lVar2)
static int parse(void); static int parse(void);
void OnEvent(int iEventID, short sActor,short sPlayer,long lDist) void OnEvent(int iEventID, int iActor, int iPlayer, long lDist)
{ {
short og_i,og_p; int og_i, og_p, okillit_flag;
long og_x; long og_x, *og_t, *oinsptr;
long *og_t;
spritetype *og_sp; spritetype *og_sp;
char okillit_flag;
long *oinsptr;
int done;
if (iEventID >= MAXGAMEEVENTS) if (iEventID >= MAXGAMEEVENTS)
{ {
@ -3035,8 +3031,8 @@ void OnEvent(int iEventID, short sActor,short sPlayer,long lDist)
okillit_flag=killit_flag; okillit_flag=killit_flag;
oinsptr=insptr; oinsptr=insptr;
g_i = sActor; // current sprite ID g_i = iActor; // current sprite ID
g_p = sPlayer; // current player ID g_p = iPlayer; // current player ID
g_x = lDist; // ? g_x = lDist; // ?
g_sp = &sprite[g_i]; g_sp = &sprite[g_i];
g_t = &hittype[g_i].temp_data[0]; g_t = &hittype[g_i].temp_data[0];
@ -3046,9 +3042,8 @@ void OnEvent(int iEventID, short sActor,short sPlayer,long lDist)
//AddLog(g_szBuf); //AddLog(g_szBuf);
killit_flag = 0; killit_flag = 0;
do
done = parse(); while (1) if (parse()) break;
while (done == 0);
if (killit_flag == 1) if (killit_flag == 1)
{ {
@ -3114,9 +3109,7 @@ static long ifsquished(short i, short p)
static void forceplayerangle(struct player_struct *p) static void forceplayerangle(struct player_struct *p)
{ {
short n; int n = 128-(TRAND&255);
n = 128-(TRAND&255);
p->horiz += 64; p->horiz += 64;
p->return_to_center = 9; p->return_to_center = 9;
@ -3126,13 +3119,10 @@ static void forceplayerangle(struct player_struct *p)
static char dodge(spritetype *s) static char dodge(spritetype *s)
{ {
short i; long bx,by,bxvect,byvect,d,i;
long bx,by,mx,my,bxvect,byvect,mxvect,myvect,d; long mx = s->x, my = s->y;
long mxvect = sintable[(s->ang+512)&2047];
mx = s->x; long myvect = sintable[s->ang&2047];
my = s->y;
mxvect = sintable[(s->ang+512)&2047];
myvect = sintable[s->ang&2047];
for (i=headspritestat[4];i>=0;i=nextspritestat[i]) //weapons list for (i=headspritestat[4];i>=0;i=nextspritestat[i]) //weapons list
{ {
@ -3158,14 +3148,13 @@ static char dodge(spritetype *s)
return 0; return 0;
} }
short furthestangle(short sActor,short angs) int furthestangle(int iActor,int angs)
{ {
short j, hitsect,hitwall,hitspr,furthest_angle=0, angincs; short hitsect,hitwall,hitspr,furthest_angle=0;
long hx, hy, hz, d, greatestd; long hx, hy, hz, d;
spritetype *s = &sprite[sActor]; spritetype *s = &sprite[iActor];
long greatestd = -(1<<30);
greatestd = -(1<<30); int angincs = 2048/angs,j;
angincs = 2048/angs;
if (s->picnum != APLAYER) if (s->picnum != APLAYER)
if ((g_t[0]&63) > 2) return(s->ang + 1024); if ((g_t[0]&63) > 2) return(s->ang + 1024);
@ -3188,11 +3177,12 @@ short furthestangle(short sActor,short angs)
return (furthest_angle&2047); return (furthest_angle&2047);
} }
short furthestcanseepoint(short sActor,spritetype *ts,long *dax,long *day) int furthestcanseepoint(int iActor,spritetype *ts,long *dax,long *day)
{ {
short j, hitsect,hitwall,hitspr, angincs; short hitsect,hitwall,hitspr, angincs;
long hx, hy, hz, d, da;//, d, cd, ca,tempx,tempy,cx,cy; long hx, hy, hz, d, da;//, d, cd, ca,tempx,tempy,cx,cy;
spritetype *s = &sprite[sActor]; int j;
spritetype *s = &sprite[iActor];
if ((g_t[0]&63)) return -1; if ((g_t[0]&63)) return -1;
@ -3221,11 +3211,11 @@ short furthestcanseepoint(short sActor,spritetype *ts,long *dax,long *day)
return -1; return -1;
} }
void getglobalz(short sActor) void getglobalz(int iActor)
{ {
long hz,lz,zr; long hz,lz,zr;
spritetype *s = &sprite[sActor]; spritetype *s = &sprite[iActor];
if (s->statnum == 10 || s->statnum == 6 || s->statnum == 2 || s->statnum == 1 || s->statnum == 4) if (s->statnum == 10 || s->statnum == 6 || s->statnum == 2 || s->statnum == 1 || s->statnum == 4)
{ {
@ -3234,7 +3224,7 @@ void getglobalz(short sActor)
if (s->statnum == 4) if (s->statnum == 4)
zr = 4L; zr = 4L;
getzrange(s->x,s->y,s->z-(FOURSLEIGHT),s->sectnum,&hittype[sActor].ceilingz,&hz,&hittype[sActor].floorz,&lz,zr,CLIPMASK0); getzrange(s->x,s->y,s->z-(FOURSLEIGHT),s->sectnum,&hittype[iActor].ceilingz,&hz,&hittype[iActor].floorz,&lz,zr,CLIPMASK0);
if ((lz&49152) == 49152 && (sprite[lz&(MAXSPRITES-1)].cstat&48) == 0) if ((lz&49152) == 49152 && (sprite[lz&(MAXSPRITES-1)].cstat&48) == 0)
{ {
@ -3243,35 +3233,35 @@ void getglobalz(short sActor)
{ {
if (s->statnum != 4) if (s->statnum != 4)
{ {
hittype[sActor].dispicnum = -4; // No shadows on actors hittype[iActor].dispicnum = -4; // No shadows on actors
s->xvel = -256; s->xvel = -256;
ssp(sActor,CLIPMASK0); ssp(iActor,CLIPMASK0);
} }
} }
else if (sprite[lz].picnum == APLAYER && badguy(s)) else if (sprite[lz].picnum == APLAYER && badguy(s))
{ {
hittype[sActor].dispicnum = -4; // No shadows on actors hittype[iActor].dispicnum = -4; // No shadows on actors
s->xvel = -256; s->xvel = -256;
ssp(sActor,CLIPMASK0); ssp(iActor,CLIPMASK0);
} }
else if (s->statnum == 4 && sprite[lz].picnum == APLAYER) else if (s->statnum == 4 && sprite[lz].picnum == APLAYER)
if (s->owner == lz) if (s->owner == lz)
{ {
hittype[sActor].ceilingz = sector[s->sectnum].ceilingz; hittype[iActor].ceilingz = sector[s->sectnum].ceilingz;
hittype[sActor].floorz = sector[s->sectnum].floorz; hittype[iActor].floorz = sector[s->sectnum].floorz;
} }
} }
} }
else else
{ {
hittype[sActor].ceilingz = sector[s->sectnum].ceilingz; hittype[iActor].ceilingz = sector[s->sectnum].ceilingz;
hittype[sActor].floorz = sector[s->sectnum].floorz; hittype[iActor].floorz = sector[s->sectnum].floorz;
} }
} }
void makeitfall(short sActor) void makeitfall(int iActor)
{ {
spritetype *s = &sprite[sActor]; spritetype *s = &sprite[iActor];
long hz,lz,c; long hz,lz,c;
if (floorspace(s->sectnum)) if (floorspace(s->sectnum))
@ -3284,14 +3274,14 @@ void makeitfall(short sActor)
} }
if ((s->statnum == 1 || s->statnum == 10 || s->statnum == 2 || s->statnum == 6)) if ((s->statnum == 1 || s->statnum == 10 || s->statnum == 2 || s->statnum == 6))
getzrange(s->x,s->y,s->z-(FOURSLEIGHT),s->sectnum,&hittype[sActor].ceilingz,&hz,&hittype[sActor].floorz,&lz,127L,CLIPMASK0); getzrange(s->x,s->y,s->z-(FOURSLEIGHT),s->sectnum,&hittype[iActor].ceilingz,&hz,&hittype[iActor].floorz,&lz,127L,CLIPMASK0);
else else
{ {
hittype[sActor].ceilingz = sector[s->sectnum].ceilingz; hittype[iActor].ceilingz = sector[s->sectnum].ceilingz;
hittype[sActor].floorz = sector[s->sectnum].floorz; hittype[iActor].floorz = sector[s->sectnum].floorz;
} }
if (s->z < hittype[sActor].floorz-(FOURSLEIGHT)) if (s->z < hittype[iActor].floorz-(FOURSLEIGHT))
{ {
if (sector[s->sectnum].lotag == 2 && s->zvel > 3122) if (sector[s->sectnum].lotag == 2 && s->zvel > 3122)
s->zvel = 3144; s->zvel = 3144;
@ -3300,14 +3290,14 @@ void makeitfall(short sActor)
else s->zvel = 6144; else s->zvel = 6144;
s->z += s->zvel; s->z += s->zvel;
} }
if (s->z >= hittype[sActor].floorz-(FOURSLEIGHT)) if (s->z >= hittype[iActor].floorz-(FOURSLEIGHT))
{ {
s->z = hittype[sActor].floorz - FOURSLEIGHT; s->z = hittype[iActor].floorz - FOURSLEIGHT;
s->zvel = 0; s->zvel = 0;
} }
} }
short getincangle(short a,short na) int getincangle(int a,int na)
{ {
a &= 2047; a &= 2047;
na &= 2047; na &= 2047;
@ -3323,10 +3313,11 @@ short getincangle(short a,short na)
return (na-a); return (na-a);
} }
static void alterang(short a) static void alterang(int a)
{ {
short aang, angdif, goalang,j; short aang, angdif, goalang;
long ticselapsed, *moveptr; long ticselapsed, *moveptr;
int j;
moveptr = (long *)g_t[1]; moveptr = (long *)g_t[1];
@ -6405,12 +6396,10 @@ static int parse(void)
return 0; return 0;
} }
void LoadActor(long sActor) void LoadActor(long iActor)
{ {
char done; g_i = iActor; // Sprite ID
g_p = -1; // iPlayer; // Player ID
g_i = sActor; // Sprite ID
g_p = -1; // sPlayer; // Player ID
g_x = -1; // lDist; // ?? g_x = -1; // lDist; // ??
g_sp = &sprite[g_i]; // Pointer to sprite structure g_sp = &sprite[g_i]; // Pointer to sprite structure
g_t = &hittype[g_i].temp_data[0]; // Sprite's 'extra' data g_t = &hittype[g_i].temp_data[0]; // Sprite's 'extra' data
@ -6428,9 +6417,8 @@ void LoadActor(long sActor)
deletesprite(g_i); deletesprite(g_i);
return; return;
} }
do
done = parse(); while (1) if (parse()) break;
while (done == 0);
if (killit_flag == 1) if (killit_flag == 1)
{ {
@ -6446,8 +6434,6 @@ void LoadActor(long sActor)
void execute(int iActor,int iPlayer,long lDist) void execute(int iActor,int iPlayer,long lDist)
{ {
char done;
g_i = iActor; // Sprite ID g_i = iActor; // Sprite ID
g_p = iPlayer; // Player ID g_p = iPlayer; // Player ID
g_x = lDist; // ?? g_x = lDist; // ??
@ -6483,9 +6469,7 @@ void execute(int iActor,int iPlayer,long lDist)
g_t[3] = 0; g_t[3] = 0;
} }
do while (1) if (parse()) break;
done = parse();
while (done == 0);
if (killit_flag == 1) if (killit_flag == 1)
{ {

View file

@ -382,15 +382,15 @@ char AddGameVar(char *pszLabel, long lValue, unsigned long dwFlags)
} }
} }
void ResetActorGameVars(short sActor) void ResetActorGameVars(int iActor)
{ {
int i; int i;
// OSD_Printf("resetting vars for actor %d\n",sActor); // OSD_Printf("resetting vars for actor %d\n",iActor);
for (i=0;i<MAXGAMEVARS;i++) for (i=0;i<MAXGAMEVARS;i++)
if ((aGameVars[i].dwFlags & GAMEVAR_FLAG_PERACTOR) && !(aGameVars[i].dwFlags & GAMEVAR_FLAG_NODEFAULT)) if ((aGameVars[i].dwFlags & GAMEVAR_FLAG_PERACTOR) && !(aGameVars[i].dwFlags & GAMEVAR_FLAG_NODEFAULT))
{ {
// OSD_Printf("reset %s (%d) to %s (%d)\n",aGameVars[i].szLabel,aGameVars[i].plValues[sActor],aDefaultGameVars[i].szLabel,aDefaultGameVars[i].lValue); // OSD_Printf("reset %s (%d) to %s (%d)\n",aGameVars[i].szLabel,aGameVars[i].plValues[iActor],aDefaultGameVars[i].szLabel,aDefaultGameVars[i].lValue);
aGameVars[i].plValues[sActor]=aDefaultGameVars[i].lValue; aGameVars[i].plValues[iActor]=aDefaultGameVars[i].lValue;
} }
} }
@ -411,12 +411,12 @@ static int GetGameID(char *szGameLabel)
return -1; return -1;
} }
long GetGameVarID(int id, short sActor, short sPlayer) long GetGameVarID(int id, int iActor, int iPlayer)
{ {
int inv=0; int inv=0;
if (id == g_iThisActorID) if (id == g_iThisActorID)
return sActor; return iActor;
if (id<0 || id >= iGameVarCount) if (id<0 || id >= iGameVarCount)
{ {
@ -436,12 +436,12 @@ long GetGameVarID(int id, short sActor, short sPlayer)
if (aGameVars[id].dwFlags & GAMEVAR_FLAG_PERPLAYER) if (aGameVars[id].dwFlags & GAMEVAR_FLAG_PERPLAYER)
{ {
// for the current player // for the current player
if (sPlayer >=0 && sPlayer < MAXPLAYERS) if (iPlayer >=0 && iPlayer < MAXPLAYERS)
{ {
//Bsprintf(g_szBuf,"GetGameVarID(%d, %d, %d) returns %ld\n",id,sActor,sPlayer, aGameVars[id].plValues[sPlayer]); //Bsprintf(g_szBuf,"GetGameVarID(%d, %d, %d) returns %ld\n",id,iActor,iPlayer, aGameVars[id].plValues[iPlayer]);
//AddLog(g_szBuf); //AddLog(g_szBuf);
if (inv) return (-aGameVars[id].plValues[sPlayer]); if (inv) return (-aGameVars[id].plValues[iPlayer]);
return (aGameVars[id].plValues[sPlayer]); return (aGameVars[id].plValues[iPlayer]);
} }
if (inv) return (-aGameVars[id].lValue); if (inv) return (-aGameVars[id].lValue);
@ -451,10 +451,10 @@ long GetGameVarID(int id, short sActor, short sPlayer)
if (aGameVars[id].dwFlags & GAMEVAR_FLAG_PERACTOR) if (aGameVars[id].dwFlags & GAMEVAR_FLAG_PERACTOR)
{ {
// for the current actor // for the current actor
if (sActor >= 0 && sActor <=MAXSPRITES) if (iActor >= 0 && iActor <=MAXSPRITES)
{ {
if (inv) return (-aGameVars[id].plValues[sActor]); if (inv) return (-aGameVars[id].plValues[iActor]);
return (aGameVars[id].plValues[sActor]); return (aGameVars[id].plValues[iActor]);
} }
if (inv) return (-aGameVars[id].lValue); if (inv) return (-aGameVars[id].lValue);
@ -471,26 +471,26 @@ long GetGameVarID(int id, short sActor, short sPlayer)
return (aGameVars[id].lValue); return (aGameVars[id].lValue);
} }
void SetGameVarID(int id, long lValue, short sActor, short sPlayer) void SetGameVarID(int id, long lValue, int iActor, int iPlayer)
{ {
if (id<0 || id >= iGameVarCount) if (id<0 || id >= iGameVarCount)
{ {
AddLog("Invalid Game ID"); AddLog("Invalid Game ID");
return; return;
} }
//Bsprintf(g_szBuf,"SGVI: %d ('%s') to %ld for %d %d",id,aGameVars[id].szLabel,lValue,sActor,sPlayer); //Bsprintf(g_szBuf,"SGVI: %d ('%s') to %ld for %d %d",id,aGameVars[id].szLabel,lValue,iActor,iPlayer);
//AddLog(g_szBuf); //AddLog(g_szBuf);
if ((aGameVars[id].dwFlags & GAMEVAR_FLAG_PERPLAYER) && (sPlayer != -1)) if ((aGameVars[id].dwFlags & GAMEVAR_FLAG_PERPLAYER) && (iPlayer != -1))
{ {
// for the current player // for the current player
aGameVars[id].plValues[sPlayer]=lValue; aGameVars[id].plValues[iPlayer]=lValue;
return; return;
} }
if ((aGameVars[id].dwFlags & GAMEVAR_FLAG_PERACTOR) && (sActor != -1)) if ((aGameVars[id].dwFlags & GAMEVAR_FLAG_PERACTOR) && (iActor != -1))
{ {
// for the current actor // for the current actor
aGameVars[id].plValues[sActor]=lValue; aGameVars[id].plValues[iActor]=lValue;
return; return;
} }
@ -504,7 +504,7 @@ void SetGameVarID(int id, long lValue, short sActor, short sPlayer)
aGameVars[id].lValue=lValue; aGameVars[id].lValue=lValue;
} }
long GetGameVar(char *szGameLabel, long lDefault, short sActor, short sPlayer) long GetGameVar(char *szGameLabel, long lDefault, int iActor, int iPlayer)
{ {
int i=0; int i=0;
for (;i<iGameVarCount;i++) for (;i<iGameVarCount;i++)
@ -513,7 +513,7 @@ long GetGameVar(char *szGameLabel, long lDefault, short sActor, short sPlayer)
{ {
if (Bstrcmp(szGameLabel, aGameVars[i].szLabel) == 0) if (Bstrcmp(szGameLabel, aGameVars[i].szLabel) == 0)
{ {
return GetGameVarID(i, sActor, sPlayer); return GetGameVarID(i, iActor, iPlayer);
} }
} }
} }

View file

@ -113,7 +113,7 @@ long vel, svel, angvel, horiz, ototalclock, respawnactortime=768, respawnitemtim
long *scriptptr,*insptr,*labelcode,labelcnt,defaultlabelcnt,*labeltype; long *scriptptr,*insptr,*labelcode,labelcnt,defaultlabelcnt,*labeltype;
long *actorscrptr[MAXTILES],*parsing_actor; long *actorscrptr[MAXTILES],*parsing_actor;
char *label,*textptr,error,warning,killit_flag; char *label;
char *music_pointer; char *music_pointer;
char actortype[MAXTILES]; char actortype[MAXTILES];
long script[MAXSCRIPTSIZE+16]; long script[MAXSCRIPTSIZE+16];

View file

@ -28,10 +28,9 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
extern char inputloc; extern char inputloc;
extern int recfilep; extern int recfilep;
//extern char vgacompatible; //extern char vgacompatible;
short probey=0,lastprobey=0,globalskillsound=-1,last_probey=0; short globalskillsound=-1;
int last_menu; int probey=0,lastprobey=0,last_probey=0,last_menu,sh,onbar,buttonstat,deletespot;
short sh,onbar,buttonstat,deletespot; int last_zero,last_fifty,last_onehundred,last_twoohtwo,last_threehundred = 0;
short last_zero,last_fifty,last_onehundred,last_twoohtwo,last_threehundred = 0;
static char menunamecnt; static char menunamecnt;
@ -48,7 +47,7 @@ static char *mousebuttonnames[] = { "Left", "Right", "Middle", "Thumb", "Wheel D
extern int gotvote[MAXPLAYERS], votes[MAXPLAYERS], voting; extern int gotvote[MAXPLAYERS], votes[MAXPLAYERS], voting;
void cmenu(short cm) void cmenu(int cm)
{ {
current_menu = cm; current_menu = cm;
@ -475,11 +474,11 @@ extern int loadpheader(char spot,struct savehead *saveh);
static struct savehead savehead; static struct savehead savehead;
//static int32 volnum,levnum,plrskl,numplr; //static int32 volnum,levnum,plrskl,numplr;
//static char brdfn[BMAX_PATH]; //static char brdfn[BMAX_PATH];
short lastsavedpos = -1; int lastsavedpos = -1;
static void dispnames(void) static void dispnames(void)
{ {
short x, c = 160; int x, c = 160;
c += 64; c += 64;
for (x = 0;x <= 108;x += 12) for (x = 0;x <= 108;x += 12)
@ -572,7 +571,7 @@ void sendquit(void)
void menus(void) void menus(void)
{ {
CACHE1D_FIND_REC *dir; CACHE1D_FIND_REC *dir;
short c,x,i; int c,x,i;
long l,m; long l,m;
char *p = NULL; char *p = NULL;

View file

@ -299,7 +299,7 @@ static short aim(spritetype *s,short aang,short atwith)
return j; return j;
} }
short shoot(short i,short atwith) int shoot(int i,int atwith)
{ {
short sect, hitsect, hitspr, hitwall, l, sa, p, j, k=-1, wh, scount; short sect, hitsect, hitspr, hitwall, l, sa, p, j, k=-1, wh, scount;
long sx, sy, sz, vel, zvel, hitx, hity, hitz, x, oldzvel, dal; long sx, sy, sz, vel, zvel, hitx, hity, hitz, x, oldzvel, dal;
@ -1793,7 +1793,7 @@ SKIPBULLETHOLE:
return -1; return -1;
} }
static void displayloogie(short snum) static void displayloogie(int snum)
{ {
long i, a, x, y, z; long i, a, x, y, z;
@ -1812,16 +1812,16 @@ static void displayloogie(short snum)
} }
} }
static int animatefist(const short *gs,const short *snum) static int animatefist(int gs,int snum)
{ {
short looking_arc,fisti,fistpal; int looking_arc,fisti,fistpal;
long fistzoom, fistz; long fistzoom, fistz;
fisti = ps[*snum].fist_incs; fisti = ps[snum].fist_incs;
if (fisti > 32) fisti = 32; if (fisti > 32) fisti = 32;
if (fisti <= 0) return 0; if (fisti <= 0) return 0;
looking_arc = klabs(ps[*snum].look_ang)/9; looking_arc = klabs(ps[snum].look_ang)/9;
fistzoom = 65536L - (sintable[(512+(fisti<<6))&2047]<<2); fistzoom = 65536L - (sintable[(512+(fisti<<6))&2047]<<2);
if (fistzoom > 90612L) if (fistzoom > 90612L)
@ -1830,61 +1830,61 @@ static int animatefist(const short *gs,const short *snum)
fistzoom = 40290; fistzoom = 40290;
fistz = 194 + (sintable[((6+fisti)<<7)&2047]>>9); fistz = 194 + (sintable[((6+fisti)<<7)&2047]>>9);
if (sprite[ps[*snum].i].pal == 1) if (sprite[ps[snum].i].pal == 1)
fistpal = 1; fistpal = 1;
else else
fistpal = sector[ps[*snum].cursectnum].floorpal; fistpal = sector[ps[snum].cursectnum].floorpal;
rotatesprite( rotatesprite(
(-fisti+222+(sync[*snum].avel>>4))<<16, (-fisti+222+(sync[snum].avel>>4))<<16,
(looking_arc+fistz)<<16, (looking_arc+fistz)<<16,
fistzoom,0,FIST,*gs,fistpal,2,0,0,xdim-1,ydim-1); fistzoom,0,FIST,gs,fistpal,2,0,0,xdim-1,ydim-1);
return 1; return 1;
} }
static int animateknee(const short *gs,const short *snum) static int animateknee(int gs,int snum)
{ {
short knee_y[] = {0,-8,-16,-32,-64,-84,-108,-108,-108,-72,-32,-8}; short knee_y[] = {0,-8,-16,-32,-64,-84,-108,-108,-108,-72,-32,-8};
short looking_arc, pal; int looking_arc, pal;
if (ps[*snum].knee_incs > 11 || ps[*snum].knee_incs == 0 || sprite[ps[*snum].i].extra <= 0) return 0; if (ps[snum].knee_incs > 11 || ps[snum].knee_incs == 0 || sprite[ps[snum].i].extra <= 0) return 0;
looking_arc = knee_y[ps[*snum].knee_incs] + klabs(ps[*snum].look_ang)/9; looking_arc = knee_y[ps[snum].knee_incs] + klabs(ps[snum].look_ang)/9;
looking_arc -= (ps[*snum].hard_landing<<3); looking_arc -= (ps[snum].hard_landing<<3);
if (sprite[ps[*snum].i].pal == 1) if (sprite[ps[snum].i].pal == 1)
pal = 1; pal = 1;
else else
{ {
pal = sector[ps[*snum].cursectnum].floorpal; pal = sector[ps[snum].cursectnum].floorpal;
if (pal == 0) if (pal == 0)
pal = ps[*snum].palookup; pal = ps[snum].palookup;
} }
myospal(105+(sync[*snum].avel>>4)-(ps[*snum].look_ang>>1)+(knee_y[ps[*snum].knee_incs]>>2),looking_arc+280-((ps[*snum].horiz-ps[*snum].horizoff)>>4),KNEE,*gs,4,pal); myospal(105+(sync[snum].avel>>4)-(ps[snum].look_ang>>1)+(knee_y[ps[snum].knee_incs]>>2),looking_arc+280-((ps[snum].horiz-ps[snum].horizoff)>>4),KNEE,gs,4,pal);
return 1; return 1;
} }
static int animateknuckles(const short *gs,const short *snum) static int animateknuckles(int gs,int snum)
{ {
short knuckle_frames[] = {0,1,2,2,3,3,3,2,2,1,0}; short knuckle_frames[] = {0,1,2,2,3,3,3,2,2,1,0};
short looking_arc, pal; int looking_arc, pal;
if (ps[*snum].knuckle_incs == 0 || sprite[ps[*snum].i].extra <= 0) return 0; if (ps[snum].knuckle_incs == 0 || sprite[ps[snum].i].extra <= 0) return 0;
looking_arc = klabs(ps[*snum].look_ang)/9; looking_arc = klabs(ps[snum].look_ang)/9;
looking_arc -= (ps[*snum].hard_landing<<3); looking_arc -= (ps[snum].hard_landing<<3);
if (sprite[ps[*snum].i].pal == 1) if (sprite[ps[snum].i].pal == 1)
pal = 1; pal = 1;
else else
pal = sector[ps[*snum].cursectnum].floorpal; pal = sector[ps[snum].cursectnum].floorpal;
myospal(160+(sync[*snum].avel>>4)-(ps[*snum].look_ang>>1),looking_arc+180-((ps[*snum].horiz-ps[*snum].horizoff)>>4),CRACKKNUCKLES+knuckle_frames[ps[*snum].knuckle_incs>>1],*gs,4,pal); myospal(160+(sync[snum].avel>>4)-(ps[snum].look_ang>>1),looking_arc+180-((ps[snum].horiz-ps[snum].horizoff)>>4),CRACKKNUCKLES+knuckle_frames[ps[snum].knuckle_incs>>1],gs,4,pal);
return 1; return 1;
} }
@ -1893,9 +1893,7 @@ long lastvisinc;
void DoFire(struct player_struct *p) void DoFire(struct player_struct *p)
{ {
int i; int i, snum = sprite[p->i].yvel;
short snum = sprite[p->i].yvel;
SetGameVarID(g_iReturnVarID,0,p->i,snum); SetGameVarID(g_iReturnVarID,0,p->i,snum);
OnEvent(EVENT_DOFIRE, p->i, snum, -1); OnEvent(EVENT_DOFIRE, p->i, snum, -1);
@ -1948,9 +1946,7 @@ void DoFire(struct player_struct *p)
void DoSpawn(struct player_struct *p) void DoSpawn(struct player_struct *p)
{ {
int j; int j, snum = sprite[p->i].yvel;
short snum = sprite[p->i].yvel;
if (!aplWeaponSpawn[p->curr_weapon][snum]) if (!aplWeaponSpawn[p->curr_weapon][snum])
return; return;
@ -1970,9 +1966,9 @@ void DoSpawn(struct player_struct *p)
} }
void displaymasks(short snum) void displaymasks(int snum)
{ {
short p; int p;
if (sprite[ps[snum].i].pal == 1) if (sprite[ps[snum].i].pal == 1)
p = 1; p = 1;
@ -1986,53 +1982,53 @@ void displaymasks(short snum)
} }
} }
static int animatetip(const short *gs,const short *snum) static int animatetip(int gs,int snum)
{ {
short p,looking_arc; int p,looking_arc;
short tip_y[] = {0,-8,-16,-32,-64,-84,-108,-108,-108,-108,-108,-108,-108,-108,-108,-108,-96,-72,-64,-32,-16}; short tip_y[] = {0,-8,-16,-32,-64,-84,-108,-108,-108,-108,-108,-108,-108,-108,-108,-108,-96,-72,-64,-32,-16};
if (ps[*snum].tipincs == 0) return 0; if (ps[snum].tipincs == 0) return 0;
looking_arc = klabs(ps[*snum].look_ang)/9; looking_arc = klabs(ps[snum].look_ang)/9;
looking_arc -= (ps[*snum].hard_landing<<3); looking_arc -= (ps[snum].hard_landing<<3);
if (sprite[ps[*snum].i].pal == 1) if (sprite[ps[snum].i].pal == 1)
p = 1; p = 1;
else else
p = sector[ps[*snum].cursectnum].floorpal; p = sector[ps[snum].cursectnum].floorpal;
/* if(ps[snum].access_spritenum >= 0) /* if(ps[snum].access_spritenum >= 0)
p = sprite[ps[snum].access_spritenum].pal; p = sprite[ps[snum].access_spritenum].pal;
else else
p = wall[ps[snum].access_wallnum].pal; p = wall[ps[snum].access_wallnum].pal;
*/ */
myospal(170+(sync[*snum].avel>>4)-(ps[*snum].look_ang>>1), myospal(170+(sync[snum].avel>>4)-(ps[snum].look_ang>>1),
(tip_y[ps[*snum].tipincs]>>1)+looking_arc+240-((ps[*snum].horiz-ps[*snum].horizoff)>>4),TIP+((26-ps[*snum].tipincs)>>4),*gs,0,p); (tip_y[ps[snum].tipincs]>>1)+looking_arc+240-((ps[snum].horiz-ps[snum].horizoff)>>4),TIP+((26-ps[snum].tipincs)>>4),gs,0,p);
return 1; return 1;
} }
static int animateaccess(const short *gs,const short *snum) static int animateaccess(int gs,int snum)
{ {
short access_y[] = {0,-8,-16,-32,-64,-84,-108,-108,-108,-108,-108,-108,-108,-108,-108,-108,-96,-72,-64,-32,-16}; short access_y[] = {0,-8,-16,-32,-64,-84,-108,-108,-108,-108,-108,-108,-108,-108,-108,-108,-96,-72,-64,-32,-16};
short looking_arc; int looking_arc;
char p; int p;
if (ps[*snum].access_incs == 0 || sprite[ps[*snum].i].extra <= 0) return 0; if (ps[snum].access_incs == 0 || sprite[ps[snum].i].extra <= 0) return 0;
looking_arc = access_y[ps[*snum].access_incs] + klabs(ps[*snum].look_ang)/9; looking_arc = access_y[ps[snum].access_incs] + klabs(ps[snum].look_ang)/9;
looking_arc -= (ps[*snum].hard_landing<<3); looking_arc -= (ps[snum].hard_landing<<3);
if (ps[*snum].access_spritenum >= 0) if (ps[snum].access_spritenum >= 0)
p = sprite[ps[*snum].access_spritenum].pal; p = sprite[ps[snum].access_spritenum].pal;
else p = 0; else p = 0;
// else // else
// p = wall[ps[*snum].access_wallnum].pal; // p = wall[ps[snum].access_wallnum].pal;
if ((ps[*snum].access_incs-3) > 0 && (ps[*snum].access_incs-3)>>3) if ((ps[snum].access_incs-3) > 0 && (ps[snum].access_incs-3)>>3)
myospal(170+(sync[*snum].avel>>4)-(ps[*snum].look_ang>>1)+(access_y[ps[*snum].access_incs]>>2),looking_arc+266-((ps[*snum].horiz-ps[*snum].horizoff)>>4),HANDHOLDINGLASER+(ps[*snum].access_incs>>3),*gs,0,p); myospal(170+(sync[snum].avel>>4)-(ps[snum].look_ang>>1)+(access_y[ps[snum].access_incs]>>2),looking_arc+266-((ps[snum].horiz-ps[snum].horizoff)>>4),HANDHOLDINGLASER+(ps[snum].access_incs>>3),gs,0,p);
else else
myospal(170+(sync[*snum].avel>>4)-(ps[*snum].look_ang>>1)+(access_y[ps[*snum].access_incs]>>2),looking_arc+266-((ps[*snum].horiz-ps[*snum].horizoff)>>4),HANDHOLDINGACCESS,*gs,4,p); myospal(170+(sync[snum].avel>>4)-(ps[snum].look_ang>>1)+(access_y[ps[snum].access_incs]>>2),looking_arc+266-((ps[snum].horiz-ps[snum].horizoff)>>4),HANDHOLDINGACCESS,gs,4,p);
return 1; return 1;
} }
@ -2068,14 +2064,14 @@ short fistsign;
char last_quick_kick[MAXPLAYERS]; char last_quick_kick[MAXPLAYERS];
void displayweapon(short snum) 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;
char o,pal; int o,pal;
struct player_struct *p; struct player_struct *p;
short *kb; short *kb;
short gs; int gs;
p = &ps[snum]; p = &ps[snum];
kb = &p->kickback_pic; kb = &p->kickback_pic;
@ -2087,10 +2083,10 @@ void displayweapon(short snum)
gs = sprite[p->i].shade; gs = sprite[p->i].shade;
if (gs > 24) gs = 24; if (gs > 24) gs = 24;
if (p->newowner >= 0 || ud.camerasprite >= 0 || p->over_shoulder_on > 0 || (sprite[p->i].pal != 1 && sprite[p->i].extra <= 0) || animatefist(&gs,&snum) || animateknuckles(&gs,&snum) || animatetip(&gs,&snum) || animateaccess(&gs,&snum)) if (p->newowner >= 0 || ud.camerasprite >= 0 || p->over_shoulder_on > 0 || (sprite[p->i].pal != 1 && sprite[p->i].extra <= 0) || animatefist(gs,snum) || animateknuckles(gs,snum) || animatetip(gs,snum) || animateaccess(gs,snum))
return; return;
animateknee(&gs,&snum); animateknee(gs,snum);
gun_pos = 80-(p->weapon_pos*p->weapon_pos); gun_pos = 80-(p->weapon_pos*p->weapon_pos);
@ -2665,9 +2661,9 @@ static ControlInfo lastinfo =
char jump_input = 0; char jump_input = 0;
void getinput(short snum) void getinput(int snum)
{ {
short j, daang; int j, daang;
ControlInfo info; ControlInfo info;
int32 tics; int32 tics;
boolean running; boolean running;
@ -2984,9 +2980,8 @@ void getinput(short snum)
static char doincrements(struct player_struct *p) static char doincrements(struct player_struct *p)
{ {
short snum; int snum = sprite[p->i].yvel;
snum = sprite[p->i].yvel;
// j = sync[snum].avel; // j = sync[snum].avel;
// p->weapon_ang = -(j/5); // p->weapon_ang = -(j/5);
@ -3190,8 +3185,7 @@ short weapon_sprites[MAX_WEAPONS] = { KNEE__STATIC, FIRSTGUNSPRITE__STATIC, SHOT
void checkweapons(struct player_struct *p) void checkweapons(struct player_struct *p)
{ {
short cw; int cw, snum = sprite[p->i].yvel;
short snum = sprite[p->i].yvel;
cw = aplWeaponWorksLike[p->curr_weapon][snum]; cw = aplWeaponWorksLike[p->curr_weapon][snum];
@ -3211,14 +3205,16 @@ void checkweapons(struct player_struct *p)
} }
} }
void processinput(short snum) void processinput(int snum)
{ {
long j, i, k, doubvel, fz, cz, hz, lz, truefdist, x, y; long j, i, k, doubvel, fz, cz, hz, lz, truefdist, x, y;
char shrunk; int shrunk;
unsigned long sb_snum; unsigned long sb_snum;
short psect, psectlotag,*kb, tempsect, pi; int psect, psectlotag;
struct player_struct *p; short *kb, tempsect;
spritetype *s; struct player_struct *p = &ps[snum];
int pi = p->i;
spritetype *s = &sprite[pi];
p = &ps[snum]; p = &ps[snum];
pi = p->i; pi = p->i;

View file

@ -523,15 +523,14 @@ void vscrn(void)
pus = NUMPAGES; pus = NUMPAGES;
} }
void pickrandomspot(short snum) void pickrandomspot(int snum)
{ {
struct player_struct *p; struct player_struct *p;
short i=0,j,k; int i=snum,j,k;
unsigned long dist,pdist = -1; unsigned long dist,pdist = -1;
p = &ps[snum]; p = &ps[snum];
i = 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;
@ -560,7 +559,7 @@ void pickrandomspot(short snum)
p->cursectnum = po[i].os; p->cursectnum = po[i].os;
} }
static void resetplayerstats(short snum) static void resetplayerstats(int snum)
{ {
struct player_struct *p; struct player_struct *p;
@ -670,9 +669,9 @@ static void resetplayerstats(short snum)
OnEvent(EVENT_RESETPLAYER, p->i, snum, -1); OnEvent(EVENT_RESETPLAYER, p->i, snum, -1);
} }
void resetweapons(short snum) void resetweapons(int snum)
{ {
short weapon; int weapon;
struct player_struct *p; struct player_struct *p;
p = &ps[snum]; p = &ps[snum];
@ -697,7 +696,7 @@ void resetweapons(short snum)
OnEvent(EVENT_RESETWEAPONS, p->i, snum, -1); OnEvent(EVENT_RESETWEAPONS, p->i, snum, -1);
} }
void resetinventory(short snum) void resetinventory(int snum)
{ {
struct player_struct *p; struct player_struct *p;
@ -720,10 +719,10 @@ void resetinventory(short snum)
OnEvent(EVENT_RESETINVENTORY, p->i, snum, -1); OnEvent(EVENT_RESETINVENTORY, p->i, snum, -1);
} }
static void resetprestat(short snum,char g) static void resetprestat(int snum,int g)
{ {
struct player_struct *p; struct player_struct *p;
short i; int i;
p = &ps[snum]; p = &ps[snum];

View file

@ -26,9 +26,9 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
// PRIMITIVE // PRIMITIVE
char haltsoundhack; char haltsoundhack;
short callsound(short sn,short whatsprite) int callsound(int sn,int whatsprite)
{ {
short i; int i;
if (haltsoundhack) if (haltsoundhack)
{ {
haltsoundhack = 0; haltsoundhack = 0;
@ -72,9 +72,9 @@ short callsound(short sn,short whatsprite)
return -1; return -1;
} }
short check_activator_motion(short lotag) int check_activator_motion(int lotag)
{ {
short i, j; int i, j;
spritetype *s; spritetype *s;
i = headspritestat[8]; i = headspritestat[8];
@ -116,7 +116,7 @@ short check_activator_motion(short lotag)
return(0); return(0);
} }
char isadoorwall(short dapic) int isadoorwall(int dapic)
{ {
switch (dynamictostatic[dapic]) switch (dynamictostatic[dapic])
{ {
@ -147,7 +147,7 @@ char isadoorwall(short dapic)
return 0; return 0;
} }
char isanunderoperator(short lotag) int isanunderoperator(int lotag)
{ {
switch (lotag&0xff) switch (lotag&0xff)
{ {
@ -163,7 +163,7 @@ char isanunderoperator(short lotag)
return 0; return 0;
} }
char isanearoperator(short lotag) int isanearoperator(int lotag)
{ {
switch (lotag&0xff) switch (lotag&0xff)
{ {
@ -185,9 +185,9 @@ char isanearoperator(short lotag)
return 0; return 0;
} }
short checkcursectnums(short sect) int checkcursectnums(int sect)
{ {
short i; int i;
for (i=connecthead;i>=0;i=connectpoint2[i]) for (i=connecthead;i>=0;i=connectpoint2[i])
if (sprite[ps[i].i].sectnum == sect) return i; if (sprite[ps[i].i].sectnum == sect) return i;
return -1; return -1;
@ -210,9 +210,9 @@ long dist(spritetype *s1,spritetype *s2)
return(FindDistance3D(vx,vy,vz>>4)); return(FindDistance3D(vx,vy,vz>>4));
} }
short findplayer(spritetype *s,long *d) int findplayer(spritetype *s,long *d)
{ {
short j, closest_player; int j, closest_player;
long x, closest; long x, closest;
if (ud.multimode < 2) if (ud.multimode < 2)
@ -238,9 +238,9 @@ short findplayer(spritetype *s,long *d)
return closest_player; return closest_player;
} }
short findotherplayer(short p,long *d) int findotherplayer(int p,long *d)
{ {
short j, closest_player; int j, closest_player;
long x, closest; long x, closest;
closest = 0x7fffffff; closest = 0x7fffffff;
@ -982,11 +982,10 @@ REDODOOR:
} }
} }
void operaterespawns(short low) void operaterespawns(int low)
{ {
short i, j, nexti; int j, nexti, i = headspritestat[11];
i = headspritestat[11];
while (i >= 0) while (i >= 0)
{ {
nexti = nextspritestat[i]; nexti = nextspritestat[i];
@ -1003,9 +1002,10 @@ void operaterespawns(short low)
} }
} }
void operateactivators(short low,short snum) void operateactivators(int low,int snum)
{ {
short i, j, k, *p; int i, j, k;
short *p;
walltype *wal; walltype *wal;
for (i=numcyclers-1;i>=0;i--) for (i=numcyclers-1;i>=0;i--)
@ -1096,11 +1096,9 @@ void operateactivators(short low,short snum)
operaterespawns(low); operaterespawns(low);
} }
void operatemasterswitches(short low) void operatemasterswitches(int low)
{ {
short i; int i = headspritestat[6];
i = headspritestat[6];
while (i >= 0) while (i >= 0)
{ {
if (PN == MASTERSWITCH && SLT == low && SP == 0) if (PN == MASTERSWITCH && SLT == low && SP == 0)
@ -1109,9 +1107,9 @@ void operatemasterswitches(short low)
} }
} }
void operateforcefields(short s, short low) void operateforcefields(short s, int low)
{ {
short i, p; int i, p;
for (p=numanimwalls;p>=0;p--) for (p=numanimwalls;p>=0;p--)
{ {
@ -1138,10 +1136,10 @@ void operateforcefields(short s, short low)
} }
} }
char checkhitswitch(short snum,long w,char switchtype) char checkhitswitch(int snum,long w,int switchtype)
{ {
char switchpal; char switchpal;
short i, x, lotag,hitag,picnum,correctdips,numdips; int i, x, lotag,hitag,picnum,correctdips,numdips;
long sx,sy; long sx,sy;
int switchpicnum; int switchpicnum;
@ -1597,11 +1595,9 @@ char checkhitswitch(short snum,long w,char switchtype)
void activatebysector(short sect,short j) void activatebysector(short sect,short j)
{ {
short i,didit; int i = headspritesect[sect];
int didit = 0;
didit = 0;
i = headspritesect[sect];
while (i >= 0) while (i >= 0)
{ {
if (PN == ACTIVATOR) if (PN == ACTIVATOR)
@ -2524,9 +2520,9 @@ void allignwarpelevators(void)
} }
} }
void sharedkeys(short snum) void sharedkeys(int snum)
{ {
short i, k; int i, k;
char dainv; char dainv;
unsigned long sb_snum, j; unsigned long sb_snum, j;
struct player_struct *p; struct player_struct *p;
@ -3215,7 +3211,7 @@ static long hitawall(struct player_struct *p,short *hitw)
} }
void checksectors(short snum) void checksectors(int snum)
{ {
long i = -1,oldz; long i = -1,oldz;
struct player_struct *p; struct player_struct *p;