|
The legacy track format is not strictly an invention of Stunt Mania, but comes from Sports 4d
Driving. When Stunt Mania wants to display one of these tracks, it breaks it down from its original
form to one containing scenery chunks at load time. This section explains how.
First of all the object with id 0 is loaded as the background object. This should contain the floor
plane & edge fencing. This object is drawn with no z-buffer offset. You could replace this object
with one that contains a non-flat floor, but calculations for the height of various track elements
is not at this time based upon the object, so things could look very silly.
Stunt Mania then assembles the terrain - i.e. the hills and water that form a Sports 4d Driving
track. Within the Sports 4d Driving track file format, these are described with values ranging from
1 to 18. Stunt Mania very simply maps these onto a grid of objects, where each object has its id
directly dictated by the Sports 4d Driving file. i.e. the Stunt Mania object 1 is a square of
water, object 16 is a diagonal corner, etc. All water objects - that is, all objects with a numeric
value less than 6, are drawn with a small z-buffer offset. No object is displayed where a 0 is read
from the source file.
Then all that remains are track details. There is no easy general case mapping here, because the
Sports 4d Driving file format does not consistently follow any rules as such. All track objects are
drawn with a small z-buffer offset. At present tracks with road crossing water (which
are not strictly valid tracks it should be noted) will display incorrectly since the same small
offset is used for both track objects and water.
I have
explicitly assigned ids to each particular track feature. These are not set in stone, but most
probably won't vary a lot. In particular I am no longer sure I need both a left corner option and
a right corner option, since I can just rotate 180 degrees around the z axis, but that is another
matter. At the moment, I use these allocations, straight from the C format header file used in the
actual code :
#define TILE_ROAD_STRAIGHT 19
#define TILE_ROAD_SHARP_CORNER 20
#define TILE_ROAD_SLANTED 21
#define TILE_ROAD_LOOSE_CORNER 22
#define TILE_ROAD_CROSSROADS 23
#define TILE_ROAD_SHARP_OPTION_L 24
#define TILE_ROAD_SHARP_OPTION_R 25
#define TILE_ROAD_FINISH_LINE 26
#define TILE_MUD_STRAIGHT 27
#define TILE_MUD_SHARP_CORNER 28
#define TILE_MUD_SLANTED 29
#define TILE_MUD_LOOSE_CORNER 30
#define TILE_MUD_CROSSROADS 31
#define TILE_MUD_SHARP_OPTION_L 32
#define TILE_MUD_SHARP_OPTION_R 33
#define TILE_MUD_FINISH_LINE 34
#define TILE_ICE_STRAIGHT 35
#define TILE_ICE_SHARP_CORNER 36
#define TILE_ICE_SLANTED 37
#define TILE_ICE_LOOSE_CORNER 38
#define TILE_ICE_CROSSROADS 39
#define TILE_ICE_SHARP_OPTION_L 40
#define TILE_ICE_SHARP_OPTION_R 41
#define TILE_ICE_FINISH_LINE 42
#define TILE_SLALOM 43
#define TILE_BRIDGE 44
#define TILE_PIPE_END 45
#define TILE_PIPE 46
#define TILE_HALFPIPE 47
#define TILE_LR_CORKSCREW 48
#define TILE_LOOP 49
#define TILE_TUNNEL 50
#define TILE_BANKED_END 51
#define TILE_BANKED_STRAIGHT 52
#define TILE_BANKED_CORNER 53
#define TILE_ROAD_LOOSE_OPTION_L 54
#define TILE_ROAD_LOOSE_OPTION_R 55
#define TILE_CHICANE 56
#define TILE_SPLIT_END 57
#define TILE_SPLIT 58
#define TILE_RAISED_CORNER 59
#define TILE_RAISED_RAMP 60
#define TILE_SOLID_RAMP 61
#define TILE_RAISED_ROAD 62
#define TILE_RAISED_SPAN 63
#define TILE_SOLID_ROAD 64
#define TILE_UD_CORKSCREW 65
#define TILE_FURTREE 66
#define TILE_PALMTREE 67
#define TILE_TENNISCOURT 68
#define TILE_CACKTUS 69
#define TILE_BUILDING 70
#define TILE_BARN 71
#define TILE_PETROLSTATION 72
#define TILE_WINDMILL 73
#define TILE_BOAT 74
#define TILE_RESTAURANT 71
Naturally, rotated versions are composed by the game at runtime, and the one composite object -
'raised span across road' is formed by a simple composition of the two objects in question!
|