![]() |
Routines |
| Prev: AAAB | Up: Map | Next: AB31 |
|
Used by the routine at Alias_GameStart.
Relocate the menu-music code, show the main menu, set up a new game, then enter the main loop.
|
||||
| GameStart | AAB3 | DI | Disable interrupts. | |
| AAB4 | LD HL,$6F04 | Point HL at MenuMusicSource. | ||
| AAB7 | LD DE,$FC6C | DE=Seed_MenuMusicAndWaitForKey. | ||
| AABA | LD BC,$0393 | Load BC with 0393 (menu-music source copy length). | ||
| AABD | LDIR | Copy the menu-music source to Seed_MenuMusicAndWaitForKey. | ||
| AABF | CALL Seed_MenuMusicAndWaitForKey | Call Seed_MenuMusicAndWaitForKey to seed the menu music and wait for a key. | ||
|
This entry point is used by the routine at GameRestart.
Seed RNG from FRAMES, run the main menu, initialise a new game, then tick the world.
|
||||
| GameStart_MainLoopEntry | AAC2 | LD A,($5C78) | Fetch FRAMES, then seed the random scratch byte (RandomSeedScratch). | |
| AAC5 | LD ($EAE2),A | |||
| AAC8 | CALL MainMenu | Call MainMenu to display and handle the main menu. | ||
| AACB | CALL Initialise_New_Game | Call Initialise_New_Game to initialise a new game. | ||
|
Per-frame update: controls, camera, Berk, task entities, Drutt, physics, messaging, blit.
|
||||
| GameStart_FrameLoop | AACE | CALL Read_PlayerControls | Call Read_PlayerControls to read the player controls into ControlInputBitmap. | |
| AAD1 | CALL Update_CameraFollow | Call Update_CameraFollow to update the camera follow. | ||
|
Update Berk's task/idle state and drive him from the control bitmap.
|
||||
| AAD4 | CALL Update_Berk_State | Call Update_Berk_State to update Berk's state. | ||
| AAD7 | CALL Update_Berk_Controller | Call Update_Berk_Controller to update Berk's controller. | ||
|
Tick the current Thing Upstairs task entities (tasks two–four) plus the Thing Upstairs entity.
|
||||
| AADA | CALL Update_Task_Two_Entities | Call Update_Task_Two_Entities to update task-two entities. | ||
| AADD | CALL Update_Task_Three_Entities | Call Update_Task_Three_Entities to update task-three entities. | ||
| AAE0 | CALL Update_Task_Four_Entities | Call Update_Task_Four_Entities to update task-four entities. | ||
| AAE3 | CALL Update_ThingUpstairs_Entity | Call Update_ThingUpstairs_Entity to update the Thing Upstairs entity. | ||
| AAE6 | CALL Update_Miscellaneous_Entities | Call Update_Miscellaneous_Entities to update miscellaneous entities. | ||
|
Advance timed events, Drutt, falling/rising physics and Bad Tempered Thing dialogue.
|
||||
| AAE9 | CALL Update_Timed_Events | Call Update_Timed_Events to update timed events. | ||
| AAEC | CALL Update_Drutt | Call Update_Drutt to update Drutt. | ||
| AAEF | CALL Process_Special_Entity_Flags | Call Process_Special_Entity_Flags to process special entity flags. | ||
| AAF2 | CALL Process_Falling_Entities | Call Process_Falling_Entities to process falling entities. | ||
| AAF5 | CALL Process_Rising_Entities | Call Process_Rising_Entities to process rising entities. | ||
| AAF8 | CALL Update_Bad_Tempered_Thing_Dialogue | Call Update_Bad_Tempered_Thing_Dialogue to update Bad Tempered Thing dialogue. | ||
| AAFB | CALL Check_Task_Completion | Call Check_Task_Completion to check task completion. | ||
|
Clear, populate and blit the display buffers, then play any queued sound.
|
||||
| AAFE | CALL Clear_DisplayBuffer | Call Clear_DisplayBuffer to clear the display buffer. | ||
| AB01 | CALL PopulateDisplayBuffer_VisibleEntities | Call PopulateDisplayBuffer_VisibleEntities to populate the display buffer for visible entities. | ||
| AB04 | CALL Blit_DisplayBuffer | Call Blit_DisplayBuffer to blit the display buffer to the screen. | ||
| AB07 | CALL Play_QueuedSound | Call Play_QueuedSound to play any queued sound. | ||
|
Flip the double-buffer select and continue unless the camera-follow entity has been cleared (death).
|
||||
| AB0A | LD HL,$63A0 | Point HL at display buffer A (PrimaryDisplayBuffer). | ||
| AB0D | LD DE,$6B20 | Point DE at display buffer B (SecondaryDisplayBuffer). | ||
| AB10 | LD A,($72EA) | Fetch the display-buffer select flag (DisplayBufferSelectFlag). | ||
| AB13 | XOR %00000001 | Toggle bit 00 of A. | ||
| AB15 | LD ($72EA),A | Store it back at DisplayBufferSelectFlag. | ||
| AB18 | JR Z,GameStart_StoreBufferPointer | If it is now zero, keep HL = buffer A at GameStart_StoreBufferPointer. | ||
| AB1A | EX DE,HL | Otherwise swap so HL = buffer B. | ||
|
Remember the active display buffer, then loop another frame while the camera-follow entity is still alive.
|
||||
| GameStart_StoreBufferPointer | AB1B | LD ($72F5),HL | Store the active display-buffer pointer at Pointer_CurrentDisplayBuffer. | |
| AB1E | LD A,($909B) | Fetch the camera-follow entity type (StateData_Berk). Is the camera-follow entity still active? If so, jump to GameStart_FrameLoop for another frame. | ||
| AB21 | OR A | |||
| AB22 | JP NZ,GameStart_FrameLoop | |||
|
Death / end-of-life: print the death line, blit, show ratings, restart.
|
||||
| AB25 | CALL Print_DeathMessage | Call Print_DeathMessage to print the death message. | ||
| AB28 | CALL Blit_DisplayBuffer | Call Blit_DisplayBuffer to blit the display buffer to the screen. | ||
| AB2B | CALL Print_StatusMessages | Call Print_StatusMessages to print status / rating messages. | ||
| AB2E | JP GameRestart | Jump to GameRestart to restart the game. | ||
| Prev: AAAB | Up: Map | Next: AB31 |