From f88e5c475e9c11fa600334c483b31bfe40eba63b Mon Sep 17 00:00:00 2001 From: Goober5000 Date: Wed, 3 Sep 2025 22:04:48 -0400 Subject: [PATCH 1/2] modular table fix for cinematic warp Small and subtle fix: move the CINEMATIC options inside the preceding if() block in the same way that the flare style options are inside their preceding if() block. This prevents the CINEMATIC options from being reset to their default values in subsequent modular table parsing. Followup to #6500. --- code/fireball/fireballs.cpp | 77 +++++++++++++++++++------------------ 1 file changed, 39 insertions(+), 38 deletions(-) diff --git a/code/fireball/fireballs.cpp b/code/fireball/fireballs.cpp index 7783a612fe4..9733fdb1f37 100644 --- a/code/fireball/fireballs.cpp +++ b/code/fireball/fireballs.cpp @@ -437,47 +437,48 @@ static void parse_fireball_tbl(const char *table_filename) default: error_display(0, "Invalid warp model style. Must be classic or cinematic."); } - } else if (first_time) { - fi->warp_model_style = warp_style::CLASSIC; - } - - // Set warp_model_style options if cinematic style is chosen - if (fi->warp_model_style == warp_style::CINEMATIC) { - if (optional_string("+Warp size ratio:")) { - stuff_float(&fi->warp_size_ratio); - } else { - fi->warp_size_ratio = 1.6f; - } - // The first two values need to be implied multiples of PI - // for convenience. These shouldn't need to be faster than a full - // rotation per second, which is already ridiculous. - if (optional_string("+Rotation anim:")) { - stuff_float_list(fi->rot_anim, 3); - - CLAMP(fi->rot_anim[0], 0.0f, 2.0f); - CLAMP(fi->rot_anim[1], 0.0f, 2.0f); - fi->rot_anim[2] = MAX(0.0f, fi->rot_anim[2]); - } else { - // PI / 2.75f, PI / 10.0f, 2.0f - fi->rot_anim[0] = 0.365f; - fi->rot_anim[1] = 0.083f; - fi->rot_anim[2] = 2.0f; + // Set warp_model_style options if cinematic style is chosen + if (fi->warp_model_style == warp_style::CINEMATIC) { + if (optional_string("+Warp size ratio:")) { + stuff_float(&fi->warp_size_ratio); + } else { + fi->warp_size_ratio = 1.6f; + } + + // The first two values need to be implied multiples of PI + // for convenience. These shouldn't need to be faster than a full + // rotation per second, which is already ridiculous. + if (optional_string("+Rotation anim:")) { + stuff_float_list(fi->rot_anim, 3); + + CLAMP(fi->rot_anim[0], 0.0f, 2.0f); + CLAMP(fi->rot_anim[1], 0.0f, 2.0f); + fi->rot_anim[2] = MAX(0.0f, fi->rot_anim[2]); + } else { + // PI / 2.75f, PI / 10.0f, 2.0f + fi->rot_anim[0] = 0.365f; + fi->rot_anim[1] = 0.083f; + fi->rot_anim[2] = 2.0f; + } + + // Variable frame rate for faster propagation of ripples + if (optional_string("+Frame anim:")) { + stuff_float_list(fi->frame_anim, 3); + + // A frame rate that is 4 times the normal speed is ridiculous + CLAMP(fi->frame_anim[0], 0.0f, 4.0f); + CLAMP(fi->frame_anim[1], 1.0f, 4.0f); + fi->frame_anim[2] = MAX(0.0f, fi->frame_anim[2]); + } else { + fi->frame_anim[0] = 1.0f; + fi->frame_anim[1] = 1.0f; + fi->frame_anim[2] = 3.0f; + } } - // Variable frame rate for faster propagation of ripples - if (optional_string("+Frame anim:")) { - stuff_float_list(fi->frame_anim, 3); - - // A frame rate that is 4 times the normal speed is ridiculous - CLAMP(fi->frame_anim[0], 0.0f, 4.0f); - CLAMP(fi->frame_anim[1], 1.0f, 4.0f); - fi->frame_anim[2] = MAX(0.0f, fi->frame_anim[2]); - } else { - fi->frame_anim[0] = 1.0f; - fi->frame_anim[1] = 1.0f; - fi->frame_anim[2] = 3.0f; - } + } else if (first_time) { + fi->warp_model_style = warp_style::CLASSIC; } } From f2bc71c13a58f2748ad29751f7eb533570333ed2 Mon Sep 17 00:00:00 2001 From: Goober5000 Date: Wed, 3 Sep 2025 22:45:31 -0400 Subject: [PATCH 2/2] small optimization --- code/fireball/fireballs.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/code/fireball/fireballs.cpp b/code/fireball/fireballs.cpp index 9733fdb1f37..10b6c7aceed 100644 --- a/code/fireball/fireballs.cpp +++ b/code/fireball/fireballs.cpp @@ -1151,12 +1151,12 @@ static float cutscene_wormhole(float t) { float fireball_wormhole_intensity(fireball *fb) { float t = fb->time_elapsed; - - float rad = cutscene_wormhole(t / fb->warp_open_duration); + float rad; fireball_info* fi = &Fireball_info[fb->fireball_info_index]; if (fi->warp_model_style == warp_style::CINEMATIC) { + rad = cutscene_wormhole(t / fb->warp_open_duration); rad *= cutscene_wormhole((fb->total_time - t) / fb->warp_close_duration); rad /= cutscene_wormhole(fb->total_time / (2.0f * fb->warp_open_duration)); rad /= cutscene_wormhole(fb->total_time / (2.0f * fb->warp_close_duration));