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:
<source lang="C"> // // 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;
} </source>
- And this is the function that spawns it at level start.
<source lang="C"> // // 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;
} </source>