home *** CD-ROM | disk | FTP | other *** search
/ Amiga ACS 1998 #6 / amigaacscoverdisc1998-061998.iso / games / descent / source / main / polyobj.h < prev    next >
Text File  |  1998-06-08  |  7KB  |  204 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/polyobj.h $
  15.  * $Revision: 2.1 $
  16.  * $Author: john $
  17.  * $Date: 1995/02/27 18:21:54 $
  18.  * 
  19.  * Header for polyobj.c, the polygon object code
  20.  * 
  21.  * $Log: polyobj.h $
  22.  * Revision 2.1  1995/02/27  18:21:54  john
  23.  * Added extern for robot_points.
  24.  * 
  25.  * Revision 2.0  1995/02/27  11:29:58  john
  26.  * New version 2.0, which has no anonymous unions, builds with
  27.  * Watcom 10.0, and doesn't require parsing BITMAPS.TBL.
  28.  * 
  29.  * Revision 1.28  1995/01/12  12:10:16  adam
  30.  * *** empty log message ***
  31.  * 
  32.  * Revision 1.27  1994/11/11  19:28:58  matt
  33.  * Added code to show low detail polygon models
  34.  * 
  35.  * Revision 1.26  1994/11/10  14:03:05  matt
  36.  * Hacked in support for player ships with different textures
  37.  * 
  38.  * Revision 1.25  1994/11/02  16:18:24  matt
  39.  * Moved draw_model_picture() out of editor
  40.  * 
  41.  * Revision 1.24  1994/10/18  10:55:57  adam
  42.  * bumped MAX_POLYGON_OBJECTS up
  43.  * 
  44.  * Revision 1.23  1994/10/17  21:35:01  matt
  45.  * Added support for new Control Center/Main Reactor
  46.  * 
  47.  * Revision 1.22  1994/09/09  14:23:42  matt
  48.  * Added glow code to polygon models for engine glow
  49.  * 
  50.  * Revision 1.21  1994/08/26  18:03:43  matt
  51.  * Added code to remap polygon model numbers by matching filenames
  52.  * 
  53.  * Revision 1.20  1994/08/26  15:36:00  matt
  54.  * Made eclips usable on more than one object at a time
  55.  * 
  56.  * Revision 1.19  1994/07/22  20:44:23  matt
  57.  * Killed unused fields in polygon model structure
  58.  * 
  59.  * Revision 1.18  1994/06/16  17:52:11  matt
  60.  * Made submodels rotate around their centers, not their pivot points
  61.  * 
  62.  * Revision 1.17  1994/06/14  12:22:05  matt
  63.  * Integrated with drive code, using #defines to switch versions
  64.  * 
  65.  * Revision 1.16  1994/06/09  16:25:01  matt
  66.  * Fixed confusion with two constants, MAX_SUBOBJS & MAX_SUBMODELS, which
  67.  * were used for the same things, but had different values.
  68.  * 
  69.  * Revision 1.15  1994/06/08  10:56:38  matt
  70.  * Improved debris: now get submodel size from new POF files; debris now has
  71.  * limited life; debris can now be blown up.
  72.  * 
  73.  * Revision 1.14  1994/06/07  16:51:57  matt
  74.  * Made object lighting work correctly; changed name of Ambient_light to
  75.  * Dynamic_light; cleaned up polygobj object rendering a little.
  76.  * 
  77.  * Revision 1.13  1994/05/26  21:08:59  matt
  78.  * Moved robot stuff out of polygon model and into robot_info struct
  79.  * Made new file, robot.c, to deal with robots
  80.  * 
  81.  * Revision 1.12  1994/05/18  19:35:05  matt
  82.  * Added fields for the rest of the subobj data
  83.  * 
  84.  * Revision 1.11  1994/05/16  16:17:13  john
  85.  * Bunch of stuff on my Inferno Task list May16-23
  86.  * 
  87.  * Revision 1.10  1994/05/13  11:08:31  matt
  88.  * Added support for multiple gun positions on polygon models
  89.  * 
  90.  * Revision 1.9  1994/04/29  09:18:04  matt
  91.  * Added support for multiple-piece explosions
  92.  * 
  93.  * Revision 1.8  1994/04/28  18:44:18  matt
  94.  * Took out code for old-style (non-interpreted) objects.
  95.  * 
  96.  * Revision 1.7  1994/03/25  16:54:38  matt
  97.  * draw_polygon_object() now takes pointer to animation data
  98.  * 
  99.  * Revision 1.6  1994/03/15  17:44:33  matt
  100.  * Changed a bunch of names
  101.  * 
  102.  * Revision 1.5  1994/03/07  20:02:29  matt
  103.  * Added pointer to normals in polyobj struct
  104.  * Added prototype for draw_polygon_object()
  105.  * 
  106.  * Revision 1.4  1994/03/01  17:16:19  matt
  107.  * Lots of changes to support loadable binary ".pof" robot files
  108.  * 
  109.  * Revision 1.3  1994/01/31  15:51:20  matt
  110.  * Added ptr for rgb table for robot colors
  111.  * 
  112.  * Revision 1.2  1994/01/28  13:52:01  matt
  113.  * Added flesh to this previously skeletal file.
  114.  * 
  115.  * Revision 1.1  1994/01/28  13:47:42  matt
  116.  * Initial revision
  117.  * 
  118.  * 
  119.  */
  120.  
  121.  
  122.  
  123. #ifndef _POLYOBJ_H
  124. #define _POLYOBJ_H
  125.  
  126. #include "vecmat.h"
  127. #include "gr.h"
  128. #include "3d.h"
  129.  
  130. #ifndef DRIVE
  131. #include "robot.h"
  132. #endif
  133. #include "piggy.h"
  134.  
  135. #ifndef DRIVE
  136. #define MAX_POLYGON_MODELS 85
  137. #else
  138. #define MAX_POLYGON_MODELS 300
  139. #define MAX_SUBMODELS 10
  140. #endif
  141.  
  142. //used to describe a polygon model
  143. typedef struct polymodel {
  144.     int n_models;
  145.     int model_data_size;
  146.     ubyte *model_data;
  147.     int submodel_ptrs[MAX_SUBMODELS];
  148.     vms_vector submodel_offsets[MAX_SUBMODELS];
  149.     vms_vector submodel_norms[MAX_SUBMODELS];        //norm for sep plane
  150.     vms_vector submodel_pnts[MAX_SUBMODELS];        //point on sep plane 
  151.     fix submodel_rads[MAX_SUBMODELS];                //radius for each submodel
  152.     ubyte submodel_parents[MAX_SUBMODELS];        //what is parent for each submodel
  153.     vms_vector submodel_mins[MAX_SUBMODELS];
  154.     vms_vector submodel_maxs[MAX_SUBMODELS];
  155.     vms_vector mins,maxs;                            //min,max for whole model
  156.     fix rad;
  157.     ubyte        n_textures;
  158.     ushort    first_texture;
  159.     ubyte        simpler_model;        //alternate model with less detail (0 if none, model_num+1 else)
  160. //    vms_vector min,max;
  161. } polymodel;
  162.  
  163. //array of pointers to polygon objects
  164. extern polymodel Polygon_models[];
  165.  
  166. //switch to simpler model when the object has depth 
  167. //greater than this value times its radius.   
  168. extern int Simple_model_threshhold_scale;
  169.  
  170. //how many polygon objects there are
  171. extern int N_polygon_models;
  172.  
  173.  
  174. //array of names of currently-loaded models
  175. extern char Pof_names[MAX_POLYGON_MODELS][13];
  176.  
  177. init_polygon_models();
  178.  
  179. #ifndef DRIVE
  180. int load_polygon_model(char *filename,int n_textures,int first_texture,robot_info *r);
  181. #else
  182. int load_polygon_model(char *filename,int n_textures,grs_bitmap ***textures);
  183. #endif
  184.  
  185. //draw a polygon model
  186. void draw_polygon_model(vms_vector *pos,vms_matrix *orient,vms_angvec *anim_angles,int model_num,int flags,fix light,fix *glow_values,bitmap_index alt_textures[]);
  187.  
  188. //fills in arrays gun_points & gun_dirs, returns the number of guns read
  189. int read_model_guns(char *filename,vms_vector *gun_points, vms_vector *gun_dirs, int *gun_submodels);
  190.  
  191. //draws the given model in the current canvas.  The distance is set to
  192. //more-or-less fill the canvas.  Note that this routine actually renders
  193. //into an off-screen canvas that it creates, then copies to the current
  194. //canvas.
  195. draw_model_picture(int mn,vms_angvec *orient_angles);
  196.  
  197. #define MAX_POLYOBJ_TEXTURES 50
  198. extern grs_bitmap *texture_list[MAX_POLYOBJ_TEXTURES];
  199. extern bitmap_index texture_list_index[MAX_POLYOBJ_TEXTURES];
  200. extern g3s_point robot_points[];
  201.  
  202. #endif
  203. 
  204.