sprite animation sheets

‘Been working on animation sheets, and code to read/build SAT entries from them. There’s quite a bit of indirection there. I’ve been thinking of ways to optimize them:

NPCList:
.dw _Enemy0
.db bank(_Enemy0),00
.dw _Enemy1
.db bank(_Enemy1),00
.dw _Enemy2
.db bank(_Enemy2),00
.dw _Enemy2
.db bank(_Enemy2),00
.dw _Enemy3
.db bank(_Enemy3),00
.dw _Enemy4
.db bank(_Enemy4),00

_Enemy0

.dw .Up
.dw .Down
.dw .Right
.dw .Left
.dw .Death
.dw .Attack
.dw .Damaged

.Up
.dw .Up.Frame0, .Up.Frame1, $ffff

.Up.Frame0
; duration of frame. This gets copied to object handler
.db $04
; X offset (signed)
.dw $0020
; Y offset (signed)
.dw $0040
; Pattern
.dw $364
; Attrib
.dw (SIZE16_16|PRIOR_H|SPAL2)
.Up.Frame1
.db $04
.dw $0020
.dw $0040
.dw $366
.dw (SIZE16_16|PRIOR_H|SPAL2)

.Down
.dw .Down.Frame0, .Down.Frame1, $ffff

.Down.Frame0
; duration of frame. This gets copied to object handler
.db $04
; X offset (signed)
.dw $0020
; Y offset (signed)
.dw $0040
; Pattern
.dw $360
; Attrib
.dw (SIZE16_16|PRIOR_H|SPAL2)
.Down.Frame1
.db $04
.dw $0020
.dw $0040
.dw $362
.dw (SIZE16_16|PRIOR_H|SPAL2)

.Right
.dw .Right.Frame0, .Right.Frame1, $ffff

.Right.Frame0
; duration of frame. This gets copied to object handler
.db $04
; X offset (signed)
.dw $0020
; Y offset (signed)
.dw $0040
; Pattern
.dw $368
; Attrib
.dw (SIZE16_16|PRIOR_H|SPAL2)
.Right.Frame1
.db $04
.dw $0020
.dw $0040
.dw $36a
.dw (SIZE16_16|PRIOR_H|SPAL2)

.Left
.dw .Left.Frame0, .Left.Frame1, $ffff

.Left.Frame0
; duration of frame. This gets copied to object handler
.db $04
; X offset (signed)
.dw $0020
; Y offset (signed)
.dw $0040
; Pattern
.dw $368
; Attrib
.dw (H_FLIP|SIZE16_16|PRIOR_H|SPAL2)
.Left.Frame1
.db $04
.dw $0020
.dw $0040
.dw $36a
.dw (H_FLIP|SIZE16_16|PRIOR_H|SPAL2)

.Death

.Attack

.Damaged

In the above standard example, there are three layers of pointers that you need to load there. I was thinking, since most/all of the data inside the main entry are just offsets to other parts, that I might just store the offset (add the offset to the base pointer to move along the list).

But the other idea that I had, was to build the sheet as code itself. It would jump to the specific addresses (based on tables) by using a few shared variables. It could write direct to SATB in the VDC, or to a local SAT in sys RAM.

How do you guys do your sprite sheets? (the animation tables, not the sprite pixel data itself).

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: