- handle all s() cases in Exhumed using pSprite but not pActor->s().

This commit is contained in:
Christoph Oelckers 2021-12-23 16:44:43 +01:00
parent 3adbed4826
commit 1bb7f3764d
11 changed files with 48 additions and 58 deletions

View file

@ -83,7 +83,7 @@ extern const char *gItemText[];
extern const char *gAmmoText[];
extern const char *gWeaponText[];
template<typename T> void GetSpriteExtents(T const * const pSprite, int *top, int *bottom)
void GetSpriteExtents(spritetypebase const * const pSprite, int *top, int *bottom)
{
*top = *bottom = pSprite->pos.Z;
if ((pSprite->cstat & CSTAT_SPRITE_ALIGNMENT_MASK) != CSTAT_SPRITE_ALIGNMENT_FLOOR)

View file

@ -254,9 +254,9 @@ void BuildExplosion(DExhumedActor* pActor)
BuildAnim(nullptr, edx, 0, pSprite->pos.X, pSprite->pos.Y, pSprite->pos.Z, pSprite->sector(), pSprite->xrepeat, 4);
}
void BuildSplash(DExhumedActor* actor, sectortype* pSector)
void BuildSplash(DExhumedActor* pActor, sectortype* pSector)
{
auto pSprite = &actor->s();
auto pSprite = &pActor->s();
int nRepeat, nSound;
if (pSprite->statnum != 200)

View file

@ -736,18 +736,16 @@ void ExamineSprites(TArray<DExhumedActor*>& actors)
for(auto& ac : actors)
{
auto pSprite = &ac->s();
int nStatus = pSprite->statnum;
int nStatus = ac->spr.statnum;
if (!nStatus)
{
int lotag = pSprite->lotag;
int hitag = pSprite->hitag;
int lotag = ac->spr.lotag;
int hitag = ac->spr.hitag;
if ((nStatus < kMaxStatus) && lotag)
{
pSprite->lotag = 0;
pSprite->hitag = 0;
ac->spr.lotag = 0;
ac->spr.hitag = 0;
ProcessSpriteTag(ac, lotag, hitag);
}

View file

@ -58,15 +58,15 @@ void DrawMap(double const smoothratio)
}
}
template<typename T> void GetSpriteExtents(T const* const pSprite, int* top, int* bottom)
void GetActorExtents(DExhumedActor* actor, int* top, int* bottom)
{
*top = *bottom = pSprite->pos.Z;
if ((pSprite->cstat & CSTAT_SPRITE_ALIGNMENT_MASK) != CSTAT_SPRITE_ALIGNMENT_FLOOR)
*top = *bottom = actor->spr.pos.Z;
if ((actor->spr.cstat & CSTAT_SPRITE_ALIGNMENT_MASK) != CSTAT_SPRITE_ALIGNMENT_FLOOR)
{
int height = tileHeight(pSprite->picnum);
int center = height / 2 + tileTopOffset(pSprite->picnum);
*top -= (pSprite->yrepeat << 2) * center;
*bottom += (pSprite->yrepeat << 2) * (height - center);
int height = tileHeight(actor->spr.picnum);
int center = height / 2 + tileTopOffset(actor->spr.picnum);
*top -= (actor->spr.yrepeat << 2) * center;
*bottom += (actor->spr.yrepeat << 2) * (height - center);
}
}
@ -75,7 +75,6 @@ bool GameInterface::DrawAutomapPlayer(int mx, int my, int x, int y, int z, int a
for (int i = connecthead; i >= 0; i = connectpoint2[i])
{
auto pPlayerActor = PlayerList[i].Actor();
spritetype* pSprite = &pPlayerActor->s();
int xvect = -bsin(a) * z;
int yvect = -bcos(a) * z;
@ -88,20 +87,20 @@ bool GameInterface::DrawAutomapPlayer(int mx, int my, int x, int y, int z, int a
if (i == nLocalPlayer)// || gGameOptions.nGameType == 1)
{
int nTile = pSprite->picnum;
int nTile = pPlayerActor->spr.picnum;
int ceilZ, floorZ;
Collision ceilHit, floorHit;
getzrange(pSprite->pos, pSprite->sector(), &ceilZ, ceilHit, &floorZ, floorHit, (pSprite->clipdist << 2) + 16, CLIPMASK0);
getzrange(pPlayerActor->spr.pos, pPlayerActor->spr.sector(), &ceilZ, ceilHit, &floorZ, floorHit, (pPlayerActor->spr.clipdist << 2) + 16, CLIPMASK0);
int nTop, nBottom;
GetSpriteExtents(pSprite, &nTop, &nBottom);
int nScale = (pSprite->yrepeat + ((floorZ - nBottom) >> 8)) * z;
GetActorExtents(pPlayerActor, &nTop, &nBottom);
int nScale = (pPlayerActor->spr.yrepeat + ((floorZ - nBottom) >> 8)) * z;
nScale = clamp(nScale, 8000, 65536 << 1);
// Players on automap
double x = xdim / 2. + x1 / double(1 << 12);
double y = ydim / 2. + y1 / double(1 << 12);
// This very likely needs fixing later
DrawTexture(twod, tileGetTexture(nTile /*+ ((PlayClock >> 4) & 3)*/, true), xx, yy, DTA_ClipLeft, windowxy1.X, DTA_ClipTop, windowxy1.Y, DTA_ScaleX, z / 1536., DTA_ScaleY, z / 1536., DTA_CenterOffset, true,
DTA_ClipRight, windowxy2.X + 1, DTA_ClipBottom, windowxy2.Y + 1, DTA_Alpha, (pSprite->cstat & CSTAT_SPRITE_TRANSLUCENT ? 0.5 : 1.), TAG_DONE);
DTA_ClipRight, windowxy2.X + 1, DTA_ClipBottom, windowxy2.Y + 1, DTA_Alpha, (pPlayerActor->spr.cstat & CSTAT_SPRITE_TRANSLUCENT ? 0.5 : 1.), TAG_DONE);
break;
}
}

View file

@ -573,9 +573,9 @@ Collision movesprite(DExhumedActor* pActor, int dx, int dy, int dz, int ceildist
return nRet;
}
void Gravity(DExhumedActor* actor)
void Gravity(DExhumedActor* pActor)
{
auto pSprite = &actor->s();
auto pSprite = &pActor->s();
if (pSprite->sector()->Flag & kSectUnderwater)
{
@ -1389,19 +1389,19 @@ DExhumedActor* GrabChunkSprite()
DExhumedActor* BuildCreatureChunk(DExhumedActor* pSrc, int nPic, bool bSpecial)
{
auto actor = GrabChunkSprite();
auto pActor = GrabChunkSprite();
if (actor == nullptr) {
if (pActor == nullptr) {
return nullptr;
}
auto pSprite = &actor->s();
auto pSprite = &pActor->s();
auto pSrcSpr = &pSrc->s();
pSprite->pos.X = pSrcSpr->pos.X;
pSprite->pos.Y = pSrcSpr->pos.Y;
pSprite->pos.Z = pSrcSpr->pos.Z;
ChangeActorSect(actor, pSrcSpr->sector());
ChangeActorSect(pActor, pSrcSpr->sector());
pSprite->cstat = CSTAT_SPRITE_YCENTER;
pSprite->shade = -12;
@ -1429,10 +1429,10 @@ DExhumedActor* BuildCreatureChunk(DExhumedActor* pSrc, int nPic, bool bSpecial)
// GrabTimeSlot(3);
pSprite->extra = -1;
pSprite->owner = runlist_AddRunRec(pSprite->lotag - 1, actor, 0xD0000);
pSprite->hitag = runlist_AddRunRec(NewRun, actor, 0xD0000);
pSprite->owner = runlist_AddRunRec(pSprite->lotag - 1, pActor, 0xD0000);
pSprite->hitag = runlist_AddRunRec(NewRun, pActor, 0xD0000);
return actor;
return pActor;
}
void AICreatureChunk::Tick(RunListEvent* ev)

View file

@ -459,15 +459,14 @@ DExhumedActor* FindWallSprites(sectortype* pSector)
if (pAct == nullptr)
{
pAct = insertActor(pSector, 401);
auto pSprite = &pAct->s();
pSprite->pos.X = (var_24 + esi) / 2;
pSprite->pos.Y = (ecx + edi) / 2;
pSprite->pos.Z = pSector->floorz;
pSprite->cstat = CSTAT_SPRITE_INVISIBLE;
pSprite->owner = -1;
pSprite->lotag = 0;
pSprite->hitag = 0;
pAct->spr.pos.X = (var_24 + esi) / 2;
pAct->spr.pos.Y = (ecx + edi) / 2;
pAct->spr.pos.Z = pSector->floorz;
pAct->spr.cstat = CSTAT_SPRITE_INVISIBLE;
pAct->spr.owner = -1;
pAct->spr.lotag = 0;
pAct->spr.hitag = 0;
}
return pAct;

View file

@ -36,11 +36,8 @@ BEGIN_PS_NS
void GameInterface::WarpToCoords(int x, int y, int z, int ang, int horz)
{
Player *nPlayer = &PlayerList[nLocalPlayer];
spritetype *pSprite = &nPlayer->Actor()->s();
pSprite->opos.X = pSprite->pos.X = x;
pSprite->opos.Y = pSprite->pos.Y = y;
pSprite->opos.Z = pSprite->pos.Z = z;
nPlayer->Actor()->spr.opos = nPlayer->Actor()->spr.pos = { x, y, z };
if (ang != INT_MIN)
{

View file

@ -394,12 +394,12 @@ int DestroyTailPart()
void BuildTail()
{
auto pSprite = &QueenHead.pActor->s();
auto head = QueenHead.pActor;
int x = pSprite->pos.X;
int y = pSprite->pos.X;
int z = pSprite->pos.X;
auto pSector =pSprite->sector();
int x = head->spr.pos.X;
int y = head->spr.pos.X;
int z = head->spr.pos.X;
auto pSector =head->spr.sector();
int i;
@ -1053,10 +1053,9 @@ void AIQueenHead::Tick(RunListEvent* ev)
void AIQueenHead::RadialDamage(RunListEvent* ev)
{
auto pSprite = &QueenHead.pActor->s();
auto pRadial = &ev->pRadialActor->s();
if (pRadial->statnum != 121 && (pSprite->cstat & CSTAT_SPRITE_BLOCK_ALL) != 0)
if (pRadial->statnum != 121 && (QueenHead.pActor->spr.cstat & CSTAT_SPRITE_BLOCK_ALL) != 0)
{
ev->nDamage = runlist_CheckRadialDamage(QueenHead.pActor);
if (ev->nDamage) Damage(ev);

View file

@ -86,10 +86,9 @@ void DestroySnake(int nSnake)
{
DExhumedActor* pSnake = SnakeList[nSnake].pSprites[i];
if (!pSnake) continue;
auto pSprite = &pSnake->s();
runlist_DoSubRunRec(pSprite->lotag - 1);
runlist_DoSubRunRec(pSprite->owner);
runlist_DoSubRunRec(pSnake->spr.lotag - 1);
runlist_DoSubRunRec(pSnake->spr.owner);
DeleteActor(pSnake);
}

View file

@ -714,7 +714,6 @@ void UpdateCreepySounds()
{
if ((currentLevel->gameflags & LEVEL_EX_COUNTDOWN) || nFreeze || !SoundEnabled())
return;
spritetype* pSprite = &PlayerList[nLocalPlayer].pActor->spr;
nCreepyTimer--;
if (nCreepyTimer <= 0)
{
@ -730,7 +729,7 @@ void UpdateCreepySounds()
if (totalmoves & 2)
vax = -vax;
vec3_t sp = { pSprite->pos.X + vdx, pSprite->pos.Y + vax, pSprite->pos.Z };
auto sp = PlayerList[nLocalPlayer].pActor->spr.pos + vec3_t({ vdx, vax, 0 });
creepy = GetSoundPos(&sp);
if ((vsi & 0x1ff) >= kMaxSounds || !soundEngine->isValidSoundId((vsi & 0x1ff) + 1))

View file

@ -442,8 +442,8 @@ void AISWPressSector::Use(RunListEvent* ev)
{
if (SwitchData[nSwitch].nKeyMask)
{
auto pSprite = &PlayerList[nPlayer].Actor()->s();
PlayFXAtXYZ(StaticSound[nSwitchSound], pSprite->pos.X, pSprite->pos.Y, 0, CHANF_LISTENERZ);
auto& pos = PlayerList[nPlayer].Actor()->spr.pos;
PlayFXAtXYZ(StaticSound[nSwitchSound], pos.X, pos.Y, 0, CHANF_LISTENERZ);
StatusMessage(300, "YOU NEED THE KEY FOR THIS DOOR");
}