Talk:Lighting effects

Recent dwforums post mentioning this article:. Changing it would just replace one unreferenced statement with another &mdash; 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)