mirror of
https://github.com/jmarshall23/DoomRTX.git
synced 2026-08-17 11:00:38 +02:00
entity_t and brush_t now converted to idEditorEntity and idEditorBrush
This commit is contained in:
+149
-151
@@ -419,12 +419,12 @@ CClipPoint g_Clip1;
|
||||
CClipPoint g_Clip2;
|
||||
CClipPoint g_Clip3;
|
||||
CClipPoint *g_pMovingClip;
|
||||
brush_t g_brFrontSplits;
|
||||
brush_t g_brBackSplits;
|
||||
idEditorBrush g_brFrontSplits;
|
||||
idEditorBrush g_brBackSplits;
|
||||
|
||||
brush_t g_brClipboard;
|
||||
brush_t g_brUndo;
|
||||
entity_t g_enClipboard;
|
||||
idEditorBrush g_brClipboard;
|
||||
idEditorBrush g_brUndo;
|
||||
idEditorEntity g_enClipboard;
|
||||
|
||||
idVec3 g_vRotateOrigin;
|
||||
idVec3 g_vRotation;
|
||||
@@ -2366,7 +2366,7 @@ CDragPoint *PointRay(const idVec3 &org, const idVec3 &dir, float *dist) {
|
||||
=======================================================================================================================
|
||||
=======================================================================================================================
|
||||
*/
|
||||
void ClearSelectablePoints(brush_t *b) {
|
||||
void ClearSelectablePoints(idEditorBrush *b) {
|
||||
if (b == NULL) {
|
||||
dragPoints.RemoveAll();
|
||||
}
|
||||
@@ -2391,7 +2391,7 @@ void ClearSelectablePoints(brush_t *b) {
|
||||
=======================================================================================================================
|
||||
=======================================================================================================================
|
||||
*/
|
||||
void AddSelectablePoint(brush_t *b, idVec3 v, int type, bool priority) {
|
||||
void AddSelectablePoint(idEditorBrush *b, idVec3 v, int type, bool priority) {
|
||||
dragPoints.Add(new CDragPoint(b, v, type, priority));
|
||||
}
|
||||
|
||||
@@ -2399,7 +2399,7 @@ void AddSelectablePoint(brush_t *b, idVec3 v, int type, bool priority) {
|
||||
=======================================================================================================================
|
||||
=======================================================================================================================
|
||||
*/
|
||||
void UpdateSelectablePoint(brush_t *b, idVec3 v, int type) {
|
||||
void UpdateSelectablePoint(idEditorBrush *b, idVec3 v, int type) {
|
||||
int count = dragPoints.GetSize();
|
||||
for (int i = 0; i < count; i++) {
|
||||
CDragPoint *drag = reinterpret_cast < CDragPoint * > (dragPoints.GetAt(i));
|
||||
@@ -2534,18 +2534,16 @@ static void RotateLight(idVec3 &target, idVec3 &up, idVec3 &right, const idVec3
|
||||
=======================================================================================================================
|
||||
=======================================================================================================================
|
||||
*/
|
||||
extern idVec3 Brush_TransformedPoint(brush_t *b, const idVec3 &in);
|
||||
extern idMat3 Brush_RotationMatrix(brush_t *b);
|
||||
bool UpdateActiveDragPoint(const idVec3 &move) {
|
||||
if (activeDrag) {
|
||||
idMat3 mat = Brush_RotationMatrix(activeDrag->pBrush);
|
||||
idMat3 mat = activeDrag->pBrush->Brush_RotationMatrix();
|
||||
idMat3 invmat = mat.Transpose();
|
||||
idVec3 target, up, right, start, end;
|
||||
CString str;
|
||||
if (activeDrag->nType == LIGHT_TARGET) {
|
||||
GetVectorForKey(activeDrag->pBrush->owner, "light_target", target);
|
||||
GetVectorForKey(activeDrag->pBrush->owner, "light_up", up);
|
||||
GetVectorForKey(activeDrag->pBrush->owner, "light_right", right);
|
||||
activeDrag->pBrush->owner->GetVectorForKey("light_target", target);
|
||||
activeDrag->pBrush->owner->GetVectorForKey("light_up", up);
|
||||
activeDrag->pBrush->owner->GetVectorForKey("light_right", right);
|
||||
target *= mat;
|
||||
up *= mat;
|
||||
right *= mat;
|
||||
@@ -2553,68 +2551,68 @@ bool UpdateActiveDragPoint(const idVec3 &move) {
|
||||
target *= invmat;
|
||||
up *= invmat;
|
||||
right *= invmat;
|
||||
SetKeyVec3(activeDrag->pBrush->owner, "light_target", target);
|
||||
SetKeyVec3(activeDrag->pBrush->owner, "light_up", up);
|
||||
SetKeyVec3(activeDrag->pBrush->owner, "light_right", right);
|
||||
activeDrag->pBrush->owner->SetKeyVec3("light_target", target);
|
||||
activeDrag->pBrush->owner->SetKeyVec3("light_up", up);
|
||||
activeDrag->pBrush->owner->SetKeyVec3("light_right", right);
|
||||
target += (activeDrag->pBrush->trackLightOrigin) ? activeDrag->pBrush->owner->lightOrigin : activeDrag->pBrush->owner->origin;
|
||||
UpdateSelectablePoint(activeDrag->pBrush, Brush_TransformedPoint(activeDrag->pBrush, target), LIGHT_TARGET);
|
||||
UpdateSelectablePoint(activeDrag->pBrush, activeDrag->pBrush->Brush_TransformedPoint(target), LIGHT_TARGET);
|
||||
up += target;
|
||||
UpdateSelectablePoint(activeDrag->pBrush, Brush_TransformedPoint(activeDrag->pBrush,up), LIGHT_UP);
|
||||
UpdateSelectablePoint(activeDrag->pBrush, activeDrag->pBrush->Brush_TransformedPoint(up), LIGHT_UP);
|
||||
right += target;
|
||||
UpdateSelectablePoint(activeDrag->pBrush, Brush_TransformedPoint(activeDrag->pBrush,right), LIGHT_RIGHT);
|
||||
UpdateSelectablePoint(activeDrag->pBrush, activeDrag->pBrush->Brush_TransformedPoint(right), LIGHT_RIGHT);
|
||||
}
|
||||
else if (activeDrag->nType == LIGHT_UP) {
|
||||
GetVectorForKey(activeDrag->pBrush->owner, "light_up", up);
|
||||
activeDrag->pBrush->owner->GetVectorForKey("light_up", up);
|
||||
up *= mat;
|
||||
up += move;
|
||||
up *= invmat;
|
||||
SetKeyVec3(activeDrag->pBrush->owner, "light_up", up);
|
||||
GetVectorForKey(activeDrag->pBrush->owner, "light_target", target);
|
||||
activeDrag->pBrush->owner->SetKeyVec3("light_up", up);
|
||||
activeDrag->pBrush->owner->GetVectorForKey("light_target", target);
|
||||
target += (activeDrag->pBrush->trackLightOrigin) ? activeDrag->pBrush->owner->lightOrigin : activeDrag->pBrush->owner->origin;
|
||||
up += target;
|
||||
UpdateSelectablePoint(activeDrag->pBrush, Brush_TransformedPoint(activeDrag->pBrush,up), LIGHT_UP);
|
||||
UpdateSelectablePoint(activeDrag->pBrush, activeDrag->pBrush->Brush_TransformedPoint(up), LIGHT_UP);
|
||||
}
|
||||
else if (activeDrag->nType == LIGHT_RIGHT) {
|
||||
GetVectorForKey(activeDrag->pBrush->owner, "light_right", right);
|
||||
activeDrag->pBrush->owner->GetVectorForKey("light_right", right);
|
||||
right *= mat;
|
||||
right += move;
|
||||
right *= invmat;
|
||||
SetKeyVec3(activeDrag->pBrush->owner, "light_right", right);
|
||||
GetVectorForKey(activeDrag->pBrush->owner, "light_target", target);
|
||||
activeDrag->pBrush->owner->SetKeyVec3("light_right", right);
|
||||
activeDrag->pBrush->owner->GetVectorForKey("light_target", target);
|
||||
target += (activeDrag->pBrush->trackLightOrigin) ? activeDrag->pBrush->owner->lightOrigin : activeDrag->pBrush->owner->origin;
|
||||
right += target;
|
||||
UpdateSelectablePoint(activeDrag->pBrush, Brush_TransformedPoint(activeDrag->pBrush,right), LIGHT_RIGHT);
|
||||
UpdateSelectablePoint(activeDrag->pBrush, activeDrag->pBrush->Brush_TransformedPoint(right), LIGHT_RIGHT);
|
||||
}
|
||||
else if (activeDrag->nType == LIGHT_START) {
|
||||
GetVectorForKey(activeDrag->pBrush->owner, "light_start", start);
|
||||
activeDrag->pBrush->owner->GetVectorForKey("light_start", start);
|
||||
start *= mat;
|
||||
start += move;
|
||||
start *= invmat;
|
||||
SetKeyVec3(activeDrag->pBrush->owner, "light_start", start);
|
||||
activeDrag->pBrush->owner->SetKeyVec3("light_start", start);
|
||||
start += (activeDrag->pBrush->trackLightOrigin) ? activeDrag->pBrush->owner->lightOrigin : activeDrag->pBrush->owner->origin;
|
||||
UpdateSelectablePoint(activeDrag->pBrush, Brush_TransformedPoint(activeDrag->pBrush,start), LIGHT_START);
|
||||
UpdateSelectablePoint(activeDrag->pBrush, activeDrag->pBrush->Brush_TransformedPoint(start), LIGHT_START);
|
||||
}
|
||||
else if (activeDrag->nType == LIGHT_END) {
|
||||
GetVectorForKey(activeDrag->pBrush->owner, "light_end", end);
|
||||
activeDrag->pBrush->owner->GetVectorForKey("light_end", end);
|
||||
end *= mat;
|
||||
end += move;
|
||||
end *= invmat;
|
||||
SetKeyVec3(activeDrag->pBrush->owner, "light_end", end);
|
||||
activeDrag->pBrush->owner->SetKeyVec3("light_end", end);
|
||||
end += (activeDrag->pBrush->trackLightOrigin) ? activeDrag->pBrush->owner->lightOrigin : activeDrag->pBrush->owner->origin;
|
||||
UpdateSelectablePoint(activeDrag->pBrush, Brush_TransformedPoint(activeDrag->pBrush,end), LIGHT_END);
|
||||
UpdateSelectablePoint(activeDrag->pBrush, activeDrag->pBrush->Brush_TransformedPoint(end), LIGHT_END);
|
||||
}
|
||||
else if (activeDrag->nType == LIGHT_CENTER) {
|
||||
GetVectorForKey(activeDrag->pBrush->owner, "light_center", end);
|
||||
activeDrag->pBrush->owner->GetVectorForKey("light_center", end);
|
||||
end *= mat;
|
||||
end += move;
|
||||
end *= invmat;
|
||||
SetKeyVec3(activeDrag->pBrush->owner, "light_center", end);
|
||||
activeDrag->pBrush->owner->SetKeyVec3("light_center", end);
|
||||
end += (activeDrag->pBrush->trackLightOrigin) ? activeDrag->pBrush->owner->lightOrigin : activeDrag->pBrush->owner->origin;
|
||||
UpdateSelectablePoint(activeDrag->pBrush, Brush_TransformedPoint(activeDrag->pBrush, end), LIGHT_CENTER);
|
||||
UpdateSelectablePoint(activeDrag->pBrush, activeDrag->pBrush->Brush_TransformedPoint(end), LIGHT_CENTER);
|
||||
}
|
||||
|
||||
// FIXME: just build the frustrum values
|
||||
Brush_Build(activeDrag->pBrush);
|
||||
activeDrag->pBrush->Brush_Build();
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -3109,7 +3107,7 @@ float Betwixt(float f1, float f2) {
|
||||
=======================================================================================================================
|
||||
=======================================================================================================================
|
||||
*/
|
||||
void CXYWnd::ProduceSplits(brush_t **pFront, brush_t **pBack) {
|
||||
void CXYWnd::ProduceSplits(idEditorBrush **pFront, idEditorBrush **pBack) {
|
||||
*pFront = NULL;
|
||||
*pBack = NULL;
|
||||
if (ClipMode()) {
|
||||
@@ -3153,10 +3151,10 @@ void CXYWnd::ProduceSplits(brush_t **pFront, brush_t **pBack) {
|
||||
=======================================================================================================================
|
||||
=======================================================================================================================
|
||||
*/
|
||||
void CleanList(brush_t *pList) {
|
||||
brush_t *pBrush = pList->next;
|
||||
void CleanList(idEditorBrush *pList) {
|
||||
idEditorBrush *pBrush = pList->next;
|
||||
while (pBrush != NULL && pBrush != pList) {
|
||||
brush_t *pNext = pBrush->next;
|
||||
idEditorBrush *pNext = pBrush->next;
|
||||
Brush_Free(pBrush);
|
||||
pBrush = pNext;
|
||||
}
|
||||
@@ -3170,12 +3168,12 @@ void CXYWnd::ProduceSplitLists() {
|
||||
if (AnyPatchesSelected()) {
|
||||
Sys_Status("Deslecting patches for clip operation.\n");
|
||||
|
||||
brush_t *next;
|
||||
for (brush_t * pb = selected_brushes.next; pb != &selected_brushes; pb = next) {
|
||||
idEditorBrush *next;
|
||||
for (idEditorBrush * pb = selected_brushes.next; pb != &selected_brushes; pb = next) {
|
||||
next = pb->next;
|
||||
if (pb->pPatch) {
|
||||
Brush_RemoveFromList(pb);
|
||||
Brush_AddToList(pb, &active_brushes);
|
||||
pb->Brush_RemoveFromList();
|
||||
pb->Brush_AddToList(&active_brushes);
|
||||
UpdatePatchInspector();
|
||||
}
|
||||
}
|
||||
@@ -3186,10 +3184,10 @@ void CXYWnd::ProduceSplitLists() {
|
||||
g_brFrontSplits.next = &g_brFrontSplits;
|
||||
g_brBackSplits.next = &g_brBackSplits;
|
||||
|
||||
brush_t *pBrush;
|
||||
idEditorBrush *pBrush;
|
||||
for (pBrush = selected_brushes.next; pBrush != NULL && pBrush != &selected_brushes; pBrush = pBrush->next) {
|
||||
brush_t *pFront = NULL;
|
||||
brush_t *pBack = NULL;
|
||||
idEditorBrush *pFront = NULL;
|
||||
idEditorBrush *pBack = NULL;
|
||||
if (ClipMode()) {
|
||||
if (g_Clip1.Set() && g_Clip2.Set()) {
|
||||
face_t face;
|
||||
@@ -3222,11 +3220,11 @@ void CXYWnd::ProduceSplitLists() {
|
||||
|
||||
Brush_SplitBrushByFace(pBrush, &face, &pFront, &pBack);
|
||||
if (pBack) {
|
||||
Brush_AddToList(pBack, &g_brBackSplits);
|
||||
pBack->Brush_AddToList(&g_brBackSplits);
|
||||
}
|
||||
|
||||
if (pFront) {
|
||||
Brush_AddToList(pFront, &g_brFrontSplits);
|
||||
pFront->Brush_AddToList(&g_brFrontSplits);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -3237,12 +3235,12 @@ void CXYWnd::ProduceSplitLists() {
|
||||
=======================================================================================================================
|
||||
=======================================================================================================================
|
||||
*/
|
||||
void Brush_CopyList(brush_t *pFrom, brush_t *pTo) {
|
||||
brush_t *pBrush = pFrom->next;
|
||||
void Brush_CopyList(idEditorBrush *pFrom, idEditorBrush *pTo) {
|
||||
idEditorBrush *pBrush = pFrom->next;
|
||||
while (pBrush != NULL && pBrush != pFrom) {
|
||||
brush_t *pNext = pBrush->next;
|
||||
Brush_RemoveFromList(pBrush);
|
||||
Brush_AddToList(pBrush, pTo);
|
||||
idEditorBrush *pNext = pBrush->next;
|
||||
pBrush->Brush_RemoveFromList();
|
||||
pBrush->Brush_AddToList(pTo);
|
||||
pBrush = pNext;
|
||||
}
|
||||
}
|
||||
@@ -3727,8 +3725,8 @@ void CXYWnd::OnPaint() {
|
||||
if (g_Clip1.Set() && g_Clip2.Set() && selected_brushes.next != &selected_brushes) {
|
||||
ProduceSplitLists();
|
||||
|
||||
brush_t *pBrush;
|
||||
brush_t *pList = ((m_nViewType == XZ) ? !g_bSwitch : g_bSwitch) ? &g_brBackSplits : &g_brFrontSplits;
|
||||
idEditorBrush *pBrush;
|
||||
idEditorBrush *pList = ((m_nViewType == XZ) ? !g_bSwitch : g_bSwitch) ? &g_brBackSplits : &g_brFrontSplits;
|
||||
for (pBrush = pList->next; pBrush != NULL && pBrush != pList; pBrush = pBrush->next) {
|
||||
glColor3f(1, 1, 0);
|
||||
|
||||
@@ -3796,12 +3794,12 @@ void CXYWnd::OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags) {
|
||||
|
||||
//
|
||||
// =======================================================================================================================
|
||||
// FIXME: the brush_t *pBrush is never used. ( Entity_Create uses selected_brushes )
|
||||
// FIXME: the idEditorBrush *pBrush is never used. ( Entity_Create uses selected_brushes )
|
||||
// =======================================================================================================================
|
||||
//
|
||||
void CreateEntityFromName(char *pName, brush_t *pBrush, bool forceFixed, idVec3 min, idVec3 max, idVec3 org) {
|
||||
void CreateEntityFromName(char *pName, idEditorBrush *pBrush, bool forceFixed, idVec3 min, idVec3 max, idVec3 org) {
|
||||
eclass_t *pecNew;
|
||||
entity_t *petNew;
|
||||
idEditorEntity *petNew;
|
||||
if (stricmp(pName, "worldspawn") == 0) {
|
||||
g_pParentWnd->MessageBox("Can't create an entity with worldspawn.", "info", 0);
|
||||
return;
|
||||
@@ -3814,21 +3812,21 @@ void CreateEntityFromName(char *pName, brush_t *pBrush, bool forceFixed, idVec3
|
||||
}
|
||||
|
||||
// create it
|
||||
petNew = Entity_Create(pecNew, forceFixed);
|
||||
petNew = idEditorEntity::Entity_Create(pecNew, forceFixed);
|
||||
|
||||
if (petNew && idStr::Icmp(pName, "light") == 0 ) {
|
||||
idVec3 rad = max - min;
|
||||
rad *= 0.5;
|
||||
if (rad.x != 0 && rad.y != 0 && rad.z != 0) {
|
||||
SetKeyValue(petNew, "light_radius", va("%g %g %g", idMath::Fabs(rad.x), idMath::Fabs(rad.y), idMath::Fabs(rad.z)));
|
||||
DeleteKey(petNew, "light");
|
||||
petNew->SetKeyValue("light_radius", va("%g %g %g", idMath::Fabs(rad.x), idMath::Fabs(rad.y), idMath::Fabs(rad.z)));
|
||||
petNew->DeleteKey("light");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (petNew == NULL) {
|
||||
if (!((selected_brushes.next == &selected_brushes) || (selected_brushes.next->next != &selected_brushes))) {
|
||||
brush_t *b = selected_brushes.next;
|
||||
idEditorBrush *b = selected_brushes.next;
|
||||
if (b->owner != world_entity && ((b->owner->eclass->fixedsize && pecNew->fixedsize) || forceFixed)) {
|
||||
idVec3 mins, maxs;
|
||||
idVec3 origin;
|
||||
@@ -3839,13 +3837,13 @@ void CreateEntityFromName(char *pName, brush_t *pBrush, bool forceFixed, idVec3
|
||||
VectorAdd(pecNew->mins, origin, mins);
|
||||
VectorAdd(pecNew->maxs, origin, maxs);
|
||||
|
||||
brush_t *nb = Brush_Create(mins, maxs, &pecNew->texdef);
|
||||
Entity_LinkBrush(b->owner, nb);
|
||||
idEditorBrush *nb = Brush_Create(mins, maxs, &pecNew->texdef);
|
||||
b->owner->Entity_LinkBrush(nb);
|
||||
nb->owner->eclass = pecNew;
|
||||
SetKeyValue(nb->owner, "classname", pName);
|
||||
nb->owner->SetKeyValue("classname", pName);
|
||||
Brush_Free(b);
|
||||
Brush_Build(nb);
|
||||
Brush_AddToList(nb, &active_brushes);
|
||||
nb->Brush_Build();
|
||||
nb->Brush_AddToList(&active_brushes);
|
||||
Select_Brush(nb);
|
||||
return;
|
||||
}
|
||||
@@ -3858,11 +3856,11 @@ void CreateEntityFromName(char *pName, brush_t *pBrush, bool forceFixed, idVec3
|
||||
Select_Deselect();
|
||||
|
||||
//
|
||||
// entity_t* pEntity = world_entity; if (selected_brushes.next !=
|
||||
// idEditorEntity* pEntity = world_entity; if (selected_brushes.next !=
|
||||
// &selected_brushes) pEntity = selected_brushes.next->owner;
|
||||
//
|
||||
Select_Brush(petNew->brushes.onext);
|
||||
Brush_Build(petNew->brushes.onext);
|
||||
petNew->brushes.onext->Brush_Build();
|
||||
|
||||
}
|
||||
|
||||
@@ -3870,11 +3868,11 @@ void CreateEntityFromName(char *pName, brush_t *pBrush, bool forceFixed, idVec3
|
||||
=======================================================================================================================
|
||||
=======================================================================================================================
|
||||
*/
|
||||
brush_t *CreateEntityBrush(int x, int y, CXYWnd *pWnd) {
|
||||
idEditorBrush *CreateEntityBrush(int x, int y, CXYWnd *pWnd) {
|
||||
idVec3 mins, maxs;
|
||||
int i;
|
||||
float temp;
|
||||
brush_t *n;
|
||||
idEditorBrush *n;
|
||||
|
||||
pWnd->SnapToPoint(x, y, mins);
|
||||
x += 32;
|
||||
@@ -3906,9 +3904,9 @@ brush_t *CreateEntityBrush(int x, int y, CXYWnd *pWnd) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
Brush_AddToList(n, &selected_brushes);
|
||||
Entity_LinkBrush(world_entity, n);
|
||||
Brush_Build(n);
|
||||
n->Brush_AddToList(&selected_brushes);
|
||||
world_entity->Entity_LinkBrush(n);
|
||||
n->Brush_Build();
|
||||
return n;
|
||||
}
|
||||
|
||||
@@ -3924,7 +3922,7 @@ void CreateRightClickEntity(CXYWnd *pWnd, int x, int y, char *pName) {
|
||||
CRect rctZ;
|
||||
pWnd->GetClientRect(rctZ);
|
||||
|
||||
brush_t *pBrush;
|
||||
idEditorBrush *pBrush;
|
||||
if (selected_brushes.next == &selected_brushes) {
|
||||
pBrush = CreateEntityBrush(x, rctZ.Height() - 1 - y, pWnd);
|
||||
min.Zero();
|
||||
@@ -3941,10 +3939,10 @@ void CreateRightClickEntity(CXYWnd *pWnd, int x, int y, char *pName) {
|
||||
=======================================================================================================================
|
||||
=======================================================================================================================
|
||||
*/
|
||||
brush_t *CreateSmartBrush(idVec3 v) {
|
||||
idEditorBrush *CreateSmartBrush(idVec3 v) {
|
||||
idVec3 mins, maxs;
|
||||
int i;
|
||||
brush_t *n;
|
||||
idEditorBrush *n;
|
||||
|
||||
for (i = 0; i < 3; i++) {
|
||||
mins[i] = v[i] - 16;
|
||||
@@ -3956,10 +3954,10 @@ brush_t *CreateSmartBrush(idVec3 v) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
Brush_AddToList(n, &selected_brushes);
|
||||
n->Brush_AddToList(&selected_brushes);
|
||||
|
||||
// Entity_LinkBrush(world_entity, n);
|
||||
Brush_Build(n);
|
||||
// world_entity->Entity_LinkBrush(n);
|
||||
n->Brush_Build();
|
||||
return n;
|
||||
}
|
||||
|
||||
@@ -4016,11 +4014,11 @@ void CreateSmartEntity(CXYWnd *pWnd, int x, int y, const char *pName) {
|
||||
array.Add(reinterpret_cast < void * > (selected_brushes.next));
|
||||
Select_Deselect();
|
||||
|
||||
brush_t *pBrush = CreateSmartBrush(g_PathPoints[0]);
|
||||
idEditorBrush *pBrush = CreateSmartBrush(g_PathPoints[0]);
|
||||
array.Add(pBrush);
|
||||
Select_Deselect();
|
||||
Select_Brush(reinterpret_cast < brush_t * > (array.GetAt(0)));
|
||||
Select_Brush(reinterpret_cast < brush_t * > (array.GetAt(1)));
|
||||
Select_Brush(reinterpret_cast < idEditorBrush * > (array.GetAt(0)));
|
||||
Select_Brush(reinterpret_cast < idEditorBrush * > (array.GetAt(1)));
|
||||
ConnectEntities();
|
||||
g_bScreenUpdates = true;
|
||||
}
|
||||
@@ -4034,7 +4032,7 @@ void FinishSmartCreation() {
|
||||
CPtrArray array;
|
||||
HideInfoDialog();
|
||||
|
||||
brush_t *pEntities = NULL;
|
||||
idEditorBrush *pEntities = NULL;
|
||||
if (g_strSmartEntity.Find("Smart_Train") >= 0) {
|
||||
g_bScreenUpdates = false;
|
||||
CreateRightClickEntity(g_pParentWnd->ActiveXY(), g_nSmartX, g_nSmartY, "func_train");
|
||||
@@ -4054,8 +4052,8 @@ void FinishSmartCreation() {
|
||||
|
||||
for (n = 0; n < g_nPathCount; n++) {
|
||||
Select_Deselect();
|
||||
Select_Brush(reinterpret_cast < brush_t * > (array.GetAt(n)));
|
||||
Select_Brush(reinterpret_cast < brush_t * > (array.GetAt(n + 1)));
|
||||
Select_Brush(reinterpret_cast < idEditorBrush * > (array.GetAt(n)));
|
||||
Select_Brush(reinterpret_cast < idEditorBrush * > (array.GetAt(n + 1)));
|
||||
ConnectEntities();
|
||||
}
|
||||
|
||||
@@ -4102,7 +4100,7 @@ void CXYWnd::OnEntityCreate(unsigned int nID) {
|
||||
}
|
||||
else if (strItem.CompareNoCase("Remove") == 0) {
|
||||
// remove selected brushes from their current group
|
||||
brush_t *b;
|
||||
idEditorBrush *b;
|
||||
for (b = selected_brushes.next; b != &selected_brushes; b = b->next) {
|
||||
}
|
||||
}
|
||||
@@ -4687,7 +4685,7 @@ void CXYWnd::NewBrushDrag(int x, int y) {
|
||||
idVec3 mins, maxs, junk;
|
||||
int i;
|
||||
float temp;
|
||||
brush_t *n;
|
||||
idEditorBrush *n;
|
||||
|
||||
if ( radiant_entityMode.GetBool() ) {
|
||||
return;
|
||||
@@ -4735,11 +4733,11 @@ void CXYWnd::NewBrushDrag(int x, int y) {
|
||||
g_strStatus.Format("Size X:: %.1f Y:: %.1f Z:: %.1f", vSize[0], vSize[1], vSize[2]);
|
||||
g_pParentWnd->SetStatusText(2, g_strStatus);
|
||||
|
||||
Brush_AddToList(n, &selected_brushes);
|
||||
n->Brush_AddToList(&selected_brushes);
|
||||
|
||||
Entity_LinkBrush(world_entity, n);
|
||||
world_entity->Entity_LinkBrush(n);
|
||||
|
||||
Brush_Build(n);
|
||||
n->Brush_Build();
|
||||
|
||||
// Sys_UpdateWindows (W_ALL);
|
||||
Sys_UpdateWindows(W_XY | W_CAMERA);
|
||||
@@ -5327,7 +5325,7 @@ void CXYWnd::DrawZIcon(void) {
|
||||
FilterBrush
|
||||
=======================================================================================================================
|
||||
*/
|
||||
bool FilterBrush(brush_t *pb) {
|
||||
bool FilterBrush(idEditorBrush *pb) {
|
||||
|
||||
if (!pb->owner) {
|
||||
return false; // during construction
|
||||
@@ -5476,8 +5474,8 @@ bool FilterBrush(brush_t *pb) {
|
||||
*/
|
||||
struct pathLineNamedEntity_t {
|
||||
const char* name;
|
||||
entity_t* entity;
|
||||
brush_t* brush;
|
||||
idEditorEntity* entity;
|
||||
idEditorBrush* brush;
|
||||
};
|
||||
|
||||
static bool DrawPathLines_IsTargetKey(const char* key) {
|
||||
@@ -5502,22 +5500,22 @@ static bool DrawPathLines_IsTargetKey(const char* key) {
|
||||
return true;
|
||||
}
|
||||
|
||||
static brush_t* DrawPathLines_FirstBrush(entity_t* ent) {
|
||||
static idEditorBrush* DrawPathLines_FirstBrush(idEditorEntity* ent) {
|
||||
if (ent == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
brush_t* brush = ent->brushes.onext;
|
||||
idEditorBrush* brush = ent->brushes.onext;
|
||||
return (brush != &ent->brushes) ? brush : NULL;
|
||||
}
|
||||
|
||||
static void DrawPathLines_AppendNamedEntity(idList<pathLineNamedEntity_t>& namedEntities, idHashIndex& nameHash, entity_t* ent) {
|
||||
const char* name = ValueForKey(ent, "name");
|
||||
static void DrawPathLines_AppendNamedEntity(idList<pathLineNamedEntity_t>& namedEntities, idHashIndex& nameHash, idEditorEntity* ent) {
|
||||
const char* name = ent->ValueForKey("name");
|
||||
if (name == NULL || name[0] == '\0') {
|
||||
return;
|
||||
}
|
||||
|
||||
brush_t* brush = DrawPathLines_FirstBrush(ent);
|
||||
idEditorBrush* brush = DrawPathLines_FirstBrush(ent);
|
||||
if (brush == NULL) {
|
||||
return;
|
||||
}
|
||||
@@ -5531,7 +5529,7 @@ static void DrawPathLines_AppendNamedEntity(idList<pathLineNamedEntity_t>& named
|
||||
nameHash.Add(nameHash.GenerateKey(name, true), index);
|
||||
}
|
||||
|
||||
static void DrawPathLines_DrawConnection(const pathLineNamedEntity_t& namedTarget, entity_t* source, brush_t* sourceBrush) {
|
||||
static void DrawPathLines_DrawConnection(const pathLineNamedEntity_t& namedTarget, idEditorEntity* source, idEditorBrush* sourceBrush) {
|
||||
if (namedTarget.entity == NULL || namedTarget.entity->eclass == NULL || source == NULL || sourceBrush == NULL) {
|
||||
return;
|
||||
}
|
||||
@@ -5577,12 +5575,12 @@ void DrawPathLines(void) {
|
||||
idHashIndex nameHash(1024, 1024);
|
||||
namedEntities.SetGranularity(256);
|
||||
|
||||
for (entity_t* ent = entities.next; ent != &entities; ent = ent->next) {
|
||||
for (idEditorEntity* ent = entities.next; ent != &entities; ent = ent->next) {
|
||||
DrawPathLines_AppendNamedEntity(namedEntities, nameHash, ent);
|
||||
}
|
||||
|
||||
for (entity_t* source = entities.next; source != &entities; source = source->next) {
|
||||
brush_t* sourceBrush = DrawPathLines_FirstBrush(source);
|
||||
for (idEditorEntity* source = entities.next; source != &entities; source = source->next) {
|
||||
idEditorBrush* sourceBrush = DrawPathLines_FirstBrush(source);
|
||||
if (sourceBrush == NULL) {
|
||||
continue;
|
||||
}
|
||||
@@ -5736,7 +5734,7 @@ void CXYWnd::PaintSizeInfo(int nDim1, int nDim2, idVec3 vMinBounds, idVec3 vMaxB
|
||||
/* XY_Draw */
|
||||
long g_lCount = 0;
|
||||
long g_lTotal = 0;
|
||||
extern void DrawBrushEntityName(brush_t *b);
|
||||
extern void DrawBrushEntityName(idEditorBrush *b);
|
||||
|
||||
/*
|
||||
=======================================================================================================================
|
||||
@@ -5747,9 +5745,9 @@ void CXYWnd::XY_Draw() {
|
||||
return;
|
||||
}
|
||||
|
||||
brush_t *brush;
|
||||
idEditorBrush *brush;
|
||||
float w, h;
|
||||
entity_t *e;
|
||||
idEditorEntity *e;
|
||||
idVec3 mins, maxs;
|
||||
int drawn, culled;
|
||||
int i;
|
||||
@@ -5837,7 +5835,7 @@ void CXYWnd::XY_Draw() {
|
||||
glColor3fv(g_qeglobals.d_savedinfo.colors[COLOR_BRUSHES].ToFloatPtr());
|
||||
}
|
||||
|
||||
Brush_DrawXY( brush, m_nViewType );
|
||||
brush->Brush_DrawXY(m_nViewType );
|
||||
}
|
||||
|
||||
DrawPathLines();
|
||||
@@ -5901,7 +5899,7 @@ void CXYWnd::XY_Draw() {
|
||||
bool bFixedSize = false;
|
||||
for (brush = selected_brushes.next; brush != &selected_brushes; brush = brush->next) {
|
||||
drawn++;
|
||||
Brush_DrawXY(brush, m_nViewType, true);
|
||||
brush->Brush_DrawXY(m_nViewType, true);
|
||||
|
||||
if (!bFixedSize) {
|
||||
if (brush->owner->eclass->fixedsize) {
|
||||
@@ -6073,7 +6071,7 @@ void CXYWnd::OnSize(UINT nType, int cx, int cy) {
|
||||
InvalidateRect(NULL, false);
|
||||
}
|
||||
|
||||
brush_t hold_brushes;
|
||||
idEditorBrush hold_brushes;
|
||||
|
||||
/*
|
||||
=======================================================================================================================
|
||||
@@ -6084,8 +6082,8 @@ void CXYWnd::Clip() {
|
||||
hold_brushes.next = &hold_brushes;
|
||||
ProduceSplitLists();
|
||||
|
||||
// brush_t* pList = (g_bSwitch) ? &g_brFrontSplits : &g_brBackSplits;
|
||||
brush_t *pList;
|
||||
// idEditorBrush* pList = (g_bSwitch) ? &g_brFrontSplits : &g_brBackSplits;
|
||||
idEditorBrush *pList;
|
||||
if (g_PrefsDlg.m_bSwitchClip) {
|
||||
pList = ((m_nViewType == XZ) ? g_bSwitch : !g_bSwitch) ? &g_brFrontSplits : &g_brBackSplits;
|
||||
}
|
||||
@@ -6159,7 +6157,7 @@ void CXYWnd::FlipClip() {
|
||||
void CXYWnd::PositionView() {
|
||||
int nDim1 = (m_nViewType == YZ) ? 1 : 0;
|
||||
int nDim2 = (m_nViewType == XY) ? 1 : 2;
|
||||
brush_t *b = selected_brushes.next;
|
||||
idEditorBrush *b = selected_brushes.next;
|
||||
if (b && b->next != b) {
|
||||
m_vOrigin[nDim1] = b->mins[nDim1];
|
||||
m_vOrigin[nDim2] = b->mins[nDim2];
|
||||
@@ -6292,12 +6290,12 @@ void CXYWnd::OnSelectMouserotate() {
|
||||
=======================================================================================================================
|
||||
*/
|
||||
void CleanCopyEntities() {
|
||||
entity_t *pe = g_enClipboard.next;
|
||||
idEditorEntity *pe = g_enClipboard.next;
|
||||
while (pe != NULL && pe != &g_enClipboard) {
|
||||
entity_t *next = pe->next;
|
||||
idEditorEntity *next = pe->next;
|
||||
pe->epairs.Clear();
|
||||
|
||||
Entity_Free(pe);
|
||||
idEditorEntity::Entity_Free(pe);
|
||||
pe = next;
|
||||
}
|
||||
|
||||
@@ -6308,10 +6306,10 @@ void CleanCopyEntities() {
|
||||
=======================================================================================================================
|
||||
=======================================================================================================================
|
||||
*/
|
||||
entity_t *Entity_CopyClone(entity_t *e) {
|
||||
entity_t *n;
|
||||
idEditorEntity *Entity_CopyClone(idEditorEntity *e) {
|
||||
idEditorEntity *n;
|
||||
|
||||
n = Entity_New();
|
||||
n = idEditorEntity::Entity_New();
|
||||
n->brushes.onext = n->brushes.oprev = &n->brushes;
|
||||
n->eclass = e->eclass;
|
||||
n->rotation = e->rotation;
|
||||
@@ -6331,10 +6329,10 @@ entity_t *Entity_CopyClone(entity_t *e) {
|
||||
=======================================================================================================================
|
||||
=======================================================================================================================
|
||||
*/
|
||||
bool OnList(entity_t *pFind, CPtrArray *pList) {
|
||||
bool OnList(idEditorEntity *pFind, CPtrArray *pList) {
|
||||
int nSize = pList->GetSize();
|
||||
while (nSize-- > 0) {
|
||||
entity_t *pEntity = reinterpret_cast < entity_t * > (pList->GetAt(nSize));
|
||||
idEditorEntity *pEntity = reinterpret_cast < idEditorEntity * > (pList->GetAt(nSize));
|
||||
if (pEntity == pFind) {
|
||||
return true;
|
||||
}
|
||||
@@ -6391,24 +6389,24 @@ void CXYWnd::Copy()
|
||||
CPtrArray holdArray;
|
||||
CleanList(&g_brClipboard);
|
||||
CleanCopyEntities();
|
||||
for (brush_t * pBrush = selected_brushes.next; pBrush != NULL && pBrush != &selected_brushes; pBrush = pBrush->next) {
|
||||
for (idEditorBrush * pBrush = selected_brushes.next; pBrush != NULL && pBrush != &selected_brushes; pBrush = pBrush->next) {
|
||||
if (pBrush->owner == world_entity) {
|
||||
brush_t *pClone = Brush_Clone(pBrush);
|
||||
idEditorBrush *pClone = Brush_Clone(pBrush);
|
||||
pClone->owner = NULL;
|
||||
Brush_AddToList(pClone, &g_brClipboard);
|
||||
pClone->Brush_AddToList(&g_brClipboard);
|
||||
}
|
||||
else {
|
||||
if (!OnList(pBrush->owner, &holdArray)) {
|
||||
entity_t *e = pBrush->owner;
|
||||
idEditorEntity *e = pBrush->owner;
|
||||
holdArray.Add(reinterpret_cast < void * > (e));
|
||||
|
||||
entity_t *pEClone = Entity_CopyClone(e);
|
||||
for (brush_t * pEB = e->brushes.onext; pEB != &e->brushes; pEB = pEB->onext) {
|
||||
brush_t *pClone = Brush_Clone(pEB);
|
||||
idEditorEntity *pEClone = Entity_CopyClone(e);
|
||||
for (idEditorBrush * pEB = e->brushes.onext; pEB != &e->brushes; pEB = pEB->onext) {
|
||||
idEditorBrush *pClone = Brush_Clone(pEB);
|
||||
|
||||
// Brush_AddToList (pClone, &g_brClipboard);
|
||||
Entity_LinkBrush(pEClone, pClone);
|
||||
Brush_Build(pClone);
|
||||
// pClone->Brush_AddToList(&g_brClipboard);
|
||||
pEClone->Entity_LinkBrush(pClone);
|
||||
pClone->Brush_Build();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -6423,10 +6421,10 @@ void CXYWnd::Copy()
|
||||
void CXYWnd::Undo() {
|
||||
/*
|
||||
* if (g_brUndo.next != &g_brUndo) { g_bScreenUpdates = false; Select_Delete();
|
||||
* for (brush_t* pBrush = g_brUndo.next ; pBrush != NULL && pBrush != &g_brUndo ;
|
||||
* pBrush=pBrush->next) { brush_t* pClone = Brush_Clone(pBrush); Brush_AddToList
|
||||
* (pClone, &active_brushes); Entity_LinkBrush (pBrush->pUndoOwner, pClone);
|
||||
* Brush_Build(pClone); Select_Brush(pClone); } CleanList(&g_brUndo);
|
||||
* for (idEditorBrush* pBrush = g_brUndo.next ; pBrush != NULL && pBrush != &g_brUndo ;
|
||||
* pBrush=pBrush->next) { idEditorBrush* pClone = Brush_Clone(pBrush); Brush_AddToList
|
||||
* (pClone, &active_brushes); pBrush->pUndoOwner->Entity_LinkBrush(pClone);
|
||||
* pClone->Brush_Build(); Select_Brush(pClone); } CleanList(&g_brUndo);
|
||||
* g_bScreenUpdates = true; Sys_UpdateWindows(W_ALL); } else common->Printf("Nothing
|
||||
* to undo.../n");
|
||||
*/
|
||||
@@ -6446,8 +6444,8 @@ void CXYWnd::UndoClear() {
|
||||
*/
|
||||
void CXYWnd::UndoCopy() {
|
||||
/*
|
||||
* CleanList(&g_brUndo); for (brush_t* pBrush = selected_brushes.next ; pBrush !=
|
||||
* NULL && pBrush != &selected_brushes ; pBrush=pBrush->next) { brush_t* pClone =
|
||||
* CleanList(&g_brUndo); for (idEditorBrush* pBrush = selected_brushes.next ; pBrush !=
|
||||
* NULL && pBrush != &selected_brushes ; pBrush=pBrush->next) { idEditorBrush* pClone =
|
||||
* Brush_Clone(pBrush); pClone->pUndoOwner = pBrush->owner; Brush_AddToList
|
||||
* (pClone, &g_brUndo); }
|
||||
*/
|
||||
@@ -6516,30 +6514,30 @@ void CXYWnd::Paste()
|
||||
if (g_brClipboard.next != &g_brClipboard || g_enClipboard.next != &g_enClipboard) {
|
||||
Select_Deselect();
|
||||
|
||||
for (brush_t * pBrush = g_brClipboard.next; pBrush != NULL && pBrush != &g_brClipboard; pBrush = pBrush->next) {
|
||||
brush_t *pClone = Brush_Clone(pBrush);
|
||||
for (idEditorBrush * pBrush = g_brClipboard.next; pBrush != NULL && pBrush != &g_brClipboard; pBrush = pBrush->next) {
|
||||
idEditorBrush *pClone = Brush_Clone(pBrush);
|
||||
|
||||
// pClone->owner = pBrush->owner;
|
||||
if (pClone->owner == NULL) {
|
||||
Entity_LinkBrush(world_entity, pClone);
|
||||
world_entity->Entity_LinkBrush(pClone);
|
||||
}
|
||||
|
||||
Brush_AddToList(pClone, &selected_brushes);
|
||||
Brush_Build(pClone);
|
||||
pClone->Brush_AddToList(&selected_brushes);
|
||||
pClone->Brush_Build();
|
||||
}
|
||||
|
||||
for
|
||||
(
|
||||
entity_t * pEntity = g_enClipboard.next;
|
||||
idEditorEntity * pEntity = g_enClipboard.next;
|
||||
pEntity != NULL && pEntity != &g_enClipboard;
|
||||
pEntity = pEntity->next
|
||||
) {
|
||||
entity_t *pEClone = Entity_Clone(pEntity);
|
||||
for (brush_t * pEB = pEntity->brushes.onext; pEB != &pEntity->brushes; pEB = pEB->onext) {
|
||||
brush_t *pClone = Brush_Clone(pEB);
|
||||
Brush_AddToList(pClone, &selected_brushes);
|
||||
Entity_LinkBrush(pEClone, pClone);
|
||||
Brush_Build(pClone);
|
||||
idEditorEntity *pEClone = idEditorEntity::Entity_Clone(pEntity);
|
||||
for (idEditorBrush * pEB = pEntity->brushes.onext; pEB != &pEntity->brushes; pEB = pEB->onext) {
|
||||
idEditorBrush *pClone = Brush_Clone(pEB);
|
||||
pClone->Brush_AddToList(&selected_brushes);
|
||||
pEClone->Entity_LinkBrush(pClone);
|
||||
pClone->Brush_Build();
|
||||
if (pClone->owner && pClone->owner != world_entity) {
|
||||
g_Inspectors->UpdateEntitySel(pClone->owner->eclass);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user