mirror of
https://github.com/ZDoom/raze-gles.git
synced 2024-12-30 13:21:04 +00:00
- made ps an array of player_struct like it originally was.
This commit is contained in:
parent
2fd2ad2212
commit
99161e2e4a
10 changed files with 77 additions and 96 deletions
|
@ -103,7 +103,7 @@ static int osdcmd_demo(CCmdFuncPtr parm)
|
||||||
return CCMD_OK;
|
return CCMD_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
//if (g_player[myconnectindex].ps->gm & MODE_GAME)
|
//if (ps[myconnectindex].gm & MODE_GAME)
|
||||||
//{
|
//{
|
||||||
// Printf("demo: Must not be in a game.\n");
|
// Printf("demo: Must not be in a game.\n");
|
||||||
// return CCMD_OK;
|
// return CCMD_OK;
|
||||||
|
|
|
@ -53,7 +53,7 @@
|
||||||
/* Notes
|
/* Notes
|
||||||
|
|
||||||
RedNukem has this for the toggle autorun command. Todo: Check what this is supposed to accomplish. The implementation makes no sense at all.
|
RedNukem has this for the toggle autorun command. Todo: Check what this is supposed to accomplish. The implementation makes no sense at all.
|
||||||
(!RRRA || (!g_player[myconnectindex].ps->on_motorcycle && !g_player[myconnectindex].ps->on_boat)))
|
(!RRRA || (!ps[myconnectindex].on_motorcycle && !ps[myconnectindex].on_boat)))
|
||||||
|
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -418,7 +418,7 @@ static void G_DrawOverheadMap(int32_t cposx, int32_t cposy, int32_t czoom, int16
|
||||||
{
|
{
|
||||||
if (ud.scrollmode && p == screenpeek) continue;
|
if (ud.scrollmode && p == screenpeek) continue;
|
||||||
|
|
||||||
auto const pPlayer = g_player[p].ps;
|
auto const pPlayer = &ps[p];
|
||||||
auto const pSprite = (uspriteptr_t)&sprite[pPlayer->i];
|
auto const pSprite = (uspriteptr_t)&sprite[pPlayer->i];
|
||||||
|
|
||||||
ox = pSprite->x - cposx;
|
ox = pSprite->x - cposx;
|
||||||
|
|
|
@ -295,15 +295,7 @@ void stopinterpolation(int* posptr);
|
||||||
void dointerpolations(int smoothratio);
|
void dointerpolations(int smoothratio);
|
||||||
|
|
||||||
|
|
||||||
// Hack struct to allow old code to access the EDuke-style player data without changing it.
|
extern player_struct ps[MAXPLAYERS];
|
||||||
struct psaccess
|
|
||||||
{
|
|
||||||
struct player_struct& operator[](int index)
|
|
||||||
{
|
|
||||||
return *g_player[index].ps;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
extern psaccess ps;
|
|
||||||
|
|
||||||
|
|
||||||
extern int spriteqamount;
|
extern int spriteqamount;
|
||||||
|
|
|
@ -48,7 +48,6 @@ enum gamemode_t {
|
||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
struct player_struct *ps;
|
|
||||||
input_t *input;
|
input_t *input;
|
||||||
|
|
||||||
bool horizRecenter;
|
bool horizRecenter;
|
||||||
|
|
|
@ -3397,11 +3397,11 @@ void processinput_r(int snum)
|
||||||
g_player[snum].horizAngleAdjust = 0;
|
g_player[snum].horizAngleAdjust = 0;
|
||||||
g_player[snum].horizSkew = 0;
|
g_player[snum].horizSkew = 0;
|
||||||
|
|
||||||
sb_snum = g_player[snum].input->bits;// sync[snum].bits;
|
sb_snum = PlayerInputBits(snum, SKB_ALL);
|
||||||
|
|
||||||
auto sb_fvel = g_player[snum].input->fvel; // TRANSITIONAL
|
auto sb_fvel = PlayerInputForwardVel(snum);
|
||||||
auto sb_svel = g_player[snum].input->svel;
|
auto sb_svel = PlayerInputSideVel(snum);
|
||||||
auto sb_avel = g_player[snum].input->q16avel;
|
auto sb_avel = PlayerInputAngVel(snum);
|
||||||
|
|
||||||
psect = p->cursectnum;
|
psect = p->cursectnum;
|
||||||
if (p->OnMotorcycle && s->extra > 0)
|
if (p->OnMotorcycle && s->extra > 0)
|
||||||
|
|
|
@ -76,13 +76,14 @@ int32_t actor_tog;
|
||||||
static int32_t nonsharedtimer;
|
static int32_t nonsharedtimer;
|
||||||
weaponhit hittype[MAXSPRITES];
|
weaponhit hittype[MAXSPRITES];
|
||||||
ActorInfo actorinfo[MAXTILES];
|
ActorInfo actorinfo[MAXTILES];
|
||||||
|
player_struct ps[MAXPLAYERS];
|
||||||
|
|
||||||
static void gameTimerHandler(void)
|
static void gameTimerHandler(void)
|
||||||
{
|
{
|
||||||
S_Update();
|
S_Update();
|
||||||
|
|
||||||
// we need CONTROL_GetInput in order to pick up joystick button presses
|
// we need CONTROL_GetInput in order to pick up joystick button presses
|
||||||
if (!(g_player[myconnectindex].ps->gm & MODE_GAME))
|
if (!(ps[myconnectindex].gm & MODE_GAME))
|
||||||
{
|
{
|
||||||
ControlInfo noshareinfo;
|
ControlInfo noshareinfo;
|
||||||
CONTROL_GetInput(&noshareinfo);
|
CONTROL_GetInput(&noshareinfo);
|
||||||
|
@ -112,7 +113,7 @@ void G_HandleLocalKeys(void)
|
||||||
CONTROL_GetInput(&noshareinfo);
|
CONTROL_GetInput(&noshareinfo);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!ALT_IS_PRESSED && ud.overhead_on == 0 && (g_player[myconnectindex].ps->gm & MODE_TYPE) == 0)
|
if (!ALT_IS_PRESSED && ud.overhead_on == 0 && (ps[myconnectindex].gm & MODE_TYPE) == 0)
|
||||||
{
|
{
|
||||||
if (buttonMap.ButtonDown(gamefunc_Enlarge_Screen))
|
if (buttonMap.ButtonDown(gamefunc_Enlarge_Screen))
|
||||||
{
|
{
|
||||||
|
@ -149,7 +150,7 @@ void G_HandleLocalKeys(void)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((g_player[myconnectindex].ps->gm&(MODE_MENU|MODE_TYPE)) || System_WantGuiCapture())
|
if ((ps[myconnectindex].gm&(MODE_MENU|MODE_TYPE)) || System_WantGuiCapture())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (buttonMap.ButtonDown(gamefunc_See_Coop_View) && (ud.coop || ud.recstat == 2))
|
if (buttonMap.ButtonDown(gamefunc_See_Coop_View) && (ud.coop || ud.recstat == 2))
|
||||||
|
@ -163,14 +164,14 @@ void G_HandleLocalKeys(void)
|
||||||
{
|
{
|
||||||
buttonMap.ClearButton(gamefunc_Show_Opponents_Weapon);
|
buttonMap.ClearButton(gamefunc_Show_Opponents_Weapon);
|
||||||
ud.ShowOpponentWeapons = ud.showweapons = 1-ud.showweapons;
|
ud.ShowOpponentWeapons = ud.showweapons = 1-ud.showweapons;
|
||||||
FTA(QUOTE_WEAPON_MODE_OFF-ud.showweapons,g_player[screenpeek].ps);
|
FTA(QUOTE_WEAPON_MODE_OFF-ud.showweapons,&ps[screenpeek]);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (buttonMap.ButtonDown(gamefunc_Toggle_Crosshair))
|
if (buttonMap.ButtonDown(gamefunc_Toggle_Crosshair))
|
||||||
{
|
{
|
||||||
buttonMap.ClearButton(gamefunc_Toggle_Crosshair);
|
buttonMap.ClearButton(gamefunc_Toggle_Crosshair);
|
||||||
cl_crosshair = !cl_crosshair;
|
cl_crosshair = !cl_crosshair;
|
||||||
FTA(QUOTE_CROSSHAIR_OFF-cl_crosshair,g_player[screenpeek].ps);
|
FTA(QUOTE_CROSSHAIR_OFF-cl_crosshair,&ps[screenpeek]);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ud.overhead_on && buttonMap.ButtonDown(gamefunc_Map_Follow_Mode))
|
if (ud.overhead_on && buttonMap.ButtonDown(gamefunc_Map_Follow_Mode))
|
||||||
|
@ -179,11 +180,11 @@ void G_HandleLocalKeys(void)
|
||||||
ud.scrollmode = 1-ud.scrollmode;
|
ud.scrollmode = 1-ud.scrollmode;
|
||||||
if (ud.scrollmode)
|
if (ud.scrollmode)
|
||||||
{
|
{
|
||||||
ud.folx = g_player[screenpeek].ps->oposx;
|
ud.folx = ps[screenpeek].oposx;
|
||||||
ud.foly = g_player[screenpeek].ps->oposy;
|
ud.foly = ps[screenpeek].oposy;
|
||||||
ud.fola = fix16_to_int(g_player[screenpeek].ps->oq16ang);
|
ud.fola = fix16_to_int(ps[screenpeek].oq16ang);
|
||||||
}
|
}
|
||||||
FTA(QUOTE_MAP_FOLLOW_OFF+ud.scrollmode,g_player[myconnectindex].ps);
|
FTA(QUOTE_MAP_FOLLOW_OFF+ud.scrollmode,&ps[myconnectindex]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -223,14 +224,14 @@ void G_HandleLocalKeys(void)
|
||||||
{
|
{
|
||||||
buttonMap.ClearButton(gamefunc_Third_Person_View);
|
buttonMap.ClearButton(gamefunc_Third_Person_View);
|
||||||
|
|
||||||
if (!isRRRA() || (!g_player[myconnectindex].ps->OnMotorcycle && !g_player[myconnectindex].ps->OnBoat))
|
if (!isRRRA() || (!ps[myconnectindex].OnMotorcycle && !ps[myconnectindex].OnBoat))
|
||||||
{
|
{
|
||||||
g_player[myconnectindex].ps->over_shoulder_on = !g_player[myconnectindex].ps->over_shoulder_on;
|
ps[myconnectindex].over_shoulder_on = !ps[myconnectindex].over_shoulder_on;
|
||||||
|
|
||||||
cameradist = 0;
|
cameradist = 0;
|
||||||
cameraclock = (int32_t) totalclock;
|
cameraclock = (int32_t) totalclock;
|
||||||
|
|
||||||
FTA(QUOTE_VIEW_MODE_OFF + g_player[myconnectindex].ps->over_shoulder_on, g_player[myconnectindex].ps);
|
FTA(QUOTE_VIEW_MODE_OFF + ps[myconnectindex].over_shoulder_on, &ps[myconnectindex]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -240,17 +241,17 @@ void G_HandleLocalKeys(void)
|
||||||
nonsharedtimer += timerOffset;
|
nonsharedtimer += timerOffset;
|
||||||
|
|
||||||
if (buttonMap.ButtonDown(gamefunc_Enlarge_Screen))
|
if (buttonMap.ButtonDown(gamefunc_Enlarge_Screen))
|
||||||
g_player[myconnectindex].ps->zoom += mulscale6(timerOffset, max<int>(g_player[myconnectindex].ps->zoom, 256));
|
ps[myconnectindex].zoom += mulscale6(timerOffset, max<int>(ps[myconnectindex].zoom, 256));
|
||||||
|
|
||||||
if (buttonMap.ButtonDown(gamefunc_Shrink_Screen))
|
if (buttonMap.ButtonDown(gamefunc_Shrink_Screen))
|
||||||
g_player[myconnectindex].ps->zoom -= mulscale6(timerOffset, max<int>(g_player[myconnectindex].ps->zoom, 256));
|
ps[myconnectindex].zoom -= mulscale6(timerOffset, max<int>(ps[myconnectindex].zoom, 256));
|
||||||
|
|
||||||
g_player[myconnectindex].ps->zoom = clamp(g_player[myconnectindex].ps->zoom, 48, 2048);
|
ps[myconnectindex].zoom = clamp(ps[myconnectindex].zoom, 48, 2048);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#if 0 // fixme: We should not query Esc here, this needs to be done differently
|
#if 0 // fixme: We should not query Esc here, this needs to be done differently
|
||||||
if (I_EscapeTrigger() && ud.overhead_on && g_player[myconnectindex].ps->newowner == -1)
|
if (I_EscapeTrigger() && ud.overhead_on && ps[myconnectindex].newowner == -1)
|
||||||
{
|
{
|
||||||
I_EscapeTriggerClear();
|
I_EscapeTriggerClear();
|
||||||
ud.last_overhead = ud.overhead_on;
|
ud.last_overhead = ud.overhead_on;
|
||||||
|
@ -286,7 +287,6 @@ static void G_Cleanup(void)
|
||||||
|
|
||||||
for (i=MAXPLAYERS-1; i>=0; i--)
|
for (i=MAXPLAYERS-1; i>=0; i--)
|
||||||
{
|
{
|
||||||
Xfree(g_player[i].ps);
|
|
||||||
Xfree(g_player[i].input);
|
Xfree(g_player[i].input);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -413,11 +413,11 @@ static void G_Startup(void)
|
||||||
|
|
||||||
static void P_SetupMiscInputSettings(void)
|
static void P_SetupMiscInputSettings(void)
|
||||||
{
|
{
|
||||||
struct player_struct *ps = g_player[myconnectindex].ps;
|
struct player_struct *pp = &ps[myconnectindex];
|
||||||
|
|
||||||
ps->aim_mode = in_mousemode;
|
pp->aim_mode = in_mousemode;
|
||||||
ps->auto_aim = cl_autoaim;
|
pp->auto_aim = cl_autoaim;
|
||||||
ps->weaponswitch = cl_weaponswitch;
|
pp->weaponswitch = cl_weaponswitch;
|
||||||
}
|
}
|
||||||
|
|
||||||
void G_UpdatePlayerFromMenu(void)
|
void G_UpdatePlayerFromMenu(void)
|
||||||
|
@ -428,25 +428,25 @@ void G_UpdatePlayerFromMenu(void)
|
||||||
if (numplayers > 1)
|
if (numplayers > 1)
|
||||||
{
|
{
|
||||||
//Net_SendClientInfo();
|
//Net_SendClientInfo();
|
||||||
if (sprite[g_player[myconnectindex].ps->i].picnum == TILE_APLAYER && sprite[g_player[myconnectindex].ps->i].pal != 1)
|
if (sprite[ps[myconnectindex].i].picnum == TILE_APLAYER && sprite[ps[myconnectindex].i].pal != 1)
|
||||||
sprite[g_player[myconnectindex].ps->i].pal = g_player[myconnectindex].pcolor;
|
sprite[ps[myconnectindex].i].pal = g_player[myconnectindex].pcolor;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
P_SetupMiscInputSettings();
|
P_SetupMiscInputSettings();
|
||||||
g_player[myconnectindex].ps->palookup = g_player[myconnectindex].pcolor = G_CheckPlayerColor(playercolor);
|
ps[myconnectindex].palookup = g_player[myconnectindex].pcolor = G_CheckPlayerColor(playercolor);
|
||||||
|
|
||||||
g_player[myconnectindex].pteam = playerteam;
|
g_player[myconnectindex].pteam = playerteam;
|
||||||
|
|
||||||
if (sprite[g_player[myconnectindex].ps->i].picnum == TILE_APLAYER && sprite[g_player[myconnectindex].ps->i].pal != 1)
|
if (sprite[ps[myconnectindex].i].picnum == TILE_APLAYER && sprite[ps[myconnectindex].i].pal != 1)
|
||||||
sprite[g_player[myconnectindex].ps->i].pal = g_player[myconnectindex].pcolor;
|
sprite[ps[myconnectindex].i].pal = g_player[myconnectindex].pcolor;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void G_BackToMenu(void)
|
void G_BackToMenu(void)
|
||||||
{
|
{
|
||||||
boardfilename[0] = 0;
|
boardfilename[0] = 0;
|
||||||
g_player[myconnectindex].ps->gm = 0;
|
ps[myconnectindex].gm = 0;
|
||||||
M_StartControlPanel(false);
|
M_StartControlPanel(false);
|
||||||
M_SetMenu(NAME_Mainmenu);
|
M_SetMenu(NAME_Mainmenu);
|
||||||
inputState.keyFlushChars();
|
inputState.keyFlushChars();
|
||||||
|
@ -454,8 +454,6 @@ void G_BackToMenu(void)
|
||||||
|
|
||||||
void G_MaybeAllocPlayer(int32_t pnum)
|
void G_MaybeAllocPlayer(int32_t pnum)
|
||||||
{
|
{
|
||||||
if (g_player[pnum].ps == NULL)
|
|
||||||
g_player[pnum].ps = (struct player_struct *)Xcalloc(1, sizeof(struct player_struct));
|
|
||||||
if (g_player[pnum].input == NULL)
|
if (g_player[pnum].input == NULL)
|
||||||
g_player[pnum].input = (input_t *)Xcalloc(1, sizeof(input_t));
|
g_player[pnum].input = (input_t *)Xcalloc(1, sizeof(input_t));
|
||||||
}
|
}
|
||||||
|
@ -554,7 +552,7 @@ int GameInterface::app_main()
|
||||||
|
|
||||||
checkcommandline();
|
checkcommandline();
|
||||||
|
|
||||||
g_player[0].ps->aim_mode = 1;
|
ps[0].aim_mode = 1;
|
||||||
ud.ShowOpponentWeapons = 0;
|
ud.ShowOpponentWeapons = 0;
|
||||||
ud.camerasprite = -1;
|
ud.camerasprite = -1;
|
||||||
ud.camera_time = 0;//4;
|
ud.camera_time = 0;//4;
|
||||||
|
@ -592,14 +590,14 @@ int GameInterface::app_main()
|
||||||
|
|
||||||
G_Startup(); // a bunch of stuff including compiling cons
|
G_Startup(); // a bunch of stuff including compiling cons
|
||||||
|
|
||||||
g_player[myconnectindex].ps->palette = BASEPAL;
|
ps[myconnectindex].palette = BASEPAL;
|
||||||
|
|
||||||
for (int i=1, j=numplayers; j<ud.multimode; j++)
|
for (int i=1, j=numplayers; j<ud.multimode; j++)
|
||||||
{
|
{
|
||||||
Bsprintf(g_player[j].user_name,"%s %d", GStrings("PLAYER"),j+1);
|
Bsprintf(g_player[j].user_name,"%s %d", GStrings("PLAYER"),j+1);
|
||||||
g_player[j].pteam = i;
|
g_player[j].pteam = i;
|
||||||
g_player[j].ps->weaponswitch = 3;
|
ps[j].weaponswitch = 3;
|
||||||
g_player[j].ps->auto_aim = 0;
|
ps[j].auto_aim = 0;
|
||||||
i = 1-i;
|
i = 1-i;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -649,14 +647,13 @@ int GameInterface::app_main()
|
||||||
|
|
||||||
void app_loop()
|
void app_loop()
|
||||||
{
|
{
|
||||||
auto &myplayer = g_player[myconnectindex].ps;
|
|
||||||
|
|
||||||
MAIN_LOOP_RESTART:
|
MAIN_LOOP_RESTART:
|
||||||
totalclock = 0;
|
totalclock = 0;
|
||||||
ototalclock = 0;
|
ototalclock = 0;
|
||||||
lockclock = 0;
|
lockclock = 0;
|
||||||
|
|
||||||
g_player[myconnectindex].ps->ftq = 0;
|
ps[myconnectindex].ftq = 0;
|
||||||
|
|
||||||
//if (ud.warp_on == 0)
|
//if (ud.warp_on == 0)
|
||||||
{
|
{
|
||||||
|
@ -693,15 +690,15 @@ MAIN_LOOP_RESTART:
|
||||||
P_SetupMiscInputSettings();
|
P_SetupMiscInputSettings();
|
||||||
g_player[myconnectindex].pteam = playerteam;
|
g_player[myconnectindex].pteam = playerteam;
|
||||||
|
|
||||||
if (playercolor) g_player[myconnectindex].ps->palookup = g_player[myconnectindex].pcolor = G_CheckPlayerColor(playercolor);
|
if (playercolor) ps[myconnectindex].palookup = g_player[myconnectindex].pcolor = G_CheckPlayerColor(playercolor);
|
||||||
else g_player[myconnectindex].ps->palookup = g_player[myconnectindex].pcolor;
|
else ps[myconnectindex].palookup = g_player[myconnectindex].pcolor;
|
||||||
|
|
||||||
inputState.ClearKeyStatus(sc_Pause); // JBF: I hate the pause key
|
inputState.ClearKeyStatus(sc_Pause); // JBF: I hate the pause key
|
||||||
|
|
||||||
do //main loop
|
do //main loop
|
||||||
{
|
{
|
||||||
handleevents();
|
handleevents();
|
||||||
if (g_player[myconnectindex].ps->gm == MODE_DEMO)
|
if (ps[myconnectindex].gm == MODE_DEMO)
|
||||||
{
|
{
|
||||||
M_ClearMenus();
|
M_ClearMenus();
|
||||||
goto MAIN_LOOP_RESTART;
|
goto MAIN_LOOP_RESTART;
|
||||||
|
@ -717,19 +714,19 @@ MAIN_LOOP_RESTART:
|
||||||
gameupdatetime.Reset();
|
gameupdatetime.Reset();
|
||||||
gameupdatetime.Clock();
|
gameupdatetime.Clock();
|
||||||
|
|
||||||
while ((!(g_player[myconnectindex].ps->gm & (MODE_MENU|MODE_DEMO))) && (int)(totalclock - ototalclock) >= TICSPERFRAME)
|
while ((!(ps[myconnectindex].gm & (MODE_MENU|MODE_DEMO))) && (int)(totalclock - ototalclock) >= TICSPERFRAME)
|
||||||
{
|
{
|
||||||
ototalclock += TICSPERFRAME;
|
ototalclock += TICSPERFRAME;
|
||||||
|
|
||||||
if (isRRRA() && g_player[myconnectindex].ps->OnMotorcycle)
|
if (isRRRA() && ps[myconnectindex].OnMotorcycle)
|
||||||
P_GetInputMotorcycle(myconnectindex);
|
P_GetInputMotorcycle(myconnectindex);
|
||||||
else if (isRRRA() && g_player[myconnectindex].ps->OnBoat)
|
else if (isRRRA() && ps[myconnectindex].OnBoat)
|
||||||
P_GetInputBoat(myconnectindex);
|
P_GetInputBoat(myconnectindex);
|
||||||
else
|
else
|
||||||
P_GetInput(myconnectindex);
|
P_GetInput(myconnectindex);
|
||||||
|
|
||||||
// this is where we fill the input_t struct that is actually processed by P_ProcessInput()
|
// this is where we fill the input_t struct that is actually processed by P_ProcessInput()
|
||||||
auto const pPlayer = g_player[myconnectindex].ps;
|
auto const pPlayer = &ps[myconnectindex];
|
||||||
auto const q16ang = fix16_to_int(pPlayer->q16ang);
|
auto const q16ang = fix16_to_int(pPlayer->q16ang);
|
||||||
auto& input = nextinput(myconnectindex);
|
auto& input = nextinput(myconnectindex);
|
||||||
|
|
||||||
|
@ -744,8 +741,8 @@ MAIN_LOOP_RESTART:
|
||||||
|
|
||||||
advancequeue(myconnectindex);
|
advancequeue(myconnectindex);
|
||||||
|
|
||||||
if (((!System_WantGuiCapture() && (g_player[myconnectindex].ps->gm&MODE_MENU) != MODE_MENU) || ud.recstat == 2 || (ud.multimode > 1)) &&
|
if (((!System_WantGuiCapture() && (ps[myconnectindex].gm&MODE_MENU) != MODE_MENU) || ud.recstat == 2 || (ud.multimode > 1)) &&
|
||||||
(g_player[myconnectindex].ps->gm&MODE_GAME))
|
(ps[myconnectindex].gm&MODE_GAME))
|
||||||
{
|
{
|
||||||
moveloop();
|
moveloop();
|
||||||
}
|
}
|
||||||
|
@ -754,7 +751,7 @@ MAIN_LOOP_RESTART:
|
||||||
gameUpdate = true;
|
gameUpdate = true;
|
||||||
gameupdatetime.Unclock();
|
gameupdatetime.Unclock();
|
||||||
|
|
||||||
if (g_player[myconnectindex].ps->gm & (MODE_EOL|MODE_RESTART))
|
if (ps[myconnectindex].gm & (MODE_EOL|MODE_RESTART))
|
||||||
{
|
{
|
||||||
switch (exitlevel())
|
switch (exitlevel())
|
||||||
{
|
{
|
||||||
|
@ -766,9 +763,9 @@ MAIN_LOOP_RESTART:
|
||||||
|
|
||||||
if (G_FPSLimit())
|
if (G_FPSLimit())
|
||||||
{
|
{
|
||||||
if (isRRRA() && g_player[myconnectindex].ps->OnMotorcycle)
|
if (isRRRA() && ps[myconnectindex].OnMotorcycle)
|
||||||
P_GetInputMotorcycle(myconnectindex);
|
P_GetInputMotorcycle(myconnectindex);
|
||||||
else if (isRRRA() && g_player[myconnectindex].ps->OnBoat)
|
else if (isRRRA() && ps[myconnectindex].OnBoat)
|
||||||
P_GetInputBoat(myconnectindex);
|
P_GetInputBoat(myconnectindex);
|
||||||
else
|
else
|
||||||
P_GetInput(myconnectindex);
|
P_GetInput(myconnectindex);
|
||||||
|
@ -783,7 +780,7 @@ MAIN_LOOP_RESTART:
|
||||||
videoNextPage();
|
videoNextPage();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (g_player[myconnectindex].ps->gm&MODE_DEMO)
|
if (ps[myconnectindex].gm&MODE_DEMO)
|
||||||
goto MAIN_LOOP_RESTART;
|
goto MAIN_LOOP_RESTART;
|
||||||
}
|
}
|
||||||
while (1);
|
while (1);
|
||||||
|
@ -800,8 +797,5 @@ void GameInterface::FreeGameData()
|
||||||
return new GameInterface;
|
return new GameInterface;
|
||||||
}
|
}
|
||||||
|
|
||||||
// access wrappers that alias old names to current data.
|
|
||||||
psaccess ps;
|
|
||||||
|
|
||||||
|
|
||||||
END_DUKE_NS
|
END_DUKE_NS
|
||||||
|
|
|
@ -58,7 +58,7 @@ enum inputlock_t
|
||||||
|
|
||||||
static int P_CheckLockedMovement(int const playerNum)
|
static int P_CheckLockedMovement(int const playerNum)
|
||||||
{
|
{
|
||||||
auto const pPlayer = g_player[playerNum].ps;
|
auto const pPlayer = &ps[playerNum];
|
||||||
|
|
||||||
if (pPlayer->on_crane >= 0)
|
if (pPlayer->on_crane >= 0)
|
||||||
return IL_NOMOVE|IL_NOANGLE;
|
return IL_NOMOVE|IL_NOANGLE;
|
||||||
|
@ -87,7 +87,7 @@ static double scaleAdjustmentToInterval(double x)
|
||||||
void P_GetInput(int const playerNum)
|
void P_GetInput(int const playerNum)
|
||||||
{
|
{
|
||||||
auto &thisPlayer = g_player[playerNum];
|
auto &thisPlayer = g_player[playerNum];
|
||||||
auto const pPlayer = thisPlayer.ps;
|
auto const pPlayer = &ps[playerNum];
|
||||||
ControlInfo info;
|
ControlInfo info;
|
||||||
|
|
||||||
auto const currentHiTicks = timerGetHiTicks();
|
auto const currentHiTicks = timerGetHiTicks();
|
||||||
|
@ -443,7 +443,7 @@ void P_GetInput(int const playerNum)
|
||||||
void P_GetInputMotorcycle(int playerNum)
|
void P_GetInputMotorcycle(int playerNum)
|
||||||
{
|
{
|
||||||
auto &thisPlayer = g_player[playerNum];
|
auto &thisPlayer = g_player[playerNum];
|
||||||
auto const pPlayer = thisPlayer.ps;
|
auto const pPlayer = &ps[playerNum];
|
||||||
ControlInfo info;
|
ControlInfo info;
|
||||||
|
|
||||||
if ((pPlayer->gm & (MODE_MENU|MODE_TYPE)) || (ud.pause_on && !inputState.GetKeyStatus(sc_Pause)))
|
if ((pPlayer->gm & (MODE_MENU|MODE_TYPE)) || (ud.pause_on && !inputState.GetKeyStatus(sc_Pause)))
|
||||||
|
@ -635,7 +635,7 @@ void P_GetInputMotorcycle(int playerNum)
|
||||||
void P_GetInputBoat(int playerNum)
|
void P_GetInputBoat(int playerNum)
|
||||||
{
|
{
|
||||||
auto &thisPlayer = g_player[playerNum];
|
auto &thisPlayer = g_player[playerNum];
|
||||||
auto const pPlayer = thisPlayer.ps;
|
auto const pPlayer = &ps[playerNum];
|
||||||
ControlInfo info;
|
ControlInfo info;
|
||||||
|
|
||||||
if ((pPlayer->gm & (MODE_MENU|MODE_TYPE)) || (ud.pause_on && !inputState.GetKeyStatus(sc_Pause)))
|
if ((pPlayer->gm & (MODE_MENU|MODE_TYPE)) || (ud.pause_on && !inputState.GetKeyStatus(sc_Pause)))
|
||||||
|
|
|
@ -142,9 +142,9 @@ int32_t G_LoadPlayer(const char *path)
|
||||||
if (status < 0 || h.numplayers != ud.multimode)
|
if (status < 0 || h.numplayers != ud.multimode)
|
||||||
{
|
{
|
||||||
if (status == -4 || status == -3 || status == 1)
|
if (status == -4 || status == -3 || status == 1)
|
||||||
FTA(QUOTE_SAVE_BAD_VERSION, g_player[myconnectindex].ps);
|
FTA(QUOTE_SAVE_BAD_VERSION, &ps[myconnectindex]);
|
||||||
else if (h.numplayers != ud.multimode)
|
else if (h.numplayers != ud.multimode)
|
||||||
FTA(QUOTE_SAVE_BAD_PLAYERS, g_player[myconnectindex].ps);
|
FTA(QUOTE_SAVE_BAD_PLAYERS, &ps[myconnectindex]);
|
||||||
|
|
||||||
ototalclock = totalclock;
|
ototalclock = totalclock;
|
||||||
ready2send = 1;
|
ready2send = 1;
|
||||||
|
@ -242,7 +242,7 @@ bool G_SavePlayer(FSaveGameNode *sv)
|
||||||
{
|
{
|
||||||
Printf("Saved: %s\n", fn.GetChars());
|
Printf("Saved: %s\n", fn.GetChars());
|
||||||
quoteMgr.InitializeQuote(QUOTE_RESERVED4, "Game Saved");
|
quoteMgr.InitializeQuote(QUOTE_RESERVED4, "Game Saved");
|
||||||
FTA(QUOTE_RESERVED4, g_player[myconnectindex].ps);
|
FTA(QUOTE_RESERVED4, &ps[myconnectindex]);
|
||||||
}
|
}
|
||||||
|
|
||||||
ready2send = 1;
|
ready2send = 1;
|
||||||
|
@ -260,16 +260,16 @@ bool GameInterface::LoadGame(FSaveGameNode* sv)
|
||||||
if (ud.multimode > 1)
|
if (ud.multimode > 1)
|
||||||
{
|
{
|
||||||
quoteMgr.InitializeQuote(QUOTE_RESERVED4, "Multiplayer Loading Not Yet Supported");
|
quoteMgr.InitializeQuote(QUOTE_RESERVED4, "Multiplayer Loading Not Yet Supported");
|
||||||
FTA(QUOTE_RESERVED4, g_player[myconnectindex].ps);
|
FTA(QUOTE_RESERVED4, &ps[myconnectindex]);
|
||||||
|
|
||||||
// g_player[myconnectindex].ps->gm = MODE_GAME;
|
// ps[myconnectindex].gm = MODE_GAME;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
int32_t c = G_LoadPlayer(sv->Filename);
|
int32_t c = G_LoadPlayer(sv->Filename);
|
||||||
if (c == 0)
|
if (c == 0)
|
||||||
g_player[myconnectindex].ps->gm = MODE_GAME;
|
ps[myconnectindex].gm = MODE_GAME;
|
||||||
return !c;
|
return !c;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -279,7 +279,7 @@ bool GameInterface::SaveGame(FSaveGameNode* sv)
|
||||||
if (ud.multimode > 1)
|
if (ud.multimode > 1)
|
||||||
{
|
{
|
||||||
quoteMgr.InitializeQuote(QUOTE_RESERVED4, "Multiplayer Saving Not Yet Supported");
|
quoteMgr.InitializeQuote(QUOTE_RESERVED4, "Multiplayer Saving Not Yet Supported");
|
||||||
FTA(QUOTE_RESERVED4, g_player[myconnectindex].ps);
|
FTA(QUOTE_RESERVED4, &ps[myconnectindex]);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -932,9 +932,6 @@ static void sv_postanimateptr()
|
||||||
static void sv_restsave()
|
static void sv_restsave()
|
||||||
{
|
{
|
||||||
uint8_t * mem = savegame_restdata;
|
uint8_t * mem = savegame_restdata;
|
||||||
struct player_struct dummy_ps;
|
|
||||||
|
|
||||||
Bmemset(&dummy_ps, 0, sizeof(struct player_struct));
|
|
||||||
|
|
||||||
#define CPDAT(ptr,sz) do { Bmemcpy(mem, ptr, sz), mem+=sz ; } while (0)
|
#define CPDAT(ptr,sz) do { Bmemcpy(mem, ptr, sz), mem+=sz ; } while (0)
|
||||||
for (int i = 0; i < MAXPLAYERS; i++)
|
for (int i = 0; i < MAXPLAYERS; i++)
|
||||||
|
@ -942,7 +939,7 @@ static void sv_restsave()
|
||||||
CPDAT(g_player[i].user_name, 32);
|
CPDAT(g_player[i].user_name, 32);
|
||||||
CPDAT(&g_player[i].pcolor, sizeof(g_player[0].pcolor));
|
CPDAT(&g_player[i].pcolor, sizeof(g_player[0].pcolor));
|
||||||
CPDAT(&g_player[i].pteam, sizeof(g_player[0].pteam));
|
CPDAT(&g_player[i].pteam, sizeof(g_player[0].pteam));
|
||||||
CPDAT(g_player[i].ps ? g_player[i].ps : &dummy_ps, sizeof(struct player_struct));
|
CPDAT(&ps[i], sizeof(struct player_struct));
|
||||||
}
|
}
|
||||||
|
|
||||||
Bassert((savegame_restdata + SVARDATALEN) - mem == 0);
|
Bassert((savegame_restdata + SVARDATALEN) - mem == 0);
|
||||||
|
@ -951,7 +948,6 @@ static void sv_restsave()
|
||||||
static void sv_restload()
|
static void sv_restload()
|
||||||
{
|
{
|
||||||
uint8_t * mem = savegame_restdata;
|
uint8_t * mem = savegame_restdata;
|
||||||
struct player_struct dummy_ps;
|
|
||||||
|
|
||||||
#define CPDAT(ptr,sz) Bmemcpy(ptr, mem, sz), mem+=sz
|
#define CPDAT(ptr,sz) Bmemcpy(ptr, mem, sz), mem+=sz
|
||||||
for (int i = 0; i < MAXPLAYERS; i++)
|
for (int i = 0; i < MAXPLAYERS; i++)
|
||||||
|
@ -959,12 +955,12 @@ static void sv_restload()
|
||||||
CPDAT(g_player[i].user_name, 32);
|
CPDAT(g_player[i].user_name, 32);
|
||||||
CPDAT(&g_player[i].pcolor, sizeof(g_player[0].pcolor));
|
CPDAT(&g_player[i].pcolor, sizeof(g_player[0].pcolor));
|
||||||
CPDAT(&g_player[i].pteam, sizeof(g_player[0].pteam));
|
CPDAT(&g_player[i].pteam, sizeof(g_player[0].pteam));
|
||||||
CPDAT(g_player[i].ps ? g_player[i].ps : &dummy_ps, sizeof(struct player_struct));
|
CPDAT(&ps[i], sizeof(struct player_struct));
|
||||||
}
|
}
|
||||||
#undef CPDAT
|
#undef CPDAT
|
||||||
|
|
||||||
if (g_player[myconnectindex].ps)
|
if (&ps[myconnectindex])
|
||||||
g_player[myconnectindex].ps->auto_aim = cl_autoaim;
|
ps[myconnectindex].auto_aim = cl_autoaim;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef DEBUGGINGAIDS
|
#ifdef DEBUGGINGAIDS
|
||||||
|
@ -1062,11 +1058,11 @@ static void postloadplayer(int32_t savegamep)
|
||||||
int32_t i;
|
int32_t i;
|
||||||
|
|
||||||
//1
|
//1
|
||||||
if (g_player[myconnectindex].ps->over_shoulder_on != 0)
|
if (ps[myconnectindex].over_shoulder_on != 0)
|
||||||
{
|
{
|
||||||
cameradist = 0;
|
cameradist = 0;
|
||||||
cameraclock = 0;
|
cameraclock = 0;
|
||||||
g_player[myconnectindex].ps->over_shoulder_on = 1;
|
ps[myconnectindex].over_shoulder_on = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
//2
|
//2
|
||||||
|
@ -1079,15 +1075,15 @@ static void postloadplayer(int32_t savegamep)
|
||||||
Mus_ResumeSaved();
|
Mus_ResumeSaved();
|
||||||
Mus_SetPaused(false);
|
Mus_SetPaused(false);
|
||||||
|
|
||||||
g_player[myconnectindex].ps->gm = MODE_GAME;
|
ps[myconnectindex].gm = MODE_GAME;
|
||||||
ud.recstat = 0;
|
ud.recstat = 0;
|
||||||
|
|
||||||
if (g_player[myconnectindex].ps->jetpack_on)
|
if (ps[myconnectindex].jetpack_on)
|
||||||
A_PlaySound(DUKE_JETPACK_IDLE, g_player[myconnectindex].ps->i);
|
A_PlaySound(DUKE_JETPACK_IDLE, ps[myconnectindex].i);
|
||||||
}
|
}
|
||||||
|
|
||||||
//3
|
//3
|
||||||
setpal(g_player[myconnectindex].ps);
|
setpal(&ps[myconnectindex]);
|
||||||
|
|
||||||
//4
|
//4
|
||||||
if (savegamep)
|
if (savegamep)
|
||||||
|
@ -1139,7 +1135,7 @@ static void postloadplayer(int32_t savegamep)
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
for (i=0; i<MAXPLAYERS; i++)
|
for (i=0; i<MAXPLAYERS; i++)
|
||||||
g_player[i].ps->drug_timer = 0;
|
ps[i].drug_timer = 0;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -144,7 +144,7 @@ static int osdcmd_spawn(CCmdFuncPtr parm)
|
||||||
int16_t set=0, idx;
|
int16_t set=0, idx;
|
||||||
vec3_t vect;
|
vec3_t vect;
|
||||||
|
|
||||||
if (numplayers > 1 || !(g_player[myconnectindex].ps->gm & MODE_GAME))
|
if (numplayers > 1 || !(ps[myconnectindex].gm & MODE_GAME))
|
||||||
{
|
{
|
||||||
Printf("spawn: Can't spawn sprites in multiplayer games or demos\n");
|
Printf("spawn: Can't spawn sprites in multiplayer games or demos\n");
|
||||||
return CCMD_OK;
|
return CCMD_OK;
|
||||||
|
@ -213,7 +213,7 @@ static int osdcmd_spawn(CCmdFuncPtr parm)
|
||||||
return CCMD_SHOWHELP;
|
return CCMD_SHOWHELP;
|
||||||
}
|
}
|
||||||
|
|
||||||
idx = A_Spawn(g_player[myconnectindex].ps->i, picnum);
|
idx = A_Spawn(ps[myconnectindex].i, picnum);
|
||||||
if (set & 1) sprite[idx].pal = (uint8_t)pal;
|
if (set & 1) sprite[idx].pal = (uint8_t)pal;
|
||||||
if (set & 2) sprite[idx].cstat = (int16_t)cstat;
|
if (set & 2) sprite[idx].cstat = (int16_t)cstat;
|
||||||
if (set & 4) sprite[idx].ang = ang;
|
if (set & 4) sprite[idx].ang = ang;
|
||||||
|
|
Loading…
Reference in a new issue