From ddb0c65455546a96c8d96a177bec322f19fea517 Mon Sep 17 00:00:00 2001 From: "James R." Date: Fri, 8 Sep 2023 16:17:20 -0700 Subject: [PATCH] Add goto_skybox command, teleport to skybox viewpoint --- src/d_netcmd.c | 1 + src/m_cheat.c | 17 +++++++++++++++++ src/m_cheat.h | 1 + 3 files changed, 19 insertions(+) diff --git a/src/d_netcmd.c b/src/d_netcmd.c index f60b07c90..356b377d7 100644 --- a/src/d_netcmd.c +++ b/src/d_netcmd.c @@ -551,6 +551,7 @@ void D_RegisterClientCommands(void) COM_AddDebugCommand("goto", Command_Goto_f); COM_AddDebugCommand("angle", Command_Angle_f); COM_AddDebugCommand("respawnat", Command_RespawnAt_f); + COM_AddDebugCommand("goto_skybox", Command_GotoSkybox_f); { extern struct CVarList *cvlist_player; diff --git a/src/m_cheat.c b/src/m_cheat.c index 7c6855e21..8e7a708e6 100644 --- a/src/m_cheat.c +++ b/src/m_cheat.c @@ -640,6 +640,23 @@ void Command_RespawnAt_f(void) D_Cheat(consoleplayer, CHEAT_RESPAWNAT, atoi(COM_Argv(1))); } +void Command_GotoSkybox_f(void) +{ + REQUIRE_CHEATS; + REQUIRE_INLEVEL; + + mobj_t *skybox = players[consoleplayer].skybox.viewpoint; + + if (P_MobjWasRemoved(skybox)) + { + CONS_Printf("There is no visible skybox for local Player 1.\n"); + return; + } + + D_Cheat(consoleplayer, CHEAT_TELEPORT, skybox->x, skybox->y, skybox->z); + D_Cheat(consoleplayer, CHEAT_ANGLE, skybox->angle); +} + // // OBJECTPLACE (and related variables) // diff --git a/src/m_cheat.h b/src/m_cheat.h index 835832500..1c1270e9b 100644 --- a/src/m_cheat.h +++ b/src/m_cheat.h @@ -91,6 +91,7 @@ void Command_Grayscale_f(void); void Command_Goto_f(void); void Command_Angle_f(void); void Command_RespawnAt_f(void); +void Command_GotoSkybox_f(void); #ifdef _DEBUG void Command_CauseCfail_f(void); #endif