diff options
-rwxr-xr-x | engine/items.asm | 8 | ||||
-rwxr-xr-x | engine/pack.asm | 4 | ||||
-rw-r--r-- | home.asm | 38 | ||||
-rwxr-xr-x | home/hp_pals.asm | 17 | ||||
-rw-r--r-- | home/item.asm | 24 | ||||
-rwxr-xr-x | items/item_effects.asm | 2 | ||||
-rw-r--r-- | wram.asm | 1 |
7 files changed, 54 insertions, 40 deletions
diff --git a/engine/items.asm b/engine/items.asm index 7d69c933..deafa60c 100755 --- a/engine/items.asm +++ b/engine/items.asm @@ -1,4 +1,4 @@ -ReceiveItem_:: ; d1e2 (3:51e2) +_ReceiveItem:: ; d1e2 (3:51e2) call CheckBagOrPC jp nz, PutItemInPocketOrPC push hl @@ -38,7 +38,7 @@ ReceiveTMHM: call GetTMHMNumber jp PutItemInTMPocket -TossItem_:: ; d21a (3:521a) +_TossItem:: ; d21a (3:521a) call CheckBagOrPC jr nz, remove_item_from_bag_or_pc push hl @@ -79,7 +79,7 @@ RemoveNormalItem: remove_item_from_bag_or_pc jp RemoveItemAndQuantity -CheckItem_:: ; d251 (3:5251) +_CheckItem:: ; d251 (3:5251) call CheckBagOrPC jr nz, check_item_in_bag_or_pc push hl @@ -473,7 +473,7 @@ GetNumberedTM: ld c, a ret -CheckTossableItem_:: ; d434 (3:5434) +_CheckTossableItem:: ; d434 (3:5434) ld a, $4 call GetItemAttr bit 7, a diff --git a/engine/pack.asm b/engine/pack.asm index 210cb9b2..23a17c36 100755 --- a/engine/pack.asm +++ b/engine/pack.asm @@ -120,7 +120,7 @@ Pack_TMHMPocketMenu: ld c, $1 call Function10cef ret c - farcall CheckTossableItem_ + farcall _CheckTossableItem ld a, [wItemAttributeParamBuffer] and a jr nz, .asm_1053a @@ -228,7 +228,7 @@ Pack_BallsPocketMenu: ret Function105f5: ; 105f5 (4:45f5) - farcall CheckTossableItem_ + farcall _CheckTossableItem ld a, [wItemAttributeParamBuffer] and a jr nz, .asm_10629 @@ -217,40 +217,30 @@ CallPointerAt:: INCLUDE "home/queue_script.asm" INCLUDE "home/compare.asm" INCLUDE "home/tilemap.asm" - -SetHPPal:: - call GetHPPal - ld [hl], d - ret - -GetHPPal:: ; 3596 (0:3596) - ld d, $0 - ld a, e - cp $18 - ret nc - inc d - cp $a - ret nc - inc d - ret +INCLUDE "home/hp_pals.asm" CountSetBits:: - ld c, $0 -.asm_35a4 +; Count the number of set bits in b bytes starting from hl. +; Return in a, c and [wNumSetBits]. + ld c, 0 +.next ld a, [hli] ld e, a - ld d, $8 -.asm_35a8 + ld d, 8 + +.count srl e - ld a, $0 + ld a, 0 adc c ld c, a dec d - jr nz, .asm_35a8 + jr nz, .count + dec b - jr nz, .asm_35a4 + jr nz, .next + ld a, c - ld [wd151], a + ld [wNumSetBits], a ret GetWeekday:: diff --git a/home/hp_pals.asm b/home/hp_pals.asm new file mode 100755 index 00000000..f8c51b4f --- /dev/null +++ b/home/hp_pals.asm @@ -0,0 +1,17 @@ +SetHPPal:: +; Set palette for hp bar pixel length e at hl. + call GetHPPal + ld [hl], d + ret + +GetHPPal:: +; 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
\ No newline at end of file diff --git a/home/item.asm b/home/item.asm index d443c281..3c1d3357 100644 --- a/home/item.asm +++ b/home/item.asm @@ -1,12 +1,12 @@ DoItemEffect:: - farcall DoItemEffect_ + farcall _DoItemEffect ret CheckTossableItem:: push hl push de push bc - farcall CheckTossableItem_ + farcall _CheckTossableItem pop bc pop de pop hl @@ -18,9 +18,11 @@ TossItem:: push bc ldh a, [hROMBank] push af - ld a, BANK(TossItem_) + ld a, BANK(_TossItem) rst Bankswitch - call TossItem_ + + call _TossItem + pop bc ld a, b rst Bankswitch @@ -33,11 +35,13 @@ ReceiveItem:: push bc ldh a, [hROMBank] push af - ld a, BANK(ReceiveItem_) + ld a, BANK(_ReceiveItem) rst Bankswitch push hl push de - call ReceiveItem_ + + call _ReceiveItem + pop de pop hl pop bc @@ -52,13 +56,15 @@ CheckItem:: push bc ldh a, [hROMBank] push af - ld a, BANK(CheckItem_) + ld a, BANK(_CheckItem) rst Bankswitch - call CheckItem_ + + call _CheckItem + pop bc ld a, b rst Bankswitch pop bc pop de pop hl - ret + ret
\ No newline at end of file diff --git a/items/item_effects.asm b/items/item_effects.asm index 2308c6b2..3ab2de15 100755 --- a/items/item_effects.asm +++ b/items/item_effects.asm @@ -1,4 +1,4 @@ -DoItemEffect_:: ; e7a6 (3:67a6) +_DoItemEffect:: ; e7a6 (3:67a6) ld a, [wd002] ld [wd151], a call GetItemName @@ -2752,6 +2752,7 @@ wTempNumBuffer:: wNamedObjectIndexBuffer:: wDeciramBuffer:: wBreedingCompatibility:: +wNumSetBits:: wd151:: ds 1 ; d151 wd152:: ds 1 ; d152 wd153:: ds 1 ; d153 |