mirror of
https://github.com/AloUltraExt/sm64ex-alo.git
synced 2025-01-23 16:15:36 -05:00
add enums for lvlscript/beh ids (no geos for now)
This commit is contained in:
parent
a9a70aed1a
commit
1bacc62286
4 changed files with 263 additions and 128 deletions
|
@ -66,233 +66,296 @@
|
|||
#define BC_W(a) ((uintptr_t)(u32)(a))
|
||||
#define BC_PTR(a) ((uintptr_t)(a))
|
||||
|
||||
// List of commands as enum for ifdefs
|
||||
// Vanilla ones are left unnamed, custom ones are named
|
||||
enum BehaviorCommandsIDList
|
||||
{
|
||||
BHV_SCRIPT_CMD_00,
|
||||
BHV_SCRIPT_CMD_01,
|
||||
BHV_SCRIPT_CMD_02,
|
||||
BHV_SCRIPT_CMD_03,
|
||||
BHV_SCRIPT_CMD_04,
|
||||
BHV_SCRIPT_CMD_05,
|
||||
BHV_SCRIPT_CMD_06,
|
||||
BHV_SCRIPT_CMD_07,
|
||||
BHV_SCRIPT_CMD_08,
|
||||
BHV_SCRIPT_CMD_09,
|
||||
BHV_SCRIPT_CMD_0A,
|
||||
BHV_SCRIPT_CMD_0B,
|
||||
BHV_SCRIPT_CMD_0C,
|
||||
BHV_SCRIPT_CMD_0D,
|
||||
BHV_SCRIPT_CMD_0E,
|
||||
BHV_SCRIPT_CMD_0F,
|
||||
BHV_SCRIPT_CMD_10,
|
||||
BHV_SCRIPT_CMD_11,
|
||||
BHV_SCRIPT_CMD_12,
|
||||
BHV_SCRIPT_CMD_13,
|
||||
BHV_SCRIPT_CMD_14,
|
||||
BHV_SCRIPT_CMD_15,
|
||||
BHV_SCRIPT_CMD_16,
|
||||
BHV_SCRIPT_CMD_17,
|
||||
BHV_SCRIPT_CMD_18,
|
||||
BHV_SCRIPT_CMD_19,
|
||||
BHV_SCRIPT_CMD_1A,
|
||||
BHV_SCRIPT_CMD_1B,
|
||||
BHV_SCRIPT_CMD_1C,
|
||||
BHV_SCRIPT_CMD_1D,
|
||||
BHV_SCRIPT_CMD_1E,
|
||||
BHV_SCRIPT_CMD_1F,
|
||||
BHV_SCRIPT_CMD_20,
|
||||
BHV_SCRIPT_CMD_21,
|
||||
BHV_SCRIPT_CMD_22,
|
||||
BHV_SCRIPT_CMD_23,
|
||||
BHV_SCRIPT_CMD_24,
|
||||
BHV_SCRIPT_CMD_25,
|
||||
BHV_SCRIPT_CMD_26,
|
||||
BHV_SCRIPT_CMD_27,
|
||||
BHV_SCRIPT_CMD_28,
|
||||
BHV_SCRIPT_CMD_29,
|
||||
BHV_SCRIPT_CMD_2A,
|
||||
BHV_SCRIPT_CMD_2B,
|
||||
BHV_SCRIPT_CMD_2C,
|
||||
BHV_SCRIPT_CMD_2D,
|
||||
BHV_SCRIPT_CMD_2E,
|
||||
BHV_SCRIPT_CMD_2F,
|
||||
BHV_SCRIPT_CMD_30,
|
||||
BHV_SCRIPT_CMD_31,
|
||||
BHV_SCRIPT_CMD_32,
|
||||
BHV_SCRIPT_CMD_33,
|
||||
BHV_SCRIPT_CMD_34,
|
||||
BHV_SCRIPT_CMD_35,
|
||||
BHV_SCRIPT_CMD_36,
|
||||
BHV_SCRIPT_CMD_37,
|
||||
BHV_SCRIPT_CMD_CYLBOARD,
|
||||
};
|
||||
|
||||
// Defines the start of the behavior script as well as the object list the object belongs to.
|
||||
// Has some special behavior for certain objects.
|
||||
#define BEGIN(objList) \
|
||||
BC_BB(0x00, objList)
|
||||
BC_BB(BHV_SCRIPT_CMD_00, objList)
|
||||
|
||||
// Delays the behavior script for a certain number of frames.
|
||||
#define DELAY(num) \
|
||||
BC_B0H(0x01, num)
|
||||
BC_B0H(BHV_SCRIPT_CMD_01, num)
|
||||
|
||||
// Jumps to a new behavior command and stores the return address in the object's stack.
|
||||
#define CALL(addr) \
|
||||
BC_B(0x02), \
|
||||
BC_B(BHV_SCRIPT_CMD_02), \
|
||||
BC_PTR(addr)
|
||||
|
||||
// Jumps back to the behavior command stored in the object's stack.
|
||||
#define RETURN() \
|
||||
BC_B(0x03)
|
||||
BC_B(BHV_SCRIPT_CMD_03)
|
||||
|
||||
// Jumps to a new behavior script without saving anything.
|
||||
#define GOTO(addr) \
|
||||
BC_B(0x04), \
|
||||
BC_B(BHV_SCRIPT_CMD_04), \
|
||||
BC_PTR(addr)
|
||||
|
||||
// Marks the start of a loop that will repeat a certain number of times.
|
||||
#define BEGIN_REPEAT(count) \
|
||||
BC_B0H(0x05, count)
|
||||
BC_B0H(BHV_SCRIPT_CMD_05, count)
|
||||
|
||||
// Marks the end of a repeating loop.
|
||||
#define END_REPEAT() \
|
||||
BC_B(0x06)
|
||||
BC_B(BHV_SCRIPT_CMD_06)
|
||||
|
||||
// Also marks the end of a repeating loop, but continues executing commands following the loop on the same frame.
|
||||
#define END_REPEAT_CONTINUE() \
|
||||
BC_B(0x07)
|
||||
BC_B(BHV_SCRIPT_CMD_07)
|
||||
|
||||
// Marks the beginning of an infinite loop.
|
||||
#define BEGIN_LOOP() \
|
||||
BC_B(0x08)
|
||||
BC_B(BHV_SCRIPT_CMD_08)
|
||||
|
||||
// Marks the end of an infinite loop.
|
||||
#define END_LOOP() \
|
||||
BC_B(0x09)
|
||||
BC_B(BHV_SCRIPT_CMD_09)
|
||||
|
||||
// Exits the behavior script.
|
||||
// Often used to end behavior scripts that do not contain an infinite loop.
|
||||
#define BREAK() \
|
||||
BC_B(0x0A)
|
||||
BC_B(BHV_SCRIPT_CMD_0A)
|
||||
|
||||
// Exits the behavior script, unused.
|
||||
#define BREAK_UNUSED() \
|
||||
BC_B(0x0B)
|
||||
BC_B(BHV_SCRIPT_CMD_0B)
|
||||
|
||||
// Executes a native game function.
|
||||
#define CALL_NATIVE(func) \
|
||||
BC_B(0x0C), \
|
||||
BC_B(BHV_SCRIPT_CMD_0C), \
|
||||
BC_PTR(func)
|
||||
|
||||
// Adds a float to the specified field.
|
||||
#define ADD_FLOAT(field, value) \
|
||||
BC_BBH(0x0D, field, value)
|
||||
BC_BBH(BHV_SCRIPT_CMD_0D, field, value)
|
||||
|
||||
// Sets the specified field to a float.
|
||||
#define SET_FLOAT(field, value) \
|
||||
BC_BBH(0x0E, field, value)
|
||||
BC_BBH(BHV_SCRIPT_CMD_0E, field, value)
|
||||
|
||||
// Adds an integer to the specified field.
|
||||
#define ADD_INT(field, value) \
|
||||
BC_BBH(0x0F, field, value)
|
||||
BC_BBH(BHV_SCRIPT_CMD_0F, field, value)
|
||||
|
||||
// Sets the specified field to an integer.
|
||||
#define SET_INT(field, value) \
|
||||
BC_BBH(0x10, field, value)
|
||||
BC_BBH(BHV_SCRIPT_CMD_10, field, value)
|
||||
|
||||
// Performs a bitwise OR with the specified field and the given integer.
|
||||
// Usually used to set an object's flags.
|
||||
#define OR_INT(field, value) \
|
||||
BC_BBH(0x11, field, value)
|
||||
BC_BBH(BHV_SCRIPT_CMD_11, field, value)
|
||||
|
||||
// Performs a bit clear with the specified short. Unused in favor of the 32-bit version.
|
||||
#define BIT_CLEAR(field, value) \
|
||||
BC_BBH(0x12, field, value)
|
||||
BC_BBH(BHV_SCRIPT_CMD_12, field, value)
|
||||
|
||||
// TODO: this one needs a better name / labelling
|
||||
// Gets a random short, right shifts it the specified amount and adds min to it, then sets the specified field to that value.
|
||||
#define SET_INT_RAND_RSHIFT(field, min, rshift) \
|
||||
BC_BBH(0x13, field, min), \
|
||||
BC_BBH(BHV_SCRIPT_CMD_13, field, min), \
|
||||
BC_H(rshift)
|
||||
|
||||
// Sets the specified field to a random float in the given range.
|
||||
#define SET_RANDOM_FLOAT(field, min, range) \
|
||||
BC_BBH(0x14, field, min), \
|
||||
BC_BBH(BHV_SCRIPT_CMD_14, field, min), \
|
||||
BC_H(range)
|
||||
|
||||
// Sets the specified field to a random integer in the given range.
|
||||
#define SET_RANDOM_INT(field, min, range) \
|
||||
BC_BBH(0x15, field, min), \
|
||||
BC_BBH(BHV_SCRIPT_CMD_15, field, min), \
|
||||
BC_H(range)
|
||||
|
||||
// Adds a random float in the given range to the specified field.
|
||||
#define ADD_RANDOM_FLOAT(field, min, range) \
|
||||
BC_BBH(0x16, field, min), \
|
||||
BC_BBH(BHV_SCRIPT_CMD_16, field, min), \
|
||||
BC_H(range)
|
||||
|
||||
// TODO: better name (unused anyway)
|
||||
// Gets a random short, right shifts it the specified amount and adds min to it, then adds the value to the specified field. Unused.
|
||||
#define ADD_INT_RAND_RSHIFT(field, min, rshift) \
|
||||
BC_BBH(0x17, field, min), \
|
||||
BC_BBH(BHV_SCRIPT_CMD_17, field, min), \
|
||||
BC_H(rshift)
|
||||
|
||||
// No operation. Unused.
|
||||
#define CMD_NOP_1(field) \
|
||||
BC_BB(0x18, field)
|
||||
BC_BB(BHV_SCRIPT_CMD_18, field)
|
||||
|
||||
// No operation. Unused.
|
||||
#define CMD_NOP_2(field) \
|
||||
BC_BB(0x19, field)
|
||||
BC_BB(BHV_SCRIPT_CMD_19, field)
|
||||
|
||||
// No operation. Unused.
|
||||
#define CMD_NOP_3(field) \
|
||||
BC_BB(0x1A, field)
|
||||
BC_BB(BHV_SCRIPT_CMD_1A, field)
|
||||
|
||||
// Sets the current model ID of the object.
|
||||
#define SET_MODEL(modelID) \
|
||||
BC_B0H(0x1B, modelID)
|
||||
BC_B0H(BHV_SCRIPT_CMD_1B, modelID)
|
||||
|
||||
// Spawns a child object with the specified model and behavior.
|
||||
#define SPAWN_CHILD(modelID, behavior) \
|
||||
BC_B(0x1C), \
|
||||
BC_B(BHV_SCRIPT_CMD_1C), \
|
||||
BC_W(modelID), \
|
||||
BC_PTR(behavior)
|
||||
|
||||
// Exits the behavior script and despawns the object.
|
||||
// Often used to end behavior scripts that do not contain an infinite loop.
|
||||
#define DEACTIVATE() \
|
||||
BC_B(0x1D)
|
||||
BC_B(BHV_SCRIPT_CMD_1D)
|
||||
|
||||
// Finds the floor triangle directly under the object and moves the object down to it.
|
||||
#define DROP_TO_FLOOR() \
|
||||
BC_B(0x1E)
|
||||
BC_B(BHV_SCRIPT_CMD_1E)
|
||||
|
||||
// Sets the destination float field to the sum of the values of the given float fields.
|
||||
#define SUM_FLOAT(fieldDst, fieldSrc1, fieldSrc2) \
|
||||
BC_BBBB(0x1F, fieldDst, fieldSrc1, fieldSrc2)
|
||||
BC_BBBB(BHV_SCRIPT_CMD_1F, fieldDst, fieldSrc1, fieldSrc2)
|
||||
|
||||
// Sets the destination integer field to the sum of the values of the given integer fields. Unused.
|
||||
#define SUM_INT(fieldDst, fieldSrc1, fieldSrc2) \
|
||||
BC_BBBB(0x20, fieldDst, fieldSrc1, fieldSrc2)
|
||||
BC_BBBB(BHV_SCRIPT_CMD_20, fieldDst, fieldSrc1, fieldSrc2)
|
||||
|
||||
// Billboards the current object, making it always face the camera.
|
||||
#define BILLBOARD() \
|
||||
BC_B(0x21)
|
||||
BC_B(BHV_SCRIPT_CMD_21)
|
||||
|
||||
// Custom bhv that doesn't face billboards upwards
|
||||
#define CYLBOARD() \
|
||||
BC_B(0x38)
|
||||
BC_B(BHV_SCRIPT_CMD_CYLBOARD)
|
||||
|
||||
// Hides the current object.
|
||||
#define HIDE() \
|
||||
BC_B(0x22)
|
||||
BC_B(BHV_SCRIPT_CMD_22)
|
||||
|
||||
// Sets the size of the object's cylindrical hitbox.
|
||||
#define SET_HITBOX(radius, height) \
|
||||
BC_B(0x23), \
|
||||
BC_B(BHV_SCRIPT_CMD_23), \
|
||||
BC_HH(radius, height)
|
||||
|
||||
// No operation. Unused.
|
||||
#define CMD_NOP_4(field, value) \
|
||||
BC_BBH(0x24, field, value)
|
||||
BC_BBH(BHV_SCRIPT_CMD_24, field, value)
|
||||
|
||||
// Delays the behavior script for the number of frames given by the value of the specified field.
|
||||
#define DELAY_VAR(field) \
|
||||
BC_BB(0x25, field)
|
||||
BC_BB(BHV_SCRIPT_CMD_25, field)
|
||||
|
||||
// Unused. Marks the start of a loop that will repeat a certain number of times.
|
||||
// Uses a u8 as the argument, instead of a s16 like the other version does.
|
||||
#define BEGIN_REPEAT_UNUSED(count) \
|
||||
BC_BB(0x26, count)
|
||||
BC_BB(BHV_SCRIPT_CMD_26, count)
|
||||
|
||||
// Loads the animations for the object. <field> is always set to oAnimations.
|
||||
#define LOAD_ANIMATIONS(field, anims) \
|
||||
BC_BB(0x27, field), \
|
||||
BC_BB(BHV_SCRIPT_CMD_27, field), \
|
||||
BC_PTR(anims)
|
||||
|
||||
// Begins animation and sets the object's current animation index to the specified value.
|
||||
#define ANIMATE(animIndex) \
|
||||
BC_BB(0x28, animIndex)
|
||||
BC_BB(BHV_SCRIPT_CMD_28, animIndex)
|
||||
|
||||
// Spawns a child object with the specified model and behavior, plus a behavior param.
|
||||
#define SPAWN_CHILD_WITH_PARAM(bhvParam, modelID, behavior) \
|
||||
BC_B0H(0x29, bhvParam), \
|
||||
BC_B0H(BHV_SCRIPT_CMD_29, bhvParam), \
|
||||
BC_W(modelID), \
|
||||
BC_PTR(behavior)
|
||||
|
||||
// Loads collision data for the object.
|
||||
#define LOAD_COLLISION_DATA(collisionData) \
|
||||
BC_B(0x2A), \
|
||||
BC_B(BHV_SCRIPT_CMD_2A), \
|
||||
BC_PTR(collisionData)
|
||||
|
||||
// Sets the size of the object's cylindrical hitbox, and applies a downwards offset.
|
||||
#define SET_HITBOX_WITH_OFFSET(radius, height, downOffset) \
|
||||
BC_B(0x2B), \
|
||||
BC_B(BHV_SCRIPT_CMD_2B), \
|
||||
BC_HH(radius, height), \
|
||||
BC_H(downOffset)
|
||||
|
||||
// Spawns a new object with the specified model and behavior.
|
||||
#define SPAWN_OBJ(modelID, behavior) \
|
||||
BC_B(0x2C), \
|
||||
BC_B(BHV_SCRIPT_CMD_2C), \
|
||||
BC_W(modelID), \
|
||||
BC_PTR(behavior)
|
||||
|
||||
// Sets the home position of the object to its current position.
|
||||
#define SET_HOME() \
|
||||
BC_B(0x2D)
|
||||
BC_B(BHV_SCRIPT_CMD_2D)
|
||||
|
||||
// Sets the size of the object's cylindrical hurtbox.
|
||||
#define SET_HURTBOX(radius, height) \
|
||||
BC_B(0x2E), \
|
||||
BC_B(BHV_SCRIPT_CMD_2E), \
|
||||
BC_HH(radius, height)
|
||||
|
||||
// Sets the object's interaction type.
|
||||
#define SET_INTERACT_TYPE(type) \
|
||||
BC_B(0x2F), \
|
||||
BC_B(BHV_SCRIPT_CMD_2F), \
|
||||
BC_W(type)
|
||||
|
||||
// Sets various parameters that the object uses for calculating physics.
|
||||
#define SET_OBJ_PHYSICS(wallHitboxRadius, gravity, bounciness, dragStrength, friction, buoyancy, unused1, unused2) \
|
||||
BC_B(0x30), \
|
||||
BC_B(BHV_SCRIPT_CMD_30), \
|
||||
BC_HH(wallHitboxRadius, gravity), \
|
||||
BC_HH(bounciness, dragStrength), \
|
||||
BC_HH(friction, buoyancy), \
|
||||
|
@ -300,35 +363,35 @@
|
|||
|
||||
// Sets the object's interaction subtype. Unused.
|
||||
#define SET_INTERACT_SUBTYPE(subtype) \
|
||||
BC_B(0x31), \
|
||||
BC_B(BHV_SCRIPT_CMD_31), \
|
||||
BC_W(subtype)
|
||||
|
||||
// Sets the object's size to the specified percentage.
|
||||
#define SCALE(unusedField, percent) \
|
||||
BC_BBH(0x32, unusedField, percent)
|
||||
BC_BBH(BHV_SCRIPT_CMD_32, unusedField, percent)
|
||||
|
||||
// Performs a bit clear on the object's parent's field with the specified value.
|
||||
// Used for clearing active particle flags fron Mario's object.
|
||||
#define PARENT_BIT_CLEAR(field, flags) \
|
||||
BC_BB(0x33, field), \
|
||||
BC_BB(BHV_SCRIPT_CMD_33, field), \
|
||||
BC_W(flags)
|
||||
|
||||
// Animates an object using texture animation. <field> is always set to oAnimState.
|
||||
#define ANIMATE_TEXTURE(field, rate) \
|
||||
BC_BBH(0x34, field, rate)
|
||||
BC_BBH(BHV_SCRIPT_CMD_34, field, rate)
|
||||
|
||||
// Disables rendering for the object.
|
||||
#define DISABLE_RENDERING() \
|
||||
BC_B(0x35)
|
||||
BC_B(BHV_SCRIPT_CMD_35)
|
||||
|
||||
// Unused. Sets the specified field to an integer. Wastes 4 bytes of space for no reason at all.
|
||||
#define SET_INT_UNUSED(field, value) \
|
||||
BC_BB(0x36, field), \
|
||||
BC_BB(BHV_SCRIPT_CMD_36, field), \
|
||||
BC_HH(0, value)
|
||||
|
||||
// Spawns a water droplet with the given parameters.
|
||||
#define SPAWN_WATER_DROPLET(dropletParams) \
|
||||
BC_B(0x37), \
|
||||
BC_B(BHV_SCRIPT_CMD_37), \
|
||||
BC_PTR(dropletParams)
|
||||
|
||||
|
||||
|
|
|
@ -34,193 +34,263 @@
|
|||
#define REGULAR_FACE 0x0002
|
||||
#define DIZZY_FACE 0x0003
|
||||
|
||||
// List of commands as enum for ifdefs
|
||||
// Vanilla ones are left unnamed, custom ones are named
|
||||
enum LevelCommandsIDList
|
||||
{
|
||||
LVL_SCRIPT_CMD_00,
|
||||
LVL_SCRIPT_CMD_01,
|
||||
LVL_SCRIPT_CMD_02,
|
||||
LVL_SCRIPT_CMD_03,
|
||||
LVL_SCRIPT_CMD_04,
|
||||
LVL_SCRIPT_CMD_05,
|
||||
LVL_SCRIPT_CMD_06,
|
||||
LVL_SCRIPT_CMD_07,
|
||||
LVL_SCRIPT_CMD_08,
|
||||
LVL_SCRIPT_CMD_09,
|
||||
LVL_SCRIPT_CMD_0A,
|
||||
LVL_SCRIPT_CMD_0B,
|
||||
LVL_SCRIPT_CMD_0C,
|
||||
LVL_SCRIPT_CMD_0D,
|
||||
LVL_SCRIPT_CMD_0E,
|
||||
LVL_SCRIPT_CMD_0F,
|
||||
LVL_SCRIPT_CMD_10,
|
||||
LVL_SCRIPT_CMD_11,
|
||||
LVL_SCRIPT_CMD_12,
|
||||
LVL_SCRIPT_CMD_13,
|
||||
LVL_SCRIPT_CMD_14,
|
||||
LVL_SCRIPT_CMD_15,
|
||||
LVL_SCRIPT_CMD_16,
|
||||
LVL_SCRIPT_CMD_17,
|
||||
LVL_SCRIPT_CMD_18,
|
||||
LVL_SCRIPT_CMD_19,
|
||||
LVL_SCRIPT_CMD_1A,
|
||||
LVL_SCRIPT_CMD_1B,
|
||||
LVL_SCRIPT_CMD_1C,
|
||||
LVL_SCRIPT_CMD_1D,
|
||||
LVL_SCRIPT_CMD_1E,
|
||||
LVL_SCRIPT_CMD_1F,
|
||||
LVL_SCRIPT_CMD_20,
|
||||
LVL_SCRIPT_CMD_21,
|
||||
LVL_SCRIPT_CMD_22,
|
||||
LVL_SCRIPT_CMD_23,
|
||||
LVL_SCRIPT_CMD_24,
|
||||
LVL_SCRIPT_CMD_25,
|
||||
LVL_SCRIPT_CMD_26,
|
||||
LVL_SCRIPT_CMD_27,
|
||||
LVL_SCRIPT_CMD_28,
|
||||
LVL_SCRIPT_CMD_29,
|
||||
LVL_SCRIPT_CMD_2A,
|
||||
LVL_SCRIPT_CMD_2B,
|
||||
LVL_SCRIPT_CMD_2C,
|
||||
LVL_SCRIPT_CMD_2D,
|
||||
LVL_SCRIPT_CMD_2E,
|
||||
LVL_SCRIPT_CMD_2F,
|
||||
LVL_SCRIPT_CMD_30,
|
||||
LVL_SCRIPT_CMD_31,
|
||||
LVL_SCRIPT_CMD_32,
|
||||
LVL_SCRIPT_CMD_33,
|
||||
LVL_SCRIPT_CMD_34,
|
||||
LVL_SCRIPT_CMD_35,
|
||||
LVL_SCRIPT_CMD_36,
|
||||
LVL_SCRIPT_CMD_37,
|
||||
LVL_SCRIPT_CMD_38,
|
||||
LVL_SCRIPT_CMD_39,
|
||||
LVL_SCRIPT_CMD_3A,
|
||||
LVL_SCRIPT_CMD_3B,
|
||||
LVL_SCRIPT_CMD_3C,
|
||||
#ifdef BETTERCAMERA
|
||||
LVL_SCRIPT_CMD_PUPPYVOLUME,
|
||||
#endif
|
||||
};
|
||||
|
||||
#ifdef NO_SEGMENTED_MEMORY
|
||||
#define EXECUTE(seg, script, scriptEnd, entry) \
|
||||
CMD_BBH(0x00, 0x10, 0x0000), \
|
||||
CMD_BBH(LVL_SCRIPT_CMD_00, 0x10, 0x0000), \
|
||||
CMD_PTR(NULL), \
|
||||
CMD_PTR(NULL), \
|
||||
CMD_PTR(entry)
|
||||
|
||||
#define EXIT_AND_EXECUTE(seg, script, scriptEnd, entry) \
|
||||
CMD_BBH(0x01, 0x10, 0x0000), \
|
||||
CMD_BBH(LVL_SCRIPT_CMD_01, 0x10, 0x0000), \
|
||||
CMD_PTR(NULL), \
|
||||
CMD_PTR(NULL), \
|
||||
CMD_PTR(entry)
|
||||
#else
|
||||
#define EXECUTE(seg, script, scriptEnd, entry) \
|
||||
CMD_BBH(0x00, 0x10, seg), \
|
||||
CMD_BBH(LVL_SCRIPT_CMD_00, 0x10, seg), \
|
||||
CMD_PTR(script), \
|
||||
CMD_PTR(scriptEnd), \
|
||||
CMD_PTR(entry)
|
||||
|
||||
#define EXIT_AND_EXECUTE(seg, script, scriptEnd, entry) \
|
||||
CMD_BBH(0x01, 0x10, seg), \
|
||||
CMD_BBH(LVL_SCRIPT_CMD_01, 0x10, seg), \
|
||||
CMD_PTR(script), \
|
||||
CMD_PTR(scriptEnd), \
|
||||
CMD_PTR(entry)
|
||||
#endif
|
||||
|
||||
#define EXIT() \
|
||||
CMD_BBH(0x02, 0x04, 0x0000)
|
||||
CMD_BBH(LVL_SCRIPT_CMD_02, 0x04, 0x0000)
|
||||
|
||||
#define SLEEP(frames) \
|
||||
CMD_BBH(0x03, 0x04, frames)
|
||||
CMD_BBH(LVL_SCRIPT_CMD_03, 0x04, frames)
|
||||
|
||||
#define SLEEP_BEFORE_EXIT(frames) \
|
||||
CMD_BBH(0x04, 0x04, frames)
|
||||
CMD_BBH(LVL_SCRIPT_CMD_04, 0x04, frames)
|
||||
|
||||
#define JUMP(target) \
|
||||
CMD_BBH(0x05, 0x08, 0x0000), \
|
||||
CMD_BBH(LVL_SCRIPT_CMD_05, 0x08, 0x0000), \
|
||||
CMD_PTR(target)
|
||||
|
||||
#define JUMP_LINK(target) \
|
||||
CMD_BBH(0x06, 0x08, 0x0000), \
|
||||
CMD_BBH(LVL_SCRIPT_CMD_06, 0x08, 0x0000), \
|
||||
CMD_PTR(target)
|
||||
|
||||
#define RETURN() \
|
||||
CMD_BBH(0x07, 0x04, 0x0000)
|
||||
CMD_BBH(LVL_SCRIPT_CMD_07, 0x04, 0x0000)
|
||||
|
||||
#define JUMP_LINK_PUSH_ARG(arg) \
|
||||
CMD_BBH(0x08, 0x04, arg)
|
||||
CMD_BBH(LVL_SCRIPT_CMD_08, 0x04, arg)
|
||||
|
||||
#define JUMP_N_TIMES() \
|
||||
CMD_BBH(0x09, 0x04, 0x0000)
|
||||
CMD_BBH(LVL_SCRIPT_CMD_09, 0x04, 0x0000)
|
||||
|
||||
#define LOOP_BEGIN() \
|
||||
CMD_BBH(0x0A, 0x04, 0x0000)
|
||||
CMD_BBH(LVL_SCRIPT_CMD_0A, 0x04, 0x0000)
|
||||
|
||||
#define LOOP_UNTIL(op, arg) \
|
||||
CMD_BBBB(0x0B, 0x08, op, 0x00), \
|
||||
CMD_BBBB(LVL_SCRIPT_CMD_0B, 0x08, op, 0x00), \
|
||||
CMD_W(arg)
|
||||
|
||||
#define JUMP_IF(op, arg, target) \
|
||||
CMD_BBBB(0x0C, 0x0C, op, 0x00), \
|
||||
CMD_BBBB(LVL_SCRIPT_CMD_0C, 0x0C, op, 0x00), \
|
||||
CMD_W(arg), \
|
||||
CMD_PTR(target)
|
||||
|
||||
#define JUMP_LINK_IF(op, arg, target) \
|
||||
CMD_BBBB(0x0D, 0x0C, op, 0x00), \
|
||||
CMD_BBBB(LVL_SCRIPT_CMD_0D, 0x0C, op, 0x00), \
|
||||
CMD_W(arg), \
|
||||
CMD_PTR(target)
|
||||
|
||||
|
||||
#define SKIP_IF(op, arg) \
|
||||
CMD_BBBB(0x0E, 0x08, op, 0) \
|
||||
CMD_BBBB(LVL_SCRIPT_CMD_0E, 0x08, op, 0) \
|
||||
CMD_W(arg)
|
||||
|
||||
#define SKIP() \
|
||||
CMD_BBH(0x0F, 0x04, 0x0000)
|
||||
CMD_BBH(LVL_SCRIPT_CMD_0F, 0x04, 0x0000)
|
||||
|
||||
#define SKIP_NOP() \
|
||||
CMD_BBH(0x10, 0x04, 0x0000)
|
||||
CMD_BBH(LVL_SCRIPT_CMD_10, 0x04, 0x0000)
|
||||
|
||||
#define CALL(arg, func) \
|
||||
CMD_BBH(0x11, 0x08, arg), \
|
||||
CMD_BBH(LVL_SCRIPT_CMD_11, 0x08, arg), \
|
||||
CMD_PTR(func)
|
||||
|
||||
// Calls func in a loop until it returns nonzero
|
||||
#define CALL_LOOP(arg, func) \
|
||||
CMD_BBH(0x12, 0x08, arg), \
|
||||
CMD_BBH(LVL_SCRIPT_CMD_12, 0x08, arg), \
|
||||
CMD_PTR(func)
|
||||
|
||||
#define SET_REG(value) \
|
||||
CMD_BBH(0x13, 0x04, value)
|
||||
CMD_BBH(LVL_SCRIPT_CMD_13, 0x04, value)
|
||||
|
||||
#define PUSH_POOL() \
|
||||
CMD_BBH(0x14, 0x04, 0x0000)
|
||||
CMD_BBH(LVL_SCRIPT_CMD_14, 0x04, 0x0000)
|
||||
|
||||
#define POP_POOL() \
|
||||
CMD_BBH(0x15, 0x04, 0x0000)
|
||||
CMD_BBH(LVL_SCRIPT_CMD_15, 0x04, 0x0000)
|
||||
|
||||
#ifdef NO_SEGMENTED_MEMORY
|
||||
#define FIXED_LOAD(loadAddr, romStart, romEnd) \
|
||||
CMD_BBH(0x16, 0x10, 0x0000), \
|
||||
CMD_BBH(LVL_SCRIPT_CMD_16, 0x10, 0x0000), \
|
||||
CMD_PTR(NULL), \
|
||||
CMD_PTR(NULL), \
|
||||
CMD_PTR(NULL)
|
||||
|
||||
#define LOAD_RAW(seg, romStart, romEnd) \
|
||||
CMD_BBH(0x17, 0x0C, 0x0000), \
|
||||
CMD_BBH(LVL_SCRIPT_CMD_17, 0x0C, 0x0000), \
|
||||
CMD_PTR(NULL), \
|
||||
CMD_PTR(NULL)
|
||||
|
||||
#define LOAD_MIO0(seg, romStart, romEnd) \
|
||||
CMD_BBH(0x18, 0x0C, 0x0000), \
|
||||
CMD_BBH(LVL_SCRIPT_CMD_18, 0x0C, 0x0000), \
|
||||
CMD_PTR(NULL), \
|
||||
CMD_PTR(NULL)
|
||||
#else
|
||||
#define FIXED_LOAD(loadAddr, romStart, romEnd) \
|
||||
CMD_BBH(0x16, 0x10, 0x0000), \
|
||||
CMD_BBH(LVL_SCRIPT_CMD_16, 0x10, 0x0000), \
|
||||
CMD_PTR(loadAddr), \
|
||||
CMD_PTR(romStart), \
|
||||
CMD_PTR(romEnd)
|
||||
|
||||
#define LOAD_RAW(seg, romStart, romEnd) \
|
||||
CMD_BBH(0x17, 0x0C, seg), \
|
||||
CMD_BBH(LVL_SCRIPT_CMD_17, 0x0C, seg), \
|
||||
CMD_PTR(romStart), \
|
||||
CMD_PTR(romEnd)
|
||||
|
||||
#define LOAD_MIO0(seg, romStart, romEnd) \
|
||||
CMD_BBH(0x18, 0x0C, seg), \
|
||||
CMD_BBH(LVL_SCRIPT_CMD_18, 0x0C, seg), \
|
||||
CMD_PTR(romStart), \
|
||||
CMD_PTR(romEnd)
|
||||
#endif
|
||||
|
||||
#ifdef GODDARD_MFACE
|
||||
#define LOAD_MARIO_HEAD(sethead) \
|
||||
CMD_BBH(0x19, 0x04, sethead)
|
||||
CMD_BBH(LVL_SCRIPT_CMD_19, 0x04, sethead)
|
||||
#else
|
||||
#define LOAD_MARIO_HEAD(sethead) \
|
||||
CMD_BBH(0x19, 0x04, NULL)
|
||||
CMD_BBH(LVL_SCRIPT_CMD_19, 0x04, NULL)
|
||||
#endif
|
||||
|
||||
#ifdef NO_SEGMENTED_MEMORY
|
||||
#define LOAD_MIO0_TEXTURE(seg, romStart, romEnd) \
|
||||
CMD_BBH(0x1A, 0x0C, 0x0000), \
|
||||
CMD_BBH(LVL_SCRIPT_CMD_1A, 0x0C, 0x0000), \
|
||||
CMD_PTR(NULL), \
|
||||
CMD_PTR(NULL)
|
||||
#else
|
||||
#define LOAD_MIO0_TEXTURE(seg, romStart, romEnd) \
|
||||
CMD_BBH(0x1A, 0x0C, seg), \
|
||||
CMD_BBH(LVL_SCRIPT_CMD_1A, 0x0C, seg), \
|
||||
CMD_PTR(romStart), \
|
||||
CMD_PTR(romEnd)
|
||||
#endif
|
||||
|
||||
#define INIT_LEVEL() \
|
||||
CMD_BBH(0x1B, 0x04, 0x0000)
|
||||
CMD_BBH(LVL_SCRIPT_CMD_1B, 0x04, 0x0000)
|
||||
|
||||
#define CLEAR_LEVEL() \
|
||||
CMD_BBH(0x1C, 0x04, 0x0000)
|
||||
CMD_BBH(LVL_SCRIPT_CMD_1C, 0x04, 0x0000)
|
||||
|
||||
#define ALLOC_LEVEL_POOL() \
|
||||
CMD_BBH(0x1D, 0x04, 0x0000)
|
||||
CMD_BBH(LVL_SCRIPT_CMD_1D, 0x04, 0x0000)
|
||||
|
||||
#define FREE_LEVEL_POOL() \
|
||||
CMD_BBH(0x1E, 0x04, 0x0000)
|
||||
CMD_BBH(LVL_SCRIPT_CMD_1E, 0x04, 0x0000)
|
||||
|
||||
#define AREA(index, geo) \
|
||||
CMD_BBBB(0x1F, 0x08, index, 0), \
|
||||
CMD_BBBB(LVL_SCRIPT_CMD_1F, 0x08, index, 0), \
|
||||
CMD_PTR(geo)
|
||||
|
||||
#define END_AREA() \
|
||||
CMD_BBH(0x20, 0x04, 0x0000)
|
||||
CMD_BBH(LVL_SCRIPT_CMD_20, 0x04, 0x0000)
|
||||
|
||||
#define LOAD_MODEL_FROM_DL(model, dl, layer) \
|
||||
CMD_BBH(0x21, 0x08, ((layer << 12) | model)), \
|
||||
CMD_BBH(LVL_SCRIPT_CMD_21, 0x08, ((layer << 12) | model)), \
|
||||
CMD_PTR(dl)
|
||||
|
||||
#define LOAD_MODEL_FROM_GEO(model, geo) \
|
||||
CMD_BBH(0x22, 0x08, model), \
|
||||
CMD_BBH(LVL_SCRIPT_CMD_22, 0x08, model), \
|
||||
CMD_PTR(geo)
|
||||
|
||||
// unk8 is float, but doesn't really matter since CMD23 is unused
|
||||
#define CMD23(model, unk4, unk8) \
|
||||
CMD_BBH(0x22, 0x08, model), \
|
||||
CMD_BBH(LVL_SCRIPT_CMD_23, 0x08, model), \
|
||||
CMD_PTR(unk4), \
|
||||
CMD_W(unk8)
|
||||
|
||||
#define OBJECT_WITH_ACTS(model, posX, posY, posZ, angleX, angleY, angleZ, behParam, beh, acts) \
|
||||
CMD_BBBB(0x24, 0x18, acts, model), \
|
||||
CMD_BBBB(LVL_SCRIPT_CMD_24, 0x18, acts, model), \
|
||||
CMD_HHHHHH(posX, posY, posZ, angleX, angleY, angleZ), \
|
||||
CMD_W(behParam), \
|
||||
CMD_PTR(beh)
|
||||
|
@ -229,95 +299,95 @@
|
|||
OBJECT_WITH_ACTS(model, posX, posY, posZ, angleX, angleY, angleZ, behParam, beh, 0x1F)
|
||||
|
||||
#define MARIO(unk3, behArg, beh) \
|
||||
CMD_BBBB(0x25, 0x0C, 0x00, unk3), \
|
||||
CMD_BBBB(LVL_SCRIPT_CMD_25, 0x0C, 0x00, unk3), \
|
||||
CMD_W(behArg), \
|
||||
CMD_PTR(beh)
|
||||
|
||||
#define WARP_NODE(id, destLevel, destArea, destNode, flags) \
|
||||
CMD_BBBB(0x26, 0x08, id, destLevel), \
|
||||
CMD_BBBB(LVL_SCRIPT_CMD_26, 0x08, id, destLevel), \
|
||||
CMD_BBBB(destArea, destNode, flags, 0x00)
|
||||
|
||||
#define PAINTING_WARP_NODE(id, destLevel, destArea, destNode, flags) \
|
||||
CMD_BBBB(0x27, 0x08, id, destLevel), \
|
||||
CMD_BBBB(LVL_SCRIPT_CMD_27, 0x08, id, destLevel), \
|
||||
CMD_BBBB(destArea, destNode, flags, 0x00)
|
||||
|
||||
#define INSTANT_WARP(index, destArea, displaceX, displaceY, displaceZ) \
|
||||
CMD_BBBB(0x28, 0x0C, index, destArea), \
|
||||
CMD_BBBB(LVL_SCRIPT_CMD_28, 0x0C, index, destArea), \
|
||||
CMD_HH(displaceX, displaceY), \
|
||||
CMD_HH(displaceZ, 0x0000)
|
||||
|
||||
#define LOAD_AREA(area) \
|
||||
CMD_BBBB(0x29, 0x04, area, 0x00)
|
||||
CMD_BBBB(LVL_SCRIPT_CMD_29, 0x04, area, 0x00)
|
||||
|
||||
#define CMD2A(unk2) \
|
||||
CMD_BBBB(0x2A, 0x04, unk2, 0x00)
|
||||
CMD_BBBB(LVL_SCRIPT_CMD_2A, 0x04, unk2, 0x00)
|
||||
|
||||
#define MARIO_POS(area, yaw, posX, posY, posZ) \
|
||||
CMD_BBBB(0x2B, 0x0C, area, 0x00), \
|
||||
CMD_BBBB(LVL_SCRIPT_CMD_2B, 0x0C, area, 0x00), \
|
||||
CMD_HH(yaw, posX), \
|
||||
CMD_HH(posY, posZ)
|
||||
|
||||
// unused
|
||||
#define CMD2C() \
|
||||
CMD_BBH(0x2C, 0x04, 0x0000)
|
||||
CMD_BBH(LVL_SCRIPT_CMD_2C, 0x04, 0x0000)
|
||||
|
||||
// unused
|
||||
#define CMD2D() \
|
||||
CMD_BBH(0x2D, 0x04, 0x0000)
|
||||
CMD_BBH(LVL_SCRIPT_CMD_2D, 0x04, 0x0000)
|
||||
|
||||
#define TERRAIN(terrainData) \
|
||||
CMD_BBH(0x2E, 0x08, 0x0000), \
|
||||
CMD_BBH(LVL_SCRIPT_CMD_2E, 0x08, 0x0000), \
|
||||
CMD_PTR(terrainData)
|
||||
|
||||
#define ROOMS(surfaceRooms) \
|
||||
CMD_BBH(0x2F, 0x08, 0x0000), \
|
||||
CMD_BBH(LVL_SCRIPT_CMD_2F, 0x08, 0x0000), \
|
||||
CMD_PTR(surfaceRooms)
|
||||
|
||||
#define SHOW_DIALOG(index, dialogId) \
|
||||
CMD_BBBB(0x30, 0x04, index, dialogId)
|
||||
CMD_BBBB(LVL_SCRIPT_CMD_30, 0x04, index, dialogId)
|
||||
|
||||
#define TERRAIN_TYPE(terrainType) \
|
||||
CMD_BBH(0x31, 0x04, terrainType)
|
||||
CMD_BBH(LVL_SCRIPT_CMD_31, 0x04, terrainType)
|
||||
|
||||
#define NOP() \
|
||||
CMD_BBH(0x32, 0x04, 0x0000)
|
||||
CMD_BBH(LVL_SCRIPT_CMD_32, 0x04, 0x0000)
|
||||
|
||||
#define TRANSITION(transType, time, colorR, colorG, colorB) \
|
||||
CMD_BBBB(0x33, 0x08, transType, time), \
|
||||
CMD_BBBB(LVL_SCRIPT_CMD_33, 0x08, transType, time), \
|
||||
CMD_BBBB(colorR, colorG, colorB, 0x00)
|
||||
|
||||
#define BLACKOUT(active) \
|
||||
CMD_BBBB(0x34, 0x04, active, 0x00)
|
||||
CMD_BBBB(LVL_SCRIPT_CMD_34, 0x04, active, 0x00)
|
||||
|
||||
#define GAMMA(enabled) \
|
||||
CMD_BBBB(0x35, 0x04, enabled, 0x00)
|
||||
CMD_BBBB(LVL_SCRIPT_CMD_35, 0x04, enabled, 0x00)
|
||||
|
||||
#define SET_BACKGROUND_MUSIC(settingsPreset, seq) \
|
||||
CMD_BBH(0x36, 0x08, settingsPreset), \
|
||||
CMD_BBH(LVL_SCRIPT_CMD_36, 0x08, settingsPreset), \
|
||||
CMD_HH(seq, 0x0000)
|
||||
|
||||
#define SET_MENU_MUSIC(seq) \
|
||||
CMD_BBH(0x37, 0x04, seq)
|
||||
CMD_BBH(LVL_SCRIPT_CMD_37, 0x04, seq)
|
||||
|
||||
#define STOP_MUSIC(fadeOutTime) \
|
||||
CMD_BBH(0x38, 0x04, fadeOutTime)
|
||||
CMD_BBH(LVL_SCRIPT_CMD_38, 0x04, fadeOutTime)
|
||||
|
||||
#define MACRO_OBJECTS(objList) \
|
||||
CMD_BBH(0x39, 0x08, 0x0000), \
|
||||
CMD_BBH(LVL_SCRIPT_CMD_39, 0x08, 0x0000), \
|
||||
CMD_PTR(objList)
|
||||
|
||||
// unused
|
||||
#define CMD3A(unk2, unk4, unk6, unk8, unk10) \
|
||||
CMD_BBH(0x3A, 0x0C, unk2), \
|
||||
CMD_BBH(LVL_SCRIPT_CMD_3A, 0x0C, unk2), \
|
||||
CMD_HH(unk6, unk8), \
|
||||
CMD_HH(unk10, 0x0000)
|
||||
|
||||
#define WHIRLPOOL(index, condition, posX, posY, posZ, strength) \
|
||||
CMD_BBBB(0x3B, 0x0C, index, condition), \
|
||||
CMD_BBBB(LVL_SCRIPT_CMD_3B, 0x0C, index, condition), \
|
||||
CMD_HH(posX, posY), \
|
||||
CMD_HH(posZ, strength)
|
||||
|
||||
#define GET_OR_SET(op, var) \
|
||||
CMD_BBBB(0x3C, 0x04, op, var)
|
||||
CMD_BBBB(LVL_SCRIPT_CMD_3C, 0x04, op, var)
|
||||
|
||||
#endif // LEVEL_COMMANDS_H
|
||||
|
|
|
@ -140,7 +140,7 @@ static s32 bhv_cmd_billboard(void) {
|
|||
return BHV_PROC_CONTINUE;
|
||||
}
|
||||
|
||||
// Command 0x
|
||||
// Custom bhv that doesn't face billboards upwards
|
||||
static s32 bhv_cmd_cylboard(void) {
|
||||
gCurrentObject->header.gfx.node.flags |= GRAPH_RENDER_CYLBOARD;
|
||||
|
||||
|
@ -908,7 +908,7 @@ static BhvCommandProc BehaviorCmdTable[] = {
|
|||
bhv_cmd_disable_rendering, //35
|
||||
bhv_cmd_set_int_unused, //36
|
||||
bhv_cmd_spawn_water_droplet, //37
|
||||
bhv_cmd_cylboard //38
|
||||
bhv_cmd_cylboard, //38
|
||||
};
|
||||
|
||||
// Execute the behavior script of the current object, process the object flags, and other miscellaneous code for updating objects.
|
||||
|
|
|
@ -3,6 +3,8 @@
|
|||
|
||||
#ifdef BETTERCAMERA
|
||||
|
||||
#include "level_commands.h"
|
||||
|
||||
#define PUPPYCAM_FLAGS_CUTSCENE 0x0001
|
||||
#define PUPPYCAM_FLAGS_SMOOTH 0x0002
|
||||
|
||||
|
@ -31,7 +33,7 @@ extern const u8 optsCameraStr[][32];
|
|||
extern struct SubMenu menuCamera;
|
||||
|
||||
#define PUPPYVOLUME(x, y, z, length, height, width, yaw, functionptr, anglesptr, addflags, removeflags, flagpersistance, room, shape) \
|
||||
CMD_BBH(0x3D, 0x24, x), \
|
||||
CMD_BBH(LVL_SCRIPT_CMD_PUPPYVOLUME, 0x24, x), \
|
||||
CMD_HHHHHH(y, z, length, height, width, yaw), \
|
||||
CMD_PTR(functionptr), \
|
||||
CMD_PTR(anglesptr), \
|
||||
|
|
Loading…
Add table
Reference in a new issue