void Browse();
void Reload();
void SetPosLabel();
-// ~BackgroundDialogPage();
};
//TODO GetMapName saves the map. eeep!
//also with no map, returns unnamed.map, otherwise returns full path
-// Syn_Printf(MSG_PREFIX "GetMapName() %s\n",
-// g_FuncTable.m_pfnGetMapName());
ct = g_FuncTable.m_pfnReadProjectKey( "basepath" );
// TODO shouldn't need this stuff
g_signal_connect( G_OBJECT( w ), "clicked", G_CALLBACK( reload_callback ),
( gpointer ) this );
// TODO disable until we have file
- // gtk_widget_set_sensitive(w,FALSE);
gtk_tooltips_set_tip( pTooltips, w, "Reload current file", NULL );
gtk_box_pack_start( GTK_BOX( hbox ),w, FALSE, FALSE, 5 );
gtk_widget_show( w );
GTK_SIGNAL_FUNC( close_callback ), NULL );
gtk_signal_connect( GTK_OBJECT( pDialogWnd ), "response",
GTK_SIGNAL_FUNC( response_callback ), NULL );
-// gtk_signal_connect( GTK_OBJECT (pDialogWnd), "expose_event", GTK_SIGNAL_FUNC( ci_expose ), NULL );
pTooltips = gtk_tooltips_new();
VectorScale( dist, 1 / flight_time, speed );
speed[2] = speed_z;
-// Sys_Printf("Speed: (%.4f %.4f %.4f)\n", speed[0], speed[1], speed[2]);
vec3_t* pPath = new vec3_t[points];
VectorScale( speed, ltime, pPath[i] );
VectorAdd( pPath[i], start, pPath[i] );
- // could do this all with vectors
- // vGrav = {0, 0, -800.0f}
- // VectorScale(vGrav, 0.5f*ltime*ltime, vAdd);
- // VectorScale(speed, ltime, pPath[i]);
- // _VectorAdd(pPath[i], start, pPath[i])
- // _VectorAdd(pPath[i], vAdd, pPath[i])
-
pPath[i][2] = start[2] + ( speed_z * ltime ) + ( varGravity * 0.5f * ltime * ltime );
}
globalErrorStream() << "bobToolz PathPlotter: Entity must have a targetname.\n";
}
return;
-}
\ No newline at end of file
+}
// otherwise point is removed due to another plane..
- // Sys_Printf("(%f, %f, %f)\n", pnt[0], pnt[1], pnt[2]);
}
}
}
for ( int x = 0; x < p2->width; x++ )
newPatch->points[x][( y + p1->height - 1 )] = p2->points[x][y];
-// newPatch->Invert();
return newPatch;
}
}
}
else {
- //globalErrorStream() << "bobToolz SplitPatchRows: Patch has not enough rows for splitting.\n";
patchList.push_back( *this );
}
return patchList;
}
else
{
- //globalErrorStream() << "bobToolz SplitPatchRows: Patch has not enough rows for splitting.\n";
patchList.push_back( *this );
}
return patchList;
bool DPlane::IsRedundant( std::list<DPoint*>& pointList ){
int cnt = 0;
- //std::list<DPoint *>::const_iterator point=pointList.begin();
for ( std::list<DPoint *>::const_iterator point = pointList.begin(); point != pointList.end(); point++ )
{
if ( fabs( DistanceToPoint( ( *point )->_pnt ) ) < MAX_ROUND_ERROR ) {
VectorScale( origin, 0.5f, origin );
if ( nBorder >= Min( radius[0], radius[1] ) ) {
-// DoMessageBox("Border is too large", "Error", MB_OK);
return;
}
if ( !pTarget ) {
globalOutputStream() << "couldn't find target " << pSP->strTarget;
return;
-// continue;
}
pSP->pTarget = pTarget;
int i;
// models
-// SwapBlock( (int *)dmodels, nummodels * sizeof( dmodels[0] ) );
-
- // shaders (don't swap the name)
-// for ( i = 0 ; i < numShaders ; i++ ) {
-// dshaders[i].contentFlags = LittleLong( dshaders[i].contentFlags );
-// dshaders[i].surfaceFlags = LittleLong( dshaders[i].surfaceFlags );
-// }
// planes
SwapBlock( (int *)dplanes, numplanes * sizeof( dplanes[0] ) );
}
// drawindexes
-// SwapBlock( (int *)drawIndexes, numDrawIndexes * sizeof( drawIndexes[0] ) );
// drawsurfs
SwapBlock( (int *)drawSurfaces, numDrawSurfaces * sizeof( drawSurfaces[0] ) );
-
- // fogs
-// for ( i = 0 ; i < numFogs ; i++ ) {
-// dfogs[i].brushNum = LittleLong( dfogs[i].brushNum );
-// dfogs[i].visibleSide = LittleLong( dfogs[i].visibleSide );
-// }
}
/*
if ( rs.nBrushOptions == BRUSH_OPT_SELECTED ) {
if ( GlobalSelectionSystem().countSelected() < 2 ) {
- //DoMessageBox("Invalid number of brushes selected, choose at least 2", "Error", eMB_OK);
globalErrorStream() << "bobToolz Intersect: Invalid number of brushes selected, choose at least 2.\n";
return;
}
UndoableCommand undo( "bobToolz.polygons" );
// ensure we have something selected
if ( GlobalSelectionSystem().countSelected() != 1 ) {
- //DoMessageBox("Invalid number of brushes selected, choose 1 only", "Error", eMB_OK);
globalErrorStream() << "bobToolz Polygons: Invalid number of brushes selected, choose 1 only.\n";
return;
}
PolygonRS rs;
scene::Instance& instance = GlobalSelectionSystem().ultimateSelected();
if ( !Node_isBrush( instance.path().top() ) ) {
- //DoMessageBox("No brush selected, select ONLY one brush", "Error", eMB_OK);
globalErrorStream() << "bobToolz Polygons: No brush selected, select ONLY one brush.\n";
return;
}
// ensure we have something selected
if ( GlobalSelectionSystem().countSelected() != 1 ) {
- //DoMessageBox("Invalid number of brushes selected, choose 1 only", "Error", eMB_OK);
globalErrorStream() << "bobToolz BuildStairs: Invalid number of brushes selected, choose 1 only.\n";
return;
}
if ( ( (int)size[2] % rs.stairHeight ) != 0 ) {
// stairs must fit evenly into brush
- //DoMessageBox("Invalid stair height\nHeight of block must be divisable by stair height", "Error", eMB_OK);
globalErrorStream() << "bobToolz BuildStairs: Invalid stair height. Height of block must be divisable by stair height.\n";
}
else
UndoableCommand undo( "bobToolz.buildDoors" );
// ensure we have something selected
if ( GlobalSelectionSystem().countSelected() != 1 ) {
- //DoMessageBox("Invalid number of brushes selected, choose 1 only", "Error", eMB_OK);
globalErrorStream() << "bobToolz BuildDoors: Invalid number of brushes selected, choose 1 only.\n";
return;
}
/*
if( GlobalSelectionSystem().countSelected() != 1 )
{
- //DoMessageBox("Invalid number of brushes selected, choose 1 only", "Error", eMB_OK);
globalOutputStream() << "bobToolz PathPlotter: Invalid number of entities selected, choose 1 trigger_push entity only.\n";
return;
}
UndoableCommand undo( "bobToolz.pitBuilder" );
// ensure we have something selected
if ( GlobalSelectionSystem().countSelected() != 1 ) {
- //DoMessageBox("Invalid number of brushes selected, choose 1 only", "Error", eMB_OK);
globalErrorStream() << "bobToolz PitBuilder: Invalid number of brushes selected, choose 1 only.\n";
return;
}
scene::Instance& instance = GlobalSelectionSystem().ultimateSelected();
//seems it does this also with a patch with valid dimensions.. but probably better to enforce a brush.
if ( !Node_isBrush( instance.path().top() ) ) {
- //DoMessageBox("No brush selected, select ONLY one brush", "Error", eMB_OK);
globalErrorStream() << "bobToolz PitBuilder: No brush selected, select ONLY 1 brush.\n";
return;
}
}
else
{
- //DoMessageBox("Failed To Make Pit\nTry Making The Brush Bigger", "Error", eMB_OK);
globalErrorStream() << "bobToolz PitBuilder: Failed to make Pit, try making the brush bigger.\n";
}
}
// ensure we have something selected
if ( GlobalSelectionSystem().countSelected() != 2 ) {
globalErrorStream() << "bobToolz MergePatches: Invalid number of patches selected, choose 2 only.\n";
- //DoMessageBox("Invalid number of patches selected, choose 2 only", "Error", eMB_OK);
return;
}
for ( i = 0; i < 2; i++ )
{
if ( !Node_isPatch( patches[i]->path().top() ) ) {
- //DoMessageBox("No patches selected, select ONLY patches", "Error", eMB_OK);
globalErrorStream() << "bobToolz MergePatches: Invalid number of patches selected, choose ONLY 2 patches.\n";
return;
}
if ( merge_info.mergable ) {
globalOutputStream() << merge_info.pos1 << " " << merge_info.pos2;
//Message removed, No tools give feedback on success.
- //globalOutputStream() << "bobToolz MergePatches: Patches Mergable.\n";
DPatch* newPatch = mrgPatches[0].MergePatches( merge_info, &mrgPatches[0], &mrgPatches[1] );
/* mrgPatches[0].RemoveFromRadiant();
// ensure we have something selected
if ( GlobalSelectionSystem().countSelected() != 1 ) {
- //DoMessageBox("Invalid number of patches selected, choose 1 only", "Error", eMB_OK);
globalErrorStream() << "bobToolz SplitPatch: Invalid number of patches selected, choose only 1 patch.\n";
return;
}
scene::Instance& instance = GlobalSelectionSystem().ultimateSelected();
if ( !Node_isPatch( instance.path().top() ) ) {
- //DoMessageBox("No patch selected, select ONLY one patch", "Error", eMB_OK);
globalErrorStream() << "bobToolz SplitPatch: No patch selected, select ONLY 1 patch.\n";
return;
}
// ensure we have something selected
if ( GlobalSelectionSystem().countSelected() != 1 ) {
- //DoMessageBox("Invalid number of patches selected, choose 1 only", "Error", eMB_OK);
globalErrorStream() << "bobToolz SplitPatchCols: Invalid number of patches selected, choose 1 only.\n";
return;
}
scene::Instance& instance = GlobalSelectionSystem().ultimateSelected();
if ( !Node_isPatch( instance.path().top() ) ) {
- //DoMessageBox("No patch selected, select ONLY one patch", "Error", eMB_OK);
globalErrorStream() << "bobToolz SplitPatchCols: No patch selected, select ONLY 1 patch.\n";
return;
}
// ensure we have something selected
if ( GlobalSelectionSystem().countSelected() != 1 ) {
- //DoMessageBox("Invalid number of patches selected, choose 1 only", "Error", eMB_OK);
globalErrorStream() << "bobToolz SplitPatchRows: Invalid number of patches selected, choose 1 only.\n";
return;
}
scene::Instance& instance = GlobalSelectionSystem().ultimateSelected();
if ( !Node_isPatch( instance.path().top() ) ) {
- //DoMessageBox("No patch selected, select ONLY one patch", "Error", eMB_OK);
globalErrorStream() << "bobToolz SplitPatchRows: No patch selected, select ONLY 1 patch.\n";
return;
}
// ensure we have something selected
if ( GlobalSelectionSystem().countSelected() != 1 ) {
- //DoMessageBox("Invalid number of objects selected, choose 1 only", "Error", eMB_OK);
globalErrorStream() << "bobToolz VisAnalyse: Invalid number of objects selected, choose 1 only.\n";
return;
}
scene::Instance& brush = GlobalSelectionSystem().ultimateSelected();
//ensure we have a brush selected
if ( !Node_isBrush( brush.path().top() ) ) {
- //DoMessageBox("No brush selected, select ONLY one brush", "Error", eMB_OK);
globalErrorStream() << "bobToolz VisAnalyse: No brush selected, select ONLY 1 brush.\n";
return;
}
const char* rad_filename = GlobalRadiant().getMapName();
if ( !rad_filename ) {
- //DoMessageBox("An ERROR occurred while trying\n to get the map filename", "Error", eMB_OK);
globalErrorStream() << "bobToolz VisAnalyse: An ERROR occurred while trying to get the map filename.\n";
return;
}
// ensure we have something selected
if ( GlobalSelectionSystem().countSelected() != 2 ) {
- //DoMessageBox("Invalid number of objects selected, choose 2 only", "Error", eMB_OK);
globalErrorStream() << "bobToolz FlipTerrain: Invalid number of objects selected, choose 2 only.\n";
return;
}
for ( i = 0; i < 2; i++ )
{
if ( !Node_isBrush( brushes[i]->path().top() ) ) {
- //DoMessageBox("No brushes selected, select ONLY brushes", "Error", eMB_OK);
globalErrorStream() << "bobToolz FlipTerrain: No brushes selected, select ONLY 2 brushes.\n";
return;
}
for ( i = 0; i < 2; i++ ) {
Brushes[i].LoadFromBrush( *brushes[i], false );
if ( !( Planes[i] = Brushes[i].FindPlaneWithClosestNormal( vUp ) ) || Brushes[i].FindPointsForPlane( Planes[i], Points[i], 3 ) != 3 ) {
- //DoMessageBox("Error", "Error", eMB_OK);
globalErrorStream() << "bobToolz FlipTerrain: ERROR (FindPlaneWithClosestNormal/FindPointsForPlane).\n";
return;
}
found = false;
}
if ( dontmatch[0] == -1 ) {
- //DoMessageBox("Error", "Error", eMB_OK);
globalErrorStream() << "bobToolz FlipTerrain: ERROR (dontmatch[0]).\n";
return;
}
found = false;
}
if ( dontmatch[1] == -1 ) {
- //DoMessageBox("Error", "Error", eMB_OK);
globalErrorStream() << "bobToolz FlipTerrain: ERROR (dontmatch[1]).\n";
return;
}
Global Vars
==========================*/
-//HANDLE bsp_process;
char g_CurrentTexture[256] = "";
//=============================================================
{
case -1:
return false;
-// Error ("CreateProcess failed");
break;
case 0:
#ifdef _DEBUG
#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 );
Node_getTraversable( GlobalSceneGraph().root() )->insert( pEDoor1 );
Node_getTraversable( GlobalSceneGraph().root() )->insert( pEDoor2 );
-// ResetCurrentTexture();
}
//-----------------------------------------------------------------------------------
PatchControl& p = matrix( i,2 - j );
PatchControl& q = matrix( i, j );
std::swap( p.m_vertex, q.m_vertex );
- //std::swap(p.m_texcoord, q.m_texcoord);
}
}
GlobalPatchCreator().Patch_controlPointsChanged( patch );
//TODO - the patch has textures weird, patchmanip.h has all function it needs.. lots of duplicate code..
- //NaturalTexture(patch);
Node_getTraversable( GlobalRadiant().getMapWorldEntity() )->insert( patch );
}
vec3_t* topPoints = new vec3_t[nSteps + 1];
vec3_t* botPoints = new vec3_t[nSteps + 1];
- //bool bFacesUse[6] = {true, true, false, true, false, false};
vec3_t centre;
VectorCopy( vMin, centre );
int leafbytes; //leafbytes = ((portalclusters+63)&~63)>>3;
} vis_header;
-// added because int shift = 32; i = 0xFFFFFFFF >> shift;
// then i = 0xFFFFFFFF, when it should = 0
const unsigned long bitmasks[33] =
{
EMessageBoxReturn ret;
int loop = 1;
GSList *targetTypeRadio = NULL;
-// char buf[128];
// create the window
window = gtk_window_new( GTK_WINDOW_TOPLEVEL );
CCamera *combo_cam = firstCam;
if ( combo_cam ) {
while ( combo_cam ) {
- //combo_list = g_list_append( combo_list, (void *)combo_cam->GetCam()->getName() );
- //if( combo_cam->HasBeenSaved() ) {
combo_list = g_list_append( combo_list, (void *)combo_cam->GetFileName() );
- /*} else {
- char buf[128];
- sprintf( buf, "Unsaved Camera %i", combo_cam->GetCamNum() );
- combo_list = g_list_append( combo_list, (void *)buf );
-
- //combo_list = g_list_append( combo_list, (void *)combo_cam->GetCam()->getName() ); // FIXME: this requires camera.dll to create unique names for new cams
- }*/
combo_cam = combo_cam->GetNext();
}
}
// select our current entry in the list
if ( GetCurrentCam() ) {
// stop editing on the current cam
- //GetCurrentCam()->GetCam()->stopEdit(); // FIXME: this crashed on creating new cameras, why is it here?
GList *li = GTK_LIST( GTK_COMBO( g_pCamListCombo )->list )->children;
combo_cam = firstCam;
EMessageBoxReturn ret;
int i, loop = 1;
GSList *eventTypeRadio = NULL;
-// char buf[128];
if ( !GetCurrentCam() ) {
return TRUE;
if ( !camEventFlags[i][0] || ( str && str[0] ) ) {
int type = 0;
-// GList *li;
for ( type = 1; type < EVENT_COUNT; type++ ) {
if ( gtk_toggle_button_get_active( (GtkToggleButton*)eventWidget[type] ) ) {
gtk_window_set_title( GTK_WINDOW( window ), "Camera Inspector" );
gtk_signal_connect( GTK_OBJECT( window ), "delete_event", GTK_SIGNAL_FUNC( ci_close ), NULL );
gtk_signal_connect( GTK_OBJECT( window ), "expose_event", GTK_SIGNAL_FUNC( ci_expose ), NULL );
- // gtk_signal_connect( GTK_OBJECT (window), "destroy", GTK_SIGNAL_FUNC( gtk_widget_destroy ), NULL );
gtk_window_set_transient_for( GTK_WINDOW( window ), GTK_WINDOW( g_pRadiantWnd ) );
- // don't use show, as you don't want to have it displayed on startup ;-)
gtk_widget_realize( window );
// fill the window
g_pEventsList = gtk_clist_new( 3 );
gtk_container_add( GTK_CONTAINER( w ), g_pEventsList );
- //gtk_signal_connect( GTK_OBJECT(g_pEventsList), "select_row", GTK_SIGNAL_FUNC (proplist_select_row), NULL);
gtk_clist_set_selection_mode( GTK_CLIST( g_pEventsList ), GTK_SELECTION_BROWSE );
gtk_clist_column_titles_hide( GTK_CLIST( g_pEventsList ) );
gtk_clist_set_column_auto_resize( GTK_CLIST( g_pEventsList ), 0, TRUE );
FreeCam( cam );
sprintf( error, "Camera file \'%s\' is already loaded", fullpathtofile );
g_FuncTable.m_pfnMessageBox( (GtkWidget *)g_pRadiantWnd, error, "Load error", eMB_OK );
- //g_free( filename );
return;
}
checkCam = checkCam->GetNext();
g_FuncTable.m_pfnMessageBox( (GtkWidget *)g_pRadiantWnd, error, "Load error", eMB_OK );
}
- //g_free( filename );
}
else {
g_FuncTable.m_pfnMessageBox( (GtkWidget *)g_pRadiantWnd, "No free camera slots available", "Load error", eMB_OK );
return true;
- //return false;
}
bool CListener::OnLButtonUp( unsigned int nFlags, double x, double y ){
}
free( TriTable );
// One last time (because we're pessimistic), check border triangles
-// CheckBorders(&NumNodesUsed,NumNodes[0],Node,NumTris,pTri);
-// Tri = *pTri;
// Check that all fixed points are exact. If not, add them to the mix.
// First check to see if we have any fixed points that aren't already used.
#define SIDE_BACK 1
#define SIDE_CROSS -2
-//vec3 vec3_origin = {0,0,0};
void PlaneFromPoints( float *p0, float *p1, float *p2, PLANE *plane ){
vec3 t1, t2;
void FreeWinding( MY_WINDING *w ){
if ( *(unsigned *)w == 0xdeaddead ) {
-// Error ("FreeWinding: freed a freed winding");
return;
}
*(unsigned *)w = 0xdeaddead;
}
// if (f->numpoints > maxpts)
-// Error ("ClipWinding: points exceeded estimate");
// if (f->numpoints > MAX_POINTS_ON_WINDING)
-// Error ("ClipWinding: MAX_POINTS_ON_WINDING");
FreeWinding( in );
*inout = f;
g_GLTable.m_pfn_qglTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT );
g_GLTable.m_pfn_qglTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST );
g_GLTable.m_pfn_qglTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST );
- // g_GLTable.m_pfn_qglPixelStorei (GL_UNPACK_ALIGNMENT, 1);
unsigned char *buf = (unsigned char*)malloc( 128 * 128 );
memset( buf, 255, 128 * 128 );
g_GLTable.m_pfn_qglColor3f( 0, 1, 0 );
g_GLTable.m_pfn_qglBindTexture( GL_TEXTURE_2D, texture );
g_GLTable.m_pfn_qglEnable( GL_TEXTURE_2D );
- // g_GLTable.m_pfn_qglTexEnvi (GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
g_GLTable.m_pfn_qglAlphaFunc( GL_GREATER, 0.0625 );
g_GLTable.m_pfn_qglEnable( GL_ALPHA_TEST );
}
static void ReadDlgValues( int tab ){
- // char Text[256];
- // int i;
switch ( tab )
{
g_pWnd = dlg = gtk_window_new( GTK_WINDOW_TOPLEVEL );
gtk_window_set_title( GTK_WINDOW( dlg ), gszCaption );
g_signal_connect( G_OBJECT( dlg ), "delete_event", G_CALLBACK( main_close ), NULL );
- // g_signal_connect (G_OBJECT (dlg), "destroy", G_CALLBACK (gtk_widget_destroy), NULL);
gtk_window_set_transient_for( GTK_WINDOW( dlg ), GTK_WINDOW( g_pRadiantWnd ) );
hbox = gtk_hbox_new( FALSE, 5 );
v[0].p[2] += HINT_OFFSET;
v[1].p[2] += HINT_OFFSET;
v[2].p[2] += HINT_OFFSET;
-// v[3].p[2] = backface;
-// v[4].p[2] = backface;
-// v[5].p[2] = backface;
break;
case PLANE_XY1:
v[0].p[2] -= HINT_OFFSET;
v[1].p[2] -= HINT_OFFSET;
v[2].p[2] -= HINT_OFFSET;
-// v[3].p[2] = backface;
-// v[4].p[2] = backface;
-// v[5].p[2] = backface;
break;
case PLANE_XZ0:
-// v[0].p[1] = backface;
-// v[1].p[1] = backface;
-// v[2].p[1] = backface;
v[3].p[1] += HINT_OFFSET;
v[4].p[1] += HINT_OFFSET;
v[5].p[1] += HINT_OFFSET;
break;
case PLANE_XZ1:
-// v[0].p[1] = backface;
-// v[1].p[1] = backface;
-// v[2].p[1] = backface;
v[3].p[1] -= HINT_OFFSET;
v[4].p[1] -= HINT_OFFSET;
v[5].p[1] -= HINT_OFFSET;
v[0].p[0] += HINT_OFFSET;
v[1].p[0] += HINT_OFFSET;
v[2].p[0] += HINT_OFFSET;
-// v[3].p[0] = backface;
-// v[4].p[0] = backface;
-// v[5].p[0] = backface;
break;
case PLANE_YZ1:
v[0].p[0] -= HINT_OFFSET;
v[1].p[0] -= HINT_OFFSET;
v[2].p[0] -= HINT_OFFSET;
-// v[3].p[0] = backface;
-// v[4].p[0] = backface;
-// v[5].p[0] = backface;
break;
}
brush.Number = N;
int i0, i1, j0, j1;
int ii, jj;
-// FILE *f;
-// char CSV[64];
if ( !ValidSurface() ) {
return;
{{-16., 16.}, {-16., 16.}, {-24., 32.}}, // KingPin (guess)
{{-30., 30.}, {-30., 30.}, {-10.,160.}}, // Genesis3D (no idea)
{{-16., 16.}, {-16., 16.}, {-24., 32.}}}; // Quake3 (not sure)
-//char gszOutputDir[NUMGAMES][NAME_MAX];
-//char gszTextureDir[NUMGAMES][NAME_MAX];
char Texture[NUMGAMES][3][64];
-//char pakfile[NUMGAMES][NAME_MAX];
-//char lastpakfile[NUMGAMES][NAME_MAX];
-//int UsePak[NUMGAMES];
-//char GameDir[NUMGAMES][NAME_MAX];
char GameName[NUMGAMES][16] = {"Quake2", "Half-Life", "SiN", "Heretic2", "Kingpin", "Genesis3D", "Quake3" };
NV = g_FuncTable.m_pfnProfileLoadInt( file, OPTS_SECTION,"NV",8 );
NV = max( 1,min( NV,MAX_ROWS ) );
-// Decimate = GetPrivateProfileInt(OPTS_SECTION,"Decimate",0,file);
-// Decimate = max(0,min(Decimate,100));
AddHints = g_FuncTable.m_pfnProfileLoadInt( file, OPTS_SECTION,"AddHints",0 );
ArghRad2 = g_FuncTable.m_pfnProfileLoadInt( file, OPTS_SECTION,"ArghRad2",0 );
for ( i = 0; i < NUMGAMES; i++ )
{
- // strcpy (gszOutputDir[i], g_FuncTable.m_pfnProfileLoadString (file, GameName[i],"OutputDir",""));
strcpy( Texture[i][0], g_FuncTable.m_pfnProfileLoadString( file, GameName[i], "Texture", "" ) );
strcpy( Texture[i][1], g_FuncTable.m_pfnProfileLoadString( file, GameName[i], "Texture2", "" ) );
strcpy( Texture[i][2], g_FuncTable.m_pfnProfileLoadString( file, GameName[i], "Texture3", "" ) );
- // strcpy (gszTextureDir[i], g_FuncTable.m_pfnProfileLoadString (file, GameName[i],"TextureDir",""));
- // UsePak[i] = GetPrivateProfileInt(GameName[i],"UsePak",0);
- // strcpy (pakfile[i], g_FuncTable.m_pfnProfileLoadString (file, GameName[i],"PakFile",""));
- // strcpy (lastpakfile[i], g_FuncTable.m_pfnProfileLoadString (file, GameName[i],"LastPakFile",""));
- // strcpy (GameDir[i], g_FuncTable.m_pfnProfileLoadString (file, GameName[i],"GameDir","\0"));
}
/*
if(!strlen(gszTextureDir[QUAKE2]))
g_FuncTable.m_pfnProfileSaveString( file, "Bitmap", "DefaultPath", gbmp.defpath );
g_FuncTable.m_pfnProfileSaveString( file, "Bitmap", "BlackValue", va( "%g",gbmp.black_value ) );
g_FuncTable.m_pfnProfileSaveString( file, "Bitmap", "WhiteValue", va( "%g",gbmp.white_value ) );
-//g_FuncTable.m_pfnProfileSaveString (file, "Formula", "Formula", ExcelFunc );
}
void UpdatePreview( bool DataChange ){
y = Vll + dv / 2;
}
}
-// x = (Hll+Hur)/2.;
-// y = (Vll+Vur)/2.;
v[0].p[0] = x + PlayerBox[Game].x[0];
v[0].p[1] = y + PlayerBox[Game].y[0];
v[0].p[2] = PlayerStartZ( x,y ) + PlayerBox[Game].z[0] + 8; // add 8 cuz I'm a pessimist
y = ct[2] * ya + st[2] * za;
// horizontal and vertical projections:
-// v->pp[0] = D*x/z;
-// v->pp[1] = D*y/z;
v->pp[0] = -y;
v->pp[1] = x;
v->pp[2] = z;
// NOTE: if perspective transformation is desired,
// set "persp" to the range from the surface,
// then:
- // v->projected_h = -v->projected_h * persp/(v->projected_z-persp);
- // v->projected_v = -v->projected_v * persp/(v->projected_z-persp);
}
/*=======================================================================*/
void evaluate(){
return wadlist;
}
ExtractFilePath( shadername,tmpstr );
- // Sys_Printf("checking: %s\n",shadername);
int l = strlen( tmpstr ) - 1;
strcpy( wads,pEpair->value );
ConvertDOSToUnixName( wads,wads );
- // ok, we got the list of ; delimited wads, now split it into a GSList that contains
// just the wad names themselves.
p1 = wads;
g_FuncTable.m_pfnReleaseSelectedBrushHandles();
// Now we have a complete list of wadnames (without paths) so we just have to turn this
- // back to a ; delimited list.
wads[0] = 0;
while ( wadlist )
// store the wad list back in the worldspawn.
if ( wads[0] ) {
- //free(pEpair->value);
- //pEpair->value = strdup(wads);
SetKeyValue( pEntity, "wad", wads );
}
return;
}
-// node = new CBspNode[node_count];
portal = new CBspPortal[portal_count];
portal_sort = new int[portal_count];
// write the values of the Spinner-Boxes to the worldspawn
static void set_coordinates( GtkWidget *widget, gpointer data ){
- //Str str_min, str_max;
char buffer[10], str_min[20], str_max[20];
itoa( gtk_spin_button_get_value_as_int( msp.spinner1 ), str_min, 10 );
int value;
void printValue() const {
- // print this->value here;
}
void setValue(){
{
// ReferenceCaller example
void Int_printValue( const int& value ){
- // print value here;
}
void Int_setValue( int& value ){
void globalQueuedAccelerators_commit(){
for ( AcceleratorSet::const_iterator i = g_queuedAcceleratorsRemove.begin(); i != g_queuedAcceleratorsRemove.end(); ++i )
{
- //globalOutputStream() << "removing: " << (*i).first << "\n";
accel_group_remove_accelerator( global_accel, *i );
}
g_queuedAcceleratorsRemove.clear();
for ( AcceleratorMap::const_iterator i = g_queuedAcceleratorsAdd.begin(); i != g_queuedAcceleratorsAdd.end(); ++i )
{
- //globalOutputStream() << "adding: " << (*i).first << "\n";
accel_group_add_accelerator( global_accel, ( *i ).first, ( *i ).second );
}
g_queuedAcceleratorsAdd.clear();
}
gboolean PressedKeys_key_press( GtkWidget* widget, GdkEventKey* event, PressedKeys* pressedKeys ){
- //globalOutputStream() << "pressed: " << event->keyval << "\n";
return event->state == 0 && Keys_press( pressedKeys->keys, event->keyval );
}
gboolean PressedKeys_key_release( GtkWidget* widget, GdkEventKey* event, PressedKeys* pressedKeys ){
- //globalOutputStream() << "released: " << event->keyval << "\n";
return Keys_release( pressedKeys->keys, event->keyval );
}
void special_accelerators_add( Accelerator accelerator, const Callback& callback ){
- //globalOutputStream() << "special_accelerators_add: " << makeQuoted(accelerator) << "\n";
if ( !accelerator_map_insert( g_special_accelerators, accelerator, callback ) ) {
globalErrorStream() << "special_accelerators_add: already exists: " << makeQuoted( accelerator ) << "\n";
}
}
void special_accelerators_remove( Accelerator accelerator ){
- //globalOutputStream() << "special_accelerators_remove: " << makeQuoted(accelerator) << "\n";
if ( !accelerator_map_erase( g_special_accelerators, accelerator ) ) {
globalErrorStream() << "special_accelerators_remove: not found: " << makeQuoted( accelerator ) << "\n";
}
}
void keydown_accelerators_add( Accelerator accelerator, const Callback& callback ){
- //globalOutputStream() << "keydown_accelerators_add: " << makeQuoted(accelerator) << "\n";
if ( !accelerator_map_insert( g_keydown_accelerators, accelerator, callback ) ) {
globalErrorStream() << "keydown_accelerators_add: already exists: " << makeQuoted( accelerator ) << "\n";
}
}
void keydown_accelerators_remove( Accelerator accelerator ){
- //globalOutputStream() << "keydown_accelerators_remove: " << makeQuoted(accelerator) << "\n";
if ( !accelerator_map_erase( g_keydown_accelerators, accelerator ) ) {
globalErrorStream() << "keydown_accelerators_remove: not found: " << makeQuoted( accelerator ) << "\n";
}
}
void keyup_accelerators_add( Accelerator accelerator, const Callback& callback ){
- //globalOutputStream() << "keyup_accelerators_add: " << makeQuoted(accelerator) << "\n";
if ( !accelerator_map_insert( g_keyup_accelerators, accelerator, callback ) ) {
globalErrorStream() << "keyup_accelerators_add: already exists: " << makeQuoted( accelerator ) << "\n";
}
}
void keyup_accelerators_remove( Accelerator accelerator ){
- //globalOutputStream() << "keyup_accelerators_remove: " << makeQuoted(accelerator) << "\n";
if ( !accelerator_map_erase( g_keyup_accelerators, accelerator ) ) {
globalErrorStream() << "keyup_accelerators_remove: not found: " << makeQuoted( accelerator ) << "\n";
}
GClosure* accel_group_add_accelerator( GtkAccelGroup* group, Accelerator accelerator, const Callback& callback ){
if ( accelerator.key != 0 && gtk_accelerator_valid( accelerator.key, accelerator.modifiers ) ) {
- //globalOutputStream() << "global_accel_connect: " << makeQuoted(accelerator) << "\n";
GClosure* closure = create_cclosure( G_CALLBACK( accel_closure_callback ), callback );
gtk_accel_group_connect( group, accelerator.key, accelerator.modifiers, GTK_ACCEL_VISIBLE, closure );
return closure;
void accel_group_remove_accelerator( GtkAccelGroup* group, Accelerator accelerator ){
if ( accelerator.key != 0 && gtk_accelerator_valid( accelerator.key, accelerator.modifiers ) ) {
- //globalOutputStream() << "global_accel_disconnect: " << makeQuoted(accelerator) << "\n";
gtk_accel_group_disconnect_key( group, accelerator.key, accelerator.modifiers );
}
else
GClosure* global_accel_group_add_accelerator( Accelerator accelerator, const Callback& callback ){
if ( !global_accel_enabled() ) {
// workaround: cannot add to GtkAccelGroup while it is disabled
- //globalOutputStream() << "queued for add: " << accelerator << "\n";
globalQueuedAccelerators_add( accelerator, callback );
return 0;
}
}
void global_accel_group_remove_accelerator( Accelerator accelerator ){
if ( !global_accel_enabled() ) {
- //globalOutputStream() << "queued for remove: " << accelerator << "\n";
globalQueuedAccelerators_remove( accelerator );
return;
}
}
void toggle_button_set_active_no_signal( GtkToggleButton* button, gboolean active ){
- //globalOutputStream() << "set active: " << active << "\n";
guint handler_id = gpointer_to_int( g_object_get_data( G_OBJECT( button ), "handler" ) );
- //guint signal_id = g_signal_lookup("toggled", G_OBJECT_TYPE (button));
- //globalOutputStream() << "signal_id: " << signal_id << "\n";
- //guint found = g_signal_handler_find(G_OBJECT(button), G_SIGNAL_MATCH_ID, signal_id, 0, 0, 0, 0);
- //globalOutputStream() << " handler found: " << found << "\n";
g_signal_handler_block( G_OBJECT( button ), handler_id );
gtk_toggle_button_set_active( button, active );
g_signal_handler_unblock( G_OBJECT( button ), handler_id );
}
void radio_button_set_active( GtkRadioButton* radio, int index ){
- //radio_button_print_state(radio);
gtk_toggle_button_set_active( radio_button_get_nth( radio, index ), TRUE );
- //radio_button_print_state(radio);
}
void radio_button_set_active_no_signal( GtkRadioButton* radio, int index ){
}
int radio_button_get_active( GtkRadioButton* radio ){
- //radio_button_print_state(radio);
GSList *group = gtk_radio_button_group( radio );
int index = g_slist_length( group ) - 1;
for (; group != 0; group = g_slist_next( group ) )
window_remove_minmax( window );
- //gtk_widget_set_size_request(GTK_WIDGET(window), width, height);
- //gtk_window_set_default_size(window, width, height);
- //gtk_window_resize(window, width, height);
- //GdkGeometry geometry = { width, height, -1, -1, width, height, -1, -1, -1, -1, GDK_GRAVITY_STATIC, };
- //gtk_window_set_geometry_hints(window, GTK_WIDGET(window), &geometry, (GdkWindowHints)(GDK_HINT_POS|GDK_HINT_MIN_SIZE|GDK_HINT_BASE_SIZE));
return window;
}
}
// we should add all important paths as shortcut folder...
- // gtk_file_chooser_add_shortcut_folder(GTK_FILE_CHOOSER(dialog), "/tmp/", NULL);
for ( std::size_t i = 0; i < masks.m_filters.size(); ++i )
#endif
font_desc = pango_font_description_from_string( font_string );
- //pango_font_description_set_size(font_desc, 10 * PANGO_SCALE);
pango_context_set_font_description( ft2_context, font_desc );
pango_font_description_free( font_desc );
// TODO fallback to fixed 8, courier new 8
GtkTearoffMenuItem* menu_tearoff( GtkMenu* menu ){
GtkTearoffMenuItem* menu_item = GTK_TEAROFF_MENU_ITEM( gtk_tearoff_menu_item_new() );
container_add_widget( GTK_CONTAINER( menu ), GTK_WIDGET( menu_item ) );
-// gtk_widget_set_sensitive(GTK_WIDGET(menu_item), FALSE); -- controls whether menu is detachable
gtk_widget_show( GTK_WIDGET( menu_item ) );
return menu_item;
}
GtkWindow* window = create_fixedsize_modal_dialog_window( parentWindow, title, dialog, 400, 100 );
if ( parentWindow != 0 ) {
- //g_signal_connect(G_OBJECT(window), "delete_event", G_CALLBACK(floating_window_delete_present), parent);
gtk_window_deiconify( parentWindow );
}
{
NamedAllocator<int> allocator( "test" );
int* p = NamedNew<int>::type( allocator ).scalar();
- //new int();
NamedDelete<int>::type( allocator ).scalar( p );
}
}
void splineTest() {
- //g_splineList->load("p:/doom/base/maps/test_base1.camera");
}
void splineDraw() {
- //g_splineList->addToRenderer();
}
-//extern void D_DebugLine( const idVec3 &color, const idVec3 &start, const idVec3 &end );
void debugLine( idVec3 &color, float x, float y, float z, float x2, float y2, float z2 ) {
idVec3 from( x, y, z );
idVec3 to( x2, y2, z2 );
- //D_DebugLine(color, from, to);
}
void idSplineList::addToRenderer() {
}
void idSplineList::buildSpline() {
- //int start = Sys_Milliseconds();
clearSpline();
for ( int i = 3; i < controlPoints.Num(); i++ ) {
for ( float tension = 0.0f; tension < 1.001f; tension += granularity ) {
}
}
dirty = false;
- //Com_Printf("Spline build took %f seconds\n", (float)(Sys_Milliseconds() - start) / 1000);
}
glEnd();
}
if ( count > 0 ) {
- //assert(activeSegment >=0 && activeSegment < count);
if ( activeSegment >= 0 && activeSegment < count ) {
glBox( activeColor, *splinePoints[activeSegment], 6 );
glBox( yellow, *splinePoints[activeSegment], 8 );
double distSoFar = 0.0;
idVec3 temp;
int count = splinePoints.Num();
- //for(int i = 2; i < count - 1; i++) {
for ( int i = 1; i < count; i++ ) {
temp = *splinePoints[i - 1];
temp -= *splinePoints[i];
return &zero;
}
-// Com_Printf("Time: %d\n", t);
assert( splineTime.Num() == splinePoints.Num() );
while ( activeSegment < count ) {
void idSplineList::parse( const char *( *text ) ) {
const char *token;
- //Com_MatchToken( text, "{" );
do {
token = Com_Parse( text );
addPoint( point.x, point.y, point.z );
} while ( 1 );
- //Com_UngetToken();
- //Com_MatchToken( text, "}" );
dirty = true;
}
void idSplineList::write( fileHandle_t file, const char *p ) {
idStr s = va( "\t\t%s {\n", p );
FS_Write( s.c_str(), s.length(), file );
- //s = va("\t\tname %s\n", name.c_str());
- //FS_Write(s.c_str(), s.length(), file);
s = va( "\t\t\tgranularity %f\n", granularity );
FS_Write( s.c_str(), s.length(), file );
int count = controlPoints.Num();
if ( events[i]->getType() == idCameraEvent::EVENT_TARGET ) {
setActiveTargetByName( events[i]->getParam() );
getActiveTarget()->start( startTime + events[i]->getTime() );
- //Com_Printf("Triggered event switch to target: %s\n",events[i]->getParam());
}
else if ( events[i]->getType() == idCameraEvent::EVENT_TRIGGER ) {
- //idEntity *ent = NULL;
- //ent = level.FindTarget( ent, events[i]->getParam());
//if (ent) {
- // ent->signal( SIG_TRIGGER );
- // ent->ProcessEvent( &EV_Activate, world );
//}
}
else if ( events[i]->getType() == idCameraEvent::EVENT_FOV ) {
float len = ( param2 ) ? atof( param2 ) : 0;
float newfov = ( param1 ) ? atof( param1 ) : 90;
fov.reset( fov.getFOV( time ), newfov, time, len );
- //*fv = fov = atof(events[i]->getParam());
}
else if ( events[i]->getType() == idCameraEvent::EVENT_FADEIN ) {
float time = atof( events[i]->getParam() );
}
bool idCameraDef::waitEvent( int index ) {
- //for (int i = 0; i < events.Num(); i++) {
- // if (events[i]->getSegment() == index && events[i]->getType() == idCameraEvent::EVENT_WAIT) {
- // return true;
- // }
- //}
return false;
}
break;
}
case idCameraEvent::EVENT_TARGETWAIT: {
- //targetWaits.Append(i);
break;
}
case idCameraEvent::EVENT_SPEED: {
cameraPosition->start( t );
buildCamera();
fov.reset( 90, 90, t, 0 );
- //for (int i = 0; i < targetPositions.Num(); i++) {
- // targetPositions[i]->
- //}
startTime = t;
cameraRunning = true;
}
void idCameraDef::addEvent( idCameraEvent *event ) {
events.Append( event );
- //events.Sort(&sortEvents);
}
void idCameraDef::addEvent( idCameraEvent::eventType t, const char *param, long time ) {
percent = 0.0;
}
- // the following line does a straigt calc on percentage of time
- // float percent = (float)(startTime + time - t) / time;
-
idVec3 v1 = startPos;
idVec3 v2 = endPos;
v1 *= ( 1.0 - percent );
delete t; // t == ?
a = c; // a.len == 4, a.data == "test\0"
-// a = "";
a = NULL; // a.len == 0, a.data == "\0" ASSERT!
a = c + d; // a.len == 8, a.data == "testtest\0"
a = c + "wow"; // a.len == 7, a.data == "testwow\0"
TypeCasts(){
m_casts = TargetableInstance::StaticTypeCasts::instance().get();
InstanceContainedCast<LightInstance, Bounded>::install( m_casts );
- //InstanceContainedCast<LightInstance, Cullable>::install(m_casts);
InstanceStaticCast<LightInstance, Renderable>::install( m_casts );
InstanceStaticCast<LightInstance, SelectionTestable>::install( m_casts );
InstanceStaticCast<LightInstance, Transformable>::install( m_casts );
}
else
{
- //globalOutputStream() << getTranslation() << "\n";
m_dragPlanes.m_bounds = m_contained.aabb();
m_contained.setLightRadius( m_dragPlanes.evaluateResize( getTranslation(), rotation() ) );
RGBAImage* image = new RGBAImage( columns, rows );
- //Sys_Printf("lpMip->width = %i, lpMip->height = %i, lpMip->offsets[0] = %i, lpMip->offsets[1] = %i, lpMip->offsets[2] = %i, lpMip->offsets[3] = %i, numPixels = %i\n", lpMip->width, lpMip->height, lpMip->offsets[0], lpMip->offsets[1], lpMip->offsets[2], lpMip->offsets[3], numPixels);
- //for (i = 0; i < sizeof(*lpMip); i++)
- // Sys_Printf("%02x", (int) ((unsigned char *)lpMip)[i]);
pixbuf = image->getRGBAPixels();
globalErrorStream() << "WARNING: IDSP file has multiple frames, only the first frame will be used.\n";
}
- // palette = buffer+mipdatasize+2;
- // buf_p = buffer+lpMip->offsets[0];
numPixels = columns * rows;
}
path[i] = '\0';
}
-// globalErrorStream() << "modified skinname: " << path << " (path) and " << skinnameRelative << " (texture)" << "\n";
snprintf( skinname, MD2_MAX_SKINNAME, "%s%s", path, &skinnameRelative[1] );
-// globalErrorStream() << skinname << "\n";
}
else
{
b = gammatable[pal[2]];
pal += 3;
- //v = (r<<24) + (g<<16) + (b<<8) + 255;
- //v = BigLong (v);
- //mdl_palette[i] = v;
mdl_palette[i * 3 + 0] = r;
mdl_palette[i * 3 + 1] = g;
mdl_palette[i * 3 + 2] = b;
/* each surface on the model will become a new map drawsurface */
int numSurfaces = PicoGetModelNumSurfaces( model );
- //% SYs_FPrintf( SYS_VRB, "Model %s has %d surfaces\n", name, numSurfaces );
for ( int s = 0; s < numSurfaces; ++s )
{
/* get surface */
break;
case PICO_VERBOSE:
- //globalOutputStream() << "PICO_VERBOSE: " << str << "\n";
break;
case PICO_WARNING:
}
}
- //StringPool_analyse(ShaderPool::instance());
}
void Shaders_Free(){
model->Construct( pShader );
interfaces->pRender = (IRender*)model;
interfaces->pRender->IncRef();
- //interfaces->pSelect = (ISelect*)model;
- //interfaces->pSelect->IncRef();
interfaces->pSelect = NULL;
interfaces->pEdit = NULL;
model->DecRef();
CSpriteModel::CSpriteModel(){
refCount = 1;
- //m_nSurfaces = 0;
- //m_children = NULL;
m_pShader = NULL;
}
CSpriteModel::~CSpriteModel(){
- // if(m_children) delete[] m_children;
if ( m_pShader ) {
m_pShader->DecRef();
}
// setup opengl stuff
g_QglTable.m_pfn_qglPushAttrib( GL_ALL_ATTRIB_BITS ); // GL_ENABLE_BIT
- //g_QglTable.m_pfn_qglColor3f (1,1,1); //testing
- //g_QglTable.m_pfn_qglColor4f (1,1,1,1); //testing
g_QglTable.m_pfn_qglBindTexture( GL_TEXTURE_2D, q->texture_number );
- //g_QglTable.m_pfn_qglEnable (GL_TEXTURE_2D); // FIXME: ? this forces textures, even in wireframe mode, bad... ?
g_QglTable.m_pfn_qglAlphaFunc( GL_LESS, 1 );
g_QglTable.m_pfn_qglEnable( GL_ALPHA_TEST );
if ( g_AutoSave_Enabled ) {
const char* strMsg = g_SnapShots_Enabled ? "Autosaving snapshot..." : "Autosaving...";
globalOutputStream() << strMsg << "\n";
- //Sys_Status(strMsg);
// only snapshot if not working on a default map
if ( g_SnapShots_Enabled && !Map_Unnamed( g_map ) ) {
else
{
globalOutputStream() << "Autosave skipped...\n";
- //Sys_Status ("Autosave skipped...");
}
}
}
return true;
}
v = v->m_next;
- //ASSERT_MESSAGE(DEBUG_LOOP < c_brush_maxFaces, "infinite loop");
if ( !( DEBUG_LOOP < c_brush_maxFaces ) ) {
break;
}
texdef.scale[1] = -texdef.scale[1];
}
}
- //globalOutputStream() << "fromTransform: " << texdef.shift[0] << " " << texdef.shift[1] << " " << texdef.scale[0] << " " << texdef.scale[1] << " " << texdef.rotate << "\n";
}
inline void BPTexdef_fromTransform( brushprimit_texdef_t& bp_texdef, const Matrix4& transform ){
// it may be useful to also normalise the rotation here, if this function is used elsewhere.
texdef.shift[0] = float_mod( texdef.shift[0], width );
texdef.shift[1] = float_mod( texdef.shift[1], height );
- //globalOutputStream() << "normalise: " << texdef.shift[0] << " " << texdef.shift[1] << " " << texdef.scale[0] << " " << texdef.scale[1] << " " << texdef.rotate << "\n";
}
inline void BPTexdef_normalise( brushprimit_texdef_t& bp_texdef, float width, float height ){
ComputeAxisBase( normal, vector4_to_vector3( basis.x() ), vector4_to_vector3( basis.y() ) );
vector4_to_vector3( basis.z() ) = normal;
matrix4_transpose( basis );
- //DebugAxisBase(normal);
}
else if ( g_bp_globals.m_texdefTypeId == TEXDEFTYPEID_HALFLIFE ) {
basis = g_matrix4_identity;
vector4_to_vector3( basis.y() ) = vector3_negated( projection.m_basis_t );
vector4_to_vector3( basis.z() ) = vector3_normalised( vector3_cross( vector4_to_vector3( basis.x() ), vector4_to_vector3( basis.y() ) ) );
matrix4_multiply_by_matrix4( basis, matrix4_rotation_for_z_degrees( -projection.m_texdef.rotate ) );
- //globalOutputStream() << "debug: " << projection.m_basis_s << projection.m_basis_t << normal << "\n";
matrix4_transpose( basis );
}
else
}
void Texdef_transformLocked( TextureProjection& projection, std::size_t width, std::size_t height, const Plane3& plane, const Matrix4& identity2transformed ){
- //globalOutputStream() << "identity2transformed: " << identity2transformed << "\n";
- //globalOutputStream() << "plane.normal(): " << plane.normal() << "\n";
Vector3 normalTransformed( matrix4_transformed_direction( identity2transformed, plane.normal() ) );
- //globalOutputStream() << "normalTransformed: " << normalTransformed << "\n";
// identity: identity space
// transformed: transformation
Matrix4 identity2stIdentity;
Texdef_basisForNormal( projection, plane.normal(), identity2stIdentity );
- //globalOutputStream() << "identity2stIdentity: " << identity2stIdentity << "\n";
if ( g_bp_globals.m_texdefTypeId == TEXDEFTYPEID_HALFLIFE ) {
matrix4_transform_direction( identity2transformed, projection.m_basis_s );
Texdef_toTransform( projection, (float)width, (float)height, stIdentity2stOriginal );
Matrix4 identity2stOriginal( matrix4_multiplied_by_matrix4( stIdentity2stOriginal, identity2stIdentity ) );
- //globalOutputStream() << "originalProj: " << originalProjectionAxis << "\n";
- //globalOutputStream() << "transformedProj: " << transformedProjectionAxis << "\n";
double dot = vector3_dot( originalProjectionAxis, transformedProjectionAxis );
- //globalOutputStream() << "dot: " << dot << "\n";
if ( dot == 0 ) {
// The projection axis chosen for the transformed normal is at 90 degrees
// to the transformed projection axis chosen for the original normal.
}
else
{
- //ERROR_MESSAGE("parse error: invalid element \"" << element.name() << "\"");
return *this;
}
}
}
void Camera_mouseMove( camera_t& camera, int x, int y ){
- //globalOutputStream() << "mousemove... ";
Camera_FreeMove( camera, -x, -y );
camera.m_update();
CameraMovedNotify();
void Camera_keyMove( camera_t& camera ){
camera.m_mouseMove.flush();
- //globalOutputStream() << "keymove... ";
float time_seconds = camera.m_keycontrol_timer.elapsed_msec() / static_cast<float>( msec_per_sec );
camera.m_keycontrol_timer.start();
if ( time_seconds > 0.05f ) {
}
void selection_motion( gdouble x, gdouble y, guint state, void* data ){
- //globalOutputStream() << "motion... ";
reinterpret_cast<WindowObserver*>( data )->onMouseMotion( WindowVector_forDouble( x, y ), modifiers_for_state( state ) );
}
}
void CamWnd::EnableFreeMove(){
- //globalOutputStream() << "EnableFreeMove\n";
ASSERT_MESSAGE( !m_bFreeMove, "EnableFreeMove: free-move was already enabled" );
m_bFreeMove = true;
}
void CamWnd::DisableFreeMove(){
- //globalOutputStream() << "DisableFreeMove\n";
ASSERT_MESSAGE( m_bFreeMove, "DisableFreeMove: free-move was not enabled" );
m_bFreeMove = false;
ambient[3] = 1.0f;
diffuse[0] = diffuse[1] = diffuse[2] = 0.4f;
diffuse[3] = 1.0f;
- //material[0] = material[1] = material[2] = 0.8f;
- //material[3] = 1.0f;
inverse_cam_dir[0] = m_Camera.vpn[0];
inverse_cam_dir[1] = m_Camera.vpn[1];
void CamWnd::draw(){
m_drawing = true;
- //globalOutputStream() << "draw...\n";
if ( glwidget_make_current( m_gl_widget ) != FALSE ) {
if ( Map_Valid( g_map ) && ScreenUpdates_Enabled() ) {
GlobalOpenGL_debugAssertNoErrors();
Cam_Draw();
GlobalOpenGL_debugAssertNoErrors();
- //qglFinish();
m_XORRectangle.set( rectangle_t() );
}
dialog.m_model = model;
// 2. disallow changing the row
- //gtk_widget_set_sensitive(GTK_WIDGET(dialog.m_list), false);
// 3. highlight the row
gtk_list_store_set( GTK_LIST_STORE( model ), &iter, 2, true, -1 );
gtk_widget_show( text );
g_console = text;
- //globalExtendedASCIICharacterSet().print();
widget_connect_escape_clear_focus_widget( g_console );
- //g_consoleWidgetFocusPrinter.connect(g_console);
g_signal_connect( G_OBJECT( g_console ), "populate-popup", G_CALLBACK( console_populate_popup ), 0 );
g_signal_connect( G_OBJECT( g_console ), "destroy", G_CALLBACK( destroy_set_null ), &g_console );
}
void realise(){
if ( --m_unrealised == 0 ) {
- //globalOutputStream() << "Entity Classes: realise\n";
EntityClassQuake3_Construct();
m_observers.realise();
}
void unrealise(){
if ( ++m_unrealised == 1 ) {
m_observers.unrealise();
- //globalOutputStream() << "Entity Classes: unrealise\n";
Eclass_Clear();
}
}
//const char* name =
PARSE_RETURN_FALSE_IF_FAIL( EntityClassDoom3_parseToken( tokeniser ) );
- //globalOutputStream() << "parsing unknown block " << makeQuoted(name) << "\n";
PARSE_RETURN_FALSE_IF_FAIL( EntityClassDoom3_parseToken( tokeniser, "{" ) );
tokeniser.nextLine();
}
}
else if ( string_equal( key, "editor_ragdoll" ) ) {
- //bool ragdoll = atoi(tokeniser.getToken()) != 0;
PARSE_RETURN_FALSE_IF_FAIL( EntityClassDoom3_parseToken( tokeniser ) );
}
else if ( string_equal( key, "editor_mins" ) ) {
std::pair<BaseClasses::iterator, bool> result = g_EntityClassFGD_bases.insert( BaseClasses::value_type( entityClass->name(), entityClass ) );
if ( !result.second ) {
globalErrorStream() << "duplicate base class: " << makeQuoted( entityClass->name() ) << "\n";
- //eclass_capture_state(entityClass);
- //entityClass->free(entityClass);
}
return ( *result.first ).second;
}
class EntityGroupSelected : public scene::Graph::Walker
{
NodeSmartReference group, worldspawn;
-//typedef std::pair<NodeSmartReference, NodeSmartReference> DeletionPair;
-//Stack<DeletionPair> deleteme;
public:
EntityGroupSelected( const scene::Path &p ) : group( p.top().get() ), worldspawn( Map_FindOrInsertWorldspawn( g_map ) ){
}
Node_getTraversable( group )->insert( child );
if ( Node_getTraversable( parent )->empty() ) {
- //deleteme.push(DeletionPair(parentparent, parent));
Node_getTraversable( parentparent )->erase( parent );
}
}
void realise(){
if ( --m_unrealised == 0 ) {
if ( g_entityInspector_windowConstructed ) {
- //globalOutputStream() << "Entity Inspector: realise\n";
EntityClassList_fill();
}
}
void unrealise(){
if ( ++m_unrealised == 1 ) {
if ( g_entityInspector_windowConstructed ) {
- //globalOutputStream() << "Entity Inspector: unrealise\n";
EntityClassList_clear();
}
}
char* name = const_cast<char*>( node_get_name( *node ) );
g_object_set( G_OBJECT( renderer ), "text", name, "visible", TRUE, 0 );
- //globalOutputStream() << "rendering cell " << makeQuoted(name) << "\n";
GtkStyle* style = gtk_widget_get_style( GTK_WIDGET( getEntityList().m_tree_view ) );
if ( instance->childSelected() ) {
g_object_set( G_OBJECT( renderer ), "cell-background-gdk", &style->base[GTK_STATE_ACTIVE], 0 );
GtkVBox* vbox = create_dialog_vbox( 4 );
gtk_box_pack_start( GTK_BOX( hbox ), GTK_WIDGET( vbox ), TRUE, TRUE, 0 );
{
- //GtkLabel* label = GTK_LABEL(gtk_label_new("Enter one ore more tags separated by spaces"));
GtkLabel* label = GTK_LABEL( gtk_label_new( "ESC to cancel, ENTER to validate" ) );
gtk_widget_show( GTK_WIDGET( label ) );
gtk_box_pack_start( GTK_BOX( vbox ), GTK_WIDGET( label ), FALSE, FALSE, 0 );
Scene_Clone_Selected( GlobalSceneGraph(), false );
- //NudgeSelection(eNudgeRight, GetGridSize(), GlobalXYWnd_getCurrentViewType());
- //NudgeSelection(eNudgeDown, GetGridSize(), GlobalXYWnd_getCurrentViewType());
}
}
Scene_Clone_Selected( GlobalSceneGraph(), true );
- //NudgeSelection(eNudgeRight, GetGridSize(), GlobalXYWnd_getCurrentViewType());
- //NudgeSelection(eNudgeDown, GetGridSize(), GlobalXYWnd_getCurrentViewType());
}
}
}
bool MainFrame_isActiveApp(){
- //globalOutputStream() << "listing\n";
GList* list = gtk_window_list_toplevels();
for ( GList* i = list; i != 0; i = g_list_next( i ) )
{
- //globalOutputStream() << "toplevel.. ";
if ( gtk_window_is_active( GTK_WINDOW( i->data ) ) ) {
- //globalOutputStream() << "is active\n";
return true;
}
- //globalOutputStream() << "not active\n";
}
return false;
}
g_wait_stack.pop_back();
if ( g_wait_stack.empty() ) {
EverySecondTimer_enable();
- //gtk_widget_set_sensitive(GTK_WIDGET(MainFrame_getWindow()), TRUE);
gtk_grab_remove( GTK_WIDGET( g_wait.m_window ) );
destroy_floating_window( g_wait.m_window );
g_wait.m_window = 0;
- //gtk_window_present(MainFrame_getWindow());
}
else if ( GTK_WIDGET_VISIBLE( g_wait.m_window ) ) {
gtk_label_set_text( g_wait.m_label, g_wait_stack.back().c_str() );
command_connect_accelerator( "PatchDeleteLastColumn" );
command_connect_accelerator( "PatchDeleteLastRow" );
command_connect_accelerator( "NaturalizePatch" );
- //command_connect_accelerator("CapCurrentCurve");
}
void Manipulators_registerShortcuts(){
void SelectNudge_registerShortcuts(){
command_connect_accelerator( "MoveSelectionDOWN" );
command_connect_accelerator( "MoveSelectionUP" );
- //command_connect_accelerator("SelectNudgeLeft");
- //command_connect_accelerator("SelectNudgeRight");
- //command_connect_accelerator("SelectNudgeUp");
- //command_connect_accelerator("SelectNudgeDown");
}
void SnapToGrid_registerShortcuts(){
GtkButton* g_view_console_button = toolbar_append_button( toolbar, "Console (O)", "console.png", "ToggleConsole" );
GtkButton* g_view_textures_button = toolbar_append_button( toolbar, "Texture Browser (T)", "texture_browser.png", "ToggleTextures" );
// TODO: call light inspector
- //GtkButton* g_view_lightinspector_button = toolbar_append_button(toolbar, "Light Inspector", "lightinspector.png", "ToggleLightInspector");
gtk_toolbar_append_space( GTK_TOOLBAR( toolbar ) );
GtkButton* g_refresh_models_button = toolbar_append_button( toolbar, "Refresh Models", "refresh_models.png", "RefreshReferences" );
EverySecondTimer_enable();
- //GlobalShortcuts_reportUnregistered();
}
void MainFrame::SaveWindowInfo(){
void construct(){
if ( !empty() ) {
- //globalOutputStream() << "construct " << makeQuoted(c_str()) << "\n";
m_names.insert( name_read( c_str() ) );
}
}
void destroy(){
if ( !empty() ) {
- //globalOutputStream() << "destroy " << makeQuoted(c_str()) << "\n";
m_names.erase( name_read( c_str() ) );
}
}
std::pair<Names::iterator, bool> result = m_names.insert( Names::value_type( setName, m_uniqueNames ) );
ASSERT_MESSAGE( result.second, "cannot attach name" );
attachObserver( NameObserver::NameChangedCaller( ( *result.first ).second ) );
- //globalOutputStream() << "attach: " << reinterpret_cast<const unsigned int&>(setName) << "\n";
}
void detach( const NameCallback& setName, const NameCallbackCallback& detachObserver ){
Names::iterator i = m_names.find( setName );
ASSERT_MESSAGE( i != m_names.end(), "cannot detach name" );
- //globalOutputStream() << "detach: " << reinterpret_cast<const unsigned int&>(setName) << "\n";
detachObserver( NameObserver::NameChangedCaller( ( *i ).second ) );
m_names.erase( i );
}
char buffer[1024];
name_write( buffer, uniqueName );
- //globalOutputStream() << "renaming " << makeQuoted((*i).first.c_str()) << " to " << makeQuoted(buffer) << "\n";
SetNameCallbacks& setNameCallbacks = ( *i ).second;
globalOutputStream() << Unsigned( g_brushCount.get() ) << " primitive\n";
globalOutputStream() << Unsigned( g_entityCount.get() ) << " entities\n";
- //GlobalEntityCreator().printStatistics();
//
// move the view to a start position
===========
*/
void Map_New(){
- //globalOutputStream() << "Map_New\n";
g_map.m_name = "unnamed.map";
Map_UpdateTitle( g_map );
{
g_map.m_resource = GlobalReferenceCache().capture( g_map.m_name.c_str() );
-// ASSERT_MESSAGE(g_map.m_resource->getNode() == 0, "bleh");
g_map.m_resource->attach( g_map );
SceneChangeNotify();
{
p1 = m_ctrl.data() + ( h * row_stride );
p2 = p1 + ( 2 * width ) * col_stride;
- //globalErrorStream() << "compare " << p1->m_vertex << " and " << p2->m_vertex << "\n";
if ( vector3_length_squared( vector3_subtracted( p1->m_vertex, p2->m_vertex ) ) > 1.0 ) {
- //globalErrorStream() << "too far\n";
wrap = false;
break;
}
int n = ( width - 1 ) / 2; // n = number of segments
setDims( width, height );
- // vPos[0] = vector3_subtracted(aabb.origin, aabb.extents);
- // vPos[1] = aabb.origin;
- // vPos[2] = vector3_added(aabb.origin, aabb.extents);
int i, j;
float f = 1 / cos( M_PI / n );
int n = ( width - 1 ) / 2; // n = number of segments
setDims( width, height );
- // vPos[0] = vector3_subtracted(aabb.origin, aabb.extents);
- // vPos[1] = aabb.origin;
- // vPos[2] = vector3_added(aabb.origin, aabb.extents);
int i, j;
float f = 1 / cos( M_PI / n );
int m = ( height - 1 ) / 2; // m = number of segments (pitch)
setDims( width, height );
- // vPos[0] = vector3_subtracted(aabb.origin, aabb.extents);
- // vPos[1] = aabb.origin;
- // vPos[2] = vector3_added(aabb.origin, aabb.extents);
int i, j;
float f = 1 / cos( M_PI / n );
}
- //if((nFlagsX & DEGEN_0a) && (nFlagsX & DEGEN_1a) && (nFlagsX & DEGEN_2a)) { newFlagsX |= DEGEN_0a; newFlagsX |= DEGEN_1a; newFlagsX |= DEGEN_2a; }
- //if((nFlagsX & DEGEN_0b) && (nFlagsX & DEGEN_1b) && (nFlagsX & DEGEN_2b)) { newFlagsX |= DEGEN_0b; newFlagsX |= DEGEN_1b; newFlagsX |= DEGEN_2b; }
newFlagsX |= ( nFlagsX & SPLIT );
newFlagsX |= ( nFlagsX & AVERAGE );
m_tess.m_indices[( j * m_tess.m_lenStrips ) + i * 2] = RenderIndex( j * m_tess.m_nArrayWidth + i );
m_tess.m_indices[( j * m_tess.m_lenStrips ) + i * 2 + 1] = RenderIndex( ( j + 1 ) * m_tess.m_nArrayWidth + i );
// reverse because radiant uses CULL_FRONT
- //m_tess.m_indices[(j*m_tess.m_lenStrips)+i*2+1] = RenderIndex(j*m_tess.m_nArrayWidth+i);
- //m_tess.m_indices[(j*m_tess.m_lenStrips)+i*2] = RenderIndex((j+1)*m_tess.m_nArrayWidth+i);
}
}
}
m_tess.m_indices[( j * m_tess.m_lenStrips ) + i * 2] = RenderIndex( ( ( m_tess.m_nArrayHeight - 1 ) - i ) * m_tess.m_nArrayWidth + j );
m_tess.m_indices[( j * m_tess.m_lenStrips ) + i * 2 + 1] = RenderIndex( ( ( m_tess.m_nArrayHeight - 1 ) - i ) * m_tess.m_nArrayWidth + j + 1 );
// reverse because radiant uses CULL_FRONT
- //m_tess.m_indices[(j*m_tess.m_lenStrips)+i*2+1] = RenderIndex(((m_tess.m_nArrayHeight-1)-i)*m_tess.m_nArrayWidth+j);
- //m_tess.m_indices[(j*m_tess.m_lenStrips)+i*2] = RenderIndex(((m_tess.m_nArrayHeight-1)-i)*m_tess.m_nArrayWidth+j+1);
}
}
return GTK_WIDGET_VISIBLE( GetWidget() );
}
-// void UpdateInfo();
-// void SetPatchInfo();
void GetPatchInfo();
void UpdateSpinners( bool bUp, int nID );
// read the current patch on map and initialize m_fX m_fY accordingly
}
{
GtkEntry* entry = GTK_ENTRY( gtk_entry_new() );
- // gtk_entry_set_editable (GTK_ENTRY (entry), false);
gtk_widget_show( GTK_WIDGET( entry ) );
gtk_box_pack_start( GTK_BOX( vbox2 ), GTK_WIDGET( entry ), TRUE, TRUE, 0 );
AddDialogData( *entry, m_strName );
}
else
{
- //globalOutputStream() << "WARNING: no patch\n";
}
// fill in our internal structs
m_nRow = 0; m_nCol = 0;
void Patch_Cap(){
// FIXME: add support for patch cap creation
- // Patch_CapCurrent();
UndoableCommand undo( "patchCreateCaps" );
Scene_PatchDoCap_Selected( GlobalSceneGraph(), TextureBrowser_GetSelectedShader( GlobalTextureBrowser() ) );
QGLFunctionPointer QGL_getExtensionFunc( const char* symbol ){
#if defined( XWINDOWS )
- //ASSERT_NOTNULL(qglXGetProcAddressARB);
if ( qglXGetProcAddressARB == 0 ) {
return reinterpret_cast<QGLFunctionPointer>( glInvalidFunction );
}
}
bool MapResource_saveFile( const MapFormat& format, scene::Node& root, GraphTraversalFunc traverse, const char* filename ){
- //ASSERT_MESSAGE(path_is_absolute(filename), "MapResource_saveFile: path is not absolute: " << makeQuoted(filename));
globalOutputStream() << "Open file " << filename << " for write...";
TextFileOutputStream file( filename );
if ( !file.failed() ) {
void ModelCache_flush( const char* path, const char* name ){
ModelCache::iterator i = g_modelCache.find( ModelKey( path, name ) );
if ( i != g_modelCache.end() ) {
- //ASSERT_MESSAGE((*i).value.getCount() == 0, "resource flushed while still in use: " << (*i).key.first.c_str() << (*i).key.second.c_str());
g_modelCache.erase( i );
}
}
{
return m_model.get_pointer();
}
- //return 0;
}
void setNode( scene::Node* node ){
ModelCache::iterator i = ModelCache_find( m_path.c_str(), m_name.c_str() );
m_path = rootPath( m_originalName.c_str() );
m_name = path_make_relative( m_originalName.c_str(), m_path.c_str() );
- //globalOutputStream() << "ModelResource::realise: " << m_path.c_str() << m_name.c_str() << "\n";
m_observers.realise();
}
if ( ++m_unrealised == 1 ) {
m_observers.unrealise();
- //globalOutputStream() << "ModelResource::unrealise: " << m_path.c_str() << m_name.c_str() << "\n";
clearModel();
}
}
}
Resource* capture( const char* path ){
- //globalOutputStream() << "capture: \"" << path << "\"\n";
return m_references.capture( CopiedString( path ) ).get();
}
void release( const char* path ){
m_references.release( CopiedString( path ) );
- //globalOutputStream() << "release: \"" << path << "\"\n";
}
void setEntityCreator( EntityCreator& entityCreator ){
}
if ( delta & state & RENDER_FILL ) {
- //qglPolygonMode (GL_BACK, GL_LINE);
- //qglPolygonMode (GL_FRONT, GL_FILL);
glPolygonMode( GL_FRONT_AND_BACK, GL_FILL );
GlobalOpenGL_debugAssertNoErrors();
}
glPushMatrix();
for ( OpenGLStateBucket::Renderables::const_iterator i = renderables.begin(); i != renderables.end(); ++i )
{
- //qglLoadMatrixf(i->m_transform);
if ( !transform || ( transform != ( *i ).m_transform && !matrix4_affine_equal( *transform, *( *i ).m_transform ) ) ) {
count_transform();
transform = ( *i ).m_transform;
return m_rootpath.top();
}
void insert_root( scene::Node& root ){
- //globalOutputStream() << "insert_root\n";
ASSERT_MESSAGE( m_rootpath.empty(), "scenegraph root already exists" );
m_rootpath.push( makeReference( root ) );
}
void erase_root(){
- //globalOutputStream() << "erase_root\n";
ASSERT_MESSAGE( !m_rootpath.empty(), "scenegraph root does not exist" );
Scene_BrushShiftTexdef_Selected( GlobalSceneGraph(), x, y );
Scene_PatchTranslateTexture_Selected( GlobalSceneGraph(), x, y );
}
- //globalOutputStream() << "shift selected face textures: s=" << x << " t=" << y << '\n';
Scene_BrushShiftTexdef_Component_Selected( GlobalSceneGraph(), x, y );
}
void ray_intersect_ray( const Ray& ray, const Ray& other, Vector3& intersection ){
intersection = vector3_subtracted( ray.origin, other.origin );
- //float a = 1;//vector3_dot(ray.direction, ray.direction); // always >= 0
double dot = vector3_dot( ray.direction, other.direction );
- //float c = 1;//vector3_dot(other.direction, other.direction); // always >= 0
double d = vector3_dot( ray.direction, intersection );
double e = vector3_dot( other.direction, intersection );
double D = 1 - dot * dot; //a*c - dot*dot; // always >= 0
void translate( const Vector3& translation ){
if ( !nothingSelected() ) {
- //ASSERT_MESSAGE(!m_pivotChanged, "pivot is invalid");
m_translation = translation;
}
void rotate( const Quaternion& rotation ){
if ( !nothingSelected() ) {
- //ASSERT_MESSAGE(!m_pivotChanged, "pivot is invalid");
m_rotation = rotation;
#if TEXTOOL_ENABLED
if ( g_bp_globals.m_texdefTypeId == TEXDEFTYPEID_BRUSHPRIMITIVES ) {
TexTool::queueDraw();
- //globalOutputStream() << "textool texture changed..\n";
}
#endif
}
// DoSurface will always try to show the surface inspector
// or update it because something new has been selected
-// Shamus: It does get called when the SI is hidden, but not when you select something new. ;-)
void DoSurface( void ){
if ( getSurfaceInspector().GetWidget() == 0 ) {
getSurfaceInspector().Create();
}
static void OnBtnAxial( GtkWidget *widget, gpointer data ){
-//globalOutputStream() << "--> [OnBtnAxial]...\n";
UndoableCommand undo( "textureDefault" );
TextureProjection projection;
-//globalOutputStream() << " TexDef_Construct_Default()...\n";
TexDef_Construct_Default( projection );
-//globalOutputStream() << " Select_SetTexdef()...\n";
#if TEXTOOL_ENABLED
gtk_box_pack_start( GTK_BOX( vbox ), GTK_WIDGET( frame ), TRUE, TRUE, 0 );
{
GtkVBox* vbox3 = GTK_VBOX( gtk_vbox_new( FALSE, 4 ) );
- //gtk_container_set_border_width(GTK_CONTAINER(vbox3), 4);
gtk_widget_show( GTK_WIDGET( vbox3 ) );
gtk_container_add( GTK_CONTAINER( frame ), GTK_WIDGET( vbox3 ) );
{
gtk_box_pack_start( GTK_BOX( vbox ), GTK_WIDGET( frame ), TRUE, TRUE, 0 );
{
GtkVBox* vbox3 = GTK_VBOX( gtk_vbox_new( FALSE, 4 ) );
- //gtk_container_set_border_width(GTK_CONTAINER(vbox3), 4);
gtk_widget_show( GTK_WIDGET( vbox3 ) );
gtk_container_add( GTK_CONTAINER( frame ), GTK_WIDGET( vbox3 ) );
{
//Instead of this, we probably need to create a vbox to put into the frame, then the
//window, then the hbox. !!! FIX !!!
-// gtk_container_add(GTK_CONTAINER(frame), hbox);
//Hmm. Do we really need g_object_set_data? Mebbe not... And we don't! :-)
-// g_object_set_data(G_OBJECT(flipX), "handler", gint_to_pointer(g_signal_connect(G_OBJECT(flipX), "toggled", G_CALLBACK(TexTool::flipX), 0)));
-// g_object_set_data(G_OBJECT(flipY), "handler", gint_to_pointer(g_signal_connect(G_OBJECT(flipY), "toggled", G_CALLBACK(TexTool::flipY), 0)));
//Instead, just do:
g_signal_connect( G_OBJECT( flipX ), "toggled", G_CALLBACK( TexTool::flipX ), NULL );
g_signal_connect( G_OBJECT( flipY ), "toggled", G_CALLBACK( TexTool::flipY ), NULL );
float height( void ) { return fabs( maxY - minY ); }
};
-//This seems to control the texture scale... (Yep! ;-)
Extent extents = { -2.0f, -2.0f, +2.0f, +2.0f };
brushprimit_texdef_t tm; // Texture transform matrix
Vector2 pts[c_brush_maxFaces];
#define PI 3.14159265358979
bool lButtonDown = false;
bool rButtonDown = false;
-//int dragPoint;
-//int anchorPoint;
bool haveAnchor = false;
brushprimit_texdef_t currentBP;
brushprimit_texdef_t origBP; // Original brush primitive (before we muck it up)
textureNum = face.getShader().m_state->getTexture().texture_number;
textureSize.x() = face.getShader().m_state->getTexture().width;
textureSize.y() = face.getShader().m_state->getTexture().height;
-//globalOutputStream() << "--> Texture #" << textureNum << ": " << textureSize.x() << " x " << textureSize.y() << "...\n";
currentBP = SurfaceInspector_GetSelectedTexdef().m_brushprimit_texdef;
for ( Winding::const_iterator i = w.begin(); i != w.end(); i++ )
{
- //globalOutputStream() << (*i).texcoord.x() << " " << (*i).texcoord.y() << ", ";
pts[count].x() = ( *i ).texcoord.x();
pts[count].y() = ( *i ).texcoord.y();
count++;
numPts = count;
- //globalOutputStream() << " ..copied points\n";
}
brushprimit_texdef_t bp;
bp.coords[0][1] = tm.coords[0][0] * origBP.coords[0][1] + tm.coords[0][1] * origBP.coords[1][1];
bp.coords[0][2] = tm.coords[0][0] * origBP.coords[0][2] + tm.coords[0][1] * origBP.coords[1][2] + tm.coords[0][2];
//Ok, this works for translation...
-// bp.coords[0][2] = tm.coords[0][0] * origBP.coords[0][2] + tm.coords[0][1] * origBP.coords[1][2] + tm.coords[0][2] * textureSize.x();
bp.coords[1][0] = tm.coords[1][0] * origBP.coords[0][0] + tm.coords[1][1] * origBP.coords[1][0];
bp.coords[1][1] = tm.coords[1][0] * origBP.coords[0][1] + tm.coords[1][1] * origBP.coords[1][1];
bp.coords[1][2] = tm.coords[1][0] * origBP.coords[0][2] + tm.coords[1][1] * origBP.coords[1][2] + tm.coords[1][2];
-// bp.coords[1][2] = tm.coords[1][0] * origBP.coords[0][2] + tm.coords[1][1] * origBP.coords[1][2] + tm.coords[1][2] * textureSize.y();
-//This doesn't work: g_brush_texture_changed();
+//This doesn't work: g_brush_texture_changed();
// Let's try this:
//Note: We should only set an undo *after* the button has been released... !!! FIX !!!
//Definitely *should* have an undo, though!
// Do some viewport fitting stuff...
-//globalOutputStream() << "--> Center: " << center.x() << ", " << center.y() << "\n";
-//globalOutputStream() << "--> Extents (stage 1): " << extents.minX << ", "
-// << extents.maxX << ", " << extents.minY << ", " << extents.maxY << "\n";
// TTimo: Apply a ratio to get the area we'll draw.
center.x() = 0.5f * ( extents.minX + extents.maxX ),
center.y() = 0.5f * ( extents.minY + extents.maxY );
extents.minY = center.y() + VP_PADDING * ( extents.minY - center.y() ),
extents.maxX = center.x() + VP_PADDING * ( extents.maxX - center.x() ),
extents.maxY = center.y() + VP_PADDING * ( extents.maxY - center.y() );
-//globalOutputStream() << "--> Extents (stage 2): " << extents.minX << ", "
-// << extents.maxX << ", " << extents.minY << ", " << extents.maxY << "\n";
// TTimo: We want a texture with the same X / Y ratio.
// TTimo: Compute XY space / window size ratio.
float SSize = extents.width(), TSize = extents.height();
float ratioX = textureSize.x() * extents.width() / windowSize.x(),
ratioY = textureSize.y() * extents.height() / windowSize.y();
-//globalOutputStream() << "--> Texture size: " << textureSize.x() << ", " << textureSize.y() << "\n";
-//globalOutputStream() << "--> Window size: " << windowSize.x() << ", " << windowSize.y() << "\n";
if ( ratioX > ratioY ) {
TSize = ( windowSize.y() * ratioX ) / textureSize.y();
-// TSize = extents.width() * (windowSize.y() / windowSize.x()) * (textureSize.x() / textureSize.y());
}
else
{
SSize = ( windowSize.x() * ratioY ) / textureSize.x();
-// SSize = extents.height() * (windowSize.x() / windowSize.y()) * (textureSize.y() / textureSize.x());
}
extents.minX = center.x() - 0.5f * SSize, extents.maxX = center.x() + 0.5f * SSize,
extents.minY = center.y() - 0.5f * TSize, extents.maxY = center.y() + 0.5f * TSize;
-//globalOutputStream() << "--> Extents (stage 3): " << extents.minX << ", "
-// << extents.maxX << ", " << extents.minY << ", " << extents.maxY << "\n";
}
gboolean size_allocate( GtkWidget * win, GtkAllocation * a, gpointer ){
}
gboolean expose( GtkWidget * win, GdkEventExpose * e, gpointer ){
-// globalOutputStream() << "--> Textool Window was exposed!\n";
-// globalOutputStream() << " (window width/height: " << cc << "/" << e->area.height << ")\n";
-// windowSize.x() = e->area.width, windowSize.y() = e->area.height;
//This needs to go elsewhere...
-// InitTextool();
if ( glwidget_make_current( win ) == FALSE ) {
globalOutputStream() << " FAILED to make current! Oh, the agony! :-(\n";
}
// Probably should init button/anchor states here as well...
-// rotationAngle = 0.0f;
glClearColor( 0, 0, 0, 0 );
glViewport( 0, 0, e->area.width, e->area.height );
glMatrixMode( GL_PROJECTION );
DrawControlWidgets();
//???
// reset the current texture
-// glBindTexture(GL_TEXTURE_2D, 0);
-// glFinish();
glwidget_swap_buffers( win );
return false;
Vector2 dragPoint; // Defined in terms of window space (+x/-y)
Vector2 oldTrans;
gboolean button_press( GtkWidget * win, GdkEventButton * e, gpointer ){
-// globalOutputStream() << "--> Textool button press...\n";
if ( e->button == 1 ) {
lButtonDown = true;
origBP = currentBP;
- //globalOutputStream() << "--> Original BP: [" << origBP.coords[0][0] << "][" << origBP.coords[0][1] << "][" << origBP.coords[0][2] << "]\n";
- //globalOutputStream() << " [" << origBP.coords[1][0] << "][" << origBP.coords[1][1] << "][" << origBP.coords[1][2] << "]\n";
- //float angle = atan2(origBP.coords[0][1], origBP.coords[0][0]) * 180.0f / 3.141592653589f;
origAngle = ( origBP.coords[0][1] > 0 ? PI : -PI ); // Could also be -PI... !!! FIX !!! [DONE]
if ( origBP.coords[0][0] != 0.0f ) {
rotationAngle = origAngle;
oldCenter[0] = oldCenter[1] = 0;
- //globalOutputStream() << "--> BP stats: ang=" << origAngle * RAD_TO_DEG << ", scale=" << origScaleX << "/" << origScaleY << "\n";
//Should also set the Flip X/Y checkboxes here as well... !!! FIX !!!
//Also: should reverse texture left/right up/down instead of flipping the points...
//disnowok
-//float nx = windowSize.x() * (e->x - extents.minX) / (extents.maxX - extents.minX);
-//float ny = windowSize.y() * (e->y - extents.minY) / (extents.maxY - extents.minY);
//disdoes...
//But I want it to scroll the texture window, not the points... !!! FIX !!!
//Actually, should scroll the texture window only when mouse is down on no widgets...
dragPoint.x() = e->x, dragPoint.y() = e->y;
trans2.x() = nx, trans2.y() = ny;
oldRotationAngle = rotationAngle;
-// oldTrans.x() = tm.coords[0][2] - nx * textureSize.x();
-// oldTrans.y() = tm.coords[1][2] - ny * textureSize.y();
oldTrans.x() = tm.coords[0][2];
oldTrans.y() = tm.coords[1][2];
oldCenter.x() = center.x();
rButtonDown = true;
}//*/
-//globalOutputStream() << "(" << (haveAnchor ? "anchor" : "released") << ")\n";
return false;
}
gboolean button_release( GtkWidget * win, GdkEventButton * e, gpointer ){
-// globalOutputStream() << "--> Textool button release...\n";
if ( e->button == 1 ) {
/* float ptx = e->x / windowSize.x() * extents.width() + extents.minX;
}
*/
gboolean motion( GtkWidget * win, GdkEventMotion * e, gpointer ){
-// globalOutputStream() << "--> Textool motion...\n";
if ( lButtonDown ) {
if ( translatingX || translatingY ) {
//Need to fix this to take the rotation angle into account, so that it moves along
//the rotated X/Y axis...
if ( translatingX ) {
-// tm.coords[0][2] = (trans.x() + ptx) * textureSize.x();
//This works, but only when the angle is zero. !!! FIX !!! [DONE]
-// tm.coords[0][2] = oldCenter.x() + (ptx * textureSize.x());
tm.coords[0][2] = oldTrans.x() + ( ptx - trans2.x() ) * textureSize.x();
-// center.x() = oldCenter.x() + (ptx - trans2.x());
}
if ( translatingY ) {
-// tm.coords[1][2] = (trans.y() + pty) * textureSize.y();
-// tm.coords[1][2] = oldCenter.y() + (pty * textureSize.y());
tm.coords[1][2] = oldTrans.y() + ( pty - trans2.y() ) * textureSize.y();
-// center.y() = oldCenter.y() + (pty - trans2.y());
}
//Need to update center.x/y() so that the widget translates as well. Also, oldCenter
// Problem with this: arcsin/cos seems to only return -90 to 90 and 0 to 180...
// Can't derive angle from that!
-//rotationAngle = asin(s);// * 180.0f / 3.141592653589f;
rotationAngle = acos( c );
-//rotationAngle2 = asin(s);
if ( cross[2] < 0 ) {
rotationAngle = -rotationAngle;
}
-//NO! DOESN'T WORK! rotationAngle -= 45.0f * DEG_TO_RAD;
//Let's try this:
//No wok.
/*c = cos(rotationAngle - oldRotationAngle);
s = sin(rotationAngle - oldRotationAngle);
rotationAngle += oldRotationAngle;
- //c += cos(oldRotationAngle);
- //s += sin(oldRotationAngle);
- //rotationAngle += oldRotationAngle;
- //c %= 2.0 * PI;
- //s %= 2.0 * PI;
- //rotationAngle %= 2.0 * PI;//*/
//This is wrong... Hmm...
//It seems to shear the texture instead of rotating it... !!! FIX !!!
-// Now it rotates correctly. Seems TTimo was overcomplicating things here... ;-)
// Seems like what needs to happen here is multiplying these rotations by tm... !!! FIX !!!
tm.coords[1][0] = -s;
tm.coords[1][1] = c;
//It doesn't work anymore... Dunno why...
-//tm.coords[0][2] = -trans.x(); // This works!!! Yeah!!!
-//tm.coords[1][2] = -trans.y();
//nope.
-//tm.coords[0][2] = rotationPoint.x(); // This works, but strangely...
-//tm.coords[1][2] = rotationPoint.y();
-//tm.coords[0][2] = 0;// center.x() / 2.0f;
-//tm.coords[1][2] = 0;// center.y() / 2.0f;
//No.
-//tm.coords[0][2] = -(center.x() * textureSize.x());
-//tm.coords[1][2] = -(center.y() * textureSize.y());
//Eh? No, but seems to be getting closer...
/*float ptx = e->x / windowSize.x() * extents.width() + extents.minX;
float pty = e->y / windowSize.y() * extents.height() + extents.minY;
//Look at nx/y above: they're getting fixed there! !!! FIX !!! [DONE]
float dist = sqrt( ( nx * nx ) + ( ny * ny ) );
// Normalize to the 2.0 = height standard (for now)
-//globalOutputStream() << "--> Distance before: " << dist;
dist = dist * 2.0f / extents.height();
-//globalOutputStream() << ". After: " << dist;
tran.x() = tran.x() * 2.0f / extents.height();
tran.y() = tran.y() * 2.0f / extents.height();
-//globalOutputStream() << ". Trans: " << tran.x() << ", " << tran.y() << "\n";
//Let's try this instead...
//Interesting! It seems that e->x/y are rotated
//It seems the fake tex coords conversion is screwing this stuff up... !!! FIX !!!
//This is still wrong... Prolly need to do something with the oldScaleX/Y stuff...
void flipX( GtkToggleButton *, gpointer ){
-// globalOutputStream() << "--> Flip X...\n";
//Shamus:
-// SurfaceInspector_GetSelectedBPTexdef(); // Refresh g_selectedBrushPrimitTexdef...
-// tm.coords[0][0] = -tm.coords[0][0];
-// tm.coords[1][0] = -tm.coords[1][0];
-// tm.coords[0][0] = -tm.coords[0][0]; // This should be correct now...Nope.
-// tm.coords[1][1] = -tm.coords[1][1];
tm.coords[0][0] = -tm.coords[0][0]; // This should be correct now...
tm.coords[1][0] = -tm.coords[1][0];
-// tm.coords[2][0] = -tm.coords[2][0];//wil wok? no.
UpdateControlPoints();
}
void flipY( GtkToggleButton *, gpointer ){
-// globalOutputStream() << "--> Flip Y...\n";
-// tm.coords[0][1] = -tm.coords[0][1];
-// tm.coords[1][1] = -tm.coords[1][1];
-// tm.coords[0][1] = -tm.coords[0][1]; // This should be correct now...Nope.
-// tm.coords[1][0] = -tm.coords[1][0];
tm.coords[0][1] = -tm.coords[0][1]; // This should be correct now...
tm.coords[1][1] = -tm.coords[1][1];
-// tm.coords[2][1] = -tm.coords[2][1];//wil wok? no.
UpdateControlPoints();
}
glEnable( GL_TEXTURE_2D );
}
- //int totalHeight = abs(y) + last_height + TextureBrowser_fontHeight(textureBrowser) + 4;
}
// reset the current texture
glBindTexture( GL_TEXTURE_2D, 0 );
- //qglFinish();
}
void TextureBrowser_queueDraw( TextureBrowser& textureBrowser ){
}
void TextureBrowser_scrollChanged( void* data, gdouble value ){
- //globalOutputStream() << "vertical scroll\n";
TextureBrowser_setOriginY( *reinterpret_cast<TextureBrowser*>( data ), -(int)value );
}
}
// TODO do we need this?
- //gtk_container_set_focus_chain(GTK_CONTAINER(hbox_table), NULL);
return table;
}
static gint graph_tree_model_get_n_columns( GtkTreeModel* tree_model ){
ASSERT_MESSAGE( tree_model != 0, "RUNTIME ERROR" );
- //GraphTreeModel* graph_tree_model = (GraphTreeModel*) tree_model;
return 2;
}
static GType graph_tree_model_get_column_type( GtkTreeModel *tree_model, gint index ){
ASSERT_MESSAGE( tree_model != 0, "RUNTIME ERROR" );
- //GraphTreeModel *graph_tree_model = (GraphTreeModel *) tree_model;
return G_TYPE_POINTER;
}
{
string << "+set sv_pure 0 ";
// TTimo: a check for vm_* but that's all fine
- //cmdline = "+set sv_pure 0 +set vm_ui 0 +set vm_cgame 0 +set vm_game 0 ";
const char* fs_game = gamename_get();
if ( !string_equal( fs_game, basegame_get() ) ) {
string << "+set fs_game " << fs_game << " ";
// see if there's anything in input
ret = Net_Receive( m_pInSocket, &msg );
if ( ret > 0 ) {
- // unsigned int size = msg.size; //++timo just a check
strcpy( m_xmlBuf, NMSG_ReadString( &msg ) );
if ( m_bNeedCtxtInit ) {
m_xmlParserCtxt = NULL;
{
case GDK_Alt_L:
case GDK_Alt_R:
- //globalOutputStream() << "Alt PRESSED\n";
WindowObservers_OnModifierDown( observers, c_modifierAlt );
break;
case GDK_Shift_L:
case GDK_Shift_R:
- //globalOutputStream() << "Shift PRESSED\n";
WindowObservers_OnModifierDown( observers, c_modifierShift );
break;
case GDK_Control_L:
case GDK_Control_R:
- //globalOutputStream() << "Control PRESSED\n";
WindowObservers_OnModifierDown( observers, c_modifierControl );
break;
}
{
case GDK_Alt_L:
case GDK_Alt_R:
- //globalOutputStream() << "Alt RELEASED\n";
WindowObservers_OnModifierUp( observers, c_modifierAlt );
break;
case GDK_Shift_L:
case GDK_Shift_R:
- //globalOutputStream() << "Shift RELEASED\n";
WindowObservers_OnModifierUp( observers, c_modifierShift );
break;
case GDK_Control_L:
case GDK_Control_R:
- //globalOutputStream() << "Control RELEASED\n";
WindowObservers_OnModifierUp( observers, c_modifierControl );
break;
}
float multiplier = g_chasemouse_timer.elapsed_msec() / 10.0f;
Scroll( float_to_integer( multiplier * m_chasemouse_delta_x ), float_to_integer( multiplier * -m_chasemouse_delta_y ) );
- //globalOutputStream() << "chasemouse: multiplier=" << multiplier << " x=" << m_chasemouse_delta_x << " y=" << m_chasemouse_delta_y << '\n';
XY_MouseMoved( m_chasemouse_current_x, m_chasemouse_current_y, getButtonState() );
g_chasemouse_timer.start();
}
if ( m_chasemouse_delta_y != 0 || m_chasemouse_delta_x != 0 ) {
- //globalOutputStream() << "chasemouse motion: x=" << pointx << " y=" << pointy << "... ";
m_chasemouse_current_x = pointx;
m_chasemouse_current_y = pointy;
if ( m_chasemouse_handler == 0 ) {
- //globalOutputStream() << "chasemouse timer start... ";
g_chasemouse_timer.start();
m_chasemouse_handler = g_idle_add( xywnd_chasemouse, this );
}
else
{
if ( m_chasemouse_handler != 0 ) {
- //globalOutputStream() << "chasemouse cancel\n";
g_source_remove( m_chasemouse_handler );
m_chasemouse_handler = 0;
}
else
{
if ( m_chasemouse_handler != 0 ) {
- //globalOutputStream() << "chasemouse cancel\n";
g_source_remove( m_chasemouse_handler );
m_chasemouse_handler = 0;
}
}
// d1223m
- //Scene_BrushResize_Selected(GlobalSceneGraph(), aabb_for_minmax(mins, maxs), TextureBrowser_GetSelectedShader(GlobalTextureBrowser()));
Scene_BrushResize_Selected( GlobalSceneGraph(), aabb_for_minmax( mins, maxs ),
g_brush_always_caulk ?
"textures/common/caulk" : TextureBrowser_GetSelectedShader( GlobalTextureBrowser() ) );