mirror of
https://gitlab.com/xCrystal/pokecrystal-board.git
synced 2024-09-09 09:51:34 -07:00
Board menu: break die and appear die number animations (#11)
This commit is contained in:
parent
db7d9c7063
commit
98d69d4e04
@ -188,4 +188,5 @@ DEF BOARD_MENU_BG_FIRST_TILE EQU "A"
|
||||
; Object tile locations (vTiles0)
|
||||
DEF SECONDARY_SPRITES_FIRST_TILE EQU $20
|
||||
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
|
||||
DEF DIE_ROLL_OAM_FIRST_TILE EQU BOARD_MENU_OAM_FIRST_TILE + 45 ; max(BOARD_MENU_ITEM_SIZE * NUM_BOARD_MENU_ITEMS, DIE_SIZE * 10)
|
||||
DEF DIE_NUMBERS_OAM_FIRST_TILE EQU BOARD_MENU_OAM_FIRST_TILE
|
||||
|
@ -71,3 +71,6 @@ 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
|
||||
DIE_NUMBER_WIDTH EQU 2
|
||||
DIE_NUMBER_HEIGHT EQU 2
|
||||
DIE_NUMBER_SIZE EQU DIE_NUMBER_WIDTH * DIE_NUMBER_HEIGHT
|
||||
|
@ -23,7 +23,8 @@ DEF NUM_SPRITE_ANIM_STRUCTS EQU 10 ; see wSpriteAnimationStructs
|
||||
; UnusedSpriteAnimGFX indexes (see data/sprite_anims/unused_gfx.asm)
|
||||
const_def
|
||||
const SPRITE_ANIM_DICT_DEFAULT ; 0
|
||||
const_skip 4 ; unused
|
||||
const SPRITE_ANIM_DICT_BOARD_MENU ; 1
|
||||
const_skip 3 ; unused
|
||||
const SPRITE_ANIM_DICT_TEXT_CURSOR ; 5
|
||||
const SPRITE_ANIM_DICT_GS_SPLASH ; 6
|
||||
const SPRITE_ANIM_DICT_SLOTS ; 7
|
||||
@ -88,6 +89,9 @@ DEF NUM_SPRITEANIMDICT_ENTRIES EQU 10
|
||||
const SPRITE_ANIM_OBJ_LEVEL_SELECTION_MENU_FEMALE_WALK_LEFT ; 32
|
||||
const SPRITE_ANIM_OBJ_LEVEL_SELECTION_MENU_MALE_WALK_RIGHT ; 33
|
||||
const SPRITE_ANIM_OBJ_LEVEL_SELECTION_MENU_FEMALE_WALK_RIGHT ; 34
|
||||
const SPRITE_ANIM_OBJ_BOARD_MENU_BREAK_DIE ; 35
|
||||
const SPRITE_ANIM_OBJ_BOARD_MENU_APPEAR_DIE_NUMBER ; 36
|
||||
const SPRITE_ANIM_OBJ_BOARD_MENU_MOVE_DIE_NUMBER ; 37
|
||||
DEF NUM_SPRITE_ANIM_OBJS EQU const_value
|
||||
|
||||
; DoSpriteAnimFrame.Jumptable indexes (see engine/sprite_anims/functions.asm)
|
||||
@ -131,6 +135,9 @@ DEF NUM_SPRITE_ANIM_OBJS EQU const_value
|
||||
const SPRITE_ANIM_FUNC_LEVEL_SELECTION_MENU_WALK_UP ; 24
|
||||
const SPRITE_ANIM_FUNC_LEVEL_SELECTION_MENU_WALK_LEFT ; 25
|
||||
const SPRITE_ANIM_FUNC_LEVEL_SELECTION_MENU_WALK_RIGHT ; 26
|
||||
const SPRITE_ANIM_FUNC_BOARD_MENU_BREAK_DIE ; 27
|
||||
const SPRITE_ANIM_FUNC_BOARD_MENU_APPEAR_DIE_NUMBER ; 28
|
||||
const SPRITE_ANIM_FUNC_BOARD_MENU_MOVE_DIE_NUMBER ; 29
|
||||
DEF NUM_SPRITE_ANIM_FUNCS EQU const_value
|
||||
|
||||
; SpriteAnimFrameData indexes (see data/sprite_anims/framesets.asm)
|
||||
@ -209,6 +216,9 @@ DEF NUM_SPRITE_ANIM_FUNCS EQU const_value
|
||||
const SPRITE_ANIM_FRAMESET_LEVEL_SELECTION_MENU_FEMALE_WALK_LEFT ; 47
|
||||
const SPRITE_ANIM_FRAMESET_LEVEL_SELECTION_MENU_MALE_WALK_RIGHT ; 48
|
||||
const SPRITE_ANIM_FRAMESET_LEVEL_SELECTION_MENU_FEMALE_WALK_RIGHT ; 49
|
||||
const SPRITE_ANIM_FRAMESET_BOARD_MENU_BREAK_DIE ; 50
|
||||
const SPRITE_ANIM_FRAMESET_BOARD_MENU_APPEAR_DIE_NUMBER ; 51
|
||||
const SPRITE_ANIM_FRAMESET_BOARD_MENU_MOVE_DIE_NUMBER ; 52
|
||||
DEF NUM_SPRITE_ANIM_FRAMESETS EQU const_value
|
||||
|
||||
; SpriteAnimOAMData indexes (see data/sprite_anims/oam.asm)
|
||||
@ -369,6 +379,11 @@ DEF NUM_SPRITE_ANIM_FRAMESETS EQU const_value
|
||||
const SPRITE_ANIM_OAMSET_LEVEL_SELECTION_MENU_MALE_RIGHT_2 ; 99
|
||||
const SPRITE_ANIM_OAMSET_LEVEL_SELECTION_MENU_FEMALE_RIGHT_1 ; 9a
|
||||
const SPRITE_ANIM_OAMSET_LEVEL_SELECTION_MENU_FEMALE_RIGHT_2 ; 9b
|
||||
const SPRITE_ANIM_OAMSET_BOARD_MENU_BREAK_DIE_1 ; 9c
|
||||
const SPRITE_ANIM_OAMSET_BOARD_MENU_BREAK_DIE_2 ; 9d
|
||||
const SPRITE_ANIM_OAMSET_BOARD_MENU_BREAK_DIE_3 ; 9e
|
||||
const SPRITE_ANIM_OAMSET_BOARD_MENU_BREAK_DIE_4 ; 9f
|
||||
const SPRITE_ANIM_OAMSET_BOARD_MENU_APPEAR_DIE_NUMBER ; a0
|
||||
DEF NUM_SPRITE_ANIM_OAMSETS EQU const_value
|
||||
|
||||
assert NUM_SPRITE_ANIM_OAMSETS <= FIRST_OAM_CMD, \
|
||||
|
@ -75,6 +75,9 @@ SpriteAnimFrameData:
|
||||
dw .Frameset_LevelSelectionMenuFemaleWalkLeft
|
||||
dw .Frameset_LevelSelectionMenuMaleWalkRight
|
||||
dw .Frameset_LevelSelectionMenuFemaleWalkRight
|
||||
dw .Frameset_BoardMenuBreakDie
|
||||
dw .Frameset_BoardMenuAppearDieNumber
|
||||
dw .Frameset_BoardMenuMoveDieNumber
|
||||
assert_table_length NUM_SPRITE_ANIM_FRAMESETS
|
||||
|
||||
.Frameset_00:
|
||||
@ -561,3 +564,23 @@ SpriteAnimFrameData:
|
||||
oamframe SPRITE_ANIM_OAMSET_LEVEL_SELECTION_MENU_FEMALE_RIGHT_1, 6, OAM_X_FLIP
|
||||
oamframe SPRITE_ANIM_OAMSET_LEVEL_SELECTION_MENU_FEMALE_RIGHT_2, 6, OAM_X_FLIP
|
||||
oamrestart
|
||||
|
||||
.Frameset_BoardMenuBreakDie:
|
||||
oamframe SPRITE_ANIM_OAMSET_BOARD_MENU_BREAK_DIE_1, 2
|
||||
oamframe SPRITE_ANIM_OAMSET_BOARD_MENU_BREAK_DIE_2, 6
|
||||
oamframe SPRITE_ANIM_OAMSET_BOARD_MENU_BREAK_DIE_3, 6
|
||||
oamframe SPRITE_ANIM_OAMSET_BOARD_MENU_BREAK_DIE_4, 6
|
||||
oamwait 2
|
||||
oamframe SPRITE_ANIM_OAMSET_BOARD_MENU_BREAK_DIE_4, 6
|
||||
oamwait 2
|
||||
oamframe SPRITE_ANIM_OAMSET_BOARD_MENU_BREAK_DIE_4, 6
|
||||
oamwait 2
|
||||
oamframe SPRITE_ANIM_OAMSET_BOARD_MENU_BREAK_DIE_4, 6
|
||||
oamdelete
|
||||
|
||||
.Frameset_BoardMenuAppearDieNumber:
|
||||
oamframe SPRITE_ANIM_OAMSET_BOARD_MENU_APPEAR_DIE_NUMBER, 44
|
||||
oamdelete
|
||||
|
||||
.Frameset_BoardMenuMoveDieNumber:
|
||||
oamdelete
|
||||
|
@ -163,6 +163,11 @@ SpriteAnimOAMData:
|
||||
spriteanimoam $14, .OAMData_RedWalkRight ; SPRITE_ANIM_OAMSET_LEVEL_SELECTION_MENU_MALE_RIGHT_2
|
||||
spriteanimoam $08, .OAMData_BlueWalkRight ; SPRITE_ANIM_OAMSET_LEVEL_SELECTION_MENU_FEMALE_RIGHT_1
|
||||
spriteanimoam $14, .OAMData_BlueWalkRight ; SPRITE_ANIM_OAMSET_LEVEL_SELECTION_MENU_FEMALE_RIGHT_2
|
||||
spriteanimoam $00, .OAMData_BreakDie1 ; SPRITE_ANIM_OAMSET_BOARD_MENU_BREAK_DIE_1
|
||||
spriteanimoam $00, .OAMData_BreakDie2 ; SPRITE_ANIM_OAMSET_BOARD_MENU_BREAK_DIE_2
|
||||
spriteanimoam $00, .OAMData_BreakDie3 ; SPRITE_ANIM_OAMSET_BOARD_MENU_BREAK_DIE_3
|
||||
spriteanimoam $00, .OAMData_BreakDie4 ; SPRITE_ANIM_OAMSET_BOARD_MENU_BREAK_DIE_4
|
||||
spriteanimoam $00, .OAMData_AppearDieNumber ; SPRITE_ANIM_OAMSET_BOARD_MENU_APPEAR_DIE_NUMBER
|
||||
|
||||
assert_table_length NUM_SPRITE_ANIM_OAMSETS
|
||||
|
||||
@ -631,6 +636,41 @@ SpriteAnimOAMData:
|
||||
dbsprite -2, 0, 0, 0, $02, PAL_OW_TREE
|
||||
dbsprite 1, 0, 0, 0, $03, PAL_OW_TREE
|
||||
|
||||
.OAMData_BreakDie1:
|
||||
db 4
|
||||
dbsprite -1, -1, 0, 0, $00, PAL_OW_MISC
|
||||
dbsprite 0, -1, 0, 0, $01, PAL_OW_MISC
|
||||
dbsprite -1, 0, 0, 0, $14, PAL_OW_MISC
|
||||
dbsprite 0, 0, 0, 0, $15, PAL_OW_MISC
|
||||
|
||||
.OAMData_BreakDie2:
|
||||
db 4
|
||||
dbsprite -2, -1, 6, 0, $00, PAL_OW_MISC
|
||||
dbsprite 0, -1, 2, 0, $01, PAL_OW_MISC
|
||||
dbsprite -2, 0, 6, 0, $14, PAL_OW_MISC
|
||||
dbsprite 0, 0, 2, 0, $15, PAL_OW_MISC
|
||||
|
||||
.OAMData_BreakDie3:
|
||||
db 4
|
||||
dbsprite -2, -1, 4, 0, $00, PAL_OW_MISC
|
||||
dbsprite 0, -1, 4, 0, $01, PAL_OW_MISC
|
||||
dbsprite -2, 0, 4, 0, $14, PAL_OW_MISC
|
||||
dbsprite 0, 0, 4, 0, $15, PAL_OW_MISC
|
||||
|
||||
.OAMData_BreakDie4:
|
||||
db 4
|
||||
dbsprite -2, -1, 0, 0, $00, PAL_OW_MISC
|
||||
dbsprite 1, -1, 0, 0, $01, PAL_OW_MISC
|
||||
dbsprite -2, 0, 0, 0, $14, PAL_OW_MISC
|
||||
dbsprite 1, 0, 0, 0, $15, PAL_OW_MISC
|
||||
|
||||
.OAMData_AppearDieNumber:
|
||||
db 4
|
||||
dbsprite -1, -1, 0, 0, $00, PAL_OW_MISC
|
||||
dbsprite 0, -1, 0, 0, $01, PAL_OW_MISC
|
||||
dbsprite -1, 0, 0, 0, $14, PAL_OW_MISC
|
||||
dbsprite 0, 0, 0, 0, $15, PAL_OW_MISC
|
||||
|
||||
.OAMData_GSIntroHoOhLugia1:
|
||||
db 19
|
||||
dbsprite -4, -1, 0, 0, $00, 0
|
||||
|
@ -108,5 +108,11 @@ SpriteAnimObjects:
|
||||
db SPRITE_ANIM_FRAMESET_LEVEL_SELECTION_MENU_MALE_WALK_RIGHT, SPRITE_ANIM_FUNC_LEVEL_SELECTION_MENU_WALK_RIGHT, SPRITE_ANIM_DICT_DEFAULT
|
||||
; SPRITE_ANIM_OBJ_LEVEL_SELECTION_MENU_FEMALE_WALK_RIGHT
|
||||
db SPRITE_ANIM_FRAMESET_LEVEL_SELECTION_MENU_FEMALE_WALK_RIGHT, SPRITE_ANIM_FUNC_LEVEL_SELECTION_MENU_WALK_RIGHT, SPRITE_ANIM_DICT_DEFAULT
|
||||
; SPRITE_ANIM_OBJ_BOARD_MENU_BREAK_DIE
|
||||
db SPRITE_ANIM_FRAMESET_BOARD_MENU_BREAK_DIE, SPRITE_ANIM_FUNC_BOARD_MENU_BREAK_DIE, SPRITE_ANIM_DICT_BOARD_MENU
|
||||
; SPRITE_ANIM_OBJ_BOARD_MENU_APPEAR_DIE_NUMBER
|
||||
db SPRITE_ANIM_FRAMESET_BOARD_MENU_APPEAR_DIE_NUMBER, SPRITE_ANIM_FUNC_BOARD_MENU_APPEAR_DIE_NUMBER, SPRITE_ANIM_DICT_DEFAULT
|
||||
; SPRITE_ANIM_OBJ_BOARD_MENU_MOVE_DIE_NUMBER
|
||||
db SPRITE_ANIM_FRAMESET_BOARD_MENU_MOVE_DIE_NUMBER, SPRITE_ANIM_FUNC_BOARD_MENU_MOVE_DIE_NUMBER, SPRITE_ANIM_DICT_DEFAULT
|
||||
|
||||
assert_table_length NUM_SPRITE_ANIM_OBJS
|
||||
|
@ -226,6 +226,71 @@ DIE_MAX_NUMBER EQU 6
|
||||
ld [wScriptVar], a
|
||||
ret
|
||||
|
||||
BoardMenu_BreakDieAnimation:
|
||||
farcall LoadBoardMenuDieNumbersGFX
|
||||
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
|
||||
ldh [hUsedSpriteIndex], a
|
||||
.go
|
||||
farcall _UpdateSpritesAfterOffset
|
||||
|
||||
ld a, 44 ; total duration of SPRITE_ANIM_FRAMESET_BOARD_MENU_BREAK_DIE
|
||||
ld [wFrameCounter], a
|
||||
.loop
|
||||
farcall PlaySpriteAnimationsAndDelayFrame
|
||||
ld hl, wFrameCounter
|
||||
ld a, [hl]
|
||||
and a
|
||||
jr z, .done
|
||||
dec [hl]
|
||||
jr .loop
|
||||
|
||||
.done
|
||||
ld hl, wVramState
|
||||
res 2, [hl]
|
||||
ret
|
||||
|
||||
BoardMenu_Party:
|
||||
ld a, [wPartyCount]
|
||||
and a
|
||||
@ -247,9 +312,6 @@ BoardMenu_Party:
|
||||
ldh [hMenuReturn], a
|
||||
ret
|
||||
|
||||
BoardMenu_BreakDieAnimation:
|
||||
ret
|
||||
|
||||
BoardMenu_Pack:
|
||||
call BoardMenu_OpenSubmenu
|
||||
farcall Pack
|
||||
|
@ -9,7 +9,7 @@ LoadBoardMenuGFX::
|
||||
call Get2bppViaHDMA
|
||||
ld de, .DieRollOAMGFX
|
||||
ld hl, vTiles0 + DIE_ROLL_OAM_FIRST_TILE * LEN_2BPP_TILE
|
||||
lb bc, BANK(.BoardMenuOAMGFX), DIE_SIZE * 10
|
||||
lb bc, BANK(.DieRollOAMGFX), DIE_SIZE * 10
|
||||
call Get2bppViaHDMA
|
||||
ret
|
||||
|
||||
@ -27,3 +27,14 @@ INCBIN "gfx/board/menu_exit.2bpp"
|
||||
|
||||
.DieRollOAMGFX:
|
||||
INCBIN "gfx/board/die_roll.2bpp"
|
||||
|
||||
LoadBoardMenuDieNumbersGFX::
|
||||
ld de, .DieNumbersOAMGFX
|
||||
; overwrite in vTiles0 the no-longer-needed BoardMenuOAMGFX, but keep DieRollOAMGFX
|
||||
ld hl, vTiles0 + DIE_NUMBERS_OAM_FIRST_TILE * LEN_2BPP_TILE
|
||||
lb bc, BANK(.DieNumbersOAMGFX), DIE_NUMBER_SIZE * 10
|
||||
call Get2bppViaHDMA
|
||||
ret
|
||||
|
||||
.DieNumbersOAMGFX:
|
||||
INCBIN "gfx/board/die_numbers.2bpp"
|
||||
|
@ -2754,12 +2754,19 @@ ResetObject:
|
||||
db SPRITEMOVEDATA_STANDING_LEFT
|
||||
db SPRITEMOVEDATA_STANDING_RIGHT
|
||||
|
||||
_UpdateSpritesAfterOffset::
|
||||
ld a, [wVramState]
|
||||
bit 0, a
|
||||
ret z
|
||||
jr _UpdateSprites.go
|
||||
|
||||
_UpdateSprites::
|
||||
ld a, [wVramState]
|
||||
bit 0, a
|
||||
ret z
|
||||
xor a
|
||||
ldh [hUsedSpriteIndex], a
|
||||
.go
|
||||
ldh a, [hOAMUpdate]
|
||||
push af
|
||||
ld a, 1
|
||||
|
@ -53,6 +53,9 @@ DoSpriteAnimFrame:
|
||||
dw SpriteAnimFunc_LevelSelectionMenuWalkUp
|
||||
dw SpriteAnimFunc_LevelSelectionMenuWalkLeft
|
||||
dw SpriteAnimFunc_LevelSelectionMenuWalkRight
|
||||
dw SpriteAnimFunc_BoardMenuBreakDie
|
||||
dw SpriteAnimFunc_BoardMenuAppearDieNumber
|
||||
dw SpriteAnimFunc_BoardMenuMoveDieNumber
|
||||
assert_table_length NUM_SPRITE_ANIM_FUNCS
|
||||
|
||||
SpriteAnimFunc_Null:
|
||||
@ -877,6 +880,15 @@ SpriteAnimFunc_LevelSelectionMenuWalkRight:
|
||||
inc [hl]
|
||||
ret
|
||||
|
||||
SpriteAnimFunc_BoardMenuBreakDie:
|
||||
ret
|
||||
|
||||
SpriteAnimFunc_BoardMenuAppearDieNumber:
|
||||
ret
|
||||
|
||||
SpriteAnimFunc_BoardMenuMoveDieNumber:
|
||||
ret
|
||||
|
||||
LevelSelectionMenuHandleTransition:
|
||||
; return carry if apply x/y displacement during this frame
|
||||
ld a, [wLevelSelectionMenuStandingStill]
|
||||
|
BIN
gfx/board/die_numbers.png
Executable file
BIN
gfx/board/die_numbers.png
Executable file
Binary file not shown.
After Width: | Height: | Size: 926 B |
2
main.asm
2
main.asm
@ -132,6 +132,7 @@ INCLUDE "engine/pokemon/print_move_description.asm"
|
||||
INCLUDE "engine/events/pokerus/pokerus.asm"
|
||||
INCLUDE "engine/battle/start_battle.asm"
|
||||
INCLUDE "engine/gfx/place_graphic.asm"
|
||||
INCLUDE "engine/battle/battle_transition.asm"
|
||||
|
||||
|
||||
SECTION "Effect Commands", ROMX
|
||||
@ -273,7 +274,6 @@ INCLUDE "engine/events/dratini.asm"
|
||||
SECTION "bank23", ROMX
|
||||
|
||||
INCLUDE "engine/tilesets/timeofday_pals.asm"
|
||||
INCLUDE "engine/battle/battle_transition.asm"
|
||||
INCLUDE "engine/events/field_moves.asm"
|
||||
INCLUDE "engine/events/magnet_train.asm"
|
||||
INCLUDE "engine/sprite_anims/core.asm"
|
||||
|
Loading…
Reference in New Issue
Block a user