tweaked the rifle and added rifle sounds

This commit is contained in:
Magnus Auvinen 2008-03-17 01:03:14 +00:00
parent 259d288633
commit ad19e0702e
6 changed files with 57 additions and 36 deletions

View file

@ -11,12 +11,6 @@ sounds {
"data/audio/wp_shotty_fire-03.wv" "data/audio/wp_shotty_fire-03.wv"
} }
rifle_fire {
"data/audio/wp_shotty_fire-01.wv"
"data/audio/wp_shotty_fire-02.wv"
"data/audio/wp_shotty_fire-03.wv"
}
grenade_fire { grenade_fire {
"data/audio/wp_flump_launch-01.wv" "data/audio/wp_flump_launch-01.wv"
"data/audio/wp_flump_launch-02.wv" "data/audio/wp_flump_launch-02.wv"
@ -52,6 +46,18 @@ sounds {
"data/audio/wp_ninja_hit-02.wv" "data/audio/wp_ninja_hit-02.wv"
"data/audio/wp_ninja_hit-03.wv" "data/audio/wp_ninja_hit-03.wv"
} }
rifle_fire {
"data/audio/wp_rifle_fire-01.wv"
"data/audio/wp_rifle_fire-02.wv"
"data/audio/wp_rifle_fire-03.wv"
}
rifle_bounce {
"data/audio/wp_rifle_bnce-01.wv"
"data/audio/wp_rifle_bnce-02.wv"
"data/audio/wp_rifle_bnce-03.wv"
}
weapon_switch { weapon_switch {
"data/audio/wp_switch-01.wv" "data/audio/wp_switch-01.wv"

View file

@ -805,7 +805,7 @@ void render_game()
{ {
INPUT_EVENT e = inp_get_event(i); INPUT_EVENT e = inp_get_event(i);
if (!(e.ch >= 0 && e.ch < 32)) if(e.ch > 32)
{ {
if (chat_input_len < sizeof(chat_input) - 1) if (chat_input_len < sizeof(chat_input) - 1)
{ {

View file

@ -154,8 +154,6 @@ void render_laser(const struct NETOBJ_LASER *current)
vec2 from = vec2(current->from_x, current->from_y); vec2 from = vec2(current->from_x, current->from_y);
vec2 dir = normalize(pos-from); vec2 dir = normalize(pos-from);
float ticks = client_tick() + client_intratick() - current->eval_tick; float ticks = client_tick() + client_intratick() - current->eval_tick;
float ms = (ticks/50.0f) * 1000.0f; float ms = (ticks/50.0f) * 1000.0f;
float a = ms / tuning.laser_bounce_delay; float a = ms / tuning.laser_bounce_delay;
@ -171,23 +169,30 @@ void render_laser(const struct NETOBJ_LASER *current)
gfx_texture_set(-1); gfx_texture_set(-1);
gfx_quads_begin(); gfx_quads_begin();
vec4 start_color(0.25f,0.25f,0.5f,1.0f);
vec4 end_color(0.85f,0.85f,1.0f,1.0f);
start_color = end_color;
gfx_setcolorvertex(0, start_color.r, start_color.g, start_color.b, start_color.a); vec4 inner_color(0.25f,0.25f,0.5f,1.0f);
gfx_setcolorvertex(1, start_color.r, start_color.g, start_color.b, start_color.a); vec4 outer_color(0.85f,0.85f,1.0f,1.0f);
gfx_setcolorvertex(2, end_color.r, end_color.g, end_color.b, end_color.a);
gfx_setcolorvertex(3, end_color.r, end_color.g, end_color.b, end_color.a);
from = mix(from, pos, a); gfx_setcolorvertex(0, inner_color.r, inner_color.g, inner_color.b, 0.2f); // center
gfx_setcolorvertex(1, outer_color.r, outer_color.g, outer_color.b, 1.0f);
gfx_setcolorvertex(2, inner_color.r, inner_color.g, inner_color.b, 0.2f); // center
gfx_setcolorvertex(3, outer_color.r, outer_color.g, outer_color.b, 1.0f);
//from = mix(from, pos, a);
gfx_quads_draw_freeform( gfx_quads_draw_freeform(
from.x-out.x, from.y-out.y, from.x, from.y,
from.x+out.x, from.y+out.y, from.x+out.x, from.y+out.y,
pos.x-out.x, pos.y-out.y, pos.x, pos.y,
pos.x+out.x, pos.y+out.y pos.x+out.x, pos.y+out.y
); );
gfx_quads_draw_freeform(
from.x, from.y,
from.x-out.x, from.y-out.y,
pos.x, pos.y,
pos.x-out.x, pos.y-out.y
);
gfx_quads_end(); gfx_quads_end();
@ -197,12 +202,14 @@ void render_laser(const struct NETOBJ_LASER *current)
gfx_texture_set(data->images[IMAGE_PARTICLES].id); gfx_texture_set(data->images[IMAGE_PARTICLES].id);
gfx_quads_begin(); gfx_quads_begin();
gfx_setcolor(end_color.r, end_color.g, end_color.b, end_color.a); gfx_setcolor(outer_color.r, outer_color.g, outer_color.b, outer_color.a);
int sprites[] = {SPRITE_PART_SPLAT01, SPRITE_PART_SPLAT02, SPRITE_PART_SPLAT03}; int sprites[] = {SPRITE_PART_SPLAT01, SPRITE_PART_SPLAT02, SPRITE_PART_SPLAT03};
select_sprite(sprites[client_tick()%3]); select_sprite(sprites[client_tick()%3]);
gfx_quads_setrotation(client_tick()); gfx_quads_setrotation(client_tick());
gfx_quads_draw(pos.x, pos.y, 32,32); gfx_quads_draw(pos.x, pos.y, 24,24);
//gfx_setcolor(inner_color.r, inner_color.g, inner_color.b, 1.0f);
//gfx_quads_draw(pos.x, pos.y, 24,24);
gfx_quads_end(); gfx_quads_end();
} }

View file

@ -1,5 +1,5 @@
/* physics tuning */ /* physics tuning */
MACRO_TUNING_PARAM(ground_control_speed, 350.0f / ticks_per_second) MACRO_TUNING_PARAM(ground_control_speed, 10.0f)
MACRO_TUNING_PARAM(ground_control_accel, 100.0f / ticks_per_second) MACRO_TUNING_PARAM(ground_control_accel, 100.0f / ticks_per_second)
MACRO_TUNING_PARAM(ground_friction, 0.5f) MACRO_TUNING_PARAM(ground_friction, 0.5f)
MACRO_TUNING_PARAM(ground_jump_impulse, 12.6f) MACRO_TUNING_PARAM(ground_jump_impulse, 12.6f)
@ -8,14 +8,14 @@ MACRO_TUNING_PARAM(air_control_speed, 250.0f / ticks_per_second)
MACRO_TUNING_PARAM(air_control_accel, 1.5f) MACRO_TUNING_PARAM(air_control_accel, 1.5f)
MACRO_TUNING_PARAM(air_friction, 0.95f) MACRO_TUNING_PARAM(air_friction, 0.95f)
MACRO_TUNING_PARAM(hook_length, 34*10.0f) MACRO_TUNING_PARAM(hook_length, 34*10.0f)
MACRO_TUNING_PARAM(hook_fire_speed, 45.0f) MACRO_TUNING_PARAM(hook_fire_speed, 80.0f)
MACRO_TUNING_PARAM(hook_drag_accel, 3.0f) MACRO_TUNING_PARAM(hook_drag_accel, 3.0f)
MACRO_TUNING_PARAM(hook_drag_speed, 15.0f) MACRO_TUNING_PARAM(hook_drag_speed, 15.0f)
MACRO_TUNING_PARAM(gravity, 0.5f) MACRO_TUNING_PARAM(gravity, 0.5f)
MACRO_TUNING_PARAM(velramp_start, 500) MACRO_TUNING_PARAM(velramp_start, 550)
MACRO_TUNING_PARAM(velramp_range, 2000) MACRO_TUNING_PARAM(velramp_range, 2000)
MACRO_TUNING_PARAM(velramp_curvature, 1.5f) MACRO_TUNING_PARAM(velramp_curvature, 1.4f)
/* weapon tuning */ /* weapon tuning */
MACRO_TUNING_PARAM(gun_curvature, 1.5f) MACRO_TUNING_PARAM(gun_curvature, 1.5f)
@ -25,7 +25,7 @@ MACRO_TUNING_PARAM(shotgun_curvature, 1.5f)
MACRO_TUNING_PARAM(shotgun_speed, 2200.0f) MACRO_TUNING_PARAM(shotgun_speed, 2200.0f)
MACRO_TUNING_PARAM(grenade_curvature, 7.0f) MACRO_TUNING_PARAM(grenade_curvature, 7.0f)
MACRO_TUNING_PARAM(grenade_speed, 900.0f) MACRO_TUNING_PARAM(grenade_speed, 1000.0f)
MACRO_TUNING_PARAM(laser_reach, 800.0f) MACRO_TUNING_PARAM(laser_reach, 800.0f)
MACRO_TUNING_PARAM(laser_bounce_delay, 150) MACRO_TUNING_PARAM(laser_bounce_delay, 150)

View file

@ -204,6 +204,7 @@ public:
projectile(int type, int owner, vec2 pos, vec2 vel, int span, entity* powner, projectile(int type, int owner, vec2 pos, vec2 vel, int span, entity* powner,
int damage, int flags, float force, int sound_impact, int weapon); int damage, int flags, float force, int sound_impact, int weapon);
vec2 get_pos(float time);
void fill_info(NETOBJ_PROJECTILE *proj); void fill_info(NETOBJ_PROJECTILE *proj);
virtual void reset(); virtual void reset();

View file

@ -406,7 +406,7 @@ void projectile::reset()
world->destroy_entity(this); world->destroy_entity(this);
} }
void projectile::tick() vec2 projectile::get_pos(float time)
{ {
float curvature = 0; float curvature = 0;
float speed = 0; float speed = 0;
@ -426,10 +426,17 @@ void projectile::tick()
speed = tuning.gun_speed; speed = tuning.gun_speed;
} }
return calc_pos(pos, direction, curvature, speed, time);
}
void projectile::tick()
{
float pt = (server_tick()-start_tick-1)/(float)server_tickspeed(); float pt = (server_tick()-start_tick-1)/(float)server_tickspeed();
float ct = (server_tick()-start_tick)/(float)server_tickspeed(); float ct = (server_tick()-start_tick)/(float)server_tickspeed();
vec2 prevpos = calc_pos(pos, direction, curvature, speed, pt); vec2 prevpos = get_pos(pt);
vec2 curpos = calc_pos(pos, direction, curvature, speed, ct); vec2 curpos = get_pos(ct);
lifespan--; lifespan--;
@ -466,13 +473,10 @@ void projectile::fill_info(NETOBJ_PROJECTILE *proj)
void projectile::snap(int snapping_client) void projectile::snap(int snapping_client)
{ {
/*float ct = (server_tick()-start_tick)/(float)server_tickspeed();*/ float ct = (server_tick()-start_tick)/(float)server_tickspeed();
/*vec2 curpos = calc_pos(pos, vel, -7.5f*server_tickspeed(), ct);*/
if(distance(players[snapping_client].pos, get_pos(ct)) > 1000.0f)
/*if(distance(players[snapping_client].pos, curpos) > 1000.0f) return;
return;*/
/* TODO: FIX ME */
NETOBJ_PROJECTILE *proj = (NETOBJ_PROJECTILE *)snap_new_item(NETOBJTYPE_PROJECTILE, id, sizeof(NETOBJ_PROJECTILE)); NETOBJ_PROJECTILE *proj = (NETOBJ_PROJECTILE *)snap_new_item(NETOBJTYPE_PROJECTILE, id, sizeof(NETOBJ_PROJECTILE));
fill_info(proj); fill_info(proj);
@ -564,7 +568,10 @@ void laser::reset()
void laser::tick() void laser::tick()
{ {
if(server_tick() > eval_tick+(server_tickspeed()*tuning.laser_bounce_delay)/1000.0f) if(server_tick() > eval_tick+(server_tickspeed()*tuning.laser_bounce_delay)/1000.0f)
{
create_sound(pos, SOUND_RIFLE_BOUNCE);
do_bounce(); do_bounce();
}
} }