mirror of
https://github.com/ZDoom/raze-gles.git
synced 2025-01-15 12:10:53 +00:00
- Blood: replaced several uses of gameclock with gFrameClock
Mainly those which do not use its full precision. Choke needs interpolation support, though.
This commit is contained in:
parent
b19681b50c
commit
4b45ee150f
9 changed files with 28 additions and 35 deletions
|
@ -60,6 +60,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|||
#include "gamestate.h"
|
||||
#include "screenjob.h"
|
||||
#include "mapinfo.h"
|
||||
#include "choke.h"
|
||||
|
||||
BEGIN_BLD_NS
|
||||
|
||||
|
@ -242,7 +243,6 @@ void StartLevel(MapRecord *level)
|
|||
gGameOptions.uGameFlags &= ~3;
|
||||
PreloadCache();
|
||||
InitMirrors();
|
||||
gFrameClock = 0;
|
||||
trInit();
|
||||
if (!bVanilla && !gMe->packSlots[1].isActive) // if diving suit is not active, turn off reverb sound effect
|
||||
sfxSetReverb(0);
|
||||
|
@ -257,6 +257,8 @@ void StartLevel(MapRecord *level)
|
|||
lastTic = -1;
|
||||
paused = 0;
|
||||
levelTryPlayMusic();
|
||||
gFrameClock = 0;
|
||||
gChoke.reset();
|
||||
}
|
||||
|
||||
|
||||
|
@ -419,7 +421,7 @@ void GameInterface::app_init()
|
|||
sndInit();
|
||||
registerosdcommands();
|
||||
|
||||
gChoke.sub_83ff0(518, sub_84230);
|
||||
gChoke.init(518, sub_84230);
|
||||
UpdateDacs(0, true);
|
||||
|
||||
enginecompatibility_mode = ENGINECOMPATIBILITY_19960925;//bVanilla;
|
||||
|
@ -513,7 +515,7 @@ static void commonTicker()
|
|||
auto completion = [=](bool = false)
|
||||
{
|
||||
StartLevel(sng);
|
||||
gFrameClock = gameclock;
|
||||
|
||||
gamestate = GS_LEVEL;
|
||||
};
|
||||
|
||||
|
|
|
@ -35,7 +35,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|||
|
||||
BEGIN_BLD_NS
|
||||
|
||||
void CChoke::sub_83ff0(int a1, void(*a2)(PLAYER*))
|
||||
void CChoke::init(int a1, void(*a2)(PLAYER*))
|
||||
{
|
||||
at0 = NULL;
|
||||
at1c = a2;
|
||||
|
@ -47,21 +47,21 @@ void CChoke::sub_83ff0(int a1, void(*a2)(PLAYER*))
|
|||
at8->nSprite = -1;
|
||||
at8->x = at14;
|
||||
at8->y = at18;
|
||||
at8->Preload();
|
||||
sub_84218();
|
||||
//at8->Preload();
|
||||
atc = at8->at10;
|
||||
at10 = 0;
|
||||
}
|
||||
}
|
||||
|
||||
void CChoke::sub_84110(int x, int y)
|
||||
void CChoke::animateChoke(int x, int y, int smoothratio)
|
||||
{
|
||||
if (!at8)
|
||||
return;
|
||||
int v4 = gFrameClock;
|
||||
gFrameClock = gameclock;
|
||||
int myclock = gFrameClock + mulscale16(4, smoothratio);
|
||||
at8->x = x;
|
||||
at8->y = y;
|
||||
int vd = gameclock-at10;
|
||||
at10 = gameclock;
|
||||
int vd = myclock-at10;
|
||||
at10 = myclock;
|
||||
atc -= vd;
|
||||
if (atc <= 0 || atc > at8->at10)
|
||||
atc = at8->at10;
|
||||
|
@ -70,14 +70,8 @@ void CChoke::sub_84110(int x, int y)
|
|||
// This originally overlaid the HUD but that simply doesn't work right with the HUD being a genuine overlay.
|
||||
// It also never adjusted for a reduced 3D view
|
||||
at8->Draw(vdi, 10, 0, 0, true);
|
||||
gFrameClock = v4;
|
||||
}
|
||||
|
||||
void CChoke::sub_84218()
|
||||
{
|
||||
atc = at8->at10;
|
||||
at10 = gameclock;
|
||||
}
|
||||
|
||||
void sub_84230(PLAYER *pPlayer)
|
||||
{
|
||||
|
|
|
@ -41,9 +41,9 @@ public:
|
|||
at14 = 0;
|
||||
at18 = 0;
|
||||
};
|
||||
void sub_83ff0(int a1, void(*a2)(PLAYER*));
|
||||
void sub_84110(int x, int y);
|
||||
void sub_84218();
|
||||
void init(int a1, void(*a2)(PLAYER*));
|
||||
void animateChoke(int x, int y, int smoothratio);
|
||||
void reset() { at10 = 0; }
|
||||
char *at0;
|
||||
QAV *at8;
|
||||
int atc;
|
||||
|
|
|
@ -98,11 +98,13 @@ void FireInit(void)
|
|||
|
||||
void FireProcess(void)
|
||||
{
|
||||
// This assumes a smooth high frame rate. Ugh...
|
||||
static int lastUpdate;
|
||||
if (gameclock < lastUpdate || lastUpdate + 2 < gameclock)
|
||||
int clock = I_GetBuildTime()/ 2;
|
||||
if (clock < lastUpdate || lastUpdate + 2 < clock)
|
||||
{
|
||||
DoFireFrame();
|
||||
lastUpdate = gameclock;
|
||||
lastUpdate = clock;
|
||||
TileFiles.InvalidateTile(2342);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -509,7 +509,6 @@ bool GameInterface::LoadGame(FSaveGameNode* node)
|
|||
playerSetRace(&gPlayer[i], gPlayer[i].lifeMode);
|
||||
viewSetErrorMessage("");
|
||||
gFrameCount = 0;
|
||||
gameclock = 0;
|
||||
lastTic = -1;
|
||||
paused = 0;
|
||||
gamestate = GS_LEVEL;
|
||||
|
@ -601,7 +600,6 @@ void MyLoadSave::Load(void)
|
|||
Read(gotsector, sizeof(gotsector));
|
||||
Read(&gFrameClock, sizeof(gFrameClock));
|
||||
Read(&gFrameCount, sizeof(gFrameCount));
|
||||
Read(&gameclock, sizeof(gameclock));
|
||||
Read(&gLevelTime, sizeof(gLevelTime));
|
||||
Read(&paused, sizeof(paused));
|
||||
Read(baseWall, sizeof(baseWall[0])*numwalls);
|
||||
|
@ -691,8 +689,6 @@ void MyLoadSave::Save(void)
|
|||
Write(gotsector, sizeof(gotsector));
|
||||
Write(&gFrameClock, sizeof(gFrameClock));
|
||||
Write(&gFrameCount, sizeof(gFrameCount));
|
||||
int nGameClock = gameclock;
|
||||
Write(&nGameClock, sizeof(nGameClock));
|
||||
Write(&gLevelTime, sizeof(gLevelTime));
|
||||
Write(&paused, sizeof(paused));
|
||||
Write(baseWall, sizeof(baseWall[0])*numwalls);
|
||||
|
|
|
@ -55,7 +55,6 @@ void netResetToSinglePlayer(void)
|
|||
|
||||
void netReset(void)
|
||||
{
|
||||
gFrameClock = gameclock = 0;
|
||||
lastTic = -1;
|
||||
gPredictTail = 0;
|
||||
gNetFifoTail = 0;
|
||||
|
|
|
@ -4804,7 +4804,7 @@ void playerQavSceneDraw(PLAYER* pPlayer, int a2, double a3, double a4, int a5) {
|
|||
int v4 = (pPlayer->weaponTimer == 0) ? gameclock % pQAV->at10 : pQAV->at10 - pPlayer->weaponTimer;
|
||||
|
||||
int flags = 2; int nInv = powerupCheck(pPlayer, kPwUpShadowCloak);
|
||||
if (nInv >= 120 * 8 || (nInv != 0 && (gameclock & 32))) {
|
||||
if (nInv >= 120 * 8 || (nInv != 0 && (gFrameClock & 32))) {
|
||||
a2 = -128; flags |= 1;
|
||||
}
|
||||
|
||||
|
|
|
@ -307,7 +307,7 @@ private:
|
|||
if (powerups[i].remainingDuration)
|
||||
{
|
||||
int remainingSeconds = powerups[i].remainingDuration / 100;
|
||||
if (remainingSeconds > warningTime || (gameclock & 32))
|
||||
if (remainingSeconds > warningTime || (gFrameClock & 32))
|
||||
{
|
||||
DrawStatMaskedSprite(powerups[i].nTile, x, y + powerups[i].yOffset, 0, 0, 256, (int)(65536 * powerups[i].nScaleRatio), DI_SCREEN_LEFT_CENTER);
|
||||
}
|
||||
|
@ -477,7 +477,7 @@ private:
|
|||
{
|
||||
FString gTempStr;
|
||||
int x = 1, y = 1;
|
||||
if (dword_21EFD0[0] == 0 || (gameclock & 8))
|
||||
if (dword_21EFD0[0] == 0 || (gFrameClock & 8))
|
||||
{
|
||||
SBar_DrawString(this, &smallf, GStrings("TXT_COLOR_BLUE"), x, y, 0, CR_LIGHTBLUE, 1., -1, -1, 1, 1);
|
||||
dword_21EFD0[0] = dword_21EFD0[0] - arg;
|
||||
|
@ -487,7 +487,7 @@ private:
|
|||
SBar_DrawString(this, &smallf, gTempStr, x, y + 10, 0, CR_LIGHTBLUE, 1., -1, -1, 1, 1);
|
||||
}
|
||||
x = -2;
|
||||
if (dword_21EFD0[1] == 0 || (gameclock & 8))
|
||||
if (dword_21EFD0[1] == 0 || (gFrameClock & 8))
|
||||
{
|
||||
SBar_DrawString(this, &smallf, GStrings("TXT_COLOR_RED"), x, y, DI_TEXT_ALIGN_RIGHT, CR_BRICK, 1., -1, -1, 1, 1);
|
||||
dword_21EFD0[1] = dword_21EFD0[1] - arg;
|
||||
|
@ -508,7 +508,7 @@ private:
|
|||
{
|
||||
dassert(0 == team || 1 == team); // 0: blue, 1: red
|
||||
|
||||
if (dword_21EFD0[team] == 0 || (gameclock & 8))
|
||||
if (dword_21EFD0[team] == 0 || (gFrameClock & 8))
|
||||
{
|
||||
dword_21EFD0[team] = dword_21EFD0[team] - arg;
|
||||
if (dword_21EFD0[team] < 0)
|
||||
|
@ -585,7 +585,7 @@ private:
|
|||
DrawStatMaskedSprite(2200, 160, 200, 0, nPalette, RS_CENTERBOTTOM);
|
||||
DrawPackItemInStatusBar(pPlayer, 265, 186, 260, 172);
|
||||
|
||||
if (pXSprite->health >= 16 || (gameclock & 16) || pXSprite->health == 0)
|
||||
if (pXSprite->health >= 16 || (gFrameClock & 16) || pXSprite->health == 0)
|
||||
{
|
||||
DrawStatNumber("%3d", pXSprite->health >> 4, 2190, 86, 183, 0, 0);
|
||||
}
|
||||
|
@ -659,7 +659,7 @@ private:
|
|||
|
||||
BeginHUD(320, 200, 1);
|
||||
DrawStatSprite(2201, 34, 187 - 200, 16, nPalette);
|
||||
if (pXSprite->health >= 16 || (gameclock & 16) || pXSprite->health == 0)
|
||||
if (pXSprite->health >= 16 || (gFrameClock & 16) || pXSprite->health == 0)
|
||||
{
|
||||
DrawStatNumber("%3d", pXSprite->health >> 4, 2190, 8, 183 - 200, 0, 0);
|
||||
}
|
||||
|
|
|
@ -994,7 +994,7 @@ void viewDrawScreen(bool sceneonly)
|
|||
if (IsPlayerSprite(gMe->pSprite) && pPSprite->hand == 1)
|
||||
{
|
||||
//static int lastClock;
|
||||
gChoke.sub_84110(160, zn);
|
||||
gChoke.animateChoke(160, zn, (int)gInterpolate);
|
||||
//if ((gGameClock % 5) == 0 && gGameClock != lastClock)
|
||||
//{
|
||||
// gChoke.swayV(pPSprite);
|
||||
|
|
Loading…
Reference in a new issue