Permalink
Browse files

- moved bglobal.freeze to FLevelLocals, because this flag has nothing…

… specific to do with bots as it freezes the entire level.
  • Loading branch information...
coelckers committed Jan 9, 2019
1 parent adeb8fb commit 4227b9020c630f7e8095d5a97bd4b12ddb8db87b
@@ -49,6 +49,7 @@
#include "d_player.h"
#include "w_wad.h"
#include "vm.h"
#include "g_levellocals.h"

IMPLEMENT_CLASS(DBot, false, true)

@@ -138,7 +139,7 @@ void DBot::Tick ()
{
Super::Tick ();

if (player->mo == nullptr || bglobal.freeze)
if (player->mo == nullptr || Level->freeze)
{
return;
}
@@ -116,7 +116,7 @@ class FCajunMaster
void ClearPlayer (int playernum, bool keepTeam);

//(b_game.cpp)
void Main ();
void Main (FLevelLocals *Level);
void Init ();
void End();
bool SpawnBot (const char *name, int color = NOCOLOR);
@@ -139,8 +139,6 @@ class FCajunMaster
bool IsDangerous (sector_t *sec);

TArray<FString> getspawned; //Array of bots (their names) which should be spawned when starting a game.
uint8_t freeze; //Game in freeze mode.
uint8_t changefreeze; //Game wants to change freeze mode.
int botnum;
botinfo_t *botinfo;
int spawn_tries;
@@ -1178,7 +1178,7 @@ void DDecalFader::Tick ()
}
else
{
if (Level->maptime < TimeToStartDecay || bglobal.freeze)
if (Level->maptime < TimeToStartDecay || Level->freeze)
{
return;
}
@@ -1265,7 +1265,7 @@ void DDecalStretcher::Tick ()
Destroy ();
return;
}
if (Level->maptime < TimeToStart || bglobal.freeze)
if (Level->maptime < TimeToStart || Level->freeze)
{
return;
}
@@ -1333,7 +1333,7 @@ void DDecalSlider::Tick ()
Destroy ();
return;
}
if (Level->maptime < TimeToStart || bglobal.freeze)
if (Level->maptime < TimeToStart || Level->freeze)
{
return;
}
@@ -1401,7 +1401,7 @@ void DDecalColorer::Tick ()
}
else
{
if (Level->maptime < TimeToStartDecay || bglobal.freeze)
if (Level->maptime < TimeToStartDecay || Level->freeze)
{
return;
}
@@ -2873,7 +2873,6 @@ DEFINE_GLOBAL(multiplayer)
DEFINE_GLOBAL(gameaction)
DEFINE_GLOBAL(gamestate)
DEFINE_GLOBAL(skyflatnum)
DEFINE_GLOBAL_NAMED(bglobal.freeze, globalfreeze)
DEFINE_GLOBAL(gametic)
DEFINE_GLOBAL(demoplayback)
DEFINE_GLOBAL(automapactive);
@@ -218,6 +218,10 @@ struct FLevelLocals : public FLevelData
int airsupply;
int DefaultEnvironment; // Default sound environment.

uint8_t freeze; //Game in freeze mode.
uint8_t changefreeze; //Game wants to change freeze mode.


TArray<DVector2> Scrolls; // NULL if no DScrollers in this level

int8_t WallVertLight; // Light diffs for vert/horiz walls
@@ -1198,7 +1198,7 @@ void GLSprite::ProcessParticle (HWDrawInfo *di, particle_t *particle, sector_t *

const auto &vp = di->Viewpoint;
double timefrac = vp.TicFrac;
if (paused || bglobal.freeze || (di->Level->flags2 & LEVEL2_FROZEN))
if (paused || Level->freeze || (di->Level->flags2 & LEVEL2_FROZEN))
timefrac = 0.;
float xvf = (particle->Vel.X) * timefrac;
float yvf = (particle->Vel.Y) * timefrac;
@@ -514,8 +514,10 @@ void cht_DoCheat (player_t *player, int cheat)
break;

case CHT_FREEZE:
bglobal.changefreeze ^= 1;
if (bglobal.freeze ^ bglobal.changefreeze)
{
auto Level = player->mo->Level;
Level->changefreeze ^= 1;
if (Level->freeze ^ Level->changefreeze)
{
msg = GStrings("TXT_FREEZEON");
}
@@ -525,6 +527,7 @@ void cht_DoCheat (player_t *player, int cheat)
}
break;
}
}

if (!*msg) // [SO] Don't print blank lines!
return;
@@ -243,7 +243,7 @@ void P_ThinkParticles ()
{
particle = &Particles[i];
i = particle->tnext;
if (!particle->notimefreeze && ((bglobal.freeze) || (level.flags2 & LEVEL2_FROZEN)))
if (!particle->notimefreeze && ((level.freeze) || (level.flags2 & LEVEL2_FROZEN)))
{
prev = particle;
continue;
@@ -3522,7 +3522,7 @@ void AActor::Tick ()
if (!(flags5 & MF5_NOTIMEFREEZE))
{
//Added by MC: Freeze mode.
if (bglobal.freeze || Level->flags2 & LEVEL2_FROZEN)
if (Level->freeze || Level->flags2 & LEVEL2_FROZEN)
{
// Boss cubes shouldn't be accelerated by timefreeze
if (flags6 & MF6_BOSSCUBE)
@@ -3577,7 +3577,7 @@ void AActor::Tick ()
special2++;
}
//Added by MC: Freeze mode.
if (bglobal.freeze && !(player && player->Bot == NULL))
if (Level->freeze && !(player && player->Bot == NULL))
{
return;
}
@@ -984,7 +984,9 @@ void G_SerializeLevel(FSerializer &arc, FLevelLocals *Level, bool hubload)
("spotstate", Level->SpotState)
("fragglethinker", Level->FraggleScriptThinker)
("acsthinker", Level->ACSThinker)
("impactdecalcount", Level->ImpactDecalCount);
("impactdecalcount", Level->ImpactDecalCount)
("freeze", Level->freeze)
("changefreeze", Level->changefreeze

// Hub transitions must keep the current total time
if (!hubload)
@@ -109,10 +109,10 @@ void FLevelLocals::Tick()
// [RH] Frozen mode is only changed every 4 tics, to make it work with A_Tracer().
if ((maptime & 3) == 0)
{
if (bglobal.changefreeze)
if (changefreeze)
{
bglobal.freeze ^= 1;
bglobal.changefreeze = 0;
freeze ^= 1;
changefreeze = 0;
}
}

@@ -136,7 +136,7 @@ void FLevelLocals::Tick()

for (int i = 0; i<MAXPLAYERS; i++)
if (playeringame[i] &&
/*Added by MC: Freeze mode.*/!(bglobal.freeze && players[i].Bot != NULL))
/*Added by MC: Freeze mode.*/!(freeze && players[i].Bot != NULL))
P_PlayerThink (&players[i]);

// [ZZ] call the WorldTick hook
@@ -151,7 +151,7 @@ void FLevelLocals::Tick()
DThinker::RunThinkers ();

//if added by MC: Freeze mode.
if (!bglobal.freeze && !(flags2 & LEVEL2_FROZEN))
if (!freeze && !(flags2 & LEVEL2_FROZEN))
{
P_UpdateSpecials (&level);
P_RunEffects (); // [RH] Run particle effects
@@ -35,7 +35,7 @@ EXTERN_CVAR(Int, gl_particles_style)
void RenderPolyParticle::Render(PolyRenderThread *thread, particle_t *particle, subsector_t *sub, uint32_t stencilValue)
{
double timefrac = r_viewpoint.TicFrac;
if (paused || bglobal.freeze || (PolyRenderer::Instance()->Level->flags2 & LEVEL2_FROZEN))
if (paused || PolyRenderer::Instance()->Level->freeze || (PolyRenderer::Instance()->Level->flags2 & LEVEL2_FROZEN))
timefrac = 0.;
DVector3 pos = particle->Pos + (particle->Vel * timefrac);
double psize = particle->size / 8.0;
@@ -2748,6 +2748,8 @@ DEFINE_FIELD(FLevelLocals, outsidefogdensity)
DEFINE_FIELD(FLevelLocals, skyfog)
DEFINE_FIELD(FLevelLocals, pixelstretch)
DEFINE_FIELD(FLevelLocals, deathsequence)
DEFINE_FIELD(FLevelLocals, freeze)

DEFINE_FIELD_BIT(FLevelLocals, flags, noinventorybar, LEVEL_NOINVENTORYBAR)
DEFINE_FIELD_BIT(FLevelLocals, flags, monsterstelefrag, LEVEL_MONSTERSTELEFRAG)
DEFINE_FIELD_BIT(FLevelLocals, flags, actownspecial, LEVEL_ACTOWNSPECIAL)
@@ -79,7 +79,7 @@ namespace swrenderer
sector_t* heightsec = NULL;

double timefrac = r_viewpoint.TicFrac;
if (paused || bglobal.freeze || (sector->Level->flags2 & LEVEL2_FROZEN))
if (paused || sector->Level->freeze || (sector->Level->flags2 & LEVEL2_FROZEN))
timefrac = 0.;

double ippx = particle->Pos.X + particle->Vel.X * timefrac;
@@ -20,7 +20,6 @@ struct _ native // These are the global variables, the struct is only here to av
native play uint gameaction;
native readonly int gamestate;
native readonly TextureID skyflatnum;
native readonly uint8 globalfreeze;
native readonly int consoleplayer;
native readonly Font smallfont;
native readonly Font smallfont2;
@@ -690,6 +689,7 @@ struct LevelLocals native
native readonly int skyfog;
native readonly float pixelstretch;
native name deathsequence;
native readonly uint8 globalfreeze;
// level_info_t *info cannot be done yet.

native String GetUDMFString(int type, int index, Name key);
@@ -53,7 +53,7 @@ class FastProjectile : Actor
if (!bNoTimeFreeze)
{
//Added by MC: Freeze mode.
if (globalfreeze || Level.Frozen)
if (Level.freeze || Level.Frozen)
{
return;
}

0 comments on commit 4227b90

Please sign in to comment.