- more file matching.

- moved c_con to Duke subproject because it's the only one using this stuff.
This commit is contained in:
Christoph Oelckers 2020-04-12 00:09:39 +02:00
parent 2883553ed2
commit 14cdfa3f3c
11 changed files with 48 additions and 51 deletions

View file

@ -720,7 +720,6 @@ set (PCH_SOURCES
core/console/c_commandline.cpp core/console/c_commandline.cpp
core/console/c_dispatch.cpp core/console/c_dispatch.cpp
core/console/d_event.cpp core/console/d_event.cpp
core/console/c_con.cpp
common/thirdparty/sfmt/SFMT.cpp common/thirdparty/sfmt/SFMT.cpp
common/textures/bitmap.cpp common/textures/bitmap.cpp

View file

@ -34,25 +34,21 @@
#include <stdint.h> #include <stdint.h>
//#include "doomtype.h"
#include "cmdlib.h" #include "cmdlib.h"
#include "keydef.h" #include "keydef.h"
#include "c_commandline.h" #include "c_commandline.h"
#include "c_bind.h" #include "c_bind.h"
#include "c_dispatch.h" #include "c_dispatch.h"
//#include "g_level.h"
//#include "hu_stuff.h"
#include "configfile.h" #include "configfile.h"
//#include "d_event.h"
#include "filesystem.h" #include "filesystem.h"
#include "templates.h" #include "templates.h"
#include "i_time.h" #include "i_time.h"
//#include "menu/menu.h"
#include "printf.h" #include "printf.h"
#include "v_text.h"
#include "d_event.h"
#include "sc_man.h" #include "sc_man.h"
#include "gamecontrol.h" #include "c_cvars.h"
#include "d_event.h"
const char *KeyNames[NUM_KEYS] = 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"); auto lump = fileSystem.CheckNumForFullName("engine/commonbinds.txt");
if (lump >= 0) ReadBindings(lump, true); if (lump >= 0) ReadBindings(lump, true);
@ -719,15 +720,23 @@ void CONFIG_SetDefaultKeys(const char* baseconfig)
ReadBindings(lump, true); ReadBindings(lump, true);
} }
while ((lump = fileSystem.FindLumpFullName("defbinds.txt", &lastlump)) != -1) while ((lump = fileSystem.FindLump("DEFBINDS", &lastlump)) != -1)
{ {
ReadBindings(lump, false); ReadBindings(lump, false);
} }
} }
//=============================================================================
//
//
//
//=============================================================================
CVAR(Int, cl_defaultconfiguration, 2, CVAR_ARCHIVE | CVAR_GLOBALCONFIG)
void C_BindDefaults() 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) CCMD(controlpreset)
@ -754,16 +763,6 @@ void C_SetDefaultBindings()
C_BindDefaults(); 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; dclick = false;
} }
if (!binding.IsEmpty())// && (chatmodeon == 0 || ev->data1 < 256))
{
if (ev->type == EV_KeyUp && binding[0] != '+') if (ev->type == EV_KeyUp && binding[0] != '+')
{ {
return false; return false;
} }
if (!binding.IsEmpty())// && (chatmodeon == 0 || ev->data1 < 256))
{
char *copy = binding.LockBuffer(); char *copy = binding.LockBuffer();
if (ev->type == EV_KeyUp) if (ev->type == EV_KeyUp)

View file

@ -88,11 +88,9 @@ enum GameFunction_t
gamefunc_Zoom_In, // Map controls should not pollute the global button namespace. gamefunc_Zoom_In, // Map controls should not pollute the global button namespace.
gamefunc_Zoom_Out, gamefunc_Zoom_Out,
NUMGAMEFUNCTIONS
}; };
// Actions // Actions
struct FButtonStatus struct FButtonStatus
{ {
@ -113,17 +111,17 @@ struct FButtonStatus
class ButtonMap class ButtonMap
{ {
FButtonStatus Buttons[NUMGAMEFUNCTIONS]; TArray<FButtonStatus> Buttons;
FString NumToName[NUMGAMEFUNCTIONS]; // The internal name of the button TArray<FString> NumToName; // The internal name of the button
TMap<FName, int> NameToNum; TMap<FName, int> NameToNum;
public: public:
ButtonMap(); ButtonMap();
void SetGameAliases(); void SetButtons(const char** names, int count);
constexpr int NumButtons() const constexpr int NumButtons() const
{ {
return NUMGAMEFUNCTIONS; return Buttons.Size();
} }
int FindButtonIndex(const char* func) const; int FindButtonIndex(const char* func) const;
@ -134,14 +132,6 @@ public:
return index > -1? &Buttons[index] : nullptr; 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 ResetButtonTriggers (); // Call ResetTriggers for all buttons
void ResetButtonStates (); // Same as above, but also clear bDown void ResetButtonStates (); // Same as above, but also clear bDown
int ListActionCommands(const char* pattern); int ListActionCommands(const char* pattern);

View file

@ -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 // Close console and clear command line. But if we're in the
// fullscreen console mode, there's nothing to fall back on // fullscreen console mode, there's nothing to fall back on
// if it's closed, so open the main menu instead. // if it's closed, so open the main menu instead.
#if 0
if (gamestate == GS_STARTUP) if (gamestate == GS_STARTUP)
{ {
return false; return false;
@ -1613,7 +1611,6 @@ static bool C_HandleKey (event_t *ev, FCommandBuffer &buffer)
C_DoCommand ("menu_main"); C_DoCommand ("menu_main");
} }
else else
#endif
{ {
buffer.SetString(""); buffer.SetString("");
HistPos = NULL; HistPos = NULL;
@ -1631,7 +1628,6 @@ static bool C_HandleKey (event_t *ev, FCommandBuffer &buffer)
if (ev->data3 & GKM_CTRL) if (ev->data3 & GKM_CTRL)
#endif // __APPLE__ #endif // __APPLE__
{ {
#if 0
if (data1 == 'C') if (data1 == 'C')
{ // copy to clipboard { // copy to clipboard
if (buffer.TextLength() > 0) if (buffer.TextLength() > 0)
@ -1645,7 +1641,6 @@ static bool C_HandleKey (event_t *ev, FCommandBuffer &buffer)
HistPos = NULL; HistPos = NULL;
} }
break; break;
#endif
} }
break; break;

View file

@ -97,7 +97,6 @@ FString LumpFilter;
TMap<FName, int32_t> 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. TMap<FName, int32_t> 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. // 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(Bool, queryiwad, true, CVAR_ARCHIVE | CVAR_GLOBALCONFIG);
CVAR(String, defaultiwad, "", CVAR_ARCHIVE | CVAR_GLOBALCONFIG); CVAR(String, defaultiwad, "", CVAR_ARCHIVE | CVAR_GLOBALCONFIG);
CVAR(Bool, disableautoload, false, CVAR_ARCHIVE | CVAR_NOINITCALL | CVAR_GLOBALCONFIG) CVAR(Bool, disableautoload, false, CVAR_ARCHIVE | CVAR_NOINITCALL | CVAR_GLOBALCONFIG)

View file

@ -8,8 +8,6 @@
#include "name.h" #include "name.h"
#include "memarena.h" #include "memarena.h"
EXTERN_CVAR(Int, cl_defaultconfiguration)
extern FString currentGame; extern FString currentGame;
extern FString LumpFilter; extern FString LumpFilter;
class FArgs; class FArgs;
@ -19,7 +17,6 @@ extern FMemArena dump; // this is for memory blocks than cannot be deallocated w
extern TMap<FName, int32_t> NameToTileIndex; extern TMap<FName, int32_t> NameToTileIndex;
int CONFIG_Init(); int CONFIG_Init();
void CONFIG_SetDefaultKeys(const char *defbinds);
// I am not sure if anything below will survive for long... // I am not sure if anything below will survive for long...

View file

@ -1081,6 +1081,12 @@ CCMD(reset2saved)
GameConfig->DoGameSetup (currentGame); GameConfig->DoGameSetup (currentGame);
} }
CCMD(menu_main)
{
M_StartControlPanel(true);
M_SetMenu(NAME_Mainmenu, -1);
}
CCMD(openmainmenu) CCMD(openmainmenu)
{ {
//gi->ClearSoundLocks(); //gi->ClearSoundLocks();

View file

@ -2,6 +2,7 @@
set( PCH_SOURCES set( PCH_SOURCES
src/actors.cpp src/actors.cpp
src/anim.cpp src/anim.cpp
src/c_con.cpp
src/cheats.cpp src/cheats.cpp
src/cmdline.cpp src/cmdline.cpp
src/common.cpp src/common.cpp

View file

@ -128,7 +128,14 @@ static GameFuncDesc con_gamefuncs[] = {
{"+Toggle_Crouch", "Toggle_Crouch"} {"+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 "";
}
//============================================================================= //=============================================================================
// //

View file

@ -21,6 +21,9 @@ void I_Init (void);
unsigned int I_MakeRNGSeed(); unsigned int I_MakeRNGSeed();
void I_ShowFatalError(const char* msg); void I_ShowFatalError(const char* msg);
void I_PutInClipboard(const char* str);
FString I_GetFromClipboard(bool use_primary_selection);
// //
// Called by D_DoomLoop, // Called by D_DoomLoop,

View file

@ -36,6 +36,7 @@
#include <GL/gl.h> #include <GL/gl.h>
#include <vector> #include <vector>
#include "wglext.h" #include "wglext.h"
#include <vector>
#include "gl_sysfb.h" #include "gl_sysfb.h"
#include "hardware.h" #include "hardware.h"