diff options
author | Tomasz Kramkowski <tk@the-tk.com> | 2018-05-02 21:17:53 +0100 |
---|---|---|
committer | Tomasz Kramkowski <tk@the-tk.com> | 2018-05-02 21:17:53 +0100 |
commit | 6ef3557675c4c19103d927b3533e14f941f91a85 (patch) | |
tree | 39c26fde01d8458c44c39c2a7b9b9ebb6120c445 | |
parent | 3c1b90a736e3958a9f0545f04b1af7fc00b74b4e (diff) | |
download | faqe-6ef3557675c4c19103d927b3533e14f941f91a85.tar.gz faqe-6ef3557675c4c19103d927b3533e14f941f91a85.tar.xz faqe-6ef3557675c4c19103d927b3533e14f941f91a85.zip |
fmd.c: Correct bugs in implementation
Materials are now loaded correctly.
Material indices should be loaded with 0xffffffff being -1.
-rw-r--r-- | fmd.c | 6 |
1 files changed, 4 insertions, 2 deletions
@@ -84,7 +84,7 @@ void fmd_load(struct fmd *fmd, FILE *f) ret = fread(*m, len, 1, f); assert(ret == 1); - *m[len] = '\0'; + (*m)[len] = '\0'; } fmd->nmeshes = betoul(f); @@ -94,7 +94,9 @@ void fmd_load(struct fmd *fmd, FILE *f) fmd->meshes = NULL; for (int i = 0; i < fmd->nmeshes; i++) { struct fmd_mesh *m = &fmd->meshes[i]; - m->midx = betoul(f); + unsigned long midx; + midx = betoul(f); + m->midx = midx == 0xffffffff ? -1 : (int)midx; m->tidx = betoul(f); m->tcnt = betoul(f); } |