mirror of
https://github.com/coop-deluxe/sm64coopdx.git
synced 2024-11-22 20:15:17 +00:00
Synchronize warp checkpoints
Prevents softlock when dying inside volcano in LLL and pyramid in SSL
This commit is contained in:
parent
20631abc7f
commit
9c8a58fa5b
4 changed files with 17 additions and 9 deletions
|
@ -170,7 +170,7 @@ s8 gShouldNotPlayCastleMusic;
|
|||
|
||||
struct MarioState *gMarioState = &gMarioStates[0];
|
||||
u8 unused1[4] = { 0 };
|
||||
s8 D_8032C9E0 = 0;
|
||||
s8 gInWarpCheckpoint = 0;
|
||||
u8 unused3[4];
|
||||
u8 unused4[2];
|
||||
|
||||
|
@ -675,18 +675,18 @@ struct WarpNode *get_painting_warp_node(void) {
|
|||
return warpNode;
|
||||
}
|
||||
|
||||
static void initiate_painting_warp_node(struct WarpNode *pWarpNode, u8 instant) {
|
||||
static void initiate_painting_warp_node(struct WarpNode *pWarpNode) {
|
||||
struct WarpNode warpNode = *pWarpNode;
|
||||
|
||||
if (!(warpNode.destLevel & 0x80)) {
|
||||
D_8032C9E0 = check_warp_checkpoint(&warpNode);
|
||||
gInWarpCheckpoint = check_warp_checkpoint(&warpNode);
|
||||
}
|
||||
|
||||
initiate_warp(warpNode.destLevel & 0x7F, warpNode.destArea, warpNode.destNode, 0);
|
||||
check_if_should_set_warp_checkpoint(&warpNode);
|
||||
|
||||
play_transition_after_delay(WARP_TRANSITION_FADE_INTO_COLOR, 30, 255, 255, 255, instant ? 1 : 45);
|
||||
level_set_transition(instant ? 1 : 74, basic_update);
|
||||
play_transition_after_delay(WARP_TRANSITION_FADE_INTO_COLOR, 30, 255, 255, 255, 45);
|
||||
level_set_transition(74, basic_update);
|
||||
|
||||
play_sound(SOUND_MENU_STAR_SOUND, gDefaultSoundArgs);
|
||||
fadeout_music(398);
|
||||
|
@ -705,7 +705,7 @@ void initiate_painting_warp(void) {
|
|||
if (gMarioState->action & ACT_FLAG_INTANGIBLE) {
|
||||
play_painting_eject_sound();
|
||||
} else if (pWarpNode->id != 0) {
|
||||
initiate_painting_warp_node(pWarpNode, false);
|
||||
initiate_painting_warp_node(pWarpNode);
|
||||
set_mario_action(gMarioState, ACT_DISAPPEARED, 0);
|
||||
gMarioState->marioObj->header.gfx.node.flags &= ~GRAPH_RENDER_ACTIVE;
|
||||
}
|
||||
|
@ -1384,9 +1384,9 @@ s32 lvl_init_from_save_file(UNUSED s16 arg0, s32 levelNum) {
|
|||
}
|
||||
|
||||
s32 lvl_set_current_level(UNUSED s16 arg0, s32 levelNum) {
|
||||
s32 val4 = D_8032C9E0;
|
||||
s32 val4 = gInWarpCheckpoint;
|
||||
|
||||
D_8032C9E0 = 0;
|
||||
gInWarpCheckpoint = 0;
|
||||
gCurrLevelNum = levelNum;
|
||||
gCurrCourseNum = gLevelToCourseNumTable[levelNum - 1];
|
||||
|
||||
|
|
|
@ -85,6 +85,7 @@ struct WarpDest {
|
|||
};
|
||||
|
||||
extern struct WarpDest sWarpDest;
|
||||
extern s8 gInWarpCheckpoint;
|
||||
|
||||
extern s16 D_80339EE0;
|
||||
extern s16 sDelayedWarpOp;
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
|
||||
#ifdef DEBUG
|
||||
|
||||
static u8 warpToLevel = LEVEL_BITFS;
|
||||
static u8 warpToLevel = LEVEL_SSL;
|
||||
|
||||
#define SCANCODE_0 0x0B
|
||||
#define SCANCODE_3 0x04
|
||||
|
|
|
@ -20,6 +20,7 @@ extern struct WarpDest gReceiveWarpDest;
|
|||
|
||||
s16 saved_D_80339EE0 = 0;
|
||||
struct WarpDest savedWarpNode = { 0 };
|
||||
s8 savedInWarpCheckpoint = 0;
|
||||
|
||||
static clock_t lastDoneEvent = 0;
|
||||
static bool isInWarp = FALSE;
|
||||
|
@ -31,6 +32,7 @@ struct PacketLevelWarpData {
|
|||
u8 done;
|
||||
u8 controlledWarp;
|
||||
struct WarpDest warpDest;
|
||||
s8 inWarpCheckpoint;
|
||||
s16 D_80339EE0;
|
||||
};
|
||||
|
||||
|
@ -40,12 +42,14 @@ static void populate_packet_data(struct PacketLevelWarpData* data, bool done, u8
|
|||
data->done = done;
|
||||
data->controlledWarp = gControlledWarp;
|
||||
data->warpDest = savedWarpNode;
|
||||
data->inWarpCheckpoint = savedInWarpCheckpoint;
|
||||
data->D_80339EE0 = saved_D_80339EE0;
|
||||
}
|
||||
|
||||
void network_send_level_warp_begin(void) {
|
||||
isInWarp = TRUE;
|
||||
savedWarpNode = sWarpDest;
|
||||
savedInWarpCheckpoint = gInWarpCheckpoint;
|
||||
saved_D_80339EE0 = D_80339EE0;
|
||||
|
||||
float elapsedSinceDone = (clock() - lastDoneEvent) / CLOCKS_PER_SEC;
|
||||
|
@ -103,6 +107,7 @@ static void network_send_level_warp_done(u8 remoteEventId) {
|
|||
|
||||
static void do_warp(void) {
|
||||
gReceiveWarpDest = savedWarpNode;
|
||||
gInWarpCheckpoint = savedInWarpCheckpoint;
|
||||
D_80339EE0 = saved_D_80339EE0;
|
||||
gReceiveWarp = TRUE;
|
||||
}
|
||||
|
@ -143,6 +148,7 @@ void network_receive_level_warp(struct Packet* p) {
|
|||
LOG_INFO("client initiated warp!");
|
||||
gControlledWarp = !remote.controlledWarp; // two-player hack
|
||||
savedWarpNode = remote.warpDest;
|
||||
savedInWarpCheckpoint = remote.inWarpCheckpoint;
|
||||
saved_D_80339EE0 = remote.D_80339EE0;
|
||||
do_warp();
|
||||
network_send_level_warp_done(remote.eventId);
|
||||
|
@ -167,6 +173,7 @@ void network_receive_level_warp(struct Packet* p) {
|
|||
LOG_INFO("server initiated warp!");
|
||||
gControlledWarp = !remote.controlledWarp; // two-player hack
|
||||
savedWarpNode = remote.warpDest;
|
||||
savedInWarpCheckpoint = remote.inWarpCheckpoint;
|
||||
saved_D_80339EE0 = remote.D_80339EE0;
|
||||
LOG_INFO("finished event [%d]!", remote.eventId);
|
||||
do_warp();
|
||||
|
|
Loading…
Reference in a new issue