diff --git a/src/d_netcmd.c b/src/d_netcmd.c index 1ab532025..1c974fa7a 100644 --- a/src/d_netcmd.c +++ b/src/d_netcmd.c @@ -1098,6 +1098,7 @@ void D_RegisterClientCommands(void) COM_AddCommand("skynum", Command_Skynum_f); COM_AddCommand("weather", Command_Weather_f); COM_AddCommand("grayscale", Command_Grayscale_f); + COM_AddCommand("goto", Command_Goto_f); CV_RegisterVar(&cv_renderhitbox); CV_RegisterVar(&cv_devmode_screen); diff --git a/src/m_cheat.c b/src/m_cheat.c index ac66a5c97..dff5d27c2 100644 --- a/src/m_cheat.c +++ b/src/m_cheat.c @@ -579,6 +579,30 @@ void Command_Grayscale_f(void) COM_ImmedExecute("toggle palette \"\" GRAYPAL"); } +void Command_Goto_f(void) +{ + const INT32 id = atoi(COM_Argv(1)); + const waypoint_t *wayp = K_GetWaypointFromID(id); + + REQUIRE_CHEATS; + REQUIRE_INLEVEL; + + if (COM_Argc() != 2) + { + CONS_Printf(M_GetText("goto : teleport to a waypoint\n")); + return; + } + + if (wayp == NULL) + { + CONS_Alert(CONS_WARNING, "goto %d: no waypoint with that ID\n", id); + return; + } + + D_Cheat(consoleplayer, CHEAT_TELEPORT, + wayp->mobj->x, wayp->mobj->y, wayp->mobj->z); +} + // // OBJECTPLACE (and related variables) // diff --git a/src/m_cheat.h b/src/m_cheat.h index 92e25243a..a7a1c020c 100644 --- a/src/m_cheat.h +++ b/src/m_cheat.h @@ -83,6 +83,7 @@ void Command_RTeleport_f(void); void Command_Skynum_f(void); void Command_Weather_f(void); void Command_Grayscale_f(void); +void Command_Goto_f(void); #ifdef _DEBUG void Command_CauseCfail_f(void); #endif