diff --git a/source/exhumed/src/2d.cpp b/source/exhumed/src/2d.cpp index 1a70ca0e0..40f490918 100644 --- a/source/exhumed/src/2d.cpp +++ b/source/exhumed/src/2d.cpp @@ -139,7 +139,7 @@ void DrawAbs(int tile, double x, double y, int shade = 0) DrawTexture(twod, tileGetTexture(tile), x, y, DTA_FullscreenScale, FSMode_ScaleToFit43, DTA_VirtualWidth, 320, DTA_VirtualHeight, 200, DTA_TopLeft, true, DTA_Color, shadeToLight(shade), TAG_DONE); } -void DrawRel(int tile, double x, double y, int shade = 0) +void DrawRel(int tile, double x, double y, int shade) { // This is slightly different than what the backend does here, but critical for some graphics. int offx = (tileWidth(tile) >> 1) + tileLeftOffset(tile); diff --git a/source/exhumed/src/d_menu.cpp b/source/exhumed/src/d_menu.cpp index d79111d7d..8ea967bd1 100644 --- a/source/exhumed/src/d_menu.cpp +++ b/source/exhumed/src/d_menu.cpp @@ -36,8 +36,6 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. BEGIN_PS_NS -void DrawRel(int tile, double x, double y, int shade = 0); - int handle1; diff --git a/source/exhumed/src/engine.h b/source/exhumed/src/engine.h index 48506cb4d..52d97f7e1 100644 --- a/source/exhumed/src/engine.h +++ b/source/exhumed/src/engine.h @@ -92,7 +92,6 @@ void LoadObjects(); // light int LoadPaletteLookups(); -void WaitVBL(); void SetGreenPal(); void RestoreGreenPal(); void FixPalette(); diff --git a/source/exhumed/src/exhumed.cpp b/source/exhumed/src/exhumed.cpp index 8db45bf81..c0d63d54b 100644 --- a/source/exhumed/src/exhumed.cpp +++ b/source/exhumed/src/exhumed.cpp @@ -599,8 +599,6 @@ static const char* actions[] = "Alt_Weapon", "Third_Person_View", "Toggle_Crouch", // This is the last one used by EDuke32. - "Zoom_In", // Map controls should not pollute the global button namespace. - "Zoom_Out", }; @@ -642,21 +640,6 @@ void InitGame() nTotalPlayers += nNetPlayerCount; } - // loc_116A5: - -#if 0 - if (nNetPlayerCount) - { - InitInput(); - forcelevel = nStartLevel; - nNetTime = 1800 * nTimeLimit; - - if (nNetTime == 0) { - nNetTime = -1; - } - } -#endif - // temp - moving InstallEngine(); before FadeOut as we use nextpage() in FadeOut InstallEngine(); diff --git a/source/exhumed/src/exhumed.h b/source/exhumed/src/exhumed.h index b7791e338..01de74186 100644 --- a/source/exhumed/src/exhumed.h +++ b/source/exhumed/src/exhumed.h @@ -89,8 +89,6 @@ enum GameFunction_t gamefunc_Alt_Weapon, gamefunc_Third_Person_View, gamefunc_Toggle_Crouch, // This is the last one used by EDuke32. - gamefunc_Zoom_In, // Map controls should not pollute the global button namespace. - gamefunc_Zoom_Out, NUM_ACTIONS, }; @@ -271,6 +269,7 @@ extern char g_modDir[BMAX_PATH]; void G_LoadGroupsInDir(const char* dirname); void G_DoAutoload(const char* dirname); +void DrawRel(int tile, double x, double y, int shade = 0); // savegame. diff --git a/source/exhumed/src/gameloop.cpp b/source/exhumed/src/gameloop.cpp index 09451f46c..400d3c343 100644 --- a/source/exhumed/src/gameloop.cpp +++ b/source/exhumed/src/gameloop.cpp @@ -73,66 +73,8 @@ int32_t calc_smoothratio(ClockTicks totalclk, ClockTicks ototalclk); int SyncScreenJob(); void DoTitle(CompletionFunc completion); void ResetEngine(); - - -void CheckKeys() -{ - if (buttonMap.ButtonDown(gamefunc_Enlarge_Screen)) - { - buttonMap.ClearButton(gamefunc_Enlarge_Screen); - if (!nMapMode) - { - if (!SHIFTS_IS_PRESSED) - { - G_ChangeHudLayout(1); - } - else - { - hud_scale = hud_scale + 4; - } - } - } - - if (buttonMap.ButtonDown(gamefunc_Shrink_Screen)) - { - buttonMap.ClearButton(gamefunc_Shrink_Screen); - if (!nMapMode) - { - if (!SHIFTS_IS_PRESSED) - { - G_ChangeHudLayout(-1); - } - else - { - hud_scale = hud_scale - 4; - } - } - } - - // go to 3rd person view? - if (buttonMap.ButtonDown(gamefunc_Third_Person_View)) - { - if (!nFreeze) - { - if (bCamera) { - bCamera = false; - } - else { - bCamera = true; - } - - if (bCamera) - GrabPalette(); - } - buttonMap.ClearButton(gamefunc_Third_Person_View); - return; - } - - if (paused) - { - return; - } -} +void CheckKeys(); +void CheckKeys2(); void FinishLevel() { @@ -153,7 +95,6 @@ void FinishLevel() PlayLocalSound(StaticSound[59], 0, true, CHANF_UI); videoNextPage(); //WaitTicks(12); - WaitVBL(); DrawView(65536); videoNextPage(); } @@ -357,13 +298,6 @@ STARTGAME2: } InitPlayerInventory(nPlayer); - - if (i == 0) { - PlayerList[nPlayer].someNetVal = -3; - } - else { - PlayerList[nPlayer].someNetVal = -4; - } } nNetMoves = 0; @@ -588,50 +522,7 @@ GAMELOOP: bInMove = false; RefreshStatus(); } - else if (buttonMap.ButtonDown(gamefunc_Map)) // e.g. TAB (to show 2D map) - { - buttonMap.ClearButton(gamefunc_Map); - - if (!nFreeze) { - nMapMode = (nMapMode+1)%3; - } - } - - if (nMapMode != 0) - { - int const timerOffset = ((int) totalclock - nonsharedtimer); - nonsharedtimer += timerOffset; - - if (buttonMap.ButtonDown(gamefunc_Zoom_In)) - lMapZoom += mulscale6(timerOffset, max(lMapZoom, 256)); - - if (buttonMap.ButtonDown(gamefunc_Zoom_Out)) - lMapZoom -= mulscale6(timerOffset, max(lMapZoom, 256)); - - lMapZoom = clamp(lMapZoom, 48, 2048); - } - - if (PlayerList[nLocalPlayer].nHealth > 0) - { - if (buttonMap.ButtonDown(gamefunc_Inventory_Left)) - { - SetPrevItem(nLocalPlayer); - buttonMap.ClearButton(gamefunc_Inventory_Left); - } - if (buttonMap.ButtonDown(gamefunc_Inventory_Right)) - { - SetNextItem(nLocalPlayer); - buttonMap.ClearButton(gamefunc_Inventory_Right); - } - if (buttonMap.ButtonDown(gamefunc_Inventory)) - { - UseCurItem(nLocalPlayer); - buttonMap.ClearButton(gamefunc_Inventory); - } - } - else { - SetAirFrame(); - } + CheckKeys2(); } else { diff --git a/source/exhumed/src/input.cpp b/source/exhumed/src/input.cpp index e12167da4..be241025b 100644 --- a/source/exhumed/src/input.cpp +++ b/source/exhumed/src/input.cpp @@ -20,6 +20,9 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. #include "engine.h" #include "exhumed.h" #include "player.h" +#include "aistuff.h" +#include "status.h" +#include "view.h" #include BEGIN_PS_NS @@ -106,28 +109,6 @@ void SendInput() } -void LogoffPlayer(int nPlayer) -{ - if (nPlayer == nLocalPlayer) - return; - - if (PlayerList[nPlayer].someNetVal == -1) - return; - - memset(&sPlayerInput[nPlayer], 0, sizeof(sPlayerInput)); - - sprite[nDoppleSprite[nPlayer]].cstat = 0x8000u; - sprite[nPlayerFloorSprite[nPlayer]].cstat = 0x8000u; - sprite[PlayerList[nPlayer].nSprite].cstat = 0x8000u; - - PlayerList[nPlayer].someNetVal = -1; - - StatusMessage(150, "Player %d has left the game", nPlayer); - -// TODO ClearPlayerInput(&sPlayerInput[nPlayer]); - nNetPlayerCount--; -} - short nNetMoveFrames = 0; void UpdateInputs() @@ -146,4 +127,110 @@ void UpdateInputs() } } +void CheckKeys() +{ + if (!nMapMode) + { + if (buttonMap.ButtonDown(gamefunc_Enlarge_Screen)) + { + buttonMap.ClearButton(gamefunc_Enlarge_Screen); + if (!SHIFTS_IS_PRESSED) + { + G_ChangeHudLayout(1); + } + else + { + hud_scale = hud_scale + 4; + } + } + + if (buttonMap.ButtonDown(gamefunc_Shrink_Screen)) + { + buttonMap.ClearButton(gamefunc_Shrink_Screen); + if (!SHIFTS_IS_PRESSED) + { + G_ChangeHudLayout(-1); + } + else + { + hud_scale = hud_scale - 4; + } + } + } + + // go to 3rd person view? + if (buttonMap.ButtonDown(gamefunc_Third_Person_View)) + { + if (!nFreeze) + { + if (bCamera) { + bCamera = false; + } + else { + bCamera = true; + } + + if (bCamera) + GrabPalette(); + } + buttonMap.ClearButton(gamefunc_Third_Person_View); + return; + } + + if (paused) + { + return; + } +} + +static int32_t nonsharedtimer; + +void CheckKeys2() +{ + if (buttonMap.ButtonDown(gamefunc_Map)) // e.g. TAB (to show 2D map) + { + buttonMap.ClearButton(gamefunc_Map); + + if (!nFreeze) { + nMapMode = (nMapMode + 1) % 3; + } + } + + if (nMapMode != 0) + { + int const timerOffset = ((int)totalclock - nonsharedtimer); + nonsharedtimer += timerOffset; + + if (buttonMap.ButtonDown(gamefunc_Enlarge_Screen)) + lMapZoom += mulscale6(timerOffset, max(lMapZoom, 256)); + + if (buttonMap.ButtonDown(gamefunc_Shrink_Screen)) + lMapZoom -= mulscale6(timerOffset, max(lMapZoom, 256)); + + lMapZoom = clamp(lMapZoom, 48, 2048); + } + + if (PlayerList[nLocalPlayer].nHealth > 0) + { + if (buttonMap.ButtonDown(gamefunc_Inventory_Left)) + { + SetPrevItem(nLocalPlayer); + buttonMap.ClearButton(gamefunc_Inventory_Left); + } + if (buttonMap.ButtonDown(gamefunc_Inventory_Right)) + { + SetNextItem(nLocalPlayer); + buttonMap.ClearButton(gamefunc_Inventory_Right); + } + if (buttonMap.ButtonDown(gamefunc_Inventory)) + { + UseCurItem(nLocalPlayer); + buttonMap.ClearButton(gamefunc_Inventory); + } + } + else { + SetAirFrame(); + } +} + END_PS_NS diff --git a/source/exhumed/src/light.cpp b/source/exhumed/src/light.cpp index 3a57ca207..f6923d640 100644 --- a/source/exhumed/src/light.cpp +++ b/source/exhumed/src/light.cpp @@ -135,14 +135,6 @@ uint8_t RemapPLU(uint8_t pal) return pal; } -void WaitVBL() -{ -#ifdef __WATCOMC__ - while (!(inp(0x3da) & 8)); -#endif -} - - void GrabPalette() { nPalDiff = 0; diff --git a/source/exhumed/src/player.cpp b/source/exhumed/src/player.cpp index 7d12c791e..b6345157d 100644 --- a/source/exhumed/src/player.cpp +++ b/source/exhumed/src/player.cpp @@ -928,9 +928,6 @@ void FuncPlayer(int a, int nDamage, int nRun) short nPlayer = RunData[nRun].nVal; assert(nPlayer >= 0 && nPlayer < kMaxPlayers); - if (PlayerList[nPlayer].someNetVal == -1) - return; - short nPlayerSprite = PlayerList[nPlayer].nSprite; short nDopple = nDoppleSprite[nPlayer]; diff --git a/source/exhumed/src/player.h b/source/exhumed/src/player.h index 4f333fcb3..39c837b4d 100644 --- a/source/exhumed/src/player.h +++ b/source/exhumed/src/player.h @@ -53,7 +53,6 @@ struct Player short nAction; short nSprite; short bIsMummified; - short someNetVal; short invincibility; short nAir; short nSeq;