Main Page | Class Hierarchy | Alphabetical List | Data Structures | Directories | File List | Data Fields | Globals

XYWnd.cpp File Reference

#include "stdafx.h"
#include "Radiant.h"
#include "XYWnd.h"
#include "qe3.h"
#include "PrefsDlg.h"
#include "DialogInfo.h"
#include "splines/splines.h"

Include dependency graph for XYWnd.cpp:

Include dependency graph

Go to the source code of this file.

Defines

#define PAGEFLIPS   2

Functions

void _SmartPointDone (bool b, int n)
void AcquirePath (int nCount, PFNPathCallback *pFunc)
 BEGIN_MESSAGE_MAP (CXYWnd, CWnd) ON_WM_CREATE() ON_WM_LBUTTONDOWN() ON_WM_MBUTTONDOWN() ON_WM_RBUTTONDOWN() ON_WM_LBUTTONUP() ON_WM_MBUTTONUP() ON_WM_RBUTTONUP() ON_WM_MOUSEMOVE() ON_WM_PAINT() ON_WM_KEYDOWN() ON_WM_SIZE() ON_WM_DESTROY() ON_COMMAND(ID_SELECT_MOUSEROTATE
float Betwixt (float f1, float f2)
void Brush_CopyList (brush_t *pFrom, brush_t *pTo)
void CleanCopyEntities ()
void CleanList (brush_t *pList)
brush_tCreateEntityBrush (int x, int y, CXYWnd *pWnd)
void CreateEntityFromName (char *pName, brush_t *pBrush)
void CreateRightClickEntity (CXYWnd *pWnd, int x, int y, char *pName)
brush_tCreateSmartBrush (vec3_t v)
void CreateSmartEntity (CXYWnd *pWnd, int x, int y, const char *pName)
void DrawBrushEntityName (brush_t *b)
void DrawPathLines (void)
entity_tEntity_CopyClone (entity_t *e)
float fDiff (float f1, float f2)
BOOL FilterBrush (brush_t *pb)
void FinishSmartCreation ()
CMemFile g_Clipboard (4096)
CMemFile g_PatchClipboard (4096)
 IMPLEMENT_DYNCREATE (CXYWnd, CWnd)
OnSelectMouserotate CMainFrame::OnSelectionMakeDetail
CMainFrame::OnSelectionSelectcompletetall
CMainFrame::OnSelectionSelectpartialtall 
ON_COMMAND (ID_SELECTION_SELECTTOUCHING, CMainFrame::OnSelectionSelecttouching) ON_COMMAND(ID_SELECTION_UNGROUPENTITY
OnSelectMouserotate CMainFrame::OnSelectionMakeDetail
CMainFrame::OnSelectionSelectcompletetall 
ON_COMMAND (ID_SELECTION_SELECTINSIDE, CMainFrame::OnSelectionSelectinside) ON_COMMAND(ID_SELECTION_SELECTPARTIALTALL
OnSelectMouserotate CMainFrame::OnSelectionMakeDetail ON_COMMAND (ID_SELECTION_MAKE_STRUCTURAL, CMainFrame::OnSelectionMakeStructural) ON_COMMAND(ID_SELECTION_SELECTCOMPLETETALL
OnSelectMouserotate CMainFrame::OnSelectionMakeDetail
CMainFrame::OnSelectionSelectcompletetall
CMainFrame::OnSelectionSelectpartialtall
CMainFrame::OnSelectionUngroupentity 
ON_COMMAND_RANGE (ID_ENTITY_START, ID_ENTITY_END, OnEntityCreate) END_MESSAGE_MAP() LONG WINAPI XYWndProc(HWND
OnSelectMouserotate ON_WM_TIMER () ON_WM_KEYUP() ON_WM_NCCALCSIZE() ON_WM_KILLFOCUS() ON_WM_SETFOCUS() ON_WM_CLOSE() ON_COMMAND(ID_SELECTION_MAKE_DETAIL
bool OnList (entity_t *pFind, CPtrArray *pList)
float ptSum (vec3_t pt)
void WXY_InitPixelFormat (PIXELFORMATDESCRIPTOR *pPFD)
void WXY_Print (void)
LONG WINAPI XYWndProc (HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)

Variables

bool g_bClipMode
bool g_bCrossHairs = false
bool g_bPathMode
bool g_bPointMode
brush_t g_brBackSplits
brush_t g_brClipboard
brush_t g_brFrontSplits
bool g_bRogueClipMode
bool g_bRotateMode
brush_t g_brUndo
bool g_bScaleMode
bool g_bSmartGo
bool g_bSmartWaiting
bool g_bSwitch
CClipPoint g_Clip1
CClipPoint g_Clip2
CClipPoint g_Clip3
entity_t g_enClipboard
long g_lCount = 0
long g_lTotal = 0
int g_nPathCount
int g_nPathLimit
int g_nPointCount
int g_nPointLimit
int g_nScaleHow
int g_nSmartX
int g_nSmartY
CClipPoint g_PathPoints [256]
const char * g_pDimStrings [] = {"x:%.f", "y:%.f", "z:%.f"}
CClipPointg_pMovingClip
CClipPointg_pMovingPath
CClipPointg_pMovingPoint
CClipPoint g_PointPoints [512]
const char * g_pOrgStrings [] = {"(x:%.f y:%.f)", "(x:%.f z:%.f)", "(y:%.f z:%.f)"}
PFNPathCallbackg_pPathFunc = NULL
CPtrArray g_ptrMenus
CString g_strDim
CString g_strSmartEntity
CString g_strStatus
vec3_t g_vRotateOrigin
vec3_t g_vRotation
brush_t hold_brushes
OnSelectMouserotate CMainFrame::OnSelectionMakeDetail
CMainFrame::OnSelectionSelectcompletetall
CMainFrame::OnSelectionSelectpartialtall
CMainFrame::OnSelectionUngroupentity 
LPARAM
int pressx
int pressy
HDC s_hdcXY
HGLRC s_hglrcXY
unsigned s_stipple [32]
vec3_t tdp
OnSelectMouserotate CMainFrame::OnSelectionMakeDetail
CMainFrame::OnSelectionSelectcompletetall
CMainFrame::OnSelectionSelectpartialtall
CMainFrame::OnSelectionUngroupentity 
UINT
OnSelectMouserotate CMainFrame::OnSelectionMakeDetail
CMainFrame::OnSelectionSelectcompletetall
CMainFrame::OnSelectionSelectpartialtall
CMainFrame::OnSelectionUngroupentity 
WPARAM
const int XY_DOWN = 0x08
const int XY_LEFT = 0x01
const int XY_RIGHT = 0x02
const int XY_UP = 0x04


Define Documentation

#define PAGEFLIPS   2
 

Definition at line 42 of file XYWnd.cpp.


Function Documentation

void _SmartPointDone bool  b,
int  n
 

Definition at line 1286 of file XYWnd.cpp.

References g_bSmartWaiting.

Referenced by CreateSmartEntity().

01287 {
01288   g_bSmartWaiting = false;
01289 }

void AcquirePath int  nCount,
PFNPathCallback pFunc
 

Definition at line 93 of file XYWnd.cpp.

References g_bPathMode, g_nPathCount, g_nPathLimit, and g_pPathFunc.

Referenced by _3DPointInput(), CreateSmartEntity(), and QERApp_GetPoints().

00094 {
00095   g_nPathCount = 0;
00096   g_nPathLimit = nCount;
00097   g_pPathFunc = pFunc;
00098   g_bPathMode = true;
00099 }

BEGIN_MESSAGE_MAP CXYWnd  ,
CWnd 
 

float Betwixt float  f1,
float  f2
 

Definition at line 500 of file XYWnd.cpp.

References f1(), and f2().

Referenced by CXYWnd::PaintSizeInfo(), CXYWnd::ProduceSplitLists(), and CXYWnd::ProduceSplits().

00501 {
00502   if (f1 > f2)
00503     return f2 + ((f1 - f2) / 2);
00504   else
00505     return f1 + ((f2 - f1) / 2);
00506 }

Here is the call graph for this function:

void Brush_CopyList brush_t pFrom,
brush_t pTo
 

Definition at line 646 of file XYWnd.cpp.

References Brush_AddToList(), Brush_RemoveFromList(), brush_t, brush_s::next, and NULL.

Referenced by CXYWnd::Clip(), and CXYWnd::SplitClip().

00647 {
00648     brush_t* pBrush = pFrom->next; 
00649     while (pBrush != NULL && pBrush != pFrom)
00650     {
00651         brush_t* pNext = pBrush->next;
00652         Brush_RemoveFromList(pBrush);
00653         Brush_AddToList(pBrush, pTo);
00654         pBrush = pNext;
00655     }
00656 }

Here is the call graph for this function:

void CleanCopyEntities  ) 
 

Definition at line 3298 of file XYWnd.cpp.

References epair_t, entity_t::epairs, free(), g_enClipboard, epair_s::key, epair_s::next, next, NULL, and epair_s::value.

Referenced by CXYWnd::Copy().

03299 {
03300     entity_t* pe = g_enClipboard.next;
03301   while (pe != NULL && pe != &g_enClipboard)
03302   {
03303     entity_t* next = pe->next;
03304     epair_t* enext = NULL;
03305       for (epair_t* ep = pe->epairs ; ep ; ep=enext)
03306     {
03307           enext = ep->next;
03308       free (ep->key);
03309       free (ep->value);
03310           free (ep);
03311     }
03312       free (pe);
03313     pe = next;
03314   }
03315   g_enClipboard.next = g_enClipboard.prev = &g_enClipboard;
03316 }

Here is the call graph for this function:

void CleanList brush_t pList  ) 
 

Definition at line 557 of file XYWnd.cpp.

References Brush_Free(), brush_t, brush_s::next, and NULL.

Referenced by CXYWnd::Clip(), CXYWnd::Copy(), CXYWnd::ProduceSplitLists(), CXYWnd::SetClipMode(), and CXYWnd::SplitClip().

00558 {
00559   brush_t* pBrush = pList->next; 
00560   while (pBrush != NULL && pBrush != pList)
00561   {
00562     brush_t* pNext = pBrush->next;
00563     Brush_Free(pBrush);
00564     pBrush = pNext;
00565   }
00566 }

Here is the call graph for this function:

brush_t* CreateEntityBrush int  x,
int  y,
CXYWnd pWnd
 

Definition at line 1207 of file XYWnd.cpp.

References Brush_AddToList(), Brush_Build(), Brush_Create(), brush_t, QEGlobals_t::d_gridsize, QEGlobals_t::d_new_brush_bottom_z, QEGlobals_t::d_new_brush_top_z, QEGlobals_t::d_texturewin, Entity_LinkBrush(), g_qeglobals, CXYWnd::GetViewType(), i, n, selected_brushes, CXYWnd::SnapToPoint(), texturewin_t::texdef, vec3_t, world_entity, x, and y.

Referenced by CreateRightClickEntity().

01208 {
01209     vec3_t  mins, maxs;
01210     int     i;
01211     float   temp;
01212     brush_t *n;
01213 
01214     pWnd->SnapToPoint (x, y, mins);
01215   x += 32;
01216   y += 32;
01217     pWnd->SnapToPoint (x, y, maxs);
01218 
01219   int nDim = (pWnd->GetViewType() == XY) ? 2 : (pWnd->GetViewType() == YZ) ? 0 : 1;
01220     mins[nDim] = g_qeglobals.d_gridsize * ((int)(g_qeglobals.d_new_brush_bottom_z/g_qeglobals.d_gridsize));
01221     maxs[nDim] = g_qeglobals.d_gridsize * ((int)(g_qeglobals.d_new_brush_top_z/g_qeglobals.d_gridsize));
01222 
01223   if (maxs[nDim] <= mins[nDim])
01224         maxs[nDim] = mins[nDim] + g_qeglobals.d_gridsize;
01225 
01226     for (i=0 ; i<3 ; i++)
01227     {
01228         if (mins[i] == maxs[i])
01229             maxs[i] += 16;  // don't create a degenerate brush
01230         if (mins[i] > maxs[i])
01231         {
01232             temp = mins[i];
01233             mins[i] = maxs[i];
01234             maxs[i] = temp;
01235         }
01236     }
01237 
01238     n = Brush_Create (mins, maxs, &g_qeglobals.d_texturewin.texdef);
01239     if (!n)
01240         return NULL;
01241 
01242     Brush_AddToList (n, &selected_brushes);
01243     Entity_LinkBrush (world_entity, n);
01244     Brush_Build( n );
01245   return n;
01246 }

Here is the call graph for this function:

void CreateEntityFromName char *  pName,
brush_t pBrush
 

Definition at line 1149 of file XYWnd.cpp.

References active_brushes, b, Brush_AddToList(), Brush_Build(), Brush_Create(), Brush_Free(), brush_t, entity_t::brushes, QEGlobals_t::d_hwndEntity, QEGlobals_t::d_hwndMain, entity_s::eclass, Eclass_ForName(), eclass_t, Entity_Create(), Entity_LinkBrush(), eclass_s::fixedsize, g_qeglobals, i, IDC_BTN_ASSIGNMODEL, eclass_s::maxs, eclass_s::mins, brush_s::mins, brush_s::next, brush_s::owner, Select_Brush(), Select_Deselect(), selected_brushes, SetInspectorMode(), SetKeyValue(), eclass_s::texdef, vec3_t, VectorAdd, W_ENTITY, and world_entity.

Referenced by CreateRightClickEntity().

01150 {
01151     eclass_t *pecNew;
01152     entity_t *petNew;
01153     if (stricmp(pName, "worldspawn") == 0)
01154     {
01155         MessageBox(g_qeglobals.d_hwndMain, "Can't create an entity with worldspawn.", "info", 0);
01156         return;
01157     }
01158     
01159     pecNew = Eclass_ForName(pName, false);
01160     
01161     // create it
01162     petNew = Entity_Create(pecNew);
01163     if (petNew == NULL)
01164     {
01165         if (!((selected_brushes.next == &selected_brushes)||(selected_brushes.next->next != &selected_brushes)))
01166         {
01167             brush_t* b = selected_brushes.next;
01168             if (b->owner != world_entity && b->owner->eclass->fixedsize && pecNew->fixedsize)
01169             {
01170                 vec3_t mins, maxs;
01171                 vec3_t origin;
01172                 for (int i=0 ; i<3 ; i++)
01173                     origin[i] = b->mins[i] - pecNew->mins[i];
01174                 
01175                 VectorAdd (pecNew->mins, origin, mins);
01176                 VectorAdd (pecNew->maxs, origin, maxs);
01177                 brush_t* nb = Brush_Create (mins, maxs, &pecNew->texdef);
01178                 Entity_LinkBrush (b->owner, nb);
01179                 nb->owner->eclass = pecNew;
01180                 SetKeyValue (nb->owner, "classname", pName);
01181                 Brush_Free(b);
01182                 Brush_Build(nb);
01183                 Brush_AddToList (nb, &active_brushes);
01184                 Select_Brush(nb);
01185                 return;
01186             }
01187         }
01188         MessageBox(g_qeglobals.d_hwndMain, "Failed to create entity.", "info", 0);
01189         return;
01190     }
01191     
01192     Select_Deselect ();
01193     //entity_t* pEntity = world_entity;
01194     //if (selected_brushes.next != &selected_brushes)
01195     //  pEntity = selected_brushes.next->owner;
01196     Select_Brush (petNew->brushes.onext);
01197     
01198     if (stricmp(pName, "misc_model") == 0)
01199     {
01200         SetInspectorMode(W_ENTITY);
01201         PostMessage(g_qeglobals.d_hwndEntity, WM_COMMAND, IDC_BTN_ASSIGNMODEL, 0);
01202     }
01203     
01204 }

Here is the call graph for this function:

void CreateRightClickEntity CXYWnd pWnd,
int  x,
int  y,
char *  pName
 

Definition at line 1248 of file XYWnd.cpp.

References brush_t, CreateEntityBrush(), CreateEntityFromName(), brush_s::next, selected_brushes, and x.

Referenced by CreateSmartEntity(), FinishSmartCreation(), and CXYWnd::OnEntityCreate().

01249 {
01250   CRect rctZ;
01251   pWnd->GetClientRect(rctZ);
01252   brush_t* pBrush = (selected_brushes.next == &selected_brushes) ? CreateEntityBrush(x, rctZ.Height() - 1 - y, pWnd) : selected_brushes.next;
01253   CreateEntityFromName(pName, pBrush);
01254   //Select_Brush(pBrush);
01255 }

Here is the call graph for this function:

brush_t* CreateSmartBrush vec3_t  v  ) 
 

Definition at line 1257 of file XYWnd.cpp.

References Brush_AddToList(), Brush_Build(), Brush_Create(), brush_t, QEGlobals_t::d_texturewin, g_qeglobals, i, n, selected_brushes, texturewin_t::texdef, v, and vec3_t.

Referenced by CreateSmartEntity().

01258 {
01259     vec3_t  mins, maxs;
01260     int     i;
01261     brush_t *n;
01262 
01263     for (i=0 ; i<3 ; i++)
01264     {
01265     mins[i] = v[i] - 16;
01266     maxs[i] = v[i] + 16;
01267   }
01268 
01269     n = Brush_Create (mins, maxs, &g_qeglobals.d_texturewin.texdef);
01270     if (!n)
01271         return NULL;
01272 
01273     Brush_AddToList(n, &selected_brushes);
01274     //Entity_LinkBrush(world_entity, n);
01275     Brush_Build(n);
01276   return n;
01277 }

Here is the call graph for this function:

void CreateSmartEntity CXYWnd pWnd,
int  x,
int  y,
const char *  pName
 

Definition at line 1291 of file XYWnd.cpp.

References _SmartPointDone(), AcquirePath(), CMainFrame::ActiveXY(), array(), brush_t, ConnectEntities(), CreateRightClickEntity(), CreateSmartBrush(), g_bPathMode, g_bScreenUpdates, g_bSmartGo, g_bSmartWaiting, g_nPathCount, g_nPathLimit, g_nSmartX, g_nSmartY, g_PathPoints, g_pParentWnd, g_strSmartEntity, HideInfoDialog(), brush_s::next, Select_Brush(), Select_Deselect(), selected_brushes, and ShowInfoDialog().

Referenced by CXYWnd::OnEntityCreate().

01292 {
01293   g_nSmartX = x;
01294   g_nSmartY = y;
01295   g_strSmartEntity = pName;
01296   if (g_strSmartEntity.Find("Smart_Train") >= 0)
01297   {
01298     ShowInfoDialog("Select the path of the train by left clicking in XY, YZ and/or XZ views. You can move an already dropped point by grabbing and moving it. When you are finished, press ENTER to accept and create the entity and path(s), press ESC to abandon the creation");
01299     g_bPathMode = true;
01300     g_nPathLimit = 0;
01301     g_nPathCount = 0;
01302     g_bSmartGo = true;
01303   }
01304   else
01305   if (g_strSmartEntity.Find("Smart_Monster...") >= 0)
01306   {
01307     g_bPathMode = true;
01308     g_nPathLimit = 0;
01309     g_nPathCount = 0;
01310   }
01311   else
01312   if (g_strSmartEntity.Find("Smart_Rotating") >= 0)
01313   {
01314     g_bSmartWaiting = true;
01315     ShowInfoDialog("Left click to specify the rotation origin");
01316     AcquirePath(1, &_SmartPointDone);
01317     while (g_bSmartWaiting)
01318     {
01319       MSG msg;
01320       if (::PeekMessage( &msg, NULL, 0, 0, PM_REMOVE )) 
01321       { 
01322         TranslateMessage(&msg);
01323         DispatchMessage(&msg);
01324       }
01325     }
01326     HideInfoDialog();
01327     CPtrArray array;
01328     g_bScreenUpdates = false;
01329     CreateRightClickEntity(g_pParentWnd->ActiveXY(), g_nSmartX, g_nSmartY, "func_rotating");
01330     array.Add(reinterpret_cast<void*>(selected_brushes.next));
01331     Select_Deselect();
01332     brush_t* pBrush = CreateSmartBrush(g_PathPoints[0]);
01333     array.Add(pBrush);
01334     Select_Deselect();
01335     Select_Brush(reinterpret_cast<brush_t*>(array.GetAt(0)));
01336     Select_Brush(reinterpret_cast<brush_t*>(array.GetAt(1)));
01337     ConnectEntities();
01338     g_bScreenUpdates = true;
01339   }
01340 }

Here is the call graph for this function:

void DrawBrushEntityName brush_t b  ) 
 

Definition at line 488 of file Brush.cpp.

References a, b, brush_t, entity_s::brushes, c, cos(), QEGlobals_t::d_savedinfo, SavedInfo_t::exclude, FloatForKey(), g_qeglobals, i, brush_s::maxs, brush_s::mins, name, brush_s::onext, brush_s::owner, Q_PI, qglBegin, qglCallLists, qglEnd, qglRasterPos3f, qglVertex3fv, s, SavedInfo_t::show_names, sin(), strlen(), and ValueForKey().

Referenced by Brush_DrawXY().

00489 {
00490     char    *name;
00491     //float a, s, c;
00492     //vec3_t    mid;
00493     //int       i;
00494 
00495     if (!b->owner)
00496         return;     // during contruction
00497 
00498     if (b->owner == world_entity)
00499         return;
00500 
00501     if (b != b->owner->brushes.onext)
00502         return; // not key brush
00503 
00504 // MERGEME
00505 #if 0
00506     if (!(g_qeglobals.d_savedinfo.exclude & EXCLUDE_ANGLES))
00507     {
00508         // draw the angle pointer
00509         a = FloatForKey (b->owner, "angle");
00510         if (a)
00511         {
00512             s = sin (a/180*Q_PI);
00513             c = cos (a/180*Q_PI);
00514             for (i=0 ; i<3 ; i++)
00515                 mid[i] = (b->mins[i] + b->maxs[i])*0.5; 
00516 
00517             qglBegin (GL_LINE_STRIP);
00518             qglVertex3fv (mid);
00519             mid[0] += c*8;
00520             mid[1] += s*8;
00521             mid[2] += s*8;
00522             qglVertex3fv (mid);
00523             mid[0] -= c*4;
00524             mid[1] -= s*4;
00525             mid[2] -= s*4;
00526             mid[0] -= s*4;
00527             mid[1] += c*4;
00528             mid[2] += c*4;
00529             qglVertex3fv (mid);
00530             mid[0] += c*4;
00531             mid[1] += s*4;
00532             mid[2] += s*4;
00533             mid[0] += s*4;
00534             mid[1] -= c*4;
00535             mid[2] -= c*4;
00536             qglVertex3fv (mid);
00537             mid[0] -= c*4;
00538             mid[1] -= s*4;
00539             mid[2] -= s*4;
00540             mid[0] += s*4;
00541             mid[1] -= c*4;
00542             mid[2] -= c*4;
00543             qglVertex3fv (mid);
00544             qglEnd ();
00545         }
00546     }
00547 #endif
00548 
00549     if (g_qeglobals.d_savedinfo.show_names)
00550     {
00551         name = ValueForKey (b->owner, "classname");
00552         qglRasterPos3f (b->mins[0]+4, b->mins[1]+4, b->mins[2]+4);
00553         qglCallLists (strlen(name), GL_UNSIGNED_BYTE, name);
00554     }
00555 }

Here is the call graph for this function:

void DrawPathLines void   ) 
 

Definition at line 2503 of file XYWnd.cpp.

References brush_t, entity_t::brushes, QEGlobals_t::d_savedinfo, entities, SavedInfo_t::exclude, f, g_qeglobals, i, j, k, brush_s::maxs, brush_s::mins, NULL, num_entities, qglBegin, qglColor3f, qglEnd, qglVertex3f, qglVertex3fv, strcmp(), ValueForKey(), vec3_t, vec_t, VectorNormalize(), and VectorSubtract.

Referenced by CCamWnd::Cam_Draw(), and CXYWnd::XY_Draw().

02504 {
02505     int     i, j, k;
02506     vec3_t  mid, mid1;
02507     entity_t *se, *te;
02508     brush_t *sb, *tb;
02509     char    *psz;
02510     vec3_t  dir, s1, s2;
02511     vec_t   len, f;
02512     int     arrows;
02513     int         num_entities;
02514     char        *ent_target[MAX_MAP_ENTITIES];
02515     entity_t    *ent_entity[MAX_MAP_ENTITIES];
02516 
02517     if (g_qeglobals.d_savedinfo.exclude & EXCLUDE_PATHS)
02518     return;
02519 
02520     num_entities = 0;
02521     for (te = entities.next ; te != &entities && num_entities != MAX_MAP_ENTITIES ; te = te->next)
02522     {
02523         ent_target[num_entities] = ValueForKey (te, "target");
02524         if (ent_target[num_entities][0])
02525         {
02526             ent_entity[num_entities] = te;
02527             num_entities++;
02528         }
02529     }
02530 
02531     for (se = entities.next ; se != &entities ; se = se->next)
02532     {
02533         psz = ValueForKey(se, "targetname");
02534     
02535         if (psz == NULL || psz[0] == '\0')
02536             continue;
02537         
02538         sb = se->brushes.onext;
02539         if (sb == &se->brushes)
02540             continue;
02541 
02542         for (k=0 ; k<num_entities ; k++)
02543         {
02544         if (strcmp (ent_target[k], psz))
02545                 continue;
02546 
02547             te = ent_entity[k];
02548             tb = te->brushes.onext;
02549             if (tb == &te->brushes)
02550                 continue;
02551 
02552             for (i=0 ; i<3 ; i++)
02553                 mid[i] = (sb->mins[i] + sb->maxs[i])*0.5; 
02554 
02555             for (i=0 ; i<3 ; i++)
02556                 mid1[i] = (tb->mins[i] + tb->maxs[i])*0.5; 
02557 
02558             VectorSubtract (mid1, mid, dir);
02559             len = VectorNormalize (dir);
02560             s1[0] = -dir[1]*8 + dir[0]*8;
02561             s2[0] = dir[1]*8 + dir[0]*8;
02562             s1[1] = dir[0]*8 + dir[1]*8;
02563             s2[1] = -dir[0]*8 + dir[1]*8;
02564 
02565             qglColor3f (se->eclass->color[0], se->eclass->color[1], se->eclass->color[2]);
02566 
02567             qglBegin(GL_LINES);
02568             qglVertex3fv(mid);
02569             qglVertex3fv(mid1);
02570 
02571             arrows = (int)(len / 256) + 1;
02572 
02573             for (i=0 ; i<arrows ; i++)
02574             {
02575                 f = len * (i + 0.5) / arrows;
02576 
02577                 for (j=0 ; j<3 ; j++)
02578                     mid1[j] = mid[j] + f*dir[j];
02579                 qglVertex3fv (mid1);
02580                 qglVertex3f (mid1[0] + s1[0], mid1[1] + s1[1], mid1[2]);
02581                 qglVertex3fv (mid1);
02582                 qglVertex3f (mid1[0] + s2[0], mid1[1] + s2[1], mid1[2]);
02583             }
02584 
02585             qglEnd();
02586         }
02587     }
02588 
02589     return;
02590 }

Here is the call graph for this function:

entity_t* Entity_CopyClone entity_t e  ) 
 

Definition at line 3318 of file XYWnd.cpp.

References entity_t::brushes, copystring(), e, epair_t, entity_t::epairs, g_enClipboard, epair_s::key, n, nlist::next, epair_s::next, np, qmalloc(), and epair_s::value.

Referenced by CXYWnd::Copy().

03319 {
03320     entity_t    *n;
03321     epair_t     *ep, *np;
03322 
03323     n = (entity_t*)qmalloc(sizeof(*n));
03324     n->brushes.onext = n->brushes.oprev = &n->brushes;
03325     n->eclass = e->eclass;
03326 
03327     // add the entity to the entity list
03328     n->next = g_enClipboard.next;
03329     g_enClipboard.next = n;
03330     n->next->prev = n;
03331     n->prev = &g_enClipboard;
03332 
03333     for (ep = e->epairs ; ep ; ep=ep->next)
03334     {
03335         np = (epair_t*)qmalloc(sizeof(*np));
03336         np->key = copystring(ep->key);
03337         np->value = copystring(ep->value);
03338         np->next = n->epairs;
03339         n->epairs = np;
03340     }
03341     return n;
03342 }

Here is the call graph for this function:

float fDiff float  f1,
float  f2
 

Definition at line 745 of file XYWnd.cpp.

References f1(), and f2().

Referenced by CXYWnd::OnMouseMove().

00746 {
00747   if (f1 > f2)
00748     return f1 - f2;
00749   else
00750     return f2 - f1;
00751 }

Here is the call graph for this function:

BOOL FilterBrush brush_t pb  ) 
 

Definition at line 2371 of file XYWnd.cpp.

References BOOL, brush_s::brush_faces, brush_t, texdef_t::contents, CONTENTS_SLIME, CONTENTS_WATER, QEGlobals_t::d_savedinfo, entity_s::eclass, SavedInfo_t::exclude, f, face_t, g_qeglobals, brush_s::hiddenBrush, eclass_s::name, texdef_t::name, face_s::next, eclass_s::nShowFlags, brush_s::owner, brush_s::patchBrush, strncmp(), strstr(), brush_s::terrainBrush, and face_s::texdef.

Referenced by CCamWnd::Cam_Draw(), Select_AllOfType(), Select_CompleteTall(), Select_Inside(), Select_PartialTall(), Select_Touching(), Test_Ray(), and CXYWnd::XY_Draw().

02372 {
02373     if (!pb->owner)
02374         return FALSE;       // during construction
02375 
02376   if (pb->hiddenBrush)
02377   {
02378     return TRUE;
02379   }
02380 
02381     if (g_qeglobals.d_savedinfo.exclude & EXCLUDE_CAULK)
02382   {
02383     // filter out the brush only if all faces are caulk
02384     // if not don't hide the whole brush, proceed on a per-face basis (Cam_Draw)
02385     //++timo TODO: set this as a preference .. show caulk: hide any brush with caulk // don't draw caulk faces
02386     face_t *f;
02387     f=pb->brush_faces;
02388     while (f)
02389     {
02390       if (!strstr(f->texdef.name, "caulk"))
02391         break;
02392       f = f->next;
02393     }
02394     if (!f)
02395       return TRUE;
02396 
02397 #if 0
02398     if (strstr(pb->brush_faces->texdef.name, "caulk"))
02399       return TRUE;
02400 #endif
02401 
02402     //++timo FIXME: .. same deal here?
02403     if (strstr(pb->brush_faces->texdef.name, "donotenter"))
02404       return TRUE;
02405   }
02406 
02407     if (g_qeglobals.d_savedinfo.exclude & EXCLUDE_HINT)
02408   {
02409     if (strstr(pb->brush_faces->texdef.name, "hint"))
02410       return TRUE;
02411   }
02412 
02413     if (g_qeglobals.d_savedinfo.exclude & EXCLUDE_CLIP)
02414     {
02415     if (strstr(pb->brush_faces->texdef.name, "clip"))
02416       return TRUE;
02417 
02418     if (strstr(pb->brush_faces->texdef.name, "skip"))
02419       return TRUE;
02420 
02421         //if (!strncmp(pb->brush_faces->texdef.name, "clip", 4))
02422         //  return TRUE;
02423     }
02424 
02425     if (g_qeglobals.d_savedinfo.exclude & EXCLUDE_WATER)
02426     {
02427         for (face_t* f = pb->brush_faces ; f ; f=f->next)
02428     {
02429       if (f->texdef.contents & (CONTENTS_WATER | CONTENTS_SLIME | CONTENTS_LAVA))
02430         return TRUE;
02431     }
02432     }
02433 
02434     if (g_qeglobals.d_savedinfo.exclude & EXCLUDE_DETAIL)
02435     {
02436         if (pb->brush_faces->texdef.contents & CONTENTS_DETAIL)
02437             return TRUE;
02438     }
02439 
02440     if (g_qeglobals.d_savedinfo.exclude & EXCLUDE_CURVES)
02441     {
02442         if (pb->patchBrush)
02443             return TRUE;
02444     }
02445 
02446     if( g_qeglobals.d_savedinfo.exclude & EXCLUDE_TERRAIN )
02447     {
02448         if( pb->terrainBrush )
02449         {
02450             return TRUE;
02451         }
02452     }
02453 
02454     if (pb->owner == world_entity)
02455     {
02456         if (g_qeglobals.d_savedinfo.exclude & EXCLUDE_WORLD)
02457             return TRUE;
02458         return FALSE;
02459     }
02460     else 
02461   {
02462     if (g_qeglobals.d_savedinfo.exclude & EXCLUDE_ENT)
02463     {
02464           return (strncmp(pb->owner->eclass->name, "func_group", 10));
02465     }
02466   }
02467 
02468     if (g_qeglobals.d_savedinfo.exclude & EXCLUDE_LIGHTS)
02469     {
02470     return (pb->owner->eclass->nShowFlags & ECLASS_LIGHT);
02471         //if (!strncmp(pb->owner->eclass->name, "light", 5))
02472         //  return TRUE;
02473     }
02474 
02475     if (g_qeglobals.d_savedinfo.exclude & EXCLUDE_PATHS)
02476     {
02477     return (pb->owner->eclass->nShowFlags & ECLASS_PATH);
02478         //if (!strncmp(pb->owner->eclass->name, "path", 4))
02479         //  return TRUE;
02480     }
02481 
02482     return FALSE;
02483 }

Here is the call graph for this function:

void FinishSmartCreation  ) 
 

Definition at line 1343 of file XYWnd.cpp.

References CMainFrame::ActiveXY(), array(), brush_t, ConnectEntities(), CreateRightClickEntity(), g_bPathMode, g_bScreenUpdates, g_nPathCount, g_PathPoints, g_pParentWnd, g_strSmartEntity, HideInfoDialog(), CClipPoint::m_ptScreen, n, brush_s::next, Select_Brush(), Select_Deselect(), selected_brushes, Sys_UpdateWindows(), and W_ALL.

Referenced by CXYWnd::Clip().

01344 {
01345   CPtrArray array;
01346   HideInfoDialog();
01347   brush_t* pEntities = NULL;
01348   if (g_strSmartEntity.Find("Smart_Train") >= 0)
01349   {
01350     g_bScreenUpdates = false;
01351     CreateRightClickEntity(g_pParentWnd->ActiveXY(), g_nSmartX, g_nSmartY, "func_train");
01352     array.Add(reinterpret_cast<void*>(