Eyerok can now get attacked by remote players

This commit is contained in:
David Joslin 2023-10-27 01:03:20 -07:00
parent 8fe77eaf9f
commit cf20658079
7 changed files with 13 additions and 5 deletions

View file

@ -869,6 +869,7 @@
--- @class Object
--- @field public activeFlags integer
--- @field public allowRemoteInteractions integer
--- @field public areaTimer integer
--- @field public areaTimerDuration integer
--- @field public areaTimerType AreaTimerType

View file

@ -1250,6 +1250,7 @@
| Field | Type | Access |
| ----- | ---- | ------ |
| activeFlags | `integer` | |
| allowRemoteInteractions | `integer` | |
| areaTimer | `integer` | |
| areaTimerDuration | `integer` | |
| areaTimerType | [enum AreaTimerType](constants.md#enum-AreaTimerType) | |

View file

@ -243,6 +243,7 @@ struct Object
/*?????*/ struct Object* usingObj;
/*?????*/ u8 hookRender;
/*?????*/ u8 setHome;
/*?????*/ u8 allowRemoteInteractions;
/*?????*/ u8 ctx;
};

View file

@ -622,6 +622,7 @@ static void eyerok_hand_act_double_pound(void) {
void bhv_eyerok_hand_loop(void) {
if (!o->parentObj) { return; }
o->allowRemoteInteractions = TRUE;
if (o->oAction == EYEROK_HAND_ACT_DEAD) {
eyerok_hand_act_die_event();
return;

View file

@ -2307,12 +2307,14 @@ void mario_process_interactions(struct MarioState *m) {
s32 i;
for (i = 0; i < 32; i++) {
u32 interactType = sInteractionHandlers[i].interactType;
if (m->playerIndex != 0 && interactType != (u32)INTERACT_PLAYER && interactType != (u32)INTERACT_POLE) {
// skip interactions for remote
continue;
}
if (m->collidedObjInteractTypes & interactType) {
struct Object *object = mario_get_collided_object(m, interactType);
bool allowRemoteInteractions = object && object->allowRemoteInteractions;
if (m->playerIndex != 0 && interactType != (u32)INTERACT_PLAYER && interactType != (u32)INTERACT_POLE && !allowRemoteInteractions) {
// skip interactions for remote
continue;
}
m->collidedObjInteractTypes &= ~interactType;

View file

@ -333,6 +333,7 @@ struct Object *allocate_object(struct ObjectNode *objList) {
obj->areaTimerDuration = 0;
obj->areaTimerRunOnceCallback = NULL;
obj->setHome = FALSE;
obj->allowRemoteInteractions = FALSE;
obj->usingObj = NULL;

View file

@ -993,9 +993,10 @@ static struct LuaObjectField sNetworkPlayerFields[LUA_NETWORK_PLAYER_FIELD_COUNT
{ "type", LVT_U8, offsetof(struct NetworkPlayer, type), true, LOT_NONE },
};
#define LUA_OBJECT_FIELD_COUNT 757
#define LUA_OBJECT_FIELD_COUNT 758
static struct LuaObjectField sObjectFields[LUA_OBJECT_FIELD_COUNT] = {
{ "activeFlags", LVT_S16, offsetof(struct Object, activeFlags), false, LOT_NONE },
{ "allowRemoteInteractions", LVT_U8, offsetof(struct Object, allowRemoteInteractions), false, LOT_NONE },
{ "areaTimer", LVT_U32, offsetof(struct Object, areaTimer), false, LOT_NONE },
{ "areaTimerDuration", LVT_U32, offsetof(struct Object, areaTimerDuration), false, LOT_NONE },
// { "areaTimerRunOnceCallback)(void)", LVT_???, offsetof(struct Object, areaTimerRunOnceCallback)(void)), false, LOT_??? }, <--- UNIMPLEMENTED