mirror of
https://github.com/ZDoom/gzdoom.git
synced 2024-11-11 15:21:51 +00:00
- Handle level in bot code
This commit is contained in:
parent
14971c8c3a
commit
06e5dd1d86
6 changed files with 14 additions and 14 deletions
|
@ -120,8 +120,8 @@ public:
|
||||||
void Init ();
|
void Init ();
|
||||||
void End();
|
void End();
|
||||||
bool SpawnBot (const char *name, int color = NOCOLOR);
|
bool SpawnBot (const char *name, int color = NOCOLOR);
|
||||||
void TryAddBot (uint8_t **stream, int player);
|
void TryAddBot (FLevelLocals *Level, uint8_t **stream, int player);
|
||||||
void RemoveAllBots (bool fromlist);
|
void RemoveAllBots (FLevelLocals *Level, bool fromlist);
|
||||||
bool LoadBots ();
|
bool LoadBots ();
|
||||||
void ForgetBots ();
|
void ForgetBots ();
|
||||||
|
|
||||||
|
@ -153,7 +153,7 @@ public:
|
||||||
|
|
||||||
private:
|
private:
|
||||||
//(b_game.cpp)
|
//(b_game.cpp)
|
||||||
bool DoAddBot (uint8_t *info, botskill_t skill);
|
bool DoAddBot (FLevelLocals *Level, uint8_t *info, botskill_t skill);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
bool ctf;
|
bool ctf;
|
||||||
|
|
|
@ -340,7 +340,7 @@ bool FCajunMaster::SpawnBot (const char *name, int color)
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void FCajunMaster::TryAddBot (uint8_t **stream, int player)
|
void FCajunMaster::TryAddBot (FLevelLocals *Level, uint8_t **stream, int player)
|
||||||
{
|
{
|
||||||
int botshift = ReadByte (stream);
|
int botshift = ReadByte (stream);
|
||||||
char *info = ReadString (stream);
|
char *info = ReadString (stream);
|
||||||
|
@ -363,7 +363,7 @@ void FCajunMaster::TryAddBot (uint8_t **stream, int player)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (DoAddBot ((uint8_t *)info, skill))
|
if (DoAddBot (Level,(uint8_t *)info, skill))
|
||||||
{
|
{
|
||||||
//Increment this.
|
//Increment this.
|
||||||
botnum++;
|
botnum++;
|
||||||
|
@ -384,7 +384,7 @@ void FCajunMaster::TryAddBot (uint8_t **stream, int player)
|
||||||
delete[] info;
|
delete[] info;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool FCajunMaster::DoAddBot (uint8_t *info, botskill_t skill)
|
bool FCajunMaster::DoAddBot (FLevelLocals *Level, uint8_t *info, botskill_t skill)
|
||||||
{
|
{
|
||||||
int bnum;
|
int bnum;
|
||||||
|
|
||||||
|
@ -405,7 +405,7 @@ bool FCajunMaster::DoAddBot (uint8_t *info, botskill_t skill)
|
||||||
D_ReadUserInfoStrings (bnum, &info, false);
|
D_ReadUserInfoStrings (bnum, &info, false);
|
||||||
|
|
||||||
multiplayer = true; //Prevents cheating and so on; emulates real netgame (almost).
|
multiplayer = true; //Prevents cheating and so on; emulates real netgame (almost).
|
||||||
players[bnum].Bot = level.CreateThinker<DBot>();
|
players[bnum].Bot = Level->CreateThinker<DBot>();
|
||||||
players[bnum].Bot->player = &players[bnum];
|
players[bnum].Bot->player = &players[bnum];
|
||||||
players[bnum].Bot->skill = skill;
|
players[bnum].Bot->skill = skill;
|
||||||
playeringame[bnum] = true;
|
playeringame[bnum] = true;
|
||||||
|
@ -417,11 +417,11 @@ bool FCajunMaster::DoAddBot (uint8_t *info, botskill_t skill)
|
||||||
else
|
else
|
||||||
Printf ("%s joined the game\n", players[bnum].userinfo.GetName());
|
Printf ("%s joined the game\n", players[bnum].userinfo.GetName());
|
||||||
|
|
||||||
level.DoReborn (bnum, true);
|
Level->DoReborn (bnum, true);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void FCajunMaster::RemoveAllBots (bool fromlist)
|
void FCajunMaster::RemoveAllBots (FLevelLocals *Level, bool fromlist)
|
||||||
{
|
{
|
||||||
int i, j;
|
int i, j;
|
||||||
|
|
||||||
|
|
|
@ -954,7 +954,7 @@ void D_Display ()
|
||||||
void D_ErrorCleanup ()
|
void D_ErrorCleanup ()
|
||||||
{
|
{
|
||||||
savegamerestore = false;
|
savegamerestore = false;
|
||||||
bglobal.RemoveAllBots (true);
|
bglobal.RemoveAllBots (&level, true);
|
||||||
D_QuitNetGame ();
|
D_QuitNetGame ();
|
||||||
if (demorecording || demoplayback)
|
if (demorecording || demoplayback)
|
||||||
G_CheckDemoStatus ();
|
G_CheckDemoStatus ();
|
||||||
|
|
|
@ -2230,11 +2230,11 @@ void Net_DoCommand (int type, uint8_t **stream, int player)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case DEM_ADDBOT:
|
case DEM_ADDBOT:
|
||||||
bglobal.TryAddBot (stream, player);
|
bglobal.TryAddBot (&level, stream, player);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case DEM_KILLBOTS:
|
case DEM_KILLBOTS:
|
||||||
bglobal.RemoveAllBots (true);
|
bglobal.RemoveAllBots (&level, true);
|
||||||
Printf ("Removed all bots\n");
|
Printf ("Removed all bots\n");
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
|
@ -1893,7 +1893,7 @@ void G_DoLoadGame ()
|
||||||
// Read intermission data for hubs
|
// Read intermission data for hubs
|
||||||
G_SerializeHub(arc);
|
G_SerializeHub(arc);
|
||||||
|
|
||||||
bglobal.RemoveAllBots(true);
|
bglobal.RemoveAllBots(&level, true);
|
||||||
|
|
||||||
FString cvar;
|
FString cvar;
|
||||||
arc("importantcvars", cvar);
|
arc("importantcvars", cvar);
|
||||||
|
|
|
@ -1161,7 +1161,7 @@ void FLevelLocals::WorldDone (void)
|
||||||
//Added by mc
|
//Added by mc
|
||||||
if (deathmatch)
|
if (deathmatch)
|
||||||
{
|
{
|
||||||
bglobal.RemoveAllBots(consoleplayer != Net_Arbitrator);
|
bglobal.RemoveAllBots(this, consoleplayer != Net_Arbitrator);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (flags & LEVEL_CHANGEMAPCHEAT)
|
if (flags & LEVEL_CHANGEMAPCHEAT)
|
||||||
|
|
Loading…
Reference in a new issue