git-svn-id: svn://svn.icculus.org/gtkradiant/GtkRadiant/branches/ZeroRadiant.ab@188 8a3a26a2-13c4-0310-b231-cf6edde360e5
This commit is contained in:
TTimo 2007-11-04 03:59:18 +00:00
parent 2b5ef55c7c
commit beb511aadb
10 changed files with 168 additions and 1335 deletions

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

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

@ -39,15 +39,18 @@ void Pointfile_Load( void );
class CPointfile : public ISAXHandler 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,35 +145,31 @@ 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;
{ return;
data->ignore_depth = 0; }
return; if ( data->bGeometry ) {
} data->pGeometry->saxEndElement( data, name );
if (data->bGeometry) // we add the object to the debug window
{ if ( !data->bGeometry ) {
data->pGeometry->saxEndElement (data, name); g_DbgDlg.Push( data->pGeometry );
// we add the object to the debug window }
if (!data->bGeometry) }
{ if ( data->recurse == data->stop_depth ) {
g_DbgDlg.Push (data->pGeometry);
}
}
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;
}
} }
static void saxCharacters(message_info_t *data, const xmlChar *ch, int len) static void saxCharacters(message_info_t *data, const xmlChar *ch, int len)
@ -317,40 +313,37 @@ bool CWatchBSP::SetupListening()
return true; return true;
} }
void CWatchBSP::DoEBeginStep() void CWatchBSP::DoEBeginStep() {
{ Reset();
Reset(); if ( !SetupListening() ) {
if (SetupListening() == false) 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";
CString msg; Sys_Printf( msg );
msg = "Failed to get a listening socket on port 39000.\nTry running with BSP monitoring disabled if you can't fix this.\n"; gtk_MessageBox( g_pParentWnd->m_pWidget, msg, "BSP monitoring", MB_OK | MB_ICONERROR );
Sys_Printf (msg); return;
gtk_MessageBox (g_pParentWnd->m_pWidget, msg, "BSP monitoring", MB_OK | MB_ICONERROR); }
return; // set the timer for timeouts and step cancellation
} g_timer_reset( m_pTimer );
// set the timer for timeouts and step cancellation g_timer_start( m_pTimer );
g_timer_reset( 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;
} }
void CWatchBSP::RoutineProcessing() void CWatchBSP::RoutineProcessing()

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
@ -59,12 +60,12 @@ public:
// the level for stopping the feed is stored in stop_depth // the level for stopping the feed is stored in stop_depth
// unkown nodes are ignored, we use ignore_depth to track the level we start ignoring from // unkown nodes are ignored, we use ignore_depth to track the level we start ignoring from
typedef struct message_info_s { typedef struct message_info_s {
int msg_level; // current message level (SYS_MSG, SYS_WRN, SYS_ERR) int msg_level; // current message level (SYS_MSG, SYS_WRN, SYS_ERR)
int recurse; // current recursion depth (used to track various things) int recurse; // current recursion depth (used to track various things)
int ignore_depth; // the ignore depth limit when we are jumping over unknown nodes (0 means we are not ignoring) int ignore_depth; // the ignore depth limit when we are jumping over unknown nodes (0 means we are not ignoring)
int stop_depth; // the depth we need to stop at the end int stop_depth; // the depth we need to stop at the end
bool bGeometry; // are we parsing some geometry information (i.e. do we forward the SAX calls?) bool bGeometry; // are we parsing some geometry information (i.e. do we forward the SAX calls?)
ISAXHandler *pGeometry; // the handler ISAXHandler *pGeometry; // the handler
} message_info_t; } message_info_t;
#endif #endif

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;