mirror of
https://github.com/coop-deluxe/sm64coopdx.git
synced 2025-10-30 08:01:01 +00:00
Dialog to toad/signs/doors no longer soft-locks or stops time
This commit is contained in:
parent
ec2199892f
commit
6d0d7ffbaa
6 changed files with 53 additions and 34 deletions
|
|
@ -30,7 +30,7 @@ void play_door_open_noise(void) {
|
||||||
s32 sp1C = cur_obj_has_model(MODEL_HMC_METAL_DOOR);
|
s32 sp1C = cur_obj_has_model(MODEL_HMC_METAL_DOOR);
|
||||||
if (o->oTimer == 0) {
|
if (o->oTimer == 0) {
|
||||||
cur_obj_play_sound_2(D_8032F328[sp1C]);
|
cur_obj_play_sound_2(D_8032F328[sp1C]);
|
||||||
gTimeStopState |= TIME_STOP_MARIO_OPENED_DOOR;
|
//gTimeStopState |= TIME_STOP_MARIO_OPENED_DOOR;
|
||||||
}
|
}
|
||||||
if (o->oTimer == 70) {
|
if (o->oTimer == 70) {
|
||||||
cur_obj_play_sound_2(D_8032F330[sp1C]);
|
cur_obj_play_sound_2(D_8032F330[sp1C]);
|
||||||
|
|
|
||||||
|
|
@ -186,10 +186,10 @@ void hoot_action_loop(void) {
|
||||||
o->oMoveAnglePitch = 0x71C;
|
o->oMoveAnglePitch = 0x71C;
|
||||||
|
|
||||||
if (o->oPosY < 2700.0f) {
|
if (o->oPosY < 2700.0f) {
|
||||||
set_time_stop_flags(TIME_STOP_ENABLED | TIME_STOP_MARIO_AND_DOORS);
|
//set_time_stop_flags(TIME_STOP_ENABLED | TIME_STOP_MARIO_AND_DOORS);
|
||||||
|
|
||||||
if (cutscene_object_with_dialog(CUTSCENE_DIALOG, o, DIALOG_045)) {
|
if (cutscene_object_with_dialog(CUTSCENE_DIALOG, o, DIALOG_045)) {
|
||||||
clear_time_stop_flags(TIME_STOP_ENABLED | TIME_STOP_MARIO_AND_DOORS);
|
//clear_time_stop_flags(TIME_STOP_ENABLED | TIME_STOP_MARIO_AND_DOORS);
|
||||||
|
|
||||||
o->oAction = HOOT_ACT_TIRED;
|
o->oAction = HOOT_ACT_TIRED;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -8973,7 +8973,7 @@ BAD_RETURN(s32) cutscene_dialog_start(struct Camera *c) {
|
||||||
|
|
||||||
|
|
||||||
cutscene_soften_music(c);
|
cutscene_soften_music(c);
|
||||||
set_time_stop_flags(TIME_STOP_ENABLED | TIME_STOP_DIALOG);
|
//set_time_stop_flags(TIME_STOP_ENABLED | TIME_STOP_DIALOG);
|
||||||
|
|
||||||
#ifndef VERSION_JP
|
#ifndef VERSION_JP
|
||||||
if (c->mode == CAMERA_MODE_BOSS_FIGHT) {
|
if (c->mode == CAMERA_MODE_BOSS_FIGHT) {
|
||||||
|
|
@ -9092,7 +9092,7 @@ BAD_RETURN(s32) cutscene_dialog_set_flag(UNUSED struct Camera *c) {
|
||||||
BAD_RETURN(s32) cutscene_dialog_end(struct Camera *c) {
|
BAD_RETURN(s32) cutscene_dialog_end(struct Camera *c) {
|
||||||
sStatusFlags |= CAM_FLAG_UNUSED_CUTSCENE_ACTIVE;
|
sStatusFlags |= CAM_FLAG_UNUSED_CUTSCENE_ACTIVE;
|
||||||
c->cutscene = 0;
|
c->cutscene = 0;
|
||||||
clear_time_stop_flags(TIME_STOP_ENABLED | TIME_STOP_DIALOG);
|
//clear_time_stop_flags(TIME_STOP_ENABLED | TIME_STOP_DIALOG);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -9135,7 +9135,7 @@ BAD_RETURN(s32) cutscene_read_message(struct Camera *c) {
|
||||||
case 0:
|
case 0:
|
||||||
if (get_dialog_id() != -1) {
|
if (get_dialog_id() != -1) {
|
||||||
sCutsceneVars[0].angle[0] += 1;
|
sCutsceneVars[0].angle[0] += 1;
|
||||||
set_time_stop_flags(TIME_STOP_ENABLED | TIME_STOP_DIALOG);
|
//set_time_stop_flags(TIME_STOP_ENABLED | TIME_STOP_DIALOG);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
// Leave the dialog.
|
// Leave the dialog.
|
||||||
|
|
@ -9150,7 +9150,7 @@ BAD_RETURN(s32) cutscene_read_message(struct Camera *c) {
|
||||||
retrieve_info_star(c);
|
retrieve_info_star(c);
|
||||||
transition_next_state(c, 15);
|
transition_next_state(c, 15);
|
||||||
sStatusFlags |= CAM_FLAG_UNUSED_CUTSCENE_ACTIVE;
|
sStatusFlags |= CAM_FLAG_UNUSED_CUTSCENE_ACTIVE;
|
||||||
clear_time_stop_flags(TIME_STOP_ENABLED | TIME_STOP_DIALOG);
|
//clear_time_stop_flags(TIME_STOP_ENABLED | TIME_STOP_DIALOG);
|
||||||
// Retrieve previous state
|
// Retrieve previous state
|
||||||
sCUpCameraPitch = sCutsceneVars[1].angle[0];
|
sCUpCameraPitch = sCutsceneVars[1].angle[0];
|
||||||
sModeOffsetYaw = sCutsceneVars[1].angle[1];
|
sModeOffsetYaw = sCutsceneVars[1].angle[1];
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,5 @@
|
||||||
#include <PR/ultratypes.h>
|
#include <PR/ultratypes.h>
|
||||||
|
#include <string.h>
|
||||||
|
|
||||||
#include "area.h"
|
#include "area.h"
|
||||||
#include "actors/common1.h"
|
#include "actors/common1.h"
|
||||||
|
|
@ -896,6 +897,20 @@ u32 interact_warp(struct MarioState *m, UNUSED u32 interactType, struct Object *
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
u32 display_door_dialog(struct MarioState *m, u32 actionArg) {
|
||||||
|
if (m != &gMarioStates[0]) { return FALSE; }
|
||||||
|
// ugly hack: save the last place we opened a dialog to prevent dialog spam
|
||||||
|
static f32 lastDialogPosition[3] = { 0 };
|
||||||
|
f32 dx = m->pos[0] - lastDialogPosition[0]; dx *= dx;
|
||||||
|
f32 dy = m->pos[1] - lastDialogPosition[1]; dy *= dy;
|
||||||
|
f32 dz = m->pos[2] - lastDialogPosition[2]; dz *= dz;
|
||||||
|
f32 dist = sqrt(dx + dy + dz);
|
||||||
|
if (dist < 300) { return FALSE; }
|
||||||
|
memcpy(lastDialogPosition, &m->pos[0], sizeof(f32) * 3);
|
||||||
|
|
||||||
|
return set_mario_action(m, ACT_READING_AUTOMATIC_DIALOG, actionArg);
|
||||||
|
}
|
||||||
|
|
||||||
u32 interact_warp_door(struct MarioState *m, UNUSED u32 interactType, struct Object *o) {
|
u32 interact_warp_door(struct MarioState *m, UNUSED u32 interactType, struct Object *o) {
|
||||||
u32 doorAction = 0;
|
u32 doorAction = 0;
|
||||||
u32 saveFlags = save_file_get_flags();
|
u32 saveFlags = save_file_get_flags();
|
||||||
|
|
@ -905,12 +920,9 @@ u32 interact_warp_door(struct MarioState *m, UNUSED u32 interactType, struct Obj
|
||||||
if (m->action == ACT_WALKING || m->action == ACT_DECELERATING) {
|
if (m->action == ACT_WALKING || m->action == ACT_DECELERATING) {
|
||||||
if (warpDoorId == 1 && !(saveFlags & SAVE_FLAG_UNLOCKED_UPSTAIRS_DOOR)) {
|
if (warpDoorId == 1 && !(saveFlags & SAVE_FLAG_UNLOCKED_UPSTAIRS_DOOR)) {
|
||||||
if (!(saveFlags & SAVE_FLAG_HAVE_KEY_2)) {
|
if (!(saveFlags & SAVE_FLAG_HAVE_KEY_2)) {
|
||||||
if (!sDisplayingDoorText) {
|
if (display_door_dialog(m, (saveFlags & SAVE_FLAG_HAVE_KEY_1) ? DIALOG_023 : DIALOG_022)) {
|
||||||
set_mario_action(m, ACT_READING_AUTOMATIC_DIALOG,
|
sDisplayingDoorText = TRUE;
|
||||||
(saveFlags & SAVE_FLAG_HAVE_KEY_1) ? DIALOG_023 : DIALOG_022);
|
|
||||||
}
|
}
|
||||||
sDisplayingDoorText = TRUE;
|
|
||||||
|
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -919,13 +931,9 @@ u32 interact_warp_door(struct MarioState *m, UNUSED u32 interactType, struct Obj
|
||||||
|
|
||||||
if (warpDoorId == 2 && !(saveFlags & SAVE_FLAG_UNLOCKED_BASEMENT_DOOR)) {
|
if (warpDoorId == 2 && !(saveFlags & SAVE_FLAG_UNLOCKED_BASEMENT_DOOR)) {
|
||||||
if (!(saveFlags & SAVE_FLAG_HAVE_KEY_1)) {
|
if (!(saveFlags & SAVE_FLAG_HAVE_KEY_1)) {
|
||||||
if (!sDisplayingDoorText) {
|
if (display_door_dialog(m, (saveFlags & SAVE_FLAG_HAVE_KEY_2) ? DIALOG_023 : DIALOG_022)) {
|
||||||
// Moat door skip was intended confirmed
|
sDisplayingDoorText = TRUE;
|
||||||
set_mario_action(m, ACT_READING_AUTOMATIC_DIALOG,
|
|
||||||
(saveFlags & SAVE_FLAG_HAVE_KEY_2) ? DIALOG_023 : DIALOG_022);
|
|
||||||
}
|
}
|
||||||
sDisplayingDoorText = TRUE;
|
|
||||||
|
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1047,8 +1055,10 @@ u32 interact_door(struct MarioState *m, UNUSED u32 interactType, struct Object *
|
||||||
|
|
||||||
text += requiredNumStars - numStars;
|
text += requiredNumStars - numStars;
|
||||||
|
|
||||||
sDisplayingDoorText = TRUE;
|
if (display_door_dialog(m, text)) {
|
||||||
return set_mario_action(m, ACT_READING_AUTOMATIC_DIALOG, text);
|
sDisplayingDoorText = TRUE;
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else if (m->action == ACT_IDLE && sDisplayingDoorText == TRUE && requiredNumStars == 70) {
|
} else if (m->action == ACT_IDLE && sDisplayingDoorText == TRUE && requiredNumStars == 70) {
|
||||||
m->interactObj = o;
|
m->interactObj = o;
|
||||||
|
|
|
||||||
|
|
@ -395,7 +395,7 @@ s32 act_reading_npc_dialog(struct MarioState *m) {
|
||||||
headTurnAmount = 384;
|
headTurnAmount = 384;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m->actionState < 8) {
|
if (m->actionState < 8 && m->usedObj != NULL) {
|
||||||
// turn to NPC
|
// turn to NPC
|
||||||
angleToNPC = mario_obj_angle_to_object(m, m->usedObj);
|
angleToNPC = mario_obj_angle_to_object(m, m->usedObj);
|
||||||
m->faceAngle[1] =
|
m->faceAngle[1] =
|
||||||
|
|
@ -454,7 +454,7 @@ s32 act_reading_automatic_dialog(struct MarioState *m) {
|
||||||
|
|
||||||
m->actionState++;
|
m->actionState++;
|
||||||
if (m->actionState == 2) {
|
if (m->actionState == 2) {
|
||||||
enable_time_stop();
|
//enable_time_stop();
|
||||||
}
|
}
|
||||||
if (m->actionState < 9) {
|
if (m->actionState < 9) {
|
||||||
set_mario_animation(m, m->prevAction == ACT_STAR_DANCE_WATER ? MARIO_ANIM_WATER_IDLE
|
set_mario_animation(m, m->prevAction == ACT_STAR_DANCE_WATER ? MARIO_ANIM_WATER_IDLE
|
||||||
|
|
@ -464,11 +464,15 @@ s32 act_reading_automatic_dialog(struct MarioState *m) {
|
||||||
} else {
|
} else {
|
||||||
// set Mario dialog
|
// set Mario dialog
|
||||||
if (m->actionState == 9) {
|
if (m->actionState == 9) {
|
||||||
actionArg = m->actionArg;
|
// only show dialog for local player
|
||||||
if (GET_HIGH_U16_OF_32(actionArg) == 0) {
|
if (m == &gMarioStates[0]) {
|
||||||
create_dialog_box(GET_LOW_U16_OF_32(actionArg));
|
actionArg = m->actionArg;
|
||||||
} else {
|
if (GET_HIGH_U16_OF_32(actionArg) == 0) {
|
||||||
create_dialog_box_with_var(GET_HIGH_U16_OF_32(actionArg), GET_LOW_U16_OF_32(actionArg));
|
create_dialog_box(GET_LOW_U16_OF_32(actionArg));
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
create_dialog_box_with_var(GET_HIGH_U16_OF_32(actionArg), GET_LOW_U16_OF_32(actionArg));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// wait until dialog is done
|
// wait until dialog is done
|
||||||
|
|
@ -483,7 +487,7 @@ s32 act_reading_automatic_dialog(struct MarioState *m) {
|
||||||
}
|
}
|
||||||
// finished action
|
// finished action
|
||||||
else if (m->actionState == 25) {
|
else if (m->actionState == 25) {
|
||||||
disable_time_stop();
|
//disable_time_stop();
|
||||||
if (gShouldNotPlayCastleMusic) {
|
if (gShouldNotPlayCastleMusic) {
|
||||||
gShouldNotPlayCastleMusic = FALSE;
|
gShouldNotPlayCastleMusic = FALSE;
|
||||||
play_cutscene_music(SEQUENCE_ARGS(0, SEQ_LEVEL_INSIDE_CASTLE));
|
play_cutscene_music(SEQUENCE_ARGS(0, SEQ_LEVEL_INSIDE_CASTLE));
|
||||||
|
|
@ -503,6 +507,7 @@ s32 act_reading_automatic_dialog(struct MarioState *m) {
|
||||||
}
|
}
|
||||||
|
|
||||||
s32 act_reading_sign(struct MarioState *m) {
|
s32 act_reading_sign(struct MarioState *m) {
|
||||||
|
|
||||||
struct Object *marioObj = m->marioObj;
|
struct Object *marioObj = m->marioObj;
|
||||||
|
|
||||||
play_sound_if_no_flag(m, SOUND_ACTION_READ_SIGN, MARIO_ACTION_SOUND_PLAYED);
|
play_sound_if_no_flag(m, SOUND_ACTION_READ_SIGN, MARIO_ACTION_SOUND_PLAYED);
|
||||||
|
|
@ -510,8 +515,10 @@ s32 act_reading_sign(struct MarioState *m) {
|
||||||
switch (m->actionState) {
|
switch (m->actionState) {
|
||||||
// start dialog
|
// start dialog
|
||||||
case 0:
|
case 0:
|
||||||
trigger_cutscene_dialog(1);
|
if (m == &gMarioStates[0]) {
|
||||||
enable_time_stop();
|
trigger_cutscene_dialog(1);
|
||||||
|
}
|
||||||
|
//enable_time_stop();
|
||||||
// reading sign
|
// reading sign
|
||||||
set_mario_animation(m, MARIO_ANIM_FIRST_PERSON);
|
set_mario_animation(m, MARIO_ANIM_FIRST_PERSON);
|
||||||
m->actionState = 1;
|
m->actionState = 1;
|
||||||
|
|
@ -523,7 +530,9 @@ s32 act_reading_sign(struct MarioState *m) {
|
||||||
m->pos[2] += marioObj->oMarioReadingSignDPosZ / 11.0f;
|
m->pos[2] += marioObj->oMarioReadingSignDPosZ / 11.0f;
|
||||||
// create the text box
|
// create the text box
|
||||||
if (m->actionTimer++ == 10) {
|
if (m->actionTimer++ == 10) {
|
||||||
create_dialog_inverted_box(m->usedObj->oBehParams2ndByte);
|
if (m == &gMarioStates[0]) {
|
||||||
|
create_dialog_inverted_box(m->usedObj->oBehParams2ndByte);
|
||||||
|
}
|
||||||
m->actionState = 2;
|
m->actionState = 2;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
@ -531,7 +540,7 @@ s32 act_reading_sign(struct MarioState *m) {
|
||||||
case 2:
|
case 2:
|
||||||
// dialog finished
|
// dialog finished
|
||||||
if (gCamera->cutscene == 0) {
|
if (gCamera->cutscene == 0) {
|
||||||
disable_time_stop();
|
//disable_time_stop();
|
||||||
set_mario_action(m, ACT_IDLE, 0);
|
set_mario_action(m, ACT_IDLE, 0);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
|
||||||
|
|
@ -2632,7 +2632,7 @@ s32 cur_obj_update_dialog(s32 actionArg, s32 dialogFlags, s32 dialogID, UNUSED s
|
||||||
// Patched :(
|
// Patched :(
|
||||||
// Wait for Mario to be ready to speak, and then enable time stop
|
// Wait for Mario to be ready to speak, and then enable time stop
|
||||||
if (mario_ready_to_speak() || gMarioState->action == ACT_READING_NPC_DIALOG) {
|
if (mario_ready_to_speak() || gMarioState->action == ACT_READING_NPC_DIALOG) {
|
||||||
gTimeStopState |= TIME_STOP_ENABLED;
|
//gTimeStopState |= TIME_STOP_ENABLED;
|
||||||
o->activeFlags |= ACTIVE_FLAG_INITIATED_TIME_STOP;
|
o->activeFlags |= ACTIVE_FLAG_INITIATED_TIME_STOP;
|
||||||
o->oDialogState++;
|
o->oDialogState++;
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -2709,7 +2709,7 @@ s32 cur_obj_update_dialog_with_cutscene(s32 actionArg, s32 dialogFlags, s32 cuts
|
||||||
case DIALOG_UNK2_ENABLE_TIME_STOP:
|
case DIALOG_UNK2_ENABLE_TIME_STOP:
|
||||||
// Wait for Mario to be ready to speak, and then enable time stop
|
// Wait for Mario to be ready to speak, and then enable time stop
|
||||||
if (mario_ready_to_speak() || gMarioState->action == ACT_READING_NPC_DIALOG) {
|
if (mario_ready_to_speak() || gMarioState->action == ACT_READING_NPC_DIALOG) {
|
||||||
gTimeStopState |= TIME_STOP_ENABLED;
|
//gTimeStopState |= TIME_STOP_ENABLED;
|
||||||
o->activeFlags |= ACTIVE_FLAG_INITIATED_TIME_STOP;
|
o->activeFlags |= ACTIVE_FLAG_INITIATED_TIME_STOP;
|
||||||
o->oDialogState++;
|
o->oDialogState++;
|
||||||
o->oDialogResponse = 0;
|
o->oDialogResponse = 0;
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue