Skip to content

Commit a023a1a

Browse files
authored
Merge pull request scp-fs2open#7014 from Goober5000/cinematic_followup
modular table fix for cinematic warp
2 parents f89cd69 + f2bc71c commit a023a1a

File tree

1 file changed

+41
-40
lines changed

1 file changed

+41
-40
lines changed

code/fireball/fireballs.cpp

Lines changed: 41 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -437,47 +437,48 @@ static void parse_fireball_tbl(const char *table_filename)
437437
default:
438438
error_display(0, "Invalid warp model style. Must be classic or cinematic.");
439439
}
440-
} else if (first_time) {
441-
fi->warp_model_style = warp_style::CLASSIC;
442-
}
443-
444-
// Set warp_model_style options if cinematic style is chosen
445-
if (fi->warp_model_style == warp_style::CINEMATIC) {
446-
if (optional_string("+Warp size ratio:")) {
447-
stuff_float(&fi->warp_size_ratio);
448-
} else {
449-
fi->warp_size_ratio = 1.6f;
450-
}
451-
452-
// The first two values need to be implied multiples of PI
453-
// for convenience. These shouldn't need to be faster than a full
454-
// rotation per second, which is already ridiculous.
455-
if (optional_string("+Rotation anim:")) {
456-
stuff_float_list(fi->rot_anim, 3);
457440

458-
CLAMP(fi->rot_anim[0], 0.0f, 2.0f);
459-
CLAMP(fi->rot_anim[1], 0.0f, 2.0f);
460-
fi->rot_anim[2] = MAX(0.0f, fi->rot_anim[2]);
461-
} else {
462-
// PI / 2.75f, PI / 10.0f, 2.0f
463-
fi->rot_anim[0] = 0.365f;
464-
fi->rot_anim[1] = 0.083f;
465-
fi->rot_anim[2] = 2.0f;
441+
// Set warp_model_style options if cinematic style is chosen
442+
if (fi->warp_model_style == warp_style::CINEMATIC) {
443+
if (optional_string("+Warp size ratio:")) {
444+
stuff_float(&fi->warp_size_ratio);
445+
} else {
446+
fi->warp_size_ratio = 1.6f;
447+
}
448+
449+
// The first two values need to be implied multiples of PI
450+
// for convenience. These shouldn't need to be faster than a full
451+
// rotation per second, which is already ridiculous.
452+
if (optional_string("+Rotation anim:")) {
453+
stuff_float_list(fi->rot_anim, 3);
454+
455+
CLAMP(fi->rot_anim[0], 0.0f, 2.0f);
456+
CLAMP(fi->rot_anim[1], 0.0f, 2.0f);
457+
fi->rot_anim[2] = MAX(0.0f, fi->rot_anim[2]);
458+
} else {
459+
// PI / 2.75f, PI / 10.0f, 2.0f
460+
fi->rot_anim[0] = 0.365f;
461+
fi->rot_anim[1] = 0.083f;
462+
fi->rot_anim[2] = 2.0f;
463+
}
464+
465+
// Variable frame rate for faster propagation of ripples
466+
if (optional_string("+Frame anim:")) {
467+
stuff_float_list(fi->frame_anim, 3);
468+
469+
// A frame rate that is 4 times the normal speed is ridiculous
470+
CLAMP(fi->frame_anim[0], 0.0f, 4.0f);
471+
CLAMP(fi->frame_anim[1], 1.0f, 4.0f);
472+
fi->frame_anim[2] = MAX(0.0f, fi->frame_anim[2]);
473+
} else {
474+
fi->frame_anim[0] = 1.0f;
475+
fi->frame_anim[1] = 1.0f;
476+
fi->frame_anim[2] = 3.0f;
477+
}
466478
}
467479

468-
// Variable frame rate for faster propagation of ripples
469-
if (optional_string("+Frame anim:")) {
470-
stuff_float_list(fi->frame_anim, 3);
471-
472-
// A frame rate that is 4 times the normal speed is ridiculous
473-
CLAMP(fi->frame_anim[0], 0.0f, 4.0f);
474-
CLAMP(fi->frame_anim[1], 1.0f, 4.0f);
475-
fi->frame_anim[2] = MAX(0.0f, fi->frame_anim[2]);
476-
} else {
477-
fi->frame_anim[0] = 1.0f;
478-
fi->frame_anim[1] = 1.0f;
479-
fi->frame_anim[2] = 3.0f;
480-
}
480+
} else if (first_time) {
481+
fi->warp_model_style = warp_style::CLASSIC;
481482
}
482483
}
483484

@@ -1150,12 +1151,12 @@ static float cutscene_wormhole(float t) {
11501151
float fireball_wormhole_intensity(fireball *fb)
11511152
{
11521153
float t = fb->time_elapsed;
1153-
1154-
float rad = cutscene_wormhole(t / fb->warp_open_duration);
1154+
float rad;
11551155

11561156
fireball_info* fi = &Fireball_info[fb->fireball_info_index];
11571157

11581158
if (fi->warp_model_style == warp_style::CINEMATIC) {
1159+
rad = cutscene_wormhole(t / fb->warp_open_duration);
11591160
rad *= cutscene_wormhole((fb->total_time - t) / fb->warp_close_duration);
11601161
rad /= cutscene_wormhole(fb->total_time / (2.0f * fb->warp_open_duration));
11611162
rad /= cutscene_wormhole(fb->total_time / (2.0f * fb->warp_close_duration));

0 commit comments

Comments
 (0)