Fix stars not respawning + other syncing fixes (#460)
* Force secret stars to respawn Hacky fix for sure. I'll need to see how to deal with this in a better way. * Improve star syncing All stars now respawn (hopefully) and the red coin star no longer repeatedly respawns. Also forced oSyncDeath for other objects. * Remove leftover include * (Probably) improve star syncing It'll still spam packets but at least it'll only spam packets to people who are able to receive them * Revert "(Probably) improve star syncing" This reverts commit 86ff2c5451cff0a06e8c3410b2815e12b414f264. * Weird sync No idea why this works but it does. At least no fields have to be synced over, as far as I can tell.
This commit is contained in:
parent
718be07a79
commit
518f582ed2
|
@ -80,6 +80,10 @@ void slow_star_rotation(void) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void bhv_spawned_star_loop(void) {
|
void bhv_spawned_star_loop(void) {
|
||||||
|
if (!sync_object_is_initialized(o->oSyncID)) {
|
||||||
|
sync_object_init(o, SYNC_DISTANCE_ONLY_EVENTS);
|
||||||
|
}
|
||||||
|
|
||||||
if (o->oAction == 0) {
|
if (o->oAction == 0) {
|
||||||
// All of these are for checking if we spawned the star, If
|
// All of these are for checking if we spawned the star, If
|
||||||
// we didn't. We don't need the time stop.
|
// we didn't. We don't need the time stop.
|
||||||
|
@ -140,6 +144,7 @@ void bhv_spawned_star_loop(void) {
|
||||||
} else {
|
} else {
|
||||||
set_sparkle_spawn_star_hitbox();
|
set_sparkle_spawn_star_hitbox();
|
||||||
slow_star_rotation();
|
slow_star_rotation();
|
||||||
|
network_send_object(o);
|
||||||
}
|
}
|
||||||
cur_obj_move_using_fvel_and_gravity();
|
cur_obj_move_using_fvel_and_gravity();
|
||||||
o->oFaceAngleYaw += o->oAngleVelYaw;
|
o->oFaceAngleYaw += o->oAngleVelYaw;
|
||||||
|
|
|
@ -106,6 +106,10 @@ void bhv_star_spawn_init(void) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void bhv_star_spawn_loop(void) {
|
void bhv_star_spawn_loop(void) {
|
||||||
|
if (!sync_object_is_initialized(o->oSyncID)) {
|
||||||
|
sync_object_init(o, SYNC_DISTANCE_ONLY_EVENTS);
|
||||||
|
}
|
||||||
|
|
||||||
switch (o->oAction) {
|
switch (o->oAction) {
|
||||||
case 0:
|
case 0:
|
||||||
o->oFaceAngleYaw += 0x1000;
|
o->oFaceAngleYaw += 0x1000;
|
||||||
|
@ -148,6 +152,7 @@ void bhv_star_spawn_loop(void) {
|
||||||
|
|
||||||
case 3:
|
case 3:
|
||||||
o->oFaceAngleYaw += 0x800;
|
o->oFaceAngleYaw += 0x800;
|
||||||
|
cur_obj_become_tangible();
|
||||||
if (o->oTimer == 20) {
|
if (o->oTimer == 20) {
|
||||||
gMarioStates[0].freeze = 0;
|
gMarioStates[0].freeze = 0;
|
||||||
gObjCutsceneDone = TRUE;
|
gObjCutsceneDone = TRUE;
|
||||||
|
@ -159,6 +164,8 @@ void bhv_star_spawn_loop(void) {
|
||||||
mark_obj_for_deletion(o);
|
mark_obj_for_deletion(o);
|
||||||
o->oInteractStatus = 0;
|
o->oInteractStatus = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
network_send_object(o);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
spawn_star_number();
|
spawn_star_number();
|
||||||
|
@ -321,7 +328,7 @@ void bhv_hidden_red_coin_star_loop(void) {
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 1:
|
case 1:
|
||||||
if (o->oTimer == 3) {
|
if (o->oTimer > 2) {
|
||||||
struct Object *obj = spawn_red_coin_cutscene_star(o->oPosX, o->oPosY, o->oPosZ);
|
struct Object *obj = spawn_red_coin_cutscene_star(o->oPosX, o->oPosY, o->oPosZ);
|
||||||
if (obj != NULL) {
|
if (obj != NULL) {
|
||||||
if (o->oHiddenStarLastInteractedObject == &gMarioStates[0]) {
|
if (o->oHiddenStarLastInteractedObject == &gMarioStates[0]) {
|
||||||
|
@ -331,7 +338,7 @@ void bhv_hidden_red_coin_star_loop(void) {
|
||||||
}
|
}
|
||||||
spawn_mist_particles();
|
spawn_mist_particles();
|
||||||
}
|
}
|
||||||
network_send_object(o);
|
o->activeFlags = ACTIVE_FLAG_DEACTIVATED;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
@ -812,7 +812,7 @@ void obj_act_knockback(UNUSED f32 baseScale) {
|
||||||
//! Dies immediately if above lava
|
//! Dies immediately if above lava
|
||||||
if ((o->oMoveFlags
|
if ((o->oMoveFlags
|
||||||
& (OBJ_MOVE_MASK_ON_GROUND | OBJ_MOVE_MASK_IN_WATER | OBJ_MOVE_HIT_WALL | OBJ_MOVE_ABOVE_LAVA))
|
& (OBJ_MOVE_MASK_ON_GROUND | OBJ_MOVE_MASK_IN_WATER | OBJ_MOVE_HIT_WALL | OBJ_MOVE_ABOVE_LAVA))
|
||||||
|| (o->oAction == OBJ_ACT_VERTICAL_KNOCKBACK && o->oTimer >= 9)) {
|
|| (o->oAction == OBJ_ACT_VERTICAL_KNOCKBACK && o->oTimer >= 9) || o->oSyncDeath) {
|
||||||
obj_die_if_health_non_positive();
|
obj_die_if_health_non_positive();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -832,7 +832,7 @@ void obj_act_squished(f32 baseScale) {
|
||||||
if (approach_f32_ptr(&o->header.gfx.scale[1], targetScaleY, baseScale * 0.14f)) {
|
if (approach_f32_ptr(&o->header.gfx.scale[1], targetScaleY, baseScale * 0.14f)) {
|
||||||
o->header.gfx.scale[0] = o->header.gfx.scale[2] = baseScale * 2.0f - o->header.gfx.scale[1];
|
o->header.gfx.scale[0] = o->header.gfx.scale[2] = baseScale * 2.0f - o->header.gfx.scale[1];
|
||||||
|
|
||||||
if (o->oTimer >= 16) {
|
if (o->oTimer >= 16 || o->oSyncDeath) {
|
||||||
obj_die_if_health_non_positive();
|
obj_die_if_health_non_positive();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -419,6 +419,7 @@ void network_receive_object(struct Packet* p) {
|
||||||
|
|
||||||
// deactivated
|
// deactivated
|
||||||
if (o->activeFlags == ACTIVE_FLAG_DEACTIVATED) {
|
if (o->activeFlags == ACTIVE_FLAG_DEACTIVATED) {
|
||||||
|
o->oSyncDeath = 1; // Force oSyncDeath if deactivated
|
||||||
sync_object_forget(so->id);
|
sync_object_forget(so->id);
|
||||||
} else if (p->reliable) {
|
} else if (p->reliable) {
|
||||||
// remember packet
|
// remember packet
|
||||||
|
|
Loading…
Reference in New Issue