summaryrefslogtreecommitdiff
path: root/home
diff options
context:
space:
mode:
Diffstat (limited to 'home')
-rw-r--r--home/audio.asm42
-rw-r--r--home/copy2.asm8
-rw-r--r--home/hp_pals.asm19
-rw-r--r--home/map_objects.asm20
4 files changed, 54 insertions, 35 deletions
diff --git a/home/audio.asm b/home/audio.asm
index 4b9c3a71c..05dbafa0a 100644
--- a/home/audio.asm
+++ b/home/audio.asm
@@ -249,16 +249,16 @@ WaitSFX:: ; 3c55
push hl
.wait
- ld hl, wChannel5Flags
+ ld hl, wChannel5Flags1
bit 0, [hl]
jr nz, .wait
- ld hl, wChannel6Flags
+ ld hl, wChannel6Flags1
bit 0, [hl]
jr nz, .wait
- ld hl, wChannel7Flags
+ ld hl, wChannel7Flags1
bit 0, [hl]
jr nz, .wait
- ld hl, wChannel8Flags
+ ld hl, wChannel8Flags1
bit 0, [hl]
jr nz, .wait
@@ -271,16 +271,16 @@ IsSFXPlaying:: ; 3c74
; The inverse of CheckSFX.
push hl
- ld hl, wChannel5Flags
+ ld hl, wChannel5Flags1
bit 0, [hl]
jr nz, .playing
- ld hl, wChannel6Flags
+ ld hl, wChannel6Flags1
bit 0, [hl]
jr nz, .playing
- ld hl, wChannel7Flags
+ ld hl, wChannel7Flags1
bit 0, [hl]
jr nz, .playing
- ld hl, wChannel8Flags
+ ld hl, wChannel8Flags1
bit 0, [hl]
jr nz, .playing
@@ -540,16 +540,16 @@ Unreferenced_Function3d9f:: ; 3d9f
CheckSFX:: ; 3dde
; Return carry if any SFX channels are active.
- ld a, [wChannel5Flags]
+ ld a, [wChannel5Flags1]
bit 0, a
jr nz, .playing
- ld a, [wChannel6Flags]
+ ld a, [wChannel6Flags1]
bit 0, a
jr nz, .playing
- ld a, [wChannel7Flags]
+ ld a, [wChannel7Flags1]
bit 0, a
jr nz, .playing
- ld a, [wChannel8Flags]
+ ld a, [wChannel8Flags1]
bit 0, a
jr nz, .playing
and a
@@ -561,7 +561,7 @@ CheckSFX:: ; 3dde
TerminateExpBarSound:: ; 3dfe
xor a
- ld [wChannel5Flags], a
+ ld [wChannel5Flags1], a
ld [wSoundInput], a
ld [rNR10], a
ld [rNR11], a
@@ -575,10 +575,10 @@ TerminateExpBarSound:: ; 3dfe
ChannelsOff:: ; 3e10
; Quickly turn off music channels
xor a
- ld [wChannel1Flags], a
- ld [wChannel2Flags], a
- ld [wChannel3Flags], a
- ld [wChannel4Flags], a
+ ld [wChannel1Flags1], a
+ ld [wChannel2Flags1], a
+ ld [wChannel3Flags1], a
+ ld [wChannel4Flags1], a
ld [wSoundInput], a
ret
; 3e21
@@ -586,10 +586,10 @@ ChannelsOff:: ; 3e10
SFXChannelsOff:: ; 3e21
; Quickly turn off sound effect channels
xor a
- ld [wChannel5Flags], a
- ld [wChannel6Flags], a
- ld [wChannel7Flags], a
- ld [wChannel8Flags], a
+ ld [wChannel5Flags1], a
+ ld [wChannel6Flags1], a
+ ld [wChannel7Flags1], a
+ ld [wChannel8Flags1], a
ld [wSoundInput], a
ret
; 3e32
diff --git a/home/copy2.asm b/home/copy2.asm
index 23e1eca7f..63f3cfafb 100644
--- a/home/copy2.asm
+++ b/home/copy2.asm
@@ -1,7 +1,7 @@
CopyBytes:: ; 0x3026
; copy bc bytes from hl to de
- inc b ; we bail the moment b hits 0, so include the last run
- inc c ; same thing; include last byte
+ inc b ; we bail the moment b hits 0, so include the last run
+ inc c ; same thing; include last byte
jr .HandleLoop
.CopyByte:
ld a, [hli]
@@ -39,8 +39,8 @@ SwapBytes:: ; 0x3034
ByteFill:: ; 0x3041
; fill bc bytes with the value of a, starting at hl
- inc b ; we bail the moment b hits 0, so include the last run
- inc c ; same thing; include last byte
+ inc b ; we bail the moment b hits 0, so include the last run
+ inc c ; same thing; include last byte
jr .HandleLoop
.PutByte:
ld [hli], a
diff --git a/home/hp_pals.asm b/home/hp_pals.asm
new file mode 100644
index 000000000..221b93da0
--- /dev/null
+++ b/home/hp_pals.asm
@@ -0,0 +1,19 @@
+SetHPPal:: ; 334e
+; Set palette for hp bar pixel length e at hl.
+ call GetHPPal
+ ld [hl], d
+ ret
+; 3353
+
+GetHPPal:: ; 3353
+; Get palette for hp bar pixel length e in d.
+ ld d, HP_GREEN
+ ld a, e
+ cp (HP_BAR_LENGTH_PX * 50 / 100) ; 24
+ ret nc
+ inc d ; HP_YELLOW
+ cp (HP_BAR_LENGTH_PX * 21 / 100) ; 10
+ ret nc
+ inc d ; HP_RED
+ ret
+; 335f
diff --git a/home/map_objects.asm b/home/map_objects.asm
index c99e27088..5acea7822 100644
--- a/home/map_objects.asm
+++ b/home/map_objects.asm
@@ -482,10 +482,10 @@ GetSpriteMovementFunction:: ; 1a2f
xor a
.ok
- ld hl, SpriteMovementData
+ ld hl, SpriteMovementData + SPRITEMOVEATTR_MOVEMENT
ld e, a
ld d, 0
-rept SPRITEMOVEDATA_FIELDS
+rept NUM_SPRITEMOVEDATA_FIELDS
add hl, de
endr
ld a, [hl]
@@ -497,15 +497,15 @@ GetInitialFacing:: ; 1a47
push de
ld e, a
ld d, 0
- ld hl, SpriteMovementData + 1 ; init facing
-rept SPRITEMOVEDATA_FIELDS
+ ld hl, SpriteMovementData + SPRITEMOVEATTR_FACING
+rept NUM_SPRITEMOVEDATA_FIELDS
add hl, de
endr
ld a, BANK(SpriteMovementData)
call GetFarByte
add a
add a
- and $c
+ maskbits NUM_DIRECTIONS, 2
pop de
pop bc
ret
@@ -537,8 +537,8 @@ CopySpriteMovementData:: ; 1a61
push de
ld e, a
ld d, 0
- ld hl, SpriteMovementData + 1 ; init facing
-rept SPRITEMOVEDATA_FIELDS
+ ld hl, SpriteMovementData + SPRITEMOVEATTR_FACING
+rept NUM_SPRITEMOVEDATA_FIELDS
add hl, de
endr
ld b, h
@@ -549,7 +549,7 @@ endr
inc bc
rlca
rlca
- and %00001100
+ maskbits NUM_DIRECTIONS, 2
ld hl, OBJECT_FACING
add hl, de
ld [hl], a
@@ -654,7 +654,7 @@ SetSpriteDirection:: ; 1af8
and %11110011
ld e, a
pop af
- and %00001100
+ maskbits NUM_DIRECTIONS, 2
or e
ld [hl], a
ret
@@ -664,6 +664,6 @@ GetSpriteDirection:: ; 1b07
ld hl, OBJECT_FACING
add hl, bc
ld a, [hl]
- and %00001100
+ maskbits NUM_DIRECTIONS, 2
ret
; 1b0f