updated readme
[divverent/nexuiz.git] / navnodeedit / src / menu.qc
1 /*\r
2 ==================================================\r
3 Menu.qc (originally) By: Chris Voss 3-18-99 (I simplified it a bit -Urre)\r
4 ==================================================\r
5 */\r
6 \r
7 void(entity navn, entity delplane) RemovePlane;\r
8 \r
9 void(float i) Select =\r
10 {\r
11         local entity e;\r
12 \r
13         if (self.confirm == C_DELETE_NAVNODE)\r
14         {\r
15                 if (i == 1)\r
16                 {\r
17                         if (self.current_navnode.plane_chain)\r
18                         {\r
19                                 e = self.current_navnode.plane_chain;\r
20                                 if (e)\r
21                                 {\r
22                                         e.think = SUB_Remove;\r
23                                         e.nextthink = time;\r
24                                         e = e.plane_next;\r
25                                         while (e != self.current_navnode.plane_chain)\r
26                                         {\r
27                                                 e.think = SUB_Remove;\r
28                                                 e.nextthink = time;\r
29                                                 e = e.plane_next;\r
30                                         }\r
31                                 }\r
32                         }\r
33                         e = navnode_chain;\r
34                         while (e)\r
35                         {\r
36                                 if (e.link0 == self.current_navnode)\r
37                                         PushLinks(e, 0);\r
38                                 else if (e.link1 == self.current_navnode)\r
39                                         PushLinks(e, 1);\r
40                                 else if (e.link2 == self.current_navnode)\r
41                                         PushLinks(e, 2);\r
42                                 else if (e.link3 == self.current_navnode)\r
43                                         PushLinks(e, 3);\r
44                                 else if (e.link4 == self.current_navnode)\r
45                                         PushLinks(e, 4);\r
46                                 else if (e.link5 == self.current_navnode)\r
47                                         PushLinks(e, 5);\r
48                                 else if (e.link6 == self.current_navnode)\r
49                                         PushLinks(e, 6);\r
50                                 else if (e.link7 == self.current_navnode)\r
51                                         PushLinks(e, 7);\r
52                                 else if (e.link8 == self.current_navnode)\r
53                                         PushLinks(e, 8);\r
54                                 else if (e.link9 == self.current_navnode)\r
55                                         PushLinks(e, 9);\r
56                                 else if (e.link10 == self.current_navnode)\r
57                                         PushLinks(e, 10);\r
58                                 else if (e.link11 == self.current_navnode)\r
59                                         PushLinks(e, 11);\r
60                                 else if (e.link12 == self.current_navnode)\r
61                                         PushLinks(e, 12);\r
62                                 else if (e.link13 == self.current_navnode)\r
63                                         PushLinks(e, 13);\r
64                                 else if (e.link14 == self.current_navnode)\r
65                                         PushLinks(e, 14);\r
66                                 else if (e.link15 == self.current_navnode)\r
67                                         PushLinks(e, 15);\r
68                                 else if (e.link16 == self.current_navnode)\r
69                                         PushLinks(e, 16);\r
70                                 else if (e.link17 == self.current_navnode)\r
71                                         PushLinks(e, 17);\r
72                                 else if (e.link18 == self.current_navnode)\r
73                                         PushLinks(e, 18);\r
74                                 else if (e.link19 == self.current_navnode)\r
75                                         PushLinks(e, 19);\r
76                                 e = e.list;\r
77                         }\r
78                         remove(self.current_navnode);\r
79                 }\r
80                 self.current_navnode = world;\r
81                 self.confirm = 0;\r
82                 self.lockselection = FALSE;\r
83                 return;\r
84         }\r
85         else if (self.confirm == C_DELETE_PLANE)\r
86         {\r
87                 if (i == 1)\r
88                         RemovePlane(self.current_navnode, self.current_plane);\r
89                 self.current_plane = world;\r
90                 self.confirm = 0;\r
91                 self.lockselection = FALSE;\r
92                 return;\r
93         }\r
94         centerprint(self, "\n");\r
95 };\r
96 \r
97 void() MainMenu =\r
98 {\r
99         local string s;\r
100 \r
101         if (self.menu_time < time)\r
102         {\r
103                 self.menu_time = time + 0.5;\r
104 \r
105                 if (!self.confirm)\r
106                 {\r
107                         if (self.current_navnode)\r
108                         {\r
109                                 s = strcat("^5Gridsize^7: ", ftos(self.gridsize));\r
110                                 s = strcat(s, "\n^2self^7.origin: ");\r
111                                 s = strcat(s, vtos(self.origin));\r
112                                 s = strcat(s, "\nCURRENT AXIS: ");\r
113                                 if (self.axis == 0)\r
114                                         s = strcat(s, "^4X^7");\r
115                                 else if (self.axis == 1)\r
116                                         s = strcat(s, "^3Y^7");\r
117                                 else if (self.axis == 2)\r
118                                         s = strcat(s, "^1Z^7");\r
119                                 if (self.current_navnode.sflags)\r
120                                 {\r
121                                         s = strcat(s, "\nnavnode.sflags:");\r
122                                         if (self.current_navnode.sflags & S_TELEPORT)\r
123                                                 s = strcat(s, " S_TELEPORT");\r
124                                         if (self.current_navnode.sflags & S_DOOR)\r
125                                                 s = strcat(s, " S_DOOR");\r
126                                         if (self.current_navnode.sflags & S_TOUCH)\r
127                                                 s = strcat(s, " S_TOUCH");\r
128                                 }\r
129                                 if (self.current_navnode.lflags0)\r
130                                 {\r
131                                         s = strcat(s, "\nnavnode.lflags0:");\r
132                                         if (self.current_navnode.lflags0 & LF_NOLINK)\r
133                                                 s = strcat(s, " LF_NOLINK");\r
134                                         if (self.current_navnode.lflags0 & LF_NOWALK)\r
135                                                 s = strcat(s, " LF_NOWALK");\r
136                                         if (self.current_navnode.lflags0 & LF_BAD)\r
137                                                 s = strcat(s, " LF_BAD");\r
138                                         if (self.current_navnode.lflags0 & LF_BIGDROP)\r
139                                                 s = strcat(s, " LF_BIGDROP");\r
140                                         if (self.current_navnode.lflags0 & LF_REMOTE)\r
141                                                 s = strcat(s, " LF_REMOTE");\r
142                                 }\r
143                                 if (self.current_navnode.lflags1)\r
144                                 {\r
145                                         s = strcat(s, "\nnavnode.lflags1:");\r
146                                         if (self.current_navnode.lflags1 & LF_NOLINK)\r
147                                                 s = strcat(s, " LF_NOLINK");\r
148                                         if (self.current_navnode.lflags1 & LF_NOWALK)\r
149                                                 s = strcat(s, " LF_NOWALK");\r
150                                         if (self.current_navnode.lflags1 & LF_BAD)\r
151                                                 s = strcat(s, " LF_BAD");\r
152                                         if (self.current_navnode.lflags1 & LF_BIGDROP)\r
153                                                 s = strcat(s, " LF_BIGDROP");\r
154                                         if (self.current_navnode.lflags1 & LF_REMOTE)\r
155                                                 s = strcat(s, " LF_REMOTE");\r
156                                 }\r
157                                 if (self.current_navnode.lflags2)\r
158                                 {\r
159                                         s = strcat(s, "\nnavnode.lflags2:");\r
160                                         if (self.current_navnode.lflags2 & LF_NOLINK)\r
161                                                 s = strcat(s, " LF_NOLINK");\r
162                                         if (self.current_navnode.lflags2 & LF_NOWALK)\r
163                                                 s = strcat(s, " LF_NOWALK");\r
164                                         if (self.current_navnode.lflags2 & LF_BAD)\r
165                                                 s = strcat(s, " LF_BAD");\r
166                                         if (self.current_navnode.lflags2 & LF_BIGDROP)\r
167                                                 s = strcat(s, " LF_BIGDROP");\r
168                                         if (self.current_navnode.lflags2 & LF_REMOTE)\r
169                                                 s = strcat(s, " LF_REMOTE");\r
170                                 }\r
171                                 if (self.current_navnode.lflags3)\r
172                                 {\r
173                                         s = strcat(s, "\nnavnode.lflags3:");\r
174                                         if (self.current_navnode.lflags3 & LF_NOLINK)\r
175                                                 s = strcat(s, " LF_NOLINK");\r
176                                         if (self.current_navnode.lflags3 & LF_NOWALK)\r
177                                                 s = strcat(s, " LF_NOWALK");\r
178                                         if (self.current_navnode.lflags3 & LF_BAD)\r
179                                                 s = strcat(s, " LF_BAD");\r
180                                         if (self.current_navnode.lflags3 & LF_BIGDROP)\r
181                                                 s = strcat(s, " LF_BIGDROP");\r
182                                         if (self.current_navnode.lflags3 & LF_REMOTE)\r
183                                                 s = strcat(s, " LF_REMOTE");\r
184                                 }\r
185                                 if (self.current_navnode.lflags4)\r
186                                 {\r
187                                         s = strcat(s, "\nnavnode.lflags4:");\r
188                                         if (self.current_navnode.lflags4 & LF_NOLINK)\r
189                                                 s = strcat(s, " LF_NOLINK");\r
190                                         if (self.current_navnode.lflags4 & LF_NOWALK)\r
191                                                 s = strcat(s, " LF_NOWALK");\r
192                                         if (self.current_navnode.lflags4 & LF_BAD)\r
193                                                 s = strcat(s, " LF_BAD");\r
194                                         if (self.current_navnode.lflags4 & LF_BIGDROP)\r
195                                                 s = strcat(s, " LF_BIGDROP");\r
196                                         if (self.current_navnode.lflags4 & LF_REMOTE)\r
197                                                 s = strcat(s, " LF_REMOTE");\r
198                                 }\r
199                                 if (self.current_navnode.lflags5)\r
200                                 {\r
201                                         s = strcat(s, "\nnavnode.lflags5:");\r
202                                         if (self.current_navnode.lflags5 & LF_NOLINK)\r
203                                                 s = strcat(s, " LF_NOLINK");\r
204                                         if (self.current_navnode.lflags5 & LF_NOWALK)\r
205                                                 s = strcat(s, " LF_NOWALK");\r
206                                         if (self.current_navnode.lflags5 & LF_BAD)\r
207                                                 s = strcat(s, " LF_BAD");\r
208                                         if (self.current_navnode.lflags5 & LF_BIGDROP)\r
209                                                 s = strcat(s, " LF_BIGDROP");\r
210                                         if (self.current_navnode.lflags5 & LF_REMOTE)\r
211                                                 s = strcat(s, " LF_REMOTE");\r
212                                 }\r
213                                 if (self.current_navnode.lflags6)\r
214                                 {\r
215                                         s = strcat(s, "\nnavnode.lflags6:");\r
216                                         if (self.current_navnode.lflags6 & LF_NOLINK)\r
217                                                 s = strcat(s, " LF_NOLINK");\r
218                                         if (self.current_navnode.lflags6 & LF_NOWALK)\r
219                                                 s = strcat(s, " LF_NOWALK");\r
220                                         if (self.current_navnode.lflags6 & LF_BAD)\r
221                                                 s = strcat(s, " LF_BAD");\r
222                                         if (self.current_navnode.lflags6 & LF_BIGDROP)\r
223                                                 s = strcat(s, " LF_BIGDROP");\r
224                                         if (self.current_navnode.lflags6 & LF_REMOTE)\r
225                                                 s = strcat(s, " LF_REMOTE");\r
226                                 }\r
227                                 if (self.current_navnode.lflags7)\r
228                                 {\r
229                                         s = strcat(s, "\nnavnode.lflags7:");\r
230                                         if (self.current_navnode.lflags7 & LF_NOLINK)\r
231                                                 s = strcat(s, " LF_NOLINK");\r
232                                         if (self.current_navnode.lflags7 & LF_NOWALK)\r
233                                                 s = strcat(s, " LF_NOWALK");\r
234                                         if (self.current_navnode.lflags7 & LF_BAD)\r
235                                                 s = strcat(s, " LF_BAD");\r
236                                         if (self.current_navnode.lflags7 & LF_BIGDROP)\r
237                                                 s = strcat(s, " LF_BIGDROP");\r
238                                         if (self.current_navnode.lflags7 & LF_REMOTE)\r
239                                                 s = strcat(s, " LF_REMOTE");\r
240                                 }\r
241                                 if (self.current_navnode.lflags8)\r
242                                 {\r
243                                         s = strcat(s, "\nnavnode.lflags8:");\r
244                                         if (self.current_navnode.lflags8 & LF_NOLINK)\r
245                                                 s = strcat(s, " LF_NOLINK");\r
246                                         if (self.current_navnode.lflags8 & LF_NOWALK)\r
247                                                 s = strcat(s, " LF_NOWALK");\r
248                                         if (self.current_navnode.lflags8 & LF_BAD)\r
249                                                 s = strcat(s, " LF_BAD");\r
250                                         if (self.current_navnode.lflags8 & LF_BIGDROP)\r
251                                                 s = strcat(s, " LF_BIGDROP");\r
252                                         if (self.current_navnode.lflags8 & LF_REMOTE)\r
253                                                 s = strcat(s, " LF_REMOTE");\r
254                                 }\r
255                                 if (self.current_navnode.lflags9)\r
256                                 {\r
257                                         s = strcat(s, "\nnavnode.lflags9:");\r
258                                         if (self.current_navnode.lflags9 & LF_NOLINK)\r
259                                                 s = strcat(s, " LF_NOLINK");\r
260                                         if (self.current_navnode.lflags9 & LF_NOWALK)\r
261                                                 s = strcat(s, " LF_NOWALK");\r
262                                         if (self.current_navnode.lflags9 & LF_BAD)\r
263                                                 s = strcat(s, " LF_BAD");\r
264                                         if (self.current_navnode.lflags9 & LF_BIGDROP)\r
265                                                 s = strcat(s, " LF_BIGDROP");\r
266                                         if (self.current_navnode.lflags9 & LF_REMOTE)\r
267                                                 s = strcat(s, " LF_REMOTE");\r
268                                 }\r
269                                 if (self.current_navnode.lflags10)\r
270                                 {\r
271                                         s = strcat(s, "\nnavnode.lflags10:");\r
272                                         if (self.current_navnode.lflags10 & LF_NOLINK)\r
273                                                 s = strcat(s, " LF_NOLINK");\r
274                                         if (self.current_navnode.lflags10 & LF_NOWALK)\r
275                                                 s = strcat(s, " LF_NOWALK");\r
276                                         if (self.current_navnode.lflags10 & LF_BAD)\r
277                                                 s = strcat(s, " LF_BAD");\r
278                                         if (self.current_navnode.lflags10 & LF_BIGDROP)\r
279                                                 s = strcat(s, " LF_BIGDROP");\r
280                                         if (self.current_navnode.lflags10 & LF_REMOTE)\r
281                                                 s = strcat(s, " LF_REMOTE");\r
282                                 }\r
283                                 if (self.current_navnode.lflags11)\r
284                                 {\r
285                                         s = strcat(s, "\nnavnode.lflags11:");\r
286                                         if (self.current_navnode.lflags11 & LF_NOLINK)\r
287                                                 s = strcat(s, " LF_NOLINK");\r
288                                         if (self.current_navnode.lflags11 & LF_NOWALK)\r
289                                                 s = strcat(s, " LF_NOWALK");\r
290                                         if (self.current_navnode.lflags11 & LF_BAD)\r
291                                                 s = strcat(s, " LF_BAD");\r
292                                         if (self.current_navnode.lflags11 & LF_BIGDROP)\r
293                                                 s = strcat(s, " LF_BIGDROP");\r
294                                         if (self.current_navnode.lflags11 & LF_REMOTE)\r
295                                                 s = strcat(s, " LF_REMOTE");\r
296                                 }\r
297                                 if (self.current_navnode.lflags12)\r
298                                 {\r
299                                         s = strcat(s, "\nnavnode.lflags12:");\r
300                                         if (self.current_navnode.lflags12 & LF_NOLINK)\r
301                                                 s = strcat(s, " LF_NOLINK");\r
302                                         if (self.current_navnode.lflags12 & LF_NOWALK)\r
303                                                 s = strcat(s, " LF_NOWALK");\r
304                                         if (self.current_navnode.lflags12 & LF_BAD)\r
305                                                 s = strcat(s, " LF_BAD");\r
306                                         if (self.current_navnode.lflags12 & LF_BIGDROP)\r
307                                                 s = strcat(s, " LF_BIGDROP");\r
308                                         if (self.current_navnode.lflags12 & LF_REMOTE)\r
309                                                 s = strcat(s, " LF_REMOTE");\r
310                                 }\r
311                                 if (self.current_navnode.lflags13)\r
312                                 {\r
313                                         s = strcat(s, "\nnavnode.lflags13:");\r
314                                         if (self.current_navnode.lflags13 & LF_NOLINK)\r
315                                                 s = strcat(s, " LF_NOLINK");\r
316                                         if (self.current_navnode.lflags13 & LF_NOWALK)\r
317                                                 s = strcat(s, " LF_NOWALK");\r
318                                         if (self.current_navnode.lflags13 & LF_BAD)\r
319                                                 s = strcat(s, " LF_BAD");\r
320                                         if (self.current_navnode.lflags13 & LF_BIGDROP)\r
321                                                 s = strcat(s, " LF_BIGDROP");\r
322                                         if (self.current_navnode.lflags13 & LF_REMOTE)\r
323                                                 s = strcat(s, " LF_REMOTE");\r
324                                 }\r
325                                 if (self.current_navnode.lflags14)\r
326                                 {\r
327                                         s = strcat(s, "\nnavnode.lflags14:");\r
328                                         if (self.current_navnode.lflags14 & LF_NOLINK)\r
329                                                 s = strcat(s, " LF_NOLINK");\r
330                                         if (self.current_navnode.lflags14 & LF_NOWALK)\r
331                                                 s = strcat(s, " LF_NOWALK");\r
332                                         if (self.current_navnode.lflags14 & LF_BAD)\r
333                                                 s = strcat(s, " LF_BAD");\r
334                                         if (self.current_navnode.lflags14 & LF_BIGDROP)\r
335                                                 s = strcat(s, " LF_BIGDROP");\r
336                                         if (self.current_navnode.lflags14 & LF_REMOTE)\r
337                                                 s = strcat(s, " LF_REMOTE");\r
338                                 }\r
339                                 if (self.current_navnode.lflags15)\r
340                                 {\r
341                                         s = strcat(s, "\nnavnode.lflags15:");\r
342                                         if (self.current_navnode.lflags15 & LF_NOLINK)\r
343                                                 s = strcat(s, " LF_NOLINK");\r
344                                         if (self.current_navnode.lflags15 & LF_NOWALK)\r
345                                                 s = strcat(s, " LF_NOWALK");\r
346                                         if (self.current_navnode.lflags15 & LF_BAD)\r
347                                                 s = strcat(s, " LF_BAD");\r
348                                         if (self.current_navnode.lflags15 & LF_BIGDROP)\r
349                                                 s = strcat(s, " LF_BIGDROP");\r
350                                         if (self.current_navnode.lflags15 & LF_REMOTE)\r
351                                                 s = strcat(s, " LF_REMOTE");\r
352                                 }\r
353                                 if (self.current_navnode.lflags16)\r
354                                 {\r
355                                         s = strcat(s, "\nnavnode.lflags16:");\r
356                                         if (self.current_navnode.lflags16 & LF_NOLINK)\r
357                                                 s = strcat(s, " LF_NOLINK");\r
358                                         if (self.current_navnode.lflags16 & LF_NOWALK)\r
359                                                 s = strcat(s, " LF_NOWALK");\r
360                                         if (self.current_navnode.lflags16 & LF_BAD)\r
361                                                 s = strcat(s, " LF_BAD");\r
362                                         if (self.current_navnode.lflags16 & LF_BIGDROP)\r
363                                                 s = strcat(s, " LF_BIGDROP");\r
364                                         if (self.current_navnode.lflags16 & LF_REMOTE)\r
365                                                 s = strcat(s, " LF_REMOTE");\r
366                                 }\r
367                                 if (self.current_navnode.lflags17)\r
368                                 {\r
369                                         s = strcat(s, "\nnavnode.lflags17:");\r
370                                         if (self.current_navnode.lflags17 & LF_NOLINK)\r
371                                                 s = strcat(s, " LF_NOLINK");\r
372                                         if (self.current_navnode.lflags17 & LF_NOWALK)\r
373                                                 s = strcat(s, " LF_NOWALK");\r
374                                         if (self.current_navnode.lflags17 & LF_BAD)\r
375                                                 s = strcat(s, " LF_BAD");\r
376                                         if (self.current_navnode.lflags17 & LF_BIGDROP)\r
377                                                 s = strcat(s, " LF_BIGDROP");\r
378                                         if (self.current_navnode.lflags17 & LF_REMOTE)\r
379                                                 s = strcat(s, " LF_REMOTE");\r
380                                 }\r
381                                 if (self.current_navnode.lflags18)\r
382                                 {\r
383                                         s = strcat(s, "\nnavnode.lflags18:");\r
384                                         if (self.current_navnode.lflags18 & LF_NOLINK)\r
385                                                 s = strcat(s, " LF_NOLINK");\r
386                                         if (self.current_navnode.lflags18 & LF_NOWALK)\r
387                                                 s = strcat(s, " LF_NOWALK");\r
388                                         if (self.current_navnode.lflags18 & LF_BAD)\r
389                                                 s = strcat(s, " LF_BAD");\r
390                                         if (self.current_navnode.lflags18 & LF_BIGDROP)\r
391                                                 s = strcat(s, " LF_BIGDROP");\r
392                                         if (self.current_navnode.lflags18 & LF_REMOTE)\r
393                                                 s = strcat(s, " LF_REMOTE");\r
394                                 }\r
395                                 if (self.current_navnode.lflags19)\r
396                                 {\r
397                                         s = strcat(s, "\nnavnode.lflags19:");\r
398                                         if (self.current_navnode.lflags19 & LF_NOLINK)\r
399                                                 s = strcat(s, " LF_NOLINK");\r
400                                         if (self.current_navnode.lflags19 & LF_NOWALK)\r
401                                                 s = strcat(s, " LF_NOWALK");\r
402                                         if (self.current_navnode.lflags19 & LF_BAD)\r
403                                                 s = strcat(s, " LF_BAD");\r
404                                         if (self.current_navnode.lflags19 & LF_BIGDROP)\r
405                                                 s = strcat(s, " LF_BIGDROP");\r
406                                         if (self.current_navnode.lflags19 & LF_REMOTE)\r
407                                                 s = strcat(s, " LF_REMOTE");\r
408                                 }\r
409                                 s = strcat(s, "\n^6NavNode^7.origin: ");\r
410                                 s = strcat(s, vtos(self.current_navnode.origin));\r
411                                 s = strcat(s, "\n^6NavNode^7.absmin: ");\r
412                                 s = strcat(s, vtos(self.current_navnode.origin + self.current_navnode.mins));\r
413                                 s = strcat(s, "\n^6NavNode^7.absmax: ");\r
414                                 s = strcat(s, vtos(self.current_navnode.origin + self.current_navnode.maxs));\r
415                                 s = strcat(s, "\n");\r
416                                 centerprint(self, s);\r
417                         }\r
418                         else\r
419                         {\r
420                                 s = strcat("^5Gridsize^7: ", ftos(self.gridsize));\r
421                                 s = strcat(s, "\n^2Self^7.origin: ");\r
422                                 s = strcat(s, vtos(self.origin));\r
423                                 s = strcat(s, "\nCURRENT AXIS: ");\r
424                                 if (self.axis == 0)\r
425                                         s = strcat(s, "^4X^7");\r
426                                 else if (self.axis == 1)\r
427                                         s = strcat(s, "^3Y^7");\r
428                                 else if (self.axis == 2)\r
429                                         s = strcat(s, "^1Z^7");\r
430                                 s = strcat(s, "\n");\r
431                                 centerprint(self, s);\r
432                         }\r
433                 }\r
434                 else if (self.confirm == C_DELETE_NAVNODE)\r
435                         centerprint(self, "Are you sure you wish to delete this NavNode?\n^11. Yes\n^42. No\n^7");\r
436                 else if (self.confirm == C_DELETE_PLANE)\r
437                         centerprint(self, "Are you sure you wish to delete this Plane?\n^11. Yes\n^42. No\n^7");\r
438         }\r
439 };