mirror of
https://github.com/KartKrewDev/RingRacers.git
synced 2025-12-02 22:22:55 +00:00
Merge branch 'ufo-debug' into 'master'
ufo_follow and ufo_health cheats See merge request KartKrew/Kart!1493
This commit is contained in:
commit
bdc564b989
2 changed files with 92 additions and 0 deletions
|
|
@ -802,6 +802,8 @@ consvar_t cv_numlaps = OnlineCheat("numlaps", "Map default").values(numlaps_cons
|
||||||
consvar_t cv_restrictskinchange = OnlineCheat("restrictskinchange", "Yes").yes_no().description("Don't let players change their skin in the middle of gameplay");
|
consvar_t cv_restrictskinchange = OnlineCheat("restrictskinchange", "Yes").yes_no().description("Don't let players change their skin in the middle of gameplay");
|
||||||
consvar_t cv_spbtest = OnlineCheat("spbtest", "Off").on_off().description("SPB can never target a player");
|
consvar_t cv_spbtest = OnlineCheat("spbtest", "Off").on_off().description("SPB can never target a player");
|
||||||
consvar_t cv_timescale = OnlineCheat(cvlist_timer)("timescale", "1.0").floating_point().min_max(FRACUNIT/20, 20*FRACUNIT).description("Overclock or slow down the game");
|
consvar_t cv_timescale = OnlineCheat(cvlist_timer)("timescale", "1.0").floating_point().min_max(FRACUNIT/20, 20*FRACUNIT).description("Overclock or slow down the game");
|
||||||
|
consvar_t cv_ufo_follow = OnlineCheat("ufo_follow", "0").min_max(0, MAXPLAYERS).description("Make UFO Catcher folow this player");
|
||||||
|
consvar_t cv_ufo_health = OnlineCheat("ufo_health", "100").min_max(0, 100).description("Override UFO Catcher health -- applied at spawn or when value is changed");
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
|
|
|
||||||
|
|
@ -10,6 +10,7 @@
|
||||||
/// \file ufo.c
|
/// \file ufo.c
|
||||||
/// \brief Special Stage UFO + Emerald handler
|
/// \brief Special Stage UFO + Emerald handler
|
||||||
|
|
||||||
|
#include "../command.h"
|
||||||
#include "../doomdef.h"
|
#include "../doomdef.h"
|
||||||
#include "../doomstat.h"
|
#include "../doomstat.h"
|
||||||
#include "../info.h"
|
#include "../info.h"
|
||||||
|
|
@ -337,8 +338,66 @@ waypoint_t *K_GetSpecialUFOWaypoint(mobj_t *ufo)
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void UFOMoveToDistance(mobj_t *ufo, UINT32 distancetofinish)
|
||||||
|
{
|
||||||
|
waypoint_t *finishline = K_GetFinishLineWaypoint();
|
||||||
|
const boolean useshortcuts = false;
|
||||||
|
const boolean huntbackwards = true;
|
||||||
|
path_t pathtofinish = {0};
|
||||||
|
|
||||||
|
if (finishline == NULL)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
boolean pathfindsuccess = K_PathfindThruCircuit(
|
||||||
|
finishline,
|
||||||
|
distancetofinish,
|
||||||
|
&pathtofinish,
|
||||||
|
useshortcuts,
|
||||||
|
huntbackwards
|
||||||
|
);
|
||||||
|
|
||||||
|
if (pathfindsuccess == false)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
pathfindnode_t *node = &pathtofinish.array[pathtofinish.numnodes - 1];
|
||||||
|
|
||||||
|
if (node->camefrom != NULL)
|
||||||
|
{
|
||||||
|
UINT32 a_to_b = (node->gscore - node->camefrom->gscore);
|
||||||
|
UINT32 overshot = (node->gscore - distancetofinish);
|
||||||
|
fixed_t f = FixedDiv(overshot, max(1, a_to_b));
|
||||||
|
|
||||||
|
mobj_t *a = ((waypoint_t*)node->camefrom->nodedata)->mobj;
|
||||||
|
mobj_t *b = ((waypoint_t*)node->nodedata)->mobj;
|
||||||
|
|
||||||
|
UFOMoveTo(
|
||||||
|
ufo,
|
||||||
|
b->x - FixedMul(f, b->x - a->x),
|
||||||
|
b->y - FixedMul(f, b->y - a->y),
|
||||||
|
b->z - FixedMul(f, b->z - a->z)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
Z_Free(pathtofinish.array);
|
||||||
|
}
|
||||||
|
|
||||||
static void UFOMove(mobj_t *ufo)
|
static void UFOMove(mobj_t *ufo)
|
||||||
{
|
{
|
||||||
|
extern consvar_t cv_ufo_follow;
|
||||||
|
|
||||||
|
if (cv_ufo_follow.value)
|
||||||
|
{
|
||||||
|
if (playeringame[cv_ufo_follow.value - 1])
|
||||||
|
{
|
||||||
|
UFOMoveToDistance(ufo, players[cv_ufo_follow.value - 1].distancetofinish);
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
waypoint_t *curWaypoint = NULL;
|
waypoint_t *curWaypoint = NULL;
|
||||||
waypoint_t *destWaypoint = NULL;
|
waypoint_t *destWaypoint = NULL;
|
||||||
|
|
||||||
|
|
@ -496,8 +555,34 @@ static void UFOUpdateSound(mobj_t *ufo) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void UFODebugSetHealth(mobj_t *ufo, UINT8 health)
|
||||||
|
{
|
||||||
|
if (ufo->health == health + 1 || UFOEmeraldChase(ufo) == true)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
extern consvar_t cv_ufo_follow;
|
||||||
|
|
||||||
|
UINT8 pnum = max(1, cv_ufo_follow.value) - 1;
|
||||||
|
mobj_t *source = players[pnum].mo;
|
||||||
|
|
||||||
|
if (playeringame[pnum] == false || P_MobjWasRemoved(source) == true)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
ufo->health = health + 2;
|
||||||
|
Obj_SpecialUFODamage(ufo, ufo, source, DMG_NORMAL); // does 1 damage, updates pieces
|
||||||
|
}
|
||||||
|
|
||||||
void Obj_SpecialUFOThinker(mobj_t *ufo)
|
void Obj_SpecialUFOThinker(mobj_t *ufo)
|
||||||
{
|
{
|
||||||
|
{
|
||||||
|
extern consvar_t cv_ufo_health;
|
||||||
|
UFODebugSetHealth(ufo, cv_ufo_health.value);
|
||||||
|
}
|
||||||
|
|
||||||
UFOMove(ufo);
|
UFOMove(ufo);
|
||||||
UFOUpdateAngle(ufo);
|
UFOUpdateAngle(ufo);
|
||||||
UFOUpdateDistanceToFinish(ufo);
|
UFOUpdateDistanceToFinish(ufo);
|
||||||
|
|
@ -717,6 +802,11 @@ static UINT8 GetUFODamage(mobj_t *inflictor, UINT8 damageType)
|
||||||
// Players deal damage relative to how many sneakers they used.
|
// Players deal damage relative to how many sneakers they used.
|
||||||
return 15 * max(1, inflictor->player->numsneakers);
|
return 15 * max(1, inflictor->player->numsneakers);
|
||||||
}
|
}
|
||||||
|
case MT_SPECIAL_UFO:
|
||||||
|
{
|
||||||
|
// UFODebugSetHealth
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
default:
|
default:
|
||||||
{
|
{
|
||||||
break;
|
break;
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue