summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--level.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/level.c b/level.c
index 0d22f64..9118499 100644
--- a/level.c
+++ b/level.c
@@ -270,11 +270,19 @@ LEVEL *LoadLevel(char *filename) {
}
}
}
+
v = VectorCross(
VectorSub(level->rooms[i].walls[j].vertices[1], level->rooms[i].walls[j].vertices[0]),
VectorSub(level->rooms[i].walls[j].vertices[2], level->rooms[i].walls[j].vertices[0])
);
- if(VectorLengthSq(v)) level->rooms[i].walls[j].normal = VectorNormalize(v);
+ if(VectorLengthSq(v) > 0.0) {
+ level->rooms[i].walls[j].normal = VectorNormalize(v);
+
+ for(k = 0; k < 3; k++) {
+ if(VectorLengthSq(level->rooms[i].walls[j].normals[k]) == 0.0)
+ level->rooms[i].walls[j].normals[k] = level->rooms[i].walls[j].normal;
+ }
+ }
j++;
}