From 24d847f4ec0d71adc6fd83cb8b80241db44c6b18 Mon Sep 17 00:00:00 2001 From: Mitchell Richters Date: Tue, 4 Aug 2020 18:03:47 +1000 Subject: [PATCH] - create Duke dynamic CCMD `warptocoords`. --- source/games/duke/src/ccmds.cpp | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/source/games/duke/src/ccmds.cpp b/source/games/duke/src/ccmds.cpp index 3425763ce..0b303f3ac 100644 --- a/source/games/duke/src/ccmds.cpp +++ b/source/games/duke/src/ccmds.cpp @@ -261,6 +261,22 @@ static int ccmd_give(CCmdFuncPtr parm) return CCMD_OK; } +static int osdcmd_warptocoords(CCmdFuncPtr parm) +{ + if (parm->numparms != 5) + return CCMD_SHOWHELP; + + player_struct* p = &ps[myconnectindex]; + + p->oposx = p->posx = atoi(parm->parms[0]); + p->oposy = p->posy = atoi(parm->parms[1]); + p->oposz = p->posz = atoi(parm->parms[2]); + p->oq16ang = p->q16ang = fix16_from_int(atoi(parm->parms[3])); + p->oq16horiz = p->q16horiz = fix16_from_int(atoi(parm->parms[4])); + + return CCMD_OK; +} + int registerosdcommands(void) @@ -276,6 +292,8 @@ int registerosdcommands(void) C_RegisterFunction("spawn","spawn [palnum] [cstat] [ang] [x y z]: spawns a sprite with the given properties",ccmd_spawn); + C_RegisterFunction("warptocoords","warptocoords [x] [y] [z] [ang] [horiz]: warps the player to the specified coordinates",osdcmd_warptocoords); + return 0; }