![]() |
Routines |
| Prev: 60891 | Up: Map | Next: 60976 |
|
Used by the routine at ScriptRoutine_OpenTrapDoor.
Open the trap door: queue a sound, switch the lever graphic layout to open facing right, and update the related scenery entity types.
|
||||
| Open_TrapDoor | 60920 | PUSH IX | Stash IX, HL and DE on the stack. | |
| 60922 | PUSH HL | |||
| 60923 | PUSH DE | |||
| 60924 | CALL Check_EntitiesNearTrapDoor | Call Check_EntitiesNearTrapDoor to check whether entities require the trap door to open. | ||
| 60927 | JP NC,TrapDoor_RestoreAndReturn | Jump to TrapDoor_RestoreAndReturn to continue if no open is required. | ||
| 60930 | LD HL,29363 | Point HL at the game event flags (GameEventFlags). | ||
| 60933 | BIT 4,(HL) | Is "task-two / upstairs event latch" (bit 4 of GameEventFlags) set? If so, jump to TrapDoor_RestoreAndReturn. | ||
| 60935 | JR NZ,TrapDoor_RestoreAndReturn | |||
| 60937 | SET 1,(HL) | Set "trap door is open / trap door event armed" (bit 1 of GameEventFlags). | ||
|
|
||||
| 60939 | LD A,5 | Load A with sound index 5. | ||
| 60941 | CALL Queue_Sound | Call Queue_Sound to queue sound. | ||
| 60944 | LD HL,43002 | Point HL at the lever open, facing right (GraphicLayout_LeverOpenRight). | ||
| 60947 | LD (37239),HL | Store HL in the lever layout pointer (Pointer_TrapDoorLayout). | ||
| 60950 | LD HL,60867 | Point HL at the open-trap type list (Data_TrapDoorOpenTypes). | ||
|
This entry point is used by the routine at Close_TrapDoor.
Rewrite 6 scenery entity types from the open/close type list starting at 36487.
|
||||
| UpdateTrapDoorEntityTypes | 60953 | LD IX,36487 | Point IX at the simple-entity slot at 36487. | |
| 60957 | LD DE,14 | Load DE with 0014. | ||
| 60960 | LD B,6 | Load B with loop count 6. | ||
|
Write one type byte into the current trap door scenery slot and advance.
|
||||
| UpdateTrapDoorEntityTypes_WriteType | 60962 | LD A,(HL) | Load A with the next type byte. | |
| 60963 | LD (IX+0),A | Write it to the entity. | ||
| 60966 | INC HL | Advance the trap door script pointer. | ||
| 60967 | ADD IX,DE | Advance IX to the next entity. | ||
| 60969 | DJNZ UpdateTrapDoorEntityTypes_WriteType | Decrease the loop counter in B and jump to UpdateTrapDoorEntityTypes_WriteType if more iterations remain. | ||
|
This entry point is used by the routine at Close_TrapDoor.
Exit open/close trap door after updating scenery types (or early abort).
|
||||
| TrapDoor_RestoreAndReturn | 60971 | POP DE | Restore DE, HL and IX from the stack. | |
| 60972 | POP HL | |||
| 60973 | POP IX | |||
| 60975 | RET | Return. | ||
| Prev: 60891 | Up: Map | Next: 60976 |