Prev: 55734 Up: Map Next: 56069
55871: Handler: Carried Object
Used by the routine at Dispatch_Handlers.
Draws CarriedObject and drops it when it lines up with a slot.
Handler_CarriedObject 55871 LD HL,31856 Write Buffer_ActiveFont to *CHARS.
55874 LD (23606),HL
55877 LD IX,25739 IX=CarriedObject.
55881 LD A,(IX+0) Return if bit 7 is set (nothing carried).
55884 BIT 7,A
55886 RET NZ Stash the current clip window on the stack.
55887 LD HL,(25625)
55890 PUSH HL
55891 LD HL,(25627)
55894 PUSH HL Use the object's own clip window.
55895 LD L,(IX+16)
55898 LD H,(IX+17)
55901 LD (25625),HL
55904 LD L,(IX+18)
55907 LD H,(IX+19)
55910 LD (25627),HL Call JumpTable_AdvanceEntity.
55913 CALL JumpTable_AdvanceEntity Call JumpTable_StorePosition.
55916 CALL JumpTable_StorePosition Call JumpTable_DrawEntity.
55919 CALL JumpTable_DrawEntity Restore the clip window from the stack.
55922 POP HL
55923 LD (25627),HL
55926 POP HL Return unless the object is at the drop cell.
55927 LD (25625),HL
55930 LD A,7
55932 CP (IX+3)
55935 RET NZ
55936 CP (IX+2)
55939 RET NZ
55940 LD A,(IX+0) Return unless it matches the stored drop mark.
55943 CP (IX+14)
55946 RET NZ
55947 LD A,(IX+1)
55950 CP (IX+15)
55953 RET NZ
55954 LD C,(IX+0) Call JumpTable_PrintSprite to stamp the object into the room.
55957 LD B,(IX+1)
55960 LD E,(IX+4)
55963 LD D,(IX+5)
55966 LD A,(IX+6)
55969 CALL JumpTable_PrintSprite Set bit 7 (no longer carried).
55972 SET 7,(IX+0)
55976 LD A,(IX+6) Return unless the object ID is 217.
55979 CP 217
55981 RET NZ
55982 LD C,(IX+0) Convert the drop cell into a Buffer_RoomTiles offset.
55985 LD B,(IX+1)
55988 RES 7,C
55990 CALL JumpTable_ConvertCoordinate
55993 LD DE,24014 Write 14/15 into that tile.
55996 ADD HL,DE
55997 LD (HL),14
55999 INC HL
56000 LD (HL),15
56002 RET Return.
Pendulum_Position 56003 DEFB 0
Pendulum_Delta 56004 DEFB 0
This entry point is used by the routine at Handler_PendulumRooms.
Animate the pendulum in rooms 9-11.
Handler_Pendulum 56005 LD A,(56003) Reset the pendulum to 216 / 2 if it holds 255.
56008 CP 255
56010 JR NZ,Handler_Pendulum_Step
56012 LD A,216
56014 LD (56003),A
56017 LD A,2
56019 LD (56004),A
Handler_Pendulum_Step 56022 LD A,(56003) Add the delta to the position.
56025 LD C,A
56026 LD A,(56004)
56029 ADD A,C
56030 LD (56003),A
56033 LD C,A Jump to Handler_Pendulum_Bounce at either end-stop.
56034 LD B,A
56035 CP 214
56037 JR Z,Handler_Pendulum_Bounce
56039 CP 226
56041 JR Z,Handler_Pendulum_Bounce Jump to Draw_Pendulum if the room is 10.
56043 LD A,(25762)
56046 CP 10 Mirror the position for the other rooms.
56048 JR Z,Draw_Pendulum
56050 LD A,220
56052 SUB B
56053 ADD A,220
56055 LD B,A Jump to Draw_Pendulum.
56056 JR Draw_Pendulum
Handler_Pendulum_Bounce 56058 LD A,(56004) Negate *Pendulum_Delta.
56061 DEC A
56062 XOR 255
56064 LD (56004),A
56067 JR Handler_Pendulum_Step Jump to Handler_Pendulum_Step.
Prev: 55734 Up: Map Next: 56069