aboutsummaryrefslogtreecommitdiff
path: root/src
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
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')
-rw-r--r--src/main.c1
-rw-r--r--src/physics.c12
-rw-r--r--src/render.c4
3 files changed, 14 insertions, 3 deletions
diff --git a/src/main.c b/src/main.c
index 27589f4..7b022fd 100644
--- a/src/main.c
+++ b/src/main.c
@@ -241,7 +241,6 @@ int main(int argc, char *argv[]) {
game->t_fps = t;
game->frames = 0;
}
- game->radiation = game->fps / 40.0;
/* Sleep for a bit to avoid hogging the CPU.
* This is a fudge - ideally this delay would adapt so that the CPU is not hogged when the GPU is the
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;
diff --git a/src/render.c b/src/render.c
index e18b3a6..3f651c6 100644
--- a/src/render.c
+++ b/src/render.c
@@ -585,8 +585,8 @@ static void render_draw_2d(RenderContext *r, Game *game) {
glVertex2f(-1.0, -0.8); /* Bottom left */
glVertex2f(-0.9, -0.8); /* Bottom right */
glColor4f(0.8, cg, 0.0, PANEL_ALPHA);
- glVertex2f(-0.9, -0.8+(1.8*game->radiation)); /* Top right */
- glVertex2f(-1.0, -0.8+(1.8*game->radiation)); /* Top left */
+ glVertex2f(-0.9, -0.8+(1.7*game->radiation)); /* Top right */
+ glVertex2f(-1.0, -0.8+(1.7*game->radiation)); /* Top left */
glEnd();
/* Fuel symbol */