Skip to content

Add Passengers/Occupants Cameo Display#2272

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

Add Passengers/Occupants Cameo Display#2272
CZHczhABCZ wants to merge 35 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.

When you select a single vehicle or building, cameo icons and counts of passengers/occupants inside are displayed above the unit, giving you a quick overview of what's inside. Two activation modes are available:

  1. Permanent mode: Set ShowCameo=true (globally or per-unit) to always display cameos.
  2. Toggleable mode: Set ShowCameo=false (global) + ShowCameo.Toggleable=true (global), then use the Toggle Cameos hotkey to switch the display on/off.

Features

  • Supports two unit types: passengers (Passengers) and garrisoned occupants (Occupant)
    Only shown when a single unit is selected (not box-selection)
    Layout: horizontal rows, fixed bottom boundary, auto wrap upward when exceeding PerRow, first-entered unit displayed at the top.
    Example: A–E (letters represent entry order), 2 icons per row:
    AB
    CD
    E (centered)
    (bottom)

  • Translucency: set ShowCameo.Translucency = 0/25/50/75, SHP only

  • Overlap customization:
    ShowCameo.OverlapXY: overlap percentage between adjacent cameos (supports negative values)
    ShowCameo.OffsetXY: pixel offset adjustment (supports negative values)
    ShowCameo.OverlapPrimary: controls overlay direction, true = earlier cameo covers later, false = later covers earlier

  • Custom SHP support:
    ShowCameo.CustomShape in artmd.ini to specify a per-unit custom SHP icon (animated SHPs supported)
    ShowCameo.CustomPalette to specify a custom palette; falls back to CameoPalette or the default cameo.pal

New INI Tags:

In RA2MD.INI:

[Phobos]
ShowCameo.Enable=true               ; boolean, master switch

In rulesmd.ini:

[AudioVisual]
ShowCameo=false                     ; boolean, permanent display
ShowCameo.Toggleable=false          ; boolean, allow hotkey toggle
ShowCameo.PerRow=5                  ; integer, max icons per row
ShowCameo.BottomOffset=0,0          ; X,Y, bottom boundary offset
ShowCameo.Translucency=0            ; 0/25/50/75, default 0 (opaque)
ShowCameo.OverlapXY=0,0             ; X,Y overlap percentage
ShowCameo.OffsetXY=0,0              ; X,Y pixel offset
ShowCameo.OverlapPrimary=true       ; boolean, earlier covers later

[SOMETECHNO]                        ; TechnoType
ShowCameo=                          ; boolean, default true
ShowCameo.PerRow=                   ; inherits [AudioVisual]
ShowCameo.BottomOffset=             ; inherits [AudioVisual]
ShowCameo.Translucency=             ; inherits [AudioVisual]
ShowCameo.OverlapXY=                ; inherits [AudioVisual]
ShowCameo.OffsetXY=                 ; inherits [AudioVisual]
ShowCameo.OverlapPrimary=           ; inherits [AudioVisual]

In artmd.ini:

[SOMETECHNO]                        ; TechnoType (passenger/occupant type)
ShowCameo.CustomShape=              ; SHP filename, uses default if not set
ShowCameo.CustomPCX=                ; PCX filename, uses default if not set
ShowCameo.CustomPalette=            ; PAL filename, falls back if not set

CSF Entries:

CSF Label Description Fallback Text
TXT_SHOWCAMEO Hotkey name Toggle Cameos
TXT_SHOWCAMEO_DESC Hotkey description Show/hide cameo display.
MSG:ShowCameoEnabled Toggle enabled message Cameos Display: Enabled
MSG:ShowCameoDisabled Toggle disabled message Cameos Display: Disabled

Fallback text is used if the CSF label is not found.

- 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
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
Comment thread src/Ext/TechnoType/Body.cpp
Comment thread src/Phobos.INI.cpp Outdated
Comment thread src/Ext/Techno/Body.Visuals.cpp Outdated
Comment thread src/Ext/Techno/Body.Visuals.cpp Outdated
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
@CZHczhABCZ CZHczhABCZ changed the title Add Unit Passengers Display Add Passengers Cameo Display Jul 4, 2026
@CZHczhABCZ

CZHczhABCZ commented Jul 4, 2026

Copy link
Copy Markdown
Author

@TaranDahl I think I've addressed all the changes you requested. Could you please re‑review?

(Ah…I hope this doesn't interfere with your normal work. Please feel free to re‑review whenever it's convenient for you.)

Move ShowPassengers_Enable as master switch with early return; merge redundant shouldShow branches; move CameoPalette.LoadFromINI after ShowPassengers reads to match declaration order
CSF: MSG:PassengerCameoDisplayEnabled/Disabled, TXT_PASSENGERCAMEO/_DESC. Fix passenger vector reversal for LIFO list. Docs: section title, description text, INI defaults.
Comment thread docs/User-Interface.md Outdated
- Rename TogglePassengers to ToggleCameos
- Add ShowCameo.CustomPalette tag (artmd.ini)
- Fix building passenger display order (LIFO reverse + Y flip)
- Fix occupant display order (FIFO, no reverse)
- Update docs with full CN/EN bilingual documentation
…ix formatting

- Move ShowCameo.Enable to its own [Phobos] block in Show Cameo section
- Rewrite Show Cameo docs to be concise, English-only, following Phobos style
- Remove Chinese from comments in Body.Visuals.cpp
- Remove blank line before CameoPalette in TechnoType/Body.cpp
- Fix ; placement in serialization chain
…rrectly with Y flip

- When OverlapPrimary=true, earlier (visual top) cameos should cover later (visual bottom) ones
- For buildings, the Y flip reverses visual order but draw order still followed cameoCounts
- Fix: draw buildings in reverse cameoCounts order so visual top draws last
- Move Toggle Cameos to end of Hotkey Commands section
- Move ShowCameo changelog entry from Breaking changes to New features
- Move ShowCameo declarations to end of public block in Rules/Body.h
- Restore blank line before BuildingSelectBracketPosition in Enum.h
- Move ShowCameo_Enable to end of Config struct in Phobos.h
- Move ShowCameo_Enable fields to end of Config blocks in Phobos.INI.cpp
- Move ToggleCameos files to end of Commands block in Phobos.vcxproj
…-New

- Move Toggle Cameos to after Deselect Object(s), before Loading screen
- Remove ShowCameo.Enable from New user settings (0.2 version log)
- Remove duplicate ShowCameo entry from Vanilla fixes (already in New section)
@CZHczhABCZ CZHczhABCZ changed the title Add Passengers Cameo Display Add Passengers/Occupants Cameo Display Jul 8, 2026
Comment thread docs/User-Interface.md
Comment on lines +574 to +579
In `artmd.ini`:
```ini
[SOMETECHNO] ; TechnoType
ShowCameo.CustomShape= ; SHP filename
ShowCameo.CustomPalette= ; PAL filename
```

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

No CustomPCX?

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.

Oh wow, that makes sense... I forgot again. Something like a banner, hmm — yes, we do need support for custom PCX.

But WAIT…
The purpose of custom shapes is simply to expand the ways mods can display passengers or occupants. For example, an SHK could show a lightning bolt icon or animation, and a YURI could show a small mind-control icon or animation... So just custom SHP support might already be sufficient for these needs. As for custom PCX, I haven't yet figured out how it could be used.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

As for custom PCX, I haven't yet figured out how it could be used.

Any difference with the CameoPCX?

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.

[SOMETECHNO]                        ; TechnoType
ShowCameo.CustomShape=              ; SHP filename
ShowCameo.CustomPCX=                ; PCX filename
ShowCameo.CustomPalette=            ; PAL filename

It has been added…But I haven't tested whether it works properly (I think it should).

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