diff options
| author | Magnus Auvinen <magnus.auvinen@gmail.com> | 2007-12-09 13:51:55 +0000 |
|---|---|---|
| committer | Magnus Auvinen <magnus.auvinen@gmail.com> | 2007-12-09 13:51:55 +0000 |
| commit | 808959328acbed8467fb8feb25341bb924dfd529 (patch) | |
| tree | a15b11a84518c7eee6676240171eed2a4f8c19b5 /src/game | |
| parent | 633612409700d56ac98c2a9448e79bf6701b508f (diff) | |
| download | zcatch-808959328acbed8467fb8feb25341bb924dfd529.tar.gz zcatch-808959328acbed8467fb8feb25341bb924dfd529.zip | |
fixed the shotgun spread
Diffstat (limited to 'src/game')
| -rw-r--r-- | src/game/client/game_client.cpp | 3 | ||||
| -rw-r--r-- | src/game/server/game_server.cpp | 11 |
2 files changed, 11 insertions, 3 deletions
diff --git a/src/game/client/game_client.cpp b/src/game/client/game_client.cpp index 25a9fdc4..32a98cc5 100644 --- a/src/game/client/game_client.cpp +++ b/src/game/client/game_client.cpp @@ -939,6 +939,9 @@ static void render_projectile(const obj_projectile *prev, const obj_projectile * // get positions float gravity = -400; + if(current->type != WEAPON_ROCKET) + gravity = -100; + float ct = (client_tick()-current->start_tick)/(float)SERVER_TICK_SPEED + client_intratick()*1/(float)SERVER_TICK_SPEED; vec2 startpos(current->x, current->y); vec2 startvel(current->vx, current->vy); diff --git a/src/game/server/game_server.cpp b/src/game/server/game_server.cpp index 02e58c88..0cfcb0c8 100644 --- a/src/game/server/game_server.cpp +++ b/src/game/server/game_server.cpp @@ -292,6 +292,9 @@ void projectile::reset() void projectile::tick() { float gravity = -400; + if(type != WEAPON_ROCKET) + gravity = -100; + float pt = (server_tick()-start_tick-1)/(float)SERVER_TICK_SPEED; float ct = (server_tick()-start_tick)/(float)SERVER_TICK_SPEED; vec2 prevpos = calc_pos(pos, vel, gravity, pt); @@ -802,14 +805,16 @@ int player::handle_weapons() int shotspread = 2; for(int i = -shotspread; i <= shotspread; i++) { + float spreading[] = {-0.12f, -0.05f, 0, 0.05f, 0.12f}; float a = get_angle(direction); - a += i*0.08f; + float v = 1.0f-fabs(i/(float)shotspread); + a += spreading[i+2]; new projectile(WEAPON_SHOTGUN, client_id, pos+vec2(0,0), - vec2(cosf(a), sinf(a))*25.0f, + vec2(cosf(a), sinf(a))*(30.0f + 15.0f*v), //vec2(cosf(a), sinf(a))*20.0f, - (int)(server_tickspeed()*0.4f), + (int)(server_tickspeed()*0.3f), this, 1, 0, 0, -1, WEAPON_SHOTGUN); } |