- store an actual actor pointer in PLAYER.

# Conflicts:
#	source/games/blood/src/player.cpp
This commit is contained in:
Christoph Oelckers 2021-09-05 09:53:06 +02:00
parent 812b18e49a
commit fb95f0fff7
22 changed files with 121 additions and 129 deletions

View file

@ -1537,7 +1537,7 @@ void aiThinkTarget(DBloodActor* actor)
for (int p = connecthead; p >= 0; p = connectpoint2[p]) for (int p = connecthead; p >= 0; p = connectpoint2[p])
{ {
PLAYER* pPlayer = &gPlayer[p]; PLAYER* pPlayer = &gPlayer[p];
if (actor->GetOwner() == pPlayer->actor() || pPlayer->pXSprite->health == 0 || powerupCheck(pPlayer, kPwUpShadowCloak) > 0) if (actor->GetOwner() == pPlayer->actor || pPlayer->pXSprite->health == 0 || powerupCheck(pPlayer, kPwUpShadowCloak) > 0)
continue; continue;
int x = pPlayer->pSprite->x; int x = pPlayer->pSprite->x;
int y = pPlayer->pSprite->y; int y = pPlayer->pSprite->y;
@ -1554,7 +1554,7 @@ void aiThinkTarget(DBloodActor* actor)
int nDeltaAngle = ((getangle(dx, dy) + 1024 - pSprite->ang) & 2047) - 1024; int nDeltaAngle = ((getangle(dx, dy) + 1024 - pSprite->ang) & 2047) - 1024;
if (nDist < pDudeInfo->seeDist && abs(nDeltaAngle) <= pDudeInfo->periphery) if (nDist < pDudeInfo->seeDist && abs(nDeltaAngle) <= pDudeInfo->periphery)
{ {
aiSetTarget(actor, pPlayer->actor()); aiSetTarget(actor, pPlayer->actor);
aiActivateDude(actor); aiActivateDude(actor);
return; return;
} }
@ -1585,7 +1585,7 @@ void aiLookForTarget(DBloodActor* actor)
for (int p = connecthead; p >= 0; p = connectpoint2[p]) for (int p = connecthead; p >= 0; p = connectpoint2[p])
{ {
PLAYER* pPlayer = &gPlayer[p]; PLAYER* pPlayer = &gPlayer[p];
if (actor->GetOwner() == pPlayer->actor() || pPlayer->pXSprite->health == 0 || powerupCheck(pPlayer, kPwUpShadowCloak) > 0) if (actor->GetOwner() == pPlayer->actor || pPlayer->pXSprite->health == 0 || powerupCheck(pPlayer, kPwUpShadowCloak) > 0)
continue; continue;
int x = pPlayer->pSprite->x; int x = pPlayer->pSprite->x;
int y = pPlayer->pSprite->y; int y = pPlayer->pSprite->y;
@ -1601,7 +1601,7 @@ void aiLookForTarget(DBloodActor* actor)
int nDeltaAngle = ((getangle(dx, dy) + 1024 - pSprite->ang) & 2047) - 1024; int nDeltaAngle = ((getangle(dx, dy) + 1024 - pSprite->ang) & 2047) - 1024;
if (nDist < pDudeInfo->seeDist && abs(nDeltaAngle) <= pDudeInfo->periphery) if (nDist < pDudeInfo->seeDist && abs(nDeltaAngle) <= pDudeInfo->periphery)
{ {
aiSetTarget(actor, pPlayer->actor()); aiSetTarget(actor, pPlayer->actor);
aiActivateDude(actor); aiActivateDude(actor);
return; return;
} }

View file

@ -117,7 +117,7 @@ static void batThinkTarget(DBloodActor* actor)
int nDeltaAngle = ((getangle(dx, dy) + 1024 - pSprite->ang) & 2047) - 1024; int nDeltaAngle = ((getangle(dx, dy) + 1024 - pSprite->ang) & 2047) - 1024;
if (nDist < pDudeInfo->seeDist && abs(nDeltaAngle) <= pDudeInfo->periphery) if (nDist < pDudeInfo->seeDist && abs(nDeltaAngle) <= pDudeInfo->periphery)
{ {
aiSetTarget(actor, pPlayer->actor()); aiSetTarget(actor, pPlayer->actor);
aiActivateDude(actor); aiActivateDude(actor);
} }
else if (nDist < pDudeInfo->hearDist) else if (nDist < pDudeInfo->hearDist)

View file

@ -130,7 +130,7 @@ static void eelThinkTarget(DBloodActor* actor)
if (nDist < pDudeInfo->seeDist && abs(nDeltaAngle) <= pDudeInfo->periphery) if (nDist < pDudeInfo->seeDist && abs(nDeltaAngle) <= pDudeInfo->periphery)
{ {
pDudeExtraE->thinkTime = 0; pDudeExtraE->thinkTime = 0;
aiSetTarget(actor, pPlayer->actor()); aiSetTarget(actor, pPlayer->actor);
aiActivateDude(actor); aiActivateDude(actor);
} }
else if (nDist < pDudeInfo->hearDist) else if (nDist < pDudeInfo->hearDist)

View file

@ -289,7 +289,7 @@ static void cerberusThinkTarget(DBloodActor* actor)
if (nDist < pDudeInfo->seeDist && abs(nDeltaAngle) <= pDudeInfo->periphery) if (nDist < pDudeInfo->seeDist && abs(nDeltaAngle) <= pDudeInfo->periphery)
{ {
pDudeExtraE->thinkTime = 0; pDudeExtraE->thinkTime = 0;
aiSetTarget(actor, pPlayer->actor()); aiSetTarget(actor, pPlayer->actor);
aiActivateDude(actor); aiActivateDude(actor);
} }
else if (nDist < pDudeInfo->hearDist) else if (nDist < pDudeInfo->hearDist)

View file

@ -248,7 +248,7 @@ static void gargThinkTarget(DBloodActor* actor)
if (nDist < pDudeInfo->seeDist && abs(nDeltaAngle) <= pDudeInfo->periphery) if (nDist < pDudeInfo->seeDist && abs(nDeltaAngle) <= pDudeInfo->periphery)
{ {
pDudeExtraE->thinkTime = 0; pDudeExtraE->thinkTime = 0;
aiSetTarget(actor, pPlayer->actor()); aiSetTarget(actor, pPlayer->actor);
aiActivateDude(actor); aiActivateDude(actor);
} }
else if (nDist < pDudeInfo->hearDist) else if (nDist < pDudeInfo->hearDist)

View file

@ -225,7 +225,7 @@ static void ghostThinkTarget(DBloodActor* actor)
if (nDist < pDudeInfo->seeDist && abs(nDeltaAngle) <= pDudeInfo->periphery) if (nDist < pDudeInfo->seeDist && abs(nDeltaAngle) <= pDudeInfo->periphery)
{ {
pDudeExtraE->thinkTime = 0; pDudeExtraE->thinkTime = 0;
aiSetTarget(actor, pPlayer->actor()); aiSetTarget(actor, pPlayer->actor);
aiActivateDude(actor); aiActivateDude(actor);
return; return;
} }

View file

@ -255,7 +255,7 @@ static void sub_725A4(DBloodActor* actor)
if (nDist < pDudeInfo->seeDist && abs(nDeltaAngle) <= pDudeInfo->periphery) if (nDist < pDudeInfo->seeDist && abs(nDeltaAngle) <= pDudeInfo->periphery)
{ {
pDudeExtraE->thinkTime = 0; pDudeExtraE->thinkTime = 0;
aiSetTarget(actor, pPlayer->actor()); aiSetTarget(actor, pPlayer->actor);
aiActivateDude(actor); aiActivateDude(actor);
} }
else if (nDist < pDudeInfo->hearDist) else if (nDist < pDudeInfo->hearDist)

View file

@ -222,7 +222,7 @@ static void myThinkTarget(DBloodActor* actor)
{ {
PLAYER* pPlayer = &gPlayer[p]; PLAYER* pPlayer = &gPlayer[p];
auto owneractor = actor->GetOwner(); auto owneractor = actor->GetOwner();
if (owneractor == nullptr || owneractor == pPlayer->actor() || pPlayer->pXSprite->health == 0 || powerupCheck(pPlayer, kPwUpShadowCloak) > 0) if (owneractor == nullptr || owneractor == pPlayer->actor || pPlayer->pXSprite->health == 0 || powerupCheck(pPlayer, kPwUpShadowCloak) > 0)
continue; continue;
int x = pPlayer->pSprite->x; int x = pPlayer->pSprite->x;
int y = pPlayer->pSprite->y; int y = pPlayer->pSprite->y;
@ -238,7 +238,7 @@ static void myThinkTarget(DBloodActor* actor)
int nDeltaAngle = ((getangle(dx, dy) + 1024 - pSprite->ang) & 2047) - 1024; int nDeltaAngle = ((getangle(dx, dy) + 1024 - pSprite->ang) & 2047) - 1024;
if (nDist < pDudeInfo->seeDist && abs(nDeltaAngle) <= pDudeInfo->periphery) if (nDist < pDudeInfo->seeDist && abs(nDeltaAngle) <= pDudeInfo->periphery)
{ {
aiSetTarget(actor, pPlayer->actor()); aiSetTarget(actor, pPlayer->actor);
aiActivateDude(actor); aiActivateDude(actor);
} }
else if (nDist < pDudeInfo->hearDist) else if (nDist < pDudeInfo->hearDist)

View file

@ -806,7 +806,7 @@ void viewProcessSprites(spritetype* tsprite, int& spritesortcnt, int32_t cX, int
case kMissileFlareRegular: case kMissileFlareRegular:
case kMissileFlareAlt: case kMissileFlareAlt:
if (pTSprite->statnum == kStatFlare) { if (pTSprite->statnum == kStatFlare) {
if (owneractor->GetTarget() == gView->actor()) if (owneractor->GetTarget() == gView->actor)
{ {
pTSprite->xrepeat = 0; pTSprite->xrepeat = 0;
break; break;

View file

@ -107,7 +107,7 @@ void StartLevel(MapRecord* level, bool newgame)
for (int i = connecthead; i >= 0; i = connectpoint2[i]) for (int i = connecthead; i >= 0; i = connectpoint2[i])
{ {
memcpy(&gPlayerTemp[i], &gPlayer[i], sizeof(PLAYER)); memcpy(&gPlayerTemp[i], &gPlayer[i], sizeof(PLAYER));
gHealthTemp[i] = gPlayer[i].actor()->x().health; gHealthTemp[i] = gPlayer[i].actor->x().health;
} }
} }
memset(xsprite, 0, sizeof(xsprite)); memset(xsprite, 0, sizeof(xsprite));

View file

@ -327,12 +327,6 @@ inline void GetActorExtents(DBloodActor* actor, int* top, int* bottom)
GetSpriteExtents(&actor->s(), top, bottom); GetSpriteExtents(&actor->s(), top, bottom);
} }
inline DBloodActor* PLAYER::actor()
{
return &bloodActors[pSprite->index];
}
inline DBloodActor* getUpperLink(int sect) inline DBloodActor* getUpperLink(int sect)
{ {
return gUpperLink[sect]; return gUpperLink[sect];

View file

@ -381,7 +381,7 @@ void FinishHim(DBloodActor* actor, int) // 13
{ {
if (!actor) return; if (!actor) return;
spritetype* pSprite = &actor->s(); spritetype* pSprite = &actor->s();
if (actor->IsPlayerActor() && playerSeqPlaying(&gPlayer[pSprite->type - kDudePlayer1], 16) && actor == gMe->actor()) if (actor->IsPlayerActor() && playerSeqPlaying(&gPlayer[pSprite->type - kDudePlayer1], 16) && actor == gMe->actor)
sndStartSample(3313, -1, 1, 0); sndStartSample(3313, -1, 1, 0);
} }

View file

@ -459,14 +459,14 @@ void evSend(DBloodActor* actor, int nIndex, int nType, int rxId, COMMAND_ID comm
if (playerRXRngIsFine(rxId)) if (playerRXRngIsFine(rxId))
{ {
if ((pPlayer = getPlayerById((rxId - kChannelPlayer7) + kMaxPlayers)) != nullptr) if ((pPlayer = getPlayerById((rxId - kChannelPlayer7) + kMaxPlayers)) != nullptr)
trMessageSprite(pPlayer->actor(), event); trMessageSprite(pPlayer->actor, event);
} }
else if (rxId == kChannelAllPlayers) else if (rxId == kChannelAllPlayers)
{ {
for (int i = 0; i < kMaxPlayers; i++) for (int i = 0; i < kMaxPlayers; i++)
{ {
if ((pPlayer = getPlayerById(i)) != nullptr) if ((pPlayer = getPlayerById(i)) != nullptr)
trMessageSprite(pPlayer->actor(), event); trMessageSprite(pPlayer->actor, event);
} }
return; return;
} }

View file

@ -304,27 +304,27 @@ const char* GameInterface::GenericCheat(int player, int cheat)
SetToys(true); SetToys(true);
break; break;
case kCheatKevorkian: case kCheatKevorkian:
actDamageSprite(gMe->actor(), gMe->actor(), kDamageBullet, 8000); actDamageSprite(gMe->actor, gMe->actor, kDamageBullet, 8000);
return GStrings("TXTB_KEVORKIAN"); return GStrings("TXTB_KEVORKIAN");
case kCheatMcGee: case kCheatMcGee:
{ {
if (!gMe->pXSprite->burnTime) if (!gMe->pXSprite->burnTime)
evPostActor(gMe->actor(), 0, kCallbackFXFlameLick); evPostActor(gMe->actor, 0, kCallbackFXFlameLick);
actBurnSprite(gMe->actor(), gMe->actor(), 2400); actBurnSprite(gMe->actor, gMe->actor, 2400);
return GStrings("TXTB_FIRED"); return GStrings("TXTB_FIRED");
} }
case kCheatEdmark: case kCheatEdmark:
actDamageSprite(gMe->actor(), gMe->actor(), kDamageExplode, 8000); actDamageSprite(gMe->actor, gMe->actor, kDamageExplode, 8000);
return GStrings("TXTB_THEDAYS"); return GStrings("TXTB_THEDAYS");
case kCheatKrueger: case kCheatKrueger:
{ {
actHealDude(gMe->actor(), 200, 200); actHealDude(gMe->actor, 200, 200);
gMe->armor[1] = VanillaMode() ? 200 : 3200; gMe->armor[1] = VanillaMode() ? 200 : 3200;
if (!gMe->pXSprite->burnTime) if (!gMe->pXSprite->burnTime)
evPostActor(gMe->actor(), 0, kCallbackFXFlameLick); evPostActor(gMe->actor, 0, kCallbackFXFlameLick);
actBurnSprite(gMe->actor(), gMe->actor(), 2400); actBurnSprite(gMe->actor, gMe->actor, 2400);
return GStrings("TXTB_RETARD"); return GStrings("TXTB_RETARD");
} }
case kCheatSterno: case kCheatSterno:
@ -334,7 +334,7 @@ const char* GameInterface::GenericCheat(int player, int cheat)
gMe->flickerEffect = 360; gMe->flickerEffect = 360;
break; break;
case kCheatSpork: case kCheatSpork:
actHealDude(gMe->actor(), 200, 200); actHealDude(gMe->actor, 200, 200);
break; break;
case kCheatClarice: case kCheatClarice:
for (int i = 0; i < 3; i++) for (int i = 0; i < 3; i++)
@ -383,7 +383,7 @@ const char* GameInterface::GenericCheat(int player, int cheat)
SetWooMode(true); SetWooMode(true);
break; break;
case kCheatCousteau: case kCheatCousteau:
actHealDude(gMe->actor(), 200, 200); actHealDude(gMe->actor, 200, 200);
gMe->packSlots[1].curAmount = 100; gMe->packSlots[1].curAmount = 100;
if (!VanillaMode()) if (!VanillaMode())
gMe->pwUpTime[kPwUpDivingSuit] = gPowerUpInfo[kPwUpDivingSuit].bonusTime; gMe->pwUpTime[kPwUpDivingSuit] = gPowerUpInfo[kPwUpDivingSuit].bonusTime;
@ -507,7 +507,7 @@ static void cmd_Give(int player, uint8_t **stream, bool skip)
break; break;
case GIVE_HEALTH: case GIVE_HEALTH:
actHealDude(gMe->actor(), 200, 200); actHealDude(gMe->actor, 200, 200);
bPlayerCheated = true; bPlayerCheated = true;
break; break;

View file

@ -1270,10 +1270,10 @@ void nnExtProcessSuperSprites()
for (int a = connecthead; a >= 0; a = connectpoint2[a]) for (int a = connecthead; a >= 0; a = connectpoint2[a])
{ {
PLAYER* pPlayer = &gPlayer[a]; PLAYER* pPlayer = &gPlayer[a];
if (!pPlayer || !pPlayer->actor()->hasX() || pPlayer->pXSprite->health <= 0) if (!pPlayer || !pPlayer->actor->hasX() || pPlayer->pXSprite->health <= 0)
continue; continue;
if (pPlayer->pXSprite->health > 0 && CheckProximity(gPlayer->actor(), x, y, z, sectnum, okDist)) if (pPlayer->pXSprite->health > 0 && CheckProximity(gPlayer->actor, x, y, z, sectnum, okDist))
{ {
trTriggerSprite(gProxySpritesList[i], kCmdSpriteProximity); trTriggerSprite(gProxySpritesList[i], kCmdSpriteProximity);
break; break;
@ -1315,7 +1315,7 @@ void nnExtProcessSuperSprites()
for (int a = connecthead; a >= 0; a = connectpoint2[a]) for (int a = connecthead; a >= 0; a = connectpoint2[a])
{ {
PLAYER* pPlayer = &gPlayer[a]; PLAYER* pPlayer = &gPlayer[a];
if (!pPlayer || !pPlayer->actor()->hasX() || pPlayer->pXSprite->health <= 0) if (!pPlayer || !pPlayer->actor->hasX() || pPlayer->pXSprite->health <= 0)
continue; continue;
spritetype* pPlaySprite = pPlayer->pSprite; spritetype* pPlaySprite = pPlayer->pSprite;
@ -1334,9 +1334,9 @@ void nnExtProcessSuperSprites()
if (!vector) if (!vector)
pSightSpr->cstat |= CSTAT_SPRITE_BLOCK_HITSCAN; pSightSpr->cstat |= CSTAT_SPRITE_BLOCK_HITSCAN;
HitScan(pPlayer->actor(), pPlayer->zWeapon, pPlayer->aim.dx, pPlayer->aim.dy, pPlayer->aim.dz, CLIPMASK0 | CLIPMASK1, 0); HitScan(pPlayer->actor, pPlayer->zWeapon, pPlayer->aim.dx, pPlayer->aim.dy, pPlayer->aim.dz, CLIPMASK0 | CLIPMASK1, 0);
//VectorScan(pPlayer->actor(), 0, pPlayer->zWeapon, pPlayer->aim.dx, pPlayer->aim.dy, pPlayer->aim.dz, 0, 1); //VectorScan(pPlayer->actor, 0, pPlayer->zWeapon, pPlayer->aim.dx, pPlayer->aim.dy, pPlayer->aim.dz, 0, 1);
if (!vector) if (!vector)
pSightSpr->cstat &= ~CSTAT_SPRITE_BLOCK_HITSCAN; pSightSpr->cstat &= ~CSTAT_SPRITE_BLOCK_HITSCAN;
@ -1415,7 +1415,7 @@ void nnExtProcessSuperSprites()
for (int a = connecthead; a != -1; a = connectpoint2[a]) for (int a = connecthead; a != -1; a = connectpoint2[a])
{ {
pPlayer = &gPlayer[a]; pPlayer = &gPlayer[a];
auto pact = pPlayer->actor(); auto pact = pPlayer->actor;
if (pact->hit.hit.type == kHitSprite && pact->hit.hit.index == nDebris) if (pact->hit.hit.type == kHitSprite && pact->hit.hit.index == nDebris)
{ {
int nSpeed = approxDist(pact->xvel, pact->yvel); int nSpeed = approxDist(pact->xvel, pact->yvel);
@ -2139,7 +2139,7 @@ void trPlayerCtrlLink(DBloodActor* sourceactor, PLAYER* pPlayer, bool checkCondi
{ {
auto pXSource = &sourceactor->x(); auto pXSource = &sourceactor->x();
// save player's sprite index to let the tracking condition know it after savegame loading... // save player's sprite index to let the tracking condition know it after savegame loading...
pXSource->sysData1 = pPlayer->nSprite; sourceactor->prevmarker = pPlayer->actor;
pPlayer->pXSprite->txID = pXSource->txID; pPlayer->pXSprite->txID = pXSource->txID;
pPlayer->pXSprite->command = kCmdToggle; pPlayer->pXSprite->command = kCmdToggle;
@ -2181,7 +2181,7 @@ void trPlayerCtrlLink(DBloodActor* sourceactor, PLAYER* pPlayer, bool checkCondi
for (unsigned k = 0; k < pCond->length; k++) for (unsigned k = 0; k < pCond->length; k++)
{ {
if (pCond->obj[k].type != OBJ_SPRITE || pCond->obj[k].actor != sourceactor) continue; if (pCond->obj[k].type != OBJ_SPRITE || pCond->obj[k].actor != sourceactor) continue;
pCond->obj[k].actor = pPlayer->actor(); pCond->obj[k].actor = pPlayer->actor;
pCond->obj[k].index_ = 0; pCond->obj[k].index_ = 0;
pCond->obj[k].cmd = (uint8_t)pPlayer->pXSprite->command; pCond->obj[k].cmd = (uint8_t)pPlayer->pXSprite->command;
break; break;
@ -4295,7 +4295,7 @@ bool condCheckPlayer(DBloodActor* aCond, int cmpOp, bool PUSH)
for (int i = 0; i < kMaxPlayers; i++) for (int i = 0; i < kMaxPlayers; i++)
{ {
if (objActor != gPlayer[i].actor()) continue; if (objActor != gPlayer[i].actor) continue;
pPlayer = &gPlayer[i]; pPlayer = &gPlayer[i];
break; break;
} }
@ -4308,8 +4308,8 @@ bool condCheckPlayer(DBloodActor* aCond, int cmpOp, bool PUSH)
switch (cond) { switch (cond) {
case 0: // check if this player is connected case 0: // check if this player is connected
if (!condCmp(pPlayer->nPlayer + 1, arg1, arg2, cmpOp) || pPlayer->actor() == nullptr) return false; if (!condCmp(pPlayer->nPlayer + 1, arg1, arg2, cmpOp) || pPlayer->actor == nullptr) return false;
else if (PUSH) condPush(aCond, OBJ_SPRITE, 0, pPlayer->actor()); else if (PUSH) condPush(aCond, OBJ_SPRITE, 0, pPlayer->actor);
return (pPlayer->nPlayer >= 0); return (pPlayer->nPlayer >= 0);
case 1: return condCmp((gGameOptions.nGameType != 3) ? 0 : pPlayer->teamId + 1, arg1, arg2, cmpOp); // compare team 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 2: return (arg1 > 0 && arg1 < 8 && pPlayer->hasKey[arg1 - 1]);
@ -4351,8 +4351,8 @@ bool condCheckPlayer(DBloodActor* aCond, int cmpOp, bool PUSH)
case 14: return condCmp(pPlayer->posture + 1, arg1, arg2, cmpOp); case 14: return condCmp(pPlayer->posture + 1, arg1, arg2, cmpOp);
case 46: return condCmp(pPlayer->sceneQav, arg1, arg2, cmpOp); case 46: return condCmp(pPlayer->sceneQav, arg1, arg2, cmpOp);
case 47: return (pPlayer->godMode || powerupCheck(pPlayer, kPwUpDeathMask)); case 47: return (pPlayer->godMode || powerupCheck(pPlayer, kPwUpDeathMask));
case 48: return isShrinked(pPlayer->actor()); case 48: return isShrinked(pPlayer->actor);
case 49: return isGrown(pPlayer->actor()); case 49: return isGrown(pPlayer->actor);
} }
condError(aCond, "Unexpected condition #%d!", cond); condError(aCond, "Unexpected condition #%d!", cond);
@ -5740,7 +5740,7 @@ bool modernTypeOperateSprite(DBloodActor* actor, EVENT event)
{ {
PLAYER* pPlayer = getPlayerById(pXSprite->data1); PLAYER* pPlayer = getPlayerById(pXSprite->data1);
if (pPlayer != NULL) if (pPlayer != NULL)
useSpriteDamager(actor, OBJ_SPRITE, 0, pPlayer->actor()); useSpriteDamager(actor, OBJ_SPRITE, 0, pPlayer->actor);
} }
if (pXSprite->busyTime > 0) if (pXSprite->busyTime > 0)
@ -5759,7 +5759,7 @@ bool modernTypeOperateSprite(DBloodActor* actor, EVENT event)
PLAYER* pPlayer = getPlayerById(pXSprite->data1); PLAYER* pPlayer = getPlayerById(pXSprite->data1);
if (pPlayer != NULL && SetSpriteState(actor, pXSprite->state ^ 1) == 1) if (pPlayer != NULL && SetSpriteState(actor, pXSprite->state ^ 1) == 1)
useTeleportTarget(actor, pPlayer->actor()); useTeleportTarget(actor, pPlayer->actor);
return true; return true;
} }
[[fallthrough]]; [[fallthrough]];
@ -5956,7 +5956,7 @@ bool modernTypeOperateSprite(DBloodActor* actor, EVENT event)
switch (cmd) { switch (cmd) {
case 36: case 36:
actHealDude(pPlayer->actor(), ((pXSprite->data2 > 0) ? ClipHigh(pXSprite->data2, 200) : getDudeInfo(pPlayer->pSprite->type)->startHealth), 200); actHealDude(pPlayer->actor, ((pXSprite->data2 > 0) ? ClipHigh(pXSprite->data2, 200) : getDudeInfo(pPlayer->pSprite->type)->startHealth), 200);
pPlayer->curWeapon = kWeapPitchFork; pPlayer->curWeapon = kWeapPitchFork;
break; break;
} }
@ -8405,10 +8405,10 @@ DBloodActor* aiPatrolSearchTargets(DBloodActor* actor)
for (i = connecthead; i != -1; i = connectpoint2[i]) for (i = connecthead; i != -1; i = connectpoint2[i])
{ {
pPlayer = &gPlayer[i]; pPlayer = &gPlayer[i];
if (!pPlayer->actor()->hasX()) continue; if (!pPlayer->actor->hasX()) continue;
spritetype* pSpr = pPlayer->pSprite; spritetype* pSpr = pPlayer->pSprite;
XSPRITE* pXSpr = &pPlayer->actor()->x(); XSPRITE* pXSpr = &pPlayer->actor->x();
if (pXSpr->health <= 0) if (pXSpr->health <= 0)
continue; continue;
@ -8424,7 +8424,7 @@ DBloodActor* aiPatrolSearchTargets(DBloodActor* actor)
if (nDist <= seeDist) if (nDist <= seeDist)
{ {
eyeAboveZ = (pDudeInfo->eyeHeight * pSprite->yrepeat) << 2; eyeAboveZ = (pDudeInfo->eyeHeight * pSprite->yrepeat) << 2;
if (nDist < seeDist >> 3) GetActorExtents(pPlayer->actor(), &z, &j); //use ztop of the target sprite if (nDist < seeDist >> 3) GetActorExtents(pPlayer->actor, &z, &j); //use ztop of the target sprite
if (!cansee(x, y, z, pSpr->sectnum, pSprite->x, pSprite->y, pSprite->z - eyeAboveZ, pSprite->sectnum)) if (!cansee(x, y, z, pSpr->sectnum, pSprite->x, pSprite->y, pSprite->z - eyeAboveZ, pSprite->sectnum))
continue; continue;
} }
@ -8432,11 +8432,11 @@ DBloodActor* aiPatrolSearchTargets(DBloodActor* actor)
continue; continue;
bool invisible = (powerupCheck(pPlayer, kPwUpShadowCloak) > 0); bool invisible = (powerupCheck(pPlayer, kPwUpShadowCloak) > 0);
if (spritesTouching(actor, pPlayer->actor()) || spritesTouching(pPlayer->actor(), actor)) if (spritesTouching(actor, pPlayer->actor) || spritesTouching(pPlayer->actor, 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->nPlayer + 1);
if (invisible) pPlayer->pwUpTime[kPwUpShadowCloak] = 0; if (invisible) pPlayer->pwUpTime[kPwUpShadowCloak] = 0;
newtarget = pPlayer->actor(); newtarget = pPlayer->actor;
break; break;
} }
@ -8490,7 +8490,7 @@ DBloodActor* aiPatrolSearchTargets(DBloodActor* actor)
BloodSectIterator it(searchsect); BloodSectIterator it(searchsect);
while (auto act = it.Next()) while (auto act = it.Next())
{ {
if (act->GetOwner() == pPlayer->actor()) if (act->GetOwner() == pPlayer->actor)
{ {
found = true; found = true;
break; break;
@ -8506,7 +8506,7 @@ DBloodActor* aiPatrolSearchTargets(DBloodActor* actor)
if (invisible && hearChance >= kMaxPatrolSpotValue >> 2) if (invisible && hearChance >= kMaxPatrolSpotValue >> 2)
{ {
newtarget = pPlayer->actor(); newtarget = pPlayer->actor;
pPlayer->pwUpTime[kPwUpShadowCloak] = 0; pPlayer->pwUpTime[kPwUpShadowCloak] = 0;
invisible = false; invisible = false;
break; break;
@ -8552,7 +8552,7 @@ DBloodActor* aiPatrolSearchTargets(DBloodActor* actor)
if (hearDist) if (hearDist)
{ {
auto act = pPlayer->actor(); auto act = pPlayer->actor;
itCanHear = (!deaf && (nDist < hearDist || hearChance > 0)); itCanHear = (!deaf && (nDist < hearDist || hearChance > 0));
if (itCanHear && nDist < feelDist && (act->xvel || act->yvel || act->zvel)) if (itCanHear && nDist < feelDist && (act->xvel || act->yvel || act->zvel))
hearChance += ClipLow(mulscale8(1, ClipLow(((feelDist - nDist) + (abs(act->xvel) + abs(act->yvel) + abs(act->zvel))) >> 6, 0)), 0); hearChance += ClipLow(mulscale8(1, ClipLow(((feelDist - nDist) + (abs(act->xvel) + abs(act->yvel) + abs(act->zvel))) >> 6, 0)), 0);
@ -8666,7 +8666,7 @@ DBloodActor* aiPatrolSearchTargets(DBloodActor* actor)
pXSprite->data3 = ClipRange(pXSprite->data3 + hearChance, -kMaxPatrolSpotValue, kMaxPatrolSpotValue); pXSprite->data3 = ClipRange(pXSprite->data3 + hearChance, -kMaxPatrolSpotValue, kMaxPatrolSpotValue);
if (!stealth) if (!stealth)
{ {
newtarget = pPlayer->actor(); newtarget = pPlayer->actor;
break; break;
} }
} }
@ -8678,7 +8678,7 @@ DBloodActor* aiPatrolSearchTargets(DBloodActor* actor)
pXSprite->data3 = ClipRange(pXSprite->data3 + seeChance, -kMaxPatrolSpotValue, kMaxPatrolSpotValue); pXSprite->data3 = ClipRange(pXSprite->data3 + seeChance, -kMaxPatrolSpotValue, kMaxPatrolSpotValue);
if (!stealth) if (!stealth)
{ {
newtarget = pPlayer->actor(); newtarget = pPlayer->actor;
break; break;
} }
} }
@ -8688,7 +8688,7 @@ DBloodActor* aiPatrolSearchTargets(DBloodActor* actor)
if ((pXSprite->data3 = ClipRange(pXSprite->data3, 0, kMaxPatrolSpotValue)) == kMaxPatrolSpotValue) if ((pXSprite->data3 = ClipRange(pXSprite->data3, 0, kMaxPatrolSpotValue)) == kMaxPatrolSpotValue)
{ {
newtarget = pPlayer->actor(); newtarget = pPlayer->actor;
break; break;
} }

View file

@ -254,12 +254,12 @@ char powerupActivate(PLAYER *pPlayer, int nPowerUp)
break; break;
case kItemShroomShrink: case kItemShroomShrink:
if (!gModernMap) break; if (!gModernMap) break;
else if (isGrown(pPlayer->actor())) playerDeactivateShrooms(pPlayer); else if (isGrown(pPlayer->actor)) playerDeactivateShrooms(pPlayer);
else playerSizeShrink(pPlayer, 2); else playerSizeShrink(pPlayer, 2);
break; break;
case kItemShroomGrow: case kItemShroomGrow:
if (!gModernMap) break; if (!gModernMap) break;
else if (isShrinked(pPlayer->actor())) playerDeactivateShrooms(pPlayer); else if (isShrinked(pPlayer->actor)) playerDeactivateShrooms(pPlayer);
else { else {
playerSizeGrow(pPlayer, 2); playerSizeGrow(pPlayer, 2);
if (powerupCheck(&gPlayer[pPlayer->pSprite->type - kDudePlayer1], kPwUpShadowCloak) > 0) { if (powerupCheck(&gPlayer[pPlayer->pSprite->type - kDudePlayer1], kPwUpShadowCloak) > 0) {
@ -267,8 +267,8 @@ char powerupActivate(PLAYER *pPlayer, int nPowerUp)
pPlayer->pwUpTime[kPwUpShadowCloak] = 0; pPlayer->pwUpTime[kPwUpShadowCloak] = 0;
} }
if (ceilIsTooLow(pPlayer->actor())) if (ceilIsTooLow(pPlayer->actor))
actDamageSprite(pPlayer->actor(), pPlayer->actor(), kDamageExplode, 65535); actDamageSprite(pPlayer->actor, pPlayer->actor, kDamageExplode, 65535);
} }
break; break;
#endif #endif
@ -315,8 +315,8 @@ void powerupDeactivate(PLAYER *pPlayer, int nPowerUp)
case kItemShroomShrink: case kItemShroomShrink:
if (gModernMap) { if (gModernMap) {
playerSizeReset(pPlayer); playerSizeReset(pPlayer);
if (ceilIsTooLow(pPlayer->actor())) if (ceilIsTooLow(pPlayer->actor))
actDamageSprite(pPlayer->actor(), pPlayer->actor(), kDamageExplode, 65535); actDamageSprite(pPlayer->actor, pPlayer->actor, kDamageExplode, 65535);
} }
break; break;
case kItemShroomGrow: case kItemShroomGrow:
@ -486,7 +486,7 @@ void packUseItem(PLAYER *pPlayer, int nPack)
if (health < 100) if (health < 100)
{ {
int heal = ClipHigh(100-health, pPlayer->packSlots[0].curAmount); int heal = ClipHigh(100-health, pPlayer->packSlots[0].curAmount);
actHealDude(pPlayer->actor(), heal, 100); actHealDude(pPlayer->actor, heal, 100);
pPlayer->packSlots[0].curAmount -= heal; pPlayer->packSlots[0].curAmount -= heal;
} }
break; break;
@ -564,8 +564,8 @@ void packNextItem(PLAYER* pPlayer)
char playerSeqPlaying(PLAYER * pPlayer, int nSeq) char playerSeqPlaying(PLAYER * pPlayer, int nSeq)
{ {
int nCurSeq = seqGetID(pPlayer->actor()); int nCurSeq = seqGetID(pPlayer->actor);
if (pPlayer->pDudeInfo->seqStartID+nSeq == nCurSeq && seqGetStatus(pPlayer->actor()) >= 0) if (pPlayer->pDudeInfo->seqStartID+nSeq == nCurSeq && seqGetStatus(pPlayer->actor) >= 0)
return 1; return 1;
return 0; return 0;
} }
@ -665,7 +665,7 @@ void playerStart(int nPlayer, int bNewLevel)
XSPRITE *pXSprite = &actor->x(); XSPRITE *pXSprite = &actor->x();
pPlayer->pSprite = pSprite; pPlayer->pSprite = pSprite;
pPlayer->pXSprite = pXSprite; pPlayer->pXSprite = pXSprite;
pPlayer->nSprite = pSprite->index; pPlayer->actor = actor;
DUDEINFO *pDudeInfo = &dudeInfo[kDudePlayer1 + nPlayer - kDudeBase]; DUDEINFO *pDudeInfo = &dudeInfo[kDudePlayer1 + nPlayer - kDudeBase];
pPlayer->pDudeInfo = pDudeInfo; pPlayer->pDudeInfo = pDudeInfo;
playerSetRace(pPlayer, kModeHuman); playerSetRace(pPlayer, kModeHuman);
@ -754,10 +754,10 @@ void playerStart(int nPlayer, int bNewLevel)
XSPRITE* pXCtrl = &iactor->x(); XSPRITE* pXCtrl = &iactor->x();
if (pXCtrl->data1 == pPlayer->nPlayer + 1) if (pXCtrl->data1 == pPlayer->nPlayer + 1)
{ {
int nSpriteOld = pXCtrl->sysData1; auto SpriteOld = iactor->prevmarker;
trPlayerCtrlLink(iactor, pPlayer, (nSpriteOld < 0) ? true : false); trPlayerCtrlLink(iactor, pPlayer, (SpriteOld == nullptr)); // this modifies iactor's prevmarker field!
if (nSpriteOld > 0) if (SpriteOld)
condUpdateObjectIndex(&bloodActors[nSpriteOld], &bloodActors[pXCtrl->sysData1]); condUpdateObjectIndex(SpriteOld, iactor->prevmarker);
} }
} }
@ -860,7 +860,7 @@ bool findDroppedLeech(PLAYER *a1, DBloodActor *a2)
if (a2 == actor) if (a2 == actor)
continue; continue;
spritetype *pSprite = &actor->s(); spritetype *pSprite = &actor->s();
if (pSprite->type == kThingDroppedLifeLeech && pSprite->owner == a1->nSprite) if (pSprite->type == kThingDroppedLifeLeech && actor->GetOwner() == a1->actor)
return 1; return 1;
} }
return 0; return 0;
@ -875,7 +875,7 @@ char PickupItem(PLAYER *pPlayer, DBloodActor* itemactor)
switch (pItem->type) { switch (pItem->type) {
case kItemShadowCloak: case kItemShadowCloak:
#ifdef NOONE_EXTENSIONS #ifdef NOONE_EXTENSIONS
if (isGrown(pPlayer->actor()) || !powerupActivate(pPlayer, nType)) return false; if (isGrown(pPlayer->actor) || !powerupActivate(pPlayer, nType)) return false;
#else #else
if (!powerupActivate(pPlayer, nType)) return false; if (!powerupActivate(pPlayer, nType)) return false;
#endif #endif
@ -887,10 +887,10 @@ char PickupItem(PLAYER *pPlayer, DBloodActor* itemactor)
if (gModernMap) { if (gModernMap) {
switch (pItem->type) { switch (pItem->type) {
case kItemShroomShrink: case kItemShroomShrink:
if (isShrinked(pPlayer->actor())) return false; if (isShrinked(pPlayer->actor)) return false;
break; break;
case kItemShroomGrow: case kItemShroomGrow:
if (isGrown(pPlayer->actor())) return false; if (isGrown(pPlayer->actor)) return false;
break; break;
} }
@ -1079,7 +1079,7 @@ char PickupItem(PLAYER *pPlayer, DBloodActor* itemactor)
addPower = itemactor->x().data1; addPower = itemactor->x().data1;
#endif #endif
if (!actHealDude(pPlayer->actor(), addPower, gPowerUpInfo[nType].maxTime)) return 0; if (!actHealDude(pPlayer->actor, addPower, gPowerUpInfo[nType].maxTime)) return 0;
return 1; return 1;
} }
case kItemHealthDoctorBag: case kItemHealthDoctorBag:
@ -1248,7 +1248,7 @@ int ActionScan(PLAYER *pPlayer, int *pIndex, int *pXIndex, DBloodActor** pAct)
int x = bcos(pSprite->ang); int x = bcos(pSprite->ang);
int y = bsin(pSprite->ang); int y = bsin(pSprite->ang);
int z = pPlayer->slope; int z = pPlayer->slope;
int hit = HitScan(pPlayer->actor(), pPlayer->zView, x, y, z, 0x10000040, 128); int hit = HitScan(pPlayer->actor, pPlayer->zView, x, y, z, 0x10000040, 128);
int hitDist = approxDist(pSprite->x-gHitInfo.hitx, pSprite->y-gHitInfo.hity)>>4; int hitDist = approxDist(pSprite->x-gHitInfo.hitx, pSprite->y-gHitInfo.hity)>>4;
if (hitDist < 64) if (hitDist < 64)
{ {
@ -1338,7 +1338,7 @@ void doslopetilting(PLAYER* pPlayer, double const scaleAdjust = 1)
{ {
auto* const pSprite = pPlayer->pSprite; auto* const pSprite = pPlayer->pSprite;
auto* const pXSprite = pPlayer->pXSprite; auto* const pXSprite = pPlayer->pXSprite;
int const florhit = pPlayer->actor()->hit.florhit.type; int const florhit = pPlayer->actor->hit.florhit.type;
char const va = pXSprite->height < 16 && (florhit == kHitSector || florhit == 0) ? 1 : 0; char const va = pXSprite->height < 16 && (florhit == kHitSector || florhit == 0) ? 1 : 0;
pPlayer->horizon.calcviewpitch(pSprite->pos.vec2, buildang(pSprite->ang), va, sector[pSprite->sectnum].floorstat & 2, pSprite->sectnum, scaleAdjust); pPlayer->horizon.calcviewpitch(pSprite->pos.vec2, buildang(pSprite->ang), va, sector[pSprite->sectnum].floorstat & 2, pSprite->sectnum, scaleAdjust);
} }
@ -1356,7 +1356,7 @@ void ProcessInput(PLAYER *pPlayer)
pPlayer->horizon.resetadjustment(); pPlayer->horizon.resetadjustment();
pPlayer->angle.resetadjustment(); pPlayer->angle.resetadjustment();
auto actor = pPlayer->actor(); auto actor = pPlayer->actor;
spritetype *pSprite = pPlayer->pSprite; spritetype *pSprite = pPlayer->pSprite;
XSPRITE *pXSprite = pPlayer->pXSprite; XSPRITE *pXSprite = pPlayer->pXSprite;
POSTURE *pPosture = &pPlayer->pPosture[pPlayer->lifeMode][pPlayer->posture]; POSTURE *pPosture = &pPlayer->pPosture[pPlayer->lifeMode][pPlayer->posture];
@ -1389,14 +1389,14 @@ void ProcessInput(PLAYER *pPlayer)
if (bSeqStat) if (bSeqStat)
{ {
if (pPlayer->deathTime > 360) if (pPlayer->deathTime > 360)
seqSpawn(pPlayer->pDudeInfo->seqStartID+14, pPlayer->actor(), nPlayerSurviveClient); seqSpawn(pPlayer->pDudeInfo->seqStartID+14, pPlayer->actor, nPlayerSurviveClient);
} }
else if (seqGetStatus(pPlayer->actor()) < 0) else if (seqGetStatus(pPlayer->actor) < 0)
{ {
if (pPlayer->pSprite) if (pPlayer->pSprite)
pPlayer->pSprite->type = kThingBloodChunks; pPlayer->pSprite->type = kThingBloodChunks;
actPostSprite(pPlayer->actor(), kStatThing); actPostSprite(pPlayer->actor, kStatThing);
seqSpawn(pPlayer->pDudeInfo->seqStartID+15, pPlayer->actor(), -1); seqSpawn(pPlayer->pDudeInfo->seqStartID+15, pPlayer->actor, -1);
playerReset(pPlayer); playerReset(pPlayer);
if (gGameOptions.nGameType == 0 && numplayers == 1) if (gGameOptions.nGameType == 0 && numplayers == 1)
{ {
@ -1576,7 +1576,7 @@ void ProcessInput(PLAYER *pPlayer)
pPlayer->handTime = ClipLow(pPlayer->handTime-4*(6-gGameOptions.nDifficulty), 0); pPlayer->handTime = ClipLow(pPlayer->handTime-4*(6-gGameOptions.nDifficulty), 0);
if (pPlayer->handTime <= 0 && pPlayer->hand) if (pPlayer->handTime <= 0 && pPlayer->hand)
{ {
auto pactor = pPlayer->actor(); auto pactor = pPlayer->actor;
auto spawned = actSpawnDude(pactor, kDudeHand, pPlayer->pSprite->clipdist<<1, 0); auto spawned = actSpawnDude(pactor, kDudeHand, pPlayer->pSprite->clipdist<<1, 0);
if (spawned) if (spawned)
{ {
@ -1585,9 +1585,9 @@ void ProcessInput(PLAYER *pPlayer)
int nSprite = pPlayer->pSprite->index; int nSprite = pPlayer->pSprite->index;
int x = bcos(pPlayer->pSprite->ang); int x = bcos(pPlayer->pSprite->ang);
int y = bsin(pPlayer->pSprite->ang); int y = bsin(pPlayer->pSprite->ang);
spawned->xvel = pPlayer->actor()->xvel + MulScale(0x155555, x, 14); spawned->xvel = pPlayer->actor->xvel + MulScale(0x155555, x, 14);
spawned->yvel = pPlayer->actor()->yvel + MulScale(0x155555, y, 14); spawned->yvel = pPlayer->actor->yvel + MulScale(0x155555, y, 14);
spawned->zvel = pPlayer->actor()->zvel; spawned->zvel = pPlayer->actor->zvel;
} }
pPlayer->hand = 0; pPlayer->hand = 0;
} }
@ -1660,7 +1660,7 @@ void ProcessInput(PLAYER *pPlayer)
void playerProcess(PLAYER *pPlayer) void playerProcess(PLAYER *pPlayer)
{ {
auto actor = pPlayer->actor(); auto actor = pPlayer->actor;
spritetype *pSprite = pPlayer->pSprite; spritetype *pSprite = pPlayer->pSprite;
XSPRITE *pXSprite = pPlayer->pXSprite; XSPRITE *pXSprite = pPlayer->pXSprite;
POSTURE* pPosture = &pPlayer->pPosture[pPlayer->lifeMode][pPlayer->posture]; POSTURE* pPosture = &pPlayer->pPosture[pPlayer->lifeMode][pPlayer->posture];
@ -1786,13 +1786,13 @@ void playerProcess(PLAYER *pPlayer)
DBloodActor* playerFireMissile(PLAYER *pPlayer, int a2, int a3, int a4, int a5, int a6) DBloodActor* playerFireMissile(PLAYER *pPlayer, int a2, int a3, int a4, int a5, int a6)
{ {
return actFireMissile(pPlayer->actor(), a2, pPlayer->zWeapon-pPlayer->pSprite->z, a3, a4, a5, a6); return actFireMissile(pPlayer->actor, a2, pPlayer->zWeapon-pPlayer->pSprite->z, a3, a4, a5, a6);
} }
DBloodActor* playerFireThing(PLAYER *pPlayer, int a2, int a3, int thingType, int a5) DBloodActor* playerFireThing(PLAYER *pPlayer, int a2, int a3, int thingType, int a5)
{ {
assert(thingType >= kThingBase && thingType < kThingMax); assert(thingType >= kThingBase && thingType < kThingMax);
return actFireThing(pPlayer->actor(), a2, pPlayer->zWeapon-pPlayer->pSprite->z, pPlayer->slope+a3, thingType, a5); return actFireThing(pPlayer->actor, a2, pPlayer->zWeapon-pPlayer->pSprite->z, pPlayer->slope+a3, thingType, a5);
} }
void playerFrag(PLAYER *pKiller, PLAYER *pVictim) void playerFrag(PLAYER *pKiller, PLAYER *pVictim)
@ -1903,7 +1903,7 @@ int playerDamageArmor(PLAYER *pPlayer, DAMAGE_TYPE nType, int nDamage)
void flagDropped(PLAYER *pPlayer, int a2) void flagDropped(PLAYER *pPlayer, int a2)
{ {
auto playeractor = pPlayer->actor(); auto playeractor = pPlayer->actor;
DBloodActor* actor; DBloodActor* actor;
char buffer[80]; char buffer[80];
spritetype *pSprite = NULL; spritetype *pSprite = NULL;
@ -1940,7 +1940,7 @@ int playerDamageSprite(DBloodActor* source, PLAYER *pPlayer, DAMAGE_TYPE nDamage
spritetype *pSprite = pPlayer->pSprite; spritetype *pSprite = pPlayer->pSprite;
XSPRITE *pXSprite = pPlayer->pXSprite; XSPRITE *pXSprite = pPlayer->pXSprite;
auto pActor = pPlayer->actor(); auto pActor = pPlayer->actor;
int nXSprite = pSprite->extra; int nXSprite = pSprite->extra;
int nXSector = sector[pSprite->sectnum].extra; int nXSector = sector[pSprite->sectnum].extra;
DUDEINFO *pDudeInfo = getDudeInfo(pSprite->type); DUDEINFO *pDudeInfo = getDudeInfo(pSprite->type);
@ -2039,7 +2039,7 @@ int playerDamageSprite(DBloodActor* source, PLAYER *pPlayer, DAMAGE_TYPE nDamage
nKneelingPlayer = nPlayerKneelClient; nKneelingPlayer = nPlayerKneelClient;
powerupActivate(pPlayer, kPwUpDeliriumShroom); powerupActivate(pPlayer, kPwUpDeliriumShroom);
pActor->SetTarget(source); pActor->SetTarget(source);
evPostActor(pPlayer->actor(), 15, kCallbackFinishHim); evPostActor(pPlayer->actor, 15, kCallbackFinishHim);
} }
else else
{ {
@ -2059,7 +2059,7 @@ int playerDamageSprite(DBloodActor* source, PLAYER *pPlayer, DAMAGE_TYPE nDamage
pSprite->flags |= 7; pSprite->flags |= 7;
for (int p = connecthead; p >= 0; p = connectpoint2[p]) for (int p = connecthead; p >= 0; p = connectpoint2[p])
{ {
if (gPlayer[p].fragger == pPlayer->actor() && gPlayer[p].deathTime > 0) if (gPlayer[p].fragger == pPlayer->actor && gPlayer[p].deathTime > 0)
gPlayer[p].fragger = nullptr; gPlayer[p].fragger = nullptr;
} }
FragPlayer(pPlayer, source); FragPlayer(pPlayer, source);
@ -2092,7 +2092,7 @@ int playerDamageSprite(DBloodActor* source, PLAYER *pPlayer, DAMAGE_TYPE nDamage
} }
assert(getSequence(pDudeInfo->seqStartID + nDeathSeqID) != NULL); assert(getSequence(pDudeInfo->seqStartID + nDeathSeqID) != NULL);
seqSpawn(pDudeInfo->seqStartID+nDeathSeqID, pPlayer->actor(), nKneelingPlayer); seqSpawn(pDudeInfo->seqStartID+nDeathSeqID, pPlayer->actor, nKneelingPlayer);
return nDamage; return nDamage;
} }
@ -2108,7 +2108,7 @@ int UseAmmo(PLAYER *pPlayer, int nAmmoType, int nDec)
void voodooTarget(PLAYER *pPlayer) void voodooTarget(PLAYER *pPlayer)
{ {
auto actor = pPlayer->actor(); auto actor = pPlayer->actor;
int v4 = pPlayer->aim.dz; int v4 = pPlayer->aim.dz;
int dz = pPlayer->zWeapon-pPlayer->pSprite->z; int dz = pPlayer->zWeapon-pPlayer->pSprite->z;
if (UseAmmo(pPlayer, 9, 0) < 8) if (UseAmmo(pPlayer, 9, 0) < 8)
@ -2146,7 +2146,7 @@ void playerLandingSound(PLAYER *pPlayer)
603 603
}; };
spritetype *pSprite = pPlayer->pSprite; spritetype *pSprite = pPlayer->pSprite;
SPRITEHIT* pHit = &pPlayer->actor()->hit; SPRITEHIT* pHit = &pPlayer->actor->hit;
if (pHit->florhit.type != kHitNone) if (pHit->florhit.type != kHitNone)
{ {
if (!gGameOptions.bFriendlyFire && pHit->florhit.type == kHitSprite && IsTargetTeammate(pPlayer, &pHit->florhit.actor->s())) if (!gGameOptions.bFriendlyFire && pHit->florhit.type == kHitSprite && IsTargetTeammate(pPlayer, &pHit->florhit.actor->s()))
@ -2254,7 +2254,7 @@ FSerializer& Serialize(FSerializer& arc, const char* keyname, PLAYER& w, PLAYER*
if (arc.isReading()) playerResetPosture(&w); if (arc.isReading()) playerResetPosture(&w);
if (arc.BeginObject(keyname)) if (arc.BeginObject(keyname))
{ {
arc("spritenum", w.nSprite) arc("spritenum", w.actor)
("horizon", w.horizon) ("horizon", w.horizon)
("angle", w.angle) ("angle", w.angle)
("newweapon", w.newWeapon) ("newweapon", w.newWeapon)
@ -2378,8 +2378,8 @@ void SerializePlayers(FSerializer& arc)
{ {
for (int i = 0; i < gNetPlayers; i++) for (int i = 0; i < gNetPlayers; i++)
{ {
gPlayer[i].pSprite = &sprite[gPlayer[i].nSprite]; gPlayer[i].pSprite = &gPlayer[i].actor->s();
gPlayer[i].pXSprite = &xsprite[gPlayer[i].pSprite->extra]; gPlayer[i].pXSprite = &gPlayer[i].actor->x();
gPlayer[i].pDudeInfo = &dudeInfo[gPlayer[i].pSprite->type - kDudeBase]; gPlayer[i].pDudeInfo = &dudeInfo[gPlayer[i].pSprite->type - kDudeBase];
#ifdef NOONE_EXTENSIONS #ifdef NOONE_EXTENSIONS
@ -2419,7 +2419,6 @@ DEFINE_FIELD_X(BloodPlayer, PLAYER, swayAmp)
DEFINE_FIELD_X(BloodPlayer, PLAYER, swayHeight) DEFINE_FIELD_X(BloodPlayer, PLAYER, swayHeight)
DEFINE_FIELD_X(BloodPlayer, PLAYER, swayWidth) DEFINE_FIELD_X(BloodPlayer, PLAYER, swayWidth)
DEFINE_FIELD_X(BloodPlayer, PLAYER, nPlayer) // Connect id DEFINE_FIELD_X(BloodPlayer, PLAYER, nPlayer) // Connect id
DEFINE_FIELD_X(BloodPlayer, PLAYER, nSprite)
DEFINE_FIELD_X(BloodPlayer, PLAYER, lifeMode) DEFINE_FIELD_X(BloodPlayer, PLAYER, lifeMode)
DEFINE_FIELD_X(BloodPlayer, PLAYER, zView) DEFINE_FIELD_X(BloodPlayer, PLAYER, zView)
DEFINE_FIELD_X(BloodPlayer, PLAYER, zViewVel) DEFINE_FIELD_X(BloodPlayer, PLAYER, zViewVel)

View file

@ -81,7 +81,7 @@ extern POSTURE gPostureDefaults[kModeMax][kPostureMax];
struct PLAYER struct PLAYER
{ {
DBloodActor* actor(); DBloodActor* actor;
spritetype* pSprite; spritetype* pSprite;
XSPRITE* pXSprite; XSPRITE* pXSprite;
DUDEINFO* pDudeInfo; DUDEINFO* pDudeInfo;
@ -104,7 +104,6 @@ struct PLAYER
int swayHeight; int swayHeight;
int swayWidth; int swayWidth;
int nPlayer; // Connect id int nPlayer; // Connect id
int nSprite;
int lifeMode; int lifeMode;
int bloodlust; // ---> useless int bloodlust; // ---> useless
int zView; int zView;

View file

@ -62,14 +62,14 @@ void viewInitializePrediction(void)
predict.z = gMe->pSprite->z; predict.z = gMe->pSprite->z;
predict.sectnum = gMe->pSprite->sectnum; predict.sectnum = gMe->pSprite->sectnum;
predict.at73 = gMe->pSprite->flags; predict.at73 = gMe->pSprite->flags;
predict.xvel = gMe->actor()->xvel; predict.xvel = gMe->actor->xvel;
predict.yvel = gMe->actor()->yvel; predict.yvel = gMe->actor->yvel;
predict.zvel = gMe->actor()->zvel; predict.zvel = gMe->actor->zvel;
predict.floordist = gMe->pXSprite->height; predict.floordist = gMe->pXSprite->height;
predict.at48 = gMe->posture; predict.at48 = gMe->posture;
predict.spin = gMe->angle.spin; predict.spin = gMe->angle.spin;
predict.at6e = !!(gMe->input.actions & SB_CENTERVIEW); predict.at6e = !!(gMe->input.actions & SB_CENTERVIEW);
predict.at75 = gMe->actor()->hit; predict.at75 = gMe->actor->hit;
predict.bobPhase = gMe->bobPhase; predict.bobPhase = gMe->bobPhase;
predict.Kills = gMe->bobAmp; predict.Kills = gMe->bobAmp;
predict.bobHeight = gMe->bobHeight; predict.bobHeight = gMe->bobHeight;

View file

@ -205,7 +205,7 @@ void QAV::Draw(double x, double y, int ticks, int stat, int shade, int palnum, b
void QAV::Play(int start, int end, int nCallback, PLAYER *pData) void QAV::Play(int start, int end, int nCallback, PLAYER *pData)
{ {
auto pActor = pData ? pData->actor() : nullptr; auto pActor = pData ? pData->actor : nullptr;
assert(ticksPerFrame > 0); assert(ticksPerFrame > 0);
int frame; int frame;
int ticks; int ticks;

View file

@ -118,7 +118,7 @@ void viewDrawAimedPlayerName(void)
if (!cl_idplayers || (gView->aim.dx == 0 && gView->aim.dy == 0)) if (!cl_idplayers || (gView->aim.dx == 0 && gView->aim.dy == 0))
return; return;
int hit = HitScan(gView->actor(), gView->zView, gView->aim.dx, gView->aim.dy, gView->aim.dz, CLIPMASK0, 512); int hit = HitScan(gView->actor, gView->zView, gView->aim.dx, gView->aim.dy, gView->aim.dz, CLIPMASK0, 512);
if (hit == 3) if (hit == 3)
{ {
if (gHitInfo.hitactor && gHitInfo.hitactor->IsPlayerActor()) if (gHitInfo.hitactor && gHitInfo.hitactor->IsPlayerActor())
@ -687,7 +687,7 @@ void viewDrawScreen(bool sceneonly)
int nClipDist = gView->pSprite->clipdist << 2; int nClipDist = gView->pSprite->clipdist << 2;
int vec, vf4; int vec, vf4;
Collision c1, c2; Collision c1, c2;
GetZRange(gView->actor(), &vf4, &c1, &vec, &c2, nClipDist, 0); GetZRange(gView->actor, &vf4, &c1, &vec, &c2, nClipDist, 0);
if (sceneonly) return; if (sceneonly) return;
#if 0 #if 0
int tmpSect = nSectnum; int tmpSect = nSectnum;
@ -776,7 +776,7 @@ bool GameInterface::DrawAutomapPlayer(int x, int y, int z, int a, double const s
int nTile = pSprite->picnum; int nTile = pSprite->picnum;
int ceilZ, floorZ; int ceilZ, floorZ;
Collision ceilHit, floorHit; Collision ceilHit, floorHit;
GetZRange(gView->actor(), &ceilZ, &ceilHit, &floorZ, &floorHit, (pSprite->clipdist << 2) + 16, CLIPMASK0, PARALLAXCLIP_CEILING | PARALLAXCLIP_FLOOR); GetZRange(gView->actor, &ceilZ, &ceilHit, &floorZ, &floorHit, (pSprite->clipdist << 2) + 16, CLIPMASK0, PARALLAXCLIP_CEILING | PARALLAXCLIP_FLOOR);
int nTop, nBottom; int nTop, nBottom;
GetSpriteExtents(pSprite, &nTop, &nBottom); GetSpriteExtents(pSprite, &nTop, &nBottom);
int nScale = (pSprite->yrepeat + ((floorZ - nBottom) >> 8)) * z; int nScale = (pSprite->yrepeat + ((floorZ - nBottom) >> 8)) * z;

View file

@ -214,7 +214,7 @@ void SpawnBulletEject(PLAYER *pPlayer, int a2, int a3)
POSTURE *pPosture = &pPlayer->pPosture[pPlayer->lifeMode][pPlayer->posture]; POSTURE *pPosture = &pPlayer->pPosture[pPlayer->lifeMode][pPlayer->posture];
pPlayer->zView = pPlayer->pSprite->z-pPosture->eyeAboveZ; pPlayer->zView = pPlayer->pSprite->z-pPosture->eyeAboveZ;
int dz = pPlayer->zWeapon-(pPlayer->zWeapon-pPlayer->zView)/2; int dz = pPlayer->zWeapon-(pPlayer->zWeapon-pPlayer->zView)/2;
fxSpawnEjectingBrass(pPlayer->actor(), dz, a2, a3); fxSpawnEjectingBrass(pPlayer->actor, dz, a2, a3);
} }
void SpawnShellEject(PLAYER *pPlayer, int a2, int a3) void SpawnShellEject(PLAYER *pPlayer, int a2, int a3)
@ -223,7 +223,7 @@ void SpawnShellEject(PLAYER *pPlayer, int a2, int a3)
pPlayer->zView = pPlayer->pSprite->z-pPosture->eyeAboveZ; pPlayer->zView = pPlayer->pSprite->z-pPosture->eyeAboveZ;
int t = pPlayer->zWeapon - pPlayer->zView; int t = pPlayer->zWeapon - pPlayer->zView;
int dz = pPlayer->zWeapon-t+(t>>2); int dz = pPlayer->zWeapon-t+(t>>2);
fxSpawnEjectingShell(pPlayer->actor(), dz, a2, a3); fxSpawnEjectingShell(pPlayer->actor, dz, a2, a3);
} }
void WeaponInit(void) void WeaponInit(void)
@ -1060,7 +1060,7 @@ void WeaponUpdateState(PLAYER *pPlayer)
void FirePitchfork(int, PLAYER *pPlayer) void FirePitchfork(int, PLAYER *pPlayer)
{ {
auto actor = pPlayer->actor(); auto actor = pPlayer->actor;
Aim *aim = &pPlayer->aim; Aim *aim = &pPlayer->aim;
int r1 = Random2(2000); int r1 = Random2(2000);
int r2 = Random2(2000); int r2 = Random2(2000);
@ -1217,7 +1217,7 @@ enum { kMaxShotgunBarrels = 4 };
void FireShotgun(int nTrigger, PLAYER *pPlayer) void FireShotgun(int nTrigger, PLAYER *pPlayer)
{ {
auto actor = pPlayer->actor(); auto actor = pPlayer->actor;
assert(nTrigger > 0 && nTrigger <= kMaxShotgunBarrels); assert(nTrigger > 0 && nTrigger <= kMaxShotgunBarrels);
if (nTrigger == 1) if (nTrigger == 1)
{ {
@ -1264,7 +1264,7 @@ void EjectShell(int, PLAYER *pPlayer)
void FireTommy(int nTrigger, PLAYER *pPlayer) void FireTommy(int nTrigger, PLAYER *pPlayer)
{ {
auto actor = pPlayer->actor(); auto actor = pPlayer->actor;
Aim *aim = &pPlayer->aim; Aim *aim = &pPlayer->aim;
sfxPlay3DSound(pPlayer->pSprite, 431, -1, 0); sfxPlay3DSound(pPlayer->pSprite, 431, -1, 0);
switch (nTrigger) switch (nTrigger)
@ -1303,7 +1303,7 @@ enum { kMaxSpread = 14 };
void FireSpread(int nTrigger, PLAYER *pPlayer) void FireSpread(int nTrigger, PLAYER *pPlayer)
{ {
auto actor = pPlayer->actor(); auto actor = pPlayer->actor;
assert(nTrigger > 0 && nTrigger <= kMaxSpread); assert(nTrigger > 0 && nTrigger <= kMaxSpread);
Aim *aim = &pPlayer->aim; Aim *aim = &pPlayer->aim;
int angle = (getangle(aim->dx, aim->dy)+((112*(nTrigger-1))/14-56))&2047; int angle = (getangle(aim->dx, aim->dy)+((112*(nTrigger-1))/14-56))&2047;
@ -1325,7 +1325,7 @@ void FireSpread(int nTrigger, PLAYER *pPlayer)
void AltFireSpread(int nTrigger, PLAYER *pPlayer) void AltFireSpread(int nTrigger, PLAYER *pPlayer)
{ {
auto actor = pPlayer->actor(); auto actor = pPlayer->actor;
assert(nTrigger > 0 && nTrigger <= kMaxSpread); assert(nTrigger > 0 && nTrigger <= kMaxSpread);
Aim *aim = &pPlayer->aim; Aim *aim = &pPlayer->aim;
int angle = (getangle(aim->dx, aim->dy)+((112*(nTrigger-1))/14-56))&2047; int angle = (getangle(aim->dx, aim->dy)+((112*(nTrigger-1))/14-56))&2047;
@ -1355,7 +1355,7 @@ void AltFireSpread(int nTrigger, PLAYER *pPlayer)
void AltFireSpread2(int nTrigger, PLAYER *pPlayer) void AltFireSpread2(int nTrigger, PLAYER *pPlayer)
{ {
auto actor = pPlayer->actor(); auto actor = pPlayer->actor;
assert(nTrigger > 0 && nTrigger <= kMaxSpread); assert(nTrigger > 0 && nTrigger <= kMaxSpread);
Aim *aim = &pPlayer->aim; Aim *aim = &pPlayer->aim;
int angle = (getangle(aim->dx, aim->dy)+((112*(nTrigger-1))/14-56))&2047; int angle = (getangle(aim->dx, aim->dy)+((112*(nTrigger-1))/14-56))&2047;
@ -1448,7 +1448,7 @@ void AltFireFlare(int nTrigger, PLAYER *pPlayer)
void FireVoodoo(int nTrigger, PLAYER *pPlayer) void FireVoodoo(int nTrigger, PLAYER *pPlayer)
{ {
nTrigger--; nTrigger--;
auto actor = pPlayer->actor(); auto actor = pPlayer->actor;
spritetype *pSprite = pPlayer->pSprite; spritetype *pSprite = pPlayer->pSprite;
if (nTrigger == 4) if (nTrigger == 4)
{ {
@ -1506,7 +1506,7 @@ void FireVoodoo(int nTrigger, PLAYER *pPlayer)
void AltFireVoodoo(int nTrigger, PLAYER *pPlayer) void AltFireVoodoo(int nTrigger, PLAYER *pPlayer)
{ {
auto actor = pPlayer->actor(); auto actor = pPlayer->actor;
if (nTrigger == 2) { if (nTrigger == 2) {
// by NoOne: trying to simulate v1.0x voodoo here. // by NoOne: trying to simulate v1.0x voodoo here.
@ -1692,7 +1692,7 @@ void AltFireNapalm(int , PLAYER *pPlayer)
pXSprite->data4 = ClipHigh(pPlayer->ammoCount[4], 12); pXSprite->data4 = ClipHigh(pPlayer->ammoCount[4], 12);
UseAmmo(pPlayer, 4, pXSprite->data4); UseAmmo(pPlayer, 4, pXSprite->data4);
seqSpawn(22, missile, -1); seqSpawn(22, missile, -1);
actBurnSprite(pPlayer->actor(), missile, 600); actBurnSprite(pPlayer->actor, missile, 600);
evPostActor(missile, 0, kCallbackFXFlameLick); evPostActor(missile, 0, kCallbackFXFlameLick);
sfxPlay3DSound(missile, 480, 2, 0); sfxPlay3DSound(missile, 480, 2, 0);
pPlayer->visibility = 30; pPlayer->visibility = 30;
@ -1707,7 +1707,7 @@ void FireLifeLeech(int nTrigger, PLAYER *pPlayer)
int r1 = Random2(2000); int r1 = Random2(2000);
int r2 = Random2(2000); int r2 = Random2(2000);
int r3 = Random2(1000); int r3 = Random2(1000);
auto actor = pPlayer->actor(); auto actor = pPlayer->actor;
auto missileActor = playerFireMissile(pPlayer, 0, pPlayer->aim.dx+r1, pPlayer->aim.dy+r2, pPlayer->aim.dz+r3, 315); auto missileActor = playerFireMissile(pPlayer, 0, pPlayer->aim.dx+r1, pPlayer->aim.dy+r2, pPlayer->aim.dz+r3, 315);
if (missileActor) if (missileActor)
{ {
@ -1723,7 +1723,7 @@ void FireLifeLeech(int nTrigger, PLAYER *pPlayer)
void AltFireLifeLeech(int , PLAYER *pPlayer) void AltFireLifeLeech(int , PLAYER *pPlayer)
{ {
auto actor = pPlayer->actor(); auto actor = pPlayer->actor;
sfxPlay3DSound(pPlayer->pSprite, 455, 2, 0); sfxPlay3DSound(pPlayer->pSprite, 455, 2, 0);
auto missile = playerFireThing(pPlayer, 0, -4730, kThingDroppedLifeLeech, 0x19999); auto missile = playerFireThing(pPlayer, 0, -4730, kThingDroppedLifeLeech, 0x19999);
if (missile) if (missile)
@ -1759,7 +1759,7 @@ void AltFireLifeLeech(int , PLAYER *pPlayer)
void FireBeast(int , PLAYER * pPlayer) void FireBeast(int , PLAYER * pPlayer)
{ {
auto actor = pPlayer->actor(); auto actor = pPlayer->actor;
int r1 = Random2(2000); int r1 = Random2(2000);
int r2 = Random2(2000); int r2 = Random2(2000);
int r3 = Random2(2000); int r3 = Random2(2000);

View file

@ -73,7 +73,7 @@ struct BloodPlayer native
native int swayHeight; native int swayHeight;
native int swayWidth; native int swayWidth;
native int nPlayer; // Connect id native int nPlayer; // Connect id
native int nSprite; //native int nSprite;
native int lifeMode; native int lifeMode;
native int zView; native int zView;
native int zViewVel; native int zViewVel;