- even more x() in actor.cpp.

This commit is contained in:
Christoph Oelckers 2021-12-22 18:12:55 +01:00
parent 3201f85ab9
commit 3f65aee70b

View file

@ -5552,27 +5552,26 @@ static void actCheckProximity()
if (actor->hasX()) if (actor->hasX())
{ {
XSPRITE* pXSprite = &actor->x();
switch (actor->spr.type) switch (actor->spr.type)
{ {
case kThingBloodBits: case kThingBloodBits:
case kThingBloodChunks: case kThingBloodChunks:
case kThingZombieHead: case kThingZombieHead:
if (pXSprite->locked && PlayClock >= pXSprite->targetX) pXSprite->locked = 0; if (actor->xspr.locked && PlayClock >= actor->xspr.targetX) actor->xspr.locked = 0;
break; break;
} }
if (pXSprite->burnTime > 0) if (actor->xspr.burnTime > 0)
{ {
pXSprite->burnTime = ClipLow(pXSprite->burnTime - 4, 0); actor->xspr.burnTime = ClipLow(actor->xspr.burnTime - 4, 0);
actDamageSprite(actor->GetBurnSource(), actor, kDamageBurn, 8); actDamageSprite(actor->GetBurnSource(), actor, kDamageBurn, 8);
} }
if (pXSprite->Proximity) if (actor->xspr.Proximity)
{ {
#ifdef NOONE_EXTENSIONS #ifdef NOONE_EXTENSIONS
// don't process locked or 1-shot things for proximity // don't process locked or 1-shot things for proximity
if (gModernMap && (pXSprite->locked || pXSprite->isTriggered)) if (gModernMap && (actor->xspr.locked || actor->xspr.isTriggered))
continue; continue;
#endif #endif
@ -5589,7 +5588,7 @@ static void actCheckProximity()
int proxyDist = 96; int proxyDist = 96;
#ifdef NOONE_EXTENSIONS #ifdef NOONE_EXTENSIONS
// allow dudeLockout for proximity flag // allow dudeLockout for proximity flag
if (gModernMap && actor->spr.type != kThingDroppedLifeLeech && pXSprite->DudeLockout && !dudeactor->IsPlayerActor()) if (gModernMap && actor->spr.type != kThingDroppedLifeLeech && actor->xspr.DudeLockout && !dudeactor->IsPlayerActor())
continue; continue;
if (actor->spr.type == kModernThingEnemyLifeLeech) proxyDist = 512; if (actor->spr.type == kModernThingEnemyLifeLeech) proxyDist = 512;
@ -5656,7 +5655,6 @@ static void actCheckThings()
if (actor->spr.flags & 32) continue; if (actor->spr.flags & 32) continue;
if (!actor->hasX()) continue; if (!actor->hasX()) continue;
auto pXSprite = &actor->x();
auto pSector = actor->spr.sector(); auto pSector = actor->spr.sector();
XSECTOR* pXSector = pSector->hasX()? &pSector->xs() : nullptr; XSECTOR* pXSector = pSector->hasX()? &pSector->xs() : nullptr;
@ -5698,7 +5696,7 @@ static void actCheckThings()
Collision hit = MoveThing(actor); Collision hit = MoveThing(actor);
if (hit.type) if (hit.type)
{ {
if (pXSprite->Impact) trTriggerSprite(actor, kCmdOff); if (actor->xspr.Impact) trTriggerSprite(actor, kCmdOff);
switch (actor->spr.type) switch (actor->spr.type)
{ {
@ -5713,7 +5711,7 @@ static void actCheckThings()
{ {
actor->spr.xrepeat = 32; actor->spr.xrepeat = 32;
actor->spr.yrepeat = 32; actor->spr.yrepeat = 32;
actDamageSprite(actor->GetOwner(), hit.actor(), kDamageFall, pXSprite->data1); actDamageSprite(actor->GetOwner(), hit.actor(), kDamageFall, actor->xspr.data1);
} }
break; break;
#endif #endif
@ -5783,7 +5781,6 @@ static void actCheckExplosion()
continue; continue;
if (!actor->hasX()) continue; if (!actor->hasX()) continue;
XSPRITE* pXSprite = &actor->x();
auto Owner = actor->GetOwner(); auto Owner = actor->GetOwner();
int nType = actor->spr.type; int nType = actor->spr.type;
@ -5798,8 +5795,8 @@ static void actCheckExplosion()
#ifdef NOONE_EXTENSIONS #ifdef NOONE_EXTENSIONS
// Allow to override explosion radius by data4 field of any sprite which have statnum 2 set in editor // Allow to override explosion radius by data4 field of any sprite which have statnum 2 set in editor
// or of Hidden Exploder. // or of Hidden Exploder.
if (gModernMap && pXSprite->data4 > 0) if (gModernMap && actor->xspr.data4 > 0)
radius = pXSprite->data4; radius = actor->xspr.data4;
#endif #endif
// GetClosestSpriteSectors() has issues checking some sectors due to optimizations // GetClosestSpriteSectors() has issues checking some sectors due to optimizations
@ -5821,7 +5818,7 @@ static void actCheckExplosion()
if (CheckSector(sectorMap, dudeactor)) if (CheckSector(sectorMap, dudeactor))
{ {
if (pXSprite->data1 && CheckProximity(dudeactor, x, y, z, pSector, radius)) if (actor->xspr.data1 && CheckProximity(dudeactor, x, y, z, pSector, radius))
{ {
if (pExplodeInfo->dmg && actor->explosionhackflag) if (pExplodeInfo->dmg && actor->explosionhackflag)
{ {
@ -5846,7 +5843,7 @@ static void actCheckExplosion()
if (CheckSector(sectorMap, thingactor)) if (CheckSector(sectorMap, thingactor))
{ {
if (pXSprite->data1 && CheckProximity(thingactor, x, y, z, pSector, radius) && thingactor->hasX()) if (actor->xspr.data1 && CheckProximity(thingactor, x, y, z, pSector, radius) && thingactor->hasX())
{ {
if (!thingactor->xspr.locked) if (!thingactor->xspr.locked)
{ {
@ -5870,12 +5867,12 @@ static void actCheckExplosion()
int dy = (y - pos.Y) >> 4; int dy = (y - pos.Y) >> 4;
int dz = (z - pos.Z) >> 8; int dz = (z - pos.Z) >> 8;
int nDist = dx * dx + dy * dy + dz * dz + 0x40000; int nDist = dx * dx + dy * dy + dz * dz + 0x40000;
int t = DivScale(pXSprite->data2, nDist, 16); int t = DivScale(actor->xspr.data2, nDist, 16);
gPlayer[p].flickerEffect += t; gPlayer[p].flickerEffect += t;
} }
#ifdef NOONE_EXTENSIONS #ifdef NOONE_EXTENSIONS
if (pXSprite->data1 != 0) if (actor->xspr.data1 != 0)
{ {
// add impulse for sprites from physics list // add impulse for sprites from physics list
if (gPhysSpritesCount > 0 && pExplodeInfo->dmgType != 0) if (gPhysSpritesCount > 0 && pExplodeInfo->dmgType != 0)
@ -5912,17 +5909,17 @@ static void actCheckExplosion()
if (!gModernMap || !(actor->spr.flags & kModernTypeFlag1)) if (!gModernMap || !(actor->spr.flags & kModernTypeFlag1))
{ {
// if data4 > 0, do not remove explosion. This can be useful when designer wants put explosion generator in map manually via sprite statnum 2. // if data4 > 0, do not remove explosion. This can be useful when designer wants put explosion generator in map manually via sprite statnum 2.
pXSprite->data1 = ClipLow(pXSprite->data1 - 4, 0); actor->xspr.data1 = ClipLow(actor->xspr.data1 - 4, 0);
pXSprite->data2 = ClipLow(pXSprite->data2 - 4, 0); actor->xspr.data2 = ClipLow(actor->xspr.data2 - 4, 0);
pXSprite->data3 = ClipLow(pXSprite->data3 - 4, 0); actor->xspr.data3 = ClipLow(actor->xspr.data3 - 4, 0);
} }
#else #else
pXSprite->data1 = ClipLow(pXSprite->data1 - 4, 0); actor->xspr.data1 = ClipLow(actor->xspr.data1 - 4, 0);
pXSprite->data2 = ClipLow(pXSprite->data2 - 4, 0); actor->xspr.data2 = ClipLow(actor->xspr.data2 - 4, 0);
pXSprite->data3 = ClipLow(pXSprite->data3 - 4, 0); actor->xspr.data3 = ClipLow(actor->xspr.data3 - 4, 0);
#endif #endif
if (pXSprite->data1 == 0 && pXSprite->data2 == 0 && pXSprite->data3 == 0 && seqGetStatus(actor) < 0) if (actor->xspr.data1 == 0 && actor->xspr.data2 == 0 && actor->xspr.data3 == 0 && seqGetStatus(actor) < 0)
actPostSprite(actor, kStatFree); actPostSprite(actor, kStatFree);
} }
} }
@ -5941,19 +5938,18 @@ static void actCheckTraps()
if ((actor->spr.flags & 32) || !actor->hasX()) if ((actor->spr.flags & 32) || !actor->hasX())
continue; continue;
XSPRITE* pXSprite = &actor->x();
switch (actor->spr.type) { switch (actor->spr.type) {
case kTrapSawCircular: case kTrapSawCircular:
pXSprite->data2 = ClipLow(pXSprite->data2 - 4, 0); actor->xspr.data2 = ClipLow(actor->xspr.data2 - 4, 0);
break; break;
case kTrapFlame: case kTrapFlame:
if (pXSprite->state && seqGetStatus(actor) < 0) if (actor->xspr.state && seqGetStatus(actor) < 0)
{ {
int x = actor->spr.pos.X; int x = actor->spr.pos.X;
int y = actor->spr.pos.Y; int y = actor->spr.pos.Y;
int z = actor->spr.pos.Z; int z = actor->spr.pos.Z;
int t = (pXSprite->data1 << 23) / 120; int t = (actor->xspr.data1 << 23) / 120;
int dx = MulScale(t, Cos(actor->spr.ang), 30); int dx = MulScale(t, Cos(actor->spr.ang), 30);
int dy = MulScale(t, Sin(actor->spr.ang), 30); int dy = MulScale(t, Sin(actor->spr.ang), 30);
for (int i = 0; i < 2; i++) for (int i = 0; i < 2; i++)
@ -5970,7 +5966,7 @@ static void actCheckTraps()
} }
dy = bsin(actor->spr.ang); dy = bsin(actor->spr.ang);
dx = bcos(actor->spr.ang); dx = bcos(actor->spr.ang);
gVectorData[kVectorTchernobogBurn].maxDist = pXSprite->data1 << 9; gVectorData[kVectorTchernobogBurn].maxDist = actor->xspr.data1 << 9;
actFireVector(actor, 0, 0, dx, dy, Random2(0x8888), kVectorTchernobogBurn); actFireVector(actor, 0, 0, dx, dy, Random2(0x8888), kVectorTchernobogBurn);
} }
break; break;