feat(gui): Add configurable menu transition speed#2840
Conversation
|
| Filename | Overview |
|---|---|
| Core/GameEngine/Include/Common/OptionPreferences.h | Adds getGameWindowTransitionSpeed() declaration; clean, consistent with existing getter signatures |
| Core/GameEngine/Source/Common/OptionPreferences.cpp | Implements getGameWindowTransitionSpeed(); enforced range (>0, ≤1000) doesn't match documented range (0.1–10.0) from PR description |
| Core/GameEngine/Source/GameClient/GUI/GameWindowTransitions.cpp | Multiplies timeScale by TheGlobalData->m_gameWindowTransitionSpeed; correctly placed alongside existing TheFramePacer dereference pattern |
| Generals/Code/GameEngine/Include/Common/GlobalData.h | Adds m_gameWindowTransitionSpeed field; annotation, placement, and type match surrounding members |
| Generals/Code/GameEngine/Source/Common/GlobalData.cpp | Initializes m_gameWindowTransitionSpeed = 1.0f in constructor and reads it from OptionPreferences in parseGameDataDefinition; mirrors the pattern of adjacent fields |
| GeneralsMD/Code/GameEngine/Include/Common/GlobalData.h | Mirrors the Generals GlobalData.h change; field declaration and annotation are consistent |
| GeneralsMD/Code/GameEngine/Source/Common/GlobalData.cpp | Mirrors the Generals GlobalData.cpp change; initialization and preference-loading are consistent |
Sequence Diagram
%%{init: {'theme': 'neutral'}}%%
sequenceDiagram
participant INI as Options.ini
participant OP as OptionPreferences
participant GD as GlobalData
participant TG as TransitionGroup::update()
participant FP as FramePacer
INI->>OP: GameWindowTransitionSpeed value
OP->>OP: "getGameWindowTransitionSpeed() clamp >0 <= 1000 default 1.0"
OP->>GD: "parseGameDataDefinition() m_gameWindowTransitionSpeed = speed"
Note over GD: initialized to 1.0f in ctor
FP->>TG: getBaseOverUpdateFpsRatio()
GD->>TG: m_gameWindowTransitionSpeed
TG->>TG: "timeScale = ratio x speed"
TG->>TG: step frames prevFrame to newFrame break on isFinished
%%{init: {'theme': 'base', 'themeVariables': {"darkMode": true, "background": "#0d1117", "primaryColor": "#21262d", "primaryTextColor": "#e6edf3", "primaryBorderColor": "#8b949e", "lineColor": "#8b949e", "textColor": "#e6edf3", "edgeLabelBackground": "#161b22", "actorBkg": "#21262d", "actorBorder": "#8b949e", "actorTextColor": "#e6edf3", "actorLineColor": "#8b949e", "signalColor": "#8b949e", "signalTextColor": "#e6edf3", "noteBkgColor": "#373320", "noteBorderColor": "#d4a72c", "noteTextColor": "#f0e6c0", "labelBoxBkgColor": "#21262d", "labelBoxBorderColor": "#8b949e", "labelTextColor": "#e6edf3", "loopTextColor": "#e6edf3", "activationBkgColor": "#30363d", "activationBorderColor": "#8b949e"}}}%%
sequenceDiagram
participant INI as Options.ini
participant OP as OptionPreferences
participant GD as GlobalData
participant TG as TransitionGroup::update()
participant FP as FramePacer
INI->>OP: GameWindowTransitionSpeed value
OP->>OP: "getGameWindowTransitionSpeed() clamp >0 <= 1000 default 1.0"
OP->>GD: "parseGameDataDefinition() m_gameWindowTransitionSpeed = speed"
Note over GD: initialized to 1.0f in ctor
FP->>TG: getBaseOverUpdateFpsRatio()
GD->>TG: m_gameWindowTransitionSpeed
TG->>TG: "timeScale = ratio x speed"
TG->>TG: step frames prevFrame to newFrame break on isFinished
Reviews (3): Last reviewed commit: "refactor(gui): Replicate game window tra..." | Re-trigger Greptile
Caball009
left a comment
There was a problem hiding this comment.
Can you lower this Sleep? As far as I'm concerned it can be set to 1ms.
| return 1.0f; | ||
|
|
||
| Real speed = (Real) atof(it->second.str()); | ||
| return clamp(0.1f, speed, 10.0f); |
There was a problem hiding this comment.
I don't really see the need for lower than 1.0 (certainly not 0.1), but would appreciate the option for up to 30.0.
There was a problem hiding this comment.
Does it even need a ceiling? Let the user put 999999 if he wants it instant?
There was a problem hiding this comment.
I'm happy with something like 1 - 1000. Literally no ceiling a user could theoretically cause an int overflow. At 1000 it would be practically instant.
| // transitions cannot skip a state when the render frame rate dips below the base rate. | ||
| const Real timeScale = TheFramePacer->getBaseOverUpdateFpsRatio(); | ||
| // TheSuperHackers @feature bobtista 28/06/2026 Scale by the user menu transition speed preference. | ||
| const Real timeScale = TheFramePacer->getBaseOverUpdateFpsRatio() * TheGlobalData->m_menuTransitionSpeed; |
There was a problem hiding this comment.
Maybe also apply this to the movement speed of Control Bar, Diplomacy Screen? Or does that need to be a separate setting?
There was a problem hiding this comment.
Those don't go through TransitionGroup they use the sliding/animate-window path. Could make another PR for those - would you want it to be a separate setting or controlled by this one?
|
|
||
| Bool getShowMoneyPerMinute() const; | ||
|
|
||
| Real getMenuTransitionSpeed() const; |
There was a problem hiding this comment.
Maybe GameWindowTransitionSpeed if this applies to all GUI, not just inside the menu? (Quit Screen is not Menu, but Ingame)
It's iteration-bound (frame-pacer frozen in that loop), so lowering Sleep speeds the fade up rather than smoothing it, is that what you want? It would be like 30x faster right? Maybe the proper change is to route the loop through the frame pacer, which would presumably be in its own PR. |
Right, perhaps
I don't think that's necessary. |
Closes #2839
Adds a per-user
MenuTransitionSpeedoption (inOptions.ini) that scales the speed of menu/window transition animations, as requested following #2056. Defaults to1.0(unchanged behavior); values range from0.1(10× slower) to10.0(10× faster).The multiplier is applied to the existing frame-rate-decoupled time step from #2056, so transitions still step through every state and never skip.
Todo