}
-typedef void (*mod_framegroupify_parsegroups_t) (unsigned int i, int start, int len, float fps, qboolean loop, void *pass);
+typedef void (*mod_framegroupify_parsegroups_t) (unsigned int i, int start, int len, float fps, qboolean loop, const char *name, void *pass);
int Mod_FrameGroupify_ParseGroups(const char *buf, mod_framegroupify_parsegroups_t cb, void *pass)
{
float fps;
unsigned int i;
qboolean loop;
+ char name[64];
bufptr = buf;
i = 0;
for(;;)
{
// an anim scene!
- if (!COM_ParseToken_Simple(&bufptr, true, false))
+
+ // REQUIRED: fetch start
+ if (!COM_ParseToken_Simple(&bufptr, true, false, true))
break;
if (!strcmp(com_token, "\n"))
continue; // empty line
start = atoi(com_token);
- if (!COM_ParseToken_Simple(&bufptr, true, false))
+
+ // REQUIRED: fetch length
+ if (!COM_ParseToken_Simple(&bufptr, true, false, true))
break;
if (!strcmp(com_token, "\n"))
{
continue;
}
len = atoi(com_token);
- if (!COM_ParseToken_Simple(&bufptr, true, false))
+
+ // OPTIONAL args start
+ if (!COM_ParseToken_Simple(&bufptr, true, false, true))
break;
- // we default to looping as it's usually wanted, so to NOT loop you append a 0
+
+ // OPTIONAL: fetch fps
+ fps = 20;
if (strcmp(com_token, "\n"))
{
fps = atof(com_token);
- if (!COM_ParseToken_Simple(&bufptr, true, false))
+ if (!COM_ParseToken_Simple(&bufptr, true, false, true))
break;
- if (strcmp(com_token, "\n"))
- loop = atoi(com_token) != 0;
- else
- loop = true;
}
- else
+
+ // OPTIONAL: fetch loopflag
+ loop = true;
+ if (strcmp(com_token, "\n"))
+ {
+ loop = (atoi(com_token) != 0);
+ if (!COM_ParseToken_Simple(&bufptr, true, false, true))
+ break;
+ }
+
+ // OPTIONAL: fetch name
+ name[0] = 0;
+ if (strcmp(com_token, "\n"))
{
- fps = 20;
- loop = true;
+ strlcpy(name, com_token, sizeof(name));
+ if (!COM_ParseToken_Simple(&bufptr, true, false, true))
+ break;
}
+ // OPTIONAL: remaining unsupported tokens (eat them)
+ while (strcmp(com_token, "\n"))
+ {
+ if (!COM_ParseToken_Simple(&bufptr, true, false, true))
+ {
+ bufptr = NULL;
+ break;
+ }
+ }
+ if(!bufptr)
+ break;
+
+ //Con_Printf("data: %d %d %d %f %d (%s)\n", i, start, len, fps, loop, name);
+
if(cb)
- cb(i, start, len, fps, loop, pass);
+ cb(i, start, len, fps, loop, (name[0] ? name : NULL), pass);
++i;
}
return i;
}
-void Mod_FrameGroupify_ParseGroups_Count (unsigned int i, int start, int len, float fps, qboolean loop, void *pass)
-{
- unsigned int *cnt = (unsigned int *) pass;
- ++*cnt;
-}
-
-void Mod_FrameGroupify_ParseGroups_Store (unsigned int i, int start, int len, float fps, qboolean loop, void *pass)
+static void Mod_FrameGroupify_ParseGroups_Store (unsigned int i, int start, int len, float fps, qboolean loop, const char *name, void *pass)
{
dp_model_t *mod = (dp_model_t *) pass;
animscene_t *anim = &mod->animscenes[i];
- dpsnprintf(anim->name, sizeof(anim[i].name), "groupified_%d_anim", i);
+ if(name)
+ strlcpy(anim->name, name, sizeof(anim[i].name));
+ else
+ dpsnprintf(anim->name, sizeof(anim[i].name), "groupified_%d_anim", i);
anim->firstframe = bound(0, start, mod->num_poses - 1);
anim->framecount = bound(1, len, mod->num_poses - anim->firstframe);
anim->framerate = max(1, fps);
extern cvar_t mod_q3shader_default_offsetmapping_bias;
extern cvar_t mod_q3shader_default_polygonoffset;
extern cvar_t mod_q3shader_default_polygonfactor;
+extern cvar_t mod_q3shader_force_addalpha;
void Mod_LoadQ3Shaders(void)
{
int j;
layer->blendfunc[0] = GL_ONE;
layer->blendfunc[1] = GL_ONE;
}
+ else if (!strcasecmp(parameter[1], "addalpha"))
+ {
+ layer->blendfunc[0] = GL_SRC_ALPHA;
+ layer->blendfunc[1] = GL_ONE;
+ }
else if (!strcasecmp(parameter[1], "filter"))
{
layer->blendfunc[0] = GL_DST_COLOR;
else if (!strcasecmp(parameter[k+1], "GL_DST_COLOR"))
layer->blendfunc[k] = GL_DST_COLOR;
else if (!strcasecmp(parameter[k+1], "GL_DST_ALPHA"))
- layer->blendfunc[k] = GL_ONE_MINUS_DST_ALPHA;
+ layer->blendfunc[k] = GL_DST_ALPHA;
else if (!strcasecmp(parameter[k+1], "GL_ONE_MINUS_SRC_COLOR"))
layer->blendfunc[k] = GL_ONE_MINUS_SRC_COLOR;
else if (!strcasecmp(parameter[k+1], "GL_ONE_MINUS_SRC_ALPHA"))
shader.textureblendalpha = true;
}
}
+
+ if(mod_q3shader_force_addalpha.integer)
+ {
+ // for a long while, DP treated GL_ONE GL_ONE as GL_SRC_ALPHA GL_ONE
+ // this cvar brings back this behaviour
+ if(layer->blendfunc[0] == GL_ONE && layer->blendfunc[1] == GL_ONE)
+ layer->blendfunc[0] = GL_SRC_ALPHA;
+ }
+
layer->texflags = 0;
if (layer->alphatest)
layer->texflags |= TEXF_ALPHA;