mirror of
https://gitlab.com/xCrystal/pokecrystal-board.git
synced 2024-11-16 11:27:33 -08:00
Effects of branch space [Commit 1] (#28)
This commit is contained in:
parent
884e4bdc63
commit
a52e7f4df5
@ -190,3 +190,4 @@ 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 ; max(BOARD_MENU_ITEM_SIZE * NUM_BOARD_MENU_ITEMS, DIE_SIZE * 10)
|
||||
DEF DIE_NUMBERS_OAM_FIRST_TILE EQU BOARD_MENU_OAM_FIRST_TILE
|
||||
DEF BRANCH_ARROWS_OAM_FIRST_TILE EQU DIE_NUMBERS_OAM_FIRST_TILE + 40 ; DIE_NUMBER_SIZE * 10
|
||||
|
@ -123,6 +123,7 @@ DEF COLL_UP_LEFT_BUOY EQU $c7 ; unused
|
||||
const COLL_MINIGAME_SPACE ; $d5
|
||||
const COLL_END_SPACE ; $d6
|
||||
const COLL_GREY_SPACE ; $d7
|
||||
const COLL_BRANCH_SPACE ; $d8
|
||||
DEF NUM_COLL_SPACES EQU const_value - $d0
|
||||
DEF COLL_FF EQU $ff ; garbage
|
||||
|
||||
|
@ -11,6 +11,7 @@ DEF AUTO_INPUT EQU $ff
|
||||
const SECONDARYSPRITES_BOARD_MENU_F ; 0
|
||||
const SECONDARYSPRITES_DIE_ROLL_F ; 1
|
||||
const SECONDARYSPRITES_SPACES_LEFT_F ; 2
|
||||
const SECONDARYSPRITES_BRANCH_ARROWS_F ; 3
|
||||
|
||||
; wCurDexMode::
|
||||
const_def
|
||||
|
@ -113,3 +113,10 @@ SpacesLeftNumberOAM:
|
||||
dbsprite 2, 3, 4, 4, DIE_NUMBERS_OAM_FIRST_TILE + 11, PAL_OW_MISC
|
||||
dbsprite 1, 4, 4, 4, DIE_NUMBERS_OAM_FIRST_TILE + 30, PAL_OW_MISC
|
||||
dbsprite 2, 4, 4, 4, DIE_NUMBERS_OAM_FIRST_TILE + 31, PAL_OW_MISC
|
||||
|
||||
BranchArrowsOAM:
|
||||
; the PAL_ argument is unused (actual palette comes from the player gender)
|
||||
dbsprite 10, 7, 4, 0, BRANCH_ARROWS_OAM_FIRST_TILE, PAL_OW_RED ; right
|
||||
dbsprite 8, 7, 4, 0, BRANCH_ARROWS_OAM_FIRST_TILE + 1, PAL_OW_RED ; left
|
||||
dbsprite 9, 6, 4, 0, BRANCH_ARROWS_OAM_FIRST_TILE + 2, PAL_OW_RED ; up
|
||||
dbsprite 9, 8, 4, 0, BRANCH_ARROWS_OAM_FIRST_TILE + 3, PAL_OW_RED ; down
|
||||
|
@ -341,11 +341,11 @@ $~~~~$<c>then always returns PLAYERMOVEMENT_FINISH but often is overwritten by c
|
||||
|
||||
- **hCurBoardEvent**: holds a *BOARDEVENT_* value.
|
||||
|
||||
- **wTurnData** ~ **wTurnDataEnd**: not preserved on save, and cleared at the beginning of BoardMenuScript (i.e. on turn begin). It's part of *wMapStatus* ~ *wMapStatusEnd*, so it's also cleared by *StartMap*.
|
||||
- **wTurnData** ~ **wTurnDataEnd**: not preserved on save, and cleared at the beginning of BoardMenuScript (i.e. on turn begin). It's part of *wMapStatus* ~ *wMapStatusEnd*, so it's also cleared by *StartMap*. Includes:
|
||||
- **wDieRoll**
|
||||
- **wSpacesLeft**
|
||||
|
||||
- Addresses within *wCurMapData* ~ *wCurMapDataEnd*: preserved on save.
|
||||
- Addresses within *wCurMapData* ~ *wCurMapDataEnd*: preserved on save. Includes:
|
||||
- **wCurTurn**
|
||||
- **wCurSpace**
|
||||
- **wCurSpaceStruct**:
|
||||
|
@ -3,6 +3,7 @@ BoardSpaceScripts:: ; used only for BANK(BoardSpaceScripts)
|
||||
BlueSpaceScript::
|
||||
scall ArriveToRegularSpaceScript
|
||||
iftrue .not_landed
|
||||
wait 400
|
||||
scall LandedInRegularSpaceScript
|
||||
.not_landed
|
||||
end
|
||||
@ -10,6 +11,7 @@ BlueSpaceScript::
|
||||
RedSpaceScript::
|
||||
scall ArriveToRegularSpaceScript
|
||||
iftrue .not_landed
|
||||
wait 400
|
||||
scall LandedInRegularSpaceScript
|
||||
.not_landed
|
||||
end
|
||||
@ -17,6 +19,7 @@ RedSpaceScript::
|
||||
GreenSpaceScript::
|
||||
scall ArriveToRegularSpaceScript
|
||||
iftrue .not_landed
|
||||
wait 400
|
||||
scall LandedInRegularSpaceScript
|
||||
.not_landed
|
||||
end
|
||||
@ -24,6 +27,7 @@ GreenSpaceScript::
|
||||
ItemSpaceScript::
|
||||
scall ArriveToRegularSpaceScript
|
||||
iftrue .not_landed
|
||||
wait 400
|
||||
scall LandedInRegularSpaceScript
|
||||
.not_landed
|
||||
end
|
||||
@ -31,6 +35,7 @@ ItemSpaceScript::
|
||||
PokemonSpaceScript::
|
||||
scall ArriveToRegularSpaceScript
|
||||
iftrue .not_landed
|
||||
wait 600
|
||||
loadpikachudata
|
||||
startbattle
|
||||
reloadmapafterbattle
|
||||
@ -42,6 +47,7 @@ PokemonSpaceScript::
|
||||
MinigameSpaceScript::
|
||||
scall ArriveToRegularSpaceScript
|
||||
iftrue .not_landed
|
||||
wait 600
|
||||
scall LandedInRegularSpaceScript
|
||||
.not_landed
|
||||
end
|
||||
@ -76,9 +82,6 @@ GreySpaceScript::
|
||||
ArriveToRegularSpaceScript:
|
||||
playsound SFX_PRESENT
|
||||
callasm ArriveToRegularSpace
|
||||
iftrue .not_landed
|
||||
wait 600
|
||||
.not_landed
|
||||
end
|
||||
|
||||
ArriveToRegularSpace:
|
||||
@ -121,3 +124,31 @@ LandedInRegularSpace:
|
||||
ld a, BOARDEVENT_END_TURN
|
||||
ldh [hCurBoardEvent], a
|
||||
ret
|
||||
|
||||
BranchSpaceScript::
|
||||
scall .ArriveToBranchSpaceScript
|
||||
end
|
||||
|
||||
.ArriveToBranchSpaceScript:
|
||||
playsound SFX_TWINKLE
|
||||
wait 400
|
||||
callasm .ArriveToBranchSpace
|
||||
end
|
||||
|
||||
.ArriveToBranchSpace:
|
||||
; load new space
|
||||
ld a, [wCurSpaceNextSpace]
|
||||
ld [wCurSpace], a
|
||||
call LoadCurSpaceData
|
||||
; load its branch data
|
||||
call LoadTempSpaceBranchData
|
||||
call .DisableDirectionsRequiringLockedTechniques
|
||||
; draw arrows for valid directions
|
||||
farcall LoadBranchArrowsGFX
|
||||
ld hl, wDisplaySecondarySprites
|
||||
set SECONDARYSPRITES_BRANCH_ARROWS_F, [hl]
|
||||
; update sprites
|
||||
jp UpdateActiveSprites
|
||||
|
||||
.DisableDirectionsRequiringLockedTechniques:
|
||||
ret
|
||||
|
@ -38,3 +38,13 @@ LoadBoardMenuDieNumbersGFX::
|
||||
|
||||
.DieNumbersOAMGFX:
|
||||
INCBIN "gfx/board/die_numbers.2bpp"
|
||||
|
||||
LoadBranchArrowsGFX::
|
||||
ld de, .BranchArrowsOAMGFX
|
||||
ld hl, vTiles0 + BRANCH_ARROWS_OAM_FIRST_TILE * LEN_2BPP_TILE
|
||||
lb bc, BANK(.BranchArrowsOAMGFX), NUM_DIRECTIONS
|
||||
call Get2bppViaHDMA
|
||||
ret
|
||||
|
||||
.BranchArrowsOAMGFX:
|
||||
INCBIN "gfx/board/branch_arrows.2bpp"
|
||||
|
@ -384,6 +384,7 @@ CheckBoardEvent:
|
||||
dw MinigameSpaceScript ; COLL_MINIGAME_SPACE
|
||||
dw EndSpaceScript ; COLL_END_SPACE
|
||||
dw GreySpaceScript ; COLL_GREY_SPACE
|
||||
dw BranchSpaceScript ; COLL_BRANCH_SPACE
|
||||
assert_table_length NUM_COLL_SPACES
|
||||
|
||||
CheckTrainerEvent:
|
||||
|
@ -3113,9 +3113,11 @@ InitSecondarySprites:
|
||||
bit SECONDARYSPRITES_BOARD_MENU_F, a
|
||||
call nz, InitBoardMenuSprites
|
||||
bit SECONDARYSPRITES_DIE_ROLL_F, a
|
||||
call nz, InitRollDieSprites
|
||||
call nz, InitDieRollSprites
|
||||
bit SECONDARYSPRITES_SPACES_LEFT_F, a
|
||||
call nz, InitSpacesLeftNumberSprites
|
||||
bit SECONDARYSPRITES_BRANCH_ARROWS_F, a
|
||||
call nz, InitBranchArrowsSprites
|
||||
ret
|
||||
|
||||
InitBoardMenuSprites:
|
||||
@ -3143,7 +3145,7 @@ InitBoardMenuSprites:
|
||||
pop af
|
||||
ret
|
||||
|
||||
InitRollDieSprites:
|
||||
InitDieRollSprites:
|
||||
push af
|
||||
|
||||
ld a, [wDieRoll]
|
||||
@ -3197,4 +3199,55 @@ InitSpacesLeftNumberSprites:
|
||||
pop af
|
||||
ret
|
||||
|
||||
InitBranchArrowsSprites:
|
||||
push af
|
||||
|
||||
; find the beginning of free space in OAM, and assure there's space for 4 objects
|
||||
ldh a, [hUsedSpriteIndex]
|
||||
cp (NUM_SPRITE_OAM_STRUCTS * SPRITEOAMSTRUCT_LENGTH) - (NUM_DIRECTIONS * SPRITEOAMSTRUCT_LENGTH) + 1
|
||||
jr nc, .oam_full
|
||||
|
||||
ld hl, BranchArrowsOAM
|
||||
ld de, wTempSpaceBranchStruct
|
||||
ld c, NUM_DIRECTIONS
|
||||
.loop
|
||||
ld a, [de]
|
||||
cp -1 ;
|
||||
jr z, .next1 ; skip this arrow if this direction is not valid
|
||||
|
||||
; draw this arrow and advance hUsedSpriteIndex
|
||||
; preserve loop variables d, e, c
|
||||
push de
|
||||
push bc
|
||||
ldh a, [hUsedSpriteIndex]
|
||||
ld e, a
|
||||
ld d, HIGH(wShadowOAM)
|
||||
; copy all bytes minus the attributes one
|
||||
; the palette matches the player's color palette
|
||||
ld bc, SPRITEOAMSTRUCT_LENGTH - 1
|
||||
call CopyBytes
|
||||
gender_to_pal
|
||||
ld [de], a
|
||||
inc de
|
||||
ld a, e
|
||||
ldh [hUsedSpriteIndex], a
|
||||
pop bc
|
||||
pop de
|
||||
jr .next2
|
||||
|
||||
.next1
|
||||
inc hl ;
|
||||
inc hl ;
|
||||
inc hl ;
|
||||
|
||||
.next2
|
||||
inc hl ; next object in BranchArrowsOAM
|
||||
inc de
|
||||
dec c
|
||||
jr nz, .loop
|
||||
|
||||
.oam_full
|
||||
pop af
|
||||
ret
|
||||
|
||||
INCLUDE "data/sprites/secondary_sprites.asm"
|
||||
|
BIN
gfx/board/branch_arrows.png
Executable file
BIN
gfx/board/branch_arrows.png
Executable file
Binary file not shown.
After Width: | Height: | Size: 238 B |
11
home/map.asm
11
home/map.asm
@ -2318,3 +2318,14 @@ LoadSpaceData::
|
||||
pop de
|
||||
ld a, [wMapScriptsBank]
|
||||
jp FarCopyBytes
|
||||
|
||||
; load the branch data of the space at wCurSpaceStruct to wTempSpaceBranchStruct
|
||||
LoadTempSpaceBranchData::
|
||||
ld hl, wCurSpaceBranchStructPtr
|
||||
ld a, [hli]
|
||||
ld h, [hl]
|
||||
ld l, a
|
||||
ld de, wTempSpaceBranchStruct
|
||||
ld bc, wTempSpaceBranchStructEnd - wTempSpaceBranchStruct
|
||||
ld a, [wMapScriptsBank]
|
||||
jp FarCopyBytes
|
||||
|
@ -410,6 +410,7 @@ ENDM
|
||||
MACRO space_struct
|
||||
\1XCoord:: db
|
||||
\1YCoord:: db
|
||||
\1BranchStructPtr:: ; dw
|
||||
\1Effect:: db
|
||||
\1NextSpace:: db
|
||||
ENDM
|
||||
|
@ -1680,6 +1680,8 @@ wStringBuffer5:: ds STRING_BUFFER_LENGTH
|
||||
NEXTU
|
||||
wTempSpaceStruct:: space_struct wTempSpace
|
||||
wTempSpaceStructEnd::
|
||||
wTempSpaceBranchStruct:: ds NUM_DIRECTIONS * 2
|
||||
wTempSpaceBranchStructEnd::
|
||||
ENDU
|
||||
|
||||
wBattleMenuCursorPosition::
|
||||
|
Loading…
Reference in New Issue
Block a user