diff --git a/build-windows-visual-studio/sm64ex.vcxproj b/build-windows-visual-studio/sm64ex.vcxproj
index 05f69d367..f1935d026 100644
--- a/build-windows-visual-studio/sm64ex.vcxproj
+++ b/build-windows-visual-studio/sm64ex.vcxproj
@@ -3863,6 +3863,7 @@
+
@@ -3963,6 +3964,7 @@
+
@@ -4394,6 +4396,7 @@
+
@@ -4416,6 +4419,7 @@
+
diff --git a/build-windows-visual-studio/sm64ex.vcxproj.filters b/build-windows-visual-studio/sm64ex.vcxproj.filters
index f7e38ee81..a9e0055d7 100644
--- a/build-windows-visual-studio/sm64ex.vcxproj.filters
+++ b/build-windows-visual-studio/sm64ex.vcxproj.filters
@@ -15291,6 +15291,12 @@
Source Files\src\pc\controller
+
+ Source Files\src\pc\djui\panel
+
+
+ Source Files\src\game
+
@@ -16393,5 +16399,11 @@
Source Files\src\pc\controller
+
+ Source Files\src\pc\djui\panel
+
+
+ Source Files\src\game
+
\ No newline at end of file
diff --git a/src/game/level_info.c b/src/game/level_info.c
new file mode 100644
index 000000000..51e40dd83
--- /dev/null
+++ b/src/game/level_info.c
@@ -0,0 +1,136 @@
+#include
+#include
+#include "types.h"
+#include "level_info.h"
+#include "game/memory.h"
+
+extern u8 seg2_course_name_table[];
+
+static const char charset[0xFF + 1] = {
+ ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', // 7
+ ' ', ' ', 'a', 'b', 'c', 'd', 'e', 'f', // 15
+ 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', // 23
+ 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', // 31
+ 'w', 'x', 'y', 'z', ' ', ' ', ' ', ' ', // 39
+ ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', // 49
+ ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', // 55
+ ' ', ' ', ' ', ' ', ' ', ' ', '\'', ' ', // 63
+ ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', // 71
+ ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', // 79
+ ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', // 87
+ ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', // 95
+ ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', // 103
+ ' ', ' ', ' ', ' ', ' ', ' ', ' ', ',', // 111
+ ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', // 119
+ ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', // 127
+ ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', // 135
+ ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', // 143
+ ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', // 151
+ ' ', ' ', ' ', ' ', ' ', ' ', ' ', '-', // 159
+ ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', // 167
+ ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', // 175
+ ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', // 183
+ ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', // 192
+ ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', // 199
+ ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', // 207
+ ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', // 215
+ ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', // 223
+ ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', // 231
+ ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', // 239
+ ' ', ' ', '!', ' ', ' ', ' ', ' ', ' ', // 247
+ ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ' // 255
+};
+
+static void convert_string(const u8* str, char* output) {
+ s32 strPos = 0;
+ bool capitalizeChar = true;
+
+ while (str[strPos] != 0xFF) {
+ if (str[strPos] < 0xFF) {
+ output[strPos] = charset[str[strPos]];
+
+ // if the char is a letter we can capatalize it
+ if (capitalizeChar && 0x0A <= str[strPos] && str[strPos] <= 0x23) {
+ output[strPos] -= ('a' - 'A');
+ capitalizeChar = false;
+ }
+
+ }
+ else {
+ output[strPos] = ' ';
+ }
+
+ // decide if the next character should be capitalized
+ switch (output[strPos]) {
+ case ' ':
+ //if (str[strPos] != 158)
+ //fprintf(stdout, "Unknown Character (%i)\n", str[strPos]); // inform that an unknown char was found
+ case '-':
+ capitalizeChar = true;
+ break;
+ default:
+ capitalizeChar = false;
+ break;
+ }
+
+ strPos++;
+ }
+
+ output[strPos] = '\0';
+}
+
+const char* get_level_name(s16 courseNum, s16 levelNum, s16 areaIndex) {
+ static char stage[188];
+ // overrides for castle locations
+ if (courseNum == 0 && levelNum == 16) {
+ strcpy(stage, "Castle Grounds");
+ return stage;
+ }
+ if (courseNum == 0 && levelNum == 6) {
+ if (areaIndex == 1) {
+ strcpy(stage, "Castle Main Floor");
+ return stage;
+ }
+ else if (areaIndex == 2) {
+ strcpy(stage, "Castle Upper Floor");
+ return stage;
+ }
+ else if (areaIndex == 3) {
+ strcpy(stage, "Castle Basement");
+ return stage;
+ }
+ }
+ if (courseNum == 0 && levelNum == 26) {
+ strcpy(stage, "Castle Courtyard");
+ return stage;
+ }
+
+ // If we are in in Course 0 we are in the castle which doesn't have a string
+ if (courseNum) {
+ void** courseNameTbl;
+
+#ifndef VERSION_EU
+ courseNameTbl = segmented_to_virtual(seg2_course_name_table);
+#else
+ switch (gInGameLanguage) {
+ case LANGUAGE_ENGLISH:
+ courseNameTbl = segmented_to_virtual(course_name_table_eu_en);
+ break;
+ case LANGUAGE_FRENCH:
+ courseNameTbl = segmented_to_virtual(course_name_table_eu_fr);
+ break;
+ case LANGUAGE_GERMAN:
+ courseNameTbl = segmented_to_virtual(course_name_table_eu_de);
+ break;
+ }
+#endif
+ u8* courseName = segmented_to_virtual(courseNameTbl[courseNum - 1]);
+
+ convert_string(&courseName[3], stage);
+ }
+ else {
+ strcpy(stage, "Peach's Castle");
+ }
+
+ return stage;
+}
diff --git a/src/game/level_info.h b/src/game/level_info.h
new file mode 100644
index 000000000..2c81e5ad7
--- /dev/null
+++ b/src/game/level_info.h
@@ -0,0 +1,8 @@
+#ifndef LEVEL_INFO_H
+#define LEVEL_INFO_H
+
+#include
+
+const char* get_level_name(s16 courseNum, s16 levelNum, s16 areaIndex);
+
+#endif // LEVEL_INFO_H
diff --git a/src/pc/djui/djui_panel_playerlist.c b/src/pc/djui/djui_panel_playerlist.c
index 9bfd38f02..345cd1665 100644
--- a/src/pc/djui/djui_panel_playerlist.c
+++ b/src/pc/djui/djui_panel_playerlist.c
@@ -1,5 +1,6 @@
#include
+#include "game/level_info.h"
#include "pc/network/network.h"
#include "djui.h"
#include "djui_panel_playerlist.h"
@@ -14,148 +15,18 @@ static struct DjuiImage* djuiImages[MAX_PLAYERS] = { 0 };
static struct DjuiText* djuiTextNames[MAX_PLAYERS] = { 0 };
static struct DjuiText* djuiTextLocations[MAX_PLAYERS] = { 0 };
-extern u8 seg2_course_name_table[];
-extern u8 seg2_act_name_table[];
-
-static char stage[188];
-static char act[188];
-
-static const char charset[0xFF + 1] = {
- ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', // 7
- ' ', ' ', 'a', 'b', 'c', 'd', 'e', 'f', // 15
- 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', // 23
- 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', // 31
- 'w', 'x', 'y', 'z', ' ', ' ', ' ', ' ', // 39
- ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', // 49
- ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', // 55
- ' ', ' ', ' ', ' ', ' ', ' ', '\'', ' ', // 63
- ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', // 71
- ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', // 79
- ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', // 87
- ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', // 95
- ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', // 103
- ' ', ' ', ' ', ' ', ' ', ' ', ' ', ',', // 111
- ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', // 119
- ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', // 127
- ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', // 135
- ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', // 143
- ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', // 151
- ' ', ' ', ' ', ' ', ' ', ' ', ' ', '-', // 159
- ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', // 167
- ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', // 175
- ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', // 183
- ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', // 192
- ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', // 199
- ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', // 207
- ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', // 215
- ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', // 223
- ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', // 231
- ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', // 239
- ' ', ' ', '!', ' ', ' ', ' ', ' ', ' ', // 247
- ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ' // 255
-};
-
-static void convert_string(const u8* str, char* output) {
- s32 strPos = 0;
- bool capitalizeChar = true;
-
- while (str[strPos] != 0xFF) {
- if (str[strPos] < 0xFF) {
- output[strPos] = charset[str[strPos]];
-
- // if the char is a letter we can capatalize it
- if (capitalizeChar && 0x0A <= str[strPos] && str[strPos] <= 0x23) {
- output[strPos] -= ('a' - 'A');
- capitalizeChar = false;
- }
-
- }
- else {
- output[strPos] = ' ';
- }
-
- // decide if the next character should be capitalized
- switch (output[strPos]) {
- case ' ':
- //if (str[strPos] != 158)
- //fprintf(stdout, "Unknown Character (%i)\n", str[strPos]); // inform that an unknown char was found
- case '-':
- capitalizeChar = true;
- break;
- default:
- capitalizeChar = false;
- break;
- }
-
- strPos++;
- }
-
- output[strPos] = '\0';
-}
-
-static void set_details(s16 courseNum, s16 levelNum, s16 areaIndex) {
- // overrides for castle locations
- if (courseNum == 0 && levelNum == 16) {
- strcpy(stage, "Castle Grounds");
- return;
- }
- if (courseNum == 0 && levelNum == 6) {
- if (areaIndex == 1) {
- strcpy(stage, "Castle Main Floor");
- return;
- } else if (areaIndex == 2) {
- strcpy(stage, "Castle Upper Floor");
- return;
- } else if (areaIndex == 3) {
- strcpy(stage, "Castle Basement");
- return;
- }
- }
- if (courseNum == 0 && levelNum == 26) {
- strcpy(stage, "Castle Courtyard");
- return;
- }
-
- // If we are in in Course 0 we are in the castle which doesn't have a string
- if (courseNum) {
- void** courseNameTbl;
-
-#ifndef VERSION_EU
- courseNameTbl = segmented_to_virtual(seg2_course_name_table);
-#else
- switch (gInGameLanguage) {
- case LANGUAGE_ENGLISH:
- courseNameTbl = segmented_to_virtual(course_name_table_eu_en);
- break;
- case LANGUAGE_FRENCH:
- courseNameTbl = segmented_to_virtual(course_name_table_eu_fr);
- break;
- case LANGUAGE_GERMAN:
- courseNameTbl = segmented_to_virtual(course_name_table_eu_de);
- break;
- }
-#endif
- u8* courseName = segmented_to_virtual(courseNameTbl[courseNum - 1]);
-
- convert_string(&courseName[3], stage);
- } else {
- strcpy(stage, "Peach's Castle");
- }
-}
-
static void playerlist_update_row(u8 i, struct NetworkPlayer* np) {
u8 charIndex = np->modelIndex;
if (charIndex >= CT_MAX) { charIndex = 0; }
djuiImages[i]->texture = gCharacters[charIndex].hudHeadTexture;
- set_details(np->currCourseNum, np->currLevelNum, np->currAreaIndex);
djui_base_set_visible(&djuiRow[i]->base, np->connected);
u8* rgb = get_player_color(np->paletteIndex, 0);
djui_base_set_color(&djuiTextNames[i]->base, rgb[0], rgb[1], rgb[2], 255);
djui_text_set_text(djuiTextNames[i], np->name);
- djui_text_set_text(djuiTextLocations[i], stage);
+ djui_text_set_text(djuiTextLocations[i], get_level_name(np->currCourseNum, np->currLevelNum, np->currAreaIndex));
}
void djui_panel_playerlist_on_render_pre(UNUSED struct DjuiBase* base, UNUSED bool* skipRender) {
diff --git a/src/pc/network/network_player.c b/src/pc/network/network_player.c
index 11d25797a..b57c837c9 100644
--- a/src/pc/network/network_player.c
+++ b/src/pc/network/network_player.c
@@ -6,6 +6,7 @@
#include "pc/debuglog.h"
#include "pc/utils/misc.h"
#include "game/area.h"
+#include "game/level_info.h"
struct NetworkPlayer gNetworkPlayers[MAX_PLAYERS] = { 0 };
struct NetworkPlayer* gNetworkPlayerLocal = NULL;
@@ -95,43 +96,9 @@ struct NetworkPlayer* get_network_player_smallest_global(void) {
return smallest;
}
-static void network_player_update_level_popup(void) {
- static s16 sCachedCourseNum = 0;
- static s16 sCachedActStarNum = 0;
- static s16 sCachedLevelNum = 0;
-
- bool inBonusCourse = (gCurrCourseNum >= 16);
- bool allowPopup = (sCachedCourseNum == gCurrCourseNum)
- && (sCachedActStarNum == gCurrActStarNum)
- && (sCachedLevelNum == gCurrLevelNum)
- && (gCurrActStarNum != 99) // suppress popup for credits sequence
- && (inBonusCourse || gCurrActStarNum != 0); // suppress popup for star selection
-
- sCachedCourseNum = gCurrCourseNum;
- sCachedActStarNum = gCurrActStarNum;
- sCachedLevelNum = gCurrLevelNum;
-
- for (int i = 1; i < MAX_PLAYERS; i++) {
- struct NetworkPlayer* np = &gNetworkPlayers[i];
- if (!np->connected) { continue; }
- bool localLevelMatch = (np->currCourseNum == gCurrCourseNum && np->currActNum == gCurrActStarNum && np->currLevelNum == gCurrLevelNum);
- if (np->localLevelMatch != localLevelMatch) {
- np->localLevelMatch = localLevelMatch;
-
- if (!allowPopup) { continue; }
- u8* rgb = get_player_color(np->paletteIndex, 0);
- char popupMsg[128] = { 0 };
- snprintf(popupMsg, 128, "\\#%02x%02x%02x\\%s\\#dcdcdc\\ %s this level.", rgb[0], rgb[1], rgb[2], np->name, localLevelMatch ? "entered" : "left");
- djui_popup_create(popupMsg, 1);
- }
- }
-}
-
void network_player_update(void) {
if (!network_player_any_connected()) { return; }
- network_player_update_level_popup();
-
#ifndef DEVELOPMENT
if (gNetworkType == NT_SERVER) {
for (int i = 1; i < MAX_PLAYERS; i++) {
@@ -187,10 +154,7 @@ u8 network_player_connected(enum NetworkPlayerType type, u8 globalIndex, u8 mode
np->currLevelAreaSeqId = 0;
extern s16 gCurrCourseNum, gCurrActStarNum, gCurrLevelNum, gCurrAreaIndex;
- np->currCourseNum = gCurrCourseNum;
- np->currActNum = gCurrActStarNum;
- np->currLevelNum = gCurrLevelNum;
- np->currAreaIndex = gCurrAreaIndex;
+ network_player_update_course_level(np, gCurrCourseNum, gCurrActStarNum, gCurrLevelNum, gCurrAreaIndex);
np->currLevelSyncValid = false;
np->currAreaSyncValid = false;
np->modelIndex = modelIndex;
@@ -236,10 +200,7 @@ u8 network_player_connected(enum NetworkPlayerType type, u8 globalIndex, u8 mode
np->connected = true;
np->currLevelAreaSeqId = 0;
if (gNetworkType == NT_SERVER && !np->currAreaSyncValid) {
- np->currCourseNum = 0;
- np->currActNum = 0;
- np->currLevelNum = 16;
- np->currAreaIndex = 1;
+ network_player_update_course_level(np, 0, 0, 16, 1);
np->currLevelSyncValid = false;
np->currAreaSyncValid = false;
}
@@ -264,7 +225,7 @@ u8 network_player_connected(enum NetworkPlayerType type, u8 globalIndex, u8 mode
// display popup
u8* rgb = get_player_color(np->paletteIndex, 0);
char popupMsg[128] = { 0 };
- snprintf(popupMsg, 128, "\\#%02x%02x%02x\\%s\\#dcdcdc\\ connected.", rgb[0], rgb[1], rgb[2], np->name);
+ snprintf(popupMsg, 128, "\\#%02x%02x%02x\\%s\\#dcdcdc\\ connected", rgb[0], rgb[1], rgb[2], np->name);
djui_popup_create(popupMsg, 1);
}
LOG_INFO("player connected, local %d, global %d", i, np->globalIndex);
@@ -311,7 +272,7 @@ u8 network_player_disconnected(u8 globalIndex) {
// display popup
u8* rgb = get_player_color(np->paletteIndex, 0);
char popupMsg[128] = { 0 };
- snprintf(popupMsg, 128, "\\#%02x%02x%02x\\%s\\#dcdcdc\\ disconnected.", rgb[0], rgb[1], rgb[2], np->name);
+ snprintf(popupMsg, 128, "\\#%02x%02x%02x\\%s\\#dcdcdc\\ disconnected", rgb[0], rgb[1], rgb[2], np->name);
djui_popup_create(popupMsg, 1);
packet_ordered_clear(globalIndex);
@@ -321,6 +282,27 @@ u8 network_player_disconnected(u8 globalIndex) {
return UNKNOWN_GLOBAL_INDEX;
}
+void network_player_update_course_level(struct NetworkPlayer* np, s16 courseNum, s16 actNum, s16 levelNum, s16 areaIndex) {
+ // display popup
+ if (np->currCourseNum != courseNum && np->localIndex != 0) {
+ u8* rgb = get_player_color(np->paletteIndex, 0);
+ char popupMsg[128] = { 0 };
+ if (np->currCourseNum == gNetworkPlayerLocal->currCourseNum && gNetworkPlayerLocal->currCourseNum != 0) {
+ snprintf(popupMsg, 128, "\\#%02x%02x%02x\\%s\\#dcdcdc\\ left this level", rgb[0], rgb[1], rgb[2], np->name);
+ } else if (courseNum == gNetworkPlayerLocal->currCourseNum && gNetworkPlayerLocal->currCourseNum != 0) {
+ snprintf(popupMsg, 128, "\\#%02x%02x%02x\\%s\\#dcdcdc\\ entered this level", rgb[0], rgb[1], rgb[2], np->name);
+ } else {
+ snprintf(popupMsg, 128, "\\#%02x%02x%02x\\%s\\#dcdcdc\\ entered\n%s", rgb[0], rgb[1], rgb[2], np->name, get_level_name(courseNum, levelNum, areaIndex));
+ }
+ djui_popup_create(popupMsg, 1);
+ }
+
+ np->currCourseNum = courseNum;
+ np->currActNum = actNum;
+ np->currLevelNum = levelNum;
+ np->currAreaIndex = areaIndex;
+}
+
void network_player_shutdown(void) {
gNetworkPlayerLocal = NULL;
gNetworkPlayerServer = NULL;
@@ -330,6 +312,6 @@ void network_player_shutdown(void) {
gNetworkSystem->clear_id(i);
}
- djui_popup_create("\\#ffa0a0\\Error:\\#dcdcdc\\ network shutdown.", 1);
+ djui_popup_create("\\#ffa0a0\\Error:\\#dcdcdc\\ network shutdown", 1);
LOG_INFO("cleared all network players");
}
diff --git a/src/pc/network/network_player.h b/src/pc/network/network_player.h
index 158bd63cb..ac10964ed 100644
--- a/src/pc/network/network_player.h
+++ b/src/pc/network/network_player.h
@@ -57,6 +57,7 @@ struct NetworkPlayer* get_network_player_smallest_global(void);
void network_player_update(void);
u8 network_player_connected(enum NetworkPlayerType type, u8 globalIndex, u8 modelIndex, u8 paletteIndex, char* name);
u8 network_player_disconnected(u8 globalIndex);
+void network_player_update_course_level(struct NetworkPlayer* np, s16 courseNum, s16 actNum, s16 levelNum, s16 areaIndex);
void network_player_shutdown(void);
#endif
diff --git a/src/pc/network/packets/packet_change_area.c b/src/pc/network/packets/packet_change_area.c
index 93cb5ff79..1f60a6d6b 100644
--- a/src/pc/network/packets/packet_change_area.c
+++ b/src/pc/network/packets/packet_change_area.c
@@ -7,10 +7,7 @@
static void player_changed_area(struct NetworkPlayer* np, s16 courseNum, s16 actNum, s16 levelNum, s16 areaIndex) {
// set NetworkPlayer variables
- np->currCourseNum = courseNum;
- np->currActNum = actNum;
- np->currLevelNum = levelNum;
- np->currAreaIndex = areaIndex;
+ network_player_update_course_level(np, courseNum, actNum, levelNum, areaIndex);
np->currAreaSyncValid = false;
reservation_area_change(np);
@@ -56,10 +53,7 @@ void network_send_change_area(void) {
network_send_to(gNetworkPlayerServer->localIndex, &p);
struct NetworkPlayer* np = gNetworkPlayerLocal;
- np->currCourseNum = gCurrCourseNum;
- np->currActNum = gCurrActStarNum;
- np->currLevelNum = gCurrLevelNum;
- np->currAreaIndex = gCurrAreaIndex;
+ network_player_update_course_level(np, gCurrCourseNum, gCurrActStarNum, gCurrLevelNum, gCurrAreaIndex);
np->currAreaSyncValid = false;
LOG_INFO("tx change area");
diff --git a/src/pc/network/packets/packet_change_level.c b/src/pc/network/packets/packet_change_level.c
index 1673a67aa..f5186296c 100644
--- a/src/pc/network/packets/packet_change_level.c
+++ b/src/pc/network/packets/packet_change_level.c
@@ -7,10 +7,7 @@
static void player_changed_level(struct NetworkPlayer* np, s16 courseNum, s16 actNum, s16 levelNum, s16 areaIndex) {
// set NetworkPlayer variables
- np->currCourseNum = courseNum;
- np->currActNum = actNum;
- np->currLevelNum = levelNum;
- np->currAreaIndex = areaIndex;
+ network_player_update_course_level(np, courseNum, actNum, levelNum, areaIndex);
np->currLevelSyncValid = false;
np->currAreaSyncValid = false;
reservation_area_change(np);
@@ -62,10 +59,7 @@ void network_send_change_level(void) {
network_send_to(gNetworkPlayerServer->localIndex, &p);
struct NetworkPlayer* np = gNetworkPlayerLocal;
- np->currCourseNum = gCurrCourseNum;
- np->currActNum = gCurrActStarNum;
- np->currLevelNum = gCurrLevelNum;
- np->currAreaIndex = gCurrAreaIndex;
+ network_player_update_course_level(np, gCurrCourseNum, gCurrActStarNum, gCurrLevelNum, gCurrAreaIndex);
np->currAreaSyncValid = false;
np->currLevelSyncValid = false;
diff --git a/src/pc/network/packets/packet_level_area_inform.c b/src/pc/network/packets/packet_level_area_inform.c
index a67c0ae52..c3bbb0028 100644
--- a/src/pc/network/packets/packet_level_area_inform.c
+++ b/src/pc/network/packets/packet_level_area_inform.c
@@ -4,6 +4,10 @@
//#define DISABLE_MODULE_LOG 1
#include "pc/debuglog.h"
+#include "pc/djui/djui.h"
+#include "game/level_info.h"
+#include "game/mario_misc.h"
+
static u16 sLevelAreaInformSeq[MAX_PLAYERS][MAX_PLAYERS] = { 0 };
void network_send_level_area_inform(struct NetworkPlayer* np) {
@@ -64,10 +68,7 @@ void network_receive_level_area_inform(struct Packet* p) {
}
sLevelAreaInformSeq[0][globalIndex] = seq;
- np->currCourseNum = courseNum;
- np->currActNum = actNum;
- np->currLevelNum = levelNum;
- np->currAreaIndex = areaIndex;
+ network_player_update_course_level(np, courseNum, actNum, levelNum, areaIndex);
np->currLevelSyncValid = levelSyncValid;
np->currAreaSyncValid = areaSyncValid;
}
diff --git a/src/pc/network/packets/packet_network_players.c b/src/pc/network/packets/packet_network_players.c
index f6d0d7616..3478d9b24 100644
--- a/src/pc/network/packets/packet_network_players.c
+++ b/src/pc/network/packets/packet_network_players.c
@@ -87,10 +87,7 @@ void network_receive_network_players(struct Packet* p) {
struct NetworkPlayer* np = &gNetworkPlayers[localIndex];
if (localIndex != 0) {
np->currLevelAreaSeqId = levelAreaSeqId;
- np->currCourseNum = courseNum;
- np->currActNum = actNum;
- np->currLevelNum = levelNum;
- np->currAreaIndex = areaIndex;
+ network_player_update_course_level(np, courseNum, actNum, levelNum, areaIndex);
np->currLevelSyncValid = levelSyncValid;
np->currAreaSyncValid = areaSyncValid;
LOG_INFO("received network player location (%d, %d, %d, %d)", courseNum, actNum, levelNum, areaIndex);
diff --git a/src/pc/network/packets/packet_player.c b/src/pc/network/packets/packet_player.c
index 2a450ba94..10f56c538 100644
--- a/src/pc/network/packets/packet_player.c
+++ b/src/pc/network/packets/packet_player.c
@@ -341,7 +341,7 @@ void network_receive_player(struct Packet* p) {
// display popup
u8* rgb = get_player_color(np->paletteIndex, 0);
char popupMsg[128] = { 0 };
- snprintf(popupMsg, 128, "\\#%02x%02x%02x\\%s\\#dcdcdc\\ died.", rgb[0], rgb[1], rgb[2], np->name);
+ snprintf(popupMsg, 128, "\\#%02x%02x%02x\\%s\\#dcdcdc\\ died", rgb[0], rgb[1], rgb[2], np->name);
djui_popup_create(popupMsg, 1);
}