- Blood: Cleanup some timing variables following timing uplift.

* Remove cast of int on `gFrameClock` since gFrameClock is now just an int.
* Remove unused `gFrameTicks`.
* Remove unused `gFrameRate`.
* Rename `gFrame` to `gFrameCount` so it's easier to search and distinguish from `gFrameClock` without relying on regex.
This commit is contained in:
Mitchell Richters 2020-08-26 20:55:46 +10:00
parent ddd6a300ab
commit 5bfd4069ef
17 changed files with 51 additions and 77 deletions

View file

@ -2935,7 +2935,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].at0 = (int)gFrameClock + 360; gDudeExtra[pSprite->extra].at0 = gFrameClock + 360;
return; return;
} }
@ -3572,7 +3572,7 @@ int actDamageSprite(int nSource, spritetype *pSprite, DAMAGE_TYPE damageType, in
case kThingZombieHead: case kThingZombieHead:
if (damageType == 3 && pSourcePlayer && gFrameClock > pSourcePlayer->laughCount && Chance(0x4000)) { if (damageType == 3 && pSourcePlayer && gFrameClock > pSourcePlayer->laughCount && Chance(0x4000)) {
sfxPlay3DSound(pSourcePlayer->pSprite, gPlayerGibThingComments[Random(10)], 0, 2); sfxPlay3DSound(pSourcePlayer->pSprite, gPlayerGibThingComments[Random(10)], 0, 2);
pSourcePlayer->laughCount = (int)gFrameClock+3600; pSourcePlayer->laughCount = gFrameClock+3600;
} }
break; break;
case kTrapMachinegun: case kTrapMachinegun:
@ -4211,7 +4211,7 @@ void ProcessTouchObjects(spritetype *pSprite, int nXSprite)
case kThingKickablePail: case kThingKickablePail:
if (pPlayer) { if (pPlayer) {
if (pPlayer->kickPower > gFrameClock) return; if (pPlayer->kickPower > gFrameClock) return;
pPlayer->kickPower = (int)gFrameClock+60; pPlayer->kickPower = gFrameClock+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);
@ -4220,7 +4220,7 @@ void ProcessTouchObjects(spritetype *pSprite, int nXSprite)
case kThingZombieHead: case kThingZombieHead:
if (pPlayer) { if (pPlayer) {
if (pPlayer->kickPower > gFrameClock) return; if (pPlayer->kickPower > gFrameClock) return;
pPlayer->kickPower = (int)gFrameClock+60; pPlayer->kickPower = gFrameClock+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);
@ -4400,9 +4400,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 = ((int)gFrameClock*3)&2047; int v34 = (gFrameClock*3)&2047;
int v30 = ((int)gFrameClock*5)&2047; int v30 = (gFrameClock*5)&2047;
int vbx = ((int)gFrameClock*11)&2047; int vbx = (gFrameClock*11)&2047;
int v2c = 0x44444; int v2c = 0x44444;
int v28 = 0; int v28 = 0;
int v24 = 0; int v24 = 0;
@ -5571,7 +5571,7 @@ void actProcessSprites(void)
} }
actAirDrag(pSprite, 128); actAirDrag(pSprite, 128);
if (((pSprite->index>>8)&15) == (gFrame&15) && (pSprite->flags&2)) if (((pSprite->index>>8)&15) == (gFrameCount&15) && (pSprite->flags&2))
pSprite->flags |= 4; pSprite->flags |= 4;
if ((pSprite->flags&4) || xvel[nSprite] || yvel[nSprite] || zvel[nSprite] || if ((pSprite->flags&4) || xvel[nSprite] || yvel[nSprite] || zvel[nSprite] ||
velFloor[pSprite->sectnum] || velCeil[pSprite->sectnum]) velFloor[pSprite->sectnum] || velCeil[pSprite->sectnum])
@ -6221,7 +6221,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 = (int)gFrameClock+180.0; pXThing->targetX = gFrameClock+180.0;
pXThing->locked = 1; pXThing->locked = 1;
pXThing->state = 1; pXThing->state = 1;
pXThing->triggerOnce = 0; pXThing->triggerOnce = 0;
@ -6233,7 +6233,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 = (int)gFrameClock+180.0; pXThing->targetX = gFrameClock+180.0;
pXThing->locked = 1; pXThing->locked = 1;
pXThing->state = 1; pXThing->state = 1;
pXThing->triggerOnce = 0; pXThing->triggerOnce = 0;
@ -6830,7 +6830,7 @@ void DudeToGibCallback1(int, int nXSprite)
pXSprite->triggerOnce = 0; pXSprite->triggerOnce = 0;
pXSprite->isTriggered = 0; pXSprite->isTriggered = 0;
pXSprite->locked = 0; pXSprite->locked = 0;
pXSprite->targetX = (int)gFrameClock; pXSprite->targetX = gFrameClock;
pXSprite->state = 1; pXSprite->state = 1;
} }
@ -6848,7 +6848,7 @@ void DudeToGibCallback2(int, int nXSprite)
pXSprite->triggerOnce = 0; pXSprite->triggerOnce = 0;
pXSprite->isTriggered = 0; pXSprite->isTriggered = 0;
pXSprite->locked = 0; pXSprite->locked = 0;
pXSprite->targetX = (int)gFrameClock; pXSprite->targetX = gFrameClock;
pXSprite->state = 1; pXSprite->state = 1;
} }

View file

@ -75,12 +75,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->at5 || pDudeExtra->at0 <= (int)gFrameClock) else if (a3 > pDudeExtra->at5 || pDudeExtra->at0 <= gFrameClock)
{ {
sfxKill3DSound(pSprite, -1, -1); sfxKill3DSound(pSprite, -1, -1);
sfxPlay3DSound(pSprite, a2, a4, 0); sfxPlay3DSound(pSprite, a2, a4, 0);
pDudeExtra->at5 = a3; pDudeExtra->at5 = a3;
pDudeExtra->at0 = (int)gFrameClock+120; pDudeExtra->at0 = gFrameClock+120;
} }
} }
@ -935,7 +935,7 @@ int aiDamageSprite(spritetype *pSprite, XSPRITE *pXSprite, int nSource, DAMAGE_T
aiNewState(pSprite, pXSprite, &cultistBurnGoto); aiNewState(pSprite, pXSprite, &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].at0 = (int)gFrameClock+360; gDudeExtra[pSprite->extra].at0 = gFrameClock+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);
} }
@ -946,7 +946,7 @@ int aiDamageSprite(spritetype *pSprite, XSPRITE *pXSprite, int nSource, DAMAGE_T
pSprite->type = kDudeBurningInnocent; pSprite->type = kDudeBurningInnocent;
aiNewState(pSprite, pXSprite, &cultistBurnGoto); aiNewState(pSprite, pXSprite, &cultistBurnGoto);
aiPlay3DSound(pSprite, 361, AI_SFX_PRIORITY_0, -1); aiPlay3DSound(pSprite, 361, AI_SFX_PRIORITY_0, -1);
gDudeExtra[pSprite->extra].at0 = (int)gFrameClock+360; gDudeExtra[pSprite->extra].at0 = gFrameClock+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);
} }
@ -955,7 +955,7 @@ int aiDamageSprite(spritetype *pSprite, XSPRITE *pXSprite, int nSource, DAMAGE_T
if (Chance(0x4000) && gDudeExtra[pSprite->extra].at0 < gFrameClock) if (Chance(0x4000) && gDudeExtra[pSprite->extra].at0 < gFrameClock)
{ {
aiPlay3DSound(pSprite, 1031+Random(2), AI_SFX_PRIORITY_2, -1); aiPlay3DSound(pSprite, 1031+Random(2), AI_SFX_PRIORITY_2, -1);
gDudeExtra[pSprite->extra].at0 = (int)gFrameClock+360; gDudeExtra[pSprite->extra].at0 = gFrameClock+360;
} }
if (Chance(0x600) && (pXSprite->medium == kMediumWater || pXSprite->medium == kMediumGoo)) if (Chance(0x600) && (pXSprite->medium == kMediumWater || pXSprite->medium == kMediumGoo))
{ {
@ -989,16 +989,16 @@ int aiDamageSprite(spritetype *pSprite, XSPRITE *pXSprite, int nSource, DAMAGE_T
pSprite->type = kDudeBurningInnocent; pSprite->type = kDudeBurningInnocent;
aiNewState(pSprite, pXSprite, &cultistBurnGoto); aiNewState(pSprite, pXSprite, &cultistBurnGoto);
aiPlay3DSound(pSprite, 361, AI_SFX_PRIORITY_0, -1); aiPlay3DSound(pSprite, 361, AI_SFX_PRIORITY_0, -1);
gDudeExtra[pSprite->extra].at0 = (int)gFrameClock+360; gDudeExtra[pSprite->extra].at0 = gFrameClock+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].at0 < (int)gFrameClock) { if (Chance(0x2000) && gDudeExtra[pSprite->extra].at0 < gFrameClock) {
playGenDudeSound(pSprite, kGenDudeSndBurning); playGenDudeSound(pSprite, kGenDudeSndBurning);
gDudeExtra[pSprite->extra].at0 = (int)gFrameClock + 360; gDudeExtra[pSprite->extra].at0 = gFrameClock + 360;
} }
if (pXSprite->burnTime == 0) pXSprite->burnTime = 2400; if (pXSprite->burnTime == 0) pXSprite->burnTime = 2400;
if (spriteIsUnderwater(pSprite, false)) { if (spriteIsUnderwater(pSprite, false)) {
@ -1038,7 +1038,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].at0 = (int)gFrameClock + 360; gDudeExtra[pSprite->extra].at0 = gFrameClock + 360;
evKill(nSprite, 3, kCallbackFXFlameLick); evKill(nSprite, 3, kCallbackFXFlameLick);
} }
@ -1453,7 +1453,7 @@ void aiProcessDudes(void) {
if (pXSprite->aiState->moveFunc) if (pXSprite->aiState->moveFunc)
pXSprite->aiState->moveFunc(pSprite, pXSprite); pXSprite->aiState->moveFunc(pSprite, pXSprite);
if (pXSprite->aiState->thinkFunc && (gFrame & 3) == (nSprite & 3)) if (pXSprite->aiState->thinkFunc && (gFrameCount & 3) == (nSprite & 3))
pXSprite->aiState->thinkFunc(pSprite, pXSprite); pXSprite->aiState->thinkFunc(pSprite, pXSprite);
switch (pSprite->type) { switch (pSprite->type) {

View file

@ -497,7 +497,7 @@ static void thinkChase( spritetype* pSprite, XSPRITE* pXSprite ) {
// is the target visible? // is the target visible?
if (dist < pDudeInfo->seeDist && klabs(losAngle) <= pDudeInfo->periphery) { if (dist < pDudeInfo->seeDist && klabs(losAngle) <= pDudeInfo->periphery) {
if (((int)gFrameClock & 64) == 0 && Chance(0x3000) && !spriteIsUnderwater(pSprite, false)) if ((gFrameClock & 64) == 0 && Chance(0x3000) && !spriteIsUnderwater(pSprite, false))
playGenDudeSound(pSprite, kGenDudeSndChasing); playGenDudeSound(pSprite, kGenDudeSndChasing);
gDudeSlope[pSprite->extra] = divscale(pTarget->z - pSprite->z, dist, 10); gDudeSlope[pSprite->extra] = divscale(pTarget->z - pSprite->z, dist, 10);

View file

@ -143,7 +143,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 = ((int)gFrameClock*2048)/120; int ang = (gFrameClock*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];

View file

@ -504,7 +504,7 @@ void StartLevel(MapRecord *level)
sfxSetReverb(0); sfxSetReverb(0);
ambInit(); ambInit();
netReset(); netReset();
gFrame = 0; gFrameCount = 0;
gChokeCounter = 0; gChokeCounter = 0;
M_ClearMenus(); M_ClearMenus();
// viewSetMessage(""); // viewSetMessage("");
@ -580,7 +580,7 @@ void ProcessFrame(void)
playerProcess(&gPlayer[i]); playerProcess(&gPlayer[i]);
} }
trProcessBusy(); trProcessBusy();
evProcess((int)gFrameClock); evProcess(gFrameClock);
seqProcess(4); seqProcess(4);
DoSectorPanning(); DoSectorPanning();
actProcessSprites(); actProcessSprites();
@ -605,7 +605,7 @@ void ProcessFrame(void)
} }
} }
gLevelTime++; gLevelTime++;
gFrame++; gFrameCount++;
gFrameClock += 4; gFrameClock += 4;
if ((gGameOptions.uGameFlags&1) != 0 && !gStartNewGame) if ((gGameOptions.uGameFlags&1) != 0 && !gStartNewGame)
{ {
@ -800,7 +800,6 @@ static void gameTicker()
gInput = {}; gInput = {};
netGetInput(); netGetInput();
lastTic = currentTic; lastTic = currentTic;
gNetFifoClock = gameclock;
while (gNetFifoHead[myconnectindex] - gNetFifoTail > gBufferJitter && !gStartNewGame && !gQuitGame) while (gNetFifoHead[myconnectindex] - gNetFifoTail > gBufferJitter && !gStartNewGame && !gQuitGame)
{ {
int i; int i;
@ -853,7 +852,7 @@ static void commonTicker()
auto completion = [=](bool = false) auto completion = [=](bool = false)
{ {
StartLevel(sng); StartLevel(sng);
gNetFifoClock = gFrameClock = gameclock; gFrameClock = gameclock;
gamestate = GS_LEVEL; gamestate = GS_LEVEL;
}; };

View file

@ -493,7 +493,7 @@ void evPost(int nIndex, int nType, unsigned int nDelta, COMMAND_ID command) {
evn.index = nIndex; evn.index = nIndex;
evn.type = nType; evn.type = nType;
evn.cmd = command; evn.cmd = command;
eventQ.PQueue->Insert((int)gFrameClock+nDelta, evn); eventQ.PQueue->Insert(gFrameClock+nDelta, 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) {
@ -502,7 +502,7 @@ void evPost(int nIndex, int nType, unsigned int nDelta, CALLBACK_ID callback) {
evn.type = nType; evn.type = nType;
evn.cmd = kCmdCallback; evn.cmd = kCmdCallback;
evn.funcID = callback; evn.funcID = callback;
eventQ.PQueue->Insert((int)gFrameClock+nDelta, evn); eventQ.PQueue->Insert(gFrameClock+nDelta, evn);
} }
void evProcess(unsigned int nTime) void evProcess(unsigned int nTime)

View file

@ -143,18 +143,6 @@ bool FindSector(int nX, int nY, int *nSector)
return 0; return 0;
} }
void CalcFrameRate(void)
{
static int ticks[64];
static int index;
if (ticks[index] != gFrameClock)
{
gFrameRate = (120*64)/((int)gFrameClock-ticks[index]);
ticks[index] = (int)gFrameClock;
}
index = (index+1) & 63;
}
bool CheckProximity(spritetype *pSprite, int nX, int nY, int nZ, int nSector, int nDist) bool CheckProximity(spritetype *pSprite, int nX, int nY, int nZ, int nSector, int nDist)
{ {
dassert(pSprite != NULL); dassert(pSprite != NULL);

View file

@ -68,7 +68,6 @@ inline bool wallRangeIsFine(int nIndex) {
bool AreSectorsNeighbors(int sect1, int sect2); bool AreSectorsNeighbors(int sect1, int sect2);
bool FindSector(int nX, int nY, int nZ, int *nSector); bool FindSector(int nX, int nY, int nZ, int *nSector);
bool FindSector(int nX, int nY, int *nSector); bool FindSector(int nX, int nY, int *nSector);
void CalcFrameRate(void);
bool CheckProximity(spritetype *pSprite, int nX, int nY, int nZ, int nSector, int nDist); bool CheckProximity(spritetype *pSprite, int nX, int nY, int nZ, int nSector, int nDist);
bool CheckProximityPoint(int nX1, int nY1, int nZ1, int nX2, int nY2, int nZ2, int nDist); bool CheckProximityPoint(int nX1, int nY1, int nZ1, int nX2, int nY2, int nZ2, int nDist);
bool CheckProximityWall(int nWall, int x, int y, int nDist); bool CheckProximityWall(int nWall, int x, int y, int nDist);

View file

@ -34,10 +34,8 @@ BEGIN_BLD_NS
bool bVanilla = false; bool bVanilla = false;
int gFrameClock; int gFrameClock;
int gFrameTicks; int gFrameCount;
int gFrame;
//int volatile gGameClock; //int volatile gGameClock;
int gFrameRate;
static const char *_module; static const char *_module;
static int _line; static int _line;

View file

@ -31,10 +31,8 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
BEGIN_BLD_NS BEGIN_BLD_NS
extern int gFrameClock; extern int gFrameClock;
extern int gFrameTicks; extern int gFrameCount;
extern int gFrame;
//extern int gGameClock; //extern int gGameClock;
extern int gFrameRate;
extern bool bVanilla; extern bool bVanilla;
#define MAXPLAYERNAME 16 #define MAXPLAYERNAME 16

View file

@ -504,7 +504,6 @@ bool GameInterface::LoadGame(FSaveGameNode* node)
memset(myMinLag, 0, sizeof(myMinLag)); memset(myMinLag, 0, sizeof(myMinLag));
otherMinLag = 0; otherMinLag = 0;
myMaxLag = 0; myMaxLag = 0;
gNetFifoClock = 0;
gNetFifoTail = 0; gNetFifoTail = 0;
memset(gNetFifoHead, 0, sizeof(gNetFifoHead)); memset(gNetFifoHead, 0, sizeof(gNetFifoHead));
gPredictTail = 0; gPredictTail = 0;
@ -522,9 +521,7 @@ bool GameInterface::LoadGame(FSaveGameNode* node)
netWaitForEveryone(0); netWaitForEveryone(0);
memset(gPlayerReady, 0, sizeof(gPlayerReady)); memset(gPlayerReady, 0, sizeof(gPlayerReady));
} }
gFrameTicks = 0; gFrameCount = 0;
gFrame = 0;
gFrameRate = 0;
gameclock = 0; gameclock = 0;
lastTic = -1; lastTic = -1;
paused = 0; paused = 0;
@ -617,8 +614,7 @@ void MyLoadSave::Load(void)
Read(gotpic, sizeof(gotpic)); Read(gotpic, sizeof(gotpic));
Read(gotsector, sizeof(gotsector)); Read(gotsector, sizeof(gotsector));
Read(&gFrameClock, sizeof(gFrameClock)); Read(&gFrameClock, sizeof(gFrameClock));
Read(&gFrameTicks, sizeof(gFrameTicks)); Read(&gFrameCount, sizeof(gFrameCount));
Read(&gFrame, sizeof(gFrame));
Read(&gameclock, sizeof(gameclock)); Read(&gameclock, sizeof(gameclock));
Read(&gLevelTime, sizeof(gLevelTime)); Read(&gLevelTime, sizeof(gLevelTime));
Read(&paused, sizeof(paused)); Read(&paused, sizeof(paused));
@ -708,8 +704,7 @@ void MyLoadSave::Save(void)
Write(gotpic, sizeof(gotpic)); Write(gotpic, sizeof(gotpic));
Write(gotsector, sizeof(gotsector)); Write(gotsector, sizeof(gotsector));
Write(&gFrameClock, sizeof(gFrameClock)); Write(&gFrameClock, sizeof(gFrameClock));
Write(&gFrameTicks, sizeof(gFrameTicks)); Write(&gFrameCount, sizeof(gFrameCount));
Write(&gFrame, sizeof(gFrame));
int nGameClock = gameclock; int nGameClock = gameclock;
Write(&nGameClock, sizeof(nGameClock)); Write(&nGameClock, sizeof(nGameClock));
Write(&gLevelTime, sizeof(gLevelTime)); Write(&gLevelTime, sizeof(gLevelTime));

View file

@ -40,7 +40,6 @@ BEGIN_BLD_NS
MapRecord *gStartNewGame = 0; MapRecord *gStartNewGame = 0;
PACKETMODE gPacketMode = PACKETMODE_1; PACKETMODE gPacketMode = PACKETMODE_1;
int gNetFifoClock = 0;
int gNetFifoTail = 0; int gNetFifoTail = 0;
int gNetFifoHead[8]; int gNetFifoHead[8];
int gPredictTail = 0; int gPredictTail = 0;
@ -78,7 +77,7 @@ void netResetToSinglePlayer(void)
void netReset(void) void netReset(void)
{ {
gNetFifoClock = gFrameClock = gameclock = 0; gFrameClock = gameclock = 0;
lastTic = -1; lastTic = -1;
gNetFifoMasterTail = 0; gNetFifoMasterTail = 0;
gPredictTail = 0; gPredictTail = 0;

View file

@ -45,7 +45,6 @@ enum NETWORKMODE {
extern MapRecord *gStartNewGame; extern MapRecord *gStartNewGame;
extern PACKETMODE gPacketMode; extern PACKETMODE gPacketMode;
extern int gNetFifoClock;
extern int gNetFifoTail; extern int gNetFifoTail;
extern int gNetFifoHead[8]; extern int gNetFifoHead[8];
extern int gPredictTail; extern int gPredictTail;

View file

@ -885,7 +885,7 @@ void nnExtProcessSuperSprites() {
actAirDrag(pDebris, airVel); actAirDrag(pDebris, airVel);
if (((pDebris->index >> 8) & 15) == (gFrame & 15) && (pXDebris->physAttr & kPhysGravity)) if (((pDebris->index >> 8) & 15) == (gFrameCount & 15) && (pXDebris->physAttr & kPhysGravity))
pXDebris->physAttr |= kPhysFalling; pXDebris->physAttr |= kPhysFalling;
if ((pXDebris->physAttr & 4) == 0 && xvel[pDebris->index] == 0 && yvel[pDebris->index] == 0 && if ((pXDebris->physAttr & 4) == 0 && xvel[pDebris->index] == 0 && yvel[pDebris->index] == 0 &&
@ -4588,7 +4588,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 (((int)gFrameClock & 256) != 0 && (pXSprite->target < 0 || aiFightGetTargetDist(pSprite, pDudeInfo, pTarget) >= mDist)) { else if ((gFrameClock & 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];
@ -4618,7 +4618,7 @@ void useTargetChanger(XSPRITE* pXSource, spritetype* pSprite) {
} }
} }
if ((pXSprite->target < 0 || pPlayer != NULL) && ((int)gFrameClock & 32) != 0) { if ((pXSprite->target < 0 || pPlayer != NULL) && (gFrameClock & 32) != 0) {
// try find first target that dude can see // try find first target that dude can see
for (int nSprite = headspritestat[kStatDude]; nSprite >= 0; nSprite = nextspritestat[nSprite]) { for (int nSprite = headspritestat[kStatDude]; nSprite >= 0; nSprite = nextspritestat[nSprite]) {
@ -4664,7 +4664,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 && ((int)gFrameClock & 64) != 0) { if ((pXSprite->target < 0 || pPlayer != NULL) && pXSource->data2 == 1 && (gFrameClock & 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];

View file

@ -38,7 +38,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 = (int)gFrameClock; int const frameClock = gFrameClock;
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

@ -572,7 +572,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 = (int)gFrameClock*4; int timer = gFrameClock*4;
if (powerCount < 512) if (powerCount < 512)
{ {
int powerScale = (powerCount<<16) / 512; int powerScale = (powerCount<<16) / 512;
@ -1057,7 +1057,6 @@ void viewDrawScreen(bool sceneonly)
DrawStatSprite(2048, xdim-15, 20); DrawStatSprite(2048, xdim-15, 20);
} }
#endif #endif
CalcFrameRate();
viewDrawMapTitle(); viewDrawMapTitle();
viewDrawAimedPlayerName(); viewDrawAimedPlayerName();

View file

@ -1781,12 +1781,12 @@ char sub_4F0E0(PLAYER *pPlayer)
{ {
pPlayer->weaponState = 7; pPlayer->weaponState = 7;
pPlayer->fuseTime = 0; pPlayer->fuseTime = 0;
pPlayer->throwTime = (int)gFrameClock; pPlayer->throwTime = gFrameClock;
} }
return 1; return 1;
case 7: case 7:
{ {
pPlayer->throwPower = ClipHigh(divscale16((int)gFrameClock-pPlayer->throwTime,240), 65536); pPlayer->throwPower = ClipHigh(divscale16(gFrameClock-pPlayer->throwTime,240), 65536);
if (!pPlayer->input.buttonFlags.shoot) if (!pPlayer->input.buttonFlags.shoot)
{ {
if (!pPlayer->fuseTime) if (!pPlayer->fuseTime)
@ -1819,12 +1819,12 @@ char sub_4F200(PLAYER *pPlayer)
{ {
pPlayer->weaponState = 6; pPlayer->weaponState = 6;
pPlayer->fuseTime = 0; pPlayer->fuseTime = 0;
pPlayer->throwTime = (int)gFrameClock; pPlayer->throwTime = gFrameClock;
} }
return 1; return 1;
case 6: case 6:
{ {
pPlayer->throwPower = ClipHigh(divscale16((int)gFrameClock-pPlayer->throwTime,240), 65536); pPlayer->throwPower = ClipHigh(divscale16(gFrameClock-pPlayer->throwTime,240), 65536);
if (!pPlayer->input.buttonFlags.shoot) if (!pPlayer->input.buttonFlags.shoot)
{ {
if (!pPlayer->fuseTime) if (!pPlayer->fuseTime)
@ -1843,7 +1843,7 @@ char sub_4F320(PLAYER *pPlayer)
switch (pPlayer->weaponState) switch (pPlayer->weaponState)
{ {
case 9: case 9:
pPlayer->throwPower = ClipHigh(divscale16((int)gFrameClock-pPlayer->throwTime,240), 65536); pPlayer->throwPower = ClipHigh(divscale16(gFrameClock-pPlayer->throwTime,240), 65536);
pPlayer->weaponTimer = 0; pPlayer->weaponTimer = 0;
if (!pPlayer->input.buttonFlags.shoot) if (!pPlayer->input.buttonFlags.shoot)
{ {
@ -1860,7 +1860,7 @@ char sub_4F3A0(PLAYER *pPlayer)
switch (pPlayer->weaponState) switch (pPlayer->weaponState)
{ {
case 13: case 13:
pPlayer->throwPower = ClipHigh(divscale16((int)gFrameClock-pPlayer->throwTime,240), 65536); pPlayer->throwPower = ClipHigh(divscale16(gFrameClock-pPlayer->throwTime,240), 65536);
if (!pPlayer->input.buttonFlags.shoot) if (!pPlayer->input.buttonFlags.shoot)
{ {
pPlayer->weaponState = 11; pPlayer->weaponState = 11;
@ -2197,7 +2197,7 @@ void WeaponProcess(PLAYER *pPlayer) {
case 3: case 3:
pPlayer->weaponState = 6; pPlayer->weaponState = 6;
pPlayer->fuseTime = -1; pPlayer->fuseTime = -1;
pPlayer->throwTime = (int)gFrameClock; pPlayer->throwTime = gFrameClock;
StartQAV(pPlayer, 21, nClientExplodeBundle, 0); StartQAV(pPlayer, 21, nClientExplodeBundle, 0);
return; return;
} }
@ -2208,7 +2208,7 @@ void WeaponProcess(PLAYER *pPlayer) {
case 7: case 7:
pPlayer->weaponQav = 27; pPlayer->weaponQav = 27;
pPlayer->weaponState = 9; pPlayer->weaponState = 9;
pPlayer->throwTime = (int)gFrameClock; pPlayer->throwTime = gFrameClock;
return; return;
} }
break; break;
@ -2218,7 +2218,7 @@ void WeaponProcess(PLAYER *pPlayer) {
case 10: case 10:
pPlayer->weaponQav = 36; pPlayer->weaponQav = 36;
pPlayer->weaponState = 13; pPlayer->weaponState = 13;
pPlayer->throwTime = (int)gFrameClock; pPlayer->throwTime = gFrameClock;
return; return;
case 11: case 11:
pPlayer->weaponState = 12; pPlayer->weaponState = 12;