Resynchronized piranha plants

This commit is contained in:
MysterD 2020-09-21 18:15:49 -07:00
parent fef41ed741
commit 378ab6edc1
4 changed files with 3 additions and 8 deletions

View file

@ -40,7 +40,6 @@ struct SyncObject* boo_network_init_object(void) {
network_init_object_field(o, &o->oInteractType); network_init_object_field(o, &o->oInteractType);
network_init_object_field(o, &o->oOpacity); network_init_object_field(o, &o->oOpacity);
network_init_object_field(o, &o->oRoom); network_init_object_field(o, &o->oRoom);
network_init_object_field(o, &o->oIntangibleTimer);
return so; return so;
} }

View file

@ -61,7 +61,6 @@ void bhv_mips_init(void) {
network_init_object_field(o, &o->oBehParams2ndByte); network_init_object_field(o, &o->oBehParams2ndByte);
network_init_object_field(o, &o->oHeldState); network_init_object_field(o, &o->oHeldState);
network_init_object_field(o, &o->oFlags); network_init_object_field(o, &o->oFlags);
network_init_object_field(o, &o->oIntangibleTimer);
so->on_received_pre = bhv_mips_on_received_pre; so->on_received_pre = bhv_mips_on_received_pre;
so->on_received_post = bhv_mips_on_received_post; so->on_received_post = bhv_mips_on_received_post;
} }

View file

@ -238,7 +238,6 @@ void piranha_plant_act_respawn(void) {
} else { } else {
o->oPiranhaPlantScale = 1.0f; o->oPiranhaPlantScale = 1.0f;
o->oAction = PIRANHA_PLANT_ACT_IDLE; o->oAction = PIRANHA_PLANT_ACT_IDLE;
if (network_owns_object(o)) { network_send_object(o); }
} }
cur_obj_scale(o->oPiranhaPlantScale); cur_obj_scale(o->oPiranhaPlantScale);
} }
@ -283,7 +282,6 @@ void piranha_plant_act_biting(void) {
if (distanceToPlayer > 500.0f) { if (distanceToPlayer > 500.0f) {
if (cur_obj_check_if_near_animation_end()) { if (cur_obj_check_if_near_animation_end()) {
o->oAction = PIRANHA_PLANT_ACT_STOPPED_BITING; o->oAction = PIRANHA_PLANT_ACT_STOPPED_BITING;
if (network_owns_object(o)) { network_send_object(o); }
} }
} }
@ -292,7 +290,6 @@ void piranha_plant_act_biting(void) {
if (o->oInteractStatus & INT_STATUS_INTERACTED) { if (o->oInteractStatus & INT_STATUS_INTERACTED) {
if (marioState->flags & MARIO_METAL_CAP) { if (marioState->flags & MARIO_METAL_CAP) {
o->oAction = PIRANHA_PLANT_ACT_ATTACKED; o->oAction = PIRANHA_PLANT_ACT_ATTACKED;
if (network_owns_object(o)) { network_send_object(o); }
} }
} }
} }
@ -323,7 +320,6 @@ void piranha_plant_act_stopped_biting(void) {
if (cur_obj_check_if_near_animation_end()) { if (cur_obj_check_if_near_animation_end()) {
o->oAction = PIRANHA_PLANT_ACT_SLEEPING; o->oAction = PIRANHA_PLANT_ACT_SLEEPING;
if (network_owns_object(o)) { network_send_object(o); }
} }
/** /**
@ -336,7 +332,6 @@ void piranha_plant_act_stopped_biting(void) {
if (o->oDistanceToMario < 400.0f) { if (o->oDistanceToMario < 400.0f) {
if (mario_moving_fast_enough_to_make_piranha_plant_bite()) { if (mario_moving_fast_enough_to_make_piranha_plant_bite()) {
o->oAction = PIRANHA_PLANT_ACT_BITING; o->oAction = PIRANHA_PLANT_ACT_BITING;
if (network_owns_object(o)) { network_send_object(o); }
} }
} }
} }
@ -361,7 +356,7 @@ void (*TablePiranhaPlantActions[])(void) = {
*/ */
void bhv_piranha_plant_loop(void) { void bhv_piranha_plant_loop(void) {
if (!network_sync_object_initialized(o)) { if (!network_sync_object_initialized(o)) {
network_init_object(o, SYNC_DISTANCE_ONLY_EVENTS); network_init_object(o, 2000.0f);
network_init_object_field(o, &o->oAction); network_init_object_field(o, &o->oAction);
network_init_object_field(o, &o->oInteractStatus); network_init_object_field(o, &o->oInteractStatus);
network_init_object_field(o, &o->oInteractType); network_init_object_field(o, &o->oInteractType);

View file

@ -222,6 +222,7 @@ static void packet_write_object_standard_fields(struct Packet* p, struct Object*
packet_write(p, &o->oTimer, sizeof(u32)); packet_write(p, &o->oTimer, sizeof(u32));
packet_write(p, &o->activeFlags, sizeof(s16)); packet_write(p, &o->activeFlags, sizeof(s16));
packet_write(p, &o->header.gfx.node.flags, sizeof(s16)); packet_write(p, &o->header.gfx.node.flags, sizeof(s16));
packet_write(p, &o->oIntangibleTimer, sizeof(s32));
} }
static void packet_read_object_standard_fields(struct Packet* p, struct Object* o) { static void packet_read_object_standard_fields(struct Packet* p, struct Object* o) {
@ -242,6 +243,7 @@ static void packet_read_object_standard_fields(struct Packet* p, struct Object*
packet_read(p, &o->oTimer, sizeof(u32)); packet_read(p, &o->oTimer, sizeof(u32));
packet_read(p, &o->activeFlags, sizeof(u16)); packet_read(p, &o->activeFlags, sizeof(u16));
packet_read(p, &o->header.gfx.node.flags, sizeof(s16)); packet_read(p, &o->header.gfx.node.flags, sizeof(s16));
packet_read(p, &o->oIntangibleTimer, sizeof(s32));
} }
// ----- extra fields ----- // // ----- extra fields ----- //