ref: 2a263629a40e201b1702e2f4e65f1c61360cc2b2
parent: 9bbb65166e4f7674bbdec7b1314b0cf42b43a923
author: PikalaxALT <PikalaxALT@gmail.com>
date: Tue Dec 29 11:44:37 EST 2015
Item effects, post-battle, and decoration flags
--- a/battle/core.asm
+++ b/battle/core.asm
@@ -8701,12 +8701,12 @@
ExitBattle: ; 3f69e
- call Function3f6a5
+ call .HandleEndOfBattle
call CleanUpBattleRAM
ret
; 3f6a5
-Function3f6a5: ; 3f6a5
+.HandleEndOfBattle: ; 3f6a5
ld a, [wLinkMode]
and a
jr z, .not_linked
@@ -8713,7 +8713,7 @@
call ShowLinkBattleParticipantsAfterEnd
ld c, 150
call DelayFrames
- call Function3f77c
+ call DetermineMobileBattleResult
ret
.not_linked
@@ -8724,12 +8724,12 @@
xor a
ld [wForceEvolution], a
predef EvolveAfterBattle
- callba Function2ed44
+ callba GivePokerusAndConvertBerries
ret
; 3f6d0
CleanUpBattleRAM: ; 3f6d0
- call Function3f998
+ call BattleEnd_HandleRoamMons
xor a
ld [Danger], a
ld [wBattleMode], a
@@ -8810,7 +8810,7 @@
ret
; 3f77c
-Function3f77c: ; 3f77c
+DetermineMobileBattleResult: ; 3f77c
callba CheckMobileBattleError
jp c, .Mobile_InvalidBattle
call IsMobileBattle2
@@ -9058,19 +9058,19 @@
; 3f998
-Function3f998: ; 3f998
+BattleEnd_HandleRoamMons: ; 3f998
ld a, [BattleType]
cp BATTLETYPE_ROAMING
- jr nz, .asm_3f9c4
+ jr nz, .not_roaming
ld a, [wBattleResult]
and $f
- jr z, .asm_3f9af
+ jr z, .caught_or_defeated_roam_mon
call GetRoamMonHP
ld a, [EnemyMonHP + 1]
ld [hl], a
- jr .asm_3f9ca
+ jr .update_roam_mons
-.asm_3f9af
+.caught_or_defeated_roam_mon
call GetRoamMonHP
ld [hl], $0
call GetRoamMonMapGroup
@@ -9081,12 +9081,12 @@
ld [hl], $0
ret
-.asm_3f9c4
+.not_roaming
call BattleRandom
and $f
ret nz
-.asm_3f9ca
+.update_roam_mons
callab UpdateRoamMons
ret
; 3f9d1
--- a/constants/deco_constants.asm
+++ b/constants/deco_constants.asm
@@ -51,59 +51,71 @@
const SET_UP_ORNAMENT
const PUT_AWAY_ORNAMENT
+deco: MACRO
+ const DECO_\1
+ enum DECOFLAG_\1
+endm
+
const_value = 1
- const DECO_BEDS
- const DECO_FEATHERY_BED ; 2
- const DECO_PINK_BED ; 3
- const DECO_POLKADOT_BED ; 4
- const DECO_PIKACHU_BED ; 5
- const DECO_CARPETS
- const DECO_RED_CARPET ; 7
- const DECO_BLUE_CARPET ; 8
- const DECO_YELLOW_CARPET ; 9
- const DECO_GREEN_CARPET ; a
- const DECO_0B
- const DECO_MAGNAPLANT ; c
- const DECO_TROPICPLANT ; d
- const DECO_JUMBOPLANT ; e
- const DECO_POSTERS
- const DECO_TOWN_MAP ; 10
- const DECO_PIKACHU_POSTER ; 11
- const DECO_CLEFAIRY_POSTER ; 12
- const DECO_JIGGLYPUFF_POSTER ; 13
- const DECO_CONSOLES
- const DECO_FAMICOM ; 15
- const DECO_SNES ; 16
- const DECO_N64 ; 17
- const DECO_VIRTUAL_BOY ; 18
- const DECO_BIG_DOLLS
- const DECO_BIG_SNORLAX_DOLL ; 1a
- const DECO_BIG_ONIX_DOLL ; 1b
- const DECO_BIG_LAPRAS_DOLL ; 1c
- const DECO_DOLLS
- const DECO_PIKACHU_DOLL ; 1e
- const DECO_SURF_PIKACHU_DOLL ; 1f
- const DECO_CLEFAIRY_DOLL ; 20
- const DECO_JIGGLYPUFF_DOLL ; 21
- const DECO_BULBASAUR_DOLL ; 22
- const DECO_CHARMANDER_DOLL ; 23
- const DECO_SQUIRTLE_DOLL ; 24
- const DECO_POLIWAG_DOLL ; 25
- const DECO_DIGLETT_DOLL ; 26
- const DECO_STARMIE_DOLL ; 27
- const DECO_MAGIKARP_DOLL ; 28
- const DECO_ODDISH_DOLL ; 29
- const DECO_GENGAR_DOLL ; 2a
- const DECO_SHELLDER_DOLL ; 2b
- const DECO_GRIMER_DOLL ; 2c
- const DECO_VOLTORB_DOLL ; 2d
- const DECO_WEEDLE_DOLL ; 2e
- const DECO_UNOWN_DOLL ; 2f
- const DECO_GEODUDE_DOLL ; 30
- const DECO_MACHOP_DOLL ; 31
- const DECO_TENTACOOL_DOLL ; 32
- const DECO_GOLD_TROPHY_DOLL ; 33
- const DECO_SILVER_TROPHY_DOLL ; 34
+__enum__ = 0
+ const BEDS
+ deco FEATHERY_BED ; 2 (0)
+ deco PINK_BED ; 3 (1)
+ deco POLKADOT_BED ; 4 (2)
+ deco PIKACHU_BED ; 5 (3)
+
+ const CARPETS
+ deco RED_CARPET ; 7 (4)
+ deco BLUE_CARPET ; 8 (5)
+ deco YELLOW_CARPET ; 9 (6)
+ deco GREEN_CARPET ; a (7)
+
+ const PLANTS
+ deco MAGNAPLANT ; c (8)
+ deco TROPICPLANT ; d (9)
+ deco JUMBOPLANT ; e (a)
+
+ const POSTERS
+ deco TOWN_MAP ; 10 (b)
+ deco PIKACHU_POSTER ; 11 (c)
+ deco CLEFAIRY_POSTER ; 12 (d)
+ deco JIGGLYPUFF_POSTER ; 13(e)
+
+ const CONSOLES
+ deco FAMICOM ; 15 (f)
+ deco SNES ; 16 (10)
+ deco N64 ; 17 (11)
+ deco VIRTUAL_BOY ; 18 (12)
+
+ const BIG_DOLLS
+ deco BIG_SNORLAX_DOLL ; 1a (13)
+ deco BIG_ONIX_DOLL ; 1b (14)
+ deco BIG_LAPRAS_DOLL ; 1c (15)
+
+ const DOLLS
+ deco PIKACHU_DOLL ; 1e (16)
+ deco SURF_PIKACHU_DOLL ; 1f (17)
+ deco CLEFAIRY_DOLL ; 20 (18)
+ deco JIGGLYPUFF_DOLL ; 21 (19)
+ deco BULBASAUR_DOLL ; 22 (1a)
+ deco CHARMANDER_DOLL ; 23 (1b)
+ deco SQUIRTLE_DOLL ; 24 (1c)
+ deco POLIWAG_DOLL ; 25 (1d)
+ deco DIGLETT_DOLL ; 26 (1e)
+ deco STARMIE_DOLL ; 27 (1f)
+ deco MAGIKARP_DOLL ; 28 (20)
+ deco ODDISH_DOLL ; 29 (21)
+ deco GENGAR_DOLL ; 2a (22)
+ deco SHELLDER_DOLL ; 2b (23)
+ deco GRIMER_DOLL ; 2c (24)
+ deco VOLTORB_DOLL ; 2d (25)
+ deco WEEDLE_DOLL ; 2e (26)
+ deco UNOWN_DOLL ; 2f (27)
+ deco GEODUDE_DOLL ; 30 (28)
+ deco MACHOP_DOLL ; 31 (29)
+ deco TENTACOOL_DOLL ; 32 (2a)
+ deco GOLD_TROPHY_DOLL ; 33 (2b)
+ deco SILVER_TROPHY_DOLL ; 34 (2c)
NUM_NON_TROPHY_DECOS EQU $2b
NUM_DECOS EQU $2d
--- a/engine/decorations.asm
+++ b/engine/decorations.asm
@@ -207,7 +207,7 @@
FindOwnedBeds: ; 268bd
ld hl, .beds
- ld c, DECO_BEDS
+ ld c, BEDS
jp FindOwnedDecosInCategory
; 268c5
@@ -228,7 +228,7 @@
FindOwnedCarpets: ; 268d2
ld hl, .carpets
- ld c, DECO_CARPETS
+ ld c, CARPETS
jp FindOwnedDecosInCategory
; 268da
@@ -249,7 +249,7 @@
FindOwnedPlants: ; 268e7
ld hl, .plants
- ld c, DECO_0B
+ ld c, PLANTS
jp FindOwnedDecosInCategory
; 268ef
@@ -269,7 +269,7 @@
FindOwnedPosters: ; 268fb
ld hl, .posters
- ld c, DECO_POSTERS
+ ld c, POSTERS
jp FindOwnedDecosInCategory
; 26903
@@ -290,7 +290,7 @@
FindOwnedConsoles: ; 26910
ld hl, .consoles
- ld c, DECO_CONSOLES
+ ld c, CONSOLES
jp FindOwnedDecosInCategory
; 26918
@@ -311,7 +311,7 @@
FindOwnedOrnaments: ; 26925
ld hl, .ornaments
- ld c, DECO_DOLLS
+ ld c, DOLLS
jp FindOwnedDecosInCategory
; 2692d
@@ -351,7 +351,7 @@
FindOwnedBigDolls: ; 2694d
ld hl, .big_dolls
- ld c, DECO_BIG_DOLLS
+ ld c, BIG_DOLLS
jp FindOwnedDecosInCategory
; 26955
--- a/engine/mysterygift2.asm
+++ b/engine/mysterygift2.asm
@@ -187,41 +187,41 @@
; 2c74a
MysteryGiftDecos: ; 2c74a
- db DECO_SNES
- db DECO_BIG_SNORLAX_DOLL
- db DECO_BIG_ONIX_DOLL
- db DECO_BIG_LAPRAS_DOLL
- db DECO_DOLLS
- db DECO_PIKACHU_DOLL
- db DECO_SURF_PIKACHU_DOLL
- db DECO_CLEFAIRY_DOLL
- db DECO_JIGGLYPUFF_DOLL
- db DECO_BULBASAUR_DOLL
- db DECO_TROPICPLANT
- db DECO_JUMBOPLANT
- db DECO_TOWN_MAP
- db DECO_CHARMANDER_DOLL
- db DECO_POLIWAG_DOLL
- db DECO_DIGLETT_DOLL
- db DECO_BLUE_CARPET
- db DECO_YELLOW_CARPET
- db DECO_POSTERS
- db DECO_PIKACHU_POSTER
- db DECO_N64
- db DECO_BIG_DOLLS
- db DECO_BEDS
- db DECO_FEATHERY_BED
- db DECO_POLKADOT_BED
- db DECO_PIKACHU_BED
- db DECO_CARPETS
- db DECO_RED_CARPET
- db DECO_GREEN_CARPET
- db DECO_CLEFAIRY_POSTER
- db DECO_ODDISH_DOLL
- db DECO_MAGNAPLANT
- db DECO_GENGAR_DOLL
- db DECO_CONSOLES
- db DECO_PINK_BED
- db DECO_SQUIRTLE_DOLL
- db DECO_STARMIE_DOLL
+ db DECOFLAG_PIKACHU_DOLL
+ db DECOFLAG_BULBASAUR_DOLL
+ db DECOFLAG_CHARMANDER_DOLL
+ db DECOFLAG_SQUIRTLE_DOLL
+ db DECOFLAG_POLIWAG_DOLL
+ db DECOFLAG_DIGLETT_DOLL
+ db DECOFLAG_STARMIE_DOLL
+ db DECOFLAG_MAGIKARP_DOLL
+ db DECOFLAG_ODDISH_DOLL
+ db DECOFLAG_GENGAR_DOLL
+ db DECOFLAG_CLEFAIRY_POSTER
+ db DECOFLAG_JIGGLYPUFF_POSTER
+ db DECOFLAG_SNES
+ db DECOFLAG_SHELLDER_DOLL
+ db DECOFLAG_VOLTORB_DOLL
+ db DECOFLAG_WEEDLE_DOLL
+ db DECOFLAG_MAGNAPLANT
+ db DECOFLAG_TROPICPLANT
+ db DECOFLAG_FAMICOM
+ db DECOFLAG_N64
+ db DECOFLAG_SURF_PIKACHU_DOLL
+ db DECOFLAG_JIGGLYPUFF_DOLL
+ db DECOFLAG_PINK_BED
+ db DECOFLAG_POLKADOT_BED
+ db DECOFLAG_RED_CARPET
+ db DECOFLAG_BLUE_CARPET
+ db DECOFLAG_YELLOW_CARPET
+ db DECOFLAG_GREEN_CARPET
+ db DECOFLAG_JUMBOPLANT
+ db DECOFLAG_VIRTUAL_BOY
+ db DECOFLAG_MACHOP_DOLL
+ db DECOFLAG_PIKACHU_POSTER
+ db DECOFLAG_TENTACOOL_DOLL
+ db DECOFLAG_BIG_ONIX_DOLL
+ db DECOFLAG_PIKACHU_BED
+ db DECOFLAG_GRIMER_DOLL
+ db DECOFLAG_UNOWN_DOLL
; 2c76f
--- a/items/item_effects.asm
+++ b/items/item_effects.asm
@@ -2811,29 +2811,27 @@
NormalBox: ; f763
- ld c, $2c
- jr Function_0xf769
+ ld c, DECOFLAG_SILVER_TROPHY_DOLL
+ jr OpenBox
; f767
GorgeousBox: ; f767
- ld c, $2b
-; f769
-
-Function_0xf769: ; f769
+ ld c, DECOFLAG_GOLD_TROPHY_DOLL
+OpenBox: ; f769
callba SetSpecificDecorationFlag
- ld hl, UnknownText_0xf778
+ ld hl, .text
call PrintText
jp UseDisposableItem
; f778
-UnknownText_0xf778: ; 0xf778
+.text: ; 0xf778
+ ; There was a trophy inside!
text_jump UnknownText_0x1c5d03
db "@"
; 0xf77d
-
Brightpowder:
Item19:
LuckyPunch:
@@ -2923,7 +2921,8 @@
UpGrade:
ItemB0:
RainbowWing:
-ItemB3: ; f77d
+ItemB3:
+TeruSama: ; f77d
jp IsntTheTimeMessage
; f780
--- a/main.asm
+++ b/main.asm
@@ -6743,7 +6743,7 @@
INCLUDE "battle/moves/move_descriptions.asm"
; 2ed44
-Function2ed44: ; 2ed44
+GivePokerusAndConvertBerries: ; 2ed44
call ConvertBerriesToBerryJuice
ld hl, PartyMon1PokerusStatus
ld a, [PartyCount]
@@ -6784,12 +6784,11 @@
jr z, .randomPokerusLoop
ld b, a
and $f0
- jr z, .asm_2ed91
+ jr z, .load_pkrs
ld a, b
and $7
inc a
-
-.asm_2ed91
+.load_pkrs
ld b, a
swap b
and $3
@@ -6800,10 +6799,10 @@
.monHasActivePokerus
call Random
- cp $55
+ cp 1 + 33 percent
ret nc ; 1/3 chance
ld a, [PartyCount]
- cp $1
+ cp 1
ret z ; only one mon, nothing to do
ld c, [hl]
ld a, b
--- a/misc/mobile_40.asm
+++ b/misc/mobile_40.asm
@@ -4077,7 +4077,7 @@
Function101a4f: ; 101a4f
ld a, $1
ld [wc2d7], a
- callba Function3f77c
+ callba DetermineMobileBattleResult
xor a
ld [wc2d7], a
callba CleanUpBattleRAM