diff --git a/src/actorinlines.h b/src/actorinlines.h index a253ecc7f3..abc17e1b30 100644 --- a/src/actorinlines.h +++ b/src/actorinlines.h @@ -26,12 +26,6 @@ inline DVector3 AActor::PosRelative(const line_t *line) const return Pos() + Level->Displacements.getOffset(Sector->PortalGroup, line->frontsector->PortalGroup); } -inline DVector3 PosRelative(const DVector3 &pos, line_t *line, sector_t *refsec = NULL) -{ - return pos + level.Displacements.getOffset(refsec->PortalGroup, line->frontsector->PortalGroup); -} - - inline void AActor::ClearInterpolation() { Prev = Pos(); diff --git a/src/g_levellocals.h b/src/g_levellocals.h index fcf92642eb..3eb3c810eb 100644 --- a/src/g_levellocals.h +++ b/src/g_levellocals.h @@ -261,6 +261,7 @@ public: void SpawnExtraPlayers(); void Serialize(FSerializer &arc, bool hubload); + private: // Work data for CollectConnectedGroups. FPortalBits processMask; @@ -398,6 +399,12 @@ public: thinker->Construct(std::forward(args)...); return thinker; } + + void SetMusic() + { + if (cdtrack == 0 || !S_ChangeCDMusic(cdtrack, cdid)) + S_ChangeMusic(Music, musicorder); + } uint8_t md5[16]; // for savegame validation. If the MD5 does not match the savegame won't be loaded. diff --git a/src/g_shared/a_dynlight.h b/src/g_shared/a_dynlight.h index f0f287ef69..25d6a34779 100644 --- a/src/g_shared/a_dynlight.h +++ b/src/g_shared/a_dynlight.h @@ -170,7 +170,7 @@ struct FDynamicLight inline DVector3 PosRelative(int portalgroup) const { - return Pos + level.Displacements.getOffset(Sector->PortalGroup, portalgroup); + return Pos + Level->Displacements.getOffset(Sector->PortalGroup, portalgroup); } bool ShouldLightActor(AActor *check) diff --git a/src/hwrenderer/data/hw_vertexbuilder.cpp b/src/hwrenderer/data/hw_vertexbuilder.cpp index f4e4c6c368..a21b3c78f1 100644 --- a/src/hwrenderer/data/hw_vertexbuilder.cpp +++ b/src/hwrenderer/data/hw_vertexbuilder.cpp @@ -129,7 +129,7 @@ static void CreateVerticesForSection(FSection §ion, VertexContainer &gen, bo static void CreateVerticesForSector(sector_t *sec, VertexContainer &gen) { - auto sections = level.sections.SectionsForSector(sec); + auto sections = sec->Level->sections.SectionsForSector(sec); for (auto §ion :sections) { CreateVerticesForSection( section, gen, true); diff --git a/src/hwrenderer/scene/hw_fakeflat.cpp b/src/hwrenderer/scene/hw_fakeflat.cpp index 030c09f8e4..b37d8b67f0 100644 --- a/src/hwrenderer/scene/hw_fakeflat.cpp +++ b/src/hwrenderer/scene/hw_fakeflat.cpp @@ -196,7 +196,7 @@ static sector_t *allocateSector(sector_t *sec) { if (fakesectorbuffer == nullptr) { - unsigned numsectors = level.sectors.Size(); + unsigned numsectors = sec->Level->sectors.Size(); fakesectorbuffer = (sector_t**)FakeSectorAllocator.Alloc(numsectors * sizeof(sector_t*)); memset(fakesectorbuffer, 0, numsectors * sizeof(sector_t*)); } diff --git a/src/intermission/intermission.cpp b/src/intermission/intermission.cpp index 47d9cec1bd..2c014c78b2 100644 --- a/src/intermission/intermission.cpp +++ b/src/intermission/intermission.cpp @@ -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); + currentUILevel->SetMusic(); gamestate = GS_LEVEL; wipegamestate = GS_LEVEL; P_ResumeConversation (); diff --git a/src/p_saveg.cpp b/src/p_saveg.cpp index 7972d06d31..06fc8c6136 100644 --- a/src/p_saveg.cpp +++ b/src/p_saveg.cpp @@ -544,8 +544,7 @@ void P_SerializeSounds(FLevelLocals *Level, FSerializer &arc) 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->SetMusic(); Level->SetMusicVolume(musvol); } } diff --git a/src/p_setup.h b/src/p_setup.h index 8588ada684..0ddc25fa30 100644 --- a/src/p_setup.h +++ b/src/p_setup.h @@ -140,12 +140,6 @@ public: MapData * P_OpenMapData(const char * mapname, bool justcheck); bool P_CheckMapData(const char * mapname); - -// NOT called by W_Ticker. Fixme. [RH] Is that bad? -// -// [RH] The only parameter used is mapname, so I removed playermask and skill. -// On September 1, 1998, I added the position to indicate which set -// of single-player start spots should be spawned in the level. void P_SetupLevel (FLevelLocals *Level, int position, bool newGame); void P_FreeLevelData(); diff --git a/src/portal.h b/src/portal.h index cb9d5c7a82..58093476f9 100644 --- a/src/portal.h +++ b/src/portal.h @@ -22,7 +22,7 @@ struct subsector_t; // have to be traversed to connect the two // // - any sector not connected to any portal is assigned to group 0 -// Group 0 has no displacement to any other group in the level. +// Group 0 has no displacement to any other group in the level // //============================================================================ diff --git a/src/posix/sdl/i_main.cpp b/src/posix/sdl/i_main.cpp index 3d7912fc8b..f7d5da8f34 100644 --- a/src/posix/sdl/i_main.cpp +++ b/src/posix/sdl/i_main.cpp @@ -162,7 +162,7 @@ static int DoomSpecificInfo (char *buffer, char *end) } else { - p += snprintf (buffer+p, size-p, "\n\nCurrent map: %s", level.MapName.GetChars()); + p += snprintf (buffer+p, size-p, "\n\nCurrent map: %s", currentUILevel->MapName.GetChars()); if (!viewactive) { diff --git a/src/r_data/models/models.cpp b/src/r_data/models/models.cpp index e75d9d030c..f75594b05a 100644 --- a/src/r_data/models/models.cpp +++ b/src/r_data/models/models.cpp @@ -167,7 +167,7 @@ void FModelRenderer::RenderModel(float x, float y, float z, FSpriteModelFrame *s objectToWorldMatrix.rotate(-smf->rolloffset, 1, 0, 0); // consider the pixel stretching. For non-voxels this must be factored out here - float stretch = (smf->modelIDs[0] != -1 ? Models[smf->modelIDs[0]]->getAspectFactor() : 1.f) / level.info->pixelstretch; + float stretch = (smf->modelIDs[0] != -1 ? Models[smf->modelIDs[0]]->getAspectFactor() : 1.f) / actor->Level->info->pixelstretch; objectToWorldMatrix.scale(1, stretch, 1); float orientation = scaleFactorX * scaleFactorY * scaleFactorZ; diff --git a/src/s_sound.cpp b/src/s_sound.cpp index 20a287ae7d..ad4eb38ed7 100644 --- a/src/s_sound.cpp +++ b/src/s_sound.cpp @@ -458,8 +458,7 @@ void S_Start () // Don't start the music if revisiting a level in a hub for the same reason. if (!currentUILevel->IsReentering()) { - if (currentUILevel->cdtrack == 0 || !S_ChangeCDMusic (currentUILevel->cdtrack, currentUILevel->cdid)) - S_ChangeMusic (currentUILevel->Music, currentUILevel->musicorder); + currentUILevel->SetMusic(); } } diff --git a/src/v_video.h b/src/v_video.h index 2fd3f7e13c..1b3131f835 100644 --- a/src/v_video.h +++ b/src/v_video.h @@ -399,9 +399,6 @@ public: // Mark the palette as changed. It will be updated on the next Update(). virtual void UpdatePalette() {} - // Sets the gamma level. Returns false if the hardware does not support - // gamma changing. (Always true for now, since palettes can always be - // gamma adjusted.) virtual void SetGamma() {} // Sets a color flash. RGB is the color, and amount is 0-256, with 256 diff --git a/src/win32/i_keyboard.cpp b/src/win32/i_keyboard.cpp index 840313cead..69571cbfd1 100644 --- a/src/win32/i_keyboard.cpp +++ b/src/win32/i_keyboard.cpp @@ -345,7 +345,7 @@ ufailit: Device = NULL; return false; } - // Set cooperative level. + hr = Device->SetCooperativeLevel(Window, DISCL_NONEXCLUSIVE | DISCL_BACKGROUND); if (FAILED(hr)) { diff --git a/src/win32/i_main.cpp b/src/win32/i_main.cpp index 809deb43cb..878ba29a16 100644 --- a/src/win32/i_main.cpp +++ b/src/win32/i_main.cpp @@ -1104,7 +1104,7 @@ void DoomSpecificInfo (char *buffer, size_t bufflen) } else { - buffer += mysnprintf (buffer, buffend - buffer, "\r\n\r\nCurrent map: %s", level.MapName.GetChars()); + buffer += mysnprintf (buffer, buffend - buffer, "\r\n\r\nCurrent map: %s", currentUILevel->MapName.GetChars()); if (!viewactive) { diff --git a/src/win32/i_mouse.cpp b/src/win32/i_mouse.cpp index df81332e81..00103d7462 100644 --- a/src/win32/i_mouse.cpp +++ b/src/win32/i_mouse.cpp @@ -781,7 +781,7 @@ ufailit: Device = NULL; return false; } - // Set cooperative level. + hr = Device->SetCooperativeLevel(Window, DISCL_EXCLUSIVE | DISCL_FOREGROUND); if (FAILED(hr)) {