Mercurial > hg > forks > yadex
annotate src/editloop.cc @ 107:20aa5a515896
Reformat one line /* */ comments to //
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Mon, 06 Oct 2014 12:42:55 +0300 |
parents | 99242b34e6dc |
children | f05330267c66 |
rev | line source |
---|---|
0 | 1 /* |
33
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
2 * editloop.cc |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
3 * The main loop of the editor. |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
4 * BW & RQ sometime in 1993 or 1994. |
0 | 5 */ |
6 | |
7 | |
8 /* | |
9 This file is part of Yadex. | |
10 | |
11 Yadex incorporates code from DEU 5.21 that was put in the public domain in | |
12 1994 by Raphaël Quinet and Brendon Wyber. | |
13 | |
14 The rest of Yadex is Copyright © 1997-2003 André Majorel and others. | |
15 | |
16 This program is free software; you can redistribute it and/or modify it under | |
17 the terms of the GNU General Public License as published by the Free Software | |
18 Foundation; either version 2 of the License, or (at your option) any later | |
19 version. | |
20 | |
21 This program is distributed in the hope that it will be useful, but WITHOUT | |
22 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS | |
23 FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. | |
24 | |
25 You should have received a copy of the GNU General Public License along with | |
26 this program; if not, write to the Free Software Foundation, Inc., 59 Temple | |
27 Place, Suite 330, Boston, MA 02111-1307, USA. | |
28 */ | |
29 | |
30 | |
31 #include "yadex.h" | |
32 #include <assert.h> | |
33 #include "_edit.h" | |
34 #include "checks.h" | |
35 #include "dialog.h" | |
36 #include "drawmap.h" | |
37 #include "edisplay.h" | |
38 #include "editgrid.h" | |
39 #include "editloop.h" | |
40 #include "editobj.h" | |
41 #include "editsave.h" | |
42 #include "editzoom.h" | |
43 #include "entry.h" | |
44 #include "entry2.h" | |
45 #include "events.h" | |
46 #include "gfx.h" | |
47 #include "gfx3.h" | |
48 #include "gotoobj.h" | |
49 #include "help2.h" | |
50 #include "l_flags.h" | |
51 #include "levels.h" | |
52 #include "lists.h" | |
53 #include "menubar.h" | |
54 #include "menu.h" | |
55 #include "modpopup.h" | |
56 #include "objects.h" | |
57 #include "objid.h" | |
58 #include "palview.h" | |
59 #include "prefer.h" | |
60 #include "rgbbmp.h" | |
61 #include "s_slice.h" | |
62 #include "selbox.h" | |
63 #include "selectn.h" | |
64 #include "selpath.h" | |
65 #include "spot.h" | |
66 #include "t_flags.h" | |
67 #include "t_spin.h" | |
68 #include "x_centre.h" | |
69 #include "x_exchng.h" | |
70 #include "x_hover.h" | |
71 #include "xref.h" | |
24
b2dc19044bf3
Import simple 3D preview, an old patch by Andrew Apted. Pressing 'R' key
Matti Hamalainen <ccr@tnsp.org>
parents:
22
diff
changeset
|
72 #include "r_render.h" |
0 | 73 |
74 | |
25
8eaf72e2041b
Reindent the source using GNU indent and "indent -i4 -bli0 -npcs -nprs -npsl".
Matti Hamalainen <ccr@tnsp.org>
parents:
24
diff
changeset
|
75 static int zoom_fit(edit_t &); |
107
20aa5a515896
Reformat one line /* */ comments to //
Matti Hamalainen <ccr@tnsp.org>
parents:
89
diff
changeset
|
76 static int menubar_out_y1; // FIXME |
0 | 77 |
78 | |
107
20aa5a515896
Reformat one line /* */ comments to //
Matti Hamalainen <ccr@tnsp.org>
parents:
89
diff
changeset
|
79 // prototypes of private functions |
25
8eaf72e2041b
Reindent the source using GNU indent and "indent -i4 -bli0 -npcs -nprs -npsl".
Matti Hamalainen <ccr@tnsp.org>
parents:
24
diff
changeset
|
80 static int SortLevels(const void *item1, const void *item2); |
0 | 81 |
82 /* | |
33
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
83 * SelectLevel |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
84 * Prompt the user for a level name (EnMn or MAPnm). The |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
85 * name chosen must be present in the master directory |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
86 * (iwad or pwads). |
0 | 87 * |
33
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
88 * If <levelno> is 0, the level name can be picked from all |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
89 * levels present in the master directory. If <levelno> is |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
90 * non-zero, the level name can be picked only from those |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
91 * levels in the master directory for which |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
92 * levelname2levelno() % 1000 is equal to <levelno>. For |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
93 * example, if <levelno> is equal to 12, only E1M2 and |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
94 * MAP12 would be listed. This feature is not used anymore |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
95 * because "e" now requires an argument and tends to deal |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
96 * with ambiguous level names (like "12") itself. |
0 | 97 */ |
25
8eaf72e2041b
Reindent the source using GNU indent and "indent -i4 -bli0 -npcs -nprs -npsl".
Matti Hamalainen <ccr@tnsp.org>
parents:
24
diff
changeset
|
98 const char *SelectLevel(int levelno) |
0 | 99 { |
25
8eaf72e2041b
Reindent the source using GNU indent and "indent -i4 -bli0 -npcs -nprs -npsl".
Matti Hamalainen <ccr@tnsp.org>
parents:
24
diff
changeset
|
100 MDirPtr dir; |
107
20aa5a515896
Reformat one line /* */ comments to //
Matti Hamalainen <ccr@tnsp.org>
parents:
89
diff
changeset
|
101 static char name[WAD_NAME + 1]; // AYM it was [7] previously |
25
8eaf72e2041b
Reindent the source using GNU indent and "indent -i4 -bli0 -npcs -nprs -npsl".
Matti Hamalainen <ccr@tnsp.org>
parents:
24
diff
changeset
|
102 char **levels = 0; |
107
20aa5a515896
Reformat one line /* */ comments to //
Matti Hamalainen <ccr@tnsp.org>
parents:
89
diff
changeset
|
103 int n = 0; // number of levels in the dir. that match |
0 | 104 |
25
8eaf72e2041b
Reindent the source using GNU indent and "indent -i4 -bli0 -npcs -nprs -npsl".
Matti Hamalainen <ccr@tnsp.org>
parents:
24
diff
changeset
|
105 get_levels_that_match: |
80
2f1ecc1c5f72
Huge cleanup -- move some global variables into a struct.
Matti Hamalainen <ccr@tnsp.org>
parents:
43
diff
changeset
|
106 for (dir = cfg.MasterDir; dir; dir = dir->next) |
25
8eaf72e2041b
Reindent the source using GNU indent and "indent -i4 -bli0 -npcs -nprs -npsl".
Matti Hamalainen <ccr@tnsp.org>
parents:
24
diff
changeset
|
107 { |
33
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
108 if (levelname2levelno(dir->dir.name) > 0 |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
109 && (levelno == 0 |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
110 || levelname2levelno(dir->dir.name) % 1000 == levelno)) |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
111 { |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
112 if (n == 0) |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
113 levels = (char **) GetMemory(sizeof(char *)); |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
114 else |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
115 levels = |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
116 (char **) ResizeMemory(levels, (n + 1) * sizeof(char *)); |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
117 levels[n] = dir->dir.name; |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
118 n++; |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
119 } |
25
8eaf72e2041b
Reindent the source using GNU indent and "indent -i4 -bli0 -npcs -nprs -npsl".
Matti Hamalainen <ccr@tnsp.org>
parents:
24
diff
changeset
|
120 } |
107
20aa5a515896
Reformat one line /* */ comments to //
Matti Hamalainen <ccr@tnsp.org>
parents:
89
diff
changeset
|
121 if (n == 0 && levelno != 0) // In case no level matched levelno |
25
8eaf72e2041b
Reindent the source using GNU indent and "indent -i4 -bli0 -npcs -nprs -npsl".
Matti Hamalainen <ccr@tnsp.org>
parents:
24
diff
changeset
|
122 { |
107
20aa5a515896
Reformat one line /* */ comments to //
Matti Hamalainen <ccr@tnsp.org>
parents:
89
diff
changeset
|
123 levelno = 0; // List ALL levels instead |
33
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
124 goto get_levels_that_match; |
25
8eaf72e2041b
Reindent the source using GNU indent and "indent -i4 -bli0 -npcs -nprs -npsl".
Matti Hamalainen <ccr@tnsp.org>
parents:
24
diff
changeset
|
125 } |
0 | 126 /* So that InputNameFromList doesn't fail if you |
127 have both EnMn's and MAPnn's in the master dir. */ | |
25
8eaf72e2041b
Reindent the source using GNU indent and "indent -i4 -bli0 -npcs -nprs -npsl".
Matti Hamalainen <ccr@tnsp.org>
parents:
24
diff
changeset
|
128 qsort(levels, n, sizeof(char *), SortLevels); |
8eaf72e2041b
Reindent the source using GNU indent and "indent -i4 -bli0 -npcs -nprs -npsl".
Matti Hamalainen <ccr@tnsp.org>
parents:
24
diff
changeset
|
129 al_scps(name, levels[0], sizeof name - 1); |
8eaf72e2041b
Reindent the source using GNU indent and "indent -i4 -bli0 -npcs -nprs -npsl".
Matti Hamalainen <ccr@tnsp.org>
parents:
24
diff
changeset
|
130 if (n == 1) |
33
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
131 return name; |
25
8eaf72e2041b
Reindent the source using GNU indent and "indent -i4 -bli0 -npcs -nprs -npsl".
Matti Hamalainen <ccr@tnsp.org>
parents:
24
diff
changeset
|
132 InputNameFromList(-1, -1, "Level name :", n, levels, name); |
8eaf72e2041b
Reindent the source using GNU indent and "indent -i4 -bli0 -npcs -nprs -npsl".
Matti Hamalainen <ccr@tnsp.org>
parents:
24
diff
changeset
|
133 FreeMemory(levels); |
8eaf72e2041b
Reindent the source using GNU indent and "indent -i4 -bli0 -npcs -nprs -npsl".
Matti Hamalainen <ccr@tnsp.org>
parents:
24
diff
changeset
|
134 return name; |
0 | 135 } |
136 | |
137 | |
138 /* | |
139 compare 2 level names (for sorting) | |
140 */ | |
141 | |
25
8eaf72e2041b
Reindent the source using GNU indent and "indent -i4 -bli0 -npcs -nprs -npsl".
Matti Hamalainen <ccr@tnsp.org>
parents:
24
diff
changeset
|
142 static int SortLevels(const void *item1, const void *item2) |
0 | 143 { |
107
20aa5a515896
Reformat one line /* */ comments to //
Matti Hamalainen <ccr@tnsp.org>
parents:
89
diff
changeset
|
144 // FIXME should probably use y_stricmp() instead |
25
8eaf72e2041b
Reindent the source using GNU indent and "indent -i4 -bli0 -npcs -nprs -npsl".
Matti Hamalainen <ccr@tnsp.org>
parents:
24
diff
changeset
|
145 return strcmp(*((const char *const *) item1), |
33
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
146 *((const char *const *) item2)); |
0 | 147 } |
148 | |
149 | |
150 // A table of the modes in the editor. | |
151 typedef struct | |
25
8eaf72e2041b
Reindent the source using GNU indent and "indent -i4 -bli0 -npcs -nprs -npsl".
Matti Hamalainen <ccr@tnsp.org>
parents:
24
diff
changeset
|
152 { |
33
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
153 i8 obj_type; // Corresponding object type |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
154 i8 item_no; // # of item to tick in the "View" menu |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
155 i8 menu_no; // # of flavour of the "Misc op." menu |
25
8eaf72e2041b
Reindent the source using GNU indent and "indent -i4 -bli0 -npcs -nprs -npsl".
Matti Hamalainen <ccr@tnsp.org>
parents:
24
diff
changeset
|
156 } editmode_t; |
0 | 157 |
158 const int NB_MODES = 4; | |
159 | |
25
8eaf72e2041b
Reindent the source using GNU indent and "indent -i4 -bli0 -npcs -nprs -npsl".
Matti Hamalainen <ccr@tnsp.org>
parents:
24
diff
changeset
|
160 static const editmode_t modes[NB_MODES] = { |
8eaf72e2041b
Reindent the source using GNU indent and "indent -i4 -bli0 -npcs -nprs -npsl".
Matti Hamalainen <ccr@tnsp.org>
parents:
24
diff
changeset
|
161 {OBJ_THINGS, 0, MBM_MISC_T}, |
8eaf72e2041b
Reindent the source using GNU indent and "indent -i4 -bli0 -npcs -nprs -npsl".
Matti Hamalainen <ccr@tnsp.org>
parents:
24
diff
changeset
|
162 {OBJ_LINEDEFS, 1, MBM_MISC_L}, |
8eaf72e2041b
Reindent the source using GNU indent and "indent -i4 -bli0 -npcs -nprs -npsl".
Matti Hamalainen <ccr@tnsp.org>
parents:
24
diff
changeset
|
163 {OBJ_VERTICES, 2, MBM_MISC_V}, |
8eaf72e2041b
Reindent the source using GNU indent and "indent -i4 -bli0 -npcs -nprs -npsl".
Matti Hamalainen <ccr@tnsp.org>
parents:
24
diff
changeset
|
164 {OBJ_SECTORS, 3, MBM_MISC_S}, |
8eaf72e2041b
Reindent the source using GNU indent and "indent -i4 -bli0 -npcs -nprs -npsl".
Matti Hamalainen <ccr@tnsp.org>
parents:
24
diff
changeset
|
165 }; |
0 | 166 |
167 | |
168 /* | |
33
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
169 * obj_type_to_mode_no |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
170 * Return the # of the mode that has this <obj_type> |
0 | 171 */ |
25
8eaf72e2041b
Reindent the source using GNU indent and "indent -i4 -bli0 -npcs -nprs -npsl".
Matti Hamalainen <ccr@tnsp.org>
parents:
24
diff
changeset
|
172 static int obj_type_to_mode_no(int obj_type) |
0 | 173 { |
25
8eaf72e2041b
Reindent the source using GNU indent and "indent -i4 -bli0 -npcs -nprs -npsl".
Matti Hamalainen <ccr@tnsp.org>
parents:
24
diff
changeset
|
174 int n; |
8eaf72e2041b
Reindent the source using GNU indent and "indent -i4 -bli0 -npcs -nprs -npsl".
Matti Hamalainen <ccr@tnsp.org>
parents:
24
diff
changeset
|
175 for (n = 0; n < NB_MODES; n++) |
33
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
176 if (modes[n].obj_type == obj_type) |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
177 break; |
25
8eaf72e2041b
Reindent the source using GNU indent and "indent -i4 -bli0 -npcs -nprs -npsl".
Matti Hamalainen <ccr@tnsp.org>
parents:
24
diff
changeset
|
178 if (n == NB_MODES) |
33
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
179 fatal_error("no mode for obj_type %d", obj_type); |
25
8eaf72e2041b
Reindent the source using GNU indent and "indent -i4 -bli0 -npcs -nprs -npsl".
Matti Hamalainen <ccr@tnsp.org>
parents:
24
diff
changeset
|
180 return n; |
0 | 181 } |
182 | |
183 | |
184 // Used by the View menu | |
25
8eaf72e2041b
Reindent the source using GNU indent and "indent -i4 -bli0 -npcs -nprs -npsl".
Matti Hamalainen <ccr@tnsp.org>
parents:
24
diff
changeset
|
185 bool mode_th(micbarg_t p) |
8eaf72e2041b
Reindent the source using GNU indent and "indent -i4 -bli0 -npcs -nprs -npsl".
Matti Hamalainen <ccr@tnsp.org>
parents:
24
diff
changeset
|
186 { |
8eaf72e2041b
Reindent the source using GNU indent and "indent -i4 -bli0 -npcs -nprs -npsl".
Matti Hamalainen <ccr@tnsp.org>
parents:
24
diff
changeset
|
187 return ((edit_t *) p)->obj_type == OBJ_THINGS; |
8eaf72e2041b
Reindent the source using GNU indent and "indent -i4 -bli0 -npcs -nprs -npsl".
Matti Hamalainen <ccr@tnsp.org>
parents:
24
diff
changeset
|
188 } |
8eaf72e2041b
Reindent the source using GNU indent and "indent -i4 -bli0 -npcs -nprs -npsl".
Matti Hamalainen <ccr@tnsp.org>
parents:
24
diff
changeset
|
189 |
8eaf72e2041b
Reindent the source using GNU indent and "indent -i4 -bli0 -npcs -nprs -npsl".
Matti Hamalainen <ccr@tnsp.org>
parents:
24
diff
changeset
|
190 bool mode_l(micbarg_t p) |
8eaf72e2041b
Reindent the source using GNU indent and "indent -i4 -bli0 -npcs -nprs -npsl".
Matti Hamalainen <ccr@tnsp.org>
parents:
24
diff
changeset
|
191 { |
8eaf72e2041b
Reindent the source using GNU indent and "indent -i4 -bli0 -npcs -nprs -npsl".
Matti Hamalainen <ccr@tnsp.org>
parents:
24
diff
changeset
|
192 return ((edit_t *) p)->obj_type == OBJ_LINEDEFS; |
8eaf72e2041b
Reindent the source using GNU indent and "indent -i4 -bli0 -npcs -nprs -npsl".
Matti Hamalainen <ccr@tnsp.org>
parents:
24
diff
changeset
|
193 } |
8eaf72e2041b
Reindent the source using GNU indent and "indent -i4 -bli0 -npcs -nprs -npsl".
Matti Hamalainen <ccr@tnsp.org>
parents:
24
diff
changeset
|
194 |
8eaf72e2041b
Reindent the source using GNU indent and "indent -i4 -bli0 -npcs -nprs -npsl".
Matti Hamalainen <ccr@tnsp.org>
parents:
24
diff
changeset
|
195 bool mode_v(micbarg_t p) |
8eaf72e2041b
Reindent the source using GNU indent and "indent -i4 -bli0 -npcs -nprs -npsl".
Matti Hamalainen <ccr@tnsp.org>
parents:
24
diff
changeset
|
196 { |
8eaf72e2041b
Reindent the source using GNU indent and "indent -i4 -bli0 -npcs -nprs -npsl".
Matti Hamalainen <ccr@tnsp.org>
parents:
24
diff
changeset
|
197 return ((edit_t *) p)->obj_type == OBJ_VERTICES; |
8eaf72e2041b
Reindent the source using GNU indent and "indent -i4 -bli0 -npcs -nprs -npsl".
Matti Hamalainen <ccr@tnsp.org>
parents:
24
diff
changeset
|
198 } |
8eaf72e2041b
Reindent the source using GNU indent and "indent -i4 -bli0 -npcs -nprs -npsl".
Matti Hamalainen <ccr@tnsp.org>
parents:
24
diff
changeset
|
199 |
8eaf72e2041b
Reindent the source using GNU indent and "indent -i4 -bli0 -npcs -nprs -npsl".
Matti Hamalainen <ccr@tnsp.org>
parents:
24
diff
changeset
|
200 bool mode_s(micbarg_t p) |
8eaf72e2041b
Reindent the source using GNU indent and "indent -i4 -bli0 -npcs -nprs -npsl".
Matti Hamalainen <ccr@tnsp.org>
parents:
24
diff
changeset
|
201 { |
8eaf72e2041b
Reindent the source using GNU indent and "indent -i4 -bli0 -npcs -nprs -npsl".
Matti Hamalainen <ccr@tnsp.org>
parents:
24
diff
changeset
|
202 return ((edit_t *) p)->obj_type == OBJ_SECTORS; |
8eaf72e2041b
Reindent the source using GNU indent and "indent -i4 -bli0 -npcs -nprs -npsl".
Matti Hamalainen <ccr@tnsp.org>
parents:
24
diff
changeset
|
203 } |
0 | 204 |
205 | |
206 /* | |
207 the editor main loop | |
208 */ | |
209 | |
107
20aa5a515896
Reformat one line /* */ comments to //
Matti Hamalainen <ccr@tnsp.org>
parents:
89
diff
changeset
|
210 void EditorLoop(const char *levelname) // SWAP! |
0 | 211 { |
25
8eaf72e2041b
Reindent the source using GNU indent and "indent -i4 -bli0 -npcs -nprs -npsl".
Matti Hamalainen <ccr@tnsp.org>
parents:
24
diff
changeset
|
212 edit_t e; |
107
20aa5a515896
Reformat one line /* */ comments to //
Matti Hamalainen <ccr@tnsp.org>
parents:
89
diff
changeset
|
213 // FIXME : all these variables should be moved to edit_t : |
25
8eaf72e2041b
Reindent the source using GNU indent and "indent -i4 -bli0 -npcs -nprs -npsl".
Matti Hamalainen <ccr@tnsp.org>
parents:
24
diff
changeset
|
214 int RedrawMap; |
8eaf72e2041b
Reindent the source using GNU indent and "indent -i4 -bli0 -npcs -nprs -npsl".
Matti Hamalainen <ccr@tnsp.org>
parents:
24
diff
changeset
|
215 bool DragObject = false, DragMapMove = false; |
89
99242b34e6dc
Fix some cosmetics and warnings.
Matti Hamalainen <ccr@tnsp.org>
parents:
83
diff
changeset
|
216 int DragMapMoveX = 0, DragMapMoveY = 0; |
0 | 217 |
33
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
218 bool StretchSelBox = false; // FIXME apparently not used anymore... |
0 | 219 |
33
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
220 Objid object; // The object under the pointer |
25
8eaf72e2041b
Reindent the source using GNU indent and "indent -i4 -bli0 -npcs -nprs -npsl".
Matti Hamalainen <ccr@tnsp.org>
parents:
24
diff
changeset
|
221 const Objid CANVAS(OBJ_NONE, OBJ_NO_CANVAS); |
0 | 222 |
107
20aa5a515896
Reformat one line /* */ comments to //
Matti Hamalainen <ccr@tnsp.org>
parents:
89
diff
changeset
|
223 memset(&e, 0, sizeof e); // Catch-all |
25
8eaf72e2041b
Reindent the source using GNU indent and "indent -i4 -bli0 -npcs -nprs -npsl".
Matti Hamalainen <ccr@tnsp.org>
parents:
24
diff
changeset
|
224 e.move_speed = 20; |
8eaf72e2041b
Reindent the source using GNU indent and "indent -i4 -bli0 -npcs -nprs -npsl".
Matti Hamalainen <ccr@tnsp.org>
parents:
24
diff
changeset
|
225 e.extra_zoom = 0; |
0 | 226 // If you change this, don't forget to change |
227 // the initialisation of the menu bar below. | |
25
8eaf72e2041b
Reindent the source using GNU indent and "indent -i4 -bli0 -npcs -nprs -npsl".
Matti Hamalainen <ccr@tnsp.org>
parents:
24
diff
changeset
|
228 e.obj_type = OBJ_THINGS; |
8eaf72e2041b
Reindent the source using GNU indent and "indent -i4 -bli0 -npcs -nprs -npsl".
Matti Hamalainen <ccr@tnsp.org>
parents:
24
diff
changeset
|
229 e.global = false; |
8eaf72e2041b
Reindent the source using GNU indent and "indent -i4 -bli0 -npcs -nprs -npsl".
Matti Hamalainen <ccr@tnsp.org>
parents:
24
diff
changeset
|
230 e.tool = TOOL_NORMAL; |
8eaf72e2041b
Reindent the source using GNU indent and "indent -i4 -bli0 -npcs -nprs -npsl".
Matti Hamalainen <ccr@tnsp.org>
parents:
24
diff
changeset
|
231 e.grid_step = 128; |
80
2f1ecc1c5f72
Huge cleanup -- move some global variables into a struct.
Matti Hamalainen <ccr@tnsp.org>
parents:
43
diff
changeset
|
232 e.grid_step_min = cfg.GridMin; |
2f1ecc1c5f72
Huge cleanup -- move some global variables into a struct.
Matti Hamalainen <ccr@tnsp.org>
parents:
43
diff
changeset
|
233 e.grid_step_max = cfg.GridMax; |
25
8eaf72e2041b
Reindent the source using GNU indent and "indent -i4 -bli0 -npcs -nprs -npsl".
Matti Hamalainen <ccr@tnsp.org>
parents:
24
diff
changeset
|
234 e.grid_step_locked = 0; |
8eaf72e2041b
Reindent the source using GNU indent and "indent -i4 -bli0 -npcs -nprs -npsl".
Matti Hamalainen <ccr@tnsp.org>
parents:
24
diff
changeset
|
235 e.grid_shown = 1; |
8eaf72e2041b
Reindent the source using GNU indent and "indent -i4 -bli0 -npcs -nprs -npsl".
Matti Hamalainen <ccr@tnsp.org>
parents:
24
diff
changeset
|
236 e.grid_snap = 1; |
80
2f1ecc1c5f72
Huge cleanup -- move some global variables into a struct.
Matti Hamalainen <ccr@tnsp.org>
parents:
43
diff
changeset
|
237 e.infobar_shown = cfg.InfoShown; |
25
8eaf72e2041b
Reindent the source using GNU indent and "indent -i4 -bli0 -npcs -nprs -npsl".
Matti Hamalainen <ccr@tnsp.org>
parents:
24
diff
changeset
|
238 e.objinfo_shown = true; |
8eaf72e2041b
Reindent the source using GNU indent and "indent -i4 -bli0 -npcs -nprs -npsl".
Matti Hamalainen <ccr@tnsp.org>
parents:
24
diff
changeset
|
239 e.show_object_numbers = false; |
8eaf72e2041b
Reindent the source using GNU indent and "indent -i4 -bli0 -npcs -nprs -npsl".
Matti Hamalainen <ccr@tnsp.org>
parents:
24
diff
changeset
|
240 e.show_things_squares = false; |
8eaf72e2041b
Reindent the source using GNU indent and "indent -i4 -bli0 -npcs -nprs -npsl".
Matti Hamalainen <ccr@tnsp.org>
parents:
24
diff
changeset
|
241 e.show_things_sprites = true; |
8eaf72e2041b
Reindent the source using GNU indent and "indent -i4 -bli0 -npcs -nprs -npsl".
Matti Hamalainen <ccr@tnsp.org>
parents:
24
diff
changeset
|
242 e.rulers_shown = 0; |
8eaf72e2041b
Reindent the source using GNU indent and "indent -i4 -bli0 -npcs -nprs -npsl".
Matti Hamalainen <ccr@tnsp.org>
parents:
24
diff
changeset
|
243 e.clicked.nil(); |
0 | 244 //e.click_obj_no = OBJ_NO_NONE; |
245 //e.click_obj_type = -1; | |
25
8eaf72e2041b
Reindent the source using GNU indent and "indent -i4 -bli0 -npcs -nprs -npsl".
Matti Hamalainen <ccr@tnsp.org>
parents:
24
diff
changeset
|
246 e.click_ctrl = 0; |
8eaf72e2041b
Reindent the source using GNU indent and "indent -i4 -bli0 -npcs -nprs -npsl".
Matti Hamalainen <ccr@tnsp.org>
parents:
24
diff
changeset
|
247 e.highlighted.nil(); |
0 | 248 //e.highlight_obj_no = OBJ_NO_NONE; |
249 //e.highlight_obj_type = -1; | |
25
8eaf72e2041b
Reindent the source using GNU indent and "indent -i4 -bli0 -npcs -nprs -npsl".
Matti Hamalainen <ccr@tnsp.org>
parents:
24
diff
changeset
|
250 e.Selected = 0; |
8eaf72e2041b
Reindent the source using GNU indent and "indent -i4 -bli0 -npcs -nprs -npsl".
Matti Hamalainen <ccr@tnsp.org>
parents:
24
diff
changeset
|
251 e.selbox = new selbox_c; |
8eaf72e2041b
Reindent the source using GNU indent and "indent -i4 -bli0 -npcs -nprs -npsl".
Matti Hamalainen <ccr@tnsp.org>
parents:
24
diff
changeset
|
252 e.edisplay = new edisplay_c(&e); |
8eaf72e2041b
Reindent the source using GNU indent and "indent -i4 -bli0 -npcs -nprs -npsl".
Matti Hamalainen <ccr@tnsp.org>
parents:
24
diff
changeset
|
253 e.menubar = new menubar_c; |
8eaf72e2041b
Reindent the source using GNU indent and "indent -i4 -bli0 -npcs -nprs -npsl".
Matti Hamalainen <ccr@tnsp.org>
parents:
24
diff
changeset
|
254 e.spot = new spot_c; |
8eaf72e2041b
Reindent the source using GNU indent and "indent -i4 -bli0 -npcs -nprs -npsl".
Matti Hamalainen <ccr@tnsp.org>
parents:
24
diff
changeset
|
255 e.modpopup = new modpopup_c; |
8eaf72e2041b
Reindent the source using GNU indent and "indent -i4 -bli0 -npcs -nprs -npsl".
Matti Hamalainen <ccr@tnsp.org>
parents:
24
diff
changeset
|
256 e.modal = '\0'; |
0 | 257 |
25
8eaf72e2041b
Reindent the source using GNU indent and "indent -i4 -bli0 -npcs -nprs -npsl".
Matti Hamalainen <ccr@tnsp.org>
parents:
24
diff
changeset
|
258 MadeChanges = 0; |
8eaf72e2041b
Reindent the source using GNU indent and "indent -i4 -bli0 -npcs -nprs -npsl".
Matti Hamalainen <ccr@tnsp.org>
parents:
24
diff
changeset
|
259 MadeMapChanges = 0; |
0 | 260 |
261 // Sane defaults | |
80
2f1ecc1c5f72
Huge cleanup -- move some global variables into a struct.
Matti Hamalainen <ccr@tnsp.org>
parents:
43
diff
changeset
|
262 cfg.Scale = 1.0; |
2f1ecc1c5f72
Huge cleanup -- move some global variables into a struct.
Matti Hamalainen <ccr@tnsp.org>
parents:
43
diff
changeset
|
263 cfg.OrigX = 0; |
2f1ecc1c5f72
Huge cleanup -- move some global variables into a struct.
Matti Hamalainen <ccr@tnsp.org>
parents:
43
diff
changeset
|
264 cfg.OrigY = 0; |
0 | 265 |
25
8eaf72e2041b
Reindent the source using GNU indent and "indent -i4 -bli0 -npcs -nprs -npsl".
Matti Hamalainen <ccr@tnsp.org>
parents:
24
diff
changeset
|
266 edit_zoom_init(); |
0 | 267 |
80
2f1ecc1c5f72
Huge cleanup -- move some global variables into a struct.
Matti Hamalainen <ccr@tnsp.org>
parents:
43
diff
changeset
|
268 if (cfg.zoom_default == 0) |
25
8eaf72e2041b
Reindent the source using GNU indent and "indent -i4 -bli0 -npcs -nprs -npsl".
Matti Hamalainen <ccr@tnsp.org>
parents:
24
diff
changeset
|
269 { |
33
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
270 zoom_fit(e); |
25
8eaf72e2041b
Reindent the source using GNU indent and "indent -i4 -bli0 -npcs -nprs -npsl".
Matti Hamalainen <ccr@tnsp.org>
parents:
24
diff
changeset
|
271 } |
8eaf72e2041b
Reindent the source using GNU indent and "indent -i4 -bli0 -npcs -nprs -npsl".
Matti Hamalainen <ccr@tnsp.org>
parents:
24
diff
changeset
|
272 else |
8eaf72e2041b
Reindent the source using GNU indent and "indent -i4 -bli0 -npcs -nprs -npsl".
Matti Hamalainen <ccr@tnsp.org>
parents:
24
diff
changeset
|
273 { |
80
2f1ecc1c5f72
Huge cleanup -- move some global variables into a struct.
Matti Hamalainen <ccr@tnsp.org>
parents:
43
diff
changeset
|
274 int r = edit_set_zoom(&e, cfg.zoom_default / 100.0); |
33
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
275 if (r == 0) |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
276 CenterMapAroundCoords((MapMinX + MapMaxX) / 2, |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
277 (MapMinY + MapMaxY) / 2); |
25
8eaf72e2041b
Reindent the source using GNU indent and "indent -i4 -bli0 -npcs -nprs -npsl".
Matti Hamalainen <ccr@tnsp.org>
parents:
24
diff
changeset
|
278 } |
0 | 279 |
107
20aa5a515896
Reformat one line /* */ comments to //
Matti Hamalainen <ccr@tnsp.org>
parents:
89
diff
changeset
|
280 // Create the menu bar |
25
8eaf72e2041b
Reindent the source using GNU indent and "indent -i4 -bli0 -npcs -nprs -npsl".
Matti Hamalainen <ccr@tnsp.org>
parents:
24
diff
changeset
|
281 { |
80
2f1ecc1c5f72
Huge cleanup -- move some global variables into a struct.
Matti Hamalainen <ccr@tnsp.org>
parents:
43
diff
changeset
|
282 e.menubar->compute_menubar_coords(0, 0, cfg.ScrMaxX, cfg.ScrMaxY); |
0 | 283 |
33
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
284 e.mb_menu[MBM_FILE] = new Menu(NULL, |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
285 "~Save", YK_F2, 0, |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
286 "Save ~as...", YK_F3, 0, |
0 | 287 // "~Print", YK_, MIF_SACTIVE, false, 0, |
33
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
288 "~Quit", 'q', 0, NULL); |
0 | 289 |
33
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
290 e.mb_menu[MBM_EDIT] = new Menu(NULL, |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
291 "~Copy object(s)", 'o', 0, |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
292 "~Add object", YK_INS, 0, |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
293 "~Delete object(s)", YK_DEL, 0, |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
294 "~Exchange object numbers", 24, 0, |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
295 "~Preferences...", YK_F5, 0, |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
296 "~Snap to grid", 'y', MIF_VTICK, |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
297 &e.grid_snap, 0, "~Lock grid step", |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
298 'z', MIF_VTICK, &e.grid_step_locked, 0, |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
299 NULL); |
0 | 300 |
301 // If you change the order of modes here, don't forget | |
302 // to modify the <modes> array. | |
33
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
303 e.mb_menu[MBM_VIEW] = new Menu(NULL, |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
304 "~Things", 't', MIF_FTICK, mode_th, |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
305 (micbarg_t) & e, 0, |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
306 "~Linedefs & sidedefs", 'l', MIF_FTICK, |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
307 mode_l, (micbarg_t) & e, 0, |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
308 "~Vertices", 'v', MIF_FTICK, mode_v, |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
309 (micbarg_t) & e, 0, "~Sectors", 's', |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
310 MIF_FTICK, mode_s, (micbarg_t) & e, 0, |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
311 "Global", '\7', MIF_VTICK, &e.global, |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
312 0, "~Next mode", YK_TAB, 0, |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
313 "~Prev mode", YK_BACKTAB, 0, |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
314 MI_SEPARATION, "Zoom ~in", '+', 0, |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
315 "Zoom ~out", '-', 0, "Extra ~zoom", |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
316 ' ', MIF_VTICK, &e.extra_zoom, 0, |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
317 "~Whole level", '`', 0, MI_SEPARATION, |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
318 "Show object numbers", '&', MIF_VTICK, |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
319 &e.show_object_numbers, 0, |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
320 "Show sprites", '%', MIF_VTICK, |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
321 &e.show_things_sprites, 0, |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
322 "Show ~grid", 'h', MIF_VTICK, |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
323 &e.grid_shown, 0, "Info bar", |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
324 YK_ALT + 'i', MIF_VTICK, |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
325 &e.infobar_shown, 0, |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
326 "Object info boxes", 'i', MIF_VTICK, |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
327 &e.objinfo_shown, 0, |
0 | 328 // "3D preview", '3', MIF_SACTIVE, false, 0, |
33
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
329 NULL); |
0 | 330 |
33
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
331 e.mb_menu[MBM_SEARCH] = new Menu(NULL, |
0 | 332 // "~Find/change", YK_F4, MIF_SACTIVE, false, 0, |
333 // "~Repeat last find", -1, MIF_SACTIVE, false, 0, | |
33
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
334 "~Next object", 'n', 0, |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
335 "~Prev object", 'p', 0, |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
336 "~Jump to object...", 'j', 0, |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
337 "~Find by type", 'f', 0, NULL); |
0 | 338 |
33
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
339 e.mb_menu[MBM_MISC_L] = new Menu("Misc. operations", |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
340 "Find first free ~tag number", YK_, |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
341 0, "~Rotate and scale linedefs...", |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
342 YK_, 0, |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
343 "Split linedefs (add new ~vertex)", |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
344 YK_, 0, "~Split linedefs and sector", |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
345 YK_, 0, |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
346 "~Delete linedefs and join sectors", |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
347 YK_, 0, "~Flip linedefs", YK_, 0, |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
348 "S~wap sidedefs", YK_, 0, |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
349 "Align textures (~Y offset)", YK_, 0, |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
350 "Align textures (~X offset)...", YK_, |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
351 0, |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
352 "Remove ~2nd sidedef (make single-sided)", |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
353 YK_, 0, |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
354 "Make rectangular ~nook (32x16)", |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
355 YK_, 0, |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
356 "Make rectangular ~boss (32x16)", |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
357 YK_, 0, |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
358 "Set ~length (move 1st vertex)...", |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
359 YK_, 0, |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
360 "Set length (move 2nd vertex)...", |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
361 YK_, 0, "~Unlink 1st sidedef", YK_, |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
362 0, "Unlink 2nd sidedef", YK_, 0, |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
363 "~Mirror horizontally", YK_, 0, |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
364 "Mirror v~ertically", YK_, 0, |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
365 "~Cut a slice out of a sector", YK_, |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
366 0, NULL); |
0 | 367 |
33
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
368 e.mb_menu[MBM_MISC_S] = new Menu("Misc. operations", |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
369 "Find first free ~tag number", YK_, |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
370 0, "~Rotate and scale sectors...", |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
371 YK_, 0, "Make ~door from sector", |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
372 YK_, 0, "Make ~lift from sector", |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
373 YK_, 0, |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
374 "Distribute sector ~floor heights", |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
375 YK_, 0, |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
376 "Distribute sector ~ceiling heights", |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
377 YK_, 0, "R~aise or lower sectors...", |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
378 YK_, 0, |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
379 "~Brighten or darken sectors...", |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
380 YK_, 0, "~Unlink room", YK_, 0, |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
381 "~Mirror horizontally", YK_, 0, |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
382 "Mirror ~vertically", YK_, 0, |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
383 "~Swap flats", YK_, 0, NULL); |
0 | 384 |
33
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
385 e.mb_menu[MBM_MISC_T] = new Menu("Misc. operations", |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
386 "Find first free ~tag number", YK_, |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
387 0, "~Rotate and scale things...", |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
388 YK_, 0, "~Spin things 45° clockwise", |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
389 'x', 0, |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
390 "Spin things 45° ~counter-clockwise", |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
391 'w', 0, "~Mirror horizontally", YK_, |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
392 0, "Mirror ~vertically", YK_, 0, |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
393 NULL); |
0 | 394 |
33
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
395 e.mb_menu[MBM_MISC_V] = new Menu("Misc. operations", |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
396 "Find first free ~tag number", YK_, |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
397 0, "~Rotate and scale vertices...", |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
398 YK_, 0, |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
399 "~Delete vertex and join linedefs", |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
400 YK_, 0, |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
401 "~Merge several vertices into one", |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
402 YK_, 0, |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
403 "Add a linedef and ~split sector", |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
404 YK_, 0, "Mirror ~horizontally", YK_, |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
405 0, "Mirror ~vertically", YK_, 0, |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
406 NULL); |
0 | 407 |
33
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
408 e.mb_menu[MBM_OBJECTS] = new Menu("Insert a pre-defined object", |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
409 "~Rectangle...", YK_, 0, |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
410 "~Polygon (N sides)...", YK_, 0, |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
411 NULL); |
0 | 412 |
33
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
413 e.mb_menu[MBM_CHECK] = new Menu("Check level consistency", |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
414 "~Number of objects", YK_, 0, |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
415 "Check if all ~sectors are closed", |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
416 YK_, 0, "Check all ~cross-references", |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
417 YK_, 0, "Check for ~missing textures", |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
418 YK_, 0, "Check ~texture names", YK_, |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
419 0, NULL); |
0 | 420 |
33
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
421 e.mb_menu[MBM_HELP] = new Menu(NULL, |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
422 "~Keyboard & mouse...", YK_F1, 0, |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
423 "~About Yadex...", YK_ALT + 'a', 0, |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
424 NULL); |
0 | 425 |
33
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
426 e.mb_ino[MBI_FILE] = |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
427 e.menubar->add_item("File", 0, 0, e.mb_menu[MBM_FILE]); |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
428 e.mb_ino[MBI_EDIT] = |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
429 e.menubar->add_item("Edit", 0, 0, e.mb_menu[MBM_EDIT]); |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
430 e.mb_ino[MBI_VIEW] = |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
431 e.menubar->add_item("View", 0, 0, e.mb_menu[MBM_VIEW]); |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
432 e.mb_ino[MBI_SEARCH] = |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
433 e.menubar->add_item("Search", 0, 0, e.mb_menu[MBM_SEARCH]); |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
434 e.mb_ino[MBI_MISC] = |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
435 e.menubar->add_item("Misc", 0, 0, e.mb_menu[MBM_MISC_T]); |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
436 e.mb_ino[MBI_OBJECTS] = |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
437 e.menubar->add_item("Objects", 0, 0, e.mb_menu[MBM_OBJECTS]); |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
438 e.mb_ino[MBI_CHECK] = |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
439 e.menubar->add_item("Check", 0, 0, e.mb_menu[MBM_CHECK]); |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
440 e.mb_ino[MBI_HELP] = |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
441 e.menubar->add_item("Help", 0, 1, e.mb_menu[MBM_HELP]); |
0 | 442 |
33
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
443 menubar_out_y1 = 2 * BOX_BORDER + 2 * NARROW_VSPACING + FONTH - 1; // FIXME |
25
8eaf72e2041b
Reindent the source using GNU indent and "indent -i4 -bli0 -npcs -nprs -npsl".
Matti Hamalainen <ccr@tnsp.org>
parents:
24
diff
changeset
|
444 } |
0 | 445 |
446 // FIXME this should come from the .ygd | |
447 // instead of being hard-coded. | |
25
8eaf72e2041b
Reindent the source using GNU indent and "indent -i4 -bli0 -npcs -nprs -npsl".
Matti Hamalainen <ccr@tnsp.org>
parents:
24
diff
changeset
|
448 Menu *menu_linedef_flags = new Menu(NULL, |
33
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
449 "~Impassable", YK_, 0, |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
450 "~Monsters cannot cross", YK_, 0, |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
451 "~Double-sided", YK_, 0, |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
452 "~Upper texture unpegged", YK_, 0, |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
453 "~Lower texture unpegged", YK_, 0, |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
454 "~Secret (shown as normal)", YK_, 0, |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
455 "~Blocks sound", YK_, 0, |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
456 "~Never shown on the map", YK_, 0, |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
457 "~Always shown on the map", YK_, 0, |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
458 "~Pass through [Boom]", YK_, 0, // Boom extension |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
459 "b1~0 0400h", YK_, 0, // Undefined |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
460 "b1~1 0800h", YK_, 0, // Undefined |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
461 "~Translucent [Strife]", YK_, 0, // Strife |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
462 "b1~3 2000h", YK_, 0, // Undefined |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
463 "b1~4 4000h", YK_, 0, // Undefined |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
464 "b1~5 8000h", YK_, 0, // Undefined |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
465 NULL); |
0 | 466 |
25
8eaf72e2041b
Reindent the source using GNU indent and "indent -i4 -bli0 -npcs -nprs -npsl".
Matti Hamalainen <ccr@tnsp.org>
parents:
24
diff
changeset
|
467 Menu *menu_thing_flags = new Menu(NULL, |
33
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
468 "~Easy", YK_, 0, |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
469 "Medi~um", YK_, 0, |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
470 "~Hard", YK_, 0, |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
471 "~Deaf", YK_, 0, |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
472 "~Multiplayer", YK_, 0, |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
473 "~Not in DM [Boom]", YK_, 0, // Boom extension |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
474 "Not in ~coop [Boom]", YK_, 0, // Boom extension |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
475 "F~riendly [MBF]", YK_, 0, // MBF extension |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
476 "b~8 0100h", YK_, 0, // Undefined |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
477 "b~9 0200h", YK_, 0, // Undefined |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
478 "b1~0 0400h", YK_, 0, // Undefined |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
479 "b1~1 0800h", YK_, 0, // Undefined |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
480 "b1~2 1000h", YK_, 0, // Undefined |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
481 "b1~3 2000h", YK_, 0, // Undefined |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
482 "b1~4 4000h", YK_, 0, // Undefined |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
483 "b1~5 8000h", YK_, 0, // Undefined |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
484 NULL); |
0 | 485 |
486 /* AYM 1998-06-22 | |
487 This is the big mean loop. I organized it in three main steps : | |
488 | |
489 1. Update the display according to the current state of affairs. | |
490 2. Wait for the next event (key press, mouse click/motion, etc.). | |
491 3. Process this event and change states as appropriate. | |
492 | |
493 This piece of code remembers a lot of state in various variables and | |
494 flags. Hope you can work your way through it. If you don't, don't | |
495 hesitate to ask me. You never know, I might help you to be even more | |
496 confused. ;-) */ | |
497 | |
25
8eaf72e2041b
Reindent the source using GNU indent and "indent -i4 -bli0 -npcs -nprs -npsl".
Matti Hamalainen <ccr@tnsp.org>
parents:
24
diff
changeset
|
498 for (RedrawMap = 1;; RedrawMap = 0) |
8eaf72e2041b
Reindent the source using GNU indent and "indent -i4 -bli0 -npcs -nprs -npsl".
Matti Hamalainen <ccr@tnsp.org>
parents:
24
diff
changeset
|
499 { |
33
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
500 int motion = 0; // Initialized to silence GCC warning |
0 | 501 |
33
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
502 /* |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
503 * Step 1 -- Do all the displaying work |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
504 */ |
0 | 505 |
506 #ifdef Y_BATCH | |
33
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
507 // Hold refresh until all events are processed |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
508 if (!has_event() && !has_input_event()) |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
509 { |
0 | 510 #endif |
33
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
511 if (e.highlighted()) // FIXME |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
512 e.edisplay->highlight_object(e.highlighted); // Should |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
513 else // be in |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
514 e.edisplay->forget_highlight(); // edisplay_c ! |
0 | 515 |
33
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
516 if (is.in_window) |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
517 e.spot->set(edit_mapx_snapped(&e, e.pointer_x), |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
518 edit_mapy_snapped(&e, e.pointer_y)); |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
519 else |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
520 e.spot->unset(); |
0 | 521 |
33
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
522 e.edisplay->refresh(); |
107
20aa5a515896
Reformat one line /* */ comments to //
Matti Hamalainen <ccr@tnsp.org>
parents:
89
diff
changeset
|
523 // The display is now up to date |
0 | 524 #ifdef Y_BATCH |
33
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
525 } |
0 | 526 #endif |
527 | |
528 | |
33
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
529 /* |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
530 * Step 2 -- Get the next event |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
531 */ |
0 | 532 |
33
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
533 if (has_key_press_event()) |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
534 is.key = get_event(); |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
535 else |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
536 get_input_status(); |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
537 e.pointer_in_window = is.in_window; |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
538 if (is.in_window) |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
539 { |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
540 /* AYM 1998-07-04 |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
541 If the map coordinates of the pointer have changed, |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
542 generate a pointer motion event. I don't like to do |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
543 that but it makes things much simpler elsewhere. */ |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
544 if (MAPX(is.x) != e.pointer_x || MAPY(is.y) != e.pointer_y) |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
545 motion = 1; |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
546 else |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
547 motion = 0; |
0 | 548 |
33
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
549 e.pointer_x = MAPX(is.x); |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
550 e.pointer_y = MAPY(is.y); |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
551 obj_type_t t = e.global ? OBJ_ANY : e.obj_type; |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
552 GetCurObject(object, t, e.pointer_x, e.pointer_y); |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
553 } |
0 | 554 |
33
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
555 /* |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
556 * Step 3 -- Process the event |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
557 * This section is (should be) a long list of elif's |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
558 */ |
0 | 559 |
33
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
560 /* |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
561 * Step 3.1A -- If a pull-down menu is "on", |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
562 * try to make it process the event. |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
563 */ |
0 | 564 |
33
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
565 if (e.menubar->pulled_down() >= 0) |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
566 { |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
567 int menu_no = e.menubar->pulled_down(); |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
568 Menu *menu = e.menubar->get_menu(menu_no); |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
569 int r = menu->process_event(&is); |
0 | 570 |
33
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
571 if (r == MEN_CANCEL) |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
572 { |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
573 e.menubar->pull_down(-1); |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
574 e.menubar->highlight(-1); |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
575 goto done; |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
576 } |
0 | 577 |
33
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
578 // The event was understood and processed normally |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
579 // by the menu event handler so we're done. |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
580 else if (r == MEN_OTHER) |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
581 goto done; |
0 | 582 |
33
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
583 // The event was not understood by the menu event |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
584 // handler so let's see what the normal event handler |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
585 // can do with it. |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
586 else if (r == MEN_INVALID) |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
587 ; |
25
8eaf72e2041b
Reindent the source using GNU indent and "indent -i4 -bli0 -npcs -nprs -npsl".
Matti Hamalainen <ccr@tnsp.org>
parents:
24
diff
changeset
|
588 |
33
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
589 else |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
590 { |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
591 e.menubar->pull_down(-1); |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
592 e.menubar->highlight(-1); |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
593 if (menu_no == e.mb_ino[MBI_MISC]) |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
594 { |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
595 if (e.Selected) |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
596 MiscOperations(e.obj_type, &e.Selected, r + 1); |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
597 else |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
598 { |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
599 if (e.highlighted()) |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
600 SelectObject(&e.Selected, e.highlighted.num); |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
601 MiscOperations(e.obj_type, &e.Selected, r + 1); |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
602 if (e.highlighted()) |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
603 UnSelectObject(&e.Selected, e.highlighted.num); |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
604 } |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
605 e.highlighted.nil(); |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
606 DragObject = false; |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
607 StretchSelBox = false; |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
608 RedrawMap = 1; |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
609 } |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
610 else if (menu_no == e.mb_ino[MBI_OBJECTS]) |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
611 { |
107
20aa5a515896
Reformat one line /* */ comments to //
Matti Hamalainen <ccr@tnsp.org>
parents:
89
diff
changeset
|
612 // code duplicated from 'F9' - I hate to do that |
33
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
613 int savednum = NumLineDefs; |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
614 InsertStandardObject(e.pointer_x, e.pointer_y, r + 1); |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
615 if (NumLineDefs > savednum) |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
616 { |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
617 ForgetSelection(&e.Selected); |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
618 e.obj_type = OBJ_LINEDEFS; |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
619 for (int i = savednum; i < NumLineDefs; i++) |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
620 SelectObject(&e.Selected, i); |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
621 e.highlighted.nil(); |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
622 DragObject = false; |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
623 StretchSelBox = false; |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
624 } |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
625 RedrawMap = 1; |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
626 } |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
627 else if (menu_no == e.mb_ino[MBI_CHECK]) |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
628 { |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
629 if (r == 0) |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
630 Statistics(); |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
631 else if (r == 1) |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
632 CheckSectors(); |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
633 else if (r == 2) |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
634 CheckCrossReferences(); |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
635 else if (r == 3) |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
636 CheckTextures(); |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
637 else if (r == 4) |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
638 CheckTextureNames(); |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
639 } |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
640 else |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
641 send_event(menu->last_shortcut_key()); |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
642 goto done; |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
643 } |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
644 } |
0 | 645 |
33
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
646 /* |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
647 * Step 3.1B -- If the "Misc operations" popup is on, |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
648 * try to make it process the event. |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
649 */ |
0 | 650 |
33
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
651 else if (e.modpopup->get() == e.mb_menu[MBM_MISC_L] |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
652 || e.modpopup->get() == e.mb_menu[MBM_MISC_S] |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
653 || e.modpopup->get() == e.mb_menu[MBM_MISC_T] |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
654 || e.modpopup->get() == e.mb_menu[MBM_MISC_V]) |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
655 { |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
656 int r = (e.modpopup->get())->process_event(&is); |
0 | 657 |
33
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
658 // [Esc] or click outside the popup menu. Close it. |
43 | 659 if (r == MEN_CANCEL || (r == MEN_INVALID && is.key == YE_BUTL_PRESS)) |
33
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
660 { |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
661 e.modpopup->unset(); |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
662 goto done2; |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
663 } |
0 | 664 |
33
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
665 // The event was understood and processed normally |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
666 // by the menu event handler so we're done. |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
667 else if (r == MEN_OTHER) |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
668 goto done2; |
25
8eaf72e2041b
Reindent the source using GNU indent and "indent -i4 -bli0 -npcs -nprs -npsl".
Matti Hamalainen <ccr@tnsp.org>
parents:
24
diff
changeset
|
669 |
33
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
670 // The event was not understood by the menu event |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
671 // handler so let's see what the normal event handler |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
672 // can do with it. |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
673 else if (r == MEN_INVALID) |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
674 ; |
0 | 675 |
33
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
676 else |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
677 { |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
678 e.modpopup->unset(); |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
679 if (e.Selected) |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
680 MiscOperations(e.obj_type, &e.Selected, r + 1); |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
681 else |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
682 { |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
683 if (e.highlighted()) |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
684 SelectObject(&e.Selected, e.highlighted.num); |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
685 MiscOperations(e.obj_type, &e.Selected, r + 1); |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
686 if (e.highlighted()) |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
687 UnSelectObject(&e.Selected, e.highlighted.num); |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
688 } |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
689 e.highlighted.nil(); |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
690 DragObject = false; |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
691 StretchSelBox = false; |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
692 goto done2; |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
693 } |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
694 } |
25
8eaf72e2041b
Reindent the source using GNU indent and "indent -i4 -bli0 -npcs -nprs -npsl".
Matti Hamalainen <ccr@tnsp.org>
parents:
24
diff
changeset
|
695 |
33
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
696 /* |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
697 * Step 3.1C -- If the "Insert standard object" popup is on, |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
698 * try to make it process the event. |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
699 */ |
0 | 700 |
33
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
701 else if (e.modpopup->get() == e.mb_menu[MBM_OBJECTS]) |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
702 { |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
703 int r = (e.modpopup->get())->process_event(&is); |
0 | 704 |
33
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
705 // [Esc] or click outside the popup menu. Close it. |
43 | 706 if (r == MEN_CANCEL || (r == MEN_INVALID && is.key == YE_BUTL_PRESS)) |
33
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
707 { |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
708 e.modpopup->unset(); |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
709 goto done2; |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
710 } |
0 | 711 |
33
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
712 // The event was understood and processed normally |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
713 // by the menu event handler so we're done. |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
714 else if (r == MEN_OTHER) |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
715 goto done2; |
0 | 716 |
33
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
717 // The event was not understood by the menu event |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
718 // handler so let's see what the normal event handler |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
719 // can do with it. |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
720 else if (r == MEN_INVALID) |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
721 ; |
0 | 722 |
33
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
723 else |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
724 { |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
725 e.modpopup->unset(); |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
726 int savednum = NumLineDefs; |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
727 InsertStandardObject(e.pointer_x, e.pointer_y, r + 1); |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
728 if (NumLineDefs > savednum) |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
729 { |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
730 ForgetSelection(&e.Selected); |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
731 e.obj_type = OBJ_LINEDEFS; |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
732 for (int i = savednum; i < NumLineDefs; i++) |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
733 SelectObject(&e.Selected, i); |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
734 e.highlighted.nil(); |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
735 DragObject = false; |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
736 StretchSelBox = false; |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
737 } |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
738 goto done2; |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
739 } |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
740 } |
25
8eaf72e2041b
Reindent the source using GNU indent and "indent -i4 -bli0 -npcs -nprs -npsl".
Matti Hamalainen <ccr@tnsp.org>
parents:
24
diff
changeset
|
741 |
33
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
742 /* |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
743 * Step 3.1D -- if the "Set/toggle/clear" linedef flag popup |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
744 * is on, try to make it process the event. |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
745 */ |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
746 else if (e.modpopup->get() == menu_linedef_flags) |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
747 { |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
748 int r = (e.modpopup->get())->process_event(&is); |
25
8eaf72e2041b
Reindent the source using GNU indent and "indent -i4 -bli0 -npcs -nprs -npsl".
Matti Hamalainen <ccr@tnsp.org>
parents:
24
diff
changeset
|
749 |
33
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
750 // [Esc] or click outside the popup menu. Close it. |
43 | 751 if (r == MEN_CANCEL || (r == MEN_INVALID && is.key == YE_BUTL_PRESS)) |
33
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
752 { |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
753 e.modpopup->unset(); |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
754 goto done2; |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
755 } |
0 | 756 |
33
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
757 // The event was understood and processed normally |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
758 // by the menu event handler so we're done. |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
759 else if (r == MEN_OTHER) |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
760 goto done2; |
25
8eaf72e2041b
Reindent the source using GNU indent and "indent -i4 -bli0 -npcs -nprs -npsl".
Matti Hamalainen <ccr@tnsp.org>
parents:
24
diff
changeset
|
761 |
33
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
762 // The event was not understood by the menu event |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
763 // handler so let's see what the normal event handler |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
764 // can do with it. |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
765 else if (r == MEN_INVALID) |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
766 ; |
0 | 767 |
33
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
768 else |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
769 { |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
770 int op = -1; |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
771 e.modpopup->unset(); |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
772 if (e.modal == 's') |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
773 op = YO_SET; |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
774 else if (e.modal == 't') |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
775 op = YO_TOGGLE; |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
776 else if (e.modal == 'c') |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
777 op = YO_CLEAR; |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
778 else |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
779 fatal_error("modal=%02X", e.modal); |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
780 if (!e.Selected) |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
781 { |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
782 SelectObject(&e.Selected, e.highlighted.num); |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
783 frob_linedefs_flags(e.Selected, op, r); |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
784 UnSelectObject(&e.Selected, e.highlighted.num); |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
785 } |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
786 else |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
787 { |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
788 frob_linedefs_flags(e.Selected, op, r); |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
789 } |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
790 goto done2; |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
791 } |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
792 } |
0 | 793 |
33
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
794 /* |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
795 * Step 3.1E -- if the "Set/toggle/clear" thing flag popup |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
796 * is on, try to make it process the event. |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
797 */ |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
798 else if (e.modpopup->get() == menu_thing_flags) |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
799 { |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
800 int r = (e.modpopup->get())->process_event(&is); |
0 | 801 |
33
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
802 // [Esc] or click outside the popup menu. Close it. |
43 | 803 if (r == MEN_CANCEL || (r == MEN_INVALID && is.key == YE_BUTL_PRESS)) |
33
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
804 { |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
805 e.modpopup->unset(); |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
806 goto done2; |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
807 } |
25
8eaf72e2041b
Reindent the source using GNU indent and "indent -i4 -bli0 -npcs -nprs -npsl".
Matti Hamalainen <ccr@tnsp.org>
parents:
24
diff
changeset
|
808 |
33
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
809 // The event was understood and processed normally |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
810 // by the menu event handler so we're done. |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
811 else if (r == MEN_OTHER) |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
812 goto done2; |
25
8eaf72e2041b
Reindent the source using GNU indent and "indent -i4 -bli0 -npcs -nprs -npsl".
Matti Hamalainen <ccr@tnsp.org>
parents:
24
diff
changeset
|
813 |
33
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
814 // The event was not understood by the menu event |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
815 // handler so let's see what the normal event handler |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
816 // can do with it. |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
817 else if (r == MEN_INVALID) |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
818 ; |
0 | 819 |
33
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
820 else |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
821 { |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
822 int op = -1; |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
823 e.modpopup->unset(); |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
824 if (e.modal == 's') |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
825 op = YO_SET; |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
826 else if (e.modal == 't') |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
827 op = YO_TOGGLE; |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
828 else if (e.modal == 'c') |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
829 op = YO_CLEAR; |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
830 else |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
831 fatal_error("modal=%02X", e.modal); |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
832 if (!e.Selected) |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
833 { |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
834 SelectObject(&e.Selected, e.highlighted.num); |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
835 frob_things_flags(e.Selected, op, r); |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
836 UnSelectObject(&e.Selected, e.highlighted.num); |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
837 } |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
838 else |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
839 { |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
840 frob_things_flags(e.Selected, op, r); |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
841 } |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
842 goto done2; |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
843 } |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
844 } |
0 | 845 |
33
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
846 /* |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
847 * Step 3.2 -- "Normal" event handling |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
848 */ |
25
8eaf72e2041b
Reindent the source using GNU indent and "indent -i4 -bli0 -npcs -nprs -npsl".
Matti Hamalainen <ccr@tnsp.org>
parents:
24
diff
changeset
|
849 |
33
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
850 /* |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
851 * Step 3.2.1 -- Non keyboard events |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
852 */ |
25
8eaf72e2041b
Reindent the source using GNU indent and "indent -i4 -bli0 -npcs -nprs -npsl".
Matti Hamalainen <ccr@tnsp.org>
parents:
24
diff
changeset
|
853 |
33
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
854 if (is.key == YE_EXPOSE) |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
855 { |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
856 RedrawMap = 1; |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
857 goto done2; |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
858 } |
0 | 859 |
33
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
860 else if (is.key == YE_RESIZE) |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
861 { |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
862 SetWindowSize(is.width, is.height); |
80
2f1ecc1c5f72
Huge cleanup -- move some global variables into a struct.
Matti Hamalainen <ccr@tnsp.org>
parents:
43
diff
changeset
|
863 e.menubar->compute_menubar_coords(0, 0, cfg.ScrMaxX, cfg.ScrMaxY); |
33
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
864 RedrawMap = 1; |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
865 goto done2; |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
866 } |
0 | 867 |
33
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
868 // To prevent normal handling when a popup menu is on. |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
869 if (e.modpopup->get() != 0) |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
870 { |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
871 goto done2; |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
872 } |
0 | 873 |
33
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
874 /* |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
875 * Step 3.2.2 -- Mouse events |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
876 */ |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
877 if (DragMapMove && is.key == YE_MOTION) |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
878 { |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
879 int deltaX = DragMapMoveX - is.x, deltaY = DragMapMoveY - is.y; |
0 | 880 |
33
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
881 if (deltaX != 0 || deltaY != 0) |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
882 { |
80
2f1ecc1c5f72
Huge cleanup -- move some global variables into a struct.
Matti Hamalainen <ccr@tnsp.org>
parents:
43
diff
changeset
|
883 cfg.OrigX += (deltaX / cfg.Scale); |
2f1ecc1c5f72
Huge cleanup -- move some global variables into a struct.
Matti Hamalainen <ccr@tnsp.org>
parents:
43
diff
changeset
|
884 cfg.OrigY -= (deltaY / cfg.Scale); |
33
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
885 RedrawMap = 1; |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
886 DragMapMoveX = is.x; |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
887 DragMapMoveY = is.y; |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
888 goto done2; |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
889 } |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
890 } |
0 | 891 |
33
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
892 else if (is.key == YE_BUTM_PRESS) |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
893 { |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
894 DragMapMove = true; |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
895 DragMapMoveX = is.x; |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
896 DragMapMoveY = is.y; |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
897 goto done; |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
898 } |
0 | 899 |
33
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
900 else if (is.key == YE_BUTM_RELEASE) |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
901 { |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
902 DragMapMove = false; |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
903 goto done; |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
904 } |
25
8eaf72e2041b
Reindent the source using GNU indent and "indent -i4 -bli0 -npcs -nprs -npsl".
Matti Hamalainen <ccr@tnsp.org>
parents:
24
diff
changeset
|
905 |
33
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
906 // Clicking on an item of the menu bar |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
907 // pulls down the corresponding menu. |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
908 else if (is.key == YE_BUTL_PRESS |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
909 && e.menubar->is_on_menubar_item(is.x, is.y) >= 0) |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
910 { |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
911 int itemno; |
13
40c5d2879627
Add functionality for moving around the map via "dragging" while pressing 3rd / middle mouse button.
Matti Hamalainen <ccr@tnsp.org>
parents:
4
diff
changeset
|
912 |
33
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
913 e.clicked.nil(); |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
914 itemno = e.menubar->is_on_menubar_item(is.x, is.y); |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
915 if (itemno >= 0) |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
916 e.menubar->pull_down(itemno); |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
917 else |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
918 Beep(); |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
919 goto done; |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
920 } |
0 | 921 |
33
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
922 /* Clicking on an empty space starts a new selection box. |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
923 Unless [Ctrl] is pressed, it also clears the current selection. */ |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
924 else if (is.key == YE_BUTL_PRESS |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
925 && e.tool == TOOL_NORMAL && object.is_nil()) |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
926 { |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
927 e.menubar->highlight(-1); // Close any open menu |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
928 e.clicked = CANVAS; |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
929 e.click_ctrl = is.ctrl; |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
930 if (!is.ctrl) |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
931 { |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
932 ForgetSelection(&e.Selected); |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
933 RedrawMap = 1; |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
934 } |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
935 e.selbox->set_1st_corner(e.pointer_x, e.pointer_y); |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
936 e.selbox->set_2nd_corner(e.pointer_x, e.pointer_y); |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
937 } |
0 | 938 |
33
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
939 /* Clicking on an unselected object unselects |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
940 everything but that object. Additionally, |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
941 we write the number of the object in case |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
942 the user is about to drag it. */ |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
943 else if (is.key == YE_BUTL_PRESS && !is.ctrl |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
944 && e.tool == TOOL_NORMAL |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
945 && !IsSelected(e.Selected, object.num)) |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
946 { |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
947 e.menubar->highlight(-1); // Close any open menu |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
948 e.clicked = object; |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
949 e.click_ctrl = 0; |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
950 e.click_time = is.time; |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
951 ForgetSelection(&e.Selected); |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
952 SelectObject(&e.Selected, object.num); |
107
20aa5a515896
Reformat one line /* */ comments to //
Matti Hamalainen <ccr@tnsp.org>
parents:
89
diff
changeset
|
953 // I don't like having to do that |
33
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
954 if (object.type == OBJ_THINGS && object()) |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
955 MoveObjectsToCoords(object.type, 0, |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
956 Things[object.num].xpos, |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
957 Things[object.num].ypos, 0); |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
958 else if (object.type == OBJ_VERTICES && object()) |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
959 MoveObjectsToCoords(object.type, 0, |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
960 Vertices[object.num].x, |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
961 Vertices[object.num].y, 0); |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
962 else |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
963 MoveObjectsToCoords(object.type, 0, |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
964 e.pointer_x, e.pointer_y, |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
965 e.grid_snap ? e.grid_step : 0); |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
966 RedrawMap = 1; |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
967 } |
0 | 968 |
107
20aa5a515896
Reformat one line /* */ comments to //
Matti Hamalainen <ccr@tnsp.org>
parents:
89
diff
changeset
|
969 // Second click of a double click on an object |
33
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
970 else if (is.key == YE_BUTL_PRESS && !is.ctrl |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
971 && e.tool == TOOL_NORMAL |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
972 && IsSelected(e.Selected, object.num) |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
973 && object == e.clicked |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
974 && is.time - e.click_time <= |
80
2f1ecc1c5f72
Huge cleanup -- move some global variables into a struct.
Matti Hamalainen <ccr@tnsp.org>
parents:
43
diff
changeset
|
975 (unsigned long) cfg.double_click_timeout) |
33
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
976 { |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
977 // Very important! If you don't do that, the release of the |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
978 // click that closed the properties menu will drag the object. |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
979 e.clicked.nil(); |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
980 send_event(YK_RETURN); |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
981 goto done; |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
982 } |
0 | 983 |
33
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
984 /* Clicking on a selected object does nothing ; |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
985 the user might want to drag the selection. */ |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
986 else if (is.key == YE_BUTL_PRESS && !is.ctrl |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
987 && e.tool == TOOL_NORMAL |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
988 && IsSelected(e.Selected, object.num)) |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
989 { |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
990 e.menubar->highlight(-1); // Close any open menu |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
991 e.clicked = object; |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
992 e.click_ctrl = 0; |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
993 e.click_time = is.time; |
107
20aa5a515896
Reformat one line /* */ comments to //
Matti Hamalainen <ccr@tnsp.org>
parents:
89
diff
changeset
|
994 // I don't like having to do that |
33
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
995 if (object.type == OBJ_THINGS && object()) |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
996 MoveObjectsToCoords(object.type, 0, |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
997 Things[object.num].xpos, |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
998 Things[object.num].ypos, 0); |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
999 else if (object.type == OBJ_VERTICES && object()) |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1000 MoveObjectsToCoords(object.type, 0, |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1001 Vertices[object.num].x, |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1002 Vertices[object.num].y, 0); |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1003 else |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1004 MoveObjectsToCoords(object.type, 0, |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1005 e.pointer_x, e.pointer_y, |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1006 e.grid_snap ? e.grid_step : 0); |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1007 } |
0 | 1008 |
33
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1009 /* Clicking on selected object with [Ctrl] pressed unselects it. |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1010 Clicking on unselected object with [Ctrl] pressed selects it. */ |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1011 else if (((is.key == YE_BUTL_PRESS && is.ctrl) |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1012 || is.key == YE_BUTR_PRESS) && e.tool == TOOL_NORMAL |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1013 && object()) |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1014 { |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1015 e.menubar->highlight(-1); // Close any open menu |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1016 e.clicked = object; |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1017 e.click_ctrl = 1; |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1018 if (IsSelected(e.Selected, object.num)) |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1019 UnSelectObject(&e.Selected, object.num); |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1020 else |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1021 SelectObject(&e.Selected, object.num); |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1022 RedrawMap = 1; |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1023 } |
0 | 1024 |
107
20aa5a515896
Reformat one line /* */ comments to //
Matti Hamalainen <ccr@tnsp.org>
parents:
89
diff
changeset
|
1025 // TOOL_SNAP_VERTEX |
33
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1026 else if (is.key == YE_BUTL_PRESS |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1027 && e.tool == TOOL_SNAP_VERTEX |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1028 && e.obj_type == OBJ_VERTICES && object() |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1029 // Can't delete vertex that is referenced by the selection |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1030 && !IsSelected(e.Selected, object.num)) |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1031 { |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1032 printf("SNAP %d\n", (int) object.num); |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1033 SelPtr list = 0; |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1034 SelectObject(&list, object.num); |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1035 DeleteVerticesJoinLineDefs(list); |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1036 ForgetSelection(&list); |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1037 RedrawMap = 1; |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1038 } |
0 | 1039 |
107
20aa5a515896
Reformat one line /* */ comments to //
Matti Hamalainen <ccr@tnsp.org>
parents:
89
diff
changeset
|
1040 // Clicking anywhere else closes the pull-down menus. |
33
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1041 else if (is.key == YE_BUTL_PRESS) |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1042 e.menubar->highlight(-1); // Close any open menu |
0 | 1043 |
33
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1044 /* Releasing the button while there was a selection box |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1045 causes all the objects within the box to be selected. */ |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1046 // FIXME : should call this automatically when switching tool |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1047 else if (is.key == YE_BUTL_RELEASE |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1048 && e.tool == TOOL_NORMAL && e.clicked == CANVAS) |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1049 { |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1050 int x1, y1, x2, y2; |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1051 e.selbox->get_corners(&x1, &y1, &x2, &y2); |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1052 SelectObjectsInBox(&e.Selected, e.obj_type, x1, y1, x2, y2); |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1053 e.selbox->unset_corners(); |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1054 RedrawMap = 1; |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1055 } |
0 | 1056 |
107
20aa5a515896
Reformat one line /* */ comments to //
Matti Hamalainen <ccr@tnsp.org>
parents:
89
diff
changeset
|
1057 // Releasing the button while dragging : drop the selection. |
33
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1058 // FIXME : should call this automatically when switching tool |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1059 else if (is.key == YE_BUTL_RELEASE |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1060 && e.tool == TOOL_NORMAL && e.clicked()) |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1061 { |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1062 if (AutoMergeVertices(&e.Selected, e.obj_type, 'm')) |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1063 RedrawMap = 1; |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1064 } |
0 | 1065 |
33
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1066 // Moving the pointer with the left button pressed |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1067 // after clicking on an item of the menu bar : pull |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1068 // down menus as the pointer passes over them. |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1069 else if (is.key == YE_MOTION |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1070 && e.tool == TOOL_NORMAL |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1071 && is.butl && !e.clicked() && !(e.clicked == CANVAS)) |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1072 { |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1073 int itemno = e.menubar->is_on_menubar_item(is.x, is.y); |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1074 if (itemno >= 0) |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1075 e.menubar->pull_down(itemno); |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1076 goto done; |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1077 } |
0 | 1078 |
33
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1079 /* Moving the pointer with the left button pressed |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1080 and a selection box exists : move the second |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1081 corner of the selection box. */ |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1082 else if ((is.key == YE_MOTION || motion) |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1083 && e.tool == TOOL_NORMAL && is.butl && e.clicked == CANVAS) |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1084 { |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1085 e.selbox->set_2nd_corner(e.pointer_x, e.pointer_y); |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1086 } |
0 | 1087 |
33
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1088 /* Moving the pointer with the left button pressed |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1089 but no selection box exists and [Ctrl] was not |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1090 pressed when the button was pressed : |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1091 drag the selection. */ |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1092 else if (motion |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1093 && e.tool == TOOL_NORMAL |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1094 && is.butl && e.clicked() && !e.click_ctrl) |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1095 { |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1096 if (!e.Selected) |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1097 { |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1098 SelectObject(&e.Selected, e.clicked.num); |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1099 if (MoveObjectsToCoords(e.clicked.type, e.Selected, |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1100 e.pointer_x, e.pointer_y, |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1101 e.grid_snap ? e.grid_step : 0)) |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1102 RedrawMap = 1; |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1103 ForgetSelection(&e.Selected); |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1104 } |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1105 else if (MoveObjectsToCoords(e.clicked.type, e.Selected, |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1106 e.pointer_x, e.pointer_y, |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1107 e.grid_snap ? e.grid_step : 0)) |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1108 RedrawMap = 1; |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1109 } |
0 | 1110 |
107
20aa5a515896
Reformat one line /* */ comments to //
Matti Hamalainen <ccr@tnsp.org>
parents:
89
diff
changeset
|
1111 // AYM : added is.in_window |
33
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1112 if (is.in_window && !is.butl && !is.shift) |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1113 { |
107
20aa5a515896
Reformat one line /* */ comments to //
Matti Hamalainen <ccr@tnsp.org>
parents:
89
diff
changeset
|
1114 // Check if there is something near the pointer |
33
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1115 e.highlighted = object; |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1116 } |
0 | 1117 |
33
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1118 /* |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1119 * Step 3.2.3 -- Keyboard events |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1120 */ |
0 | 1121 |
33
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1122 if (event_is_key(is.key) |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1123 || is.key == YE_WHEEL_UP || is.key == YE_WHEEL_DOWN) |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1124 { |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1125 if (is.key == YK_LEFT && e.menubar->highlighted() >= 0) |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1126 { |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1127 int new_item = e.menubar->highlighted() - 1; |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1128 if (new_item < 0) |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1129 new_item = e.mb_ino[MBI_HELP]; |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1130 e.menubar->pull_down(new_item); |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1131 RedrawMap = 1; |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1132 } |
0 | 1133 |
33
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1134 else if (is.key == YK_RIGHT && e.menubar->highlighted() >= 0) |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1135 { |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1136 int new_item = e.menubar->highlighted() + 1; |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1137 if (new_item > e.mb_ino[MBI_HELP]) |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1138 new_item = 0; |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1139 e.menubar->pull_down(new_item); |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1140 RedrawMap = 1; |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1141 } |
0 | 1142 |
33
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1143 else if (is.key == YK_ALT + 'f') |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1144 e.menubar->pull_down(e.mb_ino[MBI_FILE]); |
0 | 1145 |
33
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1146 else if (is.key == YK_ALT + 'e') |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1147 e.menubar->pull_down(e.mb_ino[MBI_EDIT]); |
0 | 1148 |
33
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1149 else if (is.key == YK_ALT + 's') |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1150 e.menubar->pull_down(e.mb_ino[MBI_SEARCH]); |
0 | 1151 |
33
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1152 else if (is.key == YK_ALT + 'v') |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1153 e.menubar->pull_down(e.mb_ino[MBI_VIEW]); |
0 | 1154 |
33
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1155 else if (is.key == YK_ALT + 'm') |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1156 e.menubar->pull_down(e.mb_ino[MBI_MISC]); |
0 | 1157 |
33
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1158 else if (is.key == YK_ALT + 'o') |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1159 e.menubar->pull_down(e.mb_ino[MBI_OBJECTS]); |
0 | 1160 |
33
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1161 else if (is.key == YK_ALT + 'c') |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1162 e.menubar->pull_down(e.mb_ino[MBI_CHECK]); |
0 | 1163 |
33
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1164 else if (is.key == YK_ALT + 'h') |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1165 e.menubar->pull_down(e.mb_ino[MBI_HELP]); |
0 | 1166 |
1167 | |
33
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1168 // [Ctrl][L]: force redraw |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1169 else if (is.key == '\f') |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1170 { |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1171 RedrawMap = 1; |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1172 } |
0 | 1173 |
33
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1174 // [Esc], [q]: close |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1175 else if (is.key == YK_ESC || is.key == 'q') |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1176 { |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1177 if (DragObject) |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1178 DragObject = false; |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1179 else if (StretchSelBox) |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1180 StretchSelBox = false; |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1181 else |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1182 { |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1183 ForgetSelection(&e.Selected); |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1184 if (!MadeChanges |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1185 || Confirm(-1, -1, "You have unsaved changes." |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1186 " Do you really want to quit?", 0)) |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1187 break; |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1188 RedrawMap = 1; |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1189 } |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1190 } |
0 | 1191 |
33
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1192 // [F1]: pop up "Help" window |
107
20aa5a515896
Reformat one line /* */ comments to //
Matti Hamalainen <ccr@tnsp.org>
parents:
89
diff
changeset
|
1193 else if (is.key == YK_F1) // 'F1' |
33
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1194 { |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1195 DisplayHelp(); |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1196 RedrawMap = 1; |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1197 } |
25
8eaf72e2041b
Reindent the source using GNU indent and "indent -i4 -bli0 -npcs -nprs -npsl".
Matti Hamalainen <ccr@tnsp.org>
parents:
24
diff
changeset
|
1198 |
33
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1199 // [Alt][a]: pop up the "About..." window |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1200 else if (is.key == YK_ALT + 'a') |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1201 { |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1202 about_yadex(); |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1203 RedrawMap = 1; |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1204 } |
0 | 1205 |
33
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1206 // [Shift][F1]: save a screen shot into yadex.gif. |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1207 // FIXME doesn't work in the Unix port |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1208 else if (is.key == YK_F1 + YK_SHIFT) |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1209 { |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1210 Rgbbmp b; |
80
2f1ecc1c5f72
Huge cleanup -- move some global variables into a struct.
Matti Hamalainen <ccr@tnsp.org>
parents:
43
diff
changeset
|
1211 window_to_rgbbmp(0, 0, (int) cfg.ScrMaxX + 1, (int) cfg.ScrMaxY + 1, |
33
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1212 b); |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1213 rgbbmp_to_rawppm(b, "yadex.ppm"); |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1214 //ScreenShot (); |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1215 } |
0 | 1216 |
33
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1217 // [Shift][F2]: undocumented--test of Entry2 |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1218 else if (is.key == YK_F2 + YK_SHIFT) |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1219 { |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1220 char buf1[10]; |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1221 char buf2[30]; |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1222 char buf3[20]; |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1223 strcpy(buf1, "buf1"); |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1224 strcpy(buf2, "buf2"); |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1225 strcpy(buf3, "buf3"); |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1226 Entry2 e("Title of window", "Buf 1%*sBuf 2%*sBuf 3%*s", |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1227 sizeof buf1 - 1, buf1, |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1228 sizeof buf2 - 1, buf2, sizeof buf3 - 1, buf3); |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1229 e.loop(); |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1230 printf("bufs: \"%s\", \"%s\", \"%s\"\n", buf1, buf2, buf3); |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1231 RedrawMap = 1; |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1232 } |
0 | 1233 |
33
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1234 /* [F2] save level into pwad, prompt for the file name |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1235 every time but keep the same level name. */ |
83
002bc70a3982
More cleanups. Mostly variable renames.
Matti Hamalainen <ccr@tnsp.org>
parents:
80
diff
changeset
|
1236 else if (is.key == YK_F2 && cfg.registered) |
33
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1237 { |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1238 if (!CheckStartingPos()) |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1239 goto cancel_save; |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1240 char *outfile; |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1241 const char *newlevelname; |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1242 if (levelname) |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1243 newlevelname = levelname; |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1244 else |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1245 { |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1246 newlevelname = SelectLevel(0); |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1247 if (!*newlevelname) |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1248 goto cancel_save; |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1249 } |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1250 outfile = GetWadFileName(newlevelname); |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1251 if (!outfile) |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1252 goto cancel_save; |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1253 SaveLevelData(outfile, newlevelname); |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1254 levelname = newlevelname; |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1255 // Sigh. Shouldn't have to do that. Level must die ! |
80
2f1ecc1c5f72
Huge cleanup -- move some global variables into a struct.
Matti Hamalainen <ccr@tnsp.org>
parents:
43
diff
changeset
|
1256 Level = FindMasterDir(cfg.MasterDir, levelname); |
33
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1257 cancel_save: |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1258 RedrawMap = 1; |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1259 } |
0 | 1260 |
33
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1261 /* [F3] save level into pwad, prompt for the file name and |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1262 level name. */ |
83
002bc70a3982
More cleanups. Mostly variable renames.
Matti Hamalainen <ccr@tnsp.org>
parents:
80
diff
changeset
|
1263 else if (is.key == YK_F3 && cfg.registered) |
33
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1264 { |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1265 char *outfile; |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1266 const char *newlevelname; |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1267 MDirPtr newLevel, oldl, newl; |
0 | 1268 |
33
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1269 if (!CheckStartingPos()) |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1270 goto cancel_save_as; |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1271 newlevelname = SelectLevel(0); |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1272 if (!*newlevelname) |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1273 goto cancel_save_as; |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1274 if (!levelname || y_stricmp(newlevelname, levelname)) |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1275 { |
107
20aa5a515896
Reformat one line /* */ comments to //
Matti Hamalainen <ccr@tnsp.org>
parents:
89
diff
changeset
|
1276 // horrible but it works... |
33
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1277 // Horrible indeed -- AYM 1999-07-30 |
80
2f1ecc1c5f72
Huge cleanup -- move some global variables into a struct.
Matti Hamalainen <ccr@tnsp.org>
parents:
43
diff
changeset
|
1278 newLevel = FindMasterDir(cfg.MasterDir, newlevelname); |
33
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1279 if (!newLevel) |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1280 nf_bug("newLevel is NULL"); // Debatable ! -- AYM 2001-05-29 |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1281 if (Level) // If new level ("create" command), Level is NULL |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1282 { |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1283 oldl = Level; |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1284 newl = newLevel; |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1285 for (int m = 0; m < 11; m++) |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1286 { |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1287 newl->wadfile = oldl->wadfile; |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1288 if (m > 0) |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1289 newl->dir = oldl->dir; |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1290 /* |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1291 if (!fncmp (outfile, oldl->wadfile->filename)) |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1292 { |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1293 oldl->wadfile = WadFileList; |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1294 oldl->dir = lost... |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1295 } |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1296 */ |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1297 oldl = oldl->next; |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1298 newl = newl->next; |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1299 } |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1300 } |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1301 Level = newLevel; |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1302 } |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1303 outfile = GetWadFileName(newlevelname); |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1304 if (!outfile) |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1305 goto cancel_save_as; |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1306 SaveLevelData(outfile, newlevelname); |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1307 levelname = newlevelname; |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1308 cancel_save_as: |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1309 RedrawMap = 1; |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1310 } |
0 | 1311 |
33
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1312 // [F5]: pop up the "Preferences" menu |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1313 else if (is.key == YK_F5 && e.menubar->highlighted() < 0) |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1314 { |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1315 Preferences(-1, -1); |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1316 RedrawMap = 1; |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1317 } |
25
8eaf72e2041b
Reindent the source using GNU indent and "indent -i4 -bli0 -npcs -nprs -npsl".
Matti Hamalainen <ccr@tnsp.org>
parents:
24
diff
changeset
|
1318 |
33
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1319 // [a]: pop up the "Set flag" menu |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1320 else if (is.key == 'a' |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1321 && e.menubar->highlighted() < 0 |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1322 && (e.Selected || e.highlighted())) |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1323 { |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1324 e.modal = 's'; // Set |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1325 if (e.obj_type == OBJ_LINEDEFS) |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1326 { |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1327 menu_linedef_flags->set_title("Set linedef flag"); |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1328 e.modpopup->set(menu_linedef_flags, 0); |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1329 } |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1330 else if (e.obj_type == OBJ_THINGS) |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1331 { |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1332 menu_thing_flags->set_title("Set thing flag"); |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1333 e.modpopup->set(menu_thing_flags, 0); |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1334 } |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1335 } |
0 | 1336 |
33
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1337 // [b]: pop up the "Toggle flag" menu |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1338 else if (is.key == 'b' |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1339 && e.menubar->highlighted() < 0 |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1340 && (e.Selected || e.highlighted())) |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1341 { |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1342 e.modal = 't'; // Toggle |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1343 if (e.obj_type == OBJ_LINEDEFS) |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1344 { |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1345 menu_linedef_flags->set_title("Toggle linedef flag"); |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1346 e.modpopup->set(menu_linedef_flags, 0); |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1347 } |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1348 else if (e.obj_type == OBJ_THINGS) |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1349 { |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1350 menu_thing_flags->set_title("Toggle thing flag"); |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1351 e.modpopup->set(menu_thing_flags, 0); |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1352 } |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1353 } |
0 | 1354 |
33
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1355 // [c]: pop up the "Clear flag" menu |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1356 else if (is.key == 'c' |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1357 && e.menubar->highlighted() < 0 |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1358 && (e.Selected || e.highlighted())) |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1359 { |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1360 e.modal = 'c'; // Clear; |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1361 if (e.obj_type == OBJ_LINEDEFS) |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1362 { |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1363 menu_linedef_flags->set_title("Clear linedef flag"); |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1364 e.modpopup->set(menu_linedef_flags, 0); |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1365 } |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1366 else if (e.obj_type == OBJ_THINGS) |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1367 { |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1368 menu_thing_flags->set_title("Clear thing flag"); |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1369 e.modpopup->set(menu_thing_flags, 0); |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1370 } |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1371 } |
0 | 1372 |
33
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1373 // [F8]: pop up the "Misc. operations" menu |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1374 else if (is.key == YK_F8 && e.menubar->highlighted() < 0) |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1375 { |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1376 e.modpopup->set(e.menubar->get_menu(MBI_MISC), 1); |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1377 } |
0 | 1378 |
33
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1379 // [F9]: pop up the "Insert a standard object" menu |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1380 else if (is.key == YK_F9 && e.menubar->highlighted() < 0) |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1381 { |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1382 e.modpopup->set(e.menubar->get_menu(MBI_OBJECTS), 1); |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1383 } |
25
8eaf72e2041b
Reindent the source using GNU indent and "indent -i4 -bli0 -npcs -nprs -npsl".
Matti Hamalainen <ccr@tnsp.org>
parents:
24
diff
changeset
|
1384 |
33
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1385 // [F10]: pop up the "Checks" menu |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1386 else if (is.key == YK_F10 && e.menubar->highlighted() < 0) |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1387 { |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1388 CheckLevel(-1, -1); |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1389 RedrawMap = 1; |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1390 } |
0 | 1391 |
33
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1392 // [Alt][i]: show/hide the info bar |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1393 else if (is.key == YK_ALT + 'i') |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1394 { |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1395 e.infobar_shown = !e.infobar_shown; |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1396 RedrawMap = 1; |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1397 } |
0 | 1398 |
33
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1399 // [i]: show/hide the object info boxes |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1400 else if (is.key == 'i') |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1401 { |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1402 e.objinfo_shown = !e.objinfo_shown; |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1403 RedrawMap = 1; |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1404 } |
25
8eaf72e2041b
Reindent the source using GNU indent and "indent -i4 -bli0 -npcs -nprs -npsl".
Matti Hamalainen <ccr@tnsp.org>
parents:
24
diff
changeset
|
1405 |
33
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1406 // [+], [=], wheel: zooming in |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1407 else if (is.key == '+' || is.key == '=' || is.key == YE_WHEEL_UP) |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1408 { |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1409 int r = edit_zoom_in(&e); |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1410 if (r == 0) |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1411 RedrawMap = 1; |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1412 } |
0 | 1413 |
33
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1414 // [-], [_], wheel: zooming out |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1415 else if (is.key == '-' || is.key == '_' |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1416 || is.key == YE_WHEEL_DOWN) |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1417 { |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1418 int r = edit_zoom_out(&e); |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1419 if (r == 0) |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1420 RedrawMap = 1; |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1421 } |
25
8eaf72e2041b
Reindent the source using GNU indent and "indent -i4 -bli0 -npcs -nprs -npsl".
Matti Hamalainen <ccr@tnsp.org>
parents:
24
diff
changeset
|
1422 |
33
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1423 // [1] - [9], [0]: set the zoom factor |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1424 else if (is.key >= '0' && is.key <= '9') |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1425 { |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1426 int r = edit_set_zoom(&e, digit_zoom_factors[dectoi(is.key)]); |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1427 if (r == 0) |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1428 RedrawMap = 1; |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1429 } |
0 | 1430 |
33
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1431 // [']: centre window on centre of map |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1432 else if (is.key == '\'') |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1433 { |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1434 update_level_bounds(); |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1435 CenterMapAroundCoords((MapMinX + MapMaxX) / 2, |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1436 (MapMinY + MapMaxY) / 2); |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1437 RedrawMap = 1; |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1438 } |
0 | 1439 |
33
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1440 // [`]: centre window on centre of map |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1441 // and set zoom to view the entire map |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1442 else if (is.key == '`') |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1443 { |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1444 int r = zoom_fit(e); |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1445 if (r == 0) |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1446 RedrawMap = 1; |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1447 } |
0 | 1448 |
1449 | |
33
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1450 // [Left], [Right], [Up], [Down]: |
80
2f1ecc1c5f72
Huge cleanup -- move some global variables into a struct.
Matti Hamalainen <ccr@tnsp.org>
parents:
43
diff
changeset
|
1451 // scroll <cfg.scroll_less> percents of a screenful. |
2f1ecc1c5f72
Huge cleanup -- move some global variables into a struct.
Matti Hamalainen <ccr@tnsp.org>
parents:
43
diff
changeset
|
1452 else if (is.key == YK_LEFT && MAPX(cfg.ScrCenterX) > -20000) |
33
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1453 { |
80
2f1ecc1c5f72
Huge cleanup -- move some global variables into a struct.
Matti Hamalainen <ccr@tnsp.org>
parents:
43
diff
changeset
|
1454 cfg.OrigX -= (int) ((double) cfg.ScrMaxX * cfg.scroll_less / 100 / cfg.Scale); |
33
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1455 RedrawMap = 1; |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1456 } |
80
2f1ecc1c5f72
Huge cleanup -- move some global variables into a struct.
Matti Hamalainen <ccr@tnsp.org>
parents:
43
diff
changeset
|
1457 else if (is.key == YK_RIGHT && MAPX(cfg.ScrCenterX) < 20000) |
33
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1458 { |
80
2f1ecc1c5f72
Huge cleanup -- move some global variables into a struct.
Matti Hamalainen <ccr@tnsp.org>
parents:
43
diff
changeset
|
1459 cfg.OrigX += (int) ((double) cfg.ScrMaxX * cfg.scroll_less / 100 / cfg.Scale); |
33
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1460 RedrawMap = 1; |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1461 } |
80
2f1ecc1c5f72
Huge cleanup -- move some global variables into a struct.
Matti Hamalainen <ccr@tnsp.org>
parents:
43
diff
changeset
|
1462 else if (is.key == YK_UP && MAPY(cfg.ScrCenterY) < 20000) |
33
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1463 { |
80
2f1ecc1c5f72
Huge cleanup -- move some global variables into a struct.
Matti Hamalainen <ccr@tnsp.org>
parents:
43
diff
changeset
|
1464 cfg.OrigY += (int) ((double) cfg.ScrMaxY * cfg.scroll_less / 100 / cfg.Scale); |
33
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1465 RedrawMap = 1; |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1466 } |
80
2f1ecc1c5f72
Huge cleanup -- move some global variables into a struct.
Matti Hamalainen <ccr@tnsp.org>
parents:
43
diff
changeset
|
1467 else if (is.key == YK_DOWN && MAPY(cfg.ScrCenterY) > -20000) |
33
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1468 { |
80
2f1ecc1c5f72
Huge cleanup -- move some global variables into a struct.
Matti Hamalainen <ccr@tnsp.org>
parents:
43
diff
changeset
|
1469 cfg.OrigY -= (int) ((double) cfg.ScrMaxY * cfg.scroll_less / 100 / cfg.Scale); |
33
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1470 RedrawMap = 1; |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1471 } |
25
8eaf72e2041b
Reindent the source using GNU indent and "indent -i4 -bli0 -npcs -nprs -npsl".
Matti Hamalainen <ccr@tnsp.org>
parents:
24
diff
changeset
|
1472 |
33
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1473 // [Pgup], [Pgdn], [Home], [End]: |
80
2f1ecc1c5f72
Huge cleanup -- move some global variables into a struct.
Matti Hamalainen <ccr@tnsp.org>
parents:
43
diff
changeset
|
1474 // scroll <cfg.scroll_more> percents of a screenful. |
2f1ecc1c5f72
Huge cleanup -- move some global variables into a struct.
Matti Hamalainen <ccr@tnsp.org>
parents:
43
diff
changeset
|
1475 else if (is.key == YK_PU && MAPY(cfg.ScrCenterY) < /*MapMaxY */ 20000) |
33
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1476 { |
80
2f1ecc1c5f72
Huge cleanup -- move some global variables into a struct.
Matti Hamalainen <ccr@tnsp.org>
parents:
43
diff
changeset
|
1477 cfg.OrigY += (int) ((double) cfg.ScrMaxY * cfg.scroll_more / 100 / cfg.Scale); |
33
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1478 RedrawMap = 1; |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1479 } |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1480 else if (is.key == YK_PD |
80
2f1ecc1c5f72
Huge cleanup -- move some global variables into a struct.
Matti Hamalainen <ccr@tnsp.org>
parents:
43
diff
changeset
|
1481 && MAPY(cfg.ScrCenterY) > /*MapMinY */ -20000) |
33
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1482 { |
80
2f1ecc1c5f72
Huge cleanup -- move some global variables into a struct.
Matti Hamalainen <ccr@tnsp.org>
parents:
43
diff
changeset
|
1483 cfg.OrigY -= (int) ((double) cfg.ScrMaxY * cfg.scroll_more / 100 / cfg.Scale); |
33
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1484 RedrawMap = 1; |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1485 } |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1486 else if (is.key == YK_HOME |
80
2f1ecc1c5f72
Huge cleanup -- move some global variables into a struct.
Matti Hamalainen <ccr@tnsp.org>
parents:
43
diff
changeset
|
1487 && MAPX(cfg.ScrCenterX) > /*MapMinX */ -20000) |
33
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1488 { |
80
2f1ecc1c5f72
Huge cleanup -- move some global variables into a struct.
Matti Hamalainen <ccr@tnsp.org>
parents:
43
diff
changeset
|
1489 cfg.OrigX -= (int) ((double) cfg.ScrMaxX * cfg.scroll_more / 100 / cfg.Scale); |
33
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1490 RedrawMap = 1; |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1491 } |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1492 else if (is.key == YK_END |
80
2f1ecc1c5f72
Huge cleanup -- move some global variables into a struct.
Matti Hamalainen <ccr@tnsp.org>
parents:
43
diff
changeset
|
1493 && MAPX(cfg.ScrCenterX) < /*MapMaxX */ 20000) |
33
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1494 { |
80
2f1ecc1c5f72
Huge cleanup -- move some global variables into a struct.
Matti Hamalainen <ccr@tnsp.org>
parents:
43
diff
changeset
|
1495 cfg.OrigX += (int) ((double) cfg.ScrMaxX * cfg.scroll_more / 100 / cfg.Scale); |
33
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1496 RedrawMap = 1; |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1497 } |
25
8eaf72e2041b
Reindent the source using GNU indent and "indent -i4 -bli0 -npcs -nprs -npsl".
Matti Hamalainen <ccr@tnsp.org>
parents:
24
diff
changeset
|
1498 |
33
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1499 else if (is.key == ' ') |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1500 { |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1501 e.extra_zoom = !e.extra_zoom; |
80
2f1ecc1c5f72
Huge cleanup -- move some global variables into a struct.
Matti Hamalainen <ccr@tnsp.org>
parents:
43
diff
changeset
|
1502 edit_set_zoom(&e, cfg.Scale * (e.extra_zoom ? 4 : 0.25)); |
33
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1503 RedrawMap = 1; |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1504 } |
25
8eaf72e2041b
Reindent the source using GNU indent and "indent -i4 -bli0 -npcs -nprs -npsl".
Matti Hamalainen <ccr@tnsp.org>
parents:
24
diff
changeset
|
1505 |
33
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1506 // [Tab], [l], [s], [t], [v]: switch mode |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1507 else if (is.key == YK_TAB || is.key == YK_BACKTAB |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1508 || is.key == 't' || is.key == 'v' || is.key == 'l' |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1509 || is.key == 's') |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1510 { |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1511 int old_mode; |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1512 int new_mode = -1; |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1513 int PrevMode = e.obj_type; |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1514 SelPtr NewSel; |
25
8eaf72e2041b
Reindent the source using GNU indent and "indent -i4 -bli0 -npcs -nprs -npsl".
Matti Hamalainen <ccr@tnsp.org>
parents:
24
diff
changeset
|
1515 |
33
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1516 // What's the number of the current mode ? |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1517 old_mode = obj_type_to_mode_no(e.obj_type); |
25
8eaf72e2041b
Reindent the source using GNU indent and "indent -i4 -bli0 -npcs -nprs -npsl".
Matti Hamalainen <ccr@tnsp.org>
parents:
24
diff
changeset
|
1518 |
33
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1519 // What's the number of the new mode ? |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1520 if (is.key == YK_TAB) // [Tab] |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1521 new_mode = (old_mode + 1) % NB_MODES; |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1522 else if (is.key == YK_BACKTAB) // [Shift]-[Tab] |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1523 new_mode = old_mode == 0 ? NB_MODES - 1 : old_mode - 1; |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1524 else |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1525 { |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1526 if (is.key == 't') |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1527 new_mode = obj_type_to_mode_no(OBJ_THINGS); |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1528 else if (is.key == 'v') |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1529 new_mode = obj_type_to_mode_no(OBJ_VERTICES); |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1530 else if (is.key == 'l') |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1531 new_mode = obj_type_to_mode_no(OBJ_LINEDEFS); |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1532 else if (is.key == 's') |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1533 new_mode = obj_type_to_mode_no(OBJ_SECTORS); |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1534 else |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1535 fatal_error("changing mode with %04X", is.key); |
107
20aa5a515896
Reformat one line /* */ comments to //
Matti Hamalainen <ccr@tnsp.org>
parents:
89
diff
changeset
|
1536 // unselect all |
33
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1537 ForgetSelection(&e.Selected); |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1538 } |
25
8eaf72e2041b
Reindent the source using GNU indent and "indent -i4 -bli0 -npcs -nprs -npsl".
Matti Hamalainen <ccr@tnsp.org>
parents:
24
diff
changeset
|
1539 |
33
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1540 // Set the object type according to the new mode. |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1541 e.obj_type = modes[new_mode].obj_type; |
25
8eaf72e2041b
Reindent the source using GNU indent and "indent -i4 -bli0 -npcs -nprs -npsl".
Matti Hamalainen <ccr@tnsp.org>
parents:
24
diff
changeset
|
1542 |
33
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1543 // Change the flavour of the "Misc" menu. |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1544 e.menubar->set_menu(e.mb_ino[MBI_MISC], |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1545 e.mb_menu[modes[new_mode].menu_no]); |
0 | 1546 |
107
20aa5a515896
Reformat one line /* */ comments to //
Matti Hamalainen <ccr@tnsp.org>
parents:
89
diff
changeset
|
1547 // special cases for the selection list... |
33
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1548 if (e.Selected) |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1549 { |
107
20aa5a515896
Reformat one line /* */ comments to //
Matti Hamalainen <ccr@tnsp.org>
parents:
89
diff
changeset
|
1550 // select all linedefs bound to the selected sectors |
33
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1551 if (PrevMode == OBJ_SECTORS && e.obj_type == OBJ_LINEDEFS) |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1552 { |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1553 int l, sd; |
0 | 1554 |
33
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1555 NewSel = 0; |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1556 for (l = 0; l < NumLineDefs; l++) |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1557 { |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1558 sd = LineDefs[l].sidedef1; |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1559 if (sd >= 0 |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1560 && IsSelected(e.Selected, |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1561 SideDefs[sd].sector)) |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1562 SelectObject(&NewSel, l); |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1563 else |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1564 { |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1565 sd = LineDefs[l].sidedef2; |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1566 if (sd >= 0 |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1567 && IsSelected(e.Selected, |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1568 SideDefs[sd].sector)) |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1569 SelectObject(&NewSel, l); |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1570 } |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1571 } |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1572 ForgetSelection(&e.Selected); |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1573 e.Selected = NewSel; |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1574 } |
107
20aa5a515896
Reformat one line /* */ comments to //
Matti Hamalainen <ccr@tnsp.org>
parents:
89
diff
changeset
|
1575 // select all Vertices bound to the selected linedefs |
33
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1576 else if (PrevMode == OBJ_LINEDEFS |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1577 && e.obj_type == OBJ_VERTICES) |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1578 { |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1579 NewSel = 0; |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1580 while (e.Selected) |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1581 { |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1582 if (!IsSelected |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1583 (NewSel, LineDefs[e.Selected->objnum].start)) |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1584 SelectObject(&NewSel, |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1585 LineDefs[e.Selected->objnum]. |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1586 start); |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1587 if (!IsSelected |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1588 (NewSel, LineDefs[e.Selected->objnum].end)) |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1589 SelectObject(&NewSel, |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1590 LineDefs[e.Selected->objnum]. |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1591 end); |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1592 UnSelectObject(&e.Selected, e.Selected->objnum); |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1593 } |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1594 e.Selected = NewSel; |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1595 } |
107
20aa5a515896
Reformat one line /* */ comments to //
Matti Hamalainen <ccr@tnsp.org>
parents:
89
diff
changeset
|
1596 // select all sectors that have their linedefs selected |
33
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1597 else if (PrevMode == OBJ_LINEDEFS |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1598 && e.obj_type == OBJ_SECTORS) |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1599 { |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1600 int l, sd; |
0 | 1601 |
33
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1602 NewSel = 0; |
107
20aa5a515896
Reformat one line /* */ comments to //
Matti Hamalainen <ccr@tnsp.org>
parents:
89
diff
changeset
|
1603 // select all sectors... |
33
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1604 for (l = 0; l < NumSectors; l++) |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1605 SelectObject(&NewSel, l); |
107
20aa5a515896
Reformat one line /* */ comments to //
Matti Hamalainen <ccr@tnsp.org>
parents:
89
diff
changeset
|
1606 // ... then unselect those that should not be in the list |
33
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1607 for (l = 0; l < NumLineDefs; l++) |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1608 if (!IsSelected(e.Selected, l)) |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1609 { |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1610 sd = LineDefs[l].sidedef1; |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1611 if (sd >= 0) |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1612 UnSelectObject(&NewSel, |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1613 SideDefs[sd].sector); |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1614 sd = LineDefs[l].sidedef2; |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1615 if (sd >= 0) |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1616 UnSelectObject(&NewSel, |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1617 SideDefs[sd].sector); |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1618 } |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1619 ForgetSelection(&e.Selected); |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1620 e.Selected = NewSel; |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1621 } |
107
20aa5a515896
Reformat one line /* */ comments to //
Matti Hamalainen <ccr@tnsp.org>
parents:
89
diff
changeset
|
1622 // select all linedefs that have both ends selected |
33
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1623 else if (PrevMode == OBJ_VERTICES |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1624 && e.obj_type == OBJ_LINEDEFS) |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1625 { |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1626 int l; |
25
8eaf72e2041b
Reindent the source using GNU indent and "indent -i4 -bli0 -npcs -nprs -npsl".
Matti Hamalainen <ccr@tnsp.org>
parents:
24
diff
changeset
|
1627 |
33
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1628 NewSel = 0; |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1629 for (l = 0; l < NumLineDefs; l++) |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1630 if (IsSelected(e.Selected, LineDefs[l].start) |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1631 && IsSelected(e.Selected, LineDefs[l].end)) |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1632 SelectObject(&NewSel, l); |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1633 ForgetSelection(&e.Selected); |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1634 e.Selected = NewSel; |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1635 } |
107
20aa5a515896
Reformat one line /* */ comments to //
Matti Hamalainen <ccr@tnsp.org>
parents:
89
diff
changeset
|
1636 // unselect all |
33
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1637 else |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1638 ForgetSelection(&e.Selected); |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1639 } |
83
002bc70a3982
More cleanups. Mostly variable renames.
Matti Hamalainen <ccr@tnsp.org>
parents:
80
diff
changeset
|
1640 if (GetMaxObjectNum(e.obj_type) >= 0 && cfg.autoselect0 && !e.global) |
33
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1641 { |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1642 e.highlighted.type = e.obj_type; |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1643 e.highlighted.num = 0; |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1644 } |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1645 else |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1646 e.highlighted.nil(); |
25
8eaf72e2041b
Reindent the source using GNU indent and "indent -i4 -bli0 -npcs -nprs -npsl".
Matti Hamalainen <ccr@tnsp.org>
parents:
24
diff
changeset
|
1647 |
33
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1648 DragObject = false; |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1649 StretchSelBox = false; |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1650 RedrawMap = 1; |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1651 } |
0 | 1652 |
33
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1653 // [Ctrl][g]: toggle global mode |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1654 else if (is.key == '\7') |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1655 { |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1656 static bool dont_warn = false; |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1657 bool ok = false; |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1658 if (e.global) |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1659 ok = true; // No confirmation needed to switch off |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1660 else if (dont_warn) |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1661 ok = true; |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1662 else |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1663 { |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1664 ok = Confirm(-1, -1, |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1665 "Global mode is experimental and probably highly", |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1666 "unstable. This means crashes. Are you sure ?"); |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1667 RedrawMap = 1; |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1668 if (ok) |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1669 { |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1670 dont_warn = true; // User is sure. Won't ask again |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1671 Notify(-1, -1, |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1672 "Selection does not work in global mode. Don't", |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1673 "bother reporting it, I'm aware of it already."); |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1674 } |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1675 } |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1676 if (ok) |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1677 { |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1678 ForgetSelection(&e.Selected); |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1679 e.global = !e.global; |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1680 RedrawMap = 1; |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1681 } |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1682 } |
0 | 1683 |
33
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1684 // [e]: Select/unselect all linedefs in non-forked path |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1685 else if (is.key == 'e' && e.highlighted._is_linedef()) |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1686 { |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1687 ForgetSelection(&e.Selected); |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1688 select_linedefs_path(&e.Selected, e.highlighted.num, YS_ADD); |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1689 RedrawMap = 1; |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1690 } |
0 | 1691 |
33
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1692 // [Ctrl][e] Select/unselect all linedefs in path |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1693 else if (is.key == '\5' && !is.shift |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1694 && e.highlighted._is_linedef()) |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1695 { |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1696 select_linedefs_path(&e.Selected, e.highlighted.num, |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1697 YS_TOGGLE); |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1698 RedrawMap = 1; |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1699 } |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1700 // [E]: add linedef and split sector -- [AJA] |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1701 else if (is.key == 'E' && e.obj_type == OBJ_VERTICES) |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1702 { |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1703 if (e.Selected) |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1704 { |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1705 MiscOperations(e.obj_type, &e.Selected, 5); |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1706 RedrawMap = 1; |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1707 } |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1708 } |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1709 // [E]: Select/unselect all 1s linedefs in path |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1710 else if (is.key == 'E' && e.highlighted._is_linedef()) |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1711 { |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1712 ForgetSelection(&e.Selected); |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1713 select_1s_linedefs_path(&e.Selected, e.highlighted.num, |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1714 YS_ADD); |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1715 RedrawMap = 1; |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1716 } |
0 | 1717 |
33
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1718 // [Ctrl][Shift][e]: Select/unselect all 1s linedefs in path |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1719 else if (is.key == '\5' && is.shift |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1720 && e.highlighted._is_linedef()) |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1721 { |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1722 select_1s_linedefs_path(&e.Selected, e.highlighted.num, |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1723 YS_TOGGLE); |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1724 RedrawMap = 1; |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1725 } |
0 | 1726 |
33
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1727 // [G]: to increase the grid step |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1728 else if (is.key == 'G') |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1729 { |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1730 if (e.grid_step < e.grid_step_max) |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1731 e.grid_step *= 2; |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1732 else |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1733 e.grid_step = e.grid_step_min; |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1734 RedrawMap = 1; |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1735 } |
25
8eaf72e2041b
Reindent the source using GNU indent and "indent -i4 -bli0 -npcs -nprs -npsl".
Matti Hamalainen <ccr@tnsp.org>
parents:
24
diff
changeset
|
1736 |
33
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1737 // [g]: decrease the grid step |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1738 else if (is.key == 'g') |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1739 { |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1740 if (e.grid_step > e.grid_step_min) |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1741 e.grid_step /= 2; |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1742 else |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1743 e.grid_step = e.grid_step_max; |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1744 RedrawMap = 1; |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1745 } |
0 | 1746 |
33
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1747 // [h]: display or hide the grid |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1748 else if (is.key == 'h') |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1749 { |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1750 e.grid_shown = !e.grid_shown; |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1751 RedrawMap = 1; |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1752 } |
25
8eaf72e2041b
Reindent the source using GNU indent and "indent -i4 -bli0 -npcs -nprs -npsl".
Matti Hamalainen <ccr@tnsp.org>
parents:
24
diff
changeset
|
1753 |
33
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1754 // [H]: reset the grid to grid_step_max |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1755 else if (is.key == 'H') |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1756 { |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1757 e.grid_step = e.grid_step_max; |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1758 RedrawMap = 1; |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1759 } |
0 | 1760 |
33
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1761 // [y]: toggle the snap_to_grid flag |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1762 else if (is.key == 'y') |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1763 { |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1764 e.grid_snap = !e.grid_snap; |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1765 } |
25
8eaf72e2041b
Reindent the source using GNU indent and "indent -i4 -bli0 -npcs -nprs -npsl".
Matti Hamalainen <ccr@tnsp.org>
parents:
24
diff
changeset
|
1766 |
33
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1767 // [z]: toggle the lock_grip_step flag |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1768 else if (is.key == 'z') |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1769 { |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1770 e.grid_step_locked = !e.grid_step_locked; |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1771 } |
25
8eaf72e2041b
Reindent the source using GNU indent and "indent -i4 -bli0 -npcs -nprs -npsl".
Matti Hamalainen <ccr@tnsp.org>
parents:
24
diff
changeset
|
1772 |
33
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1773 // [r]: toggle the rulers |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1774 else if (is.key == 'r') |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1775 e.rulers_shown = !e.rulers_shown; |
0 | 1776 |
33
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1777 // [n], [>]: highlight the next object |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1778 else if ((is.key == 'n' || is.key == '>') |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1779 && (!e.global ||e.highlighted())) |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1780 { |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1781 obj_type_t t = |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1782 e.highlighted()? e.highlighted.type : e.obj_type; |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1783 obj_no_t nmax = GetMaxObjectNum(t); |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1784 if (is_obj(nmax)) |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1785 { |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1786 if (e.highlighted.is_nil()) |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1787 { |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1788 e.highlighted.type = t; |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1789 e.highlighted.num = 0; |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1790 } |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1791 else |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1792 { |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1793 e.highlighted.num++; |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1794 if (e.highlighted.num > nmax) |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1795 e.highlighted.num = 0; |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1796 } |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1797 GoToObject(e.highlighted); |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1798 RedrawMap = 1; |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1799 } |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1800 } |
0 | 1801 |
33
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1802 // [p], [<]: highlight the previous object |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1803 else if ((is.key == 'p' || is.key == '<') |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1804 && (!e.global ||e.highlighted())) |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1805 { |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1806 obj_type_t t = |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1807 e.highlighted()? e.highlighted.type : e.obj_type; |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1808 obj_no_t nmax = GetMaxObjectNum(t); |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1809 if (is_obj(nmax)) |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1810 { |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1811 if (e.highlighted.is_nil()) |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1812 { |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1813 e.highlighted.type = t; |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1814 e.highlighted.num = nmax; |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1815 } |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1816 else |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1817 { |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1818 e.highlighted.num--; |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1819 if (e.highlighted.num < 0) |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1820 e.highlighted.num = nmax; |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1821 } |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1822 GoToObject(e.highlighted); |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1823 RedrawMap = 1; |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1824 } |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1825 } |
0 | 1826 |
33
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1827 // [j], [#]: jump to object by number |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1828 else if ((is.key == 'j' || is.key == '#') |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1829 && (!e.global ||e.highlighted())) |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1830 { |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1831 Objid default_obj; |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1832 default_obj.type = |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1833 e.highlighted()? e.highlighted.type : e.obj_type; |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1834 default_obj.num = e.highlighted()? e.highlighted.num : 0; |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1835 Objid target_obj; |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1836 input_objid(target_obj, default_obj, -1, -1); |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1837 if (target_obj()) |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1838 GoToObject(target_obj); |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1839 RedrawMap = 1; |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1840 } |
0 | 1841 |
33
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1842 // [f]: find object by type |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1843 else if (is.key == 'f' && (!e.global ||e.highlighted())) |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1844 { |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1845 Objid find_obj; |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1846 int otype; |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1847 obj_no_t omax, onum; |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1848 find_obj.type = |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1849 e.highlighted()? e.highlighted.type : e.obj_type; |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1850 onum = find_obj.num = e.highlighted()? e.highlighted.num : 0; |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1851 omax = GetMaxObjectNum(find_obj.type); |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1852 switch (find_obj.type) |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1853 { |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1854 case OBJ_SECTORS: |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1855 if (!InputSectorType(84, 21, &otype)) |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1856 { |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1857 for (onum = e.highlighted()? onum + 1 : onum; |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1858 onum <= omax; onum++) |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1859 if (Sectors[onum].special == (wad_stype_t) otype) |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1860 { |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1861 find_obj.num = onum; |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1862 GoToObject(find_obj); |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1863 break; |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1864 } |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1865 } |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1866 break; |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1867 case OBJ_THINGS: |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1868 if (!InputThingType(42, 21, &otype)) |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1869 { |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1870 for (onum = e.highlighted()? onum + 1 : onum; |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1871 onum <= omax; onum++) |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1872 if (Things[onum].type == (wad_ttype_t) otype) |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1873 { |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1874 find_obj.num = onum; |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1875 GoToObject(find_obj); |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1876 break; |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1877 } |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1878 } |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1879 break; |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1880 case OBJ_LINEDEFS: |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1881 if (!InputLinedefType(0, 21, &otype)) |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1882 { |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1883 for (onum = e.highlighted()? onum + 1 : onum; |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1884 onum <= omax; onum++) |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1885 if (LineDefs[onum].type == (wad_ldtype_t) otype) |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1886 { |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1887 find_obj.num = onum; |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1888 GoToObject(find_obj); |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1889 break; |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1890 } |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1891 } |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1892 break; |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1893 } |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1894 RedrawMap = 1; |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1895 } |
0 | 1896 #if 0 |
33
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1897 // [c]: clear selection and redraw the map |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1898 else if (is.key == 'c') |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1899 { |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1900 ForgetSelection(&e.Selected); |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1901 RedrawMap = 1; |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1902 DragObject = false; |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1903 StretchSelBox = false; |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1904 } |
0 | 1905 #endif |
1906 | |
33
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1907 // [o]: copy a group of objects |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1908 else if (is.key == 'o' && (e.Selected || e.highlighted())) |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1909 { |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1910 int x, y; |
25
8eaf72e2041b
Reindent the source using GNU indent and "indent -i4 -bli0 -npcs -nprs -npsl".
Matti Hamalainen <ccr@tnsp.org>
parents:
24
diff
changeset
|
1911 |
107
20aa5a515896
Reformat one line /* */ comments to //
Matti Hamalainen <ccr@tnsp.org>
parents:
89
diff
changeset
|
1912 // copy the object(s) |
33
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1913 if (!e.Selected) |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1914 SelectObject(&e.Selected, e.highlighted.num); |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1915 CopyObjects(e.obj_type, e.Selected); |
107
20aa5a515896
Reformat one line /* */ comments to //
Matti Hamalainen <ccr@tnsp.org>
parents:
89
diff
changeset
|
1916 // enter drag mode |
33
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1917 //DragObject = true; |
107
20aa5a515896
Reformat one line /* */ comments to //
Matti Hamalainen <ccr@tnsp.org>
parents:
89
diff
changeset
|
1918 // AYM 19980619 : got to look into this!! |
33
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1919 //e.highlight_obj_no = e.Selected->objnum; |
0 | 1920 |
33
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1921 // Find the "hotspot" in the object(s) |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1922 if (e.highlighted() && !e.Selected) |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1923 GetObjectCoords(e.highlighted.type, e.highlighted.num, &x, |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1924 &y); |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1925 else |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1926 centre_of_objects(e.obj_type, e.Selected, &x, &y); |
25
8eaf72e2041b
Reindent the source using GNU indent and "indent -i4 -bli0 -npcs -nprs -npsl".
Matti Hamalainen <ccr@tnsp.org>
parents:
24
diff
changeset
|
1927 |
33
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1928 // Drag the object(s) so that the "hotspot" is under the pointer |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1929 MoveObjectsToCoords(e.obj_type, 0, x, y, 0); |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1930 MoveObjectsToCoords(e.obj_type, e.Selected, |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1931 e.pointer_x, e.pointer_y, 0); |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1932 RedrawMap = 1; |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1933 StretchSelBox = false; |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1934 } |
0 | 1935 |
33
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1936 // [Return]: edit the properties of the current object. |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1937 else if (is.key == YK_RETURN && (e.Selected || e.highlighted())) |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1938 { |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1939 if (e.Selected) |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1940 EditObjectsInfo(0, menubar_out_y1 + 1, e.obj_type, |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1941 e.Selected); |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1942 else |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1943 { |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1944 SelectObject(&e.Selected, e.highlighted.num); |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1945 EditObjectsInfo(0, menubar_out_y1 + 1, e.highlighted.type, |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1946 e.Selected); |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1947 UnSelectObject(&e.Selected, e.highlighted.num); |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1948 } |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1949 RedrawMap = 1; |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1950 DragObject = false; |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1951 StretchSelBox = false; |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1952 } |
0 | 1953 |
33
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1954 // [w]: spin things 1/8 turn counter-clockwise |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1955 else if (is.key == 'w' && e.obj_type == OBJ_THINGS |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1956 && (e.Selected || e.highlighted())) |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1957 { |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1958 if (!e.Selected) |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1959 { |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1960 SelectObject(&e.Selected, e.highlighted.num); |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1961 spin_things(e.Selected, 45); |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1962 UnSelectObject(&e.Selected, e.highlighted.num); |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1963 } |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1964 else |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1965 { |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1966 spin_things(e.Selected, 45); |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1967 } |
107
20aa5a515896
Reformat one line /* */ comments to //
Matti Hamalainen <ccr@tnsp.org>
parents:
89
diff
changeset
|
1968 RedrawMap = 1; // FIXME: should redraw only the things |
33
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1969 DragObject = false; |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1970 StretchSelBox = false; |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1971 } |
0 | 1972 |
33
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1973 // [w]: split linedefs and sectors |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1974 else if (is.key == 'w' && e.obj_type == OBJ_LINEDEFS |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1975 && e.Selected && e.Selected->next |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1976 && !e.Selected->next->next) |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1977 { |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1978 SplitLineDefsAndSector(e.Selected->next->objnum, |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1979 e.Selected->objnum); |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1980 ForgetSelection(&e.Selected); |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1981 RedrawMap = 1; |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1982 DragObject = false; |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1983 StretchSelBox = false; |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1984 } |
25
8eaf72e2041b
Reindent the source using GNU indent and "indent -i4 -bli0 -npcs -nprs -npsl".
Matti Hamalainen <ccr@tnsp.org>
parents:
24
diff
changeset
|
1985 |
33
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1986 // [w]: split sector between vertices |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1987 else if (is.key == 'w' && e.obj_type == OBJ_VERTICES |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1988 && e.Selected && e.Selected->next |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1989 && !e.Selected->next->next) |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1990 { |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1991 SplitSector(e.Selected->next->objnum, e.Selected->objnum); |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1992 ForgetSelection(&e.Selected); |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1993 RedrawMap = 1; |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1994 DragObject = false; |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1995 StretchSelBox = false; |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1996 } |
0 | 1997 |
33
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1998 // [x]: spin things 1/8 turn clockwise |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
1999 else if (is.key == 'x' && e.obj_type == OBJ_THINGS |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
2000 && (e.Selected || e.highlighted())) |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
2001 { |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
2002 if (!e.Selected) |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
2003 { |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
2004 SelectObject(&e.Selected, e.highlighted.num); |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
2005 spin_things(e.Selected, -45); |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
2006 UnSelectObject(&e.Selected, e.highlighted.num); |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
2007 } |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
2008 else |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
2009 { |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
2010 spin_things(e.Selected, -45); |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
2011 } |
107
20aa5a515896
Reformat one line /* */ comments to //
Matti Hamalainen <ccr@tnsp.org>
parents:
89
diff
changeset
|
2012 RedrawMap = 1; // FIXME: should redraw only the things |
33
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
2013 DragObject = false; |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
2014 StretchSelBox = false; |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
2015 } |
25
8eaf72e2041b
Reindent the source using GNU indent and "indent -i4 -bli0 -npcs -nprs -npsl".
Matti Hamalainen <ccr@tnsp.org>
parents:
24
diff
changeset
|
2016 |
33
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
2017 // [x]: split linedefs |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
2018 else if (is.key == 'x' && e.obj_type == OBJ_LINEDEFS |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
2019 && (e.Selected || e.highlighted())) |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
2020 { |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
2021 if (!e.Selected) |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
2022 { |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
2023 SelectObject(&e.Selected, e.highlighted.num); |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
2024 SplitLineDefs(e.Selected); |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
2025 UnSelectObject(&e.Selected, e.highlighted.num); |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
2026 } |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
2027 else |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
2028 SplitLineDefs(e.Selected); |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
2029 RedrawMap = 1; |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
2030 DragObject = false; |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
2031 StretchSelBox = false; |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
2032 } |
25
8eaf72e2041b
Reindent the source using GNU indent and "indent -i4 -bli0 -npcs -nprs -npsl".
Matti Hamalainen <ccr@tnsp.org>
parents:
24
diff
changeset
|
2033 |
33
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
2034 // [Ctrl][x]: exchange objects numbers |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
2035 else if (is.key == 24) |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
2036 { |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
2037 if (!e.Selected |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
2038 || !e.Selected->next || (e.Selected->next)->next) |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
2039 { |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
2040 Beep(); |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
2041 Notify(-1, -1, "You must select exactly two objects", 0); |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
2042 RedrawMap = 1; |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
2043 } |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
2044 else |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
2045 { |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
2046 exchange_objects_numbers(e.obj_type, e.Selected, true); |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
2047 RedrawMap = 1; |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
2048 } |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
2049 } |
0 | 2050 |
33
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
2051 // [Ctrl][k]: cut a slice out of a sector |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
2052 else if (is.key == 11 && e.obj_type == OBJ_LINEDEFS |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
2053 && e.Selected && e.Selected->next |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
2054 && !e.Selected->next->next) |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
2055 { |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
2056 sector_slice(e.Selected->next->objnum, e.Selected->objnum); |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
2057 ForgetSelection(&e.Selected); |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
2058 RedrawMap = 1; |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
2059 DragObject = false; |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
2060 StretchSelBox = false; |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
2061 } |
0 | 2062 |
33
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
2063 // [Del]: delete the current object |
107
20aa5a515896
Reformat one line /* */ comments to //
Matti Hamalainen <ccr@tnsp.org>
parents:
89
diff
changeset
|
2064 else if (is.key == YK_DEL && (e.Selected || e.highlighted())) // 'Del' |
33
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
2065 { |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
2066 if (e.obj_type == OBJ_THINGS |
83
002bc70a3982
More cleanups. Mostly variable renames.
Matti Hamalainen <ccr@tnsp.org>
parents:
80
diff
changeset
|
2067 || cfg.expert |
33
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
2068 || Confirm(-1, -1, |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
2069 (e.Selected && e.Selected->next ? |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
2070 "Do you really want to delete these objects?" |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
2071 : |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
2072 "Do you really want to delete this object?"), |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
2073 (e.Selected |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
2074 && e.Selected-> |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
2075 next ? |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
2076 "This will also delete the objects bound to them." |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
2077 : |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
2078 "This will also delete the objects bound to it."))) |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
2079 { |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
2080 if (e.Selected) |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
2081 DeleteObjects(e.obj_type, &e.Selected); |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
2082 else |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
2083 DeleteObject(e.highlighted); |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
2084 } |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
2085 // AYM 1998-09-20 I thought I'd add this |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
2086 // (though it doesn't fix the problem : if the object has been |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
2087 // deleted, HighlightObject is still called with a bad object#). |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
2088 e.highlighted.nil(); |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
2089 DragObject = false; |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
2090 StretchSelBox = false; |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
2091 RedrawMap = 1; |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
2092 } |
0 | 2093 |
33
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
2094 // [Ins]: insert a new object |
107
20aa5a515896
Reformat one line /* */ comments to //
Matti Hamalainen <ccr@tnsp.org>
parents:
89
diff
changeset
|
2095 else if (is.key == YK_INS || is.key == YK_INS + YK_SHIFT) // 'Ins' |
33
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
2096 { |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
2097 SelPtr cur; |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
2098 int prev_obj_type = e.obj_type; |
25
8eaf72e2041b
Reindent the source using GNU indent and "indent -i4 -bli0 -npcs -nprs -npsl".
Matti Hamalainen <ccr@tnsp.org>
parents:
24
diff
changeset
|
2099 |
33
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
2100 /* first special case: if several vertices are |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
2101 selected, add new linedefs */ |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
2102 if (e.obj_type == OBJ_VERTICES |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
2103 && e.Selected && e.Selected->next) |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
2104 { |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
2105 int firstv; |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
2106 int obj_no = OBJ_NO_NONE; |
25
8eaf72e2041b
Reindent the source using GNU indent and "indent -i4 -bli0 -npcs -nprs -npsl".
Matti Hamalainen <ccr@tnsp.org>
parents:
24
diff
changeset
|
2107 |
33
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
2108 if (e.Selected->next->next) |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
2109 firstv = e.Selected->objnum; |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
2110 else |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
2111 firstv = -1; |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
2112 e.obj_type = OBJ_LINEDEFS; |
107
20aa5a515896
Reformat one line /* */ comments to //
Matti Hamalainen <ccr@tnsp.org>
parents:
89
diff
changeset
|
2113 // create linedefs between the vertices |
33
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
2114 for (cur = e.Selected; cur->next; cur = cur->next) |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
2115 { |
107
20aa5a515896
Reformat one line /* */ comments to //
Matti Hamalainen <ccr@tnsp.org>
parents:
89
diff
changeset
|
2116 // check if there is already a linedef between the two vertices |
33
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
2117 for (obj_no = 0; obj_no < NumLineDefs; obj_no++) |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
2118 if ((LineDefs[obj_no].start == cur->next->objnum |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
2119 && LineDefs[obj_no].end == cur->objnum) |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
2120 || (LineDefs[obj_no].end == cur->next->objnum |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
2121 && LineDefs[obj_no].start == cur->objnum)) |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
2122 break; |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
2123 if (obj_no < NumLineDefs) |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
2124 cur->objnum = obj_no; |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
2125 else |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
2126 { |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
2127 InsertObject(OBJ_LINEDEFS, -1, 0, 0); |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
2128 e.highlighted.type = OBJ_LINEDEFS; |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
2129 e.highlighted.num = NumLineDefs - 1; |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
2130 LineDefs[e.highlighted.num].start = |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
2131 cur->next->objnum; |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
2132 LineDefs[e.highlighted.num].end = cur->objnum; |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
2133 cur->objnum = e.highlighted.num; // FIXME cur = e.highlighted |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
2134 } |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
2135 } |
107
20aa5a515896
Reformat one line /* */ comments to //
Matti Hamalainen <ccr@tnsp.org>
parents:
89
diff
changeset
|
2136 // close the polygon if there are more than 2 vertices |
33
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
2137 if (firstv >= 0 && is.shift) |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
2138 { |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
2139 e.highlighted.type = OBJ_LINEDEFS; |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
2140 for (e.highlighted.num = 0; |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
2141 e.highlighted.num < NumLineDefs; |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
2142 e.highlighted.num++) |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
2143 if ((LineDefs[e.highlighted.num].start == firstv |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
2144 && LineDefs[e.highlighted.num].end == |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
2145 cur->objnum) |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
2146 || (LineDefs[e.highlighted.num].end == firstv |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
2147 && LineDefs[e.highlighted.num].start == |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
2148 cur->objnum)) |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
2149 break; |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
2150 if (e.highlighted.num < NumLineDefs) |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
2151 cur->objnum = obj_no; |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
2152 else |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
2153 { |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
2154 InsertObject(OBJ_LINEDEFS, -1, 0, 0); |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
2155 e.highlighted.type = OBJ_LINEDEFS; |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
2156 e.highlighted.num = NumLineDefs - 1; |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
2157 LineDefs[e.highlighted.num].start = firstv; |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
2158 LineDefs[e.highlighted.num].end = cur->objnum; |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
2159 cur->objnum = e.highlighted.num; // FIXME cur = e.highlighted |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
2160 } |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
2161 } |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
2162 else |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
2163 UnSelectObject(&e.Selected, cur->objnum); |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
2164 } |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
2165 /* second special case: if several linedefs are selected, |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
2166 add new sidedefs and one sector */ |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
2167 else if (e.obj_type == OBJ_LINEDEFS && e.Selected) |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
2168 { |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
2169 for (cur = e.Selected; cur; cur = cur->next) |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
2170 if (LineDefs[cur->objnum].sidedef1 >= 0 |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
2171 && LineDefs[cur->objnum].sidedef2 >= 0) |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
2172 { |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
2173 char msg[80]; |
0 | 2174 |
33
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
2175 Beep(); |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
2176 sprintf(msg, |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
2177 "Linedef #%d already has two sidedefs", |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
2178 cur->objnum); |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
2179 Notify(-1, -1, "Error: cannot add the new sector", |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
2180 msg); |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
2181 break; |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
2182 } |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
2183 if (!cur) |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
2184 { |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
2185 e.obj_type = OBJ_SECTORS; |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
2186 InsertObject(OBJ_SECTORS, -1, 0, 0); |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
2187 e.highlighted.type = OBJ_SECTORS; |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
2188 e.highlighted.num = NumSectors - 1; |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
2189 for (cur = e.Selected; cur; cur = cur->next) |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
2190 { |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
2191 InsertObject(OBJ_SIDEDEFS, -1, 0, 0); |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
2192 SideDefs[NumSideDefs - 1].sector = |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
2193 e.highlighted.num; |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
2194 if (LineDefs[cur->objnum].sidedef1 >= 0) |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
2195 { |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
2196 int s; |
0 | 2197 |
33
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
2198 s = SideDefs[LineDefs[cur->objnum].sidedef1]. |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
2199 sector; |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
2200 if (s >= 0) |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
2201 { |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
2202 Sectors[e.highlighted.num].floorh = |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
2203 Sectors[s].floorh; |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
2204 Sectors[e.highlighted.num].ceilh = |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
2205 Sectors[s].ceilh; |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
2206 strncpy(Sectors[e.highlighted.num].floort, |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
2207 Sectors[s].floort, WAD_FLAT_NAME); |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
2208 strncpy(Sectors[e.highlighted.num].ceilt, |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
2209 Sectors[s].ceilt, WAD_FLAT_NAME); |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
2210 Sectors[e.highlighted.num].light = |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
2211 Sectors[s].light; |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
2212 } |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
2213 LineDefs[cur->objnum].sidedef2 = |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
2214 NumSideDefs - 1; |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
2215 LineDefs[cur->objnum].flags = 4; |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
2216 strncpy(SideDefs[NumSideDefs - 1].tex3, |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
2217 "-", WAD_TEX_NAME); |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
2218 strncpy(SideDefs |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
2219 [LineDefs[cur->objnum].sidedef1].tex3, |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
2220 "-", WAD_TEX_NAME); |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
2221 } |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
2222 else |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
2223 LineDefs[cur->objnum].sidedef1 = |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
2224 NumSideDefs - 1; |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
2225 } |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
2226 ForgetSelection(&e.Selected); |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
2227 SelectObject(&e.Selected, e.highlighted.num); |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
2228 } |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
2229 } |
107
20aa5a515896
Reformat one line /* */ comments to //
Matti Hamalainen <ccr@tnsp.org>
parents:
89
diff
changeset
|
2230 // normal case: add a new object of the current type |
33
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
2231 else |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
2232 { |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
2233 ForgetSelection(&e.Selected); |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
2234 /* FIXME how do you insert a new object of type T if |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
2235 no object of that type already exists ? */ |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
2236 obj_type_t t = |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
2237 e.highlighted()? e.highlighted.type : e.obj_type; |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
2238 InsertObject(t, e.highlighted.num, |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
2239 edit_mapx_snapped(&e, e.pointer_x), |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
2240 edit_mapy_snapped(&e, e.pointer_y)); |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
2241 e.highlighted.type = t; |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
2242 e.highlighted.num = GetMaxObjectNum(e.obj_type); |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
2243 if (e.obj_type == OBJ_LINEDEFS) |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
2244 { |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
2245 int v1 = LineDefs[e.highlighted.num].start; |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
2246 int v2 = LineDefs[e.highlighted.num].end; |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
2247 if (!Input2VertexNumbers(-1, -1, |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
2248 "Choose the two vertices for the new linedef", |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
2249 &v1, &v2)) |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
2250 { |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
2251 DeleteObject(e.highlighted); |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
2252 e.highlighted.nil(); |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
2253 } |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
2254 else |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
2255 { |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
2256 LineDefs[e.highlighted.num].start = v1; |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
2257 LineDefs[e.highlighted.num].end = v2; |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
2258 } |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
2259 } |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
2260 else if (e.obj_type == OBJ_VERTICES) |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
2261 { |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
2262 SelectObject(&e.Selected, e.highlighted.num); |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
2263 if (AutoMergeVertices(&e.Selected, e.obj_type, 'i')) |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
2264 RedrawMap = 1; |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
2265 ForgetSelection(&e.Selected); |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
2266 } |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
2267 } |
25
8eaf72e2041b
Reindent the source using GNU indent and "indent -i4 -bli0 -npcs -nprs -npsl".
Matti Hamalainen <ccr@tnsp.org>
parents:
24
diff
changeset
|
2268 |
33
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
2269 // Mode-changing code, duplicated from above. |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
2270 // As RQ would say: "I hate to do that". So do I. |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
2271 // The best solution would be to have a mode |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
2272 // changing function that only changes e.obj_type |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
2273 // and emits a "mode change" message. Another part |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
2274 // of the code, responsible for the menus, would |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
2275 // intercept that message and update them. I don't |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
2276 // have the time (as of 1998-12-14) to do it now. |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
2277 if (e.obj_type != prev_obj_type) |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
2278 { |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
2279 int new_mode; |
25
8eaf72e2041b
Reindent the source using GNU indent and "indent -i4 -bli0 -npcs -nprs -npsl".
Matti Hamalainen <ccr@tnsp.org>
parents:
24
diff
changeset
|
2280 |
33
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
2281 // What's the number of the new mode ? |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
2282 new_mode = obj_type_to_mode_no(e.obj_type); |
25
8eaf72e2041b
Reindent the source using GNU indent and "indent -i4 -bli0 -npcs -nprs -npsl".
Matti Hamalainen <ccr@tnsp.org>
parents:
24
diff
changeset
|
2283 |
33
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
2284 // Change the flavour of the "Misc" menu. |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
2285 e.menubar->set_menu(e.mb_ino[MBI_MISC], |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
2286 e.mb_menu[modes[new_mode].menu_no]); |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
2287 } |
25
8eaf72e2041b
Reindent the source using GNU indent and "indent -i4 -bli0 -npcs -nprs -npsl".
Matti Hamalainen <ccr@tnsp.org>
parents:
24
diff
changeset
|
2288 |
33
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
2289 DragObject = false; |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
2290 StretchSelBox = false; |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
2291 RedrawMap = 1; |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
2292 } |
0 | 2293 |
33
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
2294 // [Z] Set sector on surrounding linedefs (AJA) |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
2295 else if (is.key == 'Z' && e.pointer_in_window) |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
2296 { |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
2297 if (e.obj_type == OBJ_SECTORS && e.Selected) |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
2298 { |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
2299 SuperSectorSelector(e.pointer_x, e.pointer_y, |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
2300 e.Selected->objnum); |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
2301 } |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
2302 else |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
2303 { |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
2304 SuperSectorSelector(e.pointer_x, e.pointer_y, |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
2305 OBJ_NO_NONE); |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
2306 } |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
2307 RedrawMap = 1; |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
2308 } |
0 | 2309 |
33
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
2310 // [!] Debug info (not documented) |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
2311 else if (is.key == '!') |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
2312 { |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
2313 DumpSelection(e.Selected); |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
2314 } |
4
db8b4f975bad
"Tools" patch by Andrew Apted. Adds a few extra tools to Yadex's
Matti Hamalainen <ccr@tnsp.org>
parents:
3
diff
changeset
|
2315 |
33
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
2316 // [R] Render 3D view (AJA) |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
2317 else if (is.key == 'R') |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
2318 { |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
2319 Render3D(); |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
2320 RedrawMap = 1; |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
2321 } |
24
b2dc19044bf3
Import simple 3D preview, an old patch by Andrew Apted. Pressing 'R' key
Matti Hamalainen <ccr@tnsp.org>
parents:
22
diff
changeset
|
2322 |
33
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
2323 // [T] Transfer properties to selected objects (AJA) |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
2324 else if (is.key == 'T' && e.Selected && e.highlighted.num >= 0) |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
2325 { |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
2326 switch (e.obj_type) |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
2327 { |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
2328 case OBJ_SECTORS: |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
2329 TransferSectorProperties(e.highlighted.num, e.Selected); |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
2330 RedrawMap = 1; |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
2331 break; |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
2332 case OBJ_THINGS: |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
2333 TransferThingProperties(e.highlighted.num, e.Selected); |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
2334 RedrawMap = 1; |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
2335 break; |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
2336 case OBJ_LINEDEFS: |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
2337 TransferLinedefProperties(e.highlighted.num, e.Selected); |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
2338 RedrawMap = 1; |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
2339 break; |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
2340 default: |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
2341 Beep(); |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
2342 break; |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
2343 } |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
2344 } |
4
db8b4f975bad
"Tools" patch by Andrew Apted. Adds a few extra tools to Yadex's
Matti Hamalainen <ccr@tnsp.org>
parents:
3
diff
changeset
|
2345 |
33
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
2346 // [Ctrl][b] Select linedefs whose sidedefs reference non-existant sectors |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
2347 else if (is.key == 2) |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
2348 { |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
2349 bad_sector_number(&e.Selected); |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
2350 RedrawMap = 1; |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
2351 } |
0 | 2352 |
33
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
2353 // [Ctrl][p] Examine game palette (not documented) |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
2354 else if (is.key == 16) |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
2355 { |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
2356 Palette_viewer pv; |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
2357 pv.run(); |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
2358 RedrawMap = 1; |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
2359 } |
0 | 2360 |
33
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
2361 // [Ctrl][r] Xref for sidedef (not documented) |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
2362 else if (is.key == 18) |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
2363 { |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
2364 xref_sidedef(); |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
2365 } |
0 | 2366 |
33
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
2367 // [Ctrl][s] List secret sectors (not documented) |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
2368 else if (is.key == 19) |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
2369 { |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
2370 secret_sectors(); |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
2371 } |
0 | 2372 |
33
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
2373 // [Ctrl][t] List tagged linedefs or sectors |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
2374 else if (is.key == 20) |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
2375 { |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
2376 if (e.highlighted._is_sector()) |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
2377 list_tagged_linedefs(Sectors[e.highlighted.num].tag); |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
2378 else if (e.highlighted._is_linedef()) |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
2379 list_tagged_sectors(LineDefs[e.highlighted.num].tag); |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
2380 else |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
2381 Beep(); |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
2382 } |
0 | 2383 |
33
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
2384 // [Ctrl][u] Select linedefs with unknown type (not documented) |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
2385 else if (is.key == 21) |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
2386 { |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
2387 unknown_linedef_type(&e.Selected); |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
2388 RedrawMap = 1; |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
2389 } |
0 | 2390 |
33
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
2391 // [Ctrl][v] Toggle between "snap vertex" tool and normal tool |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
2392 // (not documented) |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
2393 else if (is.key == 22) |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
2394 { |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
2395 if (e.tool == TOOL_NORMAL) |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
2396 { |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
2397 e.tool = TOOL_SNAP_VERTEX; |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
2398 printf("Switched to snap vertex tool." |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
2399 " Press [Ctrl][v] to switch back to normal tool.\n"); |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
2400 } |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
2401 else |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
2402 { |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
2403 e.tool = TOOL_NORMAL; |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
2404 printf("Switched back to normal tool.\n"); |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
2405 } |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
2406 } |
0 | 2407 |
33
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
2408 // [&] Show object numbers |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
2409 else if (is.key == '&') |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
2410 { |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
2411 e.show_object_numbers = !e.show_object_numbers; |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
2412 RedrawMap = 1; |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
2413 } |
0 | 2414 |
33
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
2415 // [%] Show things sprites |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
2416 else if (is.key == '%') |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
2417 { |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
2418 e.show_things_sprites = !e.show_things_sprites; |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
2419 e.show_things_squares = !e.show_things_sprites; // Not a typo ! |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
2420 RedrawMap = 1; |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
2421 } |
0 | 2422 |
107
20aa5a515896
Reformat one line /* */ comments to //
Matti Hamalainen <ccr@tnsp.org>
parents:
89
diff
changeset
|
2423 // user likes music |
33
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
2424 else if (is.key) |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
2425 { |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
2426 Beep(); |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
2427 } |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
2428 } |
0 | 2429 |
33
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
2430 /* |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
2431 * Step 4 -- Misc. cruft |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
2432 */ |
0 | 2433 |
25
8eaf72e2041b
Reindent the source using GNU indent and "indent -i4 -bli0 -npcs -nprs -npsl".
Matti Hamalainen <ccr@tnsp.org>
parents:
24
diff
changeset
|
2434 done: |
0 | 2435 |
33
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
2436 // Auto-scrolling: scroll the map automatically |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
2437 // when the mouse pointer rests near the edge |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
2438 // of the window. |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
2439 // Scrolling is disabled when a pull-down menu |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
2440 // is visible because it would be annoying to see |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
2441 // the map scrolling while you're searching |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
2442 // through the menus. |
0 | 2443 |
33
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
2444 if (is.in_window |
80
2f1ecc1c5f72
Huge cleanup -- move some global variables into a struct.
Matti Hamalainen <ccr@tnsp.org>
parents:
43
diff
changeset
|
2445 && cfg.autoscroll && !is.scroll_lock && e.menubar->pulled_down() < 0) |
33
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
2446 { |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
2447 unsigned distance; // In pixels |
0 | 2448 |
2449 #define actual_move(total,dist) \ | |
80
2f1ecc1c5f72
Huge cleanup -- move some global variables into a struct.
Matti Hamalainen <ccr@tnsp.org>
parents:
43
diff
changeset
|
2450 ((int) (((total * cfg.autoscroll_amp / 100) * ((double) (cfg.autoscroll_edge - dist) / cfg.autoscroll_edge)) / cfg.Scale)) |
0 | 2451 |
33
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
2452 distance = is.y; |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
2453 // The reason for the second member of the condition |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
2454 // is that we don't want to scroll when the user is |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
2455 // simply reaching for a menu... |
80
2f1ecc1c5f72
Huge cleanup -- move some global variables into a struct.
Matti Hamalainen <ccr@tnsp.org>
parents:
43
diff
changeset
|
2456 if (distance <= cfg.autoscroll_edge |
33
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
2457 && e.menubar->is_under_menubar_item(is.x) < 0) |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
2458 { |
80
2f1ecc1c5f72
Huge cleanup -- move some global variables into a struct.
Matti Hamalainen <ccr@tnsp.org>
parents:
43
diff
changeset
|
2459 if (MAPY(cfg.ScrCenterY) < /*MapMaxY */ 20000) |
33
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
2460 { |
80
2f1ecc1c5f72
Huge cleanup -- move some global variables into a struct.
Matti Hamalainen <ccr@tnsp.org>
parents:
43
diff
changeset
|
2461 cfg.OrigY += actual_move(cfg.ScrMaxY, distance); |
33
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
2462 RedrawMap = 1; |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
2463 } |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
2464 } |
0 | 2465 |
80
2f1ecc1c5f72
Huge cleanup -- move some global variables into a struct.
Matti Hamalainen <ccr@tnsp.org>
parents:
43
diff
changeset
|
2466 distance = cfg.ScrMaxY - is.y; |
2f1ecc1c5f72
Huge cleanup -- move some global variables into a struct.
Matti Hamalainen <ccr@tnsp.org>
parents:
43
diff
changeset
|
2467 if (distance <= cfg.autoscroll_edge) |
33
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
2468 { |
80
2f1ecc1c5f72
Huge cleanup -- move some global variables into a struct.
Matti Hamalainen <ccr@tnsp.org>
parents:
43
diff
changeset
|
2469 if (MAPY(cfg.ScrCenterY) > /*MapMinY */ -20000) |
33
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
2470 { |
80
2f1ecc1c5f72
Huge cleanup -- move some global variables into a struct.
Matti Hamalainen <ccr@tnsp.org>
parents:
43
diff
changeset
|
2471 cfg.OrigY -= actual_move(cfg.ScrMaxY, distance); |
33
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
2472 RedrawMap = 1; |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
2473 } |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
2474 } |
0 | 2475 |
33
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
2476 distance = is.x; |
80
2f1ecc1c5f72
Huge cleanup -- move some global variables into a struct.
Matti Hamalainen <ccr@tnsp.org>
parents:
43
diff
changeset
|
2477 if (distance <= cfg.autoscroll_edge) |
33
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
2478 { |
80
2f1ecc1c5f72
Huge cleanup -- move some global variables into a struct.
Matti Hamalainen <ccr@tnsp.org>
parents:
43
diff
changeset
|
2479 if (MAPX(cfg.ScrCenterX) > /*MapMinX */ -20000) |
33
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
2480 { |
80
2f1ecc1c5f72
Huge cleanup -- move some global variables into a struct.
Matti Hamalainen <ccr@tnsp.org>
parents:
43
diff
changeset
|
2481 cfg.OrigX -= actual_move(cfg.ScrMaxX, distance); |
33
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
2482 RedrawMap = 1; |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
2483 } |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
2484 } |
0 | 2485 |
33
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
2486 // The reason for the second member of the condition |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
2487 // is that we don't want to scroll when the user is |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
2488 // simply reaching for the "Help" menu... |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
2489 // Note: the ordinate "3 * FONTH" is of course not |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
2490 // critical. It's just a rough approximation. |
80
2f1ecc1c5f72
Huge cleanup -- move some global variables into a struct.
Matti Hamalainen <ccr@tnsp.org>
parents:
43
diff
changeset
|
2491 distance = cfg.ScrMaxX - is.x; |
2f1ecc1c5f72
Huge cleanup -- move some global variables into a struct.
Matti Hamalainen <ccr@tnsp.org>
parents:
43
diff
changeset
|
2492 if (distance <= cfg.autoscroll_edge && (unsigned) is.y >= 3 * FONTH) |
33
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
2493 { |
80
2f1ecc1c5f72
Huge cleanup -- move some global variables into a struct.
Matti Hamalainen <ccr@tnsp.org>
parents:
43
diff
changeset
|
2494 if (MAPX(cfg.ScrCenterX) < /*MapMaxX */ 20000) |
33
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
2495 { |
80
2f1ecc1c5f72
Huge cleanup -- move some global variables into a struct.
Matti Hamalainen <ccr@tnsp.org>
parents:
43
diff
changeset
|
2496 cfg.OrigX += actual_move(cfg.ScrMaxX, distance); |
33
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
2497 RedrawMap = 1; |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
2498 } |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
2499 } |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
2500 } |
0 | 2501 |
33
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
2502 /* |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
2503 * Step 5 -- Process events that were generated |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
2504 */ |
0 | 2505 |
25
8eaf72e2041b
Reindent the source using GNU indent and "indent -i4 -bli0 -npcs -nprs -npsl".
Matti Hamalainen <ccr@tnsp.org>
parents:
24
diff
changeset
|
2506 done2: |
0 | 2507 |
33
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
2508 // Process events that were generated |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
2509 if (has_event(YE_ZOOM_CHANGED) && !e.grid_step_locked) |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
2510 { |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
2511 get_event(); |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
2512 edit_grid_adapt(&e); |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
2513 RedrawMap = 1; |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
2514 } |
0 | 2515 |
33
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
2516 if (RedrawMap) |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
2517 e.edisplay->need_refresh(); |
25
8eaf72e2041b
Reindent the source using GNU indent and "indent -i4 -bli0 -npcs -nprs -npsl".
Matti Hamalainen <ccr@tnsp.org>
parents:
24
diff
changeset
|
2518 } |
0 | 2519 |
25
8eaf72e2041b
Reindent the source using GNU indent and "indent -i4 -bli0 -npcs -nprs -npsl".
Matti Hamalainen <ccr@tnsp.org>
parents:
24
diff
changeset
|
2520 delete e.edisplay; |
8eaf72e2041b
Reindent the source using GNU indent and "indent -i4 -bli0 -npcs -nprs -npsl".
Matti Hamalainen <ccr@tnsp.org>
parents:
24
diff
changeset
|
2521 delete e.selbox; |
8eaf72e2041b
Reindent the source using GNU indent and "indent -i4 -bli0 -npcs -nprs -npsl".
Matti Hamalainen <ccr@tnsp.org>
parents:
24
diff
changeset
|
2522 delete e.menubar; |
8eaf72e2041b
Reindent the source using GNU indent and "indent -i4 -bli0 -npcs -nprs -npsl".
Matti Hamalainen <ccr@tnsp.org>
parents:
24
diff
changeset
|
2523 for (size_t n = 0; n < MBM_HELP; n++) |
33
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
2524 delete e.mb_menu[n]; |
0 | 2525 |
25
8eaf72e2041b
Reindent the source using GNU indent and "indent -i4 -bli0 -npcs -nprs -npsl".
Matti Hamalainen <ccr@tnsp.org>
parents:
24
diff
changeset
|
2526 delete menu_linedef_flags; |
8eaf72e2041b
Reindent the source using GNU indent and "indent -i4 -bli0 -npcs -nprs -npsl".
Matti Hamalainen <ccr@tnsp.org>
parents:
24
diff
changeset
|
2527 delete menu_thing_flags; |
0 | 2528 } |
2529 | |
2530 | |
2531 /* | |
33
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
2532 * zoom_fit - adjust zoom factor to make level fit in window |
0 | 2533 * |
33
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
2534 * Return 0 on success, non-zero on failure. |
0 | 2535 */ |
25
8eaf72e2041b
Reindent the source using GNU indent and "indent -i4 -bli0 -npcs -nprs -npsl".
Matti Hamalainen <ccr@tnsp.org>
parents:
24
diff
changeset
|
2536 static int zoom_fit(edit_t & e) |
0 | 2537 { |
25
8eaf72e2041b
Reindent the source using GNU indent and "indent -i4 -bli0 -npcs -nprs -npsl".
Matti Hamalainen <ccr@tnsp.org>
parents:
24
diff
changeset
|
2538 // Empty level, 100% will be fine. |
8eaf72e2041b
Reindent the source using GNU indent and "indent -i4 -bli0 -npcs -nprs -npsl".
Matti Hamalainen <ccr@tnsp.org>
parents:
24
diff
changeset
|
2539 if (NumVertices == 0) |
33
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
2540 return edit_set_zoom(&e, 1.0); |
25
8eaf72e2041b
Reindent the source using GNU indent and "indent -i4 -bli0 -npcs -nprs -npsl".
Matti Hamalainen <ccr@tnsp.org>
parents:
24
diff
changeset
|
2541 |
8eaf72e2041b
Reindent the source using GNU indent and "indent -i4 -bli0 -npcs -nprs -npsl".
Matti Hamalainen <ccr@tnsp.org>
parents:
24
diff
changeset
|
2542 update_level_bounds(); |
8eaf72e2041b
Reindent the source using GNU indent and "indent -i4 -bli0 -npcs -nprs -npsl".
Matti Hamalainen <ccr@tnsp.org>
parents:
24
diff
changeset
|
2543 |
8eaf72e2041b
Reindent the source using GNU indent and "indent -i4 -bli0 -npcs -nprs -npsl".
Matti Hamalainen <ccr@tnsp.org>
parents:
24
diff
changeset
|
2544 int MapSizeX = MapMaxX - MapMinX, |
8eaf72e2041b
Reindent the source using GNU indent and "indent -i4 -bli0 -npcs -nprs -npsl".
Matti Hamalainen <ccr@tnsp.org>
parents:
24
diff
changeset
|
2545 MapSizeY = MapMaxY - MapMinY; |
0 | 2546 |
80
2f1ecc1c5f72
Huge cleanup -- move some global variables into a struct.
Matti Hamalainen <ccr@tnsp.org>
parents:
43
diff
changeset
|
2547 double xzoom = MapSizeX ? (0.95f * cfg.ScrMaxX / (double) MapSizeX) : 1, |
2f1ecc1c5f72
Huge cleanup -- move some global variables into a struct.
Matti Hamalainen <ccr@tnsp.org>
parents:
43
diff
changeset
|
2548 yzoom = MapSizeY ? (0.9f * cfg.ScrMaxY / (double) MapSizeY) : 1; |
25
8eaf72e2041b
Reindent the source using GNU indent and "indent -i4 -bli0 -npcs -nprs -npsl".
Matti Hamalainen <ccr@tnsp.org>
parents:
24
diff
changeset
|
2549 |
8eaf72e2041b
Reindent the source using GNU indent and "indent -i4 -bli0 -npcs -nprs -npsl".
Matti Hamalainen <ccr@tnsp.org>
parents:
24
diff
changeset
|
2550 int r = edit_set_zoom(&e, y_min(xzoom, yzoom)); |
8eaf72e2041b
Reindent the source using GNU indent and "indent -i4 -bli0 -npcs -nprs -npsl".
Matti Hamalainen <ccr@tnsp.org>
parents:
24
diff
changeset
|
2551 if (r != 0) |
33
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
2552 return 1; |
25
8eaf72e2041b
Reindent the source using GNU indent and "indent -i4 -bli0 -npcs -nprs -npsl".
Matti Hamalainen <ccr@tnsp.org>
parents:
24
diff
changeset
|
2553 |
8eaf72e2041b
Reindent the source using GNU indent and "indent -i4 -bli0 -npcs -nprs -npsl".
Matti Hamalainen <ccr@tnsp.org>
parents:
24
diff
changeset
|
2554 CenterMapAroundCoords((MapMinX + MapMaxX) / 2, (MapMinY + MapMaxY) / 2); |
8eaf72e2041b
Reindent the source using GNU indent and "indent -i4 -bli0 -npcs -nprs -npsl".
Matti Hamalainen <ccr@tnsp.org>
parents:
24
diff
changeset
|
2555 return 0; |
0 | 2556 } |