summaryrefslogtreecommitdiff
path: root/src/cl_parse.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/cl_parse.c')
-rw-r--r--src/cl_parse.c162
1 files changed, 0 insertions, 162 deletions
diff --git a/src/cl_parse.c b/src/cl_parse.c
index b17ec82..6057b75 100644
--- a/src/cl_parse.c
+++ b/src/cl_parse.c
@@ -708,168 +708,6 @@ static void CL_ParseServerData( void ) {
}
/*
-================
-CL_ParsePlayerSkin
-
-Breaks up playerskin into name (optional), model and skin components.
-If model or skin are found to be invalid, replaces them with sane defaults.
-================
-*/
-void CL_ParsePlayerSkin( char *name, char *model, char *skin, const char *s ) {
- size_t len;
- char *t;
-
- // configstring parsing guarantees that playerskins can never
- // overflow, but still check the length to be entirely fool-proof
- len = strlen( s );
- if( len >= MAX_QPATH ) {
- Com_Error( ERR_DROP, "%s: oversize playerskin", __func__ );
- }
-
- // isolate the player's name
- t = strchr( s, '\\' );
- if( t ) {
- len = t - s;
- strcpy( model, t + 1 );
- } else {
- len = 0;
- strcpy( model, s );
- }
-
- // copy the player's name
- if( name ) {
- memcpy( name, s, len );
- name[len] = 0;
- }
-
- // isolate the model name
- t = strchr( model, '/' );
- if( !t )
- t = strchr( model, '\\' );
- if( !t )
- t = model;
- if( t == model )
- goto default_model;
- *t++ = 0;
-
- // apply restrictions on skins
- if( cl_noskins->integer == 2 || !COM_IsPath( t ) )
- goto default_skin;
-
- if( cl_noskins->integer || !COM_IsPath( model ) )
- goto default_model;
-
- // isolate the skin name
- strcpy( skin, t );
- return;
-
-default_skin:
- if( !Q_stricmp( model, "female" ) ) {
- strcpy( model, "female" );
- strcpy( skin, "athena" );
- } else {
-default_model:
- strcpy( model, "male" );
- strcpy( skin, "grunt" );
- }
-}
-
-/*
-================
-CL_LoadClientinfo
-
-================
-*/
-void CL_LoadClientinfo( clientinfo_t *ci, const char *s ) {
- int i;
- char model_name[MAX_QPATH];
- char skin_name[MAX_QPATH];
- char model_filename[MAX_QPATH];
- char skin_filename[MAX_QPATH];
- char weapon_filename[MAX_QPATH];
- char icon_filename[MAX_QPATH];
-
- CL_ParsePlayerSkin( ci->name, model_name, skin_name, s );
-
- // model file
- Q_concat( model_filename, sizeof( model_filename ),
- "players/", model_name, "/tris.md2", NULL );
- ci->model = R_RegisterModel( model_filename );
- if( !ci->model && Q_stricmp( model_name, "male" ) ) {
- strcpy( model_name, "male" );
- strcpy( model_filename, "players/male/tris.md2" );
- ci->model = R_RegisterModel( model_filename );
- }
-
- // skin file
- Q_concat( skin_filename, sizeof( skin_filename ),
- "players/", model_name, "/", skin_name, ".pcx", NULL );
- ci->skin = R_RegisterSkin( skin_filename );
-
- // if we don't have the skin and the model was female,
- // see if athena skin exists
- if( !ci->skin && !Q_stricmp( model_name, "female" ) ) {
- strcpy( skin_name, "athena" );
- strcpy( skin_filename, "players/female/athena.pcx" );
- ci->skin = R_RegisterSkin( skin_filename );
- }
-
- // if we don't have the skin and the model wasn't male,
- // see if the male has it (this is for CTF's skins)
- if( !ci->skin && Q_stricmp( model_name, "male" ) ) {
- // change model to male
- strcpy( model_name, "male" );
- strcpy( model_filename, "players/male/tris.md2" );
- ci->model = R_RegisterModel( model_filename );
-
- // see if the skin exists for the male model
- Q_concat( skin_filename, sizeof( skin_filename ),
- "players/male/", skin_name, ".pcx", NULL );
- ci->skin = R_RegisterSkin( skin_filename );
- }
-
- // if we still don't have a skin, it means that the male model
- // didn't have it, so default to grunt
- if( !ci->skin ) {
- // see if the skin exists for the male model
- strcpy( skin_name, "grunt" );
- strcpy( skin_filename, "players/male/grunt.pcx" );
- ci->skin = R_RegisterSkin( skin_filename );
- }
-
- // weapon file
- for( i = 0; i < cl.numWeaponModels; i++ ) {
- Q_concat( weapon_filename, sizeof( weapon_filename ),
- "players/", model_name, "/", cl.weaponModels[i], NULL );
- ci->weaponmodel[i] = R_RegisterModel( weapon_filename );
- if( !ci->weaponmodel[i] && Q_stricmp( model_name, "male" ) ) {
- // try male
- Q_concat( weapon_filename, sizeof( weapon_filename ),
- "players/male/", cl.weaponModels[i], NULL );
- ci->weaponmodel[i] = R_RegisterModel( weapon_filename );
- }
- }
-
- // icon file
- Q_concat( icon_filename, sizeof( icon_filename ),
- "/players/", model_name, "/", skin_name, "_i.pcx", NULL );
- ci->icon = R_RegisterPic( icon_filename );
-
- strcpy( ci->model_name, model_name );
- strcpy( ci->skin_name, skin_name );
-
- // must have loaded all data types to be valid
- if( !ci->skin || !ci->icon || !ci->model || !ci->weaponmodel[0] ) {
- ci->skin = 0;
- ci->icon = 0;
- ci->model = 0;
- ci->weaponmodel[0] = 0;
- ci->model_name[0] = 0;
- ci->skin_name[0] = 0;
- }
-}
-
-/*
=====================================================================
ACTION MESSAGES