Restore SPB force-seek define as 'spbtest' cvar

This commit is contained in:
AJ Martinez 2022-10-01 21:46:26 -07:00
parent 1300ec5d56
commit 6a7c5050ad
4 changed files with 65 additions and 57 deletions

View file

@ -455,6 +455,9 @@ consvar_t cv_kartdebugcheckpoint = CVAR_INIT ("kartdebugcheckpoint", "Off", CV_C
consvar_t cv_kartdebugnodes = CVAR_INIT ("kartdebugnodes", "Off", CV_CHEAT, CV_OnOff, NULL); consvar_t cv_kartdebugnodes = CVAR_INIT ("kartdebugnodes", "Off", CV_CHEAT, CV_OnOff, NULL);
consvar_t cv_kartdebugcolorize = CVAR_INIT ("kartdebugcolorize", "Off", CV_CHEAT, CV_OnOff, NULL); consvar_t cv_kartdebugcolorize = CVAR_INIT ("kartdebugcolorize", "Off", CV_CHEAT, CV_OnOff, NULL);
consvar_t cv_kartdebugdirector = CVAR_INIT ("kartdebugdirector", "Off", CV_CHEAT, CV_OnOff, NULL); consvar_t cv_kartdebugdirector = CVAR_INIT ("kartdebugdirector", "Off", CV_CHEAT, CV_OnOff, NULL);
#ifdef DEVELOP
consvar_t cv_spbtest = CVAR_INIT ("spbtest", "Off", CV_CHEAT, CV_OnOff, NULL);
#endif
static CV_PossibleValue_t votetime_cons_t[] = {{10, "MIN"}, {3600, "MAX"}, {0, NULL}}; static CV_PossibleValue_t votetime_cons_t[] = {{10, "MIN"}, {3600, "MAX"}, {0, NULL}};
consvar_t cv_votetime = CVAR_INIT ("votetime", "20", CV_NETVAR, votetime_cons_t, NULL); consvar_t cv_votetime = CVAR_INIT ("votetime", "20", CV_NETVAR, votetime_cons_t, NULL);

View file

@ -123,7 +123,7 @@ extern consvar_t cv_kartusepwrlv;
extern consvar_t cv_votetime; extern consvar_t cv_votetime;
extern consvar_t cv_kartdebugitem, cv_kartdebugamount, cv_kartdebugdistribution, cv_kartdebughuddrop; extern consvar_t cv_kartdebugitem, cv_kartdebugamount, cv_kartdebugdistribution, cv_kartdebughuddrop;
extern consvar_t cv_kartdebugcheckpoint, cv_kartdebugnodes, cv_kartdebugcolorize, cv_kartdebugdirector; extern consvar_t cv_kartdebugcheckpoint, cv_kartdebugnodes, cv_kartdebugcolorize, cv_kartdebugdirector, cv_spbtest;
extern consvar_t cv_kartdebugwaypoints, cv_kartdebugbotpredict; extern consvar_t cv_kartdebugwaypoints, cv_kartdebugbotpredict;
extern consvar_t cv_itemfinder; extern consvar_t cv_itemfinder;

View file

@ -267,6 +267,7 @@ void K_RegisterKartStuff(void)
CV_RegisterVar(&cv_kartdebugnodes); CV_RegisterVar(&cv_kartdebugnodes);
CV_RegisterVar(&cv_kartdebugcolorize); CV_RegisterVar(&cv_kartdebugcolorize);
CV_RegisterVar(&cv_kartdebugdirector); CV_RegisterVar(&cv_kartdebugdirector);
CV_RegisterVar(&cv_spbtest);
} }
//} //}

View file

@ -24,8 +24,6 @@
#include "../k_waypoint.h" #include "../k_waypoint.h"
#include "../k_respawn.h" #include "../k_respawn.h"
// #define SPB_SEEKTEST
#define SPB_SLIPTIDEDELTA (ANG1 * 3) #define SPB_SLIPTIDEDELTA (ANG1 * 3)
#define SPB_STEERDELTA (ANGLE_90 - ANG10) #define SPB_STEERDELTA (ANGLE_90 - ANG10)
#define SPB_DEFAULTSPEED (FixedMul(mapobjectscale, K_GetKartSpeedFromStat(9) * 2)) #define SPB_DEFAULTSPEED (FixedMul(mapobjectscale, K_GetKartSpeedFromStat(9) * 2))
@ -107,8 +105,8 @@ static void SPBMantaRings(mobj_t *spb)
Obj_MantaRingCreate( Obj_MantaRingCreate(
spb, spb,
spb_owner(spb), spb_owner(spb),
#ifdef SPB_SEEKTEST #ifdef DEVELOP
NULL cv_spbtest.value ? NULL : spb_chase(spb)
#else #else
spb_chase(spb) spb_chase(spb)
#endif #endif
@ -360,8 +358,11 @@ static void SPBSeek(mobj_t *spb, player_t *bestPlayer)
spb->fuse = 2*TICRATE; spb->fuse = 2*TICRATE;
} }
} }
#ifndef SPB_SEEKTEST // Easy debug switch #ifdef DEVELOP
else if (!cv_spbtest.value)
#else
else else
#endif
{ {
if (dist <= activeDist) if (dist <= activeDist)
{ {
@ -378,7 +379,6 @@ static void SPBSeek(mobj_t *spb, player_t *bestPlayer)
return; return;
} }
} }
#endif
if (SPBSeekSoundPlaying(spb) == false) if (SPBSeekSoundPlaying(spb) == false)
{ {
@ -441,64 +441,68 @@ static void SPBSeek(mobj_t *spb, player_t *bestPlayer)
if (pathfindsuccess == true) if (pathfindsuccess == true)
{ {
#ifdef SPB_SEEKTEST #ifdef DEVELOP
if (pathtoplayer.numnodes > 1) if (cv_spbtest.value) {
{ if (pathtoplayer.numnodes > 1)
// Go to the next waypoint. {
curWaypoint = (waypoint_t *)pathtoplayer.array[1].nodedata; // Go to the next waypoint.
} curWaypoint = (waypoint_t *)pathtoplayer.array[1].nodedata;
else if (destWaypoint->numnextwaypoints > 0) }
{ else if (destWaypoint->numnextwaypoints > 0)
// Run ahead. {
curWaypoint = destWaypoint->nextwaypoints[0]; // Run ahead.
curWaypoint = destWaypoint->nextwaypoints[0];
}
else
{
// Sort of wait at the player's dest waypoint.
circling = true;
curWaypoint = destWaypoint;
}
} }
else else
{
// Sort of wait at the player's dest waypoint.
circling = true;
curWaypoint = destWaypoint;
}
#else #else
path_t reversepath = {0}; {
boolean reversesuccess = false; path_t reversepath = {0};
boolean reversesuccess = false;
huntbackwards = true; huntbackwards = true;
reversesuccess = K_PathfindToWaypoint( reversesuccess = K_PathfindToWaypoint(
curWaypoint, destWaypoint, curWaypoint, destWaypoint,
&reversepath, &reversepath,
useshortcuts, huntbackwards useshortcuts, huntbackwards
); );
if (reversesuccess == true if (reversesuccess == true
&& reversepath.totaldist < pathtoplayer.totaldist) && reversepath.totaldist < pathtoplayer.totaldist)
{ {
// It's faster to go backwards than to chase forward. // It's faster to go backwards than to chase forward.
// Keep curWaypoint the same, so the SPB waits around for them. // Keep curWaypoint the same, so the SPB waits around for them.
circling = true; circling = true;
} }
else if (pathtoplayer.numnodes > 1) else if (pathtoplayer.numnodes > 1)
{ {
// Go to the next waypoint. // Go to the next waypoint.
curWaypoint = (waypoint_t *)pathtoplayer.array[1].nodedata; curWaypoint = (waypoint_t *)pathtoplayer.array[1].nodedata;
} }
else if (spb->fuse > 0 && destWaypoint->numnextwaypoints > 0) else if (spb->fuse > 0 && destWaypoint->numnextwaypoints > 0)
{ {
// Run ahead. // Run ahead.
curWaypoint = destWaypoint->nextwaypoints[0]; curWaypoint = destWaypoint->nextwaypoints[0];
} }
else else
{ {
// Sort of wait at the player's dest waypoint. // Sort of wait at the player's dest waypoint.
circling = true; circling = true;
curWaypoint = destWaypoint; curWaypoint = destWaypoint;
} }
if (reversesuccess == true) if (reversesuccess == true)
{ {
Z_Free(reversepath.array); Z_Free(reversepath.array);
}
} }
#endif #endif
Z_Free(pathtoplayer.array); Z_Free(pathtoplayer.array);
} }
} }