Prev: D9B6 Up: Map Next: DB05
DA3F: Handler: Carried Object
Used by the routine at Dispatch_Handlers.
Draws CarriedObject and drops it when it lines up with a slot.
Handler_CarriedObject DA3F LD HL,$7C70 Write Buffer_ActiveFont to *CHARS.
DA42 LD ($5C36),HL
DA45 LD IX,$648B IX=CarriedObject.
DA49 LD A,(IX+$00) Return if bit 7 is set (nothing carried).
DA4C BIT 7,A
DA4E RET NZ Stash the current clip window on the stack.
DA4F LD HL,($6419)
DA52 PUSH HL
DA53 LD HL,($641B)
DA56 PUSH HL Use the object's own clip window.
DA57 LD L,(IX+$10)
DA5A LD H,(IX+$11)
DA5D LD ($6419),HL
DA60 LD L,(IX+$12)
DA63 LD H,(IX+$13)
DA66 LD ($641B),HL Call JumpTable_AdvanceEntity.
DA69 CALL JumpTable_AdvanceEntity Call JumpTable_StorePosition.
DA6C CALL JumpTable_StorePosition Call JumpTable_DrawEntity.
DA6F CALL JumpTable_DrawEntity Restore the clip window from the stack.
DA72 POP HL
DA73 LD ($641B),HL
DA76 POP HL Return unless the object is at the drop cell.
DA77 LD ($6419),HL
DA7A LD A,$07
DA7C CP (IX+$03)
DA7F RET NZ
DA80 CP (IX+$02)
DA83 RET NZ
DA84 LD A,(IX+$00) Return unless it matches the stored drop mark.
DA87 CP (IX+$0E)
DA8A RET NZ
DA8B LD A,(IX+$01)
DA8E CP (IX+$0F)
DA91 RET NZ
DA92 LD C,(IX+$00) Call JumpTable_PrintSprite to stamp the object into the room.
DA95 LD B,(IX+$01)
DA98 LD E,(IX+$04)
DA9B LD D,(IX+$05)
DA9E LD A,(IX+$06)
DAA1 CALL JumpTable_PrintSprite Set bit 7 (no longer carried).
DAA4 SET 7,(IX+$00)
DAA8 LD A,(IX+$06) Return unless the object ID is D9.
DAAB CP $D9
DAAD RET NZ
DAAE LD C,(IX+$00) Convert the drop cell into a Buffer_RoomTiles offset.
DAB1 LD B,(IX+$01)
DAB4 RES 7,C
DAB6 CALL JumpTable_ConvertCoordinate
DAB9 LD DE,$5DCE Write 0E/0F into that tile.
DABC ADD HL,DE
DABD LD (HL),$0E
DABF INC HL
DAC0 LD (HL),$0F
DAC2 RET Return.
Pendulum_Position DAC3 DEFB $00
Pendulum_Delta DAC4 DEFB $00
This entry point is used by the routine at Handler_PendulumRooms.
Animate the pendulum in rooms 09-0B.
Handler_Pendulum DAC5 LD A,($DAC3) Reset the pendulum to D8 / 02 if it holds FF.
DAC8 CP $FF
DACA JR NZ,Handler_Pendulum_Step
DACC LD A,$D8
DACE LD ($DAC3),A
DAD1 LD A,$02
DAD3 LD ($DAC4),A
Handler_Pendulum_Step DAD6 LD A,($DAC3) Add the delta to the position.
DAD9 LD C,A
DADA LD A,($DAC4)
DADD ADD A,C
DADE LD ($DAC3),A
DAE1 LD C,A Jump to Handler_Pendulum_Bounce at either end-stop.
DAE2 LD B,A
DAE3 CP $D6
DAE5 JR Z,Handler_Pendulum_Bounce
DAE7 CP $E2
DAE9 JR Z,Handler_Pendulum_Bounce Jump to Draw_Pendulum if the room is 0A.
DAEB LD A,($64A2)
DAEE CP $0A Mirror the position for the other rooms.
DAF0 JR Z,Draw_Pendulum
DAF2 LD A,$DC
DAF4 SUB B
DAF5 ADD A,$DC
DAF7 LD B,A Jump to Draw_Pendulum.
DAF8 JR Draw_Pendulum
Handler_Pendulum_Bounce DAFA LD A,($DAC4) Negate *Pendulum_Delta.
DAFD DEC A
DAFE XOR $FF
DB00 LD ($DAC4),A
DB03 JR Handler_Pendulum_Step Jump to Handler_Pendulum_Step.
Prev: D9B6 Up: Map Next: DB05