mirror of
https://github.com/DrBeef/Raze.git
synced 2025-01-31 13:10:39 +00:00
- eliminated Player::nSprite.
This commit is contained in:
parent
076a995c6e
commit
9cfd682c9e
11 changed files with 53 additions and 59 deletions
|
@ -53,9 +53,9 @@ void ThrowGrenade(short nPlayer, int, int, int ecx, int push1)
|
|||
return;
|
||||
|
||||
auto pActor = PlayerList[nPlayer].pPlayerGrenade;
|
||||
short nPlayerSprite = PlayerList[nPlayer].nSprite;
|
||||
auto pGrenadeSprite = &pActor->s();
|
||||
auto pPlayerSprite = &PlayerList[nPlayer].Actor()->s();
|
||||
auto pGrenadeSprite = &pActor->s();
|
||||
auto pPlayerActor = PlayerList[nPlayer].Actor();
|
||||
auto pPlayerSprite = &pPlayerActor->s();
|
||||
|
||||
short nAngle = pPlayerSprite->ang;
|
||||
|
||||
|
|
|
@ -397,7 +397,7 @@ void MoveWeapons(short nPlayer)
|
|||
if (!WeaponCanFire(nPlayer))
|
||||
{
|
||||
if (!dword_96E22) {
|
||||
D3PlayFX(StaticSound[4], PlayerList[nPlayer].nSprite);
|
||||
D3PlayFX(StaticSound[4], PlayerList[nPlayer].Actor());
|
||||
}
|
||||
}
|
||||
else
|
||||
|
|
|
@ -136,7 +136,7 @@ uint8_t LoadLevel(MapRecord* map)
|
|||
|
||||
for (i = 0; i < kMaxPlayers; i++)
|
||||
{
|
||||
PlayerList[i].nSprite = -1;
|
||||
PlayerList[i].pActor = nullptr;
|
||||
}
|
||||
|
||||
psky_t* pSky = tileSetupSky(DEFAULTPSKY);
|
||||
|
|
|
@ -387,7 +387,7 @@ int movespritez(short nSprite, int z, int height, int, int clipdist)
|
|||
|
||||
if (SectFlag[edi] & kSectUnderwater)
|
||||
{
|
||||
if (nSprite == PlayerList[nLocalPlayer].nSprite) {
|
||||
if (nSprite == PlayerList[nLocalPlayer].Actor()->GetSpriteIndex()) {
|
||||
D3PlayFX(StaticSound[kSound2], nSprite);
|
||||
}
|
||||
|
||||
|
@ -514,12 +514,6 @@ int movespritez(short nSprite, int z, int height, int, int clipdist)
|
|||
return nRet;
|
||||
}
|
||||
|
||||
int GetSpriteHeight(int nSprite)
|
||||
{
|
||||
auto pSprite = &sprite[nSprite];
|
||||
return tileHeight(pSprite->picnum) * pSprite->yrepeat * 4;
|
||||
}
|
||||
|
||||
int GetActorHeight(DExhumedActor* actor)
|
||||
{
|
||||
return tileHeight(actor->s().picnum) * actor->s().yrepeat * 4;
|
||||
|
@ -1164,10 +1158,11 @@ void SetQuake(DExhumedActor* pActor, int nVal)
|
|||
|
||||
for (int i = 0; i < nTotalPlayers; i++)
|
||||
{
|
||||
int nPlayerSprite = PlayerList[i].nSprite;
|
||||
auto pPlayerActor = PlayerList[i].Actor();
|
||||
|
||||
uint32_t xDiff = abs((int32_t)((sprite[nPlayerSprite].x - x) >> 8));
|
||||
uint32_t yDiff = abs((int32_t)((sprite[nPlayerSprite].y - y) >> 8));
|
||||
|
||||
uint32_t xDiff = abs((int32_t)((pPlayerActor->s().x - x) >> 8));
|
||||
uint32_t yDiff = abs((int32_t)((pPlayerActor->s().y - y) >> 8));
|
||||
|
||||
uint32_t sqrtNum = xDiff * xDiff + yDiff * yDiff;
|
||||
|
||||
|
|
|
@ -168,7 +168,7 @@ void feebtag(int x, int y, int z, int nSector, short *nSprite, int nVal2, int nV
|
|||
void InitPlayer()
|
||||
{
|
||||
for (int i = 0; i < kMaxPlayers; i++) {
|
||||
PlayerList[i].nSprite = -1;
|
||||
PlayerList[i].pActor = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -188,7 +188,7 @@ void InitPlayerInventory(short nPlayer)
|
|||
|
||||
PlayerList[nPlayer].nLives = kDefaultLives;
|
||||
|
||||
PlayerList[nPlayer].nSprite = -1;
|
||||
PlayerList[nPlayer].pActor = nullptr;
|
||||
PlayerList[nPlayer].nRun = -1;
|
||||
|
||||
PlayerList[nPlayer].nPistolClip = 6;
|
||||
|
@ -229,7 +229,7 @@ void RestartPlayer(short nPlayer)
|
|||
|
||||
ChangeActorStat(pActor, 0);
|
||||
|
||||
plr->nSprite = -1;
|
||||
plr->pActor = nullptr;
|
||||
|
||||
auto pFloorSprite = plr->pPlayerFloorSprite;
|
||||
if (pFloorSprite != nullptr) {
|
||||
|
@ -341,7 +341,7 @@ void RestartPlayer(short nPlayer)
|
|||
}
|
||||
|
||||
plr->field_2 = 0;
|
||||
plr->nSprite = pActor->GetSpriteIndex();
|
||||
plr->pActor = pActor;
|
||||
plr->bIsMummified = false;
|
||||
|
||||
if (plr->invincibility >= 0) {
|
||||
|
@ -439,8 +439,8 @@ void StartDeathSeq(int nPlayer, int nVal)
|
|||
{
|
||||
FreeRa(nPlayer);
|
||||
|
||||
short nSprite = PlayerList[nPlayer].nSprite;
|
||||
auto pSprite = &sprite[nSprite];
|
||||
auto pActor = PlayerList[nPlayer].Actor();
|
||||
auto pSprite = &pActor->s();
|
||||
PlayerList[nPlayer].nHealth = 0;
|
||||
|
||||
short nLotag = sector[pSprite->sectnum].lotag;
|
||||
|
@ -562,8 +562,8 @@ int AddAmmo(int nPlayer, int nWeapon, int nAmmoAmount)
|
|||
|
||||
void SetPlayerMummified(int nPlayer, int bIsMummified)
|
||||
{
|
||||
int nSprite = PlayerList[nPlayer].nSprite;
|
||||
auto pSprite = &sprite[nSprite];
|
||||
auto pActor = PlayerList[nPlayer].pActor;
|
||||
auto pSprite = &pActor->s();
|
||||
|
||||
pSprite->yvel = 0;
|
||||
pSprite->xvel = 0;
|
||||
|
@ -611,7 +611,8 @@ static void pickupMessage(int no)
|
|||
|
||||
void UpdatePlayerSpriteAngle(Player* pPlayer)
|
||||
{
|
||||
inita = sprite[pPlayer->nSprite].ang = pPlayer->angle.ang.asbuild();
|
||||
inita = pPlayer->angle.ang.asbuild();
|
||||
if (pPlayer->Actor()) pPlayer->Actor()->s().ang = inita;
|
||||
}
|
||||
|
||||
void AIPlayer::Draw(RunListEvent* ev)
|
||||
|
@ -628,14 +629,14 @@ void AIPlayer::RadialDamage(RunListEvent* ev)
|
|||
short nPlayer = RunData[ev->nRun].nObjIndex;
|
||||
assert(nPlayer >= 0 && nPlayer < kMaxPlayers);
|
||||
|
||||
short nPlayerSprite = PlayerList[nPlayer].nSprite;
|
||||
auto pPlayerActor = PlayerList[nPlayer].Actor();
|
||||
|
||||
if (PlayerList[nPlayer].nHealth <= 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
ev->nDamage = runlist_CheckRadialDamage(nPlayerSprite);
|
||||
ev->nDamage = runlist_CheckRadialDamage(pPlayerActor);
|
||||
Damage(ev);
|
||||
}
|
||||
|
||||
|
@ -755,7 +756,6 @@ void AIPlayer::Tick(RunListEvent* ev)
|
|||
assert(nPlayer >= 0 && nPlayer < kMaxPlayers);
|
||||
|
||||
auto pPlayerActor = PlayerList[nPlayer].Actor();
|
||||
int nPlayerSprite = PlayerList[nPlayer].nSprite;
|
||||
auto pPlayerSprite = &pPlayerActor->s();
|
||||
|
||||
auto pDopple = PlayerList[nPlayer].pDoppleSprite;
|
||||
|
@ -863,7 +863,7 @@ void AIPlayer::Tick(RunListEvent* ev)
|
|||
|
||||
if (pPlayerSprite->zvel >= 6500 && zVel < 6500)
|
||||
{
|
||||
D3PlayFX(StaticSound[kSound17], nPlayerSprite);
|
||||
D3PlayFX(StaticSound[kSound17], pPlayerActor);
|
||||
}
|
||||
|
||||
// loc_1A4E6
|
||||
|
@ -903,7 +903,7 @@ void AIPlayer::Tick(RunListEvent* ev)
|
|||
pPlayerSprite->y += (y >> 14);
|
||||
|
||||
vec3_t pos = { pPlayerSprite->x, pPlayerSprite->y, pPlayerSprite->z };
|
||||
setsprite(nPlayerSprite, &pos);
|
||||
setActorPos(pPlayerActor, &pos);
|
||||
|
||||
pPlayerSprite->z = sector[pPlayerSprite->sectnum].floorz;
|
||||
}
|
||||
|
@ -1004,19 +1004,19 @@ void AIPlayer::Tick(RunListEvent* ev)
|
|||
pPlayerSprite->xvel >>= 2;
|
||||
pPlayerSprite->yvel >>= 2;
|
||||
|
||||
runlist_DamageEnemy(nPlayerSprite, -1, ((zVel - 6500) >> 7) + 10);
|
||||
runlist_DamageEnemy(pPlayerActor, nullptr, ((zVel - 6500) >> 7) + 10);
|
||||
|
||||
if (PlayerList[nPlayer].nHealth <= 0)
|
||||
{
|
||||
pPlayerSprite->xvel = 0;
|
||||
pPlayerSprite->yvel = 0;
|
||||
|
||||
StopSpriteSound(nPlayerSprite);
|
||||
StopActorSound(pPlayerActor);
|
||||
PlayFXAtXYZ(StaticSound[kSoundJonFDie], pPlayerSprite->x, pPlayerSprite->y, pPlayerSprite->z, pPlayerSprite->sectnum, CHANF_NONE, 1); // CHECKME
|
||||
}
|
||||
else
|
||||
{
|
||||
D3PlayFX(StaticSound[kSound27] | 0x2000, nPlayerSprite);
|
||||
D3PlayFX(StaticSound[kSound27] | 0x2000, pPlayerActor);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1699,7 +1699,7 @@ sectdone:
|
|||
|
||||
if (PlayerList[nPlayer].nBreathTimer < 89)
|
||||
{
|
||||
D3PlayFX(StaticSound[kSound13], nPlayerSprite);
|
||||
D3PlayFX(StaticSound[kSound13], pPlayerActor);
|
||||
}
|
||||
|
||||
PlayerList[nPlayer].nBreathTimer = 90;
|
||||
|
@ -2496,7 +2496,7 @@ sectdone:
|
|||
// will invalidate nPlayerSprite
|
||||
RestartPlayer(nPlayer);
|
||||
|
||||
nPlayerSprite = PlayerList[nPlayer].nSprite;
|
||||
pPlayerActor = PlayerList[nPlayer].Actor();
|
||||
pDopple = PlayerList[nPlayer].pDoppleSprite;
|
||||
}
|
||||
else
|
||||
|
@ -2517,7 +2517,7 @@ sectdone:
|
|||
|
||||
int var_AC = SeqOffsets[PlayerList[nPlayer].nSeq] + PlayerSeq[nAction].a;
|
||||
|
||||
seq_MoveSequence(nPlayerSprite, var_AC, PlayerList[nPlayer].field_2);
|
||||
seq_MoveSequence(pPlayerActor, var_AC, PlayerList[nPlayer].field_2);
|
||||
PlayerList[nPlayer].field_2++;
|
||||
|
||||
if (PlayerList[nPlayer].field_2 >= SeqSize[var_AC])
|
||||
|
@ -2642,7 +2642,7 @@ FSerializer& Serialize(FSerializer& arc, const char* keyname, Player& w, Player*
|
|||
arc("health", w.nHealth)
|
||||
("at2", w.field_2)
|
||||
("action", w.nAction)
|
||||
("sprite", w.nSprite)
|
||||
("sprite", w.pActor)
|
||||
("mummy", w.bIsMummified)
|
||||
("invincible", w.invincibility)
|
||||
("air", w.nAir)
|
||||
|
@ -2736,7 +2736,7 @@ DEFINE_FIELD_X(ExhumedPlayer, Player, nInvisible);
|
|||
DEFINE_FIELD_X(ExhumedPlayer, Player, nTorch);
|
||||
DEFINE_FIELD_X(ExhumedPlayer, Player, field_2);
|
||||
DEFINE_FIELD_X(ExhumedPlayer, Player, nAction);
|
||||
DEFINE_FIELD_X(ExhumedPlayer, Player, nSprite);
|
||||
DEFINE_FIELD_X(ExhumedPlayer, Player, pActor);
|
||||
DEFINE_FIELD_X(ExhumedPlayer, Player, bIsMummified);
|
||||
DEFINE_FIELD_X(ExhumedPlayer, Player, invincibility);
|
||||
DEFINE_FIELD_X(ExhumedPlayer, Player, nAir);
|
||||
|
@ -2783,7 +2783,7 @@ DEFINE_ACTION_FUNCTION(_ExhumedPlayer, IsUnderwater)
|
|||
DEFINE_ACTION_FUNCTION(_ExhumedPlayer, GetAngle)
|
||||
{
|
||||
PARAM_SELF_STRUCT_PROLOGUE(Player);
|
||||
ACTION_RETURN_INT(sprite[self->nSprite].ang);
|
||||
ACTION_RETURN_INT(self->Actor()->s().ang);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -58,7 +58,8 @@ struct PlayerSave
|
|||
|
||||
struct Player
|
||||
{
|
||||
DExhumedActor* Actor() { return nSprite == -1? nullptr : &exhumedActors[nSprite]; }
|
||||
DExhumedActor* Actor() { return pActor; }
|
||||
DExhumedActor* pActor;
|
||||
short nHealth;
|
||||
short nLives;
|
||||
short nDouble;
|
||||
|
@ -66,7 +67,6 @@ struct Player
|
|||
short nTorch;
|
||||
short field_2;
|
||||
short nAction;
|
||||
short nSprite;
|
||||
short bIsMummified;
|
||||
short invincibility;
|
||||
short nAir;
|
||||
|
|
|
@ -1704,8 +1704,8 @@ void runlist_DamageEnemy(int nSprite, int nSprite2, short nDamage)
|
|||
if (PlayerList[nPlayer].nTauntTimer <= 0)
|
||||
{
|
||||
// Do a taunt
|
||||
int nPlayerSprite = PlayerList[nPlayer].nSprite;
|
||||
int nSector = sprite[nPlayerSprite].sectnum;
|
||||
auto pPlayerActor = PlayerList[nPlayer].Actor();
|
||||
int nSector = pPlayerActor->s().sectnum;
|
||||
|
||||
if (!(SectFlag[nSector] & kSectUnderwater))
|
||||
{
|
||||
|
|
|
@ -102,12 +102,12 @@ void ExplodeSnakeSprite(DExhumedActor* pActor, short nPlayer)
|
|||
}
|
||||
|
||||
// take a copy of this, to revert after call to runlist_RadialDamageEnemy()
|
||||
short nOwner = pSprite->owner;
|
||||
pSprite->owner = PlayerList[nPlayer].nSprite;
|
||||
auto nOwner = pActor->pTarget;
|
||||
pActor->pTarget = PlayerList[nPlayer].pActor;
|
||||
|
||||
runlist_RadialDamageEnemy(pActor, nDamage, BulletInfo[kWeaponStaff].nRadius);
|
||||
|
||||
pSprite->owner = nOwner;
|
||||
pActor->pTarget = nOwner;
|
||||
|
||||
BuildAnim(nullptr, 23, 0, pSprite->x, pSprite->y, pSprite->z, pSprite->sectnum, 40, 4);
|
||||
|
||||
|
|
|
@ -693,7 +693,7 @@ void CheckAmbience(short nSector)
|
|||
{
|
||||
if (nSector == nSector2)
|
||||
{
|
||||
spritetype* pSprite = &sprite[PlayerList[0].nSprite];
|
||||
spritetype* pSprite = &PlayerList[0].Actor()->s();
|
||||
amb = GetSoundPos(&pSprite->pos);
|
||||
}
|
||||
else
|
||||
|
@ -724,7 +724,7 @@ void UpdateCreepySounds()
|
|||
{
|
||||
if ((currentLevel->gameflags & LEVEL_EX_COUNTDOWN) || nFreeze || !SoundEnabled())
|
||||
return;
|
||||
spritetype* pSprite = &sprite[PlayerList[nLocalPlayer].nSprite];
|
||||
spritetype* pSprite = &PlayerList[nLocalPlayer].Actor()->s();
|
||||
nCreepyTimer--;
|
||||
if (nCreepyTimer <= 0)
|
||||
{
|
||||
|
|
|
@ -87,12 +87,12 @@ static void analyzesprites(spritetype* tsprite, int& spritesortcnt, int x, int y
|
|||
}
|
||||
}
|
||||
|
||||
short nPlayerSprite = PlayerList[nLocalPlayer].nSprite;
|
||||
auto pPlayerActor = PlayerList[nLocalPlayer].Actor();
|
||||
|
||||
int var_38 = 20;
|
||||
int var_2C = 30000;
|
||||
|
||||
spritetype *pPlayerSprite = &sprite[nPlayerSprite];
|
||||
spritetype *pPlayerSprite = &pPlayerActor->s();
|
||||
|
||||
bestTarget = nullptr;
|
||||
|
||||
|
@ -132,7 +132,7 @@ static void analyzesprites(spritetype* tsprite, int& spritesortcnt, int x, int y
|
|||
{
|
||||
runlist_SignalRun(pSprite->lotag - 1, nTSprite | 0x90000);
|
||||
|
||||
if ((pSprite->statnum < 150) && (pSprite->cstat & 0x101) && (nSprite != nPlayerSprite))
|
||||
if ((pSprite->statnum < 150) && (pSprite->cstat & 0x101) && (pActor != pPlayerActor))
|
||||
{
|
||||
int xval = pSprite->x - x;
|
||||
int yval = pSprite->y - y;
|
||||
|
@ -212,8 +212,8 @@ void DrawView(double smoothRatio, bool sceneonly)
|
|||
DoInterpolations(smoothRatio / 65536.);
|
||||
pm_smoothratio = (int)smoothRatio;
|
||||
|
||||
int nPlayerSprite = PlayerList[nLocalPlayer].nSprite;
|
||||
auto pPlayerSprite = &sprite[nPlayerSprite];
|
||||
auto pPlayerActor = PlayerList[nLocalPlayer].Actor();
|
||||
auto pPlayerSprite = &pPlayerActor->s();
|
||||
int nPlayerOldCstat = pPlayerSprite->cstat;
|
||||
auto pDop = &PlayerList[nLocalPlayer].pDoppleSprite->s();
|
||||
int nDoppleOldCstat = pDop->cstat;
|
||||
|
@ -246,10 +246,9 @@ void DrawView(double smoothRatio, bool sceneonly)
|
|||
}
|
||||
else
|
||||
{
|
||||
auto psp = &sprite[nPlayerSprite];
|
||||
playerX = psp->interpolatedx(smoothRatio);
|
||||
playerY = psp->interpolatedy(smoothRatio);
|
||||
playerZ = psp->interpolatedz(smoothRatio) + interpolatedvalue(PlayerList[nLocalPlayer].oeyelevel, PlayerList[nLocalPlayer].eyelevel, smoothRatio);
|
||||
playerX = pPlayerSprite->interpolatedx(smoothRatio);
|
||||
playerY = pPlayerSprite->interpolatedy(smoothRatio);
|
||||
playerZ = pPlayerSprite->interpolatedz(smoothRatio) + interpolatedvalue(PlayerList[nLocalPlayer].oeyelevel, PlayerList[nLocalPlayer].eyelevel, smoothRatio);
|
||||
|
||||
nSector = PlayerList[nLocalPlayer].nPlayerViewSect;
|
||||
updatesector(playerX, playerY, &nSector);
|
||||
|
@ -300,10 +299,10 @@ void DrawView(double smoothRatio, bool sceneonly)
|
|||
if (bCamera)
|
||||
{
|
||||
viewz -= 2560;
|
||||
if (!calcChaseCamPos(&playerX, &playerY, &viewz, &sprite[nPlayerSprite], &nSector, nAngle, pan, smoothRatio))
|
||||
if (!calcChaseCamPos(&playerX, &playerY, &viewz, pPlayerSprite, &nSector, nAngle, pan, smoothRatio))
|
||||
{
|
||||
viewz += 2560;
|
||||
calcChaseCamPos(&playerX, &playerY, &viewz, &sprite[nPlayerSprite], &nSector, nAngle, pan, smoothRatio);
|
||||
calcChaseCamPos(&playerX, &playerY, &viewz, pPlayerSprite, &nSector, nAngle, pan, smoothRatio);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -41,7 +41,7 @@ struct ExhumedPlayer native
|
|||
native int16 nTorch;
|
||||
native int16 field_2;
|
||||
native int16 nAction;
|
||||
native int16 nSprite;
|
||||
//native int16 nSprite;
|
||||
native int16 bIsMummified;
|
||||
native int16 invincibility;
|
||||
native int16 nAir;
|
||||
|
|
Loading…
Reference in a new issue