Skip to content

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.

feat(gamenetwork): persona tooltip says what the picked personality does

Olcay Seygan1c88f377ec67
diff --git a/CHANGELOG.md b/CHANGELOG.md
index a7e59d307..dd16cfde5 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -38,6 +38,7 @@ found and fixed — EA's own, not port damage.**
## Computer players have personalities
- Every computer seat in the skirmish, LAN and online lobbies has a new Personality box beside its team. It says how that player plays, and the difficulty still says how well, so a Hard Turtle and an Easy Turtle play the same way at different strengths.
+- Point at the Personality box and its tooltip says what the picked personality does, in one line, where every box used to give the same vague sentence. With the list open, each line explains itself as the pointer passes over it. In English and Turkish.
- Normal is the computer player you know, unchanged. The others:
- **Attacker** goes out early and often with smaller waves and spends everything it earns.
- **Turtle** finds the narrow stretch of each road into its base and packs its defences there so they cover each other, rather than ringing its command centre. China mines the guns on that line, GLA lays demo traps in front of it and America leans on Fire Bases. It holds its army back for a few big late waves and pulls out of fights it is losing.
diff --git a/GeneralsMD/Code/Data/Patch.str b/GeneralsMD/Code/Data/Patch.str
index 1383c0f97..015ed2e07 100644
--- a/GeneralsMD/Code/Data/Patch.str
+++ b/GeneralsMD/Code/Data/Patch.str
@@ -1822,6 +1822,67 @@ GUI:AIPersonaTooltip
"How this computer player plays, whatever its difficulty"
END
+// What each personality does, shown when the pointer is over the box or a line of its list
+GUI:AIPersonaTooltipNormal
+"Plays exactly as the computer always has."
+END
+
+GUI:AIPersonaTooltipAttacker
+"Attacks early and often with smaller waves, spends its money as fast as it comes in and builds few defences."
+END
+
+GUI:AIPersonaTooltipTurtle
+"Puts up a defence line early and guns at the chokepoints, attacks late with big waves and pulls back sooner when it is losing."
+END
+
+GUI:AIPersonaTooltipEconomist
+"Income and upgrades first, a later first attack, and its spare money goes to the poorest ally."
+END
+
+GUI:AIPersonaTooltipAir
+"Builds airfields and sends its aircraft out on sorties, and turns away from them when your anti-air is heavy."
+END
+
+GUI:AIPersonaTooltipRusher
+"Throws everything into one attack, three minutes in on Hard and four and a half on Easy, with almost no defences. After it, it plays as an Attacker."
+END
+
+GUI:AIPersonaTooltipRaider
+"Sends small groups of its fastest vehicles around your army at your gatherers and workers, from the third minute on Hard and the fifth on Easy."
+END
+
+GUI:AIPersonaTooltipTech
+"Sits behind its defences and races to the superweapon, then plays as the normal computer once it stands. Turns its powers on whoever hits an ally."
+END
+
+GUI:AIPersonaTooltipInfantry
+"An infantry army trained from its barracks first, with its waves carried in transports."
+END
+
+GUI:AIPersonaTooltipArmor
+"A tank-heavy army that waits longer to gather and attacks in fewer, bigger waves."
+END
+
+GUI:AIPersonaTooltipSneaky
+"Favours units that turn invisible, spends its general's points on stealth first and comes in by the flanks and the back door."
+END
+
+GUI:AIPersonaTooltipOpportunist
+"Goes after the weakest enemy in sight, and after whoever is already fighting someone else."
+END
+
+GUI:AIPersonaTooltipSupporter
+"Joins its allies' attacks and sends its idle army to clear enemies out of an ally's base."
+END
+
+GUI:AIPersonaTooltipCounter
+"Reads your army harder and builds what beats it, even on Easy."
+END
+
+GUI:AIPersonaTooltipRandom
+"One of the personalities above, drawn when the match starts. Never Normal."
+END
+
GUI:AIPersona
"Personality"
END
diff --git a/GeneralsMD/Code/Data/Turkish/Generals.str b/GeneralsMD/Code/Data/Turkish/Generals.str
index 6de8d42d2..5c9ae3819 100644
--- a/GeneralsMD/Code/Data/Turkish/Generals.str
+++ b/GeneralsMD/Code/Data/Turkish/Generals.str
@@ -16215,6 +16215,67 @@ GUI:AIPersonaTooltip
"Zorluğu ne olursa olsun bu bilgisayar oyuncusunun nasıl oynadığı"
END
+// Her kişiliğin yaptığı, imleç kutunun ya da listesindeki bir satırın üstündeyken gösterilir
+GUI:AIPersonaTooltipNormal
+"Bilgisayarın her zaman oynadığı gibi oynar."
+END
+
+GUI:AIPersonaTooltipAttacker
+"Erken ve sık, küçük dalgalarla saldırır, parasını geldiği anda harcar ve az savunma kurar."
+END
+
+GUI:AIPersonaTooltipTurtle
+"Erkenden bir savunma hattı ve geçitlere toplar kurar, geç ve büyük dalgalarla saldırır, kaybederken daha erken geri çekilir."
+END
+
+GUI:AIPersonaTooltipEconomist
+"Önce gelir ve yükseltmeler, ilk saldırısı daha geç, artan parası en yoksul müttefikine gider."
+END
+
+GUI:AIPersonaTooltipAir
+"Havaalanları kurar, uçaklarını akınlara yollar, uçaksavarın güçlüyse uçaktan vazgeçer."
+END
+
+GUI:AIPersonaTooltipRusher
+"Her şeyini tek bir saldırıya koyar, Zor'da üçüncü, Kolay'da dördüncü buçuk dakikada, neredeyse hiç savunma kurmadan. Sonrasında Saldırgan gibi oynar."
+END
+
+GUI:AIPersonaTooltipRaider
+"En hızlı araçlarından küçük grupları ordunun etrafından dolaştırıp toplayıcılarına ve işçilerine yollar, Zor'da üçüncü, Kolay'da beşinci dakikadan başlayarak."
+END
+
+GUI:AIPersonaTooltipTech
+"Savunmasının arkasında süper silaha koşar, süper silah ayağa kalkınca normal bilgisayar gibi oynar. Müttefikine vurana güçlerini çevirir."
+END
+
+GUI:AIPersonaTooltipInfantry
+"Önce kışlasından yetiştirdiği bir piyade ordusu, dalgalarını nakliye araçlarıyla taşır."
+END
+
+GUI:AIPersonaTooltipArmor
+"Toplanmak için daha uzun bekleyen, daha az ama daha büyük dalgalarla saldıran tank ağırlıklı bir ordu."
+END
+
+GUI:AIPersonaTooltipSneaky
+"Görünmez olabilen birlikleri sever, generallik puanlarını önce gizliliğe harcar, kanatlardan ve arka kapıdan gelir."
+END
+
+GUI:AIPersonaTooltipOpportunist
+"Görüşteki en zayıf düşmanın ve zaten başkasıyla savaşanın peşine düşer."
+END
+
+GUI:AIPersonaTooltipSupporter
+"Müttefiklerinin saldırılarına katılır, boştaki ordusunu müttefikin üssündeki düşmanları temizlemeye yollar."
+END
+
+GUI:AIPersonaTooltipCounter
+"Ordunu daha dikkatli okur ve onu yenecek olanı kurar, Kolay'da bile."
+END
+
+GUI:AIPersonaTooltipRandom
+"Yukarıdaki kişiliklerden biri, maç başlarken çekilir. Normal asla çıkmaz."
+END
+
GUI:AIPersona
"Kişilik"
END
diff --git a/GeneralsMD/Code/GameEngine/Source/GameNetwork/GUIUtil.cpp b/GeneralsMD/Code/GameEngine/Source/GameNetwork/GUIUtil.cpp
index 4610d096d..2aeaafdbd 100644
--- a/GeneralsMD/Code/GameEngine/Source/GameNetwork/GUIUtil.cpp
+++ b/GeneralsMD/Code/GameEngine/Source/GameNetwork/GUIUtil.cpp
@@ -45,6 +45,7 @@
#include "GameClient/GameText.h"
#include "GameClient/Display.h"
#include "GameClient/Image.h"
+#include "GameClient/Mouse.h"
#include "GameClient/UIStyle.h"
#include "GameLogic/GameLogic.h" // SUPERWEAPON_RESTRICT_COUNT
#include "GameLogic/AI.h" // AIPersonality, for the personality column
@@ -874,6 +875,32 @@ static void setSeatPlayerWidth(GameWindow *window, Int width)
window->winSetSize(width, height);
}
+static UnicodeString personaTooltip(Int persona)
+{
+ AsciiString label;
+ label.format("GUI:AIPersonaTooltip%s", aiPersonalityName((AIPersonality)persona));
+ return TheGameText->fetch(label);
+}
+
+// the box's own text, its arrow and its edit field all say what the picked personality does
+static void personaComboTooltip(GameWindow *window, WinInstanceData *, UnsignedInt)
+{
+ GameWindow *combo = BitTest(window->winGetStyle(), GWS_COMBO_BOX) ? window : window->winGetParent();
+ Int pos = 0;
+ GadgetComboBoxGetSelectedPos(combo, &pos);
+ TheMouse->setCursorTooltip(personaTooltip((Int)(intptr_t)GadgetComboBoxGetItemData(combo, pos)));
+}
+
+// an open list says what the line under the pointer does
+static void personaListTooltip(GameWindow *listBox, WinInstanceData *, UnsignedInt mouse)
+{
+ Int row, col;
+ GadgetListBoxGetEntryBasedOnXY(listBox, LOLONGTOSHORT(mouse), HILONGTOSHORT(mouse), row, col);
+ if (row == -1 || col == -1)
+ return;
+ TheMouse->setCursorTooltip(personaTooltip((Int)(intptr_t)GadgetListBoxGetItemData(listBox, row, col)), 0);
+}
+
void InitAIPersonaComboBoxes(GameWindow *parent, const char *layoutFilename,
GameWindow *comboPersona[], NameKeyType comboPersonaID[])
{
@@ -894,6 +921,10 @@ void InitAIPersonaComboBoxes(GameWindow *parent, const char *layoutFilename,
GadgetListBoxSetListLength(listBox, AIPERSONA_COUNT);
// sixteen lines from a lower seat ran off the bottom of the screen; eight and a scroll bar
GadgetComboBoxSetMaxDisplay(comboPersona[i], min((Int)AIPERSONA_COUNT, 8));
+ comboPersona[i]->winSetTooltipFunc(personaComboTooltip);
+ GadgetComboBoxGetEditBox(comboPersona[i])->winSetTooltipFunc(personaComboTooltip);
+ GadgetComboBoxGetDropDownButton(comboPersona[i])->winSetTooltipFunc(personaComboTooltip);
+ listBox->winSetTooltipFunc(personaListTooltip);
GadgetComboBoxReset(comboPersona[i]);
const Color color = comboPersona[i]->winGetEnabledTextColor();