1 // Emacs style mode select   -*- C++ -*-
2 //-----------------------------------------------------------------------------
3 //
4 // $Id: m_cheat.h 4469 2014-01-03 23:38:29Z dr_sean $
5 //
6 // Copyright (C) 1993-1996 by id Software, Inc.
7 // Copyright (C) 2006-2014 by The Odamex Team.
8 //
9 // This program is free software; you can redistribute it and/or
10 // modify it under the terms of the GNU General Public License
11 // as published by the Free Software Foundation; either version 2
12 // of the License, or (at your option) any later version.
13 //
14 // This program is distributed in the hope that it will be useful,
15 // but WITHOUT ANY WARRANTY; without even the implied warranty of
16 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17 // GNU General Public License for more details.
18 //
19 // DESCRIPTION:
20 //	Cheat code checking.
21 //
22 //-----------------------------------------------------------------------------
23 
24 
25 #ifndef __M_CHEAT_H__
26 #define __M_CHEAT_H__
27 
28 //
29 // CHEAT SEQUENCE PACKAGE
30 //
31 
32 #define SCRAMBLE(a) \
33 ((((a)&1)<<7) + (((a)&2)<<5) + ((a)&4) + (((a)&8)<<1) \
34  + (((a)&16)>>1) + ((a)&32) + (((a)&64)>>5) + (((a)&128)>>7))
35 
36 #define CHT_GOD				0
37 #define CHT_NOCLIP			1
38 #define CHT_NOTARGET		2
39 #define CHT_CHAINSAW		3
40 #define CHT_IDKFA			4
41 #define CHT_IDFA			5
42 #define CHT_BEHOLDV			6
43 #define CHT_BEHOLDS			7
44 #define CHT_BEHOLDI			8
45 #define CHT_BEHOLDR			9
46 #define CHT_BEHOLDA			10
47 #define CHT_BEHOLDL			11
48 #define CHT_IDDQD			12	// Same as CHT_GOD but sets health
49 #define CHT_MASSACRE		13
50 #define CHT_CHASECAM		14
51 #define CHT_FLY				15
52 
53 typedef struct
54 {
55 	unsigned char *sequence;
56 	unsigned char *p;
57 
58 } cheatseq_t;
59 
60 int cht_CheckCheat (cheatseq_t *cht, char key);
61 
62 void cht_GetParam (cheatseq_t *cht, char *buffer);
63 
64 // [RH] Functions that actually perform the cheating
65 class player_s;
66 void cht_DoCheat (player_s *player, int cheat);
67 void cht_Give (player_s *player, const char *item);
68 void cht_Suicide (player_s *player);
69 
70 #endif
71 
72 
73