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

MAP.CPP File Reference

#include "stdafx.h"
#include "qe3.h"
#include "PrefsDlg.h"

Include dependency graph for MAP.CPP:

Include dependency graph

Go to the source code of this file.

Functions

void AddRegionBrushes (void)
entity_tAngledEntity ()
bool CheckForTinyBrush (brush_t *b, int n, float fSize)
void DupLists ()
void Map_ApplyRegion (void)
void Map_BuildBrushData (void)
entity_tMap_FindClass (char *cname)
void Map_Free (void)
void Map_ImportBuffer (char *buf)
void Map_ImportFile (char *filename)
qboolean Map_IsBrushFiltered (brush_t *b)
void Map_LoadFile (char *filename)
void Map_New (void)
void Map_RegionBrush (void)
void Map_RegionOff (void)
void Map_RegionSelectedBrushes (void)
void Map_RegionTallBrush (void)
void Map_RegionXY (void)
void Map_RestoreBetween (void)
void Map_SaveBetween (void)
void Map_SaveFile (char *filename, qboolean use_region)
void Map_SaveSelected (CMemFile *pMemFile, CMemFile *pPatchFile)
void Map_SaveSelected (char *pFilename)
void MemFile_fprintf (CMemFile *pMemFile, const char *pText,...)
void RemoveRegionBrushes (void)
void UniqueTargetName (CString &rStr)

Variables

brush_t active_brushes
brush_t between_brushes
entity_t between_entities
char currentmap [1024]
entity_t entities
brush_t filtered_brushes
bool g_bRestoreBetween = false
qboolean modified
qboolean region_active
vec3_t region_maxs = {MAX_WORLD_COORD, MAX_WORLD_COORD, MAX_WORLD_COORD}
vec3_t region_mins = {MIN_WORLD_COORD, MIN_WORLD_COORD, MIN_WORLD_COORD}
brush_tregion_sides [4]
brush_t selected_brushes
face_tselected_face
brush_tselected_face_brush
entity_tworld_entity = NULL


Function Documentation

void AddRegionBrushes void   ) 
 

Definition at line 574 of file MAP.CPP.

References Brush_AddToList(), Brush_Build(), Brush_Create(), Entity_LinkBrush(), i, memset(), region_maxs, region_mins, region_sides, selected_brushes, vec3_t, and world_entity.

Referenced by Map_SaveFile().

00575 {
00576     vec3_t  mins, maxs;
00577     int     i;
00578     texdef_t    td;
00579 
00580     if (!region_active)
00581         return;
00582 
00583     memset (&td, 0, sizeof(td));
00584     //strcpy (td.name, "REGION");
00585     td.SetName("REGION");
00586 
00587     mins[0] = region_mins[0] - 16;
00588     maxs[0] = region_mins[0] + 1;
00589     mins[1] = region_mins[1] - 16;
00590     maxs[1] = region_maxs[1] + 16;
00591     mins[2] = MIN_WORLD_COORD;
00592     maxs[2] = MAX_WORLD_COORD;
00593     region_sides[0] = Brush_Create (mins, maxs, &td);
00594 
00595     mins[0] = region_maxs[0] - 1;
00596     maxs[0] = region_maxs[0] + 16;
00597     region_sides[1] = Brush_Create (mins, maxs, &td);
00598 
00599     mins[0] = region_mins[0] - 16;
00600     maxs[0] = region_maxs[0] + 16;
00601     mins[1] = region_mins[1] - 16;
00602     maxs[1] = region_mins[1] + 1;
00603     region_sides[2] = Brush_Create (mins, maxs, &td);
00604 
00605     mins[1] = region_maxs[1] - 1;
00606     maxs[1] = region_maxs[1] + 16;
00607     region_sides[3] = Brush_Create (mins, maxs, &td);
00608 
00609     for (i=0 ; i<4 ; i++)
00610     {
00611         Brush_AddToList (region_sides[i], &selected_brushes);
00612         Entity_LinkBrush (world_entity, region_sides[i]);
00613         Brush_Build( region_sides[i] );
00614     }
00615 }

Here is the call graph for this function:

entity_t* AngledEntity  ) 
 

Definition at line 260 of file MAP.CPP.

References Map_FindClass().

Referenced by Map_LoadFile().

00261 {
00262   entity_t *ent = Map_FindClass ("info_player_start");
00263     if (!ent)
00264   {
00265         ent = Map_FindClass ("info_player_deathmatch");
00266   }
00267   if (!ent)
00268   {
00269         ent = Map_FindClass ("info_player_deathmatch");
00270   }
00271   if (!ent)
00272   {
00273     ent = Map_FindClass ("team_CTF_redplayer");
00274   }
00275   if (!ent)
00276   {
00277     ent = Map_FindClass ("team_CTF_blueplayer");
00278   }
00279   if (!ent)
00280   {
00281     ent = Map_FindClass ("team_CTF_redspawn");
00282   }
00283   if (!ent)
00284   {
00285     ent = Map_FindClass ("team_CTF_bluespawn");
00286   }
00287   return ent;
00288 }

Here is the call graph for this function:

bool CheckForTinyBrush brush_t b,
int  n,
float  fSize
 

Definition at line 164 of file MAP.CPP.

References b, brush_t, i, brush_s::maxs, brush_s::mins, n, and Sys_Printf().

Referenced by Map_BuildBrushData().

00165 {
00166   bool bTiny = false;
00167     for (int i=0 ; i<3 ; i++)
00168     {
00169     if (b->maxs[i] - b->mins[i] < fSize)
00170       bTiny = true;
00171   }
00172   if (bTiny)
00173     Sys_Printf("Possible problem brush (too small) #%i ", n);
00174   return bTiny;
00175 }

Here is the call graph for this function:

void DupLists  ) 
 

Definition at line 50 of file MAP.CPP.

References DWORD.

00051 {
00052   DWORD dw = GetTickCount();
00053 
00054 }

void Map_ApplyRegion void   ) 
 

Definition at line 678 of file MAP.CPP.

References active_brushes, b, Brush_AddToList(), Brush_RemoveFromList(), brush_t, filtered_brushes, Map_IsBrushFiltered(), next, brush_s::next, region_active, Sys_UpdateWindows(), and W_ALL.

Referenced by Map_RegionBrush(), Map_RegionTallBrush(), and Map_RegionXY().

00679 {
00680     brush_t *b, *next;
00681 
00682     region_active = true;
00683     for (b=active_brushes.next ; b != &active_brushes ; b=next)
00684     {
00685         next = b->next;
00686         if (!Map_IsBrushFiltered (b))
00687             continue;       // still filtered
00688         Brush_RemoveFromList (b);
00689         Brush_AddToList (b, &filtered_brushes);
00690     }
00691 
00692     Sys_UpdateWindows (W_ALL);
00693 }

Here is the call graph for this function:

void Map_BuildBrushData void   ) 
 

Definition at line 177 of file MAP.CPP.

References active_brushes, b, Brush_Build(), brush_s::brush_faces, Brush_Free(), brush_t, CheckForTinyBrush(), g_PrefsDlg, CPrefsDlg::m_bCleanTiny, CPrefsDlg::m_fTinySize, n, brush_s::next, next, NULL, Sys_BeginWait(), Sys_EndWait(), and Sys_Printf().

Referenced by Map_ImportFile(), Map_LoadFile(), CMainFrame::OnConvertcurves(), CMainFrame::OnSelectMouserotate(), CMainFrame::OnViewCubicclipping(), CMainFrame::OnViewShownames(), and Texture_SetMode().

00178 {
00179     brush_t *b, *next;
00180 
00181     if (active_brushes.next == NULL)
00182         return;
00183 
00184     Sys_BeginWait ();   // this could take a while
00185 
00186   int n = 0;
00187     for (b=active_brushes.next ; b != NULL && b != &active_brushes ; b=next)
00188     {
00189         next = b->next;
00190         Brush_Build( b, true, false, false );
00191         if (!b->brush_faces || (g_PrefsDlg.m_bCleanTiny && CheckForTinyBrush(b, n++, g_PrefsDlg.m_fTinySize)))
00192         {
00193             Brush_Free (b);
00194             Sys_Printf ("Removed degenerate brush\n");
00195         }
00196     }
00197     Sys_EndWait();
00198 }

Here is the call graph for this function:

entity_t* Map_FindClass char *  cname  ) 
 

Definition at line 200 of file MAP.CPP.

References entities, strcmp(), and ValueForKey().

Referenced by AngledEntity().

00201 {
00202     entity_t    *ent;
00203 
00204     for (ent = entities.next ; ent != &entities ; ent=ent->next)
00205     {
00206         if (!strcmp(cname, ValueForKey (ent, "classname")))
00207             return ent;
00208     }
00209     return NULL;
00210 }

Here is the call graph for this function:

void Map_Free void   ) 
 

Definition at line 217 of file MAP.CPP.

References active_brushes, Brush_Free(), currentmap, QEGlobals_t::d_hwndMain, QEGlobals_t::d_num_entities, QEGlobals_t::d_numterrapoints, entities, Entity_Free(), filtered_brushes, g_bRestoreBetween, g_qeglobals, Map_SaveBetween(), brush_s::next, Pointfile_Clear(), brush_s::prev, selected_brushes, strcpy(), Sys_SetTitle(), Texture_ClearInuse(), and world_entity.

Referenced by Map_LoadFile(), and Map_New().

00218 {
00219   g_bRestoreBetween = false;
00220     if (selected_brushes.next &&
00221         (selected_brushes.next != &selected_brushes) )
00222     {
00223     if (MessageBox(g_qeglobals.d_hwndMain, "Copy selection?", "", MB_YESNO) == IDYES)
00224           Map_SaveBetween ();
00225     }
00226 
00227     Texture_ClearInuse ();
00228     Pointfile_Clear ();
00229     strcpy (currentmap, "unnamed.map");
00230     Sys_SetTitle (currentmap);
00231     g_qeglobals.d_num_entities = 0;
00232     g_qeglobals.d_numterrapoints = 0;
00233 
00234     if (!active_brushes.next)
00235     {   // first map
00236         active_brushes.prev = active_brushes.next = &active_brushes;
00237         selected_brushes.prev = selected_brushes.next = &selected_brushes;
00238         filtered_brushes.prev = filtered_brushes.next = &filtered_brushes;
00239 
00240         entities.prev = entities.next = &entities;
00241     }
00242     else
00243     {
00244         while (active_brushes.next != &active_brushes)
00245             Brush_Free (active_brushes.next);
00246         while (selected_brushes.next != &selected_brushes)
00247             Brush_Free (selected_brushes.next);
00248         while (filtered_brushes.next != &filtered_brushes)
00249             Brush_Free (filtered_brushes.next);
00250 
00251         while (entities.next != &entities)
00252             Entity_Free (entities.next);
00253     }
00254 
00255   if (world_entity)
00256     Entity_Free(world_entity);
00257     world_entity = NULL;
00258 }

Here is the call graph for this function:

void Map_ImportBuffer char *  buf  ) 
 

Definition at line 834 of file MAP.CPP.

References active_brushes, b, QEGlobals_t::bNeedConvert, QEGlobals_t::bOldBrushes, QEGlobals_t::bPrimitBrushes, Brush_Build(), brush_t, entity_t::brushes, QEGlobals_t::d_num_entities, QEGlobals_t::d_parsed_brushes, entities, Entity_LinkBrush(), Entity_Parse(), Entity_UnlinkBrush(), FindEntity(), g_bScreenUpdates, g_qeglobals, i, modified, brush_s::next, brush_s::onext, Select_Brush(), Select_Deselect(), SetKeyValue(), StartTokenParsing(), strcmp(), Sys_UpdateWindows(), Undo_End(), Undo_EndBrush(), Undo_EndEntity(), Undo_Start(), UniqueTargetName(), ValueForKey(), W_ALL, and world_entity.

Referenced by Map_ImportFile(), and CXYWnd::Paste().

00835 {
00836     entity_t* ent;
00837     brush_t* b = NULL;
00838     CPtrArray ptrs;
00839 
00840     Select_Deselect();
00841 
00842     Undo_Start("import buffer");
00843 
00844     g_qeglobals.d_parsed_brushes = 0;
00845     if (buf)
00846     {
00847         CMapStringToString mapStr;
00848         StartTokenParsing (buf);
00849         g_qeglobals.d_num_entities = 0;
00850 
00851         // Timo
00852         // will be used in Entity_Parse to detect if a conversion between brush formats is needed
00853         g_qeglobals.bNeedConvert = false;
00854         g_qeglobals.bOldBrushes = false;
00855         g_qeglobals.bPrimitBrushes = false;
00856 
00857         while (1)
00858         {
00859 
00860             // use the selected brushes list as it's handy
00861             //ent = Entity_Parse (false, &selected_brushes);
00862             ent = Entity_Parse (false, &active_brushes);
00863             if (!ent)
00864                 break;
00865             //end entity for undo
00866             Undo_EndEntity(ent);
00867             //end brushes for undo
00868             for(b = ent->brushes.onext; b && b != &ent->brushes; b = b->onext)
00869             {
00870                 Undo_EndBrush(b);
00871             }
00872 
00873             if (!strcmp(ValueForKey (ent, "classname"), "worldspawn"))
00874             {
00875                 // world brushes need to be added to the current world entity
00876 
00877                 b=ent->brushes.onext;
00878                 while (b && b != &ent->brushes)
00879                 {
00880                     brush_t* bNext = b->onext;
00881                     Entity_UnlinkBrush(b);
00882                     Entity_LinkBrush(world_entity, b);
00883                     ptrs.Add(b);
00884                     b = bNext;
00885                 }
00886             }
00887             else
00888             {
00889                 // the following bit remaps conflicting target/targetname key/value pairs
00890                 CString str = ValueForKey(ent, "target");
00891                 CString strKey;
00892                 CString strTarget("");
00893                 if (str.GetLength() > 0)
00894                 {
00895                     if (FindEntity("target", str.GetBuffer(0)))
00896                     {
00897                         if (!mapStr.Lookup(str, strKey))
00898                         {
00899                             UniqueTargetName(strKey);
00900                             mapStr.SetAt(str, strKey);
00901                         }
00902                         strTarget = strKey;
00903                         SetKeyValue(ent, "target", strTarget.GetBuffer(0));
00904                     }
00905                 }
00906                 str = ValueForKey(ent, "targetname");
00907                 if (str.GetLength() > 0)
00908                 {
00909                     if (FindEntity("targetname", str.GetBuffer(0)))
00910                     {
00911                         if (!mapStr.Lookup(str, strKey))
00912                         {
00913                             UniqueTargetName(strKey);
00914                             mapStr.SetAt(str, strKey);
00915                         }
00916                         SetKeyValue(ent, "targetname", strKey.GetBuffer(0));
00917                     }
00918                 }
00919                 //if (strTarget.GetLength() > 0)
00920                 //  SetKeyValue(ent, "target", strTarget.GetBuffer(0));
00921 
00922                 // add the entity to the end of the entity list
00923                 ent->next = &entities;
00924                 ent->prev = entities.prev;
00925                 entities.prev->next = ent;
00926                 entities.prev = ent;
00927                 g_qeglobals.d_num_entities++;
00928 
00929                 for (b=ent->brushes.onext ; b != &ent->brushes ; b=b->onext)
00930                 {
00931                     ptrs.Add(b);
00932                 }
00933             }
00934         }
00935     }
00936 
00937     //::ShowWindow(g_qeglobals.d_hwndEntity, FALSE);
00938     //::LockWindowUpdate(g_qeglobals.d_hwndEntity);
00939     g_bScreenUpdates = false; 
00940     for (int i = 0; i < ptrs.GetSize(); i++)
00941     {
00942         Brush_Build(reinterpret_cast<brush_t*>(ptrs[i]), true, false);
00943         Select_Brush(reinterpret_cast<brush_t*>(ptrs[i]), true, false);
00944     }
00945     //::LockWindowUpdate(NULL);
00946     g_bScreenUpdates = true; 
00947 
00948     ptrs.RemoveAll();
00949 
00950     // reset the "need conversion" flag
00951     // conversion to the good format done in Map_BuildBrushData
00952     g_qeglobals.bNeedConvert=false;
00953 
00954     Sys_UpdateWindows (W_ALL);
00955   //Sys_MarkMapModified();
00956     modified = true;
00957 
00958     Undo_End();
00959 
00960 }

Here is the call graph for this function:

void Map_ImportFile char *  filename  ) 
 

Definition at line 968 of file MAP.CPP.

References free(), LoadFile(), Map_BuildBrushData(), Map_ImportBuffer(), modified, QE_ConvertDOSToUnixName(), Sys_BeginWait(), Sys_EndWait(), Sys_UpdateWindows(), and W_ALL.

Referenced by CMainFrame::OnEditLoadprefab(), and CMainFrame::OnFileImportmap().

00969 {
00970   char* buf;
00971     char temp[1024];
00972     Sys_BeginWait ();
00973     QE_ConvertDOSToUnixName( temp, filename );
00974   if (LoadFile (filename, (void **)&buf) != -1)
00975   {
00976     Map_ImportBuffer(buf);
00977     free(buf);
00978     Map_BuildBrushData();
00979   }
00980     Sys_UpdateWindows (W_ALL);
00981     modified = true;
00982     Sys_EndWait();
00983 }

Here is the call graph for this function:

qboolean Map_IsBrushFiltered brush_t b  ) 
 

Definition at line 628 of file MAP.CPP.

References b, brush_t, i, brush_s::maxs, brush_s::mins, qboolean, region_maxs, and region_mins.

Referenced by Entity_Write(), Map_ApplyRegion(), and Map_RegionOff().

00629 {
00630     int     i;
00631 
00632     for (i=0 ; i<3 ; i++)
00633     {
00634         if (b->mins[i] > region_maxs[i])
00635             return true;
00636         if (b->maxs[i] < region_mins[i])
00637             return true;
00638     }
00639     return false;
00640 }

void Map_LoadFile char *  filename  ) 
 

Definition at line 297 of file MAP.CPP.

References active_brushes, AngledEntity(), camera_t::angles, QEGlobals_t::bNeedConvert, QEGlobals_t::bOldBrushes, QEGlobals_t::bPrimitBrushes, CCamWnd::Camera(), currentmap, QEGlobals_t::d_num_entities, QEGlobals_t::d_parsed_brushes, entities, Entity_Free(), Entity_Parse(), FloatForKey(), free(), g_pParentWnd, g_qeglobals, CMainFrame::GetCamera(), CXYWnd::GetOrigin(), GetVectorForKey(), CMainFrame::GetXYWnd(), Group_Add(), Group_Init(), LoadFile(), Map_BuildBrushData(), Map_Free(), Map_New(), Map_RegionOff(), Map_RestoreBetween(), modified, camera_t::origin, QE_ConvertDOSToUnixName(), Select_Deselect(), StartTokenParsing(), strcmp(), strcpy(), Sys_BeginWait(), Sys_EndWait(), Sys_Printf(), Sys_SetTitle(), Sys_UpdateWindows(), Texture_ShowInuse(), ValueForKey(), vec3_origin, VectorCopy, W_ALL, and world_entity.

Referenced by CMainFrame::OnCreate(), CMainFrame::OnFileNewproject(), and OpenDialog().

00298 {
00299     char        *buf;
00300     entity_t    *ent;
00301     char         temp[1024];
00302 
00303     Sys_BeginWait ();
00304     Select_Deselect();
00305     //SetInspectorMode(W_CONSOLE);
00306 
00307     QE_ConvertDOSToUnixName( temp, filename );
00308     Sys_Printf ("Map_LoadFile: %s\n", temp );
00309 
00310     Map_Free ();
00311     //++timo FIXME: maybe even easier to have Group_Init called from Map_Free?
00312     Group_Init();
00313 
00314     g_qeglobals.d_parsed_brushes = 0;
00315     strcpy (currentmap, filename);
00316 
00317     if (LoadFile (filename, (void **)&buf) != -1)
00318     {
00319 
00320         StartTokenParsing (buf);
00321         g_qeglobals.d_num_entities = 0;
00322 
00323         // Timo
00324         // will be used in Entity_Parse to detect if a conversion between brush formats is needed
00325         g_qeglobals.bNeedConvert = false;
00326         g_qeglobals.bOldBrushes = false;
00327         g_qeglobals.bPrimitBrushes = false;
00328 
00329         while (1)
00330         {
00331             ent = Entity_Parse (false, &active_brushes);
00332             if (!ent)
00333                 break;
00334             if (!strcmp(ValueForKey (ent, "classname"), "worldspawn"))
00335             {
00336                 if (world_entity)
00337                     Sys_Printf ("WARNING: multiple worldspawn\n");
00338                 world_entity = ent;
00339             }
00340             else if (!strcmp(ValueForKey (ent, "classname"), "group_info"))
00341       {
00342         // it's a group thing!
00343         Group_Add(ent);
00344         Entity_Free(ent);
00345       }
00346       else
00347             {
00348                 // add the entity to the end of the entity list
00349                 ent->next = &entities;
00350                 ent->prev = entities.prev;
00351                 entities.prev->next = ent;
00352                 entities.prev = ent;
00353                 g_qeglobals.d_num_entities++;
00354             }
00355         }
00356     }
00357 
00358   free (buf);
00359 
00360     if (!world_entity)
00361     {
00362         Sys_Printf ("No worldspawn in map.\n");
00363         Map_New ();
00364         return;
00365     }
00366 
00367     Sys_Printf ("--- LoadMapFile ---\n");
00368     Sys_Printf ("%s\n", temp );
00369 
00370     Sys_Printf ("%5i brushes\n",  g_qeglobals.d_parsed_brushes );
00371     Sys_Printf ("%5i entities\n", g_qeglobals.d_num_entities);
00372 
00373     Map_RestoreBetween ();
00374 
00375     Sys_Printf ("Map_BuildAllDisplayLists\n");
00376     Map_BuildBrushData();
00377 
00378     // reset the "need conversion" flag
00379     // conversion to the good format done in Map_BuildBrushData
00380     g_qeglobals.bNeedConvert=false;
00381 
00382     //
00383     // move the view to a start position
00384     //
00385   ent = AngledEntity();
00386 
00387   g_pParentWnd->GetCamera()->Camera().angles[PITCH] = 0;
00388     if (ent)
00389     {
00390         GetVectorForKey (ent, "origin", g_pParentWnd->GetCamera()->Camera().origin);
00391         GetVectorForKey (ent, "origin", g_pParentWnd->GetXYWnd()->GetOrigin());
00392         g_pParentWnd->GetCamera()->Camera().angles[YAW] = FloatForKey (ent, "angle");
00393     }
00394     else
00395     {
00396         g_pParentWnd->GetCamera()->Camera().angles[YAW] = 0;
00397         VectorCopy (vec3_origin, g_pParentWnd->GetCamera()->Camera().origin);
00398         VectorCopy (vec3_origin, g_pParentWnd->GetXYWnd()->GetOrigin());
00399     }
00400 
00401     Map_RegionOff ();
00402 
00403 
00404     modified = false;
00405     Sys_SetTitle (temp);
00406 
00407     Texture_ShowInuse ();
00408 
00409     Sys_EndWait();
00410     Sys_UpdateWindows (W_ALL);
00411 
00412 }

Here is the call graph for this function:

void Map_New void   ) 
 

Definition at line 527 of file MAP.CPP.

References camera_t::angles, entity_t::brushes, CCamWnd::Camera(), Eclass_ForName(), g_pParentWnd, CMainFrame::GetCamera(), CXYWnd::GetOrigin(), CMainFrame::GetXYWnd(), Group_Init(), Map_Free(), Map_RestoreBetween(), modified, camera_t::origin, Patch_Cleanup(), qmalloc(), SetKeyValue(), Sys_Printf(), Sys_UpdateWindows(), vec3_origin, VectorCopy, W_ALL, and world_entity.

Referenced by Map_LoadFile(), CMainFrame::OnFileNew(), QE_LoadProject(), and Texture_Flush().

00528 {
00529     Sys_Printf ("Map_New\n");
00530     Map_Free ();
00531 
00532   Patch_Cleanup();
00533 
00534     world_entity = (entity_s*)qmalloc(sizeof(*world_entity));
00535     world_entity->brushes.onext = 
00536         world_entity->brushes.oprev = &world_entity->brushes;
00537     SetKeyValue (world_entity, "classname", "worldspawn");
00538     world_entity->eclass = Eclass_ForName ("worldspawn", true);
00539 
00540     g_pParentWnd->GetCamera()->Camera().angles[YAW] = 0;
00541     g_pParentWnd->GetCamera()->Camera().angles[PITCH] = 0;
00542     VectorCopy (vec3_origin, g_pParentWnd->GetCamera()->Camera().origin);
00543     g_pParentWnd->GetCamera()->Camera().origin[2] = 48;
00544     VectorCopy (vec3_origin, g_pParentWnd->GetXYWnd()->GetOrigin());
00545 
00546     Map_RestoreBetween ();
00547 
00548   Group_Init();
00549 
00550     Sys_UpdateWindows (W_ALL);
00551     modified = false;
00552 }

Here is the call graph for this function:

void Map_RegionBrush void   ) 
 

Definition at line 780 of file MAP.CPP.

References b, brush_t, Map_ApplyRegion(), Map_RegionOff(), brush_s::maxs, brush_s::mins, brush_s::next, QE_SingleBrush(), region_maxs, region_mins, Select_Delete(), selected_brushes, and VectorCopy.

Referenced by CMainFrame::OnRegionSetbrush().

00781 {
00782     brush_t *b;
00783 
00784     if (!QE_SingleBrush ())
00785         return;
00786 
00787     b = selected_brushes.next;
00788 
00789     Map_RegionOff ();
00790 
00791     VectorCopy (b->mins, region_mins);
00792     VectorCopy (b->maxs, region_maxs);
00793 
00794     Select_Delete ();
00795     Map_ApplyRegion ();
00796 }

Here is the call graph for this function:

void Map_RegionOff void   ) 
 

Definition at line 649 of file MAP.CPP.

References active_brushes, b, Brush_AddToList(), Brush_RemoveFromList(), brush_t, filtered_brushes, i, Map_IsBrushFiltered(), brush_s::next, next, NULL, brush_s::prev, region_active, region_maxs, region_mins, Sys_UpdateWindows(), and W_ALL.

Referenced by Map_LoadFile(), Map_RegionBrush(), Map_RegionSelectedBrushes(), Map_RegionTallBrush(), Map_RegionXY(), and CMainFrame::OnRegionOff().

00650 {
00651     brush_t *b, *next;
00652     int         i;
00653 
00654     region_active = false;
00655     for (i=0 ; i<3 ; i++)
00656     {
00657         region_maxs[i] = MAX_WORLD_COORD;//4096;
00658         region_mins[i] = MIN_WORLD_COORD;//-4096;
00659     }
00660     
00661     for (b=filtered_brushes.next ; b != &filtered_brushes ; b=next)
00662     {
00663         next = b->next;
00664         if (Map_IsBrushFiltered (b))
00665             continue;       // still filtered
00666         Brush_RemoveFromList (b);
00667     if (active_brushes.next == NULL || active_brushes.prev == NULL)
00668     {
00669       active_brushes.next = &active_brushes;
00670       active_brushes.prev = &active_brushes;
00671     }
00672         Brush_AddToList (b, &active_brushes);
00673     }
00674 
00675     Sys_UpdateWindows (W_ALL);
00676 }

Here is the call graph for this function:

void Map_RegionSelectedBrushes void   ) 
 

Definition at line 701 of file MAP.CPP.

References active_brushes, filtered_brushes, Map_RegionOff(), brush_s::next, brush_s::prev, region_active, region_maxs, region_mins, Select_GetBounds(), selected_brushes, Sys_Printf(), Sys_UpdateWindows(), and W_ALL.

Referenced by CMainFrame::OnRegionSetselection().

00702 {
00703     Map_RegionOff ();
00704 
00705     if (selected_brushes.next == &selected_brushes)  // nothing selected
00706   {
00707     Sys_Printf("Tried to region with no selection...\n");
00708     return;
00709   }
00710     region_active = true;
00711     Select_GetBounds (region_mins, region_maxs);
00712 
00713     // move the entire active_brushes list to filtered_brushes
00714     filtered_brushes.next = active_brushes.next;
00715     filtered_brushes.prev = active_brushes.prev;
00716     filtered_brushes.next->prev = &filtered_brushes;
00717     filtered_brushes.prev->next = &filtered_brushes;
00718 
00719     // move the entire selected_brushes list to active_brushes
00720     active_brushes.next = selected_brushes.next;
00721     active_brushes.prev = selected_brushes.prev;
00722     active_brushes.next->prev = &active_brushes;
00723     active_brushes.prev->next = &active_brushes;
00724 
00725     // clear selected_brushes
00726     selected_brushes.next = selected_brushes.prev = &selected_brushes;
00727 
00728     Sys_UpdateWindows (W_ALL);
00729 }

Here is the call graph for this function:

void Map_RegionTallBrush void   ) 
 

Definition at line 755 of file MAP.CPP.

References b, brush_t, Map_ApplyRegion(), Map_RegionOff(), brush_s::maxs, brush_s::mins, brush_s::next, QE_SingleBrush(), region_maxs, region_mins, Select_Delete(), selected_brushes, and VectorCopy.

Referenced by CMainFrame::OnRegionSettallbrush().

00756 {
00757     brush_t *b;
00758 
00759     if (!QE_SingleBrush ())
00760         return;
00761 
00762     b = selected_brushes.next;
00763 
00764     Map_RegionOff ();
00765 
00766     VectorCopy (b->mins, region_mins);
00767     VectorCopy (b->maxs, region_maxs);
00768     region_mins[2] = MIN_WORLD_COORD;
00769     region_maxs[2] = MAX_WORLD_COORD;
00770 
00771 
00772     Select_Delete ();
00773     Map_ApplyRegion ();
00774 }

Here is the call graph for this function:

void Map_RegionXY void   ) 
 

Definition at line 737 of file MAP.CPP.

References g_pParentWnd, CXYWnd::GetOrigin(), CMainFrame::GetXYWnd(), CXYWnd::Height(), Map_ApplyRegion(), Map_RegionOff(), region_maxs, region_mins, CXYWnd::Scale(), and CXYWnd::Width().

Referenced by CMainFrame::OnRegionSetxy().

00738 {
00739     Map_RegionOff ();
00740 
00741     region_mins[0] = g_pParentWnd->GetXYWnd()->GetOrigin()[0] - 0.5 * g_pParentWnd->GetXYWnd()->Width() / g_pParentWnd->GetXYWnd()->Scale();
00742     region_maxs[0] = g_pParentWnd->GetXYWnd()->GetOrigin()[0] + 0.5 * g_pParentWnd->GetXYWnd()->Width() / g_pParentWnd->GetXYWnd()->Scale();
00743     region_mins[1] = g_pParentWnd->GetXYWnd()->GetOrigin()[1] - 0.5 * g_pParentWnd->GetXYWnd()->Height() / g_pParentWnd->GetXYWnd()->Scale();
00744     region_maxs[1] = g_pParentWnd->GetXYWnd()->GetOrigin()[1] + 0.5 * g_pParentWnd->GetXYWnd()->Height() / g_pParentWnd->GetXYWnd()->Scale();
00745     region_mins[2] = -MIN_WORLD_COORD;
00746     region_maxs[2] = MAX_WORLD_COORD;
00747     Map_ApplyRegion ();
00748 }

Here is the call graph for this function:

void Map_RestoreBetween void   ) 
 

Definition at line 116 of file MAP.CPP.

References CMainFrame::ActiveXY(), b, between_brushes, between_entities, brush_t, entity_t::brushes, entities, g_pParentWnd, head, brush_s::next, brush_s::onext, brush_s::oprev, brush_s::owner, CXYWnd::Paste(), brush_s::prev, selected_brushes, and world_entity.

Referenced by Map_LoadFile(), and Map_New().

00117 {
00118     if (g_pParentWnd->ActiveXY() && g_bRestoreBetween)
00119     g_pParentWnd->ActiveXY()->Paste();
00120   return;
00121 
00122 #if 0  
00123   entity_t  *head, *tail;
00124     brush_t     *b;
00125 
00126     if (!between_brushes.next)
00127         return;
00128 
00129     for (b=between_brushes.next ; b != &between_brushes ; b=b->next)
00130     {
00131         if (!b->owner)
00132         {
00133             b->owner = world_entity;
00134             b->onext = world_entity->brushes.onext;
00135             b->oprev = &world_entity->brushes;
00136             b->onext->