Skip to content

Commit

Permalink
rt_debug.c: Hook up to console so all cheats work
Browse files Browse the repository at this point in the history
  • Loading branch information
erysdren committed Dec 19, 2023
1 parent 368b31c commit e3a6410
Show file tree
Hide file tree
Showing 3 changed files with 326 additions and 303 deletions.
49 changes: 7 additions & 42 deletions source/console.c
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
#include "states.h"
#include "sprites.h"
#include "rt_stat.h"
#include "rt_debug.h"
#include "w_wad.h"
#include "console.h"

Expand Down Expand Up @@ -625,44 +626,6 @@ int _cmd_exec(int argc, char **argv)
return 0;
}

/* debug mode */
int _cmd_debug(int argc, char **argv)
{

cmd_t *cmd;

if (argc < 2)
{
DebugOk = 0;
console_printf("Debug Mode DISABLED!");
}
else
{
DebugOk = 1;
console_printf("Debug Mode ENABLED!");
}

return 0;
}

/* EKG command */
int _cmd_ekg(int argc, char **argv)
{

cmd_t *cmd;

if (argc < 2)
{
ludicrousgibs ^= 1;
if (ludicrousgibs)
console_printf("EKG mode on!");
else
console_printf("EKG mode off!");
}
return 0;
}


/* cmdlib array */
cmd_t _cmdlib[] = {
CMD("quit", "exit the game immediately", _cmd_quit),
Expand All @@ -672,9 +635,7 @@ cmd_t _cmdlib[] = {
CMD("help", "print help text", _cmd_help),
CMD("find", "find command or variable by name", _cmd_find),
CMD("dopefish", "?", _cmd_dopefish),
CMD("exec", "execute config script", _cmd_exec),
CMD("debug", "enables debug mode", _cmd_debug),
CMD("ekg", "enables Engine Killing Gibs", _cmd_ekg)
CMD("exec", "execute config script", _cmd_exec)
};

/* register standard library of cmds */
Expand Down Expand Up @@ -1020,6 +981,10 @@ static boolean console_parse_command(char *s)
if (!argv[0] || !argc)
return false;

/* check for cheat */
if (DoCheatCodeString(argv[0]))
return true;

/* check for cmd */
if ((cmd = cmd_retrieve(argv[0])) != NULL)
{
Expand Down Expand Up @@ -1117,7 +1082,7 @@ static boolean console_parse_command(char *s)
}
}

console_printf("\"%s\" is not a valid command or variable", s);
console_printf("\"%s\" is not a valid command, variable, or cheat", s);
return false;
}

Expand Down
Loading

0 comments on commit e3a6410

Please sign in to comment.