Prev: DA3F Up: Map Next: DBC9
DB05: Handler: Pendulum
Used by the routine at Dispatch_Handlers.
Rooms 09-0B share a swinging pendulum.
Handler_PendulumRooms DB05 LD A,($64A2) Return if *CurrentRoom is 0C or higher.
DB08 CP $0C
DB0A RET NC Return if *CurrentRoom is lower than 09.
DB0B CP $09
DB0D RET C
DB0E CP $0A Jump to Handler_Pendulum if the room is 0A or 0B.
DB10 JR NC,Handler_Pendulum
DB12 LD A,($64A4) A=*Player-04.
DB15 SUB $04
DB17 LD B,$E0 B=E0.
Handler_PendulumRooms_NextRoom DB19 SUB $06 Subtract 06 until A is negative, decreasing B by two each pass.
DB1B BIT 7,A
DB1D JR NZ,Handler_Pendulum_DrawPair
DB1F DEC B
DB20 DEC B
DB21 JR Handler_PendulumRooms_NextRoom
Handler_Pendulum_DrawPair DB23 LD C,B C=B.
This entry point is used by the routine at Handler_CarriedObject.
Draw one pendulum pair.
Draw_Pendulum DB24 LD A,$47 Write WHITE (BRIGHT) to *ATTR_T.
DB26 LD ($5C8F),A
DB29 PUSH BC Draw the first bob at 1214.
DB2A LD A,B
DB2B LD BC,$1214
DB2E LD DE,$0102
DB31 CALL JumpTable_PrintSprite
DB34 POP BC
DB35 LD A,C Jump to JumpTable_PrintSprite for the second bob at 1210.
DB36 LD BC,$1210
DB39 LD DE,$0102
DB3C JP JumpTable_PrintSprite
This entry point is used by the routines at Handler_Player and Handler_Actors.
Test the player against one actor pointed to by IY.
Test_ActorCollision DB3F LD A,(IY+$08) Jump to Test_ActorCollision_Vertical if the actor is moving vertically.
DB42 OR A
DB43 JR NZ,Test_ActorCollision_Vertical
DB45 LD A,$07 Call Actor_Reverse if the actor lines up horizontally.
DB47 CP (IY+$03)
DB4A JR NZ,Test_ActorCollision_Bounds
DB4C LD A,(IY+$01)
DB4F CP (IY+$06)
DB52 CALL Z,Actor_Reverse Jump to Test_ActorCollision_Bounds.
DB55 JR Test_ActorCollision_Bounds
Test_ActorCollision_Vertical DB57 LD A,$07 Call Actor_Reverse if the actor lines up vertically.
DB59 CP (IY+$02)
DB5C JR NZ,Test_ActorCollision_Bounds
DB5E LD A,(IY+$00)
DB61 CP (IY+$05)
DB64 CALL Z,Actor_Reverse
Test_ActorCollision_Bounds DB67 LD A,($6410) Return if *Player_JumpTimer is set.
DB6A OR A
DB6B RET NZ
DB6C LD A,(IY+$01) Convert the actor row and fine-Y into a pixel row.
DB6F ADD A,A
DB70 ADD A,A
DB71 ADD A,A
DB72 ADD A,(IY+$03)
DB75 LD C,A
DB76 LD A,($64A7) Convert the player row the same way and return unless the difference is less than 04.
DB79 LD B,A
DB7A LD A,($64A5)
DB7D SUB $03
DB7F ADD A,A
DB80 ADD A,A
DB81 ADD A,A
DB82 ADD A,B
DB83 SUB C
DB84 CP $04
DB86 RET NC
DB87 LD D,A Convert the actor column and fine-X into a pixel column.
DB88 LD A,(IY+$00)
DB8B DEC A
DB8C DEC A
DB8D ADD A,A
DB8E ADD A,A
DB8F ADD A,A
DB90 ADD A,(IY+$02)
DB93 LD B,A
DB94 LD A,($6449) Compare the player footprint at Player_Footprint and return unless the ranges overlap.
DB97 LD C,A
DB98 LD A,(IY+$04)
DB9B ADD A,A
DB9C ADD A,A
DB9D ADD A,A
DB9E ADD A,C
DB9F DEC A
DBA0 LD ($DBAD),A
DBA3 SUB C
DBA4 LD C,A
DBA5 INC C
DBA6 LD A,($6448)
DBA9 ADD A,C
DBAA SUB B
DBAB DEC A
DBAC CP $C8
DBAE RET NC
DBAF LD A,(IY+$08) Store the actor state in *Player_StoredState.
DBB2 LD ($64AC),A
DBB5 LD A,$03 A=03.
DBB7 LD ($6434),A Write the actor pointer to *Pointer_CollidedActor.
DBBA LD A,(IY+$09)
DBBD OR A
DBBE JR Z,Handler_PendulumRooms_StoreActor
DBC0 SUB D
Handler_PendulumRooms_StoreActor DBC1 LD ($64AD),A Write the actor pointer to *Pointer_CollidedActor.
DBC4 LD ($644B),IY
DBC8 RET
Prev: DA3F Up: Map Next: DBC9