many small changes everywhere

This commit is contained in:
Magnus Auvinen 2007-08-05 08:59:38 +00:00
parent c1509e5cd4
commit 421300ffb8
6 changed files with 33 additions and 9 deletions

BIN
data/audio/chat_client.wav Normal file

Binary file not shown.

BIN
data/audio/chat_server.wav Normal file

Binary file not shown.

View file

@ -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"
}
}

View file

@ -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++)

View file

@ -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)
{

View file

@ -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;
}