- Blood: handled the remaining write accesses to 'pos'

This commit is contained in:
Christoph Oelckers 2022-01-30 17:56:38 +01:00
parent 04c9422db8
commit 702a73ff6c
6 changed files with 30 additions and 10 deletions

View file

@ -95,6 +95,12 @@ public:
spr.pos = add;
}
void copy_int_xy(DCoreActor* other)
{
spr.pos.X = other->spr.pos.X;
spr.pos.Y = other->spr.pos.Y;
}
void set_int_xy(int x, int y)
{
spr.pos.X = x;
@ -490,6 +496,17 @@ inline int pushmove(vec3_t* const vect, sectortype** const sect, int32_t const w
return res;
}
inline int pushmove(DCoreActor* actor, sectortype** const sect, int32_t const walldist, int32_t const ceildist, int32_t const flordist,
uint32_t const cliptype, bool clear = true)
{
auto vect = actor->int_pos();
int sectno = *sect ? sector.IndexOf(*sect) : -1;
int res = pushmove_(&vect, &sectno, walldist, ceildist, flordist, cliptype, clear);
actor->set_int_pos(vect);
*sect = sectno == -1 ? nullptr : &sector[sectno];
return res;
}
tspritetype* renderAddTsprite(tspriteArray& tsprites, DCoreActor* actor);
inline PClassActor* PClass::FindActor(FName name)

View file

@ -4776,7 +4776,7 @@ void MoveDude(DBloodActor* actor)
if (pSector->type >= kSectorPath && pSector->type <= kSectorRotate)
{
auto pSector2 = pSector;
if (pushmove(&actor->spr.pos, &pSector2, wd, tz, bz, CLIPMASK0) == -1)
if (pushmove(actor, &pSector2, wd, tz, bz, CLIPMASK0) == -1)
actDamageSprite(actor, actor, kDamageFall, 1000 << 4);
if (pSector2 != nullptr)
pSector = pSector2;

View file

@ -1692,7 +1692,7 @@ void debrisMove(int listIndex)
if (pSector->type >= kSectorPath && pSector->type <= kSectorRotate)
{
auto pSector2 = pSector;
if (pushmove(&actor->spr.pos, &pSector2, clipDist, ceilDist, floorDist, CLIPMASK0) != -1)
if (pushmove(actor, &pSector2, clipDist, ceilDist, floorDist, CLIPMASK0) != -1)
pSector = pSector2;
}

View file

@ -36,8 +36,9 @@ void GameInterface::WarpToCoords(int x, int y, int z, int ang, int horz)
PLAYER* pPlayer = &gPlayer[myconnectindex];
VIEW* pView = &gPrevView[myconnectindex];
pPlayer->actor->spr.pos.X = pView->x = gView->actor->spr.pos.X = x;
pPlayer->actor->spr.pos.Y = pView->y = gView->actor->spr.pos.Y = y;
pPlayer->actor->copy_int_xy(gView->actor);
pView->x = gView->actor->int_pos().X;
pView->y = gView->actor->int_pos().Y;
pPlayer->zView = pView->viewz = gView->zView = z;
if (ang != INT_MIN)

View file

@ -1850,7 +1850,7 @@ void playerProcess(PLAYER* pPlayer)
if (!gNoClip)
{
auto pSector = actor->sector();
if (pushmove(&actor->spr.pos, &pSector, dw, dzt, dzb, CLIPMASK0) == -1)
if (pushmove(actor, &pSector, dw, dzt, dzb, CLIPMASK0) == -1)
actDamageSprite(actor, actor, kDamageFall, 500 << 4);
if (actor->sector() != pSector)
{

View file

@ -937,8 +937,7 @@ void TranslateSector(sectortype* pSector, int a2, int a3, int a4, int a5, int a6
RotatePoint((int*)&x, (int*)&y, ang, a4, a5);
viewBackupSpriteLoc(actor);
actor->spr.ang = (actor->spr.ang + v14) & 2047;
actor->spr.pos.X = x + vc - a4;
actor->spr.pos.Y = y + v8 - a5;
actor->set_int_xy(x + vc - a4, y + v8 - a5);
}
else if (actor->spr.cstat & CSTAT_SPRITE_MOVE_REVERSE)
{
@ -946,8 +945,7 @@ void TranslateSector(sectortype* pSector, int a2, int a3, int a4, int a5, int a6
RotatePoint((int*)&x, (int*)&y, -ang, a4, sprDy);
viewBackupSpriteLoc(actor);
actor->spr.ang = (actor->spr.ang - v14) & 2047;
actor->spr.pos.X = x - (vc - a4);
actor->spr.pos.Y = y - (v8 - a5);
actor->set_int_xy(x - vc + a4, y - v8 + a5);
}
else if (pXSector->Drag)
{
@ -958,7 +956,11 @@ void TranslateSector(sectortype* pSector, int a2, int a3, int a4, int a5, int a6
{
viewBackupSpriteLoc(actor);
if (v14)
RotatePoint((int*)&actor->spr.pos.X, (int*)&actor->spr.pos.Y, v14, v20, v24);
{
auto pos = actor->int_pos();
RotatePoint(&pos.X, &pos.Y, v14, v20, v24);
actor->set_int_pos(pos);
}
actor->spr.ang = (actor->spr.ang + v14) & 2047;
actor->add_int_pos({ v28, v2c, 0 });
}