mirror of
https://github.com/KartKrewDev/RingRacers.git
synced 2025-10-30 08:01:28 +00:00
I would really like to believe that this just makes foes work in demos
This commit is contained in:
parent
ec36f6bb01
commit
528eaf0e64
2 changed files with 4 additions and 11 deletions
|
|
@ -321,6 +321,7 @@ void G_ReadDemoExtraData(void)
|
|||
players[p].botvars.difficulty = READUINT8(demobuf.p);
|
||||
players[p].botvars.diffincrease = READINT16(demobuf.p); // needed to avoid having to duplicate logic
|
||||
players[p].botvars.rival = (boolean)READUINT8(demobuf.p);
|
||||
players[p].botvars.foe = (boolean)READUINT8(demobuf.p);
|
||||
}
|
||||
}
|
||||
if (extradata & DXD_PLAYSTATE)
|
||||
|
|
@ -497,6 +498,7 @@ void G_WriteDemoExtraData(void)
|
|||
WRITEUINT8(demobuf.p, players[i].botvars.difficulty);
|
||||
WRITEINT16(demobuf.p, players[i].botvars.diffincrease); // needed to avoid having to duplicate logic
|
||||
WRITEUINT8(demobuf.p, (UINT8)players[i].botvars.rival);
|
||||
WRITEUINT8(demobuf.p, (UINT8)players[i].botvars.foe);
|
||||
}
|
||||
}
|
||||
if (demo_extradata[i] & DXD_PLAYSTATE)
|
||||
|
|
@ -2111,6 +2113,7 @@ void G_BeginRecording(void)
|
|||
WRITEUINT8(demobuf.p, player->botvars.difficulty);
|
||||
WRITEINT16(demobuf.p, player->botvars.diffincrease); // needed to avoid having to duplicate logic
|
||||
WRITEUINT8(demobuf.p, (UINT8)player->botvars.rival);
|
||||
WRITEUINT8(demobuf.p, (UINT8)player->botvars.foe);
|
||||
}
|
||||
|
||||
// Name
|
||||
|
|
@ -3222,6 +3225,7 @@ void G_DoPlayDemoEx(const char *defdemoname, lumpnum_t deflumpnum)
|
|||
players[p].botvars.difficulty = READUINT8(demobuf.p);
|
||||
players[p].botvars.diffincrease = READINT16(demobuf.p); // needed to avoid having to duplicate logic
|
||||
players[p].botvars.rival = (boolean)READUINT8(demobuf.p);
|
||||
players[p].botvars.foe = (boolean)READUINT8(demobuf.p);
|
||||
}
|
||||
|
||||
K_UpdateShrinkCheat(&players[p]);
|
||||
|
|
|
|||
|
|
@ -152,23 +152,17 @@ static INT16 K_RivalScore(player_t *bot)
|
|||
|
||||
static boolean CompareRivals(player_t *a, player_t *b)
|
||||
{
|
||||
CONS_Printf("compare foes\n");
|
||||
if (a == NULL)
|
||||
return false;
|
||||
if (b == NULL)
|
||||
return true;
|
||||
|
||||
CONS_Printf("%s %d VS %s %d\n", player_names[a-players], K_RivalScore(a), player_names[b-players], K_RivalScore(b));
|
||||
|
||||
if (K_RivalScore(a) != K_RivalScore(b))
|
||||
{
|
||||
// Push bad position to the back.
|
||||
CONS_Printf("returning known\n");
|
||||
return (K_RivalScore(a) > K_RivalScore(b));
|
||||
}
|
||||
|
||||
CONS_Printf("returning shuffle\n");
|
||||
|
||||
// They are equals, so just randomize
|
||||
return (P_Random(PR_BOTS) & 1);
|
||||
}
|
||||
|
|
@ -176,7 +170,6 @@ static boolean CompareRivals(player_t *a, player_t *b)
|
|||
static void K_AssignFoes(void)
|
||||
{
|
||||
std::vector<player_t *> bots;
|
||||
CONS_Printf("foe assignment\n");
|
||||
for (UINT8 i = 0; i < MAXPLAYERS; i++)
|
||||
{
|
||||
if (playeringame[i] == false)
|
||||
|
|
@ -186,20 +179,16 @@ static void K_AssignFoes(void)
|
|||
|
||||
if (!player->spectator && player->bot)
|
||||
{
|
||||
CONS_Printf("added %s\n", player_names[i]);
|
||||
bots.push_back(player);
|
||||
player->botvars.foe = false;
|
||||
}
|
||||
}
|
||||
|
||||
CONS_Printf("sort foes\n");
|
||||
std::stable_sort(bots.begin(), bots.end(), CompareRivals);
|
||||
|
||||
UINT8 i = 0;
|
||||
for (auto &bot : bots)
|
||||
{
|
||||
CONS_Printf("assign foes\n");
|
||||
|
||||
if (bot != NULL)
|
||||
bot->botvars.foe = true;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue