| 1 |
/* Emacs style mode select -*- C -*- |
| 2 |
*----------------------------------------------------------------------------- |
| 3 |
* |
| 4 |
* |
| 5 |
* PrBoom: a Doom port merged with LxDoom and LSDLDoom |
| 6 |
* based on BOOM, a modified and improved DOOM engine |
| 7 |
* Copyright (C) 1999 by |
| 8 |
* id Software, Chi Hoang, Lee Killough, Jim Flynn, Rand Phares, Ty Halderman |
| 9 |
* Copyright (C) 1999-2000 by |
| 10 |
* Jess Haas, Nicolas Kalkhof, Colin Phipps, Florian Schulze |
| 11 |
* Copyright 2005, 2006 by |
| 12 |
* Florian Schulze, Colin Phipps, Neil Stevens, Andrey Budko |
| 13 |
* |
| 14 |
* This program is free software; you can redistribute it and/or |
| 15 |
* modify it under the terms of the GNU General Public License |
| 16 |
* as published by the Free Software Foundation; either version 2 |
| 17 |
* of the License, or (at your option) any later version. |
| 18 |
* |
| 19 |
* This program is distributed in the hope that it will be useful, |
| 20 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 21 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 22 |
* GNU General Public License for more details. |
| 23 |
* |
| 24 |
* You should have received a copy of the GNU General Public License |
| 25 |
* along with this program; if not, write to the Free Software |
| 26 |
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA |
| 27 |
* 02111-1307, USA. |
| 28 |
* |
| 29 |
* DESCRIPTION: |
| 30 |
* Cheat code checking. |
| 31 |
* |
| 32 |
*-----------------------------------------------------------------------------*/ |
| 33 |
|
| 34 |
#ifndef __M_CHEAT__ |
| 35 |
#define __M_CHEAT__ |
| 36 |
|
| 37 |
#include "d_event.h" |
| 38 |
|
| 39 |
#define CHEAT(cheat, deh_cheat, when, func, arg, repeatable) \ |
| 40 |
{ cheat, deh_cheat, when, func, arg, repeatable, 0, 0, 0, 0, 0, "" } |
| 41 |
|
| 42 |
#define CHEAT_ARGS_MAX 8 /* Maximum number of args at end of cheats */ |
| 43 |
|
| 44 |
/* killough 4/16/98: Cheat table structure */ |
| 45 |
|
| 46 |
typedef enum { |
| 47 |
cht_always = 0, |
| 48 |
not_demo = 1, |
| 49 |
not_menu = 2, |
| 50 |
not_classic_demo = 4, // allowed in dsda demo format |
| 51 |
} cheat_when_t; |
| 52 |
|
| 53 |
typedef struct cheatseq_s { |
| 54 |
const char * cheat; |
| 55 |
const char *const deh_cheat; |
| 56 |
const cheat_when_t when; |
| 57 |
void (*const func)(); |
| 58 |
const int arg; |
| 59 |
const int repeatable; |
| 60 |
uint64_t code, mask; |
| 61 |
size_t sequence_len; |
| 62 |
|
| 63 |
// state used during the game |
| 64 |
size_t chars_read; |
| 65 |
int param_chars_read; |
| 66 |
char parameter_buf[CHEAT_ARGS_MAX]; |
| 67 |
} cheatseq_t; |
| 68 |
|
| 69 |
extern cheatseq_t cheat[]; |
| 70 |
|
| 71 |
void M_CheatGod(void); |
| 72 |
void M_CheatNoClip(void); |
| 73 |
void M_CheatIDDT(void); |
| 74 |
dboolean M_CheatResponder(event_t *ev); |
| 75 |
dboolean M_CheatEntered(const char* element, const char* value); |
| 76 |
|
| 77 |
#endif |