ref: bcfca2e267a6ee023271d90e27e4a7fde06f66fc
parent: 4a8c9993ad182296131ef87111e1b6d6e2af4201
author: YamaArashi <shadow962@live.com>
date: Sun Jul 12 19:36:56 EDT 2015
movemon and removepokemon wram variables
--- a/constants/misc_constants.asm
+++ b/constants/misc_constants.asm
@@ -66,6 +66,12 @@
CHOSE_FIRST_ITEM EQU 1
CHOSE_SECOND_ITEM EQU 2
+; move mon constants
+BOX_TO_PARTY EQU 0
+PARTY_TO_BOX EQU 1
+DAYCARE_TO_PARTY EQU 2
+PARTY_TO_DAYCARE EQU 3
+
; serial
ESTABLISH_CONNECTION_WITH_INTERNAL_CLOCK EQU $01
--- a/engine/cable_club.asm
+++ b/engine/cable_club.asm
@@ -793,7 +793,7 @@
ld a, [hl]
ld [wTradedPlayerMonSpecies], a
xor a
- ld [wcf95], a
+ ld [wRemoveMonFromBox], a
call RemovePokemon
ld a, [wTradingWhichEnemyMon]
ld c, a
--- a/engine/in_game_trades.asm
+++ b/engine/in_game_trades.asm
@@ -131,7 +131,7 @@
ld [wcf91],a
xor a
ld [wcc49],a
- ld [wcf95],a
+ ld [wRemoveMonFromBox],a
call RemovePokemon
ld a,$80
ld [wcc49],a
--- a/engine/menu/bills_pc.asm
+++ b/engine/menu/bills_pc.asm
@@ -229,11 +229,11 @@
ld a, [wcf91]
call GetCryData
call PlaySoundWaitForCurrent
- ld a, $1
- ld [wcf95], a
+ ld a, PARTY_TO_BOX
+ ld [wMoveMonType], a
call MoveMon
xor a
- ld [wcf95], a
+ ld [wRemoveMonFromBox], a
call RemovePokemon
call WaitForSoundToFinish
ld hl, wWhichTrade
@@ -281,11 +281,11 @@
ld a, [wcf91]
call GetCryData
call PlaySoundWaitForCurrent
- xor a
- ld [wcf95], a
+ xor a ; BOX_TO_PARTY
+ ld [wMoveMonType], a
call MoveMon
- ld a, $1
- ld [wcf95], a
+ ld a, 1
+ ld [wRemoveMonFromBox], a
call RemovePokemon
call WaitForSoundToFinish
ld hl, MonIsTakenOutText
@@ -310,7 +310,7 @@
and a
jr nz, .asm_21682
inc a
- ld [wcf95], a
+ ld [wRemoveMonFromBox], a
call RemovePokemon
call WaitForSoundToFinish
ld a, [wcf91]
--- a/home.asm
+++ b/home.asm
@@ -3599,8 +3599,8 @@
; Function to remove a pokemon from the party or the current box.
; wWhichPokemon determines the pokemon.
-; [wcf95] == 0 specifies the party.
-; [wcf95] != 0 specifies the current box.
+; [wRemoveMonFromBox] == 0 specifies the party.
+; [wRemoveMonFromBox] != 0 specifies the current box.
RemovePokemon:: ; 391f (0:391f)
ld hl, _RemovePokemon
ld b, BANK(_RemovePokemon)
--- a/main.asm
+++ b/main.asm
@@ -1916,7 +1916,7 @@
_RemovePokemon: ; 7b68 (1:7b68)
ld hl, wPartyCount
- ld a, [wcf95]
+ ld a, [wRemoveMonFromBox]
and a
jr z, .asm_7b74
ld hl, W_NUMINBOX
@@ -1939,7 +1939,7 @@
jr nz, .asm_7b81
ld hl, wPartyMonOT
ld d, $5
- ld a, [wcf95]
+ ld a, [wRemoveMonFromBox]
and a
jr z, .asm_7b97
ld hl, wBoxMonOT
@@ -1958,7 +1958,7 @@
ld bc, $b
add hl, bc
ld bc, wPartyMonNicks
- ld a, [wcf95]
+ ld a, [wRemoveMonFromBox]
and a
jr z, .asm_7bb8
ld bc, wBoxMonNicks
@@ -1966,7 +1966,7 @@
call CopyDataUntil
ld hl, wPartyMons
ld bc, wPartyMon2 - wPartyMon1
- ld a, [wcf95]
+ ld a, [wRemoveMonFromBox]
and a
jr z, .asm_7bcd
ld hl, wBoxMons
@@ -1976,7 +1976,7 @@
call AddNTimes
ld d, h
ld e, l
- ld a, [wcf95]
+ ld a, [wRemoveMonFromBox]
and a
jr z, .asm_7be4
ld bc, wBoxMon2 - wBoxMon1
@@ -1990,7 +1990,7 @@
.asm_7beb
call CopyDataUntil
ld hl, wPartyMonNicks
- ld a, [wcf95]
+ ld a, [wRemoveMonFromBox]
and a
jr z, .asm_7bfa
ld hl, wBoxMonNicks
@@ -2003,7 +2003,7 @@
ld bc, $b
add hl, bc
ld bc, wPokedexOwned
- ld a, [wcf95]
+ ld a, [wRemoveMonFromBox]
and a
jr z, .asm_7c15
ld bc, wBoxMonNicksEnd
@@ -3867,12 +3867,12 @@
ret ; return success
_MoveMon: ; f51e (3:751e)
- ld a, [wcf95]
+ ld a, [wMoveMonType]
and a
jr z, .checkPartyMonSlots
- cp $2
+ cp DAYCARE_TO_PARTY
jr z, .checkPartyMonSlots
- cp $3
+ cp PARTY_TO_DAYCARE
ld hl, wDayCareMon
jr z, .asm_f575
ld hl, W_NUMINBOX
@@ -3892,10 +3892,10 @@
inc a
ld [hl], a ; increment number of mons in party/box
ld c, a
- ld b, $0
+ ld b, 0
add hl, bc
- ld a, [wcf95]
- cp $2
+ ld a, [wMoveMonType]
+ cp DAYCARE_TO_PARTY
ld a, [wDayCareMon]
jr z, .asm_f556
ld a, [wcf91]
@@ -3902,7 +3902,7 @@
.asm_f556
ld [hli], a ; write new mon ID
ld [hl], $ff ; write new sentinel
- ld a, [wcf95]
+ ld a, [wMoveMonType]
dec a
ld hl, wPartyMons
ld bc, wPartyMon2 - wPartyMon1 ; $2c
@@ -3918,12 +3918,12 @@
push hl
ld e, l
ld d, h
- ld a, [wcf95]
+ ld a, [wMoveMonType]
and a
ld hl, wBoxMons
ld bc, wBoxMon2 - wBoxMon1 ; $21
jr z, .asm_f591
- cp $2
+ cp DAYCARE_TO_PARTY
ld hl, wDayCareMon
jr z, .asm_f597
ld hl, wPartyMons
@@ -3938,10 +3938,10 @@
call CopyData
pop de
pop hl
- ld a, [wcf95]
+ ld a, [wMoveMonType]
and a
jr z, .asm_f5b4
- cp $2
+ cp DAYCARE_TO_PARTY
jr z, .asm_f5b4
ld bc, wBoxMon2 - wBoxMon1
add hl, bc
@@ -3951,8 +3951,8 @@
inc de
ld [de], a
.asm_f5b4
- ld a, [wcf95]
- cp $3
+ ld a, [wMoveMonType]
+ cp PARTY_TO_DAYCARE
ld de, W_DAYCAREMONOT
jr z, .asm_f5d3
dec a
@@ -3968,11 +3968,11 @@
ld e, l
.asm_f5d3
ld hl, wBoxMonOT
- ld a, [wcf95]
+ ld a, [wMoveMonType]
and a
jr z, .asm_f5e6
ld hl, W_DAYCAREMONOT
- cp $2
+ cp DAYCARE_TO_PARTY
jr z, .asm_f5ec
ld hl, wPartyMonOT
.asm_f5e6
@@ -3981,8 +3981,8 @@
.asm_f5ec
ld bc, $b
call CopyData
- ld a, [wcf95]
- cp $3
+ ld a, [wMoveMonType]
+ cp PARTY_TO_DAYCARE
ld de, W_DAYCAREMONNAME
jr z, .asm_f611
dec a
@@ -3998,11 +3998,11 @@
ld e, l
.asm_f611
ld hl, wBoxMonNicks
- ld a, [wcf95]
+ ld a, [wMoveMonType]
and a
jr z, .asm_f624
ld hl, W_DAYCAREMONNAME
- cp $2
+ cp DAYCARE_TO_PARTY
jr z, .asm_f62a
ld hl, wPartyMonNicks
.asm_f624
@@ -4012,10 +4012,10 @@
ld bc, $b
call CopyData
pop hl
- ld a, [wcf95]
- cp $1
+ ld a, [wMoveMonType]
+ cp PARTY_TO_BOX
jr z, .asm_f664
- cp $3
+ cp PARTY_TO_DAYCARE
jr z, .asm_f664
push hl
srl a
--- a/scripts/daycarem.asm
+++ b/scripts/daycarem.asm
@@ -45,13 +45,13 @@
call GetPartyMonName
ld hl, DayCareMText_56419
call PrintText
- ld a, $1
+ ld a, 1
ld [W_DAYCARE_IN_USE], a
- ld a, $3
- ld [wcf95], a
+ ld a, PARTY_TO_DAYCARE
+ ld [wMoveMonType], a
call MoveMon
xor a
- ld [wcf95], a
+ ld [wRemoveMonFromBox], a
call RemovePokemon
ld a, [wcf91]
call PlayCry
@@ -163,8 +163,8 @@
call DisplayTextBoxID
ld hl, DayCareMText_5644f
call PrintText
- ld a, $2
- ld [wcf95], a
+ ld a, DAYCARE_TO_PARTY
+ ld [wMoveMonType], a
call MoveMon
ld a, [wDayCareMonSpecies]
ld [wcf91], a
@@ -171,13 +171,13 @@
ld a, [wPartyCount]
dec a
push af
- ld bc, $002c
+ ld bc, wPartyMon2 - wPartyMon1
push bc
ld hl, wPartyMon1Moves
call AddNTimes
ld d, h
ld e, l
- ld a, $1
+ ld a, 1
ld [wHPBarMaxHP], a
predef WriteMonMoves
pop bc
@@ -186,7 +186,7 @@
call AddNTimes
ld d, h
ld e, l
- ld bc, $0021
+ ld bc, wPartyMon1MaxHP - wPartyMon1HP
add hl, bc
ld a, [hli]
ld [de], a
--- a/wram.asm
+++ b/wram.asm
@@ -851,7 +851,16 @@
; ID used by DisplayListMenuID
ds 1
-wcf95:: ds 1 ; used with RemovePokemon (BoxMons, Daycare, Trades, etc.)
+wRemoveMonFromBox:: ; cf95
+; if non-zero, RemovePokemon will remove the mon from the current box,
+; else it will remove the mon from the party
+
+wMoveMonType:: ; cf95
+; 0 = move from box to party
+; 1 = move from party to box
+; 2 = move from daycare to party
+; 3 = move from party to daycare
+ ds 1
wItemQuantity:: ; cf96
ds 1