propagate from internal tree

git-svn-id: svn://svn.icculus.org/gtkradiant/GtkRadiant/branches/ZeroRadiant@191 8a3a26a2-13c4-0310-b231-cf6edde360e5
This commit is contained in:
TTimo 2007-11-05 13:28:33 +00:00
commit 0975f4af11
12 changed files with 136 additions and 1314 deletions

View file

@ -60,7 +60,6 @@ could be split into two independant libraries actually, the server part and the
#if defined(_WIN32) #if defined(_WIN32)
#define SYNAPSE_DLL_EXPORT WINAPI #define SYNAPSE_DLL_EXPORT WINAPI
#elif defined(__linux__) || defined(__APPLE__) /* ydnar */ #elif defined(__linux__) || defined(__APPLE__) /* ydnar */
// #define SYNAPSE_DLL_EXPORT __attribute__ ((visibility ("protected")))
#define SYNAPSE_DLL_EXPORT #define SYNAPSE_DLL_EXPORT
#else #else
#error unknown architecture #error unknown architecture

View file

@ -42,12 +42,6 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include <jpeglib.h> #include <jpeglib.h>
#include <jerror.h> #include <jerror.h>
/*
extern "C" {
#include "radiant_jpeglib.h"
#include "jpeg6/jerror.h"
}
*/
#include "image.h" #include "image.h"

View file

@ -243,5 +243,3 @@ void LoadImage (const char *filename, unsigned char **pic, int *width, int *heig
free(row_pointers); free(row_pointers);
g_FileSystemTable.m_pfnFreeFile (fbuffer); g_FileSystemTable.m_pfnFreeFile (fbuffer);
} }

View file

@ -102,5 +102,3 @@ const char* CSynapseClientVFS::GetName()
{ {
return "VFS"; return "VFS";
} }

View file

@ -56,8 +56,14 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "model", "plugins\model\mode
EndProjectSection EndProjectSection
EndProject EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "shaders", "plugins\shaders\shaders.vcproj", "{AEBCB950-AB67-48BB-9AF5-FCFB042824E8}" Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "shaders", "plugins\shaders\shaders.vcproj", "{AEBCB950-AB67-48BB-9AF5-FCFB042824E8}"
ProjectSection(ProjectDependencies) = postProject
{E13CCFB0-A366-4EF3-A66F-C374B563E4DF} = {E13CCFB0-A366-4EF3-A66F-C374B563E4DF}
EndProjectSection
EndProject EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "surface", "plugins\surface\surface.vcproj", "{6FDF6CFE-52FF-4E8C-A6F6-C0392DAE4DB7}" Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "surface", "plugins\surface\surface.vcproj", "{6FDF6CFE-52FF-4E8C-A6F6-C0392DAE4DB7}"
ProjectSection(ProjectDependencies) = postProject
{E13CCFB0-A366-4EF3-A66F-C374B563E4DF} = {E13CCFB0-A366-4EF3-A66F-C374B563E4DF}
EndProjectSection
EndProject EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "vfspk3", "plugins\vfspk3\vfspk3.vcproj", "{DEFCF433-3A47-40EB-BBF7-861211C3A941}" Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "vfspk3", "plugins\vfspk3\vfspk3.vcproj", "{DEFCF433-3A47-40EB-BBF7-861211C3A941}"
ProjectSection(ProjectDependencies) = postProject ProjectSection(ProjectDependencies) = postProject

File diff suppressed because it is too large Load diff

View file

@ -290,40 +290,46 @@ void CDbgDlg::SetHighlight(gint row)
} }
} }
ISAXHandler *CDbgDlg::GetElement (gint row) ISAXHandler *CDbgDlg::GetElement( gint row ) {
{ return static_cast<ISAXHandler *>( g_ptr_array_index( m_pFeedbackElements, row ) );
return static_cast<ISAXHandler *>(g_ptr_array_index(m_pFeedbackElements, row));
} }
void CDbgDlg::Init () void CDbgDlg::ClearFeedbackArray() {
{ // free all the ISAXHandler*, clean it
while ( m_pFeedbackElements->len ) {
// some ISAXHandler are static and passed around but should never be deleted
ISAXHandler *handler = static_cast< ISAXHandler * >( g_ptr_array_index( m_pFeedbackElements, 0 ) );
if ( handler->ShouldDelete() ) {
delete handler;
}
g_ptr_array_remove_index( m_pFeedbackElements, 0 );
}
}
void CDbgDlg::Init() {
DropHighlight(); DropHighlight();
// free all the ISAXHandler*, clean it ClearFeedbackArray();
while (m_pFeedbackElements->len)
{
delete static_cast<ISAXHandler *>(g_ptr_array_index (m_pFeedbackElements, 0));
g_ptr_array_remove_index (m_pFeedbackElements, 0);
}
if (m_clist != NULL) if ( m_clist != NULL ) {
gtk_list_store_clear (m_clist); gtk_list_store_clear( m_clist );
}
} }
void CDbgDlg::Push (ISAXHandler *pHandler) void CDbgDlg::Push( ISAXHandler *pHandler ) {
{
// push in the list // push in the list
g_ptr_array_add (m_pFeedbackElements, (void *)pHandler); g_ptr_array_add( m_pFeedbackElements, (void *)pHandler );
if (m_pWidget == NULL) if ( m_pWidget == NULL ) {
Create(); Create();
}
// put stuff in the list // put stuff in the list
gtk_list_store_clear (m_clist); gtk_list_store_clear( m_clist );
for(unsigned int i = 0; i < m_pFeedbackElements->len; ++i) unsigned int i;
{ for ( i = 0; i < m_pFeedbackElements->len; i++ ) {
GtkTreeIter iter; GtkTreeIter iter;
gtk_list_store_append(m_clist, &iter); gtk_list_store_append( m_clist, &iter );
gtk_list_store_set(m_clist, &iter, 0, GetElement(i)->getName(), -1); gtk_list_store_set( m_clist, &iter, 0, GetElement(i)->getName(), -1 );
} }
ShowDlg(); ShowDlg();

View file

@ -106,18 +106,18 @@ class CDbgDlg : public Dialog
GtkListStore* m_clist; GtkListStore* m_clist;
ISAXHandler *m_pHighlight; ISAXHandler *m_pHighlight;
public: public:
CDbgDlg() { m_pFeedbackElements = g_ptr_array_new (); m_pHighlight = NULL; } CDbgDlg() { m_pFeedbackElements = g_ptr_array_new(); m_pHighlight = NULL; }
virtual ~CDbgDlg() { } virtual ~CDbgDlg() { ClearFeedbackArray(); }
// refresh items // refresh items
void Push (ISAXHandler *); void Push( ISAXHandler * );
// clean the debug window, release all ISAXHanlders we have // clean the debug window, release all ISAXHanlders we have
void Init(); void Init();
ISAXHandler *GetElement(gint row); ISAXHandler *GetElement(gint row);
void SetHighlight(gint row); void SetHighlight(gint row);
void DropHighlight(); void DropHighlight();
// void HideDlg();
protected: protected:
void BuildDialog (); void BuildDialog();
void ClearFeedbackArray();
}; };
extern CDbgDlg g_DbgDlg; extern CDbgDlg g_DbgDlg;

View file

@ -41,13 +41,16 @@ class CPointfile : public ISAXHandler
public: public:
CPointfile() { } CPointfile() { }
void Init(); void Init();
void PushPoint (vec3_t v); void PushPoint( vec3_t v );
void GenerateDisplayList(); void GenerateDisplayList();
// SAX interface // SAX interface
void saxStartElement (message_info_t *ctx, const xmlChar *name, const xmlChar **attrs); void saxStartElement( message_info_t *ctx, const xmlChar *name, const xmlChar **attrs );
void saxEndElement (message_info_t *ctx, const xmlChar *name); void saxEndElement( message_info_t *ctx, const xmlChar *name );
void saxCharacters (message_info_t *ctx, const xmlChar *ch, int len); void saxCharacters( message_info_t *ctx, const xmlChar *ch, int len );
char *getName(); char *getName();
// class is only used for g_pointfile and we should not attempt to free it
bool ShouldDelete() { return false; }
}; };
// instead of using Pointfile_Load you can do it by hand through g_pointfile // instead of using Pointfile_Load you can do it by hand through g_pointfile

View file

@ -110,28 +110,28 @@ static void saxStartElement(message_info_t *data, const xmlChar *name, const xml
{ {
data->bGeometry = true; data->bGeometry = true;
data->pGeometry = &g_pointfile; data->pGeometry = &g_pointfile;
data->pGeometry->saxStartElement (data, name, attrs); data->pGeometry->saxStartElement( data, name, attrs );
} }
else if (strcmp ((char *)name, "select") == 0) else if (strcmp ((char *)name, "select") == 0)
{ {
CSelectMsg *pSelect = new CSelectMsg(); CSelectMsg *pSelect = new CSelectMsg();
data->bGeometry = true; data->bGeometry = true;
data->pGeometry = pSelect; data->pGeometry = pSelect;
data->pGeometry->saxStartElement (data, name, attrs); data->pGeometry->saxStartElement( data, name, attrs );
} }
else if (strcmp ((char *)name, "pointmsg") == 0) else if (strcmp ((char *)name, "pointmsg") == 0)
{ {
CPointMsg *pPoint = new CPointMsg(); CPointMsg *pPoint = new CPointMsg();
data->bGeometry = true; data->bGeometry = true;
data->pGeometry = pPoint; data->pGeometry = pPoint;
data->pGeometry->saxStartElement (data, name, attrs); data->pGeometry->saxStartElement( data, name, attrs );
} }
else if (strcmp ((char *)name, "windingmsg") == 0) else if (strcmp ((char *)name, "windingmsg") == 0)
{ {
CWindingMsg *pWinding = new CWindingMsg(); CWindingMsg *pWinding = new CWindingMsg();
data->bGeometry = true; data->bGeometry = true;
data->pGeometry = pWinding; data->pGeometry = pWinding;
data->pGeometry->saxStartElement (data, name, attrs); data->pGeometry->saxStartElement( data, name, attrs );
} }
else else
{ {
@ -145,33 +145,29 @@ static void saxStartElement(message_info_t *data, const xmlChar *name, const xml
data->recurse++; data->recurse++;
} }
static void saxEndElement(message_info_t *data, const xmlChar *name) static void saxEndElement(message_info_t *data, const xmlChar *name) {
{
data->recurse--; data->recurse--;
// we are out of an ignored chunk // we are out of an ignored chunk
if (data->recurse == data->ignore_depth) if ( data->recurse == data->ignore_depth ) {
{
data->ignore_depth = 0; data->ignore_depth = 0;
return; return;
} }
if (data->bGeometry) if ( data->bGeometry ) {
{ data->pGeometry->saxEndElement( data, name );
data->pGeometry->saxEndElement (data, name);
// we add the object to the debug window // we add the object to the debug window
if (!data->bGeometry) if ( !data->bGeometry ) {
{ g_DbgDlg.Push( data->pGeometry );
g_DbgDlg.Push (data->pGeometry);
} }
} }
if (data->recurse == data->stop_depth) if ( data->recurse == data->stop_depth ) {
{
#ifdef _DEBUG #ifdef _DEBUG
Sys_Printf ("Received error msg .. shutting down..\n"); Sys_Printf ("Received error msg .. shutting down..\n");
#endif #endif
g_pParentWnd->GetWatchBSP()->Reset(); g_pParentWnd->GetWatchBSP()->Reset();
// tell there has been an error // tell there has been an error
if (g_pParentWnd->GetWatchBSP()->HasBSPPlugin ()) if ( g_pParentWnd->GetWatchBSP()->HasBSPPlugin() ) {
g_BSPFrontendTable.m_pfnEndListen(2); g_BSPFrontendTable.m_pfnEndListen( 2 );
}
return; return;
} }
} }
@ -317,39 +313,36 @@ bool CWatchBSP::SetupListening()
return true; return true;
} }
void CWatchBSP::DoEBeginStep() void CWatchBSP::DoEBeginStep() {
{
Reset(); Reset();
if (SetupListening() == false) if ( !SetupListening() ) {
{
CString msg; CString msg;
msg = "Failed to get a listening socket on port 39000.\nTry running with BSP monitoring disabled if you can't fix this.\n"; msg = "Failed to get a listening socket on port 39000.\nTry running with BSP monitoring disabled if you can't fix this.\n";
Sys_Printf (msg); Sys_Printf( msg );
gtk_MessageBox (g_pParentWnd->m_pWidget, msg, "BSP monitoring", MB_OK | MB_ICONERROR); gtk_MessageBox( g_pParentWnd->m_pWidget, msg, "BSP monitoring", MB_OK | MB_ICONERROR );
return; return;
} }
// set the timer for timeouts and step cancellation // set the timer for timeouts and step cancellation
g_timer_reset( m_pTimer ); g_timer_reset( m_pTimer );
g_timer_start( m_pTimer ); g_timer_start( m_pTimer );
if (!m_bBSPPlugin) if ( !m_bBSPPlugin ) {
{ Sys_Printf( "=== running BSP command ===\n%s\n", g_ptr_array_index( m_pCmd, m_iCurrentStep ) );
Sys_Printf("=== running BSP command ===\n%s\n", g_ptr_array_index( m_pCmd, m_iCurrentStep ) );
if (!Q_Exec(NULL, (char *)g_ptr_array_index( m_pCmd, m_iCurrentStep ), NULL, true )) if ( !Q_Exec( NULL, (char *)g_ptr_array_index( m_pCmd, m_iCurrentStep ), NULL, true ) ) {
{
CString msg; CString msg;
msg = "Failed to execute the following command: "; msg = "Failed to execute the following command: ";
msg += (char *)g_ptr_array_index( m_pCmd, m_iCurrentStep ); msg += (char *)g_ptr_array_index( m_pCmd, m_iCurrentStep );
msg += "\nCheck that the file exists and that you don't run out of system resources.\n"; msg += "\nCheck that the file exists and that you don't run out of system resources.\n";
Sys_Printf(msg); Sys_Printf( msg );
gtk_MessageBox(g_pParentWnd->m_pWidget, msg, "BSP monitoring", MB_OK | MB_ICONERROR ); gtk_MessageBox( g_pParentWnd->m_pWidget, msg, "BSP monitoring", MB_OK | MB_ICONERROR );
return; return;
} }
// re-initialise the debug window // re-initialise the debug window
if (m_iCurrentStep == 0) if ( m_iCurrentStep == 0 ) {
g_DbgDlg.Init(); g_DbgDlg.Init();
} }
}
m_eState = EBeginStep; m_eState = EBeginStep;
} }

View file

@ -44,12 +44,13 @@ struct message_info_s;
class ISAXHandler class ISAXHandler
{ {
public: public:
virtual void saxStartElement (struct message_info_s *ctx, const xmlChar *name, const xmlChar **attrs) = 0; virtual void saxStartElement( struct message_info_s *ctx, const xmlChar *name, const xmlChar **attrs ) = 0;
virtual void saxEndElement (struct message_info_s *ctx, const xmlChar *name) = 0; virtual void saxEndElement( struct message_info_s *ctx, const xmlChar *name ) = 0;
virtual void saxCharacters (struct message_info_s *ctx, const xmlChar *ch, int len) = 0; virtual void saxCharacters( struct message_info_s *ctx, const xmlChar *ch, int len ) = 0;
virtual char *getName() { return NULL; } virtual char *getName() { return NULL; }
virtual void Highlight() { } virtual void Highlight() { }
virtual void DropHighlight() { } virtual void DropHighlight() { }
virtual bool ShouldDelete() { return true; } // should the handler be deleted when the feedback dialog is cleared?
}; };
// a 'user data' structure we pass along in the SAX callbacks to represent the current state // a 'user data' structure we pass along in the SAX callbacks to represent the current state

View file

@ -381,8 +381,7 @@ mesh_t *SubdivideMesh( mesh_t in, float maxError, float minLength )
float len; float len;
mesh_t out; mesh_t out;
/* ydnar: static for os x */ static bspDrawVert_t expand[MAX_EXPANDED_AXIS][MAX_EXPANDED_AXIS];
MAC_STATIC bspDrawVert_t expand[MAX_EXPANDED_AXIS][MAX_EXPANDED_AXIS];
out.width = in.width; out.width = in.width;
@ -548,8 +547,7 @@ mesh_t *SubdivideMesh2( mesh_t in, int iterations )
bspDrawVert_t prev, next, mid; bspDrawVert_t prev, next, mid;
mesh_t out; mesh_t out;
/* ydnar: static for os x */ static bspDrawVert_t expand[ MAX_EXPANDED_AXIS ][ MAX_EXPANDED_AXIS ];
MAC_STATIC bspDrawVert_t expand[ MAX_EXPANDED_AXIS ][ MAX_EXPANDED_AXIS ];
/* initial setup */ /* initial setup */
@ -654,8 +652,7 @@ mesh_t *RemoveLinearMeshColumnsRows( mesh_t *in ) {
vec3_t proj, dir; vec3_t proj, dir;
mesh_t out; mesh_t out;
/* ydnar: static for os x */ static bspDrawVert_t expand[MAX_EXPANDED_AXIS][MAX_EXPANDED_AXIS];
MAC_STATIC bspDrawVert_t expand[MAX_EXPANDED_AXIS][MAX_EXPANDED_AXIS];
out.width = in->width; out.width = in->width;
@ -731,7 +728,8 @@ mesh_t *SubdivideMeshQuads( mesh_t *in, float minLength, int maxsize, int *width
vec3_t dir; vec3_t dir;
float length, maxLength, amount; float length, maxLength, amount;
mesh_t out; mesh_t out;
bspDrawVert_t expand[MAX_EXPANDED_AXIS][MAX_EXPANDED_AXIS];
static bspDrawVert_t expand[MAX_EXPANDED_AXIS][MAX_EXPANDED_AXIS];
out.width = in->width; out.width = in->width;
out.height = in->height; out.height = in->height;