EvilEngine/UIM

From Heavy Iron Modding
< EvilEngine(Redirected from UIM)

UIM
UI Motion
TypeBase
Base Type0x53
Games usedThe SpongeBob SquarePants Movie

The Incredibles
Rise of the Underminer

Ratatouille Prototype

Format[edit]

A UI Motion asset begins with a 0x18-byte header which extends from xBaseAsset:

struct zUIMotionAsset : xBaseAsset
{
	uint8 cmdCount;
	uint8 in;
	uint8 pad[2];
	uint32 cmdSize;
	float totalTime;
	float loopTime;
};
Offset Type Variable Description
0x08 uint8 cmdCount Number of commands after the header
0x09 uint8 in Always 1?
0x0A uint8[2] pad Padding
0x0C uint32 cmdSize Size of commands list - 8? Unknown what this is for
0x10 float totalTime How long the motion lasts in seconds. The motion will end at this point, so if there are any commands after it, they won't be played.
0x14 float loopTime The time offset in seconds of the loop point. When the motion loops, it will start over at this point instead of 0.

Following the header is a list of Commands (with a length of cmdCount). The format of each command is explained below.

Commands[edit]

There are 8 types of Commands defined:

  • 0 - Move
  • 1 - Scale
  • 2 - Rotate
  • 3 - Opacity
  • 4 - AbsoluteScale
  • 5 - Brightness
  • 6 - Color
  • 7 - UVScroll

Each command type has an 0x18-byte header:

struct zUIMotionCmdAsset
{
	uint32 type;
	float startTime;
	float endTime;
	float accelTime;
	float decelTime;
	uint8 enabled;
	// 3 bytes of padding
};
Offset Type Variable Description
0x00 uint32 type Type ID (see above)
0x04 float startTime Start time in seconds.
0x08 float endTime End time in seconds.
0x0C float accelTime Ease in time in seconds.
0x10 float decelTime Ease out time in seconds.
0x14 uint8 enabled 0 or 1. If 0, this command will not run (likely for testing purposes).
0x15 - - 3 bytes of padding

Depending on the command type, the UI's corresponding property will be interpolated in between startTime and endTime to its new value (for example, the Color command will interpolate the UI's color from a starting red-green-blue value to an ending red-green-blue value). accelTime and decelTime can be used to "ease in" and "ease out" the interpolation so it appears to start and end smoothly.

Each command type is either absolute, relative, or relative to original.

  • Absolute means the property will be overwritten with a set value and changed over time to a new value.
  • Relative means the property will be changed from its existing value by a specified amount.
  • Relative to original means the property will be overwritten with its original value set in the asset and changed by a specified amount.

Absolute commands:

  • Opacity
  • AbsoluteScale
  • Brightness
  • Color

Relative commands:

  • Move
  • Rotate

Relative to original commands:

  • Scale
  • UVScroll

Move (Type 0)[edit]

Move command example

Move the UI by a specified amount, relative to its last position.

struct zUIMotionCmdMove : zUIMotionCmdAsset
{
	float distX;
	float distY;
};
Offset Type Variable Description
0x18 float distX How far to move in pixels on the X axis.
0x1C float distY How far to move in pixels on the Y axis.

Size = 0x20 bytes

Scale (Type 1)[edit]

Scale command example

Change the scale of the UI by a specified ratio, relative to its original scale set in the asset.

struct zUIMotionCmdScale : zUIMotionCmdAsset
{
	float amountX;
	float amountY;
	uint8 centerPivot;
	// 3 bytes of padding
	float centerOffsetX;
	float centerOffsetY;
};
Offset Type Variable Description
0x18 float amountX How much to scale the X axis by as a ratio (2.0 = 200%, 0.5 = 50%, etc.)
0x1C float amountY How much to scale the Y axis by as a ratio (2.0 = 200%, 0.5 = 50%, etc.)
0x20 uint8 centerPivot 0 or 1. If 1, the UI will scale from its center. If 0, the UI will scale from its top-left corner.
0x21 - - 3 bytes of padding
0x24 float centerOffsetX Offset in pixels of the scale center point on the X axis. centerPivot must be set to 1.
0x28 float centerOffsetY Offset in pixels of the scale center point on the Y axis. centerPivot must be set to 1.

Size = 0x2C bytes

Rotate (Type 2)[edit]

Rotate command example

Rotate the UI by a specified amount, relative to its last rotation.

struct zUIMotionCmdRotate : zUIMotionCmdAsset
{
	float rotation;
	float centerOffsetX;
	float centerOffsetY;
};
Offset Type Variable Description
0x18 float rotation How far to rotate in degrees. (Positive is clockwise, negative is counter-clockwise)
0x1C float centerOffsetX Offset in pixels of the rotation pivot on the X axis.
0x20 float centerOffsetY Offset in pixels of the rotation pivot on the Y axis.

Size = 0x24 bytes

Opacity (Type 3)[edit]

Opacity command example

Change the opacity/alpha of the UI from a start to end value, overwriting its previous opacity.

struct zUIMotionCmdOpacity : zUIMotionCmdAsset
{
	uint8 startOpacity;
	uint8 endOpacity;
	// 2 bytes of padding
};
Offset Type Variable Description
0x18 uint8 startOpacity Start opacity/alpha (0-255).
0x19 uint8 endOpacity End opacity/alpha (0-255).
0x1A - - 2 bytes of padding

Size = 0x1C bytes

AbsoluteScale (Type 4)[edit]

AbsoluteScale command example

Change the scale of the UI from a start to an end ratio, overwriting its previous scale.

struct zUIMotionCmdAbsoluteScale : zUIMotionCmdAsset
{
	float startX;
	float startY;
	float endX;
	float endY;
	uint8 centerPivot;
	uint8 textScale;
	// 2 bytes of padding
};
Offset Type Variable Description
0x18 float startX Start X axis scale as a ratio (2.0 = 200%, 0.5 = 50%, etc.)
0x1C float startY Start Y axis scale as a ratio (2.0 = 200%, 0.5 = 50%, etc.)
0x20 float endX End X axis scale as a ratio (2.0 = 200%, 0.5 = 50%, etc.)
0x24 float endY End X axis scale as a ratio (2.0 = 200%, 0.5 = 50%, etc.)
0x28 uint8 centerPivot 0 or 1. If 1, the UI will scale from its center. If 0, the UI will scale from its top-left corner.
0x29 uint8 textScale Unknown
0x2A - - 2 bytes of padding

Size = 0x2C bytes

Brightness (Type 5)[edit]

Unknown. Might be related to bloom on Xbox

struct zUIMotionCmdBrightness : zUIMotionCmdAsset
{
	uint8 startBrightness;
	uint8 endBrightness;
	// 2 bytes of padding
};
Offset Type Variable Description
0x18 uint8 startBrightness
0x19 uint8 endBrightness
0x1A - - 2 bytes of padding

Size = 0x1C bytes

Color (Type 6)[edit]

Color command example

Change the color of the UI from a start to an end value, overwriting its previous color.

struct zUIMotionCmdColor : zUIMotionCmdAsset
{
	uint8 startRed;
	uint8 startGreen;
	uint8 startBlue;
	uint8 endRed;
	uint8 endGreen;
	uint8 endBlue;
	// 2 bytes of padding
};
Offset Type Variable Description
0x18 uint8 startRed Start red channel value (0-255).
0x19 uint8 startGreen Start green channel value (0-255).
0x1A uint8 startBlue Start blue channel value (0-255).
0x1B uint8 endRed End red channel value (0-255).
0x1C uint8 endGreen End green channel value (0-255).
0x1D uint8 endBlue End blue channel value (0-255).
0x1E - - 2 bytes of padding

Size = 0x20 bytes

UVScroll (Type 7)[edit]

UVScroll command example

Change the UI's UV offset by a specified amount, relative to its original UV set in the asset.

struct zUIMotionCmdUVScroll : zUIMotionCmdAsset
{
	float amountU;
	float amountV;
};
Offset Type Variable Description
0x18 float amountU How much to scroll the U (horizontal) coordinate (1.0 = full texture width).
0x1C float amountV How much to scroll the V (vertical) coordinate (1.0 = full texture height).

Size = 0x20 bytes