Data Types

From Heavy Iron Modding
(Redirected from Asset ID)

Basic types

Type Description
long, int64, S64 64-bit signed integer
ulong, uint64, U64 64-bit unsigned integer
int, int32, S32 32-bit signed integer
uint, uint32, U32 32-bit unsigned integer
short, int16, S16 16-bit signed integer
ushort, uint16, U16 16-bit unsigned integer
byte, int8, S8 8-bit signed integer
ubyte, uint8, U8 8-bit unsigned integer
char 8-bit unsigned ASCII integer
float, F32 IEEE 754 floating point number

Structs

AssetID

Asset ID is a type derived from uint32 (EvilEngine) or uint64 (GoodEngine). It is considered its own type due to how the game uses Asset IDs to uniquely identify an asset and manage communication between them.

Type Description
uint 32-bit unsigned integer
ulong 64-bit unsigned integer

EvilEngine

To calculate the asset ID for the original game's assets, the game runs the BKDR hash algorithm on the asset's name converted to upper case. This is specially important to know when editing RWTX assets; to be able to refer to them from MODL, BSP and JSP assets, the game calculates the hash at runtime and finds the textures based on that.

This is HipHopTool's implementation of the algorithm in C#:

   public static uint BKDRHash(string str)
   {
       str = str.ToUpper();
       uint seed = 131;
       uint hash = 0;
       int length = str.Length;
       
       if (length > 31)
           length = 31;
       
        for (int i = 0; i < length; i++)
           hash = (hash * seed) + str[i];
       
       return hash;
   }

xVec2

xVec2 is a set of 2 floats, which usually represent a 2D vector on the world; it is used mostly for texture coordinates.

Source code: xMath2.h

struct xVec2
{
    F32 x;
    F32 y;
};
Type Description
float X - The X coordinate of this vector
float Y - The Y coordinate of this vector

xVec3

xVec3 is a set of 3 floats, which usually represent a 3D vector on the world, be it position, rotation or scale.

Source code: xVec3.h

struct xVec3
{
    F32 x;
    F32 y;
    F32 z;
};
Type Description
float X - The X coordinate of this vector
float Y - The Y coordinate of this vector
float Z - The Z coordinate of this vector

xVec4

xVec4 is a set of 4 floats. They can represent a vector in 4D space, and also a color with R, G, B, A components ranging from 0 to 1.

Source code: xMath3.h

struct xVec4
{
    F32 x;
    F32 y;
    F32 z;
    F32 w;
};
Type Description
float X - The X coordinate of this vector
float Y - The Y coordinate of this vector
float Z - The Z coordinate of this vector
float W - The W coordinate of this vector

xColor

xColor is a set of 4 bytes, which represent a 32 bit color with red, blue, green and alpha components.

In the source code, xColor is a typedef for iColor_tag, which can be different per platform (usually not though).

Source code: iColor.h

struct iColor_tag
{
    uint8 r;
    uint8 g;
    uint8 b;
    uint8 a;
};
Type Description
byte R - red (0-255)
byte G - green (0-255)
byte B - blue (0-255)
byte A - alpha (0-255)

Motion

Motion is a 0x30-byte structure (0x3C in TSSM) used in several asset types (PLAT and BUTN) which contains some settings defining how the object should move.

Source code: xEntMotion.h

Offset Type Variable Description
0x00 byte type
  • 0 - Extend/Retract - Move to one position and back
  • 1 - Orbit - Move around a center point
  • 2 - Spline - Unused, does nothing
  • 3 - Move Point - Move along a Move Point path
  • 4 - Mechanism - Slide along/rotate around a specific axis
  • 5 - Pendulum - Swing from side to side
  • 6 - None? - no movement
0x01 byte use_banking Unknown, always 0
0x02 ushort flags
  • 1 - ?
  • 4 - Stopped - If not set, the object starts moving on Scene Prepare.
Extend/Retract only
0x04 Vector3 ret_pos Retract Position - Start position
0x10 Vector3 ext_dpos Extend Delta Position - Distance to move from start position
0x1C float ext_tm Extend Time - Move forward time
0x20 float ext_wait_tm Extend Wait Time - Wait time after moving forward
0x24 float ret_tm Retract Time - Move backward time
0x28 float ret_wait_tm Retract Wait Time - Wait time after moving backward
0x2C byte[4] - null (Padding)
Orbit only
0x04 Vector3 center Point to move around
0x10 float w Width - X scale of orbit
0x14 float h Height - Z scale of orbit
0x18 float period Time it takes to complete one orbit
0x1C byte[0x14] - null (Padding)
Spline only (Scooby/BFBB)
0x04 int unknown Yes, this field is actually called "unknown"
0x08 byte[0x28] - null (Padding)
Spline only (TSSM)
0x04 AssetID spline_id Spline AssetID
0x08 float speed
0x0C float lean_modifier
Move Point only
0x04 uint flags Always 0
0x08 AssetID mp_id MovePoint AssetID - Move Point to start at
0x0C float speed Speed to move at, in units per second
0x10 byte[0x20] - null (Padding)
Mechanism only (Scooby/BFBB)
0x04 byte type
  • 0 - Slide only
  • 1 - Rotate only
  • 2 - Slide and Rotate at the same time
  • 3 - Slide then Rotate
  • 4 - Rotate then Slide

All other values default to Rotate only

0x05 byte flags Movement Loop Mode Flags
  • 1 - Return to start - If set, the object moves forward and back in one cycle. If not set, the object only moves forward.
  • 2 - Don't loop - If set, the object will run one cycle and stop. If not set, the object will continuously run cycles.
0x06 byte sld_axis Slide Axis
  • 0 - X
  • 1 - Y
  • 2 - Z
0x07 byte rot_axis Rotate Axis
  • 0 - X
  • 1 - Y
  • 2 - Z
0x08 float sld_dist Slide Distance
0x0C float sld_tm Slide Time
0x10 float sld_acc_tm Slide Accel Time - Ease in time
0x14 float sld_dec_tm Slide Decel Time - Ease out time
0x18 float rot_dist Rotate Distance - In degrees
0x1C float rot_tm Rotate Time
0x20 float rot_acc_tm Rotate Accel Time - Ease in time
0x24 float rot_dec_tm Rotate Decel Time - Ease out time
0x28 float ret_delay Return Delay - Wait time after moving forward
0x2C float post_ret_delay Post-Return Delay - Wait time after moving backward
Mechanism only (TSSM)
0x04 byte type
  • 0 - Slide only
  • 1 - Rotate only
  • 2 - Slide and Rotate at the same time
  • 3 - Slide then Rotate
  • 4 - Rotate then Slide

All other values default to Rotate only

0x05 byte flags
  • 1 - Return to start - If set, the object moves forward and back in one cycle. If not set, the object only moves forward.
  • 2 - Don't loop - If set, the object will run one cycle and stop. If not set, the object will continuously run cycles.
0x06 byte sld_axis Slide Axis
  • 0 - X
  • 1 - Y
  • 2 - Z
0x07 byte rot_axis Rotate Axis
  • 0 - X
  • 1 - Y
  • 2 - Z
0x08 byte scale_axis
0x09 byte[3] - null (Padding)
0x0C float sld_dist Slide Distance
0x10 float sld_tm Slide Time
0x14 float sld_acc_tm Slide Accel Time - Ease in time
0x18 float sld_dec_tm Slide Decel Time - Ease out time
0x1C float rot_dist Rotate Distance - In degrees
0x20 float rot_tm Rotate Time
0x24 float rot_acc_tm Rotate Accel Time - Ease in time
0x28 float rot_dec_tm Rotate Decel Time - Ease out time
0x2C float ret_delay Return Delay - Wait time after moving forward
0x30 float post_ret_delay Post-Return Delay - Wait time after moving backward
0x34 float scale_amount
0x38 float scale_duration
Pendulum only
0x04 byte flags
0x05 byte plane Unknown
0x06 byte[2] pad null (Padding)
0x08 float len Length - The height of the pivot point
0x0C float range The amount (in radians) the pendulum swings on each side
0x10 float period The time one full swing takes
0x14 float phase Start swing offset (in radians), e.g. 6.28 = 1 full swing
0x18 byte[0x18] - null (Padding)
None only
0x04 byte[0x2C] - null (Padding)