shithub: pokecrystal

Download patch

ref: 3d34f5a5a371ad2b9979ae36763cdfb52c581dab
parent: a22343d32c9f81b9cd2a4f2ff49725cfbed6671d
author: mid-kid <esteve.varela@gmail.com>
date: Thu Feb 22 16:35:11 EST 2018

Label wPokemonWithdrawDepositParameter of RemoveMonFromPartyOrBox

It takes a clearly different parameter, completely unrelated and
different in function to PC_DEPOSIT and PC_WITHDRAW.

--- a/constants/wram_constants.asm
+++ b/constants/wram_constants.asm
@@ -128,6 +128,8 @@
 ; wPokemonWithdrawDepositParameter
 PC_WITHDRAW       EQU 0
 PC_DEPOSIT        EQU 1
+REMOVE_PARTY      EQU 0
+REMOVE_BOX        EQU 1
 DAY_CARE_WITHDRAW EQU 2
 DAY_CARE_DEPOSIT  EQU 3
 
--- a/engine/billspc.asm
+++ b/engine/billspc.asm
@@ -203,7 +203,7 @@
 	ld hl, wBillsPC_ScrollPosition
 	add [hl]
 	ld [wCurPartyMon], a
-	xor a
+	xor a ; REMOVE_PARTY
 	ld [wPokemonWithdrawDepositParameter], a
 	farcall RemoveMonFromPartyOrBox
 	call ReleasePKMN_ByePKMN
@@ -463,7 +463,7 @@
 	ld hl, wBillsPC_ScrollPosition
 	add [hl]
 	ld [wCurPartyMon], a
-	ld a, PC_DEPOSIT
+	ld a, REMOVE_BOX
 	ld [wPokemonWithdrawDepositParameter], a
 	farcall RemoveMonFromPartyOrBox
 	call ReleasePKMN_ByePKMN
@@ -1821,7 +1821,7 @@
 	ld [wPokemonWithdrawDepositParameter], a
 	predef SendGetMonIntoFromBox
 	jr c, .asm_boxisfull
-	xor a
+	xor a ; REMOVE_PARTY
 	ld [wPokemonWithdrawDepositParameter], a
 	farcall RemoveMonFromPartyOrBox
 	ld a, [wCurPartySpecies]
@@ -1876,7 +1876,7 @@
 	ld [wPokemonWithdrawDepositParameter], a
 	predef SendGetMonIntoFromBox
 	jr c, .PartyFull
-	ld a, PC_DEPOSIT
+	ld a, REMOVE_BOX
 	ld [wPokemonWithdrawDepositParameter], a
 	farcall RemoveMonFromPartyOrBox
 	ld a, [wCurPartySpecies]
@@ -2113,7 +2113,7 @@
 	call CopyMonToTemp
 	call CloseSRAM
 	farcall CalcBufferMonStats
-	ld a, PC_DEPOSIT
+	ld a, REMOVE_BOX
 	ld [wPokemonWithdrawDepositParameter], a
 	farcall RemoveMonFromPartyOrBox
 	ret
@@ -2146,7 +2146,7 @@
 	ld hl, wPartyMon1Species
 	ld bc, PARTYMON_STRUCT_LENGTH
 	call CopyMonToTemp
-	xor a
+	xor a ; REMOVE_PARTY
 	ld [wPokemonWithdrawDepositParameter], a
 	farcall RemoveMonFromPartyOrBox
 	ret
--- a/engine/events/special.asm
+++ b/engine/events/special.asm
@@ -118,7 +118,7 @@
 	cp 150
 	ld a, SHUCKIE_HAPPY
 	jr nc, .HappyToStayWithYou
-	xor a ; take from pc
+	xor a ; REMOVE_PARTY
 	ld [wPokemonWithdrawDepositParameter], a
 	callfar RemoveMonFromPartyOrBox
 	ld a, SHUCKIE_RETURNED
--- a/engine/link.asm
+++ b/engine/link.asm
@@ -1863,7 +1863,7 @@
 	add hl, bc
 	ld a, [hl]
 	ld [wd002], a
-	xor a
+	xor a ; REMOVE_PARTY
 	ld [wPokemonWithdrawDepositParameter], a
 	callfar RemoveMonFromPartyOrBox
 	ld a, [wPartyCount]
--- a/engine/mail.asm
+++ b/engine/mail.asm
@@ -175,7 +175,7 @@
 	farcall CheckCurPartyMonFainted
 	ld a, POKEMAIL_LAST_MON
 	jr c, .close_sram_return
-	xor a
+	xor a ; REMOVE_PARTY
 	ld [wPokemonWithdrawDepositParameter], a
 	farcall RemoveMonFromPartyOrBox
 	ld a, POKEMAIL_CORRECT
--- a/engine/move_mon.asm
+++ b/engine/move_mon.asm
@@ -918,7 +918,7 @@
 DepositMonWithDayCareMan: ; de2a
 	ld de, wBreedMon1Nick
 	call DepositBreedmon
-	xor a
+	xor a ; REMOVE_PARTY
 	ld [wPokemonWithdrawDepositParameter], a
 	jp RemoveMonFromPartyOrBox
 ; de37
@@ -926,7 +926,7 @@
 DepositMonWithDayCareLady: ; de37
 	ld de, wBreedMon2Nick
 	call DepositBreedmon
-	xor a
+	xor a ; REMOVE_PARTY
 	ld [wPokemonWithdrawDepositParameter], a
 	jp RemoveMonFromPartyOrBox
 ; de44
--- a/engine/npctrade.asm
+++ b/engine/npctrade.asm
@@ -185,8 +185,8 @@
 	ld a, [wOTTrademonSpecies]
 	ld [wCurPartySpecies], a
 	xor a
-	ld [wMonType], a
-	ld [wPokemonWithdrawDepositParameter], a
+	ld [wMonType], a ; PARTYMON
+	ld [wPokemonWithdrawDepositParameter], a ; REMOVE_PARTY
 	callfar RemoveMonFromPartyOrBox
 	predef TryAddMonToParty
 
--- a/mobile/mobile_40.asm
+++ b/mobile/mobile_40.asm
@@ -5410,7 +5410,7 @@
 	ld a, [wcd4c]
 	dec a
 	ld [wCurPartyMon], a
-	xor a
+	xor a ; REMOVE_PARTY
 	ld [wPokemonWithdrawDepositParameter], a
 	farcall RemoveMonFromPartyOrBox
 	ld hl, wPartyCount
--- a/mobile/mobile_46.asm
+++ b/mobile/mobile_46.asm
@@ -7323,7 +7323,7 @@
 	ld a, [wcd82]
 	dec a
 	ld [wCurPartyMon], a
-	xor a
+	xor a ; REMOVE_PARTY
 	ld [wPokemonWithdrawDepositParameter], a
 	farcall RemoveMonFromPartyOrBox
 	farcall Function170807