Skip to content

Commit

Permalink
Fixed sound_end/theme_end signals sometimes not firing
Browse files Browse the repository at this point in the history
  • Loading branch information
Decane committed Nov 12, 2023
1 parent a1ce319 commit bcc6616
Show file tree
Hide file tree
Showing 8 changed files with 21 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -125,11 +125,11 @@ function generic_physics_binder:update(delta) -- called 6th
end
end

xr_sound.update(obj:id()) -- DC20231015

if obj_st.active_scheme then
xr_logic.issue_event(nil, obj_st[obj_st.active_scheme], "update", delta)
end

xr_sound.update(obj:id())
end

--------------------------------------------------------------------------------
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -125,11 +125,11 @@ function generic_physics_binder:update(delta) -- called 6th
end
end

xr_sound.update(obj:id()) -- DC20231015

if obj_st.active_scheme then
xr_logic.issue_event(nil, obj_st[obj_st.active_scheme], "update", delta)
end

xr_sound.update(obj:id())
end

--------------------------------------------------------------------------------
Expand Down
1 change: 1 addition & 0 deletions SRP v1.1.4 - Readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,7 @@ Quest fixes:
+ Fixed an onslaught of tasks being suddenly received and completed in the Abandoned Hospital if the player kills the sniper earlier than intended.
+ Fixed the issue where the player could break the storyline at Agroprom by killing the Duty outpost commander while he is speaking or by leaving the map before he has finished.
+ Fixed the "Help the stalkers" task in Agroprom being cancelled immediately after being received if the loner faction is hostile to the player.
+ Fixed the storyline potentially breaking in saves created immediately after Sidorovich's first audio transmission to the player upon entering the Cordon.
+ Fixed the storyline breaking if the player kills every stalker in the Cordon stalker base before extracting the location of Sidorovich's loot from Khaletskiy, even after paying Sidorovich to set things right with the stalkers.
+ Fixed the storyline temporarily breaking if the player suppresses the Limansk military machine gun nest during the interval between receiving and completing the task to speak to the Clear Sky squad commander.
+ Fixed the storyline breaking if the player speaks to Forester before responding to the SOS signal in the Red Forest.
Expand Down
1 change: 1 addition & 0 deletions SRP v1.1.4 - Version History.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ v1.1.4
+ Fixed a rare crash caused by too many stalkers trying to enter the 'Small old wagon' at the Dark Valley: smart_terrain.script:483: Insufficient smart_terrain jobs val_smart_terrain_9_6. - Decane
+ Fixed a rare crash caused by too many stalkers trying to enter the 'Camp amidst rocks' at the Army Warehouses: smart_terrain.script:483: Insufficient smart_terrain jobs mil_smart_terrain_2_1 (new game required for effect). - Decane
+ Fixed NPCs becoming corrupted in the rare (but possible) case where the game attempts to load their logic before initializing the player, thus creating an opportunity for save corruption. - Decane
+ Fixed the issue where a sound_end and/or theme_end signal would be registered and processed in successive calls of the relevant object binder's update() routine, opening time windows in which saving the game could generate a save with stuck logic scripts. - Decane
+ Fixed NPCs not settling into their sleeping animation at some sleep waypoints. - Decane
+ Fixed campfire NPCs sometimes not settling into their campfire idle animation. - Decane
+ Fixed sniper NPCs not settling back into their scan-for-targets state after an enemy detection timeout. - Decane
Expand Down
4 changes: 2 additions & 2 deletions gamedata/scripts/bind_heli.script
Original file line number Diff line number Diff line change
Expand Up @@ -65,13 +65,13 @@ function heli_binder:update(delta) -- called 6th
xr_logic.initialize_obj(self.object, obj_st, self.loaded, modules.stype_heli)
end

xr_sound.update(self.object:id()) -- DC20231015

if obj_st.active_scheme then
xr_logic.issue_event(nil, obj_st[obj_st.active_scheme], "update", delta)
end

self:check_health()

xr_sound.update(self.object:id())
end

--------------------------------------------------------------------------------
Expand Down
4 changes: 2 additions & 2 deletions gamedata/scripts/bind_physic_object.script
Original file line number Diff line number Diff line change
Expand Up @@ -104,11 +104,11 @@ function generic_physics_binder:update(delta) -- called 6th
end
end

xr_sound.update(obj:id()) -- DC20231015

if obj_st.active_scheme then
xr_logic.issue_event(nil, obj_st[obj_st.active_scheme], "update", delta)
end

xr_sound.update(obj:id())
end

--------------------------------------------------------------------------------
Expand Down
9 changes: 7 additions & 2 deletions gamedata/scripts/bind_restrictor.script
Original file line number Diff line number Diff line change
Expand Up @@ -90,11 +90,16 @@ function restrictor_binder:update(delta) -- called 6th
xr_logic.initialize_obj(self.object, obj_st, self.loaded, modules.stype_restrictor)
end

-- DC20231015: Per https://github.com/Decane/SRP/issues/154, the xr_sound update must precede
-- the active scheme update to prevent time windows wherein the game can be saved in a state
-- where a sound_end/theme_end signal has been registered in scheme storage but not yet
-- processed to trigger a section switch (which would only happen on the subsequent update).

xr_sound.update(self.object:id())

if obj_st.active_scheme then
xr_logic.issue_event(nil, obj_st[obj_st.active_scheme], "update", delta)
end

xr_sound.update(self.object:id())
end

--------------------------------------------------------------------------------
Expand Down
8 changes: 4 additions & 4 deletions gamedata/scripts/xr_motivator.script
Original file line number Diff line number Diff line change
Expand Up @@ -259,6 +259,10 @@ function motivator_binder:update(delta) -- called 6th

if npc_alive then

local npc_id = npc:id()

xr_sound.update(npc_id) -- DC20231015

if npc_st.active_scheme then
local need_switch = true
local manager = npc:motivation_action_manager()
Expand All @@ -282,10 +286,6 @@ function motivator_binder:update(delta) -- called 6th
npc_st.active_sector = sr_danger.select_active_sectors(npc)
npc_st.state_mgr:update()

local npc_id = npc:id()

xr_sound.update(npc_id)

local squad = npc_st.squad_obj

if squad and squad.commander_id == npc_id then
Expand Down

0 comments on commit bcc6616

Please sign in to comment.