Difference between revisions of "Entity"

From Crash Bandicoot Hacking Wiki
Jump to navigation Jump to search
(Type: added 0x336 (time trial crate type))
(Type)
 
(9 intermediate revisions by 3 users not shown)
Line 16: Line 16:
 
|-
 
|-
 
|0x4
 
|0x4
|Unknown
+
|Parent Zone Pointer (reserved)
|4 bytes x 2
+
|4 bytes
 +
|*
 +
|-
 +
|0x8
 +
|Parent Entity Pointer (reserved)
 +
|4 bytes
 
|*
 
|*
 
|-
 
|-
Line 58: Line 63:
 
|-
 
|-
 
|0x6
 
|0x6
|Row count
+
|Group count
 
|2 bytes
 
|2 bytes
 
|rc
 
|rc
Line 70: Line 75:
 
|-
 
|-
 
|0x0 + rc * 2
 
|0x0 + rc * 2
|Metavalues
+
|Metavalues (not present if flag 32 not set)
 
|2 bytes * rc
 
|2 bytes * rc
 
|*
 
|*
Line 89: Line 94:
 
!Format
 
!Format
 
!Uses Metavalues?
 
!Uses Metavalues?
 +
|-
 +
|0x29
 +
|Camera Mode
 +
|Determines the behavior of the camera trail - similar to ''Crash 1'' camera mode
 +
|UInt8 (''Crash 2'')<br />Int32 (''Crash 3'')
 +
|No
 
|-
 
|-
 
|0x2C
 
|0x2C
Line 94: Line 105:
 
|String of characters for the internal name used to refer to the entity. Its only purpose is for the devs to distinguish entities so whatever you put here won't directly affect the game
 
|String of characters for the internal name used to refer to the entity. Its only purpose is for the devs to distinguish entities so whatever you put here won't directly affect the game
 
|Unspecified
 
|Unspecified
 +
|No
 +
|-
 +
|0x32
 +
|Depth modifier
 +
|Modifier optionally applied to the object, usually to correct bad automatic depth sorting (i.e. force objects to appear behind certain scenery)
 +
|Int32
 
|No
 
|No
 
|-
 
|-
Line 104: Line 121:
 
|0x9F
 
|0x9F
 
|ID
 
|ID
|Value to uniquely identify the entity that is used to draw it, destroy it (see victims below) and other miscellaneous behaviors
+
|Value to uniquely identify the entity that is used to draw it, destroy it, and other miscellaneous behavior
 
|Int32'''<sup>1</sup>'''
 
|Int32'''<sup>1</sup>'''
 
|No
 
|No
 
|-
 
|-
 
|0xA4
 
|0xA4
|General Settings
+
|Arguments
|List of values that can be used to change a certain object's behavior (i.e. flags, delay, speed)
+
|List of values that affect an object's behavior (i.e. flags, timings, speed, etc.). These are the arguments pushed to GOOL stack before the object's appropriate spawn code runs.
|Int32 (UInt8 + Int24, but can be combined in different ways)
+
|Int32
 
|No
 
|No
 
|-
 
|-
 
|0xA9
 
|0xA9
 
|Type
 
|Type
|Type of the entity<!--Index of T11 entry in T11 entry list in the [[NSD]]?-->
+
|Type of the entity (index of GOOL entry in GOOL entry list in the [[NSD]])
 
|Int32
 
|Int32
 
|No
 
|No
Line 122: Line 139:
 
|0xAA
 
|0xAA
 
|Subtype
 
|Subtype
|Variant of the entity
+
|Variant of the entity - used as an index to the subtype table when spawning the object
 +
|Int32
 +
|No
 +
|-
 +
|0xC9
 +
|Camera movement unit
 +
|Specifies the amount of "distance" between two camera points. This "distance" translates to a multiplication of the direction vector for Crash-linked camera modes, is not necessary on automatic trails
 
|Int32
 
|Int32
 
|No
 
|No
Line 128: Line 151:
 
|0x103
 
|0x103
 
|SLST EID
 
|SLST EID
|EID of the SLST [[entry]] to be used by this camera rail
+
|EID of the SLST [[entry]] to be used by this camera trail
 
|Int32
 
|Int32
 
|No
 
|No
 
|-
 
|-
 
|0x109
 
|0x109
|Neighbor camera rails (untested)
+
|Neighbor camera trails
|Contains information about neighboring [[zone]]s
+
|Contains information about neighboring camera trails. If one position contains multiple trails, special collision nodes may determine which to use. Trail settings are same as ''Crash 1'', in reverse order.
 
|Int32
 
|Int32
 
|Yes
 
|Yes
Line 143: Line 166:
 
|Int32
 
|Int32
 
|No
 
|No
 +
|-
 +
|0x130
 +
|Field-of-View timeline
 +
|Determines the field of view. A value of 288 is the "normal" field of view. The end result is interpolated between the "keyframes" of this property. It is unknown if multiple FOV values can be used on the same position.
 +
|Int32
 +
|Yes
 
|-
 
|-
 
|0x13B
 
|0x13B
 
|Draw List A
 
|Draw List A
|List of values that determine which entities should despawn while the camera is in this zone'''<sup>2</sup>'''
+
|List of values that determine which entities should despawn while the camera is in this zone - includes zone index and entity index'''<sup>2</sup>'''
 
|Int32
 
|Int32
 
|Yes
 
|Yes
Line 152: Line 181:
 
|0x13C
 
|0x13C
 
|Draw List B
 
|Draw List B
|List of values that determine which entities should spawn while the camera is in this zone'''<sup>2</sup>'''
+
|List of values that determine which entities should spawn while the camera is in this zone - includes zone index and entity index'''<sup>2</sup>'''
 
|Int32
 
|Int32
 
|Yes
 
|Yes
 +
|-
 +
|0x173
 +
|Camera index
 +
|Specifies the index of this entity within the zone's list of cameras
 +
|Int32
 +
|No
 +
|-
 +
|0x174
 +
|Camera sub-index
 +
|Specifies the index of this entity within the camera's list of entities (i.e. values should be 0, 1 or 2)
 +
|Int32
 +
|No
 
|-
 
|-
 
|0x208
 
|0x208
 
|Load List A
 
|Load List A
|List of EIDs to load when the camera is in this zone
+
|List of EIDs to load when the camera is in this zone'''<sup>2</sup>'''
 
|Int32
 
|Int32
 
|Yes
 
|Yes
Line 164: Line 205:
 
|0x209
 
|0x209
 
|Load List B
 
|Load List B
|List of EIDs to deload when the camera is in this zone
+
|List of EIDs to deload when the camera is in this zone'''<sup>2</sup>'''
 
|Int32
 
|Int32
 
|Yes
 
|Yes
Line 170: Line 211:
 
|0x277
 
|0x277
 
|Misc Settings 2
 
|Misc Settings 2
|Value that can be used to change a certain object's DDA behavior (i.e. deaths until DDA checkpoint) or other settings like Y rotation.
+
|Value that can be used to change a certain object's DDA behavior (i.e. deaths until DDA checkpoint) or other settings like Y rotation.(?)
 
|Int32
 
|Int32
 
|No
 
|No
 
|-
 
|-
 
|0x287
 
|0x287
|Victim
+
|Victims
 
|List of entity IDs to destroy on certain occasions (i.e. TNT is despawned, Nitro Switch activated)
 
|List of entity IDs to destroy on certain occasions (i.e. TNT is despawned, Nitro Switch activated)
 
|Int16
 
|Int16
Line 188: Line 229:
 
|0x28B
 
|0x28B
 
|Box count
 
|Box count
|Number of boxes in the level;<br>Should only be used in obj_willy
+
|Number of boxes in the level;<br>Only used by obj_willy
 +
|Int32
 +
|No
 +
|-
 +
|0x2A0
 +
|Parent box ID
 +
|Parent box ID, passed to spawned fruit from a box
 
|Int32
 
|Int32
 
|No
 
|No
 
|-
 
|-
 
|0x30E
 
|0x30E
|Scale
+
|Scale modifier
|Indicates the scale of the object. ''Crash 3''-only;<br/> 1 = Position/4 in-game; 2 = Position/2 in-game; 3 = Normal; 4 = Position*2 in-game; etc.
+
|Indicates the scale of the object. ''Crash 3''-only;<br/>0 = Position/4 in-game; 1 = Position/2 in-game; 2 = Normal; 3 = Position*2 in-game; etc.
 
|Int32
 
|Int32
 
|No
 
|No
 
|-
 
|-
 
|0x336
 
|0x336
|Time Trial crate type
+
|Time Trial reward
|BoxOC-only. Affects what the crate will turn into during time trial mode. ''Crash 3''-only
+
|Affects what the crate will reward (and consequentially turn into) during time trial mode. ''Crash 3''-only
 
|Int32
 
|Int32
 
|No
 
|No
Line 206: Line 253:
 
|0x337
 
|0x337
 
|Bonus box count
 
|Bonus box count
|Number of boxes in the level's bonus;<br>Should only be used in obj_willy. ''Crash 3''-only
+
|Number of boxes in the level's bonus;<br>Only used by obj_willy. ''Crash 3''-only
 
|Int32
 
|Int32
 
|No
 
|No
 
|}
 
|}
'''<sup>1</sup>''' Other lists store this as an Int16, so setting this to a value higher than the maximum value that can be stored in a 16-bit field (65535) may cause serious issues.
+
'''<sup>1</sup>''' Should fall within Int16 boundaries, as it is the common type used for entity ID-related operations.
  
'''<sup>2</sup>''' The roles of draw lists is reversed when the camera is going backwards.
+
'''<sup>2</sup>''' The roles of these lists is reversed when the camera is going backwards.
  
 
'''NOTE:''' When proceeding from one camera path to the next, all entities should be despawned at the "connection" point for proper disposal of resources. Same applies to entry loading and disposal, as the game seems smart enough not to dispose of resources it's also immediately told to load.
 
'''NOTE:''' When proceeding from one camera path to the next, all entities should be despawned at the "connection" point for proper disposal of resources. Same applies to entry loading and disposal, as the game seems smart enough not to dispose of resources it's also immediately told to load.

Latest revision as of 22:57, 14 April 2020

This article is for the Crash 2/3 entity format.

An entity is an item that stores a collection of values (hereafter referred to as "fields") that can represent either a game object or a camera rail in Crash 2 and 3.

Format

Offset Field Size Value
0x0 Length of this item 4 bytes *
0x4 Parent Zone Pointer (reserved) 4 bytes *
0x8 Parent Entity Pointer (reserved) 4 bytes *
0xC Field count 4 bytes hc
0x10 Field info structures (headers) hc * 8 bytes *
>=0x18 Field data structures (data) (varies) *
Field Info Structure
0x0 Type 2 bytes *
0x2 Offset to the field data relative to 12 bytes at the start of the item 2 bytes offset
0x4 Flags Byte *
0x5 Element size Byte es
0x6 Group count 2 bytes rc
Field Data Structure
0x0 Element count 2 bytes * rc ec
0x0 + rc * 2 Metavalues (not present if flag 32 not set) 2 bytes * rc *
0x0 + rc * 4 Data es * ec * rc *

Type

The format and usage of the field data depends on the field type. Incomplete list.

Type Name Purpose Format Uses Metavalues?
0x29 Camera Mode Determines the behavior of the camera trail - similar to Crash 1 camera mode UInt8 (Crash 2)
Int32 (Crash 3)
No
0x2C Name String of characters for the internal name used to refer to the entity. Its only purpose is for the devs to distinguish entities so whatever you put here won't directly affect the game Unspecified No
0x32 Depth modifier Modifier optionally applied to the object, usually to correct bad automatic depth sorting (i.e. force objects to appear behind certain scenery) Int32 No
0x4B Position List of position points to be used by the entity. More than one position can be used to make the entity follow a path (as long as it is programmed to do so) Int16 for each X, Y and Z coordinate No
0x9F ID Value to uniquely identify the entity that is used to draw it, destroy it, and other miscellaneous behavior Int321 No
0xA4 Arguments List of values that affect an object's behavior (i.e. flags, timings, speed, etc.). These are the arguments pushed to GOOL stack before the object's appropriate spawn code runs. Int32 No
0xA9 Type Type of the entity (index of GOOL entry in GOOL entry list in the NSD) Int32 No
0xAA Subtype Variant of the entity - used as an index to the subtype table when spawning the object Int32 No
0xC9 Camera movement unit Specifies the amount of "distance" between two camera points. This "distance" translates to a multiplication of the direction vector for Crash-linked camera modes, is not necessary on automatic trails Int32 No
0x103 SLST EID EID of the SLST entry to be used by this camera trail Int32 No
0x109 Neighbor camera trails Contains information about neighboring camera trails. If one position contains multiple trails, special collision nodes may determine which to use. Trail settings are same as Crash 1, in reverse order. Int32 Yes
0x118 Misc Settings 1 ??? Int32 No
0x130 Field-of-View timeline Determines the field of view. A value of 288 is the "normal" field of view. The end result is interpolated between the "keyframes" of this property. It is unknown if multiple FOV values can be used on the same position. Int32 Yes
0x13B Draw List A List of values that determine which entities should despawn while the camera is in this zone - includes zone index and entity index2 Int32 Yes
0x13C Draw List B List of values that determine which entities should spawn while the camera is in this zone - includes zone index and entity index2 Int32 Yes
0x173 Camera index Specifies the index of this entity within the zone's list of cameras Int32 No
0x174 Camera sub-index Specifies the index of this entity within the camera's list of entities (i.e. values should be 0, 1 or 2) Int32 No
0x208 Load List A List of EIDs to load when the camera is in this zone2 Int32 Yes
0x209 Load List B List of EIDs to deload when the camera is in this zone2 Int32 Yes
0x277 Misc Settings 2 Value that can be used to change a certain object's DDA behavior (i.e. deaths until DDA checkpoint) or other settings like Y rotation.(?) Int32 No
0x287 Victims List of entity IDs to destroy on certain occasions (i.e. TNT is despawned, Nitro Switch activated) Int16 No
0x288 Section ID Value to uniquely identify a "section" of the level and is used in checkpoints for the game to know which DDA checkpoints have been triggered and at what point in the level the player is (i.e. First real checkpoint has this set to 1, the next DDA checkpoint will have a 1 too, the next real checkpoint will have a 2, etc.) Int32 No
0x28B Box count Number of boxes in the level;
Only used by obj_willy
Int32 No
0x2A0 Parent box ID Parent box ID, passed to spawned fruit from a box Int32 No
0x30E Scale modifier Indicates the scale of the object. Crash 3-only;
0 = Position/4 in-game; 1 = Position/2 in-game; 2 = Normal; 3 = Position*2 in-game; etc.
Int32 No
0x336 Time Trial reward Affects what the crate will reward (and consequentially turn into) during time trial mode. Crash 3-only Int32 No
0x337 Bonus box count Number of boxes in the level's bonus;
Only used by obj_willy. Crash 3-only
Int32 No

1 Should fall within Int16 boundaries, as it is the common type used for entity ID-related operations.

2 The roles of these lists is reversed when the camera is going backwards.

NOTE: When proceeding from one camera path to the next, all entities should be despawned at the "connection" point for proper disposal of resources. Same applies to entry loading and disposal, as the game seems smart enough not to dispose of resources it's also immediately told to load.