void G2_SetSurfaceOnOffFromSkin (CGhoul2Info *ghlInfo, qhandle_t renderSkin) { int j; const skin_t *skin = R_GetSkinByHandle( renderSkin ); ghlInfo->mSlist.clear(); //remove any overrides we had before. ghlInfo->mMeshFrameNum = 0; for ( j = 0 ; j < skin->numSurfaces ; j++ ) { // the names have both been lowercased //Raz: why is this using the shader name and not the surface name? if ( !strcmp( ((shader_t *)skin->surfaces[j]->shader)->name, "*off") ) { G2_SetSurfaceOnOff(ghlInfo, ghlInfo->mSlist, skin->surfaces[j]->name, G2SURFACEFLAG_OFF); } else { int flags; int surfaceNum = G2_IsSurfaceLegal((void *)ghlInfo->currentModel, skin->surfaces[j]->name, &flags); if ( (surfaceNum != -1) && (!(flags&G2SURFACEFLAG_OFF)) ) //only turn on if it's not an "_off" surface { G2_SetSurfaceOnOff(ghlInfo, ghlInfo->mSlist, skin->surfaces[j]->name, 0); } } } }
qboolean G2API_SetSurfaceOnOff(g2handle_t g2h, const char *surfaceName, const int flags) { CGhoul2Info_v *ghoul2 = G2API_GetGhoul2Model(g2h); if (ghoul2 && !ghoul2->empty()) { CGhoul2Info &ghlInfo = ghoul2->front(); ghlInfo.mMeshFrameNum = 0; return G2_SetSurfaceOnOff(ghlInfo.mFileName, ghlInfo.mSlist, surfaceName, flags); } return qfalse; }
qboolean G2API_SetSurfaceOnOff(CGhoul2Info_v &ghoul2, const char *surfaceName, const int flags) { CGhoul2Info *ghlInfo = NULL; if ((int)&ghoul2 && ghoul2.size()>0) { ghlInfo = &ghoul2[0]; } if (ghlInfo) { // ensure we flush the cache ghlInfo->mMeshFrameNum = 0; return G2_SetSurfaceOnOff(ghlInfo->mFileName, ghlInfo->mSlist, surfaceName, flags); } return qfalse; }