Skip to content

Commit

Permalink
Label HRAM addresses and tidy hram.asm
Browse files Browse the repository at this point in the history
  • Loading branch information
ElectroDeoxys committed Jun 27, 2024
1 parent 91fcd40 commit fe014b5
Show file tree
Hide file tree
Showing 24 changed files with 302 additions and 314 deletions.
236 changes: 118 additions & 118 deletions src/data/object_groups.asm

Large diffs are not rendered by default.

50 changes: 25 additions & 25 deletions src/engine/level/block_functions.asm
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
; processes the block function of wBlockPtrBank:wBlockPtr
ProcessBlock:
xor a ; FALSE
ld [wc0dd], a
ld [wIsInWaterOrSand], a
ld a, [wBlockPtrBank]
sramswitch
ld hl, wBlockPtr
Expand Down Expand Up @@ -239,7 +239,7 @@ LeftSlopeCollision:

BlockFunc_Water:
ld a, TRUE
ld [wc0dd], a
ld [wIsInWaterOrSand], a
ld a, [wBlockFuncWarioFlag]
and a
jp z, BlockFunc_Free
Expand Down Expand Up @@ -323,7 +323,7 @@ BlockFunc_WaterSurface:
jp BlockFunc_Floor
.asm_1825a
ld a, TRUE
ld [wc0dd], a
ld [wIsInWaterOrSand], a
jp BlockFunc_Solid

BlockFunc_18262:
Expand Down Expand Up @@ -1005,7 +1005,7 @@ BlockFunc_LightSource:

BlockFunc_Sand:
ld a, TRUE
ld [wc0dd], a
ld [wIsInWaterOrSand], a
ld a, [wBlockFuncWarioFlag]
and a
jp z, BlockFunc_Free
Expand Down Expand Up @@ -1062,7 +1062,7 @@ BlockFunc_188ba:

BlockFunc_NonSubmersibleWater:
ld a, TRUE
ld [wc0dd], a
ld [wIsInWaterOrSand], a
ld a, [wBlockFuncWarioFlag]
and a
jp z, BlockFunc_Free
Expand Down Expand Up @@ -3156,13 +3156,13 @@ YarnBlockCollision:
BreakBlock:
; temporarily store hPos
ldh a, [hYPosHi]
ldh [hffad], a
ldh [hYPosHiBackup], a
ldh a, [hYPosLo]
ldh [hffae], a
ldh [hYPosLoBackup], a
ldh a, [hXPosHi]
ldh [hffaf], a
ldh [hXPosHiBackup], a
ldh a, [hXPosLo]
ldh [hffb0], a
ldh [hXPosLoBackup], a

ld b, PARTICLE_DEBRIS
farcall CreateParticleInBlock
Expand All @@ -3182,7 +3182,7 @@ BreakBlock:

; backup CurObj
ld hl, wCurObjUnk01
ld de, hffa0
ld de, hCurObjBackup
ld b, OBJ_UNK_07 - OBJ_UNK_01
call CopyHLToDE

Expand All @@ -3202,7 +3202,7 @@ BreakBlock:
farcall _CreateObjectFromCurObjPos

; restore CurObj
ld hl, hffa0
ld hl, hCurObjBackup
ld de, wCurObjUnk01
ld b, OBJ_UNK_07 - OBJ_UNK_01
call CopyHLToDE
Expand All @@ -3211,26 +3211,26 @@ BreakBlock:

.done
; restore hPos
ldh a, [hffad]
ldh a, [hYPosHiBackup]
ldh [hYPosHi], a
ldh a, [hffae]
ldh a, [hYPosLoBackup]
ldh [hYPosLo], a
ldh a, [hffaf]
ldh a, [hXPosHiBackup]
ldh [hXPosHi], a
ldh a, [hffb0]
ldh a, [hXPosLoBackup]
ldh [hXPosLo], a
ret

BreakBlockWithColourCoin:
; temporarily store hPos
ldh a, [hYPosHi]
ldh [hffad], a
ldh [hYPosHiBackup], a
ldh a, [hYPosLo]
ldh [hffae], a
ldh [hYPosLoBackup], a
ldh a, [hXPosHi]
ldh [hffaf], a
ldh [hXPosHiBackup], a
ldh a, [hXPosLo]
ldh [hffb0], a
ldh [hXPosLoBackup], a

ld b, PARTICLE_DEBRIS
farcall CreateParticleInBlock
Expand All @@ -3241,7 +3241,7 @@ BreakBlockWithColourCoin:

; backup CurObj
ld hl, wCurObjUnk01
ld de, hffa0
ld de, hCurObjBackup
ld b, OBJ_UNK_07 - OBJ_UNK_01
call CopyHLToDE

Expand All @@ -3261,20 +3261,20 @@ BreakBlockWithColourCoin:
farcall _CreateObjectFromCurObjPos

; restore CurObj
ld hl, hffa0
ld hl, hCurObjBackup
ld de, wCurObjUnk01
ld b, OBJ_UNK_07 - OBJ_UNK_01
call CopyHLToDE
pop af
ldh [rSVBK], a

; restore hPos
ldh a, [hffad]
ldh a, [hYPosHiBackup]
ldh [hYPosHi], a
ldh a, [hffae]
ldh a, [hYPosLoBackup]
ldh [hYPosLo], a
ldh a, [hffaf]
ldh a, [hXPosHiBackup]
ldh [hXPosHi], a
ldh a, [hffb0]
ldh a, [hXPosLoBackup]
ldh [hXPosLo], a
ret
24 changes: 12 additions & 12 deletions src/engine/level/object_interactions.asm
Original file line number Diff line number Diff line change
Expand Up @@ -931,13 +931,13 @@ SetState_Stung:
ld [wCollisionBoxTop], a

ldh a, [hYPosHi]
ldh [hffad], a
ldh [hYPosHiBackup], a
ldh a, [hYPosLo]
ldh [hffae], a
ldh [hYPosLoBackup], a
ldh a, [hXPosHi]
ldh [hffaf], a
ldh [hXPosHiBackup], a
ldh a, [hXPosLo]
ldh [hffb0], a
ldh [hXPosLoBackup], a

farcall CheckUpCollision
ld a, b
Expand All @@ -946,13 +946,13 @@ SetState_Stung:

xor a
ld [wIsCrouching], a
ldh a, [hffad]
ldh a, [hYPosHiBackup]
ldh [hYPosHi], a
ldh a, [hffae]
ldh a, [hYPosLoBackup]
ldh [hYPosLo], a
ldh a, [hffaf]
ldh a, [hXPosHiBackup]
ldh [hXPosHi], a
ldh a, [hffb0]
ldh a, [hXPosLoBackup]
ldh [hXPosLo], a

.asm_20774
Expand All @@ -968,13 +968,13 @@ SetState_Stung:
xor a ; JUMP_VEL_NONE
ld [wJumpVelTable], a

ldh a, [hffad]
ldh a, [hYPosHiBackup]
ldh [hYPosHi], a
ldh a, [hffae]
ldh a, [hYPosLoBackup]
ldh [hYPosLo], a
ldh a, [hffaf]
ldh a, [hXPosHiBackup]
ldh [hXPosHi], a
ldh a, [hffb0]
ldh a, [hXPosLoBackup]
ldh [hXPosLo], a

.asm_20799
Expand Down
2 changes: 1 addition & 1 deletion src/engine/level/objects/big_leaf.asm
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ BigLeaf2Func:
ld a, [hl]
ldh [hXPosHi], a
call Func_352b
ld a, [wc0dd]
ld a, [wIsInWaterOrSand]
and a
ret z
ld a, NO_ACTIONS_FOR 1
Expand Down
12 changes: 6 additions & 6 deletions src/engine/level/objects/bubble.asm
Original file line number Diff line number Diff line change
Expand Up @@ -119,8 +119,8 @@ BubbleFunc:
call Func_358b
and a
jp nz, .set_burst
ld a, [wc0dd]
ldh [hffa0], a
ld a, [wIsInWaterOrSand]
ldh [hIsInWaterOrSandBackup], a

ld hl, wCurObjYPos
ld a, [hli]
Expand All @@ -134,12 +134,12 @@ BubbleFunc:
ld a, [hli]
ldh [hXPosHi], a
call Func_358b
ld a, [wc0dd]
ld a, [wIsInWaterOrSand]
and a
ret nz
ldh a, [hffa0]
ret nz ; still underwater
ldh a, [hIsInWaterOrSandBackup]
and a
ret nz
ret nz ; still underwater
jp .set_burst

.asm_47ce0
Expand Down
6 changes: 3 additions & 3 deletions src/engine/level/objects/coin.asm
Original file line number Diff line number Diff line change
Expand Up @@ -310,7 +310,7 @@ CoinFunc:
call Func_352b
and a
jr nz, .asm_63680
ld a, [wc0dd]
ld a, [wIsInWaterOrSand]
and a
jr z, .asm_6365d
ld [wCurObjFramesetOffset], a
Expand Down Expand Up @@ -420,7 +420,7 @@ CoinFunc:
call Func_352b
and a
jr nz, .asm_63729
ld a, [wc0dd]
ld a, [wIsInWaterOrSand]
and a
jr z, .asm_63706
ld [wCurObjFramesetOffset], a
Expand Down Expand Up @@ -765,7 +765,7 @@ CoinFunc:
ld a, $12
ld [wCurObjState], a
.asm_6392d
ld a, [wc0dd]
ld a, [wIsInWaterOrSand]
and a
ret z
ld [wCurObjFramesetOffset], a
Expand Down
2 changes: 1 addition & 1 deletion src/engine/level/objects/count_richtertoffen.asm
Original file line number Diff line number Diff line change
Expand Up @@ -427,7 +427,7 @@ CountRichtertoffenFunc:
jp DoGroundShake

.continue_fall
ld a, [wc0dd]
ld a, [wIsInWaterOrSand]
and a
jp nz, VanishObject2
ld bc, Data_603e0
Expand Down
2 changes: 1 addition & 1 deletion src/engine/level/objects/haridama.asm
Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,7 @@ HaridamaFunc:
call Func_358b
and a
jr nz, .asm_490d5
ld a, [wc0dd]
ld a, [wIsInWaterOrSand]
and a
jr z, .asm_490d5
ld hl, wCurObjYPos
Expand Down
2 changes: 1 addition & 1 deletion src/engine/level/objects/hebarii.asm
Original file line number Diff line number Diff line change
Expand Up @@ -338,7 +338,7 @@ HebariiFunc:
call Func_352b
and a
jr nz, .asm_4a204
ld a, [wc0dd]
ld a, [wIsInWaterOrSand]
and a
jp nz, VanishObject2
ld bc, FallingYVel_Light
Expand Down
2 changes: 1 addition & 1 deletion src/engine/level/objects/mizuuo.asm
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ MizzouProjectileFunc:
call Func_3543
and a
jr nz, .asm_488b5
ld a, [wc0dd]
ld a, [wIsInWaterOrSand]
and a
jr nz, .asm_488c8
ld bc, Data_60740
Expand Down
6 changes: 3 additions & 3 deletions src/engine/level/objects/muddee.asm
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@ MuddeeFunc:
ld a, [hl]
ldh [hXPosHi], a
call Func_352b
ld a, [wc0dd]
ld a, [wIsInWaterOrSand]
and a
jr nz, .asm_557ed
ld bc, Data_60d40
Expand Down Expand Up @@ -381,7 +381,7 @@ MuddeeFunc:
ld a, [hli]
ldh [hXPosHi], a
call Func_352b
ld a, [wc0dd]
ld a, [wIsInWaterOrSand]
and a
jr nz, .asm_55910
call .Func_55c2b
Expand Down Expand Up @@ -761,7 +761,7 @@ MuddeeFunc:
ld a, [hli]
ldh [hXPosHi], a
call Func_352b
ld a, [wc0dd]
ld a, [wIsInWaterOrSand]
and a
jr nz, .asm_55b9a
jp MoveObjectDown_Slow
Expand Down
2 changes: 1 addition & 1 deletion src/engine/level/objects/para_goom.asm
Original file line number Diff line number Diff line change
Expand Up @@ -761,7 +761,7 @@ ParaGoomFunc:
call Func_352b
and a
jr nz, .asm_41857
ld a, [wc0dd]
ld a, [wIsInWaterOrSand]
and a
ret z
ld a, $0a
Expand Down
4 changes: 2 additions & 2 deletions src/engine/level/objects/pesce.asm
Original file line number Diff line number Diff line change
Expand Up @@ -285,7 +285,7 @@ PesceFunc:
ld a, [hli]
ldh [hXPosHi], a
call Func_358b
ld a, [wc0dd]
ld a, [wIsInWaterOrSand]
and a
jr z, .asm_51f46
ld a, [wWarioScreenYPos]
Expand Down Expand Up @@ -1311,7 +1311,7 @@ CheeseFunc:
ld a, [hl]
ldh [hXPosHi], a
call Func_352b
ld a, [wc0dd]
ld a, [wIsInWaterOrSand]
and a
jr nz, .asm_5263d
ld hl, wCurObjFlags
Expand Down
6 changes: 3 additions & 3 deletions src/engine/level/objects/pneumo.asm
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,7 @@ PneumoFunc:
jr z, .asm_45801
jr .asm_457ed
.asm_457e7
ld a, [wc0dd]
ld a, [wIsInWaterOrSand]
and a
jr nz, .asm_45801
.asm_457ed
Expand Down Expand Up @@ -478,7 +478,7 @@ PneumoFunc:
ld a, [wWarioYPos + 1]
and $fc
ld l, a
ld de, hffb0
ld de, hXPosLoBackup
add hl, de
ld d, h
ld e, l
Expand Down Expand Up @@ -528,7 +528,7 @@ PneumoFunc:
jp nz, MoveObjectDown_Slow
jp .Func_456fe
.asm_4599f
ld a, [wc0dd]
ld a, [wIsInWaterOrSand]
and a
jp z, MoveObjectDown
jp .Func_456fe
Loading

0 comments on commit fe014b5

Please sign in to comment.