- made DMenu's static variables regular global variables because that class is going to go completely scripted soon.

This commit is contained in:
Christoph Oelckers 2017-02-18 19:19:14 +01:00
parent 1b4c9e13b8
commit 06141338f1
9 changed files with 74 additions and 74 deletions

View file

@ -207,7 +207,7 @@ DEFINE_ACTION_FUNCTION(_CVar, SetInt)
{ {
// Only menus are allowed to change CVARs. // Only menus are allowed to change CVARs.
PARAM_SELF_STRUCT_PROLOGUE(FBaseCVar); PARAM_SELF_STRUCT_PROLOGUE(FBaseCVar);
if (!(self->GetFlags() & CVAR_MOD) && DMenu::CurrentMenu == nullptr) return 0; if (!(self->GetFlags() & CVAR_MOD) && CurrentMenu == nullptr) return 0;
PARAM_INT(val); PARAM_INT(val);
UCVarValue v; UCVarValue v;
v.Int = val; v.Int = val;
@ -219,7 +219,7 @@ DEFINE_ACTION_FUNCTION(_CVar, SetFloat)
{ {
// Only menus are allowed to change CVARs. // Only menus are allowed to change CVARs.
PARAM_SELF_STRUCT_PROLOGUE(FBaseCVar); PARAM_SELF_STRUCT_PROLOGUE(FBaseCVar);
if (!(self->GetFlags() & CVAR_MOD) && DMenu::CurrentMenu == nullptr) return 0; if (!(self->GetFlags() & CVAR_MOD) && CurrentMenu == nullptr) return 0;
PARAM_FLOAT(val); PARAM_FLOAT(val);
UCVarValue v; UCVarValue v;
v.Float = (float)val; v.Float = (float)val;
@ -231,7 +231,7 @@ DEFINE_ACTION_FUNCTION(_CVar, SetString)
{ {
// Only menus are allowed to change CVARs. // Only menus are allowed to change CVARs.
PARAM_SELF_STRUCT_PROLOGUE(FBaseCVar); PARAM_SELF_STRUCT_PROLOGUE(FBaseCVar);
if (!(self->GetFlags() & CVAR_MOD) && DMenu::CurrentMenu == nullptr) return 0; if (!(self->GetFlags() & CVAR_MOD) && CurrentMenu == nullptr) return 0;
PARAM_STRING(val); PARAM_STRING(val);
UCVarValue v; UCVarValue v;
v.String = val.GetChars(); v.String = val.GetChars();

View file

@ -666,7 +666,7 @@ void C_DoCommand (const char *cmd, int keynum)
// This is only accessible to the special menu item to run CCMDs. // This is only accessible to the special menu item to run CCMDs.
DEFINE_ACTION_FUNCTION(DOptionMenuItemCommand, DoCommand) DEFINE_ACTION_FUNCTION(DOptionMenuItemCommand, DoCommand)
{ {
if (DMenu::CurrentMenu == nullptr) return 0; if (CurrentMenu == nullptr) return 0;
PARAM_PROLOGUE; PARAM_PROLOGUE;
PARAM_STRING(cmd); PARAM_STRING(cmd);
C_DoCommand(cmd); C_DoCommand(cmd);

View file

@ -189,9 +189,9 @@ void UpdateJoystickMenu(IJoystickConfig *selected)
//opt->CalcIndent(); //opt->CalcIndent();
// If the joystick config menu is open, close it if the device it's open for is gone. // If the joystick config menu is open, close it if the device it's open for is gone.
if (DMenu::CurrentMenu != nullptr && (DMenu::CurrentMenu->IsKindOf("JoystickConfigMenu"))) if (CurrentMenu != nullptr && (CurrentMenu->IsKindOf("JoystickConfigMenu")))
{ {
auto p = DMenu::CurrentMenu->PointerVar<IJoystickConfig>("mJoy"); auto p = CurrentMenu->PointerVar<IJoystickConfig>("mJoy");
if (p != nullptr) if (p != nullptr)
{ {
unsigned i; unsigned i;
@ -204,7 +204,7 @@ void UpdateJoystickMenu(IJoystickConfig *selected)
} }
if (i == Joysticks.Size()) if (i == Joysticks.Size())
{ {
DMenu::CurrentMenu->Close(); CurrentMenu->Close();
} }
} }
} }

View file

@ -69,18 +69,16 @@ CVAR (Float, snd_menuvolume, 0.6f, CVAR_ARCHIVE)
CVAR(Int, m_use_mouse, 2, CVAR_ARCHIVE|CVAR_GLOBALCONFIG) CVAR(Int, m_use_mouse, 2, CVAR_ARCHIVE|CVAR_GLOBALCONFIG)
CVAR(Int, m_show_backbutton, 0, CVAR_ARCHIVE|CVAR_GLOBALCONFIG) CVAR(Int, m_show_backbutton, 0, CVAR_ARCHIVE|CVAR_GLOBALCONFIG)
DMenu *DMenu::CurrentMenu;
DEFINE_ACTION_FUNCTION(DMenu, GetCurrentMenu) DEFINE_ACTION_FUNCTION(DMenu, GetCurrentMenu)
{ {
ACTION_RETURN_OBJECT(DMenu::CurrentMenu); ACTION_RETURN_OBJECT(CurrentMenu);
} }
int DMenu::MenuTime;
DEFINE_ACTION_FUNCTION(DMenu, MenuTime) DEFINE_ACTION_FUNCTION(DMenu, MenuTime)
{ {
ACTION_RETURN_INT(DMenu::MenuTime); ACTION_RETURN_INT(MenuTime);
} }
FGameStartup GameStartupInfo; FGameStartup GameStartupInfo;
@ -92,6 +90,8 @@ bool MenuButtonOrigin[NUM_MKEYS];
int BackbuttonTime; int BackbuttonTime;
float BackbuttonAlpha; float BackbuttonAlpha;
static bool MenuEnabled = true; static bool MenuEnabled = true;
DMenu *CurrentMenu;
int MenuTime;
void M_InitVideoModes(); void M_InitVideoModes();
extern PClass *DefaultListMenuClass; extern PClass *DefaultListMenuClass;
@ -140,7 +140,7 @@ void M_MarkMenus()
{ {
GC::Mark(pair->Value); GC::Mark(pair->Value);
} }
GC::Mark(DMenu::CurrentMenu); GC::Mark(CurrentMenu);
} }
//============================================================================ //============================================================================
// //
@ -237,7 +237,7 @@ bool DMenu::MenuEvent (int mkey, bool fromcontroller)
{ {
Close(); Close();
S_Sound (CHAN_VOICE | CHAN_UI, S_Sound (CHAN_VOICE | CHAN_UI,
DMenu::CurrentMenu != nullptr? "menu/backup" : "menu/clear", snd_menuvolume, ATTN_NONE); CurrentMenu != nullptr? "menu/backup" : "menu/clear", snd_menuvolume, ATTN_NONE);
return true; return true;
} }
} }
@ -272,13 +272,13 @@ bool DMenu::CallMenuEvent(int mkey, bool fromcontroller)
void DMenu::Close () void DMenu::Close ()
{ {
if (DMenu::CurrentMenu == nullptr) return; // double closing can happen in the save menu. if (CurrentMenu == nullptr) return; // double closing can happen in the save menu.
assert(DMenu::CurrentMenu == this); assert(CurrentMenu == this);
DMenu::CurrentMenu = mParentMenu; CurrentMenu = mParentMenu;
Destroy(); Destroy();
if (DMenu::CurrentMenu != nullptr) if (CurrentMenu != nullptr)
{ {
GC::WriteBarrier(DMenu::CurrentMenu); GC::WriteBarrier(CurrentMenu);
} }
else else
{ {
@ -401,7 +401,7 @@ void DMenu::CallTicker()
void DMenu::Drawer () void DMenu::Drawer ()
{ {
if (this == DMenu::CurrentMenu && BackbuttonAlpha > 0 && m_show_backbutton >= 0 && m_use_mouse) if (this == CurrentMenu && BackbuttonAlpha > 0 && m_show_backbutton >= 0 && m_use_mouse)
{ {
FTexture *tex = TexMan(gameinfo.mBackButton); FTexture *tex = TexMan(gameinfo.mBackButton);
int w = tex->GetScaledWidth() * CleanXfac; int w = tex->GetScaledWidth() * CleanXfac;
@ -471,7 +471,7 @@ bool DMenu::TranslateKeyboardEvents()
void M_StartControlPanel (bool makeSound) void M_StartControlPanel (bool makeSound)
{ {
// intro might call this repeatedly // intro might call this repeatedly
if (DMenu::CurrentMenu != nullptr) if (CurrentMenu != nullptr)
return; return;
ResetButtonStates (); ResetButtonStates ();
@ -503,9 +503,9 @@ void M_StartControlPanel (bool makeSound)
void M_ActivateMenu(DMenu *menu) void M_ActivateMenu(DMenu *menu)
{ {
if (menuactive == MENU_Off) menuactive = MENU_On; if (menuactive == MENU_Off) menuactive = MENU_On;
if (DMenu::CurrentMenu != nullptr) DMenu::CurrentMenu->ReleaseCapture(); if (CurrentMenu != nullptr) CurrentMenu->ReleaseCapture();
DMenu::CurrentMenu = menu; CurrentMenu = menu;
GC::WriteBarrier(DMenu::CurrentMenu); GC::WriteBarrier(CurrentMenu);
} }
DEFINE_ACTION_FUNCTION(DMenu, ActivateMenu) DEFINE_ACTION_FUNCTION(DMenu, ActivateMenu)
@ -617,7 +617,7 @@ void M_SetMenu(FName menu, int param)
DMenu *newmenu = (DMenu *)cls->CreateNew(); DMenu *newmenu = (DMenu *)cls->CreateNew();
IFVIRTUALPTRNAME(newmenu, "ListMenu", Init) IFVIRTUALPTRNAME(newmenu, "ListMenu", Init)
{ {
VMValue params[3] = { newmenu, DMenu::CurrentMenu, ld }; VMValue params[3] = { newmenu, CurrentMenu, ld };
GlobalVMStack.Call(func, params, 3, nullptr, 0); GlobalVMStack.Call(func, params, 3, nullptr, 0);
} }
M_ActivateMenu(newmenu); M_ActivateMenu(newmenu);
@ -633,7 +633,7 @@ void M_SetMenu(FName menu, int param)
DMenu *newmenu = (DMenu*)cls->CreateNew(); DMenu *newmenu = (DMenu*)cls->CreateNew();
IFVIRTUALPTRNAME(newmenu, "OptionMenu", Init) IFVIRTUALPTRNAME(newmenu, "OptionMenu", Init)
{ {
VMValue params[3] = { newmenu, DMenu::CurrentMenu, ld }; VMValue params[3] = { newmenu, CurrentMenu, ld };
GlobalVMStack.Call(func, params, 3, nullptr, 0); GlobalVMStack.Call(func, params, 3, nullptr, 0);
} }
M_ActivateMenu(newmenu); M_ActivateMenu(newmenu);
@ -648,7 +648,7 @@ void M_SetMenu(FName menu, int param)
if (menuclass->IsDescendantOf(RUNTIME_CLASS(DMenu))) if (menuclass->IsDescendantOf(RUNTIME_CLASS(DMenu)))
{ {
DMenu *newmenu = (DMenu*)menuclass->CreateNew(); DMenu *newmenu = (DMenu*)menuclass->CreateNew();
newmenu->mParentMenu = DMenu::CurrentMenu; newmenu->mParentMenu = CurrentMenu;
M_ActivateMenu(newmenu); M_ActivateMenu(newmenu);
return; return;
} }
@ -684,7 +684,7 @@ bool M_Responder (event_t *ev)
return false; return false;
} }
if (DMenu::CurrentMenu != nullptr && menuactive != MENU_Off) if (CurrentMenu != nullptr && menuactive != MENU_Off)
{ {
// There are a few input sources we are interested in: // There are a few input sources we are interested in:
// //
@ -719,9 +719,9 @@ bool M_Responder (event_t *ev)
} }
// pass everything else on to the current menu // pass everything else on to the current menu
return DMenu::CurrentMenu->CallResponder(ev); return CurrentMenu->CallResponder(ev);
} }
else if (DMenu::CurrentMenu->TranslateKeyboardEvents()) else if (CurrentMenu->TranslateKeyboardEvents())
{ {
ch = ev->data1; ch = ev->data1;
keyup = ev->subtype == EV_GUI_KeyUp; keyup = ev->subtype == EV_GUI_KeyUp;
@ -740,7 +740,7 @@ bool M_Responder (event_t *ev)
default: default:
if (!keyup) if (!keyup)
{ {
return DMenu::CurrentMenu->CallResponder(ev); return CurrentMenu->CallResponder(ev);
} }
break; break;
} }
@ -823,11 +823,11 @@ bool M_Responder (event_t *ev)
{ {
MenuButtonTickers[mkey] = KEY_REPEAT_DELAY; MenuButtonTickers[mkey] = KEY_REPEAT_DELAY;
} }
DMenu::CurrentMenu->CallMenuEvent(mkey, fromcontroller); CurrentMenu->CallMenuEvent(mkey, fromcontroller);
return true; return true;
} }
} }
return DMenu::CurrentMenu->CallResponder(ev) || !keyup; return CurrentMenu->CallResponder(ev) || !keyup;
} }
else if (MenuEnabled) else if (MenuEnabled)
{ {
@ -868,10 +868,10 @@ bool M_Responder (event_t *ev)
void M_Ticker (void) void M_Ticker (void)
{ {
DMenu::MenuTime++; MenuTime++;
if (DMenu::CurrentMenu != nullptr && menuactive != MENU_Off) if (CurrentMenu != nullptr && menuactive != MENU_Off)
{ {
DMenu::CurrentMenu->CallTicker(); CurrentMenu->CallTicker();
for (int i = 0; i < NUM_MKEYS; ++i) for (int i = 0; i < NUM_MKEYS; ++i)
{ {
@ -880,7 +880,7 @@ void M_Ticker (void)
if (MenuButtonTickers[i] > 0 && --MenuButtonTickers[i] <= 0) if (MenuButtonTickers[i] > 0 && --MenuButtonTickers[i] <= 0)
{ {
MenuButtonTickers[i] = KEY_REPEAT_RATE; MenuButtonTickers[i] = KEY_REPEAT_RATE;
DMenu::CurrentMenu->CallMenuEvent(i, MenuButtonOrigin[i]); CurrentMenu->CallMenuEvent(i, MenuButtonOrigin[i]);
} }
} }
} }
@ -920,14 +920,14 @@ void M_Drawer (void)
} }
if (DMenu::CurrentMenu != nullptr && menuactive != MENU_Off) if (CurrentMenu != nullptr && menuactive != MENU_Off)
{ {
if (DMenu::CurrentMenu->DimAllowed()) if (CurrentMenu->DimAllowed())
{ {
screen->Dim(fade); screen->Dim(fade);
V_SetBorderNeedRefresh(); V_SetBorderNeedRefresh();
} }
DMenu::CurrentMenu->CallDrawer(); CurrentMenu->CallDrawer();
} }
} }
@ -940,10 +940,10 @@ void M_Drawer (void)
void M_ClearMenus () void M_ClearMenus ()
{ {
M_DemoNoPlay = false; M_DemoNoPlay = false;
if (DMenu::CurrentMenu != nullptr) if (CurrentMenu != nullptr)
{ {
DMenu::CurrentMenu->Destroy(); CurrentMenu->Destroy();
DMenu::CurrentMenu = nullptr; CurrentMenu = nullptr;
} }
V_SetBorderNeedRefresh(); V_SetBorderNeedRefresh();
menuactive = MENU_Off; menuactive = MENU_Off;
@ -1181,11 +1181,11 @@ CCMD(reset2saved)
// This really should be in the script but we can't do scripted CCMDs yet. // This really should be in the script but we can't do scripted CCMDs yet.
CCMD(undocolorpic) CCMD(undocolorpic)
{ {
if (DMenu::CurrentMenu != NULL) if (CurrentMenu != NULL)
{ {
IFVIRTUALPTR(DMenu::CurrentMenu, DMenu, ResetColor) IFVIRTUALPTR(CurrentMenu, DMenu, ResetColor)
{ {
VMValue params[] = { (DObject*)DMenu::CurrentMenu }; VMValue params[] = { (DObject*)CurrentMenu };
GlobalVMStack.Call(func, params, countof(params), nullptr, 0, nullptr); GlobalVMStack.Call(func, params, countof(params), nullptr, 0, nullptr);
} }
} }

View file

@ -107,6 +107,9 @@ public:
}; };
extern FSavegameManager savegameManager; extern FSavegameManager savegameManager;
class DMenu;
extern DMenu *CurrentMenu;
extern int MenuTime;
//============================================================================= //=============================================================================
// //
@ -267,9 +270,6 @@ public:
BACKBUTTON_TIME = 4*TICRATE BACKBUTTON_TIME = 4*TICRATE
}; };
static DMenu *CurrentMenu;
static int MenuTime;
TObjPtr<DMenu> mParentMenu; TObjPtr<DMenu> mParentMenu;
DMenu(DMenu *parent = NULL); DMenu(DMenu *parent = NULL);

View file

@ -147,7 +147,7 @@ static void DeinitMenus()
} }
MenuDescriptors.Clear(); MenuDescriptors.Clear();
OptionValues.Clear(); OptionValues.Clear();
DMenu::CurrentMenu = nullptr; CurrentMenu = nullptr;
savegameManager.ClearSaveGames(); savegameManager.ClearSaveGames();
} }

View file

@ -139,7 +139,7 @@ void DMessageBoxMenu::OnDestroy()
void DMessageBoxMenu::CloseSound() void DMessageBoxMenu::CloseSound()
{ {
S_Sound (CHAN_VOICE | CHAN_UI, S_Sound (CHAN_VOICE | CHAN_UI,
DMenu::CurrentMenu != NULL? "menu/backup" : "menu/dismiss", snd_menuvolume, ATTN_NONE); CurrentMenu != NULL? "menu/backup" : "menu/dismiss", snd_menuvolume, ATTN_NONE);
} }
//============================================================================= //=============================================================================
@ -212,7 +212,7 @@ void DMessageBoxMenu::Drawer ()
if (messageSelection >= 0) if (messageSelection >= 0)
{ {
if ((DMenu::MenuTime%8) < 6) if ((MenuTime%8) < 6)
{ {
screen->DrawText(ConFont, OptionSettings.mFontColorSelection, screen->DrawText(ConFont, OptionSettings.mFontColorSelection,
(150 - 160) * CleanXfac + screen->GetWidth() / 2, (150 - 160) * CleanXfac + screen->GetWidth() / 2,
@ -431,7 +431,7 @@ CCMD (menu_quit)
{ // F10 { // F10
M_StartControlPanel (true); M_StartControlPanel (true);
DMenu *newmenu = new DQuitMenu(false); DMenu *newmenu = new DQuitMenu(false);
newmenu->mParentMenu = DMenu::CurrentMenu; newmenu->mParentMenu = CurrentMenu;
M_ActivateMenu(newmenu); M_ActivateMenu(newmenu);
} }
@ -511,7 +511,7 @@ CCMD (menu_endgame)
//M_StartControlPanel (true); //M_StartControlPanel (true);
S_Sound (CHAN_VOICE | CHAN_UI, "menu/activate", snd_menuvolume, ATTN_NONE); S_Sound (CHAN_VOICE | CHAN_UI, "menu/activate", snd_menuvolume, ATTN_NONE);
DMenu *newmenu = new DEndGameMenu(false); DMenu *newmenu = new DEndGameMenu(false);
newmenu->mParentMenu = DMenu::CurrentMenu; newmenu->mParentMenu = CurrentMenu;
M_ActivateMenu(newmenu); M_ActivateMenu(newmenu);
} }
@ -607,7 +607,7 @@ CCMD (quicksave)
S_Sound(CHAN_VOICE | CHAN_UI, "menu/activate", snd_menuvolume, ATTN_NONE); S_Sound(CHAN_VOICE | CHAN_UI, "menu/activate", snd_menuvolume, ATTN_NONE);
DMenu *newmenu = new DQuickSaveMenu(false); DMenu *newmenu = new DQuickSaveMenu(false);
newmenu->mParentMenu = DMenu::CurrentMenu; newmenu->mParentMenu = CurrentMenu;
M_ActivateMenu(newmenu); M_ActivateMenu(newmenu);
} }
@ -702,7 +702,7 @@ CCMD (quickload)
M_StartControlPanel(true); M_StartControlPanel(true);
DMenu *newmenu = new DQuickLoadMenu(false); DMenu *newmenu = new DQuickLoadMenu(false);
newmenu->mParentMenu = DMenu::CurrentMenu; newmenu->mParentMenu = CurrentMenu;
M_ActivateMenu(newmenu); M_ActivateMenu(newmenu);
} }
@ -714,13 +714,13 @@ CCMD (quickload)
void M_StartMessage(const char *message, int messagemode, FName action) void M_StartMessage(const char *message, int messagemode, FName action)
{ {
if (DMenu::CurrentMenu == NULL) if (CurrentMenu == NULL)
{ {
// only play a sound if no menu was active before // only play a sound if no menu was active before
M_StartControlPanel(menuactive == MENU_Off); M_StartControlPanel(menuactive == MENU_Off);
} }
DMenu *newmenu = new DMessageBoxMenu(DMenu::CurrentMenu, message, messagemode, false, action); DMenu *newmenu = new DMessageBoxMenu(CurrentMenu, message, messagemode, false, action);
newmenu->mParentMenu = DMenu::CurrentMenu; newmenu->mParentMenu = CurrentMenu;
M_ActivateMenu(newmenu); M_ActivateMenu(newmenu);
} }

View file

@ -66,7 +66,7 @@ DEFINE_ACTION_FUNCTION(DPlayerMenu, ColorChanged)
PARAM_INT(g); PARAM_INT(g);
PARAM_INT(b); PARAM_INT(b);
// only allow if the menu is active to prevent abuse. // only allow if the menu is active to prevent abuse.
if (self == DMenu::CurrentMenu) if (self == CurrentMenu)
{ {
char command[24]; char command[24];
players[consoleplayer].userinfo.ColorChanged(MAKERGB(r, g, b)); players[consoleplayer].userinfo.ColorChanged(MAKERGB(r, g, b));
@ -91,7 +91,7 @@ DEFINE_ACTION_FUNCTION(DPlayerMenu, PlayerNameChanged)
const char *pp = s; const char *pp = s;
FString command("name \""); FString command("name \"");
if (self == DMenu::CurrentMenu) if (self == CurrentMenu)
{ {
// Escape any backslashes or quotation marks before sending the name to the console. // Escape any backslashes or quotation marks before sending the name to the console.
for (auto p = pp; *p != '\0'; ++p) for (auto p = pp; *p != '\0'; ++p)
@ -118,7 +118,7 @@ DEFINE_ACTION_FUNCTION(DPlayerMenu, ColorSetChanged)
{ {
PARAM_SELF_PROLOGUE(DMenu); PARAM_SELF_PROLOGUE(DMenu);
PARAM_INT(sel); PARAM_INT(sel);
if (self == DMenu::CurrentMenu) if (self == CurrentMenu)
{ {
players[consoleplayer].userinfo.ColorSetChanged(sel); players[consoleplayer].userinfo.ColorSetChanged(sel);
char command[24]; char command[24];
@ -139,7 +139,7 @@ DEFINE_ACTION_FUNCTION(DPlayerMenu, ClassChanged)
PARAM_SELF_PROLOGUE(DMenu); PARAM_SELF_PROLOGUE(DMenu);
PARAM_INT(sel); PARAM_INT(sel);
PARAM_POINTER(cls, FPlayerClass); PARAM_POINTER(cls, FPlayerClass);
if (self == DMenu::CurrentMenu) if (self == CurrentMenu)
{ {
players[consoleplayer].userinfo.PlayerClassNumChanged(gameinfo.norandomplayerclass ? sel : sel - 1); players[consoleplayer].userinfo.PlayerClassNumChanged(gameinfo.norandomplayerclass ? sel : sel - 1);
cvar_set("playerclass", sel == 0 && !gameinfo.norandomplayerclass ? "Random" : GetPrintableDisplayName(cls->Type).GetChars()); cvar_set("playerclass", sel == 0 && !gameinfo.norandomplayerclass ? "Random" : GetPrintableDisplayName(cls->Type).GetChars());
@ -158,7 +158,7 @@ DEFINE_ACTION_FUNCTION(DPlayerMenu, SkinChanged)
{ {
PARAM_SELF_PROLOGUE(DMenu); PARAM_SELF_PROLOGUE(DMenu);
PARAM_INT(sel); PARAM_INT(sel);
if (self == DMenu::CurrentMenu) if (self == CurrentMenu)
{ {
players[consoleplayer].userinfo.SkinNumChanged(sel); players[consoleplayer].userinfo.SkinNumChanged(sel);
cvar_set("skin", Skins[sel].Name); cvar_set("skin", Skins[sel].Name);
@ -177,7 +177,7 @@ DEFINE_ACTION_FUNCTION(DPlayerMenu, AutoaimChanged)
PARAM_SELF_PROLOGUE(DMenu); PARAM_SELF_PROLOGUE(DMenu);
PARAM_FLOAT(val); PARAM_FLOAT(val);
// only allow if the menu is active to prevent abuse. // only allow if the menu is active to prevent abuse.
if (self == DMenu::CurrentMenu) if (self == CurrentMenu)
{ {
autoaim = float(val); autoaim = float(val);
} }
@ -195,7 +195,7 @@ DEFINE_ACTION_FUNCTION(DPlayerMenu, TeamChanged)
PARAM_SELF_PROLOGUE(DMenu); PARAM_SELF_PROLOGUE(DMenu);
PARAM_INT(val); PARAM_INT(val);
// only allow if the menu is active to prevent abuse. // only allow if the menu is active to prevent abuse.
if (self == DMenu::CurrentMenu) if (self == CurrentMenu)
{ {
team = val == 0 ? TEAM_NONE : val - 1; team = val == 0 ? TEAM_NONE : val - 1;
} }
@ -213,7 +213,7 @@ DEFINE_ACTION_FUNCTION(DPlayerMenu, GenderChanged)
PARAM_SELF_PROLOGUE(DMenu); PARAM_SELF_PROLOGUE(DMenu);
PARAM_INT(v); PARAM_INT(v);
// only allow if the menu is active to prevent abuse. // only allow if the menu is active to prevent abuse.
if (self == DMenu::CurrentMenu) if (self == CurrentMenu)
{ {
cvar_set("gender", v == 0 ? "male" : v == 1 ? "female" : "other"); cvar_set("gender", v == 0 ? "male" : v == 1 ? "female" : "other");
} }
@ -231,7 +231,7 @@ DEFINE_ACTION_FUNCTION(DPlayerMenu, SwitchOnPickupChanged)
PARAM_SELF_PROLOGUE(DMenu); PARAM_SELF_PROLOGUE(DMenu);
PARAM_INT(v); PARAM_INT(v);
// only allow if the menu is active to prevent abuse. // only allow if the menu is active to prevent abuse.
if (self == DMenu::CurrentMenu) if (self == CurrentMenu)
{ {
neverswitchonpickup = !!v; neverswitchonpickup = !!v;
} }
@ -249,7 +249,7 @@ DEFINE_ACTION_FUNCTION(DPlayerMenu, AlwaysRunChanged)
PARAM_SELF_PROLOGUE(DMenu); PARAM_SELF_PROLOGUE(DMenu);
PARAM_INT(v); PARAM_INT(v);
// only allow if the menu is active to prevent abuse. // only allow if the menu is active to prevent abuse.
if (self == DMenu::CurrentMenu) if (self == CurrentMenu)
{ {
cl_run = !!v; cl_run = !!v;
} }

View file

@ -1097,7 +1097,7 @@ public:
if (response == mSelection+1) if (response == mSelection+1)
{ {
int color = ((DMenu::MenuTime%8) < 4) || DMenu::CurrentMenu != this ? CR_RED:CR_GREY; int color = ((MenuTime%8) < 4) || CurrentMenu != this ? CR_RED:CR_GREY;
x = (50 + 3 - 160) * CleanXfac + screen->GetWidth() / 2; x = (50 + 3 - 160) * CleanXfac + screen->GetWidth() / 2;
int yy = (y + fontheight/2 - 5 - 100) * CleanYfac + screen->GetHeight() / 2; int yy = (y + fontheight/2 - 5 - 100) * CleanYfac + screen->GetHeight() / 2;
@ -1135,9 +1135,9 @@ void P_FreeStrifeConversations ()
ClassRoots.Clear(); ClassRoots.Clear();
PrevNode = NULL; PrevNode = NULL;
if (DMenu::CurrentMenu != NULL && DMenu::CurrentMenu->IsKindOf(RUNTIME_CLASS(DConversationMenu))) if (CurrentMenu != NULL && CurrentMenu->IsKindOf(RUNTIME_CLASS(DConversationMenu)))
{ {
DMenu::CurrentMenu->Close(); CurrentMenu->Close();
} }
} }
@ -1482,10 +1482,10 @@ void P_ConversationCommand (int netcode, int pnum, BYTE **stream)
// The conversation menus are normally closed by the menu code, but that // The conversation menus are normally closed by the menu code, but that
// doesn't happen during demo playback, so we need to do it here. // doesn't happen during demo playback, so we need to do it here.
if (demoplayback && DMenu::CurrentMenu != NULL && if (demoplayback && CurrentMenu != NULL &&
DMenu::CurrentMenu->IsKindOf(RUNTIME_CLASS(DConversationMenu))) CurrentMenu->IsKindOf(RUNTIME_CLASS(DConversationMenu)))
{ {
DMenu::CurrentMenu->Close(); CurrentMenu->Close();
} }
if (netcode == DEM_CONVREPLY) if (netcode == DEM_CONVREPLY)
{ {