Skip to content

Add Unit Passengers Display#2272

Open
CZHczhABCZ wants to merge 13 commits into
Phobos-developers:developfrom
CZHczhABCZ:feat-unit-passengers-display
Open

Add Unit Passengers Display#2272
CZHczhABCZ wants to merge 13 commits into
Phobos-developers:developfrom
CZHczhABCZ:feat-unit-passengers-display

Conversation

@CZHczhABCZ

@CZHczhABCZ CZHczhABCZ commented Jun 27, 2026

Copy link
Copy Markdown

Perhaps my inspiration came from a YR-based mod called Extreme Starry, but regardless, this feature provides players with a more convenient way to view the passengers inside vehicles.

  • Show passenger cameo icons and counts above vehicles when selected
  • Toggle via hotkey Toggle Unit Passengers with CSF-configurable messages
  • Two modes: Permanent (ShowUnitPassengers=true) and Toggleable (ShowUnitPassengers.Toggleable=true)
  • Icons use CAMEO_PAL, arranged bottom-to-top with fixed bottom boundary
  • When multiple units are selected, passenger cameos are not displayed simultaneously; this feature has been specifically handled to address that.

New INI tags:
In rulesmd.ini:

[AudioVisual]
ShowUnitPassengers=false              ; boolean, permanently shows passengers for all vehicles (ignores hotkey). Defaults to false
ShowUnitPassengers.Toggleable=false   ; boolean, allows hotkey to toggle the display. Defaults to false
ShowUnitPassengers.EnabledMessage=    ; CSF entry key, message shown when the feature is enabled via hotkey
ShowUnitPassengers.DisabledMessage=   ; CSF entry key, message shown when the feature is disabled via hotkey

[SOMETECHNO]                          ; TechnoType
ShowPassengers=                       ; boolean, permanently show/hide for this vehicle (overrides global). Not set = follow global
ShowPassengers.Toggleable=            ; boolean, override global toggleable setting for this vehicle. Not set = follow global
Passengers.PerRow=5                   ; integer, max icons per row before wrapping, defaults to 5
Passengers.BottomOffset=0,0           ; X,Y, bottom boundary offset from selection bracket, defaults to 0,0

Em……One picture to show the feature.Awa
Just like this:
Toggleable:
Hotkey
Permanent:
Normal

- Show passenger cameo icons and counts above vehicles when selected
- Toggle via hotkey Toggle Unit Passengers with CSF-configurable messages
- Two modes: Permanent (ShowUnitPassengers=true) and Toggleable (ShowUnitPassengers.Toggleable=true)
- Icons use CAMEO_PAL, arranged bottom-to-top with fixed bottom boundary

New INI tags:
  [AudioVisual] ShowUnitPassengers, ShowUnitPassengers.Toggleable,
    ShowUnitPassengers.EnabledMessage, ShowUnitPassengers.DisabledMessage
  [TechnoType] ShowPassengers, ShowPassengers.Toggleable,
    Passengers.PerRow, Passengers.BottomOffset
@CZHczhABCZ CZHczhABCZ force-pushed the feat-unit-passengers-display branch from c1aba96 to 5e17992 Compare June 27, 2026 13:59
@TaranDahl TaranDahl added ❓New feature Needs testing ⚙️T2 T2 maintainer review is sufficient labels Jun 27, 2026
Comment thread docs/User-Interface.md Outdated
Comment thread docs/User-Interface.md Outdated
Comment thread docs/User-Interface.md Outdated
Comment thread src/Ext/Techno/Body.Visuals.cpp Outdated
Comment thread docs/User-Interface.md Outdated
@github-actions

github-actions Bot commented Jun 27, 2026

Copy link
Copy Markdown

Nightly build for this pull request:

This comment is automatic and is meant to allow guests to get latest nightly builds for this pull request without registering. It is updated on every successful build.

Comment thread src/Ext/Techno/Body.Visuals.cpp Outdated
@CZHczhABCZ CZHczhABCZ force-pushed the feat-unit-passengers-display branch from 1bfa9f5 to 5d6ddbc Compare June 27, 2026 15:58
@NetsuNegi

NetsuNegi commented Jun 27, 2026

Copy link
Copy Markdown
Contributor

I think this should be T1 level...
The new class is just for hotkey, there's no new-systems or large codes.

@NetsuNegi NetsuNegi added ⚙️T1 T1 maintainer review is sufficient and removed ⚙️T2 T2 maintainer review is sufficient labels Jun 27, 2026
@CZHczhABCZ CZHczhABCZ force-pushed the feat-unit-passengers-display branch 2 times, most recently from 34bec10 to bdedc8c Compare June 28, 2026 01:12
@TaranDahl

Copy link
Copy Markdown
Contributor

I think this should be T1 level... The new class is just for hotkey, there's no new-systems or large codes.

I raised the level because she is a first-time contributor.

@phoboscn-bot

Copy link
Copy Markdown

To Chinese users:
This pull request has been mentioned on Phobos CN. There might be relevant details there:

致中文用户:
此拉取请求已在 Phobos CN 上被提及。那里可能有相关详细信息:

https://www.phoboscn.top/t/topic/600/1

@NetsuNegi

Copy link
Copy Markdown
Contributor

I think this is should be T1 level...

I think this should be T1 level... The new class is just for hotkey, there's no new-systems or large codes.

I raised the level because she is a first-time contributor.

This is not appropriate.

@CZHczhABCZ CZHczhABCZ force-pushed the feat-unit-passengers-display branch 2 times, most recently from 1d133f4 to 8fac7ff Compare June 28, 2026 03:31
- Show passenger cameo icons (SHP/PCX) and counts above vehicles when selected
- Toggle via hotkey Toggle Unit Passengers with CSF-configurable messages
- Two modes: Permanent (ShowUnitPassengers=true) and Toggleable (ShowUnitPassengers.Toggleable=true)
- Icons use CAMEO_PAL/SHP, with PCX cameo fallback, arranged bottom-to-top with fixed bottom boundary

New INI tags:
  [AudioVisual] ShowUnitPassengers, ShowUnitPassengers.Toggleable
  [TechnoType] ShowPassengers, ShowPassengers.PerRow, ShowPassengers.BottomOffset
@CZHczhABCZ CZHczhABCZ force-pushed the feat-unit-passengers-display branch from 8fac7ff to 1f1f0db Compare June 28, 2026 03:32
@CZHczhABCZ

Copy link
Copy Markdown
Author

Here are the additional test items.
https://www.phoboscn.top/t/topic/600/2?u=abcz

Comment thread docs/User-Interface.md Outdated
Comment thread docs/User-Interface.md Outdated
Comment thread docs/User-Interface.md Outdated
Comment thread docs/User-Interface.md Outdated
Comment thread docs/Whats-New.md Outdated
this->ShadowIndex_Frame.Read(exArtINI, pArtSection, "ShadowIndex.Frame");

this->AltCameoPCX.Read(pArtINI, pArtSection, "AltCameoPCX");
this->CameoPCX.Read(pArtINI, pArtSection, "CameoPCX");

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is suggested to place it before AltCameoPCX in Ares' order, rather than after it.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Moved CameoPCX.Read before AltCameoPCX.Read.

@DeathFishAtEase DeathFishAtEase Jun 28, 2026

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do not ignore the corresponding content in Ext\TechnoType\Body.h and .Process(this->CameoPCX) in Ext\TechnoType\Body.cpp.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Emm,maybe it's done.

@DeathFishAtEase DeathFishAtEase Jun 28, 2026

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The CameoPalette used for Shape cameo looks strange sandwiched between two PCX cameo entries. Also, in the serialization, declaration, and initialization sections, you still haven't placed CameoPCX and AltCameoPCX together.

Comment thread src/Phobos.INI.cpp
bool Phobos::Config::ShowPlacementPreview = false;
bool Phobos::Config::EnableSelectBox = false;
bool Phobos::Config::DigitalDisplay_Enable = false;
bool Phobos::Config::UnitPassengers_Enable = false;

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this feature add configuration items in RA2MD.INI for CnCNet Client and others to enable or disable?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Emm,Idon't know…
It seems other features that use hotkeys don't do this.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Really? Take Phobos::Config::DigitalDisplay_Enable in the previous line as an example. Many of them are here.

	Phobos::Config::ToolTipDescriptions = CCINIClass::INI_RA2MD.ReadBool(phobosSection, "ToolTipDescriptions", true);
	Phobos::Config::ToolTipBlur = CCINIClass::INI_RA2MD.ReadBool(phobosSection, "ToolTipBlur", false);
	Phobos::Config::PrioritySelectionFiltering = CCINIClass::INI_RA2MD.ReadBool(phobosSection, "PrioritySelectionFiltering", true);
	Phobos::Config::PriorityDeployFiltering = CCINIClass::INI_RA2MD.ReadBool(phobosSection, "PriorityDeployFiltering", true);
	Phobos::Config::TypeSelectUseIFVMode = CCINIClass::INI_RA2MD.ReadBool(phobosSection, "TypeSelectUseIFVMode", true);
	Phobos::Config::ShowPlacementPreview = CCINIClass::INI_RA2MD.ReadBool(phobosSection, "ShowPlacementPreview", true);
	Phobos::Config::MessageApplyHoverState = CCINIClass::INI_RA2MD.ReadBool(phobosSection, "MessageApplyHoverState", false);
	Phobos::Config::MessageDisplayInCenter = CCINIClass::INI_RA2MD.ReadBool(phobosSection, "MessageDisplayInCenter", false);
	Phobos::Config::MessageDisplayInCenter_BoardOpacity = CCINIClass::INI_RA2MD.ReadInteger(phobosSection, "MessageDisplayInCenter.BoardOpacity", 40);
	Phobos::Config::MessageDisplayInCenter_LabelsCount = CCINIClass::INI_RA2MD.ReadInteger(phobosSection, "MessageDisplayInCenter.LabelsCount", 6);
	Phobos::Config::MessageDisplayInCenter_RecordsCount = CCINIClass::INI_RA2MD.ReadInteger(phobosSection, "MessageDisplayInCenter.RecordsCount", 12);
	Phobos::Config::RealTimeTimers = CCINIClass::INI_RA2MD.ReadBool(phobosSection, "RealTimeTimers", false);
	Phobos::Config::RealTimeTimers_Adaptive = CCINIClass::INI_RA2MD.ReadBool(phobosSection, "RealTimeTimers.Adaptive", false);
	Phobos::Config::EnableSelectBox = CCINIClass::INI_RA2MD.ReadBool(phobosSection, "EnableSelectBox", false);
	Phobos::Config::DigitalDisplay_Enable = CCINIClass::INI_RA2MD.ReadBool(phobosSection, "DigitalDisplay.Enable", false);
	Phobos::Config::SaveGameOnScenarioStart = CCINIClass::INI_RA2MD.ReadBool(phobosSection, "SaveGameOnScenarioStart", true);
	Phobos::Config::ShowBriefing = CCINIClass::INI_RA2MD.ReadBool(phobosSection, "ShowBriefing", true);
	Phobos::Config::ShowPowerDelta = CCINIClass::INI_RA2MD.ReadBool(phobosSection, "ShowPowerDelta", true);
	Phobos::Config::ShowHarvesterCounter = CCINIClass::INI_RA2MD.ReadBool(phobosSection, "ShowHarvesterCounter", true);
	Phobos::Config::ShowWeedsCounter = CCINIClass::INI_RA2MD.ReadBool(phobosSection, "ShowWeedsCounter", true);
	Phobos::Config::HideLightFlashEffects = CCINIClass::INI_RA2MD.ReadBool(phobosSection, "HideLightFlashEffects", false);
	Phobos::Config::HideLaserTrailEffects = CCINIClass::INI_RA2MD.ReadBool(phobosSection, "HideLaserTrailEffects", false);
	Phobos::Config::HideShakeEffects = CCINIClass::INI_RA2MD.ReadBool(phobosSection, "HideShakeEffects", false);
	Phobos::Config::ShowFlashOnSelecting = CCINIClass::INI_RA2MD.ReadBool(phobosSection, "ShowFlashOnSelecting", false);
	Phobos::Config::SuperWeaponSidebar_RequiredSignificance = CCINIClass::INI_RA2MD.ReadInteger(phobosSection, "SuperWeaponSidebar.RequiredSignificance", 0);

	// Custom game speeds, 6 - i so that GS6 is index 0, just like in the engine
	Phobos::Config::CampaignDefaultGameSpeed = 6 - CCINIClass::INI_RA2MD.ReadInteger(phobosSection, "CampaignDefaultGameSpeed", 4);
	if (Phobos::Config::CampaignDefaultGameSpeed > 6 || Phobos::Config::CampaignDefaultGameSpeed < 0)
	{
		Phobos::Config::CampaignDefaultGameSpeed = 2;
	}

	{
		const byte temp = (byte)Phobos::Config::CampaignDefaultGameSpeed;

		Patch::Apply_RAW(0x55D77A, { temp }); // We overwrite the instructions that force GameSpeed to 2 (GS4)
		Patch::Apply_RAW(0x55D78D, { temp }); // when speed control is off. Doesn't need a hook.
	}

	Phobos::Config::ShowDesignatorRange = CCINIClass::INI_RA2MD.ReadBool(phobosSection, "ShowDesignatorRange", false);
	Phobos::Config::ShowPowerPlantEnhancerRange = CCINIClass::INI_RA2MD.ReadBool(phobosSection, "ShowPowerPlantEnhancerRange", false);

	CCINIC

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

@DeathFishAtEase DeathFishAtEase Jun 28, 2026

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please check the logic priority.
You can refer to the method here for improvement.

Comment thread src/Ext/Techno/Body.Visuals.cpp Outdated
Comment thread src/Ext/Techno/Body.Visuals.cpp Outdated
if (passengerCounts.empty())
return;

const auto bracketPos = GetFootSelectBracketPosition(pThis, Anchor(HorizontalPosition::Center, VerticalPosition::Top));

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does it not have any specific handling for BuildingType?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A specific handling has been added to BuildingType before calling GetFootSelectBracketPosition

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually, buildings have a dedicated GetBuildingSelectBracketPosition().

Comment thread src/Ext/Techno/Body.Visuals.cpp Outdated
- Move ToggleUnitPassengers include and MakeCommand to end of lists
- Place CameoPCX.Read before AltCameoPCX.Read per Ares convention
- Cache bottomOffset.Get() to avoid repeated calls
- Remove redundant passengerCounts.empty() check (already guards on NumPassengers)
@DeathFishAtEase

DeathFishAtEase commented Jun 28, 2026

Copy link
Copy Markdown
Collaborator

To testers: At the current stage, the following need to be tested:

  1. How it works when the transport is a BuildingType (Especially in terms of the coordinates drawn.).
  2. How it works with unloading and loading passengers in different orders, continuously or at once (NoQueueUpToEnter).
  3. How it interacts with the Automatic passenger deletion feature.

CZHczhABCZ and others added 3 commits June 28, 2026 18:57
- Rename fallback strings to 'Unit Passenger Icons' per review feedback
- Merge three Whats-New lines into one summary line with anchor link
…ngelog

New features belong in Changelog > #### New:, not Breaking changes
- Add abstract_cast<FootClass*> guard to prevent crash on BuildingType passengers
- Read UnitPassengers.Enable from [Phobos] section in RA2MD.INI
- Use pFoot instead of pThis for GetFootSelectBracketPosition
- Move ShowUnitPassengers reads to end of Rules/Body.cpp LoadFromINIFile
- Add blank line between BunkerStateUpdateDelay and ShowUnitPassengers in Rules/Body.h
- Move DrawUnitPassengers declaration after ApplyKillDriver in Techno/Body.h
- Ensure proper blank line spacing in Hooks.Pips.cpp
@CZHczhABCZ CZHczhABCZ force-pushed the feat-unit-passengers-display branch from 6443e68 to 92365a5 Compare June 28, 2026 13:16
Comment thread .agents/AGENTS.md Outdated
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Needs testing ❓New feature ⚙️T1 T1 maintainer review is sufficient

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants