shithub: pokered

Download patch

ref: cdaf8e3d9a8fe4c3e9c53269424aada468fdb6ab
parent: 4b11f36a0aff0751dedf2b536b40b5424b3b3871
author: Sawakita <sawakitanoodles@gmail.com>
date: Sun Jan 8 18:45:46 EST 2012

Add function to get a monster's name from a given id (internal order).

hg-commit-id: 42e7deffd9b8


--- a/constants.asm
+++ b/constants.asm
@@ -137,9 +137,15 @@
 
 W_ISLINKBATTLE EQU $D12B
 
+W_PRIZE1 EQU $D13D
+W_PRIZE2 EQU $D13E
+W_PRIZE3 EQU $D13F
+
 W_PLAYERNAME EQU $D158 ; 11 characters, including null
 
 W_NUMINPARTY EQU $D163
+
+W_NUMBAGITEMS EQU $D31D
 
 W_RIVALNAME  EQU $D34A ; 11 characters, including null
 
--- a/pokered.asm
+++ b/pokered.asm
@@ -1003,7 +1003,32 @@
 	db $FE,7,ULTRA_BALL,GREAT_BALL,FULL_RESTORE,MAX_POTION,FULL_HEAL
 	db REVIVE,MAX_REPEL,$FF
 
-INCBIN "baserom.gbc",$24D6,$2FCF - $24D6
+INCBIN "baserom.gbc",$24D6,$2F9E - $24D6
+GetMonsterName: ; 2F9E
+	push hl
+	ld a,[$ffb8]
+	push af
+	ld a,BANK(MonsterNames) ; 07
+	ld [$ffb8],a
+	ld [$2000],a
+	ld a,[$d11e]
+	dec a
+	ld hl,MonsterNames ; 421E
+	ld c,10
+	ld b,0
+	call AddNTimes
+	ld de,$cd6d
+	push de
+	ld bc,10
+	call CopyData
+	ld hl,$cd77
+	ld [hl],$50
+	pop de
+	pop af
+	ld [$ffb8],a
+	ld [$2000],a
+	pop hl
+	ret
 
 GetItemName: ; 2FCF
 ; given an item ID at [$D11E], store the name of the item into a string
@@ -1247,7 +1272,7 @@
 	dec a
 	jr nz,.otherEntries\@
 	;1 = MON_NAMES
-	call $2f9e; GetMonName
+	call GetMonsterName
 	ld hl,11
 	add hl,de
 	ld e,l