home *** CD-ROM | disk | FTP | other *** search
/ Amiga ACS 1998 #6 / amigaacscoverdisc1998-061998.iso / games / descent / source / main / mglobal.c < prev    next >
Text File  |  1998-06-08  |  8KB  |  253 lines

  1. /*
  2. THE COMPUTER CODE CONTAINED HEREIN IS THE SOLE PROPERTY OF PARALLAX
  3. SOFTWARE CORPORATION ("PARALLAX").  PARALLAX, IN DISTRIBUTING THE CODE TO
  4. END-USERS, AND SUBJECT TO ALL OF THE TERMS AND CONDITIONS HEREIN, GRANTS A
  5. ROYALTY-FREE, PERPETUAL LICENSE TO SUCH END-USERS FOR USE BY SUCH END-USERS
  6. IN USING, DISPLAYING,  AND CREATING DERIVATIVE WORKS THEREOF, SO LONG AS
  7. SUCH USE, DISPLAY OR CREATION IS FOR NON-COMMERCIAL, ROYALTY OR REVENUE
  8. FREE PURPOSES.  IN NO EVENT SHALL THE END-USER USE THE COMPUTER CODE
  9. CONTAINED HEREIN FOR REVENUE-BEARING PURPOSES.  THE END-USER UNDERSTANDS
  10. AND AGREES TO THE TERMS HEREIN AND ACCEPTS THE SAME BY USE OF THIS FILE.  
  11. COPYRIGHT 1993-1998 PARALLAX SOFTWARE CORPORATION.  ALL RIGHTS RESERVED.
  12. */
  13. /*
  14.  * $Source: f:/miner/source/main/rcs/mglobal.c $
  15.  * $Revision: 2.2 $
  16.  * $Author: john $
  17.  * $Date: 1995/03/14 18:24:37 $
  18.  *
  19.  * Global variables for main directory
  20.  *
  21.  * $Log: mglobal.c $
  22.  * Revision 2.2  1995/03/14  18:24:37  john
  23.  * Force Destination Saturn to use CD-ROM drive.
  24.  * 
  25.  * Revision 2.1  1995/03/06  16:47:23  mike
  26.  * destination saturn
  27.  * 
  28.  * Revision 2.0  1995/02/27  11:30:00  john
  29.  * New version 2.0, which has no anonymous unions, builds with
  30.  * Watcom 10.0, and doesn't require parsing BITMAPS.TBL.
  31.  * 
  32.  * Revision 1.43  1995/01/19  17:00:53  john
  33.  * Made save game work between levels.
  34.  * 
  35.  * Revision 1.42  1994/12/05  14:23:53  adam
  36.  * changed default detail to max, not custom
  37.  * 
  38.  * Revision 1.41  1994/11/19  15:15:07  mike
  39.  * remove unused code and data
  40.  * 
  41.  * Revision 1.40  1994/11/03  10:13:19  yuan
  42.  * Added #include "game.h"
  43.  * 
  44.  * Revision 1.39  1994/11/03  10:09:59  matt
  45.  * Properly initialize detail & difficulty levels
  46.  * 
  47.  * Revision 1.38  1994/10/30  14:11:21  mike
  48.  * rip out local segments stuff.
  49.  * 
  50.  * Revision 1.37  1994/10/26  15:21:30  mike
  51.  * detail level.
  52.  * 
  53.  * Revision 1.36  1994/09/22  10:46:12  mike
  54.  * Add difficulty levels.
  55.  * 
  56.  * Revision 1.35  1994/09/13  11:19:11  mike
  57.  * Add Next_missile_fire_time.
  58.  * 
  59.  * Revision 1.34  1994/08/31  19:25:34  mike
  60.  * GameTime and laser-firing limiting stuff added.
  61.  * 
  62.  * Revision 1.33  1994/08/11  18:58:53  mike
  63.  * Add Side_to_verts_int.
  64.  * 
  65.  * Revision 1.32  1994/07/21  19:01:38  mike
  66.  * Add Lsegment.
  67.  * 
  68.  * Revision 1.31  1994/07/21  13:11:24  matt
  69.  * Ripped out remants of old demo system, and added demo only system that
  70.  * disables object movement and game options from menu.
  71.  * 
  72.  * Revision 1.30  1994/06/17  18:06:48  matt
  73.  * Made password be treated as lowercase, since cmdline parsing converts
  74.  * everything to lowercase.
  75.  * 
  76.  * Revision 1.29  1994/03/15  16:33:04  yuan
  77.  * Cleaned up bm-loading code.
  78.  * (Fixed structures too)
  79.  * 
  80.  * Revision 1.28  1994/02/17  11:32:45  matt
  81.  * Changes in object system
  82.  * 
  83.  * Revision 1.27  1994/02/16  17:08:43  matt
  84.  * Added needed include of 3d.h
  85.  * 
  86.  * Revision 1.26  1994/02/16  13:47:58  mike
  87.  * fix bugs so editor can compile out.
  88.  * 
  89.  * Revision 1.25  1994/02/11  21:52:13  matt
  90.  * Made password protection selectable by #define (and thus INFERNO.INI)
  91.  * 
  92.  * Revision 1.24  1994/02/10  15:35:56  matt
  93.  * Various changes to make editor compile out.
  94.  * 
  95.  * Revision 1.23  1994/02/02  12:34:29  mike
  96.  * take out BATS encryption.
  97.  * 
  98.  * Revision 1.22  1994/01/21  16:08:11  matt
  99.  * Added FrameCount variable
  100.  * 
  101.  * Revision 1.21  1994/01/06  17:13:10  john
  102.  * Added Video clip functionality
  103.  * 
  104.  * Revision 1.20  1993/12/08  17:45:08  matt
  105.  * Changed password again
  106.  * 
  107.  * Revision 1.19  1993/12/08  17:41:05  matt
  108.  * Changed password
  109.  * 
  110.  * Revision 1.18  1993/12/08  10:55:10  mike
  111.  * Add free_obj_list
  112.  * 
  113.  * Revision 1.17  1993/12/07  13:46:38  john
  114.  * Added Explosion bitmap array
  115.  * 
  116.  * Revision 1.16  1993/12/06  18:40:35  matt
  117.  * Changed object loading & handling
  118.  * 
  119.  * Revision 1.15  1993/12/05  22:47:48  matt
  120.  * Reworked include files in an attempt to cut down on build times
  121.  * 
  122.  * Revision 1.14  1993/12/01  11:44:11  matt
  123.  * Chagned Frfract to FrameTime
  124.  * 
  125.  * Revision 1.13  1993/12/01  00:27:11  yuan
  126.  * Implemented new bitmap structure system...
  127.  * overall bitmap scheme still needs some work.
  128.  * 
  129.  * Revision 1.12  1993/11/19  17:21:59  matt
  130.  * Changed the bitmap number of object class UNICLASS
  131.  * Removed static initialization for objects
  132.  * 
  133.  * Revision 1.11  1993/11/18  13:51:47  mike
  134.  * Add Classes, Class_views, Objects
  135.  * 
  136.  * Revision 1.10  1993/11/04  18:52:36  matt
  137.  * Made Vertices[] and Segment_points[] use same constant for size, since
  138.  * they must be the same size anyway
  139.  * 
  140.  * Revision 1.9  1993/11/04  14:01:06  matt
  141.  * Mucked with include files
  142.  * 
  143.  * Revision 1.8  1993/10/26  13:58:42  mike
  144.  * Add password protection.
  145.  * 
  146.  * Revision 1.7  1993/10/14  18:05:50  mike
  147.  * Change Side_to_verts to use MAX_SIDES_PER_SEGMENT in place of CONNECTIVITY
  148.  * 
  149.  * Revision 1.6  1993/10/12  13:57:19  john
  150.  * added texture[]
  151.  * 
  152.  * Revision 1.5  1993/10/12  09:58:15  mike
  153.  * Move Side_to_verts here from eglobal.c, since it is needed in the game.
  154.  * 
  155.  * Revision 1.4  1993/10/09  15:52:30  mike
  156.  * Move test_pos, test_orient here from render.c.
  157.  * 
  158.  * Revision 1.3  1993/10/02  18:15:45  mike
  159.  * Killed include of segment.h, which gets included by inferno.h.
  160.  * 
  161.  * Revision 1.2  1993/09/23  17:54:24  mike
  162.  * Add Segment_points
  163.  * 
  164.  * Revision 1.1  1993/09/23  15:01:50  mike
  165.  * Initial revision
  166.  * 
  167.  *
  168.  */
  169.  
  170. #include "fix.h"
  171. #include "vecmat.h"
  172. #include "inferno.h"
  173. #include "segment.h"
  174. #include "object.h"
  175. #include "bm.h"
  176. #include "3d.h"
  177. #include "game.h"
  178.  
  179. #pragma off (unreferenced)
  180. static char rcsid[] = "$Id: mglobal.c 2.2 1995/03/14 18:24:37 john Exp $";
  181. #pragma on (unreferenced)
  182.  
  183. // Global array of vertices, common to one mine.
  184. vms_vector Vertices[MAX_VERTICES];
  185. g3s_point Segment_points[MAX_VERTICES];
  186.  
  187. fix FrameTime = 0;        // Time since last frame, in seconds
  188. fix GameTime = 0;        //    Time in game, in seconds
  189.  
  190. //How many frames we've rendered
  191. int FrameCount = 0;
  192.  
  193. //    This is the global mine which create_new_mine returns.
  194. segment    Segments[MAX_SEGMENTS];
  195. //lsegment    Lsegments[MAX_SEGMENTS];
  196.  
  197. // Number of vertices in current mine (ie, Vertices, pointed to by Vp)
  198. int        Num_vertices = 0;
  199. int        Num_segments = 0;
  200.  
  201. int        Highest_vertex_index=0;
  202. int        Highest_segment_index=0;
  203.  
  204. //    Translate table to get opposite side of a face on a segment.
  205. char    Side_opposite[MAX_SIDES_PER_SEGMENT] = {WRIGHT, WBOTTOM, WLEFT, WTOP, WFRONT, WBACK};
  206.  
  207. #define TOLOWER(c) ((((c)>='A') && ((c)<='Z'))?((c)+('a'-'A')):(c))
  208.  
  209. #ifdef PASSWORD
  210. #define encrypt(a,b,c,d)    a ^ TOLOWER((((int) PASSWORD)>>24)&255), \
  211.                                     b ^ TOLOWER((((int) PASSWORD)>>16)&255), \
  212.                                     c ^ TOLOWER((((int) PASSWORD)>>8)&255), \
  213.                                     d ^ TOLOWER((((int) PASSWORD))&255)
  214. #else
  215. #define encrypt(a,b,c,d) a,b,c,d
  216. #endif
  217.  
  218. byte Side_to_verts[MAX_SIDES_PER_SEGMENT][4] = {
  219.             encrypt(7,6,2,3),            // left
  220.             encrypt(0,4,7,3),            // top
  221.             encrypt(0,1,5,4),            // right
  222.             encrypt(2,6,5,1),            // bottom
  223.             encrypt(4,5,6,7),            // back
  224.             encrypt(3,2,1,0),            // front
  225. };        
  226.  
  227. //    Note, this MUST be the same as Side_to_verts, it is an int for speed reasons.
  228. int Side_to_verts_int[MAX_SIDES_PER_SEGMENT][4] = {
  229.             encrypt(7,6,2,3),            // left
  230.             encrypt(0,4,7,3),            // top
  231.             encrypt(0,1,5,4),            // right
  232.             encrypt(2,6,5,1),            // bottom
  233.             encrypt(4,5,6,7),            // back
  234.             encrypt(3,2,1,0),            // front
  235. };        
  236.  
  237. // Texture map stuff
  238.  
  239. int NumTextures = 0;
  240. bitmap_index Textures[MAX_TEXTURES];        // All textures.
  241.  
  242. fix    Next_laser_fire_time;            //    Time at which player can next fire his selected laser.
  243. fix    Next_missile_fire_time;            //    Time at which player can next fire his selected missile.
  244. //--unused-- fix    Laser_delay_time = F1_0/6;        //    Delay between laser fires.
  245.  
  246. #define DEFAULT_DIFFICULTY        1
  247.  
  248. int    Difficulty_level=DEFAULT_DIFFICULTY;    //    Difficulty level in 0..NDL-1, 0 = easiest, NDL-1 = hardest
  249. int    Detail_level=NUM_DETAIL_LEVELS-2;        //    Detail level in 0..NUM_DETAIL_LEVELS-1, 0 = boringest, NUM_DETAIL_LEVELS = coolest
  250.  
  251. char    Menu_pcx_name[13];
  252. 
  253.