mirror of
https://github.com/KartKrewDev/RingRacers.git
synced 2025-10-30 08:01:28 +00:00
Fake results for bots that didn't get to finish in time
This commit is contained in:
parent
8bb145e249
commit
e2d95ae9c1
6 changed files with 71 additions and 35 deletions
35
src/g_game.c
35
src/g_game.c
|
|
@ -3645,11 +3645,22 @@ static void G_DoCompleted(void)
|
|||
{
|
||||
// SRB2Kart: exitlevel shouldn't get you the points
|
||||
if (!players[i].exiting && !(players[i].pflags & PF_TIMEOVER))
|
||||
{
|
||||
if (players[i].bot)
|
||||
{
|
||||
K_FakeBotResults(&players[i]);
|
||||
}
|
||||
else
|
||||
{
|
||||
players[i].pflags |= PF_TIMEOVER;
|
||||
|
||||
if (P_IsLocalPlayer(&players[i]))
|
||||
{
|
||||
j++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
G_PlayerFinishLevel(i); // take away cards and stuff
|
||||
}
|
||||
|
||||
|
|
@ -3918,7 +3929,7 @@ static void G_DoContinued(void)
|
|||
token = 0;
|
||||
|
||||
// Reset # of lives
|
||||
pl->lives = (ultimatemode) ? 1 : 3;
|
||||
pl->lives = 3;
|
||||
|
||||
D_MapChange(gamemap, gametype, false, false, 0, false, false);
|
||||
|
||||
|
|
@ -4562,27 +4573,7 @@ void G_InitNew(UINT8 pencoremode, const char *mapname, boolean resetplayer, bool
|
|||
players[i].starpostangle = players[i].starpostnum = players[i].starposttime = 0;
|
||||
players[i].starpostx = players[i].starposty = players[i].starpostz = 0;
|
||||
|
||||
#if 0
|
||||
if (netgame || multiplayer)
|
||||
{
|
||||
players[i].lives = cv_startinglives.value;
|
||||
players[i].continues = 0;
|
||||
}
|
||||
else if (pultmode)
|
||||
{
|
||||
players[i].lives = 1;
|
||||
players[i].continues = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
players[i].lives = 3;
|
||||
players[i].continues = 1;
|
||||
}
|
||||
|
||||
players[i].xtralife = 0;
|
||||
#else
|
||||
players[i].lives = 1; // SRB2Kart
|
||||
#endif
|
||||
players[i].lives = 3; // SRB2Kart
|
||||
|
||||
// The latter two should clear by themselves, but just in case
|
||||
players[i].pflags &= ~(PF_TAGIT|PF_TAGGED|PF_FULLSTASIS);
|
||||
|
|
|
|||
|
|
@ -254,7 +254,6 @@ void K_CheckBumpers(void)
|
|||
for (i = 0; i < MAXPLAYERS; i++)
|
||||
{
|
||||
players[i].pflags |= PF_TIMEOVER;
|
||||
//players[i].lives = 0;
|
||||
P_DoPlayerExit(&players[i]);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -178,3 +178,55 @@ void K_InitGrandPrixBots(void)
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
void K_FakeBotResults(player_t *bot)
|
||||
{
|
||||
const UINT32 distfactor = 32;
|
||||
UINT32 worstdist = 0;
|
||||
tic_t besttime = UINT32_MAX;
|
||||
UINT8 numplayers = 0;
|
||||
UINT8 i;
|
||||
|
||||
for (i = 0; i < MAXPLAYERS; i++)
|
||||
{
|
||||
if (playeringame[i] && !players[i].spectator)
|
||||
{
|
||||
numplayers++;
|
||||
|
||||
if (players[i].exiting && players[i].realtime < besttime)
|
||||
{
|
||||
besttime = players[i].realtime;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (besttime == UINT32_MAX)
|
||||
{
|
||||
// No one finished, so you don't finish either.
|
||||
bot->pflags |= PF_TIMEOVER;
|
||||
return;
|
||||
}
|
||||
|
||||
for (i = 0; i < MAXPLAYERS; i++)
|
||||
{
|
||||
if (playeringame[i] && !players[i].spectator)
|
||||
{
|
||||
if (players[i].distancetofinish > worstdist)
|
||||
{
|
||||
worstdist = players[i].distancetofinish;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (bot->distancetofinish >= worstdist)
|
||||
{
|
||||
// Last place, you aren't going to finish.
|
||||
bot->pflags |= PF_TIMEOVER;
|
||||
return;
|
||||
}
|
||||
|
||||
// hey, you "won"
|
||||
bot->exiting = 2;
|
||||
bot->realtime = bot->realtime + (bot->distancetofinish / distfactor);
|
||||
bot->distancetofinish = 0;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -15,6 +15,7 @@ extern struct grandprixinfo
|
|||
} grandprixinfo;
|
||||
|
||||
void K_InitGrandPrixBots(void);
|
||||
void K_FakeBotResults(player_t *bot);
|
||||
|
||||
#endif
|
||||
|
||||
|
|
|
|||
|
|
@ -2352,15 +2352,10 @@ static void P_LevelInitStuff(void)
|
|||
|
||||
for (i = 0; i < MAXPLAYERS; i++)
|
||||
{
|
||||
#if 0
|
||||
if ((netgame || multiplayer) && (gametype == GT_COMPETITION || players[i].lives <= 0))
|
||||
if (grandprixinfo.roundnum == 0)
|
||||
{
|
||||
// In Co-Op, replenish a user's lives if they are depleted.
|
||||
players[i].lives = cv_startinglives.value;
|
||||
players[i].lives = 3;
|
||||
}
|
||||
#else
|
||||
players[i].lives = 1; // SRB2Kart
|
||||
#endif
|
||||
|
||||
players[i].realtime = countdown = countdown2 = 0;
|
||||
curlap = bestlap = 0; // SRB2Kart
|
||||
|
|
|
|||
|
|
@ -8023,8 +8023,6 @@ void P_DoTimeOver(player_t *player)
|
|||
P_DamageMobj(player->mo, NULL, NULL, 10000);
|
||||
}
|
||||
|
||||
player->lives = 0;
|
||||
|
||||
P_EndingMusic(player);
|
||||
|
||||
if (!countdown2)
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue