- Changed D3DFB to explicitly request double buffering instead of assuming

that the drivers will treat a BackBufferCount of 0 as a request for
  double buffering.
- Fixed: Unsetting a cvar did not remove it from the list of tab
  completions.
- Added "" as a synonym for "nullimage" in SBARINFO.
- Fixed: MAKESAVESIG's stringifier in version.h did not work as expected.
  It stringified the passed macro name, not the value of the macro.
- Moved DCajunMaster off the DObject hierarchy.
- Changed DCajunMaster::getspawned into a TArray of FStrings. It was
  mysteriously being left pointing to uninitialized memory during the
  final GC at exit and crashing.
- Fixed: The code that removed hexdd.wad from the list of IWADs when
  hexen.wad was not present did not work.


SVN r861 (trunk)
This commit is contained in:
Randy Heit 2008-03-28 00:38:17 +00:00
parent 643fc792bd
commit 776d89428d
31 changed files with 17388 additions and 17388 deletions

View file

@ -1,3 +1,19 @@
March 27, 2008
- Changed D3DFB to explicitly request double buffering instead of assuming
that the drivers will treat a BackBufferCount of 0 as a request for
double buffering.
- Fixed: Unsetting a cvar did not remove it from the list of tab
completions.
- Added "" as a synonym for "nullimage" in SBARINFO.
- Fixed: MAKESAVESIG's stringifier in version.h did not work as expected.
It stringified the passed macro name, not the value of the macro.
- Moved DCajunMaster off the DObject hierarchy.
- Changed DCajunMaster::getspawned into a TArray of FStrings. It was
mysteriously being left pointing to uninitialized memory during the
final GC at exit and crashing.
- Fixed: The code that removed hexdd.wad from the list of IWADs when
hexen.wad was not present did not work.
March 27, 2008 (Changes by Graf Zahl) March 27, 2008 (Changes by Graf Zahl)
- Fixed: DCajunMaster::End was missing a write barrier for getspawned. The - Fixed: DCajunMaster::End was missing a write barrier for getspawned. The
same problem in D_DoomMain. same problem in D_DoomMain.
@ -5,6 +21,7 @@ March 27, 2008 (Changes by Graf Zahl)
collector. collector.
March 26, 2008 March 26, 2008
- Added uppercase copies of the IWAD names to the IWAD search for Unix land.
- 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
hang while waiting for input from the pipe, since Timidity hadn't been hang while waiting for input from the pipe, since Timidity hadn't been
@ -14394,7 +14411,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.
@ -14444,7 +14461,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

View file

@ -15,13 +15,6 @@
CVAR (Int, bot_next_color, 11, 0) CVAR (Int, bot_next_color, 11, 0)
CVAR (Bool, bot_observer, false, 0) CVAR (Bool, bot_observer, false, 0)
IMPLEMENT_POINTY_CLASS (DCajunMaster)
DECLARE_POINTER (getspawned)
DECLARE_POINTER (firstthing)
DECLARE_POINTER (body1)
DECLARE_POINTER (body2)
END_POINTERS
CCMD (addbot) CCMD (addbot)
{ {
if (gamestate != GS_LEVEL && gamestate != GS_INTERMISSION) if (gamestate != GS_LEVEL && gamestate != GS_INTERMISSION)
@ -43,12 +36,12 @@ 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 FCajunMaster::ClearPlayer (int i, bool keepTeam)
{ {
if (players[i].mo) if (players[i].mo)
{ {
@ -92,7 +85,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,9 +109,6 @@ 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)
{ {

View file

@ -73,13 +73,10 @@ struct botinfo_t
}; };
//Used to keep all the globally needed variables in nice order. //Used to keep all the globally needed variables in nice order.
class DCajunMaster : public DObject class FCajunMaster
{ {
DECLARE_CLASS (DCajunMaster, DObject)
HAS_OBJECT_POINTERS
public: public:
DCajunMaster(); ~FCajunMaster();
~DCajunMaster();
void ClearPlayer (int playernum, bool keepTeam); void ClearPlayer (int playernum, bool keepTeam);
@ -110,7 +107,7 @@ public:
void Pitch (AActor *actor, AActor *target); void Pitch (AActor *actor, AActor *target);
bool IsDangerous (sector_t *sec); bool IsDangerous (sector_t *sec);
DArgs *getspawned; //Array of bots (their names) which should be spawned when starting a game. TArray<FString> getspawned; //Array of bots (their names) which should be spawned when starting a game.
bool botingame[MAXPLAYERS]; bool botingame[MAXPLAYERS];
BYTE freeze:1; //Game in freeze mode. BYTE freeze:1; //Game in freeze mode.
BYTE changefreeze:1; //Game wants to change freeze mode. BYTE changefreeze:1; //Game wants to change freeze mode.
@ -119,6 +116,8 @@ public:
int spawn_tries; int spawn_tries;
int wanted_botnum; int wanted_botnum;
TObjPtr<AActor> firstthing; TObjPtr<AActor> firstthing;
TObjPtr<AActor> body1;
TObjPtr<AActor> body2;
bool m_Thinking; bool m_Thinking;
@ -142,14 +141,12 @@ protected:
bool ctf; bool ctf;
int loaded_bots; int loaded_bots;
int t_join; int t_join;
TObjPtr<AActor> body1;
TObjPtr<AActor> body2;
bool observer; //Consoleplayer is observer. bool observer; //Consoleplayer is observer.
}; };
//Externs //Externs
extern DCajunMaster *bglobal; extern FCajunMaster 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)

View file

@ -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?
@ -100,7 +100,7 @@ static bool PTR_Reachable (intercept_t *in)
//Checks TRUE reachability from //Checks TRUE reachability from
//one actor to another. First mobj (actor) is looker. //one actor to another. First mobj (actor) is looker.
bool DCajunMaster::Reachable (AActor *actor, AActor *target) bool FCajunMaster::Reachable (AActor *actor, AActor *target)
{ {
if (actor == target) if (actor == target)
return false; return false;
@ -128,7 +128,7 @@ bool DCajunMaster::Reachable (AActor *actor, AActor *target)
//if these conditions are true, the function returns true. //if these conditions are true, the function returns true.
//GOOD TO KNOW is that the player's view angle //GOOD TO KNOW is that the player's view angle
//in doom is 90 degrees infront. //in doom is 90 degrees infront.
bool DCajunMaster::Check_LOS (AActor *from, AActor *to, angle_t vangle) bool FCajunMaster::Check_LOS (AActor *from, AActor *to, angle_t vangle)
{ {
if (!P_CheckSight (from, to, 2)) if (!P_CheckSight (from, to, 2))
return false; // out of sight return false; // out of sight
@ -145,7 +145,7 @@ bool DCajunMaster::Check_LOS (AActor *from, AActor *to, angle_t vangle)
//------------------------------------- //-------------------------------------
//The bot will check if it's time to fire //The bot will check if it's time to fire
//and do so if that is the case. //and do so if that is the case.
void DCajunMaster::Dofire (AActor *actor, ticcmd_t *cmd) void FCajunMaster::Dofire (AActor *actor, ticcmd_t *cmd)
{ {
bool no_fire; //used to prevent bot from pumping rockets into nearby walls. bool no_fire; //used to prevent bot from pumping rockets into nearby walls.
int aiming_penalty=0; //For shooting at shading target, if screen is red, MAKEME: When screen red. int aiming_penalty=0; //For shooting at shading target, if screen is red, MAKEME: When screen red.
@ -288,7 +288,7 @@ shootmissile:
//This function is called every //This function is called every
//tick (for each bot) to set //tick (for each bot) to set
//the mate (teammate coop mate). //the mate (teammate coop mate).
AActor *DCajunMaster::Choose_Mate (AActor *bot) AActor *FCajunMaster::Choose_Mate (AActor *bot)
{ {
int count; int count;
int count2; int count2;
@ -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)
@ -385,7 +385,7 @@ AActor *DCajunMaster::Choose_Mate (AActor *bot)
} }
//MAKEME: Make this a smart decision //MAKEME: Make this a smart decision
AActor *DCajunMaster::Find_enemy (AActor *bot) AActor *FCajunMaster::Find_enemy (AActor *bot)
{ {
int count; int count;
fixed_t closest_dist, temp; //To target. fixed_t closest_dist, temp; //To target.
@ -448,7 +448,7 @@ AActor *DCajunMaster::Find_enemy (AActor *bot)
//Creates a temporary mobj (invisible) at the given location. //Creates a temporary mobj (invisible) at the given location.
void DCajunMaster::SetBodyAt (fixed_t x, fixed_t y, fixed_t z, int hostnum) void FCajunMaster::SetBodyAt (fixed_t x, fixed_t y, fixed_t z, int hostnum)
{ {
if (hostnum == 1) if (hostnum == 1)
{ {
@ -459,7 +459,6 @@ void DCajunMaster::SetBodyAt (fixed_t x, fixed_t y, fixed_t z, int hostnum)
else else
{ {
body1 = Spawn ("CajunBodyNode", x, y, z, NO_REPLACE); body1 = Spawn ("CajunBodyNode", x, y, z, NO_REPLACE);
GC::WriteBarrier(this, body1);
} }
} }
else if (hostnum == 2) else if (hostnum == 2)
@ -471,7 +470,6 @@ void DCajunMaster::SetBodyAt (fixed_t x, fixed_t y, fixed_t z, int hostnum)
else else
{ {
body2 = Spawn ("CajunBodyNode", x, y, z, NO_REPLACE); body2 = Spawn ("CajunBodyNode", x, y, z, NO_REPLACE);
GC::WriteBarrier(this, body2);
} }
} }
} }
@ -486,7 +484,7 @@ void DCajunMaster::SetBodyAt (fixed_t x, fixed_t y, fixed_t z, int hostnum)
//Emulates missile travel. Returns distance travelled. //Emulates missile travel. Returns distance travelled.
fixed_t DCajunMaster::FakeFire (AActor *source, AActor *dest, ticcmd_t *cmd) fixed_t FCajunMaster::FakeFire (AActor *source, AActor *dest, ticcmd_t *cmd)
{ {
AActor *th = Spawn ("CajunTrace", source->x, source->y, source->z + 4*8*FRACUNIT, NO_REPLACE); AActor *th = Spawn ("CajunTrace", source->x, source->y, source->z + 4*8*FRACUNIT, NO_REPLACE);
@ -516,7 +514,7 @@ fixed_t DCajunMaster::FakeFire (AActor *source, AActor *dest, ticcmd_t *cmd)
return dist; return dist;
} }
angle_t DCajunMaster::FireRox (AActor *bot, AActor *enemy, ticcmd_t *cmd) angle_t FCajunMaster::FireRox (AActor *bot, AActor *enemy, ticcmd_t *cmd)
{ {
fixed_t dist; fixed_t dist;
angle_t ang; angle_t ang;
@ -527,7 +525,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 +535,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;
} }
} }
@ -565,7 +563,7 @@ angle_t DCajunMaster::FireRox (AActor *bot, AActor *enemy, ticcmd_t *cmd)
// [RH] We absolutely do not want to pick things up here. The bot code is // [RH] We absolutely do not want to pick things up here. The bot code is
// executed apart from all the other simulation code, so we don't want it // executed apart from all the other simulation code, so we don't want it
// creating side-effects during gameplay. // creating side-effects during gameplay.
bool DCajunMaster::SafeCheckPosition (AActor *actor, fixed_t x, fixed_t y) bool FCajunMaster::SafeCheckPosition (AActor *actor, fixed_t x, fixed_t y)
{ {
int savedFlags = actor->flags; int savedFlags = actor->flags;
actor->flags &= ~MF_PICKUP; actor->flags &= ~MF_PICKUP;

View file

@ -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; FCajunMaster bglobal;
cycle_t BotThinkCycles, BotSupportCycles, BotWTG; cycle_t BotThinkCycles, BotSupportCycles, BotWTG;
@ -88,41 +88,14 @@ enum
static bool waitingforspawn[MAXPLAYERS]; static bool waitingforspawn[MAXPLAYERS];
DCajunMaster::DCajunMaster() FCajunMaster::~FCajunMaster()
{
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()
{ {
ForgetBots(); ForgetBots();
if (getspawned != NULL)
{
getspawned->Destroy();
getspawned = NULL;
}
// FIXME: Make this object proper
ObjectFlags |= OF_Cleanup | OF_YesReallyDelete;
} }
//This function is called every tick (from g_game.c), //This function is called every tick (from g_game.c),
//send bots into thinking (+more). //send bots into thinking (+more).
void DCajunMaster::Main (int buf) void FCajunMaster::Main (int buf)
{ {
int i; int i;
@ -153,7 +126,7 @@ void DCajunMaster::Main (int buf)
{ {
if (t_join == ((wanted_botnum - botnum) * SPAWN_DELAY)) if (t_join == ((wanted_botnum - botnum) * SPAWN_DELAY))
{ {
if (!SpawnBot (getspawned->GetArg (spawn_tries))) if (!SpawnBot (getspawned[spawn_tries]))
wanted_botnum--; wanted_botnum--;
spawn_tries++; spawn_tries++;
} }
@ -184,7 +157,7 @@ void DCajunMaster::Main (int buf)
m_Thinking = false; m_Thinking = false;
} }
void DCajunMaster::Init () void FCajunMaster::Init ()
{ {
int i; int i;
@ -230,25 +203,19 @@ void DCajunMaster::Init ()
} }
//Called on each level exit (from g_game.c). //Called on each level exit (from g_game.c).
void DCajunMaster::End () void FCajunMaster::End ()
{ {
int i; int i;
//Arrange wanted botnum and their names, so they can be spawned next level. //Arrange wanted botnum and their names, so they can be spawned next level.
if (getspawned) getspawned.Clear();
getspawned->FlushArgs ();
else
{
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)
{ {
if (deathmatch) if (deathmatch)
{ {
getspawned->AppendArg (players[i].userinfo.netname); getspawned.Push(players[i].userinfo.netname);
} }
CleanBotstuff (&players[i]); CleanBotstuff (&players[i]);
} }
@ -272,7 +239,7 @@ void DCajunMaster::End ()
//The color parameter overides bots //The color parameter overides bots
//induvidual colors if not = NOCOLOR. //induvidual colors if not = NOCOLOR.
bool DCajunMaster::SpawnBot (const char *name, int color) bool FCajunMaster::SpawnBot (const char *name, int color)
{ {
int playernumber; int playernumber;
@ -375,7 +342,7 @@ bool DCajunMaster::SpawnBot (const char *name, int color)
return true; return true;
} }
void DCajunMaster::DoAddBot (int bnum, char *info) void FCajunMaster::DoAddBot (int bnum, char *info)
{ {
BYTE *infob = (BYTE *)info; BYTE *infob = (BYTE *)info;
D_ReadUserInfoStrings (bnum, &infob, false); D_ReadUserInfoStrings (bnum, &infob, false);
@ -412,7 +379,7 @@ void DCajunMaster::DoAddBot (int bnum, char *info)
waitingforspawn[bnum] = false; waitingforspawn[bnum] = false;
} }
void DCajunMaster::RemoveAllBots (bool fromlist) void FCajunMaster::RemoveAllBots (bool fromlist)
{ {
int i, j; int i, j;
@ -452,7 +419,7 @@ void DCajunMaster::RemoveAllBots (bool fromlist)
//Clean the bot part of the player_t //Clean the bot part of the player_t
//Used when bots are respawned or at level starts. //Used when bots are respawned or at level starts.
void DCajunMaster::CleanBotstuff (player_t *p) void FCajunMaster::CleanBotstuff (player_t *p)
{ {
p->angle = ANG45; p->angle = ANG45;
p->dest = NULL; p->dest = NULL;
@ -509,7 +476,7 @@ static void appendinfo (char *&front, const char *back)
front = newstr; front = newstr;
} }
void DCajunMaster::ForgetBots () void FCajunMaster::ForgetBots ()
{ {
botinfo_t *thebot = botinfo; botinfo_t *thebot = botinfo;
@ -526,13 +493,13 @@ void DCajunMaster::ForgetBots ()
loaded_bots = 0; loaded_bots = 0;
} }
bool DCajunMaster::LoadBots () bool FCajunMaster::LoadBots ()
{ {
FScanner sc; FScanner sc;
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;
@ -662,12 +629,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;
} }

View file

@ -46,7 +46,7 @@ extern TArray<line_t *> spechit;
//Called while the bot moves after its player->dest mobj //Called while the bot moves after its player->dest mobj
//which can be a weapon/enemy/item whatever. //which can be a weapon/enemy/item whatever.
void DCajunMaster::Roam (AActor *actor, ticcmd_t *cmd) void FCajunMaster::Roam (AActor *actor, ticcmd_t *cmd)
{ {
int delta; int delta;
@ -72,7 +72,7 @@ void DCajunMaster::Roam (AActor *actor, ticcmd_t *cmd)
} }
} }
bool DCajunMaster::Move (AActor *actor, ticcmd_t *cmd) bool FCajunMaster::Move (AActor *actor, ticcmd_t *cmd)
{ {
fixed_t tryx, tryy; fixed_t tryx, tryy;
bool try_ok; bool try_ok;
@ -130,7 +130,7 @@ bool DCajunMaster::Move (AActor *actor, ticcmd_t *cmd)
return true; return true;
} }
bool DCajunMaster::TryWalk (AActor *actor, ticcmd_t *cmd) bool FCajunMaster::TryWalk (AActor *actor, ticcmd_t *cmd)
{ {
if (!Move (actor, cmd)) if (!Move (actor, cmd))
return false; return false;
@ -139,7 +139,7 @@ bool DCajunMaster::TryWalk (AActor *actor, ticcmd_t *cmd)
return true; return true;
} }
void DCajunMaster::NewChaseDir (AActor *actor, ticcmd_t *cmd) void FCajunMaster::NewChaseDir (AActor *actor, ticcmd_t *cmd)
{ {
fixed_t deltax; fixed_t deltax;
fixed_t deltay; fixed_t deltay;
@ -275,7 +275,7 @@ void DCajunMaster::NewChaseDir (AActor *actor, ticcmd_t *cmd)
// This is also a traverse function for // This is also a traverse function for
// bots pre-rocket fire (preventing suicide) // bots pre-rocket fire (preventing suicide)
// //
bool DCajunMaster::CleanAhead (AActor *thing, fixed_t x, fixed_t y, ticcmd_t *cmd) bool FCajunMaster::CleanAhead (AActor *thing, fixed_t x, fixed_t y, ticcmd_t *cmd)
{ {
if (!SafeCheckPosition (thing, x, y)) if (!SafeCheckPosition (thing, x, y))
return false; // solid wall or thing return false; // solid wall or thing
@ -322,7 +322,7 @@ bool DCajunMaster::CleanAhead (AActor *thing, fixed_t x, fixed_t y, ticcmd_t *cm
#define MAXTURN (15*ANGLE_1) //Max degrees turned in one tic. Lower is smother but may cause the bot not getting where it should = crash #define MAXTURN (15*ANGLE_1) //Max degrees turned in one tic. Lower is smother but may cause the bot not getting where it should = crash
#define TURNSENS 3 //Higher is smoother but slower turn. #define TURNSENS 3 //Higher is smoother but slower turn.
void DCajunMaster::TurnToAng (AActor *actor) void FCajunMaster::TurnToAng (AActor *actor)
{ {
int maxturn = MAXTURN; int maxturn = MAXTURN;
@ -356,7 +356,7 @@ void DCajunMaster::TurnToAng (AActor *actor)
actor->angle += distance; actor->angle += distance;
} }
void DCajunMaster::Pitch (AActor *actor, AActor *target) void FCajunMaster::Pitch (AActor *actor, AActor *target)
{ {
double aim; double aim;
double diff; double diff;
@ -367,7 +367,7 @@ void DCajunMaster::Pitch (AActor *actor, AActor *target)
} }
//Checks if a sector is dangerous. //Checks if a sector is dangerous.
bool DCajunMaster::IsDangerous (sector_t *sec) bool FCajunMaster::IsDangerous (sector_t *sec)
{ {
int special; int special;

View file

@ -23,7 +23,7 @@ static FRandom pr_botmove ("BotMove");
//This function is called each tic for each bot, //This function is called each tic for each bot,
//so this is what the bot does. //so this is what the bot does.
void DCajunMaster::Think (AActor *actor, ticcmd_t *cmd) void FCajunMaster::Think (AActor *actor, ticcmd_t *cmd)
{ {
memset (cmd, 0, sizeof(*cmd)); memset (cmd, 0, sizeof(*cmd));
@ -71,7 +71,7 @@ void DCajunMaster::Think (AActor *actor, ticcmd_t *cmd)
//how the bot moves. //how the bot moves.
//MAIN movement function. //MAIN movement function.
void DCajunMaster::ThinkForMove (AActor *actor, ticcmd_t *cmd) void FCajunMaster::ThinkForMove (AActor *actor, ticcmd_t *cmd)
{ {
player_t *b; player_t *b;
fixed_t dist; fixed_t dist;
@ -312,7 +312,7 @@ void DCajunMaster::ThinkForMove (AActor *actor, ticcmd_t *cmd)
//BOT_WhatToGet //BOT_WhatToGet
// //
//Determines if the bot will roam after an item or not. //Determines if the bot will roam after an item or not.
void DCajunMaster::WhatToGet (AActor *actor, AActor *item) void FCajunMaster::WhatToGet (AActor *actor, AActor *item)
{ {
player_t *b = actor->player; player_t *b = actor->player;
@ -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)))
@ -376,7 +376,7 @@ void DCajunMaster::WhatToGet (AActor *actor, AActor *item)
} }
} }
void DCajunMaster::Set_enemy (AActor *actor) void FCajunMaster::Set_enemy (AActor *actor)
{ {
AActor *oldenemy; AActor *oldenemy;
AActor **enemy = &actor->player->enemy; AActor **enemy = &actor->player->enemy;

View file

@ -127,6 +127,7 @@ FBaseCVar::~FBaseCVar ()
else else
CVars = m_Next; CVars = m_Next;
} }
C_RemoveTabCommand(Name);
delete[] Name; delete[] Name;
} }
} }

View file

@ -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)
@ -1526,6 +1526,7 @@ static int CheckIWAD (const char *doomwaddir, WadStuff *wads)
iwad.Format ("%s%s%s", doomwaddir, slash, IWADNames[i]); iwad.Format ("%s%s%s", doomwaddir, slash, IWADNames[i]);
FixPathSeperator (iwad.LockBuffer()); FixPathSeperator (iwad.LockBuffer());
iwad.UnlockBuffer();
if (FileExists (iwad)) if (FileExists (iwad))
{ {
wads[i].Type = ScanIWAD (iwad); wads[i].Type = ScanIWAD (iwad);
@ -1656,7 +1657,7 @@ static int CheckIWADinEnvDir (const char *str, WadStuff *wads)
static EIWADType IdentifyVersion (const char *zdoom_wad) static EIWADType IdentifyVersion (const char *zdoom_wad)
{ {
WadStuff wads[sizeof(IWADNames)/sizeof(char *)]; WadStuff wads[countof(IWADNames)];
size_t foundwads[NUM_IWAD_TYPES] = { 0 }; size_t foundwads[NUM_IWAD_TYPES] = { 0 };
const char *iwadparm = Args->CheckValue ("-iwad"); const char *iwadparm = Args->CheckValue ("-iwad");
size_t numwads; size_t numwads;
@ -1746,7 +1747,7 @@ static EIWADType IdentifyVersion (const char *zdoom_wad)
{ {
wads[numwads] = wads[i]; wads[numwads] = wads[i];
} }
foundwads[wads[numwads].Type] = numwads+1; foundwads[wads[numwads].Type] = numwads + 1;
numwads++; numwads++;
} }
} }
@ -1754,11 +1755,19 @@ static EIWADType IdentifyVersion (const char *zdoom_wad)
if (foundwads[IWAD_HexenDK] && !foundwads[IWAD_Hexen]) if (foundwads[IWAD_HexenDK] && !foundwads[IWAD_Hexen])
{ // Cannot play Hexen DK without Hexen { // Cannot play Hexen DK without Hexen
size_t kill = foundwads[IWAD_HexenDK]; size_t kill = foundwads[IWAD_HexenDK];
if (kill != numwads) for (i = kill; i < numwads; ++i)
{ {
memmove (&wads[kill-1], &wads[kill], numwads - kill); wads[i - 1] = wads[i];
} }
numwads--; numwads--;
foundwads[IWAD_HexenDK] = 0;
for (i = 0; i < NUM_IWAD_TYPES; ++i)
{
if (foundwads[i] > kill)
{
foundwads[i]--;
}
}
} }
if (numwads == 0) if (numwads == 0)
@ -2433,18 +2442,13 @@ void D_DoomMain (void)
} }
//Added by MC: //Added by MC:
bglobal->getspawned = Args->GatherFiles ("-bots", "", false); DArgs *bots = Args->GatherFiles("-bots", "", false);
if (bglobal->getspawned->NumArgs() == 0) for (p = 0; p < bots->NumArgs(); ++p)
{ {
bglobal->getspawned->Destroy(); bglobal.getspawned.Push(bots->GetArg(p));
bglobal->getspawned = NULL;
}
else
{
GC::WriteBarrier(bglobal, bglobal->getspawned);
bglobal->spawn_tries = 0;
bglobal->wanted_botnum = bglobal->getspawned->NumArgs();
} }
bglobal.spawn_tries = 0;
bglobal.wanted_botnum = bglobal.getspawned.Size();
Printf ("M_Init: Init miscellaneous info.\n"); Printf ("M_Init: Init miscellaneous info.\n");
M_Init (); M_Init ();

View file

@ -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;

View file

@ -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;
} }

View file

@ -492,7 +492,7 @@ size_t DObject::StaticPointerSubstitution (DObject *old, DObject *notOld)
for (i = 0; i < numsectors; ++i) for (i = 0; i < numsectors; ++i)
{ {
#define SECTOR_CHECK(f,t) \ #define SECTOR_CHECK(f,t) \
if (sectors[i].f == static_cast<t *>(old)) { sectors[i].f = static_cast<t *>(notOld); changed++; } if (sectors[i].f.p == static_cast<t *>(old)) { sectors[i].f = static_cast<t *>(notOld); changed++; }
SECTOR_CHECK( SoundTarget, AActor ); SECTOR_CHECK( SoundTarget, AActor );
SECTOR_CHECK( CeilingSkyBox, ASkyViewpoint ); SECTOR_CHECK( CeilingSkyBox, ASkyViewpoint );
SECTOR_CHECK( FloorSkyBox, ASkyViewpoint ); SECTOR_CHECK( FloorSkyBox, ASkyViewpoint );
@ -503,6 +503,12 @@ size_t DObject::StaticPointerSubstitution (DObject *old, DObject *notOld)
#undef SECTOR_CHECK #undef SECTOR_CHECK
} }
} }
// Go through bot stuff.
if (bglobal.firstthing.p == (AActor *)old) bglobal.firstthing = (AActor *)notOld, ++changed;
if (bglobal.body1.p == (AActor *)old) bglobal.body1 = (AActor *)notOld, ++changed;
if (bglobal.body2.p == (AActor *)old) bglobal.body2 = (AActor *)notOld, ++changed;
return changed; return changed;
} }

View file

@ -400,6 +400,7 @@ public:
} }
template<class U> friend inline FArchive &operator<<(FArchive &arc, TObjPtr<U> &o); template<class U> friend inline FArchive &operator<<(FArchive &arc, TObjPtr<U> &o);
friend class DObject;
}; };
template<class T> inline FArchive &operator<<(FArchive &arc, TObjPtr<T> &o) template<class T> inline FArchive &operator<<(FArchive &arc, TObjPtr<T> &o)

View file

@ -289,15 +289,18 @@ static void MarkRoot()
DThinker::MarkRoots(); DThinker::MarkRoots();
FCanvasTextureInfo::Mark(); FCanvasTextureInfo::Mark();
Mark(DACSThinker::ActiveThinker); Mark(DACSThinker::ActiveThinker);
// Mark dead bodies.
for (i = 0; i < BODYQUESIZE; ++i) for (i = 0; i < BODYQUESIZE; ++i)
{ {
Mark(bodyque[i]); Mark(bodyque[i]);
} }
// Mark players.
for (i = 0; i < MAXPLAYERS; i++) for (i = 0; i < MAXPLAYERS; i++)
{ {
if (playeringame[i]) if (playeringame[i])
players[i].PropagateMark(); players[i].PropagateMark();
} }
// Mark sectors.
if (SectorMarker == NULL && sectors != NULL) if (SectorMarker == NULL && sectors != NULL)
{ {
SectorMarker = new DSectorMarker; SectorMarker = new DSectorMarker;
@ -311,10 +314,11 @@ static void MarkRoot()
SectorMarker->SecNum = 0; SectorMarker->SecNum = 0;
} }
Mark(SectorMarker); Mark(SectorMarker);
{ // Silly bots // Mark bot stuff.
Mark(bglobal); Mark(bglobal.firstthing);
} Mark(bglobal.body1);
// Add soft roots Mark(bglobal.body2);
// Mark soft roots.
if (SoftRoots != NULL) if (SoftRoots != NULL)
{ {
DObject **probe = &SoftRoots->ObjNext; DObject **probe = &SoftRoots->ObjNext;
@ -328,6 +332,7 @@ static void MarkRoot()
} }
} }
} }
// Time to propagate the marks.
State = GCS_Propagate; State = GCS_Propagate;
StepCount = 0; StepCount = 0;
} }

View file

@ -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)

View file

@ -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)

View file

@ -1072,9 +1072,9 @@ int SBarInfo::getSignedInteger(FScanner &sc)
} }
} }
int SBarInfo::newImage(const char* patchname) int SBarInfo::newImage(const char *patchname)
{ {
if(stricmp(patchname, "nullimage") == 0) if(patchname[0] == '\0' || stricmp(patchname, "nullimage") == 0)
{ {
return -1; return -1;
} }

View file

@ -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";
} }

View file

@ -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++)

View file

@ -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;

View file

@ -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;

View file

@ -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
{ {

View file

@ -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;

View file

@ -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

View file

@ -132,7 +132,6 @@ void STACK_ARGS call_terms ()
static void FinalGC() static void FinalGC()
{ {
Args = NULL; Args = NULL;
bglobal = NULL;
GC::FullGC(); GC::FullGC();
} }

View file

@ -80,8 +80,23 @@
#if SVN_REVISION_NUMBER < MINSAVEVER #if SVN_REVISION_NUMBER < MINSAVEVER
// Never write a savegame with a version lower than what we need // Never write a savegame with a version lower than what we need
#define SAVEVER MINSAVEVER #define SAVEVER MINSAVEVER
#define MAKESAVESIG(x) "ZDOOMSAVE" #x #define SAVESIG MakeSaveSig()
#define SAVESIG MAKESAVESIG(SAVEVER) static inline const char *MakeSaveSig()
{
static char foo[] = { 'Z','D','O','O','M','S','A','V','E',
#if SAVEVER > 9999
'0' + (SAVEVER / 10000),
#endif
#if SAVEVER > 999
'0' + ((SAVEVER / 1000) % 10),
#endif
'0' + ((SAVEVER / 100) % 10),
'0' + ((SAVEVER / 10) % 10),
'0' + (SAVEVER % 10),
'\0'
};
return foo;
}
#else #else
#define SAVEVER SVN_REVISION_NUMBER #define SAVEVER SVN_REVISION_NUMBER
#define SAVESIG "ZDOOMSAVE"SVN_REVISION_STRING #define SAVESIG "ZDOOMSAVE"SVN_REVISION_STRING

View file

@ -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);
} }
} }

View file

@ -397,6 +397,7 @@ void D3DFB::FillPresentParameters (D3DPRESENT_PARAMETERS *pp, bool fullscreen, b
pp->BackBufferWidth = Width << PixelDoubling; pp->BackBufferWidth = Width << PixelDoubling;
pp->BackBufferHeight = TrueHeight << PixelDoubling; pp->BackBufferHeight = TrueHeight << PixelDoubling;
pp->BackBufferFormat = fullscreen ? D3DFMT_A8R8G8B8 : D3DFMT_UNKNOWN; pp->BackBufferFormat = fullscreen ? D3DFMT_A8R8G8B8 : D3DFMT_UNKNOWN;
pp->BackBufferCount = 1;
pp->hDeviceWindow = Window; pp->hDeviceWindow = Window;
pp->PresentationInterval = vsync ? D3DPRESENT_INTERVAL_ONE : D3DPRESENT_INTERVAL_IMMEDIATE; pp->PresentationInterval = vsync ? D3DPRESENT_INTERVAL_ONE : D3DPRESENT_INTERVAL_IMMEDIATE;
if (fullscreen) if (fullscreen)

View file

@ -249,7 +249,6 @@ static void UnWTS (void)
static void FinalGC() static void FinalGC()
{ {
Args = NULL; Args = NULL;
bglobal = NULL;
GC::FullGC(); GC::FullGC();
} }