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(gameclient): aircraft altitude lines as an options check box

Olcay Seygan9bf42430b4ca
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 08fe14220..146ebfe9f 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -856,7 +856,7 @@ found and fixed, EA's own, not port damage.**
## Aircraft, guards, and orders that used to be ignored
-- From the game's angle a Comanche over a ridge and a Comanche over your base can sit on the same spot of the screen. Aircraft in the air now hang a thin line straight down to the ground or water under them, so the foot tells you where the plane really is and the length how high. A parked one has none, and cutscenes draw none. A high plane at the very bottom edge of the screen can lose its line there, and so can one whose line would be taller than the screen.
+- From the game's angle a Comanche over a ridge and a Comanche over your base can sit on the same spot of the screen. Aircraft in the air now hang a thin line straight down to the ground or water under them, so the foot tells you where the plane really is and the length how high. A parked one has none, and cutscenes draw none. A high plane at the very bottom edge of the screen can lose its line there, and so can one whose line would be taller than the screen. If the lines are clutter to you, Aircraft Altitude Lines under Options, Interface turns them off; they start on.
- Two jets on one airfield could deadlock waiting for each other; now they go.
- Losing the airfield no longer leaves its aircraft circling rubble forever.
- A jet looking for a new airfield no longer locks parking spaces it never uses. The search booked a space at every airfield it looked at on the way to the nearest, and each of those stayed booked for that jet until it died: an empty spot on the tarmac no other plane could land on and the airfield could not build into.
diff --git a/GeneralsMD/Code/Data/Patch.str b/GeneralsMD/Code/Data/Patch.str
index c8e75b63a..fcda1f34d 100644
--- a/GeneralsMD/Code/Data/Patch.str
+++ b/GeneralsMD/Code/Data/Patch.str
@@ -887,6 +887,14 @@ TOOLTIP:OrderLines
"A line from each selected unit to where it is going, and on through every point it has queued. Off, the markers on those points stay."
END
+GUI:AircraftAltitudeLine
+"Aircraft Altitude Lines"
+END
+
+TOOLTIP:AircraftAltitudeLine
+"A thin line from each aircraft in the air straight down to the ground under it. Where it touches is where the plane really is, and its length is how high it flies. Parked aircraft have none."
+END
+
GUI:PlayerColors
"Player Colors"
END
diff --git a/GeneralsMD/Code/Data/Turkish/Generals.str b/GeneralsMD/Code/Data/Turkish/Generals.str
index d12f3c846..e6650ea81 100644
--- a/GeneralsMD/Code/Data/Turkish/Generals.str
+++ b/GeneralsMD/Code/Data/Turkish/Generals.str
@@ -15389,6 +15389,14 @@ TOOLTIP:OrderLines
"Seçili her birimden gittiği yere, oradan da sıraya aldığı her noktaya bir çizgi çeker. Kapalıyken çizgiler gider, o noktalardaki işaretler kalır."
END
+GUI:AircraftAltitudeLine
+"Uçak Yükseklik Çizgileri"
+END
+
+TOOLTIP:AircraftAltitudeLine
+"Havadaki her uçaktan altındaki yere dümdüz ince bir çizgi iner. Çizginin değdiği yer uçağın asıl yeri, boyu da ne kadar yüksekte uçtuğu. Yerde duran uçakta çizgi olmaz."
+END
+
GUI:PlayerColors
"Oyuncu Renkleri"
END
diff --git a/GeneralsMD/Code/Data/Window/Menus/OptionsMenuClassic.wnd b/GeneralsMD/Code/Data/Window/Menus/OptionsMenuClassic.wnd
index 382f2d8fa..02a5348ec 100644
--- a/GeneralsMD/Code/Data/Window/Menus/OptionsMenuClassic.wnd
+++ b/GeneralsMD/Code/Data/Window/Menus/OptionsMenuClassic.wnd
@@ -12829,6 +12829,53 @@ WINDOW
WINDOW
WINDOWTYPE = CHECKBOX;
SCREENRECT = UPPERLEFT: 288 378, BOTTOMRIGHT: 512 402, CREATIONRESOLUTION: 800 600;
+ NAME = "OptionsMenu.wnd:CheckAircraftAltitudeLine";
+ STATUS = ENABLED+IMAGE+BORDER;
+ STYLE = CHECKBOX+MOUSETRACK;
+ SYSTEMCALLBACK = "[None]";
+ INPUTCALLBACK = "[None]";
+ TOOLTIPCALLBACK = "[None]";
+ DRAWCALLBACK = "[None]";
+ FONT = NAME: "Arial", SIZE: 14, BOLD: 0;
+ HEADERTEMPLATE = "MinorTitle";
+ TOOLTIPTEXT = "TOOLTIP:AircraftAltitudeLine";
+ TOOLTIPDELAY = -1;
+ TEXT = "GUI:AircraftAltitudeLine";
+ TEXTCOLOR = ENABLED: 255 255 255 255, ENABLEDBORDER: 0 0 0 255,
+ DISABLED: 192 192 192 255, DISABLEDBORDER: 64 64 64 255,
+ HILITE: 186 255 12 255, HILITEBORDER: 0 0 0 255;
+ ENABLEDDRAWDATA = IMAGE: NoImage, COLOR: 255 0 0 255, BORDERCOLOR: 255 128 128 255,
+ IMAGE: Active-Unchecked, COLOR: 255 255 255 0, BORDERCOLOR: 128 128 255 255,
+ IMAGE: Active-Checked, COLOR: 0 0 255 255, BORDERCOLOR: 128 128 255 255,
+ IMAGE: NoImage, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0,
+ IMAGE: NoImage, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0,
+ IMAGE: NoImage, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0,
+ IMAGE: NoImage, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0,
+ IMAGE: NoImage, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0,
+ IMAGE: NoImage, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0;
+ DISABLEDDRAWDATA = IMAGE: NoImage, COLOR: 128 128 128 255, BORDERCOLOR: 192 192 192 255,
+ IMAGE: Disabled-Unchecked, COLOR: 255 255 255 0, BORDERCOLOR: 192 192 192 255,
+ IMAGE: Disabled-Checked, COLOR: 64 64 64 255, BORDERCOLOR: 254 254 254 255,
+ IMAGE: NoImage, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0,
+ IMAGE: NoImage, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0,
+ IMAGE: NoImage, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0,
+ IMAGE: NoImage, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0,
+ IMAGE: NoImage, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0,
+ IMAGE: NoImage, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0;
+ HILITEDRAWDATA = IMAGE: NoImage, COLOR: 0 255 0 255, BORDERCOLOR: 128 255 128 255,
+ IMAGE: Active-HiLighted, COLOR: 255 255 255 0, BORDERCOLOR: 128 128 255 255,
+ IMAGE: Active-Checked, COLOR: 255 255 0 255, BORDERCOLOR: 254 254 254 255,
+ IMAGE: NoImage, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0,
+ IMAGE: NoImage, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0,
+ IMAGE: NoImage, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0,
+ IMAGE: NoImage, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0,
+ IMAGE: NoImage, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0,
+ IMAGE: NoImage, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0;
+ END
+ CHILD
+ WINDOW
+ WINDOWTYPE = CHECKBOX;
+ SCREENRECT = UPPERLEFT: 288 406, BOTTOMRIGHT: 512 430, CREATIONRESOLUTION: 800 600;
NAME = "OptionsMenu.wnd:CheckEmptyBuildingPips";
STATUS = ENABLED+IMAGE+BORDER;
STYLE = CHECKBOX+MOUSETRACK;
diff --git a/GeneralsMD/Code/GameEngine/Include/Common/GlobalData.h b/GeneralsMD/Code/GameEngine/Include/Common/GlobalData.h
index ec32a75fc..e80a8f7c2 100644
--- a/GeneralsMD/Code/GameEngine/Include/Common/GlobalData.h
+++ b/GeneralsMD/Code/GameEngine/Include/Common/GlobalData.h
@@ -377,6 +377,7 @@ public:
Int m_playerColorScheme; ///< PlayerColorSchemeType: whose colour the client draws (client only)
Int m_textLanguage; ///< TextLanguageType: the translation GameText lays over the CSF, read once at startup (client only)
Bool m_showOrderLines; ///< draw a line from each selected unit to where it is going, and its queue (client only)
+ Bool m_aircraftAltitudeLine; ///< "AircraftAltitudeLine": a line from each aircraft in the air down to the ground under it (client only)
Bool m_scriptDebug; ///< Should we attempt to load the script debugger window (.DLL)
Bool m_particleEdit; ///< Should we attempt to load the particle editor (.DLL)
Bool m_displayDebug; ///< Used to display display debug info
diff --git a/GeneralsMD/Code/GameEngine/Source/Common/GlobalData.cpp b/GeneralsMD/Code/GameEngine/Source/Common/GlobalData.cpp
index 279dfe68e..51777271f 100644
--- a/GeneralsMD/Code/GameEngine/Source/Common/GlobalData.cpp
+++ b/GeneralsMD/Code/GameEngine/Source/Common/GlobalData.cpp
@@ -1006,6 +1006,7 @@ GlobalData::GlobalData()
// the words the game shipped with until somebody picks a translation
m_textLanguage = TEXT_LANGUAGE_ENGLISH;
m_showOrderLines = FALSE;
+ m_aircraftAltitudeLine = TRUE; // the owner's word: on until a player turns it off
m_particleEdit = FALSE;
diff --git a/GeneralsMD/Code/GameEngine/Source/Common/OptionsCatalog.cpp b/GeneralsMD/Code/GameEngine/Source/Common/OptionsCatalog.cpp
index 95fb1c7af..8df1b0f2a 100644
--- a/GeneralsMD/Code/GameEngine/Source/Common/OptionsCatalog.cpp
+++ b/GeneralsMD/Code/GameEngine/Source/Common/OptionsCatalog.cpp
@@ -128,6 +128,7 @@ OPTION_INT_ACCESSORS( m_healthBarColors )
OPTION_INT_ACCESSORS( m_playerColorScheme )
OPTION_INT_ACCESSORS( m_textLanguage )
OPTION_BOOL_ACCESSORS( m_showOrderLines )
+OPTION_BOOL_ACCESSORS( m_aircraftAltitudeLine )
OPTION_BOOL_ACCESSORS( m_showNetBox )
OPTION_BOOL_ACCESSORS( m_showEmptyBuildingPips )
OPTION_BOOL_ACCESSORS( m_useShadowVolumesForSkins )
@@ -525,6 +526,14 @@ const OptionDef TheOptionCatalog[] =
OPTION_BOOL, APPLY_LIVE, 0, 1,
get_m_showOrderLines, set_m_showOrderLines },
+ // The line from each aircraft in the air down to the ground under it. Drawn fresh every frame, so
+ // the box takes it away at once. On by default, unlike the rows around it: the owner wants it seen
+ // and left for the player who finds it noise to turn off. No row in the quality table, it is not
+ // a picture setting.
+ { "AircraftAltitudeLine", OPT_WND( "CheckAircraftAltitudeLine" ), "GUI:AircraftAltitudeLine",
+ OPTION_BOOL, APPLY_LIVE, 0, 1,
+ get_m_aircraftAltitudeLine, set_m_aircraftAltitudeLine },
+
// The box in the top right corner: the match clock, the frame rates and, in a network game, the
// connection. Off, the superweapon timers move up into the corner it leaves. A key of its own
// and not ShowHudOverlay, which left this catalog on purpose: an Options.ini from before that
diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/Drawable.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/Drawable.cpp
index a31d2929e..fea643bbb 100644
--- a/GeneralsMD/Code/GameEngine/Source/GameClient/Drawable.cpp
+++ b/GeneralsMD/Code/GameEngine/Source/GameClient/Drawable.cpp
@@ -3591,6 +3591,9 @@ Bool Drawable::drawsAnyUIText( void )
// ------------------------------------------------------------------------------------------------
void Drawable::drawAltitudeLine( void )
{
+ if( !TheGlobalData->m_aircraftAltitudeLine )
+ return;
+
const Object *obj = getObject();
if( obj == NULL || obj->isEffectivelyDead() )
return;
diff --git a/GeneralsMD/Code/Tests/test_gameengine.cpp b/GeneralsMD/Code/Tests/test_gameengine.cpp
index ebae73972..9387f06c3 100644
--- a/GeneralsMD/Code/Tests/test_gameengine.cpp
+++ b/GeneralsMD/Code/Tests/test_gameengine.cpp
@@ -19549,6 +19549,28 @@ TEST(empty_building_slots_are_a_check_box_that_starts_on)
delete scratch;
}
+TEST(aircraft_altitude_lines_are_a_check_box_that_starts_on)
+{
+ const OptionDef *def = findOptionDef( "AircraftAltitudeLine" );
+ CHECK( def != NULL );
+ if( def == NULL )
+ return;
+ CHECK_EQ( (Int)def->kind, (Int)OPTION_BOOL );
+ CHECK_EQ( (Int)def->apply, (Int)APPLY_LIVE );
+ CHECK( strstr( def->widgetName, "CheckAircraftAltitudeLine" ) != NULL );
+
+ GlobalData *saved = TheWritableGlobalData;
+ GlobalData *scratch = NEW GlobalData;
+ TheWritableGlobalData = scratch;
+
+ CHECK( scratch->m_aircraftAltitudeLine );
+ def->set( 0 );
+ CHECK( !scratch->m_aircraftAltitudeLine );
+
+ TheWritableGlobalData = saved;
+ delete scratch;
+}
+
TEST(high_static_lod_keeps_the_picture_settings)
{
StaticGameLODInfo high;
diff --git a/GeneralsMD/Code/Tools/optionsmenu_layout.py b/GeneralsMD/Code/Tools/optionsmenu_layout.py
index 6789f6190..267650955 100644
--- a/GeneralsMD/Code/Tools/optionsmenu_layout.py
+++ b/GeneralsMD/Code/Tools/optionsmenu_layout.py
@@ -185,6 +185,7 @@ NEW_CONTROLS = [
(LABEL, "LabelLanguage", "GUI:Language"),
(COMBO, "ComboBoxLanguage", None),
(CHECK, "CheckOrderLines", "GUI:OrderLines"),
+ (CHECK, "CheckAircraftAltitudeLine", "GUI:AircraftAltitudeLine"),
(CHECK, "CheckNetBox", "GUI:NetBox"),
(CHECK, "CheckEmptyBuildingPips", "GUI:EmptyBuildingPips"),
(CHECK, "CheckZoomToCursor", "GUI:ZoomToCursor"),
@@ -462,6 +463,7 @@ GROUP_LAYOUT = [
setting("LabelHealthBarColors", "ComboBoxHealthBarColors"),
setting("LabelPlayerColors", "ComboBoxPlayerColors"),
("check", "CheckOrderLines"),
+ ("check", "CheckAircraftAltitudeLine"),
("check", "CheckEmptyBuildingPips")]),
("GUI:OptionsGroupLanguage", [
setting("LabelLanguage", "ComboBoxLanguage")]),