- Duke: Leverage new spritetype methods within Duke, removing bposx/bposy/bposz from hittype.

This commit is contained in:
Mitchell Richters 2021-01-06 06:20:55 +11:00
parent 07a43c572e
commit 97159c20c1
13 changed files with 62 additions and 123 deletions

View file

@ -415,16 +415,14 @@ void moveplayers(void)
auto p = &ps[pn]; auto p = &ps[pn];
auto spri = &act->s; auto spri = &act->s;
// Back up player's sprite angle, used in DrawAutomapPlayer() when input is synchronised.
act->tempang = spri->ang;
if (act->GetOwner()) if (act->GetOwner())
{ {
if (p->newOwner != nullptr) //Looking thru the camera if (p->newOwner != nullptr) //Looking thru the camera
{ {
spri->x = p->oposx; spri->x = p->oposx;
spri->y = p->oposy; spri->y = p->oposy;
act->bposz = spri->z = p->oposz + gs.playerheight; spri->z = p->oposz + gs.playerheight;
spri->backupz();
spri->ang = p->angle.oang.asbuild(); spri->ang = p->angle.oang.asbuild();
setsprite(act, spri->pos); setsprite(act, spri->pos);
} }
@ -503,9 +501,7 @@ void moveplayers(void)
continue; continue;
} }
act->bposx = spri->x; spri->backuppos();
act->bposy = spri->y;
act->bposz = spri->z;
spri->cstat = 0; spri->cstat = 0;
@ -811,9 +807,7 @@ void movecrane(DDukeActor *actor, int crane)
{ {
setsprite(Owner, spri->pos); setsprite(Owner, spri->pos);
Owner->bposx = spri->x; Owner->s.opos = spri->pos;
Owner->bposy = spri->y;
Owner->bposz = spri->z;
spri->zvel = 0; spri->zvel = 0;
} }
@ -1081,7 +1075,8 @@ void movewaterdrip(DDukeActor *actor, int drip)
} }
else else
{ {
actor->bposz = s->z = t[0]; s->z = t[0];
s->backupz();
t[1] = 48 + (krand() & 31); t[1] = 48 + (krand() & 31);
} }
} }
@ -2015,9 +2010,6 @@ void camera(DDukeActor *actor)
return; return;
} }
} }
// backup current angle for interpolating camera angle.
actor->tempang = s->ang;
if (s->hitag > 0) if (s->hitag > 0)
{ {
@ -2972,8 +2964,7 @@ void handle_se14(DDukeActor* actor, bool checkstat, int RPG, int JIBS6)
if (numplayers > 1) if (numplayers > 1)
{ {
a2->bposx = sj->x; sj->backupvec2();
a2->bposy = sj->y;
} }
} }
} }
@ -3083,8 +3074,7 @@ void handle_se30(DDukeActor *actor, int JIBS6)
{ {
if (a2->s.picnum != SECTOREFFECTOR && a2->s.picnum != LOCATORS) if (a2->s.picnum != SECTOREFFECTOR && a2->s.picnum != LOCATORS)
{ {
a2->bposx = a2->s.x; a2->s.backupvec2();
a2->bposy = a2->s.y;
} }
} }
@ -3150,8 +3140,7 @@ void handle_se30(DDukeActor *actor, int JIBS6)
{ {
if (numplayers < 2) if (numplayers < 2)
{ {
a2->bposx = spa2->x; spa2->backupvec2();
a2->bposy = spa2->y;
} }
spa2->x += l; spa2->x += l;
@ -3159,8 +3148,7 @@ void handle_se30(DDukeActor *actor, int JIBS6)
if (numplayers > 1) if (numplayers > 1)
{ {
a2->bposx = spa2->x; spa2->backupvec2();
a2->bposy = spa2->y;
} }
} }
} }
@ -3995,7 +3983,7 @@ void handle_se17(DDukeActor* actor)
} }
if (act1->s.statnum != STAT_EFFECTOR) if (act1->s.statnum != STAT_EFFECTOR)
{ {
act1->bposz = act1->s.z; act1->s.backupz();
act1->s.z += q; act1->s.z += q;
} }
@ -4065,9 +4053,7 @@ void handle_se17(DDukeActor* actor)
spr3->y += spr2->y - s->y; spr3->y += spr2->y - s->y;
spr3->z = sector[spr2->sectnum].floorz - (sc->floorz - spr3->z); spr3->z = sector[spr2->sectnum].floorz - (sc->floorz - spr3->z);
act3->bposx = spr3->x; spr3->backuppos();
act3->bposy = spr3->y;
act3->bposz = spr3->z;
changespritesect(act3, spr2->sectnum); changespritesect(act3, spr2->sectnum);
setsprite(act3, spr3->pos); setsprite(act3, spr3->pos);
@ -4119,7 +4105,8 @@ void handle_se18(DDukeActor *actor, bool morecheck)
if (ps[a2->PlayerIndex()].on_ground == 1) ps[a2->PlayerIndex()].posz += sc->extra; if (ps[a2->PlayerIndex()].on_ground == 1) ps[a2->PlayerIndex()].posz += sc->extra;
if (a2->s.zvel == 0 && a2->s.statnum != STAT_EFFECTOR && a2->s.statnum != STAT_PROJECTILE) if (a2->s.zvel == 0 && a2->s.statnum != STAT_EFFECTOR && a2->s.statnum != STAT_PROJECTILE)
{ {
a2->bposz = a2->s.z += sc->extra; a2->s.z += sc->extra;
a2->s.backupz();
a2->floorz = sc->floorz; a2->floorz = sc->floorz;
} }
} }
@ -4156,7 +4143,8 @@ void handle_se18(DDukeActor *actor, bool morecheck)
if (ps[a2->PlayerIndex()].on_ground == 1) ps[a2->PlayerIndex()].posz -= sc->extra; if (ps[a2->PlayerIndex()].on_ground == 1) ps[a2->PlayerIndex()].posz -= sc->extra;
if (a2->s.zvel == 0 && a2->s.statnum != STAT_EFFECTOR && a2->s.statnum != STAT_PROJECTILE) if (a2->s.zvel == 0 && a2->s.statnum != STAT_EFFECTOR && a2->s.statnum != STAT_PROJECTILE)
{ {
a2->bposz = a2->s.z -= sc->extra; a2->s.z -= sc->extra;
a2->s.backupz();
a2->floorz = sc->floorz; a2->floorz = sc->floorz;
} }
} }
@ -4442,8 +4430,7 @@ void handle_se26(DDukeActor* actor)
{ {
if (a2->s.statnum != 3 && a2->s.statnum != 10) if (a2->s.statnum != 3 && a2->s.statnum != 10)
{ {
a2->bposx = a2->s.x; a2->s.backupvec2();
a2->bposy = a2->s.y;
a2->s.x += l; a2->s.x += l;
a2->s.y += x; a2->s.y += x;
@ -4579,8 +4566,7 @@ void handle_se24(DDukeActor *actor, int16_t *list1, int16_t *list2, int TRIPBOMB
{ {
if (s2->z > (a2->floorz - (16 << 8))) if (s2->z > (a2->floorz - (16 << 8)))
{ {
a2->bposx = s2->x; s2->backupvec2();
a2->bposy = s2->y;
s2->x += x >> shift; s2->x += x >> shift;
s2->y += l >> shift; s2->y += l >> shift;
@ -5395,9 +5381,7 @@ void recordoldspritepos()
DukeStatIterator it(statNum); DukeStatIterator it(statNum);
while (auto ac = it.Next()) while (auto ac = it.Next())
{ {
ac->bposx = ac->s.x; ac->s.backuploc();
ac->bposy = ac->s.y;
ac->bposz = ac->s.z;
} }
} }
} }

View file

@ -2075,9 +2075,7 @@ void movetransports_d(void)
ps[p].oposz = ps[p].posz; ps[p].oposz = ps[p].posz;
auto pa = ps[p].GetActor(); auto pa = ps[p].GetActor();
pa->bposx = ps[p].posx; pa->s.opos = ps[p].pos;
pa->bposy = ps[p].posy;
pa->bposz = ps[p].posz;
changespritesect(act2, Owner->s.sectnum); changespritesect(act2, Owner->s.sectnum);
ps[p].cursectnum = Owner->s.sectnum; ps[p].cursectnum = Owner->s.sectnum;
@ -2240,9 +2238,7 @@ void movetransports_d(void)
spr2->z -= spr->z - sector[Owner->s.sectnum].floorz; spr2->z -= spr->z - sector[Owner->s.sectnum].floorz;
spr2->ang = Owner->s.ang; spr2->ang = Owner->s.ang;
act2->bposx = spr2->x; spr2->backuppos();
act2->bposy = spr2->y;
act2->bposz = spr2->z;
if (spr->pal == 0) if (spr->pal == 0)
{ {
@ -2268,9 +2264,7 @@ void movetransports_d(void)
spr2->y += (Owner->s.y - spr->y); spr2->y += (Owner->s.y - spr->y);
spr2->z = Owner->s.z + 4096; spr2->z = Owner->s.z + 4096;
act2->bposx = spr2->x; spr2->backuppos();
act2->bposy = spr2->y;
act2->bposz = spr2->z;
changespritesect(act2, Owner->s.sectnum); changespritesect(act2, Owner->s.sectnum);
} }
@ -2280,9 +2274,7 @@ void movetransports_d(void)
spr2->y += (Owner->s.y - spr->y); spr2->y += (Owner->s.y - spr->y);
spr2->z = sector[Owner->s.sectnum].ceilingz + ll; spr2->z = sector[Owner->s.sectnum].ceilingz + ll;
act2->bposx = spr2->x; spr2->backuppos();
act2->bposy = spr2->y;
act2->bposz = spr2->z;
changespritesect(act2, Owner->s.sectnum); changespritesect(act2, Owner->s.sectnum);
@ -2292,9 +2284,7 @@ void movetransports_d(void)
spr2->y += (Owner->s.y - spr->y); spr2->y += (Owner->s.y - spr->y);
spr2->z = sector[Owner->s.sectnum].floorz - ll; spr2->z = sector[Owner->s.sectnum].floorz - ll;
act2->bposx = spr2->x; spr2->backuppos();
act2->bposy = spr2->y;
act2->bposz = spr2->z;
changespritesect(act2, Owner->s.sectnum); changespritesect(act2, Owner->s.sectnum);
@ -3849,10 +3839,9 @@ void move_d(DDukeActor *actor, int playernum, int xvel)
if (t[1] == 0 || a == 0) if (t[1] == 0 || a == 0)
{ {
if ((badguy(actor) && spr->extra <= 0) || (actor->bposx != spr->x) || (actor->bposy != spr->y)) if ((badguy(actor) && spr->extra <= 0) || (spr->ox != spr->x) || (spr->oy != spr->y))
{ {
actor->bposx = spr->x; spr->backupvec2();
actor->bposy = spr->y;
setsprite(actor, spr->pos); setsprite(actor, spr->pos);
} }
return; return;
@ -3957,7 +3946,7 @@ void move_d(DDukeActor *actor, int playernum, int xvel)
} }
else if (spr->picnum != DRONE && spr->picnum != SHARK && spr->picnum != COMMANDER) else if (spr->picnum != DRONE && spr->picnum != SHARK && spr->picnum != COMMANDER)
{ {
if (actor->bposz != spr->z || (ud.multimode < 2 && ud.player_skill < 2)) if (spr->oz != spr->z || (ud.multimode < 2 && ud.player_skill < 2))
{ {
if ((t[0] & 1) || ps[playernum].actorsqu == actor) return; if ((t[0] & 1) || ps[playernum].actorsqu == actor) return;
else daxvel <<= 1; else daxvel <<= 1;

View file

@ -1846,9 +1846,7 @@ void movetransports_r(void)
spr2->z -= spr->z - sector[Owner->s.sectnum].floorz; spr2->z -= spr->z - sector[Owner->s.sectnum].floorz;
spr2->ang = Owner->s.ang; spr2->ang = Owner->s.ang;
act2->bposx = spr2->x; spr2->backuppos();
act2->bposy = spr2->y;
act2->bposz = spr2->z;
auto beam = spawn(act, TRANSPORTERBEAM); auto beam = spawn(act, TRANSPORTERBEAM);
S_PlayActorSound(TELEPORTER, beam); S_PlayActorSound(TELEPORTER, beam);
@ -1871,9 +1869,7 @@ void movetransports_r(void)
spr2->y += (Owner->s.y - spr->y); spr2->y += (Owner->s.y - spr->y);
spr2->z = Owner->s.z + 4096; spr2->z = Owner->s.z + 4096;
act2->bposx = spr2->x; spr2->backuppos();
act2->bposy = spr2->y;
act2->bposz = spr2->z;
changespritesect(act2, Owner->s.sectnum); changespritesect(act2, Owner->s.sectnum);
} }
@ -1883,9 +1879,7 @@ void movetransports_r(void)
spr2->y += (Owner->s.y - spr->y); spr2->y += (Owner->s.y - spr->y);
spr2->z = sector[Owner->s.sectnum].ceilingz + ll; spr2->z = sector[Owner->s.sectnum].ceilingz + ll;
act2->bposx = spr2->x; spr2->backuppos();
act2->bposy = spr2->y;
act2->bposz = spr2->z;
changespritesect(act2, Owner->s.sectnum); changespritesect(act2, Owner->s.sectnum);
@ -1895,9 +1889,7 @@ void movetransports_r(void)
spr2->y += (Owner->s.y - spr->y); spr2->y += (Owner->s.y - spr->y);
spr2->z = sector[Owner->s.sectnum].floorz - ll; spr2->z = sector[Owner->s.sectnum].floorz - ll;
act2->bposx = spr2->x; spr2->backuppos();
act2->bposy = spr2->y;
act2->bposz = spr2->z;
changespritesect(act2, Owner->s.sectnum); changespritesect(act2, Owner->s.sectnum);
@ -1909,9 +1901,7 @@ void movetransports_r(void)
spr2->y += (Owner->s.y - spr->y); spr2->y += (Owner->s.y - spr->y);
spr2->z = sector[Owner->s.sectnum].ceilingz + ll2; spr2->z = sector[Owner->s.sectnum].ceilingz + ll2;
act2->bposx = spr2->x; spr2->backuppos();
act2->bposy = spr2->y;
act2->bposz = spr2->z;
changespritesect(act2, Owner->s.sectnum); changespritesect(act2, Owner->s.sectnum);
@ -1925,9 +1915,7 @@ void movetransports_r(void)
spr2->y += (Owner->s.y - spr->y); spr2->y += (Owner->s.y - spr->y);
spr2->z = sector[Owner->s.sectnum].floorz - ll2; spr2->z = sector[Owner->s.sectnum].floorz - ll2;
act2->bposx = spr2->x; spr2->backuppos();
act2->bposy = spr2->y;
act2->bposz = spr2->z;
changespritesect(act2, Owner->s.sectnum); changespritesect(act2, Owner->s.sectnum);
@ -3810,10 +3798,9 @@ void move_r(DDukeActor *actor, int pnum, int xvel)
if (t[1] == 0 || a == 0) if (t[1] == 0 || a == 0)
{ {
if ((badguy(actor) && spr->extra <= 0) || (actor->bposx != spr->x) || (actor->bposy != spr->y)) if ((badguy(actor) && spr->extra <= 0) || (spr->ox != spr->x) || (spr->oy != spr->y))
{ {
actor->bposx = spr->x; spr->backupvec2();
actor->bposy = spr->y;
setsprite(actor, spr->pos); setsprite(actor, spr->pos);
} }
if (badguy(actor) && spr->extra <= 0) if (badguy(actor) && spr->extra <= 0)
@ -3924,7 +3911,7 @@ void move_r(DDukeActor *actor, int pnum, int xvel)
(!isRRRA() && spr->picnum != DRONE && spr->picnum != SHARK && spr->picnum != UFO1_RR (!isRRRA() && spr->picnum != DRONE && spr->picnum != SHARK && spr->picnum != UFO1_RR
&& spr->picnum != UFO2 && spr->picnum != UFO3 && spr->picnum != UFO4 && spr->picnum != UFO5)) && spr->picnum != UFO2 && spr->picnum != UFO3 && spr->picnum != UFO4 && spr->picnum != UFO5))
{ {
if (actor->bposz != spr->z || (ud.multimode < 2 && ud.player_skill < 2)) if (spr->oz != spr->z || (ud.multimode < 2 && ud.player_skill < 2))
{ {
if ((t[0] & 1) || ps[pnum].actorsqu == actor) return; if ((t[0] & 1) || ps[pnum].actorsqu == actor) return;
else daxvel <<= 1; else daxvel <<= 1;

View file

@ -182,9 +182,7 @@ void animatesprites_d(int x, int y, int a, int smoothratio)
} }
else if (s->picnum != CRANEPOLE) else if (s->picnum != CRANEPOLE)
{ {
t->x -= MulScale(MaxSmoothRatio - smoothratio, s->x - h->bposx, 16); t->pos = s->interpolatedvec3(smoothratio);
t->y -= MulScale(MaxSmoothRatio - smoothratio, s->y - h->bposy, 16);
t->z -= MulScale(MaxSmoothRatio - smoothratio, s->z - h->bposz, 16);
} }
sect = s->sectnum; sect = s->sectnum;

View file

@ -170,9 +170,7 @@ void animatesprites_r(int x, int y, int a, int smoothratio)
} }
else if (s->picnum != CRANEPOLE) else if (s->picnum != CRANEPOLE)
{ {
t->x -= MulScale(MaxSmoothRatio - smoothratio, s->x - h->bposx, 16); t->pos = s->interpolatedvec3(smoothratio);
t->y -= MulScale(MaxSmoothRatio - smoothratio, s->y - h->bposy, 16);
t->z -= MulScale(MaxSmoothRatio - smoothratio, s->z - h->bposz, 16);
} }
sect = s->sectnum; sect = s->sectnum;

View file

@ -559,9 +559,8 @@ bool GameInterface::DrawAutomapPlayer(int cposx, int cposy, int czoom, int cang,
{ {
auto act = ps[p].GetActor(); auto act = ps[p].GetActor();
auto pspr = &act->s; auto pspr = &act->s;
x1 = act->bposx + MulScale(pspr->x - act->bposx, smoothratio, 16) - cposx; auto spos = pspr->interpolatedvec2(smoothratio);
y1 = act->bposy + MulScale(pspr->y - act->bposy, smoothratio, 16) - cposy; daang = ((!SyncInput() ? pspr->ang : pspr->interpolatedang(smoothratio)) - cang) & 2047;
daang = ((!SyncInput() ? pspr->ang : act->tempang + MulScale(((pspr->ang + 1024 - act->tempang) & 2047) - 1024, smoothratio, 16)) - cang) & 2047;
if (p == screenpeek || ud.coop == 1) if (p == screenpeek || ud.coop == 1)
{ {
@ -577,7 +576,7 @@ bool GameInterface::DrawAutomapPlayer(int cposx, int cposy, int czoom, int cang,
if (j < 22000) j = 22000; if (j < 22000) j = 22000;
else if (j > (65536 << 1)) j = (65536 << 1); else if (j > (65536 << 1)) j = (65536 << 1);
DrawTexture(twod, tileGetTexture(i), xdim / 2. + x1 / 4096., ydim / 2. + y1 / 4096., DTA_TranslationIndex, TRANSLATION(Translation_Remap + setpal(&pp), pspr->pal), DTA_CenterOffset, true, DrawTexture(twod, tileGetTexture(i), xdim / 2. + spos.x / 4096., ydim / 2. + spos.y / 4096., DTA_TranslationIndex, TRANSLATION(Translation_Remap + setpal(&pp), pspr->pal), DTA_CenterOffset, true,
DTA_Rotate, daang * (-360./2048), DTA_Color, shadeToLight(pspr->shade), DTA_ScaleX, j / 65536., DTA_ScaleY, j / 65536., TAG_DONE); DTA_Rotate, daang * (-360./2048), DTA_Color, shadeToLight(pspr->shade), DTA_ScaleX, j / 65536., DTA_ScaleY, j / 65536., TAG_DONE);
} }
} }

View file

@ -1314,16 +1314,16 @@ void DoActor(bool bSet, int lVar1, int lLabelID, int lVar2, DDukeActor* sActor,
else SetGameVarID((int)lVar2, act->lastvy, sActor, sPlayer); else SetGameVarID((int)lVar2, act->lastvy, sActor, sPlayer);
break; break;
case ACTOR_HTBPOSX: case ACTOR_HTBPOSX:
if (bSet) act->bposx = lValue; if (bSet) spr->ox = lValue;
else SetGameVarID((int)lVar2, act->bposx, sActor, sPlayer); else SetGameVarID((int)lVar2, spr->ox, sActor, sPlayer);
break; break;
case ACTOR_HTBPOSY: case ACTOR_HTBPOSY:
if (bSet) act->bposy = lValue; if (bSet) spr->oy = lValue;
else SetGameVarID((int)lVar2, act->bposy, sActor, sPlayer); else SetGameVarID((int)lVar2, spr->oy, sActor, sPlayer);
break; break;
case ACTOR_HTBPOSZ: case ACTOR_HTBPOSZ:
if (bSet) act->bposz = lValue; if (bSet) spr->oz = lValue;
else SetGameVarID((int)lVar2, act->bposz, sActor, sPlayer); else SetGameVarID((int)lVar2, spr->oz, sActor, sPlayer);
break; break;
case ACTOR_HTG_T0: case ACTOR_HTG_T0:
if (bSet) act->temp_data[0] = lValue; if (bSet) act->temp_data[0] = lValue;
@ -2229,9 +2229,10 @@ int ParseState::parse(void)
{ {
// I am not convinced this is even remotely smart to be executed from here.. // I am not convinced this is even remotely smart to be executed from here..
pickrandomspot(g_p); pickrandomspot(g_p);
g_sp->x = g_ac->bposx = ps[g_p].bobposx = ps[g_p].oposx = ps[g_p].posx; g_sp->x = ps[g_p].bobposx = ps[g_p].oposx = ps[g_p].posx;
g_sp->y = g_ac->bposy = ps[g_p].bobposy = ps[g_p].oposy = ps[g_p].posy; g_sp->y = ps[g_p].bobposy = ps[g_p].oposy = ps[g_p].posy;
g_sp->z = g_ac->bposy = ps[g_p].oposz = ps[g_p].posz; g_sp->z = ps[g_p].oposz = ps[g_p].posz;
g_sp->backuppos();
updatesector(ps[g_p].posx, ps[g_p].posy, &ps[g_p].cursectnum); updatesector(ps[g_p].posx, ps[g_p].posy, &ps[g_p].cursectnum);
setsprite(ps[g_p].GetActor(), ps[g_p].posx, ps[g_p].posy, ps[g_p].posz + gs.playerheight); setsprite(ps[g_p].GetActor(), ps[g_p].posx, ps[g_p].posy, ps[g_p].posz + gs.playerheight);
g_sp->cstat = 257; g_sp->cstat = 257;

View file

@ -624,9 +624,10 @@ void resetpspritevars(int g)
ps[j].frag_ps = j; ps[j].frag_ps = j;
act->SetOwner(act); act->SetOwner(act);
act->bposx = ps[j].bobposx = ps[j].oposx = ps[j].posx = s->x; ps[j].bobposx = ps[j].oposx = ps[j].posx = s->x;
act->bposy = ps[j].bobposy = ps[j].oposy = ps[j].posy = s->y; ps[j].bobposy = ps[j].oposy = ps[j].posy = s->y;
act->bposz = ps[j].oposz = ps[j].posz = s->z; ps[j].oposz = ps[j].posz = s->z;
s->backuppos();
ps[j].angle.oang = ps[j].angle.ang = buildang(s->ang); ps[j].angle.oang = ps[j].angle.ang = buildang(s->ang);
updatesector(s->x, s->y, &ps[j].cursectnum); updatesector(s->x, s->y, &ps[j].cursectnum);

View file

@ -259,17 +259,6 @@ void renderMirror(int cposx, int cposy, int cposz, binangle cang, fixedhoriz cho
// //
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
static inline binangle getcamspriteang(DDukeActor* newOwner, double const smoothratio)
{
return buildfang(newOwner->tempang + MulScaleF(((newOwner->s.ang - newOwner->tempang + 1024) & 2047) - 1024, smoothratio, 16));
}
//---------------------------------------------------------------------------
//
//
//
//---------------------------------------------------------------------------
void animatecamsprite(double smoothratio) void animatecamsprite(double smoothratio)
{ {
const int VIEWSCREEN_ACTIVE_DISTANCE = 8192; const int VIEWSCREEN_ACTIVE_DISTANCE = 8192;
@ -293,7 +282,7 @@ void animatecamsprite(double smoothratio)
screen->RenderTextureView(canvas, [=](IntRect& rect) screen->RenderTextureView(canvas, [=](IntRect& rect)
{ {
auto camera = &camsprite->GetOwner()->s; auto camera = &camsprite->GetOwner()->s;
auto ang = getcamspriteang(camsprite->GetOwner(), smoothratio); auto ang = buildang(camera->interpolatedang(smoothratio));
// Note: no ROR or camera here for now - the current setup has no means to detect these things before rendering the scene itself. // Note: no ROR or camera here for now - the current setup has no means to detect these things before rendering the scene itself.
renderDrawRoomsQ16(camera->x, camera->y, camera->z, ang.asq16(), IntToFixed(camera->shade), camera->sectnum); // why 'shade'...? renderDrawRoomsQ16(camera->x, camera->y, camera->z, ang.asq16(), IntToFixed(camera->shade), camera->sectnum); // why 'shade'...?
display_mirror = 1; // should really be 'display external view'. display_mirror = 1; // should really be 'display external view'.
@ -581,7 +570,7 @@ void displayrooms(int snum, double smoothratio)
if (p->newOwner != nullptr) if (p->newOwner != nullptr)
{ {
auto spr = &p->newOwner->s; auto spr = &p->newOwner->s;
cang = getcamspriteang(p->newOwner, smoothratio); cang = buildang(spr->interpolatedang(smoothratio));
choriz = buildhoriz(spr->shade); choriz = buildhoriz(spr->shade);
cposx = spr->pos.x; cposx = spr->pos.x;
cposy = spr->pos.y; cposy = spr->pos.y;

View file

@ -287,9 +287,6 @@ FSerializer& Serialize(FSerializer& arc, const char* keyname, weaponhit& w, weap
("ceilingz", w.ceilingz, def->ceilingz) ("ceilingz", w.ceilingz, def->ceilingz)
("lastvx", w.lastvx, def->lastvx) ("lastvx", w.lastvx, def->lastvx)
("lastvy", w.lastvy, def->lastvy) ("lastvy", w.lastvy, def->lastvy)
("bposx", w.bposx, def->bposx)
("bposy", w.bposy, def->bposy)
("bposz", w.bposz, def->bposz)
("aflags", w.aflags, def->aflags) ("aflags", w.aflags, def->aflags)
("saved_ammo", w.saved_ammo, def->saved_ammo) ("saved_ammo", w.saved_ammo, def->saved_ammo)
("temp_actor", w.temp_actor, def->temp_actor) ("temp_actor", w.temp_actor, def->temp_actor)

View file

@ -358,7 +358,7 @@ void doanimations(void)
{ {
if (act->s.statnum != STAT_EFFECTOR) if (act->s.statnum != STAT_EFFECTOR)
{ {
act->bposz = act->s.z; act->s.backupz();
act->s.z += v; act->s.z += v;
act->floorz = sector[dasect].floorz + v; act->floorz = sector[dasect].floorz + v;
} }

View file

@ -58,9 +58,6 @@ DDukeActor* EGS(short whatsect, int s_x, int s_y, int s_z, short s_pn, signed ch
auto act = &hittype[i]; auto act = &hittype[i];
auto s = &act->s; auto s = &act->s;
act->bposx = s_x;
act->bposy = s_y;
act->bposz = s_z;
s->x = s_x; s->x = s_x;
s->y = s_y; s->y = s_y;
@ -81,6 +78,7 @@ DDukeActor* EGS(short whatsect, int s_x, int s_y, int s_z, short s_pn, signed ch
s->clipdist = 0; s->clipdist = 0;
s->pal = 0; s->pal = 0;
s->lotag = 0; s->lotag = 0;
s->backuploc();
act->lastvx = 0; act->lastvx = 0;
act->lastvy = 0; act->lastvy = 0;
@ -162,9 +160,7 @@ int initspriteforspawn(DDukeActor* actj, int pn, const std::initializer_list<int
act->timetosleep = 0; act->timetosleep = 0;
act->extra = -1; act->extra = -1;
act->bposx = sp->x; sp->backuppos();
act->bposy = sp->y;
act->bposz = sp->z;
act->SetOwner(act); act->SetOwner(act);
act->SetHitOwner(act); act->SetHitOwner(act);

View file

@ -28,7 +28,7 @@ struct weaponhit
short picnum, ang, extra, owner, movflag; short picnum, ang, extra, owner, movflag;
short tempang, actorstayput, dispicnum; short tempang, actorstayput, dispicnum;
short timetosleep; short timetosleep;
int floorz, ceilingz, lastvx, lastvy, bposx, bposy, bposz, aflags; int floorz, ceilingz, lastvx, lastvy, aflags;
union union
{ {
int saved_ammo; int saved_ammo;
@ -47,7 +47,7 @@ struct weaponhit
{ {
cgg = spriteextra = 0; cgg = spriteextra = 0;
picnum = ang = extra = owner = movflag = tempang = actorstayput = dispicnum = timetosleep = 0; picnum = ang = extra = owner = movflag = tempang = actorstayput = dispicnum = timetosleep = 0;
floorz = ceilingz = lastvx = lastvy = bposx = bposy = bposz = aflags = saved_ammo = 0; floorz = ceilingz = lastvx = lastvy = aflags = saved_ammo = 0;
memset(temp_data, 0, sizeof(temp_data)); memset(temp_data, 0, sizeof(temp_data));
} }
int GetIndex() const { return this - array(); } int GetIndex() const { return this - array(); }