With the new q3map tool you can add custom surface parameters for mods without the need to recompile the q3map tool. These custom surfaceparms are stored in a file called ?custinfoparms.txt? in the folder scripts/. An example of this file with the new surfaceparm treacle and surfaceparm grass is shown below.
// Custom Infoparms File
// Custom Contentsflags
// Custom Surfaceflags
NOTE: For linux users, when using the -custinfoparms parameter q3map first looks in your homedir, and only if it doesn't find a custinfoparms.txt there, it uses the one stored in the
quake3 install dir (usually /usr/local/games).
Contents flags are flags similar to CONTENTS_FOG in the original Q3A. These flags define the contents of volumes inside the game (for instance lava, fog, water, etc.).
If you look in the source file game/surfaceflags.h, it has defines for all contents flags. The define is split into a name and a hexadecimal value, for instance CONTENTS_PLAYERCLIP 0x10000. These hexadecimal values are powers of 2 and can be ored together (binary) to form a bit mask. Up to 32 contents flags can be ored together this way.
Example: creating a volume with treacle.
The following outlines how a custom contents flag can be added and used in a mod. First open the ?custinfoparms.txt? file and add ?treacle 0x4000? to the Custom Contentsflags section as shown in the example file above (0x4000 is one of the unused values available for custom use). Next write a shader script which uses ?surfaceparm treacle?. Apply this new shader to all sides of a brush in a test map. When you compile the map, add the -custinfoparms parameter to the command line following q3map.
Next, add CONTENTS_TREACLE 0x4000 to the source file game/surfaceflags.h in your mod. Now you can call the point contents function. If the point is inside the brush with the shader using the ?surfaceparm treacle? then the point contents call will return a bit mask with CONTENTS_TREACLE set. This can for instance be used to slow down player movement when a player is inside such a brush.
The surface flags are texture properties that often affect entities in contact with surfaces using such flags. The ?surfaceparm metalsteps? parameter from Q3A is a good example.
If you look in the source file game/surfaceflags.h, it has defines for all surface flags. The define is split into a name and a hexadecimal value, for instance SURF_NODAMAGE 0x1. These hexadecimal values are powers of 2 and can be ored together (binary) to form a bit mask. Up to 32 surface flags can be ored together this way.
Example: Making ?footsteps on grass? sounds
The following outlines how a custom surface flag can be added and used in a mod. First open up the ?custinfoparms.txt? file and add 'grass 0x80000' to the Custom Surfaceflags section as shown in the example file above (0x80000 is the first available unused value in surfaceflags.h for surface flags). Next write a shader script which uses a grass image and has 'surfaceparm grass?. Create a test map with the grass shader covering the ground surface. When you compile the map, add the -custinfoparms parameter to the command line following q3map.
Next, add SURF_GRASS 0x80000 to the source file game/surfaceflags.h in your mod. Now you'll be able to execute a trace and the trace information will be returned in the trace_t structure. If the trace hits a surface with the grass surfaceparm then the SURF_GRASS flag will be set in trace_t->surfaceFlags. Such a trace can be used to trigger playing a sound of a person stepping on grass. For a reference example, see the existing metal steps in the game code.
Anyone make sense of this?
Topics relating to D-Day modeling/coding/skinning etc.
3 posts • Page 1 of 1