shithub: pokered

Download patch

ref: f6d618090aa689540056a13fb74125d83879347f
parent: 0750db0d72227bb982c8db7c999521fc505aefc9
author: YamaArashi <shadow962@live.com>
date: Thu Aug 13 15:13:47 EDT 2015

Named a test battle variable

--- a/constants/misc_constants.asm
+++ b/constants/misc_constants.asm
@@ -164,6 +164,9 @@
 HP_BAR_YELLOW EQU 1
 HP_BAR_RED    EQU 2
 
+; D733 flags
+BIT_TEST_BATTLE EQU 0
+
 ; serial
 
 ESTABLISH_CONNECTION_WITH_INTERNAL_CLOCK EQU $01
--- a/engine/battle/core.asm
+++ b/engine/battle/core.asm
@@ -2634,7 +2634,7 @@
 	cp LINK_STATE_BATTLING
 	jr z, .matchedkeyspicked
 	ld a, [W_FLAGS_D733]
-	bit 0, a
+	bit BIT_TEST_BATTLE, a
 	ld b, D_UP | D_DOWN | A_BUTTON | B_BUTTON | SELECT
 	jr z, .matchedkeyspicked
 	ld b, $ff
@@ -2662,7 +2662,7 @@
 	jr .select
 .battleselect
 	ld a, [W_FLAGS_D733]
-	bit 0, a
+	bit BIT_TEST_BATTLE, a
 	jr nz, .select
 	call PrintMenuItem
 	ld a, [wMenuItemToSwap]
@@ -6170,8 +6170,8 @@
 .player
 	ld de, W_PLAYERMOVENUM
 	ld a, [W_FLAGS_D733]
-	bit 0, a
-	ld a, [wccd9]
+	bit BIT_TEST_BATTLE, a
+	ld a, [wTestBattlePlayerSelectedMove]
 	jr nz, .selected
 	ld a, [wPlayerSelectedMove]
 .selected
--- a/engine/battle/init_battle_variables.asm
+++ b/engine/battle/init_battle_variables.asm
@@ -25,8 +25,8 @@
 	ld [hli], a
 	dec b
 	jr nz, .loop
-	inc a
-	ld [wccd9], a
+	inc a ; POUND
+	ld [wTestBattlePlayerSelectedMove], a
 	ld a, [W_CURMAP]
 	cp SAFARI_ZONE_EAST
 	jr c, .notSafariBattle
--- a/wram.asm
+++ b/wram.asm
@@ -577,8 +577,13 @@
 wEnemySubstituteHP:: ; ccd8
 	ds 1
 
-wccd9:: ds 2 ; used in InitBattleVariablesLoop (written to after the loop is finished)
+wTestBattlePlayerSelectedMove:: ; ccd9
+; The player's selected move during a test battle.
+; InitBattleVariables sets it to the move Pound.
+	ds 1
 
+	ds 1
+
 wMoveMenuType:: ; ccdb
 ; 0=regular, 1=mimic, 2=above message box (relearn, heal pp..)
 	ds 1
@@ -2951,6 +2956,7 @@
 	ds 1
 
 W_FLAGS_D733:: ; d733
+; bit 0: running a test battle
 ; bit 4: use variable [W_CURMAPSCRIPT] instead of the provided index for next frame's map script (used to start battle when talking to trainers)
 ; bit 7: used fly out of battle
 	ds 1