![]() |
Routines |
Prev: 44999 | Up: Map | Next: 45087 |
Used by the routine at GameLoop.
Handles checking if a scenic event should occur ... and also, handles jumping to the correct related scenic event routine to action it.
|
||||
Handler_ScenicEvents | 45035 | LD A,(42990) | A=*Count_ScenicEvents. | |
45038 | AND A | Return if *Count_ScenicEvents is zero. | ||
45039 | RET Z | |||
45040 | LD B,A | B=A. | ||
45041 | LD HL,(42978) | HL=*Pointer_ScenicEventLocations. | ||
45044 | JR ScenicEvents_Process | Jump to ScenicEvents_Process. | ||
Handler_ScenicEvents_Loop | 45046 | INC HL | Increment HL by one. | |
ScenicEvents_Process | 45047 | LD A,(HL) | A=*HL. | |
45048 | CALL ValidateItemPresent | Call ValidateItemPresent. | ||
45051 | JR NZ,ScenicEvents_Next | Jump to ScenicEvents_Next if HL is not equal to A. | ||
An event was found to be processed!
First though, stash away the current pointer and index in the search, so this can be resumed later.
|
||||
45053 | LD (43067),HL | Write HL to *TempStore_TablePointer. | ||
45056 | LD (43069),BC | Write BC to *TempStore_TableIndex. | ||
Calculate the event index and get the event handler.
|
||||
45060 | LD A,(42990) | E=*Count_ScenicEvents-B. | ||
45063 | SUB B | |||
45064 | LD E,A | |||
45065 | LD IX,(42974) | Load IX with *Pointer_JumpTable_ScenicEvents which contains a pointer to the scenic event rountines jump table. | ||
45069 | CALL GetTableEntry | Call GetTableEntry. | ||
45072 | LD DE,45077 | Push ScenicEvents_PostProcessing onto the stack (as the return address). | ||
45075 | PUSH DE | |||
45076 | JP (HL) | Jump to the event handler held by HL. | ||
This is the return point after the handler has finished executing.
|
||||
ScenicEvents_PostProcessing | 45077 | LD HL,(43067) | Restore *TempStore_TablePointer to HL. | |
45080 | LD BC,(43069) | Restore *TempStore_TableIndex to BC. | ||
ScenicEvents_Next | 45084 | DJNZ Handler_ScenicEvents_Loop | Decrease the event counter by one and loop back to Handler_ScenicEvents_Loop until all events have been processed. | |
45086 | RET | Return. | ||
View the equivalent code in The Jewels Of Babylon.
|
Prev: 44999 | Up: Map | Next: 45087 |