Add goto command, teleport to a waypoint

This commit is contained in:
James R 2023-04-08 01:01:17 -07:00
parent dc18fa745a
commit 5b2d791cf6
3 changed files with 26 additions and 0 deletions

View file

@ -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);

View file

@ -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 <waypoint id>: 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)
//

View file

@ -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