movemon and removepokemon wram variables

This commit is contained in:
YamaArashi 2015-07-12 23:36:56 -07:00
parent 4a8c9993ad
commit bcfca2e267
8 changed files with 66 additions and 51 deletions

View file

@ -66,6 +66,12 @@ CANCELLED_MENU EQU 2 ; pressed B
CHOSE_FIRST_ITEM EQU 1 CHOSE_FIRST_ITEM EQU 1
CHOSE_SECOND_ITEM EQU 2 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 ; serial
ESTABLISH_CONNECTION_WITH_INTERNAL_CLOCK EQU $01 ESTABLISH_CONNECTION_WITH_INTERNAL_CLOCK EQU $01

View file

@ -793,7 +793,7 @@ TradeCenter_Trade:
ld a, [hl] ld a, [hl]
ld [wTradedPlayerMonSpecies], a ld [wTradedPlayerMonSpecies], a
xor a xor a
ld [wcf95], a ld [wRemoveMonFromBox], a
call RemovePokemon call RemovePokemon
ld a, [wTradingWhichEnemyMon] ld a, [wTradingWhichEnemyMon]
ld c, a ld c, a

View file

@ -131,7 +131,7 @@ InGameTrade_DoTrade: ; 71c07 (1c:5c07)
ld [wcf91],a ld [wcf91],a
xor a xor a
ld [wcc49],a ld [wcc49],a
ld [wcf95],a ld [wRemoveMonFromBox],a
call RemovePokemon call RemovePokemon
ld a,$80 ld a,$80
ld [wcc49],a ld [wcc49],a

View file

@ -229,11 +229,11 @@ BillsPCDeposit:
ld a, [wcf91] ld a, [wcf91]
call GetCryData call GetCryData
call PlaySoundWaitForCurrent call PlaySoundWaitForCurrent
ld a, $1 ld a, PARTY_TO_BOX
ld [wcf95], a ld [wMoveMonType], a
call MoveMon call MoveMon
xor a xor a
ld [wcf95], a ld [wRemoveMonFromBox], a
call RemovePokemon call RemovePokemon
call WaitForSoundToFinish call WaitForSoundToFinish
ld hl, wWhichTrade ld hl, wWhichTrade
@ -281,11 +281,11 @@ Func_21618: ; 21618 (8:5618)
ld a, [wcf91] ld a, [wcf91]
call GetCryData call GetCryData
call PlaySoundWaitForCurrent call PlaySoundWaitForCurrent
xor a xor a ; BOX_TO_PARTY
ld [wcf95], a ld [wMoveMonType], a
call MoveMon call MoveMon
ld a, $1 ld a, 1
ld [wcf95], a ld [wRemoveMonFromBox], a
call RemovePokemon call RemovePokemon
call WaitForSoundToFinish call WaitForSoundToFinish
ld hl, MonIsTakenOutText ld hl, MonIsTakenOutText
@ -310,7 +310,7 @@ Func_21673: ; 21673 (8:5673)
and a and a
jr nz, .asm_21682 jr nz, .asm_21682
inc a inc a
ld [wcf95], a ld [wRemoveMonFromBox], a
call RemovePokemon call RemovePokemon
call WaitForSoundToFinish call WaitForSoundToFinish
ld a, [wcf91] ld a, [wcf91]

View file

@ -3599,8 +3599,8 @@ CopyDataUntil:: ; 3913 (0:3913)
; Function to remove a pokemon from the party or the current box. ; Function to remove a pokemon from the party or the current box.
; wWhichPokemon determines the pokemon. ; wWhichPokemon determines the pokemon.
; [wcf95] == 0 specifies the party. ; [wRemoveMonFromBox] == 0 specifies the party.
; [wcf95] != 0 specifies the current box. ; [wRemoveMonFromBox] != 0 specifies the current box.
RemovePokemon:: ; 391f (0:391f) RemovePokemon:: ; 391f (0:391f)
ld hl, _RemovePokemon ld hl, _RemovePokemon
ld b, BANK(_RemovePokemon) ld b, BANK(_RemovePokemon)

View file

@ -1916,7 +1916,7 @@ INCLUDE "engine/menu/players_pc.asm"
_RemovePokemon: ; 7b68 (1:7b68) _RemovePokemon: ; 7b68 (1:7b68)
ld hl, wPartyCount ld hl, wPartyCount
ld a, [wcf95] ld a, [wRemoveMonFromBox]
and a and a
jr z, .asm_7b74 jr z, .asm_7b74
ld hl, W_NUMINBOX ld hl, W_NUMINBOX
@ -1939,7 +1939,7 @@ _RemovePokemon: ; 7b68 (1:7b68)
jr nz, .asm_7b81 jr nz, .asm_7b81
ld hl, wPartyMonOT ld hl, wPartyMonOT
ld d, $5 ld d, $5
ld a, [wcf95] ld a, [wRemoveMonFromBox]
and a and a
jr z, .asm_7b97 jr z, .asm_7b97
ld hl, wBoxMonOT ld hl, wBoxMonOT
@ -1958,7 +1958,7 @@ _RemovePokemon: ; 7b68 (1:7b68)
ld bc, $b ld bc, $b
add hl, bc add hl, bc
ld bc, wPartyMonNicks ld bc, wPartyMonNicks
ld a, [wcf95] ld a, [wRemoveMonFromBox]
and a and a
jr z, .asm_7bb8 jr z, .asm_7bb8
ld bc, wBoxMonNicks ld bc, wBoxMonNicks
@ -1966,7 +1966,7 @@ _RemovePokemon: ; 7b68 (1:7b68)
call CopyDataUntil call CopyDataUntil
ld hl, wPartyMons ld hl, wPartyMons
ld bc, wPartyMon2 - wPartyMon1 ld bc, wPartyMon2 - wPartyMon1
ld a, [wcf95] ld a, [wRemoveMonFromBox]
and a and a
jr z, .asm_7bcd jr z, .asm_7bcd
ld hl, wBoxMons ld hl, wBoxMons
@ -1976,7 +1976,7 @@ _RemovePokemon: ; 7b68 (1:7b68)
call AddNTimes call AddNTimes
ld d, h ld d, h
ld e, l ld e, l
ld a, [wcf95] ld a, [wRemoveMonFromBox]
and a and a
jr z, .asm_7be4 jr z, .asm_7be4
ld bc, wBoxMon2 - wBoxMon1 ld bc, wBoxMon2 - wBoxMon1
@ -1990,7 +1990,7 @@ _RemovePokemon: ; 7b68 (1:7b68)
.asm_7beb .asm_7beb
call CopyDataUntil call CopyDataUntil
ld hl, wPartyMonNicks ld hl, wPartyMonNicks
ld a, [wcf95] ld a, [wRemoveMonFromBox]
and a and a
jr z, .asm_7bfa jr z, .asm_7bfa
ld hl, wBoxMonNicks ld hl, wBoxMonNicks
@ -2003,7 +2003,7 @@ _RemovePokemon: ; 7b68 (1:7b68)
ld bc, $b ld bc, $b
add hl, bc add hl, bc
ld bc, wPokedexOwned ld bc, wPokedexOwned
ld a, [wcf95] ld a, [wRemoveMonFromBox]
and a and a
jr z, .asm_7c15 jr z, .asm_7c15
ld bc, wBoxMonNicksEnd ld bc, wBoxMonNicksEnd
@ -3867,12 +3867,12 @@ _AddEnemyMonToPlayerParty: ; f49d (3:749d)
ret ; return success ret ; return success
_MoveMon: ; f51e (3:751e) _MoveMon: ; f51e (3:751e)
ld a, [wcf95] ld a, [wMoveMonType]
and a and a
jr z, .checkPartyMonSlots jr z, .checkPartyMonSlots
cp $2 cp DAYCARE_TO_PARTY
jr z, .checkPartyMonSlots jr z, .checkPartyMonSlots
cp $3 cp PARTY_TO_DAYCARE
ld hl, wDayCareMon ld hl, wDayCareMon
jr z, .asm_f575 jr z, .asm_f575
ld hl, W_NUMINBOX ld hl, W_NUMINBOX
@ -3892,17 +3892,17 @@ _MoveMon: ; f51e (3:751e)
inc a inc a
ld [hl], a ; increment number of mons in party/box ld [hl], a ; increment number of mons in party/box
ld c, a ld c, a
ld b, $0 ld b, 0
add hl, bc add hl, bc
ld a, [wcf95] ld a, [wMoveMonType]
cp $2 cp DAYCARE_TO_PARTY
ld a, [wDayCareMon] ld a, [wDayCareMon]
jr z, .asm_f556 jr z, .asm_f556
ld a, [wcf91] ld a, [wcf91]
.asm_f556 .asm_f556
ld [hli], a ; write new mon ID ld [hli], a ; write new mon ID
ld [hl], $ff ; write new sentinel ld [hl], $ff ; write new sentinel
ld a, [wcf95] ld a, [wMoveMonType]
dec a dec a
ld hl, wPartyMons ld hl, wPartyMons
ld bc, wPartyMon2 - wPartyMon1 ; $2c ld bc, wPartyMon2 - wPartyMon1 ; $2c
@ -3918,12 +3918,12 @@ _MoveMon: ; f51e (3:751e)
push hl push hl
ld e, l ld e, l
ld d, h ld d, h
ld a, [wcf95] ld a, [wMoveMonType]
and a and a
ld hl, wBoxMons ld hl, wBoxMons
ld bc, wBoxMon2 - wBoxMon1 ; $21 ld bc, wBoxMon2 - wBoxMon1 ; $21
jr z, .asm_f591 jr z, .asm_f591
cp $2 cp DAYCARE_TO_PARTY
ld hl, wDayCareMon ld hl, wDayCareMon
jr z, .asm_f597 jr z, .asm_f597
ld hl, wPartyMons ld hl, wPartyMons
@ -3938,10 +3938,10 @@ _MoveMon: ; f51e (3:751e)
call CopyData call CopyData
pop de pop de
pop hl pop hl
ld a, [wcf95] ld a, [wMoveMonType]
and a and a
jr z, .asm_f5b4 jr z, .asm_f5b4
cp $2 cp DAYCARE_TO_PARTY
jr z, .asm_f5b4 jr z, .asm_f5b4
ld bc, wBoxMon2 - wBoxMon1 ld bc, wBoxMon2 - wBoxMon1
add hl, bc add hl, bc
@ -3951,8 +3951,8 @@ _MoveMon: ; f51e (3:751e)
inc de inc de
ld [de], a ld [de], a
.asm_f5b4 .asm_f5b4
ld a, [wcf95] ld a, [wMoveMonType]
cp $3 cp PARTY_TO_DAYCARE
ld de, W_DAYCAREMONOT ld de, W_DAYCAREMONOT
jr z, .asm_f5d3 jr z, .asm_f5d3
dec a dec a
@ -3968,11 +3968,11 @@ _MoveMon: ; f51e (3:751e)
ld e, l ld e, l
.asm_f5d3 .asm_f5d3
ld hl, wBoxMonOT ld hl, wBoxMonOT
ld a, [wcf95] ld a, [wMoveMonType]
and a and a
jr z, .asm_f5e6 jr z, .asm_f5e6
ld hl, W_DAYCAREMONOT ld hl, W_DAYCAREMONOT
cp $2 cp DAYCARE_TO_PARTY
jr z, .asm_f5ec jr z, .asm_f5ec
ld hl, wPartyMonOT ld hl, wPartyMonOT
.asm_f5e6 .asm_f5e6
@ -3981,8 +3981,8 @@ _MoveMon: ; f51e (3:751e)
.asm_f5ec .asm_f5ec
ld bc, $b ld bc, $b
call CopyData call CopyData
ld a, [wcf95] ld a, [wMoveMonType]
cp $3 cp PARTY_TO_DAYCARE
ld de, W_DAYCAREMONNAME ld de, W_DAYCAREMONNAME
jr z, .asm_f611 jr z, .asm_f611
dec a dec a
@ -3998,11 +3998,11 @@ _MoveMon: ; f51e (3:751e)
ld e, l ld e, l
.asm_f611 .asm_f611
ld hl, wBoxMonNicks ld hl, wBoxMonNicks
ld a, [wcf95] ld a, [wMoveMonType]
and a and a
jr z, .asm_f624 jr z, .asm_f624
ld hl, W_DAYCAREMONNAME ld hl, W_DAYCAREMONNAME
cp $2 cp DAYCARE_TO_PARTY
jr z, .asm_f62a jr z, .asm_f62a
ld hl, wPartyMonNicks ld hl, wPartyMonNicks
.asm_f624 .asm_f624
@ -4012,10 +4012,10 @@ _MoveMon: ; f51e (3:751e)
ld bc, $b ld bc, $b
call CopyData call CopyData
pop hl pop hl
ld a, [wcf95] ld a, [wMoveMonType]
cp $1 cp PARTY_TO_BOX
jr z, .asm_f664 jr z, .asm_f664
cp $3 cp PARTY_TO_DAYCARE
jr z, .asm_f664 jr z, .asm_f664
push hl push hl
srl a srl a

View file

@ -45,13 +45,13 @@ DayCareMText1: ; 56254 (15:6254)
call GetPartyMonName call GetPartyMonName
ld hl, DayCareMText_56419 ld hl, DayCareMText_56419
call PrintText call PrintText
ld a, $1 ld a, 1
ld [W_DAYCARE_IN_USE], a ld [W_DAYCARE_IN_USE], a
ld a, $3 ld a, PARTY_TO_DAYCARE
ld [wcf95], a ld [wMoveMonType], a
call MoveMon call MoveMon
xor a xor a
ld [wcf95], a ld [wRemoveMonFromBox], a
call RemovePokemon call RemovePokemon
ld a, [wcf91] ld a, [wcf91]
call PlayCry call PlayCry
@ -163,21 +163,21 @@ DayCareMScript_562e1: ; 562e1 (15:62e1)
call DisplayTextBoxID call DisplayTextBoxID
ld hl, DayCareMText_5644f ld hl, DayCareMText_5644f
call PrintText call PrintText
ld a, $2 ld a, DAYCARE_TO_PARTY
ld [wcf95], a ld [wMoveMonType], a
call MoveMon call MoveMon
ld a, [wDayCareMonSpecies] ld a, [wDayCareMonSpecies]
ld [wcf91], a ld [wcf91], a
ld a, [wPartyCount] ld a, [wPartyCount]
dec a dec a
push af push af
ld bc, $002c ld bc, wPartyMon2 - wPartyMon1
push bc push bc
ld hl, wPartyMon1Moves ld hl, wPartyMon1Moves
call AddNTimes call AddNTimes
ld d, h ld d, h
ld e, l ld e, l
ld a, $1 ld a, 1
ld [wHPBarMaxHP], a ld [wHPBarMaxHP], a
predef WriteMonMoves predef WriteMonMoves
pop bc pop bc
@ -186,7 +186,7 @@ DayCareMScript_562e1: ; 562e1 (15:62e1)
call AddNTimes call AddNTimes
ld d, h ld d, h
ld e, l ld e, l
ld bc, $0021 ld bc, wPartyMon1MaxHP - wPartyMon1HP
add hl, bc add hl, bc
ld a, [hli] ld a, [hli]
ld [de], a ld [de], a

View file

@ -851,7 +851,16 @@ wListMenuID:: ; cf94
; ID used by DisplayListMenuID ; ID used by DisplayListMenuID
ds 1 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 wItemQuantity:: ; cf96
ds 1 ds 1