mirror of
https://github.com/ZDoom/raze-gles.git
synced 2024-11-10 23:02:03 +00:00
Exhumed: Fix look up/down in line with input amendments.
This commit is contained in:
parent
2ddc442e48
commit
b801a73db9
5 changed files with 31 additions and 60 deletions
|
@ -2227,7 +2227,7 @@ GAMELOOP:
|
||||||
lLocalCodes = 0;
|
lLocalCodes = 0;
|
||||||
nPlayerDAng = 0;
|
nPlayerDAng = 0;
|
||||||
|
|
||||||
sPlayerInput[nLocalPlayer].horizon = nVertPan[nLocalPlayer];
|
sPlayerInput[nLocalPlayer].horizon = PlayerList[nLocalPlayer].q16horiz;
|
||||||
}
|
}
|
||||||
|
|
||||||
// loc_11F72:
|
// loc_11F72:
|
||||||
|
@ -2334,7 +2334,7 @@ GAMELOOP:
|
||||||
lLocalCodes = 0;
|
lLocalCodes = 0;
|
||||||
nPlayerDAng = 0;
|
nPlayerDAng = 0;
|
||||||
|
|
||||||
sPlayerInput[nLocalPlayer].horizon = nVertPan[nLocalPlayer];
|
sPlayerInput[nLocalPlayer].horizon = PlayerList[nLocalPlayer].q16horiz;
|
||||||
|
|
||||||
while (levelnew < 0 && totalclock >= tclocks + 4)
|
while (levelnew < 0 && totalclock >= tclocks + 4)
|
||||||
{
|
{
|
||||||
|
@ -2882,7 +2882,7 @@ int DoSpiritHead()
|
||||||
{
|
{
|
||||||
static short word_964E6 = 0;
|
static short word_964E6 = 0;
|
||||||
|
|
||||||
nVertPan[0] += (nDestVertPan[0] - nVertPan[0]) / 4;
|
PlayerList[0].q16horiz = fix16_sadd(PlayerList[0].q16horiz, fix16_sdiv(fix16_ssub(nDestVertPan[0], PlayerList[0].q16horiz), fix16_from_int(4)));
|
||||||
|
|
||||||
tileInvalidate(kTileRamsesWorkTile, -1, -1);
|
tileInvalidate(kTileRamsesWorkTile, -1, -1);
|
||||||
|
|
||||||
|
|
|
@ -276,66 +276,44 @@ void PlayerInterruptKeys()
|
||||||
|
|
||||||
localInput.yVel = clamp(localInput.yVel + input.yVel, -12, 12);
|
localInput.yVel = clamp(localInput.yVel + input.yVel, -12, 12);
|
||||||
localInput.xVel = clamp(localInput.xVel + input.xVel, -12, 12);
|
localInput.xVel = clamp(localInput.xVel + input.xVel, -12, 12);
|
||||||
localInput.nAngle = fix16_sadd(localInput.nAngle, input.nAngle);
|
|
||||||
|
|
||||||
|
localInput.nAngle = fix16_sadd(localInput.nAngle, input.nAngle);
|
||||||
PlayerList[nLocalPlayer].q16angle = fix16_sadd(PlayerList[nLocalPlayer].q16angle, input.nAngle) & 0x7FFFFFF;
|
PlayerList[nLocalPlayer].q16angle = fix16_sadd(PlayerList[nLocalPlayer].q16angle, input.nAngle) & 0x7FFFFFF;
|
||||||
PlayerList[nLocalPlayer].q16horiz = fix16_clamp(fix16_sadd(PlayerList[nLocalPlayer].q16horiz, input.horizon), fix16_from_int(0), fix16_from_int(184));
|
|
||||||
|
|
||||||
// A horiz diff of 128 equal 45 degrees,
|
// A horiz diff of 128 equal 45 degrees,
|
||||||
// so we convert horiz to 1024 angle units
|
// so we convert horiz to 1024 angle units
|
||||||
|
|
||||||
float horizAngle = atan2f(nVertPan[nLocalPlayer] - fix16_from_int(92), fix16_from_int(128)) * (512.f / fPI) + scaleAdjustmentToInterval(fix16_to_float(input.horizon));
|
float const horizAngle = clamp(atan2f(PlayerList[nLocalPlayer].q16horiz - fix16_from_int(92), fix16_from_int(128)) * (512.f / fPI) + fix16_to_float(input.horizon), -255.f, 255.f);
|
||||||
horizAngle = clamp(horizAngle, -255.f, 255.f);
|
PlayerList[nLocalPlayer].q16horiz = fix16_from_int(92) + Blrintf(fix16_from_int(128) * tanf(horizAngle * (fPI / 512.f)));
|
||||||
nVertPan[nLocalPlayer] = fix16_clamp(fix16_from_int(92) + Blrintf(fix16_from_int(128) * tanf(horizAngle * (fPI / 512.f))), fix16_from_int(0), fix16_from_int(184));
|
|
||||||
|
|
||||||
// TODO - tidy / consolidate repeating blocks of code here?
|
// Look/aim up/down functions.
|
||||||
if (buttonMap.ButtonDown(gamefunc_Look_Up))
|
if (buttonMap.ButtonDown(gamefunc_Look_Up) || buttonMap.ButtonDown(gamefunc_Aim_Up))
|
||||||
{
|
{
|
||||||
bLockPan = kFalse;
|
bLockPan = kFalse;
|
||||||
if (nVertPan[nLocalPlayer] < fix16_from_int(180)) {
|
if (PlayerList[nLocalPlayer].q16horiz < fix16_from_int(180)) {
|
||||||
nVertPan[nLocalPlayer] = fix16_sadd(nVertPan[nLocalPlayer], fix16_from_float(scaleAdjustmentToInterval(4)));
|
PlayerList[nLocalPlayer].q16horiz = fix16_sadd(PlayerList[nLocalPlayer].q16horiz, fix16_from_float(scaleAdjustmentToInterval(4)));
|
||||||
}
|
}
|
||||||
|
|
||||||
bPlayerPan = kTrue;
|
bPlayerPan = kTrue;
|
||||||
nDestVertPan[nLocalPlayer] = nVertPan[nLocalPlayer];
|
nDestVertPan[nLocalPlayer] = PlayerList[nLocalPlayer].q16horiz;
|
||||||
}
|
}
|
||||||
else if (buttonMap.ButtonDown(gamefunc_Look_Down))
|
else if (buttonMap.ButtonDown(gamefunc_Look_Down) || buttonMap.ButtonDown(gamefunc_Aim_Down))
|
||||||
{
|
{
|
||||||
bLockPan = kFalse;
|
bLockPan = kFalse;
|
||||||
if (nVertPan[nLocalPlayer] > fix16_from_int(4)) {
|
if (PlayerList[nLocalPlayer].q16horiz > fix16_from_int(4)) {
|
||||||
nVertPan[nLocalPlayer] = fix16_ssub(nVertPan[nLocalPlayer], fix16_from_float(scaleAdjustmentToInterval(4)));
|
PlayerList[nLocalPlayer].q16horiz = fix16_ssub(PlayerList[nLocalPlayer].q16horiz, fix16_from_float(scaleAdjustmentToInterval(4)));
|
||||||
}
|
}
|
||||||
|
|
||||||
bPlayerPan = kTrue;
|
bPlayerPan = kTrue;
|
||||||
nDestVertPan[nLocalPlayer] = nVertPan[nLocalPlayer];
|
nDestVertPan[nLocalPlayer] = PlayerList[nLocalPlayer].q16horiz;
|
||||||
}
|
}
|
||||||
else if (buttonMap.ButtonDown(gamefunc_Look_Straight))
|
else if (buttonMap.ButtonDown(gamefunc_Look_Straight))
|
||||||
{
|
{
|
||||||
bLockPan = kFalse;
|
bLockPan = kFalse;
|
||||||
bPlayerPan = kFalse;
|
bPlayerPan = kFalse;
|
||||||
nVertPan[nLocalPlayer] = fix16_from_int(92);
|
PlayerList[nLocalPlayer].q16horiz = fix16_from_int(92);
|
||||||
nDestVertPan[nLocalPlayer] = fix16_from_int(92);
|
nDestVertPan[nLocalPlayer] = fix16_from_int(92);
|
||||||
}
|
}
|
||||||
else if (buttonMap.ButtonDown(gamefunc_Aim_Up))
|
|
||||||
{
|
|
||||||
bLockPan = kTrue;
|
|
||||||
if (nVertPan[nLocalPlayer] < fix16_from_int(180)) {
|
|
||||||
nVertPan[nLocalPlayer] = fix16_sadd(nVertPan[nLocalPlayer], fix16_from_float(scaleAdjustmentToInterval(4)));
|
|
||||||
}
|
|
||||||
|
|
||||||
bPlayerPan = kTrue;
|
|
||||||
nDestVertPan[nLocalPlayer] = nVertPan[nLocalPlayer];
|
|
||||||
}
|
|
||||||
else if (buttonMap.ButtonDown(gamefunc_Aim_Down))
|
|
||||||
{
|
|
||||||
bLockPan = kTrue;
|
|
||||||
if (nVertPan[nLocalPlayer] > fix16_from_int(4)) {
|
|
||||||
nVertPan[nLocalPlayer] = fix16_ssub(nVertPan[nLocalPlayer], fix16_from_float(scaleAdjustmentToInterval(4)));
|
|
||||||
}
|
|
||||||
|
|
||||||
bPlayerPan = kTrue;
|
|
||||||
nDestVertPan[nLocalPlayer] = nVertPan[nLocalPlayer];
|
|
||||||
}
|
|
||||||
|
|
||||||
// loc_1C048:
|
// loc_1C048:
|
||||||
if (totalvel[nLocalPlayer] > 20) {
|
if (totalvel[nLocalPlayer] > 20) {
|
||||||
|
@ -346,7 +324,7 @@ void PlayerInterruptKeys()
|
||||||
bLockPan = kTrue;
|
bLockPan = kTrue;
|
||||||
|
|
||||||
// loc_1C05E
|
// loc_1C05E
|
||||||
fix16_t ecx = fix16_ssub(nDestVertPan[nLocalPlayer], PlayerList[nLocalPlayer].q16horiz);
|
fix16_t ecx = nDestVertPan[nLocalPlayer] - PlayerList[nLocalPlayer].q16horiz;
|
||||||
|
|
||||||
if (g_MyAimMode)
|
if (g_MyAimMode)
|
||||||
{
|
{
|
||||||
|
@ -379,9 +357,10 @@ void PlayerInterruptKeys()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
nVertPan[nLocalPlayer] = fix16_sadd(nVertPan[nLocalPlayer], ecx);
|
PlayerList[nLocalPlayer].q16horiz = fix16_sadd(PlayerList[nLocalPlayer].q16horiz, ecx);
|
||||||
PlayerList[nLocalPlayer].q16horiz = fix16_clamp(nVertPan[nLocalPlayer], fix16_from_int(0), fix16_from_int(184));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
PlayerList[nLocalPlayer].q16horiz = fix16_clamp(PlayerList[nLocalPlayer].q16horiz, fix16_from_int(0), fix16_from_int(184));
|
||||||
}
|
}
|
||||||
|
|
||||||
void RestoreSavePoint(int nPlayer, int *x, int *y, int *z, short *nSector, short *nAngle)
|
void RestoreSavePoint(int nPlayer, int *x, int *y, int *z, short *nSector, short *nAngle)
|
||||||
|
@ -583,7 +562,6 @@ void RestartPlayer(short nPlayer)
|
||||||
}
|
}
|
||||||
|
|
||||||
PlayerList[nPlayer].opos = sprite[nSprite].pos;
|
PlayerList[nPlayer].opos = sprite[nSprite].pos;
|
||||||
PlayerList[nPlayer].q16oangle = PlayerList[nPlayer].q16angle;
|
|
||||||
|
|
||||||
nPlayerFloorSprite[nPlayer] = floorspr;
|
nPlayerFloorSprite[nPlayer] = floorspr;
|
||||||
|
|
||||||
|
@ -683,7 +661,7 @@ void RestartPlayer(short nPlayer)
|
||||||
nYDamage[nPlayer] = 0;
|
nYDamage[nPlayer] = 0;
|
||||||
nXDamage[nPlayer] = 0;
|
nXDamage[nPlayer] = 0;
|
||||||
|
|
||||||
PlayerList[nPlayer].q16ohoriz = PlayerList[nPlayer].q16horiz = nVertPan[nPlayer] = F16(92);
|
PlayerList[nPlayer].q16horiz = F16(92);
|
||||||
nDestVertPan[nPlayer] = F16(92);
|
nDestVertPan[nPlayer] = F16(92);
|
||||||
nBreathTimer[nPlayer] = 90;
|
nBreathTimer[nPlayer] = 90;
|
||||||
|
|
||||||
|
@ -785,7 +763,7 @@ void StartDeathSeq(int nPlayer, int nVal)
|
||||||
|
|
||||||
StopFiringWeapon(nPlayer);
|
StopFiringWeapon(nPlayer);
|
||||||
|
|
||||||
PlayerList[nPlayer].q16ohoriz = PlayerList[nPlayer].q16horiz = nVertPan[nPlayer] = F16(92);
|
PlayerList[nPlayer].q16horiz = F16(92);
|
||||||
oeyelevel[nPlayer] = eyelevel[nPlayer] = -14080;
|
oeyelevel[nPlayer] = eyelevel[nPlayer] = -14080;
|
||||||
nPlayerInvisible[nPlayer] = 0;
|
nPlayerInvisible[nPlayer] = 0;
|
||||||
dVertPan[nPlayer] = 15;
|
dVertPan[nPlayer] = 15;
|
||||||
|
@ -962,8 +940,6 @@ void FuncPlayer(int a, int nDamage, int nRun)
|
||||||
short nSprite2;
|
short nSprite2;
|
||||||
|
|
||||||
PlayerList[nPlayer].opos = sprite[nPlayerSprite].pos;
|
PlayerList[nPlayer].opos = sprite[nPlayerSprite].pos;
|
||||||
PlayerList[nPlayer].q16oangle = PlayerList[nPlayer].q16angle;
|
|
||||||
PlayerList[nPlayer].q16ohoriz = PlayerList[nPlayer].q16horiz;
|
|
||||||
oeyelevel[nPlayer] = eyelevel[nPlayer];
|
oeyelevel[nPlayer] = eyelevel[nPlayer];
|
||||||
|
|
||||||
switch (nMessage)
|
switch (nMessage)
|
||||||
|
@ -1273,10 +1249,9 @@ void FuncPlayer(int a, int nDamage, int nRun)
|
||||||
if (nTotalPlayers <= 1)
|
if (nTotalPlayers <= 1)
|
||||||
{
|
{
|
||||||
PlayerList[nPlayer].q16angle = fix16_from_int(GetAngleToSprite(nPlayerSprite, nSpiritSprite) & kAngleMask);
|
PlayerList[nPlayer].q16angle = fix16_from_int(GetAngleToSprite(nPlayerSprite, nSpiritSprite) & kAngleMask);
|
||||||
PlayerList[nPlayer].q16oangle = PlayerList[nPlayer].q16angle;
|
|
||||||
sprite[nPlayerSprite].ang = fix16_to_int(PlayerList[nPlayer].q16angle);
|
sprite[nPlayerSprite].ang = fix16_to_int(PlayerList[nPlayer].q16angle);
|
||||||
|
|
||||||
PlayerList[nPlayer].q16ohoriz = PlayerList[nPlayer].q16horiz = nVertPan[nPlayer] = F16(92);
|
PlayerList[nPlayer].q16horiz = F16(92);
|
||||||
|
|
||||||
lPlayerXVel = 0;
|
lPlayerXVel = 0;
|
||||||
lPlayerYVel = 0;
|
lPlayerYVel = 0;
|
||||||
|
@ -3068,19 +3043,19 @@ loc_1BD2E:
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (nVertPan[nPlayer] < F16(92))
|
if (PlayerList[nPlayer].q16horiz < fix16_from_int(92))
|
||||||
{
|
{
|
||||||
nVertPan[nPlayer] = F16(91);
|
PlayerList[nPlayer].q16horiz = fix16_from_int(91);
|
||||||
eyelevel[nPlayer] -= (dVertPan[nPlayer] << 8);
|
eyelevel[nPlayer] -= (dVertPan[nPlayer] << 8);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
nVertPan[nPlayer] += fix16_from_int(dVertPan[nPlayer]);
|
PlayerList[nPlayer].q16horiz = fix16_sadd(PlayerList[nPlayer].q16horiz, fix16_from_int(dVertPan[nPlayer]));
|
||||||
if (nVertPan[nPlayer] >= F16(200))
|
if (PlayerList[nPlayer].q16horiz >= fix16_from_int(200))
|
||||||
{
|
{
|
||||||
nVertPan[nPlayer] = F16(199);
|
PlayerList[nPlayer].q16horiz = fix16_from_int(199);
|
||||||
}
|
}
|
||||||
else if (nVertPan[nPlayer] <= F16(92))
|
else if (PlayerList[nPlayer].q16horiz <= fix16_from_int(92))
|
||||||
{
|
{
|
||||||
if (!(SectFlag[sprite[nPlayerSprite].sectnum] & kSectUnderwater))
|
if (!(SectFlag[sprite[nPlayerSprite].sectnum] & kSectUnderwater))
|
||||||
{
|
{
|
||||||
|
|
|
@ -72,8 +72,8 @@ struct Player
|
||||||
short field_3C;
|
short field_3C;
|
||||||
short nRun;
|
short nRun;
|
||||||
|
|
||||||
fix16_t q16angle, q16oangle;
|
fix16_t q16angle;
|
||||||
fix16_t q16horiz, q16ohoriz;
|
fix16_t q16horiz;
|
||||||
vec3_t opos;
|
vec3_t opos;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -47,7 +47,6 @@ int zbob;
|
||||||
|
|
||||||
fix16_t nDestVertPan[kMaxPlayers] = { 0 };
|
fix16_t nDestVertPan[kMaxPlayers] = { 0 };
|
||||||
short dVertPan[kMaxPlayers];
|
short dVertPan[kMaxPlayers];
|
||||||
fix16_t nVertPan[kMaxPlayers];
|
|
||||||
int nCamerax;
|
int nCamerax;
|
||||||
int nCameray;
|
int nCameray;
|
||||||
int nCameraz;
|
int nCameraz;
|
||||||
|
@ -414,7 +413,6 @@ void DrawView(int smoothRatio, bool sceneonly)
|
||||||
viewz = playerZ + nQuake[nLocalPlayer];
|
viewz = playerZ + nQuake[nLocalPlayer];
|
||||||
int floorZ = sector[sprite[nPlayerSprite].sectnum].floorz;
|
int floorZ = sector[sprite[nPlayerSprite].sectnum].floorz;
|
||||||
|
|
||||||
// pan = nVertPan[nLocalPlayer];
|
|
||||||
pan = PlayerList[nLocalPlayer].q16horiz;
|
pan = PlayerList[nLocalPlayer].q16horiz;
|
||||||
|
|
||||||
if (viewz > floorZ)
|
if (viewz > floorZ)
|
||||||
|
@ -648,7 +646,6 @@ static SavegameHelper sgh("view",
|
||||||
SV(nEnemyPal),
|
SV(nEnemyPal),
|
||||||
SA(nDestVertPan),
|
SA(nDestVertPan),
|
||||||
SA(dVertPan),
|
SA(dVertPan),
|
||||||
SA(nVertPan),
|
|
||||||
SA(nQuake),
|
SA(nQuake),
|
||||||
SV(g_interpolationCnt),
|
SV(g_interpolationCnt),
|
||||||
SA(oldipos),
|
SA(oldipos),
|
||||||
|
|
|
@ -49,7 +49,6 @@ void viewRestoreInterpolations(void);
|
||||||
|
|
||||||
extern fix16_t nDestVertPan[];
|
extern fix16_t nDestVertPan[];
|
||||||
extern short dVertPan[];
|
extern short dVertPan[];
|
||||||
extern fix16_t nVertPan[];
|
|
||||||
extern short nQuake[];
|
extern short nQuake[];
|
||||||
extern int nCamerax;
|
extern int nCamerax;
|
||||||
extern int nCameray;
|
extern int nCameray;
|
||||||
|
|
Loading…
Reference in a new issue