Zero Hour rebuilt from EA's source: x64, Direct3D 11, VS2022/CMake, ~60 original bugs fixed, an AI that builds a base. Bring your own game.
C++ cmakecnccommand-and-conquercppdirectx11game-enginegame-preservationgeneralsrtssage-enginex64zero-hour
fix(gameclient): contra's powers key, promotion slots and its own sets
Olcay Seygan0b4b7b8a8335
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex 0933a3390..f3e4b7fc6 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -352,6 +352,9 @@ found and fixed, EA's own, not port damage.**- A Paladin under Contra no longer crashes the game. Reforged gives every Paladin a second laser for infantry, and that laser borrowed a Zero Hour weapon nothing else fires. Contra deleted it, so the laser had no gun, and the game went down a moment after the first Paladin rolled out. The laser is Reforged's own weapon now and is there whatever mod you load. The same kind of gap took the guns off Contra's Toxin Tunnel Defender and Toxin Stinger soldier, the Chemical Suits off its Rangers, and the death blast off its Demolition Scud Launcher, Toxin demo trap and Toxin Tractors (ShockWave's trap too). Where Reforged names a weapon or armour the mod dropped, the unit now keeps the mod's own, and the death blasts carry Zero Hour's charge.- Contra's units have their attack move, guard and stop buttons again, and A, G and S press them. Contra draws its command bar with eighteen buttons and keeps those three in the last row, which our fourteen-button bar does not have, so they went missing on every Contra unit, the Cybernetic general's cyborgs among them. A button a mod puts past the end of our bar now moves to an empty one, the three orders to the places Zero Hour gives them.- A mod with more than fourteen buttons on one unit or building gets all eighteen. The command bar grows a column at each end, nine across and two down, numbered the way Contra's own bar numbers them, and the steel plate behind it grows with it in your side's own paint, rail and toolbar buttons included. Before, there were only fourteen windows to move buttons into, so a set of sixteen lost two without a word. Without such a mod, or with a mod that brings a bar of its own, the bar is the fourteen-button one it always was. The nine-column layout follows Hojjat's edit of ControlBar Pro for Contra.+- Contra's Special Powers menu opens on its own key. The button's tooltip says tilde, the key under Escape, and that key opened our console instead, so the menu only answered a click. It opens with the key now on any keyboard layout, a Turkish one too, and while that button is on screen Shift and the same key bring up the console.+- A mod general's promotion screen is the one the mod laid out. We packed every row to the left and sorted upgrade chains into whichever column had room, so a Contra Flame General's Emergency Repair left the fourth column Contra gives it and his Frenzy moved over to make way. Every mod's button now stands in the slot its author gave it, as Zero Hour's own generals always did.+- Contra's Air Force, Laser, Superweapon and Demolitions generals have their whole promotion screens back, and the Demolitions General his power tray. Our corrections to Zero Hour's button lists overwrote the mod's lists of the same name, so the Air Force General showed four of his fifteen three-star powers and the Demolitions General's tray never came up. A mod that brings its own lists keeps them.- Contra's Laser Turret draws its beam at aircraft again, and a Contra Toxin General can buy his Rebel Ambush without the game going down. Reforged's fixes for those two named a beam and an ambush of Zero Hour's own that Contra does not have, so the turret shot an invisible beam, and the moment the ambush was bought its button had no power behind it and the game crashed. Now the promotion screen sells it and the powers bar fires it: gas-masked rebels climb out of the ground where you click. Where a Reforged fix names a beam, a power, a science or a spawn list the mod lacks, the mod's own now stays.- Contra's cyborgs no longer stand on black squares. Their little ground shadow is drawn the way Zero Hour draws it again, darkening the ground by the shape painted in the picture, so it comes out as a soft patch under the feet. We had been reading the shape from the picture's transparency instead, and Contra's shadow picture has none: it filled its whole square. Zero Hour's own shadows look as they did.- A computer opponent on ShockWave's Armor, Special Weapons or Salvage general plays on every map now. Those are the three generals ShockWave adds to Zero Hour's nine, and Shockwave Chaos renames two of them the Scumbag Artillery and Bandana generals. A map made before they existed, every one Zero Hour ships among them, has no computer player for them, so the seat started with no AI at all: its base sat idle, and clicking it with nothing selected handed it to you, which is how a player found himself running the enemy's base. The seat now takes the mod's skirmish AI for that general and builds like any other; on Tournament Desert it had three buildings up in forty seconds where it used to have none.diff --git a/GeneralsMD/Code/GameEngine/Include/Common/Science.h b/GeneralsMD/Code/GameEngine/Include/Common/Science.hindex 458be0baa..d0339f11e 100644--- a/GeneralsMD/Code/GameEngine/Include/Common/Science.h+++ b/GeneralsMD/Code/GameEngine/Include/Common/Science.h@@ -112,9 +112,6 @@ public:/// GrantsUpgrade: the player upgrade that comes with the science, empty when noneAsciiString getGrantedUpgradeName(ScienceType science) const;- /// does st name prereq among its own prerequisites (one level, not the whole chain)- Bool isDirectPrereq(ScienceType prereq, ScienceType st) const;-ScienceType getScienceFromInternalName(const AsciiString& name) const;AsciiString getInternalNameForScience(ScienceType science) const;diff --git a/GeneralsMD/Code/GameEngine/Include/GameClient/ControlBar.h b/GeneralsMD/Code/GameEngine/Include/GameClient/ControlBar.hindex 1fd655a42..d17a9a37f 100644--- a/GeneralsMD/Code/GameEngine/Include/GameClient/ControlBar.h+++ b/GeneralsMD/Code/GameEngine/Include/GameClient/ControlBar.h@@ -1144,8 +1144,8 @@ protected:// the following methods are for populating the context GUI controls for a particular contextstatic void populateButtonProc( Object *obj, void *userData );void populatePurchaseScience(Player* player);- /// one rank's section of the promotion screen: placed[i] goes on windows[i]- void populatePurchaseScienceRank( Player *player, const CommandButton *const *placed, GameWindow **windows, Int windowCount );+ /// one rank's section of the promotion screen: slot i of the command set goes on windows[i]+ void populatePurchaseScienceRank( Player *player, const CommandSet *commandSet, GameWindow **windows, Int windowCount );void populateCommand( Object *obj );void populateMultiSelect( void );void populateMultiSelectUnitList( void );diff --git a/GeneralsMD/Code/GameEngine/Include/GameClient/ControlBarScheme.h b/GeneralsMD/Code/GameEngine/Include/GameClient/ControlBarScheme.hindex c6574f307..8d415af7c 100644--- a/GeneralsMD/Code/GameEngine/Include/GameClient/ControlBarScheme.h+++ b/GeneralsMD/Code/GameEngine/Include/GameClient/ControlBarScheme.h@@ -312,7 +312,7 @@ private://-----------------------------------------------------------------------------// EXTERNALS ////////////////////////////////////////////////////////////////////------------------------------------------------------------------------------/// a mod's faction, which gets our American power tray and our science layout (owner's call)+/// a mod's faction, which gets our American power tray (owner's call)Bool ControlBarIsModFaction( const PlayerTemplate *pt );#endif // __CONTROL_BAR_SCHEME_H_diff --git a/GeneralsMD/Code/GameEngine/Source/Common/GlobalData.cpp b/GeneralsMD/Code/GameEngine/Source/Common/GlobalData.cppindex 806a4e7a6..efc3afd3c 100644--- a/GeneralsMD/Code/GameEngine/Source/Common/GlobalData.cpp+++ b/GeneralsMD/Code/GameEngine/Source/Common/GlobalData.cpp@@ -1922,6 +1922,14 @@ void GlobalData::computeExeCRC( void )const UnsignedInt modScriptsMark = 0x4D4F4453; // "MODS"exeCRC.computeCRC( &modScriptsMark, sizeof( modScriptsMark ) );}++ // A mod's CommandSet.ini keeps its sets from the fork's corrections (CommandStore), and a copy+ // byte for byte of EA's would hash the same as no copy at all.+ if( TheFileSystem->modLooseFile( AsciiString( "Data\\INI\\CommandSet.ini" ), &inModArchive ).isNotEmpty() || inModArchive )+ {+ const UnsignedInt modSetsMark = 0x4D4F4443; // "MODC"+ exeCRC.computeCRC( &modSetsMark, sizeof( modSetsMark ) );+ }}m_exeCRC = exeCRC.get();diff --git a/GeneralsMD/Code/GameEngine/Source/Common/RTS/Science.cpp b/GeneralsMD/Code/GameEngine/Source/Common/RTS/Science.cppindex 4c95be4ec..c5e1a661c 100644--- a/GeneralsMD/Code/GameEngine/Source/Common/RTS/Science.cpp+++ b/GeneralsMD/Code/GameEngine/Source/Common/RTS/Science.cpp@@ -271,17 +271,6 @@ AsciiString ScienceStore::getGrantedUpgradeName(ScienceType st) constreturn si ? si->m_grantedUpgradeName : AsciiString::TheEmptyString;}-//------------------------------------------------------------------------------/** Does st ask for prereq directly - the way Artillery Barrage 2 asks for Artillery Barrage 1? */-Bool ScienceStore::isDirectPrereq(ScienceType prereq, ScienceType st) const-{- const ScienceInfo* si = findScienceInfo(st);- if (si == NULL)- return false;-- return std::find(si->m_prereqSciences.begin(), si->m_prereqSciences.end(), prereq) != si->m_prereqSciences.end();-}-//-----------------------------------------------------------------------------Bool ScienceStore::isScienceGrantable(ScienceType st) const{diff --git a/GeneralsMD/Code/GameEngine/Source/Common/System/CommandStore.cpp b/GeneralsMD/Code/GameEngine/Source/Common/System/CommandStore.cppindex c653470d7..249e58ac3 100644--- a/GeneralsMD/Code/GameEngine/Source/Common/System/CommandStore.cpp+++ b/GeneralsMD/Code/GameEngine/Source/Common/System/CommandStore.cpp@@ -25,6 +25,7 @@#include "PreRTS.h" // This must go first in EVERY cpp file int the GameEngine#include "Common/CommandStore.h"+#include "Common/FileSystem.h"#include "Common/INI.h"#include "GameClient/ControlBar.h"@@ -247,6 +248,18 @@ CommandSet *CommandStore::newCommandSetOverride( CommandSet *setToOverride )} // end ifelse if( ini->getLoadType() == INI_LOAD_MULTIFILE ){+ // The fork's sets are EA's with corrections. A mod that ships its own CommandSet.ini fills the+ // same names with its own buttons, and a set replaced whole took Contra's Demolitions General+ // his power tray and left its Air Force General two columns of promotions. The mod's set stays.+ Bool inModArchive = FALSE;+ if( TheFileSystem->modLooseFile( AsciiString( "Data\\INI\\CommandSet.ini" ), &inModArchive ).isNotEmpty() || inModArchive )+ {+ CommandSet *unused = newInstance(CommandSet)( name );+ ini->initFromINI( unused, unused->friend_getFieldParse() );+ unused->deleteInstance();+ return;+ }+// a patch file's set replaces the set whole, in place, so every pointer to it stays goodcommandSet->friend_clearCommands();}diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBar.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBar.cppindex d113e95d9..07c20aa6f 100644--- a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBar.cpp+++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBar.cpp@@ -822,206 +822,14 @@ Player *ControlBar::getWatchedPlayer( void )return local;}-/** True when a compact section gives this button a window: a real purchase the player could ever- * see. A script-only button, a science a script hid and one whose root prerequisites the player's- * general never has would leave a hole. */-static Bool isSciencePurchaseShown( const Player *player, const CommandButton *commandButton )-{- if( commandButton == NULL || BitTest( commandButton->getOptions(), SCRIPT_ONLY ) )- return FALSE;- if( commandButton->getScienceVec().empty() )- return TRUE;- ScienceType science = commandButton->getScienceVec()[ 0 ];- return !player->isScienceHidden( science ) && TheScienceStore->playerHasRootPrereqsForScience( player, science );-}--/// the promotion screen's sections: rank 1, rank 3 and rank 8 (the 5 star general)-enum { PURCHASE_SCIENCE_RANK_SECTIONS = 3 };--/** Does upgrade's science name base's among its own prerequisites - Paradrop 2 over Paradrop 1? */-static Bool isSciencePurchaseUpgradeOf( const CommandButton *upgrade, const CommandButton *base )-{- if( base->getScienceVec().empty() || upgrade->getScienceVec().empty() )- return FALSE;- return TheScienceStore->isDirectPrereq( base->getScienceVec()[ 0 ], upgrade->getScienceVec()[ 0 ] );-}--/** Lays a mod faction's purchase buttons on the three rank sections of our promotion screen. A mod's- * command sets were written for the mod's own screen and leave holes in ours, so the slots are not- * kept. Each section is a grid of columns and rows read off its windows' positions. A chain of- * upgrades - a science whose prerequisite is another science on the screen - stacks down one column,- * base on top, the way Zero Hour stacks Paradrop 1, 2 and 3. A chain whose base sits in an earlier- * section starts in the column under that base when this section has one; the other chains take the- * leftmost column with room. What is left, single skills and the part of a chain that did not fit,- * fills the free windows in reading order and slot order. The windows are fixed by the layout, so a- * section with more buttons than windows drops the rest and the log names them. */-static void layoutModPurchaseSciences( const Player *player, const CommandSet *const *commandSets, GameWindow **const *sectionWindows, const Int *windowCounts, const CommandButton *(*placed)[ MAX_COMMANDS_PER_SET ] )-{- enum { NO_WINDOW = -1, NO_CHAIN = -1 };- const CommandButton *earlierButtons[ MAX_COMMANDS_PER_SET * PURCHASE_SCIENCE_RANK_SECTIONS ];- Int earlierColumnX[ MAX_COMMANDS_PER_SET * PURCHASE_SCIENCE_RANK_SECTIONS ];- Int earlierCount = 0;-- for( Int section = 0; section < PURCHASE_SCIENCE_RANK_SECTIONS; section++ )- {- const CommandSet *commandSet = commandSets[ section ];- GameWindow **windows = sectionWindows[ section ];- const Int windowCount = windowCounts[ section ];- Int windowX[ MAX_COMMANDS_PER_SET ];- Int windowY[ MAX_COMMANDS_PER_SET ];- Int columnX[ MAX_COMMANDS_PER_SET ];- Int rowY[ MAX_COMMANDS_PER_SET ];- Int columnCount = 0;- Int rowCount = 0;- Int i;-- for( i = 0; i < windowCount; i++ )- {- placed[ section ][ i ] = NULL;- windows[ i ]->winGetScreenPosition( &windowX[ i ], &windowY[ i ] );- if( std::find( columnX, columnX + columnCount, windowX[ i ] ) == columnX + columnCount )- columnX[ columnCount++ ] = windowX[ i ];- if( std::find( rowY, rowY + rowCount, windowY[ i ] ) == rowY + rowCount )- rowY[ rowCount++ ] = windowY[ i ];- }- std::sort( columnX, columnX + columnCount );- std::sort( rowY, rowY + rowCount );-- // cell[column][row] is the window there, or NO_WINDOW; a filled cell turns NO_WINDOW too- Int cell[ MAX_COMMANDS_PER_SET ][ MAX_COMMANDS_PER_SET ];- for( Int column = 0; column < columnCount; column++ )- for( Int row = 0; row < rowCount; row++ )- cell[ column ][ row ] = NO_WINDOW;- for( i = 0; i < windowCount; i++ )- {- const Int column = std::find( columnX, columnX + columnCount, windowX[ i ] ) - columnX;- const Int row = std::find( rowY, rowY + rowCount, windowY[ i ] ) - rowY;- cell[ column ][ row ] = i;- }-- const CommandButton *shown[ MAX_COMMANDS_PER_SET ];- Int shownCount = 0;- for( i = 0; i < MAX_COMMANDS_PER_SET; i++ )- if( isSciencePurchaseShown( player, commandSet->getCommandButton( i ) ) )- shown[ shownCount++ ] = commandSet->getCommandButton( i );-- // chains of shown buttons, a base's first upgrade following it; roots first, then anything a- // branch or a loop left unclaimed starts a chain of its own- Int chainMembers[ MAX_COMMANDS_PER_SET ][ MAX_COMMANDS_PER_SET ];- Int chainLength[ MAX_COMMANDS_PER_SET ];- Int chainCount = 0;- Int chainOf[ MAX_COMMANDS_PER_SET ];- std::fill( chainOf, chainOf + shownCount, (Int)NO_CHAIN );- for( Int rootsOnly = 1; rootsOnly >= 0; rootsOnly-- )- {- for( Int start = 0; start < shownCount; start++ )- {- if( chainOf[ start ] != NO_CHAIN )- continue;- Bool hasBaseHere = FALSE;- for( Int other = 0; other < shownCount; other++ )- hasBaseHere |= other != start && isSciencePurchaseUpgradeOf( shown[ start ], shown[ other ] );- if( rootsOnly && hasBaseHere )- continue;-- const Int chain = chainCount++;- chainLength[ chain ] = 0;- for( Int member = start; member != NO_CHAIN; )- {- chainOf[ member ] = chain;- chainMembers[ chain ][ chainLength[ chain ]++ ] = member;- Int next = NO_CHAIN;- for( Int upgrade = 0; upgrade < shownCount && next == NO_CHAIN; upgrade++ )- if( chainOf[ upgrade ] == NO_CHAIN && isSciencePurchaseUpgradeOf( shown[ upgrade ], shown[ member ] ) )- next = upgrade;- member = next;- }- }- }-- Int leftovers[ MAX_COMMANDS_PER_SET ];- Int leftoverCount = 0;-- auto placeButton = [&]( Int column, Int row, Int member )- {- placed[ section ][ cell[ column ][ row ] ] = shown[ member ];- earlierButtons[ earlierCount ] = shown[ member ];- earlierColumnX[ earlierCount++ ] = columnX[ column ];- cell[ column ][ row ] = NO_WINDOW;- };- auto freeRows = [&]( Int column )- {- Int count = 0;- for( Int row = 0; row < rowCount; row++ )- count += cell[ column ][ row ] != NO_WINDOW;- return count;- };- auto stackChain = [&]( Int chain, Int column )- {- Int member = 0;- for( Int row = 0; row < rowCount && member < chainLength[ chain ]; row++ )- if( cell[ column ][ row ] != NO_WINDOW )- placeButton( column, row, chainMembers[ chain ][ member++ ] );- while( member < chainLength[ chain ] )- leftovers[ leftoverCount++ ] = chainMembers[ chain ][ member++ ];- };-- Bool stacked[ MAX_COMMANDS_PER_SET ] = { FALSE };- const Int earlierSections = earlierCount;- for( Int chain = 0; chain < chainCount; chain++ )- {- const CommandButton *root = shown[ chainMembers[ chain ][ 0 ] ];- for( Int earlier = 0; earlier < earlierSections && !stacked[ chain ]; earlier++ )- {- if( !isSciencePurchaseUpgradeOf( root, earlierButtons[ earlier ] ) )- continue;- const Int column = std::find( columnX, columnX + columnCount, earlierColumnX[ earlier ] ) - columnX;- if( column == columnCount )- continue;- stackChain( chain, column );- stacked[ chain ] = TRUE;- }- }- for( Int chain = 0; chain < chainCount; chain++ )- {- if( stacked[ chain ] || chainLength[ chain ] < 2 )- continue;- Int roomiest = 0;- for( Int column = 0; column < columnCount; column++ )- {- if( freeRows( column ) >= chainLength[ chain ] )- {- roomiest = column;- break;- }- if( freeRows( column ) > freeRows( roomiest ) )- roomiest = column;- }- stackChain( chain, roomiest );- stacked[ chain ] = TRUE;- }- for( Int chain = 0; chain < chainCount; chain++ )- if( !stacked[ chain ] )- leftovers[ leftoverCount++ ] = chainMembers[ chain ][ 0 ];-- std::sort( leftovers, leftovers + leftoverCount );- Int leftover = 0;- for( Int row = 0; row < rowCount; row++ )- for( Int column = 0; column < columnCount && leftover < leftoverCount; column++ )- if( cell[ column ][ row ] != NO_WINDOW )- placeButton( column, row, leftovers[ leftover++ ] );- for( ; leftover < leftoverCount; leftover++ )- DEBUG_LOG(( "PROMOTION %s has %d windows, no room for %s\n", commandSet->getName().str(), windowCount, shown[ leftovers[ leftover ] ]->getName().str() ));- }-}--/** Puts one rank's placed buttons on its windows, placed[i] on windows[i]. The caller has hidden- * every window. */-void ControlBar::populatePurchaseScienceRank( Player *player, const CommandButton *const *placed, GameWindow **windows, Int windowCount )+/** Puts one rank's command set on its windows, slot i on window i. Every promotion screen, Zero Hour's+ * and each mod's, numbers its windows down the columns the same way, so a mod's empty slots and its+ * columns are the ones its author laid out on ours too. The caller has hidden every window. */+void ControlBar::populatePurchaseScienceRank( Player *player, const CommandSet *commandSet, GameWindow **windows, Int windowCount ){for( Int i = 0; i < windowCount; i++ ){- const CommandButton *commandButton = placed[ i ];+ const CommandButton *commandButton = commandSet->getCommandButton( i );GameWindow *window = windows[ i ];if( commandButton == NULL || BitTest( commandButton->getOptions(), SCRIPT_ONLY ) )@@ -1085,21 +893,9 @@ void ControlBar::populatePurchaseScience( Player* player )commandSet8 == NULL )return;- const CommandSet *sectionSets[ PURCHASE_SCIENCE_RANK_SECTIONS ] = { commandSet1, commandSet3, commandSet8 };- GameWindow **sectionWindows[ PURCHASE_SCIENCE_RANK_SECTIONS ] = { m_sciencePurchaseWindowsRank1, m_sciencePurchaseWindowsRank3, m_sciencePurchaseWindowsRank8 };- const Int windowCounts[ PURCHASE_SCIENCE_RANK_SECTIONS ] = { MAX_PURCHASE_SCIENCE_RANK_1, MAX_PURCHASE_SCIENCE_RANK_3, MAX_PURCHASE_SCIENCE_RANK_8 };- const CommandButton *placed[ PURCHASE_SCIENCE_RANK_SECTIONS ][ MAX_COMMANDS_PER_SET ];-- // retail keeps slot i on window i, gaps and all, as Zero Hour shipped it- if( ControlBarIsModFaction( player->getPlayerTemplate() ) )- layoutModPurchaseSciences( player, sectionSets, sectionWindows, windowCounts, placed );- else- for( Int section = 0; section < PURCHASE_SCIENCE_RANK_SECTIONS; section++ )- for( i = 0; i < windowCounts[ section ]; i++ )- placed[ section ][ i ] = sectionSets[ section ]->getCommandButton( i );-- for( Int section = 0; section < PURCHASE_SCIENCE_RANK_SECTIONS; section++ )- populatePurchaseScienceRank( player, placed[ section ], sectionWindows[ section ], windowCounts[ section ] );+ populatePurchaseScienceRank( player, commandSet1, m_sciencePurchaseWindowsRank1, MAX_PURCHASE_SCIENCE_RANK_1 );+ populatePurchaseScienceRank( player, commandSet3, m_sciencePurchaseWindowsRank3, MAX_PURCHASE_SCIENCE_RANK_3 );+ populatePurchaseScienceRank( player, commandSet8, m_sciencePurchaseWindowsRank8, MAX_PURCHASE_SCIENCE_RANK_8 );//// Somebody else's screen is a read-out, not a shop: a watcher sees what that general has boughtdiff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarScheme.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarScheme.cppindex ea8a1070f..f16b95907 100644--- a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarScheme.cpp+++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarScheme.cpp@@ -1108,8 +1108,8 @@ ControlBarScheme *ControlBarSchemeManager::findSchemeForSide( const AsciiString&}//------------------------------------------------------------------------------/** The owner's call: a mod's faction gets our American power tray and our science layout, whatever- * .wnd the mod names. Its buttons, cameos and portrait are still the mod's. Under -modfactions that+/** The owner's call: a mod's faction gets our American power tray, whatever .wnd the mod names. Its+ * buttons, cameos and portrait are still the mod's. Under -modfactions that* is a faction with a mod index; under a single -mod every faction is the mod's. The observer is* none. *///-----------------------------------------------------------------------------diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GameConsole.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GameConsole.cppindex eba258528..881c0d865 100644--- a/GeneralsMD/Code/GameEngine/Source/GameClient/GameConsole.cpp+++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GameConsole.cpp@@ -49,6 +49,7 @@#include "GameClient/Gadget.h"#include "GameClient/GadgetListBox.h"#include "GameClient/GUICallbacks.h"+#include "GameClient/HotKey.h"#include "GameClient/InGameUI.h"#include "GameClient/GameWindowManager.h"#include "GameClient/WindowLayout.h"@@ -977,11 +978,18 @@ GameMessageDisposition GameConsoleTranslator::translateGameMessage( const GameMeconst UnsignedByte key = msg->getArgument( 0 )->integer;const UnsignedShort keyState = msg->getArgument( 1 )->integer;- // the key above Tab belongs to the console whether it is open or shut+ // The key above Tab belongs to the console whether it is open or shut, unless a button on+ // screen is labelled with it: Contra's Special Powers menu is "&`", and its tooltip sends the+ // player to this key. Shift still reaches the console. The button is asked for by name and+ // not by what the layout types here, which on a Turkish keyboard is a double quote.if( key == KEY_TICK ){if( BitTest( keyState, KEY_STATE_DOWN ) && !BitTest( keyState, KEY_STATE_AUTOREPEAT ) )- TheGameConsole->toggle();+ {+ const Bool plain = !BitTest( keyState, KEY_STATE_CONTROL | KEY_STATE_SHIFT | KEY_STATE_ALT );+ if( TheGameConsole->isOpen() || !plain || !TheHotKeyManager->executeHotKey( HotKeyManager::nameOf( u'`' ) ) )+ TheGameConsole->toggle();+ }return DESTROY_MESSAGE;}