![]() |
Routines |
| Prev: A040 | Up: Map | Next: A0D8 |
|
Used by the routine at LoadOrSaveGame_Save.
Clears the startup flag, updates the date bar, and walks each character until play begins.
|
||||
| Game_Initialisation | A064 | XOR A | Clear the startup flag. | |
| A065 | LD ($A0DA),A | |||
| Game_Loop | A068 | LD A,($A0DA) | Jump to LoadOrSaveGame if the startup flag is set. | |
| A06B | AND A | |||
| A06C | JR NZ,LoadOrSaveGame | |||
| A06E | CALL Handler_GameClock | Call Handler_GameClock to show the game clock, then call Handler_DateBar to show the date bar. | ||
| A071 | CALL Handler_DateBar | |||
|
Handler for Sherlock (as he's the first character).
|
||||
| A074 | LD IY,$9860 | Use the timetable at Table_Timetable. | ||
| A078 | LD A,(IY+$03) | Fetch Sherlocks location. | ||
| A07B | CP $32 | Jump ahead to Handler_ProcessCharacters if the schedule entry is not 32. | ||
| A07D | JR NZ,Handler_ProcessCharacters | |||
| A07F | CALL GetKeypress | Call GetKeypress to read the keyboard, and go to Handler_ProcessCharacters if no key was pressed. | ||
| A082 | BIT 7,A | |||
| A084 | JR Z,Handler_ProcessCharacters | |||
| A086 | CP $8D | Jump to Handler_ProcessCharacters if the player did not press "ENTER". | ||
| A088 | JR NZ,Handler_ProcessCharacters | |||
| A08A | LD HL,($9FDD) | Write *CurrentTime_Ticker to *IY+06/ *IY+07. | ||
| A08D | LD (IY+$06),L | |||
| A090 | LD (IY+$07),H | |||
|
Cycle through the character timetable and run through each characters script according to their schedule and current game time.
|
||||
| Handler_ProcessCharacters | A093 | LD IY,$9860 | Use the timetable at Table_Timetable. | |
| CharacterProcessing_Loop | A097 | LD A,(IY+$00) | Jump to Game_Loop if the character id is FF. | |
| A09A | INC A | |||
| A09B | JR Z,Game_Loop | |||
|
This is a valid character so begin processing them.
|
||||
| A09D | LD HL,($9FDD) | Call CheckCharacterSchedule to check character schedule. | ||
| A0A0 | CALL CheckCharacterSchedule | |||
| A0A3 | JR C,Character_Next | Go to Character_Next if the current time is below this character's schedule time. | ||
|
The currently processed character has an active schedule so process it.
|
||||
| A0A5 | LD A,(IY+$00) | Fetch the character ID and store it in A. | ||
| A0A8 | PUSH IY | Call ProcessCharacterAction to run this character's action. | ||
| A0AA | PUSH AF | |||
| A0AB | CALL ProcessCharacterAction | |||
|
Repeatedly execute the characters script until it completes or encounters a wait condition.
|
||||
| CharacterScript_Loop | A0AE | POP AF | Restore the character ID from the stack, keeping a copy there. | |
| A0AF | PUSH AF | |||
|
Script interpreter.
|
||||
| A0B0 | CALL ScriptInterpreter | Call ScriptInterpreter to run this character's script. | ||
|
Keep looping until the script for this character is finished.
|
||||
| A0B3 | LD HL,($A01F) | Jump back to CharacterScript_Loop if CharacterScriptCycles is zero. | ||
| A0B6 | LD A,L | |||
| A0B7 | OR H | |||
| A0B8 | JR Z,CharacterScript_Loop | |||
| A0BA | POP AF | Restore the saved character ID and the schedule entry from the stack. | ||
| A0BB | POP IY | |||
|
Set up the next schedule time for this character.
|
||||
| A0BD | LD E,(IY+$06) | Add the characters schedule time to the current time. | ||
| A0C0 | LD D,(IY+$07) | |||
| A0C3 | ADD HL,DE | |||
| A0C4 | LD (IY+$06),L | And write it back to the characters schedule. | ||
| A0C7 | LD (IY+$07),H | |||
| A0CA | PUSH IY | Call ExecuteCharacterAction to execute character action. | ||
| A0CC | CALL ExecuteCharacterAction | |||
| A0CF | POP IY | |||
|
Move to the next character in the timetable.
|
||||
| Character_Next | A0D1 | LD DE,$0008 | Jump back to CharacterProcessing_Loop, the character processing loop. | |
| A0D4 | ADD IY,DE | |||
| A0D6 | JR CharacterProcessing_Loop | |||
| Prev: A040 | Up: Map | Next: A0D8 |