Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions GeneralsMD/Code/GameEngine/Include/GameClient/MetaEvent.h
Original file line number Diff line number Diff line change
Expand Up @@ -391,9 +391,11 @@ class MetaMap : public SubsystemInterface

static void parseMetaMap(INI* ini);

// TheSuperHackers @info Function to generate default key mappings
// TheSuperHackers @feature Function to generate default key mappings
// for actions that were not found in a CommandMap.ini
static void generateMetaMap();
void generateMetaMap();

void verifyMetaMap();

const MetaMapRec *getFirstMetaMapRec() const { return m_metaMaps; }
};
Expand Down
5 changes: 3 additions & 2 deletions GeneralsMD/Code/GameEngine/Source/Common/GameEngine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -627,8 +627,6 @@ void GameEngine::init()
fname.format("Data\\%s\\CommandMap", GetRegistryLanguage().str());
initSubsystem(TheMetaMap,"TheMetaMap", MSGNEW("GameEngineSubsystem") MetaMap(), nullptr, fname.str(), "Data\\INI\\CommandMap");

TheMetaMap->generateMetaMap();

#if defined(RTS_DEBUG)
ini.loadFileDirectory("Data\\INI\\CommandMapDebug", INI_LOAD_MULTIFILE, nullptr);
#endif
Expand All @@ -637,6 +635,9 @@ void GameEngine::init()
ini.loadFileDirectory("Data\\INI\\CommandMapDemo", INI_LOAD_MULTIFILE, nullptr);
#endif

TheMetaMap->generateMetaMap();
TheMetaMap->verifyMetaMap();


initSubsystem(TheActionManager,"TheActionManager", MSGNEW("GameEngineSubsystem") ActionManager(), nullptr);
//initSubsystem((CComObject<WebBrowser> *)TheWebBrowser,"(CComObject<WebBrowser> *)TheWebBrowser", (CComObject<WebBrowser> *)createWebBrowser(), nullptr);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -466,9 +466,6 @@ GameMessageDisposition MetaEventTranslator::translateGameMessage(const GameMessa

for (const MetaMapRec *map = TheMetaMap->getFirstMetaMapRec(); map; map = map->m_next)
{
DEBUG_ASSERTCRASH(map->m_meta > GameMessage::MSG_BEGIN_META_MESSAGES &&
map->m_meta < GameMessage::MSG_END_META_MESSAGES, ("hmm, expected only meta-msgs here"));

if (!isMessageUsable(map->m_usableIn))
continue;

Expand Down Expand Up @@ -725,14 +722,14 @@ MetaMapRec *MetaMap::getMetaMapRec(GameMessage::Type t)
}

//-------------------------------------------------------------------------------------------------
/*static */ void MetaMap::generateMetaMap()
void MetaMap::generateMetaMap()
{
// TheSuperHackers @info A default mapping for MSG_META_SELECT_ALL_AIRCRAFT would be useful for Generals
// but is not recommended, because it will cause key mapping conflicts with original game languages.

{
// Is useful for Generals and Zero Hour.
MetaMapRec *map = TheMetaMap->getMetaMapRec(GameMessage::MSG_META_INCREASE_MAX_RENDER_FPS);
MetaMapRec *map = getMetaMapRec(GameMessage::MSG_META_INCREASE_MAX_RENDER_FPS);
if (map->m_key == MK_NONE)
{
map->m_key = MK_KPPLUS;
Expand All @@ -743,7 +740,7 @@ MetaMapRec *MetaMap::getMetaMapRec(GameMessage::Type t)
}
{
// Is useful for Generals and Zero Hour.
MetaMapRec *map = TheMetaMap->getMetaMapRec(GameMessage::MSG_META_DECREASE_MAX_RENDER_FPS);
MetaMapRec *map = getMetaMapRec(GameMessage::MSG_META_DECREASE_MAX_RENDER_FPS);
if (map->m_key == MK_NONE)
{
map->m_key = MK_KPMINUS;
Expand All @@ -754,7 +751,7 @@ MetaMapRec *MetaMap::getMetaMapRec(GameMessage::Type t)
}
{
// Is useful for Generals and Zero Hour.
MetaMapRec *map = TheMetaMap->getMetaMapRec(GameMessage::MSG_META_INCREASE_LOGIC_TIME_SCALE);
MetaMapRec *map = getMetaMapRec(GameMessage::MSG_META_INCREASE_LOGIC_TIME_SCALE);
if (map->m_key == MK_NONE)
{
map->m_key = MK_KPPLUS;
Expand All @@ -765,7 +762,7 @@ MetaMapRec *MetaMap::getMetaMapRec(GameMessage::Type t)
}
{
// Is useful for Generals and Zero Hour.
MetaMapRec *map = TheMetaMap->getMetaMapRec(GameMessage::MSG_META_DECREASE_LOGIC_TIME_SCALE);
MetaMapRec *map = getMetaMapRec(GameMessage::MSG_META_DECREASE_LOGIC_TIME_SCALE);
if (map->m_key == MK_NONE)
{
map->m_key = MK_KPMINUS;
Expand All @@ -776,7 +773,7 @@ MetaMapRec *MetaMap::getMetaMapRec(GameMessage::Type t)
}
{
// Is useful for Generals and Zero Hour.
MetaMapRec *map = TheMetaMap->getMetaMapRec(GameMessage::MSG_META_TOGGLE_PLAYER_OBSERVER);
MetaMapRec *map = getMetaMapRec(GameMessage::MSG_META_TOGGLE_PLAYER_OBSERVER);
if (map->m_key == MK_NONE)
{
map->m_key = MK_M;
Expand All @@ -787,7 +784,7 @@ MetaMapRec *MetaMap::getMetaMapRec(GameMessage::Type t)
}
{
// Is mostly useful for Generals.
MetaMapRec *map = TheMetaMap->getMetaMapRec(GameMessage::MSG_META_TOGGLE_FAST_FORWARD_REPLAY);
MetaMapRec *map = getMetaMapRec(GameMessage::MSG_META_TOGGLE_FAST_FORWARD_REPLAY);
if (map->m_key == MK_NONE)
{
map->m_key = MK_F;
Expand All @@ -798,7 +795,7 @@ MetaMapRec *MetaMap::getMetaMapRec(GameMessage::Type t)
}
{
// Is useful for Generals and Zero Hour.
MetaMapRec *map = TheMetaMap->getMetaMapRec(GameMessage::MSG_META_TOGGLE_PAUSE);
MetaMapRec *map = getMetaMapRec(GameMessage::MSG_META_TOGGLE_PAUSE);
if (map->m_key == MK_NONE)
{
map->m_key = MK_P;
Expand All @@ -809,7 +806,7 @@ MetaMapRec *MetaMap::getMetaMapRec(GameMessage::Type t)
}
{
// Is useful for Generals and Zero Hour.
MetaMapRec *map = TheMetaMap->getMetaMapRec(GameMessage::MSG_META_TOGGLE_PAUSE_ALT);
MetaMapRec *map = getMetaMapRec(GameMessage::MSG_META_TOGGLE_PAUSE_ALT);
if (map->m_key == MK_NONE)
{
map->m_key = MK_P;
Expand All @@ -820,7 +817,7 @@ MetaMapRec *MetaMap::getMetaMapRec(GameMessage::Type t)
}
{
// Is useful for Generals and Zero Hour.
MetaMapRec *map = TheMetaMap->getMetaMapRec(GameMessage::MSG_META_STEP_FRAME);
MetaMapRec *map = getMetaMapRec(GameMessage::MSG_META_STEP_FRAME);
if (map->m_key == MK_NONE)
{
map->m_key = MK_O;
Expand All @@ -831,7 +828,7 @@ MetaMapRec *MetaMap::getMetaMapRec(GameMessage::Type t)
}
{
// Is useful for Generals and Zero Hour.
MetaMapRec *map = TheMetaMap->getMetaMapRec(GameMessage::MSG_META_STEP_FRAME_ALT);
MetaMapRec *map = getMetaMapRec(GameMessage::MSG_META_STEP_FRAME_ALT);
if (map->m_key == MK_NONE)
{
map->m_key = MK_O;
Expand All @@ -842,7 +839,7 @@ MetaMapRec *MetaMap::getMetaMapRec(GameMessage::Type t)
}
{
// Is useful for Generals and Zero Hour.
MetaMapRec* map = TheMetaMap->getMetaMapRec(GameMessage::MSG_META_SELECT_NEXT_IDLE_WORKER);
MetaMapRec *map = getMetaMapRec(GameMessage::MSG_META_SELECT_NEXT_IDLE_WORKER);
if (map->m_key == MK_NONE) {
map->m_key = MK_I;
map->m_transition = DOWN;
Expand All @@ -854,7 +851,7 @@ MetaMapRec *MetaMap::getMetaMapRec(GameMessage::Type t)
}
}
{
MetaMapRec* map = TheMetaMap->getMetaMapRec(GameMessage::MSG_META_ALT_CAMERA_ROTATE_LEFT);
MetaMapRec *map = getMetaMapRec(GameMessage::MSG_META_ALT_CAMERA_ROTATE_LEFT);
if (map->m_key == MK_NONE) {
map->m_key = MK_KP4;
map->m_transition = DOWN;
Expand All @@ -863,7 +860,7 @@ MetaMapRec *MetaMap::getMetaMapRec(GameMessage::Type t)
}
}
{
MetaMapRec* map = TheMetaMap->getMetaMapRec(GameMessage::MSG_META_ALT_CAMERA_ROTATE_RIGHT);
MetaMapRec *map = getMetaMapRec(GameMessage::MSG_META_ALT_CAMERA_ROTATE_RIGHT);
if (map->m_key == MK_NONE) {
map->m_key = MK_KP6;
map->m_transition = DOWN;
Expand All @@ -875,7 +872,7 @@ MetaMapRec *MetaMap::getMetaMapRec(GameMessage::Type t)
#if defined(RTS_DEBUG)
{
// Is useful for Generals and Zero Hour.
MetaMapRec *map = TheMetaMap->getMetaMapRec(GameMessage::MSG_META_DEMO_REMOVE_PREREQ);
MetaMapRec *map = getMetaMapRec(GameMessage::MSG_META_DEMO_REMOVE_PREREQ);
if (map->m_key == MK_NONE)
{
map->m_key = MK_P;
Expand All @@ -886,7 +883,7 @@ MetaMapRec *MetaMap::getMetaMapRec(GameMessage::Type t)
}
{
// Is useful for Generals and Zero Hour.
MetaMapRec *map = TheMetaMap->getMetaMapRec(GameMessage::MSG_META_DEMO_FREE_BUILD);
MetaMapRec *map = getMetaMapRec(GameMessage::MSG_META_DEMO_FREE_BUILD);
if (map->m_key == MK_NONE)
{
map->m_key = MK_B;
Expand All @@ -898,6 +895,20 @@ MetaMapRec *MetaMap::getMetaMapRec(GameMessage::Type t)
#endif // defined(RTS_DEBUG)
}

//-------------------------------------------------------------------------------------------------
void MetaMap::verifyMetaMap()
{
#ifdef DEBUG_CRASHING
for (const MetaMapRec *map = getFirstMetaMapRec(); map; map = map->m_next)
{
DEBUG_ASSERTCRASH(
map->m_meta > GameMessage::MSG_BEGIN_META_MESSAGES &&
map->m_meta < GameMessage::MSG_END_META_MESSAGES,
("hmm, expected only meta-msgs here"));
}
#endif
}

//-------------------------------------------------------------------------------------------------
/*static*/ void INI::parseMetaMapDefinition( INI* ini )
{
Expand Down
Loading