Per map track complexity and modifier max

This commit is contained in:
NepDisk 2025-05-13 15:37:20 -04:00
parent 9a45acdd7d
commit bd233a9201
7 changed files with 40 additions and 2 deletions

View file

@ -19,6 +19,8 @@ extern "C" {
boolean B_UseWallTransfer(void);
boolean B_UseTerrainDef(void);
boolean B_TrackComplexity(void);
fixed_t K_TrackModifierMax(void);
#ifdef __cplusplus
} // extern "C"

View file

@ -47,3 +47,28 @@ boolean B_UseTerrainDef(void)
return value;
}
// Give each map a custom track complexity
INT32 B_TrackComplexity(void)
{
const mapheader_t *mapheader = mapheaderinfo[gamemap - 1];
const INT32 defaultvalue = atoi(cv_kartbot_basetrackcomplexity.defaultvalue);
const INT32 mapvalue = mapheader->base_track_complexity;
if (cv_kartbot_basetrackcomplexity.value != defaultvalue || mapvalue == INT32_MAX)
return cv_kartbot_basetrackcomplexity.value;
return mapvalue;
}
fixed_t K_TrackModifierMax(void)
{
const mapheader_t *mapheader = mapheaderinfo[gamemap - 1];
const fixed_t defaultvalue = FloatToFixed(atof(cv_kartbot_modifiermax.defaultvalue));
const fixed_t mapvalue = mapheader->track_modifier_max;
if (cv_kartbot_modifiermax.value != defaultvalue || mapvalue == INT32_MAX)
return cv_kartbot_modifiermax.value;
return mapvalue;
}

View file

@ -1416,6 +1416,10 @@ void readlevelheader(MYFILE *f, char * name)
mapheaderinfo[num]->encorepal = (UINT16)i;
else if (fastcmp(word, "NUMLAPS"))
mapheaderinfo[num]->numlaps = (UINT8)i;
else if (fastcmp(word, "BASETRACKCOMPLEXITY"))
mapheaderinfo[num]->base_track_complexity = i;
else if (fastcmp(word, "TRACKMODIFIERMAX"))
mapheaderinfo[num]->track_modifier_max = FloatToFixed(atof(word2));
else if (fastcmp(word, "LAPSPERSECTION"))
mapheaderinfo[num]->lapspersection = max((UINT8)i, 1u);
else if (fastcmp(word, "UNLOCKABLE"))

View file

@ -443,6 +443,8 @@ struct mapheader_t
// BlanKart
boolean use_walltransfer; ///< Whether to use RR style wall transfering or not
boolean use_terrain; ///< Whether to use gameplay affecting Terrain effects or not (leaves visuals alone)
INT32 base_track_complexity; ///< Decides what the base track compexity for the current map is.
fixed_t track_modifier_max; ///< Decides what the modifier max for the current map is.
};

View file

@ -41,6 +41,7 @@
#include "discord.h" // DRPC_UpdatePresence
#endif
#include "i_net.h" // doomcom
#include "blan/b_soc.h"
consvar_t cv_forcebots = CVAR_INIT ("kartforcebots", "Off", CV_NETVAR|CV_CHEAT, CV_OnOff, NULL);
consvar_t cv_botcontrol = CVAR_INIT ("kartbotcontrol", "On", CV_NETVAR|CV_CHEAT, CV_OnOff, NULL);
@ -510,7 +511,7 @@ const botcontroller_t *K_GetBotController(mobj_t *mobj)
fixed_t K_BotMapModifier(void)
{
constexpr INT32 complexity_scale = 10000;
fixed_t modifier_max = cv_kartbot_modifiermax.value;
fixed_t modifier_max = K_TrackModifierMax();
if (K_CanChangeRules() == false)
{

View file

@ -21,6 +21,7 @@
#include "g_game.h"
#include "p_slopes.h"
#include "k_kart.h"
#include "blan/b_soc.h"
#include "cxxutil.hpp"
@ -45,7 +46,8 @@ static waypoint_t *startingwaypoint = NULL;
static UINT32 circuitlength = 0U;
#define BASE_TRACK_COMPLEXITY (cv_kartbot_basetrackcomplexity.value) // Arbritrary, vibes-based value
// Defaults to arbritrary, vibes-based value other wise uses maps specified value instead.
#define BASE_TRACK_COMPLEXITY (B_TrackComplexity())
static INT32 trackcomplexity = 0;
static size_t numwaypoints = 0U;

View file

@ -432,6 +432,8 @@ static void P_ClearSingleMapHeaderInfo(INT16 num)
mapheaderinfo[num]->palette = UINT16_MAX;
mapheaderinfo[num]->encorepal = UINT16_MAX;
mapheaderinfo[num]->numlaps = NUMLAPS_DEFAULT;
mapheaderinfo[num]->base_track_complexity = INT32_MAX;
mapheaderinfo[num]->track_modifier_max = INT32_MAX;
mapheaderinfo[num]->lapspersection = 1;
mapheaderinfo[num]->unlockrequired = -1;
mapheaderinfo[num]->levelselect = 0;