Updated tools to use IMG instead of STA.

This commit is contained in:
Scott Duensing 2020-05-10 16:51:12 -05:00
parent 7b7dffad7a
commit 0be3ee69ba
6 changed files with 22 additions and 16 deletions

View file

@ -27,21 +27,21 @@ void convertColor(char *filename, char *basename, bool showIt) {
colors = image->format->palette->ncolors; colors = image->format->palette->ncolors;
c = image->format->palette->colors; c = image->format->palette->colors;
jlStaT *sta = NULL; jlImgT *img = NULL;
jlStaCreate(sta); jlImgCreate(img);
for (int x=0; x<colors; x++) { for (int x=0; x<colors; x++) {
sta->palette[x].r = c[x].r / 16; img->palette[x].r = c[x].r / 16;
sta->palette[x].g = c[x].g / 16; img->palette[x].g = c[x].g / 16;
sta->palette[x].b = c[x].b / 16; img->palette[x].b = c[x].b / 16;
//printf("Palette %03d = R%03d G%03d B%03d\n", x, sta->palette[x].r, sta->palette[x].g, sta->palette[x].b); //printf("Palette %03d = R%03d G%03d B%03d\n", x, img->palette[x].r, img->palette[x].g, img->palette[x].b);
} }
if (colors < 16) { if (colors < 16) {
for (int x=colors; x<16; x++) { for (int x=colors; x<16; x++) {
sta->palette[x].r = 0; img->palette[x].r = 0;
sta->palette[x].g = 0; img->palette[x].g = 0;
sta->palette[x].b = 0; img->palette[x].b = 0;
//printf("Palette %03d = R000 G000 B000 (added)\n", x); //printf("Palette %03d = R000 G000 B000 (added)\n", x);
} }
} }
@ -51,22 +51,22 @@ void convertColor(char *filename, char *basename, bool showIt) {
for (int x=0; x<image->w; x+=2) { for (int x=0; x<image->w; x+=2) {
//printf("%02X %02X ", getPixel(image, x, y), getPixel(image, x + 1, y)); //printf("%02X %02X ", getPixel(image, x, y), getPixel(image, x + 1, y));
// These are backwards - no idea why yet. // These are backwards - no idea why yet.
sta->pixels[p].r = (unsigned char)getPixel(image, x, y); img->pixels[p].r = (unsigned char)getPixel(image, x, y);
sta->pixels[p++].l = (unsigned char)getPixel(image, x + 1, y); img->pixels[p++].l = (unsigned char)getPixel(image, x + 1, y);
} }
} }
jlStaSave(sta, basename); jlImgSave(img, basename);
SDL_FreeSurface(image); SDL_FreeSurface(image);
if (showIt) { if (showIt) {
jlStaDisplay(sta); jlImgDisplay(img);
jlDisplayPresent(); jlDisplayPresent();
jlKeyWaitForAny(); jlKeyWaitForAny();
} }
jlStaFree(sta); jlImgFree(img);
} }
@ -193,7 +193,7 @@ int main(int argc, char *argv[]) {
return 1; return 1;
} }
jlUtilStartup("STA/STN Converter"); jlUtilStartup("IMG/STN Converter");
int imageFlags = IMG_INIT_JPG | IMG_INIT_PNG | IMG_INIT_TIF; int imageFlags = IMG_INIT_JPG | IMG_INIT_PNG | IMG_INIT_TIF;
int imageResult = IMG_Init(imageFlags); int imageResult = IMG_Init(imageFlags);

Binary file not shown.

BIN
joeylib/src/font.xcf (Stored with Git LFS) Normal file

Binary file not shown.

Binary file not shown.

BIN
joeylib/src/kanga.xcf (Stored with Git LFS) Normal file

Binary file not shown.

View file

@ -49,7 +49,7 @@ fi
# Call custom converter # Call custom converter
${JOEY}/utils/imgconvert "${FILENAME}-DoNtEvErDoThIs-1.png" "${FILENAME}-DoNtEvErDoThIs-2.png" "${NAME}" ${JOEY}/utils/imgconvert "${FILENAME}-DoNtEvErDoThIs-1.png" "${FILENAME}-DoNtEvErDoThIs-2.png" "${NAME}"
mv "data/${NAME}.sta" . mv "data/${NAME}.img" .
# Remove data folder if we created one # Remove data folder if we created one
if [[ "${HASDATA}" -eq "0" ]]; then if [[ "${HASDATA}" -eq "0" ]]; then