mirror of
https://github.com/ZDoom/raze-gles.git
synced 2024-11-10 23:02:03 +00:00
Fix for crash with MD2s that only have an internal skin filename instead of something set in the defs
git-svn-id: https://svn.eduke32.com/eduke32@265 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
parent
ea72e474a0
commit
65450800b0
1 changed files with 20 additions and 5 deletions
|
@ -56,10 +56,10 @@ typedef struct
|
||||||
} md2frame_t;
|
} md2frame_t;
|
||||||
|
|
||||||
typedef struct { short u, v; } md2uv_t;
|
typedef struct { short u, v; } md2uv_t;
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
unsigned short v[3];
|
unsigned short v[3];
|
||||||
unsigned short u[3];
|
unsigned short u[3];
|
||||||
} md2tri_t;
|
} md2tri_t;
|
||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
|
@ -934,7 +934,7 @@ if ((head.id != 0x32504449) || (head.vers != 8)) { free(m); return(0); } //"IDP2
|
||||||
if ((st[i] == '/') || (st[i] == '\\')) { i++; break; }
|
if ((st[i] == '/') || (st[i] == '\\')) { i++; break; }
|
||||||
if (i<0) i=0;
|
if (i<0) i=0;
|
||||||
st[i] = 0;
|
st[i] = 0;
|
||||||
m->basepath = (char *)malloc(i+1); if (!m->basepath) { free(m->uv); free(m->tris); free(m->glcmds); free(m->frames); free(m); return(0); }
|
m->basepath = (char *)malloc(i+1); if (!m->basepath) { free(m->uv); free(m->tris); free(m->glcmds); free(m->frames); free(m); return(0); }
|
||||||
strcpy(m->basepath, st);
|
strcpy(m->basepath, st);
|
||||||
|
|
||||||
m->skinfn = (char *)calloc(m->numskins,64); if (!m->skinfn) { free(m->basepath); free(m->uv); free(m->tris); free(m->glcmds); free(m->frames); free(m); return(0); }
|
m->skinfn = (char *)calloc(m->numskins,64); if (!m->skinfn) { free(m->basepath); free(m->uv); free(m->tris); free(m->glcmds); free(m->frames); free(m); return(0); }
|
||||||
|
@ -1030,6 +1030,21 @@ if ((head.id != 0x32504449) || (head.vers != 8)) { free(m); return(0); } //"IDP2
|
||||||
}
|
}
|
||||||
//OSD_Printf("Finished md3 conversion.\n");
|
//OSD_Printf("Finished md3 conversion.\n");
|
||||||
|
|
||||||
|
{
|
||||||
|
mdskinmap_t *sk;
|
||||||
|
|
||||||
|
sk = (mdskinmap_t *)calloc(1,sizeof(mdskinmap_t));
|
||||||
|
sk->palette = 0;
|
||||||
|
sk->skinnum = 0;
|
||||||
|
sk->surfnum = 0;
|
||||||
|
|
||||||
|
sk->fn = (char *)malloc(strlen(m->basepath)+strlen(m->skinfn)+1);
|
||||||
|
strcpy(sk->fn, m->basepath);
|
||||||
|
strcat(sk->fn, m->skinfn);
|
||||||
|
|
||||||
|
m3->skinmap = sk;
|
||||||
|
}
|
||||||
|
|
||||||
// die MD2 ! DIE !
|
// die MD2 ! DIE !
|
||||||
free(m->texid); free(m->skinfn); free(m->basepath); free(m->uv); free(m->tris); free(m->glcmds); free(m->frames); free(m);
|
free(m->texid); free(m->skinfn); free(m->basepath); free(m->uv); free(m->tris); free(m->glcmds); free(m->frames); free(m);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue