Beispiel #1
0
/*
==========================
UI_RegisterClientModelname
==========================
*/
qbool UI_RegisterClientModelname( playerInfo_t *pi, const char *modelSkinName ) {
    char		modelName[MAX_QPATH];
    char		skinName[MAX_QPATH];
    char		filename[MAX_QPATH];
    char		*slash;

    pi->torsoModel = 0;
    pi->headModel = 0;

    if ( !modelSkinName[0] ) {
        return qfalse;
    }

    Q_strncpyz( modelName, modelSkinName, sizeof( modelName ) );

    slash = strchr( modelName, '/' );
    if ( !slash ) {
        // modelName did not include a skin name
        Q_strncpyz( skinName, "default", sizeof( skinName ) );
    } else {
        Q_strncpyz( skinName, slash + 1, sizeof( skinName ) );
        *slash = '\0';
    }

    Com_sprintf( filename, sizeof( filename ), "models/wq3_players/%s/lower.md3", modelName );
    pi->legsModel = trap_R_RegisterModel( filename );
    if ( !pi->legsModel ) {
        Com_Printf( "Failed to load model file %s\n", filename );
        return qfalse;
    }

    Com_sprintf( filename, sizeof( filename ), "models/wq3_players/%s/upper.md3", modelName );
    pi->torsoModel = trap_R_RegisterModel( filename );
    if ( !pi->torsoModel ) {
        Com_Printf( "Failed to load model file %s\n", filename );
        return qfalse;
    }

    Com_sprintf( filename, sizeof( filename ), "models/wq3_players/%s/head.md3", modelName );
    pi->headModel = trap_R_RegisterModel( filename );

    if (!pi->headModel) {
        Com_Printf( "Failed to load model file %s\n", filename );
        return qfalse;
    }

    // if any skins failed to load, fall back to default
    if ( !UI_RegisterClientSkin( pi, modelName, skinName ) ) {
        if ( !UI_RegisterClientSkin( pi, modelName, "default" ) ) {
            Com_Printf( "Failed to load skin file: %s : %s\n", modelName, skinName );
            return qfalse;
        }
    }

    // load the animations
    Com_sprintf( filename, sizeof( filename ), "models/wq3_players/%s/animation.cfg", modelName );
    if ( !UI_ParseAnimationFile( filename, pi->animations ) ) {
        Com_Printf( "Failed to load animation file %s\n", filename );
        return qfalse;
    }

    return qtrue;
}
qboolean UI_RegisterClientModelname( playerInfo_t *pi, const char *modelSkinName ) {
	char modelName[MAX_QPATH];
	char skinName[MAX_QPATH];
	char filename[MAX_QPATH];
	char        *slash;
	const char* backpack = NULL;
	const char* helmet = NULL;

	pi->torsoModel = 0;
	pi->headModel = 0;

	if ( !modelSkinName[0] ) {
		return qfalse;
	}

	Q_strncpyz( modelName, modelSkinName, sizeof( modelName ) );

	slash = strchr( modelName, '/' );
	if ( !slash ) {
		// modelName did not include a skin name
		Q_strncpyz( skinName, "default", sizeof( skinName ) );
	} else {
		Q_strncpyz( skinName, slash + 1, sizeof( skinName ) );
		// truncate modelName
		*slash = 0;
	}

	// NERVE - SMF - set weapon
	pi->weapon = WM_getWeaponIndex();
	UI_PlayerInfo_SetWeapon( pi, pi->weapon );

	// NERVE - SMF - determine skin
	{
		const char *team;
		const char *playerClass;
		int var, teamval;

		teamval = trap_Cvar_VariableValue( "mp_team" );

		if ( teamval == 1 ) {
			team = "blue";
		} else {
			team = "red";
		}

		var = trap_Cvar_VariableValue( "mp_playerType" );

		if ( var == 0 ) {
			playerClass = "soldier";

			if ( teamval == 1 ) {
				backpack = "acc/backpack/backpack_sol.md3";
				helmet = "acc/helmet_american/sol.md3";
			} else {
				backpack = "acc/backpack/backpack_german_sol.md3";
				helmet = "acc/helmet_german/helmet_german_sol.md3";
			}
		} else if ( var == 1 )   {
			playerClass = "medic";

			if ( teamval == 1 ) {
				backpack = "acc/backpack/backpack_med.md3";
				helmet = "acc/helmet_american/med.md3";
			} else {
				backpack = "acc/backpack/backpack_german_med.md3";
				helmet = "acc/helmet_german/helmet_german_med.md3";
			}
		} else if ( var == 2 )   {
			playerClass = "engineer";

			if ( teamval == 1 ) {
				backpack = "acc/backpack/backpack_eng.md3";
				helmet = "acc/helmet_american/eng.md3";
			} else {
				backpack = "acc/backpack/backpack_german_eng.md3";
				helmet = "acc/helmet_german/helmet_german_eng.md3";
			}
		} else {
			playerClass = "lieutenant";

			if ( teamval == 1 ) {
				backpack = "acc/backpack/backpack_lieu.md3";
				helmet = "acc/helmet_american/lieu.md3";
			} else {
				backpack = "acc/backpack/backpack_german_lieu.md3";
				helmet = "acc/helmet_american/lieu.md3";
			}
		}

		strcpy( skinName, va( "%s%s1", team, playerClass ) );
	}
	// -NERVE - SMF

//		Q_strncpyz( skinName, "bluesoldier1", sizeof( skinName ) );		// NERVE - SMF - make this work with wolf - TESTING!!!
//	}
//	else {
//		Q_strncpyz( skinName, "redsoldier1", sizeof( skinName ) );		// NERVE - SMF - make this work with wolf - TESTING!!!
//	}

	// load cmodels before models so filecache works

//	Com_sprintf( filename, sizeof( filename ), "models/players/%s/lower.md3", modelName );
	Com_sprintf( filename, sizeof( filename ), "models/players/%s/body.mds", modelName ); // NERVE - SMF - make this work with wolf
	pi->legsModel = trap_R_RegisterModel( filename );
	if ( !pi->legsModel ) {
		Com_Printf( "Failed to load model file %s\n", filename );
		return qfalse;
	}

//	Com_sprintf( filename, sizeof( filename ), "models/players/%s/upper.md3", modelName );
	Com_sprintf( filename, sizeof( filename ), "models/players/%s/body.mds", modelName ); // NERVE - SMF - make this work with wolf
	pi->torsoModel = trap_R_RegisterModel( filename );
	if ( !pi->torsoModel ) {
		Com_Printf( "Failed to load model file %s\n", filename );
		return qfalse;
	}

	Com_sprintf( filename, sizeof( filename ), "models/players/%s/head.md3", modelName );
	pi->headModel = trap_R_RegisterModel( filename );
	if ( !pi->headModel ) {
		Com_Printf( "Failed to load model file %s\n", filename );
		return qfalse;
	}

	// NERVE - SMF - load backpack and helmet
	if ( backpack ) {
		pi->backpackModel = trap_R_RegisterModel( va( "models/players/%s/%s", modelName, backpack ) );
	}

	if ( helmet ) {
		pi->helmetModel = trap_R_RegisterModel( va( "models/players/%s/%s", modelName, helmet ) );
	}

	// if any skins failed to load, fall back to default
	if ( !UI_RegisterClientSkin( pi, modelName, skinName ) ) {
		if ( !UI_RegisterClientSkin( pi, modelName, "default" ) ) {
			Com_Printf( "Failed to load skin file: %s : %s\n", modelName, skinName );
			return qfalse;
		}
	}

	// load the animations
//----(SA) changing name of config file to avoid backwards or alternate compatibility confustion
//	Com_sprintf( filename, sizeof( filename ), "models/players/%s/animation.cfg", modelName );
	Com_sprintf( filename, sizeof( filename ), "models/players/%s/wolfanim.cfg", modelName );
//----(SA) end
	if ( !UI_ParseAnimationFile( filename, pi ) ) {         // NERVE - SMF - make this work with wolf
		Com_Printf( "Failed to load animation file %s\n", filename );
		return qfalse;
	}

	return qtrue;
}
Beispiel #3
0
/*
==========================
UI_RegisterPlayerModelname
==========================
*/
qboolean UI_RegisterPlayerModelname( uiPlayerInfo_t *pi, const char *modelSkinName, const char *headModelSkinName, const char *teamName ) {
	char		modelName[MAX_QPATH];
	char		skinName[MAX_QPATH];
	char		headModelName[MAX_QPATH];
	char		headSkinName[MAX_QPATH];
	char		filename[MAX_QPATH];
	char		*slash;

	pi->torsoModel = 0;
	pi->headModel = 0;

	if ( !modelSkinName[0] ) {
		return qfalse;
	}

	Q_strncpyz( modelName, modelSkinName, sizeof( modelName ) );

	slash = strchr( modelName, '/' );
	if ( !slash ) {
		// modelName did not include a skin name
		Q_strncpyz( skinName, "default", sizeof( skinName ) );
	} else {
		Q_strncpyz( skinName, slash + 1, sizeof( skinName ) );
		*slash = '\0';
	}

	Q_strncpyz( headModelName, headModelSkinName, sizeof( headModelName ) );
	slash = strchr( headModelName, '/' );
	if ( !slash ) {
		// modelName did not include a skin name
		Q_strncpyz( headSkinName, "default", sizeof( skinName ) );
	} else {
		Q_strncpyz( headSkinName, slash + 1, sizeof( skinName ) );
		*slash = '\0';
	}

#ifdef IOQ3ZTM // BLANK_HEADMODEL
	if (!headModelName[0]) {
		Q_strncpyz( headModelName, modelName, sizeof( headModelName ) );
	}
#endif

	// load cmodels before models so filecache works

	Com_sprintf( filename, sizeof( filename ), "models/players/%s/lower.md3", modelName );
	pi->legsModel = trap_R_RegisterModel( filename );
	if ( !pi->legsModel ) {
		Com_Printf( "Failed to load model file %s\n", filename );
		return qfalse;
	}

	Com_sprintf( filename, sizeof( filename ), "models/players/%s/upper.md3", modelName );
	pi->torsoModel = trap_R_RegisterModel( filename );
	if ( !pi->torsoModel ) {
		Com_Printf( "Failed to load model file %s\n", filename );
		return qfalse;
	}

	if (headModelName[0] == '*' ) {
		Com_sprintf( filename, sizeof( filename ), "models/players/heads/%s/%s.md3", &headModelName[1], &headModelName[1] );
	}
	else {
		Com_sprintf( filename, sizeof( filename ), "models/players/%s/head.md3", headModelName );
	}
	pi->headModel = trap_R_RegisterModel( filename );
	if ( !pi->headModel && headModelName[0] != '*') {
		Com_sprintf( filename, sizeof( filename ), "models/players/heads/%s/%s.md3", headModelName, headModelName );
		pi->headModel = trap_R_RegisterModel( filename );
	}

	if (!pi->headModel) {
		Com_Printf( "Failed to load model file %s\n", filename );
		return qfalse;
	}

	// if any skins failed to load, fall back to default
	if ( !UI_RegisterPlayerSkin( pi, modelName, skinName, headModelName, headSkinName, teamName) ) {
		if ( !UI_RegisterPlayerSkin( pi, modelName, "default", headModelName, "default", teamName ) ) {
			Com_Printf( "Failed to load skin file: %s : %s\n", modelName, skinName );
			return qfalse;
		}
	}

	// load the animations
#ifdef TA_PLAYERSYS
	return BG_LoadPlayerCFGFile(&pi->playercfg, modelName, headModelName);
#else
	Com_sprintf( filename, sizeof( filename ), "models/players/%s/animation.cfg", modelName );
	if ( !UI_ParseAnimationFile( filename, pi->animations ) ) {
		Com_Printf( "Failed to load animation file %s\n", filename );
		return qfalse;
	}

	return qtrue;
#endif
}
Beispiel #4
0
/*
==========================
UI_RegisterClientModelname
==========================
*/
qboolean UI_RegisterClientModelname( playerInfo_t *pi, const char *modelSkinName, const char *headName, const char *teamName ) {
	char		modelName[MAX_QPATH];
	char		headModelName[MAX_QPATH];
	char		skinName[MAX_QPATH];
	char		filename[MAX_QPATH];
	char		*slash, *headslash;

	pi->torsoModel = 0;
	pi->headModel = 0;

	if ( !modelSkinName[0] ) {
		return qfalse;
	}

	Q_strncpyz( modelName, modelSkinName, sizeof( modelName ) );
	Q_strncpyz( headModelName, headName, sizeof( headModelName ) );

	slash = strchr( modelName, '/' );
	if ( !slash ) {
		// modelName did not include a skin name
		Q_strncpyz( skinName, "default", sizeof( skinName ) );
	} else {
		Q_strncpyz( skinName, slash + 1, sizeof( skinName ) );
		// truncate modelName
		*slash = 0;
	}

	headslash = strchr( headModelName, '/' );
	if ( headslash ) {
		*headslash = 0;
	}

	// load cmodels before models so filecache works

	Com_sprintf( filename, sizeof( filename ), "models/players/%s/lower.md3", modelName );
	pi->legsModel = trap_R_RegisterModel( filename );
	if ( !pi->legsModel ) {
		Com_Printf( "Failed to load model file %s\n", filename );
		return qfalse;
	}

	Com_sprintf( filename, sizeof( filename ), "models/players/%s/upper.md3", modelName );
	pi->torsoModel = trap_R_RegisterModel( filename );
	if ( !pi->torsoModel ) {
		Com_Printf( "Failed to load model file %s\n", filename );
		return qfalse;
	}

  if (headName && headName[0] == '*' ) {
	  Com_sprintf( filename, sizeof( filename ), "models/players/heads/%s/%s.md3", &headName[1], &headName[1] );
  }
  else {
	  Com_sprintf( filename, sizeof( filename ), "models/players/%s/head.md3", headModelName );
  }
  pi->headModel = trap_R_RegisterModel( filename );
  if ( !pi->headModel && headName[0] != '*') {
	  Com_sprintf( filename, sizeof( filename ), "models/players/heads/%s/%s.md3", headName, headName );
	  pi->headModel = trap_R_RegisterModel( filename );
	}

	if (!pi->headModel) {
	  Com_Printf( "Failed to load model file %s\n", filename );
	  return qfalse;
  }

	// if any skins failed to load, fall back to default
	if ( !UI_RegisterClientSkin( pi, modelName, skinName, headModelName, skinName, teamName) ) {
    if ( !UI_RegisterClientSkin( pi, modelName, "default", headName, "default", teamName ) ) {
			Com_Printf( "Failed to load skin file: %s : %s\n", modelName, skinName );
			return qfalse;
		}
	}

	// load the animations
	Com_sprintf( filename, sizeof( filename ), "models/players/%s/animation.cfg", modelName );
	if ( !UI_ParseAnimationFile( filename, pi->animations ) ) {
		Com_Printf( "Failed to load animation file %s\n", filename );
		return qfalse;
	}

	return qtrue;
}
Beispiel #5
0
/*
 * UI_RegisterClientModelname
 */
qbool
UI_RegisterClientModelname(Playerinfo *pi, const char *modelSkinName)
{
	char	modelName[MAX_QPATH];
	char	skinName[MAX_QPATH];
	char	filename[MAX_QPATH];
	char	*slash;

	pi->torsoModel	= 0;
	pi->headModel	= 0;

	if(!modelSkinName[0])
		return qfalse;

	Q_strncpyz(modelName, modelSkinName, sizeof(modelName));

	slash = strchr(modelName, '/');
	if(!slash)
		/* modelName did not include a skin name */
		Q_strncpyz(skinName, "default", sizeof(skinName));
	else{
		Q_strncpyz(skinName, slash + 1, sizeof(skinName));
		/* truncate modelName */
		*slash = 0;
	}

	/* load cmodels before models so filecache works */

	Q_sprintf(filename, sizeof(filename), Pplayermodels "/%s/lower",
		modelName);
	pi->legsModel = trap_R_RegisterModel(filename);
	if(!pi->legsModel){
		comprintf("Failed to load model file %s\n", filename);
		return qfalse;
	}

	Q_sprintf(filename, sizeof(filename), Pplayermodels "/%s/upper",
		modelName);
	pi->torsoModel = trap_R_RegisterModel(filename);
	if(!pi->torsoModel){
		comprintf("Failed to load model file %s\n", filename);
		return qfalse;
	}

	Q_sprintf(filename, sizeof(filename), Pplayermodels "/%s/head",
		modelName);
	pi->headModel = trap_R_RegisterModel(filename);
	if(!pi->headModel){
		comprintf("Failed to load model file %s\n", filename);
		return qfalse;
	}

	/* if any skins failed to load, fall back to default */
	if(!UI_RegisterClientSkin(pi, modelName, skinName))
		if(!UI_RegisterClientSkin(pi, modelName, "default")){
			comprintf("Failed to load skin file: %s : %s\n",
				modelName,
				skinName);
			return qfalse;
		}

	/* load the animations */
	Q_sprintf(filename, sizeof(filename),
		Pplayermodels "/%s/animation.cfg",
		modelName);
	if(!UI_ParseAnimationFile(filename, pi->animations)){
		comprintf("Failed to load animation file %s\n", filename);
		return qfalse;
	}

	return qtrue;
}