Difference between revisions of "Object"
(Created page with "An object is defined by various properties. == Position and velocity == The object's position is stored in <code>oPosX</code>, <code>oPosY</code> and <code>oPosZ</code>. The...") |
|||
(One intermediate revision by the same user not shown) | |||
Line 1: | Line 1: | ||
An object is defined by various properties. | 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 <code>oBehParams</code>. Since the second byte is the most frequently used one by objects, this is also copied to a special field <code>oBehParams2ndByte</code>. 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 == | == Position and velocity == | ||
Line 28: | Line 33: | ||
|- | |- | ||
!<code>OBJ_FLAG_COMPUTE_DIST_TO_MARIO</code> | !<code>OBJ_FLAG_COMPUTE_DIST_TO_MARIO</code> | ||
− | |Compute distance to Mario. | + | |Compute distance to Mario. It is stored in <code>oDistanceToMario</code>. |
|- | |- | ||
!<code>OBJ_FLAG_ACTIVE_FROM_AFAR</code> | !<code>OBJ_FLAG_ACTIVE_FROM_AFAR</code> | ||
Line 43: | Line 48: | ||
|- | |- | ||
!<code>OBJ_FLAG_COMPUTE_ANGLE_TO_MARIO</code> | !<code>OBJ_FLAG_COMPUTE_ANGLE_TO_MARIO</code> | ||
− | |Compute angle to Mario. | + | |Compute angle to Mario. It is stored in <code>oAngleToMario</code>. |
|- | |- | ||
!<code>OBJ_FLAG_PERSISTENT_RESPAWN</code> | !<code>OBJ_FLAG_PERSISTENT_RESPAWN</code> | ||
Line 218: | Line 223: | ||
| | | | ||
|} | |} | ||
+ | |||
+ | == Action and timer == | ||
+ | The object has a timer <code>oTimer</code> which starts at 0 and is increased by 1 per frame (if game is not paused). The integer property <code>oAction</code> 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, <code>oTimer</code> will be reset to 0 on the next loop. | ||
== Misc. properties == | == Misc. properties == |
Latest revision as of 11:22, 9 November 2020
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 |