diff options
Diffstat (limited to 'src/model.c')
-rw-r--r-- | src/model.c | 15 |
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; |