#include #include #include #include #include #include "sgrab.h" #pragma hdrstop #define TILEBOXWIDTH 24 #define TILEBOXHEIGHT 32 #define TILESPERLINE 12 #define TILEWIDTH 16 #define TILEHEIGHT 30 #define MASKCOLOR 255 /* ============== = = GrabLynxWalls = = filename LYNXWALLS numtiles = ============== */ void GrabLynxWalls (void) { int x,y,xl,yl,w,h; int t,tiles; byte far *screen_p; GetToken (false); tiles = atoi (token); for (t=0 ; t=0;lastline--) { for (x=0;x=0;lastx--) if (quadrant[y][lastx] != MASKCOLOR) break; // leave space for line length in bytes length_p = lump_p; lump_p++; // grab the line, packing pixels if 3 in a row databyte = bit = 0; for (x=0 ; x<=lastx ; x++) { pixel = quadrant[y][x]; if (pixel==MASKCOLOR) pixel = 0; pixel <<= bit; databyte |= pixel; bit += 4; if (bit>=8) { *lump_p++ = (byte)databyte; bit-=8; databyte>>=8; } #if 0 // check for a run of pixels for (rle=0 ; x+rle<=lastx ; rle++) if (quadrant[y][x+rle+1] != pixel) break; #endif } if (bit || *(lump_p-1)&1 || lump_p == length_p+1) // if bits left, lynx bug, or nothing on line, write a final byte out *lump_p++ = (byte)databyte; // write out the length *length_p = lump_p-length_p; } } /* ============== = = GrabLynxScale = = filename LYNXSCALE spot = ============== */ void GrabLynxScale (void) { int spot,x,y,xl,yl,xh,yh; byte far *screen_p,pixel; int linedelta; GetToken (false); spot = atoi (token); xl = spot%5*64+1; yl = spot/5*62+1; // // grab the source block // xh = xl+63; yh = yl+60; screen_p = MK_FP(0xa000,yl*SCREENWIDTH+xl); linedelta = SCREENWIDTH - 63; memset (counts,0,sizeof(counts)); for (y=yl ; y