From cb49aacee1dd0d9d4f09a59b10542b73769b9715 Mon Sep 17 00:00:00 2001 From: Thomas White Date: Wed, 13 Aug 2008 12:09:23 +0100 Subject: Attempt to load model file again as collision model, but don't subdivide --- src/model.c | 15 +++++++++++++-- 1 file 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; -- cgit v1.2.3