RR: Promote rotscrnang to Q16.16.

This commit is contained in:
Mitchell Richters 2020-05-13 14:46:44 +10:00 committed by Christoph Oelckers
parent 3af6ad697b
commit 21e58160bf
5 changed files with 25 additions and 24 deletions

View file

@ -916,9 +916,9 @@ void G_DrawRooms(int32_t playerNum, int32_t smoothRatio)
))
{
#ifdef USE_OPENGL
renderSetRollAngle(pPlayer->orotscrnang + mulscale16(((pPlayer->rotscrnang - pPlayer->orotscrnang + 1024)&2047)-1024, smoothRatio));
renderSetRollAngle(fix16_to_float(pPlayer->oq16rotscrnang + mulscale16(((pPlayer->q16rotscrnang - pPlayer->oq16rotscrnang + fix16_from_int(1024))&0x7FFFFFF)-fix16_from_int(1024), smoothRatio)));
#endif
pPlayer->orotscrnang = pPlayer->rotscrnang;
pPlayer->oq16rotscrnang = pPlayer->q16rotscrnang;
}
if (RRRA && pPlayer->drug_mode > 0)

View file

@ -261,8 +261,8 @@ GAMEEXEC_STATIC GAMEEXEC_INLINE void P_ForceAngle(DukePlayer_t *pPlayer)
pPlayer->q16horiz += F16(64);
pPlayer->return_to_center = 9;
pPlayer->rotscrnang = nAngle >> 1;
pPlayer->look_ang = pPlayer->rotscrnang;
pPlayer->q16rotscrnang = fix16_from_int(nAngle >> 1);
pPlayer->look_ang = fix16_to_int(pPlayer->q16rotscrnang);
}
// wow, this function sucks

View file

@ -6821,7 +6821,7 @@ void P_UpdatePosWhenViewingCam(DukePlayer_t *pPlayer)
pPlayer->vel.y = 0;
sprite[pPlayer->i].xvel = 0;
pPlayer->look_ang = 0;
pPlayer->rotscrnang = 0;
pPlayer->q16rotscrnang = 0;
}
static void P_DoWater(int const playerNum, int const playerBits, int const floorZ, int const ceilZ)
@ -6978,7 +6978,7 @@ static void P_Dead(int const playerNum, int const sectorLotag, int const floorZ,
pushmove((vec3_t *) pPlayer, &pPlayer->cursectnum, 128L, (4L<<8), (20L<<8), CLIPMASK0);
if (floorZ > ceilZ + ZOFFSET2 && pSprite->pal != 1)
pPlayer->rotscrnang = (pPlayer->dead_flag + ((floorZ+pPlayer->pos.z)>>7))&2047;
pPlayer->q16rotscrnang = fix16_from_int((pPlayer->dead_flag + ((floorZ+pPlayer->pos.z)>>7)))&0x7FFFFFF;
pPlayer->on_warping_sector = 0;
}
@ -7816,10 +7816,10 @@ check_enemy_sprite:
return;
}
pPlayer->rotscrnang -= (pPlayer->rotscrnang >> 1);
pPlayer->q16rotscrnang = fix16_ssub(pPlayer->q16rotscrnang, fix16_sdiv(pPlayer->q16rotscrnang, fix16_from_int(2)));
if (pPlayer->rotscrnang && !(pPlayer->rotscrnang >> 1))
pPlayer->rotscrnang -= ksgn(pPlayer->rotscrnang);
if (pPlayer->q16rotscrnang && !fix16_sdiv(pPlayer->q16rotscrnang, fix16_from_int(2)))
pPlayer->q16rotscrnang = fix16_ssub(pPlayer->q16rotscrnang, fix16_from_int(ksgn(fix16_to_int(pPlayer->q16rotscrnang))));
pPlayer->look_ang -= (pPlayer->look_ang >> 2);
@ -7832,7 +7832,7 @@ check_enemy_sprite:
if (VM_OnEvent(EVENT_LOOKLEFT,pPlayer->i,playerNum) == 0)
{
pPlayer->look_ang -= 152;
pPlayer->rotscrnang += 24;
pPlayer->q16rotscrnang = fix16_sadd(pPlayer->q16rotscrnang, fix16_from_int(24));
}
}
@ -7842,7 +7842,7 @@ check_enemy_sprite:
if (VM_OnEvent(EVENT_LOOKRIGHT,pPlayer->i,playerNum) == 0)
{
pPlayer->look_ang += 152;
pPlayer->rotscrnang -= 24;
pPlayer->q16rotscrnang = fix16_ssub(pPlayer->q16rotscrnang, fix16_from_int(24));
}
}
@ -7851,13 +7851,13 @@ check_enemy_sprite:
if (pPlayer->sea_sick < 250)
{
if (pPlayer->sea_sick >= 180)
pPlayer->rotscrnang += 24;
pPlayer->q16rotscrnang = fix16_sadd(pPlayer->q16rotscrnang, fix16_from_int(24));
else if (pPlayer->sea_sick >= 130)
pPlayer->rotscrnang -= 24;
pPlayer->q16rotscrnang = fix16_ssub(pPlayer->q16rotscrnang, fix16_from_int(24));
else if (pPlayer->sea_sick >= 70)
pPlayer->rotscrnang += 24;
pPlayer->q16rotscrnang = fix16_sadd(pPlayer->q16rotscrnang, fix16_from_int(24));
else if (pPlayer->sea_sick >= 20)
pPlayer->rotscrnang += 24;
pPlayer->q16rotscrnang = fix16_sadd(pPlayer->q16rotscrnang, fix16_from_int(24));
}
if (pPlayer->sea_sick < 250)
pPlayer->look_ang += (krand2()&255)-128;
@ -9071,10 +9071,10 @@ void P_DHProcessInput(int playerNum)
return;
}
pPlayer->rotscrnang -= (pPlayer->rotscrnang >> 1);
pPlayer->q16rotscrnang = fix16_ssub(pPlayer->q16rotscrnang, fix16_sdiv(pPlayer->q16rotscrnang, fix16_from_int(2)));
if (pPlayer->rotscrnang && !(pPlayer->rotscrnang >> 1))
pPlayer->rotscrnang -= ksgn(pPlayer->rotscrnang);
if (pPlayer->q16rotscrnang && !fix16_sdiv(pPlayer->q16rotscrnang, fix16_from_int(2)))
pPlayer->q16rotscrnang = fix16_ssub(pPlayer->q16rotscrnang, fix16_from_int(ksgn(fix16_to_int(pPlayer->q16rotscrnang))));
pPlayer->look_ang -= (pPlayer->look_ang >> 2);
@ -9085,14 +9085,14 @@ void P_DHProcessInput(int playerNum)
{
// look_left
pPlayer->look_ang -= 152;
pPlayer->rotscrnang += 24;
pPlayer->q16rotscrnang = fix16_sadd(pPlayer->q16rotscrnang, fix16_from_int(24));
}
if (TEST_SYNC_KEY(playerBits, SK_LOOK_RIGHT) && !pPlayer->on_motorcycle)
{
// look_right
pPlayer->look_ang += 152;
pPlayer->rotscrnang -= 24;
pPlayer->q16rotscrnang = fix16_ssub(pPlayer->q16rotscrnang, fix16_from_int(24));
}
int velocityModifier = TICSPERFRAME;

View file

@ -166,7 +166,8 @@ typedef struct {
int16_t weaprecs[MAX_WEAPON_RECS], weapon_sway, crack_time, bobcounter;
int16_t orotscrnang, rotscrnang, dead_flag; // JBF 20031220: added orotscrnang
int16_t dead_flag;
fix16_t oq16rotscrnang, q16rotscrnang; // JBF 20031220: added orotscrnang
int16_t holoduke_on, pycount;
int16_t transporter_hold/*, clipdist*/;

View file

@ -816,7 +816,7 @@ void P_ResetPlayer(int playerNum)
pPlayer->fta = 0;
pPlayer->ftq = 0;
pPlayer->vel.x = pPlayer->vel.y = 0;
if (!RR) pPlayer->rotscrnang = 0;
if (!RR) pPlayer->q16rotscrnang = 0;
pPlayer->runspeed = g_playerFriction;
pPlayer->falling_counter = 0;
@ -909,8 +909,8 @@ void P_ResetStatus(int playerNum)
pPlayer->jetpack_on = 0;
pPlayer->holoduke_on = -1;
pPlayer->look_ang = 512 - ((ud.level_number & 1) << 10);
pPlayer->rotscrnang = 0;
pPlayer->orotscrnang = 1; // JBF 20031220
pPlayer->q16rotscrnang = 0;
pPlayer->oq16rotscrnang = fix16_one; // JBF 20031220
pPlayer->newowner = -1;
pPlayer->jumping_counter = 0;
pPlayer->hard_landing = 0;