Difference between revisions of "Entity"

From Crash Bandicoot Hacking Wiki
Jump to navigation Jump to search
(Type: fixing stuff)
(pt. 2, simplifying table layout a bit)
Line 1: Line 1:
 
<!--Mostly from https://dl.dropboxusercontent.com/s/fu29g6xn97sa4pl/crash2fileformat.html-->
 
<!--Mostly from https://dl.dropboxusercontent.com/s/fu29g6xn97sa4pl/crash2fileformat.html-->
 
<!--Majorly incomplete-->
 
<!--Majorly incomplete-->
An ''entity'' is an item that stores a collection of values (hereafter referred to as "fields") that can represent a game [[object]]/camera rail in Crash 2 and 3.
+
:''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==
 
==Format==
===Crash 2/3===
 
 
{|class="article-table"
 
{|class="article-table"
 
!Offset
 
!Offset
Line 30: Line 30:
 
|*
 
|*
 
|-
 
|-
|colspan="4"|Field Info Structure ''h''
+
|>=0x18
 +
|Field data structures (data)
 +
|(varies)
 +
|*
 
|-
 
|-
|0x10 + (h * 0x8)
+
!colspan="4"|''Field Info Structure''
 +
|-
 +
|0x0
 
|Type
 
|Type
 
|2 bytes
 
|2 bytes
 
|*
 
|*
 
|-
 
|-
|0x12 + (h * 0x8)
+
|0x2
|Offset relative to 12 bytes at the start of the item
+
|Offset to the ''field data'' relative to 12 bytes at the start of the item
 
|2 bytes
 
|2 bytes
 
|offset
 
|offset
 
|-
 
|-
|0x14 + (h * 0x8)
+
|0x4
 
|Flags
 
|Flags
 
|Byte
 
|Byte
 
|*
 
|*
 
|-
 
|-
|0x15 + (h * 0x8)
+
|0x5
 
|Element size
 
|Element size
 
|Byte
 
|Byte
 
|es
 
|es
 
|-
 
|-
|0x16 + (h * 0x8)
+
|0x6
|Row Count
+
|Row count
 
|2 bytes
 
|2 bytes
|r
+
|rc
 
|-
 
|-
|colspan="4"|Field Structure ''f''
+
!colspan="4"|''Field Data Structure''
 
|-
 
|-
|offset + 0xC + f * 2
+
|0x0
 
|Element count
 
|Element count
|2 bytes
+
|2 bytes * rc
 
|ec
 
|ec
 
|-
 
|-
|offset + 0xE + r * 2 + f * 2
+
|0x0 + rc * 2
 
|Metavalues
 
|Metavalues
|2 bytes
+
|2 bytes * rc
 
|*
 
|*
 
|-
 
|-
|offset + 0xE + r * 4 + f * 2
+
|0x0 + rc * 4
 
|Data
 
|Data
|es * ec
+
|es * ec * rc
 
|*
 
|*
 
|-
 
|-
Line 88: Line 93:
 
|Name
 
|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
 
|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
|UTF-8 charset
+
|Unspecified
 
|No
 
|No
 
|-
 
|-
 
|0x4B
 
|0x4B
 
|Position
 
|Position
|List of position points to be used by the entity. Multiple of these can be used to make the entity follow a path (as long as it is programmed to do so)
+
|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
 
|Int16 for each X, Y and Z coordinate
 
|No
 
|No
Line 129: Line 134:
 
|0x109
 
|0x109
 
|Neighbor camera rails (untested)
 
|Neighbor camera rails (untested)
|Contains information about neighboring [[zone]]  
+
|Contains information about neighboring [[zone]]s
 
|Int32
 
|Int32
|No
+
|Yes
 
|-
 
|-
 
|0x118
 
|0x118
 
|Misc Settings 1
 
|Misc Settings 1
|X rotation?
+
|???
 
|Int32
 
|Int32
 
|No
 
|No
Line 201: Line 206:
 
'''<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>''' 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>2</sup>''' The roles of draw lists is reversed when the camera is going backwards. When proceeding from one camera path to the next, all entities should be despawned at the "connection" point for proper disposal of resources.
+
'''<sup>2</sup>''' The roles of draw 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.

Revision as of 05:39, 25 August 2018

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 Unknown 4 bytes x 2 *
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 Row count 2 bytes rc
Field Data Structure
0x0 Element count 2 bytes * rc ec
0x0 + rc * 2 Metavalues 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?
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
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 (see victims below) and other miscellaneous behaviors Int321 No
0xA4 General Settings List of values that can be used to change a certain object's behavior (i.e. flags, delay, speed) Int32 (UInt8 + Int24, but can be combined in different ways) No
0xA9 Type Type of the entity Int32 No
0xAA Subtype Variant of the entity Int32 No
0x103 SLST EID EID of the SLST entry to be used by this camera rail Int32 No
0x109 Neighbor camera rails (untested) Contains information about neighboring zones Int32 Yes
0x118 Misc Settings 1 ??? Int32 No
0x13B Draw List A List of values that determine which entities should despawn while the camera is in this zone2 Int32 Yes
0x13C Draw List B List of values that determine which entities should spawn while the camera is in this zone2 Int32 Yes
0x208 Load List A List of EIDs to load when the camera is in this zone Int32 Yes
0x209 Load List B List of EIDs to deload when the camera is in this zone 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 Victim 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;
Should only be used in obj_willy
Int32 No
0x30E Scale Indicates the scale of the object. Crash 3-only;
1 = Position/4 in-game; 2 = Position/2 in-game; 3 = Normal; 4 = Position*2 in-game; etc.
Int32 No
0x337 Bonus box count Number of boxes in the level's bonus;
Should only be used in obj_willy;
Crash 3-only
Int32 No

1 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.

2 The roles of draw 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.