Skip to content

TNL Format Reference (REWiki)

Chuck Ritola edited this page Jan 19, 2022 · 1 revision

.TNL

The actual look of the tunnel is defined in the TNL files. Found in Terminal Velocity and Fury3. The first number gives the number of tunnel segments. The tunnel can have up to 90 segments. More segments cause a crash! Each segment has the following format:

start_x, start_y, end_x, end_y, polygons
start_angle1, start_angle2, rotation_speed
start_width, start_height
end_angle1, end_angle2
end_width, end_height
???
light_polygon
cutout
obstacle
obstacle_tex_index
polygon#1_tex_index
polygon#2_tex_index
polygon#3_tex_index
polygon#4_tex_index
polygon#5_tex_index
polygon#6_tex_index
polygon#7_tex_index
polygon#8_tex_index
flicker_light_type
flicker_light_strength
ambient_light

Start_x and start_y are the positions for the near end of the segment, end_x and end_y for the far end. The start position of the next segment should be equal to the end position of the current segment. This is not required for the game but it prevents rendering errors. The polygons parameter defines the number of polygon per segment in the range from 3 to 8. Although 1 and 2 polygons are supported by the engine, it's not recommended because it makes no sense (A flat plane is no tunnel!). Start_angle1 and start_angle2 are used to rotate the upper and lower half of the pipe independently to create other forms (half-pipes for example). All polygons stay connected but the first one is stretched depending on the two angles. To create a normal pipe, the 2nd angle must be 360 degrees (65536 units) higher than the 1st. The same rules apply for end_angle1 and end_angle2. The rotation_speed lets the segment rotate with the defined speed, where 65536 equals 360 degrees in one second. Both directions are possible. Start_width and start_height are the scale for the near end of the segment, end_width and end_height for the far end. The start scale of the next segment should be equal to the end scale of the current segment to prevent rendering errors. The light_polygon specifies the polygon where the light is coming from, starting at 0. When this parameter is -1, the light is switched off. If cutout is set to 1, a quarter or half cutout can be created. Note that even if it's possible to define a three-quarter cutout (correctly rendered), the collision shape can not be concave! This will lead to wrong collision detection.

Obstacle can be one of the following types (0 = none):

Terminal Velocity Tunnel Obstacles

26-29 are never used in the game. The obstacle is rendered with the texture specified in obstacle_tex_index. This index refers to the TEX file specified in the tunnel's LVL file. The game crashes if an invalid index is given! The polygon#n_tex_index parameters are the texture indexes for every polygon of the current segment. The number of lines must be equal to the number of polygons. If not, the game crashes! The flicker_light_type can be one of the following patterns:

0 = 	no light
1 = 	1.0 sec ON 	1.0 sec OFF
2 =	1.5 sec ON	0.5 sec OFF
3 =	1.5 sec OFF	0.5 sec ON
4 =	toggle every frame

When flickering light is activated, the texture is split up in 2 separate sectors. Because all textures need to be square, the texture resolution is limited to 128^2 pixels. The upper left quarter of the texture is used for "light ON" and the upper right for "light OFF". The lower half of the texture is unused. The same rules apply for the obstacles of type 2 and 3. "closed door" takes the upper left sector, "blown open door" takes the upper right. flicker_light_strength and ambient_light are self explanatory. Both are in the range of 0...65536.

Clone this wiki locally