home *** CD-ROM | disk | FTP | other *** search
/ Amiga ACS 1998 #6 / amigaacscoverdisc1998-061998.iso / games / descent / source / main / editor / eglobal.c < prev    next >
C/C++ Source or Header  |  1998-06-08  |  8KB  |  214 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/editor/rcs/eglobal.c $
  15.  * $Revision: 2.0 $
  16.  * $Author: john $
  17.  * $Date: 1995/02/27 11:35:52 $
  18.  *
  19.  * Globals for editor.
  20.  *
  21.  * $Log: eglobal.c $
  22.  * Revision 2.0  1995/02/27  11:35:52  john
  23.  * Version 2.0! No anonymous unions, Watcom 10.0, with no need
  24.  * for bitmaps.tbl.
  25.  * 
  26.  * Revision 1.35  1994/05/23  14:48:15  mike
  27.  * make current segment be add segment.
  28.  * 
  29.  * Revision 1.34  1994/05/19  12:10:30  matt
  30.  * Use new vecmat macros and globals
  31.  * 
  32.  * Revision 1.33  1994/05/04  19:16:27  mike
  33.  * Add Degenerate_segment_found.
  34.  * 
  35.  * Revision 1.32  1994/05/03  11:02:57  mike
  36.  * Add SegSizeMode.
  37.  * 
  38.  * Revision 1.31  1994/02/16  13:49:12  mike
  39.  * enable editor to compile out.
  40.  * 
  41.  * Revision 1.30  1994/02/10  15:36:35  matt
  42.  * Various changes to make editor compile out.
  43.  * 
  44.  * Revision 1.29  1993/12/16  14:00:33  mike
  45.  * Add Curvert and Curedge.
  46.  * 
  47.  * Revision 1.28  1993/12/10  14:48:28  mike
  48.  * Kill orthogonal views.
  49.  * 
  50.  * Revision 1.27  1993/12/08  10:58:49  mike
  51.  * Add Cur_object_index.
  52.  * 
  53.  * Revision 1.26  1993/12/06  18:45:45  matt
  54.  * Changed object loading & handling
  55.  * 
  56.  * Revision 1.25  1993/12/02  17:51:49  john
  57.  * Changed my variable to match Mike's.
  58.  * 
  59.  * Revision 1.24  1993/12/02  17:36:13  john
  60.  * Added cur_obj_type
  61.  * 
  62.  * Revision 1.23  1993/11/24  14:41:16  mike
  63.  * Add variable Num_tilings.
  64.  * 
  65.  * Revision 1.22  1993/11/12  16:40:55  mike
  66.  * Add Identity_matrix, which is an identity matrix.
  67.  * 
  68.  * Revision 1.21  1993/11/02  13:08:17  mike
  69.  * Add N_warning_segs and Warning_segs
  70.  * 
  71.  * Revision 1.20  1993/11/02  10:31:53  mike
  72.  * Document some variables,
  73.  * Add Been_visited, removing it from editor.c
  74.  * Add Selected_segs[] and N_selected_segs.
  75.  * 
  76.  * Revision 1.19  1993/10/31  18:07:48  mike
  77.  * Add variable Lock_view_to_cursegp.
  78.  * 
  79.  * Revision 1.18  1993/10/19  20:54:51  matt
  80.  * Changed/cleaned up window updates
  81.  * 
  82.  * Revision 1.17  1993/10/18  18:35:43  mike
  83.  * Move Highest_vertex_index and Highest_segment_index here because they need
  84.  * to be globals.
  85.  * 
  86.  * Revision 1.16  1993/10/15  13:10:00  mike
  87.  * Move globals from editor.c to eglobal.c
  88.  * 
  89.  * Revision 1.15  1993/10/14  18:08:55  mike
  90.  * Change use of CONNECTIVITY to MAX_SIDES_PER_SEGMENT
  91.  * 
  92.  * Revision 1.14  1993/10/13  11:11:38  matt
  93.  * Made coordinate axes off by default
  94.  * 
  95.  * Revision 1.13  1993/10/12  09:59:27  mike
  96.  * Remove definition of Side_to_verts, which belongs in the game, not in the editor.
  97.  * 
  98.  * Revision 1.12  1993/10/09  15:48:07  mike
  99.  * Change type of Vertex_active and Side_to_verts from char to byte
  100.  * Move N_found_segs and Found_segs here from render.c
  101.  * Add Show_axes_flag.
  102.  * 
  103.  * Revision 1.11  1993/10/06  11:29:58  mike
  104.  * Add prototype for Side_opposite
  105.  * 
  106.  * Revision 1.10  1993/10/05  17:00:17  mike
  107.  * Add Vertex_active.
  108.  * 
  109.  * Revision 1.9  1993/10/04  17:18:16  mike
  110.  * Add variables Markedsegp, Markedside
  111.  * 
  112.  * Revision 1.8  1993/10/02  18:18:02  mike
  113.  * Added Draw_all_segments.  If !0, then all segments are drawn in draw_world.  If not set, then only those segments which
  114.  * are connected to the first segment are drawn.
  115.  * 
  116.  * Revision 1.7  1993/10/01  10:03:15  mike
  117.  * Fix ordering of vertices on front face: Used to be 0,1,2,3 made it 3,2,1,0
  118.  * 
  119.  * Revision 1.6  1993/09/27  16:04:28  mike
  120.  * Add Side_to_verts to replace _verts, which was local to segment.c
  121.  * 
  122.  * Revision 1.5  1993/09/27  15:20:52  mike
  123.  * Add Curside, which is current side, so we can make a certain side active.
  124.  * 
  125.  * Revision 1.4  1993/09/23  15:01:13  mike
  126.  * Remove game specific variables, put in mglobal.c
  127.  * 
  128.  * Revision 1.3  1993/09/22  10:52:17  mike
  129.  * Add global New_segment
  130.  * 
  131.  * Revision 1.2  1993/09/22  09:41:21  mike
  132.  * Change constand and variable names to conform to coding standards.
  133.  * 
  134.  * Revision 1.1  1993/09/20  17:06:09  mike
  135.  * Initial revision
  136.  * 
  137.  *
  138.  */
  139.  
  140. #pragma off (unreferenced)
  141. static char rcsid[] = "$Id: eglobal.c 2.0 1995/02/27 11:35:52 john Exp $";
  142. #pragma on (unreferenced)
  143.  
  144. #include "inferno.h"
  145. #include "segment.h"
  146. #include "editor.h"
  147.  
  148. // Global pointer to current vertices, right now always Vertices.  Set in create_new_mine.
  149. segment    New_segment;                // The segment which can be added to the mine.
  150. segment    *Cursegp;                    // Pointer to current segment in mine.
  151. int        Curside;                        // Side index in 0..MAX_SIDES_PER_SEGMENT of active side.
  152. int        Curedge;                        //    Current edge on current side, in 0..3
  153. int        Curvert;                        //    Current vertex on current side, in 0..3
  154. int        AttachSide = WFRONT;        //    Side on segment to attach.
  155. segment    *Markedsegp;                // Marked segment, used in conjunction with *Cursegp to form joints.
  156. int        Markedside;                    // Marked side on Markedsegp.
  157.  
  158. int        Draw_all_segments;        // Set to 1 means draw_world draws all segments in Segments, else draw only connected segments
  159.  
  160. byte        Vertex_active[MAX_VERTICES];    // !0 means vertex is in use, 0 means not in use.
  161.  
  162. int        N_selected_segs=0;                            // Number of segments found at Selected_segs
  163. short        Selected_segs[MAX_SELECTED_SEGS];        // List of segment numbers currently selected
  164.  
  165. int        N_warning_segs=0;                                // Number of segments warning-worthy, such as a concave segment
  166. short        Warning_segs[MAX_WARNING_SEGS];            // List of segment numbers currently selected
  167.  
  168. int        N_found_segs=0;                                // Number of segments found with last shift-mouse-click
  169. short        Found_segs[MAX_FOUND_SEGS];                // List of warning-worthy segments
  170.  
  171. int        Show_axes_flag=0;                                // 0 = don't show, !0 = do show coordinate axes in *Cursegp orientation
  172.  
  173. byte        Been_visited[MAX_SEGMENTS];                //    List of segments visited in a recursive search, if element n set, segment n done been visited
  174.  
  175. // Variables global to this editor.c and the k?????.c files.
  176. uint        Update_flags = UF_ALL;  //force total redraw
  177. int            Funky_chase_mode = 0;
  178. vms_angvec    Seg_orientation = {0,0,0};
  179. vms_vector    Seg_scale = {F1_0*20,F1_0*20,F1_0*20};
  180. int         mine_changed = 0;
  181. int         ModeFlag;
  182. editor_view *current_view;
  183.  
  184. int    SegSizeMode = 1;                                    // Mode = 0/1 = not/is legal to move bound vertices, 
  185.  
  186. //the view for the different windows.
  187. editor_view LargeView = {0,1, NULL, i2f(100),{f1_0,0,0,0,f1_0,0,0,0,f1_0},f1_0};
  188. #if ORTHO_VIEWS
  189. editor_view TopView   = {1,1, NULL, i2f(100),{f1_0,0,0,0,0,-f1_0,0,f1_0,0},f1_0};
  190. editor_view FrontView = {2,1, NULL, i2f(100),{f1_0,0,0,0,f1_0,0,0,0,f1_0},f1_0};
  191. editor_view RightView = {3,1, NULL, i2f(100),{0,0,f1_0,0,f1_0,0,f1_0,0,0},f1_0};
  192. #endif
  193.  
  194. editor_view *Views[] = {&LargeView,
  195. #if ORTHO_VIEWS
  196.     &TopView,&FrontView,&RightView
  197. #endif
  198.     };
  199.  
  200. int N_views = (sizeof(Views) / sizeof(*Views));
  201.  
  202. int    Lock_view_to_cursegp = 1;        // !0 means whenever cursegp changes, view it
  203.  
  204. int    Num_tilings = 1;                    // Number of tilings per wall
  205.  
  206. short Cur_object_index = -1;
  207.  
  208. // The current robot type
  209. int Cur_robot_type = 0;
  210.  
  211. //    !0 if a degenerate segment has been found.
  212. int    Degenerate_segment_found=0;
  213.  
  214.