summaryrefslogtreecommitdiffstats
path: root/player.c
diff options
context:
space:
mode:
Diffstat (limited to 'player.c')
-rw-r--r--player.c45
1 files changed, 40 insertions, 5 deletions
diff --git a/player.c b/player.c
index e5b0fdf..7250009 100644
--- a/player.c
+++ b/player.c
@@ -20,6 +20,7 @@ float rotxspeed = 0, rotyspeed = 0;
float objrot = 0;
extern LEVEL level;
+extern LIGHT light;
void MouseInput(int x, int y) {
roty += x * 0.3;
@@ -188,12 +189,12 @@ void DoInput(int delta) {
player.rotysin = s;
player.rotycos = c;
- for(i = 0; i < level.rooms[player.room].nObjects; i++) {
- pos = VectorSub(level.rooms[player.room].objects[i].pos, player.pos);
+ for(i = 0; i < level.rooms[player.room].nThings; i++) {
+ pos = VectorSub(level.rooms[player.room].things[i].pos, player.pos);
pos.y += 0.9;
- switch(level.rooms[player.room].objects[i].type) {
- case OBJECT_MEDIPAK100:
- if((pos.x*pos.x + (pos.y*pos.y)/3 + pos.z*pos.z) < 0.36) level.rooms[player.room].objects[i].visible = 0;
+ switch(level.rooms[player.room].things[i].type) {
+ case THING_MEDIPAK100:
+ if((pos.x*pos.x + (pos.y*pos.y)/3 + pos.z*pos.z) < 0.36) level.rooms[player.room].things[i].visible = 0;
}
}
@@ -212,4 +213,38 @@ void DoInput(int delta) {
}
else level.rooms[player.room].gateinfo[i].timer -= delta;
}
+
+ static int lightpos = 0;
+
+ lightpos += delta;
+ lightpos %= 24000;
+
+ if(lightpos < 12000) i = lightpos;
+ else i = 24000 - lightpos;
+
+ if(i == 0) {
+ light.pos.x = 0.0;
+ light.pos.y = 0.0;
+ light.pos.z = 0.0;
+ }
+ else if(i < 4000) {
+ light.pos.x = 0.0;
+ light.pos.y = 0.0;
+ light.pos.z = -i * 0.001;
+ }
+ else if(i < 8000) {
+ light.pos.x = (i-4000) * 0.001;
+ light.pos.y = 0.0;
+ light.pos.z = -4.0;
+ }
+ else if(i < 12000) {
+ light.pos.x = 4.0;
+ light.pos.y = 0.0;
+ light.pos.z = -4.0 - (i-8000) * 0.001;
+ }
+ else {
+ light.pos.x = 4.0;
+ light.pos.y = 0.0;
+ light.pos.z = -8.0;
+ }
}