dedicated mapper for menu, new logo gfx, TODO: fix avr mem access again
also minor cleanups.
This commit is contained in:
@@ -32,16 +32,16 @@ int main(int argc, char** argv) {
|
||||
// depth = 2;
|
||||
// 4->2
|
||||
|
||||
pixperbyte = 2;
|
||||
mask_shift = 4;
|
||||
mask = 0x0f;
|
||||
depth = 4;
|
||||
// pixperbyte = 2;
|
||||
// mask_shift = 4;
|
||||
// mask = 0x0f;
|
||||
// depth = 4;
|
||||
// 4->4?
|
||||
|
||||
// pixperbyte = 1;
|
||||
// mask_shift = 0;
|
||||
// mask = 0xff;
|
||||
// depth = 8;
|
||||
pixperbyte = 1;
|
||||
mask_shift = 0;
|
||||
mask = 0xff;
|
||||
depth = 8;
|
||||
// 8->8
|
||||
|
||||
dsize = fsize * depth / (8/pixperbyte);
|
||||
|
||||
@@ -3,19 +3,19 @@
|
||||
|
||||
int main(void) {
|
||||
uint16_t tile=256;
|
||||
uint16_t pad=0xa+256;
|
||||
uint16_t pad=256;
|
||||
int i,j;
|
||||
FILE *out;
|
||||
if((out=fopen("tilemap", "wb"))==NULL) {
|
||||
perror("Could not open output file 'tilemap'");
|
||||
return 1;
|
||||
}
|
||||
for(i=0; i<10; i++) {
|
||||
for(j=0; j<21; j++) {
|
||||
for(i=0; i<8; i++) {
|
||||
for(j=0; j<26; j++) {
|
||||
fwrite(&tile, 2, 1, out);
|
||||
tile++;
|
||||
}
|
||||
for(j=21; j<32; j++) {
|
||||
for(j=26; j<32; j++) {
|
||||
fwrite(&pad, 2, 1, out);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,8 +18,27 @@ int main(int argc, char **argv) {
|
||||
while(1) {
|
||||
uint8_t c=fgetc(in);
|
||||
if(feof(in))break;
|
||||
if(c>=1 && c<=48) {
|
||||
c+=207;
|
||||
// if(c>=1 && c<=48) {
|
||||
// c+=207;
|
||||
// }
|
||||
|
||||
// shift palette by 32
|
||||
// keep color 0
|
||||
// leave room for sprite pal 3 and 7 (176-192 and 240-255)
|
||||
if(c) {
|
||||
if(c>224) { // move upper colors to start
|
||||
c-=224;
|
||||
} else if(c==224) { // remap 224 to 32, not 0
|
||||
c=32;
|
||||
} else { // shift colors, leave gap 176-191
|
||||
// relocate 0xd0-0xdf (which would be
|
||||
// remapped to 0x00-0x0f) to 0xb0-0xbf
|
||||
c+=32;
|
||||
if(c>=176) {
|
||||
c+=16;
|
||||
if(c<16) c=0xb0+c;
|
||||
}
|
||||
}
|
||||
}
|
||||
fputc(c, out);
|
||||
}
|
||||
|
||||
46
utils/palreorder.c
Normal file
46
utils/palreorder.c
Normal file
@@ -0,0 +1,46 @@
|
||||
#include <stdio.h>
|
||||
#include <stdint.h>
|
||||
|
||||
int main(int argc, char **argv) {
|
||||
if(argc<3) {
|
||||
fprintf(stderr, "Usage: %s <infile> <outfile>\n", argv[0]);
|
||||
return 1;
|
||||
}
|
||||
FILE *in, *out;
|
||||
if((in=fopen(argv[1], "rb"))==NULL) {
|
||||
perror("Could not open input file");
|
||||
return 1;
|
||||
}
|
||||
if((out=fopen(argv[2], "wb"))==NULL) {
|
||||
perror("Could not open output file");
|
||||
return 1;
|
||||
}
|
||||
uint16_t palette_src[256];
|
||||
uint16_t palette_tgt[256];
|
||||
uint16_t i=0;
|
||||
fread(palette_src, 2, 256, in);
|
||||
for(i=0; i<256; i++) {
|
||||
uint8_t tgt_index=i;
|
||||
if(tgt_index) {
|
||||
if(tgt_index>224) { // move upper colors to start
|
||||
tgt_index-=224;
|
||||
} else if(tgt_index==224) { // remap 224 to 32, not 0
|
||||
tgt_index=32;
|
||||
} else { // shift colors, leave gap 176-191
|
||||
// relocate 0xd0-0xdf (which would be
|
||||
// remapped to 0x00-0x0f) to 0xb0-0xbf
|
||||
tgt_index+=32;
|
||||
if(tgt_index>=176) {
|
||||
tgt_index+=16;
|
||||
if(tgt_index<16) tgt_index=0xb0+tgt_index;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
palette_tgt[tgt_index] = palette_src[i];
|
||||
}
|
||||
fwrite(palette_tgt, 2, 256, out);
|
||||
fclose(out);
|
||||
fclose(in);
|
||||
return 0;
|
||||
}
|
||||
Reference in New Issue
Block a user