mirror of
https://github.com/ZDoom/raze-gles.git
synced 2024-12-29 04:50:42 +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 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);
|
DrawView(smoothratio);
|
||||||
DrawStatusBar();
|
DrawStatusBar();
|
||||||
|
|
|
@ -985,7 +985,7 @@ void DrawWeapons(double smooth)
|
||||||
nShade = sprite[PlayerList[nLocalPlayer].nSprite].shade;
|
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;
|
double const looking_arc = fabs(look_anghalf) / 4.5;
|
||||||
|
|
||||||
xOffset -= look_anghalf;
|
xOffset -= look_anghalf;
|
||||||
|
|
|
@ -128,11 +128,11 @@ void GameInterface::GetInput(InputPacket* packet, ControlInfo* const hidInput)
|
||||||
|
|
||||||
if (!nFreeze)
|
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);
|
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);
|
pPlayer->horizon.processhelpers(scaleAdjust);
|
||||||
UpdatePlayerSpriteAngle(pPlayer);
|
UpdatePlayerSpriteAngle(pPlayer);
|
||||||
}
|
}
|
||||||
|
|
|
@ -50,7 +50,7 @@ static int osdcmd_warptocoords(CCmdFuncPtr parm)
|
||||||
|
|
||||||
if (parm->numparms >= 4)
|
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)
|
if (parm->numparms == 5)
|
||||||
|
|
|
@ -309,8 +309,8 @@ void RestartPlayer(short nPlayer)
|
||||||
sprite[nSprite].y = sprite[nNStartSprite].y;
|
sprite[nSprite].y = sprite[nNStartSprite].y;
|
||||||
sprite[nSprite].z = sprite[nNStartSprite].z;
|
sprite[nSprite].z = sprite[nNStartSprite].z;
|
||||||
mychangespritesect(nSprite, sprite[nNStartSprite].sectnum);
|
mychangespritesect(nSprite, sprite[nNStartSprite].sectnum);
|
||||||
PlayerList[nPlayer].q16angle = IntToFixed(sprite[nNStartSprite].ang&kAngleMask);
|
PlayerList[nPlayer].angle.ang = buildang(sprite[nNStartSprite].ang&kAngleMask);
|
||||||
sprite[nSprite].ang = FixedToInt(PlayerList[nPlayer].q16angle);
|
sprite[nSprite].ang = PlayerList[nPlayer].angle.ang.asbuild();
|
||||||
|
|
||||||
floorspr = insertsprite(sprite[nSprite].sectnum, 0);
|
floorspr = insertsprite(sprite[nSprite].sectnum, 0);
|
||||||
assert(floorspr >= 0 && floorspr < kMaxSprites);
|
assert(floorspr >= 0 && floorspr < kMaxSprites);
|
||||||
|
@ -328,16 +328,14 @@ void RestartPlayer(short nPlayer)
|
||||||
sprite[nSprite].x = sPlayerSave[nPlayer].x;
|
sprite[nSprite].x = sPlayerSave[nPlayer].x;
|
||||||
sprite[nSprite].y = sPlayerSave[nPlayer].y;
|
sprite[nSprite].y = sPlayerSave[nPlayer].y;
|
||||||
sprite[nSprite].z = sector[sPlayerSave[nPlayer].nSector].floorz;
|
sprite[nSprite].z = sector[sPlayerSave[nPlayer].nSector].floorz;
|
||||||
PlayerList[nPlayer].q16angle = IntToFixed(sPlayerSave[nPlayer].nAngle&kAngleMask);
|
PlayerList[nPlayer].angle.ang = buildang(sPlayerSave[nPlayer].nAngle&kAngleMask);
|
||||||
sprite[nSprite].ang = FixedToInt(PlayerList[nPlayer].q16angle);
|
sprite[nSprite].ang = PlayerList[nPlayer].angle.ang.asbuild();
|
||||||
|
|
||||||
floorspr = -1;
|
floorspr = -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
PlayerList[nPlayer].opos = sprite[nSprite].pos;
|
PlayerList[nPlayer].opos = sprite[nSprite].pos;
|
||||||
PlayerList[nPlayer].oq16angle = PlayerList[nPlayer].q16angle;
|
PlayerList[nPlayer].angle.backup();
|
||||||
PlayerList[nPlayer].oq16look_ang = PlayerList[nPlayer].q16look_ang = 0;
|
|
||||||
PlayerList[nPlayer].oq16rotscrnang = PlayerList[nPlayer].q16rotscrnang = 0;
|
|
||||||
PlayerList[nPlayer].horizon.backup();
|
PlayerList[nPlayer].horizon.backup();
|
||||||
|
|
||||||
nPlayerFloorSprite[nPlayer] = floorspr;
|
nPlayerFloorSprite[nPlayer] = floorspr;
|
||||||
|
@ -702,7 +700,7 @@ static void pickupMessage(int no)
|
||||||
|
|
||||||
void UpdatePlayerSpriteAngle(Player* pPlayer)
|
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)
|
void FuncPlayer(int a, int nDamage, int nRun)
|
||||||
|
@ -725,12 +723,10 @@ void FuncPlayer(int a, int nDamage, int nRun)
|
||||||
|
|
||||||
short nSprite2;
|
short nSprite2;
|
||||||
|
|
||||||
PlayerList[nPlayer].angAdjust = 0;
|
|
||||||
PlayerList[nPlayer].opos = sprite[nPlayerSprite].pos;
|
PlayerList[nPlayer].opos = sprite[nPlayerSprite].pos;
|
||||||
PlayerList[nPlayer].oq16angle = PlayerList[nPlayer].q16angle;
|
PlayerList[nPlayer].angle.backup();
|
||||||
PlayerList[nPlayer].oq16look_ang = PlayerList[nPlayer].q16look_ang;
|
|
||||||
PlayerList[nPlayer].oq16rotscrnang = PlayerList[nPlayer].q16rotscrnang;
|
|
||||||
PlayerList[nPlayer].horizon.backup();
|
PlayerList[nPlayer].horizon.backup();
|
||||||
|
PlayerList[nPlayer].angle.resetadjustment();
|
||||||
PlayerList[nPlayer].horizon.resetadjustment();
|
PlayerList[nPlayer].horizon.resetadjustment();
|
||||||
oeyelevel[nPlayer] = eyelevel[nPlayer];
|
oeyelevel[nPlayer] = eyelevel[nPlayer];
|
||||||
|
|
||||||
|
@ -948,7 +944,7 @@ void FuncPlayer(int a, int nDamage, int nRun)
|
||||||
if (cl_syncinput)
|
if (cl_syncinput)
|
||||||
{
|
{
|
||||||
Player* pPlayer = &PlayerList[nPlayer];
|
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);
|
UpdatePlayerSpriteAngle(pPlayer);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1046,8 +1042,7 @@ void FuncPlayer(int a, int nDamage, int nRun)
|
||||||
if (nTotalPlayers <= 1)
|
if (nTotalPlayers <= 1)
|
||||||
{
|
{
|
||||||
auto ang = GetAngleToSprite(nPlayerSprite, nSpiritSprite) & kAngleMask;
|
auto ang = GetAngleToSprite(nPlayerSprite, nSpiritSprite) & kAngleMask;
|
||||||
playerSetAngle2(&PlayerList[nPlayer].q16angle, &PlayerList[nPlayer].angTarget, ang);
|
PlayerList[nPlayer].angle.settarget(ang, true);
|
||||||
PlayerList[nPlayer].oq16angle = PlayerList[nPlayer].q16angle;
|
|
||||||
sprite[nPlayerSprite].ang = ang;
|
sprite[nPlayerSprite].ang = ang;
|
||||||
|
|
||||||
PlayerList[nPlayer].horizon.settarget(0, true);
|
PlayerList[nPlayer].horizon.settarget(0, true);
|
||||||
|
|
|
@ -71,12 +71,7 @@ struct Player
|
||||||
short nRun;
|
short nRun;
|
||||||
|
|
||||||
PlayerHorizon horizon;
|
PlayerHorizon horizon;
|
||||||
fixed_t oq16angle, q16angle;
|
PlayerAngle angle;
|
||||||
fixed_t oq16look_ang, q16look_ang;
|
|
||||||
fixed_t oq16rotscrnang, q16rotscrnang;
|
|
||||||
fixed_t spin;
|
|
||||||
fixed_t angTarget;
|
|
||||||
double angAdjust;
|
|
||||||
vec3_t opos;
|
vec3_t opos;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -376,7 +376,7 @@ void seq_DrawPilotLightSeq(double xOffset, double yOffset)
|
||||||
double x = ChunkXpos[nFrameBase] + (160 + xOffset);
|
double x = ChunkXpos[nFrameBase] + (160 + xOffset);
|
||||||
double y = ChunkYpos[nFrameBase] + (100 + yOffset);
|
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++;
|
nFrameBase++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -48,7 +48,7 @@ short nQuake[kMaxPlayers] = { 0 };
|
||||||
|
|
||||||
short nChunkTotal = 0;
|
short nChunkTotal = 0;
|
||||||
|
|
||||||
fixed_t nCameraa;
|
binangle nCameraa;
|
||||||
fixedhoriz nCamerapan;
|
fixedhoriz nCamerapan;
|
||||||
short nViewTop;
|
short nViewTop;
|
||||||
bool bCamera = false;
|
bool bCamera = false;
|
||||||
|
@ -235,9 +235,9 @@ void DrawView(double smoothRatio, bool sceneonly)
|
||||||
int playerY;
|
int playerY;
|
||||||
int playerZ;
|
int playerZ;
|
||||||
short nSector;
|
short nSector;
|
||||||
fixed_t nAngle;
|
binangle nAngle;
|
||||||
fixedhoriz pan;
|
fixedhoriz pan;
|
||||||
fixed_t q16rotscrnang;
|
lookangle rotscrnang;
|
||||||
|
|
||||||
fixed_t dang = IntToFixed(1024);
|
fixed_t dang = IntToFixed(1024);
|
||||||
|
|
||||||
|
@ -255,7 +255,7 @@ void DrawView(double smoothRatio, bool sceneonly)
|
||||||
playerY = sprite[nSprite].y;
|
playerY = sprite[nSprite].y;
|
||||||
playerZ = sprite[nSprite].z;
|
playerZ = sprite[nSprite].z;
|
||||||
nSector = sprite[nSprite].sectnum;
|
nSector = sprite[nSprite].sectnum;
|
||||||
nAngle = IntToFixed(sprite[nSprite].ang);
|
nAngle = buildang(sprite[nSprite].ang);
|
||||||
|
|
||||||
SetGreenPal();
|
SetGreenPal();
|
||||||
|
|
||||||
|
@ -282,20 +282,13 @@ void DrawView(double smoothRatio, bool sceneonly)
|
||||||
|
|
||||||
if (!cl_syncinput)
|
if (!cl_syncinput)
|
||||||
{
|
{
|
||||||
nAngle = PlayerList[nLocalPlayer].q16angle + PlayerList[nLocalPlayer].q16look_ang;
|
nAngle = PlayerList[nLocalPlayer].angle.sum();
|
||||||
q16rotscrnang = PlayerList[nLocalPlayer].q16rotscrnang;
|
rotscrnang = PlayerList[nLocalPlayer].angle.rotscrnang;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
fixed_t oang, ang;
|
nAngle = PlayerList[nLocalPlayer].angle.interpolatedsum(smoothRatio);
|
||||||
|
rotscrnang = PlayerList[nLocalPlayer].angle.interpolatedrotscrn(smoothRatio);
|
||||||
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));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!bCamera)
|
if (!bCamera)
|
||||||
|
@ -304,7 +297,7 @@ void DrawView(double smoothRatio, bool sceneonly)
|
||||||
sprite[nDoppleSprite[nLocalPlayer]].cstat |= CSTAT_SPRITE_INVISIBLE;
|
sprite[nDoppleSprite[nLocalPlayer]].cstat |= CSTAT_SPRITE_INVISIBLE;
|
||||||
}
|
}
|
||||||
|
|
||||||
renderSetRollAngle(FixedToFloat(q16rotscrnang));
|
renderSetRollAngle(rotscrnang.asbam() / (double)BAMUNIT);
|
||||||
}
|
}
|
||||||
|
|
||||||
nCameraa = nAngle;
|
nCameraa = nAngle;
|
||||||
|
@ -333,8 +326,7 @@ void DrawView(double smoothRatio, bool sceneonly)
|
||||||
if (viewz > floorZ)
|
if (viewz > floorZ)
|
||||||
viewz = floorZ;
|
viewz = floorZ;
|
||||||
|
|
||||||
nCameraa += IntToFixed((nQuake[nLocalPlayer] >> 7) % 31);
|
nCameraa += buildang((nQuake[nLocalPlayer] >> 7) % 31);
|
||||||
nCameraa &= 0x7FFFFFF;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
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();
|
analyzesprites();
|
||||||
renderDrawMasks();
|
renderDrawMasks();
|
||||||
|
|
||||||
|
@ -436,7 +428,7 @@ void DrawView(double smoothRatio, bool sceneonly)
|
||||||
|
|
||||||
sprite[nPlayerSprite].cstat |= 0x8000;
|
sprite[nPlayerSprite].cstat |= 0x8000;
|
||||||
|
|
||||||
int ang2 = FixedToInt(nCameraa) - sprite[nPlayerSprite].ang;
|
int ang2 = nCameraa.asbuild() - sprite[nPlayerSprite].ang;
|
||||||
if (ang2 < 0)
|
if (ang2 < 0)
|
||||||
ang2 = -ang2;
|
ang2 = -ang2;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue