## Terrain Clarification

Archive of the old editing forum
Forum rules
Before asking on how to use a ZDoom feature, read the ZDoom wiki first. This forum is archived - please use this set of forums to ask new questions.
Demolisher
Posts: 1749
Joined: Mon Aug 11, 2008 12:59 pm
Graphics Processor: nVidia with Vulkan support
Location: Winchester, VA

### Terrain Clarification

I was reading the wiki, and I'm getting really confused what DamageTimeMask does. The page ([wiki]TERRAIN[/wiki]) seems to organized oddly compared to other pages, as the properties are all hidden in a paragraph, and I can't figure out how to make the damage occur every half-second. I have no clue as to what it means about power of 2's, and the example leads me to believe that the formula is tics = value + 1. I do not have access to the source at the moment, or I would peruse in there for an answer. As soon as this gets cleared up, I'm updating the page.
Gez

Posts: 17684
Joined: Fri Jul 06, 2007 3:22 pm

### Re: Terrain Clarification

You can't make half-seconds, but you can approximate them with a damagetimemask of 15.

The formula is simple: if (!gametic & damagetimemask) { inflict(damage); } in pseudocode.

So, suppose we are at tic 0 and damagetimemask is 15. (0 & 15) => 0, !0 => true, damage is inflicted. Now if it's tic 1? 1 & 15 => 1; !1 => false. Etc. Any tic that isn't a perfect multiple of 16 will fail to trigger the effect.

In theory you can use weird damagetimemasks such as 23, but that'll just give you an irregular progression, which is why you should use powers of two. (23 will trigger damage everytime the gametic is a multiple of 32, but also some other times such as at 8, 40, but then not 16 or 80.)
Demolisher
Posts: 1749
Joined: Mon Aug 11, 2008 12:59 pm
Graphics Processor: nVidia with Vulkan support
Location: Winchester, VA

### Re: Terrain Clarification

Thanks, I'll just use 15 then.