// // Draw Hud // void DrawHUD(void) { glLoadIdentity(); // change the matrix glMatrixMode(GL_PROJECTION); // current view glPushMatrix(); #if ENABLE_HUD glDisable(GL_LIGHTING); // setup projectino for text glLoadIdentity(); glOrtho(0, SCREEN_WIDTH, 0, SCREEN_HEIGHT, -1.0, 1.0); // get rid of textured text glDisable(GL_TEXTURE_2D); // dont need depth test glDisable(GL_DEPTH_TEST); // draw variables glColor3f(1.0, 1.0, 0.0); glRasterPos2i(10, 48); PrintText("FPS: %0.2f", framerate); PrintGlobals(); glPopMatrix(); // end // reset the textures glEnable(GL_TEXTURE_2D); glEnable(GL_DEPTH_TEST); glEnable(GL_LIGHTING); #endif // Begin normal code // reset the matrix glMatrixMode(GL_PROJECTION); glLoadIdentity(); gluPerspective(45.0f, (GLfloat)SCREEN_WIDTH / (GLfloat)SCREEN_HEIGHT, 0.1f, PERSPECTIVE_Z); glMatrixMode(GL_MODELVIEW); GetFramesPerSecond(); // get frames } // end of the function
/* ============ main ============ */ int main (int argc, char **argv) { const char *psrc; void *src, *src2; char filename[1024]; int p, c; unsigned short crc; double start, stop; FILE *f; myargc = argc; myargv = argv; if (CheckParm("-?") || CheckParm("-h") || CheckParm("-help") || CheckParm("--help")) { printf(" Compiles progs.dat using progs.src in the current directory\n"); printf(" -src <directory> : Specify source directory\n"); printf(" -dcc : decompile the progs.dat in the current directory\n"); printf(" -dcc -fix : fixes mangled names during decompilation\n"); printf(" -dcc -asm <functionname> : decompile filename to the console\n"); printf(" -dcc -dump -asm <functionname> : same as above but will show\n\t\tinstructions (opcodes and parms) as well\n"); exit(0); } ValidateByteorder (); start = GetTime (); p = CheckParm("-src"); if (p && p < argc-1) { strcpy(sourcedir, argv[p+1]); strcat(sourcedir, "/"); printf("Source directory: %s\n", sourcedir); } else { sourcedir[0] = '\0'; } InitData (); PR_FILE = stdout; p = CheckParm("-dump"); if (p) pr_dumpasm = true; // do a crc of the file p = CheckParm("-crc"); if (p) { CRC_Init (&crc); f = fopen ("progdefs.h", "r"); while ((c = fgetc(f)) != EOF) CRC_ProcessByte (&crc, (byte)c); printf ("#define PROGHEADER_CRC %i %d\n", crc, (int)crc); fclose (f); exit (0); } p = CheckParm("-dcc"); if (p) { DEC_ReadData ("progs.dat"); //fix mangled names if asked p = CheckParm ("-fix"); if (p) FILE_NUM_FOR_NAME = 1; memset(func_headers, 0, MAX_FUNCTIONS * sizeof(char *)); memset(temp_val, 0, MAX_REGS * sizeof(char *)); p = CheckParm("-bbb"); if (p) { /* i= -999; for (p = 0; p < numstatements; p++) if ((statements+p)->op > i) i = (statements+p)->op; printf("largest op %d\n", i); */ FindBuiltinParameters(1); exit (0); } p = CheckParm("-ddd"); if (p) { for (p++ ; p < argc ; p++) { if (argv[p][0] == '-') break; DccFunctionOP (atoi(argv[p])); } exit (0); } p = CheckParm("-info2"); if (p) { printf("\n=======================\n"); printf("fields\n"); printf("=======================\n"); PrintFields (); printf("\n=======================\n"); printf("globals\n"); printf("=======================\n"); PrintGlobals (); exit (0); } p = CheckParm("-info"); if (p) { printf("\n=======================\n"); printf("strings\n"); printf("=======================\n"); PrintStrings (); printf("\n=======================\n"); printf("functions"); printf("\n=======================\n"); PrintFunctions (); printf("\n=======================\n"); printf("fields\n"); printf("=======================\n"); PrintFields (); printf("\n=======================\n"); printf("globals\n"); printf("=======================\n"); PrintGlobals (); printf("\n=======================\n"); printf("pr_globals\n"); printf("=======================\n"); PrintPRGlobals (); printf("\n=======================\n"); printf("statements\n"); printf("=======================\n"); Printstatements(); exit (0); } p = CheckParm("-asm"); if (p) { for (p++; p < argc; p++) { if (argv[p][0] == '-') break; PR_PrintFunction(argv[p]); } } else { Dcc_Functions (); stop = GetTime (); printf("\n%d seconds elapsed.\n", (int)(stop-start)); } exit (0); } sprintf(filename, "%sprogs.src", sourcedir); LoadFile(filename, &src); psrc = (char *) src; psrc = COM_Parse(psrc); if (!psrc) { Error("No destination filename. HCC -help for info.\n"); } strcpy(destfile, com_token); printf("outputfile: %s\n", destfile); pr_dumpasm = false; PR_BeginCompilation(); // compile all the files do { psrc = COM_Parse(psrc); if (!psrc) break; sprintf (filename, "%s%s", sourcedir, com_token); printf ("compiling %s\n", filename); LoadFile (filename, &src2); if (!PR_CompileFile((char *)src2, filename)) exit (1); } while (1); if (!PR_FinishCompilation()) { Error ("compilation errors"); } p = CheckParm("-asm"); if (p) { for (p++; p < argc; p++) { if (argv[p][0] == '-') { break; } PrintFunction(argv[p]); } } // write progdefs.h crc = PR_WriteProgdefs("progdefs.h"); // crc = 14046; // FIXME: cheap hack for now!!!!!!!!!!!!! // write data file WriteData(crc); // write files.dat WriteFiles(); stop = GetTime (); printf("\n%d seconds elapsed.\n", (int)(stop-start)); exit (0); }