Definitions
Contents |
Fixed point numbers
ZDoom commonly represents fixed point numbers as 32-bit integers with the integer part of the represented number stored in the top 16 bits, and with the fractional part (65536ths) stored the lower 16 bits.
In other words, the fixed point representation of a number = that number * 65536.
See Fixed point numbers for more information.
Byte angles
This is a value between 0 and 255 representing a direction and is used with some line specials. Some useful values are:
| 96 Northwest |
64 North |
32 Northeast |
| 128 West |
0 East | |
| 160 Southwest |
192 South |
224 Southeast |
Fixed point angles
These angles are similar to above but the value lies between 0.0 and 1.0 and is represented as a fixed point number. This means the value lies between 0 and 65536, with 0 representing 0.0 and 65536 representing 1.0. It is therefore possible to represent these angles as decimals (e.g. 0.5 is west, 0.25 is north), and use FixedMul and other commands on them.
Converting angles
To convert fixed point angles to byte angles, you can use the following formula:
byte_angle = fixed_point_angle >> 8
And to convert byte to fixed point angles you use the opposite:
fixed_point_angle = byte_angle << 8
Sprite angles
See Sprite article
Byte pitches
Pitches can be represented in byte form, as they only have a range of 180°, rather than 360°. The pitch is a value between 0 and 255 representing vertical pitch and is used with some actors. The number is actually in degrees, and is equal to the angle subtracted from 256. 0 is level, 1-89 is down, and 166-255 is up.
Some useful values are:
| 210 45° up |
166 Straight up |
| 0 Level | |
| 45 45° down |
89 Straight down |
Units of time
- Tic
- A time interval of 1/35 second. Actor logic (state duration) is based on tics.
- Octic
- A time interval of 1/8 second. Sector logic (speed and wait for crushers, doors, lifts, raising stairs, etc.) is based on octics, as well as interpolation points for moving cameras and actor movers.
Note: Because of a loss of precision with integer division, the duration of a tic is of 28 milliseconds (instead of 28.5714287514...), which means that 35 tics actually make up only 0.98 seconds. There are therefore actually 35.7142857142857... tics in one second. Likewise, octics are internally derived from tics (one octic being 35 tics divided by 8), and the duration of an octic is 122 milliseconds (instead of 122.5 based on the tic, or of 125 based on the second), which means that 8 octics actually make up only 0.976 seconds. There are therefore 8.192721311475409... octics in one second.