mirror of
https://github.com/coop-deluxe/sm64coopdx.git
synced 2024-11-25 21:45:12 +00:00
Additional synchronization + misc fixes
Prevented crash that happened when an upstairs painting was entered Synchronized TTC speed setting Synchronized WDW water level on late join Player packets no longer broadcasted to clients in a different location
This commit is contained in:
parent
b1ac0c9f7f
commit
cd48d177b0
4 changed files with 16 additions and 7 deletions
|
@ -509,11 +509,15 @@ Gfx* geo_mario_head_rotation(s32 callContext, struct GraphNode* node, UNUSED Mat
|
||||||
struct MarioBodyState* bodyState = &gBodyStates[plrIdx];
|
struct MarioBodyState* bodyState = &gBodyStates[plrIdx];
|
||||||
s32 action = bodyState->action;
|
s32 action = bodyState->action;
|
||||||
|
|
||||||
|
bool marioActive = gMarioObjects[plrIdx] != NULL && gMarioObjects[plrIdx]->activeFlags != ACTIVE_FLAG_DEACTIVATED;
|
||||||
|
|
||||||
if (callContext == GEO_CONTEXT_RENDER) {
|
if (callContext == GEO_CONTEXT_RENDER) {
|
||||||
struct GraphNodeRotation* rotNode = (struct GraphNodeRotation*) node->next;
|
struct GraphNodeRotation* rotNode = (struct GraphNodeRotation*) node->next;
|
||||||
struct Camera* camera = gCurGraphNodeCamera->config.camera;
|
struct Camera* camera = gCurGraphNodeCamera->config.camera;
|
||||||
|
|
||||||
if (camera->mode == CAMERA_MODE_C_UP) {
|
if (!marioActive) {
|
||||||
|
node->flags &= ~GRAPH_RENDER_ACTIVE;
|
||||||
|
} else if (camera->mode == CAMERA_MODE_C_UP) {
|
||||||
rotNode->rotation[0] = gPlayerCameraState->headRotation[1];
|
rotNode->rotation[0] = gPlayerCameraState->headRotation[1];
|
||||||
rotNode->rotation[2] = gPlayerCameraState->headRotation[0];
|
rotNode->rotation[2] = gPlayerCameraState->headRotation[0];
|
||||||
}
|
}
|
||||||
|
@ -521,8 +525,7 @@ Gfx* geo_mario_head_rotation(s32 callContext, struct GraphNode* node, UNUSED Mat
|
||||||
rotNode->rotation[0] = bodyState->headAngle[1];
|
rotNode->rotation[0] = bodyState->headAngle[1];
|
||||||
rotNode->rotation[1] = bodyState->headAngle[2];
|
rotNode->rotation[1] = bodyState->headAngle[2];
|
||||||
rotNode->rotation[2] = bodyState->headAngle[0];
|
rotNode->rotation[2] = bodyState->headAngle[0];
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
vec3s_set(bodyState->headAngle, 0, 0, 0);
|
vec3s_set(bodyState->headAngle, 0, 0, 0);
|
||||||
vec3s_set(rotNode->rotation, 0, 0, 0);
|
vec3s_set(rotNode->rotation, 0, 0, 0);
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,8 +12,10 @@ void packet_process(struct Packet* p) {
|
||||||
|| p->areaIndex != gCurrAreaIndex);
|
|| p->areaIndex != gCurrAreaIndex);
|
||||||
// drop packet
|
// drop packet
|
||||||
if (levelAreaMismatch) {
|
if (levelAreaMismatch) {
|
||||||
|
if (gNetworkType != NT_SERVER) {
|
||||||
LOG_INFO("dropping level mismatch packet %d", p->packetType);
|
LOG_INFO("dropping level mismatch packet %d", p->packetType);
|
||||||
LOG_INFO(" (%d, %d, %d, %d) != (%d, %d, %d, %d)", p->courseNum, p->actNum, p->levelNum, p->areaIndex, gCurrCourseNum, gCurrActNum, gCurrLevelNum, gCurrAreaIndex);
|
LOG_INFO(" (%d, %d, %d, %d) != (%d, %d, %d, %d)", p->courseNum, p->actNum, p->levelNum, p->areaIndex, gCurrCourseNum, gCurrActNum, gCurrLevelNum, gCurrAreaIndex);
|
||||||
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,6 +28,8 @@ void network_send_level(struct NetworkPlayer* toNp, bool sendArea) {
|
||||||
packet_write(&p, &gRedCoinsCollected, sizeof(u8));
|
packet_write(&p, &gRedCoinsCollected, sizeof(u8));
|
||||||
packet_write(&p, &gPssSlideStarted, sizeof(u8));
|
packet_write(&p, &gPssSlideStarted, sizeof(u8));
|
||||||
packet_write(&p, &gHudDisplay.timer, sizeof(u16));
|
packet_write(&p, &gHudDisplay.timer, sizeof(u16));
|
||||||
|
packet_write(&p, &gTTCSpeedSetting, sizeof(s16));
|
||||||
|
packet_write(&p, gEnvironmentLevels, sizeof(s32));
|
||||||
|
|
||||||
// send level packet
|
// send level packet
|
||||||
network_send_to(toNp->localIndex, &p);
|
network_send_to(toNp->localIndex, &p);
|
||||||
|
@ -72,6 +74,8 @@ void network_receive_level(struct Packet* p) {
|
||||||
packet_read(p, &redCoinsCollected, sizeof(u8));
|
packet_read(p, &redCoinsCollected, sizeof(u8));
|
||||||
packet_read(p, &gPssSlideStarted, sizeof(u8));
|
packet_read(p, &gPssSlideStarted, sizeof(u8));
|
||||||
packet_read(p, &gHudDisplay.timer, sizeof(u16));
|
packet_read(p, &gHudDisplay.timer, sizeof(u16));
|
||||||
|
packet_read(p, &gTTCSpeedSetting, sizeof(s16)); // likely doesn't work after level load.. but it could
|
||||||
|
packet_read(p, gEnvironmentLevels, sizeof(s32));
|
||||||
|
|
||||||
// hacky way to override red coins collected
|
// hacky way to override red coins collected
|
||||||
gRedCoinsCollected = redCoinsCollected;
|
gRedCoinsCollected = redCoinsCollected;
|
||||||
|
|
|
@ -190,7 +190,7 @@ void network_send_player(u8 localIndex) {
|
||||||
read_packet_data(&data, &gMarioStates[localIndex]);
|
read_packet_data(&data, &gMarioStates[localIndex]);
|
||||||
|
|
||||||
struct Packet p;
|
struct Packet p;
|
||||||
packet_init(&p, PACKET_PLAYER, false, false);
|
packet_init(&p, PACKET_PLAYER, false, true);
|
||||||
packet_write(&p, &gNetworkPlayers[localIndex].globalIndex, sizeof(u8));
|
packet_write(&p, &gNetworkPlayers[localIndex].globalIndex, sizeof(u8));
|
||||||
packet_write(&p, &data, sizeof(struct PacketPlayerData));
|
packet_write(&p, &data, sizeof(struct PacketPlayerData));
|
||||||
network_send(&p);
|
network_send(&p);
|
||||||
|
|
Loading…
Reference in a new issue