added switch and noammo sounds. ingame chat works more intuitively (sp?)

This commit is contained in:
Jakob Fries 2007-08-04 16:49:57 +00:00
parent 04ab18c37c
commit 9f35dfa5db
3 changed files with 27 additions and 10 deletions

View file

@ -152,6 +152,14 @@ sounds {
"data/audio/sfx_spawn_wpn-02.wav" "data/audio/sfx_spawn_wpn-02.wav"
"data/audio/sfx_spawn_wpn-03.wav" "data/audio/sfx_spawn_wpn-03.wav"
} }
weapon_noammo {
"data/audio/wp_noammo-01.wav"
"data/audio/wp_noammo-02.wav"
"data/audio/wp_noammo-03.wav"
"data/audio/wp_noammo-04.wav"
"data/audio/wp_noammo-05.wav"
}
} }

View file

@ -1202,6 +1202,9 @@ void modc_render()
if (inp_key_down(input::esc)) if (inp_key_down(input::esc))
{ {
if (chat_active)
chat_active = false;
else
menu_active = !menu_active; menu_active = !menu_active;
} }
@ -1557,12 +1560,6 @@ void modc_render()
} }
} }
if (menu_active)
{
ingamemenu_render();
return;
}
// render chat // render chat
{ {
gfx_mapscreen(0,0,400,300); gfx_mapscreen(0,0,400,300);
@ -1592,6 +1589,12 @@ void modc_render()
} }
} }
if (menu_active)
{
ingamemenu_render();
return;
}
// render goals // render goals
if(gameobj) if(gameobj)
{ {

View file

@ -877,8 +877,14 @@ int player::handle_weapons()
// switch weapon if wanted // switch weapon if wanted
if(input.activeweapon >= 0 && input.activeweapon < NUM_WEAPONS && weapons[input.activeweapon].got && if(input.activeweapon >= 0 && input.activeweapon < NUM_WEAPONS && weapons[input.activeweapon].got &&
data->weapons[active_weapon].duration <= 0) data->weapons[active_weapon].duration <= 0)
{
if (active_weapon != input.activeweapon)
create_sound(pos, SOUND_WEAPON_SWITCH);
active_weapon = input.activeweapon; active_weapon = input.activeweapon;
}
if(!previnput.fire && input.fire) if(!previnput.fire && input.fire)
{ {
if(reload_timer == 0) if(reload_timer == 0)
@ -917,6 +923,7 @@ int player::handle_weapons()
case WEAPON_SHOTGUN: case WEAPON_SHOTGUN:
{ {
int shotspread = min(2, weapons[active_weapon].ammo); int shotspread = min(2, weapons[active_weapon].ammo);
weapons[active_weapon].ammo -= shotspread - 1; // one will be taken later
for(int i = -shotspread; i <= shotspread; i++) for(int i = -shotspread; i <= shotspread; i++)
{ {
float a = get_angle(direction); float a = get_angle(direction);
@ -942,14 +949,13 @@ int player::handle_weapons()
break; break;
} }
weapons[active_weapon].ammo -= max(1, weapons[active_weapon].ammocost); weapons[active_weapon].ammo--;
attack_tick = server_tick(); attack_tick = server_tick();
reload_timer = data->weapons[active_weapon].firedelay * server_tickspeed() / 1000; reload_timer = data->weapons[active_weapon].firedelay * server_tickspeed() / 1000;
} }
else else
{ {
// click!!! click create_sound(pos, SOUND_WEAPON_NOAMMO);
// TODO: make sound here
} }
} }
} }