Eyerok can now get attacked by remote players

This commit is contained in:
MysterD 2023-10-27 01:03:20 -07:00
parent f7f10b9881
commit 30ca5bf018
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) {
// skip interactions for remote
continue;
}
if (m->collidedObjInteractTypes & interactType) { if (m->collidedObjInteractTypes & interactType) {
struct Object *object = mario_get_collided_object(m, 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; 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