Skip to content

Commit

Permalink
Fix redundant messages for player speech
Browse files Browse the repository at this point in the history
  • Loading branch information
Davi-DeGanne committed Dec 9, 2019
1 parent 49b5702 commit b23a55b
Show file tree
Hide file tree
Showing 7 changed files with 50 additions and 39 deletions.
8 changes: 4 additions & 4 deletions src/iexamine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -825,8 +825,8 @@ void iexamine::cardreader_foodplace( player &p, const tripoint &examp )
if( open ) {
add_msg( _( "You press your face on the reader." ) );
add_msg( m_good, _( "The nearby doors are unlocked." ) );
sounds::sound( examp, 6, sounds::sound_t::speech, _( "\"Hello Foodperson. Welcome home.\"" ), true,
"speech", "welcome" );
sounds::sound( examp, 6, sounds::sound_t::electronic_speech,
_( "\"Hello Foodperson. Welcome home.\"" ), true, "speech", "welcome" );
} else {
add_msg( _( "The nearby doors are already unlocked." ) );
if( query_yn( _( "Lock doors?" ) ) ) {
Expand All @@ -843,11 +843,11 @@ void iexamine::cardreader_foodplace( player &p, const tripoint &examp )
}
} else if( p.has_amount( itype_id( "foodperson_mask" ), 1 ) ||
p.has_amount( itype_id( "foodperson_mask_on" ), 1 ) ) {
sounds::sound( examp, 6, sounds::sound_t::speech,
sounds::sound( examp, 6, sounds::sound_t::electronic_speech,
_( "\"FOODPERSON DETECTED. Please make yourself presentable.\"" ), true,
"speech", "welcome" );
} else {
sounds::sound( examp, 6, sounds::sound_t::speech,
sounds::sound( examp, 6, sounds::sound_t::electronic_speech,
_( "\"Your face is inadequate. Please go away.\"" ), true,
"speech", "welcome" );
if( query_yn( _( "Attempt to hack this card-reader?" ) ) ) {
Expand Down
24 changes: 15 additions & 9 deletions src/iuse.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2140,7 +2140,7 @@ int iuse::radio_on( player *p, item *it, bool t, const tripoint &pos )
messtream << string_format( _( "radio: %s" ), segments[index] );
message = messtream.str();
}
sounds::ambient_sound( pos, 6, sounds::sound_t::speech, message );
sounds::ambient_sound( pos, 6, sounds::sound_t::electronic_speech, message );
if( !sfx::is_channel_playing( sfx::channel::radio ) ) {
if( one_in( 10 ) ) {
sfx::play_ambient_variant_sound( "radio", "static", 100, sfx::channel::radio, 300, -1, 0 );
Expand Down Expand Up @@ -3552,7 +3552,8 @@ int iuse::granade_act( player *p, item *it, bool t, const tripoint &pos )
}
if( t ) { // Simple timer effects
// Vol 0 = only heard if you hold it
sounds::sound( pos, 0, sounds::sound_t::speech, _( "Merged!" ), true, "speech", it->typeId() );
sounds::sound( pos, 0, sounds::sound_t::electronic_speech, _( "Merged!" ),
true, "speech", it->typeId() );
} else if( it->charges > 0 ) {
p->add_msg_if_player( m_info, _( "You've already pulled the %s's pin, try throwing it instead." ),
it->tname() );
Expand All @@ -3566,7 +3567,8 @@ int iuse::granade_act( player *p, item *it, bool t, const tripoint &pos )
};
switch( effect_roll ) {
case 1:
sounds::sound( pos, 100, sounds::sound_t::speech, _( "BUGFIXES!" ), true, "speech", it->typeId() );
sounds::sound( pos, 100, sounds::sound_t::electronic_speech, _( "BUGFIXES!" ),
true, "speech", it->typeId() );
explosion_handler::draw_explosion( pos, explosion_radius, c_light_cyan );
for( const tripoint &dest : g->m.points_in_radius( pos, explosion_radius ) ) {
monster *const mon = g->critter_at<monster>( dest, true );
Expand All @@ -3577,7 +3579,8 @@ int iuse::granade_act( player *p, item *it, bool t, const tripoint &pos )
break;

case 2:
sounds::sound( pos, 100, sounds::sound_t::speech, _( "BUFFS!" ), true, "speech", it->typeId() );
sounds::sound( pos, 100, sounds::sound_t::electronic_speech, _( "BUFFS!" ),
true, "speech", it->typeId() );
explosion_handler::draw_explosion( pos, explosion_radius, c_green );
for( const tripoint &dest : g->m.points_in_radius( pos, explosion_radius ) ) {
if( monster *const mon_ptr = g->critter_at<monster>( dest ) ) {
Expand Down Expand Up @@ -3615,7 +3618,8 @@ int iuse::granade_act( player *p, item *it, bool t, const tripoint &pos )
break;

case 3:
sounds::sound( pos, 100, sounds::sound_t::speech, _( "NERFS!" ), true, "speech", it->typeId() );
sounds::sound( pos, 100, sounds::sound_t::electronic_speech, _( "NERFS!" ),
true, "speech", it->typeId() );
explosion_handler::draw_explosion( pos, explosion_radius, c_red );
for( const tripoint &dest : g->m.points_in_radius( pos, explosion_radius ) ) {
if( monster *const mon_ptr = g->critter_at<monster>( dest ) ) {
Expand Down Expand Up @@ -3652,7 +3656,8 @@ int iuse::granade_act( player *p, item *it, bool t, const tripoint &pos )
break;

case 4:
sounds::sound( pos, 100, sounds::sound_t::speech, _( "REVERTS!" ), true, "speech", it->typeId() );
sounds::sound( pos, 100, sounds::sound_t::electronic_speech, _( "REVERTS!" ),
true, "speech", it->typeId() );
explosion_handler::draw_explosion( pos, explosion_radius, c_pink );
for( const tripoint &dest : g->m.points_in_radius( pos, explosion_radius ) ) {
if( monster *const mon_ptr = g->critter_at<monster>( dest ) ) {
Expand All @@ -3669,7 +3674,8 @@ int iuse::granade_act( player *p, item *it, bool t, const tripoint &pos )
}
break;
case 5:
sounds::sound( pos, 100, sounds::sound_t::speech, _( "BEES!" ), true, "speech", it->typeId() );
sounds::sound( pos, 100, sounds::sound_t::electronic_speech, _( "BEES!" ),
true, "speech", it->typeId() );
explosion_handler::draw_explosion( pos, explosion_radius, c_yellow );
for( const tripoint &dest : g->m.points_in_radius( pos, explosion_radius ) ) {
if( one_in( 5 ) && !g->critter_at( dest ) ) {
Expand Down Expand Up @@ -5836,8 +5842,8 @@ int iuse::talking_doll( player *p, item *it, bool, const tripoint & )

const SpeechBubble speech = get_speech( it->typeId() );

sounds::sound( p->pos(), speech.volume, sounds::sound_t::speech, speech.text.translated(), true,
"speech", it->typeId() );
sounds::sound( p->pos(), speech.volume, sounds::sound_t::electronic_speech,
speech.text.translated(), true, "speech", it->typeId() );

// Sound code doesn't describe noises at the player position
if( p->can_hear( p->pos(), speech.volume ) ) {
Expand Down
40 changes: 21 additions & 19 deletions src/monattack.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2819,16 +2819,16 @@ bool mattack::nurse_check_up( monster *z )

if( !z->has_effect(
effect_countdown ) ) { // first we offer the check up then we wait to the player to come close
sounds::sound( z->pos(), 8, sounds::sound_t::speech,
sounds::sound( z->pos(), 8, sounds::sound_t::electronic_speech,
string_format(
_( "a soft robotic voice say, \"Come here. I'll give you a check-up.\"" ) ) );
z->add_effect( effect_countdown, 1_minutes );
} else if( rl_dist( target->pos(), z->pos() ) > 1 ) { // giving them some encouragement
sounds::sound( z->pos(), 8, sounds::sound_t::speech,
sounds::sound( z->pos(), 8, sounds::sound_t::electronic_speech,
string_format(
_( "a soft robotic voice say, \"Come on. I don't bite, I promise it won't hurt one bit.\"" ) ) );
} else {
sounds::sound( z->pos(), 8, sounds::sound_t::speech,
sounds::sound( z->pos(), 8, sounds::sound_t::electronic_speech,
string_format(
_( "a soft robotic voice say, \"Here we go. Just hold still.\"" ) ) );
if( target == &g->u ) {
Expand Down Expand Up @@ -2869,7 +2869,7 @@ bool mattack::nurse_assist( monster *z )
if( found_target ) {
if( target->is_wearing( "badge_doctor" ) ||
z->attitude_to( *target ) == Creature::Attitude::A_FRIENDLY ) {
sounds::sound( z->pos(), 8, sounds::sound_t::speech,
sounds::sound( z->pos(), 8, sounds::sound_t::electronic_speech,
string_format(
_( "a soft robotic voice say, \"Welcome doctor %s. I'll be your assistant today.\"" ),
Name::generate( target->male ) ) );
Expand Down Expand Up @@ -2951,12 +2951,12 @@ bool mattack::nurse_operate( monster *z )
monster *mon = dynamic_cast<monster *>( critter );
if( mon != nullptr && mon != z ) {
if( mon->type->id != mon_defective_robot_nurse ) {
sounds::sound( z->pos(), 8, sounds::sound_t::speech,
sounds::sound( z->pos(), 8, sounds::sound_t::electronic_speech,
string_format(
_( "a soft robotic voice say, \"Unhand this patient immediately! If you keep interfering with the procedure I'll be forced to call law enforcement.\"" ) ) );
z->push_to( mon->pos(), 6, 0 );// try to push the perpetrator away
} else {
sounds::sound( z->pos(), 8, sounds::sound_t::speech,
sounds::sound( z->pos(), 8, sounds::sound_t::electronic_speech,
string_format(
_( "a soft robotic voice say, \"Greetings kinbot. Please take good care of this patient.\"" ) ) );
z->anger = 0;
Expand Down Expand Up @@ -2996,7 +2996,8 @@ bool mattack::check_money_left( monster *z )
}

const SpeechBubble &speech_no_time = get_speech( "mon_grocerybot_friendship_done" );
sounds::sound( z->pos(), speech_no_time.volume, sounds::sound_t::speech, speech_no_time.text );
sounds::sound( z->pos(), speech_no_time.volume,
sounds::sound_t::electronic_speech, speech_no_time.text );
z->remove_effect( effect_paid );
return true;
}
Expand All @@ -3005,15 +3006,16 @@ bool mattack::check_money_left( monster *z )
if( time_left < 1_minutes ) {
if( calendar::once_every( 20_seconds ) ) {
const SpeechBubble &speech_time_low = get_speech( "mon_grocerybot_running_out_of_friendship" );
sounds::sound( z->pos(), speech_time_low.volume, sounds::sound_t::speech, speech_time_low.text );
sounds::sound( z->pos(), speech_time_low.volume,
sounds::sound_t::electronic_speech, speech_time_low.text );
}
}
}
if( z->friendly == -1 && !z->has_effect( effect_paid ) ) {
if( calendar::once_every( 3_hours ) ) {
const SpeechBubble &speech_override_start = get_speech( "mon_grocerybot_hacked" );
sounds::sound( z->pos(), speech_override_start.volume, sounds::sound_t::speech,
speech_override_start.text );
sounds::sound( z->pos(), speech_override_start.volume,
sounds::sound_t::electronic_speech, speech_override_start.text );
}
}
return false;
Expand Down Expand Up @@ -3247,8 +3249,8 @@ void mattack::frag( monster *z, Creature *target ) // This is for the bots, not
}
g->u.add_effect( effect_laserlocked,
3_turns ); // Effect removed in game.cpp, duration doesn't much matter
sounds::sound( z->pos(), 10, sounds::sound_t::speech, _( "Targeting." ), false, "speech",
z->type->id.str() );
sounds::sound( z->pos(), 10, sounds::sound_t::electronic_speech, _( "Targeting." ),
false, "speech", z->type->id.str() );
z->add_effect( effect_targeted, 5_turns );
z->moves -= 150;
// Should give some ability to get behind cover,
Expand Down Expand Up @@ -4538,7 +4540,7 @@ bool mattack::riotbot( monster *z )
z->anger = 0;

if( calendar::once_every( 25_turns ) ) {
sounds::sound( z->pos(), 10, sounds::sound_t::speech,
sounds::sound( z->pos(), 10, sounds::sound_t::electronic_speech,
_( "Halt and submit to arrest, citizen! The police will be here any moment." ), false, "speech",
z->type->id.str() );
}
Expand All @@ -4556,7 +4558,7 @@ bool mattack::riotbot( monster *z )
//we need empty hands to arrest
if( foe == &g->u && !foe->is_armed() ) {

sounds::sound( z->pos(), 15, sounds::sound_t::speech,
sounds::sound( z->pos(), 15, sounds::sound_t::electronic_speech,
_( "Please stay in place, citizen, do not make any movements!" ), false, "speech",
z->type->id.str() );

Expand Down Expand Up @@ -4620,14 +4622,14 @@ bool mattack::riotbot( monster *z )
add_msg( _( "The robot puts handcuffs on you." ) );
}

sounds::sound( z->pos(), 5, sounds::sound_t::speech,
sounds::sound( z->pos(), 5, sounds::sound_t::electronic_speech,
_( "You are under arrest, citizen. You have the right to remain silent. If you do not remain silent, anything you say may be used against you in a court of law." ),
false, "speech", z->type->id.str() );
sounds::sound( z->pos(), 5, sounds::sound_t::speech,
sounds::sound( z->pos(), 5, sounds::sound_t::electronic_speech,
_( "You have the right to an attorney. If you cannot afford an attorney, one will be provided at no cost to you. You may have your attorney present during any questioning." ) );
sounds::sound( z->pos(), 5, sounds::sound_t::speech,
sounds::sound( z->pos(), 5, sounds::sound_t::electronic_speech,
_( "If you do not understand these rights, an officer will explain them in greater detail when taking you into custody." ) );
sounds::sound( z->pos(), 5, sounds::sound_t::speech,
sounds::sound( z->pos(), 5, sounds::sound_t::electronic_speech,
_( "Do not attempt to flee or to remove the handcuffs, citizen. That can be dangerous to your health." ) );

z->moves -= 300;
Expand Down Expand Up @@ -4674,7 +4676,7 @@ bool mattack::riotbot( monster *z )
}

if( calendar::once_every( 5_turns ) ) {
sounds::sound( z->pos(), 25, sounds::sound_t::speech,
sounds::sound( z->pos(), 25, sounds::sound_t::electronic_speech,
_( "Empty your hands and hold your position, citizen!" ), false, "speech", z->type->id.str() );
}

Expand Down
2 changes: 1 addition & 1 deletion src/monmove.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -991,7 +991,7 @@ void monster::nursebot_operate( player *dragged_foe )
add_effect( effect_countdown, 2_turns );// there's still time to get away
add_msg( m_bad, _( "The %s produces a syringe full of some translucent liquid." ), name() );
} else if( g->critter_at( goal ) != nullptr && has_effect( effect_dragging ) ) {
sounds::sound( pos(), 8, sounds::sound_t::speech,
sounds::sound( pos(), 8, sounds::sound_t::electronic_speech,
string_format(
_( "a soft robotic voice say, \"Please step away from the autodoc, this patient needs immediate care.\"" ) ) );
// TODO: Make it able to push NPC/player
Expand Down
10 changes: 6 additions & 4 deletions src/sounds.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,7 @@ std::string enum_to_string<sounds::sound_t>( sounds::sound_t data )
case sounds::sound_t::music: return "music";
case sounds::sound_t::movement: return "movement";
case sounds::sound_t::speech: return "speech";
case sounds::sound_t::electronic_speech: return "electronic_speech";
case sounds::sound_t::activity: return "activity";
case sounds::sound_t::destructive_activity: return "destructive_activity";
case sounds::sound_t::alarm: return "alarm";
Expand Down Expand Up @@ -312,12 +313,12 @@ static bool describe_sound( sounds::sound_t category, bool from_player_position
case sounds::sound_t::activity:
case sounds::sound_t::destructive_activity:
case sounds::sound_t::combat:
return false;
case sounds::sound_t::speech:
// radios also produce speech sound
case sounds::sound_t::alarm:
case sounds::sound_t::alert:
case sounds::sound_t::order:
case sounds::sound_t::speech:
return false;
case sounds::sound_t::electronic_speech:
case sounds::sound_t::alarm:
return true;
}
} else {
Expand All @@ -330,6 +331,7 @@ static bool describe_sound( sounds::sound_t category, bool from_player_position
case sounds::sound_t::destructive_activity:
return one_in( 100 );
case sounds::sound_t::speech:
case sounds::sound_t::electronic_speech:
case sounds::sound_t::alarm:
case sounds::sound_t::combat:
case sounds::sound_t::alert:
Expand Down
1 change: 1 addition & 0 deletions src/sounds.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ enum class sound_t : int {
music,
movement,
speech,
electronic_speech, // Any electronic sound that's not music/alarm: Robot speech, radio, etc.
activity,
destructive_activity,
alarm,
Expand Down
4 changes: 2 additions & 2 deletions src/trapfunc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -699,8 +699,8 @@ bool trapfunc::dissector( const tripoint &p, Creature *c, item * )
if( z->type->in_species( ROBOT ) ) {
//The monster is a robot. So the dissector should not try to dissect the monsters flesh.
//Dissector error sound.
sounds::sound( p, 4, sounds::sound_t::speech, _( "BEEPBOOP! Please remove non-organic object." ),
false, "speech", "robot" );
sounds::sound( p, 4, sounds::sound_t::electronic_speech,
_( "BEEPBOOP! Please remove non-organic object." ), false, "speech", "robot" );
c->add_msg_player_or_npc( m_bad, _( "The dissector lights up, and shuts down." ),
_( "The dissector lights up, and shuts down." ) );
return false;
Expand Down

0 comments on commit b23a55b

Please sign in to comment.