X-Git-Url: http://git.xonotic.org/?a=blobdiff_plain;f=model_brush.c;h=ce195bd2f9078a3c62f2e193346e20b121e2220f;hb=97aa709c0a3e5a4374b24a638c14b01f3c8095c6;hp=6fd45ee75de43255a498c09a61b574287a017fc3;hpb=fa20f76c173d9513a1e5543f840e008324ed71aa;p=xonotic%2Fdarkplaces.git diff --git a/model_brush.c b/model_brush.c index 6fd45ee7..ce195bd2 100644 --- a/model_brush.c +++ b/model_brush.c @@ -1904,6 +1904,12 @@ static void Mod_Q1BSP_LoadTextures(sizebuf_t *sb) tx = loadmodel->data_textures + i; if (!tx || tx->name[0] != '+' || tx->name[1] == 0 || tx->name[2] == 0) continue; + num = tx->name[1]; + if ((num < '0' || num > '9') && (num < 'a' || num > 'j')) + { + Con_Printf("Bad animating texture %s\n", tx->name); + continue; + } if (tx->anim_total[0] || tx->anim_total[1]) continue; // already sequenced @@ -1922,8 +1928,7 @@ static void Mod_Q1BSP_LoadTextures(sizebuf_t *sb) anims[num - '0'] = tx2; else if (num >= 'a' && num <= 'j') altanims[num - 'a'] = tx2; - else - Con_Printf("Bad animating texture %s\n", tx->name); + // No need to warn otherwise - we already did above. } max = altmax = 0; @@ -1956,6 +1961,12 @@ static void Mod_Q1BSP_LoadTextures(sizebuf_t *sb) if (incomplete) continue; + // If we have exactly one frame, something's wrong. + if (max + altmax <= 1) + { + Con_Printf("Texture %s is animated (leading +) but has only one frame\n", tx->name); + } + if (altmax < 1) { // if there is no alternate animation, duplicate the primary @@ -1965,6 +1976,18 @@ static void Mod_Q1BSP_LoadTextures(sizebuf_t *sb) altanims[k] = anims[k]; } + if (max < 1) + { + // Warn. + Con_Printf("Missing frame 0 of %s\n", tx->name); + + // however, we can handle this by duplicating the alternate animation into the primary + max = altmax; + for (k = 0;k < 10;k++) + anims[k] = altanims[k]; + } + + // link together the primary animation for (j = 0;j < max;j++) { @@ -4417,6 +4440,7 @@ static void Mod_Q2BSP_LoadTexinfo(sizebuf_t *sb) { int j; texture_t *t = loadmodel->data_textures + out->textureindex; + t->currentframe = t; // fix the reallocated pointer // if this is not animated, skip it // if this is already processed, skip it (part of an existing sequence)