-
Notifications
You must be signed in to change notification settings - Fork 4
/
sprite_struct.bt
53 lines (49 loc) · 1.2 KB
/
sprite_struct.bt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
/* -*- Mode: C; -*- */
//--------------------------------------
//--- 010 Editor v6.0.3 Binary Template
//
// File: sprite_struct.bt
// Author: ufdada
// Revision: 1.0
// Purpose: Sprite Container
//--------------------------------------
struct Header {
char signature[4]; // PSFB
uint framesCount;
} header;
struct Entry {
ushort width;
ushort height;
long offset;
} entry[header.framesCount];
local int i;
local int y;
local int x;
local int w;
for (i = 0; i < header.framesCount; i++) {
int pointer = FTell();
FSeek(entry[i].offset);
struct Frame {
while (y < entry[i].height) {
ubyte color;
if (w == 0) {
if (color < 0x80) {
w = color;
if (w == 0) {
x = 0;
y++;
}
} else {
x += (color ^ 0xFF) + 1;
}
} else {
if (x < entry[i].width && y < entry[i].height) {
Printf("%i %i %i", x, y, color);
}
x++;
w--;
}
}
} frame;
FSeek(pointer);
}