mirror of
https://github.com/KartKrewDev/RingRacers.git
synced 2026-04-27 20:41:46 +00:00
Merge branch 'rework-rteleport-command' into 'master'
relativeteleport cheat online See merge request KartKrew/Kart!719
This commit is contained in:
commit
40b28d7d1a
3 changed files with 47 additions and 50 deletions
|
|
@ -2060,6 +2060,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
|
||||||
|
|
@ -5631,6 +5637,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)
|
||||||
|
|
|
||||||
|
|
@ -28,6 +28,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