diff --git a/Makefile b/Makefile
index ef11a3fb..acc149f1 100644
--- a/Makefile
+++ b/Makefile
@@ -305,7 +305,7 @@ TARGET := sm64.$(VERSION)
# f3d_new - default for EU and Shindou versions
# f3dex -
# f3dex2 -
-# f3dex2e -
+# f3dex2e - default for PC Port
# f3dzex - newer, experimental microcode used in Animal Crossing
$(eval $(call validate-option,GRUCODE,f3d_old f3dex f3dex2 f3dex2e f3d_new f3dzex))
@@ -381,29 +381,14 @@ endif
ifeq ($(NON_MATCHING),1)
DEFINES += NON_MATCHING=1 AVOID_UB=1
- COMPARE := 0
endif
-
-# COMPARE - whether to verify the SHA-1 hash of the ROM after building
-# 1 - verifies the SHA-1 hash of the selected version of the game
-# 0 - does not verify the hash
-COMPARE ?= 1
-$(eval $(call validate-option,COMPARE,0 1))
-
ifeq ($(OSX_BUILD),0)
USE_APP := 0
else ifeq ($(shell uname -m),arm64)
DISCORD_SDK := 0
endif
-TARGET_STRING := sm64.$(VERSION).$(GRUCODE)
-# If non-default settings were chosen, disable COMPARE
-ifeq ($(filter $(TARGET_STRING), sm64.jp.f3d_old sm64.us.f3d_old sm64.eu.f3d_new sm64.sh.f3d_new),)
- COMPARE := 0
-endif
-
-
# Whether to hide commands or not
VERBOSE ?= 0
ifeq ($(VERBOSE),0)
@@ -418,12 +403,6 @@ ifeq ($(filter clean distclean,$(MAKECMDGOALS)),)
$(info ==== Build Options ====)
$(info Version: $(VERSION))
$(info Microcode: $(GRUCODE))
- $(info Target: $(TARGET))
- ifeq ($(COMPARE),1)
- $(info Compare ROM: yes)
- else
- $(info Compare ROM: no)
- endif
ifeq ($(NON_MATCHING),1)
$(info Build Matching: no)
else
@@ -499,12 +478,12 @@ BUILD_DIR_BASE := build
BUILD_DIR := $(BUILD_DIR_BASE)/$(VERSION)_pc
ifeq ($(WINDOWS_BUILD),1)
- EXE := $(BUILD_DIR)/$(TARGET_STRING).exe
+ EXE := $(BUILD_DIR)/sm64coopdx.exe
else # Linux builds/binary namer
ifeq ($(TARGET_RPI),1)
- EXE := $(BUILD_DIR)/$(TARGET_STRING).arm
+ EXE := $(BUILD_DIR)/sm64coopdx.arm
else
- EXE := $(BUILD_DIR)/$(TARGET_STRING)
+ EXE := $(BUILD_DIR)/sm64coopdx
endif
endif
@@ -1157,11 +1136,6 @@ exemap: $(EXE)
all: exemap
endif
-ifeq ($(COMPARE),1)
- @$(PRINT) "$(GREEN)Checking if ROM matches.. $(NO_COL)\n"
- @$(SHA1SUM) --quiet -c $(TARGET).sha1 && $(PRINT) "$(TARGET): $(GREEN)OK$(NO_COL)\n" || ($(PRINT) "$(YELLOW)Building the ROM file has succeeded, but does not match the original ROM.\nThis is expected, and not an error, if you are making modifications.\nTo silence this message, use 'make COMPARE=0.' $(NO_COL)\n" && false)
-endif
-
clean:
$(RM) -r $(BUILD_DIR_BASE)
diff --git a/actors/luigi/geo.inc.c b/actors/luigi/geo.inc.c
index c6a5ad4e..be9b7259 100644
--- a/actors/luigi/geo.inc.c
+++ b/actors/luigi/geo.inc.c
@@ -1,3 +1,4 @@
+#include "geo_header.h"
// Normal Mario Geo
const GeoLayout luigi_geo_face_and_wings[] = {
diff --git a/actors/luigi_cap/geo.inc.c b/actors/luigi_cap/geo.inc.c
index 0283df73..ad6e7dd3 100644
--- a/actors/luigi_cap/geo.inc.c
+++ b/actors/luigi_cap/geo.inc.c
@@ -1,3 +1,4 @@
+#include "geo_header.h"
// 0x16000CA4
const GeoLayout luigis_cap_geo[] = {
GEO_NODE_START(),
diff --git a/actors/mario/geo.inc.c b/actors/mario/geo.inc.c
index 9cefb37c..9a6ea4d6 100644
--- a/actors/mario/geo.inc.c
+++ b/actors/mario/geo.inc.c
@@ -1,3 +1,4 @@
+#include "geo_header.h"
// Normal Mario Geo
// 0x170002E0
diff --git a/actors/mario_cap/geo.inc.c b/actors/mario_cap/geo.inc.c
index 942509ef..37546c41 100644
--- a/actors/mario_cap/geo.inc.c
+++ b/actors/mario_cap/geo.inc.c
@@ -1,3 +1,4 @@
+#include "geo_header.h"
// 0x16000CA4
const GeoLayout marios_cap_geo[] = {
GEO_NODE_START(),
diff --git a/actors/mario_cap/mario_cap_externs.h b/actors/mario_cap/mario_cap_externs.h
index 664ee3ea..538e3af0 100644
--- a/actors/mario_cap/mario_cap_externs.h
+++ b/actors/mario_cap/mario_cap_externs.h
@@ -4,4 +4,3 @@ extern ALIGNED8 const Texture mario_cap_seg3_texture_0301E750[];
extern ALIGNED8 const Texture mario_cap_seg3_texture_0301F750[];
extern ALIGNED8 const Texture mario_cap_seg3_texture_03020750[];
extern ALIGNED8 const Texture mario_cap_seg3_texture_03021750[];
-extern ALIGNED8 const Texture mario_cap_texture_cap_inside[];
diff --git a/actors/mario_cap/model.inc.c b/actors/mario_cap/model.inc.c
index 672d57d1..273beabf 100644
--- a/actors/mario_cap/model.inc.c
+++ b/actors/mario_cap/model.inc.c
@@ -203,7 +203,7 @@ const Gfx mario_cap_seg3_dl_03022D10[] = {
gsDPTileSync(),
gsDPSetTile(G_IM_FMT_RGBA, G_IM_SIZ_16b, 8, 0, G_TX_RENDERTILE, 0, G_TX_CLAMP, 5, G_TX_NOLOD, G_TX_CLAMP, 5, G_TX_NOLOD),
gsDPSetTileSize(0, 0, 0, (8 - 1) << G_TEXTURE_IMAGE_FRAC, (8 - 1) << G_TEXTURE_IMAGE_FRAC),
- gsDPSetTextureImage(G_IM_FMT_RGBA, G_IM_SIZ_16b, 1, mario_cap_texture_cap_inside),
+ gsDPSetTextureImage(G_IM_FMT_RGBA, G_IM_SIZ_16b, 1, mario_texture_cap_inside),
gsDPLoadSync(),
gsDPLoadBlock(G_TX_LOADTILE, 0, 0, 8 * 8 - 1, CALC_DXT(8, G_IM_SIZ_16b_BYTES)),
gsSPCopyLightsPlayerPart(CAP), //gsSPLight(&mario_cap_seg3_lights_0301CF08.a, 2),
diff --git a/autogen/convert_functions.py b/autogen/convert_functions.py
index eab7b3dd..14c94bee 100644
--- a/autogen/convert_functions.py
+++ b/autogen/convert_functions.py
@@ -75,7 +75,7 @@ override_allowed_functions = {
"src/game/object_list_processor.h": [ "set_object_respawn_info_bits" ],
"src/game/mario_misc.h": [ "bhv_toad.*", "bhv_unlock_door.*" ],
"src/pc/utils/misc.h": [ "update_all_mario_stars" ],
- "src/game/level_update.h": [ "level_trigger_warp", "get_painting_warp_node", "initiate_painting_warp", "warp_special" ],
+ "src/game/level_update.h": [ "level_trigger_warp", "get_painting_warp_node", "initiate_painting_warp", "warp_special", "lvl_set_current_level" ],
"src/game/area.h": [ "area_get_warp_node" ],
"src/engine/level_script.h": [ "area_create_warp_node" ],
"src/game/ingame_menu.h": [ "set_min_dialog_width", "set_dialog_override_pos", "reset_dialog_override_pos", "set_dialog_override_color", "reset_dialog_override_color" ]
diff --git a/autogen/lua_definitions/constants.lua b/autogen/lua_definitions/constants.lua
index 36e3742f..8c2200a7 100644
--- a/autogen/lua_definitions/constants.lua
+++ b/autogen/lua_definitions/constants.lua
@@ -4040,6 +4040,30 @@ TIMER_CONTROL_START = 1
--- @type integer
TIMER_CONTROL_STOP = 2
+--- @type integer
+WARP_NODE_CREDITS_END = 0xFA
+
+--- @type integer
+WARP_NODE_CREDITS_MIN = 0xF8
+
+--- @type integer
+WARP_NODE_CREDITS_NEXT = 0xF9
+
+--- @type integer
+WARP_NODE_CREDITS_START = 0xF8
+
+--- @type integer
+WARP_NODE_DEATH = 0xF1
+
+--- @type integer
+WARP_NODE_F0 = 0xF0
+
+--- @type integer
+WARP_NODE_F2 = 0xF2
+
+--- @type integer
+WARP_NODE_WARP_FLOOR = 0xF3
+
--- @type integer
WARP_OP_CREDITS_END = 0x15
@@ -5500,6 +5524,17 @@ PACKET_LENGTH = 3000
--- @type integer
SYNC_DISTANCE_INFINITE = 0
+--- @class BouncyLevelBounds
+
+--- @type BouncyLevelBounds
+BOUNCY_LEVEL_BOUNDS_OFF = 0
+
+--- @type BouncyLevelBounds
+BOUNCY_LEVEL_BOUNDS_ON = 1
+
+--- @type BouncyLevelBounds
+BOUNCY_LEVEL_BOUNDS_ON_CAP = 2
+
--- @class NetworkSystemType
--- @type NetworkSystemType
diff --git a/autogen/lua_definitions/functions.lua b/autogen/lua_definitions/functions.lua
index 20bc244f..104097ff 100644
--- a/autogen/lua_definitions/functions.lua
+++ b/autogen/lua_definitions/functions.lua
@@ -4244,6 +4244,13 @@ function level_trigger_warp(m, warpOp)
-- ...
end
+--- @param arg0 integer
+--- @param levelNum integer
+--- @return integer
+function lvl_set_current_level(arg0, levelNum)
+ -- ...
+end
+
--- @param arg integer
--- @return nil
function warp_special(arg)
diff --git a/docs/lua/constants.md b/docs/lua/constants.md
index c8bbd972..8d37c794 100644
--- a/docs/lua/constants.md
+++ b/docs/lua/constants.md
@@ -41,6 +41,7 @@
- [enum MarioHandGSCId](#enum-MarioHandGSCId)
- [mod_storage.h](#mod_storageh)
- [network.h](#networkh)
+ - [enum BouncyLevelBounds](#enum-BouncyLevelBounds)
- [enum NetworkSystemType](#enum-NetworkSystemType)
- [enum PlayerInteractions](#enum-PlayerInteractions)
- [network_player.h](#network_playerh)
@@ -1427,6 +1428,14 @@
- TIMER_CONTROL_SHOW
- TIMER_CONTROL_START
- TIMER_CONTROL_STOP
+- WARP_NODE_CREDITS_END
+- WARP_NODE_CREDITS_MIN
+- WARP_NODE_CREDITS_NEXT
+- WARP_NODE_CREDITS_START
+- WARP_NODE_DEATH
+- WARP_NODE_F0
+- WARP_NODE_F2
+- WARP_NODE_WARP_FLOOR
- WARP_OP_CREDITS_END
- WARP_OP_CREDITS_NEXT
- WARP_OP_CREDITS_START
@@ -1962,6 +1971,13 @@
- PACKET_LENGTH
- SYNC_DISTANCE_INFINITE
+### [enum BouncyLevelBounds](#BouncyLevelBounds)
+| Identifier | Value |
+| :--------- | :---- |
+| BOUNCY_LEVEL_BOUNDS_OFF | 0 |
+| BOUNCY_LEVEL_BOUNDS_ON | 1 |
+| BOUNCY_LEVEL_BOUNDS_ON_CAP | 2 |
+
### [enum NetworkSystemType](#NetworkSystemType)
| Identifier | Value |
| :--------- | :---- |
diff --git a/docs/lua/functions-3.md b/docs/lua/functions-3.md
index 7a966539..5cccefc3 100644
--- a/docs/lua/functions-3.md
+++ b/docs/lua/functions-3.md
@@ -4030,6 +4030,27 @@
+## [lvl_set_current_level](#lvl_set_current_level)
+
+### Lua Example
+`local integerValue = lvl_set_current_level(arg0, levelNum)`
+
+### Parameters
+| Field | Type |
+| ----- | ---- |
+| arg0 | `integer` |
+| levelNum | `integer` |
+
+### Returns
+- `integer`
+
+### C Prototype
+`s32 lvl_set_current_level(UNUSED s16 arg0, s32 levelNum);`
+
+[:arrow_up_small:](#)
+
+
+
## [warp_special](#warp_special)
### Lua Example
diff --git a/docs/lua/functions.md b/docs/lua/functions.md
index b94ebf35..d88ac6f6 100644
--- a/docs/lua/functions.md
+++ b/docs/lua/functions.md
@@ -859,6 +859,7 @@
- [get_painting_warp_node](functions-3.md#get_painting_warp_node)
- [initiate_painting_warp](functions-3.md#initiate_painting_warp)
- [level_trigger_warp](functions-3.md#level_trigger_warp)
+ - [lvl_set_current_level](functions-3.md#lvl_set_current_level)
- [warp_special](functions-3.md#warp_special)
diff --git a/src/game/camera.c b/src/game/camera.c
index b6232b83..0bd9936f 100644
--- a/src/game/camera.c
+++ b/src/game/camera.c
@@ -3193,7 +3193,7 @@ void update_camera(struct Camera *c) {
gCamera = c;
update_camera_hud_status(c);
- if ((gOverrideFreezeCamera || first_person_update()) && !gDjuiInMainMenu) {
+ if ((gOverrideFreezeCamera || get_first_person_enabled()) && !gDjuiInMainMenu) {
return;
}
@@ -7199,15 +7199,13 @@ void find_mario_floor_and_ceil(struct PlayerGeometry *pg) {
s16 tempCheckingSurfaceCollisionsForCamera = gCheckingSurfaceCollisionsForCamera;
gCheckingSurfaceCollisionsForCamera = TRUE;
- if (find_floor(sMarioCamState->pos[0], sMarioCamState->pos[1] + 10.f,
- sMarioCamState->pos[2], &surf) != gLevelValues.floorLowerLimit) {
+ if (find_floor(sMarioCamState->pos[0], sMarioCamState->pos[1] + 10.f, sMarioCamState->pos[2], &surf) != gLevelValues.floorLowerLimit && surf != NULL) {
pg->currFloorType = surf->type;
} else {
pg->currFloorType = 0;
}
- if (find_ceil(sMarioCamState->pos[0], sMarioCamState->pos[1] - 10.f,
- sMarioCamState->pos[2], &surf) != gLevelValues.cellHeightLimit) {
+ if (find_ceil(sMarioCamState->pos[0], sMarioCamState->pos[1] - 10.f, sMarioCamState->pos[2], &surf) != gLevelValues.cellHeightLimit && surf != NULL) {
pg->currCeilType = surf->type;
} else {
pg->currCeilType = 0;
diff --git a/src/game/first_person_cam.c b/src/game/first_person_cam.c
index 6d45f800..4119114f 100644
--- a/src/game/first_person_cam.c
+++ b/src/game/first_person_cam.c
@@ -35,6 +35,9 @@ bool first_person_check_cancels(void) {
if (m->action == ACT_FIRST_PERSON || m->action == ACT_IN_CANNON || m->action == ACT_READING_NPC_DIALOG || m->action == ACT_DISAPPEARED) {
return true;
}
+
+ if (gLuaLoadingMod != NULL) { return false; }
+
struct Object *bowser = find_object_with_behavior(bhvBowser);
if (bowser != NULL && (bowser->oAction == 5 || bowser->oAction == 6)) {
return true;
@@ -138,13 +141,13 @@ void first_person_camera_update(void) {
gFOVState.fov = gFirstPersonCamera.fov;
}
-bool first_person_update(void) {
+void first_person_update(void) {
if (gFirstPersonCamera.enabled && !gDjuiInMainMenu) {
- struct MarioState *m = &gMarioStates[0];
-
// check cancels
bool cancel = first_person_check_cancels();
- if (cancel) { return false; }
+ if (cancel) { return; }
+
+ struct MarioState *m = &gMarioStates[0];
if (m->action == ACT_SHOT_FROM_CANNON && m->area->camera->mode == CAMERA_MODE_INSIDE_CANNON) {
gFirstPersonCamera.yaw = m->faceAngle[1] + 0x8000;
@@ -166,13 +169,9 @@ bool first_person_update(void) {
}
first_person_camera_update();
-
- return true;
} else if (!camera_config_is_mouse_look_enabled()) {
gDjuiHudLockMouse = false;
}
-
- return false;
}
void first_person_reset(void) {
diff --git a/src/game/first_person_cam.h b/src/game/first_person_cam.h
index 2f654b18..e91f3e03 100644
--- a/src/game/first_person_cam.h
+++ b/src/game/first_person_cam.h
@@ -19,7 +19,7 @@ extern struct FirstPersonCamera gFirstPersonCamera;
bool get_first_person_enabled(void);
void set_first_person_enabled(bool enable);
-bool first_person_update(void);
+void first_person_update(void);
void first_person_reset(void);
#endif
\ No newline at end of file
diff --git a/src/game/level_update.c b/src/game/level_update.c
index 38f3b6a1..8b843363 100644
--- a/src/game/level_update.c
+++ b/src/game/level_update.c
@@ -48,17 +48,6 @@
#include "engine/level_script.h"
-#include "mario_actions_cutscene.h"
-
-#define WARP_NODE_F0 0xF0
-#define WARP_NODE_DEATH 0xF1
-#define WARP_NODE_F2 0xF2
-#define WARP_NODE_WARP_FLOOR 0xF3
-#define WARP_NODE_CREDITS_START 0xF8
-#define WARP_NODE_CREDITS_NEXT 0xF9
-#define WARP_NODE_CREDITS_END 0xFA
-#define WARP_NODE_CREDITS_MIN 0xF8
-
#define MENU_LEVEL_MIN 0
#define MENU_LEVEL_MAX 17
diff --git a/src/game/level_update.h b/src/game/level_update.h
index f9c2b0eb..514af0e1 100644
--- a/src/game/level_update.h
+++ b/src/game/level_update.h
@@ -58,6 +58,15 @@
#define MARIO_SPAWN_LAUNCH_DEATH 0x25
#define MARIO_SPAWN_UNKNOWN_27 0x27
+#define WARP_NODE_F0 0xF0
+#define WARP_NODE_DEATH 0xF1
+#define WARP_NODE_F2 0xF2
+#define WARP_NODE_WARP_FLOOR 0xF3
+#define WARP_NODE_CREDITS_START 0xF8
+#define WARP_NODE_CREDITS_NEXT 0xF9
+#define WARP_NODE_CREDITS_END 0xFA
+#define WARP_NODE_CREDITS_MIN 0xF8
+
#define WARP_TYPE_NOT_WARPING 0
#define WARP_TYPE_CHANGE_LEVEL 1
#define WARP_TYPE_CHANGE_AREA 2
@@ -162,6 +171,7 @@ void initiate_painting_warp(s16 paintingIndex);
s16 level_trigger_warp(struct MarioState *m, s32 warpOp);
void level_set_transition(s16 length, void (*updateFunction)(s16 *));
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);
diff --git a/src/game/object_list_processor.c b/src/game/object_list_processor.c
index a9c5e732..283a9602 100644
--- a/src/game/object_list_processor.c
+++ b/src/game/object_list_processor.c
@@ -20,6 +20,7 @@
#include "platform_displacement.h"
#include "profiler.h"
#include "spawn_object.h"
+#include "first_person_cam.h"
#include "engine/math_util.h"
#include "pc/network/network.h"
#include "pc/lua/smlua.h"
@@ -293,6 +294,8 @@ void bhv_mario_update(void) {
particleFlags |= gMarioState->particleFlags;
gCurrentObject->oMarioParticleFlags = particleFlags;
+ if (stateIndex == 0) { first_person_update(); }
+
// This code is meant to preserve old Lua mods' ability to set overridePaletteIndex and paletteIndex and still work
// as they expected. USE_REAL_PALETTE_VAR is meant to help support cases where mods will do:
// np.overridePaletteIndex = np.paletteIndex
diff --git a/src/pc/configfile.c b/src/pc/configfile.c
index ea09b9d3..45593798 100644
--- a/src/pc/configfile.c
+++ b/src/pc/configfile.c
@@ -602,12 +602,16 @@ NEXT_OPTION:
void configfile_load(void) {
bool configReadError = false;
+#ifdef DEVELOPMENT
+ configfile_load_internal(configfile_name(), &configReadError);
+#else
configfile_load_internal(configfile_name(), &configReadError);
if (configReadError) {
configfile_load_internal(configfile_backup_name(), &configReadError);
} else {
configfile_save(configfile_backup_name());
}
+#endif
}
// Writes the config file to 'filename'
diff --git a/src/pc/djui/djui_panel_misc.c b/src/pc/djui/djui_panel_misc.c
index 84b86ee0..aa027a52 100644
--- a/src/pc/djui/djui_panel_misc.c
+++ b/src/pc/djui/djui_panel_misc.c
@@ -83,7 +83,9 @@ void djui_panel_misc_create(struct DjuiBase* caller) {
djui_checkbox_create(body, DLANG(MISC, COOP_COMPATIBILITY), &configCoopCompatibility, djui_panel_compatibility_checkbox_on_value_change);
djui_button_create(body, DLANG(MISC, LANGUAGE), DJUI_BUTTON_STYLE_NORMAL, djui_panel_language_create);
- djui_button_create(body, DLANG(MISC, MENU_OPTIONS), DJUI_BUTTON_STYLE_NORMAL, djui_panel_main_menu_create);
+ if (gDjuiInMainMenu) {
+ djui_button_create(body, DLANG(MISC, MENU_OPTIONS), DJUI_BUTTON_STYLE_NORMAL, djui_panel_main_menu_create);
+ }
djui_button_create(body, DLANG(MISC, INFORMATION), DJUI_BUTTON_STYLE_NORMAL, djui_panel_info_create);
#ifdef DEVELOPMENT
djui_button_create(body, DLANG(MISC, DEBUG), DJUI_BUTTON_STYLE_NORMAL, djui_panel_options_debug_create);
diff --git a/src/pc/djui/djui_panel_options.c b/src/pc/djui/djui_panel_options.c
index 887a31a0..7e16fdd5 100644
--- a/src/pc/djui/djui_panel_options.c
+++ b/src/pc/djui/djui_panel_options.c
@@ -21,10 +21,12 @@ void djui_panel_options_create(struct DjuiBase* caller) {
struct DjuiThreePanel* panel = djui_panel_menu_create(DLANG(OPTIONS, OPTIONS));
struct DjuiBase* body = djui_three_panel_get_body(panel);
{
- struct DjuiRect* rect1 = djui_rect_container_create(body, 64);
- {
- djui_button_left_create(&rect1->base, DLANG(PAUSE, PLAYER), DJUI_BUTTON_STYLE_NORMAL, djui_panel_player_create);
- djui_button_right_create(&rect1->base, DLANG(PAUSE, DYNOS_PACKS), DJUI_BUTTON_STYLE_NORMAL, djui_panel_dynos_create);
+ if (gDjuiInMainMenu) {
+ struct DjuiRect* rect1 = djui_rect_container_create(body, 64);
+ {
+ djui_button_left_create(&rect1->base, DLANG(PAUSE, PLAYER), DJUI_BUTTON_STYLE_NORMAL, djui_panel_player_create);
+ djui_button_right_create(&rect1->base, DLANG(PAUSE, DYNOS_PACKS), DJUI_BUTTON_STYLE_NORMAL, djui_panel_dynos_create);
+ }
}
djui_button_create(body, DLANG(OPTIONS, CAMERA), DJUI_BUTTON_STYLE_NORMAL, djui_panel_camera_create);
djui_button_create(body, DLANG(OPTIONS, CONTROLS), DJUI_BUTTON_STYLE_NORMAL, djui_panel_controls_create);
diff --git a/src/pc/lua/smlua_constants_autogen.c b/src/pc/lua/smlua_constants_autogen.c
index fb82b08a..5e81d959 100644
--- a/src/pc/lua/smlua_constants_autogen.c
+++ b/src/pc/lua/smlua_constants_autogen.c
@@ -1569,6 +1569,14 @@ char gSmluaConstants[] = ""
"MARIO_SPAWN_LAUNCH_STAR_COLLECT = 0x24\n"
"MARIO_SPAWN_LAUNCH_DEATH = 0x25\n"
"MARIO_SPAWN_UNKNOWN_27 = 0x27\n"
+"WARP_NODE_F0 = 0xF0\n"
+"WARP_NODE_DEATH = 0xF1\n"
+"WARP_NODE_F2 = 0xF2\n"
+"WARP_NODE_WARP_FLOOR = 0xF3\n"
+"WARP_NODE_CREDITS_START = 0xF8\n"
+"WARP_NODE_CREDITS_NEXT = 0xF9\n"
+"WARP_NODE_CREDITS_END = 0xFA\n"
+"WARP_NODE_CREDITS_MIN = 0xF8\n"
"WARP_TYPE_NOT_WARPING = 0\n"
"WARP_TYPE_CHANGE_LEVEL = 1\n"
"WARP_TYPE_CHANGE_AREA = 2\n"
@@ -2040,6 +2048,9 @@ char gSmluaConstants[] = ""
"PLAYER_INTERACTIONS_NONE = 0\n"
"PLAYER_INTERACTIONS_SOLID = 1\n"
"PLAYER_INTERACTIONS_PVP = 2\n"
+"BOUNCY_LEVEL_BOUNDS_OFF = 0\n"
+"BOUNCY_LEVEL_BOUNDS_ON = 1\n"
+"BOUNCY_LEVEL_BOUNDS_ON_CAP = 2\n"
"UNKNOWN_LOCAL_INDEX = (-1)\n"
"UNKNOWN_GLOBAL_INDEX = (-1)\n"
"UNKNOWN_NETWORK_INDEX = (-1)\n"
diff --git a/src/pc/lua/smlua_functions_autogen.c b/src/pc/lua/smlua_functions_autogen.c
index 5ac0cd4c..8edc2f60 100644
--- a/src/pc/lua/smlua_functions_autogen.c
+++ b/src/pc/lua/smlua_functions_autogen.c
@@ -13867,6 +13867,25 @@ int smlua_func_level_trigger_warp(lua_State* L) {
return 1;
}
+int smlua_func_lvl_set_current_level(lua_State* L) {
+ if (L == NULL) { return 0; }
+
+ int top = lua_gettop(L);
+ if (top != 2) {
+ LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "lvl_set_current_level", 2, top);
+ return 0;
+ }
+
+ s16 arg0 = smlua_to_integer(L, 1);
+ if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "lvl_set_current_level"); return 0; }
+ s32 levelNum = smlua_to_integer(L, 2);
+ if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "lvl_set_current_level"); return 0; }
+
+ lua_pushinteger(L, lvl_set_current_level(arg0, levelNum));
+
+ return 1;
+}
+
int smlua_func_warp_special(lua_State* L) {
if (L == NULL) { return 0; }
@@ -32084,6 +32103,7 @@ void smlua_bind_functions_autogen(void) {
smlua_bind_function(L, "get_painting_warp_node", smlua_func_get_painting_warp_node);
smlua_bind_function(L, "initiate_painting_warp", smlua_func_initiate_painting_warp);
smlua_bind_function(L, "level_trigger_warp", smlua_func_level_trigger_warp);
+ smlua_bind_function(L, "lvl_set_current_level", smlua_func_lvl_set_current_level);
smlua_bind_function(L, "warp_special", smlua_func_warp_special);
// mario.h
diff --git a/src/pc/lua/utils/smlua_obj_utils.c b/src/pc/lua/utils/smlua_obj_utils.c
index 1bda952d..c0ed5c4e 100644
--- a/src/pc/lua/utils/smlua_obj_utils.c
+++ b/src/pc/lua/utils/smlua_obj_utils.c
@@ -11,6 +11,9 @@
#include "pc/debuglog.h"
static struct Object* spawn_object_internal(enum BehaviorId behaviorId, enum ModelExtendedId modelId, f32 x, f32 y, f32 z, LuaFunction objSetupFunction, bool doSync) {
+ // prevent spawning objects on mod init, this can cause issues if --server is specificed
+ if (gLuaLoadingMod != NULL) { return NULL; }
+
if (doSync) {
// prevent spawning objects before area is synchronized
if (gNetworkPlayerLocal == NULL || !gNetworkPlayerLocal->currAreaSyncValid) { return NULL; }
diff --git a/src/pc/pc_main.c b/src/pc/pc_main.c
index 93bf6798..bf8c73fe 100644
--- a/src/pc/pc_main.c
+++ b/src/pc/pc_main.c
@@ -370,10 +370,9 @@ int main(int argc, char *argv[]) {
djui_panel_modlist_create(NULL);
} else {
network_init(NT_NONE, false);
+ WAPI.delay(200);
}
- WAPI.delay(200);
-
// Main loop
while (true) {
debug_context_reset();