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

@ -124,6 +124,7 @@ DEF COLL_UP_LEFT_BUOY EQU $c7 ; unused
const COLL_END_SPACE ; $d6 const COLL_END_SPACE ; $d6
const COLL_GREY_SPACE ; $d7 const COLL_GREY_SPACE ; $d7
const COLL_BRANCH_SPACE ; $d8 const COLL_BRANCH_SPACE ; $d8
const COLL_UNION_SPACE ; $d9
DEF NUM_COLL_SPACES EQU const_value - $d0 DEF NUM_COLL_SPACES EQU const_value - $d0
DEF COLL_FF EQU $ff ; garbage DEF COLL_FF EQU $ff ; garbage

View File

@ -217,8 +217,8 @@ TileCollisionTable::
db LAND_TILE ; COLL_MINIGAME_SPACE db LAND_TILE ; COLL_MINIGAME_SPACE
db LAND_TILE ; COLL_END_SPACE db LAND_TILE ; COLL_END_SPACE
db LAND_TILE ; COLL_GREY_SPACE db LAND_TILE ; COLL_GREY_SPACE
db LAND_TILE ; d8 db LAND_TILE ; COLL_BRANCH_SPACE
db LAND_TILE ; d9 db LAND_TILE ; COLL_UNION_SPACE
db LAND_TILE ; da db LAND_TILE ; da
db LAND_TILE ; db db LAND_TILE ; db
db LAND_TILE ; dc db LAND_TILE ; dc

View File

@ -116,7 +116,7 @@ SpacesLeftNumberOAM:
BranchArrowsOAM: BranchArrowsOAM:
; the PAL_ argument is unused (actual palette comes from the player gender) ; 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 11, 10, 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 7, 10, 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 + 2, PAL_OW_RED ; up
dbsprite 9, 8, 4, 0, BRANCH_ARROWS_OAM_FIRST_TILE + 3, PAL_OW_RED ; down dbsprite 9, 12, 4, 0, BRANCH_ARROWS_OAM_FIRST_TILE + 3, PAL_OW_RED ; down

View File

@ -67,7 +67,7 @@
tilecoll WALL, WALL, FLOOR, WALL ; 42 tilecoll WALL, WALL, FLOOR, WALL ; 42
tilecoll WATER, WATER, WATER, WATER ; 43 tilecoll WATER, WATER, WATER, WATER ; 43
tilecoll WALL, FLOOR, WALL, FLOOR ; 44 tilecoll WALL, FLOOR, WALL, FLOOR ; 44
tilecoll WALL, FLOOR, FLOOR, FLOOR ; 45 tilecoll FLOOR, FLOOR, FLOOR, FLOOR ; 45
tilecoll FLOOR, WALL, FLOOR, WALL ; 46 tilecoll FLOOR, WALL, FLOOR, WALL ; 46
tilecoll FLOOR, FLOOR, FLOOR, WALL ; 47 tilecoll FLOOR, FLOOR, FLOOR, WALL ; 47
tilecoll WALL, FLOOR, WALL, WALL ; 48 tilecoll WALL, FLOOR, WALL, WALL ; 48
@ -124,8 +124,8 @@
tilecoll WALL, WALL, WALL, WALL ; 7b tilecoll WALL, WALL, WALL, WALL ; 7b
tilecoll WALL, WALL, WALL, WALL ; 7c tilecoll WALL, WALL, WALL, WALL ; 7c
tilecoll WALL, WALL, WALL, WALL ; 7d tilecoll WALL, WALL, WALL, WALL ; 7d
tilecoll WALL, WALL, WALL, WALL ; 7e tilecoll BRANCH_SPACE, FLOOR, FLOOR, FLOOR ; 7e
tilecoll WALL, WALL, WALL, WALL ; 7f tilecoll UNION_SPACE, FLOOR, FLOOR, FLOOR ; 7f
tilecoll BLUE_SPACE, FLOOR, FLOOR, FLOOR ; 80 tilecoll BLUE_SPACE, FLOOR, FLOOR, FLOOR ; 80
tilecoll BLUE_SPACE, FLOOR, FLOOR, FLOOR ; 81 tilecoll BLUE_SPACE, FLOOR, FLOOR, FLOOR ; 81
tilecoll BLUE_SPACE, FLOOR, FLOOR, FLOOR ; 82 tilecoll BLUE_SPACE, FLOOR, FLOOR, FLOOR ; 82

View File

@ -127,6 +127,8 @@ LandedInRegularSpace:
BranchSpaceScript:: BranchSpaceScript::
scall .ArriveToBranchSpaceScript scall .ArriveToBranchSpaceScript
callasm .PromptPlayerToChooseDirection
wait 200
end end
.ArriveToBranchSpaceScript: .ArriveToBranchSpaceScript:
@ -152,3 +154,63 @@ BranchSpaceScript::
.DisableDirectionsRequiringLockedTechniques: .DisableDirectionsRequiringLockedTechniques:
ret 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 EndSpaceScript ; COLL_END_SPACE
dw GreySpaceScript ; COLL_GREY_SPACE dw GreySpaceScript ; COLL_GREY_SPACE
dw BranchSpaceScript ; COLL_BRANCH_SPACE dw BranchSpaceScript ; COLL_BRANCH_SPACE
dw UnionSpaceScript ; COLL_UNION_SPACE
assert_table_length NUM_COLL_SPACES assert_table_length NUM_COLL_SPACES
CheckTrainerEvent: CheckTrainerEvent:

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.6 KiB

After

Width:  |  Height:  |  Size: 2.2 KiB

View File

@ -26,7 +26,7 @@
tilepal 1, RED, RED, YELLOW, YELLOW, GRAY, GRAY, GRAY, GRAY tilepal 1, RED, RED, YELLOW, YELLOW, GRAY, GRAY, GRAY, GRAY
tilepal 1, WATER, WATER, RED, RED, GREEN, GREEN, BROWN, BROWN tilepal 1, WATER, WATER, RED, RED, GREEN, GREEN, BROWN, BROWN
tilepal 1, RED, RED, YELLOW, YELLOW, GRAY, GRAY, GRAY, GRAY tilepal 1, RED, RED, YELLOW, YELLOW, GRAY, GRAY, GRAY, GRAY
tilepal 1, RED, RED, RED, RED, BROWN, BROWN, BROWN, BROWN
tilepal 1, BROWN, BROWN, BROWN, BROWN, BROWN, BROWN, BROWN, BROWN tilepal 1, BROWN, BROWN, BROWN, BROWN, BROWN, BROWN, BROWN, BROWN
tilepal 1, BROWN, BROWN, BROWN, BROWN, BROWN, BROWN, BROWN, BROWN tilepal 1, RED, RED, RED, RED, BROWN, BROWN, BROWN, BROWN
tilepal 1, BROWN, BROWN, BROWN, BROWN, BROWN, BROWN, BROWN, BROWN
tilepal 1, BROWN, BROWN, BROWN, BROWN, BROWN, BROWN, BROWN, BROWN tilepal 1, BROWN, BROWN, BROWN, BROWN, BROWN, BROWN, BROWN, BROWN

Binary file not shown.

Before

Width:  |  Height:  |  Size: 384 B

After

Width:  |  Height:  |  Size: 390 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 244 B

After

Width:  |  Height:  |  Size: 424 B

View File

@ -1,4 +1,4 @@
tilepal 1, YELLOW, YELLOW, GREEN, GREEN, BROWN, BROWN, GRAY, GRAY tilepal 1, RED, RED, RED, RED, BROWN, BROWN, GRAY, GRAY
tilepal 1, GRAY, GRAY, GRAY, GRAY, GRAY, GRAY, GRAY, GRAY tilepal 1, GRAY, GRAY, GRAY, GRAY, GRAY, GRAY, GRAY, GRAY
tilepal 1, YELLOW, YELLOW, GREEN, GREEN, BROWN, BROWN, GRAY, GRAY tilepal 1, RED, RED, RED, RED, BROWN, BROWN, GRAY, GRAY
tilepal 1, GRAY, GRAY, GRAY, GRAY, GRAY, GRAY, GRAY, GRAY tilepal 1, GRAY, GRAY, GRAY, GRAY, GRAY, GRAY, GRAY, GRAY

View File

@ -134,9 +134,17 @@ ENDM
MACRO space MACRO space
;\1: x coord ;\1: x coord
;\2: y coord ;\2: y coord
; [non-branch space]
;\3: effect (space type specific) ;\3: effect (space type specific)
;\4: next space ;\4: next space
db \1, \2, \3, \4 ; [branch space]
;\3: pointer to branch struct
db \1, \2
if _NARG == 4
db \3, \4
else
dw \3
endc
ENDM ENDM
MACRO trainer MACRO trainer

View File

@ -19,12 +19,14 @@ DebugLevel5_Map1_MapEvents:
DebugLevel5_Map1_MapSpaces: DebugLevel5_Map1_MapSpaces:
space 2, 4, $0, 1 ; 0 space 2, 4, $0, 1 ; 0
space 4, 4, $0, 2 ; 1 space 4, 4, $0, 2 ; 1
space 6, 4, $0, 3 ; 2 space 6, 4, .BranchDataSpace2 ; 2
space 8, 4, $0, 4 ; 3 space 8, 4, $0, 4 ; 3
space 10, 4, $0, 5 ; 4 space 10, 4, $0, 5 ; 4
space 12, 4, $0, 6 ; 5 space 12, 4, $0, 6 ; 5
space 14, 4, $0, 7 ; 6 space 14, 4, $0, 7 ; 6
space 16, 4, $0, 8 ; 7 space 16, 4, $0, 8 ; 7
space 18, 4, $0, 9 ; 8 space 18, 4, $0, 9 ; 8
space 20, 4, $0, 10 ; 9 space 20, 4, $0, 10 ; 9
space 22, 4, $0, 11 ; 10 space 22, 4, $0, 11 ; 10
@ -52,3 +54,17 @@ DebugLevel5_Map1_MapSpaces:
space 10, 8, $0, 33 ; 32 space 10, 8, $0, 33 ; 32
space 12, 8, $0, 34 ; 33 space 12, 8, $0, 34 ; 33
space 14, 8, $0, 34 ; 34 space 14, 8, $0, 34 ; 34
space 6, 2, $0, 36 ; 35
space 6, 0, $0, 37 ; 36
space 8, 0, $0, 38 ; 37
space 10, 0, $0, 39 ; 38
space 12, 0, $0, 40 ; 39
space 14, 0, $0, 41 ; 40
space 16, 0, $0, 42 ; 41
space 16, 2, $0, 43 ; 42
space 16, 4, $0, 8 ; 43
.BranchDataSpace2:
db 3, -1, 35, -1
db 0, 0, 0, 0

View File

@ -1 +1 @@
ÿ€€Â€°Ã<C2B0>¡±¡¡¡À€°€À<02>¡°Á€€€Â°Ã<C2B0>¡±¡¡ €Ã€°Â<EFBFBD>°¡ÿ€~€°Ã¡±¡¡¡À€°€À<02>¡°Á€€€Â°Ã<C2B0>¡±¡¡