mirror of
https://github.com/ZDoom/raze-gles.git
synced 2024-12-30 13:21:04 +00:00
- Exhumed: Perform weapon bobbing with maximum precision and implement cl_weaponsway
.
This commit is contained in:
parent
fed70e6df7
commit
e225e85ae1
11 changed files with 35 additions and 27 deletions
|
@ -152,7 +152,7 @@ void StopFiringWeapon(short nPlayer);
|
||||||
void FireWeapon(short nPlayer);
|
void FireWeapon(short nPlayer);
|
||||||
void CheckClip(short nPlayer);
|
void CheckClip(short nPlayer);
|
||||||
void MoveWeapons(short nPlayer);
|
void MoveWeapons(short nPlayer);
|
||||||
void DrawWeapons(int smooth);
|
void DrawWeapons(double smooth);
|
||||||
|
|
||||||
// items
|
// items
|
||||||
|
|
||||||
|
|
|
@ -146,6 +146,11 @@ inline int Sin(int angle)
|
||||||
return sintable[angle & kAngleMask];
|
return sintable[angle & kAngleMask];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
inline double FSin(double angle)
|
||||||
|
{
|
||||||
|
return calcSinTableValue(fmod(angle, kAngleMask + 1));
|
||||||
|
}
|
||||||
|
|
||||||
inline int Cos(int angle)
|
inline int Cos(int angle)
|
||||||
{
|
{
|
||||||
return sintable[(angle + 512) & kAngleMask];
|
return sintable[(angle + 512) & kAngleMask];
|
||||||
|
|
|
@ -412,7 +412,7 @@ void DrawClock()
|
||||||
DoEnergyTile();
|
DoEnergyTile();
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t calc_smoothratio(ClockTicks totalclk, ClockTicks ototalclk)
|
double calc_smoothratio(ClockTicks totalclk, ClockTicks ototalclk)
|
||||||
{
|
{
|
||||||
if (bRecord || bPlayback || nFreeze != 0 || bCamera || paused)
|
if (bRecord || bPlayback || nFreeze != 0 || bCamera || paused)
|
||||||
return 65536;
|
return 65536;
|
||||||
|
|
|
@ -60,7 +60,7 @@ extern ClockTicks tclocks;
|
||||||
void RunCinemaScene(int num);
|
void RunCinemaScene(int num);
|
||||||
void GameMove(void);
|
void GameMove(void);
|
||||||
void DrawClock();
|
void DrawClock();
|
||||||
int32_t calc_smoothratio(ClockTicks totalclk, ClockTicks ototalclk);
|
double calc_smoothratio(ClockTicks totalclk, ClockTicks ototalclk);
|
||||||
void DoTitle(CompletionFunc completion);
|
void DoTitle(CompletionFunc completion);
|
||||||
|
|
||||||
static int FinishLevel(TArray<JobDesc> &jobs)
|
static int FinishLevel(TArray<JobDesc> &jobs)
|
||||||
|
@ -117,7 +117,7 @@ static void GameDisplay(void)
|
||||||
DrawClock();
|
DrawClock();
|
||||||
}
|
}
|
||||||
|
|
||||||
auto smoothRatio = calc_smoothratio(totalclock, tclocks);
|
double smoothRatio = calc_smoothratio(totalclock, tclocks);
|
||||||
|
|
||||||
DrawView(smoothRatio);
|
DrawView(smoothRatio);
|
||||||
DrawStatusBar();
|
DrawStatusBar();
|
||||||
|
|
|
@ -924,7 +924,7 @@ loc_flag:
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void DrawWeapons(int smooth)
|
void DrawWeapons(double smooth)
|
||||||
{
|
{
|
||||||
if (bCamera) {
|
if (bCamera) {
|
||||||
return;
|
return;
|
||||||
|
@ -958,21 +958,22 @@ void DrawWeapons(int smooth)
|
||||||
|
|
||||||
nPal = RemapPLU(nPal);
|
nPal = RemapPLU(nPal);
|
||||||
|
|
||||||
int nVal = totalvel[nLocalPlayer] >> 1;
|
double xOffset, yOffset;
|
||||||
|
|
||||||
// CHECKME - not & 0x7FF?
|
if (cl_weaponsway && var_34 == 1)
|
||||||
int nBobAngle = angle_interpolate16(obobangle, bobangle, smooth);
|
|
||||||
int yOffset = (nVal * (sintable[nBobAngle & 0x3FF] >> 8)) >> 9;
|
|
||||||
|
|
||||||
int xOffset = 0;
|
|
||||||
|
|
||||||
if (var_34 == 1)
|
|
||||||
{
|
{
|
||||||
xOffset = ((Sin(nBobAngle + 512) >> 8) * nVal) >> 8;
|
// CHECKME - not & 0x7FF?
|
||||||
|
double nBobAngle = obobangle + fmulscale16(((bobangle + 1024 - obobangle) & 2047) - 1024, smooth);
|
||||||
|
double nVal = (ototalvel[nLocalPlayer] + fmulscale16(totalvel[nLocalPlayer] - ototalvel[nLocalPlayer], smooth)) / 2.;
|
||||||
|
yOffset = (nVal * (calcSinTableValue(fmod(nBobAngle, 1024)) / 256.)) / 512.;
|
||||||
|
|
||||||
|
if (var_34 == 1)
|
||||||
|
{
|
||||||
|
xOffset = ((FSin(nBobAngle + 512) / 256.) * nVal) / 256.;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
xOffset = 0;
|
|
||||||
obobangle = bobangle = 512;
|
obobangle = bobangle = 512;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -112,6 +112,7 @@ short nPlayerDouble[kMaxPlayers];
|
||||||
short nPlayerViewSect[kMaxPlayers];
|
short nPlayerViewSect[kMaxPlayers];
|
||||||
short nPlayerFloorSprite[kMaxPlayers];
|
short nPlayerFloorSprite[kMaxPlayers];
|
||||||
PlayerSave sPlayerSave[kMaxPlayers];
|
PlayerSave sPlayerSave[kMaxPlayers];
|
||||||
|
int ototalvel[kMaxPlayers] = { 0 };
|
||||||
int totalvel[kMaxPlayers] = { 0 };
|
int totalvel[kMaxPlayers] = { 0 };
|
||||||
int16_t eyelevel[kMaxPlayers], oeyelevel[kMaxPlayers];
|
int16_t eyelevel[kMaxPlayers], oeyelevel[kMaxPlayers];
|
||||||
short nNetStartSprite[kMaxPlayers] = { 0 };
|
short nNetStartSprite[kMaxPlayers] = { 0 };
|
||||||
|
@ -677,7 +678,7 @@ void RestartPlayer(short nPlayer)
|
||||||
sprintf(playerNames[nPlayer], "JOE%d", nPlayer);
|
sprintf(playerNames[nPlayer], "JOE%d", nPlayer);
|
||||||
namelen[nPlayer] = strlen(playerNames[nPlayer]);
|
namelen[nPlayer] = strlen(playerNames[nPlayer]);
|
||||||
|
|
||||||
totalvel[nPlayer] = 0;
|
ototalvel[nPlayer] = totalvel[nPlayer] = 0;
|
||||||
|
|
||||||
memset(&sPlayerInput[nPlayer], 0, sizeof(PlayerInput));
|
memset(&sPlayerInput[nPlayer], 0, sizeof(PlayerInput));
|
||||||
sPlayerInput[nPlayer].nItem = -1;
|
sPlayerInput[nPlayer].nItem = -1;
|
||||||
|
@ -798,7 +799,7 @@ void StartDeathSeq(int nPlayer, int nVal)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
totalvel[nPlayer] = 0;
|
ototalvel[nPlayer] = totalvel[nPlayer] = 0;
|
||||||
|
|
||||||
if (nPlayer == nLocalPlayer) {
|
if (nPlayer == nLocalPlayer) {
|
||||||
RefreshStatus();
|
RefreshStatus();
|
||||||
|
@ -1425,6 +1426,7 @@ loc_1AB8E:
|
||||||
sqrtNum = INT_MAX;
|
sqrtNum = INT_MAX;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ototalvel[nPlayer] = totalvel[nPlayer];
|
||||||
totalvel[nPlayer] = ksqrt(sqrtNum);
|
totalvel[nPlayer] = ksqrt(sqrtNum);
|
||||||
|
|
||||||
int nViewSect = sprite[nPlayerSprite].sectnum;
|
int nViewSect = sprite[nPlayerSprite].sectnum;
|
||||||
|
|
|
@ -106,7 +106,7 @@ extern short nPlayerClip[];
|
||||||
|
|
||||||
extern short obobangle, bobangle;
|
extern short obobangle, bobangle;
|
||||||
|
|
||||||
extern int totalvel[];
|
extern int ototalvel[], totalvel[];
|
||||||
extern int16_t eyelevel[], oeyelevel[];
|
extern int16_t eyelevel[], oeyelevel[];
|
||||||
|
|
||||||
extern short nNetStartSprite[kMaxPlayers];
|
extern short nNetStartSprite[kMaxPlayers];
|
||||||
|
|
|
@ -354,7 +354,7 @@ short seq_GetFrameFlag(short val, short nFrame)
|
||||||
return FrameFlag[SeqBase[val] + nFrame];
|
return FrameFlag[SeqBase[val] + nFrame];
|
||||||
}
|
}
|
||||||
|
|
||||||
void seq_DrawPilotLightSeq(int xOffset, int yOffset)
|
void seq_DrawPilotLightSeq(double xOffset, double yOffset)
|
||||||
{
|
{
|
||||||
short nSect = nPlayerViewSect[nLocalPlayer];
|
short nSect = nPlayerViewSect[nLocalPlayer];
|
||||||
|
|
||||||
|
@ -371,10 +371,10 @@ void seq_DrawPilotLightSeq(int xOffset, int yOffset)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
short nTile = ChunkPict[nFrameBase];
|
short nTile = ChunkPict[nFrameBase];
|
||||||
int x = ChunkXpos[nFrameBase] + (160 + xOffset);
|
double x = ChunkXpos[nFrameBase] + (160 + xOffset);
|
||||||
int y = ChunkYpos[nFrameBase] + (100 + yOffset);
|
double y = ChunkYpos[nFrameBase] + (100 + yOffset);
|
||||||
|
|
||||||
hud_drawsprite(x, y, 65536, (-2 * fix16_to_int(nPlayerDAng)) & kAngleMask, nTile, 0, 0, 1);
|
hud_drawsprite(x, y, 65536, fmod(-2 * (nPlayerDAng / (double)(FRACUNIT)), kAngleMask + 1), nTile, 0, 0, 1);
|
||||||
nFrameBase++;
|
nFrameBase++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -387,7 +387,7 @@ void seq_DrawPilotLightSeq(int xOffset, int yOffset)
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
int seq_DrawGunSequence(int nSeqOffset, short dx, int xOffs, int yOffs, int nShade, int nPal)
|
int seq_DrawGunSequence(int nSeqOffset, short dx, double xOffs, double yOffs, int nShade, int nPal)
|
||||||
{
|
{
|
||||||
int nFrame = SeqBase[nSeqOffset] + dx;
|
int nFrame = SeqBase[nSeqOffset] + dx;
|
||||||
int nFrameBase = FrameBase[nFrame];
|
int nFrameBase = FrameBase[nFrame];
|
||||||
|
|
|
@ -142,11 +142,11 @@ int seq_GetSeqPicnum2(short nSeq, short nFrame);
|
||||||
int seq_GetSeqPicnum(short nSeq, short edx, short ebx);
|
int seq_GetSeqPicnum(short nSeq, short edx, short ebx);
|
||||||
void seq_DrawStatusSequence(short nSequence, uint16_t edx, short ebx);
|
void seq_DrawStatusSequence(short nSequence, uint16_t edx, short ebx);
|
||||||
|
|
||||||
int seq_DrawGunSequence(int nSeqOffset, short dx, int xOffs, int yOffs, int nShade, int nPal);
|
int seq_DrawGunSequence(int nSeqOffset, short dx, double xOffs, double yOffs, int nShade, int nPal);
|
||||||
short seq_GetFrameFlag(short val, short nFrame);
|
short seq_GetFrameFlag(short val, short nFrame);
|
||||||
int seq_PlotSequence(short nSprite, short edx, short nFrame, short ecx);
|
int seq_PlotSequence(short nSprite, short edx, short nFrame, short ecx);
|
||||||
int seq_PlotArrowSequence(short nSprite, short nSeq, int nVal);
|
int seq_PlotArrowSequence(short nSprite, short nSeq, int nVal);
|
||||||
void seq_DrawPilotLightSeq(int xOffset, int yOffset);
|
void seq_DrawPilotLightSeq(double xOffset, double yOffset);
|
||||||
|
|
||||||
END_PS_NS
|
END_PS_NS
|
||||||
|
|
||||||
|
|
|
@ -237,7 +237,7 @@ static inline int interpolate16(int a, int b, int smooth)
|
||||||
|
|
||||||
static TextOverlay subtitleOverlay;
|
static TextOverlay subtitleOverlay;
|
||||||
|
|
||||||
void DrawView(int smoothRatio, bool sceneonly)
|
void DrawView(double smoothRatio, bool sceneonly)
|
||||||
{
|
{
|
||||||
int playerX;
|
int playerX;
|
||||||
int playerY;
|
int playerY;
|
||||||
|
|
|
@ -29,7 +29,7 @@ extern short bCamera;
|
||||||
|
|
||||||
void InitView();
|
void InitView();
|
||||||
void DrawStatusBar();
|
void DrawStatusBar();
|
||||||
void DrawView(int smoothRatio, bool sceneonly = false);
|
void DrawView(double smoothRatio, bool sceneonly = false);
|
||||||
void ResetView();
|
void ResetView();
|
||||||
void NoClip();
|
void NoClip();
|
||||||
void Clip();
|
void Clip();
|
||||||
|
|
Loading…
Reference in a new issue