MODSon[line.com] Wiki - Beta 1.0

Call of Duty 4: Map File Format

From MODSonline Wiki

Jump to: navigation, search

Example of a cube in the CoD4 map file format:

Image:Cube 4.png

iwmap 4
"000_Global" flags  active
"The Map" flags 
// entity 0
{
"classname" "worldspawn"
// brush 0
{
 ( 128 64 0 ) ( 64 64 0 ) ( 64 0 0 ) caulk 64 64 0 0 0 0 lightmap_gray 16384 16384 0 0 0 0
 ( 64 0 64 ) ( 64 64 64 ) ( 128 64 64 ) caulk 64 64 0 0 0 0 lightmap_gray 16384 16384 0 0 0 0
 ( 64 0 16 ) ( 128 0 16 ) ( 128 0 0 ) caulk 64 64 0 0 0 0 lightmap_gray 16384 16384 0 0 0 0
 ( 128 0 16 ) ( 128 64 16 ) ( 128 64 0 ) caulk 64 64 0 0 0 0 lightmap_gray 16384 16384 0 0 0 0
 ( 128 64 16 ) ( 64 64 16 ) ( 64 64 0 ) caulk 64 64 0 0 0 0 lightmap_gray 16384 16384 0 0 0 0
 ( 64 64 16 ) ( 64 0 16 ) ( 64 0 0 ) caulk 64 64 0 0 0 0 lightmap_gray 16384 16384 0 0 0 0
}
}




iwmap 4 map file version
"000_Global" flags active global flag, contained in every map file *
"000_Global/sky" flags global sky flag (?) *
"The Map" flags map name flag? (always "The Map", probably not in use / necessary) *
"blackout_geo.map" flags prefab expanded kind of prefab, but not misc_prefab (flagged as expanded prefab) *
"prefabs" flags prefab expanded may belong to the prefab stuff above *
"glow" flags
"high town" flags
"low town" flags
"stream" flags
"water" flags
various flags *
// entity 0
{
"classname" "worldspawn"
entity 0, must be the worldspawn entity.
Closing bracket is above entity 1 block, but other data blocks (brushes and patches) in between are really common.
"script_flag" "blackout_lightswitch_begins"
"contrastGain" ".25"
"sunRadiosity" "1"
"sunlight" ".6"
"sundirection" "-30 42 0"
"sundiffusecolor" "0.5 0.6 1"
"suncolor" "0.75 0.9 1"
"diffusefraction" "0.35"
"ambient" "0.1"
"_color" "0.6 0.7 1.000000"
"classname" "worldspawn"
"reflection_color_correction" "hunted"
some possible key/value pairs for worldspawn entity
// brush N
{
//...
}
a data block, in this case of a brush.
lines starting with a // (double slash) are used like comments.
n is a number, first block = 0, second = 1 etc.




Contents

[edit] Brushes

[edit] Brush data block

contains a minimum of 4 (ramps = 5, cubes = 6, complex convex brushes > 6) lines with the following structure:

attributes   ( x1 y1 z1 ) ( x2 y2 z2 ) ( x3 y3 z3 )   texture   tex_x   tex_y   shift_x   shift_y   rotation   ?   lightmap   lmap_x   lmap_y    ?   ?   ?   ?   smoothing type


[edit] Example

contents detail;
( 128 64 0 ) ( 64 64 0 ) ( 64 0 0 ) caulk 64 64 0 0 0 0 lightmap_gray 16384 16384 0 0 0 0 smoothing smoothing_smooth
(
... etc.


[edit] Explanation

attributes optional brush properties ( below opening data block bracket )
( xn yn zn ) coord of x, y and z value ( 1 unit = 1 inch )
texture name of texture
tex_x texture repetition x
tex_y texture repetition y
shift_x texture offset x
shift_y texture offset y
rotation rotation angle of the texture
? unknown ( default = 0 )
lightmap light map texture ( default = lightmap_gray )
lmap_x light map size x
lmap_y light map size y
? unknown ( default = 0 )
? unknown ( default = 0 )
? unknown ( default = 0 )
? unknown ( default = 0 )
smoothing type type of edge smoothing ( optional ) *


[edit] Patches

[edit] Terrain patches (Meshes)

example density: 2 x 2

// brush 0
 {
  mesh
  {
  contents nonColliding;
  toolFlags splitGeo;
   caulk
   lightmap_gray
   2 2 16 8
   (
	v 0 0 128 t 0 -0 0 0
	v 0 128 128 t 0 -2048 0 -8
   )
   (
	v 128 0 128 t 2048 -0 8 0
	v 128 128 128 t 2048 -2048 8 -8
   )
  }
 }
contents nonColliding; mesh attribute ( optional )
toolFlags splitGeo; unknown ( a flag which might have to do with portalling? )
caulk texture
lightmap_gray light map texture
2 2 16 8 first pair: density (rows and columns count)
second pair: unknown ( always 16 and 8? )
v 0 0 128 vertex coordonates defining a plane (triangle shape)
c 214 255 255 255 color / transparency (optional)
t 0 -0 0 0 texture applied on the above plane
( first two values: offset, streching and rotation; second pair: sample scale / lightmap related )

[edit] Curve patches (Curves)

example density: 3 x 3

// brush 0
 {
  curve
  {
  toolFlags splitGeo;
   caulk
   lightmap_gray
   3 3 16 8
   (
	v 0 0 128 t 0 -0 0 0
	v 0 64 128 t 0 -1024 0 -4
	v 0 128 128 t 0 -2048 0 -8
   )
   (
	v 64 0 128 t 1024 -0 4 0
	v 64 64 128 t 1024 -1024 4 -4
	v 64 128 128 t 1024 -2048 4 -8
   )
   (
	v 128 0 128 t 2048 -0 8 0
	v 128 64 128 t 2048 -1024 8 -4
	v 128 128 128 t 2048 -2048 8 -8
   )
  }
 }

(see above)


[edit] Entities

[edit] Models

// entity 1
{
"origin" "0.0 64.0 0.0"
"model" "a_usmc_tank_pose_a"
"classname" "misc_model"
}
origin position / coord of the model
model xmodel file path and name
classname entity type for xmodels


[edit] Spawns

// entity 2
{
"origin" "16.0 16.0 0.0"
"classname" "mp_dm_spawn"
}


[edit] Script Brushmodel

brush data blocks (brushes, patches, etc.) enclosed by an entity block, which has a classname of script_brushmodel

the enumeration of the brush data blocks start at 0 in each script_brushmodel block

// entity 3
{
"classname" "script_brushmodel"
// brush 0
{
 // ...
}
// brush 1
{
 // ...
}
}


* assumed as specific for Call of Duty 4, not supported in earlier CoD games

Personal tools