- 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);
}
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();

View file

@ -261,6 +261,7 @@ public:
void SpawnExtraPlayers();
void Serialize(FSerializer &arc, bool hubload);
private:
// Work data for CollectConnectedGroups.
FPortalBits processMask;
@ -399,6 +400,12 @@ public:
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.
int time; // time in the hub

View file

@ -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)

View file

@ -129,7 +129,7 @@ static void CreateVerticesForSection(FSection &section, 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 &section :sections)
{
CreateVerticesForSection( section, gen, true);

View file

@ -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*));
}

View file

@ -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 ();

View file

@ -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);
}
}

View file

@ -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();

View file

@ -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
//
//============================================================================

View file

@ -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)
{

View file

@ -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;

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.
if (!currentUILevel->IsReentering())
{
if (currentUILevel->cdtrack == 0 || !S_ChangeCDMusic (currentUILevel->cdtrack, currentUILevel->cdid))
S_ChangeMusic (currentUILevel->Music, currentUILevel->musicorder);
currentUILevel->SetMusic();
}
}

View file

@ -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

View file

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

View file

@ -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)
{

View file

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