diff --git a/source/sw/src/draw.cpp b/source/sw/src/draw.cpp index 4c5a19115..153f7022a 100644 --- a/source/sw/src/draw.cpp +++ b/source/sw/src/draw.cpp @@ -939,24 +939,36 @@ post_analyzesprites(void) } #endif -static int mapzoomclock; +static int nonsharedtimer; void ResizeView(PLAYERp pp) { - if (M_Active() || paused) + int ms = screen->FrameTime; + int interval; + if (nonsharedtimer > 0 || ms < nonsharedtimer) + { + interval = ms - nonsharedtimer; + } + else + { + interval = 0; + } + nonsharedtimer = screen->FrameTime; + + if (System_WantGuiCapture()) return; if (automapMode != am_off) { - int32_t timepassed = gameclock - mapzoomclock; - mapzoomclock += timepassed; - if (buttonMap.ButtonDown(gamefunc_Shrink_Screen)) - zoom = max(zoom - mulscale7(timepassed * synctics, zoom), 48); + double j = interval * (120. / 1000); if (buttonMap.ButtonDown(gamefunc_Enlarge_Screen)) - zoom = min(zoom + mulscale7(timepassed * synctics, zoom), 4096); + zoom += (int)fmulscale6(j, max(zoom, 256)); + if (buttonMap.ButtonDown(gamefunc_Shrink_Screen)) + zoom -= (int)fmulscale6(j, max(zoom, 256)); + zoom = clamp(zoom, 48, 2048); } } @@ -1859,11 +1871,11 @@ drawscreen(PLAYERp pp, double smoothratio) { // only clear the actual window. twod->AddColorOnlyQuad(windowxy1.x, windowxy1.y, (windowxy2.x + 1) - windowxy1.x, (windowxy2.y + 1) - windowxy1.y, 0xff000000); - renderDrawMapView(tx, ty, zoom, FixedToInt(tq16ang)); + renderDrawMapView(tx, ty, zoom*2, FixedToInt(tq16ang)); } // Draw the line map on top of texture 2d map or just stand alone - drawoverheadmap(tx, ty, zoom, FixedToInt(tq16ang)); + drawoverheadmap(tx, ty, zoom*2, FixedToInt(tq16ang)); } for (j = 0; j < MAXSPRITES; j++) @@ -1888,7 +1900,7 @@ drawscreen(PLAYERp pp, double smoothratio) SyncStatMessage(); #endif - UpdateStatusBar(gameclock); + UpdateStatusBar(); DrawCrosshair(pp); DoPlayerDiveMeter(pp); // Do the underwater breathing bar diff --git a/source/sw/src/game.cpp b/source/sw/src/game.cpp index 85ef4dc9e..b8b75923b 100644 --- a/source/sw/src/game.cpp +++ b/source/sw/src/game.cpp @@ -291,7 +291,7 @@ void InitLevelGlobals(void) { ChopTics = 0; automapMode = am_off; - zoom = 768; + zoom = 768 / 2; PlayerGravity = 24; wait_active_check_offset = 0; PlaxCeilGlobZadjust = PlaxFloorGlobZadjust = Z(500); @@ -725,11 +725,9 @@ void GameTicker(void) ready2send = 1; int const currentTic = I_GetTime(); - updateGameClock(); if (paused) { - buttonMap.ResetButtonStates(); smoothratio = MaxSmoothRatio; } else @@ -740,7 +738,6 @@ void GameTicker(void) while (ready2send && currentTic - lastTic >= 1) { lastTic = currentTic; - ogameclock = gameclock; UpdateInputs(); MoveTicker(); } diff --git a/source/sw/src/game.h b/source/sw/src/game.h index f16341ada..9ce23f9e3 100644 --- a/source/sw/src/game.h +++ b/source/sw/src/game.h @@ -2053,7 +2053,6 @@ extern USER puser[MAX_SW_PLAYERS_REG]; /////////////////////////// extern int gotlastpacketclock; -extern int ogameclock; extern SWBOOL ready2send; extern double smoothratio; @@ -2181,7 +2180,7 @@ void AudioUpdate(void); // stupid extern short LastSaveNum; void LoadSaveMsg(const char *msg); -void UpdateStatusBar(int arg); +void UpdateStatusBar(); void InitFonts(); int32_t registerosdcommands(void); void SW_InitMultiPsky(void); diff --git a/source/sw/src/jsector.cpp b/source/sw/src/jsector.cpp index dac537361..9920acb08 100644 --- a/source/sw/src/jsector.cpp +++ b/source/sw/src/jsector.cpp @@ -300,7 +300,7 @@ void JS_InitMirrors(void) // Scan wall tags for mirrors mirrorcnt = 0; tileDelete(MIRROR); - oscilationclock = ogameclock; + oscilationclock = I_GetBuildTime(); for (i = 0; i < MAXMIRRORS; i++) { @@ -517,6 +517,7 @@ JS_ProcessEchoSpot() #define MAXCAMDIST 8000 int camloopcnt = 0; // Timer to cycle through player +int lastcamclock; // views short camplayerview = 1; // Don't show yourself! @@ -531,8 +532,9 @@ void JS_DrawCameras(PLAYERp pp, int tx, int ty, int tz) int* longptr; SWBOOL bIsWallMirror = FALSE; + int camclock = I_GetBuildTime(); - camloopcnt += gameclock - ogameclock; + camloopcnt += camclock - lastcamclock; if (camloopcnt > (60 * 5)) // 5 seconds per player view { camloopcnt = 0; @@ -540,12 +542,13 @@ void JS_DrawCameras(PLAYERp pp, int tx, int ty, int tz) if (camplayerview >= numplayers) camplayerview = 1; } + lastcamclock = camclock; // WARNING! Assuming (MIRRORLABEL&31) = 0 and MAXMIRRORS = 64 <-- JBF: wrong longptr = (int*)&gotpic[MIRRORLABEL >> 3]; if (longptr && (longptr[0] || longptr[1])) { - uint32_t oscilation_delta = ogameclock - oscilationclock; + uint32_t oscilation_delta = camclock - oscilationclock; oscilation_delta -= oscilation_delta % 4; oscilationclock += oscilation_delta; oscilation_delta *= 2; diff --git a/source/sw/src/map2d.cpp b/source/sw/src/map2d.cpp index c9bd386df..db1e2774d 100644 --- a/source/sw/src/map2d.cpp +++ b/source/sw/src/map2d.cpp @@ -139,7 +139,7 @@ void drawoverheadmap(int cposx, int cposy, int czoom, short cang) if (Player[p].PlayerSprite == j) { if (sprite[Player[p].PlayerSprite].xvel > 16) - pspr_ndx[myconnectindex] = ((gameclock >> 4)&3); + pspr_ndx[myconnectindex] = ((PlayClock >> 4)&3); sprisplayer = TRUE; goto SHOWSPRITE; diff --git a/source/sw/src/network.cpp b/source/sw/src/network.cpp index 303fc80d1..b625fbb59 100644 --- a/source/sw/src/network.cpp +++ b/source/sw/src/network.cpp @@ -67,7 +67,6 @@ int movefifoplc, movefifosendplc; //, movefifoend[MAX_SW_PLAYERS]; int bufferjitter = 1; -int ogameclock; double smoothratio; // must start out as 0 diff --git a/source/sw/src/panel.cpp b/source/sw/src/panel.cpp index d268cb8f2..9c9fd0021 100644 --- a/source/sw/src/panel.cpp +++ b/source/sw/src/panel.cpp @@ -971,7 +971,7 @@ InitWeaponSword(PLAYERp pp) PlaySound(DIGI_SWORD_UP, pp, v3df_follow|v3df_dontpan); - if (pp == Player+myconnectindex && gameclock > 0) + if (pp == Player+myconnectindex && PlayClock > 0) { rnd_num = STD_RANDOM_RANGE(1024); if (rnd_num > 900) diff --git a/source/sw/src/save.cpp b/source/sw/src/save.cpp index 067ec1205..757021e2a 100644 --- a/source/sw/src/save.cpp +++ b/source/sw/src/save.cpp @@ -562,8 +562,6 @@ bool GameInterface::SaveGame(FSaveGameNode *sv) #endif #endif - MWRITE(&gameclock,sizeof(gameclock),1,fil); - MWRITE(&NormalVisibility,sizeof(NormalVisibility),1,fil); MWRITE(&MoveSkip2,sizeof(MoveSkip2),1,fil); MWRITE(&MoveSkip4,sizeof(MoveSkip4),1,fil); @@ -936,8 +934,6 @@ bool GameInterface::LoadGame(FSaveGameNode* sv) #endif #endif - MREAD(&gameclock,sizeof(gameclock),1,fil); - MREAD(&NormalVisibility,sizeof(NormalVisibility),1,fil); MREAD(&MoveSkip2,sizeof(MoveSkip2),1,fil); diff --git a/source/sw/src/sbar.cpp b/source/sw/src/sbar.cpp index 5534a7617..c1f89bf31 100644 --- a/source/sw/src/sbar.cpp +++ b/source/sw/src/sbar.cpp @@ -792,11 +792,11 @@ private: imgScale = baseScale / img->GetDisplayHeight(); DrawGraphic(img, 1.5, -1, DI_ITEM_LEFT_BOTTOM, 1., -1, -1, imgScale, imgScale); - if (!althud_flashing || u->Health > (u->MaxHealth >> 2) || (gameclock & 32)) + if (!althud_flashing || u->Health > (u->MaxHealth >> 2) || (PlayClock & 32)) { int s = -8; if (althud_flashing && u->Health > u->MaxHealth) - s += (sintable[(gameclock << 5) & 2047] >> 10); + s += (sintable[(PlayClock << 5) & 2047] >> 10); int intens = clamp(255 - 4 * s, 0, 255); auto pe = PalEntry(255, intens, intens, intens); format.Format("%d", u->Health); @@ -854,7 +854,7 @@ private: imgX += (imgX * 0.855) * (strlen - 1); } - if ((!althud_flashing || gameclock & 32 || ammo > (DamageData[weapon].max_ammo / 10))) + if ((!althud_flashing || PlayClock & 32 || ammo > (DamageData[weapon].max_ammo / 10))) { SBar_DrawString(this, &numberFont, format, -1.5, -numberFont.mFont->GetHeight(), DI_TEXT_ALIGN_RIGHT, CR_UNTRANSLATED, 1, 0, 0, 1, 1); } @@ -982,7 +982,7 @@ private: // //--------------------------------------------------------------------------- public: - void UpdateStatusBar(int arg) + void UpdateStatusBar() { int nPalette = 0; double inv_x, inv_y; @@ -1049,7 +1049,7 @@ static void UpdateFrame(void) // //--------------------------------------------------------------------------- -void UpdateStatusBar(int arg) +void UpdateStatusBar() { DSWStatusBar sbar; @@ -1058,7 +1058,7 @@ void UpdateStatusBar(int arg) UpdateFrame(); } - sbar.UpdateStatusBar(arg); + sbar.UpdateStatusBar(); PLAYERp pp = &Player[screenpeek]; if (pp->cookieTime > 0) { diff --git a/source/sw/src/sounds.cpp b/source/sw/src/sounds.cpp index 503d4b5c8..072d921e7 100644 --- a/source/sw/src/sounds.cpp +++ b/source/sw/src/sounds.cpp @@ -304,7 +304,7 @@ static void RestartAmbient(AmbientSound* amb) int pitch = 0; if (vp.pitch_hi <= vp.pitch_lo) pitch = vp.pitch_lo; else pitch = vp.pitch_lo + (STD_RANDOM_RANGE(vp.pitch_hi - vp.pitch_lo)); - amb->curIndex = gameclock; + amb->curIndex = PlayClock; if (!soundEngine->IsSourcePlayingSomething(SOURCE_Ambient, amb, CHAN_BODY, amb->vocIndex)) soundEngine->StartSound(SOURCE_Ambient, amb, nullptr, CHAN_BODY, EChanFlags::FromInt(amb->ChanFlags), amb->vocIndex, 1.f, ATTN_NORM, &rolloff, S_ConvertPitch(pitch)); @@ -343,7 +343,7 @@ static int RandomizeAmbientSpecials(int handle) static void DoTimedSound(AmbientSound* amb) { - if (gameclock >= amb->curIndex + amb->maxIndex) + if (PlayClock >= amb->curIndex + amb->maxIndex) { if (!soundEngine->IsSourcePlayingSomething(SOURCE_Ambient, amb, CHAN_BODY)) { diff --git a/source/sw/src/weapon.cpp b/source/sw/src/weapon.cpp index 832b367b4..939c7a896 100644 --- a/source/sw/src/weapon.cpp +++ b/source/sw/src/weapon.cpp @@ -17797,16 +17797,16 @@ InitUzi(PLAYERp pp) PlayerUpdateAmmo(pp, u->WeaponNum, -1); - if (uziclock > gameclock) + if (uziclock > PlayClock) { - uziclock = gameclock; + uziclock = PlayClock; FireSnd = TRUE; } - clockdiff = gameclock - uziclock; + clockdiff = PlayClock - uziclock; if (clockdiff > UZIFIRE_WAIT) { - uziclock = gameclock; + uziclock = PlayClock; FireSnd = TRUE; }