diff tools/lib64fmts.c @ 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
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;
 }