Difference between revisions of "Item Definition"

From GTAMods Wiki
Jump to navigation Jump to search
m (GTA Vice City)
m (GTA Vice City)
Line 101: Line 101:
 
| 0 || 1 || 0x01 || IS_ROAD || Identifies objects to draw "wet reflections" on them. || Roads
 
| 0 || 1 || 0x01 || IS_ROAD || Identifies objects to draw "wet reflections" on them. || Roads
 
|-
 
|-
| 1 || 2 || 0x02 || DO_NOT_FADE || Do not fade the object when it is being loaded into or out of view. ||  
+
| 1 || 2 || 0x02 || DO_NOT_FADE || Do not fade the object when it is being loaded into or out of view. || Some night objects, North Point Mall
 
|-
 
|-
| 2 || 4 || 0x04 || DRAW_LAST || Model is transparent. Render this object after all opaque objects, allowing transparencies of other objects to be visible through this object. ||  
+
| 2 || 4 || 0x04 || DRAW_LAST || Model is transparent. Render this object after all opaque objects, allowing transparencies of other objects to be visible through this object. || Fencse, trees
 
|-
 
|-
| 3 || 8 || 0x08 || ADDITIVE || Render with additive blending. Previous flag will be enabled automatically. ||  
+
| 3 || 8 || 0x08 || ADDITIVE || Render with additive blending. Previous flag will be enabled automatically. || Night windows
 
|-
 
|-
| 4 || 16 || 0x10 || - || Read, but not used. ||  
+
| 4 || 16 || 0x10 || - || Read, but not used. || _dy, _dt objects
 
|-
 
|-
| 5 || 32 || 0x20 || IGNORE_LIGHTING || Don't use static lighting, we want dynamic if it's possible. ||  
+
| 5 || 32 || 0x20 || IGNORE_LIGHTING || Don't use static lighting, we want dynamic if it's possible. || Interior objects
 
|-
 
|-
| 6 || 64 || 0x40 || NO_ZBUFFER_WRITE || Model is a shadow. Disable writing to z-buffer when rendering it, allowing transparencies of other objects, shadows, and lights to be visible through this object. ||  
+
| 6 || 64 || 0x40 || NO_ZBUFFER_WRITE || Model is a shadow. Disable writing to z-buffer when rendering it, allowing transparencies of other objects, shadows, and lights to be visible through this object. || Tree shadows
 
|-
 
|-
| 7 || 128 || 0x80 || DONT_RECEIVE_SHADOWS || Do not draw shadows on this object. ||  
+
| 7 || 128 || 0x80 || DONT_RECEIVE_SHADOWS || Do not draw shadows on this object. || Small objects, pickups, lamps, trees
 
|-
 
|-
| 8 || 256 || 0x100 || IGNORE_DRAW_DISTANCE || Ignore draw distance for this object (sets its "level" (island id) to 0). ||  
+
| 8 || 256 || 0x100 || IGNORE_DRAW_DISTANCE || Ignore draw distance for this object (sets its "level" (island id) to 0). || LOD models, North Bridge
 
|-
 
|-
| 9 || 512 || 0x200 || IS_GLASS_TYPE_1 || Breakable glass type 1: glass object changes its textures when breaking. ||  
+
| 9 || 512 || 0x200 || IS_GLASS_TYPE_1 || Breakable glass type 1: glass object changes its textures when breaking. || Small windows
 
|-
 
|-
| 10 || 1024 || 0x400 || IS_GLASS_TYPE_2 || Breakable glass type 2: glass object doesn't change its textures when breaking. ||  
+
| 10 || 1024 || 0x400 || IS_GLASS_TYPE_2 || Breakable glass type 2: glass object doesn't change its textures when breaking. || Large windows
 
|}
 
|}
  

Revision as of 13:28, 2 July 2017

Item Definition
IDE Sections:
2DFX AMAT ANIM CARS HIER HAND MLO OBJS
PATH PEDS TANM TOBJ TREE TXDP WEAP

Item definition files, usually identified by the file extension .ide, are used to declare many different aspects for the map system or to specify special behaviour rules for one of the aspects. They are stored in plain text format, so that they can be opened by any text editing program (like Notepad), but there are also some tools to simplify editing.

Overview

The item definition files are split up into several sections. There is no order on how you arrange the sections and sections do not need to appear in the file.

Format and syntax description

Line comments are indicated by the character # (number sign) and empty lines are allowed. They can be placed anywhere in the file. The game reads up to a maximum of 256 characters for each line and ignores the rest if the line is longer. Each section starts with a section identifier (usually four characters long, e.g. objs, tobj, etc.) indicating how the content of the section gets interpreted by the game. The identifier is followed by the definition entries. Each entry takes one line and every line follows a specific format which are described in the articles handling the sections in detail (see below). The end of any section is indicated by the terminating string end. Both the section identifier and terminating string are case sensitive. Lines within sections are always formatted in the same way differing only in the number of parameters describing the semantical content of the line. Data are usually separated by the character , (comma) but can be separated by  (space). Tabs and spaces anywhere in the beginning of the line, between data, or after the data are omitted by the game and can be used to improve readability for human eyes. The games' parser uses an invariant culture to parse numerical values and strings, which means strings are ASCII encrypted and the decimal separator is . (period).

Example

# line comment
objs
# default style in objs section
200, ind_land101, pjs, 1, 127, 0
# valid style
	    200 ind_land101 pjs 1 127 0
end

Sections

The following table contains all known sections in the item definition. The supported games column lists games that support the sections but it doesn't necessarily means they're functional in the games. Mouse over the game icons to see if the games are functional.

Identifier Supported games Description
OBJS GTA III Vice City San Andreas GTA IV Most important section: defines objects for the map. These objects can be placed into the world through the INST section of the item placement files.
TOBJ GTA III Vice City San Andreas GTA IV Functions similarly to OBJS but has two additional parameters defining the ingame time range the object can get rendered. These objects can be placed into the world through the INST section of the item placement files.
HIER GTA III Vice City San Andreas GTA IV Used to define objects for use in cutscenes.
CARS GTA III Vice City San Andreas GTA IV Used to define vehicles.
PEDS GTA III Vice City San Andreas GTA IV Used to define pedestrians (random NPC's).
PATH GTA III Vice City San Andreas Used to create waypoints for random NPC spawns (Paths).
2DFX GTA III Vice City San Andreas GTA IV Used to add particle effects and simple ped behaviors to defined objects.
WEAP Vice City San Andreas GTA IV Used to define weapons.
ANIM San Andreas GTA IV Functions similarly to OBJS, but it has one additional parameter indicating an IFP or WAD animation file to assign an animation to the object.
These objects are placed through the INST section of the item placement files.
TXDP San Andreas GTA IV Used to virtually extend texture dictionaries.
TANM GTA IV Used to combine TOBJ and ANIM sections.
Those objects get placed inside the INST section of the WPL.
TREE GTA IV
VNOD GTA IV
LINK GTA IV
MLO GTA IV Used to create interiors. This section does also contain information about portals (previous ENEX connections) and dimensions of the interior which influences certain aspects, like the weather, for example. All objects are placed relative to an offset placed using MLO+ inside the IPL or WPL file.
AMAT GTA IV This is Audio Materials. Possible Used to make a sound effect at the model. Usually used for dynamic objects.
LODM GTA IV
AGRPS GTA IV
HAND VC Xbox/Mobile

IDE Flags

Flags are used in order to specify the behaviour of objects. They are interpreted as signed 32-bit integer values where each bit describes a boolean value of a different aspect. The following table shows the standard flags used for objects defined in OBJS, TOBJ and ANIM section.

Flags are used to specify the behaviour of objects. They are signed 32-bit integer values where each bit describes a boolean value of an special aspect.

Flag Supported games Binary Description
-1 1111 1111 1111 1111 1111 1111 Enables all flags.[a] Never used by default.
1 GTA III Vice City San Andreas GTA IV 0000 0000 0000 0000 0000 0001 Wet effect (objects appear darker).
2 GTA III Vice City San Andreas GTA IV 0000 0000 0000 0000 0000 0010 Do not fade the object when it is being loaded into or out of view.
4 GTA III Vice City San Andreas GTA IV 0000 0000 0000 0000 0000 0100 Allow transparencies of other objects to be visible through this object.
8 GTA III Vice City San Andreas GTA IV 0000 0000 0000 0000 0000 1000 Alpha transparency 2
16 GTA III Vice City San Andreas GTA IV 0000 0000 0000 0000 0001 0000 Opposite to flag 2
32 GTA III Vice City San Andreas GTA IV 0000 0000 0000 0000 0010 0000 Indicates an object to be used inside an interior.
64 GTA III Vice City San Andreas GTA IV 0000 0000 0000 0000 0100 0000 Disables the shadow mesh to project a shadow; allow transparencies of other objects, shadows, and lights to be visible through this object.
128 Vice City San Andreas GTA IV 0000 0000 0000 0000 1000 0000 Object surface will not be culled.
256 Vice City San Andreas GTA IV 0000 0000 0000 0001 0000 0000 Disables draw distance (Only used for LOD objects with an LOD value greater than 299).
512 Vice City San Andreas GTA IV 0000 0000 0000 0010 0000 0000 Object is breakable (like glass – additional parameters defined inside the object.dat file, otherwise there is no effect).
1024 Vice City San Andreas GTA IV 0000 0000 0000 0100 0000 0000 Similar to flag 512: object first cracks on a strong collision, then it breaks (does also require object.dat registration).
2048 San Andreas GTA IV 0000 0000 0000 1000 0000 0000 Indicates an object as an garage door (for more information see GRGE – requires object.dat registration).
4096 San Andreas GTA IV 0000 0000 0001 0000 0000 0000 Indicates a multi mesh object (Object switches from mesh 2 to mesh 1 after collision – requires object.dat registration).
16384 San Andreas 0000 0000 0100 0000 0000 0000 Indicates a vegetation object (Object moves in wind).
32768 San Andreas GTA IV 0000 0000 1000 0000 0000 0000 Uses object brightness from the current weather definition (See timecyc.datPoleShd).
65536 San Andreas GTA IV 0000 0001 0000 0000 0000 0000 Object explodes after getting hit (requires object.dat registration).
131072 San Andreas 0000 0010 0000 0000 0000 0000 Unknown – apparently some flag for the Script.
262144 San Andreas 0000 0100 0000 0000 0000 0000 Unknown – only used 1 time in San Andreas.
1048576 San Andreas 0000 1000 0000 0000 0000 0000 Object will switch from mesh 2 to mesh 1 after getting sprayed by the player (graffity flag).
2097152 San Andreas 0001 0000 0000 0000 0000 0000 Disables backface culling – as an result the texture will be drawed on both sides of the model (Always enabled for GTA III and Vice City)
4194304 San Andreas 0010 0000 0000 0000 0000 0000 Unknown – apparently related into physics.
edit

GTA III

Bits Dec Hex Name Description Examples
0 1 0x01 - Cull model if player doesn't look at it? Read, but ignored. Fences
1 2[1] 0x02 DO_NOT_FADE Do not fade the object when it is being loaded into or out of view. Some lampposts
2 4[1] 0x04 DRAW_LAST Model is transparent. Render this object after all opaque objects, allowing transparencies of other objects to be visible through this object. Trees
3 8 0x08 ADDITIVE Render with additive blending. Previous flag must be enabled too.
4 16[1] 0x10 IS_SUBWAY Model is a tunnel, i.e. set the object as invisible unless the player enters cull zone flag 128. This flag works only with static models. Tunnels, some dynamic objects
5 32 0x20 IGNORE_LIGHTING Don't use static lighting, we want dynamic if it's possible. Some lampposts and trafficlights
6 64[1] 0x40 NO_ZBUFFER_WRITE Model is a shadow. Disable writing to z-buffer when rendering it, allowing transparencies of other objects, shadows, and lights to be visible through this object. Not implemented in the PS2 version. Shadow

GTA Vice City

Bits Dec Hex Name Description Examples
0 1 0x01 IS_ROAD Identifies objects to draw "wet reflections" on them. Roads
1 2 0x02 DO_NOT_FADE Do not fade the object when it is being loaded into or out of view. Some night objects, North Point Mall
2 4 0x04 DRAW_LAST Model is transparent. Render this object after all opaque objects, allowing transparencies of other objects to be visible through this object. Fencse, trees
3 8 0x08 ADDITIVE Render with additive blending. Previous flag will be enabled automatically. Night windows
4 16 0x10 - Read, but not used. _dy, _dt objects
5 32 0x20 IGNORE_LIGHTING Don't use static lighting, we want dynamic if it's possible. Interior objects
6 64 0x40 NO_ZBUFFER_WRITE Model is a shadow. Disable writing to z-buffer when rendering it, allowing transparencies of other objects, shadows, and lights to be visible through this object. Tree shadows
7 128 0x80 DONT_RECEIVE_SHADOWS Do not draw shadows on this object. Small objects, pickups, lamps, trees
8 256 0x100 IGNORE_DRAW_DISTANCE Ignore draw distance for this object (sets its "level" (island id) to 0). LOD models, North Bridge
9 512 0x200 IS_GLASS_TYPE_1 Breakable glass type 1: glass object changes its textures when breaking. Small windows
10 1024 0x400 IS_GLASS_TYPE_2 Breakable glass type 2: glass object doesn't change its textures when breaking. Large windows

Reference table

Bits Dec Hex Name Model info flag Ref address Ref description
0 1 0x01 IS_ROAD 0x04 0x4CA1D7 CRenderer::RenderRoads()
if (CModelInfo::GetModelInfo(entity->m_nModelIndex)->m_nFlags & IS_ROAD)
    entity->Render();
1 2 0x02 DO_NOT_FADE 0x20 0x4C7E03 CRenderer::ShouldModelBeStreamed(CEntity *,CVector const&)
if (model->m_nFlags & DO_NOT_FADE) {
    if (distance >= model->GetLargestLodDistance() + 30.0f)
        return true;
}
else if ( distance >= model->GetLargestLodDistance() + 50.0f)
    return true;
2 4 0x04 DRAW_LAST 0x40 0x56F4F3 CSimpleModelInfo::SetupBigBuilding(int,int)
if (model->m_nFlags & DRAW_LAST) {
    model->m_nFlags &= ~DRAW_LAST;
    dbgprint("%s was draw last\n", model->m_szName);
}
3 8 0x08 ADDITIVE 0x80 0x582590 CVisibilityPlugins::RenderFadingAtomic(RpAtomic *,float)
if (model->m_nFlags & ADDITIVE)
    RwRenderStateSet(rwRENDERSTATEDESTBLEND, rwBLENDONE);
4 16 0x10 - 0x100 - -
5 32 0x20 IGNORE_LIGHTING 0x200 0x56F7C4 CSimpleModelInfo::SetAtomic(int,RpAtomic *)
if (model->m_nFlags & IGNORE_LIGHTING)
    atomic->geometry->flags &= ~rpGEOMETRYLIGHT;
6 64 0x40 NO_ZBUFFER_WRITE 0x400 0x581390 CVisibilityPlugins::RenderFadingEntities(CLinkList<CVisibilityPlugins::AlphaObjectInfo> &)
if (model->m_nType == MODEL_INFO_SIMPLE && model->m_nFlags & NO_ZBUFFER_WRITE)
    RwRenderStateSet(rwRENDERSTATEZWRITEENABLE, FALSE);
7 128 0x80 DONT_RECEIVE_SHADOWS 0x800 0x48AF21 CFileLoader::LoadObjectInstance(char const*)
if (model->m_nFlags & DONT_RECEIVE_SHADOWS)
    entity->m_nFlags.bDontCastShadowsOn = true;
8 256 0x100 IGNORE_DRAW_DISTANCE 0x1000 0x487CDE CEntity::SetupBigBuilding()
if (model->m_afLodDistances[0] > 2500.0f || model->m_nFlags & IGNORE_DRAW_DISTANCE)
    entity->m_nLevel = 0;
9 512 0x200 IS_GLASS_TYPE_1 0x2000 0x488CCD CEntity::PreRender(), probably in-lined CModelInfo::IsGlassModel(int) @0x488CAA
bool CModelInfo::IsGlassModel(int modelId) {
    CBaseModelInfo *model = CModelInfo::GetModelInfo(modelId);
    if (model->m_nType == MODEL_INFO_SIMPLE || model->m_nType == MODEL_INFO_TIME) {
        CSimpleModelInfo *simpleModel = reinterpret_cast<CSimpleModelInfo *>(model);
        return simpleModel->m_nFlags & IS_GLASS_TYPE_1 || simpleModel->m_nFlags & IS_GLASS_TYPE_2;
    }
    return false;
}
10 1024 0x400 IS_GLASS_TYPE_2 0x4000 0x488CE7 CEntity::PreRender()
if (CModelInfo::IsGlassModel(modelId)) {
    if (!(CModelInfo::GetModelInfo(modelId)->m_nFlags & IS_GLASS_TYPE_2) ) {
        CGlass::AskForObjectToBeRenderedInGlass(entity);
        entity->m_nFlags.bIsVisible = false;
    }
}

Difference between GTA III and GTA IV engines

GTA IV not only uses different formats to the previous games, it also does not use IDs to identify objects anymore. While GTA III era games use an ID as an index inside an array of definitions, GTA IV uses the hashes of the model name as a key inside a hash table. For more information about this see Map System.

Tools

See also

References

External links