mirror of
https://github.com/ZDoom/gzdoom.git
synced 2025-02-22 12:01:13 +00:00
- moved base menu code to "common".
This commit is contained in:
parent
90befff479
commit
475f740058
12 changed files with 100 additions and 82 deletions
|
@ -955,14 +955,9 @@ set (PCH_SOURCES
|
||||||
maploader/compatibility.cpp
|
maploader/compatibility.cpp
|
||||||
maploader/postprocessor.cpp
|
maploader/postprocessor.cpp
|
||||||
menu/doommenu.cpp
|
menu/doommenu.cpp
|
||||||
menu/joystickmenu.cpp
|
|
||||||
menu/loadsavemenu.cpp
|
menu/loadsavemenu.cpp
|
||||||
menu/menu.cpp
|
|
||||||
menu/menudef.cpp
|
menu/menudef.cpp
|
||||||
menu/messagebox.cpp
|
|
||||||
menu/optionmenu.cpp
|
|
||||||
menu/playermenu.cpp
|
menu/playermenu.cpp
|
||||||
menu/resolutionmenu.cpp
|
|
||||||
gamedata/textures/animations.cpp
|
gamedata/textures/animations.cpp
|
||||||
gamedata/textures/anim_switches.cpp
|
gamedata/textures/anim_switches.cpp
|
||||||
gamedata/textures/buildloader.cpp
|
gamedata/textures/buildloader.cpp
|
||||||
|
@ -1120,6 +1115,12 @@ set (PCH_SOURCES
|
||||||
common/objects/dobject.cpp
|
common/objects/dobject.cpp
|
||||||
common/objects/dobjgc.cpp
|
common/objects/dobjgc.cpp
|
||||||
common/objects/dobjtype.cpp
|
common/objects/dobjtype.cpp
|
||||||
|
common/menu/joystickmenu.cpp
|
||||||
|
common/menu/menu.cpp
|
||||||
|
common/menu/messagebox.cpp
|
||||||
|
common/menu/optionmenu.cpp
|
||||||
|
common/menu/resolutionmenu.cpp
|
||||||
|
|
||||||
common/rendering/v_framebuffer.cpp
|
common/rendering/v_framebuffer.cpp
|
||||||
common/rendering/v_video.cpp
|
common/rendering/v_video.cpp
|
||||||
common/rendering/r_thread.cpp
|
common/rendering/r_thread.cpp
|
||||||
|
|
|
@ -32,7 +32,7 @@
|
||||||
**
|
**
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "menu/menu.h"
|
#include "menu.h"
|
||||||
#include "m_joy.h"
|
#include "m_joy.h"
|
||||||
#include "vm.h"
|
#include "vm.h"
|
||||||
|
|
|
@ -51,6 +51,9 @@
|
||||||
#include "vm.h"
|
#include "vm.h"
|
||||||
#include "gamestate.h"
|
#include "gamestate.h"
|
||||||
#include "i_interface.h"
|
#include "i_interface.h"
|
||||||
|
#include "menustate.h"
|
||||||
|
#include "i_time.h"
|
||||||
|
#include "printf.h"
|
||||||
|
|
||||||
void M_StartControlPanel(bool makeSound, bool scaleoverride = false);
|
void M_StartControlPanel(bool makeSound, bool scaleoverride = false);
|
||||||
|
|
||||||
|
@ -101,7 +104,7 @@ extern PClass *DefaultListMenuClass;
|
||||||
extern PClass *DefaultOptionMenuClass;
|
extern PClass *DefaultOptionMenuClass;
|
||||||
|
|
||||||
|
|
||||||
#define KEY_REPEAT_DELAY (TICRATE*5/12)
|
#define KEY_REPEAT_DELAY (GameTicRate*5/12)
|
||||||
#define KEY_REPEAT_RATE (3)
|
#define KEY_REPEAT_RATE (3)
|
||||||
|
|
||||||
bool OkForLocalization(FTextureID texnum, const char* substitute);
|
bool OkForLocalization(FTextureID texnum, const char* substitute);
|
||||||
|
@ -394,11 +397,6 @@ void M_SetMenu(FName menu, int param)
|
||||||
DMenuDescriptor **desc = MenuDescriptors.CheckKey(menu);
|
DMenuDescriptor **desc = MenuDescriptors.CheckKey(menu);
|
||||||
if (desc != nullptr)
|
if (desc != nullptr)
|
||||||
{
|
{
|
||||||
if ((*desc)->mNetgameMessage.IsNotEmpty() && netgame && !demoplayback)
|
|
||||||
{
|
|
||||||
M_StartMessage((*desc)->mNetgameMessage, 1);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ((*desc)->IsKindOf(RUNTIME_CLASS(DListMenuDescriptor)))
|
if ((*desc)->IsKindOf(RUNTIME_CLASS(DListMenuDescriptor)))
|
||||||
{
|
{
|
||||||
|
@ -711,8 +709,6 @@ void M_Ticker (void)
|
||||||
|
|
||||||
void M_Drawer (void)
|
void M_Drawer (void)
|
||||||
{
|
{
|
||||||
player_t *player = &players[consoleplayer];
|
|
||||||
AActor *camera = player->camera;
|
|
||||||
PalEntry fade = 0;
|
PalEntry fade = 0;
|
||||||
|
|
||||||
if (CurrentMenu != nullptr && menuactive != MENU_Off)
|
if (CurrentMenu != nullptr && menuactive != MENU_Off)
|
|
@ -5,7 +5,6 @@
|
||||||
|
|
||||||
|
|
||||||
#include "dobject.h"
|
#include "dobject.h"
|
||||||
#include "d_player.h"
|
|
||||||
#include "c_cvars.h"
|
#include "c_cvars.h"
|
||||||
#include "v_font.h"
|
#include "v_font.h"
|
||||||
#include "textures.h"
|
#include "textures.h"
|
||||||
|
@ -18,7 +17,6 @@ struct event_t;
|
||||||
class FTexture;
|
class FTexture;
|
||||||
class FFont;
|
class FFont;
|
||||||
enum EColorRange : int;
|
enum EColorRange : int;
|
||||||
class FPlayerClass;
|
|
||||||
class FKeyBindings;
|
class FKeyBindings;
|
||||||
struct FBrokenLines;
|
struct FBrokenLines;
|
||||||
|
|
||||||
|
@ -45,64 +43,6 @@ enum EMenuKey
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
struct FNewGameStartup
|
|
||||||
{
|
|
||||||
const char *PlayerClass;
|
|
||||||
int Episode;
|
|
||||||
int Skill;
|
|
||||||
};
|
|
||||||
|
|
||||||
extern FNewGameStartup NewGameStartupInfo;
|
|
||||||
|
|
||||||
struct FSaveGameNode
|
|
||||||
{
|
|
||||||
FString SaveTitle;
|
|
||||||
FString Filename;
|
|
||||||
bool bOldVersion = false;
|
|
||||||
bool bMissingWads = false;
|
|
||||||
bool bNoDelete = false;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct FSavegameManager
|
|
||||||
{
|
|
||||||
private:
|
|
||||||
TArray<FSaveGameNode*> SaveGames;
|
|
||||||
FSaveGameNode NewSaveNode;
|
|
||||||
int LastSaved = -1;
|
|
||||||
int LastAccessed = -1;
|
|
||||||
FGameTexture *SavePic = nullptr;
|
|
||||||
|
|
||||||
public:
|
|
||||||
int WindowSize = 0;
|
|
||||||
FString SaveCommentString;
|
|
||||||
FSaveGameNode *quickSaveSlot = nullptr;
|
|
||||||
~FSavegameManager();
|
|
||||||
|
|
||||||
private:
|
|
||||||
int InsertSaveNode(FSaveGameNode *node);
|
|
||||||
public:
|
|
||||||
void NotifyNewSave(const FString &file, const FString &title, bool okForQuicksave, bool forceQuicksave);
|
|
||||||
void ClearSaveGames();
|
|
||||||
|
|
||||||
void ReadSaveStrings();
|
|
||||||
void UnloadSaveData();
|
|
||||||
|
|
||||||
int RemoveSaveSlot(int index);
|
|
||||||
void LoadSavegame(int Selected);
|
|
||||||
void DoSave(int Selected, const char *savegamestring);
|
|
||||||
unsigned ExtractSaveData(int index);
|
|
||||||
void ClearSaveStuff();
|
|
||||||
bool DrawSavePic(int x, int y, int w, int h);
|
|
||||||
void DrawSaveComment(FFont *font, int cr, int x, int y, int scalefactor);
|
|
||||||
void SetFileInfo(int Selected);
|
|
||||||
unsigned SavegameCount();
|
|
||||||
FSaveGameNode *GetSavegame(int i);
|
|
||||||
void InsertNewSaveNode();
|
|
||||||
bool RemoveNewSaveNode();
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
extern FSavegameManager savegameManager;
|
|
||||||
class DMenu;
|
class DMenu;
|
||||||
extern DMenu *CurrentMenu;
|
extern DMenu *CurrentMenu;
|
||||||
extern int MenuTime;
|
extern int MenuTime;
|
||||||
|
@ -343,8 +283,6 @@ void M_ActivateMenu(DMenu *menu);
|
||||||
void M_ClearMenus ();
|
void M_ClearMenus ();
|
||||||
void M_PreviousMenu ();
|
void M_PreviousMenu ();
|
||||||
void M_ParseMenuDefs();
|
void M_ParseMenuDefs();
|
||||||
void M_StartupEpisodeMenu(FNewGameStartup *gs);
|
|
||||||
void M_StartupSkillMenu(FNewGameStartup *gs);
|
|
||||||
void M_DoStartControlPanel(bool scaleoverride);
|
void M_DoStartControlPanel(bool scaleoverride);
|
||||||
void M_SetMenu(FName menu, int param = -1);
|
void M_SetMenu(FName menu, int param = -1);
|
||||||
void M_StartMessage(const char *message, int messagemode, FName action = NAME_None);
|
void M_StartMessage(const char *message, int messagemode, FName action = NAME_None);
|
|
@ -38,6 +38,7 @@
|
||||||
#include "i_video.h"
|
#include "i_video.h"
|
||||||
#include "c_dispatch.h"
|
#include "c_dispatch.h"
|
||||||
#include "vm.h"
|
#include "vm.h"
|
||||||
|
#include "menustate.h"
|
||||||
|
|
||||||
void M_StartControlPanel(bool makeSound, bool scaleoverride = false);
|
void M_StartControlPanel(bool makeSound, bool scaleoverride = false);
|
||||||
FName MessageBoxClass = NAME_MessageBoxMenu;
|
FName MessageBoxClass = NAME_MessageBoxMenu;
|
|
@ -33,7 +33,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "v_video.h"
|
#include "v_video.h"
|
||||||
#include "menu/menu.h"
|
#include "menu.h"
|
||||||
#include "vm.h"
|
#include "vm.h"
|
||||||
|
|
||||||
|
|
|
@ -37,7 +37,8 @@
|
||||||
#include "c_dispatch.h"
|
#include "c_dispatch.h"
|
||||||
#include "c_cvars.h"
|
#include "c_cvars.h"
|
||||||
#include "v_video.h"
|
#include "v_video.h"
|
||||||
#include "menu/menu.h"
|
#include "menu.h"
|
||||||
|
#include "printf.h"
|
||||||
|
|
||||||
CVAR(Int, menu_resolution_custom_width, 640, 0)
|
CVAR(Int, menu_resolution_custom_width, 640, 0)
|
||||||
CVAR(Int, menu_resolution_custom_height, 480, 0)
|
CVAR(Int, menu_resolution_custom_height, 480, 0)
|
|
@ -42,7 +42,9 @@
|
||||||
#include "d_eventbase.h"
|
#include "d_eventbase.h"
|
||||||
#include "d_gui.h"
|
#include "d_gui.h"
|
||||||
#include "hardware.h"
|
#include "hardware.h"
|
||||||
#include "menu/menu.h"
|
#include "menu.h"
|
||||||
|
#include "menustate.h"
|
||||||
|
#include "keydef.h"
|
||||||
#include "i_interface.h"
|
#include "i_interface.h"
|
||||||
|
|
||||||
// MACROS ------------------------------------------------------------------
|
// MACROS ------------------------------------------------------------------
|
||||||
|
|
|
@ -34,12 +34,15 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
#include "menu/menu.h"
|
#include "menu.h"
|
||||||
#include "gi.h"
|
#include "gi.h"
|
||||||
#include "c_bind.h"
|
#include "c_bind.h"
|
||||||
#include "c_dispatch.h"
|
#include "c_dispatch.h"
|
||||||
#include "gameconfigfile.h"
|
#include "gameconfigfile.h"
|
||||||
#include "filesystem.h"
|
#include "filesystem.h"
|
||||||
|
#include "gi.h"
|
||||||
|
#include "d_player.h"
|
||||||
|
#include "c_dispatch.h"
|
||||||
|
|
||||||
TArray<FKeySection> KeySections;
|
TArray<FKeySection> KeySections;
|
||||||
extern TArray<FString> KeyConfWeapons;
|
extern TArray<FString> KeyConfWeapons;
|
||||||
|
|
|
@ -62,6 +62,7 @@
|
||||||
#include "doommenu.h"
|
#include "doommenu.h"
|
||||||
#include "r_utility.h"
|
#include "r_utility.h"
|
||||||
#include "gameconfigfile.h"
|
#include "gameconfigfile.h"
|
||||||
|
#include "d_player.h"
|
||||||
|
|
||||||
EXTERN_CVAR(Int, cl_gfxlocalization)
|
EXTERN_CVAR(Int, cl_gfxlocalization)
|
||||||
EXTERN_CVAR(Bool, m_quickexit)
|
EXTERN_CVAR(Bool, m_quickexit)
|
||||||
|
@ -191,6 +192,17 @@ bool M_SetSpecialMenu(FName menu, int param)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
DMenuDescriptor** desc = MenuDescriptors.CheckKey(menu);
|
||||||
|
if (desc != nullptr)
|
||||||
|
{
|
||||||
|
if ((*desc)->mNetgameMessage.IsNotEmpty() && netgame && !demoplayback)
|
||||||
|
{
|
||||||
|
M_StartMessage((*desc)->mNetgameMessage, 1);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// End of special checks
|
// End of special checks
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,3 +2,66 @@
|
||||||
#include "menu.h"
|
#include "menu.h"
|
||||||
|
|
||||||
void M_StartControlPanel (bool makeSound, bool scaleoverride = false);
|
void M_StartControlPanel (bool makeSound, bool scaleoverride = false);
|
||||||
|
|
||||||
|
|
||||||
|
struct FNewGameStartup
|
||||||
|
{
|
||||||
|
const char *PlayerClass;
|
||||||
|
int Episode;
|
||||||
|
int Skill;
|
||||||
|
};
|
||||||
|
|
||||||
|
extern FNewGameStartup NewGameStartupInfo;
|
||||||
|
void M_StartupEpisodeMenu(FNewGameStartup *gs);
|
||||||
|
void M_StartupSkillMenu(FNewGameStartup *gs);
|
||||||
|
|
||||||
|
// The savegame manager contains too much code that is game specific. Parts are shareable but need more work first.
|
||||||
|
struct FSaveGameNode
|
||||||
|
{
|
||||||
|
FString SaveTitle;
|
||||||
|
FString Filename;
|
||||||
|
bool bOldVersion = false;
|
||||||
|
bool bMissingWads = false;
|
||||||
|
bool bNoDelete = false;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct FSavegameManager
|
||||||
|
{
|
||||||
|
private:
|
||||||
|
TArray<FSaveGameNode*> SaveGames;
|
||||||
|
FSaveGameNode NewSaveNode;
|
||||||
|
int LastSaved = -1;
|
||||||
|
int LastAccessed = -1;
|
||||||
|
FGameTexture *SavePic = nullptr;
|
||||||
|
|
||||||
|
public:
|
||||||
|
int WindowSize = 0;
|
||||||
|
FString SaveCommentString;
|
||||||
|
FSaveGameNode *quickSaveSlot = nullptr;
|
||||||
|
~FSavegameManager();
|
||||||
|
|
||||||
|
private:
|
||||||
|
int InsertSaveNode(FSaveGameNode *node);
|
||||||
|
public:
|
||||||
|
void NotifyNewSave(const FString &file, const FString &title, bool okForQuicksave, bool forceQuicksave);
|
||||||
|
void ClearSaveGames();
|
||||||
|
|
||||||
|
void ReadSaveStrings();
|
||||||
|
void UnloadSaveData();
|
||||||
|
|
||||||
|
int RemoveSaveSlot(int index);
|
||||||
|
void LoadSavegame(int Selected);
|
||||||
|
void DoSave(int Selected, const char *savegamestring);
|
||||||
|
unsigned ExtractSaveData(int index);
|
||||||
|
void ClearSaveStuff();
|
||||||
|
bool DrawSavePic(int x, int y, int w, int h);
|
||||||
|
void DrawSaveComment(FFont *font, int cr, int x, int y, int scalefactor);
|
||||||
|
void SetFileInfo(int Selected);
|
||||||
|
unsigned SavegameCount();
|
||||||
|
FSaveGameNode *GetSavegame(int i);
|
||||||
|
void InsertNewSaveNode();
|
||||||
|
bool RemoveNewSaveNode();
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
extern FSavegameManager savegameManager;
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
/*
|
/*
|
||||||
** playermenu.cpp
|
** playermenu.cpp
|
||||||
** The player setup menu
|
** The player setup menu's setters. These are native for security purposes.
|
||||||
**
|
**
|
||||||
**---------------------------------------------------------------------------
|
**---------------------------------------------------------------------------
|
||||||
** Copyright 2001-2010 Randy Heit
|
** Copyright 2001-2010 Randy Heit
|
||||||
|
@ -33,12 +33,13 @@
|
||||||
**
|
**
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "menu/menu.h"
|
#include "menu.h"
|
||||||
#include "gi.h"
|
#include "gi.h"
|
||||||
#include "c_dispatch.h"
|
#include "c_dispatch.h"
|
||||||
#include "teaminfo.h"
|
#include "teaminfo.h"
|
||||||
#include "r_state.h"
|
#include "r_state.h"
|
||||||
#include "vm.h"
|
#include "vm.h"
|
||||||
|
#include "d_player.h"
|
||||||
|
|
||||||
EXTERN_CVAR(Int, team)
|
EXTERN_CVAR(Int, team)
|
||||||
EXTERN_CVAR(Float, autoaim)
|
EXTERN_CVAR(Float, autoaim)
|
||||||
|
|
Loading…
Reference in a new issue