mirror of
https://github.com/ZDoom/raze-gles.git
synced 2025-02-05 05:10:55 +00:00
- Blood: Migrate to GZDoom time code like Duke, SW and Exhumed.
This commit is contained in:
parent
39541408f2
commit
d358c71f82
17 changed files with 62 additions and 50 deletions
|
@ -559,7 +559,7 @@ void viewProcessSprites(int32_t cX, int32_t cY, int32_t cZ, int32_t cA, int32_t)
|
|||
pTSprite->picnum = voxelIndex[pTSprite->picnum];
|
||||
if ((picanm[nTile].extra&7) == 7)
|
||||
{
|
||||
pTSprite->ang = ((int)totalclock<<3)&2047;
|
||||
pTSprite->ang = (gameclock<<3)&2047;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -588,7 +588,7 @@ void viewProcessSprites(int32_t cX, int32_t cY, int32_t cZ, int32_t cA, int32_t)
|
|||
int const nVoxel = tiletovox[pTSprite->picnum];
|
||||
|
||||
if (nVoxel != -1 && ((voxrotate[nVoxel>>3]&pow2char[nVoxel&7]) != 0 || (picanm[nRootTile].extra&7) == 7))
|
||||
pTSprite->ang = (pTSprite->ang+((int)totalclock<<3))&2047;
|
||||
pTSprite->ang = (pTSprite->ang+(gameclock<<3))&2047;
|
||||
}
|
||||
|
||||
if ((pTSprite->cstat&48) != 48 && hw_models && !(spriteext[nSprite].flags&SPREXT_NOTMD))
|
||||
|
@ -603,7 +603,7 @@ void viewProcessSprites(int32_t cX, int32_t cY, int32_t cZ, int32_t cA, int32_t)
|
|||
pTSprite->xoffset += tileLeftOffset(nAnimTile);
|
||||
|
||||
if ((picanm[nRootTile].extra&7) == 7)
|
||||
pTSprite->ang = (pTSprite->ang+((int)totalclock<<3))&2047;
|
||||
pTSprite->ang = (pTSprite->ang+(gameclock<<3))&2047;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -320,7 +320,6 @@ void PreloadTiles(void)
|
|||
void PreloadCache(void)
|
||||
{
|
||||
PreloadTiles();
|
||||
ClockTicks clock = totalclock;
|
||||
int cnt = 0;
|
||||
int percentDisplayed = -1;
|
||||
|
||||
|
@ -511,7 +510,8 @@ void StartLevel(MapRecord *level)
|
|||
// viewSetMessage("");
|
||||
viewSetErrorMessage("");
|
||||
netWaitForEveryone(0);
|
||||
totalclock = 0;
|
||||
gameclock = 0;
|
||||
lastTic = -1;
|
||||
paused = 0;
|
||||
ready2send = 1;
|
||||
levelTryPlayMusic();
|
||||
|
@ -791,12 +791,17 @@ static void gameTicker()
|
|||
}
|
||||
if (numplayers == 1)
|
||||
gBufferJitter = 0;
|
||||
while (totalclock >= gNetFifoClock && ready2send)
|
||||
|
||||
int const currentTic = I_GetTime();
|
||||
gameclock = I_GetBuildTime();
|
||||
|
||||
while (currentTic - lastTic >= 1 && ready2send)
|
||||
{
|
||||
gNetInput = gInput;
|
||||
gInput = {};
|
||||
netGetInput();
|
||||
gNetFifoClock += 4;
|
||||
lastTic = currentTic;
|
||||
gNetFifoClock = gameclock;
|
||||
while (gNetFifoHead[myconnectindex] - gNetFifoTail > gBufferJitter && !gStartNewGame && !gQuitGame)
|
||||
{
|
||||
int i;
|
||||
|
@ -849,7 +854,7 @@ static void commonTicker()
|
|||
auto completion = [=](bool = false)
|
||||
{
|
||||
StartLevel(sng);
|
||||
gNetFifoClock = gFrameClock = totalclock;
|
||||
gNetFifoClock = gFrameClock = gameclock;
|
||||
gamestate = GS_LEVEL;
|
||||
};
|
||||
|
||||
|
|
|
@ -57,11 +57,11 @@ void CChoke::sub_84110(int x, int y)
|
|||
if (!at8)
|
||||
return;
|
||||
ClockTicks v4 = gFrameClock;
|
||||
gFrameClock = totalclock;
|
||||
gFrameClock = gameclock;
|
||||
at8->x = x;
|
||||
at8->y = y;
|
||||
int vd = (int)totalclock-at10;
|
||||
at10 = (int)totalclock;
|
||||
int vd = gameclock-at10;
|
||||
at10 = gameclock;
|
||||
atc -= vd;
|
||||
if (atc <= 0 || atc > at8->at10)
|
||||
atc = at8->at10;
|
||||
|
@ -76,7 +76,7 @@ void CChoke::sub_84110(int x, int y)
|
|||
void CChoke::sub_84218()
|
||||
{
|
||||
atc = at8->at10;
|
||||
at10 = (int)totalclock;
|
||||
at10 = gameclock;
|
||||
}
|
||||
|
||||
void sub_84230(PLAYER *pPlayer)
|
||||
|
|
|
@ -60,7 +60,7 @@ int32_t mouseyaxismode = -1;
|
|||
|
||||
int32_t GetTime(void)
|
||||
{
|
||||
return (int32_t)totalclock;
|
||||
return gameclock;
|
||||
}
|
||||
|
||||
fix16_t gViewLook, gViewAngle;
|
||||
|
@ -262,13 +262,13 @@ void ctrlGetInput(void)
|
|||
|
||||
static int32_t turnHeldTime;
|
||||
static int32_t lastInputClock; // MED
|
||||
int32_t const elapsedTics = (int32_t)totalclock - lastInputClock;
|
||||
int32_t const elapsedTics = gameclock - lastInputClock;
|
||||
|
||||
// Blood's q16mlook scaling is different from the other games, therefore use the below constant to attenuate
|
||||
// the speed to match the other games.
|
||||
float const mlookScale = 3.25f;
|
||||
|
||||
lastInputClock = (int32_t) totalclock;
|
||||
lastInputClock = gameclock;
|
||||
|
||||
if (turnLeft || turnRight)
|
||||
turnHeldTime += elapsedTics;
|
||||
|
|
|
@ -73,7 +73,7 @@ CGameMenuItemQAV::CGameMenuItemQAV(int a3, int a4, const char* name, bool widesc
|
|||
data->y = m_nY;
|
||||
data->Preload();
|
||||
at2c = data->at10;
|
||||
lastTick = (int)totalclock;
|
||||
lastTick = I_GetBuildTime();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -87,9 +87,10 @@ void CGameMenuItemQAV::Draw(void)
|
|||
{
|
||||
auto data = (QAV*)raw.Data();
|
||||
ClockTicks backFC = gFrameClock;
|
||||
gFrameClock = totalclock;
|
||||
int nTicks = (int)totalclock - lastTick;
|
||||
lastTick = (int)totalclock;
|
||||
int currentclock = I_GetBuildTime();
|
||||
gFrameClock = currentclock;
|
||||
int nTicks = currentclock - lastTick;
|
||||
lastTick = currentclock;
|
||||
at2c -= nTicks;
|
||||
if (at2c <= 0 || at2c > data->at10)
|
||||
{
|
||||
|
@ -207,7 +208,7 @@ void GameInterface::DrawNativeMenuText(int fontnum, int state, double xpos, doub
|
|||
if (!text) return;
|
||||
int shade = (state != NIT_InactiveState) ? 32 : 48;
|
||||
int pal = (state != NIT_InactiveState) ? 5 : 5;
|
||||
if (state == NIT_SelectedState) shade = 32 - ((int)totalclock & 63);
|
||||
if (state == NIT_SelectedState) shade = 32 - (I_GetBuildTime() & 63);
|
||||
auto gamefont = fontnum == NIT_BigFont ? BigFont : fontnum == NIT_SmallFont ? SmallFont : SmallFont2;
|
||||
|
||||
if (flags & LMF_Centered)
|
||||
|
|
|
@ -112,7 +112,7 @@ void CEndGameMgr::Draw(void)
|
|||
DrawMenuCaption(GStrings("TXTB_FRAGSTATS"));
|
||||
gKillMgr.Draw();
|
||||
}
|
||||
if (/*dword_28E3D4 != 1 && */((int)totalclock&32))
|
||||
if (/*dword_28E3D4 != 1 && */(gameclock&32))
|
||||
{
|
||||
viewDrawText(3, GStrings("PRESSKEY"), 160, 134, -128, 0, 1, 1);
|
||||
}
|
||||
|
|
|
@ -99,10 +99,10 @@ void FireInit(void)
|
|||
void FireProcess(void)
|
||||
{
|
||||
static ClockTicks lastUpdate;
|
||||
if (totalclock < lastUpdate || lastUpdate + 2 < totalclock)
|
||||
if (gameclock < lastUpdate || lastUpdate + 2 < gameclock)
|
||||
{
|
||||
DoFireFrame();
|
||||
lastUpdate = totalclock;
|
||||
lastUpdate = gameclock;
|
||||
TileFiles.InvalidateTile(2342);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -35,6 +35,8 @@ BEGIN_BLD_NS
|
|||
bool bVanilla = false;
|
||||
ClockTicks gFrameClock;
|
||||
ClockTicks gFrameTicks;
|
||||
int gameclock;
|
||||
int lastTic;
|
||||
int gFrame;
|
||||
//int volatile gGameClock;
|
||||
int gFrameRate;
|
||||
|
|
|
@ -32,6 +32,8 @@ BEGIN_BLD_NS
|
|||
|
||||
extern ClockTicks gFrameClock;
|
||||
extern ClockTicks gFrameTicks;
|
||||
extern int gameclock;
|
||||
extern int lastTic;
|
||||
extern int gFrame;
|
||||
//extern ClockTicks gGameClock;
|
||||
extern int gFrameRate;
|
||||
|
|
|
@ -525,7 +525,8 @@ bool GameInterface::LoadGame(FSaveGameNode* node)
|
|||
gFrameTicks = 0;
|
||||
gFrame = 0;
|
||||
gFrameRate = 0;
|
||||
totalclock = 0;
|
||||
gameclock = 0;
|
||||
lastTic = -1;
|
||||
paused = 0;
|
||||
ready2send = 1;
|
||||
gamestate = GS_LEVEL;
|
||||
|
@ -618,7 +619,7 @@ void MyLoadSave::Load(void)
|
|||
Read(&gFrameClock, sizeof(gFrameClock));
|
||||
Read(&gFrameTicks, sizeof(gFrameTicks));
|
||||
Read(&gFrame, sizeof(gFrame));
|
||||
Read(&totalclock, sizeof(totalclock));
|
||||
Read(&gameclock, sizeof(gameclock));
|
||||
Read(&gLevelTime, sizeof(gLevelTime));
|
||||
Read(&paused, sizeof(paused));
|
||||
Read(baseWall, sizeof(baseWall[0])*numwalls);
|
||||
|
@ -709,7 +710,7 @@ void MyLoadSave::Save(void)
|
|||
Write(&gFrameClock, sizeof(gFrameClock));
|
||||
Write(&gFrameTicks, sizeof(gFrameTicks));
|
||||
Write(&gFrame, sizeof(gFrame));
|
||||
ClockTicks nGameClock = totalclock;
|
||||
ClockTicks nGameClock = gameclock;
|
||||
Write(&nGameClock, sizeof(nGameClock));
|
||||
Write(&gLevelTime, sizeof(gLevelTime));
|
||||
Write(&paused, sizeof(paused));
|
||||
|
|
|
@ -78,7 +78,8 @@ void netResetToSinglePlayer(void)
|
|||
|
||||
void netReset(void)
|
||||
{
|
||||
gNetFifoClock = gFrameClock = totalclock = 0;
|
||||
gNetFifoClock = gFrameClock = gameclock = 0;
|
||||
lastTic = -1;
|
||||
gNetFifoMasterTail = 0;
|
||||
gPredictTail = 0;
|
||||
gNetFifoTail = 0;
|
||||
|
|
|
@ -4802,10 +4802,10 @@ void playerQavSceneDraw(PLAYER* pPlayer, int a2, double a3, double a4, int a5) {
|
|||
if (pQavScene->qavResrc != NULL) {
|
||||
|
||||
QAV* pQAV = pQavScene->qavResrc;
|
||||
int v4 = (pPlayer->weaponTimer == 0) ? (int)totalclock % pQAV->at10 : pQAV->at10 - pPlayer->weaponTimer;
|
||||
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 && ((int)totalclock & 32))) {
|
||||
if (nInv >= 120 * 8 || (nInv != 0 && (gameclock & 32))) {
|
||||
a2 = -128; flags |= 1;
|
||||
}
|
||||
|
||||
|
|
|
@ -280,7 +280,7 @@ private:
|
|||
if (powerups[i].remainingDuration)
|
||||
{
|
||||
int remainingSeconds = powerups[i].remainingDuration / 100;
|
||||
if (remainingSeconds > warningTime || ((int)totalclock & 32))
|
||||
if (remainingSeconds > warningTime || (gameclock & 32))
|
||||
{
|
||||
DrawStatMaskedSprite(powerups[i].nTile, x, y + powerups[i].yOffset, 0, 0, 256, (int)(65536 * powerups[i].nScaleRatio), DI_SCREEN_LEFT_CENTER);
|
||||
}
|
||||
|
@ -450,7 +450,7 @@ private:
|
|||
{
|
||||
FString gTempStr;
|
||||
int x = 1, y = 1;
|
||||
if (dword_21EFD0[0] == 0 || ((int)totalclock & 8))
|
||||
if (dword_21EFD0[0] == 0 || (gameclock & 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;
|
||||
|
@ -460,7 +460,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 || ((int)totalclock & 8))
|
||||
if (dword_21EFD0[1] == 0 || (gameclock & 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;
|
||||
|
@ -481,7 +481,7 @@ private:
|
|||
{
|
||||
dassert(0 == team || 1 == team); // 0: blue, 1: red
|
||||
|
||||
if (dword_21EFD0[team] == 0 || ((int)totalclock & 8))
|
||||
if (dword_21EFD0[team] == 0 || (gameclock & 8))
|
||||
{
|
||||
dword_21EFD0[team] = dword_21EFD0[team] - arg;
|
||||
if (dword_21EFD0[team] < 0)
|
||||
|
@ -558,7 +558,7 @@ private:
|
|||
DrawStatMaskedSprite(2200, 160, 200, 0, nPalette, RS_CENTERBOTTOM);
|
||||
DrawPackItemInStatusBar(pPlayer, 265, 186, 260, 172);
|
||||
|
||||
if (pXSprite->health >= 16 || ((int)totalclock & 16) || pXSprite->health == 0)
|
||||
if (pXSprite->health >= 16 || (gameclock & 16) || pXSprite->health == 0)
|
||||
{
|
||||
DrawStatNumber("%3d", pXSprite->health >> 4, 2190, 86, 183, 0, 0);
|
||||
}
|
||||
|
@ -632,7 +632,7 @@ private:
|
|||
|
||||
BeginHUD(320, 200, 1);
|
||||
DrawStatSprite(2201, 34, 187 - 200, 16, nPalette);
|
||||
if (pXSprite->health >= 16 || ((int)totalclock & 16) || pXSprite->health == 0)
|
||||
if (pXSprite->health >= 16 || (gameclock & 16) || pXSprite->health == 0)
|
||||
{
|
||||
DrawStatNumber("%3d", pXSprite->health >> 4, 2190, 8, 183 - 200, 0, 0);
|
||||
}
|
||||
|
|
|
@ -168,7 +168,7 @@ void DoSectorLighting(void)
|
|||
{
|
||||
t2 = mulscale16(t2, pXSector->busy);
|
||||
}
|
||||
int v4 = GetWaveValue(t1, pXSector->phase*8+pXSector->freq*(int)totalclock, t2);
|
||||
int v4 = GetWaveValue(t1, pXSector->phase*8+pXSector->freq*gameclock, t2);
|
||||
if (pXSector->shadeFloor)
|
||||
{
|
||||
sector[nSector].floorshade = ClipRange(sector[nSector].floorshade+v4, -128, 127);
|
||||
|
|
|
@ -137,7 +137,7 @@ void sfxUpdate3DSounds(void)
|
|||
|
||||
listener.ListenerObject = gMe->pSprite;
|
||||
soundEngine->SetListener(listener);
|
||||
soundEngine->UpdateSounds((int)totalclock);
|
||||
soundEngine->UpdateSounds(gameclock);
|
||||
}
|
||||
|
||||
FSoundID getSfx(FSoundID soundId, float &attenuation, int &pitch, int &relvol)
|
||||
|
|
|
@ -393,8 +393,8 @@ void CalcOtherPosition(spritetype *pSprite, int *pX, int *pY, int *pZ, int *vsec
|
|||
*pX += mulscale16(vX, othercameradist);
|
||||
*pY += mulscale16(vY, othercameradist);
|
||||
*pZ += mulscale16(vZ, othercameradist);
|
||||
othercameradist = ClipHigh(othercameradist+(((int)(totalclock-othercameraclock))<<10), 65536);
|
||||
othercameraclock = (int)totalclock;
|
||||
othercameradist = ClipHigh(othercameradist+((gameclock-othercameraclock)<<10), 65536);
|
||||
othercameraclock = gameclock;
|
||||
dassert(*vsectnum >= 0 && *vsectnum < kMaxSectors);
|
||||
FindSector(*pX, *pY, *pZ, vsectnum);
|
||||
pSprite->cstat = bakCstat;
|
||||
|
@ -439,8 +439,8 @@ void CalcPosition(spritetype *pSprite, int *pX, int *pY, int *pZ, int *vsectnum,
|
|||
*pX += mulscale16(vX, cameradist);
|
||||
*pY += mulscale16(vY, cameradist);
|
||||
*pZ += mulscale16(vZ, cameradist);
|
||||
cameradist = ClipHigh(cameradist+(((int)(totalclock-cameraclock))<<10), 65536);
|
||||
cameraclock = (int)totalclock;
|
||||
cameradist = ClipHigh(cameradist+((gameclock-cameraclock)<<10), 65536);
|
||||
cameraclock = gameclock;
|
||||
dassert(*vsectnum >= 0 && *vsectnum < kMaxSectors);
|
||||
FindSector(*pX, *pY, *pZ, vsectnum);
|
||||
pSprite->cstat = bakCstat;
|
||||
|
@ -653,15 +653,15 @@ void viewDrawScreen(bool sceneonly)
|
|||
#ifdef USE_OPENGL
|
||||
polymostcenterhoriz = defaultHoriz;
|
||||
#endif
|
||||
ClockTicks delta = totalclock - lastUpdate;
|
||||
ClockTicks delta = gameclock - lastUpdate;
|
||||
if (delta < 0)
|
||||
delta = 0;
|
||||
lastUpdate = totalclock;
|
||||
lastUpdate = gameclock;
|
||||
if (!paused && (!M_Active() || gGameOptions.nGameType != 0))
|
||||
{
|
||||
gInterpolate = CalcSmoothRatio(totalclock, gNetFifoClock - 4, 30);
|
||||
gInterpolate = I_GetTimeFrac() * MaxSmoothRatio;
|
||||
}
|
||||
else gInterpolate = 65536;
|
||||
else gInterpolate = MaxSmoothRatio;
|
||||
|
||||
if (cl_interpolate)
|
||||
{
|
||||
|
@ -782,7 +782,7 @@ void viewDrawScreen(bool sceneonly)
|
|||
}
|
||||
cZ += fix16_to_int(q16horiz * 10);
|
||||
cameradist = -1;
|
||||
cameraclock = (int)totalclock;
|
||||
cameraclock = gameclock;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -806,7 +806,7 @@ void viewDrawScreen(bool sceneonly)
|
|||
else if (v4 && gNetPlayers > 1)
|
||||
{
|
||||
#if 0 // needs to be redone for pure hardware rendering.
|
||||
int tmp = ((int)totalclock / 240) % (gNetPlayers - 1);
|
||||
int tmp = (gameclock / 240) % (gNetPlayers - 1);
|
||||
int i = connecthead;
|
||||
while (1)
|
||||
{
|
||||
|
@ -895,7 +895,7 @@ void viewDrawScreen(bool sceneonly)
|
|||
}
|
||||
else
|
||||
{
|
||||
othercameraclock = (int)totalclock;
|
||||
othercameraclock = gameclock;
|
||||
}
|
||||
|
||||
if (!bDelirium)
|
||||
|
|
|
@ -240,14 +240,14 @@ void WeaponDraw(PLAYER *pPlayer, int a2, double a3, double a4, int a5)
|
|||
QAV * pQAV = weaponQAV[pPlayer->weaponQav];
|
||||
int v4;
|
||||
if (pPlayer->weaponTimer == 0)
|
||||
v4 = (int)totalclock % pQAV->at10;
|
||||
v4 = gameclock % pQAV->at10;
|
||||
else
|
||||
v4 = pQAV->at10 - pPlayer->weaponTimer;
|
||||
pQAV->x = int(a3);
|
||||
pQAV->y = int(a4);
|
||||
int flags = 2;
|
||||
int nInv = powerupCheck(pPlayer, kPwUpShadowCloak);
|
||||
if (nInv >= 120 * 8 || (nInv != 0 && ((int)totalclock & 32)))
|
||||
if (nInv >= 120 * 8 || (nInv != 0 && (gameclock & 32)))
|
||||
{
|
||||
a2 = -128;
|
||||
flags |= 1;
|
||||
|
|
Loading…
Reference in a new issue