diff --git a/source/rr/src/game.cpp b/source/rr/src/game.cpp index bf75e0a19..4c791c7aa 100644 --- a/source/rr/src/game.cpp +++ b/source/rr/src/game.cpp @@ -1014,7 +1014,7 @@ void G_DrawRooms(int32_t playerNum, int32_t smoothRatio) omypos.z + mulscale16(mypos.z - omypos.z, smoothRatio) }; CAMERA(pos) = camVect; - CAMERA(q16ang) = myang + fix16_from_int(pPlayer->look_ang); + CAMERA(q16ang) = myang + pPlayer->q16look_ang; CAMERA(q16horiz) = myhoriz + myhorizoff; CAMERA(sect) = mycursectnum; } @@ -1030,13 +1030,13 @@ void G_DrawRooms(int32_t playerNum, int32_t smoothRatio) { CAMERA(q16ang) = pPlayer->oq16ang + mulscale16(((pPlayer->q16ang + F16(1024) - pPlayer->oq16ang) & 0x7FFFFFF) - F16(1024), smoothRatio) - + fix16_from_int(pPlayer->look_ang); + + pPlayer->q16look_ang; CAMERA(q16horiz) = pPlayer->oq16horiz + pPlayer->oq16horizoff + mulscale16((pPlayer->q16horiz + pPlayer->q16horizoff - pPlayer->oq16horiz - pPlayer->oq16horizoff), smoothRatio); } else { - CAMERA(q16ang) = pPlayer->q16ang + fix16_from_int(pPlayer->look_ang); + CAMERA(q16ang) = pPlayer->q16ang + pPlayer->q16look_ang; CAMERA(q16horiz) = pPlayer->q16horiz + pPlayer->q16horizoff; } } @@ -1068,7 +1068,7 @@ void G_DrawRooms(int32_t playerNum, int32_t smoothRatio) // looking through viewscreen CAMERA(pos) = camVect; - CAMERA(q16ang) = pPlayer->q16ang + fix16_from_int(pPlayer->look_ang); + CAMERA(q16ang) = pPlayer->q16ang + pPlayer->q16look_ang; CAMERA(q16horiz) = fix16_from_int(100 + sprite[pPlayer->newowner].shade); CAMERA(sect) = sprite[pPlayer->newowner].sectnum; } diff --git a/source/rr/src/gameexec.cpp b/source/rr/src/gameexec.cpp index 463758d96..53bdd3a6f 100644 --- a/source/rr/src/gameexec.cpp +++ b/source/rr/src/gameexec.cpp @@ -262,7 +262,7 @@ GAMEEXEC_STATIC GAMEEXEC_INLINE void P_ForceAngle(DukePlayer_t *pPlayer) pPlayer->q16horiz += F16(64); pPlayer->return_to_center = 9; pPlayer->q16rotscrnang = fix16_from_int(nAngle >> 1); - pPlayer->look_ang = fix16_to_int(pPlayer->q16rotscrnang); + pPlayer->q16look_ang = pPlayer->q16rotscrnang; } // wow, this function sucks diff --git a/source/rr/src/player.cpp b/source/rr/src/player.cpp index 6cb0890e7..cfe0d477d 100644 --- a/source/rr/src/player.cpp +++ b/source/rr/src/player.cpp @@ -1455,7 +1455,7 @@ static int P_DisplayFist(int const fistShade) if (fistInc <= 0) return 0; - int const fistY = klabs(pPlayer->look_ang) / 9; + int const fistY = klabs(fix16_to_int(pPlayer->q16look_ang)) / 9; int const fistZoom = clamp(65536 - (sintable[(512 + (fistInc << 6)) & 2047] << 2), 40920, 90612); int const fistYOffset = 194 + (sintable[((6 + fistInc) << 7) & 2047] >> 9); int const fistPal = P_GetHudPal(pPlayer); @@ -1609,10 +1609,10 @@ static int P_DisplayKnee(int kneeShade) if (ps->knee_incs >= ARRAY_SIZE(knee_y) || sprite[ps->i].extra <= 0) return 0; - int const kneeY = knee_y[ps->knee_incs] + (klabs(ps->look_ang) / 9) - (ps->hard_landing << 3); + int const kneeY = knee_y[ps->knee_incs] + (klabs(fix16_to_int(ps->q16look_ang)) / 9) - (ps->hard_landing << 3); int const kneePal = P_GetKneePal(ps); - G_DrawTileScaled(105+(fix16_to_int(g_player[screenpeek].input->q16avel)>>5)-(ps->look_ang>>1)+(knee_y[ps->knee_incs]>>2), + G_DrawTileScaled(105+(fix16_to_int(g_player[screenpeek].input->q16avel)>>5)-(fix16_to_int(ps->q16look_ang)>>1)+(knee_y[ps->knee_incs]>>2), kneeY+280-(fix16_to_int(ps->q16horiz-ps->q16horizoff)>>4),KNEE,kneeShade,4+DRAWEAP_CENTER,kneePal); return 1; @@ -1632,10 +1632,10 @@ static int P_DisplayKnuckles(int knuckleShade) if ((unsigned) (pPlayer->knuckle_incs>>1) >= ARRAY_SIZE(knuckleFrames) || sprite[pPlayer->i].extra <= 0) return 0; - int const knuckleY = (klabs(pPlayer->look_ang) / 9) - (pPlayer->hard_landing << 3); + int const knuckleY = (klabs(fix16_to_int(pPlayer->q16look_ang)) / 9) - (pPlayer->hard_landing << 3); int const knucklePal = P_GetHudPal(pPlayer); - G_DrawTileScaled(160 + (fix16_to_int(g_player[screenpeek].input->q16avel) >> 5) - (pPlayer->look_ang >> 1), + G_DrawTileScaled(160 + (fix16_to_int(g_player[screenpeek].input->q16avel) >> 5) - (fix16_to_int(pPlayer->q16look_ang) >> 1), knuckleY + 180 - (fix16_to_int(pPlayer->q16horiz - pPlayer->q16horizoff) >> 4), CRACKKNUCKLES + knuckleFrames[pPlayer->knuckle_incs >> 1], knuckleShade, 4 + DRAWEAP_CENTER, knucklePal); @@ -1803,13 +1803,13 @@ static int P_DisplayTip(int tipShade) if ((unsigned)pPlayer->tipincs >= ARRAY_SIZE(access_tip_y)) return 1; - int const tipY = (klabs(pPlayer->look_ang) / 9) - (pPlayer->hard_landing << 3); + int const tipY = (klabs(fix16_to_int(pPlayer->q16look_ang)) / 9) - (pPlayer->hard_landing << 3); int const tipPal = P_GetHudPal(pPlayer); int const tipYOffset = access_tip_y[pPlayer->tipincs] >> 1; guniqhudid = 201; - G_DrawTileScaled(170 + (fix16_to_int(g_player[screenpeek].input->q16avel) >> 5) - (pPlayer->look_ang >> 1), + G_DrawTileScaled(170 + (fix16_to_int(g_player[screenpeek].input->q16avel) >> 5) - (fix16_to_int(pPlayer->q16look_ang) >> 1), tipYOffset + tipY + 240 - (fix16_to_int(pPlayer->q16horiz - pPlayer->q16horizoff) >> 4), TIP + ((26 - pPlayer->tipincs) >> 4), tipShade, DRAWEAP_CENTER, tipPal); @@ -1829,20 +1829,20 @@ static int P_DisplayAccess(int accessShade) return 1; int const accessX = access_tip_y[pSprite->access_incs] >> 2; - int const accessY = access_tip_y[pSprite->access_incs] + (klabs(pSprite->look_ang) / 9) - (pSprite->hard_landing << 3); + int const accessY = access_tip_y[pSprite->access_incs] + (klabs(fix16_to_int(pSprite->q16look_ang)) / 9) - (pSprite->hard_landing << 3); int const accessPal = (pSprite->access_spritenum >= 0) ? sprite[pSprite->access_spritenum].pal : 0; guniqhudid = 200; if ((pSprite->access_incs - 3) > 0 && (pSprite->access_incs - 3) >> 3) { - G_DrawTileScaled(170 + (fix16_to_int(g_player[screenpeek].input->q16avel) >> 5) - (pSprite->look_ang >> 1) + accessX, + G_DrawTileScaled(170 + (fix16_to_int(g_player[screenpeek].input->q16avel) >> 5) - (fix16_to_int(pSprite->q16look_ang) >> 1) + accessX, accessY + 266 - (fix16_to_int(pSprite->q16horiz - pSprite->q16horizoff) >> 4), HANDHOLDINGLASER + (pSprite->access_incs >> 3), accessShade, DRAWEAP_CENTER, accessPal); } else { - G_DrawTileScaled(170 + (fix16_to_int(g_player[screenpeek].input->q16avel) >> 5) - (pSprite->look_ang >> 1) + accessX, + G_DrawTileScaled(170 + (fix16_to_int(g_player[screenpeek].input->q16avel) >> 5) - (fix16_to_int(pSprite->q16look_ang) >> 1) + accessX, accessY + 266 - (fix16_to_int(pSprite->q16horiz - pSprite->q16horizoff) >> 4), HANDHOLDINGACCESS, accessShade, 4 + DRAWEAP_CENTER, accessPal); } @@ -1891,7 +1891,7 @@ void P_DisplayWeapon(void) return; int weaponX = (160) - 90; - int weaponY = klabs(pPlayer->look_ang) / 9; + int weaponY = klabs(fix16_to_int(pPlayer->q16look_ang)) / 9; int weaponYOffset = 80 - (pPlayer->weapon_pos * pPlayer->weapon_pos); int weaponShade = (RR && pPlayer->cursectnum >= 0 && g_shadedSector[pPlayer->cursectnum]) ? 16 : (sprite[pPlayer->i].shade <= 24 ? sprite[pPlayer->i].shade : 24); @@ -1925,7 +1925,7 @@ void P_DisplayWeapon(void) hudweap.gunposx = weaponX; hudweap.shade = weaponShade; hudweap.count = *weaponFrame; - hudweap.lookhalfang = pPlayer->look_ang >> 1; + hudweap.lookhalfang = fix16_to_int(pPlayer->q16look_ang) >> 1; quickKickFrame = 14 - pPlayer->quick_kick; @@ -1936,10 +1936,10 @@ void P_DisplayWeapon(void) guniqhudid = 100; if (quickKickFrame < 6 || quickKickFrame > 12) - G_DrawTileScaled(weaponX + 80 - (pPlayer->look_ang >> 1), weaponY + 250 - weaponYOffset, KNEE, weaponShade, + G_DrawTileScaled(weaponX + 80 - (fix16_to_int(pPlayer->q16look_ang) >> 1), weaponY + 250 - weaponYOffset, KNEE, weaponShade, weaponBits | 4 | DRAWEAP_CENTER, weaponPal); else - G_DrawTileScaled(weaponX + 160 - 16 - (pPlayer->look_ang >> 1), weaponY + 214 - weaponYOffset, KNEE + 1, + G_DrawTileScaled(weaponX + 160 - 16 - (fix16_to_int(pPlayer->q16look_ang) >> 1), weaponY + 214 - weaponYOffset, KNEE + 1, weaponShade, weaponBits | 4 | DRAWEAP_CENTER, weaponPal); guniqhudid = 0; } @@ -1982,7 +1982,7 @@ void P_DisplayWeapon(void) int const weaponPal = P_GetHudPal(pPlayer); - G_DrawTileScaled(160-(pPlayer->look_ang>>1), 174, motoTile, weaponShade, 2 | DRAWEAP_CENTER, + G_DrawTileScaled(160-(fix16_to_int(pPlayer->q16look_ang)>>1), 174, motoTile, weaponShade, 2 | DRAWEAP_CENTER, weaponPal, 34816, pPlayer->tilt_status * 5 + (pPlayer->tilt_status < 0 ? 2047 : 0)); return; } @@ -2049,7 +2049,7 @@ void P_DisplayWeapon(void) else weaponY = 170 + (*weaponFrame>>2); - G_DrawTileScaled(160-(pPlayer->look_ang>>1), weaponY, boatTile, weaponShade, 2 | DRAWEAP_CENTER, + G_DrawTileScaled(160-(fix16_to_int(pPlayer->q16look_ang)>>1), weaponY, boatTile, weaponShade, 2 | DRAWEAP_CENTER, weaponPal, 66048, pPlayer->tilt_status + (pPlayer->tilt_status < 0 ? 2047 : 0)); return; } @@ -2070,10 +2070,10 @@ void P_DisplayWeapon(void) currentWeapon = weaponX; weaponX += sintable[(fistPos)&2047] >> 10; - G_DrawTileScaled(weaponX + 250 - (pPlayer->look_ang >> 1), weaponY + 258 - (klabs(sintable[(fistPos)&2047] >> 8)), + G_DrawTileScaled(weaponX + 250 - (fix16_to_int(pPlayer->q16look_ang) >> 1), weaponY + 258 - (klabs(sintable[(fistPos)&2047] >> 8)), FIST, weaponShade, weaponBits, weaponPal); weaponX = currentWeapon - (sintable[(fistPos)&2047] >> 10); - G_DrawTileScaled(weaponX + 40 - (pPlayer->look_ang >> 1), weaponY + 200 + (klabs(sintable[(fistPos)&2047] >> 8)), FIST, + G_DrawTileScaled(weaponX + 40 - (fix16_to_int(pPlayer->q16look_ang) >> 1), weaponY + 200 + (klabs(sintable[(fistPos)&2047] >> 8)), FIST, weaponShade, weaponBits | 4, weaponPal); } else @@ -2093,7 +2093,7 @@ void P_DisplayWeapon(void) goto enddisplayweapon; int const doAnim = !(sprite[pPlayer->i].pal == 1 || ud.pause_on || g_player[myconnectindex].ps->gm & MODE_MENU); - int const halfLookAng = pPlayer->look_ang >> 1; + int const halfLookAng = fix16_to_int(pPlayer->q16look_ang) >> 1; int const weaponPal = P_GetHudPal(pPlayer); @@ -2352,16 +2352,16 @@ void P_DisplayWeapon(void) switch (*weaponFrame) { case 0: - G_DrawWeaponTileWithID(currentWeapon, weaponX + 178 - (pPlayer->look_ang >> 1) + 30, weaponY + 233 - weaponYOffset + 5, + G_DrawWeaponTileWithID(currentWeapon, weaponX + 178 - (fix16_to_int(pPlayer->q16look_ang) >> 1) + 30, weaponY + 233 - weaponYOffset + 5, CHAINGUN, weaponShade, weaponBits, weaponPal, 32768); break; default: if (*weaponFrame < 8) - G_DrawWeaponTileWithID(currentWeapon, weaponX + 178 - (pPlayer->look_ang >> 1) + 30, weaponY + 233 - weaponYOffset + 5, + G_DrawWeaponTileWithID(currentWeapon, weaponX + 178 - (fix16_to_int(pPlayer->q16look_ang) >> 1) + 30, weaponY + 233 - weaponYOffset + 5, CHAINGUN + 1, 0, weaponBits, weaponPal, 32768); else - G_DrawWeaponTileWithID(currentWeapon, weaponX + 178 - (pPlayer->look_ang >> 1) + 30, weaponY + 233 - weaponYOffset + 5, + G_DrawWeaponTileWithID(currentWeapon, weaponX + 178 - (fix16_to_int(pPlayer->q16look_ang) >> 1) + 30, weaponY + 233 - weaponYOffset + 5, CHAINGUN + 2, weaponShade, weaponBits, weaponPal, 32768); break; @@ -2379,7 +2379,7 @@ void P_DisplayWeapon(void) if (frame) weaponShade = 0; - G_DrawWeaponTileWithID(currentWeapon, offsetX[frame] - 12 + weaponX - (pPlayer->look_ang >> 1), weaponY + offsetY[frame] - weaponYOffset, + G_DrawWeaponTileWithID(currentWeapon, offsetX[frame] - 12 + weaponX - (fix16_to_int(pPlayer->q16look_ang) >> 1), weaponY + offsetY[frame] - weaponYOffset, FIRSTGUN + frame, weaponShade, weaponBits, weaponPal, 36700); break; @@ -2484,11 +2484,11 @@ void P_DisplayWeapon(void) { static uint8_t freezerFrames[] = { 0,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 }; - G_DrawWeaponTileWithID(currentWeapon, weaponX + 260 - (pPlayer->look_ang >> 1), weaponY + 215 - weaponYOffset, + G_DrawWeaponTileWithID(currentWeapon, weaponX + 260 - (fix16_to_int(pPlayer->q16look_ang) >> 1), weaponY + 215 - weaponYOffset, FREEZE + freezerFrames[*weaponFrame], -32, weaponBits, weaponPal, 32768); } else - G_DrawWeaponTileWithID(currentWeapon, weaponX + 260 - (pPlayer->look_ang >> 1), weaponY + 215 - weaponYOffset, + G_DrawWeaponTileWithID(currentWeapon, weaponX + 260 - (fix16_to_int(pPlayer->q16look_ang) >> 1), weaponY + 215 - weaponYOffset, FREEZE, weaponShade, weaponBits, weaponPal, 32768); break; @@ -2786,7 +2786,7 @@ void P_DisplayWeapon(void) switch (*weaponFrame) { case 0: - G_DrawWeaponTileWithID(currentWeapon, weaponX + 178 - (pPlayer->look_ang >> 1), weaponY + 233 - weaponYOffset, + G_DrawWeaponTileWithID(currentWeapon, weaponX + 178 - (fix16_to_int(pPlayer->q16look_ang) >> 1), weaponY + 233 - weaponYOffset, CHAINGUN + 1, weaponShade, weaponBits, weaponPal); break; @@ -2794,11 +2794,11 @@ void P_DisplayWeapon(void) if (*weaponFrame > 4 && *weaponFrame < 12) { int randomOffset = doAnim ? rand()&7 : 0; - G_DrawWeaponTileWithID(currentWeapon << 2, randomOffset + weaponX - 4 + 140 - (pPlayer->look_ang >> 1), + G_DrawWeaponTileWithID(currentWeapon << 2, randomOffset + weaponX - 4 + 140 - (fix16_to_int(pPlayer->q16look_ang) >> 1), randomOffset + weaponY - ((*weaponFrame) >> 1) + 208 - weaponYOffset, CHAINGUN + 5 + ((*weaponFrame - 4) / 5), weaponShade, weaponBits, weaponPal); if (doAnim) randomOffset = rand()&7; - G_DrawWeaponTileWithID(currentWeapon << 2, randomOffset + weaponX - 4 + 184 - (pPlayer->look_ang >> 1), + G_DrawWeaponTileWithID(currentWeapon << 2, randomOffset + weaponX - 4 + 184 - (fix16_to_int(pPlayer->q16look_ang) >> 1), randomOffset + weaponY - ((*weaponFrame) >> 1) + 208 - weaponYOffset, CHAINGUN + 5 + ((*weaponFrame - 4) / 5), weaponShade, weaponBits, weaponPal); } @@ -2806,20 +2806,20 @@ void P_DisplayWeapon(void) if (*weaponFrame < 8) { int const randomOffset = doAnim ? rand()&7 : 0; - G_DrawWeaponTileWithID(currentWeapon << 2, randomOffset + weaponX - 4 + 162 - (pPlayer->look_ang >> 1), + G_DrawWeaponTileWithID(currentWeapon << 2, randomOffset + weaponX - 4 + 162 - (fix16_to_int(pPlayer->q16look_ang) >> 1), randomOffset + weaponY - ((*weaponFrame) >> 1) + 208 - weaponYOffset, CHAINGUN + 5 + ((*weaponFrame - 2) / 5), weaponShade, weaponBits, weaponPal); - G_DrawWeaponTileWithID(currentWeapon, weaponX + 178 - (pPlayer->look_ang >> 1), weaponY + 233 - weaponYOffset, + G_DrawWeaponTileWithID(currentWeapon, weaponX + 178 - (fix16_to_int(pPlayer->q16look_ang) >> 1), weaponY + 233 - weaponYOffset, CHAINGUN + 1 + ((*weaponFrame) >> 1), weaponShade, weaponBits, weaponPal); } else - G_DrawWeaponTileWithID(currentWeapon, weaponX + 178 - (pPlayer->look_ang >> 1), weaponY + 233 - weaponYOffset, + G_DrawWeaponTileWithID(currentWeapon, weaponX + 178 - (fix16_to_int(pPlayer->q16look_ang) >> 1), weaponY + 233 - weaponYOffset, CHAINGUN + 1, weaponShade, weaponBits, weaponPal); break; } - G_DrawWeaponTileWithID(currentWeapon << 1, weaponX + 168 - (pPlayer->look_ang >> 1), weaponY + 260 - weaponYOffset, + G_DrawWeaponTileWithID(currentWeapon << 1, weaponX + 168 - (fix16_to_int(pPlayer->q16look_ang) >> 1), weaponY + 260 - weaponYOffset, CHAINGUN, weaponShade, weaponBits, weaponPal); break; @@ -2832,7 +2832,7 @@ void P_DisplayWeapon(void) if ((*weaponFrame) == 2) pistolOffset -= 3; - G_DrawWeaponTileWithID(currentWeapon, (pistolOffset - (pPlayer->look_ang >> 1)), (weaponY + 244 - weaponYOffset), + G_DrawWeaponTileWithID(currentWeapon, (pistolOffset - (fix16_to_int(pPlayer->q16look_ang) >> 1)), (weaponY + 244 - weaponYOffset), FIRSTGUN + pistolFrames[*weaponFrame > 2 ? 0 : *weaponFrame], weaponShade, 2, weaponPal); @@ -2843,41 +2843,41 @@ void P_DisplayWeapon(void) weaponBits |= 512; if ((*weaponFrame) < 10) - G_DrawWeaponTileWithID(currentWeapon, 194 - (pPlayer->look_ang >> 1), weaponY + 230 - weaponYOffset, FIRSTGUN + 4, + G_DrawWeaponTileWithID(currentWeapon, 194 - (fix16_to_int(pPlayer->q16look_ang) >> 1), weaponY + 230 - weaponYOffset, FIRSTGUN + 4, weaponShade, weaponBits, weaponPal); else if ((*weaponFrame) < 15) { - G_DrawWeaponTileWithID(currentWeapon << 1, 244 - ((*weaponFrame) << 3) - (pPlayer->look_ang >> 1), + G_DrawWeaponTileWithID(currentWeapon << 1, 244 - ((*weaponFrame) << 3) - (fix16_to_int(pPlayer->q16look_ang) >> 1), weaponY + 130 - weaponYOffset + ((*weaponFrame) << 4), FIRSTGUN + 6, weaponShade, weaponBits, weaponPal); - G_DrawWeaponTileWithID(currentWeapon, 224 - (pPlayer->look_ang >> 1), weaponY + 220 - weaponYOffset, FIRSTGUN + 5, + G_DrawWeaponTileWithID(currentWeapon, 224 - (fix16_to_int(pPlayer->q16look_ang) >> 1), weaponY + 220 - weaponYOffset, FIRSTGUN + 5, weaponShade, weaponBits, weaponPal); } else if ((*weaponFrame) < 20) { - G_DrawWeaponTileWithID(currentWeapon << 1, 124 + ((*weaponFrame) << 1) - (pPlayer->look_ang >> 1), + G_DrawWeaponTileWithID(currentWeapon << 1, 124 + ((*weaponFrame) << 1) - (fix16_to_int(pPlayer->q16look_ang) >> 1), weaponY + 430 - weaponYOffset - ((*weaponFrame) << 3), FIRSTGUN + 6, weaponShade, weaponBits, weaponPal); - G_DrawWeaponTileWithID(currentWeapon, 224 - (pPlayer->look_ang >> 1), weaponY + 220 - weaponYOffset, FIRSTGUN + 5, + G_DrawWeaponTileWithID(currentWeapon, 224 - (fix16_to_int(pPlayer->q16look_ang) >> 1), weaponY + 220 - weaponYOffset, FIRSTGUN + 5, weaponShade, weaponBits, weaponPal); } else if ((*weaponFrame) < (WW2GI ? PWEAPON(screenpeek, PISTOL_WEAPON, Reload) - 12 : (NAM ? 38 : 23))) { - G_DrawWeaponTileWithID(currentWeapon << 2, 184 - (pPlayer->look_ang >> 1), weaponY + 235 - weaponYOffset, + G_DrawWeaponTileWithID(currentWeapon << 2, 184 - (fix16_to_int(pPlayer->q16look_ang) >> 1), weaponY + 235 - weaponYOffset, FIRSTGUN + 8, weaponShade, weaponBits, weaponPal); - G_DrawWeaponTileWithID(currentWeapon, 224 - (pPlayer->look_ang >> 1), weaponY + 210 - weaponYOffset, FIRSTGUN + 5, + G_DrawWeaponTileWithID(currentWeapon, 224 - (fix16_to_int(pPlayer->q16look_ang) >> 1), weaponY + 210 - weaponYOffset, FIRSTGUN + 5, weaponShade, weaponBits, weaponPal); } else if ((*weaponFrame) < (WW2GI ? PWEAPON(screenpeek, PISTOL_WEAPON, Reload) - 6 : (NAM ? 44 : 25))) { - G_DrawWeaponTileWithID(currentWeapon << 2, 164 - (pPlayer->look_ang >> 1), weaponY + 245 - weaponYOffset, + G_DrawWeaponTileWithID(currentWeapon << 2, 164 - (fix16_to_int(pPlayer->q16look_ang) >> 1), weaponY + 245 - weaponYOffset, FIRSTGUN + 8, weaponShade, weaponBits, weaponPal); - G_DrawWeaponTileWithID(currentWeapon, 224 - (pPlayer->look_ang >> 1), weaponY + 220 - weaponYOffset, FIRSTGUN + 5, + G_DrawWeaponTileWithID(currentWeapon, 224 - (fix16_to_int(pPlayer->q16look_ang) >> 1), weaponY + 220 - weaponYOffset, FIRSTGUN + 5, weaponShade, weaponBits, weaponPal); } else if ((*weaponFrame) < (WW2GI ? PWEAPON(screenpeek, PISTOL_WEAPON, Reload) : (NAM ? 50 : 27))) - G_DrawWeaponTileWithID(currentWeapon, 194 - (pPlayer->look_ang >> 1), weaponY + 235 - weaponYOffset, FIRSTGUN + 5, + G_DrawWeaponTileWithID(currentWeapon, 194 - (fix16_to_int(pPlayer->q16look_ang) >> 1), weaponY + 235 - weaponYOffset, FIRSTGUN + 5, weaponShade, weaponBits, weaponPal); break; @@ -3050,13 +3050,13 @@ void P_DisplayWeapon(void) weaponY += rand() & 3; } weaponYOffset -= 16; - G_DrawWeaponTileWithID(currentWeapon << 1, weaponX + 210 - (pPlayer->look_ang >> 1), weaponY + 261 - weaponYOffset, + G_DrawWeaponTileWithID(currentWeapon << 1, weaponX + 210 - (fix16_to_int(pPlayer->q16look_ang) >> 1), weaponY + 261 - weaponYOffset, FREEZE + 2, -32, weaponBits, weaponPal); - G_DrawWeaponTileWithID(currentWeapon, weaponX + 210 - (pPlayer->look_ang >> 1), weaponY + 235 - weaponYOffset, + G_DrawWeaponTileWithID(currentWeapon, weaponX + 210 - (fix16_to_int(pPlayer->q16look_ang) >> 1), weaponY + 235 - weaponYOffset, FREEZE + 3 + freezerFrames[*weaponFrame % 6], -32, weaponBits, weaponPal); } else - G_DrawWeaponTileWithID(currentWeapon, weaponX + 210 - (pPlayer->look_ang >> 1), weaponY + 261 - weaponYOffset, + G_DrawWeaponTileWithID(currentWeapon, weaponX + 210 - (fix16_to_int(pPlayer->q16look_ang) >> 1), weaponY + 261 - weaponYOffset, FREEZE, weaponShade, weaponBits, weaponPal); break; @@ -6820,7 +6820,7 @@ void P_UpdatePosWhenViewingCam(DukePlayer_t *pPlayer) pPlayer->vel.x = 0; pPlayer->vel.y = 0; sprite[pPlayer->i].xvel = 0; - pPlayer->look_ang = 0; + pPlayer->q16look_ang = 0; pPlayer->q16rotscrnang = 0; } @@ -7821,17 +7821,17 @@ check_enemy_sprite: 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); + pPlayer->q16look_ang = fix16_ssub(pPlayer->q16look_ang, fix16_sdiv(pPlayer->q16look_ang, fix16_from_int(4))); - if (pPlayer->look_ang && !(pPlayer->look_ang >> 2)) - pPlayer->look_ang -= ksgn(pPlayer->look_ang); + if (pPlayer->q16look_ang && !fix16_sdiv(pPlayer->q16look_ang, fix16_from_int(4))) + pPlayer->q16look_ang = fix16_ssub(pPlayer->q16look_ang, fix16_from_int(ksgn(fix16_to_int(pPlayer->q16look_ang)))); if (TEST_SYNC_KEY(playerBits, SK_LOOK_LEFT) && (!RRRA || !pPlayer->on_motorcycle)) { // look_left if (VM_OnEvent(EVENT_LOOKLEFT,pPlayer->i,playerNum) == 0) { - pPlayer->look_ang -= 152; + pPlayer->q16look_ang = fix16_ssub(pPlayer->q16look_ang, fix16_from_int(152)); pPlayer->q16rotscrnang = fix16_sadd(pPlayer->q16rotscrnang, fix16_from_int(24)); } } @@ -7841,7 +7841,7 @@ check_enemy_sprite: // look_right if (VM_OnEvent(EVENT_LOOKRIGHT,pPlayer->i,playerNum) == 0) { - pPlayer->look_ang += 152; + pPlayer->q16look_ang = fix16_sadd(pPlayer->q16look_ang, fix16_from_int(152)); pPlayer->q16rotscrnang = fix16_ssub(pPlayer->q16rotscrnang, fix16_from_int(24)); } } @@ -7860,7 +7860,7 @@ check_enemy_sprite: pPlayer->q16rotscrnang = fix16_sadd(pPlayer->q16rotscrnang, fix16_from_int(24)); } if (pPlayer->sea_sick < 250) - pPlayer->look_ang += (krand2()&255)-128; + pPlayer->q16look_ang = fix16_sadd(pPlayer->q16look_ang, fix16_from_int((krand2()&255)-128)); } int velocityModifier = TICSPERFRAME; @@ -9076,22 +9076,22 @@ void P_DHProcessInput(int playerNum) 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); + pPlayer->q16look_ang = fix16_ssub(pPlayer->q16look_ang, fix16_sdiv(pPlayer->q16look_ang, fix16_from_int(4))); - if (pPlayer->look_ang && !(pPlayer->look_ang >> 2)) - pPlayer->look_ang -= ksgn(pPlayer->look_ang); + if (pPlayer->q16look_ang && !fix16_sdiv(pPlayer->q16look_ang, fix16_from_int(4))) + pPlayer->q16look_ang = fix16_ssub(pPlayer->q16look_ang, fix16_from_int(ksgn(fix16_to_int(pPlayer->q16look_ang)))); if (TEST_SYNC_KEY(playerBits, SK_LOOK_LEFT) && !pPlayer->on_motorcycle) { // look_left - pPlayer->look_ang -= 152; + pPlayer->q16look_ang = fix16_ssub(pPlayer->q16look_ang, fix16_from_int(152)); 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->q16look_ang = fix16_sadd(pPlayer->q16look_ang, fix16_from_int(152)); pPlayer->q16rotscrnang = fix16_ssub(pPlayer->q16rotscrnang, fix16_from_int(24)); } diff --git a/source/rr/src/player.h b/source/rr/src/player.h index 3528396d4..fa65df9e4 100644 --- a/source/rr/src/player.h +++ b/source/rr/src/player.h @@ -152,9 +152,10 @@ typedef struct { int16_t loogiex[64], loogiey[64], sbs, sound_pitch; - int16_t cursectnum, look_ang, last_extra, subweapon; + int16_t cursectnum, last_extra, subweapon; int16_t max_ammo_amount[MAX_WEAPONS], ammo_amount[MAX_WEAPONS], inv_amount[GET_MAX]; int16_t wackedbyactor, pyoff, opyoff; + fix16_t q16look_ang; int16_t newowner, jumping_counter, airleft; int16_t fta, ftq, access_wallnum, access_spritenum; @@ -226,7 +227,7 @@ typedef struct { int32_t dhat60f, dhat613, dhat617, dhat61b, dhat61f; int8_t crouch_toggle; - int8_t padding_[1]; + int8_t padding_[7]; } DukePlayer_t; // KEEPINSYNC lunatic/_defs_game.lua diff --git a/source/rr/src/premap.cpp b/source/rr/src/premap.cpp index 9899d7801..249d44cf5 100644 --- a/source/rr/src/premap.cpp +++ b/source/rr/src/premap.cpp @@ -908,7 +908,7 @@ void P_ResetStatus(int playerNum) pPlayer->heat_on = 0; pPlayer->jetpack_on = 0; pPlayer->holoduke_on = -1; - pPlayer->look_ang = 512 - ((ud.level_number & 1) << 10); + pPlayer->q16look_ang = fix16_from_int(512 - ((ud.level_number & 1) << 10)); pPlayer->q16rotscrnang = 0; pPlayer->oq16rotscrnang = fix16_one; // JBF 20031220 pPlayer->newowner = -1; diff --git a/source/rr/src/screens.cpp b/source/rr/src/screens.cpp index b6ec763dc..cb214db89 100644 --- a/source/rr/src/screens.cpp +++ b/source/rr/src/screens.cpp @@ -841,12 +841,12 @@ void G_DisplayRest(int32_t smoothratio) if (!DEER && g_player[myconnectindex].ps->newowner == -1 && ud.overhead_on == 0 && cl_crosshair && ud.camerasprite == -1) { int32_t a = CROSSHAIR; - //ud.returnvar[0] = (160<<16) - (g_player[myconnectindex].ps->look_ang<<15); + //ud.returnvar[0] = (160<<16) - (fix16_to_int(g_player[myconnectindex].ps->q16look_ang)<<15); //ud.returnvar[1] = 100<<16; //int32_t a = VM_OnEventWithReturn(EVENT_DISPLAYCROSSHAIR, g_player[screenpeek].ps->i, screenpeek, CROSSHAIR); if ((unsigned) a < MAXTILES) { - vec2_t crosshairpos = { (160<<16) - (g_player[myconnectindex].ps->look_ang<<15), 100<<16 }; + vec2_t crosshairpos = { (160<<16) - (fix16_to_int(g_player[myconnectindex].ps->q16look_ang)<<15), 100<<16 }; //vec2_t crosshairpos = { ud.returnvar[0], ud.returnvar[1] }; uint32_t crosshair_o = 1|2; uint32_t crosshair_scale = divscale16(cl_crosshairscale, 100);