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