diff --git a/source/build/include/baselayer.h b/source/build/include/baselayer.h index e45646689..94bf8e9c1 100644 --- a/source/build/include/baselayer.h +++ b/source/build/include/baselayer.h @@ -14,6 +14,7 @@ #include "inputstate.h" #include "printf.h" #include "zstring.h" +#include "vectors.h" #ifdef DEBUGGINGAIDS @@ -211,7 +212,7 @@ struct GameInterface virtual void StartGame(FGameStartup& gs) {} virtual FSavegameInfo GetSaveSig() { return { "", 0, 0}; } virtual bool DrawSpecialScreen(const DVector2 &origin, int tilenum) { return false; } - virtual void DrawCenteredTextScreen(const DVector2 &origin, const char *text, int position); + virtual void DrawCenteredTextScreen(const DVector2& origin, const char* text, int position) {} }; extern GameInterface* gi; diff --git a/source/common/inputstate.h b/source/common/inputstate.h index 834790ff7..12b973ca3 100644 --- a/source/common/inputstate.h +++ b/source/common/inputstate.h @@ -302,6 +302,13 @@ public: int32_t mouseReadAbs(vec2_t* const pResult); void GetMouseDelta(ControlInfo* info); + void ClearAllInput() + { + ClearKeysDown(); + keyFlushChars(); + keyFlushScans(); + } + }; diff --git a/source/common/menu/listmenu.cpp b/source/common/menu/listmenu.cpp index 8ec1259e3..adb928d89 100644 --- a/source/common/menu/listmenu.cpp +++ b/source/common/menu/listmenu.cpp @@ -629,17 +629,17 @@ int FListMenuItemPatch::GetWidth() void ImageScreen::Drawer() { - if (mDesc->mType == 0) + if (mDesc->type == 0) { - auto tileindexp = NameToTileIndex.CheckKey(mDesc->mText); + auto tileindexp = NameToTileIndex.CheckKey(FName(mDesc->text, true)); int tileindex; if (tileindexp == nullptr) { // If this isn't a name, try a literal tile index; - auto c = mDesc->mMenuName.GetChars(); + auto c = mDesc->text.GetChars(); if (*c == '#') tileindex = (int)strtoll(c+1, nullptr, 0); // Error out if the screen cannot be found, this is always a definition error that needs to be reported. - else I_Error("Invalid menu screen '%s'", mDesc->mMenuName.GetChars()); + else I_Error("Invalid menu screen '%s'", mDesc->text.GetChars()); } else tileindex = *tileindexp; if (!gi->DrawSpecialScreen(origin, tileindex)) // allows the front end to do custom handling for a given image. @@ -649,6 +649,6 @@ void ImageScreen::Drawer() } else { - gi->DrawCenteredTextScreen(origin, mDesc->mText, mDesc->type); + gi->DrawCenteredTextScreen(origin, mDesc->text, mDesc->type); } } diff --git a/source/common/menu/menu.cpp b/source/common/menu/menu.cpp index e043450c8..cfa864708 100644 --- a/source/common/menu/menu.cpp +++ b/source/common/menu/menu.cpp @@ -377,6 +377,7 @@ void M_StartControlPanel (bool makeSound) } buttonMap.ResetButtonStates (); + inputState.ClearAllKeyStatus(); for (int i = 0; i < NUM_MKEYS; ++i) { MenuButtons[i].ReleaseKey(0); diff --git a/source/common/music/music.cpp b/source/common/music/music.cpp index 1ff85cda7..2a06e6fe0 100644 --- a/source/common/music/music.cpp +++ b/source/common/music/music.cpp @@ -71,8 +71,6 @@ #include "savegamehelp.h" #include "sjson.h" -CVARD(Bool, mus_restartonload, false, CVAR_ARCHIVE|CVAR_GLOBALCONFIG, "restart the music when loading a saved game with the same map or not") // only implemented for Blood - todo: generalize - MusPlayingInfo mus_playing; MusicAliasMap MusicAliases; MidiDeviceMap MidiDevices; @@ -80,6 +78,8 @@ MusicVolumeMap MusicVolumes; MusicAliasMap LevelMusicAliases; bool MusicPaused; static bool mus_blocked; +static FString lastStartedMusic; + //========================================================================== // // @@ -257,6 +257,7 @@ bool S_StartMusic (const char *m_id) bool S_ChangeMusic(const char* musicname, int order, bool looping, bool force) { + lastStartedMusic = musicname; // remember the last piece of music that was requested to be played. if (musicname == nullptr || musicname[0] == 0) { // Don't choke if the map doesn't have a song attached @@ -269,16 +270,6 @@ bool S_ChangeMusic(const char* musicname, int order, bool looping, bool force) FString DEH_Music; - FName* aliasp = MusicAliases.CheckKey(musicname); - if (aliasp != nullptr) - { - if (*aliasp == NAME_None) - { - return true; // flagged to be ignored - } - musicname = aliasp->GetChars(); - } - if (!mus_playing.name.IsEmpty() && mus_playing.handle != nullptr && stricmp(mus_playing.name, musicname) == 0 && @@ -577,10 +568,11 @@ int Mus_Play(const char *mapname, const char *fn, bool loop) mapname = lastMusicLevel.GetChars(); fn = lastMusic.GetChars(); } + // Allow per level music substitution. - // Unlike some other engines like ZDoom or even Blood which use definition files, the music names in Duke Nukem are being defined in a CON script, making direct replacement a lot harder. // For most cases using $musicalias would be sufficient, but that method only works if a level actually has some music defined at all. - // This way it can be done with an add-on definition lump even in cases like Redneck Rampage where no music definitions exist or where music gets reused for multiple levels but replacement is wanted individually. + // This way it can be done with an add-on definition lump even in cases like Redneck Rampage where no music definitions exist + // or where music gets reused for multiple levels but replacement is wanted individually. if (mapname && *mapname) { if (*mapname == '/') mapname++; @@ -588,6 +580,24 @@ int Mus_Play(const char *mapname, const char *fn, bool loop) if (check) fn = check->GetChars(); } + // Now perform music aliasing. This also needs to be done before checking identities because multiple names can map to the same song. + FName* aliasp = MusicAliases.CheckKey(fn); + if (aliasp != nullptr) + { + if (*aliasp == NAME_None) + { + return true; // flagged to be ignored + } + fn = aliasp->GetChars(); + } + + if (!mus_restartonload) + { + // If the currently playing piece of music is the same, do not restart. Note that there's still edge cases where this may fail to detect identities. + if (mus_playing.handle != nullptr && lastStartedMusic.CompareNoCase(fn) == 0 && mus_playing.loop) + return true; + } + S_ChangeMusic(fn, 0, loop, true); return mus_playing.handle != nullptr; } diff --git a/source/common/savegamehelp.cpp b/source/common/savegamehelp.cpp index c16ede5ef..b0eae5d96 100644 --- a/source/common/savegamehelp.cpp +++ b/source/common/savegamehelp.cpp @@ -256,6 +256,7 @@ int G_ValidateSavegame(FileReader &fr, FString *savetitle) return 0; } } + return 1; } //============================================================================= diff --git a/source/duke3d/src/gameexec.cpp b/source/duke3d/src/gameexec.cpp index e9f15c183..0690feac8 100644 --- a/source/duke3d/src/gameexec.cpp +++ b/source/duke3d/src/gameexec.cpp @@ -1080,8 +1080,6 @@ static int32_t VM_ResetPlayer(int const playerNum, int32_t vmFlags, int32_t cons } else if (!(resetFlags & 1)) { - inputState.ClearKeyStatus(sc_Space); - I_AdvanceTriggerClear(); M_StartControlPanel(false); M_SetMenu(NAME_ConfirmPlayerReset); } diff --git a/source/duke3d/src/menus.cpp b/source/duke3d/src/menus.cpp index f5ab60a2c..b6b580a5a 100644 --- a/source/duke3d/src/menus.cpp +++ b/source/duke3d/src/menus.cpp @@ -1553,7 +1553,6 @@ static void Menu_PreDraw(MenuID_t cm, MenuEntry_t *entry, const vec2_t origin) } } break; -#endif case MENU_CREDITS4: // JBF 20031220 { #define MENU_YOFFSET 40 diff --git a/source/duke3d/src/screens.cpp b/source/duke3d/src/screens.cpp index 8ef72c260..fb0b9593f 100644 --- a/source/duke3d/src/screens.cpp +++ b/source/duke3d/src/screens.cpp @@ -1004,31 +1004,6 @@ void G_DisplayRest(int32_t smoothratio) } } -#if 0 - if (I_EscapeTrigger() && ud.overhead_on == 0 - && ud.show_help == 0 - && g_player[myconnectindex].ps->newowner == -1) - { - if ((g_player[myconnectindex].ps->gm&MODE_MENU) != MODE_MENU && - g_player[myconnectindex].ps->newowner == -1 && - (g_player[myconnectindex].ps->gm&MODE_TYPE) != MODE_TYPE) - { - I_EscapeTriggerClear(); - S_PauseSounds(true); - - Menu_Open(myconnectindex); - - if ((!g_netServer && ud.multimode < 2) && ud.recstat != 2) ready2send = 0; - - if (g_player[myconnectindex].ps->gm&MODE_GAME) Menu_Change(MENU_MAIN_INGAME); - else Menu_Change(MENU_MAIN); - screenpeek = myconnectindex; - - S_MenuSound(); - } - } -#endif - if (g_player[myconnectindex].ps->newowner == -1 && ud.overhead_on == 0 && cl_crosshair && ud.camerasprite == -1) { ud.returnvar[0] = (160<<16) - (g_player[myconnectindex].ps->look_ang<<15); diff --git a/source/rr/src/actors.cpp b/source/rr/src/actors.cpp index 12ae0d40c..00bcadf60 100644 --- a/source/rr/src/actors.cpp +++ b/source/rr/src/actors.cpp @@ -9142,13 +9142,13 @@ next_sprite: static void G_DoEffectorLights(void) // STATNUM 14 { - int32_t i; +#ifdef POLYMER + int32_t i; for (SPRITES_OF(STAT_LIGHT, i)) { switch (sprite[i].lotag) { -#ifdef POLYMER case SE_49_POINT_LIGHT: { if (!A_CheckSpriteFlags(i, SFLAG_NOLIGHT) && videoGetRenderMode() == REND_POLYMER && @@ -9310,9 +9310,9 @@ static void G_DoEffectorLights(void) // STATNUM 14 break; } -#endif // POLYMER } } +#endif // POLYMER } #ifdef POLYMER diff --git a/source/rr/src/d_menu.cpp b/source/rr/src/d_menu.cpp index 80dd7bef4..9da300fea 100644 --- a/source/rr/src/d_menu.cpp +++ b/source/rr/src/d_menu.cpp @@ -40,7 +40,8 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. #include "namesdyn.h" #include "../../glbackend/glbackend.h" -BEGIN_DUKE_NS + +BEGIN_RR_NS #define MENU_MARGIN_REGULAR 40 #define MENU_MARGIN_WIDE 32 @@ -142,8 +143,7 @@ static void Menu_DrawBackground(const DVector2 &origin) static void Menu_DrawTopBar(const DVector2 &origin) { - if ((G_GetLogoFlags() & LOGO_NOTITLEBAR) == 0) - rotatesprite_fs(int(origin.X*65536) + (MENU_MARGIN_CENTER<<16), int(origin.Y*65536) + (19<<16), MF_Redfont.cursorScale, 0,MENUBAR,16,0,10); + rotatesprite_fs(int(origin.X*65536) + (MENU_MARGIN_CENTER<<16), int(origin.Y*65536) + (19<<16), MF_Redfont.cursorScale, 0,MENUBAR,16,0,10); } static void Menu_DrawTopBarCaption(const char *caption, const DVector2 &origin) @@ -163,7 +163,7 @@ static void Menu_DrawTopBarCaption(const char *caption, const DVector2 &origin) static void Menu_GetFmt(const MenuFont_t* font, uint8_t const status, int32_t* s, int32_t* z) { if (status & MT_Selected) - *s = VM_OnEventWithReturn(EVENT_MENUSHADESELECTED, -1, myconnectindex, sintable[((int32_t)totalclock << 5) & 2047] >> 12); + *s = sintable[((int32_t)totalclock << 5) & 2047] >> 12; else *s = font->shade_deselected; // sum shade values @@ -335,7 +335,7 @@ class MainMenu : public RedneckListMenu void PreDraw() override { RedneckListMenu::PreDraw(); - rotatesprite_fs(origin.x + ((MENU_MARGIN_CENTER-5)<<16), origin.y + ((57+l)<<16), 16592L,0,RRRA? THREEDEE : INGAMEDUKETHREEDEE,0,0,10); + rotatesprite_fs(int((origin.X + MENU_MARGIN_CENTER-5) * 65536), int((origin.Y + 57) * 65536), 16592L,0,RRRA? THREEDEE : INGAMEDUKETHREEDEE,0,0,10); } }; @@ -423,7 +423,7 @@ void GameInterface::StartGame(FGameStartup& gs) } ud.m_player_skill = gs.Skill + 1; - ud.skill_voice = S_PlaySound(skillsound); + g_skillSoundVoice = S_PlaySound(skillsound); ud.m_respawn_monsters = (gs.Skill == 3); ud.m_monsters_off = ud.monsters_off = 0; ud.m_respawn_items = 0; @@ -443,9 +443,9 @@ FSavegameInfo GameInterface::GetSaveSig() void GameInterface::DrawCenteredTextScreen(const DVector2 &origin, const char *text, int position) { Menu_DrawBackground(origin); - G_ScreenText(MF_Bluefont.tilenum, int(origin.X + 160) * 65536), int((origin.Y + position) * 65536), MF_Bluefont.zoom, 0, 0, text, 0, MF_Bluefont.pal, + G_ScreenText(MF_Bluefont.tilenum, int((origin.X + 160) * 65536), int((origin.Y + position) * 65536), MF_Bluefont.zoom, 0, 0, text, 0, MF_Bluefont.pal, 2 | 8 | 16 | ROTATESPRITE_FULL16, 0, MF_Bluefont.emptychar.x, MF_Bluefont.emptychar.y, MF_Bluefont.between.x, MF_Bluefont.between.y, - MF_Bluefont.textflags | f | TEXT_XCENTER, 0, 0, xdim - 1, ydim - 1); + MF_Bluefont.textflags | TEXT_XCENTER, 0, 0, xdim - 1, ydim - 1); } diff --git a/source/rr/src/demo.cpp b/source/rr/src/demo.cpp index 1ca20b462..4eea7b22b 100644 --- a/source/rr/src/demo.cpp +++ b/source/rr/src/demo.cpp @@ -55,12 +55,12 @@ static int32_t demorec_seeds=1, demo_hasseeds; static void Demo_RestoreModes(int32_t menu) { - if (menu) - Menu_Open(myconnectindex); - else - Menu_Close(myconnectindex); + if (menu) + M_StartControlPanel(false); + else + M_ClearMenus(); - g_player[myconnectindex].ps->gm &= ~MODE_GAME; + g_player[myconnectindex].ps->gm &= ~MODE_GAME; g_player[myconnectindex].ps->gm |= MODE_DEMO; } @@ -489,7 +489,7 @@ RECHECK: fadepal(0,0,0, 0,252,28); P_SetGamePalette(g_player[myconnectindex].ps, BASEPAL, 1); // JBF 20040308 G_DrawBackground(); - M_DisplayMenus(); + //M_DisplayMenus(); videoNextPage(); fadepal(0,0,0, 252,0,-28); ud.reccnt = 0; @@ -523,8 +523,8 @@ RECHECK: { FX_StopAllSounds(); S_ClearSoundLocks(); - Menu_Open(myconnectindex); - } + M_StartControlPanel(false); + } ready2send = 0; bigi = 0; @@ -664,7 +664,7 @@ RECHECK: corrupt: OSD_Printf(OSD_ERROR "Demo %d is corrupt (code %d).\n", g_whichDemo-1, corruptcode); nextdemo: - Menu_Open(myconnectindex); + M_StartControlPanel(false); nextdemo_nomenu: foundemo = 0; ud.reccnt = 0; @@ -862,16 +862,6 @@ nextdemo_nomenu: goto RECHECK; } - if (I_EscapeTrigger() && (g_player[myconnectindex].ps->gm&MODE_MENU) == 0 && (g_player[myconnectindex].ps->gm&MODE_TYPE) == 0) - { - I_EscapeTriggerClear(); - FX_StopAllSounds(); - S_ClearSoundLocks(); - Menu_Open(myconnectindex); - Menu_Change(MENU_MAIN); - S_MenuSound(); - } - if (Demo_IsProfiling()) { // Do nothing: sampletimer() is reached from M_DisplayMenus() -> @@ -884,15 +874,15 @@ nextdemo_nomenu: if ((g_player[myconnectindex].ps->gm&MODE_TYPE) != MODE_TYPE) { g_player[myconnectindex].ps->gm = 0; - Menu_Open(myconnectindex); - } + M_StartControlPanel(false); + } } else { - if (ud.recstat != 2) - M_DisplayMenus(); + //if (ud.recstat != 2) + //M_DisplayMenus(); - if ((g_netServer || ud.multimode > 1) && !Menu_IsTextInput(m_currentMenu)) + if ((g_netServer || ud.multimode > 1))// && !Menu_IsTextInput(m_currentMenu)) { ControlInfo noshareinfo; CONTROL_GetInput(&noshareinfo); diff --git a/source/rr/src/duke3d.h b/source/rr/src/duke3d.h index 28d426db3..497b64327 100644 --- a/source/rr/src/duke3d.h +++ b/source/rr/src/duke3d.h @@ -158,7 +158,14 @@ struct GameInterface : ::GameInterface bool mouseInactiveConditional(bool condition) override; FString statFPS() override; GameStats getStats() override; + void DrawNativeMenuText(int fontnum, int state, int xpos, int ypos, float fontscale, const char* text, int flags); + void MenuOpened() override; + void MenuSound(::GameInterface::EMenuSounds snd) override; + void MenuClosed() override; + bool CanSave() override; + void StartGame(FGameStartup& gs) override; FSavegameInfo GetSaveSig() override; + void DrawCenteredTextScreen(const DVector2& origin, const char* text, int position) override; }; END_RR_NS diff --git a/source/rr/src/game.cpp b/source/rr/src/game.cpp index 6bcd72953..bb37e2352 100644 --- a/source/rr/src/game.cpp +++ b/source/rr/src/game.cpp @@ -46,6 +46,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. #include "m_argv.h" #include "filesystem/filesystem.h" #include "statistics.h" +#include "c_dispatch.h" // Uncomment to prevent anything except mirrors from drawing. It is sensible to // also uncomment ENGINE_CLEAR_SCREEN in build/src/engine_priv.h. @@ -6230,82 +6231,6 @@ void G_HandleLocalKeys(void) typebuf[0] = 0; } - if (inputState.UnboundKeyPressed(sc_F1)/* || (ud.show_help && I_AdvanceTrigger())*/) - { - inputState.ClearKeyStatus(sc_F1); - - Menu_Change(MENU_STORY); - S_PauseSounds(true); - Menu_Open(myconnectindex); - - if ((!g_netServer && ud.multimode < 2)) - { - ready2send = 0; - totalclock = ototalclock; - screenpeek = myconnectindex; - } - } - - // if((!net_server && ud.multimode < 2)) - { - if (ud.recstat != 2 && (!RRRA || ud.player_skill != 4) && (!RR || RRRA || ud.player_skill != 5) && inputState.UnboundKeyPressed(sc_F2)) - { - inputState.ClearKeyStatus(sc_F2); - -FAKE_F2: - if (sprite[g_player[myconnectindex].ps->i].extra <= 0) - { - P_DoQuote(QUOTE_SAVE_DEAD,g_player[myconnectindex].ps); - return; - } - - Menu_Change(MENU_SAVE); - - S_PauseSounds(true); - Menu_Open(myconnectindex); - - if ((!g_netServer && ud.multimode < 2)) - { - ready2send = 0; - totalclock = ototalclock; - screenpeek = myconnectindex; - } - } - - if ((!RRRA || ud.player_skill != 4) && (!RR || RRRA || ud.player_skill != 5) && inputState.UnboundKeyPressed(sc_F3)) - { - inputState.ClearKeyStatus(sc_F3); - -FAKE_F3: - Menu_Change(MENU_LOAD); - S_PauseSounds(true); - Menu_Open(myconnectindex); - - if ((!g_netServer && ud.multimode < 2) && ud.recstat != 2) - { - ready2send = 0; - totalclock = ototalclock; - } - - screenpeek = myconnectindex; - } - } - - if (inputState.UnboundKeyPressed(sc_F4)) - { - inputState.ClearKeyStatus(sc_F4); - - S_PauseSounds(true); - Menu_Open(myconnectindex); - - if ((!g_netServer && ud.multimode < 2) && ud.recstat != 2) - { - ready2send = 0; - totalclock = ototalclock; - } - - Menu_Change(MENU_SOUND_INGAME); - } if ((buttonMap.ButtonDown(gamefunc_Quick_Save) || g_doQuickSave == 1) && (!RRRA || ud.player_skill != 4) && (!RR || RRRA || ud.player_skill != 5) && (g_player[myconnectindex].ps->gm&MODE_GAME)) { @@ -6313,8 +6238,11 @@ FAKE_F3: g_doQuickSave = 0; - if (!g_lastusersave.isValid()) - goto FAKE_F2; + if (!g_lastusersave.isValid()) + { + C_DoCommand("opensavemenu"); + return; + } inputState.keyFlushChars(); @@ -6375,9 +6303,11 @@ FAKE_F3: g_doQuickSave = 0; - if (g_quickload == nullptr || !g_quickload->isValid()) - goto FAKE_F3; - else if (g_quickload->isValid()) + if (g_quickload == nullptr || !g_quickload->isValid()) + { + C_DoCommand("openloadmenu"); + } + else if (g_quickload->isValid()) { inputState.keyFlushChars(); inputState.ClearKeysDown(); @@ -6387,36 +6317,6 @@ FAKE_F3: } } - if (inputState.UnboundKeyPressed(sc_F10)) - { - inputState.ClearKeyStatus(sc_F10); - - Menu_Change(MENU_QUIT_INGAME); - S_PauseSounds(true); - Menu_Open(myconnectindex); - - if ((!g_netServer && ud.multimode < 2) && ud.recstat != 2) - { - ready2send = 0; - totalclock = ototalclock; - } - } - - if (inputState.UnboundKeyPressed(sc_F11)) - { - inputState.ClearKeyStatus(sc_F11); - - Menu_Change(MENU_COLCORR_INGAME); - S_PauseSounds(true); - Menu_Open(myconnectindex); - - if ((!g_netServer && ud.multimode < 2) && ud.recstat != 2) - { - ready2send = 0; - totalclock = ototalclock; - } - } - if (ud.overhead_on != 0) { int const timerOffset = ((int) totalclock - nonsharedtimer); @@ -7381,9 +7281,9 @@ void G_BackToMenu(void) if (ud.recstat == 1) G_CloseDemoWrite(); ud.warp_on = 0; g_player[myconnectindex].ps->gm = 0; - Menu_Open(myconnectindex); - Menu_Change(MENU_MAIN); - inputState.keyFlushChars(); + M_StartControlPanel(false); + M_SetMenu(NAME_MainMenu); + inputState.keyFlushChars(); } static int G_EndOfLevel(void) @@ -7426,9 +7326,9 @@ static int G_EndOfLevel(void) if (!VOLUMEALL) G_DoOrderScreen(); g_player[myconnectindex].ps->gm = 0; - Menu_Open(myconnectindex); - Menu_Change(MENU_MAIN); - return 2; + M_StartControlPanel(false); + M_SetMenu(NAME_MainMenu); + return 2; } else { @@ -7719,8 +7619,6 @@ MAIN_LOOP_RESTART: for (int & q : user_quote_time) q = 0; - Menu_Change(MENU_MAIN); - //if (g_networkMode != NET_DEDICATED_SERVER) { G_GetCrosshairColor(); diff --git a/source/rr/src/gameexec.cpp b/source/rr/src/gameexec.cpp index 712dae268..7f261f91b 100644 --- a/source/rr/src/gameexec.cpp +++ b/source/rr/src/gameexec.cpp @@ -1063,11 +1063,9 @@ static int32_t VM_ResetPlayer(int const playerNum, int32_t vmFlags) { if (g_quickload && g_quickload->isValid() && ud.recstat != 2) { - Menu_Open(playerNum); - inputState.ClearKeyStatus(sc_Space); - I_AdvanceTriggerClear(); - Menu_Change(MENU_RESETPLAYER); - } + M_StartControlPanel(false); + M_SetMenu(NAME_ConfirmPlayerReset); + } else g_player[playerNum].ps->gm = MODE_RESTART; vmFlags |= VM_NOEXECUTE; diff --git a/source/rr/src/menus.cpp b/source/rr/src/menus.cpp index 5b219ad29..ff2b7672f 100644 --- a/source/rr/src/menus.cpp +++ b/source/rr/src/menus.cpp @@ -36,13 +36,14 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. BEGIN_RR_NS +#if 0 + // common positions #define MENU_MARGIN_REGULAR 40 #define MENU_MARGIN_WIDE 32 #define MENU_MARGIN_CENTER 160 #define MENU_HEIGHT_CENTER 100 -int32_t g_skillSoundVoice = -1; #define USERMAPENTRYLENGTH 25 @@ -179,19 +180,6 @@ they effectively stand in for curly braces as struct initializers. // common font types // tilenums are set after namesdyn runs -// emptychar x,y between x,y zoom cursorLeft cursorCenter cursorScale textflags -// tilenum shade_deselected shade_disabled pal pal_selected pal_deselected pal_disabled -MenuFont_t MF_Redfont = { { 5<<16, 15<<16 }, { 0, 0 }, 65536, 20<<16, 110<<16, 65536, 65536, 65536, TEXT_BIGALPHANUM | TEXT_UPPERCASE, - -1, 10, 0, 0, 0, 0, 1, - 0, 0, 1 }; -MenuFont_t MF_Bluefont = { { 5<<16, 7<<16 }, { 0, 0 }, 65536, 10<<16, 110<<16, 32768, 65536, 65536, 0, - -1, 10, 0, 0, 10, 10, 16, - 0, 0, 16 }; -MenuFont_t MF_Minifont = { { 4<<16, 5<<16 }, { 1<<16, 1<<16 }, 65536, 10<<16, 110<<16, 32768, 65536, 65536, 0, - -1, 10, 0, 0, 2, 2, 0, - 0, 0, 16 }; - - static MenuMenuFormat_t MMF_Top_Main = { { MENU_MARGIN_CENTER<<16, 55<<16, }, -(170<<16) }; static MenuMenuFormat_t MMF_Top_Episode = { { MENU_MARGIN_CENTER<<16, 48<<16, }, -(190<<16) }; static MenuMenuFormat_t MMF_Top_Skill = { { MENU_MARGIN_CENTER<<16, 58<<16, }, -(190<<16) }; @@ -7445,14 +7433,6 @@ void M_DisplayMenus(void) } } -bool GameInterface::mouseInactiveConditional(bool condition) -{ - return MOUSEINACTIVECONDITIONAL(condition); -} - -FSavegameInfo GameInterface::GetSaveSig() -{ - return { SAVESIG_RR, MINSAVEVER_RR, SAVEVER_RR }; -} +#endif END_RR_NS diff --git a/source/rr/src/menus.h b/source/rr/src/menus.h index 7bdf57a7a..3e8b0a47b 100644 --- a/source/rr/src/menus.h +++ b/source/rr/src/menus.h @@ -27,6 +27,31 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. BEGIN_RR_NS +// a subset of screentext parameters, restricted because menus require accessibility +typedef struct MenuFont_t +{ + // int32_t xspace, yline; + vec2_t emptychar, between; + int32_t zoom; + int32_t cursorLeftPosition, cursorCenterPosition, cursorScale, cursorScale2, cursorScale3; + int32_t textflags; + int16_t tilenum; + // selected shade glows, deselected shade is used by Blood, disabled shade is used by SW + int8_t shade_deselected, shade_disabled; + uint8_t pal; + uint8_t pal_selected, pal_deselected, pal_disabled; + uint8_t pal_selected_right, pal_deselected_right, pal_disabled_right; + + int32_t get_yline() const { return mulscale16(emptychar.y, zoom); } +} MenuFont_t; + +extern MenuFont_t MF_Redfont, MF_Bluefont, MF_Minifont; + +void Menu_Init(void); + +#if 0 + + enum MenuIndex_t { MENU_NULL = INT32_MIN, // sentinel for "do nothing" MENU_CLOSE = -2, // sentinel for "close the menu"/"no menu" @@ -141,25 +166,6 @@ typedef enum MenuAnimationType_t MA_Advance, } MenuAnimationType_t; -// a subset of screentext parameters, restricted because menus require accessibility -typedef struct MenuFont_t -{ -// int32_t xspace, yline; - vec2_t emptychar, between; - int32_t zoom; - int32_t cursorLeftPosition, cursorCenterPosition, cursorScale, cursorScale2, cursorScale3; - int32_t textflags; - int16_t tilenum; - // selected shade glows, deselected shade is used by Blood, disabled shade is used by SW - int8_t shade_deselected, shade_disabled; - uint8_t pal; - uint8_t pal_selected, pal_deselected, pal_disabled; - uint8_t pal_selected_right, pal_deselected_right, pal_disabled_right; - - int32_t get_yline() const { return mulscale16(emptychar.y, zoom); } -} MenuFont_t; - - typedef enum MenuEntryType_t { @@ -505,6 +511,8 @@ extern int32_t m_mousewake_watchpoint, m_menuchange_watchpoint; # define MOUSEINACTIVECONDITIONAL(condition) (!MOUSEACTIVECONDITION && (condition)) # define MOUSEWATCHPOINTCONDITIONAL(condition) ((condition) || m_mousewake_watchpoint || m_menuchange_watchpoint == 3) +#endif + END_RR_NS #endif diff --git a/source/rr/src/premap.cpp b/source/rr/src/premap.cpp index 7b369be2b..1aaffd4be 100644 --- a/source/rr/src/premap.cpp +++ b/source/rr/src/premap.cpp @@ -36,6 +36,7 @@ static int32_t g_whichPalForPlayer = 9; static uint8_t precachehightile[2][MAXTILES>>3]; static int32_t g_precacheCount; +int32_t g_skillSoundVoice = -1; static void flag_precache(int32_t tile, int32_t type) @@ -1948,7 +1949,7 @@ end_vol4a: pPlayer->zoom = 768; #endif pPlayer->gm = 0; - Menu_Close(0); + M_ClearMenus(); //AddLog("Newgame"); @@ -2474,7 +2475,6 @@ int G_EnterLevel(int gameMode) for (TRAVERSE_CONNECT(i)) { g_player[i].ps->gm = MODE_GAME; - Menu_Close(i); } } else if (gameMode & MODE_RESTART) diff --git a/source/rr/src/screens.cpp b/source/rr/src/screens.cpp index fa99b3788..2c2eb268a 100644 --- a/source/rr/src/screens.cpp +++ b/source/rr/src/screens.cpp @@ -1035,37 +1035,6 @@ void G_DisplayRest(int32_t smoothratio) } } - if (I_EscapeTrigger() && ud.overhead_on == 0 - && ud.show_help == 0 - && g_player[myconnectindex].ps->newowner == -1) - { - if ((g_player[myconnectindex].ps->gm&MODE_MENU) == MODE_MENU && g_currentMenu <= MENU_MAIN_INGAME) - { - I_EscapeTriggerClear(); - S_PlaySound(EXITMENUSOUND); - Menu_Change(MENU_CLOSE); - if (!ud.pause_on) - S_PauseSounds(false); - } - else if ((g_player[myconnectindex].ps->gm&MODE_MENU) != MODE_MENU && - g_player[myconnectindex].ps->newowner == -1 && - (g_player[myconnectindex].ps->gm&MODE_TYPE) != MODE_TYPE) - { - I_EscapeTriggerClear(); - S_PauseSounds(true); - - Menu_Open(myconnectindex); - - if ((!g_netServer && ud.multimode < 2) && ud.recstat != 2) ready2send = 0; - - if (g_player[myconnectindex].ps->gm&MODE_GAME) Menu_Change(MENU_MAIN_INGAME); - else Menu_Change(MENU_MAIN); - screenpeek = myconnectindex; - - S_MenuSound(); - } - } - if (g_player[myconnectindex].ps->newowner == -1 && ud.overhead_on == 0 && cl_crosshair && ud.camerasprite == -1) { int32_t a = CROSSHAIR; @@ -1171,8 +1140,8 @@ void G_DisplayRest(int32_t smoothratio) { if (g_player[myconnectindex].ps->gm&MODE_TYPE) Net_SendMessage(); - else - M_DisplayMenus(); + //else + //M_DisplayMenus(); } { diff --git a/source/rr/src/sounds.cpp b/source/rr/src/sounds.cpp index 17d9b265d..473f9f1c3 100644 --- a/source/rr/src/sounds.cpp +++ b/source/rr/src/sounds.cpp @@ -738,9 +738,6 @@ void S_Callback(intptr_t num) dnum++; } -void S_ClearSoundLocks(void) -{ -} bool A_CheckSoundPlaying(int spriteNum, int soundNum) {