1 // Emacs style mode select -*- C++ -*-
2 //-----------------------------------------------------------------------------
6 // Copyright (C) 1993-1996 by id Software, Inc.
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.
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
20 // Cheat sequence checking.
22 //-----------------------------------------------------------------------------
26 rcsid[] = "$Id: m_cheat.c,v 1.1 1997/02/03 21:24:34 b1 Exp $";
31 // CHEAT SEQUENCE PACKAGE
34 static int firsttime = 1;
35 static unsigned char cheat_xlate_table[256];
39 // Called in st_stuff module, which handles the input.
40 // Returns a 1 if the cheat was successful, 0 if failed.
53 for (i=0;i<256;i++) cheat_xlate_table[i] = SCRAMBLE(i);
57 cht->p = cht->sequence; // initialize if first time
62 (cheat_xlate_table[(unsigned char)key] == *cht->p) cht->p++;
64 cht->p = cht->sequence;
68 else if (*cht->p == 0xff) // end of sequence character
70 cht->p = cht->sequence;
94 while (c && *p!=0xff );