From 522cc855ad9d67d54636b4d3916e0cde5e23afbb Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Sun, 27 Jan 2019 16:59:50 +0100 Subject: [PATCH] - a few more. --- src/p_user.cpp | 11 +++++------ src/portal.cpp | 2 +- src/serializer.cpp | 6 +++--- src/st_stuff.cpp | 2 +- src/umapinfo.cpp | 1 - src/v_blend.cpp | 13 +++++++------ src/v_palette.cpp | 3 +-- 7 files changed, 18 insertions(+), 20 deletions(-) diff --git a/src/p_user.cpp b/src/p_user.cpp index 55f643783a..88f47db38b 100644 --- a/src/p_user.cpp +++ b/src/p_user.cpp @@ -693,7 +693,7 @@ bool player_t::Resurrect() // fire E_PlayerRespawned and start the ACS SCRIPT_Respawn. E_PlayerRespawned(int(this - players)); // - level.Behaviors.StartTypedScripts(SCRIPT_Respawn, mo, true); + mo->Level->Behaviors.StartTypedScripts(SCRIPT_Respawn, mo, true); return true; } @@ -890,7 +890,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_PlayerScream) } // Handle the different player death screams - if ((((level.flags >> 15) | (dmflags)) & + if ((((self->Level->flags >> 15) | (dmflags)) & (DF_FORCE_FALLINGZD | DF_FORCE_FALLINGHX)) && self->Vel.Z <= -39) { @@ -1009,7 +1009,7 @@ void P_FallingDamage (AActor *actor) int damage; double vel; - damagestyle = ((level.flags >> 15) | (dmflags)) & + damagestyle = ((actor->Level->flags >> 15) | (dmflags)) & (DF_FORCE_FALLINGZD | DF_FORCE_FALLINGHX); if (damagestyle == 0) @@ -1110,7 +1110,7 @@ void P_CheckMusicChange(player_t *player) { if (player->MUSINFOactor->args[0] != 0) { - FName *music = level.info->MusicMap.CheckKey(player->MUSINFOactor->args[0]); + FName *music = player->MUSINFOactor->Level->info->MusicMap.CheckKey(player->MUSINFOactor->args[0]); if (music != NULL) { @@ -1248,7 +1248,6 @@ void P_PredictionLerpReset() bool P_LerpCalculate(AActor *pmo, PredictPos from, PredictPos to, PredictPos &result, float scale) { - //DVector2 pfrom = level.Displacements.getOffset(from.portalgroup, to.portalgroup); DVector3 vecFrom = from.pos; DVector3 vecTo = to.pos; DVector3 vecResult; @@ -1683,7 +1682,7 @@ bool P_IsPlayerTotallyFrozen(const player_t *player) return gamestate == GS_TITLELEVEL || player->cheats & CF_TOTALLYFROZEN || - ((level.flags2 & LEVEL2_FROZEN) && player->timefreezer == 0); + ((player->mo->Level->flags2 & LEVEL2_FROZEN) && player->timefreezer == 0); } diff --git a/src/portal.cpp b/src/portal.cpp index b4764c6081..7b10f1d9b1 100644 --- a/src/portal.cpp +++ b/src/portal.cpp @@ -1035,7 +1035,7 @@ void FLevelLocals::CreateLinkedPortals() if (linkedPortals.Size() > 0) { // We need to relink all actors that may touch a linked line portal - auto it = Level->GetThinkerIterator(); + auto it = GetThinkerIterator(); AActor *actor; while ((actor = it.Next())) { diff --git a/src/serializer.cpp b/src/serializer.cpp index b88ae0ba5f..7fccd74752 100644 --- a/src/serializer.cpp +++ b/src/serializer.cpp @@ -2136,11 +2136,11 @@ template<> FSerializer &Serialize(FSerializer &arc, const char *key, char *&pstr // // This is a bit of a cheat because it never actually writes out the pointer. // The rules for levels are that they must be self-contained. -// No level and no pbject that is part of a level may reference a different level. +// No level and no pbject that is part of a level may reference a different one. // // When writing, this merely checks if the rules are obeyed and if not errors out. // When reading, it assumes that the object was properly written and restores -// the reference from the owning level. +// the reference from the owning level // // The only exception are null pointers which are allowed // @@ -2159,7 +2159,7 @@ template<> FSerializer &Serialize(FSerializer &arc, const char *key, FLevelLocal } else { - // This MUST be the currently serialized level. Anything else will error out here as a sanity check. + // This MUST be the currently serialized level, anything else will error out here as a sanity check. if (arc.Level == nullptr || lev != arc.Level) { I_Error("Attempt to serialize invalid level reference"); diff --git a/src/st_stuff.cpp b/src/st_stuff.cpp index fe96d62655..8213171386 100644 --- a/src/st_stuff.cpp +++ b/src/st_stuff.cpp @@ -489,7 +489,7 @@ static bool Cht_ChangeStartSpot (cheatseq_t *cheat) { char cmd[64]; - mysnprintf (cmd, countof(cmd), "changemap %s %c", level.MapName.GetChars(), cheat->Args[0]); + mysnprintf (cmd, countof(cmd), "changemap %s %c", currentUILevel->MapName.GetChars(), cheat->Args[0]); C_DoCommand (cmd); return true; } diff --git a/src/umapinfo.cpp b/src/umapinfo.cpp index c981fc44f8..324b1a0e1a 100644 --- a/src/umapinfo.cpp +++ b/src/umapinfo.cpp @@ -271,7 +271,6 @@ static int ParseStandardProperty(FScanner &scanner, UMapEntry *mape) scanner.MustGetValue(false); int tag = scanner.Number; // allow no 0-tag specials here, unless a level exit. -#pragma message("Fixme: This needs to be evaluated at run time") if (tag != 0 || special == 11 || special == 51 || special == 52 || special == 124) { // This cannot be evaluated here because this needs to be done in the context of the level being used. diff --git a/src/v_blend.cpp b/src/v_blend.cpp index 94a40b8321..6e6f31c90c 100644 --- a/src/v_blend.cpp +++ b/src/v_blend.cpp @@ -93,6 +93,7 @@ void V_AddBlend (float r, float g, float b, float a, float v_blend[4]) void V_AddPlayerBlend (player_t *CPlayer, float blend[4], float maxinvalpha, int maxpainblend) { int cnt; + auto Level = CPlayer->mo->Level; // [RH] All powerups can affect the screen blending now for (AActor *item = CPlayer->mo->Inventory; item != NULL; item = item->Inventory) @@ -175,18 +176,18 @@ void V_AddPlayerBlend (player_t *CPlayer, float blend[4], float maxinvalpha, int { if (CPlayer->hazardcount > 16*TICRATE || (CPlayer->hazardcount & 8)) { - float r = ((level.hazardflash & 0xff0000) >> 16) / 255.f; - float g = ((level.hazardflash & 0xff00) >> 8) / 255.f; - float b = ((level.hazardflash & 0xff)) / 255.f; + float r = ((Level->hazardflash & 0xff0000) >> 16) / 255.f; + float g = ((Level->hazardflash & 0xff00) >> 8) / 255.f; + float b = ((Level->hazardflash & 0xff)) / 255.f; V_AddBlend (r, g, b, 0.125f, blend); } } else { cnt= MIN(CPlayer->hazardcount/8, 64); - float r = ((level.hazardcolor & 0xff0000) >> 16) / 255.f; - float g = ((level.hazardcolor & 0xff00) >> 8) / 255.f; - float b = ((level.hazardcolor & 0xff)) / 255.f; + float r = ((Level->hazardcolor & 0xff0000) >> 16) / 255.f; + float g = ((Level->hazardcolor & 0xff00) >> 8) / 255.f; + float b = ((Level->hazardcolor & 0xff)) / 255.f; V_AddBlend (r, g, b, cnt/93.2571428571f, blend); } } diff --git a/src/v_palette.cpp b/src/v_palette.cpp index 814d7e7fa9..e598fa290b 100644 --- a/src/v_palette.cpp +++ b/src/v_palette.cpp @@ -79,8 +79,7 @@ CUSTOM_CVAR (Float, Gamma, 1.f, CVAR_ARCHIVE|CVAR_GLOBALCONFIG) CCMD (bumpgamma) { - // [RH] Gamma correction tables are now generated - // on the fly for *any* gamma level. + // [RH] Gamma correction tables are now generated on the fly for *any* gamma level // Q: What are reasonable limits to use here? float newgamma = Gamma + 0.1f;