diff --git a/tools/quake3/common/scriplib.cpp b/tools/quake3/common/scriplib.cpp index f7bebd7f..b1d74e27 100644 --- a/tools/quake3/common/scriplib.cpp +++ b/tools/quake3/common/scriplib.cpp @@ -106,7 +106,7 @@ bool LoadScriptFile( const char *filename, int index /* = 0 */, bool verbose /* ParseFromMemory ============== */ -void ParseFromMemory( char *buffer, size_t size ){ +void ParseFromMemory( const char *buffer, size_t size ){ scriptstack.clear(); tokenready = false; MemBuffer bu( size ); diff --git a/tools/quake3/common/scriplib.h b/tools/quake3/common/scriplib.h index 39cf8db8..06b9b9cb 100644 --- a/tools/quake3/common/scriplib.h +++ b/tools/quake3/common/scriplib.h @@ -32,7 +32,7 @@ extern int scriptline; /// \param[in] index >= 0: \p filename is relative path in VSF, Nth occurrence of file /// \return true on success bool LoadScriptFile( const char *filename, int index = 0, bool verbose = true ); -void ParseFromMemory( char *buffer, size_t size ); +void ParseFromMemory( const char *buffer, size_t size ); /// \param[in] crossline true: write next token to \c token or return false on EOF /// \param[in] crossline false: find next token on the current line or emit \c Error diff --git a/tools/quake3/q3map2/shaders.cpp b/tools/quake3/q3map2/shaders.cpp index a03a133f..c729043c 100644 --- a/tools/quake3/q3map2/shaders.cpp +++ b/tools/quake3/q3map2/shaders.cpp @@ -1094,7 +1094,7 @@ static void ParseShaderFile( const char *filename ){ sun.numSamples = atoi( token ); } - /* apply sky surfaceparm */ + /* apply sky surfaceparm, this is required by ELightType::Sun to work */ ApplySurfaceParm( "sky", &si.contentFlags, &si.surfaceFlags, &si.compileFlags ); /* don't process any more tokens on this line */ @@ -1179,13 +1179,12 @@ static void ParseShaderFile( const char *filename ){ else if ( striEqual( token, "q3map_skyLight" ) ) { skylight_t& skylight = si.skylights.emplace_back(); text.GetToken( false ); - skylight.value = atof( token ); + skylight.value = std::max( atof( token ), 0.0 ); text.GetToken( false ); - skylight.iterations = atoi( token ); + skylight.iterations = std::max( atoi( token ), 2 ); - /* clamp */ - value_maximize( skylight.value, 0.0f ); - value_maximize( skylight.iterations, 2 ); + /* apply sky surfaceparm, this is required by ELightType::Sun to work */ + ApplySurfaceParm( "sky", &si.contentFlags, &si.surfaceFlags, &si.compileFlags ); /* read optional extension: horizon_min horizon_max sample_color*/ if( TokenAvailable() ){