[Change] Tweaked the rumble system a little.

This commit is contained in:
Allanis 2014-05-17 13:11:11 +01:00
parent 3232d35cfe
commit 31ec890d3e
3 changed files with 17 additions and 15 deletions

View File

@ -409,7 +409,7 @@
<gfx_store>afterburner</gfx_store> <gfx_store>afterburner</gfx_store>
</general> </general>
<specific type="afterburner"> <specific type="afterburner">
<rumble>30</rumble> <rumble>0.5</rumble>
<sound>afterburner</sound> <sound>afterburner</sound>
<thrust_perc>100</thrust_perc> <thrust_perc>100</thrust_perc>
<thrust_abs>50</thrust_abs> <thrust_abs>50</thrust_abs>
@ -428,7 +428,7 @@
<gfx_store>afterburner2</gfx_store> <gfx_store>afterburner2</gfx_store>
</general> </general>
<specific type="afterburner"> <specific type="afterburner">
<rumble>50</rumble> <rumble>0.9</rumble>
<sound>afterburner</sound> <sound>afterburner</sound>
<thrust_perc>185</thrust_perc> <thrust_perc>185</thrust_perc>
<thrust_abs>100</thrust_abs> <thrust_abs>100</thrust_abs>

View File

@ -457,16 +457,15 @@ void pilot_hit(Pilot* p, const Solid* w, const unsigned int shooter,
dam_mod = damage_armour / p->armour_max; dam_mod = damage_armour / p->armour_max;
if(p->id == PLAYER_ID) /* Shake us up a bit. */ if(p->id == PLAYER_ID) /* Shake us up a bit. */
spfx_shake(dam_mod*100.); spfx_shake(SHAKE_MAX*dam_mod);
} }
} }
if(shooter != 0) /* Knock back effect is dependent on both damage and mass of the weapon. */
/* Knock back effect is dependent on both damage and mass of the weapon. */ /* should probably turn it into a partial conservative collision.. */
/* should probably turn it into a partial conservative collision.. */ vect_cadd(&p->solid->vel,
vect_cadd(&p->solid->vel, knockback * (w->vel.x * (dam_mod/6. + w->mass/p->solid->mass/6.)),
knockback * (w->vel.x * (dam_mod/6. + w->mass/p->solid->mass/6.)), knockback * (w->vel.y * (dam_mod/6. + w->mass/p->solid->mass/6.)));
knockback * (w->vel.y * (dam_mod/6. + w->mass/p->solid->mass/6.)));
} }
/** /**
@ -670,12 +669,15 @@ void pilot_explode(double x, double y, double radius,
/* Pilot is hit. */ /* Pilot is hit. */
if(dist < rad2) { if(dist < rad2) {
/* Impact settings. */ /* Impact settings. */
s.mass = (rad2 - dist) / 10.; s.mass = pow2(damage) * sqrt(rad2 - dist) / 30.;
s.vel.x = rx; s.vel.x = rx;
s.vel.y = ry; s.vel.y = ry;
/* Actual damage calculations. */ /* Actual damage calculations. */
pilot_hit(p, &s, parent, dtype, damage); pilot_hit(p, &s, parent, dtype, damage);
/* Shock wave from the explosion. */
spfx_shake(pow2(damage) / pow2(100.) * SHAKE_MAX);
} }
} }
} }
@ -822,7 +824,8 @@ static void pilot_update(Pilot* pilot, const double dt) {
pilot->speed * pilot->afterburner->outfit->u.afb.speed_perc + pilot->speed * pilot->afterburner->outfit->u.afb.speed_perc +
pilot->afterburner->outfit->u.afb.speed_abs, dt); pilot->afterburner->outfit->u.afb.speed_abs, dt);
if(pilot->id == PLAYER_ID) if(pilot->id == PLAYER_ID)
spfx_shake(SHAKE_DECAY*0.75 * dt); /* Shake goes down at half speed. */ spfx_shake(0.75*SHAKE_DECAY*dt); /* Shake goes down at half speed. */
pilot->energy -= pilot->afterburner->outfit->u.afb.energy * dt; /* Energy loss. */ pilot->energy -= pilot->afterburner->outfit->u.afb.energy * dt; /* Energy loss. */
} else /* Normal limit. */ } else /* Normal limit. */
limit_speed(&pilot->solid->vel, pilot->speed, dt); limit_speed(&pilot->solid->vel, pilot->speed, dt);

View File

@ -17,8 +17,7 @@
#define SPFX_GFX "../gfx/spfx/" /**< Graphics location. */ #define SPFX_GFX "../gfx/spfx/" /**< Graphics location. */
#define SPFX_CHUNK 32 /**< Chunk to allocate when needed. */ #define SPFX_CHUNK 32 /**< Chunk to allocate when needed. */
#define SHAKE_VEL_MOD 0.0006 /**< Shake modifier. */ #define SHAKE_VEL_MOD 0.0008 /**< Shake modifier. */
#define SHAKE_MOD_FACTOR 0.2 /**< Shake modifier factor. */
/* Special hardcoded effects.. */ /* Special hardcoded effects.. */
@ -343,7 +342,7 @@ void spfx_start(const double dt) {
-VANGLE(shake_pos) + (RNGF()-0.5) * M_PI); -VANGLE(shake_pos) + (RNGF()-0.5) * M_PI);
} }
/* The shake decays over time. */ /* The shake decays over time. */
shake_rad -= SHAKE_DECAY * dt * SHAKE_MOD_FACTOR; shake_rad -= SHAKE_DECAY * dt;
if(shake_rad < 0.) shake_rad = 0.; if(shake_rad < 0.) shake_rad = 0.;
x = shake_pos.x; x = shake_pos.x;
@ -369,7 +368,7 @@ void spfx_start(const double dt) {
* @param mod Modifier to increase levely by. * @param mod Modifier to increase levely by.
*/ */
void spfx_shake(double mod) { void spfx_shake(double mod) {
shake_rad += mod*SHAKE_MOD_FACTOR; shake_rad += mod;
if(shake_rad > SHAKE_MAX) shake_rad = SHAKE_MAX; if(shake_rad > SHAKE_MAX) shake_rad = SHAKE_MAX;
shake_off = 0; shake_off = 0;