entity_t and brush_t now converted to idEditorEntity and idEditorBrush

This commit is contained in:
Justin Marshall
2026-05-24 11:33:16 -07:00
parent d6d01e1faf
commit 3242531044
41 changed files with 1598 additions and 1540 deletions
+145 -150
View File
@@ -38,14 +38,12 @@ CPtrArray g_SelectedFaceBrushes;
CPtrArray &g_ptrSelectedFaces = g_SelectedFaces;
CPtrArray &g_ptrSelectedFaceBrushes = g_SelectedFaceBrushes;
extern void Brush_Resize(brush_t *b, idVec3 vMin, idVec3 vMax);
/*
=======================================================================================================================
=======================================================================================================================
*/
qertrace_t Test_Ray(const idVec3 &origin, const idVec3 &dir, int flags) {
brush_t *brush;
idEditorBrush *brush;
face_t *face;
float dist;
qertrace_t t;
@@ -66,7 +64,7 @@ qertrace_t Test_Ray(const idVec3 &origin, const idVec3 &dir, int flags) {
if (flags & SF_CYCLE) {
CPtrArray array;
brush_t *pToSelect = (selected_brushes.next != &selected_brushes) ? selected_brushes.next : NULL;
idEditorBrush *pToSelect = (selected_brushes.next != &selected_brushes) ? selected_brushes.next : NULL;
Select_Deselect();
// go through active brushes and accumulate all "hit" brushes
@@ -89,7 +87,7 @@ qertrace_t Test_Ray(const idVec3 &origin, const idVec3 &dir, int flags) {
}
// if (!g_bShowPatchBounds && brush->pPatch) continue;
face = Brush_Ray(origin, dir, brush, &dist, true);
face = brush->Brush_Ray(origin, dir, &dist, true);
if (face) {
array.Add(brush);
@@ -100,25 +98,25 @@ qertrace_t Test_Ray(const idVec3 &origin, const idVec3 &dir, int flags) {
if (nSize > 0) {
bool bFound = false;
for (int i = 0; i < nSize; i++) {
brush_t *b = reinterpret_cast < brush_t * > (array.GetAt(i));
idEditorBrush *b = reinterpret_cast < idEditorBrush * > (array.GetAt(i));
// did we hit the last one selected yet ?
if (b == pToSelect) {
// yes we want to select the next one in the list
int n = (i > 0) ? i - 1 : nSize - 1;
pToSelect = reinterpret_cast < brush_t * > (array.GetAt(n));
pToSelect = reinterpret_cast < idEditorBrush * > (array.GetAt(n));
bFound = true;
break;
}
}
if (!bFound) {
pToSelect = reinterpret_cast < brush_t * > (array.GetAt(0));
pToSelect = reinterpret_cast < idEditorBrush * > (array.GetAt(0));
}
}
if (pToSelect) {
face = Brush_Ray(origin, dir, pToSelect, &dist, true);
face = pToSelect->Brush_Ray(origin, dir, &dist, true);
t.dist = dist;
t.brush = pToSelect;
t.face = face;
@@ -149,7 +147,7 @@ qertrace_t Test_Ray(const idVec3 &origin, const idVec3 &dir, int flags) {
}
}
face = Brush_Ray(origin, dir, brush, &dist, true);
face = brush->Brush_Ray(origin, dir, &dist, true);
if (dist > 0 && dist < t.dist) {
t.dist = dist;
t.brush = brush;
@@ -180,7 +178,7 @@ qertrace_t Test_Ray(const idVec3 &origin, const idVec3 &dir, int flags) {
}
}
face = Brush_Ray(origin, dir, brush, &dist, true);
face = brush->Brush_Ray(origin, dir, &dist, true);
if (dist > 0 && dist < t.dist) {
t.dist = dist;
t.brush = brush;
@@ -197,18 +195,17 @@ qertrace_t Test_Ray(const idVec3 &origin, const idVec3 &dir, int flags) {
return t;
}
extern void AddSelectablePoint(brush_t *b, idVec3 v, int type, bool priority);
extern void ClearSelectablePoints(brush_t *b);
extern idVec3 Brush_TransformedPoint(brush_t *b, const idVec3 &in);
extern void AddSelectablePoint(idEditorBrush *b, idVec3 v, int type, bool priority);
extern void ClearSelectablePoints(idEditorBrush *b);
/*
=======================================================================================================================
Select_Brush
=======================================================================================================================
*/
void Select_Brush(brush_t *brush, bool bComplete, bool bStatus) {
brush_t *b;
entity_t *e;
void Select_Brush(idEditorBrush *brush, bool bComplete, bool bStatus) {
idEditorBrush *b;
idEditorEntity *e;
g_ptrSelectedFaces.RemoveAll();
g_ptrSelectedFaceBrushes.RemoveAll();
@@ -235,15 +232,15 @@ void Select_Brush(brush_t *brush, bool bComplete, bool bStatus) {
}
for (b = e->brushes.onext; b != &e->brushes; b = b->onext) {
Brush_RemoveFromList(b);
Brush_AddToList(b, &selected_brushes);
b->Brush_RemoveFromList();
b->Brush_AddToList(&selected_brushes);
}
}
else
{
singleselect:
Brush_RemoveFromList(brush);
Brush_AddToList(brush, &selected_brushes);
brush->Brush_RemoveFromList();
brush->Brush_AddToList(&selected_brushes);
UpdateSurfaceDialog();
UpdatePatchInspector();
UpdateLightInspector();
@@ -252,7 +249,7 @@ singleselect:
if (e->eclass) {
g_Inspectors->UpdateEntitySel(brush->owner->eclass);
if ( radiant_entityMode.GetBool() && e->eclass->nShowFlags & (ECLASS_LIGHT | ECLASS_SPEAKER) ) {
const char *p = ValueForKey(e, "s_shader");
const char *p = e->ValueForKey("s_shader");
if (p && *p) {
g_Inspectors->mediaDlg.SelectCurrentItem(true, p, CDialogTextures::SOUNDS);
}
@@ -262,16 +259,16 @@ singleselect:
if (brush->pointLight) {
// add center drag point if not at the origin
if (brush->lightCenter[0] || brush->lightCenter[1] || brush->lightCenter[2]) {
AddSelectablePoint(brush, Brush_TransformedPoint(brush, brush->lightCenter), LIGHT_CENTER, false);
AddSelectablePoint(brush, brush->Brush_TransformedPoint(brush->lightCenter), LIGHT_CENTER, false);
}
}
else {
AddSelectablePoint(brush, Brush_TransformedPoint(brush, brush->lightTarget), LIGHT_TARGET, true);
AddSelectablePoint(brush, Brush_TransformedPoint(brush, brush->lightUp), LIGHT_UP, false);
AddSelectablePoint(brush, Brush_TransformedPoint(brush, brush->lightRight), LIGHT_RIGHT, false);
AddSelectablePoint(brush, brush->Brush_TransformedPoint(brush->lightTarget), LIGHT_TARGET, true);
AddSelectablePoint(brush, brush->Brush_TransformedPoint(brush->lightUp), LIGHT_UP, false);
AddSelectablePoint(brush, brush->Brush_TransformedPoint(brush->lightRight), LIGHT_RIGHT, false);
if (brush->startEnd) {
AddSelectablePoint(brush, Brush_TransformedPoint(brush, brush->lightStart), LIGHT_START, false);
AddSelectablePoint(brush, Brush_TransformedPoint(brush, brush->lightEnd), LIGHT_END, false);
AddSelectablePoint(brush, brush->Brush_TransformedPoint(brush->lightStart), LIGHT_START, false);
AddSelectablePoint(brush, brush->Brush_TransformedPoint(brush->lightEnd), LIGHT_END, false);
}
}
UpdateLightInspector();
@@ -326,8 +323,8 @@ void Select_Ray(idVec3 origin, idVec3 dir, int flags) {
face_t *face;
// DeSelect brush
Brush_RemoveFromList(t.brush);
Brush_AddToList(t.brush, &active_brushes);
t.brush->Brush_RemoveFromList();
t.brush->Brush_AddToList(&active_brushes);
// Select all brush faces
for ( face = t.brush->brush_faces; face; face = face->next ) {
@@ -370,12 +367,12 @@ void Select_Ray(idVec3 origin, idVec3 dir, int flags) {
g_qeglobals.d_select_mode = sel_brush;
if (t.selected) {
Brush_RemoveFromList(t.brush);
Brush_AddToList(t.brush, &active_brushes);
t.brush->Brush_RemoveFromList();
t.brush->Brush_AddToList(&active_brushes);
UpdatePatchInspector();
UpdateSurfaceDialog();
entity_t *e = t.brush->owner;
idEditorEntity *e = t.brush->owner;
if (e->eclass->nShowFlags & ECLASS_LIGHT && !t.brush->entityModel) {
if (t.brush->pointLight) {
}
@@ -396,7 +393,7 @@ void Select_Ray(idVec3 origin, idVec3 dir, int flags) {
=======================================================================================================================
*/
void Select_Delete(void) {
brush_t *brush;
idEditorBrush *brush;
g_ptrSelectedFaces.RemoveAll();
g_ptrSelectedFaceBrushes.RemoveAll();
@@ -425,7 +422,7 @@ void Select_Delete(void) {
=======================================================================================================================
*/
void Select_Deselect(bool bDeselectFaces) {
brush_t *b;
idEditorBrush *b;
ClearSelectablePoints(NULL);
Patch_Deselect();
@@ -481,14 +478,14 @@ void Select_Deselect(bool bDeselectFaces) {
=======================================================================================================================
*/
void Select_Move(idVec3 delta, bool bSnap) {
brush_t *b;
idEditorBrush *b;
// actually move the selected brushes
bool updateOrigin = true;
entity_t *lastOwner = selected_brushes.next->owner;
idEditorEntity *lastOwner = selected_brushes.next->owner;
for (b = selected_brushes.next; b != &selected_brushes; b = b->next) {
Brush_Move(b, delta, bSnap, updateOrigin);
b->Brush_Move(delta, bSnap, updateOrigin);
if (updateOrigin) {
updateOrigin = false;
}
@@ -537,17 +534,17 @@ void Select_Clone(void) {
=======================================================================================================================
*/
void WINAPI Select_SetTexture(texdef_t *texdef,brushprimit_texdef_t *brushprimit_texdef,bool bFitScale,void *pPlugTexdef,bool update) {
brush_t *b;
idEditorBrush *b;
int nCount = g_ptrSelectedFaces.GetSize();
if (nCount > 0) {
Undo_Start("set face textures");
ASSERT(g_ptrSelectedFaces.GetSize() == g_ptrSelectedFaceBrushes.GetSize());
for (int i = 0; i < nCount; i++) {
face_t *selFace = reinterpret_cast < face_t * > (g_ptrSelectedFaces.GetAt(i));
brush_t *selBrush = reinterpret_cast < brush_t * > (g_ptrSelectedFaceBrushes.GetAt(i));
idEditorBrush *selBrush = reinterpret_cast < idEditorBrush * > (g_ptrSelectedFaceBrushes.GetAt(i));
Undo_AddBrush(selBrush);
SetFaceTexdef(selBrush,selFace,texdef,brushprimit_texdef,bFitScale);
Brush_Build(selBrush, bFitScale);
selBrush->Brush_Build(bFitScale);
Undo_EndBrush(selBrush);
}
@@ -558,17 +555,17 @@ void WINAPI Select_SetTexture(texdef_t *texdef,brushprimit_texdef_t *brushprimit
for (b = selected_brushes.next; b != &selected_brushes; b = b->next) {
if (!b->owner->eclass->fixedsize) {
Undo_AddBrush(b);
Brush_SetTexture(b, texdef, brushprimit_texdef, bFitScale);
b->Brush_SetTexture(texdef, brushprimit_texdef, bFitScale);
Undo_EndBrush(b);
} else if (b->owner->eclass->nShowFlags & ECLASS_LIGHT) {
if ( idStr::Cmpn(texdef->name, "lights/", strlen("lights/")) == 0 ) {
SetKeyValue(b->owner, "texture", texdef->name);
b->owner->SetKeyValue("texture", texdef->name);
g_Inspectors->UpdateEntitySel(b->owner->eclass);
UpdateLightInspector();
Brush_Build(b);
b->Brush_Build();
} else {
Undo_AddBrush(b);
Brush_SetTexture(b, texdef, brushprimit_texdef, bFitScale);
b->Brush_SetTexture(texdef, brushprimit_texdef, bFitScale);
Undo_EndBrush(b);
}
}
@@ -588,7 +585,7 @@ void WINAPI Select_SetTexture(texdef_t *texdef,brushprimit_texdef_t *brushprimit
=======================================================================================================================
*/
void Select_GetBounds(idVec3 &mins, idVec3 &maxs) {
brush_t *b;
idEditorBrush *b;
int i;
for (i = 0; i < 3; i++) {
@@ -656,7 +653,7 @@ int select_flipAxis;
float select_orgDeg;
void Select_InitializeRotation() {
for (brush_t *b = selected_brushes.next; b != &selected_brushes; b = b->next) {
for (idEditorBrush *b = selected_brushes.next; b != &selected_brushes; b = b->next) {
for (face_t *f = b->brush_faces; f; f = f->next) {
for (int i = 0; i < 3; i++) {
f->orgplanepts[i] = f->planepts[i];
@@ -671,7 +668,7 @@ void Select_FinalizeRotation() {
}
bool Select_OnlyModelsSelected() {
for (brush_t *b = selected_brushes.next; b != &selected_brushes; b = b->next) {
for (idEditorBrush *b = selected_brushes.next; b != &selected_brushes; b = b->next) {
if (!b->modelHandle) {
return false;
}
@@ -679,7 +676,7 @@ bool Select_OnlyModelsSelected() {
return true;
}
bool OkForRotationKey(brush_t *b) {
bool OkForRotationKey(idEditorBrush *b) {
if (b->owner->eclass->nShowFlags & ECLASS_WORLDSPAWN) {
return false;
}
@@ -746,16 +743,14 @@ void VectorRotate3Origin( const idVec3 &vIn, const idVec3 &vRotation, const idVe
=======================================================================================================================
=======================================================================================================================
*/
extern void Brush_Rotate(brush_t *b, idMat3 matrix, idVec3 origin, bool bBuild);
void Select_ApplyMatrix(bool bSnap, bool rotateOrigins) {
brush_t *b;
idEditorBrush *b;
face_t *f;
int i;
idVec3 temp;
idStr str;
char text[128];
entity_t *lastOwner = NULL;
idEditorEntity *lastOwner = NULL;
for (b = selected_brushes.next; b != &selected_brushes; b = b->next) {
@@ -765,11 +760,11 @@ void Select_ApplyMatrix(bool bSnap, bool rotateOrigins) {
if (rotateOrigins) {
b->owner->rotation *= select_matrix;
b->owner->origin *= select_rotation;
SetKeyVec3(b->owner, "origin", b->owner->origin);
b->owner->SetKeyVec3("origin", b->owner->origin);
if (b->trackLightOrigin) {
b->owner->lightRotation *= select_matrix;
b->owner->lightOrigin *= select_rotation;
SetKeyVec3(b->owner, "light_origin", b->owner->lightOrigin);
b->owner->SetKeyVec3("light_origin", b->owner->lightOrigin);
}
} else {
@@ -806,7 +801,7 @@ void Select_ApplyMatrix(bool bSnap, bool rotateOrigins) {
bo2 = b->modelHandle->Bounds();
}
bo.FromTransformedBounds(bo2, b->owner->origin, b->owner->rotation);
Brush_Resize(b, bo[0], bo[1]);
b->Brush_Resize(bo[0], bo[1]);
doBrush = false;
}
if (b->owner->eclass->fixedsize) {
@@ -820,7 +815,7 @@ void Select_ApplyMatrix(bool bSnap, bool rotateOrigins) {
b->owner->origin += select_origin;
sprintf(text, "%i %i %i", (int)b->owner->origin[0], (int)b->owner->origin[1], (int)b->owner->origin[2]);
SetKeyValue(b->owner, "origin", text);
b->owner->SetKeyValue("origin", text);
}
@@ -829,17 +824,17 @@ void Select_ApplyMatrix(bool bSnap, bool rotateOrigins) {
sprintf(str, "%g %g %g %g %g %g %g %g %g",b->owner->rotation[0][0],b->owner->rotation[0][1],b->owner->rotation[0][2],
b->owner->rotation[1][0],b->owner->rotation[1][1],b->owner->rotation[1][2],b->owner->rotation[2][0],
b->owner->rotation[2][1],b->owner->rotation[2][2]);
SetKeyValue(b->owner, "rotation", str);
b->owner->SetKeyValue("rotation", str);
}
if (b->trackLightOrigin) {
sprintf(str, "%g %g %g %g %g %g %g %g %g",b->owner->lightRotation[0][0],b->owner->lightRotation[0][1],b->owner->lightRotation[0][2],
b->owner->lightRotation[1][0],b->owner->lightRotation[1][1],b->owner->lightRotation[1][2],b->owner->lightRotation[2][0],
b->owner->lightRotation[2][1],b->owner->lightRotation[2][2]);
SetKeyValue(b->owner, "light_rotation", str);
b->owner->SetKeyValue("light_rotation", str);
}
DeleteKey(b->owner, "angle");
DeleteKey(b->owner, "angles");
b->owner->DeleteKey("angle");
b->owner->DeleteKey("angles");
}
if (doBrush) {
@@ -865,9 +860,9 @@ void Select_ApplyMatrix(bool bSnap, bool rotateOrigins) {
min = b->owner->origin + b->owner->eclass->mins;
max = b->owner->origin + b->owner->eclass->maxs;
}
Brush_Resize(b, min, max);
b->Brush_Resize(min, max);
} else {
Brush_Build(b, bSnap);
b->Brush_Build(bSnap);
}
if (b->pPatch) {
@@ -923,7 +918,7 @@ void RotateFaceTexture(face_t *f, int nAxis, float fDeg) {
=======================================================================================================================
*/
void RotateTextures(int nAxis, float fDeg, idVec3 vOrigin) {
for (brush_t * b = selected_brushes.next; b != &selected_brushes; b = b->next) {
for (idEditorBrush * b = selected_brushes.next; b != &selected_brushes; b = b->next) {
for (face_t * f = b->brush_faces; f; f = f->next) {
if (g_qeglobals.m_bBrushPrimitMode) {
RotateFaceTexture_BrushPrimit(f, nAxis, fDeg, vOrigin);
@@ -932,10 +927,10 @@ void RotateTextures(int nAxis, float fDeg, idVec3 vOrigin) {
RotateFaceTexture(f, nAxis, fDeg);
}
// ++timo removed that call .. works fine .. ??????? Brush_Build(b, false);
// ++timo removed that call .. works fine .. ??????? b->Brush_Build(false);
}
Brush_Build(b, false);
b->Brush_Build(false);
}
}
@@ -944,7 +939,7 @@ void RotateTextures(int nAxis, float fDeg, idVec3 vOrigin) {
=======================================================================================================================
*/
void Select_ApplyMatrix_BrushPrimit() {
for (brush_t * b = selected_brushes.next; b != &selected_brushes; b = b->next) {
for (idEditorBrush * b = selected_brushes.next; b != &selected_brushes; b = b->next) {
for (face_t * f = b->brush_faces; f; f = f->next) {
ApplyMatrix_BrushPrimit(f, select_matrix, select_origin);
}
@@ -1229,7 +1224,7 @@ void Select_FlipAxis(int axis) {
*/
void Select_Scale(float x, float y, float z) {
Select_GetMid(select_origin);
for (brush_t * b = selected_brushes.next; b != &selected_brushes; b = b->next) {
for (idEditorBrush * b = selected_brushes.next; b != &selected_brushes; b = b->next) {
for (face_t * f = b->brush_faces; f; f = f->next) {
for (int i = 0; i < 3; i++) {
f->planepts[i][0] -= select_origin[0];
@@ -1259,7 +1254,7 @@ void Select_Scale(float x, float y, float z) {
}
}
Brush_Build(b, false);
b->Brush_Build(false);
if (b->pPatch) {
idVec3 v;
v[0] = x;
@@ -1278,7 +1273,7 @@ void Select_Scale(float x, float y, float z) {
=======================================================================================================================
*/
void Select_CompleteTall(void) {
brush_t *b, *next;
idEditorBrush *b, *next;
// int i;
idVec3 mins, maxs;
@@ -1312,8 +1307,8 @@ void Select_CompleteTall(void) {
continue;
}
Brush_RemoveFromList(b);
Brush_AddToList(b, &selected_brushes);
b->Brush_RemoveFromList();
b->Brush_AddToList(&selected_brushes);
}
Sys_UpdateWindows(W_ALL);
@@ -1324,7 +1319,7 @@ void Select_CompleteTall(void) {
=======================================================================================================================
*/
void Select_PartialTall(void) {
brush_t *b, *next;
idEditorBrush *b, *next;
// int i;
idVec3 mins, maxs;
@@ -1357,8 +1352,8 @@ void Select_PartialTall(void) {
continue;
}
Brush_RemoveFromList(b);
Brush_AddToList(b, &selected_brushes);
b->Brush_RemoveFromList();
b->Brush_AddToList(&selected_brushes);
#if 0
// old stuff
@@ -1369,8 +1364,8 @@ void Select_PartialTall(void) {
}
if (i == 2) {
Brush_RemoveFromList(b);
Brush_AddToList(b, &selected_brushes);
b->Brush_RemoveFromList();
b->Brush_AddToList(&selected_brushes);
}
#endif
}
@@ -1383,7 +1378,7 @@ void Select_PartialTall(void) {
=======================================================================================================================
*/
void Select_Touching(void) {
brush_t *b, *next;
idEditorBrush *b, *next;
int i;
idVec3 mins, maxs;
@@ -1410,8 +1405,8 @@ void Select_Touching(void) {
}
if (i == 3) {
Brush_RemoveFromList(b);
Brush_AddToList(b, &selected_brushes);
b->Brush_RemoveFromList();
b->Brush_AddToList(&selected_brushes);
}
}
@@ -1423,7 +1418,7 @@ void Select_Touching(void) {
=======================================================================================================================
*/
void Select_Inside(void) {
brush_t *b, *next;
idEditorBrush *b, *next;
int i;
idVec3 mins, maxs;
@@ -1451,8 +1446,8 @@ void Select_Inside(void) {
}
if (i == 3) {
Brush_RemoveFromList(b);
Brush_AddToList(b, &selected_brushes);
b->Brush_RemoveFromList();
b->Brush_AddToList(&selected_brushes);
}
}
@@ -1466,8 +1461,8 @@ void Select_Inside(void) {
*/
void Select_Ungroup() {
int numselectedgroups;
entity_t *e;
brush_t *b, *sb;
idEditorEntity *e;
idEditorBrush *b, *sb;
numselectedgroups = 0;
for (sb = selected_brushes.next; sb != &selected_brushes; sb = sb->next) {
@@ -1478,13 +1473,13 @@ void Select_Ungroup() {
}
for (b = e->brushes.onext; b != &e->brushes; b = e->brushes.onext) {
Entity_UnlinkBrush(b);
Entity_LinkBrush(world_entity, b);
Brush_Build(b);
idEditorEntity::Entity_UnlinkBrush(b);
world_entity->Entity_LinkBrush(b);
b->Brush_Build();
b->owner = world_entity;
}
Entity_Free(e);
idEditorEntity::Entity_Free(e);
numselectedgroups++;
}
@@ -1502,7 +1497,7 @@ void Select_Ungroup() {
=======================================================================================================================
*/
void Select_ShiftTexture(float x, float y, bool autoAdjust) {
brush_t *b;
idEditorBrush *b;
face_t *f;
int nFaceCount = g_ptrSelectedFaces.GetSize();
@@ -1526,7 +1521,7 @@ void Select_ShiftTexture(float x, float y, bool autoAdjust) {
}
}
Brush_Build(b);
b->Brush_Build();
if (b->pPatch) {
// Patch_ShiftTexture(b->nPatchID, x, y);
Patch_ShiftTexture(b->pPatch, x, y, autoAdjust);
@@ -1536,7 +1531,7 @@ void Select_ShiftTexture(float x, float y, bool autoAdjust) {
if (nFaceCount > 0) {
for (int i = 0; i < nFaceCount; i++) {
face_t *selFace = reinterpret_cast < face_t * > (g_ptrSelectedFaces.GetAt(i));
brush_t *selBrush = reinterpret_cast < brush_t * > (g_ptrSelectedFaceBrushes.GetAt(i));
idEditorBrush *selBrush = reinterpret_cast < idEditorBrush * > (g_ptrSelectedFaceBrushes.GetAt(i));
if (g_qeglobals.m_bBrushPrimitMode) {
//
// use face normal to compute a true translation Select_ShiftTexture_BrushPrimit(
@@ -1549,7 +1544,7 @@ void Select_ShiftTexture(float x, float y, bool autoAdjust) {
selFace->texdef.shift[1] += y;
}
Brush_Build(selBrush);
selBrush->Brush_Build();
}
}
@@ -1565,7 +1560,7 @@ extern void Face_ScaleTexture_BrushPrimit(face_t *face, float sS, float sT);
=======================================================================================================================
*/
void Select_ScaleTexture(float x, float y, bool update, bool absolute) {
brush_t *b;
idEditorBrush *b;
face_t *f;
int nFaceCount = g_ptrSelectedFaces.GetSize();
@@ -1590,7 +1585,7 @@ void Select_ScaleTexture(float x, float y, bool update, bool absolute) {
}
}
Brush_Build(b);
b->Brush_Build();
if (b->pPatch) {
Patch_ScaleTexture(b->pPatch, x, y, absolute);
}
@@ -1599,7 +1594,7 @@ void Select_ScaleTexture(float x, float y, bool update, bool absolute) {
if (nFaceCount > 0) {
for (int i = 0; i < nFaceCount; i++) {
face_t *selFace = reinterpret_cast < face_t * > (g_ptrSelectedFaces.GetAt(i));
brush_t *selBrush = reinterpret_cast < brush_t * > (g_ptrSelectedFaceBrushes.GetAt(i));
idEditorBrush *selBrush = reinterpret_cast < idEditorBrush * > (g_ptrSelectedFaceBrushes.GetAt(i));
if (g_qeglobals.m_bBrushPrimitMode) {
if (absolute) {
Face_SetExplicitScale_BrushPrimit(selFace, x, y);
@@ -1612,7 +1607,7 @@ void Select_ScaleTexture(float x, float y, bool update, bool absolute) {
selFace->texdef.scale[1] += y;
}
Brush_Build(selBrush);
selBrush->Brush_Build();
}
}
@@ -1629,7 +1624,7 @@ extern void Face_RotateTexture_BrushPrimit(face_t *face, float amount, idVec3 or
=======================================================================================================================
*/
void Select_RotateTexture(float amt, bool absolute) {
brush_t *b;
idEditorBrush *b;
face_t *f;
int nFaceCount = g_ptrSelectedFaces.GetSize();
@@ -1650,7 +1645,7 @@ void Select_RotateTexture(float amt, bool absolute) {
}
}
Brush_Build(b);
b->Brush_Build();
if (b->pPatch) {
// Patch_RotateTexture(b->nPatchID, amt);
Patch_RotateTexture(b->pPatch, amt);
@@ -1660,7 +1655,7 @@ void Select_RotateTexture(float amt, bool absolute) {
if (nFaceCount > 0) {
for (int i = 0; i < nFaceCount; i++) {
face_t *selFace = reinterpret_cast < face_t * > (g_ptrSelectedFaces.GetAt(i));
brush_t *selBrush = reinterpret_cast < brush_t * > (g_ptrSelectedFaceBrushes.GetAt(i));
idEditorBrush *selBrush = reinterpret_cast < idEditorBrush * > (g_ptrSelectedFaceBrushes.GetAt(i));
if (g_qeglobals.m_bBrushPrimitMode) {
idVec3 org;
org.Zero();
@@ -1672,7 +1667,7 @@ void Select_RotateTexture(float amt, bool absolute) {
selFace->texdef.rotate = static_cast<int>(selFace->texdef.rotate) % 360;
}
Brush_Build(selBrush);
selBrush->Brush_Build();
}
}
@@ -1685,12 +1680,12 @@ void Select_RotateTexture(float amt, bool absolute) {
=======================================================================================================================
*/
void FindReplaceTextures(const char *pFind, const char *pReplace, bool bSelected, bool bForce) {
brush_t *pList = (bSelected) ? &selected_brushes : &active_brushes;
idEditorBrush *pList = (bSelected) ? &selected_brushes : &active_brushes;
if (!bSelected) {
Select_Deselect();
}
for (brush_t * pBrush = pList->next; pBrush != pList; pBrush = pBrush->next) {
for (idEditorBrush * pBrush = pList->next; pBrush != pList; pBrush = pBrush->next) {
if (pBrush->pPatch) {
Patch_FindReplaceTexture(pBrush, pFind, pReplace, bForce);
}
@@ -1704,7 +1699,7 @@ void FindReplaceTextures(const char *pFind, const char *pReplace, bool bSelected
}
}
Brush_Build(pBrush);
pBrush->Brush_Build();
}
Sys_UpdateWindows(W_CAMERA);
@@ -1715,8 +1710,8 @@ void FindReplaceTextures(const char *pFind, const char *pReplace, bool bSelected
=======================================================================================================================
*/
void Select_AllOfType() {
brush_t *b, *next;
entity_t *e;
idEditorBrush *b, *next;
idEditorEntity *e;
if ((selected_brushes.next == &selected_brushes) || (selected_brushes.next->next != &selected_brushes)) {
CString strName;
if (g_ptrSelectedFaces.GetSize() == 0) {
@@ -1737,15 +1732,15 @@ void Select_AllOfType() {
if (b->pPatch) {
if ( idStr::Icmp(strName, b->pPatch->d_texture->GetName()) == 0 ) {
Brush_RemoveFromList(b);
Brush_AddToList(b, &selected_brushes);
b->Brush_RemoveFromList();
b->Brush_AddToList(&selected_brushes);
}
}
else {
for (face_t * pFace = b->brush_faces; pFace; pFace = pFace->next) {
if ( idStr::Icmp(strName, pFace->texdef.name) == 0 ) {
Brush_RemoveFromList(b);
Brush_AddToList(b, &selected_brushes);
b->Brush_RemoveFromList();
b->Brush_AddToList(&selected_brushes);
}
}
}
@@ -1777,15 +1772,15 @@ void Select_AllOfType() {
if ( idStr::Icmp(e->eclass->name, strName) == 0 ) {
bool doIt = true;
if (bCriteria) {
CString str = ValueForKey(e, strKey);
CString str = e->ValueForKey(strKey);
if (str.CompareNoCase(strVal) != 0) {
doIt = false;
}
}
if (doIt) {
Brush_RemoveFromList(b);
Brush_AddToList(b, &selected_brushes);
b->Brush_RemoveFromList();
b->Brush_AddToList(&selected_brushes);
}
}
}
@@ -1807,14 +1802,14 @@ void Select_AllOfType() {
*/
void Select_Reselect() {
CPtrArray holdArray;
brush_t *b;
idEditorBrush *b;
for ( b = selected_brushes.next; b && b != &selected_brushes; b = b->next ) {
holdArray.Add(reinterpret_cast < void * > (b));
}
int n = holdArray.GetSize();
while (n-- > 0) {
b = reinterpret_cast < brush_t * > (holdArray.GetAt(n));
b = reinterpret_cast < idEditorBrush * > (holdArray.GetAt(n));
Select_Brush(b);
}
@@ -1826,7 +1821,7 @@ void Select_Reselect() {
=======================================================================================================================
*/
void Select_FitTexture(float height, float width) {
brush_t *b;
idEditorBrush *b;
int nFaceCount = g_ptrSelectedFaces.GetSize();
if (selected_brushes.next == &selected_brushes && nFaceCount == 0) {
@@ -1839,17 +1834,17 @@ void Select_FitTexture(float height, float width) {
Patch_FitTexture(b->pPatch, width, height);
}
else {
Brush_FitTexture(b, height, width);
Brush_Build(b);
b->Brush_FitTexture(height, width);
b->Brush_Build();
}
}
if (nFaceCount > 0) {
for (int i = 0; i < nFaceCount; i++) {
face_t *selFace = reinterpret_cast < face_t * > (g_ptrSelectedFaces.GetAt(i));
brush_t *selBrush = reinterpret_cast < brush_t * > (g_ptrSelectedFaceBrushes.GetAt(i));
idEditorBrush *selBrush = reinterpret_cast < idEditorBrush * > (g_ptrSelectedFaceBrushes.GetAt(i));
Face_FitTexture(selFace, height, width);
Brush_Build(selBrush);
selBrush->Brush_Build();
}
}
@@ -1871,11 +1866,11 @@ void Select_AxialTexture() {
void Select_Hide(bool invert) {
if (invert) {
for (brush_t * b = active_brushes.next; b && b != &active_brushes; b = b->next) {
for (idEditorBrush * b = active_brushes.next; b && b != &active_brushes; b = b->next) {
b->hiddenBrush = true;
}
} else {
for (brush_t * b = selected_brushes.next; b && b != &selected_brushes; b = b->next) {
for (idEditorBrush * b = selected_brushes.next; b && b != &selected_brushes; b = b->next) {
b->hiddenBrush = true;
}
}
@@ -1883,14 +1878,14 @@ void Select_Hide(bool invert) {
}
void Select_WireFrame( bool wireFrame ) {
for (brush_t * b = selected_brushes.next; b && b != &selected_brushes; b = b->next) {
for (idEditorBrush * b = selected_brushes.next; b && b != &selected_brushes; b = b->next) {
b->forceWireFrame = wireFrame;
}
Sys_UpdateWindows(W_ALL);
}
void Select_ForceVisible( bool visible ) {
for (brush_t * b = selected_brushes.next; b && b != &selected_brushes; b = b->next) {
for (idEditorBrush * b = selected_brushes.next; b && b != &selected_brushes; b = b->next) {
b->forceVisibile = visible;
}
Sys_UpdateWindows(W_ALL);
@@ -1901,7 +1896,7 @@ void Select_ForceVisible( bool visible ) {
=======================================================================================================================
*/
void Select_ShowAllHidden() {
brush_t *b;
idEditorBrush *b;
for (b = selected_brushes.next; b && b != &selected_brushes; b = b->next) {
b->hiddenBrush = false;
}
@@ -1919,7 +1914,7 @@ void Select_ShowAllHidden() {
=======================================================================================================================
*/
void Select_Invert(void) {
brush_t *next, *prev;
idEditorBrush *next, *prev;
Sys_Status("inverting selection...\n");
@@ -1959,8 +1954,8 @@ void Select_Invert(void) {
*/
void Select_Name(const char *pName) {
if (g_qeglobals.m_bBrushPrimitMode) {
for (brush_t * b = selected_brushes.next; b && b != &selected_brushes; b = b->next) {
Brush_SetEpair(b, "Name", pName);
for (idEditorBrush * b = selected_brushes.next; b && b != &selected_brushes; b = b->next) {
b->Brush_SetEpair("Name", pName);
}
}
}
@@ -1975,13 +1970,13 @@ void Select_CenterOrigin() {
Select_GetTrueMid(mid);
mid.Snap();
brush_t *b = selected_brushes.next;
entity_t *e = b->owner;
idEditorBrush *b = selected_brushes.next;
idEditorEntity *e = b->owner;
if (e != NULL) {
if (e != world_entity) {
char text[1024];
sprintf(text, "%i %i %i", (int)mid[0], (int)mid[1], (int)mid[2]);
SetKeyValue(e, "origin", text);
e->SetKeyValue("origin", text);
VectorCopy(mid, e->origin);
}
}
@@ -2010,9 +2005,9 @@ face_t *Select_GetSelectedFace(int index) {
=======================================================================================================================
=======================================================================================================================
*/
brush_t *Select_GetSelectedFaceBrush(int index) {
idEditorBrush *Select_GetSelectedFaceBrush(int index) {
assert(index >= 0 && index < Select_NumSelectedFaces());
return reinterpret_cast < brush_t * > (g_ptrSelectedFaceBrushes.GetAt(index));
return reinterpret_cast < idEditorBrush * > (g_ptrSelectedFaceBrushes.GetAt(index));
}
/*
@@ -2051,17 +2046,17 @@ void Select_SetDefaultTexture(const idMaterial *mat, bool fitScale, bool setText
void Select_UpdateTextureName(const char *name) {
brush_t *b;
idEditorBrush *b;
int nCount = g_ptrSelectedFaces.GetSize();
if (nCount > 0) {
Undo_Start("set face texture name");
ASSERT(g_ptrSelectedFaces.GetSize() == g_ptrSelectedFaceBrushes.GetSize());
for (int i = 0; i < nCount; i++) {
face_t *selFace = reinterpret_cast < face_t * > (g_ptrSelectedFaces.GetAt(i));
brush_t *selBrush = reinterpret_cast < brush_t * > (g_ptrSelectedFaceBrushes.GetAt(i));
idEditorBrush *selBrush = reinterpret_cast < idEditorBrush * > (g_ptrSelectedFaceBrushes.GetAt(i));
Undo_AddBrush(selBrush);
selFace->texdef.SetName(name);
Brush_Build(selBrush);
selBrush->Brush_Build();
Undo_EndBrush(selBrush);
}
@@ -2072,14 +2067,14 @@ void Select_UpdateTextureName(const char *name) {
for (b = selected_brushes.next; b != &selected_brushes; b = b->next) {
if (!b->owner->eclass->fixedsize) {
Undo_AddBrush(b);
Brush_SetTextureName(b, name);
b->Brush_SetTextureName(name);
Undo_EndBrush(b);
} else if (b->owner->eclass->nShowFlags & ECLASS_LIGHT) {
if ( idStr::Cmpn(name, "lights/", strlen("lights/")) == 0 ) {
SetKeyValue(b->owner, "texture", name);
b->owner->SetKeyValue("texture", name);
g_Inspectors->UpdateEntitySel(b->owner->eclass);
UpdateLightInspector();
Brush_Build(b);
b->Brush_Build();
}
}
}
@@ -2100,18 +2095,18 @@ void Select_FlipTexture(bool y) {
int faceCount = g_ptrSelectedFaces.GetSize();
Undo_Start("Select_FlipTexture");
for (brush_t *b = selected_brushes.next; b != &selected_brushes; b = b->next) {
for (idEditorBrush *b = selected_brushes.next; b != &selected_brushes; b = b->next) {
if (b->pPatch) {
Patch_FlipTexture(b->pPatch, y);
} else {
Brush_FlipTexture_BrushPrimit(b, y);
b->Brush_FlipTexture_BrushPrimit(y);
}
}
if (faceCount > 0) {
for (int i = 0; i < faceCount; i++) {
face_t *selFace = reinterpret_cast < face_t * > (g_ptrSelectedFaces.GetAt(i));
brush_t *selBrush = reinterpret_cast < brush_t * > (g_ptrSelectedFaceBrushes.GetAt(i));
idEditorBrush *selBrush = reinterpret_cast < idEditorBrush * > (g_ptrSelectedFaceBrushes.GetAt(i));
Face_FlipTexture_BrushPrimit(selFace, y);
}
}
@@ -2130,9 +2125,9 @@ void Select_FlipTexture(bool y) {
=======================================================================================================================
*/
void Select_SetKeyVal(const char *key, const char *val) {
for (brush_t * b = selected_brushes.next; b && b != &selected_brushes; b = b->next) {
for (idEditorBrush * b = selected_brushes.next; b && b != &selected_brushes; b = b->next) {
if (b->owner != world_entity) {
SetKeyValue(b->owner, key, val, false);
b->owner->SetKeyValue(key, val, false);
}
}
}
@@ -2143,7 +2138,7 @@ void Select_SetKeyVal(const char *key, const char *val) {
=======================================================================================================================
*/
void Select_CopyPatchTextureCoords( patchMesh_t *p ) {
for (brush_t * b = selected_brushes.next; b && b != &selected_brushes; b = b->next) {
for (idEditorBrush * b = selected_brushes.next; b && b != &selected_brushes; b = b->next) {
if (b->pPatch) {
if ( b->pPatch->width <= p->width && b->pPatch->height <= p->height ) {
for ( int i = 0; i < b->pPatch->width; i ++ ) {
@@ -2163,7 +2158,7 @@ void Select_CopyPatchTextureCoords( patchMesh_t *p ) {
=======================================================================================================================
*/
void Select_ProjectFaceOntoPatch( face_t *face ) {
for (brush_t * b = selected_brushes.next; b && b != &selected_brushes; b = b->next) {
for (idEditorBrush * b = selected_brushes.next; b && b != &selected_brushes; b = b->next) {
if (b->pPatch) {
EmitBrushPrimitTextureCoordinates(face, NULL, b->pPatch);
Patch_MakeDirty(b->pPatch);
@@ -2179,7 +2174,7 @@ void Select_ProjectFaceOntoPatch( face_t *face ) {
extern float Patch_Width(patchMesh_t *p);
extern float Patch_Height(patchMesh_t *p);
void Select_SetPatchFit(float dim1, float dim2, float srcWidth, float srcHeight, float rot) {
for (brush_t * b = selected_brushes.next; b && b != &selected_brushes; b = b->next) {
for (idEditorBrush * b = selected_brushes.next; b && b != &selected_brushes; b = b->next) {
if (b->pPatch) {
float w = Patch_Width(b->pPatch);
float h = Patch_Height(b->pPatch);
@@ -2195,11 +2190,11 @@ void Select_SetPatchST(float s1, float t1, float s2, float t2) {
void Select_AllTargets() {
for (brush_t * b = selected_brushes.next; b && b != &selected_brushes; b = b->next) {
for (idEditorBrush * b = selected_brushes.next; b && b != &selected_brushes; b = b->next) {
if (b->owner != world_entity) {
const idKeyValue *kv = b->owner->epairs.MatchPrefix("target", NULL);
while (kv) {
entity_t *ent = FindEntity("name", kv->GetValue());
idEditorEntity *ent = idEditorEntity::FindEntity("name", kv->GetValue());
if (ent) {
Select_Brush(ent->brushes.onext, true, false);
}
@@ -2207,4 +2202,4 @@ void Select_AllTargets() {
}
}
}
}
}