* fix crash with nonpthreads xmllib + multithreading + output to system console
	* number of code fixes
Radiant:

misc...
	* fix: clone group ent / map import / saving map as : group ents name labels at 0,0,0;
	* number of code fixes
This commit is contained in:
Garux 2017-08-02 09:00:11 +03:00
parent 3ec33465b1
commit 173f350be7
29 changed files with 101 additions and 75 deletions

View File

@ -5,7 +5,7 @@ MAKEFILE_CONF ?= Makefile.conf
# user customizable stuf
# you may override this in Makefile.conf or the environment
BUILD ?= debug
# or: release, or: extradebug, or: profile, or: debug
# or: release, or: debug, or: extradebug, or: profile, or: native
OS ?= $(shell uname)
# or: Linux, Win32, Darwin
LDFLAGS ?=

View File

@ -209,7 +209,7 @@ std::list<DWinding*> *CreateTrace( dleaf_t *leaf, int c, vis_header *header, byt
}
}
delete repeatlist;
delete [] repeatlist;
return pointlist;
}

View File

@ -47,7 +47,7 @@ GdkPixbuf* pixbuf_new_from_file_with_mask( const char* filename ){
{
//GdkPixbuf* rgba = gdk_pixbuf_add_alpha( rgb, TRUE, 255, 0, 255 ); //pink to alpha
GdkPixbuf* rgba = gdk_pixbuf_add_alpha( rgb, FALSE, 255, 0, 255 ); //alpha
gdk_pixbuf_unref( rgb );
g_object_unref( rgb );
return rgba;
}
}
@ -60,7 +60,7 @@ GtkImage* image_new_from_file_with_mask( const char* filename ){
else
{
GtkImage* image = GTK_IMAGE( gtk_image_new_from_pixbuf( rgba ) );
gdk_pixbuf_unref( rgba );
g_object_unref( rgba );
return image;
}
}

View File

@ -28,9 +28,19 @@
#if defined( WIN32 )
#define S_ISDIR( mode ) ( mode & _S_IFDIR )
#include <io.h> // _access()
#ifndef F_OK
#define F_OK 0x00
#endif
#ifndef W_OK
#define W_OK 0x02
#endif
#ifndef R_OK
#define R_OK 0x04
#endif
#define access( path, mode ) _access( path, mode )
#else
#include <unistd.h> // access()

View File

@ -606,12 +606,12 @@ int _pico_nofname( const char *path, char *dest, int destSize ){
* string otherwise. given 'path' is not altered. -sea
*/
const char *_pico_nopath( const char *path ){
const char *src;
src = path + ( strlen( path ) - 1 );
if ( path == NULL ) {
return "";
}
const char *src;
src = path + ( strlen( path ) - 1 );
if ( !strchr( path,'/' ) && !strchr( path,'\\' ) ) {
return ( path );
}

View File

@ -84,7 +84,7 @@ void insert( RenderIndex index ){
m_data.push_back( index );
}
void swap( IndexBuffer& other ){
std::swap( m_data, m_data );
std::swap( m_data, other.m_data );
}
};

View File

@ -91,8 +91,8 @@ NameKeys m_nameKeys;
TraversableObserverPairRelay m_traverseObservers;
Doom3GroupOrigin m_funcStaticOrigin;
RenderablePivot m_renderOrigin;
RenderableNamedEntity m_renderName;
mutable Vector3 m_name_origin;
RenderableNamedEntity m_renderName;
ModelSkinKey m_skin;
public:
@ -259,8 +259,8 @@ Doom3Group( EntityClass* eclass, scene::Node& node, const Callback& transformCha
m_named( m_entity ),
m_nameKeys( m_entity ),
m_funcStaticOrigin( m_traverse, m_origin ),
m_renderName( m_named, m_name_origin ),
m_name_origin( g_vector3_identity ),
m_renderName( m_named, m_name_origin ),
m_skin( SkinChangedCaller( *this ) ),
m_curveNURBS( boundsChanged ),
m_curveCatmullRom( boundsChanged ),
@ -278,7 +278,8 @@ Doom3Group( const Doom3Group& other, scene::Node& node, const Callback& transfor
m_named( m_entity ),
m_nameKeys( m_entity ),
m_funcStaticOrigin( m_traverse, m_origin ),
m_renderName( m_named, g_vector3_identity ),
m_name_origin( g_vector3_identity ),
m_renderName( m_named, m_name_origin ),
m_skin( SkinChangedCaller( *this ) ),
m_curveNURBS( boundsChanged ),
m_curveCatmullRom( boundsChanged ),

View File

@ -63,8 +63,8 @@ NameKeys m_nameKeys;
OriginKey m_originKey;
Vector3 m_origin;
RenderableNamedEntity m_renderName;
mutable Vector3 m_name_origin;
RenderableNamedEntity m_renderName;
Callback m_transformChanged;
Callback m_evaluateTransform;
@ -83,8 +83,8 @@ Group( EntityClass* eclass, scene::Node& node, const Callback& transformChanged,
m_nameKeys( m_entity ),
m_originKey( OriginChangedCaller( *this ) ),
m_origin( ORIGINKEY_IDENTITY ),
m_renderName( m_named, m_name_origin ),
m_name_origin( g_vector3_identity ),
m_renderName( m_named, m_name_origin ),
m_transformChanged( transformChanged ),
m_evaluateTransform( evaluateTransform ){
construct();
@ -96,7 +96,8 @@ Group( const Group& other, scene::Node& node, const Callback& transformChanged,
m_nameKeys( m_entity ),
m_originKey( OriginChangedCaller( *this ) ),
m_origin( ORIGINKEY_IDENTITY ),
m_renderName( m_named, g_vector3_identity ),
m_name_origin( g_vector3_identity ),
m_renderName( m_named, m_name_origin ),
m_transformChanged( transformChanged ),
m_evaluateTransform( evaluateTransform ){
construct();

View File

@ -655,11 +655,11 @@ void render( RenderStateFlags state ) const {
aabb_draw_wire( points );
}
};
/*
inline void default_extents( Vector3& extents ){
extents = Vector3( 12, 12, 12 );
}
*/
class ShaderRef
{
CopiedString m_name;
@ -773,6 +773,8 @@ Doom3GroupOrigin m_funcStaticOrigin;
LightRadii m_radii;
Doom3LightRadius m_doom3Radius;
AABB m_aabb_light;
RenderLightRadiiWire m_radii_wire;
RenderLightRadiiFill m_radii_fill;
RenderLightRadiiBox m_radii_box;
@ -805,16 +807,14 @@ RenderLightProjection m_renderProjection;
LightShader m_shader;
AABB m_aabb_light;
Callback m_transformChanged;
Callback m_boundsChanged;
Callback m_evaluateTransform;
void construct(){
default_rotation( m_rotation );
m_aabb_light.origin = Vector3( 0, 0, 0 );
default_extents( m_aabb_light.extents );
//m_aabb_light.origin = Vector3( 0, 0, 0 );
//default_extents( m_aabb_light.extents );
m_keyObservers.insert( "classname", ClassnameFilter::ClassnameChangedCaller( m_filter ) );
m_keyObservers.insert( Static<KeyIsName>::instance().m_nameKey, NamedEntity::IdentifierChangedCaller( m_named ) );
@ -982,6 +982,7 @@ Light( EntityClass* eclass, scene::Node& node, const Callback& transformChanged,
m_nameKeys( m_entity ),
m_funcStaticOrigin( m_traverse, m_originKey.m_origin ),
m_doom3Radius( EntityClass_valueForKey( m_entity.getEntityClass(), "light_radius" ) ),
m_aabb_light( Vector3( 0, 0, 0 ), Vector3( 12, 12, 12 ) ),
m_radii_wire( m_radii, m_aabb_light.origin ),
m_radii_fill( m_radii, m_aabb_light.origin ),
m_radii_box( m_aabb_light.origin ),
@ -1005,6 +1006,7 @@ Light( const Light& other, scene::Node& node, const Callback& transformChanged,
m_nameKeys( m_entity ),
m_funcStaticOrigin( m_traverse, m_originKey.m_origin ),
m_doom3Radius( EntityClass_valueForKey( m_entity.getEntityClass(), "light_radius" ) ),
m_aabb_light( Vector3( 0, 0, 0 ), Vector3( 12, 12, 12 ) ),
m_radii_wire( m_radii, m_aabb_light.origin ),
m_radii_fill( m_radii, m_aabb_light.origin ),
m_radii_box( m_aabb_light.origin ),

View File

@ -136,6 +136,9 @@ GtkWidget* Console_constructWindow( GtkWindow* toplevel ){
return scr;
}
//#pragma GCC push_options
//#pragma GCC optimize ("O0")
class GtkTextBufferOutputStream : public TextOutputStream
{
GtkTextBuffer* textBuffer;
@ -144,12 +147,14 @@ GtkTextTag* tag;
public:
GtkTextBufferOutputStream( GtkTextBuffer* textBuffer, GtkTextIter* iter, GtkTextTag* tag ) : textBuffer( textBuffer ), iter( iter ), tag( tag ){
}
std::size_t write( const char* buffer, std::size_t length ){
std::size_t __attribute__((optimize("O0"))) write( const char* buffer, std::size_t length ){
gtk_text_buffer_insert_with_tags( textBuffer, iter, buffer, gint( length ), tag, 0 );
return length;
}
};
//#pragma GCC pop_options
std::size_t Sys_Print( int level, const char* buf, std::size_t length ){
bool contains_newline = std::find( buf, buf + length, '\n' ) != buf + length;

View File

@ -1,4 +1,4 @@
/*
/*
Copyright (C) 1999-2006 Id Software, Inc. and contributors.
For a list of contributors, see the accompanying CONTRIBUTORS file.
@ -232,7 +232,7 @@ void HomePaths_Realise(){
if ( shfolder ) {
FreeLibrary( shfolder );
}
if ( SHGetFolderPath( NULL, CSIDL_PERSONAL, NULL, 0, mydocsdir ) ) {
if ( SUCCEEDED( SHGetFolderPath( NULL, CSIDL_PERSONAL, NULL, 0, mydocsdir ) ) ) {
path.clear();
path << DirectoryCleaned( mydocsdir ) << "My Games/" << ( prefix + 1 ) << "/";
// win32: only add it if it already exists
@ -2756,7 +2756,7 @@ void MainFrame::Create(){
GdkPixbuf* pixbuf = pixbuf_new_from_file_with_mask( "bitmaps/icon.png" );
if ( pixbuf != 0 ) {
gtk_window_set_icon( window, pixbuf );
gdk_pixbuf_unref( pixbuf );
g_object_unref( pixbuf );
}
}
#endif

View File

@ -1,4 +1,4 @@
/*
/*
Copyright (C) 1999-2006 Id Software, Inc. and contributors.
For a list of contributors, see the accompanying CONTRIBUTORS file.
@ -118,7 +118,7 @@ CGameDescription::CGameDescription( xmlDocPtr pDoc, const CopiedString& gameFile
// read the user-friendly game name
xmlNodePtr pNode = pDoc->children;
while ( strcmp( (const char*)pNode->name, "game" ) && pNode != 0 )
while ( pNode != 0 && strcmp( (const char*)pNode->name, "game" ) )
{
pNode = pNode->next;
}

View File

@ -1577,7 +1577,7 @@ void TextureBrowser_constructTreeStore(){
TextureGroups groups = TextureGroups_constructTreeView();
GtkTreeStore* store = gtk_tree_store_new( 1, G_TYPE_STRING );
TextureGroups_constructTreeModel( groups, store );
std::set<CopiedString>::iterator iter;
//std::set<CopiedString>::iterator iter;
GtkTreeModel* model = GTK_TREE_MODEL( store );
@ -1587,7 +1587,7 @@ void TextureBrowser_constructTreeStore(){
}
void TextureBrowser_constructTreeStoreTags(){
TextureGroups groups;
//TextureGroups groups;
GtkTreeStore* store = gtk_tree_store_new( 1, G_TYPE_STRING );
GtkTreeModel* model = GTK_TREE_MODEL( g_TextureBrowser.m_all_tags_list );

View File

@ -210,6 +210,7 @@ void BuildMonitor_Construct(){
void BuildMonitor_Destroy(){
delete g_pWatchBSP;
g_pWatchBSP = NULL;
}
CWatchBSP *GetWatchBSP(){

View File

@ -67,7 +67,7 @@ xmlNodePtr xml_NodeForVec( vec3_t v ){
sprintf( buf, "%f %f %f", v[0], v[1], v[2] );
ret = xmlNewNode( NULL, "point" );
xmlNodeSetContent( ret, buf );
xmlNodeAddContent( ret, buf );
return ret;
}
@ -145,14 +145,14 @@ void xml_Select( char *msg, int entitynum, int brushnum, qboolean bError ){
// now build a proper "select" XML node
sprintf( buf, "Entity %i, Brush %i: %s", entitynum, brushnum, msg );
node = xmlNewNode( NULL, "select" );
xmlNodeSetContent( node, buf );
xmlNodeAddContent( node, buf );
level[0] = (int)'0' + ( bError ? SYS_ERR : SYS_WRN ) ;
level[1] = 0;
xmlSetProp( node, "level", (char *)&level );
// a 'select' information
sprintf( buf, "%i %i", entitynum, brushnum );
select = xmlNewNode( NULL, "brush" );
xmlNodeSetContent( select, buf );
xmlNodeAddContent( select, buf );
xmlAddChild( node, select );
xml_SendNode( node );
@ -172,14 +172,14 @@ void xml_Point( char *msg, vec3_t pt ){
char level[2];
node = xmlNewNode( NULL, "pointmsg" );
xmlNodeSetContent( node, msg );
xmlNodeAddContent( node, msg );
level[0] = (int)'0' + SYS_ERR;
level[1] = 0;
xmlSetProp( node, "level", (char *)&level );
// a 'point' node
sprintf( buf, "%g %g %g", pt[0], pt[1], pt[2] );
point = xmlNewNode( NULL, "point" );
xmlNodeSetContent( point, buf );
xmlNodeAddContent( point, buf );
xmlAddChild( node, point );
xml_SendNode( node );
@ -196,7 +196,7 @@ void xml_Winding( char *msg, vec3_t p[], int numpoints, qboolean die ){
int i;
node = xmlNewNode( NULL, "windingmsg" );
xmlNodeSetContent( node, msg );
xmlNodeAddContent( node, msg );
level[0] = (int)'0' + SYS_ERR;
level[1] = 0;
xmlSetProp( node, "level", (char *)&level );
@ -213,7 +213,7 @@ void xml_Winding( char *msg, vec3_t p[], int numpoints, qboolean die ){
}
winding = xmlNewNode( NULL, "winding" );
xmlNodeSetContent( winding, buf );
xmlNodeAddContent( winding, buf );
xmlAddChild( node, winding );
xml_SendNode( node );
@ -260,7 +260,7 @@ void FPrintf( int flag, char *buf ){
static qboolean bGotXML = false;
char level[2];
printf( buf );
printf( "%s", buf );
// the following part is XML stuff only.. but maybe we don't want that message to go down the XML pipe?
if ( flag == SYS_NOXML ) {
@ -282,7 +282,7 @@ void FPrintf( int flag, char *buf ){
bGotXML = true;
}
node = xmlNewNode( NULL, "message" );
xmlNodeSetContent( node, buf );
xmlNodeAddContent( node, buf );
level[0] = (int)'0' + flag;
level[1] = 0;
xmlSetProp( node, "level", (char *)&level );

View File

@ -242,7 +242,7 @@ void ProcessWorldModel( void ){
Sys_FPrintf( SYS_NOXML, "**********************\n" );
polyline = LeakFile( tree );
leaknode = xmlNewNode( NULL, "message" );
xmlNodeSetContent( leaknode, "MAP LEAKED\n" );
xmlNodeAddContent( leaknode, "MAP LEAKED\n" );
xmlAddChild( leaknode, polyline );
level[0] = (int) '0' + SYS_ERR;
level[1] = 0;

View File

@ -1,4 +1,4 @@
/*
/*
Copyright (C) 1999-2006 Id Software, Inc. and contributors.
For a list of contributors, see the accompanying CONTRIBUTORS file.
@ -692,7 +692,7 @@ void Cmd_Mipdir( void ){
GetToken( false );
strcpy( mip_prefix, token );
// create the directory if needed
sprintf( filename, "%stextures", gamedir, mip_prefix );
sprintf( filename, "%stextures", gamedir );
Q_mkdir( filename );
sprintf( filename, "%stextures/%s", gamedir, mip_prefix );
Q_mkdir( filename );

View File

@ -1194,7 +1194,7 @@ void Cmd_Video( void ){
// build the dictionary
for ( frame = startframe ; ; frame++ )
{
printf( "counting ", frame );
printf( "counting %i", frame );
in = LoadFrame( base, frame, digits, &palette );
if ( !in.data ) {
break;
@ -1213,7 +1213,7 @@ void Cmd_Video( void ){
// compress it with the dictionary
for ( frame = startframe ; ; frame++ )
{
printf( "packing ", frame );
printf( "packing %i", frame );
in = LoadFrame( base, frame, digits, &palette );
if ( !in.data ) {
break;

View File

@ -900,7 +900,7 @@ int ParseNum( const char *str ){
// all output ends up through here
void FPrintf (int flag, char *buf)
{
printf(buf);
printf( "%s", buf );
}

View File

@ -67,7 +67,7 @@ xmlNodePtr xml_NodeForVec( vec3_t v ){
sprintf( buf, "%f %f %f", v[0], v[1], v[2] );
ret = xmlNewNode( NULL, "point" );
xmlNodeSetContent( ret, buf );
xmlNodeAddContent( ret, buf );
return ret;
}
@ -145,14 +145,14 @@ void xml_Select( char *msg, int entitynum, int brushnum, qboolean bError ){
// now build a proper "select" XML node
sprintf( buf, "Entity %i, Brush %i: %s", entitynum, brushnum, msg );
node = xmlNewNode( NULL, "select" );
xmlNodeSetContent( node, buf );
xmlNodeAddContent( node, buf );
level[0] = (int)'0' + ( bError ? SYS_ERR : SYS_WRN ) ;
level[1] = 0;
xmlSetProp( node, "level", (char *)&level );
// a 'select' information
sprintf( buf, "%i %i", entitynum, brushnum );
select = xmlNewNode( NULL, "brush" );
xmlNodeSetContent( select, buf );
xmlNodeAddContent( select, buf );
xmlAddChild( node, select );
xml_SendNode( node );
@ -172,14 +172,14 @@ void xml_Point( char *msg, vec3_t pt ){
char level[2];
node = xmlNewNode( NULL, "pointmsg" );
xmlNodeSetContent( node, msg );
xmlNodeAddContent( node, msg );
level[0] = (int)'0' + SYS_ERR;
level[1] = 0;
xmlSetProp( node, "level", (char *)&level );
// a 'point' node
sprintf( buf, "%g %g %g", pt[0], pt[1], pt[2] );
point = xmlNewNode( NULL, "point" );
xmlNodeSetContent( point, buf );
xmlNodeAddContent( point, buf );
xmlAddChild( node, point );
xml_SendNode( node );
@ -196,7 +196,7 @@ void xml_Winding( char *msg, vec3_t p[], int numpoints, qboolean die ){
int i;
node = xmlNewNode( NULL, "windingmsg" );
xmlNodeSetContent( node, msg );
xmlNodeAddContent( node, msg );
level[0] = (int)'0' + SYS_ERR;
level[1] = 0;
xmlSetProp( node, "level", (char *)&level );
@ -213,7 +213,7 @@ void xml_Winding( char *msg, vec3_t p[], int numpoints, qboolean die ){
}
winding = xmlNewNode( NULL, "winding" );
xmlNodeSetContent( winding, buf );
xmlNodeAddContent( winding, buf );
xmlAddChild( node, winding );
xml_SendNode( node );
@ -260,7 +260,7 @@ void FPrintf( int flag, char *buf ){
static qboolean bGotXML = false;
char level[2];
printf( buf );
printf( "%s", buf );
// the following part is XML stuff only.. but maybe we don't want that message to go down the XML pipe?
if ( flag == SYS_NOXML ) {
@ -282,7 +282,7 @@ void FPrintf( int flag, char *buf ){
bGotXML = true;
}
node = xmlNewNode( NULL, "message" );
xmlNodeSetContent( node, buf );
xmlNodeAddContent( node, buf );
level[0] = (int)'0' + flag;
level[1] = 0;
xmlSetProp( node, "level", (char *)&level );

View File

@ -70,7 +70,7 @@ xmlNodePtr xml_NodeForVec( vec3_t v ){
sprintf( buf, "%f %f %f", v[0], v[1], v[2] );
ret = xmlNewNode( NULL, (xmlChar*)"point" );
xmlNodeSetContent( ret, (xmlChar*)buf );
xmlNodeAddContent( ret, (xmlChar*)buf );
return ret;
}
@ -148,14 +148,14 @@ void xml_Select( char *msg, int entitynum, int brushnum, qboolean bError ){
// now build a proper "select" XML node
sprintf( buf, "Entity %i, Brush %i: %s", entitynum, brushnum, msg );
node = xmlNewNode( NULL, (xmlChar*)"select" );
xmlNodeSetContent( node, (xmlChar*)buf );
xmlNodeAddContent( node, (xmlChar*)buf );
level[0] = (int)'0' + ( bError ? SYS_ERR : SYS_WRN ) ;
level[1] = 0;
xmlSetProp( node, (xmlChar*)"level", (xmlChar *)&level );
// a 'select' information
sprintf( buf, "%i %i", entitynum, brushnum );
select = xmlNewNode( NULL, (xmlChar*)"brush" );
xmlNodeSetContent( select, (xmlChar*)buf );
xmlNodeAddContent( select, (xmlChar*)buf );
xmlAddChild( node, select );
xml_SendNode( node );
@ -175,14 +175,14 @@ void xml_Point( char *msg, vec3_t pt ){
char level[2];
node = xmlNewNode( NULL, (xmlChar*)"pointmsg" );
xmlNodeSetContent( node, (xmlChar*)msg );
xmlNodeAddContent( node, (xmlChar*)msg );
level[0] = (int)'0' + SYS_ERR;
level[1] = 0;
xmlSetProp( node, (xmlChar*)"level", (xmlChar *)&level );
// a 'point' node
sprintf( buf, "%g %g %g", pt[0], pt[1], pt[2] );
point = xmlNewNode( NULL, (xmlChar*)"point" );
xmlNodeSetContent( point, (xmlChar*)buf );
xmlNodeAddContent( point, (xmlChar*)buf );
xmlAddChild( node, point );
xml_SendNode( node );
@ -199,7 +199,7 @@ void xml_Winding( char *msg, vec3_t p[], int numpoints, qboolean die ){
int i;
node = xmlNewNode( NULL, (xmlChar*)"windingmsg" );
xmlNodeSetContent( node, (xmlChar*)msg );
xmlNodeAddContent( node, (xmlChar*)msg );
level[0] = (int)'0' + SYS_ERR;
level[1] = 0;
xmlSetProp( node, (xmlChar*)"level", (xmlChar *)&level );
@ -216,7 +216,7 @@ void xml_Winding( char *msg, vec3_t p[], int numpoints, qboolean die ){
}
winding = xmlNewNode( NULL, (xmlChar*)"winding" );
xmlNodeSetContent( winding, (xmlChar*)buf );
xmlNodeAddContent( winding, (xmlChar*)buf );
xmlAddChild( node, winding );
xml_SendNode( node );
@ -287,7 +287,7 @@ void FPrintf( int flag, char *buf ){
node = xmlNewNode( NULL, (xmlChar*)"message" );
{
gchar* utf8 = g_locale_to_utf8( buf, -1, NULL, NULL, NULL );
xmlNodeSetContent( node, (xmlChar*)utf8 );
xmlNodeAddContent( node, (xmlChar*)utf8 );
g_free( utf8 );
}
level[0] = (int)'0' + flag;

View File

@ -39,7 +39,11 @@
#else
#include <wtypes.h>
#include <io.h>
#ifndef R_OK
#define R_OK 04
#endif
#define S_ISDIR( mode ) ( mode & _S_IFDIR )
#define PATH_MAX 260
#endif

View File

@ -349,7 +349,7 @@ void ProcessWorldModel( void ){
Sys_FPrintf( SYS_NOXML, "**********************\n" );
polyline = LeakFile( tree );
leaknode = xmlNewNode( NULL, (xmlChar*)"message" );
xmlNodeSetContent( leaknode, (xmlChar*)"MAP LEAKED\n" );
xmlNodeAddContent( leaknode, (xmlChar*)"MAP LEAKED\n" );
xmlAddChild( leaknode, polyline );
level[0] = (int) '0' + SYS_ERR;
level[1] = 0;

View File

@ -712,7 +712,7 @@ int FogForBounds( vec3_t mins, vec3_t maxs, float epsilon ){
*/
void CreateMapFogs( void ){
int i;
int i, j;
entity_t *entity;
brush_t *brush;
fog_t *fog;
@ -759,10 +759,10 @@ void CreateMapFogs( void ){
VectorScale( fog->si->fogDir, -1.0f, invFogDir );
/* find the brush side */
for ( i = 0; i < brush->numsides; i++ )
for ( j = 0; j < brush->numsides; j++ )
{
if ( VectorCompare( invFogDir, mapplanes[ brush->sides[ i ].planenum ].normal ) ) {
fog->visibleSide = i;
if ( VectorCompare( invFogDir, mapplanes[ brush->sides[ j ].planenum ].normal ) ) {
fog->visibleSide = j;
//% Sys_Printf( "Brush num: %d Side num: %d\n", fog->brushNum, fog->visibleSide );
break;
}

View File

@ -580,7 +580,7 @@ static void RadSubdivideDiffuseLight( int lightmapNum, bspDrawSurface_t *ds, raw
VectorMA( light->origin, 1.0f, light->normal, light->origin );
light->dist = DotProduct( light->origin, normal );
/* optionally create a point splashsplash light for first pass */
/* optionally create a point backsplash light for first pass */
if ( original && si->backsplashFraction > 0 ) {
/* allocate a new point light */
splash = safe_malloc( sizeof( *splash ) );

View File

@ -1825,7 +1825,7 @@ static void SubsampleRawLuxel_r( rawLightmap_t *lm, trace_t *trace, vec3_t sampl
int b, samples, mapped, lighted;
int cluster[ 4 ];
vec4_t luxel[ 4 ];
vec3_t deluxel[ 3 ];
vec3_t deluxel[ 4 ];
vec3_t origin[ 4 ], normal[ 4 ];
float biasDirs[ 4 ][ 2 ] = { { -1.0f, -1.0f }, { 1.0f, -1.0f }, { -1.0f, 1.0f }, { 1.0f, 1.0f } };
vec3_t color, direction = { 0, 0, 0 }, total;
@ -3222,7 +3222,6 @@ void IlluminateVertexes( int num ){
void SetupBrushesFlags( int mask_any, int test_any, int mask_all, int test_all ){
int i, j, b;
unsigned int compileFlags, allCompileFlags;
qboolean inside;
bspBrush_t *brush;
bspBrushSide_t *side;
bspShader_t *shader;
@ -3249,10 +3248,9 @@ void SetupBrushesFlags( int mask_any, int test_any, int mask_all, int test_all )
brush = &bspBrushes[ b ];
/* check all sides */
inside = qtrue;
compileFlags = 0;
allCompileFlags = ~( 0u );
for ( j = 0; j < brush->numSides && inside; j++ )
for ( j = 0; j < brush->numSides; j++ )
{
/* do bsp shader calculations */
side = &bspBrushSides[ brush->firstSide + j ];

View File

@ -82,7 +82,7 @@ void FinishSurface( mapDrawSurface_t *ds ){
/* dummy check */
if ( ds->type <= SURFACE_BAD || ds->type >= NUM_SURFACE_TYPES || ds == NULL || ds->shaderInfo == NULL ) {
if ( ds == NULL || ds->shaderInfo == NULL || ds->type <= SURFACE_BAD || ds->type >= NUM_SURFACE_TYPES ) {
return;
}
@ -3368,7 +3368,7 @@ int AddSurfaceModels( mapDrawSurface_t *ds ){
alpha /= ds->numVerts;
centroid.color[ 0 ][ 0 ] = 0xFF;
centroid.color[ 0 ][ 1 ] = 0xFF;
centroid.color[ 0 ][ 2 ] = 0xFF;
//centroid.color[ 0 ][ 2 ] = 0xFF;
centroid.color[ 0 ][ 2 ] = ( alpha > 255.0f ? 0xFF : alpha );
/* head vert is centroid */

View File

@ -1705,8 +1705,12 @@ static void MetaTrianglesToSurface( int numPossibles, metaTriangle_t *possibles,
ClearBounds( ds->mins, ds->maxs );
/* clear verts/indexes */
memset( verts, 0, sizeof( verts ) );
memset( indexes, 0, sizeof( indexes ) );
// memset( verts, 0, sizeof( verts ) );
// memset( indexes, 0, sizeof( indexes ) );
//is more correct, but upper works ok too
memset( verts, 0, sizeof( *verts ) * maxSurfaceVerts );
memset( indexes, 0, sizeof( *indexes ) * maxSurfaceIndexes );
/* add the first triangle */
if ( AddMetaTriangleToSurface( ds, seed, qfalse ) ) {

View File

@ -603,7 +603,7 @@ int EdgeCompare( const void *elem1, const void *elem2 ) {
if ( d1 < d2 ) {
return -1;
}
if ( d2 > d1 ) {
if ( d1 > d2 ) {
return 1;
}
return 0;