annotate src/editobj.cc @ 104:76ad709ed3c6

Cleanups.
author Matti Hamalainen <ccr@tnsp.org>
date Mon, 06 Oct 2014 05:04:24 +0300
parents 002bc70a3982
children 20aa5a515896
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
241c93442be0 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
1 /*
33
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
2 * editobj.cc
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
3 * Object editing routines.
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
241c93442be0 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
5 */
241c93442be0 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
6
241c93442be0 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
7
241c93442be0 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
8 /*
241c93442be0 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
9 This file is part of Yadex.
241c93442be0 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
10
241c93442be0 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
11 Yadex incorporates code from DEU 5.21 that was put in the public domain in
241c93442be0 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
12 1994 by Raphaël Quinet and Brendon Wyber.
241c93442be0 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
13
241c93442be0 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
14 The rest of Yadex is Copyright © 1997-2003 André Majorel and others.
241c93442be0 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
15
241c93442be0 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
16 This program is free software; you can redistribute it and/or modify it under
241c93442be0 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
17 the terms of the GNU General Public License as published by the Free Software
241c93442be0 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
18 Foundation; either version 2 of the License, or (at your option) any later
241c93442be0 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
19 version.
241c93442be0 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
20
241c93442be0 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
21 This program is distributed in the hope that it will be useful, but WITHOUT
241c93442be0 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
22 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
241c93442be0 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
23 FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
241c93442be0 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
24
241c93442be0 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
25 You should have received a copy of the GNU General Public License along with
241c93442be0 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
26 this program; if not, write to the Free Software Foundation, Inc., 59 Temple
241c93442be0 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
27 Place, Suite 330, Boston, MA 02111-1307, USA.
241c93442be0 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
28 */
241c93442be0 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
29
241c93442be0 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
30
241c93442be0 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
31 #include "yadex.h"
241c93442be0 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
32 #include "_edit.h"
241c93442be0 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
33 #include "dialog.h"
241c93442be0 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
34 #include "editobj.h"
241c93442be0 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
35 #include "entry.h"
241c93442be0 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
36 #include "flats.h"
241c93442be0 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
37 #include "game.h"
241c93442be0 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
38 #include "gfx.h"
241c93442be0 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
39 #include "levels.h"
241c93442be0 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
40 #include "objects.h"
241c93442be0 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
41 #include "objid.h"
241c93442be0 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
42 #include "oldmenus.h"
241c93442be0 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
43 #include "s_slice.h"
241c93442be0 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
44 #include "s_swapf.h"
241c93442be0 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
45 #include "selectn.h"
241c93442be0 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
46 #include "t_spin.h"
241c93442be0 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
47 #include "x_mirror.h"
241c93442be0 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
48 #include "x_rotate.h"
241c93442be0 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
49
241c93442be0 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
50
241c93442be0 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
51 /*
241c93442be0 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
52 ask for an object number and check for maximum valid number
241c93442be0 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
53 (this is just like InputIntegerValue, but with a different prompt)
241c93442be0 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
54 */
241c93442be0 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
55
25
8eaf72e2041b Reindent the source using GNU indent and "indent -i4 -bli0 -npcs -nprs -npsl".
Matti Hamalainen <ccr@tnsp.org>
parents: 22
diff changeset
56 int InputObjectNumber(int x0, int y0, int objtype, int curobj)
0
241c93442be0 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
57 {
25
8eaf72e2041b Reindent the source using GNU indent and "indent -i4 -bli0 -npcs -nprs -npsl".
Matti Hamalainen <ccr@tnsp.org>
parents: 22
diff changeset
58 int val, key;
8eaf72e2041b Reindent the source using GNU indent and "indent -i4 -bli0 -npcs -nprs -npsl".
Matti Hamalainen <ccr@tnsp.org>
parents: 22
diff changeset
59 char prompt[80];
0
241c93442be0 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
60
25
8eaf72e2041b Reindent the source using GNU indent and "indent -i4 -bli0 -npcs -nprs -npsl".
Matti Hamalainen <ccr@tnsp.org>
parents: 22
diff changeset
61 sprintf(prompt, "Enter a %s number between 0 and %d:",
33
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
62 GetObjectTypeName(objtype), GetMaxObjectNum(objtype));
25
8eaf72e2041b Reindent the source using GNU indent and "indent -i4 -bli0 -npcs -nprs -npsl".
Matti Hamalainen <ccr@tnsp.org>
parents: 22
diff changeset
63 if (x0 < 0)
80
2f1ecc1c5f72 Huge cleanup -- move some global variables into a struct.
Matti Hamalainen <ccr@tnsp.org>
parents: 66
diff changeset
64 x0 = (cfg.ScrMaxX - 25 - 8 * strlen(prompt)) / 2;
25
8eaf72e2041b Reindent the source using GNU indent and "indent -i4 -bli0 -npcs -nprs -npsl".
Matti Hamalainen <ccr@tnsp.org>
parents: 22
diff changeset
65 if (y0 < 0)
80
2f1ecc1c5f72 Huge cleanup -- move some global variables into a struct.
Matti Hamalainen <ccr@tnsp.org>
parents: 66
diff changeset
66 y0 = (cfg.ScrMaxY - 55) / 2;
25
8eaf72e2041b Reindent the source using GNU indent and "indent -i4 -bli0 -npcs -nprs -npsl".
Matti Hamalainen <ccr@tnsp.org>
parents: 22
diff changeset
67 DrawScreenBox3D(x0, y0, x0 + 25 + 8 * strlen(prompt), y0 + 55);
8eaf72e2041b Reindent the source using GNU indent and "indent -i4 -bli0 -npcs -nprs -npsl".
Matti Hamalainen <ccr@tnsp.org>
parents: 22
diff changeset
68 set_colour(WHITE);
8eaf72e2041b Reindent the source using GNU indent and "indent -i4 -bli0 -npcs -nprs -npsl".
Matti Hamalainen <ccr@tnsp.org>
parents: 22
diff changeset
69 DrawScreenText(x0 + 10, y0 + 8, prompt);
8eaf72e2041b Reindent the source using GNU indent and "indent -i4 -bli0 -npcs -nprs -npsl".
Matti Hamalainen <ccr@tnsp.org>
parents: 22
diff changeset
70 val = curobj;
8eaf72e2041b Reindent the source using GNU indent and "indent -i4 -bli0 -npcs -nprs -npsl".
Matti Hamalainen <ccr@tnsp.org>
parents: 22
diff changeset
71 while ((key
33
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
72 =
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
73 InputInteger(x0 + 10, y0 + 28, &val, 0,
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
74 GetMaxObjectNum(objtype))) != YK_RETURN
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
75 && key != YK_ESC)
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
76 Beep();
25
8eaf72e2041b Reindent the source using GNU indent and "indent -i4 -bli0 -npcs -nprs -npsl".
Matti Hamalainen <ccr@tnsp.org>
parents: 22
diff changeset
77 return val;
0
241c93442be0 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
78 }
241c93442be0 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
79
241c93442be0 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
80
241c93442be0 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
81 /*
33
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
82 * input_objid - ask for an object number of the specified type
0
241c93442be0 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
83 *
33
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
84 * If the user hit [Return], set objid.type to init.type
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
85 * and objid.num to whatever number the user entered. If
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
86 * the user hit [Esc], call nil() on objid.
0
241c93442be0 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
87 */
25
8eaf72e2041b Reindent the source using GNU indent and "indent -i4 -bli0 -npcs -nprs -npsl".
Matti Hamalainen <ccr@tnsp.org>
parents: 22
diff changeset
88 void input_objid(Objid & objid, const Objid & init, int x0, int y0)
0
241c93442be0 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
89 {
25
8eaf72e2041b Reindent the source using GNU indent and "indent -i4 -bli0 -npcs -nprs -npsl".
Matti Hamalainen <ccr@tnsp.org>
parents: 22
diff changeset
90 char prompt[80];
0
241c93442be0 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
91
25
8eaf72e2041b Reindent the source using GNU indent and "indent -i4 -bli0 -npcs -nprs -npsl".
Matti Hamalainen <ccr@tnsp.org>
parents: 22
diff changeset
92 sprintf(prompt, "Enter a %s number between 0 and %d:",
33
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
93 GetObjectTypeName(init.type), GetMaxObjectNum(init.type));
25
8eaf72e2041b Reindent the source using GNU indent and "indent -i4 -bli0 -npcs -nprs -npsl".
Matti Hamalainen <ccr@tnsp.org>
parents: 22
diff changeset
94 if (x0 < 0)
80
2f1ecc1c5f72 Huge cleanup -- move some global variables into a struct.
Matti Hamalainen <ccr@tnsp.org>
parents: 66
diff changeset
95 x0 = (cfg.ScrMaxX - 25 - 8 * strlen(prompt)) / 2;
25
8eaf72e2041b Reindent the source using GNU indent and "indent -i4 -bli0 -npcs -nprs -npsl".
Matti Hamalainen <ccr@tnsp.org>
parents: 22
diff changeset
96 if (y0 < 0)
80
2f1ecc1c5f72 Huge cleanup -- move some global variables into a struct.
Matti Hamalainen <ccr@tnsp.org>
parents: 66
diff changeset
97 y0 = (cfg.ScrMaxY - 55) / 2;
25
8eaf72e2041b Reindent the source using GNU indent and "indent -i4 -bli0 -npcs -nprs -npsl".
Matti Hamalainen <ccr@tnsp.org>
parents: 22
diff changeset
98 DrawScreenBox3D(x0, y0, x0 + 25 + 8 * strlen(prompt), y0 + 55);
8eaf72e2041b Reindent the source using GNU indent and "indent -i4 -bli0 -npcs -nprs -npsl".
Matti Hamalainen <ccr@tnsp.org>
parents: 22
diff changeset
99 set_colour(WHITE);
8eaf72e2041b Reindent the source using GNU indent and "indent -i4 -bli0 -npcs -nprs -npsl".
Matti Hamalainen <ccr@tnsp.org>
parents: 22
diff changeset
100 DrawScreenText(x0 + 10, y0 + 8, prompt);
8eaf72e2041b Reindent the source using GNU indent and "indent -i4 -bli0 -npcs -nprs -npsl".
Matti Hamalainen <ccr@tnsp.org>
parents: 22
diff changeset
101 int num = init.num;
8eaf72e2041b Reindent the source using GNU indent and "indent -i4 -bli0 -npcs -nprs -npsl".
Matti Hamalainen <ccr@tnsp.org>
parents: 22
diff changeset
102 int key;
8eaf72e2041b Reindent the source using GNU indent and "indent -i4 -bli0 -npcs -nprs -npsl".
Matti Hamalainen <ccr@tnsp.org>
parents: 22
diff changeset
103 while ((key
33
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
104 =
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
105 InputInteger(x0 + 10, y0 + 28, &num, 0,
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
106 GetMaxObjectNum(init.type))) != YK_RETURN
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
107 && key != YK_ESC)
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
108 Beep();
25
8eaf72e2041b Reindent the source using GNU indent and "indent -i4 -bli0 -npcs -nprs -npsl".
Matti Hamalainen <ccr@tnsp.org>
parents: 22
diff changeset
109 if (key == YK_ESC)
33
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
110 objid.nil();
25
8eaf72e2041b Reindent the source using GNU indent and "indent -i4 -bli0 -npcs -nprs -npsl".
Matti Hamalainen <ccr@tnsp.org>
parents: 22
diff changeset
111 else if (key == YK_RETURN)
8eaf72e2041b Reindent the source using GNU indent and "indent -i4 -bli0 -npcs -nprs -npsl".
Matti Hamalainen <ccr@tnsp.org>
parents: 22
diff changeset
112 {
33
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
113 objid.type = init.type;
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
114 objid.num = num;
25
8eaf72e2041b Reindent the source using GNU indent and "indent -i4 -bli0 -npcs -nprs -npsl".
Matti Hamalainen <ccr@tnsp.org>
parents: 22
diff changeset
115 }
8eaf72e2041b Reindent the source using GNU indent and "indent -i4 -bli0 -npcs -nprs -npsl".
Matti Hamalainen <ccr@tnsp.org>
parents: 22
diff changeset
116 else
8eaf72e2041b Reindent the source using GNU indent and "indent -i4 -bli0 -npcs -nprs -npsl".
Matti Hamalainen <ccr@tnsp.org>
parents: 22
diff changeset
117 {
33
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
118 nf_bug("input_objid: bad key %d", (int) key); // Can't happen
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
119 objid.nil();
25
8eaf72e2041b Reindent the source using GNU indent and "indent -i4 -bli0 -npcs -nprs -npsl".
Matti Hamalainen <ccr@tnsp.org>
parents: 22
diff changeset
120 }
0
241c93442be0 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
121 }
241c93442be0 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
122
241c93442be0 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
123
241c93442be0 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
124 /*
241c93442be0 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
125 ask for an object number and display a warning message
241c93442be0 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
126 */
241c93442be0 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
127
25
8eaf72e2041b Reindent the source using GNU indent and "indent -i4 -bli0 -npcs -nprs -npsl".
Matti Hamalainen <ccr@tnsp.org>
parents: 22
diff changeset
128 int InputObjectXRef(int x0, int y0, int objtype, bool allownone, int curobj)
0
241c93442be0 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
129 {
25
8eaf72e2041b Reindent the source using GNU indent and "indent -i4 -bli0 -npcs -nprs -npsl".
Matti Hamalainen <ccr@tnsp.org>
parents: 22
diff changeset
130 const char *const msg1 = "Warning: modifying the cross-references";
8eaf72e2041b Reindent the source using GNU indent and "indent -i4 -bli0 -npcs -nprs -npsl".
Matti Hamalainen <ccr@tnsp.org>
parents: 22
diff changeset
131 const char *const msg2 = "between some objects may crash the game.";
8eaf72e2041b Reindent the source using GNU indent and "indent -i4 -bli0 -npcs -nprs -npsl".
Matti Hamalainen <ccr@tnsp.org>
parents: 22
diff changeset
132 char prompt[80];
8eaf72e2041b Reindent the source using GNU indent and "indent -i4 -bli0 -npcs -nprs -npsl".
Matti Hamalainen <ccr@tnsp.org>
parents: 22
diff changeset
133 size_t maxlen = 0;
8eaf72e2041b Reindent the source using GNU indent and "indent -i4 -bli0 -npcs -nprs -npsl".
Matti Hamalainen <ccr@tnsp.org>
parents: 22
diff changeset
134 int width;
8eaf72e2041b Reindent the source using GNU indent and "indent -i4 -bli0 -npcs -nprs -npsl".
Matti Hamalainen <ccr@tnsp.org>
parents: 22
diff changeset
135 int height;
0
241c93442be0 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
136
241c93442be0 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
137 // Dimensions
25
8eaf72e2041b Reindent the source using GNU indent and "indent -i4 -bli0 -npcs -nprs -npsl".
Matti Hamalainen <ccr@tnsp.org>
parents: 22
diff changeset
138 sprintf(prompt, "Enter a %s number between 0 and %d%c",
33
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
139 GetObjectTypeName(objtype),
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
140 GetMaxObjectNum(objtype), allownone ? ',' : ':');
65
2537585c2b93 Fix a possible typo in the code.
Matti Hamalainen <ccr@tnsp.org>
parents: 33
diff changeset
141
33
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
142 maxlen = 40; // Why 40 ? -- AYM 2002-04-17
65
2537585c2b93 Fix a possible typo in the code.
Matti Hamalainen <ccr@tnsp.org>
parents: 33
diff changeset
143
2537585c2b93 Fix a possible typo in the code.
Matti Hamalainen <ccr@tnsp.org>
parents: 33
diff changeset
144 if (strlen(prompt) > maxlen)
2537585c2b93 Fix a possible typo in the code.
Matti Hamalainen <ccr@tnsp.org>
parents: 33
diff changeset
145 maxlen = strlen(prompt);
25
8eaf72e2041b Reindent the source using GNU indent and "indent -i4 -bli0 -npcs -nprs -npsl".
Matti Hamalainen <ccr@tnsp.org>
parents: 22
diff changeset
146 if (strlen(msg1) > maxlen)
33
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
147 maxlen = strlen(msg1);
25
8eaf72e2041b Reindent the source using GNU indent and "indent -i4 -bli0 -npcs -nprs -npsl".
Matti Hamalainen <ccr@tnsp.org>
parents: 22
diff changeset
148 if (strlen(msg2) > maxlen)
33
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
149 maxlen = strlen(msg2);
65
2537585c2b93 Fix a possible typo in the code.
Matti Hamalainen <ccr@tnsp.org>
parents: 33
diff changeset
150
25
8eaf72e2041b Reindent the source using GNU indent and "indent -i4 -bli0 -npcs -nprs -npsl".
Matti Hamalainen <ccr@tnsp.org>
parents: 22
diff changeset
151 int ya = 0 + BOX_BORDER + WIDE_VSPACING;
8eaf72e2041b Reindent the source using GNU indent and "indent -i4 -bli0 -npcs -nprs -npsl".
Matti Hamalainen <ccr@tnsp.org>
parents: 22
diff changeset
152 int yb = ya;
8eaf72e2041b Reindent the source using GNU indent and "indent -i4 -bli0 -npcs -nprs -npsl".
Matti Hamalainen <ccr@tnsp.org>
parents: 22
diff changeset
153 if (allownone)
33
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
154 yb += FONTH;
25
8eaf72e2041b Reindent the source using GNU indent and "indent -i4 -bli0 -npcs -nprs -npsl".
Matti Hamalainen <ccr@tnsp.org>
parents: 22
diff changeset
155 int yc = yb + FONTH + WIDE_VSPACING;
0
241c93442be0 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
156 // FIXME should query InputInteger() instead
25
8eaf72e2041b Reindent the source using GNU indent and "indent -i4 -bli0 -npcs -nprs -npsl".
Matti Hamalainen <ccr@tnsp.org>
parents: 22
diff changeset
157 int yd =
33
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
158 yc + 2 * HOLLOW_BORDER + 2 * NARROW_VSPACING + FONTH + WIDE_VSPACING;
25
8eaf72e2041b Reindent the source using GNU indent and "indent -i4 -bli0 -npcs -nprs -npsl".
Matti Hamalainen <ccr@tnsp.org>
parents: 22
diff changeset
159 int ye = yd + FONTH;
8eaf72e2041b Reindent the source using GNU indent and "indent -i4 -bli0 -npcs -nprs -npsl".
Matti Hamalainen <ccr@tnsp.org>
parents: 22
diff changeset
160 int yf = ye + FONTH + WIDE_VSPACING + BOX_BORDER;
8eaf72e2041b Reindent the source using GNU indent and "indent -i4 -bli0 -npcs -nprs -npsl".
Matti Hamalainen <ccr@tnsp.org>
parents: 22
diff changeset
161 width = 2 * BOX_BORDER + 2 * WIDE_HSPACING + maxlen * FONTW;
8eaf72e2041b Reindent the source using GNU indent and "indent -i4 -bli0 -npcs -nprs -npsl".
Matti Hamalainen <ccr@tnsp.org>
parents: 22
diff changeset
162 height = yf - 0;
0
241c93442be0 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
163
241c93442be0 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
164 // Position
25
8eaf72e2041b Reindent the source using GNU indent and "indent -i4 -bli0 -npcs -nprs -npsl".
Matti Hamalainen <ccr@tnsp.org>
parents: 22
diff changeset
165 if (x0 < 0)
80
2f1ecc1c5f72 Huge cleanup -- move some global variables into a struct.
Matti Hamalainen <ccr@tnsp.org>
parents: 66
diff changeset
166 x0 = (cfg.ScrMaxX - width) / 2;
25
8eaf72e2041b Reindent the source using GNU indent and "indent -i4 -bli0 -npcs -nprs -npsl".
Matti Hamalainen <ccr@tnsp.org>
parents: 22
diff changeset
167 if (y0 < 0)
80
2f1ecc1c5f72 Huge cleanup -- move some global variables into a struct.
Matti Hamalainen <ccr@tnsp.org>
parents: 66
diff changeset
168 y0 = (cfg.ScrMaxY - height) / 2;
0
241c93442be0 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
169
25
8eaf72e2041b Reindent the source using GNU indent and "indent -i4 -bli0 -npcs -nprs -npsl".
Matti Hamalainen <ccr@tnsp.org>
parents: 22
diff changeset
170 DrawScreenBox3D(x0, y0, x0 + width, y0 + height);
8eaf72e2041b Reindent the source using GNU indent and "indent -i4 -bli0 -npcs -nprs -npsl".
Matti Hamalainen <ccr@tnsp.org>
parents: 22
diff changeset
171 set_colour(WHITE);
8eaf72e2041b Reindent the source using GNU indent and "indent -i4 -bli0 -npcs -nprs -npsl".
Matti Hamalainen <ccr@tnsp.org>
parents: 22
diff changeset
172 int x = x0 + BOX_BORDER + WIDE_HSPACING;
8eaf72e2041b Reindent the source using GNU indent and "indent -i4 -bli0 -npcs -nprs -npsl".
Matti Hamalainen <ccr@tnsp.org>
parents: 22
diff changeset
173 DrawScreenText(x, y0 + ya, prompt);
8eaf72e2041b Reindent the source using GNU indent and "indent -i4 -bli0 -npcs -nprs -npsl".
Matti Hamalainen <ccr@tnsp.org>
parents: 22
diff changeset
174 if (allownone)
33
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
175 DrawScreenText(x, y0 + yb, "or -1 for none:");
25
8eaf72e2041b Reindent the source using GNU indent and "indent -i4 -bli0 -npcs -nprs -npsl".
Matti Hamalainen <ccr@tnsp.org>
parents: 22
diff changeset
176 set_colour(LIGHTRED);
8eaf72e2041b Reindent the source using GNU indent and "indent -i4 -bli0 -npcs -nprs -npsl".
Matti Hamalainen <ccr@tnsp.org>
parents: 22
diff changeset
177 DrawScreenText(x, y0 + yd, msg1);
8eaf72e2041b Reindent the source using GNU indent and "indent -i4 -bli0 -npcs -nprs -npsl".
Matti Hamalainen <ccr@tnsp.org>
parents: 22
diff changeset
178 DrawScreenText(x, y0 + ye, msg2);
0
241c93442be0 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
179
25
8eaf72e2041b Reindent the source using GNU indent and "indent -i4 -bli0 -npcs -nprs -npsl".
Matti Hamalainen <ccr@tnsp.org>
parents: 22
diff changeset
180 int val = curobj;
8eaf72e2041b Reindent the source using GNU indent and "indent -i4 -bli0 -npcs -nprs -npsl".
Matti Hamalainen <ccr@tnsp.org>
parents: 22
diff changeset
181 int key;
8eaf72e2041b Reindent the source using GNU indent and "indent -i4 -bli0 -npcs -nprs -npsl".
Matti Hamalainen <ccr@tnsp.org>
parents: 22
diff changeset
182 int min = allownone ? -1 : 0;
8eaf72e2041b Reindent the source using GNU indent and "indent -i4 -bli0 -npcs -nprs -npsl".
Matti Hamalainen <ccr@tnsp.org>
parents: 22
diff changeset
183 int max = GetMaxObjectNum(objtype);
8eaf72e2041b Reindent the source using GNU indent and "indent -i4 -bli0 -npcs -nprs -npsl".
Matti Hamalainen <ccr@tnsp.org>
parents: 22
diff changeset
184 while (key = InputInteger(x, y0 + yc, &val, min, max),
33
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
185 key != YK_RETURN && key != YK_ESC)
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
186 Beep();
25
8eaf72e2041b Reindent the source using GNU indent and "indent -i4 -bli0 -npcs -nprs -npsl".
Matti Hamalainen <ccr@tnsp.org>
parents: 22
diff changeset
187 return val;
0
241c93442be0 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
188 }
241c93442be0 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
189
241c93442be0 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
190
241c93442be0 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
191
241c93442be0 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
192 /*
241c93442be0 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
193 ask for two vertex numbers and check for maximum valid number
241c93442be0 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
194 */
241c93442be0 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
195
25
8eaf72e2041b Reindent the source using GNU indent and "indent -i4 -bli0 -npcs -nprs -npsl".
Matti Hamalainen <ccr@tnsp.org>
parents: 22
diff changeset
196 bool Input2VertexNumbers(int x0, int y0, const char *prompt1, int *v1,
33
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
197 int *v2)
0
241c93442be0 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
198 {
25
8eaf72e2041b Reindent the source using GNU indent and "indent -i4 -bli0 -npcs -nprs -npsl".
Matti Hamalainen <ccr@tnsp.org>
parents: 22
diff changeset
199 int key;
8eaf72e2041b Reindent the source using GNU indent and "indent -i4 -bli0 -npcs -nprs -npsl".
Matti Hamalainen <ccr@tnsp.org>
parents: 22
diff changeset
200 int maxlen, first;
8eaf72e2041b Reindent the source using GNU indent and "indent -i4 -bli0 -npcs -nprs -npsl".
Matti Hamalainen <ccr@tnsp.org>
parents: 22
diff changeset
201 char prompt2[80];
8eaf72e2041b Reindent the source using GNU indent and "indent -i4 -bli0 -npcs -nprs -npsl".
Matti Hamalainen <ccr@tnsp.org>
parents: 22
diff changeset
202 int text_x0;
8eaf72e2041b Reindent the source using GNU indent and "indent -i4 -bli0 -npcs -nprs -npsl".
Matti Hamalainen <ccr@tnsp.org>
parents: 22
diff changeset
203 int text_y0;
8eaf72e2041b Reindent the source using GNU indent and "indent -i4 -bli0 -npcs -nprs -npsl".
Matti Hamalainen <ccr@tnsp.org>
parents: 22
diff changeset
204 int entry1_x0;
8eaf72e2041b Reindent the source using GNU indent and "indent -i4 -bli0 -npcs -nprs -npsl".
Matti Hamalainen <ccr@tnsp.org>
parents: 22
diff changeset
205 int entry1_y0;
8eaf72e2041b Reindent the source using GNU indent and "indent -i4 -bli0 -npcs -nprs -npsl".
Matti Hamalainen <ccr@tnsp.org>
parents: 22
diff changeset
206 int entry2_x0;
8eaf72e2041b Reindent the source using GNU indent and "indent -i4 -bli0 -npcs -nprs -npsl".
Matti Hamalainen <ccr@tnsp.org>
parents: 22
diff changeset
207 int entry2_y0;
0
241c93442be0 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
208 // FIXME should let InputInteger() tell us
25
8eaf72e2041b Reindent the source using GNU indent and "indent -i4 -bli0 -npcs -nprs -npsl".
Matti Hamalainen <ccr@tnsp.org>
parents: 22
diff changeset
209 const int entry_width =
33
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
210 2 * HOLLOW_BORDER + 2 * NARROW_HSPACING + 7 * FONTW;
25
8eaf72e2041b Reindent the source using GNU indent and "indent -i4 -bli0 -npcs -nprs -npsl".
Matti Hamalainen <ccr@tnsp.org>
parents: 22
diff changeset
211 const int entry_height = 2 * HOLLOW_BORDER + 2 * NARROW_VSPACING + FONTH;
0
241c93442be0 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
212
25
8eaf72e2041b Reindent the source using GNU indent and "indent -i4 -bli0 -npcs -nprs -npsl".
Matti Hamalainen <ccr@tnsp.org>
parents: 22
diff changeset
213 sprintf(prompt2, "Enter two numbers between 0 and %d:", NumVertices - 1);
0
241c93442be0 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
214
25
8eaf72e2041b Reindent the source using GNU indent and "indent -i4 -bli0 -npcs -nprs -npsl".
Matti Hamalainen <ccr@tnsp.org>
parents: 22
diff changeset
215 if (strlen(prompt1) > strlen(prompt2))
33
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
216 maxlen = strlen(prompt1);
25
8eaf72e2041b Reindent the source using GNU indent and "indent -i4 -bli0 -npcs -nprs -npsl".
Matti Hamalainen <ccr@tnsp.org>
parents: 22
diff changeset
217 else
33
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
218 maxlen = strlen(prompt2);
25
8eaf72e2041b Reindent the source using GNU indent and "indent -i4 -bli0 -npcs -nprs -npsl".
Matti Hamalainen <ccr@tnsp.org>
parents: 22
diff changeset
219 if (x0 < 0)
80
2f1ecc1c5f72 Huge cleanup -- move some global variables into a struct.
Matti Hamalainen <ccr@tnsp.org>
parents: 66
diff changeset
220 x0 = (cfg.ScrMaxX - 25 - 8 * maxlen) / 2;
25
8eaf72e2041b Reindent the source using GNU indent and "indent -i4 -bli0 -npcs -nprs -npsl".
Matti Hamalainen <ccr@tnsp.org>
parents: 22
diff changeset
221 if (y0 < 0)
80
2f1ecc1c5f72 Huge cleanup -- move some global variables into a struct.
Matti Hamalainen <ccr@tnsp.org>
parents: 66
diff changeset
222 y0 = (cfg.ScrMaxY - 75) / 2;
25
8eaf72e2041b Reindent the source using GNU indent and "indent -i4 -bli0 -npcs -nprs -npsl".
Matti Hamalainen <ccr@tnsp.org>
parents: 22
diff changeset
223 text_x0 = x0 + BOX_BORDER + WIDE_HSPACING;
8eaf72e2041b Reindent the source using GNU indent and "indent -i4 -bli0 -npcs -nprs -npsl".
Matti Hamalainen <ccr@tnsp.org>
parents: 22
diff changeset
224 text_y0 = y0 + BOX_BORDER + WIDE_VSPACING;
8eaf72e2041b Reindent the source using GNU indent and "indent -i4 -bli0 -npcs -nprs -npsl".
Matti Hamalainen <ccr@tnsp.org>
parents: 22
diff changeset
225 entry1_x0 = text_x0 + 13 * FONTW;
8eaf72e2041b Reindent the source using GNU indent and "indent -i4 -bli0 -npcs -nprs -npsl".
Matti Hamalainen <ccr@tnsp.org>
parents: 22
diff changeset
226 entry1_y0 = text_y0 + 3 * FONTH - HOLLOW_BORDER - NARROW_VSPACING;
8eaf72e2041b Reindent the source using GNU indent and "indent -i4 -bli0 -npcs -nprs -npsl".
Matti Hamalainen <ccr@tnsp.org>
parents: 22
diff changeset
227 entry2_x0 = entry1_x0;
8eaf72e2041b Reindent the source using GNU indent and "indent -i4 -bli0 -npcs -nprs -npsl".
Matti Hamalainen <ccr@tnsp.org>
parents: 22
diff changeset
228 entry2_y0 = text_y0 + 5 * FONTH - HOLLOW_BORDER - NARROW_VSPACING;
0
241c93442be0 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
229
25
8eaf72e2041b Reindent the source using GNU indent and "indent -i4 -bli0 -npcs -nprs -npsl".
Matti Hamalainen <ccr@tnsp.org>
parents: 22
diff changeset
230 DrawScreenBox3D(x0, y0,
33
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
231 x0 + 2 * BOX_BORDER + 2 * WIDE_HSPACING
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
232 + y_max(entry_width + 13 * FONTW, maxlen * FONTW) - 1,
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
233 y0 + 2 * BOX_BORDER + 2 * WIDE_VSPACING + 6 * FONTH - 1);
25
8eaf72e2041b Reindent the source using GNU indent and "indent -i4 -bli0 -npcs -nprs -npsl".
Matti Hamalainen <ccr@tnsp.org>
parents: 22
diff changeset
234 set_colour(WHITE);
8eaf72e2041b Reindent the source using GNU indent and "indent -i4 -bli0 -npcs -nprs -npsl".
Matti Hamalainen <ccr@tnsp.org>
parents: 22
diff changeset
235 DrawScreenText(text_x0, text_y0, prompt1);
8eaf72e2041b Reindent the source using GNU indent and "indent -i4 -bli0 -npcs -nprs -npsl".
Matti Hamalainen <ccr@tnsp.org>
parents: 22
diff changeset
236 set_colour(WINFG);
8eaf72e2041b Reindent the source using GNU indent and "indent -i4 -bli0 -npcs -nprs -npsl".
Matti Hamalainen <ccr@tnsp.org>
parents: 22
diff changeset
237 DrawScreenText(text_x0, text_y0 + FONTH, prompt2);
8eaf72e2041b Reindent the source using GNU indent and "indent -i4 -bli0 -npcs -nprs -npsl".
Matti Hamalainen <ccr@tnsp.org>
parents: 22
diff changeset
238 DrawScreenText(text_x0, text_y0 + 3 * FONTH, "Start vertex");
8eaf72e2041b Reindent the source using GNU indent and "indent -i4 -bli0 -npcs -nprs -npsl".
Matti Hamalainen <ccr@tnsp.org>
parents: 22
diff changeset
239 DrawScreenText(text_x0, text_y0 + 5 * FONTH, "End vertex");
0
241c93442be0 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
240
25
8eaf72e2041b Reindent the source using GNU indent and "indent -i4 -bli0 -npcs -nprs -npsl".
Matti Hamalainen <ccr@tnsp.org>
parents: 22
diff changeset
241 first = 1;
8eaf72e2041b Reindent the source using GNU indent and "indent -i4 -bli0 -npcs -nprs -npsl".
Matti Hamalainen <ccr@tnsp.org>
parents: 22
diff changeset
242 for (;;)
8eaf72e2041b Reindent the source using GNU indent and "indent -i4 -bli0 -npcs -nprs -npsl".
Matti Hamalainen <ccr@tnsp.org>
parents: 22
diff changeset
243 {
33
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
244 DrawScreenBoxHollow(entry1_x0, entry1_y0,
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
245 entry1_x0 + entry_width - 1,
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
246 entry1_y0 + entry_height - 1, BLACK);
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
247 set_colour(first ? WHITE : DARKGREY);
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
248 DrawScreenText(entry1_x0 + HOLLOW_BORDER + NARROW_HSPACING,
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
249 entry1_y0 + HOLLOW_BORDER + NARROW_VSPACING, "%d",
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
250 *v1);
0
241c93442be0 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
251
33
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
252 DrawScreenBoxHollow(entry2_x0, entry2_y0,
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
253 entry2_x0 + entry_width - 1,
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
254 entry2_y0 + entry_height - 1, BLACK);
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
255 set_colour(!first ? WHITE : DARKGREY);
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
256 DrawScreenText(entry2_x0 + HOLLOW_BORDER + NARROW_HSPACING,
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
257 entry2_y0 + HOLLOW_BORDER + NARROW_VSPACING, "%d",
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
258 *v2);
0
241c93442be0 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
259
33
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
260 if (first)
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
261 key = InputInteger(entry1_x0, entry1_y0, v1, 0, NumVertices - 1);
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
262 else
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
263 key = InputInteger(entry2_x0, entry2_y0, v2, 0, NumVertices - 1);
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
264 if (key == YK_LEFT || key == YK_RIGHT || key == YK_TAB
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
265 || key == YK_BACKTAB)
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
266 first = !first;
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
267 else if (key == YK_ESC)
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
268 break;
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
269 else if (key == YK_RETURN)
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
270 {
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
271 if (first)
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
272 first = 0;
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
273 else if (*v1 < 0 || *v1 >= NumVertices
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
274 || *v2 < 0 || *v2 >= NumVertices)
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
275 Beep();
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
276 else
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
277 break;
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
278 }
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
279 else
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
280 Beep();
25
8eaf72e2041b Reindent the source using GNU indent and "indent -i4 -bli0 -npcs -nprs -npsl".
Matti Hamalainen <ccr@tnsp.org>
parents: 22
diff changeset
281 }
8eaf72e2041b Reindent the source using GNU indent and "indent -i4 -bli0 -npcs -nprs -npsl".
Matti Hamalainen <ccr@tnsp.org>
parents: 22
diff changeset
282 return (key == YK_RETURN);
0
241c93442be0 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
283 }
241c93442be0 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
284
241c93442be0 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
285
241c93442be0 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
286
241c93442be0 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
287 /*
241c93442be0 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
288 edit an object or a group of objects
241c93442be0 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
289 */
241c93442be0 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
290
33
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
291 void EditObjectsInfo(int x0, int y0, int objtype, SelPtr obj) /* SWAP! */
0
241c93442be0 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
292 {
25
8eaf72e2041b Reindent the source using GNU indent and "indent -i4 -bli0 -npcs -nprs -npsl".
Matti Hamalainen <ccr@tnsp.org>
parents: 22
diff changeset
293 char *menustr[3];
8eaf72e2041b Reindent the source using GNU indent and "indent -i4 -bli0 -npcs -nprs -npsl".
Matti Hamalainen <ccr@tnsp.org>
parents: 22
diff changeset
294 int n, val;
8eaf72e2041b Reindent the source using GNU indent and "indent -i4 -bli0 -npcs -nprs -npsl".
Matti Hamalainen <ccr@tnsp.org>
parents: 22
diff changeset
295 SelPtr cur;
8eaf72e2041b Reindent the source using GNU indent and "indent -i4 -bli0 -npcs -nprs -npsl".
Matti Hamalainen <ccr@tnsp.org>
parents: 22
diff changeset
296 int subwin_y0;
0
241c93442be0 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
297
25
8eaf72e2041b Reindent the source using GNU indent and "indent -i4 -bli0 -npcs -nprs -npsl".
Matti Hamalainen <ccr@tnsp.org>
parents: 22
diff changeset
298 if (!obj)
33
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
299 return;
25
8eaf72e2041b Reindent the source using GNU indent and "indent -i4 -bli0 -npcs -nprs -npsl".
Matti Hamalainen <ccr@tnsp.org>
parents: 22
diff changeset
300 switch (objtype)
8eaf72e2041b Reindent the source using GNU indent and "indent -i4 -bli0 -npcs -nprs -npsl".
Matti Hamalainen <ccr@tnsp.org>
parents: 22
diff changeset
301 {
8eaf72e2041b Reindent the source using GNU indent and "indent -i4 -bli0 -npcs -nprs -npsl".
Matti Hamalainen <ccr@tnsp.org>
parents: 22
diff changeset
302 case OBJ_THINGS:
33
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
303 ThingProperties(x0, y0, obj);
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
304 break;
0
241c93442be0 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
305
25
8eaf72e2041b Reindent the source using GNU indent and "indent -i4 -bli0 -npcs -nprs -npsl".
Matti Hamalainen <ccr@tnsp.org>
parents: 22
diff changeset
306 case OBJ_VERTICES:
33
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
307 for (n = 0; n < 3; n++)
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
308 menustr[n] = (char *) GetMemory(60);
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
309 sprintf(menustr[2], "Edit Vertex #%d", obj->objnum);
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
310 sprintf(menustr[0], "Change X position (Current: %d)",
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
311 Vertices[obj->objnum].x);
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
312 sprintf(menustr[1], "Change Y position (Current: %d)",
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
313 Vertices[obj->objnum].y);
0
241c93442be0 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
314 #ifdef OLDMEN
33
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
315 val = DisplayMenuArray(0, y0,
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
316 menustr[2], 2, NULL, menustr, NULL, NULL,
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
317 NULL);
0
241c93442be0 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
318 #else
33
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
319 val = vDisplayMenu(0, y0, menustr[2],
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
320 menustr[0], YK_, 0, menustr[1], YK_, 0, NULL);
0
241c93442be0 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
321 #endif
33
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
322 for (n = 0; n < 3; n++)
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
323 FreeMemory(menustr[n]);
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
324 subwin_y0 = y0 + BOX_BORDER + (2 + val) * FONTH;
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
325 switch (val)
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
326 {
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
327 case 1:
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
328 val = InputIntegerValue(x0 + 42, subwin_y0,
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
329 y_min(MapMinX, -10000),
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
330 y_max(MapMaxX, 10000),
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
331 Vertices[obj->objnum].x);
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
332 if (val != IIV_CANCEL)
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
333 {
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
334 n = val - Vertices[obj->objnum].x;
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
335 for (cur = obj; cur; cur = cur->next)
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
336 Vertices[cur->objnum].x += n;
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
337 MadeChanges = 1;
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
338 MadeMapChanges = 1;
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
339 }
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
340 break;
0
241c93442be0 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
341
33
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
342 case 2:
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
343 val = InputIntegerValue(x0 + 42, subwin_y0,
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
344 y_min(MapMinY, -10000),
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
345 y_max(MapMaxY, 10000),
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
346 Vertices[obj->objnum].y);
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
347 if (val != IIV_CANCEL)
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
348 {
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
349 n = val - Vertices[obj->objnum].y;
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
350 for (cur = obj; cur; cur = cur->next)
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
351 Vertices[cur->objnum].y += n;
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
352 MadeChanges = 1;
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
353 MadeMapChanges = 1;
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
354 }
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
355 break;
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
356 }
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
357 break;
0
241c93442be0 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
358
25
8eaf72e2041b Reindent the source using GNU indent and "indent -i4 -bli0 -npcs -nprs -npsl".
Matti Hamalainen <ccr@tnsp.org>
parents: 22
diff changeset
359 case OBJ_LINEDEFS:
33
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
360 LinedefProperties(x0, y0, obj);
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
361 break;
0
241c93442be0 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
362
25
8eaf72e2041b Reindent the source using GNU indent and "indent -i4 -bli0 -npcs -nprs -npsl".
Matti Hamalainen <ccr@tnsp.org>
parents: 22
diff changeset
363 case OBJ_SECTORS:
33
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
364 SectorProperties(x0, y0, obj);
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
365 break;
25
8eaf72e2041b Reindent the source using GNU indent and "indent -i4 -bli0 -npcs -nprs -npsl".
Matti Hamalainen <ccr@tnsp.org>
parents: 22
diff changeset
366 }
0
241c93442be0 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
367 }
241c93442be0 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
368
241c93442be0 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
369
241c93442be0 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
370 /*
241c93442be0 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
371 Yuck! Dirty piece of code...
241c93442be0 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
372 */
241c93442be0 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
373
25
8eaf72e2041b Reindent the source using GNU indent and "indent -i4 -bli0 -npcs -nprs -npsl".
Matti Hamalainen <ccr@tnsp.org>
parents: 22
diff changeset
374 bool Input2Numbers(int x0, int y0, const char *name1, const char *name2,
33
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
375 int v1max, int v2max, int *v1, int *v2)
0
241c93442be0 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
376 {
25
8eaf72e2041b Reindent the source using GNU indent and "indent -i4 -bli0 -npcs -nprs -npsl".
Matti Hamalainen <ccr@tnsp.org>
parents: 22
diff changeset
377 int key;
8eaf72e2041b Reindent the source using GNU indent and "indent -i4 -bli0 -npcs -nprs -npsl".
Matti Hamalainen <ccr@tnsp.org>
parents: 22
diff changeset
378 int maxlen, first;
8eaf72e2041b Reindent the source using GNU indent and "indent -i4 -bli0 -npcs -nprs -npsl".
Matti Hamalainen <ccr@tnsp.org>
parents: 22
diff changeset
379 bool ok;
8eaf72e2041b Reindent the source using GNU indent and "indent -i4 -bli0 -npcs -nprs -npsl".
Matti Hamalainen <ccr@tnsp.org>
parents: 22
diff changeset
380 char prompt[80];
8eaf72e2041b Reindent the source using GNU indent and "indent -i4 -bli0 -npcs -nprs -npsl".
Matti Hamalainen <ccr@tnsp.org>
parents: 22
diff changeset
381 // FIXME copied from InputInteger()...
8eaf72e2041b Reindent the source using GNU indent and "indent -i4 -bli0 -npcs -nprs -npsl".
Matti Hamalainen <ccr@tnsp.org>
parents: 22
diff changeset
382 int entry_width = 2 * HOLLOW_BORDER + 2 * NARROW_HSPACING + 7 * FONTW;
8eaf72e2041b Reindent the source using GNU indent and "indent -i4 -bli0 -npcs -nprs -npsl".
Matti Hamalainen <ccr@tnsp.org>
parents: 22
diff changeset
383 int entry_height = 2 * HOLLOW_BORDER + 2 * NARROW_VSPACING + FONTH;
8eaf72e2041b Reindent the source using GNU indent and "indent -i4 -bli0 -npcs -nprs -npsl".
Matti Hamalainen <ccr@tnsp.org>
parents: 22
diff changeset
384
8eaf72e2041b Reindent the source using GNU indent and "indent -i4 -bli0 -npcs -nprs -npsl".
Matti Hamalainen <ccr@tnsp.org>
parents: 22
diff changeset
385 y_snprintf(prompt, sizeof prompt, "Give the %s and %s for the object:",
33
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
386 name1, name2);
25
8eaf72e2041b Reindent the source using GNU indent and "indent -i4 -bli0 -npcs -nprs -npsl".
Matti Hamalainen <ccr@tnsp.org>
parents: 22
diff changeset
387 maxlen = strlen(prompt);
8eaf72e2041b Reindent the source using GNU indent and "indent -i4 -bli0 -npcs -nprs -npsl".
Matti Hamalainen <ccr@tnsp.org>
parents: 22
diff changeset
388
8eaf72e2041b Reindent the source using GNU indent and "indent -i4 -bli0 -npcs -nprs -npsl".
Matti Hamalainen <ccr@tnsp.org>
parents: 22
diff changeset
389 int title_x0 = BOX_BORDER + FONTW;
8eaf72e2041b Reindent the source using GNU indent and "indent -i4 -bli0 -npcs -nprs -npsl".
Matti Hamalainen <ccr@tnsp.org>
parents: 22
diff changeset
390 int title_y0 = BOX_BORDER + FONTH / 2;
8eaf72e2041b Reindent the source using GNU indent and "indent -i4 -bli0 -npcs -nprs -npsl".
Matti Hamalainen <ccr@tnsp.org>
parents: 22
diff changeset
391 int label1_x0 = title_x0;
8eaf72e2041b Reindent the source using GNU indent and "indent -i4 -bli0 -npcs -nprs -npsl".
Matti Hamalainen <ccr@tnsp.org>
parents: 22
diff changeset
392 int label1_y0 = title_y0 + 2 * FONTH;
8eaf72e2041b Reindent the source using GNU indent and "indent -i4 -bli0 -npcs -nprs -npsl".
Matti Hamalainen <ccr@tnsp.org>
parents: 22
diff changeset
393 int label2_x0 = title_x0 + (strlen(name1) + 2) * FONTW;
8eaf72e2041b Reindent the source using GNU indent and "indent -i4 -bli0 -npcs -nprs -npsl".
Matti Hamalainen <ccr@tnsp.org>
parents: 22
diff changeset
394 {
33
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
395 int bound = label1_x0 + entry_width + int (FONTW);
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
396 if (label2_x0 < bound)
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
397 label2_x0 = bound;
25
8eaf72e2041b Reindent the source using GNU indent and "indent -i4 -bli0 -npcs -nprs -npsl".
Matti Hamalainen <ccr@tnsp.org>
parents: 22
diff changeset
398 }
0
241c93442be0 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
399 // FIXME Assuming the range is not longer than the name
25
8eaf72e2041b Reindent the source using GNU indent and "indent -i4 -bli0 -npcs -nprs -npsl".
Matti Hamalainen <ccr@tnsp.org>
parents: 22
diff changeset
400 int label2_y0 = label1_y0;
8eaf72e2041b Reindent the source using GNU indent and "indent -i4 -bli0 -npcs -nprs -npsl".
Matti Hamalainen <ccr@tnsp.org>
parents: 22
diff changeset
401 int entry1_out_x0 = label1_x0;
8eaf72e2041b Reindent the source using GNU indent and "indent -i4 -bli0 -npcs -nprs -npsl".
Matti Hamalainen <ccr@tnsp.org>
parents: 22
diff changeset
402 int entry1_out_y0 = label1_y0 + 3 * FONTH / 2;
8eaf72e2041b Reindent the source using GNU indent and "indent -i4 -bli0 -npcs -nprs -npsl".
Matti Hamalainen <ccr@tnsp.org>
parents: 22
diff changeset
403 int entry1_text_x0 = entry1_out_x0 + HOLLOW_BORDER + NARROW_HSPACING;
8eaf72e2041b Reindent the source using GNU indent and "indent -i4 -bli0 -npcs -nprs -npsl".
Matti Hamalainen <ccr@tnsp.org>
parents: 22
diff changeset
404 int entry1_text_y0 = entry1_out_y0 + HOLLOW_BORDER + NARROW_VSPACING;
8eaf72e2041b Reindent the source using GNU indent and "indent -i4 -bli0 -npcs -nprs -npsl".
Matti Hamalainen <ccr@tnsp.org>
parents: 22
diff changeset
405 int entry1_out_x1 = entry1_out_x0 + entry_width - 1;
8eaf72e2041b Reindent the source using GNU indent and "indent -i4 -bli0 -npcs -nprs -npsl".
Matti Hamalainen <ccr@tnsp.org>
parents: 22
diff changeset
406 int entry1_out_y1 = entry1_out_y0 + entry_height - 1;
8eaf72e2041b Reindent the source using GNU indent and "indent -i4 -bli0 -npcs -nprs -npsl".
Matti Hamalainen <ccr@tnsp.org>
parents: 22
diff changeset
407 int entry2_out_x0 = label2_x0;
8eaf72e2041b Reindent the source using GNU indent and "indent -i4 -bli0 -npcs -nprs -npsl".
Matti Hamalainen <ccr@tnsp.org>
parents: 22
diff changeset
408 int entry2_out_y0 = label2_y0 + 3 * FONTH / 2;
8eaf72e2041b Reindent the source using GNU indent and "indent -i4 -bli0 -npcs -nprs -npsl".
Matti Hamalainen <ccr@tnsp.org>
parents: 22
diff changeset
409 int entry2_text_x0 = entry2_out_x0 + HOLLOW_BORDER + NARROW_HSPACING;
8eaf72e2041b Reindent the source using GNU indent and "indent -i4 -bli0 -npcs -nprs -npsl".
Matti Hamalainen <ccr@tnsp.org>
parents: 22
diff changeset
410 int entry2_text_y0 = entry2_out_y0 + HOLLOW_BORDER + NARROW_VSPACING;
8eaf72e2041b Reindent the source using GNU indent and "indent -i4 -bli0 -npcs -nprs -npsl".
Matti Hamalainen <ccr@tnsp.org>
parents: 22
diff changeset
411 int entry2_out_x1 = entry2_out_x0 + entry_width - 1;
8eaf72e2041b Reindent the source using GNU indent and "indent -i4 -bli0 -npcs -nprs -npsl".
Matti Hamalainen <ccr@tnsp.org>
parents: 22
diff changeset
412 int entry2_out_y1 = entry2_out_y0 + entry_height - 1;
8eaf72e2041b Reindent the source using GNU indent and "indent -i4 -bli0 -npcs -nprs -npsl".
Matti Hamalainen <ccr@tnsp.org>
parents: 22
diff changeset
413 int range1_x0 = entry1_out_x0;
8eaf72e2041b Reindent the source using GNU indent and "indent -i4 -bli0 -npcs -nprs -npsl".
Matti Hamalainen <ccr@tnsp.org>
parents: 22
diff changeset
414 int range1_y0 = entry1_out_y1 + FONTH / 2;
8eaf72e2041b Reindent the source using GNU indent and "indent -i4 -bli0 -npcs -nprs -npsl".
Matti Hamalainen <ccr@tnsp.org>
parents: 22
diff changeset
415 int range2_x0 = entry2_out_x0;
8eaf72e2041b Reindent the source using GNU indent and "indent -i4 -bli0 -npcs -nprs -npsl".
Matti Hamalainen <ccr@tnsp.org>
parents: 22
diff changeset
416 int range2_y0 = entry2_out_y1 + FONTH / 2;
8eaf72e2041b Reindent the source using GNU indent and "indent -i4 -bli0 -npcs -nprs -npsl".
Matti Hamalainen <ccr@tnsp.org>
parents: 22
diff changeset
417 int window_x1 = entry2_out_x1 + FONTW + BOX_BORDER;
8eaf72e2041b Reindent the source using GNU indent and "indent -i4 -bli0 -npcs -nprs -npsl".
Matti Hamalainen <ccr@tnsp.org>
parents: 22
diff changeset
418 int window_y1 = range1_y0 + 3 * FONTH / 2 + BOX_BORDER;
8eaf72e2041b Reindent the source using GNU indent and "indent -i4 -bli0 -npcs -nprs -npsl".
Matti Hamalainen <ccr@tnsp.org>
parents: 22
diff changeset
419 {
33
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
420 int bound = 2 * BOX_BORDER + (maxlen + 2) * int (FONTW);
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
421 if (window_x1 < bound)
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
422 window_x1 = bound;
25
8eaf72e2041b Reindent the source using GNU indent and "indent -i4 -bli0 -npcs -nprs -npsl".
Matti Hamalainen <ccr@tnsp.org>
parents: 22
diff changeset
423 }
8eaf72e2041b Reindent the source using GNU indent and "indent -i4 -bli0 -npcs -nprs -npsl".
Matti Hamalainen <ccr@tnsp.org>
parents: 22
diff changeset
424
8eaf72e2041b Reindent the source using GNU indent and "indent -i4 -bli0 -npcs -nprs -npsl".
Matti Hamalainen <ccr@tnsp.org>
parents: 22
diff changeset
425 if (x0 < 0)
80
2f1ecc1c5f72 Huge cleanup -- move some global variables into a struct.
Matti Hamalainen <ccr@tnsp.org>
parents: 66
diff changeset
426 x0 = (cfg.ScrMaxX - window_x1) / 2;
25
8eaf72e2041b Reindent the source using GNU indent and "indent -i4 -bli0 -npcs -nprs -npsl".
Matti Hamalainen <ccr@tnsp.org>
parents: 22
diff changeset
427 if (y0 < 0)
80
2f1ecc1c5f72 Huge cleanup -- move some global variables into a struct.
Matti Hamalainen <ccr@tnsp.org>
parents: 66
diff changeset
428 y0 = (cfg.ScrMaxY - window_y1) / 2;
0
241c93442be0 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
429
25
8eaf72e2041b Reindent the source using GNU indent and "indent -i4 -bli0 -npcs -nprs -npsl".
Matti Hamalainen <ccr@tnsp.org>
parents: 22
diff changeset
430 DrawScreenBox3D(x0, y0, x0 + window_x1, y0 + window_y1);
8eaf72e2041b Reindent the source using GNU indent and "indent -i4 -bli0 -npcs -nprs -npsl".
Matti Hamalainen <ccr@tnsp.org>
parents: 22
diff changeset
431 set_colour(WHITE);
8eaf72e2041b Reindent the source using GNU indent and "indent -i4 -bli0 -npcs -nprs -npsl".
Matti Hamalainen <ccr@tnsp.org>
parents: 22
diff changeset
432 DrawScreenText(x0 + title_x0, y0 + title_x0, prompt);
8eaf72e2041b Reindent the source using GNU indent and "indent -i4 -bli0 -npcs -nprs -npsl".
Matti Hamalainen <ccr@tnsp.org>
parents: 22
diff changeset
433 DrawScreenText(x0 + label1_x0, y0 + label1_y0, name1);
8eaf72e2041b Reindent the source using GNU indent and "indent -i4 -bli0 -npcs -nprs -npsl".
Matti Hamalainen <ccr@tnsp.org>
parents: 22
diff changeset
434 DrawScreenText(x0 + label2_x0, y0 + label2_y0, name2);
8eaf72e2041b Reindent the source using GNU indent and "indent -i4 -bli0 -npcs -nprs -npsl".
Matti Hamalainen <ccr@tnsp.org>
parents: 22
diff changeset
435 DrawScreenText(x0 + range1_x0, y0 + range1_y0, "(0-%d)", v1max);
8eaf72e2041b Reindent the source using GNU indent and "indent -i4 -bli0 -npcs -nprs -npsl".
Matti Hamalainen <ccr@tnsp.org>
parents: 22
diff changeset
436 DrawScreenText(x0 + range2_x0, y0 + range2_y0, "(0-%d)", v2max);
0
241c93442be0 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
437
25
8eaf72e2041b Reindent the source using GNU indent and "indent -i4 -bli0 -npcs -nprs -npsl".
Matti Hamalainen <ccr@tnsp.org>
parents: 22
diff changeset
438 first = 1;
8eaf72e2041b Reindent the source using GNU indent and "indent -i4 -bli0 -npcs -nprs -npsl".
Matti Hamalainen <ccr@tnsp.org>
parents: 22
diff changeset
439 key = 0;
8eaf72e2041b Reindent the source using GNU indent and "indent -i4 -bli0 -npcs -nprs -npsl".
Matti Hamalainen <ccr@tnsp.org>
parents: 22
diff changeset
440 for (;;)
8eaf72e2041b Reindent the source using GNU indent and "indent -i4 -bli0 -npcs -nprs -npsl".
Matti Hamalainen <ccr@tnsp.org>
parents: 22
diff changeset
441 {
33
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
442 ok = true;
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
443 DrawScreenBoxHollow(x0 + entry1_out_x0, y0 + entry1_out_y0,
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
444 x0 + entry1_out_x1, y0 + entry1_out_y1, BLACK);
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
445 if (*v1 < 0 || *v1 > v1max)
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
446 {
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
447 set_colour(DARKGREY);
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
448 ok = false;
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
449 }
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
450 else
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
451 set_colour(LIGHTGREY);
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
452 DrawScreenText(x0 + entry1_text_x0, y0 + entry1_text_y0, "%d", *v1);
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
453 DrawScreenBoxHollow(x0 + entry2_out_x0, y0 + entry2_out_y0,
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
454 x0 + entry2_out_x1, y0 + entry2_out_y1, BLACK);
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
455 if (*v2 < 0 || *v2 > v2max)
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
456 {
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
457 set_colour(DARKGREY);
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
458 ok = false;
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
459 }
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
460 else
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
461 set_colour(LIGHTGREY);
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
462 DrawScreenText(x0 + entry2_text_x0, y0 + entry2_text_y0, "%d", *v2);
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
463 if (first)
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
464 key =
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
465 InputInteger(x0 + entry1_out_x0, y0 + entry1_out_y0, v1, 0,
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
466 v1max);
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
467 else
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
468 key =
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
469 InputInteger(x0 + entry2_out_x0, y0 + entry2_out_y0, v2, 0,
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
470 v2max);
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
471 if (key == YK_LEFT || key == YK_RIGHT || key == YK_TAB
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
472 || key == YK_BACKTAB)
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
473 first = !first;
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
474 else if (key == YK_ESC)
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
475 break;
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
476 else if (key == YK_RETURN)
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
477 {
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
478 if (first)
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
479 first = 0;
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
480 else if (ok)
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
481 break;
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
482 else
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
483 Beep();
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
484 }
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
485 else
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
486 Beep();
25
8eaf72e2041b Reindent the source using GNU indent and "indent -i4 -bli0 -npcs -nprs -npsl".
Matti Hamalainen <ccr@tnsp.org>
parents: 22
diff changeset
487 }
8eaf72e2041b Reindent the source using GNU indent and "indent -i4 -bli0 -npcs -nprs -npsl".
Matti Hamalainen <ccr@tnsp.org>
parents: 22
diff changeset
488 return (key == YK_RETURN);
0
241c93442be0 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
489 }
241c93442be0 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
490
241c93442be0 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
491
241c93442be0 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
492
241c93442be0 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
493 /*
241c93442be0 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
494 insert a standard object at given position
241c93442be0 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
495 */
241c93442be0 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
496
33
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
497 void InsertStandardObject(int xpos, int ypos, int choice) /* SWAP! */
0
241c93442be0 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
498 {
25
8eaf72e2041b Reindent the source using GNU indent and "indent -i4 -bli0 -npcs -nprs -npsl".
Matti Hamalainen <ccr@tnsp.org>
parents: 22
diff changeset
499 int sector;
8eaf72e2041b Reindent the source using GNU indent and "indent -i4 -bli0 -npcs -nprs -npsl".
Matti Hamalainen <ccr@tnsp.org>
parents: 22
diff changeset
500 int n;
8eaf72e2041b Reindent the source using GNU indent and "indent -i4 -bli0 -npcs -nprs -npsl".
Matti Hamalainen <ccr@tnsp.org>
parents: 22
diff changeset
501 int a, b;
0
241c93442be0 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
502
241c93442be0 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
503 /* are we inside a Sector? */
25
8eaf72e2041b Reindent the source using GNU indent and "indent -i4 -bli0 -npcs -nprs -npsl".
Matti Hamalainen <ccr@tnsp.org>
parents: 22
diff changeset
504 Objid o;
8eaf72e2041b Reindent the source using GNU indent and "indent -i4 -bli0 -npcs -nprs -npsl".
Matti Hamalainen <ccr@tnsp.org>
parents: 22
diff changeset
505 GetCurObject(o, OBJ_SECTORS, xpos, ypos);
8eaf72e2041b Reindent the source using GNU indent and "indent -i4 -bli0 -npcs -nprs -npsl".
Matti Hamalainen <ccr@tnsp.org>
parents: 22
diff changeset
506 sector = o.num;
0
241c93442be0 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
507
241c93442be0 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
508 /* !!!! Should also check for overlapping objects (sectors) !!!! */
25
8eaf72e2041b Reindent the source using GNU indent and "indent -i4 -bli0 -npcs -nprs -npsl".
Matti Hamalainen <ccr@tnsp.org>
parents: 22
diff changeset
509 switch (choice)
8eaf72e2041b Reindent the source using GNU indent and "indent -i4 -bli0 -npcs -nprs -npsl".
Matti Hamalainen <ccr@tnsp.org>
parents: 22
diff changeset
510 {
8eaf72e2041b Reindent the source using GNU indent and "indent -i4 -bli0 -npcs -nprs -npsl".
Matti Hamalainen <ccr@tnsp.org>
parents: 22
diff changeset
511 case 1:
33
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
512 a = 256;
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
513 b = 128;
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
514 if (Input2Numbers(-1, -1, "Width", "Height", 2000, 2000, &a, &b))
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
515 {
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
516 if (a < 8)
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
517 a = 8;
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
518 if (b < 8)
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
519 b = 8;
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
520 xpos = xpos - a / 2;
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
521 ypos = ypos - b / 2;
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
522 InsertObject(OBJ_VERTICES, -1, xpos, ypos);
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
523 InsertObject(OBJ_VERTICES, -1, xpos + a, ypos);
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
524 InsertObject(OBJ_VERTICES, -1, xpos + a, ypos + b);
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
525 InsertObject(OBJ_VERTICES, -1, xpos, ypos + b);
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
526 if (sector < 0)
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
527 InsertObject(OBJ_SECTORS, -1, 0, 0);
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
528 for (n = 0; n < 4; n++)
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 InsertObject(OBJ_LINEDEFS, -1, 0, 0);
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
531 LineDefs[NumLineDefs - 1].sidedef1 = NumSideDefs;
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
532 InsertObject(OBJ_SIDEDEFS, -1, 0, 0);
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
533 if (sector >= 0)
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
534 SideDefs[NumSideDefs - 1].sector = sector;
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
535 }
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
536 if (sector >= 0)
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
537 {
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
538 LineDefs[NumLineDefs - 4].start = NumVertices - 4;
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
539 LineDefs[NumLineDefs - 4].end = NumVertices - 3;
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
540 LineDefs[NumLineDefs - 3].start = NumVertices - 3;
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
541 LineDefs[NumLineDefs - 3].end = NumVertices - 2;
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
542 LineDefs[NumLineDefs - 2].start = NumVertices - 2;
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
543 LineDefs[NumLineDefs - 2].end = NumVertices - 1;
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
544 LineDefs[NumLineDefs - 1].start = NumVertices - 1;
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
545 LineDefs[NumLineDefs - 1].end = NumVertices - 4;
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
546 }
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
547 else
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
548 {
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
549 LineDefs[NumLineDefs - 4].start = NumVertices - 1;
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
550 LineDefs[NumLineDefs - 4].end = NumVertices - 2;
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
551 LineDefs[NumLineDefs - 3].start = NumVertices - 2;
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
552 LineDefs[NumLineDefs - 3].end = NumVertices - 3;
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
553 LineDefs[NumLineDefs - 2].start = NumVertices - 3;
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
554 LineDefs[NumLineDefs - 2].end = NumVertices - 4;
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
555 LineDefs[NumLineDefs - 1].start = NumVertices - 4;
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
556 LineDefs[NumLineDefs - 1].end = NumVertices - 1;
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
557 }
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
558 }
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
559 break;
25
8eaf72e2041b Reindent the source using GNU indent and "indent -i4 -bli0 -npcs -nprs -npsl".
Matti Hamalainen <ccr@tnsp.org>
parents: 22
diff changeset
560 case 2:
33
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
561 a = 8;
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
562 b = 128;
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
563 if (Input2Numbers
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
564 (-1, -1, "Number of sides", "Radius", 32, 2000, &a, &b))
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
565 {
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
566 if (a < 3)
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
567 a = 3;
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
568 if (b < 8)
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
569 b = 8;
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
570 InsertPolygonVertices(xpos, ypos, a, b);
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
571 if (sector < 0)
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
572 InsertObject(OBJ_SECTORS, -1, 0, 0);
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
573 for (n = 0; n < a; n++)
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
574 {
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
575 InsertObject(OBJ_LINEDEFS, -1, 0, 0);
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
576 LineDefs[NumLineDefs - 1].sidedef1 = NumSideDefs;
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
577 InsertObject(OBJ_SIDEDEFS, -1, 0, 0);
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
578 if (sector >= 0)
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
579 SideDefs[NumSideDefs - 1].sector = sector;
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
580 }
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
581 if (sector >= 0)
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
582 {
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
583 LineDefs[NumLineDefs - 1].start = NumVertices - 1;
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
584 LineDefs[NumLineDefs - 1].end = NumVertices - a;
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
585 for (n = 2; n <= a; n++)
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
586 {
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
587 LineDefs[NumLineDefs - n].start = NumVertices - n;
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
588 LineDefs[NumLineDefs - n].end = NumVertices - n + 1;
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
589 }
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 else
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
592 {
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
593 LineDefs[NumLineDefs - 1].start = NumVertices - a;
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
594 LineDefs[NumLineDefs - 1].end = NumVertices - 1;
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
595 for (n = 2; n <= a; n++)
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
596 {
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
597 LineDefs[NumLineDefs - n].start = NumVertices - n + 1;
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
598 LineDefs[NumLineDefs - n].end = NumVertices - n;
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
599 }
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
600 }
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
601 }
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
602 break;
25
8eaf72e2041b Reindent the source using GNU indent and "indent -i4 -bli0 -npcs -nprs -npsl".
Matti Hamalainen <ccr@tnsp.org>
parents: 22
diff changeset
603 case 3:
33
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 a = 6;
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
606 b = 16;
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
607 if (Input2Numbers (-1, -1, "Number of steps", "Step height", 32, 48, &a, &b))
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
608 {
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
609 if (a < 2)
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
610 a = 2;
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
611 n = Sectors[sector].ceilh;
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
612 h = Sectors[sector].floorh;
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
613 if (a * b < n - h)
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
614 {
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
615 Beep ();
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
616 Notify (-1, -1, "The stairs are too high for this Sector", 0);
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
617 return;
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
618 }
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
619 xpos = xpos - 32;
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
620 ypos = ypos - 32 * a;
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
621 for (n = 0; n < a; n++)
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
622 {
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
623 InsertObject (OBJ_VERTICES, -1, xpos, ypos);
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
624 InsertObject (OBJ_VERTICES, -1, xpos + 64, ypos);
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
625 InsertObject (OBJ_VERTICES, -1, xpos + 64, ypos + 64);
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
626 InsertObject (OBJ_VERTICES, -1, xpos, ypos + 64);
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
627 ypos += 64;
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
628 InsertObject (OBJ_SECTORS, sector, 0, 0);
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
629 h += b;
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
630 Sectors[NumSectors - 1].floorh = h;
0
241c93442be0 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
631
33
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
632 InsertObject (OBJ_LINEDEFS, -1, 0, 0);
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
633 LineDefs[NumLineDefs - 1].sidedef1 = NumSideDefs;
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
634 LineDefs[NumLineDefs - 1].sidedef2 = NumSideDefs + 1;
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
635 InsertObject (OBJ_SIDEDEFS, -1, 0, 0);
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
636 SideDefs[NumSideDefs - 1].sector = sector;
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
637 InsertObject (OBJ_SIDEDEFS, -1, 0, 0);
0
241c93442be0 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
638
33
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
639 LineDefs[NumLineDefs - 4].start = NumVertices - 4;
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
640 LineDefs[NumLineDefs - 4].end = NumVertices - 3;
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
641 LineDefs[NumLineDefs - 3].start = NumVertices - 3;
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
642 LineDefs[NumLineDefs - 3].end = NumVertices - 2;
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
643 LineDefs[NumLineDefs - 2].start = NumVertices - 2;
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
644 LineDefs[NumLineDefs - 2].end = NumVertices - 1;
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
645 LineDefs[NumLineDefs - 1].start = NumVertices - 1;
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
646 LineDefs[NumLineDefs - 1].end = NumVertices - 4;
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
647 }
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
648 }
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
649 break;
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
650 */
25
8eaf72e2041b Reindent the source using GNU indent and "indent -i4 -bli0 -npcs -nprs -npsl".
Matti Hamalainen <ccr@tnsp.org>
parents: 22
diff changeset
651 case 4:
33
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
652 NotImplemented();
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
653 break;
25
8eaf72e2041b Reindent the source using GNU indent and "indent -i4 -bli0 -npcs -nprs -npsl".
Matti Hamalainen <ccr@tnsp.org>
parents: 22
diff changeset
654 }
0
241c93442be0 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
655 }
241c93442be0 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
656
66
794b7bb40d7f Initial work on cleaning up and improving the texture alignment functionality.
Matti Hamalainen <ccr@tnsp.org>
parents: 65
diff changeset
657 static void AlignTexturesMenu(int xc, int yc, int mode, SelPtr *list)
794b7bb40d7f Initial work on cleaning up and improving the texture alignment functionality.
Matti Hamalainen <ccr@tnsp.org>
parents: 65
diff changeset
658 {
794b7bb40d7f Initial work on cleaning up and improving the texture alignment functionality.
Matti Hamalainen <ccr@tnsp.org>
parents: 65
diff changeset
659 int opt_sdef;
794b7bb40d7f Initial work on cleaning up and improving the texture alignment functionality.
Matti Hamalainen <ccr@tnsp.org>
parents: 65
diff changeset
660 bool opt_offset = false, opt_check = false;
794b7bb40d7f Initial work on cleaning up and improving the texture alignment functionality.
Matti Hamalainen <ccr@tnsp.org>
parents: 65
diff changeset
661
794b7bb40d7f Initial work on cleaning up and improving the texture alignment functionality.
Matti Hamalainen <ccr@tnsp.org>
parents: 65
diff changeset
662 switch (vDisplayMenu(xc, yc,
794b7bb40d7f Initial work on cleaning up and improving the texture alignment functionality.
Matti Hamalainen <ccr@tnsp.org>
parents: 65
diff changeset
663 mode ? "Aligning textures (Y offset) :" : "Aligning textures (X offset) :",
794b7bb40d7f Initial work on cleaning up and improving the texture alignment functionality.
Matti Hamalainen <ccr@tnsp.org>
parents: 65
diff changeset
664
794b7bb40d7f Initial work on cleaning up and improving the texture alignment functionality.
Matti Hamalainen <ccr@tnsp.org>
parents: 65
diff changeset
665 " Sidedef 1, Check for identical textures. ", YK_, 0,
794b7bb40d7f Initial work on cleaning up and improving the texture alignment functionality.
Matti Hamalainen <ccr@tnsp.org>
parents: 65
diff changeset
666 " Sidedef 1, As above, but with initial offset.", YK_, 0,
794b7bb40d7f Initial work on cleaning up and improving the texture alignment functionality.
Matti Hamalainen <ccr@tnsp.org>
parents: 65
diff changeset
667 " Sidedef 1, No texture checking. ", YK_, 0,
794b7bb40d7f Initial work on cleaning up and improving the texture alignment functionality.
Matti Hamalainen <ccr@tnsp.org>
parents: 65
diff changeset
668 " Sidedef 1, As above, but with initial offset.", YK_, 0,
794b7bb40d7f Initial work on cleaning up and improving the texture alignment functionality.
Matti Hamalainen <ccr@tnsp.org>
parents: 65
diff changeset
669 " Sidedef 2, Check for identical textures. ", YK_, 0,
794b7bb40d7f Initial work on cleaning up and improving the texture alignment functionality.
Matti Hamalainen <ccr@tnsp.org>
parents: 65
diff changeset
670 " Sidedef 2, As above, but with initial offset.", YK_, 0,
794b7bb40d7f Initial work on cleaning up and improving the texture alignment functionality.
Matti Hamalainen <ccr@tnsp.org>
parents: 65
diff changeset
671 " Sidedef 2, No texture checking. ", YK_, 0,
794b7bb40d7f Initial work on cleaning up and improving the texture alignment functionality.
Matti Hamalainen <ccr@tnsp.org>
parents: 65
diff changeset
672 " Sidedef 2, As above, but with initial offset.", YK_, 0,
794b7bb40d7f Initial work on cleaning up and improving the texture alignment functionality.
Matti Hamalainen <ccr@tnsp.org>
parents: 65
diff changeset
673 NULL))
794b7bb40d7f Initial work on cleaning up and improving the texture alignment functionality.
Matti Hamalainen <ccr@tnsp.org>
parents: 65
diff changeset
674 {
794b7bb40d7f Initial work on cleaning up and improving the texture alignment functionality.
Matti Hamalainen <ccr@tnsp.org>
parents: 65
diff changeset
675 case 1: /* Sidedef 1 with checking for same textures */
794b7bb40d7f Initial work on cleaning up and improving the texture alignment functionality.
Matti Hamalainen <ccr@tnsp.org>
parents: 65
diff changeset
676 opt_sdef = 1;
794b7bb40d7f Initial work on cleaning up and improving the texture alignment functionality.
Matti Hamalainen <ccr@tnsp.org>
parents: 65
diff changeset
677 opt_check = true;
794b7bb40d7f Initial work on cleaning up and improving the texture alignment functionality.
Matti Hamalainen <ccr@tnsp.org>
parents: 65
diff changeset
678 opt_offset = false;
794b7bb40d7f Initial work on cleaning up and improving the texture alignment functionality.
Matti Hamalainen <ccr@tnsp.org>
parents: 65
diff changeset
679 break;
794b7bb40d7f Initial work on cleaning up and improving the texture alignment functionality.
Matti Hamalainen <ccr@tnsp.org>
parents: 65
diff changeset
680
794b7bb40d7f Initial work on cleaning up and improving the texture alignment functionality.
Matti Hamalainen <ccr@tnsp.org>
parents: 65
diff changeset
681 case 2: /* Sidedef 1 as above, but with inital offset */
794b7bb40d7f Initial work on cleaning up and improving the texture alignment functionality.
Matti Hamalainen <ccr@tnsp.org>
parents: 65
diff changeset
682 opt_sdef = 1;
794b7bb40d7f Initial work on cleaning up and improving the texture alignment functionality.
Matti Hamalainen <ccr@tnsp.org>
parents: 65
diff changeset
683 opt_check = true;
794b7bb40d7f Initial work on cleaning up and improving the texture alignment functionality.
Matti Hamalainen <ccr@tnsp.org>
parents: 65
diff changeset
684 opt_offset = true;
794b7bb40d7f Initial work on cleaning up and improving the texture alignment functionality.
Matti Hamalainen <ccr@tnsp.org>
parents: 65
diff changeset
685 break;
794b7bb40d7f Initial work on cleaning up and improving the texture alignment functionality.
Matti Hamalainen <ccr@tnsp.org>
parents: 65
diff changeset
686
794b7bb40d7f Initial work on cleaning up and improving the texture alignment functionality.
Matti Hamalainen <ccr@tnsp.org>
parents: 65
diff changeset
687 case 3: /* Sidedef 1 regardless of same textures */
794b7bb40d7f Initial work on cleaning up and improving the texture alignment functionality.
Matti Hamalainen <ccr@tnsp.org>
parents: 65
diff changeset
688 opt_sdef = 1;
794b7bb40d7f Initial work on cleaning up and improving the texture alignment functionality.
Matti Hamalainen <ccr@tnsp.org>
parents: 65
diff changeset
689 opt_check = false;
794b7bb40d7f Initial work on cleaning up and improving the texture alignment functionality.
Matti Hamalainen <ccr@tnsp.org>
parents: 65
diff changeset
690 opt_offset = false;
794b7bb40d7f Initial work on cleaning up and improving the texture alignment functionality.
Matti Hamalainen <ccr@tnsp.org>
parents: 65
diff changeset
691 break;
794b7bb40d7f Initial work on cleaning up and improving the texture alignment functionality.
Matti Hamalainen <ccr@tnsp.org>
parents: 65
diff changeset
692
794b7bb40d7f Initial work on cleaning up and improving the texture alignment functionality.
Matti Hamalainen <ccr@tnsp.org>
parents: 65
diff changeset
693 case 4: /* Sidedef 1 as above, but with inital offset */
794b7bb40d7f Initial work on cleaning up and improving the texture alignment functionality.
Matti Hamalainen <ccr@tnsp.org>
parents: 65
diff changeset
694 opt_sdef = 1;
794b7bb40d7f Initial work on cleaning up and improving the texture alignment functionality.
Matti Hamalainen <ccr@tnsp.org>
parents: 65
diff changeset
695 opt_check = false;
794b7bb40d7f Initial work on cleaning up and improving the texture alignment functionality.
Matti Hamalainen <ccr@tnsp.org>
parents: 65
diff changeset
696 opt_offset = true;
794b7bb40d7f Initial work on cleaning up and improving the texture alignment functionality.
Matti Hamalainen <ccr@tnsp.org>
parents: 65
diff changeset
697 break;
794b7bb40d7f Initial work on cleaning up and improving the texture alignment functionality.
Matti Hamalainen <ccr@tnsp.org>
parents: 65
diff changeset
698
794b7bb40d7f Initial work on cleaning up and improving the texture alignment functionality.
Matti Hamalainen <ccr@tnsp.org>
parents: 65
diff changeset
699 case 5: /* Sidedef 2 with checking for same textures */
794b7bb40d7f Initial work on cleaning up and improving the texture alignment functionality.
Matti Hamalainen <ccr@tnsp.org>
parents: 65
diff changeset
700 opt_sdef = 2;
794b7bb40d7f Initial work on cleaning up and improving the texture alignment functionality.
Matti Hamalainen <ccr@tnsp.org>
parents: 65
diff changeset
701 opt_check = true;
794b7bb40d7f Initial work on cleaning up and improving the texture alignment functionality.
Matti Hamalainen <ccr@tnsp.org>
parents: 65
diff changeset
702 opt_offset = false;
794b7bb40d7f Initial work on cleaning up and improving the texture alignment functionality.
Matti Hamalainen <ccr@tnsp.org>
parents: 65
diff changeset
703 break;
794b7bb40d7f Initial work on cleaning up and improving the texture alignment functionality.
Matti Hamalainen <ccr@tnsp.org>
parents: 65
diff changeset
704
794b7bb40d7f Initial work on cleaning up and improving the texture alignment functionality.
Matti Hamalainen <ccr@tnsp.org>
parents: 65
diff changeset
705 case 6: /* Sidedef 2 as above, but with initial offset */
794b7bb40d7f Initial work on cleaning up and improving the texture alignment functionality.
Matti Hamalainen <ccr@tnsp.org>
parents: 65
diff changeset
706 opt_sdef = 2;
794b7bb40d7f Initial work on cleaning up and improving the texture alignment functionality.
Matti Hamalainen <ccr@tnsp.org>
parents: 65
diff changeset
707 opt_check = true;
794b7bb40d7f Initial work on cleaning up and improving the texture alignment functionality.
Matti Hamalainen <ccr@tnsp.org>
parents: 65
diff changeset
708 opt_offset = true;
794b7bb40d7f Initial work on cleaning up and improving the texture alignment functionality.
Matti Hamalainen <ccr@tnsp.org>
parents: 65
diff changeset
709 break;
794b7bb40d7f Initial work on cleaning up and improving the texture alignment functionality.
Matti Hamalainen <ccr@tnsp.org>
parents: 65
diff changeset
710
794b7bb40d7f Initial work on cleaning up and improving the texture alignment functionality.
Matti Hamalainen <ccr@tnsp.org>
parents: 65
diff changeset
711 case 7: /* Sidedef 2 regardless of same textures */
794b7bb40d7f Initial work on cleaning up and improving the texture alignment functionality.
Matti Hamalainen <ccr@tnsp.org>
parents: 65
diff changeset
712 opt_sdef = 2;
794b7bb40d7f Initial work on cleaning up and improving the texture alignment functionality.
Matti Hamalainen <ccr@tnsp.org>
parents: 65
diff changeset
713 opt_check = false;
794b7bb40d7f Initial work on cleaning up and improving the texture alignment functionality.
Matti Hamalainen <ccr@tnsp.org>
parents: 65
diff changeset
714 opt_offset = false;
794b7bb40d7f Initial work on cleaning up and improving the texture alignment functionality.
Matti Hamalainen <ccr@tnsp.org>
parents: 65
diff changeset
715 break;
794b7bb40d7f Initial work on cleaning up and improving the texture alignment functionality.
Matti Hamalainen <ccr@tnsp.org>
parents: 65
diff changeset
716
794b7bb40d7f Initial work on cleaning up and improving the texture alignment functionality.
Matti Hamalainen <ccr@tnsp.org>
parents: 65
diff changeset
717 case 8: /* Sidedef 2 as above, but with initial offset */
794b7bb40d7f Initial work on cleaning up and improving the texture alignment functionality.
Matti Hamalainen <ccr@tnsp.org>
parents: 65
diff changeset
718 opt_sdef = 2;
794b7bb40d7f Initial work on cleaning up and improving the texture alignment functionality.
Matti Hamalainen <ccr@tnsp.org>
parents: 65
diff changeset
719 opt_check = false;
794b7bb40d7f Initial work on cleaning up and improving the texture alignment functionality.
Matti Hamalainen <ccr@tnsp.org>
parents: 65
diff changeset
720 opt_offset = true;
794b7bb40d7f Initial work on cleaning up and improving the texture alignment functionality.
Matti Hamalainen <ccr@tnsp.org>
parents: 65
diff changeset
721 break;
794b7bb40d7f Initial work on cleaning up and improving the texture alignment functionality.
Matti Hamalainen <ccr@tnsp.org>
parents: 65
diff changeset
722
794b7bb40d7f Initial work on cleaning up and improving the texture alignment functionality.
Matti Hamalainen <ccr@tnsp.org>
parents: 65
diff changeset
723 default:
794b7bb40d7f Initial work on cleaning up and improving the texture alignment functionality.
Matti Hamalainen <ccr@tnsp.org>
parents: 65
diff changeset
724 return;
794b7bb40d7f Initial work on cleaning up and improving the texture alignment functionality.
Matti Hamalainen <ccr@tnsp.org>
parents: 65
diff changeset
725 }
794b7bb40d7f Initial work on cleaning up and improving the texture alignment functionality.
Matti Hamalainen <ccr@tnsp.org>
parents: 65
diff changeset
726
794b7bb40d7f Initial work on cleaning up and improving the texture alignment functionality.
Matti Hamalainen <ccr@tnsp.org>
parents: 65
diff changeset
727 /* Select all sidedefs */
794b7bb40d7f Initial work on cleaning up and improving the texture alignment functionality.
Matti Hamalainen <ccr@tnsp.org>
parents: 65
diff changeset
728 SelPtr sdlist = NULL, cur;
794b7bb40d7f Initial work on cleaning up and improving the texture alignment functionality.
Matti Hamalainen <ccr@tnsp.org>
parents: 65
diff changeset
729 for (cur = *list; cur; cur = cur->next)
794b7bb40d7f Initial work on cleaning up and improving the texture alignment functionality.
Matti Hamalainen <ccr@tnsp.org>
parents: 65
diff changeset
730 {
794b7bb40d7f Initial work on cleaning up and improving the texture alignment functionality.
Matti Hamalainen <ccr@tnsp.org>
parents: 65
diff changeset
731 if (opt_sdef == 1 && LineDefs[cur->objnum].sidedef1 >= 0)
794b7bb40d7f Initial work on cleaning up and improving the texture alignment functionality.
Matti Hamalainen <ccr@tnsp.org>
parents: 65
diff changeset
732 SelectObject(&sdlist, LineDefs[cur->objnum].sidedef1);
794b7bb40d7f Initial work on cleaning up and improving the texture alignment functionality.
Matti Hamalainen <ccr@tnsp.org>
parents: 65
diff changeset
733
794b7bb40d7f Initial work on cleaning up and improving the texture alignment functionality.
Matti Hamalainen <ccr@tnsp.org>
parents: 65
diff changeset
734 if (opt_sdef == 2 && LineDefs[cur->objnum].sidedef2 >= 0)
794b7bb40d7f Initial work on cleaning up and improving the texture alignment functionality.
Matti Hamalainen <ccr@tnsp.org>
parents: 65
diff changeset
735 SelectObject(&sdlist, LineDefs[cur->objnum].sidedef2);
794b7bb40d7f Initial work on cleaning up and improving the texture alignment functionality.
Matti Hamalainen <ccr@tnsp.org>
parents: 65
diff changeset
736 }
794b7bb40d7f Initial work on cleaning up and improving the texture alignment functionality.
Matti Hamalainen <ccr@tnsp.org>
parents: 65
diff changeset
737
794b7bb40d7f Initial work on cleaning up and improving the texture alignment functionality.
Matti Hamalainen <ccr@tnsp.org>
parents: 65
diff changeset
738 if (mode == 0)
794b7bb40d7f Initial work on cleaning up and improving the texture alignment functionality.
Matti Hamalainen <ccr@tnsp.org>
parents: 65
diff changeset
739 /* Align the textures along the X axis (width) */
794b7bb40d7f Initial work on cleaning up and improving the texture alignment functionality.
Matti Hamalainen <ccr@tnsp.org>
parents: 65
diff changeset
740 AlignTexturesX(&sdlist, opt_sdef, opt_check, opt_offset, -1);
794b7bb40d7f Initial work on cleaning up and improving the texture alignment functionality.
Matti Hamalainen <ccr@tnsp.org>
parents: 65
diff changeset
741 else
794b7bb40d7f Initial work on cleaning up and improving the texture alignment functionality.
Matti Hamalainen <ccr@tnsp.org>
parents: 65
diff changeset
742 /* Align the textures along the Y axis (height) */
794b7bb40d7f Initial work on cleaning up and improving the texture alignment functionality.
Matti Hamalainen <ccr@tnsp.org>
parents: 65
diff changeset
743 AlignTexturesY(&sdlist, opt_sdef, opt_check);
794b7bb40d7f Initial work on cleaning up and improving the texture alignment functionality.
Matti Hamalainen <ccr@tnsp.org>
parents: 65
diff changeset
744 }
0
241c93442be0 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
745
241c93442be0 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
746
241c93442be0 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
747 /*
66
794b7bb40d7f Initial work on cleaning up and improving the texture alignment functionality.
Matti Hamalainen <ccr@tnsp.org>
parents: 65
diff changeset
748 * Menu of miscellaneous operations
794b7bb40d7f Initial work on cleaning up and improving the texture alignment functionality.
Matti Hamalainen <ccr@tnsp.org>
parents: 65
diff changeset
749 */
33
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
750 void MiscOperations(int objtype, SelPtr * list, int val) /* SWAP! */
0
241c93442be0 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
751 {
25
8eaf72e2041b Reindent the source using GNU indent and "indent -i4 -bli0 -npcs -nprs -npsl".
Matti Hamalainen <ccr@tnsp.org>
parents: 22
diff changeset
752 char msg[80];
8eaf72e2041b Reindent the source using GNU indent and "indent -i4 -bli0 -npcs -nprs -npsl".
Matti Hamalainen <ccr@tnsp.org>
parents: 22
diff changeset
753 int angle, scale;
0
241c93442be0 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
754
25
8eaf72e2041b Reindent the source using GNU indent and "indent -i4 -bli0 -npcs -nprs -npsl".
Matti Hamalainen <ccr@tnsp.org>
parents: 22
diff changeset
755 if (val > 1 && !*list)
8eaf72e2041b Reindent the source using GNU indent and "indent -i4 -bli0 -npcs -nprs -npsl".
Matti Hamalainen <ccr@tnsp.org>
parents: 22
diff changeset
756 {
33
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
757 Beep();
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
758 sprintf(msg, "You must select at least one %s",
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
759 GetObjectTypeName(objtype));
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
760 Notify(-1, -1, msg, 0);
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
761 return;
25
8eaf72e2041b Reindent the source using GNU indent and "indent -i4 -bli0 -npcs -nprs -npsl".
Matti Hamalainen <ccr@tnsp.org>
parents: 22
diff changeset
762 }
0
241c93442be0 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
763
241c93442be0 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
764 /* I think this switch statement deserves a prize for "worst
241c93442be0 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
765 gratuitous obfuscation" or something. -- AYM 2000-11-07 */
25
8eaf72e2041b Reindent the source using GNU indent and "indent -i4 -bli0 -npcs -nprs -npsl".
Matti Hamalainen <ccr@tnsp.org>
parents: 22
diff changeset
766 switch (val)
8eaf72e2041b Reindent the source using GNU indent and "indent -i4 -bli0 -npcs -nprs -npsl".
Matti Hamalainen <ccr@tnsp.org>
parents: 22
diff changeset
767 {
8eaf72e2041b Reindent the source using GNU indent and "indent -i4 -bli0 -npcs -nprs -npsl".
Matti Hamalainen <ccr@tnsp.org>
parents: 22
diff changeset
768 case 1:
33
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
769 // * -> First free tag number
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
770 sprintf(msg, "First free tag number: %d", FindFreeTag());
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
771 Notify(-1, -1, msg, 0);
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
772 break;
0
241c93442be0 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
773
25
8eaf72e2041b Reindent the source using GNU indent and "indent -i4 -bli0 -npcs -nprs -npsl".
Matti Hamalainen <ccr@tnsp.org>
parents: 22
diff changeset
774 case 2:
33
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
775 // * -> Rotate and scale
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
776 if ((objtype == OBJ_THINGS
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
777 || objtype == OBJ_VERTICES) && !(*list)->next)
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
778 {
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
779 Beep();
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
780 sprintf(msg, "You must select more than one %s",
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
781 GetObjectTypeName(objtype));
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
782 Notify(-1, -1, msg, 0);
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
783 return;
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
784 }
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
785 angle = 0;
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
786 scale = 100;
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
787 if (Input2Numbers(-1, -1, "rotation angle (°)", "scale (%)",
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
788 360, 1000, &angle, &scale))
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
789 RotateAndScaleObjects(objtype, *list, (double) angle * 0.0174533,
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
790 (double) scale * 0.01);
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
791 break;
0
241c93442be0 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
792
25
8eaf72e2041b Reindent the source using GNU indent and "indent -i4 -bli0 -npcs -nprs -npsl".
Matti Hamalainen <ccr@tnsp.org>
parents: 22
diff changeset
793 case 3:
33
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
794 // Linedef -> Split
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
795 if (objtype == OBJ_LINEDEFS)
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
796 {
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
797 SplitLineDefs(*list);
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
798 }
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
799 // Sector -> Make door from sector
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
800 else if (objtype == OBJ_SECTORS)
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
801 {
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
802 if ((*list)->next)
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
803 {
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
804 Beep();
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
805 Notify(-1, -1, "You must select exactly one sector", 0);
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
806 }
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
807 else
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
808 {
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
809 MakeDoorFromSector((*list)->objnum);
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
810 }
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
811 }
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
812 // Thing -> Spin 45° clockwise
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
813 else if (objtype == OBJ_THINGS)
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
814 {
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
815 spin_things(*list, -45);
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
816 }
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
817 // Vertex -> Delete and join linedefs
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
818 else if (objtype == OBJ_VERTICES)
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
819 {
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
820 DeleteVerticesJoinLineDefs(*list);
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
821 ForgetSelection(list);
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
822 }
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
823 break;
0
241c93442be0 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
824
25
8eaf72e2041b Reindent the source using GNU indent and "indent -i4 -bli0 -npcs -nprs -npsl".
Matti Hamalainen <ccr@tnsp.org>
parents: 22
diff changeset
825 case 4:
33
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
826 // Linedef -> Split linedefs and sector
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
827 if (objtype == OBJ_LINEDEFS)
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
828 {
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
829 if (!(*list)->next || (*list)->next->next)
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
830 {
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
831 Beep();
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
832 Notify(-1, -1, "You must select exactly two linedefs", 0);
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 else
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
835 {
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
836 SplitLineDefsAndSector((*list)->next->objnum,
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
837 (*list)->objnum);
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
838 ForgetSelection(list);
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 }
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
841 // Sector -> Make lift from sector
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
842 else if (objtype == OBJ_SECTORS)
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 if ((*list)->next)
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
845 {
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
846 Beep();
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
847 Notify(-1, -1, "You must select exactly one Sector", 0);
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
848 }
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
849 else
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 MakeLiftFromSector((*list)->objnum);
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
852 }
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
853 }
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
854 // Thing -> Spin 45° counter-clockwise
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
855 else if (objtype == OBJ_THINGS)
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
856 spin_things(*list, 45);
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
857 // Vertex -> Merge
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
858 else if (objtype == OBJ_VERTICES)
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
859 {
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
860 MergeVertices(list);
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 break;
0
241c93442be0 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
863
25
8eaf72e2041b Reindent the source using GNU indent and "indent -i4 -bli0 -npcs -nprs -npsl".
Matti Hamalainen <ccr@tnsp.org>
parents: 22
diff changeset
864 case 5:
33
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
865 // Linedef -> Delete linedefs and join sectors
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
866 if (objtype == OBJ_LINEDEFS)
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
867 {
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
868 DeleteLineDefsJoinSectors(list);
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
869 }
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
870 // Sector -> Distribute sector floor heights
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
871 else if (objtype == OBJ_SECTORS)
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
872 {
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
873 if (!(*list)->next || !(*list)->next->next)
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 Beep();
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
876 Notify(-1, -1, "You must select three or more sectors", 0);
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
877 }
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
878 else
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
879 {
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
880 DistributeSectorFloors(*list);
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
881 }
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
882 }
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
883 // Thing -> Mirror horizontally
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
884 else if (objtype == OBJ_THINGS)
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
885 {
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
886 flip_mirror(*list, OBJ_THINGS, 'm');
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
887 }
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
888 // Vertex -> Add linedef and split sector
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
889 else if (objtype == OBJ_VERTICES)
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
890 {
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
891 if (!(*list)->next || (*list)->next->next)
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
892 {
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
893 Beep();
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
894 Notify(-1, -1, "You must select exactly two vertices", 0);
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
895 }
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
896 else
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
897 {
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
898 SplitSector((*list)->next->objnum, (*list)->objnum);
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
899 ForgetSelection(list);
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
900 }
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 break;
0
241c93442be0 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
903
25
8eaf72e2041b Reindent the source using GNU indent and "indent -i4 -bli0 -npcs -nprs -npsl".
Matti Hamalainen <ccr@tnsp.org>
parents: 22
diff changeset
904 case 6:
33
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
905 // Linedef -> Flip
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
906 if (objtype == OBJ_LINEDEFS)
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
907 {
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
908 FlipLineDefs(*list, 1);
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
909 }
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
910 // Sector -> Distribute ceiling heights
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
911 else if (objtype == OBJ_SECTORS)
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
912 {
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
913 if (!(*list)->next || !(*list)->next->next)
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
914 {
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
915 Beep();
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
916 Notify(-1, -1, "You must select three or more sectors", 0);
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
917 }
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
918 else
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
919 {
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
920 DistributeSectorCeilings(*list);
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
921 }
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
922 }
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
923 // Things -> Mirror vertically
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
924 else if (objtype == OBJ_THINGS)
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
925 {
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
926 flip_mirror(*list, OBJ_THINGS, 'f');
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
927 }
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
928 // Vertex -> Mirror horizontally
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
929 else if (objtype == OBJ_VERTICES)
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
930 {
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
931 flip_mirror(*list, OBJ_VERTICES, 'm');
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
932 }
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
933 break;
0
241c93442be0 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
934
25
8eaf72e2041b Reindent the source using GNU indent and "indent -i4 -bli0 -npcs -nprs -npsl".
Matti Hamalainen <ccr@tnsp.org>
parents: 22
diff changeset
935 case 7:
33
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
936 // Linedefs -> Swap sidedefs
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
937 if (objtype == OBJ_LINEDEFS)
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
938 {
83
002bc70a3982 More cleanups. Mostly variable renames.
Matti Hamalainen <ccr@tnsp.org>
parents: 80
diff changeset
939 if (cfg.expert
80
2f1ecc1c5f72 Huge cleanup -- move some global variables into a struct.
Matti Hamalainen <ccr@tnsp.org>
parents: 66
diff changeset
940 || cfg.blindly_swap_sidedefs
33
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
941 || Confirm(-1, -1,
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
942 "Warning: the sector references are also swapped",
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
943 "You may get strange results if you don't know what you are doing..."))
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
944 FlipLineDefs(*list, 0);
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
945 }
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
946 // Sectors -> Raise or lower
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
947 else if (objtype == OBJ_SECTORS)
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
948 {
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
949 RaiseOrLowerSectors(*list);
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
950 }
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
951 // Vertices -> Mirror vertically
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
952 else if (objtype == OBJ_VERTICES)
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
953 {
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
954 flip_mirror(*list, OBJ_VERTICES, 'f');
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
955 }
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
956 break;
0
241c93442be0 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
957
25
8eaf72e2041b Reindent the source using GNU indent and "indent -i4 -bli0 -npcs -nprs -npsl".
Matti Hamalainen <ccr@tnsp.org>
parents: 22
diff changeset
958 case 8:
33
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
959 // Linedef -> Align textures vertically
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
960 if (objtype == OBJ_LINEDEFS)
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
961 {
66
794b7bb40d7f Initial work on cleaning up and improving the texture alignment functionality.
Matti Hamalainen <ccr@tnsp.org>
parents: 65
diff changeset
962 AlignTexturesMenu(250, 110, 1, list);
33
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
963 }
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
964 // Sector -> Brighten or darken
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
965 else if (objtype == OBJ_SECTORS)
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
966 {
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
967 BrightenOrDarkenSectors(*list);
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
968 }
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
969 break;
0
241c93442be0 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
970
25
8eaf72e2041b Reindent the source using GNU indent and "indent -i4 -bli0 -npcs -nprs -npsl".
Matti Hamalainen <ccr@tnsp.org>
parents: 22
diff changeset
971 case 9:
33
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
972 // Linedef -> Align texture horizontally
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
973 if (objtype == OBJ_LINEDEFS)
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
974 {
66
794b7bb40d7f Initial work on cleaning up and improving the texture alignment functionality.
Matti Hamalainen <ccr@tnsp.org>
parents: 65
diff changeset
975 AlignTexturesMenu(250, 110, 0, list);
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 // Sector -> Unlink room
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
978 else if (objtype == OBJ_SECTORS)
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
979 {
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
980 NotImplemented(); // FIXME
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
981 break;
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
982 }
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
983 break;
0
241c93442be0 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
984
25
8eaf72e2041b Reindent the source using GNU indent and "indent -i4 -bli0 -npcs -nprs -npsl".
Matti Hamalainen <ccr@tnsp.org>
parents: 22
diff changeset
985 case 10:
33
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
986 // Linedef -> Make linedef single-sided
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
987 if (objtype == OBJ_LINEDEFS)
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
988 {
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
989 SelPtr cur;
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
990 for (cur = *list; cur; cur = cur->next)
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
991 {
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
992 struct LineDef *l = LineDefs + cur->objnum;
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
993 l->sidedef2 = -1; /* remove ref. to 2nd SD */
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
994 l->flags &= ~0x04; /* clear "2S" bit */
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
995 l->flags |= 0x01; /* set "Im" bit */
0
241c93442be0 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
996
33
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
997 if (is_sidedef(l->sidedef1))
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
998 {
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
999 struct SideDef *s = SideDefs + l->sidedef1;
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
1000 strcpy(s->tex1, "-");
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
1001 strcpy(s->tex2, "-");
80
2f1ecc1c5f72 Huge cleanup -- move some global variables into a struct.
Matti Hamalainen <ccr@tnsp.org>
parents: 66
diff changeset
1002 strcpy(s->tex3, cfg.def.middle_texture);
33
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
1003 }
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
1004 /* Don't delete the 2nd sidedef, it could be used
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
1005 by another linedef. And if it isn't, the next
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
1006 cross-references check will delete it anyway. */
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
1007 }
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
1008 }
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
1009 // Sector -> Mirror horizontally
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
1010 else if (objtype == OBJ_SECTORS)
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
1011 {
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
1012 flip_mirror(*list, OBJ_SECTORS, 'm');
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
1013 }
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
1014 break;
0
241c93442be0 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
1015
25
8eaf72e2041b Reindent the source using GNU indent and "indent -i4 -bli0 -npcs -nprs -npsl".
Matti Hamalainen <ccr@tnsp.org>
parents: 22
diff changeset
1016 case 11:
33
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
1017 // Linedef -> Make rectangular nook
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
1018 if (objtype == OBJ_LINEDEFS)
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
1019 MakeRectangularNook(*list, 32, 16, 0);
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
1020 // Sector -> Mirror vertically
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
1021 else if (objtype == OBJ_SECTORS)
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
1022 {
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
1023 flip_mirror(*list, OBJ_SECTORS, 'f');
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
1024 }
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
1025 break;
0
241c93442be0 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
1026
25
8eaf72e2041b Reindent the source using GNU indent and "indent -i4 -bli0 -npcs -nprs -npsl".
Matti Hamalainen <ccr@tnsp.org>
parents: 22
diff changeset
1027 case 12:
33
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
1028 // Linedef -> Make rectangular boss
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
1029 if (objtype == OBJ_LINEDEFS)
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
1030 MakeRectangularNook(*list, 32, 16, 1);
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
1031 // Sector -> Swap flats
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
1032 else if (objtype == OBJ_SECTORS)
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
1033 swap_flats(*list);
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
1034 break;
0
241c93442be0 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
1035
25
8eaf72e2041b Reindent the source using GNU indent and "indent -i4 -bli0 -npcs -nprs -npsl".
Matti Hamalainen <ccr@tnsp.org>
parents: 22
diff changeset
1036 case 13:
33
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
1037 // Linedef -> Set length (1st vertex)
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
1038 if (objtype == OBJ_LINEDEFS)
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
1039 {
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
1040 static int length = 24;
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
1041 length = InputIntegerValue(-1, -1, -10000, 10000, length);
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
1042 if (length != IIV_CANCEL)
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
1043 SetLinedefLength(*list, length, 0);
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
1044 }
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
1045 break;
0
241c93442be0 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
1046
25
8eaf72e2041b Reindent the source using GNU indent and "indent -i4 -bli0 -npcs -nprs -npsl".
Matti Hamalainen <ccr@tnsp.org>
parents: 22
diff changeset
1047 case 14:
33
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
1048 // Linedef -> Set length (2nd vertex)
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
1049 if (objtype == OBJ_LINEDEFS)
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
1050 {
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
1051 static int length = 24;
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
1052 length = InputIntegerValue(-1, -1, -10000, 10000, length);
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
1053 if (length != IIV_CANCEL)
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
1054 SetLinedefLength(*list, length, 1);
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
1055 }
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
1056 break;
0
241c93442be0 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
1057
25
8eaf72e2041b Reindent the source using GNU indent and "indent -i4 -bli0 -npcs -nprs -npsl".
Matti Hamalainen <ccr@tnsp.org>
parents: 22
diff changeset
1058 case 15:
33
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
1059 // Linedef -> Unlink 1st sidedef
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
1060 if (objtype == OBJ_LINEDEFS)
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
1061 unlink_sidedef(*list, 1, 0);
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
1062 break;
0
241c93442be0 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
1063
25
8eaf72e2041b Reindent the source using GNU indent and "indent -i4 -bli0 -npcs -nprs -npsl".
Matti Hamalainen <ccr@tnsp.org>
parents: 22
diff changeset
1064 case 16:
33
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
1065 // Linedef -> Unlink 2nd sidedef
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
1066 if (objtype == OBJ_LINEDEFS)
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
1067 unlink_sidedef(*list, 0, 1);
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
1068 break;
0
241c93442be0 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
1069
25
8eaf72e2041b Reindent the source using GNU indent and "indent -i4 -bli0 -npcs -nprs -npsl".
Matti Hamalainen <ccr@tnsp.org>
parents: 22
diff changeset
1070 case 17:
33
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
1071 // Linedef -> Mirror horizontally
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
1072 flip_mirror(*list, OBJ_LINEDEFS, 'm');
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
1073 break;
0
241c93442be0 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
1074
25
8eaf72e2041b Reindent the source using GNU indent and "indent -i4 -bli0 -npcs -nprs -npsl".
Matti Hamalainen <ccr@tnsp.org>
parents: 22
diff changeset
1075 case 18:
33
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
1076 // Linedef -> Mirror vertically
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
1077 flip_mirror(*list, OBJ_LINEDEFS, 'f');
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
1078 break;
25
8eaf72e2041b Reindent the source using GNU indent and "indent -i4 -bli0 -npcs -nprs -npsl".
Matti Hamalainen <ccr@tnsp.org>
parents: 22
diff changeset
1079
8eaf72e2041b Reindent the source using GNU indent and "indent -i4 -bli0 -npcs -nprs -npsl".
Matti Hamalainen <ccr@tnsp.org>
parents: 22
diff changeset
1080 case 19:
33
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
1081 // Linedef -> 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
1082 if (objtype == OBJ_LINEDEFS)
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
1083 {
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
1084 if (!(*list)->next || (*list)->next->next)
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
1085 {
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
1086 Beep();
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
1087 Notify(-1, -1, "You must select exactly two linedefs", 0);
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
1088 }
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
1089 else
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
1090 {
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
1091 sector_slice((*list)->next->objnum, (*list)->objnum);
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
1092 ForgetSelection(list);
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
1093 }
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
1094 }
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
1095 break;
25
8eaf72e2041b Reindent the source using GNU indent and "indent -i4 -bli0 -npcs -nprs -npsl".
Matti Hamalainen <ccr@tnsp.org>
parents: 22
diff changeset
1096 }
0
241c93442be0 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
1097 }