mirror of
https://github.com/coop-deluxe/sm64coopdx.git
synced 2026-04-22 01:52:43 +00:00
Bug fixes for mostly the title screen (#308)
- Add NULL checks to DynOS warps - Change checks for skipping interpolation on the original title screen for much better ones - Interactions are no longer processed if you are on the title screen - Re-add some of the legacy demo code for the original title screen - Fix disconnecting on the original title screen - Fix disconnecting on the act select screen - Fix interpolation crash
This commit is contained in:
parent
22952dda05
commit
4fd13c6bda
9 changed files with 54 additions and 22 deletions
|
|
@ -312,8 +312,10 @@ static void *DynOS_Warp_UpdateWarp(void *aCmd, bool aIsLevelInitDone) {
|
|||
#endif
|
||||
|
||||
// Init transition
|
||||
reset_camera(gCurrentArea->camera);
|
||||
init_camera(gCurrentArea->camera);
|
||||
if (gCurrentArea != NULL) {
|
||||
reset_camera(gCurrentArea->camera);
|
||||
init_camera(gCurrentArea->camera);
|
||||
}
|
||||
sDelayedWarpOp = WARP_OP_NONE;
|
||||
switch (sDynosWarpSpawnType) {
|
||||
case MARIO_SPAWN_UNKNOWN_03: play_transition(WARP_TRANSITION_FADE_FROM_STAR, 0x10, 0x00, 0x00, 0x00); break;
|
||||
|
|
@ -327,7 +329,9 @@ static void *DynOS_Warp_UpdateWarp(void *aCmd, bool aIsLevelInitDone) {
|
|||
|
||||
// Set music
|
||||
if (sWarpDest.type != WARP_TYPE_SAME_AREA && sWarpDest.type != WARP_TYPE_NOT_WARPING) {
|
||||
set_background_music(gCurrentArea->musicParam, gCurrentArea->musicParam2, 0);
|
||||
if (gCurrentArea != NULL) {
|
||||
set_background_music(gCurrentArea->musicParam, gCurrentArea->musicParam2, 0);
|
||||
}
|
||||
if (gMarioState->flags & MARIO_METAL_CAP) play_cap_music(SEQUENCE_ARGS(4, SEQ_EVENT_METAL_CAP));
|
||||
if (gMarioState->flags & MARIO_VANISH_CAP) play_cap_music(SEQUENCE_ARGS(4, SEQ_EVENT_POWERUP));
|
||||
if (gMarioState->flags & MARIO_WING_CAP) play_cap_music(SEQUENCE_ARGS(4, SEQ_EVENT_POWERUP));
|
||||
|
|
|
|||
|
|
@ -29,6 +29,7 @@
|
|||
#include "src/pc/lua/smlua.h"
|
||||
#include "src/pc/djui/djui.h"
|
||||
#include "game/hardcoded.h"
|
||||
#include "menu/intro_geo.h"
|
||||
|
||||
#define CMD_GET(type, offset) (*(type *) (CMD_PROCESS_OFFSET(offset) + (u8 *) sCurrentCmd))
|
||||
|
||||
|
|
@ -332,6 +333,8 @@ static void level_cmd_load_mio0(void) {
|
|||
}
|
||||
|
||||
static void level_cmd_load_mario_head(void) {
|
||||
gSkipInterpolationTitleScreen = true;
|
||||
gGlobalTimer = 0;
|
||||
// TODO: Fix these hardcoded sizes
|
||||
void *addr = main_pool_alloc(DOUBLE_SIZE_ON_64_BIT(0xE1000), MEMORY_POOL_LEFT);
|
||||
if (addr != NULL) {
|
||||
|
|
@ -357,6 +360,7 @@ static void level_cmd_init_level(void) {
|
|||
clear_areas();
|
||||
main_pool_push_state();
|
||||
smlua_model_util_clear();
|
||||
gSkipInterpolationTitleScreen = false;
|
||||
|
||||
sCurrentCmd = CMD_NEXT;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2183,6 +2183,8 @@ void check_kick_or_punch_wall(struct MarioState *m) {
|
|||
}
|
||||
|
||||
void mario_process_interactions(struct MarioState *m) {
|
||||
if (gDjuiInMainMenu) { return; }
|
||||
|
||||
sDelayInvincTimer = FALSE;
|
||||
sInvulnerable = (m->action & ACT_FLAG_INVULNERABLE) || m->invincTimer != 0;
|
||||
|
||||
|
|
|
|||
|
|
@ -34,6 +34,7 @@
|
|||
#include "../../include/libc/stdlib.h"
|
||||
#include "rumble_init.h"
|
||||
#include "game/interaction.h"
|
||||
#include "menu/intro_geo.h"
|
||||
|
||||
#include "pc/pc_main.h"
|
||||
#include "pc/cliopts.h"
|
||||
|
|
@ -826,7 +827,13 @@ s16 level_trigger_warp(struct MarioState *m, s32 warpOp) {
|
|||
case WARP_OP_DEMO_NEXT:
|
||||
case WARP_OP_DEMO_END: sDelayedWarpTimer = 20; // Must be one line to match on -O2
|
||||
val04 = FALSE;
|
||||
stop_demo(NULL);
|
||||
if (!gDjuiInMainMenu) {
|
||||
sSourceWarpNodeId = WARP_NODE_F0;
|
||||
gSavedCourseNum = COURSE_NONE;
|
||||
play_transition(WARP_TRANSITION_FADE_INTO_STAR, 0x14, 0x00, 0x00, 0x00);
|
||||
} else {
|
||||
stop_demo(NULL);
|
||||
}
|
||||
break;
|
||||
|
||||
case WARP_OP_CREDITS_END:
|
||||
|
|
@ -974,6 +981,9 @@ void initiate_delayed_warp(void) {
|
|||
break;
|
||||
|
||||
case WARP_OP_DEMO_NEXT:
|
||||
if (!gDjuiInMainMenu) {
|
||||
warp_special(-2);
|
||||
}
|
||||
break;
|
||||
|
||||
case WARP_OP_CREDITS_START:
|
||||
|
|
@ -1180,16 +1190,30 @@ void stop_demo(UNUSED struct DjuiBase* caller) {
|
|||
int gPressedStart = 0;
|
||||
|
||||
s32 play_mode_normal(void) {
|
||||
if (gDjuiInMainMenu && gCurrDemoInput == NULL && configMenuDemos && !inPlayerMenu) {
|
||||
find_demo_number();
|
||||
if ((++gDemoCountdown) == PRESS_START_DEMO_TIMER && (demoNumber <= 6 || demoNumber > -1)) {
|
||||
start_demo();
|
||||
if (!gDjuiInMainMenu) {
|
||||
if (gCurrDemoInput != NULL) {
|
||||
print_intro_text();
|
||||
if (gPlayer1Controller->buttonPressed & END_DEMO) {
|
||||
level_trigger_warp(gMarioState,
|
||||
gCurrLevelNum == LEVEL_PSS ? WARP_OP_DEMO_END : WARP_OP_DEMO_NEXT);
|
||||
} else if (!gWarpTransition.isActive && sDelayedWarpOp == WARP_OP_NONE
|
||||
&& (gPlayer1Controller->buttonPressed & START_BUTTON)) {
|
||||
gPressedStart = 1;
|
||||
level_trigger_warp(gMarioState, WARP_OP_DEMO_NEXT);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (gDjuiInMainMenu && gCurrDemoInput == NULL && configMenuDemos && !inPlayerMenu) {
|
||||
find_demo_number();
|
||||
if ((++gDemoCountdown) == PRESS_START_DEMO_TIMER && (demoNumber <= 6 || demoNumber > -1)) {
|
||||
start_demo();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (((gCurrDemoInput != NULL) && (gPlayer1Controller->buttonPressed & END_DEMO || !isDemoActive || !gDjuiInMainMenu || gNetworkType != NT_NONE || inPlayerMenu)) || (gCurrDemoInput == NULL && isDemoActive)) {
|
||||
gPlayer1Controller->buttonPressed &= ~END_DEMO;
|
||||
stop_demo(NULL);
|
||||
if (((gCurrDemoInput != NULL) && (gPlayer1Controller->buttonPressed & END_DEMO || !isDemoActive || !gDjuiInMainMenu || gNetworkType != NT_NONE || inPlayerMenu)) || (gCurrDemoInput == NULL && isDemoActive)) {
|
||||
gPlayer1Controller->buttonPressed &= ~END_DEMO;
|
||||
stop_demo(NULL);
|
||||
}
|
||||
}
|
||||
|
||||
warp_area();
|
||||
|
|
|
|||
|
|
@ -63,7 +63,7 @@ static Gfx *sIntroScalePos;
|
|||
static Vec3f sIntroScale;
|
||||
static Vec3f sIntroScalePrev;
|
||||
|
||||
bool skipInterpolationTitleScreen = false;
|
||||
bool gSkipInterpolationTitleScreen = false;
|
||||
|
||||
void patch_title_screen_before(void) {
|
||||
sIntroScalePos = NULL;
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@
|
|||
#include "types.h"
|
||||
#include "engine/graph_node.h"
|
||||
|
||||
extern bool skipInterpolationTitleScreen;
|
||||
extern bool gSkipInterpolationTitleScreen;
|
||||
|
||||
Gfx *geo_intro_super_mario_64_logo(s32 sp50, struct GraphNode *sp54, UNUSED void *context);
|
||||
Gfx *geo_intro_tm_copyright(s32 sp40, struct GraphNode *sp44, UNUSED void *context);
|
||||
|
|
|
|||
|
|
@ -248,13 +248,6 @@ s32 lvl_intro_update(s16 arg1, UNUSED s32 arg2) {
|
|||
case 3:
|
||||
retVar = level_select_input_loop();
|
||||
break;
|
||||
case 4:
|
||||
gGlobalTimer = 0;
|
||||
skipInterpolationTitleScreen = true;
|
||||
break;
|
||||
case 5:
|
||||
skipInterpolationTitleScreen = false;
|
||||
break;
|
||||
}
|
||||
return retVar;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -20,6 +20,8 @@
|
|||
#include "pc/crash_handler.h"
|
||||
#include "pc/debuglog.h"
|
||||
#include "game/camera.h"
|
||||
#include "game/object_helpers.h"
|
||||
#include "menu/intro_geo.h"
|
||||
|
||||
// fix warnings when including rendering_graph_node
|
||||
#undef near
|
||||
|
|
@ -512,6 +514,9 @@ void network_shutdown(bool sendLeaving, bool exiting, bool popup) {
|
|||
smlua_shutdown();
|
||||
extern s16 gChangeLevel;
|
||||
gChangeLevel = LEVEL_CASTLE_GROUNDS;
|
||||
if (gSkipInterpolationTitleScreen || find_object_with_behavior(bhvActSelector) != NULL) {
|
||||
dynos_warp_to_level(LEVEL_CASTLE_GROUNDS, 1, 0);
|
||||
}
|
||||
network_player_init();
|
||||
camera_set_use_course_specific_settings(true);
|
||||
free_vtx_scroll_targets();
|
||||
|
|
|
|||
|
|
@ -174,7 +174,7 @@ void produce_interpolation_frames_and_delay(void) {
|
|||
gfx_start_frame();
|
||||
f32 delta = MIN((curTime - sFrameTimeStart) / (sFrameTargetTime - sFrameTimeStart), 1);
|
||||
gRenderingDelta = delta;
|
||||
if (!skipInterpolationTitleScreen || configFrameLimit > 30) { patch_interpolations(delta); }
|
||||
if (!gSkipInterpolationTitleScreen && configFrameLimit > 30) { patch_interpolations(delta); }
|
||||
send_display_list(gGfxSPTask);
|
||||
gfx_end_frame();
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue