// PlayStation Gravity Force map viewer // Compile on Turbo C++ for DOS, runs on PC #include #include #include // Function prototypes void setGFpalette(void); // Sets screen palette to that of Amiga's Gravity Force unsigned char PALETTE[96] = { 0, 0, 0, 240, 240, 240, 224, 96, 32, 32, 80, 144, 240, 240, 32, 64, 112, 176, 112, 160, 208, 160, 208, 240, 176, 16, 0, 128, 0, 0, 192, 192, 192, 128, 128, 128, 48, 48, 48, 224, 176, 112, 192, 128, 64, 160, 96, 32, 128, 64, 0, 144, 144, 144, 96, 96, 96, 144, 144, 144, 32, 192, 0, 0, 128, 0, 0, 160, 0, 0, 160, 0, 160, 160, 160, 48, 192, 192, 48, 112, 112, 48, 192, 192, 0, 160, 160, 0, 80, 80, 0, 112, 112, 0, 112, 112 }; // svga256.bgi range 0-63 so div by 4 void setGFpalette() { for (int i=0; i<32; i++) setrgbpalette(i, PALETTE[i*3]/4, PALETTE[i*3+1]/4, PALETTE[i*3+2]/4); } int main() { unsigned int x=0, y=0; unsigned char inbyte=0, NEOF=0; FILE *gfmfile; if ((gfmfile = fopen("dogfite1.gfm","rb")) == NULL) { printf("\nFile not found: DOGFITE1.GFM\n\n"); return 1; } // 3 = SVGA 800x600x256 mode to see full virtual map int gmode=3, gdriver = installuserdriver("SVGA256", DETECT); initgraph(&gdriver, &gmode, ""); setGFpalette(); do { NEOF = fread(&inbyte, 1, 1, gfmfile); // read byte if (inbyte) // non zero value { putpixel(x, y, inbyte); // draw dot if (++x == 640) { x=0; y++; } } else // zero - black line { NEOF = fread(&inbyte, 1, 1, gfmfile); // read length of black line (must be non-zero) x+=inbyte; if (x >= 640) { x-=640; // add onto x; end of scanline y++; } } } while (NEOF); // While Not End Of File fclose(gfmfile); getch(); closegraph(); return 0; }