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 --- @class Object
--- @field public activeFlags integer --- @field public activeFlags integer
--- @field public allowRemoteInteractions integer
--- @field public areaTimer integer --- @field public areaTimer integer
--- @field public areaTimerDuration integer --- @field public areaTimerDuration integer
--- @field public areaTimerType AreaTimerType --- @field public areaTimerType AreaTimerType

View file

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

View file

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

View file

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

View file

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

View file

@ -333,6 +333,7 @@ struct Object *allocate_object(struct ObjectNode *objList) {
obj->areaTimerDuration = 0; obj->areaTimerDuration = 0;
obj->areaTimerRunOnceCallback = NULL; obj->areaTimerRunOnceCallback = NULL;
obj->setHome = FALSE; obj->setHome = FALSE;
obj->allowRemoteInteractions = FALSE;
obj->usingObj = NULL; 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 }, { "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] = { static struct LuaObjectField sObjectFields[LUA_OBJECT_FIELD_COUNT] = {
{ "activeFlags", LVT_S16, offsetof(struct Object, activeFlags), false, LOT_NONE }, { "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 }, { "areaTimer", LVT_U32, offsetof(struct Object, areaTimer), false, LOT_NONE },
{ "areaTimerDuration", LVT_U32, offsetof(struct Object, areaTimerDuration), false, LOT_NONE }, { "areaTimerDuration", LVT_U32, offsetof(struct Object, areaTimerDuration), false, LOT_NONE },
// { "areaTimerRunOnceCallback)(void)", LVT_???, offsetof(struct Object, areaTimerRunOnceCallback)(void)), false, LOT_??? }, <--- UNIMPLEMENTED // { "areaTimerRunOnceCallback)(void)", LVT_???, offsetof(struct Object, areaTimerRunOnceCallback)(void)), false, LOT_??? }, <--- UNIMPLEMENTED