Prev: EDB1 Up: Map Next: EED2
EDD9: Handler: Events
Used by the routine at Dispatch_Events.
Dispatches the event ID in A to a room action. Bit 7 marks a collectible pickup.
Input
A Event ID (bit 7 set for a collectible)
IX Player entity (unused)
Stash the caller context.
Handler_Events EDD9 PUSH IX Stash IX and *CHARS on the stack.
EDDB LD HL,($5C36)
EDDE PUSH HL
EDDF LD HL,$EECB Push Handler_Events_Restore as the return address.
EDE2 PUSH HL
Use the in-game font.
EDE3 LD HL,$7C70 Write Buffer_ActiveFont to *CHARS.
EDE6 LD ($5C36),HL
Ignore event 26.
EDE9 CP $26 Return through Handler_Events_Restore if the event is 26.
EDEB RET Z
Return if a timer is already running.
EDEC LD L,A Copy the event ID into L.
EDED LD A,($649F) Return through Handler_Events_Restore if *EventTimer is already running.
EDF0 OR A
EDF1 RET NZ
Collectibles skip the event sound.
EDF2 BIT 7,L Jump to Handler_Events_Dispatch if this is a collectible event.
EDF4 JR NZ,Handler_Events_Dispatch
EDF6 LD A,$10 Write 10 to *SoundFlags.
EDF8 LD ($6472),A
Keep only the event ID.
Handler_Events_Dispatch EDFB LD A,L Copy the event ID into A.
EDFC AND %01111111 Keep only bits 0-6.
Jump to the handler for this event ID.
EDFE OR A Jump to Event_DrawHeader if the event is 00 (draw the first header item).
EDFF JP Z,Event_DrawHeader
EE02 CP $01 Jump to Event_DrawHeaderNext if the event is 01 (draw the next header item).
EE04 JP Z,Event_DrawHeaderNext
EE07 CP $03 Jump to Event_DrawHeaderPair if the event is 03 (draw the first two header items).
EE09 JP Z,Event_DrawHeaderPair
EE0C CP $02 Jump to Event_NudgeActor if the event is 02 (nudge the first actor).
EE0E JP Z,Event_NudgeActor
EE11 CP $04 Jump to Event_PrintMessage if the event is 04 (print the event message).
EE13 JP Z,Event_PrintMessage
EE16 CP $05 Jump to Event_StartEnemy if the event is 05 (start the first enemy).
EE18 JP Z,Event_StartEnemy
EE1B CP $06 Jump to Event_RevealHeader if the event is 06 (reveal the room-header item).
EE1D JP Z,Event_RevealHeader
EE20 CP $07 Jump to Event_RevealHeaderTriple if the event is 07 (reveal three header items).
EE22 JP Z,Event_RevealHeaderTriple
EE25 CP $08 Jump to Event_StartActor if the event is 08 (start an actor walking).
EE27 JP Z,Event_StartActor
EE2A CP $09 Jump to Event_ToggleTune if the event is 09 (toggle the silent-tune flag).
EE2C JP Z,Event_ToggleTune
EE2F CP $0A Jump to Event_ShortTimer if the event is 0A (start a short event timer).
EE31 JP Z,Event_ShortTimer
EE34 CP $0B Jump to Event_RevealDecorAndMover if the event is 0B (reveal a decoration and a mover).
EE36 JP Z,Event_RevealDecorAndMover
EE39 CP $0C Jump to Event_RevealNextPair if the event is 0C (reveal the next decoration and mover).
EE3B JP Z,Event_RevealNextPair
EE3E CP $0D Jump to Event_HideLaterActor if the event is 0D (hide a later actor).
EE40 JP Z,Event_HideLaterActor
EE43 CP $0E Jump to Event_SwapKeys if the event is 0E (swap the left/right keys).
EE45 JP Z,Event_SwapKeys
EE48 CP $0F Jump to Event_HideActor if the event is 0F (hide the first active actor).
EE4A JP Z,Event_HideActor
EE4D CP $11 Jump to Event_HideFurniture if the event is 11 (hide the first furniture item).
EE4F JP Z,Event_HideFurniture
EE52 CP $12 Jump to Event_RevealDoor if the event is 12 (reveal the first door).
EE54 JP Z,Event_RevealDoor
EE57 CP $13 Jump to Event_RevealNextDoor if the event is 13 (reveal the next door).
EE59 JP Z,Event_RevealNextDoor
EE5C CP $14 Jump to Event_RevealDecorations if the event is 14 (reveal two decorations).
EE5E JP Z,Event_RevealDecorations
EE61 CP $15 Jump to Event_RevealThirdDoor if the event is 15 (reveal the third door).
EE63 JP Z,Event_RevealThirdDoor
EE66 CP $16 Jump to Event_RandomCombination if the event is 16 (randomise the combination).
EE68 JP Z,Event_RandomCombination
EE6B CP $17 Jump to Event_HeaderAndTimer if the event is 17 (draw two header items and start a timer).
EE6D JP Z,Event_HeaderAndTimer
EE70 CP $18 Jump to Event_ShowEnemy if the event is 18 (show the first hidden enemy).
EE72 JP Z,Event_ShowEnemy
EE75 CP $19 Jump to Event_RevealFurniture if the event is 19 (reveal the first furniture item).
EE77 JP Z,Event_RevealFurniture
EE7A CP $1A Jump to Event_RevealPair if the event is 1A (reveal two decorations and a mover).
EE7C JP Z,Event_RevealPair
EE7F CP $1B Jump to Event_RevealLadder if the event is 1B (reveal the first ladder).
EE81 JP Z,Event_RevealLadder
EE84 CP $1C Jump to Event_RevealTriple if the event is 1C (reveal three decorations and three movers).
EE86 JP Z,Event_RevealTriple
EE89 CP $1D Jump to Event_RevealAllDecorations if the event is 1D (reveal every decoration).
EE8B JP Z,Event_RevealAllDecorations
EE8E CP $1E Jump to Event_RevealThreeDecorations if the event is 1E (reveal three decorations).
EE90 JP Z,Event_RevealThreeDecorations
EE93 CP $1F Jump to Event_ShowMovers if the event is 1F (show every moving object).
EE95 JP Z,Event_ShowMovers
EE98 CP $20 Jump to Event_DigitFour if the event is 20 (increment combination digit 4).
EE9A JP Z,Event_DigitFour
EE9D CP $21 Jump to Event_DigitThree if the event is 21 (increment combination digit 3).
EE9F JP Z,Event_DigitThree
EEA2 CP $22 Jump to Event_AwardDigit if the event is 22 (award a combination digit).
EEA4 JP Z,Event_AwardDigit
EEA7 CP $23 Jump to Event_DigitTwo if the event is 23 (increment combination digit 2).
EEA9 JP Z,Event_DigitTwo
EEAC CP $24 Jump to Event_HideHeaderPair if the event is 24 (hide two header items).
EEAE JP Z,Event_HideHeaderPair
EEB1 CP $25 Jump to Event_DigitOne if the event is 25 (increment combination digit 1).
EEB3 JP Z,Event_DigitOne
EEB6 CP $27 Jump to Event_DrawHeaderFourth if the event is 27 (draw the fourth header item).
EEB8 JP Z,Event_DrawHeaderFourth
EEBB CP $28 Jump to Event_HideHeaderFourth if the event is 28 (hide the fourth header item).
EEBD JP Z,Event_HideHeaderFourth
EEC0 CP $29 Jump to Event_TestHeader if the event is 29 (test the second header item).
EEC2 JP Z,Event_TestHeader
EEC5 CP $2A Jump to Event_HideEnemies if the event is 2A (hide the first two enemies).
EEC7 JP Z,Event_HideEnemies
Ignore an unhandled event ID.
Handler_Events_Done EECA POP HL Drop the unused return address.
Restore the font and IX.
Handler_Events_Restore EECB POP HL Restore *CHARS from the stack.
EECC LD ($5C36),HL
EECF POP IX Restore IX from the stack.
Return.
EED1 RET Return.
Prev: EDB1 Up: Map Next: EED2