Properly synchronize koopa shells spawned from boxes

This commit is contained in:
MysterD 2020-10-14 20:34:38 -07:00
parent d882e8a039
commit cb902c519d
2 changed files with 9 additions and 1 deletions

View file

@ -12,6 +12,7 @@ struct ObjectHitbox sExclamationBoxHitbox = {
/* hurtboxHeight: */ 30, /* hurtboxHeight: */ 30,
}; };
// hack: if any other sync objects get added here we have to check for them (search for hack in this file)
struct Struct802C0DF0 sExclamationBoxContents[] = { { 0, 0, 0, MODEL_MARIOS_WING_CAP, bhvWingCap }, struct Struct802C0DF0 sExclamationBoxContents[] = { { 0, 0, 0, MODEL_MARIOS_WING_CAP, bhvWingCap },
{ 1, 0, 0, MODEL_MARIOS_METAL_CAP, bhvMetalCap }, { 1, 0, 0, MODEL_MARIOS_METAL_CAP, bhvMetalCap },
{ 2, 0, 0, MODEL_MARIOS_CAP, bhvVanishCap }, { 2, 0, 0, MODEL_MARIOS_CAP, bhvVanishCap },
@ -132,6 +133,10 @@ void exclamation_box_spawn_contents(struct Struct802C0DF0 *a0, u8 a1) {
// send non-star spawn events // send non-star spawn events
// stars cant be sent here to due jankiness in oBehParams // stars cant be sent here to due jankiness in oBehParams
if (a0->behavior != bhvSpawnedStar) { if (a0->behavior != bhvSpawnedStar) {
// hack: if any other sync objects get spawned here we have to check for them
if (a0->behavior == bhvKoopaShell) {
network_set_sync_id(sp1C);
}
struct Object* spawn_objects[] = { sp1C }; struct Object* spawn_objects[] = { sp1C };
u32 models[] = { a0->model }; u32 models[] = { a0->model };
network_send_spawn_objects(spawn_objects, models, 1); network_send_spawn_objects(spawn_objects, models, 1);

View file

@ -295,7 +295,10 @@ u32 attack_object(struct Object *o, s32 interaction) {
void mario_stop_riding_object(struct MarioState *m) { void mario_stop_riding_object(struct MarioState *m) {
if (m->riddenObj != NULL && m->playerIndex == 0) { if (m->riddenObj != NULL && m->playerIndex == 0) {
m->riddenObj->oInteractStatus = INT_STATUS_STOP_RIDING; m->riddenObj->oInteractStatus = INT_STATUS_STOP_RIDING;
if (m->playerIndex == 0) { stop_shell_music(); } if (m->riddenObj->oSyncID != 0) {
network_send_object_reliability(m->riddenObj, TRUE);
}
stop_shell_music();
m->riddenObj = NULL; m->riddenObj = NULL;
} }
} }