| Prev: 5D43 | Up: Map | Next: 5D9F |
5D44: Initialize game state for overview/demo mode.
|
|
||||
|
This routine sets up the initial game state used by the overview (attract mode) routine. It initializes player positions, scores, lives, terrain state, and sets the gameplay mode to GAMEPLAY_MODE_OVERVIEW.
|
||||
| init_state | 5D44 | LD A,$78 | Initialize plane X position to $78. Why isn't it $80? | |
| 5D46 | LD ($5F72),A | |||
| 5D49 | CALL init_starting_bridge | Set starting bridges for both players based on game mode. | ||
| 5D4C | LD HL,$5F00 | Initialize viewport objects list (set pointer, mark as empty). | ||
| 5D4F | LD ($5F60),HL | |||
| 5D52 | LD (HL),$FF | |||
| 5D54 | LD A,$1F | Set normal activation timing (every 32 frames). | ||
| 5D56 | LD ($5F5F),A | |||
| 5D59 | LD A,$00 | Set border to black, silence speaker, clear tank shell and controls state. | ||
| 5D5B | OUT ($FE),A | |||
| 5D5D | LD ($5EF2),A | |||
| 5D60 | LD ($6BB0),A | |||
| 5D63 | LD BC,$4C83 | Initialize terrain element (C=$83: river center position, B=$4C: row offset). | ||
| 5D66 | LD ($5F78),BC | |||
| 5D6A | LD A,$02 | Initialize terrain profile, gameplay mode, and speed to $02 (GAMEPLAY_MODE_OVERVIEW / SPEED_NORMAL). | ||
| 5D6C | LD ($5F77),A | |||
| 5D6F | LD ($5F68),A | |||
| 5D72 | LD ($5F64),A | |||
| 5D75 | LD ($5F6D),A | Store $02 to state_bridge_destroyed (unclear why $02 is used here). | ||
| 5D78 | LD HL,"0" | Initialize all player scores to zero. | ||
| 5D7B | LD ($90BC),HL | |||
| 5D7E | LD ($90BE),HL | |||
| 5D81 | LD ($90C0),HL | |||
| 5D84 | LD ($90C2),HL | |||
| 5D87 | LD ($90C4),HL | |||
| 5D8A | LD ($90C6),HL | |||
| 5D8D | LD A,$01 | Set level fragment number and terrain position to 1. | ||
| 5D8F | LD ($5F76),A | |||
| 5D92 | LD ($5F7D),A | |||
| 5D95 | LD HL,$0404 | Set both players' lives to 4. | ||
| 5D98 | LD ($923B),HL | |||
| 5D9B | LD ($923D),A | Set current player to PLAYER_1. | ||
| 5D9E | RET | |||
| Prev: 5D43 | Up: Map | Next: 5D9F |