Effects of branch (and union) space [Commit 2] (#28)

This commit is contained in:
xCrystal
2023-10-28 19:09:58 +02:00
parent a13558aeb2
commit 29f98ccb8c
15 changed files with 104 additions and 16 deletions

View File

@@ -127,6 +127,8 @@ LandedInRegularSpace:
BranchSpaceScript::
scall .ArriveToBranchSpaceScript
callasm .PromptPlayerToChooseDirection
wait 200
end
.ArriveToBranchSpaceScript:
@@ -152,3 +154,63 @@ BranchSpaceScript::
.DisableDirectionsRequiringLockedTechniques:
ret
.PromptPlayerToChooseDirection:
; compute available directions in b as joypad dpad flags
ld hl, wTempSpaceBranchStruct
ld b, 0
ld a, [hli]
cp -1
jr z, .not_right
set D_RIGHT_F, b
.not_right
ld a, [hli]
cp -1
jr z, .not_left
set D_LEFT_F, b
.not_left
ld a, [hli]
cp -1
jr z, .not_up
set D_UP_F, b
.not_up
ld a, [hli]
cp -1
jr z, .joypad_loop
set D_DOWN_F, b
; sample input of an available direction
.joypad_loop
call GetJoypad
ldh a, [hJoyPressed]
and b
jr z, .joypad_loop
; load the next space for the chosen direction
ld hl, wTempSpaceBranchStruct
bit D_RIGHT_F, a
jr nz, .ok
inc hl
bit D_LEFT_F, a
jr nz, .ok
inc hl
bit D_UP_F, a
jr nz, .ok
inc hl
.ok
ld a, [hl]
ld [wCurSpaceNextSpace], a
ld hl, wDisplaySecondarySprites
res SECONDARYSPRITES_BRANCH_ARROWS_F, [hl]
jp PlayClickSFX
UnionSpaceScript::
callasm .ArriveToUnionSpace
end
.ArriveToUnionSpace:
; these are just transition spaces, so simply load the next space
ld a, [wCurSpaceNextSpace]
ld [wCurSpace], a
call LoadCurSpaceData
end

View File

@@ -385,6 +385,7 @@ CheckBoardEvent:
dw EndSpaceScript ; COLL_END_SPACE
dw GreySpaceScript ; COLL_GREY_SPACE
dw BranchSpaceScript ; COLL_BRANCH_SPACE
dw UnionSpaceScript ; COLL_UNION_SPACE
assert_table_length NUM_COLL_SPACES
CheckTrainerEvent: