diff --git a/autogen/lua_definitions/constants.lua b/autogen/lua_definitions/constants.lua index 99a90f86..68bb10ad 100644 --- a/autogen/lua_definitions/constants.lua +++ b/autogen/lua_definitions/constants.lua @@ -4739,6 +4739,9 @@ ACTIVE_FLAG_DEACTIVATED = 0 --- @type integer ACTIVE_FLAG_DITHERED_ALPHA = (1 << 7) +--- @type integer +ACTIVE_FLAG_DORMANT = (1 << 11) + --- @type integer ACTIVE_FLAG_FAR_AWAY = (1 << 1) diff --git a/autogen/lua_definitions/structs.lua b/autogen/lua_definitions/structs.lua index 8ebf8bd3..d5c29f91 100644 --- a/autogen/lua_definitions/structs.lua +++ b/autogen/lua_definitions/structs.lua @@ -658,6 +658,7 @@ --- @field public vanishCapSequence integer --- @field public wingCapDuration integer --- @field public wingCapDurationTotwc integer +--- @field public wingCapLookUpReq integer --- @field public wingCapSequence integer --- @class LinearTransitionPoint @@ -759,7 +760,6 @@ --- @field public unkC4 number --- @field public usedObj Object --- @field public vel Vec3f ---- @field public visibleToEnemies integer --- @field public wall Surface --- @field public wallKickTimer integer --- @field public wallNormal Vec3f diff --git a/docs/lua/constants.md b/docs/lua/constants.md index 7a4a1685..8d1e0121 100644 --- a/docs/lua/constants.md +++ b/docs/lua/constants.md @@ -1697,6 +1697,7 @@ - ACTIVE_FLAG_ACTIVE - ACTIVE_FLAG_DEACTIVATED - ACTIVE_FLAG_DITHERED_ALPHA +- ACTIVE_FLAG_DORMANT - ACTIVE_FLAG_FAR_AWAY - ACTIVE_FLAG_INITIATED_TIME_STOP - ACTIVE_FLAG_IN_DIFFERENT_ROOM diff --git a/docs/lua/structs.md b/docs/lua/structs.md index f8b1ac37..d52a4c5e 100644 --- a/docs/lua/structs.md +++ b/docs/lua/structs.md @@ -956,6 +956,7 @@ | vanishCapSequence | `integer` | | | wingCapDuration | `integer` | | | wingCapDurationTotwc | `integer` | | +| wingCapLookUpReq | `integer` | | | wingCapSequence | `integer` | | [:arrow_up_small:](#) @@ -1085,7 +1086,6 @@ | unkC4 | `number` | | | usedObj | [Object](structs.md#Object) | | | vel | [Vec3f](structs.md#Vec3f) | read-only | -| visibleToEnemies | `integer` | | | wall | [Surface](structs.md#Surface) | | | wallKickTimer | `integer` | | | wallNormal | [Vec3f](structs.md#Vec3f) | read-only | diff --git a/include/object_constants.h b/include/object_constants.h index 71d186f1..e0b33e8b 100644 --- a/include/object_constants.h +++ b/include/object_constants.h @@ -17,6 +17,7 @@ #define ACTIVE_FLAG_UNK8 (1 << 8) // 0x0100 #define ACTIVE_FLAG_UNK9 (1 << 9) // 0x0200 #define ACTIVE_FLAG_UNK10 (1 << 10) // 0x0400 +#define ACTIVE_FLAG_DORMANT (1 << 11) // 0x0800 /* respawnInfoType */ diff --git a/src/engine/behavior_script.c b/src/engine/behavior_script.c index dff439ac..a7649a32 100644 --- a/src/engine/behavior_script.c +++ b/src/engine/behavior_script.c @@ -20,6 +20,7 @@ #include "pc/lua/smlua_hooks.h" #include "pc/lua/smlua_utils.h" #include "game/rng_position.h" +#include "game/interaction.h" // Macros for retrieving arguments from behavior scripts. #define BHV_CMD_GET_1ST_U8(index) (u8)((gCurBhvCommand[index] >> 24) & 0xFF) // unused @@ -1260,6 +1261,13 @@ static BhvCommandProc BehaviorCmdTable[] = { // Execute the behavior script of the current object, process the object flags, and other miscellaneous code for updating objects. void cur_obj_update(void) { + // Don't update if dormant + if (gCurrentObject->activeFlags & ACTIVE_FLAG_DORMANT) { + gCurrentObject->header.gfx.node.flags &= ~GRAPH_RENDER_ACTIVE; + gCurrentObject->oInteractStatus = INT_STATUS_INTERACTED; + return; + } + // handle network area timer if (gCurrentObject->areaTimerType != AREA_TIMER_TYPE_NONE) { // make sure the area is valid diff --git a/src/pc/lua/smlua_cobject_autogen.c b/src/pc/lua/smlua_cobject_autogen.c index 84e3124b..dd4c43b0 100644 --- a/src/pc/lua/smlua_cobject_autogen.c +++ b/src/pc/lua/smlua_cobject_autogen.c @@ -733,7 +733,7 @@ static struct LuaObjectField sLakituStateFields[LUA_LAKITU_STATE_FIELD_COUNT] = { "yaw", LVT_S16, offsetof(struct LakituState, yaw), false, LOT_NONE }, }; -#define LUA_LEVEL_VALUES_FIELD_COUNT 26 +#define LUA_LEVEL_VALUES_FIELD_COUNT 27 static struct LuaObjectField sLevelValuesFields[LUA_LEVEL_VALUES_FIELD_COUNT] = { { "cellHeightLimit", LVT_S16, offsetof(struct LevelValues, cellHeightLimit), false, LOT_NONE }, { "coinsRequiredForCoinStar", LVT_S16, offsetof(struct LevelValues, coinsRequiredForCoinStar), false, LOT_NONE }, @@ -760,6 +760,7 @@ static struct LuaObjectField sLevelValuesFields[LUA_LEVEL_VALUES_FIELD_COUNT] = { "vanishCapSequence", LVT_U8, offsetof(struct LevelValues, vanishCapSequence), false, LOT_NONE }, { "wingCapDuration", LVT_U16, offsetof(struct LevelValues, wingCapDuration), false, LOT_NONE }, { "wingCapDurationTotwc", LVT_U16, offsetof(struct LevelValues, wingCapDurationTotwc), false, LOT_NONE }, + { "wingCapLookUpReq", LVT_U8, offsetof(struct LevelValues, wingCapLookUpReq), false, LOT_NONE }, { "wingCapSequence", LVT_U8, offsetof(struct LevelValues, wingCapSequence), false, LOT_NONE }, }; @@ -799,7 +800,7 @@ static struct LuaObjectField sMarioBodyStateFields[LUA_MARIO_BODY_STATE_FIELD_CO { "wingFlutter", LVT_S8, offsetof(struct MarioBodyState, wingFlutter), false, LOT_NONE }, }; -#define LUA_MARIO_STATE_FIELD_COUNT 77 +#define LUA_MARIO_STATE_FIELD_COUNT 76 static struct LuaObjectField sMarioStateFields[LUA_MARIO_STATE_FIELD_COUNT] = { { "action", LVT_U32, offsetof(struct MarioState, action), false, LOT_NONE }, { "actionArg", LVT_U32, offsetof(struct MarioState, actionArg), false, LOT_NONE }, @@ -872,7 +873,6 @@ static struct LuaObjectField sMarioStateFields[LUA_MARIO_STATE_FIELD_COUNT] = { { "unkC4", LVT_F32, offsetof(struct MarioState, unkC4), false, LOT_NONE }, { "usedObj", LVT_COBJECT_P, offsetof(struct MarioState, usedObj), false, LOT_OBJECT }, { "vel", LVT_COBJECT, offsetof(struct MarioState, vel), true, LOT_VEC3F }, - { "visibleToEnemies", LVT_U8, offsetof(struct MarioState, visibleToEnemies), false, LOT_NONE }, { "wall", LVT_COBJECT_P, offsetof(struct MarioState, wall), false, LOT_SURFACE }, { "wallKickTimer", LVT_U8, offsetof(struct MarioState, wallKickTimer), false, LOT_NONE }, { "wallNormal", LVT_COBJECT, offsetof(struct MarioState, wallNormal), true, LOT_VEC3F }, diff --git a/src/pc/lua/smlua_constants_autogen.c b/src/pc/lua/smlua_constants_autogen.c index 17fe16cc..494fd690 100644 --- a/src/pc/lua/smlua_constants_autogen.c +++ b/src/pc/lua/smlua_constants_autogen.c @@ -1768,6 +1768,7 @@ char gSmluaConstants[] = "" "ACTIVE_FLAG_UNK8 = (1 << 8)\n" "ACTIVE_FLAG_UNK9 = (1 << 9)\n" "ACTIVE_FLAG_UNK10 = (1 << 10)\n" +"ACTIVE_FLAG_DORMANT = (1 << 11)\n" "RESPAWN_INFO_TYPE_NULL = 0\n" "RESPAWN_INFO_TYPE_32 = 1\n" "RESPAWN_INFO_TYPE_16 = 2\n"