Fixed loading of certain save flags, e.g. lakitu

This commit is contained in:
MysterD 2021-08-10 22:25:34 -07:00
parent d9ab09ee64
commit 22121eea6b
4 changed files with 23 additions and 0 deletions

View file

@ -1443,3 +1443,19 @@ s32 lvl_exiting_credits(UNUSED s16 arg0, UNUSED s32 arg1) {
gCurrActNum = 0; gCurrActNum = 0;
return 1; return 1;
} }
void fake_lvl_init_from_save_file(void) {
sWarpDest.type = WARP_TYPE_NOT_WARPING;
sDelayedWarpOp = WARP_OP_NONE;
gShouldNotPlayCastleMusic = !save_file_exists(gCurrSaveFileNum - 1) && gServerSettings.skipIntro;
if (gNetworkType == NT_NONE) { gShouldNotPlayCastleMusic = true; }
gCurrCreditsEntry = NULL;
gSpecialTripleJump = 0;
init_mario_from_save_file();
disable_warp_checkpoint();
save_file_move_cap_to_default_location();
select_mario_cam_mode();
set_yoshi_as_not_dead();
}

View file

@ -155,4 +155,6 @@ void star_select_finish_selection(void);
s32 lvl_exiting_credits(UNUSED s16 arg0, UNUSED s32 arg1); s32 lvl_exiting_credits(UNUSED s16 arg0, UNUSED s32 arg1);
void fake_lvl_init_from_save_file(void);
#endif // LEVEL_UPDATE_H #endif // LEVEL_UPDATE_H

View file

@ -5,6 +5,7 @@
#include "src/pc/utils/misc.h" #include "src/pc/utils/misc.h"
#include "src/pc/configfile.h" #include "src/pc/configfile.h"
#include "pc/utils/misc.h" #include "pc/utils/misc.h"
#include "src/game/level_update.h"
#ifdef DISCORD_SDK #ifdef DISCORD_SDK
static char* sWarningDiscord = "\ static char* sWarningDiscord = "\
@ -38,6 +39,7 @@ void djui_panel_host_message_do_host(struct DjuiBase* caller) {
} }
#endif #endif
network_init(NT_SERVER); network_init(NT_SERVER);
fake_lvl_init_from_save_file();
extern s16 gChangeLevel; extern s16 gChangeLevel;
gChangeLevel = 16; gChangeLevel = 16;
} }

View file

@ -7,6 +7,7 @@
#include "src/game/interaction.h" #include "src/game/interaction.h"
#include "src/engine/math_util.h" #include "src/engine/math_util.h"
#include "src/game/save_file.h" #include "src/game/save_file.h"
#include "src/game/level_update.h"
#include "src/pc/fs/fs.h" #include "src/pc/fs/fs.h"
#include "PR/os_eeprom.h" #include "PR/os_eeprom.h"
#include "pc/network/version.h" #include "pc/network/version.h"
@ -208,6 +209,8 @@ void network_receive_join(struct Packet* p) {
djui_panel_shutdown(); djui_panel_shutdown();
update_all_mario_stars(); update_all_mario_stars();
fake_lvl_init_from_save_file();
extern s16 gChangeLevel; extern s16 gChangeLevel;
gChangeLevel = 16; gChangeLevel = 16;
} }