2023-09-22 14:12:05 -07:00
|
|
|
BoardMenuScript::
|
|
|
|
opentext
|
2023-10-14 11:52:09 -07:00
|
|
|
callasm .Upkeep
|
2023-09-22 14:12:05 -07:00
|
|
|
.display_menu
|
|
|
|
callasm BoardMenu
|
|
|
|
ifequal BOARDMENUITEM_DIE, .Die
|
|
|
|
ifequal BOARDMENUITEM_PARTY, .Party
|
|
|
|
ifequal BOARDMENUITEM_PACK, .Pack
|
|
|
|
ifequal BOARDMENUITEM_POKEGEAR, .Pokegear
|
|
|
|
ifequal BOARDMENUITEM_EXIT, .Exit
|
2023-10-31 12:25:56 -07:00
|
|
|
ifequal BOARDMENUITEM_VIEWMAP, .ViewMap
|
2023-09-22 14:12:05 -07:00
|
|
|
closetext
|
|
|
|
end
|
|
|
|
|
2023-10-14 11:52:09 -07:00
|
|
|
.Upkeep:
|
2023-10-31 12:25:56 -07:00
|
|
|
; skip upkeep if we are re-entering after returning from View Map mode
|
2023-11-05 02:07:32 -08:00
|
|
|
ldh a, [hCurBoardEvent]
|
2023-10-31 12:25:56 -07:00
|
|
|
cp BOARDEVENT_REDISPLAY_MENU
|
|
|
|
ret z
|
2023-10-14 11:52:09 -07:00
|
|
|
; save after opentext to reanchor map first
|
|
|
|
; save before processing variables like wCurTurn due to BoardMenuScript reentry after game reset
|
|
|
|
farcall AutoSaveGameInOverworld
|
2023-11-28 09:02:00 -08:00
|
|
|
; reset turn-scoped variables (wDieRoll, wSpacesLeft) and update wCurTurn
|
2023-10-14 11:52:09 -07:00
|
|
|
ld hl, wTurnData
|
|
|
|
ld bc, wTurnDataEnd - wTurnData
|
|
|
|
xor a
|
2023-10-18 08:46:57 -07:00
|
|
|
call ByteFill
|
|
|
|
ld hl, wCurTurn
|
2023-12-27 08:42:46 -08:00
|
|
|
ld a, [hli]
|
|
|
|
cp MAX_TURNS / $100
|
|
|
|
jr nz, .not_max_turns
|
|
|
|
ld a, [hl]
|
|
|
|
cp MAX_TURNS % $100
|
|
|
|
jr z, .next
|
|
|
|
.not_max_turns
|
2023-10-18 08:46:57 -07:00
|
|
|
inc [hl]
|
2023-12-27 08:42:46 -08:00
|
|
|
jr nz, .next
|
|
|
|
dec hl
|
|
|
|
inc [hl]
|
|
|
|
jr .next
|
|
|
|
.next
|
|
|
|
; apply wCurTurn and wDieRoll in overworld HUD
|
|
|
|
call RefreshOverworldHUD
|
2023-11-28 09:02:00 -08:00
|
|
|
; reset turn-scoped event flags
|
2023-11-28 12:36:51 -08:00
|
|
|
ld hl, wEventFlags + EVENT_TURN_SCOPED_FLAGS_START / 8
|
|
|
|
ld c, (EVENT_TURN_SCOPED_FLAGS_END / 8) - (EVENT_TURN_SCOPED_FLAGS_START / 8)
|
2023-11-28 09:02:00 -08:00
|
|
|
xor a
|
|
|
|
.loop
|
|
|
|
ld [hli], a
|
|
|
|
dec c
|
|
|
|
jr nz, .loop
|
|
|
|
; load the data for the current space to wCurSpaceStruct
|
2023-10-18 08:46:57 -07:00
|
|
|
jp LoadCurSpaceData
|
2023-10-14 11:52:09 -07:00
|
|
|
|
2023-09-22 14:12:05 -07:00
|
|
|
.Die:
|
2023-09-25 12:57:47 -07:00
|
|
|
callasm BoardMenu_Die
|
|
|
|
iffalse BoardMenuScript
|
|
|
|
callasm BoardMenu_BreakDieAnimation
|
2023-10-14 10:28:35 -07:00
|
|
|
callasm RestoreOverworldFontOverBoardMenuGFX
|
2023-09-22 14:12:05 -07:00
|
|
|
end
|
|
|
|
|
|
|
|
.Party:
|
|
|
|
callasm BoardMenu_Party
|
|
|
|
scall .SubmenuCallback
|
|
|
|
sjump .display_menu
|
|
|
|
|
|
|
|
.Pack:
|
|
|
|
callasm BoardMenu_Pack
|
|
|
|
scall .SubmenuCallback
|
|
|
|
sjump .display_menu
|
|
|
|
|
|
|
|
.Pokegear:
|
|
|
|
callasm BoardMenu_Pokegear
|
|
|
|
scall .SubmenuCallback
|
|
|
|
sjump .display_menu
|
|
|
|
|
|
|
|
.Exit:
|
|
|
|
writetext .EmptyText
|
|
|
|
callasm RestoreOverworldFontOverBoardMenuGFX
|
|
|
|
writetext .ConfirmExitText
|
|
|
|
yesorno
|
|
|
|
iftrue .exit
|
|
|
|
writetext .EmptyText
|
|
|
|
sjump .display_menu
|
|
|
|
|
|
|
|
.exit:
|
2023-09-30 15:39:18 -07:00
|
|
|
wait 300
|
2023-10-21 09:00:59 -07:00
|
|
|
exitoverworld ABANDONED_LEVEL
|
2023-10-23 09:40:08 -07:00
|
|
|
endall
|
2023-09-22 14:12:05 -07:00
|
|
|
|
|
|
|
.ConfirmExitText:
|
|
|
|
text "Abandon level and"
|
|
|
|
line "return to menu?"
|
|
|
|
done
|
|
|
|
|
|
|
|
.EmptyText:
|
|
|
|
text ""
|
|
|
|
done
|
|
|
|
|
2023-10-31 12:25:56 -07:00
|
|
|
.ViewMap:
|
|
|
|
callasm .EnterViewMapMode
|
|
|
|
closetext
|
|
|
|
end
|
|
|
|
|
|
|
|
.EnterViewMapMode:
|
2023-12-15 10:10:47 -08:00
|
|
|
call BackupMapObjectsOnEnterViewMapMode
|
2023-10-31 12:25:56 -07:00
|
|
|
ld hl, wVramState
|
|
|
|
res 2, [hl]
|
|
|
|
ld a, BOARDEVENT_VIEW_MAP_MODE
|
|
|
|
ldh [hCurBoardEvent], a
|
2023-12-14 08:11:15 -08:00
|
|
|
ld a, 100
|
2023-10-31 12:25:56 -07:00
|
|
|
ld [wViewMapModeRange], a
|
|
|
|
ld a, [wMapGroup]
|
|
|
|
ld [wBeforeViewMapMapGroup], a
|
|
|
|
ld a, [wMapNumber]
|
|
|
|
ld [wBeforeViewMapMapNumber], a
|
|
|
|
ld a, [wXCoord]
|
|
|
|
ld [wBeforeViewMapXCoord], a
|
|
|
|
ld a, [wYCoord]
|
|
|
|
ld [wBeforeViewMapYCoord], a
|
|
|
|
xor a
|
|
|
|
ld [wViewMapModeDisplacementY], a
|
|
|
|
ld [wViewMapModeDisplacementX], a
|
|
|
|
call DisableOverworldHUD
|
2023-11-04 05:04:25 -07:00
|
|
|
farcall LoadViewMapModeGFX
|
|
|
|
ld hl, wDisplaySecondarySprites
|
|
|
|
set SECONDARYSPRITES_VIEW_MAP_MODE_F, [hl]
|
2023-11-04 09:17:08 -07:00
|
|
|
ld hl, wPlayerFlags
|
|
|
|
set INVISIBLE_F, [hl]
|
|
|
|
farcall MockPlayerObject
|
2023-11-04 05:04:25 -07:00
|
|
|
ret
|
|
|
|
|
2023-09-22 14:12:05 -07:00
|
|
|
.SubmenuCallback:
|
2023-09-30 10:12:57 -07:00
|
|
|
; if submenu has requested a callback through wMenuReturn,
|
2023-09-22 14:12:05 -07:00
|
|
|
; it has also taken care of queuing it into wQueuedScriptBank/wQueuedScriptAddr.
|
2023-09-30 10:12:57 -07:00
|
|
|
readmem wMenuReturn
|
|
|
|
ifequal MENURETURN_SCRIPT, .CallbackScript
|
|
|
|
ifequal MENURETURN_ASM, .CallbackAsm
|
2023-09-22 14:12:05 -07:00
|
|
|
end
|
|
|
|
|
|
|
|
.CallbackScript:
|
|
|
|
memjump wQueuedScriptBank
|
|
|
|
|
|
|
|
.CallbackAsm:
|
|
|
|
memcallasm wQueuedScriptBank
|
|
|
|
end
|
|
|
|
|
2023-08-14 11:09:23 -07:00
|
|
|
BoardMenu::
|
2023-09-30 10:12:57 -07:00
|
|
|
; returns the selected menu item (BOARDMENUITEM_*) in hScriptVar upon exit
|
2023-08-14 11:09:23 -07:00
|
|
|
ld a, [wBoardMenuLastCursorPosition]
|
2023-08-17 04:51:29 -07:00
|
|
|
cp NUM_BOARD_MENU_ITEMS
|
|
|
|
jr c, .ok
|
|
|
|
ld a, BOARDMENUITEM_DIE
|
|
|
|
.ok
|
2023-08-14 11:09:23 -07:00
|
|
|
ld [wBoardMenuCursorPosition], a
|
2023-10-23 08:36:52 -07:00
|
|
|
; clear any other sprite animation
|
|
|
|
farcall ClearSpriteAnims
|
2023-08-17 04:51:29 -07:00
|
|
|
; refresh overworld sprites to hide those behind textbox before drawing new graphics
|
|
|
|
call UpdateSprites
|
2023-08-14 11:09:23 -07:00
|
|
|
farcall LoadBoardMenuGFX
|
2023-08-31 09:51:37 -07:00
|
|
|
call DrawBoardMenuTilesAndClearPriorityAttr
|
2023-08-17 04:51:29 -07:00
|
|
|
call ApplyBoardMenuSpritePalette
|
|
|
|
; allow Pal update to complete, then apply the tilemap
|
|
|
|
call DelayFrame
|
2023-08-14 11:09:23 -07:00
|
|
|
call ApplyTilemap
|
2023-08-17 04:51:29 -07:00
|
|
|
; update sprites again to display the sprites of the selected menu item
|
|
|
|
ld hl, wDisplaySecondarySprites
|
|
|
|
set SECONDARYSPRITES_BOARD_MENU_F, [hl]
|
2023-08-14 11:09:23 -07:00
|
|
|
call UpdateSprites
|
|
|
|
|
|
|
|
.loop
|
|
|
|
call GetBoardMenuSelection
|
|
|
|
jr c, .done
|
|
|
|
ld hl, wBoardMenuCursorPosition
|
|
|
|
ld a, [wBoardMenuLastCursorPosition]
|
|
|
|
cp [hl]
|
|
|
|
jr z, .loop
|
|
|
|
|
|
|
|
; menu item change: refresh board menu OAM and save cursor position
|
2023-08-17 04:51:29 -07:00
|
|
|
call ApplyBoardMenuSpritePalette
|
|
|
|
call UpdateSprites
|
2023-08-14 11:09:23 -07:00
|
|
|
ld a, [wBoardMenuCursorPosition]
|
|
|
|
ld [wBoardMenuLastCursorPosition], a
|
|
|
|
jr .loop
|
|
|
|
|
|
|
|
.done
|
2023-08-17 04:51:29 -07:00
|
|
|
ld hl, wDisplaySecondarySprites
|
|
|
|
res SECONDARYSPRITES_BOARD_MENU_F, [hl]
|
2023-08-14 11:09:23 -07:00
|
|
|
ld a, [wBoardMenuCursorPosition]
|
2023-09-30 10:12:57 -07:00
|
|
|
ldh [hScriptVar], a
|
2023-08-14 11:09:23 -07:00
|
|
|
ret
|
|
|
|
|
2023-08-31 09:51:37 -07:00
|
|
|
DrawBoardMenuTilesAndClearPriorityAttr:
|
2023-08-14 11:09:23 -07:00
|
|
|
hlcoord TEXTBOX_INNERX, TEXTBOX_INNERY
|
|
|
|
ld a, BOARD_MENU_BG_FIRST_TILE
|
|
|
|
lb bc, 3, 18
|
2023-08-31 09:51:37 -07:00
|
|
|
call FillBoxWithConsecutiveBytes
|
|
|
|
hlcoord TEXTBOX_INNERX, TEXTBOX_INNERY, wAttrmap
|
|
|
|
ld a, PAL_BG_TEXT
|
|
|
|
lb bc, 3, 18
|
|
|
|
jp FillBoxWithByte
|
2023-08-14 11:09:23 -07:00
|
|
|
|
2023-08-17 04:51:29 -07:00
|
|
|
ApplyBoardMenuSpritePalette:
|
2023-08-14 11:09:23 -07:00
|
|
|
ld hl, BoardMenuItemPals
|
2023-08-17 04:51:29 -07:00
|
|
|
ld a, [wBoardMenuCursorPosition]
|
2023-08-14 11:09:23 -07:00
|
|
|
ld bc, PALETTE_SIZE
|
|
|
|
call AddNTimes
|
2023-09-22 14:12:05 -07:00
|
|
|
; write to wOBPals2 directly as well to avoid calling ApplyPals and overwriting other overworld pals
|
|
|
|
; writing to wOBPals1 is still necessary to make fading animations consistent
|
|
|
|
ld de, wOBPals1 palette PAL_OW_MISC
|
|
|
|
ld bc, PALETTE_SIZE
|
|
|
|
ld a, BANK(wOBPals1)
|
|
|
|
call FarCopyWRAM
|
|
|
|
ld hl, wOBPals1 palette PAL_OW_MISC
|
2023-08-14 11:09:23 -07:00
|
|
|
ld de, wOBPals2 palette PAL_OW_MISC
|
|
|
|
ld bc, PALETTE_SIZE
|
2023-09-22 14:12:05 -07:00
|
|
|
ld a, BANK(wOBPals1)
|
2023-08-14 11:09:23 -07:00
|
|
|
call FarCopyWRAM
|
2023-08-17 04:51:29 -07:00
|
|
|
ld a, TRUE
|
|
|
|
ldh [hCGBPalUpdate], a
|
2023-08-14 11:09:23 -07:00
|
|
|
ret
|
|
|
|
|
|
|
|
GetBoardMenuSelection:
|
2023-08-17 04:51:29 -07:00
|
|
|
call JoyTextDelay
|
|
|
|
call GetMenuJoypad
|
|
|
|
bit A_BUTTON_F, a
|
|
|
|
jr nz, .a_button
|
2023-10-31 12:25:56 -07:00
|
|
|
bit SELECT_F, a
|
|
|
|
jr nz, .select_button
|
2023-08-17 04:51:29 -07:00
|
|
|
bit D_RIGHT_F, a
|
|
|
|
jr nz, .d_right
|
|
|
|
bit D_LEFT_F, a
|
|
|
|
jr nz, .d_left
|
|
|
|
xor a
|
|
|
|
ret ; nc
|
|
|
|
|
|
|
|
.a_button
|
|
|
|
call PlayClickSFX
|
|
|
|
call WaitSFX
|
2023-08-14 11:09:23 -07:00
|
|
|
scf
|
|
|
|
ret
|
|
|
|
|
2023-10-31 12:25:56 -07:00
|
|
|
.select_button
|
|
|
|
ld a, BOARDMENUITEM_VIEWMAP
|
|
|
|
ld [wBoardMenuCursorPosition], a
|
|
|
|
call PlayClickSFX
|
|
|
|
call WaitSFX
|
|
|
|
scf
|
|
|
|
ret
|
|
|
|
|
2023-08-17 04:51:29 -07:00
|
|
|
.d_right
|
|
|
|
call PlayClickSFX
|
|
|
|
ld a, [wBoardMenuCursorPosition]
|
|
|
|
inc a
|
|
|
|
cp NUM_BOARD_MENU_ITEMS
|
|
|
|
jr c, .right_dont_wrap_around
|
|
|
|
ld a, BOARDMENUITEM_DIE
|
|
|
|
.right_dont_wrap_around
|
|
|
|
ld [wBoardMenuCursorPosition], a
|
|
|
|
xor a
|
|
|
|
ret ; nc
|
|
|
|
|
|
|
|
.d_left
|
|
|
|
call PlayClickSFX
|
|
|
|
ld a, [wBoardMenuCursorPosition]
|
|
|
|
dec a
|
|
|
|
cp -1
|
|
|
|
jr nz, .left_dont_wrap_around
|
|
|
|
ld a, NUM_BOARD_MENU_ITEMS - 1 ; BOARDMENUITEM_EXIT
|
|
|
|
.left_dont_wrap_around
|
|
|
|
ld [wBoardMenuCursorPosition], a
|
|
|
|
xor a
|
|
|
|
ret ; nc
|
|
|
|
|
2023-09-25 12:57:47 -07:00
|
|
|
BoardMenu_Die:
|
|
|
|
DIE_MAX_NUMBER EQU 6
|
|
|
|
ld hl, wDisplaySecondarySprites
|
|
|
|
set SECONDARYSPRITES_DIE_ROLL_F, [hl]
|
|
|
|
ld a, 1
|
|
|
|
ld [wDieRoll], a
|
|
|
|
call HDMATransferTilemapAndAttrmap_OpenAndCloseMenu ;
|
|
|
|
call CloseText ; closetext
|
|
|
|
|
|
|
|
.rotate_die_loop
|
|
|
|
call IsSFXPlaying
|
2023-10-03 10:01:24 -07:00
|
|
|
ld de, SFX_STOP_SLOT
|
2023-09-25 12:57:47 -07:00
|
|
|
call c, PlaySFX
|
|
|
|
call Random
|
|
|
|
.sample_die_loop
|
|
|
|
sub DIE_MAX_NUMBER
|
|
|
|
jr nc, .sample_die_loop
|
|
|
|
add DIE_MAX_NUMBER
|
|
|
|
add $1
|
|
|
|
ld [wDieRoll], a
|
2023-10-14 10:28:35 -07:00
|
|
|
call UpdateSecondarySprites
|
2023-09-25 12:57:47 -07:00
|
|
|
call GetJoypad
|
|
|
|
ldh a, [hJoyPressed]
|
|
|
|
bit B_BUTTON_F, a
|
|
|
|
jr nz, .back_to_menu
|
|
|
|
bit A_BUTTON_F, a
|
|
|
|
jr nz, .confirm_roll
|
|
|
|
call DelayFrame
|
|
|
|
jr .rotate_die_loop
|
|
|
|
|
|
|
|
.back_to_menu
|
|
|
|
call PlayClickSFX
|
|
|
|
ld hl, wDisplaySecondarySprites
|
|
|
|
res SECONDARYSPRITES_DIE_ROLL_F, [hl]
|
2023-10-21 10:33:40 -07:00
|
|
|
call UpdateActiveSprites ; update sprites not to drag a static die
|
2023-09-25 12:57:47 -07:00
|
|
|
xor a ; FALSE
|
2023-09-30 10:12:57 -07:00
|
|
|
ldh [hScriptVar], a
|
2023-09-25 12:57:47 -07:00
|
|
|
ret
|
|
|
|
|
|
|
|
.confirm_roll
|
2023-09-30 04:30:30 -07:00
|
|
|
call UpdateSprites
|
2023-09-25 12:57:47 -07:00
|
|
|
ld a, TRUE
|
2023-09-30 10:12:57 -07:00
|
|
|
ldh [hScriptVar], a
|
2023-09-25 12:57:47 -07:00
|
|
|
ret
|
|
|
|
|
2023-09-26 11:09:13 -07:00
|
|
|
BoardMenu_BreakDieAnimation:
|
|
|
|
farcall LoadBoardMenuDieNumbersGFX
|
2023-12-27 08:42:46 -08:00
|
|
|
call RefreshOverworldHUD ; apply wDieRoll in overworld HUD
|
2023-09-26 11:09:13 -07:00
|
|
|
ld a, [wDieRoll]
|
|
|
|
dec a
|
|
|
|
add a
|
|
|
|
ld c, a
|
|
|
|
ld a, SPRITE_ANIM_DICT_BOARD_MENU
|
|
|
|
ld hl, wSpriteAnimDict ; wSpriteAnimDict[0]
|
|
|
|
ld [hli], a
|
|
|
|
ld a, DIE_ROLL_OAM_FIRST_TILE
|
|
|
|
add c
|
|
|
|
ld [hli], a
|
|
|
|
xor a ; SPRITE_ANIM_DICT_DEFAULT
|
|
|
|
ld [hli], a ; wSpriteAnimDict[1]
|
|
|
|
ld a, DIE_NUMBERS_OAM_FIRST_TILE
|
|
|
|
add c
|
|
|
|
ld [hl], a
|
|
|
|
|
|
|
|
; initialize break die animation
|
|
|
|
depixel 8, 10, 0, 0
|
|
|
|
ld a, SPRITE_ANIM_OBJ_BOARD_MENU_BREAK_DIE
|
|
|
|
call InitSpriteAnimStruct
|
|
|
|
|
|
|
|
; initialize appear die number animation, but only if there is enough
|
|
|
|
; OAM space without pushing aside some NPC (aesthetic failsafe).
|
|
|
|
ldh a, [hUsedSpriteIndex]
|
|
|
|
cp (NUM_SPRITE_OAM_STRUCTS * SPRITEOAMSTRUCT_LENGTH) - (4 * SPRITEOAMSTRUCT_LENGTH) + 1
|
|
|
|
jr nc, .anims_initialized
|
|
|
|
depixel 8, 10, 0, 0
|
|
|
|
ld a, SPRITE_ANIM_OBJ_BOARD_MENU_APPEAR_DIE_NUMBER
|
|
|
|
call InitSpriteAnimStruct
|
|
|
|
|
|
|
|
.anims_initialized
|
|
|
|
ld hl, wDisplaySecondarySprites
|
|
|
|
res SECONDARYSPRITES_DIE_ROLL_F, [hl]
|
|
|
|
|
|
|
|
ld hl, wVramState
|
|
|
|
set 2, [hl] ; do not clear wShadowOAM during DoNextFrameForAllSprites
|
|
|
|
; animation plays above NPCs so draw the graphics at the beginning of OAM.
|
|
|
|
; begin placing NPC sprites in OAM after all objects allocated to animations.
|
|
|
|
ld a, [wSpriteAnim2Index]
|
|
|
|
and a
|
|
|
|
ld a, $8 * SPRITEOAMSTRUCT_LENGTH ; with SPRITE_ANIM_OBJ_BOARD_MENU_APPEAR_DIE_NUMBER
|
|
|
|
jr nz, .go
|
|
|
|
ld a, $4 * SPRITEOAMSTRUCT_LENGTH ; w/o SPRITE_ANIM_OBJ_BOARD_MENU_APPEAR_DIE_NUMBER
|
|
|
|
.go
|
2023-09-30 04:30:30 -07:00
|
|
|
ldh [hUsedSpriteIndex], a
|
2023-10-21 09:46:56 -07:00
|
|
|
farcall _UpdateActiveSpritesAfterOffset
|
2023-09-26 11:09:13 -07:00
|
|
|
|
2023-11-30 06:51:24 -08:00
|
|
|
ld de, SFX_PLACE_PUZZLE_PIECE_DOWN
|
2023-09-27 10:25:47 -07:00
|
|
|
call PlaySFX
|
|
|
|
|
|
|
|
; play break die and appear die number animations
|
|
|
|
ld a, 61 ; total duration of SPRITE_ANIM_FRAMESET_BOARD_MENU_BREAK_DIE.
|
|
|
|
; the total duration is the sum of all durations in the frameset
|
|
|
|
; plus one for each oam* entry in the frameset.
|
2023-09-26 11:09:13 -07:00
|
|
|
ld [wFrameCounter], a
|
2023-09-27 10:25:47 -07:00
|
|
|
.loop1
|
|
|
|
farcall PlaySpriteAnimationsAndDelayFrame
|
|
|
|
ld hl, wFrameCounter
|
|
|
|
ld a, [hl]
|
|
|
|
and a
|
|
|
|
jr z, .next
|
|
|
|
dec [hl]
|
|
|
|
jr .loop1
|
|
|
|
|
|
|
|
.next
|
|
|
|
; initialize move die number animation
|
|
|
|
depixel 8, 10, 0, 0
|
|
|
|
ld a, SPRITE_ANIM_OBJ_BOARD_MENU_MOVE_DIE_NUMBER
|
|
|
|
call InitSpriteAnimStruct
|
|
|
|
|
|
|
|
ld a, $4 * SPRITEOAMSTRUCT_LENGTH
|
|
|
|
ldh [hUsedSpriteIndex], a
|
2023-10-21 09:46:56 -07:00
|
|
|
farcall _UpdateActiveSpritesAfterOffset
|
2023-09-27 10:25:47 -07:00
|
|
|
|
|
|
|
; play move die number animation
|
2023-09-30 10:06:54 -07:00
|
|
|
ld a, 43 ; total duration of SPRITE_ANIM_FRAMESET_BOARD_MENU_MOVE_DIE_NUMBER
|
2023-09-27 10:25:47 -07:00
|
|
|
ld [wFrameCounter], a
|
|
|
|
.loop2
|
2023-09-26 11:09:13 -07:00
|
|
|
farcall PlaySpriteAnimationsAndDelayFrame
|
|
|
|
ld hl, wFrameCounter
|
|
|
|
ld a, [hl]
|
|
|
|
and a
|
|
|
|
jr z, .done
|
|
|
|
dec [hl]
|
2023-09-27 10:25:47 -07:00
|
|
|
jr .loop2
|
2023-09-26 11:09:13 -07:00
|
|
|
|
|
|
|
.done
|
|
|
|
ld hl, wVramState
|
|
|
|
res 2, [hl]
|
2023-09-27 10:25:47 -07:00
|
|
|
ld hl, wDisplaySecondarySprites
|
|
|
|
set SECONDARYSPRITES_SPACES_LEFT_F, [hl]
|
|
|
|
ld a, [wDieRoll]
|
|
|
|
ld [wSpacesLeft], a
|
|
|
|
call UpdateSprites
|
2023-10-14 10:28:35 -07:00
|
|
|
ld a, BOARDEVENT_HANDLE_BOARD
|
|
|
|
ldh [hCurBoardEvent], a
|
2023-09-26 11:09:13 -07:00
|
|
|
ret
|
|
|
|
|
2023-09-22 14:12:05 -07:00
|
|
|
BoardMenu_Party:
|
|
|
|
ld a, [wPartyCount]
|
|
|
|
and a
|
|
|
|
ret z
|
|
|
|
|
|
|
|
call BoardMenu_OpenSubmenu
|
|
|
|
farcall Party
|
|
|
|
jr nc, .quit
|
|
|
|
|
|
|
|
.return
|
|
|
|
; if cancelled or pressed B
|
|
|
|
call BoardMenu_CloseSubmenu
|
|
|
|
ret
|
|
|
|
|
|
|
|
.quit
|
|
|
|
; if quitted party menu after using field move
|
|
|
|
call BoardMenu_CloseSubmenu
|
2023-09-30 10:12:57 -07:00
|
|
|
ld a, MENURETURN_SCRIPT
|
|
|
|
ld [wMenuReturn], a
|
2023-09-22 14:12:05 -07:00
|
|
|
ret
|
|
|
|
|
|
|
|
BoardMenu_Pack:
|
|
|
|
call BoardMenu_OpenSubmenu
|
|
|
|
farcall Pack
|
|
|
|
call BoardMenu_CloseSubmenu
|
|
|
|
ld a, [wPackUsedItem]
|
|
|
|
and a
|
|
|
|
ret z
|
2023-09-30 10:12:57 -07:00
|
|
|
ld a, MENURETURN_SCRIPT
|
|
|
|
ld [wMenuReturn], a
|
2023-09-22 14:12:05 -07:00
|
|
|
ret
|
|
|
|
|
|
|
|
BoardMenu_Pokegear:
|
|
|
|
call BoardMenu_OpenSubmenu
|
|
|
|
farcall PokeGear
|
|
|
|
jp BoardMenu_CloseSubmenu
|
|
|
|
|
|
|
|
BoardMenu_OpenSubmenu:
|
|
|
|
xor a
|
2023-09-30 10:12:57 -07:00
|
|
|
ld [wMenuReturn], a
|
2023-09-22 14:12:05 -07:00
|
|
|
ldh [hBGMapMode], a
|
|
|
|
call LoadStandardMenuHeader
|
|
|
|
farcall FadeOutPalettesToWhite
|
|
|
|
call DisableOverworldHUD
|
2023-09-30 15:10:44 -07:00
|
|
|
ld a, FALSE
|
|
|
|
ld [wText2bpp], a
|
2023-09-22 14:12:05 -07:00
|
|
|
call LoadStandardFont
|
|
|
|
call LoadFrame
|
|
|
|
call ClearSprites
|
|
|
|
call DisableSpriteUpdates
|
|
|
|
ret
|
|
|
|
|
|
|
|
BoardMenu_CloseSubmenu:
|
|
|
|
call ClearBGPalettes
|
2023-10-23 08:36:52 -07:00
|
|
|
farcall ClearSpriteAnims
|
2023-09-30 15:10:44 -07:00
|
|
|
ld a, TRUE
|
|
|
|
ld [wText2bpp], a
|
2023-09-22 14:12:05 -07:00
|
|
|
call EnableOverworldHUD
|
|
|
|
call ReloadTilesetAndPalettes
|
|
|
|
call UpdateSprites
|
|
|
|
call ExitMenu
|
|
|
|
call ClearTextbox
|
|
|
|
ld b, CGB_MAPPALS
|
|
|
|
call GetCGBLayout
|
|
|
|
call WaitBGMap2
|
|
|
|
farcall FadeInPalettesFromWhite
|
|
|
|
call EnableSpriteUpdates
|
|
|
|
ret
|
|
|
|
|
2023-08-14 11:09:23 -07:00
|
|
|
BoardMenuItemPals:
|
|
|
|
INCLUDE "gfx/board/menu.pal"
|