diff --git a/docs/Complete_list_of_entity_keys.htm b/docs/Complete_list_of_entity_keys.htm index cb6717b0..e95a3cf9 100644 --- a/docs/Complete_list_of_entity_keys.htm +++ b/docs/Complete_list_of_entity_keys.htm @@ -211,7 +211,7 @@ td.formatted_questions ol { margin-top: 0px; margin-bottom: 0px; }
  • _clipdepth: thickness of autoclip brushes
  • _frame, frame: frame of model to load (doesn't work)
  • _remapXXX: XXX can be any string to allow multiple keys for this; contains a string of the form from;to, and any shader from in the model will be replaced by to; the special value * in from matches all shader names
  • -
  • _skin, skin: skin number to use
  • +
  • _skin, skin: skin number (DarkPlaces convention) or name (Quake3 convention) to use
  • model: path name of model to load
  • modelscale: scaling factor for the model to include
  • diff --git a/docs/shaderManual/quake-editor-radiant-directives.html b/docs/shaderManual/quake-editor-radiant-directives.html index 83f48f8d..6342113e 100644 --- a/docs/shaderManual/quake-editor-radiant-directives.html +++ b/docs/shaderManual/quake-editor-radiant-directives.html @@ -88,7 +88,7 @@ textures/liquids/lavahell2 //path and name of new texture -->

    qer_trans N.N

    -

    This directive makes brush transparent when seen in the editor (no effect on game rendering at all). It can have a positive value between 0 and 1. The higher the value, the less transparent the texture. Example: qer_trans 0.2 means the brush is 20% opaque and nearly invisible.

    +

    This directive makes brush transparent when seen in the editor and filterable by 'translucent' filter (no effect on game rendering at all). It can have a positive value between 0 and 1. The higher the value, the less transparent the texture. Example: qer_trans 0.2 means the brush is 20% opaque and nearly invisible.

    Design Notes:

    On GtkRadiant 1.4 and earlier, if the shader uses qer_trans and a qer_editorImage with an alpha channel, the transparent areas of the editorImage will be 100% transparent. To keep the solid areas of the editorImage opaque, use a near 1 value for qer_trans (eg. 0.9999). This is useful for grates, windows, fences, etc. If using GtkRadiant 1.5 or later, use qer_alphaFunc for editorImage masking instead.

    diff --git a/tools/quake3/q3map2/model.cpp b/tools/quake3/q3map2/model.cpp index 150f0d70..77735f06 100644 --- a/tools/quake3/q3map2/model.cpp +++ b/tools/quake3/q3map2/model.cpp @@ -988,7 +988,7 @@ default_CLIPMODEL: adds a picomodel into the bsp */ -void InsertModel( const char *name, int skin, int frame, const Matrix4& transform, const std::list *remaps, shaderInfo_t *celShader, entity_t& entity, int castShadows, int recvShadows, int spawnFlags, float lightmapScale, int lightmapSampleSize, float shadeAngle, float clipDepth ){ +void InsertModel( const char *name, const char *skin, int frame, const Matrix4& transform, const std::list *remaps, shaderInfo_t *celShader, entity_t& entity, int castShadows, int recvShadows, int spawnFlags, float lightmapScale, int lightmapSampleSize, float shadeAngle, float clipDepth ){ int i, j; const Matrix4 nTransform( matrix4_for_normal_transform( transform ) ); const bool transform_lefthanded = MATRIX4_LEFTHANDED == matrix4_handedness( transform ); @@ -1006,27 +1006,27 @@ void InsertModel( const char *name, int skin, int frame, const Matrix4& transfor /* load skin file */ std::list skins; - { - auto skinfilename = StringOutputStream(99)( PathExtensionless( name ), '_', skin, ".skin" ); - MemBuffer skinfile = vfsLoadFile( skinfilename ); - if ( skinfile && skin != 0 ) { - /* fallback to skin 0 if invalid */ - skinfilename( PathExtensionless( name ), "_0.skin" ); - skinfile = vfsLoadFile( skinfilename ); - if ( skinfile ) { - Sys_Printf( "Skin %d of %s does not exist, using 0 instead\n", skin, name ); - } - } - if ( skinfile ) { - Sys_Printf( "Using skin %d of %s\n", skin, name ); + if( !strEmptyOrNull( skin ) ){ + const bool isnumber = std::all_of( skin, skin + strlen( skin ), ::isdigit ); + + StringOutputStream skinfilename( 99 ); + if( isnumber ) + skinfilename( name, '_', skin, ".skin" ); // DarkPlaces naming: models/relics/relic.md3_14.skin for models/relics/relic.md3 + else + skinfilename( PathExtensionless( name ), '_', skin, ".skin" ); // Q3 naming: models/players/sarge/head_roderic.skin for models/players/sarge/head.md3 + + if ( MemBuffer skinfile = vfsLoadFile( skinfilename ) ) { + Sys_Printf( "Using skin %s of %s\n", skin, name ); for ( char *skinfilenextptr, *skinfileptr = skinfile.data(); !strEmpty( skinfileptr ); skinfileptr = skinfilenextptr ) { - // for fscanf + // for sscanf char format[64]; skinfilenextptr = strchr( skinfileptr, '\r' ); if ( skinfilenextptr != NULL ) { strClear( skinfilenextptr++ ); + if( *skinfilenextptr == '\n' ) // handle \r\n + ++skinfilenextptr; } else { @@ -1400,7 +1400,8 @@ void AddTriangleModels( entity_t& eparent ){ if ( shadeAngle != 0 ) Sys_Printf( "misc_model has shading angle of %.4f\n", shadeAngle ); - const int skin = e.intForKey( "_skin", "skin" ); + const char *skin = nullptr; + e.read_keyvalue( skin, "_skin", "skin" ); float clipDepth = clipDepthGlobal; if ( e.read_keyvalue( clipDepth, "_clipdepth" ) ) diff --git a/tools/quake3/q3map2/q3map2.h b/tools/quake3/q3map2/q3map2.h index 8e8085f4..8970cc26 100644 --- a/tools/quake3/q3map2/q3map2.h +++ b/tools/quake3/q3map2/q3map2.h @@ -1523,7 +1523,7 @@ tree_t FaceBSP( facelist_t& list ); /* model.c */ void assimp_init(); -void InsertModel( const char *name, int skin, int frame, const Matrix4& transform, const std::list *remaps, shaderInfo_t *celShader, entity_t& entity, int castShadows, int recvShadows, int spawnFlags, float lightmapScale, int lightmapSampleSize, float shadeAngle, float clipDepth ); +void InsertModel( const char *name, const char *skin, int frame, const Matrix4& transform, const std::list *remaps, shaderInfo_t *celShader, entity_t& entity, int castShadows, int recvShadows, int spawnFlags, float lightmapScale, int lightmapSampleSize, float shadeAngle, float clipDepth ); void AddTriangleModels( entity_t& eparent ); diff --git a/tools/quake3/q3map2/surface.cpp b/tools/quake3/q3map2/surface.cpp index 7a35b617..545188f8 100644 --- a/tools/quake3/q3map2/surface.cpp +++ b/tools/quake3/q3map2/surface.cpp @@ -2811,7 +2811,7 @@ static int AddSurfaceModelsToTriangle_r( mapDrawSurface_t *ds, const surfaceMode } /* insert the model */ - InsertModel( model.model.c_str(), 0, 0, transform, NULL, ds->celShader, entity, ds->castShadows, ds->recvShadows, 0, ds->lightmapScale, 0, 0, clipDepthGlobal ); + InsertModel( model.model.c_str(), NULL, 0, transform, NULL, ds->celShader, entity, ds->castShadows, ds->recvShadows, 0, ds->lightmapScale, 0, 0, clipDepthGlobal ); /* return to sender */ return 1; diff --git a/tools/quake3/q3map2/surface_foliage.cpp b/tools/quake3/q3map2/surface_foliage.cpp index a2dfe9b1..4f839478 100644 --- a/tools/quake3/q3map2/surface_foliage.cpp +++ b/tools/quake3/q3map2/surface_foliage.cpp @@ -255,7 +255,7 @@ void Foliage( mapDrawSurface_t *src, entity_t& entity ){ oldNumMapDrawSurfs = numMapDrawSurfs; /* add the model to the bsp */ - InsertModel( foliage.model.c_str(), 0, 0, matrix4_scale_for_vec3( Vector3( foliage.scale ) ), NULL, NULL, entity, src->castShadows, src->recvShadows, 0, src->lightmapScale, 0, 0, clipDepthGlobal ); + InsertModel( foliage.model.c_str(), NULL, 0, matrix4_scale_for_vec3( Vector3( foliage.scale ) ), NULL, NULL, entity, src->castShadows, src->recvShadows, 0, src->lightmapScale, 0, 0, clipDepthGlobal ); /* walk each new surface */ for ( i = oldNumMapDrawSurfs; i < numMapDrawSurfs; i++ )