mirror of
https://github.com/coop-deluxe/sm64coopdx.git
synced 2024-10-19 03:32:41 +00:00
Instance levels based on which star was selected
Previously the levels were instanced based on "act" which is a concept that is invisible and unintuitive to the user.
This commit is contained in:
parent
cd48d177b0
commit
361a57edb6
22 changed files with 85 additions and 80 deletions
|
@ -33,6 +33,7 @@ struct WarpTransition gWarpTransition;
|
||||||
|
|
||||||
s16 gCurrCourseNum;
|
s16 gCurrCourseNum;
|
||||||
s16 gCurrActNum;
|
s16 gCurrActNum;
|
||||||
|
s16 gCurrActStarNum;
|
||||||
s16 gCurrAreaIndex;
|
s16 gCurrAreaIndex;
|
||||||
s16 gSavedCourseNum;
|
s16 gSavedCourseNum;
|
||||||
s16 gPauseScreenMode;
|
s16 gPauseScreenMode;
|
||||||
|
|
|
@ -125,6 +125,7 @@ extern struct Area gAreaData[];
|
||||||
extern struct WarpTransition gWarpTransition;
|
extern struct WarpTransition gWarpTransition;
|
||||||
extern s16 gCurrCourseNum;
|
extern s16 gCurrCourseNum;
|
||||||
extern s16 gCurrActNum;
|
extern s16 gCurrActNum;
|
||||||
|
extern s16 gCurrActStarNum;
|
||||||
extern s16 gCurrAreaIndex;
|
extern s16 gCurrAreaIndex;
|
||||||
extern s16 gSavedCourseNum;
|
extern s16 gSavedCourseNum;
|
||||||
extern s16 gPauseScreenMode;
|
extern s16 gPauseScreenMode;
|
||||||
|
|
|
@ -1177,7 +1177,7 @@ s32 play_mode_change_level(void) {
|
||||||
gHudDisplay.flags = HUD_DISPLAY_NONE;
|
gHudDisplay.flags = HUD_DISPLAY_NONE;
|
||||||
sTransitionTimer = 0;
|
sTransitionTimer = 0;
|
||||||
sTransitionUpdate = NULL;
|
sTransitionUpdate = NULL;
|
||||||
|
gCurrActStarNum = 0;
|
||||||
if (sWarpDest.type != WARP_TYPE_NOT_WARPING) {
|
if (sWarpDest.type != WARP_TYPE_NOT_WARPING) {
|
||||||
return sWarpDest.levelNum;
|
return sWarpDest.levelNum;
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -455,4 +455,5 @@ void star_select_finish_selection(void) {
|
||||||
sLoadedActNum = sInitSelectedActNum;
|
sLoadedActNum = sInitSelectedActNum;
|
||||||
}
|
}
|
||||||
gDialogCourseActNum = sSelectedActIndex + 1;
|
gDialogCourseActNum = sSelectedActIndex + 1;
|
||||||
|
gCurrActStarNum = gDialogCourseActNum;
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,7 +13,7 @@
|
||||||
|
|
||||||
// Mario 64 specific externs
|
// Mario 64 specific externs
|
||||||
extern s16 sCurrPlayMode;
|
extern s16 sCurrPlayMode;
|
||||||
extern s16 gCurrCourseNum, gCurrActNum, gCurrLevelNum, gCurrAreaIndex;
|
extern s16 gCurrCourseNum, gCurrActStarNum, gCurrLevelNum, gCurrAreaIndex;
|
||||||
|
|
||||||
enum NetworkType gNetworkType = NT_NONE;
|
enum NetworkType gNetworkType = NT_NONE;
|
||||||
#ifdef DISCORD_SDK
|
#ifdef DISCORD_SDK
|
||||||
|
@ -98,7 +98,7 @@ void network_on_loaded_level(void) {
|
||||||
struct NetworkPlayer* np = gNetworkPlayerLocal;
|
struct NetworkPlayer* np = gNetworkPlayerLocal;
|
||||||
if (np != NULL) {
|
if (np != NULL) {
|
||||||
bool levelMatch = (np->currCourseNum == gCurrCourseNum
|
bool levelMatch = (np->currCourseNum == gCurrCourseNum
|
||||||
&& np->currActNum == gCurrActNum
|
&& np->currActNum == gCurrActStarNum
|
||||||
&& np->currLevelNum == gCurrLevelNum);
|
&& np->currLevelNum == gCurrLevelNum);
|
||||||
if (np->currLevelSyncValid && levelMatch && np->currAreaIndex != gCurrAreaIndex) {
|
if (np->currLevelSyncValid && levelMatch && np->currAreaIndex != gCurrAreaIndex) {
|
||||||
network_send_change_area();
|
network_send_change_area();
|
||||||
|
|
|
@ -4,17 +4,17 @@
|
||||||
|
|
||||||
void packet_process(struct Packet* p) {
|
void packet_process(struct Packet* p) {
|
||||||
if (p->levelAreaMustMatch) {
|
if (p->levelAreaMustMatch) {
|
||||||
extern s16 gCurrCourseNum, gCurrActNum, gCurrLevelNum, gCurrAreaIndex;
|
extern s16 gCurrCourseNum, gCurrActStarNum, gCurrLevelNum, gCurrAreaIndex;
|
||||||
bool levelAreaMismatch =
|
bool levelAreaMismatch =
|
||||||
(p->courseNum != gCurrCourseNum
|
(p->courseNum != gCurrCourseNum
|
||||||
|| p->actNum != gCurrActNum
|
|| p->actNum != gCurrActStarNum
|
||||||
|| p->levelNum != gCurrLevelNum
|
|| p->levelNum != gCurrLevelNum
|
||||||
|| p->areaIndex != gCurrAreaIndex);
|
|| p->areaIndex != gCurrAreaIndex);
|
||||||
// drop packet
|
// drop packet
|
||||||
if (levelAreaMismatch) {
|
if (levelAreaMismatch) {
|
||||||
if (gNetworkType != NT_SERVER) {
|
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, gCurrActStarNum, gCurrLevelNum, gCurrAreaIndex);
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -30,7 +30,7 @@ void area_remove_sync_ids_clear(void) {
|
||||||
/////////////////////////////////////////////////
|
/////////////////////////////////////////////////
|
||||||
|
|
||||||
void network_send_area(struct NetworkPlayer* toNp) {
|
void network_send_area(struct NetworkPlayer* toNp) {
|
||||||
extern s16 gCurrCourseNum, gCurrActNum, gCurrLevelNum, gCurrAreaIndex;
|
extern s16 gCurrCourseNum, gCurrActStarNum, gCurrLevelNum, gCurrAreaIndex;
|
||||||
|
|
||||||
packet_ordered_begin();
|
packet_ordered_begin();
|
||||||
{
|
{
|
||||||
|
@ -38,10 +38,10 @@ void network_send_area(struct NetworkPlayer* toNp) {
|
||||||
packet_init(&p, PACKET_AREA, true, false);
|
packet_init(&p, PACKET_AREA, true, false);
|
||||||
|
|
||||||
// level location
|
// level location
|
||||||
packet_write(&p, &gCurrCourseNum, sizeof(s16));
|
packet_write(&p, &gCurrCourseNum, sizeof(s16));
|
||||||
packet_write(&p, &gCurrActNum, sizeof(s16));
|
packet_write(&p, &gCurrActStarNum, sizeof(s16));
|
||||||
packet_write(&p, &gCurrLevelNum, sizeof(s16));
|
packet_write(&p, &gCurrLevelNum, sizeof(s16));
|
||||||
packet_write(&p, &gCurrAreaIndex, sizeof(s16));
|
packet_write(&p, &gCurrAreaIndex, sizeof(s16));
|
||||||
|
|
||||||
// write sync id removals
|
// write sync id removals
|
||||||
packet_write(&p, &sRemoveSyncIdsIndex, sizeof(u8));
|
packet_write(&p, &sRemoveSyncIdsIndex, sizeof(u8));
|
||||||
|
@ -129,8 +129,8 @@ void network_receive_area(struct Packet* p) {
|
||||||
packet_read(p, &levelNum, sizeof(s16));
|
packet_read(p, &levelNum, sizeof(s16));
|
||||||
packet_read(p, &areaIndex, sizeof(s16));
|
packet_read(p, &areaIndex, sizeof(s16));
|
||||||
|
|
||||||
extern s16 gCurrCourseNum, gCurrActNum, gCurrLevelNum;
|
extern s16 gCurrCourseNum, gCurrActStarNum, gCurrLevelNum;
|
||||||
if (courseNum != gCurrCourseNum || actNum != gCurrActNum || levelNum != gCurrLevelNum || areaIndex != gCurrAreaIndex) {
|
if (courseNum != gCurrCourseNum || actNum != gCurrActStarNum || levelNum != gCurrLevelNum || areaIndex != gCurrAreaIndex) {
|
||||||
LOG_ERROR("rx area: received an improper location");
|
LOG_ERROR("rx area: received an improper location");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -38,8 +38,8 @@ void network_receive_area_request(struct Packet* p) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
extern s16 gCurrCourseNum, gCurrActNum, gCurrLevelNum, gCurrAreaIndex;
|
extern s16 gCurrCourseNum, gCurrActStarNum, gCurrLevelNum, gCurrAreaIndex;
|
||||||
if (courseNum != gCurrCourseNum || actNum != gCurrActNum || levelNum != gCurrLevelNum || areaIndex != gCurrAreaIndex) {
|
if (courseNum != gCurrCourseNum || actNum != gCurrActStarNum || levelNum != gCurrLevelNum || areaIndex != gCurrAreaIndex) {
|
||||||
LOG_ERROR("rx area request: received an improper location");
|
LOG_ERROR("rx area request: received an improper location");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -29,29 +29,30 @@ static void player_changed_area(struct NetworkPlayer* np, s16 courseNum, s16 act
|
||||||
}
|
}
|
||||||
|
|
||||||
void network_send_change_area(void) {
|
void network_send_change_area(void) {
|
||||||
extern s16 gCurrCourseNum, gCurrActNum, gCurrLevelNum, gCurrAreaIndex;
|
extern s16 gCurrCourseNum, gCurrActNum, gCurrActStarNum, gCurrLevelNum, gCurrAreaIndex;
|
||||||
|
|
||||||
// override castle act to 0 to prevent instancing of the hub
|
// override castle act to 0 to prevent instancing of the hub
|
||||||
if (gCurrCourseNum == 0 && (gCurrLevelNum == LEVEL_CASTLE || gCurrLevelNum == LEVEL_CASTLE_GROUNDS || gCurrLevelNum == LEVEL_CASTLE_COURTYARD)) {
|
if (gCurrCourseNum == 0 && (gCurrLevelNum == LEVEL_CASTLE || gCurrLevelNum == LEVEL_CASTLE_GROUNDS || gCurrLevelNum == LEVEL_CASTLE_COURTYARD)) {
|
||||||
|
gCurrActStarNum = 0;
|
||||||
gCurrActNum = 0;
|
gCurrActNum = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (gNetworkType == NT_SERVER) {
|
if (gNetworkType == NT_SERVER) {
|
||||||
player_changed_area(gNetworkPlayerLocal, gCurrCourseNum, gCurrActNum, gCurrLevelNum, gCurrAreaIndex);
|
player_changed_area(gNetworkPlayerLocal, gCurrCourseNum, gCurrActStarNum, gCurrLevelNum, gCurrAreaIndex);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
struct Packet p;
|
struct Packet p;
|
||||||
packet_init(&p, PACKET_CHANGE_AREA, true, false);
|
packet_init(&p, PACKET_CHANGE_AREA, true, false);
|
||||||
packet_write(&p, &gCurrCourseNum, sizeof(s16));
|
packet_write(&p, &gCurrCourseNum, sizeof(s16));
|
||||||
packet_write(&p, &gCurrActNum, sizeof(s16));
|
packet_write(&p, &gCurrActStarNum, sizeof(s16));
|
||||||
packet_write(&p, &gCurrLevelNum, sizeof(s16));
|
packet_write(&p, &gCurrLevelNum, sizeof(s16));
|
||||||
packet_write(&p, &gCurrAreaIndex, sizeof(s16));
|
packet_write(&p, &gCurrAreaIndex, sizeof(s16));
|
||||||
network_send_to(gNetworkPlayerServer->localIndex, &p);
|
network_send_to(gNetworkPlayerServer->localIndex, &p);
|
||||||
|
|
||||||
struct NetworkPlayer* np = gNetworkPlayerLocal;
|
struct NetworkPlayer* np = gNetworkPlayerLocal;
|
||||||
np->currCourseNum = gCurrCourseNum;
|
np->currCourseNum = gCurrCourseNum;
|
||||||
np->currActNum = gCurrActNum;
|
np->currActNum = gCurrActStarNum;
|
||||||
np->currLevelNum = gCurrLevelNum;
|
np->currLevelNum = gCurrLevelNum;
|
||||||
np->currAreaIndex = gCurrAreaIndex;
|
np->currAreaIndex = gCurrAreaIndex;
|
||||||
np->currAreaSyncValid = false;
|
np->currAreaSyncValid = false;
|
||||||
|
|
|
@ -36,29 +36,30 @@ static void player_changed_level(struct NetworkPlayer* np, s16 courseNum, s16 ac
|
||||||
}
|
}
|
||||||
|
|
||||||
void network_send_change_level(void) {
|
void network_send_change_level(void) {
|
||||||
extern s16 gCurrCourseNum, gCurrActNum, gCurrLevelNum, gCurrAreaIndex;
|
extern s16 gCurrCourseNum, gCurrActNum, gCurrActStarNum, gCurrLevelNum, gCurrAreaIndex;
|
||||||
|
|
||||||
// override castle act to 0 to prevent instancing of the hub
|
// override castle act to 0 to prevent instancing of the hub
|
||||||
if (gCurrCourseNum == 0 && (gCurrLevelNum == LEVEL_CASTLE || gCurrLevelNum == LEVEL_CASTLE_GROUNDS || gCurrLevelNum == LEVEL_CASTLE_COURTYARD)) {
|
if (gCurrCourseNum == 0 && (gCurrLevelNum == LEVEL_CASTLE || gCurrLevelNum == LEVEL_CASTLE_GROUNDS || gCurrLevelNum == LEVEL_CASTLE_COURTYARD)) {
|
||||||
|
gCurrActStarNum = 0;
|
||||||
gCurrActNum = 0;
|
gCurrActNum = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (gNetworkType == NT_SERVER) {
|
if (gNetworkType == NT_SERVER) {
|
||||||
player_changed_level(gNetworkPlayerLocal, gCurrCourseNum, gCurrActNum, gCurrLevelNum, gCurrAreaIndex);
|
player_changed_level(gNetworkPlayerLocal, gCurrCourseNum, gCurrActStarNum, gCurrLevelNum, gCurrAreaIndex);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
struct Packet p;
|
struct Packet p;
|
||||||
packet_init(&p, PACKET_CHANGE_LEVEL, true, false);
|
packet_init(&p, PACKET_CHANGE_LEVEL, true, false);
|
||||||
packet_write(&p, &gCurrCourseNum, sizeof(s16));
|
packet_write(&p, &gCurrCourseNum, sizeof(s16));
|
||||||
packet_write(&p, &gCurrActNum, sizeof(s16));
|
packet_write(&p, &gCurrActStarNum, sizeof(s16));
|
||||||
packet_write(&p, &gCurrLevelNum, sizeof(s16));
|
packet_write(&p, &gCurrLevelNum, sizeof(s16));
|
||||||
packet_write(&p, &gCurrAreaIndex, sizeof(s16));
|
packet_write(&p, &gCurrAreaIndex, sizeof(s16));
|
||||||
network_send_to(gNetworkPlayerServer->localIndex, &p);
|
network_send_to(gNetworkPlayerServer->localIndex, &p);
|
||||||
|
|
||||||
struct NetworkPlayer* np = gNetworkPlayerLocal;
|
struct NetworkPlayer* np = gNetworkPlayerLocal;
|
||||||
np->currCourseNum = gCurrCourseNum;
|
np->currCourseNum = gCurrCourseNum;
|
||||||
np->currActNum = gCurrActNum;
|
np->currActNum = gCurrActStarNum;
|
||||||
np->currLevelNum = gCurrLevelNum;
|
np->currLevelNum = gCurrLevelNum;
|
||||||
np->currAreaIndex = gCurrAreaIndex;
|
np->currAreaIndex = gCurrAreaIndex;
|
||||||
np->currAreaSyncValid = false;
|
np->currAreaSyncValid = false;
|
||||||
|
|
|
@ -11,7 +11,7 @@
|
||||||
#include "pc/debuglog.h"
|
#include "pc/debuglog.h"
|
||||||
|
|
||||||
void network_send_level(struct NetworkPlayer* toNp, bool sendArea) {
|
void network_send_level(struct NetworkPlayer* toNp, bool sendArea) {
|
||||||
extern s16 gCurrCourseNum, gCurrActNum, gCurrLevelNum;
|
extern s16 gCurrCourseNum, gCurrActStarNum, gCurrLevelNum;
|
||||||
|
|
||||||
packet_ordered_begin();
|
packet_ordered_begin();
|
||||||
{
|
{
|
||||||
|
@ -19,9 +19,9 @@ void network_send_level(struct NetworkPlayer* toNp, bool sendArea) {
|
||||||
packet_init(&p, PACKET_LEVEL, true, false);
|
packet_init(&p, PACKET_LEVEL, true, false);
|
||||||
|
|
||||||
// level location
|
// level location
|
||||||
packet_write(&p, &gCurrCourseNum, sizeof(s16));
|
packet_write(&p, &gCurrCourseNum, sizeof(s16));
|
||||||
packet_write(&p, &gCurrActNum, sizeof(s16));
|
packet_write(&p, &gCurrActStarNum, sizeof(s16));
|
||||||
packet_write(&p, &gCurrLevelNum, sizeof(s16));
|
packet_write(&p, &gCurrLevelNum, sizeof(s16));
|
||||||
|
|
||||||
// level variables
|
// level variables
|
||||||
packet_write(&p, &gMarioStates[0].numCoins, sizeof(s16));
|
packet_write(&p, &gMarioStates[0].numCoins, sizeof(s16));
|
||||||
|
@ -62,8 +62,8 @@ void network_receive_level(struct Packet* p) {
|
||||||
packet_read(p, &actNum, sizeof(s16));
|
packet_read(p, &actNum, sizeof(s16));
|
||||||
packet_read(p, &levelNum, sizeof(s16));
|
packet_read(p, &levelNum, sizeof(s16));
|
||||||
|
|
||||||
extern s16 gCurrCourseNum, gCurrActNum, gCurrLevelNum;
|
extern s16 gCurrCourseNum, gCurrActStarNum, gCurrLevelNum;
|
||||||
if (courseNum != gCurrCourseNum || actNum != gCurrActNum || levelNum != gCurrLevelNum) {
|
if (courseNum != gCurrCourseNum || actNum != gCurrActStarNum || levelNum != gCurrLevelNum) {
|
||||||
LOG_ERROR("rx level: received an improper location");
|
LOG_ERROR("rx level: received an improper location");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -38,8 +38,8 @@ void network_receive_level_area_request(struct Packet* p) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
extern s16 gCurrCourseNum, gCurrActNum, gCurrLevelNum, gCurrAreaIndex;
|
extern s16 gCurrCourseNum, gCurrActStarNum, gCurrLevelNum, gCurrAreaIndex;
|
||||||
if (courseNum != gCurrCourseNum || actNum != gCurrActNum || levelNum != gCurrLevelNum || areaIndex != gCurrAreaIndex) {
|
if (courseNum != gCurrCourseNum || actNum != gCurrActStarNum || levelNum != gCurrLevelNum || areaIndex != gCurrAreaIndex) {
|
||||||
LOG_ERROR("rx level area request: received an improper location");
|
LOG_ERROR("rx level area request: received an improper location");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -38,10 +38,10 @@ static void network_send_level_macro_area(struct NetworkPlayer* destNp, u8 areaI
|
||||||
// write header
|
// write header
|
||||||
struct Packet p;
|
struct Packet p;
|
||||||
packet_init(&p, PACKET_LEVEL_MACRO, true, false);
|
packet_init(&p, PACKET_LEVEL_MACRO, true, false);
|
||||||
packet_write(&p, &gCurrCourseNum, sizeof(s16));
|
packet_write(&p, &gCurrCourseNum, sizeof(s16));
|
||||||
packet_write(&p, &gCurrActNum, sizeof(s16));
|
packet_write(&p, &gCurrActStarNum, sizeof(s16));
|
||||||
packet_write(&p, &gCurrLevelNum, sizeof(s16));
|
packet_write(&p, &gCurrLevelNum, sizeof(s16));
|
||||||
packet_write(&p, &gCurrAreaIndex, sizeof(s16));
|
packet_write(&p, &gCurrAreaIndex, sizeof(s16));
|
||||||
|
|
||||||
// write this area's index
|
// write this area's index
|
||||||
packet_write(&p, &areaIndex, sizeof(u8));
|
packet_write(&p, &areaIndex, sizeof(u8));
|
||||||
|
@ -127,7 +127,7 @@ void network_receive_level_macro(struct Packet* p) {
|
||||||
packet_read(p, &levelNum, sizeof(s16));
|
packet_read(p, &levelNum, sizeof(s16));
|
||||||
packet_read(p, &areaIndex, sizeof(s16));
|
packet_read(p, &areaIndex, sizeof(s16));
|
||||||
|
|
||||||
if (courseNum != gCurrCourseNum || actNum != gCurrActNum || levelNum != gCurrLevelNum) {
|
if (courseNum != gCurrCourseNum || actNum != gCurrActStarNum || levelNum != gCurrLevelNum) {
|
||||||
LOG_ERROR("Receiving 'location response' with the wrong location!");
|
LOG_ERROR("Receiving 'location response' with the wrong location!");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -36,8 +36,8 @@ void network_receive_level_request(struct Packet* p) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
extern s16 gCurrCourseNum, gCurrActNum, gCurrLevelNum;
|
extern s16 gCurrCourseNum, gCurrActStarNum, gCurrLevelNum;
|
||||||
if (courseNum != gCurrCourseNum || actNum != gCurrActNum || levelNum != gCurrLevelNum) {
|
if (courseNum != gCurrCourseNum || actNum != gCurrActStarNum || levelNum != gCurrLevelNum) {
|
||||||
LOG_ERROR("rx level request: received an improper location");
|
LOG_ERROR("rx level request: received an improper location");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -111,10 +111,10 @@ void network_send_level_respawn_info(struct Object* o, u8 respawnInfoBits) {
|
||||||
// write header
|
// write header
|
||||||
struct Packet p;
|
struct Packet p;
|
||||||
packet_init(&p, PACKET_LEVEL_RESPAWN_INFO, true, false);
|
packet_init(&p, PACKET_LEVEL_RESPAWN_INFO, true, false);
|
||||||
packet_write(&p, &gCurrCourseNum, sizeof(s16));
|
packet_write(&p, &gCurrCourseNum, sizeof(s16));
|
||||||
packet_write(&p, &gCurrActNum, sizeof(s16));
|
packet_write(&p, &gCurrActStarNum, sizeof(s16));
|
||||||
packet_write(&p, &gCurrLevelNum, sizeof(s16));
|
packet_write(&p, &gCurrLevelNum, sizeof(s16));
|
||||||
packet_write(&p, &gCurrAreaIndex, sizeof(s16));
|
packet_write(&p, &gCurrAreaIndex, sizeof(s16));
|
||||||
|
|
||||||
// write object info
|
// write object info
|
||||||
packet_write(&p, &isMacroObject, sizeof(u8));
|
packet_write(&p, &isMacroObject, sizeof(u8));
|
||||||
|
@ -131,7 +131,7 @@ void network_send_level_respawn_info(struct Object* o, u8 respawnInfoBits) {
|
||||||
if (!np->connected) { continue; }
|
if (!np->connected) { continue; }
|
||||||
if (!np->currLevelSyncValid) { continue; }
|
if (!np->currLevelSyncValid) { continue; }
|
||||||
if (np->currCourseNum != gCurrCourseNum) { continue; }
|
if (np->currCourseNum != gCurrCourseNum) { continue; }
|
||||||
if (np->currActNum != gCurrActNum) { continue; }
|
if (np->currActNum != gCurrActStarNum) { continue; }
|
||||||
if (np->currLevelNum != gCurrLevelNum) { continue; }
|
if (np->currLevelNum != gCurrLevelNum) { continue; }
|
||||||
if (np == gNetworkPlayerLocal) { continue; }
|
if (np == gNetworkPlayerLocal) { continue; }
|
||||||
struct Packet p2;
|
struct Packet p2;
|
||||||
|
@ -164,7 +164,7 @@ void network_receive_level_respawn_info(struct Packet* p) {
|
||||||
packet_read(p, &respawnInfoBits, sizeof(u8));
|
packet_read(p, &respawnInfoBits, sizeof(u8));
|
||||||
|
|
||||||
|
|
||||||
bool levelMismatch = (courseNum != gCurrCourseNum || actNum != gCurrActNum || levelNum != gCurrLevelNum);
|
bool levelMismatch = (courseNum != gCurrCourseNum || actNum != gCurrActStarNum || levelNum != gCurrLevelNum);
|
||||||
if (gNetworkType == NT_SERVER) {
|
if (gNetworkType == NT_SERVER) {
|
||||||
// ensure we got the info from a valid player
|
// ensure we got the info from a valid player
|
||||||
struct NetworkPlayer* npFrom = &gNetworkPlayers[p->localIndex];
|
struct NetworkPlayer* npFrom = &gNetworkPlayers[p->localIndex];
|
||||||
|
|
|
@ -37,10 +37,10 @@ static void network_send_level_spawn_info_area(struct NetworkPlayer* destNp, u8
|
||||||
// write header
|
// write header
|
||||||
struct Packet p;
|
struct Packet p;
|
||||||
packet_init(&p, PACKET_LEVEL_SPAWN_INFO, true, false);
|
packet_init(&p, PACKET_LEVEL_SPAWN_INFO, true, false);
|
||||||
packet_write(&p, &gCurrCourseNum, sizeof(s16));
|
packet_write(&p, &gCurrCourseNum, sizeof(s16));
|
||||||
packet_write(&p, &gCurrActNum, sizeof(s16));
|
packet_write(&p, &gCurrActStarNum, sizeof(s16));
|
||||||
packet_write(&p, &gCurrLevelNum, sizeof(s16));
|
packet_write(&p, &gCurrLevelNum, sizeof(s16));
|
||||||
packet_write(&p, &gCurrAreaIndex, sizeof(s16));
|
packet_write(&p, &gCurrAreaIndex, sizeof(s16));
|
||||||
|
|
||||||
// write this area's index
|
// write this area's index
|
||||||
packet_write(&p, &areaIndex, sizeof(u8));
|
packet_write(&p, &areaIndex, sizeof(u8));
|
||||||
|
@ -96,7 +96,7 @@ void network_receive_level_spawn_info(struct Packet* p) {
|
||||||
packet_read(p, &levelNum, sizeof(s16));
|
packet_read(p, &levelNum, sizeof(s16));
|
||||||
packet_read(p, &areaIndex, sizeof(s16));
|
packet_read(p, &areaIndex, sizeof(s16));
|
||||||
|
|
||||||
if (courseNum != gCurrCourseNum || actNum != gCurrActNum || levelNum != gCurrLevelNum) {
|
if (courseNum != gCurrCourseNum || actNum != gCurrActStarNum || levelNum != gCurrLevelNum) {
|
||||||
LOG_ERROR("Receiving 'location response' with the wrong location!");
|
LOG_ERROR("Receiving 'location response' with the wrong location!");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -56,12 +56,12 @@ void packet_init(struct Packet* packet, enum PacketType packetType, bool reliabl
|
||||||
|
|
||||||
// write location
|
// write location
|
||||||
if (levelAreaMustMatch) {
|
if (levelAreaMustMatch) {
|
||||||
packet_write(packet, &gCurrCourseNum, sizeof(u8));
|
packet_write(packet, &gCurrCourseNum, sizeof(u8));
|
||||||
packet_write(packet, &gCurrActNum, sizeof(u8));
|
packet_write(packet, &gCurrActStarNum, sizeof(u8));
|
||||||
packet_write(packet, &gCurrLevelNum, sizeof(u8));
|
packet_write(packet, &gCurrLevelNum, sizeof(u8));
|
||||||
packet_write(packet, &gCurrAreaIndex, sizeof(u8));
|
packet_write(packet, &gCurrAreaIndex, sizeof(u8));
|
||||||
packet->courseNum = gCurrCourseNum;
|
packet->courseNum = gCurrCourseNum;
|
||||||
packet->actNum = gCurrActNum;
|
packet->actNum = gCurrActStarNum;
|
||||||
packet->levelNum = gCurrLevelNum;
|
packet->levelNum = gCurrLevelNum;
|
||||||
packet->areaIndex = gCurrAreaIndex;
|
packet->areaIndex = gCurrAreaIndex;
|
||||||
}
|
}
|
||||||
|
|
|
@ -37,8 +37,8 @@ void network_receive_reservation_list(struct Packet* p) {
|
||||||
packet_read(p, &levelNum, sizeof(u8));
|
packet_read(p, &levelNum, sizeof(u8));
|
||||||
packet_read(p, &areaIndex, sizeof(u8));
|
packet_read(p, &areaIndex, sizeof(u8));
|
||||||
|
|
||||||
extern s16 gCurrCourseNum, gCurrActNum, gCurrLevelNum, gCurrAreaIndex;
|
extern s16 gCurrCourseNum, gCurrActStarNum, gCurrLevelNum, gCurrAreaIndex;
|
||||||
if (courseNum != gCurrCourseNum || actNum != gCurrActNum || levelNum != gCurrLevelNum || areaIndex != gCurrAreaIndex) {
|
if (courseNum != gCurrCourseNum || actNum != gCurrActStarNum || levelNum != gCurrLevelNum || areaIndex != gCurrAreaIndex) {
|
||||||
LOG_ERROR("received an improper location");
|
LOG_ERROR("received an improper location");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,11 +19,11 @@ void network_send_reservation_release(u8 syncId) {
|
||||||
struct Packet p;
|
struct Packet p;
|
||||||
packet_init(&p, PACKET_RESERVATION_RELEASE, true, false);
|
packet_init(&p, PACKET_RESERVATION_RELEASE, true, false);
|
||||||
|
|
||||||
extern s16 gCurrCourseNum, gCurrActNum, gCurrLevelNum, gCurrAreaIndex;
|
extern s16 gCurrCourseNum, gCurrActStarNum, gCurrLevelNum, gCurrAreaIndex;
|
||||||
packet_write(&p, &gCurrCourseNum, sizeof(u8));
|
packet_write(&p, &gCurrCourseNum, sizeof(u8));
|
||||||
packet_write(&p, &gCurrActNum, sizeof(u8));
|
packet_write(&p, &gCurrActStarNum, sizeof(u8));
|
||||||
packet_write(&p, &gCurrLevelNum, sizeof(u8));
|
packet_write(&p, &gCurrLevelNum, sizeof(u8));
|
||||||
packet_write(&p, &gCurrAreaIndex, sizeof(u8));
|
packet_write(&p, &gCurrAreaIndex, sizeof(u8));
|
||||||
|
|
||||||
packet_write(&p, &syncId, sizeof(u8));
|
packet_write(&p, &syncId, sizeof(u8));
|
||||||
|
|
||||||
|
@ -45,8 +45,8 @@ void network_receive_reservation_release(struct Packet* p) {
|
||||||
packet_read(p, &levelNum, sizeof(u8));
|
packet_read(p, &levelNum, sizeof(u8));
|
||||||
packet_read(p, &areaIndex, sizeof(u8));
|
packet_read(p, &areaIndex, sizeof(u8));
|
||||||
|
|
||||||
extern s16 gCurrCourseNum, gCurrActNum, gCurrLevelNum, gCurrAreaIndex;
|
extern s16 gCurrCourseNum, gCurrActStarNum, gCurrLevelNum, gCurrAreaIndex;
|
||||||
if (courseNum != gCurrCourseNum || actNum != gCurrActNum || levelNum != gCurrLevelNum || areaIndex != gCurrAreaIndex) {
|
if (courseNum != gCurrCourseNum || actNum != gCurrActStarNum || levelNum != gCurrLevelNum || areaIndex != gCurrAreaIndex) {
|
||||||
LOG_ERROR("received an improper location");
|
LOG_ERROR("received an improper location");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,11 +19,11 @@ void network_send_reservation_use(u8 syncId) {
|
||||||
struct Packet p;
|
struct Packet p;
|
||||||
packet_init(&p, PACKET_RESERVATION_USE, true, false);
|
packet_init(&p, PACKET_RESERVATION_USE, true, false);
|
||||||
|
|
||||||
extern s16 gCurrCourseNum, gCurrActNum, gCurrLevelNum, gCurrAreaIndex;
|
extern s16 gCurrCourseNum, gCurrActStarNum, gCurrLevelNum, gCurrAreaIndex;
|
||||||
packet_write(&p, &gCurrCourseNum, sizeof(u8));
|
packet_write(&p, &gCurrCourseNum, sizeof(u8));
|
||||||
packet_write(&p, &gCurrActNum, sizeof(u8));
|
packet_write(&p, &gCurrActStarNum, sizeof(u8));
|
||||||
packet_write(&p, &gCurrLevelNum, sizeof(u8));
|
packet_write(&p, &gCurrLevelNum, sizeof(u8));
|
||||||
packet_write(&p, &gCurrAreaIndex, sizeof(u8));
|
packet_write(&p, &gCurrAreaIndex, sizeof(u8));
|
||||||
|
|
||||||
packet_write(&p, &syncId, sizeof(u8));
|
packet_write(&p, &syncId, sizeof(u8));
|
||||||
|
|
||||||
|
@ -45,8 +45,8 @@ void network_receive_reservation_use(struct Packet* p) {
|
||||||
packet_read(p, &levelNum, sizeof(u8));
|
packet_read(p, &levelNum, sizeof(u8));
|
||||||
packet_read(p, &areaIndex, sizeof(u8));
|
packet_read(p, &areaIndex, sizeof(u8));
|
||||||
|
|
||||||
extern s16 gCurrCourseNum, gCurrActNum, gCurrLevelNum, gCurrAreaIndex;
|
extern s16 gCurrCourseNum, gCurrActStarNum, gCurrLevelNum, gCurrAreaIndex;
|
||||||
if (courseNum != gCurrCourseNum || actNum != gCurrActNum || levelNum != gCurrLevelNum || areaIndex != gCurrAreaIndex) {
|
if (courseNum != gCurrCourseNum || actNum != gCurrActStarNum || levelNum != gCurrLevelNum || areaIndex != gCurrAreaIndex) {
|
||||||
LOG_ERROR("received an improper location");
|
LOG_ERROR("received an improper location");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -39,8 +39,8 @@ void network_receive_sync_valid(struct Packet* p) {
|
||||||
packet_read(p, &fromGlobalIndex, sizeof(u8));
|
packet_read(p, &fromGlobalIndex, sizeof(u8));
|
||||||
|
|
||||||
if (gNetworkType != NT_SERVER) {
|
if (gNetworkType != NT_SERVER) {
|
||||||
extern s16 gCurrCourseNum, gCurrActNum, gCurrLevelNum, gCurrAreaIndex;
|
extern s16 gCurrCourseNum, gCurrActStarNum, gCurrLevelNum, gCurrAreaIndex;
|
||||||
if (courseNum != gCurrCourseNum || actNum != gCurrActNum || levelNum != gCurrLevelNum || areaIndex != gCurrAreaIndex) {
|
if (courseNum != gCurrCourseNum || actNum != gCurrActStarNum || levelNum != gCurrLevelNum || areaIndex != gCurrAreaIndex) {
|
||||||
LOG_ERROR("rx sync valid: received an improper location");
|
LOG_ERROR("rx sync valid: received an improper location");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -269,8 +269,8 @@ void reservation_area_local_update(u8 courseNum, u8 actNum, u8 levelNum, u8 area
|
||||||
u8 reservation_area_local_grab_id(void) {
|
u8 reservation_area_local_grab_id(void) {
|
||||||
struct LocalReservationArea* la = &sLocalReservationArea;
|
struct LocalReservationArea* la = &sLocalReservationArea;
|
||||||
|
|
||||||
extern s16 gCurrCourseNum, gCurrActNum, gCurrLevelNum, gCurrAreaIndex;
|
extern s16 gCurrCourseNum, gCurrActStarNum, gCurrLevelNum, gCurrAreaIndex;
|
||||||
if (la->courseNum != gCurrCourseNum || la->actNum != gCurrActNum || la->levelNum != gCurrLevelNum || la->areaIndex != gCurrAreaIndex) {
|
if (la->courseNum != gCurrCourseNum || la->actNum != gCurrActStarNum || la->levelNum != gCurrLevelNum || la->areaIndex != gCurrAreaIndex) {
|
||||||
// invalid location
|
// invalid location
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue