mirror of
https://github.com/coop-deluxe/sm64coopdx.git
synced 2024-11-25 13:35:12 +00:00
Fixed the merry go round in BBH
Fixed releasing of sync objects that otherwise don't sync their death events Fixed using/releasing reserved objects in an area that the server isn't in
This commit is contained in:
parent
ef2287a5d5
commit
0c459294bb
5 changed files with 24 additions and 11 deletions
|
@ -859,7 +859,7 @@ void bhv_merry_go_round_boo_manager_loop(void) {
|
|||
switch (o->oAction) {
|
||||
case 0:
|
||||
if (distanceToPlayer < 1000.0f) {
|
||||
if (gNetworkType == NT_SERVER && o->oMerryGoRoundBooManagerNumBoosKilled < 5) {
|
||||
if (player == gMarioObjects[0] && o->oMerryGoRoundBooManagerNumBoosKilled < 5) {
|
||||
if (o->oMerryGoRoundBooManagerNumBoosSpawned < 5) {
|
||||
if (o->oMerryGoRoundBooManagerNumBoosSpawned - o->oMerryGoRoundBooManagerNumBoosKilled < 2) {
|
||||
struct Object* boo = spawn_object(o, MODEL_BOO, bhvMerryGoRoundBoo);
|
||||
|
@ -878,7 +878,7 @@ void bhv_merry_go_round_boo_manager_loop(void) {
|
|||
}
|
||||
|
||||
if (o->oMerryGoRoundBooManagerNumBoosKilled > 4) {
|
||||
if (gNetworkType == NT_SERVER) {
|
||||
if (player == gMarioObjects[0]) {
|
||||
struct Object* boo = spawn_object(o, MODEL_BOO, bhvMerryGoRoundBigBoo);
|
||||
obj_copy_behavior_params(boo, o);
|
||||
|
||||
|
|
|
@ -13,6 +13,7 @@
|
|||
#include "spawn_object.h"
|
||||
#include "types.h"
|
||||
#include "pc/network/network.h"
|
||||
#include "pc/network/reservation_area.h"
|
||||
|
||||
/**
|
||||
* An unused linked list struct that seems to have been replaced by ObjectNode.
|
||||
|
@ -198,8 +199,16 @@ void unload_object(struct Object *obj) {
|
|||
obj->header.gfx.node.flags &= ~GRAPH_RENDER_CYLBOARD;
|
||||
obj->header.gfx.node.flags &= ~GRAPH_RENDER_ACTIVE;
|
||||
|
||||
if (obj->oSyncID != 0 && gSyncObjects[obj->oSyncID].syncDeathEvent) {
|
||||
network_send_object(obj);
|
||||
if (obj->oSyncID != 0) {
|
||||
if (gSyncObjects[obj->oSyncID].syncDeathEvent) {
|
||||
network_send_object(obj);
|
||||
} else {
|
||||
if (gNetworkType == NT_SERVER) {
|
||||
reservation_area_release(gNetworkPlayerLocal, obj->oSyncID);
|
||||
} else {
|
||||
network_send_reservation_release(obj->oSyncID);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
deallocate_object(&gFreeObjectList, &obj->header);
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
#include "course_table.h"
|
||||
#include "src/game/interaction.h"
|
||||
#include "src/engine/math_util.h"
|
||||
#define DISABLE_MODULE_LOG 1
|
||||
//#define DISABLE_MODULE_LOG 1
|
||||
#include "pc/debuglog.h"
|
||||
|
||||
void network_send_reservation_list(struct NetworkPlayer* np, u8 syncIds[]) {
|
||||
|
@ -26,10 +26,12 @@ void network_send_reservation_list(struct NetworkPlayer* np, u8 syncIds[]) {
|
|||
}
|
||||
|
||||
network_send_to(np->localIndex, &p);
|
||||
LOG_INFO("tx reservation list");
|
||||
}
|
||||
|
||||
void network_receive_reservation_list(struct Packet* p) {
|
||||
assert(gNetworkType == NT_CLIENT);
|
||||
LOG_INFO("rx reservation list");
|
||||
|
||||
u8 courseNum, actNum, levelNum, areaIndex;
|
||||
packet_read(p, &courseNum, sizeof(u8));
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
#include "course_table.h"
|
||||
#include "src/game/interaction.h"
|
||||
#include "src/engine/math_util.h"
|
||||
#define DISABLE_MODULE_LOG 1
|
||||
//#define DISABLE_MODULE_LOG 1
|
||||
#include "pc/debuglog.h"
|
||||
|
||||
void network_send_reservation_release(u8 syncId) {
|
||||
|
@ -28,10 +28,12 @@ void network_send_reservation_release(u8 syncId) {
|
|||
packet_write(&p, &syncId, sizeof(u8));
|
||||
|
||||
network_send_to(gNetworkPlayerServer->localIndex, &p);
|
||||
LOG_INFO("tx reservation release");
|
||||
}
|
||||
|
||||
void network_receive_reservation_release(struct Packet* p) {
|
||||
assert(gNetworkType == NT_SERVER);
|
||||
LOG_INFO("rx reservation release");
|
||||
|
||||
struct NetworkPlayer* np = &gNetworkPlayers[p->localIndex];
|
||||
if (np == NULL || np->localIndex == UNKNOWN_LOCAL_INDEX || !np->connected) {
|
||||
|
@ -45,8 +47,7 @@ void network_receive_reservation_release(struct Packet* p) {
|
|||
packet_read(p, &levelNum, sizeof(u8));
|
||||
packet_read(p, &areaIndex, sizeof(u8));
|
||||
|
||||
extern s16 gCurrCourseNum, gCurrActStarNum, gCurrLevelNum, gCurrAreaIndex;
|
||||
if (courseNum != gCurrCourseNum || actNum != gCurrActStarNum || levelNum != gCurrLevelNum || areaIndex != gCurrAreaIndex) {
|
||||
if (courseNum != np->currCourseNum || actNum != np->currActNum || levelNum != np->currLevelNum || areaIndex != np->currAreaIndex) {
|
||||
LOG_ERROR("received an improper location");
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
#include "course_table.h"
|
||||
#include "src/game/interaction.h"
|
||||
#include "src/engine/math_util.h"
|
||||
#define DISABLE_MODULE_LOG 1
|
||||
//#define DISABLE_MODULE_LOG 1
|
||||
#include "pc/debuglog.h"
|
||||
|
||||
void network_send_reservation_use(u8 syncId) {
|
||||
|
@ -28,10 +28,12 @@ void network_send_reservation_use(u8 syncId) {
|
|||
packet_write(&p, &syncId, sizeof(u8));
|
||||
|
||||
network_send_to(gNetworkPlayerServer->localIndex, &p);
|
||||
LOG_INFO("tx reservation use");
|
||||
}
|
||||
|
||||
void network_receive_reservation_use(struct Packet* p) {
|
||||
assert(gNetworkType == NT_SERVER);
|
||||
LOG_INFO("rx reservation use");
|
||||
|
||||
struct NetworkPlayer* np = &gNetworkPlayers[p->localIndex];
|
||||
if (np == NULL || np->localIndex == UNKNOWN_LOCAL_INDEX || !np->connected) {
|
||||
|
@ -45,8 +47,7 @@ void network_receive_reservation_use(struct Packet* p) {
|
|||
packet_read(p, &levelNum, sizeof(u8));
|
||||
packet_read(p, &areaIndex, sizeof(u8));
|
||||
|
||||
extern s16 gCurrCourseNum, gCurrActStarNum, gCurrLevelNum, gCurrAreaIndex;
|
||||
if (courseNum != gCurrCourseNum || actNum != gCurrActStarNum || levelNum != gCurrLevelNum || areaIndex != gCurrAreaIndex) {
|
||||
if (courseNum != np->currCourseNum || actNum != np->currActNum|| levelNum != np->currLevelNum || areaIndex != np->currAreaIndex) {
|
||||
LOG_ERROR("received an improper location");
|
||||
return;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue