Talk:Lighting effects

From DoomWiki.org

Recent dwforums post mentioning this article: [1].  Changing it would just replace one unreferenced statement with another — a source code excerpt would be more reassuring, but I can't find one.    Ryan W (talk) 16:27, 5 July 2014 (UTC)

This is the function which thinks for a fire flicker effect every tic:
 //
 // T_FireFlicker
 //
 void T_FireFlicker (fireflicker_t* flick)
 {
     int	amount;
	
     if (--flick->count)
	 return;
	
     amount = (P_Random()&3)*16;
    
     if (flick->sector->lightlevel - amount < flick->minlight)
	 flick->sector->lightlevel = flick->minlight;
     else
 	flick->sector->lightlevel = flick->maxlight - amount;
 
     flick->count = 4;
 }
And this is the function that spawns it at level start.
 //
 // P_SpawnFireFlicker
 //
 void P_SpawnFireFlicker (sector_t*	sector)
 {
     fireflicker_t*	flick;
 	
     // Note that we are resetting sector attributes.
     // Nothing special about it during gameplay.
     sector->special = 0; 
 	
     flick = Z_Malloc ( sizeof(*flick), PU_LEVSPEC, 0);
 
     P_AddThinker (&flick->thinker);
 
     flick->thinker.function.acp1 = (actionf_p1) T_FireFlicker;
     flick->sector = sector;
     flick->maxlight = sector->lightlevel;
     flick->minlight = P_FindMinSurroundingLight(sector,sector->lightlevel)+16;
     flick->count = 4;
 }
The light can be seen to flicker to a random value between the sector's light and the minimum surrounding light plus 16 every 4 tics. It does so only in steps of 16 (the minimum amount of difference between two light levels in vanilla Doom).
--Quasar (talk) 19:45, 5 July 2014 (UTC)

Sector special 1[edit]

The current (prior to my edit, that is) name and description for sector special 1 are wrong. UDS lists it as "random off"; DEU v5.2, DeepSea, WadAuthor and Doombuilder use variations of "blinks randomly". Where did that "flash" come from?

And the description is in fact the reverse of the actual behavior. Load E1M1 of the IWAD, turn around and look at the silver door behind the player start. The sector in front of it (#30) has special 1. It is lit steadily, with occasional drop in brightness (hence "blink"). Quite the opposite of "flash", n'est ce pas? --Tpoppins (talk) 02:35, 31 August 2023 (CDT)