From 17348a8fc41189abb3eb5182530fb95a9dc095de Mon Sep 17 00:00:00 2001 From: Agent X <44549182+Agent-11@users.noreply.github.com> Date: Sun, 28 Apr 2024 10:00:13 -0400 Subject: [PATCH] Make level IDs s16s --- src/game/level_update.c | 4 ++-- src/game/level_update.h | 6 +++--- src/pc/network/packets/packet.h | 2 +- src/pc/network/packets/packet_read_write.c | 8 ++++---- 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/game/level_update.c b/src/game/level_update.c index 2195d6c4..3f096e60 100644 --- a/src/game/level_update.c +++ b/src/game/level_update.c @@ -1869,7 +1869,7 @@ s32 lvl_init_or_update(s16 initOrUpdate, UNUSED s32 unused) { return result; } -s32 lvl_init_from_save_file(UNUSED s16 arg0, s32 levelNum) { +s32 lvl_init_from_save_file(UNUSED s16 arg0, s16 levelNum) { #ifdef VERSION_EU s16 var = eu_get_language(); switch (var) { @@ -1907,7 +1907,7 @@ s32 lvl_init_from_save_file(UNUSED s16 arg0, s32 levelNum) { return levelNum; } -s32 lvl_set_current_level(UNUSED s16 arg0, s32 levelNum) { +s32 lvl_set_current_level(UNUSED s16 arg0, s16 levelNum) { s32 warpCheckpointActive = sWarpCheckpointActive; sWarpCheckpointActive = FALSE; diff --git a/src/game/level_update.h b/src/game/level_update.h index d1fdb2bd..2f4d16a9 100644 --- a/src/game/level_update.h +++ b/src/game/level_update.h @@ -101,7 +101,7 @@ extern s16 gDelayedInitSound; struct WarpDest { u8 type; - u8 levelNum; + s16 levelNum; u8 areaIdx; u8 nodeId; u32 arg; @@ -176,8 +176,8 @@ void warp_special(s32 arg); void initiate_warp(s16 destLevel, s16 destArea, s16 destWarpNode, s32 arg3); s32 lvl_init_or_update(s16 initOrUpdate, UNUSED s32 unused); -s32 lvl_init_from_save_file(UNUSED s16 arg0, s32 levelNum); -s32 lvl_set_current_level(UNUSED s16 arg0, s32 levelNum); +s32 lvl_init_from_save_file(UNUSED s16 arg0, s16 levelNum); +s32 lvl_set_current_level(UNUSED s16 arg0, s16 levelNum); s32 lvl_play_the_end_screen_sound(UNUSED s16 arg0, UNUSED s32 arg1); void basic_update(UNUSED s16 *arg); diff --git a/src/pc/network/packets/packet.h b/src/pc/network/packets/packet.h index af7a0a39..bde6844b 100644 --- a/src/pc/network/packets/packet.h +++ b/src/pc/network/packets/packet.h @@ -107,7 +107,7 @@ struct Packet { u16 orderedSeqId; u8 courseNum; u8 actNum; - u8 levelNum; + s16 levelNum; u8 areaIndex; u8 buffer[PACKET_LENGTH]; }; diff --git a/src/pc/network/packets/packet_read_write.c b/src/pc/network/packets/packet_read_write.c index eacd05b0..80e84747 100644 --- a/src/pc/network/packets/packet_read_write.c +++ b/src/pc/network/packets/packet_read_write.c @@ -62,7 +62,7 @@ void packet_init(struct Packet* packet, enum PacketType packetType, bool reliabl if (packet->levelAreaMustMatch) { packet_write(packet, &gCurrCourseNum, sizeof(u8)); packet_write(packet, &gCurrActStarNum, sizeof(u8)); - packet_write(packet, &gCurrLevelNum, sizeof(u8)); + packet_write(packet, &gCurrLevelNum, sizeof(s16)); packet_write(packet, &gCurrAreaIndex, sizeof(u8)); packet->courseNum = gCurrCourseNum; packet->actNum = gCurrActStarNum; @@ -71,7 +71,7 @@ void packet_init(struct Packet* packet, enum PacketType packetType, bool reliabl } else if (packet->levelMustMatch) { packet_write(packet, &gCurrCourseNum, sizeof(u8)); packet_write(packet, &gCurrActStarNum, sizeof(u8)); - packet_write(packet, &gCurrLevelNum, sizeof(u8)); + packet_write(packet, &gCurrLevelNum, sizeof(s16)); packet->courseNum = gCurrCourseNum; packet->actNum = gCurrActStarNum; packet->levelNum = gCurrLevelNum; @@ -170,12 +170,12 @@ u8 packet_initial_read(struct Packet* packet) { if (packet->levelAreaMustMatch) { packet_read(packet, &packet->courseNum, sizeof(u8)); packet_read(packet, &packet->actNum, sizeof(u8)); - packet_read(packet, &packet->levelNum, sizeof(u8)); + packet_read(packet, &packet->levelNum, sizeof(s16)); packet_read(packet, &packet->areaIndex, sizeof(u8)); } else if (packet->levelMustMatch) { packet_read(packet, &packet->courseNum, sizeof(u8)); packet_read(packet, &packet->actNum, sizeof(u8)); - packet_read(packet, &packet->levelNum, sizeof(u8)); + packet_read(packet, &packet->levelNum, sizeof(s16)); } // don't drop packet