summaryrefslogtreecommitdiff
path: root/home
diff options
context:
space:
mode:
Diffstat (limited to 'home')
-rw-r--r--home/copy2.asm8
-rw-r--r--home/hp_pals.asm19
-rw-r--r--home/map_objects.asm20
3 files changed, 33 insertions, 14 deletions
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