- SW: Remove q16horizbase and apply q16horizoff in draw code like Duke & Blood.

* Standardisation is needed here for upcoming horizon changes.
This commit is contained in:
Mitchell Richters 2020-10-07 13:32:24 +11:00
parent 082336e5f8
commit 0e3604ac9e
3 changed files with 11 additions and 17 deletions

View file

@ -1649,13 +1649,16 @@ drawscreen(PLAYERp pp, double smoothratio)
fixed_t oang = camerapp->oq16ang + camerapp->oq16look_ang; fixed_t oang = camerapp->oq16ang + camerapp->oq16look_ang;
fixed_t ang = camerapp->q16ang + camerapp->q16look_ang; fixed_t ang = camerapp->q16ang + camerapp->q16look_ang;
tq16ang = oang + xs_CRoundToInt(fmulscale16(NORM_Q16ANGLE(ang + dang - oang) - dang, smoothratio)); tq16ang = oang + xs_CRoundToInt(fmulscale16(NORM_Q16ANGLE(ang + dang - oang) - dang, smoothratio));
tq16horiz = camerapp->oq16horiz + xs_CRoundToInt(fmulscale16(camerapp->q16horiz - camerapp->oq16horiz, smoothratio));
fixed_t ohoriz = camerapp->oq16horiz + camerapp->oq16horizoff;
fixed_t horiz = camerapp->q16horiz + camerapp->q16horizoff;
tq16horiz = ohoriz + xs_CRoundToInt(fmulscale16(horiz - ohoriz, smoothratio));
tq16rotscrnang = camerapp->oq16rotscrnang + xs_CRoundToInt(fmulscale16(NORM_Q16ANGLE(camerapp->q16rotscrnang + dang - camerapp->oq16rotscrnang) - dang, smoothratio)); tq16rotscrnang = camerapp->oq16rotscrnang + xs_CRoundToInt(fmulscale16(NORM_Q16ANGLE(camerapp->q16rotscrnang + dang - camerapp->oq16rotscrnang) - dang, smoothratio));
} }
else else
{ {
tq16ang = pp->q16ang + pp->q16look_ang; tq16ang = pp->q16ang + pp->q16look_ang;
tq16horiz = pp->q16horiz; tq16horiz = pp->q16horiz + pp->q16horizoff;
tq16rotscrnang = pp->q16rotscrnang; tq16rotscrnang = pp->q16rotscrnang;
} }
tsectnum = camerapp->cursectnum; tsectnum = camerapp->cursectnum;

View file

@ -831,7 +831,7 @@ struct PLAYERstruct
// interpolation // interpolation
int int
oposx, oposy, oposz; oposx, oposy, oposz;
fixed_t oq16horiz, oq16ang; fixed_t oq16horiz, oq16horizoff, oq16ang;
fixed_t oq16look_ang, oq16rotscrnang; fixed_t oq16look_ang, oq16rotscrnang;
// holds last valid move position // holds last valid move position
@ -882,7 +882,7 @@ struct PLAYERstruct
// variables that do not fit into sprite structure // variables that do not fit into sprite structure
int hvel,tilt,tilt_dest; int hvel,tilt,tilt_dest;
fixed_t q16horiz, q16horizbase, q16horizoff, q16ang; fixed_t q16horiz, q16horizoff, q16ang;
fixed_t q16look_ang, q16rotscrnang; fixed_t q16look_ang, q16rotscrnang;
short recoil_amt; short recoil_amt;
short recoil_speed; short recoil_speed;

View file

@ -1741,16 +1741,7 @@ DoPlayerHorizon(PLAYERp pp, fixed_t const q16horz, double const scaleAdjust)
PlayerAutoLook(pp, scaleAdjust); PlayerAutoLook(pp, scaleAdjust);
// apply default horizon from backend // apply default horizon from backend
sethorizon(&pp->q16horizbase, q16horz, &pp->input.actions, scaleAdjust); sethorizon(&pp->q16horiz, q16horz, &pp->input.actions, scaleAdjust);
// bound adjust q16horizoff
if (pp->q16horizbase + pp->q16horizoff < gi->playerHorizMin())
pp->q16horizoff = gi->playerHorizMin() - pp->q16horizbase;
else if (pp->q16horizbase + pp->q16horizoff > gi->playerHorizMax())
pp->q16horizoff = gi->playerHorizMax() - pp->q16horizbase;
// add base and offsets
pp->q16horiz = pp->q16horizbase + pp->q16horizoff;
} }
void void
@ -6308,7 +6299,7 @@ void DoPlayerDeathCheckKeys(PLAYERp pp)
sp->yrepeat = PLAYER_NINJA_YREPEAT; sp->yrepeat = PLAYER_NINJA_YREPEAT;
//pp->tilt = 0; //pp->tilt = 0;
pp->q16horiz = pp->q16horizbase = 0; pp->q16horiz = 0;
DoPlayerResetMovement(pp); DoPlayerResetMovement(pp);
u->ID = NINJA_RUN_R0; u->ID = NINJA_RUN_R0;
PlayerDeathReset(pp); PlayerDeathReset(pp);
@ -6981,6 +6972,7 @@ MoveSkipSavePos(void)
pp->oposz = pp->posz; pp->oposz = pp->posz;
pp->oq16ang = pp->q16ang; pp->oq16ang = pp->q16ang;
pp->oq16horiz = pp->q16horiz; pp->oq16horiz = pp->q16horiz;
pp->oq16horizoff = pp->q16horizoff;
pp->obob_z = pp->bob_z; pp->obob_z = pp->bob_z;
pp->oq16look_ang = pp->q16look_ang; pp->oq16look_ang = pp->q16look_ang;
pp->oq16rotscrnang = pp->q16rotscrnang; pp->oq16rotscrnang = pp->q16rotscrnang;
@ -7360,7 +7352,7 @@ InitAllPlayers(void)
//getzsofslope(pfirst->cursectnum, pfirst->posx, pfirst->posy, &cz, &fz); //getzsofslope(pfirst->cursectnum, pfirst->posx, pfirst->posy, &cz, &fz);
//pfirst->posz = fz - PLAYER_HEIGHT; //pfirst->posz = fz - PLAYER_HEIGHT;
pfirst->q16horiz = pfirst->q16horizbase = 0; pfirst->q16horiz = 0;
// Initialize all [MAX_SW_PLAYERS] arrays here! // Initialize all [MAX_SW_PLAYERS] arrays here!
for (pp = Player; pp < &Player[MAX_SW_PLAYERS]; pp++) for (pp = Player; pp < &Player[MAX_SW_PLAYERS]; pp++)
@ -7376,7 +7368,6 @@ InitAllPlayers(void)
//pp->MaxHealth = 100; //pp->MaxHealth = 100;
pp->q16horizbase = pfirst->q16horizbase;
pp->oldposx = 0; pp->oldposx = 0;
pp->oldposy = 0; pp->oldposy = 0;
pp->climb_ndx = 10; pp->climb_ndx = 10;