- backend update to make the ZScript compiler work.

This commit is contained in:
Christoph Oelckers 2020-06-14 18:57:55 +02:00
parent 7b3ad35cc2
commit d4cdb31464
81 changed files with 1779 additions and 235 deletions

View file

@ -810,6 +810,7 @@ set (PCH_SOURCES
common/audio/sound/oalsound.cpp common/audio/sound/oalsound.cpp
common/audio/sound/s_environment.cpp common/audio/sound/s_environment.cpp
common/audio/sound/s_sound.cpp common/audio/sound/s_sound.cpp
#common/audio/sound/s_reverbedit.cpp
common/audio/music/music_midi_base.cpp common/audio/music/music_midi_base.cpp
common/audio/music/music.cpp common/audio/music/music.cpp
common/audio/music/i_music.cpp common/audio/music/i_music.cpp
@ -828,7 +829,6 @@ set (PCH_SOURCES
common/fonts/v_text.cpp common/fonts/v_text.cpp
common/textures/hw_ihwtexture.cpp common/textures/hw_ihwtexture.cpp
common/textures/hw_material.cpp common/textures/hw_material.cpp
common/textures/bitmap.cpp common/textures/bitmap.cpp
common/textures/m_png.cpp common/textures/m_png.cpp
common/textures/texture.cpp common/textures/texture.cpp
@ -905,6 +905,7 @@ set (PCH_SOURCES
common/filesystem/file_directory.cpp common/filesystem/file_directory.cpp
common/filesystem/resourcefile.cpp common/filesystem/resourcefile.cpp
common/engine/cycler.cpp common/engine/cycler.cpp
common/engine/d_event.cpp
common/engine/stats.cpp common/engine/stats.cpp
common/engine/sc_man.cpp common/engine/sc_man.cpp
common/engine/palettecontainer.cpp common/engine/palettecontainer.cpp
@ -918,6 +919,7 @@ 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/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
@ -960,7 +962,7 @@ set (PCH_SOURCES
common/scripting/vm/vmexec.cpp common/scripting/vm/vmexec.cpp
common/scripting/vm/vmframe.cpp common/scripting/vm/vmframe.cpp
common/scripting/interface/stringformat.cpp common/scripting/interface/stringformat.cpp
#common/scripting/interface/exports.cpp common/scripting/interface/vmnatives.cpp
common/scripting/frontend/ast.cpp common/scripting/frontend/ast.cpp
common/scripting/frontend/zcc_compile.cpp common/scripting/frontend/zcc_compile.cpp
common/scripting/frontend/zcc_parser.cpp common/scripting/frontend/zcc_parser.cpp

View file

@ -70,7 +70,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#include "gamecontrol.h" #include "gamecontrol.h"
#include "m_argv.h" #include "m_argv.h"
#include "statistics.h" #include "statistics.h"
#include "menu/menu.h" #include "menu.h"
#include "raze_sound.h" #include "raze_sound.h"
#include "nnexts.h" #include "nnexts.h"
#include"secrets.h" #include"secrets.h"

View file

@ -39,7 +39,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#include "network.h" #include "network.h"
#include "mmulti.h" #include "mmulti.h"
#include "c_bind.h" #include "c_bind.h"
#include "menu/menu.h" #include "menu.h"
#include "sfx.h" #include "sfx.h"
bool ShowOptionMenu(); bool ShowOptionMenu();

View file

@ -44,7 +44,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#include "screen.h" #include "screen.h"
#include "view.h" #include "view.h"
#include "gamecontrol.h" #include "gamecontrol.h"
#include "menu/menu.h" #include "menu.h"
#include "gameconfigfile.h" #include "gameconfigfile.h"
#include "findfile.h" #include "findfile.h"

View file

@ -43,7 +43,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#include "sfx.h" #include "sfx.h"
#include "view.h" #include "view.h"
#include "eventq.h" #include "eventq.h"
#include "menu/menu.h" #include "menu.h"
BEGIN_BLD_NS BEGIN_BLD_NS

View file

@ -38,7 +38,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#include "seq.h" #include "seq.h"
#include "sound.h" #include "sound.h"
#include "view.h" #include "view.h"
#include "menu/menu.h" #include "menu.h"
extern bool gHaveNetworking; extern bool gHaveNetworking;

View file

@ -60,7 +60,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#include "weapon.h" #include "weapon.h"
#include "nnexts.h" #include "nnexts.h"
#include "zstring.h" #include "zstring.h"
#include "menu/menu.h" #include "menu.h"
#include "gstrings.h" #include "gstrings.h"
#include "v_2ddrawer.h" #include "v_2ddrawer.h"
#include "v_video.h" #include "v_video.h"

View file

@ -35,7 +35,7 @@
#include "c_dispatch.h" #include "c_dispatch.h"
#include "v_text.h" #include "v_text.h"
#include "menu/menu.h" #include "menu.h"
#include <zmusic.h> #include <zmusic.h>
#include "s_music.h" #include "s_music.h"
#include "c_cvars.h" #include "c_cvars.h"

View file

@ -2071,7 +2071,7 @@ FSoundChan *OpenALSoundRenderer::FindLowestChannel()
#endif // NO_OPENAL #endif // NO_OPENAL
#include "menu/menu.h" #include "menu.h"
void I_BuildALDeviceList(FOptionValues* opt) void I_BuildALDeviceList(FOptionValues* opt)
{ {

View file

@ -0,0 +1,553 @@
/*
**
** reverb editor
**
**---------------------------------------------------------------------------
** Copyright 2005-2016 Randy Heit
** Copyright 2005-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 "s_soundinternal.h"
#include "sc_man.h"
#include "cmdlib.h"
#include "templates.h"
#include "filesystem.h"
#include "i_system.h"
#include "printf.h"
#include "i_specialpaths.h"
#include "c_cvars.h"
#include "c_dispatch.h"
#include "vm.h"
#include "dobject.h"
#include "menu.h"
void S_ReadReverbDef (FScanner &sc);
extern ReverbContainer *ForcedEnvironment;
ReverbContainer *CurrentEnv;
REVERB_PROPERTIES SavedProperties;
extern FReverbField ReverbFields[];
extern const char* ReverbFieldNames[];
extern int NumReverbs;
// These are for internal use only and not supposed to be user-settable
CVAR(String, reverbedit_name, "", CVAR_NOSET);
CVAR(Int, reverbedit_id1, 0, CVAR_NOSET);
CVAR(Int, reverbedit_id2, 0, CVAR_NOSET);
CVAR(String, reverbsavename, "", 0);
CUSTOM_CVAR(Bool, eaxedit_test, false, CVAR_NOINITCALL)
{
if (self)
{
ForcedEnvironment = CurrentEnv;
}
else
{
ForcedEnvironment = nullptr;
}
}
struct EnvFlag
{
const char *Name;
int CheckboxControl;
unsigned int Flag;
};
inline int HIBYTE(int i)
{
return (i >> 8) & 255;
}
inline int LOBYTE(int i)
{
return i & 255;
}
uint16_t FirstFreeID(uint16_t base, bool builtin)
{
int tryCount = 0;
int priID = HIBYTE(base);
// If the original sound is built-in, start searching for a new
// primary ID at 30.
if (builtin)
{
for (priID = 30; priID < 256; ++priID)
{
if (S_FindEnvironment(priID << 8) == nullptr)
{
break;
}
}
if (priID == 256)
{ // Oh well.
priID = 30;
}
}
for (;;)
{
uint16_t lastID = Environments->ID;
const ReverbContainer *env = Environments->Next;
// Find the lowest-numbered free ID with the same primary ID as base
// If none are available, add 100 to base's primary ID and try again.
// If that fails, then the primary ID gets incremented
// by 1 until a match is found. If all the IDs searchable by this
// algorithm are in use, then you're in trouble.
while (env != nullptr)
{
if (HIBYTE(env->ID) > priID)
{
break;
}
if (HIBYTE(env->ID) == priID)
{
if (HIBYTE(lastID) == priID)
{
if (LOBYTE(env->ID) - LOBYTE(lastID) > 1)
{
return lastID + 1;
}
}
lastID = env->ID;
}
env = env->Next;
}
if (LOBYTE(lastID) == 255)
{
if (tryCount == 0)
{
base += 100 * 256;
tryCount = 1;
}
else
{
base += 256;
}
}
else if (builtin && lastID == 0)
{
return priID << 8;
}
else
{
return lastID + 1;
}
}
}
FString SuggestNewName(const ReverbContainer *env)
{
const ReverbContainer *probe = nullptr;
char text[32];
size_t len;
int number, numdigits;
strncpy(text, env->Name, 31);
text[31] = 0;
len = strlen(text);
while (text[len - 1] >= '0' && text[len - 1] <= '9')
{
len--;
}
number = atoi(text + len);
if (number < 1)
{
number = 1;
}
if (text[len - 1] != ' ' && len < 31)
{
text[len++] = ' ';
}
for (; number < 100000; ++number)
{
if (number < 10) numdigits = 1;
else if (number < 100) numdigits = 2;
else if (number < 1000) numdigits = 3;
else if (number < 10000)numdigits = 4;
else numdigits = 5;
if (len + numdigits > 31)
{
len = 31 - numdigits;
}
mysnprintf(text + len, countof(text) - len, "%d", number);
probe = Environments;
while (probe != nullptr)
{
if (stricmp(probe->Name, text) == 0)
break;
probe = probe->Next;
}
if (probe == nullptr)
{
break;
}
}
return text;
}
void ExportEnvironments(const char *filename, uint32_t count, const ReverbContainer **envs)
{
FString dest = M_GetDocumentsPath() + filename;
FileWriter *f = FileWriter::Open(dest);
if (f != nullptr)
{
for (uint32_t i = 0; i < count; ++i)
{
const ReverbContainer *env = envs[i];
const ReverbContainer *base;
if ((unsigned int)env->Properties.Environment < 26)
{
base = DefaultEnvironments[env->Properties.Environment];
}
else
{
base = nullptr;
}
f->Printf("\"%s\" %u %u\n{\n", env->Name, HIBYTE(env->ID), LOBYTE(env->ID));
for (int j = 0; j < NumReverbs; ++j)
{
const FReverbField *ctl = &ReverbFields[j];
const char *ctlName = ReverbFieldNames[j];
if (ctlName)
{
if (j == 0 ||
(ctl->Float && base->Properties.*ctl->Float != env->Properties.*ctl->Float) ||
(ctl->Int && base->Properties.*ctl->Int != env->Properties.*ctl->Int))
{
f->Printf("\t%s ", ctlName);
if (ctl->Float)
{
float v = env->Properties.*ctl->Float * 1000;
int vi = int(v >= 0.0 ? v + 0.5 : v - 0.5);
f->Printf("%d.%03d\n", vi / 1000, abs(vi % 1000));
}
else
{
f->Printf("%d\n", env->Properties.*ctl->Int);
}
}
else
{
if ((1 << ctl->Flag) & (env->Properties.Flags ^ base->Properties.Flags))
{
f->Printf("\t%s %s\n", ctlName, ctl->Flag & env->Properties.Flags ? "true" : "false");
}
}
}
}
f->Printf("}\n\n");
}
delete f;
}
else
{
M_StartMessage("Save failed", 1);
}
}
DEFINE_ACTION_FUNCTION(DReverbEdit, GetValue)
{
PARAM_PROLOGUE;
PARAM_INT(index);
float v = 0;
if (index >= 0 && index < NumReverbs)
{
auto rev = &ReverbFields[index];
if (rev->Int != nullptr)
{
v = float(CurrentEnv->Properties.*(rev->Int));
}
else if (rev->Float != nullptr)
{
v = CurrentEnv->Properties.*(rev->Float);
}
else
{
v = !!(CurrentEnv->Properties.Flags & (1 << int(rev->Flag)));
}
}
ACTION_RETURN_FLOAT(v);
return 1;
}
DEFINE_ACTION_FUNCTION(DReverbEdit, SetValue)
{
PARAM_PROLOGUE;
PARAM_INT(index);
PARAM_FLOAT(v);
if (index >= 0 && index < NumReverbs)
{
auto rev = &ReverbFields[index];
if (rev->Int != nullptr)
{
v = CurrentEnv->Properties.*(rev->Int) = clamp<int>(int(v), rev->Min, rev->Max);
}
else if (rev->Float != nullptr)
{
v = CurrentEnv->Properties.*(rev->Float) = clamp<float>(float(v), rev->Min / 1000.f, rev->Max / 1000.f);
}
else
{
if (v == 0) CurrentEnv->Properties.Flags &= ~(1 << int(rev->Flag));
else CurrentEnv->Properties.Flags |= (1 << int(rev->Flag));
}
}
ACTION_RETURN_FLOAT(v);
return 1;
}
DEFINE_ACTION_FUNCTION(DReverbEdit, GrayCheck)
{
PARAM_PROLOGUE;
ACTION_RETURN_BOOL(CurrentEnv->Builtin);
return 1;
}
DEFINE_ACTION_FUNCTION(DReverbEdit, GetSelectedEnvironment)
{
PARAM_PROLOGUE;
if (numret > 1)
{
numret = 2;
ret[1].SetInt(CurrentEnv ? CurrentEnv->ID : -1);
}
if (numret > 0)
{
ret[0].SetString(CurrentEnv ? CurrentEnv->Name : "");
}
return numret;
}
DEFINE_ACTION_FUNCTION(DReverbEdit, FillSelectMenu)
{
PARAM_PROLOGUE;
PARAM_STRING(ccmd);
PARAM_OBJECT(desc, DOptionMenuDescriptor);
desc->mItems.Clear();
for (auto env = Environments; env != nullptr; env = env->Next)
{
FStringf text("(%d, %d) %s", HIBYTE(env->ID), LOBYTE(env->ID), env->Name);
FStringf cmd("%s \"%s\"", ccmd.GetChars(), env->Name);
PClass *cls = PClass::FindClass("OptionMenuItemCommand");
if (cls != nullptr && cls->IsDescendantOf("OptionMenuItem"))
{
auto func = dyn_cast<PFunction>(cls->FindSymbol("Init", true));
if (func != nullptr)
{
DMenuItemBase *item = (DMenuItemBase*)cls->CreateNew();
VMValue params[] = { item, &text, FName(cmd).GetIndex(), false, true };
VMCall(func->Variants[0].Implementation, params, 5, nullptr, 0);
desc->mItems.Push((DMenuItemBase*)item);
}
}
}
return 0;
}
static TArray<std::pair<ReverbContainer*, bool>> SaveState;
DEFINE_ACTION_FUNCTION(DReverbEdit, FillSaveMenu)
{
PARAM_PROLOGUE;
PARAM_OBJECT(desc, DOptionMenuDescriptor);
desc->mItems.Resize(4);
SaveState.Clear();
for (auto env = Environments; env != nullptr; env = env->Next)
{
if (!env->Builtin)
{
int index = (int)SaveState.Push(std::make_pair(env, false));
FStringf text("(%d, %d) %s", HIBYTE(env->ID), LOBYTE(env->ID), env->Name);
PClass *cls = PClass::FindClass("OptionMenuItemReverbSaveSelect");
if (cls != nullptr && cls->IsDescendantOf("OptionMenuItem"))
{
auto func = dyn_cast<PFunction>(cls->FindSymbol("Init", true));
if (func != nullptr)
{
DMenuItemBase *item = (DMenuItemBase*)cls->CreateNew();
VMValue params[] = { item, &text, index, FName("OnOff").GetIndex() };
VMCall(func->Variants[0].Implementation, params, 4, nullptr, 0);
desc->mItems.Push((DMenuItemBase*)item);
}
}
}
}
return 0;
}
DEFINE_ACTION_FUNCTION(DReverbEdit, GetSaveSelection)
{
PARAM_PROLOGUE;
PARAM_INT(index);
bool res = false;
if ((unsigned)index <= SaveState.Size())
{
res = SaveState[index].second;
}
ACTION_RETURN_BOOL(res);
}
DEFINE_ACTION_FUNCTION(DReverbEdit, ToggleSaveSelection)
{
PARAM_PROLOGUE;
PARAM_INT(index);
if ((unsigned)index <= SaveState.Size())
{
SaveState[index].second = !SaveState[index].second;
}
return 0;
}
CCMD(savereverbs)
{
if (SaveState.Size() == 0) return;
TArray<const ReverbContainer*> toSave;
for (auto &p : SaveState)
{
if (p.second) toSave.Push(p.first);
}
ExportEnvironments(reverbsavename, toSave.Size(), &toSave[0]);
SaveState.Clear();
}
static void SelectEnvironment(const char *envname)
{
for (auto env = Environments; env != nullptr; env = env->Next)
{
if (!strcmp(env->Name, envname))
{
CurrentEnv = env;
SavedProperties = env->Properties;
if (eaxedit_test) ForcedEnvironment = env;
// Set up defaults for a new environment based on this one.
int newid = FirstFreeID(env->ID, env->Builtin);
UCVarValue cv;
cv.Int = HIBYTE(newid);
reverbedit_id1.ForceSet(cv, CVAR_Int);
cv.Int = LOBYTE(newid);
reverbedit_id2.ForceSet(cv, CVAR_Int);
FString selectname = SuggestNewName(env);
cv.String = selectname.GetChars();
reverbedit_name.ForceSet(cv, CVAR_String);
return;
}
}
}
void InitReverbMenu()
{
// Make sure that the editor's variables are properly initialized.
SelectEnvironment("Off");
}
CCMD(selectenvironment)
{
if (argv.argc() > 1)
{
auto str = argv[1];
SelectEnvironment(str);
}
else
InitReverbMenu();
}
CCMD(revertenvironment)
{
if (CurrentEnv != nullptr)
{
CurrentEnv->Properties = SavedProperties;
}
}
CCMD(createenvironment)
{
if (S_FindEnvironment(reverbedit_name))
{
M_StartMessage(FStringf("An environment with the name '%s' already exists", *reverbedit_name), 1);
return;
}
int id = (reverbedit_id1 << 8) + reverbedit_id2;
if (S_FindEnvironment(id))
{
M_StartMessage(FStringf("An environment with the ID (%d, %d) already exists", *reverbedit_id1, *reverbedit_id2), 1);
return;
}
auto newenv = new ReverbContainer;
newenv->Builtin = false;
newenv->ID = id;
newenv->Name = copystring(reverbedit_name);
newenv->Next = nullptr;
newenv->Properties = CurrentEnv->Properties;
S_AddEnvironment(newenv);
SelectEnvironment(newenv->Name);
}
CCMD(reverbedit)
{
C_DoCommand("openmenu reverbedit");
}
// This is here because it depends on Doom's resource management and is not universal.
void S_ParseReverbDef ()
{
int lump, lastlump = 0;
while ((lump = fileSystem.FindLump ("REVERBS", &lastlump)) != -1)
{
FScanner sc;
sc.OpenLumpNum(lump);
S_ReadReverbDef (sc);;
}
InitReverbMenu();
}

View file

@ -47,7 +47,7 @@
#include "sc_man.h" #include "sc_man.h"
#include "c_cvars.h" #include "c_cvars.h"
#include "d_event.h" #include "d_eventbase.h"
extern int chatmodeon; extern int chatmodeon;

View file

@ -0,0 +1,198 @@
/*
** c_dispatch.cpp
** Functions for executing console commands and aliases
**
**---------------------------------------------------------------------------
** Copyright 1998-2016 Randy Heit
** Copyright 2003-2019 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 "c_bind.h"
#include "d_eventbase.h"
#include "c_console.h"
#include "d_gui.h"
#include "menu.h"
#include "utf8.h"
#include "m_joy.h"
#include "vm.h"
bool G_Responder(event_t* ev);
int eventhead;
int eventtail;
event_t events[MAXEVENTS];
//==========================================================================
//
// D_ProcessEvents
//
// Send all the events of the given timestamp down the responder chain.
// Events are asynchronous inputs generally generated by the game user.
// Events can be discarded if no responder claims them
//
//==========================================================================
void D_ProcessEvents (void)
{
event_t *ev;
while (eventtail != eventhead)
{
ev = &events[eventtail];
eventtail = (eventtail + 1) & (MAXEVENTS - 1);
if (ev->type == EV_None)
continue;
if (ev->type == EV_DeviceChange)
UpdateJoystickMenu(I_UpdateDeviceList());
if (C_Responder (ev))
continue; // console ate the event
if (M_Responder (ev))
continue; // menu ate the event
G_Responder (ev);
}
}
//==========================================================================
//
// D_RemoveNextCharEvent
//
// Removes the next EV_GUI_Char event in the input queue. Used by the menu,
// since it (generally) consumes EV_GUI_KeyDown events and not EV_GUI_Char
// events, and it needs to ensure that there is no left over input when it's
// done. If there are multiple EV_GUI_KeyDowns before the EV_GUI_Char, then
// there are dead chars involved, so those should be removed, too. We do
// this by changing the message type to EV_None rather than by actually
// removing the event from the queue.
//
//==========================================================================
void D_RemoveNextCharEvent()
{
assert(events[eventtail].type == EV_GUI_Event && events[eventtail].subtype == EV_GUI_KeyDown);
for (int evnum = eventtail; evnum != eventhead; evnum = (evnum+1) & (MAXEVENTS-1))
{
event_t *ev = &events[evnum];
if (ev->type != EV_GUI_Event)
break;
if (ev->subtype == EV_GUI_KeyDown || ev->subtype == EV_GUI_Char)
{
ev->type = EV_None;
if (ev->subtype == EV_GUI_Char)
break;
}
else
{
break;
}
}
}
FInputEvent::FInputEvent(const event_t *ev)
{
Type = (EGenericEvent)ev->type;
// we don't want the modders to remember what weird fields mean what for what events.
KeyScan = 0;
KeyChar = 0;
MouseX = 0;
MouseY = 0;
switch (Type)
{
case EV_None:
break;
case EV_KeyDown:
case EV_KeyUp:
KeyScan = ev->data1;
KeyChar = ev->data2;
KeyString = FString(char(ev->data1));
break;
case EV_Mouse:
MouseX = ev->x;
MouseY = ev->y;
break;
default:
break; // EV_DeviceChange = wat?
}
}
FUiEvent::FUiEvent(const event_t *ev)
{
Type = (EGUIEvent)ev->subtype;
KeyChar = 0;
IsShift = false;
IsAlt = false;
IsCtrl = false;
MouseX = 0;
MouseY = 0;
// we don't want the modders to remember what weird fields mean what for what events.
switch (ev->subtype)
{
case EV_GUI_None:
break;
case EV_GUI_KeyDown:
case EV_GUI_KeyRepeat:
case EV_GUI_KeyUp:
KeyChar = ev->data1;
KeyString = FString(char(ev->data1));
IsShift = !!(ev->data3 & GKM_SHIFT);
IsAlt = !!(ev->data3 & GKM_ALT);
IsCtrl = !!(ev->data3 & GKM_CTRL);
break;
case EV_GUI_Char:
KeyChar = ev->data1;
KeyString = MakeUTF8(ev->data1);
IsAlt = !!ev->data2; // only true for Win32, not sure about SDL
break;
default: // mouse event
// note: SDL input doesn't seem to provide these at all
//Printf("Mouse data: %d, %d, %d, %d\n", ev->x, ev->y, ev->data1, ev->data2);
MouseX = ev->data1;
MouseY = ev->data2;
IsShift = !!(ev->data3 & GKM_SHIFT);
IsAlt = !!(ev->data3 & GKM_ALT);
IsCtrl = !!(ev->data3 & GKM_CTRL);
break;
}
}
DEFINE_FIELD_X(UiEvent, FUiEvent, Type);
DEFINE_FIELD_X(UiEvent, FUiEvent, KeyString);
DEFINE_FIELD_X(UiEvent, FUiEvent, KeyChar);
DEFINE_FIELD_X(UiEvent, FUiEvent, MouseX);
DEFINE_FIELD_X(UiEvent, FUiEvent, MouseY);
DEFINE_FIELD_X(UiEvent, FUiEvent, IsShift);
DEFINE_FIELD_X(UiEvent, FUiEvent, IsAlt);
DEFINE_FIELD_X(UiEvent, FUiEvent, IsCtrl);
DEFINE_FIELD_X(InputEvent, FInputEvent, Type);
DEFINE_FIELD_X(InputEvent, FInputEvent, KeyScan);
DEFINE_FIELD_X(InputEvent, FInputEvent, KeyString);
DEFINE_FIELD_X(InputEvent, FInputEvent, KeyChar);
DEFINE_FIELD_X(InputEvent, FInputEvent, MouseX);
DEFINE_FIELD_X(InputEvent, FInputEvent, MouseY);

View file

@ -0,0 +1,77 @@
#pragma once
#include <stdint.h>
#include "d_gui.h"
#include "zstring.h"
// Input event types.
enum EGenericEvent
{
EV_None,
EV_KeyDown, // data1: scan code, data2: Qwerty ASCII code
EV_KeyUp, // same
EV_Mouse, // x, y: mouse movement deltas
EV_GUI_Event, // subtype specifies actual event
EV_DeviceChange,// a device has been connected or removed
};
// Event structure.
struct event_t
{
uint8_t type;
uint8_t subtype;
int16_t data1; // keys / mouse/joystick buttons
int16_t data2;
int16_t data3;
int x; // mouse/joystick x move
int y; // mouse/joystick y move
};
// Called by IO functions when input is detected.
void D_PostEvent (const event_t* ev);
void D_RemoveNextCharEvent();
void D_ProcessEvents(void);
enum
{
MAXEVENTS = 128
};
extern event_t events[MAXEVENTS];
extern int eventhead;
extern int eventtail;
struct FUiEvent
{
// this essentially translates event_t UI events to ZScript.
EGUIEvent Type;
// for keys/chars/whatever
FString KeyString;
int KeyChar;
// for mouse
int MouseX;
int MouseY;
// global (?)
bool IsShift;
bool IsCtrl;
bool IsAlt;
FUiEvent(const event_t *ev);
};
struct FInputEvent
{
// this translates regular event_t events to ZScript (not UI, UI events are sent via DUiEvent and only if requested!)
EGenericEvent Type = EV_None;
// for keys
int KeyScan;
FString KeyString;
int KeyChar;
// for mouse
int MouseX;
int MouseY;
FInputEvent(const event_t *ev);
};

View file

@ -0,0 +1,115 @@
/*
** d_gui.h
**
**---------------------------------------------------------------------------
** Copyright 1998-2006 Randy Heit
** 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.
**---------------------------------------------------------------------------
**
** So when do I get a real UT-like windowing system?
*/
#ifndef __D_GUI_H__
#define __D_GUI_H__
// For a GUIEvent, x and y specify absolute location of mouse pointer
enum EGUIEvent
{
EV_GUI_None,
EV_GUI_KeyDown, // data1: unshifted ASCII, data2: shifted ASCII, data3: modifiers
EV_GUI_KeyRepeat, // same
EV_GUI_KeyUp, // same
EV_GUI_Char, // data1: translated character (for user text input), data2: alt down?
EV_GUI_FirstMouseEvent,
EV_GUI_MouseMove,
EV_GUI_LButtonDown,
EV_GUI_LButtonUp,
EV_GUI_LButtonDblClick,
EV_GUI_MButtonDown,
EV_GUI_MButtonUp,
EV_GUI_MButtonDblClick,
EV_GUI_RButtonDown,
EV_GUI_RButtonUp,
EV_GUI_RButtonDblClick,
EV_GUI_WheelUp, // data3: shift/ctrl/alt
EV_GUI_WheelDown, // "
EV_GUI_WheelRight, // "
EV_GUI_WheelLeft, // "
EV_GUI_BackButtonDown,
EV_GUI_BackButtonUp,
EV_GUI_FwdButtonDown,
EV_GUI_FwdButtonUp,
EV_GUI_LastMouseEvent,
};
enum GUIKeyModifiers
{
GKM_SHIFT = 1,
GKM_CTRL = 2,
GKM_ALT = 4,
GKM_META = 8,
GKM_LBUTTON = 16
};
// Special codes for some GUI keys, including a few real ASCII codes.
enum ESpecialGUIKeys
{
GK_PGDN = 1,
GK_PGUP = 2,
GK_HOME = 3,
GK_END = 4,
GK_LEFT = 5,
GK_RIGHT = 6,
GK_ALERT = 7, // ASCII bell
GK_BACKSPACE= 8, // ASCII
GK_TAB = 9, // ASCII
GK_LINEFEED = 10, // ASCII
GK_DOWN = 10,
GK_VTAB = 11, // ASCII
GK_UP = 11,
GK_FORMFEED = 12, // ASCII
GK_RETURN = 13, // ASCII
GK_F1 = 14,
GK_F2 = 15,
GK_F3 = 16,
GK_F4 = 17,
GK_F5 = 18,
GK_F6 = 19,
GK_F7 = 20,
GK_F8 = 21,
GK_F9 = 22,
GK_F10 = 23,
GK_F11 = 24,
GK_F12 = 25,
GK_DEL = 26,
GK_ESCAPE = 27, // ASCII
GK_FREE1 = 28,
GK_FREE2 = 29,
GK_BACK = 30, // browser back key
GK_CESCAPE = 31 // color escape
};
#endif //__D_GUI_H__

View file

@ -17,6 +17,7 @@ struct SystemCallbacks
void (*OnScreenSizeChanged)(); void (*OnScreenSizeChanged)();
IntRect(*GetSceneRect)(); IntRect(*GetSceneRect)();
FString(*GetLocationDescription)(); FString(*GetLocationDescription)();
void (*MenuDim)();
}; };
extern SystemCallbacks *sysCallbacks; extern SystemCallbacks *sysCallbacks;

View file

@ -36,7 +36,7 @@
#include "vectors.h" #include "vectors.h"
#include "m_joy.h" #include "m_joy.h"
#include "gameconfigfile.h" #include "gameconfigfile.h"
#include "d_event.h" #include "d_eventbase.h"
#include "cmdlib.h" #include "cmdlib.h"
#include "printf.h" #include "printf.h"

View file

@ -57,6 +57,9 @@ public:
virtual void NetMessage(const char *format, ...) {} // cover for printf virtual void NetMessage(const char *format, ...) {} // cover for printf
virtual void NetDone() {} virtual void NetDone() {}
virtual bool NetLoop(bool (*timer_callback)(void *), void *userdata) { return false; } virtual bool NetLoop(bool (*timer_callback)(void *), void *userdata) { return false; }
virtual void AppendStatusLine(const char* status) {}
virtual void LoadingStatus(const char* message, int colors) {}
protected: protected:
int MaxPos, CurPos, NotchPos; int MaxPos, CurPos, NotchPos;
}; };

View file

@ -59,8 +59,9 @@
#include "dobject.h" #include "dobject.h"
#include "templates.h" #include "templates.h"
#include "c_dispatch.h" #include "c_dispatch.h"
#include "menu/menu.h" #include "menu.h"
#include "stats.h" #include "stats.h"
#include "printf.h"
// MACROS ------------------------------------------------------------------ // MACROS ------------------------------------------------------------------

View file

@ -922,3 +922,31 @@ unsigned GetVirtualIndex(PClass *cls, const char *funcname)
return VIndex; return VIndex;
} }
void PClass::InitializeDefaults()
{
if (VMType != nullptr) // purely internal classes have no symbol table
{
if (bRuntimeClass)
{
// Copy parent values from the parent defaults.
assert(ParentClass != nullptr);
if (Defaults != nullptr) ParentClass->InitializeSpecials(Defaults, ParentClass->Defaults, &PClass::SpecialInits);
for (const PField* field : Fields)
{
if (!(field->Flags & VARF_Native) && !(field->Flags & VARF_Meta))
{
field->Type->SetDefaultValue(Defaults, unsigned(field->Offset), &SpecialInits);
}
}
}
if (Meta != nullptr) ParentClass->InitializeSpecials(Meta, ParentClass->Meta, &PClass::MetaInits);
for (const PField* field : Fields)
{
if (!(field->Flags & VARF_Native) && (field->Flags & VARF_Meta))
{
field->Type->SetDefaultValue(Meta, unsigned(field->Offset), &MetaInits);
}
}
}
}

View file

@ -46,6 +46,7 @@ public:
int FindVirtualIndex(FName name, PFunction::Variant *variant, PFunction *parentfunc); int FindVirtualIndex(FName name, PFunction::Variant *variant, PFunction *parentfunc);
PSymbol *FindSymbol(FName symname, bool searchparents) const; PSymbol *FindSymbol(FName symname, bool searchparents) const;
PField *AddField(FName name, PType *type, uint32_t flags); PField *AddField(FName name, PType *type, uint32_t flags);
void InitializeDefaults();
static void StaticInit(); static void StaticInit();
static void StaticShutdown(); static void StaticShutdown();

View file

@ -38,7 +38,7 @@
#include "c_console.h" #include "c_console.h"
#include "c_cvars.h" #include "c_cvars.h"
#include "c_dispatch.h" #include "c_dispatch.h"
#include "d_event.h" #include "d_eventbase.h"
#include "c_buttons.h" #include "c_buttons.h"
#include "d_gui.h" #include "d_gui.h"
#include "dikeys.h" #include "dikeys.h"

View file

@ -35,7 +35,7 @@
#include <IOKit/IOMessage.h> #include <IOKit/IOMessage.h>
#include <IOKit/hid/IOHIDLib.h> #include <IOKit/hid/IOHIDLib.h>
#include "d_event.h" #include "d_eventbase.h"
#include "i_system.h" #include "i_system.h"
#include "m_argv.h" #include "m_argv.h"
#include "m_joy.h" #include "m_joy.h"

View file

@ -34,7 +34,7 @@
#include "m_argv.h" #include "m_argv.h"
#include "v_video.h" #include "v_video.h"
#include "d_event.h" #include "d_eventbase.h"
#include "d_gui.h" #include "d_gui.h"
#include "c_buttons.h" #include "c_buttons.h"
#include "c_console.h" #include "c_console.h"

View file

@ -44,7 +44,7 @@
#include <malloc.h> #include <malloc.h>
#include "i_input.h" #include "i_input.h"
#include "d_event.h" #include "d_eventbase.h"
#include "templates.h" #include "templates.h"
#include "gameconfigfile.h" #include "gameconfigfile.h"
#include "cmdlib.h" #include "cmdlib.h"

View file

@ -77,7 +77,7 @@
#include "s_soundinternal.h" #include "s_soundinternal.h"
#include "gameconfigfile.h" #include "gameconfigfile.h"
#include "hardware.h" #include "hardware.h"
#include "d_event.h" #include "d_eventbase.h"
#include "v_text.h" #include "v_text.h"
#include "version.h" #include "version.h"
#include "engineerrors.h" #include "engineerrors.h"

View file

@ -39,7 +39,7 @@
#include <dinput.h> #include <dinput.h>
#include "i_input.h" #include "i_input.h"
#include "d_event.h" #include "d_eventbase.h"
// MACROS ------------------------------------------------------------------ // MACROS ------------------------------------------------------------------

View file

@ -39,10 +39,12 @@
#include <dinput.h> #include <dinput.h>
#include "i_input.h" #include "i_input.h"
#include "d_event.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 ------------------------------------------------------------------

View file

@ -37,7 +37,7 @@
#include <windows.h> #include <windows.h>
#include "i_input.h" #include "i_input.h"
#include "d_event.h" #include "d_eventbase.h"
#include "templates.h" #include "templates.h"
#include "gameconfigfile.h" #include "gameconfigfile.h"
#include "m_argv.h" #include "m_argv.h"

View file

@ -39,7 +39,7 @@
#include <limits.h> #include <limits.h>
#include "i_input.h" #include "i_input.h"
#include "d_event.h" #include "d_eventbase.h"
#include "templates.h" #include "templates.h"
#include "gameconfigfile.h" #include "gameconfigfile.h"
#include "m_argv.h" #include "m_argv.h"

View file

@ -40,7 +40,8 @@
#include "c_dispatch.h" #include "c_dispatch.h"
#include "v_video.h" #include "v_video.h"
#include "hw_cvars.h" #include "hw_cvars.h"
#include "menu/menu.h" #include "menu.h"
#include "printf.h"
CUSTOM_CVAR(Int, gl_fogmode, 1, CVAR_ARCHIVE | CVAR_NOINITCALL) CUSTOM_CVAR(Int, gl_fogmode, 1, CVAR_ARCHIVE | CVAR_NOINITCALL)

View file

@ -53,7 +53,7 @@
#include "cmdlib.h" #include "cmdlib.h"
#include "hardware.h" #include "hardware.h"
#include "m_png.h" #include "m_png.h"
#include "menu/menu.h" #include "menu.h"
#include "vm.h" #include "vm.h"
#include "r_videoscale.h" #include "r_videoscale.h"
#include "i_time.h" #include "i_time.h"

View file

@ -36,7 +36,7 @@
#include "gstrings.h" #include "gstrings.h"
#include "v_font.h" #include "v_font.h"
#include "menu/menu.h" #include "menu.h"
#include "types.h" #include "types.h"
#include "dictionary.h" #include "dictionary.h"
#include "vm.h" #include "vm.h"

View file

@ -650,6 +650,7 @@ int ZCCCompiler::Compile()
CreateStructTypes(); CreateStructTypes();
CompileAllConstants(); CompileAllConstants();
CompileAllFields(); CompileAllFields();
InitDefaults();
InitFunctions(); InitFunctions();
return FScriptPosition::ErrorCounter; return FScriptPosition::ErrorCounter;
} }
@ -1942,6 +1943,18 @@ void ZCCCompiler::SetImplicitArgs(TArray<PType*>* args, TArray<uint32_t>* argfla
} }
void ZCCCompiler::InitDefaults()
{
for (auto c : Classes)
{
if (c->ClassType()->ParentClass)
{
auto ti = c->ClassType();
ti->InitializeDefaults();
}
}
}
//========================================================================== //==========================================================================
// //
// //

View file

@ -139,6 +139,7 @@ protected:
void CompileFunction(ZCC_StructWork *c, ZCC_FuncDeclarator *f, bool forclass); void CompileFunction(ZCC_StructWork *c, ZCC_FuncDeclarator *f, bool forclass);
void InitFunctions(); void InitFunctions();
virtual void InitDefaults();
TArray<ZCC_ConstantDef *> Constants; TArray<ZCC_ConstantDef *> Constants;
TArray<ZCC_StructWork *> Structs; TArray<ZCC_StructWork *> Structs;

View file

@ -0,0 +1,643 @@
/*
** vmnatives.cpp
**
** VM exports for engine backend classes
**
**---------------------------------------------------------------------------
** Copyright 2005-2020 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 "texturemanager.h"
#include "filesystem.h"
#include "c_console.h"
#include "c_cvars.h"
#include "c_bind.h"
#include "c_dispatch.h"
#include "templates.h"
#include "menu.h"
#include "vm.h"
#include "gstrings.h"
#include "printf.h"
#include "s_music.h"
//==========================================================================
//
// texture manager exports
//
//==========================================================================
DEFINE_ACTION_FUNCTION(_TexMan, GetName)
{
PARAM_PROLOGUE;
PARAM_INT(texid);
auto tex = TexMan.GameByIndex(texid);
FString retval;
if (tex != nullptr)
{
if (tex->GetName().IsNotEmpty()) retval = tex->GetName();
else
{
// Textures for full path names do not have their own name, they merely link to the source lump.
auto lump = tex->GetSourceLump();
if (fileSystem.GetLinkedTexture(lump) == tex)
retval = fileSystem.GetFileFullName(lump);
}
}
ACTION_RETURN_STRING(retval);
}
static int CheckForTexture(const FString& name, int type, int flags)
{
return TexMan.CheckForTexture(name, static_cast<ETextureType>(type), flags).GetIndex();
}
DEFINE_ACTION_FUNCTION_NATIVE(_TexMan, CheckForTexture, CheckForTexture)
{
PARAM_PROLOGUE;
PARAM_STRING(name);
PARAM_INT(type);
PARAM_INT(flags);
ACTION_RETURN_INT(CheckForTexture(name, type, flags));
}
//==========================================================================
//
//
//
//==========================================================================
static int GetTextureSize(int texid, int* py)
{
auto tex = TexMan.GameByIndex(texid);
int x, y;
if (tex != nullptr)
{
x = int(0.5 + tex->GetDisplayWidth());
y = int(0.5 + tex->GetDisplayHeight());
}
else x = y = -1;
if (py) *py = y;
return x;
}
DEFINE_ACTION_FUNCTION_NATIVE(_TexMan, GetSize, GetTextureSize)
{
PARAM_PROLOGUE;
PARAM_INT(texid);
int x, y;
x = GetTextureSize(texid, &y);
if (numret > 0) ret[0].SetInt(x);
if (numret > 1) ret[1].SetInt(y);
return MIN(numret, 2);
}
//==========================================================================
//
//
//
//==========================================================================
static void GetScaledSize(int texid, DVector2* pvec)
{
auto tex = TexMan.GameByIndex(texid);
double x, y;
if (tex != nullptr)
{
x = tex->GetDisplayWidth();
y = tex->GetDisplayHeight();
}
else x = y = -1;
if (pvec)
{
pvec->X = x;
pvec->Y = y;
}
}
DEFINE_ACTION_FUNCTION_NATIVE(_TexMan, GetScaledSize, GetScaledSize)
{
PARAM_PROLOGUE;
PARAM_INT(texid);
DVector2 vec;
GetScaledSize(texid, &vec);
ACTION_RETURN_VEC2(vec);
}
//==========================================================================
//
//
//
//==========================================================================
static void GetScaledOffset(int texid, DVector2* pvec)
{
auto tex = TexMan.GameByIndex(texid);
double x, y;
if (tex != nullptr)
{
x = tex->GetDisplayLeftOffset();
y = tex->GetDisplayTopOffset();
}
else x = y = -1;
if (pvec)
{
pvec->X = x;
pvec->Y = y;
}
}
DEFINE_ACTION_FUNCTION_NATIVE(_TexMan, GetScaledOffset, GetScaledOffset)
{
PARAM_PROLOGUE;
PARAM_INT(texid);
DVector2 vec;
GetScaledOffset(texid, &vec);
ACTION_RETURN_VEC2(vec);
}
//==========================================================================
//
//
//
//==========================================================================
static int CheckRealHeight(int texid)
{
auto tex = TexMan.GameByIndex(texid);
if (tex != nullptr) return tex->CheckRealHeight();
else return -1;
}
DEFINE_ACTION_FUNCTION_NATIVE(_TexMan, CheckRealHeight, CheckRealHeight)
{
PARAM_PROLOGUE;
PARAM_INT(texid);
ACTION_RETURN_INT(CheckRealHeight(texid));
}
bool OkForLocalization(FTextureID texnum, const char* substitute);
static int OkForLocalization_(int index, const FString& substitute)
{
return OkForLocalization(FSetTextureID(index), substitute);
}
DEFINE_ACTION_FUNCTION_NATIVE(_TexMan, OkForLocalization, OkForLocalization_)
{
PARAM_PROLOGUE;
PARAM_INT(name);
PARAM_STRING(subst)
ACTION_RETURN_INT(OkForLocalization_(name, subst));
}
//=====================================================================================
//
// FFont exports
//
//=====================================================================================
static FFont *GetFont(int name)
{
return V_GetFont(FName(ENamedName(name)).GetChars());
}
DEFINE_ACTION_FUNCTION_NATIVE(FFont, GetFont, GetFont)
{
PARAM_PROLOGUE;
PARAM_INT(name);
ACTION_RETURN_POINTER(GetFont(name));
}
static FFont *FindFont(int name)
{
return FFont::FindFont(FName(ENamedName(name)));
}
DEFINE_ACTION_FUNCTION_NATIVE(FFont, FindFont, FindFont)
{
PARAM_PROLOGUE;
PARAM_NAME(name);
ACTION_RETURN_POINTER(FFont::FindFont(name));
}
static int GetCharWidth(FFont *font, int code)
{
return font->GetCharWidth(code);
}
DEFINE_ACTION_FUNCTION_NATIVE(FFont, GetCharWidth, GetCharWidth)
{
PARAM_SELF_STRUCT_PROLOGUE(FFont);
PARAM_INT(code);
ACTION_RETURN_INT(self->GetCharWidth(code));
}
static int GetHeight(FFont *font)
{
return font->GetHeight();
}
DEFINE_ACTION_FUNCTION_NATIVE(FFont, GetHeight, GetHeight)
{
PARAM_SELF_STRUCT_PROLOGUE(FFont);
ACTION_RETURN_INT(self->GetHeight());
}
static int GetDisplacement(FFont* font)
{
return font->GetDisplacement();
}
DEFINE_ACTION_FUNCTION_NATIVE(FFont, GetDisplacement, GetDisplacement)
{
PARAM_SELF_STRUCT_PROLOGUE(FFont);
ACTION_RETURN_INT(self->GetDisplacement());
}
double GetBottomAlignOffset(FFont *font, int c);
DEFINE_ACTION_FUNCTION_NATIVE(FFont, GetBottomAlignOffset, GetBottomAlignOffset)
{
PARAM_SELF_STRUCT_PROLOGUE(FFont);
PARAM_INT(code);
ACTION_RETURN_FLOAT(GetBottomAlignOffset(self, code));
}
static int StringWidth(FFont *font, const FString &str)
{
const char *txt = str[0] == '$' ? GStrings(&str[1]) : str.GetChars();
return font->StringWidth(txt);
}
DEFINE_ACTION_FUNCTION_NATIVE(FFont, StringWidth, StringWidth)
{
PARAM_SELF_STRUCT_PROLOGUE(FFont);
PARAM_STRING(str);
ACTION_RETURN_INT(StringWidth(self, str));
}
static int GetMaxAscender(FFont* font, const FString& str)
{
const char* txt = str[0] == '$' ? GStrings(&str[1]) : str.GetChars();
return font->GetMaxAscender(txt);
}
DEFINE_ACTION_FUNCTION_NATIVE(FFont, GetMaxAscender, GetMaxAscender)
{
PARAM_SELF_STRUCT_PROLOGUE(FFont);
PARAM_STRING(str);
ACTION_RETURN_INT(GetMaxAscender(self, str));
}
static int CanPrint(FFont *font, const FString &str)
{
const char *txt = str[0] == '$' ? GStrings(&str[1]) : str.GetChars();
return font->CanPrint(txt);
}
DEFINE_ACTION_FUNCTION_NATIVE(FFont, CanPrint, CanPrint)
{
PARAM_SELF_STRUCT_PROLOGUE(FFont);
PARAM_STRING(str);
ACTION_RETURN_INT(CanPrint(self, str));
}
static int FindFontColor(int name)
{
return V_FindFontColor(ENamedName(name));
}
DEFINE_ACTION_FUNCTION_NATIVE(FFont, FindFontColor, FindFontColor)
{
PARAM_PROLOGUE;
PARAM_NAME(code);
ACTION_RETURN_INT((int)V_FindFontColor(code));
}
static void GetCursor(FFont *font, FString *result)
{
*result = font->GetCursor();
}
DEFINE_ACTION_FUNCTION_NATIVE(FFont, GetCursor, GetCursor)
{
PARAM_SELF_STRUCT_PROLOGUE(FFont);
ACTION_RETURN_STRING(FString(self->GetCursor()));
}
//==========================================================================
//
// file system
//
//==========================================================================
DEFINE_ACTION_FUNCTION(_Wads, GetNumLumps)
{
PARAM_PROLOGUE;
ACTION_RETURN_INT(fileSystem.GetNumEntries());
}
DEFINE_ACTION_FUNCTION(_Wads, CheckNumForName)
{
PARAM_PROLOGUE;
PARAM_STRING(name);
PARAM_INT(ns);
PARAM_INT(wadnum);
PARAM_BOOL(exact);
ACTION_RETURN_INT(fileSystem.CheckNumForName(name, ns, wadnum, exact));
}
DEFINE_ACTION_FUNCTION(_Wads, CheckNumForFullName)
{
PARAM_PROLOGUE;
PARAM_STRING(name);
ACTION_RETURN_INT(fileSystem.CheckNumForFullName(name));
}
DEFINE_ACTION_FUNCTION(_Wads, FindLump)
{
PARAM_PROLOGUE;
PARAM_STRING(name);
PARAM_INT(startlump);
PARAM_INT(ns);
const bool isLumpValid = startlump >= 0 && startlump < fileSystem.GetNumEntries();
ACTION_RETURN_INT(isLumpValid ? fileSystem.FindLump(name, &startlump, 0 != ns) : -1);
}
DEFINE_ACTION_FUNCTION(_Wads, GetLumpName)
{
PARAM_PROLOGUE;
PARAM_INT(lump);
FString lumpname;
fileSystem.GetFileShortName(lumpname, lump);
ACTION_RETURN_STRING(lumpname);
}
DEFINE_ACTION_FUNCTION(_Wads, GetLumpFullName)
{
PARAM_PROLOGUE;
PARAM_INT(lump);
ACTION_RETURN_STRING(fileSystem.GetFileFullName(lump));
}
DEFINE_ACTION_FUNCTION(_Wads, GetLumpNamespace)
{
PARAM_PROLOGUE;
PARAM_INT(lump);
ACTION_RETURN_INT(fileSystem.GetFileNamespace(lump));
}
DEFINE_ACTION_FUNCTION(_Wads, ReadLump)
{
PARAM_PROLOGUE;
PARAM_INT(lump);
const bool isLumpValid = lump >= 0 && lump < fileSystem.GetNumEntries();
ACTION_RETURN_STRING(isLumpValid ? fileSystem.ReadFile(lump).GetString() : FString());
}
//==========================================================================
//
// CVARs
//
//==========================================================================
DEFINE_ACTION_FUNCTION(_CVar, GetInt)
{
PARAM_SELF_STRUCT_PROLOGUE(FBaseCVar);
auto v = self->GetGenericRep(CVAR_Int);
ACTION_RETURN_INT(v.Int);
}
DEFINE_ACTION_FUNCTION(_CVar, GetFloat)
{
PARAM_SELF_STRUCT_PROLOGUE(FBaseCVar);
auto v = self->GetGenericRep(CVAR_Float);
ACTION_RETURN_FLOAT(v.Float);
}
DEFINE_ACTION_FUNCTION(_CVar, GetString)
{
PARAM_SELF_STRUCT_PROLOGUE(FBaseCVar);
auto v = self->GetGenericRep(CVAR_String);
ACTION_RETURN_STRING(v.String);
}
DEFINE_ACTION_FUNCTION(_CVar, SetInt)
{
// Only menus are allowed to change CVARs.
PARAM_SELF_STRUCT_PROLOGUE(FBaseCVar);
if (!(self->GetFlags() & CVAR_MOD))
{
// Only menus are allowed to change non-mod CVARs.
if (DMenu::InMenu == 0)
{
ThrowAbortException(X_OTHER, "Attempt to change CVAR '%s' outside of menu code", self->GetName());
}
}
PARAM_INT(val);
UCVarValue v;
v.Int = val;
self->SetGenericRep(v, CVAR_Int);
return 0;
}
DEFINE_ACTION_FUNCTION(_CVar, SetFloat)
{
PARAM_SELF_STRUCT_PROLOGUE(FBaseCVar);
if (!(self->GetFlags() & CVAR_MOD))
{
// Only menus are allowed to change non-mod CVARs.
if (DMenu::InMenu == 0)
{
ThrowAbortException(X_OTHER, "Attempt to change CVAR '%s' outside of menu code", self->GetName());
}
}
PARAM_FLOAT(val);
UCVarValue v;
v.Float = (float)val;
self->SetGenericRep(v, CVAR_Float);
return 0;
}
DEFINE_ACTION_FUNCTION(_CVar, SetString)
{
// Only menus are allowed to change CVARs.
PARAM_SELF_STRUCT_PROLOGUE(FBaseCVar);
if (!(self->GetFlags() & CVAR_MOD))
{
// Only menus are allowed to change non-mod CVARs.
if (DMenu::InMenu == 0)
{
ThrowAbortException(X_OTHER, "Attempt to change CVAR '%s' outside of menu code", self->GetName());
}
}
PARAM_STRING(val);
UCVarValue v;
v.String = val.GetChars();
self->SetGenericRep(v, CVAR_String);
return 0;
}
DEFINE_ACTION_FUNCTION(_CVar, GetRealType)
{
PARAM_SELF_STRUCT_PROLOGUE(FBaseCVar);
ACTION_RETURN_INT(self->GetRealType());
}
DEFINE_ACTION_FUNCTION(_CVar, ResetToDefault)
{
PARAM_SELF_STRUCT_PROLOGUE(FBaseCVar);
if (!(self->GetFlags() & CVAR_MOD))
{
// Only menus are allowed to change non-mod CVARs.
if (DMenu::InMenu == 0)
{
ThrowAbortException(X_OTHER, "Attempt to change CVAR '%s' outside of menu code", self->GetName());
}
}
self->ResetToDefault();
return 0;
}
DEFINE_ACTION_FUNCTION(_CVar, FindCVar)
{
PARAM_PROLOGUE;
PARAM_NAME(name);
ACTION_RETURN_POINTER(FindCVar(name.GetChars(), nullptr));
}
//=============================================================================
//
//
//
//=============================================================================
DEFINE_ACTION_FUNCTION(FKeyBindings, SetBind)
{
PARAM_SELF_STRUCT_PROLOGUE(FKeyBindings);
PARAM_INT(k);
PARAM_STRING(cmd);
// Only menus are allowed to change bindings.
if (DMenu::InMenu == 0)
{
I_FatalError("Attempt to change key bindings outside of menu code to '%s'", cmd.GetChars());
}
self->SetBind(k, cmd);
return 0;
}
DEFINE_ACTION_FUNCTION(FKeyBindings, NameKeys)
{
PARAM_PROLOGUE;
PARAM_INT(k1);
PARAM_INT(k2);
char buffer[120];
C_NameKeys(buffer, k1, k2);
ACTION_RETURN_STRING(buffer);
}
DEFINE_ACTION_FUNCTION(FKeyBindings, GetKeysForCommand)
{
PARAM_SELF_STRUCT_PROLOGUE(FKeyBindings);
PARAM_STRING(cmd);
int k1, k2;
self->GetKeysForCommand(cmd.GetChars(), &k1, &k2);
if (numret > 0) ret[0].SetInt(k1);
if (numret > 1) ret[1].SetInt(k2);
return MIN(numret, 2);
}
DEFINE_ACTION_FUNCTION(FKeyBindings, UnbindACommand)
{
PARAM_SELF_STRUCT_PROLOGUE(FKeyBindings);
PARAM_STRING(cmd);
// Only menus are allowed to change bindings.
if (DMenu::InMenu == 0)
{
I_FatalError("Attempt to unbind key bindings for '%s' outside of menu code", cmd.GetChars());
}
self->UnbindACommand(cmd);
return 0;
}
// This is only accessible to the special menu item to run CCMDs.
DEFINE_ACTION_FUNCTION(DOptionMenuItemCommand, DoCommand)
{
if (CurrentMenu == nullptr) return 0;
PARAM_PROLOGUE;
PARAM_STRING(cmd);
PARAM_BOOL(unsafe);
UnsafeExecutionScope scope(unsafe);
C_DoCommand(cmd);
return 0;
}
DEFINE_ACTION_FUNCTION(_Console, MidPrint)
{
PARAM_PROLOGUE;
PARAM_POINTER(fnt, FFont);
PARAM_STRING(text);
PARAM_BOOL(bold);
const char* txt = text[0] == '$' ? GStrings(&text[1]) : text.GetChars();
C_MidPrint(fnt, txt, bold);
return 0;
}
DEFINE_ACTION_FUNCTION(_Console, HideConsole)
{
C_HideConsole();
return 0;
}
DEFINE_ACTION_FUNCTION(_Console, Printf)
{
PARAM_PROLOGUE;
PARAM_VA_POINTER(va_reginfo) // Get the hidden type information array
FString s = FStringFormat(VM_ARGS_NAMES);
Printf("%s\n", s.GetChars());
return 0;
}
DEFINE_GLOBAL_NAMED(mus_playing, musplaying);
DEFINE_FIELD_X(MusPlayingInfo, MusPlayingInfo, name);
DEFINE_FIELD_X(MusPlayingInfo, MusPlayingInfo, baseorder);
DEFINE_FIELD_X(MusPlayingInfo, MusPlayingInfo, loop);
DEFINE_GLOBAL_NAMED(PClass::AllClasses, AllClasses)
DEFINE_GLOBAL(Bindings)

View file

@ -360,6 +360,10 @@ static int ExecScriptFunc(VMFrameStack *stack, VMReturn *ret, int numret)
OP(SS): OP(SS):
ASSERTA(a); ASSERTS(B); ASSERTKD(C); ASSERTA(a); ASSERTS(B); ASSERTKD(C);
GETADDR(PA,KC,X_WRITE_NIL); GETADDR(PA,KC,X_WRITE_NIL);
#ifdef _DEBUG
// Should never happen, if it does it indicates a compiler side problem.
if (((FString*)ptr)->GetChars() == nullptr) ThrowAbortException(X_OTHER, "Uninitialized string");
#endif
*(FString *)ptr = reg.s[B]; *(FString *)ptr = reg.s[B];
NEXTOP; NEXTOP;
OP(SS_R): OP(SS_R):

View file

@ -103,7 +103,7 @@ class FGameTexture
int flags = 0; int flags = 0;
uint8_t warped = 0; uint8_t warped = 0;
int8_t expandSprite = -1; int8_t expandSprite = -1;
uint16_t GlowHeight; uint16_t GlowHeight = 128;
PalEntry GlowColor = 0; PalEntry GlowColor = 0;
int16_t SkyOffset = 0; int16_t SkyOffset = 0;

View file

@ -3,6 +3,7 @@
#include <stdint.h> #include <stdint.h>
#include "tarray.h" #include "tarray.h"
#include "textureid.h" #include "textureid.h"
#include "textures.h"
#include "basics.h" #include "basics.h"
#include "texmanip.h" #include "texmanip.h"
#include "name.h" #include "name.h"

View file

@ -54,7 +54,7 @@
#endif #endif
#ifndef _DEBUG #ifndef _DEBUG
#if !defined(__solaris__) && !defined(__OpenBSD__) #if !defined(__solaris__) && !defined(__OpenBSD__) && !defined(__DragonFly__)
void *M_Malloc(size_t size) void *M_Malloc(size_t size)
{ {
void *block = malloc(size); void *block = malloc(size);
@ -124,7 +124,7 @@ void *M_Realloc(void *memblock, size_t size)
#include <crtdbg.h> #include <crtdbg.h>
#endif #endif
#if !defined(__solaris__) && !defined(__OpenBSD__) #if !defined(__solaris__) && !defined(__OpenBSD__) && !defined(__DragonFly__)
void *M_Malloc_Dbg(size_t size, const char *file, int lineno) void *M_Malloc_Dbg(size_t size, const char *file, int lineno)
{ {
void *block = _malloc_dbg(size, _NORMAL_BLOCK, file, lineno); void *block = _malloc_dbg(size, _NORMAL_BLOCK, file, lineno);
@ -192,7 +192,7 @@ void *M_Realloc_Dbg(void *memblock, size_t size, const char *file, int lineno)
#endif #endif
#endif #endif
#if !defined(__solaris__) && !defined(__OpenBSD__) #if !defined(__solaris__) && !defined(__OpenBSD__) && !defined(__DragonFly__)
void M_Free (void *block) void M_Free (void *block)
{ {
if (block != NULL) if (block != NULL)

View file

@ -1759,7 +1759,6 @@ CCMD(toggleconsole)
C_ToggleConsole(); C_ToggleConsole();
} }
#if 0 // The Build engine cannot do this at the moment. Q: Implement and redirect some messages here?
/* Printing in the middle of the screen */ /* Printing in the middle of the screen */
CVAR(Float, con_midtime, 3.f, CVAR_ARCHIVE) CVAR(Float, con_midtime, 3.f, CVAR_ARCHIVE)
@ -1768,6 +1767,7 @@ const char *console_bar = "----------------------------------------";
void C_MidPrint (FFont *font, const char *msg, bool bold) void C_MidPrint (FFont *font, const char *msg, bool bold)
{ {
#if 0 // The Build engine cannot do this at the moment. Q: Implement and redirect some messages here?
if (StatusBar == nullptr || screen == nullptr) if (StatusBar == nullptr || screen == nullptr)
return; return;
@ -1793,8 +1793,8 @@ void C_MidPrint (FFont *font, const char *msg, bool bold)
{ {
StatusBar->DetachMessage (MAKE_ID('C','N','T','R')); StatusBar->DetachMessage (MAKE_ID('C','N','T','R'));
} }
}
#endif #endif
}
/****** Tab completion code ******/ /****** Tab completion code ******/

View file

@ -40,10 +40,6 @@
#include "inputstate.h" #include "inputstate.h"
#include "menu.h" #include "menu.h"
int eventhead;
int eventtail;
event_t events[NUM_EVENTS];
//========================================================================== //==========================================================================
// //
// G_Responder // G_Responder
@ -87,35 +83,6 @@ bool G_Responder (event_t *ev)
} }
//==========================================================================
//
// D_ProcessEvents
//
// Send all the events of the given timestamp down the responder chain.
// Events are asynchronous inputs generally generated by the game user.
// Events can be discarded if no responder claims them
//
//==========================================================================
void D_ProcessEvents (void)
{
event_t *ev;
while (eventtail != eventhead)
{
ev = &events[eventtail];
eventtail = (eventtail + 1) & (NUM_EVENTS - 1);
if (ev->type == EV_None)
continue;
/*if (ev->type == EV_DeviceChange)
UpdateJoystickMenu(I_UpdateDeviceList());*/
if (C_Responder (ev))
continue; // console ate the event
if (M_Responder (ev))
continue; // menu ate the event
G_Responder (ev);
}
}
//========================================================================== //==========================================================================
// //
// D_PostEvent // D_PostEvent
@ -143,41 +110,6 @@ void D_PostEvent (const event_t *ev)
// Also add it to the event queue. // Also add it to the event queue.
events[eventhead] = *ev; events[eventhead] = *ev;
eventhead = (eventhead+1)&(NUM_EVENTS-1); eventhead = (eventhead+1)&(MAXEVENTS-1);
}
//==========================================================================
//
// D_RemoveNextCharEvent
//
// Removes the next EV_GUI_Char event in the input queue. Used by the menu,
// since it (generally) consumes EV_GUI_KeyDown events and not EV_GUI_Char
// events, and it needs to ensure that there is no left over input when it's
// done. If there are multiple EV_GUI_KeyDowns before the EV_GUI_Char, then
// there are dead chars involved, so those should be removed, too. We do
// this by changing the message type to EV_None rather than by actually
// removing the event from the queue.
//
//==========================================================================
void D_RemoveNextCharEvent()
{
assert(events[eventtail].type == EV_GUI_Event && events[eventtail].subtype == EV_GUI_KeyDown);
for (int evnum = eventtail; evnum != eventhead; evnum = (evnum+1) & (NUM_EVENTS-1))
{
event_t *ev = &events[evnum];
if (ev->type != EV_GUI_Event)
break;
if (ev->subtype == EV_GUI_KeyDown || ev->subtype == EV_GUI_Char)
{
ev->type = EV_None;
if (ev->subtype == EV_GUI_Char)
break;
}
else
{
break;
}
}
} }

View file

@ -1,40 +1,8 @@
#pragma once #pragma once
#include <functional> #include <functional>
#include "d_eventbase.h"
// Input event types.
enum EGenericEvent
{
EV_None,
EV_KeyDown, // data1: scan code, data2: Qwerty ASCII code
EV_KeyUp, // same
EV_Mouse, // x, y: mouse movement deltas
EV_GUI_Event, // subtype specifies actual event
EV_DeviceChange,// a device has been connected or removed
};
// Event structure.
struct event_t
{
uint8_t type;
uint8_t subtype;
int16_t data1; // keys / mouse/joystick buttons
int16_t data2;
int16_t data3;
int x; // mouse/joystick x move
int y; // mouse/joystick y move
};
// Called by IO functions when input is detected. // Called by IO functions when input is detected.
void D_PostEvent (const event_t* ev); void D_PostEvent (const event_t* ev);
void D_RemoveNextCharEvent();
void D_ProcessEvents(void);
enum
{
NUM_EVENTS = 128
};
extern event_t events[NUM_EVENTS];

View file

@ -1111,3 +1111,7 @@ void updatePauseStatus()
} }
} }
bool OkForLocalization(FTextureID texnum, const char* substitute)
{
return false;
}

View file

@ -418,9 +418,9 @@ void UpdateJoystickMenu(IJoystickConfig *selected)
if (i == (int)Joysticks.Size()) if (i == (int)Joysticks.Size())
{ {
SELECTED_JOYSTICK = NULL; SELECTED_JOYSTICK = NULL;
if (DMenu::CurrentMenu != NULL && dynamic_cast<DJoystickConfigMenu*>(DMenu::CurrentMenu)) if (CurrentMenu != NULL && dynamic_cast<DJoystickConfigMenu*>(CurrentMenu))
{ {
DMenu::CurrentMenu->Close(); CurrentMenu->Close();
} }
} }
} }

View file

@ -536,7 +536,7 @@ bool FListMenuItemSelectable::MouseEvent(int type, int x, int y)
{ {
if (type == DMenu::MOUSE_Release) if (type == DMenu::MOUSE_Release)
{ {
if (NULL != DMenu::CurrentMenu && DMenu::CurrentMenu->MenuEvent(MKEY_Enter, true)) if (NULL != CurrentMenu && CurrentMenu->MenuEvent(MKEY_Enter, true))
{ {
return true; return true;
} }

View file

@ -33,7 +33,7 @@
** **
*/ */
#include "menu/menu.h" #include "menu.h"
#include "version.h" #include "version.h"
#include "m_png.h" #include "m_png.h"
#include "filesystem.h" #include "filesystem.h"

View file

@ -85,8 +85,9 @@ CVAR(Int, m_show_backbutton, 0, CVAR_ARCHIVE|CVAR_GLOBALCONFIG)
TArray<MenuClassDescriptor*> menuClasses(TArray<MenuClassDescriptor*>::ENoInit(0)); TArray<MenuClassDescriptor*> menuClasses(TArray<MenuClassDescriptor*>::ENoInit(0));
DMenu *DMenu::CurrentMenu; DMenu *CurrentMenu;
int DMenu::MenuTime; int DMenu::MenuTime;
bool DMenu::InMenu;
FNewGameStartup NewGameStartupInfo; FNewGameStartup NewGameStartupInfo;
EMenuState menuactive; EMenuState menuactive;
@ -207,7 +208,7 @@ bool DMenu::MenuEvent (int mkey, bool fromcontroller)
{ {
if (scriptID != 0) if (scriptID != 0)
{ {
M_MenuSound(DMenu::CurrentMenu->mParentMenu? BackSound : CloseSound); M_MenuSound(CurrentMenu->mParentMenu? BackSound : CloseSound);
Close(); Close();
return true; return true;
} }
@ -224,24 +225,24 @@ bool DMenu::MenuEvent (int mkey, bool fromcontroller)
void DMenu::Close () void DMenu::Close ()
{ {
assert(DMenu::CurrentMenu == this); assert(CurrentMenu == this);
DMenu::CurrentMenu = mParentMenu; CurrentMenu = mParentMenu;
if (mParentMenu && transition.StartTransition(this, mParentMenu, MA_Return)) if (mParentMenu && transition.StartTransition(this, mParentMenu, MA_Return))
{ {
g_currentMenu = DMenu::CurrentMenu->scriptID; g_currentMenu = CurrentMenu->scriptID;
} }
else else
{ {
Destroy(); Destroy();
toDelete.Push(this); toDelete.Push(this);
if (DMenu::CurrentMenu == NULL) if (CurrentMenu == NULL)
{ {
M_ClearMenus(); M_ClearMenus();
} }
else else
{ {
g_currentMenu = DMenu::CurrentMenu->scriptID; g_currentMenu = CurrentMenu->scriptID;
} }
} }
} }
@ -322,7 +323,7 @@ void DMenu::Ticker ()
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)
{ {
auto texid = TexMan.CheckForTexture("engine/graphics/m_back.png", ETextureType::Any); auto texid = TexMan.CheckForTexture("engine/graphics/m_back.png", ETextureType::Any);
if (texid.isValid()) if (texid.isValid())
@ -365,7 +366,7 @@ void M_StartControlPanel (bool makeSound)
{ {
static bool created = false; static bool created = false;
// intro might call this repeatedly // intro might call this repeatedly
if (DMenu::CurrentMenu != NULL) if (CurrentMenu != NULL)
return; return;
if (!created) // Cannot do this earlier. if (!created) // Cannot do this earlier.
@ -396,7 +397,7 @@ void M_StartControlPanel (bool makeSound)
void Menu_Open(int playerid) void Menu_Open(int playerid)
{ {
M_StartControlPanel(DMenu::CurrentMenu == nullptr); M_StartControlPanel(CurrentMenu == nullptr);
} }
//============================================================================= //=============================================================================
@ -409,12 +410,12 @@ void M_ActivateMenu(DMenu *menu)
{ {
g_currentMenu = menu->scriptID; g_currentMenu = menu->scriptID;
if (menuactive == MENU_Off) menuactive = MENU_On; if (menuactive == MENU_Off) menuactive = MENU_On;
if (DMenu::CurrentMenu != NULL) if (CurrentMenu != NULL)
{ {
DMenu::CurrentMenu->ReleaseCapture(); CurrentMenu->ReleaseCapture();
transition.StartTransition(DMenu::CurrentMenu, menu, MA_Advance); transition.StartTransition(CurrentMenu, menu, MA_Advance);
} }
DMenu::CurrentMenu = menu; CurrentMenu = menu;
DMenu::MenuTime = -1; DMenu::MenuTime = -1;
M_Ticker(); // This needs to be called once here to make sure that the menu actually has ticked before it gets drawn for the first time. M_Ticker(); // This needs to be called once here to make sure that the menu actually has ticked before it gets drawn for the first time.
} }
@ -482,8 +483,8 @@ bool M_SetMenu(FName menu, int param, FName caller)
case NAME_EngineCredits: case NAME_EngineCredits:
case NAME_EngineCredits2: case NAME_EngineCredits2:
{ {
auto m = DMenu::CurrentMenu; auto m = CurrentMenu;
DMenu::CurrentMenu = m->mParentMenu; CurrentMenu = m->mParentMenu;
m->mParentMenu = nullptr; m->mParentMenu = nullptr;
toDelete.Push(m); toDelete.Push(m);
break; break;
@ -579,7 +580,7 @@ bool M_SetMenu(FName menu, int param, FName caller)
{ {
newmenu = new DListMenu; newmenu = new DListMenu;
} }
newmenu->Init(DMenu::CurrentMenu, ld); newmenu->Init(CurrentMenu, ld);
M_ActivateMenu(newmenu); M_ActivateMenu(newmenu);
} }
} }
@ -603,7 +604,7 @@ bool M_SetMenu(FName menu, int param, FName caller)
{ {
newmenu = new DOptionMenu; newmenu = new DOptionMenu;
} }
newmenu->Init(DMenu::CurrentMenu, ld); newmenu->Init(CurrentMenu, ld);
M_ActivateMenu(newmenu); M_ActivateMenu(newmenu);
} }
else if ((*desc)->mType == MDESC_ImageScroller) else if ((*desc)->mType == MDESC_ImageScroller)
@ -627,7 +628,7 @@ bool M_SetMenu(FName menu, int param, FName caller)
{ {
newmenu = new DImageScrollerMenu; newmenu = new DImageScrollerMenu;
} }
newmenu->Init(DMenu::CurrentMenu, ld); newmenu->Init(CurrentMenu, ld);
M_ActivateMenu(newmenu); M_ActivateMenu(newmenu);
} }
return true; return true;
@ -641,7 +642,7 @@ bool M_SetMenu(FName menu, int param, FName caller)
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 true; return true;
} }
@ -673,7 +674,7 @@ bool M_DoResponder (event_t *ev)
} }
*/ */
if (DMenu::CurrentMenu != NULL && menuactive != MENU_Off) if (CurrentMenu != NULL && menuactive != MENU_Off)
{ {
// There are a few input sources we are interested in: // There are a few input sources we are interested in:
// //
@ -708,9 +709,9 @@ bool M_DoResponder (event_t *ev)
} }
// pass everything else on to the current menu // pass everything else on to the current menu
return DMenu::CurrentMenu->Responder(ev); return CurrentMenu->Responder(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;
@ -729,7 +730,7 @@ bool M_DoResponder (event_t *ev)
default: default:
if (!keyup) if (!keyup)
{ {
return DMenu::CurrentMenu->Responder(ev); return CurrentMenu->Responder(ev);
} }
break; break;
} }
@ -812,11 +813,11 @@ bool M_DoResponder (event_t *ev)
{ {
MenuButtonTickers[mkey] = KEY_REPEAT_DELAY; MenuButtonTickers[mkey] = KEY_REPEAT_DELAY;
} }
DMenu::CurrentMenu->MenuEvent(mkey, fromcontroller); CurrentMenu->MenuEvent(mkey, fromcontroller);
return true; return true;
} }
} }
return DMenu::CurrentMenu->Responder(ev) || !keyup; return CurrentMenu->Responder(ev) || !keyup;
} }
else if (MenuEnabled) else if (MenuEnabled)
{ {
@ -871,12 +872,12 @@ void M_Ticker (void)
{ {
DMenu::MenuTime++; DMenu::MenuTime++;
if (DMenu::MenuTime & 3) return; if (DMenu::MenuTime & 3) return;
if (DMenu::CurrentMenu != NULL && menuactive != MENU_Off) if (CurrentMenu != NULL && menuactive != MENU_Off)
{ {
if (DMenu::MenuTime != 0) D_ProcessEvents(); // The main loop is blocked when the menu is open and cannot dispatch the events. if (DMenu::MenuTime != 0) D_ProcessEvents(); // The main loop is blocked when the menu is open and cannot dispatch the events.
if (transition.previous) transition.previous->Ticker(); if (transition.previous) transition.previous->Ticker();
if (DMenu::CurrentMenu == nullptr) return; // In case one of the sub-screens has closed the menu. if (CurrentMenu == nullptr) return; // In case one of the sub-screens has closed the menu.
DMenu::CurrentMenu->Ticker(); CurrentMenu->Ticker();
for (int i = 0; i < NUM_MKEYS; ++i) for (int i = 0; i < NUM_MKEYS; ++i)
{ {
@ -885,7 +886,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->MenuEvent(i, MenuButtonOrigin[i]); CurrentMenu->MenuEvent(i, MenuButtonOrigin[i]);
} }
} }
} }
@ -912,9 +913,9 @@ void M_Drawer (void)
{ {
PalEntry fade = 0x70000000; PalEntry fade = 0x70000000;
if (DMenu::CurrentMenu != NULL && menuactive != MENU_Off) if (CurrentMenu != NULL && menuactive != MENU_Off)
{ {
if (DMenu::CurrentMenu->DimAllowed() && fade && !DrawBackground) twod->AddColorOnlyQuad(0, 0, screen->GetWidth(), screen->GetHeight(), fade); if (CurrentMenu->DimAllowed() && fade && !DrawBackground) twod->AddColorOnlyQuad(0, 0, screen->GetWidth(), screen->GetHeight(), fade);
bool going = false; bool going = false;
if (transition.previous) if (transition.previous)
@ -929,10 +930,10 @@ void M_Drawer (void)
} }
if (!going) if (!going)
{ {
assert(DMenu::CurrentMenu); assert(CurrentMenu);
DMenu::CurrentMenu->origin = { 0,0 }; CurrentMenu->origin = { 0,0 };
// else if (DrawBackground) Menu_DrawBackground(origin); // else if (DrawBackground) Menu_DrawBackground(origin);
DMenu::CurrentMenu->Drawer(); CurrentMenu->Drawer();
} }
} }
} }
@ -954,7 +955,7 @@ void M_ClearMenus (bool final)
M_DemoNoPlay = false; M_DemoNoPlay = false;
transition.previous = transition.current = nullptr; transition.previous = transition.current = nullptr;
transition.dir = 0; transition.dir = 0;
auto menu = DMenu::CurrentMenu; auto menu = CurrentMenu;
while (menu != nullptr) while (menu != nullptr)
{ {
auto nextm = menu->mParentMenu; auto nextm = menu->mParentMenu;
@ -962,7 +963,7 @@ void M_ClearMenus (bool final)
delete menu; delete menu;
menu = nextm; menu = nextm;
} }
DMenu::CurrentMenu = nullptr; CurrentMenu = nullptr;
menuactive = MENU_Off; menuactive = MENU_Off;
M_UnpauseSound(); M_UnpauseSound();
if (!final) if (!final)
@ -978,7 +979,7 @@ void Menu_Close(int playerid)
bool M_Active() bool M_Active()
{ {
return DMenu::CurrentMenu != nullptr || ConsoleState == c_down || ConsoleState == c_falling; return CurrentMenu != nullptr || ConsoleState == c_down || ConsoleState == c_falling;
} }
//============================================================================= //=============================================================================
@ -1000,11 +1001,11 @@ void M_MenuSound(EMenuSounds snd)
void M_PreviousMenu() void M_PreviousMenu()
{ {
if (DMenu::CurrentMenu != nullptr) if (CurrentMenu != nullptr)
{ {
DMenu* parent = DMenu::CurrentMenu->mParentMenu; DMenu* parent = CurrentMenu->mParentMenu;
DMenu::CurrentMenu->Destroy(); CurrentMenu->Destroy();
DMenu::CurrentMenu = parent; CurrentMenu = parent;
} }
} }
@ -1122,3 +1123,4 @@ CCMD(openloadmenu)
M_StartControlPanel(true); M_StartControlPanel(true);
M_SetMenu(NAME_Loadgamemenu); M_SetMenu(NAME_Loadgamemenu);
} }

View file

@ -11,6 +11,7 @@
#include "zstring.h" #include "zstring.h"
#include "baselayer.h" #include "baselayer.h"
#include "v_draw.h" #include "v_draw.h"
#include "menustate.h"
EXTERN_CVAR(Float, snd_menuvolume) EXTERN_CVAR(Float, snd_menuvolume)
EXTERN_CVAR(Int, m_use_mouse); EXTERN_CVAR(Int, m_use_mouse);
@ -85,14 +86,6 @@ typedef struct MenuGameplayStemEntry
extern MenuGameplayStemEntry g_MenuGameplayEntries[MAXMENUGAMEPLAYENTRIES]; extern MenuGameplayStemEntry g_MenuGameplayEntries[MAXMENUGAMEPLAYENTRIES];
enum EMenuState : int
{
MENU_Off, // Menu is closed
MENU_On, // Menu is opened
MENU_WaitKey, // Menu is opened and waiting for a key in the controls menu
MENU_OnNoPause, // Menu is opened but does not pause the game
};
enum EMenuSounds : int enum EMenuSounds : int
{ {
ActivateSound, ActivateSound,
@ -326,8 +319,8 @@ public:
BACKBUTTON_TIME = 4*MENU_TICRATE BACKBUTTON_TIME = 4*MENU_TICRATE
}; };
static DMenu *CurrentMenu;
static int MenuTime; static int MenuTime;
static bool InMenu;
DMenu *mParentMenu; DMenu *mParentMenu;
DVector2 origin = { 0,0 }; DVector2 origin = { 0,0 };
@ -842,5 +835,6 @@ public:
}; };
extern FSavegameManager savegameManager; extern FSavegameManager savegameManager;
extern DMenu* CurrentMenu;
#endif #endif

View file

@ -100,7 +100,7 @@ void M_DeinitMenus()
MenuDescriptors.Clear(); MenuDescriptors.Clear();
OptionValues.Clear(); OptionValues.Clear();
DMenu::CurrentMenu = NULL; CurrentMenu = NULL;
DefaultListMenuSettings.mItems.Clear(); DefaultListMenuSettings.mItems.Clear();
} }

View file

@ -33,7 +33,7 @@
** **
*/ */
#include "menu/menu.h" #include "menu.h"
#include "c_cvars.h" #include "c_cvars.h"
#include "d_event.h" #include "d_event.h"
#include "d_gui.h" #include "d_gui.h"

View file

@ -132,7 +132,7 @@ void DMessageBoxMenu::Destroy()
void DMessageBoxMenu::CloseSound() void DMessageBoxMenu::CloseSound()
{ {
M_MenuSound(DMenu::CurrentMenu ? BackSound : ::CloseSound); M_MenuSound(CurrentMenu ? BackSound : ::CloseSound);
} }
//============================================================================= //=============================================================================
@ -362,13 +362,13 @@ bool DMessageBoxMenu::MouseEvent(int type, int x, int y)
void M_StartMessage(const char *message, int messagemode, int scriptId, FName action) void M_StartMessage(const char *message, int messagemode, int scriptId, 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;
newmenu->scriptID = scriptId; newmenu->scriptID = scriptId;
M_ActivateMenu(newmenu); M_ActivateMenu(newmenu);
} }
@ -382,7 +382,7 @@ void M_StartMessage(const char *message, int messagemode, int scriptId, FName ac
DMenu* CreateMessageBoxMenu(DMenu* parent, const char* message, int messagemode, int scriptId, bool playsound, FName action, hFunc handler) DMenu* CreateMessageBoxMenu(DMenu* parent, const char* message, int messagemode, int scriptId, bool playsound, FName action, hFunc handler)
{ {
auto newmenu = new DMessageBoxMenu(DMenu::CurrentMenu, message, messagemode, false, action, handler); auto newmenu = new DMessageBoxMenu(CurrentMenu, message, messagemode, false, action, handler);
newmenu->scriptID = scriptId; newmenu->scriptID = scriptId;
return newmenu; return newmenu;
@ -403,7 +403,7 @@ CCMD (menu_endgame)
M_StartControlPanel (true); M_StartControlPanel (true);
FString tempstring; FString tempstring;
tempstring << GStrings("ENDGAME") << "\n\n" << GStrings("PRESSYN"); tempstring << GStrings("ENDGAME") << "\n\n" << GStrings("PRESSYN");
DMenu* newmenu = CreateMessageBoxMenu(DMenu::CurrentMenu, tempstring, 0, 501, false, NAME_None, [](bool res) DMenu* newmenu = CreateMessageBoxMenu(CurrentMenu, tempstring, 0, 501, false, NAME_None, [](bool res)
{ {
if (res) if (res)
{ {
@ -429,7 +429,7 @@ CCMD (menu_quit)
FString EndString; FString EndString;
EndString << GStrings("CONFIRM_QUITMSG") << "\n\n" << GStrings("PRESSYN"); EndString << GStrings("CONFIRM_QUITMSG") << "\n\n" << GStrings("PRESSYN");
DMenu *newmenu = CreateMessageBoxMenu(DMenu::CurrentMenu, EndString, 0, 500, false, NAME_None, [](bool res) DMenu *newmenu = CreateMessageBoxMenu(CurrentMenu, EndString, 0, 500, false, NAME_None, [](bool res)
{ {
if (res) throw CExitEvent(0); if (res) throw CExitEvent(0);
}); });

View file

@ -42,7 +42,7 @@
#include "c_cvars.h" #include "c_cvars.h"
#include "c_bind.h" #include "c_bind.h"
#include "gameconfigfile.h" #include "gameconfigfile.h"
#include "menu/menu.h" #include "menu.h"
#include "v_draw.h" #include "v_draw.h"
#include "v_2ddrawer.h" #include "v_2ddrawer.h"
#include "v_video.h" #include "v_video.h"
@ -428,7 +428,7 @@ void DOptionMenu::Drawer ()
int cur_indent = mDesc->mItems[i]->Draw(mDesc, y, indent, isSelected); int cur_indent = mDesc->mItems[i]->Draw(mDesc, y, indent, isSelected);
if (cur_indent >= 0 && isSelected && mDesc->mItems[i]->Selectable()) if (cur_indent >= 0 && isSelected && mDesc->mItems[i]->Selectable())
{ {
if ((((DMenu::MenuTime>>2)%8) < 6) || DMenu::CurrentMenu != this) if ((((DMenu::MenuTime>>2)%8) < 6) || CurrentMenu != this)
{ {
DrawOptionText(cur_indent + 3 * CleanXfac_1, y, OptionSettings.mFontColorSelection, ""); DrawOptionText(cur_indent + 3 * CleanXfac_1, y, OptionSettings.mFontColorSelection, "");
//M_DrawConText(OptionSettings.mFontColorSelection, cur_indent + 3 * CleanXfac_1, y+fontheight-9*CleanYfac_1, "\xd"); //M_DrawConText(OptionSettings.mFontColorSelection, cur_indent + 3 * CleanXfac_1, y+fontheight-9*CleanYfac_1, "\xd");
@ -478,7 +478,7 @@ bool FOptionMenuItem::MouseEvent(int type, int x, int y)
{ {
if (Selectable() && type == DMenu::MOUSE_Release) if (Selectable() && type == DMenu::MOUSE_Release)
{ {
return DMenu::CurrentMenu->MenuEvent(MKEY_Enter, true); return CurrentMenu->MenuEvent(MKEY_Enter, true);
} }
return false; return false;
} }

View file

@ -68,7 +68,7 @@ public:
bool Activate(FName caller) override bool Activate(FName caller) override
{ {
M_MenuSound(CursorSound); M_MenuSound(CursorSound);
M_SetMenu(mAction, mParam, static_cast<DOptionMenu*>(DMenu::CurrentMenu)->GetDescriptor()->mMenuName); M_SetMenu(mAction, mParam, static_cast<DOptionMenu*>(CurrentMenu)->GetDescriptor()->mMenuName);
return true; return true;
} }
}; };
@ -481,7 +481,7 @@ public:
{ {
M_MenuSound(AdvanceSound); M_MenuSound(AdvanceSound);
mWaiting = true; mWaiting = true;
DMenu *input = new DEnterKey(DMenu::CurrentMenu, &mInput); DMenu *input = new DEnterKey(CurrentMenu, &mInput);
M_ActivateMenu(input); M_ActivateMenu(input);
return true; return true;
} }
@ -685,7 +685,7 @@ public:
bool MouseEvent(int type, int x, int y) override bool MouseEvent(int type, int x, int y) override
{ {
DOptionMenu *lm = static_cast<DOptionMenu*>(DMenu::CurrentMenu); DOptionMenu *lm = static_cast<DOptionMenu*>(CurrentMenu);
if (type != DMenu::MOUSE_Click) if (type != DMenu::MOUSE_Click)
{ {
if (!lm->CheckFocus(this)) return false; if (!lm->CheckFocus(this)) return false;
@ -905,7 +905,7 @@ public:
{ {
M_MenuSound(AdvanceSound); M_MenuSound(AdvanceSound);
mEntering = true; mEntering = true;
mInput = new DTextEnterMenu(DMenu::CurrentMenu, NewSmallFont, GetCVarString(), 256, fromcontroller ); mInput = new DTextEnterMenu(CurrentMenu, NewSmallFont, GetCVarString(), 256, fromcontroller );
M_ActivateMenu( mInput ); M_ActivateMenu( mInput );
return true; return true;
} }

View file

@ -35,7 +35,7 @@
#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"
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)

View file

@ -33,7 +33,7 @@
** **
*/ */
#include "menu/menu.h" #include "menu.h"
#include "version.h" #include "version.h"
#include "m_png.h" #include "m_png.h"
#include "filesystem.h" #include "filesystem.h"
@ -660,7 +660,7 @@ CCMD(quicksave)
tempstring.Substitute("%s", slot->SaveTitle.GetChars()); tempstring.Substitute("%s", slot->SaveTitle.GetChars());
M_StartControlPanel(true); M_StartControlPanel(true);
DMenu* newmenu = CreateMessageBoxMenu(DMenu::CurrentMenu, tempstring, 0, INT_MAX, false, NAME_None, [](bool res) DMenu* newmenu = CreateMessageBoxMenu(CurrentMenu, tempstring, 0, INT_MAX, false, NAME_None, [](bool res)
{ {
if (res) if (res)
{ {
@ -708,7 +708,7 @@ CCMD(quickload)
M_StartControlPanel(true); M_StartControlPanel(true);
DMenu* newmenu = CreateMessageBoxMenu(DMenu::CurrentMenu, tempstring, 0, INT_MAX, false, NAME_None, [](bool res) DMenu* newmenu = CreateMessageBoxMenu(CurrentMenu, tempstring, 0, INT_MAX, false, NAME_None, [](bool res)
{ {
if (res) if (res)
{ {

View file

@ -34,7 +34,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#include "gamecvars.h" #include "gamecvars.h"
#include "gamecontrol.h" #include "gamecontrol.h"
#include "c_bind.h" #include "c_bind.h"
#include "menu/menu.h" #include "menu.h"
#include "gstrings.h" #include "gstrings.h"
#include "version.h" #include "version.h"
#include "namesdyn.h" #include "namesdyn.h"

View file

@ -29,7 +29,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#include "savegame.h" #include "savegame.h"
#include "screens.h" #include "screens.h"
#include "printf.h" #include "printf.h"
#include "menu/menu.h" #include "menu.h"
BEGIN_DUKE_NS BEGIN_DUKE_NS

View file

@ -32,7 +32,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#include "polymost.h" #include "polymost.h"
#include "gamecvars.h" #include "gamecvars.h"
#include "gamecontrol.h" #include "gamecontrol.h"
#include "menu/menu.h" #include "menu.h"
#include "memarena.h" #include "memarena.h"

View file

@ -48,7 +48,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#include "c_dispatch.h" #include "c_dispatch.h"
#include "filesystem.h" #include "filesystem.h"
#include "statistics.h" #include "statistics.h"
#include "menu/menu.h" #include "menu.h"
#include "mapinfo.h" #include "mapinfo.h"
#include "v_video.h" #include "v_video.h"
#include "glbackend/glbackend.h" #include "glbackend/glbackend.h"

View file

@ -33,7 +33,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#include "gamevars.h" #include "gamevars.h"
#include "mmulti.h" #include "mmulti.h"
#include "network.h" #include "network.h"
#include "menu/menu.h" #include "menu.h"
#include "palette.h" #include "palette.h"
#include "cmdlib.h" #include "cmdlib.h"

View file

@ -36,7 +36,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#include "savegame.h" #include "savegame.h"
#include "printf.h" #include "printf.h"
#include "m_argv.h" #include "m_argv.h"
#include "menu/menu.h" #include "menu.h"
#include "stringtable.h" #include "stringtable.h"
#include "mapinfo.h" #include "mapinfo.h"
#include "gamestructures.h" #include "gamestructures.h"

View file

@ -38,7 +38,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#include "files.h" #include "files.h"
#include "base64.h" #include "base64.h"
#include "version.h" #include "version.h"
#include "menu/menu.h" #include "menu.h"
#include "c_dispatch.h" #include "c_dispatch.h"
#include "quotemgr.h" #include "quotemgr.h"
#include "mapinfo.h" #include "mapinfo.h"

View file

@ -26,7 +26,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#include "menus.h" #include "menus.h"
#include "savegame.h" #include "savegame.h"
#include "gamecvars.h" #include "gamecvars.h"
#include "menu/menu.h" #include "menu.h"
#include "gamestructures.h" #include "gamestructures.h"
BEGIN_DUKE_NS BEGIN_DUKE_NS

View file

@ -30,7 +30,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#include "quotes.h" #include "quotes.h"
#include "sector.h" #include "sector.h"
#include "sounds.h" #include "sounds.h"
#include "menu/menu.h" #include "menu.h"
BEGIN_DUKE_NS BEGIN_DUKE_NS

View file

@ -30,7 +30,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#include "savegame.h" #include "savegame.h"
#include "sbar.h" #include "sbar.h"
#include "statistics.h" #include "statistics.h"
#include "menu/menu.h" #include "menu.h"
#include "mapinfo.h" #include "mapinfo.h"
#include "cmdlib.h" #include "cmdlib.h"
#include "v_2ddrawer.h" #include "v_2ddrawer.h"

View file

@ -31,7 +31,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#include "gamecontrol.h" #include "gamecontrol.h"
#include "version.h" #include "version.h"
#include "savegamehelp.h" #include "savegamehelp.h"
#include "menu/menu.h" #include "menu.h"
#include "mapinfo.h" #include "mapinfo.h"
#include "raze_music.h" #include "raze_music.h"

View file

@ -31,7 +31,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#include "sbar.h" #include "sbar.h"
#include "screens.h" #include "screens.h"
#include "gamecvars.h" #include "gamecvars.h"
#include "menu/menu.h" #include "menu.h"
#include "mapinfo.h" #include "mapinfo.h"
#include "v_2ddrawer.h" #include "v_2ddrawer.h"

View file

@ -31,7 +31,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#include "raze_sound.h" #include "raze_sound.h"
#include "menu/menu.h" #include "menu/menu.h" // to override the local menu.h
#include "../../glbackend/glbackend.h" #include "../../glbackend/glbackend.h"

View file

@ -38,7 +38,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#include "light.h" #include "light.h"
#include "cd.h" #include "cd.h"
#include "raze_sound.h" #include "raze_sound.h"
#include "menu/menu.h" #include "menu.h"
#include "v_2ddrawer.h" #include "v_2ddrawer.h"
#include <string> #include <string>

View file

@ -34,7 +34,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#include "gamecvars.h" #include "gamecvars.h"
#include "gamecontrol.h" #include "gamecontrol.h"
#include "c_bind.h" #include "c_bind.h"
#include "menu/menu.h" #include "menu.h"
#include "gstrings.h" #include "gstrings.h"
#include "version.h" #include "version.h"
#include "namesdyn.h" #include "namesdyn.h"

View file

@ -33,7 +33,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#include "polymost.h" #include "polymost.h"
#include "gamecvars.h" #include "gamecvars.h"
#include "menu/menu.h" #include "menu.h"
BEGIN_RR_NS BEGIN_RR_NS

View file

@ -35,7 +35,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#include "osd.h" #include "osd.h"
#include "m_crc32.h" #include "m_crc32.h"
#include "printf.h" #include "printf.h"
#include "menu/menu.h" #include "menu.h"
#include "stringtable.h" #include "stringtable.h"
#include "mapinfo.h" #include "mapinfo.h"

View file

@ -28,7 +28,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#include "savegame.h" #include "savegame.h"
#include "cmdline.h" #include "cmdline.h"
#include "statistics.h" #include "statistics.h"
#include "menu/menu.h" #include "menu.h"
#include "mapinfo.h" #include "mapinfo.h"
#include "cmdlib.h" #include "cmdlib.h"
#include "v_2ddrawer.h" #include "v_2ddrawer.h"

View file

@ -31,7 +31,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#include "demo.h" #include "demo.h"
#include "mdsprite.h" #include "mdsprite.h"
#include "gamecvars.h" #include "gamecvars.h"
#include "menu/menu.h" #include "menu.h"
#include "mapinfo.h" #include "mapinfo.h"
#include "v_2ddrawer.h" #include "v_2ddrawer.h"

View file

@ -49,7 +49,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#include "colormap.h" #include "colormap.h"
#include "config.h" #include "config.h"
#include "menu/menu.h" #include "menu.h"
#include "raze_sound.h" #include "raze_sound.h"
#include "sounds.h" #include "sounds.h"

View file

@ -56,7 +56,7 @@ Prepared for public release: 03/28/2005 - Charlie Wiederhold, 3D Realms
#include "interpso.h" #include "interpso.h"
#include "sector.h" #include "sector.h"
#include "config.h" #include "config.h"
#include "menu/menu.h" #include "menu.h"
#include "swcvar.h" #include "swcvar.h"
#include "v_2ddrawer.h" #include "v_2ddrawer.h"
#include "v_video.h" #include "v_video.h"

View file

@ -93,7 +93,7 @@ Things required to make savegames work:
#include "printf.h" #include "printf.h"
#include "m_argv.h" #include "m_argv.h"
#include "debugbreak.h" #include "debugbreak.h"
#include "menu/menu.h" #include "menu.h"
#include "raze_music.h" #include "raze_music.h"
#include "statistics.h" #include "statistics.h"
#include "gstrings.h" #include "gstrings.h"

View file

@ -44,7 +44,7 @@ Prepared for public release: 03/28/2005 - Charlie Wiederhold, 3D Realms
#include "v_2ddrawer.h" #include "v_2ddrawer.h"
#include "weapon.h" #include "weapon.h"
#include "menu/menu.h" #include "menu.h"
#include "swcvar.h" #include "swcvar.h"
#include "raze_sound.h" #include "raze_sound.h"

View file

@ -63,7 +63,7 @@ Prepared for public release: 03/28/2005 - Charlie Wiederhold, 3D Realms
#include "track.h" #include "track.h"
#include "interp.h" #include "interp.h"
#include "interpso.h" #include "interpso.h"
#include "menu/menu.h" #include "menu.h"
#include "gstrings.h" #include "gstrings.h"
#include "raze_music.h" #include "raze_music.h"

View file

@ -39,7 +39,7 @@ Prepared for public release: 03/28/2005 - Charlie Wiederhold, 3D Realms
#include "jsector.h" #include "jsector.h"
#include "parent.h" #include "parent.h"
#include "scriptfile.h" #include "scriptfile.h"
#include "menu/menu.h" #include "menu.h"
#include "quotemgr.h" #include "quotemgr.h"
#include "mapinfo.h" #include "mapinfo.h"

View file

@ -48,7 +48,7 @@ Prepared for public release: 03/28/2005 - Charlie Wiederhold, 3D Realms
#include "rts.h" #include "rts.h"
#include "menus.h" #include "menus.h"
#include "config.h" #include "config.h"
#include "menu/menu.h" #include "menu.h"
#include "raze_music.h" #include "raze_music.h"
#include "raze_sound.h" #include "raze_sound.h"
#include "filesystem.h" #include "filesystem.h"