Skip to content

tweak(drawable): Decouple police car light animation from render update#2829

Open
bobtista wants to merge 2 commits into
TheSuperHackers:mainfrom
bobtista:bobtista/tweak/decouple-police-car-lights
Open

tweak(drawable): Decouple police car light animation from render update#2829
bobtista wants to merge 2 commits into
TheSuperHackers:mainfrom
bobtista:bobtista/tweak/decouple-police-car-lights

Conversation

@bobtista

Copy link
Copy Markdown

Resolves #2828

The police car light bar animation and its blinking dynamic light are advanced by a fixed m_curFrame += 0.25 increment in W3DPoliceCarDraw::doDrawModule, which runs once per render frame. This makes the blink rate scale with render frame rate.

This change scales the per-frame increment by TheFramePacer->getActualLogicTimeScaleOverFpsRatio(), following the same pattern already applied to the stealth opacity fade, tint envelope, tree sway, and water movement. The animation now advances at the logic rate regardless of render frame rate.

This is a render-only change. m_curFrame is not part of crc()/xfer(), so there is no effect on logic, replays, or CRC determinism.

Testing:

[x]Police car light bar blinks at a consistent rate with various render FPS

@bobtista bobtista self-assigned this Jun 24, 2026
@greptile-apps

greptile-apps Bot commented Jun 24, 2026

Copy link
Copy Markdown

Greptile Summary

This PR decouples the police car light bar animation from the render frame rate by scaling the per-frame increment with TheFramePacer->getActualLogicTimeScaleOverFpsRatio(), matching the existing pattern used for stealth fade, tree sway, and water movement.

  • Single-line change in W3DPoliceCarDraw::doDrawModule: animAmt is now multiplied by the logic-to-render-fps ratio, so the blink rate stays consistent regardless of render FPS.
  • m_curFrame is not serialised via crc()/xfer(), so there is no impact on replays, CRC determinism, or network sync.

Confidence Score: 5/5

Safe to merge — render-only change to a cosmetic animation that follows an established, tested pattern in the same codebase.

The change is a one-line multiplication using the same FramePacer API already applied to stealth opacity, tree sway, and water movement. m_curFrame is not serialised, so no logic, replay, or CRC impact. No new code paths, no state shared with other systems.

No files require special attention.

Important Files Changed

Filename Overview
Core/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DPoliceCarDraw.cpp Scales the police car light animation per-frame step by the logic-to-render-fps ratio using the same FramePacer API already used in tree sway, water, and stealth systems. Change is minimal and isolated to the render path.

Sequence Diagram

%%{init: {'theme': 'neutral'}}%%
sequenceDiagram
    participant RenderLoop
    participant W3DPoliceCarDraw
    participant FramePacer

    RenderLoop->>W3DPoliceCarDraw: doDrawModule()
    W3DPoliceCarDraw->>FramePacer: getActualLogicTimeScaleOverFpsRatio()
    FramePacer-->>W3DPoliceCarDraw: "ratio = min(1.0, logicFps / renderFps)"
    W3DPoliceCarDraw->>W3DPoliceCarDraw: "animAmt = 0.25f * ratio"
    W3DPoliceCarDraw->>W3DPoliceCarDraw: "m_curFrame += animAmt"
    W3DPoliceCarDraw->>W3DPoliceCarDraw: update light color from m_curFrame
Loading
%%{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 RenderLoop
    participant W3DPoliceCarDraw
    participant FramePacer

    RenderLoop->>W3DPoliceCarDraw: doDrawModule()
    W3DPoliceCarDraw->>FramePacer: getActualLogicTimeScaleOverFpsRatio()
    FramePacer-->>W3DPoliceCarDraw: "ratio = min(1.0, logicFps / renderFps)"
    W3DPoliceCarDraw->>W3DPoliceCarDraw: "animAmt = 0.25f * ratio"
    W3DPoliceCarDraw->>W3DPoliceCarDraw: "m_curFrame += animAmt"
    W3DPoliceCarDraw->>W3DPoliceCarDraw: update light color from m_curFrame
Loading

Reviews (2): Last reviewed commit: "style(drawable): Add blank line before d..." | Re-trigger Greptile

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Police car light bar animation speed changes with framerate

2 participants