• R/O
  • SSH
  • HTTPS

vima19: Commit


Commit MetaInfo

Revisión2543 (tree)
Tiempo2023-09-20 00:14:56
Autorhgtterry

Log Message

GameDirectorSB 19-09-23 [v1.26] Update

Cambiar Resumen

Diferencia incremental

--- WorldEditor/WorldEditor/A_Brush.cpp (revision 2542)
+++ WorldEditor/WorldEditor/A_Brush.cpp (revision 2543)
@@ -229,7 +229,7 @@
229229
230230 Level_AppendBrush(App->CLSB_Doc->pLevel, pBrush);
231231 Brush_SetVisible(pBrush, GE_TRUE);
232- SelBrushList_Add(App->m_pDoc->pSelBrushes, pBrush);
232+ SelBrushList_Add(App->CLSB_Doc->pSelBrushes, pBrush);
233233
234234 App->m_pDoc->SetDefaultBrushTexInfo(pBrush);
235235 Brush_Bound(pBrush);
--- WorldEditor/WorldEditor/A_CreateArchDialog.cpp (revision 2542)
+++ WorldEditor/WorldEditor/A_CreateArchDialog.cpp (revision 2543)
@@ -575,17 +575,17 @@
575575
576576 assert (pBrush != NULL);
577577
578- if (m_pDoc->BTemplate != NULL)
578+ if (App->CLSB_Doc->BTemplate != NULL)
579579 {
580- Brush_Destroy (&m_pDoc->BTemplate);
580+ Brush_Destroy (&App->CLSB_Doc->BTemplate);
581581 }
582582
583- m_pDoc->CurBrush = pBrush;
583+ App->CLSB_Doc->CurBrush = pBrush;
584584
585- m_pDoc->TempEnt = FALSE;
586- m_pDoc->SetDefaultBrushTexInfo (m_pDoc->CurBrush);
587- Brush_Bound (m_pDoc->CurBrush);
588- Brush_Center (m_pDoc->CurBrush, &BrushPos);
585+ App->CLSB_Doc->TempEnt = FALSE;
586+ m_pDoc->SetDefaultBrushTexInfo (App->CLSB_Doc->CurBrush);
587+ Brush_Bound (App->CLSB_Doc->CurBrush);
588+ Brush_Center (App->CLSB_Doc->CurBrush, &BrushPos);
589589
590590 pTemplatePos = Level_GetTemplatePos (App->CLSB_Doc->pLevel);
591591
@@ -609,7 +609,7 @@
609609
610610 geVec3d_Subtract (pTemplatePos, &BrushPos, &MoveVec);
611611
612- Brush_Move (m_pDoc->CurBrush, &MoveVec);
612+ Brush_Move (App->CLSB_Doc->CurBrush, &MoveVec);
613613
614614 App->CLSB_Doc->UpdateAllViews (UAV_ALL3DVIEWS, NULL);
615615 m_pDoc->SetModifiedFlag ();
--- WorldEditor/WorldEditor/A_CreateBoxDialog.cpp (revision 2542)
+++ WorldEditor/WorldEditor/A_CreateBoxDialog.cpp (revision 2543)
@@ -461,17 +461,17 @@
461461
462462 assert (pBrush != NULL);
463463
464- if (App->m_pDoc->BTemplate != NULL)
464+ if (App->CLSB_Doc->BTemplate != NULL)
465465 {
466- Brush_Destroy (&App->m_pDoc->BTemplate);
466+ Brush_Destroy (&App->CLSB_Doc->BTemplate);
467467 }
468468
469- App->m_pDoc->CurBrush = pBrush;
469+ App->CLSB_Doc->CurBrush = pBrush;
470470
471- App->m_pDoc->TempEnt = FALSE;
472- App->m_pDoc->SetDefaultBrushTexInfo (App->m_pDoc->CurBrush);
473- Brush_Bound (App->m_pDoc->CurBrush);
474- Brush_Center (App->m_pDoc->CurBrush, &BrushPos);
471+ App->CLSB_Doc->TempEnt = FALSE;
472+ App->m_pDoc->SetDefaultBrushTexInfo (App->CLSB_Doc->CurBrush);
473+ Brush_Bound (App->CLSB_Doc->CurBrush);
474+ Brush_Center (App->CLSB_Doc->CurBrush, &BrushPos);
475475
476476 pTemplatePos = Level_GetTemplatePos (App->CLSB_Doc->pLevel);
477477
@@ -495,7 +495,7 @@
495495
496496 geVec3d_Subtract (pTemplatePos, &BrushPos, &MoveVec);
497497
498- Brush_Move (App->m_pDoc->CurBrush, &MoveVec);
498+ Brush_Move (App->CLSB_Doc->CurBrush, &MoveVec);
499499
500500 App->CLSB_Doc->UpdateAllViews (UAV_ALL3DVIEWS, NULL);
501501 App->m_pDoc->SetModifiedFlag ();
--- WorldEditor/WorldEditor/A_CreateConeDialog.cpp (revision 2542)
+++ WorldEditor/WorldEditor/A_CreateConeDialog.cpp (revision 2543)
@@ -353,17 +353,17 @@
353353
354354 assert (pBrush != NULL);
355355
356- if (m_pDoc->BTemplate != NULL)
356+ if (App->CLSB_Doc->BTemplate != NULL)
357357 {
358- Brush_Destroy (&m_pDoc->BTemplate);
358+ Brush_Destroy (&App->CLSB_Doc->BTemplate);
359359 }
360360
361- m_pDoc->CurBrush = pBrush;
361+ App->CLSB_Doc->CurBrush = pBrush;
362362
363- m_pDoc->TempEnt = FALSE;
364- m_pDoc->SetDefaultBrushTexInfo (m_pDoc->CurBrush);
365- Brush_Bound (m_pDoc->CurBrush);
366- Brush_Center (m_pDoc->CurBrush, &BrushPos);
363+ App->CLSB_Doc->TempEnt = FALSE;
364+ m_pDoc->SetDefaultBrushTexInfo (App->CLSB_Doc->CurBrush);
365+ Brush_Bound (App->CLSB_Doc->CurBrush);
366+ Brush_Center (App->CLSB_Doc->CurBrush, &BrushPos);
367367
368368 pTemplatePos = Level_GetTemplatePos (App->CLSB_Doc->pLevel);
369369
@@ -387,7 +387,7 @@
387387
388388 geVec3d_Subtract (pTemplatePos, &BrushPos, &MoveVec);
389389
390- Brush_Move (m_pDoc->CurBrush, &MoveVec);
390+ Brush_Move (App->CLSB_Doc->CurBrush, &MoveVec);
391391
392392 App->CLSB_Doc->UpdateAllViews (UAV_ALL3DVIEWS, NULL);
393393 m_pDoc->SetModifiedFlag ();
--- WorldEditor/WorldEditor/A_CreateCylDialog.cpp (revision 2542)
+++ WorldEditor/WorldEditor/A_CreateCylDialog.cpp (revision 2543)
@@ -436,17 +436,17 @@
436436
437437 assert (pBrush != NULL);
438438
439- if (m_pDoc->BTemplate != NULL)
439+ if (App->CLSB_Doc->BTemplate != NULL)
440440 {
441- Brush_Destroy (&m_pDoc->BTemplate);
441+ Brush_Destroy (&App->CLSB_Doc->BTemplate);
442442 }
443443
444- m_pDoc->CurBrush = pBrush;
444+ App->CLSB_Doc->CurBrush = pBrush;
445445
446- m_pDoc->TempEnt = FALSE;
447- m_pDoc->SetDefaultBrushTexInfo (m_pDoc->CurBrush);
448- Brush_Bound (m_pDoc->CurBrush);
449- Brush_Center (m_pDoc->CurBrush, &BrushPos);
446+ App->CLSB_Doc->TempEnt = FALSE;
447+ m_pDoc->SetDefaultBrushTexInfo (App->CLSB_Doc->CurBrush);
448+ Brush_Bound (App->CLSB_Doc->CurBrush);
449+ Brush_Center (App->CLSB_Doc->CurBrush, &BrushPos);
450450
451451 pTemplatePos = Level_GetTemplatePos (App->CLSB_Doc->pLevel);
452452
@@ -470,7 +470,7 @@
470470
471471 geVec3d_Subtract (pTemplatePos, &BrushPos, &MoveVec);
472472
473- Brush_Move (m_pDoc->CurBrush, &MoveVec);
473+ Brush_Move (App->CLSB_Doc->CurBrush, &MoveVec);
474474
475475 App->CLSB_Doc->UpdateAllViews (UAV_ALL3DVIEWS, NULL);
476476 m_pDoc->SetModifiedFlag ();
--- WorldEditor/WorldEditor/A_CreateSpheroidDialog.cpp (revision 2542)
+++ WorldEditor/WorldEditor/A_CreateSpheroidDialog.cpp (revision 2543)
@@ -346,17 +346,17 @@
346346
347347 assert (pBrush != NULL);
348348
349- if (m_pDoc->BTemplate != NULL)
349+ if (App->CLSB_Doc->BTemplate != NULL)
350350 {
351- Brush_Destroy (&m_pDoc->BTemplate);
351+ Brush_Destroy (&App->CLSB_Doc->BTemplate);
352352 }
353353
354- m_pDoc->CurBrush = pBrush;
354+ App->CLSB_Doc->CurBrush = pBrush;
355355
356- m_pDoc->TempEnt = FALSE;
357- m_pDoc->SetDefaultBrushTexInfo (m_pDoc->CurBrush);
358- Brush_Bound (m_pDoc->CurBrush);
359- Brush_Center (m_pDoc->CurBrush, &BrushPos);
356+ App->CLSB_Doc->TempEnt = FALSE;
357+ m_pDoc->SetDefaultBrushTexInfo (App->CLSB_Doc->CurBrush);
358+ Brush_Bound (App->CLSB_Doc->CurBrush);
359+ Brush_Center (App->CLSB_Doc->CurBrush, &BrushPos);
360360
361361 pTemplatePos = Level_GetTemplatePos (App->CLSB_Doc->pLevel);
362362
@@ -380,7 +380,7 @@
380380
381381 geVec3d_Subtract (pTemplatePos, &BrushPos, &MoveVec);
382382
383- Brush_Move (m_pDoc->CurBrush, &MoveVec);
383+ Brush_Move (App->CLSB_Doc->CurBrush, &MoveVec);
384384
385385 App->CLSB_Doc->UpdateAllViews (UAV_ALL3DVIEWS, NULL);
386386 m_pDoc->SetModifiedFlag ();
--- WorldEditor/WorldEditor/A_CreateStaircaseDialog.cpp (revision 2542)
+++ WorldEditor/WorldEditor/A_CreateStaircaseDialog.cpp (revision 2543)
@@ -326,17 +326,17 @@
326326
327327 assert (pBrush != NULL);
328328
329- if (m_pDoc->BTemplate != NULL)
329+ if (App->CLSB_Doc->BTemplate != NULL)
330330 {
331- Brush_Destroy (&m_pDoc->BTemplate);
331+ Brush_Destroy (&App->CLSB_Doc->BTemplate);
332332 }
333333
334- m_pDoc->CurBrush = pBrush;
334+ App->CLSB_Doc->CurBrush = pBrush;
335335
336- m_pDoc->TempEnt = FALSE;
337- m_pDoc->SetDefaultBrushTexInfo (m_pDoc->CurBrush);
338- Brush_Bound (m_pDoc->CurBrush);
339- Brush_Center (m_pDoc->CurBrush, &BrushPos);
336+ App->CLSB_Doc->TempEnt = FALSE;
337+ m_pDoc->SetDefaultBrushTexInfo (App->CLSB_Doc->CurBrush);
338+ Brush_Bound (App->CLSB_Doc->CurBrush);
339+ Brush_Center (App->CLSB_Doc->CurBrush, &BrushPos);
340340
341341 pTemplatePos = Level_GetTemplatePos (App->CLSB_Doc->pLevel);
342342
@@ -360,7 +360,7 @@
360360
361361 geVec3d_Subtract (pTemplatePos, &BrushPos, &MoveVec);
362362
363- Brush_Move (m_pDoc->CurBrush, &MoveVec);
363+ Brush_Move (App->CLSB_Doc->CurBrush, &MoveVec);
364364
365365 App->CLSB_Doc->UpdateAllViews (UAV_ALL3DVIEWS, NULL);
366366 m_pDoc->SetModifiedFlag ();
--- WorldEditor/WorldEditor/A_Dialogs.cpp (revision 2542)
+++ WorldEditor/WorldEditor/A_Dialogs.cpp (revision 2543)
@@ -687,7 +687,7 @@
687687 }
688688 else
689689 {
690- App->CLSB_Doc->MoveSelectedBrushList(App->CL_Dialogs->m_pDoc->pSelBrushes, &App->CL_Dialogs->CenterOfSelection);
690+ App->CLSB_Doc->MoveSelectedBrushList(App->CLSB_Doc->pSelBrushes, &App->CL_Dialogs->CenterOfSelection);
691691 }
692692
693693 App->CLSB_Doc->UpdateAllViews(UAV_ALL3DVIEWS, NULL);
@@ -715,7 +715,7 @@
715715 }
716716 else
717717 {
718- App->CLSB_Doc->MoveSelectedBrushList(App->CL_Dialogs->m_pDoc->pSelBrushes, &App->CL_Dialogs->CenterOfSelection);
718+ App->CLSB_Doc->MoveSelectedBrushList(App->CLSB_Doc->pSelBrushes, &App->CL_Dialogs->CenterOfSelection);
719719 }
720720
721721 App->CLSB_Doc->UpdateAllViews(UAV_ALL3DVIEWS, NULL);
--- WorldEditor/WorldEditor/A_FaceDialog.cpp (revision 2542)
+++ WorldEditor/WorldEditor/A_FaceDialog.cpp (revision 2543)
@@ -353,11 +353,11 @@
353353 int test = SendMessage(temp, BM_GETCHECK, 0, 0);
354354 if (test == BST_CHECKED)
355355 {
356- NumberOfFaces = SelFaceList_GetSize(App->m_pDoc->pSelFaces);
356+ NumberOfFaces = SelFaceList_GetSize(App->CLSB_Doc->pSelFaces);
357357
358358 for (int i = 0; i < NumberOfFaces; ++i)
359359 {
360- pFace = SelFaceList_GetFace(App->m_pDoc->pSelFaces,i);
360+ pFace = SelFaceList_GetFace(App->CLSB_Doc->pSelFaces,i);
361361 Face_SetTextureLock(pFace,true);
362362 }
363363
@@ -367,11 +367,11 @@
367367 }
368368 else
369369 {
370- NumberOfFaces = SelFaceList_GetSize(App->m_pDoc->pSelFaces);
370+ NumberOfFaces = SelFaceList_GetSize(App->CLSB_Doc->pSelFaces);
371371
372372 for (int i = 0; i < NumberOfFaces; ++i)
373373 {
374- pFace = SelFaceList_GetFace(App->m_pDoc->pSelFaces, i);
374+ pFace = SelFaceList_GetFace(App->CLSB_Doc->pSelFaces, i);
375375 Face_SetTextureLock(pFace, false);
376376 }
377377
@@ -517,11 +517,11 @@
517517
518518 if (App->m_pDoc)
519519 {
520- NumberOfFaces = SelFaceList_GetSize (App->m_pDoc->pSelFaces);
520+ NumberOfFaces = SelFaceList_GetSize (App->CLSB_Doc->pSelFaces);
521521 // pFace = SelFaceList_GetFace (pDoc->pSelFaces, 0);
522522 if (NumberOfFaces)
523523 {
524- pFace = SelFaceList_GetFace(App->m_pDoc->pSelFaces, (NumberOfFaces - 1));
524+ pFace = SelFaceList_GetFace(App->CLSB_Doc->pSelFaces, (NumberOfFaces - 1));
525525 }
526526 else
527527 {
@@ -577,11 +577,11 @@
577577 Face* pFace;
578578
579579
580- NumberOfFaces = SelFaceList_GetSize(App->m_pDoc->pSelFaces);
580+ NumberOfFaces = SelFaceList_GetSize(App->CLSB_Doc->pSelFaces);
581581 // pFace = SelFaceList_GetFace (pDoc->pSelFaces, 0);
582582 if (NumberOfFaces)
583583 {
584- pFace = SelFaceList_GetFace(App->m_pDoc->pSelFaces, (NumberOfFaces - 1));
584+ pFace = SelFaceList_GetFace(App->CLSB_Doc->pSelFaces, (NumberOfFaces - 1));
585585 }
586586 else
587587 {
@@ -677,7 +677,7 @@
677677 {
678678 App->m_pDoc->SetModifiedFlag();
679679 m_TextureYScale = -m_TextureYScale;
680- SelFaceList_Enum (App->m_pDoc->pSelFaces, FlipVertical, NULL);
680+ SelFaceList_Enum (App->CLSB_Doc->pSelFaces, FlipVertical, NULL);
681681 AssignCurrentToViews();
682682 }
683683 }
@@ -704,7 +704,7 @@
704704 {
705705 App->m_pDoc->SetModifiedFlag();
706706 m_TextureXScale = -m_TextureXScale;
707- SelFaceList_Enum (App->m_pDoc->pSelFaces, FlipHorizontal, NULL);
707+ SelFaceList_Enum (App->CLSB_Doc->pSelFaces, FlipHorizontal, NULL);
708708 AssignCurrentToViews();
709709 }
710710
@@ -732,7 +732,7 @@
732732 if (App->m_pDoc)
733733 {
734734 App->m_pDoc->SetModifiedFlag();
735- SelFaceList_Enum (App->m_pDoc->pSelFaces, ChangeTextureAngle, &m_TextureAngle);
735+ SelFaceList_Enum (App->CLSB_Doc->pSelFaces, ChangeTextureAngle, &m_TextureAngle);
736736
737737 AssignCurrentToViews ();
738738 }
@@ -761,7 +761,7 @@
761761 if (App->m_pDoc)
762762 {
763763 App->m_pDoc->SetModifiedFlag();
764- SelFaceList_Enum (App->m_pDoc->pSelFaces, ChangeYOffset, &m_TextureYOffset);
764+ SelFaceList_Enum (App->CLSB_Doc->pSelFaces, ChangeYOffset, &m_TextureYOffset);
765765 AssignCurrentToViews ();
766766 }
767767 }
@@ -789,7 +789,7 @@
789789 if (App->m_pDoc)
790790 {
791791 App->m_pDoc->SetModifiedFlag();
792- SelFaceList_Enum (App->m_pDoc->pSelFaces, ChangeXOffset, &m_TextureXOffset);
792+ SelFaceList_Enum (App->CLSB_Doc->pSelFaces, ChangeXOffset, &m_TextureXOffset);
793793 AssignCurrentToViews ();
794794 }
795795 }
@@ -817,7 +817,7 @@
817817 if (App->m_pDoc)
818818 {
819819 App->m_pDoc->SetModifiedFlag();
820- SelFaceList_Enum (App->m_pDoc->pSelFaces, ChangeTextureYScale, &m_TextureYScale);
820+ SelFaceList_Enum (App->CLSB_Doc->pSelFaces, ChangeTextureYScale, &m_TextureYScale);
821821 AssignCurrentToViews ();
822822 }
823823 }
@@ -845,7 +845,7 @@
845845 if (App->m_pDoc)
846846 {
847847 App->m_pDoc->SetModifiedFlag();
848- SelFaceList_Enum (App->m_pDoc->pSelFaces, ChangeTextureXScale, &m_TextureXScale);
848+ SelFaceList_Enum (App->CLSB_Doc->pSelFaces, ChangeTextureXScale, &m_TextureXScale);
849849 AssignCurrentToViews ();
850850 }
851851 }
@@ -864,10 +864,10 @@
864864 // update child faces on all selected brushes
865865 int NumSelBrushes;
866866
867- NumSelBrushes = SelBrushList_GetSize (App->m_pDoc->pSelBrushes);
867+ NumSelBrushes = SelBrushList_GetSize (App->CLSB_Doc->pSelBrushes);
868868 for (int i = 0; i < NumSelBrushes; ++i)
869869 {
870- Brush *pBrush = SelBrushList_GetBrush (App->m_pDoc->pSelBrushes, i);
870+ Brush *pBrush = SelBrushList_GetBrush (App->CLSB_Doc->pSelBrushes, i);
871871 Brush_UpdateChildFaces (pBrush);
872872 }
873873
--- WorldEditor/WorldEditor/A_File.cpp (revision 2542)
+++ WorldEditor/WorldEditor/A_File.cpp (revision 2543)
@@ -363,22 +363,22 @@
363363
364364 assert (pBrush != NULL);
365365
366- if (App->m_pDoc->BTemplate != NULL)
366+ if (App->CLSB_Doc->BTemplate != NULL)
367367 {
368- Brush_Destroy (&App->m_pDoc->BTemplate);
368+ Brush_Destroy (&App->CLSB_Doc->BTemplate);
369369 }
370370
371- App->m_pDoc->BTemplate = pBrush;
372- App->m_pDoc->CurBrush = pBrush;
371+ App->CLSB_Doc->BTemplate = pBrush;
372+ App->CLSB_Doc->CurBrush = pBrush;
373373
374- App->m_pDoc->TempEnt = FALSE;
375- App->m_pDoc->SetDefaultBrushTexInfo (App->m_pDoc->CurBrush);
376- Brush_Bound (App->m_pDoc->CurBrush);
377- Brush_Center (App->m_pDoc->CurBrush, &BrushPos);
374+ App->CLSB_Doc->TempEnt = FALSE;
375+ App->m_pDoc->SetDefaultBrushTexInfo (App->CLSB_Doc->CurBrush);
376+ Brush_Bound (App->CLSB_Doc->CurBrush);
377+ Brush_Center (App->CLSB_Doc->CurBrush, &BrushPos);
378378
379379 pTemplatePos = Level_GetTemplatePos (App->CLSB_Doc->pLevel);
380380 geVec3d_Subtract (pTemplatePos, &BrushPos, &MoveVec);
381- Brush_Move (App->m_pDoc->CurBrush, &MoveVec);
381+ Brush_Move (App->CLSB_Doc->CurBrush, &MoveVec);
382382
383383 App->CLSB_Doc->UpdateAllViews (UAV_ALL3DVIEWS, NULL);
384384 App->m_pDoc->SetModifiedFlag ();
@@ -390,6 +390,7 @@
390390 void SB_File_WE::AddCameraEntityToLevel(void)
391391 {
392392 CEntity* pCameraEntity = App->CLSB_Camera_WE->FindCameraEntity();
393+
393394 if (!pCameraEntity)
394395 {
395396 // Make default camera entity
@@ -396,7 +397,7 @@
396397 CEntity CameraEntity ;
397398 CString cstr;
398399
399- App->m_pDoc->CreateEntityFromName( "Camera", CameraEntity ) ;
400+ App->CLSB_Doc->CreateEntityFromName( "Camera", CameraEntity ) ;
400401 cstr.LoadString( IDS_CAMERAENTITYNAME ) ;
401402 CameraEntity.SetKeyValue ("%name%", cstr );
402403 CameraEntity.SetOrigin ( 0.0f, 0.0f, 0.0f, Level_GetEntityDefs (App->CLSB_Doc->pLevel) );
@@ -418,7 +419,7 @@
418419 CEntity ZeroEntity;
419420 CString cstr;
420421
421- App->m_pDoc->CreateEntityFromName("Zero", ZeroEntity);
422+ App->CLSB_Doc->CreateEntityFromName("Zero", ZeroEntity);
422423 cstr.LoadString(IDS_CAMERAENTITYNAME);
423424 ZeroEntity.SetKeyValue("%name%", "Zero");
424425 ZeroEntity.SetOrigin(0.0f, 0.0f, 0.0f, Level_GetEntityDefs(App->CLSB_Doc->pLevel));
@@ -572,7 +573,7 @@
572573
573574 if(pBrush!=NULL)
574575 {
575- SelBrushList_Remove(App->m_pDoc->pSelBrushes, pBrush);
576+ SelBrushList_Remove(App->CLSB_Doc->pSelBrushes, pBrush);
576577 Level_RemoveBrush(NewLevel, pBrush);
577578 (*Entities)[i].DeleteActorBrush();
578579 }
@@ -1112,21 +1113,21 @@
11121113 }
11131114
11141115
1115- App->m_pDoc->pSelBrushes = SelBrushList_Create();
1116+ App->CLSB_Doc->pSelBrushes = SelBrushList_Create();
11161117 App->CLSB_Doc->pTempSelBrushes = SelBrushList_Create();
1117- App->m_pDoc->pSelFaces = SelFaceList_Create();
1118+ App->CLSB_Doc->pSelFaces = SelFaceList_Create();
11181119
1119- App->m_pDoc->SetLockAxis(0); // Start with no axis locked
1120+ App->CLSB_Doc->SetLockAxis(0); // Start with no axis locked
11201121
11211122 {
11221123 BrushTemplate_Box* pBoxTemplate;
11231124 pBoxTemplate = Level_GetBoxTemplate(App->CLSB_Doc->pLevel);
11241125
1125- App->m_pDoc->BTemplate = BrushTemplate_CreateBox(pBoxTemplate);
1126+ App->CLSB_Doc->BTemplate = BrushTemplate_CreateBox(pBoxTemplate);
11261127 }
11271128
1128- Brush_Bound(App->m_pDoc->BTemplate);
1129- App->m_pDoc->CurBrush = App->m_pDoc->BTemplate;
1129+ Brush_Bound(App->CLSB_Doc->BTemplate);
1130+ App->CLSB_Doc->CurBrush = App->CLSB_Doc->BTemplate;
11301131
11311132 geVec3d_Clear(&App->CLSB_Doc->SelectedGeoCenter);
11321133
--- WorldEditor/WorldEditor/A_MainView.cpp (revision 2542)
+++ WorldEditor/WorldEditor/A_MainView.cpp (revision 2543)
@@ -1187,7 +1187,7 @@
11871187 brushDrawData.FlagTest = NULL;
11881188 {
11891189 CEntityArray *Entities = Level_GetEntities (App->CLSB_Doc->pLevel);
1190- int NumSelBrushes = SelBrushList_GetSize (m_pDoc->pSelBrushes);
1190+ int NumSelBrushes = SelBrushList_GetSize (App->CLSB_Doc->pSelBrushes);
11911191
11921192 // render selected brushes and entities
11931193 pDC->SelectObject(&PenSelected);
@@ -1196,7 +1196,7 @@
11961196 {
11971197 Brush *pBrush;
11981198
1199- pBrush = SelBrushList_GetBrush (m_pDoc->pSelBrushes, i);
1199+ pBrush = SelBrushList_GetBrush (App->CLSB_Doc->pSelBrushes, i);
12001200 if (m_pDoc->fdocShowBrush (pBrush, &ViewBox))
12011201 {
12021202 if(Brush_IsMulti (pBrush))
@@ -1238,25 +1238,25 @@
12381238 pDC->SelectObject (&PenTemplate);
12391239
12401240 if((App->CLSB_Doc->mModeTool==ID_TOOLS_TEMPLATE)||
1241- (App->CLSB_Doc->mModeTool==ID_TOOLS_CAMERA && m_pDoc->GetSelState()==NOSELECTIONS))
1241+ (App->CLSB_Doc->mModeTool==ID_TOOLS_CAMERA && App->CLSB_Doc->GetSelState()==NOSELECTIONS))
12421242 {
1243- if(!m_pDoc->TempEnt)
1243+ if(!App->CLSB_Doc->TempEnt)
12441244 {
1245- if (Brush_TestBoundsIntersect(m_pDoc->CurBrush, &ViewBox))
1245+ if (Brush_TestBoundsIntersect(App->CLSB_Doc->CurBrush, &ViewBox))
12461246 {
1247- if(Brush_IsMulti(m_pDoc->CurBrush))
1247+ if(Brush_IsMulti(App->CLSB_Doc->CurBrush))
12481248 {
1249- BrushList_EnumLeafBrushes(App->CL_Brush->Brush_GetBrushList(m_pDoc->CurBrush), &brushDrawData, BrushDraw);
1249+ BrushList_EnumLeafBrushes(App->CL_Brush->Brush_GetBrushList(App->CLSB_Doc->CurBrush), &brushDrawData, BrushDraw);
12501250 }
12511251 else
12521252 {
1253- Render_RenderBrushFacesOrtho(v, m_pDoc->CurBrush, pDC->m_hDC);
1253+ Render_RenderBrushFacesOrtho(v, App->CLSB_Doc->CurBrush, pDC->m_hDC);
12541254 }
12551255 }
12561256 }
12571257 else
12581258 {
1259- fdocDrawEntity (&m_pDoc->mRegularEntity, v, pDC, Level_GetEntityDefs (App->CLSB_Doc->pLevel), GE_FALSE );
1259+ fdocDrawEntity (&App->CLSB_Doc->mRegularEntity, v, pDC, Level_GetEntityDefs (App->CLSB_Doc->pLevel), GE_FALSE );
12601260 }
12611261 }
12621262 }
--- WorldEditor/WorldEditor/A_TabsGroups_Dlg.cpp (revision 2542)
+++ WorldEditor/WorldEditor/A_TabsGroups_Dlg.cpp (revision 2543)
@@ -329,7 +329,7 @@
329329
330330 Selected_Brush = App->CL_World->Get_Brush_ByIndex( Index );
331331
332- SelBrushList_Add(App->m_pDoc->pSelBrushes, Selected_Brush);
332+ SelBrushList_Add(App->CLSB_Doc->pSelBrushes, Selected_Brush);
333333
334334 if (Clear == 1)
335335 {
@@ -384,7 +384,7 @@
384384 void A_TabsGroups_Dlg::Update_Dlg_SelectedBrushesCount()
385385 {
386386 char buff[100];
387- int NumSelBrushes = SelBrushList_GetSize(App->m_pDoc->pSelBrushes);
387+ int NumSelBrushes = SelBrushList_GetSize(App->CLSB_Doc->pSelBrushes);
388388 SetDlgItemText(GroupsDlg_Hwnd, IDC_ST_GD_SELECTED, itoa(NumSelBrushes, buff, 10));
389389 }
390390
@@ -448,7 +448,7 @@
448448 else
449449 {
450450 App->CL_TabsGroups_Dlg->Selected_Index = Index;
451- App->CL_TabsGroups_Dlg->Selected_Brush = SelBrushList_GetBrush(App->m_pDoc->pSelBrushes, Index);
451+ App->CL_TabsGroups_Dlg->Selected_Brush = SelBrushList_GetBrush(App->CLSB_Doc->pSelBrushes, Index);
452452 App->CL_TabsGroups_Dlg->List_BrushData(hDlg);
453453 }
454454
@@ -521,7 +521,7 @@
521521 {
522522 SendDlgItemMessage(hDlg, IDC_LIST_SELECTEDBRUSHES, LB_RESETCONTENT, (WPARAM)0, (LPARAM)0);
523523
524- int NumSelBrushes = SelBrushList_GetSize(App->m_pDoc->pSelBrushes);
524+ int NumSelBrushes = SelBrushList_GetSize(App->CLSB_Doc->pSelBrushes);
525525
526526 if (NumSelBrushes == 0)
527527 {
@@ -531,7 +531,7 @@
531531
532532 for (int i = 0; i < NumSelBrushes; ++i)
533533 {
534- Brush* pBrush = SelBrushList_GetBrush(App->m_pDoc->pSelBrushes, i);
534+ Brush* pBrush = SelBrushList_GetBrush(App->CLSB_Doc->pSelBrushes, i);
535535 SendDlgItemMessage(hDlg, IDC_LIST_SELECTEDBRUSHES, LB_ADDSTRING, (WPARAM)0, (LPARAM)pBrush->Name);
536536 }
537537
@@ -538,7 +538,7 @@
538538 SendDlgItemMessage(hDlg, IDC_LIST_SELECTEDBRUSHES, LB_SETCURSEL, (WPARAM) 0, (LPARAM)0);
539539
540540 Selected_Index = 0;
541- Selected_Brush = SelBrushList_GetBrush(App->m_pDoc->pSelBrushes, 0);
541+ Selected_Brush = SelBrushList_GetBrush(App->CLSB_Doc->pSelBrushes, 0);
542542 }
543543
544544 // *************************************************************************
@@ -785,7 +785,7 @@
785785 {
786786 App->Get_Current_Document();
787787
788- int NumSelBrushes = SelBrushList_GetSize(App->m_pDoc->pSelBrushes);
788+ int NumSelBrushes = SelBrushList_GetSize(App->CLSB_Doc->pSelBrushes);
789789 if (NumSelBrushes == 0)
790790 {
791791 EnableWindow(GetDlgItem(GroupsDlg_Hwnd, IDC_BT_GD_BRUSHPROPERTIES), 0);
--- WorldEditor/WorldEditor/A_TabsTemplates_Dlg.cpp (revision 2542)
+++ WorldEditor/WorldEditor/A_TabsTemplates_Dlg.cpp (revision 2543)
@@ -260,22 +260,22 @@
260260
261261 assert (pBrush != NULL);
262262
263- if (App->m_pDoc->BTemplate != NULL)
263+ if (App->CLSB_Doc->BTemplate != NULL)
264264 {
265- Brush_Destroy (&App->m_pDoc->BTemplate);
265+ Brush_Destroy (&App->CLSB_Doc->BTemplate);
266266 }
267267
268- App->m_pDoc->BTemplate = pBrush;
269- App->m_pDoc->CurBrush = pBrush;
268+ App->CLSB_Doc->BTemplate = pBrush;
269+ App->CLSB_Doc->CurBrush = pBrush;
270270
271- App->m_pDoc->TempEnt = FALSE;
272- App->m_pDoc->SetDefaultBrushTexInfo (App->m_pDoc->CurBrush);
273- Brush_Bound (App->m_pDoc->CurBrush);
274- Brush_Center (App->m_pDoc->CurBrush, &BrushPos);
271+ App->CLSB_Doc->TempEnt = FALSE;
272+ App->m_pDoc->SetDefaultBrushTexInfo (App->CLSB_Doc->CurBrush);
273+ Brush_Bound (App->CLSB_Doc->CurBrush);
274+ Brush_Center (App->CLSB_Doc->CurBrush, &BrushPos);
275275
276276 pTemplatePos = Level_GetTemplatePos (App->CLSB_Doc->pLevel);
277277 geVec3d_Subtract (pTemplatePos, &BrushPos, &MoveVec);
278- Brush_Move (App->m_pDoc->CurBrush, &MoveVec);
278+ Brush_Move (App->CLSB_Doc->CurBrush, &MoveVec);
279279
280280 App->CLSB_Doc->UpdateAllViews (UAV_ALL3DVIEWS, NULL);
281281 App->m_pDoc->SetModifiedFlag ();
--- WorldEditor/WorldEditor/A_TextureDialog.cpp (revision 2542)
+++ WorldEditor/WorldEditor/A_TextureDialog.cpp (revision 2543)
@@ -407,17 +407,17 @@
407407
408408 App->m_pDoc->SetModifiedFlag();
409409
410- switch (App->m_pDoc->mAdjustMode)
410+ switch (App->CLSB_Doc->mAdjustMode)
411411 {
412412 case ADJUST_MODE_FACE :
413413 {
414414 int Size;
415415
416- Size = SelFaceList_GetSize (App->m_pDoc->pSelFaces);
416+ Size = SelFaceList_GetSize (App->CLSB_Doc->pSelFaces);
417417 for (i = 0; i < Size; ++i)
418418 {
419419 Face *pFace;
420- pFace = SelFaceList_GetFace (App->m_pDoc->pSelFaces, i);
420+ pFace = SelFaceList_GetFace (App->CLSB_Doc->pSelFaces, i);
421421
422422 // changed QD 12/03
423423 WadFileEntry* BitmapPtr = App->m_pDoc->GetDibBitmap( m_CurrentTexture );
@@ -425,12 +425,12 @@
425425 // end change
426426 }
427427 // have to go through the selected brushes and update their child faces
428- int NumSelBrushes = SelBrushList_GetSize (App->m_pDoc->pSelBrushes);
428+ int NumSelBrushes = SelBrushList_GetSize (App->CLSB_Doc->pSelBrushes);
429429 for (i = 0; i < NumSelBrushes; ++i)
430430 {
431431 Brush *pBrush;
432432
433- pBrush = SelBrushList_GetBrush (App->m_pDoc->pSelBrushes, i);
433+ pBrush = SelBrushList_GetBrush (App->CLSB_Doc->pSelBrushes, i);
434434 Brush_UpdateChildFaces (pBrush);
435435 }
436436 break;
@@ -438,12 +438,12 @@
438438
439439 case ADJUST_MODE_BRUSH :
440440 {
441- if(App->m_pDoc->GetSelState() & MULTIBRUSH)
441+ if(App->CLSB_Doc->GetSelState() & MULTIBRUSH)
442442 {
443- int NumSelBrushes = SelBrushList_GetSize (App->m_pDoc->pSelBrushes);
443+ int NumSelBrushes = SelBrushList_GetSize (App->CLSB_Doc->pSelBrushes);
444444 for (i = 0; i < NumSelBrushes; ++i)
445445 {
446- Brush *pBrush = SelBrushList_GetBrush (App->m_pDoc->pSelBrushes, i);
446+ Brush *pBrush = SelBrushList_GetBrush (App->CLSB_Doc->pSelBrushes, i);
447447 // changed QD 12/03
448448 WadFileEntry* BitmapPtr = App->m_pDoc->GetDibBitmap( m_CurrentTexture );
449449 ::TextureBrush (pBrush, SelectedItem, (LPCSTR)m_CurrentTexture, BitmapPtr);
@@ -455,9 +455,9 @@
455455 {
456456 // changed QD 12/03
457457 WadFileEntry* BitmapPtr = App->m_pDoc->GetDibBitmap( m_CurrentTexture );
458- ::TextureBrush (App->m_pDoc->CurBrush, SelectedItem, (LPCSTR)m_CurrentTexture, BitmapPtr);
458+ ::TextureBrush (App->CLSB_Doc->CurBrush, SelectedItem, (LPCSTR)m_CurrentTexture, BitmapPtr);
459459 // end change
460- Brush_UpdateChildFaces (App->m_pDoc->CurBrush);
460+ Brush_UpdateChildFaces (App->CLSB_Doc->CurBrush);
461461 }
462462 break;
463463 }
--- WorldEditor/WorldEditor/A_TopTabs.cpp (revision 2542)
+++ WorldEditor/WorldEditor/A_TopTabs.cpp (revision 2543)
@@ -1032,11 +1032,9 @@
10321032 // *************************************************************************
10331033 void SB_TopTabs::Select_Mode()
10341034 {
1035- m_pDoc = (CFusionDoc*)App->m_pMainFrame->GetCurrentDoc();
1036-
10371035 App->CLSB_Doc->mCurrentTool = CURTOOL_NONE;
10381036 App->CLSB_Doc->mModeTool = ID_GENERALSELECT;
1039- m_pDoc->ConfigureCurrentTool();
1037+ App->CLSB_Doc->ConfigureCurrentTool();
10401038
10411039 }
10421040
@@ -1047,11 +1045,11 @@
10471045 {
10481046 CFusionView *pView;
10491047
1050- m_pDoc = (CFusionDoc*)App->m_pMainFrame->GetCurrentDoc();
1048+ App->Get_Current_Document();
10511049
10521050 POSITION pos;
1053- pos = m_pDoc->GetFirstViewPosition();
1054- pView = (CFusionView*)m_pDoc->GetNextView(pos) ;
1051+ pos = App->m_pDoc->GetFirstViewPosition();
1052+ pView = (CFusionView*)App->m_pDoc->GetNextView(pos) ;
10551053
10561054 int mode = pView->GetModeTool();
10571055
@@ -1058,7 +1056,7 @@
10581056 if(mode == ID_TOOLS_TEMPLATE)
10591057 {
10601058 pView->SetTool( ID_TOOLS_BRUSH_MOVEROTATEBRUSH );
1061- m_pDoc->ConfigureCurrentTool();
1059+ App->CLSB_Doc->ConfigureCurrentTool();
10621060 }
10631061 else
10641062 {
@@ -1072,7 +1070,7 @@
10721070 pView->SetTool(ID_TOOLS_BRUSH_MOVEROTATEBRUSH);
10731071 }
10741072
1075- m_pDoc->ConfigureCurrentTool();
1073+ App->CLSB_Doc->ConfigureCurrentTool();
10761074 }
10771075 }
10781076
@@ -1089,7 +1087,7 @@
10891087 if(mode == ID_TOOLS_TEMPLATE)
10901088 {
10911089 App->CLSB_Doc->mCurrentTool = ID_TOOLS_BRUSH_SCALEBRUSH;
1092- App->m_pDoc->ConfigureCurrentTool();
1090+ App->CLSB_Doc->ConfigureCurrentTool();
10931091 }
10941092 else
10951093 {
@@ -1096,7 +1094,7 @@
10961094 if(App->CLSB_Doc->mCurrentTool == ID_TOOLS_BRUSH_SCALEBRUSH)
10971095 {
10981096 App->CLSB_Doc->mCurrentTool = CURTOOL_NONE;
1099- App->m_pDoc->mAdjustMode = ADJUST_MODE_FACE;
1097+ App->CLSB_Doc->mAdjustMode = ADJUST_MODE_FACE;
11001098 }
11011099 else
11021100 {
@@ -1103,7 +1101,7 @@
11031101 App->CLSB_Doc->mCurrentTool = ID_TOOLS_BRUSH_SCALEBRUSH;
11041102 }
11051103
1106- App->m_pDoc->ConfigureCurrentTool();
1104+ App->CLSB_Doc->ConfigureCurrentTool();
11071105 }
11081106 }
11091107
@@ -1125,7 +1123,7 @@
11251123 if(mode == ID_TOOLS_TEMPLATE)
11261124 {
11271125 pView->SetTool( ID_TOOLS_BRUSH_SHEARBRUSH);
1128- App->m_pDoc->ConfigureCurrentTool();
1126+ App->CLSB_Doc->ConfigureCurrentTool();
11291127 }
11301128 else
11311129 {
@@ -1139,7 +1137,7 @@
11391137 pView->SetTool(ID_TOOLS_BRUSH_SHEARBRUSH);
11401138 }
11411139
1142- App->m_pDoc->ConfigureCurrentTool();
1140+ App->CLSB_Doc->ConfigureCurrentTool();
11431141 }
11441142 }
11451143
@@ -1166,7 +1164,7 @@
11661164 }
11671165 }
11681166
1169- int NumSelBrushes = SelBrushList_GetSize(App->m_pDoc->pSelBrushes);
1167+ int NumSelBrushes = SelBrushList_GetSize(App->CLSB_Doc->pSelBrushes);
11701168 if (NumSelBrushes == 0)
11711169 {
11721170 EndDialog(App->CLSB_Brushes->Dimensions_Dlg_hWnd, 0);
--- WorldEditor/WorldEditor/A_TopTabs.h (revision 2542)
+++ WorldEditor/WorldEditor/A_TopTabs.h (revision 2543)
@@ -91,7 +91,4 @@
9191 bool Brush_MoveRotate_Flag;
9292 bool Brush_Scale_Flag;
9393 bool Brush_Shear_Flag;
94-
95- CFusionDoc *m_pDoc;
96-
9794 };
--- WorldEditor/WorldEditor/BrushAttributesDialog.cpp (revision 2542)
+++ WorldEditor/WorldEditor/BrushAttributesDialog.cpp (revision 2543)
@@ -138,11 +138,11 @@
138138 {
139139 pDoc->SetModifiedFlag();
140140 int i;
141- int NumBrushes = SelBrushList_GetSize (pDoc->pSelBrushes);
141+ int NumBrushes = SelBrushList_GetSize (App->CLSB_Doc->pSelBrushes);
142142
143143 for (i = 0; i < NumBrushes; ++i)
144144 {
145- Brush *pBrush = SelBrushList_GetBrush (pDoc->pSelBrushes, i);
145+ Brush *pBrush = SelBrushList_GetBrush (App->CLSB_Doc->pSelBrushes, i);
146146
147147 switch( m_BrushType )
148148 {
@@ -267,7 +267,7 @@
267267 {
268268 pDoc->SetModifiedFlag();
269269 char const *pName;
270- int NumBrushes = SelBrushList_GetSize (pDoc->pSelBrushes);
270+ int NumBrushes = SelBrushList_GetSize (App->CLSB_Doc->pSelBrushes);
271271 int i;
272272
273273 // update user flags
@@ -284,7 +284,7 @@
284284
285285 for (i = 0; i < NumBrushes; ++i)
286286 {
287- Brush *pBrush = SelBrushList_GetBrush (pDoc->pSelBrushes, i);
287+ Brush *pBrush = SelBrushList_GetBrush (App->CLSB_Doc->pSelBrushes, i);
288288
289289 pName = App->CL_Brush->Brush_GetName (pBrush);
290290 // Flags for the Types (RB's) are always up to date.
@@ -330,10 +330,10 @@
330330 CFusionDoc *pDoc = m_pMainFrame->GetCurrentDoc();
331331 if (pDoc)
332332 {
333- NumberOfBrushes = SelBrushList_GetSize (pDoc->pSelBrushes);
333+ NumberOfBrushes = SelBrushList_GetSize (App->CLSB_Doc->pSelBrushes);
334334 // pBrush = SelBrushList_GetBrush (pDoc->pSelBrushes, 0);
335335 if (NumberOfBrushes)
336- pBrush = SelBrushList_GetBrush (pDoc->pSelBrushes, (NumberOfBrushes-1));
336+ pBrush = SelBrushList_GetBrush (App->CLSB_Doc->pSelBrushes, (NumberOfBrushes-1));
337337 else
338338 pBrush = NULL;
339339 }
@@ -589,7 +589,7 @@
589589 {
590590 pDoc->SetModifiedFlag();
591591 UpdateData (TRUE);
592- SelBrushList_Enum (pDoc->pSelBrushes, ::SetFlocking, &m_Flocking);
592+ SelBrushList_Enum (App->CLSB_Doc->pSelBrushes, ::SetFlocking, &m_Flocking);
593593 AssignCurrentToViews ();
594594 }
595595 }
@@ -611,7 +611,7 @@
611611 {
612612 pDoc->SetModifiedFlag();
613613 UpdateData (TRUE);
614- SelBrushList_Enum (pDoc->pSelBrushes, ::SetSheet, &m_Sheet);
614+ SelBrushList_Enum (App->CLSB_Doc->pSelBrushes, ::SetSheet, &m_Sheet);
615615 AssignCurrentToViews ();
616616 }
617617 }
@@ -641,7 +641,7 @@
641641 {
642642 pDoc->SetModifiedFlag();
643643 UpdateData (TRUE);
644- SelBrushList_Enum (pDoc->pSelBrushes, ::SetDetail, &m_Detail);
644+ SelBrushList_Enum (App->CLSB_Doc->pSelBrushes, ::SetDetail, &m_Detail);
645645 AssignCurrentToViews ();
646646 }
647647 }
@@ -663,7 +663,7 @@
663663 {
664664 pDoc->SetModifiedFlag();
665665 UpdateData (TRUE);
666- SelBrushList_Enum (pDoc->pSelBrushes, ::SetArea, &m_Area);
666+ SelBrushList_Enum (App->CLSB_Doc->pSelBrushes, ::SetArea, &m_Area);
667667 AssignCurrentToViews ();
668668 }
669669 }
@@ -685,7 +685,7 @@
685685 {
686686 pDoc->SetModifiedFlag();
687687 UpdateData (TRUE);
688- SelBrushList_Enum (pDoc->pSelBrushes, ::SetWavy, &m_Wavy);
688+ SelBrushList_Enum (App->CLSB_Doc->pSelBrushes, ::SetWavy, &m_Wavy);
689689 AssignCurrentToViews ();
690690 }
691691 }
@@ -718,7 +718,7 @@
718718 }
719719 // end change
720720 pDoc->SetModifiedFlag();
721- SelBrushList_Enum (pDoc->pSelBrushes, ::SetName, &m_Name);
721+ SelBrushList_Enum (App->CLSB_Doc->pSelBrushes, ::SetName, &m_Name);
722722 AssignCurrentToViews ();
723723 }
724724 }
@@ -750,7 +750,7 @@
750750
751751 pDoc->SetModifiedFlag();
752752 UpdateData (TRUE);
753- SelBrushList_Enum (pDoc->pSelBrushes, ::SetUserFlags, &UserFlags);
753+ SelBrushList_Enum (App->CLSB_Doc->pSelBrushes, ::SetUserFlags, &UserFlags);
754754 AssignCurrentToViews ();
755755 }
756756 }
--- WorldEditor/WorldEditor/FUSIONDoc.cpp (revision 2542)
+++ WorldEditor/WorldEditor/FUSIONDoc.cpp (revision 2543)
@@ -279,19 +279,12 @@
279279 // end change
280280 }
281281
282-CFusionDoc::CFusionDoc() : CDocument (),
282+CFusionDoc::CFusionDoc() : CDocument(),
283283
284- SelectLock (FALSE), TempEnt (FALSE), SelState (NOSELECTIONS),
285- mShowSelectedBrushes (FALSE),
286- LeakPoints (NULL), NumLeakPoints (0), bLeakLoaded (FALSE), bShowLeak (TRUE),
287- bShowClipBrushes (GE_TRUE), bShowDetailBrushes (GE_TRUE), bShowHintBrushes (GE_TRUE), bShowActors(GE_TRUE)/*changed QD*/,
288- mpActiveViewFrame (NULL), // mpBrushAttributes (NULL), mpFaceAttributes (NULL),
289- /*mpTextureView (NULL), */mWorldBsp (NULL),
290- mAdjustMode (ADJUST_MODE_FACE),
291- mConstrainHollows (GE_TRUE),
292- //mTextureBrowserOpen (0),
293- TempShearTemplate (NULL), PlaceObjectFlag (FALSE),
294- pSelFaces (NULL), pSelBrushes (NULL)//, pCameraEntity (NULL)
284+LeakPoints(NULL), NumLeakPoints(0), bLeakLoaded(FALSE), bShowLeak(TRUE),
285+bShowClipBrushes(GE_TRUE), bShowDetailBrushes(GE_TRUE), bShowHintBrushes(GE_TRUE), bShowActors(GE_TRUE)/*changed QD*/,
286+mpActiveViewFrame(NULL)
287+
295288 {
296289
297290 const char *DefaultWadName;
@@ -332,11 +325,11 @@
332325 App->hInst = AfxGetApp()->m_hInstance;
333326 App->hMenu_WE = GetMenu(App->MainHwnd);
334327
335- pSelBrushes = SelBrushList_Create ();
328+ App->CLSB_Doc->pSelBrushes = SelBrushList_Create ();
336329 App->CLSB_Doc->pTempSelBrushes = SelBrushList_Create ();
337- pSelFaces = SelFaceList_Create ();
330+ App->CLSB_Doc->pSelFaces = SelFaceList_Create ();
338331
339- SetLockAxis( 0 ) ; // Start with no axis locked
332+ App->CLSB_Doc->SetLockAxis( 0 ) ; // Start with no axis locked
340333
341334 {
342335 // create our default box
@@ -343,11 +336,11 @@
343336 BrushTemplate_Box *pBoxTemplate;
344337 pBoxTemplate = Level_GetBoxTemplate (App->CLSB_Doc->pLevel);
345338
346- BTemplate = BrushTemplate_CreateBox (pBoxTemplate);
339+ App->CLSB_Doc->BTemplate = BrushTemplate_CreateBox (pBoxTemplate);
347340 }
348341
349- Brush_Bound(BTemplate);
350- CurBrush =BTemplate;
342+ Brush_Bound(App->CLSB_Doc->BTemplate);
343+ App->CLSB_Doc->CurBrush = App->CLSB_Doc->BTemplate;
351344
352345 geVec3d_Clear(&App->CLSB_Doc->SelectedGeoCenter);
353346
@@ -356,44 +349,24 @@
356349 pUndoStack = UndoStack_Create ();
357350 }/* CFusionDoc::CFusionDoc */
358351
359-void CFusionDoc::AddCameraEntityToLevel (void)
360-{
361-
362- CEntity* pCameraEntity = App->CLSB_Camera_WE->FindCameraEntity();
363- if (!pCameraEntity)
364- {
365- // Make default camera entity
366- CEntity CameraEntity ;
367- CString cstr;
368-
369- CreateEntityFromName( "Camera", CameraEntity ) ;
370- cstr.LoadString( IDS_CAMERAENTITYNAME ) ;
371- CameraEntity.SetKeyValue ("%name%", cstr );
372- CameraEntity.SetOrigin ( 0.0f, 0.0f, 0.0f, Level_GetEntityDefs (App->CLSB_Doc->pLevel) );
373- Level_AddEntity (App->CLSB_Doc->pLevel, CameraEntity);
374-
375-// pCameraEntity = FindCameraEntity();
376- }
377-}
378-
379352 CFusionDoc::~CFusionDoc()
380353 {
381- if (mWorldBsp != NULL) Node_ClearBsp(mWorldBsp);
382- mWorldBsp = NULL;
354+ if (App->CLSB_Doc->mWorldBsp != NULL) Node_ClearBsp(App->CLSB_Doc->mWorldBsp);
355+ App->CLSB_Doc->mWorldBsp = NULL;
383356 if (App->CLSB_Doc->pLevel != NULL) Level_Destroy (&App->CLSB_Doc->pLevel);
384357 App->CLSB_Doc->pLevel = NULL;
385- if (BTemplate != NULL) Brush_Destroy (&BTemplate);
386- BTemplate = NULL;
358+ if (App->CLSB_Doc->BTemplate != NULL) Brush_Destroy (&App->CLSB_Doc->BTemplate);
359+ App->CLSB_Doc->BTemplate = NULL;
387360 if (pUndoStack != NULL) UndoStack_Destroy (&pUndoStack);
388361 pUndoStack = NULL;
389- if (pSelBrushes != NULL) SelBrushList_Destroy (&pSelBrushes);
390- pSelBrushes = NULL;
362+ if (App->CLSB_Doc->pSelBrushes != NULL) SelBrushList_Destroy (&App->CLSB_Doc->pSelBrushes);
363+ App->CLSB_Doc->pSelBrushes = NULL;
391364 if (App->CLSB_Doc->pTempSelBrushes != NULL)SelBrushList_Destroy (&App->CLSB_Doc->pTempSelBrushes);
392365 App->CLSB_Doc->pTempSelBrushes = NULL;
393366 if (LeakPoints != NULL) geRam_Free(LeakPoints);
394367 LeakPoints = NULL;
395- if (pSelFaces != NULL) SelFaceList_Destroy (&pSelFaces);
396- pSelFaces = NULL;
368+ if (App->CLSB_Doc->pSelFaces != NULL) SelFaceList_Destroy (&App->CLSB_Doc->pSelFaces);
369+ App->CLSB_Doc->pSelFaces = NULL;
397370
398371 // OpenClipboard(mpMainFrame->GetSafeHwnd());
399372 // EmptyClipboard();
@@ -661,12 +634,12 @@
661634 {
662635 if( pData->Select )
663636 { // add this brush to the selected list
664- SelBrushList_Add (pData->pDoc->pSelBrushes, pBrush);
637+ SelBrushList_Add (App->CLSB_Doc->pSelBrushes, pBrush);
665638 }
666639 else
667640 {
668641 // remove this brush from the selection list
669- SelBrushList_Remove (pData->pDoc->pSelBrushes, pBrush);
642+ SelBrushList_Remove (App->CLSB_Doc->pSelBrushes, pBrush);
670643 }
671644 }
672645 return GE_TRUE ; // Continue enumeration
@@ -832,7 +805,7 @@
832805 return FALSE;
833806 }
834807
835- AddCameraEntityToLevel ();
808+ App->CLSB_Doc->AddCameraEntityToLevel ();
836809
837810 SetupDefaultFilename ();
838811
@@ -927,7 +900,7 @@
927900 Level_EnumEntities (App->CLSB_Doc->pLevel, &pEntityView->pEntries[i], ::fdocSetEntityVisibility);
928901 }
929902
930- AddCameraEntityToLevel ();
903+ App->CLSB_Doc->AddCameraEntityToLevel ();
931904
932905 DoGeneralSelect();
933906 return GE_TRUE;
@@ -963,10 +936,10 @@
963936 return;
964937
965938 Placed = GE_FALSE;
966- if(TempEnt)
939+ if(App->CLSB_Doc->TempEnt)
967940 {
968941 // here we check to see if the user is placing library objects down
969- if ( PlaceObjectFlag )
942+ if (App->CLSB_Doc->PlaceObjectFlag )
970943 {
971944 geBoolean GotName;
972945 char ObjectName[MAX_PATH];
@@ -992,7 +965,7 @@
992965 CEntity NewEnt;
993966 char EntityName[MAX_PATH];
994967
995- mRegularEntity.DoneMove (1, Level_GetEntityDefs (App->CLSB_Doc->pLevel));
968+ App->CLSB_Doc->mRegularEntity.DoneMove (1, Level_GetEntityDefs (App->CLSB_Doc->pLevel));
996969
997970 // now create a new entity of the currently-selected type
998971 //GotName = mpMainFrame->m_wndTabControls->m_pBrushEntityDialog->GetCurrentEntityName (EntityName);
@@ -1025,7 +998,7 @@
1025998 Brush *nb;
1026999 geVec3d *pTemplatePos;
10271000
1028- nb =Brush_Clone(CurBrush);
1001+ nb =Brush_Clone(App->CLSB_Doc->CurBrush);
10291002
10301003 SetDefaultBrushTexInfo(nb);
10311004 Brush_Bound (nb);
@@ -1048,7 +1021,7 @@
10481021
10491022 if(!Brush_IsHollow(nb) && !Brush_IsMulti(nb))
10501023 {
1051- mWorldBsp =Node_AddBrushToTree(mWorldBsp, nb);
1024+ App->CLSB_Doc->mWorldBsp =Node_AddBrushToTree(App->CLSB_Doc->mWorldBsp, nb);
10521025 App->CLSB_Doc->UpdateAllViews(UAV_ALL3DVIEWS, NULL);
10531026 }
10541027 else
@@ -1071,7 +1044,7 @@
10711044 // Lib objects to where they were placed in Template mode
10721045 // switch to move mode
10731046 App->CLSB_Doc->mCurrentTool=ID_TOOLS_BRUSH_MOVEROTATEBRUSH;
1074- ConfigureCurrentTool();
1047+ App->CLSB_Doc->ConfigureCurrentTool();
10751048 // fake a move
10761049 App->CLSB_Doc->DoneMove();
10771050 // Back to select mode
@@ -1099,15 +1072,15 @@
10991072 if(App->CLSB_Doc->mModeTool==ID_GENERALSELECT)
11001073 {
11011074 // put the brush at the very end of the list
1102- BrushList_Remove (BList, CurBrush);
1103- Brush_SetSubtract(CurBrush, GE_TRUE);
1075+ BrushList_Remove (BList, App->CLSB_Doc->CurBrush);
1076+ Brush_SetSubtract(App->CLSB_Doc->CurBrush, GE_TRUE);
11041077
1105- SelBrushList_RemoveAll (pSelBrushes);
1106- BrushList_Append (BList, CurBrush);
1078+ SelBrushList_RemoveAll (App->CLSB_Doc->pSelBrushes);
1079+ BrushList_Append (BList, App->CLSB_Doc->CurBrush);
11071080 }
11081081 else
11091082 {
1110- nb =Brush_Clone(CurBrush);
1083+ nb =Brush_Clone(App->CLSB_Doc->CurBrush);
11111084
11121085 SetDefaultBrushTexInfo(nb);
11131086 Brush_Bound (nb);
@@ -1126,7 +1099,7 @@
11261099 int i;
11271100 int NumSelBrushes;
11281101
1129- NumSelBrushes = SelBrushList_GetSize (pSelBrushes);
1102+ NumSelBrushes = SelBrushList_GetSize (App->CLSB_Doc->pSelBrushes);
11301103
11311104 if( NumSelBrushes )
11321105 {
@@ -1139,7 +1112,7 @@
11391112 Brush *pBrush;
11401113 Brush *pClone;
11411114
1142- pBrush = SelBrushList_GetBrush (pSelBrushes, 0);
1115+ pBrush = SelBrushList_GetBrush (App->CLSB_Doc->pSelBrushes, 0);
11431116 // changed QD Actors
11441117 // don't copy ActorBrushes
11451118 if(strstr(App->CL_Brush->Brush_GetName(pBrush),".act")!=NULL)
@@ -1147,8 +1120,8 @@
11471120 // end change
11481121 pClone = Brush_Clone (pBrush);
11491122 Level_AppendBrush (App->CLSB_Doc->pLevel, pClone);
1150- SelBrushList_Add (pSelBrushes, pClone);
1151- SelBrushList_Remove (pSelBrushes, pBrush);
1123+ SelBrushList_Add (App->CLSB_Doc->pSelBrushes, pClone);
1124+ SelBrushList_Remove (App->CLSB_Doc->pSelBrushes, pBrush);
11521125 }
11531126 }// Duplicate selected and delesect original Brushes
11541127
@@ -1199,10 +1172,10 @@
11991172
12001173 void CFusionDoc::MakeSelectedBrushNewest(void)
12011174 {
1202- if(GetSelState()==ONEBRUSHONLY)
1175+ if(App->CLSB_Doc->GetSelState()==ONEBRUSHONLY)
12031176 {
1204- Level_RemoveBrush (App->CLSB_Doc->pLevel, CurBrush);
1205- Level_AppendBrush (App->CLSB_Doc->pLevel, CurBrush);
1177+ Level_RemoveBrush (App->CLSB_Doc->pLevel, App->CLSB_Doc->CurBrush);
1178+ Level_AppendBrush (App->CLSB_Doc->pLevel, App->CLSB_Doc->CurBrush);
12061179 }
12071180 }
12081181
@@ -1212,7 +1185,7 @@
12121185 int i;
12131186 int NumSelBrushes;
12141187
1215- NumSelBrushes = SelBrushList_GetSize (pSelBrushes);
1188+ NumSelBrushes = SelBrushList_GetSize (App->CLSB_Doc->pSelBrushes);
12161189
12171190 SelBrushList_RemoveAll (App->CLSB_Doc->pTempSelBrushes);
12181191
@@ -1221,7 +1194,7 @@
12211194 {
12221195 Brush *pBrush, *pClone;
12231196
1224- pBrush = SelBrushList_GetBrush (pSelBrushes, i);
1197+ pBrush = SelBrushList_GetBrush (App->CLSB_Doc->pSelBrushes, i);
12251198 pClone = Brush_Clone (pBrush);
12261199 Level_AppendBrush (App->CLSB_Doc->pLevel, pClone);
12271200 SelBrushList_Add (App->CLSB_Doc->pTempSelBrushes, pClone);
@@ -1361,21 +1334,21 @@
13611334
13621335 assert (pBrush != NULL);
13631336
1364- if (BTemplate != NULL)
1337+ if (App->CLSB_Doc->BTemplate != NULL)
13651338 {
1366- Brush_Destroy (&BTemplate);
1339+ Brush_Destroy (&App->CLSB_Doc->BTemplate);
13671340 }
1368- BTemplate = pBrush;
1369- CurBrush = pBrush;
1341+ App->CLSB_Doc->BTemplate = pBrush;
1342+ App->CLSB_Doc->CurBrush = pBrush;
13701343
1371- TempEnt = FALSE;
1372- SetDefaultBrushTexInfo (CurBrush);
1373- Brush_Bound (CurBrush);
1374- Brush_Center (CurBrush, &BrushPos);
1344+ App->CLSB_Doc->TempEnt = FALSE;
1345+ SetDefaultBrushTexInfo (App->CLSB_Doc->CurBrush);
1346+ Brush_Bound (App->CLSB_Doc->CurBrush);
1347+ Brush_Center (App->CLSB_Doc->CurBrush, &BrushPos);
13751348
13761349 pTemplatePos = Level_GetTemplatePos (App->CLSB_Doc->pLevel);
13771350 geVec3d_Subtract (pTemplatePos, &BrushPos, &MoveVec);
1378- Brush_Move (CurBrush, &MoveVec);
1351+ Brush_Move (App->CLSB_Doc->CurBrush, &MoveVec);
13791352
13801353 App->CLSB_Doc->UpdateAllViews (UAV_ALL3DVIEWS, NULL);
13811354 SetModifiedFlag ();
@@ -1452,19 +1425,6 @@
14521425 App->Say("Gone");
14531426 }
14541427
1455-void CFusionDoc::BrushSelect
1456- (
1457- Brush *pBrush
1458- )
1459-{
1460- // if the brush is already selected, then unselect it.
1461- // if not currently selected, then select it.
1462- if (!SelBrushList_Remove (pSelBrushes, pBrush))
1463- {
1464- SelBrushList_Add (pSelBrushes, pBrush);
1465- }
1466-}
1467-
14681428 geBoolean CFusionDoc::BrushIsSelected
14691429 (
14701430 Brush const *pBrush
@@ -1472,7 +1432,7 @@
14721432 {
14731433 assert (pBrush != NULL);
14741434
1475- return SelBrushList_Find (pSelBrushes, pBrush);
1435+ return SelBrushList_Find (App->CLSB_Doc->pSelBrushes, pBrush);
14761436 }
14771437
14781438
@@ -1665,34 +1625,7 @@
16651625 SetModifiedFlag();
16661626 }
16671627
1668-geBoolean CFusionDoc::CreateEntityFromName(char const *pEntityType,CEntity &NewEnt)
1669-{
1670- assert (pEntityType != NULL);
1671- // get all properties for this entity type...
1672- EntityPropertiesList *pProps;
16731628
1674- pProps = EntityTable_GetEntityPropertiesFromName (Level_GetEntityDefs (App->CLSB_Doc->pLevel), pEntityType, ET_ALL);
1675- if (pProps == NULL)
1676- {
1677- return FALSE;
1678- }
1679-
1680- // Add key/value pairs for all of the properties...
1681- for (int PropNo = 0; PropNo < pProps->NumProps; ++PropNo)
1682- {
1683- EntityProperty *p = &(pProps->Props[PropNo]);
1684-
1685- NewEnt.SetKeyValue (p->pKey, p->pValue);
1686-
1687- }
1688-
1689- EntityTable_ReleaseEntityProperties (pProps);
1690-
1691- NewEnt.SetGroupId ( 0 );
1692- NewEnt.UpdateOrigin (Level_GetEntityDefs (App->CLSB_Doc->pLevel));
1693- return TRUE;
1694-}
1695-
16961629 void CFusionDoc::CreateEntity
16971630 (
16981631 char const *pEntityType
@@ -1700,18 +1633,18 @@
17001633 {
17011634 CEntity NewEnt;
17021635
1703- if (CreateEntityFromName (pEntityType, NewEnt))
1636+ if (App->CLSB_Doc->CreateEntityFromName (pEntityType, NewEnt))
17041637 {
1705- TempEnt = TRUE;
1638+ App->CLSB_Doc->TempEnt = TRUE;
17061639
1707- mRegularEntity = NewEnt;
1640+ App->CLSB_Doc->mRegularEntity = NewEnt;
17081641 App->CLSB_Doc->mCurrentEntity = -1;
17091642 // set this flag so that doc knows when enter is pressed that user is NOT adding
17101643 // objects to level
1711- PlaceObjectFlag = FALSE;
1644+ App->CLSB_Doc->PlaceObjectFlag = FALSE;
17121645
17131646 App->CLSB_Doc->mCurrentTool=ID_TOOLS_BRUSH_MOVEROTATEBRUSH;
1714- ConfigureCurrentTool();
1647+ App->CLSB_Doc->ConfigureCurrentTool();
17151648
17161649 App->CLSB_Doc->UpdateAllViews(UAV_ALL3DVIEWS, NULL);
17171650 SetModifiedFlag();
@@ -1725,21 +1658,21 @@
17251658 CEntity NewEnt;
17261659
17271660 // make an origin
1728- if (CreateEntityFromName ("ModelOrigin", NewEnt))
1661+ if (App->CLSB_Doc->CreateEntityFromName ("ModelOrigin", NewEnt))
17291662 {
1730- TempEnt=TRUE;
1663+ App->CLSB_Doc->TempEnt=TRUE;
17311664
17321665 NewEnt.SetOrigin (0.0f, 0.0f, 0.0f, Level_GetEntityDefs (App->CLSB_Doc->pLevel));
17331666
1734- mRegularEntity=NewEnt;
1667+ App->CLSB_Doc->mRegularEntity=NewEnt;
17351668 App->CLSB_Doc->mCurrentEntity=-1;
17361669
17371670 // set this flag so that doc knows when enter is pressed that user is adding objects
17381671 // to level
1739- PlaceObjectFlag = TRUE;
1672+ App->CLSB_Doc->PlaceObjectFlag = TRUE;
17401673
17411674 App->CLSB_Doc->mCurrentTool=ID_TOOLS_BRUSH_MOVEROTATEBRUSH;
1742- ConfigureCurrentTool();
1675+ App->CLSB_Doc->ConfigureCurrentTool();
17431676
17441677 App->CLSB_Doc->UpdateAllViews(UAV_ALL3DVIEWS, NULL);
17451678 SetModifiedFlag();
@@ -1759,7 +1692,7 @@
17591692
17601693 void CFusionDoc::OnViewShowAllGroups()
17611694 {
1762- CurBrush =BTemplate;
1695+ App->CLSB_Doc->CurBrush = App->CLSB_Doc->BTemplate;
17631696 Level_SetGroupVisibility (App->CLSB_Doc->pLevel, Group_ShowAll);
17641697
17651698 App->CLSB_Doc->UpdateAllViews(UAV_ALL3DVIEWS, NULL);
@@ -1768,7 +1701,7 @@
17681701
17691702 void CFusionDoc::OnViewShowCurrentGroup()
17701703 {
1771- CurBrush = BTemplate;
1704+ App->CLSB_Doc->CurBrush = App->CLSB_Doc->BTemplate;
17721705 Level_SetGroupVisibility (App->CLSB_Doc->pLevel, Group_ShowCurrent);
17731706
17741707 App->CLSB_Doc->UpdateAllViews(UAV_ALL3DVIEWS, NULL);
@@ -1776,7 +1709,7 @@
17761709
17771710 void CFusionDoc::OnViewShowVisibleGroups()
17781711 {
1779- CurBrush =BTemplate;
1712+ App->CLSB_Doc->CurBrush = App->CLSB_Doc->BTemplate;
17801713 Level_SetGroupVisibility (App->CLSB_Doc->pLevel, Group_ShowVisible);
17811714
17821715 App->CLSB_Doc->UpdateAllViews(UAV_ALL3DVIEWS, NULL);
@@ -1861,7 +1794,7 @@
18611794
18621795 if(pBrush)
18631796 {
1864- SelBrushList_Remove(pSelBrushes, pBrush);
1797+ SelBrushList_Remove(App->CLSB_Doc->pSelBrushes, pBrush);
18651798 Level_RemoveBrush(App->CLSB_Doc->pLevel, pBrush);
18661799 (*Entities)[i].DeleteActorBrush();
18671800 }
@@ -1873,7 +1806,7 @@
18731806 {
18741807 Level_AppendBrush(App->CLSB_Doc->pLevel,pBrush);
18751808 if((*Entities)[i].IsSelected())
1876- SelBrushList_Add(pSelBrushes, pBrush);
1809+ SelBrushList_Add(App->CLSB_Doc->pSelBrushes, pBrush);
18771810 if(!bShowActors)
18781811 Brush_SetVisible(pBrush, GE_FALSE);
18791812 }
@@ -1883,7 +1816,7 @@
18831816 Brush *pBrush = (*Entities)[i].GetActorBrush();
18841817 if(pBrush!=NULL)
18851818 {
1886- SelBrushList_Remove(pSelBrushes, pBrush);
1819+ SelBrushList_Remove(App->CLSB_Doc->pSelBrushes, pBrush);
18871820 Level_RemoveBrush(App->CLSB_Doc->pLevel, pBrush);
18881821 (*Entities)[i].DeleteActorBrush();
18891822 }
@@ -1899,7 +1832,7 @@
18991832
19001833 if(App->CLSB_Doc->mCurrentEntity < 0) //template
19011834 {
1902- mRegularEntity.Move (v);
1835+ App->CLSB_Doc->mRegularEntity.Move (v);
19031836 }
19041837 else
19051838 {
@@ -1923,7 +1856,7 @@
19231856 void CFusionDoc::OnUpdateBrushAdjustmentmode(CCmdUI* pCmdUI)
19241857 {
19251858 pCmdUI->Enable( TRUE); //( mModeTool == ID_GENERALSELECT ) ? TRUE : FALSE ) ;
1926- pCmdUI->SetCheck( ( mAdjustMode == ADJUST_MODE_BRUSH ) ? TRUE : FALSE ) ;
1859+ pCmdUI->SetCheck( (App->CLSB_Doc->mAdjustMode == ADJUST_MODE_BRUSH ) ? TRUE : FALSE ) ;
19271860 }
19281861
19291862 void CFusionDoc::OnToolsBrushAdjustmentmode()
@@ -1933,7 +1866,7 @@
19331866 App->CLSB_Doc->mCurrentTool == CURTOOL_NONE )
19341867 {
19351868 // SetAdjustmentMode( ADJUST_MODE_BRUSH ) ;
1936- SetAdjustmentMode( ADJUST_MODE_FACE ) ;
1869+ App->CLSB_Doc->SetAdjustmentMode( ADJUST_MODE_FACE ) ;
19371870 }
19381871 }
19391872
@@ -1940,7 +1873,7 @@
19401873 void CFusionDoc::OnUpdateFaceAdjustmentmode(CCmdUI* pCmdUI)
19411874 {
19421875 pCmdUI->Enable( TRUE); //( mModeTool == ID_GENERALSELECT ) ? TRUE : FALSE ) ;
1943- pCmdUI->SetCheck( (mAdjustMode==ADJUST_MODE_FACE) ? TRUE : FALSE ) ;
1876+ pCmdUI->SetCheck( (App->CLSB_Doc->mAdjustMode==ADJUST_MODE_FACE) ? TRUE : FALSE ) ;
19441877 }
19451878
19461879 void CFusionDoc::OnToolsFaceAdjustmentmode()
@@ -1949,7 +1882,7 @@
19491882 !IsSelectionLocked() && */
19501883 App->CLSB_Doc->mCurrentTool == CURTOOL_NONE )
19511884 {
1952- SetAdjustmentMode( ADJUST_MODE_FACE ) ;
1885+ App->CLSB_Doc->SetAdjustmentMode( ADJUST_MODE_FACE ) ;
19531886 }
19541887 }
19551888
@@ -1961,7 +1894,7 @@
19611894 !IsSelectionLocked() && */
19621895 App->CLSB_Doc->mCurrentTool == CURTOOL_NONE )
19631896 {
1964- SetAdjustmentMode( ADJUST_MODE_FACE ) ;
1897+ App->CLSB_Doc->SetAdjustmentMode( ADJUST_MODE_FACE ) ;
19651898 }
19661899
19671900 }
@@ -1974,217 +1907,11 @@
19741907 !IsSelectionLocked() && */
19751908 App->CLSB_Doc->mCurrentTool == CURTOOL_NONE )
19761909 {
1977- SetAdjustmentMode( ADJUST_MODE_TOGGLE ) ; // Flip between Brush & face
1910+ App->CLSB_Doc->SetAdjustmentMode( ADJUST_MODE_TOGGLE ) ; // Flip between Brush & face
19781911 }
19791912
19801913 }
19811914
1982-
1983-static geFloat PointToLineDist
1984- (
1985- POINT const *ptFrom,
1986- POINT const *ptLine1,
1987- POINT const *ptLine2
1988- )
1989-{
1990- geFloat xkj, ykj;
1991- geFloat xlk, ylk;
1992- geFloat denom;
1993- geFloat dist;
1994-
1995- xkj = (geFloat)(ptLine1->x - ptFrom->x);
1996- ykj = (geFloat)(ptLine1->y - ptFrom->y);
1997- xlk = (geFloat)(ptLine2->x - ptLine1->x);
1998- ylk = (geFloat)(ptLine2->y - ptLine1->y);
1999- denom = (xlk*xlk) + (ylk*ylk);
2000- if (denom < .0005f)
2001- {
2002- // segment ends coincide
2003- dist = xkj*xkj + ykj*ykj;
2004- }
2005- else
2006- {
2007- geFloat t;
2008- geFloat xfac, yfac;
2009-
2010- t = -(xkj*xlk + ykj*ylk)/denom;
2011- t = std::max (t, 0.0f);
2012- t = std::min (t, 1.0f);
2013- xfac = xkj + t*xlk;
2014- yfac = ykj + t*ylk;
2015- dist = xfac*xfac + yfac*yfac;
2016- }
2017- return (geFloat)sqrt (dist);
2018-}
2019-
2020-
2021-typedef struct FindClosestInfoTag
2022-{
2023- CFusionDoc *pDoc;
2024- ViewVars *v;
2025- Brush **ppFoundBrush;
2026- geFloat *pMinEdgeDist;
2027- const POINT *ptFrom;
2028-} FindClosestInfo;
2029-
2030-static geBoolean FindClosestBrushCB(Brush *pBrush, void *pVoid)
2031-{
2032- FindClosestInfo *fci =(FindClosestInfo *)pVoid;
2033-
2034- if(fci->pDoc->BrushIsVisible(pBrush))
2035- {
2036- // for each face...
2037- for (int iFace = 0; iFace < Brush_GetNumFaces(pBrush); ++iFace)
2038- {
2039- POINT pt1, pt2;
2040- Face *pFace =Brush_GetFace(pBrush, iFace);
2041- const geVec3d *FacePoints =Face_GetPoints(pFace);
2042- int NumPoints =Face_GetNumPoints(pFace);
2043-
2044- // Starting with the edge formed by the last point and the first point,
2045- // determine distance from mouse cursor pos to the edge.
2046- pt1 = Render_OrthoWorldToView(fci->v, &FacePoints[NumPoints-1]);
2047- for(int iPoint = 0; iPoint < NumPoints; ++iPoint)
2048- {
2049- geFloat Dist;
2050-
2051- pt2 = Render_OrthoWorldToView (fci->v, &FacePoints[iPoint]);
2052- Dist = PointToLineDist (fci->ptFrom, &pt1, &pt2);
2053- if (Dist < *fci->pMinEdgeDist)
2054- {
2055- *fci->pMinEdgeDist = Dist;
2056- *fci->ppFoundBrush = pBrush;
2057- }
2058- pt1 = pt2; // next edge...
2059- }
2060- }
2061- }
2062- return GE_TRUE ;
2063-}
2064-
2065-geBoolean CFusionDoc::FindClosestBrush
2066- (
2067- POINT const *ptFrom,
2068- ViewVars *v,
2069- Brush **ppFoundBrush,
2070- geFloat *pMinEdgeDist
2071- )
2072-{
2073- // determine the distance to the closest brush edge in the current view.
2074- FindClosestInfo fci;
2075-
2076- *pMinEdgeDist = FLT_MAX;
2077- *ppFoundBrush = NULL;
2078-
2079- fci.pDoc =this;
2080- fci.v =v;
2081- fci.ppFoundBrush =ppFoundBrush;
2082- fci.pMinEdgeDist =pMinEdgeDist;
2083- fci.ptFrom =ptFrom;
2084-
2085- BrushList_EnumLeafBrushes(Level_GetBrushes (App->CLSB_Doc->pLevel), &fci, ::FindClosestBrushCB);
2086-
2087- return (*ppFoundBrush)? GE_TRUE : GE_FALSE;
2088-}
2089-
2090-geBoolean CFusionDoc::FindClosestEntity
2091- (
2092- POINT const *ptFrom,
2093- ViewVars *v,
2094- CEntity **ppMinEntity,
2095- geFloat *pMinEntityDist
2096- )
2097-{
2098- geBoolean rslt;
2099- CEntityArray *Entities;
2100-
2101- Entities = Level_GetEntities (App->CLSB_Doc->pLevel);
2102- rslt = GE_FALSE;
2103- // determine distance to closest entity in the current view
2104- *pMinEntityDist = FLT_MAX;
2105- *ppMinEntity = NULL;
2106- for (int i = 0; i < Entities->GetSize(); ++i)
2107- {
2108- CEntity *pEnt;
2109- POINT EntPosView;
2110- geFloat Dist;
2111- int dx, dy;
2112-
2113- pEnt = &(*Entities)[i];
2114- if (EntityIsVisible( pEnt ))
2115- {
2116- EntPosView = Render_OrthoWorldToView (v, &pEnt->mOrigin);
2117- dx = EntPosView.x - ptFrom->x;
2118- dy = EntPosView.y - ptFrom->y;
2119-
2120- Dist = (geFloat)((dx*dx) + (dy*dy));
2121- if (Dist < *pMinEntityDist)
2122- {
2123- *pMinEntityDist = Dist;
2124- *ppMinEntity = pEnt;
2125- rslt = GE_TRUE;
2126- }
2127- }
2128- }
2129-
2130- if (rslt)
2131- {
2132- *pMinEntityDist = (geFloat)sqrt (*pMinEntityDist);
2133- }
2134- return rslt;
2135-}
2136-
2137-int CFusionDoc::FindClosestThing
2138- (
2139- POINT const *ptFrom,
2140- ViewVars *v,
2141- Brush **ppMinBrush, // NULL OK
2142- CEntity **ppMinEntity, // NULL OK
2143- geFloat *pDist
2144- )
2145-{
2146- int rslt;
2147-
2148- geBoolean FoundBrush;
2149- geFloat MinEdgeDist;
2150- Brush *pMinBrush;
2151-
2152- geBoolean FoundEntity;
2153- geFloat MinEntityDist;
2154- CEntity *pMinEntity;
2155-
2156- rslt = fctNOTHING;
2157- FoundBrush = FindClosestBrush (ptFrom, v, &pMinBrush, &MinEdgeDist);
2158- FoundEntity = FindClosestEntity (ptFrom, v, &pMinEntity, &MinEntityDist);
2159-
2160-
2161- if (FoundEntity)
2162- {
2163- if ((!FoundBrush) || (MinEntityDist < MinEdgeDist))
2164- {
2165- *pDist = MinEntityDist;
2166- if( ppMinEntity != NULL )
2167- *ppMinEntity = pMinEntity;
2168- rslt = fctENTITY;
2169- }
2170- else
2171- {
2172- *pDist = MinEdgeDist;
2173- if( ppMinBrush != NULL )
2174- *ppMinBrush = pMinBrush;
2175- rslt = fctBRUSH;
2176- }
2177- }
2178- else if (FoundBrush)
2179- {
2180- *pDist = MinEdgeDist;
2181- if( ppMinBrush != NULL )
2182- *ppMinBrush = pMinBrush;
2183- rslt = fctBRUSH;
2184- }
2185- return rslt;
2186-}
2187-
21881915 void CFusionDoc::DoBrushSelection(Brush * pBrush,BrushSel nSelType) // brushSelToggle | brushSelAlways)
21891916 {
21901917 int ModelId = 0;
@@ -2246,7 +1973,7 @@
22461973 }
22471974 else
22481975 {
2249- SelBrushList_Remove (pSelBrushes, pBrush);
1976+ SelBrushList_Remove (App->CLSB_Doc->pSelBrushes, pBrush);
22501977 // changed QD Actors
22511978 if(strstr(App->CL_Brush->Brush_GetName(pBrush),".act")!=NULL)
22521979 {
@@ -2256,7 +1983,7 @@
22561983 {
22571984 Brush *b=(*Entities)[i].GetActorBrush();
22581985 if(b!=NULL)
2259- if(SelBrushList_Find (pSelBrushes, b))
1986+ if(SelBrushList_Find (App->CLSB_Doc->pSelBrushes, b))
22601987 if ((*Entities)[i].IsSelected())
22611988 {
22621989 (*Entities)[i].DeSelect();
@@ -2281,7 +2008,7 @@
22812008 }
22822009 else
22832010 {
2284- SelBrushList_Add (pSelBrushes, pBrush);
2011+ SelBrushList_Add (App->CLSB_Doc->pSelBrushes, pBrush);
22852012 // changed QD Actors
22862013 if(strstr(App->CL_Brush->Brush_GetName(pBrush),".act")!=NULL)
22872014 {
@@ -2291,7 +2018,7 @@
22912018 {
22922019 Brush *b=(*Entities)[i].GetActorBrush();
22932020 if(b!=NULL)
2294- if(SelBrushList_Find (pSelBrushes, b))
2021+ if(SelBrushList_Find (App->CLSB_Doc->pSelBrushes, b))
22952022 if (!(*Entities)[i].IsSelected())
22962023 {
22972024 (*Entities)[i].Select();
@@ -2319,7 +2046,7 @@
23192046 pBrush = pEntity->GetActorBrush();
23202047 if(pBrush!=NULL)
23212048 {
2322- SelBrushList_Add (pSelBrushes, pBrush);
2049+ SelBrushList_Add (App->CLSB_Doc->pSelBrushes, pBrush);
23232050 }
23242051 // end change
23252052 ++App->CLSB_Doc->NumSelEntities;
@@ -2341,7 +2068,7 @@
23412068 pBrush = pEntity->GetActorBrush();
23422069 if(pBrush!=NULL)
23432070 {
2344- SelBrushList_Remove(pSelBrushes, pBrush);
2071+ SelBrushList_Remove(App->CLSB_Doc->pSelBrushes, pBrush);
23452072 }
23462073 // end change
23472074 --App->CLSB_Doc->NumSelEntities;
@@ -2408,7 +2135,7 @@
24082135 {
24092136 CFusionDoc *pDoc = (CFusionDoc *)lParam;
24102137
2411- SelBrushList_Add(pDoc->pSelBrushes, pBrush);
2138+ SelBrushList_Add(App->CLSB_Doc->pSelBrushes, pBrush);
24122139
24132140 return GE_TRUE;
24142141 }
@@ -2425,7 +2152,7 @@
24252152
24262153 pFace = Brush_GetFace (pBrush, iFace);
24272154 Face_SetSelected (pFace, GE_TRUE);
2428- SelFaceList_Add (pDoc->pSelFaces, pFace);
2155+ SelFaceList_Add (App->CLSB_Doc->pSelFaces, pFace);
24292156 }
24302157 return GE_TRUE;
24312158 }
@@ -2455,13 +2182,13 @@
24552182
24562183 // Select all faces on all selected brushes
24572184 int iBrush;
2458- int NumSelBrushes = SelBrushList_GetSize (pSelBrushes);
2185+ int NumSelBrushes = SelBrushList_GetSize (App->CLSB_Doc->pSelBrushes);
24592186
24602187 for (iBrush = 0; iBrush < NumSelBrushes; ++iBrush)
24612188 {
24622189 Brush *pBrush;
24632190
2464- pBrush = SelBrushList_GetBrush (pSelBrushes, iBrush);
2191+ pBrush = SelBrushList_GetBrush (App->CLSB_Doc->pSelBrushes, iBrush);
24652192 if (Brush_IsMulti (pBrush))
24662193 {
24672194 BrushList_EnumLeafBrushes (App->CL_Brush->Brush_GetBrushList (pBrush), this, ::SelAllBrushFaces);
@@ -2473,7 +2200,7 @@
24732200 }
24742201 App->CLSB_Doc->UpdateSelected ();
24752202
2476- ConfigureCurrentTool();
2203+ App->CLSB_Doc->ConfigureCurrentTool();
24772204 }
24782205
24792206 BOOL CFusionDoc::IsEntitySelected(void)
@@ -2598,7 +2325,7 @@
25982325
25992326 viewRect.NormalizeRect() ;
26002327
2601- if(IsSelectionLocked())
2328+ if(App->CLSB_Doc->IsSelectionLocked())
26022329 {
26032330 return;
26042331 }
@@ -2658,11 +2385,11 @@
26582385
26592386 if(App->CLSB_Doc->mModeTool == ID_TOOLS_TEMPLATE)
26602387 {
2661- Brush_Resize(CurBrush, dx, dy, sides, inidx, &App->CLSB_Doc->FinalScale, &App->CLSB_Doc->ScaleNum);
2662- if(Brush_IsMulti(CurBrush))
2388+ Brush_Resize(App->CLSB_Doc->CurBrush, dx, dy, sides, inidx, &App->CLSB_Doc->FinalScale, &App->CLSB_Doc->ScaleNum);
2389+ if(Brush_IsMulti(App->CLSB_Doc->CurBrush))
26632390 {
2664- BrushList_ClearCSGAndHollows((BrushList *)App->CL_Brush->Brush_GetBrushList(CurBrush), Brush_GetModelId(CurBrush));
2665- BrushList_RebuildHollowFaces((BrushList *)App->CL_Brush->Brush_GetBrushList(CurBrush), Brush_GetModelId(CurBrush), ::fdocBrushCSGCallback, this);
2391+ BrushList_ClearCSGAndHollows((BrushList *)App->CL_Brush->Brush_GetBrushList(App->CLSB_Doc->CurBrush), Brush_GetModelId(App->CLSB_Doc->CurBrush));
2392+ BrushList_RebuildHollowFaces((BrushList *)App->CL_Brush->Brush_GetBrushList(App->CLSB_Doc->CurBrush), Brush_GetModelId(App->CLSB_Doc->CurBrush), ::fdocBrushCSGCallback, this);
26662393 }
26672394 }
26682395 else
@@ -2701,23 +2428,23 @@
27012428
27022429 if(App->CLSB_Doc->mModeTool == ID_TOOLS_TEMPLATE)
27032430 {
2704- Brush_Scale3d(CurBrush, ScaleVector);
2705- if(Brush_IsMulti(CurBrush))
2431+ Brush_Scale3d(App->CLSB_Doc->CurBrush, ScaleVector);
2432+ if(Brush_IsMulti(App->CLSB_Doc->CurBrush))
27062433 {
2707- BrushList_ClearCSGAndHollows((BrushList *)App->CL_Brush->Brush_GetBrushList(CurBrush), Brush_GetModelId(CurBrush));
2708- BrushList_RebuildHollowFaces((BrushList *)App->CL_Brush->Brush_GetBrushList(CurBrush), Brush_GetModelId(CurBrush), ::fdocBrushCSGCallback, this);
2434+ BrushList_ClearCSGAndHollows((BrushList *)App->CL_Brush->Brush_GetBrushList(App->CLSB_Doc->CurBrush), Brush_GetModelId(App->CLSB_Doc->CurBrush));
2435+ BrushList_RebuildHollowFaces((BrushList *)App->CL_Brush->Brush_GetBrushList(App->CLSB_Doc->CurBrush), Brush_GetModelId(App->CLSB_Doc->CurBrush), ::fdocBrushCSGCallback, this);
27092436 }
27102437 }
27112438 else
27122439 {
27132440 int i;
2714- int NumSelBrushes = SelBrushList_GetSize (pSelBrushes);
2441+ int NumSelBrushes = SelBrushList_GetSize (App->CLSB_Doc->pSelBrushes);
27152442
27162443 for (i = 0; i < NumSelBrushes; ++i)
27172444 {
27182445 Brush *pBrush;
27192446
2720- pBrush = SelBrushList_GetBrush (pSelBrushes, i);
2447+ pBrush = SelBrushList_GetBrush (App->CLSB_Doc->pSelBrushes, i);
27212448
27222449 Brush_Move(pBrush, &MoveTo);
27232450 Brush_Scale3d(pBrush, ScaleVector);
@@ -2820,7 +2547,7 @@
28202547 geVec3d_Subtract(&ClickPosWorld, &bdat.vp, &ClickPosWorld);
28212548
28222549 geVec3d_Inverse (&ClickPosWorld);
2823- mRegularEntity.mOrigin = ClickPosWorld;
2550+ App->CLSB_Doc->mRegularEntity.mOrigin = ClickPosWorld;
28242551 App->CLSB_Doc->UpdateAllViews( UAV_ALL3DVIEWS, NULL );
28252552 }
28262553 }
@@ -3083,7 +2810,7 @@
30832810 if (fsData.Found)
30842811 {
30852812 // We found the hit face.
3086- if (mAdjustMode == ADJUST_MODE_BRUSH)
2813+ if (App->CLSB_Doc->mAdjustMode == ADJUST_MODE_BRUSH)
30872814 {
30882815 DoBrushSelection (fsData.pFoundBrush, brushSelToggle);
30892816 }
@@ -3091,7 +2818,7 @@
30912818 {
30922819 DoBrushSelection (fsData.pFoundBrush, brushSelAlways);
30932820 // if the face is already in the list, then remove it
3094- if (SelFaceList_Remove (pSelFaces, fsData.pFoundFace))
2821+ if (SelFaceList_Remove (App->CLSB_Doc->pSelFaces, fsData.pFoundFace))
30952822 {
30962823 Face_SetSelected (fsData.pFoundFace, GE_FALSE);
30972824 }
@@ -3098,22 +2825,22 @@
30982825 else
30992826 {
31002827 Face_SetSelected (fsData.pFoundFace, GE_TRUE);
3101- SelFaceList_Add (pSelFaces, fsData.pFoundFace);
2828+ SelFaceList_Add (App->CLSB_Doc->pSelFaces, fsData.pFoundFace);
31022829
31032830 SelectTextureFromFace3D(point, v);
31042831 //App->Say("k");
31052832 }
31062833 // Deselect any brush that doesn't have selected faces
3107- int NumSelBrushes = SelBrushList_GetSize (pSelBrushes);
2834+ int NumSelBrushes = SelBrushList_GetSize (App->CLSB_Doc->pSelBrushes);
31082835 for (int i = NumSelBrushes-1; i >= 0; --i)
31092836 {
31102837 Brush *pBrush;
31112838
3112- pBrush = SelBrushList_GetBrush (pSelBrushes, i);
2839+ pBrush = SelBrushList_GetBrush (App->CLSB_Doc->pSelBrushes, i);
31132840
31142841 if (Brush_GetSelectedFace (pBrush) == NULL)
31152842 {
3116- SelBrushList_Remove (pSelBrushes, pBrush);
2843+ SelBrushList_Remove (App->CLSB_Doc->pSelBrushes, pBrush);
31172844 }
31182845 }
31192846 }
@@ -3293,7 +3020,7 @@
32933020 Brush *pMinBrush;
32943021 CEntity *pMinEntity;
32953022 geFloat Dist;
3296- FoundThingType = FindClosestThing (&ViewCursorPos, pView->VCam, &pMinBrush, &pMinEntity, &Dist);
3023+ FoundThingType = App->CLSB_Doc->FindClosestThing (&ViewCursorPos, pView->VCam, &pMinBrush, &pMinEntity, &Dist);
32973024 if (App->CLSB_Doc->mCurrentTool==ID_TOOLS_BRUSH_MOVEROTATEBRUSH)
32983025 SetCursor(AfxGetApp()->LoadStandardCursor(IDC_SIZEALL));
32993026 else
@@ -3354,26 +3081,6 @@
33543081 // ConfigureCurrentTool();
33553082 }
33563083
3357-BOOL CFusionDoc::TempDeleteSelected(void)
3358-{
3359- BOOL ret;
3360- int i;
3361- int NumTSelBrushes = SelBrushList_GetSize (App->CLSB_Doc->pTempSelBrushes);
3362-
3363- for(ret=FALSE, i=0;i < NumTSelBrushes;i++)
3364- {
3365- Brush *pBrush;
3366-
3367- pBrush = SelBrushList_GetBrush (App->CLSB_Doc->pTempSelBrushes, 0);
3368-
3369- Level_RemoveBrush (App->CLSB_Doc->pLevel, pBrush);
3370- SelBrushList_Remove (App->CLSB_Doc->pTempSelBrushes, pBrush);
3371- Brush_Destroy(&pBrush);
3372- ret =TRUE;
3373- }
3374- return ret;
3375-}
3376-
33773084 void CFusionDoc::OnBrushSelectedDelete()
33783085 {
33793086 App->CLSB_Doc->DeleteSelectedBrushes();
@@ -3508,7 +3215,7 @@
35083215 ModelInfo_Type *ModelInfo;
35093216 Model *pMod;
35103217
3511- Node_InvalidateTreeOGFaces(mWorldBsp);
3218+ Node_InvalidateTreeOGFaces(App->CLSB_Doc->mWorldBsp);
35123219
35133220 ModelInfo =Level_GetModelInfo(App->CLSB_Doc->pLevel);
35143221 pMod =ModelList_GetFirst(ModelInfo->Models, &mi);
@@ -3545,8 +3252,8 @@
35453252
35463253
35473254 //do the world csg list and tree first
3548- Node_ClearBsp(mWorldBsp);
3549- mWorldBsp =NULL;
3255+ Node_ClearBsp(App->CLSB_Doc->mWorldBsp);
3256+ App->CLSB_Doc->mWorldBsp =NULL;
35503257
35513258 BrushList_ClearAllCSG (BList);
35523259
@@ -3554,7 +3261,7 @@
35543261
35553262 BspCallbackData.pDoc =this;
35563263 BspCallbackData.CurId =CurId;
3557- BspCallbackData.pTree =&mWorldBsp;
3264+ BspCallbackData.pTree =&App->CLSB_Doc->mWorldBsp;
35583265 BspCallbackData.bAddFlocking=GE_FALSE;
35593266
35603267 BrushList_EnumCSGBrushes (BList, &BspCallbackData, ::AddBrushToBspCB) ;
@@ -3584,7 +3291,7 @@
35843291 Model_SetModelTree(pMod, n);
35853292 pMod = ModelList_GetNext(ModelInfo->Models, &mi);
35863293 }
3587- if(mAdjustMode==ADJUST_MODE_FACE)
3294+ if(App->CLSB_Doc->mAdjustMode==ADJUST_MODE_FACE)
35883295 {
35893296 UpdateFaceAttributesDlg ();
35903297 }
@@ -3686,9 +3393,9 @@
36863393 brushDrawData.FlagTest = NULL;
36873394 brushDrawData.Color = PEN_WHITE_COLOR;
36883395
3689- if((Render_GetViewType(v) & (VIEWSOLID|VIEWTEXTURE)) && mWorldBsp)
3396+ if((Render_GetViewType(v) & (VIEWSOLID|VIEWTEXTURE)) && App->CLSB_Doc->mWorldBsp)
36903397 {
3691- Render_RenderTree(v, mWorldBsp, pDC->m_hDC, ZFILL);
3398+ Render_RenderTree(v, App->CLSB_Doc->mWorldBsp, pDC->m_hDC, ZFILL);
36923399 DoBlit =TRUE;
36933400 }
36943401 else
@@ -3730,7 +3437,7 @@
37303437 ::DrawEntity (pEnt, v, Level_GetEntityDefs (App->CLSB_Doc->pLevel));
37313438 }
37323439
3733- if(!(GetSelState() & NOENTITIES))
3440+ if(!(App->CLSB_Doc->GetSelState() & NOENTITIES))
37343441 {
37353442 for(i=0;i < Entities->GetSize();i++)
37363443 {
@@ -3772,12 +3479,12 @@
37723479 brushDrawData.FlagTest = NULL;
37733480 brushDrawData.Color = PEN_CYAN_COLOR;
37743481
3775- int NumSelBrushes = SelBrushList_GetSize (pSelBrushes);
3482+ int NumSelBrushes = SelBrushList_GetSize (App->CLSB_Doc->pSelBrushes);
37763483 for(i=0;i < NumSelBrushes;i++)
37773484 {
37783485 Brush *pBrush;
37793486
3780- pBrush = SelBrushList_GetBrush (pSelBrushes, i);
3487+ pBrush = SelBrushList_GetBrush (App->CLSB_Doc->pSelBrushes, i);
37813488 // changed QD Actors
37823489 if(!bShowActors)
37833490 if(strstr(App->CL_Brush->Brush_GetName(pBrush),".act")!=NULL)
@@ -3793,7 +3500,7 @@
37933500 }
37943501 }
37953502
3796- if(!(GetSelState() & NOFACES))
3503+ if(!(App->CLSB_Doc->GetSelState() & NOFACES))
37973504 {
37983505 brushDrawData.Color = PEN_PURPLE_COLOR;
37993506 BrushList_EnumLeafBrushes(BList, &brushDrawData, ::BrushDrawWireSel3dCB);
@@ -3800,25 +3507,25 @@
38003507 }
38013508
38023509 if((App->CLSB_Doc->mModeTool==ID_TOOLS_TEMPLATE)||
3803- (App->CLSB_Doc->mModeTool==ID_TOOLS_CAMERA && GetSelState()==NOSELECTIONS))
3510+ (App->CLSB_Doc->mModeTool==ID_TOOLS_CAMERA && App->CLSB_Doc->GetSelState()==NOSELECTIONS))
38043511 {
38053512 brushDrawData.Color = PEN_BLUE_COLOR;
3806- if(!TempEnt)
3513+ if(!App->CLSB_Doc->TempEnt)
38073514 {
3808- if(Brush_IsMulti(CurBrush))
3515+ if(Brush_IsMulti(App->CLSB_Doc->CurBrush))
38093516 {
3810- BrushList_EnumLeafBrushes(App->CL_Brush->Brush_GetBrushList(CurBrush), &brushDrawData, ::BrushDrawWire3dCB);
3517+ BrushList_EnumLeafBrushes(App->CL_Brush->Brush_GetBrushList(App->CLSB_Doc->CurBrush), &brushDrawData, ::BrushDrawWire3dCB);
38113518 }
38123519 else
38133520 {
3814- Render_RenderBrushFaces(v, CurBrush, brushDrawData.Color);
3521+ Render_RenderBrushFaces(v, App->CLSB_Doc->CurBrush, brushDrawData.Color);
38153522 }
38163523 }
38173524 else
38183525 {
3819- if(Render_PointInFrustum(v, &mRegularEntity.mOrigin))
3526+ if(Render_PointInFrustum(v, &App->CLSB_Doc->mRegularEntity.mOrigin))
38203527 {
3821- ::DrawEntity (&mRegularEntity, v, Level_GetEntityDefs (App->CLSB_Doc->pLevel));
3528+ ::DrawEntity (&App->CLSB_Doc->mRegularEntity, v, Level_GetEntityDefs (App->CLSB_Doc->pLevel));
38223529 }
38233530 }
38243531 }
@@ -3832,7 +3539,7 @@
38323539
38333540 void CFusionDoc::MoveSelectedClone(geVec3d const *v)
38343541 {
3835- App->CLSB_Doc->MoveSelectedBrushList (pSelBrushes, v);
3542+ App->CLSB_Doc->MoveSelectedBrushList (App->CLSB_Doc->pSelBrushes, v);
38363543 }
38373544
38383545 void CFusionDoc::MoveTemplateBrush(geVec3d *v)
@@ -3842,17 +3549,17 @@
38423549 geVec3d_Add (&App->CLSB_Doc->SelectedGeoCenter, v, &App->CLSB_Doc->SelectedGeoCenter);
38433550 geVec3d_Add (v, &App->CLSB_Doc->FinalPos, &App->CLSB_Doc->FinalPos);
38443551
3845- if(TempEnt)
3552+ if(App->CLSB_Doc->TempEnt)
38463553 {
3847- mRegularEntity.Move (v);
3554+ App->CLSB_Doc->mRegularEntity.Move (v);
38483555 }
38493556 else
38503557 {
38513558 geVec3d *pTemplatePos;
38523559
3853- Brush_Move (CurBrush, v);
3560+ Brush_Move (App->CLSB_Doc->CurBrush, v);
38543561 pTemplatePos = Level_GetTemplatePos (App->CLSB_Doc->pLevel);
3855- Brush_Center (CurBrush, pTemplatePos);
3562+ Brush_Center (App->CLSB_Doc->CurBrush, pTemplatePos);
38563563 }
38573564 }
38583565
@@ -3864,7 +3571,7 @@
38643571
38653572 geVec3d_Add(v, &App->CLSB_Doc->FinalRot, &App->CLSB_Doc->FinalRot);
38663573 geXForm3d_SetEulerAngles(&rm, v);
3867- Brush_Rotate (CurBrush, &rm, &App->CLSB_Doc->SelectedGeoCenter);
3574+ Brush_Rotate (App->CLSB_Doc->CurBrush, &rm, &App->CLSB_Doc->SelectedGeoCenter);
38683575 }
38693576
38703577 void CFusionDoc::GetRotationPoint
@@ -3953,7 +3660,7 @@
39533660
39543661 void CFusionDoc::RotateSelectedBrushesDirect(geVec3d const *v)
39553662 {
3956- RotateSelectedBrushList (pSelBrushes, v);
3663+ RotateSelectedBrushList (App->CLSB_Doc->pSelBrushes, v);
39573664 UpdateSelectedModel (BRUSH_ROTATE, v);
39583665 geVec3d_Clear (&App->CLSB_Doc->FinalRot);
39593666 }
@@ -3969,9 +3676,9 @@
39693676 // Sets texture scale on all faces of all selected brushes.
39703677 void CFusionDoc::SetAllFacesTextureScale(geFloat ScaleVal)
39713678 {
3972- if (SelBrushList_GetSize (pSelBrushes) > 0)
3679+ if (SelBrushList_GetSize (App->CLSB_Doc->pSelBrushes) > 0)
39733680 {
3974- SelBrushList_Enum (pSelBrushes, fdocBrushTextureScaleCallback, &ScaleVal);
3681+ SelBrushList_Enum (App->CLSB_Doc->pSelBrushes, fdocBrushTextureScaleCallback, &ScaleVal);
39753682 if (Level_RebuildBspAlways (App->CLSB_Doc->pLevel))
39763683 {
39773684 RebuildTrees();
@@ -3992,12 +3699,12 @@
39923699
39933700 App->CLSB_Doc->mLastOp =BRUSH_ROTATE;
39943701
3995- TempDeleteSelected();
3702+ App->CLSB_Doc->TempDeleteSelected();
39963703 TempCopySelectedBrushes();
39973704
39983705 GetRotationPoint (&RotationPoint);
39993706
4000- if((SelState & NOENTITIES) && Level_UseGrid (App->CLSB_Doc->pLevel))
3707+ if((App->CLSB_Doc->SelState & NOENTITIES) && Level_UseGrid (App->CLSB_Doc->pLevel))
40013708 {
40023709 RSnap =Units_DegreesToRadians ((float)Level_GetRotationSnap (App->CLSB_Doc->pLevel));
40033710 App->CLSB_Doc->FinalRot.X =((float)((int)(App->CLSB_Doc->FinalRot.X / RSnap))) * RSnap;
@@ -4012,17 +3719,17 @@
40123719
40133720 if(App->CLSB_Doc->mModeTool == ID_TOOLS_TEMPLATE)
40143721 {
4015- if (TempEnt)
3722+ if (App->CLSB_Doc->TempEnt)
40163723 {
40173724 }
40183725 else
40193726 {
4020- Brush_Rotate (CurBrush, &rm, &RotationPoint);
3727+ Brush_Rotate (App->CLSB_Doc->CurBrush, &rm, &RotationPoint);
40213728 }
40223729 return;
40233730 }
40243731
4025- int NumSelBrushes = SelBrushList_GetSize (pSelBrushes);
3732+ int NumSelBrushes = SelBrushList_GetSize (App->CLSB_Doc->pSelBrushes);
40263733
40273734 for(i=0;i < NumSelBrushes;i++)
40283735 {
@@ -4039,7 +3746,7 @@
40393746 }
40403747 if(i < NumSelBrushes)
40413748 {
4042- TempDeleteSelected();
3749+ App->CLSB_Doc->TempDeleteSelected();
40433750 }
40443751 else
40453752 {
@@ -4050,7 +3757,7 @@
40503757 Brush *TempBrush, *OldBrush;
40513758
40523759 TempBrush = SelBrushList_GetBrush (App->CLSB_Doc->pTempSelBrushes, 0);
4053- OldBrush = SelBrushList_GetBrush (pSelBrushes, 0);
3760+ OldBrush = SelBrushList_GetBrush (App->CLSB_Doc->pSelBrushes, 0);
40543761 // changed QD Actors
40553762 if(strstr(App->CL_Brush->Brush_GetName(OldBrush),".act")!=NULL)
40563763 {
@@ -4064,10 +3771,10 @@
40643771 BrushList_InsertAfter (BList, OldBrush, TempBrush);
40653772 BrushList_Remove (BList, OldBrush);
40663773
4067- SelBrushList_Remove (pSelBrushes, OldBrush);
3774+ SelBrushList_Remove (App->CLSB_Doc->pSelBrushes, OldBrush);
40683775 SelBrushList_Remove (App->CLSB_Doc->pTempSelBrushes, TempBrush);
40693776
4070- SelBrushList_Add (pSelBrushes, TempBrush);
3777+ SelBrushList_Add (App->CLSB_Doc->pSelBrushes, TempBrush);
40713778
40723779 Brush_Destroy (&OldBrush);
40733780 }
@@ -4113,7 +3820,7 @@
41133820 // don't mess with models that are animating
41143821 if (Model_IsAnimating (pModel) != GE_TRUE)
41153822 {
4116- if (Model_IsSelected (pModel, pSelBrushes, BList))
3823+ if (Model_IsSelected (pModel, App->CLSB_Doc->pSelBrushes, BList))
41173824 {
41183825 Model_UpdateOrigin (pModel, MoveRotate, pVecDelta);
41193826 }
@@ -4122,64 +3829,6 @@
41223829 }
41233830 }
41243831
4125-void CFusionDoc::DoneMoveEntity(void)
4126-{
4127- int i;
4128- float SnapSize;
4129- CEntityArray *Entities = Level_GetEntities (App->CLSB_Doc->pLevel);
4130- CEntity *pEnt;
4131-
4132- if (App->CLSB_Doc->mCurrentTool==ID_TOOLS_BRUSH_MOVEROTATEBRUSH)
4133- {
4134- if ((GetSelState()==ONEENTITYONLY) && Level_UseGrid (App->CLSB_Doc->pLevel))
4135- {
4136- SnapSize = Level_GetGridSnapSize (App->CLSB_Doc->pLevel);
4137- }
4138- else
4139- {
4140- SnapSize = 1.0f;
4141- }
4142-
4143- for(i=0;i < Entities->GetSize();i++)
4144- {
4145- pEnt = &(*Entities)[i];
4146-
4147- if (pEnt->IsSelected ())
4148- {
4149- pEnt->DoneMove (SnapSize, Level_GetEntityDefs (App->CLSB_Doc->pLevel));
4150- if( pEnt->IsCamera() == GE_TRUE ) // Camera Entity?
4151-// if( pEnt==pCameraEntity ) // Camera Entity?
4152- {
4153- geVec3d PitchRollYaw ;
4154-
4155- pEnt->GetAngles( &PitchRollYaw, Level_GetEntityDefs (App->CLSB_Doc->pLevel) ) ;
4156- SetRenderedViewCamera( &(pEnt->mOrigin), &PitchRollYaw ) ;
4157- App->CLSB_Doc->UpdateAllViews(UAV_RENDER_ONLY, NULL);
4158- }// Camera entity, update camera
4159- }// Entity Selected
4160- }// Loop thru Entities
4161- }
4162- else
4163- {
4164- if(App->CLSB_Doc->mCurrentEntity < 0) //template
4165- {
4166- pEnt = &mRegularEntity;
4167- }
4168- else
4169- {
4170- pEnt = &(*Entities)[App->CLSB_Doc->mCurrentEntity];
4171- }
4172-
4173- SnapSize = 1.0f;
4174- if( Level_UseGrid (App->CLSB_Doc->pLevel))
4175- {
4176- SnapSize = Level_GetGridSnapSize (App->CLSB_Doc->pLevel);
4177- }
4178- pEnt->DoneMove(SnapSize, Level_GetEntityDefs (App->CLSB_Doc->pLevel));
4179- }
4180- SetModifiedFlag();
4181-}/* CFusionDoc::DoneMoveEntity */
4182-
41833832 // ME Terry
41843833 //void CFusionDoc::UpdateAllViews(int Mode, CView* pSender, BOOL Override)
41853834 //{
@@ -4310,83 +3959,6 @@
43103959 }
43113960 */
43123961
4313-// This function basically sets up everything required
4314-// for each tool before its use...
4315-void CFusionDoc::ConfigureCurrentTool(void)
4316-{
4317- BOOL Redraw =FALSE;
4318-
4319- if(App->CLSB_Doc->mModeTool==ID_TOOLS_CAMERA)
4320- {
4321- App->CLSB_Doc->mCurrentTool =CURTOOL_NONE;
4322- mShowSelectedBrushes=(mAdjustMode==ADJUST_MODE_BRUSH);
4323- App->CLSB_Doc->mShowSelectedFaces =(mAdjustMode==ADJUST_MODE_FACE);
4324- App->CLSB_Doc->UpdateAllViews(UAV_ALL3DVIEWS, NULL);
4325- return;
4326- }
4327-
4328- switch(mAdjustMode)
4329- {
4330- case ADJUST_MODE_BRUSH :
4331- App->CLSB_Doc->mShowSelectedFaces =FALSE;
4332- mShowSelectedBrushes=TRUE;
4333-
4334- App->CLSB_Doc->UpdateSelected();
4335- Redraw =TRUE;
4336- break;
4337-
4338- case ADJUST_MODE_FACE :
4339- App->CLSB_Doc->mShowSelectedFaces =TRUE;
4340- mShowSelectedBrushes=FALSE;
4341-
4342- App->CLSB_Doc->UpdateSelected();
4343- Redraw =TRUE;
4344- break;
4345-
4346- default :
4347- assert (0); // bad adjustment mode
4348- break;
4349- }
4350-
4351- switch(App->CLSB_Doc->mCurrentTool)
4352- {
4353- case ID_TOOLS_BRUSH_MOVEROTATEBRUSH:
4354- if(App->CLSB_Doc->mModeTool!=ID_TOOLS_TEMPLATE)
4355- {
4356- App->CLSB_Doc->mShowSelectedFaces =FALSE;
4357- mShowSelectedBrushes=TRUE;
4358- Redraw =TRUE;
4359- }
4360- else
4361- {
4362- App->CLSB_Doc->mShowSelectedFaces =FALSE;
4363- mShowSelectedBrushes=FALSE;
4364- }
4365- break;
4366-
4367- case ID_TOOLS_BRUSH_SCALEBRUSH:
4368- if(App->CLSB_Doc->mModeTool!=ID_TOOLS_TEMPLATE)
4369- {
4370- Redraw =TRUE;
4371- App->CLSB_Doc->mShowSelectedFaces =FALSE;
4372- mShowSelectedBrushes=TRUE;
4373- }
4374- else
4375- {
4376- App->CLSB_Doc->mShowSelectedFaces =FALSE;
4377- mShowSelectedBrushes=FALSE;
4378- }
4379- break;
4380-
4381- }
4382- if(App->CLSB_Doc->mModeTool==ID_TOOLS_TEMPLATE && TempEnt)
4383- App->CLSB_Doc->mCurrentEntity=-1;
4384-
4385- Redraw =TRUE;
4386- if(Redraw)
4387- App->CLSB_Doc->UpdateAllViews(UAV_ALL3DVIEWS, NULL);
4388-}
4389-
43903962 //void CFusionDoc::NullBrushAttributes(void){ mpBrushAttributes=NULL; }
43913963
43923964 #pragma warning (disable:4100)
@@ -4422,13 +3994,13 @@
44223994
44233995 void CFusionDoc::OnConstrainhollows()
44243996 {
4425- mConstrainHollows = ! mConstrainHollows ;
3997+ App->CLSB_Doc->mConstrainHollows = !App->CLSB_Doc->mConstrainHollows ;
44263998 SetModifiedFlag();
44273999 }
44284000
44294001 void CFusionDoc::OnUpdateConstrainhollows(CCmdUI* pCmdUI)
44304002 {
4431- pCmdUI->SetCheck( mConstrainHollows );
4003+ pCmdUI->SetCheck(App->CLSB_Doc->mConstrainHollows );
44324004 }
44334005
44344006 void CFusionDoc::OnGeneralselect()
@@ -4440,7 +4012,7 @@
44404012 {
44414013 App->CLSB_Doc->mCurrentTool =CURTOOL_NONE;
44424014 App->CLSB_Doc->mModeTool =ID_GENERALSELECT;
4443- ConfigureCurrentTool();
4015+ App->CLSB_Doc->ConfigureCurrentTool();
44444016 //mpMainFrame->m_wndTabControls->m_pBrushEntityDialog->Update(this);
44454017 }
44464018
@@ -4449,90 +4021,6 @@
44494021 pCmdUI->SetCheck ((App->CLSB_Doc->mModeTool == ID_GENERALSELECT) ? 1 : 0);
44504022 }
44514023
4452-static geBoolean fdocSelectBrushesFromFaces (Brush *pBrush, void *lParam)
4453-{
4454- CFusionDoc *pDoc = (CFusionDoc *)lParam;
4455- int iFace, nFaces;
4456-
4457- // if any of the brush's faces is selected, then select the brush.
4458- nFaces = Brush_GetNumFaces (pBrush);
4459- for (iFace = 0; iFace < nFaces; ++iFace)
4460- {
4461- Face *pFace;
4462-
4463- pFace = Brush_GetFace (pBrush, iFace);
4464- if (Face_IsSelected (pFace))
4465- {
4466- pDoc->DoBrushSelection (pBrush, brushSelAlways);
4467- break;
4468- }
4469- }
4470- return GE_TRUE;
4471-}
4472-
4473-void CFusionDoc::SetAdjustmentMode( fdocAdjustEnum nCmdIDMode )
4474-{
4475- if( mAdjustMode == nCmdIDMode )
4476- return ;
4477-
4478- if (nCmdIDMode == ADJUST_MODE_TOGGLE)
4479- {
4480-// nCmdIDMode = (mAdjustMode == ADJUST_MODE_BRUSH) ? ADJUST_MODE_FACE : ADJUST_MODE_BRUSH;
4481- nCmdIDMode = ADJUST_MODE_FACE;
4482- }
4483-
4484- switch (nCmdIDMode)
4485- {
4486- case ADJUST_MODE_BRUSH :
4487- mAdjustMode = nCmdIDMode;
4488-
4489- // go through brush list and select any brush that has selected faces.
4490- // Ensure that all brushes in a locked group or model set are selected...
4491- Level_EnumLeafBrushes (App->CLSB_Doc->pLevel, this, ::fdocSelectBrushesFromFaces);
4492-
4493- App->CLSB_Doc->ResetAllSelectedFaces();
4494- App->CLSB_Doc->UpdateSelected();
4495-
4496- //remove face attributes dialog if present...
4497-// DeleteFaceAttributes ();
4498- ConfigureCurrentTool();
4499- break;
4500-
4501- case ADJUST_MODE_FACE :
4502- {
4503- mAdjustMode = nCmdIDMode;
4504-
4505- // Select all faces on all selected brushes
4506- int iBrush;
4507- int NumSelBrushes = SelBrushList_GetSize (pSelBrushes);
4508-
4509- for (iBrush = 0; iBrush < NumSelBrushes; ++iBrush)
4510- {
4511- Brush *pBrush;
4512-
4513- pBrush = SelBrushList_GetBrush (pSelBrushes, iBrush);
4514- if (Brush_IsMulti (pBrush))
4515- {
4516- BrushList_EnumLeafBrushes (App->CL_Brush->Brush_GetBrushList (pBrush), this, ::SelAllBrushFaces);
4517- }
4518- else
4519- {
4520- ::SelAllBrushFaces (pBrush, this);
4521- }
4522- }
4523- App->CLSB_Doc->UpdateSelected ();
4524- //remove brush attributes dialog if present...
4525-// DeleteBrushAttributes ();
4526- ConfigureCurrentTool();
4527- break;
4528- }
4529- default :
4530- assert (0); // bad mode (can't happen?)
4531- break;
4532- }
4533-}
4534-
4535-
45364024 void CFusionDoc::OnCloseDocument() // hgtterry Exit Aplication
45374025 {
45384026
@@ -4568,7 +4056,7 @@
45684056
45694057 void CFusionDoc::OnUpdateEditCopy(CCmdUI* pCmdUI)
45704058 {
4571- if(GetSelState()!=NOSELECTIONS) pCmdUI->Enable( TRUE );
4059+ if(App->CLSB_Doc->GetSelState()!=NOSELECTIONS) pCmdUI->Enable( TRUE );
45724060 else pCmdUI->Enable( FALSE );
45734061 }
45744062
@@ -4594,7 +4082,7 @@
45944082 // Place selected brushes on clipboard and then delete them...
45954083 void CFusionDoc::OnEditCut()
45964084 {
4597- BOOL Flag =(GetSelState() & ANYBRUSH);
4085+ BOOL Flag =(App->CLSB_Doc->GetSelState() & ANYBRUSH);
45984086
45994087 OnEditCopy();
46004088 App->CLSB_Doc->DeleteSelectedBrushes();
@@ -4614,7 +4102,7 @@
46144102
46154103 void CFusionDoc::OnUpdateEditCut(CCmdUI* pCmdUI)
46164104 {
4617- if(GetSelState()!=NOSELECTIONS) pCmdUI->Enable( TRUE );
4105+ if(App->CLSB_Doc->GetSelState()!=NOSELECTIONS) pCmdUI->Enable( TRUE );
46184106 else pCmdUI->Enable( FALSE );
46194107 }
46204108
@@ -4631,7 +4119,7 @@
46314119 int i;
46324120 int NumSelBrushes;
46334121
4634- NumSelBrushes = SelBrushList_GetSize (pSelBrushes);
4122+ NumSelBrushes = SelBrushList_GetSize (App->CLSB_Doc->pSelBrushes);
46354123
46364124 if( NumSelBrushes )
46374125 {
@@ -4644,7 +4132,7 @@
46444132 Brush *pBrush;
46454133 Brush *pClone;
46464134
4647- pBrush = SelBrushList_GetBrush (pSelBrushes, i);
4135+ pBrush = SelBrushList_GetBrush (App->CLSB_Doc->pSelBrushes, i);
46484136 // changed QD Actors
46494137 // don't copy ActorBrushes
46504138 if(strstr(App->CL_Brush->Brush_GetName(pBrush),".act")!=NULL)
@@ -4739,7 +4227,7 @@
47394227 Brush *pClone;
47404228 pClone = Brush_Clone ((*CopiedBrushes)[i]);
47414229 Level_AppendBrush (App->CLSB_Doc->pLevel, pClone);
4742- SelBrushList_Add (pSelBrushes, pClone);
4230+ SelBrushList_Add (App->CLSB_Doc->pSelBrushes, pClone);
47434231 }
47444232 }
47454233
@@ -4776,9 +4264,9 @@
47764264
47774265 if(App->CLSB_Doc->mModeTool == ID_TOOLS_TEMPLATE)
47784266 {
4779- Brush_Destroy(&CurBrush);
4780- CurBrush =BTemplate =Brush_Clone(TempShearTemplate);
4781- Brush_ShearFixed(CurBrush, dx, dy, sides, inidx, &App->CLSB_Doc->FinalScale, &App->CLSB_Doc->ScaleNum);
4267+ Brush_Destroy(&App->CLSB_Doc->CurBrush);
4268+ App->CLSB_Doc->CurBrush = App->CLSB_Doc->BTemplate =Brush_Clone(App->CLSB_Doc->TempShearTemplate);
4269+ Brush_ShearFixed(App->CLSB_Doc->CurBrush, dx, dy, sides, inidx, &App->CLSB_Doc->FinalScale, &App->CLSB_Doc->ScaleNum);
47824270 }
47834271 else
47844272 {
@@ -4785,7 +4273,7 @@
47854273 int i;
47864274 int NumSelBrushes;
47874275
4788- TempDeleteSelected();
4276+ App->CLSB_Doc->TempDeleteSelected();
47894277 TempCopySelectedBrushes();
47904278 NumSelBrushes = SelBrushList_GetSize (App->CLSB_Doc->pTempSelBrushes);
47914279 for (i = 0; i < NumSelBrushes; ++i)
@@ -4800,86 +4288,6 @@
48004288 SetModifiedFlag();
48014289 }
48024290
4803-void CFusionDoc::DoneShear(int sides, int inidx)
4804-{
4805-// BrushList *BList = Level_GetBrushes (pLevel);
4806- const Box3d *bx1, *bx2;
4807- int snapside =0;
4808- geFloat bsnap;
4809-
4810- SetModifiedFlag();
4811-
4812- App->CLSB_Doc->mLastOp =BRUSH_SHEAR;
4813-
4814- bsnap = 1.0f;
4815- if(Level_UseGrid (App->CLSB_Doc->pLevel))
4816- {
4817- bsnap = Level_GetGridSnapSize (App->CLSB_Doc->pLevel);
4818- }
4819-
4820- if(App->CLSB_Doc->mModeTool==ID_TOOLS_TEMPLATE)
4821- {
4822- if(TempShearTemplate) //can get here without shearing
4823- { //by rapid clicking
4824- Brush_Destroy(&CurBrush);
4825- CurBrush =BTemplate =Brush_Clone(TempShearTemplate);
4826- Brush_ShearFinal(CurBrush, sides, inidx, &App->CLSB_Doc->FinalScale);
4827-
4828- //check which side of the bounds changed
4829- bx1 =Brush_GetBoundingBox(CurBrush);
4830- bx2 =Brush_GetBoundingBox(TempShearTemplate);
4831-
4832- if(bx1->Max.X != bx2->Max.X) snapside |=2;
4833- if(bx1->Max.Y != bx2->Max.Y) snapside |=8;
4834- if(bx1->Max.Z != bx2->Max.Z) snapside |=32;
4835- if(bx1->Min.X != bx2->Min.X) snapside |=1;
4836- if(bx1->Min.Y != bx2->Min.Y) snapside |=4;
4837- if(bx1->Min.Z != bx2->Min.Z) snapside |=16;
4838- Brush_SnapShearNearest(CurBrush, bsnap, sides, inidx, snapside);
4839- Brush_Destroy(&TempShearTemplate);
4840- }
4841- return;
4842- }
4843-
4844- int NumSelBrushes = SelBrushList_GetSize (pSelBrushes);
4845-
4846- TempDeleteSelected();
4847- TempCopySelectedBrushes();
4848-
4849- int i;
4850-
4851- for (i = 0; i < NumSelBrushes; ++i)
4852- {
4853- Brush *pBrush;
4854- Brush *tBrush;
4855-
4856- pBrush = SelBrushList_GetBrush (pSelBrushes, i);
4857- tBrush = SelBrushList_GetBrush (App->CLSB_Doc->pTempSelBrushes, i);
4858-// changed QD Actors
4859-// don't shear ActorBrushes
4860- if(strstr(App->CL_Brush->Brush_GetName(pBrush),".act")!=NULL)
4861- continue;
4862-// end change
4863-
4864- Brush_ShearFinal(pBrush, sides, inidx, &App->CLSB_Doc->FinalScale);
4865-
4866- //check which side of the bounds changed
4867- bx1 =Brush_GetBoundingBox(pBrush);
4868- bx2 =Brush_GetBoundingBox(tBrush);
4869-
4870- if(bx1->Max.X != bx2->Max.X) snapside |=2;
4871- if(bx1->Max.Y != bx2->Max.Y) snapside |=8;
4872- if(bx1->Max.Z != bx2->Max.Z) snapside |=32;
4873- if(bx1->Min.X != bx2->Min.X) snapside |=1;
4874- if(bx1->Min.Y != bx2->Min.Y) snapside |=4;
4875- if(bx1->Min.Z != bx2->Min.Z) snapside |=16;
4876-
4877- Brush_SnapShearNearest(pBrush, bsnap, sides, inidx, snapside);
4878- }
4879- TempDeleteSelected();
4880- App->CLSB_Doc->UpdateSelected();
4881-}
4882-
48834291 int CFusionDoc::DoCompileDialog(void)
48844292 {
48854293 //CompileParamsType *CompileParams;
@@ -5247,11 +4655,11 @@
52474655 {
52484656 if (pData->Select)
52494657 {
5250- SelBrushList_Add (pData->pDoc->pSelBrushes, pBrush);
4658+ SelBrushList_Add (App->CLSB_Doc->pSelBrushes, pBrush);
52514659 }
52524660 else
52534661 {
5254- SelBrushList_Remove (pData->pDoc->pSelBrushes, pBrush);
4662+ SelBrushList_Remove (App->CLSB_Doc->pSelBrushes, pBrush);
52554663 }
52564664 }
52574665 return GE_TRUE;
@@ -5359,7 +4767,7 @@
53594767 // add selected brushes/entities to current group, no UI
53604768 {
53614769 fdocAddEntityData entData;
5362- int NumSelBrushes = SelBrushList_GetSize (pSelBrushes);
4770+ int NumSelBrushes = SelBrushList_GetSize (App->CLSB_Doc->pSelBrushes);
53634771
53644772 entData.Groups = Level_GetGroups (App->CLSB_Doc->pLevel);
53654773 entData.CurrentGroup = App->CLSB_Doc->mCurrentGroup;
@@ -5369,7 +4777,7 @@
53694777 {
53704778 Brush *pBrush;
53714779
5372- pBrush = SelBrushList_GetBrush (pSelBrushes, i);
4780+ pBrush = SelBrushList_GetBrush (App->CLSB_Doc->pSelBrushes, i);
53734781 // changed QD Actors
53744782 if(strstr(App->CL_Brush->Brush_GetName(pBrush),".act")!=NULL)
53754783 continue;
@@ -5404,7 +4812,7 @@
54044812 SetModifiedFlag();
54054813
54064814 fdocAddEntityData entData;
5407- int NumSelBrushes = SelBrushList_GetSize (pSelBrushes);
4815+ int NumSelBrushes = SelBrushList_GetSize (App->CLSB_Doc->pSelBrushes);
54084816
54094817 entData.Groups = Level_GetGroups (App->CLSB_Doc->pLevel);
54104818 entData.CurrentGroup = App->CLSB_Doc->mCurrentGroup;
@@ -5413,7 +4821,7 @@
54134821 {
54144822 Brush *pBrush;
54154823
5416- pBrush = SelBrushList_GetBrush (pSelBrushes, i);
4824+ pBrush = SelBrushList_GetBrush (App->CLSB_Doc->pSelBrushes, i);
54174825 if( Brush_GetGroupId(pBrush) == App->CLSB_Doc->mCurrentGroup )
54184826 {
54194827 Group_RemoveBrush( entData.Groups, App->CLSB_Doc->mCurrentGroup, pBrush );
@@ -5444,8 +4852,8 @@
54444852 BOOL CFusionDoc::OneBrushSelectedOnly(void)
54454853 {
54464854 return ((App->CLSB_Doc->mModeTool==ID_TOOLS_TEMPLATE) ||
5447- ((SelBrushList_GetSize (pSelBrushes)==1) && (App->CLSB_Doc->NumSelEntities == 0) &&
5448- (SelFaceList_GetSize (pSelFaces) == 0)));
4855+ ((SelBrushList_GetSize (App->CLSB_Doc->pSelBrushes)==1) && (App->CLSB_Doc->NumSelEntities == 0) &&
4856+ (SelFaceList_GetSize (App->CLSB_Doc->pSelFaces) == 0)));
54494857 }
54504858
54514859 void CFusionDoc::OnUpdateBrushSubtractfromworld(CCmdUI* pCmdUI)
@@ -5453,8 +4861,8 @@
54534861 BOOL EnableFlag;
54544862
54554863 EnableFlag = ((App->CLSB_Doc->mModeTool==ID_GENERALSELECT) &&
5456- (SelBrushList_GetSize (pSelBrushes)==1) &&
5457- (SelFaceList_GetSize (pSelFaces) == 0) &&
4864+ (SelBrushList_GetSize (App->CLSB_Doc->pSelBrushes)==1) &&
4865+ (SelFaceList_GetSize (App->CLSB_Doc->pSelFaces) == 0) &&
54584866 (App->CLSB_Doc->NumSelEntities == 0));
54594867 pCmdUI->Enable (EnableFlag);
54604868 }
@@ -5583,7 +4991,7 @@
55834991 EnumData.NewLevel = NewLevel;
55844992 EnumData.OldLevel = App->CLSB_Doc->pLevel;
55854993
5586- int NumSelBrushes = SelBrushList_GetSize (pSelBrushes);
4994+ int NumSelBrushes = SelBrushList_GetSize (App->CLSB_Doc->pSelBrushes);
55874995 // add all selected brushes and entities to the new level
55884996 for (i = 0; i < NumSelBrushes; ++i)
55894997 {
@@ -5590,7 +4998,7 @@
55904998 Brush *NewBrush;
55914999 Brush *OldBrush;
55925000
5593- OldBrush = SelBrushList_GetBrush (pSelBrushes, i);
5001+ OldBrush = SelBrushList_GetBrush (App->CLSB_Doc->pSelBrushes, i);
55945002 // changed QD Actors
55955003 if(strstr(App->CL_Brush->Brush_GetName(OldBrush),".act")!=NULL)
55965004 continue;
@@ -5743,7 +5151,7 @@
57435151
57445152 if(App->CLSB_Doc->mModeTool == ID_TOOLS_TEMPLATE)
57455153 {
5746- Brush_SnapScaleNearest(CurBrush, bsnap, sides, inidx, &App->CLSB_Doc->FinalScale, &App->CLSB_Doc->ScaleNum);
5154+ Brush_SnapScaleNearest(App->CLSB_Doc->CurBrush, bsnap, sides, inidx, &App->CLSB_Doc->FinalScale, &App->CLSB_Doc->ScaleNum);
57475155 }
57485156 else
57495157 {
@@ -6426,7 +5834,7 @@
64265834 Brush_SetSolid(b, GE_TRUE);
64275835 //MRB END
64285836 }
6429- SelBrushList_Add (pSelBrushes, b);
5837+ SelBrushList_Add (App->CLSB_Doc->pSelBrushes, b);
64305838 }
64315839 }
64325840 else if(bc=='}')
@@ -6445,7 +5853,7 @@
64455853 }
64465854 // add the new model to the list.
64475855 // This will set the model id fields in the model's brushes
6448- if (ModelList_Add (ModelInfo->Models, Key, pSelBrushes))
5856+ if (ModelList_Add (ModelInfo->Models, Key, App->CLSB_Doc->pSelBrushes))
64495857 {
64505858 Model *m;
64515859
@@ -6460,7 +5868,7 @@
64605868 // (and don't allow it to be edited/deleted)
64615869 Model_AddKeyframe(m, 0.0f, &XfmDelta);
64625870 }
6463- SelBrushList_RemoveAll (pSelBrushes);
5871+ SelBrushList_RemoveAll (App->CLSB_Doc->pSelBrushes);
64645872 }
64655873 else if(bc==EOF || bc=='}')
64665874 {
@@ -6958,7 +6366,7 @@
69586366 EnumData.NewLevel = NewLevel;
69596367 EnumData.OldLevel = App->CLSB_Doc->pLevel;
69606368
6961- int NumSelBrushes = SelBrushList_GetSize (pSelBrushes);
6369+ int NumSelBrushes = SelBrushList_GetSize (App->CLSB_Doc->pSelBrushes);
69626370
69636371 // add all selected brushes and entities to the new level
69646372 for (i = 0; i < NumSelBrushes; ++i)
@@ -6966,7 +6374,7 @@
69666374 Brush *NewBrush;
69676375 Brush *OldBrush;
69686376
6969- OldBrush = SelBrushList_GetBrush (pSelBrushes, i);
6377+ OldBrush = SelBrushList_GetBrush (App->CLSB_Doc->pSelBrushes, i);
69706378 // changed QD Actors
69716379 if(strstr(App->CL_Brush->Brush_GetName(OldBrush),".act")!=NULL)
69726380 continue;
@@ -7386,7 +6794,7 @@
73866794 {
73876795 if(!strstr(App->CL_Brush->Brush_GetName(pBrush),".act"))
73886796 {
7389- if(!ExpSelected || SelBrushList_Find(pSelBrushes, pBrush))
6797+ if(!ExpSelected || SelBrushList_Find(App->CLSB_Doc->pSelBrushes, pBrush))
73906798 {
73916799 if(!ExpFiles || Brush_GetGroupId(pBrush)==i)
73926800 {
@@ -7538,7 +6946,7 @@
75386946 {
75396947 if(!strstr(App->CL_Brush->Brush_GetName(pBrush),".act"))
75406948 {
7541- if(!ExpSelected || SelBrushList_Find(pSelBrushes, pBrush))
6949+ if(!ExpSelected || SelBrushList_Find(App->CLSB_Doc->pSelBrushes, pBrush))
75426950 {
75436951 if(!ExpFiles || Brush_GetGroupId(pBrush)==i)
75446952 {
@@ -7666,7 +7074,7 @@
76667074 {
76677075 BOOL bEnable ;
76687076
7669- bEnable = ((GetSelState() & ANYBRUSH) ? TRUE : FALSE) || ((GetSelState() & ANYENTITY) ? TRUE : FALSE);
7077+ bEnable = ((App->CLSB_Doc->GetSelState() & ANYBRUSH) ? TRUE : FALSE) || ((App->CLSB_Doc->GetSelState() & ANYENTITY) ? TRUE : FALSE);
76707078
76717079 pCmdUI->Enable( bEnable ) ;
76727080
@@ -7679,7 +7087,7 @@
76797087 {
76807088 BOOL bEnable ;
76817089
7682- bEnable = ((GetSelState() & ANYBRUSH) ? TRUE : FALSE) || ((GetSelState() & ANYENTITY) ? TRUE : FALSE);
7090+ bEnable = ((App->CLSB_Doc->GetSelState() & ANYBRUSH) ? TRUE : FALSE) || ((App->CLSB_Doc->GetSelState() & ANYENTITY) ? TRUE : FALSE);
76837091
76847092 pCmdUI->Enable( bEnable ) ;
76857093
@@ -7694,34 +7102,6 @@
76947102 App->Say("Exported");
76957103 }
76967104
7697-
7698-const char* CFusionDoc::ReturnThingUnderPoint(CPoint point, ViewVars *v)
7699-{
7700- Brush *pMinBrush;
7701- CEntity *pMinEntity;
7702- geFloat Dist;
7703- int FoundThingType;
7704-
7705- FoundThingType = FindClosestThing (&point, v, &pMinBrush, &pMinEntity, &Dist);
7706- if ((FoundThingType != fctNOTHING) && (Dist <= MAX_PIXEL_SELECT_THINGNAME))
7707- {
7708- switch (FoundThingType)
7709- {
7710- case fctBRUSH :
7711- return App->CL_Brush->Brush_GetName(pMinBrush);
7712- break;
7713- case fctENTITY :
7714- return pMinEntity->GetName();
7715- break;
7716- default :
7717- break;
7718- }
7719- }
7720-
7721- return "";
7722-}
7723-
7724-
77257105 const char* CFusionDoc::GetObjectName3D(CPoint point, ViewVars *v)
77267106 {
77277107 int CurEnt = 0;
@@ -7859,7 +7239,7 @@
78597239 {
78607240 CEntity* pEnt = NULL;
78617241
7862- if(SelState & ONEENTITY)
7242+ if(App->CLSB_Doc->SelState & ONEENTITY)
78637243 {
78647244 CEntityArray *Entities = Level_GetEntities (App->CLSB_Doc->pLevel);
78657245
@@ -7980,13 +7360,13 @@
79807360 // Get the current thing's position...
79817361 geVec3d CurrentThingPos;
79827362
7983- if (TempEnt)
7363+ if (App->CLSB_Doc->TempEnt)
79847364 {
7985- CurrentThingPos = mRegularEntity.mOrigin;
7365+ CurrentThingPos = App->CLSB_Doc->mRegularEntity.mOrigin;
79867366 }
79877367 else
79887368 {
7989- int NumSelBrushes = SelBrushList_GetSize( pSelBrushes );
7369+ int NumSelBrushes = SelBrushList_GetSize(App->CLSB_Doc->pSelBrushes );
79907370
79917371 if ((!NumSelBrushes) && (!App->CLSB_Doc->NumSelEntities))
79927372 return;
@@ -8012,7 +7392,7 @@
80127392 }
80137393
80147394 geVec3d BrushSelectionCenter;
8015- SelBrushList_Center( pSelBrushes, &BrushSelectionCenter);
7395+ SelBrushList_Center(App->CLSB_Doc->pSelBrushes, &BrushSelectionCenter);
80167396 geVec3d_Scale(&BrushSelectionCenter, (float)NumSelBrushes, &BrushSelectionCenter);
80177397
80187398 geVec3d_Add(&EntitySelectionCenter, &BrushSelectionCenter, &CurrentThingPos);
@@ -8062,7 +7442,7 @@
80627442
80637443 void CFusionDoc::OnUpdateCameraCenteronselection(CCmdUI* pCmdUI)
80647444 {
8065- if(GetSelState()!=NOSELECTIONS)
7445+ if(App->CLSB_Doc->GetSelState()!=NOSELECTIONS)
80667446 pCmdUI->Enable( TRUE );
80677447 else
80687448 pCmdUI->Enable( FALSE );
@@ -8081,7 +7461,7 @@
80817461
80827462 App->CLSB_Doc->mCurrentTool = ID_TOOLS_BRUSH_MOVEROTATEBRUSH;
80837463
8084- SetAdjustmentMode( ADJUST_MODE_FACE ) ;
7464+ App->CLSB_Doc->SetAdjustmentMode( ADJUST_MODE_FACE ) ;
80857465 //ConfigureCurrentTool();
80867466 }
80877467
@@ -8139,7 +7519,7 @@
81397519
81407520 void CFusionDoc::OnUpdateModifyMove(CCmdUI* pCmdUI)
81417521 {
8142- if ((GetSelState()!=NOSELECTIONS) || ((App->CLSB_Doc->mModeTool==ID_TOOLS_TEMPLATE) && !PlaceObjectFlag))
7522+ if ((App->CLSB_Doc->GetSelState()!=NOSELECTIONS) || ((App->CLSB_Doc->mModeTool==ID_TOOLS_TEMPLATE) && !App->CLSB_Doc->PlaceObjectFlag))
81437523 pCmdUI->Enable( TRUE );
81447524 else
81457525 pCmdUI->Enable( FALSE );
@@ -8167,7 +7547,7 @@
81677547
81687548 void CFusionDoc::OnUpdateModifyScale(CCmdUI* pCmdUI)
81697549 {
8170- if ((GetSelState()!=NOSELECTIONS) || ((App->CLSB_Doc->mModeTool==ID_TOOLS_TEMPLATE) && !PlaceObjectFlag))
7550+ if ((App->CLSB_Doc->GetSelState()!=NOSELECTIONS) || ((App->CLSB_Doc->mModeTool==ID_TOOLS_TEMPLATE) && !App->CLSB_Doc->PlaceObjectFlag))
81717551 pCmdUI->Enable( TRUE );
81727552 else
81737553 pCmdUI->Enable( FALSE );
@@ -8181,7 +7561,7 @@
81817561
81827562 void CFusionDoc::OnUpdateToolsBrushMakenewest(CCmdUI* pCmdUI)
81837563 {
8184- if (GetSelState()==ONEBRUSHONLY)
7564+ if (App->CLSB_Doc->GetSelState()==ONEBRUSHONLY)
81857565 pCmdUI->Enable( TRUE );
81867566 else
81877567 pCmdUI->Enable( FALSE );
--- WorldEditor/WorldEditor/FUSIONDoc.h (revision 2542)
+++ WorldEditor/WorldEditor/FUSIONDoc.h (revision 2543)
@@ -92,14 +92,6 @@
9292 //bool callback for flag checking
9393 typedef geBoolean (*BrushFlagTest)(const Brush *pBrush);
9494
95-
96-enum fdocAdjustEnum
97-{
98- ADJUST_MODE_TOGGLE,
99- ADJUST_MODE_BRUSH,
100- ADJUST_MODE_FACE
101-};
102-
10395 class CFusionView;
10496
10597 class CMainFrame;
@@ -112,24 +104,6 @@
112104
113105 public:
114106
115- fdocAdjustEnum mAdjustMode;
116- int mShowSelectedBrushes;
117- int mLockAxis;
118- geBoolean mConstrainHollows ;
119- BOOL SelectLock, TempEnt;
120- BOOL PlaceObjectFlag; // this flag signifies to place an object rather than putting
121- // down an entity when enter is pressed
122- DWORD SelState;
123-
124- //list related
125- Brush *BTemplate, *CurBrush, *TempShearTemplate;
126- SelBrushList *pSelBrushes;
127-
128- SelFaceList *pSelFaces;
129-
130- GNode *mWorldBsp;
131- CEntity mRegularEntity;
132-
133107 //dialogs / controls
134108 CFrameWnd *mpActiveViewFrame;
135109 CMainFrame *mpMainFrame;
@@ -138,11 +112,9 @@
138112 geBoolean EntityIsVisible( const CEntity *pEntity ) const ;
139113 void TempCopySelectedBrushes();
140114 void DoneRotate(void);
141- void DoneShear(int sides, int inidx);
115+
142116 void SnapScaleNearest(int sides, int inidx, ViewVars *v);
143- DWORD GetSelState(void){ return SelState; }
144- int GetLockAxis( void ) { return mLockAxis ; } ;
145- void SetLockAxis( int Lock ) { mLockAxis = Lock ; } ;
117+
146118 void SetCurrentBrushTexture();
147119 BOOL IsEntitySelected();
148120 void DeleteSelectedEntities();
@@ -165,7 +137,7 @@
165137 void OnBrushAddtoworld();
166138 void DoGeneralSelect (void);
167139 void CreateEntity(char const *pEntityName);
168- geBoolean CreateEntityFromName (char const *pEntityType, CEntity &NewEnt);
140+
169141
170142 // creates a template entity with which the user specifies a location for any objects
171143 // they place
@@ -183,8 +155,7 @@
183155 void ResetSelectedBrush();
184156 void ResetSelectedFace(int PolyNum = 0);
185157 BOOL OneBrushSelectedOnly(void);
186- void ToggleSelectionLock(void){ SelectLock=!(SelectLock); }
187- BOOL IsSelectionLocked(void){ return SelectLock; }
158+
188159 void RotateSelectedBrushes(geVec3d const *v);
189160 void RotateSelectedBrushesDirect(geVec3d const *v);
190161
@@ -194,7 +165,7 @@
194165
195166
196167 void NullBrushAttributes();
197- void ConfigureCurrentTool();
168+
198169 void UpdateCameraEntity( const ViewVars *v ) ;
199170 void SetRenderedViewCamera( const geVec3d * pVec, const geVec3d * pPRY ) ;
200171 geBoolean GetCursorInfo(char *info, int MaxSize);
@@ -211,7 +182,7 @@
211182 // void ChangeGridSize(geFloat Increment, CView* pSender );
212183 void UpdateGridInformation();
213184 void MoveEntity(geVec3d *);
214- void DoneMoveEntity();
185+
215186 void DoneRotateBrush();
216187 void OnSelectedTypeCmdUI(CCmdUI* pCmdUI);
217188 int AreBrushesSelected();
@@ -224,7 +195,8 @@
224195 int CanUndo();
225196 void RenderWorld(ViewVars *v, CDC* pDC);
226197 void RotateTemplateBrush(geVec3d *);
227- void ShearBrush(geVec3d *);
198+
199+ void ShearBrush(geVec3d*);
228200 void ResetSelectedBrushAttributes();
229201 void BrushListToMeters(void);
230202 void BrushListToTexels(void);
@@ -235,13 +207,13 @@
235207 void SelectOrthoRect(CPoint ptStart, CPoint ptEnd, ViewVars *v) ;
236208 void SelectRay(CPoint point, ViewVars *v);
237209 WadFileEntry* GetDibBitmap(const char *Name);
238- BOOL TempDeleteSelected(void);
210+
239211 int MakeNewBrushGroup ( CWnd * pParent );
240212 int FillBrushGroupCombo (CComboBox &cb);
241213 int DoBrushGroupEditor (CComboBox &cb);
242214 void AddSelToGroup( void ) ;
243215 void RemovesSelFromGroup( void ) ;
244- void SetAdjustmentMode ( fdocAdjustEnum nCmdIDMode ) ;
216+
245217
246218 // places the specified object down into the level at the specified location
247219 geBoolean PlaceObject( const char *Objectname, const geVec3d *location );
@@ -254,12 +226,11 @@
254226 geBoolean ValidateBrushes( void ) ;
255227 void SelectTab( int nTabIndex ) ;
256228
257- void BrushSelect (Brush *pBrush);
258229 geBoolean BrushIsSelected (Brush const *pBrush);
259230
260231 void DoBrushSelection (Brush *pBrush, BrushSel nSelType ) ;
261232 void DoEntitySelection (CEntity *pEntity);
262- int FindClosestThing (POINT const *ptFrom, ViewVars *v, Brush **ppMinBrush, CEntity **ppMinEntity, geFloat *pDist);
233+
263234 geBoolean fdocShowBrush( Brush const *b, Box3d const *ViewBox ) ;
264235
265236 geBoolean bShowLeakFinder(void) { return bShowLeak; }
@@ -283,7 +254,7 @@
283254 void ExportTo_RFW(const char *FileName, int ExpSelected, geBoolean ExpLights, geBoolean ExpFiles); // [281221]
284255 // end change
285256
286- const char* ReturnThingUnderPoint(CPoint point, ViewVars *v);
257+
287258 const char* GetObjectName3D(CPoint point, ViewVars *v);
288259
289260 CEntity* GetSelectedEntity();
@@ -481,10 +452,8 @@
481452
482453 void GetRotationPoint (geVec3d *pVec);
483454 void CreateNewTemplateBrush (Brush *pBrush);
484- void AddCameraEntityToLevel (void);
485455
486- geBoolean FindClosestEntity (POINT const *ptFrom, ViewVars *v, CEntity **ppMinEntity, geFloat *pMinEntityDist);
487- geBoolean FindClosestBrush (POINT const *ptFrom, ViewVars *v, Brush **ppFoundBrush, geFloat *pMinEdgeDist);
456+private:
488457
489458 void SetupDefaultFilename (void);
490459
@@ -497,7 +466,6 @@
497466 // void DeleteFaceAttributes (void);
498467 };
499468
500-
501469 geBoolean BrushSelect( Brush *pBrush, Ogre::uint32 Action, Ogre::uint32 Data, void * pVoid ) ;
502470 geBoolean BrushDraw( Brush *pBrush, Ogre::uint32 Action, Ogre::uint32 Data, void * pVoid ) ;
503471 geBoolean EntitySelect( CEntity& Entity, Ogre::uint32 Action, Ogre::uint32 Data, void * pVoid ) ;
--- WorldEditor/WorldEditor/FUSIONView.cpp (revision 2542)
+++ WorldEditor/WorldEditor/FUSIONView.cpp (revision 2543)
@@ -158,7 +158,7 @@
158158 return;
159159 }
160160
161- if ((pDoc->GetSelState()!=NOSELECTIONS) || (App->CLSB_Doc->mModeTool==ID_TOOLS_TEMPLATE))
161+ if ((App->CLSB_Doc->GetSelState()!=NOSELECTIONS) || (App->CLSB_Doc->mModeTool==ID_TOOLS_TEMPLATE))
162162 pCmdUI->Enable( TRUE );
163163 else
164164 pCmdUI->Enable( FALSE );
@@ -208,7 +208,7 @@
208208 if (App->CLSB_Doc->mModeTool == ID_TOOLS_TEMPLATE)
209209 pDoc->MoveTemplateBrush (&MoveDelta);
210210 else
211- App->CLSB_Doc->MoveSelectedBrushList(pDoc->pSelBrushes, &MoveDelta);
211+ App->CLSB_Doc->MoveSelectedBrushList(App->CLSB_Doc->pSelBrushes, &MoveDelta);
212212
213213 App->CLSB_Doc->UpdateAllViews( UAV_ALL3DVIEWS, NULL );
214214 }
@@ -225,7 +225,7 @@
225225 void CFusionView::LockAxisView (int *dx, int *dy)
226226 {
227227 CFusionDoc *pDoc = GetDocument ();
228- int mLockAxis = pDoc->GetLockAxis ();
228+ int mLockAxis = App->CLSB_Doc->GetLockAxis ();
229229
230230 switch (mViewType)
231231 {
@@ -252,7 +252,7 @@
252252 int mLockAxis ;
253253 CFusionDoc* pDoc = GetDocument();
254254
255- mLockAxis = pDoc->GetLockAxis() ;
255+ mLockAxis = App->CLSB_Doc->GetLockAxis() ;
256256
257257 if( mLockAxis & AXIS_X ) pWP->X = 0.0f ;
258258 if( mLockAxis & AXIS_Y ) pWP->Y = 0.0f ;
@@ -341,7 +341,7 @@
341341
342342 // Box3d BrushBox;
343343 // if (pDoc->mModeTool == ID_TOOLS_TEMPLATE)
344- pBrushBox = Brush_GetBoundingBox (pDoc->CurBrush);
344+ pBrushBox = Brush_GetBoundingBox (App->CLSB_Doc->CurBrush);
345345 // else
346346 // {
347347 // SelBrushList_GetBoundingBox(pDoc->pSelBrushes, &BrushBox);
@@ -772,7 +772,7 @@
772772 }// LButtonDown
773773 if (RButtonIsDown)
774774 {
775- if( pDoc->GetSelState() == ONEENTITYONLY ) // Angle,Arc,Radius control
775+ if(App->CLSB_Doc->GetSelState() == ONEENTITYONLY ) // Angle,Arc,Radius control
776776 {
777777 // if( !ShiftHeld && !ControlHeld )
778778 if( !ShiftHeld )
@@ -919,7 +919,7 @@
919919
920920 pDoc->SetModifiedFlag();
921921
922- if (SelBrushList_GetSize (pDoc->pSelBrushes) > 0 || ModeTool == ID_TOOLS_TEMPLATE)
922+ if (SelBrushList_GetSize (App->CLSB_Doc->pSelBrushes) > 0 || ModeTool == ID_TOOLS_TEMPLATE)
923923 {
924924 geFloat fSnapSize ;
925925 const geVec3d *vMin, *vMax;
@@ -933,7 +933,7 @@
933933 fSnapSize = Level_GetGridSnapSize (App->CLSB_Doc->pLevel);
934934 }
935935 // do the snap thing...
936- pBox = Brush_GetBoundingBox (pDoc->CurBrush);
936+ pBox = Brush_GetBoundingBox (App->CLSB_Doc->CurBrush);
937937 vMin = Box3d_GetMin (pBox);
938938 vMax = Box3d_GetMax (pBox);
939939 geVec3d_Clear (&SnapDelta);
@@ -977,7 +977,7 @@
977977 App->CLSB_Doc->UpdateSelected();
978978
979979 if ((ModeTool == ID_TOOLS_TEMPLATE) ||
980- ((pDoc->GetSelState() & ANYENTITY) && (!(pDoc->GetSelState() & ANYBRUSH))) )
980+ ((App->CLSB_Doc->GetSelState() & ANYENTITY) && (!(App->CLSB_Doc->GetSelState() & ANYBRUSH))) )
981981 {
982982 App->CLSB_Doc->UpdateAllViews( UAV_ALL3DVIEWS, NULL );
983983 }
@@ -1060,7 +1060,7 @@
10601060 move and pan at the same time. Of course, I'd like to get rid of the whole
10611061 temp selected thing, too, but that'll have to wait...
10621062 */
1063- pDoc->TempDeleteSelected();
1063+ App->CLSB_Doc->TempDeleteSelected();
10641064
10651065 IsPanning = FALSE;
10661066 ShowTheCursor ();
@@ -1080,7 +1080,7 @@
10801080
10811081 if (mViewIs3d)
10821082 {
1083- if(ModeTool==ID_TOOLS_TEMPLATE && pDoc->TempEnt)
1083+ if(ModeTool==ID_TOOLS_TEMPLATE && App->CLSB_Doc->TempEnt)
10841084 {
10851085 pDoc->PlaceTemplateEntity3D(point, VCam);
10861086 pDoc->SetModifiedFlag();
@@ -1162,7 +1162,7 @@
11621162
11631163 App->CLSB_Doc->UpdateSelected();
11641164 if((ModeTool == ID_TOOLS_TEMPLATE) ||
1165- ((pDoc->GetSelState() & ANYENTITY) && (!(pDoc->GetSelState() & ANYBRUSH))) )
1165+ ((App->CLSB_Doc->GetSelState() & ANYENTITY) && (!(App->CLSB_Doc->GetSelState() & ANYBRUSH))) )
11661166 {
11671167 App->CLSB_Doc->UpdateAllViews( UAV_ALL3DVIEWS, NULL );
11681168 }
@@ -1176,11 +1176,11 @@
11761176 pDoc->SetModifiedFlag();
11771177 SetCursor(AfxGetApp()->LoadStandardCursor(IDC_ARROW));
11781178 if(App->CLSB_Doc->mLastOp==BRUSH_SHEAR)
1179- pDoc->DoneShear(sides, Render_GetInidx(VCam));
1179+ App->CLSB_Doc->DoneShear(sides, Render_GetInidx(VCam));
11801180
11811181 App->CLSB_Doc->UpdateSelected();
11821182 if((ModeTool == ID_TOOLS_TEMPLATE) ||
1183- ((pDoc->GetSelState() & ANYENTITY) && (!(pDoc->GetSelState() & ANYBRUSH))) )
1183+ ((App->CLSB_Doc->GetSelState() & ANYENTITY) && (!(App->CLSB_Doc->GetSelState() & ANYBRUSH))) )
11841184 {
11851185 App->CLSB_Doc->UpdateAllViews( UAV_ALL3DVIEWS, NULL );
11861186 }
@@ -1311,7 +1311,7 @@
13111311 geVec3d_Clear (&App->CLSB_Doc->FinalScale);
13121312 if (ModeTool == ID_TOOLS_TEMPLATE)
13131313 {
1314- pDoc->TempShearTemplate =Brush_Clone(pDoc->CurBrush);
1314+ App->CLSB_Doc->TempShearTemplate =Brush_Clone(App->CLSB_Doc->CurBrush);
13151315 }
13161316 else
13171317 {
@@ -1420,7 +1420,7 @@
14201420 // if((IsKeyDown (VK_SPACE)) || IsPanning || GetModeTool()==ID_TOOLS_CAMERA)
14211421 if((IsKeyDown (VK_CONTROL)) || IsPanning || GetModeTool()==ID_TOOLS_CAMERA)
14221422 {
1423- pDoc->TempDeleteSelected();
1423+ App->CLSB_Doc->TempDeleteSelected();
14241424 IsPanning =FALSE;
14251425
14261426 ShowTheCursor ();
@@ -1460,7 +1460,7 @@
14601460 }
14611461 }
14621462
1463- if (SelBrushList_GetSize (pDoc->pSelBrushes) != 0)
1463+ if (SelBrushList_GetSize (App->CLSB_Doc->pSelBrushes) != 0)
14641464 App->CLSB_Doc->UpdateAllViews(UAV_ALL3DVIEWS | REBUILD_QUICK, NULL);
14651465 else
14661466 App->CLSB_Doc->UpdateAllViews(UAV_ALL3DVIEWS, NULL);
@@ -1627,11 +1627,8 @@
16271627
16281628 void CFusionView::OnToolsCamera()
16291629 {
1630- CFusionDoc* pDoc = GetDocument();
1631-
16321630 SetModeTool(ID_TOOLS_CAMERA);
1633-
1634- pDoc->ConfigureCurrentTool();
1631+ App->CLSB_Doc->ConfigureCurrentTool();
16351632 }
16361633
16371634 void CFusionView::OnUpdateToolsCamera(CCmdUI* pCmdUI)
@@ -1645,17 +1642,13 @@
16451642
16461643 void CFusionView::OnAxisX()
16471644 {
1648- CFusionDoc* pDoc = GetDocument();
1649-
1650- pDoc->SetLockAxis( pDoc->GetLockAxis() ^ AXIS_X ) ;
1645+ App->CLSB_Doc->SetLockAxis(App->CLSB_Doc->GetLockAxis() ^ AXIS_X ) ;
16511646 }
16521647
16531648
16541649 void CFusionView::OnUpdateAxisX(CCmdUI* pCmdUI)
16551650 {
1656- CFusionDoc* pDoc = GetDocument();
1657-
1658- if( pDoc->GetLockAxis() & AXIS_X )
1651+ if(App->CLSB_Doc->GetLockAxis() & AXIS_X )
16591652 pCmdUI->SetCheck();
16601653 else
16611654 pCmdUI->SetCheck(0);
@@ -1664,17 +1657,13 @@
16641657
16651658 void CFusionView::OnAxisY()
16661659 {
1667- CFusionDoc* pDoc = GetDocument();
1668-
1669- pDoc->SetLockAxis( pDoc->GetLockAxis() ^ AXIS_Y ) ;
1660+ App->CLSB_Doc->SetLockAxis(App->CLSB_Doc->GetLockAxis() ^ AXIS_Y ) ;
16701661 }
16711662
16721663
16731664 void CFusionView::OnUpdateAxisY(CCmdUI* pCmdUI)
16741665 {
1675- CFusionDoc* pDoc = GetDocument();
1676-
1677- if( pDoc->GetLockAxis() & AXIS_Y )
1666+ if(App->CLSB_Doc->GetLockAxis() & AXIS_Y )
16781667 pCmdUI->SetCheck();
16791668 else
16801669 pCmdUI->SetCheck(0);
@@ -1683,17 +1672,13 @@
16831672
16841673 void CFusionView::OnAxisZ()
16851674 {
1686- CFusionDoc* pDoc = GetDocument();
1687-
1688- pDoc->SetLockAxis( pDoc->GetLockAxis() ^ AXIS_Z ) ;
1675+ App->CLSB_Doc->SetLockAxis(App->CLSB_Doc->GetLockAxis() ^ AXIS_Z ) ;
16891676 }
16901677
16911678
16921679 void CFusionView::OnUpdateAxisZ(CCmdUI* pCmdUI)
16931680 {
1694- CFusionDoc* pDoc = GetDocument();
1695-
1696- if( pDoc->GetLockAxis() & AXIS_Z )
1681+ if(App->CLSB_Doc->GetLockAxis() & AXIS_Z )
16971682 pCmdUI->SetCheck();
16981683 else
16991684 pCmdUI->SetCheck(0);
@@ -1721,14 +1706,12 @@
17211706
17221707 void CFusionView::OnToolsBrushMoverotatebrush()
17231708 {
1724- CFusionDoc* pDoc = GetDocument();
1725-
17261709 int mode=GetModeTool();
17271710
17281711 if(mode==ID_TOOLS_TEMPLATE)
17291712 {
17301713 SetTool( ID_TOOLS_BRUSH_MOVEROTATEBRUSH );
1731- pDoc->ConfigureCurrentTool();
1714+ App->CLSB_Doc->ConfigureCurrentTool();
17321715 }
17331716 else
17341717 {
@@ -1742,19 +1725,17 @@
17421725 {
17431726 SetTool(ID_TOOLS_BRUSH_MOVEROTATEBRUSH);
17441727 }
1745- pDoc->ConfigureCurrentTool();
1728+ App->CLSB_Doc->ConfigureCurrentTool();
17461729 }
17471730 }
17481731
17491732 void CFusionView::OnUpdateToolsBrushMoverotatebrush(CCmdUI* pCmdUI)
17501733 {
1751- CFusionDoc* pDoc = GetDocument();
1752-
17531734 //that's a pretty big if
17541735 if(GetModeTool()==ID_TOOLS_TEMPLATE ||
17551736 (GetModeTool()==ID_GENERALSELECT &&
17561737 // GetAdjustMode()==ADJUST_MODE_BRUSH &&
1757- pDoc->GetSelState()!=NOSELECTIONS))
1738+App->CLSB_Doc->GetSelState()!=NOSELECTIONS))
17581739 {
17591740 pCmdUI->Enable();
17601741 if(GetTool()==ID_TOOLS_BRUSH_MOVEROTATEBRUSH)
@@ -1776,14 +1757,13 @@
17761757
17771758 void CFusionView::OnToolsBrushScalebrush()
17781759 {
1779- CFusionDoc* pDoc = GetDocument();
1780-
1760+
17811761 int mode=GetModeTool();
17821762
17831763 if(mode==ID_TOOLS_TEMPLATE)
17841764 {
17851765 SetTool(ID_TOOLS_BRUSH_SCALEBRUSH);
1786- pDoc->ConfigureCurrentTool();
1766+ App->CLSB_Doc->ConfigureCurrentTool();
17871767 }
17881768 else
17891769 {
@@ -1797,21 +1777,19 @@
17971777 {
17981778 SetTool(ID_TOOLS_BRUSH_SCALEBRUSH);
17991779 }
1800- pDoc->ConfigureCurrentTool();
1780+ App->CLSB_Doc->ConfigureCurrentTool();
18011781 }
18021782 }
18031783
18041784 void CFusionView::OnUpdateToolsBrushScalebrush(CCmdUI* pCmdUI)
18051785 {
1806- CFusionDoc* pDoc = GetDocument();
1807-
18081786 //that's a very big if
1809- if((GetModeTool()==ID_TOOLS_TEMPLATE && !pDoc->TempEnt) ||
1787+ if((GetModeTool()==ID_TOOLS_TEMPLATE && !App->CLSB_Doc->TempEnt) ||
18101788 (GetModeTool()==ID_GENERALSELECT &&
18111789 // GetAdjustMode ()==ADJUST_MODE_BRUSH &&
18121790 #pragma message ("Can't do multiple brush scaling due to Brush_Resize implementation.")
18131791 // SelBrushList_GetSize (pDoc->pSelBrushes) > 0))
1814- SelBrushList_GetSize (pDoc->pSelBrushes) == 1))
1792+ SelBrushList_GetSize (App->CLSB_Doc->pSelBrushes) == 1))
18151793 {
18161794 pCmdUI->Enable();
18171795 if(GetTool()==ID_TOOLS_BRUSH_SCALEBRUSH)
@@ -1983,14 +1961,12 @@
19831961
19841962 void CFusionView::OnToolsBrushShearbrush()
19851963 {
1986- CFusionDoc* pDoc = GetDocument();
1987-
19881964 int mode=GetModeTool();
19891965
19901966 if(mode==ID_TOOLS_TEMPLATE)
19911967 {
19921968 SetTool( ID_TOOLS_BRUSH_SHEARBRUSH);
1993- pDoc->ConfigureCurrentTool();
1969+ App->CLSB_Doc->ConfigureCurrentTool();
19941970 }
19951971 else
19961972 {
@@ -2004,7 +1980,7 @@
20041980 {
20051981 SetTool(ID_TOOLS_BRUSH_SHEARBRUSH);
20061982 }
2007- pDoc->ConfigureCurrentTool();
1983+ App->CLSB_Doc->ConfigureCurrentTool();
20081984 }
20091985 }
20101986
@@ -2011,14 +1987,12 @@
20111987
20121988 void CFusionView::OnUpdateToolsBrushShearbrush(CCmdUI* pCmdUI)
20131989 {
2014- CFusionDoc* pDoc = GetDocument();
2015-
20161990 //that's a very big if
2017- if((GetModeTool()==ID_TOOLS_TEMPLATE && !pDoc->TempEnt) ||
1991+ if((GetModeTool()==ID_TOOLS_TEMPLATE && !App->CLSB_Doc->TempEnt) ||
20181992 (GetModeTool()==ID_GENERALSELECT &&
20191993 // GetAdjustMode()==ADJUST_MODE_BRUSH &&
20201994 #pragma message ("Can't do multiple brush shear due to Brush_Shear implementation.")
2021- SelBrushList_GetSize (pDoc->pSelBrushes) == 1))
1995+ SelBrushList_GetSize (App->CLSB_Doc->pSelBrushes) == 1))
20221996 // SelBrushList_GetSize (pDoc->pSelBrushes) > 0))
20231997 {
20241998 pCmdUI->Enable();
@@ -2045,9 +2019,7 @@
20452019
20462020 fdocAdjustEnum CFusionView::GetAdjustMode(void)
20472021 {
2048- CFusionDoc* pDoc = GetDocument();
2049-
2050- return pDoc->mAdjustMode;
2022+ return App->CLSB_Doc->mAdjustMode;
20512023 }
20522024
20532025 int CFusionView::GetModeTool(void)
@@ -2062,10 +2034,8 @@
20622034
20632035 void CFusionView::SetAdjustMode(fdocAdjustEnum Mode)
20642036 {
2065- CFusionDoc* pDoc = GetDocument();
2066-
20672037 // pDoc->mAdjustMode = Mode;
2068- pDoc->mAdjustMode = ADJUST_MODE_FACE;
2038+ App->CLSB_Doc->mAdjustMode = ADJUST_MODE_FACE;
20692039 }
20702040
20712041 void CFusionView::SetModeTool(int Tool)
@@ -2092,9 +2062,7 @@
20922062
20932063 void CFusionView::OnUpdateBrushGroupsAddtogroup(CCmdUI* pCmdUI)
20942064 {
2095- CFusionDoc* pDoc = GetDocument();
2096-
2097- pCmdUI->Enable (!(pDoc->GetSelState() == NOSELECTIONS));
2065+ pCmdUI->Enable (!(App->CLSB_Doc->GetSelState() == NOSELECTIONS));
20982066 }
20992067
21002068 void CFusionView::OnBrushRemoveselectedfromgroup()
@@ -2110,9 +2078,7 @@
21102078
21112079 void CFusionView::OnUpdateBrushRemoveselectedfromgroup(CCmdUI* pCmdUI)
21122080 {
2113- CFusionDoc* pDoc = GetDocument();
2114-
2115- if( (App->CLSB_Doc->mCurrentGroup == 0) || (pDoc->GetSelState() == NOSELECTIONS) )
2081+ if( (App->CLSB_Doc->mCurrentGroup == 0) || (App->CLSB_Doc->GetSelState() == NOSELECTIONS) )
21162082 pCmdUI->Enable( FALSE ) ;
21172083 else
21182084 pCmdUI->Enable( TRUE ) ;
@@ -2121,10 +2087,7 @@
21212087 void CFusionView::OnToolsBrushMoveselectedbrushes()
21222088 {
21232089 SetTool(ID_TOOLS_BRUSH_MOVESELECTEDBRUSHES);
2124-
2125- CFusionDoc* pDoc = GetDocument();
2126-
2127- pDoc->ConfigureCurrentTool();
2090+ App->CLSB_Doc->ConfigureCurrentTool();
21282091 }
21292092
21302093 void CFusionView::OnUpdateToolsBrushMoveselectedbrushes(CCmdUI* pCmdUI)
@@ -2155,13 +2118,11 @@
21552118
21562119 void CFusionView::OnUpdateToolsBrushRotate45(CCmdUI* pCmdUI)
21572120 {
2158- CFusionDoc* pDoc = GetDocument();
2159-
21602121 //that's a pretty big if
2161- if((GetModeTool()==ID_TOOLS_TEMPLATE && !pDoc->TempEnt) ||
2122+ if((GetModeTool()==ID_TOOLS_TEMPLATE && !App->CLSB_Doc->TempEnt) ||
21622123 (GetModeTool()==ID_GENERALSELECT &&
21632124 // GetAdjustMode()==ADJUST_MODE_BRUSH &&
2164- pDoc->GetSelState()!=NOSELECTIONS))
2125+App->CLSB_Doc->GetSelState()!=NOSELECTIONS))
21652126 {
21662127 pCmdUI->Enable();
21672128 }
@@ -2240,9 +2201,8 @@
22402201 void CFusionView::OnUpdateDeselectall(CCmdUI* pCmdUI)
22412202 {
22422203 BOOL bEnable ;
2243- CFusionDoc* pDoc = GetDocument();
2244-
2245- bEnable = ( pDoc->GetSelState() == NOSELECTIONS ) ? FALSE : TRUE ;
2204+
2205+ bEnable = (App->CLSB_Doc->GetSelState() == NOSELECTIONS ) ? FALSE : TRUE ;
22462206 pCmdUI->Enable( bEnable ) ;
22472207 }
22482208
@@ -2346,16 +2306,15 @@
23462306 void CFusionView::OnToolsNextbrush()
23472307 {
23482308
2349- CFusionDoc *pDoc = GetDocument ();
23502309 BrushList *BList = Level_GetBrushes (App->CLSB_Doc->pLevel);
23512310
2352- if(GetModeTool()==ID_GENERALSELECT && !pDoc->IsSelectionLocked())
2311+ if(GetModeTool()==ID_GENERALSELECT && !App->CLSB_Doc->IsSelectionLocked())
23532312 {
2354- if(pDoc->GetSelState()&ONEBRUSH)
2313+ if(App->CLSB_Doc->GetSelState()&ONEBRUSH)
23552314 {
23562315 if (!(IsKeyDown(VK_SHIFT)))
2357- SelBrushList_RemoveAll (pDoc->pSelBrushes);
2358- SelBrushList_Add (pDoc->pSelBrushes, Brush_GetNextBrush(pDoc->CurBrush, BList));
2316+ SelBrushList_RemoveAll (App->CLSB_Doc->pSelBrushes);
2317+ SelBrushList_Add (App->CLSB_Doc->pSelBrushes, Brush_GetNextBrush(App->CLSB_Doc->CurBrush, BList));
23592318 App->CLSB_Doc->UpdateSelected();
23602319
23612320 //update the brush attributes dialog...
@@ -2362,7 +2321,7 @@
23622321 // pDoc->UpdateBrushAttributesDlg ();
23632322 App->CLSB_Doc->UpdateAllViews(UAV_ALL3DVIEWS, NULL);
23642323 }
2365- else if(!(pDoc->GetSelState() & ANYBRUSH))
2324+ else if(!(App->CLSB_Doc->GetSelState() & ANYBRUSH))
23662325 {
23672326 Brush *pBrush;
23682327 BrushIterator bi;
@@ -2370,7 +2329,7 @@
23702329 pBrush = BrushList_GetFirst (BList, &bi);
23712330 if(pBrush != NULL)
23722331 {
2373- SelBrushList_Add (pDoc->pSelBrushes, pBrush);
2332+ SelBrushList_Add (App->CLSB_Doc->pSelBrushes, pBrush);
23742333 App->CLSB_Doc->UpdateSelected();
23752334 App->CLSB_Doc->UpdateAllViews(UAV_ALL3DVIEWS, NULL);
23762335 }
@@ -2380,16 +2339,15 @@
23802339
23812340 void CFusionView::OnToolsPrevbrush()
23822341 {
2383- CFusionDoc *pDoc = GetDocument ();
23842342 BrushList *BList = Level_GetBrushes (App->CLSB_Doc->pLevel);
23852343
2386- if(GetModeTool()==ID_GENERALSELECT && !pDoc->IsSelectionLocked())
2344+ if(GetModeTool()==ID_GENERALSELECT && !App->CLSB_Doc->IsSelectionLocked())
23872345 {
2388- if(pDoc->GetSelState()&ONEBRUSH)
2346+ if(App->CLSB_Doc->GetSelState()&ONEBRUSH)
23892347 {
23902348 if (!(IsKeyDown(VK_SHIFT)))
2391- SelBrushList_RemoveAll (pDoc->pSelBrushes);
2392- SelBrushList_Add (pDoc->pSelBrushes, Brush_GetPrevBrush(pDoc->CurBrush, BList));
2349+ SelBrushList_RemoveAll (App->CLSB_Doc->pSelBrushes);
2350+ SelBrushList_Add (App->CLSB_Doc->pSelBrushes, Brush_GetPrevBrush(App->CLSB_Doc->CurBrush, BList));
23932351 App->CLSB_Doc->UpdateSelected();
23942352
23952353 //update the brush attributes dialog...
@@ -2396,7 +2354,7 @@
23962354 // pDoc->UpdateBrushAttributesDlg ();
23972355 App->CLSB_Doc->UpdateAllViews(UAV_ALL3DVIEWS, NULL);
23982356 }
2399- else if(!(pDoc->GetSelState() & ANYBRUSH))
2357+ else if(!(App->CLSB_Doc->GetSelState() & ANYBRUSH))
24002358 {
24012359 Brush *pBrush;
24022360 BrushIterator bi;
@@ -2404,7 +2362,7 @@
24042362 pBrush = BrushList_GetLast(BList, &bi);
24052363 if (pBrush != NULL)
24062364 {
2407- SelBrushList_Add (pDoc->pSelBrushes, pBrush);
2365+ SelBrushList_Add (App->CLSB_Doc->pSelBrushes, pBrush);
24082366 App->CLSB_Doc->UpdateSelected();
24092367 App->CLSB_Doc->UpdateAllViews(UAV_ALL3DVIEWS, NULL);
24102368 }
@@ -2522,12 +2480,11 @@
25222480
25232481 void CFusionView::OnEditSelectFacesNext()
25242482 {
2525- CFusionDoc *pDoc = GetDocument ();
25262483 BrushList *BList = Level_GetBrushes (App->CLSB_Doc->pLevel);
25272484
2528- if(GetModeTool()==ID_GENERALSELECT && !pDoc->IsSelectionLocked())
2485+ if(GetModeTool()==ID_GENERALSELECT && !App->CLSB_Doc->IsSelectionLocked())
25292486 {
2530- int nSelectedFaces = SelFaceList_GetSize (pDoc->pSelFaces);
2487+ int nSelectedFaces = SelFaceList_GetSize (App->CLSB_Doc->pSelFaces);
25312488 Face *pFace;
25322489
25332490 if (nSelectedFaces == 0)
@@ -2534,9 +2491,9 @@
25342491 {
25352492 BrushIterator bi;
25362493
2537- pDoc->CurBrush = BrushList_GetFirst (BList, &bi);
2538- pFace = Brush_SelectFirstFace (pDoc->CurBrush);
2539- SelBrushList_Add (pDoc->pSelBrushes, pDoc->CurBrush);
2494+ App->CLSB_Doc->CurBrush = BrushList_GetFirst (BList, &bi);
2495+ pFace = Brush_SelectFirstFace (App->CLSB_Doc->CurBrush);
2496+ SelBrushList_Add (App->CLSB_Doc->pSelBrushes, App->CLSB_Doc->CurBrush);
25402497 }
25412498 else
25422499 {
@@ -2543,7 +2500,7 @@
25432500 Brush *pBrush;
25442501
25452502 // get first selected face
2546- pFace = SelFaceList_GetFace (pDoc->pSelFaces, nSelectedFaces-1);
2503+ pFace = SelFaceList_GetFace (App->CLSB_Doc->pSelFaces, nSelectedFaces-1);
25472504 // Remove all face selections
25482505 if (!(IsKeyDown(VK_SHIFT)))
25492506 {
@@ -2564,7 +2521,7 @@
25642521 }
25652522 }
25662523
2567- SelFaceList_Add (pDoc->pSelFaces, pFace);
2524+ SelFaceList_Add (App->CLSB_Doc->pSelFaces, pFace);
25682525 App->CLSB_Doc->UpdateSelected ();
25692526
25702527 //pDoc->UpdateFaceAttributesDlg ();
@@ -2574,12 +2531,11 @@
25742531
25752532 void CFusionView::OnEditSelectFacesPrevious()
25762533 {
2577- CFusionDoc *pDoc = GetDocument ();
25782534 BrushList *BList = Level_GetBrushes (App->CLSB_Doc->pLevel);
25792535
2580- if(GetModeTool()==ID_GENERALSELECT && !pDoc->IsSelectionLocked())
2536+ if(GetModeTool()==ID_GENERALSELECT && !App->CLSB_Doc->IsSelectionLocked())
25812537 {
2582- int nSelectedFaces = SelFaceList_GetSize (pDoc->pSelFaces);
2538+ int nSelectedFaces = SelFaceList_GetSize (App->CLSB_Doc->pSelFaces);
25832539 Face *pFace;
25842540
25852541 if (nSelectedFaces == 0)
@@ -2586,9 +2542,9 @@
25862542 {
25872543 BrushIterator bi;
25882544
2589- pDoc->CurBrush = BrushList_GetFirst (BList, &bi);
2590- pFace = Brush_SelectFirstFace (pDoc->CurBrush);
2591- SelBrushList_Add (pDoc->pSelBrushes, pDoc->CurBrush);
2545+ App->CLSB_Doc->CurBrush = BrushList_GetFirst (BList, &bi);
2546+ pFace = Brush_SelectFirstFace (App->CLSB_Doc->CurBrush);
2547+ SelBrushList_Add (App->CLSB_Doc->pSelBrushes, App->CLSB_Doc->CurBrush);
25922548 }
25932549 else
25942550 {
@@ -2595,7 +2551,7 @@
25952551 Brush *pBrush;
25962552
25972553 // get the last selected face
2598- pFace = SelFaceList_GetFace (pDoc->pSelFaces, 0);
2554+ pFace = SelFaceList_GetFace (App->CLSB_Doc->pSelFaces, 0);
25992555
26002556 // Remove all face selections
26012557 if (!(IsKeyDown(VK_SHIFT)))
@@ -2618,7 +2574,7 @@
26182574 }
26192575 }
26202576
2621- SelFaceList_Add (pDoc->pSelFaces, pFace);
2577+ SelFaceList_Add (App->CLSB_Doc->pSelFaces, pFace);
26222578 App->CLSB_Doc->UpdateSelected ();
26232579
26242580 //pDoc->UpdateFaceAttributesDlg ();
@@ -2652,7 +2608,7 @@
26522608 {
26532609 CFusionDoc* pDoc = GetDocument();
26542610
2655- if(GetModeTool()==ID_GENERALSELECT && !pDoc->IsSelectionLocked())
2611+ if(GetModeTool()==ID_GENERALSELECT && !App->CLSB_Doc->IsSelectionLocked())
26562612 {
26572613
26582614 CEntityArray *Entities;
@@ -2720,7 +2676,7 @@
27202676 {
27212677 CFusionDoc* pDoc = GetDocument();
27222678
2723- if(GetModeTool()==ID_GENERALSELECT && !pDoc->IsSelectionLocked())
2679+ if(GetModeTool()==ID_GENERALSELECT && !App->CLSB_Doc->IsSelectionLocked())
27242680 {
27252681
27262682 CEntityArray *Entities;
@@ -2814,9 +2770,7 @@
28142770 void CFusionView::OnUpdateEditDeselectBrushes(CCmdUI* pCmdUI)
28152771 {
28162772 BOOL bEnable ;
2817- CFusionDoc* pDoc = GetDocument();
2818-
2819- bEnable = ( pDoc->GetSelState() & ANYBRUSH ) ? TRUE : FALSE ;
2773+ bEnable = (App->CLSB_Doc->GetSelState() & ANYBRUSH ) ? TRUE : FALSE ;
28202774 pCmdUI->Enable( bEnable ) ;
28212775 }
28222776
@@ -2823,9 +2777,7 @@
28232777 void CFusionView::OnUpdateEditDeselectEntities(CCmdUI* pCmdUI)
28242778 {
28252779 BOOL bEnable ;
2826- CFusionDoc* pDoc = GetDocument();
2827-
2828- bEnable = ( pDoc->GetSelState() & ANYENTITY ) ? TRUE : FALSE ;
2780+ bEnable = (App->CLSB_Doc->GetSelState() & ANYENTITY ) ? TRUE : FALSE ;
28292781 pCmdUI->Enable( bEnable ) ;
28302782 }
28312783
@@ -2832,9 +2784,7 @@
28322784 void CFusionView::OnUpdateEditDeselectFaces(CCmdUI* pCmdUI)
28332785 {
28342786 BOOL bEnable ;
2835- CFusionDoc* pDoc = GetDocument();
2836-
2837- bEnable = ( pDoc->GetSelState() & ANYFACE ) ? TRUE : FALSE ;
2787+ bEnable = (App->CLSB_Doc->GetSelState() & ANYFACE ) ? TRUE : FALSE ;
28382788 pCmdUI->Enable( bEnable ) ;
28392789 }
28402790
@@ -2964,7 +2914,7 @@
29642914 {
29652915 CFusionDoc *pDoc = GetDocument ();
29662916 if (pDoc) {
2967- if ((pDoc->GetSelState()!=NOSELECTIONS) || (App->CLSB_Doc->mModeTool == ID_TOOLS_TEMPLATE))
2917+ if ((App->CLSB_Doc->GetSelState()!=NOSELECTIONS) || (App->CLSB_Doc->mModeTool == ID_TOOLS_TEMPLATE))
29682918 pCmdUI->Enable( TRUE );
29692919 else
29702920 pCmdUI->Enable( FALSE );
@@ -3166,7 +3116,7 @@
31663116 return;
31673117 }
31683118
3169- if ((pDoc->GetSelState()!=NOSELECTIONS) || ((App->CLSB_Doc->mModeTool==ID_TOOLS_TEMPLATE) && !pDoc->PlaceObjectFlag))
3119+ if ((App->CLSB_Doc->GetSelState()!=NOSELECTIONS) || ((App->CLSB_Doc->mModeTool==ID_TOOLS_TEMPLATE) && !App->CLSB_Doc->PlaceObjectFlag))
31703120 pCmdUI->Enable( TRUE );
31713121 else
31723122 pCmdUI->Enable( FALSE );
--- WorldEditor/WorldEditor/F_View.cpp (revision 2542)
+++ WorldEditor/WorldEditor/F_View.cpp (revision 2543)
@@ -615,7 +615,7 @@
615615 brushDrawData.FlagTest = NULL;
616616 {
617617 CEntityArray *Entities = Level_GetEntities (App->CLSB_Doc->pLevel);
618- int NumSelBrushes = SelBrushList_GetSize (m_pDoc->pSelBrushes);
618+ int NumSelBrushes = SelBrushList_GetSize (App->CLSB_Doc->pSelBrushes);
619619
620620 // render selected brushes and entities
621621 SelectObject(MemoryhDC,PenSelected2);
@@ -624,7 +624,7 @@
624624 {
625625 Brush *pBrush;
626626
627- pBrush = SelBrushList_GetBrush (m_pDoc->pSelBrushes, i);
627+ pBrush = SelBrushList_GetBrush (App->CLSB_Doc->pSelBrushes, i);
628628 if (m_pDoc->fdocShowBrush (pBrush, &ViewBox))
629629 {
630630 if(Brush_IsMulti (pBrush))
@@ -669,19 +669,19 @@
669669 SelectObject(MemoryhDC, PenTemplate2);
670670
671671 if((App->CLSB_Doc->mModeTool==ID_TOOLS_TEMPLATE)||
672- (App->CLSB_Doc->mModeTool==ID_TOOLS_CAMERA && m_pDoc->GetSelState()==NOSELECTIONS))
672+ (App->CLSB_Doc->mModeTool==ID_TOOLS_CAMERA && App->CLSB_Doc->GetSelState()==NOSELECTIONS))
673673 {
674- if(!m_pDoc->TempEnt)
674+ if(!App->CLSB_Doc->TempEnt)
675675 {
676- if (Brush_TestBoundsIntersect(m_pDoc->CurBrush, &ViewBox))
676+ if (Brush_TestBoundsIntersect(App->CLSB_Doc->CurBrush, &ViewBox))
677677 {
678- if(Brush_IsMulti(m_pDoc->CurBrush))
678+ if(Brush_IsMulti(App->CLSB_Doc->CurBrush))
679679 {
680- BrushList_EnumLeafBrushes(App->CL_Brush->Brush_GetBrushList(m_pDoc->CurBrush), &brushDrawData, BrushDraw2);
680+ BrushList_EnumLeafBrushes(App->CL_Brush->Brush_GetBrushList(App->CLSB_Doc->CurBrush), &brushDrawData, BrushDraw2);
681681 }
682682 else
683683 {
684- Render_RenderBrushFacesOrtho(v, m_pDoc->CurBrush, MemoryhDC);
684+ Render_RenderBrushFacesOrtho(v, App->CLSB_Doc->CurBrush, MemoryhDC);
685685 }
686686 }
687687 }
--- WorldEditor/WorldEditor/FaceAttributesDialog.cpp (revision 2542)
+++ WorldEditor/WorldEditor/FaceAttributesDialog.cpp (revision 2543)
@@ -284,7 +284,7 @@
284284 if (pDoc)
285285 {
286286 pDoc->SetModifiedFlag();
287- SelFaceList_Enum (pDoc->pSelFaces, ::AssignFaceValues, this);
287+ SelFaceList_Enum (App->CLSB_Doc->pSelFaces, ::AssignFaceValues, this);
288288 }
289289
290290 AssignCurrentToViews();
@@ -447,10 +447,10 @@
447447 // update child faces on all selected brushes
448448 int NumSelBrushes;
449449
450- NumSelBrushes = SelBrushList_GetSize (pDoc->pSelBrushes);
450+ NumSelBrushes = SelBrushList_GetSize (App->CLSB_Doc->pSelBrushes);
451451 for (int i = 0; i < NumSelBrushes; ++i)
452452 {
453- Brush *pBrush = SelBrushList_GetBrush (pDoc->pSelBrushes, i);
453+ Brush *pBrush = SelBrushList_GetBrush (App->CLSB_Doc->pSelBrushes, i);
454454 Brush_UpdateChildFaces (pBrush);
455455 }
456456 App->CLSB_Doc->UpdateAllViews(UAV_RENDER_ONLY, NULL);
@@ -499,10 +499,10 @@
499499 CFusionDoc *pDoc = m_pMainFrame->GetCurrentDoc();
500500 if (pDoc)
501501 {
502- NumberOfFaces = SelFaceList_GetSize (pDoc->pSelFaces);
502+ NumberOfFaces = SelFaceList_GetSize (App->CLSB_Doc->pSelFaces);
503503 // pFace = SelFaceList_GetFace (pDoc->pSelFaces, 0);
504504 if (NumberOfFaces)
505- pFace = SelFaceList_GetFace (pDoc->pSelFaces, (NumberOfFaces-1));
505+ pFace = SelFaceList_GetFace (App->CLSB_Doc->pSelFaces, (NumberOfFaces-1));
506506 else
507507 pFace = NULL;
508508 }
@@ -722,7 +722,7 @@
722722 pDoc->SetModifiedFlag();
723723 UpdateData (TRUE);
724724 OnIntKillFocus (m_EditXOffset, &m_TextureXOffset, 0, "0");
725- SelFaceList_Enum (pDoc->pSelFaces, ChangeXOffset, &m_TextureXOffset);
725+ SelFaceList_Enum (App->CLSB_Doc->pSelFaces, ChangeXOffset, &m_TextureXOffset);
726726 AssignCurrentToViews ();
727727 }
728728 }
@@ -748,7 +748,7 @@
748748 pDoc->SetModifiedFlag();
749749 UpdateData (TRUE);
750750 OnIntKillFocus (m_EditYOffset, &m_TextureYOffset, 0, "0");
751- SelFaceList_Enum (pDoc->pSelFaces, ChangeYOffset, &m_TextureYOffset);
751+ SelFaceList_Enum (App->CLSB_Doc->pSelFaces, ChangeYOffset, &m_TextureYOffset);
752752 AssignCurrentToViews ();
753753 }
754754 }
@@ -774,7 +774,7 @@
774774 pDoc->SetModifiedFlag();
775775 UpdateData (TRUE);
776776 OnFloatKillFocus (m_EditXScale, &m_TextureXScale, 1.0f, "1.0");
777- SelFaceList_Enum (pDoc->pSelFaces, ChangeTextureXScale, &m_TextureXScale);
777+ SelFaceList_Enum (App->CLSB_Doc->pSelFaces, ChangeTextureXScale, &m_TextureXScale);
778778 AssignCurrentToViews ();
779779 }
780780 }
@@ -800,7 +800,7 @@
800800 pDoc->SetModifiedFlag();
801801 UpdateData (TRUE);
802802 OnFloatKillFocus (m_EditYScale, &m_TextureYScale, 1.0f, "1.0");
803- SelFaceList_Enum (pDoc->pSelFaces, ChangeTextureYScale, &m_TextureYScale);
803+ SelFaceList_Enum (App->CLSB_Doc->pSelFaces, ChangeTextureYScale, &m_TextureYScale);
804804 AssignCurrentToViews ();
805805 }
806806 }
@@ -826,7 +826,7 @@
826826 pDoc->SetModifiedFlag();
827827 UpdateData (TRUE);
828828 OnFloatKillFocus (m_EditLightXScale, &m_LightXScale, 1.0f, "1.0");
829- SelFaceList_Enum (pDoc->pSelFaces, ChangeLightXScale, &m_LightXScale);
829+ SelFaceList_Enum (App->CLSB_Doc->pSelFaces, ChangeLightXScale, &m_LightXScale);
830830 AssignCurrentToViews ();
831831 }
832832 }
@@ -852,7 +852,7 @@
852852 pDoc->SetModifiedFlag();
853853 UpdateData (TRUE);
854854 OnFloatKillFocus (m_EditLightYScale, &m_LightYScale, 1.0f, "1.0");
855- SelFaceList_Enum (pDoc->pSelFaces, ChangeLightYScale, &m_LightYScale);
855+ SelFaceList_Enum (App->CLSB_Doc->pSelFaces, ChangeLightYScale, &m_LightYScale);
856856 AssignCurrentToViews ();
857857 }
858858 }
@@ -876,7 +876,7 @@
876876 pDoc->SetModifiedFlag();
877877 UpdateData (TRUE);
878878 OnFloatKillFocus (m_EditAngle, &m_TextureAngle, 0, "0");
879- SelFaceList_Enum (pDoc->pSelFaces, ::ChangeTextureAngle, &m_TextureAngle);
879+ SelFaceList_Enum (App->CLSB_Doc->pSelFaces, ::ChangeTextureAngle, &m_TextureAngle);
880880 AssignCurrentToViews ();
881881 }
882882 }
@@ -900,7 +900,7 @@
900900 pDoc->SetModifiedFlag();
901901 UpdateData (TRUE);
902902 OnIntKillFocus (m_EditLightIntensity, &m_LightIntensity, 300, "300");
903- SelFaceList_Enum (pDoc->pSelFaces, ::ChangeLightIntensity, &m_LightIntensity);
903+ SelFaceList_Enum (App->CLSB_Doc->pSelFaces, ::ChangeLightIntensity, &m_LightIntensity);
904904 AssignCurrentToViews ();
905905 }
906906 }
@@ -924,7 +924,7 @@
924924 pDoc->SetModifiedFlag();
925925 UpdateData (TRUE);
926926 OnFloatKillFocus (m_EditMipMapBias, &m_MipMapBias, 0, "1.0");
927- SelFaceList_Enum (pDoc->pSelFaces, ::ChangeMipMapBias, &m_MipMapBias);
927+ SelFaceList_Enum (App->CLSB_Doc->pSelFaces, ::ChangeMipMapBias, &m_MipMapBias);
928928 AssignCurrentToViews ();
929929 }
930930 }
@@ -958,7 +958,7 @@
958958 m_Reflectivity =10.0f;
959959 }
960960
961- SelFaceList_Enum (pDoc->pSelFaces, ::ChangeReflectivity, &m_Reflectivity);
961+ SelFaceList_Enum (App->CLSB_Doc->pSelFaces, ::ChangeReflectivity, &m_Reflectivity);
962962 AssignCurrentToViews ();
963963 }
964964 }
@@ -991,7 +991,7 @@
991991 {
992992 m_Translucency =255.0f;
993993 }
994- SelFaceList_Enum (pDoc->pSelFaces, ::ChangeTranslucency, &m_Translucency);
994+ SelFaceList_Enum (App->CLSB_Doc->pSelFaces, ::ChangeTranslucency, &m_Translucency);
995995 AssignCurrentToViews ();
996996 }
997997 }
@@ -1021,7 +1021,7 @@
10211021
10221022 UpdateData(FALSE);
10231023
1024- SelFaceList_Enum (pDoc->pSelFaces, FlipVertical, NULL);
1024+ SelFaceList_Enum (App->CLSB_Doc->pSelFaces, FlipVertical, NULL);
10251025
10261026 AssignCurrentToViews();
10271027 }
@@ -1052,7 +1052,7 @@
10521052
10531053 UpdateData(FALSE);
10541054
1055- SelFaceList_Enum (pDoc->pSelFaces, FlipHorizontal, NULL);
1055+ SelFaceList_Enum (App->CLSB_Doc->pSelFaces, FlipHorizontal, NULL);
10561056
10571057 AssignCurrentToViews();
10581058 }
@@ -1077,7 +1077,7 @@
10771077 pDoc->SetModifiedFlag();
10781078 UpdateData (TRUE);
10791079 GetDlgItem( IDC_FACELIGHTINTENSITY )->EnableWindow( m_Light && !m_Sky) ;
1080- SelFaceList_Enum (pDoc->pSelFaces, SetLight, &m_Light);
1080+ SelFaceList_Enum (App->CLSB_Doc->pSelFaces, SetLight, &m_Light);
10811081 AssignCurrentToViews ();
10821082 }
10831083 }
@@ -1102,7 +1102,7 @@
11021102 pDoc->SetModifiedFlag();
11031103 UpdateData (TRUE);
11041104 EnabledChange(TRUE);
1105- SelFaceList_Enum (pDoc->pSelFaces, SetMirror, &m_Mirror);
1105+ SelFaceList_Enum (App->CLSB_Doc->pSelFaces, SetMirror, &m_Mirror);
11061106 AssignCurrentToViews ();
11071107 }
11081108 }
@@ -1126,7 +1126,7 @@
11261126 pDoc->SetModifiedFlag();
11271127 UpdateData (TRUE);
11281128 EnabledChange(TRUE);
1129- SelFaceList_Enum (pDoc->pSelFaces, SetSky, &m_Sky);
1129+ SelFaceList_Enum (App->CLSB_Doc->pSelFaces, SetSky, &m_Sky);
11301130 AssignCurrentToViews ();
11311131 }
11321132 }
@@ -1145,10 +1145,10 @@
11451145 if (pDoc)
11461146 {
11471147 // Face *pFace = SelFaceList_GetFace (pDoc->pSelFaces, 0);
1148- int NumberOfFaces = SelFaceList_GetSize (pDoc->pSelFaces);
1148+ int NumberOfFaces = SelFaceList_GetSize (App->CLSB_Doc->pSelFaces);
11491149 Face *pFace;
11501150 if (NumberOfFaces)
1151- pFace = SelFaceList_GetFace (pDoc->pSelFaces, (NumberOfFaces-1));
1151+ pFace = SelFaceList_GetFace (App->CLSB_Doc->pSelFaces, (NumberOfFaces-1));
11521152 else
11531153 return;
11541154
@@ -1169,7 +1169,7 @@
11691169 {
11701170 pDoc->SetModifiedFlag();
11711171 UpdateData (TRUE);
1172- SelFaceList_Enum (pDoc->pSelFaces, ::SetFullBright, &m_FullBright);
1172+ SelFaceList_Enum (App->CLSB_Doc->pSelFaces, ::SetFullBright, &m_FullBright);
11731173 SetShadingChecks ();
11741174 AssignCurrentToViews ();
11751175 }
@@ -1193,7 +1193,7 @@
11931193 {
11941194 pDoc->SetModifiedFlag();
11951195 UpdateData (TRUE);
1196- SelFaceList_Enum (pDoc->pSelFaces, ::SetGouraud, &m_Gouraud);
1196+ SelFaceList_Enum (App->CLSB_Doc->pSelFaces, ::SetGouraud, &m_Gouraud);
11971197 SetShadingChecks ();
11981198 AssignCurrentToViews ();
11991199 }
@@ -1217,7 +1217,7 @@
12171217 {
12181218 pDoc->SetModifiedFlag();
12191219 UpdateData (TRUE);
1220- SelFaceList_Enum (pDoc->pSelFaces, ::SetFlat, &m_Flat);
1220+ SelFaceList_Enum (App->CLSB_Doc->pSelFaces, ::SetFlat, &m_Flat);
12211221 SetShadingChecks ();
12221222 AssignCurrentToViews ();
12231223 }
@@ -1241,7 +1241,7 @@
12411241 {
12421242 pDoc->SetModifiedFlag();
12431243 UpdateData (TRUE);
1244- SelFaceList_Enum (pDoc->pSelFaces, ::SetTextureLock, &m_TextureLock);
1244+ SelFaceList_Enum (App->CLSB_Doc->pSelFaces, ::SetTextureLock, &m_TextureLock);
12451245 AssignCurrentToViews ();
12461246 }
12471247 }
@@ -1265,7 +1265,7 @@
12651265 pDoc->SetModifiedFlag();
12661266 UpdateData (TRUE);
12671267 GetDlgItem( IDC_FACETRANSLUCENCY )->EnableWindow( (m_Mirror || m_Transparent) && !m_Sky) ;
1268- SelFaceList_Enum (pDoc->pSelFaces, ::SetTransparent, &m_Transparent);
1268+ SelFaceList_Enum (App->CLSB_Doc->pSelFaces, ::SetTransparent, &m_Transparent);
12691269 AssignCurrentToViews ();
12701270 }
12711271 }
--- WorldEditor/WorldEditor/MainFrm.cpp (revision 2542)
+++ WorldEditor/WorldEditor/MainFrm.cpp (revision 2543)
@@ -135,7 +135,7 @@
135135 pDoc = this->GetCurrentDoc ();
136136 if (pDoc != NULL)
137137 {
138- if (pDoc->IsSelectionLocked())
138+ if (App->CLSB_Doc->IsSelectionLocked())
139139 {
140140 m_wndStatusBar.SetPaneText(ID_SLOCK_PANE, "SLOCK");
141141 }
@@ -161,8 +161,8 @@
161161 if(pDoc)
162162 {
163163 CString etxt, btxt, ftxt;
164- int NumSelFaces = SelFaceList_GetSize (pDoc->pSelFaces);
165- int NumSelBrushes = SelBrushList_GetSize (pDoc->pSelBrushes);
164+ int NumSelFaces = SelFaceList_GetSize (App->CLSB_Doc->pSelFaces);
165+ int NumSelBrushes = SelBrushList_GetSize (App->CLSB_Doc->pSelBrushes);
166166
167167 etxt.Format("Entities: %d", App->CLSB_Doc->NumSelEntities);
168168 btxt.Format(" Brushes: %d", NumSelBrushes);
--- WorldEditor/WorldEditor/SB_Brushes.cpp (revision 2542)
+++ WorldEditor/WorldEditor/SB_Brushes.cpp (revision 2543)
@@ -73,7 +73,7 @@
7373
7474 //Lock_Textures(true);
7575
76- SelBrushList_Center(m_pDoc->pSelBrushes, &App->CLSB_Doc->SelectedGeoCenter);
76+ SelBrushList_Center(App->CLSB_Doc->pSelBrushes, &App->CLSB_Doc->SelectedGeoCenter);
7777
7878 CenterOfSelection = App->CLSB_Doc->SelectedGeoCenter;
7979
@@ -745,7 +745,7 @@
745745 {
746746 geVec3d_Subtract(&App->CLSB_Brushes->CenterOfSelection, &App->CLSB_Doc->SelectedGeoCenter, &App->CLSB_Brushes->CenterOfSelection);
747747
748- App->CLSB_Doc->MoveSelectedBrushList(App->CLSB_Brushes->m_pDoc->pSelBrushes, &App->CLSB_Brushes->CenterOfSelection);
748+ App->CLSB_Doc->MoveSelectedBrushList(App->CLSB_Doc->pSelBrushes, &App->CLSB_Brushes->CenterOfSelection);
749749
750750 App->CLSB_Doc->UpdateAllViews(UAV_ALLVIEWS | REBUILD_QUICK, NULL);
751751 }
@@ -761,7 +761,7 @@
761761 FinalScale.Y = SY;
762762 FinalScale.Z = SZ;
763763
764- App->m_pDoc->RotateSelectedBrushList(App->CLSB_Brushes->m_pDoc->pSelBrushes, &FinalScale);
764+ App->m_pDoc->RotateSelectedBrushList(App->CLSB_Doc->pSelBrushes, &FinalScale);
765765
766766 App->CLSB_Doc->UpdateAllViews(UAV_ALLVIEWS | UAV_ALL3DVIEWS | REBUILD_QUICK, NULL);
767767 }
@@ -878,7 +878,7 @@
878878 //Lock_Textures(true);
879879
880880 Get_Brush();
881- SelBrushList_Center(m_pDoc->pSelBrushes, &App->CLSB_Doc->SelectedGeoCenter);
881+ SelBrushList_Center(App->CLSB_Doc->pSelBrushes, &App->CLSB_Doc->SelectedGeoCenter);
882882 CenterOfSelection = App->CLSB_Doc->SelectedGeoCenter;
883883
884884 char buf[255];
@@ -941,11 +941,11 @@
941941
942942 m_pDoc->SelectAllFacesInBrushes();
943943
944- NumberOfFaces = SelFaceList_GetSize(m_pDoc->pSelFaces);
944+ NumberOfFaces = SelFaceList_GetSize(App->CLSB_Doc->pSelFaces);
945945
946946 for (int i = 0; i < NumberOfFaces; ++i)
947947 {
948- pFace = SelFaceList_GetFace(m_pDoc->pSelFaces, i);
948+ pFace = SelFaceList_GetFace(App->CLSB_Doc->pSelFaces, i);
949949 Face_SetTextureLock(pFace, 256);
950950 }
951951
@@ -962,11 +962,11 @@
962962 int NumberOfBrushes;
963963 Brush* pBrush;
964964
965- NumberOfBrushes = SelBrushList_GetSize(App->m_pDoc->pSelBrushes);
965+ NumberOfBrushes = SelBrushList_GetSize(App->CLSB_Doc->pSelBrushes);
966966
967967 if (NumberOfBrushes)
968968 {
969- pBrush = SelBrushList_GetBrush(App->m_pDoc->pSelBrushes, (NumberOfBrushes - 1));
969+ pBrush = SelBrushList_GetBrush(App->CLSB_Doc->pSelBrushes, (NumberOfBrushes - 1));
970970 }
971971 else
972972 {
@@ -1014,7 +1014,7 @@
10141014 Centre.Y = 0;
10151015 Centre.Z = 0;
10161016
1017- SelBrushList_Add(App->m_pDoc->pSelBrushes, Selected_Brush);
1018- App->CLSB_Doc->MoveSelectedBrushList(App->m_pDoc->pSelBrushes, &Centre);
1017+ SelBrushList_Add(App->CLSB_Doc->pSelBrushes, Selected_Brush);
1018+ App->CLSB_Doc->MoveSelectedBrushList(App->CLSB_Doc->pSelBrushes, &Centre);
10191019 }
10201020 }
--- WorldEditor/WorldEditor/SB_Doc.cpp (revision 2542)
+++ WorldEditor/WorldEditor/SB_Doc.cpp (revision 2543)
@@ -6,7 +6,17 @@
66 #include "units.h"
77
88 #define MAX_PIXEL_SELECT_DIST (50)
9+#define MIN_ENTITY_SELECT_DIST (8.0f)
10+#define MAX_PIXEL_SELECT_THINGNAME (20)
911
12+// Maximum distance from entity in order for it to be selected.
13+// This is in world space coordinates and is used in rendered view only.
14+#define MAX_ENTITY_SELECT_DIST (16.0f)
15+
16+#define CAMERA_MOVEMENT_DISTANCE (32.0f)
17+#define CAMERA_MOVEMENT_ANGLE (M_PI/16.0f)
18+
19+
1020 SB_Doc::SB_Doc(void)
1121 {
1222 pTempSelBrushes = NULL;
@@ -22,6 +32,20 @@
2232 mCurrentBitmap = 0;
2333 NumSelEntities = 0;
2434 mCurrentGroup = 0;
35+
36+ TempShearTemplate = NULL;
37+ pSelFaces = NULL;
38+ pSelBrushes = NULL;
39+
40+ SelectLock = FALSE;
41+ TempEnt = FALSE;
42+ SelState = NOSELECTIONS;
43+ mShowSelectedBrushes = FALSE;
44+
45+ mWorldBsp = NULL;
46+ mConstrainHollows = GE_TRUE,
47+ PlaceObjectFlag = FALSE;
48+ mAdjustMode = ADJUST_MODE_FACE;
2549 }
2650
2751 SB_Doc::~SB_Doc(void)
@@ -35,7 +59,7 @@
3559 {
3660 App->Get_Current_Document();
3761
38- if (App->m_pDoc->TempEnt || !Brush_IsSubtract(App->m_pDoc->CurBrush))
62+ if (TempEnt || !Brush_IsSubtract(CurBrush))
3963 {
4064 App->m_pDoc->OnBrushAddtoworld();
4165 }
@@ -62,7 +86,7 @@
6286 SetCursor(AfxGetApp()->LoadStandardCursor(IDC_WAIT));
6387
6488 ResetAllSelectedFaces();
65- ReBuild = (App->m_pDoc->GetSelState() & ANYBRUSH);
89+ ReBuild = (GetSelState() & ANYBRUSH);
6690
6791 DeleteSelectedBrushes();
6892
@@ -90,7 +114,7 @@
90114 geBoolean bAlteredCurrentGroup = GE_FALSE;
91115 CEntityArray* Entities = Level_GetEntities(pLevel);
92116
93- for (int Ent = 0; Ent < Entities->GetSize() && (!(App->m_pDoc->GetSelState() & NOENTITIES)); Ent++)
117+ for (int Ent = 0; Ent < Entities->GetSize() && (!(GetSelState() & NOENTITIES)); Ent++)
94118 {
95119 if ((*Entities)[Ent].IsSelected())
96120 {
@@ -101,20 +125,20 @@
101125 bAlteredCurrentGroup = GE_TRUE;
102126 }
103127
104- App->CLSB_Doc->DeleteEntity(Ent--);
128+ DeleteEntity(Ent--);
105129 App->m_pDoc->SetModifiedFlag();
106130 }
107131 }
108132 }
109133
110- if (App->m_pDoc->GetSelState() & ANYBRUSH)
134+ if (GetSelState() & ANYBRUSH)
111135 {
112- int NumSelBrushes = SelBrushList_GetSize(App->m_pDoc->pSelBrushes);
136+ int NumSelBrushes = SelBrushList_GetSize(pSelBrushes);
113137 for (int i = 0; i < NumSelBrushes; i++)
114138 {
115139 Brush* pBrush;
116140
117- pBrush = SelBrushList_GetBrush(App->m_pDoc->pSelBrushes, 0);
141+ pBrush = SelBrushList_GetBrush(pSelBrushes, 0);
118142
119143 if (strstr(App->CL_Brush->Brush_GetName(pBrush), ".act") != NULL)
120144 continue;
@@ -125,7 +149,7 @@
125149 }
126150
127151 Level_RemoveBrush(pLevel, pBrush);
128- SelBrushList_Remove(App->m_pDoc->pSelBrushes, pBrush);
152+ SelBrushList_Remove(pSelBrushes, pBrush);
129153 Brush_Destroy(&pBrush);
130154 }
131155
@@ -163,13 +187,13 @@
163187 Brush* b = (*Entities)[EntityIndex].GetActorBrush();
164188 if (b != NULL)
165189 {
166- SelBrushList_Remove(App->m_pDoc->pSelBrushes, b);
190+ SelBrushList_Remove(pSelBrushes, b);
167191 Level_RemoveBrush(pLevel, b);
168192 }
169193 // end change
170194 Entities->RemoveAt(EntityIndex);
171- App->m_pDoc->SelState &= (~ENTITYCLEAR);
172- App->m_pDoc->SelState |= (NumSelEntities > 1) ? MULTIENTITY : (NumSelEntities + 1) << 7;
195+ SelState &= (~ENTITYCLEAR);
196+ SelState |= (NumSelEntities > 1) ? MULTIENTITY : (NumSelEntities + 1) << 7;
173197 }
174198
175199 // *************************************************************************
@@ -230,7 +254,7 @@
230254 geFloat Dist;
231255 int FoundThingType;
232256
233- if (App->m_pDoc->IsSelectionLocked())
257+ if (IsSelectionLocked())
234258 {
235259 return;
236260 }
@@ -241,7 +265,7 @@
241265 ResetAllSelections();
242266 }
243267
244- FoundThingType = App->m_pDoc->FindClosestThing(&point, v, &pMinBrush, &pMinEntity, &Dist);
268+ FoundThingType = FindClosestThing(&point, v, &pMinBrush, &pMinEntity, &Dist);
245269
246270 if ((FoundThingType != fctNOTHING) && (Dist <= MAX_PIXEL_SELECT_DIST))
247271 {
@@ -268,7 +292,7 @@
268292 UpdateSelected();
269293
270294 App->CL_TabsControl->Select_Brushes_Tab(0);
271- App->CL_TabsGroups_Dlg->Get_Index(App->m_pDoc->CurBrush);
295+ App->CL_TabsGroups_Dlg->Get_Index(CurBrush);
272296
273297 App->CL_TabsGroups_Dlg->Update_Dlg_Controls();
274298 App->CLSB_TopTabs->Update_Dlg_Controls();
@@ -291,24 +315,24 @@
291315
292316 mLastOp = BRUSH_SCALE;
293317
294- App->m_pDoc->TempDeleteSelected();
318+ TempDeleteSelected();
295319
296320 if (mModeTool == ID_TOOLS_TEMPLATE)
297321 {
298- if (Brush_IsMulti(App->m_pDoc->CurBrush))
322+ if (Brush_IsMulti(CurBrush))
299323 {
300- BrushList_ClearCSGAndHollows((BrushList*)App->CL_Brush->Brush_GetBrushList(App->m_pDoc->CurBrush), Brush_GetModelId(App->m_pDoc->CurBrush));
301- BrushList_RebuildHollowFaces((BrushList*)App->CL_Brush->Brush_GetBrushList(App->m_pDoc->CurBrush), Brush_GetModelId(App->m_pDoc->CurBrush), fdocBrushCSGCallback, NULL);
324+ BrushList_ClearCSGAndHollows((BrushList*)App->CL_Brush->Brush_GetBrushList(CurBrush), Brush_GetModelId(CurBrush));
325+ BrushList_RebuildHollowFaces((BrushList*)App->CL_Brush->Brush_GetBrushList(CurBrush), Brush_GetModelId(CurBrush), fdocBrushCSGCallback, NULL);
302326 }
303327 return;
304328 }
305329
306- int NumSelBrushes = SelBrushList_GetSize(App->m_pDoc->pSelBrushes);
330+ int NumSelBrushes = SelBrushList_GetSize(pSelBrushes);
307331 for (int i = 0; i < NumSelBrushes; ++i)
308332 {
309333 Brush* pBrush;
310334
311- pBrush = SelBrushList_GetBrush(App->m_pDoc->pSelBrushes, i);
335+ pBrush = SelBrushList_GetBrush(pSelBrushes, i);
312336
313337 if (strstr(App->CL_Brush->Brush_GetName(pBrush), ".act") != NULL)
314338 continue;
@@ -334,28 +358,28 @@
334358
335359 mLastOp = BRUSH_MOVE;
336360
337- App->m_pDoc->TempDeleteSelected();
361+ TempDeleteSelected();
338362
339363 if (mModeTool == ID_TOOLS_TEMPLATE)
340364 {
341- if (App->m_pDoc->TempEnt)
365+ if (TempEnt)
342366 {
343- App->m_pDoc->DoneMoveEntity();
367+ DoneMoveEntity();
344368 }
345369 else
346370 {
347- Brush_Move(App->m_pDoc->CurBrush, &FinalPos);
371+ Brush_Move(CurBrush, &FinalPos);
348372 }
349373 return;
350374 }
351375 else
352376 {
353- int NumSelBrushes = SelBrushList_GetSize(App->m_pDoc->pSelBrushes);
377+ int NumSelBrushes = SelBrushList_GetSize(pSelBrushes);
354378 for (i = 0; i < NumSelBrushes; i++)
355379 {
356380 Brush* pBrush;
357381
358- pBrush = SelBrushList_GetBrush(App->m_pDoc->pSelBrushes, i);
382+ pBrush = SelBrushList_GetBrush(pSelBrushes, i);
359383
360384 if (strstr(App->CL_Brush->Brush_GetName(pBrush), ".act") != NULL)
361385 continue;
@@ -363,9 +387,9 @@
363387 Brush_Move(pBrush, &FinalPos);
364388 }
365389
366- if (App->m_pDoc->GetSelState() & ANYENTITY)
390+ if (GetSelState() & ANYENTITY)
367391 {
368- App->m_pDoc->DoneMoveEntity();
392+ DoneMoveEntity();
369393 }
370394
371395 UpdateSelected();
@@ -378,6 +402,69 @@
378402 }
379403
380404 // *************************************************************************
405+// * DoneMoveEntity:- Terry and Hazel Flanigan 2023 *
406+// *************************************************************************
407+void SB_Doc::DoneMoveEntity(void)
408+{
409+ App->Get_Current_Document();
410+
411+ int i;
412+ float SnapSize;
413+ CEntityArray* Entities = Level_GetEntities(pLevel);
414+ CEntity* pEnt;
415+
416+ if (mCurrentTool == ID_TOOLS_BRUSH_MOVEROTATEBRUSH)
417+ {
418+ if ((GetSelState() == ONEENTITYONLY) && Level_UseGrid(pLevel))
419+ {
420+ SnapSize = Level_GetGridSnapSize(pLevel);
421+ }
422+ else
423+ {
424+ SnapSize = 1.0f;
425+ }
426+
427+ for (i = 0; i < Entities->GetSize(); i++)
428+ {
429+ pEnt = &(*Entities)[i];
430+
431+ if (pEnt->IsSelected())
432+ {
433+ pEnt->DoneMove(SnapSize, Level_GetEntityDefs(pLevel));
434+ if (pEnt->IsCamera() == GE_TRUE) // Camera Entity?
435+ // if( pEnt==pCameraEntity ) // Camera Entity?
436+ {
437+ geVec3d PitchRollYaw;
438+
439+ pEnt->GetAngles(&PitchRollYaw, Level_GetEntityDefs(pLevel));
440+ App->m_pDoc->SetRenderedViewCamera(&(pEnt->mOrigin), &PitchRollYaw);
441+ UpdateAllViews(UAV_RENDER_ONLY, NULL);
442+ }// Camera entity, update camera
443+ }// Entity Selected
444+ }// Loop thru Entities
445+ }
446+ else
447+ {
448+ if (mCurrentEntity < 0) //template
449+ {
450+ pEnt = &mRegularEntity;
451+ }
452+ else
453+ {
454+ pEnt = &(*Entities)[mCurrentEntity];
455+ }
456+
457+ SnapSize = 1.0f;
458+ if (Level_UseGrid(pLevel))
459+ {
460+ SnapSize = Level_GetGridSnapSize(pLevel);
461+ }
462+ pEnt->DoneMove(SnapSize, Level_GetEntityDefs(pLevel));
463+ }
464+ App->m_pDoc->SetModifiedFlag();
465+}
466+
467+// *************************************************************************
381468 // Lock_AllTextures:- Terry and Hazel Flanigan 2023 *
382469 // *************************************************************************
383470 void SB_Doc::Lock_AllTextures(void)
@@ -392,11 +479,11 @@
392479 Face* pFace;
393480 int NumberOfFaces;
394481
395- NumberOfFaces = SelFaceList_GetSize(App->m_pDoc->pSelFaces);
482+ NumberOfFaces = SelFaceList_GetSize(pSelFaces);
396483
397484 for (int i = 0; i < NumberOfFaces; ++i)
398485 {
399- pFace = SelFaceList_GetFace(App->m_pDoc->pSelFaces, i);
486+ pFace = SelFaceList_GetFace(pSelFaces, i);
400487 Face_SetTextureLock(pFace, true);
401488 }
402489
@@ -416,7 +503,7 @@
416503 static geBoolean fdocSelectBrush(Brush* pBrush, void* lParam)
417504 {
418505
419- SelBrushList_Add(App->m_pDoc->pSelBrushes, pBrush);
506+ SelBrushList_Add(App->CLSB_Doc->pSelBrushes, pBrush);
420507
421508 return GE_TRUE;
422509 }
@@ -432,7 +519,7 @@
432519
433520 pFace = Brush_GetFace(pBrush, iFace);
434521 Face_SetSelected(pFace, GE_TRUE);
435- SelFaceList_Add(App->m_pDoc->pSelFaces, pFace);
522+ SelFaceList_Add(App->CLSB_Doc->pSelFaces, pFace);
436523 }
437524 return GE_TRUE;
438525 }
@@ -452,13 +539,13 @@
452539
453540 // Select all faces on all selected brushes
454541 int iBrush;
455- int NumSelBrushes = SelBrushList_GetSize(App->m_pDoc->pSelBrushes);
542+ int NumSelBrushes = SelBrushList_GetSize(pSelBrushes);
456543
457544 for (iBrush = 0; iBrush < NumSelBrushes; ++iBrush)
458545 {
459546 Brush* pBrush;
460547
461- pBrush = SelBrushList_GetBrush(App->m_pDoc->pSelBrushes, iBrush);
548+ pBrush = SelBrushList_GetBrush(pSelBrushes, iBrush);
462549
463550 if (Brush_IsMulti(pBrush))
464551 {
@@ -473,7 +560,7 @@
473560
474561 UpdateSelected();
475562
476- App->m_pDoc->ConfigureCurrentTool();
563+ ConfigureCurrentTool();
477564 }
478565
479566 // *************************************************************************
@@ -484,20 +571,24 @@
484571 App->Get_Current_Document();
485572
486573 int i;
487- int NumSelFaces = SelFaceList_GetSize(App->m_pDoc->pSelFaces);
488- int NumSelBrushes = SelBrushList_GetSize(App->m_pDoc->pSelBrushes);
574+ int NumSelFaces = SelFaceList_GetSize(pSelFaces);
575+ int NumSelBrushes = SelBrushList_GetSize(pSelBrushes);
489576
490- App->m_pDoc->SelState = (NumSelBrushes > 1) ? MULTIBRUSH : NumSelBrushes;
491- App->m_pDoc->SelState |= (NumSelFaces > 1) ? MULTIFACE : (NumSelFaces + 1) << 3;
492- App->m_pDoc->SelState |= (NumSelEntities > 1) ? MULTIENTITY : (NumSelEntities + 1) << 7;
577+ SelState = (NumSelBrushes > 1) ? MULTIBRUSH : NumSelBrushes;
578+ SelState |= (NumSelFaces > 1) ? MULTIFACE : (NumSelFaces + 1) << 3;
579+ SelState |= (NumSelEntities > 1) ? MULTIENTITY : (NumSelEntities + 1) << 7;
493580
494581
495582 if (mModeTool == ID_GENERALSELECT)
496583 {
497- if (App->m_pDoc->GetSelState() & ONEBRUSH)
498- App->m_pDoc->CurBrush = SelBrushList_GetBrush(App->m_pDoc->pSelBrushes, 0);
584+ if (GetSelState() & ONEBRUSH)
585+ {
586+ CurBrush = SelBrushList_GetBrush(pSelBrushes, 0);
587+ }
499588 else
500- App->m_pDoc->CurBrush = App->m_pDoc->BTemplate;
589+ {
590+ CurBrush = BTemplate;
591+ }
501592 }
502593
503594 geVec3d_Clear(&SelectedGeoCenter);
@@ -504,16 +595,16 @@
504595
505596 if (mModeTool == ID_TOOLS_TEMPLATE)
506597 {
507- if (App->m_pDoc->TempEnt)
598+ if (TempEnt)
508599 {
509- SelectedGeoCenter = App->m_pDoc->mRegularEntity.mOrigin;
600+ SelectedGeoCenter = mRegularEntity.mOrigin;
510601 }
511602 else
512603 {
513- Brush_Center(App->m_pDoc->CurBrush, &SelectedGeoCenter);
604+ Brush_Center(CurBrush, &SelectedGeoCenter);
514605 }
515606 }
516- else if (App->m_pDoc->SelState != NOSELECTIONS)
607+ else if (SelState != NOSELECTIONS)
517608 {
518609 Model* pModel;
519610 ModelInfo_Type* ModelInfo = Level_GetModelInfo(pLevel);
@@ -528,7 +619,7 @@
528619 {
529620 if (NumSelBrushes)
530621 {
531- SelBrushList_Center(App->m_pDoc->pSelBrushes, &SelectedGeoCenter);
622+ SelBrushList_Center(pSelBrushes, &SelectedGeoCenter);
532623 }
533624 else if (NumSelEntities)
534625 {
@@ -554,7 +645,7 @@
554645 }
555646 }
556647
557- if (App->m_pDoc->SelState & ONEENTITY)
648+ if (SelState & ONEENTITY)
558649 {
559650 CEntityArray* Entities = Level_GetEntities(pLevel);
560651
@@ -607,10 +698,8 @@
607698 // *************************************************************************
608699 void SB_Doc::ResetAllSelectedFaces(void)
609700 {
610- App->Get_Current_Document();
611-
612701 BrushList_EnumLeafBrushes(Level_GetBrushes(pLevel), NULL, ResetSelectedFacesCB);
613- SelFaceList_RemoveAll(App->m_pDoc->pSelFaces);
702+ SelFaceList_RemoveAll(pSelFaces);
614703 }
615704
616705 // *************************************************************************
@@ -618,10 +707,8 @@
618707 // *************************************************************************
619708 void SB_Doc::ResetAllSelectedBrushes(void)
620709 {
621- App->Get_Current_Document();
622-
623- SelBrushList_RemoveAll(App->m_pDoc->pSelBrushes);
624- App->m_pDoc->CurBrush = App->m_pDoc->BTemplate;
710+ SelBrushList_RemoveAll(pSelBrushes);
711+ CurBrush = BTemplate;
625712 }
626713
627714 static geBoolean fdocDeselectEntity(CEntity& Ent, void* lParam)
@@ -801,3 +888,577 @@
801888 }
802889 }
803890 }
891+
892+// *************************************************************************
893+// * AddCameraEntityToLevel:- Terry and Hazel Flanigan 2023 *
894+// *************************************************************************
895+void SB_Doc::AddCameraEntityToLevel(void)
896+{
897+ CEntity* pCameraEntity = App->CLSB_Camera_WE->FindCameraEntity();
898+ if (!pCameraEntity)
899+ {
900+ // Make default camera entity
901+ CEntity CameraEntity;
902+ CString cstr;
903+
904+ CreateEntityFromName("Camera", CameraEntity);
905+ cstr.LoadString(IDS_CAMERAENTITYNAME);
906+ CameraEntity.SetKeyValue("%name%", cstr);
907+ CameraEntity.SetOrigin(0.0f, 0.0f, 0.0f, Level_GetEntityDefs(App->CLSB_Doc->pLevel));
908+ Level_AddEntity(App->CLSB_Doc->pLevel, CameraEntity);
909+
910+ // pCameraEntity = FindCameraEntity();
911+ }
912+}
913+
914+// *************************************************************************
915+// * CreateEntityFromName:- Terry and Hazel Flanigan 2023 *
916+// *************************************************************************
917+geBoolean SB_Doc::CreateEntityFromName(char const* pEntityType, CEntity& NewEnt)
918+{
919+ assert(pEntityType != NULL);
920+ // get all properties for this entity type...
921+ EntityPropertiesList* pProps;
922+
923+ pProps = EntityTable_GetEntityPropertiesFromName(Level_GetEntityDefs(App->CLSB_Doc->pLevel), pEntityType, ET_ALL);
924+ if (pProps == NULL)
925+ {
926+ return FALSE;
927+ }
928+
929+ // Add key/value pairs for all of the properties...
930+ for (int PropNo = 0; PropNo < pProps->NumProps; ++PropNo)
931+ {
932+ EntityProperty* p = &(pProps->Props[PropNo]);
933+
934+ NewEnt.SetKeyValue(p->pKey, p->pValue);
935+
936+ }
937+
938+ EntityTable_ReleaseEntityProperties(pProps);
939+
940+ NewEnt.SetGroupId(0);
941+ NewEnt.UpdateOrigin(Level_GetEntityDefs(App->CLSB_Doc->pLevel));
942+ return TRUE;
943+}
944+
945+// *************************************************************************
946+// * DoneShear:- Terry and Hazel Flanigan 2023 *
947+// *************************************************************************
948+void SB_Doc::DoneShear(int sides, int inidx)
949+{
950+ App->Get_Current_Document();
951+
952+ // BrushList *BList = Level_GetBrushes (pLevel);
953+ const Box3d* bx1, * bx2;
954+ int snapside = 0;
955+ geFloat bsnap;
956+
957+ App->m_pDoc->SetModifiedFlag();
958+
959+ mLastOp = BRUSH_SHEAR;
960+
961+ bsnap = 1.0f;
962+ if (Level_UseGrid(pLevel))
963+ {
964+ bsnap = Level_GetGridSnapSize(pLevel);
965+ }
966+
967+ if (mModeTool == ID_TOOLS_TEMPLATE)
968+ {
969+ if (TempShearTemplate) //can get here without shearing
970+ { //by rapid clicking
971+ Brush_Destroy(&CurBrush);
972+ CurBrush = BTemplate = Brush_Clone(TempShearTemplate);
973+ Brush_ShearFinal(CurBrush, sides, inidx, &FinalScale);
974+
975+ //check which side of the bounds changed
976+ bx1 = Brush_GetBoundingBox(CurBrush);
977+ bx2 = Brush_GetBoundingBox(TempShearTemplate);
978+
979+ if (bx1->Max.X != bx2->Max.X) snapside |= 2;
980+ if (bx1->Max.Y != bx2->Max.Y) snapside |= 8;
981+ if (bx1->Max.Z != bx2->Max.Z) snapside |= 32;
982+ if (bx1->Min.X != bx2->Min.X) snapside |= 1;
983+ if (bx1->Min.Y != bx2->Min.Y) snapside |= 4;
984+ if (bx1->Min.Z != bx2->Min.Z) snapside |= 16;
985+ Brush_SnapShearNearest(CurBrush, bsnap, sides, inidx, snapside);
986+ Brush_Destroy(&TempShearTemplate);
987+ }
988+ return;
989+ }
990+
991+ int NumSelBrushes = SelBrushList_GetSize(pSelBrushes);
992+
993+ TempDeleteSelected();
994+ App->m_pDoc->TempCopySelectedBrushes();
995+
996+ int i;
997+
998+ for (i = 0; i < NumSelBrushes; ++i)
999+ {
1000+ Brush* pBrush;
1001+ Brush* tBrush;
1002+
1003+ pBrush = SelBrushList_GetBrush(pSelBrushes, i);
1004+ tBrush = SelBrushList_GetBrush(pTempSelBrushes, i);
1005+ // changed QD Actors
1006+ // don't shear ActorBrushes
1007+ if (strstr(App->CL_Brush->Brush_GetName(pBrush), ".act") != NULL)
1008+ continue;
1009+ // end change
1010+
1011+ Brush_ShearFinal(pBrush, sides, inidx, &FinalScale);
1012+
1013+ //check which side of the bounds changed
1014+ bx1 = Brush_GetBoundingBox(pBrush);
1015+ bx2 = Brush_GetBoundingBox(tBrush);
1016+
1017+ if (bx1->Max.X != bx2->Max.X) snapside |= 2;
1018+ if (bx1->Max.Y != bx2->Max.Y) snapside |= 8;
1019+ if (bx1->Max.Z != bx2->Max.Z) snapside |= 32;
1020+ if (bx1->Min.X != bx2->Min.X) snapside |= 1;
1021+ if (bx1->Min.Y != bx2->Min.Y) snapside |= 4;
1022+ if (bx1->Min.Z != bx2->Min.Z) snapside |= 16;
1023+
1024+ Brush_SnapShearNearest(pBrush, bsnap, sides, inidx, snapside);
1025+ }
1026+ TempDeleteSelected();
1027+ UpdateSelected();
1028+}
1029+
1030+// *************************************************************************
1031+// * TempDeleteSelected:- Terry and Hazel Flanigan 2023 *
1032+// *************************************************************************
1033+BOOL SB_Doc::TempDeleteSelected(void)
1034+{
1035+ BOOL ret;
1036+ int i;
1037+ int NumTSelBrushes = SelBrushList_GetSize(pTempSelBrushes);
1038+
1039+ for (ret = FALSE, i = 0; i < NumTSelBrushes; i++)
1040+ {
1041+ Brush* pBrush;
1042+
1043+ pBrush = SelBrushList_GetBrush(pTempSelBrushes, 0);
1044+
1045+ Level_RemoveBrush(pLevel, pBrush);
1046+ SelBrushList_Remove(pTempSelBrushes, pBrush);
1047+ Brush_Destroy(&pBrush);
1048+ ret = TRUE;
1049+ }
1050+ return ret;
1051+}
1052+
1053+// *************************************************************************
1054+// * BrushSelect:- Terry and Hazel Flanigan 2023 *
1055+// *************************************************************************
1056+void SB_Doc::BrushSelect(Brush* pBrush)
1057+{
1058+ // if the brush is already selected, then unselect it.
1059+ // if not currently selected, then select it.
1060+ if (!SelBrushList_Remove(pSelBrushes, pBrush))
1061+ {
1062+ SelBrushList_Add(pSelBrushes, pBrush);
1063+ }
1064+}
1065+
1066+typedef struct FindClosestInfoTag
1067+{
1068+ CFusionDoc* pDoc;
1069+ ViewVars* v;
1070+ Brush** ppFoundBrush;
1071+ geFloat* pMinEdgeDist;
1072+ const POINT* ptFrom;
1073+} FindClosestInfo;
1074+
1075+static geFloat PointToLineDist
1076+(
1077+ POINT const* ptFrom,
1078+ POINT const* ptLine1,
1079+ POINT const* ptLine2
1080+)
1081+{
1082+ geFloat xkj, ykj;
1083+ geFloat xlk, ylk;
1084+ geFloat denom;
1085+ geFloat dist;
1086+
1087+ xkj = (geFloat)(ptLine1->x - ptFrom->x);
1088+ ykj = (geFloat)(ptLine1->y - ptFrom->y);
1089+ xlk = (geFloat)(ptLine2->x - ptLine1->x);
1090+ ylk = (geFloat)(ptLine2->y - ptLine1->y);
1091+ denom = (xlk * xlk) + (ylk * ylk);
1092+ if (denom < .0005f)
1093+ {
1094+ // segment ends coincide
1095+ dist = xkj * xkj + ykj * ykj;
1096+ }
1097+ else
1098+ {
1099+ geFloat t;
1100+ geFloat xfac, yfac;
1101+
1102+ t = -(xkj * xlk + ykj * ylk) / denom;
1103+ t = std::max(t, 0.0f);
1104+ t = std::min(t, 1.0f);
1105+ xfac = xkj + t * xlk;
1106+ yfac = ykj + t * ylk;
1107+ dist = xfac * xfac + yfac * yfac;
1108+ }
1109+ return (geFloat)sqrt(dist);
1110+}
1111+
1112+static geBoolean FindClosestBrushCB(Brush* pBrush, void* pVoid)
1113+{
1114+ FindClosestInfo* fci = (FindClosestInfo*)pVoid;
1115+
1116+ if (fci->pDoc->BrushIsVisible(pBrush))
1117+ {
1118+ // for each face...
1119+ for (int iFace = 0; iFace < Brush_GetNumFaces(pBrush); ++iFace)
1120+ {
1121+ POINT pt1, pt2;
1122+ Face* pFace = Brush_GetFace(pBrush, iFace);
1123+ const geVec3d* FacePoints = Face_GetPoints(pFace);
1124+ int NumPoints = Face_GetNumPoints(pFace);
1125+
1126+ // Starting with the edge formed by the last point and the first point,
1127+ // determine distance from mouse cursor pos to the edge.
1128+ pt1 = Render_OrthoWorldToView(fci->v, &FacePoints[NumPoints - 1]);
1129+ for (int iPoint = 0; iPoint < NumPoints; ++iPoint)
1130+ {
1131+ geFloat Dist;
1132+
1133+ pt2 = Render_OrthoWorldToView(fci->v, &FacePoints[iPoint]);
1134+ Dist = PointToLineDist(fci->ptFrom, &pt1, &pt2);
1135+ if (Dist < *fci->pMinEdgeDist)
1136+ {
1137+ *fci->pMinEdgeDist = Dist;
1138+ *fci->ppFoundBrush = pBrush;
1139+ }
1140+ pt1 = pt2; // next edge...
1141+ }
1142+ }
1143+ }
1144+ return GE_TRUE;
1145+}
1146+
1147+// *************************************************************************
1148+// * FindClosestThing:- Terry and Hazel Flanigan 2023 *
1149+// *************************************************************************
1150+int SB_Doc::FindClosestThing(POINT const* ptFrom,ViewVars* v,Brush** ppMinBrush,CEntity** ppMinEntity,geFloat* pDist)
1151+{
1152+ App->Get_Current_Document();
1153+
1154+ int rslt;
1155+
1156+ geBoolean FoundBrush;
1157+ geFloat MinEdgeDist;
1158+ Brush* pMinBrush;
1159+
1160+ geBoolean FoundEntity;
1161+ geFloat MinEntityDist;
1162+ CEntity* pMinEntity;
1163+
1164+ rslt = fctNOTHING;
1165+ FoundBrush = FindClosestBrush(ptFrom, v, &pMinBrush, &MinEdgeDist);
1166+ FoundEntity = FindClosestEntity(ptFrom, v, &pMinEntity, &MinEntityDist);
1167+
1168+
1169+ if (FoundEntity)
1170+ {
1171+ if ((!FoundBrush) || (MinEntityDist < MinEdgeDist))
1172+ {
1173+ *pDist = MinEntityDist;
1174+ if (ppMinEntity != NULL)
1175+ *ppMinEntity = pMinEntity;
1176+ rslt = fctENTITY;
1177+ }
1178+ else
1179+ {
1180+ *pDist = MinEdgeDist;
1181+ if (ppMinBrush != NULL)
1182+ *ppMinBrush = pMinBrush;
1183+ rslt = fctBRUSH;
1184+ }
1185+ }
1186+ else if (FoundBrush)
1187+ {
1188+ *pDist = MinEdgeDist;
1189+ if (ppMinBrush != NULL)
1190+ *ppMinBrush = pMinBrush;
1191+ rslt = fctBRUSH;
1192+ }
1193+ return rslt;
1194+}
1195+
1196+// *************************************************************************
1197+// * FindClosestBrush:- Terry and Hazel Flanigan 2023 *
1198+// *************************************************************************
1199+geBoolean SB_Doc::FindClosestBrush(POINT const* ptFrom, ViewVars* v, Brush** ppFoundBrush, geFloat* pMinEdgeDist)
1200+{
1201+ App->Get_Current_Document();
1202+
1203+ // determine the distance to the closest brush edge in the current view.
1204+ FindClosestInfo fci;
1205+
1206+ *pMinEdgeDist = FLT_MAX;
1207+ *ppFoundBrush = NULL;
1208+
1209+ fci.pDoc = App->m_pDoc;
1210+ fci.v = v;
1211+ fci.ppFoundBrush = ppFoundBrush;
1212+ fci.pMinEdgeDist = pMinEdgeDist;
1213+ fci.ptFrom = ptFrom;
1214+
1215+ BrushList_EnumLeafBrushes(Level_GetBrushes(App->CLSB_Doc->pLevel), &fci, ::FindClosestBrushCB);
1216+
1217+ return (*ppFoundBrush) ? GE_TRUE : GE_FALSE;
1218+}
1219+
1220+// *************************************************************************
1221+// * FindClosestEntity:- Terry and Hazel Flanigan 2023 *
1222+// *************************************************************************
1223+geBoolean SB_Doc::FindClosestEntity(POINT const* ptFrom,ViewVars* v,CEntity** ppMinEntity,geFloat* pMinEntityDist)
1224+{
1225+ App->Get_Current_Document();
1226+
1227+ geBoolean rslt;
1228+ CEntityArray* Entities;
1229+
1230+ Entities = Level_GetEntities(pLevel);
1231+ rslt = GE_FALSE;
1232+ // determine distance to closest entity in the current view
1233+ *pMinEntityDist = FLT_MAX;
1234+ *ppMinEntity = NULL;
1235+ for (int i = 0; i < Entities->GetSize(); ++i)
1236+ {
1237+ CEntity* pEnt;
1238+ POINT EntPosView;
1239+ geFloat Dist;
1240+ int dx, dy;
1241+
1242+ pEnt = &(*Entities)[i];
1243+ if (App->m_pDoc->EntityIsVisible(pEnt))
1244+ {
1245+ EntPosView = Render_OrthoWorldToView(v, &pEnt->mOrigin);
1246+ dx = EntPosView.x - ptFrom->x;
1247+ dy = EntPosView.y - ptFrom->y;
1248+
1249+ Dist = (geFloat)((dx * dx) + (dy * dy));
1250+ if (Dist < *pMinEntityDist)
1251+ {
1252+ *pMinEntityDist = Dist;
1253+ *ppMinEntity = pEnt;
1254+ rslt = GE_TRUE;
1255+ }
1256+ }
1257+ }
1258+
1259+ if (rslt)
1260+ {
1261+ *pMinEntityDist = (geFloat)sqrt(*pMinEntityDist);
1262+ }
1263+ return rslt;
1264+}
1265+
1266+// *************************************************************************
1267+// * ReturnThingUnderPoint:- Terry and Hazel Flanigan 2023 *
1268+// *************************************************************************
1269+const char* SB_Doc::ReturnThingUnderPoint(CPoint point, ViewVars* v)
1270+{
1271+ Brush* pMinBrush;
1272+ CEntity* pMinEntity;
1273+ geFloat Dist;
1274+ int FoundThingType;
1275+
1276+ FoundThingType = FindClosestThing(&point, v, &pMinBrush, &pMinEntity, &Dist);
1277+ if ((FoundThingType != fctNOTHING) && (Dist <= MAX_PIXEL_SELECT_THINGNAME))
1278+ {
1279+ switch (FoundThingType)
1280+ {
1281+ case fctBRUSH:
1282+ return App->CL_Brush->Brush_GetName(pMinBrush);
1283+ break;
1284+ case fctENTITY:
1285+ return pMinEntity->GetName();
1286+ break;
1287+ default:
1288+ break;
1289+ }
1290+ }
1291+
1292+ return "";
1293+}
1294+
1295+static geBoolean fdocSelectBrushesFromFaces(Brush* pBrush, void* lParam)
1296+{
1297+ CFusionDoc* pDoc = (CFusionDoc*)lParam;
1298+ int iFace, nFaces;
1299+
1300+ // if any of the brush's faces is selected, then select the brush.
1301+ nFaces = Brush_GetNumFaces(pBrush);
1302+ for (iFace = 0; iFace < nFaces; ++iFace)
1303+ {
1304+ Face* pFace;
1305+
1306+ pFace = Brush_GetFace(pBrush, iFace);
1307+ if (Face_IsSelected(pFace))
1308+ {
1309+ pDoc->DoBrushSelection(pBrush, brushSelAlways);
1310+ break;
1311+ }
1312+ }
1313+ return GE_TRUE;
1314+}
1315+
1316+// *************************************************************************
1317+// * SetAdjustmentMode:- Terry and Hazel Flanigan 2023 *
1318+// *************************************************************************
1319+void SB_Doc::SetAdjustmentMode(fdocAdjustEnum nCmdIDMode)
1320+{
1321+ App->Get_Current_Document();
1322+
1323+ if (mAdjustMode == nCmdIDMode)
1324+ return;
1325+
1326+ if (nCmdIDMode == ADJUST_MODE_TOGGLE)
1327+ {
1328+ // nCmdIDMode = (mAdjustMode == ADJUST_MODE_BRUSH) ? ADJUST_MODE_FACE : ADJUST_MODE_BRUSH;
1329+ nCmdIDMode = ADJUST_MODE_FACE;
1330+ }
1331+
1332+ switch (nCmdIDMode)
1333+ {
1334+ case ADJUST_MODE_BRUSH:
1335+ mAdjustMode = nCmdIDMode;
1336+
1337+ // go through brush list and select any brush that has selected faces.
1338+ // Ensure that all brushes in a locked group or model set are selected...
1339+ Level_EnumLeafBrushes(pLevel, this, fdocSelectBrushesFromFaces);
1340+
1341+ App->CLSB_Doc->ResetAllSelectedFaces();
1342+ App->CLSB_Doc->UpdateSelected();
1343+
1344+ //remove face attributes dialog if present...
1345+// DeleteFaceAttributes ();
1346+ ConfigureCurrentTool();
1347+ break;
1348+
1349+ case ADJUST_MODE_FACE:
1350+ {
1351+ mAdjustMode = nCmdIDMode;
1352+
1353+ // Select all faces on all selected brushes
1354+ int iBrush;
1355+ int NumSelBrushes = SelBrushList_GetSize(pSelBrushes);
1356+
1357+ for (iBrush = 0; iBrush < NumSelBrushes; ++iBrush)
1358+ {
1359+ Brush* pBrush;
1360+
1361+ pBrush = SelBrushList_GetBrush(pSelBrushes, iBrush);
1362+ if (Brush_IsMulti(pBrush))
1363+ {
1364+ BrushList_EnumLeafBrushes(App->CL_Brush->Brush_GetBrushList(pBrush), this, ::SelAllBrushFaces);
1365+ }
1366+ else
1367+ {
1368+ ::SelAllBrushFaces(pBrush, this);
1369+ }
1370+ }
1371+ App->CLSB_Doc->UpdateSelected();
1372+ //remove brush attributes dialog if present...
1373+// DeleteBrushAttributes ();
1374+ ConfigureCurrentTool();
1375+ break;
1376+ }
1377+ default:
1378+ assert(0); // bad mode (can't happen?)
1379+ break;
1380+ }
1381+}
1382+
1383+// *************************************************************************
1384+// * ConfigureCurrentTool:- Terry and Hazel Flanigan 2023 *
1385+// *************************************************************************
1386+void SB_Doc::ConfigureCurrentTool(void)
1387+{
1388+ BOOL Redraw = FALSE;
1389+
1390+ if (mModeTool == ID_TOOLS_CAMERA)
1391+ {
1392+ mCurrentTool = CURTOOL_NONE;
1393+ mShowSelectedBrushes = (mAdjustMode == ADJUST_MODE_BRUSH);
1394+ mShowSelectedFaces = (mAdjustMode == ADJUST_MODE_FACE);
1395+ UpdateAllViews(UAV_ALL3DVIEWS, NULL);
1396+ return;
1397+ }
1398+
1399+ switch (mAdjustMode)
1400+ {
1401+ case ADJUST_MODE_BRUSH:
1402+ mShowSelectedFaces = FALSE;
1403+ mShowSelectedBrushes = TRUE;
1404+
1405+ UpdateSelected();
1406+ Redraw = TRUE;
1407+ break;
1408+
1409+ case ADJUST_MODE_FACE:
1410+ mShowSelectedFaces = TRUE;
1411+ mShowSelectedBrushes = FALSE;
1412+
1413+ UpdateSelected();
1414+ Redraw = TRUE;
1415+ break;
1416+
1417+ default:
1418+ assert(0); // bad adjustment mode
1419+ break;
1420+ }
1421+
1422+ switch (mCurrentTool)
1423+ {
1424+ case ID_TOOLS_BRUSH_MOVEROTATEBRUSH:
1425+ if (mModeTool != ID_TOOLS_TEMPLATE)
1426+ {
1427+ mShowSelectedFaces = FALSE;
1428+ mShowSelectedBrushes = TRUE;
1429+ Redraw = TRUE;
1430+ }
1431+ else
1432+ {
1433+ mShowSelectedFaces = FALSE;
1434+ mShowSelectedBrushes = FALSE;
1435+ }
1436+ break;
1437+
1438+ case ID_TOOLS_BRUSH_SCALEBRUSH:
1439+ if (mModeTool != ID_TOOLS_TEMPLATE)
1440+ {
1441+ Redraw = TRUE;
1442+ mShowSelectedFaces = FALSE;
1443+ mShowSelectedBrushes = TRUE;
1444+ }
1445+ else
1446+ {
1447+ mShowSelectedFaces = FALSE;
1448+ mShowSelectedBrushes = FALSE;
1449+ }
1450+ break;
1451+
1452+ }
1453+ if (mModeTool == ID_TOOLS_TEMPLATE && TempEnt)
1454+ {
1455+ mCurrentEntity = -1;
1456+ }
1457+
1458+ Redraw = TRUE;
1459+ if (Redraw)
1460+ {
1461+ UpdateAllViews(UAV_ALL3DVIEWS, NULL);
1462+ }
1463+}
1464+
--- WorldEditor/WorldEditor/SB_Doc.h (revision 2542)
+++ WorldEditor/WorldEditor/SB_Doc.h (revision 2543)
@@ -1,4 +1,14 @@
11 #pragma once
2+
3+#include "SelFaceList.h"
4+
5+enum fdocAdjustEnum
6+{
7+ ADJUST_MODE_TOGGLE,
8+ ADJUST_MODE_BRUSH,
9+ ADJUST_MODE_FACE
10+};
11+
212 class SB_Doc
313 {
414 public:
@@ -19,6 +29,7 @@
1929
2030 void DoneResize(int sides, int inidx);
2131 void DoneMove(void);
32+ void DoneMoveEntity(void);
2233
2334 void Lock_AllTextures(void);
2435
@@ -33,6 +44,30 @@
3344 void MoveSelectedBrushes(geVec3d const* v);
3445 void MoveSelectedBrushList(SelBrushList* pList, geVec3d const* v);
3546
47+ void AddCameraEntityToLevel(void);
48+ geBoolean CreateEntityFromName(char const* pEntityType, CEntity& NewEnt);
49+
50+ void DoneShear(int sides, int inidx);
51+ BOOL TempDeleteSelected(void);
52+ void BrushSelect(Brush* pBrush);
53+
54+ int FindClosestThing(POINT const* ptFrom, ViewVars* v, Brush** ppMinBrush, CEntity** ppMinEntity, geFloat* pDist);
55+ geBoolean FindClosestBrush(POINT const* ptFrom, ViewVars* v, Brush** ppFoundBrush, geFloat* pMinEdgeDist);
56+ geBoolean FindClosestEntity(POINT const* ptFrom, ViewVars* v, CEntity** ppMinEntity, geFloat* pMinEntityDist);
57+
58+ const char* ReturnThingUnderPoint(CPoint point, ViewVars* v);
59+
60+ DWORD GetSelState(void) { return SelState; }
61+ int GetLockAxis(void) { return mLockAxis; };
62+ void SetLockAxis(int Lock) { mLockAxis = Lock; };
63+ void ToggleSelectionLock(void) { SelectLock = !(SelectLock); }
64+ BOOL IsSelectionLocked(void) { return SelectLock; }
65+ void SetAdjustmentMode(fdocAdjustEnum nCmdIDMode);
66+ void ConfigureCurrentTool(void);
67+
68+ // ----------------------------------------------------------- Varibles
69+ fdocAdjustEnum mAdjustMode;
70+
3671 int NumSelEntities;
3772 int mShowSelectedFaces;
3873 int mCurrentTool, mCurrentBitmap, mShowBrush, mModeTool;
@@ -45,6 +80,20 @@
4580
4681 SelBrushList* pTempSelBrushes;
4782
83+ Brush* BTemplate, * CurBrush, * TempShearTemplate;
84+ SelBrushList* pSelBrushes;
85+ SelFaceList* pSelFaces;
86+
87+ int mShowSelectedBrushes;
88+ int mLockAxis;
89+ geBoolean mConstrainHollows;
90+ BOOL SelectLock, TempEnt;
91+ BOOL PlaceObjectFlag;
92+ DWORD SelState;
93+
94+ GNode* mWorldBsp;
95+ CEntity mRegularEntity;
96+
4897 Level* pLevel;
4998 };
5099
--- WorldEditor/WorldEditor/SB_Equity.cpp (revision 2542)
+++ WorldEditor/WorldEditor/SB_Equity.cpp (revision 2543)
@@ -1125,7 +1125,7 @@
11251125
11261126 Get_CurrentDocument();
11271127
1128- int NumSelBrushes = SelBrushList_GetSize(m_pDoc->pSelBrushes);
1128+ int NumSelBrushes = SelBrushList_GetSize(App->CLSB_Doc->pSelBrushes);
11291129
11301130 if (NumSelBrushes == 0)
11311131 {
@@ -1136,7 +1136,7 @@
11361136
11371137 for (int i = 0; i < NumSelBrushes; ++i)
11381138 {
1139- Brush* pBrush = SelBrushList_GetBrush(App->m_pDoc->pSelBrushes, i);
1139+ Brush* pBrush = SelBrushList_GetBrush(App->CLSB_Doc->pSelBrushes, i);
11401140 if (pBrush->Flags & 1 || pBrush->Flags & 1024)
11411141 {
11421142 AllGood = 1;
--- WorldEditor/WorldEditor/SB_Export_World.cpp (revision 2542)
+++ WorldEditor/WorldEditor/SB_Export_World.cpp (revision 2543)
@@ -293,7 +293,7 @@
293293 {
294294 if(!strstr(App->CL_Brush->Brush_GetName(pBrush),".act"))
295295 {
296- if(!ExpSelected || SelBrushList_Find(App->m_pDoc->pSelBrushes, pBrush))
296+ if(!ExpSelected || SelBrushList_Find(App->CLSB_Doc->pSelBrushes, pBrush))
297297 {
298298 if(!ExpFiles || Brush_GetGroupId(pBrush)==i)
299299 {
@@ -677,7 +677,7 @@
677677 while (pBrush != NULL)
678678 {
679679
680- if (SelBrushList_Find(App->m_pDoc->pSelBrushes, pBrush))
680+ if (SelBrushList_Find(App->CLSB_Doc->pSelBrushes, pBrush))
681681 {
682682 Brush* pClone = Brush_Clone(pBrush);
683683 BrushList_Append(SBList, pClone);
--- WorldEditor/WorldEditor/SB_Level.cpp (revision 2542)
+++ WorldEditor/WorldEditor/SB_Level.cpp (revision 2543)
@@ -167,7 +167,7 @@
167167 return 0;
168168 }
169169
170- SelBrushList_Add(App->m_pDoc->pSelBrushes, Selected_Brush);
170+ SelBrushList_Add(App->CLSB_Doc->pSelBrushes, Selected_Brush);
171171
172172 App->CLSB_Doc->UpdateSelected();
173173
--- WorldEditor/WorldEditor/SB_Loader.cpp (revision 2542)
+++ WorldEditor/WorldEditor/SB_Loader.cpp (revision 2543)
@@ -961,7 +961,7 @@
961961
962962 Level_AppendBrush(App->CLSB_Doc->pLevel, mActorBrush);
963963 Brush_SetVisible(mActorBrush, GE_TRUE);
964- SelBrushList_Add(m_pDoc->pSelBrushes, mActorBrush);
964+ SelBrushList_Add(App->CLSB_Doc->pSelBrushes, mActorBrush);
965965
966966 m_pDoc->SetDefaultBrushTexInfo(mActorBrush);
967967 Brush_Bound(mActorBrush);
--- WorldEditor/WorldEditor/SB_Scene.cpp (revision 2542)
+++ WorldEditor/WorldEditor/SB_Scene.cpp (revision 2543)
@@ -257,7 +257,7 @@
257257 while (pBrush != NULL)
258258 {
259259
260- if (SelBrushList_Find(App->m_pDoc->pSelBrushes, pBrush))
260+ if (SelBrushList_Find(App->CLSB_Doc->pSelBrushes, pBrush))
261261 {
262262 Brush* pClone = Brush_Clone(pBrush);
263263 BrushList_Append(SBList, pClone);
Show on old repository browser