- All Games: Migrate each game's clock counter to backend solution.

This commit is contained in:
Mitchell Richters 2021-02-18 21:46:36 +11:00
parent 5ad1d74f62
commit 2abda0e27d
47 changed files with 158 additions and 165 deletions

View file

@ -154,6 +154,8 @@ bool pausedWithKey;
bool gamesetinput = false; bool gamesetinput = false;
int PlayClock;
CUSTOM_CVAR(Int, cl_gender, 0, CVAR_ARCHIVE | CVAR_GLOBALCONFIG) CUSTOM_CVAR(Int, cl_gender, 0, CVAR_ARCHIVE | CVAR_GLOBALCONFIG)
{ {
if (self < 0 || self > 3) self = 0; if (self < 0 || self > 3) self = 0;

View file

@ -232,4 +232,5 @@ extern int chatmodeon;
extern bool sendPause; extern bool sendPause;
extern int lastTic; extern int lastTic;
extern int PlayClock;

View file

@ -2912,7 +2912,7 @@ void actKillDude(int nKillerSprite, spritetype *pSprite, DAMAGE_TYPE damageType,
aiGenDudeNewState(pSprite, &genDudeBurnGoto); aiGenDudeNewState(pSprite, &genDudeBurnGoto);
actHealDude(pXSprite, dudeInfo[55].startHealth, dudeInfo[55].startHealth); actHealDude(pXSprite, dudeInfo[55].startHealth, dudeInfo[55].startHealth);
if (pXSprite->burnTime <= 0) pXSprite->burnTime = 1200; if (pXSprite->burnTime <= 0) pXSprite->burnTime = 1200;
gDudeExtra[pSprite->extra].time = gFrameClock + 360; gDudeExtra[pSprite->extra].time = PlayClock + 360;
return; return;
} }
@ -3547,9 +3547,9 @@ int actDamageSprite(int nSource, spritetype *pSprite, DAMAGE_TYPE damageType, in
case kThingBloodBits: case kThingBloodBits:
case kThingBloodChunks: case kThingBloodChunks:
case kThingZombieHead: case kThingZombieHead:
if (damageType == 3 && pSourcePlayer && gFrameClock > pSourcePlayer->laughCount && Chance(0x4000)) { if (damageType == 3 && pSourcePlayer && PlayClock > pSourcePlayer->laughCount && Chance(0x4000)) {
sfxPlay3DSound(pSourcePlayer->pSprite, gPlayerGibThingComments[Random(10)], 0, 2); sfxPlay3DSound(pSourcePlayer->pSprite, gPlayerGibThingComments[Random(10)], 0, 2);
pSourcePlayer->laughCount = gFrameClock+3600; pSourcePlayer->laughCount = PlayClock+3600;
} }
break; break;
case kTrapMachinegun: case kTrapMachinegun:
@ -4187,8 +4187,8 @@ void ProcessTouchObjects(spritetype *pSprite, int nXSprite)
switch (pSprite2->type) { switch (pSprite2->type) {
case kThingKickablePail: case kThingKickablePail:
if (pPlayer) { if (pPlayer) {
if (pPlayer->kickPower > gFrameClock) return; if (pPlayer->kickPower > PlayClock) return;
pPlayer->kickPower = gFrameClock+60; pPlayer->kickPower = PlayClock+60;
} }
actKickObject(pSprite, pSprite2); actKickObject(pSprite, pSprite2);
sfxPlay3DSound(pSprite->x, pSprite->y, pSprite->z, 357, pSprite->sectnum); sfxPlay3DSound(pSprite->x, pSprite->y, pSprite->z, 357, pSprite->sectnum);
@ -4196,8 +4196,8 @@ void ProcessTouchObjects(spritetype *pSprite, int nXSprite)
break; break;
case kThingZombieHead: case kThingZombieHead:
if (pPlayer) { if (pPlayer) {
if (pPlayer->kickPower > gFrameClock) return; if (pPlayer->kickPower > PlayClock) return;
pPlayer->kickPower = gFrameClock+60; pPlayer->kickPower = PlayClock+60;
} }
actKickObject(pSprite, pSprite2); actKickObject(pSprite, pSprite2);
sfxPlay3DSound(pSprite->x, pSprite->y, pSprite->z, 357, pSprite->sectnum); sfxPlay3DSound(pSprite->x, pSprite->y, pSprite->z, 357, pSprite->sectnum);
@ -4377,9 +4377,9 @@ int MoveThing(spritetype *pSprite)
spritetype *pFX = gFX.fxSpawn(FX_27, pSprite->sectnum, pSprite->x, pSprite->y, pSprite->z, 0); spritetype *pFX = gFX.fxSpawn(FX_27, pSprite->sectnum, pSprite->x, pSprite->y, pSprite->z, 0);
if (pFX) if (pFX)
{ {
int v34 = (gFrameClock*3)&2047; int v34 = (PlayClock*3)&2047;
int v30 = (gFrameClock*5)&2047; int v30 = (PlayClock*5)&2047;
int vbx = (gFrameClock*11)&2047; int vbx = (PlayClock*11)&2047;
int v2c = 0x44444; int v2c = 0x44444;
int v28 = 0; int v28 = 0;
int v24 = 0; int v24 = 0;
@ -5407,7 +5407,7 @@ void actProcessSprites(void)
case kThingBloodBits: case kThingBloodBits:
case kThingBloodChunks: case kThingBloodChunks:
case kThingZombieHead: case kThingZombieHead:
if (pXSprite->locked && gFrameClock >= pXSprite->targetX) pXSprite->locked = 0; if (pXSprite->locked && PlayClock >= pXSprite->targetX) pXSprite->locked = 0;
break; break;
} }
@ -6210,7 +6210,7 @@ spritetype * actSpawnThing(int nSector, int x, int y, int z, int nThingType)
pXThing->data2 = 0; pXThing->data2 = 0;
pXThing->data3 = 0; pXThing->data3 = 0;
pXThing->data4 = 318; pXThing->data4 = 318;
pXThing->targetX = gFrameClock+180; pXThing->targetX = PlayClock+180;
pXThing->locked = 1; pXThing->locked = 1;
pXThing->state = 1; pXThing->state = 1;
pXThing->triggerOnce = 0; pXThing->triggerOnce = 0;
@ -6222,7 +6222,7 @@ spritetype * actSpawnThing(int nSector, int x, int y, int z, int nThingType)
pXThing->data2 = 0; pXThing->data2 = 0;
pXThing->data3 = 0; pXThing->data3 = 0;
pXThing->data4 = 318; pXThing->data4 = 318;
pXThing->targetX = gFrameClock+180; pXThing->targetX = PlayClock+180;
pXThing->locked = 1; pXThing->locked = 1;
pXThing->state = 1; pXThing->state = 1;
pXThing->triggerOnce = 0; pXThing->triggerOnce = 0;
@ -6813,7 +6813,7 @@ void DudeToGibCallback1(int, DBloodActor* actor)
pXSprite->triggerOnce = 0; pXSprite->triggerOnce = 0;
pXSprite->isTriggered = 0; pXSprite->isTriggered = 0;
pXSprite->locked = 0; pXSprite->locked = 0;
pXSprite->targetX = gFrameClock; pXSprite->targetX = PlayClock;
pXSprite->state = 1; pXSprite->state = 1;
} }
@ -6830,7 +6830,7 @@ void DudeToGibCallback2(int, DBloodActor* actor)
pXSprite->triggerOnce = 0; pXSprite->triggerOnce = 0;
pXSprite->isTriggered = 0; pXSprite->isTriggered = 0;
pXSprite->locked = 0; pXSprite->locked = 0;
pXSprite->targetX = gFrameClock; pXSprite->targetX = PlayClock;
pXSprite->state = 1; pXSprite->state = 1;
} }

View file

@ -55,12 +55,12 @@ void aiPlay3DSound(spritetype *pSprite, int a2, AI_SFX_PRIORITY a3, int a4)
DUDEEXTRA *pDudeExtra = &gDudeExtra[pSprite->extra]; DUDEEXTRA *pDudeExtra = &gDudeExtra[pSprite->extra];
if (a3 == AI_SFX_PRIORITY_0) if (a3 == AI_SFX_PRIORITY_0)
sfxPlay3DSound(pSprite, a2, a4, 2); sfxPlay3DSound(pSprite, a2, a4, 2);
else if (a3 > pDudeExtra->prio || pDudeExtra->time <= gFrameClock) else if (a3 > pDudeExtra->prio || pDudeExtra->time <= PlayClock)
{ {
sfxKill3DSound(pSprite, -1, -1); sfxKill3DSound(pSprite, -1, -1);
sfxPlay3DSound(pSprite, a2, a4, 0); sfxPlay3DSound(pSprite, a2, a4, 0);
pDudeExtra->prio = a3; pDudeExtra->prio = a3;
pDudeExtra->time = gFrameClock+120; pDudeExtra->time = PlayClock+120;
} }
} }
@ -925,7 +925,7 @@ int aiDamageSprite(spritetype *pSprite, XSPRITE *pXSprite, int nSource, DAMAGE_T
aiNewState(actor, &cultistBurnGoto); aiNewState(actor, &cultistBurnGoto);
aiPlay3DSound(pSprite, 361, AI_SFX_PRIORITY_0, -1); aiPlay3DSound(pSprite, 361, AI_SFX_PRIORITY_0, -1);
aiPlay3DSound(pSprite, 1031+Random(2), AI_SFX_PRIORITY_2, -1); aiPlay3DSound(pSprite, 1031+Random(2), AI_SFX_PRIORITY_2, -1);
gDudeExtra[pSprite->extra].time = gFrameClock+360; gDudeExtra[pSprite->extra].time = PlayClock+360;
actHealDude(pXSprite, dudeInfo[40].startHealth, dudeInfo[40].startHealth); actHealDude(pXSprite, dudeInfo[40].startHealth, dudeInfo[40].startHealth);
evKill(nSprite, 3, kCallbackFXFlameLick); evKill(nSprite, 3, kCallbackFXFlameLick);
} }
@ -936,16 +936,16 @@ int aiDamageSprite(spritetype *pSprite, XSPRITE *pXSprite, int nSource, DAMAGE_T
pSprite->type = kDudeBurningInnocent; pSprite->type = kDudeBurningInnocent;
aiNewState(actor, &cultistBurnGoto); aiNewState(actor, &cultistBurnGoto);
aiPlay3DSound(pSprite, 361, AI_SFX_PRIORITY_0, -1); aiPlay3DSound(pSprite, 361, AI_SFX_PRIORITY_0, -1);
gDudeExtra[pSprite->extra].time = gFrameClock+360; gDudeExtra[pSprite->extra].time = PlayClock+360;
actHealDude(pXSprite, dudeInfo[39].startHealth, dudeInfo[39].startHealth); actHealDude(pXSprite, dudeInfo[39].startHealth, dudeInfo[39].startHealth);
evKill(nSprite, 3, kCallbackFXFlameLick); evKill(nSprite, 3, kCallbackFXFlameLick);
} }
break; break;
case kDudeBurningCultist: case kDudeBurningCultist:
if (Chance(0x4000) && gDudeExtra[pSprite->extra].time < gFrameClock) if (Chance(0x4000) && gDudeExtra[pSprite->extra].time < PlayClock)
{ {
aiPlay3DSound(pSprite, 1031+Random(2), AI_SFX_PRIORITY_2, -1); aiPlay3DSound(pSprite, 1031+Random(2), AI_SFX_PRIORITY_2, -1);
gDudeExtra[pSprite->extra].time = gFrameClock+360; gDudeExtra[pSprite->extra].time = PlayClock+360;
} }
if (Chance(0x600) && (pXSprite->medium == kMediumWater || pXSprite->medium == kMediumGoo)) if (Chance(0x600) && (pXSprite->medium == kMediumWater || pXSprite->medium == kMediumGoo))
{ {
@ -979,16 +979,16 @@ int aiDamageSprite(spritetype *pSprite, XSPRITE *pXSprite, int nSource, DAMAGE_T
pSprite->type = kDudeBurningInnocent; pSprite->type = kDudeBurningInnocent;
aiNewState(actor, &cultistBurnGoto); aiNewState(actor, &cultistBurnGoto);
aiPlay3DSound(pSprite, 361, AI_SFX_PRIORITY_0, -1); aiPlay3DSound(pSprite, 361, AI_SFX_PRIORITY_0, -1);
gDudeExtra[pSprite->extra].time = gFrameClock+360; gDudeExtra[pSprite->extra].time = PlayClock+360;
actHealDude(pXSprite, dudeInfo[39].startHealth, dudeInfo[39].startHealth); actHealDude(pXSprite, dudeInfo[39].startHealth, dudeInfo[39].startHealth);
evKill(nSprite, 3, kCallbackFXFlameLick); evKill(nSprite, 3, kCallbackFXFlameLick);
} }
break; break;
#ifdef NOONE_EXTENSIONS #ifdef NOONE_EXTENSIONS
case kDudeModernCustomBurning: case kDudeModernCustomBurning:
if (Chance(0x2000) && gDudeExtra[pSprite->extra].time < gFrameClock) { if (Chance(0x2000) && gDudeExtra[pSprite->extra].time < PlayClock) {
playGenDudeSound(pSprite, kGenDudeSndBurning); playGenDudeSound(pSprite, kGenDudeSndBurning);
gDudeExtra[pSprite->extra].time = gFrameClock + 360; gDudeExtra[pSprite->extra].time = PlayClock + 360;
} }
if (pXSprite->burnTime == 0) pXSprite->burnTime = 2400; if (pXSprite->burnTime == 0) pXSprite->burnTime = 2400;
if (spriteIsUnderwater(pSprite, false)) { if (spriteIsUnderwater(pSprite, false)) {
@ -1028,7 +1028,7 @@ int aiDamageSprite(spritetype *pSprite, XSPRITE *pXSprite, int nSource, DAMAGE_T
aiGenDudeNewState(pSprite, &genDudeBurnGoto); aiGenDudeNewState(pSprite, &genDudeBurnGoto);
actHealDude(pXSprite, dudeInfo[55].startHealth, dudeInfo[55].startHealth); actHealDude(pXSprite, dudeInfo[55].startHealth, dudeInfo[55].startHealth);
gDudeExtra[pSprite->extra].time = gFrameClock + 360; gDudeExtra[pSprite->extra].time = PlayClock + 360;
evKill(nSprite, 3, kCallbackFXFlameLick); evKill(nSprite, 3, kCallbackFXFlameLick);
} }

View file

@ -490,7 +490,7 @@ static void unicultThinkChase(DBloodActor* actor)
// is the target visible? // is the target visible?
if (dist < pDudeInfo->seeDist && abs(losAngle) <= pDudeInfo->periphery) { if (dist < pDudeInfo->seeDist && abs(losAngle) <= pDudeInfo->periphery) {
if ((gFrameClock & 64) == 0 && Chance(0x3000) && !spriteIsUnderwater(pSprite, false)) if ((PlayClock & 64) == 0 && Chance(0x3000) && !spriteIsUnderwater(pSprite, false))
playGenDudeSound(pSprite, kGenDudeSndChasing); playGenDudeSound(pSprite, kGenDudeSndChasing);
actor->dudeSlope = DivScale(pTarget->z - pSprite->z, dist, 10); actor->dudeSlope = DivScale(pTarget->z - pSprite->z, dist, 10);

View file

@ -133,7 +133,7 @@ static tspritetype *viewAddEffect(int nTSprite, VIEW_EFFECT nViewEffect)
for (int i = 0; i < 16; i++) for (int i = 0; i < 16; i++)
{ {
auto pNSprite = viewInsertTSprite(pTSprite->sectnum, 32767, pTSprite); auto pNSprite = viewInsertTSprite(pTSprite->sectnum, 32767, pTSprite);
int ang = (gFrameClock*2048)/120; int ang = (PlayClock*2048)/120;
int nRand1 = dword_172CE0[i][0]; int nRand1 = dword_172CE0[i][0];
int nRand2 = dword_172CE0[i][1]; int nRand2 = dword_172CE0[i][1];
int nRand3 = dword_172CE0[i][2]; int nRand3 = dword_172CE0[i][2];
@ -432,7 +432,7 @@ static void viewApplyDefaultPal(tspritetype *pTSprite, sectortype const *pSector
void viewProcessSprites(int32_t cX, int32_t cY, int32_t cZ, int32_t cA, int32_t smoothratio) void viewProcessSprites(int32_t cX, int32_t cY, int32_t cZ, int32_t cA, int32_t smoothratio)
{ {
// shift before interpolating to increase precision. // shift before interpolating to increase precision.
int myclock = (gFrameClock<<3) + MulScale(4<<3, smoothratio, 16); int myclock = (PlayClock<<3) + MulScale(4<<3, smoothratio, 16);
assert(spritesortcnt <= maxspritesonscreen); assert(spritesortcnt <= maxspritesonscreen);
gCameraAng = cA; gCameraAng = cA;
int nViewSprites = spritesortcnt; int nViewSprites = spritesortcnt;

View file

@ -83,7 +83,7 @@ void StartLevel(MapRecord* level)
{ {
if (!level) return; if (!level) return;
gFrameCount = 0; gFrameCount = 0;
gFrameClock = 0; PlayClock = 0;
STAT_Update(0); STAT_Update(0);
EndLevel(); EndLevel();
inputState.ClearAllInput(); inputState.ClearAllInput();
@ -291,7 +291,7 @@ void GameInterface::Ticker()
} }
trProcessBusy(); trProcessBusy();
evProcess(gFrameClock); evProcess(PlayClock);
seqProcess(4); seqProcess(4);
DoSectorPanning(); DoSectorPanning();
@ -320,8 +320,8 @@ void GameInterface::Ticker()
thinktime.Unclock(); thinktime.Unclock();
gFrameCount++; gFrameCount++;
gFrameClock += kTicsPerFrame; PlayClock += kTicsPerFrame;
if (gFrameClock == 8) gameaction = ga_autosave; // let the game run for 1 frame before saving. if (PlayClock == 8) gameaction = ga_autosave; // let the game run for 1 frame before saving.
for (int i = 0; i < 8; i++) for (int i = 0; i < 8; i++)
{ {

View file

@ -50,7 +50,7 @@ void CChoke::animateChoke(int x, int y, int smoothratio)
{ {
if (!qav) if (!qav)
return; return;
int myclock = gFrameClock + MulScale(4, smoothratio, 16); int myclock = PlayClock + MulScale(4, smoothratio, 16);
qav->x = x; qav->x = x;
qav->y = y; qav->y = y;
int vd = myclock - time; int vd = myclock - time;

View file

@ -84,9 +84,9 @@ void CGameMenuItemQAV::Draw(void)
if (raw.Size() > 0) if (raw.Size() > 0)
{ {
auto data = (QAV*)raw.Data(); auto data = (QAV*)raw.Data();
int backFC = gFrameClock; int backFC = PlayClock;
int currentclock = I_GetBuildTime(); int currentclock = I_GetBuildTime();
gFrameClock = currentclock; PlayClock = currentclock;
int nTicks = currentclock - lastTick; int nTicks = currentclock - lastTick;
lastTick = currentclock; lastTick = currentclock;
duration -= nTicks; duration -= nTicks;
@ -111,7 +111,7 @@ void CGameMenuItemQAV::Draw(void)
else else
data->Draw(data->duration - duration, 10, 0, 0, false); data->Draw(data->duration - duration, 10, 0, 0, false);
gFrameClock = backFC; PlayClock = backFC;
} }
} }

View file

@ -514,13 +514,13 @@ void evPost(int nIndex, int nType, unsigned int nDelta, COMMAND_ID command)
assert(command != kCmdCallback); assert(command != kCmdCallback);
if (command == kCmdState) command = evGetSourceState(nType, nIndex) ? kCmdOn : kCmdOff; if (command == kCmdState) command = evGetSourceState(nType, nIndex) ? kCmdOn : kCmdOff;
else if (command == kCmdNotState) command = evGetSourceState(nType, nIndex) ? kCmdOff : kCmdOn; else if (command == kCmdNotState) command = evGetSourceState(nType, nIndex) ? kCmdOff : kCmdOn;
EVENT evn = { (int16_t)nIndex, (int8_t)nType, (int8_t)command, 0, gFrameClock + (int)nDelta }; EVENT evn = { (int16_t)nIndex, (int8_t)nType, (int8_t)command, 0, PlayClock + (int)nDelta };
queue.insert(evn); queue.insert(evn);
} }
void evPost(int nIndex, int nType, unsigned int nDelta, CALLBACK_ID callback) void evPost(int nIndex, int nType, unsigned int nDelta, CALLBACK_ID callback)
{ {
EVENT evn = { (int16_t)nIndex, (int8_t)nType, kCmdCallback, (int16_t)callback, gFrameClock + (int)nDelta }; EVENT evn = { (int16_t)nIndex, (int8_t)nType, kCmdCallback, (int16_t)callback, PlayClock + (int)nDelta };
queue.insert(evn); queue.insert(evn);
} }

View file

@ -31,7 +31,6 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
BEGIN_BLD_NS BEGIN_BLD_NS
int gFrameClock;
int gFrameCount; int gFrameCount;
int32_t gDetail = 4; int32_t gDetail = 4;

View file

@ -30,7 +30,6 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
BEGIN_BLD_NS BEGIN_BLD_NS
extern int gFrameClock;
extern int gFrameCount; extern int gFrameCount;
enum { MAXPLAYERNAME = 16 }; enum { MAXPLAYERNAME = 16 };

View file

@ -624,7 +624,7 @@ void SerializeState(FSerializer& arc)
arc.Array("sector_filler", qsector_filler, numsectors) arc.Array("sector_filler", qsector_filler, numsectors)
("visibility", gVisibility) ("visibility", gVisibility)
("frameclock", gFrameClock) ("frameclock", PlayClock)
("framecount", gFrameCount) ("framecount", gFrameCount)
.Array("basewall", baseWall, numwalls) .Array("basewall", baseWall, numwalls)
.SparseArray("basesprite", baseSprite, kMaxSprites, activeSprites) .SparseArray("basesprite", baseSprite, kMaxSprites, activeSprites)

View file

@ -4630,7 +4630,7 @@ void useTargetChanger(XSPRITE* pXSource, spritetype* pSprite) {
return; return;
} }
// lets try to look for target that fits better by distance // lets try to look for target that fits better by distance
else if ((gFrameClock & 256) != 0 && (pXSprite->target < 0 || aiFightGetTargetDist(pSprite, pDudeInfo, pTarget) >= mDist)) { else if ((PlayClock & 256) != 0 && (pXSprite->target < 0 || aiFightGetTargetDist(pSprite, pDudeInfo, pTarget) >= mDist)) {
pTarget = aiFightGetTargetInRange(pSprite, 0, mDist, pXSource->data1, pXSource->data2); pTarget = aiFightGetTargetInRange(pSprite, 0, mDist, pXSource->data1, pXSource->data2);
if (pTarget != NULL) { if (pTarget != NULL) {
pXTarget = &xsprite[pTarget->extra]; pXTarget = &xsprite[pTarget->extra];
@ -4660,7 +4660,7 @@ void useTargetChanger(XSPRITE* pXSource, spritetype* pSprite) {
} }
} }
if ((pXSprite->target < 0 || pPlayer != NULL) && (gFrameClock & 32) != 0) { if ((pXSprite->target < 0 || pPlayer != NULL) && (PlayClock & 32) != 0) {
// try find first target that dude can see // try find first target that dude can see
int nSprite; int nSprite;
StatIterator it(kStatDude); StatIterator it(kStatDude);
@ -4708,7 +4708,7 @@ void useTargetChanger(XSPRITE* pXSource, spritetype* pSprite) {
} }
// got no target - let's ask mates if they have targets // got no target - let's ask mates if they have targets
if ((pXSprite->target < 0 || pPlayer != NULL) && pXSource->data2 == 1 && (gFrameClock & 64) != 0) { if ((pXSprite->target < 0 || pPlayer != NULL) && pXSource->data2 == 1 && (PlayClock & 64) != 0) {
spritetype* pMateTarget = NULL; spritetype* pMateTarget = NULL;
if ((pMateTarget = aiFightGetMateTargets(pXSprite)) != NULL && pMateTarget->extra > 0) { if ((pMateTarget = aiFightGetMateTargets(pXSprite)) != NULL && pMateTarget->extra > 0) {
XSPRITE* pXMateTarget = &xsprite[pMateTarget->extra]; XSPRITE* pXMateTarget = &xsprite[pMateTarget->extra];
@ -4846,10 +4846,10 @@ void playerQavSceneDraw(PLAYER* pPlayer, int a2, double a3, double a4, int a5, i
if (pQavScene->qavResrc != NULL) { if (pQavScene->qavResrc != NULL) {
QAV* pQAV = pQavScene->qavResrc; QAV* pQAV = pQavScene->qavResrc;
int v4 = (pPlayer->weaponTimer == 0) ? ((gFrameClock + MulScale(4, smoothratio, 16)) % pQAV->duration) : pQAV->duration - pPlayer->weaponTimer; int v4 = (pPlayer->weaponTimer == 0) ? ((PlayClock + MulScale(4, smoothratio, 16)) % pQAV->duration) : pQAV->duration - pPlayer->weaponTimer;
int flags = 2; int nInv = powerupCheck(pPlayer, kPwUpShadowCloak); int flags = 2; int nInv = powerupCheck(pPlayer, kPwUpShadowCloak);
if (nInv >= 120 * 8 || (nInv != 0 && (gFrameClock & 32))) { if (nInv >= 120 * 8 || (nInv != 0 && (PlayClock & 32))) {
a2 = -128; flags |= 1; a2 = -128; flags |= 1;
} }

View file

@ -37,7 +37,7 @@ int qanimateoffs(int a1, int a2)
int frames = picanm[a1].num; int frames = picanm[a1].num;
if (frames > 0) if (frames > 0)
{ {
int const frameClock = gFrameClock; int const frameClock = PlayClock;
int vd; int vd;
if ((a2&0xc000) == 0x8000) if ((a2&0xc000) == 0x8000)
vd = (Bcrc32(&a2, 2, 0)+frameClock)>>(picanm[a1].sf&PICANM_ANIMSPEED_MASK); vd = (Bcrc32(&a2, 2, 0)+frameClock)>>(picanm[a1].sf&PICANM_ANIMSPEED_MASK);

View file

@ -313,7 +313,7 @@ private:
if (powerups[i].remainingDuration) if (powerups[i].remainingDuration)
{ {
int remainingSeconds = powerups[i].remainingDuration / 100; int remainingSeconds = powerups[i].remainingDuration / 100;
if (remainingSeconds > warningTime || (gFrameClock & 32)) if (remainingSeconds > warningTime || (PlayClock & 32))
{ {
DrawStatMaskedSprite(powerups[i].nTile, x, y + powerups[i].yOffset, 0, 0, 256, (int)(65536 * powerups[i].nScaleRatio), DI_SCREEN_LEFT_CENTER); DrawStatMaskedSprite(powerups[i].nTile, x, y + powerups[i].yOffset, 0, 0, 256, (int)(65536 * powerups[i].nScaleRatio), DI_SCREEN_LEFT_CENTER);
} }
@ -476,14 +476,14 @@ private:
{ {
FString gTempStr; FString gTempStr;
int x = 1, y = 1; int x = 1, y = 1;
if (team_ticker[0] == 0 || (gFrameClock & 8)) if (team_ticker[0] == 0 || (PlayClock & 8))
{ {
SBar_DrawString(this, smallf, GStrings("TXT_COLOR_BLUE"), x, y, 0, CR_LIGHTBLUE, 1., -1, -1, 1, 1); SBar_DrawString(this, smallf, GStrings("TXT_COLOR_BLUE"), x, y, 0, CR_LIGHTBLUE, 1., -1, -1, 1, 1);
gTempStr.Format("%-3d", team_score[0]); gTempStr.Format("%-3d", team_score[0]);
SBar_DrawString(this, smallf, gTempStr, x, y + 10, 0, CR_LIGHTBLUE, 1., -1, -1, 1, 1); SBar_DrawString(this, smallf, gTempStr, x, y + 10, 0, CR_LIGHTBLUE, 1., -1, -1, 1, 1);
} }
x = -2; x = -2;
if (team_ticker[1] == 0 || (gFrameClock & 8)) if (team_ticker[1] == 0 || (PlayClock & 8))
{ {
SBar_DrawString(this, smallf, GStrings("TXT_COLOR_RED"), x, y, DI_TEXT_ALIGN_RIGHT, CR_BRICK, 1., -1, -1, 1, 1); SBar_DrawString(this, smallf, GStrings("TXT_COLOR_RED"), x, y, DI_TEXT_ALIGN_RIGHT, CR_BRICK, 1., -1, -1, 1, 1);
gTempStr.Format("%3d", team_score[1]); gTempStr.Format("%3d", team_score[1]);
@ -501,7 +501,7 @@ private:
{ {
assert(0 == team || 1 == team); // 0: blue, 1: red assert(0 == team || 1 == team); // 0: blue, 1: red
if (team_ticker[team] == 0 || (gFrameClock & 8)) if (team_ticker[team] == 0 || (PlayClock & 8))
{ {
if (show) if (show)
DrawStatNumber("%d", team_score[team], kSBarNumberInv, -30, team ? 25 : -10, 0, team ? 2 : 10, 512, 65536 * 0.75, DI_SCREEN_RIGHT_CENTER); DrawStatNumber("%d", team_score[team], kSBarNumberInv, -30, team ? 25 : -10, 0, team ? 2 : 10, 512, 65536 * 0.75, DI_SCREEN_RIGHT_CENTER);
@ -574,7 +574,7 @@ private:
DrawStatMaskedSprite(2200, 160, 200, 0, nPalette, RS_CENTERBOTTOM); DrawStatMaskedSprite(2200, 160, 200, 0, nPalette, RS_CENTERBOTTOM);
DrawPackItemInStatusBar(pPlayer, 265, 186, 260, 172); DrawPackItemInStatusBar(pPlayer, 265, 186, 260, 172);
if (pXSprite->health >= 16 || (gFrameClock & 16) || pXSprite->health == 0) if (pXSprite->health >= 16 || (PlayClock & 16) || pXSprite->health == 0)
{ {
DrawStatNumber("%3d", pXSprite->health >> 4, 2190, 86, 183, 0, 0); DrawStatNumber("%3d", pXSprite->health >> 4, 2190, 86, 183, 0, 0);
} }
@ -648,7 +648,7 @@ private:
BeginHUD(320, 200, 1); BeginHUD(320, 200, 1);
DrawStatSprite(2201, 34, 187 - 200, 16, nPalette); DrawStatSprite(2201, 34, 187 - 200, 16, nPalette);
if (pXSprite->health >= 16 || (gFrameClock & 16) || pXSprite->health == 0) if (pXSprite->health >= 16 || (PlayClock & 16) || pXSprite->health == 0)
{ {
DrawStatNumber("%3d", pXSprite->health >> 4, 2190, 8, 183 - 200, 0, 0); DrawStatNumber("%3d", pXSprite->health >> 4, 2190, 8, 183 - 200, 0, 0);
} }

View file

@ -163,7 +163,7 @@ void DoSectorLighting(void)
{ {
t2 = MulScale(t2, pXSector->busy, 16); t2 = MulScale(t2, pXSector->busy, 16);
} }
int v4 = GetWaveValue(t1, pXSector->phase*8+pXSector->freq*gFrameClock, t2); int v4 = GetWaveValue(t1, pXSector->phase*8+pXSector->freq*PlayClock, t2);
if (pXSector->shadeFloor) if (pXSector->shadeFloor)
{ {
sector[nSector].floorshade = ClipRange(sector[nSector].floorshade+v4, -128, 127); sector[nSector].floorshade = ClipRange(sector[nSector].floorshade+v4, -128, 127);

View file

@ -237,7 +237,7 @@ void CalcOtherPosition(spritetype *pSprite, int *pX, int *pY, int *pZ, int *vsec
*pX += MulScale(vX, othercameradist, 16); *pX += MulScale(vX, othercameradist, 16);
*pY += MulScale(vY, othercameradist, 16); *pY += MulScale(vY, othercameradist, 16);
*pZ += MulScale(vZ, othercameradist, 16); *pZ += MulScale(vZ, othercameradist, 16);
int myclock = gFrameClock + MulScale(4, smoothratio, 16); int myclock = PlayClock + MulScale(4, smoothratio, 16);
othercameradist = ClipHigh(othercameradist+((myclock-othercameraclock)<<10), 65536); othercameradist = ClipHigh(othercameradist+((myclock-othercameraclock)<<10), 65536);
othercameraclock = myclock; othercameraclock = myclock;
assert(*vsectnum >= 0 && *vsectnum < kMaxSectors); assert(*vsectnum >= 0 && *vsectnum < kMaxSectors);
@ -284,7 +284,7 @@ void CalcPosition(spritetype *pSprite, int *pX, int *pY, int *pZ, int *vsectnum,
*pX += MulScale(vX, cameradist, 16); *pX += MulScale(vX, cameradist, 16);
*pY += MulScale(vY, cameradist, 16); *pY += MulScale(vY, cameradist, 16);
*pZ += MulScale(vZ, cameradist, 16); *pZ += MulScale(vZ, cameradist, 16);
int myclock = gFrameClock + MulScale(4, smoothratio, 16); int myclock = PlayClock + MulScale(4, smoothratio, 16);
cameradist = ClipHigh(cameradist+((myclock-cameraclock)<<10), 65536); cameradist = ClipHigh(cameradist+((myclock-cameraclock)<<10), 65536);
cameraclock = myclock; cameraclock = myclock;
assert(*vsectnum >= 0 && *vsectnum < kMaxSectors); assert(*vsectnum >= 0 && *vsectnum < kMaxSectors);
@ -408,7 +408,7 @@ void viewUpdateDelirium(void)
if ((powerCount = powerupCheck(gView, kPwUpDeliriumShroom)) != 0) if ((powerCount = powerupCheck(gView, kPwUpDeliriumShroom)) != 0)
{ {
int tilt1 = 170, tilt2 = 170, pitch = 20; int tilt1 = 170, tilt2 = 170, pitch = 20;
int timer = gFrameClock*4; int timer = PlayClock*4;
if (powerCount < 512) if (powerCount < 512)
{ {
int powerScale = IntToFixed(powerCount) / 512; int powerScale = IntToFixed(powerCount) / 512;
@ -633,7 +633,7 @@ void viewDrawScreen(bool sceneonly)
} }
cZ += xs_CRoundToInt(cH.asq16() / 6553.6); cZ += xs_CRoundToInt(cH.asq16() / 6553.6);
cameradist = -1; cameradist = -1;
cameraclock = gFrameClock +MulScale(4, (int)gInterpolate, 16); cameraclock = PlayClock +MulScale(4, (int)gInterpolate, 16);
} }
else else
{ {
@ -657,7 +657,7 @@ void viewDrawScreen(bool sceneonly)
else if (v4 && gNetPlayers > 1) else if (v4 && gNetPlayers > 1)
{ {
#if 0 // needs to be redone for pure hardware rendering. #if 0 // needs to be redone for pure hardware rendering.
int tmp = (gFrameClock / 240) % (gNetPlayers - 1); int tmp = (PlayClock / 240) % (gNetPlayers - 1);
int i = connecthead; int i = connecthead;
while (1) while (1)
{ {
@ -669,7 +669,7 @@ void viewDrawScreen(bool sceneonly)
tmp--; tmp--;
} }
PLAYER* pOther = &gPlayer[i]; PLAYER* pOther = &gPlayer[i];
//othercameraclock = gFrameClock + MulScale(4, (int)gInterpolate, 16);; //othercameraclock = PlayClock + MulScale(4, (int)gInterpolate, 16);;
if (!tileData(4079)) if (!tileData(4079))
{ {
TileFiles.tileCreate(4079, 128, 128); TileFiles.tileCreate(4079, 128, 128);
@ -746,7 +746,7 @@ void viewDrawScreen(bool sceneonly)
} }
else else
{ {
othercameraclock = gFrameClock + MulScale(4, (int)gInterpolate, 16); othercameraclock = PlayClock + MulScale(4, (int)gInterpolate, 16);
} }
if (!bDelirium) if (!bDelirium)

View file

@ -268,7 +268,7 @@ void WeaponDraw(PLAYER *pPlayer, int shade, double xpos, double ypos, int palnum
// Double shotgun fix from BloodGDX. // Double shotgun fix from BloodGDX.
if (/*!IsOriginalDemo() &&*/ (pPlayer->weaponState == -1 || (pPlayer->curWeapon == 3 && pPlayer->weaponState == 7)) && isOriginalQAV()) if (/*!IsOriginalDemo() &&*/ (pPlayer->weaponState == -1 || (pPlayer->curWeapon == 3 && pPlayer->weaponState == 7)) && isOriginalQAV())
duration = pQAV->duration - 1; duration = pQAV->duration - 1;
else duration = (gFrameClock + MulScale(4, smoothratio, 16)) % pQAV->duration; else duration = (PlayClock + MulScale(4, smoothratio, 16)) % pQAV->duration;
} }
else duration = pQAV->duration - pPlayer->weaponTimer; else duration = pQAV->duration - pPlayer->weaponTimer;
@ -276,7 +276,7 @@ void WeaponDraw(PLAYER *pPlayer, int shade, double xpos, double ypos, int palnum
pQAV->y = int(ypos); pQAV->y = int(ypos);
int flags = 2; int flags = 2;
int nInv = powerupCheck(pPlayer, kPwUpShadowCloak); int nInv = powerupCheck(pPlayer, kPwUpShadowCloak);
if (nInv >= 120 * 8 || (nInv != 0 && (gFrameClock & 32))) if (nInv >= 120 * 8 || (nInv != 0 && (PlayClock & 32)))
{ {
shade = -128; shade = -128;
flags |= 1; flags |= 1;
@ -1813,12 +1813,12 @@ int processSprayCan(PLAYER *pPlayer)
{ {
pPlayer->weaponState = 7; pPlayer->weaponState = 7;
pPlayer->fuseTime = 0; pPlayer->fuseTime = 0;
pPlayer->throwTime = gFrameClock; pPlayer->throwTime = PlayClock;
} }
return 1; return 1;
case 7: case 7:
{ {
pPlayer->throwPower = ClipHigh(DivScale(gFrameClock-pPlayer->throwTime,240, 16), 65536); pPlayer->throwPower = ClipHigh(DivScale(PlayClock-pPlayer->throwTime,240, 16), 65536);
if (!(pPlayer->input.actions & SB_FIRE)) if (!(pPlayer->input.actions & SB_FIRE))
{ {
if (!pPlayer->fuseTime) if (!pPlayer->fuseTime)
@ -1851,12 +1851,12 @@ char processTNT(PLAYER *pPlayer)
{ {
pPlayer->weaponState = 6; pPlayer->weaponState = 6;
pPlayer->fuseTime = 0; pPlayer->fuseTime = 0;
pPlayer->throwTime = gFrameClock; pPlayer->throwTime = PlayClock;
} }
return 1; return 1;
case 6: case 6:
{ {
pPlayer->throwPower = ClipHigh(DivScale(gFrameClock-pPlayer->throwTime,240, 16), 65536); pPlayer->throwPower = ClipHigh(DivScale(PlayClock-pPlayer->throwTime,240, 16), 65536);
if (!(pPlayer->input.actions & SB_FIRE)) if (!(pPlayer->input.actions & SB_FIRE))
{ {
if (!pPlayer->fuseTime) if (!pPlayer->fuseTime)
@ -1875,7 +1875,7 @@ char processProxy(PLAYER *pPlayer)
switch (pPlayer->weaponState) switch (pPlayer->weaponState)
{ {
case 9: case 9:
pPlayer->throwPower = ClipHigh(DivScale(gFrameClock-pPlayer->throwTime,240, 16), 65536); pPlayer->throwPower = ClipHigh(DivScale(PlayClock-pPlayer->throwTime,240, 16), 65536);
pPlayer->weaponTimer = 0; pPlayer->weaponTimer = 0;
if (!(pPlayer->input.actions & SB_FIRE)) if (!(pPlayer->input.actions & SB_FIRE))
{ {
@ -1892,7 +1892,7 @@ char processRemote(PLAYER *pPlayer)
switch (pPlayer->weaponState) switch (pPlayer->weaponState)
{ {
case 13: case 13:
pPlayer->throwPower = ClipHigh(DivScale(gFrameClock-pPlayer->throwTime,240, 16), 65536); pPlayer->throwPower = ClipHigh(DivScale(PlayClock-pPlayer->throwTime,240, 16), 65536);
if (!(pPlayer->input.actions & SB_FIRE)) if (!(pPlayer->input.actions & SB_FIRE))
{ {
pPlayer->weaponState = 11; pPlayer->weaponState = 11;
@ -2261,7 +2261,7 @@ void WeaponProcess(PLAYER *pPlayer) {
case 3: case 3:
pPlayer->weaponState = 6; pPlayer->weaponState = 6;
pPlayer->fuseTime = -1; pPlayer->fuseTime = -1;
pPlayer->throwTime = gFrameClock; pPlayer->throwTime = PlayClock;
StartQAV(pPlayer, 21, nClientExplodeBundle, 0); StartQAV(pPlayer, 21, nClientExplodeBundle, 0);
return; return;
} }
@ -2272,7 +2272,7 @@ void WeaponProcess(PLAYER *pPlayer) {
case 7: case 7:
pPlayer->weaponQav = 27; pPlayer->weaponQav = 27;
pPlayer->weaponState = 9; pPlayer->weaponState = 9;
pPlayer->throwTime = gFrameClock; pPlayer->throwTime = PlayClock;
return; return;
} }
break; break;
@ -2282,7 +2282,7 @@ void WeaponProcess(PLAYER *pPlayer) {
case 10: case 10:
pPlayer->weaponQav = 36; pPlayer->weaponQav = 36;
pPlayer->weaponState = 13; pPlayer->weaponState = 13;
pPlayer->throwTime = gFrameClock; pPlayer->throwTime = PlayClock;
return; return;
case 11: case 11:
pPlayer->weaponState = 12; pPlayer->weaponState = 12;

View file

@ -158,7 +158,7 @@ void animatesprites_d(int x, int y, int a, int smoothratio)
case SECTOREFFECTOR: case SECTOREFFECTOR:
if (t->lotag == 27 && ud.recstat == 1) if (t->lotag == 27 && ud.recstat == 1)
{ {
t->picnum = 11 + ((ud.levelclock >> 3) & 1); t->picnum = 11 + ((PlayClock >> 3) & 1);
t->cstat |= 128; t->cstat |= 128;
} }
else else
@ -252,7 +252,7 @@ void animatesprites_d(int x, int y, int a, int smoothratio)
t->z -= (4 << 8); t->z -= (4 << 8);
break; break;
case CRYSTALAMMO: case CRYSTALAMMO:
t->shade = bsin(ud.levelclock << 4, -10); t->shade = bsin(PlayClock << 4, -10);
continue; continue;
case VIEWSCREEN: case VIEWSCREEN:
case VIEWSCREEN2: case VIEWSCREEN2:
@ -270,10 +270,10 @@ void animatesprites_d(int x, int y, int a, int smoothratio)
break; break;
case SHRINKSPARK: case SHRINKSPARK:
t->picnum = SHRINKSPARK + ((ud.levelclock >> 4) & 3); t->picnum = SHRINKSPARK + ((PlayClock >> 4) & 3);
break; break;
case GROWSPARK: case GROWSPARK:
t->picnum = GROWSPARK + ((ud.levelclock >> 4) & 3); t->picnum = GROWSPARK + ((PlayClock >> 4) & 3);
break; break;
case RPG: case RPG:
if (hw_models && md_tilehasmodel(s->picnum, s->pal) >= 0) if (hw_models && md_tilehasmodel(s->picnum, s->pal) >= 0)
@ -653,7 +653,7 @@ void animatesprites_d(int x, int y, int a, int smoothratio)
if (t->picnum == EXPLOSION2) if (t->picnum == EXPLOSION2)
{ {
ps[screenpeek].visibility = -127; ps[screenpeek].visibility = -127;
lastvisinc = ud.levelclock + 32; lastvisinc = PlayClock + 32;
} }
t->shade = -127; t->shade = -127;
break; break;

View file

@ -148,7 +148,7 @@ void animatesprites_r(int x, int y, int a, int smoothratio)
case SECTOREFFECTOR: case SECTOREFFECTOR:
if (t->lotag == 27 && ud.recstat == 1) if (t->lotag == 27 && ud.recstat == 1)
{ {
t->picnum = 11 + ((ud.levelclock >> 3) & 1); t->picnum = 11 + ((PlayClock >> 3) & 1);
t->cstat |= 128; t->cstat |= 128;
} }
else else
@ -183,7 +183,7 @@ void animatesprites_r(int x, int y, int a, int smoothratio)
case RESPAWNMARKERRED: case RESPAWNMARKERRED:
case RESPAWNMARKERYELLOW: case RESPAWNMARKERYELLOW:
case RESPAWNMARKERGREEN: case RESPAWNMARKERGREEN:
t->picnum = 861 + ((ud.levelclock >> 4) & 13); t->picnum = 861 + ((PlayClock >> 4) & 13);
if (s->picnum == RESPAWNMARKERRED) if (s->picnum == RESPAWNMARKERRED)
t->pal = 0; t->pal = 0;
else if (s->picnum == RESPAWNMARKERYELLOW) else if (s->picnum == RESPAWNMARKERYELLOW)
@ -250,21 +250,21 @@ void animatesprites_r(int x, int y, int a, int smoothratio)
t->z -= (4 << 8); t->z -= (4 << 8);
break; break;
case CRYSTALAMMO: case CRYSTALAMMO:
t->shade = bsin(ud.levelclock << 4, -10); t->shade = bsin(PlayClock << 4, -10);
break; break;
case SHRINKSPARK: case SHRINKSPARK:
if (Owner && (Owner->picnum == CHEER || Owner->picnum == CHEERSTAYPUT) && isRRRA()) if (Owner && (Owner->picnum == CHEER || Owner->picnum == CHEERSTAYPUT) && isRRRA())
{ {
t->picnum = CHEERBLADE + ((ud.levelclock >> 4) & 3); t->picnum = CHEERBLADE + ((PlayClock >> 4) & 3);
t->shade = -127; t->shade = -127;
} }
else else
t->picnum = SHRINKSPARK + ((ud.levelclock >> 4) & 7); t->picnum = SHRINKSPARK + ((PlayClock >> 4) & 7);
break; break;
case CHEERBOMB: case CHEERBOMB:
if (isRRRA()) if (isRRRA())
{ {
t->picnum = CHEERBOMB + ((ud.levelclock >> 4) & 3); t->picnum = CHEERBOMB + ((PlayClock >> 4) & 3);
break; break;
} }
else goto default_case; else goto default_case;
@ -272,10 +272,10 @@ void animatesprites_r(int x, int y, int a, int smoothratio)
if (isRRRA() && Owner) if (isRRRA() && Owner)
{ {
if (Owner->picnum == MINION && Owner->pal == 8) if (Owner->picnum == MINION && Owner->pal == 8)
t->picnum = RRTILE3500 + ((ud.levelclock >> 4) % 6); t->picnum = RRTILE3500 + ((PlayClock >> 4) % 6);
else if (Owner->picnum == MINION && Owner->pal == 19) else if (Owner->picnum == MINION && Owner->pal == 19)
{ {
t->picnum = RRTILE5090 + ((ud.levelclock >> 4) & 3); t->picnum = RRTILE5090 + ((PlayClock >> 4) & 3);
t->shade = -127; t->shade = -127;
} }
else if (Owner->picnum == MAMA) else if (Owner->picnum == MAMA)
@ -291,10 +291,10 @@ void animatesprites_r(int x, int y, int a, int smoothratio)
t->picnum = RRTILE7274 + k; t->picnum = RRTILE7274 + k;
} }
else else
t->picnum = SPIT + ((ud.levelclock >> 4) & 3); t->picnum = SPIT + ((PlayClock >> 4) & 3);
} }
else else
t->picnum = SPIT + ((ud.levelclock >> 4) & 3); t->picnum = SPIT + ((PlayClock >> 4) & 3);
break; break;
case EMPTYBIKE: case EMPTYBIKE:
if (!isRRRA()) goto default_case; if (!isRRRA()) goto default_case;
@ -803,12 +803,12 @@ void animatesprites_r(int x, int y, int a, int smoothratio)
if (t->picnum == EXPLOSION2) if (t->picnum == EXPLOSION2)
{ {
ps[screenpeek].visibility = -127; ps[screenpeek].visibility = -127;
lastvisinc = ud.levelclock + 32; lastvisinc = PlayClock + 32;
t->pal = 0; t->pal = 0;
} }
else if (t->picnum == FIRELASER) else if (t->picnum == FIRELASER)
{ {
t->picnum = FIRELASER + ((ud.levelclock >> 2) & 5); t->picnum = FIRELASER + ((PlayClock >> 2) & 5);
} }
t->shade = -127; t->shade = -127;
break; break;
@ -904,11 +904,11 @@ void animatesprites_r(int x, int y, int a, int smoothratio)
t->shade = -127; t->shade = -127;
break; break;
case RRTILE2034: case RRTILE2034:
t->picnum = RRTILE2034 + ((ud.levelclock >> 2) & 1); t->picnum = RRTILE2034 + ((PlayClock >> 2) & 1);
break; break;
case RRTILE2944: case RRTILE2944:
t->shade = -127; t->shade = -127;
t->picnum = RRTILE2944 + ((ud.levelclock >> 2) & 4); t->picnum = RRTILE2944 + ((PlayClock >> 2) & 4);
break; break;
case PLAYERONWATER: case PLAYERONWATER:

View file

@ -126,7 +126,7 @@ void FTA(int q, struct player_struct* p)
if (q < 0 || gamestate != GS_LEVEL) if (q < 0 || gamestate != GS_LEVEL)
return; return;
if (p->ftq != q || (ud.levelclock - p->ftt > TICRATE && q != QUOTE_DEAD)) if (p->ftq != q || (PlayClock - p->ftt > TICRATE && q != QUOTE_DEAD))
{ {
p->ftq = q; p->ftq = q;
auto qu = quoteMgr.GetQuote(q); auto qu = quoteMgr.GetQuote(q);
@ -144,7 +144,7 @@ void FTA(int q, struct player_struct* p)
} }
} }
} }
p->ftt = ud.levelclock; p->ftt = PlayClock;
} }
//========================================================================== //==========================================================================
@ -324,16 +324,16 @@ void cameratext(DDukeActor *cam)
drawitem(TILE_CAMCORNER + 1, 24, 163, true, true); drawitem(TILE_CAMCORNER + 1, 24, 163, true, true);
drawitem(TILE_CAMCORNER + 1, 320 - 26, 163, false, true); drawitem(TILE_CAMCORNER + 1, 320 - 26, 163, false, true);
if (ud.levelclock & 16) if (PlayClock & 16)
drawitem(TILE_CAMLIGHT, 46, 32, false, false); drawitem(TILE_CAMLIGHT, 46, 32, false, false);
} }
else else
{ {
int flipbits = (ud.levelclock << 1) & 48; int flipbits = (PlayClock << 1) & 48;
for (int x = -64; x < 394; x += 64) for (int x = -64; x < 394; x += 64)
for (int y = 0; y < 200; y += 64) for (int y = 0; y < 200; y += 64)
drawitem(TILE_STATIC, x, y, !!(ud.levelclock & 8), !!(ud.levelclock & 16)); drawitem(TILE_STATIC, x, y, !!(PlayClock & 8), !!(PlayClock & 16));
} }
} }
@ -566,7 +566,7 @@ bool GameInterface::DrawAutomapPlayer(int cposx, int cposy, int czoom, int cang,
{ {
auto& pp = ps[p]; auto& pp = ps[p];
if (pspr->xvel > 16 && pp.on_ground) if (pspr->xvel > 16 && pp.on_ground)
i = TILE_APLAYERTOP + ((ud.levelclock >> 4) & 3); i = TILE_APLAYERTOP + ((PlayClock >> 4) & 3);
else else
i = TILE_APLAYERTOP; i = TILE_APLAYERTOP;

View file

@ -99,8 +99,8 @@ void GameInterface::Ticker()
dotorch(); dotorch();
r_NoInterpolate = false; r_NoInterpolate = false;
ud.levelclock+= 4; // This must be at the end of this block so that the first tic receives a value of 0! PlayClock+= 4; // This must be at the end of this block so that the first tic receives a value of 0!
if (ud.levelclock == 8) gameaction = ga_autosave; // let the game run for 1 frame before saving. if (PlayClock == 8) gameaction = ga_autosave; // let the game run for 1 frame before saving.
} }
else r_NoInterpolate = true; else r_NoInterpolate = true;

View file

@ -78,7 +78,7 @@ void displaymasks_r(int snum, double smoothratio)
{ {
//int pin = 0; //int pin = 0;
// to get the proper clock value with regards to interpolation we have add a smoothratio based offset to the value. // to get the proper clock value with regards to interpolation we have add a smoothratio based offset to the value.
double interpclock = ud.levelclock + (TICSPERFRAME/65536.) * smoothratio; double interpclock = PlayClock + (TICSPERFRAME/65536.) * smoothratio;
int pin = RS_STRETCH; int pin = RS_STRETCH;
hud_drawsprite((320 - (tileWidth(SCUBAMASK) >> 1) - 15), (200 - (tileHeight(SCUBAMASK) >> 1) + bsinf(interpclock, -10)), 49152, 0, SCUBAMASK, 0, p, 2 + 16 + pin); hud_drawsprite((320 - (tileWidth(SCUBAMASK) >> 1) - 15), (200 - (tileHeight(SCUBAMASK) >> 1) + bsinf(interpclock, -10)), 49152, 0, SCUBAMASK, 0, p, 2 + 16 + pin);
hud_drawsprite((320 - tileWidth(SCUBAMASK + 4)), (200 - tileHeight(SCUBAMASK + 4)), 65536, 0, SCUBAMASK + 4, 0, p, 2 + 16 + pin); hud_drawsprite((320 - tileWidth(SCUBAMASK + 4)), (200 - tileHeight(SCUBAMASK + 4)), 65536, 0, SCUBAMASK + 4, 0, p, 2 + 16 + pin);

View file

@ -1122,7 +1122,7 @@ bool view(struct player_struct* pp, int* vx, int* vy, int* vz, short* vsectnum,
*vy = (*vy) + MulScale(ny, cameradist, 16); *vy = (*vy) + MulScale(ny, cameradist, 16);
*vz = (*vz) + MulScale(nz, cameradist, 16); *vz = (*vz) + MulScale(nz, cameradist, 16);
int myclock = ud.levelclock + int(TICSPERFRAME/65536. * smoothratio); int myclock = PlayClock + int(TICSPERFRAME/65536. * smoothratio);
if (cameraclock == INT_MIN) cameraclock = myclock; // third person view was just started. if (cameraclock == INT_MIN) cameraclock = myclock; // third person view was just started.
cameradist = min(cameradist + ((myclock - cameraclock) << 10), 65536); cameradist = min(cameradist + ((myclock - cameraclock) << 10), 65536);

View file

@ -1600,7 +1600,7 @@ int doincrements_d(struct player_struct* p)
p->knuckle_incs++; p->knuckle_incs++;
if (p->knuckle_incs == 10 && !isWW2GI()) if (p->knuckle_incs == 10 && !isWW2GI())
{ {
if (ud.levelclock > 1024) if (PlayClock > 1024)
if (snum == screenpeek || ud.coop == 1) if (snum == screenpeek || ud.coop == 1)
{ {
if (rand() & 1) if (rand() & 1)
@ -2274,7 +2274,7 @@ static void operateweapon(int snum, ESyncBits actions, int psect)
{ {
fi.shoot(pact, SHOTSPARK1); fi.shoot(pact, SHOTSPARK1);
S_PlayActorSound(PISTOL_FIRE, pact); S_PlayActorSound(PISTOL_FIRE, pact);
lastvisinc = ud.levelclock + 32; lastvisinc = PlayClock + 32;
p->visibility = 0; p->visibility = 0;
} }
@ -2328,7 +2328,7 @@ static void operateweapon(int snum, ESyncBits actions, int psect)
S_PlayActorSound(SHOTGUN_FIRE, pact); S_PlayActorSound(SHOTGUN_FIRE, pact);
lastvisinc = ud.levelclock + 32; lastvisinc = PlayClock + 32;
p->visibility = 0; p->visibility = 0;
} }
@ -2383,7 +2383,7 @@ static void operateweapon(int snum, ESyncBits actions, int psect)
S_PlayActorSound(CHAINGUN_FIRE, pact); S_PlayActorSound(CHAINGUN_FIRE, pact);
fi.shoot(pact, CHAINGUN); fi.shoot(pact, CHAINGUN);
lastvisinc = ud.levelclock + 32; lastvisinc = PlayClock + 32;
p->visibility = 0; p->visibility = 0;
checkavailweapon(p); checkavailweapon(p);
@ -2434,7 +2434,7 @@ static void operateweapon(int snum, ESyncBits actions, int psect)
{ {
// make them visible if not set... // make them visible if not set...
p->visibility = 0; p->visibility = 0;
lastvisinc = ud.levelclock + 32; lastvisinc = PlayClock + 32;
} }
checkavailweapon(p); checkavailweapon(p);
//#endif //#endif
@ -2448,7 +2448,7 @@ static void operateweapon(int snum, ESyncBits actions, int psect)
{ {
// make them visible if not set... // make them visible if not set...
p->visibility = 0; p->visibility = 0;
lastvisinc = ud.levelclock + 32; lastvisinc = PlayClock + 32;
} }
checkavailweapon(p); checkavailweapon(p);
} }
@ -2467,7 +2467,7 @@ static void operateweapon(int snum, ESyncBits actions, int psect)
{ {
p->visibility = 0; p->visibility = 0;
//flashColor = 176 + (252 << 8) + (120 << 16); //flashColor = 176 + (252 << 8) + (120 << 16);
lastvisinc = ud.levelclock + 32; lastvisinc = PlayClock + 32;
checkavailweapon(p); checkavailweapon(p);
} }
} }
@ -2475,7 +2475,7 @@ static void operateweapon(int snum, ESyncBits actions, int psect)
{ {
p->okickback_pic = p->kickback_pic = 0; p->okickback_pic = p->kickback_pic = 0;
p->visibility = 0; p->visibility = 0;
lastvisinc = ud.levelclock + 32; lastvisinc = PlayClock + 32;
checkavailweapon(p); checkavailweapon(p);
} }
else p->kickback_pic++; else p->kickback_pic++;
@ -2493,7 +2493,7 @@ static void operateweapon(int snum, ESyncBits actions, int psect)
(p->kickback_pic & 1)) (p->kickback_pic & 1))
{ {
p->visibility = 0; p->visibility = 0;
lastvisinc = ud.levelclock + 32; lastvisinc = PlayClock + 32;
fi.shoot(pact, RPG); fi.shoot(pact, RPG);
p->ammo_amount[DEVISTATOR_WEAPON]--; p->ammo_amount[DEVISTATOR_WEAPON]--;
checkavailweapon(p); checkavailweapon(p);
@ -2503,7 +2503,7 @@ static void operateweapon(int snum, ESyncBits actions, int psect)
else if (p->kickback_pic & 1) else if (p->kickback_pic & 1)
{ {
p->visibility = 0; p->visibility = 0;
lastvisinc = ud.levelclock + 32; lastvisinc = PlayClock + 32;
fi.shoot(pact, RPG); fi.shoot(pact, RPG);
p->ammo_amount[DEVISTATOR_WEAPON]--; p->ammo_amount[DEVISTATOR_WEAPON]--;
checkavailweapon(p); checkavailweapon(p);
@ -2523,7 +2523,7 @@ static void operateweapon(int snum, ESyncBits actions, int psect)
p->ammo_amount[p->curr_weapon]--; p->ammo_amount[p->curr_weapon]--;
p->visibility = 0; p->visibility = 0;
lastvisinc = ud.levelclock + 32; lastvisinc = PlayClock + 32;
fi.shoot(pact, FREEZEBLAST); fi.shoot(pact, FREEZEBLAST);
checkavailweapon(p); checkavailweapon(p);
} }
@ -2606,7 +2606,7 @@ static void operateweapon(int snum, ESyncBits actions, int psect)
if (p->kickback_pic == 4) if (p->kickback_pic == 4)
{ {
p->ammo_amount[RPG_WEAPON]--; p->ammo_amount[RPG_WEAPON]--;
lastvisinc = ud.levelclock + 32; lastvisinc = PlayClock + 32;
p->visibility = 0; p->visibility = 0;
fi.shoot(pact, RPG); fi.shoot(pact, RPG);
checkavailweapon(p); checkavailweapon(p);

View file

@ -1486,7 +1486,7 @@ int doincrements_r(struct player_struct* p)
} }
S_PlayActorSound(snd, pact); S_PlayActorSound(snd, pact);
} }
else if (ud.levelclock > 1024) else if (PlayClock > 1024)
if (snum == screenpeek || ud.coop == 1) if (snum == screenpeek || ud.coop == 1)
{ {
if (rand() & 1) if (rand() & 1)
@ -2806,7 +2806,7 @@ static void operateweapon(int snum, ESyncBits actions, int psect)
p->noise_radius = 8192; p->noise_radius = 8192;
madenoise(snum); madenoise(snum);
lastvisinc = ud.levelclock + 32; lastvisinc = PlayClock + 32;
p->visibility = 0; p->visibility = 0;
if (psectlotag != 857) if (psectlotag != 857)
{ {
@ -2885,7 +2885,7 @@ static void operateweapon(int snum, ESyncBits actions, int psect)
p->noise_radius = 8192; p->noise_radius = 8192;
madenoise(snum); madenoise(snum);
lastvisinc = ud.levelclock + 32; lastvisinc = PlayClock + 32;
p->visibility = 0; p->visibility = 0;
} }
@ -2996,7 +2996,7 @@ static void operateweapon(int snum, ESyncBits actions, int psect)
fi.shoot(pact, CHAINGUN); fi.shoot(pact, CHAINGUN);
p->noise_radius = 8192; p->noise_radius = 8192;
madenoise(snum); madenoise(snum);
lastvisinc = ud.levelclock + 32; lastvisinc = PlayClock + 32;
p->visibility = 0; p->visibility = 0;
if (psectlotag != 857) if (psectlotag != 857)
@ -3052,7 +3052,7 @@ static void operateweapon(int snum, ESyncBits actions, int psect)
if (p->kickback_pic == 2 || p->kickback_pic == 4) if (p->kickback_pic == 2 || p->kickback_pic == 4)
{ {
p->visibility = 0; p->visibility = 0;
lastvisinc = ud.levelclock + 32; lastvisinc = PlayClock + 32;
S_PlayActorSound(CHAINGUN_FIRE, pact); S_PlayActorSound(CHAINGUN_FIRE, pact);
fi.shoot(pact, SHOTSPARK1); fi.shoot(pact, SHOTSPARK1);
p->noise_radius = 16384; p->noise_radius = 16384;
@ -3079,7 +3079,7 @@ static void operateweapon(int snum, ESyncBits actions, int psect)
if (p->kickback_pic == 2 || p->kickback_pic == 4) if (p->kickback_pic == 2 || p->kickback_pic == 4)
{ {
p->visibility = 0; p->visibility = 0;
lastvisinc = ud.levelclock + 32; lastvisinc = PlayClock + 32;
S_PlayActorSound(CHAINGUN_FIRE, pact); S_PlayActorSound(CHAINGUN_FIRE, pact);
fi.shoot(pact, CHAINGUN); fi.shoot(pact, CHAINGUN);
p->noise_radius = 16384; p->noise_radius = 16384;
@ -3137,7 +3137,7 @@ static void operateweapon(int snum, ESyncBits actions, int psect)
{ {
p->ammo_amount[ALIENBLASTER_WEAPON]--; p->ammo_amount[ALIENBLASTER_WEAPON]--;
p->visibility = 0; p->visibility = 0;
lastvisinc = ud.levelclock + 32; lastvisinc = PlayClock + 32;
checkavailweapon(p); checkavailweapon(p);
} }
else if (p->kickback_pic == 12) else if (p->kickback_pic == 12)
@ -3246,7 +3246,7 @@ static void operateweapon(int snum, ESyncBits actions, int psect)
p->ammo_amount[CROSSBOW_WEAPON]--; p->ammo_amount[CROSSBOW_WEAPON]--;
if (p->ammo_amount[DYNAMITE_WEAPON]) if (p->ammo_amount[DYNAMITE_WEAPON])
p->ammo_amount[DYNAMITE_WEAPON]--; p->ammo_amount[DYNAMITE_WEAPON]--;
lastvisinc = ud.levelclock + 32; lastvisinc = PlayClock + 32;
p->visibility = 0; p->visibility = 0;
fi.shoot(pact, RPG); fi.shoot(pact, RPG);
p->noise_radius = 32768; p->noise_radius = 32768;
@ -3264,7 +3264,7 @@ static void operateweapon(int snum, ESyncBits actions, int psect)
if (p->kickback_pic == 4) if (p->kickback_pic == 4)
{ {
p->ammo_amount[CHICKEN_WEAPON]--; p->ammo_amount[CHICKEN_WEAPON]--;
lastvisinc = ud.levelclock + 32; lastvisinc = PlayClock + 32;
p->visibility = 0; p->visibility = 0;
fi.shoot(pact, RPG2); fi.shoot(pact, RPG2);
p->noise_radius = 32768; p->noise_radius = 32768;

View file

@ -78,7 +78,7 @@ void DoFire(struct player_struct* p, short snum)
if (!(aplWeaponFlags[p->curr_weapon][snum] & WEAPON_FLAG_NOVISIBLE)) if (!(aplWeaponFlags[p->curr_weapon][snum] & WEAPON_FLAG_NOVISIBLE))
{ {
// make them visible if not set... // make them visible if not set...
lastvisinc = ud.levelclock + 32; lastvisinc = PlayClock + 32;
p->visibility = 0; p->visibility = 0;
} }
@ -400,7 +400,7 @@ void operateweapon_ww(int snum, ESyncBits actions, int psect)
if (!(aplWeaponFlags[p->curr_weapon][snum] & WEAPON_FLAG_NOVISIBLE)) if (!(aplWeaponFlags[p->curr_weapon][snum] & WEAPON_FLAG_NOVISIBLE))
{ {
// make them visible if not set... // make them visible if not set...
lastvisinc = ud.levelclock + 32; lastvisinc = PlayClock + 32;
p->visibility = 0; p->visibility = 0;
} }
SetGameVarID(g_iWeaponVarID, p->curr_weapon, p->GetActor(), snum); SetGameVarID(g_iWeaponVarID, p->curr_weapon, p->GetActor(), snum);

View file

@ -736,7 +736,7 @@ void prelevel_common(int g)
void resettimevars(void) void resettimevars(void)
{ {
cloudclock = 0; cloudclock = 0;
ud.levelclock = 0; PlayClock = 0;
if (camsprite != nullptr) if (camsprite != nullptr)
camsprite->temp_data[0] = 0; camsprite->temp_data[0] = 0;
} }

View file

@ -641,7 +641,7 @@ void displayrooms(int snum, double smoothratio)
if (!isRRRA() || !fogactive) if (!isRRRA() || !fogactive)
{ {
if (ud.levelclock < lastvisinc) if (PlayClock < lastvisinc)
{ {
if (abs(p->visibility - ud.const_visibility) > 8) if (abs(p->visibility - ud.const_visibility) > 8)
p->visibility += (ud.const_visibility - p->visibility) >> 2; p->visibility += (ud.const_visibility - p->visibility) >> 2;

View file

@ -329,7 +329,7 @@ void GameInterface::SerializeGameState(FSerializer& arc)
("coop", ud.coop) ("coop", ud.coop)
("marker", ud.marker) ("marker", ud.marker)
("ffire", ud.ffire) ("ffire", ud.ffire)
("levelclock", ud.levelclock) ("levelclock", PlayClock)
("bomb_tag", ud.bomb_tag) ("bomb_tag", ud.bomb_tag)
.Array("sectorextra", sectorextra, numsectors) .Array("sectorextra", sectorextra, numsectors)

View file

@ -158,7 +158,7 @@ public:
imgScale = baseScale / img->GetDisplayHeight(); imgScale = baseScale / img->GetDisplayHeight();
DrawGraphic(img, 2, -1.5, DI_ITEM_LEFT_BOTTOM, 1., -1, -1, imgScale, imgScale); DrawGraphic(img, 2, -1.5, DI_ITEM_LEFT_BOTTOM, 1., -1, -1, imgScale, imgScale);
if (!althud_flashing || p->last_extra > (gs.max_player_health >> 2) || (ud.levelclock & 32) || (p->GetActor()->s.pal == 1 && p->last_extra < 2)) if (!althud_flashing || p->last_extra > (gs.max_player_health >> 2) || (PlayClock & 32) || (p->GetActor()->s.pal == 1 && p->last_extra < 2))
{ {
int s = -8; int s = -8;
if (althud_flashing && p->last_extra > gs.max_player_health) if (althud_flashing && p->last_extra > gs.max_player_health)
@ -207,7 +207,7 @@ public:
imgX += (imgX * 0.6) * (strlen - 1); imgX += (imgX * 0.6) * (strlen - 1);
} }
if (weapon != KNEE_WEAPON && (!althud_flashing || ud.levelclock & 32 || ammo > (gs.max_ammo_amount[weapon] / 10))) if (weapon != KNEE_WEAPON && (!althud_flashing || PlayClock & 32 || ammo > (gs.max_ammo_amount[weapon] / 10)))
{ {
SBar_DrawString(this, numberFont, format, -3, texty, DI_TEXT_ALIGN_RIGHT, CR_UNTRANSLATED, 1, 0, 0, 1, 1); SBar_DrawString(this, numberFont, format, -3, texty, DI_TEXT_ALIGN_RIGHT, CR_UNTRANSLATED, 1, 0, 0, 1, 1);
} }

View file

@ -108,7 +108,7 @@ public:
imgScale = baseScale / img->GetDisplayHeight(); imgScale = baseScale / img->GetDisplayHeight();
DrawGraphic(img, 2, -2, DI_ITEM_LEFT_BOTTOM, 1, 0, 0, imgScale, imgScale); DrawGraphic(img, 2, -2, DI_ITEM_LEFT_BOTTOM, 1, 0, 0, imgScale, imgScale);
if (!althud_flashing || p->last_extra > (gs.max_player_health >> 2) || (ud.levelclock & 32) || (p->GetActor()->s.pal == 1 && p->last_extra < 2)) if (!althud_flashing || p->last_extra > (gs.max_player_health >> 2) || (PlayClock & 32) || (p->GetActor()->s.pal == 1 && p->last_extra < 2))
{ {
int s = -8; int s = -8;
if (althud_flashing && p->last_extra > gs.max_player_health) if (althud_flashing && p->last_extra > gs.max_player_health)
@ -175,7 +175,7 @@ public:
imgX += (imgX * 0.755) * (strlen - 1); imgX += (imgX * 0.755) * (strlen - 1);
} }
if (weapon != KNEE_WEAPON && weapon != SLINGBLADE_WEAPON && (!althud_flashing || ud.levelclock & 32 || ammo > (gs.max_ammo_amount[weapon] / 10))) if (weapon != KNEE_WEAPON && weapon != SLINGBLADE_WEAPON && (!althud_flashing || PlayClock & 32 || ammo > (gs.max_ammo_amount[weapon] / 10)))
{ {
SBar_DrawString(this, numberFont, format, -1, -numberFont->mFont->GetHeight() * scale + 4, DI_TEXT_ALIGN_RIGHT, CR_UNTRANSLATED, 1, 0, 0, scale, scale); SBar_DrawString(this, numberFont, format, -1, -numberFont->mFont->GetHeight() * scale + 4, DI_TEXT_ALIGN_RIGHT, CR_UNTRANSLATED, 1, 0, 0, scale, scale);
} }

View file

@ -1261,7 +1261,7 @@ void allignwarpelevators(void)
void moveclouds(double smoothratio) void moveclouds(double smoothratio)
{ {
// The math here is very messy.. :( // The math here is very messy.. :(
int myclock = smoothratio < 32768? ud.levelclock-2 : ud.levelclock; int myclock = smoothratio < 32768? PlayClock-2 : PlayClock;
if (myclock > cloudclock || myclock < (cloudclock - 7)) if (myclock > cloudclock || myclock < (cloudclock - 7))
{ {
cloudclock = myclock + 6; cloudclock = myclock + 6;

View file

@ -123,7 +123,6 @@ struct TileInfo
struct user_defs struct user_defs
{ {
int levelclock;
unsigned char god, cashman, eog; unsigned char god, cashman, eog;
unsigned char clipping; unsigned char clipping;
unsigned char user_pals[MAXPLAYERS]; unsigned char user_pals[MAXPLAYERS];

View file

@ -107,7 +107,6 @@ short nBackgroundPic;
short nShadowPic; short nShadowPic;
short nCreaturesKilled = 0, nCreaturesTotal = 0; short nCreaturesKilled = 0, nCreaturesTotal = 0;
int leveltime;
short nFreeze; short nFreeze;
@ -449,8 +448,8 @@ void GameInterface::Ticker()
lLocalCodes = 0; lLocalCodes = 0;
leveltime++; PlayClock += 4;
if (leveltime == 2) gameaction = ga_autosave; // let the game run for 1 frame before saving. if (PlayClock == 8) gameaction = ga_autosave; // let the game run for 1 frame before saving.
GameMove(); GameMove();
r_NoInterpolate = false; r_NoInterpolate = false;
} }
@ -625,7 +624,7 @@ bool GameInterface::CanSave()
::GameStats GameInterface::getStats() ::GameStats GameInterface::getStats()
{ {
return { nCreaturesKilled, nCreaturesTotal, 0, 0, leveltime / 30, 0 }; return { nCreaturesKilled, nCreaturesTotal, 0, 0, PlayClock / 120, 0 };
} }
::GameInterface* CreateInterface() ::GameInterface* CreateInterface()
@ -666,7 +665,7 @@ void SerializeState(FSerializer& arc)
("bodytotal", nBodyTotal) ("bodytotal", nBodyTotal)
("bsnakecam", bSnakeCam) ("bsnakecam", bSnakeCam)
("slipmode", bSlipMode) ("slipmode", bSlipMode)
("leveltime", leveltime) ("PlayClock", PlayClock)
("cinemaseen", nCinemaSeen) ("cinemaseen", nCinemaSeen)
("spiritsprite", nSpiritSprite) ("spiritsprite", nSpiritSprite)
.EndObject(); .EndObject();

View file

@ -112,7 +112,6 @@ extern short nBackgroundPic;
extern short nShadowPic; extern short nShadowPic;
extern short nCreaturesTotal, nCreaturesKilled; extern short nCreaturesTotal, nCreaturesKilled;
extern int leveltime;
extern int lLocalButtons; extern int lLocalButtons;

View file

@ -87,7 +87,7 @@ uint8_t LoadLevel(int nMap)
nCreaturesTotal = 0; nCreaturesTotal = 0;
nFreeze = 0; nFreeze = 0;
nSpiritSprite = -1; nSpiritSprite = -1;
leveltime = 0; PlayClock = 0;
InitLion(); InitLion();
InitRexs(); InitRexs();

View file

@ -100,7 +100,7 @@ bool GameInterface::DrawAutomapPlayer(int x, int y, int z, int a, double const s
double x = xdim / 2. + x1 / double(1 << 12); double x = xdim / 2. + x1 / double(1 << 12);
double y = ydim / 2. + y1 / double(1 << 12); double y = ydim / 2. + y1 / double(1 << 12);
// This very likely needs fixing later // This very likely needs fixing later
DrawTexture(twod, tileGetTexture(nTile /*+ ((leveltime >> 2) & 3)*/, true), x, y, DTA_ClipLeft, windowxy1.x, DTA_ClipTop, windowxy1.y, DTA_ScaleX, z / 1536., DTA_ScaleY, z / 1536., DTA_CenterOffset, true, DrawTexture(twod, tileGetTexture(nTile /*+ ((PlayClock >> 4) & 3)*/, true), x, y, DTA_ClipLeft, windowxy1.x, DTA_ClipTop, windowxy1.y, DTA_ScaleX, z / 1536., DTA_ScaleY, z / 1536., DTA_CenterOffset, true,
DTA_ClipRight, windowxy2.x + 1, DTA_ClipBottom, windowxy2.y + 1, DTA_Alpha, (pSprite->cstat & 2 ? 0.5 : 1.), TAG_DONE); DTA_ClipRight, windowxy2.x + 1, DTA_ClipBottom, windowxy2.y + 1, DTA_Alpha, (pSprite->cstat & 2 ? 0.5 : 1.), TAG_DONE);
break; break;
} }

View file

@ -1676,20 +1676,20 @@ void DoFinale()
{ {
StopLocalSound(); StopLocalSound();
PlayLocalSound(StaticSound[kSound76], 0); PlayLocalSound(StaticSound[kSound76], 0);
nextstage = leveltime*4 + 120; nextstage = PlayClock + 120;
nFinaleStage++; nFinaleStage++;
} }
} }
else if (nFinaleStage <= 2) else if (nFinaleStage <= 2)
{ {
if (leveltime*4 >= nextstage) if (PlayClock >= nextstage)
{ {
PlayLocalSound(StaticSound[kSound77], 0); PlayLocalSound(StaticSound[kSound77], 0);
nFinaleStage++; nFinaleStage++;
nextstage = leveltime*4 + 360; nextstage = PlayClock + 360;
} }
} }
else if (nFinaleStage == 3 && leveltime*4 >= nextstage) else if (nFinaleStage == 3 && PlayClock >= nextstage)
{ {
LevelFinished(); LevelFinished();
} }
@ -1856,7 +1856,7 @@ void ExplodeEnergyBlock(int nSprite)
else else
{ {
nFinaleSpr = nSprite; nFinaleSpr = nSprite;
lFinaleStart = leveltime*4; lFinaleStart = PlayClock;
if (!lFinaleStart) { if (!lFinaleStart) {
lFinaleStart = lFinaleStart + 1; lFinaleStart = lFinaleStart + 1;

View file

@ -128,7 +128,7 @@ void InitSpiritHead()
sprite[nSpiritSprite].cstat &= 0x7FFF; sprite[nSpiritSprite].cstat &= 0x7FFF;
nHeadTimeStart = leveltime*4; nHeadTimeStart = PlayClock;
memset(Worktile, TRANSPARENT_INDEX, WorktileSize); memset(Worktile, TRANSPARENT_INDEX, WorktileSize);
TileFiles.InvalidateTile(kTileRamsesWorkTile); TileFiles.InvalidateTile(kTileRamsesWorkTile);
@ -153,8 +153,8 @@ void InitSpiritHead()
StartSwirlies(); StartSwirlies();
sprintf(filename, "LEV%d.PUP", currentLevel->levelNumber); sprintf(filename, "LEV%d.PUP", currentLevel->levelNumber);
lNextStateChange = leveltime*4; lNextStateChange = PlayClock;
lHeadStartClock = leveltime*4; lHeadStartClock = PlayClock;
auto headfd = fileSystem.OpenFileReader(filename); auto headfd = fileSystem.OpenFileReader(filename);
if (!headfd.isOpen()) if (!headfd.isOpen())
@ -212,7 +212,6 @@ void DoSpiritHead()
sPlayerInput[0].actions |= SB_CENTERVIEW; sPlayerInput[0].actions |= SB_CENTERVIEW;
TileFiles.InvalidateTile(kTileRamsesWorkTile); TileFiles.InvalidateTile(kTileRamsesWorkTile);
int totalclock = leveltime * 4;
switch (nHeadStage) switch (nHeadStage)
{ {
@ -221,7 +220,7 @@ void DoSpiritHead()
memset(Worktile, TRANSPARENT_INDEX, WorktileSize); memset(Worktile, TRANSPARENT_INDEX, WorktileSize);
break; break;
case 5: case 5:
if (lNextStateChange <= totalclock) if (lNextStateChange <= PlayClock)
{ {
if (nPupData != 0) if (nPupData != 0)
{ {
@ -291,7 +290,7 @@ void DoSpiritHead()
return; return;
} }
nPixelsToShow = 15 * (totalclock - nHeadTimeStart); nPixelsToShow = 15 * (PlayClock - nHeadTimeStart);
if (nPixelsToShow > nPixels) if (nPixelsToShow > nPixels)
nPixelsToShow = nPixels; nPixelsToShow = nPixels;
@ -319,10 +318,10 @@ void DoSpiritHead()
if (nHeadStage == 0) if (nHeadStage == 0)
{ {
if (totalclock - nHeadTimeStart > 480) if (PlayClock - nHeadTimeStart > 480)
{ {
nHeadStage = 1; nHeadStage = 1;
nHeadTimeStart = totalclock + 480; nHeadTimeStart = PlayClock + 480;
} }
for (int i = 0; i < nPixelsToShow; i++) for (int i = 0; i < nPixelsToShow; i++)
@ -434,7 +433,7 @@ void DoSpiritHead()
Worktile[((cury[i] >> 8) + (212 * ((curx[i] >> 8) + 97))) + 106] = pixelval[i]; Worktile[((cury[i] >> 8) + (212 * ((curx[i] >> 8) + 97))) + 106] = pixelval[i];
} }
if (totalclock - lHeadStartClock > 600) if (PlayClock - lHeadStartClock > 600)
CopyHeadToWorkTile(590); CopyHeadToWorkTile(590);
if (nCount < (15 * nPixels) / 16) { if (nCount < (15 * nPixels) / 16) {

View file

@ -456,7 +456,7 @@ void EXSoundEngine::CalcPosVel(int type, const void* source, const float pt[3],
else if (type == SOURCE_Swirly) else if (type == SOURCE_Swirly)
{ {
int which = *(int*)source; int which = *(int*)source;
float phase = (leveltime << (6 + which)) * BAngRadian; float phase = (PlayClock << (4 + which)) * BAngRadian;
pos->X = fcampos.X + 256 * cos(phase); pos->X = fcampos.X + 256 * cos(phase);
pos->Z = fcampos.Z + 256 * sin(phase); pos->Z = fcampos.Z + 256 * sin(phase);
} }

View file

@ -661,7 +661,7 @@ private:
int shade; int shade;
if ((leveltime / 30) & 1) { if ((PlayClock / 120) & 1) {
shade = -100; shade = -100;
} }
else { else {
@ -733,11 +733,11 @@ private:
imgScale = baseScale / img->GetDisplayHeight(); imgScale = baseScale / img->GetDisplayHeight();
DrawGraphic(img, 1.5, -1, DI_ITEM_LEFT_BOTTOM, 1., -1, -1, imgScale, imgScale); DrawGraphic(img, 1.5, -1, DI_ITEM_LEFT_BOTTOM, 1., -1, -1, imgScale, imgScale);
if (!althud_flashing || pp->nHealth > 150 || (leveltime & 8)) if (!althud_flashing || pp->nHealth > 150 || (PlayClock & 32))
{ {
int s = -8; int s = -8;
if (althud_flashing && pp->nHealth > 800) if (althud_flashing && pp->nHealth > 800)
s += bsin(leveltime << 7, -10); s += bsin(PlayClock << 5, -10);
int intens = clamp(255 - 4 * s, 0, 255); int intens = clamp(255 - 4 * s, 0, 255);
auto pe = PalEntry(255, intens, intens, intens); auto pe = PalEntry(255, intens, intens, intens);
format.Format("%d", pp->nHealth >> 3); format.Format("%d", pp->nHealth >> 3);
@ -799,7 +799,7 @@ private:
imgX += (imgX * 0.855) * (strlen - 1); imgX += (imgX * 0.855) * (strlen - 1);
} }
if ((!althud_flashing || leveltime & 8 || ammo > 10))// (DamageData[weapon].max_ammo / 10))) if ((!althud_flashing || PlayClock & 32 || ammo > 10))// (DamageData[weapon].max_ammo / 10)))
{ {
SBar_DrawString(this, numberFont, format, -3, -numberFont->mFont->GetHeight()+3, DI_TEXT_ALIGN_RIGHT, CR_UNTRANSLATED, 1, 0, 0, 1, 1); SBar_DrawString(this, numberFont, format, -3, -numberFont->mFont->GetHeight()+3, DI_TEXT_ALIGN_RIGHT, CR_UNTRANSLATED, 1, 0, 0, 1, 1);
} }
@ -940,7 +940,7 @@ private:
stats.font = SmallFont; stats.font = SmallFont;
stats.letterColor = CR_RED; stats.letterColor = CR_RED;
stats.standardColor = CR_UNTRANSLATED; stats.standardColor = CR_UNTRANSLATED;
stats.time = Scale(leveltime, 1000, 30); stats.time = Scale(PlayClock, 1000, 120);
if (automapMode == am_full) if (automapMode == am_full)
{ {

View file

@ -2196,7 +2196,6 @@ void InitFonts();
int32_t registerosdcommands(void); int32_t registerosdcommands(void);
void SW_InitMultiPsky(void); void SW_InitMultiPsky(void);
extern int PlayClock;
extern short LevelSecrets; extern short LevelSecrets;
extern short TotalKillable; extern short TotalKillable;
extern int OrigCommPlayers; extern int OrigCommPlayers;

View file

@ -43,7 +43,6 @@ Prepared for public release: 03/28/2005 - Charlie Wiederhold, 3D Realms
BEGIN_SW_NS BEGIN_SW_NS
static uint8_t tempbuf[576], packbuf[576]; static uint8_t tempbuf[576], packbuf[576];
int PlayClock;
gNET gNet; gNET gNet;

View file

@ -7084,7 +7084,6 @@ void PauseMultiPlay(void)
void void
domovethings(void) domovethings(void)
{ {
extern int PlayClock;
short i, pnum; short i, pnum;
PLAYERp pp; PLAYERp pp;

View file

@ -70,7 +70,6 @@ void InitLevelGlobals(void);
extern int lastUpdate; extern int lastUpdate;
extern char SaveGameDescr[10][80]; extern char SaveGameDescr[10][80];
extern int PlayClock;
extern short Bunny_Count; extern short Bunny_Count;
extern bool NewGame; extern bool NewGame;
extern int GodMode; extern int GodMode;