diff --git a/source/games/duke/src/actors.cpp b/source/games/duke/src/actors.cpp index d6e0984e3..e9daaaf2b 100644 --- a/source/games/duke/src/actors.cpp +++ b/source/games/duke/src/actors.cpp @@ -400,7 +400,7 @@ void moveplayers(void) { if (p->newOwner != nullptr) //Looking thru the camera { - act->spr.pos = p->posoldGet().plusZ(gs.playerheight); + act->restorepos(); act->backupz(); act->spr.angle = p->angle.oang; SetActor(act, act->spr.pos); @@ -3349,7 +3349,7 @@ void handle_se20(DDukeActor* actor) ps[p].posAdd(vec); ps[p].GetActor()->backupvec2(); - SetActor(ps[p].GetActor(), ps[p].posGet().plusZ(gs.playerheight)); + SetActor(ps[p].GetActor(), ps[p].GetActor()->spr.pos); } sc->addfloorxpan(-(float)vec.X * 2); diff --git a/source/games/duke/src/actors_d.cpp b/source/games/duke/src/actors_d.cpp index 8bca88195..7002051bd 100644 --- a/source/games/duke/src/actors_d.cpp +++ b/source/games/duke/src/actors_d.cpp @@ -1345,7 +1345,7 @@ void movetransports_d(void) ps[p].transporter_hold = 13; } - ps[p].posSet(Owner->spr.pos.plusZ(-gs.playerheight)); + ps[p].GetActor()->spr.pos = Owner->spr.pos; ps[p].GetActor()->backuppos(); ps[p].setbobpos(); @@ -1434,7 +1434,7 @@ void movetransports_d(void) ps[p].setCursector(Owner->sector()); ChangeActorSect(act2, Owner->sector()); - SetActor(ps[p].GetActor(), ps[p].posGet().plusZ(gs.playerheight)); + SetActor(act2, act2->spr.pos); if ((krand() & 255) < 32) spawn(act2, WATERSPLASH2); diff --git a/source/games/duke/src/actors_r.cpp b/source/games/duke/src/actors_r.cpp index 16a0cadbd..64b284e92 100644 --- a/source/games/duke/src/actors_r.cpp +++ b/source/games/duke/src/actors_r.cpp @@ -1233,7 +1233,7 @@ void movetransports_r(void) ps[p].transporter_hold = 13; } - ps[p].posSet(Owner->spr.pos.plusZ(-gs.playerheight + 4)); + ps[p].GetActor()->spr.pos = Owner->spr.pos.plusZ(4); ps[p].GetActor()->backuppos(); ps[p].setbobpos(); diff --git a/source/games/duke/src/animatesprites_d.cpp b/source/games/duke/src/animatesprites_d.cpp index c8ae17304..41d338308 100644 --- a/source/games/duke/src/animatesprites_d.cpp +++ b/source/games/duke/src/animatesprites_d.cpp @@ -165,7 +165,7 @@ void animatesprites_d(tspriteArray& tsprites, const DVector2& viewVec, DAngle vi auto pp = &ps[h->PlayerIndex()]; if (h->spr.statnum != STAT_ACTOR && h->spr.picnum == APLAYER && pp->newOwner == nullptr && h->GetOwner()) { - t->pos = interpolatedvalue(pp->posoldGet(), pp->posGet(), interpfrac).plusZ(gs.playerheight); + t->pos = h->interpolatedpos(interpfrac); } else if (!actorflag(h, SFLAG_NOINTERPOLATE)) { diff --git a/source/games/duke/src/animatesprites_r.cpp b/source/games/duke/src/animatesprites_r.cpp index 4d3dd5764..702d6a829 100644 --- a/source/games/duke/src/animatesprites_r.cpp +++ b/source/games/duke/src/animatesprites_r.cpp @@ -144,7 +144,7 @@ void animatesprites_r(tspriteArray& tsprites, const DVector2& viewVec, DAngle vi auto pp = &ps[h->PlayerIndex()]; if (h->spr.statnum != STAT_ACTOR && h->spr.picnum == APLAYER && pp->newOwner == nullptr && h->GetOwner()) { - t->pos = interpolatedvalue(pp->posoldGet(), pp->posGet(), interpfrac).plusZ(gs.playerheight); + t->pos = h->interpolatedpos(interpfrac); h->spr.scale = DVector2(0.375, 0.265625); } else if (!actorflag(h, SFLAG_NOINTERPOLATE)) diff --git a/source/games/duke/src/gameexec.cpp b/source/games/duke/src/gameexec.cpp index d4a379146..2981d9121 100644 --- a/source/games/duke/src/gameexec.cpp +++ b/source/games/duke/src/gameexec.cpp @@ -2235,7 +2235,7 @@ int ParseState::parse(void) ps[g_p].setbobpos(); g_ac->backuppos(); updatesector(ps[g_p].posGet(), &ps[g_p].cursector); - SetActor(ps[g_p].GetActor(), ps[g_p].posGet().plusZ(gs.playerheight )); + SetActor(ps[g_p].GetActor(), ps[g_p].GetActor()->spr.pos); g_ac->spr.cstat = CSTAT_SPRITE_BLOCK_ALL; g_ac->spr.shade = -12; diff --git a/source/games/duke/src/player_d.cpp b/source/games/duke/src/player_d.cpp index 736376887..d34f239a6 100644 --- a/source/games/duke/src/player_d.cpp +++ b/source/games/duke/src/player_d.cpp @@ -3063,7 +3063,7 @@ HORIZONLY: } // RBG*** - SetActor(pact, p->posGet().plusZ(gs.playerheight)); + SetActor(pact, p->GetActor()->spr.pos); if (psectlotag < 3) { diff --git a/source/games/duke/src/player_r.cpp b/source/games/duke/src/player_r.cpp index d6e69817d..7631dbce0 100644 --- a/source/games/duke/src/player_r.cpp +++ b/source/games/duke/src/player_r.cpp @@ -3839,7 +3839,7 @@ HORIZONLY: } // RBG*** - SetActor(pact, p->posGet().plusZ(gs.playerheight)); + SetActor(pact, p->GetActor()->spr.pos); if (psectlotag == 800 && (!isRRRA() || !p->lotag800kill)) { diff --git a/source/games/duke/src/render.cpp b/source/games/duke/src/render.cpp index 574588528..7108f403a 100644 --- a/source/games/duke/src/render.cpp +++ b/source/games/duke/src/render.cpp @@ -273,6 +273,9 @@ void displayrooms(int snum, double interpfrac, bool sceneonly) // set screen rotation. rotscrnang = !SyncInput() ? p->angle.rotscrnang : p->angle.interpolatedrotscrn(interpfrac); + // use player's actor initially. + viewer = p->GetActor(); + if ((snum == myconnectindex) && (numplayers > 1)) { cpos = interpolatedvalue(omypos, mypos, interpfrac); @@ -290,7 +293,7 @@ void displayrooms(int snum, double interpfrac, bool sceneonly) } else { - cpos = interpolatedvalue(p->posoldGet(), p->posGet(), interpfrac); + cpos = viewer->interpolatedpos(interpfrac).plusZ(viewer->viewzoffset); if (SyncInput()) { @@ -320,14 +323,12 @@ void displayrooms(int snum, double interpfrac, bool sceneonly) else if (p->over_shoulder_on == 0) { if (cl_viewbob) cpos.Z += interpolatedvalue(p->opyoff, p->pyoff, interpfrac); - viewer = p->GetActor(); } else { auto adjustment = isRR() ? 15 : 12; cpos.Z -= adjustment; - viewer = p->GetActor(); if (!calcChaseCamPos(cpos, viewer, §, cang, choriz, interpfrac, 64.)) { cpos.Z += adjustment;