mirror of
https://github.com/KartKrewDev/RingRacers.git
synced 2025-12-21 23:42:36 +00:00
Let relativeteleport work online
Requires all x, y, z arguments. Floats supported. Old: rteleport -x 1 -y 2 -z 3 New: rteleport 1.1 2.2 3.3
This commit is contained in:
parent
63af088231
commit
0024332f34
3 changed files with 47 additions and 50 deletions
|
|
@ -2009,6 +2009,12 @@ void D_Cheat(INT32 playernum, INT32 cheat, ...)
|
||||||
case CHEAT_HURT:
|
case CHEAT_HURT:
|
||||||
COPY(WRITEINT32, INT32);
|
COPY(WRITEINT32, INT32);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case CHEAT_RELATIVE_TELEPORT:
|
||||||
|
COPY(WRITEFIXED, fixed_t);
|
||||||
|
COPY(WRITEFIXED, fixed_t);
|
||||||
|
COPY(WRITEFIXED, fixed_t);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
#undef COPY
|
#undef COPY
|
||||||
|
|
@ -5565,6 +5571,39 @@ static void Got_Cheat(UINT8 **cp, INT32 playernum)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
case CHEAT_RELATIVE_TELEPORT: {
|
||||||
|
fixed_t x = READFIXED(*cp);
|
||||||
|
fixed_t y = READFIXED(*cp);
|
||||||
|
fixed_t z = READFIXED(*cp);
|
||||||
|
|
||||||
|
float f[3] = {
|
||||||
|
FIXED_TO_FLOAT(x),
|
||||||
|
FIXED_TO_FLOAT(y),
|
||||||
|
FIXED_TO_FLOAT(z),
|
||||||
|
};
|
||||||
|
char t[3][9];
|
||||||
|
|
||||||
|
if (!P_MobjWasRemoved(player->mo))
|
||||||
|
{
|
||||||
|
P_MapStart();
|
||||||
|
P_SetOrigin(player->mo,
|
||||||
|
player->mo->x + x,
|
||||||
|
player->mo->y + y,
|
||||||
|
player->mo->z + z);
|
||||||
|
P_MapEnd();
|
||||||
|
|
||||||
|
S_StartSound(player->mo, sfx_mixup);
|
||||||
|
}
|
||||||
|
|
||||||
|
strlcpy(t[0], M_Ftrim(f[0]), sizeof t[0]);
|
||||||
|
strlcpy(t[1], M_Ftrim(f[1]), sizeof t[1]);
|
||||||
|
strlcpy(t[2], M_Ftrim(f[2]), sizeof t[2]);
|
||||||
|
|
||||||
|
CV_CheaterWarning(targetPlayer, va("relative teleport by %d%s, %d%s, %d%s",
|
||||||
|
(int)f[0], t[0], (int)f[1], t[1], (int)f[2], t[2]));
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
case NUMBER_OF_CHEATS:
|
case NUMBER_OF_CHEATS:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -306,64 +306,21 @@ void Command_Hurtme_f(void)
|
||||||
|
|
||||||
void Command_RTeleport_f(void)
|
void Command_RTeleport_f(void)
|
||||||
{
|
{
|
||||||
fixed_t intx, inty, intz;
|
float x = atof(COM_Argv(1));
|
||||||
size_t i;
|
float y = atof(COM_Argv(2));
|
||||||
player_t *p = &players[consoleplayer];
|
float z = atof(COM_Argv(3));
|
||||||
subsector_t *ss;
|
|
||||||
|
|
||||||
REQUIRE_CHEATS;
|
REQUIRE_CHEATS;
|
||||||
REQUIRE_INLEVEL;
|
REQUIRE_INLEVEL;
|
||||||
REQUIRE_SINGLEPLAYER; // TODO: make multiplayer compatible
|
|
||||||
|
|
||||||
if (COM_Argc() < 3 || COM_Argc() > 7)
|
if (COM_Argc() != 4)
|
||||||
{
|
{
|
||||||
CONS_Printf(M_GetText("rteleport -x <value> -y <value> -z <value>: relative teleport to a location\n"));
|
CONS_Printf(M_GetText("rteleport <x> <y> <z>: relative teleport to a location\n"));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!p->mo)
|
D_Cheat(consoleplayer, CHEAT_RELATIVE_TELEPORT,
|
||||||
return;
|
FLOAT_TO_FIXED(x), FLOAT_TO_FIXED(y), FLOAT_TO_FIXED(z));
|
||||||
|
|
||||||
i = COM_CheckParm("-x");
|
|
||||||
if (i)
|
|
||||||
intx = atoi(COM_Argv(i + 1));
|
|
||||||
else
|
|
||||||
intx = 0;
|
|
||||||
|
|
||||||
i = COM_CheckParm("-y");
|
|
||||||
if (i)
|
|
||||||
inty = atoi(COM_Argv(i + 1));
|
|
||||||
else
|
|
||||||
inty = 0;
|
|
||||||
|
|
||||||
ss = R_PointInSubsectorOrNull(p->mo->x + intx*FRACUNIT, p->mo->y + inty*FRACUNIT);
|
|
||||||
if (!ss || ss->sector->ceilingheight - ss->sector->floorheight < p->mo->height)
|
|
||||||
{
|
|
||||||
CONS_Alert(CONS_NOTICE, M_GetText("Not a valid location.\n"));
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
i = COM_CheckParm("-z");
|
|
||||||
if (i)
|
|
||||||
{
|
|
||||||
intz = atoi(COM_Argv(i + 1));
|
|
||||||
intz <<= FRACBITS;
|
|
||||||
intz += p->mo->z;
|
|
||||||
if (intz < ss->sector->floorheight)
|
|
||||||
intz = ss->sector->floorheight;
|
|
||||||
if (intz > ss->sector->ceilingheight - p->mo->height)
|
|
||||||
intz = ss->sector->ceilingheight - p->mo->height;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
intz = p->mo->z;
|
|
||||||
|
|
||||||
CONS_Printf(M_GetText("Teleporting by %d, %d, %d...\n"), intx, inty, FixedInt((intz-p->mo->z)));
|
|
||||||
|
|
||||||
P_MapStart();
|
|
||||||
if (!P_SetOrigin(p->mo, p->mo->x+intx*FRACUNIT, p->mo->y+inty*FRACUNIT, intz))
|
|
||||||
CONS_Alert(CONS_WARNING, M_GetText("Unable to teleport to that spot!\n"));
|
|
||||||
else
|
|
||||||
S_StartSound(p->mo, sfx_mixup);
|
|
||||||
P_MapEnd();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Command_Teleport_f(void)
|
void Command_Teleport_f(void)
|
||||||
|
|
|
||||||
|
|
@ -27,6 +27,7 @@ typedef enum {
|
||||||
CHEAT_SCALE,
|
CHEAT_SCALE,
|
||||||
CHEAT_FLIP,
|
CHEAT_FLIP,
|
||||||
CHEAT_HURT,
|
CHEAT_HURT,
|
||||||
|
CHEAT_RELATIVE_TELEPORT,
|
||||||
|
|
||||||
NUMBER_OF_CHEATS
|
NUMBER_OF_CHEATS
|
||||||
} cheat_t;
|
} cheat_t;
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue