mirror of
https://github.com/ZDoom/gzdoom.git
synced 2024-11-26 14:01:45 +00:00
- some progress.
This commit is contained in:
parent
f25397b391
commit
3b59afae31
27 changed files with 109 additions and 119 deletions
|
@ -3166,7 +3166,7 @@ void AM_drawMarks ()
|
|||
//
|
||||
//=============================================================================
|
||||
|
||||
void AM_drawAuthorMarkers ()
|
||||
void AM_drawAuthorMarkers (FLevelLocals *Level)
|
||||
{
|
||||
// [RH] Draw any actors derived from AMapMarker on the automap.
|
||||
// If args[0] is 0, then the actor's sprite is drawn at its own location.
|
||||
|
@ -3211,7 +3211,7 @@ void AM_drawAuthorMarkers ()
|
|||
tex = TexMan.GetTexture(picnum);
|
||||
}
|
||||
}
|
||||
FActorIterator it (&level, mark->args[0]);
|
||||
FActorIterator it (Level, mark->args[0]);
|
||||
AActor *marked = mark->args[0] == 0 ? mark : it.Next();
|
||||
|
||||
while (marked != NULL)
|
||||
|
@ -3293,7 +3293,7 @@ void AM_Drawer (FLevelLocals *Level, int bottom)
|
|||
if ((am_cheat >= 2 && am_cheat != 4) || allthings)
|
||||
AM_drawThings(Level);
|
||||
|
||||
AM_drawAuthorMarkers();
|
||||
AM_drawAuthorMarkers(Level);
|
||||
|
||||
if (!viewactive)
|
||||
AM_drawCrosshair(AMColors[AMColors.XHairColor]);
|
||||
|
|
|
@ -361,7 +361,7 @@ CCMD (changemap)
|
|||
if (argv.argc() > 1)
|
||||
{
|
||||
const char *mapname = argv[1];
|
||||
if (!strcmp(mapname, "*")) mapname = level.MapName.GetChars();
|
||||
if (!strcmp(mapname, "*") && currentSession) mapname = currentSession->Levelinfo[0]->MapName.GetChars();
|
||||
|
||||
try
|
||||
{
|
||||
|
|
|
@ -758,16 +758,16 @@ void D_Display ()
|
|||
viewsec = screen->RenderView(&players[consoleplayer]);
|
||||
screen->Begin2D();
|
||||
screen->DrawBlend(viewsec);
|
||||
if (automapactive)
|
||||
if (automapactive && currentSession)
|
||||
{
|
||||
AM_Drawer (&level, hud_althud? viewheight : StatusBar->GetTopOfStatusbar());
|
||||
AM_Drawer (currentSession->Levelinfo[0], hud_althud? viewheight : StatusBar->GetTopOfStatusbar());
|
||||
}
|
||||
|
||||
// for timing the statusbar code.
|
||||
//cycle_t stb;
|
||||
//stb.Reset();
|
||||
//stb.Clock();
|
||||
StatusBar->SetLevel(&level);
|
||||
StatusBar->SetLevel(currentSession->Levelinfo[0]);
|
||||
if (!automapactive || viewactive)
|
||||
{
|
||||
StatusBar->RefreshViewBorder ();
|
||||
|
|
|
@ -135,7 +135,7 @@ void FScriptLoader::ParseInfoCmd(char *line, FString &scriptsrc)
|
|||
sc.MustGetString();
|
||||
if (!FS_ChangeMusic(sc.String))
|
||||
{
|
||||
S_ChangeMusic(Level->Music, Level->musicorder);
|
||||
Level->SetMusic();
|
||||
}
|
||||
}
|
||||
else if (sc.Compare("skyname"))
|
||||
|
|
|
@ -759,7 +759,7 @@ void G_AddViewPitch (int look, bool mouse)
|
|||
return;
|
||||
}
|
||||
look = LookAdjust(look);
|
||||
if (!players[consoleplayer].mo->Level->IsFreelookAllowed())
|
||||
if (currentSession && !currentSession->Levelinfo[0]->IsFreelookAllowed())
|
||||
{
|
||||
LocalViewPitch = 0;
|
||||
}
|
||||
|
@ -1504,7 +1504,7 @@ void G_DeathMatchSpawnPlayer (FLevelLocals *Level, int playernum)
|
|||
//
|
||||
FPlayerStart *G_PickPlayerStart(FLevelLocals *Level, int playernum, int flags)
|
||||
{
|
||||
if (level.AllPlayerStarts.Size() == 0) // No starts to pick
|
||||
if (Level->AllPlayerStarts.Size() == 0) // No starts to pick
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
@ -1522,7 +1522,7 @@ FPlayerStart *G_PickPlayerStart(FLevelLocals *Level, int playernum, int flags)
|
|||
{
|
||||
if (G_CheckSpot(Level, playernum, &Level->AllPlayerStarts[i]))
|
||||
{
|
||||
good_starts.Push(&level.AllPlayerStarts[i]);
|
||||
good_starts.Push(&Level->AllPlayerStarts[i]);
|
||||
}
|
||||
}
|
||||
if (good_starts.Size() > 0)
|
||||
|
@ -1533,7 +1533,7 @@ FPlayerStart *G_PickPlayerStart(FLevelLocals *Level, int playernum, int flags)
|
|||
// Pick a spot at random, whether it's open or not.
|
||||
return &Level->AllPlayerStarts[pr_pspawn(Level->AllPlayerStarts.Size())];
|
||||
}
|
||||
return &level.playerstarts[playernum];
|
||||
return &Level->playerstarts[playernum];
|
||||
}
|
||||
|
||||
DEFINE_ACTION_FUNCTION(DObject, G_PickPlayerStart)
|
||||
|
@ -1541,7 +1541,7 @@ DEFINE_ACTION_FUNCTION(DObject, G_PickPlayerStart)
|
|||
PARAM_PROLOGUE;
|
||||
PARAM_INT(playernum);
|
||||
PARAM_INT(flags);
|
||||
auto ps = G_PickPlayerStart(&level, playernum, flags);
|
||||
auto ps = currentSession ? G_PickPlayerStart(currentSession->Levelinfo[0], playernum, flags) : nullptr;
|
||||
if (numret > 1)
|
||||
{
|
||||
ret[1].SetInt(ps? ps->angle : 0);
|
||||
|
@ -1561,7 +1561,7 @@ static void G_QueueBody (AActor *body)
|
|||
{
|
||||
auto Level = body->Level;
|
||||
// flush an old corpse if needed
|
||||
int modslot = level.bodyqueslot % FLevelLocals::BODYQUESIZE;
|
||||
int modslot = Level->bodyqueslot % FLevelLocals::BODYQUESIZE;
|
||||
Level->bodyqueslot = modslot + 1;
|
||||
|
||||
if (Level->bodyqueslot >= FLevelLocals::BODYQUESIZE && Level->bodyque[modslot] != NULL)
|
||||
|
|
|
@ -76,7 +76,7 @@ struct FHubInfo
|
|||
|
||||
static TArray<FHubInfo> hubdata;
|
||||
|
||||
void G_LeavingHub(int mode, cluster_info_t * cluster, wbstartstruct_t * wbs)
|
||||
void G_LeavingHub(int mode, cluster_info_t * cluster, wbstartstruct_t * wbs, FLevelLocals *Level)
|
||||
{
|
||||
unsigned int i, j;
|
||||
|
||||
|
@ -84,7 +84,7 @@ void G_LeavingHub(int mode, cluster_info_t * cluster, wbstartstruct_t * wbs)
|
|||
{
|
||||
for (i = 0; i < hubdata.Size(); i++)
|
||||
{
|
||||
if (hubdata[i].levelnum == level.levelnum)
|
||||
if (hubdata[i].levelnum == Level->levelnum)
|
||||
{
|
||||
hubdata[i] = *wbs;
|
||||
break;
|
||||
|
@ -95,13 +95,13 @@ void G_LeavingHub(int mode, cluster_info_t * cluster, wbstartstruct_t * wbs)
|
|||
hubdata[hubdata.Reserve(1)] = *wbs;
|
||||
}
|
||||
|
||||
hubdata[i].levelnum = level.levelnum;
|
||||
hubdata[i].levelnum = Level->levelnum;
|
||||
if (!multiplayer && !deathmatch)
|
||||
{
|
||||
// The player counters don't work in hubs
|
||||
hubdata[i].plyr[0].skills = level.killed_monsters;
|
||||
hubdata[i].plyr[0].sitems = level.found_items;
|
||||
hubdata[i].plyr[0].ssecret = level.found_secrets;
|
||||
hubdata[i].plyr[0].skills = Level->killed_monsters;
|
||||
hubdata[i].plyr[0].sitems = Level->found_items;
|
||||
hubdata[i].plyr[0].ssecret = Level->found_secrets;
|
||||
}
|
||||
|
||||
|
||||
|
@ -129,11 +129,11 @@ void G_LeavingHub(int mode, cluster_info_t * cluster, wbstartstruct_t * wbs)
|
|||
{
|
||||
if (cluster->flags & CLUSTER_LOOKUPNAME)
|
||||
{
|
||||
level.LevelName = GStrings(cluster->ClusterName);
|
||||
Level->LevelName = GStrings(cluster->ClusterName);
|
||||
}
|
||||
else
|
||||
{
|
||||
level.LevelName = cluster->ClusterName;
|
||||
Level->LevelName = cluster->ClusterName;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -4,9 +4,10 @@
|
|||
struct cluster_info_t;
|
||||
struct wbstartstruct_t;
|
||||
class FSerializer;
|
||||
struct FLevelLocals;
|
||||
|
||||
void G_SerializeHub (FSerializer &file);
|
||||
void G_LeavingHub(int mode, cluster_info_t * cluster, struct wbstartstruct_t * wbs);
|
||||
void G_LeavingHub(int mode, cluster_info_t * cluster, struct wbstartstruct_t * wbs, FLevelLocals *Level);
|
||||
|
||||
#endif
|
||||
|
||||
|
|
|
@ -887,7 +887,7 @@ void G_DoCompleted ()
|
|||
}
|
||||
|
||||
// Intermission stats for entire hubs
|
||||
G_LeavingHub(mode, thiscluster, &wminfo);
|
||||
G_LeavingHub(mode, thiscluster, &wminfo, &level);
|
||||
|
||||
for (i = 0; i < MAXPLAYERS; i++)
|
||||
{
|
||||
|
@ -1525,8 +1525,6 @@ void FLevelLocals::InitLevelLocals ()
|
|||
skytexture1 = TexMan.GetTextureID(info->SkyPic1, ETextureType::Wall, FTextureManager::TEXMAN_Overridable | FTextureManager::TEXMAN_ReturnFirst);
|
||||
skytexture2 = TexMan.GetTextureID(info->SkyPic2, ETextureType::Wall, FTextureManager::TEXMAN_Overridable | FTextureManager::TEXMAN_ReturnFirst);
|
||||
fadeto = info->fadeto;
|
||||
cdtrack = info->cdtrack;
|
||||
cdid = info->cdid;
|
||||
FromSnapshot = false;
|
||||
if (fadeto == 0)
|
||||
{
|
||||
|
@ -2190,6 +2188,11 @@ DEFINE_ACTION_FUNCTION(FLevelLocals, SetInterMusic)
|
|||
return 0;
|
||||
}
|
||||
|
||||
void FLevelLocals::SetMusic()
|
||||
{
|
||||
if (info->cdtrack == 0 || !S_ChangeCDMusic(info->cdtrack, info->cdid))
|
||||
S_ChangeMusic(Music, musicorder);
|
||||
}
|
||||
//==========================================================================
|
||||
//
|
||||
//
|
||||
|
|
|
@ -127,6 +127,7 @@ struct FLevelLocals : public FLevelData
|
|||
void Mark();
|
||||
void AddScroller(int secnum);
|
||||
void SetInterMusic(const char *nextmap);
|
||||
void SetMusic();
|
||||
void SetMusicVolume(float v);
|
||||
void ClearLevelData();
|
||||
void ClearPortals();
|
||||
|
@ -202,8 +203,7 @@ struct FLevelLocals : public FLevelData
|
|||
|
||||
FString Music;
|
||||
int musicorder;
|
||||
int cdtrack;
|
||||
unsigned int cdid;
|
||||
|
||||
FTextureID skytexture1;
|
||||
FTextureID skytexture2;
|
||||
|
||||
|
@ -411,7 +411,10 @@ inline bool line_t::hitSkyWall(AActor* mo) const
|
|||
template<class T>
|
||||
inline void ForAllLevels(T func)
|
||||
{
|
||||
func(&level);
|
||||
if (currentSession)
|
||||
{
|
||||
for (auto Level : currentSession->Levelinfo) func(Level);
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
|
@ -787,8 +787,7 @@ void DIntermissionController::Ticker ()
|
|||
switch (mGameState)
|
||||
{
|
||||
case FSTATE_InLevel:
|
||||
if (level.cdtrack == 0 || !S_ChangeCDMusic (level.cdtrack, level.cdid))
|
||||
S_ChangeMusic (level.Music, level.musicorder);
|
||||
currentSession->Levelinfo[0]->SetMusic();
|
||||
gamestate = GS_LEVEL;
|
||||
wipegamestate = GS_LEVEL;
|
||||
P_ResumeConversation ();
|
||||
|
|
|
@ -54,17 +54,17 @@ const int AAPreference = 16;
|
|||
#define D(x) do{}while(0)
|
||||
#endif
|
||||
|
||||
FNodeBuilder::FNodeBuilder(FLevel &level)
|
||||
: Level(level), GLNodes(false), SegsStuffed(0)
|
||||
FNodeBuilder::FNodeBuilder(FLevel &_level)
|
||||
: Level(_level), GLNodes(false), SegsStuffed(0)
|
||||
{
|
||||
VertexMap = NULL;
|
||||
OldVertexTable = NULL;
|
||||
}
|
||||
|
||||
FNodeBuilder::FNodeBuilder (FLevel &level,
|
||||
FNodeBuilder::FNodeBuilder (FLevel &_level,
|
||||
TArray<FPolyStart> &polyspots, TArray<FPolyStart> &anchors,
|
||||
bool makeGLNodes)
|
||||
: Level(level), GLNodes(makeGLNodes), SegsStuffed(0)
|
||||
: Level(_level), GLNodes(makeGLNodes), SegsStuffed(0)
|
||||
{
|
||||
VertexMap = new FVertexMap (*this, Level.MinX, Level.MinY, Level.MaxX, Level.MaxY);
|
||||
FindUsedVertices (Level.Vertices, Level.NumVertices);
|
||||
|
|
|
@ -228,13 +228,11 @@ public:
|
|||
fixed_t x, y;
|
||||
};
|
||||
|
||||
FNodeBuilder (FLevel &level);
|
||||
FNodeBuilder (FLevel &level,
|
||||
TArray<FPolyStart> &polyspots, TArray<FPolyStart> &anchors,
|
||||
bool makeGLNodes);
|
||||
FNodeBuilder (FLevel &_level);
|
||||
FNodeBuilder (FLevel &_level, TArray<FPolyStart> &polyspots, TArray<FPolyStart> &anchors, bool makeGLNodes);
|
||||
~FNodeBuilder ();
|
||||
|
||||
void Extract(FLevelLocals &level);
|
||||
void Extract(FLevelLocals &_level);
|
||||
const int *GetOldVertexTable();
|
||||
|
||||
// These are used for building sub-BSP trees for polyobjects.
|
||||
|
|
|
@ -3756,7 +3756,7 @@ int DLevelScript::DoSpawn (int type, const DVector3 &pos, int tid, DAngle angle,
|
|||
return 0;
|
||||
}
|
||||
|
||||
actor = Spawn (&level, info, pos, ALLOW_REPLACE);
|
||||
actor = Spawn (Level, info, pos, ALLOW_REPLACE);
|
||||
if (actor != NULL)
|
||||
{
|
||||
ActorFlags2 oldFlags2 = actor->flags2;
|
||||
|
@ -4101,7 +4101,6 @@ void DLevelScript::DoSetActorProperty (AActor *actor, int property, int value)
|
|||
{
|
||||
return;
|
||||
}
|
||||
auto Level = &level;
|
||||
switch (property)
|
||||
{
|
||||
case APROP_Health:
|
||||
|
@ -5309,7 +5308,6 @@ int DLevelScript::ScriptCall(AActor *activator, unsigned argc, int32_t *args)
|
|||
int DLevelScript::CallFunction(int argCount, int funcIndex, int32_t *args)
|
||||
{
|
||||
AActor *actor;
|
||||
auto Level = &level;
|
||||
switch(funcIndex)
|
||||
{
|
||||
case ACSF_GetLineUDMFInt:
|
||||
|
@ -5673,7 +5671,7 @@ int DLevelScript::CallFunction(int argCount, int funcIndex, int32_t *args)
|
|||
const char *seqname = Level->Behaviors.LookupString(args[1]);
|
||||
if (seqname != NULL)
|
||||
{
|
||||
FPolyObj *poly = PO_GetPolyobj(&level, args[0]);
|
||||
FPolyObj *poly = PO_GetPolyobj(Level, args[0]);
|
||||
if (poly != NULL)
|
||||
{
|
||||
SN_StartSequence(poly, seqname, 0);
|
||||
|
@ -5684,7 +5682,7 @@ int DLevelScript::CallFunction(int argCount, int funcIndex, int32_t *args)
|
|||
|
||||
case ACSF_GetPolyobjX:
|
||||
{
|
||||
FPolyObj *poly = PO_GetPolyobj(&level, args[0]);
|
||||
FPolyObj *poly = PO_GetPolyobj(Level, args[0]);
|
||||
if (poly != NULL)
|
||||
{
|
||||
return DoubleToACS(poly->StartSpot.pos.X);
|
||||
|
@ -5694,7 +5692,7 @@ int DLevelScript::CallFunction(int argCount, int funcIndex, int32_t *args)
|
|||
|
||||
case ACSF_GetPolyobjY:
|
||||
{
|
||||
FPolyObj *poly = PO_GetPolyobj(&level, args[0]);
|
||||
FPolyObj *poly = PO_GetPolyobj(Level, args[0]);
|
||||
if (poly != NULL)
|
||||
{
|
||||
return DoubleToACS(poly->StartSpot.pos.Y);
|
||||
|
@ -6836,7 +6834,7 @@ int DLevelScript::RunScript ()
|
|||
|
||||
case SCRIPT_PolyWait:
|
||||
// Wait for polyobj(s) to stop moving, then enter state running
|
||||
if (!PO_Busy (&level, statedata))
|
||||
if (!PO_Busy (Level, statedata))
|
||||
{
|
||||
state = SCRIPT_Running;
|
||||
}
|
||||
|
@ -6874,7 +6872,6 @@ int DLevelScript::RunScript ()
|
|||
const char *lookup;
|
||||
int optstart = -1;
|
||||
int temp;
|
||||
auto Level = &level;
|
||||
|
||||
while (state == SCRIPT_Running)
|
||||
{
|
||||
|
|
|
@ -181,7 +181,7 @@ void P_FindParticleSubsectors (FLevelLocals *Level)
|
|||
for (uint16_t i = Level->ActiveParticles; i != NO_PARTICLE; i = Level->Particles[i].tnext)
|
||||
{
|
||||
// Try to reuse the subsector from the last portal check, if still valid.
|
||||
if (Level->Particles[i].subsector == NULL) Level->Particles[i].subsector = R_PointInSubsector(&level, Level->Particles[i].Pos);
|
||||
if (Level->Particles[i].subsector == NULL) Level->Particles[i].subsector = R_PointInSubsector(Level, Level->Particles[i].Pos);
|
||||
int ssnum = Level->Particles[i].subsector->Index();
|
||||
Level->Particles[i].snext = Level->ParticlesInSubsec[ssnum];
|
||||
Level->ParticlesInSubsec[ssnum] = i;
|
||||
|
@ -258,7 +258,7 @@ void P_ThinkParticles (FLevelLocals *Level)
|
|||
}
|
||||
|
||||
// Handle crossing a line portal
|
||||
DVector2 newxy = P_GetOffsetPosition(&level, particle->Pos.X, particle->Pos.Y, particle->Vel.X, particle->Vel.Y);
|
||||
DVector2 newxy = P_GetOffsetPosition(Level, particle->Pos.X, particle->Pos.Y, particle->Vel.X, particle->Vel.Y);
|
||||
particle->Pos.X = newxy.X;
|
||||
particle->Pos.Y = newxy.Y;
|
||||
particle->Pos.Z += particle->Vel.Z;
|
||||
|
|
|
@ -2253,7 +2253,7 @@ FUNC(LS_Sector_SetCurrent)
|
|||
FUNC(LS_Sector_SetFriction)
|
||||
// Sector_SetFriction (tag, amount)
|
||||
{
|
||||
P_SetSectorFriction (&level, arg0, arg1, true);
|
||||
P_SetSectorFriction (Level, arg0, arg1, true);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -2312,7 +2312,7 @@ FUNC(LS_Scroll_Texture_Both)
|
|||
sidechoice = 0;
|
||||
}
|
||||
|
||||
SetWallScroller (&level, arg0, sidechoice, dx, dy, scw_all);
|
||||
SetWallScroller (Level, arg0, sidechoice, dx, dy, scw_all);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -2323,7 +2323,7 @@ FUNC(LS_Scroll_Wall)
|
|||
if (arg0 == 0)
|
||||
return false;
|
||||
|
||||
SetWallScroller (&level, arg0, !!arg3, arg1 / 65536., arg2 / 65536., EScrollPos(arg4));
|
||||
SetWallScroller (Level, arg0, !!arg3, arg1 / 65536., arg2 / 65536., EScrollPos(arg4));
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -2339,19 +2339,19 @@ FUNC(LS_Scroll_Floor)
|
|||
|
||||
if (arg3 == 0 || arg3 == 2)
|
||||
{
|
||||
SetScroller (&level, arg0, EScroll::sc_floor, -dx, dy);
|
||||
SetScroller (Level, arg0, EScroll::sc_floor, -dx, dy);
|
||||
}
|
||||
else
|
||||
{
|
||||
SetScroller (&level, arg0, EScroll::sc_floor, 0, 0);
|
||||
SetScroller (Level, arg0, EScroll::sc_floor, 0, 0);
|
||||
}
|
||||
if (arg3 > 0)
|
||||
{
|
||||
SetScroller (&level, arg0, EScroll::sc_carry, dx, dy);
|
||||
SetScroller (Level, arg0, EScroll::sc_carry, dx, dy);
|
||||
}
|
||||
else
|
||||
{
|
||||
SetScroller (&level, arg0, EScroll::sc_carry, 0, 0);
|
||||
SetScroller (Level, arg0, EScroll::sc_carry, 0, 0);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
@ -2362,7 +2362,7 @@ FUNC(LS_Scroll_Ceiling)
|
|||
double dx = arg1 / 32.;
|
||||
double dy = arg2 / 32.;
|
||||
|
||||
SetScroller (&level, arg0, EScroll::sc_ceiling, -dx, dy);
|
||||
SetScroller (Level, arg0, EScroll::sc_ceiling, -dx, dy);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -536,36 +536,6 @@ FSerializer &Serialize(FSerializer &arc, const char *key, zone_t &z, zone_t *def
|
|||
return Serialize(arc, key, z.Environment, nullptr);
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
//
|
||||
// ArchiveSounds
|
||||
//
|
||||
//==========================================================================
|
||||
|
||||
void P_SerializeSounds(FSerializer &arc)
|
||||
{
|
||||
S_SerializeSounds(arc, &level);
|
||||
const char *name = NULL;
|
||||
uint8_t order;
|
||||
float musvol = level.MusicVolume;
|
||||
|
||||
if (arc.isWriting())
|
||||
{
|
||||
order = S_GetMusic(&name);
|
||||
}
|
||||
arc.StringPtr("musicname", name)
|
||||
("musicorder", order)
|
||||
("musicvolume", musvol);
|
||||
|
||||
if (arc.isReading())
|
||||
{
|
||||
if (!S_ChangeMusic(name, order))
|
||||
if (level.cdtrack == 0 || !S_ChangeCDMusic(level.cdtrack, level.cdid))
|
||||
S_ChangeMusic(level.Music, level.musicorder);
|
||||
level.SetMusicVolume(musvol);
|
||||
}
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
//
|
||||
//
|
||||
|
@ -1020,7 +990,25 @@ void G_SerializeLevel(FSerializer &arc, FLevelLocals *Level, bool hubload)
|
|||
FRemapTable::StaticSerializeTranslations(arc);
|
||||
Level->canvasTextureInfo.Serialize(arc);
|
||||
P_SerializePlayers(Level, arc, hubload);
|
||||
P_SerializeSounds(arc);
|
||||
S_SerializeSounds(arc, Level);
|
||||
|
||||
// this must be part of the session, not the level!
|
||||
const char *name = NULL;
|
||||
uint8_t order;
|
||||
|
||||
if (arc.isWriting())
|
||||
{
|
||||
order = S_GetMusic(&name);
|
||||
}
|
||||
arc.StringPtr("musicname", name)
|
||||
("musicorder", order);
|
||||
|
||||
if (arc.isReading())
|
||||
{
|
||||
if (!S_ChangeMusic(name, order)) Level->SetMusic();
|
||||
level.SetMusicVolume(Level->MusicVolume);
|
||||
}
|
||||
|
||||
|
||||
if (arc.isReading())
|
||||
{
|
||||
|
|
|
@ -62,7 +62,7 @@ bool P_CheckTickerPaused ()
|
|||
&& players[consoleplayer].viewz != NO_VALUE
|
||||
&& wipegamestate == gamestate)
|
||||
{
|
||||
S_PauseSound (!(level.flags2 & LEVEL2_PAUSE_MUSIC_IN_MENUS), false);
|
||||
S_PauseSound (!currentSession || !(currentSession->Levelinfo[0]->flags2 & LEVEL2_PAUSE_MUSIC_IN_MENUS), false);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
@ -138,7 +138,7 @@ void P_Ticker (void)
|
|||
|
||||
// [ZZ] call the WorldTick hook
|
||||
E_WorldTick();
|
||||
StatusBar->SetLevel(players[consoleplayer].mo->Level);
|
||||
StatusBar->SetLevel(currentSession->Levelinfo[0]);
|
||||
StatusBar->CallTick (); // [RH] moved this here
|
||||
|
||||
ForAllLevels([](FLevelLocals *Level)
|
||||
|
|
|
@ -464,8 +464,7 @@ void S_Start (FLevelLocals *Level)
|
|||
}
|
||||
else if (!Level->IsReentering())
|
||||
{
|
||||
if (Level->cdtrack == 0 || !S_ChangeCDMusic (Level->cdtrack, Level->cdid))
|
||||
S_ChangeMusic (Level->Music, Level->musicorder);
|
||||
Level->SetMusic();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2592,13 +2591,14 @@ bool S_ChangeMusic (const char *musicname, int order, bool looping, bool force)
|
|||
return false;
|
||||
}
|
||||
|
||||
// allow specifying "*" as a placeholder to play the level's default music.
|
||||
// allow specifying "*" as a placeholder to play the current primary level's default music.
|
||||
if (musicname != NULL && !strcmp(musicname, "*"))
|
||||
{
|
||||
if (gamestate == GS_LEVEL || gamestate == GS_TITLELEVEL)
|
||||
if ((gamestate == GS_LEVEL || gamestate == GS_TITLELEVEL) && currentSession)
|
||||
{
|
||||
musicname = level.Music;
|
||||
order = level.musicorder;
|
||||
auto Level = currentSession->Levelinfo[0];
|
||||
musicname = Level->Music;
|
||||
order = Level->musicorder;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -2876,9 +2876,9 @@ CCMD (loopsound)
|
|||
{
|
||||
Printf("'%s' is not a sound\n", argv[1]);
|
||||
}
|
||||
else
|
||||
else if (currentSession)
|
||||
{
|
||||
AActor *icon = Spawn(&level, "SpeakerIcon", players[consoleplayer].mo->PosPlusZ(32.), ALLOW_REPLACE);
|
||||
AActor *icon = Spawn(currentSession->Levelinfo[0], "SpeakerIcon", players[consoleplayer].mo->PosPlusZ(32.), ALLOW_REPLACE);
|
||||
if (icon != NULL)
|
||||
{
|
||||
S_Sound(icon, CHAN_BODY | CHAN_LOOP, id, 1.f, ATTN_IDLE);
|
||||
|
@ -2954,7 +2954,7 @@ CCMD (changemus)
|
|||
delete PlayList;
|
||||
PlayList = NULL;
|
||||
}
|
||||
S_ChangeMusic (argv[1], argv.argc() > 2 ? atoi (argv[2]) : 0);
|
||||
S_ChangeMusic (argv[1], argv.argc() > 2 ? atoi (argv[2]) : 0);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -5195,8 +5195,6 @@ DEFINE_ACTION_FUNCTION_NATIVE(DObject, BuiltinNew, BuiltinNew)
|
|||
|
||||
ExpEmit FxNew::Emit(VMFunctionBuilder *build)
|
||||
{
|
||||
ExpEmit from = val->Emit(build);
|
||||
from.Free(build);
|
||||
ExpEmit to(build, REGT_POINTER);
|
||||
|
||||
// Call DecoRandom to generate a random number.
|
||||
|
@ -5209,14 +5207,14 @@ ExpEmit FxNew::Emit(VMFunctionBuilder *build)
|
|||
FunctionCallEmitter emitters(callfunc);
|
||||
|
||||
int outerside = -1;
|
||||
if (!from.Konst)
|
||||
if (!val->isConstant())
|
||||
{
|
||||
int outerside = FScopeBarrier::SideFromFlags(CallingFunction->Variants[0].Flags);
|
||||
if (outerside == FScopeBarrier::Side_Virtual)
|
||||
outerside = FScopeBarrier::SideFromObjectFlags(CallingFunction->OwningClass->ScopeFlags);
|
||||
}
|
||||
emitters.AddParameter(from, false);
|
||||
emitters.AddParameterIntConst(outerside);
|
||||
emitters.AddParameter(build, val);
|
||||
emitters.AddParameterIntConst(outerside + 1);
|
||||
emitters.AddParameterIntConst(1); // Todo: 1 only if version < 4.0.0
|
||||
emitters.AddReturn(REGT_POINTER);
|
||||
return emitters.EmitCall(build);
|
||||
|
|
|
@ -974,7 +974,7 @@ void FunctionCallEmitter::AddParameter(ExpEmit &emit, bool reference)
|
|||
}
|
||||
emitters.push_back([=](VMFunctionBuilder *build) ->int
|
||||
{
|
||||
build->Emit(OP_PARAM, emit.RegType + (reference * REGT_ADDROF), emit.RegNum);
|
||||
build->Emit(OP_PARAM, emit.RegType + (reference * REGT_ADDROF) + (emit.Konst * REGT_KONST), emit.RegNum);
|
||||
auto op = emit;
|
||||
op.Free(build);
|
||||
return emit.RegCount;
|
||||
|
|
|
@ -489,8 +489,11 @@ static bool Cht_ChangeStartSpot (cheatseq_t *cheat)
|
|||
{
|
||||
char cmd[64];
|
||||
|
||||
mysnprintf (cmd, countof(cmd), "changemap %s %c", level.MapName.GetChars(), cheat->Args[0]);
|
||||
C_DoCommand (cmd);
|
||||
if (currentSession)
|
||||
{
|
||||
mysnprintf(cmd, countof(cmd), "changemap %s %c", currentSession->Levelinfo[0]->MapName.GetChars(), cheat->Args[0]);
|
||||
C_DoCommand(cmd);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -577,7 +577,7 @@ FString GetStatString()
|
|||
|
||||
CCMD(printstats)
|
||||
{
|
||||
StoreLevelStats(&level); // Refresh the current level's results.
|
||||
if (currentSession) StoreLevelStats(currentSession->Levelinfo[0]); // Refresh the current level's results.
|
||||
Printf("%s", GetStatString().GetChars());
|
||||
}
|
||||
|
||||
|
@ -596,6 +596,6 @@ CCMD(finishgame)
|
|||
|
||||
ADD_STAT(statistics)
|
||||
{
|
||||
StoreLevelStats(&level); // Refresh the current level's results.
|
||||
if (currentSession) StoreLevelStats(currentSession->Levelinfo[0]); // Refresh the current level's results.
|
||||
return GetStatString();
|
||||
}
|
||||
|
|
|
@ -586,7 +586,7 @@ class Actor : Thinker native
|
|||
native void ChangeTid(int newtid);
|
||||
deprecated("3.8") static int FindUniqueTid(int start = 0, int limit = 0)
|
||||
{
|
||||
return level.FindUniqueTid(start, limit);
|
||||
return currentSession.LevelInfo[0].FindUniqueTid(start, limit);
|
||||
}
|
||||
native void SetShade(color col);
|
||||
native clearscope int GetRenderStyle() const;
|
||||
|
@ -643,7 +643,7 @@ class Actor : Thinker native
|
|||
// Since this depends on the global level variable it should not be used any longer because this may block compatibility with future features.
|
||||
deprecated("3.8") static Actor Spawn(class<Actor> type, vector3 pos = (0,0,0), int replace = NO_REPLACE)
|
||||
{
|
||||
return level.Spawn(type, pos, replace);
|
||||
return currentSession.LevelInfo[0].Spawn(type, pos, replace);
|
||||
}
|
||||
|
||||
// Helper so that not all old code needs to be changed for the above deprecation.
|
||||
|
|
|
@ -668,8 +668,8 @@ struct LevelLocals native
|
|||
native String NextMap;
|
||||
native String NextSecretMap;
|
||||
native readonly int maptype;
|
||||
deprecated("3.8") native readonly String Music;
|
||||
deprecated("3.8") native readonly int musicorder;
|
||||
native readonly String Music;
|
||||
native readonly int musicorder;
|
||||
native readonly TextureID skytexture1;
|
||||
native readonly TextureID skytexture2;
|
||||
native float skyspeed1;
|
||||
|
|
|
@ -2,7 +2,7 @@ struct HealthGroup native play
|
|||
{
|
||||
deprecated("3.8") static clearscope HealthGroup Find(int id)
|
||||
{
|
||||
return level.FindHealthGroup(id);
|
||||
return currentSession.LevelInfo[0].FindHealthGroup(id);
|
||||
}
|
||||
|
||||
readonly int id;
|
||||
|
|
|
@ -372,7 +372,7 @@ struct Sector native play
|
|||
native void RemoveForceField();
|
||||
deprecated("3.8") static clearscope Sector PointInSector(Vector2 pt)
|
||||
{
|
||||
return level.PointInSector(pt);
|
||||
return currentSession.LevelInfo[0].PointInSector(pt);
|
||||
}
|
||||
|
||||
native bool PlaneMoving(int pos);
|
||||
|
@ -536,7 +536,7 @@ class SectorTagIterator : Object native
|
|||
{
|
||||
deprecated("3.8") static SectorTagIterator Create(int tag, line defline = null)
|
||||
{
|
||||
return level.CreateSectorTagIterator(tag, defline);
|
||||
return currentSession.LevelInfo[0].CreateSectorTagIterator(tag, defline);
|
||||
}
|
||||
native int Next();
|
||||
native int NextCompat(bool compat, int secnum);
|
||||
|
@ -546,7 +546,7 @@ class LineIdIterator : Object native
|
|||
{
|
||||
deprecated("3.8") static LineIdIterator Create(int tag)
|
||||
{
|
||||
return level.CreateLineIdIterator(tag);
|
||||
return currentSession.LevelInfo[0].CreateLineIdIterator(tag);
|
||||
}
|
||||
native int Next();
|
||||
}
|
||||
|
|
|
@ -2,7 +2,7 @@ class SpotState : Object native
|
|||
{
|
||||
deprecated ("3.8") static SpotState GetSpotState(bool create = true)
|
||||
{
|
||||
return level.GetSpotState(create);
|
||||
return currentSession.LevelInfo[0].GetSpotState(create);
|
||||
}
|
||||
native SpecialSpot GetNextInList(class<Actor> type, int skipcounter);
|
||||
native SpecialSpot GetSpotWithMinMaxDistance(Class<Actor> type, double x, double y, double mindist, double maxdist);
|
||||
|
|
Loading…
Reference in a new issue