- Move each game's stored nPlayer/pnum value to CorePlayer.

This commit is contained in:
Mitchell Richters 2023-10-02 18:44:04 +11:00
parent 16189ff7f9
commit ac35e09d1c
10 changed files with 93 additions and 96 deletions

View file

@ -9,6 +9,7 @@ struct CorePlayer
ticcmd_t lastcmd, cmd;
PlayerAngles Angles;
DCoreActor* actor;
uint8_t pnum;
virtual ~CorePlayer() { if (actor) actor->Destroy(); };
virtual DCoreActor* GetActor() = 0;

View file

@ -987,7 +987,7 @@ int aiDamageSprite(DBloodActor* source, DBloodActor* actor, DAMAGE_TYPE nDmgType
}
}
DPrintf(DMSG_SPAMMY, "Player #%d does the critical damage to patrol dude #%d!", pPlayer->nPlayer + 1, actor->GetIndex());
DPrintf(DMSG_SPAMMY, "Player #%d does the critical damage to patrol dude #%d!", pPlayer->pnum + 1, actor->GetIndex());
}
return nDamage;

View file

@ -167,7 +167,6 @@ struct BloodPlayer final : public CorePlayer
double swayWidth;
double oswayHeight;
double oswayWidth;
int nPlayer; // Connect id
int lifeMode;
double zView;
double ozView;

View file

@ -1942,7 +1942,7 @@ void windGenStopWindOnSectors(DBloodActor* sourceactor)
void trPlayerCtrlStartScene(DBloodActor* sourceactor, BloodPlayer* pPlayer, bool force)
{
TRPLAYERCTRL* pCtrl = &gPlayerCtrl[pPlayer->nPlayer];
TRPLAYERCTRL* pCtrl = &gPlayerCtrl[pPlayer->pnum];
if (pCtrl->qavScene.initiator != nullptr && !force) return;
@ -1984,7 +1984,7 @@ void trPlayerCtrlStartScene(DBloodActor* sourceactor, BloodPlayer* pPlayer, bool
void trPlayerCtrlStopScene(BloodPlayer* pPlayer)
{
TRPLAYERCTRL* pCtrl = &gPlayerCtrl[pPlayer->nPlayer];
TRPLAYERCTRL* pCtrl = &gPlayerCtrl[pPlayer->pnum];
auto initiator = pCtrl->qavScene.initiator;
if (initiator->hasX())
{
@ -2188,7 +2188,7 @@ void trPlayerCtrlSetLookAngle(int value, BloodPlayer* pPlayer)
if (const double adjustment = clamp(value * 0.125 * (value > 0 ? lookStepUp : lookStepDown), downAngle, upAngle))
{
setForcedSyncInput(pPlayer->nPlayer);
setForcedSyncInput(pPlayer->pnum);
pPlayer->GetActor()->spr.Angles.Pitch = maphoriz(-100. * tan(adjustment * pi::pi() * (1. / 1024.)));
}
}
@ -4331,9 +4331,9 @@ bool condCheckPlayer(DBloodActor* aCond, int cmpOp, bool PUSH)
switch (cond) {
case 0: // check if this player is connected
if (!condCmp(pPlayer->nPlayer + 1, arg1, arg2, cmpOp) || pPlayer->GetActor() == nullptr) return false;
if (!condCmp(pPlayer->pnum + 1, arg1, arg2, cmpOp) || pPlayer->GetActor() == nullptr) return false;
else if (PUSH) condPush(aCond, pPlayer->GetActor());
return (pPlayer->nPlayer >= 0);
return (pPlayer->pnum >= 0);
case 1: return condCmp((gGameOptions.nGameType != 3) ? 0 : pPlayer->teamId + 1, arg1, arg2, cmpOp); // compare team
case 2: return (arg1 > 0 && arg1 < 8 && pPlayer->hasKey[arg1 - 1]);
case 3: return (arg1 > 0 && arg1 < 15 && pPlayer->hasWeapon[arg1 - 1]);
@ -5995,7 +5995,7 @@ bool modernTypeOperateSprite(DBloodActor* actor, EVENT& event)
|| ((cmd < 67 || cmd > 68) && !modernTypeSetSpriteState(actor, actor->xspr.state ^ 1, initiator)))
return true;
TRPLAYERCTRL* pCtrl = &gPlayerCtrl[pPlayer->nPlayer];
TRPLAYERCTRL* pCtrl = &gPlayerCtrl[pPlayer->pnum];
/// !!! COMMANDS OF THE CURRENT SPRITE, NOT OF THE EVENT !!! ///
if ((cmd -= kCmdNumberic) < 0) return true;
@ -6060,12 +6060,12 @@ bool modernTypeOperateSprite(DBloodActor* actor, EVENT& event)
if (actor->xspr.data4 != 0) break;
else if (actor->spr.flags & kModernTypeFlag1)
{
setForcedSyncInput(pPlayer->nPlayer);
setForcedSyncInput(pPlayer->pnum);
pPlayer->GetActor()->spr.Angles.Yaw = actor->spr.Angles.Yaw;
}
else if (valueIsBetween(actor->xspr.data2, -kAng360, kAng360))
{
setForcedSyncInput(pPlayer->nPlayer);
setForcedSyncInput(pPlayer->pnum);
pPlayer->GetActor()->spr.Angles.Yaw = mapangle(actor->xspr.data2);
}
break;
@ -7307,7 +7307,7 @@ void playerQavSceneDraw(BloodPlayer* pPlayer, int shade, double xpos, double ypo
{
if (pPlayer == NULL || pPlayer->sceneQav == -1) return;
QAVSCENE* pQavScene = &gPlayerCtrl[pPlayer->nPlayer].qavScene;
QAVSCENE* pQavScene = &gPlayerCtrl[pPlayer->pnum].qavScene;
auto actor = pQavScene->initiator;
if (pQavScene->qavResrc != NULL)
@ -7351,7 +7351,7 @@ void playerQavScenePlay(BloodPlayer* pPlayer)
{
if (pPlayer == NULL) return;
QAVSCENE* pQavScene = &gPlayerCtrl[pPlayer->nPlayer].qavScene;
QAVSCENE* pQavScene = &gPlayerCtrl[pPlayer->pnum].qavScene;
if (pPlayer->sceneQav == -1 && pQavScene->initiator != nullptr)
pPlayer->sceneQav = pQavScene->initiator->xspr.data2;
@ -7365,7 +7365,7 @@ void playerQavScenePlay(BloodPlayer* pPlayer)
void playerQavSceneReset(BloodPlayer* pPlayer)
{
QAVSCENE* pQavScene = &gPlayerCtrl[pPlayer->nPlayer].qavScene;
QAVSCENE* pQavScene = &gPlayerCtrl[pPlayer->pnum].qavScene;
pQavScene->initiator = nullptr;
pQavScene->dummy = pPlayer->sceneQav = -1;
pQavScene->qavResrc = NULL;
@ -7415,7 +7415,7 @@ BloodPlayer* getPlayerById(int id)
id = id - 1;
for (int i = connecthead; i >= 0; i = connectpoint2[i])
{
if (id == getPlayer(i)->nPlayer)
if (id == getPlayer(i)->pnum)
return getPlayer(i);
}
@ -8433,7 +8433,7 @@ DBloodActor* aiPatrolSearchTargets(DBloodActor* actor)
bool invisible = (powerupCheck(pPlayer, kPwUpShadowCloak) > 0);
if (spritesTouching(actor, pPlayer->GetActor()) || spritesTouching(pPlayer->GetActor(), actor))
{
DPrintf(DMSG_SPAMMY, "Patrol dude #%d spot the Player #%d via touch.", actor->GetIndex(), pPlayer->nPlayer + 1);
DPrintf(DMSG_SPAMMY, "Patrol dude #%d spot the Player #%d via touch.", actor->GetIndex(), pPlayer->pnum + 1);
if (invisible) pPlayer->pwUpTime[kPwUpShadowCloak] = 0;
newtarget = pPlayer->GetActor();
break;
@ -8656,7 +8656,7 @@ DBloodActor* aiPatrolSearchTargets(DBloodActor* actor)
if (itCanHear && hearChance > 0)
{
DPrintf(DMSG_SPAMMY, "Patrol dude #%d hearing the Player #%d.", actor->GetIndex(), pPlayer->nPlayer + 1);
DPrintf(DMSG_SPAMMY, "Patrol dude #%d hearing the Player #%d.", actor->GetIndex(), pPlayer->pnum + 1);
actor->xspr.data3 = ClipRange(actor->xspr.data3 + hearChance, -kMaxPatrolSpotValue, kMaxPatrolSpotValue);
if (!stealth)
{

View file

@ -313,7 +313,7 @@ bool powerupActivate(BloodPlayer* pPlayer, int nPowerUp)
pPlayer->damageControl[0]++;
break;
case kItemReflectShots: // reflective shots
if (pPlayer->nPlayer == myconnectindex && gGameOptions.nGameType == 0)
if (pPlayer->pnum == myconnectindex && gGameOptions.nGameType == 0)
sfxSetReverb2(1);
break;
case kItemDeathMask:
@ -322,7 +322,7 @@ bool powerupActivate(BloodPlayer* pPlayer, int nPowerUp)
break;
case kItemDivingSuit: // diving suit
pPlayer->damageControl[4]++;
if (pPlayer->nPlayer == myconnectindex && gGameOptions.nGameType == 0)
if (pPlayer->pnum == myconnectindex && gGameOptions.nGameType == 0)
sfxSetReverb(1);
break;
case kItemGasMask:
@ -375,11 +375,11 @@ void powerupDeactivate(BloodPlayer* pPlayer, int nPowerUp)
break;
case kItemDivingSuit:
pPlayer->damageControl[4]--;
if (pPlayer && pPlayer->nPlayer == myconnectindex && VanillaMode() ? true : pPlayer->pwUpTime[24] == 0)
if (pPlayer && pPlayer->pnum == myconnectindex && VanillaMode() ? true : pPlayer->pwUpTime[24] == 0)
sfxSetReverb(0);
break;
case kItemReflectShots:
if (pPlayer && pPlayer->nPlayer == myconnectindex && VanillaMode() ? true : pPlayer->packSlots[1].isActive == 0)
if (pPlayer && pPlayer->pnum == myconnectindex && VanillaMode() ? true : pPlayer->packSlots[1].isActive == 0)
sfxSetReverb(0);
break;
case kItemGasMask:
@ -714,7 +714,7 @@ void playerResetInertia(BloodPlayer* pPlayer)
pPlayer->zView = pPlayer->GetActor()->spr.pos.Z - pPosture->eyeAboveZ;
pPlayer->zWeapon = pPlayer->GetActor()->spr.pos.Z - pPosture->weaponAboveZ;
pPlayer->GetActor()->oviewzoffset = pPlayer->GetActor()->viewzoffset = pPlayer->zView - pPlayer->GetActor()->spr.pos.Z;
viewBackupView(pPlayer->nPlayer);
viewBackupView(pPlayer->pnum);
}
void playerCorrectInertia(BloodPlayer* pPlayer, const DVector3& oldpos)
@ -883,7 +883,7 @@ void playerStart(int nPlayer, int bNewLevel)
BloodStatIterator it(kStatModernPlayerLinker);
while (auto iactor = it.Next())
{
if (!iactor->xspr.data1 || iactor->xspr.data1 == pPlayer->nPlayer + 1)
if (!iactor->xspr.data1 || iactor->xspr.data1 == pPlayer->pnum + 1)
{
DBloodActor* SpriteOld = iactor->prevmarker;
trPlayerCtrlLink(iactor, pPlayer, (SpriteOld == nullptr)); // this modifies iactor's prevmarker field!
@ -983,7 +983,7 @@ void playerInit(int nPlayer, unsigned int a2)
*getPlayer(nPlayer) = {};
BloodPlayer* pPlayer = getPlayer(nPlayer);
pPlayer->nPlayer = nPlayer;
pPlayer->pnum = nPlayer;
pPlayer->teamId = nPlayer;
if (gGameOptions.nGameType == 3)
pPlayer->teamId = nPlayer & 1;
@ -1064,7 +1064,7 @@ bool PickupItem(BloodPlayer* pPlayer, DBloodActor* itemactor)
pPlayer->hasFlag |= 1;
pPlayer->ctfFlagState[0] = itemactor;
trTriggerSprite(itemactor, kCmdOff);
sprintf(buffer, "%s stole Blue Flag", PlayerName(pPlayer->nPlayer));
sprintf(buffer, "%s stole Blue Flag", PlayerName(pPlayer->pnum));
sndStartSample(8007, 255, 2, 0);
viewSetMessage(buffer);
}
@ -1076,7 +1076,7 @@ bool PickupItem(BloodPlayer* pPlayer, DBloodActor* itemactor)
pPlayer->hasFlag &= ~1;
pPlayer->ctfFlagState[0] = nullptr;
trTriggerSprite(itemactor, kCmdOn);
sprintf(buffer, "%s returned Blue Flag", PlayerName(pPlayer->nPlayer));
sprintf(buffer, "%s returned Blue Flag", PlayerName(pPlayer->pnum));
sndStartSample(8003, 255, 2, 0);
viewSetMessage(buffer);
}
@ -1087,7 +1087,7 @@ bool PickupItem(BloodPlayer* pPlayer, DBloodActor* itemactor)
team_score[pPlayer->teamId] += 10;
team_ticker[pPlayer->teamId] += 240;
evSendGame(81, kCmdOn);
sprintf(buffer, "%s captured Red Flag!", PlayerName(pPlayer->nPlayer));
sprintf(buffer, "%s captured Red Flag!", PlayerName(pPlayer->pnum));
sndStartSample(8001, 255, 2, 0);
viewSetMessage(buffer);
}
@ -1101,7 +1101,7 @@ bool PickupItem(BloodPlayer* pPlayer, DBloodActor* itemactor)
pPlayer->hasFlag |= 2;
pPlayer->ctfFlagState[1] = itemactor;
trTriggerSprite(itemactor, kCmdOff);
sprintf(buffer, "%s stole Red Flag", PlayerName(pPlayer->nPlayer));
sprintf(buffer, "%s stole Red Flag", PlayerName(pPlayer->pnum));
sndStartSample(8006, 255, 2, 0);
viewSetMessage(buffer);
}
@ -1113,7 +1113,7 @@ bool PickupItem(BloodPlayer* pPlayer, DBloodActor* itemactor)
pPlayer->hasFlag &= ~2;
pPlayer->ctfFlagState[1] = nullptr;
trTriggerSprite(itemactor, kCmdOn);
sprintf(buffer, "%s returned Red Flag", PlayerName(pPlayer->nPlayer));
sprintf(buffer, "%s returned Red Flag", PlayerName(pPlayer->pnum));
sndStartSample(8002, 255, 2, 0);
viewSetMessage(buffer);
}
@ -1124,7 +1124,7 @@ bool PickupItem(BloodPlayer* pPlayer, DBloodActor* itemactor)
team_score[pPlayer->teamId] += 10;
team_ticker[pPlayer->teamId] += 240;
evSendGame(80, kCmdOn);
sprintf(buffer, "%s captured Blue Flag!", PlayerName(pPlayer->nPlayer));
sprintf(buffer, "%s captured Blue Flag!", PlayerName(pPlayer->pnum));
sndStartSample(8000, 255, 2, 0);
viewSetMessage(buffer);
}
@ -1141,7 +1141,7 @@ bool PickupItem(BloodPlayer* pPlayer, DBloodActor* itemactor)
pPlayer->hasFlag &= ~1;
pPlayer->ctfFlagState[0] = nullptr;
trTriggerSprite(itemactor->GetOwner(), kCmdOn);
sprintf(buffer, "%s returned Blue Flag", PlayerName(pPlayer->nPlayer));
sprintf(buffer, "%s returned Blue Flag", PlayerName(pPlayer->pnum));
sndStartSample(8003, 255, 2, 0);
viewSetMessage(buffer);
break;
@ -1150,7 +1150,7 @@ bool PickupItem(BloodPlayer* pPlayer, DBloodActor* itemactor)
pPlayer->ctfFlagState[0] = itemactor->GetOwner();
if (enemyTeam)
{
sprintf(buffer, "%s stole Blue Flag", PlayerName(pPlayer->nPlayer));
sprintf(buffer, "%s stole Blue Flag", PlayerName(pPlayer->pnum));
sndStartSample(8007, 255, 2, 0);
viewSetMessage(buffer);
}
@ -1165,7 +1165,7 @@ bool PickupItem(BloodPlayer* pPlayer, DBloodActor* itemactor)
pPlayer->hasFlag &= ~2;
pPlayer->ctfFlagState[1] = nullptr;
trTriggerSprite(itemactor->GetOwner(), kCmdOn);
sprintf(buffer, "%s returned Red Flag", PlayerName(pPlayer->nPlayer));
sprintf(buffer, "%s returned Red Flag", PlayerName(pPlayer->pnum));
sndStartSample(8002, 255, 2, 0);
viewSetMessage(buffer);
break;
@ -1174,7 +1174,7 @@ bool PickupItem(BloodPlayer* pPlayer, DBloodActor* itemactor)
pPlayer->ctfFlagState[1] = itemactor->GetOwner();
if (enemyTeam)
{
sprintf(buffer, "%s stole Red Flag", PlayerName(pPlayer->nPlayer));
sprintf(buffer, "%s stole Red Flag", PlayerName(pPlayer->pnum));
sndStartSample(8006, 255, 2, 0);
viewSetMessage(buffer);
}
@ -1362,7 +1362,7 @@ void PickUp(BloodPlayer* pPlayer, DBloodActor* actor)
actPostSprite(actor, kStatFree);
pPlayer->pickupEffect = 30;
if (pPlayer->nPlayer == myconnectindex) {
if (pPlayer->pnum == myconnectindex) {
if (customMsg > 0) trTextOver(customMsg - 1);
else if (msg) viewSetMessage(msg, nullptr, MESSAGE_PRIORITY_PICKUP);
}
@ -1437,7 +1437,7 @@ int ActionScan(BloodPlayer* pPlayer, HitInfo* out)
{
if (gGameOptions.nGameType > 1 && findDroppedLeech(pPlayer, hitactor))
return -1;
hitactor->xspr.data4 = pPlayer->nPlayer;
hitactor->xspr.data4 = pPlayer->pnum;
hitactor->xspr.isTriggered = 0;
}
}
@ -1533,7 +1533,7 @@ void ProcessInput(BloodPlayer* pPlayer)
if (actor->xspr.health == 0)
{
// force synchronised input upon death.
setForcedSyncInput(pPlayer->nPlayer);
setForcedSyncInput(pPlayer->pnum);
bool bSeqStat = playerSeqPlaying(pPlayer, 16);
DBloodActor* fragger = pPlayer->fragger;
@ -1565,7 +1565,7 @@ void ProcessInput(BloodPlayer* pPlayer)
gameaction = ga_autoloadgame;
}
else
playerStart(pPlayer->nPlayer);
playerStart(pPlayer->pnum);
}
pInput->actions &= ~SB_OPEN;
}
@ -1627,7 +1627,7 @@ void ProcessInput(BloodPlayer* pPlayer)
auto pSector = result.hitSector;
auto pXSector = &pSector->xs();
int key = pXSector->Key;
if (pXSector->locked && pPlayer->nPlayer == myconnectindex)
if (pXSector->locked && pPlayer->pnum == myconnectindex)
{
viewSetMessage(GStrings("TXTB_LOCKED"));
auto snd = 3062;
@ -1637,7 +1637,7 @@ void ProcessInput(BloodPlayer* pPlayer)
}
if (!key || pPlayer->hasKey[key])
trTriggerSector(pSector, kCmdSpritePush);
else if (pPlayer->nPlayer == myconnectindex)
else if (pPlayer->pnum == myconnectindex)
{
viewSetMessage(GStrings("TXTB_KEY"));
auto snd = 3063;
@ -1652,7 +1652,7 @@ void ProcessInput(BloodPlayer* pPlayer)
auto pWall = result.hitWall;
auto pXWall = &pWall->xw();
int key = pXWall->key;
if (pXWall->locked && pPlayer->nPlayer == myconnectindex)
if (pXWall->locked && pPlayer->pnum == myconnectindex)
{
viewSetMessage(GStrings("TXTB_LOCKED"));
auto snd = 3062;
@ -1662,7 +1662,7 @@ void ProcessInput(BloodPlayer* pPlayer)
}
if (!key || pPlayer->hasKey[key])
trTriggerWall(pWall, kCmdWallPush);
else if (pPlayer->nPlayer == myconnectindex)
else if (pPlayer->pnum == myconnectindex)
{
viewSetMessage(GStrings("TXTB_KEY"));
auto snd = 3063;
@ -1676,11 +1676,11 @@ void ProcessInput(BloodPlayer* pPlayer)
{
auto act = result.actor();
int key = act->xspr.key;
if (actor->xspr.locked && pPlayer->nPlayer == myconnectindex && act->xspr.lockMsg)
if (actor->xspr.locked && pPlayer->pnum == myconnectindex && act->xspr.lockMsg)
trTextOver(act->xspr.lockMsg);
if (!key || pPlayer->hasKey[key])
trTriggerSprite(act, kCmdSpritePush);
else if (pPlayer->nPlayer == myconnectindex)
else if (pPlayer->pnum == myconnectindex)
{
viewSetMessage(GStrings("TXTB_KEY"));
sndStartSample(3063, 255, 2, 0);
@ -1844,7 +1844,7 @@ void playerProcess(BloodPlayer* pPlayer)
pPlayer->painEffect = ClipLow(pPlayer->painEffect - 4, 0);
pPlayer->blindEffect = ClipLow(pPlayer->blindEffect - 4, 0);
pPlayer->pickupEffect = ClipLow(pPlayer->pickupEffect - 4, 0);
if (pPlayer->nPlayer == myconnectindex && pPlayer->GetActor()->xspr.health == 0)
if (pPlayer->pnum == myconnectindex && pPlayer->GetActor()->xspr.health == 0)
pPlayer->hand = 0;
if (!actor->xspr.health)
return;
@ -1928,7 +1928,7 @@ void playerFrag(BloodPlayer* pKiller, BloodPlayer* pVictim)
team_score[pVictim->teamId]--;
int nMessage = Random(5);
int nSound = gSuicide[nMessage].Kills;
if (pVictim->nPlayer == myconnectindex && pVictim->handTime <= 0)
if (pVictim->pnum == myconnectindex && pVictim->handTime <= 0)
{
strcpy(buffer, GStrings("TXTB_KILLSELF"));
if (gGameOptions.nGameType > 0 && nSound >= 0)
@ -1960,7 +1960,7 @@ void playerFrag(BloodPlayer* pKiller, BloodPlayer* pVictim)
int nSound = gVictory[nMessage].Kills;
const char* pzMessage = gVictory[nMessage].message;
sprintf(buffer, pzMessage, PlayerName(nKiller), PlayerName(nVictim));
if (gGameOptions.nGameType > 0 && nSound >= 0 && pKiller->nPlayer == myconnectindex)
if (gGameOptions.nGameType > 0 && nSound >= 0 && pKiller->pnum == myconnectindex)
sndStartSample(nSound, 255, 2, 0);
}
viewSetMessage(buffer);
@ -2042,7 +2042,7 @@ void flagDropped(BloodPlayer* pPlayer, int a2)
actor = actDropObject(playeractor, kItemFlagA);
if (actor) actor->SetOwner(pPlayer->ctfFlagState[0]);
gBlueFlagDropped = true;
sprintf(buffer, "%s dropped Blue Flag", PlayerName(pPlayer->nPlayer));
sprintf(buffer, "%s dropped Blue Flag", PlayerName(pPlayer->pnum));
sndStartSample(8005, 255, 2, 0);
viewSetMessage(buffer);
break;
@ -2051,7 +2051,7 @@ void flagDropped(BloodPlayer* pPlayer, int a2)
actor = actDropObject(playeractor, kItemFlagB);
if (actor) actor->SetOwner(pPlayer->ctfFlagState[1]);
gRedFlagDropped = true;
sprintf(buffer, "%s dropped Red Flag", PlayerName(pPlayer->nPlayer));
sprintf(buffer, "%s dropped Red Flag", PlayerName(pPlayer->pnum));
sndStartSample(8004, 255, 2, 0);
viewSetMessage(buffer);
break;
@ -2321,11 +2321,11 @@ void PlayerSurvive(int, DBloodActor* actor)
if (actor->IsPlayerActor())
{
BloodPlayer* pPlayer = getPlayer(actor->spr.type - kDudePlayer1);
if (pPlayer->nPlayer == myconnectindex)
if (pPlayer->pnum == myconnectindex)
viewSetMessage(GStrings("TXT_LIVEAGAIM"));
else
{
sprintf(buffer, "%s lives again!", PlayerName(pPlayer->nPlayer));
sprintf(buffer, "%s lives again!", PlayerName(pPlayer->pnum));
viewSetMessage(buffer);
}
pPlayer->newWeapon = kWeapPitchFork;
@ -2413,7 +2413,7 @@ FSerializer& Serialize(FSerializer& arc, const char* keyname, BloodPlayer& w, Bl
("swayamp", w.swayAmp)
("swayheight", w.swayHeight)
("swaywidth", w.swayWidth)
("nplayer", w.nPlayer)
("nplayer", w.pnum)
("lifemode", w.lifeMode)
("zview", w.zView)
("zviewvel", w.zViewVel)
@ -2575,7 +2575,7 @@ DEFINE_FIELD_X(BloodPlayer, BloodPlayer, bobWidth)
DEFINE_FIELD_X(BloodPlayer, BloodPlayer, swayAmp)
DEFINE_FIELD_X(BloodPlayer, BloodPlayer, swayHeight)
DEFINE_FIELD_X(BloodPlayer, BloodPlayer, swayWidth)
DEFINE_FIELD_X(BloodPlayer, BloodPlayer, nPlayer) // Connect id
DEFINE_FIELD_X(BloodPlayer, BloodPlayer, pnum) // Connect id
DEFINE_FIELD_X(BloodPlayer, BloodPlayer, lifeMode)
DEFINE_FIELD_X(BloodPlayer, BloodPlayer, zView)
DEFINE_FIELD_X(BloodPlayer, BloodPlayer, zViewVel)

View file

@ -740,9 +740,9 @@ void viewDrawScreen(bool sceneonly)
auto text = GStrings("TXTB_PAUSED");
viewDrawText(PickBigFont(text), text, 160, 10, 0, 0, 1, 0);
}
else if (pPlayer->nPlayer != myconnectindex)
else if (pPlayer->pnum != myconnectindex)
{
FStringf gTempStr("] %s [", PlayerName(pPlayer->nPlayer));
FStringf gTempStr("] %s [", PlayerName(pPlayer->pnum));
viewDrawText(OriginalSmallFont, gTempStr, 160, 10, 0, 0, 1, 0);
}
if (cl_interpolate)

View file

@ -446,7 +446,7 @@ void UpdateAimVector(BloodPlayer* pPlayer)
WEAPONTRACK* pWeaponTrack = &gWeaponTrack[pPlayer->curWeapon];
DBloodActor* targetactor = nullptr;
pPlayer->aimTargetsCount = 0;
int autoaim = Autoaim(pPlayer->nPlayer);
int autoaim = Autoaim(pPlayer->pnum);
if (autoaim == 1 || (autoaim == 2 && !pWeaponTrack->bIsProjectile) || pPlayer->curWeapon == kWeapVoodooDoll || pPlayer->curWeapon == kWeapLifeLeech)
{
double nClosest = 0x7fffffff;
@ -2375,8 +2375,8 @@ void WeaponProcess(BloodPlayer* pPlayer) {
pPlayer->flashEffect = ClipLow(pPlayer->flashEffect - 1, 0);
#ifdef NOONE_EXTENSIONS
if (gPlayerCtrl[pPlayer->nPlayer].qavScene.initiator != nullptr && pPlayer->GetActor()->xspr.health > 0) {
playerQavSceneProcess(pPlayer, &gPlayerCtrl[pPlayer->nPlayer].qavScene);
if (gPlayerCtrl[pPlayer->pnum].qavScene.initiator != nullptr && pPlayer->GetActor()->xspr.health > 0) {
playerQavSceneProcess(pPlayer, &gPlayerCtrl[pPlayer->pnum].qavScene);
UpdateAimVector(pPlayer);
return;
}

View file

@ -282,7 +282,7 @@ void RestartPlayer(int nPlayer)
pPlayer->pDoppleSprite = pDopSprite;
pPlayer->pPlayerFloorSprite = pFloorSprite;
pPlayer->pPlayerViewSect = pPlayer->sPlayerSave.pSector;
pPlayer->nPlayer = nPlayer;
pPlayer->pnum = nPlayer;
pPlayer->nHealth = 800; // TODO - define
pPlayer->Angles.initialize(pPlayerActor);
pPlayer->bIsMummified = false;
@ -710,7 +710,7 @@ static DExhumedActor* feebtag(const DVector3& pos, sectortype* pSector, int nMag
static void doPickupNotification(ExhumedPlayer* const pPlayer, const int nItem, const int nSound = -1, const int tintRed = 0, const int tintGreen = 16)
{
if (pPlayer->nPlayer != nLocalPlayer)
if (pPlayer->pnum != nLocalPlayer)
return;
if (nItemText[nItem] > -1 && nTotalPlayers == 1)
@ -761,17 +761,17 @@ static void doPickupWeapon(ExhumedPlayer* pPlayer, DExhumedActor* pPickupActor,
if (pPlayer->nPlayerWeapons & weapFlag)
{
if (currentLevel->gameflags & LEVEL_EX_MULTI)
AddAmmo(pPlayer->nPlayer, WeaponInfo[nWeapon].nAmmoType, nAmount);
AddAmmo(pPlayer->pnum, WeaponInfo[nWeapon].nAmmoType, nAmount);
}
else
{
SetNewWeaponIfBetter(pPlayer->nPlayer, nWeapon);
SetNewWeaponIfBetter(pPlayer->pnum, nWeapon);
pPlayer->nPlayerWeapons |= weapFlag;
AddAmmo(pPlayer->nPlayer, WeaponInfo[nWeapon].nAmmoType, nAmount);
AddAmmo(pPlayer->pnum, WeaponInfo[nWeapon].nAmmoType, nAmount);
}
if (nWeapon == 2)
CheckClip(pPlayer->nPlayer);
CheckClip(pPlayer->pnum);
if (nItem > 50)
{
@ -810,7 +810,7 @@ static void doPickupHealth(ExhumedPlayer* pPlayer, DExhumedActor* pPickupActor,
else if (pPlayer->nHealth < 0)
{
nSound = -1;
StartDeathSeq(pPlayer->nPlayer, 0);
StartDeathSeq(pPlayer->pnum, 0);
}
}
@ -857,9 +857,9 @@ void doPlayerItemPickups(ExhumedPlayer* const pPlayer)
case 6: // Speed Loader
case 7: // Fuel Canister
case 8: // M - 60 Ammo Belt
if (AddAmmo(pPlayer->nPlayer, ammoArray[nItem - 6], pPickupActor->spr.hitag))
if (AddAmmo(pPlayer->pnum, ammoArray[nItem - 6], pPickupActor->spr.hitag))
{
if (nItem == 8) CheckClip(pPlayer->nPlayer);
if (nItem == 8) CheckClip(pPlayer->pnum);
doPickupDestroy(pPickupActor, nItem);
doPickupNotification(pPlayer, nItem, StaticSound[kSoundAmmoPickup]);
}
@ -868,12 +868,12 @@ void doPlayerItemPickups(ExhumedPlayer* const pPlayer)
case 9: // Grenade
case 27: // May not be grenade, needs confirmation
case 55:
if (AddAmmo(pPlayer->nPlayer, 4, 1))
if (AddAmmo(pPlayer->pnum, 4, 1))
{
if (!(pPlayer->nPlayerWeapons & 0x10))
{
pPlayer->nPlayerWeapons |= 0x10;
SetNewWeaponIfBetter(pPlayer->nPlayer, 4);
SetNewWeaponIfBetter(pPlayer->pnum, 4);
}
if (nItem == 55)
@ -940,7 +940,7 @@ void doPlayerItemPickups(ExhumedPlayer* const pPlayer)
case 21: // Unseen eye(Invisibility)
case 22: // Torch
case 23: // Sobek Mask
if (GrabItem(pPlayer->nPlayer, itemArray[nItem - 18]))
if (GrabItem(pPlayer->pnum, itemArray[nItem - 18]))
{
doPickupDestroy(pPickupActor, nItem);
doPickupNotification(pPlayer, nItem);
@ -978,7 +978,7 @@ void doPlayerItemPickups(ExhumedPlayer* const pPlayer)
case 37: // Cobra staff ammo
case 38: // Raw Energy
if (AddAmmo(pPlayer->nPlayer, nItem - 32, (nItem == 38) ? pPickupActor->spr.hitag : 1))
if (AddAmmo(pPlayer->pnum, nItem - 32, (nItem == 38) ? pPickupActor->spr.hitag : 1))
{
doPickupDestroy(pPickupActor, nItem);
doPickupNotification(pPlayer, nItem, StaticSound[kSoundAmmoPickup]);
@ -1015,14 +1015,14 @@ void doPlayerItemPickups(ExhumedPlayer* const pPlayer)
break;
case 59: // Scarab (Checkpoint)
if (nLocalPlayer == pPlayer->nPlayer)
if (nLocalPlayer == pPlayer->pnum)
{
pPickupActor->nSeqIndex++;
pPickupActor->nFlags &= 0xEF;
pPickupActor->nFrame = 0;
ChangeActorStat(pPickupActor, 899);
}
SetSavePoint(pPlayer->nPlayer, pPlayerActor->spr.pos, pPlayerSect, pPlayerActor->spr.Angles.Yaw);
SetSavePoint(pPlayer->pnum, pPlayerActor->spr.pos, pPlayerSect, pPlayerActor->spr.Angles.Yaw);
break;
case 60: // Golden Sarcophagus (End Level)
@ -1043,7 +1043,7 @@ void doPlayerItemPickups(ExhumedPlayer* const pPlayer)
void updatePlayerTarget(ExhumedPlayer* const pPlayer)
{
const auto pPlayerActor = pPlayer->GetActor();
const auto pRa = &Ra[pPlayer->nPlayer];
const auto pRa = &Ra[pPlayer->pnum];
const auto nAngVect = (-pPlayerActor->spr.Angles.Yaw).ToVector();
DExhumedActor* bestTarget = nullptr;
@ -1087,7 +1087,7 @@ void updatePlayerTarget(ExhumedPlayer* const pPlayer)
if (bestTarget)
{
if (pPlayer->nPlayer == nLocalPlayer)
if (pPlayer->pnum == nLocalPlayer)
nCreepyTimer = kCreepyCount;
if (!cansee(pPlayerActor->spr.pos, pPlayerActor->sector(), bestTarget->spr.pos.plusZ(-GetActorHeight(bestTarget)), bestTarget->sector()))
@ -1164,7 +1164,7 @@ static void updatePlayerInventory(ExhumedPlayer* const pPlayer)
if (pPlayer->items[i] > 0 && nItemMagic[i] <= pPlayer->nMagic)
{
UseItem(pPlayer->nPlayer, i);
UseItem(pPlayer->pnum, i);
break;
}
}
@ -1203,7 +1203,7 @@ static void updatePlayerWeapon(ExhumedPlayer* const pPlayer)
}
while (nextWeap && (!haveWeap || (haveWeap && !pPlayer->nAmmo[nextWeap])));
SetNewWeapon(pPlayer->nPlayer, nextWeap);
SetNewWeapon(pPlayer->pnum, nextWeap);
}
else if (newWeap == WeaponSel_Alt)
{
@ -1211,7 +1211,7 @@ static void updatePlayerWeapon(ExhumedPlayer* const pPlayer)
}
else if (pPlayer->nPlayerWeapons & (1 << (newWeap - 1)))
{
SetNewWeapon(pPlayer->nPlayer, newWeap - 1);
SetNewWeapon(pPlayer->pnum, newWeap - 1);
}
}
@ -1355,7 +1355,7 @@ static void updatePlayerAction(ExhumedPlayer* const pPlayer)
static void doPlayerCounters(ExhumedPlayer* const pPlayer)
{
const auto pPlayerActor = pPlayer->GetActor();
const bool bConsolePlayer = pPlayer->nPlayer == nLocalPlayer;
const bool bConsolePlayer = pPlayer->pnum == nLocalPlayer;
if (pPlayer->nTorch > 0)
{
@ -1363,7 +1363,7 @@ static void doPlayerCounters(ExhumedPlayer* const pPlayer)
if (pPlayer->nTorch == 0)
{
SetTorch(pPlayer->nPlayer, 0);
SetTorch(pPlayer->pnum, 0);
}
else if (!bConsolePlayer)
{
@ -1468,7 +1468,7 @@ static void doPlayerUnderwater(ExhumedPlayer* const pPlayer, const bool oUnderwa
if (pPlayer->nHealth <= 0)
{
pPlayer->nHealth = 0;
StartDeathSeq(pPlayer->nPlayer, 0);
StartDeathSeq(pPlayer->pnum, 0);
}
pPlayer->nAir = 0;
@ -1476,7 +1476,7 @@ static void doPlayerUnderwater(ExhumedPlayer* const pPlayer, const bool oUnderwa
}
}
DoBubbles(pPlayer->nPlayer);
DoBubbles(pPlayer->pnum);
}
}
}
@ -1486,7 +1486,7 @@ static void doPlayerUnderwater(ExhumedPlayer* const pPlayer, const bool oUnderwa
if (pPlayer->nTorch > 0)
{
pPlayer->nTorch = 0;
SetTorch(pPlayer->nPlayer, 0);
SetTorch(pPlayer->pnum, 0);
}
}
else
@ -1525,7 +1525,7 @@ static void doPlayerUnderwater(ExhumedPlayer* const pPlayer, const bool oUnderwa
static void doPlayerRamses(ExhumedPlayer* const pPlayer)
{
setForcedSyncInput(pPlayer->nPlayer);
setForcedSyncInput(pPlayer->pnum);
if (nTotalPlayers <= 1)
{
@ -1685,7 +1685,7 @@ static void updatePlayerViewSector(ExhumedPlayer* const pPlayer, const Collision
pPlayer->pPlayerViewSect = pViewSect;
if (nLocalPlayer == pPlayer->nPlayer)
if (nLocalPlayer == pPlayer->pnum)
CheckAmbience(pPlayer->pPlayerViewSect);
}
@ -1880,15 +1880,15 @@ static void doPlayerRunlistSignals(ExhumedPlayer* const pPlayer, sectortype* con
const auto pPlayerSect = pPlayerActor->sector();
if (pPlayer->bTouchFloor && pPlayerSect->lotag > 0)
runlist_SignalRun(pPlayerSect->lotag - 1, pPlayer->nPlayer, &ExhumedAI::TouchFloor);
runlist_SignalRun(pPlayerSect->lotag - 1, pPlayer->pnum, &ExhumedAI::TouchFloor);
if (pStartSect != pPlayerSect)
{
if (pStartSect->lotag > 0)
runlist_SignalRun(pStartSect->lotag - 1, pPlayer->nPlayer, &ExhumedAI::EnterSector);
runlist_SignalRun(pStartSect->lotag - 1, pPlayer->pnum, &ExhumedAI::EnterSector);
if (pPlayerSect->lotag > 0)
runlist_SignalRun(pPlayerSect->lotag - 1, pPlayer->nPlayer, &ExhumedAI::LeaveSector);
runlist_SignalRun(pPlayerSect->lotag - 1, pPlayer->pnum, &ExhumedAI::LeaveSector);
}
if (!pPlayer->bIsMummified && (pPlayer->cmd.ucmd.actions & SB_OPEN))
@ -1900,10 +1900,10 @@ static void doPlayerRunlistSignals(ExhumedPlayer* const pPlayer, sectortype* con
neartag(pPlayerActor->spr.pos, pPlayerSect, pPlayerActor->spr.Angles.Yaw, near, 128., NT_Hitag | NT_NoSpriteCheck);
if (near.hitWall != nullptr && near.hitWall->lotag > 0)
runlist_SignalRun(near.hitWall->lotag - 1, pPlayer->nPlayer, &ExhumedAI::Use);
runlist_SignalRun(near.hitWall->lotag - 1, pPlayer->pnum, &ExhumedAI::Use);
if (near.hitSector != nullptr && near.hitSector->lotag > 0)
runlist_SignalRun(near.hitSector->lotag - 1, pPlayer->nPlayer, &ExhumedAI::Use);
runlist_SignalRun(near.hitSector->lotag - 1, pPlayer->pnum, &ExhumedAI::Use);
}
}
@ -1920,7 +1920,7 @@ static bool doPlayerDeathRestart(ExhumedPlayer* const pPlayer)
pPlayer->cmd.ucmd.actions &= ~SB_OPEN;
if (pPlayer->nPlayer == nLocalPlayer)
if (pPlayer->pnum == nLocalPlayer)
{
StopAllSounds();
StopLocalSound();
@ -1940,7 +1940,7 @@ static bool doPlayerDeathRestart(ExhumedPlayer* const pPlayer)
}
// will invalidate nPlayerSprite
RestartPlayer(pPlayer->nPlayer);
RestartPlayer(pPlayer->pnum);
inputState.ClearAllInput();
gameInput.Clear();
}
@ -1994,7 +1994,7 @@ static void doPlayerActionSequence(ExhumedPlayer* const pPlayer)
if (!RandomSize(5))
{
sectortype* mouthSect;
const auto pos = WheresMyMouth(pPlayer->nPlayer, &mouthSect);
const auto pos = WheresMyMouth(pPlayer->pnum, &mouthSect);
BuildAnim(nullptr, "blood", 0, DVector3(pos.XY(), pPlayerActor->spr.pos.Z + 15), mouthSect, 1.171875, 128);
}
break;
@ -2039,7 +2039,7 @@ static void doPlayerDeathPitch(ExhumedPlayer* const pPlayer)
}
else if (pPlayerActor->spr.Angles.Pitch.Sgn() >= 0 && !(pPlayerActor->sector()->Flag & kSectUnderwater))
{
SetNewWeapon(pPlayer->nPlayer, pPlayer->nDeathType + 8);
SetNewWeapon(pPlayer->pnum, pPlayer->nDeathType + 8);
}
pPlayer->dVertPan--;

View file

@ -89,7 +89,6 @@ struct ExhumedPlayer final : public CorePlayer
uint16_t nPlayerWeapons; // each set bit represents a weapon the player has
int16_t dVertPan;
double nQuake;
uint8_t nPlayer;
int16_t nTemperature;
double nStandHeight;
PlayerSave sPlayerSave;

View file

@ -1734,8 +1734,6 @@ struct SWPlayer final : public CorePlayer
DAngle RevolveDeltaAng;
DAngle RevolveAng;
int16_t pnum; // carry along the player number
sectortype* LadderSector;
DVector2 LadderPosition; // ladder x and y