use safe strings more
This commit is contained in:
parent
8b204ac054
commit
f3c26c791f
|
|
@ -27,8 +27,6 @@
|
||||||
//
|
//
|
||||||
|
|
||||||
#include "cmdlib.h"
|
#include "cmdlib.h"
|
||||||
#include "mathlib.h"
|
|
||||||
#include "polylib.h"
|
|
||||||
#include "inout.h"
|
#include "inout.h"
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
|
|
|
||||||
|
|
@ -448,8 +448,7 @@ void ProcessWorldModel( void ){
|
||||||
|
|
||||||
/* ydnar: fog hull */
|
/* ydnar: fog hull */
|
||||||
if ( ENT_READKV( &value, &entities[ 0 ], "_foghull" ) ) {
|
if ( ENT_READKV( &value, &entities[ 0 ], "_foghull" ) ) {
|
||||||
char shader[MAX_QPATH];
|
const auto shader = String64()( "textures/", value );
|
||||||
sprintf( shader, "textures/%s", value );
|
|
||||||
MakeFogHullSurfs( e, tree, shader );
|
MakeFogHullSurfs( e, tree, shader );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1085,8 +1085,6 @@ static void ParseRawBrush( bool onlyLights ){
|
||||||
vec_t shift[ 2 ];
|
vec_t shift[ 2 ];
|
||||||
vec_t rotate = 0;
|
vec_t rotate = 0;
|
||||||
vec_t scale[ 2 ];
|
vec_t scale[ 2 ];
|
||||||
char name[ MAX_QPATH ];
|
|
||||||
char shader[ MAX_QPATH ];
|
|
||||||
int flags;
|
int flags;
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -1146,7 +1144,7 @@ static void ParseRawBrush( bool onlyLights ){
|
||||||
|
|
||||||
/* read shader name */
|
/* read shader name */
|
||||||
GetToken( false );
|
GetToken( false );
|
||||||
strcpy( name, token );
|
const auto shader = String64()( "textures/", token );
|
||||||
|
|
||||||
/* AP or 220? */
|
/* AP or 220? */
|
||||||
if ( g_brushType == BPRIMIT_UNDEFINED ){
|
if ( g_brushType == BPRIMIT_UNDEFINED ){
|
||||||
|
|
@ -1199,7 +1197,6 @@ static void ParseRawBrush( bool onlyLights ){
|
||||||
}
|
}
|
||||||
|
|
||||||
/* set default flags and values */
|
/* set default flags and values */
|
||||||
sprintf( shader, "textures/%s", name );
|
|
||||||
if ( onlyLights ) {
|
if ( onlyLights ) {
|
||||||
si = &shaderInfo[ 0 ];
|
si = &shaderInfo[ 0 ];
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -219,7 +219,6 @@ void InsertModel( const char *name, int skin, int frame, m4x4_t transform, const
|
||||||
mapDrawSurface_t *ds;
|
mapDrawSurface_t *ds;
|
||||||
bspDrawVert_t *dv;
|
bspDrawVert_t *dv;
|
||||||
const char *picoShaderName;
|
const char *picoShaderName;
|
||||||
char shaderName[ MAX_QPATH ];
|
|
||||||
picoVec_t *xyz, *normal, *st;
|
picoVec_t *xyz, *normal, *st;
|
||||||
byte *color;
|
byte *color;
|
||||||
picoIndex_t *indexes;
|
picoIndex_t *indexes;
|
||||||
|
|
@ -385,12 +384,12 @@ void InsertModel( const char *name, int skin, int frame, m4x4_t transform, const
|
||||||
|
|
||||||
/* shader renaming for sof2 */
|
/* shader renaming for sof2 */
|
||||||
if ( renameModelShaders ) {
|
if ( renameModelShaders ) {
|
||||||
strcpy( shaderName, picoShaderName );
|
auto shaderName = String64()( PathExtensionless( picoShaderName ) );
|
||||||
if ( spawnFlags & 1 ) {
|
if ( spawnFlags & 1 ) {
|
||||||
path_set_extension( shaderName, "_RMG_BSP" );
|
shaderName << "_RMG_BSP";
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
path_set_extension( shaderName, "_BSP" );
|
shaderName << "_BSP";
|
||||||
}
|
}
|
||||||
si = ShaderInfoForShader( shaderName );
|
si = ShaderInfoForShader( shaderName );
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -221,8 +221,6 @@ void ParsePatch( bool onlyLights ){
|
||||||
vec_t info[ 5 ];
|
vec_t info[ 5 ];
|
||||||
int i, j, k;
|
int i, j, k;
|
||||||
parseMesh_t *pm;
|
parseMesh_t *pm;
|
||||||
char texture[ MAX_QPATH ];
|
|
||||||
char shader[ MAX_QPATH ];
|
|
||||||
mesh_t m;
|
mesh_t m;
|
||||||
bspDrawVert_t *verts;
|
bspDrawVert_t *verts;
|
||||||
epair_t *ep;
|
epair_t *ep;
|
||||||
|
|
@ -233,9 +231,9 @@ void ParsePatch( bool onlyLights ){
|
||||||
|
|
||||||
MatchToken( "{" );
|
MatchToken( "{" );
|
||||||
|
|
||||||
/* get texture */
|
/* get shader name */
|
||||||
GetToken( true );
|
GetToken( true );
|
||||||
strcpy( texture, token );
|
const auto shader = String64()( "textures/", token );
|
||||||
|
|
||||||
Parse1DMatrix( 5, info );
|
Parse1DMatrix( 5, info );
|
||||||
m.width = info[0];
|
m.width = info[0];
|
||||||
|
|
@ -355,7 +353,6 @@ void ParsePatch( bool onlyLights ){
|
||||||
pm->brushNum = entitySourceBrushes;
|
pm->brushNum = entitySourceBrushes;
|
||||||
|
|
||||||
/* set shader */
|
/* set shader */
|
||||||
sprintf( shader, "textures/%s", texture );
|
|
||||||
pm->shaderInfo = ShaderInfoForShader( shader );
|
pm->shaderInfo = ShaderInfoForShader( shader );
|
||||||
|
|
||||||
/* set mesh */
|
/* set mesh */
|
||||||
|
|
|
||||||
|
|
@ -1696,7 +1696,7 @@ mapDrawSurface_t *DrawSurfaceForFlare( int entNum, vec3_t origin, vec
|
||||||
mapDrawSurface_t *DrawSurfaceForShader( const char *shader );
|
mapDrawSurface_t *DrawSurfaceForShader( const char *shader );
|
||||||
void ClipSidesIntoTree( entity_t *e, tree_t *tree );
|
void ClipSidesIntoTree( entity_t *e, tree_t *tree );
|
||||||
void MakeDebugPortalSurfs( tree_t *tree );
|
void MakeDebugPortalSurfs( tree_t *tree );
|
||||||
void MakeFogHullSurfs( entity_t *e, tree_t *tree, char *shader );
|
void MakeFogHullSurfs( entity_t *e, tree_t *tree, const char *shader );
|
||||||
void SubdivideFaceSurfaces( entity_t *e, tree_t *tree );
|
void SubdivideFaceSurfaces( entity_t *e, tree_t *tree );
|
||||||
void AddEntitySurfaceModels( entity_t *e );
|
void AddEntitySurfaceModels( entity_t *e );
|
||||||
int AddSurfaceModels( mapDrawSurface_t *ds );
|
int AddSurfaceModels( mapDrawSurface_t *ds );
|
||||||
|
|
|
||||||
|
|
@ -3046,7 +3046,7 @@ void MakeDebugPortalSurfs( tree_t *tree ){
|
||||||
generates drawsurfaces for a foghull (this MUST use a sky shader)
|
generates drawsurfaces for a foghull (this MUST use a sky shader)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void MakeFogHullSurfs( entity_t *e, tree_t *tree, char *shader ){
|
void MakeFogHullSurfs( entity_t *e, tree_t *tree, const char *shader ){
|
||||||
shaderInfo_t *si;
|
shaderInfo_t *si;
|
||||||
mapDrawSurface_t *ds;
|
mapDrawSurface_t *ds;
|
||||||
vec3_t fogMins, fogMaxs;
|
vec3_t fogMins, fogMaxs;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user