- minor cleanup

This commit is contained in:
Christoph Oelckers 2020-07-07 23:01:34 +02:00
parent ecddd8687c
commit 319e2e2745
9 changed files with 25 additions and 25 deletions

View file

@ -224,7 +224,7 @@ void GameInterface::MenuOpened()
screenpeek = myconnectindex;
}
auto& gm = g_player[myconnectindex].ps->gm;
auto& gm = ps[myconnectindex].gm;
if (gm & MODE_GAME)
{
gm |= MODE_MENU;
@ -258,7 +258,7 @@ void GameInterface::MenuSound(EMenuSounds snd)
void GameInterface::MenuClosed()
{
auto& gm = g_player[myconnectindex].ps->gm;
auto& gm = ps[myconnectindex].gm;
if (gm & MODE_GAME)
{
if (gm & MODE_MENU)
@ -282,7 +282,7 @@ void GameInterface::MenuClosed()
bool GameInterface::CanSave()
{
if (ud.recstat == 2) return false;
auto &myplayer = *g_player[myconnectindex].ps;
auto &myplayer = ps[myconnectindex];
if (sprite[myplayer.i].extra <= 0)
{
//P_DoQuote(QUOTE_SAVE_DEAD, &myplayer); // handled by the menu.
@ -358,7 +358,7 @@ void GameInterface::DrawCenteredTextScreen(const DVector2 &origin, const char *t
void GameInterface::QuitToTitle()
{
g_player[myconnectindex].ps->gm = MODE_DEMO;
ps[myconnectindex].gm = MODE_DEMO;
artClearMapArt();
}

View file

@ -76,17 +76,6 @@ extern int startrts(int lumpNum, int localPlayer);
extern void G_MaybeAllocPlayer(int32_t pnum);
static inline int32_t calc_smoothratio(ClockTicks totalclk, ClockTicks ototalclk)
{
if (!((ud.multimode < 2 && ((g_player[myconnectindex].ps->gm & MODE_MENU) == 0)) ||
ud.multimode > 1 || ud.recstat == 2) || ud.pause_on)
{
return 65536;
}
return CalcSmoothRatio(totalclk, ototalclk, REALGAMETICSPERSEC);
}
static inline void G_NewGame_EnterLevel(MapRecord *map, int skill)
{

View file

@ -145,7 +145,7 @@ void checkcommandline()
void gameexitfrommenu()
{
// MP scoreboard
if (playerswhenstarted > 1 && g_player[myconnectindex].ps->gm & MODE_GAME && !ud.coop)
if (playerswhenstarted > 1 && ps[myconnectindex].gm & MODE_GAME && !ud.coop)
{
dobonus(1);
}
@ -269,7 +269,7 @@ void FTA(int q, struct player_struct* p)
{
if (q == 13) p->ftq = q;
auto qu = quoteMgr.GetQuote(q);
if (p == g_player[screenpeek].ps && qu[0] != '\0')
if (p == &ps[screenpeek] && qu[0] != '\0')
{
if (q >= 70 && q <= 72 && hud_messages == 2)
{
@ -293,7 +293,7 @@ void FTA(int q, struct player_struct* p)
void drawbackground(void)
{
if ((g_player[myconnectindex].ps->gm & MODE_GAME) == 0 && ud.recstat != 2)
if ((ps[myconnectindex].gm & MODE_GAME) == 0 && ud.recstat != 2)
{
twod->ClearScreen();
auto tex = tileGetTexture(TILE_MENUSCREEN);

View file

@ -157,6 +157,17 @@ inline void SetPlayerPal(player_struct* p, PalEntry pe)
p->pals = pe;
}
inline int calc_smoothratio(ClockTicks totalclk, ClockTicks ototalclk)
{
if (!((ud.multimode < 2 && ((ps[myconnectindex].gm & MODE_MENU) == 0)) ||
ud.multimode > 1 || ud.recstat == 2) || ud.pause_on)
{
return 65536;
}
return CalcSmoothRatio(totalclk, ototalclk, REALGAMETICSPERSEC);
}
// These should be the only places converting between level numbers and volume/map pairs
constexpr inline int levelnum(int vol, int map)
{

View file

@ -936,7 +936,7 @@ int enterlevel(MapRecord *mi, int gamemode)
FX_StopAllSounds();
FX_SetReverb(0);
struct player_struct *const p = g_player[0].ps;
auto p = &ps[0];
/*

View file

@ -241,7 +241,7 @@ public:
void DrawHud(int snum, int style)
{
auto p = g_player[snum].ps;
auto p = &ps[snum];
BeginHUD(320, 200, 1.f, false);
if (style == 1)
{
@ -344,7 +344,7 @@ public:
void Statusbar(int snum)
{
auto p = g_player[snum].ps;
auto p = &ps[snum];
int h = tilesiz[TILE_BOTTOMSTATUSBAR].y;
int top = 200 - h;
BeginStatusBar(320, 200, h, true);

View file

@ -218,7 +218,7 @@ public:
void DrawHud(int snum, int style)
{
auto p = g_player[snum].ps;
auto p = &ps[snum];
BeginHUD(320, 200, 1.f, false);
if (style == 1)
{
@ -284,7 +284,7 @@ public:
void Statusbar(int snum)
{
auto p = g_player[snum].ps;
auto p = &ps[snum];
double h = tilesiz[BOTTOMSTATUSBAR].y * scale;
double top = 200 - h;
BeginStatusBar(320, 200, h, true);

View file

@ -333,7 +333,7 @@ void S_Update(void)
vec3_t* c;
int32_t ca, cs;
auto& gm = g_player[myconnectindex].ps->gm;
auto& gm = ps[myconnectindex].gm;
if (isRR() && !Mus_IsPlaying() && (gm && gm & MODE_GAME))
S_PlayRRMusic();

View file

@ -70,7 +70,7 @@ void clearfrags(void)
for (int i = 0; i < ud.multimode; i++)
{
playerdata_t *const pPlayerData = &g_player[i];
pPlayerData->ps->frag = pPlayerData->ps->fraggedself = 0;
ps[i].frag = ps[i].fraggedself = 0;
memset(pPlayerData->frags, 0, sizeof(pPlayerData->frags));
}
}