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

QE3.H File Reference

#include <windows.h>
#include "qgl.h"
#include <math.h>
#include <stdlib.h>
#include <malloc.h>
#include "qertypes.h"
#include "../libs/cmdlib.h"
#include "mathlib.h"
#include "parse.h"
#include "lbmlib.h"
#include <commctrl.h>
#include "afxres.h"
#include "resource.h"
#include "qedefs.h"
#include "qfiles.h"
#include "textures.h"
#include "brush.h"
#include "entity.h"
#include "map.h"
#include "select.h"
#include "splines/splines.h"
#include "camera.h"
#include "xy.h"
#include "z.h"
#include "mru.h"
#include "undo.h"
#include "terrain.h"
#include "qerplugin.h"
#include "isurfaceplugin.h"
#include "igl.h"
#include "ISelectedFace.h"
#include "IEpairs.h"
#include "EpairsWrapper.h"
#include "IPluginEntities.h"
#include "ShaderInfo.h"
#include "IScriplib.h"
#include "IBSPFrontend.h"
#include "IMessaging.h"
#include "Messaging.h"
#include "IShaders.h"

Include dependency graph for QE3.H:

Include dependency graph

Go to the source code of this file.

Data Structures

struct  group_s
struct  pedge_t
struct  QEGlobals_t
struct  SavedInfo_t

Defines

#define MAX_NUM_ARGVS   32
#define myoffsetof(type, identifier)   ((size_t)&((type *)0)->identifier)
#define QERTYPES_USE_MFC

Typedefs

typedef group_s group_t

Functions

brush_tAddBrushForPatch (patchMesh_t *pm, bool bLinkToWorld=true)
bool WINAPI AnyPatchesSelected ()
void Brush_RebuildBrush (brush_t *b, vec3_t vMins, vec3_t vMaxs)
void BrushPrimit_Parse (brush_t *)
void BuildGammaTable (float g)
int CheckParm (char *check)
char * COM_Parse (char *data)
void ComputeAxisBase (vec3_t normal, vec3_t texS, vec3_t texT)
void ComputeBest2DVector (vec3_t v, vec3_t X, vec3_t Y, int &x, int &y)
void ConnectEntities (void)
void ConvertTexMatWithQTexture (brushprimit_texdef_t *texMat1, qtexture_t *qtex1, brushprimit_texdef_t *texMat2, qtexture_t *qtex2)
char * copystring (char *s)
BOOL CreateEntityWindow (HINSTANCE hInstance)
void CSG_MakeHollow (void)
void CSG_Merge (void)
void CSG_Subtract (void)
void Curve_AddFakePlanes (brush_t *B)
void Curve_BuildPoints (brush_t *b)
void Curve_CameraDraw (brush_t *b)
void Curve_Invert (void)
void Curve_MakeCurvedBrush (qboolean negative, qboolean top, qboolean bottom, qboolean s1, qboolean s2, qboolean s3, qboolean s4)
void Curve_StripFakePlanes (brush_t *B)
void Curve_WriteFile (char *name)
void Curve_XYDraw (brush_t *b)
bool DispatchOnLButtonDown (UINT nFlags, int x, int y)
bool DispatchOnLButtonUp (UINT nFlags, int x, int y)
void DispatchOnMouseMove (UINT nFlags, int x, int y)
void DispatchRadiantMsg (int Msg)
void DoAbout (void)
void DoFind (void)
void DoGamma (void)
void DoRotate (void)
void DoSides (bool bCone=false, bool bSphere=false, bool bTorus=false)
void DoSurface ()
void Drag_Begin (int x, int y, int buttons, vec3_t xaxis, vec3_t yaxis, vec3_t origin, vec3_t dir)
void Drag_MouseMoved (int x, int y, int buttons)
void Drag_MouseUp (int nButtons=0)
void DrawPluginEntities (VIEWTYPE vt)
int DrawTexControls (HWND hWnd)
void Eclass_ScanFile (char *filename)
void EmitBrushPrimitTextureCoordinates (face_t *, winding_t *)
void EmitTextureCoordinates (float *xyzst, qtexture_t *q, face_t *f)
void Error (char *error,...)
char * ExpandReletivePath (char *p)
void Face_MoveTexture_BrushPrimit (face_t *f, vec3_t delta)
void FaceToBrushPrimitFace (face_t *f)
void FakeTexCoordsToTexMat (float shift[2], float rot, float scale[2], vec_t texMat[2][3])
void FillBSPMenu (void)
void FillClassList (void)
void FillTextureMenu (CStringArray *pArray=NULL)
BOOL GetSelectAllCriteria (CString &strKey, CString &strVal)
void GetSpawnFlags (void)
void Group_Add (entity_t *e)
void Group_AddToProperGroup (brush_t *b)
void Group_AddToSelected (brush_t *b)
void Group_AddToWorld (brush_t *b)
group_tGroup_Alloc (const char *name)
group_tGroup_ForName (const char *name)
void Group_Init ()
void Group_RemoveBrush (brush_t *b)
void Group_RemoveListFromWorld ()
void Group_Save (FILE *f)
CShaderInfohasShader (const char *pName)
double I_FloatTime (void)
qboolean IsBrushSelected (brush_t *bSel)
BOOL LoadRegistryInfo (const char *pszName, void *pvBuf, long *plSize)
BOOL LoadWindowState (HWND hWnd, const char *pszName)
void Main_Create (HINSTANCE hInstance)
patchMesh_tMakeNewPatch ()
bool WINAPI OnlyPatchesSelected ()
void ParseCommandLine (char *lpCmdLine)
int ParseNum (char *str)
void Patch_AddRow (patchMesh_t *p)
void Patch_AdjustColumns (patchMesh_t *p, int nCols)
void Patch_AdjustRows (patchMesh_t *p, int nRows)
void Patch_AdjustSelected (bool bInsert, bool bColumn, bool bFlag)
void Patch_ApplyMatrix (patchMesh_t *p, const vec3_t vOrigin, const vec3_t vMatrix[3], bool bSnap=false)
void Patch_BendHandleENTER ()
void Patch_BendHandleTAB ()
void Patch_BendToggle ()
void Patch_BrushToMesh (bool bCone=false, bool bBevel=false, bool bEndcap=false, bool bSquare=false, int nHeight=3)
void Patch_BuildPoints (brush_t *b)
void Patch_CapCurrent (bool bInvertedBevel=false, bool bInvertedEndcap=false)
void Patch_Cleanup ()
void Patch_ClearOverlays ()
void Patch_Delete (patchMesh_t *p)
void Patch_Deselect (patchMesh_t *p)
void Patch_Deselect ()
void Patch_DisperseColumns ()
void Patch_DisperseRows ()
bool Patch_DragScale (patchMesh_t *p, vec3_t vAmt, vec3_t vMove)
void Patch_DrawCam (patchMesh_t *p)
void Patch_DrawXY (patchMesh_t *p)
patchMesh_tPatch_Duplicate (patchMesh_t *pFrom)
void Patch_EditPatch ()
void Patch_FindReplaceTexture (brush_t *pb, const char *pFind, const char *pReplace, bool bForce)
void Patch_FitTexturing ()
void Patch_Freeze ()
void Patch_FromTriangle (vec5_t vx, vec5_t vy, vec5_t vz)
brush_tPatch_GenericMesh (int nWidth, int nHeight, int nOrientation=2, bool bDeleteSource=true, bool bOverride=false)
const char * Patch_GetKeyValue (patchMesh_t *p, const char *pKey)
const char * Patch_GetTextureName ()
void Patch_InsDelHandleENTER ()
void Patch_InsDelHandleTAB ()
void Patch_InsDelToggle ()
void Patch_InsertColumn (patchMesh_t *p, bool bAdd)
void Patch_InsertRow (patchMesh_t *p, bool bAdd)
void Patch_InvertTexture (bool bY)
int Patch_MemorySize (patchMesh_t *p)
void Patch_Move (patchMesh_t *p, const vec3_t vMove, bool bRebuild=false)
void Patch_NaturalizeSelected (bool bCap=false, bool bCycleCap=false)
void Patch_NaturalTexturing ()
brush_tPatch_Parse (bool bOld)
void Patch_ReadBuffer (char *pBuff, bool bSelect=false)
void Patch_ReadFile (char *name)
void WINAPI Patch_Rebuild (patchMesh_t *p)
void Patch_RemoveColumn (patchMesh_t *p, bool bFirst)
void Patch_RemoveRow (patchMesh_t *p, bool bFirst)
void Patch_ReplaceQTexture (brush_t *pb, qtexture_t *pOld, qtexture_t *pNew)
void Patch_ResetTexturing (float fx, float fy)
void Patch_Restore (patchMesh_t *p)
void Patch_RotateTexture (patchMesh_t *p, float fAngle)
void Patch_Save (patchMesh_t *p)
void Patch_Scale (patchMesh_t *p, const vec3_t vOrigin, const vec3_t vAmt, bool bRebuilt=true)
void Patch_ScaleTexture (patchMesh_t *p, float fx, float fy, bool bFixup=true)
void Patch_Select (patchMesh_t *p)
void Patch_SelectAreaPoints ()
void Patch_SelectBendAxis ()
void Patch_SelectBendNormal ()
void Patch_SetEpair (patchMesh_t *p, const char *pKey, const char *pValue)
void Patch_SetOverlays ()
void Patch_SetTexture (patchMesh_t *p, texdef_t *tex_def, IPluginTexdef *pPlugTexdef=NULL)
void Patch_SetTextureInfo (texdef_t *pt)
void Patch_SetView (int n)
void Patch_ShiftTexture (patchMesh_t *p, float fx, float fy)
void Patch_StartInsDel ()
void Patch_Thicken (int nAmount, bool bSeam)
void Patch_ToggleInverted ()
void Patch_Transpose ()
void Patch_UnFreeze (bool bAll)
void Patch_UpdateSelected (vec3_t vMove)
void Patch_Write (patchMesh_t *p, CMemFile *file)
void Patch_Write (patchMesh_t *p, FILE *f)
void Patch_WriteFile (CMemFile *pMemFile)
void Patch_WriteFile (char *name)
void WINAPI Pointfile_Check (void)
void Pointfile_Clear (void)
void Pointfile_Delete (void)
void Pointfile_Draw (void)
void Pointfile_Load (void)
void Pointfile_Next (void)
void Pointfile_Prev (void)
void ProjectDialog (void)
void QE_CheckAutoSave (void)
void WINAPI QE_CheckOpenGLForErrors (void)
void WINAPI QE_ConvertDOSToUnixName (char *dst, const char *src)
void QE_CountBrushesAndUpdateStatusBar (void)
void QE_ExpandBspString (char *bspaction, char *out, char *mapname, bool useTemps)
void QE_Init (void)
qboolean QE_KeyDown (int key, int nFlags=0)
qboolean QE_LoadProject (char *projectfile)
qboolean QE_SingleBrush (bool bQuiet=false)
int WINAPI QERApp_EClassScanDir (char *dir, HMODULE plugID)
int WINAPI QERApp_GetFaceInfo (_QERFaceData *pFaceData, winding_t *pWinding)
HGLRC WINAPI QERApp_GetQeglobalsHGLRC ()
void WINAPI QERApp_GetTextureSize (int Size[2])
void WINAPI QERApp_GetTwoSelectedPatch (patchMesh_t **p1, patchMesh_t **p2)
IXYWndWrapper *WINAPI QERApp_GetXYWndWrapper ()
void WINAPI QERApp_HookListener (IListener *pListen, int Msg)
void WINAPI QERApp_HookWindow (IWindowListener *pListen)
void WINAPI QERApp_HookXYGLWindow (IGLWindow *pGLW)
int WINAPI QERApp_ISelectedFace_GetTextureNumber ()
void WINAPI QERApp_MapPrintf_FILE (char *text,...)
int WINAPI QERApp_SetFaceInfo (_QERFaceData *pFaceData)
qtexture_t *WINAPI QERApp_TryTextureForName (const char *name)
void WINAPI QERApp_UnHookGLWindow (IGLWindow *pGLW)
int WINAPI QERApp_UnHookListener (IListener *pListen)
void WINAPI QERApp_UnHookWindow (IWindowListener *pListen)
int WINAPI QEW_SetupPixelFormat (HDC hDC, qboolean zbuffer)
void QEW_StopGL (HWND hWnd, HGLRC hGLRC, HDC hDC)
void RotateFaceTexture_BrushPrimit (face_t *f, int nAxis, float fDeg, vec3_t vOrigin)
BOOL SaveRegistryInfo (const char *pszName, void *pvBuf, long lSize)
BOOL SaveWindowState (HWND hWnd, const char *pszName)
void Select_ShiftTexture_BrushPrimit (face_t *f, int x, int y)
void Select_SnapToGrid ()
void SelectEdgeByRay (vec3_t org, vec3_t dir)
void SelectVertexByRay (vec3_t org, vec3_t dir)
void SetInspectorMode (int iType)
void SetKeyValuePairs (bool bClearMD3=false)
CShaderInfoSetNameShaderInfo (qtexture_t *q, const char *pPath, const char *pName)
void SetSpawnFlags (void)
void SetupVertexSelection (void)
patchMesh_tSinglePatchSelected ()
void Sys_Beep (void)
void Sys_BeginWait (void)
void Sys_ClearPrintf (void)
double Sys_DoubleTime (void)
void Sys_EndWait (void)
void Sys_GetCursorPos (int *x, int *y)
void Sys_MarkMapModified (void)
void Sys_Printf (char *text,...)
void Sys_SetCursorPos (int x, int y)
void Sys_SetTitle (char *text)
void Sys_Status (const char *psz, int part)
void Sys_UpdateStatusBar (void)
void WINAPI Sys_UpdateWindows (int bits)
void TexMatToFakeTexCoords (vec_t texMat[2][3], float shift[2], float *rot, float scale[2])
qtexture_tTexture_LoadTGATexture (unsigned char *pPixels, int nWidth, int nHeight, char *pPath, int nFlags, int nContents, int nValue)
char * TranslateString (char *buf)
BOOL UpdateEntitySel (eclass_t *pec)
void Warning (char *error,...)
void WCam_Create (HINSTANCE hInstance)
BOOL CALLBACK Win_Dialog (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
bool within (vec3_t vTest, vec3_t vTL, vec3_t vBR)
void WXY_Create (HINSTANCE hInstance)
void WZ_Create (HINSTANCE hInstance)

Variables

int argc
char * argv [MAX_NUM_ARGVS]
HANDLE bsp_process
qboolean com_eof
char com_token [1024]
eclass_teclass_e
qboolean eclass_found
bool g_bPatchBendMode
bool g_bPatchDrillDown
bool g_bPatchInsertMode
bool g_bPatchShowBounds
bool g_bPatchWeld
bool g_bPatchWireFrame
bool g_bSameView
CStringArray g_BSPFrontendCommands
_QERPlugBSPFrontendTable g_BSPFrontendTable
FILEg_File
HANDLE g_hBSPInput
HANDLE g_hBSPOutput
int g_nPatchClickedView
QEGlobals_t g_qeglobals
_QERPlugSurfaceTable g_SurfaceTable
vec3_t g_vBendOrigin
int myargc
char ** myargv
qboolean parsing_single
int screen_height
int screen_width
int update_bits


Define Documentation

#define MAX_NUM_ARGVS   32
 

Definition at line 97 of file QE3.H.

#define myoffsetof type,
identifier   )     ((size_t)&((type *)0)->identifier)
 

Definition at line 74 of file QE3.H.

#define QERTYPES_USE_MFC
 

Definition at line 42 of file QE3.H.


Typedef Documentation

typedef struct group_s group_t
 

Referenced by Group_Add(), Group_AddToProperGroup(), Group_Alloc(), Group_ForName(), Group_Init(), Group_Save(), and CGroupDlg::OnBtnAdd().


Function Documentation

brush_t* AddBrushForPatch patchMesh_t pm,
bool  bLinkToWorld = true
 

Definition at line 542 of file PMESH.CPP.

References active_brushes, b, Brush_AddToList(), Brush_Build(), Brush_Create(), brush_s::brush_faces, brush_t, QEGlobals_t::d_texturewin, Entity_LinkBrush(), f, face_t, texdef_t::flags, g_qeglobals, j, face_s::next, Patch_CalcBounds(), pm, brush_s::pPatch, face_s::texdef, texturewin_t::texdef, vec3_t, and world_entity.

Referenced by CPlugInManager::CommitPatchHandleToMap(), Patch_BrushToMesh(), Patch_Duplicate(), Patch_FromTriangle(), Patch_GenericMesh(), and Patch_Parse().

00543 {
00544   // find the farthest points in x,y,z
00545   vec3_t vMin, vMax;
00546   Patch_CalcBounds(pm, vMin, vMax);
00547 
00548   for (int j = 0; j < 3; j++)
00549   {
00550     if (vMin[j] == vMax[j])
00551     {
00552       vMin[j] -= 4;
00553       vMax[j] += 4;
00554     }
00555   }
00556 
00557   brush_t *b = Brush_Create(vMin, vMax, &g_qeglobals.d_texturewin.texdef);
00558     face_t      *f;
00559     for (f=b->brush_faces ; f ; f=f->next) 
00560   {
00561         f->texdef.flags |= SURF_PATCH; 
00562     }
00563 
00564   // FIXME: this entire type of linkage needs to be fixed
00565   b->pPatch = pm;
00566   pm->pSymbiot = b;
00567   pm->bSelected = false;
00568   pm->bOverlay = false;
00569   pm->bDirty = true;
00570   pm->nListID = -1;
00571 
00572   if (bLinkToWorld)
00573   {
00574     Brush_AddToList (b, &active_brushes);
00575       Entity_LinkBrush (world_entity, b);
00576     Brush_Build(b);
00577   }
00578 
00579   return b;
00580 }

Here is the call graph for this function:

bool WINAPI AnyPatchesSelected  ) 
 

Definition at line 4068 of file PMESH.CPP.

References brush_t, g_ptrSelectedFaces, brush_s::next, brush_s::patchBrush, and selected_brushes.

Referenced by CMainFrame::OnSelectionDragvertecies(), and CXYWnd::ProduceSplitLists().

04069 {
04070   if (g_ptrSelectedFaces.GetSize() > 0  || selected_brushes.next == &selected_brushes)
04071     return false;
04072     for (brush_t *pb = selected_brushes.next ; pb != &selected_brushes ; pb = pb->next)
04073     {
04074     if (pb->patchBrush)
04075     {
04076       return true;
04077     }
04078   }
04079   return false;
04080 }

void Brush_RebuildBrush brush_t b,
vec3_t  vMins,
vec3_t  vMaxs
 

Definition at line 419 of file PMESH.CPP.

References b, Brush_Build(), brush_s::brush_faces, brush_t, texdef_t::contents, Error(), f, Face_Alloc(), Face_Free(), face_t, texdef_t::flags, i, j, face_s::next, next, brush_s::patchBrush, face_s::planepts, face_s::texdef, vec3_t, and VectorCopy.

Referenced by GenerateEndCaps(), Patch_AddRow(), Patch_AdjustSelected(), Patch_ApplyMatrix(), Patch_Rebuild(), Patch_Scale(), Patch_Thicken(), Patch_UpdateSelected(), Select_SnapToGrid(), Terrain_Scale(), and Terrain_UpdateSelected().

00420 {
00421   //
00422   // Total hack job 
00423   // Rebuilds a brush
00424     int     i, j;
00425     face_t  *f, *next;
00426     vec3_t  pts[4][2];
00427   texdef_t  texdef;
00428     // free faces
00429 
00430   for (j = 0; j < 3; j++)
00431   {
00432     if ((int)vMins[j] == (int)vMaxs[j])
00433     {
00434       vMins[j] -= 4;
00435       vMaxs[j] += 4;
00436     }
00437   }
00438 
00439   
00440   for (f=b->brush_faces ; f ; f=next)
00441     {
00442         next = f->next;
00443     if (f)
00444       texdef = f->texdef;
00445     Face_Free( f );
00446     }
00447 
00448   b->brush_faces = NULL;
00449 
00450   // left the last face so we can use its texdef
00451 
00452     for (i=0 ; i<3 ; i++)
00453         if (vMaxs[i] < vMins[i])
00454             Error ("Brush_RebuildBrush: backwards");
00455 
00456     pts[0][0][0] = vMins[0];
00457     pts[0][0][1] = vMins[1];
00458     
00459     pts[1][0][0] = vMins[0];
00460     pts[1][0][1] = vMaxs[1];
00461     
00462     pts[2][0][0] = vMaxs[0];
00463     pts[2][0][1] = vMaxs[1];
00464     
00465     pts[3][0][0] = vMaxs[0];
00466     pts[3][0][1] = vMins[1];
00467     
00468     for (i=0 ; i<4 ; i++)
00469     {
00470         pts[i][0][2] = vMins[2];
00471         pts[i][1][0] = pts[i][0][0];
00472         pts[i][1][1] = pts[i][0][1];
00473         pts[i][1][2] = vMaxs[2];
00474     }
00475 
00476     for (i=0 ; i<4 ; i++)
00477     {
00478         f = Face_Alloc();
00479         f->texdef = texdef;
00480         f->texdef.flags &= ~SURF_KEEP;
00481         f->texdef.contents &= ~CONTENTS_KEEP;
00482         if ( b->patchBrush )
00483         {
00484             f->texdef.flags |= SURF_PATCH; 
00485         }
00486         f->next = b->brush_faces;
00487         b->brush_faces = f;
00488         j = (i+1)%4;
00489 
00490         VectorCopy (pts[j][1], f->planepts[0]);
00491         VectorCopy (pts[i][1], f->planepts[1]);
00492         VectorCopy (pts[i][0], f->planepts[2]);
00493     }
00494     
00495     f = Face_Alloc();
00496     f->texdef = texdef;
00497     f->texdef.flags &= ~SURF_KEEP;
00498     f->texdef.contents &= ~CONTENTS_KEEP;
00499     if ( b->patchBrush )
00500     {
00501         f->texdef.flags |= SURF_PATCH; 
00502     }
00503     f->next = b->brush_faces;
00504     b->brush_faces = f;
00505 
00506     VectorCopy (pts[0][1], f->planepts[0]);
00507     VectorCopy (pts[1][1], f->planepts[1]);
00508     VectorCopy (pts[2][1], f->planepts[2]);
00509 
00510     f = Face_Alloc();
00511     f->texdef = texdef;
00512     f->texdef.flags &= ~SURF_KEEP;
00513     f->texdef.contents &= ~CONTENTS_KEEP;
00514     if ( b->patchBrush )
00515     {
00516         f->texdef.flags |= SURF_PATCH; 
00517     }
00518     f->next = b->brush_faces;
00519     b->brush_faces = f;
00520 
00521     VectorCopy (pts[2][0], f->planepts[0]);
00522     VectorCopy (pts[1][0], f->planepts[1]);
00523     VectorCopy (pts[0][0], f->planepts[2]);
00524 
00525   Brush_Build(b);
00526 }

Here is the call graph for this function:

void BrushPrimit_Parse brush_t  ) 
 

Definition at line 150 of file brush_primit.cpp.

References atof(), atoi, b, brush_s::brush_faces, brush_t, face_s::brushprimit_texdef, texdef_t::contents, brushprimit_texdef_s::coords, epair_t, brush_s::epairs, f, Face_Alloc(), face_t, texdef_t::flags, GetToken(), i, j, face_s::next, epair_s::next, ParseEpair(), face_s::planepts, texdef_t::SetName(), strcmp(), face_s::texdef, TokenAvailable(), texdef_t::value, and Warning().

Referenced by Brush_Parse().

00151 {
00152     epair_t     *ep;
00153     face_t      *f;
00154     int         i,j;
00155     GetToken (true);
00156     if (strcmp (token, "{"))
00157     {
00158         Warning ("parsing brush primitive");
00159         return;
00160     }
00161     do
00162     {
00163         if (!GetToken (true))
00164             break;
00165         if (!strcmp (token, "}") )
00166             break;
00167         // reading of b->epairs if any
00168         if (strcmp (token, "(") )
00169         {
00170             ep = ParseEpair();
00171             ep->next = b->epairs;
00172             b->epairs = ep;
00173         }
00174         else
00175         // it's a face
00176         {
00177             f = Face_Alloc();
00178             f->next = NULL;
00179             if (!b->brush_faces)
00180                 b->brush_faces = f;
00181             else
00182             {
00183                 face_t *scan;
00184                 for (scan=b->brush_faces ; scan->next ; scan=scan->next)
00185                     ;
00186                 scan->next = f;
00187             }
00188 
00189             // read the three point plane definition
00190             for (i=0 ; i<3 ; i++)
00191             {
00192                 if (i != 0)
00193                     GetToken (true);
00194                 if (strcmp (token, "(") )
00195                 {
00196                     Warning ("parsing brush");
00197                     return;
00198                 }
00199                 for (j=0 ; j<3 ; j++)
00200                 {
00201                     GetToken (false);
00202                     f->planepts[i][j] = atof(token);
00203                 }
00204                 GetToken (false);
00205                 if (strcmp (token, ")") )
00206                 {
00207                     Warning ("parsing brush");
00208                     return;
00209                 }
00210             }
00211             // texture coordinates
00212             GetToken (false);
00213             if (strcmp(token, "("))
00214             {
00215                 Warning ("parsing brush primitive");
00216                 return;
00217             }
00218             GetToken (false);
00219             if (strcmp(token, "("))
00220             {
00221                 Warning ("parsing brush primitive");
00222                 return;
00223             }
00224             for (j=0;j<3;j++)
00225             {
00226                 GetToken(false);
00227                 f->brushprimit_texdef.coords[0][j]=atof(token);
00228             }
00229             GetToken (false);
00230             if (strcmp(token, ")"))
00231             {
00232                 Warning ("parsing brush primitive");
00233                 return;
00234             }
00235             GetToken (false);
00236             if (strcmp(token, "("))
00237             {
00238                 Warning ("parsing brush primitive");
00239                 return;
00240             }
00241             for (j=0;j<3;j++)
00242             {
00243                 GetToken(false);
00244                 f->brushprimit_texdef.coords[1][j]=atof(token);
00245             }
00246             GetToken (false);
00247             if (strcmp(token, ")"))
00248             {
00249                 Warning ("parsing brush primitive");
00250                 return;
00251             }
00252             GetToken (false);
00253             if (strcmp(token, ")"))
00254             {
00255                 Warning ("parsing brush primitive");
00256                 return;
00257             }
00258             // read the texturedef
00259             GetToken (false);
00260             //strcpy(f->texdef.name, token);
00261             f->texdef.SetName(token);
00262             if (TokenAvailable ())
00263             {
00264                 GetToken (false);
00265                 f->texdef.contents = atoi(token);
00266         GetToken (false);
00267                 f->texdef.flags = atoi(token);
00268                 GetToken (false);
00269                 f->texdef.value = atoi(token);
00270             }
00271         }
00272     } while (1);
00273 }

Here is the call graph for this function:

void BuildGammaTable float  g  ) 
 

int CheckParm char *  check  ) 
 

Definition at line 595 of file l_cmd.c.

References argv, check(), i, myargv, and Q_strcasecmp().

00596 {
00597     int             i;
00598 
00599     for (i = 1;i<myargc;i++)
00600     {
00601         if ( !Q_strcasecmp(check, myargv[i]) )
00602             return i;
00603     }
00604 
00605     return 0;
00606 }

Here is the call graph for this function:

char* COM_Parse char *  data  ) 
 

Definition at line 438 of file l_cmd.c.

References c, com_eof, com_token, and data.

Referenced by CG_NewParticleArea(), CG_ParseAnimationFile(), CG_StartMusic(), COM_MatchToken(), Eclass_InitFromText(), G_ParseInfos(), Parse1DMatrix(), R_GetEntityToken(), SV_GameSystemCalls(), UI_ParseAnimationFile(), UI_ParseInfos(), and VM_LoadSymbols().

00439 {
00440     int     c;
00441     int     len;
00442     
00443     len = 0;
00444     com_token[0] = 0;
00445     
00446     if (!data)
00447         return NULL;
00448         
00449 // skip whitespace
00450 skipwhite:
00451     while ( (c = *data) <= ' ')
00452     {
00453         if (c == 0)
00454         {
00455             com_eof = true;
00456             return NULL;            // end of file;
00457         }
00458         data++;
00459     }
00460     
00461 // skip // comments
00462     if (c=='/' && data[1] == '/')
00463     {
00464         while (*data && *data != '\n')
00465             data++;
00466         goto skipwhite;
00467     }
00468     
00469 
00470 // handle quoted strings specially
00471     if (c == '\"')
00472     {
00473         data++;
00474         do
00475         {
00476             c = *data++;
00477             if (c=='\"')
00478             {
00479                 com_token[len] = 0;
00480                 return data;
00481             }
00482             com_token[len] = c;
00483             len++;
00484         } while (1);
00485     }
00486 
00487 // parse single characters
00488     if (c=='{' || c=='}'|| c==')'|| c=='(' || c=='\'' || c==':')
00489     {
00490         com_token[len] = c;
00491         len++;
00492         com_token[len] = 0;
00493         return data+1;
00494     }
00495 
00496 // parse a regular word
00497     do
00498     {
00499         com_token[len] = c;
00500         data++;
00501         len++;
00502         c = *data;
00503     if (c=='{' || c=='}'|| c==')'|| c=='(' || c=='\'' || c==':')
00504             break;
00505     } while (c>32);
00506     
00507     com_token[len] = 0;
00508     return data;
00509 }

void ComputeAxisBase vec3_t  normal,
vec3_t  texS,
vec3_t  texT
 

Definition at line 31 of file brush_primit.c.

References atan2(), cos(), e, fabs(), sin(), sqrt(), and vec_t.

Referenced by ChopFaceByBrush(), DrawSurfaceForSide(), EmitBrushPrimitTextureCoordinates(), Face_MoveTexture_BrushPrimit(), FaceToBrushPrimitFace(), RotateFaceTexture_BrushPrimit(), Select_ShiftTexture_BrushPrimit(), and CCamWnd::ShiftTexture_BrushPrimit().

00032 {
00033     vec_t RotY,RotZ;
00034     // do some cleaning
00035     if (fabs(normal[0])<1e-6)
00036         normal[0]=0.0f;
00037     if (fabs(normal[1])<1e-6)
00038         normal[1]=0.0f;
00039     if (fabs(normal[2])<1e-6)
00040         normal[2]=0.0f;
00041     // compute the two rotations around Y and Z to rotate X to normal
00042     RotY=-atan2(normal[2],sqrt(normal[1]*normal[1]+normal[0]*normal[0]));
00043     RotZ=atan2(normal[1],normal[0]);
00044     // rotate (0,1,0) and (0,0,1) to compute texX and texY
00045     texX[0]=-sin(RotZ);
00046     texX[1]=cos(RotZ);
00047     texX[2]=0;
00048     // the texY vector is along -Z ( T texture coorinates axis )
00049     texY[0]=-sin(RotY)*cos(RotZ);
00050     texY[1]=-sin(RotY)*sin(RotZ);
00051     texY[2]=-cos(RotY);
00052 }

Here is the call graph for this function:

void ComputeBest2DVector vec3_t  v,
vec3_t  X,
vec3_t  Y,
int &  x,
int &  y
 

Definition at line 440 of file brush_primit.cpp.

References DotProduct, fabs(), v, x, X, y, and Y.

Referenced by CCamWnd::ShiftTexture_BrushPrimit().

00441 {
00442     double sx,sy;
00443     sx = DotProduct( v, X );
00444     sy = DotProduct( v, Y );
00445     if ( fabs(sy) > fabs(sx) )
00446     {
00447         x = 0;
00448         if ( sy > 0.0 )
00449             y =  1;
00450         else
00451             y = -1;
00452     }
00453     else
00454     {
00455         y = 0;
00456         if ( sx > 0.0 )
00457             x =  1;
00458         else
00459             x = -1;
00460     }
00461 }

Here is the call graph for this function:

void ConnectEntities void   ) 
 

Definition at line 359 of file QE3.CPP.

References atoi, QEGlobals_t::d_select_count, QEGlobals_t::d_select_order, e, entities, g_qeglobals, brush_s::owner, Select_Brush(), Select_Deselect(), SetKeyValue(), sprintf(), strcpy(), Sys_Beep(), Sys_Status(), Sys_UpdateWindows(), ValueForKey(), W_CAMERA, W_XY, and world_entity.

Referenced by CreateSmartEntity(), FinishSmartCreation(), and CMainFrame::OnSelectionConnect().

00360 {
00361     entity_t    *e1, *e2, *e;
00362     char        *target, *tn;
00363     int         maxtarg, targetnum;
00364     char        newtarg[32];
00365 
00366     if (g_qeglobals.d_select_count != 2)
00367     {
00368         Sys_Status ("Must have two brushes selected.", 0);
00369         Sys_Beep ();
00370         return;
00371     }
00372 
00373     e1 = g_qeglobals.d_select_order[0]->owner;
00374     e2 = g_qeglobals.d_select_order[1]->owner;
00375 
00376     if (e1 == world_entity || e2 == world_entity)
00377     {
00378         Sys_Status ("Can't connect to the world.", 0);
00379         Sys_Beep ();
00380         return;
00381     }
00382 
00383     if (e1 == e2)
00384     {
00385         Sys_Status ("Brushes are from same entity.", 0);
00386         Sys_Beep ();
00387         return;
00388     }
00389 
00390     target = ValueForKey (e1, "target");
00391     if (target && target[0])
00392         strcpy (newtarg, target);
00393     else
00394     {
00395         target = ValueForKey (e2, "targetname");
00396         if (target && target[0])
00397             strcpy (newtarg, target);
00398         else
00399         {
00400             // make a unique target value
00401             maxtarg = 0;
00402             for (e=entities.next ; e != &entities ; e=e->next)
00403             {
00404                 tn = ValueForKey (e, "targetname");
00405                 if (tn && tn[0])
00406                 {
00407                     targetnum = atoi(tn+1);
00408                     if (targetnum > maxtarg)
00409                         maxtarg = targetnum;
00410                 }
00411             }
00412             sprintf (newtarg, "t%i", maxtarg+1);
00413         }
00414     }
00415 
00416     SetKeyValue (e1, "target", newtarg);
00417     SetKeyValue (e2, "targetname", newtarg);
00418     Sys_UpdateWindows (W_XY | W_CAMERA);
00419 
00420     Select_Deselect();
00421     Select_Brush (g_qeglobals.d_select_order[1]);
00422 }

Here is the call graph for this function:

void ConvertTexMatWithQTexture brushprimit_texdef_t texMat1,
qtexture_t qtex1,
brushprimit_texdef_t texMat2,
qtexture_t qtex2
 

Definition at line 324 of file brush_primit.cpp.

References brushprimit_texdef_t, brushprimit_texdef_s::coords, qtexture_s::height, qtexture_t, and qtexture_s::width.

Referenced by Drag_Begin(), EmitBrushPrimitTextureCoordinates(), CSurfaceDlg::GetTexMods(), Select_Ray(), Select_RotateTexture(), Select_ScaleTexture(), SetFaceTexdef(), CSurfaceDlg::SetTexMods(), and CSurfaceDlg::UpdateSpinners().

00325 {
00326     float s1,s2;
00327     s1 = ( qtex1 ? static_cast<float>( qtex1->width ) : 2.0f ) / ( qtex2 ? static_cast<float>( qtex2->width ) : 2.0f );
00328     s2 = ( qtex1 ? static_cast<float>( qtex1->height ) : 2.0f ) / ( qtex2 ? static_cast<float>( qtex2->height ) : 2.0f );
00329     texMat2->coords[0][0]=s1*texMat1->coords[0][0];
00330     texMat2->coords[0][1]=s1*texMat1->coords[0][1];
00331     texMat2->coords[0][2]=s1*texMat1->coords[0][2];
00332     texMat2->coords[1][0]=s2*texMat1->coords[1][0];
00333     texMat2->coords[1][1]=s2*texMat1->coords[1][1];
00334     texMat2->coords[1][2]=s2*texMat1->coords[1][2];
00335 }

char* copystring char *  s  ) 
 

Definition at line 347 of file l_cmd.c.

References b, GetMemory(), malloc(), s, strcpy(), and strlen().

Referenced by Entity_Clone(), Entity_CopyClone(), LoadShader(), ParseEpair(), and SetKeyValue().

00348 {
00349     char    *b;
00350     b = GetMemory(strlen(s)+1);
00351     strcpy (b, s);
00352     return b;
00353 }

Here is the call graph for this function:

BOOL CreateEntityWindow HINSTANCE  hInstance  ) 
 

Definition at line 383 of file Win_ent.cpp.

References BOOL, QEGlobals_t::d_hwndEntity, QEGlobals_t::d_hwndMain, EntityListWndProc(), EntKeyField, EntList, EntValueField, Error(), FieldWndProc(), FillClassList(), g_qeglobals, GetEntityControls(), hwndEnt, IDD_ENTITY, inspector_mode, LoadWindowPlacement(), NULL, SetInspectorMode(), W_CONSOLE, and WEnt_Create().

Referenced by CMainFrame::OnCreateClient().

00384 {
00385     HWND hwndEntityPalette;
00386 
00387     inspector_mode = W_ENTITY;
00388 
00389     WEnt_Create (hInstance);
00390 
00391     hwndEntityPalette = CreateDialog(hInstance, (char *)IDD_ENTITY, g_qeglobals.d_hwndMain, (DLGPROC)NULL);
00392     if (!hwndEntityPalette)
00393         Error ("CreateDialog failed");
00394 
00395     GetEntityControls (hwndEntityPalette);
00396     DestroyWindow (hwndEntityPalette);
00397 
00398     OldFieldWindowProc = (WNDPROC)GetWindowLong (hwndEnt[EntKeyField], GWL_WNDPROC);
00399     SetWindowLong (hwndEnt[EntKeyField], GWL_WNDPROC, (long)FieldWndProc);
00400     SetWindowLong (hwndEnt[EntValueField], GWL_WNDPROC, (long)FieldWndProc);
00401 
00402     OldEntityListWindowProc = (WNDPROC)GetWindowLong (hwndEnt[EntList], GWL_WNDPROC);
00403     SetWindowLong (hwndEnt[EntList], GWL_WNDPROC, (long)EntityListWndProc);
00404 
00405     FillClassList ();
00406 
00407 
00408     LoadWindowPlacement(g_qeglobals.d_hwndEntity, "EntityWindowPlace");
00409     ShowWindow (g_qeglobals.d_hwndEntity, SW_HIDE);
00410     SetInspectorMode (W_CONSOLE);
00411 
00412     return TRUE;
00413 }

Here is the call graph for this function:

void CSG_MakeHollow void   ) 
 

Definition at line 45 of file CSG.CPP.

References b, Brush_AddToList(), brush_s::brush_faces, Brush_Free(), Brush_SplitBrushByFace(), brush_t, QEGlobals_t::d_gridsize, entity_s::eclass, f, face_t, eclass_s::fixedsize, g_qeglobals, brush_s::hiddenBrush, i, move(), face_s::next, next, brush_s::next, plane_t::normal, brush_s::owner, brush_s::patchBrush, face_s::plane, face_s::planepts, selected_brushes, Sys_UpdateWindows(), brush_s::terrainBrush, vec3_t, VectorScale, VectorSubtract, and W_ALL.

Referenced by CMainFrame::OnSelectionMakehollow().

00046 {
00047     brush_t     *b, *front, *back, *next;
00048     face_t      *f;
00049     face_t      split;
00050     vec3_t      move;
00051     int         i;
00052 
00053     for (b = selected_brushes.next ; b != &selected_brushes ; b=next)
00054     {
00055         next = b->next;
00056 
00057     if (b->owner->eclass->fixedsize || b->patchBrush || b->terrainBrush || b->hiddenBrush)
00058           continue;
00059 
00060         for (f = b->brush_faces ; f ; f=f->next)
00061         {
00062             split = *f;
00063             VectorScale (f->plane.normal, g_qeglobals.d_gridsize, move);
00064             for (i=0 ; i<3 ; i++)
00065                 VectorSubtract (split.planepts[i], move, split.planepts[i]);
00066 
00067             Brush_SplitBrushByFace (b, &split, &front, &back);
00068             if (back)
00069                 Brush_Free (back);
00070             if (front)
00071                 Brush_AddToList (front, &selected_brushes);
00072         }
00073         Brush_Free (b);
00074     }
00075     Sys_UpdateWindows (W_ALL);
00076 }

Here is the call graph for this function:

void CSG_Merge void   ) 
 

Definition at line 591 of file CSG.CPP.

References b, qtexture_s::bFromShader, Brush_AddToList(), brush_s::brush_faces, Brush_Free(), Brush_MergeList(), Brush_RemoveFromList(), brush_t, face_s::d_texture, entity_s::eclass, eclass_s::fixedsize, next, brush_s::next, qtexture_s::nShaderFlags, brush_s::owner, brush_s::patchBrush, brush_s::prev, selected_brushes, Sys_Printf(), Sys_UpdateWindows(), brush_s::terrainBrush, and W_ALL.

Referenced by CMainFrame::OnSelectionCsgmerge().

00592 {
00593     brush_t *b, *next, *newlist, *newbrush;
00594     struct entity_s *owner;
00595 
00596     Sys_Printf ("Merging...\n");
00597 
00598     if (selected_brushes.next == &selected_brushes)
00599     {
00600         Sys_Printf("No brushes selected.\n");
00601         return;
00602     }
00603 
00604     if (selected_brushes.next->next == &selected_brushes)
00605     {
00606         Sys_Printf("At least two brushes have to be selected.\n");
00607         return;
00608     }
00609 
00610     owner = selected_brushes.next->owner;
00611 
00612     for (b = selected_brushes.next; b != &selected_brushes; b = next)
00613     {
00614         next = b->next;
00615 
00616         if (b->owner->eclass->fixedsize)
00617         {
00618             // can't use texture from a fixed entity, so don't subtract
00619             Sys_Printf("Cannot add fixed size entities.\n");
00620             return;
00621         }
00622 
00623         if (b->patchBrush)
00624         {
00625             Sys_Printf("Cannot add patches.\n");
00626             return;
00627         }
00628         if (b->terrainBrush)
00629         {
00630             Sys_Printf("Cannot add terrains.\n");
00631             return;
00632         }
00633 
00634         if (b->brush_faces->d_texture->bFromShader && (b->brush_faces->d_texture->nShaderFlags & QER_NOCARVE))
00635         {
00636             Sys_Printf("Cannot add brushes using shaders that don't allows CSG operations.\n");
00637             return;
00638         }
00639 
00640         if (b->owner != owner)
00641         {
00642             Sys_Printf("Cannot add brushes from different entities.\n");
00643             return;
00644         }
00645 
00646     }
00647 
00648     newlist = NULL;
00649     for (b = selected_brushes.next; b != &selected_brushes; b = next)
00650     {
00651         next = b->next;
00652 
00653         Brush_RemoveFromList(b);
00654         b->next = newlist;
00655         b->prev = NULL;
00656         newlist = b;
00657     }
00658 
00659     newbrush = Brush_MergeList(newlist, true);
00660     // if the new brush would not be convex
00661     if (!newbrush)
00662     {
00663         // add the brushes back into the selection
00664         for (b = newlist; b; b = next)
00665         {
00666             next = b->next;
00667             b->next = NULL;
00668             b->prev = NULL;
00669             Brush_AddToList(b, &selected_brushes);
00670         }
00671         Sys_Printf("Cannot add a set of brushes with a concave hull.\n");
00672         return;
00673     }
00674     // free the original brushes
00675     for (b = newlist; b; b = next)
00676     {
00677         next = b->next;
00678         b->next = NULL;
00679         b->prev = NULL;
00680         Brush_Free(b);
00681     }
00682     Brush_AddToList(newbrush, &selected_brushes);
00683 
00684     Sys_Printf ("done.\n");
00685     Sys_UpdateWindows (W_ALL);
00686 }

Here is the call graph for this function:

void CSG_Subtract void   ) 
 

Definition at line 466 of file CSG.CPP.

References active_brushes, b, qtexture_s::bFromShader, Brush_AddToList(), brush_s::brush_faces, Brush_Free(), Brush_MergeListPairs(), Brush_RemoveFromList(), Brush_Subtract(), brush_t, face_s::d_texture, entity_s::eclass, eclass_s::fixedsize, brush_s::hiddenBrush, i, brush_s::maxs, brush_s::mins, next, brush_s::next, qtexture_s::nShaderFlags, numbrushes, ON_EPSILON, brush_s::owner, brush_s::patchBrush, brush_s::prev, s, selected_brushes, Sys_Printf(), Sys_UpdateWindows(), brush_s::terrainBrush, Undo_AddBrush(), Undo_EndBrush(), and W_ALL.

Referenced by CMainFrame::OnSelectionCsgsubtract(), and Spherize().

00467 {
00468     brush_t     *b, *s, *fragments, *nextfragment, *frag, *next, *snext;
00469     brush_t     fragmentlist;
00470     int         i, numfragments, numbrushes;
00471 
00472     Sys_Printf ("Subtracting...\n");
00473 
00474     if (selected_brushes.next == &selected_brushes)
00475     {
00476         Sys_Printf("No brushes selected.\n");
00477         return;
00478     }
00479 
00480     fragmentlist.next = &fragmentlist;
00481     fragmentlist.prev = &fragmentlist;
00482 
00483     numfragments = 0;
00484     numbrushes = 0;
00485     for (b = selected_brushes.next ; b != &selected_brushes ; b=next)
00486     {
00487         next = b->next;
00488 
00489         if (b->owner->eclass->fixedsize)
00490             continue;   // can't use texture from a fixed entity, so don't subtract
00491 
00492         // chop all fragments further up
00493         for (s = fragmentlist.next; s != &fragmentlist; s = snext)
00494         {
00495             snext = s->next;
00496 
00497             for (i=0 ; i<3 ; i++)
00498                 if (b->mins[i] >= s->maxs[i] - ON_EPSILON 
00499                 || b->maxs[i] <= s->mins[i] + ON_EPSILON)
00500                     break;
00501             if (i != 3)
00502                 continue;   // definately don't touch
00503             fragments = Brush_Subtract(s, b);
00504             // if the brushes did not really intersect
00505             if (fragments == s)
00506                 continue;
00507             // try to merge fragments
00508             fragments = Brush_MergeListPairs(fragments, true);
00509             // add the fragments to the list
00510             for (frag = fragments; frag; frag = nextfragment)
00511             {
00512                 nextfragment = frag->next;
00513                 frag->next = NULL;
00514                 frag->owner = s->owner;
00515                 Brush_AddToList(frag, &fragmentlist);
00516             }
00517             // free the original brush
00518             Brush_Free(s);
00519         }
00520 
00521         // chop any active brushes up
00522         for (s = active_brushes.next; s != &active_brushes; s = snext)
00523         {
00524             snext = s->next;
00525 
00526             if (s->owner->eclass->fixedsize || s->patchBrush || s->terrainBrush || s->hiddenBrush)
00527                 continue;
00528 
00529             //face_t *pFace = s->brush_faces;
00530             if (s->brush_faces->d_texture->bFromShader && (s->brush_faces->d_texture->nShaderFlags & QER_NOCARVE))
00531             {
00532                 continue;
00533             }
00534 
00535             for (i=0 ; i<3 ; i++)
00536                 if (b->mins[i] >= s->maxs[i] - ON_EPSILON 
00537                 || b->maxs[i] <= s->mins[i] + ON_EPSILON)
00538                     break;
00539             if (i != 3)
00540                 continue;   // definately don't touch
00541 
00542             fragments = Brush_Subtract(s, b);
00543             // if the brushes did not really intersect
00544             if (fragments == s)
00545                 continue;
00546             //
00547             Undo_AddBrush(s);
00548             // one extra brush chopped up
00549             numbrushes++;
00550             // try to merge fragments
00551             fragments = Brush_MergeListPairs(fragments, true);
00552             // add the fragments to the list
00553             for (frag = fragments; frag; frag = nextfragment)
00554             {
00555                 nextfragment = frag->next;
00556                 frag->next = NULL;
00557                 frag->owner = s->owner;
00558                 Brush_AddToList(frag, &fragmentlist);
00559             }
00560             // free the original brush
00561             Brush_Free(s);
00562         }
00563     }
00564 
00565     // move all fragments to the active brush list
00566     for (frag = fragmentlist.next; frag != &fragmentlist; frag = nextfragment)
00567     {
00568         nextfragment = frag->next;
00569         numfragments++;
00570         Brush_RemoveFromList(frag);
00571         Brush_AddToList(frag, &active_brushes);
00572         Undo_EndBrush(frag);
00573     }
00574 
00575     if (numfragments == 0)
00576     {
00577         Sys_Printf("Selected brush%s did not intersect with any other brushes.\n",
00578                     (selected_brushes.next->next == &selected_brushes) ? "":"es");
00579         return;
00580     }
00581     Sys_Printf("done. (created %d fragment%s out of %d brush%s)\n", numfragments, (numfragments == 1)?"":"s",
00582                             numbrushes, (numbrushes == 1)?"":"es");
00583     Sys_UpdateWindows(W_ALL);
00584 }

Here is the call graph for this function:

void Curve_AddFakePlanes brush_t B  ) 
 

Definition at line 55 of file cbrushstub.cpp.

References brush_t.

00056 {
00057 }

void Curve_BuildPoints brush_t b  ) 
 

Definition at line 35 of file cbrushstub.cpp.

References brush_t.

00036 {
00037 }

void Curve_CameraDraw brush_t b  ) 
 

Definition at line 39 of file cbrushstub.cpp.

References brush_t.

00040 {
00041 }

void Curve_Invert void   ) 
 

Definition at line 25 of file cbrushstub.cpp.

00026 {
00027 }

void Curve_MakeCurvedBrush qboolean  negative,
qboolean  top,
qboolean  bottom,
qboolean  s1,
qboolean  s2,
qboolean  s3,
qboolean  s4
 

Definition at line 29 of file cbrushstub.cpp.

00031 {
00032 }

void Curve_StripFakePlanes brush_t B  ) 
 

Definition at line 51 of file cbrushstub.cpp.

References brush_t.

00052 {
00053 }

void Curve_WriteFile char *  name  ) 
 

Definition at line 47 of file cbrushstub.cpp.

00048 {
00049 }

void Curve_XYDraw brush_t b  ) 
 

Definition at line 43 of file cbrushstub.cpp.

References brush_t.

00044 {
00045 }

bool DispatchOnLButtonDown UINT  nFlags,
int  x,
int  y
 

Definition at line 71 of file Messaging.cpp.

References i, l_WindowListeners, x, and y.

Referenced by CXYWnd::OnLButtonDown().

00072 {
00073     for( int i = 0; i < l_WindowListeners.GetSize(); i++ )
00074         if (static_cast<IWindowListener*>(l_WindowListeners.GetAt(i))->OnLButtonDown( nFlags, x, y ))
00075             return true;
00076     return false;
00077 }

bool DispatchOnLButtonUp UINT  nFlags,
int  x,
int  y
 

Definition at line 79 of file Messaging.cpp.

References i, l_WindowListeners, x, and y.

Referenced by CXYWnd::OnLButtonUp().

00080 {
00081     for( int i = 0; i < l_WindowListeners.GetSize(); i++ )
00082         if (static_cast<IWindowListener*>(l_WindowListeners.GetAt(i))->OnLButtonUp( nFlags, x, y ))
00083             return true;
00084     return false;
00085 }

void DispatchOnMouseMove UINT  nFlags,
int  x,
int  y
 

Definition at line 65 of file Messaging.cpp.

References i, l_WindowListeners, IWindowListener::OnMouseMove(), x, and y.

Referenced by CXYWnd::OnMouseMove().

00066 {
00067     for( int i = 0; i < l_WindowListeners.GetSize(); i++ )
00068         static_cast<IWindowListener*>(l_WindowListeners.GetAt(i))->OnMouseMove( nFlags, x, y );
00069 }

Here is the call graph for this function:

void DispatchRadiantMsg int  Msg  ) 
 

Definition at line 114 of file Messaging.cpp.

References IListener::DispatchRadiantMsg(), i, l_Listeners, Msg, and Sys_Printf().

Referenced by Brush_AddToList(), and Texture_SetTexture().

00115 {
00116 #ifdef _DEBUG
00117     if (Msg >= RADIANT_MSGCOUNT)
00118     {
00119         Sys_Printf("ERROR: bad index in DispatchRadiantMsg\n");
00120         return;
00121     }
00122 #endif
00123     for(int i = 0; i<l_Listeners[Msg].GetSize(); i++)
00124         static_cast<IListener *>(l_Listeners[Msg].GetAt(i))->DispatchRadiantMsg(Msg);
00125 }

Here is the call graph for this function:

void DoAbout void   ) 
 

Definition at line 611 of file WIN_DLG.CPP.

References AboutDlgProc(), QEGlobals_t::d_hInstance, QEGlobals_t::d_hwndMain, g_qeglobals, and IDD_ABOUT.

Referenced by CMainFrame::OnHelpAbout().

00612 {
00613     DialogBox( g_qeglobals.d_hInstance, ( char * ) IDD_ABOUT, g_qeglobals.d_hwndMain, AboutDlgProc );
00614 }

Here is the call graph for this function:

void DoFind void   ) 
 

Definition at line 433 of file WIN_DLG.CPP.

References QEGlobals_t::d_hInstance, QEGlobals_t::d_hwndMain, FindBrushDlgProc(), g_qeglobals, and IDD_FINDBRUSH.

Referenced by CMainFrame::OnMiscFindbrush().

00434 {
00435     DialogBox(g_qeglobals.d_hInstance, (char *)IDD_FINDBRUSH, g_qeglobals.d_hwndMain, FindBrushDlgProc);
00436 }   

Here is the call graph for this function:

void DoGamma void   ) 
 

Definition at line 287 of file WIN_DLG.CPP.

References QEGlobals_t::d_hInstance, QEGlobals_t::d_hwndMain, g_qeglobals, GammaDlgProc(), and IDD_GAMMA.

Referenced by CMainFrame::OnMiscGamma().

00288 {
00289     if ( DialogBox(g_qeglobals.d_hInstance, (char *)IDD_GAMMA, g_qeglobals.d_hwndMain, GammaDlgProc))
00290     {
00291     }
00292 }       

Here is the call graph for this function:

void DoRotate void   ) 
 

Definition at line 499 of file WIN_DLG.CPP.

References QEGlobals_t::d_hInstance, QEGlobals_t::d_hwndMain, g_qeglobals, IDD_ROTATE, and RotateDlgProc().

00500 {
00501     DialogBox(g_qeglobals.d_hInstance, (char *)IDD_ROTATE, g_qeglobals.d_hwndMain, RotateDlgProc);
00502 }

Here is the call graph for this function:

void DoSides bool  bCone = false,
bool  bSphere = false,
bool  bTorus = false
 

Definition at line 556 of file WIN_DLG.CPP.

References QEGlobals_t::d_hInstance, QEGlobals_t::d_hwndMain, g_bDoCone, g_bDoSphere, g_qeglobals, IDD_SIDES, and SidesDlgProc().

Referenced by CMainFrame::OnBrushArbitrarysided(), CMainFrame::OnBrushMakecone(), and CMainFrame::OnBrushPrimitivesSphere().

00557 {
00558   g_bDoCone = bCone;
00559   g_bDoSphere = bSphere;
00560   //g_bDoTorus = bTorus;
00561     DialogBox(g_qeglobals.d_hInstance, (char *)IDD_SIDES, g_qeglobals.d_hwndMain, SidesDlgProc);
00562 }       

Here is the call graph for this function:

void DoSurface  ) 
 

Definition at line 703 of file SurfaceDlg.cpp.

References QEGlobals_t::bSurfacePropertiesPlugin, QEGlobals_t::d_texturewin, g_bGatewayhack, g_bNewApplyHandling, g_bNewFace, g_changed_surface, g_dlgSurface, g_patch_texdef, g_PrefsDlg, g_qeglobals, g_SurfaceTable, g_surfwin, IDD_SURFACE, LoadRegistryInfo(), LONG, CPrefsDlg::m_bFace, CPrefsDlg::m_bGatewayHack, CPrefsDlg::m_bNewApplyHandling, CPrefsDlg::m_nRotation, _QERPlugSurfaceTable::m_pfnDoSurface, NULL, texdef_t::rotate, texdef_t::scale, CSurfaceDlg::SetTexMods(), texdef_t::shift, Sys_UpdateWindows(), texturewin_t::texdef, and W_ALL.

Referenced by CMainFrame::OnTexturesInspector().

00704 {
00705     // surface properties plugin ?
00706     if (g_qeglobals.bSurfacePropertiesPlugin)
00707     {
00708         g_SurfaceTable.m_pfnDoSurface();
00709         return;
00710     }
00711 
00712   g_bNewFace = g_PrefsDlg.m_bFace;
00713   g_bNewApplyHandling = g_PrefsDlg.m_bNewApplyHandling;
00714   g_bGatewayhack = g_PrefsDlg.m_bGatewayHack;
00715     // save current state for cancel
00716     g_old_texdef = g_qeglobals.d_texturewin.texdef;
00717     g_changed_surface = false;
00718 
00719   if (g_surfwin == NULL && g_dlgSurface.GetSafeHwnd() == NULL)
00720   {
00721     g_patch_texdef.scale[0] = 0.05;
00722     g_patch_texdef.scale[1] = 0.05;
00723     g_patch_texdef.shift[0] = 0.05;
00724     g_patch_texdef.shift[1] = 0.05;
00725     // use rotation increment from preferences
00726     g_patch_texdef.rotate = g_PrefsDlg.m_nRotation;
00727 
00728     g_dlgSurface.Create(IDD_SURFACE);
00729     CRect rct;
00730       LONG lSize = sizeof(rct);
00731       if (LoadRegistryInfo("Radiant::SurfaceWindow", &rct, &lSize))
00732       g_dlgSurface.SetWindowPos(NULL, rct.left, rct.top, 0,0, SWP_NOSIZE | SWP_SHOWWINDOW);
00733 
00734     Sys_UpdateWindows(W_ALL);
00735   }
00736   else
00737   {
00738     g_surfwin = g_dlgSurface.GetSafeHwnd();
00739       g_dlgSurface.SetTexMods ();
00740     g_dlgSurface.ShowWindow(SW_SHOW);
00741   }
00742 }       

Here is the call graph for this function:

void Drag_Begin int  x,
int  y,
int  buttons,
vec3_t  xaxis,
vec3_t  yaxis,
vec3_t  origin,
vec3_t  dir
 

Definition at line 351 of file DRAG.CPP.

References trace_t::brush, Brush_Build(), brush_s::brush_faces, Brush_SetTexture(), texturewin_t::brushprimit_texdef, face_s::brushprimit_texdef, brushprimit_texdef_t, qtexture_s::color, ConvertTexMatWithQTexture(), QEGlobals_t::d_new_brush_bottom_z, QEGlobals_t::d_new_brush_top_z, QEGlobals_t::d_select_mode, face_s::d_texture, QEGlobals_t::d_texturewin, drag_first, drag_ok, Drag_Setup(), entity_s::eclass, trace_t::face, g_PrefsDlg, g_qeglobals, GETPLUGINTEXDEF, i, CPrefsDlg::m_nMouseButtons, brush_s::maxs, brush_s::mins, texdef_t::name, eclass_s::nShowFlags, NULL, brush_s::owner, peLink, pressdelta, texturewin_t::pTexdef, qtexture_t, sel_curvepoint, sel_terrainpoint, Select_Deselect(), Select_Ray(), SetFaceTexdef(), SetKeyValue(), texdef_t::SetName(), SF_CYCLE, SF_ENTITIES_FIRST, SF_SINGLEFACE, Sys_Printf(), Sys_UpdateWindows(), t, Test_Ray(), texturewin_t::texdef, face_s::texdef, Texture_ForName(), Texture_SetTexture(), UpdatePatchInspector(), UpdateSurfaceDialog(), vec3_origin, vec3_t, VectorCopy, vPressStart, W_ALL, x, and y.

Referenced by CCamWnd::Cam_MouseDown(), CXYWnd::XY_MouseDown(), and Z_MouseDown().

00354 {
00355     trace_t t;
00356     bool altdown;
00357 
00358     drag_ok = false;
00359     VectorCopy (vec3_origin, pressdelta);
00360     VectorCopy (vec3_origin, vPressStart);
00361     drag_first = true;
00362     peLink = NULL;
00363 
00364     altdown = static_cast<bool>(::GetAsyncKeyState(VK_MENU));
00365 
00366     // shift-LBUTTON = select entire brush
00367     if (buttons == (MK_LBUTTON | MK_SHIFT) && g_qeglobals.d_select_mode != sel_curvepoint &&
00368         g_qeglobals.d_select_mode != sel_terrainpoint && g_qeglobals.d_select_mode != sel_terraintexture)
00369     {
00370         int nFlag = altdown ? SF_CYCLE : 0;
00371         if (dir[0] == 0 || dir[1] == 0 || dir[2] == 0)  // extremely low chance of this happening from camera
00372             Select_Ray (origin, dir, nFlag | SF_ENTITIES_FIRST);    // hack for XY
00373         else
00374             Select_Ray (origin, dir, nFlag);
00375         return;
00376     }
00377 
00378     // ctrl-alt-LBUTTON = multiple brush select without selecting whole entities
00379     if (buttons == (MK_LBUTTON | MK_CONTROL) && altdown && g_qeglobals.d_select_mode != sel_curvepoint &&
00380         g_qeglobals.d_select_mode != sel_terrainpoint && g_qeglobals.d_select_mode != sel_terraintexture)
00381     {
00382         if (dir[0] == 0 || dir[1] == 0 || dir[2] == 0)  // extremely low chance of this happening from camera
00383             Select_Ray (origin, dir, SF_ENTITIES_FIRST);    // hack for XY
00384         else
00385             Select_Ray (origin, dir, 0);
00386         return;
00387     }
00388 
00389     // ctrl-shift-LBUTTON = select single face
00390     if (buttons == (MK_LBUTTON | MK_CONTROL | MK_SHIFT) && g_qeglobals.d_select_mode != sel_curvepoint &&
00391         g_qeglobals.d_select_mode != sel_terrainpoint && g_qeglobals.d_select_mode != sel_terraintexture)
00392     {
00393         Select_Deselect (!static_cast<bool>(::GetAsyncKeyState(VK_MENU)));
00394         Select_Ray (origin, dir, SF_SINGLEFACE);
00395         return;
00396     }
00397 
00398 
00399     // LBUTTON + all other modifiers = manipulate selection
00400     if (buttons & MK_LBUTTON)
00401     {
00402         //
00403         Drag_Setup (x, y, buttons, xaxis, yaxis, origin, dir);
00404         return;
00405     }
00406 
00407     int nMouseButton = g_PrefsDlg.m_nMouseButtons == 2 ? MK_RBUTTON : MK_MBUTTON;
00408     // middle button = grab texture
00409     if (buttons == nMouseButton)
00410     {
00411         t = Test_Ray (origin, dir, false);
00412         if (t.face)
00413         {
00414             g_qeglobals.d_new_brush_bottom_z = t.brush->mins[2];
00415             g_qeglobals.d_new_brush_top_z = t.brush->maxs[2];
00416             // use a local brushprimit_texdef fitted to a default 2x2 texture
00417             brushprimit_texdef_t bp_local;
00418             ConvertTexMatWithQTexture( &t.face->brushprimit_texdef, t.face->d_texture, &bp_local, NULL );
00419             Texture_SetTexture ( &t.face->texdef, &bp_local, false, GETPLUGINTEXDEF(t.face));
00420             UpdateSurfaceDialog();
00421             UpdatePatchInspector();
00422         }
00423         else
00424             Sys_Printf ("Did not select a texture\n");
00425         return;
00426     }
00427 
00428     // ctrl-middle button = set entire brush to texture
00429     if (buttons == (nMouseButton|MK_CONTROL) )
00430     {
00431         t = Test_Ray (origin, dir, false);
00432         if (t.brush)
00433         {
00434             if (t.brush->brush_faces->texdef.name[0] == '(')
00435                 Sys_Printf ("Can't change an entity texture\n");
00436             else
00437             {
00438                 Brush_SetTexture (t.brush, &g_qeglobals.d_texturewin.texdef, &g_qeglobals.d_texturewin.brushprimit_texdef, false, static_cast<IPluginTexdef *>( g_qeglobals.d_texturewin.pTexdef ) );
00439                 Sys_UpdateWindows (W_ALL);
00440             }
00441         }
00442         else
00443             Sys_Printf ("Didn't hit a btrush\n");
00444         return;
00445     }
00446 
00447     // ctrl-shift-middle button = set single face to texture
00448     if (buttons == (nMouseButton|MK_SHIFT|MK_CONTROL) )
00449     {
00450         t = Test_Ray (origin, dir, false);
00451         if (t.brush)
00452         {
00453             if (t.brush->brush_faces->texdef.name[0] == '(')
00454                 Sys_Printf ("Can't change an entity texture\n");
00455             else
00456             {
00457                 SetFaceTexdef (t.brush, t.face, &g_qeglobals.d_texturewin.texdef, &g_qeglobals.d_texturewin.brushprimit_texdef);
00458                 Brush_Build( t.brush );
00459                 Sys_UpdateWindows (W_ALL);
00460             }
00461         }
00462         else
00463             Sys_Printf ("Didn't hit a btrush\n");
00464         return;
00465     }
00466 
00467     if (buttons == (nMouseButton | MK_SHIFT))
00468     {
00469         Sys_Printf("Set brush face texture info\n");
00470         t = Test_Ray (origin, dir, false);
00471         if (t.brush)
00472         {
00473             if (t.brush->brush_faces->texdef.name[0] == '(')
00474       {
00475         if (t.brush->owner->eclass->nShowFlags & ECLASS_LIGHT)
00476         {
00477           CString strBuff;
00478           qtexture_t* pTex = Texture_ForName(g_qeglobals.d_texturewin.texdef.name);
00479           if (pTex)
00480           {
00481             vec3_t vColor;
00482             VectorCopy(pTex->color, vColor);
00483 
00484             float fLargest = 0.0f;
00485             for (int i = 0; i < 3; i++)
00486             {
00487                   if (vColor[i] > fLargest)
00488                       fLargest = vColor[i];
00489             }
00490                 
00491                 if (fLargest == 0.0f)
00492                 {
00493               vColor[0] = vColor[1] = vColor[2] = 1.0f;
00494             }
00495                 else
00496                 {
00497                     float fScale = 1.0f / fLargest;
00498               for (int i = 0; i < 3; i++)
00499               {
00500                 vColor[i] *= fScale;
00501               }
00502             }
00503             strBuff.Format("%f %f %f",pTex->color[0], pTex->color[1], pTex->color[2]);
00504             SetKeyValue(t.brush->owner, "_color", strBuff.GetBuffer(0));
00505                     Sys_UpdateWindows (W_ALL);
00506           }
00507         }
00508         else
00509         {
00510                   Sys_Printf ("Can't select an entity brush face\n");
00511         }
00512       }
00513             else
00514             {
00515         //strcpy(t.face->texdef.name,g_qeglobals.d_texturewin.texdef.name);
00516         t.face->texdef.SetName(g_qeglobals.d_texturewin.texdef.name);
00517                 Brush_Build(t.brush);
00518                 Sys_UpdateWindows (W_ALL);
00519             }
00520         }
00521         else
00522             Sys_Printf ("Didn't hit a brush\n");
00523         return;
00524     }
00525 
00526 }

Here is the call graph for this function:

void Drag_MouseMoved int  x,
int  y,
int  buttons
 

Definition at line 751 of file DRAG.CPP.

References abs(), QEGlobals_t::d_gridsize, drag_first, drag_ok, drag_xvec, drag_yvec, floor(), g_PrefsDlg, g_qeglobals, i, CPrefsDlg::m_bNoClamp, move(), MoveSelection(), pressdelta, pressx, pressy, vec3_t, VectorCopy, VectorSubtract, x, and y.

Referenced by CCamWnd::Cam_MouseMoved(), CXYWnd::XY_MouseMoved(), and Z_MouseMoved().

00752 {
00753     vec3_t  move, delta;
00754     int     i;
00755 
00756     if (!buttons)
00757     {
00758         drag_ok = false;
00759         return;
00760     }
00761     if (!drag_ok)
00762         return;
00763 
00764     // clear along one axis
00765     if (buttons & MK_SHIFT)
00766     {
00767         drag_first = false;
00768         if (abs(x-pressx) > abs(y-pressy))
00769             y = pressy;
00770         else
00771             x = pressx;
00772     }
00773 
00774 
00775     for (i=0 ; i<3 ; i++)
00776     {
00777         move[i] = drag_xvec[i]*(x - pressx) + drag_yvec[i]*(y - pressy);
00778     if (!g_PrefsDlg.m_bNoClamp)
00779     {
00780           move[i] = floor(move[i]/g_qeglobals.d_gridsize+0.5)*g_qeglobals.d_gridsize;
00781     }
00782     }
00783 
00784     VectorSubtract (move, pressdelta, delta);
00785     VectorCopy (move, pressdelta);
00786 
00787   MoveSelection (delta);
00788 
00789 }

Here is the call graph for this function:

void Drag_MouseUp int  nButtons = 0  ) 
 

Definition at line 796 of file DRAG.CPP.

References QEGlobals_t::d_select_mode, QEGlobals_t::d_select_translate, g_pParentWnd, g_qeglobals, OnlyTerrainSelected(), Patch_SelectAreaPoints(), Select_Move(), selected_brushes, CMainFrame::SetStatusText(), Sys_Status(), Sys_UpdateWindows(), Terrain_SelectAreaPoints(), Undo_End(), Undo_EndBrushList(), vec3_origin, VectorCopy, W_ALL, and W_CAMERA.

Referenced by CCamWnd::Cam_MouseUp(), CXYWnd::XY_MouseUp(), and Z_MouseUp().

00797 {
00798     Sys_Status ("drag completed.", 0);
00799 
00800     if (g_qeglobals.d_select_mode == sel_area)
00801     {
00802         if ( OnlyTerrainSelected() )
00803             {
00804             Terrain_SelectAreaPoints();
00805             g_qeglobals.d_select_mode = sel_terrainpoint;
00806             Sys_UpdateWindows (W_ALL);
00807         }
00808         else
00809         {
00810             Patch_SelectAreaPoints();
00811             g_qeglobals.d_select_mode = sel_curvepoint;
00812             Sys_UpdateWindows (W_ALL);
00813         }
00814     }
00815     
00816     if (g_qeglobals.d_select_translate[0] || g_qeglobals.d_select_translate[1] || g_qeglobals.d_select_translate[2])
00817     {
00818         Select_Move (g_qeglobals.d_select_translate);
00819         VectorCopy (vec3_origin, g_qeglobals.d_select_translate);
00820         Sys_UpdateWindows (W_CAMERA);
00821     }
00822   
00823     g_pParentWnd->SetStatusText(3, "");
00824 
00825     //
00826     Undo_EndBrushList(&selected_brushes);
00827     Undo_End();
00828 }

Here is the call graph for this function:

void DrawPluginEntities VIEWTYPE  vt  ) 
 

Definition at line 89 of file GLInterface.cpp.

References IGLWindow::Draw(), i, and l_GLWindows.

Referenced by CXYWnd::XY_Draw().

00090 {
00091     for(int i = 0; i<l_GLWindows.GetSize(); i++ )
00092         static_cast<IGLWindow*>(l_GLWindows.GetAt(i))->Draw( vt );
00093 }

Here is the call graph for this function:

int DrawTexControls HWND  hWnd  ) 
 

void Eclass_ScanFile char *  filename  ) 
 

Definition at line 742 of file ECLASS.CPP.

References data, debugname, e, eclass_e, eclass_found, Eclass_InitFromText(), Eclass_InsertAlphabetized(), eclass_t, free(), i, j, LoadFile(), printf(), QE_ConvertDOSToUnixName(), strDefFile, strncmp(), and Sys_Printf().

Referenced by Eclass_InitForSourceDirectory(), QERApp_EClassScanDir(), and QERApp_ScanFileForEClass().

00743 {
00744     int     size;
00745     char    *data;
00746     eclass_t    *e;
00747     int     i;
00748     char    temp[1024];
00749     
00750     QE_ConvertDOSToUnixName( temp, filename );
00751     
00752     Sys_Printf ("ScanFile: %s\n", temp);
00753     
00754     // BUG
00755     size = LoadFile (filename, (void**)&data);
00756     eclass_found = false;
00757     for (i=0 ; i<size ; i++)
00758         if (!strncmp(data+i, "/*QUAKED",8))
00759         {
00760             
00761             //#ifdef BUILD_LIST
00762             if (g_bBuildList)
00763             {
00764                 CString strDef = "";
00765                 int j = i;
00766                 while (1)
00767                 {
00768                     strDef += *(data+j);
00769                     if (*(data+j) == '/' && *(data+j-1) == '*')
00770                         break;
00771                     j++;
00772                 }
00773                 strDef += "\r\n\r\n\r\n";
00774                 strDefFile += strDef;
00775             }
00776             //#endif
00777             e = Eclass_InitFromText (data+i);
00778             if (e)
00779                 Eclass_InsertAlphabetized (e);
00780             else
00781                 printf ("Error parsing: %s in %s\n",debugname, filename);
00782 
00783             // single ?
00784             eclass_e = e;
00785             eclass_found = true;
00786             if ( parsing_single )
00787                 break;
00788         }
00789         
00790         free (data);        
00791 }

Here is the call graph for this function:

void EmitBrushPrimitTextureCoordinates face_t ,
winding_t
 

Definition at line 110 of file brush_primit.cpp.

References QEGlobals_t::bNeedConvert, face_s::brushprimit_texdef, ComputeAxisBase(), ConvertTexMatWithQTexture(), brushprimit_texdef_s::coords, face_s::d_texture, DotProduct, e, f, fabs(), face_t, g_qeglobals, i, plane_t::normal, NULL, winding_t::numpoints, face_s::plane, winding_t::points, S, Sys_Printf(), T, vec3_t, vec_t, w, x, and y.

Referenced by Brush_BuildWindings(), and Brush_FullClone().

00111 {
00112     vec3_t texX,texY;
00113     vec_t x,y;
00114     // compute axis base
00115     ComputeAxisBase(f->plane.normal,texX,texY);
00116     // in case the texcoords matrix is empty, build a default one
00117     // same behaviour as if scale[0]==0 && scale[1]==0 in old code
00118     if (f->brushprimit_texdef.coords[0][0]==0 && f->brushprimit_texdef.coords[1][0]==0 && f->brushprimit_texdef.coords[0][1]==0 && f->brushprimit_texdef.coords[1][1]==0)
00119     {
00120         f->brushprimit_texdef.coords[0][0] = 1.0f;
00121         f->brushprimit_texdef.coords[1][1] = 1.0f;
00122         ConvertTexMatWithQTexture( &f->brushprimit_texdef, NULL, &f->brushprimit_texdef, f->d_texture );
00123     }
00124     int i;
00125     for (i=0 ; i<w->numpoints ; i++)
00126     {
00127         x=DotProduct(w->points[i],texX);
00128         y=DotProduct(w->points[i],texY);
00129 #ifdef _DEBUG
00130         if (g_qeglobals.bNeedConvert)
00131         {
00132             // check we compute the same ST as the traditional texture computation used before
00133             vec_t S=f->brushprimit_texdef.coords[0][0]*x+f->brushprimit_texdef.coords[0][1]*y+f->brushprimit_texdef.coords[0][2];
00134             vec_t T=f->brushprimit_texdef.coords[1][0]*x+f->brushprimit_texdef.coords[1][1]*y+f->brushprimit_texdef.coords[1][2];
00135             if ( fabs(S-w->points[i][3])>1e-2 || fabs(T-w->points[i][4])>1e-2 )
00136             {
00137                 if ( fabs(S-w->points[i][3])>1e-4 || fabs(T-w->points[i][4])>1e-4 )
00138                     Sys_Printf("Warning : precision loss in brush -> brush primitive texture computation\n");
00139                 else
00140                     Sys_Printf("Warning : brush -> brush primitive texture computation bug detected\n");
00141             }
00142         }
00143 #endif
00144         w->points[i][3]=f->brushprimit_texdef.coords[0][0]*x+f->brushprimit_texdef.coords[0][1]*y+f->brushprimit_texdef.coords[0][2];
00145         w->points[i][4]=f->brushprimit_texdef.coords[1][0]*x+f->brushprimit_texdef.coords[1][1]*y+f->brushprimit_texdef.coords[1][2];
00146     }
00147 }

Here is the call graph for this function:

void EmitTextureCoordinates float *  xyzst,
qtexture_t q,
face_t f
 

Definition at line 457 of file Brush.cpp.

References DotProduct, f, face_t, Face_TextureVectors(), and qtexture_t.

Referenced by Brush_BuildWindings(), Brush_FullClone(), FaceToBrushPrimitFace(), and Patch_CapTexture().

00458 {
00459     float   STfromXYZ[2][4];
00460 
00461     Face_TextureVectors (f,  STfromXYZ);
00462     xyzst[3] = DotProduct (xyzst, STfromXYZ[0]) + STfromXYZ[0][3];
00463     xyzst[4] = DotProduct (xyzst, STfromXYZ[1]) + STfromXYZ[1][3];
00464 }

Here is the call graph for this function:

void Error char *  error,
  ...
 

Definition at line 178 of file l_cmd.c.

References QEGlobals_t::d_hwndMain, err(), error(), exit(), g_PrefsDlg, g_qeglobals, i, CPrefsDlg::LoadPrefs(), Log_Close(), Log_Write(), printf(), qglGetError, sprintf(), va_end, va_list, va_start, and vsprintf().

Referenced by AAS_AddFaceSideToArea(), AAS_AddMapBrushSide(), AAS_CopyMapBrush(), AAS_Create(), AAS_CreateCurveBrushes(), AAS_Error(), AAS_FlipAreaFaces(), AAS_GetEdge(), AAS_GetFace(), AAS_GetPlane(), AAS_GetVertex(), AAS_MeltFaceWinding(), AAS_RemoveFaceFromArea(), AAS_SplitArea(), AAS_StoreArea(), AAS_StoreBoundingBoxes(), AAS_StoreTree_r(), AAS_TryMergeFaceAreas(), AAS_TryMergeFaces(), AddBrushBevels(), AddEdge(), AddPortalToNodes(), AddScriptToStack(), AddSeperators(), AddSideRef(), AddWindingPoint(), AllocateLightmapForPatch(), AllocateLightmapForSurface(), AllocateLightmaps(), AllocDrawSurf(), AllocShaderInfo(), AllocStackWinding(), ASE_GetCurrentMesh(), ASE_KeyGEOMOBJECT(), ASE_KeyMATERIAL_LIST(), ASE_KeyMESH(), ASE_KeyMESH_ANIMATION(), ASE_KeyMESH_FACE_LIST(), ASE_KeyMESH_TVERTLIST(), ASE_KeyMESH_VERTEX_LIST(), ASE_KeyTFACE_LIST(), ASE_Load(), ASE_ParseBracedBlock(), ASE_Process(), ASE_SkipEnclosingBraces(), BaseWindingForPlane(), BEGIN_MESSAGE_MAP(), BeginModel(), CCamWnd::BenchMark(), BMPEncodeLine(), BMPLine(), BMPLineNone(), BMPLineRLE4(), BMPLineRLE8(), Brush_AddToList(), Brush_Create(), Brush_CreatePyramid(), Brush_RebuildBrush(), Brush_RemoveFromList(), BuildTreeThread(), CalcPHS(), CalcTerrainSize(), CheckBspProcess(), CheckPlaneAgainstParents(), CheckStack(), CheckWinding(), ChopFaceByBrush(), ChopPatchByBrush(), ChopWindingInPlace(), ClipSidesIntoTree(), ClipToSeperators(), ClipWindingEpsilon(), ClusterMerge(), Com_Error(), CopyLump(), CountLightmaps(), CreateEntityWindow(), CreateFilters(), CreateNewFloatPlane(), CMainFrame::CreateQEChildren(), DrawSurfaceForSide(), EmitBrushes(), EmitDrawNode_r(), EmitFace(), EmitFaceVertexes(), EmitFlareSurf(), EmitLeaf(), EmitMarkFace(), EmitModelSurf(), EmitPatchSurf(), EmitPlanarSurf(), EmitPlanes(), EmitShader(), EndOfScript(), Entity_AddToList(), Entity_LinkBrush(), Entity_Parse(), Entity_RemoveFromList(), Entity_UnlinkBrush(), ExpandGamePath(), ExpandPath(), FindMiptex(), FindQuakeFilesInPak(), FindQuakeFilesInZip(), FindQuakeFilesWithPakFilter(), FixSurfaceJunctions(), FloodPortals_r(), FogDrawSurfs(), FreeStackWinding(), FreeWinding(), GetClearedMemory(), GetEdge2(), GetEntityControls(), GetMemory(), GetToken(), GetVertexnum(), GLS_BeginScene(), HashVec(), HL_BSPBrushToMapBrush(), HL_CopyLump(), HL_CreateBrushes_r(), HL_LoadBSPFile(), HL_UnparseEntities(), LBMRLEDecompress(), LeakFile(), Load256Image(), Load3DSTriangleList(), LoadAlphaMap(), LoadBMP(), LoadBSPFile(), LoadLBM(), LoadMapFromBSP(), LoadModel(), LoadPCX(), LoadPortals(), LoadTGA(), LoadTGABuffer(), main(), MakeHeadnodePortals(), MakeNodePortal(), MatchToken(), NewBMP(), NewWinding(), CCamWnd::OnCreate(), CXYWnd::OnCreate(), OnlyTextures(), ParseChunk(), ParseEntity(), ParseEpair(), ParseFaceL1(), ParseFromMemory(), ParseHex(), ParseMapEntity(), ParsePatch(), ParseRawBrush(), ParseTerrain(), ParseVertexL(), PC_CopyToken(), PlaceOccupant(), Portal_EntityFlood(), Portal_Passable(), CXYWnd::PreCreateWindow(), CZWnd::PreCreateWindow(), ProjectDialog(), Q1_BSPBrushToMapBrush(), Q1_CopyLump(), Q1_CreateBrushes_r(), Q1_LoadBSPFile(), Q1_UnparseEntities(), Q2_BSPBrushToMapBrush(), Q2_CopyLump(), Q2_DecompressVis(), Q2_LoadBSPFile(), Q2_LoadBSPFileTexinfo(), Q2_ParseBrush(), Q2_ParseBSPEntity(), Q2_ParseMapEntity(), Q2_PushNodeStack(), Q2_UnparseEntities(), Q3_BSPBrushToMapBrush(), Q3_CopyLump(), Q3_LoadBSPFile(), Q3_UnparseEntities(), Q_mkdir(), QE_LoadProject(), QE_SaveProject(), QERApp_ErrorMsg(), QEW_SetupPixelFormat(), QuickTestBrushToPlanenum(), R_LoadMD3(), ReadPolysetGeometry(), CCamWnd::ReInitGL(), RemoveColinearPoints(), RemoveEqualPoints(), RemovePortalFromNode(), RunBsp(), SafeOpenRead(), SafeOpenWrite(), SafeRead(), SafeWrite(), Save256Image(), SetLightStyles(), SetQdirFromPath(), SetTerrainTextures(), SetupGrid(), SideAsTristrip(), Sin_AddLump(), Sin_BSPBrushToMapBrush(), Sin_CopyLump(), Sin_DecompressVis(), Sin_LoadBSPFile(), Sin_LoadBSPFileTexinfo(), Sin_PushNodeStack(), Sin_UnparseEntities(), SplitMeshByPlane(), SplitNodePortals(), StoreAliasTriangles(), SubdivideDrawSurf(), SubdivideFace(), SubdivideMeshQuads(), SurfaceAsTriFan(), SurfaceAsTristrip(), Terrain_AddTexture(), TestBrushToPlanenum(), TestEdge(), TestExpandBrushes(), Texture_LoadSkin(), Texture_LoadTexture(), Texture_LoadTGATexture(), Texture_MakeDefault(), Texture_SetMode(), TH_AASToTetrahedrons(), TH_CreateEdge(), TH_CreateFloatPlane(), TH_CreateTetrahedron(), TH_CreateTriangle(), TH_CreateVertex(), TH_HashVec(), TraceLtm(), Tree_PruneNodes_r(), TRI_LoadPolysets(), UnparseEntities(), VisMain(), VL_AllocWinding(), VL_FacetsForPatch(), VL_InitSurfacesForTesting(), VL_LinkSurfaceIntoCluster(), VL_LoadPortals(), VL_R_CastLightAtSurface(), VS_AllocWinding(), VS_FacetsForPatch(), VS_InitSurfacesForTesting(), VS_LinkSurfaceIntoCluster(), VS_LoadPortals(), VS_R_CastLightAtSurface(), WCam_Create(), WCam_WndProc(), WEnt_Create(), Winding_Alloc(), Winding_BaseForPlane(), Winding_Clip(), Winding_InsertPoint(), Winding_RemovePoint(), Winding_SplitEpsilon(), WriteBMP(), WriteBspBrushMap(), WriteGLView(), WriteMapFile(), WritePortalFile(), WritePortals(), WXY_Create(), WZ_Create(), WZ_WndProc(), and XYWndProc().

00179 {
00180     va_list argptr;
00181     char    text[1024];
00182 
00183     va_start(argptr, error);
00184     vsprintf(text, error, argptr);
00185     va_end(argptr);
00186     printf("ERROR: %s\n", text);
00187 
00188     Log_Write(text);
00189     Log_Close();
00190 
00191     exit (1);
00192 } //end of the function Error

Here is the call graph for this function:

char* ExpandReletivePath char *  p  ) 
 

Definition at line 54 of file QE3.CPP.

References QEGlobals_t::d_project_entity, g_qeglobals, p, sprintf(), and ValueForKey().

Referenced by QERApp_ExpandReletivePath().

00055 {
00056     static char temp[1024];
00057     char    *base;
00058 
00059     if (!p || !p[0])
00060         return NULL;
00061     if (p[0] == '/' || p[0] == '\\')
00062         return p;
00063 
00064     base = ValueForKey(g_qeglobals.d_project_entity, "basepath");
00065     sprintf (temp, "%s/%s", base, p);
00066     return temp;
00067 }

Here is the call graph for this function:

void Face_MoveTexture_BrushPrimit face_t f,
vec3_t  delta
 

Definition at line 338 of file brush_primit.cpp.

References face_s::brushprimit_texdef, ComputeAxisBase(), brushprimit_texdef_s::coords, D, DotProduct, f, face_t, M, plane_t::normal, face_s::plane, SarrusDet(), vec3_t, and vec_t.

Referenced by Face_MoveTexture(), and Select_ShiftTexture_BrushPrimit().

00339 {
00340     vec3_t texS,texT;
00341     vec_t tx,ty;
00342     vec3_t M[3]; // columns of the matrix .. easier that way
00343     vec_t det;
00344     vec3_t D[2];
00345     // compute plane axis base ( doesn't change with translation )
00346     ComputeAxisBase( f->plane.normal, texS, texT );
00347     // compute translation vector in plane axis base
00348     tx = DotProduct( delta, texS );
00349     ty = DotProduct( delta, texT );
00350     // fill the data vectors
00351     M[0][0]=tx; M[0][1]=1.0f+tx; M[0][2]=tx;
00352     M[1][0]=ty; M[1][1]=ty; M[1][2]=1.0f+ty;
00353     M[2][0]=1.0f; M[2][1]=1.0f; M[2][2]=1.0f;
00354     D[0][0]=f->brushprimit_texdef.coords[0][2];
00355     D[0][1]=f->brushprimit_texdef.coords[0][0]+f->brushprimit_texdef.coords[0][2];
00356     D[0][2]=f->brushprimit_texdef.coords[0][1]+f->brushprimit_texdef.coords[0][2];
00357     D[1][0]=f->brushprimit_texdef.coords[1][2];
00358     D[1][1]=f->brushprimit_texdef.coords[1][0]+f->brushprimit_texdef.coords[1][2];
00359     D[1][2]=f->brushprimit_texdef.coords[1][1]+f->brushprimit_texdef.coords[1][2];
00360     // solve
00361     det = SarrusDet( M[0], M[1], M[2] );
00362     f->brushprimit_texdef.coords[0][0] = SarrusDet( D[0], M[1], M[2] ) / det;
00363     f->brushprimit_texdef.coords[0][1] = SarrusDet( M[0], D[0], M[2] ) / det;
00364     f->brushprimit_texdef.coords[0][2] = SarrusDet( M[0], M[1], D[0] ) / det;
00365     f->brushprimit_texdef.coords[1][0] = SarrusDet( D[1], M[1], M[2] ) / det;
00366     f->brushprimit_texdef.coords[1][1] = SarrusDet( M[0], D[1], M[2] ) / det;
00367     f->brushprimit_texdef.coords[1][2] = SarrusDet( M[0], M[1], D[1] ) / det;
00368 }

Here is the call graph for this function:

void FaceToBrushPrimitFace face_t f  ) 
 

Definition at line 60 of file brush_primit.cpp.

References face_s::brushprimit_texdef, ComputeAxisBase(), brushprimit_texdef_s::coords, face_s::d_texture, plane_t::dist, EmitTextureCoordinates(), f, face_t, plane_t::normal, face_s::plane, Sys_Printf(), vec3_t, vec_t, VectorAdd, VectorCopy, and VectorScale.

Referenced by Brush_BuildWindings().

00061 {
00062     vec3_t texX,texY;
00063     vec3_t proj;
00064     // ST of (0,0) (1,0) (0,1)
00065     vec_t ST[3][5]; // [ point index ] [ xyz ST ]
00066     //++timo not used as long as brushprimit_texdef and texdef are static
00067 /*  f->brushprimit_texdef.contents=f->texdef.contents;
00068     f->brushprimit_texdef.flags=f->texdef.flags;
00069     f->brushprimit_texdef.value=f->texdef.value;
00070     strcpy(f->brushprimit_texdef.name,f->texdef.name); */
00071 #ifdef _DEBUG
00072     if ( f->plane.normal[0]==0.0f && f->plane.normal[1]==0.0f && f->plane.normal[2]==0.0f )
00073     {
00074         Sys_Printf("Warning : f->plane.normal is (0,0,0) in FaceToBrushPrimitFace\n");
00075     }
00076     // check d_texture
00077     if (!f->d_texture)
00078     {
00079         Sys_Printf("Warning : f.d_texture is NULL in FaceToBrushPrimitFace\n");
00080         return;
00081     }
00082 #endif
00083     // compute axis base
00084     ComputeAxisBase(f->plane.normal,texX,texY);
00085     // compute projection vector
00086     VectorCopy(f->plane.normal,proj);
00087     VectorScale(proj,f->plane.dist,proj);
00088     // (0,0) in plane axis base is (0,0,0) in world coordinates + projection on the affine plane
00089     // (1,0) in plane axis base is texX in world coordinates + projection on the affine plane
00090     // (0,1) in plane axis base is texY in world coordinates + projection on the affine plane
00091     // use old texture code to compute the ST coords of these points
00092     VectorCopy(proj,ST[0]);
00093     EmitTextureCoordinates(ST[0], f->d_texture, f);
00094     VectorCopy(texX,ST[1]);
00095     VectorAdd(ST[1],proj,ST[1]);
00096     EmitTextureCoordinates(ST[1], f->d_texture, f);
00097     VectorCopy(texY,ST[2]);
00098     VectorAdd(ST[2],proj,ST[2]);
00099     EmitTextureCoordinates(ST[2], f->d_texture, f);
00100     // compute texture matrix
00101     f->brushprimit_texdef.coords[0][2]=ST[0][3];
00102     f->brushprimit_texdef.coords[1][2]=ST[0][4];
00103     f->brushprimit_texdef.coords[0][0]=ST[1][3]-f->brushprimit_texdef.coords[0][2];
00104     f->brushprimit_texdef.coords[1][0]=ST[1][4]-f->brushprimit_texdef.coords[1][2];
00105     f->brushprimit_texdef.coords[0][1]=ST[2][3]-f->brushprimit_texdef.coords[0][2];
00106     f->brushprimit_texdef.coords[1][1]=ST[2][4]-f->brushprimit_texdef.coords[1][2];
00107 }

Here is the call graph for this function:

void FakeTexCoordsToTexMat float  shift[2],
float  rot,
float  scale[2],
vec_t  texMat[2][3]
 

Definition at line 312 of file brush_primit.cpp.

References cos(), DEG2RAD, shift, and sin().

Referenced by CSurfaceDlg::GetTexMods(), Select_RotateTexture(), Select_ScaleTexture(), and CSurfaceDlg::UpdateSpinners().

00313 {
00314     texMat[0][0] = scale[0] * cos( DEG2RAD( rot ) );
00315     texMat[1][0] = scale[0] * sin( DEG2RAD( rot ) );
00316     texMat[0][1] = -1.0f * scale[1] * sin( DEG2RAD( rot ) );
00317     texMat[1][1] = scale[1] * cos( DEG2RAD( rot ) );
00318     texMat[0][2] = -shift[0];
00319     texMat[1][2] = shift[1];
00320 }

Here is the call graph for this function:

void FillBSPMenu void   ) 
 

Definition at line 502 of file WIN_QE3.CPP.

References QEGlobals_t::bBSPFrontendPlugin, bsp_commands, CMD_BSPCOMMAND, count, QEGlobals_t::d_hwndMain, QEGlobals_t::d_project_entity, epair_t, entity_t::epairs, g_BSPFrontendCommands, g_BSPFrontendTable, g_qeglobals, i, epair_s::key, _QERPlugBSPFrontendTable::m_pfnGetBSPMenu, MENU_BSP, epair_s::next, NULL, strcpy(), strtok(), and token.

Referenced by AddCommandDlgProc(), EditCommandDlgProc(), QE_LoadProject(), and CMainFrame::SetButtonMenuStates().

00503 {
00504     HMENU   hmenu;
00505     epair_t *ep;
00506     int     i;
00507     static int count;
00508 
00509     hmenu = GetSubMenu (GetMenu(g_qeglobals.d_hwndMain), MENU_BSP);
00510 
00511     for (i=0 ; i<count ; i++)
00512         DeleteMenu (hmenu, CMD_BSPCOMMAND+i, MF_BYCOMMAND);
00513     count = 0;
00514 
00515     if ( g_qeglobals.bBSPFrontendPlugin )
00516     {
00517         CString str = g_BSPFrontendTable.m_pfnGetBSPMenu();
00518         char cTemp[1024];
00519         strcpy(cTemp, str);
00520         char* token = strtok(cTemp, ",;");
00521         if (token && *token == ' ')
00522         {
00523             while (*token == ' ')
00524                 token++;
00525         }
00526         i = 0;
00527         // first token is menu name
00528         ModifyMenu( GetMenu(g_qeglobals.d_hwndMain), MENU_BSP, MF_BYPOSITION, MENU_BSP, (LPCTSTR)token );
00529         // redraw the menu bar
00530         DrawMenuBar( g_qeglobals.d_hwndMain );
00531         token = strtok(NULL, ",;");
00532         while (token != NULL)
00533         {
00534             g_BSPFrontendCommands.Add(token);
00535             AppendMenu (hmenu, MF_ENABLED|MF_STRING, CMD_BSPCOMMAND+i, (LPCTSTR)token );
00536             token = strtok(NULL, ",;");
00537             i++;
00538         }
00539         count = i;
00540     }
00541     else
00542     {
00543         i = 0;
00544         for (ep = g_qeglobals.d_project_entity->epairs ; ep ; ep=ep->next)
00545         {
00546             if (ep->key[0] == 'b' && ep->key[1] == 's' && ep->key[2] == 'p')
00547             {
00548                 bsp_commands[i] = ep->key;
00549                 AppendMenu (hmenu, MF_ENABLED|MF_STRING,
00550                     CMD_BSPCOMMAND+i, (LPCTSTR)ep->key);
00551                 i++;
00552             }
00553         }
00554         count = i;
00555     }
00556 }

Here is the call graph for this function:

void FillClassList void   ) 
 

Definition at line 319 of file Win_ent.cpp.

References eclass_t, EntList, hwndEnt, LPARAM, eclass_s::name, and eclass_s::next.

Referenced by CreateEntityWindow(), and QE_LoadProject().

00320 {
00321     eclass_t    *pec;
00322     int         iIndex;
00323 
00324     SendMessage(hwndEnt[EntList], LB_RESETCONTENT, 0 , 0);
00325 
00326     for (pec = eclass ; pec ; pec = pec->next)
00327     {
00328         iIndex = SendMessage(hwndEnt[EntList], LB_ADDSTRING, 0 , (LPARAM)pec->name);
00329         SendMessage(hwndEnt[EntList], LB_SETITEMDATA, iIndex, (LPARAM)pec);
00330     }   
00331 
00332 }

void FillTextureMenu CStringArray *  pArray = NULL  ) 
 

Definition at line 1485 of file TexWnd.cpp.

References AddToDirListAlphabetized(), ClearDirList(), CMD_TEXTUREWAD, QEGlobals_t::d_hwndMain, QEGlobals_t::d_project_entity, DIRLIST, FROMDISK, g_pParentWnd, g_qeglobals, GetPackTextureDirs(), CMainFrame::GetPlugInMgr(), CPlugInManager::GetTextureInfo(), i, _QERTextureInfo::m_bWadStyle, MENU_TEXTURE, DirListStruct::next, sprintf(), strcat(), strcpy(), texture_menunames, texture_nummenus, and ValueForKey().

Referenced by CDialogTextures::OnInitDialog(), QE_LoadProject(), and CMainFrame::SetButtonMenuStates().

01486 {
01487     HMENU   hmenu;
01488     int     i;
01489     struct _finddata_t fileinfo;
01490     int     handle;
01491     char    dirstring[1024];
01492     char    *path;
01493     DIRLIST *list = NULL, *temp;
01494 
01495   if (g_pParentWnd->GetPlugInMgr().GetTextureInfo() != NULL)
01496   {
01497     if (g_pParentWnd->GetPlugInMgr().GetTextureInfo()->m_bWadStyle)
01498       return;
01499   }
01500 
01501     hmenu = GetSubMenu (GetMenu(g_qeglobals.d_hwndMain), MENU_TEXTURE);
01502 
01503     // delete everything
01504     for (i=0 ; i<texture_nummenus ; i++)
01505         DeleteMenu (hmenu, CMD_TEXTUREWAD+i, MF_BYCOMMAND);
01506 
01507   texture_nummenus = 0;
01508 
01509     // add everything
01510   if (g_qeglobals.d_project_entity)
01511   {
01512     //--if (g_PrefsDlg.m_bUseShaders)
01513     //--{
01514       //--  path = ValueForKey (g_qeglobals.d_project_entity, "basepath");
01515       //--  sprintf (dirstring, "%s/scripts/*.shader", path);
01516     //--
01517     //--}
01518     //--else
01519     //--{
01520         path = ValueForKey (g_qeglobals.d_project_entity, "texturepath");
01521         sprintf (dirstring, "%s/*.*", path);
01522     //--}
01523 
01524       handle = _findfirst (dirstring, &fileinfo);
01525       if (handle != -1)
01526     {
01527         do
01528         {
01529         //--if (g_PrefsDlg.m_bUseShaders)
01530         //--{
01531             //--  if ((fileinfo.attrib & _A_SUBDIR))
01532         //--    continue;
01533         //--}
01534         //--else
01535         //--{
01536               if (!(fileinfo.attrib & _A_SUBDIR))
01537                 continue;
01538               if (fileinfo.name[0] == '.')
01539                 continue;
01540         //--}
01541         // add this directory to the menu
01542           AddToDirListAlphabetized(&list, fileinfo.name, FROMDISK);
01543         } while (_findnext( handle, &fileinfo ) != -1);
01544 
01545         _findclose (handle);
01546     }
01547 
01548     //--if (!g_PrefsDlg.m_bUseShaders)
01549     //--{
01550       GetPackTextureDirs(&list);
01551     //--}
01552 
01553       for(temp = list; temp; temp = temp->next)
01554       {
01555           AppendMenu (hmenu, MF_ENABLED|MF_STRING, CMD_TEXTUREWAD+texture_nummenus, (LPCTSTR)temp->dirname);
01556           strcpy (texture_menunames[texture_nummenus], temp->dirname);
01557       //--if (!g_PrefsDlg.m_bUseShaders)
01558       //--{
01559             strcat (texture_menunames[texture_nummenus], "/");
01560       //--}
01561       if (pArray)
01562         pArray->Add(temp->dirname);
01563           if (++texture_nummenus == MAX_TEXTUREDIRS)
01564            break;
01565       }
01566 
01567       ClearDirList(&list);
01568   }
01569 
01570 
01571 }

Here is the call graph for this function:

BOOL GetSelectAllCriteria CString &  strKey,
CString &  strVal
 

Definition at line 832 of file Win_ent.cpp.

References BOOL, EntKeyField, EntValueField, hwndEnt, i, inspector_mode, and LPARAM.

Referenced by Select_AllOfType().

00832                                                             {
00833     char    sz[4096];
00834     HWND hwnd = hwndEnt[EntProps];
00835     int i = SendMessage(hwnd, LB_GETCURSEL, 0, 0);  
00836   if (i >= 0 && inspector_mode == W_ENTITY) {
00837       SendMessage(hwndEnt[EntKeyField], WM_GETTEXT, sizeof(sz), (LPARAM)sz);    
00838     strKey = sz;
00839       SendMessage(hwndEnt[EntValueField], WM_GETTEXT, sizeof(sz), (LPARAM)sz);  
00840     strVal = sz;
00841     return TRUE;
00842   }
00843   return FALSE;
00844 }

void GetSpawnFlags void   ) 
 

Definition at line 578 of file Win_ent.cpp.

References b, brush_t, edit_entity, EntCheck1, f, hwndEnt, i, brush_s::next, brush_s::owner, selected_brushes, SetKeyValue(), SetKeyValuePairs(), sprintf(), and v.

Referenced by EntityWndProc().

00579 {
00580     int     f;
00581     int     i, v;
00582     char    sz[32];
00583 
00584     f = 0;
00585     for (i=0 ; i<12 ; i++)
00586     {
00587         v = SendMessage(hwndEnt[EntCheck1+i], BM_GETCHECK, 0, 0);
00588         f |= v<<i;
00589     }
00590 
00591     sprintf (sz, "%i", f);
00592 
00593     if (multiple_entities)
00594     {
00595         brush_t *b;
00596 
00597         for (b=selected_brushes.next ; b != &selected_brushes ; b=b->next)
00598             SetKeyValue(b->owner, "spawnflags", sz);
00599     }
00600     else
00601         SetKeyValue (edit_entity, "spawnflags", sz);
00602     SetKeyValuePairs ();
00603 }

Here is the call graph for this function:

void Group_Add entity_t e  ) 
 

Definition at line 56 of file GroupDlg.cpp.

References e, entity_t::epairs, group_s::epairs, g(), g_pGroups, g_wndGroup, group_t, group_s::itemOwner, CGroupDlg::m_hWorld, CGroupDlg::m_wndTree, memset(), group_s::next, qmalloc(), and ValueForKey().

Referenced by Map_LoadFile().

00057 {
00058   group_t *g = (group_t*)qmalloc(sizeof(group_t));
00059   g->epairs = e->epairs;
00060   g->next = NULL;
00061   e->epairs = NULL;
00062   // create a new group node
00063   HTREEITEM hItem = g_wndGroup.m_wndTree.GetSelectedItem();
00064   TVINSERTSTRUCT tvInsert;
00065   memset(&tvInsert, 0, sizeof(TVINSERTSTRUCT));
00066   tvInsert.item.iImage = IMG_GROUP;
00067   tvInsert.item.iSelectedImage = tvInsert.item.iImage;
00068     //++timo wasat?
00069   // tvInsert.hParent = (hItem) ? hItem : m_hWorld;
00070   tvInsert.hParent = g_wndGroup.m_hWorld;
00071   tvInsert.hInsertAfter = NULL;
00072   tvInsert.item.mask = TVIF_TEXT | TVIF_IMAGE | TVIF_SELECTEDIMAGE;
00073   char *pipo = ValueForKey(e->epairs, "group");
00074   tvInsert.item.pszText = _T(ValueForKey(g->epairs, "group"));
00075     g->itemOwner = g_wndGroup.m_wndTree.InsertItem(&tvInsert);
00076   g->next = g_pGroups;
00077     g_pGroups = g;
00078 }

Here is the call graph for this function:

void Group_AddToProperGroup brush_t b  ) 
 

Definition at line 178 of file GroupDlg.cpp.

References b, Brush_GetKeyValue(), brush_t, g(), g_pGroupDlg, g_qeglobals, Group_AddToItem(), Group_AddToWorld(), Group_ForName(), group_t, group_s::itemOwner, brush_s::itemOwner, QEGlobals_t::m_bBrushPrimitMode, CGroupDlg::m_wndTree, and Sys_Printf().

Referenced by Brush_Build(), Group_Init(), and Select_AddToGroup().

00179 {
00180     if (!g_qeglobals.m_bBrushPrimitMode)
00181     {
00182         return;
00183     }
00184     // NOTE: we do a local copy of the "group" key because it gets erased by Group_RemoveBrush
00185     const char *pGroup = Brush_GetKeyValue(b, "group");
00186   // remove the entry in the tree if there's one
00187   if (b->itemOwner)
00188   {
00189         g_pGroupDlg->m_wndTree.DeleteItem(b->itemOwner);
00190         b->itemOwner = NULL;
00191         g_pGroupDlg->m_wndTree.RedrawWindow();
00192   }
00193 
00194     if (*pGroup != 0)
00195     {
00196         // find the item
00197         group_t *g = Group_ForName(pGroup);
00198         if (g)
00199             Group_AddToItem(b, g->itemOwner);
00200 #ifdef _DEBUG
00201         else
00202             Sys_Printf("WARNING: unexpected Group_ForName not found in Group_AddToProperGroup\n");
00203 #endif
00204     }
00205     else
00206     {
00207         Group_AddToWorld(b);
00208     }
00209 }

Here is the call graph for this function:

void Group_AddToSelected brush_t b  ) 
 

Definition at line 211 of file GroupDlg.cpp.

References b, brush_t, g_pGroupDlg, g_qeglobals, Group_AddToItem(), QEGlobals_t::m_bBrushPrimitMode, and CGroupDlg::m_wndTree.

00212 {
00213     if (!g_qeglobals.m_bBrushPrimitMode)
00214   {
00215     return;
00216   }
00217   HTREEITEM hItem = g_pGroupDlg->m_wndTree.GetSelectedItem();
00218   if (hItem == NULL)
00219   {
00220     hItem = g_pGroupDlg->m_wndTree.GetRootItem();
00221   }
00222   Group_AddToItem(b, hItem);
00223 }

Here is the call graph for this function:

void Group_AddToWorld brush_t b  ) 
 

Definition at line 168 of file GroupDlg.cpp.

References b, brush_t, g_pGroupDlg, g_qeglobals, Group_AddToItem(), QEGlobals_t::m_bBrushPrimitMode, and CGroupDlg::m_wndTree.

Referenced by Group_AddToProperGroup().

00169 {
00170     if (!g_qeglobals.m_bBrushPrimitMode)
00171   {
00172     return;
00173   }
00174   HTREEITEM itemParent = g_pGroupDlg->m_wndTree.GetRootItem();
00175   Group_AddToItem(b, itemParent);
00176 }

Here is the call graph for this function:

group_t* Group_Alloc const char *  name  ) 
 

Referenced by CGroupDlg::OnBtnAdd().

group_t* Group_ForName const char *  name  ) 
 

Definition at line 87 of file GroupDlg.cpp.

References group_s::epairs, g(), group_t, name, group_s::next, strcmp(), and ValueForKey().

Referenced by Group_AddToProperGroup().

00088 {
00089     group_t *g = g_pGroups;
00090     while (g != NULL)
00091     {
00092         if (strcmp( ValueForKey(g->epairs,"group"), name ) == 0)
00093             break;
00094         g = g->next;
00095     }
00096     return g;
00097 }

Here is the call graph for this function:

void Group_Init  ) 
 

Definition at line 235 of file GroupDlg.cpp.

References active_brushes, b, brush_t, epair_t, group_s::epairs, free(), g(), g_pGroups, g_qeglobals, g_wndGroup, Group_AddToProperGroup(), group_t, brush_s::itemOwner, epair_s::key, QEGlobals_t::m_bBrushPrimitMode, CGroupDlg::m_wndTree, memset(), brush_s::next, group_s::next, epair_s::next, selected_brushes, Sys_Printf(), and epair_s::value.

Referenced by CGroupDlg::InitGroups(), Map_LoadFile(), and Map_New().

00236 {
00237     if (!g_qeglobals.m_bBrushPrimitMode)
00238   {
00239     return;
00240   }
00241     // start by cleaning everything
00242   // clean the groups
00243   //++timo FIXME: we leak, delete the groups on the way (I don't have time to do it now)
00244 #ifdef _DEBUG
00245   Sys_Printf("TODO: fix leak in Group_Init\n");
00246 #endif
00247   group_t *g = g_pGroups;
00248   while (g)
00249   {
00250     epair_t *ep,*enext;
00251       for (ep = g->epairs ; ep ; ep=enext )
00252       {
00253           enext = ep->next;
00254           free (ep->key);
00255           free (ep->value);
00256           free (ep);
00257       }
00258     g = g->next;
00259   }
00260   g_pGroups = NULL;
00261     g_wndGroup.m_wndTree.DeleteAllItems();
00262   TVINSERTSTRUCT tvInsert;
00263   memset(&tvInsert, 0, sizeof(TVINSERTSTRUCT));
00264   tvInsert.hParent = NULL;
00265   tvInsert.hInsertAfter = NULL;
00266   tvInsert.item.mask = TVIF_TEXT | TVIF_IMAGE | TVIF_SELECTEDIMAGE;
00267   tvInsert.item.pszText = _T("World");
00268   tvInsert.item.iImage = IMG_GROUP;
00269   tvInsert.item.iSelectedImage = IMG_GROUP;
00270   HTREEITEM hWorld = g_wndGroup.m_wndTree.InsertItem(&tvInsert);
00271     // walk through all the brushes, remove the itemOwner key and add them back where they belong
00272     brush_t *b;
00273     for (b = active_brushes.next; b != &active_brushes; b = b->next)
00274     {
00275         b->itemOwner = NULL;
00276         Group_AddToProperGroup(b);
00277     }
00278     for (b = selected_brushes.next ; b != &selected_brushes ; b = b->next)
00279     {
00280         b->itemOwner = NULL;
00281         Group_AddToProperGroup(b);
00282     }
00283 }

Here is the call graph for this function:

void Group_RemoveBrush brush_t b  ) 
 

Definition at line 153 of file GroupDlg.cpp.

References b, brush_t, DeleteKey(), brush_s::epairs, g_pGroupDlg, g_qeglobals, brush_s::itemOwner, QEGlobals_t::m_bBrushPrimitMode, and CGroupDlg::m_wndTree.

Referenced by Brush_Free().

00154 {
00155     if (!g_qeglobals.m_bBrushPrimitMode)
00156     {
00157         return;
00158     }
00159     if (b->itemOwner)
00160     {
00161         g_pGroupDlg->m_wndTree.DeleteItem(b->itemOwner);
00162         b->itemOwner = NULL;
00163         g_pGroupDlg->m_wndTree.RedrawWindow();
00164     }
00165     DeleteKey(b->epairs, "group");
00166 }

Here is the call graph for this function:

void Group_RemoveListFromWorld  ) 
 

Definition at line 317 of file GroupDlg.cpp.

References array(), DeleteKey(), g_qeglobals, Group_GetListFromWorld(), i, QEGlobals_t::m_bBrushPrimitMode, and world_entity.

00318 {
00319     if (!g_qeglobals.m_bBrushPrimitMode)
00320   {
00321     return;
00322   }
00323   CStringArray array;
00324   Group_GetListFromWorld(&array);
00325   int nCount = array.GetSize();
00326   for (int i = 0; i < nCount; i++)
00327   {
00328     DeleteKey(world_entity, array.GetAt(i));
00329   }
00330 }

Here is the call graph for this function:

void Group_Save FILE f  ) 
 

Definition at line 225 of file GroupDlg.cpp.

References group_s::epairs, f, fprintf(), g(), group_t, group_s::next, and ValueForKey().

Referenced by Map_SaveFile().

00226 {
00227     group_t *g = g_pGroups;
00228     while (g)
00229   {
00230     fprintf(f,"{\n\"classname\" \"group_info\"\n\"group\" \"%s\"\n}\n", ValueForKey( g->epairs, "group" ));
00231     g = g->next;
00232   }
00233 }

Here is the call graph for this function:

CShaderInfo* hasShader const char *  pName  ) 
 

Definition at line 126 of file TexWnd.cpp.

References g_lstShaders, i, and CShaderInfo::m_strName.

Referenced by QERApp_HasShader(), SetNameShaderInfo(), and Texture_ForName().

00127 {
00128   int nSize = g_lstShaders.GetSize();
00129   for (int i = 0; i < nSize; i++)
00130   {
00131     CShaderInfo *pInfo = reinterpret_cast<CShaderInfo*>(g_lstShaders.ElementAt(i));
00132     if (pInfo != NULL)
00133     {
00134       if (pInfo->m_strName.CompareNoCase(pName) == 0)
00135       {
00136         return pInfo;
00137       }
00138     }
00139   }
00140   return NULL;
00141 }

double I_FloatTime void   ) 
 

Definition at line 362 of file l_cmd.c.

References t, time(), and time_t.

00363 {
00364     time_t  t;
00365     
00366     time (&t);
00367     
00368     return t;
00369 #if 0
00370 // more precise, less portable
00371     struct timeval tp;
00372     struct timezone tzp;
00373     static int      secbase;
00374 
00375     gettimeofday(&tp, &tzp);
00376     
00377     if (!secbase)
00378     {
00379         secbase = tp.tv_sec;
00380         return tp.tv_usec/1000000.0;
00381     }
00382     
00383     return (tp.tv_sec - secbase) + tp.tv_usec/1000000.0;
00384 #endif
00385 }

Here is the call graph for this function:

qboolean IsBrushSelected brush_t bSel  ) 
 

Definition at line 559 of file ENTITY.CPP.

References b, brush_t, brush_s::next, NULL, qboolean, and selected_brushes.

Referenced by Entity_WriteSelected(), and PaintedModel().

00560 {
00561     for (brush_t* b = selected_brushes.next ;b != NULL && b != &selected_brushes; b = b->next)
00562   {
00563     if (b == bSel)
00564       return true;
00565   }
00566   return false;
00567 }

BOOL LoadRegistryInfo const char *  pszName,
void *  pvBuf,
long *  plSize
 

BOOL LoadWindowState HWND  hWnd,
const char *  pszName
 

Referenced by CMainFrame::OnCreateClient(), WCam_Create(), WXY_Create(), and WZ_Create().

void Main_Create HINSTANCE  hInstance  ) 
 

patchMesh_t* MakeNewPatch  ) 
 

Definition at line 43 of file PMESH.CPP.

References QEGlobals_t::bSurfacePropertiesPlugin, g_qeglobals, g_SurfaceTable, _QERPlugSurfaceTable::m_pfnPatchAlloc, pm, and qmalloc().

Referenced by CPlugInManager::CreatePatchHandle(), Patch_BrushToMesh(), Patch_Duplicate(), Patch_FromTriangle(), Patch_GenericMesh(), and Patch_Parse().

00044 {
00045   patchMesh_t *pm = reinterpret_cast<patchMesh_t*>(qmalloc(sizeof(patchMesh_t)));
00046   if (g_qeglobals.bSurfacePropertiesPlugin)
00047   {
00048       pm->pData = static_cast<void *>( g_SurfaceTable.m_pfnPatchAlloc( pm ) );
00049   }
00050   return pm;
00051 }

Here is the call graph for this function:

bool WINAPI OnlyPatchesSelected  ) 
 

Definition at line 4054 of file PMESH.CPP.

References brush_t, g_ptrSelectedFaces, brush_s::next, brush_s::patchBrush, and selected_brushes.

Referenced by CSurfaceDlg::GetTexMods(), CMainFrame::OnSelectionDragvertecies(), and CSurfaceDlg::SetTexMods().

04055 {
04056   if (g_ptrSelectedFaces.GetSize() > 0 || selected_brushes.next == &selected_brushes)
04057     return false;
04058     for (brush_t *pb = selected_brushes.next ; pb != &selected_brushes ; pb = pb->next)
04059     {
04060     if (!pb->patchBrush)
04061     {
04062       return false;
04063     }
04064   }
04065   return true;
04066 }

void ParseCommandLine char *  lpCmdLine  ) 
 

Definition at line 657 of file QE3.CPP.

References argc, and argv.

Referenced by CMainFrame::CreateQEChildren(), and CRadiantApp::InitInstance().

00658 {
00659     argc = 1;
00660     argv[0] = "programname";
00661 
00662     while (*lpCmdLine && (argc < MAX_NUM_ARGVS))
00663     {
00664         while (*lpCmdLine && ((*lpCmdLine <= 32) || (*lpCmdLine > 126)))
00665             lpCmdLine++;
00666 
00667         if (*lpCmdLine)
00668         {
00669             argv[argc] = lpCmdLine;
00670             argc++;
00671 
00672             while (*lpCmdLine && ((*lpCmdLine > 32) && (*lpCmdLine <= 126)))
00673                 lpCmdLine++;
00674 
00675             if (*lpCmdLine)
00676             {
00677                 *lpCmdLine = 0;
00678                 lpCmdLine++;
00679             }
00680             
00681         }
00682     }
00683 }

int ParseNum char *  str  ) 
 

Definition at line 904 of file l_cmd.c.

References atol(), and ParseHex().

00905 {
00906     if (str[0] == '$')
00907         return ParseHex (str+1);
00908     if (str[0] == '0' && str[1] == 'x')
00909         return ParseHex (str+2);
00910     return atol (str);
00911 }

Here is the call graph for this function:

void Patch_AddRow patchMesh_t p  ) 
 

Definition at line 3068 of file PMESH.CPP.

References Brush_RebuildBrush(), patchMesh_t::ctrl, patchMesh_t::height, i, j, p, Patch_CalcBounds(), patchMesh_t::pSymbiot, UpdatePatchInspector(), vec3_t, VectorAdd, VectorCopy, VectorSubtract, patchMesh_t::width, and drawVert_t::xyz.

03069 {
03070   vec3_t vMin, vMax, vTemp;
03071   int i, j;
03072 
03073 
03074   if (p->height+2 < MAX_PATCH_HEIGHT)
03075   {
03076     Patch_CalcBounds(p, vMin, vMax);
03077     VectorSubtract(vMax, vMin, vTemp);
03078     for (i = 0; i < 3; i++)
03079     {
03080       vTemp[i] /= p->height + 2;
03081     }
03082 
03083     for (j = 0; j < p->width; j++)
03084     {
03085       VectorCopy(p->ctrl[j][p->height].xyz, p->ctrl[j][p->height+1].xyz);
03086       VectorCopy(p->ctrl[j][p->height].xyz, p->ctrl[j][p->height+2].xyz);
03087       p->height += 2;
03088       i = 1;
03089       while (i < p->height)
03090       {
03091         VectorAdd(p->ctrl[j][i].xyz, vTemp, p->ctrl[j][i].xyz);
03092         i++;
03093       }
03094     }
03095     
03096     Patch_CalcBounds(p, vMin, vMax);
03097     Brush_RebuildBrush(p->pSymbiot, vMin, vMax);
03098   }
03099   UpdatePatchInspector();
03100 }

Here is the call graph for this function:

void Patch_AdjustColumns patchMesh_t p,
int  nCols
 

Definition at line 3269 of file PMESH.CPP.

References patchMesh_t::ctrl, h(), patchMesh_t::height, i, p, drawVert_t::st, UpdatePatchInspector(), vec3_t, VectorAdd, VectorSubtract, w, patchMesh_t::width, and drawVert_t::xyz.

Referenced by Patch_AdjustSelectedRowCols().

03270 {
03271   vec3_t vTemp, vTemp2;
03272   int i, w, h;
03273 
03274   if (nCols & 0x01 || p->width + nCols < 3 || p->width + nCols > MAX_PATCH_WIDTH)
03275     return;
03276 
03277   // add in column adjustment
03278   p->width += nCols;
03279 
03280   for (h = 0; h < p->height; h++)
03281   {
03282     // for each column, we need to evenly disperse p->width number 
03283     // of points across the old bounds
03284     
03285     // calc total distance to interpolate 
03286     VectorSubtract(p->ctrl[p->width - 1 - nCols][h].xyz, p->ctrl[0][h].xyz, vTemp);
03287 
03288     // amount per cycle
03289     for (i = 0; i < 3; i ++)
03290     {
03291       vTemp2[i] = vTemp[i] / (p->width - 1);
03292     }
03293 
03294     // move along
03295     for (w = 0; w < p->width-1; w++)
03296     {
03297       VectorAdd(p->ctrl[w][h].xyz, vTemp2, p->ctrl[w+1][h].xyz);
03298     }
03299 
03300   }
03301     for ( w = 0 ; w < p->width ; w++ ) 
03302   {
03303         for ( h = 0 ; h < p->height ; h++ ) 
03304     {
03305             p->ctrl[w][h].st[0] = 4 * (float)w / (p->width - 1);
03306             p->ctrl[w][h].st[1] = 4 * (float)h / (p->height - 1);
03307         }
03308     }
03309   UpdatePatchInspector();
03310 }

Here is the call graph for this function:

void Patch_AdjustRows patchMesh_t p,
int  nRows
 

Definition at line 3318 of file PMESH.CPP.

References patchMesh_t::ctrl, h(), patchMesh_t::height, i, p, drawVert_t::st, UpdatePatchInspector(), vec3_t, VectorAdd, VectorSubtract, w, patchMesh_t::width, and drawVert_t::xyz.

Referenced by Patch_AdjustSelectedRowCols().

03319 {
03320   vec3_t vTemp, vTemp2;
03321   int i, w, h;
03322 
03323   if (nRows & 0x01 || p->height + nRows < 3 || p->height + nRows > MAX_PATCH_HEIGHT)
03324     return;
03325 
03326   // add in column adjustment
03327   p->height += nRows;
03328 
03329   for (w = 0; w < p->width; w++)
03330   {
03331     // for each row, we need to evenly disperse p->height number 
03332     // of points across the old bounds
03333 
03334     // calc total distance to interpolate 
03335     VectorSubtract(p->ctrl[w][p->height - 1 - nRows].xyz, p->ctrl[w][0].xyz, vTemp);
03336     
03337     //vTemp[0] = vTemp[1] = vTemp[2] = 0;
03338     //for (h = 0; h < p->height - nRows; h ++)
03339     //{
03340     //  VectorAdd(vTemp, p->ctrl[w][h], vTemp);
03341     //}
03342 
03343     // amount per cycle
03344     for (i = 0; i < 3; i ++)
03345     {
03346       vTemp2[i] = vTemp[i] / (p->height - 1);
03347     }
03348 
03349     // move along
03350     for (h = 0; h < p->height-1; h++)
03351     {
03352       VectorAdd(p->ctrl[w][h].xyz, vTemp2, p->ctrl[w][h+1].xyz);
03353     }
03354 
03355   }
03356     for ( w = 0 ; w < p->width ; w++ ) 
03357   {
03358         for ( h = 0 ; h < p->height ; h++ ) 
03359     {
03360             p->ctrl[w][h].st[0] = 4 * (float)w / (p->width - 1);
03361             p->ctrl[w][h].st[1] = 4 * (float)h / (p->height - 1);
03362         }
03363     }
03364   UpdatePatchInspector();
03365 }

Here is the call graph for this function:

void Patch_AdjustSelected bool  bInsert,
bool  bColumn,
bool  bFlag
 

Definition at line 3465 of file PMESH.CPP.

References Brush_RebuildBrush(), brush_t, brush_s::next, p, Patch_CalcBounds(), Patch_InsertColumn(), Patch_InsertRow(), Patch_RemoveColumn(), Patch_RemoveRow(), brush_s::patchBrush, brush_s::pPatch, patchMesh_t::pSymbiot, selected_brushes, Sys_UpdateWindows(), vec3_t, and W_ALL.

Referenced by CMainFrame::OnCurveDeletecolumn(), CMainFrame::OnCurveDeleteFirstcolumn(), CMainFrame::OnCurveDeleteFirstrow(), CMainFrame::OnCurveDeleteLastcolumn(), CMainFrame::OnCurveDeleteLastrow(), CMainFrame::OnCurveDeleterow(), CMainFrame::OnCurveInsertAddcolumn(), CMainFrame::OnCurveInsertAddrow(), CMainFrame::OnCurveInsertcolumn(), CMainFrame::OnCurveInsertInsertcolumn(), CMainFrame::OnCurveInsertInsertrow(), and CMainFrame::OnCurveInsertrow().

03466 {
03467   bool bUpdate = false;
03468     for (brush_t* pb = selected_brushes.next ; pb != &selected_brushes ; pb = pb->next)
03469     {
03470     if (pb->patchBrush)
03471     {
03472       if (bInsert)
03473       {
03474         if (bColumn)
03475         {
03476           Patch_InsertColumn(pb->pPatch, bFlag);
03477         }
03478         else
03479         {
03480           Patch_InsertRow(pb->pPatch, bFlag);
03481         }
03482       }
03483       else
03484       {
03485         if (bColumn)
03486         {
03487           Patch_RemoveColumn(pb->pPatch, bFlag);
03488         }
03489         else
03490         {
03491           Patch_RemoveRow(pb->pPatch, bFlag);
03492         }
03493       }
03494       bUpdate = true;
03495       vec3_t vMin, vMax;
03496       patchMesh_t *p = pb->pPatch;
03497       Patch_CalcBounds(p, vMin, vMax);
03498       Brush_RebuildBrush(p->pSymbiot, vMin, vMax);
03499     }
03500   }
03501   if (bUpdate)
03502   {
03503     Sys_UpdateWindows(W_ALL);
03504   }
03505 }

Here is the call graph for this function:

void Patch_ApplyMatrix patchMesh_t p,
const vec3_t  vOrigin,
const vec3_t  vMatrix[3],
bool  bSnap = false
 

Definition at line 2757 of file PMESH.CPP.

References Brush_RebuildBrush(), patchMesh_t::ctrl, QEGlobals_t::d_select_mode, DotProduct, floor(), g_qeglobals, h(), patchMesh_t::height, j, p, Patch_CalcBounds(), PointInMoveList(), sel_curvepoint, vec3_t, VectorSubtract, w, patchMesh_t::width, and drawVert_t::xyz.

Referenced by Select_ApplyMatrix().

02758 {
02759   vec3_t vTemp;
02760 
02761   for (int w = 0; w < p->width; w++)
02762   {
02763     for (int h = 0; h < p->height; h++)
02764     {
02765       if ( (g_qeglobals.d_select_mode == sel_curvepoint || g_bPatchBendMode)
02766         && PointInMoveList(p->ctrl[w][h].xyz) == -1)
02767         continue;
02768             VectorSubtract (p->ctrl[w][h].xyz, vOrigin, vTemp);
02769             for (int j = 0; j < 3; j++)
02770       {
02771         p->ctrl[w][h].xyz[j] = DotProduct(vTemp, vMatrix[j]) + vOrigin[j];
02772         if (bSnap)
02773         {
02774           p->ctrl[w][h].xyz[j] = floor(p->ctrl[w][h].xyz[j] + 0.5);
02775         }
02776       }
02777     }
02778   }
02779   vec3_t vMin, vMax;
02780   Patch_CalcBounds(p, vMin, vMax);
02781   Brush_RebuildBrush(p->pSymbiot, vMin, vMax);
02782 }

Here is the call graph for this function:

void Patch_BendHandleENTER  ) 
 

Definition at line 4198 of file PMESH.CPP.

References g_bPatchLowerEdge, g_nBendOriginIndex, g_nPatchBendState, g_pBendStateMsg, g_vBendOrigin, Patch_BendHandleTAB(), Patch_BendToggle(), ShowInfoDialog(), Sys_UpdateWindows(), and W_ALL.

Referenced by CMainFrame::OnClipSelected().

04199 {
04200   if (!g_bPatchBendMode)
04201   {
04202     return;
04203   }
04204 
04205   if (g_nPatchBendState  < BEND_BENDIT)
04206   {
04207     g_nPatchBendState++;
04208     ShowInfoDialog(g_pBendStateMsg[g_nPatchBendState]);
04209     if (g_nPatchBendState == BEND_SELECT_ORIGIN)
04210     {
04211       g_vBendOrigin[0] = g_vBendOrigin[1] = g_vBendOrigin[2] = 0;
04212       g_nBendOriginIndex = 0;
04213       Patch_BendHandleTAB();
04214     }
04215     else
04216     if (g_nPatchBendState == BEND_SELECT_EDGE)
04217     {
04218       g_bPatchLowerEdge = true;
04219     }
04220     else
04221     if (g_nPatchBendState == BEND_BENDIT)
04222     {
04223       // basically we go into rotation mode, set the axis to the center of the 
04224     }
04225   }
04226   else
04227   {
04228     // done
04229     Patch_BendToggle();
04230   }
04231   Sys_UpdateWindows(W_ALL);
04232 
04233 }

Here is the call graph for this function:

void Patch_BendHandleTAB  ) 
 

Definition at line 4117 of file PMESH.CPP.

References b, brush_t, patchMesh_t::ctrl, g_bPatchAxisOnRow, g_bPatchLowerEdge, g_nBendOriginIndex, g_nPatchAxisIndex, g_nPatchBendState, g_vBendOrigin, patchMesh_t::height, brush_s::next, p, Patch_BendToggle(), brush_s::patchBrush, brush_s::pPatch, QE_SingleBrush(), selected_brushes, Sys_Printf(), Sys_UpdateWindows(), VectorCopy, W_ALL, patchMesh_t::width, and drawVert_t::xyz.

Referenced by CMainFrame::OnPatchTab(), and Patch_BendHandleENTER().

04118 {
04119   if (!g_bPatchBendMode)
04120   {
04121     return;
04122   }
04123 
04124     brush_t* b = selected_brushes.next;
04125   if (!QE_SingleBrush() || !b->patchBrush)
04126   {
04127     Patch_BendToggle();
04128     Sys_Printf("No patch to bend!");
04129         return;
04130   }
04131 
04132   patchMesh_t *p = b->pPatch;
04133 
04134   bool bShift = (GetKeyState(VK_SHIFT) & 0x8000);
04135 
04136   if (g_nPatchBendState == BEND_SELECT_ROTATION)
04137   {
04138     // only able to deal with odd numbered rows/cols
04139     g_nPatchAxisIndex += (bShift) ? -2 : 2;
04140     if (g_bPatchAxisOnRow)
04141     {
04142       if ((bShift) ? g_nPatchAxisIndex <= 0 : g_nPatchAxisIndex >= p->height)
04143       {
04144         g_bPatchAxisOnRow = false;
04145         g_nPatchAxisIndex = (bShift) ? p->width-1 : 1;
04146       }
04147     }
04148     else
04149     {
04150       if ((bShift) ? g_nPatchAxisIndex <= 0 : g_nPatchAxisIndex >= p->width)
04151       {
04152         g_bPatchAxisOnRow = true;
04153         g_nPatchAxisIndex = (bShift) ? p->height-1 : 1;
04154       }
04155     }
04156   }
04157   else
04158   if (g_nPatchBendState == BEND_SELECT_ORIGIN)
04159   {
04160     g_nBendOriginIndex += (bShift) ? -1 : 1;
04161     if (g_bPatchAxisOnRow)
04162     {
04163       if (bShift)
04164       {
04165         if (g_nBendOriginIndex < 0)
04166           g_nBendOriginIndex = p->width-1;
04167       }
04168       else
04169       {
04170         if (g_nBendOriginIndex > p->width-1)
04171           g_nBendOriginIndex = 0;
04172       }
04173       VectorCopy(p->ctrl[g_nBendOriginIndex][g_nPatchAxisIndex].xyz, g_vBendOrigin);
04174     }
04175     else
04176     {
04177       if (bShift)
04178       {
04179         if (g_nBendOriginIndex < 0)
04180           g_nBendOriginIndex = p->height-1;
04181       }
04182       else
04183       {
04184         if (g_nBendOriginIndex > p->height-1)
04185           g_nBendOriginIndex = 0;
04186       }
04187       VectorCopy(p->ctrl[g_nPatchAxisIndex][g_nBendOriginIndex].xyz, g_vBendOrigin);
04188     }
04189   }
04190   else
04191   if (g_nPatchBendState == BEND_SELECT_EDGE)
04192   {
04193     g_bPatchLowerEdge ^= 1;
04194   }
04195   Sys_UpdateWindows(W_ALL);
04196 }

Here is the call graph for this function:

void Patch_BendToggle  ) 
 

Definition at line 4091 of file PMESH.CPP.

References b, BEND_SELECT_ROTATION, brush_t, g_bPatchAxisOnRow, g_bPatchBendMode, g_nPatchAxisIndex, g_nPatchBendState, g_pBendStateMsg, g_pParentWnd, HideInfoDialog(), brush_s::next, Patch_Save(), brush_s::patchBrush, brush_s::pPatch, QE_SingleBrush(), selected_brushes, ShowInfoDialog(), Sys_Printf(), and CMainFrame::UpdatePatchToolbarButtons().

Referenced by CMainFrame::OnPatchBend(), Patch_BendHandleENTER(), Patch_BendHandleESC(), Patch_BendHandleTAB(), Patch_Deselect(), Patch_InsDelHandleTAB(), Patch_SelectBendAxis(), and Patch_SelectBendNormal().

04092 {
04093   if (g_bPatchBendMode)
04094   {
04095     g_bPatchBendMode = false;
04096     HideInfoDialog();
04097     g_pParentWnd->UpdatePatchToolbarButtons() ;
04098     return;
04099   }
04100 
04101     brush_t* b = selected_brushes.next;
04102 
04103   if (!QE_SingleBrush() || !b->patchBrush)
04104   {
04105     Sys_Printf("Must bend a single patch");
04106         return;
04107   }
04108 
04109   Patch_Save(b->pPatch);
04110     g_bPatchBendMode = true;
04111   g_nPatchBendState = BEND_SELECT_ROTATION;
04112   g_bPatchAxisOnRow = true;
04113   g_nPatchAxisIndex = 1;
04114   ShowInfoDialog(g_pBendStateMsg[BEND_SELECT_ROTATION]);
04115 }

Here is the call graph for this function:

void Patch_BrushToMesh bool  bCone = false,
bool  bBevel = false,
bool  bEndcap = false,
bool  bSquare = false,
int  nHeight = 3
 

Definition at line 1465 of file PMESH.CPP.

References AddBrushForPatch(), b, brush_s::brush_faces, brush_t, patchMesh_t::ctrl, face_s::d_texture, patchMesh_t::d_texture, Eclass_ForName(), eclass_t, Entity_Create(), GenerateEndCaps(), patchMesh_t::height, i, InterpolateInteriorPoints(), j, MakeNewPatch(), brush_s::maxs, brush_s::mins, brush_s::next, p, Patch_Naturalize(), QE_SingleBrush(), Select_Brush(), Select_Delete(), selected_brushes, patchMesh_t::type, VectorCopy, patchMesh_t::width, and drawVert_t::xyz.

01466 {
01467     brush_t     *b;
01468     patchMesh_t *p;
01469     int         i,j;
01470 
01471     if (!QE_SingleBrush())
01472         return;
01473 
01474     b = selected_brushes.next;
01475 
01476     p = MakeNewPatch();
01477 
01478     p->d_texture = b->brush_faces->d_texture;
01479 
01480   p->height = nHeight;
01481 
01482   p->type = PATCH_CYLINDER;
01483   if (bBevel & !bSquare)
01484   {
01485     p->type = PATCH_BEVEL;
01486     p->width = 3;
01487     int nStep = (b->maxs[2] - b->mins[2]) / (p->height-1);
01488     int nStart = b->mins[2];
01489     for (i = 0; i < p->height; i++)
01490     {
01491         p->ctrl[0][i].xyz[0] =  b->mins[0];
01492         p->ctrl[0][i].xyz[1] =  b->mins[1];
01493       p->ctrl[0][i].xyz[2] = nStart;
01494 
01495         p->ctrl[1][i].xyz[0] =  b->maxs[0];
01496         p->ctrl[1][i].xyz[1] =  b->mins[1];
01497       p->ctrl[1][i].xyz[2] = nStart;
01498 
01499         p->ctrl[2][i].xyz[0] =  b->maxs[0];
01500         p->ctrl[2][i].xyz[1] =  b->maxs[1];
01501       p->ctrl[2][i].xyz[2] = nStart;
01502       nStart += nStep;
01503     }
01504   }
01505   else if (bEndcap & !bSquare)
01506   {
01507     p->type = PATCH_ENDCAP;
01508     p->width = 5;
01509     int nStep = (b->maxs[2] - b->mins[2]) / (p->height-1);
01510     int nStart = b->mins[2];
01511     for (i = 0; i < p->height; i++)
01512     {
01513         p->ctrl[0][i].xyz[0] =  b->mins[0];
01514         p->ctrl[0][i].xyz[1] =  b->mins[1];
01515       p->ctrl[0][i].xyz[2] = nStart;
01516 
01517         p->ctrl[1][i].xyz[0] =  b->mins[0];
01518         p->ctrl[1][i].xyz[1] =  b->maxs[1];
01519       p->ctrl[1][i].xyz[2] = nStart;
01520 
01521         p->ctrl[2][i].xyz[0] =  b->mins[0] + ((b->maxs[0] - b->mins[0]) * 0.5);
01522         p->ctrl[2][i].xyz[1] =  b->maxs[1];
01523       p->ctrl[2][i].xyz[2] = nStart;
01524        
01525       p->ctrl[3][i].xyz[0] =  b->maxs[0];
01526         p->ctrl[3][i].xyz[1] =  b->maxs[1];
01527       p->ctrl[3][i].xyz[2] = nStart;
01528 
01529         p->ctrl[4][i].xyz[0] =  b->maxs[0];
01530         p->ctrl[4][i].xyz[1] =  b->mins[1];
01531       p->ctrl[4][i].xyz[2] = nStart;
01532       nStart += nStep;
01533     }
01534   }
01535   else
01536   {
01537     p->width = 9;
01538       p->ctrl[1][0].xyz[0] =  b->mins[0];
01539       p->ctrl[1][0].xyz[1] =  b->mins[1];
01540 
01541       p->ctrl[3][0].xyz[0] =  b->maxs[0];
01542       p->ctrl[3][0].xyz[1] =  b->mins[1];
01543 
01544       p->ctrl[5][0].xyz[0] =  b->maxs[0];
01545       p->ctrl[5][0].xyz[1] =  b->maxs[1];
01546 
01547       p->ctrl[7][0].xyz[0] =  b->mins[0];
01548       p->ctrl[7][0].xyz[1] =  b->maxs[1];
01549 
01550       for ( i = 1 ; i < p->width - 1 ; i += 2 ) 
01551     {
01552 
01553       p->ctrl[i][0].xyz[2] =  b->mins[2];
01554 
01555           VectorCopy( p->ctrl[i][0].xyz, p->ctrl[i][2].xyz );
01556 
01557           p->ctrl[i][2].xyz[2] =  b->maxs[2];
01558 
01559           p->ctrl[i][1].xyz[0] = ( p->ctrl[i][0].xyz[0] + p->ctrl[i][2].xyz[0] ) * 0.5;
01560           p->ctrl[i][1].xyz[1] = ( p->ctrl[i][0].xyz[1] + p->ctrl[i][2].xyz[1] ) * 0.5;
01561           p->ctrl[i][1].xyz[2] = ( p->ctrl[i][0].xyz[2] + p->ctrl[i][2].xyz[2] ) * 0.5;
01562       }
01563       InterpolateInteriorPoints( p );
01564 
01565     if (bSquare)
01566     {
01567       if (bBevel || bEndcap)
01568       {
01569         if (bBevel)
01570         {
01571           for (i = 0; i < p->height; i++)
01572           {
01573             VectorCopy(p->ctrl[1][i].xyz, p->ctrl[2][i].xyz);
01574             VectorCopy(p->ctrl[7][i].xyz, p->ctrl[6][i].xyz);
01575           }
01576         }
01577         else
01578         {
01579           for (i = 0; i < p->height; i++)
01580           {
01581             VectorCopy(p->ctrl[5][i].xyz, p->ctrl[4][i].xyz);
01582             VectorCopy(p->ctrl[1][i].xyz, p->ctrl[2][i].xyz);
01583             VectorCopy(p->ctrl[7][i].xyz, p->ctrl[6][i].xyz);
01584             VectorCopy(p->ctrl[8][i].xyz, p->ctrl[7][i].xyz);
01585           }
01586         }
01587       }
01588       else
01589       {
01590         for (i = 0; i < p->width-1; i ++)
01591         {
01592           for (j = 0; j < p->height; j++)
01593           {
01594             VectorCopy(p->ctrl[i+1][j].xyz, p->ctrl[i][j].xyz);
01595           }
01596         }
01597         for (j = 0; j < p->height; j++)
01598         {
01599           VectorCopy(p->ctrl[0][j].xyz, p->ctrl[8][j].xyz);
01600         }
01601       }
01602     }
01603   }
01604 
01605 
01606   Patch_Naturalize(p);
01607 
01608   if (bCone)
01609   {
01610     p->type = PATCH_CONE;
01611     float xc = (b->maxs[0] + b->mins[0]) * 0.5; 
01612     float yc = (b->maxs[1] + b->mins[1]) * 0.5; 
01613 
01614     for ( i = 0 ; i < p->width ; i ++)
01615     {
01616       p->ctrl[i][2].xyz[0] = xc;
01617       p->ctrl[i][2].xyz[1] = yc;
01618     }
01619   }
01620 /*
01621   if (bEndcap || bBevel)
01622   {
01623     if (bInverted)
01624     {
01625       for ( i = 0 ; i < p->height ; i ++)
01626       {
01627         if (bBevel)
01628         {
01629           VectorCopy(p->ctrl[7][i], p->ctrl[0][i]);
01630           VectorCopy(p->ctrl[7][i], p->ctrl[8][i]);
01631           VectorCopy(p->ctrl[3][i], p->ctrl[2][i]);
01632           VectorCopy(p->ctrl[5][i], p->ctrl[1][i]);
01633           VectorCopy(p->ctrl[5][i], p->ctrl[4][i]);
01634           VectorCopy(p->ctrl[5][i], p->ctrl[6][i]);
01635         }
01636         else
01637         {
01638           VectorCopy(p->ctrl[4][i], p->ctrl[8][i]);
01639           VectorCopy(p->ctrl[1][i], p->ctrl[0][i]);
01640           VectorCopy(p->ctrl[1][i], p->ctrl[10][i]);
01641           VectorCopy(p->ctrl[3][i], p->ctrl[2][i]);
01642           VectorCopy(p->ctrl[5][i], p->ctrl[4][i]);
01643           VectorCopy(p->ctrl[7][i], p->ctrl[6][i]);
01644           VectorCopy(p->ctrl[5][i], p->ctrl[7][i]);
01645           VectorCopy(p->ctrl[3][i], p->ctrl[9][i]);
01646         }
01647       }
01648     }
01649     else
01650     {
01651       for ( i = 0 ; i < p->height ; i ++)
01652       {
01653         VectorCopy(p->ctrl[1][i], p->ctrl[2][i]);
01654         VectorCopy(p->ctrl[7][i], p->ctrl[6][i]);
01655         if (bBevel)
01656         {
01657           VectorCopy(p->ctrl[5][i], p->ctrl[4][i]);
01658         }
01659       }
01660     }
01661   }
01662 */
01663   
01664   b = AddBrushForPatch(p);
01665 
01666 
01667 #if 1
01668     Select_Delete();
01669     Select_Brush(b);
01670 #else
01671   if (!bCone)
01672   {
01673     Select_Delete();
01674     Select_Brush(b);
01675     GenerateEndCaps(b, bBevel, bEndcap, bInverted);
01676     eclass_t *pecNew = Eclass_ForName("func_group", false);
01677     if (pecNew)
01678     {
01679       Entity_Create(pecNew);
01680     }
01681   }
01682   else
01683   {
01684     Select_Delete();
01685     Select_Brush(b);
01686   }
01687 #endif
01688 
01689 }

Here is the call graph for this function:

void Patch_BuildPoints brush_t b  ) 
 

Definition at line 64 of file cbrushstub.cpp.

References b, brush_s::brush_faces, brush_t, f, face_t, texdef_t::flags, face_s::next, brush_s::patchBrush, and face_s::texdef.

Referenced by Brush_Build().

00064 {};

void Patch_CapCurrent bool  bInvertedBevel = false,
bool  bInvertedEndcap = false
 

Definition at line 1127 of file PMESH.CPP.

References b, brush_t, Cap(), CapSpecial(), patchMesh_t::ctrl, e, Eclass_ForName(), eclass_t, Entity_Create(), CCapDialog::getCapType(), patchMesh_t::height, brush_s::next, NULL, brush_s::patchBrush, brush_s::pPatch, QE_SingleBrush(), Select_Brush(), selected_brushes, SetKeyValue(), Sys_Printf(), VectorCompare(), patchMesh_t::width, and drawVert_t::xyz.

Referenced by CMainFrame::OnCurveCap(), CMainFrame::OnCurveCapInvertedbevel(), and CMainFrame::OnCurveCapInvertedendcap().

01128 {
01129   patchMesh_t *pParent = NULL;
01130   brush_t *b[4];
01131   brush_t *pCap = NULL;
01132   b[0] = b[1] = b[2] = b[3] = NULL;
01133   int nIndex = 0;
01134 
01135     if (!QE_SingleBrush())
01136   {
01137     Sys_Printf("Cannot cap multiple selection. Please select a single patch.\n");
01138         return;
01139   }
01140 
01141 
01142     for (brush_t *pb = selected_brushes.next ; pb != NULL && pb != &selected_brushes ; pb = pb->next)
01143     {
01144     if (pb->patchBrush)
01145     {
01146       pParent = pb->pPatch;
01147       // decide which if any ends we are going to cap
01148       // if any of these compares hit, it is a closed patch and as such
01149       // the generic capping will work.. if we do not find a closed edge 
01150       // then we need to ask which kind of cap to add
01151       if (VectorCompare(pParent->ctrl[0][0].xyz, pParent->ctrl[pParent->width-1][0].xyz))
01152       {
01153         pCap = Cap(pParent, true, false);
01154         if (pCap != NULL)
01155         {
01156           b[nIndex++] = pCap;
01157         }
01158       }
01159       if (VectorCompare(pParent->ctrl[0][pParent->height-1].xyz, pParent->ctrl[pParent->width-1][pParent->height-1].xyz))
01160       {
01161         pCap = Cap(pParent, true, true);
01162         if (pCap != NULL)
01163         {
01164           b[nIndex++] = pCap;
01165         }
01166       }
01167       if (VectorCompare(pParent->ctrl[0][0].xyz, pParent->ctrl[0][pParent->height-1].xyz))
01168       {
01169         pCap = Cap(pParent, false, false);
01170         if (pCap != NULL)
01171         {
01172           b[nIndex++] = pCap;
01173         }
01174       }
01175       if (VectorCompare(pParent->ctrl[pParent->width-1][0].xyz, pParent->ctrl[pParent->width-1][pParent->height-1].xyz))
01176       {
01177         pCap = Cap(pParent, false, true);
01178         if (pCap != NULL)
01179         {
01180           b[nIndex++] = pCap;
01181         }
01182       }
01183     }
01184   }
01185 
01186   if (pParent)
01187   {
01188     // if we did not cap anything with the above tests
01189     if (nIndex == 0)
01190     {
01191       CCapDialog dlg;
01192       if (dlg.DoModal() == IDOK)
01193       {
01194         b[nIndex++] = CapSpecial(pParent, dlg.getCapType(), false);
01195         b[nIndex++] = CapSpecial(pParent, dlg.getCapType(), true);
01196       }
01197     }
01198 
01199     if (nIndex > 0)
01200     {
01201       while (nIndex > 0)
01202       {
01203         nIndex--;
01204         if (b[nIndex])
01205         {
01206           Select_Brush(b[nIndex]);
01207         }
01208       }
01209       eclass_t *pecNew = Eclass_ForName("func_group", false);
01210       if (pecNew)
01211       {
01212         entity_t *e = Entity_Create(pecNew);
01213         SetKeyValue(e, "type", "patchCapped");
01214       }
01215     }
01216   }
01217 }

Here is the call graph for this function:

void Patch_Cleanup  ) 
 

Definition at line 72 of file cbrushstub.cpp.

00072 {};

void Patch_ClearOverlays  ) 
 

Definition at line 4795 of file PMESH.CPP.

References active_brushes, patchMesh_t::bOverlay, brush_t, brush_s::next, brush_s::patchBrush, brush_s::pPatch, and selected_brushes.

Referenced by CMainFrame::OnCurveOverlayClear().

04796 {
04797   brush_t *pb;
04798     for (pb = selected_brushes.next ; pb != &selected_brushes ; pb = pb->next)
04799     {
04800     if (pb->patchBrush)
04801     {
04802       pb->pPatch->bOverlay = false;
04803     }
04804   }
04805 
04806     for (pb = active_brushes.next ; pb != &active_brushes ; pb = pb->next)
04807     {
04808     if (pb->patchBrush)
04809     {
04810       pb->pPatch->bOverlay = false;
04811     }
04812   }
04813 
04814 }

void Patch_Delete patchMesh_t p  ) 
 

Definition at line 2878 of file PMESH.CPP.

References QEGlobals_t::bSurfacePropertiesPlugin, free(), g_qeglobals, GETPLUGINTEXDEF, p, brush_s::patchBrush, patchMesh_t::pData, brush_s::pPatch, patchMesh_t::pSymbiot, Sys_Printf(), and UpdatePatchInspector().

Referenced by Brush_Free(), QERApp_DeletePatch(), and Select_Delete().

02879 {
02880   p->pSymbiot->pPatch = NULL;
02881   p->pSymbiot->patchBrush = false;
02882   if (g_qeglobals.bSurfacePropertiesPlugin)
02883   {
02884 #ifdef _DEBUG
02885         if (!p->pData)
02886             Sys_Printf("WARNING: unexpected IPluginTexdef* is NULL in Patch_Delete\n");
02887         else
02888 #endif
02889         {
02890             GETPLUGINTEXDEF(p)->DecRef();
02891             p->pData = NULL;
02892         }
02893   }
02894   free(p);
02895   p = NULL;
02896 
02897   // bump the array down
02898   //for (int i = n; i < numPatchMeshes; i++)
02899   //{
02900   //  patchMeshes[i].pSymbiot->nPatchID--;
02901   //  patchMeshes[i] = patchMeshes[i+1];
02902   //}
02903   //numPatchMeshes--;
02904   UpdatePatchInspector();
02905 }

Here is the call graph for this function:

void Patch_Deselect patchMesh_t p  ) 
 

Definition at line 2867 of file PMESH.CPP.

References patchMesh_t::bSelected, and p.

02868 {
02869   p->bSelected = false;
02870 }

void Patch_Deselect  ) 
 

Definition at line 68 of file cbrushstub.cpp.

00068 {};

void Patch_DisperseColumns  ) 
 

Definition at line 3419 of file PMESH.CPP.

References brush_t, patchMesh_t::ctrl, h(), patchMesh_t::height, i, brush_s::next, p, Patch_Naturalize(), Patch_Rebuild(), brush_s::patchBrush, brush_s::pPatch, selected_brushes, UpdatePatchInspector(), vec3_t, VectorAdd, VectorSubtract, w, patchMesh_t::width, and drawVert_t::xyz.

Referenced by CMainFrame::OnCurveRedisperseCols().

03420 {
03421   vec3_t vTemp, vTemp2;
03422   int i, w, h;
03423 
03424     for (brush_t *pb = selected_brushes.next ; pb != &selected_brushes ; pb = pb->next)
03425     {
03426     if (pb->patchBrush)
03427     {
03428       patchMesh_t *p = pb->pPatch;
03429       Patch_Rebuild(p);
03430 
03431       for (h = 0; h < p->height; h++)
03432       {
03433         // for each column, we need to evenly disperse p->width number 
03434         // of points across the old bounds
03435     
03436         // calc total distance to interpolate 
03437         VectorSubtract(p->ctrl[p->width - 1][h].xyz, p->ctrl[0][h].xyz, vTemp);
03438 
03439         // amount per cycle
03440         for (i = 0; i < 3; i ++)
03441         {
03442           vTemp2[i] = vTemp[i] / (p->width - 1);
03443         }
03444 
03445         // move along
03446         for (w = 0; w < p->width-1; w++)
03447         {
03448           VectorAdd(p->ctrl[w][h].xyz, vTemp2, p->ctrl[w+1][h].xyz);
03449         }
03450 
03451       }
03452       Patch_Naturalize(p);
03453     }
03454   }
03455   UpdatePatchInspector();
03456 }

Here is the call graph for this function:

void Patch_DisperseRows  ) 
 

Definition at line 3368 of file PMESH.CPP.

References brush_t, patchMesh_t::ctrl, h(), patchMesh_t::height, i, brush_s::next, p, Patch_Naturalize(), Patch_Rebuild(), brush_s::patchBrush, brush_s::pPatch, selected_brushes, UpdatePatchInspector(), vec3_t, VectorAdd, VectorSubtract, w, patchMesh_t::width, and drawVert_t::xyz.

Referenced by CMainFrame::OnCurveRedisperseRows().

03369 {
03370   vec3_t vTemp, vTemp2;
03371   int i, w, h;
03372 
03373 
03374     for (brush_t *pb = selected_brushes.next ; pb != &selected_brushes ; pb = pb->next)
03375     {
03376     if (pb->patchBrush)
03377     {
03378       patchMesh_t *p = pb->pPatch;
03379       Patch_Rebuild(p);
03380       for (w = 0; w < p->width; w++)
03381       {
03382         // for each row, we need to evenly disperse p->height number 
03383         // of points across the old bounds
03384 
03385         // calc total distance to interpolate 
03386         VectorSubtract(p->ctrl[w][p->height - 1].xyz, p->ctrl[w][0].xyz, vTemp);
03387     
03388         //vTemp[0] = vTemp[1] = vTemp[2] = 0;
03389         //for (h = 0; h < p->height - nRows; h ++)
03390         //{
03391         //  VectorAdd(vTemp, p->ctrl[w][h], vTemp);
03392         //}
03393 
03394         // amount per cycle
03395         for (i = 0; i < 3; i ++)
03396         {
03397           vTemp2[i] = vTemp[i] / (p->height - 1);
03398         }
03399 
03400         // move along
03401         for (h = 0; h < p->height-1; h++)
03402         {
03403           VectorAdd(p->ctrl[w][h].xyz, vTemp2, p->ctrl[w][h+1].xyz);
03404         }
03405         Patch_Naturalize(p);
03406 
03407       }
03408     }
03409   }
03410   UpdatePatchInspector();
03411 
03412 }

Here is the call graph for this function:

bool Patch_DragScale patchMesh_t p,
vec3_t  vAmt,
vec3_t  vMove
 

Definition at line 3002 of file PMESH.CPP.

References i, p, Patch_CalcBounds(), Patch_Move(), Patch_Scale(), vec3_t, VectorCompare(), VectorScale, and VectorSubtract.

Referenced by MoveSelection().

03003 {
03004   vec3_t vMin, vMax, vScale, vTemp, vMid;
03005   int i;
03006 
03007   Patch_CalcBounds(p, vMin, vMax);
03008 
03009   VectorSubtract(vMax, vMin, vTemp);
03010 
03011   // if we are scaling in the same dimension the patch has no depth
03012   for (i = 0; i < 3; i ++)
03013   {
03014     if (vTemp[i] == 0 && vMove[i] != 0)
03015     {
03016       //Patch_Move(n, vMove, true);
03017       return false;
03018     }
03019   }
03020   
03021   for (i=0 ; i<3 ; i++)
03022     vMid[i] = (vMin[i] + ((vMax[i] - vMin[i]) / 2));
03023 
03024   for (i = 0; i < 3; i++)
03025   {
03026     if (vAmt[i] != 0)
03027     {
03028       vScale[i] = 1.0 + vAmt[i] / vTemp[i];
03029     }
03030     else
03031     {
03032       vScale[i] = 1.0;
03033     }
03034   }
03035 
03036   Patch_Scale(p, vMid, vScale, false);
03037 
03038   VectorSubtract(vMax, vMin, vTemp);
03039 
03040   Patch_CalcBounds(p, vMin, vMax);
03041   
03042   VectorSubtract(vMax, vMin, vMid);
03043 
03044   VectorSubtract(vMid, vTemp, vTemp);
03045 
03046   VectorScale(vTemp, 0.5, vTemp);
03047 
03048   // abs of both should always be equal
03049   if (!VectorCompare(vMove, vAmt))
03050   {
03051     for (i = 0; i < 3; i++)
03052     {
03053       if (vMove[i] != vAmt[i])
03054         vTemp[i] = -(vTemp[i]);
03055     }
03056   }
03057 
03058   Patch_Move(p, vTemp);
03059   return true;
03060 }

Here is the call graph for this function:

void Patch_DrawCam patchMesh_t p  ) 
 

Definition at line 2574 of file PMESH.CPP.

References DrawPatchMesh(), g_PrefsDlg, i, j, CPrefsDlg::m_bGLLighting, pm, qglBegin, qglBindTexture, qglColor3f, qglColor4f, qglCullFace, qglDisable, qglEnable, qglEnd, qglPolygonMode, qglPopAttrib, qglPushAttrib, qglVertex3fv, vec3_t, and VectorMA.

Referenced by Brush_Draw().

02575 {
02576     qglColor3f (1,1,1);
02577   qglPushAttrib(GL_ALL_ATTRIB_BITS);
02578 
02579   if (g_bPatchWireFrame)
02580   {
02581       qglDisable( GL_CULL_FACE );
02582       qglPolygonMode (GL_FRONT_AND_BACK, GL_LINE);
02583       qglDisable(GL_TEXTURE_2D);
02584     if (g_PrefsDlg.m_bGLLighting)
02585     {
02586       qglDisable(GL_LIGHTING);
02587     }
02588       DrawPatchMesh( pm , pm->bSelected, true );
02589     if (g_PrefsDlg.m_bGLLighting)
02590     {
02591       qglEnable(GL_LIGHTING);
02592     }
02593       qglEnable( GL_CULL_FACE );
02594   }
02595   else
02596   {
02597     if (g_PrefsDlg.m_bGLLighting)
02598     {
02599       //qglEnable(GL_NORMALIZE);
02600     }
02601       qglEnable( GL_CULL_FACE );
02602     qglCullFace(GL_FRONT);
02603     qglBindTexture (GL_TEXTURE_2D, pm->d_texture->texture_number);
02604 
02605     if (pm->d_texture->bFromShader && pm->d_texture->fTrans < 1.0)
02606     {
02607         //qglEnable ( GL_BLEND );
02608         //qglBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
02609       qglColor4f(pm->d_texture->color[0], pm->d_texture->color[1], pm->d_texture->color[2], pm->d_texture->fTrans); 
02610     }
02611     DrawPatchMesh( pm , pm->bSelected, true );
02612     
02613     qglCullFace(GL_BACK);
02614       //qglDisable(GL_TEXTURE_2D);
02615       qglPolygonMode (GL_FRONT_AND_BACK, GL_LINE);
02616 
02617     qglDisable ( GL_BLEND );
02618       DrawPatchMesh( pm , pm->bSelected, true );
02619   }
02620 
02621 #if 0 // this paints normal indicators on the ctrl points
02622       //--qglDisable (GL_DEPTH_TEST);
02623       qglDisable (GL_TEXTURE_2D);
02624       qglColor3f (1,1,1);
02625 
02626       for (int i = 0; i < pm->width; i++)
02627       {
02628         for (int j = 0; j < pm->height; j++)
02629         {
02630           vec3_t temp;
02631             qglBegin (GL_LINES);
02632               qglVertex3fv (pm->ctrl[i][j].xyz);
02633               VectorMA (pm->ctrl[i][j].xyz, 8, pm->ctrl[i][j].normal, temp);
02634               qglVertex3fv (temp);
02635             qglEnd ();
02636         }
02637       }
02638       qglEnable (GL_TEXTURE_2D);
02639       //--qglEnable (GL_DEPTH_TEST);
02640 #endif
02641 
02642 
02643   qglPopAttrib();
02644 }

Here is the call graph for this function:

void Patch_DrawXY patchMesh_t p  ) 
 

Definition at line 2548 of file PMESH.CPP.

References COLOR_BRUSHES, COLOR_SELBRUSHES, SavedInfo_t::colors, QEGlobals_t::d_savedinfo, DrawPatchMesh(), g_qeglobals, pm, qglColor3fv, and qglPolygonMode.

Referenced by Brush_DrawXY().

02549 {
02550     qglPolygonMode (GL_FRONT_AND_BACK, GL_LINE);
02551   if (pm->bSelected)
02552   {
02553     qglColor3fv(g_qeglobals.d_savedinfo.colors[COLOR_SELBRUSHES]);
02554     //qglDisable (GL_LINE_STIPPLE);
02555       //qglLineWidth (1);
02556   }
02557   else
02558     qglColor3fv(g_qeglobals.d_savedinfo.colors[COLOR_BRUSHES]);
02559 
02560     DrawPatchMesh( pm , pm->bSelected );
02561     qglPolygonMode (GL_FRONT_AND_BACK, GL_FILL);
02562   if (pm->bSelected)
02563   {
02564       //qglLineWidth (2);
02565     //qglEnable (GL_LINE_STIPPLE);
02566   }
02567 }

Here is the call graph for this function:

patchMesh_t* Patch_Duplicate patchMesh_t pFrom  ) 
 

Definition at line 4599 of file PMESH.CPP.

References AddBrushForPatch(), patchMesh_t::bDirty, patchMesh_t::bOverlay, patchMesh_t::bSelected, QEGlobals_t::bSurfacePropertiesPlugin, g_qeglobals, GETPLUGINTEXDEF, MakeNewPatch(), memcpy(), patchMesh_t::nListID, p, patchMesh_t::pData, and Sys_Printf().

Referenced by Brush_Clone(), Brush_FullClone(), and Patch_Thicken().

04600 {
04601   patchMesh_t* p = MakeNewPatch();
04602   memcpy(p, pFrom , sizeof(patchMesh_t));
04603   p->bSelected = false;
04604   p->bDirty = true;
04605   p->bOverlay = false;
04606   p->nListID = -1;
04607   // surface plugin
04608   if (g_qeglobals.bSurfacePropertiesPlugin)
04609   {
04610 #ifdef _DEBUG
04611     if (!pFrom->pData)
04612         Sys_Printf("WARNING: unexpected pFrom->pData is NULL in Patch_Duplicate\n");
04613     else
04614 #endif
04615         p->pData = GETPLUGINTEXDEF(pFrom)->Copy();
04616   }
04617   AddBrushForPatch(p);
04618   return p;
04619 }

Here is the call graph for this function:

void Patch_EditPatch  ) 
 

Definition at line 2789 of file PMESH.CPP.

References brush_t, patchMesh_t::ctrl, QEGlobals_t::d_num_move_points, QEGlobals_t::d_numpoints, QEGlobals_t::d_points, QEGlobals_t::d_select_mode, g_qeglobals, patchMesh_t::height, i, j, MAX_POINTS, brush_s::next, p, brush_s::patchBrush, brush_s::pPatch, selected_brushes, VectorCopy, patchMesh_t::width, and drawVert_t::xyz.

Referenced by CMainFrame::OnSelectionDragvertecies().

02790 {
02791   //--patchMesh_t* p = &patchMeshes[n];
02792   g_qeglobals.d_numpoints = 0;
02793   g_qeglobals.d_num_move_points = 0;
02794     
02795   for (brush_t *pb = selected_brushes.next ; pb != &selected_brushes ; pb = pb->next)
02796     {
02797     if (pb->patchBrush)
02798     {
02799         patchMesh_t* p = pb->pPatch;
02800         for ( int i = 0 ; i < p->width ; i++ ) 
02801       {
02802             for ( int j = 0 ; j < p->height ; j++ ) 
02803         {
02804             VectorCopy (p->ctrl[i][j].xyz, g_qeglobals.d_points[g_qeglobals.d_numpoints]);
02805           if (g_qeglobals.d_numpoints < MAX_POINTS-1)
02806           {
02807               g_qeglobals.d_numpoints++;
02808           }
02809             }
02810       }
02811     }
02812   }
02813   g_qeglobals.d_select_mode = sel_curvepoint;
02814   //--g_nSelectedPatch = n;
02815 }

void Patch_FindReplaceTexture brush_t pb,
const char *  pFind,
const char *  pReplace,
bool  bForce
 

Definition at line 4958 of file PMESH.CPP.

References brush_t, patchMesh_t::d_texture, qtexture_s::name, p, brush_s::patchBrush, brush_s::pPatch, and Texture_ForName().

Referenced by FindReplaceTextures().

04959 {
04960   if (pb->patchBrush)
04961   {
04962     patchMesh_t *p = pb->pPatch;
04963     if (bForce || strcmpi(p->d_texture->name, pFind) == 0)
04964     {
04965       p->d_texture = Texture_ForName(pReplace);
04966       //strcpy(p->d_texture->name, pReplace);
04967     }
04968   }
04969 }

Here is the call graph for this function:

void Patch_FitTexturing  ) 
 

Definition at line 4010 of file PMESH.CPP.

References patchMesh_t::bDirty, brush_t, patchMesh_t::ctrl, patchMesh_t::height, i, j, brush_s::next, p, brush_s::patchBrush, brush_s::pPatch, selected_brushes, drawVert_t::st, and patchMesh_t::width.

Referenced by CPatchDialog::OnBtnPatchfit(), and CSurfaceDlg::OnBtnPatchfit().

04011 {
04012     for (brush_t *pb = selected_brushes.next ; pb != &selected_brushes ; pb = pb->next)
04013     {
04014     if (pb->patchBrush)
04015     {
04016       patchMesh_t *p = pb->pPatch;
04017       p->bDirty = true;
04018         for ( int i = 0 ; i < p->width ; i++ ) 
04019       {
04020             for ( int j = 0 ; j < p->height ; j++ ) 
04021         {
04022                 p->ctrl[i][j].st[0] = 1 * (float)i / (p->width - 1);
04023                 p->ctrl[i][j].st[1] = 1 * (float)j / (p->height - 1);
04024             }
04025         }
04026     }
04027   }
04028 }

void Patch_Freeze  ) 
 

Definition at line 4817 of file PMESH.CPP.

References active_brushes, patchMesh_t::bOverlay, brush_t, brush_s::next, brush_s::patchBrush, brush_s::pPatch, and selected_brushes.

Referenced by CMainFrame::OnCurveFreeze().

04818 {
04819   brush_t *pb;
04820     for (pb = selected_brushes.next ; pb != &selected_brushes ; pb = pb->next)
04821     {
04822     if (pb->patchBrush)
04823     {
04824       pb->pPatch->bOverlay = false;
04825     }
04826   }
04827 
04828     for (pb = active_brushes.next ; pb != &active_brushes ; pb = pb->next)
04829     {
04830     if (pb->patchBrush)
04831     {
04832       pb->pPatch->bOverlay = false;
04833     }
04834   }
04835 
04836 }

void Patch_FromTriangle vec5_t  vx,
vec5_t  vy,
vec5_t  vz
 

Definition at line 4987 of file PMESH.CPP.

References _Vector53Copy(), _Vector5Add(), _Vector5Scale(), AddBrushForPatch(), b, brush_t, patchMesh_t::ctrl, patchMesh_t::d_texture, QEGlobals_t::d_texturewin, g_qeglobals, patchMesh_t::height, j, MakeNewPatch(), texdef_t::name, p, drawVert_t::st, texturewin_t::texdef, Texture_ForName(), patchMesh_t::type, vec5_t, patchMesh_t::width, and drawVert_t::xyz.

Referenced by PaintedModel().

04988 {
04989   patchMesh_t* p = MakeNewPatch();
04990     p->d_texture = Texture_ForName(g_qeglobals.d_texturewin.texdef.name);
04991     p->width = 3;
04992     p->height = 3;
04993   p->type = PATCH_TRIANGLE;
04994 
04995   // 0 0 goes to x
04996   // 0 1 goes to x
04997   // 0 2 goes to x
04998 
04999   // 1 0 goes to mid of x and z
05000   // 1 1 goes to mid of x y and z
05001   // 1 2 goes to mid of x and y
05002 
05003   // 2 0 goes to z
05004   // 2 1 goes to mid of y and z
05005   // 2 2 goes to y
05006 
05007   vec5_t vMidXZ;
05008   vec5_t vMidXY;
05009   vec5_t vMidYZ;
05010 
05011 
05012   for (int j = 0; j < 3; j++)
05013   {
05014     _Vector5Add(vx, vz, vMidXZ);
05015     _Vector5Scale(vMidXZ, 0.5, vMidXZ);
05016     //vMidXZ[j] = vx[j] + abs((vx[j] - vz[j]) * 0.5);
05017   }
05018 
05019   for (j = 0; j < 3; j++)
05020   {
05021     _Vector5Add(vx, vy, vMidXY);
05022     _Vector5Scale(vMidXY, 0.5, vMidXY);
05023     //vMidXY[j] = vx[j] + abs((vx[j] - vy[j]) * 0.5);
05024   }
05025 
05026   for (j = 0; j < 3; j++)
05027   {
05028     _Vector5Add(vy, vz, vMidYZ);
05029     _Vector5Scale(vMidYZ, 0.5, vMidYZ);
05030     //vMidYZ[j] = vy[j] + abs((vy[j] - vz[j]) * 0.5);
05031   }
05032 
05033   _Vector53Copy(vx, p->ctrl[0][0].xyz);
05034   _Vector53Copy(vx, p->ctrl[0][1].xyz);
05035   _Vector53Copy(vx, p->ctrl[0][2].xyz);
05036   p->ctrl[0][0].st[0] = vx[3];
05037   p->ctrl[0][0].st[1] = vx[4];
05038   p->ctrl[0][1].st[0] = vx[3];
05039   p->ctrl[0][1].st[1] = vx[4];
05040   p->ctrl[0][2].st[0] = vx[3];
05041   p->ctrl[0][2].st[1] = vx[4];
05042 
05043   _Vector53Copy(vMidXY, p->ctrl[1][0].xyz);
05044   _Vector53Copy(vx, p->ctrl[1][1].xyz);
05045   _Vector53Copy(vMidXZ, p->ctrl[1][2].xyz);
05046   p->ctrl[1][0].st[0] = vMidXY[3];
05047   p->ctrl[1][0].st[1] = vMidXY[4];
05048   p->ctrl[1][1].st[0] = vx[3];
05049   p->ctrl[1][1].st[1] = vx[4];
05050   p->ctrl[1][2].st[0] = vMidXZ[3];
05051   p->ctrl[1][2].st[1] = vMidXZ[4];
05052 
05053   _Vector53Copy(vy, p->ctrl[2][0].xyz);
05054   _Vector53Copy(vMidYZ, p->ctrl[2][1].xyz);
05055   _Vector53Copy(vz, p->ctrl[2][2].xyz);
05056   p->ctrl[2][0].st[0] = vy[3];
05057   p->ctrl[2][0].st[1] = vy[4];
05058   p->ctrl[2][1].st[0] = vMidYZ[3];
05059   p->ctrl[2][1].st[1] = vMidYZ[4];
05060   p->ctrl[2][2].st[0] = vz[3];
05061   p->ctrl[2][2].st[1] = vz[4];
05062 
05063 
05064   //Patch_Naturalize(p);
05065 
05066   brush_t *b = AddBrushForPatch(p);
05067 
05068 }

Here is the call graph for this function:

brush_t* Patch_GenericMesh int  nWidth,
int  nHeight,
int  nOrientation = 2,
bool  bDeleteSource = true,
bool  bOverride = false
 

Definition at line 1696 of file PMESH.CPP.

References abs(), AddBrushForPatch(), b, brush_t, patchMesh_t::ctrl, patchMesh_t::d_texture, QEGlobals_t::d_texturewin, g_qeglobals, patchMesh_t::height, i, j, MakeNewPatch(), brush_s::maxs, brush_s::mins, texdef_t::name, brush_s::next, p, Patch_Naturalize(), QE_SingleBrush(), Select_Brush(), Select_Delete(), selected_brushes, Sys_Printf(), texturewin_t::texdef, Texture_ForName(), patchMesh_t::type, patchMesh_t::width, and drawVert_t::xyz.

Referenced by Cap(), CapSpecial(), GenerateEndCaps(), CPatchDensityDlg::OnOK(), and Patch_Thicken().

01697 {
01698   int i,j;
01699 
01700   if (nHeight < 3 || nHeight > 15 || nWidth < 3 || nWidth > 15)
01701   {
01702     Sys_Printf("Invalid patch width or height.\n");
01703     return NULL;
01704   }
01705 
01706     if (! bOverride && !QE_SingleBrush())
01707   {
01708     Sys_Printf("Cannot generate a patch from multiple selections.\n");
01709         return NULL;
01710   }
01711 
01712 
01713 
01714   patchMesh_t* p = MakeNewPatch();
01715     p->d_texture = Texture_ForName(g_qeglobals.d_texturewin.texdef.name);
01716 
01717     p->width = nWidth;
01718     p->height = nHeight;
01719   p->type = PATCH_GENERIC;
01720 
01721   int nFirst = 0;
01722   int nSecond = 1;
01723   if (nOrientation == 0)
01724   {
01725     nFirst = 1;
01726     nSecond = 2;
01727   }
01728   else if (nOrientation == 1)
01729   {
01730     nSecond = 2;
01731   }
01732 
01733     brush_t *b = selected_brushes.next;
01734 
01735   int xStep = b->mins[nFirst];
01736   float xAdj = abs((b->maxs[nFirst] - b->mins[nFirst]) / (nWidth - 1));
01737   float yAdj = abs((b->maxs[nSecond] - b->mins[nSecond]) / (nHeight - 1));
01738 
01739   for (i = 0; i < nWidth; i++)
01740   {
01741     int yStep = b->mins[nSecond];
01742     for (j = 0; j < nHeight; j++)
01743     {
01744       p->ctrl[i][j].xyz[nFirst] = xStep;
01745       p->ctrl[i][j].xyz[nSecond] = yStep;
01746       p->ctrl[i][j].xyz[nOrientation] = 0;
01747       yStep += yAdj;
01748     }
01749     xStep += xAdj;
01750   }
01751 
01752   Patch_Naturalize(p);
01753 
01754   b = AddBrushForPatch(p);
01755   if (bDeleteSource)
01756   {
01757     Select_Delete();
01758     Select_Brush(b);
01759   }
01760 
01761   return b;
01762   //g_qeglobals.d_select_mode = sel_curvepoint;
01763 }

Here is the call graph for this function:

const char* Patch_GetKeyValue patchMesh_t p,
const char *  pKey
 

Definition at line 5090 of file PMESH.CPP.

References patchMesh_t::epairs, g_qeglobals, QEGlobals_t::m_bBrushPrimitMode, p, and ValueForKey().

Referenced by Brush_GetKeyValue().

05091 {
05092     if (g_qeglobals.m_bBrushPrimitMode)
05093     {
05094     return ValueForKey(p->epairs, pKey);
05095     }
05096   return "";
05097 }

Here is the call graph for this function:

const char* Patch_GetTextureName  ) 
 

Definition at line 4587 of file PMESH.CPP.

References b, brush_t, patchMesh_t::d_texture, qtexture_s::name, brush_s::next, p, brush_s::patchBrush, brush_s::pPatch, and selected_brushes.

Referenced by CSurfaceDlg::SetTexMods().

04588 {
04589     brush_t* b = selected_brushes.next;
04590   if (b->patchBrush)
04591   {
04592     patchMesh_t *p = b->pPatch;
04593     if (p->d_texture->name)
04594       return p->d_texture->name;
04595   }
04596   return "";
04597 }

void Patch_InsDelHandleENTER  ) 
 

Definition at line 4417 of file PMESH.CPP.

Referenced by CMainFrame::OnClipSelected().

04418 {
04419 }

void Patch_InsDelHandleTAB  ) 
 

Definition at line 4421 of file PMESH.CPP.

References b, brush_t, g_bPatchAxisOnRow, g_nPatchAxisIndex, patchMesh_t::height, brush_s::next, p, Patch_BendToggle(), Patch_InsDelToggle(), brush_s::patchBrush, brush_s::pPatch, QE_SingleBrush(), selected_brushes, Sys_Printf(), Sys_UpdateWindows(), W_ALL, and patchMesh_t::width.

Referenced by CMainFrame::OnPatchTab().

04422 {
04423   if (!g_bPatchInsertMode)
04424   {
04425     Patch_InsDelToggle();
04426     return;
04427   }
04428 
04429     brush_t* b = selected_brushes.next;
04430   if (!QE_SingleBrush() || !b->patchBrush)
04431   {
04432     Patch_BendToggle();
04433     Sys_Printf("No patch to bend!");
04434         return;
04435   }
04436 
04437   patchMesh_t *p = b->pPatch;
04438 
04439   // only able to deal with odd numbered rows/cols
04440   g_nPatchAxisIndex += 2;
04441   if (g_bPatchAxisOnRow)
04442   {
04443     if (g_nPatchAxisIndex >= p->height-1)
04444     {
04445       g_bPatchAxisOnRow = false;
04446       g_nPatchAxisIndex = 0;
04447     }
04448   }
04449   else
04450   {
04451     if (g_nPatchAxisIndex >= p->width-1)
04452     {
04453       g_bPatchAxisOnRow = true;
04454       g_nPatchAxisIndex = 0;
04455     }
04456   }
04457   Sys_UpdateWindows(W_ALL);
04458 }

Here is the call graph for this function:

void Patch_InsDelToggle  ) 
 

Definition at line 4379 of file PMESH.CPP.

References b, brush_t, g_bPatchAxisOnRow, g_bPatchInsertMode, g_nPatchAxisIndex, g_nPatchInsertState, g_pInsertStateMsg, g_pParentWnd, HideInfoDialog(), INSERT_SELECT_EDGE, brush_s::next, Patch_Save(), brush_s::patchBrush, brush_s::pPatch, QE_SingleBrush(), selected_brushes, ShowInfoDialog(), Sys_Printf(), and CMainFrame::UpdatePatchToolbarButtons().

Referenced by CMainFrame::OnPatchInsdel(), Patch_Deselect(), Patch_InsDelESC(), and Patch_InsDelHandleTAB().

04380 {
04381   if (g_bPatchInsertMode)
04382   {
04383     g_bPatchInsertMode = false;
04384     HideInfoDialog();
04385     g_pParentWnd->UpdatePatchToolbarButtons() ;
04386     return;
04387   }
04388 
04389     brush_t* b = selected_brushes.next;
04390 
04391   if (!QE_SingleBrush() || !b->patchBrush)
04392   {
04393     Sys_Printf("Must work with a single patch");
04394         return;
04395   }
04396 
04397   Patch_Save(b->pPatch);
04398     g_bPatchInsertMode = true;
04399   g_nPatchInsertState = INSERT_SELECT_EDGE;
04400   g_bPatchAxisOnRow = true;
04401   g_nPatchAxisIndex = 0;
04402   ShowInfoDialog(g_pInsertStateMsg[INSERT_SELECT_EDGE]);
04403 
04404 }

Here is the call graph for this function:

void Patch_InsertColumn patchMesh_t p,
bool  bAdd
 

Definition at line 3107 of file PMESH.CPP.

References patchMesh_t::ctrl, h(), patchMesh_t::height, i, j, memcpy(), p, UpdatePatchInspector(), vec3_t, VectorAdd, VectorCopy, VectorSubtract, w, patchMesh_t::width, and drawVert_t::xyz.

Referenced by Patch_AdjustSelected(), and Patch_AdjustSelectedRowCols().

03108 {
03109   int h, w, i, j;
03110   vec3_t vTemp;
03111   
03112   if (p->width + 2 >= MAX_PATCH_WIDTH)
03113     return;
03114 
03115   if (bAdd) // add column?
03116   {
03117     for (h = 0; h < p->height; h++)
03118     {
03119       j = p->width-1;
03120       VectorSubtract(p->ctrl[j][h].xyz, p->ctrl[j-1][h].xyz, vTemp);
03121       for (i = 0; i < 3; i++)
03122         vTemp[i] /= 3;
03123 
03124       memcpy(&p->ctrl[j+2][h],&p->ctrl[j][h], sizeof(drawVert_t));
03125       memcpy(&p->ctrl[j][h],&p->ctrl[j-1][h], sizeof(drawVert_t));
03126 
03127       VectorAdd(p->ctrl[j][h].xyz, vTemp, p->ctrl[j][h].xyz);
03128       memcpy(&p->ctrl[j+1][h], &p->ctrl[j][h], sizeof(drawVert_t));
03129       VectorAdd(p->ctrl[j+1][h].xyz, vTemp, p->ctrl[j+1][h].xyz);
03130     }
03131   }
03132   else
03133   {
03134     for (h = 0; h < p->height; h++)
03135     {
03136       w = p->width-1;
03137       while (w >= 0)
03138       {
03139         memcpy(&p->ctrl[w+2][h],&p->ctrl[w][h], sizeof(drawVert_t));
03140         w--;
03141       }
03142       VectorSubtract(p->ctrl[1][h].xyz, p->ctrl[0][h].xyz, vTemp);
03143       for (i = 0; i < 3; i++)
03144         vTemp[i] /= 3;
03145       VectorCopy(p->ctrl[0][h].xyz, p->ctrl[1][h].xyz);
03146       VectorAdd(p->ctrl[1][h].xyz, vTemp, p->ctrl[1][h].xyz);
03147       VectorCopy(p->ctrl[1][h].xyz, p->ctrl[2][h].xyz);
03148       VectorAdd(p->ctrl[2][h].xyz, vTemp, p->ctrl[2][h].xyz);
03149     }
03150   }
03151   p->width += 2;
03152   UpdatePatchInspector();
03153 }

Here is the call graph for this function:

void Patch_InsertRow patchMesh_t p,
bool  bAdd
 

Definition at line 3161 of file PMESH.CPP.

References patchMesh_t::ctrl, h(), patchMesh_t::height, i, j, memcpy(), p, UpdatePatchInspector(), vec3_t, VectorAdd, VectorCopy, VectorSubtract, w, patchMesh_t::width, and drawVert_t::xyz.

Referenced by Patch_AdjustSelected().

03162 {
03163   int h, w, i, j;
03164   vec3_t vTemp;
03165   
03166   if (p->height + 2 >= MAX_PATCH_HEIGHT)
03167     return;
03168 
03169   if (bAdd) // add column?
03170   {
03171     for (w = 0; w < p->width; w++)
03172     {
03173       j = p->height-1;
03174       VectorSubtract(p->ctrl[w][j].xyz, p->ctrl[w][j-1].xyz, vTemp);
03175       for (i = 0; i < 3; i++)
03176         vTemp[i] /= 3;
03177 
03178       memcpy(&p->ctrl[w][j+2],&p->ctrl[w][j], sizeof(drawVert_t));
03179       memcpy(&p->ctrl[w][j],&p->ctrl[w][j-1], sizeof(drawVert_t));
03180 
03181       VectorAdd(p->ctrl[w][j].xyz, vTemp, p->ctrl[w][j].xyz);
03182       memcpy(&p->ctrl[w][j+1], &p->ctrl[w][j], sizeof(drawVert_t));
03183       VectorAdd(p->ctrl[w][j+1].xyz, vTemp, p->ctrl[w][j+1].xyz);
03184     }
03185   }
03186   else
03187   {
03188     for (w = 0; w < p->width; w++)
03189     {
03190       h = p->height-1;
03191       while (h >= 0)
03192       {
03193         memcpy(&p->ctrl[w][h+2],&p->ctrl[w][h], sizeof(drawVert_t));
03194         h--;
03195       }
03196       VectorSubtract(p->ctrl[w][1].xyz, p->ctrl[w][0].xyz, vTemp);
03197       for (i = 0; i < 3; i++)
03198         vTemp[i] /= 3;
03199       VectorCopy(p->ctrl[w][0].xyz, p->ctrl[w][1].xyz);
03200       VectorAdd(p->ctrl[w][1].xyz, vTemp, p->ctrl[w][1].xyz);
03201       VectorCopy(p->ctrl[w][1].xyz, p->ctrl[w][2].xyz);
03202       VectorAdd(p->ctrl[w][2].xyz, vTemp, p->ctrl[w][2].xyz);
03203     }
03204   }
03205   p->height += 2;
03206   UpdatePatchInspector();
03207 }

Here is the call graph for this function:

void Patch_InvertTexture bool  bY  ) 
 

Definition at line 3913 of file PMESH.CPP.

References patchMesh_t::bDirty, brush_t, patchMesh_t::ctrl, patchMesh_t::height, i, j, memcpy(), brush_s::next, p, brush_s::patchBrush, brush_s::pPatch, selected_brushes, drawVert_t::st, Sys_UpdateWindows(), UpdatePatchInspector(), W_ALL, and patchMesh_t::width.

Referenced by CMainFrame::OnCurveNegativeTextureX(), and CMainFrame::OnCurveNegativeTextureY().

03914 {
03915   bool bUpdate = false;
03916 
03917   float fTemp[2];
03918     for (brush_t *pb = selected_brushes.next ; pb != &selected_brushes ; pb = pb->next)
03919     {
03920     if (pb->patchBrush)
03921     {
03922       bUpdate = true;
03923       patchMesh_t *p = pb->pPatch;
03924       p->bDirty = true;
03925       if (bY)
03926       {
03927           for ( int i = 0 ; i < p->height ; i++ ) 
03928         {
03929           for (int j = 0; j < p->width / 2; j++)
03930           {
03931             memcpy(fTemp, &p->ctrl[p->width - 1- j][i].st[0], sizeof (float[2]));
03932             memcpy(&p->ctrl[p->width - 1- j][i].st[0], &p->ctrl[j][i].st[0], sizeof(float[2]));
03933             memcpy(&p->ctrl[j][i].st[0], fTemp, sizeof(float[2]));
03934               }
03935           }
03936       }
03937       else
03938       {
03939           for ( int i = 0 ; i < p->width ; i++ ) 
03940         {
03941           for (int j = 0; j < p->height / 2; j++)
03942           {
03943             memcpy(fTemp, &p->ctrl[i][p->height - 1- j].st[0], sizeof (float[2]));
03944             memcpy(&p->ctrl[i][p->height - 1 - j].st[0], &p->ctrl[i][j].st[0], sizeof(float[2]));
03945             memcpy(&p->ctrl[i][j].st[0], fTemp, sizeof(float[2]));
03946               }
03947           }
03948       }
03949     }
03950   }
03951 
03952   if (bUpdate)
03953   {
03954     Sys_UpdateWindows(W_ALL);
03955   }
03956   UpdatePatchInspector();
03957 }

Here is the call graph for this function:

int Patch_MemorySize patchMesh_t p  ) 
 

Definition at line 189 of file PMESH.CPP.

References p.

Referenced by Brush_MemorySize().

00190 {
00191     return _msize(p);
00192 }

void Patch_Move patchMesh_t p,
const vec3_t  vMove,
bool  bRebuild = false
 

Definition at line 2732 of file PMESH.CPP.

References h(), Patch_CalcBounds(), pm, UpdatePatchInspector(), vec3_t, VectorAdd, and w.

Referenced by Brush_Move(), and Patch_DragScale().

02733 {
02734   pm->bDirty = true;
02735   for (int w = 0; w < pm->width; w++)
02736   {
02737     for (int h = 0; h < pm->height; h++)
02738     {
02739       VectorAdd(pm->ctrl[w][h].xyz, vMove, pm->ctrl[w][h].xyz);
02740     }
02741   }
02742   if (bRebuild)
02743   {
02744     vec3_t vMin, vMax;
02745     Patch_CalcBounds(pm, vMin, vMax);
02746     //Brush_RebuildBrush(patchMeshes[n].pSymbiot, vMin, vMax);
02747   }
02748   UpdatePatchInspector();
02749 
02750 }

Here is the call graph for this function:

void Patch_NaturalizeSelected bool  bCap = false,
bool  bCycleCap = false
 

Definition at line 4534 of file PMESH.CPP.

References brush_t, brush_s::next, Patch_CapTexture(), Patch_Naturalize(), brush_s::patchBrush, brush_s::pPatch, and selected_brushes.

Referenced by END_MESSAGE_MAP(), CSurfaceDlg::OnBtnPatchdetails(), CSurfaceDlg::OnBtnPatchnatural(), CPatchDialog::OnBtnPatchnatural(), CMainFrame::OnCurveCyclecap(), and CMainFrame::OnPatchNaturalize().

04535 {
04536     for (brush_t *pb = selected_brushes.next ; pb != &selected_brushes ; pb = pb->next)
04537     {
04538     if (pb->patchBrush)
04539     {
04540       if (bCap)
04541         Patch_CapTexture(pb->pPatch, bCycleCap);
04542       else
04543         Patch_Naturalize(pb->pPatch);
04544     }
04545   }
04546 }

Here is the call graph for this function:

void Patch_NaturalTexturing  ) 
 

brush_t* Patch_Parse bool  bOld  ) 
 

Definition at line 3568 of file PMESH.CPP.

References AddBrushForPatch(), atoi, b, brush_t, QEGlobals_t::bSurfacePropertiesPlugin, epair_t, g_qeglobals, GETPLUGINTEXDEF, GetToken(), h(), QEGlobals_t::m_bBrushPrimitMode, MakeNewPatch(), epair_s::next, Parse3DMatrix(), ParseEpair(), pm, strcmp(), Sys_Printf(), Texture_ForName(), and w.

Referenced by Brush_Parse().

03569 {
03570     //--if (bOld)
03571     //--{
03572     //--  return Patch_ParseOld();
03573     //--}
03574 
03575   GetToken(true);
03576     
03577   if (strcmp(token, "{"))
03578     return NULL;
03579 
03580     patchMesh_t *pm = MakeNewPatch();
03581 
03582     if (g_qeglobals.bSurfacePropertiesPlugin)
03583     {
03584         GETPLUGINTEXDEF(pm)->ParsePatchTexdef();
03585     }
03586     else
03587     {
03588         // texture def
03589         GetToken(true);
03590         
03591         // band-aid 
03592         if (strcmp(token, "("))
03593         {
03594             pm->d_texture = Texture_ForName(token);
03595             GetToken(true);
03596         }
03597         else
03598         {
03599             pm->d_texture = notexture;
03600             Sys_Printf("Warning: Patch read with no texture, using notexture... \n");
03601         }               
03602         
03603         if (strcmp(token, "("))
03604             return NULL;
03605         
03606         // width, height, flags (currently only negative)
03607         GetToken(false);
03608         pm->width = atoi(token);
03609         
03610         GetToken(false);
03611         pm->height = atoi(token);
03612         
03613         GetToken(false);
03614         pm->contents = atoi(token);
03615         
03616         GetToken(false);
03617         pm->flags = atoi(token);
03618         
03619         GetToken(false);
03620         pm->value = atoi(token);
03621         
03622         if (!bOld)
03623         {
03624             GetToken(false);
03625             pm->type = atoi(token);
03626         }
03627         
03628         GetToken(false);
03629         if (strcmp(token, ")"))
03630             return NULL;
03631         
03632     }
03633 
03634 
03635 
03636   float ctrl[MAX_PATCH_WIDTH][MAX_PATCH_HEIGHT][5];
03637   Parse3DMatrix(pm->width, pm->height, 5, reinterpret_cast<float*>(&ctrl));
03638 
03639   int w, h;
03640 
03641   for (w = 0; w < pm->width; w++)
03642   {
03643     for (h = 0; h < pm->height; h++)
03644     {
03645       pm->ctrl[w][h].xyz[0] = ctrl[w][h][0];  
03646       pm->ctrl[w][h].xyz[1] = ctrl[w][h][1];  
03647       pm->ctrl[w][h].xyz[2] = ctrl[w][h][2];  
03648       pm->ctrl[w][h].st[0] = ctrl[w][h][3]; 
03649       pm->ctrl[w][h].st[1] = ctrl[w][h][4];  
03650     }
03651   }
03652 
03653   GetToken(true);
03654 
03655     if (g_qeglobals.m_bBrushPrimitMode)
03656   {
03657     // we are in brush primit mode, but maybe it's a classic patch that needs converting, test "}"
03658     if (strcmp(token, "}") && strcmp (token, "(") )
03659       {
03660           epair_t *ep = ParseEpair();
03661           ep->next = pm->epairs;
03662           pm->epairs = ep;
03663       GetToken(true);
03664       }
03665   }
03666 
03667   if (strcmp(token, "}"))
03668     return NULL;
03669 
03670   brush_t *b = AddBrushForPatch(pm, false);
03671 
03672   return b;
03673 }

Here is the call graph for this function:

void Patch_ReadBuffer char *  pBuff,
bool  bSelect = false
 

Referenced by CXYWnd::Paste().

void Patch_ReadFile char *  name  ) 
 

Definition at line 62 of file cbrushstub.cpp.

00062 {};

void WINAPI Patch_Rebuild patchMesh_t p  ) 
 

Definition at line 528 of file PMESH.CPP.

References patchMesh_t::bDirty, Brush_RebuildBrush(), p, Patch_CalcBounds(), patchMesh_t::pSymbiot, and vec3_t.

Referenced by Cap(), CapSpecial(), Patch_DisperseColumns(), Patch_DisperseRows(), Patch_Thicken(), and Patch_Transpose().

00529 {
00530   vec3_t vMin, vMax;
00531   Patch_CalcBounds(p, vMin, vMax);
00532   Brush_RebuildBrush(p->pSymbiot, vMin, vMax);
00533   p->bDirty = true;
00534 }

Here is the call graph for this function:

void Patch_RemoveColumn patchMesh_t p,
bool  bFirst
 

Definition at line 3242 of file PMESH.CPP.

References patchMesh_t::ctrl, h(), patchMesh_t::height, memcpy(), p, UpdatePatchInspector(), w, and patchMesh_t::width.

Referenced by Patch_AdjustSelected().

03243 {
03244   
03245   if (p->width <= MIN_PATCH_WIDTH)
03246     return;
03247 
03248   p->width -= 2;
03249 
03250   if (bFirst)
03251   {
03252     for (int h = 0; h < p->height; h++)
03253     {
03254       for (int w = 0; w < p->width; w++)
03255       {
03256         memcpy(&p->ctrl[w][h], &p->ctrl[w+2][h], sizeof(drawVert_t));
03257       }
03258     }
03259   }
03260   UpdatePatchInspector();
03261 }

Here is the call graph for this function:

void Patch_RemoveRow patchMesh_t p,
bool  bFirst
 

Definition at line 3215 of file PMESH.CPP.

References patchMesh_t::ctrl, h(), patchMesh_t::height, memcpy(), p, UpdatePatchInspector(), w, and patchMesh_t::width.

Referenced by Patch_AdjustSelected().

03216 {
03217   
03218   if (p->height <= MIN_PATCH_HEIGHT)
03219     return;
03220 
03221   p->height -= 2;
03222 
03223   if (bFirst)
03224   {
03225     for (int w = 0; w < p->width; w++)
03226     {
03227       for (int h = 0; h < p->height; h++)
03228       {
03229         memcpy(&p->ctrl[w][h], &p->ctrl[w][h+2], sizeof(drawVert_t));
03230       }
03231     }
03232   }
03233   UpdatePatchInspector();
03234 }

Here is the call graph for this function:

void Patch_ReplaceQTexture brush_t pb,
qtexture_t pOld,
qtexture_t pNew
 

Definition at line 4971 of file PMESH.CPP.

References brush_t, patchMesh_t::d_texture, p, brush_s::patchBrush, brush_s::pPatch, and qtexture_t.

Referenced by ReplaceQTexture().

04972 {
04973   if (pb->patchBrush)
04974   {
04975     patchMesh_t *p = pb->pPatch;
04976     if (p->d_texture == pOld)
04977     {
04978       p->d_texture = pNew;
04979     }
04980   }
04981 }

void Patch_ResetTexturing float  fx,
float  fy
 

Definition at line 3989 of file PMESH.CPP.

References patchMesh_t::bDirty, brush_t, patchMesh_t::ctrl, patchMesh_t::height, i, j, brush_s::next, p, brush_s::patchBrush, brush_s::pPatch, selected_brushes, drawVert_t::st, and patchMesh_t::width.

Referenced by CSurfaceDlg::OnBtnPatchreset(), and CPatchDialog::OnBtnPatchreset().

03990 {
03991     for (brush_t* pb = selected_brushes.next ; pb != &selected_brushes ; pb = pb->next)
03992     {
03993     if (pb->patchBrush)
03994     {
03995       patchMesh_t *p = pb->pPatch;
03996       p->bDirty = true;
03997         for ( int i = 0 ; i < p->width ; i++ ) 
03998       {
03999             for ( int j = 0 ; j < p->height ; j++ ) 
04000         {
04001                 p->ctrl[i][j].st[0] = fx * (float)i / (p->width - 1);
04002                 p->ctrl[i][j].st[1] = fy * (float)j / (p->height - 1);
04003             }
04004         }
04005     }
04006   }
04007 }

void Patch_Restore patchMesh_t p  ) 
 

Definition at line 3982 of file PMESH.CPP.

References patchMesh_t::ctrl, patchMesh_t::height, memcpy(), p, patchSave, and patchMesh_t::width.

Referenced by Patch_BendHandleESC().

03983 {
03984   p->width = patchSave.width;
03985   p->height = patchSave.height;
03986   memcpy(p->ctrl, patchSave.ctrl, sizeof(p->ctrl));
03987 }

Here is the call graph for this function:

void Patch_RotateTexture patchMesh_t p,
float  fAngle
 

Definition at line 3781 of file PMESH.CPP.

References patchMesh_t::bDirty, cos(), patchMesh_t::ctrl, QEGlobals_t::d_select_mode, g_qeglobals, h(), patchMesh_t::height, p, Patch_CalcBounds(), PointInMoveList(), Q_PI, sel_curvepoint, sin(), drawVert_t::st, vec3_t, w, patchMesh_t::width, x, drawVert_t::xyz, and y.

Referenced by Patch_SetTextureInfo(), and Select_RotateTexture().

03782 {
03783   vec3_t vMin, vMax;
03784   Patch_CalcBounds(p, vMin, vMax);
03785   p->bDirty = true;
03786   for (int w = 0; w < p->width; w++)
03787   {
03788     for (int h = 0; h < p->height; h++)
03789     {
03790       if (g_qeglobals.d_select_mode == sel_curvepoint && PointInMoveList(p->ctrl[w][h].xyz) == -1)
03791         continue;
03792 
03793       float x = p->ctrl[w][h].st[0];
03794       float y = p->ctrl[w][h].st[1];
03795       p->ctrl[w][h].st[0] = x * cos(fAngle * Q_PI / 180) - y * sin(fAngle * Q_PI / 180);
03796       p->ctrl[w][h].st[1] = y * cos(fAngle * Q_PI / 180) + x * sin(fAngle * Q_PI / 180);
03797     }
03798   }
03799 }

Here is the call graph for this function:

void Patch_Save patchMesh_t p  ) 
 

Definition at line 3969 of file PMESH.CPP.

References patchMesh_t::ctrl, patchMesh_t::height, memcpy(), p, patchSave, and patchMesh_t::width.

Referenced by Patch_BendToggle(), and Patch_InsDelToggle().

03970 {
03971   patchSave.width = p->width;
03972   patchSave.height = p->height;
03973   memcpy(patchSave.ctrl, p->ctrl, sizeof(p->ctrl));
03974 }

Here is the call graph for this function:

void Patch_Scale patchMesh_t p,
const vec3_t  vOrigin,
const vec3_t  vAmt,
bool  bRebuilt = true
 

Definition at line 2913 of file PMESH.CPP.

References Brush_RebuildBrush(), patchMesh_t::ctrl, QEGlobals_t::d_select_mode, g_qeglobals, h(), patchMesh_t::height, i, p, Patch_CalcBounds(), PointInMoveList(), patchMesh_t::pSymbiot, sel_curvepoint, UpdatePatchInspector(), vec3_t, w, patchMesh_t::width, and drawVert_t::xyz.

Referenced by Patch_DragScale(), and Select_Scale().

02914 {
02915 
02916   for (int w = 0; w < p->width; w++)
02917   {
02918     for (int h = 0; h < p->height; h++)
02919     {
02920       if (g_qeglobals.d_select_mode == sel_curvepoint && PointInMoveList(p->ctrl[w][h].xyz) == -1)
02921         continue;
02922             for (int i=0 ; i<3 ; i++)
02923             {
02924         p->ctrl[w][h].xyz[i] -= vOrigin[i];
02925         p->ctrl[w][h].xyz[i] *= vAmt[i];
02926         p->ctrl[w][h].xyz[i] += vOrigin[i];
02927       }
02928     }
02929   }
02930   if (bRebuild)
02931   {
02932     vec3_t vMin, vMax;
02933     Patch_CalcBounds(p, vMin, vMax);
02934     Brush_RebuildBrush(p->pSymbiot, vMin, vMax);
02935   }
02936   UpdatePatchInspector();
02937 }

Here is the call graph for this function:

void Patch_ScaleTexture patchMesh_t p,
float  fx,
float  fy,
bool  bFixup = true
 

Definition at line 3807 of file PMESH.CPP.

References patchMesh_t::bDirty, patchMesh_t::ctrl, QEGlobals_t::d_select_mode, g_qeglobals, h(), patchMesh_t::height, p, PointInMoveList(), sel_curvepoint, drawVert_t::st, w, patchMesh_t::width, and drawVert_t::xyz.

Referenced by Patch_SetTextureInfo(), and Select_ScaleTexture().

03808 {
03809   // FIXME:
03810   // this hack turns scales into 1.1 or 0.9
03811   if (bFixup)
03812   {
03813     fx = (fx == 0) ? 1.0 : (fx > 0) ? 0.9 : 1.10;
03814     fy = (fy == 0) ? 1.0 : (fy > 0) ? 0.9 : 1.10;
03815   }
03816   else
03817   {
03818     if (fx == 0)
03819       fx = 1.0;
03820     if (fy == 0)
03821       fy = 1.0;
03822   }
03823   
03824   for (int w = 0; w < p->width; w++)
03825   {
03826     for (int h = 0; h < p->height; h++)
03827     {
03828       if (g_qeglobals.d_select_mode == sel_curvepoint && PointInMoveList(p->ctrl[w][h].xyz) == -1)
03829         continue;
03830 
03831       p->ctrl[w][h].st[0] *= fx;
03832       p->ctrl[w][h].st[1] *= fy;
03833     }
03834   }
03835   p->bDirty = true;
03836 }

Here is the call graph for this function:

void Patch_Select patchMesh_t p  ) 
 

Definition at line 2853 of file PMESH.CPP.

References patchMesh_t::bSelected, and p.

Referenced by Brush_AddToList().

02854 {
02855   // maintained for point manip.. which i need to fix as this 
02856   // is pf error prone
02857   //--g_nSelectedPatch = n;
02858   p->bSelected = true;
02859 }

void Patch_SelectAreaPoints  ) 
 

Definition at line 4563 of file PMESH.CPP.

References brush_t, patchMesh_t::ctrl, QEGlobals_t::d_move_points, QEGlobals_t::d_num_move_points, QEGlobals_t::d_vAreaBR, QEGlobals_t::d_vAreaTL, g_nPatchClickedView, g_qeglobals, patchMesh_t::height, i, j, brush_s::next, p, brush_s::patchBrush, brush_s::pPatch, selected_brushes, patchMesh_t::width, within(), and drawVert_t::xyz.

Referenced by Drag_MouseUp().

04564 {
04565   g_qeglobals.d_num_move_points = 0;
04566   g_nPatchClickedView = -1;
04567 
04568     for (brush_t *pb = selected_brushes.next ; pb != &selected_brushes ; pb = pb->next)
04569     {
04570     if (pb->patchBrush)
04571     {
04572       patchMesh_t *p = pb->pPatch;
04573       for (int i = 0; i < p->width; i++)
04574       {
04575         for (int j = 0; j < p->height; j++)
04576         {
04577           if (within(p->ctrl[i][j].xyz, g_qeglobals.d_vAreaTL, g_qeglobals.d_vAreaBR))
04578           {
04579             g_qeglobals.d_move_points[g_qeglobals.d_num_move_points++] = p->ctrl[i][j].xyz;
04580           }
04581         }
04582       }
04583     }
04584   }
04585 }

Here is the call graph for this function:

void Patch_SelectBendAxis  ) 
 

Definition at line 4310 of file PMESH.CPP.

References b, brush_t, g_nPatchAxisIndex, brush_s::next, p, Patch_BendToggle(), Patch_SetBendRotateOrigin(), brush_s::patchBrush, brush_s::pPatch, QE_SingleBrush(), SelectColumn(), selected_brushes, and SelectRow().

Referenced by MoveSelection().

04311 {
04312     brush_t* b = selected_brushes.next;
04313   if (!QE_SingleBrush() || !b->patchBrush)
04314   {
04315     // should not ever happen
04316     Patch_BendToggle();
04317         return;
04318   }
04319 
04320   patchMesh_t *p = b->pPatch;
04321   if (g_bPatchAxisOnRow)
04322   {
04323     SelectRow(p, g_nPatchAxisIndex, false);
04324   }
04325   else
04326   {
04327     SelectColumn(p, g_nPatchAxisIndex, false);
04328   }
04329 
04330   //FIXME: this only needs to be set once... 
04331   Patch_SetBendRotateOrigin(p);
04332 
04333 }

Here is the call graph for this function:

void Patch_SelectBendNormal  ) 
 

Definition at line 4335 of file PMESH.CPP.

References b, brush_t, QEGlobals_t::d_num_move_points, g_qeglobals, patchMesh_t::height, j, brush_s::next, p, Patch_BendToggle(), Patch_SetBendRotateOrigin(), brush_s::patchBrush, brush_s::pPatch, QE_SingleBrush(), SelectColumn(), selected_brushes, SelectRow(), and patchMesh_t::width.

Referenced by MoveSelection().

04336 {
04337     brush_t* b = selected_brushes.next;
04338   if (!QE_SingleBrush() || !b->patchBrush)
04339   {
04340     // should not ever happen
04341     Patch_BendToggle();
04342         return;
04343   }
04344 
04345   patchMesh_t *p = b->pPatch;
04346 
04347   g_qeglobals.d_num_move_points = 0;
04348   if (g_bPatchAxisOnRow)
04349   {
04350     if (g_bPatchLowerEdge)
04351     {
04352       for (int j = 0; j < g_nPatchAxisIndex; j++)
04353         SelectRow(p, j, true);
04354     }
04355     else
04356     {
04357       for (int j = p->height-1; j > g_nPatchAxisIndex; j--)
04358         SelectRow(p, j, true);
04359     }
04360   }
04361   else
04362   {
04363     if (g_bPatchLowerEdge)
04364     {
04365       for (int j = 0; j < g_nPatchAxisIndex; j++)
04366         SelectColumn(p, j, true);
04367     }
04368     else
04369     {
04370       for (int j = p->width-1; j > g_nPatchAxisIndex; j--)
04371         SelectColumn(p, j, true);
04372     }
04373   }
04374   Patch_SetBendRotateOrigin(p);
04375 }

Here is the call graph for this function:

void Patch_SetEpair patchMesh_t p,
const char *  pKey,
const char *  pValue
 

Definition at line 5077 of file PMESH.CPP.

References patchMesh_t::epairs, g_qeglobals, QEGlobals_t::m_bBrushPrimitMode, p, and SetKeyValue().

Referenced by Brush_SetEpair().

05078 {
05079     if (g_qeglobals.m_bBrushPrimitMode)
05080     {
05081         SetKeyValue(p->epairs, pKey, pValue);
05082     }
05083 }

Here is the call graph for this function:

void Patch_SetOverlays  ) 
 

Definition at line 4782 of file PMESH.CPP.

References patchMesh_t::bOverlay, brush_t, brush_s::next, brush_s::patchBrush, brush_s::pPatch, and selected_brushes.

Referenced by CMainFrame::OnCurveOverlaySet().

04783 {
04784     for (brush_t *pb = selected_brushes.next ; pb != &selected_brushes ; pb = pb->next)
04785     {
04786     if (pb->patchBrush)
04787     {
04788       pb->pPatch->bOverlay = true;
04789     }
04790   }
04791 }

void Patch_SetTexture patchMesh_t p,
texdef_t tex_def,
IPluginTexdef pPlugTexdef = NULL
 

Definition at line 2971 of file PMESH.CPP.

References QEGlobals_t::bSurfacePropertiesPlugin, patchMesh_t::d_texture, g_qeglobals, g_SurfaceTable, GETPLUGINTEXDEF, _QERPlugSurfaceTable::m_pfnPatchAlloc, texdef_t::name, p, patchMesh_t::pData, pPlugTexdef, Sys_Printf(), Texture_ForName(), and UpdatePatchInspector().

Referenced by Brush_SetTexture().

02972 {
02973   p->d_texture = Texture_ForName(tex_def->name);
02974   if (g_qeglobals.bSurfacePropertiesPlugin)
02975   {
02976 #ifdef _DEBUG
02977       if (!p->pData)
02978           Sys_Printf("WARNING: unexpected p->pData is NULL in Patch_SetTexture\n");
02979       else
02980 #endif
02981           GETPLUGINTEXDEF(p)->DecRef();
02982       if (pPlugTexdef)
02983       {
02984         p->pData = pPlugTexdef->Copy();
02985         GETPLUGINTEXDEF(p)->Hook(p);
02986       }
02987       else
02988       {
02989           g_SurfaceTable.m_pfnPatchAlloc( p );
02990           GETPLUGINTEXDEF(p)->SetDefaultTexdef();
02991       }   
02992   }
02993   UpdatePatchInspector();
02994 }

Here is the call graph for this function:

void Patch_SetTextureInfo texdef_t pt  ) 
 

Definition at line 4031 of file PMESH.CPP.

References brush_t, texdef_t::contents, patchMesh_t::contents, texdef_t::flags, patchMesh_t::flags, brush_s::next, p, Patch_RotateTexture(), Patch_ScaleTexture(), Patch_ShiftTexture(), brush_s::patchBrush, brush_s::pPatch, texdef_t::rotate, texdef_t::scale, selected_brushes, texdef_t::shift, texdef_t::value, and patchMesh_t::value.

Referenced by CSurfaceDlg::UpdateSpinners(), and CPatchDialog::UpdateSpinners().

04032 {
04033     for (brush_t *pb = selected_brushes.next ; pb != &selected_brushes ; pb = pb->next)
04034     {
04035     if (pb->patchBrush)
04036     {
04037       if (pt->rotate)
04038         Patch_RotateTexture(pb->pPatch, pt->rotate);
04039 
04040       if (pt->shift[0] || pt->shift[1])
04041         Patch_ShiftTexture(pb->pPatch, pt->shift[0], pt->shift[1]);
04042 
04043       if (pt->scale[0] || pt->scale[1])
04044         Patch_ScaleTexture(pb->pPatch, pt->scale[0], pt->scale[1], false);
04045 
04046       patchMesh_t *p = pb->pPatch;
04047       p->contents = pt->contents;
04048       p->flags = pt->flags;
04049       p->value = pt->value;
04050     }
04051   }
04052 }

Here is the call graph for this function:

void Patch_SetView int  n  ) 
 

Definition at line 2958 of file PMESH.CPP.

References g_bSameView, g_nPatchClickedView, and n.

Referenced by CCamWnd::Cam_MouseDown(), and CXYWnd::XY_MouseDown().

02959 {
02960   g_bSameView = (n == g_nPatchClickedView);
02961   g_nPatchClickedView = n;
02962 }

void Patch_ShiftTexture patchMesh_t p,
float  fx,
float  fy
 

Definition at line 3844 of file PMESH.CPP.

References abs(), patchMesh_t::bDirty, patchMesh_t::ctrl, QEGlobals_t::d_select_mode, g_qeglobals, h(), patchMesh_t::height, p, PointInMoveList(), sel_curvepoint, drawVert_t::st, w, patchMesh_t::width, and drawVert_t::xyz.

Referenced by Patch_SetTextureInfo(), and Select_ShiftTexture().

03845 {
03846   //if (fx)
03847   //  fx = (fx > 0) ? 0.1 : -0.1;
03848   //if (fy)
03849   //  fy = (fy > 0) ? 0.1 : -0.1;
03850 
03851   fx = (abs(fx) >= 1) ? fx / 10 : fx;
03852   fy = (abs(fy) >= 1) ? fy / 10 : fy;
03853 
03854   for (int w = 0; w < p->width; w++)
03855   {
03856     for (int h = 0; h < p->height; h++)
03857     {
03858       if (g_qeglobals.d_select_mode == sel_curvepoint && PointInMoveList(p->ctrl[w][h].xyz) == -1)
03859         continue;
03860 
03861       p->ctrl[w][h].st[0] += fx;
03862       p->ctrl[w][h].st[1] += fy;
03863     }
03864   }
03865   p->bDirty = true;
03866 }

Here is the call graph for this function:

void Patch_StartInsDel  ) 
 

void Patch_Thicken int  nAmount,
bool  bSeam
 

Definition at line 4622 of file PMESH.CPP.

References b, Brush_RebuildBrush(), brush_t, patchMesh_t::ctrl, e, Eclass_ForName(), eclass_t, Entity_Create(), h(), patchMesh_t::height, i, j, brush_s::next, drawVert_t::normal, p, Patch_CalcBounds(), Patch_Duplicate(), Patch_GenericMesh(), Patch_MeshNormals(), Patch_Naturalize(), Patch_Rebuild(), brush_s::patchBrush, patchInvert(), brush_s::pPatch, patchMesh_t::pSymbiot, QE_SingleBrush(), Select_Brush(), selected_brushes, SetKeyValue(), Sys_Printf(), patchMesh_t::type, UpdatePatchInspector(), vec3_t, VectorAdd, VectorCopy, VectorMA, VectorScale, w, patchMesh_t::width, and drawVert_t::xyz.

Referenced by CMainFrame::OnCurveThicken().

04623 {
04624   int i, j, h, w;
04625   brush_t *b;
04626   patchMesh_t *pSeam;
04627   vec3_t vMin, vMax;
04628   CPtrArray brushes;
04629 
04630   nAmount = -nAmount;
04631 
04632 
04633     if (!QE_SingleBrush())
04634   {
04635     Sys_Printf("Cannot thicken multiple patches. Please select a single patch.\n");
04636         return;
04637   }
04638 
04639     for (brush_t *pb = selected_brushes.next ; pb != &selected_brushes ; pb = pb->next)
04640     {
04641     if (pb->patchBrush)
04642     {
04643       patchMesh_t *p = pb->pPatch;
04644       Patch_MeshNormals(p);
04645       patchMesh_t *pNew = Patch_Duplicate(p);
04646       for (i = 0; i < p->width; i++)
04647       {
04648         for (j = 0; j < p->height; j++)
04649         {
04650               VectorMA (p->ctrl[i][j].xyz, nAmount, p->ctrl[i][j].normal, pNew->ctrl[i][j].xyz);
04651         }
04652       }
04653 
04654       Patch_Rebuild(pNew);
04655       pNew->type |= PATCH_THICK;
04656       brushes.Add(pNew->pSymbiot);
04657 
04658       if (bSeam)
04659       {
04660 
04661         // FIXME: this should detect if any edges of the patch are closed and act appropriately
04662         // 
04663         if (!(p->type & PATCH_CYLINDER))
04664         {
04665           b = Patch_GenericMesh(3, p->height, 2, false, true);
04666           pSeam = b->pPatch;
04667           pSeam->type |= PATCH_SEAM;
04668           for (i = 0; i < p->height; i++)
04669           {
04670             VectorCopy(p->ctrl[0][i].xyz, pSeam->ctrl[0][i].xyz);
04671             VectorCopy(pNew->ctrl[0][i].xyz, pSeam->ctrl[2][i].xyz);
04672             VectorAdd(pSeam->ctrl[0][i].xyz, pSeam->ctrl[2][i].xyz, pSeam->ctrl[1][i].xyz);
04673             VectorScale(pSeam->ctrl[1][i].xyz, 0.5, pSeam->ctrl[1][i].xyz);
04674           }
04675 
04676 
04677           Patch_CalcBounds(pSeam, vMin, vMax);
04678           Brush_RebuildBrush(pSeam->pSymbiot, vMin, vMax);
04679           //--Patch_CapTexture(pSeam);
04680           Patch_Naturalize(pSeam);
04681           patchInvert(pSeam);
04682           brushes.Add(b);
04683 
04684           w = p->width - 1;
04685           b = Patch_GenericMesh(3, p->height, 2, false, true);
04686           pSeam = b->pPatch;
04687           pSeam->type |= PATCH_SEAM;
04688           for (i = 0; i < p->height; i++)
04689           {
04690             VectorCopy(p->ctrl[w][i].xyz, pSeam->ctrl[0][i].xyz);
04691             VectorCopy(pNew->ctrl[w][i].xyz, pSeam->ctrl[2][i].xyz);
04692             VectorAdd(pSeam->ctrl[0][i].xyz, pSeam->ctrl[2][i].xyz, pSeam->ctrl[1][i].xyz);
04693             VectorScale(pSeam->ctrl[1][i].xyz, 0.5, pSeam->ctrl[1][i].xyz);
04694           }
04695           Patch_CalcBounds(pSeam, vMin, vMax);
04696           Brush_RebuildBrush(pSeam->pSymbiot, vMin, vMax);
04697           //--Patch_CapTexture(pSeam);
04698           Patch_Naturalize(pSeam);
04699           brushes.Add(b);
04700         }
04701     
04702         //--{
04703           // otherwise we will add one per end
04704           b = Patch_GenericMesh(p->width, 3, 2, false, true);
04705           pSeam = b->pPatch;
04706           pSeam->type |= PATCH_SEAM;
04707           for (i = 0; i < p->width; i++)
04708           {
04709             VectorCopy(p->ctrl[i][0].xyz, pSeam->ctrl[i][0].xyz);
04710             VectorCopy(pNew->ctrl[i][0].xyz, pSeam->ctrl[i][2].xyz);
04711             VectorAdd(pSeam->ctrl[i][0].xyz, pSeam->ctrl[i][2].xyz, pSeam->ctrl[i][1].xyz);
04712             VectorScale(pSeam->ctrl[i][1].xyz, 0.5, pSeam->ctrl[i][1].xyz);
04713           }
04714 
04715 
04716           Patch_CalcBounds(pSeam, vMin, vMax);
04717           Brush_RebuildBrush(pSeam->pSymbiot, vMin, vMax);
04718           //--Patch_CapTexture(pSeam);
04719           Patch_Naturalize(pSeam);
04720           patchInvert(pSeam);
04721           brushes.Add(b);
04722 
04723           h = p->height - 1;
04724           b = Patch_GenericMesh(p->width, 3, 2, false, true);
04725           pSeam = b->pPatch;
04726           pSeam->type |= PATCH_SEAM;
04727           for (i = 0; i < p->width; i++)
04728           {
04729             VectorCopy(p->ctrl[i][h].xyz, pSeam->ctrl[i][0].xyz);
04730             VectorCopy(pNew->ctrl[i][h].xyz, pSeam->ctrl[i][2].xyz);
04731             VectorAdd(pSeam->ctrl[i][0].xyz, pSeam->ctrl[i][2].xyz, pSeam->ctrl[i][1].xyz);
04732             VectorScale(pSeam->ctrl[i][1].xyz, 0.5, pSeam->ctrl[i][1].xyz);
04733           }
04734           Patch_CalcBounds(pSeam, vMin, vMax);
04735           Brush_RebuildBrush(pSeam->pSymbiot, vMin, vMax);
04736           //--Patch_CapTexture(pSeam);
04737           Patch_Naturalize(pSeam);
04738           brushes.Add(b);
04739 
04740           eclass_t *pecNew = Eclass_ForName("func_group", false);
04741           if (pecNew)
04742           {
04743             entity_t *e = Entity_Create(pecNew);
04744             SetKeyValue(e, "type", "patchThick");
04745           }
04746 
04747         
04748         //--}
04749       }
04750       patchInvert(pNew);
04751     }
04752   }
04753 
04754   for (i = 0; i < brushes.GetSize(); i++)
04755   {
04756     Select_Brush(reinterpret_cast<brush_t*>(brushes.GetAt(i)));
04757   }
04758 
04759   UpdatePatchInspector();
04760 }

Here is the call graph for this function:

void Patch_ToggleInverted  ) 
 

Definition at line 3888 of file PMESH.CPP.

References brush_t, brush_s::next, brush_s::patchBrush, patchInvert(), brush_s::pPatch, selected_brushes, Sys_UpdateWindows(), UpdatePatchInspector(), and W_ALL.

Referenced by CMainFrame::OnCurveNegative().

03889 {
03890   bool bUpdate = false;
03891 
03892     for (brush_t *pb = selected_brushes.next ; pb != &selected_brushes ; pb = pb->next)
03893     {
03894     if (pb->patchBrush)
03895     {
03896       bUpdate = true;
03897       patchInvert(pb->pPatch);
03898     }
03899   }
03900 
03901   if (bUpdate)
03902   {
03903     Sys_UpdateWindows(W_ALL);
03904   }
03905   UpdatePatchInspector();
03906 }

Here is the call graph for this function:

void Patch_Transpose  ) 
 

Definition at line 4844 of file PMESH.CPP.

References brush_t, patchMesh_t::ctrl, patchMesh_t::height, i, j, memcpy(), brush_s::next, p, Patch_Rebuild(), brush_s::patchBrush, patchInvert(), brush_s::pPatch, selected_brushes, w, and patchMesh_t::width.

Referenced by CMainFrame::OnCurveMatrixTranspose().

04845 {
04846     int     i, j, w;
04847   drawVert_t dv;
04848     for (brush_t *pb = selected_brushes.next ; pb != &selected_brushes ; pb = pb->next)
04849     {
04850     if (pb->patchBrush)
04851     {
04852       patchMesh_t *p = pb->pPatch;
04853 
04854         if ( p->width > p->height ) 
04855       {
04856             for ( i = 0 ; i < p->height ; i++ ) 
04857         {
04858                 for ( j = i + 1 ; j < p->width ; j++ ) 
04859           {
04860                     if ( j < p->height ) 
04861             {
04862                         // swap the value
04863                         memcpy(&dv,&p->ctrl[j][i],sizeof(drawVert_t));
04864                         memcpy(&p->ctrl[j][i],&p->ctrl[i][j], sizeof(drawVert_t));
04865                         memcpy(&p->ctrl[i][j],&dv, sizeof(drawVert_t));
04866                     } 
04867             else 
04868             {
04869                         // just copy
04870                         memcpy(&p->ctrl[j][i],&p->ctrl[i][j], sizeof(drawVert_t));
04871                     }
04872                 }
04873           }
04874         } 
04875       else 
04876       {
04877             for ( i = 0 ; i < p->width ; i++ ) 
04878         {
04879               for ( j = i + 1 ; j < p->height ; j++ ) 
04880           {
04881                     if ( j < p->width ) 
04882             {
04883                         // swap the value
04884                         memcpy(&dv,&p->ctrl[i][j], sizeof(drawVert_t));
04885               memcpy(&p->ctrl[i][j],&p->ctrl[j][i], sizeof(drawVert_t));
04886                         memcpy(&p->ctrl[j][i],&dv, sizeof(drawVert_t));
04887                     } 
04888             else 
04889             {
04890                         // just copy
04891                         memcpy(&p->ctrl[i][j],&p->ctrl[j][i], sizeof(drawVert_t));
04892                     }
04893                 }
04894             }
04895         }
04896 
04897       w = p->width;
04898       p->width = p->height;
04899       p->height = w;
04900       patchInvert(p);
04901       Patch_Rebuild(p);
04902         }
04903     }
04904 }

Here is the call graph for this function:

void Patch_UnFreeze bool  bAll  ) 
 

Definition at line 4838 of file PMESH.CPP.

Referenced by CMainFrame::OnCurveUnFreeze(), and CMainFrame::OnCurveUnFreezeAll().

04839 {
04840 }

void Patch_UpdateSelected vec3_t  vMove  ) 
 

Definition at line 2030 of file PMESH.CPP.

References Brush_RebuildBrush(), brush_t, patchMesh_t::ctrl, QEGlobals_t::d_move_points, QEGlobals_t::d_num_move_points, QEGlobals_t::d_numpoints, QEGlobals_t::d_points, g_qeglobals, patchMesh_t::height, i, j, MAX_POINTS, brush_s::next, p, Patch_CalcBounds(), brush_s::patchBrush, brush_s::pPatch, patchMesh_t::pSymbiot, selected_brushes, vec3_t, VectorAdd, VectorCopy, patchMesh_t::width, and drawVert_t::xyz.

Referenced by MoveSelection().

02031 {
02032   int i, j;
02033   for (i=0 ; i < g_qeglobals.d_num_move_points ; i++)
02034   {
02035       VectorAdd (g_qeglobals.d_move_points[i], vMove, g_qeglobals.d_move_points[i]);
02036     if (g_qeglobals.d_num_move_points == 1)
02037     {
02038     }
02039   }
02040 
02041     //--patchMesh_t* p = &patchMeshes[g_nSelectedPatch];
02042     for (brush_t *pb = selected_brushes.next ; pb != &selected_brushes ; pb = pb->next)
02043     {
02044     if (pb->patchBrush)
02045     {
02046         patchMesh_t* p = pb->pPatch;
02047 
02048 
02049       g_qeglobals.d_numpoints = 0;
02050         for (i = 0 ; i < p->width ; i++ ) 
02051       {
02052             for ( j = 0 ; j < p->height ; j++ ) 
02053         {
02054             VectorCopy (p->ctrl[i][j].xyz, g_qeglobals.d_points[g_qeglobals.d_numpoints]);
02055           if (g_qeglobals.d_numpoints < MAX_POINTS-1)
02056           {
02057               g_qeglobals.d_numpoints++;
02058           }
02059             }
02060       }
02061         
02062       vec3_t vMin, vMax;
02063       Patch_CalcBounds(p, vMin, vMax);
02064       Brush_RebuildBrush(p->pSymbiot, vMin, vMax);
02065     }
02066   }
02067   //Brush_Free(p->pSymbiot);
02068   //Select_Brush(AddBrushForPatch(g_nSelectedPatch));
02069 }

Here is the call graph for this function:

void Patch_Write patchMesh_t p,
CMemFile *  file
 

Definition at line 3681 of file PMESH.CPP.

References _Write3DMatrix(), QEGlobals_t::bSurfacePropertiesPlugin, patchMesh_t::contents, patchMesh_t::ctrl, patchMesh_t::d_texture, epair_t, patchMesh_t::epairs, file, patchMesh_t::flags, g_qeglobals, h(), patchMesh_t::height, epair_s::key, QEGlobals_t::m_bBrushPrimitMode, MemFile_fprintf(), qtexture_s::name, epair_s::next, p, drawVert_t::st, Sys_Printf(), epair_s::value, patchMesh_t::value, w, patchMesh_t::width, and drawVert_t::xyz.

Referenced by Brush_Write().

03682 {
03683     if (g_qeglobals.bSurfacePropertiesPlugin)
03684     {
03685         Sys_Printf("WARNING: Patch_Write to a CMemFile and Surface Properties plugin not done\n");
03686     }
03687   //--MemFile_fprintf(file, " {\n  patchDef3\n  {\n");
03688   MemFile_fprintf(file, " {\n  patchDef2\n  {\n");
03689 
03690   MemFile_fprintf(file, "   %s\n",p->d_texture->name);
03691   //--MemFile_fprintf(file, "   ( %i %i %i %i %i %i ) \n", p->width, p->height, p->contents, p->flags, p->value, p->type);
03692   MemFile_fprintf(file, "   ( %i %i %i %i %i ) \n", p->width, p->height, p->contents, p->flags, p->value);
03693 
03694 
03695     float       ctrl[MAX_PATCH_WIDTH][MAX_PATCH_HEIGHT][5];
03696 
03697   int w, h;
03698   for (w = 0; w < p->width; w++)
03699   {
03700     for (h = 0; h < p->height; h++)
03701     {
03702       ctrl[w][h][0] = p->ctrl[w][h].xyz[0];
03703       ctrl[w][h][1] = p->ctrl[w][h].xyz[1];
03704       ctrl[w][h][2] = p->ctrl[w][h].xyz[2];
03705       ctrl[w][h][3] = p->ctrl[w][h].st[0];
03706       ctrl[w][h][4] = p->ctrl[w][h].st[1];
03707     }
03708   }
03709 
03710   _Write3DMatrix(file, p->width, p->height, 5, reinterpret_cast<float*>(&ctrl));
03711 
03712     if (g_qeglobals.m_bBrushPrimitMode)
03713   {
03714       if (p->epairs)
03715     {
03716             for (epair_t *ep = p->epairs ; ep ; ep=ep->next)
03717       {
03718                 MemFile_fprintf (file, "\"%s\" \"%s\"\n", ep->key, ep->value);
03719       }
03720     }
03721   }
03722 
03723   MemFile_fprintf(file, "  }\n }\n");
03724 }

Here is the call graph for this function:

void Patch_Write patchMesh_t p,
FILE f
 

Definition at line 3726 of file PMESH.CPP.

References _Write3DMatrix(), QEGlobals_t::bSurfacePropertiesPlugin, patchMesh_t::contents, patchMesh_t::ctrl, patchMesh_t::d_texture, epair_t, patchMesh_t::epairs, file, patchMesh_t::flags, fprintf(), g_File, g_qeglobals, GETPLUGINTEXDEF, h(), patchMesh_t::height, epair_s::key, QEGlobals_t::m_bBrushPrimitMode, qtexture_s::name, epair_s::next, p, patchMesh_t::pData, QERApp_MapPrintf_FILE(), drawVert_t::st, Sys_Printf(), epair_s::value, patchMesh_t::value, w, patchMesh_t::width, and drawVert_t::xyz.

03727 {
03728     fprintf(file, " {\n  patchDef2\n  {\n");
03729     if (g_qeglobals.bSurfacePropertiesPlugin)
03730     {
03731 #ifdef _DEBUG
03732         if ( !p->pData )
03733             Sys_Printf("ERROR: no IPluginTexdef in patch\n");
03734 #endif
03735         g_File = file;
03736         GETPLUGINTEXDEF(p)->WritePatchTexdef( QERApp_MapPrintf_FILE );
03737     }
03738     else
03739     {
03740         fprintf(file, "   %s\n",p->d_texture->name);
03741         fprintf(file, "   ( %i %i %i %i %i ) \n", p->width, p->height, p->contents, p->flags, p->value);
03742     }
03743 
03744     float       ctrl[MAX_PATCH_WIDTH][MAX_PATCH_HEIGHT][5];
03745 
03746   int w, h;
03747   for (w = 0; w < p->width; w++)
03748   {
03749     for (h = 0; h < p->height; h++)
03750     {
03751       ctrl[w][h][0] = p->ctrl[w][h].xyz[0];
03752       ctrl[w][h][1] = p->ctrl[w][h].xyz[1];
03753       ctrl[w][h][2] = p->ctrl[w][h].xyz[2];
03754       ctrl[w][h][3] = p->ctrl[w][h].st[0];
03755       ctrl[w][h][4] = p->ctrl[w][h].st[1];
03756     }
03757   }
03758 
03759   _Write3DMatrix(file, p->width, p->height, 5, reinterpret_cast<float*>(&ctrl));
03760 
03761     if (g_qeglobals.m_bBrushPrimitMode)
03762   {
03763       if (p->epairs)
03764     {
03765             for (epair_t *ep = p->epairs ; ep ; ep=ep->next)
03766       {
03767                 fprintf (file, "\"%s\" \"%s\"\n", ep->key, ep->value);
03768       }
03769     }
03770   }
03771 
03772   fprintf(file, "  }\n }\n");
03773 }

Here is the call graph for this function:

void Patch_WriteFile CMemFile *  pMemFile  ) 
 

void Patch_WriteFile char *  name  ) 
 

Definition at line 63 of file cbrushstub.cpp.

00063 {}; 

void WINAPI Pointfile_Check void   ) 
 

Definition at line 84 of file POINTS.CPP.

References currentmap, QEGlobals_t::d_pointfile_display_list, f, fclose(), fopen(), fscanf(), g_qeglobals, name, qglBegin, qglColor3f, qglDisable, qglEnd, qglEndList, qglGenLists, qglLineWidth, qglNewList, qglVertex3fv, s_check_point, s_num_points, s_pointvecs, strcat(), strcpy(), StripExtension(), Sys_Printf(), v, vec3_t, and VectorCopy.

Referenced by CheckBspProcess(), DLLBuildDone(), and CMainFrame::OnFilePointfile().

00085 {
00086     char    name[1024];
00087     FILE    *f;
00088     vec3_t  v;
00089 
00090     strcpy (name, currentmap);
00091     StripExtension (name);
00092     strcat (name, ".lin");
00093 
00094     f = fopen (name, "r");
00095     if (!f)
00096         return;
00097 
00098     Sys_Printf ("Reading pointfile %s\n", name);
00099 
00100     if (!g_qeglobals.d_pointfile_display_list)
00101         g_qeglobals.d_pointfile_display_list = qglGenLists(1);
00102 
00103     s_num_points = 0;
00104   qglNewList (g_qeglobals.d_pointfile_display_list,  GL_COMPILE);
00105     qglColor3f (1, 0, 0);
00106     qglDisable(GL_TEXTURE_2D);
00107     qglDisable(GL_TEXTURE_1D);
00108     qglLineWidth (4);
00109     qglBegin(GL_LINE_STRIP);
00110     do
00111     {
00112         if (fscanf (f, "%f %f %f\n", &v[0], &v[1], &v[2]) != 3)
00113             break;
00114         if (s_num_points < MAX_POINTFILE)
00115         {
00116             VectorCopy (v, s_pointvecs[s_num_points]);
00117             s_num_points++;
00118         }
00119         qglVertex3fv (v);
00120     } while (1);
00121     qglEnd();
00122     qglLineWidth (1);
00123     qglEndList ();
00124 
00125     s_check_point = 0;
00126     fclose (f);
00127     //Pointfile_Next ();
00128 }

Here is the call graph for this function:

void Pointfile_Clear void   ) 
 

Definition at line 147 of file POINTS.CPP.

References QEGlobals_t::d_pointfile_display_list, g_qeglobals, qglDeleteLists, Sys_UpdateWindows(), and W_ALL.

Referenced by Map_Free(), Map_SaveFile(), and CMainFrame::OnFilePointfile().

00148 {
00149     if (!g_qeglobals.d_pointfile_display_list)
00150         return;
00151 
00152     qglDeleteLists (g_qeglobals.d_pointfile_display_list, 1);
00153     g_qeglobals.d_pointfile_display_list = 0;
00154     Sys_UpdateWindows (W_ALL);
00155 }

Here is the call graph for this function:

void Pointfile_Delete void   ) 
 

Definition at line 31 of file POINTS.CPP.

References currentmap, name, remove(), strcat(), strcpy(), and StripExtension().

Referenced by RunBsp().

00032 {
00033     char    name[1024];
00034 
00035     strcpy (name, currentmap);
00036     StripExtension (name);
00037     strcat (name, ".lin");
00038 
00039     remove(name);
00040 }

Here is the call graph for this function:

void Pointfile_Draw void   ) 
 

Definition at line 130 of file POINTS.CPP.

References F, i, qglBegin, qglColor3f, qglDisable, qglEnd, qglLineWidth, qglVertex3fv, and s_pointvecs.

Referenced by CCamWnd::Cam_Draw().

00131 {
00132     int i;
00133 
00134     qglColor3f( 1.0F, 0.0F, 0.0F );
00135     qglDisable(GL_TEXTURE_2D);
00136     qglDisable(GL_TEXTURE_1D);
00137     qglLineWidth (4);
00138     qglBegin(GL_LINE_STRIP);
00139     for ( i = 0; i < s_num_points; i++ )
00140     {
00141         qglVertex3fv( s_pointvecs[i] );
00142     }
00143     qglEnd();
00144     qglLineWidth( 1 );
00145 }

void Pointfile_Load void   ) 
 

void Pointfile_Next void   ) 
 

Definition at line 43 of file POINTS.CPP.

References camera_t::angles, asin(), atan2(), CCamWnd::Camera(), g_pParentWnd, CMainFrame::GetCamera(), CXYWnd::GetOrigin(), CMainFrame::GetXYWnd(), camera_t::origin, s_check_point, s_num_points, s_pointvecs, Sys_Status(), Sys_UpdateWindows(), vec3_t, VectorCopy, VectorNormalize(), VectorSubtract, and W_ALL.

Referenced by CMainFrame::OnMiscNextleakspot().

00044 {
00045     vec3_t  dir;
00046 
00047     if (s_check_point >= s_num_points-2)
00048     {
00049         Sys_Status ("End of pointfile", 0);
00050         return;
00051     }
00052     s_check_point++;
00053     VectorCopy (s_pointvecs[s_check_point], g_pParentWnd->GetCamera()->Camera().origin);
00054     VectorCopy (s_pointvecs[s_check_point], g_pParentWnd->GetXYWnd()->GetOrigin());
00055     VectorSubtract (s_pointvecs[s_check_point+1], g_pParentWnd->GetCamera()->Camera().origin, dir);
00056     VectorNormalize (dir);
00057     g_pParentWnd->GetCamera()->Camera().angles[1] = atan2 (dir[1], dir[0])*180/3.14159;
00058     g_pParentWnd->GetCamera()->Camera().angles[0] = asin (dir[2])*180/3.14159;
00059 
00060     Sys_UpdateWindows (W_ALL);
00061 }

Here is the call graph for this function:

void Pointfile_Prev void   ) 
 

Definition at line 64 of file POINTS.CPP.

References camera_t::angles, asin(), atan2(), CCamWnd::Camera(), g_pParentWnd, CMainFrame::GetCamera(), CXYWnd::GetOrigin(), CMainFrame::GetXYWnd(), camera_t::origin, s_check_point, s_pointvecs, Sys_Status(), Sys_UpdateWindows(), vec3_t, VectorCopy, VectorNormalize(), VectorSubtract, and W_ALL.

Referenced by CMainFrame::OnMiscPreviousleakspot().

00065 {
00066     vec3_t  dir;
00067 
00068     if ( s_check_point == 0)
00069     {
00070         Sys_Status ("Start of pointfile", 0);
00071         return;
00072     }
00073     s_check_point--;
00074     VectorCopy (s_pointvecs[s_check_point], g_pParentWnd->GetCamera()->Camera().origin);
00075     VectorCopy (s_pointvecs[s_check_point], g_pParentWnd->GetXYWnd()->GetOrigin());
00076     VectorSubtract (s_pointvecs[s_check_point+1], g_pParentWnd->GetCamera()->Camera().origin, dir);
00077     VectorNormalize (dir);
00078     g_pParentWnd->GetCamera()->Camera().angles[1] = atan2 (dir[1], dir[0])*180/3.14159;
00079     g_pParentWnd->GetCamera()->Camera().angles[0] = asin (dir[2])*180/3.14159;
00080 
00081     Sys_UpdateWindows (W_ALL);
00082 }

Here is the call graph for this function:

void ProjectDialog void   ) 
 

Definition at line 398 of file WIN_QE3.CPP.

References QEGlobals_t::d_hwndCamera, QEGlobals_t::d_hwndMain, QEGlobals_t::d_lpMruMenu, QEGlobals_t::d_project_entity, Error(), g_qeglobals, ID_FILE_EXIT, ofn, PlaceMenuMRUItem(), QE_LoadProject(), strcat(), strcpy(), szDirName, szFile, and ValueForKey().

Referenced by CMainFrame::OnFileLoadproject().

00399 {
00400     /* 
00401      * Obtain the system directory name and 
00402      * store it in szDirName. 
00403      */ 
00404  
00405     strcpy (szDirName, ValueForKey(g_qeglobals.d_project_entity, "basepath") );
00406     strcat (szDirName, "\\scripts");
00407 
00408     /* Place the terminating null character in the szFile. */ 
00409  
00410     szFile[0] = '\0'; 
00411  
00412     /* Set the members of the OPENFILENAME structure. */ 
00413  
00414     ofn.lStructSize = sizeof(OPENFILENAME); 
00415     ofn.hwndOwner = g_qeglobals.d_hwndCamera;
00416     ofn.lpstrFilter = szProjectFilter; 
00417     ofn.nFilterIndex = 1; 
00418     ofn.lpstrFile = szFile; 
00419     ofn.nMaxFile = sizeof(szFile); 
00420     ofn.lpstrFileTitle = szFileTitle; 
00421     ofn.nMaxFileTitle = sizeof(szFileTitle); 
00422     ofn.lpstrInitialDir = szDirName; 
00423     ofn.Flags = OFN_SHOWHELP | OFN_PATHMUSTEXIST | 
00424         OFN_FILEMUSTEXIST; 
00425 
00426     /* Display the Open dialog box. */ 
00427  
00428     if (!GetOpenFileName(&ofn))
00429         return; // canceled
00430  
00431     // Refresh the File menu.
00432     PlaceMenuMRUItem(g_qeglobals.d_lpMruMenu,GetSubMenu(GetMenu(g_qeglobals.d_hwndMain),0), 
00433             ID_FILE_EXIT);
00434 
00435     /* Open the file. */ 
00436     if (!QE_LoadProject(ofn.lpstrFile))
00437         Error ("Couldn't load project file");
00438 }

Here is the call graph for this function:

void QE_CheckAutoSave void   ) 
 

Definition at line 146 of file QE3.CPP.

00147 {
00148     static clock_t s_start;
00149     clock_t        now;
00150 
00151     now = clock();
00152 
00153     if ( modified != 1 || !s_start)
00154     {
00155         s_start = now;
00156         return;
00157     }
00158 
00159     if ( now - s_start > ( CLOCKS_PER_SEC * 60 * g_PrefsDlg.m_nAutoSave))
00160     {
00161 
00162     if (g_PrefsDlg.m_bAutoSave)
00163     {
00164       CString strMsg = g_PrefsDlg.m_bSnapShots ? "Autosaving snapshot..." : "Autosaving...";
00165           Sys_Printf(strMsg.GetBuffer(0));
00166       Sys_Printf("\n");
00167           Sys_Status (strMsg.GetBuffer(0),0);
00168 
00169       // only snapshot if not working on a default map
00170       if (g_PrefsDlg.m_bSnapShots && stricmp(currentmap, "unnamed.map") != 0)
00171       {
00172         Map_Snapshot();
00173       }
00174       else
00175       {
00176             Map_SaveFile (ValueForKey(g_qeglobals.d_project_entity, "autosave"), false);
00177       }
00178 
00179           Sys_Status ("Autosaving...Saved.", 0 );
00180           modified = 2;
00181     }
00182     else
00183     {
00184           Sys_Printf ("Autosave skipped...\n");
00185           Sys_Status ("Autosave skipped...", 0 );
00186     }
00187         s_start = now;
00188     }
00189 }

void WINAPI QE_CheckOpenGLForErrors void   ) 
 

Definition at line 30 of file QE3.CPP.

References QEGlobals_t::d_hwndMain, exit(), g_qeglobals, i, Map_SaveFile(), NULL, qglGetError, and Sys_Printf().

Referenced by CCamWnd::Cam_Draw(), CCamWnd::OnPaint(), CXYWnd::OnPaint(), CZWnd::OnPaint(), Texture_Draw2(), Texture_Flush(), WCam_WndProc(), WZ_WndProc(), XYWndProc(), and Z_Draw().

00031 {
00032   CString strMsg;
00033   int i = qglGetError();
00034   if (i != GL_NO_ERROR)
00035   {
00036     if (i == GL_OUT_OF_MEMORY)
00037     {
00038       //strMsg.Format("OpenGL out of memory error %s\nDo you wish to save before exiting?", qgluErrorString((GLenum)i));
00039       if (MessageBox(g_qeglobals.d_hwndMain, strMsg, "Q3Radiant Error", MB_YESNO) == IDYES)
00040       {
00041         Map_SaveFile(NULL, false);
00042       }
00043           exit(1);
00044     }
00045     else
00046     {
00047       //strMsg.Format("Warning: OpenGL Error %s\n ", qgluErrorString((GLenum)i));
00048           Sys_Printf (strMsg.GetBuffer(0));
00049     }
00050   }
00051 }

Here is the call graph for this function:

void WINAPI QE_ConvertDOSToUnixName char *  dst,
const char *  src
 

Definition at line 465 of file QE3.CPP.

References src.

Referenced by AssignModel(), AssignSound(), Eclass_InitForSourceDirectory(), Eclass_ScanFile(), LoadShader(), Map_ImportFile(), Map_LoadFile(), Map_SaveFile(), Map_SaveSelected(), QE_ExpandBspString(), QERApp_EClassScanDir(), QERApp_TryTextureForName(), Sys_MarkMapModified(), Texture_ForName(), Texture_ForNamePath(), Texture_LoadSkin(), and Texture_ShowDirectory().

00466 {
00467     while ( *src )
00468     {
00469         if ( *src == '\\' )
00470             *dst = '/';
00471         else
00472             *dst = *src;
00473         dst++; src++;
00474     }
00475     *dst = 0;
00476 }

void QE_CountBrushesAndUpdateStatusBar void   ) 
 

Definition at line 480 of file QE3.CPP.

00481 {
00482     static int      s_lastbrushcount, s_lastentitycount;
00483     static qboolean s_didonce;
00484     
00485     //entity_t   *e;
00486     brush_t    *b, *next;
00487 
00488     g_numbrushes = 0;
00489     g_numentities = 0;
00490     
00491     if ( active_brushes.next != NULL )
00492     {
00493         for ( b = active_brushes.next ; b != NULL && b != &active_brushes ; b=next)
00494         {
00495             next = b->next;
00496             if (b->brush_faces )
00497             {
00498                 if ( !b->owner->eclass->fixedsize)
00499                     g_numbrushes++;
00500                 else
00501                     g_numentities++;
00502             }
00503         }
00504     }
00505 /*
00506     if ( entities.next != NULL )
00507     {
00508         for ( e = entities.next ; e != &entities && g_numentities != MAX_MAP_ENTITIES ; e = e->next)
00509         {
00510             g_numentities++;
00511         }
00512     }
00513 */
00514     if ( ( ( g_numbrushes != s_lastbrushcount ) || ( g_numentities != s_lastentitycount ) ) || ( !s_didonce ) )
00515     {
00516         Sys_UpdateStatusBar();
00517 
00518         s_lastbrushcount = g_numbrushes;
00519         s_lastentitycount = g_numentities;
00520         s_didonce = true;
00521     }
00522 }

void QE_ExpandBspString char *  bspaction,
char *  out,
char *  mapname,
bool  useTemps
 

Definition at line 52 of file Win_main.cpp.

References QEGlobals_t::d_project_entity, ExtractFileName(), FALSE, g_qeglobals, in, QE_ConvertDOSToUnixName(), sprintf(), src, strcpy(), strlen(), strlwr(), strstr(), and ValueForKey().

Referenced by RunBsp().

00053 {
00054     char    *in;
00055     char    src[2048];
00056     char    rsh[2048];
00057     char    base[2048];
00058 
00059     strcpy(src, mapname);
00060     strlwr(src);
00061     in = strstr(src, "maps/");
00062     if (!in)
00063     {
00064         in = strstr(src, "maps\\");
00065     }
00066     if (in)
00067     {
00068         in += 5;
00069         strcpy(base, in);
00070         in = base;
00071         while (*in)
00072         {
00073             if (*in == '\\')
00074             {
00075                 *in = '/';
00076             }
00077             in++;
00078         }
00079     }
00080     else
00081     {
00082         ExtractFileName (mapname, base);
00083     }
00084 
00085   if (useTemps) {
00086     CString str;
00087     CString strExt = "map";
00088     if ( strstr(mapname, ".reg") ) {
00089       strExt = "reg";
00090     }
00091     str.Format("%s/maps/%i.%s", ValueForKey(g_qeglobals.d_project_entity, "remotebasepath"), ::GetTickCount(), strExt);
00092     CopyFile(mapname, str, FALSE);
00093       sprintf (src, "-tempname %s %s/maps/%s", str, ValueForKey(g_qeglobals.d_project_entity, "remotebasepath"), base);
00094   } else {
00095       sprintf (src, "%s/maps/%s", ValueForKey(g_qeglobals.d_project_entity, "remotebasepath"), base);
00096   }
00097     strcpy (rsh, ValueForKey(g_qeglobals.d_project_entity, "rshcmd"));
00098 
00099   QE_ConvertDOSToUnixName(src, src);
00100 
00101     in = ValueForKey( g_qeglobals.d_project_entity, bspaction );
00102     while (*in)
00103     {
00104         if (in[0] == '!')
00105         {
00106             strcpy (out, rsh);
00107             out += strlen(rsh);
00108             in++;
00109             continue;
00110         }
00111         if (in[0] == '$')
00112         {
00113             strcpy (out, src);
00114             out += strlen(src);
00115             in++;
00116             continue;
00117         }
00118         if (in[0] == '@')
00119         {
00120             *out++ = '"';
00121             in++;
00122             continue;
00123         }
00124         *out++ = *in++;
00125     }
00126     *out = 0;
00127 }

Here is the call graph for this function:

void QE_Init void   ) 
 

Definition at line 447 of file QE3.CPP.

References QEGlobals_t::d_gridsize, QEGlobals_t::d_showgrid, g_qeglobals, Terrain_Init(), Texture_Init(), and Z_Init().

Referenced by CMainFrame::CreateQEChildren().

00448 {
00449     /*
00450     ** initialize variables
00451     */
00452     g_qeglobals.d_gridsize = 8;
00453     g_qeglobals.d_showgrid = true;
00454 
00455     /*
00456     ** other stuff
00457     */
00458     Texture_Init (true);
00459     //Cam_Init ();
00460     //XY_Init ();
00461     Z_Init ();
00462     Terrain_Init();
00463 }

Here is the call graph for this function:

qboolean QE_KeyDown int  key,
int  nFlags = 0
 

Referenced by WCam_WndProc(), WZ_WndProc(), and XYWndProc().

qboolean QE_LoadProject char *  projectfile  ) 
 

Definition at line 221 of file QE3.CPP.

References _MAX_PATH, AddSlash(), BuildShortPathName(), QEGlobals_t::d_project_entity, data, Eclass_InitForSourceDirectory(), Entity_Parse(), Error(), ExtractPath_and_Filename(), FillBSPMenu(), FillClassList(), FillTextureMenu(), FindReplace(), free(), g_pPathFixups, g_PrefsDlg, g_qeglobals, g_strAppPath, g_strProject, i, IntForKey(), LoadFileNoCrash(), QEGlobals_t::m_bBrushPrimitMode, CPrefsDlg::m_strLastProject, CPrefsDlg::m_strQuake2, Map_New(), n, qboolean, CPrefsDlg::SavePrefs(), SetKeyValue(), StartTokenParsing(), strlen(), Sys_Printf(), and ValueForKey().

Referenced by CMainFrame::CreateQEChildren(), CMainFrame::OnFileNewproject(), and ProjectDialog().

00222 {
00223     char    *data;
00224 
00225     Sys_Printf ("QE_LoadProject (%s)\n", projectfile);
00226     
00227     if ( LoadFileNoCrash (projectfile, (void **)&data) == -1)
00228         return false;
00229     
00230     g_strProject = projectfile;
00231     
00232     CString strData = data;
00233     free(data);
00234     
00235     CString strQ2Path = g_PrefsDlg.m_strQuake2;
00236     CString strQ2File;
00237     ExtractPath_and_Filename(g_PrefsDlg.m_strQuake2, strQ2Path, strQ2File);
00238     AddSlash(strQ2Path);
00239     
00240     
00241     char* pBuff = new char[1024];
00242     
00243     BuildShortPathName(strQ2Path, pBuff, 1024);
00244     FindReplace(strData, "__Q2PATH", pBuff);
00245     BuildShortPathName(g_strAppPath, pBuff, 1024);
00246     FindReplace(strData, "__QERPATH", pBuff);
00247     
00248     char* pFile;
00249     if (GetFullPathName(projectfile, 1024, pBuff, &pFile))
00250     {
00251         g_PrefsDlg.m_strLastProject = pBuff;
00252         BuildShortPathName(g_PrefsDlg.m_strLastProject, pBuff, 1024);
00253         g_PrefsDlg.m_strLastProject = pBuff;
00254         g_PrefsDlg.SavePrefs();
00255         
00256         ExtractPath_and_Filename(pBuff, strQ2Path, strQ2File);
00257         int nLen = strQ2Path.GetLength();
00258         if (nLen > 0)
00259         {
00260             if (strQ2Path[nLen - 1] == '\\')
00261                 strQ2Path.SetAt(nLen-1,'\0');
00262             char* pBuffer = strQ2Path.GetBufferSetLength(_MAX_PATH + 1);
00263             int n = strQ2Path.ReverseFind('\\');
00264             if (n >=0 )
00265                 pBuffer[n + 1] = '\0';
00266             strQ2Path.ReleaseBuffer();
00267             FindReplace(strData, "__QEPROJPATH", strQ2Path);
00268         }
00269     }
00270     
00271     
00272     StartTokenParsing (strData.GetBuffer(0));
00273     g_qeglobals.d_project_entity = Entity_Parse (true);
00274     if (!g_qeglobals.d_project_entity)
00275         Error ("Couldn't parse %s", projectfile);
00276 
00277   for (int i = 0; i < g_nPathFixupCount; i++)
00278   {
00279     char *pPath = ValueForKey (g_qeglobals.d_project_entity, g_pPathFixups[i]);
00280     if (pPath[0] != '\\' && pPath[0] != '/')
00281     {
00282         if (GetFullPathName(pPath, 1024, pBuff, &pFile))
00283       {
00284         SetKeyValue(g_qeglobals.d_project_entity, g_pPathFixups[i], pBuff);
00285       }
00286     }
00287   }
00288 
00289     delete []pBuff;
00290 
00291     // set here some default project settings you need
00292     if ( strlen( ValueForKey( g_qeglobals.d_project_entity, "brush_primit" ) ) == 0 )
00293     {
00294         SetKeyValue( g_qeglobals.d_project_entity, "brush_primit", "0" );
00295     }
00296 
00297     g_qeglobals.m_bBrushPrimitMode = IntForKey( g_qeglobals.d_project_entity, "brush_primit" );
00298 
00299 
00300     Eclass_InitForSourceDirectory (ValueForKey (g_qeglobals.d_project_entity, "entitypath"));
00301     FillClassList();        // list in entity window
00302     
00303     Map_New();
00304     
00305     
00306     FillTextureMenu();
00307     FillBSPMenu();
00308     
00309     return true;
00310 }

Here is the call graph for this function:

qboolean QE_SingleBrush bool  bQuiet = false  ) 
 

Definition at line 424 of file QE3.CPP.

References entity_s::eclass, eclass_s::fixedsize, brush_s::next, brush_s::owner, qboolean, selected_brushes, and Sys_Printf().

Referenced by Brush_MakeSided(), Brush_MakeSidedCone(), Brush_MakeSidedSphere(), CPlugInManager::Dispatch(), Map_RegionBrush(), Map_RegionTallBrush(), Patch_BendHandleESC(), Patch_BendHandleTAB(), Patch_BendToggle(), Patch_BrushToMesh(), Patch_CapCurrent(), Patch_GenericMesh(), Patch_InsDelHandleTAB(), Patch_InsDelToggle(), Patch_SelectBendAxis(), Patch_SelectBendNormal(), Patch_Thicken(), Select_CompleteTall(), Select_Inside(), Select_PartialTall(), Select_Touching(), CSurfaceDlg::SetTexMods(), SetupVertexSelection(), and Terrain_BrushToMesh().

00425 {
00426     if ( (selected_brushes.next == &selected_brushes)
00427         || (selected_brushes.next->next != &selected_brushes) )
00428     {
00429       if (!bQuiet)
00430     {
00431         Sys_Printf ("Error: you must have a single brush selected\n");
00432       }
00433         return false;
00434     }
00435     if (selected_brushes.next->owner->eclass->fixedsize)
00436     {
00437       if (!bQuiet)
00438       {
00439           Sys_Printf ("Error: you cannot manipulate fixed size entities\n");
00440       }
00441         return false;
00442     }
00443 
00444     return true;
00445 }

Here is the call graph for this function:

int WINAPI QERApp_EClassScanDir char *  dir,
HMODULE  plugID
 

Definition at line 66 of file PluginEntities.cpp.

References e, Eclass_ScanFile(), eclass_t, eclass_s::hPlug, eclass_s::modelpath, eclass_s::nShowFlags, QE_ConvertDOSToUnixName(), s, sprintf(), strcpy(), and strlen().

00067 {
00068     struct _finddata_t  fileinfo;
00069     int                 handle;
00070     char                temp[ _MAX_PATH ];
00071     char                filebase[ _MAX_PATH ];
00072     char                filename[ _MAX_PATH ];
00073     char                *s;
00074     eclass_t            *e;
00075     QE_ConvertDOSToUnixName( temp, path );
00076     strcpy (filebase, path);
00077     s = filebase + strlen(filebase)-1;
00078     while (*s != '\\' && *s != '/' && s!=filebase)
00079         s--;
00080     *s = 0;
00081     handle = _findfirst (path, &fileinfo);
00082     if (handle != -1)
00083        {
00084         do
00085         {           
00086             sprintf (filename, "%s\\%s", filebase, fileinfo.name);
00087             Eclass_ScanFile (filename);
00088             
00089             if (eclass_found)
00090             {
00091                 e = eclass_e;
00092                 e->modelpath = strdup( fileinfo.name );
00093                 e->nShowFlags |= ECLASS_PLUGINENTITY;
00094                 e->hPlug = hPlug;
00095             }
00096         } while (_findnext( handle, &fileinfo ) != -1);
00097         
00098         _findclose (handle);
00099        }
00100     return 0;
00101 }

Here is the call graph for this function:

int WINAPI QERApp_GetFaceInfo _QERFaceData pFaceData,
winding_t pWinding
 

Definition at line 76 of file SelectedFace.cpp.

References _QERFaceData::brushprimit_texdef, face_s::brushprimit_texdef, brushprimit_texdef_t, face_t, face_s::face_winding, g_ptrSelectedFaces, g_qeglobals, _QERFaceData::m_bBPrimit, QEGlobals_t::m_bBrushPrimitMode, _QERFaceData::m_TextureName, _QERFaceData::m_v1, _QERFaceData::m_v2, _QERFaceData::m_v3, memcpy(), texdef_t::name, winding_t::numpoints, face_s::planepts, strcpy(), Sys_Printf(), face_s::texdef, and VectorCopy.

00077 {
00078     int size;
00079 
00080     if (g_ptrSelectedFaces.GetSize() > 0)
00081     {
00082         if (!g_qeglobals.m_bBrushPrimitMode)
00083         {
00084             Sys_Printf("Warning: unexpected QERApp_GetFaceInfo out of brush primitive mode\n");
00085             return 0;
00086         }
00087         //++timo NOTE: let's put only what we need for now
00088     face_t *selFace = reinterpret_cast<face_t*>(g_ptrSelectedFaces.GetAt(0));
00089         strcpy( pFaceData->m_TextureName, selFace->texdef.name );
00090         VectorCopy( selFace->planepts[0], pFaceData->m_v1 );
00091         VectorCopy( selFace->planepts[1], pFaceData->m_v2 );
00092         VectorCopy( selFace->planepts[2], pFaceData->m_v3 );
00093         pFaceData->m_bBPrimit = true;
00094         memcpy( &pFaceData->brushprimit_texdef, &selFace->brushprimit_texdef, sizeof(brushprimit_texdef_t) );
00095         size = (int)((winding_t *)0)->points[selFace->face_winding->numpoints];
00096         memcpy( pWinding, selFace->face_winding, size );
00097         return 1;
00098     }
00099     return 0;
00100 }

Here is the call graph for this function:

HGLRC WINAPI QERApp_GetQeglobalsHGLRC  ) 
 

Definition at line 70 of file SelectedFace.cpp.

References QEGlobals_t::d_hglrcBase, g_qeglobals, and HGLRC.

00071 {
00072     return g_qeglobals.d_hglrcBase;
00073 }

void WINAPI QERApp_GetTextureSize int  Size[2]  ) 
 

Definition at line 126 of file SelectedFace.cpp.

References face_s::d_texture, face_t, g_ptrSelectedFaces, qtexture_s::height, Sys_Printf(), and qtexture_s::width.

00127 {
00128     if (g_ptrSelectedFaces.GetSize() > 0)
00129     {
00130     face_t *selFace = reinterpret_cast<face_t*>(g_ptrSelectedFaces.GetAt(0));
00131         Size[0] = selFace->d_texture->width;
00132         Size[1] = selFace->d_texture->height;
00133     }
00134     else
00135         Sys_Printf("WARNING: unexpected call to QERApp_GetTextureSize with no selected_face\n");
00136 }

Here is the call graph for this function:

void WINAPI QERApp_GetTwoSelectedPatch patchMesh_t **  p1,
patchMesh_t **  p2
 

Definition at line 61 of file SurfacePlugin.cpp.

References brush_t, brush_s::next, p2, brush_s::patchBrush, brush_s::pPatch, selected_brushes, and Sys_Printf().

00062 {
00063     *p1 = NULL; *p2 = NULL;
00064     for (brush_t *pb = selected_brushes.next ; pb != &selected_brushes ; pb = pb->next)
00065     {
00066         if (pb->patchBrush)
00067         {
00068             if (!(*p1))
00069                 *p1 = pb->pPatch;
00070             else if (!(*p2))
00071             {
00072                 *p2 = pb->pPatch;
00073                 return;
00074             }
00075         }
00076     }
00077 #ifdef _DEBUG
00078     Sys_Printf("WARNING: QERApp_GetTwoSelectedPatch failed (did not find two patches)\n");
00079 #endif
00080     return;
00081     
00082 }

Here is the call graph for this function:

IXYWndWrapper* WINAPI QERApp_GetXYWndWrapper  ) 
 

Definition at line 134 of file Messaging.cpp.

00135 {
00136     return &l_XYWndWrapper;
00137 }

void WINAPI QERApp_HookListener IListener pListen,
int  Msg
 

Definition at line 87 of file Messaging.cpp.

References IListener::IncRef(), l_Listeners, Msg, and Sys_Printf().

00088 {
00089 #ifdef _DEBUG
00090     if (Msg >= RADIANT_MSGCOUNT)
00091     {
00092         Sys_Printf("ERROR: bad index in QERApp_HookListener\n");
00093         return;
00094     }
00095 #endif
00096     l_Listeners[Msg].Add( pListen );
00097     pListen->IncRef();
00098 }

Here is the call graph for this function:

void WINAPI QERApp_HookWindow IWindowListener pListen  ) 
 

Definition at line 43 of file Messaging.cpp.

References IWindowListener::IncRef(), and l_WindowListeners.

00044 {
00045     l_WindowListeners.Add( pListen );
00046     pListen->IncRef();
00047 }

Here is the call graph for this function:

void WINAPI QERApp_HookXYGLWindow IGLWindow pGLW  ) 
 

Definition at line 67 of file GLInterface.cpp.

References IGLWindow::IncRef(), and l_GLWindows.

00068 {
00069     l_GLWindows.Add( pGLW );
00070     pGLW->IncRef();
00071 }

Here is the call graph for this function:

int WINAPI QERApp_ISelectedFace_GetTextureNumber  ) 
 

Definition at line 56 of file GLInterface.cpp.

References face_s::d_texture, face_t, g_ptrSelectedFaces, and qtexture_s::texture_number.

00057 {
00058     if (g_ptrSelectedFaces.GetSize() > 0)
00059     {
00060         face_t *selFace = reinterpret_cast<face_t*>(g_ptrSelectedFaces.GetAt(0));
00061         return selFace->d_texture->texture_number;
00062     }
00063     //++timo hu ? find the appropriate gl bind number
00064     return 0;
00065 }

void WINAPI QERApp_MapPrintf_FILE char *  text,
  ...
 

Definition at line 1855 of file Brush.cpp.

References fprintf(), g_File, va_end, va_list, va_start, and vsprintf().

Referenced by Brush_Write(), and Patch_Write().

01856 {
01857     va_list argptr;
01858     char    buf[32768];
01859 
01860     va_start (argptr,text);
01861     vsprintf (buf, text,argptr);
01862     va_end (argptr);
01863 
01864     fprintf( g_File, buf );
01865 }

Here is the call graph for this function:

int WINAPI QERApp_SetFaceInfo _QERFaceData pFaceData  ) 
 

Definition at line 102 of file SelectedFace.cpp.

References Brush_Build(), brush_t, face_s::brushprimit_texdef, _QERFaceData::brushprimit_texdef, brushprimit_texdef_t, face_t, g_ptrSelectedFaceBrushes, g_ptrSelectedFaces, g_qeglobals, QEGlobals_t::m_bBrushPrimitMode, _QERFaceData::m_TextureName, _QERFaceData::m_v1, _QERFaceData::m_v2, _QERFaceData::m_v3, memcpy(), face_s::planepts, texdef_t::SetName(), Sys_Printf(), Sys_UpdateWindows(), face_s::texdef, VectorCopy, and W_ALL.

00103 {
00104     if (g_ptrSelectedFaces.GetSize() > 0)
00105     {
00106         if (!g_qeglobals.m_bBrushPrimitMode)
00107         {
00108             Sys_Printf("Warning: unexpected QERApp_SetFaceInfo out of brush primitive mode\n");
00109             return 0;
00110         }
00111     face_t *selFace = reinterpret_cast<face_t*>(g_ptrSelectedFaces.GetAt(0));
00112     brush_t *selBrush = reinterpret_cast<brush_t*>(g_ptrSelectedFaceBrushes.GetAt(0));
00113         //strcpy( selected_face->texdef.name, pFaceData->m_TextureName );
00114         selFace->texdef.SetName(pFaceData->m_TextureName);
00115         VectorCopy( pFaceData->m_v1, selFace->planepts[0] );
00116         VectorCopy( pFaceData->m_v2, selFace->planepts[1] );
00117         VectorCopy( pFaceData->m_v3, selFace->planepts[2] );
00118         memcpy( &selFace->brushprimit_texdef, &pFaceData->brushprimit_texdef, sizeof(brushprimit_texdef_t) );
00119         Brush_Build( selBrush );
00120         Sys_UpdateWindows(W_ALL);
00121         return 1;
00122     }
00123     return 0;
00124 }

Here is the call graph for this function:

qtexture_t* WINAPI QERApp_TryTextureForName const char *  name  ) 
 

Definition at line 46 of file IShaders.cpp.

References QEGlobals_t::d_project_entity, QEGlobals_t::d_qtextures, qtexture_s::filename, free(), g_qeglobals, LoadImage(), name, qtexture_s::next, NULL, q, QE_ConvertDOSToUnixName(), qtexture_t, SetNameShaderInfo(), sprintf(), strcmp(), strcpy(), strlen(), Sys_Printf(), Texture_LoadTGATexture(), and ValueForKey().

00047 {
00048     qtexture_t *q;
00049     char filename[1024];
00050     for (q=g_qeglobals.d_qtextures ; q ; q=q->next)
00051     {
00052         if (!strcmp(name,  q->filename))
00053                 return q;
00054     }
00055     // try loading from file .. this is a copy of the worst part of Texture_ForName
00056     char cWork[1024];
00057     sprintf (filename, "%s/%s.tga", ValueForKey (g_qeglobals.d_project_entity, "texturepath"), name);
00058     QE_ConvertDOSToUnixName( cWork, filename );
00059     strcpy(filename, cWork);
00060     unsigned char* pPixels = NULL;
00061     int nWidth;
00062     int nHeight;
00063     LoadImage(filename, &pPixels, &nWidth, &nHeight);
00064     if (pPixels == NULL)
00065     {
00066         // try jpg
00067         // blatant assumption of .tga should be fine since we sprintf'd it above
00068         int nLen = strlen(filename);
00069         filename[nLen-3] = 'j';
00070         filename[nLen-2] = 'p';
00071         filename[nLen-1] = 'g';
00072         LoadImage(filename, &pPixels, &nWidth, &nHeight);
00073     }
00074     if (pPixels)
00075     {
00076         q = Texture_LoadTGATexture(pPixels, nWidth, nHeight, NULL, 0, 0, 0);
00077         //++timo storing the filename .. will be removed by shader code cleanup
00078         // this is dirty, and we sure miss some places were we should fill the filename info
00079         strcpy( q->filename, name );
00080         SetNameShaderInfo(q, filename, name);
00081         Sys_Printf ("done.\n", name);
00082         free(pPixels);
00083         return q;
00084     }
00085     return NULL;
00086 }

Here is the call graph for this function:

void WINAPI QERApp_UnHookGLWindow IGLWindow pGLW  ) 
 

Definition at line 73 of file GLInterface.cpp.

References IGLWindow::DecRef(), i, l_GLWindows, and Sys_Printf().

00074 {
00075     for( int i = 0; i < l_GLWindows.GetSize(); i++ )
00076     {
00077         if (l_GLWindows.GetAt(i) == pGLW)
00078         {
00079             l_GLWindows.RemoveAt(i);
00080             pGLW->DecRef();
00081             return;
00082         }
00083     }
00084 #ifdef _DEBUG
00085     Sys_Printf("ERROR: IGLWindow* not found in QERApp_UnHookGLWindow\n");
00086 #endif
00087 }

Here is the call graph for this function:

int WINAPI QERApp_UnHookListener IListener pListen  ) 
 

Definition at line 100 of file Messaging.cpp.

References count, IListener::DecRef(), i, j, and l_Listeners.

00101 {
00102     int count = 0;
00103     for( int i = 0; i<RADIANT_MSGCOUNT; i++ )
00104         for( int j = 0; j<l_Listeners[i].GetSize(); j++ )
00105             if (l_Listeners[i].GetAt(j) == pListen)
00106             {
00107                 l_Listeners[i].RemoveAt(j);
00108                 pListen->DecRef();
00109                 count++;
00110             }
00111     return count;
00112 }

Here is the call graph for this function:

void WINAPI QERApp_UnHookWindow IWindowListener pListen  ) 
 

Definition at line 49 of file Messaging.cpp.

References IWindowListener::DecRef(), i, l_WindowListeners, and Sys_Printf().

00050 {
00051     for ( int i = 0; i < l_WindowListeners.GetSize(); i++ )
00052     {
00053         if (l_WindowListeners.GetAt(i) == pListen)
00054         {
00055             l_WindowListeners.RemoveAt(i);
00056             pListen->DecRef();
00057             return;
00058         }
00059     }
00060 #ifdef _DEBUG
00061     Sys_Printf("WARNING: IWindowListener not found in QERApp_UnHookWindow\n");
00062 #endif
00063 }

Here is the call graph for this function: