#include #include #include #include #include #include #include "sgrab.h" #pragma hdrstop typedef struct { unsigned height; // in blocks*2 unsigned collumnofs[64]; } wall_t; typedef struct { unsigned postofs[4096]; } holo_t; // post data: numruns [skipvalue(*2) runlen [data]] typedef struct { unsigned width; unsigned top,bottom; unsigned postofs[]; } scaleshape_t; /* ============== = = GrabWall = = filename WALL xblock yblock blockheight = ============== */ void GrabWall (void) { int x,y,xl,yl,xh,yh,w,h; byte far *screen_p; int linedelta; wall_t far *header; GetToken (false); xl = atoi (token)*8; GetToken (false); yl = atoi (token)*8; GetToken (false); h = atoi (token)*8; w = 64; xh = xl+w; yh = yl+h; header = (wall_t far *)lump_p; header->height = h/4; // block height*2 for (x=0;x<64;x++) header->collumnofs[x] = 65*2+x*h - (96-h); // adjusted for entry lump_p = (byte far *)&header->collumnofs[64]; screen_p = MK_FP(0xa000,yl*SCREENWIDTH+xl); for (x=xl;xwidth = w; lump_p = (byte far *)&header->postofs[w]; // // copy the lines to post[], then let SparsePost () write the data // header->top = WORLDHEIGHT; header->bottom = 0; for (x=0 ; xpostofs[x] = lump_p - (byte far *)header; for (y=0 ; ytop) header->top = adj; if (adj > header->bottom) header->bottom = adj; } *(screen_p+y*SCREENWIDTH) = 0; } SparsePost (); screen_p++; } } /* ============================================================================= HOLOGRAM ============================================================================= */ /* ============== = = GrabHolo = = filename HOLO = ============== */ #define HOLOSIZE 64 void GrabHolo (void) { int x,y,z,shift; int runcount,runs,count,lastz; byte far *screen_p,pixel; byte far *runs_p, far *count_p; holo_t far *header; byte far *plane[HOLOSIZE]; boolean inrun; // // initialize a blank hologram // A plane is an X/Y horizontal slice through the hologram // for (z=0;z=0;y--) if (*(plane[z]+y*HOLOSIZE+x)) { if (y==HOLOSIZE-1 || !*(plane[z]+(y+1)*HOLOSIZE+x)) *(plane[z]+y*HOLOSIZE+x) = pixel; } *screen_p = pixel; } // // color the west plane // for (z=0;z=0;x--) if (*(plane[z]+y*HOLOSIZE+x)) { if (x==HOLOSIZE-1 || !*(plane[z]+y*HOLOSIZE+x+1)) *(plane[z]+y*HOLOSIZE+x) = pixel; } *screen_p = pixel; } // // color the top plane // for (y=0;y=0;z--) if (*(plane[z]+y*HOLOSIZE+x)) { if (z==HOLOSIZE-1 || !*(plane[z+1]+y*HOLOSIZE+x)) *(plane[z]+y*HOLOSIZE+x) = pixel; } *screen_p = pixel; } // // draw an orthographic representation // screen_p = MK_FP(0xa000,0); for (y=0;ypostofs[4096]; for (y=0;ypostofs[y*HOLOSIZE+x] = lump_p - (byte far *)header; runs_p = lump_p++; runs = 0; lastz = 0; inrun = false; for (z=0;zpostofs[y*HOLOSIZE+x] = 0; *screen_p = 255; lump_p--; continue; } *runs_p = runs; *screen_p = pixel; } for (z=0;z