diff options
author | neoraider <devnull@localhost> | 2006-10-20 14:57:05 +0200 |
---|---|---|
committer | neoraider <devnull@localhost> | 2006-10-20 14:57:05 +0200 |
commit | 79801b6b794a5fb50a3a013354323a48de37c050 (patch) | |
tree | 3e97322cb1ea3aa6206b6f420a9c67ceca3d9c81 /player.c | |
parent | 05f9b1d15c237e89176cc2b207454f0f30073d57 (diff) | |
download | libzoom-79801b6b794a5fb50a3a013354323a48de37c050.tar libzoom-79801b6b794a5fb50a3a013354323a48de37c050.zip |
Physik-Engine angefangen.
Lightmaps implementiert.
Diffstat (limited to 'player.c')
-rw-r--r-- | player.c | 45 |
1 files changed, 40 insertions, 5 deletions
@@ -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; + } } |