- SW: Rename Player[] array to PlayerArray[] and wrap its access.

This commit is contained in:
Mitchell Richters 2023-10-02 14:55:55 +11:00
parent 2327e08acb
commit 6a7eabd23f
30 changed files with 235 additions and 230 deletions

View file

@ -250,13 +250,13 @@ int DoActorPickClosePlayer(DSWActor* actor)
goto TARGETACTOR;
// Set initial target to Player 0
actor->user.targetActor = Player[0].GetActor();
actor->user.targetActor = getPlayer(0)->GetActor();
if (actor->user.Flags2 & (SPR2_DONT_TARGET_OWNER))
{
TRAVERSE_CONNECT(pnum)
{
pp = &Player[pnum];
pp = getPlayer(pnum);
if (GetOwner(actor) == pp->GetActor())
continue;
@ -270,7 +270,7 @@ int DoActorPickClosePlayer(DSWActor* actor)
// Set initial target to the closest player
TRAVERSE_CONNECT(pnum)
{
pp = &Player[pnum];
pp = getPlayer(pnum);
// Zombies don't target their masters!
if (actor->user.Flags2 & (SPR2_DONT_TARGET_OWNER))
@ -300,7 +300,7 @@ int DoActorPickClosePlayer(DSWActor* actor)
found = false;
TRAVERSE_CONNECT(pnum)
{
pp = &Player[pnum];
pp = getPlayer(pnum);
// Zombies don't target their masters!
if (actor->user.Flags2 & (SPR2_DONT_TARGET_OWNER))
@ -366,7 +366,7 @@ DSWActor* GetPlayerSpriteNum(DSWActor* actor)
TRAVERSE_CONNECT(pnum)
{
pp = &Player[pnum];
pp = getPlayer(pnum);
if (pp->GetActor() == actor->user.targetActor)
{

View file

@ -1012,7 +1012,7 @@ int DoBunnyQuickJump(DSWActor* actor)
int choose_snd;
static const int fagsnds[] = {DIGI_FAGRABBIT1,DIGI_FAGRABBIT2,DIGI_FAGRABBIT3};
if (pp == &Player[myconnectindex])
if (pp == getPlayer(myconnectindex))
{
choose_snd = StdRandomRange(2<<8)>>8;
if (FAFcansee(ActorVectOfTop(actor),actor->sector(),pp->GetActor()->getPosWithOffsetZ(), pp->cursector) && Facing(actor, actor->user.targetActor))
@ -1027,7 +1027,7 @@ int DoBunnyQuickJump(DSWActor* actor)
int choose_snd;
static const int straightsnds[] = {DIGI_RABBITHUMP1,DIGI_RABBITHUMP2, DIGI_RABBITHUMP3,DIGI_RABBITHUMP4};
if (pp == &Player[myconnectindex])
if (pp == getPlayer(myconnectindex))
{
choose_snd = StdRandomRange(3<<8)>>8;
if (FAFcansee(ActorVectOfTop(actor), actor->sector(), pp->GetActor()->getPosWithOffsetZ(), pp->cursector) && Facing(actor, actor->user.targetActor))

View file

@ -62,7 +62,7 @@ void KeysCheat(SWPlayer* pp, const char *cheat_string);
static SWPlayer* checkCheat(cheatseq_t* c)
{
if (::CheckCheatmode(true, true)) return nullptr;
return &Player[screenpeek];
return getPlayer(screenpeek);
}
const char *GameInterface::CheckCheatMode()
@ -91,8 +91,8 @@ const char *GameInterface::GenericCheat(int player, int cheat)
return GStrings("GOD MODE: ON");
case CHT_NOCLIP:
Player[player].Flags ^= PF_CLIP_CHEAT;
return GStrings(Player[player].Flags & PF_CLIP_CHEAT ? "CLIPPING: OFF" : "CLIPPING: ON");
getPlayer(player)->Flags ^= PF_CLIP_CHEAT;
return GStrings(getPlayer(player)->Flags & PF_CLIP_CHEAT ? "CLIPPING: OFF" : "CLIPPING: ON");
case CHT_FLY:
ToggleFlyMode = true;
@ -193,7 +193,7 @@ bool WinPachinkoCheat(cheatseq_t* c)
return false;
Pachinko_Win_Cheat = !Pachinko_Win_Cheat;
PutStringInfo(&Player[myconnectindex], GStrings(Pachinko_Win_Cheat ? "TXTS_WINPACHINKOEN" : "TXTS_WINPACHINKODIS"));
PutStringInfo(getPlayer(myconnectindex), GStrings(Pachinko_Win_Cheat ? "TXTS_WINPACHINKOEN" : "TXTS_WINPACHINKODIS"));
return true;
}
@ -209,7 +209,7 @@ bool BunnyCheat(cheatseq_t* c)
return false;
sw_bunnyrockets = !sw_bunnyrockets;
PutStringInfo(&Player[myconnectindex], GStrings(sw_bunnyrockets ? "TXTS_BUNNYENABLED" : "TXTS_BUNNYDISABLED"));
PutStringInfo(getPlayer(myconnectindex), GStrings(sw_bunnyrockets ? "TXTS_BUNNYENABLED" : "TXTS_BUNNYDISABLED"));
return true;
}
@ -258,7 +258,7 @@ static cheatseq_t swcheats[] = {
static void WeaponCheat(int player)
{
auto p = &Player[player];
auto p = getPlayer(player);
if (!(p->Flags & PF_TWO_UZI))
{
@ -289,7 +289,7 @@ static void WeaponCheat(int player)
static void ItemCheat(int player)
{
auto p = &Player[player];
auto p = getPlayer(player);
PutStringInfo(p, GStrings("GIVING EVERYTHING!"));
memset(p->HasKey, true, sizeof(p->HasKey));
@ -324,7 +324,7 @@ static void cmd_Give(int player, uint8_t** stream, bool skip)
int type = ReadByte(stream);
if (skip) return;
if (numplayers != 1 || gamestate != GS_LEVEL || (Player[player].Flags & PF_DEAD))
if (numplayers != 1 || gamestate != GS_LEVEL || (getPlayer(player)->Flags & PF_DEAD))
{
Printf("give: Cannot give while dead or not in a single-player game.\n");
return;
@ -338,10 +338,10 @@ static void cmd_Give(int player, uint8_t** stream, bool skip)
break;
case GIVE_HEALTH:
if (Player[player].GetActor()->user.Health < Player[player].MaxHealth)
if (getPlayer(player)->GetActor()->user.Health < getPlayer(player)->MaxHealth)
{
Player[player].GetActor()->user.Health += 25;
PutStringInfo(&Player[player], GStrings("TXTS_ADDEDHEALTH"));
getPlayer(player)->GetActor()->user.Health += 25;
PutStringInfo(getPlayer(player), GStrings("TXTS_ADDEDHEALTH"));
}
break;
@ -351,7 +351,7 @@ static void cmd_Give(int player, uint8_t** stream, bool skip)
case GIVE_AMMO:
{
auto p = &Player[player];
auto p = getPlayer(player);
p->WpnShotgunAuto = 50;
p->WpnRocketHeat = 5;
@ -367,21 +367,21 @@ static void cmd_Give(int player, uint8_t** stream, bool skip)
}
case GIVE_ARMOR:
if (Player[player].GetActor()->user.Health < Player[player].MaxHealth)
if (getPlayer(player)->GetActor()->user.Health < getPlayer(player)->MaxHealth)
{
Player[player].Armor = 100;
PutStringInfo(&Player[player], GStrings("TXTB_FULLARM"));
getPlayer(player)->Armor = 100;
PutStringInfo(getPlayer(player), GStrings("TXTB_FULLARM"));
}
break;
case GIVE_KEYS:
memset(Player[player].HasKey, true, sizeof(Player[player].HasKey));
PutStringInfo(&Player[player], GStrings("TXTS_GIVEKEY"));
memset(getPlayer(player)->HasKey, true, sizeof(getPlayer(player)->HasKey));
PutStringInfo(getPlayer(player), GStrings("TXTS_GIVEKEY"));
break;
case GIVE_INVENTORY:
{
auto p = &Player[player];
auto p = getPlayer(player);
PutStringInfo(p, GStrings("GOT ALL INVENTORY"));
p->WpnShotgunAuto = 50;

View file

@ -86,7 +86,7 @@ void GameInterface::MenuSound(EMenuSounds snd)
bool GameInterface::CanSave()
{
return (!CommEnabled && numplayers ==1 && /*!DemoMode &&*/ !(Player[myconnectindex].Flags & PF_DEAD));
return (!CommEnabled && numplayers ==1 && /*!DemoMode &&*/ !(getPlayer(myconnectindex)->Flags & PF_DEAD));
}
//---------------------------------------------------------------------------
@ -97,7 +97,7 @@ bool GameInterface::CanSave()
bool GameInterface::StartGame(FNewGameStartup& gs)
{
SWPlayer* pp = &Player[screenpeek];
SWPlayer* pp = getPlayer(screenpeek);
int handle = 0;
int zero = 0;

View file

@ -362,7 +362,7 @@ void DoShadows(tspriteArray& tsprites, tspritetype* tsp, double viewz)
else
{
// Alter the shadow's position so that it appears behind the sprite itself.
auto look = (tSpr->pos.XY() - Player[screenpeek].si.XY()).Angle();
auto look = (tSpr->pos.XY() - getPlayer(screenpeek)->si.XY()).Angle();
tSpr->pos.XY() += look.ToVector() * 2;
}
@ -608,7 +608,7 @@ static void analyzesprites(tspriteArray& tsprites, const DVector3& viewpos, doub
{
int tSpriteNum;
static int ang = 0;
SWPlayer* pp = &Player[screenpeek];
SWPlayer* pp = getPlayer(screenpeek);
int newshade=0;
const int DART_PIC = 2526;
@ -775,9 +775,9 @@ static void analyzesprites(tspriteArray& tsprites, const DVector3& viewpos, doub
ShadeSprite(tsp);
// sw if its your playersprite
if (Player[screenpeek].GetActor() == tActor)
if (getPlayer(screenpeek)->GetActor() == tActor)
{
pp = &Player[screenpeek];
pp = getPlayer(screenpeek);
if (display_mirror || (pp->Flags & (PF_VIEW_FROM_OUTSIDE|PF_VIEW_FROM_CAMERA)))
{
if (pp->Flags & (PF_VIEW_FROM_OUTSIDE))
@ -880,7 +880,7 @@ static void analyzesprites(tspriteArray& tsprites, const DVector3& viewpos, doub
{
if ((tActor->user.Flags2 & SPR2_VIS_SHADING))
{
if (Player[screenpeek].GetActor() != tActor)
if (getPlayer(screenpeek)->GetActor() != tActor)
{
if (!(tActor->user.PlayerP->Flags & PF_VIEW_FROM_OUTSIDE))
{
@ -1215,7 +1215,7 @@ void RestorePortalState()
void drawscreen(SWPlayer* pp, double interpfrac, bool sceneonly)
{
// prediction player if prediction is on, else regular player
SWPlayer* camerapp = (PredictionOn && CommEnabled && pp == &Player[myconnectindex]) ? ppp : pp;
SWPlayer* camerapp = (PredictionOn && CommEnabled && pp == getPlayer(myconnectindex)) ? ppp : pp;
PreDraw();
PreUpdatePanel(interpfrac);
@ -1305,7 +1305,7 @@ void drawscreen(SWPlayer* pp, double interpfrac, bool sceneonly)
MarkSectorSeen(pp->cursector);
if ((automapMode != am_off) && pp == &Player[myconnectindex])
if ((automapMode != am_off) && pp == getPlayer(myconnectindex))
{
SWSpriteIterator it;
while (auto actor = it.Next())
@ -1369,7 +1369,7 @@ void drawscreen(SWPlayer* pp, double interpfrac, bool sceneonly)
bool GameInterface::GenerateSavePic()
{
drawscreen(&Player[myconnectindex], 65536, true);
drawscreen(getPlayer(myconnectindex), 65536, true);
return true;
}
@ -1399,7 +1399,7 @@ bool GameInterface::DrawAutomapPlayer(const DVector2& mxy, const DVector2& cpos,
if (actor->spr.cstat2 & CSTAT2_SPRITE_MAPPED)
{
// 1=white / 31=black / 44=green / 56=pink / 128=yellow / 210=blue / 248=orange / 255=purple
PalEntry col = (actor->spr.cstat & CSTAT_SPRITE_BLOCK) > 0 ? GPalette.BaseColors[248] : actor == Player[screenpeek].GetActor() ? GPalette.BaseColors[31] : GPalette.BaseColors[56];
PalEntry col = (actor->spr.cstat & CSTAT_SPRITE_BLOCK) > 0 ? GPalette.BaseColors[248] : actor == getPlayer(screenpeek)->GetActor() ? GPalette.BaseColors[31] : GPalette.BaseColors[56];
auto statnum = actor->spr.statnum;
auto sprxy = ((statnum >= 1) && (statnum <= 8) && (statnum != 2) ? actor->interpolatedpos(interpfrac) : actor->spr.pos).XY() - cpos;
@ -1424,7 +1424,7 @@ bool GameInterface::DrawAutomapPlayer(const DVector2& mxy, const DVector2& cpos,
{
if (p == screenpeek)
{
auto pp = &Player[p];
auto pp = getPlayer(p);
auto actor = pp->GetActor();
if (actor->vel.X > 1) pspr_ndx[myconnectindex] = ((PlayClock >> 4) & 3);
sprisplayer = true;
@ -1437,7 +1437,7 @@ bool GameInterface::DrawAutomapPlayer(const DVector2& mxy, const DVector2& cpos,
int spnum = -1;
if (sprisplayer)
{
if (gNet.MultiGameType != MULTI_GAME_COMMBAT || actor == Player[screenpeek].GetActor())
if (gNet.MultiGameType != MULTI_GAME_COMMBAT || actor == getPlayer(screenpeek)->GetActor())
spnum = 1196 + pspr_ndx[myconnectindex];
}
else spnum = actor->spr.picnum;

View file

@ -118,7 +118,7 @@ void markgcroots()
GC::MarkArray(GenericQueue, MAX_GENERIC_QUEUE);
GC::MarkArray(LoWangsQueue, MAX_LOWANGS_QUEUE);
GC::MarkArray(BossSpriteNum, 3);
for (auto& pl : Player)
for (auto& pl : PlayerArray)
{
GC::Mark(pl.actor);
GC::Mark(pl.lowActor);
@ -265,7 +265,7 @@ void GameInterface::app_init()
gs = gs_defaults;
for (int i = 0; i < MAX_SW_PLAYERS; i++)
INITLIST(&Player[i].PanelSpriteList);
INITLIST(&getPlayer(i)->PanelSpriteList);
DebugOperate = true;
enginecompatibility_mode = ENGINECOMPATIBILITY_19961112;
@ -293,9 +293,9 @@ void GameInterface::app_init()
defineSky(nullptr, 1, nullptr);
memset(Track, 0, sizeof(Track));
memset(Player, 0, sizeof(Player));
memset(PlayerArray, 0, sizeof(PlayerArray));
for (int i = 0; i < MAX_SW_PLAYERS; i++)
INITLIST(&Player[i].PanelSpriteList);
INITLIST(&(getPlayer(i)->PanelSpriteList));
LoadCustomInfoFromScript("engine/swcustom.txt"); // load the internal definitions. These also apply to the shareware version.
if (!SW_SHAREWARE)
@ -413,12 +413,12 @@ void InitLevel(MapRecord *maprec)
for (int i = 0; i < MAX_SW_PLAYERS; i++)
{
// don't jack with the playerreadyflag
int ready_bak = Player[i].playerreadyflag;
int ver_bak = Player[i].PlayerVersion;
memset(&Player[i], 0, sizeof(Player[i]));
Player[i].playerreadyflag = ready_bak;
Player[i].PlayerVersion = ver_bak;
INITLIST(&Player[i].PanelSpriteList);
int ready_bak = getPlayer(i)->playerreadyflag;
int ver_bak = getPlayer(i)->PlayerVersion;
*getPlayer(i) = {};
getPlayer(i)->playerreadyflag = ready_bak;
getPlayer(i)->PlayerVersion = ver_bak;
INITLIST(&getPlayer(i)->PanelSpriteList);
}
memset(puser, 0, sizeof(puser));
@ -431,7 +431,7 @@ void InitLevel(MapRecord *maprec)
DVector3 ppos;
loadMap(maprec->fileName, SW_SHAREWARE ? 1 : 0, &ppos, &ang, &cursect, sprites);
spawnactors(sprites);
Player[0].cursector = cursect;
getPlayer(0)->cursector = cursect;
SECRET_SetMapName(currentLevel->DisplayName(), currentLevel->name);
STAT_NewLevel(currentLevel->fileName);
@ -505,7 +505,7 @@ void InitRunLevel(void)
PlaySong(currentLevel->music, currentLevel->cdSongId);
}
InitPrediction(&Player[myconnectindex]);
InitPrediction(getPlayer(myconnectindex));
InitTimingVars();
@ -573,7 +573,7 @@ void TerminateLevel(void)
TRAVERSE_CONNECT(pnum)
{
SWPlayer* pp = &Player[pnum];
SWPlayer* pp = getPlayer(pnum);
if (pp->Flags & PF_DEAD)
PlayerDeathReset(pp);
@ -636,7 +636,7 @@ void GameInterface::LevelCompleted(MapRecord* map, int skill)
{
//ResetPalette(mpp);
COVER_SetReverb(0); // Reset reverb
Player[myconnectindex].Reverb = 0;
getPlayer(myconnectindex)->Reverb = 0;
StopSound();
STAT_Update(map == nullptr);
@ -720,7 +720,7 @@ void GameInterface::Render()
{
drawtime.Reset();
drawtime.Clock();
drawscreen(&Player[screenpeek], paused || !cl_interpolate || cl_capfps ? 1. : I_GetTimeFrac(), false);
drawscreen(getPlayer(screenpeek), paused || !cl_interpolate || cl_capfps ? 1. : I_GetTimeFrac(), false);
drawtime.Unclock();
}

View file

@ -1861,7 +1861,12 @@ struct SWPlayer
}
};
extern SWPlayer Player[MAX_SW_PLAYERS_REG+1];
extern SWPlayer PlayerArray[MAX_SW_PLAYERS_REG+1];
inline SWPlayer* getPlayer(int index)
{
return &PlayerArray[index];
}
struct GameInterface : public ::GameInterface
@ -1892,7 +1897,7 @@ struct GameInterface : public ::GameInterface
void NextLevel(MapRecord *map, int skill) override;
void NewGame(MapRecord *map, int skill, bool) override;
bool DrawAutomapPlayer(const DVector2& mxy, const DVector2& cpos, const DAngle cang, const DVector2& xydim, const double czoom, double const interpfrac) override;
DCoreActor* getConsoleActor() override { return Player[myconnectindex].GetActor(); }
DCoreActor* getConsoleActor() override { return getPlayer(myconnectindex)->GetActor(); }
void ToggleThirdPerson() override;
void SwitchCoopView() override;
void processSprites(tspriteArray& tsprites, const DVector3& view, DAngle viewang, double smoothRatio) override;
@ -1903,10 +1908,10 @@ struct GameInterface : public ::GameInterface
int GetCurrentSkill() override;
void StartSoundEngine() override;
unsigned getCrouchState() override;
void reapplyInputBits(InputPacket* const input) override { input->actions |= Player[myconnectindex].input.actions & SB_CENTERVIEW; }
void reapplyInputBits(InputPacket* const input) override { input->actions |= getPlayer(myconnectindex)->input.actions & SB_CENTERVIEW; }
void doPlayerMovement(const float scaleAdjust) override
{
const auto pp = &Player[myconnectindex];
const auto pp = getPlayer(myconnectindex);
gameInput.processMovement(&pp->Angles, scaleAdjust, 0, !pp->sop, pp->sop_control ? (3.f / 1.40625f) : 1.f);
}
};

View file

@ -481,8 +481,8 @@ void so_dointerpolations(double interpfrac) // Stick at beg
if (CommEnabled &&
((interp->lasttic != synctics) ||
!(sop->controller) ||
((Player[screenpeek].sop_control == sop) &&
!Player[screenpeek].sop_remote)))
((getPlayer(screenpeek)->sop_control == sop) &&
!getPlayer(screenpeek)->sop_remote)))
continue;
double ratio = interpfrac * synctics + interp->tic;

View file

@ -182,7 +182,7 @@ void UseInventoryMedkit(SWPlayer* pp)
//percent
PlayerUpdateInventory(pp, pp->InventoryNum);
if (pp == &Player[myconnectindex])
if (pp == getPlayer(myconnectindex))
{
if (amt >= 30)
PlayerSound(DIGI_GETMEDKIT, v3df_follow|v3df_dontpan,pp);
@ -271,7 +271,7 @@ void UseInventoryRepairKit(SWPlayer* pp)
short inv = INVENTORY_REPAIR_KIT;
//PlaySound(DIGI_TOOLBOX, pp, v3df_none);
if (pp == &Player[myconnectindex])
if (pp == getPlayer(myconnectindex))
{
if (StdRandomRange(1000) > 500)
PlayerSound(DIGI_NOREPAIRMAN, v3df_follow|v3df_dontpan,pp);
@ -315,7 +315,7 @@ void UseInventoryCloak(SWPlayer* pp)
plActor->spr.shade = 100;
PlaySound(DIGI_GASPOP, pp, v3df_none);
if (pp == &Player[myconnectindex])
if (pp == getPlayer(myconnectindex))
PlayerSound(DIGI_IAMSHADOW, v3df_follow|v3df_dontpan,pp);
}
@ -349,7 +349,7 @@ void StopInventoryCloak(SWPlayer* pp, short InventoryNum)
void DoPlayerNightVisionPalette(SWPlayer* pp)
{
if (pp != &Player[screenpeek]) return;
if (pp != getPlayer(screenpeek)) return;
if (pp->InventoryActive[INVENTORY_NIGHT_VISION])
{

View file

@ -376,7 +376,7 @@ void drawroomstotile(const DVector3& pos, DAngle ang, DAngle horiz, sectortype*
void JS_ProcessEchoSpot()
{
SWPlayer* pp = &Player[screenpeek];
SWPlayer* pp = getPlayer(screenpeek);
int16_t reverb;
bool reverb_set = false;
@ -557,7 +557,7 @@ void JS_DrawCameras(SWPlayer* pp, const DVector3& campos, double smoothratio)
{
if (dist < MAXCAMDIST)
{
SWPlayer* cp = &Player[camplayerview];
SWPlayer* cp = getPlayer(camplayerview);
if (TEST_BOOL11(camactor) && numplayers > 1)
{

View file

@ -1473,7 +1473,7 @@ int InitFlashBomb(DSWActor* actor)
int i;
unsigned int stat;
short damage;
SWPlayer* pp = &Player[screenpeek];
SWPlayer* pp = getPlayer(screenpeek);
PlaySound(DIGI_GASPOP, actor, v3df_dontpan | v3df_doppler);

View file

@ -96,7 +96,7 @@ void SetFadeAmt(SWPlayer* pp, short damage, uint8_t startcolor)
return;
// Reset the palette
if (pp == &Player[screenpeek])
if (pp == getPlayer(screenpeek))
{
videoFadePalette(0, 0, 0, 0);
}
@ -132,7 +132,7 @@ void SetFadeAmt(SWPlayer* pp, short damage, uint8_t startcolor)
auto color = GPalette.BaseColors[pp->StartColor];
// Do initial palette set
if (pp == &Player[screenpeek])
if (pp == getPlayer(screenpeek))
{
videoFadePalette(color.r, color.g, color.b, faderamp[min(31, max(0, 32 - abs(pp->FadeAmt)))]);
if (damage < -1000)
@ -151,7 +151,7 @@ void DoPaletteFlash(SWPlayer* pp)
{
pp->FadeAmt = 0;
pp->StartColor = 0;
if (pp == &Player[screenpeek])
if (pp == getPlayer(screenpeek))
{
videoFadePalette(0, 0, 0, 0);
DoPlayerDivePalette(pp); // Check Dive again
@ -186,7 +186,7 @@ void DoPaletteFlash(SWPlayer* pp)
{
pp->FadeAmt = 0;
pp->StartColor = 0;
if (pp == &Player[screenpeek])
if (pp == getPlayer(screenpeek))
{
videoFadePalette(0, 0, 0, 0);
DoPlayerDivePalette(pp); // Check Dive again
@ -197,7 +197,7 @@ void DoPaletteFlash(SWPlayer* pp)
else
{
// Only hard set the palette if this is currently the player's view
if (pp == &Player[screenpeek])
if (pp == getPlayer(screenpeek))
{
videoFadePalette(
GPalette.BaseColors[pp->StartColor].r,

View file

@ -874,7 +874,7 @@ int PachinkoCheckWin(DSWActor* actor)
// Do a possible combo switch
if (ComboSwitchTest(TAG_COMBO_SWITCH_EVERYTHING, actor->spr.hitag))
{
DoMatchEverything(&Player[myconnectindex], actor->spr.hitag, 1);
DoMatchEverything(getPlayer(myconnectindex), actor->spr.hitag, 1);
}
ActorCoughItem(actor); // I WON! I WON!

View file

@ -60,7 +60,7 @@ uint8_t CommPlayers = 0;
void InitNetPlayerOptions(void)
{
// short pnum;
SWPlayer* pp = &Player[myconnectindex];
SWPlayer* pp = getPlayer(myconnectindex);
strncpy(pp->PlayerName, playername, 31);

View file

@ -2109,7 +2109,7 @@ void InitAllPlayerSprites(const DVector3& spawnpos, const DAngle startang)
TRAVERSE_CONNECT(i)
{
InitPlayerSprite(&Player[i], spawnpos, startang);
InitPlayerSprite(getPlayer(i), spawnpos, startang);
}
}
@ -2241,7 +2241,7 @@ void PlayerPanelSetup(void)
//for (pp = Player; pp < &Player[numplayers]; pp++)
TRAVERSE_CONNECT(pnum)
{
auto pp = &Player[pnum];
auto pp = getPlayer(pnum);
ASSERT(pp->GetActor()->hasU());
@ -2292,7 +2292,7 @@ void PlayerGameReset(SWPlayer* pp)
PlayerUpdateArmor(pp, 0);
pp->KillerActor = nullptr;;
if (pp == &Player[screenpeek])
if (pp == getPlayer(screenpeek))
{
videoFadePalette(0,0,0,0);
}
@ -2321,7 +2321,7 @@ extern ACTOR_ACTION_SET PlayerNinjaActionSet;
void InitPlayerSprite(SWPlayer* pp, const DVector3& spawnpos, const DAngle startang)
{
int pnum = int(pp - Player);
int pnum = int(pp - PlayerArray);
double fz,cz;
extern bool NewGame;
@ -2387,7 +2387,7 @@ void InitPlayerSprite(SWPlayer* pp, const DVector3& spawnpos, const DAngle start
memset(pp->InventoryTics,0,sizeof(pp->InventoryTics));
if (pp == &Player[screenpeek])
if (pp == getPlayer(screenpeek))
{
videoFadePalette(0,0,0,0);
}
@ -2408,7 +2408,7 @@ void SpawnPlayerUnderSprite(SWPlayer* pp)
{
DSWActor* plActor = pp->GetActor();
int pnum = int(pp - Player);
int pnum = int(pp - PlayerArray);
pp->PlayerUnderActor = SpawnActor(STAT_PLAYER_UNDER0 + pnum,
NINJA_RUN_R0, nullptr, pp->cursector, pp->GetActor()->getPosWithOffsetZ(), pp->GetActor()->spr.Angles.Yaw);

View file

@ -93,7 +93,7 @@ static int osdcmd_mirror(CCmdFuncPtr parm)
void GameInterface::ToggleThirdPerson()
{
if (gamestate != GS_LEVEL) return;
auto pp = &Player[myconnectindex];
auto pp = getPlayer(myconnectindex);
if (pp->Flags & (PF_VIEW_FROM_OUTSIDE))
{
pp->Flags &= ~(PF_VIEW_FROM_OUTSIDE);
@ -125,13 +125,13 @@ void GameInterface::SwitchCoopView()
if (screenpeek == myconnectindex)
{
// JBF: figure out what's going on here
auto pp = &Player[myconnectindex];
auto pp = getPlayer(myconnectindex);
DoPlayerDivePalette(pp); // Check Dive again
DoPlayerNightVisionPalette(pp); // Check Night Vision again
}
else
{
SWPlayer* tp = &Player[screenpeek];
SWPlayer* tp = getPlayer(screenpeek);
DoPlayerDivePalette(tp);
DoPlayerNightVisionPalette(tp);
}

View file

@ -221,7 +221,7 @@ void DoPlayerChooseYell(SWPlayer* pp)
choose_snd = StdRandomRange(MAX_YELLSOUNDS);
if (pp == &Player[myconnectindex])
if (pp == getPlayer(myconnectindex))
PlayerSound(PlayerYellVocs[choose_snd], v3df_follow|v3df_dontpan,pp);
}
@ -321,7 +321,7 @@ void PlayerUpdateHealth(SWPlayer* pp, short value)
}
// Do redness based on damage taken.
if (pp == &Player[screenpeek])
if (pp == getPlayer(screenpeek))
{
if (IsChem)
SetFadeAmt(pp,-40,144); // ChemBomb green color
@ -444,7 +444,7 @@ void PlayerUpdateKills(SWPlayer* pp, short value)
TRAVERSE_CONNECT(pnum)
{
opp = &Player[pnum];
opp = getPlayer(pnum);
// for everyone on the same team
if (opp != pp && opp->GetActor()->user.spal == pp->GetActor()->user.spal)
@ -1084,7 +1084,7 @@ void InitWeaponSword(SWPlayer* pp)
PlaySound(DIGI_SWORD_UP, pp, v3df_follow|v3df_dontpan);
if (pp == &Player[myconnectindex] && PlayClock > 0)
if (pp == getPlayer(myconnectindex) && PlayClock > 0)
{
rnd_num = StdRandomRange(1024);
if (rnd_num > 900)
@ -1539,7 +1539,7 @@ void InitWeaponStar(SWPlayer* pp)
pSetState(psp, psp->PresentState);
PlaySound(DIGI_PULL, pp, v3df_follow|v3df_dontpan);
if (StdRandomRange(1000) > 900 && pp == &Player[myconnectindex])
if (StdRandomRange(1000) > 900 && pp == getPlayer(myconnectindex))
{
if (!sw_darts)
PlayerSound(DIGI_ILIKESHURIKEN, v3df_follow|v3df_dontpan,pp);
@ -4761,7 +4761,7 @@ void pMicroRest(PANEL_SPRITE* psp)
pp->InitingNuke = false;
pp->NukeInitialized = true;
if (pp == &Player[myconnectindex])
if (pp == getPlayer(myconnectindex))
{
choose_voc = StdRandomRange(1024);
if (choose_voc > 600)
@ -7784,7 +7784,7 @@ void UpdatePanel(double interpfrac)
TRAVERSE_CONNECT(pnum)
{
if (pnum == screenpeek)
pDisplaySprites(&Player[pnum], interpfrac);
pDisplaySprites(getPlayer(pnum), interpfrac);
}
}
@ -7803,7 +7803,7 @@ void PreUpdatePanel(double interpfrac)
TRAVERSE_CONNECT(pnum)
{
if (pnum == screenpeek)
pDisplaySprites(&Player[pnum], interpfrac);
pDisplaySprites(getPlayer(pnum), interpfrac);
}
DrawBeforeView = false;

View file

@ -119,7 +119,7 @@ extern bool DebugOperate;
int ChopTics;
SWPlayer Player[MAX_SW_PLAYERS_REG + 1];
SWPlayer PlayerArray[MAX_SW_PLAYERS_REG + 1];
// These are a bunch of kens variables for the player
@ -1325,9 +1325,9 @@ void DoPlayerWarpTeleporter(SWPlayer* pp)
TRAVERSE_CONNECT(pnum)
{
if (pnum != pp - Player)
if (pnum != pp - PlayerArray)
{
SWPlayer* npp = &Player[pnum];
SWPlayer* npp = getPlayer(pnum);
// if someone already standing there
if (npp->cursector == pp->cursector)
@ -4101,9 +4101,9 @@ void DoPlayerWarpToSurface(SWPlayer* pp)
void DoPlayerDivePalette(SWPlayer* pp)
{
if (pp != &Player[screenpeek]) return;
if (pp != getPlayer(screenpeek)) return;
if ((pp->DeathType == PLAYER_DEATH_DROWN || (Player[screenpeek].Flags & PF_DIVING)) && !(pp->Flags & PF_DIVING_IN_LAVA))
if ((pp->DeathType == PLAYER_DEATH_DROWN || (getPlayer(screenpeek)->Flags & PF_DIVING)) && !(pp->Flags & PF_DIVING_IN_LAVA))
{
SetFadeAmt(pp,-1005,210); // Dive color , org color 208
}
@ -4138,7 +4138,7 @@ void DoPlayerBeginDive(SWPlayer* pp)
DoPlayerDivePalette(pp);
DoPlayerNightVisionPalette(pp);
if (pp == &Player[screenpeek])
if (pp == getPlayer(screenpeek))
{
COVER_SetReverb(140); // Underwater echo
pp->Reverb = 140;
@ -4189,7 +4189,7 @@ void DoPlayerBeginDiveNoWarp(SWPlayer* pp)
if (pp->Bloody) pp->Bloody = false; // Water washes away the blood
if (pp == &Player[screenpeek])
if (pp == getPlayer(screenpeek))
{
COVER_SetReverb(140); // Underwater echo
pp->Reverb = 140;
@ -4245,7 +4245,7 @@ void DoPlayerStopDiveNoWarp(SWPlayer* pp)
DoPlayerDivePalette(pp);
DoPlayerNightVisionPalette(pp);
pp->GetActor()->spr.cstat &= ~(CSTAT_SPRITE_YCENTER);
if (pp == &Player[screenpeek])
if (pp == getPlayer(screenpeek))
{
COVER_SetReverb(0);
pp->Reverb = 0;
@ -4280,7 +4280,7 @@ void DoPlayerStopDive(SWPlayer* pp)
DoPlayerDivePalette(pp);
DoPlayerNightVisionPalette(pp);
actor->spr.cstat &= ~(CSTAT_SPRITE_YCENTER);
if (pp == &Player[screenpeek])
if (pp == getPlayer(screenpeek))
{
COVER_SetReverb(0);
pp->Reverb = 0;
@ -4302,7 +4302,7 @@ void DoPlayerDiveMeter(SWPlayer* pp)
if (NoMeters) return;
// Don't draw bar from other players
if (pp != &Player[myconnectindex]) return;
if (pp != getPlayer(myconnectindex)) return;
if (!(pp->Flags & (PF_DIVING|PF_DIVING_IN_LAVA))) return;
@ -5458,16 +5458,16 @@ void DoPlayerDeathMessage(SWPlayer* pp, SWPlayer* killer)
int pnum;
bool SEND_OK = false;
killer->KilledPlayer[pp-Player]++;
killer->KilledPlayer[pp-PlayerArray]++;
if (pp == killer && pp == &Player[myconnectindex])
if (pp == killer && pp == getPlayer(myconnectindex))
{
sprintf(ds,"%s %s",pp->PlayerName,SuicideNote[StdRandomRange(MAX_SUICIDE)]);
SEND_OK = true;
}
else
// I am being killed
if (killer == &Player[myconnectindex])
if (killer == getPlayer(myconnectindex))
{
sprintf(ds,"%s",KilledPlayerMessage(pp,killer));
SEND_OK = true;
@ -5854,7 +5854,7 @@ void DoPlayerDeathCheckKeys(SWPlayer* pp)
plActor->user.ID = NINJA_RUN_R0;
if (pp == &Player[screenpeek])
if (pp == getPlayer(screenpeek))
{
videoFadePalette(0,0,0,0);
}
@ -6433,7 +6433,7 @@ void DoPlayerRun(SWPlayer* pp)
unsigned GameInterface::getCrouchState()
{
const auto pp = &Player[myconnectindex];
const auto pp = getPlayer(myconnectindex);
const bool crouchable = true;
const bool disableToggle = (pp->Flags & (PF_JUMPING|PF_FALLING|PF_CLIMBING|PF_DIVING|PF_DEAD)) || pp->sop;
return (CS_CANCROUCH * crouchable) | (CS_DISABLETOGGLE * disableToggle);
@ -6512,7 +6512,7 @@ void MoveSkipSavePos(void)
// Save off player
TRAVERSE_CONNECT(pnum)
{
pp = &Player[pnum];
pp = getPlayer(pnum);
pp->Angles.resetCameraAngles();
pp->GetActor()->backuploc();
@ -6775,7 +6775,7 @@ void domovethings(const ticcmd_t* playercmds)
extern bool PlayerTrackingMode;
extern SWPlayer* GlobPlayerP;
pp = &Player[pnum];
pp = getPlayer(pnum);
GlobPlayerP = pp;
pp->lastinput = pp->input;
@ -6797,7 +6797,7 @@ void domovethings(const ticcmd_t* playercmds)
// auto tracking mode for single player multi-game
if (numplayers <= 1 && PlayerTrackingMode && pnum == screenpeek && screenpeek != myconnectindex)
{
Player[screenpeek].GetActor()->spr.Angles.Yaw = (Player[myconnectindex].GetActor()->spr.pos.XY() - Player[screenpeek].GetActor()->spr.pos.XY()).Angle();
getPlayer(screenpeek)->GetActor()->spr.Angles.Yaw = (getPlayer(myconnectindex)->GetActor()->spr.pos.XY() - getPlayer(screenpeek)->GetActor()->spr.pos.XY()).Angle();
}
if (!(pp->Flags & PF_DEAD))
@ -6867,13 +6867,13 @@ void domovethings(const ticcmd_t* playercmds)
void InitAllPlayers(void)
{
SWPlayer* pp;
SWPlayer* pfirst = Player;
SWPlayer* pfirst = PlayerArray;
int i;
extern bool NewGame;
//int fz,cz;
// Initialize all [MAX_SW_PLAYERS] arrays here!
for (pp = Player; pp < &Player[MAX_SW_PLAYERS]; pp++)
for (pp = PlayerArray; pp < getPlayer(MAX_SW_PLAYERS); pp++)
{
pp->cursector = pfirst->cursector;
// set like this so that player can trigger something on start of the level
@ -6940,7 +6940,7 @@ int SearchSpawnPosition(SWPlayer* pp)
// check to see if anyone else is blocking this spot
TRAVERSE_CONNECT(pnum)
{
opp = &Player[pnum];
opp = getPlayer(pnum);
if (opp != pp) // don't test for yourself
{
@ -6967,7 +6967,7 @@ bool SpawnPositionUsed[MAX_SW_PLAYERS_REG+1];
void PlayerSpawnPosition(SWPlayer* pp)
{
short pnum = short(pp - Player);
short pnum = short(pp - PlayerArray);
short pos_num = pnum;
int i;
DSWActor* spawn_sprite = nullptr;
@ -7079,7 +7079,7 @@ void InitMultiPlayerInfo(const DVector3& spawnpos, const DAngle startang)
// set up the zero starting positions - its not saved in the map as a ST1 sprite
// like the others
pp = Player;
pp = PlayerArray;
for (stat = 0; stat < SIZ(MultiStatList); stat++)
{
if (gNet.MultiGameType != MULTI_GAME_NONE)
@ -7110,7 +7110,7 @@ void InitMultiPlayerInfo(const DVector3& spawnpos, const DAngle startang)
//for (pp = Player; pp < Player + numplayers; pp++)
TRAVERSE_CONNECT(pnum)
{
pp = &Player[pnum];
pp = getPlayer(pnum);
switch (gNet.MultiGameType)
{
case MULTI_GAME_NONE:
@ -7120,7 +7120,7 @@ void InitMultiPlayerInfo(const DVector3& spawnpos, const DAngle startang)
case MULTI_GAME_COMMBAT:
case MULTI_GAME_AI_BOTS:
// there are no keys in deathmatch play
memset(Player[0].HasKey,0xFFFF,sizeof(Player[0].HasKey));
memset(getPlayer(0)->HasKey,0xFFFF,sizeof(getPlayer(0)->HasKey));
memset(pp->HasKey,0xFFFF,sizeof(pp->HasKey));
PlayerSpawnPosition(pp);
break;
@ -7194,7 +7194,7 @@ static saveable_code saveable_player_code[] =
static saveable_data saveable_player_data[] =
{
SAVE_DATA(Player),
SAVE_DATA(PlayerArray),
SAVE_DATA(s_PlayerNinjaRun),
SAVE_DATA(sg_PlayerNinjaRun),
SAVE_DATA(s_PlayerNinjaStand),
@ -7383,7 +7383,7 @@ DEFINE_ACTION_FUNCTION(_SW, InventoryFlags)
DEFINE_ACTION_FUNCTION(_SW, GetViewPlayer)
{
PARAM_PROLOGUE;
ACTION_RETURN_POINTER(&Player[screenpeek]);
ACTION_RETURN_POINTER(getPlayer(screenpeek));
}
DEFINE_ACTION_FUNCTION(_SW, RealWeapon)

View file

@ -221,7 +221,7 @@ FSerializer& Serialize(FSerializer& arc, const char* keyname, PANEL_SPRITE*& w,
for (unsigned i = 0; i < MAX_SW_PLAYERS_REG; i++)
{
// special case for pointing to the list head
if ((List*)w == (List*)&Player[i].PanelSpriteList)
if ((List*)w == (List*)&getPlayer(i)->PanelSpriteList)
{
idx = 1000'0000 + i;
break;
@ -239,7 +239,7 @@ FSerializer& Serialize(FSerializer& arc, const char* keyname, PANEL_SPRITE*& w,
arc(keyname, ndx);
if (ndx == ~0u) w = nullptr;
else if (ndx >= 1000'0000) w = (PANEL_SPRITE*)&Player[ndx - 1000'0000].PanelSpriteList;
else if (ndx >= 1000'0000) w = (PANEL_SPRITE*)&(getPlayer(ndx - 1000'0000)->PanelSpriteList);
else if ((unsigned)ndx >= pspAsArray.Size())
I_Error("Bad panel sprite index in savegame");
else w = pspAsArray[ndx];
@ -419,9 +419,9 @@ FSerializer& Serialize(FSerializer& arc, const char* keyname, REMOTE_CONTROL& w,
FSerializer& Serialize(FSerializer& arc, const char* keyname, SWPlayer*& w, SWPlayer** def)
{
int ndx = w ? int(w - Player) : -1;
int ndx = w ? int(w - PlayerArray) : -1;
arc(keyname, ndx);
w = ndx == -1 ? nullptr : &Player[ndx];
w = ndx == -1 ? nullptr : getPlayer(ndx);
return arc;
}
@ -1100,7 +1100,7 @@ void GameInterface::SerializeGameState(FSerializer& arc)
preSerializePanelSprites(arc);
so_serializeinterpolations(arc);
arc("numplayers", numplayers)
.Array("players", Player, numplayers)
.Array("players", PlayerArray, numplayers)
("skill", Skill)
("screenpeek", screenpeek)
.Array("sop", SectorObject, countof(SectorObject))
@ -1162,8 +1162,8 @@ void GameInterface::SerializeGameState(FSerializer& arc)
// this is not a new game
ShadowWarrior::NewGame = false;
DoPlayerDivePalette(&Player[myconnectindex]);
DoPlayerNightVisionPalette(&Player[myconnectindex]);
DoPlayerDivePalette(getPlayer(myconnectindex));
DoPlayerNightVisionPalette(getPlayer(myconnectindex));
InitLevelGlobals();
}
}

View file

@ -89,7 +89,7 @@ void UpdateStatusBar()
::UpdateStatusBar(&info);
SWPlayer* pp = &Player[screenpeek];
SWPlayer* pp = getPlayer(screenpeek);
if (pp->cookieTime > 0)
{
const int MESSAGE_LINE = 142; // Used to be 164

View file

@ -1088,7 +1088,7 @@ void DoSoundSpotMatch(short match, short sound_num, short sound_type)
if (pp)
{
if (pp == &Player[myconnectindex])
if (pp == getPlayer(myconnectindex))
PlayerSound(snd2play, v3df_dontpan|v3df_follow,pp);
}
}
@ -1536,7 +1536,7 @@ int OperateSprite(DSWActor* actor, short player_is_operating)
actor->user.FlagOwner = 1;
actor->user.WaitTics = SEC(4);
if (pp != &Player[myconnectindex]) return true;
if (pp != getPlayer(myconnectindex)) return true;
choose_snd = StdRandomRange(1000);
if (actor->spr.lotag == CARGIRL_R0)
@ -1905,7 +1905,7 @@ int DoTrapMatch(short match)
void TriggerSecret(sectortype* sectp, SWPlayer* pp)
{
if (pp == &Player[myconnectindex])
if (pp == getPlayer(myconnectindex))
PlayerSound(DIGI_ANCIENTSECRET, v3df_dontpan | v3df_doppler | v3df_follow, pp);
SECRET_Trigger(sectindex(pp->cursector));
@ -2104,7 +2104,7 @@ bool NearThings(SWPlayer* pp)
// Check player's current sector for triggered sound
if (pp->cursector->hitag == PLAYER_SOUNDEVENT_TAG)
{
if (pp == &Player[myconnectindex])
if (pp == getPlayer(myconnectindex))
PlayerSound(pp->cursector->lotag, v3df_follow|v3df_dontpan,pp);
return false;
}
@ -2121,7 +2121,7 @@ bool NearThings(SWPlayer* pp)
// Go through list of cases
if (actor->spr.hitag == PLAYER_SOUNDEVENT_TAG)
{
if (pp == &Player[myconnectindex])
if (pp == getPlayer(myconnectindex))
PlayerSound(actor->spr.lotag, v3df_follow|v3df_dontpan,pp);
}
return false; // Return false so he doesn't grunt
@ -2132,7 +2132,7 @@ bool NearThings(SWPlayer* pp)
// Check player's current sector for triggered sound
if (near.hitWall->hitag == PLAYER_SOUNDEVENT_TAG)
{
if (pp == &Player[myconnectindex])
if (pp == getPlayer(myconnectindex))
PlayerSound(near.hitWall->lotag, v3df_follow|v3df_dontpan,pp);
return false; // We are playing a sound so don't return true
}
@ -2160,7 +2160,7 @@ bool NearThings(SWPlayer* pp)
if (hit.hitWall != nullptr)
{
// Near a plain old vanilla wall. Can't do anything but grunt.
if (!(hit.hitWall->extra & WALLFX_DONT_STICK) && pp == &Player[myconnectindex])
if (!(hit.hitWall->extra & WALLFX_DONT_STICK) && pp == getPlayer(myconnectindex))
{
if (StdRandomRange(1000) > 970)
PlayerSound(DIGI_HITTINGWALLS, v3df_follow|v3df_dontpan,pp);
@ -2894,7 +2894,7 @@ void DoSector(void)
TRAVERSE_CONNECT(pnum)
{
pp = &Player[pnum];
pp = getPlayer(pnum);
if (pp->sop_riding == sop)
{

View file

@ -581,7 +581,7 @@ int DoSlidor(DSWActor* actor)
// go ahead and look for players clip box bounds
TRAVERSE_CONNECT(pnum)
{
pp = &Player[pnum];
pp = getPlayer(pnum);
if (pp->lo_sectp == actor->sector() ||
pp->hi_sectp == actor->sector())

View file

@ -108,7 +108,7 @@ short SoundDist(const DVector3& pos, double basedist)
double sqrdist;
extern short screenpeek;
double distance = (Player[screenpeek].GetActor()->getPosWithOffsetZ() - pos).Length() * 16;
double distance = (getPlayer(screenpeek)->GetActor()->getPosWithOffsetZ() - pos).Length() * 16;
if (basedist < 0) // if basedist is negative
{
@ -199,7 +199,7 @@ void InitAmbient(int num, DSWActor* actor)
if (num != -1) // skip message for -1 to allow using it for silencing buggy ambient sound sprites (there is one in SW level 9.)
{
sprintf(ds, "Invalid or out of range ambient sound number %d\n", num);
PutStringInfo(&Player[screenpeek], ds);
PutStringInfo(getPlayer(screenpeek), ds);
}
return;
}
@ -324,7 +324,7 @@ static void UpdateAmbients()
if (sdist < 255 && sfx->ResourceId == DIGI_WHIPME)
{
SWPlayer* pp = &Player[screenpeek];
SWPlayer* pp = getPlayer(screenpeek);
if (!FAFcansee(spot->spr.pos, spot->sector(), pp->GetActor()->getPosWithOffsetZ(), pp->cursector))
{
sdist = 255;
@ -379,7 +379,7 @@ public:
int SoundSourceIndex(FSoundChan* chan) override
{
if (chan->SourceType == SOURCE_Player) return int((SWPlayer*)(chan->Source) - Player);
if (chan->SourceType == SOURCE_Player) return int((SWPlayer*)(chan->Source) - PlayerArray);
return 0;
}
@ -388,7 +388,7 @@ public:
if (chan->SourceType == SOURCE_Player)
{
if (index < 0 || index >= MAX_SW_PLAYERS_REG) index = 0;
chan->Source = &Player[index];
chan->Source = getPlayer(index);
}
else chan->Source = nullptr;
}
@ -425,7 +425,7 @@ void SWSoundEngine::CalcPosVel(int type, const void* source, const float pt[3],
{
if (pos != nullptr)
{
SWPlayer* pp = &Player[screenpeek];
SWPlayer* pp = getPlayer(screenpeek);
FVector3 campos = GetSoundPos(pp->GetActor() ? pp->GetActor()->getPosWithOffsetZ() : DVector3());
DVector3 vPos = {};
bool pancheck = false;
@ -513,7 +513,7 @@ void SWSoundEngine::CalcPosVel(int type, const void* source, const float pt[3],
void GameInterface::UpdateSounds(void)
{
SWPlayer* pp = &Player[screenpeek];
SWPlayer* pp = getPlayer(screenpeek);
SoundListener listener;
DAngle tang;
@ -722,7 +722,7 @@ int _PlayerSound(int num, SWPlayer* pp)
if (Prediction)
return 0;
if (pp < Player || pp >= &Player[MAX_SW_PLAYERS])
if (pp < PlayerArray || pp >= getPlayer(MAX_SW_PLAYERS))
{
return 0;
}

View file

@ -417,7 +417,7 @@ int DoSpike(DSWActor* actor)
// go ahead and look for players clip box bounds
TRAVERSE_CONNECT(pnum)
{
pp = &Player[pnum];
pp = getPlayer(pnum);
if (pp->lo_sectp == actor->sector() ||
pp->hi_sectp == actor->sector())

View file

@ -597,7 +597,7 @@ void KillActor(DSWActor* actor)
// reset it.
TRAVERSE_CONNECT(pnum)
{
pp = &Player[pnum];
pp = getPlayer(pnum);
if (pp->KillerActor != nullptr)
{
@ -774,7 +774,7 @@ void SpawnUser(DSWActor* actor, short id, STATE* state)
actor->user.WpnGoalActor = nullptr;
actor->user.attachActor = nullptr;
actor->user.track = -1;
actor->user.targetActor = Player[0].GetActor();
actor->user.targetActor = getPlayer(0)->GetActor();
actor->user.Radius = 220;
actor->user.Sibling = -1;
actor->user.WaitTics = 0;
@ -4891,7 +4891,7 @@ void ChoosePlayerGetSound(SWPlayer* pp)
{
int choose_snd=0;
if (pp != &Player[myconnectindex]) return;
if (pp != getPlayer(myconnectindex)) return;
choose_snd = StdRandomRange((MAX_GETSOUNDS-1)<<8)>>8;
@ -4998,7 +4998,7 @@ int DoGet(DSWActor* actor)
TRAVERSE_CONNECT(pnum)
{
pp = &Player[pnum];
pp = getPlayer(pnum);
DSWActor* plActor = pp->GetActor();
int weaponswitch = WeaponSwitch(pnum);
@ -5063,11 +5063,11 @@ KeyMain:
if (pp->HasKey[key_num])
break;
PutStringInfo(&Player[pnum], quoteMgr.GetQuote(QUOTE_KEYMSG + key_num));
PutStringInfo(getPlayer(pnum), quoteMgr.GetQuote(QUOTE_KEYMSG + key_num));
pp->HasKey[key_num] = true;
SetFadeAmt(pp,ITEMFLASHAMT,ITEMFLASHCLR); // Flash blue on item pickup
if (pp == &Player[myconnectindex])
if (pp == getPlayer(myconnectindex))
PlaySound(DIGI_KEY, actor, v3df_dontpan);
// don't kill keys in coop
@ -5083,20 +5083,20 @@ KeyMain:
if (actor->user.spal == PALETTE_PLAYER3)
{
PlayerUpdateArmor(pp, 1000+InventoryDecls[InvDecl_Kevlar].amount);
PutStringInfo(&Player[pnum], quoteMgr.GetQuote(QUOTE_INVENTORY + InvDecl_Kevlar));
PutStringInfo(getPlayer(pnum), quoteMgr.GetQuote(QUOTE_INVENTORY + InvDecl_Kevlar));
}
else
{
if (pp->Armor < InventoryDecls[InvDecl_Armor].amount)
{
PlayerUpdateArmor(pp, 1000+InventoryDecls[InvDecl_Armor].amount);
PutStringInfo(&Player[pnum], quoteMgr.GetQuote(QUOTE_INVENTORY + InvDecl_Armor));
PutStringInfo(getPlayer(pnum), quoteMgr.GetQuote(QUOTE_INVENTORY + InvDecl_Armor));
}
else
break;
}
SetFadeAmt(pp,ITEMFLASHAMT,ITEMFLASHCLR); // Flash blue on item pickup
if (pp == &Player[myconnectindex])
if (pp == getPlayer(myconnectindex))
PlaySound(DIGI_BIGITEM, actor, v3df_dontpan);
// override for respawn mode
@ -5119,7 +5119,7 @@ KeyMain:
{
bool putbackmax=false;
PutStringInfo(&Player[pnum], quoteMgr.GetQuote(QUOTE_INVENTORY + InvDecl_SmMedkit));
PutStringInfo(getPlayer(pnum), quoteMgr.GetQuote(QUOTE_INVENTORY + InvDecl_SmMedkit));
if (pp->MaxHealth == 200)
{
@ -5131,7 +5131,7 @@ KeyMain:
if (putbackmax) pp->MaxHealth = 200;
SetFadeAmt(pp,ITEMFLASHAMT,ITEMFLASHCLR); // Flash blue on item pickup
if (pp == &Player[myconnectindex])
if (pp == getPlayer(myconnectindex))
PlaySound(DIGI_ITEM, actor, v3df_dontpan);
// override for respawn mode
@ -5149,11 +5149,11 @@ KeyMain:
pp->MaxHealth = 200;
if (plActor->user.Health < 200)
{
PutStringInfo(&Player[pnum], quoteMgr.GetQuote(QUOTE_INVENTORY + InvDecl_Booster));
PutStringInfo(getPlayer(pnum), quoteMgr.GetQuote(QUOTE_INVENTORY + InvDecl_Booster));
PlayerUpdateHealth(pp, InventoryDecls[InvDecl_Booster].amount); // This is for health
// over 100%
// Say something witty
if (pp == &Player[myconnectindex])
if (pp == getPlayer(myconnectindex))
{
int cookie = StdRandomRange(MAX_FORTUNES);
// print to the console, and the user quote display.
@ -5168,7 +5168,7 @@ KeyMain:
}
SetFadeAmt(pp,ITEMFLASHAMT,ITEMFLASHCLR); // Flash blue on item pickup
if (pp == &Player[myconnectindex])
if (pp == getPlayer(myconnectindex))
PlaySound(DIGI_BIGITEM, actor, v3df_dontpan);
// override for respawn mode
@ -5189,12 +5189,12 @@ KeyMain:
if (!pp->InventoryAmount[INVENTORY_MEDKIT] || pp->InventoryPercent[INVENTORY_MEDKIT] < InventoryDecls[InvDecl_Medkit].amount)
{
PutStringInfo(&Player[pnum], quoteMgr.GetQuote(QUOTE_INVENTORY + InvDecl_Medkit));
PutStringInfo(getPlayer(pnum), quoteMgr.GetQuote(QUOTE_INVENTORY + InvDecl_Medkit));
pp->InventoryPercent[INVENTORY_MEDKIT] = InventoryDecls[InvDecl_Medkit].amount;
pp->InventoryAmount[INVENTORY_MEDKIT] = 1;
PlayerUpdateInventory(pp, INVENTORY_MEDKIT);
SetFadeAmt(pp,ITEMFLASHAMT,ITEMFLASHCLR); // Flash blue on item pickup
if (pp == &Player[myconnectindex])
if (pp == getPlayer(myconnectindex))
PlaySound(DIGI_ITEM, actor, v3df_dontpan);
// override for respawn mode
@ -5212,12 +5212,12 @@ KeyMain:
if (pp->InventoryAmount[INVENTORY_CHEMBOMB] < InventoryDecls[InvDecl_ChemBomb].amount)
{
PutStringInfo(&Player[pnum], quoteMgr.GetQuote(QUOTE_INVENTORY + InvDecl_ChemBomb));
PutStringInfo(getPlayer(pnum), quoteMgr.GetQuote(QUOTE_INVENTORY + InvDecl_ChemBomb));
pp->InventoryPercent[INVENTORY_CHEMBOMB] = 0;
pp->InventoryAmount[INVENTORY_CHEMBOMB]++;
PlayerUpdateInventory(pp, INVENTORY_CHEMBOMB);
SetFadeAmt(pp,ITEMFLASHAMT,ITEMFLASHCLR); // Flash blue on item pickup
if (pp == &Player[myconnectindex])
if (pp == getPlayer(myconnectindex))
PlaySound(DIGI_ITEM, actor, v3df_dontpan);
KillGet(actor);
}
@ -5227,12 +5227,12 @@ KeyMain:
if (pp->InventoryAmount[INVENTORY_FLASHBOMB] < InventoryDecls[InvDecl_FlashBomb].amount)
{
PutStringInfo(&Player[pnum], quoteMgr.GetQuote(QUOTE_INVENTORY + InvDecl_FlashBomb));
PutStringInfo(getPlayer(pnum), quoteMgr.GetQuote(QUOTE_INVENTORY + InvDecl_FlashBomb));
pp->InventoryPercent[INVENTORY_FLASHBOMB] = 0;
pp->InventoryAmount[INVENTORY_FLASHBOMB]++;
PlayerUpdateInventory(pp, INVENTORY_FLASHBOMB);
SetFadeAmt(pp,ITEMFLASHAMT,ITEMFLASHCLR); // Flash blue on item pickup
if (pp == &Player[myconnectindex])
if (pp == getPlayer(myconnectindex))
PlaySound(DIGI_ITEM, actor, v3df_dontpan);
KillGet(actor);
}
@ -5242,14 +5242,14 @@ KeyMain:
if (pp->InventoryAmount[INVENTORY_CALTROPS] < InventoryDecls[InvDecl_Caltrops].amount)
{
PutStringInfo(&Player[pnum], quoteMgr.GetQuote(QUOTE_INVENTORY + InvDecl_Caltrops));
PutStringInfo(getPlayer(pnum), quoteMgr.GetQuote(QUOTE_INVENTORY + InvDecl_Caltrops));
pp->InventoryPercent[INVENTORY_CALTROPS] = 0;
pp->InventoryAmount[INVENTORY_CALTROPS]+=3;
if (pp->InventoryAmount[INVENTORY_CALTROPS] > InventoryDecls[InvDecl_Caltrops].amount)
pp->InventoryAmount[INVENTORY_CALTROPS] = InventoryDecls[InvDecl_Caltrops].amount;
PlayerUpdateInventory(pp, INVENTORY_CALTROPS);
SetFadeAmt(pp,ITEMFLASHAMT,ITEMFLASHCLR); // Flash blue on item pickup
if (pp == &Player[myconnectindex])
if (pp == getPlayer(myconnectindex))
PlaySound(DIGI_ITEM, actor, v3df_dontpan);
KillGet(actor);
}
@ -5258,12 +5258,12 @@ KeyMain:
case ICON_NIGHT_VISION:
if (!pp->InventoryAmount[INVENTORY_NIGHT_VISION] || pp->InventoryPercent[INVENTORY_NIGHT_VISION] < InventoryDecls[InvDecl_NightVision].amount)
{
PutStringInfo(&Player[pnum], quoteMgr.GetQuote(QUOTE_INVENTORY + InvDecl_NightVision));
PutStringInfo(getPlayer(pnum), quoteMgr.GetQuote(QUOTE_INVENTORY + InvDecl_NightVision));
pp->InventoryPercent[INVENTORY_NIGHT_VISION] = InventoryDecls[InvDecl_NightVision].amount;
pp->InventoryAmount[INVENTORY_NIGHT_VISION] = 1;
PlayerUpdateInventory(pp, INVENTORY_NIGHT_VISION);
SetFadeAmt(pp,ITEMFLASHAMT,ITEMFLASHCLR); // Flash blue on item pickup
if (pp == &Player[myconnectindex])
if (pp == getPlayer(myconnectindex))
PlaySound(DIGI_ITEM, actor, v3df_dontpan);
KillGet(actor);
}
@ -5271,12 +5271,12 @@ KeyMain:
case ICON_REPAIR_KIT:
if (!pp->InventoryAmount[INVENTORY_REPAIR_KIT] || pp->InventoryPercent[INVENTORY_REPAIR_KIT] < InventoryDecls[InvDecl_RepairKit].amount)
{
PutStringInfo(&Player[pnum], quoteMgr.GetQuote(QUOTE_INVENTORY + InvDecl_RepairKit));
PutStringInfo(getPlayer(pnum), quoteMgr.GetQuote(QUOTE_INVENTORY + InvDecl_RepairKit));
pp->InventoryPercent[INVENTORY_REPAIR_KIT] = InventoryDecls[InvDecl_RepairKit].amount;
pp->InventoryAmount[INVENTORY_REPAIR_KIT] = 1;
PlayerUpdateInventory(pp, INVENTORY_REPAIR_KIT);
SetFadeAmt(pp,ITEMFLASHAMT,ITEMFLASHCLR); // Flash blue on item pickup
if (pp == &Player[myconnectindex])
if (pp == getPlayer(myconnectindex))
PlaySound(DIGI_ITEM, actor, v3df_dontpan);
// don't kill repair kit in coop
@ -5302,12 +5302,12 @@ KeyMain:
case ICON_CLOAK:
if (!pp->InventoryAmount[INVENTORY_CLOAK] || pp->InventoryPercent[INVENTORY_CLOAK] < InventoryDecls[InvDecl_Cloak].amount)
{
PutStringInfo(&Player[pnum], quoteMgr.GetQuote(QUOTE_INVENTORY + InvDecl_Cloak));
PutStringInfo(getPlayer(pnum), quoteMgr.GetQuote(QUOTE_INVENTORY + InvDecl_Cloak));
pp->InventoryPercent[INVENTORY_CLOAK] = InventoryDecls[InvDecl_Cloak].amount;
pp->InventoryAmount[INVENTORY_CLOAK] = 1;
PlayerUpdateInventory(pp, INVENTORY_CLOAK);
SetFadeAmt(pp,ITEMFLASHAMT,ITEMFLASHCLR); // Flash blue on item pickup
if (pp == &Player[myconnectindex])
if (pp == getPlayer(myconnectindex))
PlaySound(DIGI_ITEM, actor, v3df_dontpan);
KillGet(actor);
}
@ -5325,10 +5325,10 @@ KeyMain:
if (pp->WpnAmmo[WPN_STAR] >= DamageData[WPN_STAR].max_ammo)
break;
PutStringInfo(&Player[pnum], sw_darts? GStrings("TXTS_DARTS") : quoteMgr.GetQuote(QUOTE_WPNSHURIKEN));
PutStringInfo(getPlayer(pnum), sw_darts? GStrings("TXTS_DARTS") : quoteMgr.GetQuote(QUOTE_WPNSHURIKEN));
PlayerUpdateAmmo(pp, WPN_STAR, DamageData[WPN_STAR].weapon_pickup);
SetFadeAmt(pp,ITEMFLASHAMT,ITEMFLASHCLR); // Flash blue on item pickup
if (pp == &Player[myconnectindex])
if (pp == getPlayer(myconnectindex))
PlaySound(DIGI_ITEM, actor, v3df_dontpan);
KillGetWeapon(actor);
if (pp->WpnFlags & (BIT(WPN_STAR)))
@ -5352,10 +5352,10 @@ KeyMain:
if (pp->WpnAmmo[WPN_MINE] >= DamageData[WPN_MINE].max_ammo)
break;
//sprintf(ds,"Sticky Bombs");
PutStringInfo(&Player[pnum], quoteMgr.GetQuote(QUOTE_WPNSTICKY));
PutStringInfo(getPlayer(pnum), quoteMgr.GetQuote(QUOTE_WPNSTICKY));
PlayerUpdateAmmo(pp, WPN_MINE, DamageData[WPN_MINE].weapon_pickup);
SetFadeAmt(pp,ITEMFLASHAMT,ITEMFLASHCLR); // Flash blue on item pickup
if (pp == &Player[myconnectindex])
if (pp == getPlayer(myconnectindex))
PlaySound(DIGI_ITEM, actor, v3df_dontpan);
ChoosePlayerGetSound(pp);
KillGetWeapon(actor);
@ -5381,11 +5381,11 @@ KeyMain:
if (pp->Flags & (PF_TWO_UZI) && pp->WpnAmmo[WPN_UZI] >= DamageData[WPN_UZI].max_ammo)
break;
//sprintf(ds,"UZI Submachine Gun");
PutStringInfo(&Player[pnum], quoteMgr.GetQuote(QUOTE_WPNUZI));
PutStringInfo(getPlayer(pnum), quoteMgr.GetQuote(QUOTE_WPNUZI));
// pp->WpnAmmo[WPN_UZI] += 50;
PlayerUpdateAmmo(pp, WPN_UZI, DamageData[WPN_UZI].weapon_pickup);
SetFadeAmt(pp,ITEMFLASHAMT,ITEMFLASHCLR); // Flash blue on item pickup
if (pp == &Player[myconnectindex])
if (pp == getPlayer(myconnectindex))
PlaySound(DIGI_ITEM, actor, v3df_dontpan);
KillGetWeapon(actor);
@ -5397,7 +5397,7 @@ KeyMain:
{
pp->Flags |= (PF_TWO_UZI);
pp->WpnUziType = 0; // Let it come up
if (pp == &Player[myconnectindex])
if (pp == getPlayer(myconnectindex))
PlayerSound(DIGI_DOUBLEUZI, v3df_dontpan|v3df_follow, pp);
}
else
@ -5419,10 +5419,10 @@ KeyMain:
if (pp->WpnAmmo[WPN_UZI] >= DamageData[WPN_UZI].max_ammo)
break;
//sprintf(ds,"UZI Clip");
PutStringInfo(&Player[pnum], quoteMgr.GetQuote(QUOTE_AMMOUZI));
PutStringInfo(getPlayer(pnum), quoteMgr.GetQuote(QUOTE_AMMOUZI));
PlayerUpdateAmmo(pp, WPN_UZI, DamageData[WPN_UZI].ammo_pickup);
SetFadeAmt(pp,ITEMFLASHAMT,ITEMFLASHCLR); // Flash blue on item pickup
if (pp == &Player[myconnectindex])
if (pp == getPlayer(myconnectindex))
PlaySound(DIGI_ITEM, actor, v3df_dontpan);
KillGetAmmo(actor);
break;
@ -5437,11 +5437,11 @@ KeyMain:
if (pp->WpnFlags & (BIT(WPN_MICRO)) && pp->WpnAmmo[WPN_MICRO] >= DamageData[WPN_MICRO].max_ammo)
break;
//sprintf(ds,"Missile Launcher");
PutStringInfo(&Player[pnum], quoteMgr.GetQuote(QUOTE_WPNLAUNCH));
PutStringInfo(getPlayer(pnum), quoteMgr.GetQuote(QUOTE_WPNLAUNCH));
// pp->WpnAmmo[WPN_MICRO] += 5;
PlayerUpdateAmmo(pp, WPN_MICRO, DamageData[WPN_MICRO].weapon_pickup);
SetFadeAmt(pp,ITEMFLASHAMT,ITEMFLASHCLR); // Flash blue on item pickup
if (pp == &Player[myconnectindex])
if (pp == getPlayer(myconnectindex))
PlaySound(DIGI_ITEM, actor, v3df_dontpan);
ChoosePlayerGetSound(pp);
KillGetWeapon(actor);
@ -5460,10 +5460,10 @@ KeyMain:
if (pp->WpnAmmo[WPN_MICRO] >= DamageData[WPN_MICRO].max_ammo)
break;
//sprintf(ds,"Missiles");
PutStringInfo(&Player[pnum], quoteMgr.GetQuote(QUOTE_AMMOLAUNCH));
PutStringInfo(getPlayer(pnum), quoteMgr.GetQuote(QUOTE_AMMOLAUNCH));
PlayerUpdateAmmo(pp, WPN_MICRO, DamageData[WPN_MICRO].ammo_pickup);
SetFadeAmt(pp,ITEMFLASHAMT,ITEMFLASHCLR); // Flash blue on item pickup
if (pp == &Player[myconnectindex])
if (pp == getPlayer(myconnectindex))
PlaySound(DIGI_ITEM, actor, v3df_dontpan);
KillGetAmmo(actor);
break;
@ -5472,12 +5472,12 @@ KeyMain:
if (pp->WpnRocketNuke != 1)
{
//sprintf(ds,"Nuclear Warhead");
PutStringInfo(&Player[pnum], quoteMgr.GetQuote(QUOTE_WPNNUKE));
PutStringInfo(getPlayer(pnum), quoteMgr.GetQuote(QUOTE_WPNNUKE));
pp->WpnRocketNuke =uint8_t(DamageData[DMG_NUCLEAR_EXP].weapon_pickup);
SetFadeAmt(pp,ITEMFLASHAMT,ITEMFLASHCLR); // Flash blue on item pickup
if (pp == &Player[myconnectindex])
if (pp == getPlayer(myconnectindex))
PlaySound(DIGI_ITEM, actor, v3df_dontpan);
if (StdRandomRange(1000) > 800 && pp == &Player[myconnectindex])
if (StdRandomRange(1000) > 800 && pp == getPlayer(myconnectindex))
PlayerSound(DIGI_ILIKENUKES, v3df_dontpan|v3df_doppler|v3df_follow,pp);
if (pp->CurWpn == pp->Wpn[WPN_MICRO])
{
@ -5504,14 +5504,14 @@ KeyMain:
if (pp->WpnFlags & (BIT(WPN_GRENADE)) && pp->WpnAmmo[WPN_GRENADE] >= DamageData[WPN_GRENADE].max_ammo)
break;
//sprintf(ds,"Grenade Launcher");
PutStringInfo(&Player[pnum], quoteMgr.GetQuote(QUOTE_WPNGRENADE));
PutStringInfo(getPlayer(pnum), quoteMgr.GetQuote(QUOTE_WPNGRENADE));
// pp->WpnAmmo[WPN_GRENADE] += 6;
PlayerUpdateAmmo(pp, WPN_GRENADE, DamageData[WPN_GRENADE].weapon_pickup);
SetFadeAmt(pp,ITEMFLASHAMT,ITEMFLASHCLR); // Flash blue on item pickup
if (pp == &Player[myconnectindex])
if (pp == getPlayer(myconnectindex))
PlaySound(DIGI_ITEM, actor, v3df_dontpan);
//ChoosePlayerGetSound(pp);
if (StdRandomRange(1000) > 800 && pp == &Player[myconnectindex])
if (StdRandomRange(1000) > 800 && pp == getPlayer(myconnectindex))
PlayerSound(DIGI_LIKEBIGWEAPONS, v3df_dontpan|v3df_doppler|v3df_follow,pp);
KillGetWeapon(actor);
if (pp->WpnFlags & (BIT(WPN_GRENADE)))
@ -5529,10 +5529,10 @@ KeyMain:
if (pp->WpnAmmo[WPN_GRENADE] >= DamageData[WPN_GRENADE].max_ammo)
break;
//sprintf(ds,"Grenade Shells");
PutStringInfo(&Player[pnum], quoteMgr.GetQuote(QUOTE_AMMOGRENADE));
PutStringInfo(getPlayer(pnum), quoteMgr.GetQuote(QUOTE_AMMOGRENADE));
PlayerUpdateAmmo(pp, WPN_GRENADE, DamageData[WPN_GRENADE].ammo_pickup);
SetFadeAmt(pp,ITEMFLASHAMT,ITEMFLASHCLR); // Flash blue on item pickup
if (pp == &Player[myconnectindex])
if (pp == getPlayer(myconnectindex))
PlaySound(DIGI_ITEM, actor, v3df_dontpan);
KillGetAmmo(actor);
break;
@ -5574,12 +5574,12 @@ KeyMain:
if (pp->WpnFlags & (BIT(WPN_RAIL)) && pp->WpnAmmo[WPN_RAIL] >= DamageData[WPN_RAIL].max_ammo)
break;
//sprintf(ds,"Rail Gun");
PutStringInfo(&Player[pnum], quoteMgr.GetQuote(QUOTE_WPNRAILGUN));
PutStringInfo(getPlayer(pnum), quoteMgr.GetQuote(QUOTE_WPNRAILGUN));
PlayerUpdateAmmo(pp, WPN_RAIL, DamageData[WPN_RAIL].weapon_pickup);
SetFadeAmt(pp,ITEMFLASHAMT,ITEMFLASHCLR); // Flash blue on item pickup
if (pp == &Player[myconnectindex])
if (pp == getPlayer(myconnectindex))
PlaySound(DIGI_ITEM, actor, v3df_dontpan);
if (pp == &Player[myconnectindex])
if (pp == getPlayer(myconnectindex))
{
if (StdRandomRange(1000) > 700)
PlayerSound(DIGI_LIKEBIGWEAPONS, v3df_dontpan|v3df_doppler|v3df_follow,pp);
@ -5605,10 +5605,10 @@ KeyMain:
if (pp->WpnAmmo[WPN_RAIL] >= DamageData[WPN_RAIL].max_ammo)
break;
//sprintf(ds,"Rail Gun Rods");
PutStringInfo(&Player[pnum], quoteMgr.GetQuote(QUOTE_AMMORAILGUN));
PutStringInfo(getPlayer(pnum), quoteMgr.GetQuote(QUOTE_AMMORAILGUN));
PlayerUpdateAmmo(pp, WPN_RAIL, DamageData[WPN_RAIL].ammo_pickup);
SetFadeAmt(pp,ITEMFLASHAMT,ITEMFLASHCLR); // Flash blue on item pickup
if (pp == &Player[myconnectindex])
if (pp == getPlayer(myconnectindex))
PlaySound(DIGI_ITEM, actor, v3df_dontpan);
KillGetAmmo(actor);
break;
@ -5622,11 +5622,11 @@ KeyMain:
if (pp->WpnFlags & (BIT(WPN_SHOTGUN)) && pp->WpnAmmo[WPN_SHOTGUN] >= DamageData[WPN_SHOTGUN].max_ammo)
break;
//sprintf(ds,"Riot Gun");
PutStringInfo(&Player[pnum], quoteMgr.GetQuote(QUOTE_WPNRIOT));
PutStringInfo(getPlayer(pnum), quoteMgr.GetQuote(QUOTE_WPNRIOT));
// pp->WpnAmmo[WPN_SHOTGUN] += 10;
PlayerUpdateAmmo(pp, WPN_SHOTGUN, DamageData[WPN_SHOTGUN].weapon_pickup);
SetFadeAmt(pp,ITEMFLASHAMT,ITEMFLASHCLR); // Flash blue on item pickup
if (pp == &Player[myconnectindex])
if (pp == getPlayer(myconnectindex))
PlaySound(DIGI_ITEM, actor, v3df_dontpan);
ChoosePlayerGetSound(pp);
KillGetWeapon(actor);
@ -5645,10 +5645,10 @@ KeyMain:
if (pp->WpnAmmo[WPN_SHOTGUN] >= DamageData[WPN_SHOTGUN].max_ammo)
break;
//sprintf(ds,"Shotshells");
PutStringInfo(&Player[pnum], quoteMgr.GetQuote(QUOTE_AMMORIOT));
PutStringInfo(getPlayer(pnum), quoteMgr.GetQuote(QUOTE_AMMORIOT));
PlayerUpdateAmmo(pp, WPN_SHOTGUN, DamageData[WPN_SHOTGUN].ammo_pickup);
SetFadeAmt(pp,ITEMFLASHAMT,ITEMFLASHCLR); // Flash on item pickup
if (pp == &Player[myconnectindex])
if (pp == getPlayer(myconnectindex))
PlaySound(DIGI_ITEM, actor, v3df_dontpan);
KillGetAmmo(actor);
break;
@ -5689,13 +5689,13 @@ KeyMain:
if (pp->WpnFlags & (BIT(WPN_HOTHEAD)) && pp->WpnAmmo[WPN_HOTHEAD] >= DamageData[WPN_HOTHEAD].max_ammo)
break;
//sprintf(ds,"Guardian Head");
PutStringInfo(&Player[pnum], quoteMgr.GetQuote(QUOTE_WPNHEAD));
PutStringInfo(getPlayer(pnum), quoteMgr.GetQuote(QUOTE_WPNHEAD));
PlayerUpdateAmmo(pp, WPN_HOTHEAD, DamageData[WPN_HOTHEAD].weapon_pickup);
SetFadeAmt(pp,ITEMFLASHAMT,ITEMFLASHCLR); // Flash blue on item pickup
if (pp == &Player[myconnectindex])
if (pp == getPlayer(myconnectindex))
PlaySound(DIGI_ITEM, actor, v3df_dontpan);
//ChoosePlayerGetSound(pp);
if (StdRandomRange(1000) > 800 && pp == &Player[myconnectindex])
if (StdRandomRange(1000) > 800 && pp == getPlayer(myconnectindex))
PlayerSound(DIGI_LIKEBIGWEAPONS, v3df_dontpan|v3df_doppler|v3df_follow,pp);
KillGetWeapon(actor);
if (pp->WpnFlags & (BIT(WPN_HOTHEAD)))
@ -5715,10 +5715,10 @@ KeyMain:
if (pp->WpnAmmo[WPN_HOTHEAD] >= DamageData[WPN_HOTHEAD].max_ammo)
break;
//sprintf(ds,"Firebursts");
PutStringInfo(&Player[pnum], quoteMgr.GetQuote(QUOTE_AMMOHEAD));
PutStringInfo(getPlayer(pnum), quoteMgr.GetQuote(QUOTE_AMMOHEAD));
PlayerUpdateAmmo(pp, WPN_HOTHEAD, DamageData[WPN_HOTHEAD].ammo_pickup);
SetFadeAmt(pp,ITEMFLASHAMT,ITEMFLASHCLR); // Flash blue on item pickup
if (pp == &Player[myconnectindex])
if (pp == getPlayer(myconnectindex))
PlaySound(DIGI_ITEM, actor, v3df_dontpan);
KillGetAmmo(actor);
break;
@ -5734,13 +5734,13 @@ KeyMain:
if (pp->WpnFlags & (BIT(WPN_HEART)) && pp->WpnAmmo[WPN_HEART] >= DamageData[WPN_HEART].max_ammo)
break;
//sprintf(ds,"Ripper Heart");
PutStringInfo(&Player[pnum], quoteMgr.GetQuote(QUOTE_WPNRIPPER));
PutStringInfo(getPlayer(pnum), quoteMgr.GetQuote(QUOTE_WPNRIPPER));
PlayerUpdateAmmo(pp, WPN_HEART, DamageData[WPN_HEART].weapon_pickup);
SetFadeAmt(pp,ITEMFLASHAMT,ITEMFLASHCLR); // Flash blue on item pickup
if (pp == &Player[myconnectindex])
if (pp == getPlayer(myconnectindex))
PlaySound(DIGI_ITEM, actor, v3df_dontpan);
//ChoosePlayerGetSound(pp);
if (StdRandomRange(1000) > 800 && pp == &Player[myconnectindex])
if (StdRandomRange(1000) > 800 && pp == getPlayer(myconnectindex))
PlayerSound(DIGI_LIKEBIGWEAPONS, v3df_dontpan|v3df_doppler|v3df_follow,pp);
KillGetWeapon(actor);
if (pp->WpnFlags & (BIT(WPN_HEART)))
@ -5762,10 +5762,10 @@ KeyMain:
if (pp->WpnAmmo[WPN_HEART] >= DamageData[WPN_HEART].max_ammo)
break;
//sprintf(ds,"Deathcoils");
PutStringInfo(&Player[pnum], quoteMgr.GetQuote(QUOTE_AMMORIPPER));
PutStringInfo(getPlayer(pnum), quoteMgr.GetQuote(QUOTE_AMMORIPPER));
PlayerUpdateAmmo(pp, WPN_HEART, DamageData[WPN_HEART].ammo_pickup);
SetFadeAmt(pp,ITEMFLASHAMT,ITEMFLASHCLR); // Flash blue on item pickup
if (pp == &Player[myconnectindex])
if (pp == getPlayer(myconnectindex))
PlaySound(DIGI_ITEM, actor, v3df_dontpan);
KillGetAmmo(actor);
break;
@ -5774,10 +5774,10 @@ KeyMain:
if (pp->WpnRocketHeat != 5)
{
//sprintf(ds,"Heat Seeker Card");
PutStringInfo(&Player[pnum], quoteMgr.GetQuote(QUOTE_AMMONUKE));
PutStringInfo(getPlayer(pnum), quoteMgr.GetQuote(QUOTE_AMMONUKE));
pp->WpnRocketHeat = uint8_t(DamageData[DMG_NUCLEAR_EXP].ammo_pickup);
SetFadeAmt(pp,ITEMFLASHAMT,ITEMFLASHCLR); // Flash blue on item pickup
if (pp == &Player[myconnectindex])
if (pp == getPlayer(myconnectindex))
PlaySound(DIGI_ITEM, actor, v3df_dontpan);
KillGet(actor);
@ -6047,7 +6047,7 @@ void SpriteControl(void)
TRAVERSE_CONNECT(pnum)
{
pp = &Player[pnum];
pp = getPlayer(pnum);
// Only update the ones closest
double dist = (pp->GetActor()->spr.pos.XY() - actor->spr.pos.XY()).Length();

View file

@ -694,7 +694,7 @@ int DoSumoDeathMelt(DSWActor* actor)
void BossHealthMeter(void)
{
SWPlayer* pp = &Player[myconnectindex];
SWPlayer* pp = getPlayer(myconnectindex);
short color=0,metertics,meterunit;
int y;
extern bool NoMeters;
@ -706,7 +706,7 @@ void BossHealthMeter(void)
if (!(currentLevel->gameflags & (LEVEL_SW_BOSSMETER_SERPENT | LEVEL_SW_BOSSMETER_SUMO | LEVEL_SW_BOSSMETER_ZILLA))) return;
// Don't draw bar for other players
if (pp != &Player[myconnectindex])
if (pp != getPlayer(myconnectindex))
return;
// all enemys

View file

@ -47,7 +47,7 @@ BEGIN_SW_NS
void PutStringInfo(SWPlayer* pp, const char *string)
{
if (pp-Player == myconnectindex)
if (pp-PlayerArray == myconnectindex)
Printf(PRINT_MEDIUM|PRINT_NOTIFY, "%s\n", string); // Put it in the console too
}

View file

@ -1597,7 +1597,7 @@ PlayerPart:
TRAVERSE_CONNECT(pnum)
{
pp = &Player[pnum];
pp = getPlayer(pnum);
// if controlling a sector object
if (pp->sop)
@ -1632,7 +1632,7 @@ PlayerPart:
// move the player
TRAVERSE_CONNECT(pnum)
{
pp = &Player[pnum];
pp = getPlayer(pnum);
if (pp->lowActor && pp->lowActor == actor)
{
@ -1715,7 +1715,7 @@ PlayerPart:
TRAVERSE_CONNECT(pnum)
{
pp = &Player[pnum];
pp = getPlayer(pnum);
// if player was on a sector object
if (pp->sop_riding)
@ -3333,7 +3333,7 @@ int ActorFollowTrack(DSWActor* actor, short locktics)
{
TRAVERSE_CONNECT(pnum)
{
pp = &Player[pnum];
pp = getPlayer(pnum);
if ((actor->spr.pos.XY() - pp->GetActor()->spr.pos.XY()).Length() < actor->user.Dist)
{

View file

@ -483,7 +483,7 @@ int DoVator(DSWActor* actor)
// go ahead and look for players clip box bounds
TRAVERSE_CONNECT(pnum)
{
pp = &Player[pnum];
pp = getPlayer(pnum);
if (pp->lo_sectp == actor->sector() ||
pp->hi_sectp == actor->sector())

View file

@ -2547,7 +2547,7 @@ int DoLavaErupt(DSWActor* actor)
{
TRAVERSE_CONNECT(pnum)
{
pp = &Player[pnum];
pp = getPlayer(pnum);
if (pp->insector() && (pp->cursector->extra & SECTFX_TRIGGER))
{
SWSectIterator it(pp->cursector);
@ -4655,7 +4655,7 @@ int ActorChooseDeath(DSWActor* actor, DSWActor* weapActor)
{
SWPlayer* pp = weapActor->user.PlayerP;
if (weapActor->user.WeaponNum == WPN_FIST && StdRandomRange(1000)>500 && pp == &Player[myconnectindex])
if (weapActor->user.WeaponNum == WPN_FIST && StdRandomRange(1000)>500 && pp == getPlayer(myconnectindex))
{
int choosesnd = StdRandomRange(6);
@ -4674,7 +4674,7 @@ int ActorChooseDeath(DSWActor* actor, DSWActor* weapActor)
//PlayerSound(TauntAIVocs[choosesnd],&pp->posx,
// &pp->posy,&pp->posy,v3df_dontpan|v3df_follow,pp);
}
else if (weapActor->user.WeaponNum == WPN_SWORD && StdRandomRange(1000)>500 && pp == &Player[myconnectindex])
else if (weapActor->user.WeaponNum == WPN_SWORD && StdRandomRange(1000)>500 && pp == getPlayer(myconnectindex))
{
short choose_snd;
@ -4762,7 +4762,7 @@ int ActorChooseDeath(DSWActor* actor, DSWActor* weapActor)
{
choosesnd=StdRandomRange(MAX_TAUNTAI<<8)>>8;
if (pp == &Player[myconnectindex])
if (pp == getPlayer(myconnectindex))
PlayerSound(TauntAIVocs[choosesnd],v3df_dontpan|v3df_follow,pp);
}
}
@ -5449,14 +5449,14 @@ int DoDamage(DSWActor* actor, DSWActor* weapActor)
}
else
{
SWPlayer* pp = &Player[screenpeek];
SWPlayer* pp = getPlayer(screenpeek);
ActorHealth(actor, damage);
if (actor->user.Health <= 0)
{
int choosesnd=0;
// Random chance of taunting the AI's here
if (StdRandomRange(1024) > 512 && pp == &Player[myconnectindex])
if (StdRandomRange(1024) > 512 && pp == getPlayer(myconnectindex))
{
choosesnd=RandomRange(MAX_TAUNTAI);
PlayerSound(TauntAIVocs[choosesnd],v3df_dontpan|v3df_follow,pp);
@ -14437,7 +14437,7 @@ int InitEnemyRail(DSWActor* actor)
// Check all players
TRAVERSE_CONNECT(pnum)
{
pp = &Player[pnum];
pp = getPlayer(pnum);
if (actor->user.targetActor == pp->GetActor())
return 0;
}
@ -17977,7 +17977,7 @@ int DoFloorBlood(DSWActor* actor)
{
TRAVERSE_CONNECT(pnum)
{
pp = &Player[pnum];
pp = getPlayer(pnum);
double dist = (actor->spr.pos.XY() - pp->GetActor()->spr.pos.XY()).Length();