diff --git a/source/blood/src/player.cpp b/source/blood/src/player.cpp index 761b1f8f2..cc7df073a 100644 --- a/source/blood/src/player.cpp +++ b/source/blood/src/player.cpp @@ -1618,7 +1618,7 @@ void ProcessInput(PLAYER *pPlayer) { gViewLookAdjust -= float(lookStepDown); } - gViewLookRecenter = ((pInput->actions & SB_CENTERVIEW) && !pInput->actions & (SB_LOOK_UP | SB_LOOK_DOWN)); + gViewLookRecenter = ((pInput->actions & SB_CENTERVIEW) && !(pInput->actions & (SB_LOOK_UP | SB_LOOK_DOWN))); } pPlayer->q16look = fix16_clamp(pPlayer->q16look+(pInput->q16horz<<3), fix16_from_int(downAngle), fix16_from_int(upAngle)); pPlayer->q16horiz = fix16_from_float(100.f*tanf(fix16_to_float(pPlayer->q16look)*fPI/1024.f)); diff --git a/source/blood/src/prediction.cpp b/source/blood/src/prediction.cpp index 735acde05..dcb451c6b 100644 --- a/source/blood/src/prediction.cpp +++ b/source/blood/src/prediction.cpp @@ -262,7 +262,7 @@ static void fakeProcessInput(PLAYER *pPlayer, InputPacket *pInput) int downAngle = -347; double lookStepUp = 4.0*upAngle/60.0; double lookStepDown = -4.0*downAngle/60.0; - if (predict.at6e && !pInput->actions & (SB_LOOK_UP | SB_LOOK_DOWN)) + if (predict.at6e && !(pInput->actions & (SB_LOOK_UP | SB_LOOK_DOWN))) { if (predict.at20 < 0) predict.at20 = fix16_min(predict.at20+fix16_from_dbl(lookStepDown), fix16_from_int(0)); @@ -288,7 +288,7 @@ static void fakeProcessInput(PLAYER *pPlayer, InputPacket *pInput) { gViewLookAdjust -= float(lookStepDown); } - gViewLookRecenter = predict.at6e && !pInput->actions & (SB_LOOK_UP | SB_LOOK_DOWN); + gViewLookRecenter = predict.at6e && !(pInput->actions & (SB_LOOK_UP | SB_LOOK_DOWN)); } predict.at20 = fix16_clamp(predict.at20+(pInput->q16horz<<3), fix16_from_int(downAngle), fix16_from_int(upAngle)); predict.at24 = fix16_from_float(100.f*tanf(fix16_to_float(predict.at20)*fPI/1024.f)); diff --git a/source/core/mainloop.cpp b/source/core/mainloop.cpp index bfca7608c..99904df63 100644 --- a/source/core/mainloop.cpp +++ b/source/core/mainloop.cpp @@ -218,7 +218,7 @@ static void GameTicker() void Display() { - if (screen == nullptr || !AppActive && (screen->IsFullscreen() || !vid_activeinbackground)) + if (screen == nullptr || (!AppActive && (screen->IsFullscreen() || !vid_activeinbackground))) { return; } diff --git a/source/games/duke/src/animatesprites_d.cpp b/source/games/duke/src/animatesprites_d.cpp index 9c5a19b76..39976edef 100644 --- a/source/games/duke/src/animatesprites_d.cpp +++ b/source/games/duke/src/animatesprites_d.cpp @@ -153,7 +153,7 @@ void animatesprites_d(int x,int y,int a,int smoothratio) case SECTOREFFECTOR: if(t->lotag == 27 && ud.recstat == 1) { - t->picnum = 11+((gameclock>>3)&1); + t->picnum = 11+((ud.levelclock>>3)&1); t->cstat |= 128; } else @@ -250,7 +250,7 @@ void animatesprites_d(int x,int y,int a,int smoothratio) t->z -= (4<<8); break; case CRYSTALAMMO: - t->shade = (sintable[(gameclock<<4)&2047]>>10); + t->shade = (sintable[(ud.levelclock<<4)&2047]>>10); continue; case VIEWSCREEN: case VIEWSCREEN2: @@ -268,10 +268,10 @@ void animatesprites_d(int x,int y,int a,int smoothratio) break; case SHRINKSPARK: - t->picnum = SHRINKSPARK+( (gameclock>>4)&3 ); + t->picnum = SHRINKSPARK+( (ud.levelclock>>4)&3 ); break; case GROWSPARK: - t->picnum = GROWSPARK+( (gameclock>>4)&3 ); + t->picnum = GROWSPARK+( (ud.levelclock>>4)&3 ); break; case RPG: /*if (bpp > 8 && usemodels && md_tilehasmodel(s->picnum) >= 0) { @@ -646,7 +646,7 @@ void animatesprites_d(int x,int y,int a,int smoothratio) if(t->picnum == EXPLOSION2) { ps[screenpeek].visibility = -127; - lastvisinc = gameclock+32; + lastvisinc = ud.levelclock+32; } t->shade = -127; break; diff --git a/source/games/duke/src/animatesprites_r.cpp b/source/games/duke/src/animatesprites_r.cpp index 2892806fe..4dc59a984 100644 --- a/source/games/duke/src/animatesprites_r.cpp +++ b/source/games/duke/src/animatesprites_r.cpp @@ -142,7 +142,7 @@ void animatesprites_r(int x,int y,int a,int smoothratio) case SECTOREFFECTOR: if (t->lotag == 27 && ud.recstat == 1) { - t->picnum = 11 + ((gameclock >> 3) & 1); + t->picnum = 11 + ((ud.levelclock >> 3) & 1); t->cstat |= 128; } else @@ -180,7 +180,7 @@ void animatesprites_r(int x,int y,int a,int smoothratio) case RESPAWNMARKERRED: case RESPAWNMARKERYELLOW: case RESPAWNMARKERGREEN: - t->picnum = 861+( (gameclock>>4) & 13); + t->picnum = 861+( (ud.levelclock>>4) & 13); if (s->picnum == RESPAWNMARKERRED) t->pal = 0; else if (s->picnum == RESPAWNMARKERYELLOW) @@ -247,21 +247,21 @@ void animatesprites_r(int x,int y,int a,int smoothratio) t->z -= (4<<8); break; case CRYSTALAMMO: - t->shade = (sintable[(gameclock<<4)&2047]>>10); + t->shade = (sintable[(ud.levelclock<<4)&2047]>>10); break; case SHRINKSPARK: if ((sprite[s->owner].picnum == CHEER || sprite[s->owner].picnum == CHEERSTAYPUT) && isRRRA()) { - t->picnum = CHEERBLADE+( (gameclock>>4)&3 ); + t->picnum = CHEERBLADE+( (ud.levelclock>>4)&3 ); t->shade = -127; } else - t->picnum = SHRINKSPARK+( (gameclock>>4)&7 ); + t->picnum = SHRINKSPARK+( (ud.levelclock>>4)&7 ); break; case CHEERBOMB: if (isRRRA()) { - t->picnum = CHEERBOMB + ((gameclock >> 4) & 3); + t->picnum = CHEERBOMB + ((ud.levelclock >> 4) & 3); break; } else goto default_case; @@ -269,10 +269,10 @@ void animatesprites_r(int x,int y,int a,int smoothratio) if(isRRRA()) { if (sprite[s->owner].picnum == MINION && sprite[s->owner].pal == 8) - t->picnum = RRTILE3500 + ((gameclock >> 4) % 6); + t->picnum = RRTILE3500 + ((ud.levelclock >> 4) % 6); else if (sprite[s->owner].picnum == MINION && sprite[s->owner].pal == 19) { - t->picnum = RRTILE5090 + ((gameclock >> 4) & 3); + t->picnum = RRTILE5090 + ((ud.levelclock >> 4) & 3); t->shade = -127; } else if (sprite[s->owner].picnum == MAMA) @@ -288,10 +288,10 @@ void animatesprites_r(int x,int y,int a,int smoothratio) t->picnum = RRTILE7274 + k; } else - t->picnum = SPIT + ((gameclock >> 4) & 3); + t->picnum = SPIT + ((ud.levelclock >> 4) & 3); } else - t->picnum = SPIT + ((gameclock >> 4) & 3); + t->picnum = SPIT + ((ud.levelclock >> 4) & 3); break; case EMPTYBIKE: if (!isRRRA()) goto default_case; @@ -796,12 +796,12 @@ void animatesprites_r(int x,int y,int a,int smoothratio) if(t->picnum == EXPLOSION2) { ps[screenpeek].visibility = -127; - lastvisinc = gameclock+32; + lastvisinc = ud.levelclock+32; t->pal = 0; } else if(t->picnum == FIRELASER) { - t->picnum = FIRELASER+((gameclock>>2)&5); + t->picnum = FIRELASER+((ud.levelclock>>2)&5); } t->shade = -127; break; @@ -897,11 +897,11 @@ void animatesprites_r(int x,int y,int a,int smoothratio) t->shade = -127; break; case RRTILE2034: - t->picnum = RRTILE2034+(gameclock&1); + t->picnum = RRTILE2034 + ((ud.levelclock>>2)&1); break; case RRTILE2944: t->shade = -127; - t->picnum = RRTILE2944+((gameclock>>2)&4); + t->picnum = RRTILE2944+((ud.levelclock>>2)&4); break; case PLAYERONWATER: diff --git a/source/games/duke/src/game_misc.cpp b/source/games/duke/src/game_misc.cpp index 73ea669b1..9534dc89e 100644 --- a/source/games/duke/src/game_misc.cpp +++ b/source/games/duke/src/game_misc.cpp @@ -130,7 +130,7 @@ void FTA(int q, struct player_struct* p) if (q < 0 || !(p->gm & MODE_GAME)) return; - if (p->ftq != q || (gameclock - p->ftt > TICRATE && q != QUOTE_DEAD)) + if (p->ftq != q || (ud.levelclock - p->ftt > TICRATE && q != QUOTE_DEAD)) { p->ftq = q; auto qu = quoteMgr.GetQuote(q); @@ -148,7 +148,7 @@ void FTA(int q, struct player_struct* p) } } } - p->ftt = gameclock; + p->ftt = ud.levelclock; } //========================================================================== diff --git a/source/games/duke/src/gameexec.cpp b/source/games/duke/src/gameexec.cpp index c10701986..8ec612cfa 100644 --- a/source/games/duke/src/gameexec.cpp +++ b/source/games/duke/src/gameexec.cpp @@ -1040,9 +1040,6 @@ int ParseState::parse(void) resetinventory(g_p); resetweapons(g_p); - - //cameradist = 0; - //cameraclock = gameclock; } setpal(&ps[g_p]); break; diff --git a/source/games/duke/src/gameloop.cpp b/source/games/duke/src/gameloop.cpp index 2fccffa6b..922e9b459 100644 --- a/source/games/duke/src/gameloop.cpp +++ b/source/games/duke/src/gameloop.cpp @@ -51,9 +51,6 @@ void GameInterface::Ticker() { sync[i] = playercmds[i].ucmd; } - ud.camerasprite = -1; - - if (earthquaketime > 0) earthquaketime--; if (rtsplaying > 0) rtsplaying--; if (show_shareware > 0) @@ -61,53 +58,56 @@ void GameInterface::Ticker() show_shareware--; } - everyothertime++; updateinterpolations(); if (playrunning()) { + ud.levelclock+= 4; + if (earthquaketime > 0) earthquaketime--; + + ud.camerasprite = -1; + everyothertime++; + global_random = krand(); movedummyplayers();//ST 13 - r_NoInterpolate = false; - } - else r_NoInterpolate = true; - - for (int i = connecthead; i >= 0; i = connectpoint2[i]) - { - if (playrunning()) + + for (int i = connecthead; i >= 0; i = connectpoint2[i]) { - auto p = &ps[i]; - if (p->pals.a > 0) - p->pals.a--; + if (playrunning()) + { + auto p = &ps[i]; + if (p->pals.a > 0) + p->pals.a--; - hud_input(i); - fi.processinput(i); - fi.checksectors(i); + hud_input(i); + fi.processinput(i); + fi.checksectors(i); + } } - } - - if (playrunning()) - { + if (levelTextTime > 0) levelTextTime--; fi.think(); - } - if ((everyothertime & 1) == 0) - { - fi.animatewalls(); - movecyclers(); - } + if ((everyothertime & 1) == 0) + { + fi.animatewalls(); + movecyclers(); + } - if (isRR() && ud.recstat == 0 && ud.multimode < 2) - dotorch(); + if (isRR() && ud.recstat == 0 && ud.multimode < 2) + dotorch(); + + r_NoInterpolate = false; + } + else r_NoInterpolate = true; if (ps[myconnectindex].gm & (MODE_EOL | MODE_RESTART)) { exitlevel(); } - nonsharedkeys(); + nonsharedkeys(); // this must go elsewhere later! } //--------------------------------------------------------------------------- diff --git a/source/games/duke/src/player_d.cpp b/source/games/duke/src/player_d.cpp index cb8e1c9d6..4e96eb1cc 100644 --- a/source/games/duke/src/player_d.cpp +++ b/source/games/duke/src/player_d.cpp @@ -41,7 +41,7 @@ source as it is released. BEGIN_DUKE_NS void fireweapon_ww(int snum); -void operateweapon_ww(int snum, ESyncBits actions, int psect, int ticker); +void operateweapon_ww(int snum, ESyncBits actions, int psect); //--------------------------------------------------------------------------- // @@ -1504,7 +1504,7 @@ int doincrements_d(struct player_struct* p) p->knuckle_incs++; if (p->knuckle_incs == 10 && !isWW2GI()) { - if (gameclock > 1024) + if (ud.levelclock > 1024) if (snum == screenpeek || ud.coop == 1) { if (rand() & 1) @@ -2077,7 +2077,7 @@ static void fireweapon(int snum) // //--------------------------------------------------------------------------- -static void operateweapon(int snum, ESyncBits actions, int psect, int ticker) +static void operateweapon(int snum, ESyncBits actions, int psect) { auto p = &ps[snum]; int pi = p->i; @@ -2181,7 +2181,7 @@ static void operateweapon(int snum, ESyncBits actions, int psect, int ticker) { fi.shoot(pi, SHOTSPARK1); S_PlayActorSound(PISTOL_FIRE, pi); - lastvisinc = ticker + 32; + lastvisinc = ud.levelclock + 32; p->visibility = 0; } @@ -2240,7 +2240,7 @@ static void operateweapon(int snum, ESyncBits actions, int psect, int ticker) S_PlayActorSound(SHOTGUN_FIRE, pi); - lastvisinc = ticker + 32; + lastvisinc = ud.levelclock + 32; p->visibility = 0; } @@ -2293,7 +2293,7 @@ static void operateweapon(int snum, ESyncBits actions, int psect, int ticker) S_PlayActorSound(CHAINGUN_FIRE, pi); fi.shoot(pi, CHAINGUN); - lastvisinc = ticker + 32; + lastvisinc = ud.levelclock + 32; p->visibility = 0; checkavailweapon(p); @@ -2344,7 +2344,7 @@ static void operateweapon(int snum, ESyncBits actions, int psect, int ticker) { // make them visible if not set... p->visibility = 0; - lastvisinc = ticker + 32; + lastvisinc = ud.levelclock + 32; } checkavailweapon(p); //#endif @@ -2358,7 +2358,7 @@ static void operateweapon(int snum, ESyncBits actions, int psect, int ticker) { // make them visible if not set... p->visibility = 0; - lastvisinc = ticker + 32; + lastvisinc = ud.levelclock + 32; } checkavailweapon(p); } @@ -2377,7 +2377,7 @@ static void operateweapon(int snum, ESyncBits actions, int psect, int ticker) { p->visibility = 0; //flashColor = 176 + (252 << 8) + (120 << 16); - lastvisinc = ticker + 32; + lastvisinc = ud.levelclock + 32; checkavailweapon(p); } } @@ -2385,7 +2385,7 @@ static void operateweapon(int snum, ESyncBits actions, int psect, int ticker) { p->okickback_pic = p->kickback_pic = 0; p->visibility = 0; - lastvisinc = gameclock + 32; + lastvisinc = ud.levelclock + 32; checkavailweapon(p); } else p->kickback_pic++; @@ -2403,7 +2403,7 @@ static void operateweapon(int snum, ESyncBits actions, int psect, int ticker) (p->kickback_pic & 1)) { p->visibility = 0; - lastvisinc = ticker + 32; + lastvisinc = ud.levelclock + 32; fi.shoot(pi, RPG); p->ammo_amount[DEVISTATOR_WEAPON]--; checkavailweapon(p); @@ -2413,7 +2413,7 @@ static void operateweapon(int snum, ESyncBits actions, int psect, int ticker) else if (p->kickback_pic & 1) { p->visibility = 0; - lastvisinc = ticker + 32; + lastvisinc = ud.levelclock + 32; fi.shoot(pi, RPG); p->ammo_amount[DEVISTATOR_WEAPON]--; checkavailweapon(p); @@ -2433,7 +2433,7 @@ static void operateweapon(int snum, ESyncBits actions, int psect, int ticker) p->ammo_amount[p->curr_weapon]--; p->visibility = 0; - lastvisinc = ticker + 32; + lastvisinc = ud.levelclock + 32; fi.shoot(pi, FREEZEBLAST); checkavailweapon(p); } @@ -2516,7 +2516,7 @@ static void operateweapon(int snum, ESyncBits actions, int psect, int ticker) if (p->kickback_pic == 4) { p->ammo_amount[RPG_WEAPON]--; - lastvisinc = ticker + 32; + lastvisinc = ud.levelclock + 32; p->visibility = 0; fi.shoot(pi, RPG); checkavailweapon(p); @@ -2625,8 +2625,8 @@ static void processweapon(int snum, ESyncBits actions, int psect) } else if (p->kickback_pic) { - if (!isWW2GI()) operateweapon(snum, actions, psect, gameclock); - else operateweapon_ww(snum, actions, psect, gameclock); + if (!isWW2GI()) operateweapon(snum, actions, psect); + else operateweapon_ww(snum, actions, psect); } } //--------------------------------------------------------------------------- diff --git a/source/games/duke/src/player_r.cpp b/source/games/duke/src/player_r.cpp index 14e33ac5b..892213f4e 100644 --- a/source/games/duke/src/player_r.cpp +++ b/source/games/duke/src/player_r.cpp @@ -1430,7 +1430,7 @@ int doincrements_r(struct player_struct* p) } S_PlayActorSound(snd, p->i); } - else if (gameclock > 1024) + else if (ud.levelclock > 1024) if (snum == screenpeek || ud.coop == 1) { if (rand() & 1) @@ -2771,7 +2771,7 @@ static void fireweapon(int snum) // //--------------------------------------------------------------------------- -static void operateweapon(int snum, ESyncBits actions, int psect, int ticker) +static void operateweapon(int snum, ESyncBits actions, int psect) { auto p = &ps[snum]; int pi = p->i; @@ -2882,7 +2882,7 @@ static void operateweapon(int snum, ESyncBits actions, int psect, int ticker) p->noise_radius = 8192; madenoise(snum); - lastvisinc = ticker + 32; + lastvisinc = ud.levelclock + 32; p->visibility = 0; if (psectlotag != 857) { @@ -2961,7 +2961,7 @@ static void operateweapon(int snum, ESyncBits actions, int psect, int ticker) p->noise_radius = 8192; madenoise(snum); - lastvisinc = ticker + 32; + lastvisinc = ud.levelclock + 32; p->visibility = 0; } @@ -3072,7 +3072,7 @@ static void operateweapon(int snum, ESyncBits actions, int psect, int ticker) fi.shoot(pi, CHAINGUN); p->noise_radius = 8192; madenoise(snum); - lastvisinc = ticker + 32; + lastvisinc = ud.levelclock + 32; p->visibility = 0; if (psectlotag != 857) @@ -3128,7 +3128,7 @@ static void operateweapon(int snum, ESyncBits actions, int psect, int ticker) if (p->kickback_pic == 2 || p->kickback_pic == 4) { p->visibility = 0; - lastvisinc = ticker + 32; + lastvisinc = ud.levelclock + 32; S_PlayActorSound(CHAINGUN_FIRE, pi); fi.shoot(pi, SHOTSPARK1); p->noise_radius = 16384; @@ -3155,7 +3155,7 @@ static void operateweapon(int snum, ESyncBits actions, int psect, int ticker) if (p->kickback_pic == 2 || p->kickback_pic == 4) { p->visibility = 0; - lastvisinc = ticker + 32; + lastvisinc = ud.levelclock + 32; S_PlayActorSound(CHAINGUN_FIRE, pi); fi.shoot(pi, CHAINGUN); p->noise_radius = 16384; @@ -3213,7 +3213,7 @@ static void operateweapon(int snum, ESyncBits actions, int psect, int ticker) { p->ammo_amount[ALIENBLASTER_WEAPON]--; p->visibility = 0; - lastvisinc = ticker + 32; + lastvisinc = ud.levelclock + 32; checkavailweapon(p); } else if (p->kickback_pic == 12) @@ -3322,7 +3322,7 @@ static void operateweapon(int snum, ESyncBits actions, int psect, int ticker) p->ammo_amount[CROSSBOW_WEAPON]--; if (p->ammo_amount[DYNAMITE_WEAPON]) p->ammo_amount[DYNAMITE_WEAPON]--; - lastvisinc = ticker + 32; + lastvisinc = ud.levelclock + 32; p->visibility = 0; fi.shoot(pi, RPG); p->noise_radius = 32768; @@ -3340,7 +3340,7 @@ static void operateweapon(int snum, ESyncBits actions, int psect, int ticker) if (p->kickback_pic == 4) { p->ammo_amount[CHICKEN_WEAPON]--; - lastvisinc = ticker + 32; + lastvisinc = ud.levelclock + 32; p->visibility = 0; fi.shoot(pi, RPG2); p->noise_radius = 32768; @@ -3414,7 +3414,7 @@ static void processweapon(int snum, ESyncBits actions, int psect) } else if (p->kickback_pic) { - operateweapon(snum, actions, psect, gameclock); + operateweapon(snum, actions, psect); } } diff --git a/source/games/duke/src/player_w.cpp b/source/games/duke/src/player_w.cpp index 3740b22f4..07bff843d 100644 --- a/source/games/duke/src/player_w.cpp +++ b/source/games/duke/src/player_w.cpp @@ -77,7 +77,7 @@ void DoFire(struct player_struct *p, short snum) if(! (aplWeaponFlags[p->curr_weapon][snum] & WEAPON_FLAG_NOVISIBLE )) { // make them visible if not set... - lastvisinc = gameclock+32; + lastvisinc = ud.levelclock+32; p->visibility = 0; } @@ -306,7 +306,7 @@ void fireweapon_ww(int snum) // //--------------------------------------------------------------------------- -void operateweapon_ww(int snum, ESyncBits actions, int psect, int ticker) +void operateweapon_ww(int snum, ESyncBits actions, int psect) { auto p = &ps[snum]; int pi = p->i; @@ -400,7 +400,7 @@ void operateweapon_ww(int snum, ESyncBits actions, int psect, int ticker) if (!(aplWeaponFlags[p->curr_weapon][snum] & WEAPON_FLAG_NOVISIBLE)) { // make them visible if not set... - lastvisinc = ticker + 32; + lastvisinc = ud.levelclock + 32; p->visibility = 0; } SetGameVarID(g_iWeaponVarID, p->curr_weapon, p->i, snum); diff --git a/source/games/duke/src/premap.cpp b/source/games/duke/src/premap.cpp index 53a3d1ad3..0eb1f2598 100644 --- a/source/games/duke/src/premap.cpp +++ b/source/games/duke/src/premap.cpp @@ -757,6 +757,7 @@ void prelevel_common(int g) void resettimevars(void) { resetGameClock(); + ud.levelclock = 0; levelTextTime = 85; ready2send = 1; if (camsprite >= 0) @@ -1160,4 +1161,4 @@ void exitlevel(void) } -END_DUKE_NS \ No newline at end of file +END_DUKE_NS diff --git a/source/games/duke/src/render.cpp b/source/games/duke/src/render.cpp index 6e99a2249..8e91d79df 100644 --- a/source/games/duke/src/render.cpp +++ b/source/games/duke/src/render.cpp @@ -642,7 +642,7 @@ void displayrooms(int snum, double smoothratio) if (!isRRRA() || !fogactive) { - if (gameclock < lastvisinc) + if (ud.levelclock < lastvisinc) { if (abs(p->visibility - ud.const_visibility) > 8) p->visibility += (ud.const_visibility - p->visibility) >> 2; diff --git a/source/games/duke/src/savegame.cpp b/source/games/duke/src/savegame.cpp index 22f565ea5..f28565bfe 100644 --- a/source/games/duke/src/savegame.cpp +++ b/source/games/duke/src/savegame.cpp @@ -404,6 +404,7 @@ void GameInterface::SerializeGameState(FSerializer& arc) ("coop", ud.coop) ("marker", ud.marker) ("ffire", ud.ffire) + ("levelclock", ud.levelclock) .Array("sectorextra", sectorextra, numsectors) ("rtsplaying", rtsplaying) @@ -477,10 +478,6 @@ void GameInterface::SerializeGameState(FSerializer& arc) ("RRRA_ExitedLevel", RRRA_ExitedLevel) ("fogactive", fogactive) ("thunder_brightness", thunder_brightness) - - // Todo: move to backend - ("gameclock", gameclock) - .Array("po", po, ud.multimode) .EndObject(); diff --git a/source/games/duke/src/sbar_d.cpp b/source/games/duke/src/sbar_d.cpp index 57ad79456..f644cab14 100644 --- a/source/games/duke/src/sbar_d.cpp +++ b/source/games/duke/src/sbar_d.cpp @@ -129,11 +129,11 @@ public: imgScale = baseScale / img->GetDisplayHeight(); DrawGraphic(img, 2, -1.5, DI_ITEM_LEFT_BOTTOM, 1., -1, -1, imgScale, imgScale); - if (!althud_flashing || p->last_extra > (max_player_health >> 2) || (gameclock & 32) || (sprite[p->i].pal == 1 && p->last_extra < 2)) + if (!althud_flashing || p->last_extra > (max_player_health >> 2) || (ud.levelclock & 32) || (sprite[p->i].pal == 1 && p->last_extra < 2)) { int s = -8; if (althud_flashing && p->last_extra > max_player_health) - s += (sintable[(gameclock << 6) & 2047] >> 10); + s += (sintable[(ud.levelclock << 6) & 2047] >> 10); int intens = clamp(255 - 6 * s, 0, 255); format.Format("%d", p->last_extra); SBar_DrawString(this, &numberFont, format, 25, texty, DI_TEXT_ALIGN_LEFT, CR_UNTRANSLATED, intens / 255., 0, 0, 1, 1); @@ -178,7 +178,7 @@ public: imgX += (imgX * 0.6) * (strlen - 1); } - if (weapon != KNEE_WEAPON && (!althud_flashing || gameclock & 32 || ammo > (max_ammo_amount[weapon] / 10))) + if (weapon != KNEE_WEAPON && (!althud_flashing || ud.levelclock & 32 || ammo > (max_ammo_amount[weapon] / 10))) { SBar_DrawString(this, &numberFont, format, -3, texty, DI_TEXT_ALIGN_RIGHT, CR_UNTRANSLATED, 1, 0, 0, 1, 1); } diff --git a/source/games/duke/src/sbar_r.cpp b/source/games/duke/src/sbar_r.cpp index 0038cb8b7..5f590a41e 100644 --- a/source/games/duke/src/sbar_r.cpp +++ b/source/games/duke/src/sbar_r.cpp @@ -106,13 +106,11 @@ public: imgScale = baseScale / img->GetDisplayHeight(); DrawGraphic(img, 2, -2, DI_ITEM_LEFT_BOTTOM, 1, 0, 0, imgScale, imgScale); - int gameclock = I_GetBuildTime(); - - if (!althud_flashing || p->last_extra > (max_player_health >> 2) || (gameclock & 32) || (sprite[p->i].pal == 1 && p->last_extra < 2)) + if (!althud_flashing || p->last_extra > (max_player_health >> 2) || (ud.levelclock & 32) || (sprite[p->i].pal == 1 && p->last_extra < 2)) { int s = -8; if (althud_flashing && p->last_extra > max_player_health) - s += (sintable[(gameclock << 6) & 2047] >> 10); + s += (sintable[(ud.levelclock << 6) & 2047] >> 10); int intens = clamp(255 - 6 * s, 0, 255); format.Format("%d", p->last_extra); SBar_DrawString(this, &numberFont, format, 26.5, -numberFont.mFont->GetHeight() * scale + 4, DI_TEXT_ALIGN_LEFT, CR_UNTRANSLATED, intens / 255., 0, 0, scale, scale); @@ -175,7 +173,7 @@ public: imgX += (imgX * 0.755) * (strlen - 1); } - if (weapon != KNEE_WEAPON && weapon != SLINGBLADE_WEAPON && (!althud_flashing || gameclock & 32 || ammo > (max_ammo_amount[weapon] / 10))) + if (weapon != KNEE_WEAPON && weapon != SLINGBLADE_WEAPON && (!althud_flashing || ud.levelclock & 32 || ammo > (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); } diff --git a/source/games/duke/src/types.h b/source/games/duke/src/types.h index 685b7bcf0..6ec0e4e48 100644 --- a/source/games/duke/src/types.h +++ b/source/games/duke/src/types.h @@ -51,6 +51,7 @@ struct TileInfo struct user_defs { + int levelclock; unsigned char god, cashman, eog; unsigned char show_help, scrollmode, clipping; char user_name[MAXPLAYERS][32];