Skip to content

Commit

Permalink
Label IsInWater checks
Browse files Browse the repository at this point in the history
  • Loading branch information
ElectroDeoxys committed Jun 27, 2024
1 parent fe014b5 commit b535b0d
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 17 deletions.
4 changes: 2 additions & 2 deletions src/engine/level/objects/mizuuo.asm
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ MizzouProjectileFunc:
jr nz, .asm_488b5
ld a, [wIsInWaterOrSand]
and a
jr nz, .asm_488c8
jr nz, .in_water
ld bc, Data_60740
jr .asm_4888e
.asm_4888b
Expand Down Expand Up @@ -223,7 +223,7 @@ MizzouProjectileFunc:
ld [hli], a
ret

.asm_488c8
.in_water
xor a
ld [wCurObjFlags], a
ret
Expand Down
6 changes: 4 additions & 2 deletions src/engine/level/objects/muddee.asm
Original file line number Diff line number Diff line change
Expand Up @@ -245,10 +245,11 @@ MuddeeFunc:
call Func_352b
ld a, [wIsInWaterOrSand]
and a
jr nz, .asm_557ed
jr nz, .in_water
ld bc, Data_60d40
jp ApplyObjYMovement
.asm_557ed

.in_water
xor a
ld [w1d147], a
ld de, Frameset_69dc0
Expand All @@ -259,6 +260,7 @@ MuddeeFunc:
ld [hl], a
play_sfx SFX_083
ret

.asm_55806
ld de, Frameset_69d6a
call SetObjectFramesetPtr
Expand Down
5 changes: 3 additions & 2 deletions src/engine/level/objects/pesce.asm
Original file line number Diff line number Diff line change
Expand Up @@ -1313,7 +1313,7 @@ CheeseFunc:
call Func_352b
ld a, [wIsInWaterOrSand]
and a
jr nz, .asm_5263d
jr nz, .in_water
ld hl, wCurObjFlags
bit OBJFLAG_ON_SCREEN_F, [hl]
jp nz, MoveObjectDown_Fast
Expand All @@ -1324,7 +1324,8 @@ CheeseFunc:
xor a
ld [wCurObjFlags], a
ret
.asm_5263d

.in_water
ld a, NO_ACTIONS_FOR 1
ld [wCurObjAction], a
ld hl, wCurObjFlags
Expand Down
29 changes: 18 additions & 11 deletions src/engine/level/update_objects.asm
Original file line number Diff line number Diff line change
Expand Up @@ -1942,7 +1942,7 @@ Func_62574::
ldh [hXPosLo], a
ld a, [wCurObjStateDuration]
and a
jr z, .asm_625aa
jr z, .check_collision
ld a, [hld]
ldh [hYPosHi], a
ld a, [hl]
Expand All @@ -1958,12 +1958,13 @@ Func_62574::
jp nz, Func_62d34
ld a, [wIsInWaterOrSand]
and a
jr z, .asm_625aa
jr z, .check_collision
; vanish when touching water or sand
ld a, OBJSTATE_VANISH_TOUCH
ld [wCurObjState], a
jp HomeJumpRet

.asm_625aa
.check_collision
ld a, [wCurObjCollBoxTop]
cpl
inc a
Expand Down Expand Up @@ -2023,7 +2024,7 @@ Func_62605::
ldh [hXPosLo], a
ld a, [wCurObjStateDuration]
and a
jr z, .asm_6263b
jr z, .check_collision
ld a, [hld]
ldh [hYPosHi], a
ld a, [hl]
Expand All @@ -2039,12 +2040,13 @@ Func_62605::
jp nz, Func_62e0f
ld a, [wIsInWaterOrSand]
and a
jr z, .asm_6263b
jr z, .check_collision
; vanish when touching water or sand
ld a, OBJSTATE_VANISH_TOUCH
ld [wCurObjState], a
jp HomeJumpRet

.asm_6263b
.check_collision
ld a, [wCurObjCollBoxTop]
cpl
inc a
Expand Down Expand Up @@ -2173,6 +2175,7 @@ Func_626da::
ld a, [wIsInWaterOrSand]
and a
jr z, .asm_62710
; vanish when touching water or sand
.vanish
ld a, OBJSTATE_VANISH_TOUCH
ld [wCurObjState], a
Expand Down Expand Up @@ -2235,7 +2238,7 @@ Func_62768::
ldh [hXPosLo], a
ld a, [wCurObjStateDuration]
and a
jr z, .asm_6279e
jr z, .check_collision
ld a, [hld]
ldh [hYPosHi], a
ld a, [hl]
Expand All @@ -2251,13 +2254,14 @@ Func_62768::
jp nz, Func_62e0f
ld a, [wIsInWaterOrSand]
and a
jr z, .asm_6279e
jr z, .check_collision
; vanish when touching water or sand
.vanish
ld a, OBJSTATE_VANISH_TOUCH
ld [wCurObjState], a
jp HomeJumpRet

.asm_6279e
.check_collision
ld a, [wCurObjCollBoxTop]
cpl
inc a
Expand Down Expand Up @@ -2573,6 +2577,7 @@ Func_62926::
ld a, [wIsInWaterOrSand]
and a
jp z, HomeJumpRet
; vanish when touching water or sand
ld a, OBJSTATE_VANISH_TOUCH
ld [wCurObjState], a
jp HomeJumpRet
Expand Down Expand Up @@ -2697,6 +2702,7 @@ _ObjState_StandingFall::
ld a, [wIsInWaterOrSand]
and a
jp z, HomeJumpRet
; vanish when touching water or sand
ld a, OBJSTATE_VANISH_TOUCH
ld [wCurObjState], a
jp HomeJumpRet
Expand Down Expand Up @@ -2772,6 +2778,7 @@ _ObjState_Fall::
ld a, [wIsInWaterOrSand]
and a
jp z, HomeJumpRet
; vanish when touching water or sand
ld a, OBJSTATE_VANISH_TOUCH
ld [wCurObjState], a
jp HomeJumpRet
Expand Down Expand Up @@ -3121,7 +3128,7 @@ Func_62ca8::
jr nz, Func_62d34
ld a, [wIsInWaterOrSand]
and a
jr nz, .vanish
jr nz, .vanish ; vanish when touching water or sand

ld hl, wCurObjYPos
ld a, [hli]
Expand Down Expand Up @@ -3266,7 +3273,7 @@ Func_62d86::
jr nz, Func_62e0f
ld a, [wIsInWaterOrSand]
and a
jr nz, .vanish
jr nz, .vanish ; vanish when touching water or sand

ld hl, wCurObjYPos
ld a, [hli]
Expand Down

0 comments on commit b535b0d

Please sign in to comment.