Permalink
Browse files

Added Berry bag pockets (Breaks all previous saves) (#1)

* Ragni original work
  • Loading branch information...
maniac379 committed Jul 4, 2017
1 parent c030f48 commit 5da549ff209c7350beb9fc17b7842839796be872
@@ -270,9 +270,11 @@ MAIL_MAX_LENGTH EQU $20
; pockets
ITEM EQU 1
KEY_ITEM EQU 2
MEDICINE EQU 2
BALL EQU 3
TM_HM EQU 4
BERRIES EQU 5
KEY_ITEM EQU 6
; item actions
CANT_SELECT EQU 1 << 6
@@ -437,4 +439,4 @@ const_value set $f0
const PARTYMENUTEXT_HEAL_ALL
const PARTYMENUTEXT_REVIVE
const PARTYMENUTEXT_LEVEL_UP
const PARTYMENUTEXT_HEAL_CONFUSION
const PARTYMENUTEXT_HEAL_CONFUSION
@@ -1,9 +1,11 @@
PARTY_LENGTH EQU 6
MAX_ITEMS EQU 20
MAX_BALLS EQU 12
MAX_KEY_ITEMS EQU 25
MAX_PC_ITEMS EQU 50
MAX_ITEMS EQU 20 ; 92 kinds
MAX_MEDICINE EQU 10 ; 34 kinds
MAX_BALLS EQU 18 ; 18 kinds (12 ORIG + 6 ADDED)
MAX_BERRIES EQU 17 ; 17 kinds
MAX_KEY_ITEMS EQU 23 ; 23 kinds (25 ORIG)
MAX_PC_ITEMS EQU 19 ; (50 ORIG)
; strings
PLAYER_NAME_LENGTH EQU 8
@@ -258,4 +260,4 @@ INIT_ENEMYOT_LIST EQU 1
INIT_BAG_ITEM_LIST EQU 2
INIT_OTHER_ITEM_LIST EQU 3
INIT_PLAYEROT_LIST EQU 4
INIT_MON_LIST EQU 5
INIT_MON_LIST EQU 5
View
BIN +167 Bytes (100%) engine/events.o
Binary file not shown.
View
@@ -157,12 +157,18 @@ _ResetWRAM: ; 5bae
ld hl, NumItems
call .InitList
ld hl, NumKeyItems
ld hl, NumMedicine
call .InitList
ld hl, NumBalls
call .InitList
ld hl, NumBerries
call .InitList
ld hl, NumKeyItems
call .InitList
ld hl, PCItems
call .InitList
@@ -1418,4 +1424,4 @@ GameInit:: ; 642e
ld [hWY], a
call WaitBGMap
jp CrystalIntroSequence
; 6454
; 6454
View
@@ -1,6 +1,4 @@
_ReceiveItem:: ; d1d5
call DoesHLEqualNumItems
jp nz, PutItemInPocket
push hl
call CheckItemPocket
pop de
@@ -12,24 +10,32 @@ _ReceiveItem:: ; d1d5
.Pockets: ; d1e9
dw .Item
dw .KeyItem
dw .Medicine
dw .Ball
dw .TMHM
dw .Berry
dw .KeyItem
.Item: ; d1f1
ld h, d
ld l, e
ld hl, NumItems
jp PutItemInPocket
.KeyItem: ; d1f6
ld h, d
ld l, e
jp ReceiveKeyItem
.Medicine: ; d1f6
ld hl, NumMedicine
jp PutItemInPocket
.Ball: ; d1fb
ld hl, NumBalls
jp PutItemInPocket
.Berry:
ld hl, NumBerries
jp PutItemInPocket
.KeyItem:
ld hl, NumKeyItems
jp ReceiveKeyItem
.TMHM: ; d201
ld h, d
ld l, e
@@ -52,9 +58,15 @@ _TossItem:: ; d20d
.Pockets:
dw .Item
dw .KeyItem
dw .Medicine
dw .Ball
dw .TMHM
dw .Berry
dw .KeyItem
.Medicine:
ld hl, NumMedicine
jp RemoveItemFromPocket
.Ball: ; d228
ld hl, NumBalls
@@ -68,6 +80,10 @@ _TossItem:: ; d20d
call GetTMHMNumber
jp TossTMHM
.Berry:
ld hl, NumBerries
jp RemoveItemFromPocket
.KeyItem: ; d23a
ld h, d
ld l, e
@@ -94,9 +110,15 @@ _CheckItem:: ; d244
.Pockets:
dw .Item
dw .KeyItem
dw .Medicine
dw .Ball
dw .TMHM
dw .Berry
dw .KeyItem
.Medicine:
ld hl, NumMedicine
jp CheckTheItem
.Ball: ; d25f
ld hl, NumBalls
@@ -110,6 +132,10 @@ _CheckItem:: ; d244
call GetTMHMNumber
jp CheckTMHM
.Berry:
ld hl, NumBerries
jp CheckTheItem
.KeyItem: ; d271
ld h, d
ld l, e
@@ -134,22 +160,40 @@ GetPocketCapacity: ; d283
ld c, MAX_ITEMS
ld a, e
cp NumItems % $100
jr nz, .not_bag
jr nz, .not_items
ld a, d
cp NumItems / $100
ret z
.not_bag
ld c, MAX_PC_ITEMS
.not_items
ld c, MAX_MEDICINE
ld a, e
cp PCItems % $100
jr nz, .not_pc
cp NumMedicine % $100
jr nz, .not_medicine
ld a, d
cp PCItems / $100
cp NumMedicine / $100
ret z
.not_pc
ld c, MAX_BALLS
.not_medicine:
ld c, MAX_BALLS
ld a, e
cp NumBalls % $100
jr nz, .not_balls
ld a, d
cp NumBalls / $100
ret z
.not_balls:
ld c, MAX_BERRIES
ld a, e
cp NumBerries % $100
jr nz, .not_berries
ld a, d
cp NumBerries / $100
ret z
.not_berries:
ld c, MAX_PC_ITEMS
ret
PutItemInPocket: ; d29c
@@ -581,4 +625,4 @@ GetItemPrice: ; d486
ld d, a
pop bc
pop hl
ret
ret
Oops, something went wrong.

0 comments on commit 5da549f

Please sign in to comment.