+ else if (currentrenderentity->colormap >= 0 || !skinframe->merged || skinframe->glow || !r_quickmodels.integer)
+ {
+ R_SetupMDLMD2Frames(1 - fog, 1 - fog, 1 - fog);
+
+ memset(&aliasmeshinfo, 0, sizeof(aliasmeshinfo));
+
+ aliasmeshinfo.vertex = aliasvert;
+ aliasmeshinfo.vertexstep = sizeof(float[4]);
+ aliasmeshinfo.numverts = model->numverts;
+ aliasmeshinfo.numtriangles = model->numtris;
+ aliasmeshinfo.index = model->mdlmd2data_indices;
+ aliasmeshinfo.colorstep = sizeof(float[4]);
+ aliasmeshinfo.texcoords[0] = model->mdlmd2data_texcoords;
+ aliasmeshinfo.texcoordstep[0] = sizeof(float[2]);
+
+ if (currentrenderentity->effects & EF_ADDITIVE)
+ {
+ aliasmeshinfo.transparent = true;
+ aliasmeshinfo.blendfunc1 = GL_SRC_ALPHA;
+ aliasmeshinfo.blendfunc2 = GL_ONE;
+ }
+ else if (currentrenderentity->alpha != 1.0 || skinframe->fog != NULL)
+ {
+ aliasmeshinfo.transparent = true;
+ aliasmeshinfo.blendfunc1 = GL_SRC_ALPHA;
+ aliasmeshinfo.blendfunc2 = GL_ONE_MINUS_SRC_ALPHA;
+ }
+ else
+ {
+ aliasmeshinfo.transparent = false;
+ aliasmeshinfo.blendfunc1 = GL_ONE;
+ aliasmeshinfo.blendfunc2 = GL_ZERO;
+ }
+
+ if (skinframe->base || skinframe->pants || skinframe->shirt || skinframe->glow || skinframe->merged)
+ {
+ if (currentrenderentity->colormap >= 0 && (skinframe->base || skinframe->pants || skinframe->shirt))
+ {
+ int c;
+ qbyte *color;
+ if (skinframe->base)
+ R_DrawModelMesh(skinframe->base, aliasvertcolor, 0, 0, 0);
+ if (skinframe->pants)
+ {
+ c = (currentrenderentity->colormap & 0xF) << 4;c += (c >= 128 && c < 224) ? 4 : 12; // 128-224 are backwards ranges
+ color = (qbyte *) (&d_8to24table[c]);
+ if (c >= 224) // fullbright ranges
+ R_DrawModelMesh(skinframe->pants, NULL, color[0] * (1.0f / 255.0f), color[1] * (1.0f / 255.0f), color[2] * (1.0f / 255.0f));
+ else
+ {
+ R_TintModel(aliasvertcolor, aliasvertcolor2, model->numverts, color[0] * (1.0f / 255.0f), color[1] * (1.0f / 255.0f), color[2] * (1.0f / 255.0f));
+ R_DrawModelMesh(skinframe->pants, aliasvertcolor2, 0, 0, 0);
+ }
+ }
+ if (skinframe->shirt)
+ {
+ c = currentrenderentity->colormap & 0xF0 ;c += (c >= 128 && c < 224) ? 4 : 12; // 128-224 are backwards ranges
+ color = (qbyte *) (&d_8to24table[c]);
+ if (c >= 224) // fullbright ranges
+ R_DrawModelMesh(skinframe->shirt, NULL, color[0] * (1.0f / 255.0f), color[1] * (1.0f / 255.0f), color[2] * (1.0f / 255.0f));
+ else
+ {
+ R_TintModel(aliasvertcolor, aliasvertcolor2, model->numverts, color[0] * (1.0f / 255.0f), color[1] * (1.0f / 255.0f), color[2] * (1.0f / 255.0f));
+ R_DrawModelMesh(skinframe->shirt, aliasvertcolor2, 0, 0, 0);
+ }
+ }
+ }
+ else
+ {
+ if (skinframe->merged)
+ R_DrawModelMesh(skinframe->merged, aliasvertcolor, 0, 0, 0);
+ else
+ {
+ if (skinframe->base) R_DrawModelMesh(skinframe->base, aliasvertcolor, 0, 0, 0);
+ if (skinframe->pants) R_DrawModelMesh(skinframe->pants, aliasvertcolor, 0, 0, 0);
+ if (skinframe->shirt) R_DrawModelMesh(skinframe->shirt, aliasvertcolor, 0, 0, 0);
+ }
+ }
+ if (skinframe->glow) R_DrawModelMesh(skinframe->glow, NULL, 1 - fog, 1 - fog, 1 - fog);
+ }
+ else
+ R_DrawModelMesh(0, NULL, 1 - fog, 1 - fog, 1 - fog);
+ }
+ else
+ {
+ rmeshbufferinfo_t bufmesh;
+ memset(&bufmesh, 0, sizeof(bufmesh));
+ if (currentrenderentity->effects & EF_ADDITIVE)
+ {
+ bufmesh.transparent = true;
+ bufmesh.blendfunc1 = GL_SRC_ALPHA;
+ bufmesh.blendfunc2 = GL_ONE;
+ }
+ else if (currentrenderentity->alpha != 1.0 || skinframe->fog != NULL)
+ {
+ bufmesh.transparent = true;
+ bufmesh.blendfunc1 = GL_SRC_ALPHA;
+ bufmesh.blendfunc2 = GL_ONE_MINUS_SRC_ALPHA;
+ }
+ else
+ {
+ bufmesh.transparent = false;
+ bufmesh.blendfunc1 = GL_ONE;
+ bufmesh.blendfunc2 = GL_ZERO;
+ }
+ bufmesh.numtriangles = model->numtris;
+ bufmesh.numverts = model->numverts;
+ bufmesh.tex[0] = R_GetTexture(skinframe->merged);
+
+ R_Mesh_Draw_GetBuffer(&bufmesh);
+
+ aliasvert = bufmesh.vertex;
+ aliasvertcolor = bufmesh.color;
+ memcpy(bufmesh.index, model->mdlmd2data_indices, bufmesh.numtriangles * sizeof(int[3]));
+ memcpy(bufmesh.texcoords[0], model->mdlmd2data_texcoords, bufmesh.numverts * sizeof(float[2]));
+
+ fog = bufmesh.colorscale * (1 - fog);
+ R_SetupMDLMD2Frames(fog, fog, fog);
+
+ aliasvert = aliasvertbuf;
+ aliasvertcolor = aliasvertcolorbuf;
+ }