Skip to content

Commit

Permalink
Bunch of less urgent fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
MorsGames committed Nov 19, 2022
1 parent 7639472 commit de81144
Show file tree
Hide file tree
Showing 12 changed files with 67 additions and 22 deletions.
14 changes: 14 additions & 0 deletions .idea/deployment.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v3.0.1
v3.0.2
1 change: 1 addition & 0 deletions include/dialog_ids.h
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,7 @@ enum DialogId {
DIALOG_172,
DIALOG_173,
DIALOG_174,
DIALOG_175,
DIALOG_COUNT
};

Expand Down
2 changes: 1 addition & 1 deletion src/audio/external.c
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ u8 sDialogSpeaker[] = {
/*14*/ _, _, _, _, _, _, _, _, _, _,
/*15*/ WIGLR, WIGLR, WIGLR, _, _, _, _, _, _, _,
/*16*/ _, YOSHI, _, _, _, _, _, _, WIGLR, _,
/*NW*/ _, _, TUXIE, TUXIE, _
/*NW*/ _, _, TUXIE, TUXIE, _, _
};
#undef _
STATIC_ASSERT(ARRAY_COUNT(sDialogSpeaker) == DIALOG_COUNT,
Expand Down
12 changes: 6 additions & 6 deletions src/engine/behavior_script.c
Original file line number Diff line number Diff line change
Expand Up @@ -991,11 +991,11 @@ void cur_obj_update(void) {
} else if ((objFlags & OBJ_FLAG_COMPUTE_DIST_TO_MARIO) && gCurrentObject->collisionData == NULL) {
if (!(objFlags & OBJ_FLAG_ACTIVE_FROM_AFAR)) {
if (configDrawDistanceMultiplier <= 0.0f) {
if (distanceFromMario <= gCurrentObject->oDrawingDistance && gCurrentObject->oHeldState == HELD_FREE)
{
gCurrentObject->header.gfx.node.flags |= GRAPH_RENDER_ACTIVE;
gCurrentObject->activeFlags &= ~ACTIVE_FLAG_FAR_AWAY;
}
if (distanceFromMario <= gCurrentObject->oDrawingDistance && gCurrentObject->oHeldState == HELD_FREE)
{
gCurrentObject->header.gfx.node.flags |= GRAPH_RENDER_ACTIVE;
gCurrentObject->activeFlags &= ~ACTIVE_FLAG_FAR_AWAY;
}
}
else {
// If the object has a render distance, check if it should be shown.
Expand All @@ -1011,4 +1011,4 @@ void cur_obj_update(void) {
}
}
}
}
}
10 changes: 6 additions & 4 deletions src/game/behaviors/donut_platform.inc.c
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ void bhv_donut_platform_spawner_update(void) {
marioSqDist = dx * dx + dy * dy + dz * dz;

// dist > 1000 and dist < 2000
if (marioSqDist > 1000000.0f && marioSqDist < 4000000.0f) {
if (marioSqDist > 1000000.0f && ((marioSqDist < 4000000.0f * configDrawDistanceMultiplier) || configDrawDistanceMultiplier <= 0.0)) {
if (spawn_object_relative(i, sDonutPlatformPositions[i][0],
sDonutPlatformPositions[i][1], sDonutPlatformPositions[i][2],
o, MODEL_RR_DONUT_PLATFORM, bhvDonutPlatform)
Expand All @@ -41,12 +41,14 @@ void bhv_donut_platform_spawner_update(void) {
}

void bhv_donut_platform_update(void) {
if (o->oTimer != 0 && ((o->oMoveFlags & OBJ_MOVE_MASK_ON_GROUND) || o->oDistanceToMario > 2500.0f)) {
f32 dist = 2500.0f * configDrawDistanceMultiplier;

if (o->oTimer != 0 && ((o->oMoveFlags & OBJ_MOVE_MASK_ON_GROUND) || (o->oDistanceToMario > dist && configDrawDistanceMultiplier > 0.0))) {
o->parentObj->oDonutPlatformSpawnerSpawnedPlatforms =
o->parentObj->oDonutPlatformSpawnerSpawnedPlatforms
& ((1 << o->oBehParams2ndByte) ^ 0xFFFFFFFF);

if (o->oDistanceToMario > 2500.0f) {
if (o->oDistanceToMario > dist && configDrawDistanceMultiplier > 0.0) {
obj_mark_for_deletion(o);
} else {
obj_explode_and_spawn_coins(150.0f, 1);
Expand All @@ -70,4 +72,4 @@ void bhv_donut_platform_update(void) {

load_object_collision_model();
}
}
}
2 changes: 1 addition & 1 deletion src/game/mario.c
Original file line number Diff line number Diff line change
Expand Up @@ -1567,7 +1567,7 @@ void update_mario_health(struct MarioState *m) {
// Play a noise to alert the player when Mario is close to drowning.
if (((m->action & ACT_GROUP_MASK) == ACT_GROUP_SUBMERGED) && (m->health < 0x300) && (!(save_file_get_flags() & SAVE_FLAG_DAREDEVIL_MODE)) && (!mario_has_improved_metal_cap(m))) {
play_sound(SOUND_MOVING_ALMOST_DROWNING, gGlobalSoundSource);
#ifdef ENABLE_RUMBLE
#if ENABLE_RUMBLE
if (!gRumblePakTimer) {
gRumblePakTimer = 36;
if (is_rumble_finished_and_queue_empty()) {
Expand Down
4 changes: 2 additions & 2 deletions src/game/mario_actions_airborne.c
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ s32 check_fall_damage(struct MarioState *m, u32 hardFallAction) {
if (!configDisableFallDamage) {
m->hurtCounter += (m->flags & MARIO_CAP_ON_HEAD) ? 16 : 24;
}
#ifdef ENABLE_RUMBLE
#if ENABLE_RUMBLE
queue_rumble_data(5, 80);
#endif
set_camera_shake_from_hit(SHAKE_FALL_DAMAGE);
Expand Down Expand Up @@ -2328,4 +2328,4 @@ s32 mario_execute_airborne_action(struct MarioState *m) {
}

return cancel;
}
}
27 changes: 24 additions & 3 deletions src/game/mario_actions_cutscene.c
Original file line number Diff line number Diff line change
Expand Up @@ -615,8 +615,13 @@ void general_star_dance_handler(struct MarioState *m, s32 isInWater) {
}
// We will be extending the cap timer artificially for this star.
if (configStayInCourse && gCollectedStar == 5 && gCurrLevelNum == LEVEL_DDD) {
m->flags |= MARIO_VANISH_CAP | MARIO_METAL_CAP | MARIO_CAP_ON_HEAD;
m->capTimer = 300;

if (m->flags & MARIO_CAP_ON_HEAD) {
m->flags |= MARIO_VANISH_CAP;
}
if (m->capTimer < 300) {
m->capTimer = 300;
}
}
break;

Expand All @@ -635,7 +640,18 @@ void general_star_dance_handler(struct MarioState *m, s32 isInWater) {
} else {

// Ugly code ahead!
// This is the most readable I could make the code without overcomplicating it
// This is the most readable I could make the code without overcomplicating it

// First let's get if we have all the stars
s32 i;
u8 starCount = 0;
u8 flag = 1;
u8 starFlags = save_file_get_star_flags(gCurrSaveFileNum - 1, gCurrCourseNum - 1);
for (i = 0; i < 7; i++, flag <<= 1) {
if (!(starFlags & flag)) {
starCount++;
}
}

// If we set it to ask
if (configStayInCourse > 0 &&
Expand All @@ -650,6 +666,11 @@ void general_star_dance_handler(struct MarioState *m, s32 isInWater) {
create_dialog_box_with_response(gLastCompletedStarNum == 7 ? DIALOG_171 : DIALOG_170);
m->actionState = 1;
}
else if (configStayInCourse == 2 && starCount >= 7) {
enable_time_stop();
create_dialog_box_with_response(gLastCompletedStarNum == 7 ? DIALOG_171 : DIALOG_175);
m->actionState = 1;
}
// If it's automatic
else if (configStayInCourse == 3) {
if ((gLastCompletedStarNum == 7) ||
Expand Down
2 changes: 1 addition & 1 deletion src/game/settings.c
Original file line number Diff line number Diff line change
Expand Up @@ -303,7 +303,7 @@ unsigned int configButtonCLeft = 0;
unsigned int configButtonCRight = 0;
unsigned int gControllerLeftDeadzone = 512;
unsigned int gControllerRightDeadzone = 512;
float configRumbleStrength = 0.5f;
float configRumbleStrength = 0.25f;

unsigned int configKeyA = DIK_L;
unsigned int configKeyB = DIK_COMMA;
Expand Down
2 changes: 1 addition & 1 deletion src/pc/controller/controller_sdl2.c
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ static SDL_Haptic *controller_sdl_init_haptics(const int joy) {
if (!haptics_enabled) return NULL;

SDL_Haptic *hap = SDL_HapticOpen(joy);
if (!hap) return NULL;
if (hap == NULL) return NULL;

if (SDL_HapticRumbleSupported(hap) != SDL_TRUE) {
SDL_HapticClose(hap);
Expand Down
11 changes: 9 additions & 2 deletions text/us/dialogs.h
Original file line number Diff line number Diff line change
Expand Up @@ -2150,5 +2150,12 @@ and run circles around\n\
the fountain exactly\n\
2401 times Luigi will\n\
come to visit you!\n\
Now could please leave me\n\
alone?"))
Now could you please\n\
leave me alone?"))

DEFINE_DIALOG(DIALOG_175, 1, 5, 30, 200, _("\
Wow! That's all 7 Power\n\
Stars! Do you want to\n\
keep playing this level?\n\
\n\
//You Bet//Not Now"))

0 comments on commit de81144

Please sign in to comment.