- a few remaining simple ones

This also removes a few pointless comments that popped up and consolidates setting a level's music into a subfuntion.
This commit is contained in:
Christoph Oelckers 2019-01-28 01:25:52 +01:00
parent 648e472744
commit a7746278a8
16 changed files with 19 additions and 30 deletions

View file

@ -26,12 +26,6 @@ inline DVector3 AActor::PosRelative(const line_t *line) const
return Pos() + Level->Displacements.getOffset(Sector->PortalGroup, line->frontsector->PortalGroup); 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() inline void AActor::ClearInterpolation()
{ {
Prev = Pos(); Prev = Pos();

View file

@ -261,6 +261,7 @@ public:
void SpawnExtraPlayers(); void SpawnExtraPlayers();
void Serialize(FSerializer &arc, bool hubload); void Serialize(FSerializer &arc, bool hubload);
private: private:
// Work data for CollectConnectedGroups. // Work data for CollectConnectedGroups.
FPortalBits processMask; FPortalBits processMask;
@ -398,6 +399,12 @@ public:
thinker->Construct(std::forward<Args>(args)...); thinker->Construct(std::forward<Args>(args)...);
return thinker; 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. uint8_t md5[16]; // for savegame validation. If the MD5 does not match the savegame won't be loaded.

View file

@ -170,7 +170,7 @@ struct FDynamicLight
inline DVector3 PosRelative(int portalgroup) const 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) bool ShouldLightActor(AActor *check)

View file

@ -129,7 +129,7 @@ static void CreateVerticesForSection(FSection &section, VertexContainer &gen, bo
static void CreateVerticesForSector(sector_t *sec, VertexContainer &gen) static void CreateVerticesForSector(sector_t *sec, VertexContainer &gen)
{ {
auto sections = level.sections.SectionsForSector(sec); auto sections = sec->Level->sections.SectionsForSector(sec);
for (auto &section :sections) for (auto &section :sections)
{ {
CreateVerticesForSection( section, gen, true); CreateVerticesForSection( section, gen, true);

View file

@ -196,7 +196,7 @@ static sector_t *allocateSector(sector_t *sec)
{ {
if (fakesectorbuffer == nullptr) if (fakesectorbuffer == nullptr)
{ {
unsigned numsectors = level.sectors.Size(); unsigned numsectors = sec->Level->sectors.Size();
fakesectorbuffer = (sector_t**)FakeSectorAllocator.Alloc(numsectors * sizeof(sector_t*)); fakesectorbuffer = (sector_t**)FakeSectorAllocator.Alloc(numsectors * sizeof(sector_t*));
memset(fakesectorbuffer, 0, numsectors * sizeof(sector_t*)); memset(fakesectorbuffer, 0, numsectors * sizeof(sector_t*));
} }

View file

@ -787,8 +787,7 @@ void DIntermissionController::Ticker ()
switch (mGameState) switch (mGameState)
{ {
case FSTATE_InLevel: case FSTATE_InLevel:
if (level.cdtrack == 0 || !S_ChangeCDMusic (level.cdtrack, level.cdid)) currentUILevel->SetMusic();
S_ChangeMusic (level.Music, level.musicorder);
gamestate = GS_LEVEL; gamestate = GS_LEVEL;
wipegamestate = GS_LEVEL; wipegamestate = GS_LEVEL;
P_ResumeConversation (); P_ResumeConversation ();

View file

@ -544,8 +544,7 @@ void P_SerializeSounds(FLevelLocals *Level, FSerializer &arc)
if (arc.isReading()) if (arc.isReading())
{ {
if (!S_ChangeMusic(name, order)) if (!S_ChangeMusic(name, order))
if (Level->cdtrack == 0 || !S_ChangeCDMusic(Level->cdtrack, Level->cdid)) Level->SetMusic();
S_ChangeMusic(Level->Music, Level->musicorder);
Level->SetMusicVolume(musvol); Level->SetMusicVolume(musvol);
} }
} }

View file

@ -140,12 +140,6 @@ public:
MapData * P_OpenMapData(const char * mapname, bool justcheck); MapData * P_OpenMapData(const char * mapname, bool justcheck);
bool P_CheckMapData(const char * mapname); 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_SetupLevel (FLevelLocals *Level, int position, bool newGame);
void P_FreeLevelData(); void P_FreeLevelData();

View file

@ -22,7 +22,7 @@ struct subsector_t;
// have to be traversed to connect the two // have to be traversed to connect the two
// //
// - any sector not connected to any portal is assigned to group 0 // - 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
// //
//============================================================================ //============================================================================

View file

@ -162,7 +162,7 @@ static int DoomSpecificInfo (char *buffer, char *end)
} }
else 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) if (!viewactive)
{ {

View file

@ -167,7 +167,7 @@ void FModelRenderer::RenderModel(float x, float y, float z, FSpriteModelFrame *s
objectToWorldMatrix.rotate(-smf->rolloffset, 1, 0, 0); objectToWorldMatrix.rotate(-smf->rolloffset, 1, 0, 0);
// consider the pixel stretching. For non-voxels this must be factored out here // 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); objectToWorldMatrix.scale(1, stretch, 1);
float orientation = scaleFactorX * scaleFactorY * scaleFactorZ; float orientation = scaleFactorX * scaleFactorY * scaleFactorZ;

View file

@ -458,8 +458,7 @@ void S_Start ()
// Don't start the music if revisiting a level in a hub for the same reason. // Don't start the music if revisiting a level in a hub for the same reason.
if (!currentUILevel->IsReentering()) if (!currentUILevel->IsReentering())
{ {
if (currentUILevel->cdtrack == 0 || !S_ChangeCDMusic (currentUILevel->cdtrack, currentUILevel->cdid)) currentUILevel->SetMusic();
S_ChangeMusic (currentUILevel->Music, currentUILevel->musicorder);
} }
} }

View file

@ -399,9 +399,6 @@ public:
// Mark the palette as changed. It will be updated on the next Update(). // Mark the palette as changed. It will be updated on the next Update().
virtual void UpdatePalette() {} 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() {} virtual void SetGamma() {}
// Sets a color flash. RGB is the color, and amount is 0-256, with 256 // Sets a color flash. RGB is the color, and amount is 0-256, with 256

View file

@ -345,7 +345,7 @@ ufailit:
Device = NULL; Device = NULL;
return false; return false;
} }
// Set cooperative level.
hr = Device->SetCooperativeLevel(Window, DISCL_NONEXCLUSIVE | DISCL_BACKGROUND); hr = Device->SetCooperativeLevel(Window, DISCL_NONEXCLUSIVE | DISCL_BACKGROUND);
if (FAILED(hr)) if (FAILED(hr))
{ {

View file

@ -1104,7 +1104,7 @@ void DoomSpecificInfo (char *buffer, size_t bufflen)
} }
else 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) if (!viewactive)
{ {

View file

@ -781,7 +781,7 @@ ufailit:
Device = NULL; Device = NULL;
return false; return false;
} }
// Set cooperative level.
hr = Device->SetCooperativeLevel(Window, DISCL_EXCLUSIVE | DISCL_FOREGROUND); hr = Device->SetCooperativeLevel(Window, DISCL_EXCLUSIVE | DISCL_FOREGROUND);
if (FAILED(hr)) if (FAILED(hr))
{ {