mirror of
https://gitlab.com/xCrystal/pokecrystal-board.git
synced 2024-11-16 11:27:33 -08:00
Level cleared transition: placeholder screen, update wCoins with wCurLevelCoins, advance time of day (#35)
This commit is contained in:
parent
20e7791a83
commit
f6320585bf
@ -24,7 +24,8 @@ DEF STRING_BUFFER_LENGTH EQU 19
|
|||||||
const HAVE_LESS ; 2
|
const HAVE_LESS ; 2
|
||||||
|
|
||||||
; givecoins/takecoins/checkcoins special amount values
|
; givecoins/takecoins/checkcoins special amount values
|
||||||
DEF BLUE_RED_SPACE_COINS EQU $ffffff
|
DEF BLUE_RED_SPACE_COINS EQU $ff0000
|
||||||
|
DEF COINS_FROM_RAM EQU $fe0000
|
||||||
|
|
||||||
; checkpokemail return values
|
; checkpokemail return values
|
||||||
const_def
|
const_def
|
||||||
@ -342,7 +343,7 @@ DEF NUM_UNOWN_PUZZLES EQU const_value
|
|||||||
const BOARDEVENT_RESUME_BRANCH ; 6
|
const BOARDEVENT_RESUME_BRANCH ; 6
|
||||||
DEF NUM_BOARD_EVENTS EQU const_value - 1
|
DEF NUM_BOARD_EVENTS EQU const_value - 1
|
||||||
|
|
||||||
; exitoverworld arguments
|
; exitoverworld arguments (wExitOverworldReason)
|
||||||
const_def
|
const_def
|
||||||
const ABANDONED_LEVEL ; 0
|
const ABANDONED_LEVEL ; 0
|
||||||
const CLEARED_LEVEL ; 1
|
const CLEARED_LEVEL ; 1
|
||||||
|
@ -116,6 +116,11 @@
|
|||||||
- **wDisabledSpacesBackups**: preserved on save to **sDisabledSpacesBackups**.
|
- **wDisabledSpacesBackups**: preserved on save to **sDisabledSpacesBackups**.
|
||||||
- **wMapObjectsBackups**: preserved on save to **sMapObjectsBackups**.
|
- **wMapObjectsBackups**: preserved on save to **sMapObjectsBackups**.
|
||||||
|
|
||||||
|
- Other WRAM 0 addresses (not preserved on save):
|
||||||
|
- **wText2bpp**
|
||||||
|
- **wWhichHUD**
|
||||||
|
- **wExitOverworldReason**
|
||||||
|
|
||||||
### Overworld workflow
|
### Overworld workflow
|
||||||
|
|
||||||
1) ``OverworldLoop`` is called from ``GameMenu_WorldMap`` with either ``hMapEntryMethod`` = ``MAPSETUP_ENTERLEVEL`` or ``hMapEntryMethod`` = ``MAPSETUP_CONTINUE``.
|
1) ``OverworldLoop`` is called from ``GameMenu_WorldMap`` with either ``hMapEntryMethod`` = ``MAPSETUP_ENTERLEVEL`` or ``hMapEntryMethod`` = ``MAPSETUP_CONTINUE``.
|
||||||
|
57
engine/menus/cleared_level_screen.asm
Executable file
57
engine/menus/cleared_level_screen.asm
Executable file
@ -0,0 +1,57 @@
|
|||||||
|
ClearedLevelScreen:
|
||||||
|
xor a
|
||||||
|
ldh [hMapAnims], a
|
||||||
|
ldh [hSCY], a
|
||||||
|
ld a, -$4
|
||||||
|
ldh [hSCX], a
|
||||||
|
call ClearTilemap
|
||||||
|
call LoadFrame
|
||||||
|
call LoadStandardFont
|
||||||
|
call ClearMenuAndWindowData
|
||||||
|
ld b, CGB_DIPLOMA
|
||||||
|
call GetCGBLayout
|
||||||
|
call SetPalettes
|
||||||
|
ld hl, .LevelCleared1Text
|
||||||
|
bccoord 3, 1
|
||||||
|
call PrintHLTextAtBC
|
||||||
|
ld hl, .LevelCleared2Text
|
||||||
|
bccoord 3, 3
|
||||||
|
call PrintHLTextAtBC
|
||||||
|
.loop
|
||||||
|
call DelayFrame
|
||||||
|
call GetJoypad
|
||||||
|
ldh a, [hJoyPressed]
|
||||||
|
bit A_BUTTON_F, a
|
||||||
|
jr nz, .exit
|
||||||
|
bit B_BUTTON_F, a
|
||||||
|
jr z, .loop
|
||||||
|
.exit
|
||||||
|
call AddLevelCoinsToBalance
|
||||||
|
ld c, 30
|
||||||
|
jp DelayFrames
|
||||||
|
|
||||||
|
.LevelCleared1Text:
|
||||||
|
text " L E V E L"
|
||||||
|
done
|
||||||
|
|
||||||
|
.LevelCleared2Text:
|
||||||
|
text "C L E A R E D"
|
||||||
|
done
|
||||||
|
|
||||||
|
AddLevelCoinsToBalance:
|
||||||
|
; givecoins YOUR_COINS, COINS_FROM_RAM | wCurLevelCoins
|
||||||
|
ld de, wCoins ; YOUR_COINS
|
||||||
|
ld hl, wCurLevelCoins
|
||||||
|
ld bc, hCoinsTemp
|
||||||
|
push bc
|
||||||
|
ld a, [hli]
|
||||||
|
ld [bc], a
|
||||||
|
inc bc
|
||||||
|
ld a, [hli]
|
||||||
|
ld [bc], a
|
||||||
|
inc bc
|
||||||
|
ld a, [hl]
|
||||||
|
ld [bc], a
|
||||||
|
pop bc
|
||||||
|
farcall GiveCoins
|
||||||
|
ret
|
@ -133,6 +133,12 @@ GameMenu_WorldMap:
|
|||||||
call ClearObjectStructs
|
call ClearObjectStructs
|
||||||
call ClearBGPalettes
|
call ClearBGPalettes
|
||||||
call ClearSprites
|
call ClearSprites
|
||||||
|
ld a, [wExitOverworldReason]
|
||||||
|
cp CLEARED_LEVEL
|
||||||
|
jr nz, .save_and_return
|
||||||
|
call AdvanceTimeOfDay
|
||||||
|
farcall ClearedLevelScreen
|
||||||
|
.save_and_return
|
||||||
farcall AutoSaveGameOutsideOverworld
|
farcall AutoSaveGameOutsideOverworld
|
||||||
ret
|
ret
|
||||||
|
|
||||||
|
@ -1883,7 +1883,9 @@ GetCoinsAccount:
|
|||||||
LoadCoinsAmountToMem:
|
LoadCoinsAmountToMem:
|
||||||
ld bc, hCoinsTemp
|
ld bc, hCoinsTemp
|
||||||
call GetScriptByte
|
call GetScriptByte
|
||||||
cp HIGH(BLUE_RED_SPACE_COINS)
|
cp COINS_FROM_RAM >> 16
|
||||||
|
jr z, .coins_from_ram
|
||||||
|
cp BLUE_RED_SPACE_COINS >> 16
|
||||||
jr z, .blue_red_space_coins
|
jr z, .blue_red_space_coins
|
||||||
push bc
|
push bc
|
||||||
ld [bc], a
|
ld [bc], a
|
||||||
@ -1896,6 +1898,26 @@ LoadCoinsAmountToMem:
|
|||||||
pop bc
|
pop bc
|
||||||
ret
|
ret
|
||||||
|
|
||||||
|
.coins_from_ram
|
||||||
|
; if the highest byte was COINS_FROM_RAM, the lowest two bytes are a RAM address.
|
||||||
|
; but the script argument is dt, which is big endian rather than little endian like dw.
|
||||||
|
call GetScriptByte
|
||||||
|
ld h, a
|
||||||
|
call GetScriptByte
|
||||||
|
ld l, a
|
||||||
|
push bc
|
||||||
|
ld a, [hli]
|
||||||
|
ld [bc], a
|
||||||
|
inc bc
|
||||||
|
ld a, [hli]
|
||||||
|
ld [bc], a
|
||||||
|
inc bc
|
||||||
|
ld a, [hl]
|
||||||
|
ld [bc], a
|
||||||
|
pop bc
|
||||||
|
ret
|
||||||
|
|
||||||
|
|
||||||
.blue_red_space_coins
|
.blue_red_space_coins
|
||||||
push de
|
push de
|
||||||
call GetScriptByte
|
call GetScriptByte
|
||||||
@ -2435,6 +2457,7 @@ ReturnFromCredits:
|
|||||||
|
|
||||||
Script_exitoverworld:
|
Script_exitoverworld:
|
||||||
call GetScriptByte
|
call GetScriptByte
|
||||||
|
ld [wExitOverworldReason], a
|
||||||
call Script_endall
|
call Script_endall
|
||||||
ld a, MAPSTATUS_DONE
|
ld a, MAPSTATUS_DONE
|
||||||
call LoadMapStatus
|
call LoadMapStatus
|
||||||
|
@ -82,6 +82,7 @@ ROMX $15
|
|||||||
"Map Scripts 1"
|
"Map Scripts 1"
|
||||||
ROMX $1d
|
ROMX $1d
|
||||||
"Level Selection Menu"
|
"Level Selection Menu"
|
||||||
|
"Level Transition"
|
||||||
ROMX $1e
|
ROMX $1e
|
||||||
"Board 1"
|
"Board 1"
|
||||||
ROMX $20
|
ROMX $20
|
||||||
|
5
main.asm
5
main.asm
@ -240,6 +240,11 @@ SECTION "Level Selection Menu", ROMX
|
|||||||
INCLUDE "engine/menus/level_selection_menu.asm"
|
INCLUDE "engine/menus/level_selection_menu.asm"
|
||||||
|
|
||||||
|
|
||||||
|
SECTION "Level Transition", ROMX
|
||||||
|
|
||||||
|
INCLUDE "engine/menus/cleared_level_screen.asm"
|
||||||
|
|
||||||
|
|
||||||
SECTION "Board 1", ROMX
|
SECTION "Board 1", ROMX
|
||||||
|
|
||||||
INCLUDE "engine/board/menu.asm"
|
INCLUDE "engine/board/menu.asm"
|
||||||
|
@ -1248,6 +1248,8 @@ wWhichHUD::
|
|||||||
; index to LoadHUD
|
; index to LoadHUD
|
||||||
db
|
db
|
||||||
|
|
||||||
|
wExitOverworldReason:: db
|
||||||
|
|
||||||
wOptions::
|
wOptions::
|
||||||
; bit 0-2: number of frames to delay when printing text
|
; bit 0-2: number of frames to delay when printing text
|
||||||
; fast 1; mid 3; slow 5
|
; fast 1; mid 3; slow 5
|
||||||
|
Loading…
Reference in New Issue
Block a user