Prev: B1A9 Up: Map Next: B21E
B1E3: 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 B1E3 CALL Test_EntityOverlap Call Test_EntityOverlap to test Entity Overlap? If so, jump to Advance_Falling_Entity_LowerY.
B1E6 JR C,Advance_Falling_Entity_LowerY
B1E8 CP $21 Is A equal to 21? If not, jump to Advance_Falling_Entity_LowerY.
B1EA JR NZ,Advance_Falling_Entity_LowerY
B1EC LD A,($72B5) Load A with the task-two flags (TaskTwoFlags).
B1EF SET 1,A Set "task-two script should advance" (bit 01 of TaskTwoFlags).
B1F1 LD ($72B5),A Set the task-two flags (TaskTwoFlags).
B1F4 XOR A Clear A as a false / no-match result.
B1F5 RET Return.
Lower the falling entity one character; keep falling, or relocate it when it reaches the floor band.
Advance_Falling_Entity_LowerY B1F6 DEC (IX+$05) Move this entity one character up.
B1F9 DEC (IX+$06)
B1FC LD A,(IX+$06) Load A with the current entity's y-extent.
B1FF CP $0C Is the current entity's y-extent less than 0C? If so, jump to Advance_Falling_Entity_RelocateAtFloor.
B201 JR C,Advance_Falling_Entity_RelocateAtFloor
B203 SET 2,(HL) Set the falling-entity latch (bit 02 of GameEventFlags).
B205 SCF Signal success.
B206 RET Return.
Snap the fallen entity into room 03 at floor x 6D and finish the fall.
Advance_Falling_Entity_RelocateAtFloor B207 LD (IX+$04),$03 Write 03 to the current entity's room index.
B20B LD A,(IX+$08) Load A with the current entity's x-extent.
B20E SUB (IX+$07) Subtract the current entity's x-coordinate from A.
B211 LD C,A Keep the current entity's x-extent in C for later.
B212 LD A,$6D Load A with floor x-coordinate 6D.
B214 LD (IX+$07),A Set the current entity's x-coordinate.
B217 ADD A,C Add the saved count in C to A.
B218 LD (IX+$08),A Set the current entity's x-extent.
B21B POP BC Restore BC from the stack.
B21C JR Process_Falling_Entities_ClearFallBits Jump to Process_Falling_Entities_ClearFallBits to finish the falling-entity pass.
Prev: B1A9 Up: Map Next: B21E