shithub: pokered

Download patch

ref: 1cf79b6f15761ec95ba1b0f9d6d83781c4240612
parent: 8dd46620bc7e17c4c582a391fb95c9e29ef58576
author: yenatch <yenatch@gmail.com>
date: Thu Aug 7 17:17:44 EDT 2014

Fix static banks passed into GetName.

This appears to be the only other use of wPredefBank.

Chances are there are more uncaught banks. Known cases are marked as "hardcoded" or similar.

--- a/engine/battle/4_2.asm
+++ b/engine/battle/4_2.asm
@@ -391,7 +391,7 @@
 	ld [wd0b5], a
 	ld a, TRAINER_NAME
 	ld [W_LISTTYPE], a
-	ld a, $e
+	ld a, BANK(TrainerNames)
 	ld [wPredefBank], a
 	call GetName
 	ld hl, wcd6d
--- a/engine/battle/core.asm
+++ b/engine/battle/core.asm
@@ -2184,7 +2184,9 @@
 	jr Func_3d03c
 
 OldManItemList: ; 3d02d (f:502d)
-	db $01, POKE_BALL, 50, $ff
+	db 1 ; # items
+	db POKE_BALL, 50
+	db -1
 
 Func_3d031
 	ld hl, wNumBagItems ; wNumBagItems
@@ -5471,7 +5473,7 @@
 	res 6, [hl] ; no longer invulnerable to typcial attacks
 	ld a, [W_ENEMYMOVENUM] ; W_ENEMYMOVENUM
 	ld [wd0b5], a
-	ld a, $2c
+	ld a, BANK(MoveNames)
 	ld [wPredefBank], a
 	ld a, MOVE_NAME
 	ld [W_LISTTYPE], a
@@ -5950,10 +5952,11 @@
 	call AddNTimes
 	ld a, BANK(Moves)
 	call FarCopyData
-	ld a, $2c
+
+	ld a, BANK(MoveNames)
 	ld [wPredefBank], a
-	ld a, $2
-	ld [W_LISTTYPE], a ; list type 2 = move name
+	ld a, MOVE_NAME
+	ld [W_LISTTYPE], a
 	call GetName
 	ld de, wcd6d
 	jp CopyStringToCF4B
--- a/engine/battle/e.asm
+++ b/engine/battle/e.asm
@@ -587,7 +587,7 @@
 	jr z, .asm_39bc1
 	push hl
 	ld [wd0b5], a
-	ld a, $2c
+	ld a, BANK(MoveNames)
 	ld [wPredefBank], a
 	ld a, MOVE_NAME
 	ld [W_LISTTYPE], a
--- a/engine/evos_moves.asm
+++ b/engine/evos_moves.asm
@@ -135,7 +135,7 @@
 	ld [wHPBarMaxHP + 1], a
 	ld a, MONSTER_NAME
 	ld [W_LISTTYPE], a
-	ld a, $e
+	ld a, BANK(TrainerNames) ; bank is not used for monster names
 	ld [wPredefBank], a
 	call GetName
 	push hl
--- a/home.asm
+++ b/home.asm
@@ -2044,7 +2044,7 @@
 .skipGettingQuantity
 	ld a,[wcf91]
 	ld [wd0b5],a
-	ld a,$01
+	ld a,BANK(ItemNames)
 	ld [wPredefBank],a
 	call GetName
 	jr .storeChosenEntry
@@ -3782,7 +3782,7 @@
 ; returns pointer to name in de
 	ld a,[wd0b5]
 	ld [wd11e],a
-	cp a,$C4        ;it's TM/HM
+	cp HM_01
 	jp nc,GetMachineName
 	ld a,[H_LOADEDROMBANK]
 	push af
@@ -3858,8 +3858,8 @@
 	ld a, [H_LOADEDROMBANK]
 	push af
 	ld a, [wListMenuID] ; wListMenuID
-	cp $1
-	ld a, $1 ; hardcoded Bank
+	cp MOVESLISTMENU
+	ld a, BANK(ItemPrices)
 	jr nz, .asm_37ed
 	ld a, $f ; hardcoded Bank
 .asm_37ed