summaryrefslogtreecommitdiff
path: root/editvar.c
blob: b28fc9f0b1ac5a60f7cc6e83cfa0fa6b5dd70a12 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
/*

    viDOOM - level editor for DOOM

    Copyright (C) 2000  Ian Cowburn (ianc@noddybox.demon.co.uk)

    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation; either version 2 of the License, or
    (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with this program; if not, write to the Free Software
    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA

    -------------------------------------------------------------------------

    Editor global varaiable definitions

    Note that the lindefs, vertices, etc here are copied from the WadMap
    loaded prior to editting.  They are then reconverted back to the WadMap
    for saving.


*/
static const char rcs_id[]="$Id$";

#include "config.h"
#include "globals.h"

#include "editvar.h"


/* ---------------------------------------- EDIT TYPES
*/

char		*edit_str[]={"Sector","Linedef","Vertex","Thing","Multimode"};


/* ---------------------------------------- EDIT VARS
*/

void		HandleMoveKey(GFXKey k,int check_mouse);

int		edit_mode=SECTOR_MODE;

Map		vertex=NULL;
Map		linedef=NULL;
Map		sidedef=NULL;
Map		sector=NULL;
Map		thing=NULL;
Map		multimap=NULL;

int		SCRW;
int		SCRH;
int		FH;

int		scale=5;
int		ox;
int		oy;

GFXMouse	ms;

int		quit;

int		agrid;

int		current=-1;
List		selected=NULL;

/* This variable should be set to try by any actions in the generic object
   routines that have generated a new selection list.
*/
int		new_selection=FALSE;

Thing		ed_thing={0,0,0,1,0x07};

/* This variable stops the DrawObjectInfo() routine being called on redraws
*/
int		draw_current_info=TRUE;

/* ---------------------------------------- USED AS GENERIC FUNCTIONS AND VALUES
*/

/* Data in all these functions is the Object.data pointer
*/
int		(*PositionOnObject)(int x, int y, void *data);
void		(*SelectBox)(int x1, int y1, int x2, int y2);
void		(*SelectByType)(void);
void		(*DrawObject)(void *data, int selmode);
void		(*DrawObjectInfo)(void);
void		(*DrawObjectHeader)(void);
void		(*MoveObject)(void);
void		(*RotateObject)(double angle);
void		(*ScaleObject)(double scale);
void		(*SetTagObject)(int tag);
void		(*LocateObject)(void *obj);
void		(*ObjectMenu)(void);
void		(*ObjectInsert)(void);
void		(*ObjectDelete)(void);
void		(*ObjectKey)(GFXKey k);
int		(*ObjectHasTag)(void *obj, int tag);
void		(*SetSelect)(int i, int mode);

char		*typename;
Map		map;


/* ---------------------------------------- MENUS AND DIALOGS
*/
PLAT_MENU	thing_popup[]={
				{"Change type",TM_TYPE},
				{"Change angle",TM_ANGLE},
				{"Change flags",TM_FLAGS},
				{"Snap selected things",TM_SNAP},
				{"Move",TM_MOVE},
				{"Delete",TM_DELETE},
				{NULL,GUI_CANCEL}
			      };

PLAT_RADIO	thing_angle[]={
				{"N",90},
				{"NE",45},
				{"E",0},
				{"SE",315},
				{"S",270},
				{"SW",225},
				{"W",180},
				{"NW",135},
				{NULL,GUI_CANCEL}
			      };

PLAT_MENU	vertex_popup[]={
				{"Chain selected vertices",TM_CHAIN},
				{"Chain selected vertices "
				    "into a sector",TM_CHAIN_SECTOR},
				{"Merge selected vertices",TM_MERGE},
				{"Snap selected vertices",TM_SNAP},
				{"Move",TM_MOVE},
				{"Delete",TM_DELETE},
				{NULL,GUI_CANCEL}
			       };

PLAT_MENU	right_popup[]=
		    {
			{"Change upper texture",TM_UPPER_T_R},
			{"Change middle texture",TM_MIDDLE_T_R},
			{"Change lower texture",TM_LOWER_T_R},
			{"Change texture offset",TM_OFFSET_R},
			{"Adjust texture offset",TM_ADJUST_R},
			{"Change sector",TM_SECTOR_R},
			{"Align textures",TM_ALIGN_R},

			{NULL,GUI_CANCEL}
		    };

PLAT_MENU	left_popup[]=
		    {
			{"Change upper texture",TM_UPPER_T_L},
			{"Change middle texture",TM_MIDDLE_T_L},
			{"Change lower texture",TM_LOWER_T_L},
			{"Change texture offset",TM_OFFSET_L},
			{"Adjust texture offset",TM_ADJUST_L},
			{"Change sector",TM_SECTOR_L},
			{"Align textures",TM_ALIGN_L},

			{NULL,GUI_CANCEL}
		    };

PLAT_MENU	linedef_popup[]=
		    {
			{"Change linedef flags",TM_FLAGS},
			{"Change linedef type",TM_TYPE},
			{"Swap sides",TM_SWAP_SIDES},
			{"Split line",TM_SPLIT_LINE},
			{"Select trail from this linedef",TM_TRACK_LINE},
			{"Join linedefs with steps",TM_STEPS},

			{"Right sidedef =>",TM_RIGHT_SIDE},
			{"Left sidedef =>",TM_LEFT_SIDE},

			{"Change tag",TM_TAG},
			{"Move",TM_MOVE},
			{"Delete",TM_DELETE},
			{NULL,GUI_CANCEL}
		    };

PLAT_MENU	sector_popup[]=
		    {
			{"Change floor height",TM_FLOOR},
			{"Change ceiling height",TM_CEILING},
			{"Change light level",TM_LIGHT},
			{"Change tag",TM_TAG},
			{"Change floor",TM_FLOOR_T},
			{"Change ceiling",TM_CEILING_T},
			{"Change type",TM_TYPE},
			{"Paint sector in style",TM_STYLE},

			{"Move",TM_MOVE},
			{"Delete",TM_DELETE},
			{NULL,GUI_CANCEL}
		    };

PLAT_MENU	multi_popup[]=
		    {
			{"Move",TM_MOVE},
			{NULL,GUI_CANCEL}
		    };


PLAT_DIALOG	offset_dialog[D_OFFSET_NO]=
				{
				    {"X-offset",PLAT_DIAL_INTEGER,{0}},
				    {"Y-offset",PLAT_DIAL_INTEGER,{0}}
				};

PLAT_DIALOG	sectorn_dialog[D_OFFSET_NO]=
				{
				    {"Sector no",PLAT_DIAL_INTEGER,{0}},
				};

PLAT_DIALOG	coord_dialog[D_COORD_NO]=
				{
				    {"X",PLAT_DIAL_INTEGER,{0}},
				    {"Y",PLAT_DIAL_INTEGER,{0}}
				};

PLAT_DIALOG	vertex_dialog[D_VERTEX_NO]=
				{
				    {"Vertex from",PLAT_DIAL_INTEGER,{0}},
				    {"Vertex to",PLAT_DIAL_INTEGER,{0}}
				};

PLAT_DIALOG	sector_fl_dialog[D_SECTOR_FL_NO]=
				{
				    {"Floor height",PLAT_DIAL_INTEGER,{0}},
				};

PLAT_DIALOG	sector_ce_dialog[D_SECTOR_CE_NO]=
				{
				    {"Ceiling height",PLAT_DIAL_INTEGER,{0}},
				};

PLAT_DIALOG	sector_li_dialog[D_SECTOR_LI_NO]=
				{
				    {"Light level",PLAT_DIAL_INTEGER,{0}},
				};

PLAT_DIALOG	sector_val_dialog[D_SECTOR_VAL_NO]=
				{
				    {"Light level",PLAT_DIAL_INTEGER,{0}},
				    {"Floor height",PLAT_DIAL_INTEGER,{0}},
				    {"Ceiling height",PLAT_DIAL_INTEGER,{0}},
				};

PLAT_DIALOG	tag_dialog[D_TAG_NO]=
				{
				    {"Tag",PLAT_DIAL_INTEGER,{0}},
				};

PLAT_DIALOG	scale_dialog[D_SCALE_NO]=
				{
				    {"Scale",PLAT_DIAL_DOUBLE,{0}},
				};

PLAT_DIALOG	rotate_dialog[D_ROTATE_NO]=
				{
				    {"Angle",PLAT_DIAL_DOUBLE,{0}},
				};

PLAT_DIALOG	objno_dialog[D_OBJNO_NO]=
				{
				    {"Object number",PLAT_DIAL_INTEGER,{0}},
				};

PLAT_DIALOG	nosides_dialog[D_NOSIDES_NO]=
				{
				    {"Number of sides",PLAT_DIAL_INTEGER,{0}},
				};


/* ---------------------------------------- DRAWING TABLES
*/
Point		t_arrow[8]={{1,0},
			    {1,1},
			    {0,1},
			    {-1,1},
			    {-1,0},
			    {-1,-1},
			    {0,-1},
			    {1,-1}};

char		*angle_str[8]={"E","NE","N","NW","W","SW","S","SE"};


/* ---------------------------------------- HELP PAGES
*/
char		*general_help_keys=
			"F1                  - general help                   |"
			"F2                  - edit mode help                 |"
			"Escape              - finish editting                |"
			"Cursor keys         - move                           |"
			"Shift + Cursor keys - move quickly                   |"
			"Page down/up        - zoom in/out                    |"
			"Q/W                 - alter grid lock scale          |"
			"G                   - grid lock lines on/off         |"
			"X                   - grid snap on/off               |"
			"Tab/Shift + Tab     - next/previous edit mode        |"
			"V                   - VERTEX edit mode               |"
			"L                   - LINEDEF edit mode              |"
			"S                   - SECTOR edit mode               |"
			"T                   - THING edit mode                |"
			"C                   - MULTI edit mode                |"
			"F9                  - deselect all                   |"
			"Shift + F9          - invert selection               |"
			"F10                 - select all                     |"
			"Shift + F10         - select by type (if applicable) |"
			"F11/Shift + F11     - locate next/previous selection |"
			"DELETE              - delete selected objects        |"
			"INSERT              - insert new object              |"
			"F3                  - merge a PWAD map               |"
			"F4                  - move selected objects          |"
			"F5                  - rotate selected objects        |"
			"[                   - rotate 5 degrees left          |"
			"]                   - rotate 5 degrees right         |"
			"F6                  - scale selected objects         |"
			"{                   - scale by 90%                   |"
			"}                   - scale by 110%                  |"
			"F7                  - set tag (if applicable)        |"
			"Shift + F7          - select objects with tag        |"
			"F8                  - locate an object number        |"
			"Shift + F8          - locate and select object number|"
			"R                   - redraw [useful if selected     |"
			"                      sectors look unselected]       |"
			"                                                     |"
			"Note: Grid lock not honoured on rotate or scale      ";

char		*general_help_mouse=
	"Left button                - select object                     |"
	"Ctrl + Left button         - additionally select object        |"
	"Shift + Left button        - select objects in box             |"
	"Ctrl + Shift + Left button - additionally select objects in box|"
	"Right button               - pop-up object menu                |"
	"Middle button              - move selected objects             ";

char		*mode_help[]=
		    {
			/* SECTOR
			*/
			"M     - change sector move mode      |"
			"H     - toggle SECTOR tag highligting|"
			",     - decrease sector floor by 8   |"
			".     - increase sector floor by 8   |"
			"<     - decrease sector ceiling by 8 |"
			">     - increase sector ceiling by 8 |"
			"-     - decrease lighting level by 16|"
			"+     - increase lighting level by 16",

			/* LINEDEF
			*/
			"H     - toggle LINEDEF tag highligting     |"
			"F12   - perform checks for LINEDEF textures",

			/* VERTEX
			*/
			"F12   - remove vertices to bound to linedefs",

			/* THING
			*/
			"No additional key functions",

			/* MULTI
			*/
			"No additional key functions"
		    };


/* END OF FILE */