mirror of
https://github.com/Shpoike/Quakespasm.git
synced 2024-11-10 15:31:39 +00:00
host_cmd.c: add new "setpos" command.
developer cheat to teleport to a given origin, optionally looking in a given direction. git-svn-id: svn+ssh://svn.code.sf.net/p/quakespasm/code/trunk@1308 af15c1b1-3010-417e-b628-4374ebc0bcbd
This commit is contained in:
parent
9343180104
commit
aa5e79f86a
2 changed files with 64 additions and 0 deletions
|
@ -640,6 +640,67 @@ void Host_Noclip_f (void)
|
|||
//johnfitz
|
||||
}
|
||||
|
||||
/*
|
||||
====================
|
||||
Host_SetPos_f
|
||||
|
||||
adapted from fteqw, originally by Alex Shadowalker
|
||||
====================
|
||||
*/
|
||||
void Host_SetPos_f(void)
|
||||
{
|
||||
if (cmd_source == src_command)
|
||||
{
|
||||
Cmd_ForwardToServer ();
|
||||
return;
|
||||
}
|
||||
|
||||
if (pr_global_struct->deathmatch)
|
||||
return;
|
||||
|
||||
if (Cmd_Argc() != 7 && Cmd_Argc() != 4)
|
||||
{
|
||||
SV_ClientPrintf("usage:\n");
|
||||
SV_ClientPrintf(" setpos <x> <y> <z>\n");
|
||||
SV_ClientPrintf(" setpos <x> <y> <z> <pitch> <yaw> <roll>\n");
|
||||
SV_ClientPrintf("current values:\n");
|
||||
SV_ClientPrintf(" %i %i %i %i %i %i\n",
|
||||
(int)sv_player->v.origin[0],
|
||||
(int)sv_player->v.origin[1],
|
||||
(int)sv_player->v.origin[2],
|
||||
(int)sv_player->v.v_angle[0],
|
||||
(int)sv_player->v.v_angle[1],
|
||||
(int)sv_player->v.v_angle[2]);
|
||||
return;
|
||||
}
|
||||
|
||||
if (sv_player->v.movetype != MOVETYPE_NOCLIP)
|
||||
{
|
||||
noclip_anglehack = true;
|
||||
sv_player->v.movetype = MOVETYPE_NOCLIP;
|
||||
SV_ClientPrintf ("noclip ON\n");
|
||||
}
|
||||
|
||||
//make sure they're not going to whizz away from it
|
||||
sv_player->v.velocity[0] = 0;
|
||||
sv_player->v.velocity[1] = 0;
|
||||
sv_player->v.velocity[2] = 0;
|
||||
|
||||
sv_player->v.origin[0] = atof(Cmd_Argv(1));
|
||||
sv_player->v.origin[1] = atof(Cmd_Argv(2));
|
||||
sv_player->v.origin[2] = atof(Cmd_Argv(3));
|
||||
|
||||
if (Cmd_Argc() == 7)
|
||||
{
|
||||
sv_player->v.angles[0] = atof(Cmd_Argv(4));
|
||||
sv_player->v.angles[1] = atof(Cmd_Argv(5));
|
||||
sv_player->v.angles[2] = atof(Cmd_Argv(6));
|
||||
sv_player->v.fixangle = 1;
|
||||
}
|
||||
|
||||
SV_LinkEdict (sv_player, false);
|
||||
}
|
||||
|
||||
/*
|
||||
==================
|
||||
Host_Fly_f
|
||||
|
@ -2236,6 +2297,7 @@ void Host_InitCommands (void)
|
|||
Cmd_AddCommand ("reconnect", Host_Reconnect_f);
|
||||
Cmd_AddCommand ("name", Host_Name_f);
|
||||
Cmd_AddCommand ("noclip", Host_Noclip_f);
|
||||
Cmd_AddCommand ("setpos", Host_SetPos_f); //QuakeSpasm
|
||||
|
||||
Cmd_AddCommand ("say", Host_Say_f);
|
||||
Cmd_AddCommand ("say_team", Host_Say_Team_f);
|
||||
|
|
|
@ -543,6 +543,8 @@ nextmsg:
|
|||
ret = 1;
|
||||
else if (q_strncasecmp(s, "noclip", 6) == 0)
|
||||
ret = 1;
|
||||
else if (q_strncasecmp(s, "setpos", 6) == 0)
|
||||
ret = 1;
|
||||
else if (q_strncasecmp(s, "say", 3) == 0)
|
||||
ret = 1;
|
||||
else if (q_strncasecmp(s, "say_team", 8) == 0)
|
||||
|
|
Loading…
Reference in a new issue