From 713ac093bf88550c024d913b6cde725b7edf76c6 Mon Sep 17 00:00:00 2001 From: Sally Coolatta Date: Thu, 29 Sep 2022 12:19:45 -0400 Subject: [PATCH] devmode cheat online --- src/am_map.c | 4 +- src/command.c | 9 ++++- src/console.c | 4 +- src/d_main.cpp | 2 +- src/d_netcmd.c | 54 ++++++++++---------------- src/doomdef.h | 46 ++++++++++++++-------- src/f_finale.c | 2 +- src/g_game.c | 4 +- src/lua_blockmaplib.c | 8 ++-- src/lua_hooklib.c | 2 +- src/m_cheat.c | 90 ++++++++++++++++++++++++++++++++++++------- src/m_cheat.h | 4 ++ src/m_menu.c | 4 +- src/p_enemy.c | 22 +++++------ src/p_local.h | 2 + src/p_mobj.c | 4 +- src/p_saveg.c | 4 ++ src/p_setup.c | 2 +- src/p_user.c | 24 ++++++++++++ src/r_main.cpp | 34 +--------------- src/r_skins.c | 2 +- src/st_stuff.c | 12 +++--- 22 files changed, 204 insertions(+), 135 deletions(-) diff --git a/src/am_map.c b/src/am_map.c index ed9f9752d..f5543aec6 100644 --- a/src/am_map.c +++ b/src/am_map.c @@ -454,7 +454,7 @@ boolean AM_Responder(event_t *ev) { INT32 rc = false; - if (devparm || cv_debug) // only automap in Debug Tails 01-19-2001 + if (devparm || cht_debug) // only automap in Debug Tails 01-19-2001 { if (!automapactive) { @@ -625,7 +625,7 @@ static inline void AM_doFollowPlayer(void) */ void AM_Ticker(void) { - if (!cv_debug) + if (!cht_debug) AM_Stop(); if (dedicated || !automapactive) diff --git a/src/command.c b/src/command.c index 6b2f87767..047436772 100644 --- a/src/command.c +++ b/src/command.c @@ -1748,10 +1748,15 @@ void CV_ResetCheatNetVars(void) { consvar_t *cvar; - // Stealthset everything back to default. + // Set everything back to default. for (cvar = consvar_vars; cvar; cvar = cvar->next) if (cvar->flags & CV_CHEAT) - CV_SetCVar(cvar, cvar->defaultvalue, true); + CV_SetCVar(cvar, cvar->defaultvalue, false); + + // Reset any other cheat command effects here, as well. + cht_debug = 0; + + P_ResetPlayerCheats(); } // Returns true if the variable's current value is its default value diff --git a/src/console.c b/src/console.c index 849b936ec..519490e9b 100644 --- a/src/console.c +++ b/src/console.c @@ -1644,12 +1644,12 @@ void CONS_Alert(alerttype_t level, const char *fmt, ...) CONS_Printf("%s", txt); } -void CONS_Debug(INT32 debugflags, const char *fmt, ...) +void CONS_Debug(UINT32 debugflags, const char *fmt, ...) { va_list argptr; static char *txt = NULL; - if ((cv_debug & debugflags) != debugflags) + if ((cht_debug & debugflags) != debugflags) return; if (txt == NULL) diff --git a/src/d_main.cpp b/src/d_main.cpp index 87ed27e4c..63bd11bea 100644 --- a/src/d_main.cpp +++ b/src/d_main.cpp @@ -1017,7 +1017,7 @@ void D_StartTitle(void) splitscreen = 0; SplitScreen_OnChange(); - cv_debug = 0; + cht_debug = 0; emeralds = 0; memset(&luabanks, 0, sizeof(luabanks)); lastmaploaded = 0; diff --git a/src/d_netcmd.c b/src/d_netcmd.c index f0af87701..fde1a4e27 100644 --- a/src/d_netcmd.c +++ b/src/d_netcmd.c @@ -65,11 +65,7 @@ #include "deh_tables.h" #include "m_perfstats.h" -#ifdef NETGAME_DEVMODE #define CV_RESTRICT CV_NETVAR -#else -#define CV_RESTRICT 0 -#endif #ifdef HAVE_DISCORDRPC #include "discord.h" @@ -157,10 +153,6 @@ static void KartRings_OnChange(void); static void Schedule_OnChange(void); -#ifdef NETGAME_DEVMODE -static void Fishcake_OnChange(void); -#endif - static void Command_Playdemo_f(void); static void Command_Timedemo_f(void); static void Command_Stopdemo_f(void); @@ -324,8 +316,6 @@ consvar_t cv_followercolor[MAXSPLITSCREENPLAYERS] = { consvar_t cv_skipmapcheck = CVAR_INIT ("skipmapcheck", "Off", CV_SAVE, CV_OnOff, NULL); -INT32 cv_debug; - consvar_t cv_usemouse = CVAR_INIT ("use_mouse", "Off", CV_SAVE|CV_CALL,usemouse_cons_t, I_StartupMouse); consvar_t cv_usejoystick[MAXSPLITSCREENPLAYERS] = { @@ -2057,6 +2047,10 @@ void D_Cheat(INT32 playernum, INT32 cheat, ...) case CHEAT_HURT: COPY(WRITEINT32, INT32); break; + + case CHEAT_DEVMODE: + COPY(WRITEUINT32, UINT32); + break; } #undef COPY @@ -2786,7 +2780,7 @@ static void Command_Map_f(void) return; } - if (!newresetplayers && !cv_debug) + if (!newresetplayers && !cht_debug) { CONS_Printf(M_GetText("DEVMODE must be enabled.\n")); return; @@ -2903,8 +2897,10 @@ static void Command_Map_f(void) newresetplayers = false; // if not forcing and gametypes is the same // don't use a gametype the map doesn't support - if (cv_debug || option_force || cv_skipmapcheck.value) + if (cht_debug || option_force || cv_skipmapcheck.value) + { fromlevelselect = false; // The player wants us to trek on anyway. Do so. + } // G_TOLFlag handles both multiplayer gametype and ignores it for !multiplayer else { @@ -5059,7 +5055,7 @@ void D_GameTypeChanged(INT32 lastgametype) static void Gravity_OnChange(void) { - if (!M_SecretUnlocked(SECRET_PANDORA) && !netgame && !cv_debug + if (!M_SecretUnlocked(SECRET_PANDORA) && !netgame && !cht_debug && strcmp(cv_gravity.string, cv_gravity.defaultvalue)) { CONS_Printf(M_GetText("You haven't earned this yet.\n")); @@ -5294,7 +5290,7 @@ static void Command_Mapmd5_f(void) static void Command_ExitLevel_f(void) { - if (!(netgame || multiplayer) && !cv_debug) + if (!(netgame || multiplayer) && !cht_debug) CONS_Printf(M_GetText("This only works in a netgame.\n")); else if (!(server || (IsPlayerAdmin(consoleplayer)))) CONS_Printf(M_GetText("Only the server or a remote admin can use this.\n")); @@ -5618,6 +5614,13 @@ static void Got_Cheat(UINT8 **cp, INT32 playernum) break; } + case CHEAT_DEVMODE: { + UINT32 flags = READUINT32(*cp); + cht_debug = flags; + CV_CheaterWarning(targetPlayer, va("devmode %08x", flags)); + break; + } + case NUMBER_OF_CHEATS: break; } @@ -5678,7 +5681,7 @@ void Command_ExitGame_f(void) splitscreen = 0; SplitScreen_OnChange(); - cv_debug = 0; + cht_debug = 0; emeralds = 0; memset(&luabanks, 0, sizeof(luabanks)); @@ -5710,23 +5713,6 @@ void Command_Retry_f(void) } } -#ifdef NETGAME_DEVMODE -// Allow the use of devmode in netgames. -static void Fishcake_OnChange(void) -{ - cv_debug = cv_fishcake.value; - // consvar_t's get changed to default when registered - // so don't make modifiedgame always on! - if (cv_debug) - { - G_SetGameModified(multiplayer, true); - } - - else if (cv_debug != cv_fishcake.value) - CV_SetValue(&cv_fishcake, cv_debug); -} -#endif - /** Reports to the console whether or not the game has been modified. * * \todo Make it obvious, so a console command won't be necessary. @@ -6300,7 +6286,7 @@ static void Skin_OnChange(void) if (!Playing()) return; // do whatever you want - if (!(cv_debug || devparm) && !(multiplayer || netgame) // In single player. + if (!(cht_debug || devparm) && !(multiplayer || netgame) // In single player. && (gamestate != GS_WAITINGPLAYERS)) // allows command line -warp x +skin y { CV_StealthSet(&cv_skin[0], skins[players[consoleplayer].skin].name); @@ -6376,7 +6362,7 @@ static void Color_OnChange(void) } else { - if (!(cv_debug || devparm) && !(multiplayer || netgame)) // In single player. + if (!(cht_debug || devparm) && !(multiplayer || netgame)) // In single player. { CV_StealthSet(&cv_skin[0], skins[players[consoleplayer].skin].name); return; diff --git a/src/doomdef.h b/src/doomdef.h index eb142196d..d04fa7f2f 100644 --- a/src/doomdef.h +++ b/src/doomdef.h @@ -591,7 +591,7 @@ typedef enum void CONS_Printf(const char *fmt, ...) FUNCPRINTF; void CONS_Alert(alerttype_t level, const char *fmt, ...) FUNCDEBUG; -void CONS_Debug(INT32 debugflags, const char *fmt, ...) FUNCDEBUG; +void CONS_Debug(UINT32 debugflags, const char *fmt, ...) FUNCDEBUG; // For help debugging functions. #define POTENTIALLYUNUSED CONS_Alert(CONS_WARNING, "(%s:%d) Unused code appears to be used.\n", __FILE__, __LINE__) @@ -636,23 +636,35 @@ char *sizeu5(size_t num); extern int VERSION; extern int SUBVERSION; extern boolean devparm; // development mode (-debug) -// d_netcmd.c -extern INT32 cv_debug; -#define DBG_BASIC 0x0001 -#define DBG_DETAILED 0x0002 -#define DBG_PLAYER 0x0004 -#define DBG_RENDER 0x0008 -#define DBG_NIGHTSBASIC 0x0010 -#define DBG_NIGHTS 0x0020 -#define DBG_POLYOBJ 0x0040 -#define DBG_GAMELOGIC 0x0080 -#define DBG_NETPLAY 0x0100 -#define DBG_MEMORY 0x0200 -#define DBG_SETUP 0x0400 -#define DBG_LUA 0x0800 -#define DBG_RANDOMIZER 0x1000 -#define DBG_VIEWMORPH 0x2000 +// m_cheat.c +extern UINT32 cht_debug; + +typedef enum +{ + DBG_NONE = 0x00000000, + DBG_BASIC = 0x00000001, + DBG_DETAILED = 0x00000002, + DBG_PLAYER = 0x00000004, + DBG_RENDER = 0x00000008, + //DBG_NIGHTSBASIC = 0x00000010, // free + //DBG_NIGHTS = 0x00000020, // free + DBG_POLYOBJ = 0x00000040, + DBG_GAMELOGIC = 0x00000080, + DBG_NETPLAY = 0x00000100, + DBG_MEMORY = 0x00000200, + DBG_SETUP = 0x00000400, + DBG_LUA = 0x00000800, + DBG_RNG = 0x00001000, +} debugFlags_t; + +struct debugFlagNames_s +{ + const char *str; + debugFlags_t flag; +}; + +extern struct debugFlagNames_s const debug_flag_names[]; // ======================= // Misc stuff for later... diff --git a/src/f_finale.c b/src/f_finale.c index aed4fe0f8..4deaaa375 100644 --- a/src/f_finale.c +++ b/src/f_finale.c @@ -844,7 +844,7 @@ boolean F_CreditResponder(event_t *event) return false; } - /*if (!(timesBeaten) && !(netgame || multiplayer) && !cv_debug) + /*if (!(timesBeaten) && !(netgame || multiplayer) && !cht_debug) return false;*/ if (key != KEY_ESCAPE && key != KEY_ENTER && key != KEY_BACKSPACE) diff --git a/src/g_game.c b/src/g_game.c index c285ed5c3..becae291b 100644 --- a/src/g_game.c +++ b/src/g_game.c @@ -4504,7 +4504,7 @@ void G_SaveGame(UINT32 slot, INT16 mapnum) gameaction = ga_nothing; - if (cv_debug && saved) + if (cht_debug && saved) CONS_Printf(M_GetText("Game saved.\n")); else if (!saved) CONS_Alert(CONS_ERROR, M_GetText("Error while writing to %s for save slot %u, base: %s\n"), backup, slot, (marathonmode ? liveeventbackup : savegamename)); @@ -4609,7 +4609,7 @@ void G_SaveGameOver(UINT32 slot, boolean modifylives) } cleanup: - if (cv_debug && saved) + if (cht_debug && saved) CONS_Printf(M_GetText("Game saved.\n")); else if (!saved) CONS_Alert(CONS_ERROR, M_GetText("Error while writing to %s for save slot %u, base: %s\n"), backup, slot, (marathonmode ? liveeventbackup : savegamename)); diff --git a/src/lua_blockmaplib.c b/src/lua_blockmaplib.c index 1949d56bb..efb14a9c3 100644 --- a/src/lua_blockmaplib.c +++ b/src/lua_blockmaplib.c @@ -51,7 +51,7 @@ static UINT8 lib_searchBlockmap_Objects(lua_State *L, INT32 x, INT32 y, mobj_t * LUA_PushUserdata(L, thing, META_MOBJ); LUA_PushUserdata(L, mobj, META_MOBJ); if (lua_pcall(gL, 2, 1, 0)) { - if (!blockfuncerror || cv_debug & DBG_LUA) + if (!blockfuncerror || cht_debug & DBG_LUA) CONS_Alert(CONS_WARNING,"%s\n",lua_tostring(gL, -1)); lua_pop(gL, 1); blockfuncerror = true; @@ -112,7 +112,7 @@ static UINT8 lib_searchBlockmap_Lines(lua_State *L, INT32 x, INT32 y, mobj_t *th LUA_PushUserdata(L, thing, META_MOBJ); LUA_PushUserdata(L, po->lines[i], META_LINE); if (lua_pcall(gL, 2, 1, 0)) { - if (!blockfuncerror || cv_debug & DBG_LUA) + if (!blockfuncerror || cht_debug & DBG_LUA) CONS_Alert(CONS_WARNING,"%s\n",lua_tostring(gL, -1)); lua_pop(gL, 1); blockfuncerror = true; @@ -149,7 +149,7 @@ static UINT8 lib_searchBlockmap_Lines(lua_State *L, INT32 x, INT32 y, mobj_t *th LUA_PushUserdata(L, thing, META_MOBJ); LUA_PushUserdata(L, ld, META_LINE); if (lua_pcall(gL, 2, 1, 0)) { - if (!blockfuncerror || cv_debug & DBG_LUA) + if (!blockfuncerror || cht_debug & DBG_LUA) CONS_Alert(CONS_WARNING,"%s\n",lua_tostring(gL, -1)); lua_pop(gL, 1); blockfuncerror = true; @@ -195,7 +195,7 @@ static UINT8 lib_searchBlockmap_PolyObjs(lua_State *L, INT32 x, INT32 y, mobj_t LUA_PushUserdata(L, thing, META_MOBJ); LUA_PushUserdata(L, po, META_POLYOBJ); if (lua_pcall(gL, 2, 1, 0)) { - if (!blockfuncerror || cv_debug & DBG_LUA) + if (!blockfuncerror || cht_debug & DBG_LUA) CONS_Alert(CONS_WARNING,"%s\n",lua_tostring(gL, -1)); lua_pop(gL, 1); blockfuncerror = true; diff --git a/src/lua_hooklib.c b/src/lua_hooklib.c index 8ac70f506..a11aac517 100644 --- a/src/lua_hooklib.c +++ b/src/lua_hooklib.c @@ -412,7 +412,7 @@ static int call_single_hook_no_copy(Hook_State *hook) else { /* print the error message once */ - if (cv_debug & DBG_LUA || !in_bit_array(hooksErrored, hook->id)) + if (cht_debug & DBG_LUA || !in_bit_array(hooksErrored, hook->id)) { CONS_Alert(CONS_WARNING, "%s\n", lua_tostring(gL, -1)); set_bit_array(hooksErrored, hook->id); diff --git a/src/m_cheat.c b/src/m_cheat.c index db3f5ba3c..8cf65b60e 100644 --- a/src/m_cheat.c +++ b/src/m_cheat.c @@ -38,6 +38,8 @@ #include "lua_script.h" #include "lua_hook.h" +#include "fastcmp.h" + // // CHEAT SEQUENCE PACKAGE // @@ -125,7 +127,7 @@ static UINT8 cheatf_devmode(void) for (i = 0; i < MAXUNLOCKABLES; i++) unlockables[i].unlocked = true; devparm = true; - cv_debug |= 0x8000; + cht_debug |= 0x8000; // Refresh secrets menu existing. M_ClearMenus(true); @@ -264,10 +266,10 @@ boolean cht_Responder(event_t *ev) } // Console cheat commands rely on these a lot... -#define REQUIRE_PANDORA if (!M_SecretUnlocked(SECRET_PANDORA) && !cv_debug)\ +#define REQUIRE_PANDORA if (!M_SecretUnlocked(SECRET_PANDORA) && !cht_debug)\ { CONS_Printf(M_GetText("You haven't earned this yet.\n")); return; } -#define REQUIRE_DEVMODE if (!cv_debug)\ +#define REQUIRE_DEVMODE if (!cht_debug)\ { CONS_Printf(M_GetText("DEVMODE must be enabled.\n")); return; } #define REQUIRE_OBJECTPLACE if (!objectplacing)\ @@ -734,25 +736,85 @@ void Command_Resetemeralds_f(void) } */ +// +// Devmode +// + +UINT32 cht_debug; + +struct debugFlagNames_s const debug_flag_names[] = +{ + {"None", DBG_NONE}, + {"Basic", DBG_BASIC}, + {"Detailed", DBG_DETAILED}, + {"Player", DBG_PLAYER}, + {"Render", DBG_RENDER}, + {"Renderer", DBG_RENDER}, // alt name + {"Polyobj", DBG_POLYOBJ}, + {"GameLogic", DBG_GAMELOGIC}, + {"Game", DBG_GAMELOGIC}, // alt name + {"Netplay", DBG_NETPLAY}, + {"Memory", DBG_MEMORY}, + {"Setup", DBG_SETUP}, + {"Lua", DBG_LUA}, + {"RNG", DBG_RNG}, + {"Randomizer", DBG_RNG}, // alt name + {NULL, 0} +}; + void Command_Devmode_f(void) { -#ifndef _DEBUG - REQUIRE_SINGLEPLAYER; -#endif + size_t argc = 0; - if (COM_Argc() > 1) + if (client && !IsPlayerAdmin(consoleplayer)) { - const char *arg = COM_Argv(1); + CONS_Printf(M_GetText("Only the server or a remote admin can use this.\n")); + return; + } - if (arg[0] && arg[0] == '0' && - arg[1] && arg[1] == 'x') // Use hexadecimal! - cv_debug = axtoi(arg+2); - else - cv_debug = atoi(arg); + argc = COM_Argc(); + if (argc > 1) + { + UINT32 flags = 0; + size_t i; + + for (i = 1; i < argc; i++) + { + const char *arg = COM_Argv(i); + size_t j; + + // Try it as a string + for (j = 0; debug_flag_names[j].str; j++) + { + if (stricmp(arg, debug_flag_names[j].str) == 0) + { + break; + } + } + + if (debug_flag_names[j].str) + { + flags |= debug_flag_names[j].flag; + continue; + } + + // Try it as a number + if (arg[0] && arg[0] == '0' && + arg[1] && arg[1] == 'x') // Use hexadecimal! + { + flags |= axtoi(arg+2); + } + else + { + flags |= atoi(arg); + } + } + + D_Cheat(consoleplayer, CHEAT_DEVMODE, flags); } else { - CONS_Printf(M_GetText("devmode : enable debugging tools and info, prepend with 0x to use hexadecimal\n")); + CONS_Printf(M_GetText("devmode : Enable debugging info. Prepend with 0x to use hexadecimal\n")); return; } diff --git a/src/m_cheat.h b/src/m_cheat.h index a519b91ff..33e80e3b1 100644 --- a/src/m_cheat.h +++ b/src/m_cheat.h @@ -31,10 +31,14 @@ typedef enum { CHEAT_SCALE, CHEAT_FLIP, CHEAT_HURT, + CHEAT_DEVMODE, NUMBER_OF_CHEATS } cheat_t; +// +// Cheat sequences +// boolean cht_Responder(event_t *ev); void cht_Init(void); diff --git a/src/m_menu.c b/src/m_menu.c index aad8e3035..35b13182d 100644 --- a/src/m_menu.c +++ b/src/m_menu.c @@ -8905,7 +8905,7 @@ static void M_StartServer(INT32 choice) strncpy(connectedservername, cv_servername.string, MAXSERVERNAME); // Still need to reset devmode - cv_debug = 0; + cht_debug = 0; if (demo.playback) G_StopDemo(); @@ -11489,7 +11489,7 @@ void M_QuitResponse(INT32 ch) if (ch != 'y' && ch != KEY_ENTER) return; - if (!(netgame || cv_debug)) + if (!(netgame || cht_debug)) { mrand = M_RandomKey(sizeof(quitsounds)/sizeof(INT32)); if (quitsounds[mrand]) S_StartSound(NULL, quitsounds[mrand]); diff --git a/src/p_enemy.c b/src/p_enemy.c index 994239475..3c22f1108 100644 --- a/src/p_enemy.c +++ b/src/p_enemy.c @@ -8317,7 +8317,7 @@ void A_OrbitNights(mobj_t* actor) if (!actor->target) { - if (cv_debug && !(actor->target && actor->target->player)) + if (cht_debug && !(actor->target && actor->target->player)) CONS_Printf("ERROR: Powerup has no target!\n"); return; } @@ -8387,7 +8387,7 @@ void A_SetObjectState(mobj_t *actor) if ((!locvar2 && !actor->target) || (locvar2 && !actor->tracer)) { - if (cv_debug) + if (cht_debug) CONS_Printf("A_SetObjectState: No target to change state!\n"); return; } @@ -8478,7 +8478,7 @@ void A_KnockBack(mobj_t *actor) if (!target) { - if(cv_debug) + if(cht_debug) CONS_Printf("A_KnockBack: No target!\n"); return; } @@ -8542,7 +8542,7 @@ void A_RingDrain(mobj_t *actor) if (!actor->target || !actor->target->player) { - if(cv_debug) + if(cht_debug) CONS_Printf("A_RingDrain: No player targeted!\n"); return; } @@ -8746,7 +8746,7 @@ void A_Custom3DRotate(mobj_t *actor) if (hspeed==0 && vspeed==0) { - if (cv_debug) + if (cht_debug) CONS_Printf("Error: A_Custom3DRotate: Object has no speed.\n"); return; } @@ -9181,7 +9181,7 @@ void A_SetCustomValue(mobj_t *actor) if (LUA_CallAction(A_SETCUSTOMVALUE, actor)) return; - if (cv_debug) + if (cht_debug) CONS_Printf("Init custom value is %d\n", actor->cusval); if (locvar1 == 0 && locvar2 == 4) @@ -9201,7 +9201,7 @@ void A_SetCustomValue(mobj_t *actor) else // replace actor->cusval = locvar1; - if(cv_debug) + if(cht_debug) CONS_Printf("New custom value is %d\n", actor->cusval); } @@ -9568,7 +9568,7 @@ void A_SetScale(mobj_t *actor) if (locvar1 <= 0) { - if(cv_debug) + if(cht_debug) CONS_Printf("A_SetScale: Valid scale not specified!\n"); return; } @@ -9582,7 +9582,7 @@ void A_SetScale(mobj_t *actor) if (!target) { - if(cv_debug) + if(cht_debug) CONS_Printf("A_SetScale: No target!\n"); return; } @@ -9623,7 +9623,7 @@ void A_RemoteDamage(mobj_t *actor) if (!target) { - if(cv_debug) + if(cht_debug) CONS_Printf("A_RemoteDamage: No target!\n"); return; } @@ -13232,7 +13232,7 @@ void A_ItemPop(mobj_t *actor) if (!(actor->target && actor->target->player)) { - if (cv_debug && !(actor->target && actor->target->player)) + if (cht_debug && !(actor->target && actor->target->player)) CONS_Printf("ERROR: Powerup has no target!\n"); return; } diff --git a/src/p_local.h b/src/p_local.h index fd1c598d4..12e05d781 100644 --- a/src/p_local.h +++ b/src/p_local.h @@ -609,6 +609,8 @@ void P_RemoveThingTID(mobj_t *mo); mobj_t *P_FindMobjFromTID(mtag_t tid, mobj_t *i, mobj_t *activator); void P_DeleteMobjStringArgs(mobj_t *mobj); +void P_ResetPlayerCheats(void); + #ifdef __cplusplus } // extern "C" #endif diff --git a/src/p_mobj.c b/src/p_mobj.c index 996990461..447b24fe0 100644 --- a/src/p_mobj.c +++ b/src/p_mobj.c @@ -4416,7 +4416,7 @@ mobj_t *P_GetClosestAxis(mobj_t *source) } if (closestaxis == NULL) - CONS_Debug(DBG_NIGHTS, "ERROR: No axis points found!\n"); + CONS_Alert(CONS_ERROR, "No axis points found!\n"); return closestaxis; } @@ -4488,7 +4488,7 @@ void P_SpawnHoopOfSomething(fixed_t x, fixed_t y, fixed_t z, fixed_t radius, INT if (!axis) { - CONS_Debug(DBG_NIGHTS, "You forgot to put axis points in the map!\n"); + CONS_Alert(CONS_WARNING, "You forgot to put axis points in the map!\n"); return; } diff --git a/src/p_saveg.c b/src/p_saveg.c index 995d6581c..57ebc6da0 100644 --- a/src/p_saveg.c +++ b/src/p_saveg.c @@ -5041,6 +5041,8 @@ static void P_NetArchiveMisc(savebuffer_t *save, boolean resending) WRITEINT16(save->p, task->timer); WRITESTRING(save->p, task->command); } + + WRITEUINT32(save->p, cht_debug); } FUNCINLINE static ATTRINLINE boolean P_NetUnArchiveMisc(savebuffer_t *save, boolean reloading) @@ -5211,6 +5213,8 @@ FUNCINLINE static ATTRINLINE boolean P_NetUnArchiveMisc(savebuffer_t *save, bool Schedule_Add(basetime, timer, command); } + cht_debug = READUINT32(save->p); + return true; } diff --git a/src/p_setup.c b/src/p_setup.c index ffc4abbc4..8f2b21d7f 100644 --- a/src/p_setup.c +++ b/src/p_setup.c @@ -8119,7 +8119,7 @@ boolean P_LoadLevel(boolean fromnetsave, boolean reloadinggamestate) P_Initsecnode(); if (netgame || multiplayer) - cv_debug = 0; + cht_debug = 0; if (metalplayback) G_StopMetalDemo(); diff --git a/src/p_user.c b/src/p_user.c index 99abe94d1..48c9c53b7 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -4750,3 +4750,27 @@ boolean P_PlayerFullbright(player_t *player) { return (player->invincibilitytimer > 0); } + +void P_ResetPlayerCheats(void) +{ + INT32 i; + + for (i = 0; i < MAXPLAYERS; i++) + { + player_t *player = &players[i]; + mobj_t *thing = player->mo; + + if (!playeringame[i]) + continue; + + player->pflags &= ~(PF_GODMODE); + + if (P_MobjWasRemoved(thing)) + continue; + + thing->flags &= ~(MF_NOCLIP); + + thing->destscale = mapobjectscale; + P_SetScale(thing, thing->destscale); + } +} diff --git a/src/r_main.cpp b/src/r_main.cpp index 66ee99202..bb628c543 100644 --- a/src/r_main.cpp +++ b/src/r_main.cpp @@ -902,39 +902,9 @@ void R_ApplyViewMorph(int s) end = width * height; -#if 0 - if (cv_debug & DBG_VIEWMORPH) + for (p = 0; p < end; p++) { - UINT8 border = 32; - UINT8 grid = 160; - INT32 ws = vid.width / 4; - INT32 hs = vid.width * (vid.height / 4); - - memcpy(tmpscr, srcscr, vid.width*vid.height); - for (p = 0; p < vid.width; p++) - { - tmpscr[viewmorph.scrmap[p]] = border; - tmpscr[viewmorph.scrmap[p + hs]] = grid; - tmpscr[viewmorph.scrmap[p + hs*2]] = grid; - tmpscr[viewmorph.scrmap[p + hs*3]] = grid; - tmpscr[viewmorph.scrmap[end - 1 - p]] = border; - } - for (p = vid.width; p < end; p += vid.width) - { - tmpscr[viewmorph.scrmap[p]] = border; - tmpscr[viewmorph.scrmap[p + ws]] = grid; - tmpscr[viewmorph.scrmap[p + ws*2]] = grid; - tmpscr[viewmorph.scrmap[p + ws*3]] = grid; - tmpscr[viewmorph.scrmap[end - 1 - p]] = border; - } - } - else -#endif - { - for (p = 0; p < end; p++) - { - tmpscr[p] = srcscr[viewmorph[s].scrmap[p]]; - } + tmpscr[p] = srcscr[viewmorph[s].scrmap[p]]; } VID_BlitLinearScreen(tmpscr, srcscr, diff --git a/src/r_skins.c b/src/r_skins.c index aed2997ee..2ba8b57ed 100644 --- a/src/r_skins.c +++ b/src/r_skins.c @@ -298,7 +298,7 @@ void SetPlayerSkinByNum(INT32 playernum, INT32 skinnum) player->kartweight = skin->kartweight; #if 0 - if (!(cv_debug || devparm) && !(netgame || multiplayer || demo.playback)) + if (!(cht_debug || devparm) && !(netgame || multiplayer || demo.playback)) { for (i = 0; i <= r_splitscreen; i++) { diff --git a/src/st_stuff.c b/src/st_stuff.c index eaa355a45..64a757c83 100644 --- a/src/st_stuff.c +++ b/src/st_stuff.c @@ -444,7 +444,7 @@ static void ST_drawDebugInfo(void) if (!stplyr->mo) return; - if (cv_debug & DBG_BASIC) + if (cht_debug & DBG_BASIC) { const fixed_t d = AngleFixed(stplyr->mo->angle); V_DrawRightAlignedString(320, 168, V_MONOSPACE, va("X: %6d", stplyr->mo->x>>FRACBITS)); @@ -455,7 +455,7 @@ static void ST_drawDebugInfo(void) height = 152; } - if (cv_debug & DBG_DETAILED) + if (cht_debug & DBG_DETAILED) { //V_DrawRightAlignedString(320, height - 104, V_MONOSPACE, va("SHIELD: %5x", stplyr->powers[pw_shield])); V_DrawRightAlignedString(320, height - 96, V_MONOSPACE, va("SCALE: %5d%%", (stplyr->mo->scale*100)/FRACUNIT)); @@ -484,7 +484,7 @@ static void ST_drawDebugInfo(void) height -= 120; } - if (cv_debug & DBG_RANDOMIZER) // randomizer testing + if (cht_debug & DBG_RNG) // randomizer testing { fixed_t peekres = P_RandomPeek(); peekres *= 10000; // Change from fixed point @@ -497,17 +497,17 @@ static void ST_drawDebugInfo(void) height -= 32; } - /*if (cv_debug & DBG_MUSIC) + /*if (cht_debug & DBG_MUSIC) { ST_drawMusicDebug(&height); }*/ - if (cv_debug & DBG_RENDER) + if (cht_debug & DBG_RENDER) { ST_drawRenderDebug(&height); } - if (cv_debug & DBG_MEMORY) + if (cht_debug & DBG_MEMORY) V_DrawRightAlignedString(320, height, V_MONOSPACE, va("Heap used: %7sKB", sizeu1(Z_TagsUsage(0, INT32_MAX)>>10))); }