code fixes

Radiant:

binds...
	* m1x2 on clipper point = do clip
menus...
	* misc->colors->opengl font selector
misc...
	* calculate farplane from g_MaxWorldCoord, g_MinWorldCoord (was const 32768)
	* 1.0f nearplane
	* numerous code fixes
This commit is contained in:
Garux 2017-08-02 09:25:58 +03:00
parent 65ca31fd44
commit e3fd576624
68 changed files with 333 additions and 314 deletions

View File

@ -23,10 +23,6 @@
#include "DBrush.h" #include "DBrush.h"
#ifdef WIN32
#pragma warning(disable : 4786)
#endif
#include <list> #include <list>
#include "str.h" #include "str.h"
@ -284,8 +280,12 @@ bool DBrush::BBoxCollision( DBrush* chkBrush ){
vec3_t min1, min2; vec3_t min1, min2;
vec3_t max1, max2; vec3_t max1, max2;
GetBounds( min1, max1 ); if( !GetBounds( min1, max1 ) ){
chkBrush->GetBounds( min2, max2 ); return false;
}
if( !chkBrush->GetBounds( min2, max2 ) ){
return false;
}
if ( min1[0] >= max2[0] ) { if ( min1[0] >= max2[0] ) {
return false; return false;
@ -558,8 +558,12 @@ bool DBrush::BBoxTouch( DBrush *chkBrush ){
vec3_t min1, min2; vec3_t min1, min2;
vec3_t max1, max2; vec3_t max1, max2;
GetBounds( min1, max1 ); if( !GetBounds( min1, max1 ) ){
chkBrush->GetBounds( min2, max2 ); return false;
}
if( !chkBrush->GetBounds( min2, max2 ) ){
return false;
}
if ( ( min1[0] - max2[0] ) > MAX_ROUND_ERROR ) { if ( ( min1[0] - max2[0] ) > MAX_ROUND_ERROR ) {
return false; return false;
@ -726,7 +730,9 @@ void DBrush::Rotate( vec3_t vOrigin, vec3_t vRotation ){
void DBrush::RotateAboutCentre( vec3_t vRotation ){ void DBrush::RotateAboutCentre( vec3_t vRotation ){
vec3_t min, max, centre; vec3_t min, max, centre;
GetBounds( min, max ); if( !GetBounds( min, max ) ){
return;
}
VectorAdd( min, max, centre ); VectorAdd( min, max, centre );
VectorScale( centre, 0.5f, centre ); VectorScale( centre, 0.5f, centre );

View File

@ -23,10 +23,6 @@
#include "DEntity.h" #include "DEntity.h"
#ifdef WIN32
#pragma warning(disable : 4786)
#endif
#include <list> #include <list>
#include "str.h" #include "str.h"

View File

@ -58,7 +58,7 @@ DMap::~DMap(){
ClearEntities(); ClearEntities();
} }
DEntity* DMap::AddEntity( char *classname, int ID ){ DEntity* DMap::AddEntity( const char *classname, int ID ){
DEntity* newEntity; DEntity* newEntity;
if ( ID == -1 ) { if ( ID == -1 ) {
newEntity = new DEntity( classname, m_nNextEntity++ ); newEntity = new DEntity( classname, m_nNextEntity++ );

View File

@ -45,7 +45,7 @@ DEntity* GetWorldSpawn();
void ClearEntities(); void ClearEntities();
DEntity* GetEntityForID( int ID ); DEntity* GetEntityForID( int ID );
DEntity* AddEntity( char* classname = "worldspawn", int ID = -1 ); DEntity* AddEntity( const char* classname = "worldspawn", int ID = -1 );
std::list<DEntity*> entityList; std::list<DEntity*> entityList;

View File

@ -483,8 +483,6 @@ std::list<DPatch> DPatch::SplitRows(){
std::list<DPatch> DPatch::Split(){ std::list<DPatch> DPatch::Split(){
std::list<DPatch> patchList; std::list<DPatch> patchList;
int i;
int x, y;
if ( height >= 5 ) { if ( height >= 5 ) {
std::list<DPatch> patchColList = SplitCols(); std::list<DPatch> patchColList = SplitCols();

View File

@ -59,10 +59,10 @@ void BobToolz_destroy(){
} }
// plugin name // plugin name
char* PLUGIN_NAME = "bobToolz"; const char* PLUGIN_NAME = "bobToolz";
// commands in the menu // commands in the menu
static char* PLUGIN_COMMANDS = "About...,-,Reset Textures...,PitOMatic,-,Vis Viewer,Brush Cleanup,Polygon Builder,Caulk Selection,-,Tree Planter,Drop Entity,Plot Splines,-,Merge Patches,Split patches,Split patches cols,Split patches rows,Turn edge"; static const char* PLUGIN_COMMANDS = "About...,-,Reset Textures...,PitOMatic,-,Vis Viewer,Brush Cleanup,Polygon Builder,Caulk Selection,-,Tree Planter,Drop Entity,Plot Splines,-,Merge Patches,Split patches,Split patches cols,Split patches rows,Turn edge";
// globals // globals
GtkWidget *g_pRadiantWnd = NULL; GtkWidget *g_pRadiantWnd = NULL;
@ -286,10 +286,10 @@ class BobToolzPluginDependencies :
public: public:
BobToolzPluginDependencies() : BobToolzPluginDependencies() :
GlobalEntityModuleRef( GlobalRadiant().getRequiredGameDescriptionKeyValue( "entities" ) ), GlobalEntityModuleRef( GlobalRadiant().getRequiredGameDescriptionKeyValue( "entities" ) ),
GlobalEntityClassManagerModuleRef( GlobalRadiant().getRequiredGameDescriptionKeyValue( "entityclass" ) ),
GlobalShadersModuleRef( GlobalRadiant().getRequiredGameDescriptionKeyValue( "shaders" ) ), GlobalShadersModuleRef( GlobalRadiant().getRequiredGameDescriptionKeyValue( "shaders" ) ),
GlobalBrushModuleRef( GlobalRadiant().getRequiredGameDescriptionKeyValue( "brushtypes" ) ), GlobalBrushModuleRef( GlobalRadiant().getRequiredGameDescriptionKeyValue( "brushtypes" ) ),
GlobalPatchModuleRef( GlobalRadiant().getRequiredGameDescriptionKeyValue( "patchtypes" ) ), GlobalPatchModuleRef( GlobalRadiant().getRequiredGameDescriptionKeyValue( "patchtypes" ) ){
GlobalEntityClassManagerModuleRef( GlobalRadiant().getRequiredGameDescriptionKeyValue( "entityclass" ) ){
} }
}; };

View File

@ -117,7 +117,7 @@ static void dialog_button_callback_settex( GtkWidget *widget, gpointer data ){
Data validation Routines Data validation Routines
---------------------------------*/ ---------------------------------*/
bool ValidateTextFloat( const char* pData, char* error_title, float* value ){ bool ValidateTextFloat( const char* pData, const char* error_title, float* value ){
if ( pData ) { if ( pData ) {
float testNum = (float)atof( pData ); float testNum = (float)atof( pData );
@ -136,7 +136,7 @@ bool ValidateTextFloat( const char* pData, char* error_title, float* value ){
return FALSE; return FALSE;
} }
bool ValidateTextFloatRange( const char* pData, float min, float max, char* error_title, float* value ){ bool ValidateTextFloatRange( const char* pData, float min, float max, const char* error_title, float* value ){
char error_buffer[256]; char error_buffer[256];
sprintf( error_buffer, "Please Enter A Floating Point Number Between %.3f and %.3f", min, max ); sprintf( error_buffer, "Please Enter A Floating Point Number Between %.3f and %.3f", min, max );
@ -158,7 +158,7 @@ bool ValidateTextFloatRange( const char* pData, float min, float max, char* erro
return FALSE; return FALSE;
} }
bool ValidateTextIntRange( const char* pData, int min, int max, char* error_title, int* value ){ bool ValidateTextIntRange( const char* pData, int min, int max, const char* error_title, int* value ){
char error_buffer[256]; char error_buffer[256];
sprintf( error_buffer, "Please Enter An Integer Between %i and %i", min, max ); sprintf( error_buffer, "Please Enter An Integer Between %i and %i", min, max );
@ -180,7 +180,7 @@ bool ValidateTextIntRange( const char* pData, int min, int max, char* error_titl
return FALSE; return FALSE;
} }
bool ValidateTextInt( const char* pData, char* error_title, int* value ){ bool ValidateTextInt( const char* pData, const char* error_title, int* value ){
if ( pData ) { if ( pData ) {
int testNum = atoi( pData ); int testNum = atoi( pData );
@ -603,7 +603,7 @@ EMessageBoxReturn DoBuildStairsBox( BuildStairsRS* rs ){
EMessageBoxReturn ret; EMessageBoxReturn ret;
int loop = 1; int loop = 1;
char *text = "Please set a value in the boxes below and press 'OK' to build the stairs"; const char *text = "Please set a value in the boxes below and press 'OK' to build the stairs";
window = gtk_window_new( GTK_WINDOW_TOPLEVEL ); window = gtk_window_new( GTK_WINDOW_TOPLEVEL );
@ -1917,7 +1917,7 @@ EMessageBoxReturn DoMakeChainBox( MakeChainRS* rs ){
EMessageBoxReturn ret; EMessageBoxReturn ret;
int loop = 1; int loop = 1;
char *text = "Please set a value in the boxes below and press 'OK' to make a chain"; const char *text = "Please set a value in the boxes below and press 'OK' to make a chain";
window = gtk_window_new( GTK_WINDOW_TOPLEVEL ); window = gtk_window_new( GTK_WINDOW_TOPLEVEL );

View File

@ -19,10 +19,6 @@
#include "funchandlers.h" #include "funchandlers.h"
#ifdef WIN32
#pragma warning(disable : 4786)
#endif
#include "dialogs/dialogs-gtk.h" #include "dialogs/dialogs-gtk.h"
#include <list> #include <list>

View File

@ -19,10 +19,6 @@
#include "lists.h" #include "lists.h"
#ifdef WIN32
#pragma warning(disable : 4786)
#endif
#include <glib.h> #include <glib.h>
#include "misc.h" #include "misc.h"

View File

@ -129,7 +129,7 @@ char* TranslateString( char *buf ){
std::size_t l = strlen( buf ); std::size_t l = strlen( buf );
char* out = buf2; char* out = buf2;
for ( int i = 0 ; i < l ; i++ ) for ( std::size_t i = 0 ; i < l ; i++ )
{ {
if ( buf[i] == '\n' ) { if ( buf[i] == '\n' ) {
*out++ = '\r'; *out++ = '\r';
@ -182,60 +182,7 @@ extern char* PLUGIN_NAME;
return buffer; return buffer;
}*/ }*/
#if defined ( POSIX ) #include "cmdlib.h"
// the bCreateConsole parameter is ignored on linux ..
bool Q_Exec( const char *pCmd, bool bCreateConsole ){
switch ( fork() )
{
case -1:
return false;
// Error ("CreateProcess failed");
break;
case 0:
#ifdef _DEBUG
printf( "Running system...\n" );
printf( "Command: %s\n", pCmd );
#endif
// NOTE: we could use that to detect when a step finishes. But then it
// would not work for remote compiling stuff.
// execlp (pCmd, pCmd, NULL);
system( pCmd );
printf( "system() returned" );
_exit( 0 );
break;
}
return true;
}
#endif
#ifdef WIN32
#include <windows.h>
bool Q_Exec( const char *pCmd, bool bCreateConsole ){
// G_DeWan: Don't know if this is needed for linux version
PROCESS_INFORMATION pi;
STARTUPINFO si = {0}; // Initialize all members to zero
si.cb = sizeof( STARTUPINFO ); // Set byte count
DWORD dwCreationFlags;
if ( bCreateConsole ) {
dwCreationFlags = CREATE_NEW_CONSOLE | NORMAL_PRIORITY_CLASS;
}
else{
dwCreationFlags = DETACHED_PROCESS | NORMAL_PRIORITY_CLASS;
}
for (; *pCmd == ' '; pCmd++ ) ;
if ( !CreateProcess( NULL, (char *)pCmd, NULL, NULL, false, dwCreationFlags, NULL, NULL, &si, &pi ) ) {
return false;
}
return true;
}
#endif
void StartBSP(){ void StartBSP(){
char exename[256]; char exename[256];
@ -252,7 +199,7 @@ void StartBSP(){
char command[1024]; char command[1024];
sprintf( command, "%s -nowater -fulldetail %s", exename, mapname ); sprintf( command, "%s -nowater -fulldetail %s", exename, mapname );
Q_Exec( command, true ); Q_Exec( NULL, command, NULL, false, true );
} }
class EntityWriteMiniPrt class EntityWriteMiniPrt

View File

@ -37,10 +37,10 @@ CPortalsRender render;
int compare( const void *arg1, const void *arg2 ){ int compare( const void *arg1, const void *arg2 ){
if ( portals.portal[*( (int *)arg1 )].dist > portals.portal[*( (int *)arg2 )].dist ) { if ( portals.portal[*( (const int *)arg1 )].dist > portals.portal[*( (const int *)arg2 )].dist ) {
return -1; return -1;
} }
else if ( portals.portal[*( (int *)arg1 )].dist < portals.portal[*( (int *)arg2 )].dist ) { else if ( portals.portal[*( (const int *)arg1 )].dist < portals.portal[*( (const int *)arg2 )].dist ) {
return 1; return 1;
} }
@ -61,7 +61,7 @@ bool CBspPortal::Build( char *def ){
char *c = def; char *c = def;
unsigned int n; unsigned int n;
int dummy1, dummy2; int dummy1, dummy2;
int res_cnt, i; int res_cnt = 0;
if ( portals.hint_flags ) { if ( portals.hint_flags ) {
res_cnt = sscanf( def, "%u %d %d %d", &point_count, &dummy1, &dummy2, (int *)&hint ); res_cnt = sscanf( def, "%u %d %d %d", &point_count, &dummy1, &dummy2, (int *)&hint );
@ -96,7 +96,7 @@ bool CBspPortal::Build( char *def ){
center.p[2] += point[n].p[2]; center.p[2] += point[n].p[2];
if ( n == 0 ) { if ( n == 0 ) {
for ( i = 0; i < 3; i++ ) for ( int i = 0; i < 3; i++ )
{ {
min[i] = point[n].p[i]; min[i] = point[n].p[i];
max[i] = point[n].p[i]; max[i] = point[n].p[i];
@ -104,7 +104,7 @@ bool CBspPortal::Build( char *def ){
} }
else else
{ {
for ( i = 0; i < 3; i++ ) for ( int i = 0; i < 3; i++ )
{ {
if ( min[i] > point[n].p[i] ) { if ( min[i] > point[n].p[i] ) {
min[i] = point[n].p[i]; min[i] = point[n].p[i];
@ -603,7 +603,7 @@ void CPortalsDrawSolid::render( RenderStateFlags state ) const {
} }
void CPortalsDrawSolidOutline::render( RenderStateFlags state ) const { void CPortalsDrawSolidOutline::render( RenderStateFlags state ) const {
for ( int n = 0; n < portals.portal_count; n++ ) for ( unsigned int n = 0; n < portals.portal_count; n++ )
{ {
if ( portals.lines == 2 && !portals.portal[n].hint ) { if ( portals.lines == 2 && !portals.portal[n].hint ) {
continue; continue;
@ -632,7 +632,7 @@ void CPortalsDrawSolidOutline::render( RenderStateFlags state ) const {
glBegin( GL_LINE_LOOP ); glBegin( GL_LINE_LOOP );
for ( int p = 0; p < portals.portal[n].point_count; p++ ) for ( unsigned int p = 0; p < portals.portal[n].point_count; p++ )
glVertex3fv( portals.portal[n].inner_point[p].p ); glVertex3fv( portals.portal[n].inner_point[p].p );
glEnd(); glEnd();

View File

@ -48,23 +48,23 @@ CopiedString INIfn;
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
// CPrtViewApp construction // CPrtViewApp construction
#define RENDER_2D "Render2D" const char RENDER_2D[] = "Render2D";
#define WIDTH_2D "Width2D" const char WIDTH_2D[] = "Width2D";
#define AA_2D "AntiAlias2D" const char AA_2D[] = "AntiAlias2D";
#define COLOR_2D "Color2D" const char COLOR_2D[] = "Color2D";
#define RENDER_3D "Render3D" const char RENDER_3D[] = "Render3D";
#define WIDTH_3D "Width3D" const char WIDTH_3D[] = "Width3D";
#define AA_3D "AntiAlias3D" const char AA_3D[] = "AntiAlias3D";
#define COLOR_3D "Color3D" const char COLOR_3D[] = "Color3D";
#define COLOR_FOG "ColorFog" const char COLOR_FOG[] = "ColorFog";
#define FOG "Fog" const char FOG[] = "Fog";
#define ZBUFFER "ZBuffer" const char ZBUFFER[] = "ZBuffer";
#define POLYGON "Polygons" const char POLYGON[] = "Polygons";
#define LINE "Lines" const char LINE[] = "Lines";
#define TRANS_3D "Transparency" const char TRANS_3D[] = "Transparency";
#define CLIP_RANGE "ClipRange" const char CLIP_RANGE[] = "ClipRange";
#define CLIP "Clip" const char CLIP[] = "Clip";
void PrtView_construct(){ void PrtView_construct(){
@ -160,9 +160,9 @@ void SaveConfig(){
} }
#define CONFIG_SECTION "Configuration" const char CONFIG_SECTION[] = "Configuration";
int INIGetInt( char *key, int def ){ int INIGetInt( const char *key, int def ){
char value[1024]; char value[1024];
if ( read_var( INIfn.c_str(), CONFIG_SECTION, key, value ) ) { if ( read_var( INIfn.c_str(), CONFIG_SECTION, key, value ) ) {
@ -173,7 +173,7 @@ int INIGetInt( char *key, int def ){
} }
} }
void INISetInt( char *key, int val, char *comment /* = NULL */ ){ void INISetInt( const char *key, int val, const char *comment /* = NULL */ ){
char s[1000]; char s[1000];
if ( comment ) { if ( comment ) {

View File

@ -25,8 +25,8 @@
void InitInstance(); void InitInstance();
void SaveConfig(); void SaveConfig();
int INIGetInt( char *key, int def ); int INIGetInt( const char *key, int def );
void INISetInt( char *key, int val, char *comment = 0 ); void INISetInt( const char *key, int val, const char *comment = 0 );
typedef struct _GtkWidget GtkWidget; typedef struct _GtkWidget GtkWidget;
extern GtkWidget *g_pRadiantWnd; extern GtkWidget *g_pRadiantWnd;

View File

@ -118,7 +118,7 @@ void LoadTextureFile( const char* filename ){
typedef FreeCaller1<const char*, LoadTextureFile> LoadTextureFileCaller; typedef FreeCaller1<const char*, LoadTextureFile> LoadTextureFileCaller;
void GetTextures( char* extension ){ void GetTextures( const char* extension ){
GlobalFileSystem().forEachFile( "textures/", extension, LoadTextureFileCaller(), 0 ); GlobalFileSystem().forEachFile( "textures/", extension, LoadTextureFileCaller(), 0 );
} }

View File

@ -36,6 +36,7 @@ UFOAIGtk( void* gtk_window ) : m_gtk_window( ( GtkWindow* )gtk_window ){
} }
}; };
#if 0
/** /**
* @brief If you return FALSE in the "delete_event" signal handler, * @brief If you return FALSE in the "delete_event" signal handler,
* GTK will emit the "destroy" signal. Returning TRUE means * GTK will emit the "destroy" signal. Returning TRUE means
@ -60,6 +61,7 @@ static void destroy( GtkWidget *widget, gpointer data ){
static void close_window( GtkWidget *widget, gpointer data ){ static void close_window( GtkWidget *widget, gpointer data ){
gtk_widget_destroy( gtk_widget_get_toplevel( widget ) ); gtk_widget_destroy( gtk_widget_get_toplevel( widget ) );
} }
#endif
/* =============================== */ /* =============================== */

View File

@ -27,7 +27,13 @@
#include "iscenegraph.h" #include "iscenegraph.h"
#include "generic/callbackfwd.h" #include "generic/callbackfwd.h"
const std::size_t MAPFILE_MAX_CHANGES = std::numeric_limits<std::size_t>::max(); #ifdef __GNUC__
#define VARIABLE_IS_NOT_USED __attribute__ ((unused))
#else
#define VARIABLE_IS_NOT_USED
#endif
const std::size_t VARIABLE_IS_NOT_USED MAPFILE_MAX_CHANGES = std::numeric_limits<std::size_t>::max();
class MapFile class MapFile
{ {

View File

@ -48,7 +48,7 @@ enum EStyle
virtual void PushState() = 0; virtual void PushState() = 0;
virtual void PopState() = 0; virtual void PopState() = 0;
virtual void SetState( Shader* state, EStyle mode ) = 0; virtual void SetState( Shader* state, EStyle mode ) = 0;
virtual const EStyle getStyle() const = 0; virtual EStyle getStyle() const = 0;
virtual void Highlight( EHighlightMode mode, bool bEnable = true ) = 0; virtual void Highlight( EHighlightMode mode, bool bEnable = true ) = 0;
virtual void setLights( const LightList& lights ){ virtual void setLights( const LightList& lights ){
} }

View File

@ -92,7 +92,7 @@ bool Q_Exec( const char *cmd, char *cmdline, const char *, bool, bool waitfor ){
// NOTE TTimo windows is VERY nitpicky about the syntax in CreateProcess // NOTE TTimo windows is VERY nitpicky about the syntax in CreateProcess
bool Q_Exec( const char *cmd, char *cmdline, const char *execdir, bool bCreateConsole, bool waitfor ){ bool Q_Exec( const char *cmd, char *cmdline, const char *execdir, bool bCreateConsole, bool waitfor ){
PROCESS_INFORMATION ProcessInformation; PROCESS_INFORMATION ProcessInformation;
STARTUPINFO startupinfo = {0}; STARTUPINFO startupinfo;
DWORD dwCreationFlags; DWORD dwCreationFlags;
GetStartupInfo( &startupinfo ); GetStartupInfo( &startupinfo );
if ( bCreateConsole ) { if ( bCreateConsole ) {

View File

@ -369,6 +369,17 @@ GLFont *glfont_create( const char* font_string ){
font = gdk_gl_font_use_pango_font( font_desc, 0, 256, font_list_base ); font = gdk_gl_font_use_pango_font( font_desc, 0, 256, font_list_base );
} }
if ( font == 0 ) {
pango_font_description_free( font_desc );
GtkSettings *settings = gtk_settings_get_default();
gchar *fontname;
g_object_get( settings, "gtk-font-name", &fontname, NULL );
font_desc = pango_font_description_from_string( fontname );
font = gdk_gl_font_use_pango_font( font_desc, 0, 256, font_list_base );
}
if ( font != 0 ) { if ( font != 0 ) {
PangoFontMap *fontmap = pango_ft2_font_map_new(); PangoFontMap *fontmap = pango_ft2_font_map_new();

View File

@ -245,7 +245,13 @@ inline void aabb_planes_oriented( const AABB& aabb, const Matrix4& rotation, Pla
planes[5] = Plane3( -vector4_to_vector3( rotation.z() ), -( z - aabb.extents[2] ) ); planes[5] = Plane3( -vector4_to_vector3( rotation.z() ), -( z - aabb.extents[2] ) );
} }
const Vector3 aabb_normals[6] = { #ifdef __GNUC__
#define VARIABLE_IS_NOT_USED __attribute__ ((unused))
#else
#define VARIABLE_IS_NOT_USED
#endif
const Vector3 VARIABLE_IS_NOT_USED aabb_normals[6] = {
Vector3( 1, 0, 0 ), Vector3( 1, 0, 0 ),
Vector3( 0, 1, 0 ), Vector3( 0, 1, 0 ),
Vector3( 0, 0, 1 ), Vector3( 0, 0, 1 ),

View File

@ -279,7 +279,13 @@ const Vector3 g_vector3_axis_x( 1, 0, 0 );
const Vector3 g_vector3_axis_y( 0, 1, 0 ); const Vector3 g_vector3_axis_y( 0, 1, 0 );
const Vector3 g_vector3_axis_z( 0, 0, 1 ); const Vector3 g_vector3_axis_z( 0, 0, 1 );
const Vector3 g_vector3_axes[3] = { g_vector3_axis_x, g_vector3_axis_y, g_vector3_axis_z }; #ifdef __GNUC__
#define VARIABLE_IS_NOT_USED __attribute__ ((unused))
#else
#define VARIABLE_IS_NOT_USED
#endif
const Vector3 VARIABLE_IS_NOT_USED g_vector3_axes[3] = { g_vector3_axis_x, g_vector3_axis_y, g_vector3_axis_z };
template<typename Element, typename OtherElement> template<typename Element, typename OtherElement>
inline void vector3_swap( BasicVector3<Element>& self, BasicVector3<OtherElement>& other ){ inline void vector3_swap( BasicVector3<Element>& self, BasicVector3<OtherElement>& other ){

View File

@ -22,7 +22,9 @@
read requests until flen is reset. read requests until flen is reset.
====================================================================== */ ====================================================================== */
#define INT_MIN ( -2147483647 - 1 ) /* minimum (signed) int value */ #ifndef INT_MIN
#define INT_MIN ( -2147483647 - 1 ) /* minimum (signed) int value */
#endif
#define FLEN_ERROR INT_MIN #define FLEN_ERROR INT_MIN
static int flen; static int flen;

View File

@ -11,7 +11,7 @@
#include "lwo2.h" #include "lwo2.h"
/* disable warnings */ /* disable warnings */
#ifdef WIN32 #ifdef _MSC_VER
#pragma warning( disable:4018 ) /* signed/unsigned mismatch */ #pragma warning( disable:4018 ) /* signed/unsigned mismatch */
#endif #endif

View File

@ -12,7 +12,7 @@
#include "lwo2.h" #include "lwo2.h"
/* disable warnings */ /* disable warnings */
#ifdef WIN32 #ifdef _MSC_VER
#pragma warning( disable:4018 ) /* signed/unsigned mismatch */ #pragma warning( disable:4018 ) /* signed/unsigned mismatch */
#endif #endif

View File

@ -41,7 +41,7 @@
#include "picointernal.h" #include "picointernal.h"
/* disable warnings */ /* disable warnings */
#ifdef WIN32 #ifdef _MSC_VER
#pragma warning( disable:4100 ) /* unref param */ #pragma warning( disable:4100 ) /* unref param */
#endif #endif

View File

@ -41,7 +41,7 @@
#include "picointernal.h" #include "picointernal.h"
/* disable warnings */ /* disable warnings */
#ifdef WIN32 #ifdef _MSC_VER
#pragma warning( disable:4100 ) /* unref param */ #pragma warning( disable:4100 ) /* unref param */
#endif #endif
@ -508,7 +508,7 @@ static picoModel_t *_obj_load( PM_PARAMS_LOAD ){
picoModel_t *model; picoModel_t *model;
picoSurface_t *curSurface = NULL; picoSurface_t *curSurface = NULL;
picoParser_t *p; picoParser_t *p;
int allocated; int allocated = 0;
int entries; int entries;
int numVerts = 0; int numVerts = 0;
int numNormals = 0; int numNormals = 0;

View File

@ -175,7 +175,7 @@ MemStream::size_type MemStream::write( const byte_type* buffer, size_type length
GrowFile( m_nPosition + length ); GrowFile( m_nPosition + length );
} }
memcpy( (unsigned char*)m_pBuffer + m_nPosition, (unsigned char*)buffer, length ); memcpy( (unsigned char*)m_pBuffer + m_nPosition, (const unsigned char*)buffer, length );
m_nPosition += size_type( length ); m_nPosition += size_type( length );
@ -271,7 +271,7 @@ int MemStream::Seek( offset_type lOff, int nFrom ){
lNewPos = m_nFileSize + lOff; lNewPos = m_nFileSize + lOff;
} }
else{ else{
return ( position_type ) - 1; return -1;
} }
m_nPosition = lNewPos; m_nPosition = lNewPos;

View File

@ -252,7 +252,7 @@ bool profile_load_buffer( const char * rc_path, const char *name, void *buffer,
fclose( f ); fclose( f );
} }
return true; return ret;
} }
int profile_load_int( const char *filename, const char *section, const char *key, int default_value ){ int profile_load_int( const char *filename, const char *section, const char *key, int default_value ){

View File

@ -171,7 +171,7 @@ RenderIndex m_prev0;
RenderIndex m_prev1; RenderIndex m_prev1;
RenderIndex m_prev2; RenderIndex m_prev2;
const RenderIndex find_or_insert( const Vertex& vertex ){ RenderIndex find_or_insert( const Vertex& vertex ){
RenderIndex index = 0; RenderIndex index = 0;
while ( 1 ) while ( 1 )

View File

@ -254,7 +254,7 @@ const char* Left( std::size_t n ){
} }
else else
{ {
g_pStrWork = ""; //g_pStrWork = "";
g_pStrWork = new char[1]; g_pStrWork = new char[1];
g_pStrWork[0] = '\0'; g_pStrWork[0] = '\0';
} }
@ -290,7 +290,7 @@ const char* Mid( std::size_t first, std::size_t n ) const {
} }
else else
{ {
g_pStrWork = ""; //g_pStrWork = "";
g_pStrWork = new char[1]; g_pStrWork = new char[1];
g_pStrWork[0] = '\0'; g_pStrWork[0] = '\0';
} }
@ -429,7 +429,7 @@ bool operator >( char* pStr ) const { return ( m_bIgnoreCase ) ? stricmp( m_pStr
bool operator >( const char* pStr ) const { return ( m_bIgnoreCase ) ? stricmp( m_pStr, pStr ) > 0 : strcmp( m_pStr, pStr ) > 0; } bool operator >( const char* pStr ) const { return ( m_bIgnoreCase ) ? stricmp( m_pStr, pStr ) > 0 : strcmp( m_pStr, pStr ) > 0; }
char& operator []( std::size_t nIndex ) { return m_pStr[nIndex]; } char& operator []( std::size_t nIndex ) { return m_pStr[nIndex]; }
const char& operator []( std::size_t nIndex ) const { return m_pStr[nIndex]; } const char& operator []( std::size_t nIndex ) const { return m_pStr[nIndex]; }
const char GetAt( std::size_t nIndex ) { return m_pStr[nIndex]; } char GetAt( std::size_t nIndex ) { return m_pStr[nIndex]; }
}; };

View File

@ -187,7 +187,7 @@ XMLStreamParser( TextInputStream& istream )
: m_istream( istream ){ : m_istream( istream ){
} }
virtual void exportXML( XMLImporter& importer ){ virtual void exportXML( XMLImporter& importer ){
bool wellFormed = false; //bool wellFormed = false;
char chars[BUFSIZE]; char chars[BUFSIZE];
std::size_t res = m_istream.read( chars, 4 ); std::size_t res = m_istream.read( chars, 4 );
@ -203,7 +203,7 @@ virtual void exportXML( XMLImporter& importer ){
} }
xmlParseChunk( ctxt, chars, 0, 1 ); xmlParseChunk( ctxt, chars, 0, 1 );
wellFormed = ( ctxt->wellFormed == 1 ); //wellFormed = ( ctxt->wellFormed == 1 );
xmlFreeParserCtxt( ctxt ); xmlFreeParserCtxt( ctxt );
} }

View File

@ -49,16 +49,16 @@ bool XmlTagBuilder::CreateXmlDocument(){
xmlTextWriterStartDocument( writer, NULL, "UTF-8", NULL ); xmlTextWriterStartDocument( writer, NULL, "UTF-8", NULL );
// create the root node with stock and custom elements // create the root node with stock and custom elements
xmlTextWriterStartElement( writer, (xmlChar*)"root" ); xmlTextWriterStartElement( writer, (const xmlChar*)"root" );
xmlTextWriterWriteString( writer, (xmlChar*)"\n " ); xmlTextWriterWriteString( writer, (const xmlChar*)"\n " );
xmlTextWriterStartElement( writer, (xmlChar*)"stock" ); xmlTextWriterStartElement( writer, (const xmlChar*)"stock" );
xmlTextWriterWriteString( writer, (xmlChar*)"\n " ); xmlTextWriterWriteString( writer, (const xmlChar*)"\n " );
xmlTextWriterEndElement( writer ); xmlTextWriterEndElement( writer );
xmlTextWriterWriteString( writer, (xmlChar*)"\n " ); xmlTextWriterWriteString( writer, (const xmlChar*)"\n " );
xmlTextWriterStartElement( writer, (xmlChar*)"custom" ); xmlTextWriterStartElement( writer, (const xmlChar*)"custom" );
xmlTextWriterWriteString( writer, (xmlChar*)"\n " ); xmlTextWriterWriteString( writer, (const xmlChar*)"\n " );
xmlTextWriterEndElement( writer ); xmlTextWriterEndElement( writer );
xmlTextWriterWriteString( writer, (xmlChar*)"\n" ); xmlTextWriterWriteString( writer, (const xmlChar*)"\n" );
xmlTextWriterEndElement( writer ); xmlTextWriterEndElement( writer );
// end of the xml document // end of the xml document
@ -151,26 +151,28 @@ bool XmlTagBuilder::AddShaderNode( const char* shader, TextureType textureType,
switch ( nodeShaderType ) switch ( nodeShaderType )
{ {
case SHADER: case SHADER:
newnode = xmlNewNode( NULL, (xmlChar*)"shader" ); newnode = xmlNewNode( NULL, (const xmlChar*)"shader" );
break; break;
case TEXTURE: case TEXTURE:
newnode = xmlNewNode( NULL, (xmlChar*)"texture" ); default:
newnode = xmlNewNode( NULL, (const xmlChar*)"texture" );
break;
}; };
newnode = xmlDocCopyNode( newnode, doc, 1 ); newnode = xmlDocCopyNode( newnode, doc, 1 );
xmlSetProp( newnode, (xmlChar*)"path", (xmlChar*)shader ); xmlSetProp( newnode, (const xmlChar*)"path", (const xmlChar*)shader );
xmlNodeSetContent( newnode, (xmlChar*)"\n " ); xmlNodeSetContent( newnode, (const xmlChar*)"\n " );
if ( nodePtr->nodeTab[0]->children->next == NULL ) { // there are no shaders yet if ( nodePtr->nodeTab[0]->children->next == NULL ) { // there are no shaders yet
// add spaces // add spaces
newtext = xmlNewText( (xmlChar*)" " ); newtext = xmlNewText( (const xmlChar*)" " );
xmlAddChild( nodeParent->children, newtext ); xmlAddChild( nodeParent->children, newtext );
// add the new node // add the new node
xmlAddNextSibling( nodeParent->children, newnode ); xmlAddNextSibling( nodeParent->children, newnode );
// append a new line // append a new line
newtext = xmlNewText( (xmlChar*)"\n " ); newtext = xmlNewText( (const xmlChar*)"\n " );
xmlAddNextSibling( nodeParent->children->next, newtext ); xmlAddNextSibling( nodeParent->children->next, newtext );
} }
else { else {
@ -178,7 +180,7 @@ bool XmlTagBuilder::AddShaderNode( const char* shader, TextureType textureType,
xmlAddNextSibling( nodeParent->children, newnode ); xmlAddNextSibling( nodeParent->children, newnode );
// append a new line and spaces // append a new line and spaces
newtext = xmlNewText( (xmlChar*)"\n " ); newtext = xmlNewText( (const xmlChar*)"\n " );
xmlAddNextSibling( nodeParent->children->next, newtext ); xmlAddNextSibling( nodeParent->children->next, newtext );
} }
@ -327,26 +329,26 @@ bool XmlTagBuilder::AddShaderTag( const char* shader, const char* content, NodeT
} }
if ( !xmlXPathNodeSetIsEmpty( nodePtr ) ) { // node was found if ( !xmlXPathNodeSetIsEmpty( nodePtr ) ) { // node was found
xmlNodePtr newnode = xmlNewNode( NULL, (xmlChar*)"tag" ); xmlNodePtr newnode = xmlNewNode( NULL, (const xmlChar*)"tag" );
xmlNodePtr nodeParent = nodePtr->nodeTab[0]; xmlNodePtr nodeParent = nodePtr->nodeTab[0];
newnode = xmlDocCopyNode( newnode, doc, 1 ); newnode = xmlDocCopyNode( newnode, doc, 1 );
xmlNodeSetContent( newnode, (xmlChar*)content ); xmlNodeSetContent( newnode, (const xmlChar*)content );
if ( nodePtr->nodeTab[0]->children->next == NULL ) { // shader node has NO children if ( nodePtr->nodeTab[0]->children->next == NULL ) { // shader node has NO children
// add spaces // add spaces
xmlNodePtr newtext = xmlNewText( (xmlChar*)" " ); xmlNodePtr newtext = xmlNewText( (const xmlChar*)" " );
xmlAddChild( nodeParent->children, newtext ); xmlAddChild( nodeParent->children, newtext );
// add new node // add new node
xmlAddNextSibling( nodeParent->children, newnode ); xmlAddNextSibling( nodeParent->children, newnode );
// append a new line + spaces // append a new line + spaces
newtext = xmlNewText( (xmlChar*)"\n " ); newtext = xmlNewText( (const xmlChar*)"\n " );
xmlAddNextSibling( nodeParent->children->next, newtext ); xmlAddNextSibling( nodeParent->children->next, newtext );
} }
else { // shader node has children already - the new node will be the first sibling else { // shader node has children already - the new node will be the first sibling
xmlAddNextSibling( nodeParent->children, newnode ); xmlAddNextSibling( nodeParent->children, newnode );
xmlNodePtr newtext = xmlNewText( (xmlChar*)"\n " ); xmlNodePtr newtext = xmlNewText( (const xmlChar*)"\n " );
xmlAddNextSibling( nodeParent->children->next, newtext ); xmlAddNextSibling( nodeParent->children->next, newtext );
} }
xmlXPathFreeObject( xpathPtr ); xmlXPathFreeObject( xpathPtr );
@ -376,7 +378,7 @@ int XmlTagBuilder::RenameShaderTag( const char* oldtag, CopiedString newtag ){
strcat( expression, oldtag ); strcat( expression, oldtag );
strcat( expression, "']/*" ); strcat( expression, "']/*" );
xmlXPathObjectPtr result = xmlXPathEvalExpression( (xmlChar*)expression, context ); xmlXPathObjectPtr result = xmlXPathEvalExpression( (const xmlChar*)expression, context );
if ( !result ) { if ( !result ) {
return 0; return 0;
} }
@ -388,7 +390,7 @@ int XmlTagBuilder::RenameShaderTag( const char* oldtag, CopiedString newtag ){
char* content = (char*)xmlNodeGetContent( ptrContent ); char* content = (char*)xmlNodeGetContent( ptrContent );
if ( strcmp( content, oldtag ) == 0 ) { // found a node with old content? if ( strcmp( content, oldtag ) == 0 ) { // found a node with old content?
xmlNodeSetContent( ptrContent, (xmlChar*)newtag.c_str() ); xmlNodeSetContent( ptrContent, (const xmlChar*)newtag.c_str() );
num++; num++;
} }
} }
@ -476,7 +478,7 @@ void XmlTagBuilder::GetShaderTags( const char* shader, std::vector<CopiedString>
returns a vector containing the tags returns a vector containing the tags
*/ */
char* expression; const char* expression;
if ( shader == NULL ) { // get all tags from all shaders if ( shader == NULL ) { // get all tags from all shaders
expression = "/root/*/*/tag"; expression = "/root/*/*/tag";
@ -510,7 +512,7 @@ void XmlTagBuilder::GetUntagged( std::set<CopiedString>& shaders ){
returns a set containing the shaders (with path) returns a set containing the shaders (with path)
*/ */
char* expression = "/root/*/*[not(child::tag)]"; const char* expression = "/root/*/*[not(child::tag)]";
xmlXPathObjectPtr xpathPtr = XpathEval( expression ); xmlXPathObjectPtr xpathPtr = XpathEval( expression );
xmlNodeSetPtr nodePtr; xmlNodeSetPtr nodePtr;
@ -527,7 +529,7 @@ void XmlTagBuilder::GetUntagged( std::set<CopiedString>& shaders ){
for ( int i = 0; i < nodePtr->nodeNr; i++ ) for ( int i = 0; i < nodePtr->nodeNr; i++ )
{ {
ptr = nodePtr->nodeTab[i]; ptr = nodePtr->nodeTab[i];
shaders.insert( (char*)xmlGetProp( ptr, (xmlChar*)"path" ) ); shaders.insert( (char*)xmlGetProp( ptr, (const xmlChar*)"path" ) );
} }
} }
@ -540,7 +542,7 @@ void XmlTagBuilder::GetAllTags( std::set<CopiedString>& tags ){
returns a set containing all used tags returns a set containing all used tags
*/ */
char* expression = "/root/*/*/tag"; const char* expression = "/root/*/*/tag";
xmlXPathObjectPtr xpathPtr = XpathEval( expression ); xmlXPathObjectPtr xpathPtr = XpathEval( expression );
xmlNodeSetPtr nodePtr; xmlNodeSetPtr nodePtr;
@ -584,7 +586,7 @@ void XmlTagBuilder::TagSearch( const char* expression, std::set<CopiedString>& p
for ( int i = 0; i < nodePtr->nodeNr; i++ ) for ( int i = 0; i < nodePtr->nodeNr; i++ )
{ {
ptr = nodePtr->nodeTab[i]; ptr = nodePtr->nodeTab[i];
xmlattrib = xmlGetProp( ptr, (xmlChar*)"path" ); xmlattrib = xmlGetProp( ptr, (const xmlChar*)"path" );
paths.insert( (CopiedString)(char*)xmlattrib ); paths.insert( (CopiedString)(char*)xmlattrib );
} }
} }

View File

@ -58,7 +58,7 @@ xmlXPathContextPtr context;
xmlNodeSetPtr nodePtr; xmlNodeSetPtr nodePtr;
xmlXPathObjectPtr XpathEval( const char* queryString ){ xmlXPathObjectPtr XpathEval( const char* queryString ){
xmlChar* expression = (xmlChar*)queryString; const xmlChar* expression = (const xmlChar*)queryString;
xmlXPathObjectPtr result = xmlXPathEvalExpression( expression, context ); xmlXPathObjectPtr result = xmlXPathEvalExpression( expression, context );
return result; return result;
}; };

View File

@ -650,8 +650,8 @@ void render( RenderStateFlags state ) const {
points[5] = vector4_projected( matrix4_transformed_vector4( unproject, Vector4( points[5], 1 ) ) ); points[5] = vector4_projected( matrix4_transformed_vector4( unproject, Vector4( points[5], 1 ) ) );
points[6] = vector4_projected( matrix4_transformed_vector4( unproject, Vector4( points[6], 1 ) ) ); points[6] = vector4_projected( matrix4_transformed_vector4( unproject, Vector4( points[6], 1 ) ) );
points[7] = vector4_projected( matrix4_transformed_vector4( unproject, Vector4( points[7], 1 ) ) ); points[7] = vector4_projected( matrix4_transformed_vector4( unproject, Vector4( points[7], 1 ) ) );
Vector4 test1 = matrix4_transformed_vector4( unproject, Vector4( 0.5f, 0.5f, 0.5f, 1 ) ); //Vector4 test1 = matrix4_transformed_vector4( unproject, Vector4( 0.5f, 0.5f, 0.5f, 1 ) );
Vector3 test2 = vector4_projected( test1 ); //Vector3 test2 = vector4_projected( test1 );
aabb_draw_wire( points ); aabb_draw_wire( points );
} }
}; };

View File

@ -91,7 +91,7 @@ typedef struct
Image* LoadHLWBuff( byte* buffer ){ Image* LoadHLWBuff( byte* buffer ){
byte *buf_p; byte *buf_p;
unsigned long mipdatasize; unsigned long mipdatasize;
int columns, rows, numPixels; int columns, rows;
byte *pixbuf; byte *pixbuf;
int row, column; int row, column;
byte *palette; byte *palette;
@ -108,7 +108,6 @@ Image* LoadHLWBuff( byte* buffer ){
columns = lpMip->width; columns = lpMip->width;
rows = lpMip->height; rows = lpMip->height;
numPixels = columns * rows;
RGBAImage* image = new RGBAImage( columns, rows ); RGBAImage* image = new RGBAImage( columns, rows );

View File

@ -138,7 +138,6 @@ static const byte quakepalette[768] =
Image* LoadMIPBuff( byte* buffer ){ Image* LoadMIPBuff( byte* buffer ){
byte *buf_p; byte *buf_p;
int palettelength; int palettelength;
unsigned long mipdatasize;
int columns, rows, numPixels; int columns, rows, numPixels;
byte *pixbuf; byte *pixbuf;
int i; int i;
@ -158,7 +157,7 @@ Image* LoadMIPBuff( byte* buffer ){
return 0; return 0;
} }
mipdatasize = GET_MIP_DATA_SIZE( columns, rows ); //unsigned long mipdatasize = GET_MIP_DATA_SIZE( columns, rows );
palettelength = vfsLoadFile( "gfx/palette.lmp", (void **) &loadedpalette ); palettelength = vfsLoadFile( "gfx/palette.lmp", (void **) &loadedpalette );
if ( palettelength == 768 ) { if ( palettelength == 768 ) {

View File

@ -102,7 +102,7 @@ typedef struct {
Image* LoadIDSPBuff( byte *buffer ){ Image* LoadIDSPBuff( byte *buffer ){
byte *buf_p; byte *buf_p;
int columns, rows, numPixels; int columns, rows;
byte *pixbuf; byte *pixbuf;
int row, column; int row, column;
@ -159,8 +159,6 @@ Image* LoadIDSPBuff( byte *buffer ){
// palette = buffer+mipdatasize+2; // palette = buffer+mipdatasize+2;
// buf_p = buffer+lpMip->offsets[0]; // buf_p = buffer+lpMip->offsets[0];
numPixels = columns * rows;
RGBAImage* image = new RGBAImage( columns, rows ); RGBAImage* image = new RGBAImage( columns, rows );
#ifdef DEBUG #ifdef DEBUG

View File

@ -106,12 +106,12 @@ void readGraph( scene::Node& root, TextInputStream& inputStream, EntityCreator&
if ( !Tokeniser_parseToken( tokeniser, "Version" ) ) { if ( !Tokeniser_parseToken( tokeniser, "Version" ) ) {
return; return;
} }
std::size_t version; int version;
if ( !Tokeniser_getSize( tokeniser, version ) ) { if ( !Tokeniser_getInteger( tokeniser, version ) ) {
return; return;
} }
if ( version != MapVersion() ) { if ( version != MapVersion() ) {
globalErrorStream() << "Doom 3 map version " << MapVersion() << " supported, version is " << Unsigned( version ) << "\n"; globalErrorStream() << "Doom 3 map version " << MapVersion() << " supported, version is " << version << "\n";
return; return;
} }
tokeniser.nextLine(); tokeniser.nextLine();
@ -177,12 +177,12 @@ void readGraph( scene::Node& root, TextInputStream& inputStream, EntityCreator&
if ( !Tokeniser_parseToken( tokeniser, "Version" ) ) { if ( !Tokeniser_parseToken( tokeniser, "Version" ) ) {
return; return;
} }
std::size_t version; int version;
if ( !Tokeniser_getSize( tokeniser, version ) ) { if ( !Tokeniser_getInteger( tokeniser, version ) ) {
return; return;
} }
if ( version != MapVersion() ) { if ( version != MapVersion() ) {
globalErrorStream() << "Quake 4 map version " << MapVersion() << " supported, version is " << Unsigned( version ) << "\n"; globalErrorStream() << "Quake 4 map version " << MapVersion() << " supported, version is " << version << "\n";
return; return;
} }
tokeniser.nextLine(); tokeniser.nextLine();

View File

@ -785,6 +785,7 @@ float evaluateFloat( const ShaderValue& value, const ShaderParameters& params, c
float f; float f;
if ( !string_parse_float( result, f ) ) { if ( !string_parse_float( result, f ) ) {
globalErrorStream() << "parsing float value failed: " << makeQuoted( result ) << "\n"; globalErrorStream() << "parsing float value failed: " << makeQuoted( result ) << "\n";
return 1.f;
} }
return f; return f;
} }

View File

@ -261,12 +261,10 @@ const char* QERPlug_GetCommandList(){
char *TranslateString( char *buf ){ char *TranslateString( char *buf ){
static char buf2[32768]; static char buf2[32768];
int i, l;
char *out;
l = strlen( buf ); std::size_t l = strlen( buf );
out = buf2; char* out = buf2;
for ( i = 0 ; i < l ; i++ ) for ( std::size_t i = 0 ; i < l ; i++ )
{ {
if ( buf[i] == '\n' ) { if ( buf[i] == '\n' ) {
*out++ = '\r'; *out++ = '\r';

View File

@ -473,8 +473,8 @@ int GetFileCount( const char *filename, int flag ){
for ( archives_t::iterator i = g_archives.begin(); i != g_archives.end(); ++i ) for ( archives_t::iterator i = g_archives.begin(); i != g_archives.end(); ++i )
{ {
if ( ( *i ).is_pakfile && ( flag & VFS_SEARCH_PAK ) != 0 if ( ( ( *i ).is_pakfile && ( flag & VFS_SEARCH_PAK ) != 0 )
|| !( *i ).is_pakfile && ( flag & VFS_SEARCH_DIR ) != 0 ) { || ( !( *i ).is_pakfile && ( flag & VFS_SEARCH_DIR ) != 0 ) ) {
if ( ( *i ).archive->containsFile( fixed ) ) { if ( ( *i ).archive->containsFile( fixed ) ) {
++count; ++count;
} }

View File

@ -1255,7 +1255,7 @@ inline Matrix4 matrix4_reflection_for_plane45( const Plane3& plane, const Vector
Vector3 first = from; Vector3 first = from;
Vector3 second = to; Vector3 second = to;
if ( vector3_dot( from, plane.normal() ) > 0 == vector3_dot( to, plane.normal() ) > 0 ) { if ( ( vector3_dot( from, plane.normal() ) > 0 ) == ( vector3_dot( to, plane.normal() ) > 0 ) ) {
first = vector3_negated( first ); first = vector3_negated( first );
second = vector3_negated( second ); second = vector3_negated( second );
} }
@ -1273,7 +1273,7 @@ inline Matrix4 matrix4_reflection_for_plane45( const Plane3& plane, const Vector
Matrix4 swap = matrix4_swap_axes( first, second ); Matrix4 swap = matrix4_swap_axes( first, second );
Matrix4 tmp = matrix4_reflection_for_plane( plane ); //Matrix4 tmp = matrix4_reflection_for_plane( plane );
swap.tx() = -static_cast<float>( -2 * plane.a * plane.d ); swap.tx() = -static_cast<float>( -2 * plane.a * plane.d );
swap.ty() = -static_cast<float>( -2 * plane.b * plane.d ); swap.ty() = -static_cast<float>( -2 * plane.b * plane.d );

View File

@ -1330,13 +1330,13 @@ BrushPrefab g_brushcone( eBrushCone );
BrushPrefab g_brushsphere( eBrushSphere ); BrushPrefab g_brushsphere( eBrushSphere );
BrushPrefab g_brushrock( eBrushRock ); BrushPrefab g_brushrock( eBrushRock );
/*
void FlipClip(); void FlipClip();
void SplitClip(); void SplitClip();
void Clip(); void Clip();
void OnClipMode( bool enable ); void OnClipMode( bool enable );
bool ClipMode(); bool ClipMode();
*/
void ClipSelected(){ void ClipSelected(){
if ( ClipMode() ) { if ( ClipMode() ) {

View File

@ -55,6 +55,7 @@ const char* build_get_variable( const char* name ){
class Evaluatable class Evaluatable
{ {
public: public:
virtual ~Evaluatable(){}
virtual void evaluate( StringBuffer& output ) = 0; virtual void evaluate( StringBuffer& output ) = 0;
virtual void exportXML( XMLImporter& importer ) = 0; virtual void exportXML( XMLImporter& importer ) = 0;
}; };
@ -896,7 +897,7 @@ GtkWindow* BuildMenuDialog_construct( ModalDialog& modal, ProjectList& projectLi
object_set_boolean_property( G_OBJECT( renderer ), "editable", TRUE ); object_set_boolean_property( G_OBJECT( renderer ), "editable", TRUE );
g_signal_connect( renderer, "edited", G_CALLBACK( project_cell_edited ), &projectList ); g_signal_connect( renderer, "edited", G_CALLBACK( project_cell_edited ), &projectList );
GtkTreeViewColumn* column = gtk_tree_view_column_new_with_attributes( "", renderer, "text", 0, 0 ); GtkTreeViewColumn* column = gtk_tree_view_column_new_with_attributes( "", renderer, "text", 0, NULL );
gtk_tree_view_append_column( GTK_TREE_VIEW( view ), column ); gtk_tree_view_append_column( GTK_TREE_VIEW( view ), column );
GtkTreeSelection* selection = gtk_tree_view_get_selection( GTK_TREE_VIEW( view ) ); GtkTreeSelection* selection = gtk_tree_view_get_selection( GTK_TREE_VIEW( view ) );
@ -937,7 +938,7 @@ GtkWindow* BuildMenuDialog_construct( ModalDialog& modal, ProjectList& projectLi
object_set_int_property( G_OBJECT( renderer ), "wrap-width", 640 ); object_set_int_property( G_OBJECT( renderer ), "wrap-width", 640 );
g_signal_connect( renderer, "edited", G_CALLBACK( commands_cell_edited ), store ); g_signal_connect( renderer, "edited", G_CALLBACK( commands_cell_edited ), store );
GtkTreeViewColumn* column = gtk_tree_view_column_new_with_attributes( "", renderer, "text", 0, 0 ); GtkTreeViewColumn* column = gtk_tree_view_column_new_with_attributes( "", renderer, "text", 0, NULL );
gtk_tree_view_append_column( GTK_TREE_VIEW( view ), column ); gtk_tree_view_append_column( GTK_TREE_VIEW( view ), column );
GtkTreeSelection* selection = gtk_tree_view_get_selection( GTK_TREE_VIEW( view ) ); GtkTreeSelection* selection = gtk_tree_view_get_selection( GTK_TREE_VIEW( view ) );

View File

@ -193,12 +193,13 @@ inline Matrix4 projection_for_camera( float near_z, float far_z, float fieldOfVi
} }
float Camera_getFarClipPlane( camera_t& camera ){ float Camera_getFarClipPlane( camera_t& camera ){
return ( g_camwindow_globals_private.m_bCubicClipping ) ? pow( 2.0, ( g_camwindow_globals.m_nCubicScale + 7 ) / 2.0 ) : 32768.0f; return ( g_camwindow_globals_private.m_bCubicClipping ) ? pow( 2.0, ( g_camwindow_globals.m_nCubicScale + 7 ) / 2.0 ) : ( ( g_MaxWorldCoord - g_MinWorldCoord ) * sqrt( 3 ) );
} }
void Camera_updateProjection( camera_t& camera ){ void Camera_updateProjection( camera_t& camera ){
float farClip = Camera_getFarClipPlane( camera ); float farClip = Camera_getFarClipPlane( camera );
camera.projection = projection_for_camera( farClip / 4096.0f, farClip, camera_t::fieldOfView, camera.width, camera.height );
camera.projection = projection_for_camera( 1.f, farClip, camera_t::fieldOfView, camera.width, camera.height );
camera.m_view->Construct( camera.projection, camera.modelview, camera.width, camera.height ); camera.m_view->Construct( camera.projection, camera.modelview, camera.width, camera.height );
} }
@ -750,7 +751,7 @@ CameraView& getCameraView(){
return m_cameraview; return m_cameraview;
} }
guint32 m_rightClickTime; Timer m_rightClickTimer;
private: private:
void Cam_Draw(); void Cam_Draw();
@ -826,39 +827,39 @@ void Camera_setAngles( CamWnd& camwnd, const Vector3& angles ){
// ============================================================================= // =============================================================================
// CamWnd class // CamWnd class
void context_menu(){ void context_menu_show(){
if( g_pParentWnd->ActiveXY() ){ if( g_pParentWnd->ActiveXY() ){
g_pParentWnd->ActiveXY()->OnContextMenu(); g_pParentWnd->ActiveXY()->OnContextMenu();
g_bCamEntityMenu = true; g_bCamEntityMenu = true;
} }
} }
/* GDK_2BUTTON_PRESS doesn't always work in this case, so... */ void context_menu(){
bool context_menu_try( GdkEventButton* event, CamWnd* camwnd ){
if( ( event->time - camwnd->m_rightClickTime ) < 200 ){
camwnd->m_rightClickTime = event->time;
return true;
}
else{
camwnd->m_rightClickTime = event->time;
return false;
}
}
gboolean enable_freelook_button_press( GtkWidget* widget, GdkEventButton* event, CamWnd* camwnd ){
if ( event->type == GDK_BUTTON_PRESS && event->button == 3 && modifiers_for_state( event->state ) == c_modifierNone ) {
if( context_menu_try( event, camwnd ) ){
//need this hack, otherwise button wont be released = global accels broken, until correct button pressed again... //need this hack, otherwise button wont be released = global accels broken, until correct button pressed again...
GdkEvent* event_ = gtk_get_current_event(); GdkEvent* event_ = gtk_get_current_event();
if( event_ ){ if( event_ ){
event_->type = GDK_BUTTON_RELEASE; event_->type = GDK_BUTTON_RELEASE;
gtk_main_do_event( event_ ); gtk_main_do_event( event_ );
gdk_event_free( event_ ); gdk_event_free( event_ );
context_menu(); context_menu_show();
} }
}
/* GDK_2BUTTON_PRESS doesn't always work in this case, so... */
bool context_menu_try( CamWnd* camwnd ){
//globalOutputStream() << camwnd->m_rightClickTimer.elapsed_msec() << "\n";
return camwnd->m_rightClickTimer.elapsed_msec() < 200;
//doesn't work if cam redraw > 200msec (3x click works): gtk_widget_queue_draw proceeds after timer.start()
}
gboolean enable_freelook_button_press( GtkWidget* widget, GdkEventButton* event, CamWnd* camwnd ){
if ( event->type == GDK_BUTTON_PRESS && event->button == 3 && modifiers_for_state( event->state ) == c_modifierNone ) {
if( context_menu_try( camwnd ) ){
context_menu();
} }
else{ else{
camwnd->EnableFreeMove(); camwnd->EnableFreeMove();
camwnd->m_rightClickTimer.start();
} }
return TRUE; return TRUE;
} }
@ -867,16 +868,13 @@ gboolean enable_freelook_button_press( GtkWidget* widget, GdkEventButton* event,
gboolean disable_freelook_button_press( GtkWidget* widget, GdkEventButton* event, CamWnd* camwnd ){ gboolean disable_freelook_button_press( GtkWidget* widget, GdkEventButton* event, CamWnd* camwnd ){
if ( event->type == GDK_BUTTON_PRESS && event->button == 3 && modifiers_for_state( event->state ) == c_modifierNone ) { if ( event->type == GDK_BUTTON_PRESS && event->button == 3 && modifiers_for_state( event->state ) == c_modifierNone ) {
bool doubleclicked = context_menu_try( camwnd );
camwnd->DisableFreeMove(); camwnd->DisableFreeMove();
if( context_menu_try( event, camwnd ) ){ if( doubleclicked ){
//need this hack, otherwise button wont be released = global accels broken, until correct button pressed again...
GdkEvent* event_ = gtk_get_current_event();
if( event_ ){
event_->type = GDK_BUTTON_RELEASE;
gtk_main_do_event( event_ );
gdk_event_free( event_ );
context_menu(); context_menu();
} }
else{
camwnd->m_rightClickTimer.start();
} }
return TRUE; return TRUE;
} }
@ -973,7 +971,7 @@ gboolean wheelmove_scroll( GtkWidget* widget, GdkEventScroll* event, CamWnd* cam
normalized[1] *= -1.f; normalized[1] *= -1.f;
normalized[2] = 0.f; normalized[2] = 0.f;
normalized *= 16.0f; normalized *= 2.0f; //*= 2 * nearplane
//globalOutputStream() << normalized << " normalized "; //globalOutputStream() << normalized << " normalized ";
matrix4_transform_point( maa, normalized ); matrix4_transform_point( maa, normalized );
//globalOutputStream() << normalized << "\n"; //globalOutputStream() << normalized << "\n";
@ -1297,8 +1295,7 @@ CamWnd::CamWnd() :
m_selection_button_release_handler( 0 ), m_selection_button_release_handler( 0 ),
m_selection_motion_handler( 0 ), m_selection_motion_handler( 0 ),
m_freelook_button_press_handler( 0 ), m_freelook_button_press_handler( 0 ),
m_drawing( false ), m_drawing( false ){
m_rightClickTime( 0 ){
m_bFreeMove = false; m_bFreeMove = false;
GlobalWindowObservers_add( m_window_observer ); GlobalWindowObservers_add( m_window_observer );
@ -1503,7 +1500,7 @@ void SetState( Shader* state, EStyle style ){
m_state_stack.back().m_state = state; m_state_stack.back().m_state = state;
} }
} }
const EStyle getStyle() const { EStyle getStyle() const {
return eFullMaterials; return eFullMaterials;
} }
void PushState(){ void PushState(){

View File

@ -147,8 +147,12 @@ GtkTextTag* tag;
public: public:
GtkTextBufferOutputStream( GtkTextBuffer* textBuffer, GtkTextIter* iter, GtkTextTag* tag ) : textBuffer( textBuffer ), iter( iter ), tag( tag ){ GtkTextBufferOutputStream( GtkTextBuffer* textBuffer, GtkTextIter* iter, GtkTextTag* tag ) : textBuffer( textBuffer ), iter( iter ), tag( tag ){
} }
std::size_t __attribute__((optimize("O0"))) write( const char* buffer, std::size_t length ){ std::size_t
gtk_text_buffer_insert_with_tags( textBuffer, iter, buffer, gint( length ), tag, 0 ); #ifdef __GNUC__
__attribute__((optimize("O0")))
#endif
write( const char* buffer, std::size_t length ){
gtk_text_buffer_insert_with_tags( textBuffer, iter, buffer, gint( length ), tag, NULL );
return length; return length;
} }
}; };

View File

@ -45,7 +45,7 @@ namespace
typedef std::map<const char*, EntityClass*, RawStringLessNoCase> EntityClasses; typedef std::map<const char*, EntityClass*, RawStringLessNoCase> EntityClasses;
EntityClasses g_entityClasses; EntityClasses g_entityClasses;
EntityClass *eclass_bad = 0; EntityClass *eclass_bad = 0;
char eclass_directory[1024]; //char eclass_directory[1024];
typedef std::map<CopiedString, ListAttributeType> ListAttributeTypes; typedef std::map<CopiedString, ListAttributeType> ListAttributeTypes;
ListAttributeTypes g_listTypes; ListAttributeTypes g_listTypes;
} }

View File

@ -1485,7 +1485,7 @@ GtkWidget* EntityInspector_constructWindow( GtkWindow* toplevel ){
{ {
GtkCellRenderer* renderer = gtk_cell_renderer_text_new(); GtkCellRenderer* renderer = gtk_cell_renderer_text_new();
GtkTreeViewColumn* column = gtk_tree_view_column_new_with_attributes( "Key", renderer, "text", 0, 0 ); GtkTreeViewColumn* column = gtk_tree_view_column_new_with_attributes( "Key", renderer, "text", 0, NULL );
gtk_tree_view_append_column( view, column ); gtk_tree_view_append_column( view, column );
} }
@ -1575,13 +1575,13 @@ GtkWidget* EntityInspector_constructWindow( GtkWindow* toplevel ){
{ {
GtkCellRenderer* renderer = gtk_cell_renderer_text_new(); GtkCellRenderer* renderer = gtk_cell_renderer_text_new();
GtkTreeViewColumn* column = gtk_tree_view_column_new_with_attributes( "", renderer, "text", 0, 0 ); GtkTreeViewColumn* column = gtk_tree_view_column_new_with_attributes( "", renderer, "text", 0, NULL );
gtk_tree_view_append_column( GTK_TREE_VIEW( view ), column ); gtk_tree_view_append_column( GTK_TREE_VIEW( view ), column );
} }
{ {
GtkCellRenderer* renderer = gtk_cell_renderer_text_new(); GtkCellRenderer* renderer = gtk_cell_renderer_text_new();
GtkTreeViewColumn* column = gtk_tree_view_column_new_with_attributes( "", renderer, "text", 1, 0 ); GtkTreeViewColumn* column = gtk_tree_view_column_new_with_attributes( "", renderer, "text", 1, NULL );
gtk_tree_view_append_column( GTK_TREE_VIEW( view ), column ); gtk_tree_view_append_column( GTK_TREE_VIEW( view ), column );
} }

View File

@ -123,22 +123,22 @@ void entitylist_treeviewcolumn_celldatafunc( GtkTreeViewColumn* column, GtkCellR
if ( node != 0 ) { if ( node != 0 ) {
gtk_cell_renderer_set_fixed_size( renderer, -1, -1 ); gtk_cell_renderer_set_fixed_size( renderer, -1, -1 );
char* name = const_cast<char*>( node_get_name( *node ) ); char* name = const_cast<char*>( node_get_name( *node ) );
g_object_set( G_OBJECT( renderer ), "text", name, "visible", TRUE, 0 ); g_object_set( G_OBJECT( renderer ), "text", name, "visible", TRUE, NULL );
//globalOutputStream() << "rendering cell " << makeQuoted(name) << "\n"; //globalOutputStream() << "rendering cell " << makeQuoted(name) << "\n";
GtkStyle* style = gtk_widget_get_style( GTK_WIDGET( getEntityList().m_tree_view ) ); GtkStyle* style = gtk_widget_get_style( GTK_WIDGET( getEntityList().m_tree_view ) );
if ( instance->childSelected() ) { if ( instance->childSelected() ) {
g_object_set( G_OBJECT( renderer ), "cell-background-gdk", &style->base[GTK_STATE_ACTIVE], 0 ); g_object_set( G_OBJECT( renderer ), "cell-background-gdk", &style->base[GTK_STATE_ACTIVE], NULL );
} }
else else
{ {
g_object_set( G_OBJECT( renderer ), "cell-background-gdk", &style->base[GTK_STATE_NORMAL], 0 ); g_object_set( G_OBJECT( renderer ), "cell-background-gdk", &style->base[GTK_STATE_NORMAL], NULL );
} }
} }
else else
{ {
gtk_cell_renderer_set_fixed_size( renderer, -1, 0 ); gtk_cell_renderer_set_fixed_size( renderer, -1, 0 );
g_object_set( G_OBJECT( renderer ), "text", "", "visible", FALSE, 0 ); g_object_set( G_OBJECT( renderer ), "text", "", "visible", FALSE, NULL );
} }
} }

View File

@ -30,7 +30,7 @@
#include "cmdlib.h" #include "cmdlib.h"
int g_argc; int g_argc;
char** g_argv; const char** g_argv;
void args_init( int argc, char* argv[] ){ void args_init( int argc, char* argv[] ){
int i, j, k; int i, j, k;
@ -51,11 +51,11 @@ void args_init( int argc, char* argv[] ){
} }
g_argc = argc; g_argc = argc;
g_argv = argv; g_argv = const_cast<const char **>( argv );
} }
char *gamedetect_argv_buffer[1024]; const char *gamedetect_argv_buffer[1024];
void gamedetect_found_game( char *game, char *path ){ void gamedetect_found_game( const char *game, char *path ){
int argc; int argc;
static char buf[128]; static char buf[128];
@ -79,7 +79,7 @@ void gamedetect_found_game( char *game, char *path ){
g_argv = gamedetect_argv_buffer; g_argv = gamedetect_argv_buffer;
} }
bool gamedetect_check_game( char *gamefile, const char *checkfile1, const char *checkfile2, char *buf /* must have 64 bytes free after bufpos */, int bufpos ){ bool gamedetect_check_game( const char *gamefile, const char *checkfile1, const char *checkfile2, char *buf /* must have 64 bytes free after bufpos */, int bufpos ){
buf[bufpos] = '/'; buf[bufpos] = '/';
strcpy( buf + bufpos + 1, checkfile1 ); strcpy( buf + bufpos + 1, checkfile1 );
@ -181,15 +181,15 @@ bool portable_app_setup(){
} }
char* openCmdMap; const char* g_openCmdMap;
void cmdMap(){ void cmdMap(){
openCmdMap = NULL; g_openCmdMap = NULL;
for ( int i = 1; i < g_argc; ++i ) for ( int i = 1; i < g_argc; ++i )
{ {
//if ( !stricmp( g_argv[i] + strlen(g_argv[i]) - 4, ".map" ) ){ //if ( !stricmp( g_argv[i] + strlen(g_argv[i]) - 4, ".map" ) ){
if( string_equal_suffix_nocase( g_argv[i], ".map" ) ){ if( string_equal_suffix_nocase( g_argv[i], ".map" ) ){
openCmdMap = g_argv[i]; g_openCmdMap = g_argv[i];
} }
} }
} }
@ -211,7 +211,7 @@ const char* LINK_NAME =
; ;
/// brief Returns the filename of the executable belonging to the current process, or 0 if not found. /// brief Returns the filename of the executable belonging to the current process, or 0 if not found.
char* getexename( char *buf ){ const char* getexename( char *buf ){
/* Now read the symbolic link */ /* Now read the symbolic link */
int ret = readlink( LINK_NAME, buf, PATH_MAX ); int ret = readlink( LINK_NAME, buf, PATH_MAX );

View File

@ -27,9 +27,9 @@ const char* environment_get_home_path();
const char* environment_get_app_path(); const char* environment_get_app_path();
extern int g_argc; extern int g_argc;
extern char** g_argv; extern const char** g_argv;
extern char* openCmdMap; extern const char* g_openCmdMap;
#endif #endif

View File

@ -43,13 +43,14 @@ struct filetype_copy_t
filetype_t getType() const { filetype_t getType() const {
return filetype_t( m_name.c_str(), m_pattern.c_str(), m_can_load, m_can_save, m_can_import ); return filetype_t( m_name.c_str(), m_pattern.c_str(), m_can_load, m_can_save, m_can_import );
} }
bool m_can_load;
bool m_can_import;
bool m_can_save;
private: private:
CopiedString m_moduleName; CopiedString m_moduleName;
CopiedString m_name; CopiedString m_name;
CopiedString m_pattern; CopiedString m_pattern;
public:
bool m_can_load;
bool m_can_import;
bool m_can_save;
}; };
typedef std::vector<filetype_copy_t> filetype_list_t; typedef std::vector<filetype_copy_t> filetype_list_t;
std::map<CopiedString, filetype_list_t> m_typelists; std::map<CopiedString, filetype_list_t> m_typelists;

View File

@ -100,7 +100,7 @@ static void OnApply( GtkWidget* widget, gpointer data ){
g_FindTextureDialog.exportData(); g_FindTextureDialog.exportData();
FindTextureDialog_apply(); FindTextureDialog_apply();
} }
#if 0
static void OnFind( GtkWidget* widget, gpointer data ){ static void OnFind( GtkWidget* widget, gpointer data ){
g_FindTextureDialog.exportData(); g_FindTextureDialog.exportData();
FindTextureDialog_apply(); FindTextureDialog_apply();
@ -111,7 +111,7 @@ static void OnOK( GtkWidget* widget, gpointer data ){
FindTextureDialog_apply(); FindTextureDialog_apply();
g_FindTextureDialog.HideDlg(); g_FindTextureDialog.HideDlg();
} }
#endif
static void OnClose( GtkWidget* widget, gpointer data ){ static void OnClose( GtkWidget* widget, gpointer data ){
g_FindTextureDialog.HideDlg(); g_FindTextureDialog.HideDlg();
} }

View File

@ -134,6 +134,34 @@ bool color_dialog( GtkWidget *parent, Vector3& color, const char* title ){
return ok; return ok;
} }
bool OpenGLFont_dialog( GtkWidget *parent, const char* font, CopiedString &newfont ){
GtkWidget* dlg;
ModalDialog dialog;
dlg = gtk_font_selection_dialog_new( "OpenGLFont" );
gtk_font_selection_dialog_set_font_name( GTK_FONT_SELECTION_DIALOG( dlg ), font );
g_signal_connect( G_OBJECT( dlg ), "delete_event", G_CALLBACK( dialog_delete_callback ), &dialog );
g_signal_connect( G_OBJECT( gtk_font_selection_dialog_get_ok_button( GTK_FONT_SELECTION_DIALOG( dlg ) ) ), "clicked", G_CALLBACK( dialog_button_ok ), &dialog );
g_signal_connect( G_OBJECT( gtk_font_selection_dialog_get_cancel_button( GTK_FONT_SELECTION_DIALOG( dlg ) ) ), "clicked", G_CALLBACK( dialog_button_cancel ), &dialog );
if ( parent != 0 ) {
gtk_window_set_transient_for( GTK_WINDOW( dlg ), GTK_WINDOW( parent ) );
}
bool ok = modal_dialog_show( GTK_WINDOW( dlg ), dialog ) == eIDOK;
if ( ok ) {
gchar* selectedfont = gtk_font_selection_dialog_get_font_name( GTK_FONT_SELECTION_DIALOG( dlg ) );
newfont = selectedfont;
g_free( selectedfont );
}
gtk_widget_destroy( dlg );
return ok;
}
void button_clicked_entry_browse_file( GtkWidget* widget, GtkEntry* entry ){ void button_clicked_entry_browse_file( GtkWidget* widget, GtkEntry* entry ){
const char *filename = file_dialog( gtk_widget_get_toplevel( widget ), TRUE, "Choose File", gtk_entry_get_text( entry ) ); const char *filename = file_dialog( gtk_widget_get_toplevel( widget ), TRUE, "Choose File", gtk_entry_get_text( entry ) );

View File

@ -68,6 +68,9 @@ template<typename Element> class BasicVector3;
typedef BasicVector3<float> Vector3; typedef BasicVector3<float> Vector3;
bool color_dialog( GtkWidget *parent, Vector3& color, const char* title = "Choose Color" ); bool color_dialog( GtkWidget *parent, Vector3& color, const char* title = "Choose Color" );
#include "string/stringfwd.h"
bool OpenGLFont_dialog( GtkWidget *parent, const char* font, CopiedString &newfont );
typedef struct _GtkEntry GtkEntry; typedef struct _GtkEntry GtkEntry;
void button_clicked_entry_browse_file( GtkWidget* widget, GtkEntry* entry ); void button_clicked_entry_browse_file( GtkWidget* widget, GtkEntry* entry );
void button_clicked_entry_browse_directory( GtkWidget* widget, GtkEntry* entry ); void button_clicked_entry_browse_directory( GtkWidget* widget, GtkEntry* entry );

View File

@ -652,8 +652,8 @@ int main( int argc, char* argv[] ){
hide_splash(); hide_splash();
if( openCmdMap && *openCmdMap ){ if( g_openCmdMap && *g_openCmdMap ){
Map_LoadFile( openCmdMap ); Map_LoadFile( g_openCmdMap );
} }
else if ( g_bLoadLastMap && !g_strLastMap.empty() ) { else if ( g_bLoadLastMap && !g_strLastMap.empty() ) {
Map_LoadFile( g_strLastMap.c_str() ); Map_LoadFile( g_strLastMap.c_str() );

View File

@ -923,6 +923,7 @@ GtkMenuItem* create_colours_menu(){
create_menu_item_with_mnemonic( menu_3, "Maya/Max/Lightwave Emulation", "ColorSchemeYdnar" ); create_menu_item_with_mnemonic( menu_3, "Maya/Max/Lightwave Emulation", "ColorSchemeYdnar" );
create_menu_item_with_mnemonic( menu_in_menu, "GTK Theme...", "gtkThemeDlg" ); create_menu_item_with_mnemonic( menu_in_menu, "GTK Theme...", "gtkThemeDlg" );
create_menu_item_with_mnemonic( menu_in_menu, "OpenGL Font...", "OpenGLFont" );
menu_separator( menu_in_menu ); menu_separator( menu_in_menu );
@ -3344,9 +3345,23 @@ void GridStatus_onTextureLockEnabledChanged(){
} }
} }
void GlobalGL_sharedContextCreated(){ CopiedString g_strOpenGLFont = "arial 8";
GLFont *g_font = NULL;
void OpenGLFont_select(){
CopiedString newfont;
if( OpenGLFont_dialog( GTK_WIDGET( MainFrame_getWindow() ), g_strOpenGLFont.c_str(), newfont ) ){
{
ScopeDisableScreenUpdates disableScreenUpdates( "Processing...", "Changing OpenGL Font" );
delete GlobalOpenGL().m_font;
g_strOpenGLFont = newfont;
GlobalOpenGL().m_font = glfont_create( g_strOpenGLFont.c_str() );
}
UpdateAllWindows();
}
}
void GlobalGL_sharedContextCreated(){
// report OpenGL information // report OpenGL information
globalOutputStream() << "GL_VENDOR: " << reinterpret_cast<const char*>( glGetString( GL_VENDOR ) ) << "\n"; globalOutputStream() << "GL_VENDOR: " << reinterpret_cast<const char*>( glGetString( GL_VENDOR ) ) << "\n";
globalOutputStream() << "GL_RENDERER: " << reinterpret_cast<const char*>( glGetString( GL_RENDERER ) ) << "\n"; globalOutputStream() << "GL_RENDERER: " << reinterpret_cast<const char*>( glGetString( GL_RENDERER ) ) << "\n";
@ -3360,17 +3375,7 @@ void GlobalGL_sharedContextCreated(){
GlobalShaderCache().realise(); GlobalShaderCache().realise();
Textures_Realise(); Textures_Realise();
#ifdef WIN32 GlobalOpenGL().m_font = glfont_create( g_strOpenGLFont.c_str() );
/* win32 is dodgy here, just use courier new then */
g_font = glfont_create( "arial 8" );
#else
GtkSettings *settings = gtk_settings_get_default();
gchar *fontname;
g_object_get( settings, "gtk-font-name", &fontname, NULL );
g_font = glfont_create( fontname );
#endif
GlobalOpenGL().m_font = g_font;
} }
void GlobalGL_sharedContextDestroyed(){ void GlobalGL_sharedContextDestroyed(){
@ -3509,6 +3514,7 @@ void MainFrame_Construct(){
GlobalCommands_insert( "MouseDragOrScale", FreeCaller<ToggleDragScaleModes>(), Accelerator( 'Q' ) ); GlobalCommands_insert( "MouseDragOrScale", FreeCaller<ToggleDragScaleModes>(), Accelerator( 'Q' ) );
GlobalCommands_insert( "gtkThemeDlg", FreeCaller<gtkThemeDlg>() ); GlobalCommands_insert( "gtkThemeDlg", FreeCaller<gtkThemeDlg>() );
GlobalCommands_insert( "OpenGLFont", FreeCaller<OpenGLFont_select>() );
GlobalCommands_insert( "ColorSchemeOriginal", FreeCaller<ColorScheme_Original>() ); GlobalCommands_insert( "ColorSchemeOriginal", FreeCaller<ColorScheme_Original>() );
GlobalCommands_insert( "ColorSchemeQER", FreeCaller<ColorScheme_QER>() ); GlobalCommands_insert( "ColorSchemeQER", FreeCaller<ColorScheme_QER>() );
GlobalCommands_insert( "ColorSchemeBlackAndGreen", FreeCaller<ColorScheme_Black>() ); GlobalCommands_insert( "ColorSchemeBlackAndGreen", FreeCaller<ColorScheme_Black>() );
@ -3591,6 +3597,7 @@ void MainFrame_Construct(){
GlobalPreferenceSystem().registerPreference( "EnginePath", CopiedStringImportStringCaller( g_strEnginePath ), CopiedStringExportStringCaller( g_strEnginePath ) ); GlobalPreferenceSystem().registerPreference( "EnginePath", CopiedStringImportStringCaller( g_strEnginePath ), CopiedStringExportStringCaller( g_strEnginePath ) );
GlobalPreferenceSystem().registerPreference( "NudgeAfterClone", BoolImportStringCaller( g_bNudgeAfterClone ), BoolExportStringCaller( g_bNudgeAfterClone ) ); GlobalPreferenceSystem().registerPreference( "NudgeAfterClone", BoolImportStringCaller( g_bNudgeAfterClone ), BoolExportStringCaller( g_bNudgeAfterClone ) );
GlobalPreferenceSystem().registerPreference( "OpenGLFont", CopiedStringImportStringCaller( g_strOpenGLFont ), CopiedStringExportStringCaller( g_strOpenGLFont ) );
if ( g_strEnginePath.empty() ) if ( g_strEnginePath.empty() )
{ {
g_strEnginePath_was_empty_1st_start = true; g_strEnginePath_was_empty_1st_start = true;

View File

@ -1006,14 +1006,14 @@ void DoMapInfo(){
{ {
GtkCellRenderer* renderer = gtk_cell_renderer_text_new(); GtkCellRenderer* renderer = gtk_cell_renderer_text_new();
GtkTreeViewColumn* column = gtk_tree_view_column_new_with_attributes( "Entity", renderer, "text", 0, 0 ); GtkTreeViewColumn* column = gtk_tree_view_column_new_with_attributes( "Entity", renderer, "text", 0, NULL );
gtk_tree_view_append_column( GTK_TREE_VIEW( view ), column ); gtk_tree_view_append_column( GTK_TREE_VIEW( view ), column );
gtk_tree_view_column_set_sort_column_id( column, 0 ); gtk_tree_view_column_set_sort_column_id( column, 0 );
} }
{ {
GtkCellRenderer* renderer = gtk_cell_renderer_text_new(); GtkCellRenderer* renderer = gtk_cell_renderer_text_new();
GtkTreeViewColumn* column = gtk_tree_view_column_new_with_attributes( "Count", renderer, "text", 1, 0 ); GtkTreeViewColumn* column = gtk_tree_view_column_new_with_attributes( "Count", renderer, "text", 1, NULL );
gtk_tree_view_append_column( GTK_TREE_VIEW( view ), column ); gtk_tree_view_append_column( GTK_TREE_VIEW( view ), column );
gtk_tree_view_column_set_sort_column_id( column, 1 ); gtk_tree_view_column_set_sort_column_id( column, 1 );
} }

View File

@ -32,7 +32,8 @@ multimon_globals_t g_multimon_globals;
//LatchedBool g_Multimon_enableSysMenuPopups( false, "Floating windows sysmenu icons" ); //LatchedBool g_Multimon_enableSysMenuPopups( false, "Floating windows sysmenu icons" );
void MultiMonitor_constructPreferences( PreferencesPage& page ){ void MultiMonitor_constructPreferences( PreferencesPage& page ){
GtkWidget* primary_monitor = page.appendCheckBox( "Multi Monitor", "Start on Primary Monitor", g_multimon_globals.m_bStartOnPrimMon ); //GtkWidget* primary_monitor =
page.appendCheckBox( "Multi Monitor", "Start on Primary Monitor", g_multimon_globals.m_bStartOnPrimMon );
// GtkWidget* popup = page.appendCheckBox( // GtkWidget* popup = page.appendCheckBox(
// "", "Disable system menu on popup windows", // "", "Disable system menu on popup windows",
// LatchedBoolImportCaller( g_Multimon_enableSysMenuPopups ), // LatchedBoolImportCaller( g_Multimon_enableSysMenuPopups ),

View File

@ -1357,7 +1357,7 @@ void Patch::ConstructPrefab( const AABB& aabb, EPatchPrefab eType, int axis, std
// vPos[1] = aabb.origin; // vPos[1] = aabb.origin;
// vPos[2] = vector3_added(aabb.origin, aabb.extents); // vPos[2] = vector3_added(aabb.origin, aabb.extents);
int i, j; unsigned int i, j;
float f = 1 / cos( M_PI / n ); float f = 1 / cos( M_PI / n );
for ( i = 0; i < width; ++i ) for ( i = 0; i < width; ++i )
{ {
@ -1383,7 +1383,7 @@ void Patch::ConstructPrefab( const AABB& aabb, EPatchPrefab eType, int axis, std
// vPos[1] = aabb.origin; // vPos[1] = aabb.origin;
// vPos[2] = vector3_added(aabb.origin, aabb.extents); // vPos[2] = vector3_added(aabb.origin, aabb.extents);
int i, j; unsigned int i, j;
float f = 1 / cos( M_PI / n ); float f = 1 / cos( M_PI / n );
for ( i = 0; i < width; ++i ) for ( i = 0; i < width; ++i )
{ {
@ -1410,7 +1410,7 @@ void Patch::ConstructPrefab( const AABB& aabb, EPatchPrefab eType, int axis, std
// vPos[1] = aabb.origin; // vPos[1] = aabb.origin;
// vPos[2] = vector3_added(aabb.origin, aabb.extents); // vPos[2] = vector3_added(aabb.origin, aabb.extents);
int i, j; unsigned int i, j;
float f = 1 / cos( M_PI / n ); float f = 1 / cos( M_PI / n );
float g = 1 / cos( M_PI / ( 2 * m ) ); float g = 1 / cos( M_PI / ( 2 * m ) );
for ( i = 0; i < width; ++i ) for ( i = 0; i < width; ++i )

View File

@ -118,12 +118,13 @@ void R_ResampleTexture( const void *indata, int inwidth, int inheight, void *out
if ( bytesperpixel == 4 ) { if ( bytesperpixel == 4 ) {
int i, j, yi, oldy, f, fstep, lerp, endy = ( inheight - 1 ), inwidth4 = inwidth * 4, outwidth4 = outwidth * 4; int i, j, yi, oldy, f, fstep, lerp, endy = ( inheight - 1 ), inwidth4 = inwidth * 4, outwidth4 = outwidth * 4;
byte *inrow, *out; const byte *inrow;
byte *out;
out = (byte *)outdata; out = (byte *)outdata;
fstep = (int) ( inheight * 65536.0f / outheight ); fstep = (int) ( inheight * 65536.0f / outheight );
#define LERPBYTE( i ) out[i] = (byte) ( ( ( ( row2[i] - row1[i] ) * lerp ) >> 16 ) + row1[i] ) #define LERPBYTE( i ) out[i] = (byte) ( ( ( ( row2[i] - row1[i] ) * lerp ) >> 16 ) + row1[i] )
inrow = (byte *)indata; inrow = (const byte *)indata;
oldy = 0; oldy = 0;
R_ResampleTextureLerpLine( inrow, row1, inwidth, outwidth, bytesperpixel ); R_ResampleTextureLerpLine( inrow, row1, inwidth, outwidth, bytesperpixel );
R_ResampleTextureLerpLine( inrow + inwidth4, row2, inwidth, outwidth, bytesperpixel ); R_ResampleTextureLerpLine( inrow + inwidth4, row2, inwidth, outwidth, bytesperpixel );
@ -134,7 +135,7 @@ void R_ResampleTexture( const void *indata, int inwidth, int inheight, void *out
if ( yi < endy ) { if ( yi < endy ) {
lerp = f & 0xFFFF; lerp = f & 0xFFFF;
if ( yi != oldy ) { if ( yi != oldy ) {
inrow = (byte *)indata + inwidth4 * yi; inrow = (const byte *)indata + inwidth4 * yi;
if ( yi == oldy + 1 ) { if ( yi == oldy + 1 ) {
memcpy( row1, row2, outwidth4 ); memcpy( row1, row2, outwidth4 );
} }
@ -197,7 +198,7 @@ void R_ResampleTexture( const void *indata, int inwidth, int inheight, void *out
else else
{ {
if ( yi != oldy ) { if ( yi != oldy ) {
inrow = (byte *)indata + inwidth4 * yi; inrow = (const byte *)indata + inwidth4 * yi;
if ( yi == oldy + 1 ) { if ( yi == oldy + 1 ) {
memcpy( row1, row2, outwidth4 ); memcpy( row1, row2, outwidth4 );
} }
@ -213,12 +214,13 @@ void R_ResampleTexture( const void *indata, int inwidth, int inheight, void *out
} }
else if ( bytesperpixel == 3 ) { else if ( bytesperpixel == 3 ) {
int i, j, yi, oldy, f, fstep, lerp, endy = ( inheight - 1 ), inwidth3 = inwidth * 3, outwidth3 = outwidth * 3; int i, j, yi, oldy, f, fstep, lerp, endy = ( inheight - 1 ), inwidth3 = inwidth * 3, outwidth3 = outwidth * 3;
byte *inrow, *out; const byte *inrow;
byte *out;
out = (byte *)outdata; out = (byte *)outdata;
fstep = (int) ( inheight * 65536.0f / outheight ); fstep = (int) ( inheight * 65536.0f / outheight );
#define LERPBYTE( i ) out[i] = (byte) ( ( ( ( row2[i] - row1[i] ) * lerp ) >> 16 ) + row1[i] ) #define LERPBYTE( i ) out[i] = (byte) ( ( ( ( row2[i] - row1[i] ) * lerp ) >> 16 ) + row1[i] )
inrow = (byte *)indata; inrow = (const byte *)indata;
oldy = 0; oldy = 0;
R_ResampleTextureLerpLine( inrow, row1, inwidth, outwidth, bytesperpixel ); R_ResampleTextureLerpLine( inrow, row1, inwidth, outwidth, bytesperpixel );
R_ResampleTextureLerpLine( inrow + inwidth3, row2, inwidth, outwidth, bytesperpixel ); R_ResampleTextureLerpLine( inrow + inwidth3, row2, inwidth, outwidth, bytesperpixel );
@ -228,7 +230,7 @@ void R_ResampleTexture( const void *indata, int inwidth, int inheight, void *out
if ( yi < endy ) { if ( yi < endy ) {
lerp = f & 0xFFFF; lerp = f & 0xFFFF;
if ( yi != oldy ) { if ( yi != oldy ) {
inrow = (byte *)indata + inwidth3 * yi; inrow = (const byte *)indata + inwidth3 * yi;
if ( yi == oldy + 1 ) { if ( yi == oldy + 1 ) {
memcpy( row1, row2, outwidth3 ); memcpy( row1, row2, outwidth3 );
} }
@ -284,7 +286,7 @@ void R_ResampleTexture( const void *indata, int inwidth, int inheight, void *out
else else
{ {
if ( yi != oldy ) { if ( yi != oldy ) {
inrow = (byte *)indata + inwidth3 * yi; inrow = (const byte *)indata + inwidth3 * yi;
if ( yi == oldy + 1 ) { if ( yi == oldy + 1 ) {
memcpy( row1, row2, outwidth3 ); memcpy( row1, row2, outwidth3 );
} }

View File

@ -254,7 +254,7 @@ void release( Undoable* undoable ){
m_undoables.erase( undoable ); m_undoables.erase( undoable );
} }
void setLevels( std::size_t levels ){ void setLevels( std::size_t levels ){
if ( levels > MAX_UNDO_LEVELS() ) { if ( levels > static_cast<unsigned>( MAX_UNDO_LEVELS() ) ) {
levels = MAX_UNDO_LEVELS(); levels = MAX_UNDO_LEVELS();
} }

View File

@ -89,7 +89,7 @@ ClipPoint(){
Reset(); Reset();
}; };
void Reset(){ void Reset(){
m_ptClip[0] = m_ptClip[1] = m_ptClip[2] = 0.0; m_ptClip[0] = m_ptClip[1] = m_ptClip[2] = 0.f;
m_bSet = false; m_bSet = false;
} }
bool Set(){ bool Set(){
@ -198,7 +198,7 @@ inline bool GlobalClipPoints_valid(){
return g_Clip1.Set() && g_Clip2.Set(); return g_Clip1.Set() && g_Clip2.Set();
} }
void PlanePointsFromClipPoints( Vector3 planepts[3], const AABB& bounds, int viewtype ){ void PlanePointsFromClipPoints( Vector3 planepts[3], const AABB& bounds, VIEWTYPE viewtype ){
ASSERT_MESSAGE( GlobalClipPoints_valid(), "clipper points not initialised" ); ASSERT_MESSAGE( GlobalClipPoints_valid(), "clipper points not initialised" );
planepts[0] = g_Clip1.m_ptClip; planepts[0] = g_Clip1.m_ptClip;
planepts[1] = g_Clip2.m_ptClip; planepts[1] = g_Clip2.m_ptClip;
@ -231,9 +231,6 @@ void PlanePointsFromClipPoints( Vector3 planepts[3], const AABB& bounds, int vie
void Clip_Update(){ void Clip_Update(){
Vector3 planepts[3]; Vector3 planepts[3];
if ( !GlobalClipPoints_valid() ) { if ( !GlobalClipPoints_valid() ) {
planepts[0] = Vector3( 0, 0, 0 );
planepts[1] = Vector3( 0, 0, 0 );
planepts[2] = Vector3( 0, 0, 0 );
Scene_BrushSetClipPlane( GlobalSceneGraph(), Plane3( 0, 0, 0, 0 ) ); Scene_BrushSetClipPlane( GlobalSceneGraph(), Plane3( 0, 0, 0, 0 ) );
} }
else else
@ -264,7 +261,6 @@ void Clip(){
g_Clip2.Reset(); g_Clip2.Reset();
g_Clip3.Reset(); g_Clip3.Reset();
Clip_Update(); Clip_Update();
ClipperChangeNotify();
if( g_quick_clipper ){ if( g_quick_clipper ){
g_quick_clipper = false; g_quick_clipper = false;
ClipperMode(); ClipperMode();
@ -282,7 +278,6 @@ void SplitClip(){
g_Clip2.Reset(); g_Clip2.Reset();
g_Clip3.Reset(); g_Clip3.Reset();
Clip_Update(); Clip_Update();
ClipperChangeNotify();
if( g_quick_clipper ){ if( g_quick_clipper ){
g_quick_clipper = false; g_quick_clipper = false;
ClipperMode(); ClipperMode();
@ -293,7 +288,6 @@ void SplitClip(){
void FlipClip(){ void FlipClip(){
g_bSwitch = !g_bSwitch; g_bSwitch = !g_bSwitch;
Clip_Update(); Clip_Update();
ClipperChangeNotify();
} }
void OnClipMode( bool enabled ){ void OnClipMode( bool enabled ){
@ -306,7 +300,6 @@ void OnClipMode( bool enabled ){
} }
Clip_Update(); Clip_Update();
ClipperChangeNotify();
} }
bool ClipMode(){ bool ClipMode(){
@ -336,7 +329,6 @@ void NewClipPoint( const Vector3& point ){
} }
Clip_Update(); Clip_Update();
ClipperChangeNotify();
} }
@ -428,6 +420,7 @@ inline unsigned int buttons_for_button_and_modifiers( ButtonIdentifier button, M
case ButtonEnumeration::LEFT: buttons |= RAD_LBUTTON; break; case ButtonEnumeration::LEFT: buttons |= RAD_LBUTTON; break;
case ButtonEnumeration::MIDDLE: buttons |= RAD_MBUTTON; break; case ButtonEnumeration::MIDDLE: buttons |= RAD_MBUTTON; break;
case ButtonEnumeration::RIGHT: buttons |= RAD_RBUTTON; break; case ButtonEnumeration::RIGHT: buttons |= RAD_RBUTTON; break;
default: break;
} }
if ( bitfield_enabled( flags, c_modifierControl ) ) { if ( bitfield_enabled( flags, c_modifierControl ) ) {
@ -978,20 +971,31 @@ void XYWnd::DropClipPoint( int pointx, int pointy ){
Vector3 mid; Vector3 mid;
Select_GetMid( mid ); Select_GetMid( mid );
g_clip_viewtype = static_cast<VIEWTYPE>( GetViewType() ); g_clip_viewtype = GetViewType();
const int nDim = ( g_clip_viewtype == YZ ) ? 0 : ( ( g_clip_viewtype == XZ ) ? 1 : 2 ); const int nDim = ( g_clip_viewtype == YZ ) ? 0 : ( ( g_clip_viewtype == XZ ) ? 1 : 2 );
point[nDim] = mid[nDim]; point[nDim] = mid[nDim];
vector3_snap( point, GetSnapGridSize() ); vector3_snap( point, GetSnapGridSize() );
NewClipPoint( point ); NewClipPoint( point );
} }
Timer g_clipper_timer;
bool g_clipper_doubleclicked = false;
void XYWnd::Clipper_OnLButtonDown( int x, int y ){ void XYWnd::Clipper_OnLButtonDown( int x, int y ){
bool doubleclick = g_clipper_timer.elapsed_msec() < 200;
Vector3 mousePosition; Vector3 mousePosition;
XY_ToPoint( x, y, mousePosition ); XY_ToPoint( x, y, mousePosition );
g_pMovingClip = GlobalClipPoints_Find( mousePosition, (VIEWTYPE)m_viewType, m_fScale ); g_pMovingClip = GlobalClipPoints_Find( mousePosition, m_viewType, m_fScale );
if ( !g_pMovingClip ) { if ( !g_pMovingClip ) {
DropClipPoint( x, y ); DropClipPoint( x, y );
} }
else if( doubleclick ){
UndoableCommand undo( "clipperClip" );
Clip();
g_clipper_doubleclicked = true;
}
g_clipper_timer.start();
} }
void XYWnd::Clipper_OnLButtonUp( int x, int y ){ void XYWnd::Clipper_OnLButtonUp( int x, int y ){
@ -1005,7 +1009,6 @@ void XYWnd::Clipper_OnMouseMoved( int x, int y ){
XY_ToPoint( x, y, g_pMovingClip->m_ptClip ); XY_ToPoint( x, y, g_pMovingClip->m_ptClip );
XY_SnapToGrid( g_pMovingClip->m_ptClip ); XY_SnapToGrid( g_pMovingClip->m_ptClip );
Clip_Update(); Clip_Update();
ClipperChangeNotify();
} }
} }
@ -1016,7 +1019,7 @@ void XYWnd::Clipper_Crosshair_OnMouseMoved( int x, int y ){
Vector3 mousePosition; Vector3 mousePosition;
XY_ToPoint( x, y, mousePosition ); XY_ToPoint( x, y, mousePosition );
if ( ClipMode() ) { if ( ClipMode() ) {
if( GlobalClipPoints_Find( mousePosition, (VIEWTYPE)m_viewType, m_fScale ) != 0 ){ if( GlobalClipPoints_Find( mousePosition, m_viewType, m_fScale ) != 0 ){
GdkCursor *cursor; GdkCursor *cursor;
cursor = gdk_cursor_new( GDK_CROSSHAIR ); cursor = gdk_cursor_new( GDK_CROSSHAIR );
//cursor = gdk_cursor_new( GDK_FLEUR ); //cursor = gdk_cursor_new( GDK_FLEUR );
@ -1031,7 +1034,6 @@ void XYWnd::Clipper_Crosshair_OnMouseMoved( int x, int y ){
// g_object_unref( pixbuf ); // g_object_unref( pixbuf );
gdk_window_set_cursor( m_gl_widget->window, cursor ); gdk_window_set_cursor( m_gl_widget->window, cursor );
gdk_cursor_unref( cursor ); gdk_cursor_unref( cursor );
} }
} }
else else
@ -1518,8 +1520,10 @@ void XYWnd::XY_MouseUp( int x, int y, unsigned int buttons ){
else if ( m_zoom_started ) { else if ( m_zoom_started ) {
Zoom_End(); Zoom_End();
} }
else if ( ClipMode() && ( buttons == Clipper_buttons() || buttons == Clipper_quick_buttons() ) ) { else if ( ( ClipMode() && ( buttons == Clipper_buttons() || buttons == Clipper_quick_buttons() ) ) ||
g_clipper_doubleclicked ){
Clipper_OnLButtonUp( x, y ); Clipper_OnLButtonUp( x, y );
g_clipper_doubleclicked = false;
} }
else if ( m_bNewBrushDrag ) { else if ( m_bNewBrushDrag ) {
m_bNewBrushDrag = false; m_bNewBrushDrag = false;
@ -2455,7 +2459,7 @@ void SetState( Shader* state, EStyle style ){
m_state_stack.back().m_state = state; m_state_stack.back().m_state = state;
} }
} }
const EStyle getStyle() const { EStyle getStyle() const {
return eWireframeOnly; return eWireframeOnly;
} }
void PushState(){ void PushState(){

View File

@ -26,7 +26,7 @@
#include "bytebool.h" #include "bytebool.h"
#ifdef _WIN32 #ifdef _MSC_VER
#pragma warning(disable : 4244) // MIPS #pragma warning(disable : 4244) // MIPS
#pragma warning(disable : 4136) // X86 #pragma warning(disable : 4136) // X86
#pragma warning(disable : 4051) // ALPHA #pragma warning(disable : 4051) // ALPHA
@ -46,7 +46,7 @@
#include <time.h> #include <time.h>
#include <stdarg.h> #include <stdarg.h>
#ifdef _WIN32 #ifdef _MSC_VER
#pragma intrinsic( memset, memcpy ) #pragma intrinsic( memset, memcpy )

View File

@ -44,7 +44,7 @@
#define R_OK 04 #define R_OK 04
#endif #endif
#define S_ISDIR( mode ) ( mode & _S_IFDIR ) //#define S_ISDIR( mode ) ( mode & _S_IFDIR )
#define PATH_MAX 260 #define PATH_MAX 260
#endif #endif
#include <glib.h> #include <glib.h>

View File

@ -674,11 +674,13 @@ static void ConvertBrush( FILE *f, int num, bspBrush_t *brush, vec3_t origin, qb
vert[2]->xyz[sv], vert[2]->xyz[tv], stK[i] vert[2]->xyz[sv], vert[2]->xyz[tv], stK[i]
); );
VectorSet( sts[i], D0 / D, D1 / D, D2 / D ); VectorSet( sts[i], D0 / D, D1 / D, D2 / D );
//Sys_Printf( "%.3f %.3f %.3f \n", sts[i][0], sts[i][1], sts[i][2] );
} }
} }
else{ else{
fprintf( stderr, "degenerate triangle found when solving texDef equations\n" ); // FIXME add stuff here fprintf( stderr, "degenerate triangle found when solving texDef equations\n" ); // FIXME add stuff here
VectorSet( sts[0], 2.f, 0.f, 0.f );
VectorSet( sts[1], 0.f, -2.f, 0.f );
} }
// now we must solve: // now we must solve:
// // now we must invert: // // now we must invert:

View File

@ -3221,7 +3221,7 @@ void IlluminateVertexes( int num ){
void SetupBrushesFlags( int mask_any, int test_any, int mask_all, int test_all ){ void SetupBrushesFlags( int mask_any, int test_any, int mask_all, int test_all ){
int i, j, b; int i, j, b;
unsigned int compileFlags, allCompileFlags; int compileFlags, allCompileFlags;
bspBrush_t *brush; bspBrush_t *brush;
bspBrushSide_t *side; bspBrushSide_t *side;
bspShader_t *shader; bspShader_t *shader;
@ -3249,7 +3249,7 @@ void SetupBrushesFlags( int mask_any, int test_any, int mask_all, int test_all )
/* check all sides */ /* check all sides */
compileFlags = 0; compileFlags = 0;
allCompileFlags = ~( 0u ); allCompileFlags = ~( 0 );
for ( j = 0; j < brush->numSides; j++ ) for ( j = 0; j < brush->numSides; j++ )
{ {
/* do bsp shader calculations */ /* do bsp shader calculations */