diff --git a/extras/conf/udb/Includes/SRB222_linedefs.cfg b/extras/conf/udb/Includes/SRB222_linedefs.cfg index 2ec7691ab..a75c98b4d 100644 --- a/extras/conf/udb/Includes/SRB222_linedefs.cfg +++ b/extras/conf/udb/Includes/SRB222_linedefs.cfg @@ -2660,7 +2660,7 @@ udmf } arg2 { - title = "Speed"; + title = "Fading speed"; } arg3 { @@ -2668,8 +2668,9 @@ udmf type = 12; enum { - 1 = "Speed is tic duration"; - 2 = "Override existing fade"; + 1 = "Add to current translucency"; + 2 = "Interrupt ongoing fades"; + 4 = "Speed is duration"; } } } diff --git a/src/lua_baselib.c b/src/lua_baselib.c index 350c1585f..7c1d61a9c 100644 --- a/src/lua_baselib.c +++ b/src/lua_baselib.c @@ -2342,9 +2342,10 @@ static int lib_pFadeLight(lua_State *L) INT32 speed = (INT32)luaL_checkinteger(L, 3); boolean ticbased = lua_optboolean(L, 4); boolean force = lua_optboolean(L, 5); + boolean relative = lua_optboolean(L, 6); NOHUD INLEVEL - P_FadeLight(tag, destvalue, speed, ticbased, force); + P_FadeLight(tag, destvalue, speed, ticbased, force, relative); return 0; } diff --git a/src/p_lights.c b/src/p_lights.c index e8da48e9a..58ab2e799 100644 --- a/src/p_lights.c +++ b/src/p_lights.c @@ -358,9 +358,10 @@ void P_FadeLightBySector(sector_t *sector, INT32 destvalue, INT32 speed, boolean } } -void P_FadeLight(INT16 tag, INT32 destvalue, INT32 speed, boolean ticbased, boolean force) +void P_FadeLight(INT16 tag, INT32 destvalue, INT32 speed, boolean ticbased, boolean force, boolean relative) { INT32 i; + INT32 realdestvalue; // search all sectors for ones with tag TAG_ITER_SECTORS(tag, i) @@ -373,7 +374,9 @@ void P_FadeLight(INT16 tag, INT32 destvalue, INT32 speed, boolean ticbased, bool CONS_Debug(DBG_GAMELOGIC, "Line type 420 Executor: Fade light thinker already exists, timer: %d\n", ((lightlevel_t*)sectors[i].lightingdata)->timer); continue; } - P_FadeLightBySector(§ors[i], destvalue, speed, ticbased); + + realdestvalue = relative ? max(0, min(255, sectors[i].lightlevel + destvalue)) : destvalue; + P_FadeLightBySector(§ors[i], realdestvalue, speed, ticbased); } } diff --git a/src/p_setup.c b/src/p_setup.c index b87df4090..251e0fbb3 100644 --- a/src/p_setup.c +++ b/src/p_setup.c @@ -3745,7 +3745,7 @@ static void P_ConvertBinaryMap(void) if (lines[i].flags & ML_EFFECT4) lines[i].args[3] |= TMF_TICBASED; if (lines[i].flags & ML_EFFECT5) - lines[i].args[3] |= TMF_FORCE; + lines[i].args[3] |= TMF_OVERRIDE; break; case 421: //Stop lighting effect lines[i].args[0] = tag; diff --git a/src/p_spec.c b/src/p_spec.c index 2737c4d24..aeb657988 100644 --- a/src/p_spec.c +++ b/src/p_spec.c @@ -2527,7 +2527,7 @@ static void P_ProcessLineSpecial(line_t *line, mobj_t *mo, sector_t *callsec) break; case 420: // Fade light levels in tagged sectors to new value - P_FadeLight(line->args[0], line->args[1], line->args[2], line->args[3] & TMF_TICBASED, line->args[3] & TMF_FORCE); + P_FadeLight(line->args[0], line->args[1], line->args[2], line->args[3] & TMF_TICBASED, line->args[3] & TMF_OVERRIDE, line->args[3] & TMF_RELATIVE); break; case 421: // Stop lighting effect in tagged sectors diff --git a/src/p_spec.h b/src/p_spec.h index d759b701b..ca0bf0cb3 100644 --- a/src/p_spec.h +++ b/src/p_spec.h @@ -121,8 +121,9 @@ typedef enum typedef enum { - TMF_TICBASED = 1, - TMF_FORCE = 1<<1, + TMF_RELATIVE = 1, + TMF_OVERRIDE = 1<<1, + TMF_TICBASED = 1<<2, } textmapfadeflags_t; typedef enum @@ -301,7 +302,7 @@ void T_Glow(glow_t *g); glow_t *P_SpawnAdjustableGlowingLight(sector_t *sector, INT16 lighta, INT16 lightb, INT32 length); void P_FadeLightBySector(sector_t *sector, INT32 destvalue, INT32 speed, boolean ticbased); -void P_FadeLight(INT16 tag, INT32 destvalue, INT32 speed, boolean ticbased, boolean force); +void P_FadeLight(INT16 tag, INT32 destvalue, INT32 speed, boolean ticbased, boolean force, boolean relative); void T_LightFade(lightlevel_t *ll); typedef enum