- Blood: first part of wrapping spr.pos write access.

This commit is contained in:
Christoph Oelckers 2022-01-30 16:20:11 +01:00
parent 29d0f86726
commit 70d5ba6abe
4 changed files with 21 additions and 30 deletions

View file

@ -2876,7 +2876,7 @@ DBloodActor* actDropObject(DBloodActor* actor, int nType)
int top, bottom;
GetActorExtents(act2, &top, &bottom);
if (bottom >= act2->spr.pos.Z)
act2->spr.pos.Z -= bottom - act2->spr.pos.Z;
act2->add_int_z(-(bottom - act2->spr.pos.Z));
}
return act2;
@ -4575,7 +4575,7 @@ static Collision MoveThing(DBloodActor* actor)
FindSector(actor->spr.pos.X, actor->spr.pos.Y, actor->spr.pos.Z, &pSector);
}
actor->spr.pos.Z += actor->vel.Z >> 8;
actor->add_int_z(actor->vel.Z >> 8);
int ceilZ, floorZ;
Collision ceilColl, floorColl;
@ -4584,7 +4584,7 @@ static Collision MoveThing(DBloodActor* actor)
if ((actor->spr.flags & 2) && bottom < floorZ)
{
actor->spr.pos.Z += 455;
actor->add_int_z(455);
actor->vel.Z += 58254;
if (actor->spr.type == kThingZombieHead)
{
@ -4613,7 +4613,7 @@ static Collision MoveThing(DBloodActor* actor)
{
actTouchFloor(actor, actor->sector());
actor->hit.florhit = floorColl;
actor->spr.pos.Z += floorZ - bottom;
actor->add_int_z(floorZ - bottom);
int v20 = actor->vel.Z - actor->sector()->velFloor;
if (v20 > 0)
@ -4668,7 +4668,7 @@ static Collision MoveThing(DBloodActor* actor)
if (top <= ceilZ)
{
actor->hit.ceilhit = ceilColl;
actor->spr.pos.Z += ClipLow(ceilZ - top, 0);
actor->add_int_z(ClipLow(ceilZ - top, 0));
if (actor->vel.Z < 0)
{
actor->vel.X = MulScale(actor->vel.X, 0xc000, 16);
@ -4753,8 +4753,7 @@ void MoveDude(DBloodActor* actor)
{
if (pPlayer && gNoClip)
{
actor->spr.pos.X += actor->vel.X >> 12;
actor->spr.pos.Y += actor->vel.Y >> 12;
actor->add_int_pos({ actor->vel.X >> 12, actor->vel.Y >> 12, 0 });
if (!FindSector(actor->spr.pos.X, actor->spr.pos.Y, &pSector))
pSector = actor->sector();
}
@ -4875,7 +4874,7 @@ void MoveDude(DBloodActor* actor)
if (pUpperLink && (pUpperLink->spr.type == kMarkerUpWater || pUpperLink->spr.type == kMarkerUpGoo)) bDepth = 1;
if (pLowerLink && (pLowerLink->spr.type == kMarkerLowWater || pLowerLink->spr.type == kMarkerLowGoo)) bDepth = 1;
if (pPlayer) wd += 16;
if (actor->vel.Z) actor->spr.pos.Z += actor->vel.Z >> 8;
if (actor->vel.Z) actor->add_int_z(actor->vel.Z >> 8);
int ceilZ, floorZ;
Collision ceilColl, floorColl;
@ -4911,7 +4910,7 @@ void MoveDude(DBloodActor* actor)
}
if (vc)
{
actor->spr.pos.Z += ((vc * 4) / 2) >> 8;
actor->add_int_z(((vc * 4) / 2) >> 8);
actor->vel.Z += vc;
}
}
@ -5102,7 +5101,7 @@ void MoveDude(DBloodActor* actor)
if (floorZ <= bottom)
{
actor->hit.florhit = floorColl;
actor->spr.pos.Z += floorZ - bottom;
actor->add_int_z(floorZ - bottom);
int v30 = actor->vel.Z - actor->sector()->velFloor;
if (v30 > 0)
{
@ -5168,7 +5167,7 @@ void MoveDude(DBloodActor* actor)
if (top <= ceilZ)
{
actor->hit.ceilhit = ceilColl;
actor->spr.pos.Z += ClipLow(ceilZ - top, 0);
actor->add_int_z(ClipLow(ceilZ - top, 0));
if (actor->vel.Z <= 0 && (actor->spr.flags & 4))
actor->vel.Z = MulScale(-actor->vel.Z, 0x2000, 16);
@ -5341,7 +5340,7 @@ int MoveMissile(DBloodActor* actor)
cliptype = 1;
}
actor->spr.pos = pos;
actor->spr.pos.Z += vz;
actor->add_int_z(vz);
updatesector(pos.X, pos.Y, &pSector);
if (pSector != nullptr && pSector != actor->sector())
{
@ -6220,12 +6219,8 @@ DBloodActor* actSpawnSprite(DBloodActor* source, int nStat)
{
DBloodActor* actor = InsertSprite(source->sector(), nStat);
actor->spr.pos.X = source->spr.pos.X;
actor->spr.pos.Y = source->spr.pos.Y;
actor->spr.pos.Z = source->spr.pos.Z;
actor->vel.X = source->vel.X;
actor->vel.Y = source->vel.Y;
actor->vel.Z = source->vel.Z;
actor->set_int_pos(source->spr.pos);
actor->vel = source->vel;
actor->spr.flags = 0;
actor->addX();
actor->hit.florhit.setNone();
@ -7088,7 +7083,7 @@ void actPostProcess(void)
void MakeSplash(DBloodActor* actor)
{
actor->spr.flags &= ~2;
actor->spr.pos.Z -= 4 << 8;
actor->add_int_z(-(4 << 8));
int nSurface = tileGetSurfType(actor->hit.florhit);
switch (actor->spr.type)
{

View file

@ -2486,9 +2486,9 @@ bool genDudePrepare(DBloodActor* actor, int propId)
// make sure dudes aren't in the floor or ceiling
int zTop, zBot; GetActorExtents(actor, &zTop, &zBot);
if (!(actor->sector()->ceilingstat & CSTAT_SECTOR_SKY))
actor->spr.pos.Z += ClipLow(actor->sector()->ceilingz - zTop, 0);
actor->add_int_z(ClipLow(actor->sector()->ceilingz - zTop, 0));
if (!(actor->sector()->floorstat & CSTAT_SECTOR_SKY))
actor->spr.pos.Z += ClipHigh(actor->sector()->floorz - zBot, 0);
actor->add_int_z(ClipHigh(actor->sector()->floorz - zBot, 0));
actor->spr.clipdist = ClipRange((actor->spr.xrepeat + actor->spr.yrepeat) >> 1, 4, 120);
if (propId) break;

View file

@ -461,7 +461,7 @@ void fxBloodBits(DBloodActor* actor, sectortype*) // 14
GetZRange(actor, &ceilZ, &ceilColl, &floorZ, &floorColl, actor->spr.clipdist, CLIPMASK0);
int top, bottom;
GetActorExtents(actor, &top, &bottom);
actor->spr.pos.Z += floorZ - bottom;
actor->add_int_z(floorZ - bottom);
int nAngle = Random(2048);
int nDist = Random(16) << 4;
int x = actor->spr.pos.X + MulScale(nDist, Cos(nAngle), 28);
@ -519,7 +519,7 @@ void fxBouncingSleeve(DBloodActor* actor, sectortype*) // 16
GetZRange(actor, &ceilZ, &ceilColl, &floorZ, &floorColl, actor->spr.clipdist, CLIPMASK0);
int top, bottom; GetActorExtents(actor, &top, &bottom);
actor->spr.pos.Z += floorZ - bottom;
actor->add_int_z(floorZ - bottom);
int zv = actor->vel.Z - actor->sector()->velFloor;
@ -648,7 +648,7 @@ void fxPodBloodSplat(DBloodActor* actor, sectortype*) // 19
GetZRange(actor, &ceilZ, &ceilColl, &floorZ, &floorColl, actor->spr.clipdist, CLIPMASK0);
int top, bottom;
GetActorExtents(actor, &top, &bottom);
actor->spr.pos.Z += floorZ - bottom;
actor->add_int_z(floorZ - bottom);
int nAngle = Random(2048);
int nDist = Random(16) << 4;
int x = actor->spr.pos.X + MulScale(nDist, Cos(nAngle), 28);
@ -708,9 +708,7 @@ void sub_76A08(DBloodActor* actor, DBloodActor* actor2, PLAYER* pPlayer) // ???
{
int top, bottom;
GetActorExtents(actor, &top, &bottom);
actor->spr.pos.X = actor2->spr.pos.X;
actor->spr.pos.Y = actor2->spr.pos.Y;
actor->spr.pos.Z = actor2->sector()->floorz - (bottom - actor->spr.pos.Z);
actor->set_int_pos({ actor2->spr.pos.X, actor2->spr.pos.Y, actor2->sector()->floorz - (bottom - actor->spr.pos.Z) });
actor->spr.ang = actor2->spr.ang;
ChangeActorSect(actor, actor2->sector());
sfxPlay3DSound(actor2, 201, -1, 0);

View file

@ -208,9 +208,7 @@ void CFX::fxProcess(void)
assert(actor->spr.type < kFXMax);
FXDATA* pFXData = &gFXData[actor->spr.type];
actAirDrag(actor, pFXData->drag);
actor->spr.pos.X += actor->vel.X >> 12;
actor->spr.pos.Y += actor->vel.Y >> 12;
actor->spr.pos.Z += actor->vel.Z >> 8;
actor->add_int_pos({ actor->vel.X >> 12, actor->vel.Y >> 12, actor->vel.Z >> 8 });
// Weird...
if (actor->vel.X || (actor->vel.Y && actor->spr.pos.Z >= actor->sector()->floorz))
{