- WIP keybinding cleanup

This commit is contained in:
Christoph Oelckers 2019-12-02 02:07:32 +01:00
parent 2c218349d4
commit 00b2467eea
12 changed files with 315 additions and 608 deletions

View file

@ -860,7 +860,7 @@ add_executable( demolition WIN32 MACOSX_BUNDLE
#zzautozend.cpp #zzautozend.cpp
) )
set_source_files_properties( ${FASTMATH_SOURCES} PROPERTIES COMPILE_FLAGS ${DEM_FASTMATH_FLAG} ) #set_source_files_properties( ${FASTMATH_SOURCES} PROPERTIES COMPILE_FLAGS ${DEM_FASTMATH_FLAG} )
set_source_files_properties( xlat/parse_xlat.cpp PROPERTIES OBJECT_DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/xlat_parser.c" ) set_source_files_properties( xlat/parse_xlat.cpp PROPERTIES OBJECT_DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/xlat_parser.c" )
set_source_files_properties( utility/sc_man.cpp PROPERTIES OBJECT_DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/sc_man_scanner.h" ) set_source_files_properties( utility/sc_man.cpp PROPERTIES OBJECT_DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/sc_man_scanner.h" )
set_source_files_properties( ${NOT_COMPILED_SOURCE_FILES} PROPERTIES HEADER_FILE_ONLY TRUE ) set_source_files_properties( ${NOT_COMPILED_SOURCE_FILES} PROPERTIES HEADER_FILE_ONLY TRUE )

View file

@ -1874,54 +1874,11 @@ void SetMouseYScale(CGameMenuItemSlider *pItem)
void SetMouseDigitalAxis(CGameMenuItemZCycle *pItem) void SetMouseDigitalAxis(CGameMenuItemZCycle *pItem)
{ {
#if 0
if (pItem == &itemOptionsControlMouseDigitalUp)
{
MouseDigitalFunctions[1][0] = nGamefuncsValues[pItem->m_nFocus];
CONTROL_MapDigitalAxis(1, MouseDigitalFunctions[1][0], 0, controldevice_mouse);
}
else if (pItem == &itemOptionsControlMouseDigitalDown)
{
MouseDigitalFunctions[1][1] = nGamefuncsValues[pItem->m_nFocus];
CONTROL_MapDigitalAxis(1, MouseDigitalFunctions[1][1], 1, controldevice_mouse);
}
else if (pItem == &itemOptionsControlMouseDigitalLeft)
{
MouseDigitalFunctions[0][0] = nGamefuncsValues[pItem->m_nFocus];
CONTROL_MapDigitalAxis(0, MouseDigitalFunctions[0][0], 0, controldevice_mouse);
}
else if (pItem == &itemOptionsControlMouseDigitalRight)
{
MouseDigitalFunctions[0][1] = nGamefuncsValues[pItem->m_nFocus];
CONTROL_MapDigitalAxis(0, MouseDigitalFunctions[0][1], 1, controldevice_mouse);
}
#endif
} }
void SetupMouseMenu(CGameMenuItemChain *pItem) void SetupMouseMenu(CGameMenuItemChain *pItem)
{ {
UNREFERENCED_PARAMETER(pItem); UNREFERENCED_PARAMETER(pItem);
#if 0
static CGameMenuItemZCycle *pMouseDigitalAxis[4] = {
&itemOptionsControlMouseDigitalLeft,
&itemOptionsControlMouseDigitalRight,
&itemOptionsControlMouseDigitalUp,
&itemOptionsControlMouseDigitalDown
};
for (int i = 0; i < ARRAY_SSIZE(pMouseDigitalAxis); i++)
{
CGameMenuItemZCycle *pItem = pMouseDigitalAxis[i];
pItem->m_nFocus = 0;
for (int j = 0; j < NUMGAMEFUNCTIONS+1; j++)
{
if (nGamefuncsValues[j] == MouseDigitalFunctions[i>>1][i&1])
{
pItem->m_nFocus = j;
break;
}
}
}
#endif
itemOptionsControlMouseAimFlipped.at20 = in_mouseflip; itemOptionsControlMouseAimFlipped.at20 = in_mouseflip;
itemOptionsControlMouseFilterInput.at20 = in_mousesmoothing; itemOptionsControlMouseFilterInput.at20 = in_mousesmoothing;
itemOptionsControlMouseAimMode.at20 = in_aimmode; itemOptionsControlMouseAimMode.at20 = in_aimmode;

View file

@ -53,16 +53,6 @@ void sub_5A928(void)
buttonMap.ClearButton(i); buttonMap.ClearButton(i);
} }
void sub_5A944(int key)
{
auto binding = Bindings.GetBind(key);
if (binding)
{
auto index = buttonMap.FindButtonIndex(binding);
if (index >= 0) buttonMap.ClearButton(index);
}
}
void SetGodMode(bool god) void SetGodMode(bool god)
{ {
playerSetGodMode(gMe, god); playerSetGodMode(gMe, god);
@ -590,58 +580,6 @@ void CPlayerMsg::Send(void)
void CPlayerMsg::ProcessKeys(void) void CPlayerMsg::ProcessKeys(void)
{ {
if (inputState.GetKeyStatus(sc_Escape)) Term(); if (inputState.GetKeyStatus(sc_Escape)) Term();
#if 0
int key = inputState.keyGetScan();
int ch;
if (key != 0)
{
bool ctrl = (inputState.CtrlPressed());
bool shift = (inputState.ShiftPressed());
switch (key)
{
case sc_Escape:
Term();
break;
case sc_F1:
case sc_F2:
case sc_F3:
case sc_F4:
case sc_F5:
case sc_F6:
case sc_F7:
case sc_F8:
case sc_F9:
case sc_F10:
buttonMap.ClearButton(gamefunc_See_Chase_View);
Set(*CombatMacros[key-sc_F1]);
Send();
inputState.ClearKeyStatus(key);
break;
case sc_BackSpace:
if (ctrl)
Clear();
else
DelChar();
break;
case sc_Enter:
case sc_kpad_Enter:
if (gCheatMgr.Check(text))
Term();
else
Send();
break;
default:
if (key < 128)
{
ch = shift ? g_keyAsciiTableShift[key] : g_keyAsciiTable[key];
if (ch)
AddChar(ch);
}
break;
}
sub_5A944(key);
}
#endif
} }
bool CPlayerMsg::IsWhitespaceOnly(const char * const pzString) bool CPlayerMsg::IsWhitespaceOnly(const char * const pzString)

View file

@ -808,3 +808,216 @@ bool C_DoKey (event_t *ev, FKeyBindings *binds, FKeyBindings *doublebinds)
} }
return false; return false;
} }
// Todo: Move to a separate file.
//=============================================================================
//
// Interface for CON scripts to get descriptions for actions
// This code can query the 64 original game functions by index.
//
//=============================================================================
static GameFuncDesc con_gamefuncs[] = {
{"+Move_Forward", "Move_Forward"},
{"+Move_Backward", "Move_Backward"},
{"+Turn_Left", "Turn_Left"},
{"+Turn_Right", "Turn_Right"},
{"+Strafe", "Strafe"},
{"+Fire", "Fire"},
{"+Open", "Open"},
{"+Run", "Run"},
{"+Alt_Fire", "Alt_Fire"},
{"+Jump", "Jump"},
{"+Crouch", "Crouch"},
{"+Look_Up", "Look_Up"},
{"+Look_Down", "Look_Down"},
{"+Look_Left", "Look_Left"},
{"+Look_Right", "Look_Right"},
{"+Strafe_Left", "Strafe_Left"},
{"+Strafe_Right", "Strafe_Right"},
{"+Aim_Up", "Aim_Up"},
{"+Aim_Down", "Aim_Down"},
{"+Weapon_1", "Weapon_1"},
{"+Weapon_2", "Weapon_2"},
{"+Weapon_3", "Weapon_3"},
{"+Weapon_4", "Weapon_4"},
{"+Weapon_5", "Weapon_5"},
{"+Weapon_6", "Weapon_6"},
{"+Weapon_7", "Weapon_7"},
{"+Weapon_8", "Weapon_8"},
{"+Weapon_9", "Weapon_9"},
{"+Weapon_10", "Weapon_10"},
{"+Inventory", "Inventory"},
{"+Inventory_Left", "Inventory_Left"},
{"+Inventory_Right", "Inventory_Right"},
{"+Holo_Duke", "Holo_Duke"},
{"+Jetpack", "Jetpack"},
{"+NightVision", "NightVision"},
{"+MedKit", "MedKit"},
{"+TurnAround", "TurnAround"},
{"+SendMessage", "SendMessage"},
{"+Map", "Map"},
{"+Shrink_Screen", "Shrink_Screen"},
{"+Enlarge_Screen", "Enlarge_Screen"},
{"+Center_View", "Center_View"},
{"+Holster_Weapon", "Holster_Weapon"},
{"+Show_Opponents_Weapon", "Show_Opponents_Weapon"},
{"+Map_Follow_Mode", "Map_Follow_Mode"},
{"+See_Coop_View", "See_Coop_View"},
{"+Mouse_Aiming", "Mouse_Aiming"},
{"+Toggle_Crosshair", "Toggle_Crosshair"},
{"+Steroids", "Steroids"},
{"+Quick_Kick", "Quick_Kick"},
{"+Next_Weapon", "Next_Weapon"},
{"+Previous_Weapon", "Previous_Weapon"},
{"+Show_Console", "Show_Console"},
{"+Show_DukeMatch_Scores", "Show_Scoreboard"},
{"+Dpad_Select", "Dpad_Select"},
{"+Dpad_Aiming", "Dpad_Aiming"},
{"+AutoRun", "AutoRun"},
{"+Last_Used_Weapon", "Last_Used_Weapon"},
{"+Quick_Save", "Quick_Save"},
{"+Quick_Load", "Quick_Load"},
{"+Alt_Weapon", "Alt_Weapon"},
{"+Third_Person_View", "Third_Person_View"},
{"+Toggle_Crouch", "Toggle_Crouch"}
};
//=============================================================================
//
//
//
//=============================================================================
void C_CON_SetAliases()
{
if (g_gameType & GAMEFLAG_NAM)
{
con_gamefuncs[32].description = "Holo_Soldier";
con_gamefuncs[33].description = "Huey";
con_gamefuncs[48].description = "Tank_Mode";
}
if (g_gameType & GAMEFLAG_WW2GI)
{
con_gamefuncs[32].description = "Fire_Mission";
con_gamefuncs[33].description = "";
con_gamefuncs[48].description = "Smokes";
}
}
static FString C_CON_GetGameFuncOnKeyboard(int gameFunc)
{
if (gameFunc >= 0 && gameFunc < countof(con_gamefuncs))
{
auto keys = Bindings.GetKeysForCommand(con_gamefuncs[gameFunc].action);
for (auto key : keys)
{
if (key < KEY_FIRSTMOUSEBUTTON)
{
auto scan = KB_ScanCodeToString(key);
if (scan) return scan;
}
}
}
return "";
}
static FString C_CON_GetGameFuncOnMouse(int gameFunc)
{
if (gameFunc >= 0 && gameFunc < countof(con_gamefuncs))
{
auto keys = Bindings.GetKeysForCommand(con_gamefuncs[gameFunc].action);
for (auto key : keys)
{
if ((key >= KEY_FIRSTMOUSEBUTTON && key < KEY_FIRSTJOYBUTTON) || (key >= KEY_MWHEELUP && key <= KEY_MWHEELLEFT))
{
auto scan = KB_ScanCodeToString(key);
if (scan) return scan;
}
}
}
return "";
}
char const* C_CON_GetGameFuncOnJoystick(int gameFunc)
{
if (gameFunc >= 0 && gameFunc < countof(con_gamefuncs))
{
auto keys = Bindings.GetKeysForCommand(con_gamefuncs[gameFunc].action);
for (auto key : keys)
{
if (key >= KEY_FIRSTJOYBUTTON && !(key >= KEY_MWHEELUP && key <= KEY_MWHEELLEFT))
{
auto scan = KB_ScanCodeToString(key);
if (scan) return scan;
}
}
}
return "";
}
FString C_CON_GetBoundKeyForLastInput(int gameFunc)
{
if (CONTROL_LastSeenInput == LastSeenInput::Joystick)
{
FString name = C_CON_GetGameFuncOnJoystick(gameFunc);
if (name.IsNotEmpty())
{
return name;
}
}
FString name = C_CON_GetGameFuncOnKeyboard(gameFunc);
if (name.IsNotEmpty())
{
return name;
}
name = C_CON_GetGameFuncOnMouse(gameFunc);
if (name.IsNotEmpty())
{
return name;
}
name = C_CON_GetGameFuncOnJoystick(gameFunc);
if (name.IsNotEmpty())
{
return name;
}
return "UNBOUND";
}
//=============================================================================
//
//
//
//=============================================================================
void C_CON_SetButtonAlias(int num, const char *text)
{
if (num >= 0 && num < countof(con_gamefuncs))
{
if (con_gamefuncs[num].replaced) free((void*)con_gamefuncs[num].description);
con_gamefuncs[num].description = strdup(text);
con_gamefuncs[num].replaced = true;
}
}
//=============================================================================
//
//
//
//=============================================================================
void C_CON_ClearButtonAlias(int num)
{
if (num >= 0 && num < countof(con_gamefuncs))
{
if (con_gamefuncs[num].replaced) free((void*)con_gamefuncs[num].description);
con_gamefuncs[num].description = "";
con_gamefuncs[num].replaced = false;
}
}

View file

@ -116,4 +116,13 @@ struct FKeySection
}; };
extern TArray<FKeySection> KeySections; extern TArray<FKeySection> KeySections;
struct GameFuncDesc
{
const char *action;
const char *description;
bool replaced;
};
#endif //__C_BINDINGS_H__ #endif //__C_BINDINGS_H__

View file

@ -48,168 +48,73 @@ struct ButtonDesc
}; };
static const ButtonDesc gamefuncs[] = { static const ButtonDesc gamefuncs[] = {
{ gamefunc_Move_Forward, "Move_Forward"}, { gamefunc_Move_Forward, "Move_Forward"},
{ gamefunc_Move_Backward, "Move_Backward"}, { gamefunc_Move_Backward, "Move_Backward"},
{ gamefunc_Turn_Left, "Turn_Left"}, { gamefunc_Turn_Left, "Turn_Left"},
{ gamefunc_Turn_Right, "Turn_Right"}, { gamefunc_Turn_Right, "Turn_Right"},
{ gamefunc_Strafe, "Strafe"}, { gamefunc_Strafe, "Strafe"},
{ gamefunc_Fire, "Fire"}, { gamefunc_Fire, "Fire"},
{ gamefunc_Open, "Open"}, { gamefunc_Open, "Open"},
{ gamefunc_Run, "Run"}, { gamefunc_Run, "Run"},
{ gamefunc_Alt_Fire, "Alt_Fire"}, { gamefunc_Alt_Fire, "Alt_Fire"},
{ gamefunc_Jump, "Jump"}, { gamefunc_Jump, "Jump"},
{ gamefunc_Crouch, "Crouch"}, { gamefunc_Crouch, "Crouch"},
{ gamefunc_Look_Up, "Look_Up"}, { gamefunc_Look_Up, "Look_Up"},
{ gamefunc_Look_Down, "Look_Down"}, { gamefunc_Look_Down, "Look_Down"},
{ gamefunc_Look_Left, "Look_Left"}, { gamefunc_Look_Left, "Look_Left"},
{ gamefunc_Look_Right, "Look_Right"}, { gamefunc_Look_Right, "Look_Right"},
{ gamefunc_Strafe_Left, "Strafe_Left"}, { gamefunc_Strafe_Left, "Strafe_Left"},
{ gamefunc_Strafe_Right, "Strafe_Right"}, { gamefunc_Strafe_Right, "Strafe_Right"},
{ gamefunc_Aim_Up, "Aim_Up"}, { gamefunc_Aim_Up, "Aim_Up"},
{ gamefunc_Aim_Down, "Aim_Down"}, { gamefunc_Aim_Down, "Aim_Down"},
{ gamefunc_Weapon_1, "Weapon_1"}, { gamefunc_Weapon_1, "Weapon_1"},
{ gamefunc_Weapon_2, "Weapon_2"}, { gamefunc_Weapon_2, "Weapon_2"},
{ gamefunc_Weapon_3, "Weapon_3"}, { gamefunc_Weapon_3, "Weapon_3"},
{ gamefunc_Weapon_4, "Weapon_4"}, { gamefunc_Weapon_4, "Weapon_4"},
{ gamefunc_Weapon_5, "Weapon_5"}, { gamefunc_Weapon_5, "Weapon_5"},
{ gamefunc_Weapon_6, "Weapon_6"}, { gamefunc_Weapon_6, "Weapon_6"},
{ gamefunc_Weapon_7, "Weapon_7"}, { gamefunc_Weapon_7, "Weapon_7"},
{ gamefunc_Weapon_8, "Weapon_8"}, { gamefunc_Weapon_8, "Weapon_8"},
{ gamefunc_Weapon_9, "Weapon_9"}, { gamefunc_Weapon_9, "Weapon_9"},
{ gamefunc_Weapon_10, "Weapon_10"}, { gamefunc_Weapon_10, "Weapon_10"},
{ gamefunc_Inventory, "Inventory"}, { gamefunc_Inventory, "Inventory"},
{ gamefunc_Inventory_Left, "Inventory_Left"}, { gamefunc_Inventory_Left, "Inventory_Left"},
{ gamefunc_Inventory_Right, "Inventory_Right"}, { gamefunc_Inventory_Right, "Inventory_Right"},
{ gamefunc_Holo_Duke, "Holo_Duke"}, { gamefunc_Holo_Duke, "Holo_Duke"},
{ gamefunc_Jetpack, "Jetpack"}, { gamefunc_Jetpack, "Jetpack"},
{ gamefunc_NightVision, "NightVision"}, { gamefunc_NightVision, "NightVision"},
{ gamefunc_MedKit, "MedKit"}, { gamefunc_MedKit, "MedKit"},
{ gamefunc_TurnAround, "Turn_Around"}, { gamefunc_TurnAround, "Turn_Around"},
{ gamefunc_SendMessage, "Send_Message"}, { gamefunc_SendMessage, "Send_Message"},
{ gamefunc_Map, "Map"}, { gamefunc_Map, "Map"},
{ gamefunc_Shrink_Screen, "Shrink_Screen"}, { gamefunc_Shrink_Screen, "Shrink_Screen"},
{ gamefunc_Enlarge_Screen, "Enlarge_Screen"}, { gamefunc_Enlarge_Screen, "Enlarge_Screen"},
{ gamefunc_Center_View, "Center_View"}, { gamefunc_Center_View, "Center_View"},
{ gamefunc_Holster_Weapon, "Holster_Weapon"}, { gamefunc_Holster_Weapon, "Holster_Weapon"},
{ gamefunc_Show_Opponents_Weapon, "Show_Opponents_Weapon"}, { gamefunc_Show_Opponents_Weapon, "Show_Opponents_Weapon"},
{ gamefunc_Map_Follow_Mode, "Map_Follow_Mode"}, { gamefunc_Map_Follow_Mode, "Map_Follow_Mode"},
{ gamefunc_See_Coop_View, "See_Coop_View"}, { gamefunc_See_Coop_View, "See_Coop_View"},
{ gamefunc_Mouse_Aiming, "Mouse_Aiming"}, { gamefunc_Mouse_Aiming, "Mouse_Aiming"},
{ gamefunc_Toggle_Crosshair, "Toggle_Crosshair"}, { gamefunc_Toggle_Crosshair, "Toggle_Crosshair"},
{ gamefunc_Steroids, "Steroids"}, { gamefunc_Steroids, "Steroids"},
{ gamefunc_Quick_Kick, "Quick_Kick"}, { gamefunc_Quick_Kick, "Quick_Kick"},
{ gamefunc_Next_Weapon, "Next_Weapon"}, { gamefunc_Next_Weapon, "Next_Weapon"},
{ gamefunc_Previous_Weapon, "Previous_Weapon"}, { gamefunc_Previous_Weapon, "Previous_Weapon"},
{ gamefunc_Show_Console, "Show_Console"}, { gamefunc_Show_DukeMatch_Scores, "Show_DukeMatch_Scores"},
{ gamefunc_Show_DukeMatch_Scores, "Show_DukeMatch_Scores"},
{ gamefunc_Dpad_Select, "Dpad_Select"}, { gamefunc_Dpad_Select, "Dpad_Select"},
{ gamefunc_Dpad_Aiming, "Dpad_Aiming"}, { gamefunc_Dpad_Aiming, "Dpad_Aiming"},
{ gamefunc_AutoRun, "AutoRun"}, { gamefunc_AutoRun, "AutoRun"},
{ gamefunc_Last_Weapon, "Last_Used_Weapon"}, { gamefunc_Last_Weapon, "Last_Used_Weapon"},
{ gamefunc_Alt_Weapon, "Alt_Weapon"}, { gamefunc_Alt_Weapon, "Alt_Weapon"},
{ gamefunc_Third_Person_View, "Third_Person_View"}, { gamefunc_Third_Person_View, "Third_Person_View"},
{ gamefunc_Toggle_Crouch, "Toggle_Crouch"}, { gamefunc_Toggle_Crouch, "Toggle_Crouch"},
{ gamefunc_See_Chase_View, "See_Chase_View"}, // the following were added by Blood { gamefunc_CrystalBall, "CrystalBall"}, // the following were added by Blood
{ gamefunc_BeastVision, "BeastVision"}, { gamefunc_ProximityBombs, "ProximityBombs"},
{ gamefunc_CrystalBall, "CrystalBall"}, { gamefunc_RemoteBombs, "RemoteBombs"},
{ gamefunc_JumpBoots, "JumpBoots"}, { gamefunc_Smoke_Bomb, "Smoke_Bomb" },
{ gamefunc_ProximityBombs, "ProximityBombs"}, { gamefunc_Gas_Bomb, "Gas_Bomb" },
{ gamefunc_RemoteBombs, "RemoteBombs"}, { gamefunc_Flash_Bomb, "Flash_Bomb" },
{ gamefunc_Smoke_Bomb, "Smoke_Bomb" }, { gamefunc_Caltrops, "Caltrops" },
{ gamefunc_Gas_Bomb, "Gas_Bomb" },
{ gamefunc_Flash_Bomb, "Flash_Bomb" },
{ gamefunc_Caltrops, "Calitrops" },
};
static const ButtonDesc gamealiases_Duke3D[] = {
{ gamefunc_BeastVision, ""},
{ gamefunc_CrystalBall, ""},
{ gamefunc_ProximityBombs, ""},
{ gamefunc_RemoteBombs, ""},
{ gamefunc_Smoke_Bomb, "" },
{ gamefunc_Gas_Bomb, "" },
{ gamefunc_Flash_Bomb, "" },
{ gamefunc_Caltrops, "" },
};
static const ButtonDesc gamealiases_Nam[] = {
{ gamefunc_Holo_Duke, "Holo_Soldier"},
{ gamefunc_Jetpack, "Huey"},
{ gamefunc_Steroids, "Tank_Mode"},
{ gamefunc_Show_DukeMatch_Scores, "Show_GruntMatch_Scores"},
{ gamefunc_BeastVision, ""},
{ gamefunc_CrystalBall, ""},
{ gamefunc_ProximityBombs, ""},
{ gamefunc_RemoteBombs, ""},
{ gamefunc_Smoke_Bomb, "" },
{ gamefunc_Gas_Bomb, "" },
{ gamefunc_Flash_Bomb, "" },
{ gamefunc_Caltrops, "" },
};
static const ButtonDesc gamealiases_WW2GI[] = {
{ gamefunc_Holo_Duke, "Fire Mission"},
{ gamefunc_Jetpack, ""},
{ gamefunc_Steroids, "Smokes"},
{ gamefunc_Show_DukeMatch_Scores, "Show_GIMatch_Scores"},
{ gamefunc_BeastVision, ""},
{ gamefunc_CrystalBall, ""},
{ gamefunc_ProximityBombs, ""},
{ gamefunc_RemoteBombs, ""},
{ gamefunc_Smoke_Bomb, "" },
{ gamefunc_Gas_Bomb, "" },
{ gamefunc_Flash_Bomb, "" },
{ gamefunc_Caltrops, "" },
};
static const ButtonDesc gamealiases_RR[] = {
{ gamefunc_Holo_Duke, "Beer"},
{ gamefunc_Jetpack, "Cow Pie"},
{ gamefunc_NightVision, "Yeehaa"},
{ gamefunc_MedKit, "Whiskey"},
{ gamefunc_Steroids, "Moonshine"},
{ gamefunc_Quick_Kick, "Pee"},
{ gamefunc_Show_DukeMatch_Scores, "Show_Scores"},
{ gamefunc_Alt_Fire, ""},
{ gamefunc_BeastVision, ""},
{ gamefunc_CrystalBall, ""},
{ gamefunc_ProximityBombs, ""},
{ gamefunc_RemoteBombs, ""},
{ gamefunc_Smoke_Bomb, "" },
{ gamefunc_Gas_Bomb, "" },
{ gamefunc_Flash_Bomb, "" },
{ gamefunc_Caltrops, "" },
};
static const ButtonDesc gamealiases_Blood[] = {
{ gamefunc_Holo_Duke, ""},
{ gamefunc_JumpBoots, "JumpBoots"},
{ gamefunc_Steroids, ""},
{ gamefunc_Quick_Kick, ""},
{ gamefunc_Show_DukeMatch_Scores, ""},
{ gamefunc_Alt_Weapon, ""},
{ gamefunc_Smoke_Bomb, "" },
{ gamefunc_Gas_Bomb, "" },
{ gamefunc_Flash_Bomb, "" },
{ gamefunc_Caltrops, "" },
};
static const ButtonDesc gamealiases_SW[] = {
{ gamefunc_Holo_Duke, ""},
{ gamefunc_Jetpack, ""},
{ gamefunc_NightVision, ""},
{ gamefunc_MedKit, ""},
{ gamefunc_Steroids, ""},
{ gamefunc_Quick_Kick, ""},
{ gamefunc_Show_DukeMatch_Scores, ""},
{ gamefunc_Smoke_Bomb, "" },
{ gamefunc_Gas_Bomb, "" },
{ gamefunc_Flash_Bomb, "" },
{ gamefunc_Caltrops, "" },
}; };
@ -234,60 +139,7 @@ ButtonMap::ButtonMap()
for(auto &gf : gamefuncs) for(auto &gf : gamefuncs)
{ {
NameToNum.Insert(gf.name, gf.index); NameToNum.Insert(gf.name, gf.index);
NumToAlias[gf.index] = NumToName[gf.index] = gf.name; NumToName[gf.index] = gf.name;
}
}
//=============================================================================
//
//
//
//=============================================================================
void ButtonMap::SetGameAliases()
{
// Ion Fury hacks this together from the CON script and uses the same table as Duke Nukem
if (g_gameType & (GAMEFLAG_DUKE|GAMEFLAG_FURY))
{
for (auto& gf : gamealiases_Duke3D)
{
NumToAlias[gf.index] = gf.name;
}
}
if (g_gameType & GAMEFLAG_NAM)
{
for (auto& gf : gamealiases_Nam)
{
NumToAlias[gf.index] = gf.name;
}
}
if (g_gameType & GAMEFLAG_WW2GI)
{
for (auto& gf : gamealiases_WW2GI)
{
NumToAlias[gf.index] = gf.name;
}
}
if (g_gameType & (GAMEFLAG_RR|GAMEFLAG_RRRA))
{
for (auto& gf : gamealiases_RR)
{
NumToAlias[gf.index] = gf.name;
}
}
if (g_gameType & GAMEFLAG_BLOOD)
{
for (auto& gf : gamealiases_Blood)
{
NumToAlias[gf.index] = gf.name;
}
}
if (g_gameType & GAMEFLAG_SW)
{
for (auto& gf : gamealiases_SW)
{
NumToAlias[gf.index] = gf.name;
}
} }
} }
@ -304,18 +156,16 @@ int ButtonMap::ListActionCommands (const char *pattern)
for (int i = 0; i < NumButtons(); i++) for (int i = 0; i < NumButtons(); i++)
{ {
if (NumToAlias[i].IsEmpty()) continue; // do not list buttons that were removed from the alias list
if (pattern == NULL || CheckWildcards (pattern, if (pattern == NULL || CheckWildcards (pattern,
(snprintf (matcher, countof(matcher), "+%s", NumToName[i].GetChars()), matcher))) (snprintf (matcher, countof(matcher), "+%s", NumToName[i].GetChars()), matcher)))
{ {
Printf ("+%s\n", NumToName[i]); Printf ("+%s\n", NumToName[i].GetChars());
count++; count++;
} }
if (pattern == NULL || CheckWildcards (pattern, if (pattern == NULL || CheckWildcards (pattern,
(snprintf (matcher, countof(matcher), "-%s", NumToName[i].GetChars()), matcher))) (snprintf (matcher, countof(matcher), "-%s", NumToName[i].GetChars()), matcher)))
{ {
Printf ("-%s\n", NumToName[i]); Printf ("-%s\n", NumToName[i].GetChars());
count++; count++;
} }
} }
@ -372,34 +222,6 @@ void ButtonMap::ResetButtonStates ()
} }
} }
//=============================================================================
//
//
//
//=============================================================================
void ButtonMap::SetButtonAlias(int num, const char *text)
{
if ((unsigned)num >= (unsigned)NUMGAMEFUNCTIONS)
return;
NumToAlias[num] = text;
NameToNum.Insert(text, num);
}
//=============================================================================
//
//
//
//=============================================================================
void ButtonMap::ClearButtonAlias(int num)
{
if ((unsigned)num >= (unsigned)NUMGAMEFUNCTIONS)
return;
NumToAlias[num] = "";
}
//============================================================================= //=============================================================================
// //
// //
@ -495,4 +317,3 @@ bool FButtonStatus::ReleaseKey (int keynum)
// Returns true if releasing this key caused the button to go up. // Returns true if releasing this key caused the button to go up.
return wasdown && !bDown; return wasdown && !bDown;
} }

View file

@ -46,6 +46,7 @@ enum GameFunction_t
gamefunc_JumpBoots = gamefunc_Jetpack, gamefunc_JumpBoots = gamefunc_Jetpack,
gamefunc_NightVision, gamefunc_NightVision,
gamefunc_Night_Vision = gamefunc_NightVision, gamefunc_Night_Vision = gamefunc_NightVision,
gamefunc_BeastVision = gamefunc_NightVision,
gamefunc_MedKit, gamefunc_MedKit,
gamefunc_Med_Kit = gamefunc_MedKit, gamefunc_Med_Kit = gamefunc_MedKit,
gamefunc_TurnAround, gamefunc_TurnAround,
@ -66,17 +67,18 @@ enum GameFunction_t
gamefunc_Quick_Kick, gamefunc_Quick_Kick,
gamefunc_Next_Weapon, gamefunc_Next_Weapon,
gamefunc_Previous_Weapon, gamefunc_Previous_Weapon,
gamefunc_Show_Console, gamefunc_Unused1, // was gamefunc_Console. Cannot be deleted thanks to CON usuing numeric indiced for addressing this list.
gamefunc_Show_DukeMatch_Scores, gamefunc_Show_DukeMatch_Scores,
gamefunc_Dpad_Select, gamefunc_Dpad_Select,
gamefunc_Dpad_Aiming, gamefunc_Dpad_Aiming,
gamefunc_AutoRun, gamefunc_AutoRun,
gamefunc_Last_Weapon, gamefunc_Last_Weapon,
gamefunc_Unused2, // was quickload/quicksave
gamefunc_Unused3,
gamefunc_Alt_Weapon, gamefunc_Alt_Weapon,
gamefunc_Third_Person_View, gamefunc_Third_Person_View,
gamefunc_See_Chase_View = gamefunc_Third_Person_View, // this was added by Blood gamefunc_See_Chase_View = gamefunc_Third_Person_View,
gamefunc_Toggle_Crouch, gamefunc_Toggle_Crouch, // This is the last one used by EDuke32.
gamefunc_BeastVision,
gamefunc_CrystalBall, gamefunc_CrystalBall,
gamefunc_ProximityBombs, gamefunc_ProximityBombs,
gamefunc_RemoteBombs, gamefunc_RemoteBombs,
@ -111,7 +113,6 @@ class ButtonMap
FButtonStatus Buttons[NUMGAMEFUNCTIONS]; FButtonStatus Buttons[NUMGAMEFUNCTIONS];
FString NumToName[NUMGAMEFUNCTIONS]; // The internal name of the button FString NumToName[NUMGAMEFUNCTIONS]; // The internal name of the button
FString NumToAlias[NUMGAMEFUNCTIONS]; // The display name which can be altered by scripts.
TMap<FName, int> NameToNum; TMap<FName, int> NameToNum;
public: public:
@ -131,6 +132,7 @@ 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 const char* GetButtonName(int32_t func) const
{ {
if ((unsigned)func >= (unsigned)NumButtons()) if ((unsigned)func >= (unsigned)NumButtons())
@ -138,15 +140,6 @@ public:
return NumToName[func]; return NumToName[func];
} }
const char* GetButtonAlias(int32_t func) const
{
if ((unsigned)func >= (unsigned)NumButtons())
return nullptr;
return NumToAlias[func];
}
void SetButtonAlias(int num, const char* text);
void ClearButtonAlias(int num);
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

@ -29,6 +29,7 @@
#include "enet.h" #include "enet.h"
#endif #endif
void C_CON_SetAliases();
InputState inputState; InputState inputState;
void SetClipshapes(); void SetClipshapes();
int ShowStartupWindow(TArray<GrpEntry> &); int ShowStartupWindow(TArray<GrpEntry> &);
@ -425,7 +426,7 @@ int CONFIG_Init()
} }
GStrings.LoadStrings(); GStrings.LoadStrings();
V_InitFonts(); V_InitFonts();
buttonMap.SetGameAliases(); C_CON_SetAliases();
Mus_Init(); Mus_Init();
InitStatistics(); InitStatistics();
M_Init(); M_Init();
@ -483,7 +484,7 @@ int32_t CONFIG_GetMapBestTime(char const* const mapname, uint8_t const* const ma
if (GameConfig->SetSection("MapTimes")) if (GameConfig->SetSection("MapTimes"))
{ {
auto s = GameConfig->GetValueForKey(m); auto s = GameConfig->GetValueForKey(m);
if (s) (int)strtoull(s, nullptr, 0); if (s) return (int)strtoull(s, nullptr, 0);
} }
return -1; return -1;
} }
@ -504,7 +505,6 @@ int CONFIG_SetMapBestTime(uint8_t const* const mapmd4, int32_t tm)
// //
//========================================================================== //==========================================================================
int32_t MouseDigitalFunctions[MAXMOUSEAXES][2];
int32_t MouseAnalogueAxes[MAXMOUSEAXES]; int32_t MouseAnalogueAxes[MAXMOUSEAXES];
int32_t JoystickFunctions[MAXJOYBUTTONSANDHATS][2]; int32_t JoystickFunctions[MAXJOYBUTTONSANDHATS][2];
int32_t JoystickDigitalFunctions[MAXJOYAXES][2]; int32_t JoystickDigitalFunctions[MAXJOYAXES][2];
@ -521,51 +521,6 @@ static const char* mouseanalogdefaults[MAXMOUSEAXES] =
}; };
static const char* mousedigitaldefaults[MAXMOUSEDIGITAL] =
{
};
static const char* joystickdefaults[MAXJOYBUTTONSANDHATS] =
{
"Fire",
"Strafe",
"Run",
"Open",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"Aim_Down",
"Look_Right",
"Aim_Up",
"Look_Left",
};
static const char* joystickclickeddefaults[MAXJOYBUTTONSANDHATS] = static const char* joystickclickeddefaults[MAXJOYBUTTONSANDHATS] =
{ {
"", "",
@ -583,18 +538,6 @@ static const char* joystickanalogdefaults[MAXJOYAXES] =
}; };
static const char* joystickdigitaldefaults[MAXJOYDIGITAL] =
{
"",
"",
"",
"",
"",
"",
"Run",
};
//========================================================================== //==========================================================================
// //
// //
@ -658,62 +601,6 @@ void CONFIG_SetupMouse(void)
void CONFIG_SetupJoystick(void) void CONFIG_SetupJoystick(void)
{ {
const char* val;
FString section = currentGame + ".ControllerSettings";
if (!GameConfig->SetSection(section)) return;
for (int i = 0; i < MAXJOYBUTTONSANDHATS; i++)
{
section.Format("ControllerButton%d", i);
val = GameConfig->GetValueForKey(section);
if (val)
JoystickFunctions[i][0] = buttonMap.FindButtonIndex(val);
section.Format("ControllerButtonClicked%d", i);
val = GameConfig->GetValueForKey(section);
if (val)
JoystickFunctions[i][1] = buttonMap.FindButtonIndex(val);
}
// map over the axes
for (int i = 0; i < MAXJOYAXES; i++)
{
section.Format("ControllerAnalogAxes%d", i);
val = GameConfig->GetValueForKey(section);
if (val)
JoystickAnalogueAxes[i] = CONFIG_AnalogNameToNum(val);
section.Format("ControllerDigitalAxes%d_0", i);
val = GameConfig->GetValueForKey(section);
if (val)
JoystickDigitalFunctions[i][0] = buttonMap.FindButtonIndex(val);
section.Format("ControllerDigitalAxes%d_1", i);
val = GameConfig->GetValueForKey(section);
if (val)
JoystickDigitalFunctions[i][1] = buttonMap.FindButtonIndex(val);
section.Format("ControllerAnalogScale%d", i);
val = GameConfig->GetValueForKey(section);
if (val)
JoystickAnalogueScale[i] = (int32_t)strtoull(val, nullptr, 0);
section.Format("ControllerAnalogInvert%d", i);
val = GameConfig->GetValueForKey(section);
if (val)
JoystickAnalogueInvert[i] = (int32_t)strtoull(val, nullptr, 0);
section.Format("ControllerAnalogDead%d", i);
val = GameConfig->GetValueForKey(section);
if (val)
JoystickAnalogueDead[i] = (int32_t)strtoull(val, nullptr, 0);
section.Format("ControllerAnalogSaturate%d", i);
val = GameConfig->GetValueForKey(section);
if (val)
JoystickAnalogueSaturate[i] = (int32_t)strtoull(val, nullptr, 0);
}
for (int i = 0; i < MAXJOYAXES; i++) for (int i = 0; i < MAXJOYAXES; i++)
{ {
CONTROL_MapAnalogAxis(i, JoystickAnalogueAxes[i], controldevice_joystick); CONTROL_MapAnalogAxis(i, JoystickAnalogueAxes[i], controldevice_joystick);
@ -877,14 +764,12 @@ void CONFIG_SetGameControllerDefaultsStandard()
for (auto const& button : buttons) for (auto const& button : buttons)
button.apply(); button.apply();
/* if (g_gameType & GAMEFLAG_FURY)
if (FURY)
{ {
for (auto const& button : buttonsFury) for (auto const& button : buttonsFury)
button.apply(); button.apply();
} }
else else
*/
{ {
for (auto const& button : buttonsDuke) for (auto const& button : buttonsDuke)
button.apply(); button.apply();
@ -938,14 +823,12 @@ void CONFIG_SetGameControllerDefaultsPro()
for (auto const& button : buttons) for (auto const& button : buttons)
button.apply(); button.apply();
#if 0 // ouch... if (g_gameType & GAMEFLAG_FURY)
if (FURY)
{ {
for (auto const& button : buttonsFury) for (auto const& button : buttonsFury)
button.apply(); button.apply();
} }
else else
#endif
{ {
for (auto const& button : buttonsDuke) for (auto const& button : buttonsDuke)
button.apply(); button.apply();
@ -955,99 +838,14 @@ void CONFIG_SetGameControllerDefaultsPro()
digitalAxis.apply(); digitalAxis.apply();
} }
FString CONFIG_GetGameFuncOnKeyboard(int gameFunc)
{
auto binding = buttonMap.GetButtonAlias(gameFunc);
auto keys = Bindings.GetKeysForCommand(binding);
for(auto key : keys)
{
if (key < KEY_FIRSTMOUSEBUTTON)
{
auto scan = KB_ScanCodeToString(key);
if (scan) return scan;
}
}
return "";
}
FString CONFIG_GetGameFuncOnMouse(int gameFunc)
{
auto binding = buttonMap.GetButtonAlias(gameFunc);
auto keys = Bindings.GetKeysForCommand(binding);
for (auto key : keys)
{
if ((key >= KEY_FIRSTMOUSEBUTTON && key < KEY_FIRSTJOYBUTTON) || (key >= KEY_MWHEELUP && key <= KEY_MWHEELLEFT))
{
auto scan = KB_ScanCodeToString(key);
if (scan) return scan;
}
}
return "";
}
char const* CONFIG_GetGameFuncOnJoystick(int gameFunc)
{
auto binding = buttonMap.GetButtonAlias(gameFunc);
auto keys = Bindings.GetKeysForCommand(binding);
for (auto key : keys)
{
if (key >= KEY_FIRSTJOYBUTTON && !(key >= KEY_MWHEELUP && key <= KEY_MWHEELLEFT))
{
auto scan = KB_ScanCodeToString(key);
if (scan) return scan;
}
}
return "";
}
// FIXME: Consider the mouse as well!
FString CONFIG_GetBoundKeyForLastInput(int gameFunc)
{
if (CONTROL_LastSeenInput == LastSeenInput::Joystick)
{
FString name = CONFIG_GetGameFuncOnJoystick(gameFunc);
if (name.IsNotEmpty())
{
return name;
}
}
FString name = CONFIG_GetGameFuncOnKeyboard(gameFunc);
if (name.IsNotEmpty())
{
return name;
}
name = CONFIG_GetGameFuncOnMouse(gameFunc);
if (name.IsNotEmpty())
{
return name;
}
name = CONFIG_GetGameFuncOnJoystick(gameFunc);
if (name.IsNotEmpty())
{
return name;
}
return "UNBOUND";
}
void CONFIG_InitMouseAndController() void CONFIG_InitMouseAndController()
{ {
memset(MouseDigitalFunctions, -1, sizeof(MouseDigitalFunctions));
memset(JoystickFunctions, -1, sizeof(JoystickFunctions)); memset(JoystickFunctions, -1, sizeof(JoystickFunctions));
memset(JoystickDigitalFunctions, -1, sizeof(JoystickDigitalFunctions)); memset(JoystickDigitalFunctions, -1, sizeof(JoystickDigitalFunctions));
for (int i = 0; i < MAXMOUSEAXES; i++) for (int i = 0; i < MAXMOUSEAXES; i++)
{ {
MouseDigitalFunctions[i][0] = buttonMap.FindButtonIndex(mousedigitaldefaults[i * 2]);
MouseDigitalFunctions[i][1] = buttonMap.FindButtonIndex(mousedigitaldefaults[i * 2 + 1]);
CONTROL_MapDigitalAxis(i, MouseDigitalFunctions[i][0], 0, controldevice_mouse);
CONTROL_MapDigitalAxis(i, MouseDigitalFunctions[i][1], 1, controldevice_mouse);
MouseAnalogueAxes[i] = CONFIG_AnalogNameToNum(mouseanalogdefaults[i]); MouseAnalogueAxes[i] = CONFIG_AnalogNameToNum(mouseanalogdefaults[i]);
CONTROL_MapAnalogAxis(i, MouseAnalogueAxes[i], controldevice_mouse); CONTROL_MapAnalogAxis(i, MouseAnalogueAxes[i], controldevice_mouse);
} }
@ -1074,20 +872,6 @@ void CONFIG_WriteControllerSettings()
{ {
FString section = currentGame + ".ControllerSettings"; FString section = currentGame + ".ControllerSettings";
GameConfig->SetSection(section); GameConfig->SetSection(section);
for (int dummy = 0; dummy < MAXJOYBUTTONSANDHATS; dummy++)
{
if (buttonMap.GetButtonName(JoystickFunctions[dummy][0]))
{
buf.Format("ControllerButton%d", dummy);
GameConfig->SetValueForKey(buf, buttonMap.GetButtonName(JoystickFunctions[dummy][0]));
}
if (buttonMap.GetButtonName(JoystickFunctions[dummy][1]))
{
buf.Format("ControllerButtonClicked%d", dummy);
GameConfig->SetValueForKey(buf, buttonMap.GetButtonName(JoystickFunctions[dummy][1]));
}
}
for (int dummy = 0; dummy < MAXJOYAXES; dummy++) for (int dummy = 0; dummy < MAXJOYAXES; dummy++)
{ {
if (CONFIG_AnalogNumToName(JoystickAnalogueAxes[dummy])) if (CONFIG_AnalogNumToName(JoystickAnalogueAxes[dummy]))
@ -1096,12 +880,6 @@ void CONFIG_WriteControllerSettings()
GameConfig->SetValueForKey(buf, CONFIG_AnalogNumToName(JoystickAnalogueAxes[dummy])); GameConfig->SetValueForKey(buf, CONFIG_AnalogNumToName(JoystickAnalogueAxes[dummy]));
} }
if (buttonMap.GetButtonName(JoystickDigitalFunctions[dummy][0]))
{
buf.Format("ControllerDigitalAxes%d_0", dummy);
GameConfig->SetValueForKey(buf, buttonMap.GetButtonName(JoystickDigitalFunctions[dummy][0]));
}
if (buttonMap.GetButtonName(JoystickDigitalFunctions[dummy][1])) if (buttonMap.GetButtonName(JoystickDigitalFunctions[dummy][1]))
{ {
buf.Format("ControllerDigitalAxes%d_1", dummy); buf.Format("ControllerDigitalAxes%d_1", dummy);

View file

@ -38,19 +38,6 @@ void CONFIG_SetDefaultKeys(const char *defbinds);
#define DEFAULTJOYSTICKANALOGUESATURATE 9500 #define DEFAULTJOYSTICKANALOGUESATURATE 9500
extern int32_t MouseDigitalFunctions[MAXMOUSEAXES][2];
extern int32_t MouseAnalogueAxes[MAXMOUSEAXES];
extern int32_t JoystickFunctions[MAXJOYBUTTONSANDHATS][2];
extern int32_t JoystickDigitalFunctions[MAXJOYAXES][2];
extern int32_t JoystickAnalogueAxes[MAXJOYAXES];
extern int32_t JoystickAnalogueScale[MAXJOYAXES];
extern int32_t JoystickAnalogueDead[MAXJOYAXES];
extern int32_t JoystickAnalogueSaturate[MAXJOYAXES];
extern int32_t JoystickAnalogueInvert[MAXJOYAXES];
int32_t CONFIG_AnalogNameToNum(const char* func);
const char* CONFIG_AnalogNumToName(int32_t func);
void CONFIG_SetupMouse(void);
void CONFIG_SetupJoystick(void); void CONFIG_SetupJoystick(void);
void CONFIG_WriteControllerSettings(); void CONFIG_WriteControllerSettings();
void CONFIG_InitMouseAndController(); void CONFIG_InitMouseAndController();
@ -59,8 +46,6 @@ void CONFIG_SetGameControllerDefaultsStandard();
void CONFIG_SetGameControllerDefaultsPro(); void CONFIG_SetGameControllerDefaultsPro();
void CONFIG_SetGameControllerDefaultsClear(); void CONFIG_SetGameControllerDefaultsClear();
FString CONFIG_GetBoundKeyForLastInput(int gameFunc);
extern FStringCVar* const CombatMacros[]; extern FStringCVar* const CombatMacros[];
void CONFIG_ReadCombatMacros(); void CONFIG_ReadCombatMacros();

View file

@ -43,6 +43,9 @@ BEGIN_DUKE_NS
#define LINE_NUMBER (g_lineNumber << 12) #define LINE_NUMBER (g_lineNumber << 12)
void C_CON_SetButtonAlias(int num, const char* text);
void C_CON_ClearButtonAlias(int num);
int32_t g_scriptVersion = 13; // 13 = 1.3D-style CON files, 14 = 1.4/1.5 style CON files int32_t g_scriptVersion = 13; // 13 = 1.3D-style CON files, 14 = 1.4/1.5 style CON files
char g_scriptFileName[BMAX_PATH] = "(none)"; // file we're currently compiling char g_scriptFileName[BMAX_PATH] = "(none)"; // file we're currently compiling
@ -2197,11 +2200,14 @@ void C_InitQuotes(void)
#ifdef EDUKE32_TOUCH_DEVICES #ifdef EDUKE32_TOUCH_DEVICES
apStrings[QUOTE_DEAD] = 0; apStrings[QUOTE_DEAD] = 0;
#else #else
// WTF ?!? auto openkeys = Bindings.GetKeysForCommand("+open");
char const * const OpenGameFunc = buttonMap.GetButtonName(gamefunc_Open); if (openkeys.Size())
C_ReplaceQuoteSubstring(QUOTE_DEAD, "SPACE", OpenGameFunc); {
C_ReplaceQuoteSubstring(QUOTE_DEAD, "OPEN", OpenGameFunc); auto OpenGameFunc = C_NameKeys(openkeys.Data(), 1);
C_ReplaceQuoteSubstring(QUOTE_DEAD, "USE", OpenGameFunc); C_ReplaceQuoteSubstring(QUOTE_DEAD, "SPACE", OpenGameFunc);
C_ReplaceQuoteSubstring(QUOTE_DEAD, "OPEN", OpenGameFunc);
C_ReplaceQuoteSubstring(QUOTE_DEAD, "USE", OpenGameFunc);
}
#endif #endif
// most of these are based on Blood, obviously // most of these are based on Blood, obviously

View file

@ -55,6 +55,9 @@ BEGIN_DUKE_NS
vmstate_t vm; vmstate_t vm;
FString C_CON_GetBoundKeyForLastInput(int gameFunc);
#if !defined LUNATIC #if !defined LUNATIC
int32_t g_tw; int32_t g_tw;
int32_t g_currentEvent = -1; int32_t g_currentEvent = -1;
@ -3684,7 +3687,7 @@ badindex:
static char const s_KeyboardFormat[] = "[%s]"; static char const s_KeyboardFormat[] = "[%s]";
static char const s_JoystickFormat[] = "(%s)"; static char const s_JoystickFormat[] = "(%s)";
auto binding = CONFIG_GetBoundKeyForLastInput(gameFunc); auto binding = C_CON_GetBoundKeyForLastInput(gameFunc);
if (binding.Len()) snprintf(apStrings[quoteIndex], MAXQUOTELEN, "(%s)", binding.GetChars()); if (binding.Len()) snprintf(apStrings[quoteIndex], MAXQUOTELEN, "(%s)", binding.GetChars());
dispatch(); dispatch();
} }

View file

@ -937,10 +937,14 @@ void C_InitQuotes(void)
#ifdef EDUKE32_TOUCH_DEVICES #ifdef EDUKE32_TOUCH_DEVICES
apStrings[QUOTE_DEAD] = 0; apStrings[QUOTE_DEAD] = 0;
#else #else
char const * OpenGameFunc = buttonMap.GetButtonName(gamefunc_Open); auto openkeys = Bindings.GetKeysForCommand("+open");
C_ReplaceQuoteSubstring(QUOTE_DEAD, "SPACE", OpenGameFunc); if (openkeys.Size())
C_ReplaceQuoteSubstring(QUOTE_DEAD, "OPEN", OpenGameFunc); {
C_ReplaceQuoteSubstring(QUOTE_DEAD, "USE", OpenGameFunc); auto OpenGameFunc = C_NameKeys(openkeys.Data(), 1);
C_ReplaceQuoteSubstring(QUOTE_DEAD, "SPACE", OpenGameFunc);
C_ReplaceQuoteSubstring(QUOTE_DEAD, "OPEN", OpenGameFunc);
C_ReplaceQuoteSubstring(QUOTE_DEAD, "USE", OpenGameFunc);
}
#endif #endif
// most of these are based on Blood, obviously // most of these are based on Blood, obviously