mirror of
https://gitlab.com/xCrystal/pokecrystal-board.git
synced 2024-11-16 11:27:33 -08:00
Board menu: die roll input and animation (#11)
This commit is contained in:
parent
2cbe0e1764
commit
db7d9c7063
@ -188,3 +188,4 @@ DEF BOARD_MENU_BG_FIRST_TILE EQU "A"
|
|||||||
; Object tile locations (vTiles0)
|
; Object tile locations (vTiles0)
|
||||||
DEF SECONDARY_SPRITES_FIRST_TILE EQU $20
|
DEF SECONDARY_SPRITES_FIRST_TILE EQU $20
|
||||||
DEF BOARD_MENU_OAM_FIRST_TILE EQU SECONDARY_SPRITES_FIRST_TILE
|
DEF BOARD_MENU_OAM_FIRST_TILE EQU SECONDARY_SPRITES_FIRST_TILE
|
||||||
|
DEF DIE_ROLL_OAM_FIRST_TILE EQU BOARD_MENU_OAM_FIRST_TILE + 45 ; BOARD_MENU_ITEM_SIZE * NUM_BOARD_MENU_ITEMS
|
||||||
|
@ -59,11 +59,15 @@ DEF SPRITE_GFX_LIST_CAPACITY EQU 1 + WALKING_SPRITE_GFX_LIST_CAPACITY + STILL_SP
|
|||||||
const ANIM_MON_EGG1
|
const ANIM_MON_EGG1
|
||||||
const ANIM_MON_EGG2
|
const ANIM_MON_EGG2
|
||||||
|
|
||||||
BOARD_MENU_ITEM_WIDTH EQU 3
|
|
||||||
BOARD_MENU_ITEM_HEIGHT EQU 3
|
|
||||||
BOARD_MENU_ITEM_SIZE EQU BOARD_MENU_ITEM_WIDTH * BOARD_MENU_ITEM_HEIGHT
|
|
||||||
|
|
||||||
; LoadHUD indexes (see engine/gfx/hud.asm)
|
; LoadHUD indexes (see engine/gfx/hud.asm)
|
||||||
const_def 1
|
const_def 1
|
||||||
const HUD_OVERWORLD ; 1
|
const HUD_OVERWORLD ; 1
|
||||||
DEF NUM_HUD_TYPES EQU const_value - 1
|
DEF NUM_HUD_TYPES EQU const_value - 1
|
||||||
|
|
||||||
|
; board menu graphics
|
||||||
|
BOARD_MENU_ITEM_WIDTH EQU 3
|
||||||
|
BOARD_MENU_ITEM_HEIGHT EQU 3
|
||||||
|
BOARD_MENU_ITEM_SIZE EQU BOARD_MENU_ITEM_WIDTH * BOARD_MENU_ITEM_HEIGHT
|
||||||
|
DIE_WIDTH EQU 2
|
||||||
|
DIE_HEIGHT EQU 2
|
||||||
|
DIE_SIZE EQU DIE_WIDTH * DIE_HEIGHT
|
||||||
|
@ -9,6 +9,7 @@ DEF AUTO_INPUT EQU $ff
|
|||||||
; wDisplaySecondarySprites
|
; wDisplaySecondarySprites
|
||||||
const_def
|
const_def
|
||||||
const SECONDARYSPRITES_BOARD_MENU_F ; 0
|
const SECONDARYSPRITES_BOARD_MENU_F ; 0
|
||||||
|
const SECONDARYSPRITES_DIE_ROLL_F ; 1
|
||||||
|
|
||||||
; wCurDexMode::
|
; wCurDexMode::
|
||||||
const_def
|
const_def
|
||||||
|
@ -49,3 +49,35 @@ BoardMenuOAM:
|
|||||||
dbsprite 16, 18, 4, 0, BOARD_MENU_OAM_FIRST_TILE + 42, PAL_OW_MISC
|
dbsprite 16, 18, 4, 0, BOARD_MENU_OAM_FIRST_TILE + 42, PAL_OW_MISC
|
||||||
dbsprite 17, 18, 4, 0, BOARD_MENU_OAM_FIRST_TILE + 43, PAL_OW_MISC
|
dbsprite 17, 18, 4, 0, BOARD_MENU_OAM_FIRST_TILE + 43, PAL_OW_MISC
|
||||||
dbsprite 18, 18, 4, 0, BOARD_MENU_OAM_FIRST_TILE + 44, PAL_OW_MISC
|
dbsprite 18, 18, 4, 0, BOARD_MENU_OAM_FIRST_TILE + 44, PAL_OW_MISC
|
||||||
|
|
||||||
|
DieRollOAM:
|
||||||
|
; 1
|
||||||
|
dbsprite 9, 7, 0, 0, DIE_ROLL_OAM_FIRST_TILE, PAL_OW_MISC
|
||||||
|
dbsprite 10, 7, 0, 0, DIE_ROLL_OAM_FIRST_TILE + 1, PAL_OW_MISC
|
||||||
|
dbsprite 9, 8, 0, 0, DIE_ROLL_OAM_FIRST_TILE + 20, PAL_OW_MISC
|
||||||
|
dbsprite 10, 8, 0, 0, DIE_ROLL_OAM_FIRST_TILE + 21, PAL_OW_MISC
|
||||||
|
; 2
|
||||||
|
dbsprite 9, 7, 0, 0, DIE_ROLL_OAM_FIRST_TILE + 2, PAL_OW_MISC
|
||||||
|
dbsprite 10, 7, 0, 0, DIE_ROLL_OAM_FIRST_TILE + 3, PAL_OW_MISC
|
||||||
|
dbsprite 9, 8, 0, 0, DIE_ROLL_OAM_FIRST_TILE + 22, PAL_OW_MISC
|
||||||
|
dbsprite 10, 8, 0, 0, DIE_ROLL_OAM_FIRST_TILE + 23, PAL_OW_MISC
|
||||||
|
; 3
|
||||||
|
dbsprite 9, 7, 0, 0, DIE_ROLL_OAM_FIRST_TILE + 4, PAL_OW_MISC
|
||||||
|
dbsprite 10, 7, 0, 0, DIE_ROLL_OAM_FIRST_TILE + 5, PAL_OW_MISC
|
||||||
|
dbsprite 9, 8, 0, 0, DIE_ROLL_OAM_FIRST_TILE + 24, PAL_OW_MISC
|
||||||
|
dbsprite 10, 8, 0, 0, DIE_ROLL_OAM_FIRST_TILE + 25, PAL_OW_MISC
|
||||||
|
; 4
|
||||||
|
dbsprite 9, 7, 0, 0, DIE_ROLL_OAM_FIRST_TILE + 6, PAL_OW_MISC
|
||||||
|
dbsprite 10, 7, 0, 0, DIE_ROLL_OAM_FIRST_TILE + 7, PAL_OW_MISC
|
||||||
|
dbsprite 9, 8, 0, 0, DIE_ROLL_OAM_FIRST_TILE + 26, PAL_OW_MISC
|
||||||
|
dbsprite 10, 8, 0, 0, DIE_ROLL_OAM_FIRST_TILE + 27, PAL_OW_MISC
|
||||||
|
; 5
|
||||||
|
dbsprite 9, 7, 0, 0, DIE_ROLL_OAM_FIRST_TILE + 8, PAL_OW_MISC
|
||||||
|
dbsprite 10, 7, 0, 0, DIE_ROLL_OAM_FIRST_TILE + 9, PAL_OW_MISC
|
||||||
|
dbsprite 9, 8, 0, 0, DIE_ROLL_OAM_FIRST_TILE + 28, PAL_OW_MISC
|
||||||
|
dbsprite 10, 8, 0, 0, DIE_ROLL_OAM_FIRST_TILE + 29, PAL_OW_MISC
|
||||||
|
; 6
|
||||||
|
dbsprite 9, 7, 0, 0, DIE_ROLL_OAM_FIRST_TILE + 10, PAL_OW_MISC
|
||||||
|
dbsprite 10, 7, 0, 0, DIE_ROLL_OAM_FIRST_TILE + 11, PAL_OW_MISC
|
||||||
|
dbsprite 9, 8, 0, 0, DIE_ROLL_OAM_FIRST_TILE + 30, PAL_OW_MISC
|
||||||
|
dbsprite 10, 8, 0, 0, DIE_ROLL_OAM_FIRST_TILE + 31, PAL_OW_MISC
|
||||||
|
@ -11,7 +11,9 @@ BoardMenuScript::
|
|||||||
end
|
end
|
||||||
|
|
||||||
.Die:
|
.Die:
|
||||||
closetext
|
callasm BoardMenu_Die
|
||||||
|
iffalse BoardMenuScript
|
||||||
|
callasm BoardMenu_BreakDieAnimation
|
||||||
end
|
end
|
||||||
|
|
||||||
.Party:
|
.Party:
|
||||||
@ -180,6 +182,50 @@ GetBoardMenuSelection:
|
|||||||
xor a
|
xor a
|
||||||
ret ; nc
|
ret ; nc
|
||||||
|
|
||||||
|
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
|
||||||
|
ld de, SFX_KINESIS
|
||||||
|
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
|
||||||
|
farcall _UpdateSprites
|
||||||
|
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]
|
||||||
|
xor a ; FALSE
|
||||||
|
ld [wScriptVar], a
|
||||||
|
ret
|
||||||
|
|
||||||
|
.confirm_roll
|
||||||
|
call PlayClickSFX
|
||||||
|
ld a, TRUE
|
||||||
|
ld [wScriptVar], a
|
||||||
|
ret
|
||||||
|
|
||||||
BoardMenu_Party:
|
BoardMenu_Party:
|
||||||
ld a, [wPartyCount]
|
ld a, [wPartyCount]
|
||||||
and a
|
and a
|
||||||
@ -201,6 +247,9 @@ BoardMenu_Party:
|
|||||||
ldh [hMenuReturn], a
|
ldh [hMenuReturn], a
|
||||||
ret
|
ret
|
||||||
|
|
||||||
|
BoardMenu_BreakDieAnimation:
|
||||||
|
ret
|
||||||
|
|
||||||
BoardMenu_Pack:
|
BoardMenu_Pack:
|
||||||
call BoardMenu_OpenSubmenu
|
call BoardMenu_OpenSubmenu
|
||||||
farcall Pack
|
farcall Pack
|
||||||
|
@ -7,6 +7,10 @@ LoadBoardMenuGFX::
|
|||||||
ld hl, vTiles0 + BOARD_MENU_OAM_FIRST_TILE * LEN_2BPP_TILE
|
ld hl, vTiles0 + BOARD_MENU_OAM_FIRST_TILE * LEN_2BPP_TILE
|
||||||
lb bc, BANK(.BoardMenuOAMGFX), BOARD_MENU_ITEM_SIZE * NUM_BOARD_MENU_ITEMS
|
lb bc, BANK(.BoardMenuOAMGFX), BOARD_MENU_ITEM_SIZE * NUM_BOARD_MENU_ITEMS
|
||||||
call Get2bppViaHDMA
|
call Get2bppViaHDMA
|
||||||
|
ld de, .DieRollOAMGFX
|
||||||
|
ld hl, vTiles0 + DIE_ROLL_OAM_FIRST_TILE * LEN_2BPP_TILE
|
||||||
|
lb bc, BANK(.BoardMenuOAMGFX), DIE_SIZE * 10
|
||||||
|
call Get2bppViaHDMA
|
||||||
ret
|
ret
|
||||||
|
|
||||||
.BoardMenuGFX:
|
.BoardMenuGFX:
|
||||||
@ -20,3 +24,6 @@ INCBIN "gfx/board/menu_pack.2bpp"
|
|||||||
INCBIN "gfx/board/menu_pokegear.2bpp"
|
INCBIN "gfx/board/menu_pokegear.2bpp"
|
||||||
INCBIN "gfx/board/menu_exit.2bpp"
|
INCBIN "gfx/board/menu_exit.2bpp"
|
||||||
assert_table_length NUM_BOARD_MENU_ITEMS
|
assert_table_length NUM_BOARD_MENU_ITEMS
|
||||||
|
|
||||||
|
.DieRollOAMGFX:
|
||||||
|
INCBIN "gfx/board/die_roll.2bpp"
|
@ -807,7 +807,6 @@ PlayerMovementPointers:
|
|||||||
CheckMenuOW:
|
CheckMenuOW:
|
||||||
xor a
|
xor a
|
||||||
ldh [hMenuReturn], a
|
ldh [hMenuReturn], a
|
||||||
ldh [hUnusedByte], a
|
|
||||||
ldh a, [hJoyPressed]
|
ldh a, [hJoyPressed]
|
||||||
|
|
||||||
bit SELECT_F, a
|
bit SELECT_F, a
|
||||||
|
@ -3074,10 +3074,12 @@ InitSprites:
|
|||||||
InitSecondarySprites:
|
InitSecondarySprites:
|
||||||
ld a, [wDisplaySecondarySprites]
|
ld a, [wDisplaySecondarySprites]
|
||||||
bit SECONDARYSPRITES_BOARD_MENU_F, a
|
bit SECONDARYSPRITES_BOARD_MENU_F, a
|
||||||
call nz, .InitBoardMenuSprites
|
call nz, InitBoardMenuSprites
|
||||||
|
bit SECONDARYSPRITES_DIE_ROLL_F, a
|
||||||
|
call nz, InitRollDieSprites
|
||||||
ret
|
ret
|
||||||
|
|
||||||
.InitBoardMenuSprites:
|
InitBoardMenuSprites:
|
||||||
push af
|
push af
|
||||||
|
|
||||||
ld hl, BoardMenuOAM
|
ld hl, BoardMenuOAM
|
||||||
@ -3102,4 +3104,30 @@ InitSecondarySprites:
|
|||||||
pop af
|
pop af
|
||||||
ret
|
ret
|
||||||
|
|
||||||
|
InitRollDieSprites:
|
||||||
|
push af
|
||||||
|
|
||||||
|
ld hl, DieRollOAM
|
||||||
|
ld a, [wDieRoll]
|
||||||
|
dec a
|
||||||
|
ld bc, DIE_SIZE * SPRITEOAMSTRUCT_LENGTH
|
||||||
|
call AddNTimes
|
||||||
|
; find the beginning of free space in OAM, and assure there's space for a DIE_SIZE object
|
||||||
|
ldh a, [hUsedSpriteIndex]
|
||||||
|
cp (NUM_SPRITE_OAM_STRUCTS * SPRITEOAMSTRUCT_LENGTH) - (DIE_SIZE * SPRITEOAMSTRUCT_LENGTH) + 1
|
||||||
|
jr nc, .oam_full
|
||||||
|
; copy the sprite data (DIE_SIZE objects) of that item to the available space in OAM
|
||||||
|
ld e, a
|
||||||
|
ld d, HIGH(wShadowOAM)
|
||||||
|
ld bc, DIE_SIZE * SPRITEOAMSTRUCT_LENGTH
|
||||||
|
call CopyBytes
|
||||||
|
|
||||||
|
ldh a, [hUsedSpriteIndex]
|
||||||
|
add (DIE_SIZE * SPRITEOAMSTRUCT_LENGTH)
|
||||||
|
ldh [hUsedSpriteIndex], a
|
||||||
|
|
||||||
|
.oam_full
|
||||||
|
pop af
|
||||||
|
ret
|
||||||
|
|
||||||
INCLUDE "data/sprites/secondary_sprites.asm"
|
INCLUDE "data/sprites/secondary_sprites.asm"
|
||||||
|
BIN
gfx/board/die_roll.png
Executable file
BIN
gfx/board/die_roll.png
Executable file
Binary file not shown.
After Width: | Height: | Size: 579 B |
@ -12,7 +12,6 @@ hVBlank:: db
|
|||||||
hMapEntryMethod:: db
|
hMapEntryMethod:: db
|
||||||
|
|
||||||
hMenuReturn:: db
|
hMenuReturn:: db
|
||||||
hUnusedByte:: db
|
|
||||||
|
|
||||||
hJoypadReleased:: db
|
hJoypadReleased:: db
|
||||||
hJoypadPressed:: db
|
hJoypadPressed:: db
|
||||||
|
@ -2240,6 +2240,11 @@ wBugContestSecsRemaining:: db
|
|||||||
|
|
||||||
wMapStatusEnd::
|
wMapStatusEnd::
|
||||||
|
|
||||||
|
wTurnData::
|
||||||
|
wDieRoll:: db
|
||||||
|
wSpacesLeft:: db
|
||||||
|
wTurnDataEnd::
|
||||||
|
|
||||||
wGameData::
|
wGameData::
|
||||||
wPlayerData::
|
wPlayerData::
|
||||||
wPlayerID:: dw
|
wPlayerID:: dw
|
||||||
|
Loading…
Reference in New Issue
Block a user