Object

In technical terms, an Object is an instance of a GOOL executable. From the player's point of view, it is an in-game entity with specific appearance, behavior, location, state, and a variety of other characteristics. For each frame, or approximately every 1/60th of a second of gameplay, an object's executable bytecode is interpreted by the GOOL interpreter. This bytecode instructs the interpreter to perform a specific sequence of operations that will ultimately render the object according to its changing characteristics. As a result, the player observes a lively, animated, and interactive enemy, box, collectible item, or whatever other kind of in-game object it may be.

## General

When the game wishes to create an object, it first specifies a source GOOL executable, and an object is created as an instance of that executable-much like how a process is created in relation to its source executable in an operating system. Probably the most important part of a GOOL executable is its compiled GOOL bytecode; the compiled GOOL bytecode of an executable that any given object is an instance of-or more simply the bytecode for that object-will be 'interpreted' by the GOOL bytecode interpreter routine. The GOOL bytecode interpreter routine will then operate according to the instructions it sees in the bytecode for that object.

## Format

### Crash 1

All objects in Crash 1, with the exception of the player object, are 604 (0x25C) bytes in size. The player object, 860 (0x35C) bytes in size, includes an additional 0x100 bytes of object memory to account for the higher number of activation records and local 'registers' created by its lengthier, more complex code.

#### Free and Existing Objects

Free Objects have a header value of 0. They are placed into a 'free object pool' until the game requests to create or spawn them into existence.

Existing Objects have a header value of 1. They are the actual objects 'in use' by the game and are created or spawned into existence from a free object.

Both variations have the following format:

### List Handle Objects

List Handle Objects have a header value of 2. They are not actual objects and instead used only to point to the head object in a list of (children) objects. For this reason their structure contains only 2 fields: the object header and a pointer to the list head object.

 0x4

## Structure

### Crash 1

```
struct object;
struct dbllink
{
 object \*prev;
 object \*next;
 unsigned long unk\_8;
};

struct object
{
 unsigned long header;
 union
 {
 unsigned long proctype;
 object \*listchildren;
 };
 struct bound bound;
 entry \*local;
 entry \*external;
 entry \*zone;
 unsigned long state;

 union { struct slightmatrix colors;
 struct slightmatrix lightmatrix; };
 struct scolor color;
 struct scolormatrix colormatrix;
 struct scolor intensity;

 object \*self;
 object \*parent;
 object \*sibling;
 object \*children;
 object \*creator;
 object \*player;
 object \*collider;
 object \*interrupter;

 union { struct vector vectors;
 struct vector trans; };
 struct angle rot;
 struct vector scale;
 union
 {
 struct vector velocity;
 struct dbllink link;
 };
 struct angle targetrot;
 union
 {
 struct angle angvelocity;
 struct
 {
 unsigned long modeflagsa;
 unsigned long modeflagsb;
 unsigned long modeflagsc;
 };
 };

 unsigned long statusa;
 unsigned long statusb;
 unsigned long statusc;
 unsigned long subtype;
 unsigned long id;
 unsigned long \*sp;
 unsigned long \*pc;
 unsigned long \*fp;
 unsigned long \*pctrans;
 unsigned long \*pcevent;
 unsigned long \*pchead;
 union
 {
 unsigned long misc\_flag;
 object \*misc\_child;
 entry \*misc\_entry;
 unsigned long misc\_memcard;
 };
 unsigned long unk\_F8;
 unsigned long stampanim;
 unsigned long stampstate;
 unsigned long animcounter;
 unsigned long \*animseq;
 unsigned long animframe;

 unsigned char \*entity;
 signed long pathprogress;
 unsigned long pathcount;
 signed long groundy;
 unsigned long stateflags;
 signed long speed;
 unsigned long displaymode;
 unsigned long unk\_12C;
 unsigned long stampland;
 signed long landyvel;
 unsigned long zindex;
 unsigned long event;
 signed long camzoom;
 unsigned long approachyz;
 signed long hotspotclip;
 signed long unk\_14C;
 unsigned long unk\_150;
 unsigned long unk\_154;
 signed long node;
 unsigned long memory[0x40];
};

```

## Field Information

### Header

The header field determines whether the object is free, existing, or a list handle:

 1
 2

### Process Type or List Head

* When the object is a List Handle, this field points to the head object in its referenced list.
* When the object is *not* a List Handle, this field is set to 3 after it is successfully created or spawned.
	+ note: after successful spawning, this field is actually set to the source entity's `proctype`. However, all entities appear to have a `proctype` of 3 (not confirmed\*\*).

### Bounding Box

An object's bounding box specifies the rectangular region of 3-dimensional space which it occupies. It encompasses the geometry rendered for the object's current frame of animation. It is specified by the 3-dimensional fixed-point coordinates of its upper left and lower right points relative to the object's location (which is typically positioned at the center point of the object's animation frame model), and is recalculated for each change in frame of animation.

Fields at offsets 0x8, 0xC, and 0x10, respectively, specify the relative x, y, and z coordinates of the object's upper left bounding box point. Fields at offsets 0x14, 0x18, and 0x1C, respectively, specify the relative x, y, and z coordinates of the object's lower right bounding box point.

### Status Flags A

This field is the first bitfield in a sequence of 3 *object status flag* bitfields

### Status Flags B

This field is the second bitfield in a sequence of 3 *object status flag* bitfields