Some fixes for some small bugs (#351)

- Doors now no longer will be repeatedly talked even if you don't move away. It now behaves closer to vanilla.
- Fixed the ending level name not being able to be replaced.
This commit is contained in:
Sunk 2024-10-06 22:35:39 -04:00 committed by GitHub
parent c97f2dd033
commit 260a429285
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 15 additions and 21 deletions

View file

@ -88,7 +88,6 @@ static u32 sBackwardKnockbackActions[][3] = {
};
static u8 sDisplayingDoorText = FALSE;
static u8 sCanInteractDoor = TRUE;
static u8 sJustTeleported = FALSE;
u8 gPssSlideStarted = FALSE;
extern u8 gLastCollectedStarOrKey;
@ -1048,7 +1047,7 @@ u32 interact_warp(struct MarioState *m, UNUSED u32 interactType, struct Object *
u32 display_door_dialog(struct MarioState *m, u32 actionArg) {
if (!m) { return FALSE; }
if (m != &gMarioStates[0]) { return FALSE; }
return sCanInteractDoor ? set_mario_action(m, ACT_READING_AUTOMATIC_DIALOG, actionArg) : FALSE;
return (!sDisplayingDoorText) ? set_mario_action(m, ACT_READING_AUTOMATIC_DIALOG, actionArg) : FALSE;
}
u8 prevent_interact_door(struct MarioState* m, struct Object* o) {
@ -1082,7 +1081,6 @@ u32 interact_warp_door(struct MarioState *m, UNUSED u32 interactType, struct Obj
if (!(saveFlags & SAVE_FLAG_HAVE_KEY_2)) {
if (display_door_dialog(m, (saveFlags & SAVE_FLAG_HAVE_KEY_1) ? gBehaviorValues.dialogs.KeyDoor1HaveDialog : gBehaviorValues.dialogs.KeyDoor1DontHaveDialog)) {
sDisplayingDoorText = TRUE;
sCanInteractDoor = FALSE;
}
return FALSE;
}
@ -1094,7 +1092,6 @@ u32 interact_warp_door(struct MarioState *m, UNUSED u32 interactType, struct Obj
if (!(saveFlags & SAVE_FLAG_HAVE_KEY_1)) {
if (display_door_dialog(m, (saveFlags & SAVE_FLAG_HAVE_KEY_2) ? gBehaviorValues.dialogs.KeyDoor2HaveDialog : gBehaviorValues.dialogs.KeyDoor2DontHaveDialog)) {
sDisplayingDoorText = TRUE;
sCanInteractDoor = FALSE;
}
return FALSE;
}
@ -1225,16 +1222,8 @@ u32 interact_door(struct MarioState *m, UNUSED u32 interactType, struct Object *
text += requiredNumStars - numStars;
if ((requiredNumStars == 70) || display_door_dialog(m, text)) {
if (requiredNumStars == 70) {
m->interactObj = o;
m->usedObj = o;
set_mario_action(m, ACT_ENTERING_STAR_DOOR, should_push_or_pull_door(m, o));
}
sDisplayingDoorText = TRUE;
sCanInteractDoor = FALSE;
return TRUE;
}
sDisplayingDoorText = TRUE;
return set_mario_action(m, ACT_READING_AUTOMATIC_DIALOG, text);
}
} else if (m->action == ACT_IDLE && sDisplayingDoorText == TRUE && requiredNumStars == 70) {
m->interactObj = o;
@ -2322,13 +2311,12 @@ void mario_process_interactions(struct MarioState *m) {
check_kick_or_punch_wall(m);
m->flags &= ~MARIO_PUNCHING & ~MARIO_KICKING & ~MARIO_TRIPPING;
if (!(m->marioObj->collidedObjInteractTypes & (INTERACT_WARP_DOOR | INTERACT_DOOR))) {
sDisplayingDoorText = FALSE;
sCanInteractDoor = TRUE;
}
if (!(m->marioObj->collidedObjInteractTypes & INTERACT_WARP)) {
if (m == &gMarioStates[0]) {
// limit to only local mario
// limit to only local mario
if (m == &gMarioStates[0]) {
if (!(m->marioObj->collidedObjInteractTypes & (INTERACT_WARP_DOOR | INTERACT_DOOR))) {
sDisplayingDoorText = FALSE;
}
if (!(m->marioObj->collidedObjInteractTypes & INTERACT_WARP)) {
sJustTeleported = FALSE;
}
}

View file

@ -272,6 +272,7 @@ void smlua_text_utils_act_name_reset(s16 courseNum, u8 actNum) {
void smlua_text_utils_secret_star_replace(s16 courseNum, const char* courseName) {
if (courseNum <= COURSE_RR || courseNum > COURSE_COUNT) { return; }
/*
s16 courseOffset = courseNum - 1;
void **courseNameTbl = get_course_name_table();
@ -282,6 +283,11 @@ void smlua_text_utils_secret_star_replace(s16 courseNum, const char* courseName)
courseNameTbl[courseOffset] = smlua_text_utils_convert(courseName);
sReplacedCourseName[courseOffset] = true;
*/
struct CourseName* courseActNames = gReplacedActNameTable[courseNum];
snprintf(courseActNames->name, 256, "%s", courseName + 3);
courseActNames->modIndex = gLuaActiveMod->index;
}
void smlua_text_utils_castle_secret_stars_replace(const char* name) {