Removed vestigial painting warp code, made painting selection instant

This commit is contained in:
MysterD 2020-08-12 22:17:12 -07:00
parent 6629b5493d
commit 31904c36bf
2 changed files with 9 additions and 18 deletions

View file

@ -154,6 +154,7 @@ void bhv_act_selector_init(void) {
} }
render_100_coin_star(stars); render_100_coin_star(stars);
gInsidePainting = TRUE;
} }
/** /**
@ -459,4 +460,9 @@ void star_select_finish_selection(void) {
sLoadedActNum = sInitSelectedActNum; sLoadedActNum = sInitSelectedActNum;
} }
gDialogCourseActNum = sSelectedActIndex + 1; gDialogCourseActNum = sSelectedActIndex + 1;
gInsidePainting = FALSE;
if (gControlPainting) {
network_send_inside_painting();
}
} }

View file

@ -12,11 +12,10 @@ struct PacketDataInsidePainting {
u8 controlPainting; u8 controlPainting;
u8 starIndex; u8 starIndex;
u8 actIndex; u8 actIndex;
struct WarpNode warpNode;
}; };
static clock_t lastSentTime = 0; static clock_t lastSentTime = 0;
static float minUpdateRate = 0.5f; static float minUpdateRate = 5.0f;
static struct PacketDataInsidePainting lastSentData = { 0 }; static struct PacketDataInsidePainting lastSentData = { 0 };
static void populate_packet_data(struct PacketDataInsidePainting* data) { static void populate_packet_data(struct PacketDataInsidePainting* data) {
@ -24,7 +23,6 @@ static void populate_packet_data(struct PacketDataInsidePainting* data) {
data->controlPainting = gControlPainting; data->controlPainting = gControlPainting;
data->starIndex = sSelectableStarIndex; data->starIndex = sSelectableStarIndex;
data->actIndex = sSelectedActIndex; data->actIndex = sSelectedActIndex;
data->warpNode = gPaintingWarpNode;
} }
void network_send_inside_painting(void) { void network_send_inside_painting(void) {
@ -55,24 +53,11 @@ void network_receive_inside_painting(struct Packet* p) {
sSelectedActIndex = remote.actIndex; sSelectedActIndex = remote.actIndex;
} }
// see if the warp nodes are the same if (gControlPainting && !remote.controlPainting) {
int compareNodes = memcmp(&gPaintingWarpNode, &remote.warpNode, sizeof(struct WarpNode));
if (gControlPainting && !remote.controlPainting && (compareNodes == 0)) {
// remote is well behaved now, we can control the painting // remote is well behaved now, we can control the painting
gWaitingForRemotePainting = false; gWaitingForRemotePainting = false;
} }
bool shouldJumpInside = !gControlPainting && (!gInsidePainting && remote.insidePainting);
// ERROR: THE DESTINATION MISMATCH DOESN'T MOVE THE CLIENT TO THE CORRECT SCREEN!
bool destinationMismatch = !gControlPainting && (compareNodes != 0);
if (shouldJumpInside || destinationMismatch) {
initiate_painting_warp_node(&remote.warpNode, true);
set_play_mode(PLAY_MODE_CHANGE_LEVEL);
}
if (gControlPainting && !remote.controlPainting && !gInsidePainting && remote.insidePainting) { if (gControlPainting && !remote.controlPainting && !gInsidePainting && remote.insidePainting) {
// we're in control and no longer in the painting, let remote know // we're in control and no longer in the painting, let remote know
network_send_inside_painting(); network_send_inside_painting();