Merge branch 'pet-robo' of https://git.magicalgirl.moe/KartKrew/Kart.git into pet-robo-toast

# Conflicts:
#	src/k_bot.c
This commit is contained in:
toaster 2020-05-22 21:59:57 +01:00
commit 6d7dad12f0

View file

@ -197,147 +197,6 @@ void K_UpdateMatchRaceBots(void)
// We should have enough bots now :) // We should have enough bots now :)
} }
#if 0
// This is mostly just pesudo code right now...
void K_InitGrandPrixBots(void)
{
const UINT8 defaultbotskin = 9; // eggrobo
// startingdifficulty: Easy = 3, Normal = 6, Hard = 9
const UINT8 startingdifficulty = min(MAXBOTDIFFICULTY, (cv_kartspeed.value + 1) * 3);
UINT8 difficultylevels[MAXPLAYERS];
UINT8 playercount = 8;
UINT8 wantedbots = 0;
UINT8 numplayers = 0;
UINT8 competitors[4];
boolean skinusable[MAXSKINS];
UINT8 botskinlist[MAXPLAYERS];
UINT8 botskinlistpos = 0;
UINT8 i;
memset(difficultylevels, MAXBOTDIFFICULTY, sizeof (difficultylevels));
memset(competitors, MAXPLAYERS, sizeof (competitors));
memset(botskinlist, defaultbotskin, sizeof (botskinlist));
// init usable bot skins list
for (i = 0; i < MAXSKINS; i++)
{
if (i < numskins)
{
skinusable[i] = true;
}
else
{
skinusable[i] = false;
}
}
// init difficulty levels list
//if (!mastermodebots) {
difficultylevels[MAXPLAYERS] = {
max(1, startingdifficulty),
max(1, startingdifficulty-1),
max(1, startingdifficulty-2),
max(1, startingdifficulty-3),
max(1, startingdifficulty-3),
max(1, startingdifficulty-4),
max(1, startingdifficulty-4),
max(1, startingdifficulty-4),
max(1, startingdifficulty-5),
max(1, startingdifficulty-5),
max(1, startingdifficulty-6),
max(1, startingdifficulty-6),
max(1, startingdifficulty-7),
max(1, startingdifficulty-7),
max(1, startingdifficulty-8),
max(1, startingdifficulty-8),
};
for (i = 0; i < MAXPLAYERS; i++)
{
if (numplayers < MAXSPLITSCREENPLAYERS)
{
if (playeringame[i] && !players[i].spectator)
{
competitors[numplayers] = i;
numplayers++;
}
}
else
{
if (playeringame[i])
{
players[i].spectator = true; // force spectate for all other players, if they happen to exist?
}
}
}
if (numplayers > 2)
{
// Add 3 bots per player beyond 2P
playercount += (numplayers-2) * 3;
}
wantedbots = playercount - numplayers;
// Create rival list
// TODO: Use player skin's set rivals
// Starting with P1's rival1, P2's rival1, P3's rival1, P4's rival1,
// then P1's rival2, P2's rival2, etc etc etc etc.......
// then skip over any duplicates.
// Pad the remaining list with random skins if we need to
if (botskinlistpos < wantedbots)
{
for (i = botskinlistpos; i < wantedbots; i++)
{
UINT8 val = M_RandomKey(numskins);
UINT8 loops = 0;
while (!skinusable[val])
{
if (loops >= numskins)
{
// no more skins
break;
}
val++;
if (val >= numskins)
{
val = 0;
}
loops++;
}
if (loops >= numskins)
{
// leave the rest of the table as the default skin
break;
}
botskinlist[i] = val;
skinusable[val] = false;
}
}
for (i = 0; i < wantedbots; i++)
{
if (!K_AddBot(botskinlist[i], difficultylevels[i], &newplayernum))
{
break;
}
}
}
#endif
boolean K_PlayerUsesBotMovement(player_t *player) boolean K_PlayerUsesBotMovement(player_t *player)
{ {
if (player->bot || player->exiting) if (player->bot || player->exiting)
@ -411,10 +270,13 @@ fixed_t K_BotRubberband(player_t *player)
continue; continue;
} }
/*if (players[i].bot) #if 0
// Only rubberband up to players.
if (players[i].bot)
{ {
continue; continue;
}*/ }
#endif
if (firstplace == NULL || players[i].distancetofinish < firstplace->distancetofinish) if (firstplace == NULL || players[i].distancetofinish < firstplace->distancetofinish)
{ {
@ -554,12 +416,11 @@ fixed_t eggboxx, eggboxy;
UINT8 randomitems = 0; UINT8 randomitems = 0;
UINT8 eggboxes = 0; UINT8 eggboxes = 0;
static boolean K_FindRandomItemsAndEggboxes(mobj_t *thing) static boolean K_FindEggboxes(mobj_t *thing)
{ {
fixed_t dist; fixed_t dist;
boolean egg = (thing->type == MT_EGGMANITEM);
if (!egg && thing->type != MT_RANDOMITEM) if (thing->type != MT_RANDOMITEM && thing->type != MT_EGGMANITEM)
{ {
return true; return true;
} }
@ -576,10 +437,14 @@ static boolean K_FindRandomItemsAndEggboxes(mobj_t *thing)
return true; return true;
} }
if (egg) if (thing->type == MT_RANDOMITEM)
eggboxes++; {
else
randomitems++; randomitems++;
}
else
{
eggboxes++;
}
return true; return true;
} }
@ -604,11 +469,11 @@ static UINT8 K_EggboxStealth(fixed_t x, fixed_t y)
{ {
for (by = yl; by <= yh; by++) for (by = yl; by <= yh; by++)
{ {
P_BlockThingsIterator(bx, by, K_FindRandomItemsAndEggboxes); P_BlockThingsIterator(bx, by, K_FindEggboxes);
} }
} }
return randomitems * eggboxes; return (randomitems * eggboxes);
} }
static inline boolean K_FindBlockingWalls(line_t *line) static inline boolean K_FindBlockingWalls(line_t *line)