summaryrefslogtreecommitdiff
path: root/engine/items
diff options
context:
space:
mode:
authorRangi <remy.oukaour+rangi@gmail.com>2020-09-20 13:58:03 -0400
committerRangi <remy.oukaour+rangi@gmail.com>2020-09-20 13:58:03 -0400
commitfac958b280056922a1828b71a04d84a36e1e807a (patch)
treec094adc59182b253a61defb5fb85de7a9d77b7cc /engine/items
parentbfb981f1885d21cc59d2656e84c87bb8d64a089c (diff)
- Remove trailing whitespace
- Indent with single tabs, not spaces - Colons after labels - Capitalize BANK, HIGH, and LOW - dbw BANK(X), X -> dba X
Diffstat (limited to 'engine/items')
-rwxr-xr-xengine/items/inventory.asm146
-rw-r--r--engine/items/tmhm.asm8
2 files changed, 77 insertions, 77 deletions
diff --git a/engine/items/inventory.asm b/engine/items/inventory.asm
index d09a75a..33b5e4d 100755
--- a/engine/items/inventory.asm
+++ b/engine/items/inventory.asm
@@ -11,7 +11,7 @@ _ReceiveItem: ; 03:4AA1
dec a
ld hl, .Pockets
jp CallJumptable
-
+
.Pockets: ; 03:4ABA
dw .Item
dw .KeyItem
@@ -39,7 +39,7 @@ _ReceiveItem: ; 03:4AA1
ld c, a
call GetTMHMNumber
jp ReceiveTMHM
-
+
_TossItem: ; 03:4AE0
call DoesHLEqualwNumBagItems
@@ -50,31 +50,31 @@ _TossItem: ; 03:4AE0
dec a
ld hl, .Pockets
jp CallJumptable
-
+
.Pockets ; 03:4AF8
dw .Item
dw .KeyItem
dw .Ball
dw .TMHM
-
+
.Ball ; 03:4B00
pop hl
ld a, [wCurItem]
ld c, a
call GetBallIndex
jp TossBall
-
+
.TMHM ; 03:4B0B
pop hl
ld a, [wCurItem]
ld c, a
call GetTMHMNumber
jp TossTMHM
-
+
.KeyItem ; 03:4B16
pop hl
jp TossKeyItem
-
+
.Item ; 03:4B1A
pop hl
@@ -91,13 +91,13 @@ _CheckItem: ; 03:4B1E
dec a
ld hl, .Pockets
jp CallJumptable
-
+
.Pockets ; 03:4B36
dw .Item
dw .KeyItem
dw .Ball
dw .TMHM
-
+
.Ball ; 03:4B3E
pop hl
ld a, [wCurItem]
@@ -111,14 +111,14 @@ _CheckItem: ; 03:4B1E
ld c, a
call GetTMHMNumber
jp CheckTMHM
-
+
.KeyItem ; 03:4B54
pop hl
jp CheckKeyItems
-
+
.Item ; 03:4B58
pop hl
-
+
.not_bag
jp CheckTheItem
@@ -139,7 +139,7 @@ PutItemInPocket: ; 03:4B64
ld a, [wCurItem]
ld c, a
ld b, 0
-
+
; will add the item once the total
; available space (b) exceeds the
; amount being added
@@ -161,22 +161,22 @@ PutItemInPocket: ; 03:4B64
.next
inc hl
jr .loop
-
+
.terminator
call GetPocketCapacity
ld a, [de]
cp c
jr c, .can_add
-
+
and a
ret
-
+
.can_add
ld h, d
ld l, e
ld a, [wCurItem]
ld c, a
-
+
.loop2
inc hl
ld a, [hli]
@@ -184,7 +184,7 @@ PutItemInPocket: ; 03:4B64
jr z, .terminator2
cp c
jr nz, .loop2
-
+
ld a, [wItemQuantity]
add [hl]
cp a, 100
@@ -200,7 +200,7 @@ PutItemInPocket: ; 03:4B64
sub 99
ld [wItemQuantity], a
jr .loop2
-
+
.terminator2
dec hl
ld a, [wCurItem]
@@ -211,12 +211,12 @@ PutItemInPocket: ; 03:4B64
ld h, d
ld l, e
inc [hl]
-
+
.done
scf
ret
-
+
GetPocketCapacity: ; 03:4BC1
ld c, MAX_ITEMS
ld a, e
@@ -225,12 +225,12 @@ GetPocketCapacity: ; 03:4BC1
ld a, d
cp HIGH(wNumBagItems)
ret z
-
+
.not_bag
ld c, MAX_PC_ITEMS
ret
-
+
RemoveItemFromPocket: ;03:4BCF
ld d, h
ld e, l
@@ -246,12 +246,12 @@ RemoveItemFromPocket: ;03:4BCF
ld a, [hl]
sub b
jr c, .underflow
-
+
ld [hl], a
ld [wItemQuantityBuffer], a
and a
jr nz, .done
-
+
; if the remaining quantity is zero
; then erase the slot by shifting
; the subsequent data upwards
@@ -260,7 +260,7 @@ RemoveItemFromPocket: ;03:4BCF
ld c, l
inc hl
inc hl
-
+
.loop
ld a, [hli]
ld [bc], a
@@ -270,20 +270,20 @@ RemoveItemFromPocket: ;03:4BCF
ld h, d
ld l, e
dec [hl]
-
+
.done
scf
ret
-
+
.underflow
and a
ret
-
-
+
+
CheckTheItem: ; 03:4BFD
ld a, [wCurItem]
ld c, a
-
+
.loop
inc hl
ld a, [hli]
@@ -291,15 +291,15 @@ CheckTheItem: ; 03:4BFD
jr z, .fail
cp c
jr nz, .loop
-
+
scf
ret
-
+
.fail
and a
ret
-
+
ReceiveKeyItem: ; 03:4C0E
ld hl, wNumKeyItems
ld a, [hli]
@@ -315,12 +315,12 @@ ReceiveKeyItem: ; 03:4C0E
inc [hl]
scf
ret
-
+
.full_pack
and a
ret
-
-
+
+
TossKeyItem: ; 03:4C28
ld hl, wNumKeyItems
dec [hl]
@@ -332,7 +332,7 @@ TossKeyItem: ; 03:4C28
ld d, h
ld e, l
inc hl
-
+
; erase this item by shifting
; all subsequent data upwards
.loop
@@ -343,13 +343,13 @@ TossKeyItem: ; 03:4C28
jr nz, .loop
scf
ret
-
-
+
+
CheckKeyItems: ; 03:4C40
ld a, [wCurItem]
ld c, a
ld hl, wKeyItems
-
+
.loop
ld a, [hli]
cp c
@@ -359,12 +359,12 @@ CheckKeyItems: ; 03:4C40
and a
ret
-
+
.done
scf
ret
-
-
+
+
; get index of ball item id c from BallItems
GetBallIndex: ; 03:4C53
ld a, c
@@ -380,8 +380,8 @@ GetBallIndex: ; 03:4C53
pop hl
ld c, a
ret
-
-
+
+
; get ball item id at index c in BallItems
GetBallByIndex: ; 03:4c66
push bc
@@ -394,8 +394,8 @@ GetBallByIndex: ; 03:4c66
pop bc
ld c, a
ret
-
-
+
+
BallItems: ; 03:4C73
db ITEM_MASTER_BALL
db ITEM_ULTRA_BALL
@@ -415,7 +415,7 @@ EmptyBallPocket: ; 03:4C78
ld [hli], a
ld [hl], -1
ret
-
+
ReceiveBall: ; 03:4C80
ld hl, wBallQuantities
@@ -429,22 +429,22 @@ ReceiveBall: ; 03:4C80
ld a, [hl]
and a
jr nz, .done
-
+
; increase the ball pocket size if
; this ball's previous quantity was 0
ld a, [wNumBallItems]
inc a
ld [wNumBallItems], a
-
+
.done
ld [hl], b
scf
ret
-
+
.overflow
and a
ret
-
+
TossBall: ; 03:4C9F
ld hl, wBallQuantities
@@ -456,7 +456,7 @@ TossBall: ; 03:4C9F
sub b
jr c, .underflow
jr nz, .done
-
+
; increase the ball pocket size if
; this ball's new quantity is 0
ld b, a
@@ -464,18 +464,18 @@ TossBall: ; 03:4C9F
dec a
ld [wNumBallItems], a
ld a, b
-
+
.done
ld [hl], a
ld [wItemQuantityBuffer], a
scf
ret
-
+
.underflow
and a
ret
-
-
+
+
CheckBall: ; 03:4CC0
ld hl, wBallQuantities
ld b, 0
@@ -486,7 +486,7 @@ CheckBall: ; 03:4CC0
scf
ret
-
+
ReceiveTMHM: ; 03:4CCB
ld b, 0
ld hl, wTMsHMs
@@ -498,12 +498,12 @@ ReceiveTMHM: ; 03:4CCB
ld [hl], a
scf
ret
-
+
.overflow
and a
ret
-
-
+
+
TossTMHM: ; 03:4CDE
ld b, 0
ld hl, wTMsHMs
@@ -513,7 +513,7 @@ TossTMHM: ; 03:4CDE
ld a, [hl]
sub b
jr c, .underflow
-
+
ld [hl], a
ld [wItemQuantityBuffer], a
scf
@@ -523,7 +523,7 @@ TossTMHM: ; 03:4CDE
and a
ret
-
+
CheckTMHM: ; 03:4CF4
ld b, 0
ld hl, wTMsHMs
@@ -537,18 +537,18 @@ CheckTMHM: ; 03:4CF4
GetTMHMNumber: ; 03:4CFF
ld a, c
ld c, 0
-
+
sub ITEM_TM01
jr c, .not_machine
-
+
cp ITEM_C8 - ITEM_TM01
jr z, .not_machine
jr c, .finish
-
+
inc c
cp ITEM_E1 - ITEM_TM01
jr z, .not_machine
-
+
jr c, .finish
inc c
@@ -560,7 +560,7 @@ GetTMHMNumber: ; 03:4CFF
ld c, a
scf
ret
-
+
.not_machine
and a
ret
@@ -600,7 +600,7 @@ GetItemAmount: ; 03:4e10
ld b, 0
and a
ret
-
+
; Returns the amount of item b in b
CheckAmountInItemPocket: ; 03:4E1C
ld hl, wItems
@@ -633,7 +633,7 @@ CheckAmountInKeyItems: ; 03:4E2B
ld b, 1
scf
ret
-
+
SECTION "engine/items/inventory.asm@_CheckTossableItem", ROMX
; Return 1 in wItemAttributeParamBuffer and
@@ -680,7 +680,7 @@ CheckItemMenu: ; 03:53D9
and $f
ld [wItemAttributeParamBuffer], a
ret
-
+
; Get attribute a of wCurItem.
GetItemAttr: ; 03:53E6
push hl
@@ -707,7 +707,7 @@ ItemAttr_ReturnCarry: ; 03:5405
ld [wItemAttributeParamBuffer], a
scf
ret
-
+
; Return the price of wCurItem in de.
GetItemPrice: ; 03:540C
push hl
diff --git a/engine/items/tmhm.asm b/engine/items/tmhm.asm
index efe8c27..f3290fe 100644
--- a/engine/items/tmhm.asm
+++ b/engine/items/tmhm.asm
@@ -3,20 +3,20 @@ INCLUDE "constants.asm"
SECTION "engine/items/tmhm.asm", ROMX
CanLearnTMHMMove: ; 04:528f
-; Gets the index of TM or HM with move ID wce32,
+; Gets the index of TM or HM with move ID wce32,
; then checks the corresponding flag in wMonDexIndex's learnset.
; Sets register c to 1 if TM/HM is in learnset OR if debug is enabled.
ld a, [wDebugFlags]
ld c, 01
bit 1, a
ret nz
-
+
ld a, [wMonDexIndex]
ld [wCurSpecies], a
call GetMonHeader
ld hl, wMonHLearnset
push hl
-
+
ld a, [wce32]
ld b, a
ld c, 0
@@ -27,7 +27,7 @@ CanLearnTMHMMove: ; 04:528f
jr z, .jump
inc c
jr .loop
-
+
.jump
pop hl
ld b, 2 ;CHECK_FLAG