summaryrefslogtreecommitdiff
path: root/engine/overworld/trainer_sight.asm
diff options
context:
space:
mode:
authorRangi <remy.oukaour+rangi42@gmail.com>2020-07-05 17:29:11 -0400
committerRangi <remy.oukaour+rangi42@gmail.com>2020-07-05 17:51:29 -0400
commit2b2ed54bbf017943ba2343cd6c1dbe88b8f34a4e (patch)
treea418c4ef57d272e7e2a70337ac8c2a8194545541 /engine/overworld/trainer_sight.asm
parent7ab43f4d17aa63d4ef1050d80560379f19200088 (diff)
Identify wSpriteStateData1 and wSpriteStateData2 offsets, like pokeyellow
Diffstat (limited to 'engine/overworld/trainer_sight.asm')
-rwxr-xr-xengine/overworld/trainer_sight.asm28
1 files changed, 14 insertions, 14 deletions
diff --git a/engine/overworld/trainer_sight.asm b/engine/overworld/trainer_sight.asm
index 81978c35..c12c064b 100755
--- a/engine/overworld/trainer_sight.asm
+++ b/engine/overworld/trainer_sight.asm
@@ -1,6 +1,6 @@
_GetSpritePosition1::
ld hl, wSpriteStateData1
- ld de, $4
+ ld de, wSpritePlayerStateData1YPixels - wSpritePlayerStateData1
ld a, [wSpriteIndex]
ld [hSpriteIndex], a
call GetSpriteDataPointer
@@ -9,7 +9,7 @@ _GetSpritePosition1::
inc hl
ld a, [hl] ; c1x6 (screen X pos)
ld [hSpriteScreenXCoord], a
- ld de, (wSpriteStateData2 + $4) - (wSpriteStateData1 + $6)
+ ld de, wSpritePlayerStateData2MapY - wSpritePlayerStateData1XPixels
add hl, de
ld a, [hli] ; c2x4 (map Y pos)
ld [hSpriteMapYCoord], a
@@ -19,7 +19,7 @@ _GetSpritePosition1::
_GetSpritePosition2::
ld hl, wSpriteStateData1
- ld de, $4
+ ld de, wSpritePlayerStateData1YPixels - wSpritePlayerStateData1
ld a, [wSpriteIndex]
ld [hSpriteIndex], a
call GetSpriteDataPointer
@@ -28,7 +28,7 @@ _GetSpritePosition2::
inc hl
ld a, [hl] ; c1x6 (screen X pos)
ld [wSavedSpriteScreenX], a
- ld de, (wSpriteStateData2 + $4) - (wSpriteStateData1 + $6)
+ ld de, wSpritePlayerStateData2MapY - wSpritePlayerStateData1XPixels
add hl, de
ld a, [hli] ; c2x4 (map Y pos)
ld [wSavedSpriteMapY], a
@@ -38,7 +38,7 @@ _GetSpritePosition2::
_SetSpritePosition1::
ld hl, wSpriteStateData1
- ld de, $4
+ ld de, wSpritePlayerStateData1YPixels - wSpritePlayerStateData1
ld a, [wSpriteIndex]
ld [hSpriteIndex], a
call GetSpriteDataPointer
@@ -47,7 +47,7 @@ _SetSpritePosition1::
inc hl
ld a, [hSpriteScreenXCoord] ; c1x6 (screen X pos)
ld [hl], a
- ld de, (wSpriteStateData2 + $4) - (wSpriteStateData1 + $6)
+ ld de, wSpritePlayerStateData2MapY - wSpritePlayerStateData1XPixels
add hl, de
ld a, [hSpriteMapYCoord] ; c2x4 (map Y pos)
ld [hli], a
@@ -57,7 +57,7 @@ _SetSpritePosition1::
_SetSpritePosition2::
ld hl, wSpriteStateData1
- ld de, 4
+ ld de, wSpritePlayerStateData1YPixels - wSpritePlayerStateData1
ld a, [wSpriteIndex]
ld [hSpriteIndex], a
call GetSpriteDataPointer
@@ -66,7 +66,7 @@ _SetSpritePosition2::
inc hl
ld a, [wSavedSpriteScreenX]
ld [hl], a ; c1x6 (screen X pos)
- ld de, (wSpriteStateData2 + $4) - (wSpriteStateData1 + $6)
+ ld de, wSpritePlayerStateData2MapY - wSpritePlayerStateData1XPixels
add hl, de
ld a, [wSavedSpriteMapY]
ld [hli], a ; c2x4 (map Y pos)
@@ -165,7 +165,7 @@ TrainerEngage:
push hl
push de
ld a, [wTrainerSpriteOffset]
- add $2
+ add wSpritePlayerStateData1ImageIndex - wSpritePlayerStateData1
ld d, $0
ld e, a
ld hl, wSpriteStateData1
@@ -176,7 +176,7 @@ TrainerEngage:
jp .noEngage
.spriteOnScreen
ld a, [wTrainerSpriteOffset]
- add $9
+ add wSpritePlayerStateData1FacingDirection - wSpritePlayerStateData1
ld d, $0
ld e, a
ld hl, wSpriteStateData1
@@ -234,7 +234,7 @@ TrainerEngage:
; reads trainer's Y position to wTrainerScreenY and X position to wTrainerScreenX
ReadTrainerScreenPosition:
ld a, [wTrainerSpriteOffset]
- add $4
+ add wSpritePlayerStateData1YPixels - wSpritePlayerStateData1
ld d, $0
ld e, a
ld hl, wSpriteStateData1
@@ -242,7 +242,7 @@ ReadTrainerScreenPosition:
ld a, [hl] ; c1x4 (sprite Y pos)
ld [wTrainerScreenY], a
ld a, [wTrainerSpriteOffset]
- add $6
+ add wSpritePlayerStateData1XPixels - wSpritePlayerStateData1
ld d, $0
ld e, a
ld hl, wSpriteStateData1
@@ -295,7 +295,7 @@ CheckPlayerIsInFrontOfSprite:
cp POWER_PLANT
jp z, .engage ; bypass this for power plant to get voltorb fake items to work
ld a, [wTrainerSpriteOffset]
- add $4
+ add wSpritePlayerStateData1YPixels - wSpritePlayerStateData1
ld d, $0
ld e, a
ld hl, wSpriteStateData1
@@ -307,7 +307,7 @@ CheckPlayerIsInFrontOfSprite:
.notOnTopmostTile
ld [wTrainerScreenY], a
ld a, [wTrainerSpriteOffset]
- add $6
+ add wSpritePlayerStateData1XPixels - wSpritePlayerStateData1
ld d, $0
ld e, a
ld hl, wSpriteStateData1