Skip to content

fix(lights): synchronize headlight material and shadow with vehicle alarm flashing - #334

Open
CanerKaraca23 wants to merge 1 commit into
user-grinch:mainfrom
CanerKaraca23:fix/alarm-headlight-flashing
Open

CanerKaraca23 wants to merge 1 commit into
user-grinch:mainfrom
CanerKaraca23:fix/alarm-headlight-flashing

Conversation

@CanerKaraca23

Copy link
Copy Markdown
Collaborator

Summary

When a parked vehicle's alarm is triggered (m_nAlarmState != 0 && m_nAlarmState != 0xFFFF), GTA SA alternates the headlights and horn in 256ms cycles ((m_nAlarmState & 0x100) != 0).

Previously in ModelExtras:

  1. LightManager::Render returned early when the vehicle engine was off during the daytime, completely suppressing the light render loop and resetting m_renderLights.
  2. HeadlightComponent::Process and HeadlightComponent::Render did not track m_nAlarmState. As a result, headlight materials and front ground shadows stayed permanently off during daytime alarm sounds and stayed permanently on at night without flashing.

Changes

  • In LightManager::Render, allow the render loop to proceed when isAlarmActive is true even if the engine is off.
  • In HeadlightComponent::Process and Render, check (m_nAlarmState & 0x100) != 0 to synchronize headlight materials and shadows with the alarm ON/OFF pulse intervals in both daytime and nighttime.
  • Preserved existing SA-MP and manual light override behaviors.

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.

1 participant