audio.c: make it possible to play pseudo empty tune
[rofl0r-openDOW.git] / utils / bgcreate.c
blob2bc14b87b7930a977b735f1581e9ff92e2bd1f1c
1 /* when using gfxrip and an uncompressed amiga save state,
2 * we find at offset 401408 the map background tiles, followed
3 * by other map sprites in 16x16, ST mode, 4bitplanes.
4 * the first 16 tiles are background data.
5 * to recreate the 64x64 bg tile, 4 lines of each bg sprite
6 * are put horizontally into the output tile. */
7 #include "../palpic.h"
8 #include "leptonica/allheaders.h"
9 #include <string.h>
10 //RcB: LINK "-llept"
12 #include "../temp.c"
13 #define sprite temp
14 #define sprites_per_pic 8
15 #define bgs 6
17 int main() {
18 const struct palpic* f = & sprite .header;
19 size_t seq;
20 PIX* o = pixCreate(64, 32*bgs, 32);
21 prgb* bufptr = (prgb*) o->data;
23 for(seq = 0; seq < bgs * sprites_per_pic; seq += sprites_per_pic) {
24 prgb* palette = palpic_getpalette(f);
26 size_t i;
27 for(i = seq; i < seq + sprites_per_pic; i++) {
28 int x, y;
29 const uint8_t *source = palpic_getspritedata(f, i);
30 for(y = 0; y < palpic_getspriteheight(f); y++) {
31 for(x = 0; x < palpic_getspritewidth(f); x++) {
32 *bufptr++ = palette[*source++];
37 pixWritePng("test.png", o, 0.0);
38 pixDestroy(&o);
40 return 0;