make booms run outdoors.

multiple places in the code called boom_space for outdoors, but boom_space
had early returns in outdoor modes.
This commit is contained in:
2025-05-08 17:30:44 -05:00
parent b230329908
commit 98a7109060
6 changed files with 32 additions and 22 deletions

View File

@@ -3383,9 +3383,6 @@ void increase_age(bool eating_trigger_autosave) {
play_sound(66);
r1 = get_ran(3,1,6);
hit_party(r1,eDamageType::SPECIAL);
// Might seem redudant but maybe hit_party could change the mode if TPK?
if(!is_combat())
boom_space(univ.party.out_loc,overall_mode,0,r1,0);
}
else {
play_sound(6);

View File

@@ -4423,8 +4423,6 @@ void handle_acid() {
damage_pc(pc,r1,eDamageType::ACID,eRace::UNKNOWN);
move_to_zero(pc.status[eStatus::ACID]);
}
if(!is_combat())
boom_space(univ.party.out_loc,overall_mode,3,r1,8);
}
}

View File

@@ -1485,8 +1485,6 @@ void boom_space(location where,short mode,short type,short damage,short sound) {
return;
if((boom_anim_active) && (type != 3))
return;
if(is_out())
return;
mainPtr().setView(mainPtr().getDefaultView());
put_background();
@@ -1496,7 +1494,7 @@ void boom_space(location where,short mode,short type,short damage,short sound) {
UI::toolbar.draw(mainPtr());
// Redraw terrain in proper position
if(((!point_onscreen(center,where) && is_combat()) || (overall_mode == MODE_OUTDOORS))
if(((!point_onscreen(center,where) && is_combat()))
) {
play_sound(sound_to_play);

View File

@@ -2325,9 +2325,22 @@ bool flying() {
}
void hit_party(short how_much,eDamageType damage_type,short snd_type) {
for(short i = 0; i < 6; i++)
if(univ.party[i].main_status == eMainStatus::ALIVE)
damage_pc(univ.party[i],how_much,damage_type,eRace::UNKNOWN,snd_type);
short max_dam = 0;
for(short i = 0; i < 6; i++){
if(univ.party[i].main_status == eMainStatus::ALIVE){
short dam = damage_pc(univ.party[i],how_much,damage_type,eRace::UNKNOWN,snd_type, true, is_combat());
if(dam > max_dam) max_dam = dam;
}
}
// Peace mode: one boom for the whole party, use the highest damage actually taken
if(!is_combat() && max_dam > 0){
int boom_type = boom_gr[damage_type];
if(is_town())
boom_space(univ.party.town_loc,overall_mode,boom_type,max_dam,snd_type);
else
boom_space(univ.party.out_loc,100,boom_type,max_dam,snd_type);
}
put_pc_screen();
}
@@ -2339,7 +2352,7 @@ void slay_party(eMainStatus mode) {
put_pc_screen();
}
short damage_pc(cPlayer& which_pc,short how_much,eDamageType damage_type,eRace type_of_attacker, short sound_type,bool do_print) {
short damage_pc(cPlayer& which_pc,short how_much,eDamageType damage_type,eRace type_of_attacker, short sound_type,bool do_print, bool boom) {
if(which_pc.main_status != eMainStatus::ALIVE)
return false;
@@ -2475,12 +2488,13 @@ short damage_pc(cPlayer& which_pc,short how_much,eDamageType damage_type,eRace t
if(do_print)
add_string_to_buf(" " + which_pc.name + " takes " + std::to_string(how_much) + '.');
if(damage_type != eDamageType::MARKED) {
if(damage_type != eDamageType::MARKED && boom) {
if(is_combat())
boom_space(which_pc.combat_pos,overall_mode,boom_type,how_much,sound_type);
else if(is_town())
boom_space(univ.party.town_loc,overall_mode,boom_type,how_much,sound_type);
else boom_space(univ.party.town_loc,100,boom_type,how_much,sound_type);
else
boom_space(univ.party.out_loc,100,boom_type,how_much,sound_type);
}
// TODO: When outdoors it flushed only key events, not mouse events. Why?
flushingInput = true;

View File

@@ -38,7 +38,7 @@ mon_num_t pick_trapped_monst();
bool flying() ;
void hit_party(short how_much,eDamageType damage_type,short snd_type = 0);
void slay_party(eMainStatus mode);
short damage_pc(cPlayer& which_pc,short how_much,eDamageType damage_type,eRace type_of_attacker, short sound_type = -1,bool do_print = true);
short damage_pc(cPlayer& which_pc,short how_much,eDamageType damage_type,eRace type_of_attacker, short sound_type = -1,bool do_print = true, bool boom = true);
void petrify_pc(cPlayer& which_pc,int strength);
void kill_pc(cPlayer& which_pc,eMainStatus type);
void set_pc_moves();

View File

@@ -381,14 +381,17 @@ bool check_special_terrain(location where_check,eSpecCtx mode,cPlayer& which_pc,
break;
}
if(r1 < 0) break; // "It doesn't affect you."
if(mode != eSpecCtx::COMBAT_MOVE)
hit_party(r1,dam_type);
fast_bang = 1;
if(mode == eSpecCtx::COMBAT_MOVE)
// In combat, only hurt the active player
if(mode == eSpecCtx::COMBAT_MOVE){
fast_bang = 1;
damage_pc(which_pc,r1,dam_type,eRace::UNKNOWN);
else
boom_space(univ.party.out_loc,overall_mode,pic_type,r1,12);
fast_bang = 0;
fast_bang = 0;
}
// In peace mode, hurt everyone
else{
hit_party(r1,dam_type);
}
break;
case eTerSpec::DANGEROUS:
// if the party is flying, in a boat, or entering a boat, they cannot be harmed by terrain