summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRangi <remy.oukaour+rangi42@gmail.com>2020-07-07 16:57:51 -0400
committerRangi <remy.oukaour+rangi42@gmail.com>2020-07-07 16:57:51 -0400
commit51ac538c25f8c0a6d88101569a17f02d09855d31 (patch)
tree511154a1efc0ece4114d690eb30f3f8d7a882504
parent4a7d1513f3135a3c926233d47921b21bf8b1fab4 (diff)
Identify SPRITESTATEDATA2_ORIGFACINGDIRECTION
-rw-r--r--constants/map_object_constants.asm2
-rw-r--r--engine/menus/display_text_id_init.asm8
-rw-r--r--home/text_script.asm6
-rw-r--r--macros/wram.asm3
-rwxr-xr-xwram.asm2
5 files changed, 11 insertions, 10 deletions
diff --git a/constants/map_object_constants.asm b/constants/map_object_constants.asm
index 4c44e946..459fae4a 100644
--- a/constants/map_object_constants.asm
+++ b/constants/map_object_constants.asm
@@ -29,7 +29,7 @@ SPRITESTATEDATA1_LENGTH EQU const_value
const SPRITESTATEDATA2_MOVEMENTBYTE1 ; 6
const SPRITESTATEDATA2_GRASSPRIORITY ; 7
const SPRITESTATEDATA2_MOVEMENTDELAY ; 8
- const SPRITESTATEDATA2_09 ; 9
+ const SPRITESTATEDATA2_ORIGFACINGDIRECTION ; 9
const SPRITESTATEDATA2_0A ; a
const SPRITESTATEDATA2_0B ; b
const SPRITESTATEDATA2_0C ; c
diff --git a/engine/menus/display_text_id_init.asm b/engine/menus/display_text_id_init.asm
index c147eaf6..6ce76e7f 100644
--- a/engine/menus/display_text_id_init.asm
+++ b/engine/menus/display_text_id_init.asm
@@ -38,17 +38,17 @@ DisplayTextIDInit::
jr nz, .skipMovingSprites
call UpdateSprites
.skipMovingSprites
-; loop to copy [x#SPRITESTATEDATA1_FACINGDIRECTION] to [x#SPRITESTATEDATA2_09]
-; for each sprite from x=01 to x=15
+; loop to copy [x#SPRITESTATEDATA1_FACINGDIRECTION] to
+; [x#SPRITESTATEDATA2_ORIGFACINGDIRECTION] for each non-player sprite
; this is done because when you talk to an NPC, they turn to look your way
; the original direction they were facing must be restored after the dialogue is over
ld hl, wSprite01StateData1FacingDirection
ld c, $0f
ld de, $10
.spriteFacingDirectionCopyLoop
- ld a, [hl]
+ ld a, [hl] ; x#SPRITESTATEDATA1_FACINGDIRECTION
inc h
- ld [hl], a
+ ld [hl], a ; [x#SPRITESTATEDATA2_ORIGFACINGDIRECTION]
dec h
add hl, de
dec c
diff --git a/home/text_script.asm b/home/text_script.asm
index 1baa3d64..b9c3c8e4 100644
--- a/home/text_script.asm
+++ b/home/text_script.asm
@@ -111,13 +111,13 @@ CloseTextDisplay::
xor a
ldh [hAutoBGTransferEnabled], a ; disable continuous WRAM to VRAM transfer each V-blank
; loop to make sprites face the directions they originally faced before the dialogue
- ld hl, wSprite01StateData2 + 9 ; should be wSprite01StateData1FacingDirection?
+ ld hl, wSprite01StateData2OrigFacingDirection
ld c, $0f
ld de, $10
.restoreSpriteFacingDirectionLoop
- ld a, [hl]
+ ld a, [hl] ; x#SPRITESTATEDATA2_ORIGFACINGDIRECTION
dec h
- ld [hl], a
+ ld [hl], a ; [x#SPRITESTATEDATA1_FACINGDIRECTION]
inc h
add hl, de
dec c
diff --git a/macros/wram.asm b/macros/wram.asm
index 4c6b1dc6..41fd1dad 100644
--- a/macros/wram.asm
+++ b/macros/wram.asm
@@ -88,7 +88,8 @@ spritestatedata2: MACRO
\1MovementByte1:: db
\1GrassPriority:: db
\1MovementDelay:: db
- ds 4
+\1OrigFacingDirection:: db
+ ds 3
\1PictureID:: db
\1ImageBaseOffset:: db
ds 1
diff --git a/wram.asm b/wram.asm
index db5b7476..98f890fd 100755
--- a/wram.asm
+++ b/wram.asm
@@ -206,7 +206,7 @@ wSpriteStateData2::
; - 6: movement byte 1 (determines whether a sprite can move, $ff:not moving, $fe:random movements, others unknown)
; - 7: (?) (set to $80 when in grass, else $0; may be used to draw grass above the sprite)
; - 8: delay until next movement (counted downwards, movement status is set to ready if reached 0)
-; - 9
+; - 9: original facing direction (backed up by DisplayTextIDInit, restored by CloseTextDisplay)
; - A
; - B
; - C