420: Don't interrupt existing light fade on duration timing except EFFECT5

(cherry picked from commit 3b957c32517a8f5148940c0067af7e88a51d1fee)
This commit is contained in:
mazmazz 2018-09-18 06:27:30 -04:00
parent a036c42973
commit c45d523e8f
4 changed files with 16 additions and 4 deletions

View file

@ -1810,9 +1810,10 @@ static int lib_pFadeLight(lua_State *L)
INT32 destvalue = (INT32)luaL_checkinteger(L, 2);
INT32 speed = (INT32)luaL_checkinteger(L, 3);
boolean ticbased = lua_optboolean(L, 4);
boolean force = lua_optboolean(L, 5);
NOHUD
INLEVEL
P_FadeLight(tag, destvalue, speed, ticbased);
P_FadeLight(tag, destvalue, speed, ticbased, force);
return 0;
}

View file

@ -371,12 +371,22 @@ void P_FadeLightBySector(sector_t *sector, INT32 destvalue, INT32 speed, boolean
}
}
void P_FadeLight(INT16 tag, INT32 destvalue, INT32 speed, boolean ticbased)
void P_FadeLight(INT16 tag, INT32 destvalue, INT32 speed, boolean ticbased, boolean force)
{
INT32 i;
// search all sectors for ones with tag
for (i = -1; (i = P_FindSectorFromTag(tag, i)) >= 0 ;)
{
if (!force && ticbased // always let speed fader execute
&& sectors[i].lightingdata
&& ((lightlevel_t*)sectors[i].lightingdata)->thinker.function.acp1 == (actionf_p1)T_LightFade)
// && ((lightlevel_t*)sectors[i].lightingdata)->timer > 2)
{
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(&sectors[i], destvalue, speed, ticbased);
}
}
/** Fades the light level in a sector to a new value.

View file

@ -2877,7 +2877,8 @@ static void P_ProcessLineSpecial(line_t *line, mobj_t *mo, sector_t *callsec)
max(min(sides[line->sidenum[1]].rowoffset>>FRACBITS, 255), 0)
: max(min(sides[line->sidenum[0]].rowoffset>>FRACBITS, 255), 0))
: abs(P_AproxDistance(line->dx, line->dy))>>FRACBITS,
(line->flags & ML_EFFECT4));
(line->flags & ML_EFFECT4),
(line->flags & ML_EFFECT5));
break;
case 421: // Stop lighting effect in tagged sectors

View file

@ -162,7 +162,7 @@ void T_Glow(glow_t *g);
glow_t *P_SpawnAdjustableGlowingLight(sector_t *minsector, sector_t *maxsector, 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);
void P_FadeLight(INT16 tag, INT32 destvalue, INT32 speed, boolean ticbased, boolean force);
void T_LightFade(lightlevel_t *ll);
typedef enum