37 lines
1.6 KiB
C
37 lines
1.6 KiB
C
// Space Taxi -- the sprite cels the renderer needs, as a fixed-order
|
|
// bank. The offline baker (tools/staxibake) emits a .spr in this order,
|
|
// spritebake compiles it to a per-platform .spc, and stRenderPrewarm
|
|
// loads that with jlSpriteBankLoadPrecompiled -- so the moving cels
|
|
// arrive already compiled and the ~0.4 s-per-cel 65816 JIT never runs at
|
|
// boot. The game maps loaded cel i back to its (ptr, colour, mode) key
|
|
// from kStCels[i]. stCelBlob is the single expansion both the baker and
|
|
// the interpreter fallback use, so the compiled and built cels agree.
|
|
|
|
#ifndef ST_CELS_H
|
|
#define ST_CELS_H
|
|
|
|
#include <stdint.h>
|
|
|
|
// 3x3 tiles = 24x24 px; 32 bytes per 8x8 tile, tile-major (matches
|
|
// jlSpriteCreateFromSurface / the .spr cel layout).
|
|
#define ST_CEL_TILES 3u
|
|
#define ST_CEL_BYTES (ST_CEL_TILES * ST_CEL_TILES * 32u)
|
|
#define ST_CEL_ROWS 21u // a VIC sprite is 21 rows tall
|
|
|
|
typedef struct {
|
|
uint8_t ptr; // VIC sprite block pointer
|
|
uint8_t color; // per-sprite colour (the multicolour "10" pair)
|
|
uint8_t multi; // 1 = multicolour, 0 = hires
|
|
uint8_t mc0; // shared multicolour 0 ($D025); 0 when hires
|
|
uint8_t mc1; // shared multicolour 1 ($D026); 0 when hires
|
|
} StCelDefT;
|
|
|
|
extern const StCelDefT kStCels[];
|
|
extern const uint16_t kStCelCount;
|
|
|
|
// Expand a VIC bitmap (63 bytes, 21 rows x 3, or NULL) into the 288-byte
|
|
// tile-major 4bpp-packed cel blob. Colours as in the C64 multicolour
|
|
// rules; hires uses `color` for a set bit.
|
|
void stCelBlob(const uint8_t *bm, uint8_t multi, uint8_t color, uint8_t mc0, uint8_t mc1, uint8_t *out);
|
|
|
|
#endif
|