Permalink
Browse files

and more

  • Loading branch information...
coelckers committed Jan 11, 2019
1 parent 67326e0 commit b7112a270644328711c4e7ce893fb70022c09cdd
Showing with 85 additions and 85 deletions.
  1. +14 −12 src/g_level.cpp
  2. +1 −1 src/g_levellocals.h
  3. +1 −1 src/hwrenderer/dynlights/hw_shadowmap.h
  4. +60 −59 src/p_acs.cpp
  5. +2 −2 src/p_lnspec.cpp
  6. +1 −1 src/p_user.cpp
  7. +1 −1 src/s_sound.cpp
  8. +1 −1 src/s_sound.h
  9. +1 −1 src/statistics.cpp
  10. +3 −6 src/wi_stuff.cpp
@@ -149,7 +149,6 @@ CUSTOM_CVAR(Int, gl_lightmode, 3, CVAR_ARCHIVE | CVAR_NOINITCALL)

static FRandom pr_classchoice ("RandomPlayerClassChoice");

extern level_info_t TheDefaultLevelInfo;
extern bool timingdemo;

// Start time for timing demos
@@ -371,17 +370,20 @@ void G_NewInit ()
{
int i;

// Destory all old player refrences that may still exist
TThinkerIterator<AActor> it(currentSession->Levelinfo[0], NAME_PlayerPawn, STAT_TRAVELLING);
AActor *pawn, *next;

next = it.Next();
while ((pawn = next) != NULL)
ForAllLevels([](FLevelLocals *Level)
{
// Destory all old player refrences that may still exist
TThinkerIterator<AActor> it(Level, NAME_PlayerPawn, STAT_TRAVELLING);
AActor *pawn, *next;

next = it.Next();
pawn->flags |= MF_NOSECTOR | MF_NOBLOCKMAP;
pawn->Destroy();
}
while ((pawn = next) != NULL)
{
next = it.Next();
pawn->flags |= MF_NOSECTOR | MF_NOBLOCKMAP;
pawn->Destroy();
}
});

G_ClearSnapshots ();
netgame = false;
@@ -750,13 +752,13 @@ const char *G_GetSecretExitMap(FLevelLocals *Level)
void G_ExitLevel (FLevelLocals *Level, int position, bool keepFacing)
{
Level->flags3 |= LEVEL3_EXITNORMALUSED;
G_ChangeLevel(Level, G_GetExitMap(Level), position, keepFacing ? CHANGELEVEL_KEEPFACING : 0);
G_ChangeLevel(Level, G_GetExitMap(Level), position, keepFacing ? CHANGELEVEL_KEEPFACING : 0, -1);
}

void G_SecretExitLevel (FLevelLocals *Level, int position)
{
Level->flags3 |= LEVEL3_EXITSECRETUSED;
G_ChangeLevel(Level, G_GetSecretExitMap(Level), position, 0);
G_ChangeLevel(Level, G_GetSecretExitMap(Level), position, 0, -1);
}

//==========================================================================
@@ -311,7 +311,7 @@ class FGameSession
TArray<FLevelLocals *> Levelinfo;

TMap<FName, FCompressedBuffer> Snapshots;
TMap<FName, acsdefered_t> DeferredScripts;
TMap<FName, TArray<acsdefered_t>> DeferredScripts;
TMap<FName, bool> Visited;

FString F1Pic;
@@ -46,7 +46,7 @@ class IShadowMap
TArray<float> mLights;

// Used to detect when a level change requires the AABB tree to be regenerated
level_info_t *mLastLevel = nullptr;
const level_info_t *mLastLevel = nullptr;
unsigned mLastNumNodes = 0;
unsigned mLastNumSegs = 0;

@@ -9927,7 +9927,7 @@ int DLevelScript::RunScript ()

case PCD_CHANGELEVEL:
{
G_ChangeLevel(Level->Behaviors.LookupString(STACK(4)), STACK(3), STACK(2), STACK(1));
G_ChangeLevel(Level, Level->Behaviors.LookupString(STACK(4)), STACK(3), STACK(2), STACK(1));
sp -= 4;
}
break;
@@ -10320,70 +10320,73 @@ void P_DoDeferedScripts (FLevelLocals *Level)
FBehavior *module;

// Handle defered scripts in this step, too
for(int i = Level->info->deferred.Size()-1; i>=0; i--)
auto deferred = currentSession->DeferredScripts.CheckKey(Level->MapName);
if (deferred)
{
acsdefered_t *def = &Level->info->deferred[i];
switch (def->type)
for(int i = deferred->Size()-1; i>=0; i--)
{
case acsdefered_t::defexecute:
case acsdefered_t::defexealways:
scriptdata = Level->Behaviors.FindScript (def->script, module);
if (scriptdata)
acsdefered_t *def = &(*deferred)[i];
switch (def->type)
{
P_GetScriptGoing (Level, (unsigned)def->playernum < MAXPLAYERS &&
playeringame[def->playernum] ? players[def->playernum].mo : NULL,
NULL, def->script,
scriptdata, module,
def->args, 3,
def->type == acsdefered_t::defexealways ? ACS_ALWAYS : 0);
}
else
{
Printf ("P_DoDeferredScripts: Unknown %s\n", ScriptPresentation(def->script).GetChars());
case acsdefered_t::defexecute:
case acsdefered_t::defexealways:
scriptdata = Level->Behaviors.FindScript (def->script, module);
if (scriptdata)
{
P_GetScriptGoing (Level, (unsigned)def->playernum < MAXPLAYERS &&
playeringame[def->playernum] ? players[def->playernum].mo : NULL,
NULL, def->script,
scriptdata, module,
def->args, 3,
def->type == acsdefered_t::defexealways ? ACS_ALWAYS : 0);
}
else
{
Printf ("P_DoDeferredScripts: Unknown %s\n", ScriptPresentation(def->script).GetChars());
}
break;

case acsdefered_t::defsuspend:
SetScriptState (Level->ACSThinker, def->script, DLevelScript::SCRIPT_Suspended);
DPrintf (DMSG_SPAMMY, "Deferred suspend of %s\n", ScriptPresentation(def->script).GetChars());
break;

case acsdefered_t::defterminate:
SetScriptState (Level->ACSThinker, def->script, DLevelScript::SCRIPT_PleaseRemove);
DPrintf (DMSG_SPAMMY, "Deferred terminate of %s\n", ScriptPresentation(def->script).GetChars());
break;
}
break;

case acsdefered_t::defsuspend:
SetScriptState (Level->ACSThinker, def->script, DLevelScript::SCRIPT_Suspended);
DPrintf (DMSG_SPAMMY, "Deferred suspend of %s\n", ScriptPresentation(def->script).GetChars());
break;

case acsdefered_t::defterminate:
SetScriptState (Level->ACSThinker, def->script, DLevelScript::SCRIPT_PleaseRemove);
DPrintf (DMSG_SPAMMY, "Deferred terminate of %s\n", ScriptPresentation(def->script).GetChars());
break;
}
}
Level->info->deferred.Clear();
currentSession->DeferredScripts.Remove(Level->MapName);
}

static void addDefered (level_info_t *i, acsdefered_t::EType type, int script, const int *args, int argcount, AActor *who)
static void addDefered (FLevelLocals *Level, acsdefered_t::EType type, int script, const int *args, int argcount, AActor *who)
{
if (i)
auto &deferred = currentSession->DeferredScripts[Level->MapName];

acsdefered_t &def = deferred[deferred.Reserve(1)];
int j;

def.type = type;
def.script = script;
for (j = 0; (size_t)j < countof(def.args) && j < argcount; ++j)
{
acsdefered_t &def = i->deferred[i->deferred.Reserve(1)];
int j;

def.type = type;
def.script = script;
for (j = 0; (size_t)j < countof(def.args) && j < argcount; ++j)
{
def.args[j] = args[j];
}
while ((size_t)j < countof(def.args))
{
def.args[j++] = 0;
}
if (who != NULL && who->player != NULL)
{
def.playernum = int(who->player - players);
}
else
{
def.playernum = -1;
}
DPrintf (DMSG_SPAMMY, "%s on map %s deferred\n", ScriptPresentation(script).GetChars(), i->MapName.GetChars());
def.args[j] = args[j];
}
while ((size_t)j < countof(def.args))
{
def.args[j++] = 0;
}
if (who != NULL && who->player != NULL)
{
def.playernum = int(who->player - players);
}
else
{
def.playernum = -1;
}
DPrintf (DMSG_SPAMMY, "%s on map %s deferred\n", ScriptPresentation(script).GetChars(), Level->MapName.GetChars());
}

EXTERN_CVAR (Bool, sv_cheats)
@@ -10435,9 +10438,7 @@ int P_StartScript (FLevelLocals *Level, AActor *who, line_t *where, int script,
}
else
{
addDefered (FindLevelInfo (map),
(flags & ACS_ALWAYS) ? acsdefered_t::defexealways : acsdefered_t::defexecute,
script, args, argcount, who);
addDefered (Level, (flags & ACS_ALWAYS) ? acsdefered_t::defexealways : acsdefered_t::defexecute, script, args, argcount, who);
return true;
}
return false;
@@ -10446,15 +10447,15 @@ int P_StartScript (FLevelLocals *Level, AActor *who, line_t *where, int script,
void P_SuspendScript (FLevelLocals *Level, int script, const char *map)
{
if (strnicmp (Level->MapName, map, 8))
addDefered (FindLevelInfo (map), acsdefered_t::defsuspend, script, NULL, 0, NULL);
addDefered (Level, acsdefered_t::defsuspend, script, NULL, 0, NULL);
else
SetScriptState (Level->ACSThinker, script, DLevelScript::SCRIPT_Suspended);
}

void P_TerminateScript (FLevelLocals *Level, int script, const char *map)
{
if (strnicmp (Level->MapName, map, 8))
addDefered (FindLevelInfo (map), acsdefered_t::defterminate, script, NULL, 0, NULL);
addDefered (Level, acsdefered_t::defterminate, script, NULL, 0, NULL);
else
SetScriptState (Level->ACSThinker, script, DLevelScript::SCRIPT_PleaseRemove);
}
@@ -1182,9 +1182,9 @@ FUNC(LS_TeleportInSector)
FUNC(LS_Teleport_EndGame)
// Teleport_EndGame ()
{
if (!backSide && Level->CheckIfExitIsGood (it, NULL))
if (!backSide && Level->CheckIfExitIsGood (it, nullptr))
{
G_ChangeLevel(NULL, 0, 0);
G_ChangeLevel(Level, nullptr, 0, 0);
return true;
}
return false;
@@ -1116,7 +1116,7 @@ void P_CheckMusicChange(player_t *player)
if (player->MUSINFOactor->args[0] != 0)
{
auto Level = player->mo->Level;
FName *music = Level->info->MusicMap.CheckKey(player->MUSINFOactor->args[0]);
const FName *music = Level->info->MusicMap.CheckKey(player->MUSINFOactor->args[0]);

if (music != NULL)
{
@@ -476,7 +476,7 @@ void S_Start (FLevelLocals *Level)
//
//==========================================================================

void S_PrecacheLevel (TArray<int> &levelsounds)
void S_PrecacheLevel (const TArray<int> &levelsounds)
{
unsigned int i;

@@ -218,7 +218,7 @@ void S_Shutdown ();
void S_Start (FLevelLocals *Level);

// Called after a level is loaded. Ensures that most sounds are loaded.
void S_PrecacheLevel (TArray<int> &levelsounds);
void S_PrecacheLevel (const TArray<int> &levelsounds);

// Loads a sound, including any random sounds it might reference.
void S_CacheSound (sfxinfo_t *sfx);
@@ -437,7 +437,7 @@ void STAT_ChangeLevel(const char *newl, FLevelLocals *Level)
// record the current level's stats.
StoreLevelStats(Level);

level_info_t *thisinfo = Level->info;
const level_info_t *thisinfo = Level->info;
level_info_t *nextinfo = NULL;

if (strncmp(newl, "enDSeQ", 6))
@@ -620,13 +620,11 @@ void DInterBackground::drawBackground(int state, bool drawsplat, bool snl_pointe
switch (a->type & ANIM_CONDITION)
{
case ANIM_IFVISITED:
li = FindLevelInfo(a->LevelName);
if (li == NULL || !(li->flags & LEVEL_VISITED)) continue;
if (!currentSession->Visited.CheckKey(a->LevelName)) continue;
break;

case ANIM_IFNOTVISITED:
li = FindLevelInfo(a->LevelName);
if (li == NULL || (li->flags & LEVEL_VISITED)) continue;
if (currentSession->Visited.CheckKey(a->LevelName)) continue;
break;

// StatCount means 'leaving' - everything else means 'entering'!
@@ -663,8 +661,7 @@ void DInterBackground::drawBackground(int state, bool drawsplat, bool snl_pointe
{
for (i = 0; i<lnodes.Size(); i++)
{
level_info_t * li = FindLevelInfo(lnodes[i].Level);
if (li && li->flags & LEVEL_VISITED) drawOnLnode(i, &splat, 1); // draw a splat on taken cities.
if (currentSession->Visited.CheckKey(lnodes[i].Level)) drawOnLnode(i, &splat, 1); // draw a splat on taken cities.
}
}

0 comments on commit b7112a2

Please sign in to comment.