shithub: pokecrystal

Download patch

ref: 41f39211ca3448ee79a6c65757bd703f247442fd
parent: 2746288030ff3bd4febc43c1c9fe8a203272b927
author: mid-kid <[email protected]>
date: Thu Nov 22 07:32:24 EST 2018

Identified another user of wBattleAnimTemp

QueueBattleAnimation loads an object using these wram addresses. Usually
populated by the anim_obj command, but in a couple of cases also
manually.

--- a/engine/battle_anims/anim_commands.asm
+++ b/engine/battle_anims/anim_commands.asm
@@ -595,13 +595,13 @@
 BattleAnimCmd_Obj:
 ; index, x, y, param
 	call GetBattleAnimByte
-	ld [wBattleAnimTemp0], a
+	ld [wBattleObjectTempID], a
 	call GetBattleAnimByte
-	ld [wBattleAnimTemp1], a
+	ld [wBattleObjectTempXCoord], a
 	call GetBattleAnimByte
-	ld [wBattleAnimTemp2], a
+	ld [wBattleObjectTempYCoord], a
 	call GetBattleAnimByte
-	ld [wBattleAnimTemp3], a
+	ld [wBattleObjectTemp0b], a
 	call QueueBattleAnimation
 	ret
 
--- a/engine/battle_anims/bg_effects.asm
+++ b/engine/battle_anims/bg_effects.asm
@@ -427,20 +427,20 @@
 	call BGEffect_CheckBattleTurn
 	jr nz, .player_turn
 	ld a, ANIM_OBJ_PLAYERFEETFOLLOW
-	ld [wBattleAnimTemp0], a
-	ld a, 16 * 8 + 4
+	ld [wBattleObjectTempID], a
+	ld a, 16 * TILE_WIDTH + 4
 	jr .okay
 
 .player_turn
 	ld a, ANIM_OBJ_ENEMYFEETFOLLOW
-	ld [wBattleAnimTemp0], a
-	ld a, 6 * 8
+	ld [wBattleObjectTempID], a
+	ld a, 6 * TILE_WIDTH
 .okay
-	ld [wBattleAnimTemp1], a
-	ld a, 8 * 8
-	ld [wBattleAnimTemp2], a
+	ld [wBattleObjectTempXCoord], a
+	ld a, 8 * TILE_WIDTH
+	ld [wBattleObjectTempYCoord], a
 	xor a
-	ld [wBattleAnimTemp3], a
+	ld [wBattleObjectTemp0b], a
 	call _QueueBattleAnimation
 	pop bc
 	ret
@@ -494,20 +494,20 @@
 	call BGEffect_CheckBattleTurn
 	jr nz, .player_turn
 	ld a, ANIM_OBJ_PLAYERHEADFOLLOW
-	ld [wBattleAnimTemp0], a
-	ld a, 16 * 8 + 4
+	ld [wBattleObjectTempID], a
+	ld a, 16 * TILE_WIDTH + 4
 	jr .okay
 
 .player_turn
 	ld a, ANIM_OBJ_ENEMYHEADFOLLOW
-	ld [wBattleAnimTemp0], a
-	ld a, 6 * 8
+	ld [wBattleObjectTempID], a
+	ld a, 6 * TILE_WIDTH
 .okay
-	ld [wBattleAnimTemp1], a
-	ld a, 8 * 8
-	ld [wBattleAnimTemp2], a
+	ld [wBattleObjectTempXCoord], a
+	ld a, 8 * TILE_WIDTH
+	ld [wBattleObjectTempYCoord], a
 	xor a
-	ld [wBattleAnimTemp3], a
+	ld [wBattleObjectTemp0b], a
 	call _QueueBattleAnimation
 	pop bc
 	ret
--- a/engine/battle_anims/core.asm
+++ b/engine/battle_anims/core.asm
@@ -27,7 +27,7 @@
 	ret
 
 InitBattleAnimation:
-	ld a, [wBattleAnimTemp0]
+	ld a, [wBattleObjectTempID]
 	ld e, a
 	ld d, 0
 	ld hl, BattleAnimObjects
@@ -58,14 +58,14 @@
 	ld a, [de]
 	call GetBattleAnimTileOffset
 	ld [hli], a ; Tile ID
-	ld a, [wBattleAnimTemp1]
+	ld a, [wBattleObjectTempXCoord]
 	ld [hli], a ; X Coord
-	ld a, [wBattleAnimTemp2]
+	ld a, [wBattleObjectTempYCoord]
 	ld [hli], a ; Y Coord
 	xor a
 	ld [hli], a ; X Offset
 	ld [hli], a ; Y Offset
-	ld a, [wBattleAnimTemp3]
+	ld a, [wBattleObjectTemp0b]
 	ld [hli], a ; 0b
 	xor a
 	ld [hli], a ; 0c
--- a/wram.asm
+++ b/wram.asm
@@ -3058,6 +3058,12 @@
 wBattleAnimTemp3:: db
 
 NEXTU ; d419
+wBattleObjectTempID:: db
+wBattleObjectTempXCoord:: db
+wBattleObjectTempYCoord:: db
+wBattleObjectTemp0b:: db
+
+NEXTU ; d419
 wBattleAnimTempOAMFlags:: db
 wBattleAnimTempField02:: db
 wBattleAnimTempTileID:: db