diff --git a/source/common/dobject/dobject.cpp b/source/common/dobject/dobject.cpp index d926251e1..98b8105fe 100644 --- a/source/common/dobject/dobject.cpp +++ b/source/common/dobject/dobject.cpp @@ -37,6 +37,8 @@ #include "dobject.h" +#if 0 + PClass DObject::_StaticType; ClassReg DObject::RegistrationInfo = { @@ -71,3 +73,4 @@ DObject::~DObject () void DObject::Destroy () { } +#endif \ No newline at end of file diff --git a/source/common/dobject/dobject.h b/source/common/dobject/dobject.h index 0b2b3dc70..502f3c35b 100644 --- a/source/common/dobject/dobject.h +++ b/source/common/dobject/dobject.h @@ -34,6 +34,8 @@ #ifndef __DOBJECT_H__ #define __DOBJECT_H__ +#if 0 + #include struct PClass; @@ -176,4 +178,5 @@ inline bool DObject::IsA (const PClass *type) return (type == GetClass()); } +#endif #endif //__DOBJECT_H__ diff --git a/source/common/dobject/dobjtype.cpp b/source/common/dobject/dobjtype.cpp index d77f711bc..6f4d50485 100644 --- a/source/common/dobject/dobjtype.cpp +++ b/source/common/dobject/dobjtype.cpp @@ -38,6 +38,7 @@ #include "templates.h" #include "autosegs.h" #include "tarray.h" +#if 0 static TArray Types; static TMap Map; @@ -102,3 +103,4 @@ DObject *PClass::CreateNew () const ((DObject *)mem)->SetClass (const_cast(this)); return (DObject *)mem; } +#endif \ No newline at end of file diff --git a/source/common/menu/joystickmenu.cpp b/source/common/menu/joystickmenu.cpp index bd9dfabf3..18a1e5af6 100644 --- a/source/common/menu/joystickmenu.cpp +++ b/source/common/menu/joystickmenu.cpp @@ -226,10 +226,8 @@ public: class DJoystickConfigMenu : public DOptionMenu { - DECLARE_CLASS(DJoystickConfigMenu, DOptionMenu) }; -IMPLEMENT_CLASS(DJoystickConfigMenu) //============================================================================= // diff --git a/source/common/menu/listmenu.cpp b/source/common/menu/listmenu.cpp index 7cb389e8a..d7b31e52d 100644 --- a/source/common/menu/listmenu.cpp +++ b/source/common/menu/listmenu.cpp @@ -40,8 +40,6 @@ #include "menu.h" #include "v_draw.h" -IMPLEMENT_CLASS(DListMenu) - //============================================================================= // // @@ -253,12 +251,14 @@ void DListMenu::Ticker () void DListMenu::Drawer () { + PreDraw(); for(unsigned i=0;imItems.Size(); i++) { if (mDesc->mItems[i]->mEnabled) mDesc->mItems[i]->Drawer(mDesc->mSelectedItem == (int)i); } if (mDesc->mSelectedItem >= 0 && mDesc->mSelectedItem < (int)mDesc->mItems.Size()) mDesc->mItems[mDesc->mSelectedItem]->DrawSelector(mDesc->mSelectOfsX, mDesc->mSelectOfsY, mDesc->mSelector); + PostDraw(); Super::Drawer(); } diff --git a/source/common/menu/loadsavemenu.cpp b/source/common/menu/loadsavemenu.cpp index 20c5f6caf..12f527aef 100644 --- a/source/common/menu/loadsavemenu.cpp +++ b/source/common/menu/loadsavemenu.cpp @@ -48,7 +48,7 @@ class DLoadSaveMenu : public DListMenu { - DECLARE_CLASS(DLoadSaveMenu, DListMenu) + using Super = DListMenu; friend void ClearSaveGames(); protected: @@ -109,8 +109,6 @@ public: }; -IMPLEMENT_CLASS(DLoadSaveMenu) - TArray DLoadSaveMenu::SaveGames; int DLoadSaveMenu::LastSaved = -1; int DLoadSaveMenu::LastAccessed = -1; @@ -723,8 +721,7 @@ bool DLoadSaveMenu::Responder (event_t *ev) class DSaveMenu : public DLoadSaveMenu { - DECLARE_CLASS(DSaveMenu, DLoadSaveMenu) - + using Super = DLoadSaveMenu; FSaveGameNode NewSaveNode; public: @@ -737,9 +734,6 @@ public: }; -IMPLEMENT_CLASS(DSaveMenu) - - //============================================================================= // // @@ -895,7 +889,7 @@ bool DSaveMenu::Responder (event_t *ev) class DLoadMenu : public DLoadSaveMenu { - DECLARE_CLASS(DLoadMenu, DLoadSaveMenu) + using Super = DLoadSaveMenu; public: @@ -904,9 +898,6 @@ public: bool MenuEvent (int mkey, bool fromcontroller); }; -IMPLEMENT_CLASS(DLoadMenu) - - //============================================================================= // // diff --git a/source/common/menu/menu.cpp b/source/common/menu/menu.cpp index 2256f7ebc..e47190369 100644 --- a/source/common/menu/menu.cpp +++ b/source/common/menu/menu.cpp @@ -49,6 +49,9 @@ #include "v_draw.h" #include "gamecontrol.h" +void RegisterDukeMenus(); +extern bool rotatesprite_2doverride; + // // Todo: Move these elsewhere // @@ -60,6 +63,8 @@ CVAR (Float, snd_menuvolume, 0.6f, CVAR_ARCHIVE) CVAR(Int, m_use_mouse, 1, CVAR_ARCHIVE|CVAR_GLOBALCONFIG) CVAR(Int, m_show_backbutton, 0, CVAR_ARCHIVE|CVAR_GLOBALCONFIG) +TArray menuClasses(TArray::ENoInit(0)); + DMenu *DMenu::CurrentMenu; int DMenu::MenuTime; @@ -69,7 +74,7 @@ bool M_DemoNoPlay; FButtonStatus MenuButtons[NUM_MKEYS]; int MenuButtonTickers[NUM_MKEYS]; bool MenuButtonOrigin[NUM_MKEYS]; -int BackbuttonTime; +int BackbuttonTime; float BackbuttonAlpha; static bool MenuEnabled = true; @@ -83,7 +88,6 @@ static bool MenuEnabled = true; // //============================================================================ -IMPLEMENT_CLASS (DMenu) DMenu::DMenu(DMenu *parent) { @@ -164,6 +168,7 @@ void DMenu::Close () assert(DMenu::CurrentMenu == this); DMenu::CurrentMenu = mParentMenu; Destroy(); + delete this; if (DMenu::CurrentMenu == NULL) { M_ClearMenus (); @@ -417,9 +422,23 @@ void M_SetMenu(FName menu, int param) } else { - //const PClass *cls = ld->mClass == NULL? RUNTIME_CLASS(DListMenu) : ld->mClass; - - DListMenu* newmenu = new DListMenu; + DListMenu* newmenu; + if (ld->mClass != NAME_None) + { + auto ndx = menuClasses.FindEx([=](const auto p) { return p->mName == ld->mClass; }); + if (ndx == menuClasses.Size()) + { + I_Error("Bad menu class %s\n", ld->mClass.GetChars()); + } + else + { + newmenu = (DListMenu*)menuClasses[ndx]->CreateNew(); + } + } + else + { + newmenu = new DListMenu; + } newmenu->Init(DMenu::CurrentMenu, ld); M_ActivateMenu(newmenu); } @@ -437,6 +456,7 @@ void M_SetMenu(FName menu, int param) } else { + /* const PClass *menuclass = PClass::FindClass(menu); if (menuclass != NULL) { @@ -448,6 +468,7 @@ void M_SetMenu(FName menu, int param) return; } } + */ } Printf("Attempting to open menu of unknown type '%s'\n", menu.GetChars()); } @@ -687,6 +708,7 @@ void M_Ticker (void) void M_Drawer (void) { + rotatesprite_2doverride = true; PalEntry fade = 0x70000000; #if 0 player_t *player = &players[consoleplayer]; @@ -705,9 +727,11 @@ void M_Drawer (void) if (DMenu::CurrentMenu != NULL && menuactive != MENU_Off) { + DMenu::CurrentMenu->origin = { 0,0 }; if (DMenu::CurrentMenu->DimAllowed() && fade) twod.AddColorOnlyQuad(0, 0, screen->GetWidth(), screen->GetHeight(), fade); DMenu::CurrentMenu->Drawer(); } + rotatesprite_2doverride = false; } //============================================================================= @@ -722,6 +746,7 @@ void M_ClearMenus () if (DMenu::CurrentMenu != NULL) { DMenu::CurrentMenu->Destroy(); + delete DMenu::CurrentMenu; DMenu::CurrentMenu = NULL; } menuactive = MENU_Off; @@ -736,6 +761,7 @@ void M_ClearMenus () void M_Init (void) { + RegisterDukeMenus(); timerSetCallback(M_Ticker); M_ParseMenuDefs(); M_CreateMenus(); diff --git a/source/common/menu/menu.h b/source/common/menu/menu.h index 874a7768d..b1aaddb65 100644 --- a/source/common/menu/menu.h +++ b/source/common/menu/menu.h @@ -4,7 +4,6 @@ -#include "dobject.h" #include "c_cvars.h" #include "v_font.h" #include "version.h" @@ -107,6 +106,7 @@ class FOptionMenuItem; struct FListMenuDescriptor : public FMenuDescriptor { TDeletingArray mItems; + FString mCaption; int mSelectedItem; int mSelectOfsX; int mSelectOfsY; @@ -116,6 +116,8 @@ struct FListMenuDescriptor : public FMenuDescriptor int mWLeft, mWRight; int mLinespacing; // needs to be stored for dynamically created menus int mAutoselect; // this can only be set by internal menu creation functions + int mScriptId; + int mSecondaryId; FFont *mFont; EColorRange mFontColor; EColorRange mFontColor2; @@ -136,6 +138,8 @@ struct FListMenuDescriptor : public FMenuDescriptor mFont = NULL; mFontColor = CR_UNTRANSLATED; mFontColor2 = CR_UNTRANSLATED; + mScriptId = 0; + mSecondaryId = 0; } }; @@ -211,10 +215,8 @@ struct FMenuRect }; -class DMenu : public DObject +class DMenu { - DECLARE_CLASS (DMenu, DObject) - protected: bool mMouseCapture; bool mBackbuttonSelected; @@ -236,19 +238,24 @@ public: static int MenuTime; DMenu *mParentMenu; + vec2_t origin; DMenu(DMenu *parent = NULL); virtual bool Responder (event_t *ev); virtual bool MenuEvent (int mkey, bool fromcontroller); virtual void Ticker (); + virtual void PreDraw() {} + virtual void PostDraw() {} virtual void Drawer (); virtual bool DimAllowed (); virtual bool TranslateKeyboardEvents(); virtual void Close(); virtual bool MouseEvent(int type, int x, int y); + virtual void Destroy() {} bool MouseEventBack(int type, int x, int y); void SetCapture(); void ReleaseCapture(); + void SetOrigin(); bool HasCapture() { return mMouseCapture; @@ -427,8 +434,7 @@ public: class DListMenu : public DMenu { - DECLARE_CLASS(DListMenu, DMenu) - + typedef DMenu Super; protected: FListMenuDescriptor *mDesc = nullptr; FListMenuItem *mFocusControl = nullptr; @@ -516,8 +522,7 @@ extern FOptionMap OptionValues; class DOptionMenu : public DMenu { - DECLARE_CLASS(DOptionMenu, DMenu) - + using Super = DMenu; bool CanScrollUp; bool CanScrollDown; int VisBottom; @@ -560,8 +565,7 @@ public: class DTextEnterMenu : public DMenu { - DECLARE_ABSTRACT_CLASS(DTextEnterMenu, DMenu) - + using Super = DMenu; TArray mEnterString; FString* mOutString; unsigned int mEnterSize; @@ -611,5 +615,28 @@ void M_StartMessage(const char *message, int messagemode, FName action = NAME_No void I_SetMouseCapture(); void I_ReleaseMouseCapture(); +struct MenuClassDescriptor; +extern TArray menuClasses; + +struct MenuClassDescriptor +{ + FName mName; + MenuClassDescriptor(const char* name) : mName(name) + { + //menuClasses.Push(this); + } + + virtual DMenu* CreateNew() = 0; +}; + +template struct TMenuClassDescriptor : public MenuClassDescriptor +{ + TMenuClassDescriptor(const char* name) : MenuClassDescriptor(name) + {} + DMenu* CreateNew() + { + return new Menu; + } +}; #endif \ No newline at end of file diff --git a/source/common/menu/menudef.cpp b/source/common/menu/menudef.cpp index 40023216c..dbb1f7ab6 100644 --- a/source/common/menu/menudef.cpp +++ b/source/common/menu/menudef.cpp @@ -133,7 +133,7 @@ struct gamefilter static const gamefilter games[] = { { "Duke", GAMEFLAG_DUKE}, - { "Nam", GAMEFLAG_NAM}, + { "Nam", GAMEFLAG_NAM|GAMEFLAG_NAPALM}, { "WW2GI", GAMEFLAG_WW2GI}, { "Fury", GAMEFLAG_FURY}, { "Redneck", GAMEFLAG_RR}, @@ -294,6 +294,16 @@ static void ParseListMenuBody(FScanner &sc, FListMenuDescriptor *desc) FListMenuItem *it = new FListMenuItemStaticPatch(x, y, tex, centered); desc->mItems.Push(it); } + else if (sc.Compare("ScriptId")) + { + sc.MustGetNumber(); + desc->mScriptId = sc.Number; + } + else if (sc.Compare("Caption")) + { + sc.MustGetString(); + desc->mCaption = sc.String; + } else if (sc.Compare("StaticText") || sc.Compare("StaticTextCentered")) { bool centered = sc.Compare("StaticTextCentered"); diff --git a/source/common/menu/menuinput.cpp b/source/common/menu/menuinput.cpp index b355b905b..2a5b2faff 100644 --- a/source/common/menu/menuinput.cpp +++ b/source/common/menu/menuinput.cpp @@ -41,8 +41,6 @@ #include "v_text.h" #include "v_draw.h" -IMPLEMENT_ABSTRACT_CLASS(DTextEnterMenu) - #define INPUTGRID_WIDTH 13 #define INPUTGRID_HEIGHT 5 diff --git a/source/common/menu/messagebox.cpp b/source/common/menu/messagebox.cpp index f0f17576d..99cc86160 100644 --- a/source/common/menu/messagebox.cpp +++ b/source/common/menu/messagebox.cpp @@ -46,8 +46,7 @@ extern FSaveGameNode *quickSaveSlot; class DMessageBoxMenu : public DMenu { - DECLARE_CLASS(DMessageBoxMenu, DMenu) - + using Super = DMenu; TArray mMessage; int mMessageMode; int messageSelection; @@ -67,7 +66,6 @@ public: virtual void HandleResult(bool res); }; -IMPLEMENT_CLASS(DMessageBoxMenu) //============================================================================= // diff --git a/source/common/menu/optionmenu.cpp b/source/common/menu/optionmenu.cpp index 1eb6b7981..e8bf2f42d 100644 --- a/source/common/menu/optionmenu.cpp +++ b/source/common/menu/optionmenu.cpp @@ -62,7 +62,6 @@ void M_DrawConText (int color, int x, int y, const char *str) } -IMPLEMENT_CLASS(DOptionMenu) //============================================================================= // diff --git a/source/common/menu/optionmenuitems.h b/source/common/menu/optionmenuitems.h index bc0b443fb..fd115b398 100644 --- a/source/common/menu/optionmenuitems.h +++ b/source/common/menu/optionmenuitems.h @@ -322,8 +322,6 @@ public: class DEnterKey : public DMenu { - DECLARE_CLASS(DEnterKey, DMenu) - int *pKey; public: @@ -342,6 +340,7 @@ public: void SetMenuMessage(int which) { + /* if (mParentMenu->IsKindOf(RUNTIME_CLASS(DOptionMenu))) { DOptionMenu *m = static_cast(mParentMenu); @@ -351,6 +350,7 @@ public: it->SetValue(0, which); } } + */ } bool Responder(event_t *ev) @@ -373,10 +373,6 @@ public: } }; -#ifndef NO_IMP -IMPLEMENT_ABSTRACT_CLASS(DEnterKey) -#endif - //============================================================================= // // // Edit a key binding, Action is the CCMD to bind diff --git a/source/common/menu/readthis.cpp b/source/common/menu/readthis.cpp index 43d981822..c68cf5751 100644 --- a/source/common/menu/readthis.cpp +++ b/source/common/menu/readthis.cpp @@ -41,7 +41,6 @@ class DReadThisMenu : public DMenu { - DECLARE_CLASS(DReadThisMenu, DMenu) int mScreen; int mInfoTic; @@ -54,7 +53,6 @@ public: bool MouseEvent(int type, int x, int y); }; -IMPLEMENT_CLASS(DReadThisMenu) //============================================================================= // diff --git a/source/duke3d/CMakeLists.txt b/source/duke3d/CMakeLists.txt index c0619e2cb..b3169684e 100644 --- a/source/duke3d/CMakeLists.txt +++ b/source/duke3d/CMakeLists.txt @@ -62,8 +62,9 @@ set( PCH_SOURCES src/sector.cpp src/sounds.cpp src/soundsdyn.cpp + src/d_menu.cpp ) - + if( MSVC ) enable_precompiled_headers( ../g_pch.h PCH_SOURCES ) # The original Build code was written with unsigned chars and unfortunately they still haven't been eliminated entirely. diff --git a/source/duke3d/src/d_menu.cpp b/source/duke3d/src/d_menu.cpp new file mode 100644 index 000000000..356464116 --- /dev/null +++ b/source/duke3d/src/d_menu.cpp @@ -0,0 +1,146 @@ +//------------------------------------------------------------------------- +/* +Copyright (C) 2016 EDuke32 developers and contributors +Copyright (C) 2019 Christoph Oelckers + +This is free software; you can redistribute it and/or +modify it under the terms of the GNU General Public License version 2 +as published by the Free Software Foundation. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + +See the GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +*/ +//------------------------------------------------------------------------- + +#include "ns.h" // Must come before everything else! + +#include "cheats.h" +#include "compat.h" +#include "demo.h" +#include "duke3d.h" +#include "input.h" +#include "menus.h" +#include "osdcmds.h" +#include "savegame.h" +#include "game.h" +#include "superfasthash.h" +#include "gamecvars.h" +#include "gamecontrol.h" +#include "c_bind.h" +#include "menu/menu.h" +#include "../../glbackend/glbackend.h" + +BEGIN_DUKE_NS + +#define MENU_MARGIN_REGULAR 40 +#define MENU_MARGIN_WIDE 32 +#define MENU_MARGIN_CENTER 160 +#define MENU_HEIGHT_CENTER 100 + + +static void Menu_DrawTopBar(const vec2_t origin) +{ + if ((G_GetLogoFlags() & LOGO_NOTITLEBAR) == 0) + rotatesprite_fs(origin.x + (MENU_MARGIN_CENTER<<16), origin.y + (19<<16), MF_Redfont.cursorScale, 0,MENUBAR,16,0,10); +} + +static void Menu_DrawTopBarCaption(const char *caption, const vec2_t origin) +{ + static char t[64]; + size_t const srclen = strlen(caption); + size_t const dstlen = min(srclen, ARRAY_SIZE(t)-1); + memcpy(t, caption, dstlen); + t[dstlen] = '\0'; + char *p = &t[dstlen-1]; + if (*p == ':') + *p = '\0'; + captionmenutext(origin.x + (MENU_MARGIN_CENTER<<16), origin.y + (24<<16) + ((15>>1)<<16), t); +} + + + +class DukeListMenu : public DListMenu +{ + using Super = DListMenu; +protected: + + virtual void CallScript(int event, bool getorigin = false) + { + ud.returnvar[0] = origin.x; + ud.returnvar[1] = origin.y; + ud.returnvar[2] = mDesc->mSelectedItem; + VM_OnEventWithReturn(event, g_player[screenpeek].ps->i, screenpeek, mDesc->mScriptId); + if (getorigin) + { + origin.x = ud.returnvar[0]; + origin.y = ud.returnvar[1]; + } + } + + void PreDraw() override + { + CallScript(CurrentMenu == this ? EVENT_DISPLAYMENU : EVENT_DISPLAYMENUREST, true); + } + + void PostDraw() override + { + CallScript(CurrentMenu == this ? EVENT_DISPLAYMENUREST : EVENT_DISPLAYINACTIVEMENUREST, false); + } + + void Drawer() override + { + auto v = origin; + Super::Drawer(); + origin = v; + } +}; + +class DukeNewGameCustomSubMenu : public DukeListMenu +{ + virtual void CallScript(int event, bool getorigin) override + { + // This needs to get the secondary ID to the script. + ud.returnvar[3] = mDesc->mSecondaryId; + DukeListMenu::CallScript(event, getorigin); + } +}; + +class MainMenu : public DukeListMenu +{ + void PreDraw() override + { + DukeListMenu::PreDraw(); + if ((G_GetLogoFlags() & LOGO_NOGAMETITLE) == 0) + { + rotatesprite_fs(origin.x + (MENU_MARGIN_CENTER<<16), origin.y + ((28)<<16), 65536L,0,INGAMEDUKETHREEDEE,0,0,10); + if (PLUTOPAK) // JBF 20030804 + rotatesprite_fs(origin.x + ((MENU_MARGIN_CENTER+100)<<16), origin.y + (36<<16), 65536L,0,PLUTOPAKSPRITE+2,(sintable[((int32_t) totalclock<<4)&2047]>>11),0,2+8); + } + else if (mDesc->mCaption.IsNotEmpty()) + { + Menu_DrawTopBar(origin); + Menu_DrawTopBarCaption(mDesc->mCaption, origin); + } + } +}; + + +END_DUKE_NS + +static TMenuClassDescriptor _mm("Duke.MainMenu"); +static TMenuClassDescriptor _lm("Duke.ListMenu"); +static TMenuClassDescriptor _ngcsm("Duke.NewGameCustomSubMenu"); + +void RegisterDukeMenus() +{ + menuClasses.Push(&_mm); + menuClasses.Push(&_lm); + menuClasses.Push(&_ngcsm); +} diff --git a/source/duke3d/src/game.h b/source/duke3d/src/game.h index cf89ab514..e71d6a899 100644 --- a/source/duke3d/src/game.h +++ b/source/duke3d/src/game.h @@ -118,32 +118,12 @@ void A_DeleteSprite(int spriteNum); static inline int32_t G_GetLogoFlags(void) { -#if !defined LUNATIC return Gv_GetVarByLabel("LOGO_FLAGS",255, -1, -1); -#else - extern int32_t g_logoFlags; - return g_logoFlags; -#endif } -#ifdef LUNATIC -typedef struct { - vec3_t pos; - int32_t dist, clock; - fix16_t q16horiz, q16ang; - int16_t sect; -} camera_t; - -extern camera_t g_camera; - -# define CAMERA(Membname) (g_camera.Membname) -# define CAMERADIST (g_camera.dist) -# define CAMERACLOCK (g_camera.clock) -#else # define CAMERA(Membname) (ud.camera ## Membname) # define CAMERADIST g_cameraDistance # define CAMERACLOCK g_cameraClock -#endif #endif @@ -155,9 +135,7 @@ extern camera_t g_camera; #define MAX_RETURN_VALUES 6 typedef struct { -#if !defined LUNATIC vec3_t camerapos; -#endif int32_t const_visibility,uw_framerate; int32_t camera_time,folfvel,folavel,folx,foly,fola; int32_t reccnt; @@ -188,10 +166,8 @@ typedef struct { uint32_t userbytever; -#if !defined LUNATIC fix16_t cameraq16ang, cameraq16horiz; int16_t camerasect; -#endif int16_t pause_on,from_bonus; int16_t camerasprite,last_camsprite; int16_t last_level,secretlevel; diff --git a/source/duke3d/src/menus.cpp b/source/duke3d/src/menus.cpp index 785b1b465..02e20a3f9 100644 --- a/source/duke3d/src/menus.cpp +++ b/source/duke3d/src/menus.cpp @@ -1603,16 +1603,13 @@ void Menu_Init(void) MEOS_NETOPTIONS_LEVEL[i].optionNames = MEOSN_NetLevels[i]; } M_EPISODE.numEntries = g_volumeCnt+2; -#ifndef EDUKE32_SIMPLE_MENU - MEL_EPISODE[g_volumeCnt] = &ME_Space4_Redfont; + + MEL_EPISODE[g_volumeCnt] = &ME_Space4_Redfont; MEL_EPISODE[g_volumeCnt+1] = &ME_EPISODE_USERMAP; MEOSN_NetEpisodes[k] = MenuUserMap; MEOSV_NetEpisodes[k] = MAXVOLUMES; -#else - M_EPISODE.numEntries = g_volumeCnt; - k--; -#endif - MEOS_NETOPTIONS_EPISODE.numOptions = k + 1; + + MEOS_NETOPTIONS_EPISODE.numOptions = k + 1; NetEpisode = MEOSV_NetEpisodes[0]; MMF_Top_Episode.pos.y = (58 + (3-k)*6)<<16; if (g_skillCnt == 0) diff --git a/source/glbackend/hw_draw2d.cpp b/source/glbackend/hw_draw2d.cpp index bdd0f08f7..460466ffe 100644 --- a/source/glbackend/hw_draw2d.cpp +++ b/source/glbackend/hw_draw2d.cpp @@ -129,6 +129,8 @@ void GLInstance::Draw2D(F2DDrawer *drawer) // This just gets forwarded to the original drawer. Long term this should not survive and all calls be refactored. UseColorOnly(false); SetFadeDisable(false); + SetVertexBuffer(nullptr, 0, 0); + SetIndexBuffer(nullptr); polymost_dorotatesprite(cmd.mVertIndex, cmd.mVertCount, cmd.mIndexIndex, cmd.mIndexCount, cmd.mSpecialColormap[0].d, cmd.mRemapIndex, cmd.mFlags, cmd.mSpecialColormap[1].d, cmd.mDesaturate, cmd.mColor1.d, cmd.mScissor[0], cmd.mScissor[1], cmd.mScissor[2], cmd.mScissor[3], 0); // Reset everything to the default. @@ -138,6 +140,8 @@ void GLInstance::Draw2D(F2DDrawer *drawer) EnableBlend(true); EnableAlphaTest(true); SetBlendFunc(STYLEALPHA_Src, STYLEALPHA_InvSrc); + SetVertexBuffer(vb.GetBufferObjects().first, 0, 0); + SetIndexBuffer(vb.GetBufferObjects().second); continue; } diff --git a/wadsrc/static/demolition/menudef.txt b/wadsrc/static/demolition/menudef.txt index 838c4a6fa..402209124 100644 --- a/wadsrc/static/demolition/menudef.txt +++ b/wadsrc/static/demolition/menudef.txt @@ -6,35 +6,56 @@ LISTMENU "MainMenu" { - linespacing 15 - TextItem "$MNU_NEWGAME", "n", "PlayerclassMenu" - TextItem "$MNU_LOADGAME", "l", "LoadGameMenu" - TextItem "$MNU_OPTIONS", "o", "OptionsMenu" - TextItem "$MNU_HELP", "h", "HelpMenu" - TextItem "$MNU_CREDITS", "c", "CreditsMenu" - TextItem "$MNU_QUITGAME", "q", "QuitMenu" -} - -LISTMENU "MainMenu_Blood" -{ - linespacing 15 - TextItem "$MNU_NEWGAME", "n", "PlayerclassMenu" - TextItem "$MNU_MULTIPLAYER", "m", "MultiMenu" - TextItem "$MNU_OPTIONS", "o", "OptionsMenu" - TextItem "$MNU_LOADGAME", "l", "LoadGameMenu" - TextItem "$MNU_HELP", "h", "HelpMenu" - TextItem "$MNU_CREDITS", "c", "CreditsMenu" - TextItem "$MNU_QUITGAME", "q", "QuitMenu" -} - -LISTMENU "MainMenu_SW" -{ - linespacing 15 - TextItem "$MNU_NEWGAME", "n", "PlayerclassMenu" - TextItem "$MNU_LOADGAME", "l", "LoadGameMenu" - TextItem "$MNU_SAVEGAME", "s", "SaveGameMenu" - TextItem "$MNU_OPTIONS", "o", "OptionsMenu" - TextItem "$MNU_COOLSTUFF", "h", "HelpMenu" - TextItem "$MNU_QUITGAME", "q", "QuitMenu" + ifgame(Duke, Nam, WW2GI, Fury) + { + linespacing 15 + class "Duke.MainMenu" + TextItem "$MNU_NEWGAME", "n", "PlayerclassMenu" + //TextItem "$MNU_MULTIPLAYER", "m", "MultiMenu" // In EDuke this replaces "New Game" when in networking mode. Kept here as a reminder (I'm not going to support EDuke's C/S implementation) + ifgame(fury) + { + TextItem "$MNU_CONTINUE", "l", "LoadGameMenu" + } + else + { + TextItem "$MNU_LOADGAME", "l", "LoadGameMenu" + } + TextItem "$MNU_OPTIONS", "o", "OptionsMenu" + TextItem "$MNU_HELP", "h", "HelpMenu" + TextItem "$MNU_CREDITS", "c", "CreditsMenu" + TextItem "$MNU_QUITGAME", "q", "QuitMenu" + } + ifgame(Redneck, RedneckRides) + { + linespacing 15 + TextItem "$MNU_NEWGAME", "n", "PlayerclassMenu" + //TextItem "$MNU_MULTIPLAYER", "m", "MultiMenu" // In EDuke this replaces "New Game" when in networking mode. Kept here as a reminder (I'm not going to support EDuke's C/S implementation) + TextItem "$MNU_LOADGAME", "l", "LoadGameMenu" + TextItem "$MNU_OPTIONS", "o", "OptionsMenu" + TextItem "$MNU_HELP", "h", "HelpMenu" + TextItem "$MNU_CREDITS", "c", "CreditsMenu" + TextItem "$MNU_QUITGAME", "q", "QuitMenu" + } + ifgame(Blood) + { + linespacing 15 + TextItem "$MNU_NEWGAME", "n", "PlayerclassMenu" + TextItem "$MNU_MULTIPLAYER", "m", "MultiMenu" + TextItem "$MNU_OPTIONS", "o", "OptionsMenu" + TextItem "$MNU_LOADGAME", "l", "LoadGameMenu" + TextItem "$MNU_HELP", "h", "HelpMenu" + TextItem "$MNU_CREDITS", "c", "CreditsMenu" + TextItem "$MNU_QUITGAME", "q", "QuitMenu" + } + ifgame(ShadowWarrior) + { + linespacing 15 + TextItem "$MNU_NEWGAME", "n", "PlayerclassMenu" + TextItem "$MNU_LOADGAME", "l", "LoadGameMenu" + TextItem "$MNU_SAVEGAME", "s", "SaveGameMenu" + TextItem "$MNU_OPTIONS", "o", "OptionsMenu" + TextItem "$MNU_COOLSTUFF", "h", "HelpMenu" + TextItem "$MNU_QUITGAME", "q", "QuitMenu" + } }