Mercurial > hg > dmlib
changeset 1859:f382cde6bb58
Rename various C64 sprite / character constants.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Sun, 24 Jun 2018 05:35:23 +0300 |
parents | 1816211341a0 |
children | 01d7feb9f9ce |
files | tools/gfxconv.c tools/lib64gfx.h |
diffstat | 2 files changed, 29 insertions(+), 27 deletions(-) [+] |
line wrap: on
line diff
--- a/tools/gfxconv.c Sun Jun 24 03:37:00 2018 +0300 +++ b/tools/gfxconv.c Sun Jun 24 05:35:23 2018 +0300 @@ -800,7 +800,7 @@ void dmDumpCharASCII(FILE *outFile, const Uint8 *buf, const size_t offs, const int fmt, const BOOL multicolor) { - for (size_t yc = 0; yc < C64_CHR_HEIGHT; yc++) + for (size_t yc = 0; yc < C64_CHR_HEIGHT_UT; yc++) { fprintf(outFile, "%04" DM_PRIx_SIZE_T " : ", offs + yc); dmPrintByte(outFile, buf[yc], fmt, multicolor); @@ -813,10 +813,10 @@ { size_t bufOffs, xc, yc; - for (bufOffs = yc = 0; yc < C64_SPR_HEIGHT; yc++) + for (bufOffs = yc = 0; yc < C64_SPR_HEIGHT_UT; yc++) { fprintf(outFile, "%04" DM_PRIx_SIZE_T " ", offs + bufOffs); - for (xc = 0; xc < C64_SPR_WIDTH; xc++) + for (xc = 0; xc < C64_SPR_WIDTH_UT; xc++) { dmPrintByte(outFile, buf[bufOffs], fmt, multicolor); fprintf(outFile, " "); @@ -1331,10 +1331,10 @@ if (xoffs < 0 || yoffs < 0 || xoffs + C64_CHR_WIDTH_PX > image->width || - yoffs + C64_CHR_HEIGHT > image->height) + yoffs + C64_CHR_HEIGHT_PX > image->height) return FALSE; - for (yc = 0; yc < C64_CHR_HEIGHT; yc++) + for (yc = 0; yc < C64_CHR_HEIGHT_UT; yc++) { const Uint8 *sp = image->data + ((yc + yoffs) * image->pitch) + xoffs; buf[yc] = dmConvertByte(sp, multicolor); @@ -1351,15 +1351,15 @@ if (xoffs < 0 || yoffs < 0 || xoffs + C64_SPR_WIDTH_PX > image->width || - yoffs + C64_SPR_HEIGHT > image->height) + yoffs + C64_SPR_HEIGHT_PX > image->height) return FALSE; - for (yc = 0; yc < C64_SPR_HEIGHT; yc++) + for (yc = 0; yc < C64_SPR_HEIGHT_UT; yc++) { - for (xc = 0; xc < C64_SPR_WIDTH_PX / C64_SPR_WIDTH; xc++) + for (xc = 0; xc < C64_SPR_WIDTH_PX / C64_SPR_WIDTH_UT; xc++) { const Uint8 *sp = image->data + ((yc + yoffs) * image->pitch) + (xc * 8) + xoffs; - buf[(yc * C64_SPR_WIDTH) + xc] = dmConvertByte(sp, multicolor); + buf[(yc * C64_SPR_WIDTH_UT) + xc] = dmConvertByte(sp, multicolor); } } @@ -1381,14 +1381,14 @@ case FFMT_CHAR: outBufSize = C64_CHR_SIZE; outBlockW = image->width / C64_CHR_WIDTH_PX; - outBlockH = image->height / C64_CHR_HEIGHT; + outBlockH = image->height / C64_CHR_HEIGHT_PX; outType = "char"; break; case FFMT_SPRITE: outBufSize = C64_SPR_SIZE; outBlockW = image->width / C64_SPR_WIDTH_PX; - outBlockH = image->height / C64_SPR_HEIGHT; + outBlockH = image->height / C64_SPR_HEIGHT_PX; outType = "sprite"; break; @@ -1431,7 +1431,7 @@ { case FFMT_CHAR: if (!dmConvertImage2Char(buf, image, - bx * C64_CHR_WIDTH_PX, by * C64_CHR_HEIGHT, + bx * C64_CHR_WIDTH_PX, by * C64_CHR_HEIGHT_PX, multicolor)) { ret = DMERR_DATA_ERROR; @@ -1441,7 +1441,7 @@ case FFMT_SPRITE: if (!dmConvertImage2Sprite(buf, image, - bx * C64_SPR_WIDTH_PX, by * C64_SPR_HEIGHT, + bx * C64_SPR_WIDTH_PX, by * C64_SPR_HEIGHT_PX, multicolor)) { ret = DMERR_DATA_ERROR; @@ -1480,16 +1480,16 @@ { case FFMT_CHAR: outSize = C64_CHR_SIZE; - outWidth = C64_CHR_WIDTH; + outWidth = C64_CHR_WIDTH_UT; outWidthPX = C64_CHR_WIDTH_PX; - outHeight = C64_CHR_HEIGHT; + outHeight = C64_CHR_HEIGHT_UT; break; case FFMT_SPRITE: outSize = C64_SPR_SIZE; - outWidth = C64_SPR_WIDTH; + outWidth = C64_SPR_WIDTH_UT; outWidthPX = C64_SPR_WIDTH_PX; - outHeight = C64_SPR_HEIGHT; + outHeight = C64_SPR_HEIGHT_UT; break; default:
--- a/tools/lib64gfx.h Sun Jun 24 03:37:00 2018 +0300 +++ b/tools/lib64gfx.h Sun Jun 24 05:35:23 2018 +0300 @@ -28,21 +28,23 @@ #define C64_SCR_PAR_XY (0.9365f) // Sprite constants -#define C64_SPR_WIDTH 3 // bytes -#define C64_SPR_HEIGHT 21 // lines -#define C64_SPR_WIDTH_PX (8 * C64_SPR_WIDTH) -#define C64_SPR_SIZE ((C64_SPR_WIDTH * C64_SPR_HEIGHT) + 1) +#define C64_SPR_WIDTH_PX 24 +#define C64_SPR_HEIGHT_PX 21 +#define C64_SPR_WIDTH_UT (C64_SPR_WIDTH_PX / 8) // bytes +#define C64_SPR_HEIGHT_UT C64_SPR_HEIGHT_PX +#define C64_SPR_SIZE ((C64_SPR_WIDTH_UT * C64_SPR_HEIGHT_UT) + 1) // Character constants -#define C64_CHR_WIDTH 1 // bytes -#define C64_CHR_HEIGHT 8 // lines -#define C64_CHR_WIDTH_PX (8 * C64_CHR_WIDTH) -#define C64_CHR_SIZE (C64_CHR_WIDTH * C64_CHR_HEIGHT) +#define C64_CHR_WIDTH_PX 8 +#define C64_CHR_HEIGHT_PX 8 +#define C64_CHR_WIDTH_UT 1 // bytes +#define C64_CHR_HEIGHT_UT 8 // lines +#define C64_CHR_SIZE (C64_CHR_WIDTH_UT * C64_CHR_HEIGHT_UT) // Etc. #define C64_NCOLORS 16 #define C64_VIDBANK_SIZE (16*1024) -#define C64_MAX_SPRITES (C64_VIDBANK_SIZE / C64_SPR_SIZE) +#define C64_MAX_SPRITES 1024 #define C64_MAX_CHARS 256 @@ -130,7 +132,7 @@ { BOOL multicolor, xexpand, yexpand; int color, xc, yc; - Uint8 data[C64_SPR_HEIGHT][C64_SPR_WIDTH]; + Uint8 data[C64_SPR_HEIGHT_UT][C64_SPR_WIDTH_UT]; } DMC64Sprite;