mirror of
https://github.com/ZDoom/qzdoom.git
synced 2024-11-24 13:01:47 +00:00
- Fixed: DCajunMaster::End was missing a write barrier for getspawned. The
same problem in D_DoomMain. - Made bglobal a pointer because it was causing problems with the garbage collector. SVN r859 (trunk)
This commit is contained in:
parent
39940fe20a
commit
997533e0c8
22 changed files with 131 additions and 97 deletions
|
@ -1,3 +1,9 @@
|
||||||
|
March 27, 2008 (Changes by Graf Zahl)
|
||||||
|
- Fixed: DCajunMaster::End was missing a write barrier for getspawned. The
|
||||||
|
same problem in D_DoomMain.
|
||||||
|
- Made bglobal a pointer because it was causing problems with the garbage
|
||||||
|
collector.
|
||||||
|
|
||||||
March 26, 2008
|
March 26, 2008
|
||||||
- Added FMOD_OPENONLY to the callback version of CreateStream() to prevent it
|
- Added FMOD_OPENONLY to the callback version of CreateStream() to prevent it
|
||||||
from doing prebuffering of the song. This was causing the Linux version to
|
from doing prebuffering of the song. This was causing the Linux version to
|
||||||
|
@ -14388,7 +14394,7 @@ July 21, 1999
|
||||||
damage.
|
damage.
|
||||||
- Changed bot observer mode to use noclip instead of noblockmap. Otherwise,
|
- Changed bot observer mode to use noclip instead of noblockmap. Otherwise,
|
||||||
the player is unable to ride lifts while observing.
|
the player is unable to ride lifts while observing.
|
||||||
- The bot code spawns bglobal.body1 and bglobal.body2 actors to help with
|
- The bot code spawns bglobal->body1 and bglobal->body2 actors to help with
|
||||||
aiming. The original code would carry pointers to these over between
|
aiming. The original code would carry pointers to these over between
|
||||||
levels, even though all actors disappear when travelling between levels.
|
levels, even though all actors disappear when travelling between levels.
|
||||||
Not a good thing. Fixed.
|
Not a good thing. Fixed.
|
||||||
|
@ -14438,7 +14444,7 @@ July 14, 1999
|
||||||
the for loop.
|
the for loop.
|
||||||
|
|
||||||
July 12, 1999
|
July 12, 1999
|
||||||
- Enclosed the bot thinking code inside if (bglobal.botnum) {} blocks so that
|
- Enclosed the bot thinking code inside if (bglobal->botnum) {} blocks so that
|
||||||
no bot thinking occurs when there are no bots. Also defaulted bot_calcnodes
|
no bot thinking occurs when there are no bots. Also defaulted bot_calcnodes
|
||||||
to 0. If a bot is spawned, and there are no nodes loaded, bot_calcnodes
|
to 0. If a bot is spawned, and there are no nodes loaded, bot_calcnodes
|
||||||
will automatically be set to 1. Now the bots don't eat up any time if none
|
will automatically be set to 1. Now the bots don't eat up any time if none
|
||||||
|
|
|
@ -43,9 +43,9 @@ CCMD (addbot)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (argv.argc() > 1)
|
if (argv.argc() > 1)
|
||||||
bglobal.SpawnBot (argv[1]);
|
bglobal->SpawnBot (argv[1]);
|
||||||
else
|
else
|
||||||
bglobal.SpawnBot (NULL);
|
bglobal->SpawnBot (NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
void DCajunMaster::ClearPlayer (int i, bool keepTeam)
|
void DCajunMaster::ClearPlayer (int i, bool keepTeam)
|
||||||
|
@ -92,7 +92,7 @@ CCMD (freeze)
|
||||||
|
|
||||||
CCMD (listbots)
|
CCMD (listbots)
|
||||||
{
|
{
|
||||||
botinfo_t *thebot = bglobal.botinfo;
|
botinfo_t *thebot = bglobal->botinfo;
|
||||||
int count = 0;
|
int count = 0;
|
||||||
|
|
||||||
while (thebot)
|
while (thebot)
|
||||||
|
@ -116,6 +116,9 @@ AT_GAME_SET(BotStuff)
|
||||||
AWeapon * w;
|
AWeapon * w;
|
||||||
AActor * a;
|
AActor * a;
|
||||||
|
|
||||||
|
bglobal = new DCajunMaster;
|
||||||
|
GC::WriteBarrier(bglobal);
|
||||||
|
|
||||||
w = (AWeapon*)GetDefaultByName ("Pistol");
|
w = (AWeapon*)GetDefaultByName ("Pistol");
|
||||||
if (w != NULL)
|
if (w != NULL)
|
||||||
{
|
{
|
||||||
|
|
|
@ -78,6 +78,7 @@ class DCajunMaster : public DObject
|
||||||
DECLARE_CLASS (DCajunMaster, DObject)
|
DECLARE_CLASS (DCajunMaster, DObject)
|
||||||
HAS_OBJECT_POINTERS
|
HAS_OBJECT_POINTERS
|
||||||
public:
|
public:
|
||||||
|
DCajunMaster();
|
||||||
~DCajunMaster();
|
~DCajunMaster();
|
||||||
|
|
||||||
void ClearPlayer (int playernum, bool keepTeam);
|
void ClearPlayer (int playernum, bool keepTeam);
|
||||||
|
@ -148,7 +149,7 @@ protected:
|
||||||
|
|
||||||
|
|
||||||
//Externs
|
//Externs
|
||||||
extern DCajunMaster bglobal;
|
extern DCajunMaster *bglobal;
|
||||||
|
|
||||||
EXTERN_CVAR (Float, bot_flag_return_time)
|
EXTERN_CVAR (Float, bot_flag_return_time)
|
||||||
EXTERN_CVAR (Int, bot_next_color)
|
EXTERN_CVAR (Int, bot_next_color)
|
||||||
|
|
|
@ -63,7 +63,7 @@ static bool PTR_Reachable (intercept_t *in)
|
||||||
fixed_t ceilingheight = s->ceilingplane.ZatPoint (hitx, hity);
|
fixed_t ceilingheight = s->ceilingplane.ZatPoint (hitx, hity);
|
||||||
fixed_t floorheight = s->floorplane.ZatPoint (hitx, hity);
|
fixed_t floorheight = s->floorplane.ZatPoint (hitx, hity);
|
||||||
|
|
||||||
if (!bglobal.IsDangerous (s) && //Any nukage/lava?
|
if (!bglobal->IsDangerous (s) && //Any nukage/lava?
|
||||||
(floorheight <= (last_z+MAXMOVEHEIGHT)
|
(floorheight <= (last_z+MAXMOVEHEIGHT)
|
||||||
&& ((ceilingheight == floorheight && line->special)
|
&& ((ceilingheight == floorheight && line->special)
|
||||||
|| (ceilingheight - floorheight) >= looker->height))) //Does it fit?
|
|| (ceilingheight - floorheight) >= looker->height))) //Does it fit?
|
||||||
|
@ -369,7 +369,7 @@ AActor *DCajunMaster::Choose_Mate (AActor *bot)
|
||||||
//Make a introducing to mate.
|
//Make a introducing to mate.
|
||||||
if(target && target!=bot->player->last_mate)
|
if(target && target!=bot->player->last_mate)
|
||||||
{
|
{
|
||||||
if((P_Random()%(200*bglobal.botnum))<3)
|
if((P_Random()%(200*bglobal->botnum))<3)
|
||||||
{
|
{
|
||||||
bot->player->chat = c_teamup;
|
bot->player->chat = c_teamup;
|
||||||
if(target->bot)
|
if(target->bot)
|
||||||
|
@ -527,7 +527,7 @@ angle_t DCajunMaster::FireRox (AActor *bot, AActor *enemy, ticcmd_t *cmd)
|
||||||
bot->y + FixedMul(bot->momy, 5*FRACUNIT),
|
bot->y + FixedMul(bot->momy, 5*FRACUNIT),
|
||||||
bot->z + (bot->height / 2), 2);
|
bot->z + (bot->height / 2), 2);
|
||||||
|
|
||||||
actor = bglobal.body2;
|
actor = bglobal->body2;
|
||||||
|
|
||||||
dist = P_AproxDistance (actor->x-enemy->x, actor->y-enemy->y);
|
dist = P_AproxDistance (actor->x-enemy->x, actor->y-enemy->y);
|
||||||
if (dist < SAFE_SELF_MISDIST)
|
if (dist < SAFE_SELF_MISDIST)
|
||||||
|
@ -537,15 +537,15 @@ angle_t DCajunMaster::FireRox (AActor *bot, AActor *enemy, ticcmd_t *cmd)
|
||||||
|
|
||||||
SetBodyAt (enemy->x + FixedMul (enemy->momx, (m+2*FRACUNIT)),
|
SetBodyAt (enemy->x + FixedMul (enemy->momx, (m+2*FRACUNIT)),
|
||||||
enemy->y + FixedMul(enemy->momy, (m+2*FRACUNIT)), ONFLOORZ, 1);
|
enemy->y + FixedMul(enemy->momy, (m+2*FRACUNIT)), ONFLOORZ, 1);
|
||||||
dist = P_AproxDistance(actor->x-bglobal.body1->x, actor->y-bglobal.body1->y);
|
dist = P_AproxDistance(actor->x-bglobal->body1->x, actor->y-bglobal->body1->y);
|
||||||
//try the predicted location
|
//try the predicted location
|
||||||
if (P_CheckSight (actor, bglobal.body1, 1)) //See the predicted location, so give a test missile
|
if (P_CheckSight (actor, bglobal->body1, 1)) //See the predicted location, so give a test missile
|
||||||
{
|
{
|
||||||
if (SafeCheckPosition (bot, actor->x, actor->y))
|
if (SafeCheckPosition (bot, actor->x, actor->y))
|
||||||
{
|
{
|
||||||
if (FakeFire (actor, bglobal.body1, cmd) >= SAFE_SELF_MISDIST)
|
if (FakeFire (actor, bglobal->body1, cmd) >= SAFE_SELF_MISDIST)
|
||||||
{
|
{
|
||||||
ang = R_PointToAngle2 (actor->x, actor->y, bglobal.body1->x, bglobal.body1->y);
|
ang = R_PointToAngle2 (actor->x, actor->y, bglobal->body1->x, bglobal->body1->y);
|
||||||
return ang;
|
return ang;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -61,7 +61,7 @@ Everything that is changed is marked (maybe commented) with "Added by MC"
|
||||||
static FRandom pr_botspawn ("BotSpawn");
|
static FRandom pr_botspawn ("BotSpawn");
|
||||||
|
|
||||||
//Externs
|
//Externs
|
||||||
DCajunMaster bglobal;
|
DCajunMaster *bglobal;
|
||||||
|
|
||||||
cycle_t BotThinkCycles, BotSupportCycles, BotWTG;
|
cycle_t BotThinkCycles, BotSupportCycles, BotWTG;
|
||||||
|
|
||||||
|
@ -88,6 +88,26 @@ enum
|
||||||
|
|
||||||
static bool waitingforspawn[MAXPLAYERS];
|
static bool waitingforspawn[MAXPLAYERS];
|
||||||
|
|
||||||
|
DCajunMaster::DCajunMaster()
|
||||||
|
{
|
||||||
|
firstthing = NULL;
|
||||||
|
body1 = NULL;
|
||||||
|
body2 = NULL;
|
||||||
|
getspawned = NULL;
|
||||||
|
memset(botingame, 0, sizeof(botingame));
|
||||||
|
freeze = false;
|
||||||
|
changefreeze = false;
|
||||||
|
botnum = 0;
|
||||||
|
botinfo = NULL;
|
||||||
|
spawn_tries = 0;
|
||||||
|
wanted_botnum = NULL;
|
||||||
|
m_Thinking = false;
|
||||||
|
ctf = false;
|
||||||
|
loaded_bots = 0;
|
||||||
|
t_join = 0;
|
||||||
|
observer = false;
|
||||||
|
}
|
||||||
|
|
||||||
DCajunMaster::~DCajunMaster()
|
DCajunMaster::~DCajunMaster()
|
||||||
{
|
{
|
||||||
ForgetBots();
|
ForgetBots();
|
||||||
|
@ -218,7 +238,10 @@ void DCajunMaster::End ()
|
||||||
if (getspawned)
|
if (getspawned)
|
||||||
getspawned->FlushArgs ();
|
getspawned->FlushArgs ();
|
||||||
else
|
else
|
||||||
|
{
|
||||||
getspawned = new DArgs;
|
getspawned = new DArgs;
|
||||||
|
GC::WriteBarrier(this, getspawned);
|
||||||
|
}
|
||||||
for (i = 0; i < MAXPLAYERS; i++)
|
for (i = 0; i < MAXPLAYERS; i++)
|
||||||
{
|
{
|
||||||
if (playeringame[i] && players[i].isbot)
|
if (playeringame[i] && players[i].isbot)
|
||||||
|
@ -509,7 +532,7 @@ bool DCajunMaster::LoadBots ()
|
||||||
FString tmp;
|
FString tmp;
|
||||||
bool gotteam = false;
|
bool gotteam = false;
|
||||||
|
|
||||||
bglobal.ForgetBots ();
|
bglobal->ForgetBots ();
|
||||||
#ifndef unix
|
#ifndef unix
|
||||||
tmp = progdir;
|
tmp = progdir;
|
||||||
tmp += "zcajun/" BOTFILENAME;
|
tmp += "zcajun/" BOTFILENAME;
|
||||||
|
@ -639,12 +662,12 @@ bool DCajunMaster::LoadBots ()
|
||||||
appendinfo (newinfo->info, "team");
|
appendinfo (newinfo->info, "team");
|
||||||
appendinfo (newinfo->info, "255");
|
appendinfo (newinfo->info, "255");
|
||||||
}
|
}
|
||||||
newinfo->next = bglobal.botinfo;
|
newinfo->next = bglobal->botinfo;
|
||||||
newinfo->lastteam = TEAM_None;
|
newinfo->lastteam = TEAM_None;
|
||||||
bglobal.botinfo = newinfo;
|
bglobal->botinfo = newinfo;
|
||||||
bglobal.loaded_bots++;
|
bglobal->loaded_bots++;
|
||||||
}
|
}
|
||||||
Printf ("%d bots read from %s\n", bglobal.loaded_bots, BOTFILENAME);
|
Printf ("%d bots read from %s\n", bglobal->loaded_bots, BOTFILENAME);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -329,7 +329,7 @@ void DCajunMaster::WhatToGet (AActor *actor, AActor *item)
|
||||||
}
|
}
|
||||||
int weapgiveammo = (alwaysapplydmflags || deathmatch) && !(dmflags & DF_WEAPONS_STAY);
|
int weapgiveammo = (alwaysapplydmflags || deathmatch) && !(dmflags & DF_WEAPONS_STAY);
|
||||||
|
|
||||||
//if(pos && !bglobal.thingvis[pos->id][item->id]) continue;
|
//if(pos && !bglobal->thingvis[pos->id][item->id]) continue;
|
||||||
// if (item->IsKindOf (RUNTIME_CLASS(AArtifact)))
|
// if (item->IsKindOf (RUNTIME_CLASS(AArtifact)))
|
||||||
// return; // don't know how to use artifacts
|
// return; // don't know how to use artifacts
|
||||||
if (item->IsKindOf (RUNTIME_CLASS(AWeapon)))
|
if (item->IsKindOf (RUNTIME_CLASS(AWeapon)))
|
||||||
|
|
|
@ -718,7 +718,7 @@ void D_Display ()
|
||||||
void D_ErrorCleanup ()
|
void D_ErrorCleanup ()
|
||||||
{
|
{
|
||||||
screen->Unlock ();
|
screen->Unlock ();
|
||||||
bglobal.RemoveAllBots (true);
|
bglobal->RemoveAllBots (true);
|
||||||
D_QuitNetGame ();
|
D_QuitNetGame ();
|
||||||
if (demorecording || demoplayback)
|
if (demorecording || demoplayback)
|
||||||
G_CheckDemoStatus ();
|
G_CheckDemoStatus ();
|
||||||
|
@ -772,7 +772,7 @@ void D_DoomLoop ()
|
||||||
players[i].savedpitch = players[i].mo->pitch;
|
players[i].savedpitch = players[i].mo->pitch;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
bglobal.Main (maketic%BACKUPTICS);
|
bglobal->Main (maketic%BACKUPTICS);
|
||||||
for (i = 0; i < MAXPLAYERS; i++)
|
for (i = 0; i < MAXPLAYERS; i++)
|
||||||
{
|
{
|
||||||
if (playeringame[i] && players[i].isbot && players[i].mo)
|
if (playeringame[i] && players[i].isbot && players[i].mo)
|
||||||
|
@ -2433,16 +2433,17 @@ void D_DoomMain (void)
|
||||||
}
|
}
|
||||||
|
|
||||||
//Added by MC:
|
//Added by MC:
|
||||||
bglobal.getspawned = Args->GatherFiles ("-bots", "", false);
|
bglobal->getspawned = Args->GatherFiles ("-bots", "", false);
|
||||||
if (bglobal.getspawned->NumArgs() == 0)
|
if (bglobal->getspawned->NumArgs() == 0)
|
||||||
{
|
{
|
||||||
bglobal.getspawned->Destroy();
|
bglobal->getspawned->Destroy();
|
||||||
bglobal.getspawned = NULL;
|
bglobal->getspawned = NULL;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
bglobal.spawn_tries = 0;
|
GC::WriteBarrier(bglobal, bglobal->getspawned);
|
||||||
bglobal.wanted_botnum = bglobal.getspawned->NumArgs();
|
bglobal->spawn_tries = 0;
|
||||||
|
bglobal->wanted_botnum = bglobal->getspawned->NumArgs();
|
||||||
}
|
}
|
||||||
|
|
||||||
Printf ("M_Init: Init miscellaneous info.\n");
|
Printf ("M_Init: Init miscellaneous info.\n");
|
||||||
|
|
|
@ -641,7 +641,7 @@ void PlayerIsGone (int netnode, int netconsole)
|
||||||
FBehavior::StaticStartTypedScripts (SCRIPT_Disconnect, NULL, true, netconsole);
|
FBehavior::StaticStartTypedScripts (SCRIPT_Disconnect, NULL, true, netconsole);
|
||||||
if (netconsole == Net_Arbitrator)
|
if (netconsole == Net_Arbitrator)
|
||||||
{
|
{
|
||||||
bglobal.RemoveAllBots (true);
|
bglobal->RemoveAllBots (true);
|
||||||
Printf ("Removed all bots\n");
|
Printf ("Removed all bots\n");
|
||||||
|
|
||||||
// Pick a new network arbitrator
|
// Pick a new network arbitrator
|
||||||
|
@ -966,7 +966,7 @@ void NetUpdate (void)
|
||||||
if (maketic % ticdup == 0)
|
if (maketic % ticdup == 0)
|
||||||
{
|
{
|
||||||
//Added by MC: For some of that bot stuff. The main bot function.
|
//Added by MC: For some of that bot stuff. The main bot function.
|
||||||
bglobal.Main ((maketic / ticdup) % BACKUPTICS);
|
bglobal->Main ((maketic / ticdup) % BACKUPTICS);
|
||||||
}
|
}
|
||||||
maketic++;
|
maketic++;
|
||||||
|
|
||||||
|
@ -2048,12 +2048,12 @@ void Net_DoCommand (int type, BYTE **stream, int player)
|
||||||
case DEM_ADDBOT:
|
case DEM_ADDBOT:
|
||||||
{
|
{
|
||||||
BYTE num = ReadByte (stream);
|
BYTE num = ReadByte (stream);
|
||||||
bglobal.DoAddBot (num, s = ReadString (stream));
|
bglobal->DoAddBot (num, s = ReadString (stream));
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case DEM_KILLBOTS:
|
case DEM_KILLBOTS:
|
||||||
bglobal.RemoveAllBots (true);
|
bglobal->RemoveAllBots (true);
|
||||||
Printf ("Removed all bots\n");
|
Printf ("Removed all bots\n");
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
|
@ -1135,7 +1135,7 @@ void DDecalFader::Tick ()
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (level.maptime < TimeToStartDecay || bglobal.freeze)
|
if (level.maptime < TimeToStartDecay || bglobal->freeze)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -1218,7 +1218,7 @@ void DDecalStretcher::Tick ()
|
||||||
Destroy ();
|
Destroy ();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (level.maptime < TimeToStart || bglobal.freeze)
|
if (level.maptime < TimeToStart || bglobal->freeze)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -1287,7 +1287,7 @@ void DDecalSlider::Tick ()
|
||||||
Destroy ();
|
Destroy ();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (level.maptime < TimeToStart || bglobal.freeze)
|
if (level.maptime < TimeToStart || bglobal->freeze)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -1353,7 +1353,7 @@ void DDecalColorer::Tick ()
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (level.maptime < TimeToStartDecay || bglobal.freeze)
|
if (level.maptime < TimeToStartDecay || bglobal->freeze)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -312,8 +312,7 @@ static void MarkRoot()
|
||||||
}
|
}
|
||||||
Mark(SectorMarker);
|
Mark(SectorMarker);
|
||||||
{ // Silly bots
|
{ // Silly bots
|
||||||
DObject *foo = &bglobal;
|
Mark(bglobal);
|
||||||
Mark(foo);
|
|
||||||
}
|
}
|
||||||
// Add soft roots
|
// Add soft roots
|
||||||
if (SoftRoots != NULL)
|
if (SoftRoots != NULL)
|
||||||
|
|
|
@ -1218,8 +1218,8 @@ void G_PlayerReborn (int player)
|
||||||
}
|
}
|
||||||
|
|
||||||
//Added by MC: Init bot structure.
|
//Added by MC: Init bot structure.
|
||||||
if (bglobal.botingame[player])
|
if (bglobal->botingame[player])
|
||||||
bglobal.CleanBotstuff (p);
|
bglobal->CleanBotstuff (p);
|
||||||
else
|
else
|
||||||
p->isbot = false;
|
p->isbot = false;
|
||||||
|
|
||||||
|
@ -1764,7 +1764,7 @@ void G_DoLoadGame ()
|
||||||
// Read intermission data for hubs
|
// Read intermission data for hubs
|
||||||
G_ReadHubInfo(png);
|
G_ReadHubInfo(png);
|
||||||
|
|
||||||
bglobal.RemoveAllBots (true);
|
bglobal->RemoveAllBots (true);
|
||||||
|
|
||||||
text = M_GetPNGText (png, "Important CVARs");
|
text = M_GetPNGText (png, "Important CVARs");
|
||||||
if (text != NULL)
|
if (text != NULL)
|
||||||
|
|
|
@ -1693,7 +1693,7 @@ void G_InitNew (const char *mapname, bool bTitleLevel)
|
||||||
//Added by MC: Initialize bots.
|
//Added by MC: Initialize bots.
|
||||||
if (!deathmatch)
|
if (!deathmatch)
|
||||||
{
|
{
|
||||||
bglobal.Init ();
|
bglobal->Init ();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mapname != level.mapname)
|
if (mapname != level.mapname)
|
||||||
|
@ -1761,7 +1761,7 @@ void G_ChangeLevel(const char * levelname, int position, bool keepFacing, int ne
|
||||||
gameaction = ga_completed;
|
gameaction = ga_completed;
|
||||||
resetinventory = resetinv;
|
resetinventory = resetinv;
|
||||||
|
|
||||||
bglobal.End(); //Added by MC:
|
bglobal->End(); //Added by MC:
|
||||||
|
|
||||||
// [RH] Give scripts a chance to do something
|
// [RH] Give scripts a chance to do something
|
||||||
unloading = true;
|
unloading = true;
|
||||||
|
@ -2109,7 +2109,7 @@ void G_DoLoadLevel (int position, bool autosave)
|
||||||
//Added by MC: Initialize bots.
|
//Added by MC: Initialize bots.
|
||||||
if (deathmatch)
|
if (deathmatch)
|
||||||
{
|
{
|
||||||
bglobal.Init ();
|
bglobal->Init ();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (timingdemo)
|
if (timingdemo)
|
||||||
|
|
|
@ -403,8 +403,8 @@ void cht_DoCheat (player_t *player, int cheat)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case CHT_FREEZE:
|
case CHT_FREEZE:
|
||||||
bglobal.changefreeze ^= 1;
|
bglobal->changefreeze ^= 1;
|
||||||
if (bglobal.freeze ^ bglobal.changefreeze)
|
if (bglobal->freeze ^ bglobal->changefreeze)
|
||||||
{
|
{
|
||||||
msg = "Freeze mode on";
|
msg = "Freeze mode on";
|
||||||
}
|
}
|
||||||
|
|
|
@ -561,10 +561,10 @@ void AActor::Die (AActor *source, AActor *inflictor)
|
||||||
player->respawn_time = level.time + TICRATE;
|
player->respawn_time = level.time + TICRATE;
|
||||||
|
|
||||||
//Added by MC: Respawn bots
|
//Added by MC: Respawn bots
|
||||||
if (bglobal.botnum && consoleplayer == Net_Arbitrator && !demoplayback)
|
if (bglobal->botnum && consoleplayer == Net_Arbitrator && !demoplayback)
|
||||||
{
|
{
|
||||||
if (player->isbot)
|
if (player->isbot)
|
||||||
player->t_respawn = (pr_botrespawn()%15)+((bglobal.botnum-1)*2)+TICRATE+1;
|
player->t_respawn = (pr_botrespawn()%15)+((bglobal->botnum-1)*2)+TICRATE+1;
|
||||||
|
|
||||||
//Added by MC: Discard enemies.
|
//Added by MC: Discard enemies.
|
||||||
for (int i = 0; i < MAXPLAYERS; i++)
|
for (int i = 0; i < MAXPLAYERS; i++)
|
||||||
|
|
|
@ -1739,7 +1739,7 @@ bool P_TryMove (AActor *thing, fixed_t x, fixed_t y,
|
||||||
if (thing->player && thing->player->isbot && thing->flags & MF_SHOOTABLE)
|
if (thing->player && thing->player->isbot && thing->flags & MF_SHOOTABLE)
|
||||||
{
|
{
|
||||||
if (tmsector != thing->Sector
|
if (tmsector != thing->Sector
|
||||||
&& bglobal.IsDangerous (tmsector))
|
&& bglobal->IsDangerous (tmsector))
|
||||||
{
|
{
|
||||||
thing->player->prev = thing->player->dest;
|
thing->player->prev = thing->player->dest;
|
||||||
thing->player->dest = NULL;
|
thing->player->dest = NULL;
|
||||||
|
|
|
@ -2558,7 +2558,7 @@ void AActor::Tick ()
|
||||||
}
|
}
|
||||||
|
|
||||||
//Added by MC: Freeze mode.
|
//Added by MC: Freeze mode.
|
||||||
if (bglobal.freeze && !(player && !player->isbot))
|
if (bglobal->freeze && !(player && !player->isbot))
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -2637,11 +2637,11 @@ void AActor::Tick ()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (bglobal.botnum && consoleplayer == Net_Arbitrator && !demoplayback &&
|
if (bglobal->botnum && consoleplayer == Net_Arbitrator && !demoplayback &&
|
||||||
(flags & (MF_SPECIAL|MF_MISSILE)) || (flags3 & MF3_ISMONSTER))
|
(flags & (MF_SPECIAL|MF_MISSILE)) || (flags3 & MF3_ISMONSTER))
|
||||||
{
|
{
|
||||||
clock (BotSupportCycles);
|
clock (BotSupportCycles);
|
||||||
bglobal.m_Thinking = true;
|
bglobal->m_Thinking = true;
|
||||||
for (i = 0; i < MAXPLAYERS; i++)
|
for (i = 0; i < MAXPLAYERS; i++)
|
||||||
{
|
{
|
||||||
if (!playeringame[i] || !players[i].isbot)
|
if (!playeringame[i] || !players[i].isbot)
|
||||||
|
@ -2661,7 +2661,7 @@ void AActor::Tick ()
|
||||||
else if (flags & MF_SPECIAL)
|
else if (flags & MF_SPECIAL)
|
||||||
{ //Item pickup time
|
{ //Item pickup time
|
||||||
//clock (BotWTG);
|
//clock (BotWTG);
|
||||||
bglobal.WhatToGet (players[i].mo, this);
|
bglobal->WhatToGet (players[i].mo, this);
|
||||||
//unclock (BotWTG);
|
//unclock (BotWTG);
|
||||||
BotWTG++;
|
BotWTG++;
|
||||||
}
|
}
|
||||||
|
@ -2669,12 +2669,12 @@ void AActor::Tick ()
|
||||||
{
|
{
|
||||||
if (!players[i].missile && (flags3 & MF3_WARNBOT))
|
if (!players[i].missile && (flags3 & MF3_WARNBOT))
|
||||||
{ //warn for incoming missiles.
|
{ //warn for incoming missiles.
|
||||||
if (target != players[i].mo && bglobal.Check_LOS (players[i].mo, this, ANGLE_90))
|
if (target != players[i].mo && bglobal->Check_LOS (players[i].mo, this, ANGLE_90))
|
||||||
players[i].missile = this;
|
players[i].missile = this;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
bglobal.m_Thinking = false;
|
bglobal->m_Thinking = false;
|
||||||
unclock (BotSupportCycles);
|
unclock (BotSupportCycles);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3158,7 +3158,7 @@ AActor *AActor::StaticSpawn (const PClass *type, fixed_t ix, fixed_t iy, fixed_t
|
||||||
actor->z = actor->PrevZ = iz;
|
actor->z = actor->PrevZ = iz;
|
||||||
actor->picnum = 0xffff;
|
actor->picnum = 0xffff;
|
||||||
|
|
||||||
FRandom &rng = bglobal.m_Thinking ? pr_botspawnmobj : pr_spawnmobj;
|
FRandom &rng = bglobal->m_Thinking ? pr_botspawnmobj : pr_spawnmobj;
|
||||||
|
|
||||||
if (actor->isFast() && actor->flags3 & MF3_ISMONSTER)
|
if (actor->isFast() && actor->flags3 & MF3_ISMONSTER)
|
||||||
actor->reactiontime = 0;
|
actor->reactiontime = 0;
|
||||||
|
|
|
@ -230,7 +230,7 @@ static void CopyPlayer (player_t *dst, player_t *src, const char *name)
|
||||||
|
|
||||||
if (dst->isbot)
|
if (dst->isbot)
|
||||||
{
|
{
|
||||||
botinfo_t *thebot = bglobal.botinfo;
|
botinfo_t *thebot = bglobal->botinfo;
|
||||||
while (thebot && stricmp (name, thebot->name))
|
while (thebot && stricmp (name, thebot->name))
|
||||||
{
|
{
|
||||||
thebot = thebot->next;
|
thebot = thebot->next;
|
||||||
|
@ -239,8 +239,8 @@ static void CopyPlayer (player_t *dst, player_t *src, const char *name)
|
||||||
{
|
{
|
||||||
thebot->inuse = true;
|
thebot->inuse = true;
|
||||||
}
|
}
|
||||||
bglobal.botnum++;
|
bglobal->botnum++;
|
||||||
bglobal.botingame[dst - players] = true;
|
bglobal->botingame[dst - players] = true;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
|
@ -496,7 +496,7 @@ sightcounts[0]++;
|
||||||
// Cannot see an invisible object
|
// Cannot see an invisible object
|
||||||
if ((flags & 1) == 0 && ((t2->renderflags & RF_INVISIBLE) || !t2->RenderStyle.IsVisible(t2->alpha)))
|
if ((flags & 1) == 0 && ((t2->renderflags & RF_INVISIBLE) || !t2->RenderStyle.IsVisible(t2->alpha)))
|
||||||
{ // small chance of an attack being made anyway
|
{ // small chance of an attack being made anyway
|
||||||
if ((bglobal.m_Thinking ? pr_botchecksight() : pr_checksight()) > 50)
|
if ((bglobal->m_Thinking ? pr_botchecksight() : pr_checksight()) > 50)
|
||||||
{
|
{
|
||||||
res = false;
|
res = false;
|
||||||
goto done;
|
goto done;
|
||||||
|
|
|
@ -78,10 +78,10 @@ void P_Ticker (void)
|
||||||
// [RH] Frozen mode is only changed every 4 tics, to make it work with A_Tracer().
|
// [RH] Frozen mode is only changed every 4 tics, to make it work with A_Tracer().
|
||||||
if ((level.time & 3) == 0)
|
if ((level.time & 3) == 0)
|
||||||
{
|
{
|
||||||
if (bglobal.changefreeze)
|
if (bglobal->changefreeze)
|
||||||
{
|
{
|
||||||
bglobal.freeze ^= 1;
|
bglobal->freeze ^= 1;
|
||||||
bglobal.changefreeze = 0;
|
bglobal->changefreeze = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -102,7 +102,7 @@ void P_Ticker (void)
|
||||||
// Since things will be moving, it's okay to interpolate them in the renderer.
|
// Since things will be moving, it's okay to interpolate them in the renderer.
|
||||||
r_NoInterpolate = false;
|
r_NoInterpolate = false;
|
||||||
|
|
||||||
if (!bglobal.freeze && !(level.flags & LEVEL_FROZEN))
|
if (!bglobal->freeze && !(level.flags & LEVEL_FROZEN))
|
||||||
{
|
{
|
||||||
P_ThinkParticles (); // [RH] make the particles think
|
P_ThinkParticles (); // [RH] make the particles think
|
||||||
}
|
}
|
||||||
|
@ -110,14 +110,14 @@ void P_Ticker (void)
|
||||||
|
|
||||||
for (i = 0; i<MAXPLAYERS; i++)
|
for (i = 0; i<MAXPLAYERS; i++)
|
||||||
if (playeringame[i] &&
|
if (playeringame[i] &&
|
||||||
/*Added by MC: Freeze mode.*/!(bglobal.freeze && players[i].isbot))
|
/*Added by MC: Freeze mode.*/!(bglobal->freeze && players[i].isbot))
|
||||||
P_PlayerThink (&players[i]);
|
P_PlayerThink (&players[i]);
|
||||||
|
|
||||||
level.Tick (); // [RH] let the level tick
|
level.Tick (); // [RH] let the level tick
|
||||||
DThinker::RunThinkers ();
|
DThinker::RunThinkers ();
|
||||||
|
|
||||||
//if added by MC: Freeze mode.
|
//if added by MC: Freeze mode.
|
||||||
if (!bglobal.freeze && !(level.flags & LEVEL_FROZEN))
|
if (!bglobal->freeze && !(level.flags & LEVEL_FROZEN))
|
||||||
{
|
{
|
||||||
P_UpdateSpecials ();
|
P_UpdateSpecials ();
|
||||||
P_RunEffects (); // [RH] Run particle effects
|
P_RunEffects (); // [RH] Run particle effects
|
||||||
|
|
|
@ -132,6 +132,7 @@ void STACK_ARGS call_terms ()
|
||||||
static void FinalGC()
|
static void FinalGC()
|
||||||
{
|
{
|
||||||
Args = NULL;
|
Args = NULL;
|
||||||
|
bglobal = NULL;
|
||||||
GC::FullGC();
|
GC::FullGC();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1039,7 +1039,7 @@ void WI_End ()
|
||||||
//Added by mc
|
//Added by mc
|
||||||
if (deathmatch)
|
if (deathmatch)
|
||||||
{
|
{
|
||||||
bglobal.RemoveAllBots (consoleplayer != Net_Arbitrator);
|
bglobal->RemoveAllBots (consoleplayer != Net_Arbitrator);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue