1 // Emacs style mode select -*- C++ -*-
2 //-----------------------------------------------------------------------------
3 //
4 // $Id:$
5 //
6 // Copyright (C) 1993-1996 by id Software, Inc.
7 //
8 // This source is available for distribution and/or modification
9 // only under the terms of the DOOM Source Code License as
10 // published by id Software. All rights reserved.
11 //
12 // The source is distributed in the hope that it will be useful,
13 // but WITHOUT ANY WARRANTY; without even the implied warranty of
14 // FITNESS FOR A PARTICULAR PURPOSE. See the DOOM Source Code License
15 // for more details.
16 //
17 // $Log:$
18 //
19 // DESCRIPTION:
20 // Cheat code. See *_sbar.cpp for status bars.
21 //
22 //-----------------------------------------------------------------------------
23
24 #include "d_protocol.h"
25 #include "gstrings.h"
26 #include "c_cvars.h"
27 #include "c_dispatch.h"
28 #include "d_event.h"
29 #include "gi.h"
30 #include "d_net.h"
31 #include "doomstat.h"
32 #include "g_level.h"
33
34 EXTERN_CVAR (Bool, ticker);
35 EXTERN_CVAR (Bool, noisedebug);
36 EXTERN_CVAR (Int, am_cheat);
37
38 struct cheatseq_t
39 {
40 BYTE *Sequence;
41 BYTE *Pos;
42 BYTE DontCheck;
43 BYTE CurrentArg;
44 BYTE Args[2];
45 bool (*Handler)(cheatseq_t *);
46 };
47
48 static bool CheatCheckList (event_t *ev, cheatseq_t *cheats, int numcheats);
49 static bool CheatAddKey (cheatseq_t *cheat, BYTE key, bool *eat);
50 static bool Cht_Generic (cheatseq_t *);
51 static bool Cht_Music (cheatseq_t *);
52 static bool Cht_BeholdMenu (cheatseq_t *);
53 static bool Cht_PumpupMenu (cheatseq_t *);
54 static bool Cht_AutoMap (cheatseq_t *);
55 static bool Cht_ChangeLevel (cheatseq_t *);
56 static bool Cht_ChangeStartSpot (cheatseq_t *);
57 static bool Cht_WarpTransLevel (cheatseq_t *);
58 static bool Cht_MyPos (cheatseq_t *);
59 static bool Cht_Sound (cheatseq_t *);
60 static bool Cht_Ticker (cheatseq_t *);
61
62 BYTE CheatPowerup[7][10] =
63 {
64 { 'i','d','b','e','h','o','l','d','v', 255 },
65 { 'i','d','b','e','h','o','l','d','s', 255 },
66 { 'i','d','b','e','h','o','l','d','i', 255 },
67 { 'i','d','b','e','h','o','l','d','r', 255 },
68 { 'i','d','b','e','h','o','l','d','a', 255 },
69 { 'i','d','b','e','h','o','l','d','l', 255 },
70 { 'i','d','b','e','h','o','l','d', 255 },
71 };
72 BYTE CheatPowerup1[11][7] =
73 {
74 { 'g','i','m','m','e','a',255 },
75 { 'g','i','m','m','e','b',255 },
76 { 'g','i','m','m','e','c',255 },
77 { 'g','i','m','m','e','d',255 },
78 { 'g','i','m','m','e','e',255 },
79 { 'g','i','m','m','e','f',255 },
80 { 'g','i','m','m','e','g',255 },
81 { 'g','i','m','m','e','h',255 },
82 { 'g','i','m','m','e','i',255 },
83 { 'g','i','m','m','e','j',255 },
84 { 'g','i','m','m','e','z',255 },
85 };
86 BYTE CheatPowerup2[8][10] =
87 {
88 { 'p','u','m','p','u','p','b',255 },
89 { 'p','u','m','p','u','p','i',255 },
90 { 'p','u','m','p','u','p','m',255 },
91 { 'p','u','m','p','u','p','h',255 },
92 { 'p','u','m','p','u','p','p',255 },
93 { 'p','u','m','p','u','p','s',255 },
94 { 'p','u','m','p','u','p','t',255 },
95 { 'p','u','m','p','u','p',255 },
96 };
97
98 // Smashing Pumpkins Into Small Piles Of Putrid Debris.
99 static BYTE CheatNoclip[] = { 'i','d','s','p','i','s','p','o','p','d',255 };
100 static BYTE CheatNoclip2[] = { 'i','d','c','l','i','p',255 };
101 static BYTE CheatMus[] = { 'i','d','m','u','s',0,0,255 };
102 static BYTE CheatChoppers[] = { 'i','d','c','h','o','p','p','e','r','s',255 };
103 static BYTE CheatGod[] = { 'i','d','d','q','d',255 };
104 static BYTE CheatAmmo[] = { 'i','d','k','f','a',255 };
105 static BYTE CheatAmmoNoKey[] = { 'i','d','f','a',255 };
106 static BYTE CheatClev[] = { 'i','d','c','l','e','v',0,0,255 };
107 static BYTE CheatMypos[] = { 'i','d','m','y','p','o','s',255 };
108 static BYTE CheatAmap[] = { 'i','d','d','t',255 };
109
110 static BYTE CheatQuicken[] = { 'q','u','i','c','k','e','n',255 };
111 static BYTE CheatKitty[] = { 'k','i','t','t','y',255 };
112 static BYTE CheatRambo[] = { 'r','a','m','b','o',255 };
113 static BYTE CheatShazam[] = { 's','h','a','z','a','m',255 };
114 static BYTE CheatPonce[] = { 'p','o','n','c','e',255 };
115 static BYTE CheatSkel[] = { 's','k','e','l',255 };
116 static BYTE CheatNoise[] = { 'n','o','i','s','e',255 };
117 static BYTE CheatTicker[] = { 't','i','c','k','e','r',255 };
118 static BYTE CheatEngage[] = { 'e','n','g','a','g','e',0,0,255 };
119 static BYTE CheatChicken[] = { 'c','o','c','k','a','d','o','o','d','l','e','d','o','o',255 };
120 static BYTE CheatMassacre[] = { 'm','a','s','s','a','c','r','e',255 };
121 static BYTE CheatRavMap[] = { 'r','a','v','m','a','p',255 };
122
123 static BYTE CheatSatan[] = { 's','a','t','a','n',255 };
124 static BYTE CheatCasper[] = { 'c','a','s','p','e','r',255 };
125 static BYTE CheatNRA[] = { 'n','r','a',255 };
126 static BYTE CheatClubMed[] = { 'c','l','u','b','m','e','d',255 };
127 static BYTE CheatLocksmith[] = { 'l','o','c','k','s','m','i','t','h',255 };
128 static BYTE CheatIndiana[] = { 'i','n','d','i','a','n','a',255 };
129 static BYTE CheatSherlock[] = { 's','h','e','r','l','o','c','k',255 };
130 static BYTE CheatVisit[] = { 'v','i','s','i','t',0,0,255 };
131 static BYTE CheatPig[] = { 'd','e','l','i','v','e','r','a','n','c','e',255 };
132 static BYTE CheatButcher[] = { 'b','u','t','c','h','e','r',255 };
133 static BYTE CheatConan[] = { 'c','o','n','a','n',255 };
134 static BYTE CheatMapsco[] = { 'm','a','p','s','c','o',255 };
135 static BYTE CheatWhere[] = { 'w','h','e','r','e',255 };
136 #if 0
137 static BYTE CheatClass1[] = { 's','h','a','d','o','w','c','a','s','t','e','r',255 };
138 static BYTE CheatClass2[] = { 's','h','a','d','o','w','c','a','s','t','e','r',0,255 };
139 static BYTE CheatInit[] = { 'i','n','i','t',255 };
140 static BYTE CheatScript1[] = { 'p','u','k','e',255 };
141 static BYTE CheatScript2[] = { 'p','u','k','e',0,255 };
142 static BYTE CheatScript3[] = { 'p','u','k','e',0,0,255 };
143 #endif
144
145 static BYTE CheatSpin[] = { 's','p','i','n',0,0,255 };
146 static BYTE CheatRift[] = { 'r','i','f','t',0,0,255 };
147 static BYTE CheatGPS[] = { 'g','p','s',255 };
148 static BYTE CheatGripper[] = { 'g','r','i','p','p','e','r',255 };
149 static BYTE CheatLego[] = { 'l','e','g','o',255 };
150 static BYTE CheatDots[] = { 'd','o','t','s',255 };
151 static BYTE CheatScoot[] = { 's','c','o','o','t',0,255 };
152 static BYTE CheatDonnyTrump[] = { 'd','o','n','n','y','t','r','u','m','p',255 };
153 static BYTE CheatOmnipotent[] = { 'o','m','n','i','p','o','t','e','n','t',255 };
154 static BYTE CheatJimmy[] = { 'j','i','m','m','y',255 };
155 static BYTE CheatBoomstix[] = { 'b','o','o','m','s','t','i','x',255 };
156 static BYTE CheatStoneCold[] = { 's','t','o','n','e','c','o','l','d',255 };
157 static BYTE CheatElvis[] = { 'e','l','v','i','s',255 };
158 static BYTE CheatTopo[] = { 't','o','p','o',255 };
159
160 //[BL] Graf will probably get rid of this
161 static BYTE CheatJoelKoenigs[] = { 'j','o','e','l','k','o','e','n','i','g','s',255 };
162 static BYTE CheatDavidBrus[] = { 'd','a','v','i','d','b','r','u','s',255 };
163 static BYTE CheatScottHolman[] = { 's','c','o','t','t','h','o','l','m','a','n',255 };
164 static BYTE CheatMikeKoenigs[] = { 'm','i','k','e','k','o','e','n','i','g','s',255 };
165 static BYTE CheatCharlesJacobi[] = { 'c','h','a','r','l','e','s','j','a','c','o','b','i',255 };
166 static BYTE CheatAndrewBenson[] = { 'a','n','d','r','e','w','b','e','n','s','o','n',255 };
167 static BYTE CheatDeanHyers[] = { 'd','e','a','n','h','y','e','r','s',255 };
168 static BYTE CheatMaryBregi[] = { 'm','a','r','y','b','r','e','g','i',255 };
169 static BYTE CheatAllen[] = { 'a','l','l','e','n',255 };
170 static BYTE CheatDigitalCafe[] = { 'd','i','g','i','t','a','l','c','a','f','e',255 };
171 static BYTE CheatJoshuaStorms[] = { 'j','o','s','h','u','a','s','t','o','r','m','s',255 };
172 static BYTE CheatLeeSnyder[] = { 'l','e','e','s','n','y','d','e','r',0,0,255 };
173 static BYTE CheatKimHyers[] = { 'k','i','m','h','y','e','r','s',255 };
174 static BYTE CheatShrrill[] = { 's','h','e','r','r','i','l','l',255 };
175
176 static BYTE CheatTNTem[] = { 't','n','t','e','m',255 };
177
178 static cheatseq_t DoomCheats[] =
179 {
180 { CheatMus, 0, 1, 0, {0,0}, Cht_Music },
181 { CheatPowerup[6], 0, 1, 0, {0,0}, Cht_BeholdMenu },
182 { CheatMypos, 0, 1, 0, {0,0}, Cht_MyPos },
183 { CheatAmap, 0, 0, 0, {0,0}, Cht_AutoMap },
184 { CheatGod, 0, 0, 0, {CHT_IDDQD,0}, Cht_Generic },
185 { CheatAmmo, 0, 0, 0, {CHT_IDKFA,0}, Cht_Generic },
186 { CheatAmmoNoKey, 0, 0, 0, {CHT_IDFA,0}, Cht_Generic },
187 { CheatNoclip, 0, 0, 0, {CHT_NOCLIP,0}, Cht_Generic },
188 { CheatNoclip2, 0, 0, 0, {CHT_NOCLIP,0}, Cht_Generic },
189 { CheatPowerup[0], 0, 0, 0, {CHT_BEHOLDV,0}, Cht_Generic },
190 { CheatPowerup[1], 0, 0, 0, {CHT_BEHOLDS,0}, Cht_Generic },
191 { CheatPowerup[2], 0, 0, 0, {CHT_BEHOLDI,0}, Cht_Generic },
192 { CheatPowerup[3], 0, 0, 0, {CHT_BEHOLDR,0}, Cht_Generic },
193 { CheatPowerup[4], 0, 0, 0, {CHT_BEHOLDA,0}, Cht_Generic },
194 { CheatPowerup[5], 0, 0, 0, {CHT_BEHOLDL,0}, Cht_Generic },
195 { CheatChoppers, 0, 0, 0, {CHT_CHAINSAW,0}, Cht_Generic },
196 { CheatClev, 0, 1, 0, {0,0}, Cht_ChangeLevel }
197 };
198
199 static cheatseq_t HereticCheats[] =
200 {
201 { CheatNoise, 0, 1, 0, {0,0}, Cht_Sound },
202 { CheatTicker, 0, 1, 0, {0,0}, Cht_Ticker },
203 { CheatRavMap, 0, 0, 0, {0,0}, Cht_AutoMap },
204 { CheatQuicken, 0, 0, 0, {CHT_GOD,0}, Cht_Generic },
205 { CheatKitty, 0, 0, 0, {CHT_NOCLIP,0}, Cht_Generic },
206 { CheatRambo, 0, 0, 0, {CHT_IDFA,0}, Cht_Generic },
207 { CheatShazam, 0, 0, 0, {CHT_POWER,0}, Cht_Generic },
208 { CheatPonce, 0, 0, 0, {CHT_HEALTH,0}, Cht_Generic },
209 { CheatSkel, 0, 0, 0, {CHT_KEYS,0}, Cht_Generic },
210 { CheatChicken, 0, 0, 0, {CHT_MORPH,0}, Cht_Generic },
211 { CheatMassacre, 0, 0, 0, {CHT_MASSACRE,0}, Cht_Generic },
212 { CheatEngage, 0, 1, 0, {0,0}, Cht_ChangeLevel },
213 { CheatPowerup1[0], 0, 0, 0, {CHT_GIMMIEA,0}, Cht_Generic },
214 { CheatPowerup1[1], 0, 0, 0, {CHT_GIMMIEB,0}, Cht_Generic },
215 { CheatPowerup1[2], 0, 0, 0, {CHT_GIMMIEC,0}, Cht_Generic },
216 { CheatPowerup1[3], 0, 0, 0, {CHT_GIMMIED,0}, Cht_Generic },
217 { CheatPowerup1[4], 0, 0, 0, {CHT_GIMMIEE,0}, Cht_Generic },
218 { CheatPowerup1[5], 0, 0, 0, {CHT_GIMMIEF,0}, Cht_Generic },
219 { CheatPowerup1[6], 0, 0, 0, {CHT_GIMMIEG,0}, Cht_Generic },
220 { CheatPowerup1[7], 0, 0, 0, {CHT_GIMMIEH,0}, Cht_Generic },
221 { CheatPowerup1[8], 0, 0, 0, {CHT_GIMMIEI,0}, Cht_Generic },
222 { CheatPowerup1[9], 0, 0, 0, {CHT_GIMMIEJ,0}, Cht_Generic },
223 { CheatPowerup1[10], 0, 0, 0, {CHT_GIMMIEZ,0}, Cht_Generic },
224 { CheatAmmo, 0, 0, 0, {CHT_TAKEWEAPS,0}, Cht_Generic },
225 { CheatGod, 0, 0, 0, {CHT_NOWUDIE,0}, Cht_Generic },
226 };
227
228 static cheatseq_t HexenCheats[] =
229 {
230 { CheatSatan, 0, 0, 0, {CHT_GOD,0}, Cht_Generic },
231 { CheatCasper, 0, 0, 0, {CHT_NOCLIP,0}, Cht_Generic },
232 { CheatNRA, 0, 0, 0, {CHT_IDFA,0}, Cht_Generic },
233 { CheatClubMed, 0, 0, 0, {CHT_HEALTH,0}, Cht_Generic },
234 { CheatLocksmith, 0, 0, 0, {CHT_KEYS,0}, Cht_Generic },
235 { CheatIndiana, 0, 0, 0, {CHT_ALLARTI,0}, Cht_Generic },
236 { CheatSherlock, 0, 0, 0, {CHT_PUZZLE,0}, Cht_Generic },
237 { CheatVisit, 0, 0, 0, {0,0}, Cht_WarpTransLevel },
238 { CheatPig, 0, 0, 0, {CHT_MORPH,0}, Cht_Generic },
239 { CheatButcher, 0, 0, 0, {CHT_MASSACRE,0}, Cht_Generic },
240 { CheatConan, 0, 0, 0, {CHT_TAKEWEAPS,0}, Cht_Generic },
241 { CheatWhere, 0, 1, 0, {0,0}, Cht_MyPos },
242 { CheatMapsco, 0, 0, 0, {0,0}, Cht_AutoMap }
243 };
244
245 static cheatseq_t StrifeCheats[] =
246 {
247 { CheatSpin, 0, 1, 0, {0,0}, Cht_Music },
248 { CheatGPS, 0, 1, 0, {0,0}, Cht_MyPos },
249 { CheatTopo, 0, 0, 0, {0,0}, Cht_AutoMap },
250 { CheatDots, 0, 1, 0, {0,0}, Cht_Ticker },
251 { CheatOmnipotent, 0, 0, 0, {CHT_IDDQD,0}, Cht_Generic },
252 { CheatGripper, 0, 0, 0, {CHT_NOVELOCITY,0},Cht_Generic },
253 { CheatJimmy, 0, 0, 0, {CHT_KEYS,0}, Cht_Generic },
254 { CheatBoomstix, 0, 0, 0, {CHT_IDFA,0}, Cht_Generic },
255 { CheatElvis, 0, 0, 0, {CHT_NOCLIP,0}, Cht_Generic },
256 { CheatStoneCold, 0, 0, 0, {CHT_MASSACRE,0}, Cht_Generic },
257 { CheatPowerup2[7], 0, 1, 0, {0,0}, Cht_PumpupMenu },
258 { CheatPowerup2[0], 0, 0, 0, {CHT_BEHOLDS,0}, Cht_Generic },
259 { CheatPowerup2[1], 0, 0, 0, {CHT_PUMPUPI,0}, Cht_Generic },
260 { CheatPowerup2[2], 0, 0, 0, {CHT_PUMPUPM,0}, Cht_Generic },
261 { CheatPowerup2[3], 0, 0, 0, {CHT_PUMPUPH,0}, Cht_Generic },
262 { CheatPowerup2[4], 0, 0, 0, {CHT_PUMPUPP,0}, Cht_Generic },
263 { CheatPowerup2[5], 0, 0, 0, {CHT_PUMPUPS,0}, Cht_Generic },
264 { CheatPowerup2[6], 0, 0, 0, {CHT_PUMPUPT,0}, Cht_Generic },
265 { CheatRift, 0, 1, 0, {0,0}, Cht_ChangeLevel },
266 { CheatDonnyTrump, 0, 0, 0, {CHT_DONNYTRUMP,0},Cht_Generic },
267 { CheatScoot, 0, 0, 0, {0,0}, Cht_ChangeStartSpot },
268 { CheatLego, 0, 0, 0, {CHT_LEGO,0}, Cht_Generic },
269 };
270
271 static cheatseq_t ChexCheats[] =
272 {
273 { CheatKimHyers, 0, 1, 0, {0,0}, Cht_MyPos },
274 { CheatShrrill, 0, 0, 0, {0,0}, Cht_AutoMap },
275 { CheatDavidBrus, 0, 0, 0, {CHT_IDDQD,0}, Cht_Generic },
276 { CheatScottHolman, 0, 0, 0, {CHT_IDKFA,0}, Cht_Generic },
277 { CheatMikeKoenigs, 0, 0, 0, {CHT_IDFA,0}, Cht_Generic },
278 { CheatCharlesJacobi, 0, 0, 0, {CHT_NOCLIP,0}, Cht_Generic },
279 { CheatAndrewBenson, 0, 0, 0, {CHT_BEHOLDV,0}, Cht_Generic },
280 { CheatDeanHyers, 0, 0, 0, {CHT_BEHOLDS,0}, Cht_Generic },
281 { CheatMaryBregi, 0, 0, 0, {CHT_BEHOLDI,0}, Cht_Generic },
282 { CheatAllen, 0, 0, 0, {CHT_BEHOLDR,0}, Cht_Generic },
283 { CheatDigitalCafe, 0, 0, 0, {CHT_BEHOLDA,0}, Cht_Generic },
284 { CheatJoshuaStorms, 0, 0, 0, {CHT_BEHOLDL,0}, Cht_Generic },
285 { CheatJoelKoenigs, 0, 0, 0, {CHT_CHAINSAW,0}, Cht_Generic },
286 { CheatLeeSnyder, 0, 1, 0, {0,0}, Cht_ChangeLevel },
287 { CheatMus, 0, 1, 0, {0,0}, Cht_Music },
288 };
289
290 static cheatseq_t SpecialCheats[] =
291 {
292 { CheatTNTem, 0, 0, 0, {CHT_MASSACRE,0}, Cht_Generic }
293 };
294
295
296
CVAR(Bool,allcheats,false,CVAR_ARCHIVE)297 CVAR(Bool, allcheats, false, CVAR_ARCHIVE)
298
299 // Respond to keyboard input events, intercept cheats.
300 // [RH] Cheats eat the last keypress used to trigger them
301 bool ST_Responder (event_t *ev)
302 {
303 bool eat = false;
304
305 if (!allcheats)
306 {
307 cheatseq_t *cheats;
308 int numcheats;
309
310 switch (gameinfo.gametype)
311 {
312 case GAME_Doom:
313 cheats = DoomCheats;
314 numcheats = countof(DoomCheats);
315 break;
316
317 case GAME_Heretic:
318 cheats = HereticCheats;
319 numcheats = countof(HereticCheats);
320 break;
321
322 case GAME_Hexen:
323 cheats = HexenCheats;
324 numcheats = countof(HexenCheats);
325 break;
326
327 case GAME_Strife:
328 cheats = StrifeCheats;
329 numcheats = countof(StrifeCheats);
330 break;
331
332 case GAME_Chex:
333 cheats = ChexCheats;
334 numcheats = countof(ChexCheats);
335 break;
336
337 default:
338 return false;
339 }
340 return CheatCheckList(ev, cheats, numcheats);
341 }
342 else
343 {
344 static cheatseq_t *cheatlists[] = { DoomCheats, HereticCheats, HexenCheats, StrifeCheats, ChexCheats, SpecialCheats };
345 static int counts[] = { countof(DoomCheats), countof(HereticCheats)-2, countof(HexenCheats),
346 countof(StrifeCheats), countof(ChexCheats)-1, countof(SpecialCheats) };
347
348 for (size_t i=0; i<countof(cheatlists); i++)
349 {
350 if (CheatCheckList(ev, cheatlists[i], counts[i])) return true;
351 }
352 }
353 return false;
354 }
355
CheatCheckList(event_t * ev,cheatseq_t * cheats,int numcheats)356 static bool CheatCheckList (event_t *ev, cheatseq_t *cheats, int numcheats)
357 {
358 bool eat = false;
359
360 if (ev->type == EV_KeyDown)
361 {
362 int i;
363
364 for (i = 0; i < numcheats; i++, cheats++)
365 {
366 if (CheatAddKey (cheats, (BYTE)ev->data2, &eat))
367 {
368 if (cheats->DontCheck || !CheckCheatmode ())
369 {
370 eat |= cheats->Handler (cheats);
371 }
372 }
373 else if (cheats->Pos - cheats->Sequence > 2)
374 { // If more than two characters into the sequence,
375 // eat the keypress, just so that the Hexen cheats
376 // with T in them will work without unbinding T.
377 eat = true;
378 }
379 }
380 }
381 return eat;
382 }
383
384 //--------------------------------------------------------------------------
385 //
386 // FUNC CheatAddkey
387 //
388 // Returns true if the added key completed the cheat, false otherwise.
389 //
390 //--------------------------------------------------------------------------
391
CheatAddKey(cheatseq_t * cheat,BYTE key,bool * eat)392 static bool CheatAddKey (cheatseq_t *cheat, BYTE key, bool *eat)
393 {
394 if (cheat->Pos == NULL)
395 {
396 cheat->Pos = cheat->Sequence;
397 cheat->CurrentArg = 0;
398 }
399 if (*cheat->Pos == 0)
400 {
401 *eat = true;
402 cheat->Args[cheat->CurrentArg++] = key;
403 cheat->Pos++;
404 }
405 else if (key == *cheat->Pos)
406 {
407 cheat->Pos++;
408 }
409 else
410 {
411 cheat->Pos = cheat->Sequence;
412 cheat->CurrentArg = 0;
413 }
414 if (*cheat->Pos == 0xff)
415 {
416 cheat->Pos = cheat->Sequence;
417 cheat->CurrentArg = 0;
418 return true;
419 }
420 return false;
421 }
422
423 //--------------------------------------------------------------------------
424 //
425 // CHEAT FUNCTIONS
426 //
427 //--------------------------------------------------------------------------
428
Cht_Generic(cheatseq_t * cheat)429 static bool Cht_Generic (cheatseq_t *cheat)
430 {
431 Net_WriteByte (DEM_GENERICCHEAT);
432 Net_WriteByte (cheat->Args[0]);
433 return true;
434 }
435
Cht_Music(cheatseq_t * cheat)436 static bool Cht_Music (cheatseq_t *cheat)
437 {
438 char buf[9] = "idmus xx";
439
440 buf[6] = cheat->Args[0];
441 buf[7] = cheat->Args[1];
442 C_DoCommand (buf);
443 return true;
444 }
445
Cht_BeholdMenu(cheatseq_t * cheat)446 static bool Cht_BeholdMenu (cheatseq_t *cheat)
447 {
448 Printf ("%s\n", GStrings("STSTR_BEHOLD"));
449 return false;
450 }
451
Cht_PumpupMenu(cheatseq_t * cheat)452 static bool Cht_PumpupMenu (cheatseq_t *cheat)
453 {
454 // How many people knew about the PUMPUPT cheat, since
455 // it isn't printed in the list?
456 Printf ("Bzrk, Inviso, Mask, Health, Pack, Stats\n");
457 return false;
458 }
459
Cht_AutoMap(cheatseq_t * cheat)460 static bool Cht_AutoMap (cheatseq_t *cheat)
461 {
462 if (automapactive)
463 {
464 am_cheat = (am_cheat + 1) % 3;
465 return true;
466 }
467 else
468 {
469 return false;
470 }
471 }
472
Cht_ChangeLevel(cheatseq_t * cheat)473 static bool Cht_ChangeLevel (cheatseq_t *cheat)
474 {
475 char cmd[10] = "idclev xx";
476
477 cmd[7] = cheat->Args[0];
478 cmd[8] = cheat->Args[1];
479 C_DoCommand (cmd);
480 return true;
481 }
482
Cht_ChangeStartSpot(cheatseq_t * cheat)483 static bool Cht_ChangeStartSpot (cheatseq_t *cheat)
484 {
485 char cmd[64];
486
487 mysnprintf (cmd, countof(cmd), "changemap %s %c", level.MapName.GetChars(), cheat->Args[0]);
488 C_DoCommand (cmd);
489 return true;
490 }
491
Cht_WarpTransLevel(cheatseq_t * cheat)492 static bool Cht_WarpTransLevel (cheatseq_t *cheat)
493 {
494 char cmd[11] = "hxvisit xx";
495 cmd[8] = cheat->Args[0];
496 cmd[9] = cheat->Args[1];
497 C_DoCommand (cmd);
498 return true;
499 }
500
Cht_MyPos(cheatseq_t * cheat)501 static bool Cht_MyPos (cheatseq_t *cheat)
502 {
503 C_DoCommand ("toggle idmypos");
504 return true;
505 }
506
Cht_Ticker(cheatseq_t * cheat)507 static bool Cht_Ticker (cheatseq_t *cheat)
508 {
509 ticker = !ticker;
510 Printf ("%s\n", GStrings(ticker ? "TXT_CHEATTICKERON" : "TXT_CHEATTICKEROFF"));
511 return true;
512 }
513
Cht_Sound(cheatseq_t * cheat)514 static bool Cht_Sound (cheatseq_t *cheat)
515 {
516 noisedebug = !noisedebug;
517 Printf ("%s\n", GStrings(noisedebug ? "TXT_CHEATSOUNDON" : "TXT_CHEATSOUNDOFF"));
518 return true;
519 }
520