aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorweiss <weiss@84d2e878-0bd5-11dd-ad15-13eda11d74c5>2008-07-19 15:48:50 +0000
committerweiss <weiss@84d2e878-0bd5-11dd-ad15-13eda11d74c5>2008-07-19 15:48:50 +0000
commit186c710a5c9cb404432f8584727ee8a00c5c6977 (patch)
tree0e257cee3dba5ebc618bcac4f9130413349522cb /src
parent53a688c006e037269a32681283db86e9724606a9 (diff)
Lower 'clang' volume depending on speed of collision
Clang when hitting the floor as well git-svn-id: svn://cook.msm.cam.ac.uk:745/thrust3d/thrust3d@150 84d2e878-0bd5-11dd-ad15-13eda11d74c5
Diffstat (limited to 'src')
-rw-r--r--src/physics.c18
1 files changed, 11 insertions, 7 deletions
diff --git a/src/physics.c b/src/physics.c
index 8838889..3c7f2e0 100644
--- a/src/physics.c
+++ b/src/physics.c
@@ -315,11 +315,6 @@ static void physics_process(ModelInstance *obj, Uint32 dt, Game *game) {
if ( (coll.nx==0) && (coll.ny==0) && (coll.nz==1.0) ) {
/* Yes - land (already moved to this position */
- obj->landed = 1;
- obj->vx = 0.0;
- obj->vy = 0.0;
- obj->vz = 0.0;
- obj->yawspeed = 0.0;
if ( strcmp(coll.obj->model->name, "platform") == 0 ) {
@@ -332,14 +327,23 @@ static void physics_process(ModelInstance *obj, Uint32 dt, Game *game) {
} else {
/* Landed on something that isn't safe */
+ double modv = sqrt(obj->vx*obj->vx + obj->vy*obj->vy + obj->vz*obj->vz);
+ audio_play(game->audio, "clang", modv/0.01, 0);
game->radiation = 1.0;
}
+ obj->landed = 1;
+ obj->vx = 0.0;
+ obj->vy = 0.0;
+ obj->vz = 0.0;
+ obj->yawspeed = 0.0;
+
} else {
/* No - bounce */
- audio_play(game->audio, "clang", 1.0, 0);
+ double modv = sqrt(obj->vx*obj->vx + obj->vy*obj->vy + obj->vz*obj->vz);
+ audio_play(game->audio, "clang", modv/0.01, 0);
obj->vx = -obj->vx;
obj->vy = -obj->vy;
obj->vz = -obj->vz;
@@ -387,7 +391,7 @@ void physics_step(Game *game, Uint32 t) {
game->fuel -= 0.01*game->radiation;
}
if ( game->lander->recharging ) {
- game->fuel += 0.0005;
+ game->fuel += 0.001;
}
/* Compensate for laziness elsewhere */