changeset 1764:52e31cfc1e36

Implement fake X raster position for the pixel getting functions. At some point this will be turned into real fullscreen raster position.
author Matti Hamalainen <ccr@tnsp.org>
date Tue, 12 Jun 2018 04:43:05 +0300
parents 847bd77a538d
children cc7b5121c40b
files tools/lib64fmts.c tools/lib64gfx.c tools/lib64gfx.h
diffstat 3 files changed, 49 insertions(+), 40 deletions(-) [+]
line wrap: on
line diff
--- a/tools/lib64fmts.c	Tue Jun 12 00:27:37 2018 +0300
+++ b/tools/lib64fmts.c	Tue Jun 12 04:43:05 2018 +0300
@@ -369,10 +369,11 @@
 
 static Uint8 fmtGetPixelTruePaint(
     const DMC64Image *img, const int bmoffs, const int scroffs,
-    const int vshift, const int vbitmap, const int raster)
+    const int shift, const int bitmap, const int rasterX, const int rasterY)
 {
-    (void) raster;
-    return dmC64GetGenericMCPixel(img, bmoffs, scroffs, vshift, 0, vbitmap, 0, img->bgcolor);
+    (void) rasterX;
+    (void) rasterY;
+    return dmC64GetGenericMCPixel(img, bmoffs, scroffs, shift, 0, bitmap, 0, img->bgcolor);
 }
 
 
@@ -640,96 +641,102 @@
 
 static Uint8 fmtGetPixelFunPaint2(
     const DMC64Image *img, const int bmoffs, const int scroffs,
-    const int vshift, const int vbitmap, const int raster)
+    const int shift, const int bitmap, const int rasterX, const int rasterY)
 {
-    const int vbank = (raster & 7) + (vbitmap * 8);
+    const int vbank = (rasterY & 7) + (bitmap * 8);
     int vr, vb;
-    if (raster < 100)
+    (void) rasterX;
+    if (rasterY < 100)
     {
         vb = 0;
-        vr = raster;
+        vr = rasterY;
     }
     else
     {
         vb = 0;
-        vr = raster - 100;
+        vr = rasterY - 100;
     }
 
     return dmC64GetGenericMCPixel(
-        img, bmoffs, scroffs, vshift,
-        vbank, vbitmap, 0,
+        img, bmoffs, scroffs, shift,
+        vbank, bitmap, 0,
         img->extraData[vb].data[vr] & 15);
 }
 
 
 static Uint8 fmtGetPixelGunPaint(
     const DMC64Image *img, const int bmoffs, const int scroffs,
-    const int vshift, const int vbitmap, const int raster)
+    const int shift, const int bitmap, const int rasterX, const int rasterY)
 {
-    const int vbank = (raster & 7);// + (vbitmap * 8);
+    const int vbank = (rasterY & 7);// + (vbitmap * 8);
     int vr, vb;
-    if (raster < 177)
+    (void) rasterX;
+    if (rasterY < 177)
     {
         vb = 0;
-        vr = raster;
+        vr = rasterY;
     }
     else
     {
         vb = 0;
-        vr = raster - 177;
+        vr = rasterY - 177;
     }
 
     return dmC64GetGenericMCPixel(
-        img, bmoffs, scroffs, vshift,
-        vbank, vbitmap, 0,
+        img, bmoffs, scroffs, shift,
+        vbank, bitmap, 0,
         img->extraData[vb].data[vr] & 15);
 }
 
 
 static Uint8 fmtGetPixelBFLI(
     const DMC64Image *img, const int bmoffs, const int scroffs,
-    const int vshift, const int bitmap, const int raster)
+    const int shift, const int bitmap, const int rasterX, const int rasterY)
 {
     const int vbb = bmoffs > 0x1fff ? 1 : 0;
-    const int vbank = (raster & 7) + (vbb * 8);
+    const int vbank = (rasterY & 7) + (vbb * 8);
     const int vbmoffs = bmoffs & 0x1fff;
     const int vscroffs = scroffs & 0x3ff;
 
 //fprintf(stderr, "bmoffs=%d, scroffs=%d, vshift=%d, vbitmap=%d, raster=%d\n", vbmoffs, vscroffs, vshift, vbb, raster);
     (void) bitmap;
+    (void) rasterX;
 
     return dmC64GetGenericMCPixel(
-        img, vbmoffs, vscroffs, vshift,
+        img, vbmoffs, vscroffs, shift,
         vbank, vbb, 0, img->bgcolor);
 }
 
 
 static Uint8 fmtGetPixelBlackMailFLI(
     const DMC64Image *img, const int bmoffs, const int scroffs,
-    const int shift, const int bitmap, const int raster)
+    const int shift, const int bitmap, const int rasterX, const int rasterY)
 {
-    const int vbank = raster & 7;
+    const int vbank = rasterY & 7;
+    (void) rasterX;
 
     return dmC64GetGenericMCPixel(
         img, bmoffs, scroffs, shift,
         vbank, bitmap, 0,
-        img->extraData[0].data[raster] & 15);
+        img->extraData[0].data[rasterY] & 15);
 }
 
 
 static Uint8 fmtGetPixelFLIDesigner(
     const DMC64Image *img, const int bmoffs, const int scroffs,
-    const int shift, const int bitmap, const int raster)
+    const int shift, const int bitmap, const int rasterX, const int rasterY)
 {
-    return dmC64GetGenericMCPixel(img, bmoffs, scroffs, shift, raster & 7, bitmap, 0, img->bgcolor);
+    (void) rasterX;
+    return dmC64GetGenericMCPixel(img, bmoffs, scroffs, shift, rasterY & 7, bitmap, 0, img->bgcolor);
 }
 
 
 static Uint8 fmtGetPixelCrestHIFLIorCDHM(
     const DMC64Image *img, const int bmoffs, const int scroffs,
-    const int shift, const int bitmap, const int raster)
+    const int shift, const int bitmap, const int rasterX, const int rasterY)
 {
-    const int vbank = raster & 7;
+    const int vbank = rasterY & 7;
+    (void) rasterX;
 
     if ((img->bitmap[bitmap].data[bmoffs] >> shift) & 1)
         return img->screen[vbank].data[scroffs] >> 4;
@@ -751,14 +758,15 @@
 
 static Uint8 fmtGetPixelECI(
     const DMC64Image *img, const int bmoffs, const int scroffs,
-    const int shift, const int bitmap, const int raster)
+    const int shift, const int bitmap, const int rasterX, const int rasterY)
 {
-    const int vbank = raster & 7;
+    const int vbank = rasterY & 7;
     Uint8
         c1 = dmC64GetGenericSCPixel(img, bmoffs, scroffs, shift, vbank    , 0, 0),
         c2 = dmC64GetGenericSCPixel(img, bmoffs, scroffs, shift, vbank + 8, 1, 0);
 
     (void) bitmap;
+    (void) rasterX;
     return (c1 * C64_NCOLORS) + c2;
 }
 
--- a/tools/lib64gfx.c	Tue Jun 12 00:27:37 2018 +0300
+++ b/tools/lib64gfx.c	Tue Jun 12 04:43:05 2018 +0300
@@ -1297,7 +1297,7 @@
                 const int bmoffs = bmoffsy + (x * 8);
                 const int vshift = 7 - (xc & 7);
 
-                *d++ = getPixel(src, bmoffs, scroffs, vshift, 0, yc);
+                *d++ = getPixel(src, bmoffs, scroffs, vshift, 0, xc, yc);
             }
             else
             // Multicolor bitmap and variants
@@ -1313,8 +1313,8 @@
                     switch (src->laceType)
                     {
                         case D64_ILACE_RES:
-                            *d++ = getPixel(src, bmoffs, scroffs, vshift, 0, yc);
-                            *d++ = getPixel(src, bmoffs, scroffs, vshift, 1, yc);
+                            *d++ = getPixel(src, bmoffs, scroffs, vshift, 0, xc, yc);
+                            *d++ = getPixel(src, bmoffs, scroffs, vshift, 1, xc, yc);
                             break;
 
                         default:
@@ -1323,7 +1323,7 @@
                 }
                 else
                 {
-                    *d++ = getPixel(src, bmoffs, scroffs, vshift, 0, yc);
+                    *d++ = getPixel(src, bmoffs, scroffs, vshift, 0, xc, yc);
                 }
             }
         }
--- a/tools/lib64gfx.h	Tue Jun 12 00:27:37 2018 +0300
+++ b/tools/lib64gfx.h	Tue Jun 12 04:43:05 2018 +0300
@@ -161,7 +161,7 @@
 
 typedef Uint8 (*DMC64GetPixelFunc)(
     const DMC64Image *img, const int bmoffs, const int scroffs,
-    const int vshift, const int vbitmap, const int raster);
+    const int vshift, const int vbitmap, const int rasterX, const int rasterY);
 
 #define D64_MAX_ENCDEC_OPS 64
 
@@ -349,8 +349,7 @@
 
 static inline Uint8 dmC64GetGenericMCPixel(
     const DMC64Image *img, const int bmoffs, const int scroffs,
-    const int vshift, const int vbank, const int vbitmap, const int cbank,
-    const int bgcolor)
+    const int vshift, const int vbank, const int vbitmap, const int cbank, const int bgcolor)
 {
     switch ((img->bitmap[vbitmap].data[bmoffs] >> vshift) & 3)
     {
@@ -364,18 +363,20 @@
 
 static inline Uint8 fmtGetGenericSCPixel(
     const DMC64Image *img, const int bmoffs, const int scroffs,
-    const int vshift, const int vbitmap, const int raster)
+    const int vshift, const int vbitmap, const int rasterX, const int rasterY)
 {
-    (void) raster;
+    (void) rasterX;
+    (void) rasterY;
     return dmC64GetGenericSCPixel(img, bmoffs, scroffs, vshift, 0, vbitmap, 0);
 }
 
 
 static inline Uint8 fmtGetGenericMCPixel(
     const DMC64Image *img, const int bmoffs, const int scroffs,
-    const int vshift, const int vbitmap, const int raster)
+    const int vshift, const int vbitmap, const int rasterX, const int rasterY)
 {
-    (void) raster;
+    (void) rasterX;
+    (void) rasterY;
     return dmC64GetGenericMCPixel(img, bmoffs, scroffs, vshift, 0, vbitmap, 0, img->bgcolor);
 }