From e7ee858d0dce802e0c2a5d007c5aaf389bf349ee Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Tue, 7 Jan 2020 18:53:16 +0100 Subject: [PATCH 1/9] - fixed incomplete reset of savegame state. --- source/common/compositesaveame.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/source/common/compositesaveame.h b/source/common/compositesaveame.h index 85ebe6a8d..4b9a542cd 100644 --- a/source/common/compositesaveame.h +++ b/source/common/compositesaveame.h @@ -17,7 +17,10 @@ class CompositeSavegameWriter public: void Clear() { + isCompressed.Clear(); + subfilenames.Clear(); subfiles.DeleteAndClear(); + filename = ""; } void SetFileName(const char* fn) { From 338dcef94c6f7f9e4596b905067c0dd66d78805f Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Tue, 7 Jan 2020 20:06:56 +0100 Subject: [PATCH 2/9] - fix macOS compile error. The conditions for this redefinition do not seem to be correct. --- source/thirdparty/include/enet.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/thirdparty/include/enet.h b/source/thirdparty/include/enet.h index 7cc99c232..8c722ad19 100644 --- a/source/thirdparty/include/enet.h +++ b/source/thirdparty/include/enet.h @@ -4878,7 +4878,7 @@ extern "C" { tv->tv_nsec = t.QuadPart % 1000000 * 1000; return (0); } - #elif __APPLE__ && __MAC_OS_X_VERSION_MIN_REQUIRED < 101200 + #elif __APPLE__ && __MAC_OS_X_VERSION_MIN_REQUIRED < 101200 && !defined CLOCK_MONOTONIC #define CLOCK_MONOTONIC 0 int clock_gettime(int X, struct timespec *ts) { From bb020c15f1eb652806867aafb87a547a0485b6b0 Mon Sep 17 00:00:00 2001 From: NY00123 Date: Mon, 6 Jan 2020 22:07:41 +0200 Subject: [PATCH 3/9] PCExhumed: Further improve the widescreen fix for the smoke in menu_DrawTheMap. rotatesprite is now directly called, instead of going through the overwritesprite wrapper, in order to trim the smoke sprites, so they don't leave the map's boundaries in widescreen. A technical side-effect is that picanm[tilenum].sf is not temporarily set to 0, as done in overwritesprite. The call to videoClearScreen is still required, in case the console is shown and then hidden. It's now called after HandleAsync, just for the sake of it (less useful in case of quit, and maybe also in another scenario). --- source/exhumed/src/menu.cpp | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/source/exhumed/src/menu.cpp b/source/exhumed/src/menu.cpp index ad8b2ee59..56929e5d1 100644 --- a/source/exhumed/src/menu.cpp +++ b/source/exhumed/src/menu.cpp @@ -669,12 +669,23 @@ int menu_DrawTheMap(int nLevel, int nLevelNew, int nLevelBest) int runtimer = (int)totalclock; + // Trim smoke in widescreen + vec2_t mapwinxy1 = windowxy1, mapwinxy2 = windowxy2; + int32_t width = mapwinxy2.x - mapwinxy1.x + 1, height = mapwinxy2.y - mapwinxy1.y + 1; + if (3 * width > 4 * height) + { + mapwinxy1.x += (width - 4 * height / 3) / 2; + mapwinxy2.x -= (width - 4 * height / 3) / 2; + } + // User has 12 seconds to do something on the map screen before loading the current level while (nIdleSeconds < 12) { HandleAsync(); twod->ClearScreen(); + videoClearScreen(overscanindex); // fix hall of mirrors when console renders offscreen in widescreen resolutions. + if (((int)totalclock - startTime) / kTimerTicks) { nIdleSeconds++; @@ -711,7 +722,10 @@ int menu_DrawTheMap(int nLevel, int nLevelNew, int nLevelBest) int smokeX = MapLevelFires[i].fires[j].xPos + FireTiles[nFireType][nFireFrame].xOffs; int smokeY = MapLevelFires[i].fires[j].yPos + FireTiles[nFireType][nFireFrame].yOffs + curYPos + screenY; - overwritesprite(smokeX, smokeY, nTile, 0, 2, kPalNormal); + // Use rotatesprite to trim smoke in widescreen + rotatesprite(smokeX << 16, smokeY << 16, 65536L, 0, + nTile, 0, kPalNormal, 16 + 2, mapwinxy1.x, mapwinxy1.y, mapwinxy2.x, mapwinxy2.y); +// overwritesprite(smokeX, smokeY, nTile, 0, 2, kPalNormal); } } From 86503338ec16507089ab0c68b93d4e9ba9d5622e Mon Sep 17 00:00:00 2001 From: NY00123 Date: Mon, 6 Jan 2020 22:24:40 +0200 Subject: [PATCH 4/9] PCExhumed: Remove unused moveTimer variable from menu_DrawTheMap (minor addition to world map code fixes and tidying from Oct 14). # Conflicts: # source/exhumed/src/menu.cpp --- source/exhumed/src/menu.cpp | 5 ----- 1 file changed, 5 deletions(-) diff --git a/source/exhumed/src/menu.cpp b/source/exhumed/src/menu.cpp index 56929e5d1..f6a9a791d 100644 --- a/source/exhumed/src/menu.cpp +++ b/source/exhumed/src/menu.cpp @@ -692,8 +692,6 @@ int menu_DrawTheMap(int nLevel, int nLevelNew, int nLevelBest) startTime = (int)totalclock; } - int moveTimer = (int)totalclock; - int tileY = curYPos; // Draw the background screens @@ -763,7 +761,6 @@ int menu_DrawTheMap(int nLevel, int nLevelNew, int nLevelBest) { bFadeDone = kTrue; FadeIn(); - moveTimer = (int)totalclock; } if (curYPos == destYPos) @@ -825,8 +822,6 @@ int menu_DrawTheMap(int nLevel, int nLevelNew, int nLevelBest) runtimer = (int)totalclock; } - //curYPos += var_2C * (((int)totalclock - moveTimer) / 2); - if (inputState.CheckAllInput()) { if (var_2C < 8) { From 56abec7ed4139a3fd0023bd3a9b9ce16524cf91e Mon Sep 17 00:00:00 2001 From: sirlemonhead Date: Mon, 6 Jan 2020 21:03:16 +0000 Subject: [PATCH 5/9] PCExhumed: Add god, noclip and changelevel console commands. # Conflicts: # source/exhumed/src/osdcmds.cpp --- source/exhumed/src/exhumed.cpp | 8 ++-- source/exhumed/src/exhumed.h | 1 + source/exhumed/src/osdcmds.cpp | 75 +++++++++++++++++++++++++++++++++- source/exhumed/src/player.cpp | 8 ++-- 4 files changed, 82 insertions(+), 10 deletions(-) diff --git a/source/exhumed/src/exhumed.cpp b/source/exhumed/src/exhumed.cpp index e7ec2f3da..dba0f4acf 100644 --- a/source/exhumed/src/exhumed.cpp +++ b/source/exhumed/src/exhumed.cpp @@ -887,13 +887,13 @@ void DoPassword(int nPassword) case 2: // LOBOCOP { - lLocalCodes |= 0x20; + lLocalCodes |= kButtonCheatGuns; break; } case 3: // LOBODEITY { - lLocalCodes |= 0x40; + lLocalCodes |= kButtonCheatGodMode; break; } @@ -910,7 +910,7 @@ void DoPassword(int nPassword) case 5: { - lLocalCodes |= 0x80; + lLocalCodes |= kButtonCheatKeys; break; } @@ -954,7 +954,7 @@ void DoPassword(int nPassword) case 9: { - lLocalCodes |= 0x100; // LOBOSWAG? + lLocalCodes |= kButtonCheatItems; // LOBOSWAG break; } diff --git a/source/exhumed/src/exhumed.h b/source/exhumed/src/exhumed.h index 94cf28fe0..1196ad70b 100644 --- a/source/exhumed/src/exhumed.h +++ b/source/exhumed/src/exhumed.h @@ -143,6 +143,7 @@ void mysetbrightness(char nBrightness); void StartFadeIn(); int DoFadeIn(); +void DoPassword(int nPassword); void InitSpiritHead(); diff --git a/source/exhumed/src/osdcmds.cpp b/source/exhumed/src/osdcmds.cpp index e53348876..87811d9bb 100644 --- a/source/exhumed/src/osdcmds.cpp +++ b/source/exhumed/src/osdcmds.cpp @@ -30,11 +30,81 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. BEGIN_PS_NS +static int osdcmd_god(osdcmdptr_t UNUSED(parm)) +{ + UNREFERENCED_CONST_PARAMETER(parm); + + if (!nNetPlayerCount && !bInDemo) + { + DoPassword(3); + } + else + OSD_Printf("god: Not in a single-player game.\n"); + + return OSDCMD_OK; +} + +static int osdcmd_noclip(osdcmdptr_t UNUSED(parm)) +{ + UNREFERENCED_CONST_PARAMETER(parm); + + if (!nNetPlayerCount && !bInDemo) + { + DoPassword(6); + } + else + { + OSD_Printf("noclip: Not in a single-player game.\n"); + } + + return OSDCMD_OK; +} + +static int osdcmd_changelevel(osdcmdptr_t parm) +{ + char* p; + + if (parm->numparms != 1) return OSDCMD_SHOWHELP; + + int nLevel = strtol(parm->parms[0], &p, 10); + if (p[0]) return OSDCMD_SHOWHELP; + + if (nLevel < 0) return OSDCMD_SHOWHELP; + + int nMaxLevels; + + if (!ISDEMOVER) { + nMaxLevels = 32; + } + else { + nMaxLevels = 4; + } + + if (nLevel > nMaxLevels) + { + OSD_Printf("changelevel: invalid level number\n"); + return OSDCMD_SHOWHELP; + } + + levelnew = nLevel; + levelnum = nLevel; + + return OSDCMD_OK; +} + +static inline int osdcmd_quit(osdcmdptr_t UNUSED(parm)) +{ + UNREFERENCED_CONST_PARAMETER(parm); + OSD_ShowDisplay(0); + ShutDown(); + return OSDCMD_OK; +} + int32_t registerosdcommands(void) { //if (VOLUMEONE) - // OSD_RegisterFunction("changelevel","changelevel : warps to the given level", osdcmd_changelevel); + OSD_RegisterFunction("changelevel","changelevel : warps to the given level", osdcmd_changelevel); //else //{ // OSD_RegisterFunction("changelevel","changelevel : warps to the given level", osdcmd_changelevel); @@ -47,9 +117,10 @@ int32_t registerosdcommands(void) //OSD_RegisterFunction("give","give : gives requested item", osdcmd_give); - //OSD_RegisterFunction("god","god: toggles god mode", osdcmd_god); + OSD_RegisterFunction("god","god: toggles god mode", osdcmd_god); //OSD_RegisterFunction("activatecheat","activatecheat : activates a cheat code", osdcmd_activatecheat); + OSD_RegisterFunction("noclip","noclip: toggles clipping mode", osdcmd_noclip); //OSD_RegisterFunction("restartmap", "restartmap: restarts the current map", osdcmd_restartmap); //OSD_RegisterFunction("restartsound","restartsound: reinitializes the sound system",osdcmd_restartsound); diff --git a/source/exhumed/src/player.cpp b/source/exhumed/src/player.cpp index 289eed5b2..d1aad85c0 100644 --- a/source/exhumed/src/player.cpp +++ b/source/exhumed/src/player.cpp @@ -1415,7 +1415,7 @@ loc_1AB8E: uint16_t buttons = sPlayerInput[nPlayer].buttons; - if (buttons & 0x40) // LOBODEITY cheat + if (buttons & kButtonCheatGodMode) // LOBODEITY cheat { char strDeity[96]; // TODO - reduce in size? @@ -1437,18 +1437,18 @@ loc_1AB8E: sprintf(strDeity, "Deity mode %s for player", strDMode); StatusMessage(150, strDeity); } - else if (buttons & 0x20) // LOBOCOP cheat + else if (buttons & kButtonCheatGuns) // LOBOCOP cheat { FillWeapons(nPlayer); StatusMessage(150, "All weapons loaded for player"); } - else if (buttons & 0x80) // LOBOPICK cheat + else if (buttons & kButtonCheatKeys) // LOBOPICK cheat { PlayerList[nPlayer].keys = 0xFFFF; StatusMessage(150, "All keys loaded for player"); RefreshStatus(); } - else if (buttons & 0x100) // LOBOSWAG cheat + else if (buttons & kButtonCheatItems) // LOBOSWAG cheat { FillItems(nPlayer); StatusMessage(150, "All items loaded for player"); From dfd6796159976343114f263177bed706d4fa823b Mon Sep 17 00:00:00 2001 From: nukeykt Date: Tue, 7 Jan 2020 18:39:17 +0900 Subject: [PATCH 6/9] Rednukem: fix thunder effect timing --- source/rr/src/sector.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/rr/src/sector.cpp b/source/rr/src/sector.cpp index f445b51a2..1333b1a88 100644 --- a/source/rr/src/sector.cpp +++ b/source/rr/src/sector.cpp @@ -5248,7 +5248,7 @@ void G_Thunder(void) { if (krand2() > 65000) { - g_winderTime = 256; + g_winderTime = 128; g_winderFlash = 1; S_PlaySound(351+(rand()%3)); } From 8cbb313a969b59b05e730c78eaf5b00654342dc1 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Tue, 7 Jan 2020 20:17:08 +0100 Subject: [PATCH 7/9] - clearing the screen here is redundant. --- source/exhumed/src/menu.cpp | 2 -- 1 file changed, 2 deletions(-) diff --git a/source/exhumed/src/menu.cpp b/source/exhumed/src/menu.cpp index f6a9a791d..90bb5874d 100644 --- a/source/exhumed/src/menu.cpp +++ b/source/exhumed/src/menu.cpp @@ -684,8 +684,6 @@ int menu_DrawTheMap(int nLevel, int nLevelNew, int nLevelBest) HandleAsync(); twod->ClearScreen(); - videoClearScreen(overscanindex); // fix hall of mirrors when console renders offscreen in widescreen resolutions. - if (((int)totalclock - startTime) / kTimerTicks) { nIdleSeconds++; From 42f16a7b301650422232bebb7344bec6578fb44f Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Wed, 8 Jan 2020 00:05:37 +0100 Subject: [PATCH 8/9] - removed merged code that doesn't work anymore. --- source/exhumed/src/osdcmds.cpp | 8 -------- 1 file changed, 8 deletions(-) diff --git a/source/exhumed/src/osdcmds.cpp b/source/exhumed/src/osdcmds.cpp index 87811d9bb..2e6598703 100644 --- a/source/exhumed/src/osdcmds.cpp +++ b/source/exhumed/src/osdcmds.cpp @@ -92,14 +92,6 @@ static int osdcmd_changelevel(osdcmdptr_t parm) return OSDCMD_OK; } -static inline int osdcmd_quit(osdcmdptr_t UNUSED(parm)) -{ - UNREFERENCED_CONST_PARAMETER(parm); - OSD_ShowDisplay(0); - ShutDown(); - return OSDCMD_OK; -} - int32_t registerosdcommands(void) { From df7c5a706755c7320ee580e87cc8cf862af7e511 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Wed, 8 Jan 2020 00:06:24 +0100 Subject: [PATCH 9/9] - use proper math instead of crash-prone libdivide here. --- source/build/src/engine.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/source/build/src/engine.cpp b/source/build/src/engine.cpp index 49f34fa72..1fe231be2 100644 --- a/source/build/src/engine.cpp +++ b/source/build/src/engine.cpp @@ -207,7 +207,8 @@ static void getclosestpointonwall_internal(vec2_t const p, int32_t const dawall, return; } - i = tabledivide64((i << 15), j) << 15; + i = ((i << 15) / j) << 15; + //i = tabledivide64((i << 15), j) << 15; *closest = { (int32_t)(w.x + ((d.x * i) >> 30)), (int32_t)(w.y + ((d.y * i) >> 30)) }; }