- moved the menu code back to the game side.

This isn't really shareable. Although major parts may be identical, the specifics are not.
This commit is contained in:
Christoph Oelckers 2020-06-14 18:04:47 +02:00
commit 97d515005b
8 changed files with 6 additions and 6 deletions

198
src/menu/joystickmenu.cpp Normal file
View file

@ -0,0 +1,198 @@
/*
** joystickmenu.cpp
** The joystick configuration menus
**
**---------------------------------------------------------------------------
** Copyright 2010 Christoph Oelckers
** All rights reserved.
**
** Redistribution and use in source and binary forms, with or without
** modification, are permitted provided that the following conditions
** are met:
**
** 1. Redistributions of source code must retain the above copyright
** notice, this list of conditions and the following disclaimer.
** 2. Redistributions in binary form must reproduce the above copyright
** notice, this list of conditions and the following disclaimer in the
** documentation and/or other materials provided with the distribution.
** 3. The name of the author may not be used to endorse or promote products
** derived from this software without specific prior written permission.
**
** THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
** IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
** OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
** IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
** INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
** NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
** THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
**---------------------------------------------------------------------------
**
*/
#include "menu.h"
#include "m_joy.h"
#include "vm.h"
static TArray<IJoystickConfig *> Joysticks;
DEFINE_ACTION_FUNCTION(IJoystickConfig, GetSensitivity)
{
PARAM_SELF_STRUCT_PROLOGUE(IJoystickConfig);
ACTION_RETURN_FLOAT(self->GetSensitivity());
}
DEFINE_ACTION_FUNCTION(IJoystickConfig, SetSensitivity)
{
PARAM_SELF_STRUCT_PROLOGUE(IJoystickConfig);
PARAM_FLOAT(sens);
self->SetSensitivity((float)sens);
return 0;
}
DEFINE_ACTION_FUNCTION(IJoystickConfig, GetAxisScale)
{
PARAM_SELF_STRUCT_PROLOGUE(IJoystickConfig);
PARAM_INT(axis);
ACTION_RETURN_FLOAT(self->GetAxisScale(axis));
}
DEFINE_ACTION_FUNCTION(IJoystickConfig, SetAxisScale)
{
PARAM_SELF_STRUCT_PROLOGUE(IJoystickConfig);
PARAM_INT(axis);
PARAM_FLOAT(sens);
self->SetAxisScale(axis, (float)sens);
return 0;
}
DEFINE_ACTION_FUNCTION(IJoystickConfig, GetAxisDeadZone)
{
PARAM_SELF_STRUCT_PROLOGUE(IJoystickConfig);
PARAM_INT(axis);
ACTION_RETURN_FLOAT(self->GetAxisDeadZone(axis));
}
DEFINE_ACTION_FUNCTION(IJoystickConfig, SetAxisDeadZone)
{
PARAM_SELF_STRUCT_PROLOGUE(IJoystickConfig);
PARAM_INT(axis);
PARAM_FLOAT(dz);
self->SetAxisDeadZone(axis, (float)dz);
return 0;
}
DEFINE_ACTION_FUNCTION(IJoystickConfig, GetAxisMap)
{
PARAM_SELF_STRUCT_PROLOGUE(IJoystickConfig);
PARAM_INT(axis);
ACTION_RETURN_INT(self->GetAxisMap(axis));
}
DEFINE_ACTION_FUNCTION(IJoystickConfig, SetAxisMap)
{
PARAM_SELF_STRUCT_PROLOGUE(IJoystickConfig);
PARAM_INT(axis);
PARAM_INT(map);
self->SetAxisMap(axis, (EJoyAxis)map);
return 0;
}
DEFINE_ACTION_FUNCTION(IJoystickConfig, GetName)
{
PARAM_SELF_STRUCT_PROLOGUE(IJoystickConfig);
ACTION_RETURN_STRING(self->GetName());
}
DEFINE_ACTION_FUNCTION(IJoystickConfig, GetAxisName)
{
PARAM_SELF_STRUCT_PROLOGUE(IJoystickConfig);
PARAM_INT(axis);
ACTION_RETURN_STRING(self->GetAxisName(axis));
}
DEFINE_ACTION_FUNCTION(IJoystickConfig, GetNumAxes)
{
PARAM_SELF_STRUCT_PROLOGUE(IJoystickConfig);
ACTION_RETURN_INT(self->GetNumAxes());
}
void UpdateJoystickMenu(IJoystickConfig *selected)
{
DMenuDescriptor **desc = MenuDescriptors.CheckKey(NAME_JoystickOptions);
DMenuDescriptor **ddesc = MenuDescriptors.CheckKey("JoystickOptionsDefaults");
if (ddesc == nullptr) return; // without any data the menu cannot be set up and must remain empty.
if (desc != NULL && (*desc)->IsKindOf(RUNTIME_CLASS(DOptionMenuDescriptor)))
{
DOptionMenuDescriptor *opt = (DOptionMenuDescriptor *)*desc;
DOptionMenuDescriptor *dopt = (DOptionMenuDescriptor *)*ddesc;
if (dopt == nullptr) return;
DMenuItemBase *it;
int i;
int itemnum = -1;
I_GetJoysticks(Joysticks);
if ((unsigned)itemnum >= Joysticks.Size())
{
itemnum = Joysticks.Size() - 1;
}
if (selected != NULL)
{
for (i = 0; (unsigned)i < Joysticks.Size(); ++i)
{
if (Joysticks[i] == selected)
{
itemnum = i;
break;
}
}
}
opt->mItems = dopt->mItems;
it = opt->GetItem("ConfigureMessage");
if (it != nullptr) it->SetValue(0, !!Joysticks.Size());
it = opt->GetItem("ConnectMessage1");
if (it != nullptr) it->SetValue(0, !use_joystick);
it = opt->GetItem("ConnectMessage2");
if (it != nullptr) it->SetValue(0, !use_joystick);
for (int i = 0; i < (int)Joysticks.Size(); ++i)
{
it = CreateOptionMenuItemJoyConfigMenu(Joysticks[i]->GetName(), Joysticks[i]);
GC::WriteBarrier(opt, it);
opt->mItems.Push(it);
if (i == itemnum) opt->mSelectedItem = opt->mItems.Size();
}
if (opt->mSelectedItem >= (int)opt->mItems.Size())
{
opt->mSelectedItem = opt->mItems.Size() - 1;
}
//opt->CalcIndent();
// If the joystick config menu is open, close it if the device it's open for is gone.
if (CurrentMenu != nullptr && (CurrentMenu->IsKindOf("JoystickConfigMenu")))
{
auto p = CurrentMenu->PointerVar<IJoystickConfig>("mJoy");
if (p != nullptr)
{
unsigned i;
for (i = 0; i < Joysticks.Size(); ++i)
{
if (Joysticks[i] == p)
{
break;
}
}
if (i == Joysticks.Size())
{
CurrentMenu->Close();
}
}
}
}
}

1208
src/menu/menu.cpp Normal file

File diff suppressed because it is too large Load diff

280
src/menu/menu.h Normal file
View file

@ -0,0 +1,280 @@
#ifndef __M_MENU_MENU_H__
#define __M_MENU_MENU_H__
#include "dobject.h"
#include "c_cvars.h"
#include "v_font.h"
#include "textures.h"
EXTERN_CVAR(Float, snd_menuvolume)
EXTERN_CVAR(Int, m_use_mouse);
struct event_t;
class FTexture;
class FFont;
enum EColorRange : int;
class FKeyBindings;
struct FBrokenLines;
enum EMenuKey
{
MKEY_Up,
MKEY_Down,
MKEY_Left,
MKEY_Right,
MKEY_PageUp,
MKEY_PageDown,
//----------------- Keys past here do not repeat.
MKEY_Enter,
MKEY_Back, // Back to previous menu
MKEY_Clear, // Clear keybinding/flip player sprite preview
NUM_MKEYS,
// These are not buttons but events sent from other menus
MKEY_Input, // Sent when input is confirmed
MKEY_Abort, // Input aborted
MKEY_MBYes,
MKEY_MBNo,
};
class DMenu;
extern DMenu *CurrentMenu;
extern int MenuTime;
class DMenuItemBase;
//=============================================================================
//
// menu descriptor. This is created from the menu definition lump
// Items must be inserted in the order they are cycled through with the cursor
//
//=============================================================================
class DMenuDescriptor : public DObject
{
DECLARE_CLASS(DMenuDescriptor, DObject)
public:
FName mMenuName = NAME_None;
FString mNetgameMessage;
PClass *mClass = nullptr;
bool mProtected = false;
TArray<DMenuItemBase *> mItems;
virtual size_t PropagateMark() { return 0; }
};
class DListMenuDescriptor : public DMenuDescriptor
{
DECLARE_CLASS(DListMenuDescriptor, DMenuDescriptor)
public:
int mSelectedItem;
double mSelectOfsX;
double mSelectOfsY;
FTextureID mSelector;
int mDisplayTop;
double mXpos, mYpos;
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
FFont *mFont;
EColorRange mFontColor;
EColorRange mFontColor2;
bool mCenter;
bool mFromEngine;
void Reset();
size_t PropagateMark() override;
};
struct FOptionMenuSettings
{
EColorRange mTitleColor;
EColorRange mFontColor;
EColorRange mFontColorValue;
EColorRange mFontColorMore;
EColorRange mFontColorHeader;
EColorRange mFontColorHighlight;
EColorRange mFontColorSelection;
int mLinespacing;
};
class DOptionMenuDescriptor : public DMenuDescriptor
{
DECLARE_CLASS(DOptionMenuDescriptor, DMenuDescriptor)
public:
FString mTitle;
int mSelectedItem;
int mDrawTop;
int mScrollTop;
int mScrollPos;
int mIndent;
int mPosition;
bool mDontDim;
FFont *mFont;
void CalcIndent();
DMenuItemBase *GetItem(FName name);
void Reset();
size_t PropagateMark() override;
~DOptionMenuDescriptor() = default;
};
typedef TMap<FName, DMenuDescriptor *> MenuDescriptorList;
extern FOptionMenuSettings OptionSettings;
extern MenuDescriptorList MenuDescriptors;
#define CURSORSPACE (14 * CleanXfac_1)
//=============================================================================
//
//
//
//=============================================================================
struct FMenuRect
{
int x, y;
int width, height;
void set(int _x, int _y, int _w, int _h)
{
x = _x;
y = _y;
width = _w;
height = _h;
}
bool inside(int _x, int _y)
{
return _x >= x && _x < x+width && _y >= y && _y < y+height;
}
};
class DMenu : public DObject
{
DECLARE_CLASS (DMenu, DObject)
HAS_OBJECT_POINTERS
public:
enum
{
MOUSE_Click,
MOUSE_Move,
MOUSE_Release
};
TObjPtr<DMenu*> mParentMenu;
bool mMouseCapture;
bool mBackbuttonSelected;
bool DontDim;
bool DontBlur;
static int InMenu;
DMenu(DMenu *parent = NULL);
bool TranslateKeyboardEvents();
virtual void Close();
bool CallResponder(event_t *ev);
bool CallMenuEvent(int mkey, bool fromcontroller);
void CallTicker();
void CallDrawer();
};
//=============================================================================
//
// base class for menu items
//
//=============================================================================
class DMenuItemBase : public DObject
{
DECLARE_CLASS(DMenuItemBase, DObject)
public:
double mXpos, mYpos;
FName mAction;
bool mEnabled;
bool Activate();
bool SetString(int i, const char *s);
bool GetString(int i, char *s, int len);
bool SetValue(int i, int value);
bool GetValue(int i, int *pvalue);
void OffsetPositionY(int ydelta) { mYpos += ydelta; }
double GetY() { return mYpos; }
};
//=============================================================================
//
//
//
//=============================================================================
struct FOptionValues
{
struct Pair
{
double Value;
FString TextValue;
FString Text;
};
TArray<Pair> mValues;
};
typedef TMap< FName, FOptionValues* > FOptionMap;
extern FOptionMap OptionValues;
//=============================================================================
//
//
//
//=============================================================================
struct event_t;
void M_EnableMenu (bool on) ;
bool M_Responder (event_t *ev);
void M_Ticker (void);
void M_Drawer (void);
void M_Init (void);
void M_CreateMenus();
void M_ActivateMenu(DMenu *menu);
void M_ClearMenus ();
void M_PreviousMenu ();
void M_ParseMenuDefs();
void M_DoStartControlPanel(bool scaleoverride);
void M_SetMenu(FName menu, int param = -1);
void M_StartMessage(const char *message, int messagemode, FName action = NAME_None);
DMenu *StartPickerMenu(DMenu *parent, const char *name, FColorCVar *cvar);
void M_MarkMenus();
FTextureID GetMenuTexture(const char* const name);
void DeinitMenus();
bool M_Active();
struct IJoystickConfig;
DMenuItemBase * CreateOptionMenuItemStaticText(const char *name, int v = -1);
DMenuItemBase * CreateOptionMenuItemSubmenu(const char *label, FName cmd, int center);
DMenuItemBase * CreateOptionMenuItemControl(const char *label, FName cmd, FKeyBindings *bindings);
DMenuItemBase * CreateOptionMenuItemJoyConfigMenu(const char *label, IJoystickConfig *joy);
DMenuItemBase * CreateListMenuItemPatch(double x, double y, int height, int hotkey, FTextureID tex, FName command, int param);
DMenuItemBase * CreateListMenuItemText(double x, double y, int height, int hotkey, const char *text, FFont *font, PalEntry color1, PalEntry color2, FName command, int param);
DMenuItemBase * CreateOptionMenuItemCommand(const char *label, FName cmd, bool centered = false);
void UpdateVRModes(bool considerQuadBuffered=true);
#endif

1190
src/menu/menudef.cpp Normal file

File diff suppressed because it is too large Load diff

105
src/menu/messagebox.cpp Normal file
View file

@ -0,0 +1,105 @@
/*
** messagebox.cpp
** Confirmation, notification screns
**
**---------------------------------------------------------------------------
** Copyright 2010 Christoph Oelckers
** All rights reserved.
**
** Redistribution and use in source and binary forms, with or without
** modification, are permitted provided that the following conditions
** are met:
**
** 1. Redistributions of source code must retain the above copyright
** notice, this list of conditions and the following disclaimer.
** 2. Redistributions in binary form must reproduce the above copyright
** notice, this list of conditions and the following disclaimer in the
** documentation and/or other materials provided with the distribution.
** 3. The name of the author may not be used to endorse or promote products
** derived from this software without specific prior written permission.
**
** THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
** IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
** OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
** IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
** INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
** NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
** THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
**---------------------------------------------------------------------------
**
*/
#include <ctype.h>
#include "menu.h"
#include "gstrings.h"
#include "i_video.h"
#include "c_dispatch.h"
#include "vm.h"
#include "menustate.h"
void M_StartControlPanel(bool makeSound, bool scaleoverride = false);
FName MessageBoxClass = NAME_MessageBoxMenu;
CVAR(Bool, m_quickexit, false, CVAR_ARCHIVE)
typedef void(*hfunc)();
DEFINE_ACTION_FUNCTION(DMessageBoxMenu, CallHandler)
{
PARAM_PROLOGUE;
PARAM_POINTERTYPE(Handler, hfunc);
Handler();
return 0;
}
//=============================================================================
//
//
//
//=============================================================================
DMenu *CreateMessageBoxMenu(DMenu *parent, const char *message, int messagemode, bool playsound, FName action = NAME_None, hfunc handler = nullptr)
{
auto c = PClass::FindClass(MessageBoxClass);
if (!c->IsDescendantOf(NAME_MessageBoxMenu)) c = PClass::FindClass(NAME_MessageBoxMenu);
auto p = c->CreateNew();
FString namestr = message;
IFVIRTUALPTRNAME(p, NAME_MessageBoxMenu, Init)
{
VMValue params[] = { p, parent, &namestr, messagemode, playsound, action.GetIndex(), reinterpret_cast<void*>(handler) };
VMCall(func, params, countof(params), nullptr, 0);
return (DMenu*)p;
}
return nullptr;
}
//=============================================================================
//
//
//
//=============================================================================
void M_StartMessage(const char *message, int messagemode, FName action)
{
if (CurrentMenu == NULL)
{
// only play a sound if no menu was active before
M_StartControlPanel(menuactive == MENU_Off);
}
DMenu *newmenu = CreateMessageBoxMenu(CurrentMenu, message, messagemode, false, action);
newmenu->mParentMenu = CurrentMenu;
M_ActivateMenu(newmenu);
}
DEFINE_ACTION_FUNCTION(DMenu, StartMessage)
{
PARAM_PROLOGUE;
PARAM_STRING(msg);
PARAM_INT(mode);
PARAM_NAME(action);
M_StartMessage(msg, mode, action);
return 0;
}

68
src/menu/optionmenu.cpp Normal file
View file

@ -0,0 +1,68 @@
/*
** optionmenu.cpp
** Handler class for the option menus and associated items
**
**---------------------------------------------------------------------------
** Copyright 2010-2017 Christoph Oelckers
** All rights reserved.
**
** Redistribution and use in source and binary forms, with or without
** modification, are permitted provided that the following conditions
** are met:
**
** 1. Redistributions of source code must retain the above copyright
** notice, this list of conditions and the following disclaimer.
** 2. Redistributions in binary form must reproduce the above copyright
** notice, this list of conditions and the following disclaimer in the
** documentation and/or other materials provided with the distribution.
** 3. The name of the author may not be used to endorse or promote products
** derived from this software without specific prior written permission.
**
** THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
** IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
** OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
** IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
** INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
** NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
** THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
**---------------------------------------------------------------------------
**
*/
#include "v_video.h"
#include "menu.h"
#include "vm.h"
//=============================================================================
//
//
//
//=============================================================================
DMenuItemBase *DOptionMenuDescriptor::GetItem(FName name)
{
for(unsigned i=0;i<mItems.Size(); i++)
{
FName nm = mItems[i]->mAction;
if (nm == name) return mItems[i];
}
return NULL;
}
void SetCVarDescription(FBaseCVar* cvar, const FString* label)
{
cvar->AddDescription(*label);
}
DEFINE_ACTION_FUNCTION_NATIVE(_OptionMenuItemOption, SetCVarDescription, SetCVarDescription)
{
PARAM_PROLOGUE;
PARAM_POINTER(cv, FBaseCVar);
PARAM_STRING(label);
SetCVarDescription(cv, &label);
return 0;
}

View file

@ -0,0 +1,92 @@
/*
** resolutionmenu.cpp
** Basic Custom Resolution Selector for the Menu
**
**---------------------------------------------------------------------------
** Copyright 2018 Rachael Alexanderson
** All rights reserved.
**
** Redistribution and use in source and binary forms, with or without
** modification, are permitted provided that the following conditions
** are met:
**
** 1. Redistributions of source code must retain the above copyright
** notice, this list of conditions and the following disclaimer.
** 2. Redistributions in binary form must reproduce the above copyright
** notice, this list of conditions and the following disclaimer in the
** documentation and/or other materials provided with the distribution.
** 3. The name of the author may not be used to endorse or promote products
** derived from this software without specific prior written permission.
**
** THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
** IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
** OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
** IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
** INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
** NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
** THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
**---------------------------------------------------------------------------
**
*/
#include "c_dispatch.h"
#include "c_cvars.h"
#include "v_video.h"
#include "menu.h"
#include "printf.h"
CVAR(Int, menu_resolution_custom_width, 640, 0)
CVAR(Int, menu_resolution_custom_height, 480, 0)
EXTERN_CVAR(Bool, vid_fullscreen)
EXTERN_CVAR(Bool, win_maximized)
EXTERN_CVAR(Float, vid_scale_custompixelaspect)
EXTERN_CVAR(Int, vid_scale_customwidth)
EXTERN_CVAR(Int, vid_scale_customheight)
EXTERN_CVAR(Int, vid_scalemode)
EXTERN_CVAR(Float, vid_scalefactor)
CCMD (menu_resolution_set_custom)
{
if (argv.argc() > 2)
{
menu_resolution_custom_width = atoi(argv[1]);
menu_resolution_custom_height = atoi(argv[2]);
}
else
{
Printf("This command is not meant to be used outside the menu! But if you want to use it, please specify <x> and <y>.\n");
}
M_PreviousMenu();
}
CCMD (menu_resolution_commit_changes)
{
int do_fullscreen = vid_fullscreen;
if (argv.argc() > 1)
{
do_fullscreen = atoi(argv[1]);
}
if (do_fullscreen == false)
{
vid_scalemode = 0;
vid_scalefactor = 1.;
screen->SetWindowSize(menu_resolution_custom_width, menu_resolution_custom_height);
V_OutputResized(screen->GetClientWidth(), screen->GetClientHeight());
}
else
{
vid_fullscreen = true;
vid_scalemode = 5;
vid_scalefactor = 1.;
vid_scale_customwidth = menu_resolution_custom_width;
vid_scale_customheight = menu_resolution_custom_height;
vid_scale_custompixelaspect = 1.0;
}
}