dynamically allocated player structs

git-svn-id: https://svn.eduke32.com/eduke32@564 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
terminx 2007-08-27 06:46:31 +00:00
parent a2f4bdb2c8
commit 19c34b09ef
17 changed files with 2078 additions and 2036 deletions

File diff suppressed because it is too large Load diff

View file

@ -248,7 +248,7 @@ void playanm(const char *fn,char t)
//setpalette(0L,256L,tempbuf); //setpalette(0L,256L,tempbuf);
//setbrightness(ud.brightness>>2,tempbuf,2); //setbrightness(ud.brightness>>2,tempbuf,2);
setgamepalette(&g_player[myconnectindex].ps,animpal,10); setgamepalette(g_player[myconnectindex].ps,animpal,10);
#if defined(POLYMOST) && defined(USE_OPENGL) #if defined(POLYMOST) && defined(USE_OPENGL)
gltexfiltermode = 0; gltexfiltermode = 0;
@ -267,7 +267,7 @@ void playanm(const char *fn,char t)
getpackets(); getpackets();
if (restorepalette == 1) if (restorepalette == 1)
{ {
setgamepalette(&g_player[myconnectindex].ps,animpal,0); setgamepalette(g_player[myconnectindex].ps,animpal,0);
restorepalette = 0; restorepalette = 0;
} }
idle(); idle();

View file

@ -196,7 +196,7 @@ void CONFIG_SetDefaults(void)
ud.config.MusicDevice = 0; ud.config.MusicDevice = 0;
ud.config.MusicToggle = 1; ud.config.MusicToggle = 1;
ud.config.MusicVolume = 200; ud.config.MusicVolume = 200;
myaimmode = g_player[0].ps.aim_mode = 1; myaimmode = g_player[0].ps->aim_mode = 1;
ud.config.NumBits = 16; ud.config.NumBits = 16;
ud.config.NumChannels = 2; ud.config.NumChannels = 2;
ud.config.NumVoices = 32; ud.config.NumVoices = 32;
@ -651,7 +651,7 @@ int32 CONFIG_ReadSetup(void)
SCRIPT_GetNumber(ud.config.scripthandle, "Misc", "ShowFPS",&ud.tickrate); SCRIPT_GetNumber(ud.config.scripthandle, "Misc", "ShowFPS",&ud.tickrate);
SCRIPT_GetNumber(ud.config.scripthandle, "Misc", "Color",&ud.color); SCRIPT_GetNumber(ud.config.scripthandle, "Misc", "Color",&ud.color);
check_player_color((int *)&ud.color,-1); check_player_color((int *)&ud.color,-1);
g_player[0].ps.palookup = g_player[0].pcolor = ud.color; g_player[0].ps->palookup = g_player[0].pcolor = ud.color;
SCRIPT_GetNumber(ud.config.scripthandle, "Misc", "Team",&dummy); SCRIPT_GetNumber(ud.config.scripthandle, "Misc", "Team",&dummy);
ud.team = 0; ud.team = 0;
if (dummy < 4 && dummy > -1) ud.team = dummy; if (dummy < 4 && dummy > -1) ud.team = dummy;
@ -696,7 +696,7 @@ int32 CONFIG_ReadSetup(void)
SCRIPT_GetNumber(ud.config.scripthandle, "Controls","MouseAimingFlipped",&ud.mouseflip); // mouse aiming inverted SCRIPT_GetNumber(ud.config.scripthandle, "Controls","MouseAimingFlipped",&ud.mouseflip); // mouse aiming inverted
SCRIPT_GetNumber(ud.config.scripthandle, "Controls","MouseAiming",&ud.mouseaiming); // 1=momentary/0=toggle SCRIPT_GetNumber(ud.config.scripthandle, "Controls","MouseAiming",&ud.mouseaiming); // 1=momentary/0=toggle
g_player[0].ps.aim_mode = ud.mouseaiming; g_player[0].ps->aim_mode = ud.mouseaiming;
SCRIPT_GetNumber(ud.config.scripthandle, "Controls","MouseBias",&ud.config.MouseBias); SCRIPT_GetNumber(ud.config.scripthandle, "Controls","MouseBias",&ud.config.MouseBias);
SCRIPT_GetNumber(ud.config.scripthandle, "Controls","MouseFilter",&ud.config.MouseFilter); SCRIPT_GetNumber(ud.config.scripthandle, "Controls","MouseFilter",&ud.config.MouseFilter);
SCRIPT_GetNumber(ud.config.scripthandle, "Controls","SmoothInput",&ud.config.SmoothInput); SCRIPT_GetNumber(ud.config.scripthandle, "Controls","SmoothInput",&ud.config.SmoothInput);
@ -705,9 +705,9 @@ int32 CONFIG_ReadSetup(void)
SCRIPT_GetNumber(ud.config.scripthandle, "Controls","AimingFlag",(int32 *)&myaimmode); // (if toggle mode) gives state SCRIPT_GetNumber(ud.config.scripthandle, "Controls","AimingFlag",(int32 *)&myaimmode); // (if toggle mode) gives state
SCRIPT_GetNumber(ud.config.scripthandle, "Controls","RunKeyBehaviour",&ud.runkey_mode); // JBF 20031125 SCRIPT_GetNumber(ud.config.scripthandle, "Controls","RunKeyBehaviour",&ud.runkey_mode); // JBF 20031125
SCRIPT_GetNumber(ud.config.scripthandle, "Controls","AutoAim",&ud.config.AutoAim); // JBF 20031125 SCRIPT_GetNumber(ud.config.scripthandle, "Controls","AutoAim",&ud.config.AutoAim); // JBF 20031125
g_player[0].ps.auto_aim = ud.config.AutoAim; g_player[0].ps->auto_aim = ud.config.AutoAim;
SCRIPT_GetNumber(ud.config.scripthandle, "Controls","WeaponSwitchMode",&ud.weaponswitch); SCRIPT_GetNumber(ud.config.scripthandle, "Controls","WeaponSwitchMode",&ud.weaponswitch);
g_player[0].ps.weaponswitch = ud.weaponswitch; g_player[0].ps->weaponswitch = ud.weaponswitch;
#ifdef _WIN32 #ifdef _WIN32
SCRIPT_GetNumber(ud.config.scripthandle, "Updates", "CheckForUpdates", &ud.config.CheckForUpdates); SCRIPT_GetNumber(ud.config.scripthandle, "Updates", "CheckForUpdates", &ud.config.CheckForUpdates);

View file

@ -304,7 +304,7 @@ typedef struct {
unsigned long bits, extbits; unsigned long bits, extbits;
} input; } input;
#define sync dsync // JBF 20040604: sync is a function on some platforms // #define sync dsync // JBF 20040604: sync is a function on some platforms
extern input recsync[RECSYNCBUFSIZ]; extern input recsync[RECSYNCBUFSIZ];
extern long movefifosendplc; extern long movefifosendplc;
@ -933,8 +933,8 @@ enum logoflags {
LOGO_FLAG_TENSCREEN = 512 LOGO_FLAG_TENSCREEN = 512
}; };
extern char numl; extern int g_NumPalettes;
extern int condebug; extern int g_ScriptDebug;
#define MAXCHEATLEN 20 #define MAXCHEATLEN 20
#define NUMCHEATCODES (signed int)(sizeof(cheatquotes)/sizeof(cheatquotes[MAXCHEATLEN])) #define NUMCHEATCODES (signed int)(sizeof(cheatquotes)/sizeof(cheatquotes[MAXCHEATLEN]))
@ -956,9 +956,8 @@ typedef struct {
extern map_t map[MAXVOLUMES*MAXLEVELS]; extern map_t map[MAXVOLUMES*MAXLEVELS];
typedef struct { typedef struct {
player_struct ps; player_struct *ps;
player_orig po; input *sync;
input sync;
long movefifoend; long movefifoend;
long syncvalhead; long syncvalhead;
@ -973,9 +972,13 @@ typedef struct {
char user_name[32]; char user_name[32];
char playerreadyflag; char playerreadyflag;
char playerquitflag; char playerquitflag;
char vote;
char gotvote;
} playerdata_t; } playerdata_t;
extern input inputfifo[MOVEFIFOSIZ][MAXPLAYERS]; extern input inputfifo[MOVEFIFOSIZ][MAXPLAYERS];
extern player_orig g_PlayerSpawnPoints[MAXPLAYERS];
extern playerdata_t g_player[MAXPLAYERS]; extern playerdata_t g_player[MAXPLAYERS];
#include "funct.h" #include "funct.h"

File diff suppressed because it is too large Load diff

View file

@ -852,14 +852,14 @@ static void skipcomments(void)
} }
else if (c == '/' && textptr[1] == '/') else if (c == '/' && textptr[1] == '/')
{ {
if (!(error || warning) && condebug > 1) if (!(error || warning) && g_ScriptDebug > 1)
initprintf("%s:%ld: debug: got comment.\n",compilefile,line_number); initprintf("%s:%ld: debug: got comment.\n",compilefile,line_number);
while (*textptr != 0x0a && *textptr != 0x0d && *textptr != 0) while (*textptr != 0x0a && *textptr != 0x0d && *textptr != 0)
textptr++; textptr++;
} }
else if (c == '/' && textptr[1] == '*') else if (c == '/' && textptr[1] == '*')
{ {
if (!(error || warning) && condebug > 1) if (!(error || warning) && g_ScriptDebug > 1)
initprintf("%s:%ld: debug: got start of comment block.\n",compilefile,line_number); initprintf("%s:%ld: debug: got start of comment block.\n",compilefile,line_number);
while (*textptr && !(textptr[0] == '*' && textptr[1] == '/')) while (*textptr && !(textptr[0] == '*' && textptr[1] == '/'))
{ {
@ -867,11 +867,11 @@ static void skipcomments(void)
line_number++; line_number++;
textptr++; textptr++;
} }
if ((!(error || warning) && condebug > 1) && (textptr[0] == '*' && textptr[1] == '/')) if ((!(error || warning) && g_ScriptDebug > 1) && (textptr[0] == '*' && textptr[1] == '/'))
initprintf("%s:%ld: debug: got end of comment block.\n",compilefile,line_number); initprintf("%s:%ld: debug: got end of comment block.\n",compilefile,line_number);
if (!*textptr) if (!*textptr)
{ {
if (!(error || warning) && condebug) if (!(error || warning) && g_ScriptDebug)
initprintf("%s:%ld: debug: EOF in comment!\n",compilefile,line_number); initprintf("%s:%ld: debug: EOF in comment!\n",compilefile,line_number);
ReportError(-1); ReportError(-1);
initprintf("%s:%ld: error: found `/*' with no `*/'.\n",compilefile,line_number); initprintf("%s:%ld: error: found `/*' with no `*/'.\n",compilefile,line_number);
@ -1152,7 +1152,7 @@ static void getlabel(void)
label[(labelcnt<<6)+i++] = *(textptr++); label[(labelcnt<<6)+i++] = *(textptr++);
label[(labelcnt<<6)+i] = 0; label[(labelcnt<<6)+i] = 0;
if (!(error || warning) && condebug > 1) if (!(error || warning) && g_ScriptDebug > 1)
initprintf("%s:%ld: debug: got label `%s'.\n",compilefile,line_number,label+(labelcnt<<6)); initprintf("%s:%ld: debug: got label `%s'.\n",compilefile,line_number,label+(labelcnt<<6));
} }
@ -1220,7 +1220,7 @@ static long transword(void) //Returns its code #
*scriptptr = i; *scriptptr = i;
textptr += l; textptr += l;
scriptptr++; scriptptr++;
if (!(error || warning) && condebug) if (!(error || warning) && g_ScriptDebug)
initprintf("%s:%ld: debug: translating keyword `%s'.\n",compilefile,line_number,keyw[i]); initprintf("%s:%ld: debug: translating keyword `%s'.\n",compilefile,line_number,keyw[i]);
return i; return i;
} }
@ -1250,7 +1250,7 @@ static void transvartype(int type)
skipcomments(); skipcomments();
if (!type && !labelsonly && (isdigit(*textptr) || ((*textptr == '-') && (isdigit(*(textptr+1)))))) if (!type && !labelsonly && (isdigit(*textptr) || ((*textptr == '-') && (isdigit(*(textptr+1))))))
{ {
if (!(error || warning) && condebug) if (!(error || warning) && g_ScriptDebug)
initprintf("%s:%ld: debug: accepted constant %ld in place of gamevar.\n",compilefile,line_number,atol(textptr)); initprintf("%s:%ld: debug: accepted constant %ld in place of gamevar.\n",compilefile,line_number,atol(textptr));
*scriptptr++=MAXGAMEVARS; *scriptptr++=MAXGAMEVARS;
*scriptptr++=atol(textptr); *scriptptr++=atol(textptr);
@ -1261,7 +1261,7 @@ static void transvartype(int type)
{ {
if (!type) if (!type)
{ {
if (!(error || warning) && condebug) if (!(error || warning) && g_ScriptDebug)
initprintf("%s:%ld: debug: flagging gamevar as negative.\n",compilefile,line_number,atol(textptr)); initprintf("%s:%ld: debug: flagging gamevar as negative.\n",compilefile,line_number,atol(textptr));
f = (MAXGAMEVARS<<1); f = (MAXGAMEVARS<<1);
} }
@ -1292,7 +1292,7 @@ static void transvartype(int type)
{ {
if (Bstrcmp(tempbuf,label+(i<<6)) == 0 && (labeltype[i] & LABEL_DEFINE)) if (Bstrcmp(tempbuf,label+(i<<6)) == 0 && (labeltype[i] & LABEL_DEFINE))
{ {
if (!(error || warning) && condebug) if (!(error || warning) && g_ScriptDebug)
initprintf("%s:%ld: debug: accepted defined label `%s' instead of gamevar.\n",compilefile,line_number,label+(i<<6)); initprintf("%s:%ld: debug: accepted defined label `%s' instead of gamevar.\n",compilefile,line_number,label+(i<<6));
*scriptptr++=MAXGAMEVARS; *scriptptr++=MAXGAMEVARS;
*scriptptr++=labelcode[i]; *scriptptr++=labelcode[i];
@ -1327,7 +1327,7 @@ static void transvartype(int type)
ReportError(-1); ReportError(-1);
initprintf("%s:%ld: warning: found local gamevar `%s' used within %s; expect multiplayer synchronization issues.\n",compilefile,line_number,label+(labelcnt<<6),parsing_event?"a synced event":"an actor"); initprintf("%s:%ld: warning: found local gamevar `%s' used within %s; expect multiplayer synchronization issues.\n",compilefile,line_number,label+(labelcnt<<6),parsing_event?"a synced event":"an actor");
} }
if (!(error || warning) && condebug > 1) if (!(error || warning) && g_ScriptDebug > 1)
initprintf("%s:%ld: debug: accepted gamevar `%s'.\n",compilefile,line_number,label+(labelcnt<<6)); initprintf("%s:%ld: debug: accepted gamevar `%s'.\n",compilefile,line_number,label+(labelcnt<<6));
i |= f; i |= f;
*scriptptr++=i; *scriptptr++=i;
@ -1389,7 +1389,7 @@ static long transnum(long type)
if (labeltype[i] & type) if (labeltype[i] & type)
{ {
if (!(error || warning) && condebug > 1) if (!(error || warning) && g_ScriptDebug > 1)
{ {
gl = (char *)translatelabeltype(labeltype[i]); gl = (char *)translatelabeltype(labeltype[i]);
initprintf("%s:%ld: debug: accepted %s label `%s'.\n",compilefile,line_number,gl,label+(i<<6)); initprintf("%s:%ld: debug: accepted %s label `%s'.\n",compilefile,line_number,gl,label+(i<<6));
@ -1424,7 +1424,7 @@ static long transnum(long type)
ReportError(WARNING_LABELSONLY); ReportError(WARNING_LABELSONLY);
// warning++; // warning++;
} }
if (!(error || warning) && condebug > 1) if (!(error || warning) && g_ScriptDebug > 1)
initprintf("%s:%ld: debug: accepted constant %ld.\n",compilefile,line_number,atol(textptr)); initprintf("%s:%ld: debug: accepted constant %ld.\n",compilefile,line_number,atol(textptr));
*scriptptr = atol(textptr); *scriptptr = atol(textptr);
scriptptr++; scriptptr++;
@ -1484,7 +1484,7 @@ static int parsecommand(void)
if ((error+warning) > 63 || (*textptr == '\0') || (*(textptr+1) == '\0')) return 1; if ((error+warning) > 63 || (*textptr == '\0') || (*(textptr+1) == '\0')) return 1;
if (condebug) if (g_ScriptDebug)
ReportError(-1); ReportError(-1);
if (checking_switch > 0) if (checking_switch > 0)
@ -1532,7 +1532,7 @@ static int parsecommand(void)
{ {
if (labeltype[j] & LABEL_STATE) if (labeltype[j] & LABEL_STATE)
{ {
if (!(error || warning) && condebug > 1) if (!(error || warning) && g_ScriptDebug > 1)
initprintf("%s:%ld: debug: accepted state label `%s'.\n",compilefile,line_number,label+(j<<6)); initprintf("%s:%ld: debug: accepted state label `%s'.\n",compilefile,line_number,label+(j<<6));
*scriptptr = labelcode[j]; *scriptptr = labelcode[j];
break; break;

File diff suppressed because it is too large Load diff

View file

@ -88,6 +88,7 @@ char numplayersprites,loadfromgrouponly=0,earthquaketime;
long fricxv,fricyv; long fricxv,fricyv;
playerdata_t g_player[MAXPLAYERS]; playerdata_t g_player[MAXPLAYERS];
input inputfifo[MOVEFIFOSIZ][MAXPLAYERS]; input inputfifo[MOVEFIFOSIZ][MAXPLAYERS];
player_orig g_PlayerSpawnPoints[MAXPLAYERS];
user_defs ud; user_defs ud;
char pus, pub; char pus, pub;
@ -142,7 +143,7 @@ short weaponsandammosprites[15] =
}; };
long impact_damage; long impact_damage;
int condebug; int g_ScriptDebug;
//GLOBAL.C - replace the end "my's" with this //GLOBAL.C - replace the end "my's" with this
long myx, omyx, myxvel, myy, omyy, myyvel, myz, omyz, myzvel; long myx, omyx, myxvel, myy, omyy, myyvel, myz, omyz, myzvel;

View file

@ -365,8 +365,8 @@ int xyzsound(short num, short i, long x, long y, long z)
num >= NUM_SOUNDS || num >= NUM_SOUNDS ||
((soundm[num] & SOUNDM_PARENT) && ud.lockout) || // parental mode ((soundm[num] & SOUNDM_PARENT) && ud.lockout) || // parental mode
SoundToggle == 0 || SoundToggle == 0 ||
(g_player[myconnectindex].ps.timebeforeexit > 0 && g_player[myconnectindex].ps.timebeforeexit <= 26*3) || (g_player[myconnectindex].ps->timebeforeexit > 0 && g_player[myconnectindex].ps->timebeforeexit <= 26*3) ||
(g_player[myconnectindex].ps.gm & MODE_MENU) (g_player[myconnectindex].ps->gm & MODE_MENU)
) return -1; ) return -1;
if (soundm[num] & SOUNDM_PLAYER) { if (soundm[num] & SOUNDM_PLAYER) {
@ -410,8 +410,8 @@ int xyzsound(short num, short i, long x, long y, long z)
refdist *= d; refdist *= d;
} }
if (PN != MUSICANDSFX && if (PN != MUSICANDSFX &&
!cansee(g_player[screenpeek].ps.oposx,g_player[screenpeek].ps.oposy,g_player[screenpeek].ps.oposz-(24<<8), !cansee(g_player[screenpeek].ps->oposx,g_player[screenpeek].ps->oposy,g_player[screenpeek].ps->oposz-(24<<8),
g_player[screenpeek].ps.cursectnum,SX,SY,SZ-(24<<8),SECT) ) g_player[screenpeek].ps->cursectnum,SX,SY,SZ-(24<<8),SECT) )
gain *= OCCLUDEDFACTOR; gain *= OCCLUDEDFACTOR;
switch(num) switch(num)
@ -421,10 +421,10 @@ int xyzsound(short num, short i, long x, long y, long z)
case RPG_EXPLODE: case RPG_EXPLODE:
gain = 1.0; gain = 1.0;
global = 1; global = 1;
if (sector[g_player[screenpeek].ps.cursectnum].lotag == 2) pitch -= translatepitch(1024); if (sector[g_player[screenpeek].ps->cursectnum].lotag == 2) pitch -= translatepitch(1024);
break; break;
default: default:
if(sector[g_player[screenpeek].ps.cursectnum].lotag == 2 && (soundm[num]&SOUNDM_DUKE) == 0) if(sector[g_player[screenpeek].ps->cursectnum].lotag == 2 && (soundm[num]&SOUNDM_DUKE) == 0)
pitch = translatepitch(-768); pitch = translatepitch(-768);
//if( sndist > 31444 && PN != MUSICANDSFX) //if( sndist > 31444 && PN != MUSICANDSFX)
// return -1; // return -1;
@ -575,11 +575,11 @@ void pan3dsound(void)
jfaud->AgeCache(); jfaud->AgeCache();
if(ud.camerasprite == -1) { if(ud.camerasprite == -1) {
cx = g_player[screenpeek].ps.oposx; cx = g_player[screenpeek].ps->oposx;
cy = g_player[screenpeek].ps.oposy; cy = g_player[screenpeek].ps->oposy;
cz = g_player[screenpeek].ps.oposz; cz = g_player[screenpeek].ps->oposz;
cs = g_player[screenpeek].ps.cursectnum; cs = g_player[screenpeek].ps->cursectnum;
ca = g_player[screenpeek].ps.ang+g_player[screenpeek].ps.look_ang; ca = g_player[screenpeek].ps->ang+g_player[screenpeek].ps->look_ang;
} else { } else {
cx = sprite[ud.camerasprite].x; cx = sprite[ud.camerasprite].x;
cy = sprite[ud.camerasprite].y; cy = sprite[ud.camerasprite].y;

View file

@ -48,7 +48,7 @@ static int curvidset, newvidset = 0;
static char *mousebuttonnames[] = { "Left", "Right", "Middle", "Thumb", "Wheel Up", "Wheel Down" }; static char *mousebuttonnames[] = { "Left", "Right", "Middle", "Thumb", "Wheel Up", "Wheel Down" };
extern int gotvote[MAXPLAYERS], votes[MAXPLAYERS], voting; extern int voting;
void cmenu(int cm) void cmenu(int cm)
{ {
@ -560,7 +560,7 @@ void sendquit(void)
{ {
if (gamequit == 0 && (numplayers > 1)) if (gamequit == 0 && (numplayers > 1))
{ {
if (g_player[myconnectindex].ps.gm&MODE_GAME) if (g_player[myconnectindex].ps->gm&MODE_GAME)
{ {
gamequit = 1; gamequit = 1;
quittimer = totalclock+120; quittimer = totalclock+120;
@ -607,14 +607,14 @@ void menus(void)
buttonstat = MOUSE_GetButtons(); buttonstat = MOUSE_GetButtons();
} }
if ((g_player[myconnectindex].ps.gm&MODE_MENU) == 0) if ((g_player[myconnectindex].ps->gm&MODE_MENU) == 0)
{ {
walock[TILE_LOADSHOT] = 1; walock[TILE_LOADSHOT] = 1;
return; return;
} }
g_player[myconnectindex].ps.gm &= (0xff-MODE_TYPE); g_player[myconnectindex].ps->gm &= (0xff-MODE_TYPE);
g_player[myconnectindex].ps.fta = 0; g_player[myconnectindex].ps->fta = 0;
x = 0; x = 0;
@ -679,7 +679,7 @@ void menus(void)
ready2send = 1; ready2send = 1;
totalclock = ototalclock; totalclock = ototalclock;
} }
g_player[myconnectindex].ps.gm &= ~MODE_MENU; g_player[myconnectindex].ps->gm &= ~MODE_MENU;
} }
break; break;
@ -1320,7 +1320,7 @@ void menus(void)
if (KB_KeyPressed(sc_Escape) || KB_KeyPressed(sc_N) || RMB) if (KB_KeyPressed(sc_Escape) || KB_KeyPressed(sc_N) || RMB)
{ {
if (sprite[g_player[myconnectindex].ps.i].extra <= 0) if (sprite[g_player[myconnectindex].ps->i].extra <= 0)
{ {
if (enterlevel(MODE_GAME)) backtomenu(); if (enterlevel(MODE_GAME)) backtomenu();
return; return;
@ -1329,7 +1329,7 @@ void menus(void)
KB_ClearKeyDown(sc_N); KB_ClearKeyDown(sc_N);
KB_ClearKeyDown(sc_Escape); KB_ClearKeyDown(sc_Escape);
g_player[myconnectindex].ps.gm &= ~MODE_MENU; g_player[myconnectindex].ps->gm &= ~MODE_MENU;
if (ud.multimode < 2 && ud.recstat != 2) if (ud.multimode < 2 && ud.recstat != 2)
{ {
ready2send = 1; ready2send = 1;
@ -1346,13 +1346,13 @@ void menus(void)
if (ud.multimode > 1) if (ud.multimode > 1)
{ {
loadplayer(-1-lastsavedpos); loadplayer(-1-lastsavedpos);
g_player[myconnectindex].ps.gm = MODE_GAME; g_player[myconnectindex].ps->gm = MODE_GAME;
} }
else else
{ {
c = loadplayer(lastsavedpos); c = loadplayer(lastsavedpos);
if (c == 0) if (c == 0)
g_player[myconnectindex].ps.gm = MODE_GAME; g_player[myconnectindex].ps->gm = MODE_GAME;
} }
} }
@ -1506,10 +1506,10 @@ void menus(void)
if (ud.multimode > 1) if (ud.multimode > 1)
{ {
if (g_player[myconnectindex].ps.gm&MODE_GAME) if (g_player[myconnectindex].ps->gm&MODE_GAME)
{ {
loadplayer(-1-lastsavedpos); loadplayer(-1-lastsavedpos);
g_player[myconnectindex].ps.gm = MODE_GAME; g_player[myconnectindex].ps->gm = MODE_GAME;
} }
else else
{ {
@ -1532,7 +1532,7 @@ void menus(void)
{ {
c = loadplayer(lastsavedpos); c = loadplayer(lastsavedpos);
if (c == 0) if (c == 0)
g_player[myconnectindex].ps.gm = MODE_GAME; g_player[myconnectindex].ps->gm = MODE_GAME;
} }
break; break;
@ -1545,9 +1545,9 @@ void menus(void)
KB_ClearKeyDown(sc_N); KB_ClearKeyDown(sc_N);
KB_ClearKeyDown(sc_Escape); KB_ClearKeyDown(sc_Escape);
sound(EXITMENUSOUND); sound(EXITMENUSOUND);
if (g_player[myconnectindex].ps.gm&MODE_GAME) if (g_player[myconnectindex].ps->gm&MODE_GAME)
{ {
g_player[myconnectindex].ps.gm &= ~MODE_MENU; g_player[myconnectindex].ps->gm &= ~MODE_MENU;
if (ud.multimode < 2 && ud.recstat != 2) if (ud.multimode < 2 && ud.recstat != 2)
{ {
ready2send = 1; ready2send = 1;
@ -1579,7 +1579,7 @@ void menus(void)
ready2send = 1; ready2send = 1;
totalclock = ototalclock; totalclock = ototalclock;
} }
g_player[myconnectindex].ps.gm &= ~MODE_MENU; g_player[myconnectindex].ps->gm &= ~MODE_MENU;
sound(EXITMENUSOUND); sound(EXITMENUSOUND);
break; break;
} }
@ -1963,9 +1963,9 @@ cheat_for_port_credits:
if (KB_KeyPressed(sc_Q)) cmenu(500); if (KB_KeyPressed(sc_Q)) cmenu(500);
if (x == -1 && (g_player[myconnectindex].ps.gm&MODE_GAME || ud.recstat == 2)) if (x == -1 && (g_player[myconnectindex].ps->gm&MODE_GAME || ud.recstat == 2))
{ {
g_player[myconnectindex].ps.gm &= ~MODE_MENU; g_player[myconnectindex].ps->gm &= ~MODE_MENU;
if (ud.multimode < 2 && ud.recstat != 2) if (ud.multimode < 2 && ud.recstat != 2)
{ {
ready2send = 1; ready2send = 1;
@ -2064,7 +2064,7 @@ cheat_for_port_credits:
cmenu(500); cmenu(500);
break; break;
case -1: case -1:
g_player[myconnectindex].ps.gm &= ~MODE_MENU; g_player[myconnectindex].ps->gm &= ~MODE_MENU;
if (ud.multimode < 2 && ud.recstat != 2) if (ud.multimode < 2 && ud.recstat != 2)
{ {
ready2send = 1; ready2send = 1;
@ -2144,7 +2144,7 @@ cheat_for_port_credits:
} }
else if (x == -1) else if (x == -1)
{ {
if (g_player[myconnectindex].ps.gm&MODE_GAME) cmenu(50); if (g_player[myconnectindex].ps->gm&MODE_GAME) cmenu(50);
else cmenu(0); else cmenu(0);
} }
@ -2690,13 +2690,13 @@ cheat_for_port_credits:
case 9: case 9:
if (x==io) if (x==io)
{ {
enabled = !((g_player[myconnectindex].ps.gm&MODE_GAME) && ud.m_recstat != 1); enabled = !((g_player[myconnectindex].ps->gm&MODE_GAME) && ud.m_recstat != 1);
if ((g_player[myconnectindex].ps.gm&MODE_GAME)) closedemowrite(); if ((g_player[myconnectindex].ps->gm&MODE_GAME)) closedemowrite();
else ud.m_recstat = !ud.m_recstat; else ud.m_recstat = !ud.m_recstat;
} }
if ((g_player[myconnectindex].ps.gm&MODE_GAME) && ud.m_recstat != 1) if ((g_player[myconnectindex].ps->gm&MODE_GAME) && ud.m_recstat != 1)
enabled = 0; enabled = 0;
gametextpal(d,yy,ud.m_recstat?((ud.m_recstat && enabled && g_player[myconnectindex].ps.gm&MODE_GAME)?"Running":"On"):"Off",enabled?MENUHIGHLIGHT(io):DISABLEDMENUSHADE,enabled?0:1); gametextpal(d,yy,ud.m_recstat?((ud.m_recstat && enabled && g_player[myconnectindex].ps->gm&MODE_GAME)?"Running":"On"):"Off",enabled?MENUHIGHLIGHT(io):DISABLEDMENUSHADE,enabled?0:1);
break; break;
case 10: case 10:
if (x==io) cmenu(201); if (x==io) cmenu(201);
@ -2878,7 +2878,7 @@ cheat_for_port_credits:
switch (x) switch (x)
{ {
case -1: case -1:
if (g_player[myconnectindex].ps.gm&MODE_GAME) cmenu(50); if (g_player[myconnectindex].ps->gm&MODE_GAME) cmenu(50);
else cmenu(0); else cmenu(0);
break; break;
@ -3236,7 +3236,7 @@ cheat_for_port_credits:
if (x==4) if (x==4)
{ {
ud.brightness = ss; ud.brightness = ss;
setbrightness(ud.brightness>>2,&g_player[myconnectindex].ps.palette[0],0); setbrightness(ud.brightness>>2,&g_player[myconnectindex].ps->palette[0],0);
} }
} }
@ -4198,9 +4198,9 @@ cheat_for_port_credits:
switch (x) switch (x)
{ {
case -1: case -1:
if (g_player[myconnectindex].ps.gm&MODE_GAME && current_menu == 701) if (g_player[myconnectindex].ps->gm&MODE_GAME && current_menu == 701)
{ {
g_player[myconnectindex].ps.gm &= ~MODE_MENU; g_player[myconnectindex].ps->gm &= ~MODE_MENU;
if (ud.multimode < 2 && ud.recstat != 2) if (ud.multimode < 2 && ud.recstat != 2)
{ {
ready2send = 1; ready2send = 1;
@ -4230,7 +4230,7 @@ cheat_for_port_credits:
if (ud.config.MusicToggle == 0) MUSIC_Pause(); if (ud.config.MusicToggle == 0) MUSIC_Pause();
else else
{ {
if (ud.recstat != 2 && g_player[myconnectindex].ps.gm&MODE_GAME) if (ud.recstat != 2 && g_player[myconnectindex].ps->gm&MODE_GAME)
{ {
if (map[(unsigned char)music_select].musicfn != NULL) if (map[(unsigned char)music_select].musicfn != NULL)
playmusic(&map[(unsigned char)music_select].musicfn[0]); playmusic(&map[(unsigned char)music_select].musicfn[0]);
@ -4354,7 +4354,7 @@ cheat_for_port_credits:
if (x == -1) if (x == -1)
{ {
// readsavenames(); // readsavenames();
g_player[myconnectindex].ps.gm = MODE_GAME; g_player[myconnectindex].ps->gm = MODE_GAME;
if (ud.multimode < 2 && ud.recstat != 2) if (ud.multimode < 2 && ud.recstat != 2)
{ {
ready2send = 1; ready2send = 1;
@ -4376,7 +4376,7 @@ cheat_for_port_credits:
saveplayer(-1-(current_menu-360)); saveplayer(-1-(current_menu-360));
else saveplayer(current_menu-360); else saveplayer(current_menu-360);
lastsavedpos = current_menu-360; lastsavedpos = current_menu-360;
g_player[myconnectindex].ps.gm = MODE_GAME; g_player[myconnectindex].ps->gm = MODE_GAME;
if (ud.multimode < 2 && ud.recstat != 2) if (ud.multimode < 2 && ud.recstat != 2)
{ {
@ -4441,16 +4441,16 @@ cheat_for_port_credits:
case -1: case -1:
if (current_menu == 300) if (current_menu == 300)
{ {
if ((g_player[myconnectindex].ps.gm&MODE_GAME) != MODE_GAME) if ((g_player[myconnectindex].ps->gm&MODE_GAME) != MODE_GAME)
{ {
cmenu(0); cmenu(0);
break; break;
} }
else else
g_player[myconnectindex].ps.gm &= ~MODE_MENU; g_player[myconnectindex].ps->gm &= ~MODE_MENU;
} }
else else
g_player[myconnectindex].ps.gm = MODE_GAME; g_player[myconnectindex].ps->gm = MODE_GAME;
if (ud.multimode < 2 && ud.recstat != 2) if (ud.multimode < 2 && ud.recstat != 2)
{ {
@ -4544,7 +4544,7 @@ DISPLAYNAMES:
if (KB_KeyPressed(sc_Escape)) if (KB_KeyPressed(sc_Escape))
{ {
if (g_player[myconnectindex].ps.gm&MODE_GAME) if (g_player[myconnectindex].ps->gm&MODE_GAME)
cmenu(50); cmenu(50);
else cmenu(0); else cmenu(0);
return; return;
@ -4604,7 +4604,7 @@ VOLUME_ALL_40x:
if (x == -1) if (x == -1)
{ {
if (g_player[myconnectindex].ps.gm&MODE_GAME) if (g_player[myconnectindex].ps->gm&MODE_GAME)
cmenu(50); cmenu(50);
else cmenu(0); else cmenu(0);
return; return;
@ -4642,8 +4642,8 @@ VOLUME_ALL_40x:
{ {
KB_ClearKeyDown(sc_N); KB_ClearKeyDown(sc_N);
quittimer = 0; quittimer = 0;
if (g_player[myconnectindex].ps.gm&MODE_DEMO && ud.recstat == 2) if (g_player[myconnectindex].ps->gm&MODE_DEMO && ud.recstat == 2)
g_player[myconnectindex].ps.gm = MODE_DEMO; g_player[myconnectindex].ps->gm = MODE_DEMO;
else else
{ {
if (current_menu == 502) if (current_menu == 502)
@ -4651,9 +4651,9 @@ VOLUME_ALL_40x:
cmenu(last_menu); cmenu(last_menu);
probey = last_menu_pos; probey = last_menu_pos;
} }
else if (!(g_player[myconnectindex].ps.gm & MODE_GAME || ud.recstat == 2)) else if (!(g_player[myconnectindex].ps->gm & MODE_GAME || ud.recstat == 2))
cmenu(0); cmenu(0);
else g_player[myconnectindex].ps.gm &= ~MODE_MENU; else g_player[myconnectindex].ps->gm &= ~MODE_MENU;
if (ud.multimode < 2 && ud.recstat != 2) if (ud.multimode < 2 && ud.recstat != 2)
{ {
ready2send = 1; ready2send = 1;
@ -4671,7 +4671,7 @@ VOLUME_ALL_40x:
if (KB_KeyPressed(sc_Space) || KB_KeyPressed(sc_Enter) || KB_KeyPressed(sc_kpad_Enter) || KB_KeyPressed(sc_Y) || LMB) if (KB_KeyPressed(sc_Space) || KB_KeyPressed(sc_Enter) || KB_KeyPressed(sc_kpad_Enter) || KB_KeyPressed(sc_Y) || LMB)
{ {
KB_FlushKeyboardQueue(); KB_FlushKeyboardQueue();
g_player[myconnectindex].ps.gm = MODE_DEMO; g_player[myconnectindex].ps->gm = MODE_DEMO;
if (ud.recstat == 1) if (ud.recstat == 1)
closedemowrite(); closedemowrite();
cmenu(0); cmenu(0);
@ -4681,7 +4681,7 @@ VOLUME_ALL_40x:
if (x == -1 || KB_KeyPressed(sc_N) || RMB) if (x == -1 || KB_KeyPressed(sc_N) || RMB)
{ {
g_player[myconnectindex].ps.gm &= ~MODE_MENU; g_player[myconnectindex].ps->gm &= ~MODE_MENU;
if (ud.multimode < 2 && ud.recstat != 2) if (ud.multimode < 2 && ud.recstat != 2)
{ {
ready2send = 1; ready2send = 1;
@ -4724,14 +4724,17 @@ VOLUME_ALL_40x:
x = probe(186,124,0,0); x = probe(186,124,0,0);
if (voting != myconnectindex) if (voting != myconnectindex)
g_player[myconnectindex].ps.gm &= ~MODE_MENU; g_player[myconnectindex].ps->gm &= ~MODE_MENU;
if (x == -1) if (x == -1)
{ {
if (voting == myconnectindex) if (voting == myconnectindex)
{ {
Bmemset(votes,0,sizeof(votes)); for (i=0;i<MAXPLAYERS;i++)
Bmemset(gotvote,0,sizeof(gotvote)); {
g_player[i].vote = 0;
g_player[i].gotvote = 0;
}
tempbuf[0] = 18; tempbuf[0] = 18;
tempbuf[1] = 2; tempbuf[1] = 2;
@ -4749,12 +4752,12 @@ VOLUME_ALL_40x:
for (i=0;i<MAXPLAYERS;i++) for (i=0;i<MAXPLAYERS;i++)
{ {
plrvotes += votes[i]; plrvotes += g_player[i].vote;
j += gotvote[i]; j += g_player[i].gotvote;
} }
if (j == numplayers || !g_player[myconnectindex].ps.i || (plrvotes > (numplayers>>1)) || (!networkmode && myconnectindex == connecthead)) if (j == numplayers || !g_player[myconnectindex].ps->i || (plrvotes > (numplayers>>1)) || (!networkmode && myconnectindex == connecthead))
{ {
if (plrvotes > (numplayers>>1) || !g_player[myconnectindex].ps.i || (!networkmode && myconnectindex == connecthead)) if (plrvotes > (numplayers>>1) || !g_player[myconnectindex].ps->i || (!networkmode && myconnectindex == connecthead))
{ {
if (ud.m_player_skill == 3) ud.m_respawn_monsters = 1; if (ud.m_player_skill == 3) ud.m_respawn_monsters = 1;
else ud.m_respawn_monsters = 0; else ud.m_respawn_monsters = 0;
@ -4783,8 +4786,12 @@ VOLUME_ALL_40x:
} }
else if (j == numplayers) else if (j == numplayers)
{ {
Bmemset(votes,0,sizeof(votes)); for (i=0;i<MAXPLAYERS;i++)
Bmemset(gotvote,0,sizeof(gotvote)); {
g_player[i].vote = 0;
g_player[i].gotvote = 0;
}
voting = -1; voting = -1;
tempbuf[0] = 18; tempbuf[0] = 18;
@ -4799,8 +4806,8 @@ VOLUME_ALL_40x:
} }
Bsprintf(fta_quotes[116],"VOTE FAILED"); Bsprintf(fta_quotes[116],"VOTE FAILED");
FTA(116,&g_player[myconnectindex].ps); FTA(116,g_player[myconnectindex].ps);
g_player[myconnectindex].ps.gm &= ~MODE_MENU; g_player[myconnectindex].ps->gm &= ~MODE_MENU;
} }
} }
else else
@ -4811,7 +4818,7 @@ VOLUME_ALL_40x:
} }
case 600: case 600:
c = (320>>1) - 120; c = (320>>1) - 120;
if ((g_player[myconnectindex].ps.gm&MODE_GAME) != MODE_GAME) if ((g_player[myconnectindex].ps->gm&MODE_GAME) != MODE_GAME)
displayfragbar(); displayfragbar();
rotatesprite(160<<16,26<<16,65536L,0,MENUBAR,16,0,10,0,0,xdim-1,ydim-1); rotatesprite(160<<16,26<<16,65536L,0,MENUBAR,16,0,10,0,0,xdim-1,ydim-1);
menutext(160,31,0,0,&g_player[myconnectindex].user_name[0]); menutext(160,31,0,0,&g_player[myconnectindex].user_name[0]);
@ -4853,7 +4860,7 @@ VOLUME_ALL_40x:
{ {
case -1: case -1:
ud.m_recstat = 0; ud.m_recstat = 0;
if (g_player[myconnectindex].ps.gm&MODE_GAME) cmenu(50); if (g_player[myconnectindex].ps->gm&MODE_GAME) cmenu(50);
else cmenu(0); else cmenu(0);
break; break;
case 0: case 0:
@ -4923,11 +4930,14 @@ VOLUME_ALL_40x:
case 7: case 7:
if (voting == -1) if (voting == -1)
{ {
if (g_player[myconnectindex].ps.i) if (g_player[myconnectindex].ps->i)
{ {
Bmemset(votes,0,sizeof(votes)); for (i=0;i<MAXPLAYERS;i++)
Bmemset(gotvote,0,sizeof(gotvote)); {
votes[myconnectindex] = gotvote[myconnectindex] = 1; g_player[i].vote = 0;
g_player[i].gotvote = 0;
}
g_player[myconnectindex].vote = g_player[myconnectindex].gotvote = 1;
voting = myconnectindex; voting = myconnectindex;
tempbuf[0] = 18; tempbuf[0] = 18;
@ -5021,7 +5031,7 @@ VOLUME_ALL_40x:
break; break;
} }
if ((g_player[myconnectindex].ps.gm&MODE_MENU) != MODE_MENU) if ((g_player[myconnectindex].ps->gm&MODE_MENU) != MODE_MENU)
{ {
vscrn(); vscrn();
cameraclock = totalclock; cameraclock = totalclock;

View file

@ -30,7 +30,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "crc32.h" #include "crc32.h"
#include <ctype.h> #include <ctype.h>
extern int gotvote[MAXPLAYERS], votes[MAXPLAYERS], voting; extern int voting;
struct osdcmd_cheatsinfo osdcmd_cheatsinfo_stat; struct osdcmd_cheatsinfo osdcmd_cheatsinfo_stat;
static inline int osdcmd_quit(const osdfuncparm_t *parm) static inline int osdcmd_quit(const osdfuncparm_t *parm)
@ -86,21 +86,10 @@ static int osdcmd_changelevel(const osdfuncparm_t *parm)
} }
} }
if (volume == 0) if (level > MAXLEVELS || map[volume*MAXLEVELS+level].filename == NULL)
{ {
if (level > 6) OSD_Printf("changelevel: invalid level number\n");
{ return OSDCMD_SHOWHELP;
OSD_Printf("changelevel: invalid volume 1 level number (range 1-7)\n");
return OSDCMD_OK;
}
}
else
{
if (level > 10)
{
OSD_Printf("changelevel: invalid volume 2+ level number (range 1-11)\n");
return OSDCMD_SHOWHELP;
}
} }
if (numplayers > 1) if (numplayers > 1)
@ -112,13 +101,18 @@ static int osdcmd_changelevel(const osdfuncparm_t *parm)
ud.m_volume_number = volume; ud.m_volume_number = volume;
ud.m_level_number = level; ud.m_level_number = level;
if (g_player[myconnectindex].ps.i) if (g_player[myconnectindex].ps->i)
{ {
int i; int i;
Bmemset(votes,0,sizeof(votes)); for (i=0;i<MAXPLAYERS;i++)
Bmemset(gotvote,0,sizeof(gotvote)); {
votes[myconnectindex] = gotvote[myconnectindex] = 1; g_player[i].vote = 0;
g_player[i].gotvote = 0;
}
g_player[myconnectindex].vote = g_player[myconnectindex].gotvote = 1;
voting = myconnectindex; voting = myconnectindex;
tempbuf[0] = 18; tempbuf[0] = 18;
@ -136,12 +130,12 @@ static int osdcmd_changelevel(const osdfuncparm_t *parm)
if ((gametype_flags[ud.m_coop] & GAMETYPE_FLAG_PLAYERSFRIENDLY) && !(gametype_flags[ud.m_coop] & GAMETYPE_FLAG_TDM)) if ((gametype_flags[ud.m_coop] & GAMETYPE_FLAG_PLAYERSFRIENDLY) && !(gametype_flags[ud.m_coop] & GAMETYPE_FLAG_TDM))
ud.m_noexits = 0; ud.m_noexits = 0;
g_player[myconnectindex].ps.gm |= MODE_MENU; g_player[myconnectindex].ps->gm |= MODE_MENU;
cmenu(603); cmenu(603);
} }
return OSDCMD_OK; return OSDCMD_OK;
} }
if (g_player[myconnectindex].ps.gm & MODE_GAME) if (g_player[myconnectindex].ps->gm & MODE_GAME)
{ {
// in-game behave like a cheat // in-game behave like a cheat
osdcmd_cheatsinfo_stat.cheatnum = 2; osdcmd_cheatsinfo_stat.cheatnum = 2;
@ -214,13 +208,17 @@ static int osdcmd_map(const osdfuncparm_t *parm)
ud.m_volume_number = 0; ud.m_volume_number = 0;
ud.m_level_number = 7; ud.m_level_number = 7;
if (g_player[myconnectindex].ps.i) if (g_player[myconnectindex].ps->i)
{ {
int i; int i;
Bmemset(votes,0,sizeof(votes)); for (i=0;i<MAXPLAYERS;i++)
Bmemset(gotvote,0,sizeof(gotvote)); {
votes[myconnectindex] = gotvote[myconnectindex] = 1; g_player[i].vote = 0;
g_player[i].gotvote = 0;
}
g_player[myconnectindex].vote = g_player[myconnectindex].gotvote = 1;
voting = myconnectindex; voting = myconnectindex;
tempbuf[0] = 18; tempbuf[0] = 18;
@ -238,7 +236,7 @@ static int osdcmd_map(const osdfuncparm_t *parm)
if ((gametype_flags[ud.m_coop] & GAMETYPE_FLAG_PLAYERSFRIENDLY) && !(gametype_flags[ud.m_coop] & GAMETYPE_FLAG_TDM)) if ((gametype_flags[ud.m_coop] & GAMETYPE_FLAG_PLAYERSFRIENDLY) && !(gametype_flags[ud.m_coop] & GAMETYPE_FLAG_TDM))
ud.m_noexits = 0; ud.m_noexits = 0;
g_player[myconnectindex].ps.gm |= MODE_MENU; g_player[myconnectindex].ps->gm |= MODE_MENU;
cmenu(603); cmenu(603);
} }
return OSDCMD_OK; return OSDCMD_OK;
@ -263,7 +261,7 @@ static int osdcmd_map(const osdfuncparm_t *parm)
static int osdcmd_god(const osdfuncparm_t *parm) static int osdcmd_god(const osdfuncparm_t *parm)
{ {
if (numplayers == 1 && g_player[myconnectindex].ps.gm & MODE_GAME) if (numplayers == 1 && g_player[myconnectindex].ps->gm & MODE_GAME)
{ {
osdcmd_cheatsinfo_stat.cheatnum = 0; osdcmd_cheatsinfo_stat.cheatnum = 0;
} }
@ -277,7 +275,7 @@ static int osdcmd_god(const osdfuncparm_t *parm)
static int osdcmd_noclip(const osdfuncparm_t *parm) static int osdcmd_noclip(const osdfuncparm_t *parm)
{ {
if (numplayers == 1 && g_player[myconnectindex].ps.gm & MODE_GAME) if (numplayers == 1 && g_player[myconnectindex].ps->gm & MODE_GAME)
{ {
osdcmd_cheatsinfo_stat.cheatnum = 20; osdcmd_cheatsinfo_stat.cheatnum = 20;
} }
@ -361,7 +359,7 @@ static int osdcmd_restartsound(const osdfuncparm_t *parm)
if (ud.config.MusicToggle == 1) if (ud.config.MusicToggle == 1)
{ {
if (ud.recstat != 2 && g_player[myconnectindex].ps.gm&MODE_GAME) if (ud.recstat != 2 && g_player[myconnectindex].ps->gm&MODE_GAME)
{ {
if (map[(unsigned char)music_select].musicfn != NULL) if (map[(unsigned char)music_select].musicfn != NULL)
playmusic(&map[(unsigned char)music_select].musicfn[0]); playmusic(&map[(unsigned char)music_select].musicfn[0]);
@ -445,7 +443,7 @@ static int osdcmd_spawn(const osdfuncparm_t *parm)
short ang=0; short ang=0;
short set=0, idx; short set=0, idx;
if (numplayers > 1 || !(g_player[myconnectindex].ps.gm & MODE_GAME)) if (numplayers > 1 || !(g_player[myconnectindex].ps->gm & MODE_GAME))
{ {
OSD_Printf("spawn: Can't spawn sprites in multiplayer games or demos\n"); OSD_Printf("spawn: Can't spawn sprites in multiplayer games or demos\n");
return OSDCMD_OK; return OSDCMD_OK;
@ -507,7 +505,7 @@ static int osdcmd_spawn(const osdfuncparm_t *parm)
return OSDCMD_SHOWHELP; return OSDCMD_SHOWHELP;
} }
idx = spawn(g_player[myconnectindex].ps.i, (short)picnum); idx = spawn(g_player[myconnectindex].ps->i, (short)picnum);
if (set & 1) sprite[idx].pal = (char)pal; if (set & 1) sprite[idx].pal = (char)pal;
if (set & 2) sprite[idx].cstat = (short)cstat; if (set & 2) sprite[idx].cstat = (short)cstat;
if (set & 4) sprite[idx].ang = ang; if (set & 4) sprite[idx].ang = ang;
@ -542,7 +540,7 @@ static int osdcmd_setvar(const osdfuncparm_t *parm)
for (i=0;i<iGameVarCount;i++) for (i=0;i<iGameVarCount;i++)
if (aGameVars[i].szLabel != NULL) if (aGameVars[i].szLabel != NULL)
if (Bstrcmp(varname, aGameVars[i].szLabel) == 0) if (Bstrcmp(varname, aGameVars[i].szLabel) == 0)
SetGameVarID(i, varval, g_player[myconnectindex].ps.i, myconnectindex); SetGameVarID(i, varval, g_player[myconnectindex].ps->i, myconnectindex);
return OSDCMD_OK; return OSDCMD_OK;
} }
@ -757,7 +755,7 @@ static int osdcmd_gamma(const osdfuncparm_t *parm)
return OSDCMD_SHOWHELP; return OSDCMD_SHOWHELP;
} }
ud.brightness = atoi(parm->parms[0])<<2; ud.brightness = atoi(parm->parms[0])<<2;
setbrightness(ud.brightness>>2,&g_player[screenpeek].ps.palette[0],0); setbrightness(ud.brightness>>2,&g_player[screenpeek].ps->palette[0],0);
OSD_Printf("gamma %d\n",ud.brightness>>2); OSD_Printf("gamma %d\n",ud.brightness>>2);
return OSDCMD_OK; return OSDCMD_OK;
} }
@ -766,9 +764,9 @@ static int osdcmd_give(const osdfuncparm_t *parm)
{ {
int i; int i;
if (numplayers == 1 && g_player[myconnectindex].ps.gm & MODE_GAME) if (numplayers == 1 && g_player[myconnectindex].ps->gm & MODE_GAME)
{ {
if (g_player[myconnectindex].ps.dead_flag != 0) if (g_player[myconnectindex].ps->dead_flag != 0)
{ {
OSD_Printf("give: Cannot give while dead.\n"); OSD_Printf("give: Cannot give while dead.\n");
return OSDCMD_OK; return OSDCMD_OK;
@ -783,7 +781,7 @@ static int osdcmd_give(const osdfuncparm_t *parm)
} }
else if (!Bstrcasecmp(parm->parms[0], "health")) else if (!Bstrcasecmp(parm->parms[0], "health"))
{ {
sprite[g_player[myconnectindex].ps.i].extra = 200; sprite[g_player[myconnectindex].ps->i].extra = 200;
return OSDCMD_OK; return OSDCMD_OK;
} }
else if (!Bstrcasecmp(parm->parms[0], "weapons")) else if (!Bstrcasecmp(parm->parms[0], "weapons"))
@ -795,13 +793,13 @@ static int osdcmd_give(const osdfuncparm_t *parm)
{ {
for (i=PISTOL_WEAPON;i<MAX_WEAPONS-(VOLUMEONE?6:1);i++) for (i=PISTOL_WEAPON;i<MAX_WEAPONS-(VOLUMEONE?6:1);i++)
{ {
addammo(i,&g_player[myconnectindex].ps,max_ammo_amount[i]); addammo(i,g_player[myconnectindex].ps,max_ammo_amount[i]);
} }
return OSDCMD_OK; return OSDCMD_OK;
} }
else if (!Bstrcasecmp(parm->parms[0], "armor")) else if (!Bstrcasecmp(parm->parms[0], "armor"))
{ {
g_player[myconnectindex].ps.shield_amount = 100; g_player[myconnectindex].ps->shield_amount = 100;
return OSDCMD_OK; return OSDCMD_OK;
} }
else if (!Bstrcasecmp(parm->parms[0], "keys")) else if (!Bstrcasecmp(parm->parms[0], "keys"))
@ -829,20 +827,20 @@ void onvideomodechange(int newmode)
if (newmode) if (newmode)
{ {
if (g_player[screenpeek].ps.palette == palette || if (g_player[screenpeek].ps->palette == palette ||
g_player[screenpeek].ps.palette == waterpal || g_player[screenpeek].ps->palette == waterpal ||
g_player[screenpeek].ps.palette == titlepal || g_player[screenpeek].ps->palette == titlepal ||
g_player[screenpeek].ps.palette == animpal || g_player[screenpeek].ps->palette == animpal ||
g_player[screenpeek].ps.palette == endingpal || g_player[screenpeek].ps->palette == endingpal ||
g_player[screenpeek].ps.palette == drealms || g_player[screenpeek].ps->palette == drealms ||
g_player[screenpeek].ps.palette == slimepal) g_player[screenpeek].ps->palette == slimepal)
pal = g_player[screenpeek].ps.palette; pal = g_player[screenpeek].ps->palette;
else else
pal = palette; pal = palette;
} }
else else
{ {
pal = g_player[screenpeek].ps.palette; pal = g_player[screenpeek].ps->palette;
} }
setbrightness(ud.brightness>>2, pal, 0); setbrightness(ud.brightness>>2, pal, 0);

File diff suppressed because it is too large Load diff

View file

@ -34,7 +34,7 @@ extern char pow2char[];
extern int everyothertime; extern int everyothertime;
static int which_palookup = 9; static int which_palookup = 9;
char numl; int g_NumPalettes;
short spritecache[MAXTILES][3]; short spritecache[MAXTILES][3];
static char precachehightile[2][MAXTILES>>3]; static char precachehightile[2][MAXTILES>>3];
@ -325,8 +325,8 @@ static void dofrontscreens(char *statustext)
{ {
if (!statustext) if (!statustext)
{ {
//g_player[myconnectindex].ps.palette = palette; //g_player[myconnectindex].ps->palette = palette;
setgamepalette(&g_player[myconnectindex].ps, palette, 1); // JBF 20040308 setgamepalette(g_player[myconnectindex].ps, palette, 1); // JBF 20040308
fadepal(0,0,0, 0,64,7); fadepal(0,0,0, 0,64,7);
i = ud.screen_size; i = ud.screen_size;
ud.screen_size = 0; ud.screen_size = 0;
@ -372,9 +372,9 @@ static void dofrontscreens(char *statustext)
if (!statustext) if (!statustext)
{ {
clearview(0L); clearview(0L);
//g_player[myconnectindex].ps.palette = palette; //g_player[myconnectindex].ps->palette = palette;
//palto(0,0,0,0); //palto(0,0,0,0);
setgamepalette(&g_player[myconnectindex].ps, palette, 0); // JBF 20040308 setgamepalette(g_player[myconnectindex].ps, palette, 0); // JBF 20040308
} }
SetGameVarID(g_iReturnVarID,LOADSCREEN, -1, -1); SetGameVarID(g_iReturnVarID,LOADSCREEN, -1, -1);
OnEvent(EVENT_GETLOADTILE, -1, myconnectindex, -1); OnEvent(EVENT_GETLOADTILE, -1, myconnectindex, -1);
@ -543,7 +543,7 @@ void vscrn(void)
void pickrandomspot(int snum) void pickrandomspot(int snum)
{ {
player_struct *p = &g_player[snum].ps; player_struct *p = g_player[snum].ps;
int i=snum,j,k; int i=snum,j,k;
unsigned long dist,pdist = -1; unsigned long dist,pdist = -1;
@ -554,11 +554,11 @@ void pickrandomspot(int snum)
{ {
for (j=0;j<ud.multimode;j++) for (j=0;j<ud.multimode;j++)
{ {
if (j != snum && g_player[j].ps.team == g_player[snum].ps.team && sprite[g_player[j].ps.i].extra > 0) if (j != snum && g_player[j].ps->team == g_player[snum].ps->team && sprite[g_player[j].ps->i].extra > 0)
{ {
for (k=0;k<numplayersprites;k++) for (k=0;k<numplayersprites;k++)
{ {
dist = FindDistance2D(g_player[j].ps.posx-g_player[k].po.ox,g_player[j].ps.posy-g_player[k].po.oy); dist = FindDistance2D(g_player[j].ps->posx-g_PlayerSpawnPoints[k].ox,g_player[j].ps->posy-g_PlayerSpawnPoints[k].oy);
if (dist < pdist) if (dist < pdist)
i = k, pdist = dist; i = k, pdist = dist;
} }
@ -568,16 +568,16 @@ void pickrandomspot(int snum)
} }
} }
p->bobposx = p->oposx = p->posx = g_player[i].po.ox; p->bobposx = p->oposx = p->posx = g_PlayerSpawnPoints[i].ox;
p->bobposy = p->oposy = p->posy = g_player[i].po.oy; p->bobposy = p->oposy = p->posy = g_PlayerSpawnPoints[i].oy;
p->oposz = p->posz = g_player[i].po.oz; p->oposz = p->posz = g_PlayerSpawnPoints[i].oz;
p->ang = g_player[i].po.oa; p->ang = g_PlayerSpawnPoints[i].oa;
p->cursectnum = g_player[i].po.os; p->cursectnum = g_PlayerSpawnPoints[i].os;
} }
static void resetplayerstats(int snum) static void resetplayerstats(int snum)
{ {
player_struct *p = &g_player[snum].ps; player_struct *p = g_player[snum].ps;
ud.show_help = 0; ud.show_help = 0;
ud.showallmap = 0; ud.showallmap = 0;
@ -686,7 +686,7 @@ static void resetplayerstats(int snum)
void resetweapons(int snum) void resetweapons(int snum)
{ {
int weapon; int weapon;
player_struct *p = &g_player[snum].ps; player_struct *p = g_player[snum].ps;
for (weapon = PISTOL_WEAPON; weapon < MAX_WEAPONS; weapon++) for (weapon = PISTOL_WEAPON; weapon < MAX_WEAPONS; weapon++)
p->gotweapon[weapon] = 0; p->gotweapon[weapon] = 0;
@ -710,7 +710,7 @@ void resetweapons(int snum)
void resetinventory(int snum) void resetinventory(int snum)
{ {
player_struct *p = &g_player[snum].ps; player_struct *p = g_player[snum].ps;
p->inven_icon = 0; p->inven_icon = 0;
p->boot_amount = 0; p->boot_amount = 0;
@ -731,7 +731,7 @@ void resetinventory(int snum)
static void resetprestat(int snum,int g) static void resetprestat(int snum,int g)
{ {
player_struct *p = &g_player[snum].ps; player_struct *p = g_player[snum].ps;
int i; int i;
spriteqloc = 0; spriteqloc = 0;
@ -872,20 +872,20 @@ static void prelevel(char g)
if (sector[i].ceilingpicnum == CLOUDYSKIES && numclouds < 127) if (sector[i].ceilingpicnum == CLOUDYSKIES && numclouds < 127)
clouds[numclouds++] = i; clouds[numclouds++] = i;
if (g_player[0].ps.one_parallax_sectnum == -1) if (g_player[0].ps->one_parallax_sectnum == -1)
g_player[0].ps.one_parallax_sectnum = i; g_player[0].ps->one_parallax_sectnum = i;
} }
if (sector[i].lotag == 32767) //Found a secret room if (sector[i].lotag == 32767) //Found a secret room
{ {
g_player[0].ps.max_secret_rooms++; g_player[0].ps->max_secret_rooms++;
continue; continue;
} }
if (sector[i].lotag == -1) if (sector[i].lotag == -1)
{ {
g_player[0].ps.exitx = wall[sector[i].wallptr].x; g_player[0].ps->exitx = wall[sector[i].wallptr].x;
g_player[0].ps.exity = wall[sector[i].wallptr].y; g_player[0].ps->exity = wall[sector[i].wallptr].y;
continue; continue;
} }
} }
@ -898,8 +898,8 @@ static void prelevel(char g)
LoadActor(i); LoadActor(i);
if (sprite[i].lotag == -1 && (sprite[i].cstat&16)) if (sprite[i].lotag == -1 && (sprite[i].cstat&16))
{ {
g_player[0].ps.exitx = SX; g_player[0].ps->exitx = SX;
g_player[0].ps.exity = SY; g_player[0].ps->exity = SY;
} }
else switch (dynamictostatic[PN]) else switch (dynamictostatic[PN])
{ {
@ -1155,7 +1155,7 @@ static void prelevel(char g)
void newgame(int vn,int ln,int sk) void newgame(int vn,int ln,int sk)
{ {
player_struct *p = &g_player[0].ps; player_struct *p = g_player[0].ps;
int i; int i;
handleevents(); handleevents();
@ -1280,65 +1280,65 @@ static void resetpspritevars(char g)
char aimmode[MAXPLAYERS],autoaim[MAXPLAYERS],weaponswitch[MAXPLAYERS]; char aimmode[MAXPLAYERS],autoaim[MAXPLAYERS],weaponswitch[MAXPLAYERS];
STATUSBARTYPE tsbar[MAXPLAYERS]; STATUSBARTYPE tsbar[MAXPLAYERS];
EGS(g_player[0].ps.cursectnum,g_player[0].ps.posx,g_player[0].ps.posy,g_player[0].ps.posz, EGS(g_player[0].ps->cursectnum,g_player[0].ps->posx,g_player[0].ps->posy,g_player[0].ps->posz,
APLAYER,0,0,0,g_player[0].ps.ang,0,0,0,10); APLAYER,0,0,0,g_player[0].ps->ang,0,0,0,10);
if (ud.recstat != 2) for (i=0;i<MAXPLAYERS;i++) if (ud.recstat != 2) for (i=0;i<ud.multimode;i++)
{ {
aimmode[i] = g_player[i].ps.aim_mode; aimmode[i] = g_player[i].ps->aim_mode;
autoaim[i] = g_player[i].ps.auto_aim; autoaim[i] = g_player[i].ps->auto_aim;
weaponswitch[i] = g_player[i].ps.weaponswitch; weaponswitch[i] = g_player[i].ps->weaponswitch;
if (ud.multimode > 1 && (gametype_flags[ud.coop]&GAMETYPE_FLAG_PRESERVEINVENTORYDEATH) && ud.last_level >= 0) if (ud.multimode > 1 && (gametype_flags[ud.coop]&GAMETYPE_FLAG_PRESERVEINVENTORYDEATH) && ud.last_level >= 0)
{ {
for (j=0;j<MAX_WEAPONS;j++) for (j=0;j<MAX_WEAPONS;j++)
{ {
tsbar[i].ammo_amount[j] = g_player[i].ps.ammo_amount[j]; tsbar[i].ammo_amount[j] = g_player[i].ps->ammo_amount[j];
tsbar[i].gotweapon[j] = g_player[i].ps.gotweapon[j]; tsbar[i].gotweapon[j] = g_player[i].ps->gotweapon[j];
} }
tsbar[i].shield_amount = g_player[i].ps.shield_amount; tsbar[i].shield_amount = g_player[i].ps->shield_amount;
tsbar[i].curr_weapon = g_player[i].ps.curr_weapon; tsbar[i].curr_weapon = g_player[i].ps->curr_weapon;
tsbar[i].inven_icon = g_player[i].ps.inven_icon; tsbar[i].inven_icon = g_player[i].ps->inven_icon;
tsbar[i].firstaid_amount = g_player[i].ps.firstaid_amount; tsbar[i].firstaid_amount = g_player[i].ps->firstaid_amount;
tsbar[i].steroids_amount = g_player[i].ps.steroids_amount; tsbar[i].steroids_amount = g_player[i].ps->steroids_amount;
tsbar[i].holoduke_amount = g_player[i].ps.holoduke_amount; tsbar[i].holoduke_amount = g_player[i].ps->holoduke_amount;
tsbar[i].jetpack_amount = g_player[i].ps.jetpack_amount; tsbar[i].jetpack_amount = g_player[i].ps->jetpack_amount;
tsbar[i].heat_amount = g_player[i].ps.heat_amount; tsbar[i].heat_amount = g_player[i].ps->heat_amount;
tsbar[i].scuba_amount = g_player[i].ps.scuba_amount; tsbar[i].scuba_amount = g_player[i].ps->scuba_amount;
tsbar[i].boot_amount = g_player[i].ps.boot_amount; tsbar[i].boot_amount = g_player[i].ps->boot_amount;
} }
} }
resetplayerstats(0); resetplayerstats(0);
for (i=1;i<MAXPLAYERS;i++) for (i=1;i<ud.multimode;i++)
memcpy(&g_player[i].ps,&g_player[0].ps,sizeof(g_player[0].ps)); memcpy(g_player[i].ps,g_player[0].ps,sizeof(g_player[0].ps));
if (ud.recstat != 2) if (ud.recstat != 2)
for (i=0;i<MAXPLAYERS;i++) for (i=0;i<ud.multimode;i++)
{ {
g_player[i].ps.aim_mode = aimmode[i]; g_player[i].ps->aim_mode = aimmode[i];
g_player[i].ps.auto_aim = autoaim[i]; g_player[i].ps->auto_aim = autoaim[i];
g_player[i].ps.weaponswitch = weaponswitch[i]; g_player[i].ps->weaponswitch = weaponswitch[i];
if (ud.multimode > 1 && (gametype_flags[ud.coop]&GAMETYPE_FLAG_PRESERVEINVENTORYDEATH) && ud.last_level >= 0) if (ud.multimode > 1 && (gametype_flags[ud.coop]&GAMETYPE_FLAG_PRESERVEINVENTORYDEATH) && ud.last_level >= 0)
{ {
for (j=0;j<MAX_WEAPONS;j++) for (j=0;j<MAX_WEAPONS;j++)
{ {
g_player[i].ps.ammo_amount[j] = tsbar[i].ammo_amount[j]; g_player[i].ps->ammo_amount[j] = tsbar[i].ammo_amount[j];
g_player[i].ps.gotweapon[j] = tsbar[i].gotweapon[j]; g_player[i].ps->gotweapon[j] = tsbar[i].gotweapon[j];
} }
g_player[i].ps.shield_amount = tsbar[i].shield_amount; g_player[i].ps->shield_amount = tsbar[i].shield_amount;
g_player[i].ps.curr_weapon = tsbar[i].curr_weapon; g_player[i].ps->curr_weapon = tsbar[i].curr_weapon;
g_player[i].ps.inven_icon = tsbar[i].inven_icon; g_player[i].ps->inven_icon = tsbar[i].inven_icon;
g_player[i].ps.firstaid_amount = tsbar[i].firstaid_amount; g_player[i].ps->firstaid_amount = tsbar[i].firstaid_amount;
g_player[i].ps.steroids_amount= tsbar[i].steroids_amount; g_player[i].ps->steroids_amount= tsbar[i].steroids_amount;
g_player[i].ps.holoduke_amount = tsbar[i].holoduke_amount; g_player[i].ps->holoduke_amount = tsbar[i].holoduke_amount;
g_player[i].ps.jetpack_amount = tsbar[i].jetpack_amount; g_player[i].ps->jetpack_amount = tsbar[i].jetpack_amount;
g_player[i].ps.heat_amount = tsbar[i].heat_amount; g_player[i].ps->heat_amount = tsbar[i].heat_amount;
g_player[i].ps.scuba_amount= tsbar[i].scuba_amount; g_player[i].ps->scuba_amount= tsbar[i].scuba_amount;
g_player[i].ps.boot_amount = tsbar[i].boot_amount; g_player[i].ps->boot_amount = tsbar[i].boot_amount;
} }
} }
@ -1358,15 +1358,15 @@ static void resetpspritevars(char g)
if (numplayersprites == 0) if (numplayersprites == 0)
{ {
firstx = g_player[0].ps.posx; firstx = g_player[0].ps->posx;
firsty = g_player[0].ps.posy; firsty = g_player[0].ps->posy;
} }
g_player[(unsigned char)numplayersprites].po.ox = s->x; g_PlayerSpawnPoints[(unsigned char)numplayersprites].ox = s->x;
g_player[(unsigned char)numplayersprites].po.oy = s->y; g_PlayerSpawnPoints[(unsigned char)numplayersprites].oy = s->y;
g_player[(unsigned char)numplayersprites].po.oz = s->z; g_PlayerSpawnPoints[(unsigned char)numplayersprites].oz = s->z;
g_player[(unsigned char)numplayersprites].po.oa = s->ang; g_PlayerSpawnPoints[(unsigned char)numplayersprites].oa = s->ang;
g_player[(unsigned char)numplayersprites].po.os = s->sectnum; g_PlayerSpawnPoints[(unsigned char)numplayersprites].os = s->sectnum;
numplayersprites++; numplayersprites++;
if (j >= 0) if (j >= 0)
@ -1379,13 +1379,13 @@ static void resetpspritevars(char g)
s->xoffset = 0; s->xoffset = 0;
s->clipdist = 64; s->clipdist = 64;
if ((g&MODE_EOL) != MODE_EOL || g_player[j].ps.last_extra == 0) if ((g&MODE_EOL) != MODE_EOL || g_player[j].ps->last_extra == 0)
{ {
g_player[j].ps.last_extra = max_player_health; g_player[j].ps->last_extra = max_player_health;
s->extra = max_player_health; s->extra = max_player_health;
g_player[j].ps.runspeed = dukefriction; g_player[j].ps->runspeed = dukefriction;
} }
else s->extra = g_player[j].ps.last_extra; else s->extra = g_player[j].ps->last_extra;
s->yvel = j; s->yvel = j;
@ -1395,9 +1395,9 @@ static void resetpspritevars(char g)
{ {
int k = 0; int k = 0;
for (;k<MAXPLAYERS;k++) for (;k<ud.multimode;k++)
{ {
if (which_palookup == g_player[k].ps.palookup) if (which_palookup == g_player[k].ps->palookup)
{ {
which_palookup++; which_palookup++;
if (which_palookup >= 17) if (which_palookup >= 17)
@ -1405,11 +1405,11 @@ static void resetpspritevars(char g)
k=0; k=0;
} }
} }
g_player[j].pcolor = s->pal = g_player[j].ps.palookup = which_palookup++; g_player[j].pcolor = s->pal = g_player[j].ps->palookup = which_palookup++;
if (which_palookup >= 17) if (which_palookup >= 17)
which_palookup = 9; which_palookup = 9;
} }
else g_player[j].pcolor = g_player[j].ps.palookup = s->pal; else g_player[j].pcolor = g_player[j].ps->palookup = s->pal;
} }
else else
{ {
@ -1418,21 +1418,21 @@ static void resetpspritevars(char g)
if (gametype_flags[ud.coop] & GAMETYPE_FLAG_TDM) if (gametype_flags[ud.coop] & GAMETYPE_FLAG_TDM)
{ {
k = getteampal(g_player[j].pteam); k = getteampal(g_player[j].pteam);
g_player[j].ps.team = g_player[j].pteam; g_player[j].ps->team = g_player[j].pteam;
} }
s->pal = g_player[j].ps.palookup = k; s->pal = g_player[j].ps->palookup = k;
} }
g_player[j].ps.i = i; g_player[j].ps->i = i;
g_player[j].ps.frag_ps = j; g_player[j].ps->frag_ps = j;
hittype[i].owner = i; hittype[i].owner = i;
hittype[i].bposx = g_player[j].ps.bobposx = g_player[j].ps.oposx = g_player[j].ps.posx = s->x; hittype[i].bposx = g_player[j].ps->bobposx = g_player[j].ps->oposx = g_player[j].ps->posx = s->x;
hittype[i].bposy = g_player[j].ps.bobposy = g_player[j].ps.oposy = g_player[j].ps.posy = s->y; hittype[i].bposy = g_player[j].ps->bobposy = g_player[j].ps->oposy = g_player[j].ps->posy = s->y;
hittype[i].bposz = g_player[j].ps.oposz = g_player[j].ps.posz = s->z; hittype[i].bposz = g_player[j].ps->oposz = g_player[j].ps->posz = s->z;
g_player[j].ps.oang = g_player[j].ps.ang = s->ang; g_player[j].ps->oang = g_player[j].ps->ang = s->ang;
updatesector(s->x,s->y,&g_player[j].ps.cursectnum); updatesector(s->x,s->y,&g_player[j].ps->cursectnum);
j = connectpoint2[j]; j = connectpoint2[j];
@ -1446,11 +1446,11 @@ static inline void clearfrags(void)
{ {
int i = 0; int i = 0;
while (i<MAXPLAYERS) while (i<ud.multimode)
{ {
g_player[i].ps.frag = g_player[i].ps.fraggedself = 0, i++; g_player[i].ps->frag = g_player[i].ps->fraggedself = 0, i++;
clearbufbyte(&g_player[i].frags[0],MAXPLAYERS<<1,0L); clearbufbyte(&g_player[i].frags[0],MAXPLAYERS<<1,0L);
} }
} }
void resettimevars(void) void resettimevars(void)
@ -1510,7 +1510,7 @@ extern int jump_input;
void clearfifo(void) void clearfifo(void)
{ {
int i = 0; int i = 0;
syncvaltail = 0L; syncvaltail = 0L;
syncvaltottail = 0L; syncvaltottail = 0L;
@ -1523,37 +1523,40 @@ void clearfifo(void)
avgfvel = avgsvel = avgavel = avghorz = avgbits = avgextbits = 0; avgfvel = avgsvel = avgavel = avghorz = avgbits = avgextbits = 0;
otherminlag = mymaxlag = 0; otherminlag = mymaxlag = 0;
clearbufbyte(&loc,sizeof(input),0L); clearbufbyte(&loc,sizeof(input),0L);
clearbufbyte(inputfifo,sizeof(input)*MOVEFIFOSIZ*MAXPLAYERS,0L); clearbufbyte(&inputfifo,sizeof(input)*MOVEFIFOSIZ*MAXPLAYERS,0L);
for (;i<MAXPLAYERS;i++) for (;i<MAXPLAYERS;i++)
{ {
// Bmemset(&g_player[i].inputfifo,0,sizeof(g_player[i].inputfifo)); // Bmemset(g_player[i].inputfifo,0,sizeof(g_player[i].inputfifo));
Bmemset(&g_player[i].sync,0,sizeof(g_player[i].sync)); if (g_player[i].sync != NULL)
Bmemset(&g_player[i].movefifoend,0,sizeof(g_player[i].movefifoend)); Bmemset(g_player[i].sync,0,sizeof(input));
Bmemset(&g_player[i].syncvalhead,0,sizeof(g_player[i].syncvalhead)); Bmemset(&g_player[i].movefifoend,0,sizeof(g_player[i].movefifoend));
Bmemset(&g_player[i].myminlag,0,sizeof(g_player[i].myminlag)); Bmemset(&g_player[i].syncvalhead,0,sizeof(g_player[i].syncvalhead));
} Bmemset(&g_player[i].myminlag,0,sizeof(g_player[i].myminlag));
g_player[i].vote = 0;
g_player[i].gotvote = 0;
}
// clearbufbyte(playerquitflag,MAXPLAYERS,0x01); // clearbufbyte(playerquitflag,MAXPLAYERS,0x01);
} }
void resetmys(void) void resetmys(void)
{ {
myx = omyx = g_player[myconnectindex].ps.posx; myx = omyx = g_player[myconnectindex].ps->posx;
myy = omyy = g_player[myconnectindex].ps.posy; myy = omyy = g_player[myconnectindex].ps->posy;
myz = omyz = g_player[myconnectindex].ps.posz; myz = omyz = g_player[myconnectindex].ps->posz;
myxvel = myyvel = myzvel = 0; myxvel = myyvel = myzvel = 0;
myang = omyang = g_player[myconnectindex].ps.ang; myang = omyang = g_player[myconnectindex].ps->ang;
myhoriz = omyhoriz = g_player[myconnectindex].ps.horiz; myhoriz = omyhoriz = g_player[myconnectindex].ps->horiz;
myhorizoff = omyhorizoff = g_player[myconnectindex].ps.horizoff; myhorizoff = omyhorizoff = g_player[myconnectindex].ps->horizoff;
mycursectnum = g_player[myconnectindex].ps.cursectnum; mycursectnum = g_player[myconnectindex].ps->cursectnum;
myjumpingcounter = g_player[myconnectindex].ps.jumping_counter; myjumpingcounter = g_player[myconnectindex].ps->jumping_counter;
myjumpingtoggle = g_player[myconnectindex].ps.jumping_toggle; myjumpingtoggle = g_player[myconnectindex].ps->jumping_toggle;
myonground = g_player[myconnectindex].ps.on_ground; myonground = g_player[myconnectindex].ps->on_ground;
myhardlanding = g_player[myconnectindex].ps.hard_landing; myhardlanding = g_player[myconnectindex].ps->hard_landing;
myreturntocenter = g_player[myconnectindex].ps.return_to_center; myreturntocenter = g_player[myconnectindex].ps->return_to_center;
} }
extern int gotvote[MAXPLAYERS], votes[MAXPLAYERS], voting, vote_map, vote_episode; extern int voting, vote_map, vote_episode;
static void getlevelfromfilename(const char *fn, char *volume, char *level) static void getlevelfromfilename(const char *fn, char *volume, char *level)
{ {
@ -1582,6 +1585,8 @@ int enterlevel(int g)
waitforeverybody(); waitforeverybody();
ready2send = 0; ready2send = 0;
vote_map = vote_episode = voting = -1;
if ((g&MODE_DEMO) != MODE_DEMO) ud.recstat = ud.m_recstat; if ((g&MODE_DEMO) != MODE_DEMO) ud.recstat = ud.m_recstat;
ud.respawn_monsters = ud.m_respawn_monsters; ud.respawn_monsters = ud.m_respawn_monsters;
ud.respawn_items = ud.m_respawn_items; ud.respawn_items = ud.m_respawn_items;
@ -1592,10 +1597,6 @@ int enterlevel(int g)
ud.ffire = ud.m_ffire; ud.ffire = ud.m_ffire;
ud.noexits = ud.m_noexits; ud.noexits = ud.m_noexits;
vote_map = vote_episode = voting = -1;
Bmemset(votes,0,sizeof(votes));
Bmemset(gotvote,0,sizeof(gotvote));
if ((g&MODE_DEMO) == 0 && ud.recstat == 2) if ((g&MODE_DEMO) == 0 && ud.recstat == 2)
ud.recstat = 0; ud.recstat = 0;
@ -1661,7 +1662,7 @@ int enterlevel(int g)
{ {
if (boardfilename[0] != 0 && ud.m_level_number == 7 && ud.m_volume_number == 0) if (boardfilename[0] != 0 && ud.m_level_number == 7 && ud.m_volume_number == 0)
{ {
if (loadboard(boardfilename,0,&g_player[0].ps.posx, &g_player[0].ps.posy, &g_player[0].ps.posz, &g_player[0].ps.ang,&g_player[0].ps.cursectnum) == -1) if (loadboard(boardfilename,0,&g_player[0].ps->posx, &g_player[0].ps->posy, &g_player[0].ps->posz, &g_player[0].ps->ang,&g_player[0].ps->cursectnum) == -1)
{ {
initprintf("Map '%s' not found!\n",boardfilename); initprintf("Map '%s' not found!\n",boardfilename);
//gameexit(tempbuf); //gameexit(tempbuf);
@ -1683,7 +1684,7 @@ int enterlevel(int g)
if (!loadmaphack(levname)) initprintf("Loaded map hack file '%s'\n",levname); if (!loadmaphack(levname)) initprintf("Loaded map hack file '%s'\n",levname);
} }
} }
else if (loadboard(map[(ud.volume_number*MAXLEVELS)+ud.level_number].filename,0,&g_player[0].ps.posx, &g_player[0].ps.posy, &g_player[0].ps.posz, &g_player[0].ps.ang,&g_player[0].ps.cursectnum) == -1) else if (loadboard(map[(ud.volume_number*MAXLEVELS)+ud.level_number].filename,0,&g_player[0].ps->posx, &g_player[0].ps->posy, &g_player[0].ps->posz, &g_player[0].ps->ang,&g_player[0].ps->cursectnum) == -1)
{ {
initprintf("Map %s not found!\n",map[(ud.volume_number*MAXLEVELS)+ud.level_number].filename); initprintf("Map %s not found!\n",map[(ud.volume_number*MAXLEVELS)+ud.level_number].filename);
//gameexit(tempbuf); //gameexit(tempbuf);
@ -1714,7 +1715,7 @@ int enterlevel(int g)
levname[i] = 255; levname[i] = 255;
levname[i+1] = 0; levname[i+1] = 0;
if (loadboard(levname,1,&g_player[0].ps.posx, &g_player[0].ps.posy, &g_player[0].ps.posz, &g_player[0].ps.ang,&g_player[0].ps.cursectnum) == -1) if (loadboard(levname,1,&g_player[0].ps->posx, &g_player[0].ps->posy, &g_player[0].ps->posz, &g_player[0].ps->ang,&g_player[0].ps->cursectnum) == -1)
{ {
initprintf("Map '%s' not found!\n",map[(ud.volume_number*MAXLEVELS)+ud.level_number].filename); initprintf("Map '%s' not found!\n",map[(ud.volume_number*MAXLEVELS)+ud.level_number].filename);
//gameexit(tempbuf); //gameexit(tempbuf);
@ -1761,12 +1762,12 @@ int enterlevel(int g)
} }
if ((g&MODE_GAME) || (g&MODE_EOL)) if ((g&MODE_GAME) || (g&MODE_EOL))
g_player[myconnectindex].ps.gm = MODE_GAME; g_player[myconnectindex].ps->gm = MODE_GAME;
else if (g&MODE_RESTART) else if (g&MODE_RESTART)
{ {
if (ud.recstat == 2) if (ud.recstat == 2)
g_player[myconnectindex].ps.gm = MODE_DEMO; g_player[myconnectindex].ps->gm = MODE_DEMO;
else g_player[myconnectindex].ps.gm = MODE_GAME; else g_player[myconnectindex].ps->gm = MODE_GAME;
} }
if ((ud.recstat == 1) && (g&MODE_RESTART) != MODE_RESTART) if ((ud.recstat == 1) && (g&MODE_RESTART) != MODE_RESTART)
@ -1774,21 +1775,21 @@ int enterlevel(int g)
if (VOLUMEONE) if (VOLUMEONE)
{ {
if (ud.level_number == 0 && ud.recstat != 2) FTA(40,&g_player[myconnectindex].ps); if (ud.level_number == 0 && ud.recstat != 2) FTA(40,g_player[myconnectindex].ps);
} }
for (i=connecthead;i>=0;i=connectpoint2[i]) for (i=connecthead;i>=0;i=connectpoint2[i])
switch (dynamictostatic[sector[sprite[g_player[i].ps.i].sectnum].floorpicnum]) switch (dynamictostatic[sector[sprite[g_player[i].ps->i].sectnum].floorpicnum])
{ {
case HURTRAIL__STATIC: case HURTRAIL__STATIC:
case FLOORSLIME__STATIC: case FLOORSLIME__STATIC:
case FLOORPLASMA__STATIC: case FLOORPLASMA__STATIC:
resetweapons(i); resetweapons(i);
resetinventory(i); resetinventory(i);
g_player[i].ps.gotweapon[PISTOL_WEAPON] = 0; g_player[i].ps->gotweapon[PISTOL_WEAPON] = 0;
g_player[i].ps.ammo_amount[PISTOL_WEAPON] = 0; g_player[i].ps->ammo_amount[PISTOL_WEAPON] = 0;
g_player[i].ps.curr_weapon = KNEE_WEAPON; g_player[i].ps->curr_weapon = KNEE_WEAPON;
g_player[i].ps.kickback_pic = 0; g_player[i].ps->kickback_pic = 0;
break; break;
} }
@ -1796,11 +1797,11 @@ int enterlevel(int g)
resetmys(); resetmys();
//g_player[myconnectindex].ps.palette = palette; //g_player[myconnectindex].ps->palette = palette;
//palto(0,0,0,0); //palto(0,0,0,0);
setgamepalette(&g_player[myconnectindex].ps, palette, 0); // JBF 20040308 setgamepalette(g_player[myconnectindex].ps, palette, 0); // JBF 20040308
setpal(&g_player[myconnectindex].ps); setpal(g_player[myconnectindex].ps);
flushperms(); flushperms();
everyothertime = 0; everyothertime = 0;
@ -1823,9 +1824,9 @@ int enterlevel(int g)
drawbackground(); drawbackground();
displayrooms(myconnectindex,65536); displayrooms(myconnectindex,65536);
for (i=0;i<MAXPLAYERS;i++) for (i=0;i<ud.multimode;i++)
clearbufbyte(&g_player[i].playerquitflag,1,0x01010101); clearbufbyte(&g_player[i].playerquitflag,1,0x01010101);
g_player[myconnectindex].ps.over_shoulder_on = 0; g_player[myconnectindex].ps->over_shoulder_on = 0;
clearfrags(); clearfrags();

View file

@ -93,7 +93,7 @@ int loadpheader(char spot,struct savehead *saveh)
if (kdfread(&bv,4,1,fil) != 1) goto corrupt; if (kdfread(&bv,4,1,fil) != 1) goto corrupt;
if (bv != BYTEVERSION && bv != BYTEVERSION_COMPAT) if (bv != BYTEVERSION && bv != BYTEVERSION_COMPAT)
{ {
FTA(114,&g_player[myconnectindex].ps); FTA(114,g_player[myconnectindex].ps);
kclose(fil); kclose(fil);
return 1; return 1;
} }
@ -170,7 +170,7 @@ int loadplayer(int spot)
if (kdfread(&bv,4,1,fil) != 1) return -1; if (kdfread(&bv,4,1,fil) != 1) return -1;
if (bv != BYTEVERSION && bv != BYTEVERSION_COMPAT) if (bv != BYTEVERSION && bv != BYTEVERSION_COMPAT)
{ {
FTA(114,&g_player[myconnectindex].ps); FTA(114,g_player[myconnectindex].ps);
kclose(fil); kclose(fil);
ototalclock = totalclock; ototalclock = totalclock;
ready2send = 1; ready2send = 1;
@ -183,7 +183,7 @@ int loadplayer(int spot)
kclose(fil); kclose(fil);
ototalclock = totalclock; ototalclock = totalclock;
ready2send = 1; ready2send = 1;
FTA(124,&g_player[myconnectindex].ps); FTA(124,g_player[myconnectindex].ps);
return 1; return 1;
} }
else ud.multimode = nump; else ud.multimode = nump;
@ -244,10 +244,9 @@ int loadplayer(int spot)
if (kdfread(&nextspritestat[0],2,MAXSPRITES,fil) != MAXSPRITES) goto corrupt; if (kdfread(&nextspritestat[0],2,MAXSPRITES,fil) != MAXSPRITES) goto corrupt;
if (kdfread(&numcyclers,sizeof(numcyclers),1,fil) != 1) goto corrupt; if (kdfread(&numcyclers,sizeof(numcyclers),1,fil) != 1) goto corrupt;
if (kdfread(&cyclers[0][0],12,MAXCYCLERS,fil) != MAXCYCLERS) goto corrupt; if (kdfread(&cyclers[0][0],12,MAXCYCLERS,fil) != MAXCYCLERS) goto corrupt;
for (i=0;i<MAXPLAYERS;i++) for (i=0;i<nump;i++)
if (kdfread(&g_player[i].ps,sizeof(g_player[i].ps),1,fil) != 1) goto corrupt; if (kdfread(g_player[i].ps,sizeof(player_struct),1,fil) != 1) goto corrupt;
for (i=0;i<MAXPLAYERS;i++) if (kdfread(&g_PlayerSpawnPoints,sizeof(g_PlayerSpawnPoints),1,fil) != 1) goto corrupt;
if (kdfread(&g_player[i].po,sizeof(g_player[i].po),1,fil) != 1) goto corrupt;
if (kdfread(&numanimwalls,sizeof(numanimwalls),1,fil) != 1) goto corrupt; if (kdfread(&numanimwalls,sizeof(numanimwalls),1,fil) != 1) goto corrupt;
if (kdfread(&animwall,sizeof(animwall),1,fil) != 1) goto corrupt; if (kdfread(&animwall,sizeof(animwall),1,fil) != 1) goto corrupt;
if (kdfread(&msx[0],sizeof(long),sizeof(msx)/sizeof(long),fil) != sizeof(msx)/sizeof(long)) goto corrupt; if (kdfread(&msx[0],sizeof(long),sizeof(msx)/sizeof(long),fil) != sizeof(msx)/sizeof(long)) goto corrupt;
@ -341,8 +340,8 @@ int loadplayer(int spot)
if (kdfread(&connecthead,sizeof(connecthead),1,fil) != 1) goto corrupt; if (kdfread(&connecthead,sizeof(connecthead),1,fil) != 1) goto corrupt;
if (kdfread(connectpoint2,sizeof(connectpoint2),1,fil) != 1) goto corrupt; if (kdfread(connectpoint2,sizeof(connectpoint2),1,fil) != 1) goto corrupt;
if (kdfread(&numplayersprites,sizeof(numplayersprites),1,fil) != 1) goto corrupt; if (kdfread(&numplayersprites,sizeof(numplayersprites),1,fil) != 1) goto corrupt;
for (i=0;i<MAXPLAYERS;i++) for (i=0;i<MAXPLAYERS;i++)
if (kdfread((short *)&g_player[i].frags[0],sizeof(g_player[i].frags),1,fil) != 1) goto corrupt; if (kdfread((short *)&g_player[i].frags[0],sizeof(g_player[i].frags),1,fil) != 1) goto corrupt;
if (kdfread(&randomseed,sizeof(randomseed),1,fil) != 1) goto corrupt; if (kdfread(&randomseed,sizeof(randomseed),1,fil) != 1) goto corrupt;
if (kdfread(&global_random,sizeof(global_random),1,fil) != 1) goto corrupt; if (kdfread(&global_random,sizeof(global_random),1,fil) != 1) goto corrupt;
@ -392,11 +391,11 @@ int loadplayer(int spot)
kclose(fil); kclose(fil);
if (g_player[myconnectindex].ps.over_shoulder_on != 0) if (g_player[myconnectindex].ps->over_shoulder_on != 0)
{ {
cameradist = 0; cameradist = 0;
cameraclock = 0; cameraclock = 0;
g_player[myconnectindex].ps.over_shoulder_on = 1; g_player[myconnectindex].ps->over_shoulder_on = 1;
} }
screenpeek = myconnectindex; screenpeek = myconnectindex;
@ -413,14 +412,14 @@ int loadplayer(int spot)
playmusic(&map[(unsigned char)music_select].musicfn[0]); playmusic(&map[(unsigned char)music_select].musicfn[0]);
} }
g_player[myconnectindex].ps.gm = MODE_GAME; g_player[myconnectindex].ps->gm = MODE_GAME;
ud.recstat = 0; ud.recstat = 0;
if (g_player[myconnectindex].ps.jetpack_on) if (g_player[myconnectindex].ps->jetpack_on)
spritesound(DUKE_JETPACK_IDLE,g_player[myconnectindex].ps.i); spritesound(DUKE_JETPACK_IDLE,g_player[myconnectindex].ps->i);
restorepalette = 1; restorepalette = 1;
setpal(&g_player[myconnectindex].ps); setpal(g_player[myconnectindex].ps);
vscrn(); vscrn();
FX_SetReverb(0); FX_SetReverb(0);
@ -493,8 +492,8 @@ int loadplayer(int spot)
// clearbufbyte(playerquitflag,MAXPLAYERS,0x01010101); // clearbufbyte(playerquitflag,MAXPLAYERS,0x01010101);
for (i=0;i<MAXPLAYERS;i++) for (i=0;i<MAXPLAYERS;i++)
clearbufbyte(&g_player[i].playerquitflag,1,0x01010101); clearbufbyte(&g_player[i].playerquitflag,1,0x01010101);
resetmys(); resetmys();
@ -593,10 +592,9 @@ int saveplayer(int spot)
dfwrite(&nextspritestat[0],2,MAXSPRITES,fil); dfwrite(&nextspritestat[0],2,MAXSPRITES,fil);
dfwrite(&numcyclers,sizeof(numcyclers),1,fil); dfwrite(&numcyclers,sizeof(numcyclers),1,fil);
dfwrite(&cyclers[0][0],12,MAXCYCLERS,fil); dfwrite(&cyclers[0][0],12,MAXCYCLERS,fil);
for (i=0;i<MAXPLAYERS;i++) for (i=0;i<ud.multimode;i++)
dfwrite(&g_player[i].ps,sizeof(g_player[i].ps),1,fil); dfwrite(g_player[i].ps,sizeof(player_struct),1,fil);
for (i=0;i<MAXPLAYERS;i++) dfwrite(&g_PlayerSpawnPoints,sizeof(g_PlayerSpawnPoints),1,fil);
dfwrite(&g_player[i].po,sizeof(g_player[i].po),1,fil);
dfwrite(&numanimwalls,sizeof(numanimwalls),1,fil); dfwrite(&numanimwalls,sizeof(numanimwalls),1,fil);
dfwrite(&animwall,sizeof(animwall),1,fil); dfwrite(&animwall,sizeof(animwall),1,fil);
dfwrite(&msx[0],sizeof(long),sizeof(msx)/sizeof(long),fil); dfwrite(&msx[0],sizeof(long),sizeof(msx)/sizeof(long),fil);
@ -736,8 +734,8 @@ int saveplayer(int spot)
dfwrite(&connecthead,sizeof(connecthead),1,fil); dfwrite(&connecthead,sizeof(connecthead),1,fil);
dfwrite(connectpoint2,sizeof(connectpoint2),1,fil); dfwrite(connectpoint2,sizeof(connectpoint2),1,fil);
dfwrite(&numplayersprites,sizeof(numplayersprites),1,fil); dfwrite(&numplayersprites,sizeof(numplayersprites),1,fil);
for (i=0;i<MAXPLAYERS;i++) for (i=0;i<MAXPLAYERS;i++)
dfwrite((short *)&g_player[i].frags[0],sizeof(g_player[i].frags),1,fil); dfwrite((short *)&g_player[i].frags[0],sizeof(g_player[i].frags),1,fil);
dfwrite(&randomseed,sizeof(randomseed),1,fil); dfwrite(&randomseed,sizeof(randomseed),1,fil);
dfwrite(&global_random,sizeof(global_random),1,fil); dfwrite(&global_random,sizeof(global_random),1,fil);
@ -780,7 +778,7 @@ int saveplayer(int spot)
if (ud.multimode < 2) if (ud.multimode < 2)
{ {
strcpy(fta_quotes[122],"GAME SAVED"); strcpy(fta_quotes[122],"GAME SAVED");
FTA(122,&g_player[myconnectindex].ps); FTA(122,g_player[myconnectindex].ps);
} }
ready2send = 1; ready2send = 1;

View file

@ -192,7 +192,7 @@ int checkcursectnums(int sect)
{ {
int i; int i;
for (i=connecthead;i>=0;i=connectpoint2[i]) for (i=connecthead;i>=0;i=connectpoint2[i])
if (sprite[g_player[i].ps.i].sectnum == sect) return i; if (sprite[g_player[i].ps->i].sectnum == sect) return i;
return -1; return -1;
} }
@ -220,7 +220,7 @@ int findplayer(spritetype *s,long *d)
if (ud.multimode < 2) if (ud.multimode < 2)
{ {
*d = klabs(g_player[myconnectindex].ps.oposx-s->x) + klabs(g_player[myconnectindex].ps.oposy-s->y) + ((klabs(g_player[myconnectindex].ps.oposz-s->z+(28<<8)))>>4); *d = klabs(g_player[myconnectindex].ps->oposx-s->x) + klabs(g_player[myconnectindex].ps->oposy-s->y) + ((klabs(g_player[myconnectindex].ps->oposz-s->z+(28<<8)))>>4);
return myconnectindex; return myconnectindex;
} }
@ -229,8 +229,8 @@ int findplayer(spritetype *s,long *d)
for (j=connecthead;j>=0;j=connectpoint2[j]) for (j=connecthead;j>=0;j=connectpoint2[j])
{ {
x = klabs(g_player[j].ps.oposx-s->x) + klabs(g_player[j].ps.oposy-s->y) + ((klabs(g_player[j].ps.oposz-s->z+(28<<8)))>>4); x = klabs(g_player[j].ps->oposx-s->x) + klabs(g_player[j].ps->oposy-s->y) + ((klabs(g_player[j].ps->oposz-s->z+(28<<8)))>>4);
if (x < closest && sprite[g_player[j].ps.i].extra > 0) if (x < closest && sprite[g_player[j].ps->i].extra > 0)
{ {
closest_player = j; closest_player = j;
closest = x; closest = x;
@ -250,9 +250,9 @@ int findotherplayer(int p,long *d)
closest_player = p; closest_player = p;
for (j=connecthead;j>=0;j=connectpoint2[j]) for (j=connecthead;j>=0;j=connectpoint2[j])
if (p != j && sprite[g_player[j].ps.i].extra > 0) if (p != j && sprite[g_player[j].ps->i].extra > 0)
{ {
x = klabs(g_player[j].ps.oposx-g_player[p].ps.posx) + klabs(g_player[j].ps.oposy-g_player[p].ps.posy) + (klabs(g_player[j].ps.oposz-g_player[p].ps.posz)>>4); x = klabs(g_player[j].ps->oposx-g_player[p].ps->posx) + klabs(g_player[j].ps->oposy-g_player[p].ps->posy) + (klabs(g_player[j].ps->oposz-g_player[p].ps->posz)>>4);
if (x < closest) if (x < closest)
{ {
@ -306,17 +306,17 @@ void doanimations(void)
if (animateptr[i] == &sector[animatesect[i]].floorz) if (animateptr[i] == &sector[animatesect[i]].floorz)
{ {
for (p=connecthead;p>=0;p=connectpoint2[p]) for (p=connecthead;p>=0;p=connectpoint2[p])
if (g_player[p].ps.cursectnum == dasect) if (g_player[p].ps->cursectnum == dasect)
if ((sector[dasect].floorz-g_player[p].ps.posz) < (64<<8)) if ((sector[dasect].floorz-g_player[p].ps->posz) < (64<<8))
if (sprite[g_player[p].ps.i].owner >= 0) if (sprite[g_player[p].ps->i].owner >= 0)
{ {
g_player[p].ps.posz += v; g_player[p].ps->posz += v;
g_player[p].ps.poszv = 0; g_player[p].ps->poszv = 0;
if (p == myconnectindex) if (p == myconnectindex)
{ {
myz += v; myz += v;
myzvel = 0; myzvel = 0;
myzbak[((movefifoplc-1)&(MOVEFIFOSIZ-1))] = g_player[p].ps.posz; myzbak[((movefifoplc-1)&(MOVEFIFOSIZ-1))] = g_player[p].ps->posz;
} }
} }
@ -389,10 +389,10 @@ void animatecamsprite(void)
{ {
T1 = 0; T1 = 0;
if (g_player[screenpeek].ps.newowner >= 0) if (g_player[screenpeek].ps->newowner >= 0)
OW = g_player[screenpeek].ps.newowner; OW = g_player[screenpeek].ps->newowner;
else if (OW >= 0 && dist(&sprite[g_player[screenpeek].ps.i],&sprite[i]) < 2048) else if (OW >= 0 && dist(&sprite[g_player[screenpeek].ps->i],&sprite[i]) < 2048)
{ {
if (waloff[TILE_VIEWSCR] == 0) if (waloff[TILE_VIEWSCR] == 0)
allocatepermanenttile(TILE_VIEWSCR,tilesizx[PN],tilesizy[PN]); allocatepermanenttile(TILE_VIEWSCR,tilesizx[PN],tilesizy[PN]);
@ -1033,8 +1033,8 @@ void operateactivators(int low,int snum)
if (snum >= 0) if (snum >= 0)
{ {
if (sector[SECT].lotag&16384) if (sector[SECT].lotag&16384)
FTA(4,&g_player[snum].ps); FTA(4,g_player[snum].ps);
else FTA(8,&g_player[snum].ps); else FTA(8,g_player[snum].ps);
} }
} }
else else
@ -1199,35 +1199,35 @@ int checkhitswitch(int snum,long w,int switchtype)
break; break;
case ACCESSSWITCH__STATIC: case ACCESSSWITCH__STATIC:
case ACCESSSWITCH2__STATIC: case ACCESSSWITCH2__STATIC:
if (g_player[snum].ps.access_incs == 0) if (g_player[snum].ps->access_incs == 0)
{ {
if (switchpal == 0) if (switchpal == 0)
{ {
if ((g_player[snum].ps.got_access&1)) if ((g_player[snum].ps->got_access&1))
g_player[snum].ps.access_incs = 1; g_player[snum].ps->access_incs = 1;
else FTA(70,&g_player[snum].ps); else FTA(70,g_player[snum].ps);
} }
else if (switchpal == 21) else if (switchpal == 21)
{ {
if (g_player[snum].ps.got_access&2) if (g_player[snum].ps->got_access&2)
g_player[snum].ps.access_incs = 1; g_player[snum].ps->access_incs = 1;
else FTA(71,&g_player[snum].ps); else FTA(71,g_player[snum].ps);
} }
else if (switchpal == 23) else if (switchpal == 23)
{ {
if (g_player[snum].ps.got_access&4) if (g_player[snum].ps->got_access&4)
g_player[snum].ps.access_incs = 1; g_player[snum].ps->access_incs = 1;
else FTA(72,&g_player[snum].ps); else FTA(72,g_player[snum].ps);
} }
if (g_player[snum].ps.access_incs == 1) if (g_player[snum].ps->access_incs == 1)
{ {
if (switchtype == 0) if (switchtype == 0)
g_player[snum].ps.access_wallnum = w; g_player[snum].ps->access_wallnum = w;
else else
g_player[snum].ps.access_spritenum = w; g_player[snum].ps->access_spritenum = w;
} }
return 0; return 0;
@ -1417,7 +1417,7 @@ int checkhitswitch(int snum,long w,int switchtype)
if (lotag == (short) 65535) if (lotag == (short) 65535)
{ {
g_player[myconnectindex].ps.gm = MODE_EOL; g_player[myconnectindex].ps->gm = MODE_EOL;
if (ud.from_bonus) if (ud.from_bonus)
{ {
ud.level_number = ud.from_bonus; ud.level_number = ud.from_bonus;
@ -1480,17 +1480,17 @@ int checkhitswitch(int snum,long w,int switchtype)
if (picnum == ALIENSWITCH || picnum == ALIENSWITCH+1) if (picnum == ALIENSWITCH || picnum == ALIENSWITCH+1)
{ {
if (switchtype == 1) if (switchtype == 1)
xyzsound(ALIEN_SWITCH1,w,sx,sy,g_player[snum].ps.posz); xyzsound(ALIEN_SWITCH1,w,sx,sy,g_player[snum].ps->posz);
else xyzsound(ALIEN_SWITCH1,g_player[snum].ps.i,sx,sy,g_player[snum].ps.posz); else xyzsound(ALIEN_SWITCH1,g_player[snum].ps->i,sx,sy,g_player[snum].ps->posz);
} }
else else
{ {
if (switchtype == 1) if (switchtype == 1)
xyzsound(SWITCH_ON,w,sx,sy,g_player[snum].ps.posz); xyzsound(SWITCH_ON,w,sx,sy,g_player[snum].ps->posz);
else xyzsound(SWITCH_ON,g_player[snum].ps.i,sx,sy,g_player[snum].ps.posz); else xyzsound(SWITCH_ON,g_player[snum].ps->i,sx,sy,g_player[snum].ps->posz);
} }
if (numdips != correctdips) break; if (numdips != correctdips) break;
xyzsound(END_OF_LEVEL_WARN,g_player[snum].ps.i,sx,sy,g_player[snum].ps.posz); xyzsound(END_OF_LEVEL_WARN,g_player[snum].ps->i,sx,sy,g_player[snum].ps->posz);
} }
case DIPSWITCH2__STATIC: case DIPSWITCH2__STATIC:
//case DIPSWITCH2+1: //case DIPSWITCH2+1:
@ -1548,11 +1548,11 @@ int checkhitswitch(int snum,long w,int switchtype)
case 25: case 25:
hittype[x].temp_data[4] = !hittype[x].temp_data[4]; hittype[x].temp_data[4] = !hittype[x].temp_data[4];
if (hittype[x].temp_data[4]) if (hittype[x].temp_data[4])
FTA(15,&g_player[snum].ps); FTA(15,g_player[snum].ps);
else FTA(2,&g_player[snum].ps); else FTA(2,g_player[snum].ps);
break; break;
case 21: case 21:
FTA(2,&g_player[screenpeek].ps); FTA(2,g_player[screenpeek].ps);
break; break;
} }
} }
@ -1560,7 +1560,7 @@ int checkhitswitch(int snum,long w,int switchtype)
} }
operateactivators(lotag,snum); operateactivators(lotag,snum);
operateforcefields(g_player[snum].ps.i,lotag); operateforcefields(g_player[snum].ps->i,lotag);
operatemasterswitches(lotag); operatemasterswitches(lotag);
if (picnum == DIPSWITCH || picnum == DIPSWITCH+1 || if (picnum == DIPSWITCH || picnum == DIPSWITCH+1 ||
@ -1570,14 +1570,14 @@ int checkhitswitch(int snum,long w,int switchtype)
if (hitag == 0 && isadoorwall(picnum) == 0) if (hitag == 0 && isadoorwall(picnum) == 0)
{ {
if (switchtype == 1) if (switchtype == 1)
xyzsound(SWITCH_ON,w,sx,sy,g_player[snum].ps.posz); xyzsound(SWITCH_ON,w,sx,sy,g_player[snum].ps->posz);
else xyzsound(SWITCH_ON,g_player[snum].ps.i,sx,sy,g_player[snum].ps.posz); else xyzsound(SWITCH_ON,g_player[snum].ps->i,sx,sy,g_player[snum].ps->posz);
} }
else if (hitag != 0) else if (hitag != 0)
{ {
if (switchtype == 1 && (soundm[hitag]&4) == 0) if (switchtype == 1 && (soundm[hitag]&4) == 0)
xyzsound(hitag,w,sx,sy,g_player[snum].ps.posz); xyzsound(hitag,w,sx,sy,g_player[snum].ps->posz);
else spritesound(hitag,g_player[snum].ps.i); else spritesound(hitag,g_player[snum].ps->i);
} }
return 1; return 1;
@ -1705,7 +1705,7 @@ void checkhitwall(int spr,int dawallnum,long x,long y,long z,int atwith)
if (wal->nextwall >= 0) if (wal->nextwall >= 0)
wall[wal->nextwall].cstat = 0; wall[wal->nextwall].cstat = 0;
i = EGS(sn,x,y,z,SECTOREFFECTOR,0,0,0,g_player[0].ps.ang,0,0,spr,3); i = EGS(sn,x,y,z,SECTOREFFECTOR,0,0,0,g_player[0].ps->ang,0,0,spr,3);
SLT = 128; SLT = 128;
T2 = 5; T2 = 5;
T3 = dawallnum; T3 = dawallnum;
@ -1954,8 +1954,8 @@ int checkhitceiling(int sn)
case TECHLIGHT2__STATIC: case TECHLIGHT2__STATIC:
case TECHLIGHT4__STATIC: case TECHLIGHT4__STATIC:
ceilingglass(g_player[myconnectindex].ps.i,sn,10); ceilingglass(g_player[myconnectindex].ps->i,sn,10);
spritesound(GLASS_BREAKING,g_player[screenpeek].ps.i); spritesound(GLASS_BREAKING,g_player[screenpeek].ps->i);
if (sector[sn].ceilingpicnum == WALLLIGHT1) if (sector[sn].ceilingpicnum == WALLLIGHT1)
sector[sn].ceilingpicnum = WALLLIGHTBUST1; sector[sn].ceilingpicnum = WALLLIGHTBUST1;
@ -2414,7 +2414,7 @@ void checkhitsprite(int i,int sn)
j = sprite[sn].owner; j = sprite[sn].owner;
if (j >= 0 && sprite[j].picnum == APLAYER && PN != ROTATEGUN && PN != DRONE) if (j >= 0 && sprite[j].picnum == APLAYER && PN != ROTATEGUN && PN != DRONE)
if (g_player[sprite[j].yvel].ps.curr_weapon == SHOTGUN_WEAPON) if (g_player[sprite[j].yvel].ps->curr_weapon == SHOTGUN_WEAPON)
{ {
shoot(i,BLOODSPLAT3); shoot(i,BLOODSPLAT3);
shoot(i,BLOODSPLAT1); shoot(i,BLOODSPLAT1);
@ -2455,16 +2455,16 @@ void checkhitsprite(int i,int sn)
if (sprite[i].statnum == 10) if (sprite[i].statnum == 10)
{ {
p = sprite[i].yvel; p = sprite[i].yvel;
if (g_player[p].ps.newowner >= 0) if (g_player[p].ps->newowner >= 0)
{ {
g_player[p].ps.newowner = -1; g_player[p].ps->newowner = -1;
g_player[p].ps.posx = g_player[p].ps.oposx; g_player[p].ps->posx = g_player[p].ps->oposx;
g_player[p].ps.posy = g_player[p].ps.oposy; g_player[p].ps->posy = g_player[p].ps->oposy;
g_player[p].ps.posz = g_player[p].ps.oposz; g_player[p].ps->posz = g_player[p].ps->oposz;
g_player[p].ps.ang = g_player[p].ps.oang; g_player[p].ps->ang = g_player[p].ps->oang;
updatesector(g_player[p].ps.posx,g_player[p].ps.posy,&g_player[p].ps.cursectnum); updatesector(g_player[p].ps->posx,g_player[p].ps->posy,&g_player[p].ps->cursectnum);
setpal(&g_player[p].ps); setpal(g_player[p].ps);
j = headspritestat[1]; j = headspritestat[1];
while (j >= 0) while (j >= 0)
@ -2517,8 +2517,8 @@ void allignwarpelevators(void)
void sharedkeys(int snum) void sharedkeys(int snum)
{ {
int i, k, dainv; int i, k, dainv;
unsigned long sb_snum = g_player[snum].sync.bits, j; unsigned long sb_snum = g_player[snum].sync->bits, j;
player_struct *p = &g_player[snum].ps; player_struct *p = g_player[snum].ps;
if (p->cheat_phase == 1) return; if (p->cheat_phase == 1) return;
@ -2560,9 +2560,9 @@ void sharedkeys(int snum)
if ((sb_snum&(1<<22)) && p->quick_kick == 0) if ((sb_snum&(1<<22)) && p->quick_kick == 0)
if (p->curr_weapon != KNEE_WEAPON || p->kickback_pic == 0) if (p->curr_weapon != KNEE_WEAPON || p->kickback_pic == 0)
{ {
SetGameVarID(g_iReturnVarID,0,g_player[snum].ps.i,snum); SetGameVarID(g_iReturnVarID,0,g_player[snum].ps->i,snum);
OnEvent(EVENT_QUICKKICK,g_player[snum].ps.i,snum, -1); OnEvent(EVENT_QUICKKICK,g_player[snum].ps->i,snum, -1);
if (GetGameVarID(g_iReturnVarID,g_player[snum].ps.i,snum) == 0) if (GetGameVarID(g_iReturnVarID,g_player[snum].ps->i,snum) == 0)
{ {
p->quick_kick = 14; p->quick_kick = 14;
FTA(80,p); FTA(80,p);
@ -2602,9 +2602,9 @@ void sharedkeys(int snum)
if (sb_snum&(1<<30) && p->newowner == -1) // inventory button generates event for selected item if (sb_snum&(1<<30) && p->newowner == -1) // inventory button generates event for selected item
{ {
SetGameVarID(g_iReturnVarID,0,g_player[snum].ps.i,snum); SetGameVarID(g_iReturnVarID,0,g_player[snum].ps->i,snum);
OnEvent(EVENT_INVENTORY,g_player[snum].ps.i,snum, -1); OnEvent(EVENT_INVENTORY,g_player[snum].ps->i,snum, -1);
if (GetGameVarID(g_iReturnVarID,g_player[snum].ps.i,snum) == 0) if (GetGameVarID(g_iReturnVarID,g_player[snum].ps->i,snum) == 0)
{ {
switch (p->inven_icon) switch (p->inven_icon)
{ {
@ -2629,9 +2629,9 @@ void sharedkeys(int snum)
if (sb_snum&(1<<15)) if (sb_snum&(1<<15))
{ {
SetGameVarID(g_iReturnVarID,0,g_player[snum].ps.i,snum); SetGameVarID(g_iReturnVarID,0,g_player[snum].ps->i,snum);
OnEvent(EVENT_USENIGHTVISION,g_player[snum].ps.i,snum, -1); OnEvent(EVENT_USENIGHTVISION,g_player[snum].ps->i,snum, -1);
if (GetGameVarID(g_iReturnVarID,g_player[snum].ps.i,snum) == 0 if (GetGameVarID(g_iReturnVarID,g_player[snum].ps->i,snum) == 0
&& p->heat_amount > 0) && p->heat_amount > 0)
{ {
p->heat_on = !p->heat_on; p->heat_on = !p->heat_on;
@ -2644,9 +2644,9 @@ void sharedkeys(int snum)
if ((sb_snum&(1<<12))) if ((sb_snum&(1<<12)))
{ {
SetGameVarID(g_iReturnVarID,0,g_player[snum].ps.i,snum); SetGameVarID(g_iReturnVarID,0,g_player[snum].ps->i,snum);
OnEvent(EVENT_USESTEROIDS,g_player[snum].ps.i,snum, -1); OnEvent(EVENT_USESTEROIDS,g_player[snum].ps->i,snum, -1);
if (GetGameVarID(g_iReturnVarID,g_player[snum].ps.i,snum) == 0) if (GetGameVarID(g_iReturnVarID,g_player[snum].ps->i,snum) == 0)
{ {
if (p->steroids_amount == 400) if (p->steroids_amount == 400)
{ {
@ -2731,15 +2731,15 @@ CHECKINV1:
if (sb_snum&(1<<20)) // Inventory_Left if (sb_snum&(1<<20)) // Inventory_Left
{ {
SetGameVarID(g_iReturnVarID,dainv,g_player[snum].ps.i,snum); SetGameVarID(g_iReturnVarID,dainv,g_player[snum].ps->i,snum);
OnEvent(EVENT_INVENTORYLEFT,g_player[snum].ps.i,snum, -1); OnEvent(EVENT_INVENTORYLEFT,g_player[snum].ps->i,snum, -1);
dainv=GetGameVarID(g_iReturnVarID,g_player[snum].ps.i,snum); dainv=GetGameVarID(g_iReturnVarID,g_player[snum].ps->i,snum);
} }
if (sb_snum&(1<<27)) // Inventory_Right if (sb_snum&(1<<27)) // Inventory_Right
{ {
SetGameVarID(g_iReturnVarID,dainv,g_player[snum].ps.i,snum); SetGameVarID(g_iReturnVarID,dainv,g_player[snum].ps->i,snum);
OnEvent(EVENT_INVENTORYRIGHT,g_player[snum].ps.i,snum, -1); OnEvent(EVENT_INVENTORYRIGHT,g_player[snum].ps->i,snum, -1);
dainv=GetGameVarID(g_iReturnVarID,g_player[snum].ps.i,snum); dainv=GetGameVarID(g_iReturnVarID,g_player[snum].ps->i,snum);
} }
p->inven_icon = dainv; p->inven_icon = dainv;
@ -3054,9 +3054,9 @@ CHECKINV1:
if (p->holoduke_on == -1) if (p->holoduke_on == -1)
{ {
SetGameVarID(g_iReturnVarID,0,g_player[snum].ps.i,snum); SetGameVarID(g_iReturnVarID,0,g_player[snum].ps->i,snum);
OnEvent(EVENT_HOLODUKEON,g_player[snum].ps.i,snum, -1); OnEvent(EVENT_HOLODUKEON,g_player[snum].ps->i,snum, -1);
if (GetGameVarID(g_iReturnVarID,g_player[snum].ps.i,snum) == 0) if (GetGameVarID(g_iReturnVarID,g_player[snum].ps->i,snum) == 0)
{ {
if (p->holoduke_amount > 0) if (p->holoduke_amount > 0)
{ {
@ -3079,9 +3079,9 @@ CHECKINV1:
} }
else else
{ {
SetGameVarID(g_iReturnVarID,0,g_player[snum].ps.i,snum); SetGameVarID(g_iReturnVarID,0,g_player[snum].ps->i,snum);
OnEvent(EVENT_HOLODUKEOFF,g_player[snum].ps.i,snum, -1); OnEvent(EVENT_HOLODUKEOFF,g_player[snum].ps->i,snum, -1);
if (GetGameVarID(g_iReturnVarID,g_player[snum].ps.i,snum) == 0) if (GetGameVarID(g_iReturnVarID,g_player[snum].ps->i,snum) == 0)
{ {
spritesound(TELEPORTER,p->holoduke_on); spritesound(TELEPORTER,p->holoduke_on);
p->holoduke_on = -1; p->holoduke_on = -1;
@ -3092,9 +3092,9 @@ CHECKINV1:
if (sb_snum&(1<<16)) if (sb_snum&(1<<16))
{ {
SetGameVarID(g_iReturnVarID,0,g_player[snum].ps.i,snum); SetGameVarID(g_iReturnVarID,0,g_player[snum].ps->i,snum);
OnEvent(EVENT_USEMEDKIT,g_player[snum].ps.i,snum, -1); OnEvent(EVENT_USEMEDKIT,g_player[snum].ps->i,snum, -1);
if (GetGameVarID(g_iReturnVarID,g_player[snum].ps.i,snum) == 0) if (GetGameVarID(g_iReturnVarID,g_player[snum].ps->i,snum) == 0)
{ {
if (p->firstaid_amount > 0 && sprite[p->i].extra < max_player_health) if (p->firstaid_amount > 0 && sprite[p->i].extra < max_player_health)
{ {
@ -3119,9 +3119,9 @@ CHECKINV1:
if (sb_snum&(1<<25) && p->newowner == -1) if (sb_snum&(1<<25) && p->newowner == -1)
{ {
SetGameVarID(g_iReturnVarID,0,g_player[snum].ps.i,snum); SetGameVarID(g_iReturnVarID,0,g_player[snum].ps->i,snum);
OnEvent(EVENT_USEJETPACK,g_player[snum].ps.i,snum, -1); OnEvent(EVENT_USEJETPACK,g_player[snum].ps->i,snum, -1);
if (GetGameVarID(g_iReturnVarID,g_player[snum].ps.i,snum) == 0) if (GetGameVarID(g_iReturnVarID,g_player[snum].ps->i,snum) == 0)
{ {
if (p->jetpack_amount > 0) if (p->jetpack_amount > 0)
{ {
@ -3204,7 +3204,7 @@ static long hitawall(player_struct *p,short *hitw)
void checksectors(int snum) void checksectors(int snum)
{ {
long i = -1,oldz; long i = -1,oldz;
player_struct *p = &g_player[snum].ps; player_struct *p = g_player[snum].ps;
short j,hitscanwall; short j,hitscanwall;
switch (sector[p->cursectnum].lotag) switch (sector[p->cursectnum].lotag)
@ -3217,7 +3217,7 @@ void checksectors(int snum)
return; return;
case -1: case -1:
for (i=connecthead;i>=0;i=connectpoint2[i]) for (i=connecthead;i>=0;i=connectpoint2[i])
g_player[i].ps.gm = MODE_EOL; g_player[i].ps->gm = MODE_EOL;
sector[p->cursectnum].lotag = 0; sector[p->cursectnum].lotag = 0;
if (ud.from_bonus) if (ud.from_bonus)
{ {
@ -3253,33 +3253,33 @@ void checksectors(int snum)
if (p->gm&MODE_TYPE || sprite[p->i].extra <= 0) return; if (p->gm&MODE_TYPE || sprite[p->i].extra <= 0) return;
if ((g_player[snum].sync.bits&(1<<29))) if ((g_player[snum].sync->bits&(1<<29)))
{ {
SetGameVarID(g_iReturnVarID,0,p->i,snum); SetGameVarID(g_iReturnVarID,0,p->i,snum);
OnEvent(EVENT_USE, p->i, snum, -1); OnEvent(EVENT_USE, p->i, snum, -1);
if (GetGameVarID(g_iReturnVarID,p->i,snum) != 0) if (GetGameVarID(g_iReturnVarID,p->i,snum) != 0)
g_player[snum].sync.bits &= ~(1<<29); g_player[snum].sync->bits &= ~(1<<29);
} }
if (ud.cashman && g_player[snum].sync.bits&(1<<29)) if (ud.cashman && g_player[snum].sync->bits&(1<<29))
lotsofmoney(p->i,2); lotsofmoney(p->i,2);
if (p->newowner >= 0) if (p->newowner >= 0)
{ {
if (klabs(g_player[snum].sync.svel) > 768 || klabs(g_player[snum].sync.fvel) > 768) if (klabs(g_player[snum].sync->svel) > 768 || klabs(g_player[snum].sync->fvel) > 768)
{ {
i = -1; i = -1;
goto CLEARCAMERAS; goto CLEARCAMERAS;
} }
} }
if (!(g_player[snum].sync.bits&(1<<29)) && !(g_player[snum].sync.bits&(1<<31))) if (!(g_player[snum].sync->bits&(1<<29)) && !(g_player[snum].sync->bits&(1<<31)))
p->toggle_key_flag = 0; p->toggle_key_flag = 0;
else if (!p->toggle_key_flag) else if (!p->toggle_key_flag)
{ {
if ((g_player[snum].sync.bits&(1<<31))) if ((g_player[snum].sync->bits&(1<<31)))
{ {
if (p->newowner >= 0) if (p->newowner >= 0)
{ {
@ -3498,7 +3498,7 @@ CLEARCAMERAS:
} }
} }
if ((g_player[snum].sync.bits&(1<<29)) == 0) return; if ((g_player[snum].sync->bits&(1<<29)) == 0) return;
else if (p->newowner >= 0) else if (p->newowner >= 0)
{ {
i = -1; i = -1;

View file

@ -237,7 +237,7 @@ int loadsound(unsigned int num)
if (fp == -1) if (fp == -1)
{ {
// Bsprintf(fta_quotes[113],"Sound %s(#%d) not found.",sounds[num],num); // Bsprintf(fta_quotes[113],"Sound %s(#%d) not found.",sounds[num],num);
// FTA(113,&g_player[myconnectindex].ps); // FTA(113,g_player[myconnectindex].ps);
initprintf("Sound %s(#%d) not found.\n",sounds[num],num); initprintf("Sound %s(#%d) not found.\n",sounds[num],num);
return 0; return 0;
} }
@ -267,8 +267,8 @@ int xyzsound(int num,int i,long x,long y,long z)
ud.config.SoundToggle == 0 || ud.config.SoundToggle == 0 ||
Sound[num].num > 3 || Sound[num].num > 3 ||
FX_VoiceAvailable(soundpr[num]) == 0 || FX_VoiceAvailable(soundpr[num]) == 0 ||
(g_player[myconnectindex].ps.timebeforeexit > 0 && g_player[myconnectindex].ps.timebeforeexit <= 26*3) || (g_player[myconnectindex].ps->timebeforeexit > 0 && g_player[myconnectindex].ps->timebeforeexit <= 26*3) ||
g_player[myconnectindex].ps.gm&MODE_MENU) return -1; g_player[myconnectindex].ps->gm&MODE_MENU) return -1;
if (soundm[num]&128) if (soundm[num]&128)
{ {
@ -288,11 +288,11 @@ int xyzsound(int num,int i,long x,long y,long z)
return -1; return -1;
} }
cx = g_player[screenpeek].ps.oposx; cx = g_player[screenpeek].ps->oposx;
cy = g_player[screenpeek].ps.oposy; cy = g_player[screenpeek].ps->oposy;
cz = g_player[screenpeek].ps.oposz; cz = g_player[screenpeek].ps->oposz;
cs = g_player[screenpeek].ps.cursectnum; cs = g_player[screenpeek].ps->cursectnum;
ca = g_player[screenpeek].ps.ang+g_player[screenpeek].ps.look_ang; ca = g_player[screenpeek].ps->ang+g_player[screenpeek].ps->look_ang;
sndist = FindDistance3D((cx-x),(cy-y),(cz-z)>>4); sndist = FindDistance3D((cx-x),(cy-y),(cz-z)>>4);
@ -323,18 +323,18 @@ int xyzsound(int num,int i,long x,long y,long z)
case RPG_EXPLODE: case RPG_EXPLODE:
if (sndist > (6144)) if (sndist > (6144))
sndist = 6144; sndist = 6144;
if (sector[g_player[screenpeek].ps.cursectnum].lotag == 2) if (sector[g_player[screenpeek].ps->cursectnum].lotag == 2)
pitch -= 1024; pitch -= 1024;
break; break;
default: default:
if (sector[g_player[screenpeek].ps.cursectnum].lotag == 2 && (soundm[num]&4) == 0) if (sector[g_player[screenpeek].ps->cursectnum].lotag == 2 && (soundm[num]&4) == 0)
pitch = -768; pitch = -768;
if (sndist > 31444 && PN != MUSICANDSFX) if (sndist > 31444 && PN != MUSICANDSFX)
return -1; return -1;
break; break;
} }
if (g_player[screenpeek].ps.sound_pitch) pitch += g_player[screenpeek].ps.sound_pitch; if (g_player[screenpeek].ps->sound_pitch) pitch += g_player[screenpeek].ps->sound_pitch;
if (Sound[num].num > 0 && PN != MUSICANDSFX) if (Sound[num].num > 0 && PN != MUSICANDSFX)
{ {
@ -515,11 +515,11 @@ void pan3dsound(void)
if (ud.camerasprite == -1) if (ud.camerasprite == -1)
{ {
cx = g_player[screenpeek].ps.oposx; cx = g_player[screenpeek].ps->oposx;
cy = g_player[screenpeek].ps.oposy; cy = g_player[screenpeek].ps->oposy;
cz = g_player[screenpeek].ps.oposz; cz = g_player[screenpeek].ps->oposz;
cs = g_player[screenpeek].ps.cursectnum; cs = g_player[screenpeek].ps->cursectnum;
ca = g_player[screenpeek].ps.ang+g_player[screenpeek].ps.look_ang; ca = g_player[screenpeek].ps->ang+g_player[screenpeek].ps->look_ang;
} }
else else
{ {

View file

@ -748,7 +748,7 @@ int startwin_run(void)
settings.xdim3d = ud.config.ScreenWidth; settings.xdim3d = ud.config.ScreenWidth;
settings.ydim3d = ud.config.ScreenHeight; settings.ydim3d = ud.config.ScreenHeight;
settings.bpp3d = ud.config.ScreenBPP; settings.bpp3d = ud.config.ScreenBPP;
settings.forcesetup = ud.config.ForceSetup; settings.forcesetup = ud.config.ForceSetup;
settings.usemouse = ud.config.UseMouse; settings.usemouse = ud.config.UseMouse;
settings.usejoy = ud.config.UseJoystick; settings.usejoy = ud.config.UseJoystick;
settings.game = g_GameType; settings.game = g_GameType;