diff options
author | obskyr <powpowd@gmail.com> | 2018-07-07 03:49:57 +0200 |
---|---|---|
committer | obskyr <powpowd@gmail.com> | 2018-07-07 03:49:57 +0200 |
commit | d4bb6b990a94de27f58d2c92fad5888017d3bb9d (patch) | |
tree | 7ae791db3412dbe7f9393d0c204ab4426a4992c4 /home/items.asm | |
parent | d3f356a1dc6970973932502edbe3af6b150a22d0 (diff) | |
parent | f3f0e711bf4f4205fd29f2b448c93ff5597507e5 (diff) |
Merge branch 'master' of https://github.com/pret/pokegold-spaceworld
Diffstat (limited to 'home/items.asm')
-rwxr-xr-x | home/items.asm | 138 |
1 files changed, 69 insertions, 69 deletions
diff --git a/home/items.asm b/home/items.asm index dd4e8d3..332d5e1 100755 --- a/home/items.asm +++ b/home/items.asm @@ -1,69 +1,69 @@ -INCLUDE "constants.asm"
-
-if DEBUG
-SECTION "TossItem", ROM0[$3243]
-else
-SECTION "TossItem", ROM0[$3207]
-endc
-
-TossItem: ; 00:3243
- ldh a, [hROMBank]
- push af
- ld a, BANK(_TossItem)
- call Bankswitch
- push hl
- push de
- push bc
- call _TossItem
- pop bc
- pop de
- pop hl
- pop af
- call Bankswitch
- ret
-
-ReceiveItem:: ; 3259
-; function to add an item (in varying quantities) to the player's bag or PC box
-; INPUT:
-; HL = address of inventory (either wNumBagItems or wNumBoxItems)
-; [wCurItem] = item ID
-; [wItemQuantity] = item quantity
-; sets carry flag if successful, unsets carry flag if unsuccessful
- push bc
- ldh a, [hROMBank]
- push af
- ld a, BANK(_ReceiveItem)
- call Bankswitch
- push hl
- push de
- call _ReceiveItem
- pop de
- pop hl
- pop bc
- ld a, b
- call Bankswitch
- pop bc
- ret
-
-if DEBUG
-SECTION "GiveItem", ROM0[$366C]
-else
-SECTION "GiveItem", ROM0[$3630]
-endc
-
-GiveItem::
-; Give player quantity c of item b,
-; and copy the item's name to wcf4b.
-; Return carry on success.
- ld a, b
- ld [wNamedObjectIndexBuffer], a
- ld [wCurItem], a
- ld a, c
- ld [wItemQuantity], a
- ld hl, wNumBagItems
- call ReceiveItem
- ret nc
- call GetItemName
- call CopyStringToStringBuffer2
- scf
- ret
+INCLUDE "constants.asm" + +if DEBUG +SECTION "TossItem", ROM0[$3243] +else +SECTION "TossItem", ROM0[$3207] +endc + +TossItem: ; 00:3243 + ldh a, [hROMBank] + push af + ld a, BANK(_TossItem) + call Bankswitch + push hl + push de + push bc + call _TossItem + pop bc + pop de + pop hl + pop af + call Bankswitch + ret + +ReceiveItem:: ; 3259 +; function to add an item (in varying quantities) to the player's bag or PC box +; INPUT: +; HL = address of inventory (either wNumBagItems or wNumBoxItems) +; [wCurItem] = item ID +; [wItemQuantity] = item quantity +; sets carry flag if successful, unsets carry flag if unsuccessful + push bc + ldh a, [hROMBank] + push af + ld a, BANK(_ReceiveItem) + call Bankswitch + push hl + push de + call _ReceiveItem + pop de + pop hl + pop bc + ld a, b + call Bankswitch + pop bc + ret + +if DEBUG +SECTION "GiveItem", ROM0[$366C] +else +SECTION "GiveItem", ROM0[$3630] +endc + +GiveItem:: +; Give player quantity c of item b, +; and copy the item's name to wcf4b. +; Return carry on success. + ld a, b + ld [wNamedObjectIndexBuffer], a + ld [wCurItem], a + ld a, c + ld [wItemQuantity], a + ld hl, wNumBagItems + call ReceiveItem + ret nc + call GetItemName + call CopyStringToStringBuffer2 + scf + ret |