mirror of
https://github.com/coop-deluxe/sm64coopdx.git
synced 2025-12-11 18:42:41 +00:00
Fixed late-join for Act 1 BBH staircase
This commit is contained in:
parent
67fac0b112
commit
96288326b5
3 changed files with 31 additions and 3 deletions
|
|
@ -719,9 +719,12 @@ static void big_boo_act_4(void) {
|
||||||
if (o->oTimer > 60 && distanceToPlayer < 600.0f) {
|
if (o->oTimer > 60 && distanceToPlayer < 600.0f) {
|
||||||
obj_set_pos(o, 973, 0, 717);
|
obj_set_pos(o, 973, 0, 717);
|
||||||
|
|
||||||
|
struct Object* spawnedBridge = cur_obj_nearest_object_with_behavior(bhvBooBossSpawnedBridge);
|
||||||
|
if (spawnedBridge == NULL) {
|
||||||
spawn_object_relative(0, 0, 0, 0, o, MODEL_BBH_STAIRCASE_STEP, bhvBooBossSpawnedBridge);
|
spawn_object_relative(0, 0, 0, 0, o, MODEL_BBH_STAIRCASE_STEP, bhvBooBossSpawnedBridge);
|
||||||
spawn_object_relative(1, 0, 0, -200, o, MODEL_BBH_STAIRCASE_STEP, bhvBooBossSpawnedBridge);
|
spawn_object_relative(1, 0, 0, -200, o, MODEL_BBH_STAIRCASE_STEP, bhvBooBossSpawnedBridge);
|
||||||
spawn_object_relative(2, 0, 0, 200, o, MODEL_BBH_STAIRCASE_STEP, bhvBooBossSpawnedBridge);
|
spawn_object_relative(2, 0, 0, 200, o, MODEL_BBH_STAIRCASE_STEP, bhvBooBossSpawnedBridge);
|
||||||
|
}
|
||||||
|
|
||||||
obj_mark_for_deletion(o);
|
obj_mark_for_deletion(o);
|
||||||
}
|
}
|
||||||
|
|
@ -742,6 +745,20 @@ u8 big_boo_ignore_update(void) {
|
||||||
return o->oHealth == 0 || (cur_obj_has_behavior(bhvGhostHuntBigBoo) && !bigBooActivated);
|
return o->oHealth == 0 || (cur_obj_has_behavior(bhvGhostHuntBigBoo) && !bigBooActivated);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void big_boo_on_forget(void) {
|
||||||
|
if (o == NULL) { return; }
|
||||||
|
if (o->behavior != bhvGhostHuntBigBoo) { return; }
|
||||||
|
struct Object* spawnedBridge = cur_obj_nearest_object_with_behavior(bhvBooBossSpawnedBridge);
|
||||||
|
if (spawnedBridge == NULL && o->oBehParams2ndByte == 0) {
|
||||||
|
obj_set_pos(o, 973, 0, 717);
|
||||||
|
obj_set_angle(o, 0, 0, 0);
|
||||||
|
|
||||||
|
spawn_object_relative(0, 0, 0, 0, o, MODEL_BBH_STAIRCASE_STEP, bhvBooBossSpawnedBridge);
|
||||||
|
spawn_object_relative(1, 0, 0, -200, o, MODEL_BBH_STAIRCASE_STEP, bhvBooBossSpawnedBridge);
|
||||||
|
spawn_object_relative(2, 0, 0, 200, o, MODEL_BBH_STAIRCASE_STEP, bhvBooBossSpawnedBridge);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void bhv_big_boo_loop(void) {
|
void bhv_big_boo_loop(void) {
|
||||||
if (o->oAction == 0) {
|
if (o->oAction == 0) {
|
||||||
if (!network_sync_object_initialized(o)) {
|
if (!network_sync_object_initialized(o)) {
|
||||||
|
|
@ -749,6 +766,7 @@ void bhv_big_boo_loop(void) {
|
||||||
struct SyncObject* so = boo_network_init_object();
|
struct SyncObject* so = boo_network_init_object();
|
||||||
so->syncDeathEvent = FALSE;
|
so->syncDeathEvent = FALSE;
|
||||||
so->ignore_if_true = big_boo_ignore_update;
|
so->ignore_if_true = big_boo_ignore_update;
|
||||||
|
so->on_forget = big_boo_on_forget;
|
||||||
}
|
}
|
||||||
} else if (o->oHealth <= 0) {
|
} else if (o->oHealth <= 0) {
|
||||||
if (network_sync_object_initialized(o)) {
|
if (network_sync_object_initialized(o)) {
|
||||||
|
|
|
||||||
|
|
@ -71,6 +71,7 @@ struct SyncObject {
|
||||||
void (*on_sent_pre)(void);
|
void (*on_sent_pre)(void);
|
||||||
void (*on_sent_post)(void);
|
void (*on_sent_post)(void);
|
||||||
void (*override_ownership)(u8* shouldOverride, u8* shouldOwn);
|
void (*override_ownership)(u8* shouldOverride, u8* shouldOwn);
|
||||||
|
void (*on_forget)(void);
|
||||||
void* extraFields[MAX_SYNC_OBJECT_FIELDS];
|
void* extraFields[MAX_SYNC_OBJECT_FIELDS];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -9,6 +9,7 @@
|
||||||
#include "src/game/memory.h"
|
#include "src/game/memory.h"
|
||||||
#include "src/game/object_helpers.h"
|
#include "src/game/object_helpers.h"
|
||||||
#include "src/game/obj_behaviors.h"
|
#include "src/game/obj_behaviors.h"
|
||||||
|
#include "src/game/object_list_processor.h"
|
||||||
#include "src/game/area.h"
|
#include "src/game/area.h"
|
||||||
#include "pc/debuglog.h"
|
#include "pc/debuglog.h"
|
||||||
#include "pc/utils/misc.h"
|
#include "pc/utils/misc.h"
|
||||||
|
|
@ -135,6 +136,7 @@ struct SyncObject* network_init_object(struct Object *o, float maxSyncDistance)
|
||||||
so->on_sent_pre = NULL;
|
so->on_sent_pre = NULL;
|
||||||
so->on_sent_post = NULL;
|
so->on_sent_post = NULL;
|
||||||
so->override_ownership = NULL;
|
so->override_ownership = NULL;
|
||||||
|
so->on_forget = NULL;
|
||||||
so->syncDeathEvent = true;
|
so->syncDeathEvent = true;
|
||||||
so->randomSeed = (u16)(o->oSyncID * 7951);
|
so->randomSeed = (u16)(o->oSyncID * 7951);
|
||||||
memset(so->extraFields, 0, sizeof(void*) * MAX_SYNC_OBJECT_FIELDS);
|
memset(so->extraFields, 0, sizeof(void*) * MAX_SYNC_OBJECT_FIELDS);
|
||||||
|
|
@ -620,6 +622,13 @@ void network_forget_sync_object(struct SyncObject* so) {
|
||||||
area_remove_sync_ids_add(syncId);
|
area_remove_sync_ids_add(syncId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (so->on_forget != NULL) {
|
||||||
|
struct Object* lastObject = gCurrentObject;
|
||||||
|
gCurrentObject = so->o;
|
||||||
|
so->on_forget();
|
||||||
|
gCurrentObject = lastObject;
|
||||||
|
}
|
||||||
|
|
||||||
so->o = NULL;
|
so->o = NULL;
|
||||||
so->behavior = NULL;
|
so->behavior = NULL;
|
||||||
so->owned = false;
|
so->owned = false;
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue