ref: 8290f851fd97131d927a9702deee20b150d3eae3
parent: aba038a4a4b5a1ef9ab683a3683849809ef95467
author: PikalaxALT <PikalaxALT@gmail.com>
date: Sun Nov 15 19:52:53 EST 2015
Further decoding of SpriteMovementData
--- a/engine/map_objects.asm
+++ b/engine/map_objects.asm
@@ -2,45 +2,50 @@
INCLUDE "engine/facings.asm"
SpriteMovementData:: ; 4273
- ; function, facing, ?, ?, ?, ?
- db SPRITEMOVEFN_00, DOWN, $01, $02, $00, $00 ; 00
- db SPRITEMOVEFN_STANDING, DOWN, $01, $0c, $00, $00 ; 01
- db SPRITEMOVEFN_RANDOM_WALK_XY, DOWN, $01, $00, $00, $00 ; 02
- db SPRITEMOVEFN_SLOW_RANDOM_SPIN, DOWN, $01, $00, $00, $00 ; 03
- db SPRITEMOVEFN_RANDOM_WALK_Y, DOWN, $01, $00, $00, $00 ; 04
- db SPRITEMOVEFN_RANDOM_WALK_X, DOWN, $01, $00, $00, $00 ; 05
- db SPRITEMOVEFN_STANDING, DOWN, $01, $00, $00, $00 ; 06
- db SPRITEMOVEFN_STANDING, UP, $01, $00, $00, $00 ; 07
- db SPRITEMOVEFN_STANDING, LEFT, $01, $00, $00, $00 ; 08
- db SPRITEMOVEFN_STANDING, RIGHT, $01, $00, $00, $00 ; 09
- db SPRITEMOVEFN_FAST_RANDOM_SPIN, DOWN, $01, $00, $00, $00 ; 0a
- db SPRITEMOVEFN_OBEY_DPAD, DOWN, $01, $02, $00, $00 ; 0b
- db SPRITEMOVEFN_08, DOWN, $01, $00, $00, $00 ; 0c
- db SPRITEMOVEFN_09, DOWN, $01, $00, $00, $00 ; 0d
- db SPRITEMOVEFN_0A, DOWN, $01, $00, $00, $00 ; 0e
- db SPRITEMOVEFN_0B, DOWN, $01, $00, $00, $00 ; 0f
- db SPRITEMOVEFN_0C, DOWN, $01, $00, $00, $00 ; 10
- db SPRITEMOVEFN_0D, DOWN, $01, $00, $00, $00 ; 11
- db SPRITEMOVEFN_0E, DOWN, $01, $00, $00, $00 ; 12
- db SPRITEMOVEFN_FOLLOW, DOWN, $01, $02, $00, $00 ; 13
- db SPRITEMOVEFN_SCRIPTED, DOWN, $01, $02, $00, $00 ; 14
- db SPRITEMOVEFN_BIG_SNORLAX, DOWN, $09, $2e, $01, $c0 ; 15
- db SPRITEMOVEFN_BOUNCE, DOWN, $0a, $2e, $00, $00 ; 16
- db SPRITEMOVEFN_STANDING, DOWN, $01, $0c, $00, $00 ; 17
- db SPRITEMOVEFN_STANDING, DOWN, $01, $2e, $10, $00 ; 18
- db SPRITEMOVEFN_STRENGTH, DOWN, $01, $2e, $00, $40 ; 19
- db SPRITEMOVEFN_FOLLOWNOTEXACT, DOWN, $01, $02, $00, $00 ; 1a
- db SPRITEMOVEFN_SHADOW, DOWN, $00, $8e, $01, $00 ; 1b
- db SPRITEMOVEFN_EMOTE, DOWN, $08, $8e, $02, $00 ; 1c
- db SPRITEMOVEFN_SCREENSHAKE, DOWN, $00, $82, $00, $00 ; 1d
- db SPRITEMOVEFN_SPIN_COUNTERCLOCKWISE, LEFT, $01, $00, $00, $00 ; 1e
- db SPRITEMOVEFN_SPIN_CLOCKWISE, RIGHT, $01, $00, $00, $00 ; 1f
- db SPRITEMOVEFN_STRENGTH, DOWN, $0c, $2e, $01, $c0 ; 20
- db SPRITEMOVEFN_STRENGTH, DOWN, $0d, $2e, $01, $c0 ; 21
- db SPRITEMOVEFN_BOULDERDUST, DOWN, $0e, $8e, $01, $00 ; 22
- db SPRITEMOVEFN_GRASS, DOWN, $0f, $8e, $02, $00 ; 23
- db SPRITEMOVEFN_RANDOM_WALK_XY, DOWN, $01, $00, $00, $20 ; 24
- db SPRITEMOVEFN_00, DOWN, $01, $00, $00, $00 ; 25
+
+sprite_movement_data: macro
+ db \1, \2, \3, \4, \5
+ dn \6, 0
+ endm
+ ; function, facing, action, flags1, flags2, palette flags
+ sprite_movement_data SPRITEMOVEFN_00, DOWN, PERSON_ACTION_01, $02, $00, %0000 ; 00
+ sprite_movement_data SPRITEMOVEFN_STANDING, DOWN, PERSON_ACTION_01, $0c, $00, %0000 ; 01
+ sprite_movement_data SPRITEMOVEFN_RANDOM_WALK_XY, DOWN, PERSON_ACTION_01, $00, $00, %0000 ; 02
+ sprite_movement_data SPRITEMOVEFN_SLOW_RANDOM_SPIN, DOWN, PERSON_ACTION_01, $00, $00, %0000 ; 03
+ sprite_movement_data SPRITEMOVEFN_RANDOM_WALK_Y, DOWN, PERSON_ACTION_01, $00, $00, %0000 ; 04
+ sprite_movement_data SPRITEMOVEFN_RANDOM_WALK_X, DOWN, PERSON_ACTION_01, $00, $00, %0000 ; 05
+ sprite_movement_data SPRITEMOVEFN_STANDING, DOWN, PERSON_ACTION_01, $00, $00, %0000 ; 06
+ sprite_movement_data SPRITEMOVEFN_STANDING, UP, PERSON_ACTION_01, $00, $00, %0000 ; 07
+ sprite_movement_data SPRITEMOVEFN_STANDING, LEFT, PERSON_ACTION_01, $00, $00, %0000 ; 08
+ sprite_movement_data SPRITEMOVEFN_STANDING, RIGHT, PERSON_ACTION_01, $00, $00, %0000 ; 09
+ sprite_movement_data SPRITEMOVEFN_FAST_RANDOM_SPIN, DOWN, PERSON_ACTION_01, $00, $00, %0000 ; 0a
+ sprite_movement_data SPRITEMOVEFN_OBEY_DPAD, DOWN, PERSON_ACTION_01, $02, $00, %0000 ; 0b
+ sprite_movement_data SPRITEMOVEFN_08, DOWN, PERSON_ACTION_01, $00, $00, %0000 ; 0c
+ sprite_movement_data SPRITEMOVEFN_09, DOWN, PERSON_ACTION_01, $00, $00, %0000 ; 0d
+ sprite_movement_data SPRITEMOVEFN_0A, DOWN, PERSON_ACTION_01, $00, $00, %0000 ; 0e
+ sprite_movement_data SPRITEMOVEFN_0B, DOWN, PERSON_ACTION_01, $00, $00, %0000 ; 0f
+ sprite_movement_data SPRITEMOVEFN_0C, DOWN, PERSON_ACTION_01, $00, $00, %0000 ; 10
+ sprite_movement_data SPRITEMOVEFN_0D, DOWN, PERSON_ACTION_01, $00, $00, %0000 ; 11
+ sprite_movement_data SPRITEMOVEFN_0E, DOWN, PERSON_ACTION_01, $00, $00, %0000 ; 12
+ sprite_movement_data SPRITEMOVEFN_FOLLOW, DOWN, PERSON_ACTION_01, $02, $00, %0000 ; 13
+ sprite_movement_data SPRITEMOVEFN_SCRIPTED, DOWN, PERSON_ACTION_01, $02, $00, %0000 ; 14
+ sprite_movement_data SPRITEMOVEFN_BIG_SNORLAX, DOWN, PERSON_ACTION_09, $2e, $01, %1100 ; 15
+ sprite_movement_data SPRITEMOVEFN_BOUNCE, DOWN, PERSON_ACTION_0A, $2e, $00, %0000 ; 16
+ sprite_movement_data SPRITEMOVEFN_STANDING, DOWN, PERSON_ACTION_01, $0c, $00, %0000 ; 17
+ sprite_movement_data SPRITEMOVEFN_STANDING, DOWN, PERSON_ACTION_01, $2e, $10, %0000 ; 18
+ sprite_movement_data SPRITEMOVEFN_STRENGTH, DOWN, PERSON_ACTION_01, $2e, $00, %0100 ; 19
+ sprite_movement_data SPRITEMOVEFN_FOLLOWNOTEXACT, DOWN, PERSON_ACTION_01, $02, $00, %0000 ; 1a
+ sprite_movement_data SPRITEMOVEFN_SHADOW, DOWN, PERSON_ACTION_00, $8e, $01, %0000 ; 1b
+ sprite_movement_data SPRITEMOVEFN_EMOTE, DOWN, PERSON_ACTION_08, $8e, $02, %0000 ; 1c
+ sprite_movement_data SPRITEMOVEFN_SCREENSHAKE, DOWN, PERSON_ACTION_00, $82, $00, %0000 ; 1d
+ sprite_movement_data SPRITEMOVEFN_SPIN_COUNTERCLOCKWISE, LEFT, PERSON_ACTION_01, $00, $00, %0000 ; 1e
+ sprite_movement_data SPRITEMOVEFN_SPIN_CLOCKWISE, RIGHT, PERSON_ACTION_01, $00, $00, %0000 ; 1f
+ sprite_movement_data SPRITEMOVEFN_STRENGTH, DOWN, PERSON_ACTION_0C, $2e, $01, %1100 ; 20
+ sprite_movement_data SPRITEMOVEFN_STRENGTH, DOWN, PERSON_ACTION_0D, $2e, $01, %1100 ; 21
+ sprite_movement_data SPRITEMOVEFN_BOULDERDUST, DOWN, PERSON_ACTION_0E, $8e, $01, %0000 ; 22
+ sprite_movement_data SPRITEMOVEFN_GRASS, DOWN, PERSON_ACTION_0F, $8e, $02, %0000 ; 23
+ sprite_movement_data SPRITEMOVEFN_RANDOM_WALK_XY, DOWN, PERSON_ACTION_01, $00, $00, %0010 ; 24
+ sprite_movement_data SPRITEMOVEFN_00, DOWN, PERSON_ACTION_01, $00, $00, %0000 ; 25
; 4357
@@ -2705,6 +2710,7 @@
ld a, [VramState]
bit 0, a
ret z
+
ld bc, ObjectStructs
xor a
.loop
--- a/home/map_objects.asm
+++ b/home/map_objects.asm
@@ -542,7 +542,7 @@
; 1a61
-Function1a61:: ; 1a61
+CopySpriteMovementData:: ; 1a61
ld l, a
ld a, [hROMBank]
push af
@@ -551,7 +551,7 @@
ld a, l
push bc
- call Function1a71
+ call .CopyData
pop bc
pop af
@@ -560,10 +560,11 @@
ret
; 1a71
-Function1a71:: ; 1a71
+.CopyData ; 1a71
ld hl, OBJECT_MOVEMENTTYPE
add hl, de
ld [hl], a
+
push de
ld e, a
ld d, 0
@@ -574,29 +575,34 @@
ld b, h
ld c, l
pop de
+
ld a, [bc]
inc bc
rlca
rlca
- and $c
+ and %00001100
ld hl, OBJECT_FACING
add hl, de
ld [hl], a
+
ld a, [bc]
inc bc
ld hl, OBJECT_ACTION
add hl, de
ld [hl], a
+
ld a, [bc]
inc bc
ld hl, OBJECT_FLAGS1
add hl, de
ld [hl], a
+
ld a, [bc]
inc bc
ld hl, OBJECT_FLAGS2
add hl, de
ld [hl], a
+
ld a, [bc]
inc bc
ld hl, OBJECT_PALETTE
@@ -648,6 +654,7 @@
ld a, [VramState]
bit 0, a
ret z
+
callba Function55e0
callba _UpdateSprites
ret
--- a/main.asm
+++ b/main.asm
@@ -3248,7 +3248,7 @@
; A dummy map object used to initialize the player object.
; Shorter than the actual amount copied by two bytes.
; Said bytes seem to be unused.
- person_event SPRITE_CHRIS, -4, -4, SPRITEMOVEDATA_PLAYER, 15, 15, -1, -1, 0, 0, 0, 0, -1
+ person_event SPRITE_CHRIS, -4, -4, SPRITEMOVEDATA_PLAYER, 15, 15, -1, -1, 0, PERSONTYPE_SCRIPT, 0, 0, -1
; 807e
CopyDECoordsToMapObject:: ; 807e
@@ -3630,7 +3630,7 @@
ld [hl], a
ld a, [wTempObjectCopyMovement]
- call Function1a61
+ call CopySpriteMovementData
ld a, [wTempObjectCopyPalette]
ld hl, OBJECT_PALETTE