Skip to content

Commit

Permalink
Fix grotto exit on route36 player standing on grass
Browse files Browse the repository at this point in the history
Reference Rangi42#905
  • Loading branch information
vulcandth committed Aug 4, 2024
1 parent ea84c7b commit f35de2e
Show file tree
Hide file tree
Showing 5 changed files with 38 additions and 1 deletion.
1 change: 1 addition & 0 deletions data/maps/setup_script_pointers.asm
Original file line number Diff line number Diff line change
Expand Up @@ -59,3 +59,4 @@ MapSetupCommands:
add_mapsetup SetCurrentWeather ; 34
add_mapsetup MapConnOWFadePalettesInit ; 35
add_mapsetup LoadMapObjects_Connection ; 36
add_mapsetup GrottoUpdatePlayerTallGrassFlags ; 37
2 changes: 2 additions & 0 deletions data/maps/setup_scripts.asm
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ MapSetupScript_Warp:
mapsetup DecompressMetatiles
mapsetup LoadMapTimeOfDay
mapsetup LoadMapObjects
mapsetup GrottoUpdatePlayerTallGrassFlags
mapsetup EnableLCD
mapsetup LoadMapPalettes
mapsetup SpawnInFacingDown
Expand Down Expand Up @@ -130,6 +131,7 @@ MapSetupScript_Train:
mapsetup FadeOutMapMusic
mapsetup EnableLCD
mapsetup LoadMapObjects
mapsetup GrottoUpdatePlayerTallGrassFlags
mapsetup LoadMapPalettes
mapsetup EnableDynPalUpdatesNoApply
mapsetup RefreshMapSprites
Expand Down
18 changes: 18 additions & 0 deletions engine/overworld/map_objects.asm
Original file line number Diff line number Diff line change
Expand Up @@ -245,6 +245,24 @@ CopyCurCoordsToNextCoords:
ld [hl], a
ret

GrottoUpdatePlayerTallGrassFlags::
ld a, [wGrottoExit]
and a
ret z
xor a
ld [wGrottoExit], a
ld bc, wPlayerStruct
ld hl, OBJECT_MAP_X
add hl, bc
ld d, [hl]
ld hl, OBJECT_MAP_Y
add hl, bc
ld e, [hl]
push bc
call GetCoordTileCollision
pop bc
jr SetTallGrassFlags

UpdateTallGrassFlags:
ld hl, OBJECT_FLAGS2
add hl, bc
Expand Down
14 changes: 14 additions & 0 deletions home/map.asm
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,20 @@ CopyWarpData::
ld a, [hli]
cp $ff
jr nz, .skip
ld a, [wMapGroup]
assert GROUP_HIDDEN_TREE_GROTTO == GROUP_HIDDEN_CAVE_GROTTO
cp GROUP_HIDDEN_TREE_GROTTO
jr nz, .not_grotto
ld a, [wMapNumber]
cp MAP_HIDDEN_TREE_GROTTO
jr z, .is_grotto
cp MAP_HIDDEN_CAVE_GROTTO
jr nz, .not_grotto
.is_grotto
; set grotto exit flag
ld a, TRUE
ld [wGrottoExit], a
.not_grotto
ld hl, wBackupWarpNumber
ld a, [hli]

Expand Down
4 changes: 3 additions & 1 deletion ram/wramx.asm
Original file line number Diff line number Diff line change
Expand Up @@ -1179,7 +1179,9 @@ wNeededPalIndex:: db

wEmotePal:: db

ds 70 ; unused
wGrottoExit:: db

ds 69 ; unused

wWingAmounts::
wHealthWingAmount:: dw
Expand Down

0 comments on commit f35de2e

Please sign in to comment.