diff --git a/source/CMakeLists.txt b/source/CMakeLists.txt index d77ae1c2f..71048cb71 100644 --- a/source/CMakeLists.txt +++ b/source/CMakeLists.txt @@ -720,7 +720,6 @@ set (PCH_SOURCES core/console/c_commandline.cpp core/console/c_dispatch.cpp core/console/d_event.cpp - core/console/c_con.cpp common/thirdparty/sfmt/SFMT.cpp common/textures/bitmap.cpp diff --git a/source/core/console/c_bind.cpp b/source/core/console/c_bind.cpp index d70839994..7fe54cc84 100644 --- a/source/core/console/c_bind.cpp +++ b/source/core/console/c_bind.cpp @@ -34,25 +34,21 @@ #include -//#include "doomtype.h" #include "cmdlib.h" #include "keydef.h" #include "c_commandline.h" #include "c_bind.h" #include "c_dispatch.h" -//#include "g_level.h" -//#include "hu_stuff.h" #include "configfile.h" -//#include "d_event.h" #include "filesystem.h" #include "templates.h" #include "i_time.h" -//#include "menu/menu.h" #include "printf.h" -#include "v_text.h" -#include "d_event.h" #include "sc_man.h" -#include "gamecontrol.h" +#include "c_cvars.h" + +#include "d_event.h" + const char *KeyNames[NUM_KEYS] = @@ -706,8 +702,13 @@ void ReadBindings(int lump, bool override) } } +//============================================================================= +// +// +// +//============================================================================= -void CONFIG_SetDefaultKeys(const char* baseconfig) +void C_SetDefaultKeys(const char* baseconfig) { auto lump = fileSystem.CheckNumForFullName("engine/commonbinds.txt"); if (lump >= 0) ReadBindings(lump, true); @@ -719,15 +720,23 @@ void CONFIG_SetDefaultKeys(const char* baseconfig) ReadBindings(lump, true); } - while ((lump = fileSystem.FindLumpFullName("defbinds.txt", &lastlump)) != -1) + while ((lump = fileSystem.FindLump("DEFBINDS", &lastlump)) != -1) { ReadBindings(lump, false); } } +//============================================================================= +// +// +// +//============================================================================= +CVAR(Int, cl_defaultconfiguration, 2, CVAR_ARCHIVE | CVAR_GLOBALCONFIG) + + void C_BindDefaults() { - CONFIG_SetDefaultKeys(cl_defaultconfiguration == 1 ? "engine/origbinds.txt" : cl_defaultconfiguration == 2 ? "engine/leftbinds.txt" : "engine/defbinds.txt"); + C_SetDefaultKeys(cl_defaultconfiguration == 1 ? "engine/origbinds.txt" : cl_defaultconfiguration == 2 ? "engine/leftbinds.txt" : "engine/defbinds.txt"); } CCMD(controlpreset) @@ -754,16 +763,6 @@ void C_SetDefaultBindings() C_BindDefaults(); } -// this is horrible! -const char* KB_ScanCodeToString(int scancode) -{ - if (scancode >= 0 && scancode < NUM_KEYS) - return KeyNames[scancode]; - - return ""; -} - -void AddCommandString (const char *copy, int keynum); //============================================================================= // // @@ -819,13 +818,13 @@ bool C_DoKey (event_t *ev, FKeyBindings *binds, FKeyBindings *doublebinds) dclick = false; } + if (ev->type == EV_KeyUp && binding[0] != '+') + { + return false; + } + if (!binding.IsEmpty())// && (chatmodeon == 0 || ev->data1 < 256)) { - if (ev->type == EV_KeyUp && binding[0] != '+') - { - return false; - } - char *copy = binding.LockBuffer(); if (ev->type == EV_KeyUp) diff --git a/source/core/console/c_buttons.h b/source/core/console/c_buttons.h index 7a3cd2773..a80be688c 100644 --- a/source/core/console/c_buttons.h +++ b/source/core/console/c_buttons.h @@ -88,11 +88,9 @@ enum GameFunction_t gamefunc_Zoom_In, // Map controls should not pollute the global button namespace. gamefunc_Zoom_Out, - NUMGAMEFUNCTIONS }; - // Actions struct FButtonStatus { @@ -113,17 +111,17 @@ struct FButtonStatus class ButtonMap { - FButtonStatus Buttons[NUMGAMEFUNCTIONS]; - FString NumToName[NUMGAMEFUNCTIONS]; // The internal name of the button + TArray Buttons; + TArray NumToName; // The internal name of the button TMap NameToNum; public: ButtonMap(); - void SetGameAliases(); + void SetButtons(const char** names, int count); constexpr int NumButtons() const { - return NUMGAMEFUNCTIONS; + return Buttons.Size(); } int FindButtonIndex(const char* func) const; @@ -133,14 +131,6 @@ public: int index = FindButtonIndex(func); return index > -1? &Buttons[index] : nullptr; } - - // This is still in use but all cases are scheduled for termination. - const char* GetButtonName(int32_t func) const - { - if ((unsigned)func >= (unsigned)NumButtons()) - return nullptr; - return NumToName[func]; - } void ResetButtonTriggers (); // Call ResetTriggers for all buttons void ResetButtonStates (); // Same as above, but also clear bDown diff --git a/source/core/console/c_console.cpp b/source/core/console/c_console.cpp index 32e0f8904..20afb3297 100644 --- a/source/core/console/c_console.cpp +++ b/source/core/console/c_console.cpp @@ -1602,8 +1602,6 @@ static bool C_HandleKey (event_t *ev, FCommandBuffer &buffer) // Close console and clear command line. But if we're in the // fullscreen console mode, there's nothing to fall back on // if it's closed, so open the main menu instead. - -#if 0 if (gamestate == GS_STARTUP) { return false; @@ -1613,7 +1611,6 @@ static bool C_HandleKey (event_t *ev, FCommandBuffer &buffer) C_DoCommand ("menu_main"); } else -#endif { buffer.SetString(""); HistPos = NULL; @@ -1631,7 +1628,6 @@ static bool C_HandleKey (event_t *ev, FCommandBuffer &buffer) if (ev->data3 & GKM_CTRL) #endif // __APPLE__ { -#if 0 if (data1 == 'C') { // copy to clipboard if (buffer.TextLength() > 0) @@ -1645,7 +1641,6 @@ static bool C_HandleKey (event_t *ev, FCommandBuffer &buffer) HistPos = NULL; } break; -#endif } break; diff --git a/source/core/gamecontrol.cpp b/source/core/gamecontrol.cpp index 22fbf48cf..26b2b04eb 100644 --- a/source/core/gamecontrol.cpp +++ b/source/core/gamecontrol.cpp @@ -97,7 +97,6 @@ FString LumpFilter; TMap NameToTileIndex; // for assigning names to tiles. The menu accesses this list. By default it gets everything from the dynamic tile map in Duke Nukem and Redneck Rampage. // Todo: Add additional definition file for the other games or textures not in that list so that the menu does not have to rely on indices. -CVAR(Int, cl_defaultconfiguration, 2, CVAR_ARCHIVE | CVAR_GLOBALCONFIG) CVAR(Bool, queryiwad, true, CVAR_ARCHIVE | CVAR_GLOBALCONFIG); CVAR(String, defaultiwad, "", CVAR_ARCHIVE | CVAR_GLOBALCONFIG); CVAR(Bool, disableautoload, false, CVAR_ARCHIVE | CVAR_NOINITCALL | CVAR_GLOBALCONFIG) diff --git a/source/core/gamecontrol.h b/source/core/gamecontrol.h index 0131034eb..627c5a044 100644 --- a/source/core/gamecontrol.h +++ b/source/core/gamecontrol.h @@ -8,8 +8,6 @@ #include "name.h" #include "memarena.h" -EXTERN_CVAR(Int, cl_defaultconfiguration) - extern FString currentGame; extern FString LumpFilter; class FArgs; @@ -19,7 +17,6 @@ extern FMemArena dump; // this is for memory blocks than cannot be deallocated w extern TMap NameToTileIndex; int CONFIG_Init(); -void CONFIG_SetDefaultKeys(const char *defbinds); // I am not sure if anything below will survive for long... diff --git a/source/core/menu/menu.cpp b/source/core/menu/menu.cpp index 2c75f9af8..d4563291e 100644 --- a/source/core/menu/menu.cpp +++ b/source/core/menu/menu.cpp @@ -1081,6 +1081,12 @@ CCMD(reset2saved) GameConfig->DoGameSetup (currentGame); } +CCMD(menu_main) +{ + M_StartControlPanel(true); + M_SetMenu(NAME_Mainmenu, -1); +} + CCMD(openmainmenu) { //gi->ClearSoundLocks(); diff --git a/source/duke3d/CMakeLists.txt b/source/duke3d/CMakeLists.txt index 7b3f2cbce..a7d3162e6 100644 --- a/source/duke3d/CMakeLists.txt +++ b/source/duke3d/CMakeLists.txt @@ -2,6 +2,7 @@ set( PCH_SOURCES src/actors.cpp src/anim.cpp + src/c_con.cpp src/cheats.cpp src/cmdline.cpp src/common.cpp diff --git a/source/core/console/c_con.cpp b/source/duke3d/src/c_con.cpp similarity index 98% rename from source/core/console/c_con.cpp rename to source/duke3d/src/c_con.cpp index d9bcda875..09c460745 100644 --- a/source/core/console/c_con.cpp +++ b/source/duke3d/src/c_con.cpp @@ -128,7 +128,14 @@ static GameFuncDesc con_gamefuncs[] = { {"+Toggle_Crouch", "Toggle_Crouch"} }; -const char* KB_ScanCodeToString(int scancode); // convert scancode into a string +// this is horrible! +const char* KB_ScanCodeToString(int scancode) +{ + if (scancode >= 0 && scancode < NUM_KEYS) + return KeyNames[scancode]; + + return ""; +} //============================================================================= // diff --git a/source/platform/win32/i_system.h b/source/platform/win32/i_system.h index b4598763e..a59b6c532 100644 --- a/source/platform/win32/i_system.h +++ b/source/platform/win32/i_system.h @@ -21,6 +21,9 @@ void I_Init (void); unsigned int I_MakeRNGSeed(); void I_ShowFatalError(const char* msg); +void I_PutInClipboard(const char* str); +FString I_GetFromClipboard(bool use_primary_selection); + // // Called by D_DoomLoop, diff --git a/source/platform/win32/win32glvideo.cpp b/source/platform/win32/win32glvideo.cpp index 8e0edc5bb..37be0d154 100644 --- a/source/platform/win32/win32glvideo.cpp +++ b/source/platform/win32/win32glvideo.cpp @@ -36,6 +36,7 @@ #include #include #include "wglext.h" +#include #include "gl_sysfb.h" #include "hardware.h"