home *** CD-ROM | disk | FTP | other *** search
/ Quake++ for Quake / Quake++.iso / quake / edquake / code / edquake.c < prev    next >
Encoding:
C/C++ Source or Header  |  1996-08-12  |  3.9 KB  |  121 lines

  1. /*EdQuake v0.50 source code
  2.   (c) Copyright 1996 Scott Mitting
  3.   email:smitting@netusa1.net
  4.   ----------------------------------
  5.   EDQUAKE.C  -  Main control/init functions
  6.  
  7.   __variables:
  8.   MouseCursor mymousecursor -- mouse pointer used in EdQuake
  9.   extern int startvideomode -- video mode upon init
  10.  
  11.   __functions:
  12.   extern void initcpu()     -- inits the SVGACC library used by
  13.                    EdQuake (buy it, it's worth it)
  14.   int main()            -- main code/loop
  15.   void selectpakfile()      -- asks user input for the .pak file
  16.   void setnormcolors()      -- sets up colors for menu boxes in
  17.                    the default SVGA palette
  18.   ----------------------------------
  19. */
  20.  
  21. #include <stdio.h>
  22. #include <malloc.h>
  23. #include <dos.h>
  24. #include <stdlib.h>
  25. #include <string.h>
  26. #include "pak.h"
  27. #include "wad.h"
  28. #include "input.h"
  29. #include "ripper.h"
  30. #include "svgacc.h"
  31. #include "grfx.h"
  32. #include "mapedit.h"
  33. #include "viewer.h"
  34. #include "intpak.h"
  35. #include "disk.h"
  36.  
  37. MouseCursor mymousecursor = {
  38.     {2},{2},
  39.     {255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
  40.      255,  0,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
  41.      255,  0,  0,255,255,255,255,255,255,255,255,255,255,255,255,255,
  42.      255,  0, 15,  0,255,255,255,255,255,255,255,255,255,255,255,255,
  43.      255,  0, 15, 15,  0,255,255,255,255,255,255,255,255,255,255,255,
  44.      255,  0, 15, 15, 15,  0,255,255,255,255,255,255,255,255,255,255,
  45.      255,  0, 15, 15, 15, 15,  0,255,255,255,255,255,255,255,255,255,
  46.      255,  0, 15, 15, 15, 15, 15,  0,255,255,255,255,255,255,255,255,
  47.      255,  0, 15, 15, 15, 15, 15, 15,  0,255,255,255,255,255,255,255,
  48.      255,  0, 15, 15, 15, 15, 15, 15, 15,  0,255,255,255,255,255,255,
  49.      255,  0, 15, 15, 15, 15, 15, 15, 15, 15,  0,255,255,255,255,255,
  50.      255,  0, 15, 15, 15, 15, 15, 15, 15, 15, 15,  0,255,255,255,255,
  51.      255,  0, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15,  0,255,255,255,
  52.      255,  0, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15,  0,255,255,
  53.      255,  0, 15, 15, 15,  0, 15, 15, 15,  0,  0,  0,  0,  0,  0,255,
  54.      255,  0, 15, 15,  0,  0, 15, 15, 15,  0,255,255,255,255,255,255,
  55.      255,  0, 15,  0,255,255,  0, 15, 15, 15,  0,255,255,255,255,255,
  56.      255,  0,  0,255,255,255,  0, 15, 15, 15,  0,255,255,255,255,255,
  57.      255,  0,255,255,255,255,255,  0, 15, 15, 15,  0,255,255,255,255,
  58.      255,255,255,255,255,255,255,  0, 15, 15, 15,  0,255,255,255,255,
  59.      255,255,255,255,255,255,255,255,  0, 15, 15, 15,  0,255,255,255,
  60.      255,255,255,255,255,255,255,255,  0, 15, 15, 15,  0,255,255,255,
  61.      255,255,255,255,255,255,255,255,255,  0,  0,  0,255,255,255,255,
  62.      255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255}
  63. };
  64.  
  65. extern int startvideomode;
  66. extern void initcpu();
  67.  
  68. void setnormcolors()
  69. {
  70.     RED    = 4;
  71.     DKGRAY = 8;
  72.     LTGRAY = 7;
  73.     WHITE  = 15;
  74.     BLUE   = 1;
  75.     BLACK  = 0;
  76.     YELLOW = 14;
  77. }
  78.  
  79. void selectpakfile()
  80. {
  81.    button_t xbutton, ok, cancel;
  82.    char *t;
  83.    xbutton = inputbox(0,0,332,264,"Configurate");
  84.    loadpcx(6,20,"edquake.pcx");
  85.    drwstring(SET, 0,7,".PAK file:",10,225);
  86.    drwfillbox(SET,0,10,240,245,254);
  87.    ok = button(256,223,320,237,"   ok");
  88.    cancel = button(256,243,320,257," cancel");
  89.    mouseshow();
  90.    pakname = wgetstr("c:\\quake\\id1\\pak0.pak",13,240, ok, cancel, xbutton);
  91.    mousehide();
  92.    openpak();
  93. }
  94.  
  95. int main()
  96. {
  97.    int t;
  98.    initcpu();
  99.    res800();
  100.    mouseenter();
  101.    mousecursorset(&mymousecursor);
  102.    setnormcolors();
  103.    drwfillbox(SET,37,0,0,640,480);
  104.    loadpcx(74,155,"edqlogo.pcx");//492x167
  105. //   loadconfig();  //while you're waiting :)
  106.    delay(2000);
  107.    res800();
  108.    drwfillbox(SET,0,0,0,800,600);
  109.    selectpakfile();
  110.    if (pak.p)
  111.    {
  112.       t = findfile("maps/e1m1.bsp");
  113.       if (t < 1) t = selectentrykeyword(0, "bsp");
  114.       if (t > 0) mapedit(t);
  115.    }
  116.    mouseexit();
  117.    videomodeset(startvideomode);
  118.    saveconfig();
  119.    return 0;
  120. }
  121.