fix explosions breaking old replays

This commit is contained in:
2025-01-16 15:28:06 -06:00
parent afa79bcc5d
commit df02f79ab8
7 changed files with 31 additions and 9 deletions

View File

@@ -1599,7 +1599,8 @@ void do_combat_cast(location target) {
if(ashes_loc.x > 0){
// If ashes are going to appear, there'd better be a visible blast on the spot.
if(!hit_ashes_loc){
add_explosion(ashes_loc,0,0,get_boom_type(eDamageType::FIRE),1,0);
// the last argument is true so this doesn't break RNG of older replays:
add_explosion(ashes_loc,0,0,get_boom_type(eDamageType::FIRE),1,0,true);
}
univ.town.set_ash(ashes_loc.x,ashes_loc.y,true);

View File

@@ -264,6 +264,9 @@ static void process_args(int argc, char* argv[]) {
cli.writeToStream(std::cout);
exit(0);
}
// This obsolete preference should always be true unless running an old replay
// (which will set it false after this line if it needs to)
set_pref("DrawTerrainFrills", true);
if(replay){
if(record_to){
std::cout << "Warning: flag --record conflicts with --replay and will be ignored." << std::endl;

View File

@@ -302,7 +302,9 @@ void mondo_boom(location l,short type,short snd) {
end_missile_anim();
}
void add_explosion(location dest,short val_to_place,short place_type,short boom_type,short x_adj,short y_adj) {
void add_explosion(location dest,short val_to_place,short place_type,short boom_type,short x_adj,short y_adj, bool use_unique_ran) {
if(!get_bool_pref("DrawTerrainFrills", true))
return;
if(!boom_anim_active)
return;
// lose redundant explosions
@@ -316,7 +318,7 @@ void add_explosion(location dest,short val_to_place,short place_type,short boom_
for(short i = 0; i < 30; i++)
if(store_booms[i].boom_type < 0) {
have_boom = true;
store_booms[i].offset = (i == 0) ? 0 : -1 * get_ran(1,0,2);
store_booms[i].offset = (i == 0) ? 0 : -1 * get_ran(1,0,2,use_unique_ran);
store_booms[i].dest = dest;
store_booms[i].val_to_place = val_to_place;
store_booms[i].place_type = place_type;

View File

@@ -56,7 +56,7 @@ void run_a_missile(location from,location fire_to,miss_num_t miss_type,short pat
void run_a_boom(location boom_where,short type,short x_adj,short y_adj,short snd = -1);
void mondo_boom(location l,short type,short snd = -1);
void add_missile(location dest,miss_num_t missile_type,short path_type,short x_adj,short y_adj);
void add_explosion(location dest,short val_to_place,short place_type,short boom_type,short x_adj,short y_adj);
void add_explosion(location dest,short val_to_place,short place_type,short boom_type,short x_adj,short y_adj, bool use_unique_ran = false);
void do_missile_anim(short num_steps,location missile_origin,short sound_num) ;
void do_explosion_anim(short sound_num,short expand,short snd = -1);
void click_shop_rect(rectangle area_rect);