shithub: pokecrystal

Download patch

ref: 38bf21ae35504355b5c67f911c2e003c61c015b4
parent: 60b09f291d22f72838e29c91cd62ff0d041e2332
author: Rangi <remy.oukaour+rangi42@gmail.com>
date: Sun Sep 16 12:02:58 EDT 2018

Naming screen constants

--- a/constants/menu_constants.asm
+++ b/constants/menu_constants.asm
@@ -93,3 +93,15 @@
 	const PARTYMENUTEXT_REVIVE
 	const PARTYMENUTEXT_LEVEL_UP
 	const PARTYMENUTEXT_HEAL_CONFUSION
+
+; Naming types (see engine/menus/naming_screen.asm)
+	const_def
+	const NAME_MON
+	const NAME_PLAYER
+	const NAME_RIVAL
+	const NAME_MOM
+	const NAME_BOX
+	const NAME_FRIEND
+	const NAME_6 ; duplicate of NAME_MON
+	const NAME_7 ; duplicate of NAME_MON
+NUM_NAME_TYPES EQU const_value
--- a/engine/events/name_rater.asm
+++ b/engine/events/name_rater.asm
@@ -32,7 +32,7 @@
 	ld [wNamedObjectIndexBuffer], a
 	ld [wCurSpecies], a
 	call GetBaseData
-	ld b, 0
+	ld b, NAME_MON
 	ld de, wStringBuffer2
 	farcall _NamingScreen
 ; If the new name is empty, treat it as unchanged.
--- a/engine/events/specials.asm
+++ b/engine/events/specials.asm
@@ -84,7 +84,7 @@
 	ret
 
 NameRival:
-	ld b, $2 ; rival
+	ld b, NAME_RIVAL
 	ld de, wRivalName
 	farcall _NamingScreen
 	; default to "SILVER"
--- a/engine/items/item_effects.asm
+++ b/engine/items/item_effects.asm
@@ -584,7 +584,7 @@
 	push de
 	xor a ; PARTYMON
 	ld [wMonType], a
-	ld b, 0
+	ld b, NAME_MON
 	farcall NamingScreen
 
 	call RotateThreePalettesRight
@@ -637,7 +637,7 @@
 	ld a, BOXMON
 	ld [wMonType], a
 	ld de, wMonOrItemNameBuffer
-	ld b, $0
+	ld b, NAME_MON
 	farcall NamingScreen
 
 	ld a, BANK(sBoxMonNicknames)
--- a/engine/menus/intro_menu.asm
+++ b/engine/menus/intro_menu.asm
@@ -747,7 +747,7 @@
 	ret
 
 .NewName:
-	ld b, 1
+	ld b, NAME_PLAYER
 	ld de, wPlayerName
 	farcall NamingScreen
 
--- a/engine/menus/naming_screen.asm
+++ b/engine/menus/naming_screen.asm
@@ -61,7 +61,7 @@
 
 .GetNamingScreenSetup:
 	ld a, [wNamingScreenType]
-	and 7
+	maskbits NUM_NAME_TYPES
 	ld e, a
 	ld d, 0
 	ld hl, .Jumptable
@@ -73,6 +73,7 @@
 	jp hl
 
 .Jumptable:
+; entries correspond to NAME_* constants
 	dw .Pokemon
 	dw .Player
 	dw .Rival
--- a/engine/pokemon/bills_pc.asm
+++ b/engine/pokemon/bills_pc.asm
@@ -2454,7 +2454,7 @@
 	ret
 
 .Name:
-	ld b, $4 ; box
+	ld b, NAME_BOX
 	ld de, wd002
 	farcall NamingScreen
 	call ClearTileMap
--- a/engine/pokemon/breeding.asm
+++ b/engine/pokemon/breeding.asm
@@ -330,7 +330,7 @@
 	xor a
 	ld [wMonType], a
 	push de
-	ld b, $0
+	ld b, NAME_MON
 	farcall NamingScreen
 	pop hl
 	ld de, wStringBuffer1
--- a/engine/pokemon/move_mon.asm
+++ b/engine/pokemon/move_mon.asm
@@ -1809,7 +1809,7 @@
 	call DisableSpriteUpdates
 	pop de
 	push de
-	ld b, $0
+	ld b, NAME_MON
 	farcall NamingScreen
 	pop hl
 	ld de, wStringBuffer1
--- a/mobile/mobile_22.asm
+++ b/mobile/mobile_22.asm
@@ -3487,7 +3487,7 @@
 Function8a78c:
 	call Function891fe
 	ld de, wd002
-	ld b, $5
+	ld b, NAME_FRIEND
 	farcall NamingScreen
 	call OpenSRAMBank4
 	call Function8931b