Object

From SM64Decomp Wiki
Jump to navigation Jump to search

An object is defined by various properties.

Behavior parameters

When an object is placed in a world, 4 bytes representing 4 behavior parameters can be set individually. These bytes are available as a signed integer (s32) in the field oBehParams. Since the second byte is the most frequently used one by objects, this is also copied to a special field oBehParams2ndByte. The value 0xFF for the second byte has a special meaning and indicates that the object shall not respawn.

When the first bit of the first parameter is set, this indicates that this object is Mario.

Position and velocity

The object's position is stored in oPosX, oPosY and oPosZ. The velocity is available in oVelX, oVelY and oVelZ.

The rotation can be changed by setting oMoveAnglePitch, oMoveAngleYaw and oMoveAngleRoll.

Object flags

Object flags are set in oFlags. The following flags are available:

Flag Description
OBJ_FLAG_UPDATE_GFX_POS_AND_ANGLE Indicate that object position or angle will be changed.
OBJ_FLAG_MOVE_XZ_USING_FVEL
OBJ_FLAG_MOVE_Y_WITH_TERMINAL_VEL
OBJ_FLAG_SET_FACE_YAW_TO_MOVE_YAW
OBJ_FLAG_SET_FACE_ANGLE_TO_MOVE_ANGLE
OBJ_FLAG_COMPUTE_DIST_TO_MARIO Compute distance to Mario. It is stored in oDistanceToMario.
OBJ_FLAG_ACTIVE_FROM_AFAR
OBJ_FLAG_TRANSFORM_RELATIVE_TO_PARENT
OBJ_FLAG_HOLDABLE Mark this object as holdable.
OBJ_FLAG_SET_THROW_MATRIX_FROM_TRANSFORM
OBJ_FLAG_COMPUTE_ANGLE_TO_MARIO Compute angle to Mario. It is stored in oAngleToMario.
OBJ_FLAG_PERSISTENT_RESPAWN

Collision data

The collision data is defined by collisionData. It can be used to dynamically change the collision of a surface object.

Interaction

An object's interaction is defined in oInteractType. For some interaction types a sub type can be specified in oInteractionSubtype.The following interaction types are available:

Type Subtype Description
INTERACT_HOOT
INTERACT_GRABBABLE
INT_SUBTYPE_GRABS_MARIO Also makes the object heavy
INT_SUBTYPE_HOLDABLE_NPC Allows the object to be gently dropped. Sets vertical speed to 0 when dropped with no forwards velocity.
INT_SUBTYPE_DROP_IMMEDIATELY This gets set by grabbable NPCs that talk to Mario to make him drop them after the dialog is finished.
INT_SUBTYPE_KICKABLE
INT_SUBTYPE_NOT_GRABBABLE Used by Heavy-Ho to allow it to throw Mario, without Mario being able to pick it up.
INTERACT_DOOR
INT_SUBTYPE_STAR_DOOR
INTERACT_DAMAGE Mario takes damage on colllision
INTERACT_COIN Coin counter increases on collision
INTERACT_CAP Gives Mario a cap
INTERACT_POLE
INTERACT_KOOPA
INTERACT_BREAKABLE
INTERACT_STRONG_WIND
INTERACT_WARP_DOOR
INTERACT_STAR_OR_KEY Star or key
INT_SUBTYPE_NO_EXIT
INT_SUBTYPE_GRAND_STAR
INTERACT_WARP
INT_SUBTYPE_FADING_WARP
INTERACT_CANNON_BASE
INTERACT_BOUNCE_TOP
INT_SUBTYPE_TWIRL_BOUNCE
INTERACT_WATER_RING
INTERACT_BULLY
INTERACT_FLAME
INTERACT_KOOPA_SHELL
INTERACT_BOUNCE_TOP2
INTERACT_MR_BLIZZARD
INTERACT_HIT_FROM_BELOW
INTERACT_TEXT
INT_SUBTYPE_SIGN
INT_SUBTYPE_NPC
INTERACT_TORNADO
INTERACT_WHIRLPOOL
INTERACT_CLAM_OR_BUBBA
INT_SUBTYPE_EATS_MARIO
INTERACT_BBH_ENTRANCE
INTERACT_SNUFIT_BULLET
INTERACT_SHOCK
INTERACT_IGLOO_BARRIER

Action and timer

The object has a timer oTimer which starts at 0 and is increased by 1 per frame (if game is not paused). The integer property oAction is commonly used to change an object current action. It's usually checked in a behavior's loop script. When changing the action to a different value, oTimer will be reset to 0 on the next loop.

Misc. properties

Property Description
oFloorHeight Distance to floor (?)
oGravity Gravity

See also