mirror of
https://github.com/DrBeef/Raze.git
synced 2025-02-20 18:52:43 +00:00
- moved gSpriteHit into DBloodActor.
This commit is contained in:
parent
c34c9deb4e
commit
c0b013ac0c
10 changed files with 103 additions and 81 deletions
|
@ -2855,8 +2855,8 @@ static DBloodActor* actDropKey(DBloodActor* actor, int nType)
|
|||
act2->addX();
|
||||
auto pSprite2 = &act2->s();
|
||||
act2->x().respawn = 3;
|
||||
act2->hit().florhit = 0;
|
||||
act2->hit().ceilhit = 0;
|
||||
act2->hit.florhit = 0;
|
||||
act2->hit.ceilhit = 0;
|
||||
}
|
||||
return act2;
|
||||
}
|
||||
|
@ -4228,7 +4228,7 @@ static void checkCeilHit(DBloodActor* actor)
|
|||
auto pSprite = &actor->s();
|
||||
auto pXSprite = actor->hasX() ? &actor->x() : nullptr;
|
||||
|
||||
Collision coll(actor->hit().ceilhit);
|
||||
Collision coll(actor->hit.ceilhit);
|
||||
switch (coll.type)
|
||||
{
|
||||
case kHitWall:
|
||||
|
@ -4336,7 +4336,7 @@ static void checkHit(DBloodActor* actor)
|
|||
auto pSprite = &actor->s();
|
||||
auto pXSprite = actor->hasX() ? &actor->x() : nullptr;
|
||||
|
||||
Collision coll(actor->hit().hit);
|
||||
Collision coll(actor->hit.hit);
|
||||
switch (coll.type)
|
||||
{
|
||||
case kHitWall:
|
||||
|
@ -4410,7 +4410,7 @@ static void checkFloorHit(DBloodActor* actor)
|
|||
auto pSprite = &actor->s();
|
||||
auto pXSprite = actor->hasX() ? &actor->x() : nullptr;
|
||||
|
||||
Collision coll(actor->hit().florhit);
|
||||
Collision coll(actor->hit.florhit);
|
||||
switch (coll.type)
|
||||
{
|
||||
case kHitWall:
|
||||
|
@ -4548,7 +4548,7 @@ static void ProcessTouchObjects(DBloodActor* actor)
|
|||
if (gModernMap && actor->IsDudeActor())
|
||||
{
|
||||
DBloodActor* actor2 = nullptr;
|
||||
for (Collision* coll : { &actor->hit().hit, &actor->hit().florhit, &actor->hit().ceilhit})
|
||||
for (Collision* coll : { &actor->hit.hit, &actor->hit.florhit, &actor->hit.ceilhit})
|
||||
{
|
||||
if (coll->type == kHitSprite)
|
||||
{
|
||||
|
@ -4565,7 +4565,7 @@ static void ProcessTouchObjects(DBloodActor* actor)
|
|||
}
|
||||
|
||||
// Touch walls
|
||||
Collision coll = actor->hit().hit;
|
||||
Collision coll = actor->hit.hit;
|
||||
int nHWall = -1;
|
||||
if (coll.type == kHitWall)
|
||||
{
|
||||
|
@ -4645,7 +4645,7 @@ static Collision MoveThing(DBloodActor* actor)
|
|||
pSprite->cstat &= ~257;
|
||||
if ((pSprite->owner >= 0) && !cl_bloodvanillaexplosions && !VanillaMode())
|
||||
enginecompatibility_mode = ENGINECOMPATIBILITY_NONE; // improved clipmove accuracy
|
||||
lhit = actor->hit().hit = ClipMove(&pSprite->pos, &nSector, actor->xvel() >> 12, actor->yvel() >> 12, pSprite->clipdist << 2, (pSprite->z - top) / 4, (bottom - pSprite->z) / 4, CLIPMASK0);
|
||||
lhit = actor->hit.hit = ClipMove(&pSprite->pos, &nSector, actor->xvel() >> 12, actor->yvel() >> 12, pSprite->clipdist << 2, (pSprite->z - top) / 4, (bottom - pSprite->z) / 4, CLIPMASK0);
|
||||
enginecompatibility_mode = bakCompat; // restore
|
||||
pSprite->cstat = bakCstat;
|
||||
assert(nSector >= 0);
|
||||
|
@ -4655,7 +4655,7 @@ static Collision MoveThing(DBloodActor* actor)
|
|||
ChangeActorSect(actor, nSector);
|
||||
}
|
||||
|
||||
Collision &coll = actor->hit().hit;
|
||||
Collision &coll = actor->hit.hit;
|
||||
if (coll.type == kHitWall)
|
||||
{
|
||||
int nHitWall = coll.index;
|
||||
|
@ -4716,7 +4716,7 @@ static Collision MoveThing(DBloodActor* actor)
|
|||
if (bottom >= floorZ)
|
||||
{
|
||||
actTouchFloor(actor, pSprite->sectnum);
|
||||
actor->hit().florhit = floorColl;
|
||||
actor->hit.florhit = floorColl;
|
||||
pSprite->z += floorZ - bottom;
|
||||
|
||||
int v20 = actor->zvel() - velFloor[pSprite->sectnum];
|
||||
|
@ -4763,7 +4763,7 @@ static Collision MoveThing(DBloodActor* actor)
|
|||
}
|
||||
else
|
||||
{
|
||||
actor->hit().florhit = 0;
|
||||
actor->hit.florhit = 0;
|
||||
|
||||
if (pSprite->flags & 2)
|
||||
pSprite->flags |= 4;
|
||||
|
@ -4771,7 +4771,7 @@ static Collision MoveThing(DBloodActor* actor)
|
|||
|
||||
if (top <= ceilZ)
|
||||
{
|
||||
actor->hit().ceilhit = ceilColl;
|
||||
actor->hit.ceilhit = ceilColl;
|
||||
pSprite->z += ClipLow(ceilZ - top, 0);
|
||||
if (actor->zvel() < 0)
|
||||
{
|
||||
|
@ -4796,7 +4796,7 @@ static Collision MoveThing(DBloodActor* actor)
|
|||
}
|
||||
}
|
||||
}
|
||||
else actor->hit().ceilhit = 0;
|
||||
else actor->hit.ceilhit = 0;
|
||||
|
||||
if (bottom >= floorZ)
|
||||
{
|
||||
|
@ -4812,7 +4812,7 @@ static Collision MoveThing(DBloodActor* actor)
|
|||
{
|
||||
actor->xvel() += MulScale(4, pSprite->x - hitSpr->x, 2);
|
||||
actor->yvel() += MulScale(4, pSprite->y - hitSpr->y, 2);
|
||||
lhit = actor->hit().hit;
|
||||
lhit = actor->hit.hit;
|
||||
}
|
||||
}
|
||||
if (nVel > 0)
|
||||
|
@ -4869,7 +4869,7 @@ void MoveDude(DBloodActor* actor)
|
|||
{
|
||||
short bakCstat = pSprite->cstat;
|
||||
pSprite->cstat &= ~257;
|
||||
actor->hit().hit = ClipMove(&pSprite->pos, &nSector, actor->xvel() >> 12, actor->yvel() >> 12, wd, tz, bz, CLIPMASK0);
|
||||
actor->hit.hit = ClipMove(&pSprite->pos, &nSector, actor->xvel() >> 12, actor->yvel() >> 12, wd, tz, bz, CLIPMASK0);
|
||||
if (nSector == -1)
|
||||
{
|
||||
nSector = pSprite->sectnum;
|
||||
|
@ -4888,7 +4888,7 @@ void MoveDude(DBloodActor* actor)
|
|||
assert(nSector >= 0);
|
||||
pSprite->cstat = bakCstat;
|
||||
}
|
||||
const Collision& coll = actor->hit().hit;
|
||||
const Collision& coll = actor->hit.hit;
|
||||
switch (coll.type)
|
||||
{
|
||||
case kHitSprite:
|
||||
|
@ -5216,7 +5216,7 @@ void MoveDude(DBloodActor* actor)
|
|||
}
|
||||
if (floorZ <= bottom)
|
||||
{
|
||||
actor->hit().florhit = floorColl;
|
||||
actor->hit.florhit = floorColl;
|
||||
pSprite->z += floorZ - bottom;
|
||||
int v30 = actor->zvel() - velFloor[pSprite->sectnum];
|
||||
if (v30 > 0)
|
||||
|
@ -5276,21 +5276,21 @@ void MoveDude(DBloodActor* actor)
|
|||
}
|
||||
else
|
||||
{
|
||||
actor->hit().florhit = 0;
|
||||
actor->hit.florhit = 0;
|
||||
|
||||
if (pSprite->flags & 2)
|
||||
pSprite->flags |= 4;
|
||||
}
|
||||
if (top <= ceilZ)
|
||||
{
|
||||
actor->hit().ceilhit = ceilColl;
|
||||
actor->hit.ceilhit = ceilColl;
|
||||
pSprite->z += ClipLow(ceilZ - top, 0);
|
||||
|
||||
if (actor->zvel() <= 0 && (pSprite->flags & 4))
|
||||
actor->zvel() = MulScale(-actor->zvel(), 0x2000, 16);
|
||||
}
|
||||
else
|
||||
actor->hit().ceilhit = 0;
|
||||
actor->hit.ceilhit = 0;
|
||||
|
||||
GetActorExtents(actor, &top, &bottom);
|
||||
|
||||
|
@ -5451,13 +5451,13 @@ int MoveMissile(DBloodActor* actor)
|
|||
bottom += vz;
|
||||
if (bottom >= floorZ)
|
||||
{
|
||||
actor->hit().florhit = floorColl;
|
||||
actor->hit.florhit = floorColl;
|
||||
vz += floorZ - bottom;
|
||||
cliptype = 2;
|
||||
}
|
||||
if (top <= ceilZ)
|
||||
{
|
||||
actor->hit().ceilhit = ceilColl;
|
||||
actor->hit.ceilhit = ceilColl;
|
||||
vz += ClipLow(ceilZ - top, 0);
|
||||
cliptype = 1;
|
||||
}
|
||||
|
@ -5528,7 +5528,7 @@ void actExplodeSprite(DBloodActor* actor)
|
|||
|
||||
case kThingArmedTNTStick:
|
||||
nType = kExplosionSmall;
|
||||
if (actor->hit().florhit.type == kHitNone) seqSpawn(4, actor, -1);
|
||||
if (actor->hit.florhit.type == kHitNone) seqSpawn(4, actor, -1);
|
||||
else seqSpawn(3, actor, -1);
|
||||
sfxPlay3DSound(actor, 303, -1, 0);
|
||||
GibSprite(pSprite, GIBTYPE_5, nullptr, nullptr);
|
||||
|
@ -5541,7 +5541,7 @@ void actExplodeSprite(DBloodActor* actor)
|
|||
case kModernThingTNTProx:
|
||||
#endif
|
||||
nType = kExplosionStandard;
|
||||
if (actor->hit().florhit.type == kHitNone) seqSpawn(4, actor, -1);
|
||||
if (actor->hit.florhit.type == kHitNone) seqSpawn(4, actor, -1);
|
||||
else
|
||||
seqSpawn(3, actor, -1);
|
||||
sfxPlay3DSound(actor, 304, -1, 0);
|
||||
|
@ -6402,8 +6402,8 @@ DBloodActor* actSpawnSprite(int nSector, int x, int y, int z, int nStat, bool se
|
|||
if (setextra && !actor->hasX())
|
||||
{
|
||||
actor->addX();
|
||||
actor->hit().florhit = 0;
|
||||
actor->hit().ceilhit = 0;
|
||||
actor->hit.florhit = 0;
|
||||
actor->hit.ceilhit = 0;
|
||||
if (!VanillaMode()) actor->SetTarget(nullptr);
|
||||
}
|
||||
return actor;
|
||||
|
@ -6440,8 +6440,8 @@ DBloodActor* actSpawnSprite(DBloodActor* source, int nStat)
|
|||
actor->zvel() = source->zvel();
|
||||
pSprite->flags = 0;
|
||||
actor->addX();
|
||||
actor->hit().florhit = 0;
|
||||
actor->hit().ceilhit = 0;
|
||||
actor->hit.florhit = 0;
|
||||
actor->hit.ceilhit = 0;
|
||||
if (!VanillaMode()) actor->SetTarget(nullptr);
|
||||
return actor;
|
||||
}
|
||||
|
@ -7346,7 +7346,7 @@ void MakeSplash(DBloodActor* actor)
|
|||
pSprite->flags &= ~2;
|
||||
int nXSprite = pSprite->extra;
|
||||
pSprite->z -= 4 << 8;
|
||||
int nSurface = tileGetSurfType(actor->hit().florhit);
|
||||
int nSurface = tileGetSurfType(actor->hit.florhit);
|
||||
switch (pSprite->type)
|
||||
{
|
||||
case kThingDripWater:
|
||||
|
@ -7426,7 +7426,6 @@ void SerializeActor(FSerializer& arc)
|
|||
if (arc.BeginObject("actor"))
|
||||
{
|
||||
arc("maxdist20", gVectorData[kVectorTchernobogBurn].maxDist) // The code messes around with this field so better save it.
|
||||
.SparseArray("spritehit", gSpriteHit, kMaxSprites, activeXSprites)
|
||||
.EndObject();
|
||||
|
||||
if (arc.isReading() && gGameOptions.nMonsterSettings != 0)
|
||||
|
|
|
@ -936,7 +936,7 @@ static void unicultThinkChase(DBloodActor* actor)
|
|||
else pXSprite->dodgeDir = -1;
|
||||
}
|
||||
|
||||
if (actor->hit().hit.type == kHitWall || actor->hit().hit.type == kHitSprite)
|
||||
if (actor->hit.hit.type == kHitWall || actor->hit.hit.type == kHitSprite)
|
||||
{
|
||||
if (spriteIsUnderwater(actor)) aiGenDudeNewState(actor, &genDudeChaseW);
|
||||
else aiGenDudeNewState(actor, &genDudeChaseL);
|
||||
|
|
|
@ -602,7 +602,7 @@ void viewProcessSprites(spritetype* tsprite, int& spritesortcnt, int32_t cX, int
|
|||
{
|
||||
if (nXSprite > 0)
|
||||
{
|
||||
if (gSpriteHit[nXSprite].florhit.type == kHitNone)
|
||||
if (owneractor->hit.florhit.type == kHitNone)
|
||||
nAnim = 1;
|
||||
}
|
||||
else
|
||||
|
@ -927,7 +927,7 @@ void viewProcessSprites(spritetype* tsprite, int& spritesortcnt, int32_t cX, int
|
|||
case kStatThing: {
|
||||
viewApplyDefaultPal(pTSprite, pSector);
|
||||
|
||||
if (pTSprite->type < kThingBase || pTSprite->type >= kThingMax || gSpriteHit[nXSprite].florhit.type == kHitNone)
|
||||
if (pTSprite->type < kThingBase || pTSprite->type >= kThingMax || owneractor->hit.florhit.type == kHitNone)
|
||||
{
|
||||
if ((pTSprite->flags & kPhysMove) && getflorzofslope(pTSprite->sectnum, pTSprite->x, pTSprite->y) >= cZ)
|
||||
viewAddEffect(tsprite, spritesortcnt, nTSprite, kViewEffectShadow);
|
||||
|
|
|
@ -81,7 +81,6 @@ struct SPRITEHIT
|
|||
{
|
||||
Collision hit, ceilhit, florhit;
|
||||
};
|
||||
extern SPRITEHIT gSpriteHit[kMaxXSprites];
|
||||
|
||||
|
||||
// Due to the messed up array storage of all the game data we cannot do any direct references here yet. We have to access everything via wrapper functions for now.
|
||||
|
@ -93,6 +92,7 @@ class DBloodActor
|
|||
|
||||
public:
|
||||
int dudeSlope;
|
||||
SPRITEHIT hit;
|
||||
DUDEEXTRA dudeExtra;
|
||||
SPRITEMASS spriteMass;
|
||||
GENDUDEEXTRA genDudeExtra;
|
||||
|
@ -111,6 +111,7 @@ public:
|
|||
dudeSlope = 0;
|
||||
dudeExtra = {};
|
||||
spriteMass = {};
|
||||
hit = {};
|
||||
}
|
||||
bool hasX() { return sprite[index].extra > 0; }
|
||||
void addX()
|
||||
|
@ -119,7 +120,6 @@ public:
|
|||
}
|
||||
spritetype& s() { return sprite[index]; }
|
||||
XSPRITE& x() { return xsprite[sprite[index].extra]; } // calling this does not validate the xsprite!
|
||||
SPRITEHIT& hit() { return gSpriteHit[sprite[index].extra]; }
|
||||
int& xvel() { return Blood::xvel[index]; }
|
||||
int& yvel() { return Blood::yvel[index]; }
|
||||
int& zvel() { return Blood::zvel[index]; }
|
||||
|
|
|
@ -49,8 +49,6 @@ XSPRITE xsprite[kMaxXSprites];
|
|||
XSECTOR xsector[kMaxXSectors];
|
||||
XWALL xwall[kMaxXWalls];
|
||||
|
||||
SPRITEHIT gSpriteHit[kMaxXSprites];
|
||||
|
||||
int xvel[kMaxSprites], yvel[kMaxSprites], zvel[kMaxSprites];
|
||||
|
||||
unsigned short nextXSprite[kMaxXSprites];
|
||||
|
@ -309,7 +307,7 @@ unsigned short dbInsertXSprite(int nSprite)
|
|||
I_Error("Out of free XSprites");
|
||||
}
|
||||
memset(&xsprite[nXSprite], 0, sizeof(XSPRITE));
|
||||
memset(&gSpriteHit[nXSprite], 0, sizeof(SPRITEHIT));
|
||||
bloodActors[nSprite].hit = {};
|
||||
xsprite[nXSprite].reference = nSprite;
|
||||
sprite[nSprite].extra = nXSprite;
|
||||
return nXSprite;
|
||||
|
|
|
@ -484,12 +484,13 @@ FSerializer& Serialize(FSerializer& arc, const char* keyname, DBloodActor& w, DB
|
|||
arc("dudeslope", w.dudeSlope, def->dudeSlope)
|
||||
("dudeextra", w.dudeExtra, def->dudeExtra)
|
||||
("explosionflag", w.explosionhackflag, def->explosionhackflag)
|
||||
("prevmarker", w.prevmarker, def->prevmarker);
|
||||
("spritehit", w.hit, def->hit);
|
||||
|
||||
if (gModernMap)
|
||||
{
|
||||
arc("spritemass", w.spriteMass, def->spriteMass); // no treatment for old savegames. If this gets lost it is not critical
|
||||
#ifndef OLD_SAVEGAME
|
||||
arc("spritemass", w.spriteMass, def->spriteMass);
|
||||
("prevmarker", w.prevmarker, def->prevmarker);
|
||||
|
||||
// GenDudeExtra only contains valid info for kDudeModernCustom and kDudeModernCustomBurning so only save when needed as these are not small.
|
||||
if (w.s().type == kDudeModernCustom || w.s().time == kDudeModernCustomBurning)
|
||||
|
|
|
@ -1420,7 +1420,7 @@ void nnExtProcessSuperSprites()
|
|||
{
|
||||
pPlayer = &gPlayer[a];
|
||||
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());
|
||||
nSpeed = ClipLow(nSpeed - MulScale(nSpeed, mass, 6), 0x9000 - (mass << 3));
|
||||
|
@ -1428,7 +1428,7 @@ void nnExtProcessSuperSprites()
|
|||
debrisactor->xvel() += MulScale(nSpeed, Cos(pPlayer->pSprite->ang), 30);
|
||||
debrisactor->yvel() += MulScale(nSpeed, Sin(pPlayer->pSprite->ang), 30);
|
||||
|
||||
debrisactor->hit().hit = pPlayer->pSprite->index | 0xc000;
|
||||
debrisactor->hit.hit = pPlayer->pSprite->index | 0xc000;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1771,7 +1771,7 @@ void debrisMove(int listIndex)
|
|||
short oldcstat = pSprite->cstat;
|
||||
pSprite->cstat &= ~(CSTAT_SPRITE_BLOCK | CSTAT_SPRITE_BLOCK_HITSCAN);
|
||||
|
||||
moveHit = actor->hit().hit = ClipMove(&pSprite->pos, &nSector, actor->xvel() >> 12,
|
||||
moveHit = actor->hit.hit = ClipMove(&pSprite->pos, &nSector, actor->xvel() >> 12,
|
||||
actor->yvel() >> 12, clipDist, ceilDist, floorDist, CLIPMASK0);
|
||||
|
||||
pSprite->cstat = oldcstat;
|
||||
|
@ -1788,9 +1788,9 @@ void debrisMove(int listIndex)
|
|||
nSector = nSector2;
|
||||
}
|
||||
|
||||
if (actor->hit().hit.type == kHitWall)
|
||||
if (actor->hit.hit.type == kHitWall)
|
||||
{
|
||||
moveHit = actor->hit().hit;
|
||||
moveHit = actor->hit.hit;
|
||||
i = moveHit.index;
|
||||
actWallBounceVector(&actor->xvel(), &actor->yvel(), i, tmpFraction);
|
||||
}
|
||||
|
@ -1880,7 +1880,7 @@ void debrisMove(int listIndex)
|
|||
|
||||
if (floorZ <= bottom) {
|
||||
|
||||
actor->hit().florhit = floorColl;
|
||||
actor->hit.florhit = floorColl;
|
||||
int v30 = actor->zvel() - velFloor[pSprite->sectnum];
|
||||
|
||||
if (v30 > 0)
|
||||
|
@ -1922,14 +1922,14 @@ void debrisMove(int listIndex)
|
|||
}
|
||||
else
|
||||
{
|
||||
actor->hit().florhit.setNone();
|
||||
actor->hit.florhit.setNone();
|
||||
if (pXSprite->physAttr & kPhysGravity)
|
||||
pXSprite->physAttr |= kPhysFalling;
|
||||
}
|
||||
|
||||
if (top <= ceilZ)
|
||||
{
|
||||
actor->hit().ceilhit = moveHit = ceilColl;
|
||||
actor->hit.ceilhit = moveHit = ceilColl;
|
||||
pSprite->z += ClipLow(ceilZ - top, 0);
|
||||
if (actor->zvel() <= 0 && (pXSprite->physAttr & kPhysFalling))
|
||||
actor->zvel() = MulScale(-actor->zvel(), 0x2000, 16);
|
||||
|
@ -1937,7 +1937,7 @@ void debrisMove(int listIndex)
|
|||
}
|
||||
else
|
||||
{
|
||||
actor->hit().ceilhit.setNone();
|
||||
actor->hit.ceilhit.setNone();
|
||||
GetActorExtents(actor, &top, &bottom);
|
||||
}
|
||||
|
||||
|
@ -3059,7 +3059,7 @@ void useTeleportTarget(DBloodActor* sourceactor, DBloodActor* actor)
|
|||
GetActorExtents(sourceactor, &zTop, &zBot);
|
||||
pSprite->z = zBot;
|
||||
|
||||
clampSprite(pSprite, 0x01);
|
||||
clampSprite(actor, 0x01);
|
||||
|
||||
if (pSource->flags & kModernTypeFlag1) // force telefrag
|
||||
TeleFrag(pSprite->index, pSource->sectnum);
|
||||
|
@ -3394,7 +3394,7 @@ void useSpriteDamager(DBloodActor* sourceactor, int objType, int objIndex, DBloo
|
|||
BloodSectIterator it(objIndex);
|
||||
while (auto iactor = it.Next())
|
||||
{
|
||||
auto& hit = iactor->hit();
|
||||
auto& hit = iactor->hit;
|
||||
|
||||
if (!iactor->IsDudeActor() || !iactor->hasX())
|
||||
continue;
|
||||
|
@ -4646,16 +4646,16 @@ bool condCheckSprite(DBloodActor* aCond, int cmpOp, bool PUSH)
|
|||
else if (pSpr->type >= kThingBase && pSpr->type < kThingMax) var = thingInfo[pSpr->type - kThingBase].startHealth << 4;
|
||||
return condCmp((kPercFull * pXSpr->health) / ClipLow(var, 1), arg1, arg2, cmpOp);
|
||||
case 55: // touching ceil of sector?
|
||||
if (objActor->hit().ceilhit.type != kHitSector) return false;
|
||||
else if (PUSH) condPush(aCond, OBJ_SECTOR, objActor->hit().ceilhit.index, nullptr);
|
||||
if (objActor->hit.ceilhit.type != kHitSector) return false;
|
||||
else if (PUSH) condPush(aCond, OBJ_SECTOR, objActor->hit.ceilhit.index, nullptr);
|
||||
return true;
|
||||
case 56: // touching floor of sector?
|
||||
if (objActor->hit().florhit.type != kHitSector) return false;
|
||||
else if (PUSH) condPush(aCond, OBJ_SECTOR, objActor->hit().florhit.index, nullptr);
|
||||
if (objActor->hit.florhit.type != kHitSector) return false;
|
||||
else if (PUSH) condPush(aCond, OBJ_SECTOR, objActor->hit.florhit.index, nullptr);
|
||||
return true;
|
||||
case 57: // touching walls of sector?
|
||||
if (objActor->hit().hit.type != kHitWall) return false;
|
||||
else if (PUSH) condPush(aCond, OBJ_WALL, objActor->hit().hit.index, nullptr);
|
||||
if (objActor->hit.hit.type != kHitWall) return false;
|
||||
else if (PUSH) condPush(aCond, OBJ_WALL, objActor->hit.hit.index, nullptr);
|
||||
return true;
|
||||
case 58: // touching another sprite?
|
||||
{
|
||||
|
@ -4664,15 +4664,15 @@ bool condCheckSprite(DBloodActor* aCond, int cmpOp, bool PUSH)
|
|||
{
|
||||
case 0:
|
||||
case 1:
|
||||
if (objActor->hit().florhit.type == kHitSprite) actorvar = objActor->hit().florhit.actor;
|
||||
if (objActor->hit.florhit.type == kHitSprite) actorvar = objActor->hit.florhit.actor;
|
||||
if (arg3 || var >= 0) break;
|
||||
[[fallthrough]];
|
||||
case 2:
|
||||
if (objActor->hit().hit.type == kHitSprite) actorvar = objActor->hit().hit.actor;
|
||||
if (objActor->hit.hit.type == kHitSprite) actorvar = objActor->hit.hit.actor;
|
||||
if (arg3 || var >= 0) break;
|
||||
[[fallthrough]];
|
||||
case 3:
|
||||
if (objActor->hit().ceilhit.type == kHitSprite) actorvar = objActor->hit().ceilhit.actor;
|
||||
if (objActor->hit.ceilhit.type == kHitSprite) actorvar = objActor->hit.ceilhit.actor;
|
||||
break;
|
||||
}
|
||||
if (actorvar == nullptr)
|
||||
|
@ -4684,7 +4684,7 @@ bool condCheckSprite(DBloodActor* aCond, int cmpOp, bool PUSH)
|
|||
auto iactor = &bloodActors[idx];
|
||||
|
||||
if (iactor->s().flags & kHitagRespawn) continue;
|
||||
auto& hit = iactor->hit();
|
||||
auto& hit = iactor->hit;
|
||||
switch (arg3)
|
||||
{
|
||||
case 0:
|
||||
|
@ -6408,8 +6408,7 @@ void useRandomItemGen(DBloodActor* actor)
|
|||
|
||||
if (dropactor != nullptr)
|
||||
{
|
||||
auto pDrop = &dropactor->s();
|
||||
clampSprite(pDrop);
|
||||
clampSprite(dropactor);
|
||||
|
||||
// check if generator affected by physics
|
||||
if (debrisGetIndex(actor) != -1)
|
||||
|
@ -8165,9 +8164,9 @@ void aiPatrolMove(DBloodActor* actor)
|
|||
return;
|
||||
}
|
||||
|
||||
if (actor->hit().hit.type == kHitSprite)
|
||||
if (actor->hit.hit.type == kHitSprite)
|
||||
{
|
||||
auto hitactor = actor->hit().hit.actor;
|
||||
auto hitactor = actor->hit.hit.actor;
|
||||
hitactor->x().dodgeDir = -1;
|
||||
pXSprite->dodgeDir = 1;
|
||||
aiMoveDodge(hitactor);
|
||||
|
@ -8311,7 +8310,7 @@ bool spritesTouching(DBloodActor *actor1, DBloodActor* actor2)
|
|||
if (!actor1->hasX() || !actor2->hasX())
|
||||
return false;
|
||||
|
||||
auto hit = &actor1->hit();
|
||||
auto hit = &actor1->hit;
|
||||
DBloodActor* hitactor = nullptr;
|
||||
if (hit->hit.type == kHitSprite) hitactor = hit->hit.actor;
|
||||
else if (hit->florhit.type == kHitSprite) hitactor = hit->florhit.actor;
|
||||
|
@ -8961,7 +8960,12 @@ void aiPatrolThink(DBloodActor* actor)
|
|||
return;
|
||||
|
||||
}
|
||||
// ------------------------------------------------
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
//
|
||||
//
|
||||
//
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
int listTx(DBloodActor* actor, int tx)
|
||||
{
|
||||
|
@ -9133,14 +9137,25 @@ void seqSpawnerOffSameTx(DBloodActor* actor)
|
|||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
//
|
||||
// this function can be called via sending numbered command to TX kChannelModernEndLevelCustom
|
||||
// it allows to set custom next level instead of taking it from INI file.
|
||||
void levelEndLevelCustom(int nLevel) {
|
||||
//
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
void levelEndLevelCustom(int nLevel)
|
||||
{
|
||||
gGameOptions.uGameFlags |= GF_AdvanceLevel;
|
||||
gNextLevel = FindMapByIndex(currentLevel->cluster, nLevel + 1);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
//
|
||||
//
|
||||
//
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
void callbackUniMissileBurst(DBloodActor* actor, int) // 22
|
||||
{
|
||||
if (!actor) return;
|
||||
|
@ -9152,7 +9167,8 @@ void callbackUniMissileBurst(DBloodActor* actor, int) // 22
|
|||
for (int i = 0; i < 8; i++)
|
||||
{
|
||||
auto burstactor = actSpawnSprite(actor, 5);
|
||||
auto pBurst = &burstactor->s();
|
||||
if (!burstactor) break;
|
||||
spritetype* pBurst = &burstactor->s();
|
||||
|
||||
pBurst->type = pSprite->type;
|
||||
pBurst->shade = pSprite->shade;
|
||||
|
@ -9160,9 +9176,10 @@ void callbackUniMissileBurst(DBloodActor* actor, int) // 22
|
|||
|
||||
|
||||
pBurst->cstat = pSprite->cstat;
|
||||
if ((pBurst->cstat & CSTAT_SPRITE_BLOCK)) {
|
||||
if ((pBurst->cstat & CSTAT_SPRITE_BLOCK))
|
||||
{
|
||||
pBurst->cstat &= ~CSTAT_SPRITE_BLOCK; // we don't want missiles impact each other
|
||||
evPostActor(&bloodActors[pBurst->index], 100, kCallbackMissileSpriteBlock); // so set blocking flag a bit later
|
||||
evPostActor(burstactor, 100, kCallbackMissileSpriteBlock); // so set blocking flag a bit later
|
||||
}
|
||||
|
||||
pBurst->pal = pSprite->pal;
|
||||
|
@ -9173,7 +9190,7 @@ void callbackUniMissileBurst(DBloodActor* actor, int) // 22
|
|||
pBurst->ang = ((pSprite->ang + missileInfo[pSprite->type - kMissileBase].angleOfs) & 2047);
|
||||
pBurst->owner = pSprite->owner;
|
||||
|
||||
actBuildMissile(&bloodActors[pBurst->index], &bloodActors[pSprite->index]);
|
||||
actBuildMissile(burstactor, actor);
|
||||
|
||||
int nAngle2 = (i << 11) / 8;
|
||||
int dx = 0;
|
||||
|
@ -9188,12 +9205,18 @@ void callbackUniMissileBurst(DBloodActor* actor, int) // 22
|
|||
burstactor->xvel() += dx;
|
||||
burstactor->yvel() += dy;
|
||||
burstactor->zvel() += dz;
|
||||
evPostActor(&bloodActors[pBurst->index], 960, kCallbackRemove);
|
||||
evPostActor(burstactor, 960, kCallbackRemove);
|
||||
}
|
||||
evPostActor(actor, 0, kCallbackRemove);
|
||||
}
|
||||
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
//
|
||||
//
|
||||
//
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
void callbackMakeMissileBlocking(DBloodActor* actor, int) // 23
|
||||
{
|
||||
if (!actor || actor->s().statnum != kStatProjectile) return;
|
||||
|
@ -9206,11 +9229,12 @@ void callbackGenDudeUpdate(DBloodActor* actor, int) // 24
|
|||
genDudeUpdate(actor);
|
||||
}
|
||||
|
||||
void clampSprite(spritetype* pSprite, int which) {
|
||||
|
||||
void clampSprite(DBloodActor* actor, int which)
|
||||
{
|
||||
auto pSprite = &actor->s();
|
||||
int zTop, zBot;
|
||||
if (pSprite->sectnum >= 0 && pSprite->sectnum < kMaxSectors) {
|
||||
|
||||
if (pSprite->sectnum >= 0 && pSprite->sectnum < kMaxSectors)
|
||||
{
|
||||
GetSpriteExtents(pSprite, &zTop, &zBot);
|
||||
if (which & 0x01)
|
||||
pSprite->z += ClipHigh(getflorzofslope(pSprite->sectnum, pSprite->x, pSprite->y) - zBot, 0);
|
||||
|
|
|
@ -417,7 +417,7 @@ inline bool aiInPatrolState(int nAiStateType) {
|
|||
// ------------------------------------------------------------------------- //
|
||||
bool readyForCrit(DBloodActor* pHunter, DBloodActor* pVictim);
|
||||
int sectorInMotion(int nSector);
|
||||
void clampSprite(spritetype* pSprite, int which = 0x03);
|
||||
void clampSprite(DBloodActor* actor, int which = 3);
|
||||
#endif
|
||||
|
||||
inline bool valueIsBetween(int val, int min, int max)
|
||||
|
|
|
@ -1338,7 +1338,7 @@ void doslopetilting(PLAYER* pPlayer, double const scaleAdjust = 1)
|
|||
{
|
||||
auto* const pSprite = pPlayer->pSprite;
|
||||
auto* const pXSprite = pPlayer->pXSprite;
|
||||
int const florhit = gSpriteHit[pSprite->extra].florhit.type;
|
||||
int const florhit = pPlayer->actor()->hit.florhit.type;
|
||||
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);
|
||||
}
|
||||
|
@ -2150,7 +2150,7 @@ void playerLandingSound(PLAYER *pPlayer)
|
|||
603
|
||||
};
|
||||
spritetype *pSprite = pPlayer->pSprite;
|
||||
SPRITEHIT *pHit = &gSpriteHit[pSprite->extra];
|
||||
SPRITEHIT* pHit = &pPlayer->actor()->hit;
|
||||
if (pHit->florhit.type != kHitNone)
|
||||
{
|
||||
if (!gGameOptions.bFriendlyFire && pHit->florhit.type == kHitSprite && IsTargetTeammate(pPlayer, &pHit->florhit.actor->s()))
|
||||
|
|
|
@ -69,7 +69,7 @@ void viewInitializePrediction(void)
|
|||
predict.at48 = gMe->posture;
|
||||
predict.spin = gMe->angle.spin;
|
||||
predict.at6e = !!(gMe->input.actions & SB_CENTERVIEW);
|
||||
memcpy(&predict.at75,&gSpriteHit[gMe->pSprite->extra],sizeof(SPRITEHIT));
|
||||
predict.at75 = gMe->actor()->hit;
|
||||
predict.bobPhase = gMe->bobPhase;
|
||||
predict.Kills = gMe->bobAmp;
|
||||
predict.bobHeight = gMe->bobHeight;
|
||||
|
|
Loading…
Reference in a new issue