Prev: B16E Up: Map Next: B1E3
B1A9: Process Falling Entities
Used by the routine at GameStart.
Walk entities marked as falling, apply gravity to their Y fields and clear the fall latch when they land.
Process_Falling_Entities B1A9 LD HL,$72B3 Point HL at the game event flags (GameEventFlags).
B1AC BIT 2,(HL) Is the falling-entity latch (bit 02 of GameEventFlags. set at B203) set? If not, return.
B1AE RET Z
B1AF RES 2,(HL) Clear the falling-entity latch (bit 02 of GameEventFlags).
B1B1 LD DE,$000E Each entity record is 000E bytes long, then load that length into DE.
B1B4 LD IX,$8B69 Point IX at the simple entity table (StateData_SimpleEntities).
Scan for falling entities and advance each marked one up to three steps before clearing the latch.
Process_Falling_Entities_Scan B1B8 LD A,(IX+$00) Fetch the current entity's type for the type test.
B1BB CP $FF Is the current entity's entity type equal to FF? If so, return.
B1BD RET Z
B1BE BIT 0,(IX+$02) Is bit 00 of the current entity's flags byte 2 set? If not, jump to Process_Falling_Entities_NextEntity.
B1C2 JR Z,Process_Falling_Entities_NextEntity
B1C4 CALL Advance_Falling_Entity Call Advance_Falling_Entity to advance Falling Entity? If not, jump to Process_Falling_Entities_ClearFallBits.
B1C7 JR NC,Process_Falling_Entities_ClearFallBits
B1C9 CALL Advance_Falling_Entity Call Advance_Falling_Entity again to advance Falling Entity? If not, jump to Process_Falling_Entities_ClearFallBits.
B1CC JR NC,Process_Falling_Entities_ClearFallBits
B1CE CALL Advance_Falling_Entity Call Advance_Falling_Entity a third time to advance Falling Entity? If not, jump to Process_Falling_Entities_ClearFallBits.
B1D1 JR NC,Process_Falling_Entities_ClearFallBits
Advance to the next entity in the falling-entity walk.
Process_Falling_Entities_NextEntity B1D3 ADD IX,DE Advance IX to the next entity record.
B1D5 JR Process_Falling_Entities_Scan Jump to Process_Falling_Entities_Scan to advance to the next falling entity.
This entry point is used by the routine at Advance_Falling_Entity.
Clear the falling flag, set the landed flag, raise a room/script event, and continue the scan.
Process_Falling_Entities_ClearFallBits B1D7 RES 0,(IX+$02) Reset bit 00 of the current entity's flags byte 2.
B1DB SET 7,(IX+$01) Set bit 07 of the current entity's flags byte 1.
B1DF SET 0,(HL) Set "room / script event raised" (bit 00 of GameEventFlags).
B1E1 JR Process_Falling_Entities_NextEntity Jump to Process_Falling_Entities_NextEntity to skip this falling entity.
Prev: B16E Up: Map Next: B1E3