/* ========================== UI_RegisterPlayerSkin ========================== */ static qboolean UI_RegisterPlayerSkin( uiPlayerInfo_t *pi, const char *modelName, const char *skinName, const char *headModelName, const char *headSkinName , const char *teamName) { char filename[MAX_QPATH]; qboolean legsSkin, torsoSkin, headSkin; if (teamName && *teamName) { Com_sprintf( filename, sizeof( filename ), "models/players/%s/%s/lower_%s.skin", modelName, teamName, skinName ); } else { Com_sprintf( filename, sizeof( filename ), "models/players/%s/lower_%s.skin", modelName, skinName ); } legsSkin = CG_RegisterSkin( filename, &pi->modelSkin, qfalse ); if (teamName && *teamName) { Com_sprintf( filename, sizeof( filename ), "models/players/%s/%s/upper_%s.skin", modelName, teamName, skinName ); } else { Com_sprintf( filename, sizeof( filename ), "models/players/%s/upper_%s.skin", modelName, skinName ); } torsoSkin = CG_RegisterSkin( filename, &pi->modelSkin, qtrue ); if ( UI_FindPlayerHeadFile( filename, sizeof(filename), teamName, headModelName, headSkinName, "head", "skin" ) ) { headSkin = CG_RegisterSkin( filename, &pi->modelSkin, qtrue ); } else { headSkin = qfalse; } if ( !legsSkin || !torsoSkin || !headSkin ) { return qfalse; } return qtrue; }
/* ========================== UI_RegisterClientSkin ========================== */ static qboolean UI_RegisterClientSkin( playerInfo_t *pi, const char *modelName, const char *skinName ) { char filename[MAX_QPATH]; qboolean legsSkin, torsoSkin, headSkin; Com_sprintf( filename, sizeof( filename ), "models/players/%s/lower_%s.skin", modelName, skinName ); legsSkin = CG_RegisterSkin( filename, &pi->modelSkin, qfalse ); Com_sprintf( filename, sizeof( filename ), "models/players/%s/upper_%s.skin", modelName, skinName ); torsoSkin = CG_RegisterSkin( filename, &pi->modelSkin, qtrue ); Com_sprintf( filename, sizeof( filename ), "models/players/%s/head_%s.skin", modelName, skinName ); headSkin = CG_RegisterSkin( filename, &pi->modelSkin, qtrue ); if ( !legsSkin || !torsoSkin || !headSkin ) { return qfalse; } return qtrue; }
void SP_misc_gamemodel( void ) { char* model; char* skin; vec_t angle; vec3_t angles; vec_t scale; vec3_t vScale; vec3_t org; cg_gamemodel_t* gamemodel; int i; #if 0 // ZTM: Note: Spearmint's game always drops misc_gamemodels. Also, RTCW has targetname set though I'm not sure what, if anything, it's used for. if ( CG_SpawnString( "targetname", "", &model ) || CG_SpawnString( "scriptname", "", &model ) || CG_SpawnString( "spawnflags", "", &model ) ) { // Gordon: this model may not be static, so let the server handle it return; } #endif if ( cg.numMiscGameModels >= MAX_STATIC_GAMEMODELS ) { CG_Error( "^1MAX_STATIC_GAMEMODELS(%i) hit", MAX_STATIC_GAMEMODELS ); } CG_SpawnString( "model", "", &model ); CG_SpawnString( "skin", "", &skin ); CG_SpawnVector( "origin", "0 0 0", org ); if ( !CG_SpawnVector( "angles", "0 0 0", angles ) ) { if ( CG_SpawnFloat( "angle", "0", &angle ) ) { angles[YAW] = angle; } } if ( !CG_SpawnVector( "modelscale_vec", "1 1 1", vScale ) ) { if ( CG_SpawnFloat( "modelscale", "1", &scale ) ) { VectorSet( vScale, scale, scale, scale ); } } gamemodel = &cgs.miscGameModels[cg.numMiscGameModels++]; gamemodel->model = trap_R_RegisterModel( model ); if ( *skin ) { CG_RegisterSkin( skin, &gamemodel->skin, qfalse ); } AnglesToAxis( angles, gamemodel->axes ); for ( i = 0; i < 3; i++ ) { VectorScale( gamemodel->axes[i], vScale[i], gamemodel->axes[i] ); } VectorCopy( org, gamemodel->org ); if ( gamemodel->model ) { vec3_t mins, maxs; trap_R_ModelBounds( gamemodel->model, mins, maxs, 0, 0, 0 ); for ( i = 0; i < 3; i++ ) { mins[i] *= vScale[i]; maxs[i] *= vScale[i]; } gamemodel->radius = RadiusFromBounds( mins, maxs ); } else { gamemodel->radius = 0; } }