![]() |
Routines |
| Prev: 43691 | Up: Map | Next: 43825 |
|
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 | 43699 | DI | Disable interrupts. | |
| 43700 | LD HL,28420 | Point HL at MenuMusicSource. | ||
| 43703 | LD DE,64620 | DE=Seed_MenuMusicAndWaitForKey. | ||
| 43706 | LD BC,915 | Load BC with 915 (menu-music source copy length). | ||
| 43709 | LDIR | Copy the menu-music source to Seed_MenuMusicAndWaitForKey. | ||
| 43711 | 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 | 43714 | LD A,(23672) | Fetch FRAMES, then seed the random scratch byte (RandomSeedScratch). | |
| 43717 | LD (60130),A | |||
| 43720 | CALL MainMenu | Call MainMenu to display and handle the main menu. | ||
| 43723 | 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 | 43726 | CALL Read_PlayerControls | Call Read_PlayerControls to read the player controls into ControlInputBitmap. | |
| 43729 | CALL Update_CameraFollow | Call Update_CameraFollow to update the camera follow. | ||
|
Update Berk's task/idle state and drive him from the control bitmap.
|
||||
| 43732 | CALL Update_Berk_State | Call Update_Berk_State to update Berk's state. | ||
| 43735 | 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.
|
||||
| 43738 | CALL Update_Task_Two_Entities | Call Update_Task_Two_Entities to update task-two entities. | ||
| 43741 | CALL Update_Task_Three_Entities | Call Update_Task_Three_Entities to update task-three entities. | ||
| 43744 | CALL Update_Task_Four_Entities | Call Update_Task_Four_Entities to update task-four entities. | ||
| 43747 | CALL Update_ThingUpstairs_Entity | Call Update_ThingUpstairs_Entity to update the Thing Upstairs entity. | ||
| 43750 | CALL Update_Miscellaneous_Entities | Call Update_Miscellaneous_Entities to update miscellaneous entities. | ||
|
Advance timed events, Drutt, falling/rising physics and Bad Tempered Thing dialogue.
|
||||
| 43753 | CALL Update_Timed_Events | Call Update_Timed_Events to update timed events. | ||
| 43756 | CALL Update_Drutt | Call Update_Drutt to update Drutt. | ||
| 43759 | CALL Process_Special_Entity_Flags | Call Process_Special_Entity_Flags to process special entity flags. | ||
| 43762 | CALL Process_Falling_Entities | Call Process_Falling_Entities to process falling entities. | ||
| 43765 | CALL Process_Rising_Entities | Call Process_Rising_Entities to process rising entities. | ||
| 43768 | CALL Update_Bad_Tempered_Thing_Dialogue | Call Update_Bad_Tempered_Thing_Dialogue to update Bad Tempered Thing dialogue. | ||
| 43771 | CALL Check_Task_Completion | Call Check_Task_Completion to check task completion. | ||
|
Clear, populate and blit the display buffers, then play any queued sound.
|
||||
| 43774 | CALL Clear_DisplayBuffer | Call Clear_DisplayBuffer to clear the display buffer. | ||
| 43777 | CALL PopulateDisplayBuffer_VisibleEntities | Call PopulateDisplayBuffer_VisibleEntities to populate the display buffer for visible entities. | ||
| 43780 | CALL Blit_DisplayBuffer | Call Blit_DisplayBuffer to blit the display buffer to the screen. | ||
| 43783 | 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).
|
||||
| 43786 | LD HL,25504 | Point HL at display buffer A (PrimaryDisplayBuffer). | ||
| 43789 | LD DE,27424 | Point DE at display buffer B (SecondaryDisplayBuffer). | ||
| 43792 | LD A,(29418) | Fetch the display-buffer select flag (DisplayBufferSelectFlag). | ||
| 43795 | XOR %00000001 | Toggle bit 0 of A. | ||
| 43797 | LD (29418),A | Store it back at DisplayBufferSelectFlag. | ||
| 43800 | JR Z,GameStart_StoreBufferPointer | If it is now zero, keep HL = buffer A at GameStart_StoreBufferPointer. | ||
| 43802 | 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 | 43803 | LD (29429),HL | Store the active display-buffer pointer at Pointer_CurrentDisplayBuffer. | |
| 43806 | LD A,(37019) | Fetch the camera-follow entity type (StateData_Berk). Is the camera-follow entity still active? If so, jump to GameStart_FrameLoop for another frame. | ||
| 43809 | OR A | |||
| 43810 | JP NZ,GameStart_FrameLoop | |||
|
Death / end-of-life: print the death line, blit, show ratings, restart.
|
||||
| 43813 | CALL Print_DeathMessage | Call Print_DeathMessage to print the death message. | ||
| 43816 | CALL Blit_DisplayBuffer | Call Blit_DisplayBuffer to blit the display buffer to the screen. | ||
| 43819 | CALL Print_StatusMessages | Call Print_StatusMessages to print status / rating messages. | ||
| 43822 | JP GameRestart | Jump to GameRestart to restart the game. | ||
| Prev: 43691 | Up: Map | Next: 43825 |