diff --git a/src/g_level.cpp b/src/g_level.cpp index 0345fd449..7b41cbd26 100644 --- a/src/g_level.cpp +++ b/src/g_level.cpp @@ -947,7 +947,7 @@ void G_DoLoadLevel (int position, bool autosave, bool newGame) else lastposition = position; - G_InitLevelLocals (); + level.Init(); StatusBar->DetachAllMessages (); // Force 'teamplay' to 'true' if need be. @@ -1450,95 +1450,95 @@ int G_FinishTravel () // //========================================================================== -void G_InitLevelLocals () +void FLevelLocals::Init() { level_info_t *info; BaseBlendA = 0.0f; // Remove underwater blend effect, if any - level.gravity = sv_gravity * 35/TICRATE; - level.aircontrol = sv_aircontrol; - level.teamdamage = teamdamage; - level.flags = 0; - level.flags2 = 0; - level.flags3 = 0; + gravity = sv_gravity * 35/TICRATE; + aircontrol = sv_aircontrol; + teamdamage = teamdamage; + flags = 0; + flags2 = 0; + flags3 = 0; - info = FindLevelInfo (level.MapName); + info = FindLevelInfo (MapName); - level.info = info; - level.skyspeed1 = info->skyspeed1; - level.skyspeed2 = info->skyspeed2; - level.skytexture1 = TexMan.GetTextureID(info->SkyPic1, ETextureType::Wall, FTextureManager::TEXMAN_Overridable | FTextureManager::TEXMAN_ReturnFirst); - level.skytexture2 = TexMan.GetTextureID(info->SkyPic2, ETextureType::Wall, FTextureManager::TEXMAN_Overridable | FTextureManager::TEXMAN_ReturnFirst); - level.fadeto = info->fadeto; - level.cdtrack = info->cdtrack; - level.cdid = info->cdid; - level.FromSnapshot = false; - if (level.fadeto == 0) + info = info; + skyspeed1 = info->skyspeed1; + skyspeed2 = info->skyspeed2; + 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) { if (strnicmp (info->FadeTable, "COLORMAP", 8) != 0) { - level.flags |= LEVEL_HASFADETABLE; + flags |= LEVEL_HASFADETABLE; } } - level.airsupply = info->airsupply*TICRATE; - level.outsidefog = info->outsidefog; - level.WallVertLight = info->WallVertLight*2; - level.WallHorizLight = info->WallHorizLight*2; + airsupply = info->airsupply*TICRATE; + outsidefog = info->outsidefog; + WallVertLight = info->WallVertLight*2; + WallHorizLight = info->WallHorizLight*2; if (info->gravity != 0.f) { - level.gravity = info->gravity * 35/TICRATE; + gravity = info->gravity * 35/TICRATE; } if (info->aircontrol != 0.f) { - level.aircontrol = info->aircontrol; + aircontrol = info->aircontrol; } if (info->teamdamage != 0.f) { - level.teamdamage = info->teamdamage; + teamdamage = info->teamdamage; } G_AirControlChanged (); cluster_info_t *clus = FindClusterInfo (info->cluster); - level.partime = info->partime; - level.sucktime = info->sucktime; - level.cluster = info->cluster; - level.clusterflags = clus ? clus->flags : 0; - level.flags |= info->flags; - level.flags2 |= info->flags2; - level.flags3 |= info->flags3; - level.levelnum = info->levelnum; - level.Music = info->Music; - level.musicorder = info->musicorder; - level.MusicVolume = 1.f; - level.HasHeightSecs = false; + partime = info->partime; + sucktime = info->sucktime; + cluster = info->cluster; + clusterflags = clus ? clus->flags : 0; + flags |= info->flags; + flags2 |= info->flags2; + flags3 |= info->flags3; + levelnum = info->levelnum; + Music = info->Music; + musicorder = info->musicorder; + MusicVolume = 1.f; + HasHeightSecs = false; - level.LevelName = level.info->LookupLevelName(); - level.NextMap = info->NextMap; - level.NextSecretMap = info->NextSecretMap; - level.F1Pic = info->F1Pic; - level.hazardcolor = info->hazardcolor; - level.hazardflash = info->hazardflash; + LevelName = info->LookupLevelName(); + NextMap = info->NextMap; + NextSecretMap = info->NextSecretMap; + F1Pic = info->F1Pic; + hazardcolor = info->hazardcolor; + hazardflash = info->hazardflash; // GL fog stuff modifiable by SetGlobalFogParameter. - level.fogdensity = info->fogdensity; - level.outsidefogdensity = info->outsidefogdensity; - level.skyfog = info->skyfog; - level.deathsequence = info->deathsequence; + fogdensity = info->fogdensity; + outsidefogdensity = info->outsidefogdensity; + skyfog = info->skyfog; + deathsequence = info->deathsequence; - level.pixelstretch = info->pixelstretch; + pixelstretch = info->pixelstretch; compatflags.Callback(); compatflags2.Callback(); - level.DefaultEnvironment = info->DefaultEnvironment; + DefaultEnvironment = info->DefaultEnvironment; - level.lightMode = info->lightmode == ELightMode::NotSet? (ELightMode)*gl_lightmode : info->lightmode; - level.brightfog = info->brightfog < 0? gl_brightfog : !!info->brightfog; - level.lightadditivesurfaces = info->lightadditivesurfaces < 0 ? gl_lightadditivesurfaces : !!info->lightadditivesurfaces; - level.notexturefill = info->notexturefill < 0 ? gl_notexturefill : !!info->notexturefill; + lightMode = info->lightmode == ELightMode::NotSet? (ELightMode)*gl_lightmode : info->lightmode; + brightfog = info->brightfog < 0? gl_brightfog : !!info->brightfog; + lightadditivesurfaces = info->lightadditivesurfaces < 0 ? gl_lightadditivesurfaces : !!info->lightadditivesurfaces; + notexturefill = info->notexturefill < 0 ? gl_notexturefill : !!info->notexturefill; FLightDefaults::SetAttenuationForLevel(); } diff --git a/src/g_level.h b/src/g_level.h index 1cbd0f463..4c7a91dc1 100644 --- a/src/g_level.h +++ b/src/g_level.h @@ -477,8 +477,6 @@ int G_FinishTravel (); void G_DoLoadLevel (int position, bool autosave, bool newGame); -void G_InitLevelLocals (void); - void G_AirControlChanged (); cluster_info_t *FindClusterInfo (int cluster); diff --git a/src/g_levellocals.h b/src/g_levellocals.h index 3fb9b3d12..63c6be177 100644 --- a/src/g_levellocals.h +++ b/src/g_levellocals.h @@ -171,6 +171,7 @@ struct FLevelLocals : public FLevelData int GetConversation(FName classname); void SetConversation(int convid, PClassActor *Class, int dlgindex); int FindNode (const FStrifeDialogueNode *node); + void Init(); private: line_t *FindPortalDestination(line_t *src, int tag);