Prev: 45422 Up: Map Next: 45539
45481: 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 45481 LD HL,29363 Point HL at the game event flags (GameEventFlags).
45484 BIT 2,(HL) Is the falling-entity latch (bit 2 of GameEventFlags. set at 45571) set? If not, return.
45486 RET Z
45487 RES 2,(HL) Clear the falling-entity latch (bit 2 of GameEventFlags).
45489 LD DE,14 Each entity record is 0014 bytes long, then load that length into DE.
45492 LD IX,35689 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 45496 LD A,(IX+0) Fetch the current entity's type for the type test.
45499 CP 255 Is the current entity's entity type equal to 255? If so, return.
45501 RET Z
45502 BIT 0,(IX+2) Is bit 0 of the current entity's flags byte 2 set? If not, jump to Process_Falling_Entities_NextEntity.
45506 JR Z,Process_Falling_Entities_NextEntity
45508 CALL Advance_Falling_Entity Call Advance_Falling_Entity to advance Falling Entity? If not, jump to Process_Falling_Entities_ClearFallBits.
45511 JR NC,Process_Falling_Entities_ClearFallBits
45513 CALL Advance_Falling_Entity Call Advance_Falling_Entity again to advance Falling Entity? If not, jump to Process_Falling_Entities_ClearFallBits.
45516 JR NC,Process_Falling_Entities_ClearFallBits
45518 CALL Advance_Falling_Entity Call Advance_Falling_Entity a third time to advance Falling Entity? If not, jump to Process_Falling_Entities_ClearFallBits.
45521 JR NC,Process_Falling_Entities_ClearFallBits
Advance to the next entity in the falling-entity walk.
Process_Falling_Entities_NextEntity 45523 ADD IX,DE Advance IX to the next entity record.
45525 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 45527 RES 0,(IX+2) Reset bit 0 of the current entity's flags byte 2.
45531 SET 7,(IX+1) Set bit 7 of the current entity's flags byte 1.
45535 SET 0,(HL) Set "room / script event raised" (bit 0 of GameEventFlags).
45537 JR Process_Falling_Entities_NextEntity Jump to Process_Falling_Entities_NextEntity to skip this falling entity.
Prev: 45422 Up: Map Next: 45539