diff --git a/source/src/md2.h b/source/src/md2.h index 37739fd2..f248fbc5 100644 --- a/source/src/md2.h +++ b/source/src/md2.h @@ -230,7 +230,7 @@ struct md2 : vertmodel void rendershadow(int anim, int varseed, float speed, int basetime, const vec &o, float yaw, modelattach *a) { parts[0]->rendershadow(anim, varseed, speed, basetime, o, yaw); - if(a) for(int i = 0; a[i].name; i++) + if(a) for(int i = 0; a[i].tag; i++) { vertmodel *m = (vertmodel *)a[i].m; if(!m) continue; diff --git a/source/src/md3.h b/source/src/md3.h index 6adf1e9e..204f945f 100644 --- a/source/src/md3.h +++ b/source/src/md3.h @@ -158,7 +158,7 @@ struct md3 : vertmodel if(a) for(int i = 0; a[i].tag; i++) { vertmodel *m = (vertmodel *)a[i].m; - if(!m || !a[i].name) + if(!m) { if(a[i].pos) link(NULL, a[i].tag); continue; diff --git a/source/src/model.h b/source/src/model.h index 2b03e89e..84a0bfc0 100644 --- a/source/src/model.h +++ b/source/src/model.h @@ -32,9 +32,9 @@ struct modelattach vec *pos; model *m; - modelattach() : tag(NULL), name(NULL), pos(NULL) {} - modelattach(const char *tag, const char *name) : tag(tag), name(name), pos(NULL) {} - modelattach(const char *tag, vec *pos) : tag(tag), name(NULL), pos(pos) {} + modelattach() : tag(NULL), name(NULL), pos(NULL), m(NULL) {} + modelattach(const char *tag, const char *name) : tag(tag), name(name), pos(NULL), m(NULL) {} + modelattach(const char *tag, vec *pos) : tag(tag), name(NULL), pos(pos), m(NULL) {} }; struct dynent; diff --git a/source/src/rendermodel.cpp b/source/src/rendermodel.cpp index 8a822270..23daae5e 100644 --- a/source/src/rendermodel.cpp +++ b/source/src/rendermodel.cpp @@ -356,7 +356,7 @@ void rendermodel(const char *mdl, int anim, int tex, float rad, const vec &o, fl if(a) for(int i = 0; a[i].tag; i++) { - a[i].m = a[i].name ? loadmodel(a[i].name) : NULL; + if(a[i].name) a[i].m = loadmodel(a[i].name); //if(a[i].m && a[i].m->type()!=m->type()) a[i].m = NULL; }