aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas White <weiss@jade.(none)>2008-08-13 12:09:23 +0100
committerThomas White <weiss@jade.(none)>2008-08-13 12:42:09 +0100
commitcb49aacee1dd0d9d4f09a59b10542b73769b9715 (patch)
tree17eff0a7388cb33f325d5de951c45bd9215c608f
parent877a8718f419efe6bfef4ba248741c1233e22a1d (diff)
Attempt to load model file again as collision model, but don't subdivide
-rw-r--r--src/model.c15
1 files changed, 13 insertions, 2 deletions
diff --git a/src/model.c b/src/model.c
index 8abbc42..5c12f0e 100644
--- a/src/model.c
+++ b/src/model.c
@@ -233,7 +233,18 @@ static int model_load(ModelContext *ctx, const char *name, RenderContext *render
}
fh = fopen(tmp, "r");
if ( fh == NULL ) {
- return -1;
+ if ( coll ) {
+ /* Couldn't open a collision model with name -coll.
+ * Try again using the original model */
+ snprintf(tmp, 63, "%s/models/%s", DATADIR, name);
+ fh = fopen(tmp, "r");
+ if ( fh == NULL ) {
+ return 1;
+ }
+ subdiv = 0;
+ } else {
+ return 1;
+ }
}
if ( coll ) {
model->num_coll_primitives = 0;
@@ -324,7 +335,7 @@ static int model_load(ModelContext *ctx, const char *name, RenderContext *render
}
/* Subdivide the previous face if requested */
- if ( !coll && subdiv && (sscanf(line, "subdivide %f %f", &x, &y) == 2) ) {
+ if ( subdiv && (sscanf(line, "subdivide %f %f", &x, &y) == 2) ) {
if ( type == PRIMITIVE_QUADS ) {
if ( (num_vertices > 0) && ((num_vertices % 4)==0) ) {
GLfloat u, v;