Skip to content

Commit

Permalink
Fixed issues with the car blockers:
Browse files Browse the repository at this point in the history
- when re-entering the same random encounter map right after exiting,
critters can walk "inside" the car due to missing blockers.

- when alternating between two maps multiple times, it's possible to
fail to destroy the car blockers. So adding a destroy sequence to the
car script to ensure that.

- tweaked the sequence to remove one superfluous blocker.
  • Loading branch information
NovaRain committed Sep 4, 2024
1 parent f8bff41 commit 78bbd98
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 11 deletions.
21 changes: 20 additions & 1 deletion scripts_src/generic/zsdrvcar.ssl
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,26 @@ end

procedure map_enter_p_proc begin
if (global_var(GVAR_CAR_PLACED_TILE) != self_tile) then begin
destroy_object(self_obj);
// Warning: the following sequence must be identical to the "Dest_Car" macro!
Scenery_Creation_Ptr := tile_contains_pid_obj(self_tile, self_elevation, PID_DRIVABLE_CAR);
if (Scenery_Creation_Ptr != 0) then begin
Scenery_Creation_Hex := self_tile;
Dest_Block_Cycle(1,2,self_elevation)
Dest_Block_Cycle(2,2,self_elevation)
Dest_Block_Cycle(3,2,self_elevation)
Dest_Block_Cycle(4,2,self_elevation)
Dest_Block_Cycle(5,1,self_elevation)
Dest_Block_Cycle(4,1,self_elevation)
Dest_Block_Cycle(5,1,self_elevation)
Dest_Block_Cycle(4,1,self_elevation)
Dest_Block_Cycle(5,3,self_elevation)
Dest_Block_Cycle(0,2,self_elevation)
Dest_Block_Cycle(1,1,self_elevation)
Dest_Block_Cycle(2,1,self_elevation)
Dest_Block_Cycle(1,1,self_elevation)
Dest_Block_Cycle(2,1,self_elevation)
destroy_object(self_obj);
end
end
end

Expand Down
14 changes: 4 additions & 10 deletions scripts_src/headers/scenepid.h
Original file line number Diff line number Diff line change
Expand Up @@ -291,13 +291,12 @@ variable Scenery_Creation_Ptr;
Blocking_Cycle(4,1,Elevation) \
Blocking_Cycle(5,1,Elevation) \
Blocking_Cycle(4,1,Elevation) \
Blocking_Cycle(5,1,Elevation) \
Blocking_Cycle(4,1,Elevation) \
Blocking_Cycle(0,1,Elevation) \
Blocking_Cycle(5,1,Elevation) \
Blocking_Cycle(5,3,Elevation) \
Blocking_Cycle(0,2,Elevation) \
Blocking_Cycle(1,1,Elevation) \
Blocking_Cycle(2,1,Elevation) \
Blocking_Cycle(1,1,Elevation) \
Blocking_Cycle(2,1,Elevation) \
end \
end

Expand All @@ -312,8 +311,6 @@ variable Scenery_Creation_Ptr;
if (Scenery_Creation_Ptr != 0) then begin \
Scenery_Creation_Hex := tile_num_in_direction(tile_num_in_direction(Hex_Num, 5, 2), 4, 1); \
move_to(Scenery_Creation_Ptr, Scenery_Creation_Hex, Elevation); \
Blocking_Cycle(1,1,Elevation) \
Blocking_Cycle(2,1,Elevation) \
end else begin \
ndebug("WE HAD AN ERROR WITH THE TRUNK PTR, OHHH FUCK"); \
end \
Expand All @@ -332,10 +329,7 @@ variable Scenery_Creation_Ptr;
Dest_Block_Cycle(4,1,Elevation) \
Dest_Block_Cycle(5,1,Elevation) \
Dest_Block_Cycle(4,1,Elevation) \
Dest_Block_Cycle(5,1,Elevation) \
Dest_Block_Cycle(4,1,Elevation) \
Dest_Block_Cycle(0,1,Elevation) \
Dest_Block_Cycle(5,1,Elevation) \
Dest_Block_Cycle(5,3,Elevation) \
Dest_Block_Cycle(0,2,Elevation) \
Dest_Block_Cycle(1,1,Elevation) \
Dest_Block_Cycle(2,1,Elevation) \
Expand Down

0 comments on commit 78bbd98

Please sign in to comment.