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

  1. /*EdQuake v0.50 source code
  2.   (c) Copyright 1996 Scott Mitting
  3.   email:smitting@netusa1.net
  4.   ----------------------------------
  5.   RIPPER.C  -  High level functions for Saving files
  6.  
  7.   __variables:
  8.  
  9.   __functions:
  10.   void setquakecolors()     -- sets colors for menus to the quake
  11.                    default palette
  12.   void showcredit(char *info)   -- shows bar at top of screen
  13.   void saveentry(int e)         -- selects file name and saves file
  14.   void savewadentry(int e)      -- selects file name and saves wad
  15.   void ripper()                 -- selects file from pak and saves
  16.                    it to disk.
  17.   void ripperwad()              -- selects file from wad and saves
  18.                    it to disk.
  19.   ----------------------------------
  20.   the entire source code is under renovation to make it easier
  21.   to understand.  happy coding.
  22. */
  23.  
  24. #include <stdio.h>
  25. #include <string.h>
  26. #include "pak.h"
  27. #include "input.h"
  28. #include "svgacc.h"
  29. #include "grfx.h"
  30. #include "wad.h"
  31.  
  32. void setquakecolors()
  33. {
  34.     RED    = 250;
  35.     DKGRAY = 4;
  36.     LTGRAY = 9;
  37.     WHITE  = 15;
  38.     BLUE   = 216;
  39.     BLACK  = 0;
  40.     YELLOW = 243;
  41. }
  42.  
  43. void showcredit(char *info)
  44. {
  45.  
  46.    drwfillbox(SET,BLUE,0,0,640,13);
  47.    drwstring(SET, WHITE,BLUE,"  EdQuake v0.01b",0,0);
  48.    drwstring(SET, WHITE,BLUE,info,200,0);
  49. }
  50.  
  51. void saveentry(int e)
  52. {
  53.    char *p;
  54.    int def;
  55.    getentry(e);
  56.  
  57.    //get default name
  58.    def = strlen(pakentry.name);
  59.    while (def > 0)
  60.    {
  61.       if (pakentry.name[def] == '/') def=-def;
  62.      else def--;
  63.    }
  64.    def=-def;
  65.    def++;
  66.    //end get default name
  67.  
  68.    p = wgetstringbox("Save File As", "Save as:", pakentry.name + def);
  69.    if (p) export(e, p);
  70.    drwfillbox(SET, BLACK, 100,150,430,225);
  71. }
  72.  
  73. void savewadentry(int e)
  74. {
  75.    char *p;
  76.    getwadentry(e);
  77.    p = wgetstringbox("Save File As", "Save as:", wadentry.name);
  78.    if (p) wadexport(e, p);
  79.    drwfillbox(SET, BLACK, 100,150,430,225);
  80. }
  81.  
  82. int ripper()
  83. {
  84.    int t;
  85.    mousehide();
  86.    drwfillbox(SET,BLACK,0,0,800,600);
  87.    mouseshow();
  88.    t = selectentry(0);
  89.    if (t > 0) saveentry(t);
  90.    return t;
  91. }
  92.  
  93. int ripperwad()
  94. {
  95.    int t;
  96.    setquakecolors();
  97.    loadpcx(0,0,"quakepal.pcx");
  98.    drwfillbox(SET,BLACK,0,0,800,600);
  99.    t = selectwadentry(0);
  100.    if (t != -1) savewadentry(t);
  101.    return t;
  102. }
  103.  
  104.