shithub: pokered

Download patch

ref: b506214f68b3b6cfc75e40373b29961af7cbd6f2
parent: 6ee9cb9f97b31604c7133782d4401bbf5b64f2d8
author: Rangi <remy.oukaour+rangi42@gmail.com>
date: Sun Aug 30 12:33:14 EDT 2020

Identify some hSpriteDataOffset values

--- a/home/map_objects.asm
+++ b/home/map_objects.asm
@@ -80,7 +80,7 @@
 	jp DelayFrames
 
 SetSpriteFacingDirection::
-	ld a, $9
+	ld a, SPRITESTATEDATA1_FACINGDIRECTION
 	ldh [hSpriteDataOffset], a
 	call GetPointerWithinSpriteStateData1
 	ldh a, [hSpriteFacingDirection]
@@ -88,7 +88,7 @@
 	ret
 
 SetSpriteImageIndexAfterSettingFacingDirection::
-	ld de, -7
+	ld de, SPRITESTATEDATA1_IMAGEINDEX - SPRITESTATEDATA1_FACINGDIRECTION
 	add hl, de
 	ld [hl], a
 	ret
@@ -158,11 +158,11 @@
 	jp CheckCoords
 
 GetPointerWithinSpriteStateData1::
-	ld h, $c1
+	ld h, HIGH(wSpriteStateData1)
 	jr _GetPointerWithinSpriteStateData
 
 GetPointerWithinSpriteStateData2::
-	ld h, $c2
+	ld h, HIGH(wSpriteStateData2)
 
 _GetPointerWithinSpriteStateData:
 	ldh a, [hSpriteDataOffset]
--- a/scripts/CeruleanCity.asm
+++ b/scripts/CeruleanCity.asm
@@ -84,10 +84,10 @@
 	jr z, .asm_19535
 	ld a, $1
 	ldh [hSpriteIndex], a
-	ld a, $5
+	ld a, SPRITESTATEDATA2_MAPX
 	ldh [hSpriteDataOffset], a
 	call GetPointerWithinSpriteStateData2
-	ld [hl], $19
+	ld [hl], 25
 .asm_19535
 	ld a, HS_CERULEAN_RIVAL
 	ld [wMissableObjectIndex], a
--- a/scripts/OaksLab.asm
+++ b/scripts/OaksLab.asm
@@ -255,19 +255,19 @@
 	push hl
 	ld a, $1
 	ldh [hSpriteIndex], a
-	ld a, $4
+	ld a, SPRITESTATEDATA1_YPIXELS
 	ldh [hSpriteDataOffset], a
 	call GetPointerWithinSpriteStateData1
 	push hl
-	ld [hl], $4c
+	ld [hl], $4c ; SPRITESTATEDATA1_YPIXELS
 	inc hl
 	inc hl
-	ld [hl], $0
+	ld [hl], $0 ; SPRITESTATEDATA1_XPIXELS
 	pop hl
 	inc h
-	ld [hl], $8
+	ld [hl], 8 ; SPRITESTATEDATA2_MAPY
 	inc hl
-	ld [hl], $9
+	ld [hl], 9 ; SPRITESTATEDATA2_MAPX
 	ld de, .LeftBallMovement2 ; the rival is not currently onscreen, so account for that
 	pop hl
 	jr .moveBlue
@@ -841,13 +841,13 @@
 OaksLabScript_1d157:
 	ld a, $5
 	ldh [hSpriteIndex], a
-	ld a, $9
+	ld a, SPRITESTATEDATA1_FACINGDIRECTION
 	ldh [hSpriteDataOffset], a
 	call GetPointerWithinSpriteStateData1
 	ld [hl], SPRITE_FACING_DOWN
 	ld a, $1
 	ldh [hSpriteIndex], a
-	ld a, $9
+	ld a, SPRITESTATEDATA1_FACINGDIRECTION
 	ldh [hSpriteDataOffset], a
 	call GetPointerWithinSpriteStateData1
 	ld [hl], SPRITE_FACING_RIGHT
@@ -948,10 +948,10 @@
 OaksLabScript_1d22d:
 	ld a, $5
 	ldh [hSpriteIndex], a
-	ld a, $9
+	ld a, SPRITESTATEDATA1_FACINGDIRECTION
 	ldh [hSpriteDataOffset], a
 	call GetPointerWithinSpriteStateData1
-	ld [hl], $0
+	ld [hl], SPRITE_FACING_DOWN
 	ld hl, OaksLabLastMonText
 	call PrintText
 	jp TextScriptEnd