Prev: 45481 Up: Map Next: 45598
45539: Advance Falling Entity
Used by the routine at Process_Falling_Entities.
Advance Falling Entity walking the entity tables at StateData_SimpleEntities / StateData_Boney.
Input
IX Address of complex state data for an entity
Advance_Falling_Entity 45539 CALL Test_EntityOverlap Call Test_EntityOverlap to test Entity Overlap? If so, jump to Advance_Falling_Entity_LowerY.
45542 JR C,Advance_Falling_Entity_LowerY
45544 CP 33 Is A equal to 33? If not, jump to Advance_Falling_Entity_LowerY.
45546 JR NZ,Advance_Falling_Entity_LowerY
45548 LD A,(29365) Load A with the task-two flags (TaskTwoFlags).
45551 SET 1,A Set "task-two script should advance" (bit 1 of TaskTwoFlags).
45553 LD (29365),A Set the task-two flags (TaskTwoFlags).
45556 XOR A Clear A as a false / no-match result.
45557 RET Return.
Lower the falling entity one character; keep falling, or relocate it when it reaches the floor band.
Advance_Falling_Entity_LowerY 45558 DEC (IX+5) Move this entity one character up.
45561 DEC (IX+6)
45564 LD A,(IX+6) Load A with the current entity's y-extent.
45567 CP 12 Is the current entity's y-extent less than 12? If so, jump to Advance_Falling_Entity_RelocateAtFloor.
45569 JR C,Advance_Falling_Entity_RelocateAtFloor
45571 SET 2,(HL) Set the falling-entity latch (bit 2 of GameEventFlags).
45573 SCF Signal success.
45574 RET Return.
Snap the fallen entity into room 3 at floor x 109 and finish the fall.
Advance_Falling_Entity_RelocateAtFloor 45575 LD (IX+4),3 Write 3 to the current entity's room index.
45579 LD A,(IX+8) Load A with the current entity's x-extent.
45582 SUB (IX+7) Subtract the current entity's x-coordinate from A.
45585 LD C,A Keep the current entity's x-extent in C for later.
45586 LD A,109 Load A with floor x-coordinate 109.
45588 LD (IX+7),A Set the current entity's x-coordinate.
45591 ADD A,C Add the saved count in C to A.
45592 LD (IX+8),A Set the current entity's x-extent.
45595 POP BC Restore BC from the stack.
45596 JR Process_Falling_Entities_ClearFallBits Jump to Process_Falling_Entities_ClearFallBits to finish the falling-entity pass.
Prev: 45481 Up: Map Next: 45598