mirror of
https://github.com/ZDoom/raze-gles.git
synced 2024-12-27 20:20:40 +00:00
- Exhumed: Cut q16ang
/q16look_ang
/q16rotscrnang
over to PlayerAngle struct.
This commit is contained in:
parent
bd68f67460
commit
3bc6777cf4
8 changed files with 29 additions and 47 deletions
|
@ -89,7 +89,7 @@ void GameInterface::Render()
|
|||
}
|
||||
|
||||
double const smoothratio = calc_smoothratio();
|
||||
double const look_anghalf = getHalfLookAng(PlayerList[nLocalPlayer].oq16look_ang, PlayerList[nLocalPlayer].q16look_ang, cl_syncinput, smoothratio);
|
||||
double const look_anghalf = getHalfLookAng(PlayerList[nLocalPlayer].angle.olook_ang.asq16(), PlayerList[nLocalPlayer].angle.look_ang.asq16(), cl_syncinput, smoothratio);
|
||||
|
||||
DrawView(smoothratio);
|
||||
DrawStatusBar();
|
||||
|
|
|
@ -985,7 +985,7 @@ void DrawWeapons(double smooth)
|
|||
nShade = sprite[PlayerList[nLocalPlayer].nSprite].shade;
|
||||
}
|
||||
|
||||
double const look_anghalf = getHalfLookAng(PlayerList[nLocalPlayer].oq16look_ang, PlayerList[nLocalPlayer].q16look_ang, cl_syncinput, smooth);
|
||||
double const look_anghalf = getHalfLookAng(PlayerList[nLocalPlayer].angle.olook_ang.asq16(), PlayerList[nLocalPlayer].angle.look_ang.asq16(), cl_syncinput, smooth);
|
||||
double const looking_arc = fabs(look_anghalf) / 4.5;
|
||||
|
||||
xOffset -= look_anghalf;
|
||||
|
|
|
@ -128,11 +128,11 @@ void GameInterface::GetInput(InputPacket* packet, ControlInfo* const hidInput)
|
|||
|
||||
if (!nFreeze)
|
||||
{
|
||||
applylook2(&pPlayer->q16angle, &pPlayer->q16look_ang, &pPlayer->q16rotscrnang, &pPlayer->spin, input.q16avel, &sPlayerInput[nLocalPlayer].actions, scaleAdjust, eyelevel[nLocalPlayer] > -14080);
|
||||
applylook(&pPlayer->angle, input.q16avel, &sPlayerInput[nLocalPlayer].actions, scaleAdjust, eyelevel[nLocalPlayer] > -14080);
|
||||
sethorizon(&pPlayer->horizon.horiz, input.horz, &sPlayerInput[nLocalPlayer].actions, scaleAdjust);
|
||||
}
|
||||
|
||||
playerProcessHelpers(&pPlayer->q16angle, &pPlayer->angAdjust, &pPlayer->angTarget, scaleAdjust);
|
||||
pPlayer->angle.processhelpers(scaleAdjust);
|
||||
pPlayer->horizon.processhelpers(scaleAdjust);
|
||||
UpdatePlayerSpriteAngle(pPlayer);
|
||||
}
|
||||
|
|
|
@ -50,7 +50,7 @@ static int osdcmd_warptocoords(CCmdFuncPtr parm)
|
|||
|
||||
if (parm->numparms >= 4)
|
||||
{
|
||||
nPlayer->oq16angle = nPlayer->q16angle = IntToFixed(atoi(parm->parms[3]));
|
||||
nPlayer->angle.oang = nPlayer->angle.ang = buildang(atoi(parm->parms[3]));
|
||||
}
|
||||
|
||||
if (parm->numparms == 5)
|
||||
|
|
|
@ -309,8 +309,8 @@ void RestartPlayer(short nPlayer)
|
|||
sprite[nSprite].y = sprite[nNStartSprite].y;
|
||||
sprite[nSprite].z = sprite[nNStartSprite].z;
|
||||
mychangespritesect(nSprite, sprite[nNStartSprite].sectnum);
|
||||
PlayerList[nPlayer].q16angle = IntToFixed(sprite[nNStartSprite].ang&kAngleMask);
|
||||
sprite[nSprite].ang = FixedToInt(PlayerList[nPlayer].q16angle);
|
||||
PlayerList[nPlayer].angle.ang = buildang(sprite[nNStartSprite].ang&kAngleMask);
|
||||
sprite[nSprite].ang = PlayerList[nPlayer].angle.ang.asbuild();
|
||||
|
||||
floorspr = insertsprite(sprite[nSprite].sectnum, 0);
|
||||
assert(floorspr >= 0 && floorspr < kMaxSprites);
|
||||
|
@ -328,16 +328,14 @@ void RestartPlayer(short nPlayer)
|
|||
sprite[nSprite].x = sPlayerSave[nPlayer].x;
|
||||
sprite[nSprite].y = sPlayerSave[nPlayer].y;
|
||||
sprite[nSprite].z = sector[sPlayerSave[nPlayer].nSector].floorz;
|
||||
PlayerList[nPlayer].q16angle = IntToFixed(sPlayerSave[nPlayer].nAngle&kAngleMask);
|
||||
sprite[nSprite].ang = FixedToInt(PlayerList[nPlayer].q16angle);
|
||||
PlayerList[nPlayer].angle.ang = buildang(sPlayerSave[nPlayer].nAngle&kAngleMask);
|
||||
sprite[nSprite].ang = PlayerList[nPlayer].angle.ang.asbuild();
|
||||
|
||||
floorspr = -1;
|
||||
}
|
||||
|
||||
PlayerList[nPlayer].opos = sprite[nSprite].pos;
|
||||
PlayerList[nPlayer].oq16angle = PlayerList[nPlayer].q16angle;
|
||||
PlayerList[nPlayer].oq16look_ang = PlayerList[nPlayer].q16look_ang = 0;
|
||||
PlayerList[nPlayer].oq16rotscrnang = PlayerList[nPlayer].q16rotscrnang = 0;
|
||||
PlayerList[nPlayer].angle.backup();
|
||||
PlayerList[nPlayer].horizon.backup();
|
||||
|
||||
nPlayerFloorSprite[nPlayer] = floorspr;
|
||||
|
@ -702,7 +700,7 @@ static void pickupMessage(int no)
|
|||
|
||||
void UpdatePlayerSpriteAngle(Player* pPlayer)
|
||||
{
|
||||
sprite[pPlayer->nSprite].ang = FixedToInt(pPlayer->q16angle);
|
||||
sprite[pPlayer->nSprite].ang = pPlayer->angle.ang.asbuild();
|
||||
}
|
||||
|
||||
void FuncPlayer(int a, int nDamage, int nRun)
|
||||
|
@ -725,12 +723,10 @@ void FuncPlayer(int a, int nDamage, int nRun)
|
|||
|
||||
short nSprite2;
|
||||
|
||||
PlayerList[nPlayer].angAdjust = 0;
|
||||
PlayerList[nPlayer].opos = sprite[nPlayerSprite].pos;
|
||||
PlayerList[nPlayer].oq16angle = PlayerList[nPlayer].q16angle;
|
||||
PlayerList[nPlayer].oq16look_ang = PlayerList[nPlayer].q16look_ang;
|
||||
PlayerList[nPlayer].oq16rotscrnang = PlayerList[nPlayer].q16rotscrnang;
|
||||
PlayerList[nPlayer].angle.backup();
|
||||
PlayerList[nPlayer].horizon.backup();
|
||||
PlayerList[nPlayer].angle.resetadjustment();
|
||||
PlayerList[nPlayer].horizon.resetadjustment();
|
||||
oeyelevel[nPlayer] = eyelevel[nPlayer];
|
||||
|
||||
|
@ -948,7 +944,7 @@ void FuncPlayer(int a, int nDamage, int nRun)
|
|||
if (cl_syncinput)
|
||||
{
|
||||
Player* pPlayer = &PlayerList[nPlayer];
|
||||
applylook2(&pPlayer->q16angle, &pPlayer->q16look_ang, &pPlayer->q16rotscrnang, &pPlayer->spin, sPlayerInput[nPlayer].nAngle, &sPlayerInput[nLocalPlayer].actions, 1, eyelevel[nLocalPlayer] > -14080);
|
||||
applylook(&pPlayer->angle, sPlayerInput[nPlayer].nAngle, &sPlayerInput[nLocalPlayer].actions, 1, eyelevel[nLocalPlayer] > -14080);
|
||||
UpdatePlayerSpriteAngle(pPlayer);
|
||||
}
|
||||
|
||||
|
@ -1046,8 +1042,7 @@ void FuncPlayer(int a, int nDamage, int nRun)
|
|||
if (nTotalPlayers <= 1)
|
||||
{
|
||||
auto ang = GetAngleToSprite(nPlayerSprite, nSpiritSprite) & kAngleMask;
|
||||
playerSetAngle2(&PlayerList[nPlayer].q16angle, &PlayerList[nPlayer].angTarget, ang);
|
||||
PlayerList[nPlayer].oq16angle = PlayerList[nPlayer].q16angle;
|
||||
PlayerList[nPlayer].angle.settarget(ang, true);
|
||||
sprite[nPlayerSprite].ang = ang;
|
||||
|
||||
PlayerList[nPlayer].horizon.settarget(0, true);
|
||||
|
|
|
@ -71,12 +71,7 @@ struct Player
|
|||
short nRun;
|
||||
|
||||
PlayerHorizon horizon;
|
||||
fixed_t oq16angle, q16angle;
|
||||
fixed_t oq16look_ang, q16look_ang;
|
||||
fixed_t oq16rotscrnang, q16rotscrnang;
|
||||
fixed_t spin;
|
||||
fixed_t angTarget;
|
||||
double angAdjust;
|
||||
PlayerAngle angle;
|
||||
vec3_t opos;
|
||||
};
|
||||
|
||||
|
|
|
@ -376,7 +376,7 @@ void seq_DrawPilotLightSeq(double xOffset, double yOffset)
|
|||
double x = ChunkXpos[nFrameBase] + (160 + xOffset);
|
||||
double y = ChunkYpos[nFrameBase] + (100 + yOffset);
|
||||
|
||||
hud_drawsprite(x, y, 65536, fmod(-2 * FixedToFloat(PlayerList[nLocalPlayer].q16angle), kAngleMask + 1), nTile, 0, 0, 1);
|
||||
hud_drawsprite(x, y, 65536, fmod(-2 * (PlayerList[nLocalPlayer].angle.ang.asbam() / (double)BAMUNIT), kAngleMask + 1), nTile, 0, 0, 1);
|
||||
nFrameBase++;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -48,7 +48,7 @@ short nQuake[kMaxPlayers] = { 0 };
|
|||
|
||||
short nChunkTotal = 0;
|
||||
|
||||
fixed_t nCameraa;
|
||||
binangle nCameraa;
|
||||
fixedhoriz nCamerapan;
|
||||
short nViewTop;
|
||||
bool bCamera = false;
|
||||
|
@ -235,9 +235,9 @@ void DrawView(double smoothRatio, bool sceneonly)
|
|||
int playerY;
|
||||
int playerZ;
|
||||
short nSector;
|
||||
fixed_t nAngle;
|
||||
binangle nAngle;
|
||||
fixedhoriz pan;
|
||||
fixed_t q16rotscrnang;
|
||||
lookangle rotscrnang;
|
||||
|
||||
fixed_t dang = IntToFixed(1024);
|
||||
|
||||
|
@ -255,7 +255,7 @@ void DrawView(double smoothRatio, bool sceneonly)
|
|||
playerY = sprite[nSprite].y;
|
||||
playerZ = sprite[nSprite].z;
|
||||
nSector = sprite[nSprite].sectnum;
|
||||
nAngle = IntToFixed(sprite[nSprite].ang);
|
||||
nAngle = buildang(sprite[nSprite].ang);
|
||||
|
||||
SetGreenPal();
|
||||
|
||||
|
@ -282,20 +282,13 @@ void DrawView(double smoothRatio, bool sceneonly)
|
|||
|
||||
if (!cl_syncinput)
|
||||
{
|
||||
nAngle = PlayerList[nLocalPlayer].q16angle + PlayerList[nLocalPlayer].q16look_ang;
|
||||
q16rotscrnang = PlayerList[nLocalPlayer].q16rotscrnang;
|
||||
nAngle = PlayerList[nLocalPlayer].angle.sum();
|
||||
rotscrnang = PlayerList[nLocalPlayer].angle.rotscrnang;
|
||||
}
|
||||
else
|
||||
{
|
||||
fixed_t oang, ang;
|
||||
|
||||
oang = PlayerList[nLocalPlayer].oq16angle + PlayerList[nLocalPlayer].oq16look_ang;
|
||||
ang = PlayerList[nLocalPlayer].q16angle + PlayerList[nLocalPlayer].q16look_ang;
|
||||
nAngle = oang + xs_CRoundToInt(fmulscale16(((ang + dang - oang) & 0x7FFFFFF) - dang, smoothRatio));
|
||||
|
||||
oang = PlayerList[nLocalPlayer].oq16rotscrnang + PlayerList[nLocalPlayer].oq16rotscrnang;
|
||||
ang = PlayerList[nLocalPlayer].q16rotscrnang + PlayerList[nLocalPlayer].q16rotscrnang;
|
||||
q16rotscrnang = oang + xs_CRoundToInt(fmulscale16(((ang + dang - oang) & 0x7FFFFFF) - dang, smoothRatio));
|
||||
nAngle = PlayerList[nLocalPlayer].angle.interpolatedsum(smoothRatio);
|
||||
rotscrnang = PlayerList[nLocalPlayer].angle.interpolatedrotscrn(smoothRatio);
|
||||
}
|
||||
|
||||
if (!bCamera)
|
||||
|
@ -304,7 +297,7 @@ void DrawView(double smoothRatio, bool sceneonly)
|
|||
sprite[nDoppleSprite[nLocalPlayer]].cstat |= CSTAT_SPRITE_INVISIBLE;
|
||||
}
|
||||
|
||||
renderSetRollAngle(FixedToFloat(q16rotscrnang));
|
||||
renderSetRollAngle(rotscrnang.asbam() / (double)BAMUNIT);
|
||||
}
|
||||
|
||||
nCameraa = nAngle;
|
||||
|
@ -333,8 +326,7 @@ void DrawView(double smoothRatio, bool sceneonly)
|
|||
if (viewz > floorZ)
|
||||
viewz = floorZ;
|
||||
|
||||
nCameraa += IntToFixed((nQuake[nLocalPlayer] >> 7) % 31);
|
||||
nCameraa &= 0x7FFFFFF;
|
||||
nCameraa += buildang((nQuake[nLocalPlayer] >> 7) % 31);
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -404,7 +396,7 @@ void DrawView(double smoothRatio, bool sceneonly)
|
|||
}
|
||||
}
|
||||
|
||||
renderDrawRoomsQ16(nCamerax, nCameray, viewz, nCameraa, nCamerapan.asq16(), nSector);
|
||||
renderDrawRoomsQ16(nCamerax, nCameray, viewz, nCameraa.asq16(), nCamerapan.asq16(), nSector);
|
||||
analyzesprites();
|
||||
renderDrawMasks();
|
||||
|
||||
|
@ -436,7 +428,7 @@ void DrawView(double smoothRatio, bool sceneonly)
|
|||
|
||||
sprite[nPlayerSprite].cstat |= 0x8000;
|
||||
|
||||
int ang2 = FixedToInt(nCameraa) - sprite[nPlayerSprite].ang;
|
||||
int ang2 = nCameraa.asbuild() - sprite[nPlayerSprite].ang;
|
||||
if (ang2 < 0)
|
||||
ang2 = -ang2;
|
||||
|
||||
|
|
Loading…
Reference in a new issue