Further decoding of SpriteMovementData

This commit is contained in:
PikalaxALT 2015-11-16 00:52:53 -05:00
parent aba038a4a4
commit 8290f851fd
3 changed files with 58 additions and 45 deletions

View File

@ -2,45 +2,50 @@
INCLUDE "engine/facings.asm" INCLUDE "engine/facings.asm"
SpriteMovementData:: ; 4273 SpriteMovementData:: ; 4273
; function, facing, ?, ?, ?, ?
db SPRITEMOVEFN_00, DOWN, $01, $02, $00, $00 ; 00 sprite_movement_data: macro
db SPRITEMOVEFN_STANDING, DOWN, $01, $0c, $00, $00 ; 01 db \1, \2, \3, \4, \5
db SPRITEMOVEFN_RANDOM_WALK_XY, DOWN, $01, $00, $00, $00 ; 02 dn \6, 0
db SPRITEMOVEFN_SLOW_RANDOM_SPIN, DOWN, $01, $00, $00, $00 ; 03 endm
db SPRITEMOVEFN_RANDOM_WALK_Y, DOWN, $01, $00, $00, $00 ; 04 ; function, facing, action, flags1, flags2, palette flags
db SPRITEMOVEFN_RANDOM_WALK_X, DOWN, $01, $00, $00, $00 ; 05 sprite_movement_data SPRITEMOVEFN_00, DOWN, PERSON_ACTION_01, $02, $00, %0000 ; 00
db SPRITEMOVEFN_STANDING, DOWN, $01, $00, $00, $00 ; 06 sprite_movement_data SPRITEMOVEFN_STANDING, DOWN, PERSON_ACTION_01, $0c, $00, %0000 ; 01
db SPRITEMOVEFN_STANDING, UP, $01, $00, $00, $00 ; 07 sprite_movement_data SPRITEMOVEFN_RANDOM_WALK_XY, DOWN, PERSON_ACTION_01, $00, $00, %0000 ; 02
db SPRITEMOVEFN_STANDING, LEFT, $01, $00, $00, $00 ; 08 sprite_movement_data SPRITEMOVEFN_SLOW_RANDOM_SPIN, DOWN, PERSON_ACTION_01, $00, $00, %0000 ; 03
db SPRITEMOVEFN_STANDING, RIGHT, $01, $00, $00, $00 ; 09 sprite_movement_data SPRITEMOVEFN_RANDOM_WALK_Y, DOWN, PERSON_ACTION_01, $00, $00, %0000 ; 04
db SPRITEMOVEFN_FAST_RANDOM_SPIN, DOWN, $01, $00, $00, $00 ; 0a sprite_movement_data SPRITEMOVEFN_RANDOM_WALK_X, DOWN, PERSON_ACTION_01, $00, $00, %0000 ; 05
db SPRITEMOVEFN_OBEY_DPAD, DOWN, $01, $02, $00, $00 ; 0b sprite_movement_data SPRITEMOVEFN_STANDING, DOWN, PERSON_ACTION_01, $00, $00, %0000 ; 06
db SPRITEMOVEFN_08, DOWN, $01, $00, $00, $00 ; 0c sprite_movement_data SPRITEMOVEFN_STANDING, UP, PERSON_ACTION_01, $00, $00, %0000 ; 07
db SPRITEMOVEFN_09, DOWN, $01, $00, $00, $00 ; 0d sprite_movement_data SPRITEMOVEFN_STANDING, LEFT, PERSON_ACTION_01, $00, $00, %0000 ; 08
db SPRITEMOVEFN_0A, DOWN, $01, $00, $00, $00 ; 0e sprite_movement_data SPRITEMOVEFN_STANDING, RIGHT, PERSON_ACTION_01, $00, $00, %0000 ; 09
db SPRITEMOVEFN_0B, DOWN, $01, $00, $00, $00 ; 0f sprite_movement_data SPRITEMOVEFN_FAST_RANDOM_SPIN, DOWN, PERSON_ACTION_01, $00, $00, %0000 ; 0a
db SPRITEMOVEFN_0C, DOWN, $01, $00, $00, $00 ; 10 sprite_movement_data SPRITEMOVEFN_OBEY_DPAD, DOWN, PERSON_ACTION_01, $02, $00, %0000 ; 0b
db SPRITEMOVEFN_0D, DOWN, $01, $00, $00, $00 ; 11 sprite_movement_data SPRITEMOVEFN_08, DOWN, PERSON_ACTION_01, $00, $00, %0000 ; 0c
db SPRITEMOVEFN_0E, DOWN, $01, $00, $00, $00 ; 12 sprite_movement_data SPRITEMOVEFN_09, DOWN, PERSON_ACTION_01, $00, $00, %0000 ; 0d
db SPRITEMOVEFN_FOLLOW, DOWN, $01, $02, $00, $00 ; 13 sprite_movement_data SPRITEMOVEFN_0A, DOWN, PERSON_ACTION_01, $00, $00, %0000 ; 0e
db SPRITEMOVEFN_SCRIPTED, DOWN, $01, $02, $00, $00 ; 14 sprite_movement_data SPRITEMOVEFN_0B, DOWN, PERSON_ACTION_01, $00, $00, %0000 ; 0f
db SPRITEMOVEFN_BIG_SNORLAX, DOWN, $09, $2e, $01, $c0 ; 15 sprite_movement_data SPRITEMOVEFN_0C, DOWN, PERSON_ACTION_01, $00, $00, %0000 ; 10
db SPRITEMOVEFN_BOUNCE, DOWN, $0a, $2e, $00, $00 ; 16 sprite_movement_data SPRITEMOVEFN_0D, DOWN, PERSON_ACTION_01, $00, $00, %0000 ; 11
db SPRITEMOVEFN_STANDING, DOWN, $01, $0c, $00, $00 ; 17 sprite_movement_data SPRITEMOVEFN_0E, DOWN, PERSON_ACTION_01, $00, $00, %0000 ; 12
db SPRITEMOVEFN_STANDING, DOWN, $01, $2e, $10, $00 ; 18 sprite_movement_data SPRITEMOVEFN_FOLLOW, DOWN, PERSON_ACTION_01, $02, $00, %0000 ; 13
db SPRITEMOVEFN_STRENGTH, DOWN, $01, $2e, $00, $40 ; 19 sprite_movement_data SPRITEMOVEFN_SCRIPTED, DOWN, PERSON_ACTION_01, $02, $00, %0000 ; 14
db SPRITEMOVEFN_FOLLOWNOTEXACT, DOWN, $01, $02, $00, $00 ; 1a sprite_movement_data SPRITEMOVEFN_BIG_SNORLAX, DOWN, PERSON_ACTION_09, $2e, $01, %1100 ; 15
db SPRITEMOVEFN_SHADOW, DOWN, $00, $8e, $01, $00 ; 1b sprite_movement_data SPRITEMOVEFN_BOUNCE, DOWN, PERSON_ACTION_0A, $2e, $00, %0000 ; 16
db SPRITEMOVEFN_EMOTE, DOWN, $08, $8e, $02, $00 ; 1c sprite_movement_data SPRITEMOVEFN_STANDING, DOWN, PERSON_ACTION_01, $0c, $00, %0000 ; 17
db SPRITEMOVEFN_SCREENSHAKE, DOWN, $00, $82, $00, $00 ; 1d sprite_movement_data SPRITEMOVEFN_STANDING, DOWN, PERSON_ACTION_01, $2e, $10, %0000 ; 18
db SPRITEMOVEFN_SPIN_COUNTERCLOCKWISE, LEFT, $01, $00, $00, $00 ; 1e sprite_movement_data SPRITEMOVEFN_STRENGTH, DOWN, PERSON_ACTION_01, $2e, $00, %0100 ; 19
db SPRITEMOVEFN_SPIN_CLOCKWISE, RIGHT, $01, $00, $00, $00 ; 1f sprite_movement_data SPRITEMOVEFN_FOLLOWNOTEXACT, DOWN, PERSON_ACTION_01, $02, $00, %0000 ; 1a
db SPRITEMOVEFN_STRENGTH, DOWN, $0c, $2e, $01, $c0 ; 20 sprite_movement_data SPRITEMOVEFN_SHADOW, DOWN, PERSON_ACTION_00, $8e, $01, %0000 ; 1b
db SPRITEMOVEFN_STRENGTH, DOWN, $0d, $2e, $01, $c0 ; 21 sprite_movement_data SPRITEMOVEFN_EMOTE, DOWN, PERSON_ACTION_08, $8e, $02, %0000 ; 1c
db SPRITEMOVEFN_BOULDERDUST, DOWN, $0e, $8e, $01, $00 ; 22 sprite_movement_data SPRITEMOVEFN_SCREENSHAKE, DOWN, PERSON_ACTION_00, $82, $00, %0000 ; 1d
db SPRITEMOVEFN_GRASS, DOWN, $0f, $8e, $02, $00 ; 23 sprite_movement_data SPRITEMOVEFN_SPIN_COUNTERCLOCKWISE, LEFT, PERSON_ACTION_01, $00, $00, %0000 ; 1e
db SPRITEMOVEFN_RANDOM_WALK_XY, DOWN, $01, $00, $00, $20 ; 24 sprite_movement_data SPRITEMOVEFN_SPIN_CLOCKWISE, RIGHT, PERSON_ACTION_01, $00, $00, %0000 ; 1f
db SPRITEMOVEFN_00, DOWN, $01, $00, $00, $00 ; 25 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 ; 4357
@ -2705,6 +2710,7 @@ Function55e0:: ; 55e0
ld a, [VramState] ld a, [VramState]
bit 0, a bit 0, a
ret z ret z
ld bc, ObjectStructs ld bc, ObjectStructs
xor a xor a
.loop .loop

View File

@ -542,7 +542,7 @@ endr
; 1a61 ; 1a61
Function1a61:: ; 1a61 CopySpriteMovementData:: ; 1a61
ld l, a ld l, a
ld a, [hROMBank] ld a, [hROMBank]
push af push af
@ -551,7 +551,7 @@ Function1a61:: ; 1a61
ld a, l ld a, l
push bc push bc
call Function1a71 call .CopyData
pop bc pop bc
pop af pop af
@ -560,10 +560,11 @@ Function1a61:: ; 1a61
ret ret
; 1a71 ; 1a71
Function1a71:: ; 1a71 .CopyData ; 1a71
ld hl, OBJECT_MOVEMENTTYPE ld hl, OBJECT_MOVEMENTTYPE
add hl, de add hl, de
ld [hl], a ld [hl], a
push de push de
ld e, a ld e, a
ld d, 0 ld d, 0
@ -574,29 +575,34 @@ endr
ld b, h ld b, h
ld c, l ld c, l
pop de pop de
ld a, [bc] ld a, [bc]
inc bc inc bc
rlca rlca
rlca rlca
and $c and %00001100
ld hl, OBJECT_FACING ld hl, OBJECT_FACING
add hl, de add hl, de
ld [hl], a ld [hl], a
ld a, [bc] ld a, [bc]
inc bc inc bc
ld hl, OBJECT_ACTION ld hl, OBJECT_ACTION
add hl, de add hl, de
ld [hl], a ld [hl], a
ld a, [bc] ld a, [bc]
inc bc inc bc
ld hl, OBJECT_FLAGS1 ld hl, OBJECT_FLAGS1
add hl, de add hl, de
ld [hl], a ld [hl], a
ld a, [bc] ld a, [bc]
inc bc inc bc
ld hl, OBJECT_FLAGS2 ld hl, OBJECT_FLAGS2
add hl, de add hl, de
ld [hl], a ld [hl], a
ld a, [bc] ld a, [bc]
inc bc inc bc
ld hl, OBJECT_PALETTE ld hl, OBJECT_PALETTE
@ -648,6 +654,7 @@ UpdateSprites:: ; 1ad2
ld a, [VramState] ld a, [VramState]
bit 0, a bit 0, a
ret z ret z
callba Function55e0 callba Function55e0
callba _UpdateSprites callba _UpdateSprites
ret ret

View File

@ -3248,7 +3248,7 @@ PlayerObjectTemplate: ; 8071
; A dummy map object used to initialize the player object. ; A dummy map object used to initialize the player object.
; Shorter than the actual amount copied by two bytes. ; Shorter than the actual amount copied by two bytes.
; Said bytes seem to be unused. ; 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 ; 807e
CopyDECoordsToMapObject:: ; 807e CopyDECoordsToMapObject:: ; 807e
@ -3630,7 +3630,7 @@ CopyTempObjectToObjectStruct: ; 8286
ld [hl], a ld [hl], a
ld a, [wTempObjectCopyMovement] ld a, [wTempObjectCopyMovement]
call Function1a61 call CopySpriteMovementData
ld a, [wTempObjectCopyPalette] ld a, [wTempObjectCopyPalette]
ld hl, OBJECT_PALETTE ld hl, OBJECT_PALETTE