This commit is contained in:
Sally Coolatta 2022-04-02 14:43:38 -04:00
parent 6bdd11533c
commit 5ffba0a678
4 changed files with 78 additions and 68 deletions

View file

@ -487,7 +487,7 @@ static UINT32 K_BotRubberbandDistance(player_t *player)
fixed_t K_BotRubberband(player_t *player) fixed_t K_BotRubberband(player_t *player)
{ {
fixed_t rubberband = FRACUNIT; fixed_t rubberband = FRACUNIT;
fixed_t max, min; fixed_t rubbermax, rubbermin;
player_t *firstplace = NULL; player_t *firstplace = NULL;
line_t *botController = NULL; line_t *botController = NULL;
UINT8 i; UINT8 i;
@ -551,21 +551,21 @@ fixed_t K_BotRubberband(player_t *player)
// Lv. 5: x1.4 max // Lv. 5: x1.4 max
// Lv. 9: x1.8 max // Lv. 9: x1.8 max
// Lv. MAX: x2.2 max // Lv. MAX: x2.2 max
max = FRACUNIT + ((FRACUNIT * (player->botvars.difficulty - 1)) / 10); rubbermax = FRACUNIT + ((FRACUNIT * (player->botvars.difficulty - 1)) / 10);
// Lv. 1: x0.75 min // Lv. 1: x0.75 min
// Lv. 5: x0.875 min // Lv. 5: x0.875 min
// Lv. 9: x1.0 min // Lv. 9: x1.0 min
// Lv. MAX: x1.0 min // Lv. MAX: x1.0 min
min = FRACUNIT - (((FRACUNIT/4) * (DIFFICULTBOT - min(DIFFICULTBOT, player->botvars.difficulty))) / (DIFFICULTBOT - 1)); rubbermin = FRACUNIT - (((FRACUNIT/4) * (DIFFICULTBOT - min(DIFFICULTBOT, player->botvars.difficulty))) / (DIFFICULTBOT - 1));
if (rubberband > max) if (rubberband > rubbermax)
{ {
rubberband = max; rubberband = rubbermax;
} }
else if (rubberband < min) else if (rubberband < rubbermin)
{ {
rubberband = min; rubberband = rubbermin;
} }
return rubberband; return rubberband;
@ -1119,6 +1119,11 @@ static INT32 K_HandleBotTrack(player_t *player, ticcmd_t *cmd, botprediction_t *
predict->x, predict->y predict->x, predict->y
); );
if (realrad < player->mo->radius)
{
realrad = player->mo->radius;
}
if (anglediff > 0) if (anglediff > 0)
{ {
// Become more precise based on how hard you need to turn // Become more precise based on how hard you need to turn
@ -1447,11 +1452,7 @@ void K_BuildBotTiccmd(player_t *player, ticcmd_t *cmd)
turnamt = bullyTurn; turnamt = bullyTurn;
// If already spindashing, wait until we get a relatively OK charge first. // If already spindashing, wait until we get a relatively OK charge first.
if (player->spindash > 0 && player->spindash <= TICRATE) if (player->spindash == 0 || player->spindash > TICRATE)
{
trySpindash = true;
}
else
{ {
trySpindash = false; trySpindash = false;
cmd->buttons |= BT_ACCELERATE; cmd->buttons |= BT_ACCELERATE;

View file

@ -513,18 +513,16 @@ void K_IncreaseBotDifficulty(player_t *bot)
} }
/*-------------------------------------------------- /*--------------------------------------------------
void K_ReplaceBot(player_t *bot) void K_RetireBots(void)
See header file for description. See header file for description.
--------------------------------------------------*/ --------------------------------------------------*/
void K_ReplaceBot(player_t *bot) void K_RetireBots(void)
{ {
const SINT8 defaultbotskin = K_BotDefaultSkin(); const SINT8 defaultbotskin = K_BotDefaultSkin();
SINT8 newDifficulty; SINT8 newDifficulty;
boolean skinusable[MAXSKINS]; boolean skinusable[MAXSKINS];
UINT8 skinnum;
UINT8 loops = 0;
UINT8 i; UINT8 i;
@ -555,32 +553,6 @@ void K_ReplaceBot(player_t *bot)
} }
} }
skinnum = P_RandomKey(numskins);
while (!skinusable[skinnum])
{
if (loops >= numskins)
{
// no more skins
break;
}
skinnum++;
if (skinnum >= numskins)
{
skinnum = 0;
}
loops++;
}
if (loops >= numskins)
{
// Use default skin
skinnum = defaultbotskin;
}
if (!grandprixinfo.gp) // Sure, let's let this happen all the time :) if (!grandprixinfo.gp) // Sure, let's let this happen all the time :)
{ {
newDifficulty = cv_kartbot.value; newDifficulty = cv_kartbot.value;
@ -600,14 +572,64 @@ void K_ReplaceBot(player_t *bot)
newDifficulty = 1; newDifficulty = 1;
} }
bot->botvars.difficulty = newDifficulty; for (i = 0; i < MAXPLAYERS; i++)
bot->botvars.diffincrease = 0; {
player_t *bot = NULL;
SetPlayerSkinByNum(bot - players, skinnum); if (!playeringame[i] || !players[i].bot)
bot->skincolor = skins[skinnum].prefcolor; {
sprintf(player_names[bot - players], "%s", skins[skinnum].realname); continue;
}
bot->score = 0; bot = players[i];
if (bot->spectator)
{
continue;
}
if (bot->pflags & PF_NOCONTEST)
{
UINT8 skinnum = P_RandomKey(numskins);
UINT8 loops = 0;
while (!skinusable[skinnum])
{
if (loops >= numskins)
{
// no more skins
break;
}
skinnum++;
if (skinnum >= numskins)
{
skinnum = 0;
}
loops++;
}
if (loops >= numskins)
{
// Use default skin
skinnum = defaultbotskin;
}
skinusable[skinnum] = false;
bot->botvars.difficulty = newDifficulty;
bot->botvars.diffincrease = 0;
SetPlayerSkinByNum(bot - players, skinnum);
bot->skincolor = skins[skinnum].prefcolor;
sprintf(player_names[bot - players], "%s", skins[skinnum].realname);
bot->score = 0;
bot->pflags &= ~PF_NOCONTEST;
}
}
} }
/*-------------------------------------------------- /*--------------------------------------------------

View file

@ -106,19 +106,13 @@ void K_IncreaseBotDifficulty(player_t *bot);
/*-------------------------------------------------- /*--------------------------------------------------
void K_ReplaceBot(player_t *bot); void K_RetireBots(player_t *bot);
"Replaces" a bot, by refreshing their difficulty Replaces PF_NOCONTEST bots, by refreshing their difficulty
and changing their skin. and changing their skin.
Input Arguments:-
bot - Player to do this for.
Return:-
None
--------------------------------------------------*/ --------------------------------------------------*/
void K_ReplaceBot(player_t *bot); void K_RetireBots(player_t *bot);
/*-------------------------------------------------- /*--------------------------------------------------
@ -162,7 +156,7 @@ void K_PlayerLoseLife(player_t *player);
None None
Return:- Return:-
None true if can change important gameplay rules, otherwise false.
--------------------------------------------------*/ --------------------------------------------------*/
boolean K_CanChangeRules(void); boolean K_CanChangeRules(void);

View file

@ -584,7 +584,7 @@ void Y_IntermissionDrawer(void)
V_DrawScaledPatch(x+16, y-4, 0, W_CachePatchName(va("K_CHILI%d", cursorframe+1), PU_CACHE)); V_DrawScaledPatch(x+16, y-4, 0, W_CachePatchName(va("K_CHILI%d", cursorframe+1), PU_CACHE));
} }
if (!data.rankingsmode && (players[data.num[i]].pflags & PF_NOCONTEST) && players[data.num[i]].bot) if ((players[data.num[i]].pflags & PF_NOCONTEST) && players[data.num[i]].bot)
{ {
// RETIRED!! // RETIRED!!
V_DrawScaledPatch(x+12, y-7, 0, W_CachePatchName("K_NOBLNS", PU_CACHE)); V_DrawScaledPatch(x+12, y-7, 0, W_CachePatchName("K_NOBLNS", PU_CACHE));
@ -811,15 +811,7 @@ void Y_Ticker(void)
{ {
if (!data.rankingsmode && sorttic != -1 && (intertic >= sorttic + 8)) if (!data.rankingsmode && sorttic != -1 && (intertic >= sorttic + 8))
{ {
UINT8 i; K_RetireBots();
for (i = 0; i < MAXPLAYERS; i++)
{
if ((players[i].pflags & PF_NOCONTEST) && players[i].bot)
{
K_ReplaceBot(&players[i]);
}
}
Y_CalculateMatchData(1, Y_CompareRank); Y_CalculateMatchData(1, Y_CompareRank);
} }
@ -1170,6 +1162,7 @@ void Y_StartIntermission(void)
// //
void Y_EndIntermission(void) void Y_EndIntermission(void)
{ {
K_RetireBots();
Y_UnloadData(); Y_UnloadData();
endtic = -1; endtic = -1;