From b49d45860ccf831906d99bfc660a063e646a0b28 Mon Sep 17 00:00:00 2001 From: divverent Date: Sat, 13 Mar 2010 18:27:09 +0000 Subject: [PATCH] modeldecompile: also write a framegroups file if possible git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@10053 d7cf8633-e32d-0410-b094-e92efae38249 --- model_alias.c | 6 +++--- model_iqm.h | 3 +++ model_shared.c | 13 +++++++++++-- 3 files changed, 17 insertions(+), 5 deletions(-) diff --git a/model_alias.c b/model_alias.c index 9d820706..1bb43e4e 100644 --- a/model_alias.c +++ b/model_alias.c @@ -3010,7 +3010,7 @@ void Mod_PSKMODEL_Load(dp_model_t *mod, void *buffer, void *bufferend) loadmodel->animscenes[i].firstframe = i; loadmodel->animscenes[i].framecount = 1; loadmodel->animscenes[i].loop = true; - loadmodel->animscenes[i].framerate = 10; + loadmodel->animscenes[i].framerate = anims[index].fps; } } @@ -3287,8 +3287,8 @@ void Mod_INTERQUAKEMODEL_Load(dp_model_t *mod, void *buffer, void *bufferend) dpsnprintf(loadmodel->animscenes[j].name, sizeof(loadmodel->animscenes[i].name), "%s_%d", &text[anim[i].name], j - anim[i].first_frame); loadmodel->animscenes[j].firstframe = j; loadmodel->animscenes[j].framecount = 1; - loadmodel->animscenes[j].loop = true; - loadmodel->animscenes[j].framerate = 10; + loadmodel->animscenes[i].loop = ((anim[i].flags & IQM_LOOP) != 0); + loadmodel->animscenes[j].framerate = anim[i].framerate; } } diff --git a/model_iqm.h b/model_iqm.h index 78197162..c9222a55 100644 --- a/model_iqm.h +++ b/model_iqm.h @@ -48,6 +48,9 @@ iqmmesh_t; #define IQM_FLOAT 7 #define IQM_DOUBLE 8 +// animflags +#define IQM_LOOP 1 + typedef struct iqmtriangle_s { unsigned int vertex[3]; diff --git a/model_shared.c b/model_shared.c index 71ae765d..aada4088 100644 --- a/model_shared.c +++ b/model_shared.c @@ -2948,8 +2948,10 @@ static void Mod_Decompile_f(void) char animname2[MAX_QPATH]; char zymtextbuffer[16384]; char dpmtextbuffer[16384]; + char framegroupstextbuffer[16384]; int zymtextsize = 0; int dpmtextsize = 0; + int framegroupstextsize = 0; if (Cmd_Argc() != 2) { @@ -3037,19 +3039,26 @@ static void Mod_Decompile_f(void) Mod_Decompile_SMD(mod, outname, first, count, false); if (zymtextsize < (int)sizeof(zymtextbuffer) - 100) { - l = dpsnprintf(zymtextbuffer + zymtextsize, sizeof(zymtextbuffer) - zymtextsize, "scene %s.smd fps %g\n", animname, mod->animscenes[i].framerate); + l = dpsnprintf(zymtextbuffer + zymtextsize, sizeof(zymtextbuffer) - zymtextsize, "scene %s.smd fps %g %s\n", animname, mod->animscenes[i].framerate, mod->animscenes[i].loop ? "" : " noloop"); if (l > 0) zymtextsize += l; } if (dpmtextsize < (int)sizeof(dpmtextbuffer) - 100) { - l = dpsnprintf(dpmtextbuffer + dpmtextsize, sizeof(dpmtextbuffer) - dpmtextsize, "scene %s.smd\n", animname); + l = dpsnprintf(dpmtextbuffer + dpmtextsize, sizeof(dpmtextbuffer) - dpmtextsize, "scene %s.smd fps %g %s\n", animname, mod->animscenes[i].framerate, mod->animscenes[i].loop ? "" : " noloop"); if (l > 0) dpmtextsize += l; } + if (framegroupstextsize < (int)sizeof(framegroupstextbuffer) - 100) + { + l = dpsnprintf(framegroupstextbuffer + framegroupstextsize, sizeof(framegroupstextbuffer) - framegroupstextsize, "%d %d %f %d // %s\n", first, count, mod->animscenes[i].framerate, mod->animscenes[i].loop, animname); + if (l > 0) framegroupstextsize += l; + } } if (zymtextsize) FS_WriteFile(va("%s_decompiled/out_zym.txt", basename), zymtextbuffer, (fs_offset_t)zymtextsize); if (dpmtextsize) FS_WriteFile(va("%s_decompiled/out_dpm.txt", basename), dpmtextbuffer, (fs_offset_t)dpmtextsize); + if (framegroupstextsize) + FS_WriteFile(va("%s_decompiled.framegroups", basename), framegroupstextbuffer, (fs_offset_t)framegroupstextsize); } } -- 2.39.2