mirror of
https://github.com/coop-deluxe/sm64coopdx.git
synced 2025-10-30 08:01:01 +00:00
fix some issues with mario object pointers
This commit is contained in:
parent
29cd4d5e59
commit
2a6cb5c842
3 changed files with 13 additions and 4 deletions
|
|
@ -99,7 +99,7 @@ void bhv_idle_water_wave_loop(void) {
|
|||
}
|
||||
obj_copy_pos(o, o->parentObj);
|
||||
u8 index = o->parentObj->oBehParams - 1;
|
||||
o->oPosY = gMarioStates[index].waterLevel + 5;
|
||||
if (index < MAX_PLAYERS) { o->oPosY = gMarioStates[index].waterLevel + 5; }
|
||||
if (!(o->parentObj->oMarioParticleFlags & ACTIVE_PARTICLE_IDLE_WATER_WAVE)) {
|
||||
o->parentObj->oActiveParticleFlags &= (u16)~ACTIVE_PARTICLE_IDLE_WATER_WAVE;
|
||||
o->activeFlags = ACTIVE_FLAG_DEACTIVATED;
|
||||
|
|
|
|||
|
|
@ -219,6 +219,15 @@ void unload_object(struct Object *obj) {
|
|||
obj->header.gfx.node.flags &= ~GRAPH_RENDER_CYLBOARD;
|
||||
obj->header.gfx.node.flags &= ~GRAPH_RENDER_ACTIVE;
|
||||
|
||||
// Clear Mario object pointers
|
||||
if (obj->behavior == smlua_override_behavior(bhvMario)) {
|
||||
u8 playerIndex = obj->oBehParams - 1;
|
||||
if (playerIndex < MAX_PLAYERS) {
|
||||
gMarioObjects[playerIndex] = NULL;
|
||||
gMarioStates[playerIndex].marioObj = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
struct SyncObject* so = sync_object_get(obj->oSyncID);
|
||||
if (so && gNetworkType != NT_NONE) {
|
||||
if (so->syncDeathEvent) {
|
||||
|
|
|
|||
|
|
@ -56,12 +56,12 @@ void network_receive_spawn_star(struct Packet* p) {
|
|||
if (o != NULL) {
|
||||
packet_read(p, &o->oPosX, sizeof(u32) * 3);
|
||||
packet_read(p, &o->oHomeX, sizeof(u32) * 3);
|
||||
|
||||
|
||||
// Here we check if we're supposed to play the cutscene or not depending on if
|
||||
// the global player index sent matches us.
|
||||
// If the network player index is -1, Then the cutscene will always be skipped.
|
||||
// This check is vital for objects which are network owned specfically.
|
||||
// Leaving this the only way to properly set the cutscene flags
|
||||
// Leaving this the only way to properly set the cutscene flags
|
||||
// for those who don't own the object.
|
||||
//printf("network_receive_spawn_star: Network Player Index is %i, Our Global Index is %i.\n", networkPlayerIndex, gNetworkPlayers[0].globalIndex);
|
||||
if (networkPlayerIndex == gNetworkPlayers[0].globalIndex) {
|
||||
|
|
@ -77,7 +77,7 @@ void network_send_spawn_star_nle(struct Object* o, u32 params) {
|
|||
u8 globalIndex = UNKNOWN_GLOBAL_INDEX;
|
||||
if (o->behavior == smlua_override_behavior(bhvMario)) {
|
||||
u8 localIndex = o->oBehParams - 1;
|
||||
globalIndex = gNetworkPlayers[localIndex].globalIndex;
|
||||
if (localIndex < MAX_PLAYERS) { globalIndex = gNetworkPlayers[localIndex].globalIndex; }
|
||||
}
|
||||
|
||||
struct Packet p = { 0 };
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue