From 997533e0c86f2162968f3eba20ca6b6a4ce5a0a1 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Thu, 27 Mar 2008 22:37:13 +0000 Subject: [PATCH] - 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) --- docs/rh-log.txt | 42 ++++++++++++++++++++++++------------------ src/b_bot.cpp | 9 ++++++--- src/b_bot.h | 3 ++- src/b_func.cpp | 14 +++++++------- src/b_game.cpp | 35 +++++++++++++++++++++++++++++------ src/b_think.cpp | 2 +- src/d_main.cpp | 43 ++++++++++++++++++++++--------------------- src/d_net.cpp | 8 ++++---- src/decallib.cpp | 8 ++++---- src/dobjgc.cpp | 3 +-- src/g_game.cpp | 6 +++--- src/g_level.cpp | 6 +++--- src/m_cheat.cpp | 4 ++-- src/p_interaction.cpp | 4 ++-- src/p_map.cpp | 2 +- src/p_mobj.cpp | 14 +++++++------- src/p_saveg.cpp | 6 +++--- src/p_sight.cpp | 2 +- src/p_switch.cpp | 2 +- src/p_tick.cpp | 12 ++++++------ src/sdl/i_main.cpp | 1 + src/wi_stuff.cpp | 2 +- 22 files changed, 131 insertions(+), 97 deletions(-) diff --git a/docs/rh-log.txt b/docs/rh-log.txt index 02a895112..126bc8762 100644 --- a/docs/rh-log.txt +++ b/docs/rh-log.txt @@ -1,19 +1,25 @@ -March 26, 2008 -- 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 - hang while waiting for input from the pipe, since Timidity hadn't been - started yet. I tried using a select call in the FillStream() method, but it - always seems to return the pipe as having nothing available. Unfortunately, - the game still falls all over itself if Timidity isn't available. Instead - of execvp failing nicely, X errors kill the game. I don't know why it's - doing that. My advice for Linux music: Skip Timidity++ and get a DLS patch - set (/WINDOWS/system32/drivers/gm.dls is probably the most common by far) - and set the snd_midipatchset cvar to point to it. It's faster and also - sounds a whole lot better than the crappy freepats Ubuntu wants to install - with Timidity++ (thank goodness I have the official patches from a real - GUS so I don't need to use them). -- GCC fixes. - +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 +- 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 + hang while waiting for input from the pipe, since Timidity hadn't been + started yet. I tried using a select call in the FillStream() method, but it + always seems to return the pipe as having nothing available. Unfortunately, + the game still falls all over itself if Timidity isn't available. Instead + of execvp failing nicely, X errors kill the game. I don't know why it's + doing that. My advice for Linux music: Skip Timidity++ and get a DLS patch + set (/WINDOWS/system32/drivers/gm.dls is probably the most common by far) + and set the snd_midipatchset cvar to point to it. It's faster and also + sounds a whole lot better than the crappy freepats Ubuntu wants to install + with Timidity++ (thank goodness I have the official patches from a real + GUS so I don't need to use them). +- GCC fixes. + March 26, 2008 (Changes by Graf Zahl) - Fixed: After starting new music the music volume has to be reset so that the song's relative volume takes effect. @@ -14388,7 +14394,7 @@ July 21, 1999 damage. - Changed bot observer mode to use noclip instead of noblockmap. Otherwise, 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 levels, even though all actors disappear when travelling between levels. Not a good thing. Fixed. @@ -14438,7 +14444,7 @@ July 14, 1999 the for loop. 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 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 diff --git a/src/b_bot.cpp b/src/b_bot.cpp index 99d35b9c7..dc1a22501 100644 --- a/src/b_bot.cpp +++ b/src/b_bot.cpp @@ -43,9 +43,9 @@ CCMD (addbot) } if (argv.argc() > 1) - bglobal.SpawnBot (argv[1]); + bglobal->SpawnBot (argv[1]); else - bglobal.SpawnBot (NULL); + bglobal->SpawnBot (NULL); } void DCajunMaster::ClearPlayer (int i, bool keepTeam) @@ -92,7 +92,7 @@ CCMD (freeze) CCMD (listbots) { - botinfo_t *thebot = bglobal.botinfo; + botinfo_t *thebot = bglobal->botinfo; int count = 0; while (thebot) @@ -115,6 +115,9 @@ AT_GAME_SET(BotStuff) { AWeapon * w; AActor * a; + + bglobal = new DCajunMaster; + GC::WriteBarrier(bglobal); w = (AWeapon*)GetDefaultByName ("Pistol"); if (w != NULL) diff --git a/src/b_bot.h b/src/b_bot.h index 607fd01ff..3ce8d4d3e 100644 --- a/src/b_bot.h +++ b/src/b_bot.h @@ -78,6 +78,7 @@ class DCajunMaster : public DObject DECLARE_CLASS (DCajunMaster, DObject) HAS_OBJECT_POINTERS public: + DCajunMaster(); ~DCajunMaster(); void ClearPlayer (int playernum, bool keepTeam); @@ -148,7 +149,7 @@ protected: //Externs -extern DCajunMaster bglobal; +extern DCajunMaster *bglobal; EXTERN_CVAR (Float, bot_flag_return_time) EXTERN_CVAR (Int, bot_next_color) diff --git a/src/b_func.cpp b/src/b_func.cpp index 8e4fe03d0..f2057fc6a 100644 --- a/src/b_func.cpp +++ b/src/b_func.cpp @@ -63,7 +63,7 @@ static bool PTR_Reachable (intercept_t *in) fixed_t ceilingheight = s->ceilingplane.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) && ((ceilingheight == floorheight && line->special) || (ceilingheight - floorheight) >= looker->height))) //Does it fit? @@ -369,7 +369,7 @@ AActor *DCajunMaster::Choose_Mate (AActor *bot) //Make a introducing to 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; 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->z + (bot->height / 2), 2); - actor = bglobal.body2; + actor = bglobal->body2; dist = P_AproxDistance (actor->x-enemy->x, actor->y-enemy->y); 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)), 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 - 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 (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; } } diff --git a/src/b_game.cpp b/src/b_game.cpp index 602814d14..c4f0cb172 100644 --- a/src/b_game.cpp +++ b/src/b_game.cpp @@ -61,7 +61,7 @@ Everything that is changed is marked (maybe commented) with "Added by MC" static FRandom pr_botspawn ("BotSpawn"); //Externs -DCajunMaster bglobal; +DCajunMaster *bglobal; cycle_t BotThinkCycles, BotSupportCycles, BotWTG; @@ -88,6 +88,26 @@ enum 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() { ForgetBots(); @@ -218,7 +238,10 @@ void DCajunMaster::End () if (getspawned) getspawned->FlushArgs (); else + { getspawned = new DArgs; + GC::WriteBarrier(this, getspawned); + } for (i = 0; i < MAXPLAYERS; i++) { if (playeringame[i] && players[i].isbot) @@ -509,7 +532,7 @@ bool DCajunMaster::LoadBots () FString tmp; bool gotteam = false; - bglobal.ForgetBots (); + bglobal->ForgetBots (); #ifndef unix tmp = progdir; tmp += "zcajun/" BOTFILENAME; @@ -639,12 +662,12 @@ bool DCajunMaster::LoadBots () appendinfo (newinfo->info, "team"); appendinfo (newinfo->info, "255"); } - newinfo->next = bglobal.botinfo; + newinfo->next = bglobal->botinfo; newinfo->lastteam = TEAM_None; - bglobal.botinfo = newinfo; - bglobal.loaded_bots++; + bglobal->botinfo = newinfo; + 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; } diff --git a/src/b_think.cpp b/src/b_think.cpp index 3de21e983..b463ecd49 100644 --- a/src/b_think.cpp +++ b/src/b_think.cpp @@ -329,7 +329,7 @@ void DCajunMaster::WhatToGet (AActor *actor, AActor *item) } 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))) // return; // don't know how to use artifacts if (item->IsKindOf (RUNTIME_CLASS(AWeapon))) diff --git a/src/d_main.cpp b/src/d_main.cpp index 7841fa5ba..05704041c 100644 --- a/src/d_main.cpp +++ b/src/d_main.cpp @@ -242,19 +242,19 @@ static const char *IWADNames[] = "hexen.wad", "hexdd.wad", "strife1.wad", - "strife0.wad", -#ifdef unix - "DOOM2.WAD", // Also look for all-uppercase names - "PLUTONIA.WAD", - "TNT.WAD", - "DOOM.WAD", - "DOOM1.WAD", - "HERETIC.WAD", - "HERETIC1.WAD", - "HEXEN.WAD", - "HEXDD.WAD", - "STRIFE1.WAD", - "STRIFE0.WAD", + "strife0.wad", +#ifdef unix + "DOOM2.WAD", // Also look for all-uppercase names + "PLUTONIA.WAD", + "TNT.WAD", + "DOOM.WAD", + "DOOM1.WAD", + "HERETIC.WAD", + "HERETIC1.WAD", + "HEXEN.WAD", + "HEXDD.WAD", + "STRIFE1.WAD", + "STRIFE0.WAD", #endif NULL }; @@ -718,7 +718,7 @@ void D_Display () void D_ErrorCleanup () { screen->Unlock (); - bglobal.RemoveAllBots (true); + bglobal->RemoveAllBots (true); D_QuitNetGame (); if (demorecording || demoplayback) G_CheckDemoStatus (); @@ -772,7 +772,7 @@ void D_DoomLoop () players[i].savedpitch = players[i].mo->pitch; } } - bglobal.Main (maketic%BACKUPTICS); + bglobal->Main (maketic%BACKUPTICS); for (i = 0; i < MAXPLAYERS; i++) { if (playeringame[i] && players[i].isbot && players[i].mo) @@ -2433,16 +2433,17 @@ void D_DoomMain (void) } //Added by MC: - bglobal.getspawned = Args->GatherFiles ("-bots", "", false); - if (bglobal.getspawned->NumArgs() == 0) + bglobal->getspawned = Args->GatherFiles ("-bots", "", false); + if (bglobal->getspawned->NumArgs() == 0) { - bglobal.getspawned->Destroy(); - bglobal.getspawned = NULL; + bglobal->getspawned->Destroy(); + bglobal->getspawned = NULL; } else { - bglobal.spawn_tries = 0; - bglobal.wanted_botnum = bglobal.getspawned->NumArgs(); + GC::WriteBarrier(bglobal, bglobal->getspawned); + bglobal->spawn_tries = 0; + bglobal->wanted_botnum = bglobal->getspawned->NumArgs(); } Printf ("M_Init: Init miscellaneous info.\n"); diff --git a/src/d_net.cpp b/src/d_net.cpp index 83db8f21d..0d0441d12 100644 --- a/src/d_net.cpp +++ b/src/d_net.cpp @@ -641,7 +641,7 @@ void PlayerIsGone (int netnode, int netconsole) FBehavior::StaticStartTypedScripts (SCRIPT_Disconnect, NULL, true, netconsole); if (netconsole == Net_Arbitrator) { - bglobal.RemoveAllBots (true); + bglobal->RemoveAllBots (true); Printf ("Removed all bots\n"); // Pick a new network arbitrator @@ -966,7 +966,7 @@ void NetUpdate (void) if (maketic % ticdup == 0) { //Added by MC: For some of that bot stuff. The main bot function. - bglobal.Main ((maketic / ticdup) % BACKUPTICS); + bglobal->Main ((maketic / ticdup) % BACKUPTICS); } maketic++; @@ -2048,12 +2048,12 @@ void Net_DoCommand (int type, BYTE **stream, int player) case DEM_ADDBOT: { BYTE num = ReadByte (stream); - bglobal.DoAddBot (num, s = ReadString (stream)); + bglobal->DoAddBot (num, s = ReadString (stream)); } break; case DEM_KILLBOTS: - bglobal.RemoveAllBots (true); + bglobal->RemoveAllBots (true); Printf ("Removed all bots\n"); break; diff --git a/src/decallib.cpp b/src/decallib.cpp index 1a0e193e7..e0df0d60b 100644 --- a/src/decallib.cpp +++ b/src/decallib.cpp @@ -1135,7 +1135,7 @@ void DDecalFader::Tick () } else { - if (level.maptime < TimeToStartDecay || bglobal.freeze) + if (level.maptime < TimeToStartDecay || bglobal->freeze) { return; } @@ -1218,7 +1218,7 @@ void DDecalStretcher::Tick () Destroy (); return; } - if (level.maptime < TimeToStart || bglobal.freeze) + if (level.maptime < TimeToStart || bglobal->freeze) { return; } @@ -1287,7 +1287,7 @@ void DDecalSlider::Tick () Destroy (); return; } - if (level.maptime < TimeToStart || bglobal.freeze) + if (level.maptime < TimeToStart || bglobal->freeze) { return; } @@ -1353,7 +1353,7 @@ void DDecalColorer::Tick () } else { - if (level.maptime < TimeToStartDecay || bglobal.freeze) + if (level.maptime < TimeToStartDecay || bglobal->freeze) { return; } diff --git a/src/dobjgc.cpp b/src/dobjgc.cpp index 840c4e94b..962fc337c 100644 --- a/src/dobjgc.cpp +++ b/src/dobjgc.cpp @@ -312,8 +312,7 @@ static void MarkRoot() } Mark(SectorMarker); { // Silly bots - DObject *foo = &bglobal; - Mark(foo); + Mark(bglobal); } // Add soft roots if (SoftRoots != NULL) diff --git a/src/g_game.cpp b/src/g_game.cpp index 085990ac9..35abf7b37 100644 --- a/src/g_game.cpp +++ b/src/g_game.cpp @@ -1218,8 +1218,8 @@ void G_PlayerReborn (int player) } //Added by MC: Init bot structure. - if (bglobal.botingame[player]) - bglobal.CleanBotstuff (p); + if (bglobal->botingame[player]) + bglobal->CleanBotstuff (p); else p->isbot = false; @@ -1764,7 +1764,7 @@ void G_DoLoadGame () // Read intermission data for hubs G_ReadHubInfo(png); - bglobal.RemoveAllBots (true); + bglobal->RemoveAllBots (true); text = M_GetPNGText (png, "Important CVARs"); if (text != NULL) diff --git a/src/g_level.cpp b/src/g_level.cpp index 0cfaa3e0d..05ad8a657 100644 --- a/src/g_level.cpp +++ b/src/g_level.cpp @@ -1693,7 +1693,7 @@ void G_InitNew (const char *mapname, bool bTitleLevel) //Added by MC: Initialize bots. if (!deathmatch) { - bglobal.Init (); + bglobal->Init (); } if (mapname != level.mapname) @@ -1761,7 +1761,7 @@ void G_ChangeLevel(const char * levelname, int position, bool keepFacing, int ne gameaction = ga_completed; resetinventory = resetinv; - bglobal.End(); //Added by MC: + bglobal->End(); //Added by MC: // [RH] Give scripts a chance to do something unloading = true; @@ -2109,7 +2109,7 @@ void G_DoLoadLevel (int position, bool autosave) //Added by MC: Initialize bots. if (deathmatch) { - bglobal.Init (); + bglobal->Init (); } if (timingdemo) diff --git a/src/m_cheat.cpp b/src/m_cheat.cpp index d800cce27..e5d27ee92 100644 --- a/src/m_cheat.cpp +++ b/src/m_cheat.cpp @@ -403,8 +403,8 @@ void cht_DoCheat (player_t *player, int cheat) break; case CHT_FREEZE: - bglobal.changefreeze ^= 1; - if (bglobal.freeze ^ bglobal.changefreeze) + bglobal->changefreeze ^= 1; + if (bglobal->freeze ^ bglobal->changefreeze) { msg = "Freeze mode on"; } diff --git a/src/p_interaction.cpp b/src/p_interaction.cpp index 9da7f3dc2..18580b7e5 100644 --- a/src/p_interaction.cpp +++ b/src/p_interaction.cpp @@ -561,10 +561,10 @@ void AActor::Die (AActor *source, AActor *inflictor) player->respawn_time = level.time + TICRATE; //Added by MC: Respawn bots - if (bglobal.botnum && consoleplayer == Net_Arbitrator && !demoplayback) + if (bglobal->botnum && consoleplayer == Net_Arbitrator && !demoplayback) { 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. for (int i = 0; i < MAXPLAYERS; i++) diff --git a/src/p_map.cpp b/src/p_map.cpp index 3b571c477..c8a64c306 100644 --- a/src/p_map.cpp +++ b/src/p_map.cpp @@ -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 (tmsector != thing->Sector - && bglobal.IsDangerous (tmsector)) + && bglobal->IsDangerous (tmsector)) { thing->player->prev = thing->player->dest; thing->player->dest = NULL; diff --git a/src/p_mobj.cpp b/src/p_mobj.cpp index 9bf9f8533..d05352689 100644 --- a/src/p_mobj.cpp +++ b/src/p_mobj.cpp @@ -2558,7 +2558,7 @@ void AActor::Tick () } //Added by MC: Freeze mode. - if (bglobal.freeze && !(player && !player->isbot)) + if (bglobal->freeze && !(player && !player->isbot)) { 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)) { clock (BotSupportCycles); - bglobal.m_Thinking = true; + bglobal->m_Thinking = true; for (i = 0; i < MAXPLAYERS; i++) { if (!playeringame[i] || !players[i].isbot) @@ -2661,7 +2661,7 @@ void AActor::Tick () else if (flags & MF_SPECIAL) { //Item pickup time //clock (BotWTG); - bglobal.WhatToGet (players[i].mo, this); + bglobal->WhatToGet (players[i].mo, this); //unclock (BotWTG); BotWTG++; } @@ -2669,12 +2669,12 @@ void AActor::Tick () { if (!players[i].missile && (flags3 & MF3_WARNBOT)) { //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; } } } - bglobal.m_Thinking = false; + bglobal->m_Thinking = false; 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->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) actor->reactiontime = 0; diff --git a/src/p_saveg.cpp b/src/p_saveg.cpp index a18bdee8e..00990b41b 100644 --- a/src/p_saveg.cpp +++ b/src/p_saveg.cpp @@ -230,7 +230,7 @@ static void CopyPlayer (player_t *dst, player_t *src, const char *name) if (dst->isbot) { - botinfo_t *thebot = bglobal.botinfo; + botinfo_t *thebot = bglobal->botinfo; while (thebot && stricmp (name, thebot->name)) { thebot = thebot->next; @@ -239,8 +239,8 @@ static void CopyPlayer (player_t *dst, player_t *src, const char *name) { thebot->inuse = true; } - bglobal.botnum++; - bglobal.botingame[dst - players] = true; + bglobal->botnum++; + bglobal->botingame[dst - players] = true; } else { diff --git a/src/p_sight.cpp b/src/p_sight.cpp index 1db00c9e6..cc175a74d 100644 --- a/src/p_sight.cpp +++ b/src/p_sight.cpp @@ -496,7 +496,7 @@ sightcounts[0]++; // Cannot see an invisible object if ((flags & 1) == 0 && ((t2->renderflags & RF_INVISIBLE) || !t2->RenderStyle.IsVisible(t2->alpha))) { // 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; goto done; diff --git a/src/p_switch.cpp b/src/p_switch.cpp index f94b55305..150a38b74 100644 --- a/src/p_switch.cpp +++ b/src/p_switch.cpp @@ -370,7 +370,7 @@ FSwitchDef *ParseSwitchDef (FScanner &sc, bool ignoreBad) thisframe.Time = ((max - min + 1) << 16) | min; } else - { + { thisframe.Time = 0; // Shush, GCC. sc.ScriptError ("Must specify a duration for switch frame"); } diff --git a/src/p_tick.cpp b/src/p_tick.cpp index 3d6c3a20d..ed2e3e007 100644 --- a/src/p_tick.cpp +++ b/src/p_tick.cpp @@ -78,10 +78,10 @@ void P_Ticker (void) // [RH] Frozen mode is only changed every 4 tics, to make it work with A_Tracer(). if ((level.time & 3) == 0) { - if (bglobal.changefreeze) + if (bglobal->changefreeze) { - bglobal.freeze ^= 1; - bglobal.changefreeze = 0; + bglobal->freeze ^= 1; + 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. r_NoInterpolate = false; - if (!bglobal.freeze && !(level.flags & LEVEL_FROZEN)) + if (!bglobal->freeze && !(level.flags & LEVEL_FROZEN)) { P_ThinkParticles (); // [RH] make the particles think } @@ -110,14 +110,14 @@ void P_Ticker (void) for (i = 0; ifreeze && players[i].isbot)) P_PlayerThink (&players[i]); level.Tick (); // [RH] let the level tick DThinker::RunThinkers (); //if added by MC: Freeze mode. - if (!bglobal.freeze && !(level.flags & LEVEL_FROZEN)) + if (!bglobal->freeze && !(level.flags & LEVEL_FROZEN)) { P_UpdateSpecials (); P_RunEffects (); // [RH] Run particle effects diff --git a/src/sdl/i_main.cpp b/src/sdl/i_main.cpp index 336b303ce..73f38f830 100644 --- a/src/sdl/i_main.cpp +++ b/src/sdl/i_main.cpp @@ -132,6 +132,7 @@ void STACK_ARGS call_terms () static void FinalGC() { Args = NULL; + bglobal = NULL; GC::FullGC(); } diff --git a/src/wi_stuff.cpp b/src/wi_stuff.cpp index ae247ccb4..a69238670 100644 --- a/src/wi_stuff.cpp +++ b/src/wi_stuff.cpp @@ -1039,7 +1039,7 @@ void WI_End () //Added by mc if (deathmatch) { - bglobal.RemoveAllBots (consoleplayer != Net_Arbitrator); + bglobal->RemoveAllBots (consoleplayer != Net_Arbitrator); } }