- Duke: first batch of refactoring writes to spr.pos.

This commit is contained in:
Christoph Oelckers 2022-01-30 18:12:07 +01:00
parent 58f573e578
commit 378d126114
7 changed files with 23 additions and 25 deletions

View file

@ -932,7 +932,7 @@ void detonate(DDukeActor *actor, int explosion)
} }
} }
actor->spr.pos.Z -= (32 << 8); actor->add_int_z(-(32 << 8));
if ((actor->temp_data[3] == 1 && actor->spr.xrepeat) || actor->spr.lotag == -99) if ((actor->temp_data[3] == 1 && actor->spr.xrepeat) || actor->spr.lotag == -99)
{ {

View file

@ -559,7 +559,7 @@ void playerisdead(int snum, int psectlotag, int fz, int cz)
{ {
SetPlayerPal(p, PalEntry(63, 63, 0, 0)); SetPlayerPal(p, PalEntry(63, 63, 0, 0));
p->pos.Z -= (16 << 8); p->pos.Z -= (16 << 8);
actor->spr.pos.Z -= (16 << 8); actor->add_int_z(-(16 << 8));
} }
#if 0 #if 0
if (ud.recstat == 1 && ud.multimode < 2) if (ud.recstat == 1 && ud.multimode < 2)

View file

@ -128,7 +128,7 @@ void DoSpawn(struct player_struct *p, int snum)
j->spr.ang += 1024; j->spr.ang += 1024;
j->spr.ang &= 2047; j->spr.ang &= 2047;
j->spr.xvel += 32; j->spr.xvel += 32;
j->spr.pos.Z += (3<<8); j->add_int_z(3<<8);
ssp(j,CLIPMASK0); ssp(j,CLIPMASK0);
} }
@ -361,7 +361,7 @@ void operateweapon_ww(int snum, ESyncBits actions)
if (k == 15) if (k == 15)
{ {
j->spr.yvel = 3; j->spr.yvel = 3;
j->spr.pos.Z += (8 << 8); j->add_int_z(8 << 8);
} }
k = hits(p->GetActor()); k = hits(p->GetActor());

View file

@ -199,7 +199,7 @@ void operaterespawns_d(int low)
auto star = spawn(act, TRANSPORTERSTAR); auto star = spawn(act, TRANSPORTERSTAR);
if (star) if (star)
{ {
star->spr.pos.Z -= (32 << 8); star->add_int_z(-(32 << 8));
act->spr.extra = 66 - 12; // Just a way to killit act->spr.extra = 66 - 12; // Just a way to killit
} }
@ -1221,7 +1221,7 @@ void checkhitsprite_d(DDukeActor* targ, DDukeActor* proj)
if (targ->spr.cstat & CSTAT_SPRITE_BLOCK) if (targ->spr.cstat & CSTAT_SPRITE_BLOCK)
{ {
S_PlayActorSound(GLASS_BREAKING, targ); S_PlayActorSound(GLASS_BREAKING, targ);
targ->spr.pos.Z += 16 << 8; targ->add_int_z(16 << 8);
targ->spr.cstat = 0; targ->spr.cstat = 0;
lotsofglass(targ, nullptr, 5); lotsofglass(targ, nullptr, 5);
} }
@ -1288,7 +1288,7 @@ void checkhitsprite_d(DDukeActor* targ, DDukeActor* proj)
} }
{ {
auto spawned = spawn(targ, STEAM); auto spawned = spawn(targ, STEAM);
if (spawned) spawned->spr.pos.Z = targ->sector()->floorz - (32 << 8); if (spawned) spawned->set_int_z(targ->sector()->floorz - (32 << 8));
} }
break; break;
@ -1374,7 +1374,7 @@ void checkhitsprite_d(DDukeActor* targ, DDukeActor* proj)
{ {
if (proj->spr.pal == 6) if (proj->spr.pal == 6)
spawned->spr.pal = 6; spawned->spr.pal = 6;
spawned->spr.pos.Z += (4 << 8); spawned->add_int_z(4 << 8);
spawned->spr.xvel = 16; spawned->spr.xvel = 16;
spawned->spr.xrepeat = spawned->spr.yrepeat = 24; spawned->spr.xrepeat = spawned->spr.yrepeat = 24;
spawned->spr.ang += 32 - (krand() & 63); spawned->spr.ang += 32 - (krand() & 63);
@ -1398,7 +1398,7 @@ void checkhitsprite_d(DDukeActor* targ, DDukeActor* proj)
targ->spr.ang = (proj->spr.ang + 1024) & 2047; targ->spr.ang = (proj->spr.ang + 1024) & 2047;
targ->spr.xvel = -(proj->spr.extra << 2); targ->spr.xvel = -(proj->spr.extra << 2);
auto sp = targ->sector(); auto sp = targ->sector();
pushmove(&targ->spr.pos, &sp, 128L, (4 << 8), (4 << 8), CLIPMASK0); pushmove(targ, &sp, 128L, (4 << 8), (4 << 8), CLIPMASK0);
if (sp != targ->sector() && sp != nullptr) if (sp != targ->sector() && sp != nullptr)
ChangeActorSect(targ, sp); ChangeActorSect(targ, sp);
} }

View file

@ -313,7 +313,7 @@ void operaterespawns_r(int low)
if (badguypic(act->spr.hitag) && ud.monsters_off) break; if (badguypic(act->spr.hitag) && ud.monsters_off) break;
auto star = spawn(act, TRANSPORTERSTAR); auto star = spawn(act, TRANSPORTERSTAR);
if (star) star->spr.pos.Z -= (32 << 8); if (star) star->add_int_z(-(32 << 8));
act->spr.extra = 66 - 12; // Just a way to killit act->spr.extra = 66 - 12; // Just a way to killit
break; break;
@ -2284,7 +2284,7 @@ void checkhitsprite_r(DDukeActor* targ, DDukeActor* proj)
} }
{ {
auto spawned = spawn(targ, STEAM); auto spawned = spawn(targ, STEAM);
if (spawned) spawned->spr.pos.Z = targ->sector()->floorz - (32 << 8); if (spawned) spawned->set_int_z(targ->sector()->floorz - (32 << 8));
} }
break; break;
@ -2330,7 +2330,7 @@ void checkhitsprite_r(DDukeActor* targ, DDukeActor* proj)
{ {
if (proj->spr.pal == 6) if (proj->spr.pal == 6)
spawned->spr.pal = 6; spawned->spr.pal = 6;
spawned->spr.pos.Z += (4 << 8); spawned->add_int_z(4 << 8);
spawned->spr.xvel = 16; spawned->spr.xvel = 16;
spawned->spr.xrepeat = spawned->spr.yrepeat = 24; spawned->spr.xrepeat = spawned->spr.yrepeat = 24;
spawned->spr.ang += 32 - (krand() & 63); spawned->spr.ang += 32 - (krand() & 63);

View file

@ -317,7 +317,7 @@ void spawntransporter(DDukeActor *actj, DDukeActor* act, bool beam)
act->spr.xrepeat = 48; act->spr.xrepeat = 48;
act->spr.yrepeat = 64; act->spr.yrepeat = 64;
if (actj->spr.statnum == 10 || badguy(actj)) if (actj->spr.statnum == 10 || badguy(actj))
act->spr.pos.Z -= (32 << 8); act->add_int_z(-(32 << 8));
} }
} }

View file

@ -212,11 +212,11 @@ DDukeActor* spawninit_r(DDukeActor* actj, DDukeActor* act, TArray<DDukeActor*>*
{ {
if (actj->sector()->lotag == 2) if (actj->sector()->lotag == 2)
{ {
act->spr.pos.Z = getceilzofslopeptr(act->sector(), act->spr.pos.X, act->spr.pos.Y) + (16 << 8); act->set_int_z(getceilzofslopeptr(act->sector(), act->spr.pos.X, act->spr.pos.Y) + (16 << 8));
act->spr.cstat |= CSTAT_SPRITE_YFLIP; act->spr.cstat |= CSTAT_SPRITE_YFLIP;
} }
else if (actj->sector()->lotag == 1) else if (actj->sector()->lotag == 1)
act->spr.pos.Z = getflorzofslopeptr(act->sector(), act->spr.pos.X, act->spr.pos.Y); act->set_int_z(getflorzofslopeptr(act->sector(), act->spr.pos.X, act->spr.pos.Y));
} }
if (sectp->floorpicnum == FLOORSLIME || if (sectp->floorpicnum == FLOORSLIME ||
@ -284,7 +284,7 @@ DDukeActor* spawninit_r(DDukeActor* actj, DDukeActor* act, TArray<DDukeActor*>*
case TONGUE: case TONGUE:
if (actj) if (actj)
act->spr.ang = actj->spr.ang; act->spr.ang = actj->spr.ang;
act->spr.pos.Z -= PHEIGHT_RR; act->add_int_z(-PHEIGHT_RR);
act->spr.zvel = 256 - (krand() & 511); act->spr.zvel = 256 - (krand() & 511);
act->spr.xvel = 64 - (krand() & 127); act->spr.xvel = 64 - (krand() & 127);
ChangeActorStat(act, 4); ChangeActorStat(act, 4);
@ -324,7 +324,7 @@ DDukeActor* spawninit_r(DDukeActor* actj, DDukeActor* act, TArray<DDukeActor*>*
case BLOOD: case BLOOD:
act->spr.xrepeat = act->spr.yrepeat = 4; act->spr.xrepeat = act->spr.yrepeat = 4;
act->spr.pos.Z -= (26 << 8); act->add_int_z(-(26 << 8));
ChangeActorStat(act, STAT_MISC); ChangeActorStat(act, STAT_MISC);
break; break;
case BLOODPOOL: case BLOODPOOL:
@ -353,7 +353,7 @@ DDukeActor* spawninit_r(DDukeActor* actj, DDukeActor* act, TArray<DDukeActor*>*
act->spr.cstat |= CSTAT_SPRITE_ALIGNMENT_WALL; act->spr.cstat |= CSTAT_SPRITE_ALIGNMENT_WALL;
act->spr.xrepeat = 7 + (krand() & 7); act->spr.xrepeat = 7 + (krand() & 7);
act->spr.yrepeat = 7 + (krand() & 7); act->spr.yrepeat = 7 + (krand() & 7);
act->spr.pos.Z -= (16 << 8); act->add_int_z(-(16 << 8));
if (actj && actj->spr.pal == 6) if (actj && actj->spr.pal == 6)
act->spr.pal = 6; act->spr.pal = 6;
insertspriteq(act); insertspriteq(act);
@ -554,7 +554,7 @@ DDukeActor* spawninit_r(DDukeActor* actj, DDukeActor* act, TArray<DDukeActor*>*
if (act->spr.picnum == RESPAWNMARKERRED) if (act->spr.picnum == RESPAWNMARKERRED)
{ {
act->spr.xrepeat = act->spr.yrepeat = 8; act->spr.xrepeat = act->spr.yrepeat = 8;
if (actj) act->spr.pos.Z = actj->floorz; if (actj) act->set_int_z(actj->floorz);
} }
else else
{ {
@ -651,7 +651,7 @@ DDukeActor* spawninit_r(DDukeActor* actj, DDukeActor* act, TArray<DDukeActor*>*
{ {
int x = getflorzofslopeptr(act->sector(), act->spr.pos.X, act->spr.pos.Y); int x = getflorzofslopeptr(act->sector(), act->spr.pos.X, act->spr.pos.Y);
if (act->spr.pos.Z > x - (12 << 8)) if (act->spr.pos.Z > x - (12 << 8))
act->spr.pos.Z = x - (12 << 8); act->set_int_z(x - (12 << 8));
} }
ChangeActorStat(act, STAT_MISC); ChangeActorStat(act, STAT_MISC);
@ -684,7 +684,7 @@ DDukeActor* spawninit_r(DDukeActor* actj, DDukeActor* act, TArray<DDukeActor*>*
} }
case WATERBUBBLE: case WATERBUBBLE:
if (actj && actj->spr.picnum == APLAYER) if (actj && actj->spr.picnum == APLAYER)
act->spr.pos.Z -= (16 << 8); act->add_int_z(-(16 << 8));
if (act->spr.picnum == WATERBUBBLE) if (act->spr.picnum == WATERBUBBLE)
{ {
if (actj) if (actj)
@ -905,9 +905,7 @@ DDukeActor* spawninit_r(DDukeActor* actj, DDukeActor* act, TArray<DDukeActor*>*
act->spr.yrepeat = 64; act->spr.yrepeat = 64;
act->spr.cstat = CSTAT_SPRITE_TRANSLUCENT; act->spr.cstat = CSTAT_SPRITE_TRANSLUCENT;
act->spr.cstat |= CSTAT_SPRITE_TRANS_FLIP; act->spr.cstat |= CSTAT_SPRITE_TRANS_FLIP;
act->spr.pos.X += (krand() & 2047) - 1024; act->add_int_pos({ (krand() & 2047) - 1024, (krand() & 2047) - 1024, (krand() & 2047) - 1024 });
act->spr.pos.Y += (krand() & 2047) - 1024;
act->spr.pos.Z += (krand() & 2047) - 1024;
break; break;
case MAMA: case MAMA:
if (act->spr.pal == 30) if (act->spr.pal == 30)
@ -1157,7 +1155,7 @@ DDukeActor* spawninit_r(DDukeActor* actj, DDukeActor* act, TArray<DDukeActor*>*
act->spr.lotag = 0; act->spr.lotag = 0;
if (act->spr.picnum != BOWLINGBALLSPRITE) if (act->spr.picnum != BOWLINGBALLSPRITE)
{ {
act->spr.pos.Z -= (32 << 8); act->add_int_z(-(32 << 8));
act->spr.zvel = -(4 << 8); act->spr.zvel = -(4 << 8);
} }
else else