Q3map2:
* fix: number of problems, found by Visual Studio's static code analyser
(76ea7385dd)
Radiant:
misc...
* fix of: convert group entity to diff one = entity w/o objects
* asking for game path at 1st start, even if one, specified in .game exists (auto picking could make confused)
* disabled game autodetecting: (~2min awaiting on w7 in non admin mode was confusing)
This commit is contained in:
parent
0fb65a91c7
commit
fe73dd74d0
|
|
@ -104,7 +104,8 @@ bool gamedetect_check_game( char *gamefile, const char *checkfile1, const char *
|
||||||
void gamedetect(){
|
void gamedetect(){
|
||||||
// if we're inside a Nexuiz install
|
// if we're inside a Nexuiz install
|
||||||
// default to nexuiz.game (unless the user used an option to inhibit this)
|
// default to nexuiz.game (unless the user used an option to inhibit this)
|
||||||
bool nogamedetect = false;
|
//bool nogamedetect = false;
|
||||||
|
bool nogamedetect = true;
|
||||||
int i;
|
int i;
|
||||||
for ( i = 1; i < g_argc - 1; ++i )
|
for ( i = 1; i < g_argc - 1; ++i )
|
||||||
if ( g_argv[i][0] == '-' ) {
|
if ( g_argv[i][0] == '-' ) {
|
||||||
|
|
|
||||||
|
|
@ -447,8 +447,10 @@ GtkWindow* BuildDialog(){
|
||||||
|
|
||||||
PathsDialog g_PathsDialog;
|
PathsDialog g_PathsDialog;
|
||||||
|
|
||||||
|
bool g_strEnginePath_was_empty_1st_start = false;
|
||||||
|
|
||||||
void EnginePath_verify(){
|
void EnginePath_verify(){
|
||||||
if ( !file_exists( g_strEnginePath.c_str() ) ) {
|
if ( !file_exists( g_strEnginePath.c_str() ) || g_strEnginePath_was_empty_1st_start ) {
|
||||||
g_PathsDialog.Create();
|
g_PathsDialog.Create();
|
||||||
g_PathsDialog.DoModal();
|
g_PathsDialog.DoModal();
|
||||||
g_PathsDialog.Destroy();
|
g_PathsDialog.Destroy();
|
||||||
|
|
@ -3365,7 +3367,10 @@ void MainFrame_Construct(){
|
||||||
GlobalPreferenceSystem().registerPreference( "YZWnd", WindowPositionTrackerImportStringCaller( g_posYZWnd ), WindowPositionTrackerExportStringCaller( g_posYZWnd ) );
|
GlobalPreferenceSystem().registerPreference( "YZWnd", WindowPositionTrackerImportStringCaller( g_posYZWnd ), WindowPositionTrackerExportStringCaller( g_posYZWnd ) );
|
||||||
GlobalPreferenceSystem().registerPreference( "XZWnd", WindowPositionTrackerImportStringCaller( g_posXZWnd ), WindowPositionTrackerExportStringCaller( g_posXZWnd ) );
|
GlobalPreferenceSystem().registerPreference( "XZWnd", WindowPositionTrackerImportStringCaller( g_posXZWnd ), WindowPositionTrackerExportStringCaller( g_posXZWnd ) );
|
||||||
|
|
||||||
|
GlobalPreferenceSystem().registerPreference( "EnginePath", CopiedStringImportStringCaller( g_strEnginePath ), CopiedStringExportStringCaller( g_strEnginePath ) );
|
||||||
|
if ( g_strEnginePath.empty() )
|
||||||
{
|
{
|
||||||
|
g_strEnginePath_was_empty_1st_start = true;
|
||||||
const char* ENGINEPATH_ATTRIBUTE =
|
const char* ENGINEPATH_ATTRIBUTE =
|
||||||
#if defined( WIN32 )
|
#if defined( WIN32 )
|
||||||
"enginepath_win32"
|
"enginepath_win32"
|
||||||
|
|
@ -3380,9 +3385,10 @@ void MainFrame_Construct(){
|
||||||
StringOutputStream path( 256 );
|
StringOutputStream path( 256 );
|
||||||
path << DirectoryCleaned( g_pGameDescription->getRequiredKeyValue( ENGINEPATH_ATTRIBUTE ) );
|
path << DirectoryCleaned( g_pGameDescription->getRequiredKeyValue( ENGINEPATH_ATTRIBUTE ) );
|
||||||
g_strEnginePath = path.c_str();
|
g_strEnginePath = path.c_str();
|
||||||
|
GlobalPreferenceSystem().registerPreference( "EnginePath", CopiedStringImportStringCaller( g_strEnginePath ), CopiedStringExportStringCaller( g_strEnginePath ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
GlobalPreferenceSystem().registerPreference( "EnginePath", CopiedStringImportStringCaller( g_strEnginePath ), CopiedStringExportStringCaller( g_strEnginePath ) );
|
|
||||||
|
|
||||||
g_Layout_viewStyle.useLatched();
|
g_Layout_viewStyle.useLatched();
|
||||||
g_Layout_enableDetachableMenus.useLatched();
|
g_Layout_enableDetachableMenus.useLatched();
|
||||||
|
|
|
||||||
|
|
@ -1595,40 +1595,51 @@ bool Map_SaveSelected( const char* filename ){
|
||||||
return MapResource_saveFile( MapFormat_forFile( filename ), GlobalSceneGraph().root(), Map_Traverse_Selected, filename );
|
return MapResource_saveFile( MapFormat_forFile( filename ), GlobalSceneGraph().root(), Map_Traverse_Selected, filename );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
class ParentSelectedBrushesToEntityWalker : public scene::Graph::Walker
|
class ParentSelectedBrushesToEntityWalker : public scene::Graph::Walker
|
||||||
{
|
{
|
||||||
scene::Node& m_parent;
|
scene::Node& m_parent;
|
||||||
|
mutable bool m_emptyOldParent;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
ParentSelectedBrushesToEntityWalker( scene::Node& parent ) : m_parent( parent ){
|
ParentSelectedBrushesToEntityWalker( scene::Node& parent ) : m_parent( parent ), m_emptyOldParent( false ){
|
||||||
}
|
}
|
||||||
bool pre( const scene::Path& path, scene::Instance& instance ) const {
|
bool pre( const scene::Path& path, scene::Instance& instance ) const {
|
||||||
if ( path.top().get_pointer() != &m_parent
|
if ( path.top().get_pointer() != &m_parent && ( Node_isPrimitive( path.top() ) || m_emptyOldParent ) ) {
|
||||||
&& Node_isPrimitive( path.top() ) ) {
|
|
||||||
Selectable* selectable = Instance_getSelectable( instance );
|
Selectable* selectable = Instance_getSelectable( instance );
|
||||||
if ( selectable != 0
|
if ( selectable && selectable->isSelected() && path.size() > 1 ) {
|
||||||
&& selectable->isSelected()
|
|
||||||
&& path.size() > 1 ) {
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
void post( const scene::Path& path, scene::Instance& instance ) const {
|
void post( const scene::Path& path, scene::Instance& instance ) const {
|
||||||
if ( path.top().get_pointer() != &m_parent
|
if ( path.top().get_pointer() == &m_parent )
|
||||||
&& Node_isPrimitive( path.top() ) ) {
|
return;
|
||||||
|
|
||||||
|
if ( Node_isPrimitive( path.top() ) ){
|
||||||
|
m_emptyOldParent = false;
|
||||||
Selectable* selectable = Instance_getSelectable( instance );
|
Selectable* selectable = Instance_getSelectable( instance );
|
||||||
if ( selectable != 0
|
|
||||||
&& selectable->isSelected()
|
if ( selectable && selectable->isSelected() && path.size() > 1 ){
|
||||||
&& path.size() > 1 ) {
|
|
||||||
scene::Node& parent = path.parent();
|
scene::Node& parent = path.parent();
|
||||||
if ( &parent != &m_parent ){
|
if ( &parent != &m_parent ){
|
||||||
NodeSmartReference node( path.top().get() );
|
NodeSmartReference node( path.top().get() );
|
||||||
Node_getTraversable( parent )->erase( node );
|
scene::Traversable* traversable_parent = Node_getTraversable( parent );
|
||||||
|
traversable_parent->erase( node );
|
||||||
Node_getTraversable( m_parent )->insert( node );
|
Node_getTraversable( m_parent )->insert( node );
|
||||||
|
if ( traversable_parent->empty() )
|
||||||
|
m_emptyOldParent = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else if ( m_emptyOldParent ){
|
||||||
|
m_emptyOldParent = false;
|
||||||
|
// delete empty entities
|
||||||
|
Entity* entity = Node_getEntity( path.top() );
|
||||||
|
if ( entity != 0 && path.top().get_pointer() != Map_FindWorldspawn( g_map ) && Node_getTraversable( path.top() )->empty() ) {
|
||||||
|
Path_deleteTop( path );
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -305,34 +305,32 @@ int m_uniformTextureMinSize;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
void getTextureWH( qtexture_t* tex, int *width, int *height ){
|
void getTextureWH( qtexture_t* tex, int &W, int &H ){
|
||||||
// Don't use uniform size
|
// Don't use uniform size
|
||||||
*width = (int)( tex->width * ( (float)m_textureScale / 100 ) );
|
W = (int)( tex->width * ( (float)m_textureScale / 100 ) );
|
||||||
*height = (int)( tex->height * ( (float)m_textureScale / 100 ) );
|
H = (int)( tex->height * ( (float)m_textureScale / 100 ) );
|
||||||
|
|
||||||
if ( g_TextureBrowser_fixedSize ){
|
if ( g_TextureBrowser_fixedSize ){
|
||||||
int W = *width;
|
|
||||||
int H = *height;
|
|
||||||
if ( W >= H ) {
|
if ( W >= H ) {
|
||||||
// Texture is square, or wider than it is tall
|
// Texture is square, or wider than it is tall
|
||||||
if ( W >= m_uniformTextureSize ){
|
if ( W >= m_uniformTextureSize ){
|
||||||
*width = m_uniformTextureSize;
|
H = m_uniformTextureSize * H / W;
|
||||||
*height = m_uniformTextureSize * H / W;
|
W = m_uniformTextureSize;
|
||||||
}
|
}
|
||||||
else if ( W <= m_uniformTextureMinSize ){
|
else if ( W <= m_uniformTextureMinSize ){
|
||||||
*width = m_uniformTextureMinSize;
|
H = m_uniformTextureMinSize * H / W;
|
||||||
*height = m_uniformTextureMinSize * H / W;
|
W = m_uniformTextureMinSize;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
// Texture taller than it is wide
|
// Texture taller than it is wide
|
||||||
if ( H >= m_uniformTextureSize ){
|
if ( H >= m_uniformTextureSize ){
|
||||||
*height = m_uniformTextureSize;
|
W = m_uniformTextureSize * W / H;
|
||||||
*width = m_uniformTextureSize * W / H;
|
H = m_uniformTextureSize;
|
||||||
}
|
}
|
||||||
else if ( H <= m_uniformTextureMinSize ){
|
else if ( H <= m_uniformTextureMinSize ){
|
||||||
*height = m_uniformTextureMinSize;
|
W = m_uniformTextureMinSize * W / H;
|
||||||
*width = m_uniformTextureMinSize * W / H;
|
H = m_uniformTextureMinSize;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -461,7 +459,7 @@ void Texture_NextPos( TextureBrowser& textureBrowser, TextureLayout& layout, qte
|
||||||
qtexture_t* q = current_texture;
|
qtexture_t* q = current_texture;
|
||||||
|
|
||||||
int nWidth, nHeight;
|
int nWidth, nHeight;
|
||||||
textureBrowser.getTextureWH( q, &nWidth, &nHeight );
|
textureBrowser.getTextureWH( q, nWidth, nHeight );
|
||||||
if ( layout.current_x + nWidth > textureBrowser.width - 8 && layout.current_row ) { // go to the next row unless the texture is the first on the row
|
if ( layout.current_x + nWidth > textureBrowser.width - 8 && layout.current_row ) { // go to the next row unless the texture is the first on the row
|
||||||
layout.current_x = 8;
|
layout.current_x = 8;
|
||||||
layout.current_y -= layout.current_row + TextureBrowser_fontHeight( textureBrowser ) + 4;
|
layout.current_y -= layout.current_row + TextureBrowser_fontHeight( textureBrowser ) + 4;
|
||||||
|
|
@ -574,7 +572,7 @@ void TextureBrowser_evaluateHeight( TextureBrowser& textureBrowser ){
|
||||||
int x, y;
|
int x, y;
|
||||||
Texture_NextPos( textureBrowser, layout, shader->getTexture(), &x, &y );
|
Texture_NextPos( textureBrowser, layout, shader->getTexture(), &x, &y );
|
||||||
int nWidth, nHeight;
|
int nWidth, nHeight;
|
||||||
textureBrowser.getTextureWH( shader->getTexture(), &nWidth, &nHeight );
|
textureBrowser.getTextureWH( shader->getTexture(), nWidth, nHeight );
|
||||||
textureBrowser.m_nTotalHeight = std::max( textureBrowser.m_nTotalHeight, abs( layout.current_y ) + TextureBrowser_fontHeight( textureBrowser ) + nHeight + 4 );
|
textureBrowser.m_nTotalHeight = std::max( textureBrowser.m_nTotalHeight, abs( layout.current_y ) + TextureBrowser_fontHeight( textureBrowser ) + nHeight + 4 );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -960,7 +958,7 @@ IShader* Texture_At( TextureBrowser& textureBrowser, int mx, int my ){
|
||||||
}
|
}
|
||||||
|
|
||||||
int nWidth, nHeight;
|
int nWidth, nHeight;
|
||||||
textureBrowser.getTextureWH( q, &nWidth, &nHeight );
|
textureBrowser.getTextureWH( q, nWidth, nHeight );
|
||||||
if ( mx > x && mx - x < nWidth
|
if ( mx > x && mx - x < nWidth
|
||||||
&& my < y && y - my < nHeight + TextureBrowser_fontHeight( textureBrowser ) ) {
|
&& my < y && y - my < nHeight + TextureBrowser_fontHeight( textureBrowser ) ) {
|
||||||
return shader;
|
return shader;
|
||||||
|
|
@ -1091,7 +1089,7 @@ void Texture_Draw( TextureBrowser& textureBrowser ){
|
||||||
}
|
}
|
||||||
|
|
||||||
int nWidth, nHeight;
|
int nWidth, nHeight;
|
||||||
textureBrowser.getTextureWH( q, &nWidth, &nHeight );
|
textureBrowser.getTextureWH( q, nWidth, nHeight );
|
||||||
|
|
||||||
if ( y != last_y ) {
|
if ( y != last_y ) {
|
||||||
last_y = y;
|
last_y = y;
|
||||||
|
|
|
||||||
|
|
@ -68,14 +68,19 @@ void IncDrawVerts(){
|
||||||
|
|
||||||
}
|
}
|
||||||
else if ( numBSPDrawVerts > numBSPDrawVertsBuffer ) {
|
else if ( numBSPDrawVerts > numBSPDrawVertsBuffer ) {
|
||||||
|
bspDrawVert_t *newBspDrawVerts;
|
||||||
|
|
||||||
numBSPDrawVertsBuffer *= 3; // multiply by 1.5
|
numBSPDrawVertsBuffer *= 3; // multiply by 1.5
|
||||||
numBSPDrawVertsBuffer /= 2;
|
numBSPDrawVertsBuffer /= 2;
|
||||||
|
|
||||||
bspDrawVerts = realloc( bspDrawVerts, sizeof( bspDrawVert_t ) * numBSPDrawVertsBuffer );
|
newBspDrawVerts = realloc( bspDrawVerts, sizeof( bspDrawVert_t ) * numBSPDrawVertsBuffer );
|
||||||
|
|
||||||
if ( !bspDrawVerts ) {
|
if ( !newBspDrawVerts ) {
|
||||||
|
free (bspDrawVerts);
|
||||||
Error( "realloc() failed (IncDrawVerts)" );
|
Error( "realloc() failed (IncDrawVerts)" );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bspDrawVerts = newBspDrawVerts;
|
||||||
}
|
}
|
||||||
|
|
||||||
memset( bspDrawVerts + ( numBSPDrawVerts - 1 ), 0, sizeof( bspDrawVert_t ) );
|
memset( bspDrawVerts + ( numBSPDrawVerts - 1 ), 0, sizeof( bspDrawVert_t ) );
|
||||||
|
|
|
||||||
|
|
@ -185,10 +185,10 @@ static void RadClipWindingEpsilon( radWinding_t *in, vec3_t normal, vec_t dist,
|
||||||
}
|
}
|
||||||
|
|
||||||
/* error check */
|
/* error check */
|
||||||
if ( front->numVerts > maxPoints || front->numVerts > maxPoints ) {
|
if ( front->numVerts > maxPoints ) {
|
||||||
Error( "RadClipWindingEpsilon: points exceeded estimate" );
|
Error( "RadClipWindingEpsilon: points exceeded estimate" );
|
||||||
}
|
}
|
||||||
if ( front->numVerts > MAX_POINTS_ON_WINDING || front->numVerts > MAX_POINTS_ON_WINDING ) {
|
if ( front->numVerts > MAX_POINTS_ON_WINDING ) {
|
||||||
Error( "RadClipWindingEpsilon: MAX_POINTS_ON_WINDING" );
|
Error( "RadClipWindingEpsilon: MAX_POINTS_ON_WINDING" );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -288,7 +288,7 @@ static void RadSample( int lightmapNum, bspDrawSurface_t *ds, rawLightmap_t *lm,
|
||||||
/* multiply by texture color */
|
/* multiply by texture color */
|
||||||
if ( !RadSampleImage( si->lightImage->pixels, si->lightImage->width, si->lightImage->height, rw->verts[ samples ].st, textureColor ) ) {
|
if ( !RadSampleImage( si->lightImage->pixels, si->lightImage->width, si->lightImage->height, rw->verts[ samples ].st, textureColor ) ) {
|
||||||
VectorCopy( si->averageColor, textureColor );
|
VectorCopy( si->averageColor, textureColor );
|
||||||
textureColor[ 4 ] = 255.0f;
|
textureColor[ 3 ] = 255.0f;
|
||||||
}
|
}
|
||||||
avgcolor = ( textureColor[ 0 ] + textureColor[ 1 ] + textureColor[ 2 ] ) / 3;
|
avgcolor = ( textureColor[ 0 ] + textureColor[ 1 ] + textureColor[ 2 ] ) / 3;
|
||||||
for ( i = 0; i < 3; i++ )
|
for ( i = 0; i < 3; i++ )
|
||||||
|
|
@ -374,7 +374,7 @@ static void RadSample( int lightmapNum, bspDrawSurface_t *ds, rawLightmap_t *lm,
|
||||||
/* multiply by texture color */
|
/* multiply by texture color */
|
||||||
if ( !RadSampleImage( si->lightImage->pixels, si->lightImage->width, si->lightImage->height, st, textureColor ) ) {
|
if ( !RadSampleImage( si->lightImage->pixels, si->lightImage->width, si->lightImage->height, st, textureColor ) ) {
|
||||||
VectorCopy( si->averageColor, textureColor );
|
VectorCopy( si->averageColor, textureColor );
|
||||||
textureColor[ 4 ] = 255;
|
textureColor[ 3 ] = 255;
|
||||||
}
|
}
|
||||||
avgcolor = ( textureColor[ 0 ] + textureColor[ 1 ] + textureColor[ 2 ] ) / 3;
|
avgcolor = ( textureColor[ 0 ] + textureColor[ 1 ] + textureColor[ 2 ] ) / 3;
|
||||||
for ( l = 0; l < 3; l++ ){
|
for ( l = 0; l < 3; l++ ){
|
||||||
|
|
|
||||||
|
|
@ -2166,6 +2166,10 @@ static void FindOutLightmaps( rawLightmap_t *lm ){
|
||||||
/* allocate LIGHTMAP_RESERVE_COUNT new output lightmaps */
|
/* allocate LIGHTMAP_RESERVE_COUNT new output lightmaps */
|
||||||
numOutLightmaps += LIGHTMAP_RESERVE_COUNT;
|
numOutLightmaps += LIGHTMAP_RESERVE_COUNT;
|
||||||
olm = safe_malloc( numOutLightmaps * sizeof( outLightmap_t ) );
|
olm = safe_malloc( numOutLightmaps * sizeof( outLightmap_t ) );
|
||||||
|
if ( !olm ){
|
||||||
|
Error( "FindOutLightmaps: Failed to allocate memory.\n" );
|
||||||
|
}
|
||||||
|
|
||||||
if ( outLightmaps != NULL && numOutLightmaps > LIGHTMAP_RESERVE_COUNT ) {
|
if ( outLightmaps != NULL && numOutLightmaps > LIGHTMAP_RESERVE_COUNT ) {
|
||||||
memcpy( olm, outLightmaps, ( numOutLightmaps - LIGHTMAP_RESERVE_COUNT ) * sizeof( outLightmap_t ) );
|
memcpy( olm, outLightmaps, ( numOutLightmaps - LIGHTMAP_RESERVE_COUNT ) * sizeof( outLightmap_t ) );
|
||||||
free( outLightmaps );
|
free( outLightmaps );
|
||||||
|
|
|
||||||
|
|
@ -789,7 +789,7 @@ typedef struct shaderInfo_s
|
||||||
sun_t *sun; /* ydnar */
|
sun_t *sun; /* ydnar */
|
||||||
|
|
||||||
vec3_t color; /* normalized color */
|
vec3_t color; /* normalized color */
|
||||||
vec3_t averageColor;
|
vec4_t averageColor;
|
||||||
byte lightStyle;
|
byte lightStyle;
|
||||||
|
|
||||||
/* vortex: per-surface floodlight */
|
/* vortex: per-surface floodlight */
|
||||||
|
|
|
||||||
|
|
@ -811,10 +811,12 @@ static void LoadShaderImages( shaderInfo_t *si ){
|
||||||
if ( VectorLength( si->color ) <= 0.0f ) {
|
if ( VectorLength( si->color ) <= 0.0f ) {
|
||||||
ColorNormalize( color, si->color );
|
ColorNormalize( color, si->color );
|
||||||
VectorScale( color, ( 1.0f / count ), si->averageColor );
|
VectorScale( color, ( 1.0f / count ), si->averageColor );
|
||||||
|
si->averageColor[ 3 ] = color[ 3 ] / count;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
VectorCopy( si->color, si->averageColor );
|
VectorCopy( si->color, si->averageColor );
|
||||||
|
si->averageColor[ 3 ] = 1.0f;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -952,7 +952,8 @@ void MakeEntityMetaTriangles( entity_t *e ){
|
||||||
|
|
||||||
typedef struct edge_s
|
typedef struct edge_s
|
||||||
{
|
{
|
||||||
vec3_t origin, edge;
|
vec3_t origin;
|
||||||
|
vec4_t edge;
|
||||||
vec_t length, kingpinLength;
|
vec_t length, kingpinLength;
|
||||||
int kingpin;
|
int kingpin;
|
||||||
vec4_t plane;
|
vec4_t plane;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user