mirror of
https://github.com/ZDoom/Raze.git
synced 2024-11-15 00:42:08 +00:00
- Remove all game-side PlayerArray[]
objects and store within common code.
This commit is contained in:
parent
789c4669f1
commit
23d4cbc3bd
29 changed files with 79 additions and 92 deletions
|
@ -1,5 +1,6 @@
|
|||
#pragma once
|
||||
|
||||
#include "d_net.h"
|
||||
#include "packet.h"
|
||||
#include "gameinput.h"
|
||||
|
||||
|
@ -11,3 +12,5 @@ struct CorePlayer
|
|||
|
||||
virtual DCoreActor* GetActor() = 0;
|
||||
};
|
||||
|
||||
extern CorePlayer* PlayerArray[MAXPLAYERS];
|
||||
|
|
|
@ -90,7 +90,7 @@
|
|||
#include "i_interface.h"
|
||||
#include "texinfo.h"
|
||||
#include "texturemanager.h"
|
||||
#include "gameinput.h"
|
||||
#include "coreplayer.h"
|
||||
|
||||
CVAR(Bool, vid_activeinbackground, false, CVAR_ARCHIVE | CVAR_GLOBALCONFIG)
|
||||
CVAR(Bool, r_ticstability, true, CVAR_ARCHIVE | CVAR_GLOBALCONFIG)
|
||||
|
@ -101,6 +101,8 @@ static uint64_t stabilityticduration = 0;
|
|||
static uint64_t stabilitystarttime = 0;
|
||||
static double inputScale;
|
||||
|
||||
CorePlayer* PlayerArray[MAXPLAYERS];
|
||||
|
||||
bool r_NoInterpolate;
|
||||
int entertic;
|
||||
int oldentertics;
|
||||
|
|
|
@ -96,14 +96,14 @@ static void markgcroots()
|
|||
GC::MarkArray(gPhysSpritesList, gPhysSpritesCount);
|
||||
GC::MarkArray(gImpactSpritesList, gImpactSpritesCount);
|
||||
MarkSprInSect();
|
||||
for (auto pl : PlayerArray)
|
||||
for (int i = 0; i < MAXPLAYERS; i++)
|
||||
{
|
||||
GC::Mark(pl->actor);
|
||||
GC::MarkArray(pl->ctfFlagState, 2);
|
||||
GC::Mark(pl->aimTarget);
|
||||
GC::MarkArray(pl->aimTargets, 16);
|
||||
GC::Mark(pl->fragger);
|
||||
GC::Mark(pl->voodooTarget);
|
||||
GC::Mark(getPlayer(i)->actor);
|
||||
GC::MarkArray(getPlayer(i)->ctfFlagState, 2);
|
||||
GC::Mark(getPlayer(i)->aimTarget);
|
||||
GC::MarkArray(getPlayer(i)->aimTargets, 16);
|
||||
GC::Mark(getPlayer(i)->fragger);
|
||||
GC::Mark(getPlayer(i)->voodooTarget);
|
||||
}
|
||||
for (auto& evobj : rxBucket)
|
||||
{
|
||||
|
@ -587,10 +587,10 @@ void GameInterface::loadPalette(void)
|
|||
void GameInterface::app_init()
|
||||
{
|
||||
// Initialise player array.
|
||||
for (unsigned i = 0; i < kMaxPlayers; i++)
|
||||
for (unsigned i = 0; i < MAXPLAYERS; i++)
|
||||
{
|
||||
PlayerArray[i] = new BloodPlayer;
|
||||
*PlayerArray[i] = {};
|
||||
*getPlayer(i) = {};
|
||||
}
|
||||
|
||||
mirrortile = tileGetTextureID(504);
|
||||
|
|
|
@ -247,11 +247,9 @@ struct BloodPlayer final : public CorePlayer
|
|||
}
|
||||
};
|
||||
|
||||
extern BloodPlayer* PlayerArray[kMaxPlayers];
|
||||
|
||||
inline BloodPlayer* getPlayer(int index)
|
||||
{
|
||||
return PlayerArray[index];
|
||||
return static_cast<BloodPlayer*>(PlayerArray[index]);
|
||||
}
|
||||
|
||||
// subclassed to add a game specific actor() method
|
||||
|
|
|
@ -34,8 +34,6 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|||
|
||||
BEGIN_BLD_NS
|
||||
|
||||
BloodPlayer* PlayerArray[kMaxPlayers];
|
||||
|
||||
bool gBlueFlagDropped = false;
|
||||
bool gRedFlagDropped = false;
|
||||
|
||||
|
|
|
@ -2063,7 +2063,7 @@ static const uint8_t gWeaponUpgrade[][13] = {
|
|||
|
||||
int WeaponUpgrade(BloodPlayer* pPlayer, int newWeapon)
|
||||
{
|
||||
int weaponswitch = WeaponSwitch(pPlayer - *PlayerArray);
|
||||
int weaponswitch = WeaponSwitch(pPlayer - (BloodPlayer*)PlayerArray);
|
||||
int weapon = pPlayer->curWeapon;
|
||||
if (!checkLitSprayOrTNT(pPlayer) && (weaponswitch & 1) && (gWeaponUpgrade[pPlayer->curWeapon][newWeapon] || (weaponswitch & 2)))
|
||||
weapon = newWeapon;
|
||||
|
|
|
@ -273,7 +273,7 @@ void checkavailweapon(DukePlayer* player)
|
|||
weap = player->curr_weapon;
|
||||
if (player->gotweapon[weap])
|
||||
{
|
||||
if (player->ammo_amount[weap] > 0 || (WeaponSwitch(player - *PlayerArray) & 2) == 0)
|
||||
if (player->ammo_amount[weap] > 0 || (WeaponSwitch(player - (DukePlayer*)PlayerArray) & 2) == 0)
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -19,8 +19,6 @@
|
|||
|
||||
BEGIN_DUKE_NS
|
||||
|
||||
extern DukePlayer* PlayerArray[MAXPLAYERS];
|
||||
|
||||
struct GameInterface : public ::GameInterface
|
||||
{
|
||||
const char* Name() override { return "Duke"; }
|
||||
|
|
|
@ -83,18 +83,18 @@ static void markgcroots()
|
|||
GC::MarkArray(spriteq, 1024);
|
||||
GC::Mark(currentCommentarySprite);
|
||||
GC::Mark(ud.cameraactor);
|
||||
for (auto pl : PlayerArray)
|
||||
for (int i = 0; i < MAXPLAYERS; i++)
|
||||
{
|
||||
GC::Mark(pl->actor);
|
||||
GC::Mark(pl->actorsqu);
|
||||
GC::Mark(pl->wackedbyactor);
|
||||
GC::Mark(pl->on_crane);
|
||||
GC::Mark(pl->holoduke_on);
|
||||
GC::Mark(pl->somethingonplayer);
|
||||
GC::Mark(pl->access_spritenum);
|
||||
GC::Mark(pl->dummyplayersprite);
|
||||
GC::Mark(pl->newOwner);
|
||||
for (auto& var : pl->uservars)
|
||||
GC::Mark(getPlayer(i)->actor);
|
||||
GC::Mark(getPlayer(i)->actorsqu);
|
||||
GC::Mark(getPlayer(i)->wackedbyactor);
|
||||
GC::Mark(getPlayer(i)->on_crane);
|
||||
GC::Mark(getPlayer(i)->holoduke_on);
|
||||
GC::Mark(getPlayer(i)->somethingonplayer);
|
||||
GC::Mark(getPlayer(i)->access_spritenum);
|
||||
GC::Mark(getPlayer(i)->dummyplayersprite);
|
||||
GC::Mark(getPlayer(i)->newOwner);
|
||||
for (auto& var : getPlayer(i)->uservars)
|
||||
{
|
||||
var.Mark();
|
||||
}
|
||||
|
@ -390,7 +390,7 @@ void GameInterface::app_init()
|
|||
for (unsigned i = 0; i < MAXPLAYERS; i++)
|
||||
{
|
||||
PlayerArray[i] = new DukePlayer;
|
||||
*PlayerArray[i] = {};
|
||||
*getPlayer(i) = {};
|
||||
}
|
||||
|
||||
RegisterClasses();
|
||||
|
|
|
@ -260,17 +260,15 @@ void ClearGameVars(void)
|
|||
|
||||
void ResetGameVars(void)
|
||||
{
|
||||
int i;
|
||||
|
||||
for(i=0;i<iGameVarCount;i++)
|
||||
for (int i = 0; i < iGameVarCount; i++)
|
||||
{
|
||||
if (!(aGameVars[i].dwFlags & (GAMEVAR_FLAG_PLONG | GAMEVAR_FLAG_PFUNC)))
|
||||
{
|
||||
if (aGameVars[i].dwFlags & (GAMEVAR_FLAG_PERPLAYER))
|
||||
{
|
||||
for (auto pl : PlayerArray)
|
||||
for (int j = 0; i < MAXPLAYERS; i++)
|
||||
{
|
||||
pl->uservars[aGameVars[i].indexValue] = aGameVars[i].defaultValue;
|
||||
getPlayer(j)->uservars[aGameVars[i].indexValue] = aGameVars[i].defaultValue;
|
||||
}
|
||||
}
|
||||
else if (!(aGameVars[i].dwFlags & GAMEVAR_FLAG_PERACTOR))
|
||||
|
@ -1222,7 +1220,7 @@ void FinalizeGameVars(void)
|
|||
aGameVars[i].indexValue = actorNdx++;
|
||||
}
|
||||
}
|
||||
for (auto pl : PlayerArray) pl->uservars.Resize(weapNdx);
|
||||
for (int i = 0; i < MAXPLAYERS; i++) getPlayer(i)->uservars.Resize(weapNdx);
|
||||
ResetGameVars();
|
||||
|
||||
numActorVars = actorNdx;
|
||||
|
|
|
@ -45,9 +45,6 @@ user_defs ud; // partially serialized
|
|||
DukeGameInfo gs;
|
||||
int screenpeek;
|
||||
|
||||
// serialized
|
||||
DukePlayer* PlayerArray[MAXPLAYERS];
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
//
|
||||
// variables that only need an export if the entire game logic gets scriptified.
|
||||
|
|
|
@ -70,7 +70,6 @@ extern int screenpeek;
|
|||
// Variables that must be saved
|
||||
extern int rtsplaying;
|
||||
|
||||
extern DukePlayer* PlayerArray[MAXPLAYERS];
|
||||
extern int spriteqamount;
|
||||
extern int lastvisinc;
|
||||
extern animwalltype animwall[MAXANIMWALLS];
|
||||
|
|
|
@ -12,7 +12,7 @@ BEGIN_DUKE_NS
|
|||
|
||||
inline DukePlayer* getPlayer(int index)
|
||||
{
|
||||
return PlayerArray[index];
|
||||
return static_cast<DukePlayer*>(PlayerArray[index]);
|
||||
}
|
||||
|
||||
inline int rnd(int X)
|
||||
|
|
|
@ -1229,21 +1229,21 @@ int playeraddammo(DukePlayer* p, int weaponindex, int amount)
|
|||
}
|
||||
addammo(weaponindex, p, amount);
|
||||
if (p->curr_weapon == KNEE_WEAPON)
|
||||
if (p->gotweapon[weaponindex] && (WeaponSwitch(p - *PlayerArray) & 1))
|
||||
if (p->gotweapon[weaponindex] && (WeaponSwitch(p - (DukePlayer*)PlayerArray) & 1))
|
||||
fi.addweapon(p, weaponindex, true);
|
||||
return true;
|
||||
}
|
||||
|
||||
int playeraddweapon(DukePlayer* p, int weaponindex, int amount)
|
||||
{
|
||||
if (p->gotweapon[weaponindex] == 0) fi.addweapon(p, weaponindex, !!(WeaponSwitch(p - *PlayerArray) & 1));
|
||||
if (p->gotweapon[weaponindex] == 0) fi.addweapon(p, weaponindex, !!(WeaponSwitch(p - (DukePlayer*)PlayerArray) & 1));
|
||||
else if (p->ammo_amount[weaponindex] >= gs.max_ammo_amount[weaponindex])
|
||||
{
|
||||
return false;
|
||||
}
|
||||
addammo(weaponindex, p, amount);
|
||||
if (p->curr_weapon == KNEE_WEAPON)
|
||||
if (p->gotweapon[weaponindex] && (WeaponSwitch(p - *PlayerArray) & 1))
|
||||
if (p->gotweapon[weaponindex] && (WeaponSwitch(p - (DukePlayer*)PlayerArray) & 1))
|
||||
fi.addweapon(p, weaponindex, true);
|
||||
|
||||
return true;
|
||||
|
@ -1327,7 +1327,7 @@ int checkp(DDukeActor* self, DukePlayer* p, int flags)
|
|||
bool j = 0;
|
||||
|
||||
double vel = self->vel.X;
|
||||
unsigned plindex = unsigned(p - *PlayerArray);
|
||||
unsigned plindex = unsigned(p - (DukePlayer*)PlayerArray);
|
||||
|
||||
// sigh.. this was yet another place where number literals were used as bit masks for every single value, making the code totally unreadable.
|
||||
if ((flags & pducking) && p->on_ground && PlayerInput(plindex, SB_CROUCH))
|
||||
|
@ -1484,7 +1484,7 @@ void playerreset(DukePlayer* p, DDukeActor* g_ac)
|
|||
else
|
||||
{
|
||||
// I am not convinced this is even remotely smart to be executed from here..
|
||||
pickrandomspot(int(p - *PlayerArray));
|
||||
pickrandomspot(int(p - (DukePlayer*)PlayerArray));
|
||||
g_ac->spr.pos = p->GetActor()->getPosWithOffsetZ();
|
||||
p->GetActor()->backuppos();
|
||||
p->setbobpos();
|
||||
|
@ -1504,7 +1504,7 @@ void playerreset(DukePlayer* p, DDukeActor* g_ac)
|
|||
p->wantweaponfire = -1;
|
||||
p->GetActor()->PrevAngles.Pitch = p->GetActor()->spr.Angles.Pitch = nullAngle;
|
||||
p->on_crane = nullptr;
|
||||
p->frag_ps = int(p - *PlayerArray);
|
||||
p->frag_ps = int(p - (DukePlayer*)PlayerArray);
|
||||
p->Angles.PrevViewAngles.Pitch = p->Angles.ViewAngles.Pitch = nullAngle;
|
||||
p->opyoff = 0;
|
||||
p->wackedbyactor = nullptr;
|
||||
|
|
|
@ -1952,7 +1952,7 @@ HORIZONLY:
|
|||
if (p->show_empty_weapon > 0)
|
||||
{
|
||||
p->show_empty_weapon--;
|
||||
if (p->show_empty_weapon == 0 && (WeaponSwitch(p - *PlayerArray) & 2))
|
||||
if (p->show_empty_weapon == 0 && (WeaponSwitch(p - (DukePlayer*)PlayerArray) & 2))
|
||||
{
|
||||
if (p->last_full_weapon == GROW_WEAPON)
|
||||
p->subweapon |= (1 << GROW_WEAPON);
|
||||
|
|
|
@ -2910,7 +2910,7 @@ HORIZONLY:
|
|||
{
|
||||
p->show_empty_weapon--;
|
||||
|
||||
if (p->show_empty_weapon == 0 && (WeaponSwitch(p - *PlayerArray) & 2))
|
||||
if (p->show_empty_weapon == 0 && (WeaponSwitch(p - (DukePlayer*)PlayerArray) & 2))
|
||||
{
|
||||
fi.addweapon(p, p->last_full_weapon, true);
|
||||
return;
|
||||
|
|
|
@ -293,7 +293,7 @@ void resetweapons(DukePlayer* p)
|
|||
p->gotweapon[SLINGBLADE_WEAPON] = true;
|
||||
p->ammo_amount[SLINGBLADE_WEAPON] = 1;
|
||||
}
|
||||
OnEvent(EVENT_RESETWEAPONS, int(p - *PlayerArray), nullptr, -1);
|
||||
OnEvent(EVENT_RESETWEAPONS, int(p - (DukePlayer*)PlayerArray), nullptr, -1);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
|
@ -362,7 +362,7 @@ void resetinventory(DukePlayer* p)
|
|||
ufocnt = 0;
|
||||
hulkspawn = 2;
|
||||
}
|
||||
OnEvent(EVENT_RESETINVENTORY, int(p - *PlayerArray), p->GetActor());
|
||||
OnEvent(EVENT_RESETINVENTORY, int(p - (DukePlayer*)PlayerArray), p->GetActor());
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -179,7 +179,7 @@ DEFINE_ACTION_FUNCTION_NATIVE(_Duke, StopCommentary, StopCommentary)
|
|||
int getPlayerIndex(DukePlayer* p)
|
||||
{
|
||||
if (!p) return -1;
|
||||
return int(p - *PlayerArray);
|
||||
return int(p - (DukePlayer*)PlayerArray);
|
||||
}
|
||||
|
||||
DEFINE_ACTION_FUNCTION_NATIVE(_Duke, getPlayerIndex, getPlayerIndex)
|
||||
|
|
|
@ -418,10 +418,10 @@ void GameInterface::SetupSpecialTextures(TilesetBuildInfo& info)
|
|||
void GameInterface::app_init()
|
||||
{
|
||||
// Initialise player array.
|
||||
for (unsigned i = 0; i < kMaxPlayers; i++)
|
||||
for (unsigned i = 0; i < MAXPLAYERS; i++)
|
||||
{
|
||||
PlayerArray[i] = new ExhumedPlayer;
|
||||
*PlayerArray[i] = {};
|
||||
*getPlayer(i) = {};
|
||||
}
|
||||
|
||||
GC::AddMarkerFunc(markgcroots);
|
||||
|
|
|
@ -132,7 +132,7 @@ void ResetPlayerWeapons(int nPlayer)
|
|||
|
||||
void InitWeapons()
|
||||
{
|
||||
for (auto p : PlayerArray) p->pPlayerGrenade = nullptr;
|
||||
for (int i = 0; i < kMaxWeapons; i++) getPlayer(i)->pPlayerGrenade = nullptr;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
|
|
|
@ -69,7 +69,6 @@ static constexpr int16_t nItemText[] = {
|
|||
};
|
||||
|
||||
int nLocalPlayer = 0;
|
||||
ExhumedPlayer* PlayerArray[kMaxPlayers];
|
||||
TObjPtr<DExhumedActor*> nNetStartSprite[kMaxPlayers] = { };
|
||||
int PlayerCount;
|
||||
int nNetStartSprites;
|
||||
|
@ -84,13 +83,13 @@ int nCurStartSprite;
|
|||
|
||||
size_t MarkPlayers()
|
||||
{
|
||||
for (auto p : PlayerArray)
|
||||
for (int i = 0; i < kMaxWeapons; i++)
|
||||
{
|
||||
GC::Mark(p->actor);
|
||||
GC::Mark(p->pDoppleSprite);
|
||||
GC::Mark(p->pPlayerFloorSprite);
|
||||
GC::Mark(p->pPlayerGrenade);
|
||||
GC::Mark(p->pTarget);
|
||||
GC::Mark(getPlayer(i)->actor);
|
||||
GC::Mark(getPlayer(i)->pDoppleSprite);
|
||||
GC::Mark(getPlayer(i)->pPlayerFloorSprite);
|
||||
GC::Mark(getPlayer(i)->pPlayerGrenade);
|
||||
GC::Mark(getPlayer(i)->pTarget);
|
||||
}
|
||||
GC::MarkArray(nNetStartSprite, kMaxPlayers);
|
||||
return 6 * kMaxPlayers;
|
||||
|
@ -2238,7 +2237,7 @@ DEFINE_ACTION_FUNCTION(_Exhumed, GetPlayerClip)
|
|||
DEFINE_ACTION_FUNCTION(_ExhumedPlayer, IsUnderwater)
|
||||
{
|
||||
PARAM_SELF_STRUCT_PROLOGUE(ExhumedPlayer);
|
||||
auto nLocalPlayer = self - *PlayerArray;
|
||||
auto nLocalPlayer = self - (ExhumedPlayer*)PlayerArray;
|
||||
ACTION_RETURN_BOOL(getPlayer(nLocalPlayer)->pPlayerViewSect->Flag & kSectUnderwater);
|
||||
}
|
||||
|
||||
|
|
|
@ -117,11 +117,9 @@ struct ExhumedPlayer final : public CorePlayer
|
|||
|
||||
extern int PlayerCount;
|
||||
|
||||
extern ExhumedPlayer* PlayerArray[kMaxPlayers];
|
||||
|
||||
inline ExhumedPlayer* getPlayer(int index)
|
||||
{
|
||||
return PlayerArray[index];
|
||||
return static_cast<ExhumedPlayer*>(PlayerArray[index]);
|
||||
}
|
||||
|
||||
extern TObjPtr<DExhumedActor*> nNetStartSprite[kMaxPlayers];
|
||||
|
|
|
@ -118,16 +118,16 @@ void markgcroots()
|
|||
GC::MarkArray(GenericQueue, MAX_GENERIC_QUEUE);
|
||||
GC::MarkArray(LoWangsQueue, MAX_LOWANGS_QUEUE);
|
||||
GC::MarkArray(BossSpriteNum, 3);
|
||||
for (auto pl : PlayerArray)
|
||||
for (int i = 0; i < MAXPLAYERS; i++)
|
||||
{
|
||||
GC::Mark(pl->actor);
|
||||
GC::Mark(pl->lowActor);
|
||||
GC::Mark(pl->highActor);
|
||||
GC::Mark(pl->remoteActor);
|
||||
GC::Mark(pl->PlayerUnderActor);
|
||||
GC::Mark(pl->KillerActor);
|
||||
GC::Mark(pl->HitBy);
|
||||
GC::Mark(pl->last_camera_act);
|
||||
GC::Mark(getPlayer(i)->actor);
|
||||
GC::Mark(getPlayer(i)->lowActor);
|
||||
GC::Mark(getPlayer(i)->highActor);
|
||||
GC::Mark(getPlayer(i)->remoteActor);
|
||||
GC::Mark(getPlayer(i)->PlayerUnderActor);
|
||||
GC::Mark(getPlayer(i)->KillerActor);
|
||||
GC::Mark(getPlayer(i)->HitBy);
|
||||
GC::Mark(getPlayer(i)->last_camera_act);
|
||||
}
|
||||
for (auto& so : SectorObject)
|
||||
{
|
||||
|
@ -251,10 +251,10 @@ void GameInterface::SetupSpecialTextures(TilesetBuildInfo& info)
|
|||
void GameInterface::app_init()
|
||||
{
|
||||
// Initialise player array.
|
||||
for (unsigned i = 0; i < (MAX_SW_PLAYERS_REG+1); i++)
|
||||
for (unsigned i = 0; i < MAXPLAYERS; i++)
|
||||
{
|
||||
PlayerArray[i] = new SWPlayer;
|
||||
*PlayerArray[i] = {};
|
||||
*getPlayer(i) = {};
|
||||
}
|
||||
|
||||
// these are frequently checked markers.
|
||||
|
|
|
@ -1859,11 +1859,9 @@ struct SWPlayer final : public CorePlayer
|
|||
}
|
||||
};
|
||||
|
||||
extern SWPlayer* PlayerArray[MAX_SW_PLAYERS_REG+1];
|
||||
|
||||
inline SWPlayer* getPlayer(int index)
|
||||
{
|
||||
return PlayerArray[index];
|
||||
return static_cast<SWPlayer*>(PlayerArray[index]);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -2321,7 +2321,7 @@ extern ACTOR_ACTION_SET PlayerNinjaActionSet;
|
|||
|
||||
void InitPlayerSprite(SWPlayer* pp, const DVector3& spawnpos, const DAngle startang)
|
||||
{
|
||||
int pnum = int(pp - *PlayerArray);
|
||||
int pnum = int(pp - (SWPlayer*)PlayerArray);
|
||||
double fz,cz;
|
||||
extern bool NewGame;
|
||||
|
||||
|
@ -2408,7 +2408,7 @@ void SpawnPlayerUnderSprite(SWPlayer* pp)
|
|||
{
|
||||
DSWActor* plActor = pp->GetActor();
|
||||
|
||||
int pnum = int(pp - *PlayerArray);
|
||||
int pnum = int(pp - (SWPlayer*)PlayerArray);
|
||||
|
||||
pp->PlayerUnderActor = SpawnActor(STAT_PLAYER_UNDER0 + pnum,
|
||||
NINJA_RUN_R0, nullptr, pp->cursector, pp->GetActor()->getPosWithOffsetZ(), pp->GetActor()->spr.Angles.Yaw);
|
||||
|
|
|
@ -119,8 +119,6 @@ extern bool DebugOperate;
|
|||
|
||||
int ChopTics;
|
||||
|
||||
SWPlayer* PlayerArray[MAX_SW_PLAYERS_REG + 1];
|
||||
|
||||
// These are a bunch of kens variables for the player
|
||||
|
||||
short NormalVisibility;
|
||||
|
@ -1325,7 +1323,7 @@ void DoPlayerWarpTeleporter(SWPlayer* pp)
|
|||
|
||||
TRAVERSE_CONNECT(pnum)
|
||||
{
|
||||
if (pnum != pp - *PlayerArray)
|
||||
if (pnum != pp - (SWPlayer*)PlayerArray)
|
||||
{
|
||||
SWPlayer* npp = getPlayer(pnum);
|
||||
|
||||
|
@ -5458,7 +5456,7 @@ void DoPlayerDeathMessage(SWPlayer* pp, SWPlayer* killer)
|
|||
int pnum;
|
||||
bool SEND_OK = false;
|
||||
|
||||
killer->KilledPlayer[pp - *PlayerArray]++;
|
||||
killer->KilledPlayer[pp - (SWPlayer*)PlayerArray]++;
|
||||
|
||||
if (pp == killer && pp == getPlayer(myconnectindex))
|
||||
{
|
||||
|
@ -6968,7 +6966,7 @@ bool SpawnPositionUsed[MAX_SW_PLAYERS_REG+1];
|
|||
|
||||
void PlayerSpawnPosition(SWPlayer* pp)
|
||||
{
|
||||
short pnum = short(pp - *PlayerArray);
|
||||
short pnum = short(pp - (SWPlayer*)PlayerArray);
|
||||
short pos_num = pnum;
|
||||
int i;
|
||||
DSWActor* spawn_sprite = nullptr;
|
||||
|
|
|
@ -419,7 +419,7 @@ 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 - *PlayerArray) : -1;
|
||||
int ndx = w ? int(w - (SWPlayer*)PlayerArray) : -1;
|
||||
arc(keyname, ndx);
|
||||
w = ndx == -1 ? nullptr : getPlayer(ndx);
|
||||
return arc;
|
||||
|
@ -1100,7 +1100,8 @@ void GameInterface::SerializeGameState(FSerializer& arc)
|
|||
preSerializePanelSprites(arc);
|
||||
so_serializeinterpolations(arc);
|
||||
arc("numplayers", numplayers)
|
||||
.Array("players", PlayerArray, numplayers)
|
||||
#pragma message("SW: Fix saving!")
|
||||
//.Array("players", PlayerArray, numplayers)
|
||||
("skill", Skill)
|
||||
("screenpeek", screenpeek)
|
||||
.Array("sop", SectorObject, countof(SectorObject))
|
||||
|
|
|
@ -379,7 +379,7 @@ public:
|
|||
|
||||
int SoundSourceIndex(FSoundChan* chan) override
|
||||
{
|
||||
if (chan->SourceType == SOURCE_Player) return int((SWPlayer*)(chan->Source) - *PlayerArray);
|
||||
if (chan->SourceType == SOURCE_Player) return int((SWPlayer*)(chan->Source) - (SWPlayer*)PlayerArray);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -47,7 +47,7 @@ BEGIN_SW_NS
|
|||
|
||||
void PutStringInfo(SWPlayer* pp, const char *string)
|
||||
{
|
||||
if ((pp - *PlayerArray) == myconnectindex)
|
||||
if ((pp - (SWPlayer*)PlayerArray) == myconnectindex)
|
||||
Printf(PRINT_MEDIUM|PRINT_NOTIFY, "%s\n", string); // Put it in the console too
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue