ref: 0066e09828265cc1cc83eca27e6be76911f187ec
parent: f66a74b9fcb762d693e89415836386bcad2475b5
author: YamaArashi <shadow962@live.com>
date: Mon Jul 13 11:40:33 EDT 2015
named party menu/naming screen wram variables
--- a/constants/misc_constants.asm
+++ b/constants/misc_constants.asm
@@ -85,6 +85,30 @@
SLOTSBIRD EQU $1210
SLOTSMOUSE EQU $1614
+; party menu types
+NORMAL_PARTY_MENU EQU 0
+USE_ITEM_PARTY_MENU EQU 1
+BATTLE_PARTY_MENU EQU 2
+TMHM_PARTY_MENU EQU 3
+SWAP_MONS_PARTY_MENU EQU 4
+EVO_STONE_PARTY_MENU EQU 5
+
+; party memu message IDs
+ANTIDOTE_MSG EQU $F0
+BURN_HEAL_MSG EQU $F1
+ICE_HEAL_MSG EQU $F2
+AWAKENING_MSG EQU $F3
+PARALYZ_HEAL_MSG EQU $F4
+POTION_MSG EQU $F5
+FULL_HEAL_MSG EQU $F6
+REVIVE_MSG EQU $F7
+RARE_CANDY_MSG EQU $F8
+
+; naming screen types
+NAME_PLAYER_SCREEN EQU 0
+NAME_RIVAL_SCREEN EQU 1
+NAME_MON_SCREEN EQU 2
+
; serial
ESTABLISH_CONNECTION_WITH_INTERNAL_CLOCK EQU $01
--- a/engine/battle/animations.asm
+++ b/engine/battle/animations.asm
@@ -336,7 +336,7 @@
ld d,0
add hl,de
ld a,[hli]
- ld [wd07d],a ; number of tiles
+ ld [wTempTilesetNumTiles],a ; number of tiles
ld a,[hli]
ld e,a
ld a,[hl]
@@ -343,7 +343,7 @@
ld d,a ; de = address of tileset
ld hl,vSprites + $310
ld b, BANK(AnimationTileset1) ; ROM bank
- ld a,[wd07d]
+ ld a,[wTempTilesetNumTiles]
ld c,a ; number of tiles
jp CopyVideoData ; load tileset
--- a/engine/battle/core.asm
+++ b/engine/battle/core.asm
@@ -1162,8 +1162,8 @@
; choose next player mon to send out
; stores whether enemy mon has no HP left in Z flag
ChooseNextMon: ; 3c7d8 (f:47d8)
- ld a, $2
- ld [wd07d], a
+ ld a, BATTLE_PARTY_MENU
+ ld [wPartyMenuTypeOrMessageID], a
call DisplayPartyMenu
.checkIfMonChosen
jr nc, .monChosen
@@ -1462,8 +1462,8 @@
ld a,[wCurrentMenuItem]
and a
jr nz,.next4
- ld a,2
- ld [wd07d],a
+ ld a,BATTLE_PARTY_MENU
+ ld [wPartyMenuTypeOrMessageID],a
call DisplayPartyMenu
.next9
ld a,1
@@ -2384,8 +2384,8 @@
jp UseBagItem
.partyMenuWasSelected
call LoadScreenTilesFromBuffer1
- xor a
- ld [wd07d], a
+ xor a ; NORMAL_PARTY_MENU
+ ld [wPartyMenuTypeOrMessageID], a
ld [wMenuItemToSwap], a
call DisplayPartyMenu
.checkIfPartyMonWasSelected
@@ -2403,8 +2403,8 @@
ld bc, $81
ld a, $7f
call FillMemory
- xor a
- ld [wd07d], a
+ xor a ; NORMAL_PARTY_MENU
+ ld [wPartyMenuTypeOrMessageID], a
call GoBackToPartyMenu
jr .checkIfPartyMonWasSelected
.partyMonWasSelected
--- a/engine/in_game_trades.asm
+++ b/engine/in_game_trades.asm
@@ -87,8 +87,8 @@
INCLUDE "data/trades.asm"
InGameTrade_DoTrade: ; 71c07 (1c:5c07)
- xor a
- ld [wd07d],a
+ xor a ; NORMAL_PARTY_MENU
+ ld [wPartyMenuTypeOrMessageID],a
dec a
ld [wUpdateSpritesEnabled],a
call DisplayPartyMenu
--- a/engine/items/items.asm
+++ b/engine/items/items.asm
@@ -633,8 +633,8 @@
ld a,[wcf91]
ld [wd156],a
push af
- ld a,$05 ; evolution stone party menu
- ld [wd07d],a
+ ld a,EVO_STONE_PARTY_MENU
+ ld [wPartyMenuTypeOrMessageID],a
ld a,$ff
ld [wUpdateSpritesEnabled],a
call DisplayPartyMenu
@@ -678,8 +678,8 @@
push af
ld a,[wcf91]
push af
- ld a,$01
- ld [wd07d],a ; item use party menu
+ ld a,USE_ITEM_PARTY_MENU
+ ld [wPartyMenuTypeOrMessageID],a
ld a,$ff
ld [wUpdateSpritesEnabled],a
ld a,[wd152]
@@ -737,22 +737,22 @@
ld bc,4
add hl,bc ; hl now points to status
ld a,[wcf91]
- ld bc,$f008
+ ld bc, (ANTIDOTE_MSG << 8) | (1 << PSN)
cp a,ANTIDOTE
jr z,.checkMonStatus
- ld bc,$f110
+ ld bc, (BURN_HEAL_MSG << 8) | (1 << BRN)
cp a,BURN_HEAL
jr z,.checkMonStatus
- ld bc,$f220
+ ld bc, (ICE_HEAL_MSG << 8) | (1 << FRZ)
cp a,ICE_HEAL
jr z,.checkMonStatus
- ld bc,$f307
+ ld bc, (AWAKENING_MSG << 8) | SLP
cp a,AWAKENING
jr z,.checkMonStatus
- ld bc,$f440
+ ld bc, (PARALYZ_HEAL_MSG << 8) | (1 << PAR)
cp a,PARLYZ_HEAL
jr z,.checkMonStatus
- ld bc,$f6ff ; Full Heal
+ ld bc, (FULL_HEAL_MSG << 8) | $ff ; Full Heal
.checkMonStatus
ld a,[hl] ; pokemon's status
and c ; does the pokemon have a status ailment the item can cure?
@@ -761,7 +761,7 @@
xor a
ld [hl],a ; remove the status ailment in the party data
ld a,b
- ld [wd07d],a ; the message to display for the item used
+ ld [wPartyMenuTypeOrMessageID],a ; the message to display for the item used
ld a,[wPlayerMonNumber]
cp d ; is pokemon the item was used on active in battle?
jp nz,.doneHealing
@@ -1078,15 +1078,15 @@
ld a,[hFlags_0xFFF6]
res 0,a
ld [hFlags_0xFFF6],a
- ld a,$f7 ; revived message
- ld [wd07d],a
+ ld a,REVIVE_MSG
+ ld [wPartyMenuTypeOrMessageID],a
ld a,[wcf91]
cp a,REVIVE
jr z,.showHealingItemMessage
cp a,MAX_REVIVE
jr z,.showHealingItemMessage
- ld a,$f5 ; standard HP healed message
- ld [wd07d],a
+ ld a,POTION_MSG
+ ld [wPartyMenuTypeOrMessageID],a
jr .showHealingItemMessage
.playStatusAilmentCuringSound
ld a,(SFX_02_3e - SFX_Headers_02) / 3 ; status ailment curing sound
@@ -1257,8 +1257,8 @@
ld a,[hl]
adc b
ld [hl],a
- ld a,$f8 ; level up message
- ld [wd07d],a
+ ld a,RARE_CANDY_MSG
+ ld [wPartyMenuTypeOrMessageID],a
call RedrawPartyMenu
pop de
ld a,d
@@ -1878,8 +1878,8 @@
.chooseMon
xor a
ld [wUpdateSpritesEnabled],a
- ld a,$01 ; item use party menu
- ld [wd07d],a
+ ld a,USE_ITEM_PARTY_MENU
+ ld [wPartyMenuTypeOrMessageID],a
call DisplayPartyMenu
jr nc,.chooseMove
jp .itemNotUsed
@@ -2118,8 +2118,8 @@
call CopyData
ld a,$ff
ld [wUpdateSpritesEnabled],a
- ld a,$03 ; teach TM/HM party menu
- ld [wd07d],a
+ ld a,TMHM_PARTY_MENU
+ ld [wPartyMenuTypeOrMessageID],a
call DisplayPartyMenu
push af
ld hl,wd036
@@ -2650,8 +2650,8 @@
jr nz, .asm_e817
.asm_e82a
ld hl, wBoxMonNicks
- ld a, $2
- ld [wd07d], a
+ ld a, NAME_MON_SCREEN
+ ld [wNamingScreenType], a
predef AskName
ld a, [W_NUMINBOX]
dec a
--- a/engine/menu/naming_screen.asm
+++ b/engine/menu/naming_screen.asm
@@ -27,8 +27,8 @@
xor a
ld [wUpdateSpritesEnabled], a
push hl
- ld a, $2
- ld [wd07d], a
+ ld a, NAME_MON_SCREEN
+ ld [wNamingScreenType], a
call DisplayNamingScreen
ld a, [W_ISINBATTLE]
and a
@@ -53,12 +53,12 @@
TX_FAR _DoYouWantToNicknameText
db "@"
-Func_655c: ; 655c (1:655c)
+DisplayNameRaterScreen: ; 655c (1:655c)
ld hl, wHPBarMaxHP
xor a
ld [wUpdateSpritesEnabled], a
- ld a, $2
- ld [wd07d], a
+ ld a, NAME_MON_SCREEN
+ ld [wNamingScreenType], a
call DisplayNamingScreen
call GBPalWhiteOutWithDelay3
call RestoreScreenTilesAndReloadTilePatterns
@@ -236,8 +236,8 @@
cp $e4
ld de, Handakutens
jr z, .asm_66e3
- ld a, [wd07d]
- cp $2
+ ld a, [wNamingScreenType]
+ cp NAME_MON_SCREEN
jr nc, .checkMonNameLength
ld a, [wHPBarMaxHP]
cp $7 ; max length of player/rival names
@@ -377,8 +377,8 @@
ld de, wcf4b
call PlaceString
hlCoord 10, 3
- ld a, [wd07d]
- cp $2
+ ld a, [wNamingScreenType]
+ cp NAME_MON_SCREEN
jr nc, .asm_6835
ld b, $7
jr .asm_6837
@@ -390,8 +390,8 @@
ld [hli], a
dec b
jr nz, .asm_6839
- ld a, [wd07d]
- cp $2
+ ld a, [wNamingScreenType]
+ cp NAME_MON_SCREEN
ld a, [wHPBarMaxHP]
jr nc, .asm_684b
cp $7
@@ -405,8 +405,8 @@
ld [wTopMenuItemX], a
ld a, $5
ld [wCurrentMenuItem], a
- ld a, [wd07d]
- cp $2
+ ld a, [wNamingScreenType]
+ cp NAME_MON_SCREEN
ld a, $9
jr nc, .asm_6867
ld a, $6
@@ -462,7 +462,7 @@
PrintNamingText: ; 68f8 (1:68f8)
hlCoord 0, 1
- ld a, [wd07d]
+ ld a, [wNamingScreenType]
ld de, YourTextString
and a
jr z, .notNickname
--- a/engine/menu/party_menu.asm
+++ b/engine/menu/party_menu.asm
@@ -1,4 +1,4 @@
-; [wd07d] = menu type / message ID
+; [wPartyMenuTypeOrMessageID] = menu type / message ID
; if less than $F0, it is a menu type
; menu types:
; 00: normal pokemon menu (e.g. Start menu)
@@ -25,11 +25,11 @@
callba LoadMonPartySpriteGfxWithLCDDisabled ; load pokemon icon graphics
RedrawPartyMenu_: ; 12ce3 (4:6ce3)
- ld a,[wd07d]
- cp a,$04
+ ld a,[wPartyMenuTypeOrMessageID]
+ cp a,SWAP_MONS_PARTY_MENU
jp z,.printMessage
call ErasePartyMenuCursors
- callba SendBlkPacket_PartyMenu ; loads some data to wcf2e
+ callba SendBlkPacket_PartyMenu
hlCoord 3, 0
ld de,wPartySpecies
xor a
@@ -75,10 +75,10 @@
inc hl
inc hl
.skipUnfilledRightArrow
- ld a,[wd07d] ; menu type
- cp a,$03
+ ld a,[wPartyMenuTypeOrMessageID] ; menu type
+ cp a,TMHM_PARTY_MENU
jr z,.teachMoveMenu
- cp a,$05
+ cp a,EVO_STONE_PARTY_MENU
jr z,.evolutionStoneMenu
push hl
ld bc,14 ; 14 columns to the right
@@ -196,7 +196,7 @@
push af
push hl
set 6,[hl] ; turn off letter printing delay
- ld a,[wd07d] ; message ID
+ ld a,[wPartyMenuTypeOrMessageID] ; message ID
cp a,$F0
jr nc,.printItemUseMessage
add a
--- a/engine/menu/start_sub_menus.asm
+++ b/engine/menu/start_sub_menus.asm
@@ -12,7 +12,7 @@
jp z,RedisplayStartMenu
xor a
ld [wMenuItemToSwap],a
- ld [wd07d],a
+ ld [wPartyMenuTypeOrMessageID],a
ld [wUpdateSpritesEnabled],a
call DisplayPartyMenu
jr .checkIfPokemonChosen
@@ -19,7 +19,7 @@
.loop
xor a
ld [wMenuItemToSwap],a
- ld [wd07d],a
+ ld [wPartyMenuTypeOrMessageID],a
call GoBackToPartyMenu
.checkIfPokemonChosen
jr nc,.chosePokemon
@@ -89,8 +89,8 @@
cp a,2 ; is there more than one pokemon in the party?
jp c,StartMenu_Pokemon ; if not, no switching
call SwitchPartyMon_Stats
- ld a,$04 ; swap pokemon positions menu
- ld [wd07d],a
+ ld a,SWAP_MONS_PARTY_MENU
+ ld [wPartyMenuTypeOrMessageID],a
call GoBackToPartyMenu
jp .checkIfPokemonChosen
.choseStats
@@ -747,7 +747,7 @@
ret
.asm_13661
xor a
- ld [wd07d], a
+ ld [wPartyMenuTypeOrMessageID], a
ld a, [wMenuItemToSwap]
dec a
ld b, a
@@ -757,7 +757,7 @@
jr nz, .asm_1367b
xor a
ld [wMenuItemToSwap], a
- ld [wd07d], a
+ ld [wPartyMenuTypeOrMessageID], a
ret
.asm_1367b
ld a, b
@@ -845,7 +845,7 @@
ld [wWhichTrade], a
xor a
ld [wMenuItemToSwap], a
- ld [wd07d], a
+ ld [wPartyMenuTypeOrMessageID], a
pop de
pop hl
ret
--- a/engine/oak_speech2.asm
+++ b/engine/oak_speech2.asm
@@ -12,8 +12,8 @@
jr .asm_6999
.asm_697a
ld hl, wPlayerName
- xor a
- ld [wd07d], a
+ xor a ; NAME_PLAYER_SCREEN
+ ld [wNamingScreenType], a
call DisplayNamingScreen
ld a, [wcf4b]
cp $50
@@ -45,8 +45,8 @@
jr .asm_69e1
.asm_69c1
ld hl, W_RIVALNAME
- ld a, $1
- ld [wd07d], a
+ ld a, NAME_RIVAL_SCREEN
+ ld [wNamingScreenType], a
call DisplayNamingScreen
ld a, [wcf4b]
cp $50
--- a/home.asm
+++ b/home.asm
@@ -456,7 +456,7 @@
callba ErasePartyMenuCursors
xor a
ld [wMenuItemToSwap],a
- ld [wd07d],a
+ ld [wPartyMenuTypeOrMessageID],a
call RedrawPartyMenu
jr HandlePartyMenuInput
.handleSwap
--- a/main.asm
+++ b/main.asm
@@ -3582,8 +3582,8 @@
ld a, [$ffe4]
dec a
call SkipFixedLengthTextEntries
- ld a, $2
- ld [wd07d], a
+ ld a, NAME_MON_SCREEN
+ ld [wNamingScreenType], a
predef AskName
.asm_f33f
ld hl, wPartyMons
--- a/scripts/daycarem.asm
+++ b/scripts/daycarem.asm
@@ -25,7 +25,7 @@
call PrintText
xor a
ld [wUpdateSpritesEnabled], a
- ld [wd07d], a
+ ld [wPartyMenuTypeOrMessageID], a
ld [wMenuItemToSwap], a
call DisplayPartyMenu
push af
--- a/scripts/namerater.asm
+++ b/scripts/namerater.asm
@@ -49,7 +49,7 @@
ld hl, NameRaterText_1dab8
call PrintText
xor a
- ld [wd07d], a
+ ld [wPartyMenuTypeOrMessageID], a
ld [wUpdateSpritesEnabled], a
ld [wMenuItemToSwap], a
call DisplayPartyMenu
@@ -68,7 +68,7 @@
jr nz, .asm_1daae
ld hl, NameRaterText_1dac2
call PrintText
- callba Func_655c
+ callba DisplayNameRaterScreen
jr c, .asm_1daae
ld hl, NameRaterText_1dac7
.asm_1daa8
--- a/wram.asm
+++ b/wram.asm
@@ -1232,7 +1232,13 @@
; ID number of the current battle animation
ds 1
-wd07d:: ds 1 ; used with naming functions and party display type
+wNamingScreenType:: ; d07d
+
+wPartyMenuTypeOrMessageID:: ; d07d
+
+wTempTilesetNumTiles:: ; d07d
+; temporary storage for the number of tiles in a tileset
+ ds 1
wSavedListScrollOffset:: ; d07e
; used by the pokemart code to save the existing value of wListScrollOffset