mirror of
https://github.com/KartKrewDev/RingRacers.git
synced 2025-10-30 08:01:28 +00:00
review
This commit is contained in:
parent
6bdd11533c
commit
5ffba0a678
4 changed files with 78 additions and 68 deletions
25
src/k_bot.c
25
src/k_bot.c
|
|
@ -487,7 +487,7 @@ static UINT32 K_BotRubberbandDistance(player_t *player)
|
|||
fixed_t K_BotRubberband(player_t *player)
|
||||
{
|
||||
fixed_t rubberband = FRACUNIT;
|
||||
fixed_t max, min;
|
||||
fixed_t rubbermax, rubbermin;
|
||||
player_t *firstplace = NULL;
|
||||
line_t *botController = NULL;
|
||||
UINT8 i;
|
||||
|
|
@ -551,21 +551,21 @@ fixed_t K_BotRubberband(player_t *player)
|
|||
// Lv. 5: x1.4 max
|
||||
// Lv. 9: x1.8 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. 5: x0.875 min
|
||||
// Lv. 9: 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;
|
||||
|
|
@ -1119,6 +1119,11 @@ static INT32 K_HandleBotTrack(player_t *player, ticcmd_t *cmd, botprediction_t *
|
|||
predict->x, predict->y
|
||||
);
|
||||
|
||||
if (realrad < player->mo->radius)
|
||||
{
|
||||
realrad = player->mo->radius;
|
||||
}
|
||||
|
||||
if (anglediff > 0)
|
||||
{
|
||||
// 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;
|
||||
|
||||
// If already spindashing, wait until we get a relatively OK charge first.
|
||||
if (player->spindash > 0 && player->spindash <= TICRATE)
|
||||
{
|
||||
trySpindash = true;
|
||||
}
|
||||
else
|
||||
if (player->spindash == 0 || player->spindash > TICRATE)
|
||||
{
|
||||
trySpindash = false;
|
||||
cmd->buttons |= BT_ACCELERATE;
|
||||
|
|
|
|||
|
|
@ -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.
|
||||
--------------------------------------------------*/
|
||||
void K_ReplaceBot(player_t *bot)
|
||||
void K_RetireBots(void)
|
||||
{
|
||||
const SINT8 defaultbotskin = K_BotDefaultSkin();
|
||||
SINT8 newDifficulty;
|
||||
|
||||
boolean skinusable[MAXSKINS];
|
||||
UINT8 skinnum;
|
||||
UINT8 loops = 0;
|
||||
|
||||
UINT8 i;
|
||||
|
||||
|
|
@ -555,7 +553,45 @@ void K_ReplaceBot(player_t *bot)
|
|||
}
|
||||
}
|
||||
|
||||
skinnum = P_RandomKey(numskins);
|
||||
if (!grandprixinfo.gp) // Sure, let's let this happen all the time :)
|
||||
{
|
||||
newDifficulty = cv_kartbot.value;
|
||||
}
|
||||
else
|
||||
{
|
||||
const UINT8 startingdifficulty = K_BotStartingDifficulty(grandprixinfo.gamespeed);
|
||||
newDifficulty = startingdifficulty - 4 + grandprixinfo.roundnum;
|
||||
}
|
||||
|
||||
if (newDifficulty > MAXBOTDIFFICULTY)
|
||||
{
|
||||
newDifficulty = MAXBOTDIFFICULTY;
|
||||
}
|
||||
else if (newDifficulty < 1)
|
||||
{
|
||||
newDifficulty = 1;
|
||||
}
|
||||
|
||||
for (i = 0; i < MAXPLAYERS; i++)
|
||||
{
|
||||
player_t *bot = NULL;
|
||||
|
||||
if (!playeringame[i] || !players[i].bot)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
bot = players[i];
|
||||
|
||||
if (bot->spectator)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if (bot->pflags & PF_NOCONTEST)
|
||||
{
|
||||
UINT8 skinnum = P_RandomKey(numskins);
|
||||
UINT8 loops = 0;
|
||||
|
||||
while (!skinusable[skinnum])
|
||||
{
|
||||
|
|
@ -581,24 +617,7 @@ void K_ReplaceBot(player_t *bot)
|
|||
skinnum = defaultbotskin;
|
||||
}
|
||||
|
||||
if (!grandprixinfo.gp) // Sure, let's let this happen all the time :)
|
||||
{
|
||||
newDifficulty = cv_kartbot.value;
|
||||
}
|
||||
else
|
||||
{
|
||||
const UINT8 startingdifficulty = K_BotStartingDifficulty(grandprixinfo.gamespeed);
|
||||
newDifficulty = startingdifficulty - 4 + grandprixinfo.roundnum;
|
||||
}
|
||||
|
||||
if (newDifficulty > MAXBOTDIFFICULTY)
|
||||
{
|
||||
newDifficulty = MAXBOTDIFFICULTY;
|
||||
}
|
||||
else if (newDifficulty < 1)
|
||||
{
|
||||
newDifficulty = 1;
|
||||
}
|
||||
skinusable[skinnum] = false;
|
||||
|
||||
bot->botvars.difficulty = newDifficulty;
|
||||
bot->botvars.diffincrease = 0;
|
||||
|
|
@ -608,6 +627,9 @@ void K_ReplaceBot(player_t *bot)
|
|||
sprintf(player_names[bot - players], "%s", skins[skinnum].realname);
|
||||
|
||||
bot->score = 0;
|
||||
bot->pflags &= ~PF_NOCONTEST;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*--------------------------------------------------
|
||||
|
|
|
|||
|
|
@ -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.
|
||||
|
||||
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
|
||||
|
||||
Return:-
|
||||
None
|
||||
true if can change important gameplay rules, otherwise false.
|
||||
--------------------------------------------------*/
|
||||
|
||||
boolean K_CanChangeRules(void);
|
||||
|
|
|
|||
|
|
@ -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));
|
||||
}
|
||||
|
||||
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!!
|
||||
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))
|
||||
{
|
||||
UINT8 i;
|
||||
for (i = 0; i < MAXPLAYERS; i++)
|
||||
{
|
||||
if ((players[i].pflags & PF_NOCONTEST) && players[i].bot)
|
||||
{
|
||||
K_ReplaceBot(&players[i]);
|
||||
}
|
||||
}
|
||||
|
||||
K_RetireBots();
|
||||
Y_CalculateMatchData(1, Y_CompareRank);
|
||||
}
|
||||
|
||||
|
|
@ -1170,6 +1162,7 @@ void Y_StartIntermission(void)
|
|||
//
|
||||
void Y_EndIntermission(void)
|
||||
{
|
||||
K_RetireBots();
|
||||
Y_UnloadData();
|
||||
|
||||
endtic = -1;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue