ACTIVE_FLAG_DORMANT (#281)

This commit is contained in:
Isaac0-dev 2023-02-19 14:45:13 +10:00 committed by GitHub
parent 3f7f5da50e
commit 3bc0b13e20
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 19 additions and 5 deletions

View File

@ -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)

View File

@ -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

View File

@ -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

View File

@ -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 |

View File

@ -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 */

View File

@ -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

View File

@ -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 },

View File

@ -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"