aboutsummaryrefslogtreecommitdiff
path: root/src/physics.c
diff options
context:
space:
mode:
authorweiss <weiss@84d2e878-0bd5-11dd-ad15-13eda11d74c5>2008-07-19 14:18:21 +0000
committerweiss <weiss@84d2e878-0bd5-11dd-ad15-13eda11d74c5>2008-07-19 14:18:21 +0000
commitea9080c5043c3754fc418a73c73fbacfb8218861 (patch)
treeaaf95ad3b808d358bfb9dd5e87118e9e48afad61 /src/physics.c
parent36959697e257081cccce666d1654e57efbfa3a63 (diff)
Radiation stuff
git-svn-id: svn://cook.msm.cam.ac.uk:745/thrust3d/thrust3d@147 84d2e878-0bd5-11dd-ad15-13eda11d74c5
Diffstat (limited to 'src/physics.c')
-rw-r--r--src/physics.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/physics.c b/src/physics.c
index 8352e84..7e9f559 100644
--- a/src/physics.c
+++ b/src/physics.c
@@ -322,10 +322,18 @@ static void physics_process(ModelInstance *obj, Uint32 dt, Game *game) {
obj->yawspeed = 0.0;
if ( strcmp(coll.obj->model->name, "platform") == 0 ) {
+
+ /* Landed on a platform */
obj->recharging = 1;
game->platform_rel_x = coll.obj->x - obj->x;
game->platform_rel_y = coll.obj->y - obj->y;
game->time_of_landing_event = game->tlast + sttc;
+
+ } else {
+
+ /* Landed on something that isn't safe */
+ game->radiation = 1.0;
+
}
} else {
@@ -367,12 +375,16 @@ void physics_step(Game *game, Uint32 t) {
game->lander->vz += THRUST * dt;
game->fuel -= 0.0002;
game->lander->landed = 0;
+ game->radiation = 0.1;
if ( game->lander->recharging ) {
game->time_of_landing_event = game->tlast + dt;
game->lander->recharging = 0;
}
}
}
+ if ( (game->radiation > 0.3) && (game->fuel > 0.0) ) {
+ game->fuel -= 0.01*game->radiation;
+ }
if ( game->lander->recharging ) {
game->fuel += 0.0005;
if ( game->fuel > 1.0 ) game->fuel = 1.0;