- Ferramenta pa concretar la paleta
This commit is contained in:
64
tools/paleta.pal
Normal file
64
tools/paleta.pal
Normal file
@@ -0,0 +1,64 @@
|
|||||||
|
JASC-PAL
|
||||||
|
0100
|
||||||
|
61
|
||||||
|
255 0 255
|
||||||
|
0 0 252
|
||||||
|
120 56 0
|
||||||
|
228 188 140
|
||||||
|
228 252 196
|
||||||
|
252 0 0
|
||||||
|
252 132 132
|
||||||
|
252 252 252
|
||||||
|
0 0 132
|
||||||
|
0 132 0
|
||||||
|
24 24 24
|
||||||
|
40 40 40
|
||||||
|
132 80 0
|
||||||
|
132 132 132
|
||||||
|
188 188 188
|
||||||
|
196 196 252
|
||||||
|
220 220 220
|
||||||
|
164 164 164
|
||||||
|
252 252 0
|
||||||
|
140 140 140
|
||||||
|
0 0 196
|
||||||
|
132 132 252
|
||||||
|
140 80 48
|
||||||
|
196 0 0
|
||||||
|
0 196 0
|
||||||
|
212 156 88
|
||||||
|
0 252 0
|
||||||
|
172 104 0
|
||||||
|
64 64 64
|
||||||
|
196 196 196
|
||||||
|
228 172 104
|
||||||
|
112 112 112
|
||||||
|
204 204 204
|
||||||
|
56 56 56
|
||||||
|
156 156 156
|
||||||
|
196 132 8
|
||||||
|
8 8 8
|
||||||
|
148 80 0
|
||||||
|
0 16 81
|
||||||
|
0 8 42
|
||||||
|
56 62 88
|
||||||
|
8 42 0
|
||||||
|
13 63 0
|
||||||
|
81 65 0
|
||||||
|
84 51 34
|
||||||
|
81 81 81
|
||||||
|
64 64 252
|
||||||
|
132 0 0
|
||||||
|
164 88 24
|
||||||
|
196 228 252
|
||||||
|
212 148 80
|
||||||
|
148 148 148
|
||||||
|
255 196 0
|
||||||
|
255 172 0
|
||||||
|
255 132 0
|
||||||
|
88 72 72
|
||||||
|
0 0 64
|
||||||
|
252 196 196
|
||||||
|
0 192 0
|
||||||
|
0 128 0
|
||||||
|
255 255 0
|
||||||
101
tools/paletter.cpp
Normal file
101
tools/paletter.cpp
Normal file
@@ -0,0 +1,101 @@
|
|||||||
|
#include <stdio.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <stdint.h>
|
||||||
|
#include <string>
|
||||||
|
#include "../source/gif.c"
|
||||||
|
|
||||||
|
#define NUM_RESOURCES 39
|
||||||
|
|
||||||
|
const char *resources[NUM_RESOURCES] = {
|
||||||
|
"../data/final01.GIF",
|
||||||
|
"../data/final02.GIF",
|
||||||
|
"../data/final03.GIF",
|
||||||
|
"../data/final04.GIF",
|
||||||
|
"../data/final05.GIF",
|
||||||
|
"../data/intro01.GIF",
|
||||||
|
"../data/intro02.GIF",
|
||||||
|
"../data/intro03.GIF",
|
||||||
|
"../data/intro04.GIF",
|
||||||
|
"../data/intro05.GIF",
|
||||||
|
"../data/intro06.GIF",
|
||||||
|
"../data/menuprin.gif",
|
||||||
|
"../data/mort.gif",
|
||||||
|
"../data/postfase.gif",
|
||||||
|
"../data/prefase.gif",
|
||||||
|
"../data/SEQ11.GIF",
|
||||||
|
"../data/SEQ12.GIF",
|
||||||
|
"../data/SEQ13.GIF",
|
||||||
|
"../data/SEQ14.GIF",
|
||||||
|
"../data/SEQ21.GIF",
|
||||||
|
"../data/SEQ22.GIF",
|
||||||
|
"../data/SEQ31.GIF",
|
||||||
|
"../data/SEQ32.GIF",
|
||||||
|
"../data/SEQ41.GIF",
|
||||||
|
"../data/SEQ42.GIF",
|
||||||
|
"../data/SEQ51.GIF",
|
||||||
|
"../data/SEQ52.GIF",
|
||||||
|
"../data/SEQ61.GIF",
|
||||||
|
"../data/SEQ71.GIF",
|
||||||
|
"../data/SEQ72.GIF",
|
||||||
|
"../data/SEQ73.GIF",
|
||||||
|
"../data/SEQ74.GIF",
|
||||||
|
"../data/tiles.gif",
|
||||||
|
"../data/boto.gif",
|
||||||
|
"../data/marca.gif",
|
||||||
|
"../data/marcador.gif",
|
||||||
|
"../data/puerta.gif",
|
||||||
|
"../data/sprites.gif",
|
||||||
|
"../data/aigua.gif"
|
||||||
|
};
|
||||||
|
|
||||||
|
uint32_t main_palette[256];
|
||||||
|
int num_entries = 0;
|
||||||
|
|
||||||
|
int main(int argc, char *argv[])
|
||||||
|
{
|
||||||
|
for (int i=0; i<256; ++i) main_palette[i]=0;
|
||||||
|
|
||||||
|
for (int i = 0; i<NUM_RESOURCES; ++i)
|
||||||
|
{
|
||||||
|
const char *resourcename = resources[i];
|
||||||
|
FILE *f = fopen(resourcename, "rb");
|
||||||
|
fseek(f, 0, SEEK_END);
|
||||||
|
int filesize = ftell(f);
|
||||||
|
fseek(f, 0, SEEK_SET);
|
||||||
|
uint8_t *buffer = (uint8_t *)malloc(filesize);
|
||||||
|
fread(buffer, filesize, 1, f);
|
||||||
|
fclose(f);
|
||||||
|
uint16_t w, h;
|
||||||
|
uint8_t *pixels = LoadGif(buffer, &w, &h);
|
||||||
|
int paletteSize;
|
||||||
|
uint32_t *pal = LoadPalette(buffer, &paletteSize);
|
||||||
|
free(buffer);
|
||||||
|
|
||||||
|
bool used[256];
|
||||||
|
for (int i=0; i<256; ++i) used[i] = false;
|
||||||
|
|
||||||
|
for (int y=0; y<h; ++y)
|
||||||
|
for (int x=0; x<w; ++x)
|
||||||
|
used[pixels[x+y*w]] = true;
|
||||||
|
|
||||||
|
for (int i=0; i<256; ++i)
|
||||||
|
if (used[i])
|
||||||
|
{
|
||||||
|
bool found = false;
|
||||||
|
for (int j=0; j<256; ++j) if (main_palette[j] == pal[i]) found = true;
|
||||||
|
if (!found) main_palette[num_entries++] = pal[i];
|
||||||
|
}
|
||||||
|
free(pixels);
|
||||||
|
free(pal);
|
||||||
|
}
|
||||||
|
printf("Num entries: %i\n", num_entries);
|
||||||
|
|
||||||
|
FILE *f = fopen("paleta.pal", "w");
|
||||||
|
fprintf(f, "JASC-PAL\n");
|
||||||
|
fprintf(f, "0100\n");
|
||||||
|
fprintf(f, "%i\n", num_entries);
|
||||||
|
for (int i=0; i<num_entries; ++i) fprintf(f, "%i %i %i\n", (main_palette[i]>>16)&0xff, (main_palette[i]>>8)&0xff, main_palette[i]&0xff);
|
||||||
|
fclose(f);
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user