diff --git a/src/d_netcmd.c b/src/d_netcmd.c index 435cc5b6f..de352ee81 100644 --- a/src/d_netcmd.c +++ b/src/d_netcmd.c @@ -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_kartdebugcolorize = CVAR_INIT ("kartdebugcolorize", "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}}; consvar_t cv_votetime = CVAR_INIT ("votetime", "20", CV_NETVAR, votetime_cons_t, NULL); diff --git a/src/d_netcmd.h b/src/d_netcmd.h index 2f2b2a25b..eb1575b98 100644 --- a/src/d_netcmd.h +++ b/src/d_netcmd.h @@ -123,7 +123,7 @@ extern consvar_t cv_kartusepwrlv; extern consvar_t cv_votetime; 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_itemfinder; diff --git a/src/k_kart.c b/src/k_kart.c index c7559d558..7aba7398c 100644 --- a/src/k_kart.c +++ b/src/k_kart.c @@ -267,6 +267,7 @@ void K_RegisterKartStuff(void) CV_RegisterVar(&cv_kartdebugnodes); CV_RegisterVar(&cv_kartdebugcolorize); CV_RegisterVar(&cv_kartdebugdirector); + CV_RegisterVar(&cv_spbtest); } //} diff --git a/src/objects/spb.c b/src/objects/spb.c index 0ea565e45..c38c6b9d1 100644 --- a/src/objects/spb.c +++ b/src/objects/spb.c @@ -24,8 +24,6 @@ #include "../k_waypoint.h" #include "../k_respawn.h" -// #define SPB_SEEKTEST - #define SPB_SLIPTIDEDELTA (ANG1 * 3) #define SPB_STEERDELTA (ANGLE_90 - ANG10) #define SPB_DEFAULTSPEED (FixedMul(mapobjectscale, K_GetKartSpeedFromStat(9) * 2)) @@ -107,8 +105,8 @@ static void SPBMantaRings(mobj_t *spb) Obj_MantaRingCreate( spb, spb_owner(spb), -#ifdef SPB_SEEKTEST - NULL +#ifdef DEVELOP + cv_spbtest.value ? NULL : spb_chase(spb) #else spb_chase(spb) #endif @@ -360,8 +358,11 @@ static void SPBSeek(mobj_t *spb, player_t *bestPlayer) spb->fuse = 2*TICRATE; } } -#ifndef SPB_SEEKTEST // Easy debug switch +#ifdef DEVELOP + else if (!cv_spbtest.value) +#else else +#endif { if (dist <= activeDist) { @@ -378,7 +379,6 @@ static void SPBSeek(mobj_t *spb, player_t *bestPlayer) return; } } -#endif if (SPBSeekSoundPlaying(spb) == false) { @@ -441,64 +441,68 @@ static void SPBSeek(mobj_t *spb, player_t *bestPlayer) if (pathfindsuccess == true) { -#ifdef SPB_SEEKTEST - if (pathtoplayer.numnodes > 1) - { - // Go to the next waypoint. - curWaypoint = (waypoint_t *)pathtoplayer.array[1].nodedata; - } - else if (destWaypoint->numnextwaypoints > 0) - { - // Run ahead. - curWaypoint = destWaypoint->nextwaypoints[0]; +#ifdef DEVELOP + if (cv_spbtest.value) { + if (pathtoplayer.numnodes > 1) + { + // Go to the next waypoint. + curWaypoint = (waypoint_t *)pathtoplayer.array[1].nodedata; + } + else if (destWaypoint->numnextwaypoints > 0) + { + // Run ahead. + curWaypoint = destWaypoint->nextwaypoints[0]; + } + else + { + // Sort of wait at the player's dest waypoint. + circling = true; + curWaypoint = destWaypoint; + } } else - { - // Sort of wait at the player's dest waypoint. - circling = true; - curWaypoint = destWaypoint; - } #else - path_t reversepath = {0}; - boolean reversesuccess = false; + { + path_t reversepath = {0}; + boolean reversesuccess = false; - huntbackwards = true; - reversesuccess = K_PathfindToWaypoint( - curWaypoint, destWaypoint, - &reversepath, - useshortcuts, huntbackwards - ); + huntbackwards = true; + reversesuccess = K_PathfindToWaypoint( + curWaypoint, destWaypoint, + &reversepath, + useshortcuts, huntbackwards + ); - if (reversesuccess == true - && reversepath.totaldist < pathtoplayer.totaldist) - { - // It's faster to go backwards than to chase forward. - // Keep curWaypoint the same, so the SPB waits around for them. - circling = true; - } - else if (pathtoplayer.numnodes > 1) - { - // Go to the next waypoint. - curWaypoint = (waypoint_t *)pathtoplayer.array[1].nodedata; - } - else if (spb->fuse > 0 && destWaypoint->numnextwaypoints > 0) - { - // Run ahead. - curWaypoint = destWaypoint->nextwaypoints[0]; - } - else - { - // Sort of wait at the player's dest waypoint. - circling = true; - curWaypoint = destWaypoint; - } + if (reversesuccess == true + && reversepath.totaldist < pathtoplayer.totaldist) + { + // It's faster to go backwards than to chase forward. + // Keep curWaypoint the same, so the SPB waits around for them. + circling = true; + } + else if (pathtoplayer.numnodes > 1) + { + // Go to the next waypoint. + curWaypoint = (waypoint_t *)pathtoplayer.array[1].nodedata; + } + else if (spb->fuse > 0 && destWaypoint->numnextwaypoints > 0) + { + // Run ahead. + curWaypoint = destWaypoint->nextwaypoints[0]; + } + else + { + // Sort of wait at the player's dest waypoint. + circling = true; + curWaypoint = destWaypoint; + } - if (reversesuccess == true) - { - Z_Free(reversepath.array); + if (reversesuccess == true) + { + Z_Free(reversepath.array); + } } #endif - Z_Free(pathtoplayer.array); } }