diff --git a/data/audio/chat_client.wav b/data/audio/chat_client.wav new file mode 100644 index 000000000..d783c5cbf Binary files /dev/null and b/data/audio/chat_client.wav differ diff --git a/data/audio/chat_server.wav b/data/audio/chat_server.wav new file mode 100644 index 000000000..44c57525f Binary files /dev/null and b/data/audio/chat_server.wav differ diff --git a/datasrc/teewars.ds b/datasrc/teewars.ds index 2baba254f..828fc7c41 100644 --- a/datasrc/teewars.ds +++ b/datasrc/teewars.ds @@ -165,6 +165,14 @@ sounds { "data/audio/sfx_hit_weak-01.wav" "data/audio/sfx_hit_weak-02.wav" } + + chat_server { + "data/audio/chat_server.wav" + } + + chat_client { + "data/audio/chat_client.wav" + } } diff --git a/src/engine/client/snd.cpp b/src/engine/client/snd.cpp index 0ba18e895..2b01fc848 100644 --- a/src/engine/client/snd.cpp +++ b/src/engine/client/snd.cpp @@ -14,7 +14,7 @@ static const float NUM_FRAMES_LERP_INV = 1.0f/(float)NUM_FRAMES_LERP; static const float GLOBAL_VOLUME_SCALE = 0.75f; static float master_volume = 1.0f; -static const int64 GLOBAL_SOUND_DELAY = 1000; +static const float GLOBAL_SOUND_DELAY = 0.05f; // --- sound --- class sound_data @@ -156,7 +156,7 @@ public: int play(sound_data *sound, unsigned loop, float vol, float pan) { - if(time_get() - sound->last_played < GLOBAL_SOUND_DELAY) + if(time_get() - sound->last_played < (int64)(time_freq()*GLOBAL_SOUND_DELAY)) return -1; for(int c = 0; c < MAX_CHANNELS; c++) diff --git a/src/game/client/game_client.cpp b/src/game/client/game_client.cpp index 64ab18f00..8b8139686 100644 --- a/src/game/client/game_client.cpp +++ b/src/game/client/game_client.cpp @@ -1665,8 +1665,16 @@ void render_game() draw_round_rect(x-10.f, y-10.f, w, h, 40.0f); gfx_quads_end(); - float tw = gfx_pretty_text_width( 64, "Score Board"); - gfx_pretty_text(x+w/2-tw/2, y, 64, "Score Board"); + if(gameobj->game_over) + { + float tw = gfx_pretty_text_width( 64, "Game Over"); + gfx_pretty_text(x+w/2-tw/2, y, 64, "Game Over"); + } + else + { + float tw = gfx_pretty_text_width( 64, "Score Board"); + gfx_pretty_text(x+w/2-tw/2, y, 64, "Score Board"); + } y += 64.0f; // find players @@ -1890,6 +1898,11 @@ void modc_message(int msg) const char *message = msg_unpack_string(); dbg_msg("message", "chat cid=%d msg='%s'", cid, message); chat_add_line(cid, message); + + if(cid >= 0) + snd_play(data->sounds[SOUND_CHAT_CLIENT].sounds[0].id, SND_PLAY_ONCE, 1.0f, 0.0f); + else + snd_play(data->sounds[SOUND_CHAT_SERVER].sounds[0].id, SND_PLAY_ONCE, 1.0f, 0.0f); } else if(msg == MSG_SETNAME) { diff --git a/src/game/server/game_server.cpp b/src/game/server/game_server.cpp index d77c637d4..819215cbf 100644 --- a/src/game/server/game_server.cpp +++ b/src/game/server/game_server.cpp @@ -11,7 +11,7 @@ data_container *data = 0x0; using namespace baselib; // --------- DEBUG STUFF --------- -const int debug_bots = 0; +const int debug_bots = 7; // --------- PHYSICS TWEAK! -------- const float ground_control_speed = 7.0f; @@ -618,8 +618,6 @@ void projectile::tick() else if (targetplayer) { targetplayer->take_damage(normalize(vel) * max(0.001f, force), damage, owner, weapon); - - create_targetted_sound(pos, SOUND_HIT, owner); } world.destroy_entity(this); @@ -916,7 +914,7 @@ int player::handle_ninja() create_sound(ents[i]->pos, SOUND_NINJA_HIT); // set his velocity to fast upward (for now) hitobjects[numobjectshit++] = ents[i]; - ents[i]->take_damage(vec2(0,10.0f), data->weapons[WEAPON_NINJA].meleedamage, client_id,-1); + ents[i]->take_damage(vec2(0,10.0f), data->weapons[WEAPON_NINJA].meleedamage, client_id,WEAPON_NINJA); } } return MODIFIER_RETURNFLAGS_OVERRIDEVELOCITY | MODIFIER_RETURNFLAGS_OVERRIDEPOSITION | MODIFIER_RETURNFLAGS_OVERRIDEGRAVITY; @@ -976,7 +974,7 @@ int player::handle_weapons() break; case WEAPON_ROCKET: { - projectile *p = new projectile(projectile::WEAPON_PROJECTILETYPE_ROCKET, + new projectile(projectile::WEAPON_PROJECTILETYPE_ROCKET, client_id, pos+vec2(0,0), direction*15.0f, @@ -1386,6 +1384,10 @@ bool player::take_damage(vec2 force, int dmg, int from, int weapon) damage_taken_tick = server_tick()+50; + // do damage hit sound + if(from >= 0) + create_targetted_sound(pos, SOUND_HIT, from); + // check for death if(health <= 0) { @@ -1410,6 +1412,7 @@ bool player::take_damage(vec2 force, int dmg, int from, int weapon) else create_sound(pos, SOUND_PLAYER_PAIN_SHORT); + // spawn blood? return true; }