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
+7
View File
@@ -0,0 +1,7 @@
#pragma once
void R_InitSkyDome();
void R_ShutdownSkyDome();
// Draws the dome behind everything (no depth write), centered on view origin.
void RB_DrawSkyDome(const viewDef_t* viewDef);
+27 -27
View File
@@ -40,7 +40,7 @@ CSG_MakeHollow
*/ */
void CSG_MakeHollow (void) void CSG_MakeHollow (void)
{ {
brush_t *b, *front, *back, *next; idEditorBrush *b, *front, *back, *next;
face_t *f; face_t *f;
face_t split; face_t split;
idVec3 move; idVec3 move;
@@ -63,7 +63,7 @@ void CSG_MakeHollow (void)
if (back) if (back)
Brush_Free (back); Brush_Free (back);
if (front) if (front)
Brush_AddToList (front, &selected_brushes); front->Brush_AddToList(&selected_brushes);
} }
Brush_Free (b); Brush_Free (b);
} }
@@ -83,10 +83,10 @@ Brush_Merge
be the same as well. be the same as well.
============= =============
*/ */
brush_t *Brush_Merge(brush_t *brush1, brush_t *brush2, int onlyshape) idEditorBrush *Brush_Merge(idEditorBrush *brush1, idEditorBrush *brush2, int onlyshape)
{ {
int i, shared; int i, shared;
brush_t *newbrush; idEditorBrush *newbrush;
face_t *face1, *face2, *newface, *f; face_t *face1, *face2, *newface, *f;
// check for bounding box overlapp // check for bounding box overlapp
@@ -214,9 +214,9 @@ brush_t *Brush_Merge(brush_t *brush1, brush_t *brush2, int onlyshape)
newbrush->brush_faces = newface; newbrush->brush_faces = newface;
} }
// link the new brush to an entity // link the new brush to an entity
Entity_LinkBrush (brush1->owner, newbrush); brush1->owner->Entity_LinkBrush(newbrush);
// build windings for the faces // build windings for the faces
Brush_BuildWindings( newbrush, false); newbrush->Brush_BuildWindings(false);
return newbrush; return newbrush;
} }
@@ -230,11 +230,11 @@ Brush_MergeListPairs
Input and output should be a single linked list using .next Input and output should be a single linked list using .next
============= =============
*/ */
brush_t *Brush_MergeListPairs(brush_t *brushlist, int onlyshape) idEditorBrush *Brush_MergeListPairs(idEditorBrush *brushlist, int onlyshape)
{ {
int nummerges, merged; int nummerges, merged;
brush_t *b1, *b2, *tail, *newbrush, *newbrushlist; idEditorBrush *b1, *b2, *tail, *newbrush, *newbrushlist;
brush_t *lastb2; idEditorBrush *lastb2;
if (!brushlist) return NULL; if (!brushlist) return NULL;
@@ -301,9 +301,9 @@ Brush_MergeList
be the same as well. be the same as well.
============= =============
*/ */
brush_t *Brush_MergeList(brush_t *brushlist, int onlyshape) idEditorBrush *Brush_MergeList(idEditorBrush *brushlist, int onlyshape)
{ {
brush_t *brush1, *brush2, *brush3, *newbrush; idEditorBrush *brush1, *brush2, *brush3, *newbrush;
face_t *face1, *face2, *face3, *newface, *f; face_t *face1, *face2, *face3, *newface, *f;
if (!brushlist) return NULL; if (!brushlist) return NULL;
@@ -410,9 +410,9 @@ brush_t *Brush_MergeList(brush_t *brushlist, int onlyshape)
} }
} }
// link the new brush to an entity // link the new brush to an entity
Entity_LinkBrush (brushlist->owner, newbrush); brushlist->owner->Entity_LinkBrush(newbrush);
// build windings for the faces // build windings for the faces
Brush_BuildWindings( newbrush, false); newbrush->Brush_BuildWindings(false);
return newbrush; return newbrush;
} }
@@ -425,11 +425,11 @@ Brush_Subtract
The originals are undisturbed. The originals are undisturbed.
============= =============
*/ */
brush_t *Brush_Subtract(brush_t *a, brush_t *b) idEditorBrush *Brush_Subtract(idEditorBrush *a, idEditorBrush *b)
{ {
// a - b = out (list) // a - b = out (list)
brush_t *front, *back; idEditorBrush *front, *back;
brush_t *in, *out, *next; idEditorBrush *in, *out, *next;
face_t *f; face_t *f;
in = a; in = a;
@@ -470,8 +470,8 @@ CSG_Subtract
*/ */
void CSG_Subtract (void) void CSG_Subtract (void)
{ {
brush_t *b, *s, *fragments, *nextfragment, *frag, *next, *snext; idEditorBrush *b, *s, *fragments, *nextfragment, *frag, *next, *snext;
brush_t fragmentlist; idEditorBrush fragmentlist;
int i, numfragments, numbrushes; int i, numfragments, numbrushes;
Sys_Status ("Subtracting...\n"); Sys_Status ("Subtracting...\n");
@@ -517,7 +517,7 @@ void CSG_Subtract (void)
nextfragment = frag->next; nextfragment = frag->next;
frag->next = NULL; frag->next = NULL;
frag->owner = s->owner; frag->owner = s->owner;
Brush_AddToList(frag, &fragmentlist); frag->Brush_AddToList(&fragmentlist);
} }
// free the original brush // free the original brush
Brush_Free(s); Brush_Free(s);
@@ -560,7 +560,7 @@ void CSG_Subtract (void)
nextfragment = frag->next; nextfragment = frag->next;
frag->next = NULL; frag->next = NULL;
frag->owner = s->owner; frag->owner = s->owner;
Brush_AddToList(frag, &fragmentlist); frag->Brush_AddToList(&fragmentlist);
} }
// free the original brush // free the original brush
Brush_Free(s); Brush_Free(s);
@@ -572,8 +572,8 @@ void CSG_Subtract (void)
{ {
nextfragment = frag->next; nextfragment = frag->next;
numfragments++; numfragments++;
Brush_RemoveFromList(frag); frag->Brush_RemoveFromList();
Brush_AddToList(frag, &active_brushes); frag->Brush_AddToList(&active_brushes);
Undo_EndBrush(frag); Undo_EndBrush(frag);
} }
@@ -596,8 +596,8 @@ CSG_Merge
*/ */
void CSG_Merge(void) void CSG_Merge(void)
{ {
brush_t *b, *next, *newlist, *newbrush; idEditorBrush *b, *next, *newlist, *newbrush;
struct entity_s *owner; idEditorEntity *owner;
Sys_Status("Merging...\n"); Sys_Status("Merging...\n");
@@ -651,7 +651,7 @@ void CSG_Merge(void)
{ {
next = b->next; next = b->next;
Brush_RemoveFromList(b); b->Brush_RemoveFromList();
b->next = newlist; b->next = newlist;
b->prev = NULL; b->prev = NULL;
newlist = b; newlist = b;
@@ -667,7 +667,7 @@ void CSG_Merge(void)
next = b->next; next = b->next;
b->next = NULL; b->next = NULL;
b->prev = NULL; b->prev = NULL;
Brush_AddToList(b, &selected_brushes); b->Brush_AddToList(&selected_brushes);
} }
Sys_Status("Cannot add a set of brushes with a concave hull.\n"); Sys_Status("Cannot add a set of brushes with a concave hull.\n");
return; return;
@@ -680,7 +680,7 @@ void CSG_Merge(void)
b->prev = NULL; b->prev = NULL;
Brush_Free(b); Brush_Free(b);
} }
Brush_AddToList(newbrush, &selected_brushes); newbrush->Brush_AddToList(&selected_brushes);
Sys_Status ("done.\n"); Sys_Status ("done.\n");
Sys_UpdateWindows (W_ALL); Sys_UpdateWindows (W_ALL);
+99 -99
View File
@@ -50,7 +50,7 @@ static char THIS_FILE[] = __FILE__;
extern void DrawPathLines(); extern void DrawPathLines();
extern qertrace_t Test_Ray(const idVec3& origin, const idVec3& dir, int flags); extern qertrace_t Test_Ray(const idVec3& origin, const idVec3& dir, int flags);
extern brush_t* Brush_CreateFaceExtrusion(brush_t* sourceBrush, face_t* sourceFace, float distance); extern idEditorBrush* Brush_CreateFaceExtrusion(idEditorBrush* sourceBrush, face_t* sourceFace, float distance);
extern void Select_ShiftTexture(float x, float y); extern void Select_ShiftTexture(float x, float y);
extern void Select_ScaleTexture(float x, float y); extern void Select_ScaleTexture(float x, float y);
extern void Select_RotateTexture(float amt, bool absolute); extern void Select_RotateTexture(float amt, bool absolute);
@@ -798,10 +798,10 @@ static void CameraNav_BuildEntityInfo(CCamWnd* cam, idStr* lines, int& numLines)
return; return;
} }
entity_t* ent = trace.brush->owner; idEditorEntity* ent = trace.brush->owner;
CameraNav_AddLine(lines, numLines, "Entity"); CameraNav_AddLine(lines, numLines, "Entity");
CameraNav_AddLine(lines, numLines, va("class: %s", ValueForKey(ent, "classname"))); CameraNav_AddLine(lines, numLines, va("class: %s", ent->ValueForKey("classname")));
CameraNav_AddLine(lines, numLines, va("name: %s", ValueForKey(ent, "name"))); CameraNav_AddLine(lines, numLines, va("name: %s", ent->ValueForKey("name")));
for (int i = 0; i < ent->epairs.GetNumKeyVals() && numLines < CAMERA_NAV_MAX_INFO_LINES; i++) { for (int i = 0; i < ent->epairs.GetNumKeyVals() && numLines < CAMERA_NAV_MAX_INFO_LINES; i++) {
const idKeyValue* kv = ent->epairs.GetKeyVal(i); const idKeyValue* kv = ent->epairs.GetKeyVal(i);
@@ -930,17 +930,17 @@ static bool CamWnd_IsTargetLineKey(const char* key) {
return idStr::Icmpn(key, "target", 6) == 0; return idStr::Icmpn(key, "target", 6) == 0;
} }
static bool CamWnd_EntityNameMatches(entity_t* ent, const char* name) { static bool CamWnd_EntityNameMatches(idEditorEntity* ent, const char* name) {
if (ent == NULL || name == NULL || name[0] == '\0') { if (ent == NULL || name == NULL || name[0] == '\0') {
return false; return false;
} }
const char* entName = ValueForKey(ent, "name"); const char* entName = ent->ValueForKey("name");
if (entName != NULL && entName[0] != '\0' && idStr::Icmp(entName, name) == 0) { if (entName != NULL && entName[0] != '\0' && idStr::Icmp(entName, name) == 0) {
return true; return true;
} }
const char* targetName = ValueForKey(ent, "targetname"); const char* targetName = ent->ValueForKey("targetname");
if (targetName != NULL && targetName[0] != '\0' && idStr::Icmp(targetName, name) == 0) { if (targetName != NULL && targetName[0] != '\0' && idStr::Icmp(targetName, name) == 0) {
return true; return true;
} }
@@ -948,12 +948,12 @@ static bool CamWnd_EntityNameMatches(entity_t* ent, const char* name) {
return false; return false;
} }
static bool CamWnd_GetEntityLinePoint(entity_t* ent, idVec3& point) { static bool CamWnd_GetEntityLinePoint(idEditorEntity* ent, idVec3& point) {
if (ent == NULL) { if (ent == NULL) {
return false; return false;
} }
if (GetVectorForKey(ent, "origin", point)) { if (ent->GetVectorForKey("origin", point)) {
return true; return true;
} }
@@ -961,7 +961,7 @@ static bool CamWnd_GetEntityLinePoint(entity_t* ent, idVec3& point) {
bounds.Clear(); bounds.Clear();
bool haveBounds = false; bool haveBounds = false;
for (brush_t* brush = ent->brushes.onext; brush != NULL && brush != &ent->brushes; brush = brush->onext) { for (idEditorBrush* brush = ent->brushes.onext; brush != NULL && brush != &ent->brushes; brush = brush->onext) {
bounds.AddPoint(brush->mins); bounds.AddPoint(brush->mins);
bounds.AddPoint(brush->maxs); bounds.AddPoint(brush->maxs);
haveBounds = true; haveBounds = true;
@@ -975,7 +975,7 @@ static bool CamWnd_GetEntityLinePoint(entity_t* ent, idVec3& point) {
return false; return false;
} }
static void CamWnd_DrawVisibleTargetLine(entity_t* source, entity_t* target) { static void CamWnd_DrawVisibleTargetLine(idEditorEntity* source, idEditorEntity* target) {
if (source == NULL || target == NULL || source == target) { if (source == NULL || target == NULL || source == target) {
return; return;
} }
@@ -994,7 +994,7 @@ static void CamWnd_DrawVisibleTargetLine(entity_t* source, entity_t* target) {
glVertex3fv(end.ToFloatPtr()); glVertex3fv(end.ToFloatPtr());
} }
static void CamWnd_DrawVisibleTargetLinesForName(entity_t* source, const char* targetName) { static void CamWnd_DrawVisibleTargetLinesForName(idEditorEntity* source, const char* targetName) {
if (targetName == NULL || targetName[0] == '\0') { if (targetName == NULL || targetName[0] == '\0') {
return; return;
} }
@@ -1007,14 +1007,14 @@ static void CamWnd_DrawVisibleTargetLinesForName(entity_t* source, const char* t
return; return;
} }
for (entity_t* target = entities.next; target != &entities; target = target->next) { for (idEditorEntity* target = entities.next; target != &entities; target = target->next) {
if (CamWnd_EntityNameMatches(target, targetName)) { if (CamWnd_EntityNameMatches(target, targetName)) {
CamWnd_DrawVisibleTargetLine(source, target); CamWnd_DrawVisibleTargetLine(source, target);
} }
} }
} }
static void CamWnd_DrawVisibleTargetLinesForEntity(entity_t* source) { static void CamWnd_DrawVisibleTargetLinesForEntity(idEditorEntity* source) {
if (source == NULL || !Outliner_IsEntityVisible(source)) { if (source == NULL || !Outliner_IsEntityVisible(source)) {
return; return;
} }
@@ -1051,7 +1051,7 @@ static void CamWnd_DrawVisiblePathLines() {
CamWnd_DrawVisibleTargetLinesForEntity(world_entity); CamWnd_DrawVisibleTargetLinesForEntity(world_entity);
} }
if (entities.next != NULL) { if (entities.next != NULL) {
for (entity_t* source = entities.next; source != &entities; source = source->next) { for (idEditorEntity* source = entities.next; source != &entities; source = source->next) {
CamWnd_DrawVisibleTargetLinesForEntity(source); CamWnd_DrawVisibleTargetLinesForEntity(source);
} }
} }
@@ -1070,7 +1070,7 @@ all GL viewports/scissors use the reduced camera height, which keeps the camera
view from drawing underneath the menu. view from drawing underneath the menu.
======================== ========================
*/ */
bool IsBModel(brush_t* b); bool IsBModel(idEditorBrush* b);
static const char* CAMWND_MENU_BAR_CLASS = "QER_CamWndMenuBar"; static const char* CAMWND_MENU_BAR_CLASS = "QER_CamWndMenuBar";
static const char* CAMWND_PROP_MENU_BAR = "QER_CamWnd_MenuBar"; static const char* CAMWND_PROP_MENU_BAR = "QER_CamWnd_MenuBar";
@@ -1733,7 +1733,7 @@ static bool CamWnd_IsUtilityMaterial(const idMaterial* material) {
return false; return false;
} }
static bool CamWnd_BrushUsesOnlyUtilityMaterials(brush_t* brush) { static bool CamWnd_BrushUsesOnlyUtilityMaterials(idEditorBrush* brush) {
if (brush == NULL) { if (brush == NULL) {
return false; return false;
} }
@@ -1761,12 +1761,12 @@ static bool CamWnd_BrushUsesOnlyUtilityMaterials(brush_t* brush) {
return foundMaterial; return foundMaterial;
} }
static bool CamWnd_IsTriggerLikeBrushEntity(brush_t* brush) { static bool CamWnd_IsTriggerLikeBrushEntity(idEditorBrush* brush) {
if (brush == NULL || brush->owner == NULL) { if (brush == NULL || brush->owner == NULL) {
return false; return false;
} }
const char* className = ValueForKey(brush->owner, "classname"); const char* className = brush->owner->ValueForKey("classname");
if (className == NULL || className[0] == '\0') { if (className == NULL || className[0] == '\0') {
return false; return false;
} }
@@ -1802,7 +1802,7 @@ static bool CamWnd_TargetLinesVisible(const camWndBrushFilterContext_t& filter)
return (filter.mask & CAMWND_FILTER_HIDE_TARGET_LINES) == 0; return (filter.mask & CAMWND_FILTER_HIDE_TARGET_LINES) == 0;
} }
static bool CamWnd_MenuFilterBrush(const camWndBrushFilterContext_t& filter, brush_t* brush) { static bool CamWnd_MenuFilterBrush(const camWndBrushFilterContext_t& filter, idEditorBrush* brush) {
if (!brush) { if (!brush) {
return false; return false;
} }
@@ -1852,7 +1852,7 @@ static bool CamWnd_MenuFilterBrush(const camWndBrushFilterContext_t& filter, bru
return false; return false;
} }
static bool CamWnd_MenuFilterBrush(CCamWnd* cam, brush_t* brush) { static bool CamWnd_MenuFilterBrush(CCamWnd* cam, idEditorBrush* brush) {
const camWndBrushFilterContext_t filter = CamWnd_MakeBrushFilterContext(cam); const camWndBrushFilterContext_t filter = CamWnd_MakeBrushFilterContext(cam);
return CamWnd_MenuFilterBrush(filter, brush); return CamWnd_MenuFilterBrush(filter, brush);
} }
@@ -1873,7 +1873,7 @@ struct camFaceExtrudeState_t {
bool active; bool active;
bool moved; bool moved;
CCamWnd* cam; CCamWnd* cam;
brush_t* sourceBrush; idEditorBrush* sourceBrush;
face_t* sourceFace; face_t* sourceFace;
idWinding* sourceWinding; idWinding* sourceWinding;
idVec3 normal; idVec3 normal;
@@ -2141,7 +2141,7 @@ static bool CamWnd_DecalClick(CCamWnd* cam, const CPoint& point, UINT nFlags) {
return true; return true;
} }
static bool CamWnd_FaceExtrudeBrushAllowed(CCamWnd* cam, brush_t* brush) { static bool CamWnd_FaceExtrudeBrushAllowed(CCamWnd* cam, idEditorBrush* brush) {
if (brush == NULL || brush->owner == NULL || brush->owner->eclass == NULL) { if (brush == NULL || brush->owner == NULL || brush->owner->eclass == NULL) {
return false; return false;
} }
@@ -2275,7 +2275,7 @@ static void CamWnd_FaceExtrudeEnd(CCamWnd* cam, bool commit) {
return; return;
} }
brush_t* sourceBrush = s_faceExtrudeState.sourceBrush; idEditorBrush* sourceBrush = s_faceExtrudeState.sourceBrush;
face_t* sourceFace = s_faceExtrudeState.sourceFace; face_t* sourceFace = s_faceExtrudeState.sourceFace;
float distance = s_faceExtrudeState.distance; float distance = s_faceExtrudeState.distance;
@@ -2284,12 +2284,12 @@ static void CamWnd_FaceExtrudeEnd(CCamWnd* cam, bool commit) {
} }
if (commit && sourceBrush && sourceFace && idMath::Fabs(distance) >= CAMWND_FACE_EXTRUDE_EPSILON) { if (commit && sourceBrush && sourceFace && idMath::Fabs(distance) >= CAMWND_FACE_EXTRUDE_EPSILON) {
brush_t* newBrush = Brush_CreateFaceExtrusion(sourceBrush, sourceFace, distance); idEditorBrush* newBrush = Brush_CreateFaceExtrusion(sourceBrush, sourceFace, distance);
if (newBrush != NULL) { if (newBrush != NULL) {
Brush_AddToList(newBrush, &selected_brushes); newBrush->Brush_AddToList(&selected_brushes);
Entity_LinkBrush(sourceBrush->owner ? sourceBrush->owner : world_entity, newBrush); (sourceBrush->owner ? sourceBrush->owner : world_entity)->Entity_LinkBrush(newBrush);
Brush_Build(newBrush, true, true); newBrush->Brush_Build(true, true);
Brush_RemoveEmptyFaces(newBrush); newBrush->Brush_RemoveEmptyFaces();
if (newBrush->brush_faces == NULL) { if (newBrush->brush_faces == NULL) {
Brush_Free(newBrush); Brush_Free(newBrush);
@@ -2359,7 +2359,7 @@ static void CamWnd_FaceExtrudeDrawPreview(CCamWnd* cam) {
return; return;
} }
brush_t* previewBrush = Brush_CreateFaceExtrusion( idEditorBrush* previewBrush = Brush_CreateFaceExtrusion(
s_faceExtrudeState.sourceBrush, s_faceExtrudeState.sourceBrush,
s_faceExtrudeState.sourceFace, s_faceExtrudeState.sourceFace,
s_faceExtrudeState.distance); s_faceExtrudeState.distance);
@@ -2367,8 +2367,8 @@ static void CamWnd_FaceExtrudeDrawPreview(CCamWnd* cam) {
return; return;
} }
Brush_Build(previewBrush, true, false, false, false); previewBrush->Brush_Build(true, false, false, false);
Brush_RemoveEmptyFaces(previewBrush); previewBrush->Brush_RemoveEmptyFaces();
if (previewBrush->brush_faces == NULL) { if (previewBrush->brush_faces == NULL) {
Brush_Free(previewBrush); Brush_Free(previewBrush);
return; return;
@@ -2450,7 +2450,7 @@ static bool CamWnd_GizmoSelectionBounds(idVec3& mins, idVec3& maxs) {
maxs[0] = maxs[1] = maxs[2] = -999999.0f; maxs[0] = maxs[1] = maxs[2] = -999999.0f;
bool haveBounds = false; bool haveBounds = false;
for (brush_t* brush = selected_brushes.next; brush != &selected_brushes; brush = brush->next) { for (idEditorBrush* brush = selected_brushes.next; brush != &selected_brushes; brush = brush->next) {
if (brush == NULL) { if (brush == NULL) {
continue; continue;
} }
@@ -3306,7 +3306,7 @@ void CCamWnd::OnChar(UINT nChar, UINT nRepCnt, UINT nFlags) {
CWnd::OnChar(nChar, nRepCnt, nFlags); CWnd::OnChar(nChar, nRepCnt, nFlags);
} }
brush_t* g_pSplitList = NULL; idEditorBrush* g_pSplitList = NULL;
/* /*
======================================================================================================================= =======================================================================================================================
@@ -3669,7 +3669,7 @@ void CCamWnd::Cam_BuildMatrix() {
*/ */
void CCamWnd::Cam_ChangeFloor(bool up) { void CCamWnd::Cam_ChangeFloor(bool up) {
brush_t* b; idEditorBrush* b;
float d, bestd, current; float d, bestd, current;
idVec3 start, dir; idVec3 start, dir;
@@ -3688,7 +3688,7 @@ void CCamWnd::Cam_ChangeFloor(bool up) {
} }
for (b = active_brushes.next; b != &active_brushes; b = b->next) { for (b = active_brushes.next; b != &active_brushes; b = b->next) {
if (!Brush_Ray(start, dir, b, &d)) { if (!b->Brush_Ray(start, dir, &d)) {
continue; continue;
} }
@@ -3938,7 +3938,7 @@ void CCamWnd::InitCull() {
======================================================================================================================= =======================================================================================================================
======================================================================================================================= =======================================================================================================================
*/ */
bool CCamWnd::CullBrush(brush_t* b, bool cubicOnly) { bool CCamWnd::CullBrush(idEditorBrush* b, bool cubicOnly) {
int i; int i;
idVec3 point; idVec3 point;
float d; float d;
@@ -3994,7 +3994,7 @@ bool CCamWnd::CullBrush(brush_t* b, bool cubicOnly) {
======================================================================================================================= =======================================================================================================================
======================================================================================================================= =======================================================================================================================
*/ */
void CCamWnd::DrawLightRadius(brush_t* pBrush) { void CCamWnd::DrawLightRadius(idEditorBrush* pBrush) {
// if lighting // if lighting
int nRadius = Brush_LightRadius(pBrush); int nRadius = Brush_LightRadius(pBrush);
if (nRadius > 0) { if (nRadius > 0) {
@@ -4062,7 +4062,7 @@ struct camWndWorldFaceBatch_t {
std::vector<face_t*> faces; std::vector<face_t*> faces;
}; };
static bool CamWnd_IsFastWorldBrush(brush_t* brush) { static bool CamWnd_IsFastWorldBrush(idEditorBrush* brush) {
if (brush == NULL || brush->hiddenBrush) { if (brush == NULL || brush->hiddenBrush) {
return false; return false;
} }
@@ -4112,7 +4112,7 @@ static camWndWorldFaceBatch_t* CamWnd_FindWorldFaceBatch(std::vector<camWndWorld
return &batches.back(); return &batches.back();
} }
static void CamWnd_AddFastWorldBrush(std::vector<camWndWorldFaceBatch_t>& batches, brush_t* brush, int drawMode) { static void CamWnd_AddFastWorldBrush(std::vector<camWndWorldFaceBatch_t>& batches, idEditorBrush* brush, int drawMode) {
const bool textured = (drawMode == cd_texture || drawMode == cd_light); const bool textured = (drawMode == cd_texture || drawMode == cd_light);
for (face_t* face = brush->brush_faces; face; face = face->next) { for (face_t* face = brush->brush_faces; face; face = face->next) {
@@ -4175,11 +4175,11 @@ static void CamWnd_EmitFastWorldFaceBatches(const std::vector<camWndWorldFaceBat
static void CamWnd_DrawActiveBrushes(CCamWnd* cam, bool renderMode, bool entityMode, const camWndBrushFilterContext_t& filter) { static void CamWnd_DrawActiveBrushes(CCamWnd* cam, bool renderMode, bool entityMode, const camWndBrushFilterContext_t& filter) {
std::vector<camWndWorldFaceBatch_t> batches; std::vector<camWndWorldFaceBatch_t> batches;
std::vector<brush_t*> slowBrushes; std::vector<idEditorBrush*> slowBrushes;
batches.reserve(64); batches.reserve(64);
slowBrushes.reserve(64); slowBrushes.reserve(64);
for (brush_t* brush = active_brushes.next; brush != &active_brushes; brush = brush->next) { for (idEditorBrush* brush = active_brushes.next; brush != &active_brushes; brush = brush->next) {
if (cam->CullBrush(brush, false)) { if (cam->CullBrush(brush, false)) {
continue; continue;
} }
@@ -4215,7 +4215,7 @@ static void CamWnd_DrawActiveBrushes(CCamWnd* cam, bool renderMode, bool entityM
for (size_t i = 0; i < slowBrushes.size(); i++) { for (size_t i = 0; i < slowBrushes.size(); i++) {
setGLMode(cam->Camera().draw_mode); setGLMode(cam->Camera().draw_mode);
Brush_Draw(slowBrushes[i]); slowBrushes[i]->Brush_Draw();
} }
} }
@@ -4251,7 +4251,7 @@ static void CamWnd_DrawRadiantLightFrustums(CCamWnd* cam) {
glLineWidth(1.0f); glLineWidth(1.0f);
globalImages->BindNull(); globalImages->BindNull();
for (entity_t* ent = entities.next; ent != &entities; ent = ent->next) { for (idEditorEntity* ent = entities.next; ent != &entities; ent = ent->next) {
if (ent->eclass == NULL || !(ent->eclass->nShowFlags & ECLASS_LIGHT) || ent->epairs.GetBool("start_off")) { if (ent->eclass == NULL || !(ent->eclass->nShowFlags & ECLASS_LIGHT) || ent->epairs.GetBool("start_off")) {
continue; continue;
} }
@@ -4279,12 +4279,12 @@ static bool CamWnd_FaceHasAllPlanePointsSelected(face_t* face) {
return true; return true;
} }
static void CamWnd_DrawMoveSelectedBrushSidesForList(const camWndBrushFilterContext_t& filter, brush_t* list) { static void CamWnd_DrawMoveSelectedBrushSidesForList(const camWndBrushFilterContext_t& filter, idEditorBrush* list) {
if (list == NULL || list->next == NULL) { if (list == NULL || list->next == NULL) {
return; return;
} }
for (brush_t* brush = list->next; brush != list; brush = brush->next) { for (idEditorBrush* brush = list->next; brush != list; brush = brush->next) {
if (CamWnd_MenuFilterBrush(filter, brush)) { if (CamWnd_MenuFilterBrush(filter, brush)) {
continue; continue;
} }
@@ -4402,7 +4402,7 @@ void CCamWnd::SetProjectionMatrix() {
} }
void CCamWnd::Cam_Draw() { void CCamWnd::Cam_Draw() {
brush_t* brush; idEditorBrush* brush;
face_t* face; face_t* face;
// float yfov; // float yfov;
@@ -4455,7 +4455,7 @@ void CCamWnd::Cam_Draw() {
glTranslatef(g_qeglobals.d_select_translate[0], g_qeglobals.d_select_translate[1], g_qeglobals.d_select_translate[2]); glTranslatef(g_qeglobals.d_select_translate[0], g_qeglobals.d_select_translate[1], g_qeglobals.d_select_translate[2]);
brush_t* pList = (g_bClipMode && g_pSplitList) ? g_pSplitList : &selected_brushes; idEditorBrush* pList = (g_bClipMode && g_pSplitList) ? g_pSplitList : &selected_brushes;
if (!renderMode) { if (!renderMode) {
// draw normally // draw normally
@@ -4467,7 +4467,7 @@ void CCamWnd::Cam_Draw() {
continue; continue;
} }
setGLMode(m_Camera.draw_mode); setGLMode(m_Camera.draw_mode);
Brush_Draw(brush, true); brush->Brush_Draw(true);
} }
} }
@@ -4485,7 +4485,7 @@ void CCamWnd::Cam_Draw() {
continue; continue;
} }
if (brush->pPatch || brush->modelHandle > 0) { if (brush->pPatch || brush->modelHandle > 0) {
Brush_Draw(brush, true); brush->Brush_Draw(true);
// DHM - Nerve:: patch display lists/models mess with the state // DHM - Nerve:: patch display lists/models mess with the state
glEnable(GL_BLEND); glEnable(GL_BLEND);
@@ -4699,10 +4699,10 @@ void CCamWnd::ShiftTexture_BrushPrimit(face_t* f, int x, int y) {
} }
bool IsBModel(brush_t* b) { bool IsBModel(idEditorBrush* b) {
const char* v = ValueForKey(b->owner, "model"); const char* v = b->owner->ValueForKey("model");
if (v && *v) { if (v && *v) {
const char* n = ValueForKey(b->owner, "name"); const char* n = b->owner->ValueForKey("name");
return (stricmp(n, v) == 0); return (stricmp(n, v) == 0);
} }
return false; return false;
@@ -4715,7 +4715,7 @@ BuildEntityRenderState
Creates or updates modelDef and lightDef for an entity Creates or updates modelDef and lightDef for an entity
================ ================
*/ */
int Brush_ToTris(brush_t* brush, idTriList* tris, idMatList* mats, bool models, bool bmodel); int Brush_ToTris(idEditorBrush* brush, idTriList* tris, idMatList* mats, bool models, bool bmodel);
/* /*
@@ -4739,7 +4739,7 @@ reconcile pass:
#define EDITOR_RENDER_HASH_MUL 16777619u #define EDITOR_RENDER_HASH_MUL 16777619u
struct editorRenderWorldBrushState_t { struct editorRenderWorldBrushState_t {
brush_t* brush; idEditorBrush* brush;
idRenderModel* model; idRenderModel* model;
int modelDef; int modelDef;
unsigned int geometryHash; unsigned int geometryHash;
@@ -4748,14 +4748,14 @@ struct editorRenderWorldBrushState_t {
}; };
struct editorRenderEntityState_t { struct editorRenderEntityState_t {
entity_t* ent; idEditorEntity* ent;
int modelDef; int modelDef;
int lightDef; int lightDef;
bool touched; bool touched;
}; };
struct editorRenderBModelState_t { struct editorRenderBModelState_t {
entity_t* ent; idEditorEntity* ent;
idRenderModel* model; idRenderModel* model;
idStr modelName; idStr modelName;
unsigned int geometryHash; unsigned int geometryHash;
@@ -4821,13 +4821,13 @@ static bool EditorVec3Changed(const idVec3& a, const idVec3& b) {
idMath::Fabs(a.z - b.z) > epsilon; idMath::Fabs(a.z - b.z) > epsilon;
} }
static void EditorBrushRenderOrigin(brush_t* brush, idVec3& origin) { static void EditorBrushRenderOrigin(idEditorBrush* brush, idVec3& origin) {
origin[0] = (brush->mins[0] + brush->maxs[0]) * 0.5f; origin[0] = (brush->mins[0] + brush->maxs[0]) * 0.5f;
origin[1] = (brush->mins[1] + brush->maxs[1]) * 0.5f; origin[1] = (brush->mins[1] + brush->maxs[1]) * 0.5f;
origin[2] = (brush->mins[2] + brush->maxs[2]) * 0.5f; origin[2] = (brush->mins[2] + brush->maxs[2]) * 0.5f;
} }
static unsigned int EditorHashBrushGeometry(brush_t* brush, const idVec3& origin) { static unsigned int EditorHashBrushGeometry(idEditorBrush* brush, const idVec3& origin) {
unsigned int hash = EDITOR_RENDER_HASH_INIT; unsigned int hash = EDITOR_RENDER_HASH_INIT;
hash = EditorHashInt(hash, brush->pPatch ? 1 : 0); hash = EditorHashInt(hash, brush->pPatch ? 1 : 0);
@@ -4876,11 +4876,11 @@ static unsigned int EditorHashBrushGeometry(brush_t* brush, const idVec3& origin
return hash; return hash;
} }
static unsigned int EditorHashBModelGeometry(entity_t* ent, const camWndBrushFilterContext_t& filter) { static unsigned int EditorHashBModelGeometry(idEditorEntity* ent, const camWndBrushFilterContext_t& filter) {
unsigned int hash = EDITOR_RENDER_HASH_INIT; unsigned int hash = EDITOR_RENDER_HASH_INIT;
hash = EditorHashString(hash, ValueForKey(ent, "name")); hash = EditorHashString(hash, ent->ValueForKey("name"));
for (brush_t* brush = ent->brushes.onext; brush != &ent->brushes; brush = brush->onext) { for (idEditorBrush* brush = ent->brushes.onext; brush != &ent->brushes; brush = brush->onext) {
if (FilterBrush(brush) || CamWnd_MenuFilterBrush(filter, brush) || Map_IsBrushFiltered(brush)) { if (FilterBrush(brush) || CamWnd_MenuFilterBrush(filter, brush) || Map_IsBrushFiltered(brush)) {
continue; continue;
} }
@@ -4911,7 +4911,7 @@ static void EditorLocalizeTriSurfaces(idTriList& tris, const idVec3& origin) {
} }
} }
static idRenderModel* EditorBuildSingleBrushModel(brush_t* brush, const idVec3& origin) { static idRenderModel* EditorBuildSingleBrushModel(idEditorBrush* brush, const idVec3& origin) {
idTriList tris(1024); idTriList tris(1024);
idMatList mats(1024); idMatList mats(1024);
@@ -4935,11 +4935,11 @@ static idRenderModel* EditorBuildSingleBrushModel(brush_t* brush, const idVec3&
return model; return model;
} }
static idRenderModel* EditorBuildBModel(entity_t* ent, const char* name, const camWndBrushFilterContext_t& filter) { static idRenderModel* EditorBuildBModel(idEditorEntity* ent, const char* name, const camWndBrushFilterContext_t& filter) {
idTriList tris(1024); idTriList tris(1024);
idMatList mats(1024); idMatList mats(1024);
for (brush_t* brush = ent->brushes.onext; brush != &ent->brushes; brush = brush->onext) { for (idEditorBrush* brush = ent->brushes.onext; brush != &ent->brushes; brush = brush->onext) {
if (FilterBrush(brush) || CamWnd_MenuFilterBrush(filter, brush) || Map_IsBrushFiltered(brush)) { if (FilterBrush(brush) || CamWnd_MenuFilterBrush(filter, brush) || Map_IsBrushFiltered(brush)) {
continue; continue;
} }
@@ -5012,7 +5012,7 @@ static void EditorUpdateOrAddEntityDef(int& modelDef, const renderEntity_t* refe
} }
} }
static int EditorFindWorldBrushState(brush_t* brush) { static int EditorFindWorldBrushState(idEditorBrush* brush) {
for (int i = 0; i < s_editorWorldBrushStates.Num(); i++) { for (int i = 0; i < s_editorWorldBrushStates.Num(); i++) {
if (s_editorWorldBrushStates[i].brush == brush) { if (s_editorWorldBrushStates[i].brush == brush) {
return i; return i;
@@ -5034,7 +5034,7 @@ static void EditorFreeWorldBrushState(int index) {
s_editorWorldBrushStates.RemoveIndex(index); s_editorWorldBrushStates.RemoveIndex(index);
} }
static bool EditorWorldBrushRenderable(CCamWnd* cam, brush_t* brush) { static bool EditorWorldBrushRenderable(CCamWnd* cam, idEditorBrush* brush) {
if (brush->hiddenBrush) { if (brush->hiddenBrush) {
return false; return false;
} }
@@ -5059,7 +5059,7 @@ static bool EditorWorldBrushRenderable(CCamWnd* cam, brush_t* brush) {
return true; return true;
} }
static void EditorReconcileWorldBrushState(CCamWnd* cam, brush_t* brush) { static void EditorReconcileWorldBrushState(CCamWnd* cam, idEditorBrush* brush) {
if (!EditorWorldBrushRenderable(cam, brush)) { if (!EditorWorldBrushRenderable(cam, brush)) {
return; return;
} }
@@ -5132,7 +5132,7 @@ static void EditorPurgeUntouchedWorldBrushStates() {
} }
} }
static int EditorFindEntityState(entity_t* ent) { static int EditorFindEntityState(idEditorEntity* ent) {
for (int i = 0; i < s_editorEntityStates.Num(); i++) { for (int i = 0; i < s_editorEntityStates.Num(); i++) {
if (s_editorEntityStates[i].ent == ent) { if (s_editorEntityStates[i].ent == ent) {
return i; return i;
@@ -5141,7 +5141,7 @@ static int EditorFindEntityState(entity_t* ent) {
return -1; return -1;
} }
static editorRenderEntityState_t* EditorTouchEntityState(entity_t* ent) { static editorRenderEntityState_t* EditorTouchEntityState(idEditorEntity* ent) {
int index = EditorFindEntityState(ent); int index = EditorFindEntityState(ent);
if (index < 0) { if (index < 0) {
@@ -5170,26 +5170,26 @@ static editorRenderEntityState_t* EditorTouchEntityState(entity_t* ent) {
return &state; return &state;
} }
static void EditorFreeEntityModelDef(editorRenderEntityState_t* state, entity_t* ent) { static void EditorFreeEntityModelDef(editorRenderEntityState_t* state, idEditorEntity* ent) {
EditorFreeRenderEntityDef(state->modelDef); EditorFreeRenderEntityDef(state->modelDef);
if (ent) { if (ent) {
ent->modelDef = state->modelDef; ent->modelDef = state->modelDef;
} }
} }
static void EditorFreeEntityLightDef(editorRenderEntityState_t* state, entity_t* ent) { static void EditorFreeEntityLightDef(editorRenderEntityState_t* state, idEditorEntity* ent) {
EditorFreeRenderLightDef(state->lightDef); EditorFreeRenderLightDef(state->lightDef);
if (ent) { if (ent) {
ent->lightDef = state->lightDef; ent->lightDef = state->lightDef;
} }
} }
static void EditorUpdateOrAddEntityModelDef(editorRenderEntityState_t* state, entity_t* ent, const renderEntity_t* refent) { static void EditorUpdateOrAddEntityModelDef(editorRenderEntityState_t* state, idEditorEntity* ent, const renderEntity_t* refent) {
EditorUpdateOrAddEntityDef(state->modelDef, refent); EditorUpdateOrAddEntityDef(state->modelDef, refent);
ent->modelDef = state->modelDef; ent->modelDef = state->modelDef;
} }
static void EditorUpdateOrAddEntityLightDef(editorRenderEntityState_t* state, entity_t* ent, const renderLight_t* lightParms) { static void EditorUpdateOrAddEntityLightDef(editorRenderEntityState_t* state, idEditorEntity* ent, const renderLight_t* lightParms) {
if (state->lightDef >= 0) { if (state->lightDef >= 0) {
g_qeglobals.rw->UpdateLightDef(state->lightDef, lightParms); g_qeglobals.rw->UpdateLightDef(state->lightDef, lightParms);
} }
@@ -5220,7 +5220,7 @@ static void EditorPurgeUntouchedEntityStates() {
} }
} }
static int EditorFindBModelState(entity_t* ent) { static int EditorFindBModelState(idEditorEntity* ent) {
for (int i = 0; i < s_editorBModelStates.Num(); i++) { for (int i = 0; i < s_editorBModelStates.Num(); i++) {
if (s_editorBModelStates[i].ent == ent) { if (s_editorBModelStates[i].ent == ent) {
return i; return i;
@@ -5229,7 +5229,7 @@ static int EditorFindBModelState(entity_t* ent) {
return -1; return -1;
} }
static editorRenderBModelState_t* EditorTouchBModelState(entity_t* ent) { static editorRenderBModelState_t* EditorTouchBModelState(idEditorEntity* ent) {
int index = EditorFindBModelState(ent); int index = EditorFindBModelState(ent);
if (index < 0) { if (index < 0) {
@@ -5259,7 +5259,7 @@ static void EditorFreeBModelState(int index) {
s_editorBModelStates.RemoveIndex(index); s_editorBModelStates.RemoveIndex(index);
} }
static void EditorFreeBModelStateForEntity(entity_t* ent) { static void EditorFreeBModelStateForEntity(idEditorEntity* ent) {
const int index = EditorFindBModelState(ent); const int index = EditorFindBModelState(ent);
if (index >= 0) { if (index >= 0) {
EditorFreeBModelState(index); EditorFreeBModelState(index);
@@ -5275,7 +5275,7 @@ static void EditorPurgeUntouchedBModelStates() {
} }
void CCamWnd::BuildEntityRenderState(entity_t* ent, bool update) { void CCamWnd::BuildEntityRenderState(idEditorEntity* ent, bool update) {
const char* v; const char* v;
idDict spawnArgs; idDict spawnArgs;
const char* name = NULL; const char* name = NULL;
@@ -5287,7 +5287,7 @@ void CCamWnd::BuildEntityRenderState(entity_t* ent, bool update) {
// UpdateLightDef when possible. // UpdateLightDef when possible.
(void)update; (void)update;
Entity_UpdateSoundEmitter(ent); ent->Entity_UpdateSoundEmitter();
// If the entity is no longer renderable, remove only this entity's defs. // If the entity is no longer renderable, remove only this entity's defs.
if (ent->brushes.onext == &ent->brushes || if (ent->brushes.onext == &ent->brushes ||
@@ -5307,7 +5307,7 @@ void CCamWnd::BuildEntityRenderState(entity_t* ent, bool update) {
} }
// any entity can have a model // any entity can have a model
name = ValueForKey(ent, "name"); name = ent->ValueForKey("name");
v = spawnArgs.GetString("model"); v = spawnArgs.GetString("model");
if (v && *v) { if (v && *v) {
renderEntity_t refent; renderEntity_t refent;
@@ -5476,12 +5476,12 @@ void Tris_ToOBJ(const char* outFile, idTriList* tris, idMatList* mats) {
} }
} }
int Brush_TransformModel(brush_t* brush, idTriList* tris, idMatList* mats) { int Brush_TransformModel(idEditorBrush* brush, idTriList* tris, idMatList* mats) {
int ret = 0; int ret = 0;
if (brush->modelHandle > 0) { if (brush->modelHandle > 0) {
idRenderModel* model = brush->modelHandle; idRenderModel* model = brush->modelHandle;
if (model) { if (model) {
float a = FloatForKey(brush->owner, "angle"); float a = brush->owner->FloatForKey("angle");
float s, c; float s, c;
//FIXME: support full rotation matrix //FIXME: support full rotation matrix
bool matrix = false; bool matrix = false;
@@ -5490,7 +5490,7 @@ int Brush_TransformModel(brush_t* brush, idTriList* tris, idMatList* mats) {
c = cos(DEG2RAD(a)); c = cos(DEG2RAD(a));
} }
idMat3 mat; idMat3 mat;
if (GetMatrixForKey(brush->owner, "rotation", mat)) { if (brush->owner->GetMatrixForKey("rotation", mat)) {
matrix = true; matrix = true;
} }
@@ -5531,7 +5531,7 @@ int Brush_TransformModel(brush_t* brush, idTriList* tris, idMatList* mats) {
#define MAX_TRI_SURFACES 16384 #define MAX_TRI_SURFACES 16384
int Brush_ToTris(brush_t* brush, idTriList* tris, idMatList* mats, bool models, bool bmodel) { int Brush_ToTris(idEditorBrush* brush, idTriList* tris, idMatList* mats, bool models, bool bmodel) {
int i, j; int i, j;
srfTriangles_t* tri; srfTriangles_t* tri;
// //
@@ -5670,7 +5670,7 @@ void Select_ToOBJ() {
idTriList tris(1024); idTriList tris(1024);
idMatList mats(1024); idMatList mats(1024);
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->hiddenBrush) { if (b->hiddenBrush) {
continue; continue;
@@ -5706,7 +5706,7 @@ void Select_ToCM() {
mapEnt = new idMapEntity(); mapEnt = new idMapEntity();
mapEnt->epairs.Set("name", name.c_str()); mapEnt->epairs.Set("name", name.c_str());
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->hiddenBrush) { if (b->hiddenBrush) {
continue; continue;
@@ -5738,8 +5738,8 @@ so it can be rendered by the game renderSystem
================= =================
*/ */
void CCamWnd::BuildRendererState() { void CCamWnd::BuildRendererState() {
entity_t* ent; idEditorEntity* ent;
brush_t* brush; idEditorBrush* brush;
if (!s_editorRenderWorldInitialized) { if (!s_editorRenderWorldInitialized) {
// First build, or after FreeRendererState(). Do not do this on every // First build, or after FreeRendererState(). Do not do this on every
@@ -5762,7 +5762,7 @@ void CCamWnd::BuildRendererState() {
EditorBeginWorldBrushReconcile(); EditorBeginWorldBrushReconcile();
for (brush_t* brushList = &active_brushes; brushList; for (idEditorBrush* brushList = &active_brushes; brushList;
brushList = (brushList == &active_brushes) ? &selected_brushes : NULL) { brushList = (brushList == &active_brushes) ? &selected_brushes : NULL) {
for (brush = brushList->next; brush != brushList; brush = brush->next) { for (brush = brushList->next; brush != brushList; brush = brush->next) {
@@ -5808,7 +5808,7 @@ bool CCamWnd::UpdateRenderEntities() {
bool ret = false; bool ret = false;
EditorBeginEntityReconcile(); EditorBeginEntityReconcile();
for (entity_t* ent = entities.next; ent != &entities; ent = ent->next) { for (idEditorEntity* ent = entities.next; ent != &entities; ent = ent->next) {
BuildEntityRenderState(ent, true); BuildEntityRenderState(ent, true);
if (!ret && (ent->modelDef >= 0 || ent->lightDef >= 0)) { if (!ret && (ent->modelDef >= 0 || ent->lightDef >= 0)) {
ret = true; ret = true;
@@ -5838,7 +5838,7 @@ void CCamWnd::FreeRendererState() {
if (entities.next != NULL) if (entities.next != NULL)
{ {
for (entity_t* ent = entities.next; ent != &entities; ent = ent->next) { for (idEditorEntity* ent = entities.next; ent != &entities; ent = ent->next) {
ent->modelDef = -1; ent->modelDef = -1;
ent->lightDef = -1; ent->lightDef = -1;
} }
@@ -5962,8 +5962,8 @@ void CCamWnd::ToggleSoundMode() {
UpdateCaption(); UpdateCaption();
for (entity_t* ent = entities.next; ent != &entities; ent = ent->next) { for (idEditorEntity* ent = entities.next; ent != &entities; ent = ent->next) {
Entity_UpdateSoundEmitter(ent); ent->Entity_UpdateSoundEmitter();
} }
} }
@@ -6030,10 +6030,10 @@ void CCamWnd::DrawEntityData() {
glColor3fv(color.ToFloatPtr()); glColor3fv(color.ToFloatPtr());
const camWndBrushFilterContext_t brushFilter = CamWnd_MakeBrushFilterContext(this); const camWndBrushFilterContext_t brushFilter = CamWnd_MakeBrushFilterContext(this);
brush_t* brushList = &active_brushes; idEditorBrush* brushList = &active_brushes;
int pass = 0; int pass = 0;
while (brushList) { while (brushList) {
for (brush_t* brush = brushList->next; brush != brushList; brush = brush->next) { for (idEditorBrush* brush = brushList->next; brush != brushList; brush = brush->next) {
if (CullBrush(brush, true)) { if (CullBrush(brush, true)) {
continue; continue;
@@ -6048,7 +6048,7 @@ void CCamWnd::DrawEntityData() {
} }
if ((pass == 1 && selectMode) || (entityMode && pass == 0 && brush->owner->lightDef >= 0)) { if ((pass == 1 && selectMode) || (entityMode && pass == 0 && brush->owner->lightDef >= 0)) {
Brush_DrawXY(brush, 0, true, true); brush->Brush_DrawXY(0, true, true);
} }
} }
@@ -6221,11 +6221,11 @@ void CCamWnd::OnTimer(UINT_PTR nIDEvent)
void CCamWnd::UpdateCameraView() { void CCamWnd::UpdateCameraView() {
if (QE_SingleBrush(true, true)) { if (QE_SingleBrush(true, true)) {
brush_t* b = selected_brushes.next; idEditorBrush* b = selected_brushes.next;
if (b->owner->eclass->nShowFlags & ECLASS_CAMERAVIEW) { if (b->owner->eclass->nShowFlags & ECLASS_CAMERAVIEW) {
// find the entity that targets this // find the entity that targets this
const char* name = ValueForKey(b->owner, "name"); const char* name = b->owner->ValueForKey("name");
entity_t* ent = FindEntity("target", name); idEditorEntity* ent = idEditorEntity::FindEntity("target", name);
if (ent) { if (ent) {
if (!saveValid) { if (!saveValid) {
saveOrg = m_Camera.origin; saveOrg = m_Camera.origin;
+3 -3
View File
@@ -100,7 +100,7 @@ public:
void SetProjectionMatrix(); void SetProjectionMatrix();
void UpdateCameraView(); void UpdateCameraView();
void BuildEntityRenderState( entity_t *ent, bool update ); void BuildEntityRenderState( idEditorEntity *ent, bool update );
bool GetRenderMode() { bool GetRenderMode() {
return renderMode; return renderMode;
} }
@@ -129,7 +129,7 @@ public:
m_Camera.angles = angles; m_Camera.angles = angles;
} }
bool CullBrush(brush_t* b, bool cubicOnly); bool CullBrush(idEditorBrush* b, bool cubicOnly);
void FreeRendererState(); void FreeRendererState();
protected: protected:
void Cam_Init(); void Cam_Init();
@@ -156,7 +156,7 @@ protected:
bool animationMode; bool animationMode;
bool soundMode; bool soundMode;
void UpdateCaption(); void UpdateCaption();
bool BuildBrushRenderData(brush_t *brush); bool BuildBrushRenderData(idEditorBrush *brush);
void DrawEntityData(); void DrawEntityData();
+18 -20
View File
@@ -220,12 +220,12 @@ static void Drag_Setup( int x, int y, int buttons,
if (buttons == (MK_LBUTTON | MK_CONTROL)) { if (buttons == (MK_LBUTTON | MK_CONTROL)) {
Sys_Status("Shear dragging face\n"); Sys_Status("Shear dragging face\n");
Brush_SelectFaceForDragging(t.brush, t.face, true); t.brush->Brush_SelectFaceForDragging(t.face, true);
} }
else if (buttons == (MK_LBUTTON | MK_CONTROL | MK_SHIFT)) { else if (buttons == (MK_LBUTTON | MK_CONTROL | MK_SHIFT)) {
Sys_Status("Sticky dragging brush\n"); Sys_Status("Sticky dragging brush\n");
for (f = t.brush->brush_faces; f; f = f->next) { for (f = t.brush->brush_faces; f; f = f->next) {
Brush_SelectFaceForDragging(t.brush, f, false); t.brush->Brush_SelectFaceForDragging(f, false);
} }
} }
else { else {
@@ -248,12 +248,12 @@ static void Drag_Setup( int x, int y, int buttons,
// yes, special handling // yes, special handling
bool bOK = ( g_PrefsDlg.m_bALTEdge ) ? ( ::GetAsyncKeyState( VK_MENU ) != 0 ) : true; bool bOK = ( g_PrefsDlg.m_bALTEdge ) ? ( ::GetAsyncKeyState( VK_MENU ) != 0 ) : true;
if (bOK) { if (bOK) {
for (brush_t * pBrush = selected_brushes.next; pBrush != &selected_brushes; pBrush = pBrush->next) { for (idEditorBrush * pBrush = selected_brushes.next; pBrush != &selected_brushes; pBrush = pBrush->next) {
if (buttons & MK_CONTROL) { if (buttons & MK_CONTROL) {
Brush_SideSelect(pBrush, origin, dir, true); pBrush->Brush_SideSelect(origin, dir, true);
} }
else { else {
Brush_SideSelect(pBrush, origin, dir, false); pBrush->Brush_SideSelect(origin, dir, false);
} }
} }
} }
@@ -265,10 +265,10 @@ static void Drag_Setup( int x, int y, int buttons,
else { else {
// single select.. trying to drag fixed entities handle themselves and just move // single select.. trying to drag fixed entities handle themselves and just move
if (buttons & MK_CONTROL) { if (buttons & MK_CONTROL) {
Brush_SideSelect(selected_brushes.next, origin, dir, true); selected_brushes.next->Brush_SideSelect(origin, dir, true);
} }
else { else {
Brush_SideSelect(selected_brushes.next, origin, dir, false); selected_brushes.next->Brush_SideSelect(origin, dir, false);
} }
} }
@@ -374,10 +374,7 @@ void Drag_Begin( int x, int y, int buttons,
Sys_Status("Can't change an entity texture\n"); Sys_Status("Can't change an entity texture\n");
} }
else { else {
Brush_SetTexture t.brush->Brush_SetTexture(&g_qeglobals.d_texturewin.texdef,
(
t.brush,
&g_qeglobals.d_texturewin.texdef,
&g_qeglobals.d_texturewin.brushprimit_texdef, &g_qeglobals.d_texturewin.brushprimit_texdef,
false false
); );
@@ -406,7 +403,7 @@ void Drag_Begin( int x, int y, int buttons,
&g_qeglobals.d_texturewin.texdef, &g_qeglobals.d_texturewin.texdef,
&g_qeglobals.d_texturewin.brushprimit_texdef &g_qeglobals.d_texturewin.brushprimit_texdef
); );
Brush_Build(t.brush); t.brush->Brush_Build();
Sys_UpdateWindows(W_ALL); Sys_UpdateWindows(W_ALL);
} }
} }
@@ -447,7 +444,7 @@ void Drag_Begin( int x, int y, int buttons,
} }
strBuff.Format("%f %f %f", pTex->getColor().x, pTex->getColor().y, pTex->getColor().z); strBuff.Format("%f %f %f", pTex->getColor().x, pTex->getColor().y, pTex->getColor().z);
SetKeyValue(t.brush->owner, "_color", strBuff.GetBuffer(0)); t.brush->owner->SetKeyValue("_color", strBuff.GetBuffer(0));
Sys_UpdateWindows(W_ALL); Sys_UpdateWindows(W_ALL);
} }
} }
@@ -460,7 +457,7 @@ void Drag_Begin( int x, int y, int buttons,
*/ */
// strcpy(t.face->texdef.name,g_qeglobals.d_texturewin.texdef.name); // strcpy(t.face->texdef.name,g_qeglobals.d_texturewin.texdef.name);
t.face->texdef.SetName(g_qeglobals.d_texturewin.texdef.name); t.face->texdef.SetName(g_qeglobals.d_texturewin.texdef.name);
Brush_Build(t.brush); t.brush->Brush_Build();
Sys_UpdateWindows(W_ALL); Sys_UpdateWindows(W_ALL);
// } // }
} }
@@ -473,7 +470,8 @@ void Drag_Begin( int x, int y, int buttons,
} }
void Brush_GetBounds(brush_t *b, idVec3 &mins, idVec3 &maxs) { void idEditorBrush::Brush_GetBounds(idVec3 &mins, idVec3 &maxs) {
idEditorBrush *b = this;
int i; int i;
for (i = 0; i < 3; i++) { for (i = 0; i < 3; i++) {
@@ -500,7 +498,7 @@ MoveSelection
*/ */
static void MoveSelection( const idVec3 &orgMove ) { static void MoveSelection( const idVec3 &orgMove ) {
int i, success; int i, success;
brush_t *b; idEditorBrush *b;
CString strStatus; CString strStatus;
idVec3 vTemp, vTemp2, end, move; idVec3 vTemp, vTemp2, end, move;
@@ -601,7 +599,7 @@ static void MoveSelection( const idVec3 &orgMove ) {
if (g_qeglobals.d_select_mode == sel_vertex) { if (g_qeglobals.d_select_mode == sel_vertex) {
success = true; success = true;
for (b = selected_brushes.next; b != &selected_brushes; b = b->next) { for (b = selected_brushes.next; b != &selected_brushes; b = b->next) {
success &= Brush_MoveVertex(selected_brushes.next, *g_qeglobals.d_move_points[0], move, end, true); success &= selected_brushes.next->Brush_MoveVertex(*g_qeglobals.d_move_points[0], move, end, true);
} }
// if (success) // if (success)
@@ -625,7 +623,7 @@ static void MoveSelection( const idVec3 &orgMove ) {
for (b = selected_brushes.next; b != &selected_brushes; b = b->next) { for (b = selected_brushes.next; b != &selected_brushes; b = b->next) {
VectorCopy(b->maxs, vTemp); VectorCopy(b->maxs, vTemp);
VectorSubtract(vTemp, b->mins, vTemp); VectorSubtract(vTemp, b->mins, vTemp);
Brush_Build(b); b->Brush_Build();
for (i = 0; i < 3; i++) { for (i = 0; i < 3; i++) {
if if
( (
@@ -662,7 +660,7 @@ static void MoveSelection( const idVec3 &orgMove ) {
} }
for (b = selected_brushes.next; b != &selected_brushes; b = b->next) { for (b = selected_brushes.next; b != &selected_brushes; b = b->next) {
Brush_Build(b); b->Brush_Build();
} }
} }
} }
@@ -672,7 +670,7 @@ static void MoveSelection( const idVec3 &orgMove ) {
// necessary because Brush_Build can remove windings // necessary because Brush_Build can remove windings
// //
for (b = selected_brushes.next; b != &selected_brushes; b = b->next) { for (b = selected_brushes.next; b != &selected_brushes; b = b->next) {
Brush_ResetFaceOriginals(b); b->Brush_ResetFaceOriginals();
} }
Select_Move(move); Select_Move(move);
+1 -1
View File
@@ -1406,7 +1406,7 @@ void CDialogTextures::OnDblclkTreeTextures(NMHDR *pNMHDR, LRESULT *pResult) {
if (!m_treeTextures.ItemHasChildren(item)) { if (!m_treeTextures.ItemHasChildren(item)) {
idStr shaderName = m_treeTextures.GetItemText(item); idStr shaderName = m_treeTextures.GetItemText(item);
Select_SetKeyVal("s_shader", shaderName); Select_SetKeyVal("s_shader", shaderName);
entity_t *ent = selected_brushes.next->owner; idEditorEntity *ent = selected_brushes.next->owner;
if (ent) { if (ent) {
g_Inspectors->UpdateEntitySel(ent->eclass); g_Inspectors->UpdateEntitySel(ent->eclass);
MessageBeep(MB_OK); MessageBeep(MB_OK);
+8 -11
View File
@@ -8,15 +8,12 @@
// These are present in the classic Doom 3 Radiant/DoomEdit tree. // These are present in the classic Doom 3 Radiant/DoomEdit tree.
// In some forks you may need to include the exact headers instead of externs. // In some forks you may need to include the exact headers instead of externs.
extern brush_t active_brushes; extern idEditorBrush active_brushes;
extern brush_t selected_brushes; extern idEditorBrush selected_brushes;
extern entity_t* world_entity; extern idEditorEntity* world_entity;
extern brush_t* Brush_Alloc(void); extern idEditorBrush* Brush_Alloc(void);
extern face_t* Face_Alloc(void); extern face_t* Face_Alloc(void);
extern void Brush_AddToList(brush_t* b, brush_t* list);
extern void Entity_LinkBrush(entity_t* e, brush_t* b);
extern void Brush_Build(brush_t* b, bool bSnap, bool bMarkMap, bool bConvert, bool updateLights);
extern void Sys_UpdateWindows(int nBits); extern void Sys_UpdateWindows(int nBits);
extern const idMaterial* Texture_ForName(const char* name); extern const idMaterial* Texture_ForName(const char* name);
@@ -1065,7 +1062,7 @@ private:
return false; return false;
} }
brush_t* b = Brush_Alloc(); idEditorBrush* b = Brush_Alloc();
if (b == NULL) { if (b == NULL) {
return false; return false;
} }
@@ -1095,13 +1092,13 @@ private:
b->brush_faces = f; b->brush_faces = f;
} }
Brush_AddToList(b, &selected_brushes); b->Brush_AddToList(&selected_brushes);
Entity_LinkBrush(world_entity, b); world_entity->Entity_LinkBrush(b);
// Do not snap imported Build geometry. Duke slopes and tiny detail sectors // Do not snap imported Build geometry. Duke slopes and tiny detail sectors
// are intentionally off-grid after scale conversion; snapping the plane // are intentionally off-grid after scale conversion; snapping the plane
// points is a common cause of "Unable to create face winding on brush". // points is a common cause of "Unable to create face winding on brush".
Brush_Build(b, false, true, false, true); b->Brush_Build(false, true, false, true);
return true; return true;
} }
+1 -1
View File
@@ -423,7 +423,7 @@ eclass_t *Eclass_ForName (const char *name, bool has_brushes)
} }
eclass_t* GetCachedModel(entity_t *pEntity, const char *pName, idVec3 &vMin, idVec3 &vMax) eclass_t* GetCachedModel(idEditorEntity *pEntity, const char *pName, idVec3 &vMin, idVec3 &vMax)
{ {
eclass_t *e = NULL; eclass_t *e = NULL;
if (pName == NULL || strlen(pName) == 0) { if (pName == NULL || strlen(pName) == 0) {
File diff suppressed because it is too large Load Diff
+9 -37
View File
@@ -28,45 +28,17 @@ If you have questions concerning this license or the applicable additional terms
// brush.h // brush.h
brush_t* Brush_Alloc(); idEditorBrush* Brush_Alloc();
void Brush_Free(brush_t* b, bool bRemoveNode = true); void Brush_Free(idEditorBrush* b, bool bRemoveNode = true);
int Brush_MemorySize(brush_t* b);
void Brush_MakeSided(int sides); void Brush_MakeSided(int sides);
void Brush_MakeSidedCone(int sides); void Brush_MakeSidedCone(int sides);
void Brush_Move(brush_t* b, const idVec3 move, bool bSnap = true, bool updateOrigin = true); idEditorBrush* Brush_Parse(const idVec3 origin);
int Brush_MoveVertex(brush_t* b, const idVec3& vertex, const idVec3& delta, idVec3& end, bool bSnap); idEditorBrush* Brush_Clone(idEditorBrush* b);
void Brush_ResetFaceOriginals(brush_t* b); idEditorBrush* Brush_FullClone(idEditorBrush* b);
brush_t* Brush_Parse(const idVec3 origin); idEditorBrush* Brush_Create(idVec3 mins, idVec3 maxs, texdef_t* texdef);
face_t* Brush_Ray(idVec3 origin, idVec3 dir, brush_t* b, float* dist, bool testPrimitive = false); idEditorBrush* Brush_CreateFaceExtrusion(idEditorBrush* sourceBrush, face_t* sourceFace, float distance);
void Brush_RemoveFromList(brush_t* b); void Brush_SplitBrushByFace(idEditorBrush* in, face_t* f, idEditorBrush** front, idEditorBrush** back);
void Brush_AddToList(brush_t* b, brush_t* list);
void Brush_Build(brush_t* b, bool bSnap = true, bool bMarkMap = true, bool bConvert = false, bool updateLights = true);
void Brush_BuildWindings(brush_t* b, bool bSnap = true, bool keepOnPlaneWinding = false, bool updateLights = true, bool makeFacePlanes = true);
brush_t* Brush_Clone(brush_t* b);
brush_t* Brush_FullClone(brush_t* b);
brush_t* Brush_Create(idVec3 mins, idVec3 maxs, texdef_t* texdef);
brush_t* Brush_CreateFaceExtrusion(brush_t* sourceBrush, face_t* sourceFace, float distance);
void Brush_Draw(brush_t* b, bool bSelected = false);
void Brush_DrawXY(brush_t* b, int nViewType, bool bSelected = false, bool ignoreViewType = false);
void Brush_SplitBrushByFace(brush_t* in, face_t* f, brush_t** front, brush_t** back);
void Brush_SelectFaceForDragging(brush_t* b, face_t* f, bool shear);
void Brush_SetTexture(brush_t* b, texdef_t* texdef, brushprimit_texdef_t* brushprimit_texdef, bool bFitScale = false);
void Brush_SideSelect(brush_t* b, idVec3 origin, idVec3 dir, bool shear);
void Brush_SnapToGrid(brush_t* pb);
void Brush_Rotate(brush_t* b, idVec3 vAngle, idVec3 vOrigin, bool bBuild = true);
void Brush_MakeSidedSphere(int sides); void Brush_MakeSidedSphere(int sides);
void Brush_Write(brush_t* b, FILE* f, const idVec3& origin, bool newFormat);
void Brush_Write(brush_t* b, CMemFile* pMemFile, const idVec3& origin, bool NewFormat);
void Brush_RemoveEmptyFaces(brush_t* b);
idWinding* Brush_MakeFaceWinding(brush_t* b, face_t* face, bool keepOnPlaneWinding = false);
void Brush_SetTextureName(brush_t* b, const char* name);
void Brush_Print(brush_t* b);
void Brush_FitTexture(brush_t* b, float height, float width);
void Brush_SetEpair(brush_t* b, const char* pKey, const char* pValue);
const char* Brush_GetKeyValue(brush_t* b, const char* pKey);
const char* Brush_Name(brush_t* b);
void Brush_RebuildBrush(brush_t* b, idVec3 vMins, idVec3 vMaxs, bool patch = true);
void Brush_GetBounds(brush_t* b, idBounds& bo);
face_t* Face_Alloc(void); face_t* Face_Alloc(void);
void Face_Free(face_t* f); void Face_Free(face_t* f);
@@ -75,6 +47,6 @@ void Face_MakePlane(face_t* f);
void Face_Draw(face_t* face); void Face_Draw(face_t* face);
void Face_TextureVectors(face_t* f, float STfromXYZ[2][4]); void Face_TextureVectors(face_t* f, float STfromXYZ[2][4]);
void Face_FitTexture(face_t* face, float height, float width); void Face_FitTexture(face_t* face, float height, float width);
void SetFaceTexdef(brush_t* b, face_t* f, texdef_t* texdef, brushprimit_texdef_t* brushprimit_texdef, bool bFitScale = false); void SetFaceTexdef(idEditorBrush* b, face_t* f, texdef_t* texdef, brushprimit_texdef_t* brushprimit_texdef, bool bFitScale = false);
int AddPlanept(idVec3* f); int AddPlanept(idVec3* f);
@@ -209,7 +209,8 @@ void EmitBrushPrimitTextureCoordinates(face_t *f, idWinding *w, patchMesh_t *pat
// parse a brush in brush primitive format // parse a brush in brush primitive format
// ======================================================================================================================= // =======================================================================================================================
// //
void BrushPrimit_Parse(brush_t *b, bool newFormat, const idVec3 origin) { void idEditorBrush::BrushPrimit_Parse(bool newFormat, const idVec3 origin) {
idEditorBrush *b = this;
face_t *f; face_t *f;
int i, j; int i, j;
GetToken(true); GetToken(true);
@@ -256,7 +257,7 @@ void BrushPrimit_Parse(brush_t *b, bool newFormat, const idVec3 origin) {
f->originalPlane = plane; f->originalPlane = plane;
f->dirty = false; f->dirty = false;
//idWinding *w = Brush_MakeFaceWinding(b, f, true); //idWinding *w = b->Brush_MakeFaceWinding(f, true);
idWinding w; idWinding w;
w.BaseForPlane( plane ); w.BaseForPlane( plane );
@@ -1135,7 +1136,8 @@ void Face_FlipTexture_BrushPrimit(face_t *f, bool y) {
#endif #endif
} }
void Brush_FlipTexture_BrushPrimit(brush_t *b, bool y) { void idEditorBrush::Brush_FlipTexture_BrushPrimit(bool y) {
idEditorBrush *b = this;
for (face_t *f = b->brush_faces; f; f = f->next) { for (face_t *f = b->brush_faces; f; f = f->next) {
Face_FlipTexture_BrushPrimit(f, y); Face_FlipTexture_BrushPrimit(f, y);
} }
+181 -184
View File
@@ -36,9 +36,7 @@ int g_entityId = 1;
#define CURVE_TAG "curve_" #define CURVE_TAG "curve_"
extern void Brush_Resize(brush_t *b, idVec3 vMin, idVec3 vMax); int idEditorEntity::GetNumKeys()
int GetNumKeys(entity_t *ent)
{ {
// int iCount = 0; // int iCount = 0;
// for (epair_t* ep=ent->epairs ; ep ; ep=ep->next) // for (epair_t* ep=ent->epairs ; ep ; ep=ep->next)
@@ -46,11 +44,11 @@ int GetNumKeys(entity_t *ent)
// iCount++; // iCount++;
// } // }
int iCount = ent->epairs.GetNumKeyVals(); int iCount = epairs.GetNumKeyVals();
return iCount; return iCount;
} }
const char *GetKeyString(entity_t *ent, int iIndex) const char *idEditorEntity::GetKeyString(int iIndex)
{ {
// for (epair_t* ep=ent->epairs ; ep ; ep=ep->next) // for (epair_t* ep=ent->epairs ; ep ; ep=ep->next)
// { // {
@@ -61,9 +59,9 @@ const char *GetKeyString(entity_t *ent, int iIndex)
// assert(0); // assert(0);
// return NULL; // return NULL;
if ( iIndex < GetNumKeys(ent) ) if ( iIndex < GetNumKeys() )
{ {
return ent->epairs.GetKeyVal(iIndex)->GetKey().c_str(); return epairs.GetKeyVal(iIndex)->GetKey().c_str();
} }
assert(0); assert(0);
@@ -75,29 +73,29 @@ const char *GetKeyString(entity_t *ent, int iIndex)
======================================================================================================================= =======================================================================================================================
======================================================================================================================= =======================================================================================================================
*/ */
const char *ValueForKey(entity_t *ent, const char *key) { const char *idEditorEntity::ValueForKey(const char *key) {
return ent->epairs.GetString(key); return epairs.GetString(key);
} }
/* /*
======================================================================================================================= =======================================================================================================================
======================================================================================================================= =======================================================================================================================
*/ */
void TrackMD3Angles(entity_t *e, const char *key, const char *value) { void TrackMD3Angles(idEditorEntity *e, const char *key, const char *value) {
if ( idStr::Icmp(key, "angle") != 0 ) { if ( idStr::Icmp(key, "angle") != 0 ) {
return; return;
} }
if ((e->eclass->fixedsize && e->eclass->nShowFlags & ECLASS_MISCMODEL) || EntityHasModel(e)) { if ((e->eclass->fixedsize && e->eclass->nShowFlags & ECLASS_MISCMODEL) || e->EntityHasModel()) {
float a = FloatForKey(e, "angle"); float a = e->FloatForKey("angle");
float b = atof(value); float b = atof(value);
if (a != b) { if (a != b) {
idVec3 vAngle; idVec3 vAngle;
vAngle[0] = vAngle[1] = 0; vAngle[0] = vAngle[1] = 0;
vAngle[2] = -a; vAngle[2] = -a;
Brush_Rotate(e->brushes.onext, vAngle, e->origin, true); e->brushes.onext->Brush_Rotate(vAngle, e->origin, true);
vAngle[2] = b; vAngle[2] = b;
Brush_Rotate(e->brushes.onext, vAngle, e->origin, true); e->brushes.onext->Brush_Rotate(vAngle, e->origin, true);
} }
} }
} }
@@ -106,54 +104,42 @@ void TrackMD3Angles(entity_t *e, const char *key, const char *value) {
======================================================================================================================= =======================================================================================================================
======================================================================================================================= =======================================================================================================================
*/ */
void SetKeyValue(entity_t *ent, const char *key, const char *value, bool trackAngles) { void idEditorEntity::SetKeyValue(const char *key, const char *value, bool trackAngles) {
if (ent == NULL) {
return;
}
if (!key || !key[0]) { if (!key || !key[0]) {
return; return;
} }
if (trackAngles) { if (trackAngles) {
TrackMD3Angles(ent, key, value); TrackMD3Angles(this, key, value);
} }
ent->epairs.Set(key, value); epairs.Set(key, value);
GetVectorForKey(ent, "origin", ent->origin); GetVectorForKey("origin", origin);
// update sound in case this key was relevent // update sound in case this key was relevent
Entity_UpdateSoundEmitter( ent ); Entity_UpdateSoundEmitter();
} }
/* /*
======================================================================================================================= =======================================================================================================================
======================================================================================================================= =======================================================================================================================
*/ */
void SetKeyVec3(entity_t *ent, const char *key, idVec3 v) { void idEditorEntity::SetKeyVec3(const char *key, idVec3 v) {
if (ent == NULL) {
return;
}
if (!key || !key[0]) { if (!key || !key[0]) {
return; return;
} }
idStr str; idStr str;
sprintf(str, "%g %g %g", v.x, v.y, v.z); sprintf(str, "%g %g %g", v.x, v.y, v.z);
ent->epairs.Set(key, str); epairs.Set(key, str);
GetVectorForKey(ent, "origin", ent->origin); GetVectorForKey("origin", origin);
} }
/* /*
======================================================================================================================= =======================================================================================================================
======================================================================================================================= =======================================================================================================================
*/ */
void SetKeyMat3(entity_t *ent, const char *key, idMat3 m) { void idEditorEntity::SetKeyMat3(const char *key, idMat3 m) {
if (ent == NULL) {
return;
}
if (!key || !key[0]) { if (!key || !key[0]) {
return; return;
} }
@@ -162,8 +148,8 @@ void SetKeyMat3(entity_t *ent, const char *key, idMat3 m) {
sprintf(str, "%g %g %g %g %g %g %g %g %g",m[0][0],m[0][1],m[0][2],m[1][0],m[1][1],m[1][2],m[2][0],m[2][1],m[2][2]); sprintf(str, "%g %g %g %g %g %g %g %g %g",m[0][0],m[0][1],m[0][2],m[1][0],m[1][1],m[1][2],m[2][0],m[2][1],m[2][2]);
ent->epairs.Set(key, str); epairs.Set(key, str);
GetVectorForKey(ent, "origin", ent->origin); GetVectorForKey("origin", origin);
} }
@@ -172,10 +158,10 @@ void SetKeyMat3(entity_t *ent, const char *key, idMat3 m) {
======================================================================================================================= =======================================================================================================================
======================================================================================================================= =======================================================================================================================
*/ */
void DeleteKey(entity_t *ent, const char *key) { void idEditorEntity::DeleteKey(const char *key) {
ent->epairs.Delete(key); epairs.Delete(key);
if (stricmp(key, "rotation") == 0) { if (stricmp(key, "rotation") == 0) {
ent->rotation.Identity(); rotation.Identity();
} }
} }
@@ -183,10 +169,10 @@ void DeleteKey(entity_t *ent, const char *key) {
======================================================================================================================= =======================================================================================================================
======================================================================================================================= =======================================================================================================================
*/ */
float FloatForKey(entity_t *ent, const char *key) { float idEditorEntity::FloatForKey(const char *key) {
const char *k; const char *k;
k = ValueForKey(ent, key); k = ValueForKey(key);
if (k && *k) { if (k && *k) {
return atof(k); return atof(k);
} }
@@ -198,10 +184,10 @@ float FloatForKey(entity_t *ent, const char *key) {
======================================================================================================================= =======================================================================================================================
======================================================================================================================= =======================================================================================================================
*/ */
int IntForKey(entity_t *ent, const char *key) { int idEditorEntity::IntForKey(const char *key) {
const char *k; const char *k;
k = ValueForKey(ent, key); k = ValueForKey(key);
return atoi(k); return atoi(k);
} }
@@ -209,9 +195,9 @@ int IntForKey(entity_t *ent, const char *key) {
======================================================================================================================= =======================================================================================================================
======================================================================================================================= =======================================================================================================================
*/ */
bool GetVectorForKey(entity_t *ent, const char *key, idVec3 &vec) { bool idEditorEntity::GetVectorForKey(const char *key, idVec3 &vec) {
const char *k; const char *k;
k = ValueForKey(ent, key); k = ValueForKey(key);
if (k && strlen(k) > 0) { if (k && strlen(k) > 0) {
sscanf(k, "%f %f %f", &vec[0], &vec[1], &vec[2]); sscanf(k, "%f %f %f", &vec[0], &vec[1], &vec[2]);
return true; return true;
@@ -227,9 +213,9 @@ bool GetVectorForKey(entity_t *ent, const char *key, idVec3 &vec) {
======================================================================================================================= =======================================================================================================================
======================================================================================================================= =======================================================================================================================
*/ */
bool GetVector4ForKey(entity_t *ent, const char *key, idVec4 &vec) { bool idEditorEntity::GetVector4ForKey(const char *key, idVec4 &vec) {
const char *k; const char *k;
k = ValueForKey(ent, key); k = ValueForKey(key);
if (k && strlen(k) > 0) { if (k && strlen(k) > 0) {
sscanf(k, "%f %f %f %f", &vec[0], &vec[1], &vec[2], &vec[3]); sscanf(k, "%f %f %f %f", &vec[0], &vec[1], &vec[2], &vec[3]);
return true; return true;
@@ -245,9 +231,9 @@ bool GetVector4ForKey(entity_t *ent, const char *key, idVec4 &vec) {
======================================================================================================================= =======================================================================================================================
======================================================================================================================= =======================================================================================================================
*/ */
bool GetFloatForKey(entity_t *ent, const char *key, float *f) { bool idEditorEntity::GetFloatForKey(const char *key, float *f) {
const char *k; const char *k;
k = ValueForKey(ent, key); k = ValueForKey(key);
if (k && strlen(k) > 0) { if (k && strlen(k) > 0) {
*f = atof(k); *f = atof(k);
return true; return true;
@@ -261,9 +247,9 @@ bool GetFloatForKey(entity_t *ent, const char *key, float *f) {
======================================================================================================================= =======================================================================================================================
======================================================================================================================= =======================================================================================================================
*/ */
bool GetMatrixForKey(entity_t *ent, const char *key, idMat3 &mat) { bool idEditorEntity::GetMatrixForKey(const char *key, idMat3 &mat) {
const char *k; const char *k;
k = ValueForKey(ent, key); k = ValueForKey(key);
if (k && strlen(k) > 0) { if (k && strlen(k) > 0) {
sscanf sscanf
( (
@@ -293,8 +279,8 @@ bool GetMatrixForKey(entity_t *ent, const char *key, idMat3 &mat) {
Entity_FreeEpairs Frees the entity epairs. Entity_FreeEpairs Frees the entity epairs.
======================================================================================================================= =======================================================================================================================
*/ */
void Entity_FreeEpairs(entity_t *e) { void idEditorEntity::Entity_FreeEpairs() {
e->epairs.Clear(); epairs.Clear();
} }
/* /*
@@ -302,7 +288,9 @@ void Entity_FreeEpairs(entity_t *e) {
Entity_AddToList Entity_AddToList
======================================================================================================================= =======================================================================================================================
*/ */
void Entity_AddToList(entity_t *e, entity_t *list) { void idEditorEntity::Entity_AddToList(idEditorEntity *list) {
idEditorEntity *e = this;
if (e->next || e->prev) { if (e->next || e->prev) {
Error("Entity_AddToList: allready linked"); Error("Entity_AddToList: allready linked");
} }
@@ -318,7 +306,9 @@ void Entity_AddToList(entity_t *e, entity_t *list) {
Entity_RemoveFromList Entity_RemoveFromList
======================================================================================================================= =======================================================================================================================
*/ */
void Entity_RemoveFromList(entity_t *e) { void idEditorEntity::Entity_RemoveFromList() {
idEditorEntity *e = this;
if ( !e->next || !e->prev ) { if ( !e->next || !e->prev ) {
Error("Entity_RemoveFromList: not linked"); Error("Entity_RemoveFromList: not linked");
} }
@@ -333,7 +323,7 @@ void Entity_RemoveFromList(entity_t *e) {
Entity_Free Frees the entity and any brushes is has. The entity is removed from the global entities list. Entity_Free Frees the entity and any brushes is has. The entity is removed from the global entities list.
======================================================================================================================= =======================================================================================================================
*/ */
void Entity_Free( entity_t *e ) { void idEditorEntity::Entity_Free( idEditorEntity *e ) {
while ( e->brushes.onext != &e->brushes ) { while ( e->brushes.onext != &e->brushes ) {
Brush_Free(e->brushes.onext); Brush_Free(e->brushes.onext);
@@ -344,7 +334,7 @@ void Entity_Free( entity_t *e ) {
e->prev->next = e->next; e->prev->next = e->next;
} }
Entity_FreeEpairs( e ); e->Entity_FreeEpairs();
delete e; delete e;
} }
@@ -355,15 +345,16 @@ void Entity_Free( entity_t *e ) {
======================================================================================================================= =======================================================================================================================
*/ */
int Entity_MemorySize( entity_t *e ) int idEditorEntity::Entity_MemorySize()
{ {
brush_t *b; idEditorEntity *e = this;
idEditorBrush *b;
int size; int size;
size = sizeof( entity_t ) + e->epairs.Size(); size = sizeof( idEditorEntity ) + e->epairs.Size();
for( b = e->brushes.onext; b != &e->brushes; b = b->onext ) for( b = e->brushes.onext; b != &e->brushes; b = b->onext )
{ {
size += Brush_MemorySize( b ); size += b->Brush_MemorySize();
} }
return( size ); return( size );
} }
@@ -438,16 +429,14 @@ void ParseEpair(idDict *dict) {
======================================================================================================================= =======================================================================================================================
======================================================================================================================= =======================================================================================================================
*/ */
bool EntityHasModel(entity_t *ent) { bool idEditorEntity::EntityHasModel() {
if (ent) { const char *model = ValueForKey("model");
const char *model = ValueForKey(ent, "model"); const char *name = ValueForKey("name");
const char *name = ValueForKey(ent, "name");
if (model && *model) { if (model && *model) {
if ( idStr::Icmp(model, name) ) { if ( idStr::Icmp(model, name) ) {
return true; return true;
} }
} }
}
return false; return false;
} }
@@ -456,8 +445,8 @@ bool EntityHasModel(entity_t *ent) {
======================================================================================================================= =======================================================================================================================
======================================================================================================================= =======================================================================================================================
*/ */
entity_t *Entity_New() { idEditorEntity *idEditorEntity::Entity_New() {
entity_t *ent = new entity_t; idEditorEntity *ent = new idEditorEntity;
ent->prev = ent->next = NULL; ent->prev = ent->next = NULL;
ent->brushes.prev = ent->brushes.next = NULL; ent->brushes.prev = ent->brushes.next = NULL;
@@ -480,7 +469,8 @@ entity_t *Entity_New() {
return ent; return ent;
} }
void Entity_UpdateCurveData( entity_t *ent ) { void idEditorEntity::Entity_UpdateCurveData() {
idEditorEntity *ent = this;
if ( ent == NULL || ent->curve == NULL ) { if ( ent == NULL || ent->curve == NULL ) {
return; return;
@@ -513,7 +503,8 @@ void Entity_UpdateCurveData( entity_t *ent ) {
} }
idCurve<idVec3> *Entity_MakeCurve( entity_t *ent ) { idCurve<idVec3> *idEditorEntity::Entity_MakeCurve() {
idEditorEntity *ent = this;
const idKeyValue *kv = ent->epairs.MatchPrefix( CURVE_TAG ); const idKeyValue *kv = ent->epairs.MatchPrefix( CURVE_TAG );
if ( kv ) { if ( kv ) {
idStr str = kv->GetKey().Right( kv->GetKey().Length() - strlen( CURVE_TAG ) ); idStr str = kv->GetKey().Right( kv->GetKey().Length() - strlen( CURVE_TAG ) );
@@ -526,9 +517,10 @@ idCurve<idVec3> *Entity_MakeCurve( entity_t *ent ) {
return NULL; return NULL;
} }
void Entity_SetCurveData( entity_t *ent ) { void idEditorEntity::Entity_SetCurveData() {
idEditorEntity *ent = this;
ent->curve = Entity_MakeCurve( ent ); ent->curve = Entity_MakeCurve();
const idKeyValue *kv = ent->epairs.MatchPrefix( CURVE_TAG ); const idKeyValue *kv = ent->epairs.MatchPrefix( CURVE_TAG );
if ( kv && ent->curve ) { if ( kv && ent->curve ) {
idLexer lex; idLexer lex;
@@ -552,16 +544,17 @@ void Entity_SetCurveData( entity_t *ent ) {
} }
entity_t *Entity_PostParse(entity_t *ent, brush_t *pList) { idEditorEntity *idEditorEntity::Entity_PostParse(idEditorBrush *pList) {
idEditorEntity *ent = this;
bool has_brushes; bool has_brushes;
eclass_t *e; eclass_t *e;
brush_t *b; idEditorBrush *b;
idVec3 mins, maxs, zero; idVec3 mins, maxs, zero;
idBounds bo; idBounds bo;
zero.Zero(); zero.Zero();
Entity_SetCurveData( ent ); ent->Entity_SetCurveData();
if (ent->brushes.onext == &ent->brushes) { if (ent->brushes.onext == &ent->brushes) {
has_brushes = false; has_brushes = false;
@@ -570,15 +563,15 @@ entity_t *Entity_PostParse(entity_t *ent, brush_t *pList) {
has_brushes = true; has_brushes = true;
} }
bool needsOrigin = !GetVectorForKey(ent, "origin", ent->origin); bool needsOrigin = !ent->GetVectorForKey("origin", ent->origin);
const char *pModel = ValueForKey(ent, "model"); const char *pModel = ent->ValueForKey("model");
const char *cp = ValueForKey(ent, "classname"); const char *cp = ent->ValueForKey("classname");
if (strlen(cp)) { if (strlen(cp)) {
e = Eclass_ForName(cp, has_brushes); e = Eclass_ForName(cp, has_brushes);
} else { } else {
const char *cp2 = ValueForKey(ent, "name"); const char *cp2 = ent->ValueForKey("name");
if (strlen(cp2)) { if (strlen(cp2)) {
char buff[1024]; char buff[1024];
strcpy(buff, cp2); strcpy(buff, cp2);
@@ -588,7 +581,7 @@ entity_t *Entity_PostParse(entity_t *ent, brush_t *pList) {
len--; len--;
} }
e = Eclass_ForName(buff, has_brushes); e = Eclass_ForName(buff, has_brushes);
SetKeyValue(ent, "classname", buff, false); ent->SetKeyValue("classname", buff, false);
} else { } else {
e = Eclass_ForName("", has_brushes); e = Eclass_ForName("", has_brushes);
} }
@@ -602,7 +595,7 @@ entity_t *Entity_PostParse(entity_t *ent, brush_t *pList) {
ent->eclass = e; ent->eclass = e;
bool hasModel = EntityHasModel(ent); bool hasModel = ent->EntityHasModel();
if (hasModel) { if (hasModel) {
ent->eclass->defArgs.GetString("model", "", str); ent->eclass->defArgs.GetString("model", "", str);
@@ -617,14 +610,14 @@ entity_t *Entity_PostParse(entity_t *ent, brush_t *pList) {
needsOrigin = false; needsOrigin = false;
ent->epairs.Delete( "model" ); ent->epairs.Delete( "model" );
} else if (e->nShowFlags & ECLASS_LIGHT) { } else if (e->nShowFlags & ECLASS_LIGHT) {
if (GetVectorForKey(ent, "light_origin", ent->lightOrigin)) { if (ent->GetVectorForKey("light_origin", ent->lightOrigin)) {
GetMatrixForKey(ent, "light_rotation", ent->lightRotation); ent->GetMatrixForKey("light_rotation", ent->lightRotation);
ent->trackLightOrigin = true; ent->trackLightOrigin = true;
} else if (hasModel) { } else if (hasModel) {
SetKeyValue(ent, "light_origin", ValueForKey(ent, "origin")); ent->SetKeyValue("light_origin", ent->ValueForKey("origin"));
ent->lightOrigin = ent->origin; ent->lightOrigin = ent->origin;
if (GetMatrixForKey(ent, "rotation", ent->lightRotation)) { if (ent->GetMatrixForKey("rotation", ent->lightRotation)) {
SetKeyValue(ent, "light_rotation", ValueForKey(ent, "rotation")); ent->SetKeyValue("light_rotation", ent->ValueForKey("rotation"));
} }
ent->trackLightOrigin = true; ent->trackLightOrigin = true;
} }
@@ -678,22 +671,19 @@ entity_t *Entity_PostParse(entity_t *ent, brush_t *pList) {
b->modelHandle = modelHandle; b->modelHandle = modelHandle;
float yaw = 0; float yaw = 0;
bool convertAngles = GetFloatForKey(ent, "angle", &yaw); bool convertAngles = ent->GetFloatForKey("angle", &yaw);
extern void Brush_Rotate(brush_t *b, idMat3 matrix, idVec3 origin, bool bBuild);
extern void Brush_Rotate(brush_t *b, idVec3 rot, idVec3 origin, bool bBuild);
if (convertAngles) { if (convertAngles) {
idVec3 rot(0, 0, yaw); idVec3 rot(0, 0, yaw);
Brush_Rotate(b, rot, ent->origin, false); b->Brush_Rotate(rot, ent->origin, false);
} }
if (GetMatrixForKey(ent, "rotation", ent->rotation)) { if (ent->GetMatrixForKey("rotation", ent->rotation)) {
idBounds bo2; idBounds bo2;
bo2.FromTransformedBounds(bo, ent->origin, ent->rotation); bo2.FromTransformedBounds(bo, ent->origin, ent->rotation);
b->owner = ent; b->owner = ent;
Brush_Resize(b, bo2[0], bo2[1]); b->Brush_Resize(bo2[0], bo2[1]);
} }
Entity_LinkBrush(ent, b); ent->Entity_LinkBrush(b);
} }
if (!hasModel || (ent->eclass->nShowFlags & ECLASS_LIGHT && hasModel)) { if (!hasModel || (ent->eclass->nShowFlags & ECLASS_LIGHT && hasModel)) {
@@ -707,14 +697,14 @@ entity_t *Entity_PostParse(entity_t *ent, brush_t *pList) {
} }
b = Brush_Create(mins, maxs, &e->texdef); b = Brush_Create(mins, maxs, &e->texdef);
GetMatrixForKey(ent, "rotation", ent->rotation); ent->GetMatrixForKey("rotation", ent->rotation);
Entity_LinkBrush(ent, b); ent->Entity_LinkBrush(b);
b->trackLightOrigin = ent->trackLightOrigin; b->trackLightOrigin = ent->trackLightOrigin;
if ( e->texdef.name == NULL ) { if ( e->texdef.name == NULL ) {
brushprimit_texdef_t bp; brushprimit_texdef_t bp;
texdef_t td; texdef_t td;
td.SetName( ent->eclass->defMaterial ); td.SetName( ent->eclass->defMaterial );
Brush_SetTexture( b, &td, &bp, false ); b->Brush_SetTexture(&td, &bp, false );
} }
} }
} else { // brush entity } else { // brush entity
@@ -723,9 +713,9 @@ entity_t *Entity_PostParse(entity_t *ent, brush_t *pList) {
} }
if (!needsOrigin) { if (!needsOrigin) {
idStr cn = ValueForKey(ent, "classname"); idStr cn = ent->ValueForKey("classname");
idStr name = ValueForKey(ent, "name"); idStr name = ent->ValueForKey("name");
idStr model = ValueForKey(ent, "model"); idStr model = ent->ValueForKey("model");
if (cn.Icmp("func_static") == 0) { if (cn.Icmp("func_static") == 0) {
if (name.Icmp(model) == 0) { if (name.Icmp(model) == 0) {
needsOrigin = true; needsOrigin = true;
@@ -742,7 +732,7 @@ entity_t *Entity_PostParse(entity_t *ent, brush_t *pList) {
// add in the origin // add in the origin
for (b = ent->brushes.onext; b != &ent->brushes; b = b->onext) { for (b = ent->brushes.onext; b != &ent->brushes; b = b->onext) {
Brush_Build(b, true, false, false); b->Brush_Build(true, false, false);
for (i = 0; i < 3; i++) { for (i = 0; i < 3; i++) {
if (b->mins[i] < mins[i]) { if (b->mins[i] < mins[i]) {
mins[i] = b->mins[i]; mins[i] = b->mins[i];
@@ -759,16 +749,16 @@ entity_t *Entity_PostParse(entity_t *ent, brush_t *pList) {
} }
sprintf(text, "%i %i %i", (int)ent->origin[0], (int)ent->origin[1], (int)ent->origin[2]); sprintf(text, "%i %i %i", (int)ent->origin[0], (int)ent->origin[1], (int)ent->origin[2]);
SetKeyValue(ent, "origin", text); ent->SetKeyValue("origin", text);
} }
if (!(e->nShowFlags & ECLASS_WORLDSPAWN)) { if (!(e->nShowFlags & ECLASS_WORLDSPAWN)) {
if (e->defArgs.FindKey("model") == NULL && (pModel == NULL || (pModel && strlen(pModel) == 0))) { if (e->defArgs.FindKey("model") == NULL && (pModel == NULL || (pModel && strlen(pModel) == 0))) {
SetKeyValue(ent, "model", ValueForKey(ent, "name")); ent->SetKeyValue("model", ent->ValueForKey("name"));
} }
} }
else { else {
DeleteKey(ent, "origin"); ent->DeleteKey("origin");
} }
} }
@@ -794,8 +784,8 @@ entity_t *Entity_PostParse(entity_t *ent, brush_t *pList) {
global list. Used for parsing the project. global list. Used for parsing the project.
======================================================================================================================= =======================================================================================================================
*/ */
entity_t *Entity_Parse(bool onlypairs, brush_t *pList) { idEditorEntity *idEditorEntity::Entity_Parse(bool onlypairs, idEditorBrush *pList) {
entity_t *ent; idEditorEntity *ent;
if (!GetToken(true)) { if (!GetToken(true)) {
return NULL; return NULL;
@@ -805,7 +795,7 @@ entity_t *Entity_Parse(bool onlypairs, brush_t *pList) {
Error("ParseEntity: { not found"); Error("ParseEntity: { not found");
} }
ent = Entity_New(); ent = idEditorEntity::Entity_New();
ent->brushes.onext = ent->brushes.oprev = &ent->brushes; ent->brushes.onext = ent->brushes.oprev = &ent->brushes;
ent->origin.Zero(); ent->origin.Zero();
@@ -821,8 +811,8 @@ entity_t *Entity_Parse(bool onlypairs, brush_t *pList) {
} }
if (!strcmp(token, "{")) { if (!strcmp(token, "{")) {
GetVectorForKey(ent, "origin", ent->origin); ent->GetVectorForKey("origin", ent->origin);
brush_t *b = Brush_Parse(ent->origin); idEditorBrush *b = Brush_Parse(ent->origin);
if (b != NULL) { if (b != NULL) {
b->owner = ent; b->owner = ent;
@@ -845,7 +835,7 @@ entity_t *Entity_Parse(bool onlypairs, brush_t *pList) {
return ent; return ent;
} }
return Entity_PostParse(ent, pList); return ent->Entity_PostParse(pList);
} }
/* /*
@@ -863,8 +853,9 @@ void VectorMidpoint(idVec3 va, idVec3 vb, idVec3 &out) {
Entity_Write Entity_Write
======================================================================================================================= =======================================================================================================================
*/ */
void Entity_Write(entity_t *e, FILE *f, bool use_region) { void idEditorEntity::Entity_Write(FILE *f, bool use_region) {
brush_t *b; idEditorEntity *e = this;
idEditorBrush *b;
idVec3 origin; idVec3 origin;
char text[128]; char text[128];
int count; int count;
@@ -872,7 +863,7 @@ void Entity_Write(entity_t *e, FILE *f, bool use_region) {
// if none of the entities brushes are in the region, don't write the entity at all // if none of the entities brushes are in the region, don't write the entity at all
if (use_region) { if (use_region) {
// in region mode, save the camera position as playerstart // in region mode, save the camera position as playerstart
if (!strcmp(ValueForKey(e, "classname"), "info_player_start")) { if (!strcmp(e->ValueForKey("classname"), "info_player_start")) {
fprintf(f, "{\n"); fprintf(f, "{\n");
fprintf(f, "\"classname\" \"info_player_start\"\n"); fprintf(f, "\"classname\" \"info_player_start\"\n");
fprintf fprintf
@@ -903,15 +894,15 @@ void Entity_Write(entity_t *e, FILE *f, bool use_region) {
// NOTE: the whole brush placement / origin stuff is a mess // NOTE: the whole brush placement / origin stuff is a mess
VectorCopy(e->origin, origin); VectorCopy(e->origin, origin);
sprintf(text, "%i %i %i", (int)origin[0], (int)origin[1], (int)origin[2]); sprintf(text, "%i %i %i", (int)origin[0], (int)origin[1], (int)origin[2]);
SetKeyValue(e, "origin", text); e->SetKeyValue("origin", text);
} }
// if fixedsize, calculate a new origin based on the current brush position // if fixedsize, calculate a new origin based on the current brush position
else if (e->eclass->fixedsize || EntityHasModel(e)) { else if (e->eclass->fixedsize || e->EntityHasModel()) {
if (!GetVectorForKey(e, "origin", origin)) { if (!e->GetVectorForKey("origin", origin)) {
VectorSubtract(e->brushes.onext->mins, e->eclass->mins, origin); VectorSubtract(e->brushes.onext->mins, e->eclass->mins, origin);
sprintf(text, "%i %i %i", (int)origin[0], (int)origin[1], (int)origin[2]); sprintf(text, "%i %i %i", (int)origin[0], (int)origin[1], (int)origin[2]);
SetKeyValue(e, "origin", text); e->SetKeyValue("origin", text);
} }
} }
@@ -922,7 +913,7 @@ void Entity_Write(entity_t *e, FILE *f, bool use_region) {
fprintf(f, "\"%s\" \"%s\"\n", e->epairs.GetKeyVal(j)->GetKey().c_str(), e->epairs.GetKeyVal(j)->GetValue().c_str()); fprintf(f, "\"%s\" \"%s\"\n", e->epairs.GetKeyVal(j)->GetKey().c_str(), e->epairs.GetKeyVal(j)->GetValue().c_str());
} }
if (!EntityHasModel(e)) { if (!e->EntityHasModel()) {
count = 0; count = 0;
for (b = e->brushes.onext; b != &e->brushes; b = b->onext) { for (b = e->brushes.onext; b != &e->brushes; b = b->onext) {
if (e->eclass->fixedsize && !b->entityModel) { if (e->eclass->fixedsize && !b->entityModel) {
@@ -931,7 +922,7 @@ void Entity_Write(entity_t *e, FILE *f, bool use_region) {
if (!use_region || !Map_IsBrushFiltered(b)) { if (!use_region || !Map_IsBrushFiltered(b)) {
fprintf(f, "// brush %i\n", count); fprintf(f, "// brush %i\n", count);
count++; count++;
Brush_Write( b, f, e->origin, ( g_PrefsDlg.m_bNewMapFormat != FALSE ) ); b->Brush_Write(f, e->origin, ( g_PrefsDlg.m_bNewMapFormat != FALSE ) );
} }
} }
} }
@@ -943,8 +934,8 @@ void Entity_Write(entity_t *e, FILE *f, bool use_region) {
======================================================================================================================= =======================================================================================================================
======================================================================================================================= =======================================================================================================================
*/ */
bool IsBrushSelected(brush_t *bSel) { bool IsBrushSelected(idEditorBrush *bSel) {
for (brush_t * b = selected_brushes.next; b != NULL && b != &selected_brushes; b = b->next) { for (idEditorBrush * b = selected_brushes.next; b != NULL && b != &selected_brushes; b = b->next) {
if (b == bSel) { if (b == bSel) {
return true; return true;
} }
@@ -958,8 +949,9 @@ bool IsBrushSelected(brush_t *bSel) {
// Entity_WriteSelected // Entity_WriteSelected
// ======================================================================================================================= // =======================================================================================================================
// //
void Entity_WriteSelected(entity_t *e, FILE *f) { void idEditorEntity::Entity_WriteSelected(FILE *f) {
brush_t *b; idEditorEntity *e = this;
idEditorBrush *b;
idVec3 origin; idVec3 origin;
char text[128]; char text[128];
int count; int count;
@@ -975,11 +967,11 @@ void Entity_WriteSelected(entity_t *e, FILE *f) {
} }
// if fixedsize, calculate a new origin based on the current brush position // if fixedsize, calculate a new origin based on the current brush position
if (e->eclass->fixedsize || EntityHasModel(e)) { if (e->eclass->fixedsize || e->EntityHasModel()) {
if (!GetVectorForKey(e, "origin", origin)) { if (!e->GetVectorForKey("origin", origin)) {
VectorSubtract(e->brushes.onext->mins, e->eclass->mins, origin); VectorSubtract(e->brushes.onext->mins, e->eclass->mins, origin);
sprintf(text, "%i %i %i", (int)origin[0], (int)origin[1], (int)origin[2]); sprintf(text, "%i %i %i", (int)origin[0], (int)origin[1], (int)origin[2]);
SetKeyValue(e, "origin", text); e->SetKeyValue("origin", text);
} }
} }
@@ -990,7 +982,7 @@ void Entity_WriteSelected(entity_t *e, FILE *f) {
fprintf(f, "\"%s\" \"%s\"\n", e->epairs.GetKeyVal(j)->GetKey().c_str(), e->epairs.GetKeyVal(j)->GetValue().c_str()); fprintf(f, "\"%s\" \"%s\"\n", e->epairs.GetKeyVal(j)->GetKey().c_str(), e->epairs.GetKeyVal(j)->GetValue().c_str());
} }
if (!EntityHasModel(e)) { if (!e->EntityHasModel()) {
count = 0; count = 0;
for (b = e->brushes.onext; b != &e->brushes; b = b->onext) { for (b = e->brushes.onext; b != &e->brushes; b = b->onext) {
if (e->eclass->fixedsize && !b->entityModel) { if (e->eclass->fixedsize && !b->entityModel) {
@@ -999,7 +991,7 @@ void Entity_WriteSelected(entity_t *e, FILE *f) {
if (IsBrushSelected(b)) { if (IsBrushSelected(b)) {
fprintf(f, "// brush %i\n", count); fprintf(f, "// brush %i\n", count);
count++; count++;
Brush_Write( b, f, e->origin, ( g_PrefsDlg.m_bNewMapFormat != FALSE ) ); b->Brush_Write(f, e->origin, ( g_PrefsDlg.m_bNewMapFormat != FALSE ) );
} }
} }
} }
@@ -1012,8 +1004,9 @@ void Entity_WriteSelected(entity_t *e, FILE *f) {
// Entity_WriteSelected to a CMemFile // Entity_WriteSelected to a CMemFile
// ======================================================================================================================= // =======================================================================================================================
// //
void Entity_WriteSelected(entity_t *e, CMemFile *pMemFile) { void idEditorEntity::Entity_WriteSelected(CMemFile *pMemFile) {
brush_t *b; idEditorEntity *e = this;
idEditorBrush *b;
idVec3 origin; idVec3 origin;
char text[128]; char text[128];
int count; int count;
@@ -1029,11 +1022,11 @@ void Entity_WriteSelected(entity_t *e, CMemFile *pMemFile) {
} }
// if fixedsize, calculate a new origin based on the current brush position // if fixedsize, calculate a new origin based on the current brush position
if (e->eclass->fixedsize || EntityHasModel(e)) { if (e->eclass->fixedsize || e->EntityHasModel()) {
if (!GetVectorForKey(e, "origin", origin)) { if (!e->GetVectorForKey("origin", origin)) {
VectorSubtract(e->brushes.onext->mins, e->eclass->mins, origin); VectorSubtract(e->brushes.onext->mins, e->eclass->mins, origin);
sprintf(text, "%i %i %i", (int)origin[0], (int)origin[1], (int)origin[2]); sprintf(text, "%i %i %i", (int)origin[0], (int)origin[1], (int)origin[2]);
SetKeyValue(e, "origin", text); e->SetKeyValue("origin", text);
} }
} }
@@ -1044,7 +1037,7 @@ void Entity_WriteSelected(entity_t *e, CMemFile *pMemFile) {
MemFile_fprintf(pMemFile, "\"%s\" \"%s\"\n", e->epairs.GetKeyVal(j)->GetKey().c_str(), e->epairs.GetKeyVal(j)->GetValue().c_str()); MemFile_fprintf(pMemFile, "\"%s\" \"%s\"\n", e->epairs.GetKeyVal(j)->GetKey().c_str(), e->epairs.GetKeyVal(j)->GetValue().c_str());
} }
if (!EntityHasModel(e)) { if (!e->EntityHasModel()) {
count = 0; count = 0;
for (b = e->brushes.onext; b != &e->brushes; b = b->onext) { for (b = e->brushes.onext; b != &e->brushes; b = b->onext) {
if (e->eclass->fixedsize && !b->entityModel) { if (e->eclass->fixedsize && !b->entityModel) {
@@ -1053,7 +1046,7 @@ void Entity_WriteSelected(entity_t *e, CMemFile *pMemFile) {
if (IsBrushSelected(b)) { if (IsBrushSelected(b)) {
MemFile_fprintf(pMemFile, "// brush %i\n", count); MemFile_fprintf(pMemFile, "// brush %i\n", count);
count++; count++;
Brush_Write( b, pMemFile, e->origin, ( g_PrefsDlg.m_bNewMapFormat != FALSE ) ); b->Brush_Write(pMemFile, e->origin, ( g_PrefsDlg.m_bNewMapFormat != FALSE ) );
} }
} }
} }
@@ -1065,12 +1058,13 @@ void Entity_WriteSelected(entity_t *e, CMemFile *pMemFile) {
======================================================================================================================= =======================================================================================================================
======================================================================================================================= =======================================================================================================================
*/ */
void Entity_SetName(entity_t *e, const char *name) { void idEditorEntity::Entity_SetName(const char *name) {
CString oldName = ValueForKey(e, "name"); idEditorEntity *e = this;
CString oldModel = ValueForKey(e, "model"); CString oldName = e->ValueForKey("name");
SetKeyValue(e, "name", name); CString oldModel = e->ValueForKey("model");
e->SetKeyValue("name", name);
if (oldName == oldModel) { if (oldName == oldModel) {
SetKeyValue(e, "model", name); e->SetKeyValue("model", name);
} }
} }
@@ -1080,8 +1074,9 @@ extern bool Entity_NameIsUnique(const char *name);
======================================================================================================================= =======================================================================================================================
======================================================================================================================= =======================================================================================================================
*/ */
void Entity_Name(entity_t *e, bool force) { void idEditorEntity::Entity_Name(bool force) {
const char *name = ValueForKey(e, "name"); idEditorEntity *e = this;
const char *name = e->ValueForKey("name");
if (!force && name && name[0]) { if (!force && name && name[0]) {
return; return;
@@ -1093,7 +1088,7 @@ void Entity_Name(entity_t *e, bool force) {
bool setModel = false; bool setModel = false;
if (name[0]) { if (name[0]) {
const char *model = ValueForKey(e, "model"); const char *model = e->ValueForKey("model");
if (model[0]) { if (model[0]) {
if ( idStr::Icmp(model, name) == 0 ) { if ( idStr::Icmp(model, name) == 0 ) {
setModel = true; setModel = true;
@@ -1101,20 +1096,20 @@ void Entity_Name(entity_t *e, bool force) {
} }
} }
const char *eclass = ValueForKey(e, "classname"); const char *eclass = e->ValueForKey("classname");
if (eclass && eclass[0]) { if (eclass && eclass[0]) {
idStr str = cvarSystem->GetCVarString( "radiant_nameprefix" ); idStr str = cvarSystem->GetCVarString( "radiant_nameprefix" );
int id = Map_GetUniqueEntityID(str, eclass); int id = Map_GetUniqueEntityID(str, eclass);
if (str.Length()) { if (str.Length()) {
SetKeyValue(e, "name", va("%s_%s_%i", str.c_str(), eclass, id)); e->SetKeyValue("name", va("%s_%s_%i", str.c_str(), eclass, id));
} else { } else {
SetKeyValue(e, "name", va("%s_%i", eclass, id)); e->SetKeyValue("name", va("%s_%i", eclass, id));
} }
if (setModel) { if (setModel) {
if (str.Length()) { if (str.Length()) {
SetKeyValue(e, "model", va("%s_%s_%i", str.c_str(), eclass, id)); e->SetKeyValue("model", va("%s_%s_%i", str.c_str(), eclass, id));
} else { } else {
SetKeyValue(e, "model", va("%s_%i", eclass, id)); e->SetKeyValue("model", va("%s_%i", eclass, id));
} }
} }
} }
@@ -1126,9 +1121,9 @@ void Entity_Name(entity_t *e, bool force) {
are only used to find a midpoint. Otherwise, the brushes have their ownership transfered to the new entity. are only used to find a midpoint. Otherwise, the brushes have their ownership transfered to the new entity.
======================================================================================================================= =======================================================================================================================
*/ */
entity_t *Entity_Create(eclass_t *c, bool forceFixed) { idEditorEntity *idEditorEntity::Entity_Create(eclass_t *c, bool forceFixed) {
entity_t *e; idEditorEntity *e;
brush_t *b; idEditorBrush *b;
idVec3 mins, maxs, origin; idVec3 mins, maxs, origin;
char text[32]; char text[32];
texdef_t td; texdef_t td;
@@ -1149,15 +1144,15 @@ entity_t *Entity_Create(eclass_t *c, bool forceFixed) {
} }
// create it // create it
e = Entity_New(); e = idEditorEntity::Entity_New();
e->brushes.onext = e->brushes.oprev = &e->brushes; e->brushes.onext = e->brushes.oprev = &e->brushes;
e->eclass = c; e->eclass = c;
e->epairs.Copy(c->args); e->epairs.Copy(c->args);
SetKeyValue(e, "classname", c->name); e->SetKeyValue("classname", c->name);
Entity_Name(e, false); e->Entity_Name(false);
// add the entity to the entity list // add the entity to the entity list
Entity_AddToList(e, &entities); e->Entity_AddToList(&entities);
if (c->fixedsize) { if (c->fixedsize) {
// //
@@ -1173,11 +1168,11 @@ entity_t *Entity_Create(eclass_t *c, bool forceFixed) {
b = Brush_Create(mins, maxs, &c->texdef); b = Brush_Create(mins, maxs, &c->texdef);
Entity_LinkBrush(e, b); e->Entity_LinkBrush(b);
if (c->defMaterial.Length()) { if (c->defMaterial.Length()) {
td.SetName(c->defMaterial); td.SetName(c->defMaterial);
Brush_SetTexture(b, &td, &bp, false); b->Brush_SetTexture(&td, &bp, false);
} }
@@ -1188,7 +1183,7 @@ entity_t *Entity_Create(eclass_t *c, bool forceFixed) {
b->next = b->prev = &selected_brushes; b->next = b->prev = &selected_brushes;
selected_brushes.next = selected_brushes.prev = b; selected_brushes.next = selected_brushes.prev = b;
Brush_Build(b); b->Brush_Build();
} }
else { else {
@@ -1196,12 +1191,12 @@ entity_t *Entity_Create(eclass_t *c, bool forceFixed) {
// change the selected brushes over to the new entity // change the selected brushes over to the new entity
for (b = selected_brushes.next; b != &selected_brushes; b = b->next) { for (b = selected_brushes.next; b != &selected_brushes; b = b->next) {
Entity_UnlinkBrush(b); idEditorEntity::Entity_UnlinkBrush(b);
Entity_LinkBrush(e, b); e->Entity_LinkBrush(b);
Brush_Build(b); // so the key brush gets a name b->Brush_Build(); // so the key brush gets a name
if (c->defMaterial.Length()) { if (c->defMaterial.Length()) {
td.SetName(c->defMaterial); td.SetName(c->defMaterial);
Brush_SetTexture(b, &td, &bp, false); b->Brush_SetTexture(&td, &bp, false);
} }
} }
@@ -1211,19 +1206,19 @@ entity_t *Entity_Create(eclass_t *c, bool forceFixed) {
//} //}
if (!forceFixed) { if (!forceFixed) {
SetKeyValue(e, "model", ValueForKey(e, "name")); e->SetKeyValue("model", e->ValueForKey("name"));
} }
} }
sprintf(text, "%i %i %i", (int)origin[0], (int)origin[1], (int)origin[2]); sprintf(text, "%i %i %i", (int)origin[0], (int)origin[1], (int)origin[2]);
SetKeyValue(e, "origin", text); e->SetKeyValue("origin", text);
VectorCopy(origin, e->origin); VectorCopy(origin, e->origin);
Sys_UpdateWindows(W_ALL); Sys_UpdateWindows(W_ALL);
return e; return e;
} }
void Brush_MakeDirty(brush_t *b) { void Brush_MakeDirty(idEditorBrush *b) {
for (face_t *f = b->brush_faces; f; f = f->next) { for (face_t *f = b->brush_faces; f; f = f->next) {
f->dirty = true; f->dirty = true;
} }
@@ -1233,7 +1228,9 @@ void Brush_MakeDirty(brush_t *b) {
Entity_LinkBrush Entity_LinkBrush
======================================================================================================================= =======================================================================================================================
*/ */
void Entity_LinkBrush(entity_t *e, brush_t *b) { void idEditorEntity::Entity_LinkBrush(idEditorBrush *b) {
idEditorEntity *e = this;
if (b->oprev || b->onext) { if (b->oprev || b->onext) {
Error("Entity_LinkBrush: Allready linked"); Error("Entity_LinkBrush: Allready linked");
} }
@@ -1253,7 +1250,7 @@ void Entity_LinkBrush(entity_t *e, brush_t *b) {
Entity_UnlinkBrush Entity_UnlinkBrush
======================================================================================================================= =======================================================================================================================
*/ */
void Entity_UnlinkBrush(brush_t *b) { void idEditorEntity::Entity_UnlinkBrush(idEditorBrush *b) {
// if (!b->owner || !b->onext || !b->oprev) // if (!b->owner || !b->onext || !b->oprev)
if (!b->onext || !b->oprev) { if (!b->onext || !b->oprev) {
Error("Entity_UnlinkBrush: Not currently linked"); Error("Entity_UnlinkBrush: Not currently linked");
@@ -1270,17 +1267,17 @@ void Entity_UnlinkBrush(brush_t *b) {
Entity_Clone Entity_Clone
======================================================================================================================= =======================================================================================================================
*/ */
entity_t *Entity_Clone(entity_t *e) { idEditorEntity *idEditorEntity::Entity_Clone(idEditorEntity *e) {
entity_t *n; idEditorEntity *n;
n = Entity_New(); n = idEditorEntity::Entity_New();
n->brushes.onext = n->brushes.oprev = &n->brushes; n->brushes.onext = n->brushes.oprev = &n->brushes;
n->eclass = e->eclass; n->eclass = e->eclass;
n->rotation = e->rotation; n->rotation = e->rotation;
n->origin = e->origin; n->origin = e->origin;
// add the entity to the entity list // add the entity to the entity list
Entity_AddToList(n, &entities); n->Entity_AddToList(&entities);
n->epairs = e->epairs; n->epairs = e->epairs;
@@ -1291,10 +1288,10 @@ entity_t *Entity_Clone(entity_t *e) {
======================================================================================================================= =======================================================================================================================
======================================================================================================================= =======================================================================================================================
*/ */
int GetUniqueTargetId(int iHint) { int idEditorEntity::GetUniqueTargetId(int iHint) {
int iMin, iMax, i; int iMin, iMax, i;
BOOL fFound; BOOL fFound;
entity_t *pe; idEditorEntity *pe;
fFound = FALSE; fFound = FALSE;
pe = entities.next; pe = entities.next;
@@ -1302,7 +1299,7 @@ int GetUniqueTargetId(int iHint) {
iMax = 0; iMax = 0;
for (; pe != NULL && pe != &entities; pe = pe->next) { for (; pe != NULL && pe != &entities; pe = pe->next) {
i = IntForKey(pe, "target"); i = pe->IntForKey("target");
if (i) { if (i) {
iMin = Min(i, iMin); iMin = Min(i, iMin);
iMax = Max(i, iMax); iMax = Max(i, iMax);
@@ -1324,13 +1321,13 @@ int GetUniqueTargetId(int iHint) {
======================================================================================================================= =======================================================================================================================
======================================================================================================================= =======================================================================================================================
*/ */
entity_t *FindEntity(const char *pszKey, const char *pszValue) { idEditorEntity *idEditorEntity::FindEntity(const char *pszKey, const char *pszValue) {
entity_t *pe; idEditorEntity *pe;
pe = entities.next; pe = entities.next;
for (; pe != NULL && pe != &entities; pe = pe->next) { for (; pe != NULL && pe != &entities; pe = pe->next) {
if (!strcmp(ValueForKey(pe, pszKey), pszValue)) { if (!strcmp(pe->ValueForKey(pszKey), pszValue)) {
return pe; return pe;
} }
} }
@@ -1342,13 +1339,13 @@ entity_t *FindEntity(const char *pszKey, const char *pszValue) {
======================================================================================================================= =======================================================================================================================
======================================================================================================================= =======================================================================================================================
*/ */
entity_t *FindEntityInt(const char *pszKey, int iValue) { idEditorEntity *idEditorEntity::FindEntityInt(const char *pszKey, int iValue) {
entity_t *pe; idEditorEntity *pe;
pe = entities.next; pe = entities.next;
for (; pe != NULL && pe != &entities; pe = pe->next) { for (; pe != NULL && pe != &entities; pe = pe->next) {
if (IntForKey(pe, pszKey) == iValue) { if (pe->IntForKey(pszKey) == iValue) {
return pe; return pe;
} }
} }
@@ -1366,7 +1363,8 @@ to it not having one, being filtered away, or the sound mode being turned off.
Creates or updates the soundEmitter if needed Creates or updates the soundEmitter if needed
==================== ====================
*/ */
void Entity_UpdateSoundEmitter( entity_t *ent ) { void idEditorEntity::Entity_UpdateSoundEmitter() {
idEditorEntity *ent = this;
bool playing = false; bool playing = false;
// if an entity doesn't have any brushes at all, don't do anything // if an entity doesn't have any brushes at all, don't do anything
@@ -1374,7 +1372,7 @@ void Entity_UpdateSoundEmitter( entity_t *ent ) {
if ( g_pParentWnd->GetCamera()->GetSoundMode() if ( g_pParentWnd->GetCamera()->GetSoundMode()
&& ent->brushes.onext != &ent->brushes && !FilterBrush(ent->brushes.onext) ) { && ent->brushes.onext != &ent->brushes && !FilterBrush(ent->brushes.onext) ) {
// check for sounds // check for sounds
const char *v = ValueForKey( ent, "s_shader" ); const char *v = ent->ValueForKey("s_shader");
if ( v[0] ) { if ( v[0] ) {
refSound_t sound; refSound_t sound;
@@ -1398,4 +1396,3 @@ void Entity_UpdateSoundEmitter( entity_t *ent ) {
} }
} }
+48 -48
View File
@@ -30,9 +30,10 @@ void Eclass_InitForSourceDirectory( const char *path );
eclass_t * Eclass_ForName( const char *name, bool has_brushes ); eclass_t * Eclass_ForName( const char *name, bool has_brushes );
bool Eclass_hasModel(eclass_t *e, idVec3 &vMin, idVec3 &vMax); bool Eclass_hasModel(eclass_t *e, idVec3 &vMin, idVec3 &vMax);
typedef struct entity_s { class idEditorEntity {
struct entity_s *prev, *next; public:
brush_t brushes; // head/tail of list idEditorEntity *prev, *next;
idEditorBrush brushes; // head/tail of list
int undoId, redoId, entityId; // used for undo/redo int undoId, redoId, entityId; // used for undo/redo
idVec3 origin; idVec3 origin;
qhandle_t lightDef; qhandle_t lightDef;
@@ -46,51 +47,50 @@ typedef struct entity_s {
idMat3 lightRotation; // '' idMat3 lightRotation; // ''
bool trackLightOrigin; bool trackLightOrigin;
idCurve<idVec3> *curve; idCurve<idVec3> *curve;
} entity_t;
const char *ValueForKey(const char *key);
int GetNumKeys();
const char *GetKeyString(int iIndex);
void SetKeyValue(const char *key, const char *value, bool trackAngles = true);
void DeleteKey(const char *key);
float FloatForKey(const char *key);
int IntForKey(const char *key);
bool GetVectorForKey(const char *key, idVec3 &vec);
bool GetVector4ForKey(const char *key, idVec4 &vec);
bool GetFloatForKey(const char *key, float *f);
void SetKeyVec3(const char *key, idVec3 v);
void SetKeyMat3(const char *key, idMat3 m);
bool GetMatrixForKey(const char *key, idMat3 &mat);
void Entity_UpdateSoundEmitter();
idCurve<idVec3> *Entity_MakeCurve();
void Entity_UpdateCurveData();
void Entity_SetCurveData();
static void Entity_Free(idEditorEntity *e);
void Entity_FreeEpairs();
int Entity_MemorySize();
static idEditorEntity *Entity_Parse(bool onlypairs, idEditorBrush* pList = NULL);
idEditorEntity *Entity_PostParse(idEditorBrush *pList);
void Entity_Write(FILE *f, bool use_region);
void Entity_WriteSelected(FILE *f);
void Entity_WriteSelected(CMemFile*);
static idEditorEntity *Entity_Create(eclass_t *c, bool forceFixed = false);
static idEditorEntity *Entity_Clone(idEditorEntity *e);
void Entity_AddToList(idEditorEntity *list);
void Entity_RemoveFromList();
bool EntityHasModel();
void Entity_LinkBrush(idEditorBrush *b);
static void Entity_UnlinkBrush(idEditorBrush *b);
static idEditorEntity *FindEntity(const char *pszKey, const char *pszValue);
static idEditorEntity *FindEntityInt(const char *pszKey, int iValue);
static idEditorEntity *Entity_New();
void Entity_SetName(const char *name);
static int GetUniqueTargetId(int iHint);
void Entity_Name(bool force);
};
void ParseEpair(idDict *dict); void ParseEpair(idDict *dict);
const char *ValueForKey(entity_t *ent, const char *key); eclass_t * GetCachedModel(idEditorEntity *pEntity, const char *pName, idVec3 &vMin, idVec3 &vMax);
int GetNumKeys(entity_t *ent);
const char *GetKeyString(entity_t *ent, int iIndex);
void SetKeyValue (entity_t *ent, const char *key, const char *value, bool trackAngles = true);
void DeleteKey (entity_t *ent, const char *key);
float FloatForKey (entity_t *ent, const char *key);
int IntForKey (entity_t *ent, const char *key);
bool GetVectorForKey (entity_t *ent, const char *key, idVec3 &vec);
bool GetVector4ForKey (entity_t *ent, const char *key, idVec4 &vec);
bool GetFloatForKey(entity_t *end, const char *key, float *f);
void SetKeyVec3(entity_t *ent, const char *key, idVec3 v);
void SetKeyMat3(entity_t *ent, const char *key, idMat3 m);
bool GetMatrixForKey(entity_t *ent, const char *key, idMat3 &mat);
void Entity_UpdateSoundEmitter( entity_t *ent ); bool IsBrushSelected(idEditorBrush* bSel);
idCurve<idVec3> *Entity_MakeCurve( entity_t *e );
void Entity_UpdateCurveData( entity_t *e );
void Entity_SetCurveData( entity_t *e );
void Entity_Free (entity_t *e);
void Entity_FreeEpairs(entity_t *e);
int Entity_MemorySize(entity_t *e);
entity_t * Entity_Parse (bool onlypairs, brush_t* pList = NULL);
void Entity_Write (entity_t *e, FILE *f, bool use_region);
void Entity_WriteSelected(entity_t *e, FILE *f);
void Entity_WriteSelected(entity_t *e, CMemFile*);
entity_t * Entity_Create (eclass_t *c, bool forceFixed = false);
entity_t * Entity_Clone (entity_t *e);
void Entity_AddToList(entity_t *e, entity_t *list);
void Entity_RemoveFromList(entity_t *e);
bool EntityHasModel(entity_t *ent);
void Entity_LinkBrush (entity_t *e, brush_t *b);
void Entity_UnlinkBrush (brush_t *b);
entity_t * FindEntity(const char *pszKey, const char *pszValue);
entity_t * FindEntityInt(const char *pszKey, int iValue);
entity_t * Entity_New();
void Entity_SetName(entity_t *e, const char *name);
int GetUniqueTargetId(int iHint);
eclass_t * GetCachedModel(entity_t *pEntity, const char *pName, idVec3 &vMin, idVec3 &vMax);
//Timo : used for parsing epairs in brush primitive
void Entity_Name(entity_t *e, bool force);
bool IsBrushSelected(brush_t* bSel);
+98 -100
View File
@@ -36,17 +36,17 @@ int mapModified; // for quit confirmation (0 = clean, 1 = unsaved,
// 2 = autosaved, but not regular saved) // 2 = autosaved, but not regular saved)
char currentmap[1024]; char currentmap[1024];
brush_t active_brushes; // brushes currently being displayed idEditorBrush active_brushes; // brushes currently being displayed
brush_t selected_brushes; // highlighted idEditorBrush selected_brushes; // highlighted
face_t *selected_face; face_t *selected_face;
brush_t *selected_face_brush; idEditorBrush *selected_face_brush;
brush_t filtered_brushes; // brushes that have been filtered or regioned idEditorBrush filtered_brushes; // brushes that have been filtered or regioned
entity_t entities; // head/tail of doubly linked list idEditorEntity entities; // head/tail of doubly linked list
entity_t *world_entity = NULL; // "classname" "worldspawn" ! idEditorEntity *world_entity = NULL; // "classname" "worldspawn" !
void AddRegionBrushes(void); void AddRegionBrushes(void);
void RemoveRegionBrushes(void); void RemoveRegionBrushes(void);
@@ -63,8 +63,8 @@ void DupLists() {
* Cross map selection saving this could mess this up if you have only part of a * Cross map selection saving this could mess this up if you have only part of a
* complex entity selected... * complex entity selected...
*/ */
brush_t between_brushes; idEditorBrush between_brushes;
entity_t between_entities; idEditorEntity between_entities;
bool g_bRestoreBetween = false; bool g_bRestoreBetween = false;
@@ -393,7 +393,7 @@ void Map_RestoreBetween(void) {
======================================================================================================================= =======================================================================================================================
======================================================================================================================= =======================================================================================================================
*/ */
bool CheckForTinyBrush(brush_t *b, int n, float fSize) { bool CheckForTinyBrush(idEditorBrush *b, int n, float fSize) {
bool bTiny = false; bool bTiny = false;
for (int i = 0; i < 3; i++) { for (int i = 0; i < 3; i++) {
if (b->maxs[i] - b->mins[i] < fSize) { if (b->maxs[i] - b->mins[i] < fSize) {
@@ -413,7 +413,7 @@ bool CheckForTinyBrush(brush_t *b, int n, float fSize) {
======================================================================================================================= =======================================================================================================================
*/ */
void Map_BuildBrushData(void) { void Map_BuildBrushData(void) {
brush_t *b, *next; idEditorBrush *b, *next;
if (active_brushes.next == NULL) { if (active_brushes.next == NULL) {
return; return;
@@ -424,7 +424,7 @@ void Map_BuildBrushData(void) {
int n = 0; int n = 0;
for (b = active_brushes.next; b != NULL && b != &active_brushes; b = next) { for (b = active_brushes.next; b != NULL && b != &active_brushes; b = next) {
next = b->next; next = b->next;
Brush_Build(b, true, false, false); b->Brush_Build(true, false, false);
if (!b->brush_faces || (g_PrefsDlg.m_bCleanTiny && CheckForTinyBrush(b, n++, g_PrefsDlg.m_fTinySize))) { if (!b->brush_faces || (g_PrefsDlg.m_bCleanTiny && CheckForTinyBrush(b, n++, g_PrefsDlg.m_fTinySize))) {
Brush_Free(b); Brush_Free(b);
common->Printf("Removed degenerate brush\n"); common->Printf("Removed degenerate brush\n");
@@ -438,11 +438,11 @@ void Map_BuildBrushData(void) {
======================================================================================================================= =======================================================================================================================
======================================================================================================================= =======================================================================================================================
*/ */
entity_t *Map_FindClass(char *cname) { idEditorEntity *Map_FindClass(char *cname) {
entity_t *ent; idEditorEntity *ent;
for (ent = entities.next; ent != &entities; ent = ent->next) { for (ent = entities.next; ent != &entities; ent = ent->next) {
if (!strcmp(cname, ValueForKey(ent, "classname"))) { if (!strcmp(cname, ent->ValueForKey("classname"))) {
return ent; return ent;
} }
} }
@@ -455,11 +455,11 @@ entity_t *Map_FindClass(char *cname) {
======================================================================================================================= =======================================================================================================================
*/ */
int Map_GetUniqueEntityID(const char *prefix, const char *eclass) { int Map_GetUniqueEntityID(const char *prefix, const char *eclass) {
entity_t *ent; idEditorEntity *ent;
int id = 0; int id = 0;
for (ent = entities.next; ent != &entities; ent = ent->next) { for (ent = entities.next; ent != &entities; ent = ent->next) {
if (!strcmp(eclass, ValueForKey(ent, "classname"))) { if (!strcmp(eclass, ent->ValueForKey("classname"))) {
const char *name = ValueForKey(ent, "name"); const char *name = ent->ValueForKey("name");
if (name && name[0]) { if (name && name[0]) {
const char *buf; const char *buf;
if (prefix && *prefix) { if (prefix && *prefix) {
@@ -486,13 +486,13 @@ int Map_GetUniqueEntityID(const char *prefix, const char *eclass) {
======================================================================================================================= =======================================================================================================================
*/ */
bool Entity_NameIsUnique(const char *name) { bool Entity_NameIsUnique(const char *name) {
entity_t *ent; idEditorEntity *ent;
if (name == NULL) { if (name == NULL) {
return false; return false;
} }
for (ent = entities.next; ent != &entities; ent = ent->next) { for (ent = entities.next; ent != &entities; ent = ent->next) {
const char *testName = ValueForKey(ent, "name"); const char *testName = ent->ValueForKey("name");
if (testName) { if (testName) {
if ( idStr::Icmp(name, testName) == 0 ) { if ( idStr::Icmp(name, testName) == 0 ) {
return false; return false;
@@ -549,12 +549,12 @@ void Map_Free(void) {
} }
while (entities.next != &entities) { while (entities.next != &entities) {
Entity_Free(entities.next); idEditorEntity::Entity_Free(entities.next);
} }
} }
if (world_entity) { if (world_entity) {
Entity_Free(world_entity); idEditorEntity::Entity_Free(world_entity);
} }
world_entity = NULL; world_entity = NULL;
@@ -564,8 +564,8 @@ void Map_Free(void) {
======================================================================================================================= =======================================================================================================================
======================================================================================================================= =======================================================================================================================
*/ */
entity_t *AngledEntity() { idEditorEntity *AngledEntity() {
entity_t *ent = Map_FindClass("info_player_start"); idEditorEntity *ent = Map_FindClass("info_player_start");
if (!ent) { if (!ent) {
ent = Map_FindClass("info_player_deathmatch"); ent = Map_FindClass("info_player_deathmatch");
} }
@@ -594,7 +594,7 @@ entity_t *AngledEntity() {
} }
brush_t *BrushFromMapPatch(idMapPatch *mappatch, idVec3 origin) { idEditorBrush *BrushFromMapPatch(idMapPatch *mappatch, idVec3 origin) {
patchMesh_t *pm = MakeNewPatch(mappatch->GetWidth(), mappatch->GetHeight()); patchMesh_t *pm = MakeNewPatch(mappatch->GetWidth(), mappatch->GetHeight());
pm->d_texture = Texture_ForName(mappatch->GetMaterial()); pm->d_texture = Texture_ForName(mappatch->GetMaterial());
for (int i = 0; i < mappatch->GetWidth(); i++) { for (int i = 0; i < mappatch->GetWidth(); i++) {
@@ -610,12 +610,12 @@ brush_t *BrushFromMapPatch(idMapPatch *mappatch, idVec3 origin) {
pm->epairs = new idDict; pm->epairs = new idDict;
*pm->epairs = mappatch->epairs; *pm->epairs = mappatch->epairs;
} }
brush_t *b = AddBrushForPatch(pm, false); idEditorBrush *b = AddBrushForPatch(pm, false);
return b; return b;
} }
brush_t *BrushFromMapBrush(idMapBrush *mapbrush, idVec3 origin) { idEditorBrush *BrushFromMapBrush(idMapBrush *mapbrush, idVec3 origin) {
brush_t *b = NULL; idEditorBrush *b = NULL;
if (mapbrush) { if (mapbrush) {
b = Brush_Alloc(); b = Brush_Alloc();
int count = mapbrush->GetNumSides(); int count = mapbrush->GetNumSides();
@@ -661,14 +661,14 @@ brush_t *BrushFromMapBrush(idMapBrush *mapbrush, idVec3 origin) {
return b; return b;
} }
entity_t *EntityFromMapEntity(idMapEntity *mapent, CWaitDlg *dlg) { idEditorEntity *EntityFromMapEntity(idMapEntity *mapent, CWaitDlg *dlg) {
entity_t *ent = NULL; idEditorEntity *ent = NULL;
if (mapent) { if (mapent) {
ent = Entity_New(); ent = idEditorEntity::Entity_New();
ent->brushes.onext = ent->brushes.oprev = &ent->brushes; ent->brushes.onext = ent->brushes.oprev = &ent->brushes;
ent->origin.Zero(); ent->origin.Zero();
ent->epairs = mapent->epairs; ent->epairs = mapent->epairs;
GetVectorForKey(ent, "origin", ent->origin); ent->GetVectorForKey("origin", ent->origin);
int count = mapent->GetNumPrimitives(); int count = mapent->GetNumPrimitives();
long lastUpdate = 0; long lastUpdate = 0;
idStr status; idStr status;
@@ -689,7 +689,7 @@ entity_t *EntityFromMapEntity(idMapEntity *mapent, CWaitDlg *dlg) {
return ent; return ent;
} }
brush_t *b = NULL; idEditorBrush *b = NULL;
if (prim->GetType() == idMapPrimitive::TYPE_BRUSH) { if (prim->GetType() == idMapPrimitive::TYPE_BRUSH) {
idMapBrush *mapbrush = reinterpret_cast<idMapBrush*>(prim); idMapBrush *mapbrush = reinterpret_cast<idMapBrush*>(prim);
b = BrushFromMapBrush(mapbrush, ent->origin); b = BrushFromMapBrush(mapbrush, ent->origin);
@@ -711,14 +711,13 @@ entity_t *EntityFromMapEntity(idMapEntity *mapent, CWaitDlg *dlg) {
return ent; return ent;
} }
extern entity_t *Entity_PostParse(entity_t *ent, brush_t *pList);
/* /*
======================================================================================================================= =======================================================================================================================
Map_LoadFile Map_LoadFile
======================================================================================================================= =======================================================================================================================
*/ */
void Map_LoadFile(const char *filename) { void Map_LoadFile(const char *filename) {
entity_t *ent; idEditorEntity *ent;
CWaitDlg dlg; CWaitDlg dlg;
idStr fileStr, status; idStr fileStr, status;
idMapFile mapfile; idMapFile mapfile;
@@ -769,11 +768,11 @@ void Map_LoadFile(const char *filename) {
} }
if (classname == "worldspawn") { if (classname == "worldspawn") {
world_entity = EntityFromMapEntity(mapent, &dlg); world_entity = EntityFromMapEntity(mapent, &dlg);
Entity_PostParse(world_entity, &active_brushes); world_entity->Entity_PostParse(&active_brushes);
} else { } else {
ent = EntityFromMapEntity(mapent, &dlg); ent = EntityFromMapEntity(mapent, &dlg);
Entity_PostParse(ent, &active_brushes); ent->Entity_PostParse(&active_brushes);
Entity_Name(ent, true); ent->Entity_Name(true);
// add the entity to the end of the entity list // add the entity to the end of the entity list
ent->next = &entities; ent->next = &entities;
ent->prev = entities.prev; ent->prev = entities.prev;
@@ -816,9 +815,9 @@ void Map_LoadFile(const char *filename) {
g_pParentWnd->GetCamera()->Camera().angles[PITCH] = 0; g_pParentWnd->GetCamera()->Camera().angles[PITCH] = 0;
if (ent) { if (ent) {
GetVectorForKey(ent, "origin", g_pParentWnd->GetCamera()->Camera().origin); ent->GetVectorForKey("origin", g_pParentWnd->GetCamera()->Camera().origin);
GetVectorForKey(ent, "origin", g_pParentWnd->GetXYWnd()->GetOrigin()); ent->GetVectorForKey("origin", g_pParentWnd->GetXYWnd()->GetOrigin());
g_pParentWnd->GetCamera()->Camera().angles[YAW] = FloatForKey(ent, "angle"); g_pParentWnd->GetCamera()->Camera().angles[YAW] = ent->FloatForKey("angle");
} }
else { else {
g_pParentWnd->GetCamera()->Camera().angles[YAW] = 0; g_pParentWnd->GetCamera()->Camera().angles[YAW] = 0;
@@ -853,7 +852,7 @@ void Map_VerifyCurrentMap(const char *map) {
} }
} }
idMapPrimitive *BrushToMapPrimitive( const brush_t *b, const idVec3 &origin ) { idMapPrimitive *BrushToMapPrimitive( const idEditorBrush *b, const idVec3 &origin ) {
if ( b->pPatch ) { if ( b->pPatch ) {
idMapPatch *patch = new idMapPatch( b->pPatch->width * 6, b->pPatch->height * 6 ); idMapPatch *patch = new idMapPatch( b->pPatch->width * 6, b->pPatch->height * 6 );
patch->SetSize( b->pPatch->width, b->pPatch->height ); patch->SetSize( b->pPatch->width, b->pPatch->height );
@@ -908,14 +907,14 @@ idMapPrimitive *BrushToMapPrimitive( const brush_t *b, const idVec3 &origin ) {
} }
} }
idMapEntity *EntityToMapEntity(entity_t *e, bool use_region, CWaitDlg *dlg) { idMapEntity *EntityToMapEntity(idEditorEntity *e, bool use_region, CWaitDlg *dlg) {
idMapEntity *mapent = new idMapEntity; idMapEntity *mapent = new idMapEntity;
mapent->epairs = e->epairs; mapent->epairs = e->epairs;
idStr status; idStr status;
int count = 0; int count = 0;
long lastUpdate = 0; long lastUpdate = 0;
if ( !EntityHasModel( e ) ) { if ( !e->EntityHasModel() ) {
for ( brush_t *b = e->brushes.onext; b != &e->brushes; b = b->onext ) { for ( idEditorBrush *b = e->brushes.onext; b != &e->brushes; b = b->onext ) {
count++; count++;
if ( e->eclass->fixedsize && !b->entityModel ) { if ( e->eclass->fixedsize && !b->entityModel ) {
continue; continue;
@@ -948,10 +947,10 @@ idMapEntity *EntityToMapEntity(entity_t *e, bool use_region, CWaitDlg *dlg) {
======================================================================================================================= =======================================================================================================================
*/ */
bool Map_SaveFile(const char *filename, bool use_region, bool autosave) { bool Map_SaveFile(const char *filename, bool use_region, bool autosave) {
entity_t *e, *next; idEditorEntity *e, *next;
idStr temp; idStr temp;
int count; int count;
brush_t *b; idEditorBrush *b;
idStr status; idStr status;
int len = strlen(filename); int len = strlen(filename);
@@ -1044,7 +1043,7 @@ bool Map_SaveFile(const char *filename, bool use_region, bool autosave) {
count++; count++;
next = e->next; next = e->next;
if (e->brushes.onext == &e->brushes) { if (e->brushes.onext == &e->brushes) {
Entity_Free(e); // no brushes left, so remove it idEditorEntity::Entity_Free(e); // no brushes left, so remove it
} }
else { else {
if (use_region) { if (use_region) {
@@ -1060,14 +1059,14 @@ bool Map_SaveFile(const char *filename, bool use_region, bool autosave) {
} }
idVec3 origin; idVec3 origin;
if (!GetVectorForKey(e, "origin", origin)) { if (!e->GetVectorForKey("origin", origin)) {
idStr text; idStr text;
VectorSubtract(e->brushes.onext->mins, e->eclass->mins, origin); VectorSubtract(e->brushes.onext->mins, e->eclass->mins, origin);
sprintf(text, "%i %i %i", (int)origin[0], (int)origin[1], (int)origin[2]); sprintf(text, "%i %i %i", (int)origin[0], (int)origin[1], (int)origin[2]);
SetKeyValue(e, "origin", text); e->SetKeyValue("origin", text);
} }
if (use_region && !idStr::Icmp(ValueForKey(e, "classname"), "info_player_start")) { if (use_region && !idStr::Icmp(e->ValueForKey("classname"), "info_player_start")) {
continue; continue;
} }
@@ -1115,9 +1114,9 @@ void Map_New(void) {
Patch_Cleanup(); Patch_Cleanup();
g_Inspectors->entityDlg.SetEditEntity ( NULL ); g_Inspectors->entityDlg.SetEditEntity ( NULL );
world_entity = Entity_New(); world_entity = idEditorEntity::Entity_New();
world_entity->brushes.onext = world_entity->brushes.oprev = &world_entity->brushes; world_entity->brushes.onext = world_entity->brushes.oprev = &world_entity->brushes;
SetKeyValue(world_entity, "classname", "worldspawn"); world_entity->SetKeyValue("classname", "worldspawn");
world_entity->eclass = Eclass_ForName("worldspawn", true); world_entity->eclass = Eclass_ForName("worldspawn", true);
if (g_qeglobals.rw) { if (g_qeglobals.rw) {
g_qeglobals.rw->ClearWorldDecals(); g_qeglobals.rw->ClearWorldDecals();
@@ -1143,7 +1142,7 @@ bool region_active;
idVec3 region_mins(MIN_WORLD_COORD, MIN_WORLD_COORD, MIN_WORLD_COORD); idVec3 region_mins(MIN_WORLD_COORD, MIN_WORLD_COORD, MIN_WORLD_COORD);
idVec3 region_maxs(MAX_WORLD_COORD, MAX_WORLD_COORD, MAX_WORLD_COORD); idVec3 region_maxs(MAX_WORLD_COORD, MAX_WORLD_COORD, MAX_WORLD_COORD);
brush_t *region_sides[6]; idEditorBrush *region_sides[6];
/* /*
======================================================================================================================= =======================================================================================================================
@@ -1202,9 +1201,9 @@ const int REGION_WIDTH = 1024;
region_sides[5] = Brush_Create(mins, maxs, &td); region_sides[5] = Brush_Create(mins, maxs, &td);
for (i = 0; i < 6; i++) { for (i = 0; i < 6; i++) {
Brush_AddToList(region_sides[i], &selected_brushes); region_sides[i]->Brush_AddToList(&selected_brushes);
Entity_LinkBrush(world_entity, region_sides[i]); world_entity->Entity_LinkBrush(region_sides[i]);
Brush_Build(region_sides[i]); region_sides[i]->Brush_Build();
} }
} }
@@ -1228,7 +1227,7 @@ void RemoveRegionBrushes(void) {
======================================================================================================================= =======================================================================================================================
======================================================================================================================= =======================================================================================================================
*/ */
bool Map_IsBrushFiltered(brush_t *b) { bool Map_IsBrushFiltered(idEditorBrush *b) {
int i; int i;
if (!region_active) { if (!region_active) {
@@ -1254,7 +1253,7 @@ bool Map_IsBrushFiltered(brush_t *b) {
======================================================================================================================= =======================================================================================================================
*/ */
void Map_RegionOff(void) { void Map_RegionOff(void) {
brush_t *b, *next; idEditorBrush *b, *next;
int i; int i;
region_active = false; region_active = false;
@@ -1269,13 +1268,13 @@ void Map_RegionOff(void) {
continue; // still filtered continue; // still filtered
} }
Brush_RemoveFromList(b); b->Brush_RemoveFromList();
if (active_brushes.next == NULL || active_brushes.prev == NULL) { if (active_brushes.next == NULL || active_brushes.prev == NULL) {
active_brushes.next = &active_brushes; active_brushes.next = &active_brushes;
active_brushes.prev = &active_brushes; active_brushes.prev = &active_brushes;
} }
Brush_AddToList(b, &active_brushes); b->Brush_AddToList(&active_brushes);
} }
Sys_UpdateWindows(W_ALL); Sys_UpdateWindows(W_ALL);
@@ -1286,7 +1285,7 @@ void Map_RegionOff(void) {
======================================================================================================================= =======================================================================================================================
*/ */
void Map_ApplyRegion(void) { void Map_ApplyRegion(void) {
brush_t *b, *next; idEditorBrush *b, *next;
region_active = true; region_active = true;
for (b = active_brushes.next; b != &active_brushes; b = next) { for (b = active_brushes.next; b != &active_brushes; b = next) {
@@ -1295,8 +1294,8 @@ void Map_ApplyRegion(void) {
continue; // still filtered continue; // still filtered
} }
Brush_RemoveFromList(b); b->Brush_RemoveFromList();
Brush_AddToList(b, &filtered_brushes); b->Brush_AddToList(&filtered_brushes);
} }
Sys_UpdateWindows(W_ALL); Sys_UpdateWindows(W_ALL);
@@ -1372,7 +1371,7 @@ void Map_RegionXY(void) {
======================================================================================================================= =======================================================================================================================
*/ */
void Map_RegionTallBrush(void) { void Map_RegionTallBrush(void) {
brush_t *b; idEditorBrush *b;
if (!QE_SingleBrush()) { if (!QE_SingleBrush()) {
return; return;
@@ -1397,7 +1396,7 @@ void Map_RegionTallBrush(void) {
======================================================================================================================= =======================================================================================================================
*/ */
void Map_RegionBrush(void) { void Map_RegionBrush(void) {
brush_t *b; idEditorBrush *b;
if (!QE_SingleBrush()) { if (!QE_SingleBrush()) {
return; return;
@@ -1421,8 +1420,8 @@ void Map_RegionBrush(void) {
void UniqueTargetName(idStr &rStr) { void UniqueTargetName(idStr &rStr) {
// make a unique target value // make a unique target value
int maxtarg = 0; int maxtarg = 0;
for (entity_t * e = entities.next; e != &entities; e = e->next) { for (idEditorEntity * e = entities.next; e != &entities; e = e->next) {
const char *tn = ValueForKey(e, "name"); const char *tn = e->ValueForKey("name");
if (tn && tn[0]) { if (tn && tn[0]) {
int targetnum = atoi(tn + 1); int targetnum = atoi(tn + 1);
if (targetnum > maxtarg) { if (targetnum > maxtarg) {
@@ -1430,7 +1429,7 @@ void UniqueTargetName(idStr &rStr) {
} }
} }
else { else {
tn = ValueForKey(e, "target"); tn = e->ValueForKey("target");
if (tn && tn[0]) { if (tn && tn[0]) {
int targetnum = atoi(tn + 1); int targetnum = atoi(tn + 1);
if (targetnum > maxtarg) { if (targetnum > maxtarg) {
@@ -1450,8 +1449,8 @@ void UniqueTargetName(idStr &rStr) {
// ======================================================================================================================= // =======================================================================================================================
// //
void Map_ImportBuffer(char *buf, bool renameEntities) { void Map_ImportBuffer(char *buf, bool renameEntities) {
entity_t *ent; idEditorEntity *ent;
brush_t *b = NULL; idEditorBrush *b = NULL;
CPtrArray ptrs; CPtrArray ptrs;
Select_Deselect(); Select_Deselect();
@@ -1487,10 +1486,10 @@ void Map_ImportBuffer(char *buf, bool renameEntities) {
while (1) { while (1) {
// //
// use the selected brushes list as it's handy ent = Entity_Parse (false, // use the selected brushes list as it's handy ent = idEditorEntity::Entity_Parse(false,
// &selected_brushes); // &selected_brushes);
// //
ent = Entity_Parse(false, &active_brushes); ent = idEditorEntity::Entity_Parse(false, &active_brushes);
if (!ent) { if (!ent) {
break; break;
} }
@@ -1503,24 +1502,24 @@ void Map_ImportBuffer(char *buf, bool renameEntities) {
Undo_EndBrush(b); Undo_EndBrush(b);
} }
if (!strcmp(ValueForKey(ent, "classname"), "worldspawn")) { if (!strcmp(ent->ValueForKey("classname"), "worldspawn")) {
// world brushes need to be added to the current world entity // world brushes need to be added to the current world entity
b = ent->brushes.onext; b = ent->brushes.onext;
while (b && b != &ent->brushes) { while (b && b != &ent->brushes) {
brush_t *bNext = b->onext; idEditorBrush *bNext = b->onext;
Entity_UnlinkBrush(b); idEditorEntity::Entity_UnlinkBrush(b);
Entity_LinkBrush(world_entity, b); world_entity->Entity_LinkBrush(b);
ptrs.Add(b); ptrs.Add(b);
b = bNext; b = bNext;
} }
} }
else { else {
// the following bit remaps conflicting target/targetname key/value pairs // the following bit remaps conflicting target/targetname key/value pairs
CString str = ValueForKey(ent, "target"); CString str = ent->ValueForKey("target");
CString strKey; CString strKey;
CString strTarget(""); CString strTarget("");
if (str.GetLength() > 0) { if (str.GetLength() > 0) {
if (FindEntity("target", str.GetBuffer(0))) { if (idEditorEntity::FindEntity("target", str.GetBuffer(0))) {
if (!mapStr.Lookup(str, strKey)) { if (!mapStr.Lookup(str, strKey)) {
idStr key; idStr key;
UniqueTargetName(key); UniqueTargetName(key);
@@ -1529,25 +1528,24 @@ void Map_ImportBuffer(char *buf, bool renameEntities) {
} }
strTarget = strKey; strTarget = strKey;
SetKeyValue(ent, "target", strTarget.GetBuffer(0)); ent->SetKeyValue("target", strTarget.GetBuffer(0));
} }
} }
/* /*
* str = ValueForKey(ent, "name"); if (str.GetLength() > 0) { if * str = ent->ValueForKey("name"); if (str.GetLength() > 0) { if
* (FindEntity("name", str.GetBuffer(0))) { if (!mapStr.Lookup(str, strKey)) { * (idEditorEntity::FindEntity("name", str.GetBuffer(0))) { if (!mapStr.Lookup(str, strKey)) {
* UniqueTargetName(strKey); mapStr.SetAt(str, strKey); } Entity_SetName(ent, * UniqueTargetName(strKey); mapStr.SetAt(str, strKey); } ent->Entity_SetName(* strKey.GetBuffer(0)); } }
* strKey.GetBuffer(0)); } }
*/ */
CString cstrNameOld = ValueForKey(ent, "name"); CString cstrNameOld = ent->ValueForKey("name");
Entity_Name(ent, renameEntities); ent->Entity_Name(renameEntities);
CString cstrNameNew = ValueForKey(ent, "name"); CString cstrNameNew = ent->ValueForKey("name");
if (cstrNameOld != cstrNameNew) if (cstrNameOld != cstrNameNew)
{ {
RemappedNames.Set(cstrNameOld, cstrNameNew); RemappedNames.Set(cstrNameOld, cstrNameNew);
} }
// //
// if (strTarget.GetLength() > 0) SetKeyValue(ent, "target", // if (strTarget.GetLength() > 0) ent->SetKeyValue("target",
// strTarget.GetBuffer(0)); // strTarget.GetBuffer(0));
// add the entity to the end of the entity list // add the entity to the end of the entity list
// //
@@ -1575,24 +1573,24 @@ void Map_ImportBuffer(char *buf, bool renameEntities) {
LPCSTR psOldName = pKeyVal->GetKey().c_str(); LPCSTR psOldName = pKeyVal->GetKey().c_str();
LPCSTR psNewName = pKeyVal->GetValue().c_str(); LPCSTR psNewName = pKeyVal->GetValue().c_str();
entity_t *pEntOld = FindEntity("name", psOldName); // original ent we cloned from idEditorEntity *pEntOld = idEditorEntity::FindEntity("name", psOldName); // original ent we cloned from
entity_t *pEntNew = FindEntity("name", psNewName); // cloned ent idEditorEntity *pEntNew = idEditorEntity::FindEntity("name", psNewName); // cloned ent
if (pEntOld && pEntNew) if (pEntOld && pEntNew)
{ {
CString cstrTargetNameOld = ValueForKey(pEntOld, "target"); CString cstrTargetNameOld = pEntOld->ValueForKey("target");
if (!cstrTargetNameOld.IsEmpty()) if (!cstrTargetNameOld.IsEmpty())
{ {
// ok, this ent was targeted at another ent, so it's clone needs updating to point to // ok, this ent was targeted at another ent, so it's clone needs updating to point to
// the clone of that target, so... // the clone of that target, so...
// //
entity_t *pEntOldTarget = FindEntity("name", cstrTargetNameOld); idEditorEntity *pEntOldTarget = idEditorEntity::FindEntity("name", cstrTargetNameOld);
if ( pEntOldTarget ) if ( pEntOldTarget )
{ {
LPCSTR psNewTargetName = RemappedNames.GetString( cstrTargetNameOld ); LPCSTR psNewTargetName = RemappedNames.GetString( cstrTargetNameOld );
if (psNewTargetName && psNewTargetName[0]) if (psNewTargetName && psNewTargetName[0])
{ {
SetKeyValue(pEntNew, "target", psNewTargetName); pEntNew->SetKeyValue("target", psNewTargetName);
} }
} }
} }
@@ -1606,8 +1604,8 @@ void Map_ImportBuffer(char *buf, bool renameEntities) {
// //
g_bScreenUpdates = false; g_bScreenUpdates = false;
for (int i = 0; i < ptrs.GetSize(); i++) { for (int i = 0; i < ptrs.GetSize(); i++) {
Brush_Build(reinterpret_cast < brush_t * > (ptrs[i]), true, false); reinterpret_cast < idEditorBrush * > (ptrs[i])->Brush_Build(true, false);
Select_Brush(reinterpret_cast < brush_t * > (ptrs[i]), true, false); Select_Brush(reinterpret_cast < idEditorBrush * > (ptrs[i]), true, false);
} }
// ::LockWindowUpdate(NULL); // ::LockWindowUpdate(NULL);
@@ -1657,7 +1655,7 @@ void Map_ImportFile(char *fileName) {
// ======================================================================================================================= // =======================================================================================================================
// //
void Map_SaveSelected(char *fileName) { void Map_SaveSelected(char *fileName) {
entity_t *e, *next; idEditorEntity *e, *next;
FILE *f; FILE *f;
idStr temp; idStr temp;
int count; int count;
@@ -1677,14 +1675,14 @@ void Map_SaveSelected(char *fileName) {
// write world entity second // write world entity second
world_entity->origin.Zero(); world_entity->origin.Zero();
Entity_WriteSelected( world_entity, f ); world_entity->Entity_WriteSelected(f );
// then write all other ents // then write all other ents
count = 1; count = 1;
for ( e = entities.next; e != &entities; e = next ) { for ( e = entities.next; e != &entities; e = next ) {
fprintf( f, "// entity %i\n", count ); fprintf( f, "// entity %i\n", count );
count++; count++;
Entity_WriteSelected( e, f ); e->Entity_WriteSelected(f );
next = e->next; next = e->next;
} }
@@ -1697,7 +1695,7 @@ void Map_SaveSelected(char *fileName) {
// ======================================================================================================================= // =======================================================================================================================
// //
void Map_SaveSelected(CMemFile *pMemFile, CMemFile *pPatchFile) { void Map_SaveSelected(CMemFile *pMemFile, CMemFile *pPatchFile) {
entity_t *e, *next; idEditorEntity *e, *next;
int count; int count;
CString strTemp; CString strTemp;
@@ -1707,14 +1705,14 @@ void Map_SaveSelected(CMemFile *pMemFile, CMemFile *pPatchFile) {
// write world entity first // write world entity first
world_entity->origin.Zero(); world_entity->origin.Zero();
Entity_WriteSelected(world_entity, pMemFile); world_entity->Entity_WriteSelected(pMemFile);
// then write all other ents // then write all other ents
count = 1; count = 1;
for (e = entities.next; e != &entities; e = next) { for (e = entities.next; e != &entities; e = next) {
MemFile_fprintf(pMemFile, "// entity %i\n", count); MemFile_fprintf(pMemFile, "// entity %i\n", count);
count++; count++;
Entity_WriteSelected(e, pMemFile); e->Entity_WriteSelected(pMemFile);
next = e->next; next = e->next;
} }
+8 -8
View File
@@ -34,18 +34,18 @@ If you have questions concerning this license or the applicable additional terms
extern char currentmap[1024]; extern char currentmap[1024];
// head/tail of doubly linked lists // head/tail of doubly linked lists
extern brush_t active_brushes; // brushes currently being displayed extern idEditorBrush active_brushes; // brushes currently being displayed
extern brush_t selected_brushes; // highlighted extern idEditorBrush selected_brushes; // highlighted
extern CPtrArray& g_ptrSelectedFaces; extern CPtrArray& g_ptrSelectedFaces;
extern CPtrArray& g_ptrSelectedFaceBrushes; extern CPtrArray& g_ptrSelectedFaceBrushes;
//extern face_t *selected_face; //extern face_t *selected_face;
//extern brush_t *selected_face_brush; //extern idEditorBrush *selected_face_brush;
extern brush_t filtered_brushes; // brushes that have been filtered or regioned extern idEditorBrush filtered_brushes; // brushes that have been filtered or regioned
extern entity_t entities; extern idEditorEntity entities;
extern entity_t *world_entity; // the world entity is NOT included in extern idEditorEntity *world_entity; // the world entity is NOT included in
// the entities chain // the entities chain
extern int modified; // for quit confirmations extern int modified; // for quit confirmations
@@ -72,12 +72,12 @@ void Map_RegionXY (void);
void Map_RegionTallBrush (void); void Map_RegionTallBrush (void);
void Map_RegionBrush (void); void Map_RegionBrush (void);
void Map_RegionSelectedBrushes (void); void Map_RegionSelectedBrushes (void);
bool Map_IsBrushFiltered (brush_t *b); bool Map_IsBrushFiltered (idEditorBrush *b);
void Map_SaveSelected(CMemFile* pMemFile, CMemFile* pPatchFile = NULL); void Map_SaveSelected(CMemFile* pMemFile, CMemFile* pPatchFile = NULL);
void Map_ImportBuffer (char* buf, bool renameEntities = true); void Map_ImportBuffer (char* buf, bool renameEntities = true);
int Map_GetUniqueEntityID(const char *prefix, const char *eclass); int Map_GetUniqueEntityID(const char *prefix, const char *eclass);
idMapPrimitive *BrushToMapPrimitive( const brush_t *b, const idVec3 &origin ); idMapPrimitive *BrushToMapPrimitive( const idEditorBrush *b, const idVec3 &origin );
#endif #endif
+28 -28
View File
@@ -1260,7 +1260,7 @@ void CEntityDlg::OnCbnSelchangeComboClass() {
editEntity = selected_brushes.next->owner; editEntity = selected_brushes.next->owner;
multipleEntities = false; multipleEntities = false;
for (brush_t* b = selected_brushes.next->next; b != &selected_brushes; b = b->next) { for (idEditorBrush* b = selected_brushes.next->next; b != &selected_brushes; b = b->next) {
if (b->owner != editEntity) { if (b->owner != editEntity) {
multipleEntities = true; multipleEntities = true;
break; break;
@@ -1489,14 +1489,14 @@ void CEntityDlg::DelProp() {
editKey.GetWindowText(key); editKey.GetWindowText(key);
if (multipleEntities) { if (multipleEntities) {
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) {
DeleteKey(b->owner, key); b->owner->DeleteKey(key);
Entity_UpdateCurveData(b->owner); b->owner->Entity_UpdateCurveData();
} }
} }
else { else {
DeleteKey(editEntity, key); editEntity->DeleteKey(key);
Entity_UpdateCurveData(editEntity); editEntity->Entity_UpdateCurveData();
} }
SetKeyValPairs(); SetKeyValPairs();
@@ -1626,24 +1626,24 @@ void CEntityDlg::AddProp() {
bool isOrigin = (idStr::Icmp(Key, "origin") == 0); bool isOrigin = (idStr::Icmp(Key, "origin") == 0);
if (multipleEntities) { if (multipleEntities) {
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 (isName) { if (isName) {
Entity_SetName(b->owner, Value); b->owner->Entity_SetName(Value);
} }
else { else {
if (!((isModel || isOrigin) && (b->owner->eclass->nShowFlags & ECLASS_WORLDSPAWN))) { if (!((isModel || isOrigin) && (b->owner->eclass->nShowFlags & ECLASS_WORLDSPAWN))) {
SetKeyValue(b->owner, Key, Value); b->owner->SetKeyValue(Key, Value);
} }
} }
} }
} }
else { else {
if (isName) { if (isName) {
Entity_SetName(editEntity, Value); editEntity->Entity_SetName(Value);
} }
else { else {
if (!((isModel || isOrigin) && (editEntity->eclass->nShowFlags & ECLASS_WORLDSPAWN))) { if (!((isModel || isOrigin) && (editEntity->eclass->nShowFlags & ECLASS_WORLDSPAWN))) {
SetKeyValue(editEntity, Key, Value); editEntity->SetKeyValue(Key, Value);
} }
} }
@@ -1667,8 +1667,8 @@ void CEntityDlg::AddProp() {
VectorAdd(mins, editEntity->origin, mins); VectorAdd(mins, editEntity->origin, mins);
VectorAdd(maxs, editEntity->origin, maxs); VectorAdd(maxs, editEntity->origin, maxs);
Brush_RebuildBrush(selected_brushes.next, mins, maxs, false); selected_brushes.next->Brush_RebuildBrush(mins, maxs, false);
Brush_Build(selected_brushes.next, false, false, false, true); selected_brushes.next->Brush_Build(false, false, false, true);
} }
} }
@@ -1828,7 +1828,7 @@ CPreviewDlg* CEntityDlg::ShowParticleChooser() {
return &modelDlg; return &modelDlg;
} }
CPreviewDlg* CEntityDlg::ShowSkinChooser(entity_t* ent) { CPreviewDlg* CEntityDlg::ShowSkinChooser(idEditorEntity* ent) {
static CPreviewDlg modelDlg; static CPreviewDlg modelDlg;
modelDlg.SetMode(CPreviewDlg::SKINS); modelDlg.SetMode(CPreviewDlg::SKINS);
modelDlg.SetModal(); modelDlg.SetModal();
@@ -1978,7 +1978,7 @@ void CEntityDlg::OnBnClickedButtonCurve() {
editVal.SetWindowText(str); editVal.SetWindowText(str);
AddProp(); AddProp();
Entity_SetCurveData(editEntity); editEntity->Entity_SetCurveData();
} }
} }
} }
@@ -1995,7 +1995,7 @@ void CEntityDlg::OnCbnDblclkComboClass() {
// -------------------------------------------------------------------------- // --------------------------------------------------------------------------
void CEntityDlg::CreateEntity() { void CEntityDlg::CreateEntity() {
entity_t* petNew; idEditorEntity* petNew;
bool forceFixed = false; bool forceFixed = false;
CXYWnd* pWnd = g_pParentWnd->ActiveXY(); CXYWnd* pWnd = g_pParentWnd->ActiveXY();
@@ -2032,33 +2032,33 @@ void CEntityDlg::CreateEntity() {
eclass_t* pecNew = Eclass_ForName(str, false); eclass_t* pecNew = Eclass_ForName(str, false);
if ((GetAsyncKeyState(VK_CONTROL) & 0x8000)) { if ((GetAsyncKeyState(VK_CONTROL) & 0x8000)) {
extern void Brush_CopyList(brush_t * pFrom, brush_t * pTo); extern void Brush_CopyList(idEditorBrush * pFrom, idEditorBrush * pTo);
brush_t temp_brushes; idEditorBrush temp_brushes;
temp_brushes.next = &temp_brushes; temp_brushes.next = &temp_brushes;
Brush_CopyList(&selected_brushes, &temp_brushes); Brush_CopyList(&selected_brushes, &temp_brushes);
Select_Deselect(); Select_Deselect();
brush_t* pBrush = temp_brushes.next; idEditorBrush* pBrush = temp_brushes.next;
while (pBrush != NULL && pBrush != &temp_brushes) { while (pBrush != NULL && pBrush != &temp_brushes) {
brush_t* pNext = pBrush->next; idEditorBrush* pNext = pBrush->next;
Brush_RemoveFromList(pBrush); pBrush->Brush_RemoveFromList();
Brush_AddToList(pBrush, &selected_brushes); pBrush->Brush_AddToList(&selected_brushes);
pBrush = pNext; pBrush = pNext;
petNew = Entity_Create(pecNew, forceFixed); petNew = idEditorEntity::Entity_Create(pecNew, forceFixed);
Select_Deselect(); Select_Deselect();
} }
} }
else if ((GetAsyncKeyState(VK_SHIFT) & 0x8000)) { else if ((GetAsyncKeyState(VK_SHIFT) & 0x8000)) {
Select_Ungroup(); Select_Ungroup();
petNew = Entity_Create(pecNew, forceFixed); petNew = idEditorEntity::Entity_Create(pecNew, forceFixed);
} }
else { else {
petNew = Entity_Create(pecNew, forceFixed); petNew = idEditorEntity::Entity_Create(pecNew, forceFixed);
} }
if (petNew == NULL) { if (petNew == NULL) {
@@ -2133,7 +2133,7 @@ void CEntityDlg::UpdateKeyVal(const char* key, const char* val) {
SetKeyValPairs(); SetKeyValPairs();
g_pParentWnd->GetCamera()->BuildEntityRenderState(editEntity, true); g_pParentWnd->GetCamera()->BuildEntityRenderState(editEntity, true);
Entity_UpdateSoundEmitter(editEntity); editEntity->Entity_UpdateSoundEmitter();
} }
} }
@@ -2326,7 +2326,7 @@ void CEntityDlg::InsertCurvePoint() {
AddCurvePoints(); AddCurvePoints();
} }
else { else {
idCurve<idVec3>* newCurve = Entity_MakeCurve(editEntity); idCurve<idVec3>* newCurve = editEntity->Entity_MakeCurve();
if (newCurve == NULL) { if (newCurve == NULL) {
return; return;
@@ -2414,7 +2414,7 @@ void CEntityDlg::UpdateEntityCurve() {
return; return;
} }
Entity_UpdateCurveData(editEntity); editEntity->Entity_UpdateCurveData();
if (g_qeglobals.d_select_mode == sel_editpoint) { if (g_qeglobals.d_select_mode == sel_editpoint) {
g_qeglobals.d_numpoints = 0; g_qeglobals.d_numpoints = 0;
+3 -3
View File
@@ -28,7 +28,7 @@ public:
dict = _dict; dict = _dict;
} }
void SetEditEntity(entity_t* ent) { void SetEditEntity(idEditorEntity* ent) {
editEntity = ent; editEntity = ent;
} }
@@ -40,7 +40,7 @@ public:
static CPreviewDlg* ShowSoundChooser(); static CPreviewDlg* ShowSoundChooser();
static CPreviewDlg* ShowMaterialChooser(); static CPreviewDlg* ShowMaterialChooser();
static CPreviewDlg* ShowParticleChooser(); static CPreviewDlg* ShowParticleChooser();
static CPreviewDlg* ShowSkinChooser(entity_t* ent); static CPreviewDlg* ShowSkinChooser(idEditorEntity* ent);
void SetKeyVal(const char* key, const char* val) { void SetKeyVal(const char* key, const char* val) {
editKey.SetWindowText(key); editKey.SetWindowText(key);
@@ -79,7 +79,7 @@ public:
void UpdateFromAnimationFrame(bool updateKeyValueDisplay = true); void UpdateFromAnimationFrame(bool updateKeyValueDisplay = true);
private: private:
entity_t* editEntity; idEditorEntity* editEntity;
bool multipleEntities; bool multipleEntities;
CPropertyList listKeyVal; CPropertyList listKeyVal;
+3 -3
View File
@@ -86,7 +86,7 @@ void CEntityListDlg::OnSelect()
{ {
int index = listEntities.GetCurSel(); int index = listEntities.GetCurSel();
if (index != LB_ERR) { if (index != LB_ERR) {
entity_t *ent = reinterpret_cast<entity_t*>(listEntities.GetItemDataPtr(index)); idEditorEntity *ent = reinterpret_cast<idEditorEntity*>(listEntities.GetItemDataPtr(index));
if (ent) { if (ent) {
Select_Deselect(); Select_Deselect();
Select_Brush (ent->brushes.onext); Select_Brush (ent->brushes.onext);
@@ -97,7 +97,7 @@ void CEntityListDlg::OnSelect()
void CEntityListDlg::UpdateList() { void CEntityListDlg::UpdateList() {
listEntities.ResetContent(); listEntities.ResetContent();
for (entity_t* pEntity=entities.next ; pEntity != &entities ; pEntity=pEntity->next) { for (idEditorEntity* pEntity=entities.next ; pEntity != &entities ; pEntity=pEntity->next) {
int index = listEntities.AddString(pEntity->epairs.GetString("name")); int index = listEntities.AddString(pEntity->epairs.GetString("name"));
if (index != LB_ERR) { if (index != LB_ERR) {
listEntities.SetItemDataPtr(index, (void*)pEntity); listEntities.SetItemDataPtr(index, (void*)pEntity);
@@ -141,7 +141,7 @@ void CEntityListDlg::OnLbnSelchangeListEntities()
int index = listEntities.GetCurSel(); int index = listEntities.GetCurSel();
if (index != LB_ERR) { if (index != LB_ERR) {
m_lstEntity.DeleteAllItems(); m_lstEntity.DeleteAllItems();
entity_t* pEntity = reinterpret_cast<entity_t*>(listEntities.GetItemDataPtr(index)); idEditorEntity* pEntity = reinterpret_cast<idEditorEntity*>(listEntities.GetItemDataPtr(index));
if (pEntity) { if (pEntity) {
int count = pEntity->epairs.GetNumKeyVals(); int count = pEntity->epairs.GetNumKeyVals();
for (int i = 0; i < count; i++) { for (int i = 0; i < count; i++) {
+6 -6
View File
@@ -1093,14 +1093,14 @@ void CLightDlg::SaveLightInfo( const idDict *differences ) {
if ( com_editorActive ) { if ( com_editorActive ) {
// used from Radiant // used from Radiant
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->eclass->nShowFlags & ECLASS_LIGHT ) && !b->entityModel ) { if ( ( b->owner->eclass->nShowFlags & ECLASS_LIGHT ) && !b->entityModel ) {
if ( differences ) { if ( differences ) {
lightInfo.ToDictFromDifferences( &b->owner->epairs, differences ); lightInfo.ToDictFromDifferences( &b->owner->epairs, differences );
} else { } else {
lightInfo.ToDict( &b->owner->epairs ); lightInfo.ToDict( &b->owner->epairs );
} }
Brush_Build( b ); b->Brush_Build();
} }
} }
@@ -1233,9 +1233,9 @@ void CLightDlg::OnOK() {
CDialog::OnOK(); CDialog::OnOK();
} }
entity_t *SingleLightSelected() { idEditorEntity *SingleLightSelected() {
if ( QE_SingleBrush( true, true ) ) { if ( QE_SingleBrush( true, true ) ) {
brush_t *b = selected_brushes.next; idEditorBrush *b = selected_brushes.next;
if ( ( b->owner->eclass->nShowFlags & ECLASS_LIGHT ) && !b->entityModel ) { if ( ( b->owner->eclass->nShowFlags & ECLASS_LIGHT ) && !b->entityModel ) {
return b->owner; return b->owner;
} }
@@ -1252,7 +1252,7 @@ void CLightDlg::UpdateDialog( bool updateChecks )
if ( com_editorActive ) { if ( com_editorActive ) {
// used from Radiant // used from Radiant
entity_t *e = SingleLightSelected(); idEditorEntity *e = SingleLightSelected();
if ( e ) { if ( e ) {
lightInfo.FromDict(&e->epairs); lightInfo.FromDict(&e->epairs);
lightInfoOriginal.FromDict(&e->epairs); //our original copy of the values that we compare against for apply differences lightInfoOriginal.FromDict(&e->epairs); //our original copy of the values that we compare against for apply differences
@@ -1260,7 +1260,7 @@ void CLightDlg::UpdateDialog( bool updateChecks )
} else { } else {
//find the last brush belonging to the last entity selected and use that as the source //find the last brush belonging to the last entity selected and use that as the source
e = NULL; e = NULL;
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->owner->eclass->nShowFlags & ECLASS_LIGHT ) && !b->entityModel ) { if ( ( b->owner->eclass->nShowFlags & ECLASS_LIGHT ) && !b->entityModel ) {
e = b->owner; e = b->owner;
break; break;
+60 -60
View File
@@ -2548,23 +2548,23 @@ void CMainFrame::OnDestroy() {
} }
while (entities.next != &entities) { while (entities.next != &entities) {
Entity_Free(entities.next); idEditorEntity::Entity_Free(entities.next);
} }
g_qeglobals.d_project_entity->epairs.Clear(); g_qeglobals.d_project_entity->epairs.Clear();
entity_t* pEntity = g_qeglobals.d_project_entity->next; idEditorEntity* pEntity = g_qeglobals.d_project_entity->next;
while (pEntity != NULL && pEntity != g_qeglobals.d_project_entity) { while (pEntity != NULL && pEntity != g_qeglobals.d_project_entity) {
entity_t* pNextEntity = pEntity->next; idEditorEntity* pNextEntity = pEntity->next;
Entity_Free(pEntity); idEditorEntity::Entity_Free(pEntity);
pEntity = pNextEntity; pEntity = pNextEntity;
} }
Texture_Cleanup(); Texture_Cleanup();
if (world_entity) { if (world_entity) {
Entity_Free(world_entity); idEditorEntity::Entity_Free(world_entity);
} }
// //
@@ -2572,7 +2572,7 @@ void CMainFrame::OnDestroy() {
// if (notexture) { // Timo // Surface properties plugin #ifdef _DEBUG if ( // if (notexture) { // Timo // Surface properties plugin #ifdef _DEBUG if (
// !notexture->pData ) common->Printf("WARNING: found a qtexture_t* with no // !notexture->pData ) common->Printf("WARNING: found a qtexture_t* with no
// IPluginQTexture\n"); #endif if ( notexture->pData ) // IPluginQTexture\n"); #endif if ( notexture->pData )
// GETPLUGINTEXDEF(notexture)->DecRef(); Mem_Free(notexture); } // GETPLUGINTEXDEFnotexture->DecRef(); Mem_Free(notexture); }
// if (current_texture) free(current_texture); // if (current_texture) free(current_texture);
// //
@@ -2947,7 +2947,7 @@ void CMainFrame::OnFileSaveCopy() {
memset(&afn, 0, sizeof(OPENFILENAME)); memset(&afn, 0, sizeof(OPENFILENAME));
CString strPath = ValueForKey(g_qeglobals.d_project_entity, "basepath"); CString strPath = g_qeglobals.d_project_entity->ValueForKey("basepath");
AddSlash(strPath); AddSlash(strPath);
strPath += "maps"; strPath += "maps";
if (g_PrefsDlg.m_strMaps.GetLength() > 0) { if (g_PrefsDlg.m_strMaps.GetLength() > 0) {
@@ -3690,10 +3690,10 @@ bool DoColor(int iIndex) {
extern void Select_SetKeyVal(const char* key, const char* val); extern void Select_SetKeyVal(const char* key, const char* val);
void CMainFrame::OnMiscSelectentitycolor() { void CMainFrame::OnMiscSelectentitycolor() {
entity_t* ent = NULL; idEditorEntity* ent = NULL;
if (QE_SingleBrush(true, true)) { if (QE_SingleBrush(true, true)) {
ent = selected_brushes.next->owner; ent = selected_brushes.next->owner;
CString strColor = ValueForKey(ent, "_color"); CString strColor = ent->ValueForKey("_color");
if (strColor.GetLength() > 0) { if (strColor.GetLength() > 0) {
float fR, fG, fB; float fR, fG, fB;
int n = sscanf(strColor, "%f %f %f", &fR, &fG, &fB); int n = sscanf(strColor, "%f %f %f", &fR, &fG, &fB);
@@ -3722,7 +3722,7 @@ CString strReplaceKey;
CString strReplaceValue; CString strReplaceValue;
bool gbWholeStringMatchOnly = true; bool gbWholeStringMatchOnly = true;
bool gbSelectAllMatchingEnts = false; bool gbSelectAllMatchingEnts = false;
brush_t* gpPrevEntBrushFound = NULL; idEditorBrush* gpPrevEntBrushFound = NULL;
// all this because there's no ansi stristr(), sigh... // all this because there's no ansi stristr(), sigh...
// //
@@ -3748,11 +3748,11 @@ LPCSTR String_ToLower(LPCSTR psString)
} }
bool FindNextBrush(brush_t* pPrevFoundBrush) // can be NULL for fresh search bool FindNextBrush(idEditorBrush* pPrevFoundBrush) // can be NULL for fresh search
{ {
bool bFoundSomething = false; bool bFoundSomething = false;
entity_t* pLastFoundEnt; idEditorEntity* pLastFoundEnt;
brush_t* pLastFoundBrush; idEditorBrush* pLastFoundBrush;
CWaitCursor waitcursor; CWaitCursor waitcursor;
@@ -3760,12 +3760,12 @@ bool FindNextBrush(brush_t* pPrevFoundBrush) // can be NULL for fresh search
// see whether to start search from prev_brush->next by checking if prev_brush is still in the active list... // see whether to start search from prev_brush->next by checking if prev_brush is still in the active list...
// //
brush_t* pStartBrush = active_brushes.next; idEditorBrush* pStartBrush = active_brushes.next;
if (pPrevFoundBrush && !gbSelectAllMatchingEnts) if (pPrevFoundBrush && !gbSelectAllMatchingEnts)
{ {
brush_t* pPrev = NULL; idEditorBrush* pPrev = NULL;
for (brush_t* b = active_brushes.next; b != &active_brushes; b = b->next) for (idEditorBrush* b = active_brushes.next; b != &active_brushes; b = b->next)
{ {
if (pPrev == pPrevFoundBrush && pPrevFoundBrush) if (pPrev == pPrevFoundBrush && pPrevFoundBrush)
{ {
@@ -3782,8 +3782,8 @@ bool FindNextBrush(brush_t* pPrevFoundBrush) // can be NULL for fresh search
int iBrushesSelected = 0; int iBrushesSelected = 0;
int iEntsScanned = 0; int iEntsScanned = 0;
brush_t* pNextBrush; idEditorBrush* pNextBrush;
for (brush_t* b = pStartBrush; b != &active_brushes; b = pNextBrush) for (idEditorBrush* b = pStartBrush; b != &active_brushes; b = pNextBrush)
{ {
// setup the <nextbrush> ptr before going any further (because selecting a brush down below moves it to a // setup the <nextbrush> ptr before going any further (because selecting a brush down below moves it to a
// different link list), but we need to ensure that the next brush has a different ent-owner than the current // different link list), but we need to ensure that the next brush has a different ent-owner than the current
@@ -3805,7 +3805,7 @@ bool FindNextBrush(brush_t* pPrevFoundBrush) // can be NULL for fresh search
common->Printf("."); // cut down on printing common->Printf("."); // cut down on printing
bool bMatch = false; bool bMatch = false;
entity_t* ent = b->owner; idEditorEntity* ent = b->owner;
if (ent && ent != world_entity) // needed! if (ent && ent != world_entity) // needed!
{ {
@@ -3817,7 +3817,7 @@ bool FindNextBrush(brush_t* pPrevFoundBrush) // can be NULL for fresh search
// //
if (!strFindKey.IsEmpty()) if (!strFindKey.IsEmpty())
{ {
const char* psEntFoundValue = ValueForKey(ent, strFindKey); const char* psEntFoundValue = ent->ValueForKey(strFindKey);
if (strlen(psEntFoundValue) if (strlen(psEntFoundValue)
&& &&
@@ -3840,10 +3840,10 @@ bool FindNextBrush(brush_t* pPrevFoundBrush) // can be NULL for fresh search
{ {
// no FIND key specified, so just scan all of them... // no FIND key specified, so just scan all of them...
// //
int iNumEntKeys = GetNumKeys(ent); int iNumEntKeys = ent->GetNumKeys();
for (int i = 0; i < iNumEntKeys; i++) for (int i = 0; i < iNumEntKeys; i++)
{ {
const char* psEntFoundValue = ValueForKey(ent, GetKeyString(ent, i)); const char* psEntFoundValue = ent->ValueForKey(ent->GetKeyString(i));
if (psEntFoundValue) if (psEntFoundValue)
{ {
if ((strlen(psEntFoundValue) && strFindValue.IsEmpty()) // if blank <value> search specified then any found-value is ok if ((strlen(psEntFoundValue) && strFindValue.IsEmpty()) // if blank <value> search specified then any found-value is ok
@@ -3941,19 +3941,19 @@ void CMainFrame::OnMiscFindOrReplaceEntity()
{ {
case ID_RET_REPLACE: case ID_RET_REPLACE:
{ {
brush_t* next = NULL; idEditorBrush* next = NULL;
int iOccurences = 0; int iOccurences = 0;
for (brush_t* b = active_brushes.next; b != &active_brushes; b = next) for (idEditorBrush* b = active_brushes.next; b != &active_brushes; b = next)
{ {
next = b->next; // important to do this here, in case brush gets linked to a different list next = b->next; // important to do this here, in case brush gets linked to a different list
entity_t* ent = b->owner; idEditorEntity* ent = b->owner;
if (ent) // needed! if (ent) // needed!
{ {
if (FilterBrush(b)) if (FilterBrush(b))
continue; continue;
const char* psEntFoundValue = ValueForKey(ent, strFindKey); const char* psEntFoundValue = ent->ValueForKey(strFindKey);
if (stricmp(strFindValue, psEntFoundValue) == 0 || // found this exact key/value if (stricmp(strFindValue, psEntFoundValue) == 0 || // found this exact key/value
(strlen(psEntFoundValue) && strFindValue.IsEmpty()) // or any value for this key if blank value search specified (strlen(psEntFoundValue) && strFindValue.IsEmpty()) // or any value for this key if blank value search specified
@@ -3961,13 +3961,13 @@ void CMainFrame::OnMiscFindOrReplaceEntity()
{ {
// found this search key/value, so delete it... // found this search key/value, so delete it...
// //
DeleteKey(ent, strFindKey); ent->DeleteKey(strFindKey);
// //
// and replace with the new key/value (if specified)... // and replace with the new key/value (if specified)...
// //
if (!strReplaceKey.IsEmpty() && !strReplaceValue.IsEmpty()) if (!strReplaceKey.IsEmpty() && !strReplaceValue.IsEmpty())
{ {
SetKeyValue(ent, strReplaceKey, strReplaceValue); ent->SetKeyValue(strReplaceKey, strReplaceValue);
} }
iOccurences++; iOccurences++;
} }
@@ -4175,13 +4175,13 @@ void CMainFrame::OnBrushFlipx() {
Undo_AddBrushList(&selected_brushes); Undo_AddBrushList(&selected_brushes);
Select_FlipAxis(0); Select_FlipAxis(0);
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->owner->eclass->fixedsize) { if (b->owner->eclass->fixedsize) {
char buf[16]; char buf[16];
float a = FloatForKey(b->owner, "angle"); float a = b->owner->FloatForKey("angle");
a = div((180 - a), 180).rem; a = div((180 - a), 180).rem;
SetKeyValue(b->owner, "angle", itoa(a, buf, 10)); b->owner->SetKeyValue("angle", itoa(a, buf, 10));
Brush_Build(b); b->Brush_Build();
} }
} }
Patch_ToggleInverted(); Patch_ToggleInverted();
@@ -4198,9 +4198,9 @@ void CMainFrame::OnBrushFlipy() {
Undo_AddBrushList(&selected_brushes); Undo_AddBrushList(&selected_brushes);
Select_FlipAxis(1); Select_FlipAxis(1);
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->owner->eclass->fixedsize) { if (b->owner->eclass->fixedsize) {
float a = FloatForKey(b->owner, "angle"); float a = b->owner->FloatForKey("angle");
if (a == 0 || a == 180 || a == 360) { if (a == 0 || a == 180 || a == 360) {
continue; continue;
} }
@@ -4224,8 +4224,8 @@ void CMainFrame::OnBrushFlipy() {
a = (int)a % 360; a = (int)a % 360;
char buf[16]; char buf[16];
SetKeyValue(b->owner, "angle", itoa(a, buf, 10)); b->owner->SetKeyValue("angle", itoa(a, buf, 10));
Brush_Build(b); b->Brush_Build();
} }
} }
Patch_ToggleInverted(); Patch_ToggleInverted();
@@ -4398,7 +4398,7 @@ void CMainFrame::OnSelectionCsgmerge() {
======================================================================================================================= =======================================================================================================================
*/ */
void CMainFrame::OnSelectionDelete() { void CMainFrame::OnSelectionDelete() {
brush_t* brush; idEditorBrush* brush;
// if (ActiveXY()) ActiveXY()->UndoCopy(); // if (ActiveXY()) ActiveXY()->UndoCopy();
Undo_Start("delete"); Undo_Start("delete");
@@ -5972,8 +5972,8 @@ void CMainFrame::OnToolbarTexture() {
======================================================================================================================= =======================================================================================================================
*/ */
void CMainFrame::OnSelectionPrint() { void CMainFrame::OnSelectionPrint() {
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) {
Brush_Print(b); b->Brush_Print();
} }
} }
@@ -6751,13 +6751,13 @@ void CMainFrame::OnPatchTab() {
// check to see if the selected brush is part of a func group if it is, deselect // check to see if the selected brush is part of a func group if it is, deselect
// everything and reselect the next brush in the group // everything and reselect the next brush in the group
// //
brush_t* b = selected_brushes.next; idEditorBrush* b = selected_brushes.next;
entity_t* e; idEditorEntity* e;
if (b != &selected_brushes) { if (b != &selected_brushes) {
if (idStr::Icmp(b->owner->eclass->name, "worldspawn") != 0) { if (idStr::Icmp(b->owner->eclass->name, "worldspawn") != 0) {
e = b->owner; e = b->owner;
Select_Deselect(); Select_Deselect();
brush_t* b2; idEditorBrush* b2;
for (b2 = e->brushes.onext; b2 != &e->brushes; b2 = b2->onext) { for (b2 = e->brushes.onext; b2 != &e->brushes; b2 = b2->onext) {
if (b == b2) { if (b == b2) {
b2 = b2->onext; b2 = b2->onext;
@@ -7587,7 +7587,7 @@ void CMainFrame::OnSelectionCombine()
return; return;
} }
entity_t* e1 = g_qeglobals.d_select_order[0]->owner; idEditorEntity* e1 = g_qeglobals.d_select_order[0]->owner;
if (e1 == world_entity) { if (e1 == world_entity) {
Sys_Status("First selection must not be world.", 0); Sys_Status("First selection must not be world.", 0);
@@ -7603,47 +7603,47 @@ void CMainFrame::OnSelectionCombine()
// light_origin and light_rotation // light_origin and light_rotation
e1->trackLightOrigin = true; e1->trackLightOrigin = true;
e1->brushes.onext->trackLightOrigin = true; e1->brushes.onext->trackLightOrigin = true;
if (GetVectorForKey(e1, "origin", v)) { if (e1->GetVectorForKey("origin", v)) {
SetKeyVec3(e1, "light_origin", v); e1->SetKeyVec3("light_origin", v);
e1->lightOrigin = v; e1->lightOrigin = v;
} }
if (!GetMatrixForKey(e1, "rotation", mat)) { if (!e1->GetMatrixForKey("rotation", mat)) {
mat.Identity(); mat.Identity();
} }
sprintf(str, "%g %g %g %g %g %g %g %g %g", mat[0][0], mat[0][1], mat[0][2], mat[1][0], mat[1][1], mat[1][2], mat[2][0], mat[2][1], mat[2][2]); sprintf(str, "%g %g %g %g %g %g %g %g %g", mat[0][0], mat[0][1], mat[0][2], mat[1][0], mat[1][1], mat[1][2], mat[2][0], mat[2][1], mat[2][2]);
SetKeyValue(e1, "light_rotation", str, false); e1->SetKeyValue("light_rotation", str, false);
e1->lightRotation = mat; e1->lightRotation = mat;
} }
bool setModel = true; bool setModel = true;
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->owner != e1) { if (b->owner != e1) {
if (e1->eclass->nShowFlags & ECLASS_LIGHT) { if (e1->eclass->nShowFlags & ECLASS_LIGHT) {
if (GetVectorForKey(b->owner, "origin", v)) { if (b->owner->GetVectorForKey("origin", v)) {
e1->origin = b->owner->origin; e1->origin = b->owner->origin;
SetKeyVec3(e1, "origin", b->owner->origin); e1->SetKeyVec3("origin", b->owner->origin);
} }
if (GetMatrixForKey(b->owner, "rotation", mat)) { if (b->owner->GetMatrixForKey("rotation", mat)) {
e1->rotation = b->owner->rotation; e1->rotation = b->owner->rotation;
mat = b->owner->rotation; mat = b->owner->rotation;
sprintf(str, "%g %g %g %g %g %g %g %g %g", mat[0][0], mat[0][1], mat[0][2], mat[1][0], mat[1][1], mat[1][2], mat[2][0], mat[2][1], mat[2][2]); sprintf(str, "%g %g %g %g %g %g %g %g %g", mat[0][0], mat[0][1], mat[0][2], mat[1][0], mat[1][1], mat[1][2], mat[2][0], mat[2][1], mat[2][2]);
SetKeyValue(e1, "rotation", str, false); e1->SetKeyValue("rotation", str, false);
} }
if (b->modelHandle) { if (b->modelHandle) {
SetKeyValue(e1, "model", ValueForKey(b->owner, "model")); e1->SetKeyValue("model", b->owner->ValueForKey("model"));
setModel = false; setModel = false;
} }
else { else {
b->entityModel = true; b->entityModel = true;
} }
} }
Entity_UnlinkBrush(b); idEditorEntity::Entity_UnlinkBrush(b);
Entity_LinkBrush(e1, b); e1->Entity_LinkBrush(b);
} }
} }
if (setModel) { if (setModel) {
SetKeyValue(e1, "model", ValueForKey(e1, "name")); e1->SetKeyValue("model", e1->ValueForKey("name"));
} }
Select_Deselect(); Select_Deselect();
@@ -7655,7 +7655,7 @@ extern void Patch_Weld(patchMesh_t* p, patchMesh_t* p2);
void CMainFrame::OnPatchCombine() { void CMainFrame::OnPatchCombine() {
patchMesh_t* p, * p2; patchMesh_t* p, * p2;
p = p2 = NULL; p = p2 = NULL;
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) { if (b->pPatch) {
if (p == NULL) { if (p == NULL) {
p = b->pPatch; p = b->pPatch;
@@ -7894,8 +7894,8 @@ void CMainFrame::OnSelectAlltargets()
void CMainFrame::OnSelectCompleteEntity() void CMainFrame::OnSelectCompleteEntity()
{ {
brush_t* b = NULL; idEditorBrush* b = NULL;
entity_t* e = NULL; idEditorEntity* e = NULL;
b = selected_brushes.next; b = selected_brushes.next;
if (b == &selected_brushes) if (b == &selected_brushes)
@@ -7943,7 +7943,7 @@ void CMainFrame::OnGenerateMaterialsList()
Sys_BeginWait(); Sys_BeginWait();
common->Printf("Generating list of active materials...\n"); common->Printf("Generating list of active materials...\n");
for (brush_t* b = active_brushes.next; b != &active_brushes; b = b->next) { for (idEditorBrush* b = active_brushes.next; b != &active_brushes; b = b->next) {
if (b->pPatch) { if (b->pPatch) {
mtrName = b->pPatch->d_texture->GetName(); mtrName = b->pPatch->d_texture->GetName();
if (!mtrList.Find(mtrName)) { if (!mtrList.Find(mtrName)) {
+2 -2
View File
@@ -81,7 +81,7 @@ BOOL CMapInfo::OnInitDialog()
m_nTotalBrushes = 0; m_nTotalBrushes = 0;
m_nTotalEntities = 0; m_nTotalEntities = 0;
m_nNet = 0; m_nNet = 0;
for (brush_t* pBrush=active_brushes.next ; pBrush != &active_brushes ; pBrush=pBrush->next) for (idEditorBrush* pBrush=active_brushes.next ; pBrush != &active_brushes ; pBrush=pBrush->next)
{ {
m_nTotalBrushes++; m_nTotalBrushes++;
if (pBrush->owner == world_entity) if (pBrush->owner == world_entity)
@@ -92,7 +92,7 @@ BOOL CMapInfo::OnInitDialog()
CMapStringToPtr mapEntity; CMapStringToPtr mapEntity;
int nValue = 0; int nValue = 0;
for (entity_t* pEntity=entities.next ; pEntity != &entities ; pEntity=pEntity->next) for (idEditorEntity* pEntity=entities.next ; pEntity != &entities ; pEntity=pEntity->next)
{ {
m_nTotalEntities++; m_nTotalEntities++;
nValue = 0; nValue = 0;
+1 -1
View File
@@ -736,7 +736,7 @@ const idMaterial *Texture_ForName(const char *name) {
void Texture_ShowInuse(void) { void Texture_ShowInuse(void) {
Texture_HideAll(); Texture_HideAll();
brush_t *b; idEditorBrush *b;
for (b = active_brushes.next; b != NULL && b != &active_brushes; b = b->next) { for (b = active_brushes.next; b != NULL && b != &active_brushes; b = b->next) {
if (b->pPatch) { if (b->pPatch) {
Texture_ForName(b->pPatch->d_texture->GetName()); Texture_ForName(b->pPatch->d_texture->GetName());
+57 -57
View File
@@ -244,8 +244,8 @@ static const int OUTLINER_GAP = 6;
static CPtrArray s_outlinerHiddenEntities; static CPtrArray s_outlinerHiddenEntities;
static CString s_outlinerVisibilityMapName; static CString s_outlinerVisibilityMapName;
static entity_t* s_outlinerVisibilityWorldEntity = NULL; static idEditorEntity* s_outlinerVisibilityWorldEntity = NULL;
static entity_t* s_outlinerVisibilityFirstEntity = NULL; static idEditorEntity* s_outlinerVisibilityFirstEntity = NULL;
static int s_outlinerVisibilityEntityCount = -1; static int s_outlinerVisibilityEntityCount = -1;
static int s_outlinerVisibilityMapModified = -999999; static int s_outlinerVisibilityMapModified = -999999;
static bool s_outlinerVisibilityInitialized = false; static bool s_outlinerVisibilityInitialized = false;
@@ -254,16 +254,16 @@ static const char* Outliner_CurrentMapName() {
return currentmap ? currentmap : ""; return currentmap ? currentmap : "";
} }
static entity_t* Outliner_FirstMapEntity() { static idEditorEntity* Outliner_FirstMapEntity() {
if (entities.next != NULL && entities.next != &entities) { if (entities.next != NULL && entities.next != &entities) {
return entities.next; return entities.next;
} }
return NULL; return NULL;
} }
static bool Outliner_ArrayContainsPtr(const CPtrArray& array, entity_t* ent) { static bool Outliner_ArrayContainsPtr(const CPtrArray& array, idEditorEntity* ent) {
for (int i = 0; i < array.GetSize(); i++) { for (int i = 0; i < array.GetSize(); i++) {
if ((entity_t*)array.GetAt(i) == ent) { if ((idEditorEntity*)array.GetAt(i) == ent) {
return true; return true;
} }
} }
@@ -290,7 +290,7 @@ void Outliner_ResetEntityVisibility() {
static void Outliner_EnsureVisibilityMap() { static void Outliner_EnsureVisibilityMap() {
const char* mapName = Outliner_CurrentMapName(); const char* mapName = Outliner_CurrentMapName();
const entity_t* firstEntity = Outliner_FirstMapEntity(); const idEditorEntity* firstEntity = Outliner_FirstMapEntity();
bool resetVisibility = false; bool resetVisibility = false;
if (!s_outlinerVisibilityInitialized) { if (!s_outlinerVisibilityInitialized) {
@@ -321,9 +321,9 @@ static void Outliner_EnsureVisibilityMap() {
Outliner_SyncVisibilityMapIdentity(); Outliner_SyncVisibilityMapIdentity();
} }
static int Outliner_FindHiddenEntity(entity_t* ent) { static int Outliner_FindHiddenEntity(idEditorEntity* ent) {
for (int i = 0; i < s_outlinerHiddenEntities.GetSize(); i++) { for (int i = 0; i < s_outlinerHiddenEntities.GetSize(); i++) {
if ((entity_t*)s_outlinerHiddenEntities.GetAt(i) == ent) { if ((idEditorEntity*)s_outlinerHiddenEntities.GetAt(i) == ent) {
return i; return i;
} }
} }
@@ -334,14 +334,14 @@ static void Outliner_PruneHiddenEntities(const CPtrArray& currentEntities) {
Outliner_EnsureVisibilityMap(); Outliner_EnsureVisibilityMap();
for (int i = s_outlinerHiddenEntities.GetSize() - 1; i >= 0; i--) { for (int i = s_outlinerHiddenEntities.GetSize() - 1; i >= 0; i--) {
entity_t* ent = (entity_t*)s_outlinerHiddenEntities.GetAt(i); idEditorEntity* ent = (idEditorEntity*)s_outlinerHiddenEntities.GetAt(i);
if (!Outliner_ArrayContainsPtr(currentEntities, ent)) { if (!Outliner_ArrayContainsPtr(currentEntities, ent)) {
s_outlinerHiddenEntities.RemoveAt(i); s_outlinerHiddenEntities.RemoveAt(i);
} }
} }
} }
bool Outliner_IsEntityVisible(entity_t* ent) { bool Outliner_IsEntityVisible(idEditorEntity* ent) {
if (ent == NULL) { if (ent == NULL) {
return true; return true;
} }
@@ -355,11 +355,11 @@ bool Outliner_HasHiddenEntities() {
return s_outlinerHiddenEntities.GetSize() > 0; return s_outlinerHiddenEntities.GetSize() > 0;
} }
bool Outliner_IsEntityLinkVisible(entity_t* source, entity_t* target) { bool Outliner_IsEntityLinkVisible(idEditorEntity* source, idEditorEntity* target) {
return Outliner_IsEntityVisible(source) && Outliner_IsEntityVisible(target); return Outliner_IsEntityVisible(source) && Outliner_IsEntityVisible(target);
} }
void Outliner_SetEntityVisible(entity_t* ent, bool visible) { void Outliner_SetEntityVisible(idEditorEntity* ent, bool visible) {
if (ent == NULL) { if (ent == NULL) {
return; return;
} }
@@ -648,7 +648,7 @@ BOOL COutlinerDlg::PreTranslateMessage(MSG* pMsg) {
} }
if (pMsg->wParam == VK_SPACE && pMsg->hwnd == m_tree.GetSafeHwnd()) { if (pMsg->wParam == VK_SPACE && pMsg->hwnd == m_tree.GetSafeHwnd()) {
entity_t* ent = SelectedEntity(); idEditorEntity* ent = SelectedEntity();
if (ent != NULL) { if (ent != NULL) {
ToggleEntityVisibility(ent, false); ToggleEntityVisibility(ent, false);
return TRUE; return TRUE;
@@ -703,7 +703,7 @@ void COutlinerDlg::Refresh(bool force) {
return; return;
} }
entity_t* oldSelection = SelectedEntity(); idEditorEntity* oldSelection = SelectedEntity();
const char* mapName = Outliner_CurrentMapName(); const char* mapName = Outliner_CurrentMapName();
const bool hadPreviousRefresh = (m_lastMapModified != -999999); const bool hadPreviousRefresh = (m_lastMapModified != -999999);
@@ -739,7 +739,7 @@ void COutlinerDlg::Refresh(bool force) {
for (int i = 0; i < m_entities.GetSize(); i++) { for (int i = 0; i < m_entities.GetSize(); i++) {
if (m_incoming.GetAt(i) == 0) { if (m_incoming.GetAt(i) == 0) {
CPtrArray stack; CPtrArray stack;
HTREEITEM item = InsertEntityRecursive((entity_t*)m_entities.GetAt(i), TVI_ROOT, stack); HTREEITEM item = InsertEntityRecursive((idEditorEntity*)m_entities.GetAt(i), TVI_ROOT, stack);
if (item != NULL) { if (item != NULL) {
insertedAny = true; insertedAny = true;
} }
@@ -752,7 +752,7 @@ void COutlinerDlg::Refresh(bool force) {
continue; continue;
} }
entity_t* ent = (entity_t*)m_entities.GetAt(i); idEditorEntity* ent = (idEditorEntity*)m_entities.GetAt(i);
if (!m_filterText.IsEmpty()) { if (!m_filterText.IsEmpty()) {
CPtrArray filterStack; CPtrArray filterStack;
if (!EntityOrDescendantMatches(ent, filterStack)) { if (!EntityOrDescendantMatches(ent, filterStack)) {
@@ -823,13 +823,13 @@ void COutlinerDlg::BuildGraph() {
} }
if (entities.next != NULL) { if (entities.next != NULL) {
for (entity_t* ent = entities.next; ent != &entities; ent = ent->next) { for (idEditorEntity* ent = entities.next; ent != &entities; ent = ent->next) {
AddEntityNode(ent); AddEntityNode(ent);
} }
} }
for (int i = 0; i < m_entities.GetSize(); i++) { for (int i = 0; i < m_entities.GetSize(); i++) {
entity_t* source = (entity_t*)m_entities.GetAt(i); idEditorEntity* source = (idEditorEntity*)m_entities.GetAt(i);
if (source == NULL) { if (source == NULL) {
continue; continue;
} }
@@ -855,13 +855,13 @@ void COutlinerDlg::BuildGraph() {
continue; continue;
} }
entity_t* target = (entity_t*)m_entities.GetAt(targetIndex); idEditorEntity* target = (idEditorEntity*)m_entities.GetAt(targetIndex);
AddEdge(source, target); AddEdge(source, target);
} }
} }
} }
void COutlinerDlg::AddEntityNode(entity_t* ent) { void COutlinerDlg::AddEntityNode(idEditorEntity* ent) {
if (ent == NULL) { if (ent == NULL) {
return; return;
} }
@@ -875,7 +875,7 @@ void COutlinerDlg::AddEntityNode(entity_t* ent) {
m_covered.Add(FALSE); m_covered.Add(FALSE);
} }
void COutlinerDlg::AddEdge(entity_t* source, entity_t* target) { void COutlinerDlg::AddEdge(idEditorEntity* source, idEditorEntity* target) {
if (source == NULL || target == NULL) { if (source == NULL || target == NULL) {
return; return;
} }
@@ -895,7 +895,7 @@ void COutlinerDlg::AddEdge(entity_t* source, entity_t* target) {
} }
} }
bool COutlinerDlg::HasEdge(entity_t* source, entity_t* target) const { bool COutlinerDlg::HasEdge(idEditorEntity* source, idEditorEntity* target) const {
for (int i = 0; i < m_edges.GetSize(); i++) { for (int i = 0; i < m_edges.GetSize(); i++) {
const outlinerEdge_t& edge = m_edges.GetAt(i); const outlinerEdge_t& edge = m_edges.GetAt(i);
if (edge.source == source && edge.target == target) { if (edge.source == source && edge.target == target) {
@@ -905,9 +905,9 @@ bool COutlinerDlg::HasEdge(entity_t* source, entity_t* target) const {
return false; return false;
} }
int COutlinerDlg::FindNode(entity_t* ent) const { int COutlinerDlg::FindNode(idEditorEntity* ent) const {
for (int i = 0; i < m_entities.GetSize(); i++) { for (int i = 0; i < m_entities.GetSize(); i++) {
if ((entity_t*)m_entities.GetAt(i) == ent) { if ((idEditorEntity*)m_entities.GetAt(i) == ent) {
return i; return i;
} }
} }
@@ -920,18 +920,18 @@ int COutlinerDlg::FindNodeByName(const char* name) const {
} }
for (int i = 0; i < m_entities.GetSize(); i++) { for (int i = 0; i < m_entities.GetSize(); i++) {
entity_t* ent = (entity_t*)m_entities.GetAt(i); idEditorEntity* ent = (idEditorEntity*)m_entities.GetAt(i);
if (ent == NULL) { if (ent == NULL) {
continue; continue;
} }
const char* entName = ValueForKey(ent, "name"); const char* entName = ent->ValueForKey("name");
if (entName != NULL && entName[0] != '\0' && idStr::Icmp(entName, name) == 0) { if (entName != NULL && entName[0] != '\0' && idStr::Icmp(entName, name) == 0) {
return i; return i;
} }
// Support old/ported maps that still use targetname, but do not require it. // Support old/ported maps that still use targetname, but do not require it.
const char* targetName = ValueForKey(ent, "targetname"); const char* targetName = ent->ValueForKey("targetname");
if (targetName != NULL && targetName[0] != '\0' && idStr::Icmp(targetName, name) == 0) { if (targetName != NULL && targetName[0] != '\0' && idStr::Icmp(targetName, name) == 0) {
return i; return i;
} }
@@ -964,7 +964,7 @@ void COutlinerDlg::ClearItemData() {
m_itemData.RemoveAll(); m_itemData.RemoveAll();
} }
COutlinerDlg::outlinerItemData_t* COutlinerDlg::AllocItemData(entity_t* ent, bool cycleRef) { COutlinerDlg::outlinerItemData_t* COutlinerDlg::AllocItemData(idEditorEntity* ent, bool cycleRef) {
outlinerItemData_t* data = new outlinerItemData_t; outlinerItemData_t* data = new outlinerItemData_t;
data->entity = ent; data->entity = ent;
data->cycleRef = cycleRef; data->cycleRef = cycleRef;
@@ -972,7 +972,7 @@ COutlinerDlg::outlinerItemData_t* COutlinerDlg::AllocItemData(entity_t* ent, boo
return data; return data;
} }
entity_t* COutlinerDlg::EntityFromItem(HTREEITEM item) const { idEditorEntity* COutlinerDlg::EntityFromItem(HTREEITEM item) const {
if (item == NULL || !m_tree.GetSafeHwnd()) { if (item == NULL || !m_tree.GetSafeHwnd()) {
return NULL; return NULL;
} }
@@ -985,7 +985,7 @@ entity_t* COutlinerDlg::EntityFromItem(HTREEITEM item) const {
return data->entity; return data->entity;
} }
entity_t* COutlinerDlg::SelectedEntity() const { idEditorEntity* COutlinerDlg::SelectedEntity() const {
if (!m_tree.GetSafeHwnd()) { if (!m_tree.GetSafeHwnd()) {
return NULL; return NULL;
} }
@@ -993,15 +993,15 @@ entity_t* COutlinerDlg::SelectedEntity() const {
return EntityFromItem(m_tree.GetSelectedItem()); return EntityFromItem(m_tree.GetSelectedItem());
} }
CString COutlinerDlg::EntityDisplayName(entity_t* ent) const { CString COutlinerDlg::EntityDisplayName(idEditorEntity* ent) const {
CString text; CString text;
if (ent == NULL) { if (ent == NULL) {
return "<null entity>"; return "<null entity>";
} }
const char* classname = ValueForKey(ent, "classname"); const char* classname = ent->ValueForKey("classname");
const char* name = ValueForKey(ent, "name"); const char* name = ent->ValueForKey("name");
if (ent == world_entity) { if (ent == world_entity) {
text = "worldspawn"; text = "worldspawn";
@@ -1023,7 +1023,7 @@ CString COutlinerDlg::EntityDisplayName(entity_t* ent) const {
return text; return text;
} }
bool COutlinerDlg::EntityMatchesFilter(entity_t* ent) const { bool COutlinerDlg::EntityMatchesFilter(idEditorEntity* ent) const {
if (m_filterText.IsEmpty()) { if (m_filterText.IsEmpty()) {
return true; return true;
} }
@@ -1033,13 +1033,13 @@ bool COutlinerDlg::EntityMatchesFilter(entity_t* ent) const {
} }
CString haystack; CString haystack;
const char* name = ValueForKey(ent, "name"); const char* name = ent->ValueForKey("name");
if (name != NULL && name[0] != '\0') { if (name != NULL && name[0] != '\0') {
haystack = name; haystack = name;
} else if (ent == world_entity) { } else if (ent == world_entity) {
haystack = "worldspawn"; haystack = "worldspawn";
} else { } else {
const char* classname = ValueForKey(ent, "classname"); const char* classname = ent->ValueForKey("classname");
haystack = (classname != NULL) ? classname : ""; haystack = (classname != NULL) ? classname : "";
} }
@@ -1050,7 +1050,7 @@ bool COutlinerDlg::EntityMatchesFilter(entity_t* ent) const {
return haystack.Find(needle) >= 0; return haystack.Find(needle) >= 0;
} }
bool COutlinerDlg::EntityOrDescendantMatches(entity_t* ent, CPtrArray& stack) const { bool COutlinerDlg::EntityOrDescendantMatches(idEditorEntity* ent, CPtrArray& stack) const {
if (m_filterText.IsEmpty()) { if (m_filterText.IsEmpty()) {
return true; return true;
} }
@@ -1082,16 +1082,16 @@ bool COutlinerDlg::EntityOrDescendantMatches(entity_t* ent, CPtrArray& stack) co
return matches; return matches;
} }
bool COutlinerDlg::ArrayContains(const CPtrArray& array, entity_t* ent) const { bool COutlinerDlg::ArrayContains(const CPtrArray& array, idEditorEntity* ent) const {
for (int i = 0; i < array.GetSize(); i++) { for (int i = 0; i < array.GetSize(); i++) {
if ((entity_t*)array.GetAt(i) == ent) { if ((idEditorEntity*)array.GetAt(i) == ent) {
return true; return true;
} }
} }
return false; return false;
} }
HTREEITEM COutlinerDlg::InsertEntityRecursive(entity_t* ent, HTREEITEM parent, CPtrArray& stack) { HTREEITEM COutlinerDlg::InsertEntityRecursive(idEditorEntity* ent, HTREEITEM parent, CPtrArray& stack) {
if (ent == NULL) { if (ent == NULL) {
return NULL; return NULL;
} }
@@ -1141,7 +1141,7 @@ HTREEITEM COutlinerDlg::InsertEntityRecursive(entity_t* ent, HTREEITEM parent, C
return item; return item;
} }
HTREEITEM COutlinerDlg::FindTreeItemForEntity(entity_t* ent, HTREEITEM start) const { HTREEITEM COutlinerDlg::FindTreeItemForEntity(idEditorEntity* ent, HTREEITEM start) const {
HTREEITEM item = start; HTREEITEM item = start;
while (item != NULL) { while (item != NULL) {
if (EntityFromItem(item) == ent) { if (EntityFromItem(item) == ent) {
@@ -1204,7 +1204,7 @@ LRESULT COutlinerDlg::OnApplyTreeCheck(WPARAM wParam, LPARAM lParam) {
return 0; return 0;
} }
entity_t* ent = EntityFromItem(item); idEditorEntity* ent = EntityFromItem(item);
if (ent == NULL) { if (ent == NULL) {
return 0; return 0;
} }
@@ -1216,7 +1216,7 @@ LRESULT COutlinerDlg::OnApplyTreeCheck(WPARAM wParam, LPARAM lParam) {
return 0; return 0;
} }
void COutlinerDlg::CollectEntityAndChildren(entity_t* ent, CPtrArray& out, CPtrArray& stack) const { void COutlinerDlg::CollectEntityAndChildren(idEditorEntity* ent, CPtrArray& out, CPtrArray& stack) const {
if (ent == NULL) { if (ent == NULL) {
return; return;
} }
@@ -1245,7 +1245,7 @@ void COutlinerDlg::CollectEntityAndChildren(entity_t* ent, CPtrArray& out, CPtrA
stack.RemoveAt(stack.GetSize() - 1); stack.RemoveAt(stack.GetSize() - 1);
} }
void COutlinerDlg::SetEntityVisibility(entity_t* ent, bool visible, bool includeChildren) { void COutlinerDlg::SetEntityVisibility(idEditorEntity* ent, bool visible, bool includeChildren) {
if (ent == NULL) { if (ent == NULL) {
return; return;
} }
@@ -1257,7 +1257,7 @@ void COutlinerDlg::SetEntityVisibility(entity_t* ent, bool visible, bool include
CollectEntityAndChildren(ent, entitiesToChange, stack); CollectEntityAndChildren(ent, entitiesToChange, stack);
for (int i = 0; i < entitiesToChange.GetSize(); i++) { for (int i = 0; i < entitiesToChange.GetSize(); i++) {
Outliner_SetEntityVisible((entity_t*)entitiesToChange.GetAt(i), visible); Outliner_SetEntityVisible((idEditorEntity*)entitiesToChange.GetAt(i), visible);
} }
} }
else { else {
@@ -1267,7 +1267,7 @@ void COutlinerDlg::SetEntityVisibility(entity_t* ent, bool visible, bool include
ApplyVisibilityChange(); ApplyVisibilityChange();
} }
void COutlinerDlg::ToggleEntityVisibility(entity_t* ent, bool includeChildren) { void COutlinerDlg::ToggleEntityVisibility(idEditorEntity* ent, bool includeChildren) {
if (ent == NULL) { if (ent == NULL) {
return; return;
} }
@@ -1276,7 +1276,7 @@ void COutlinerDlg::ToggleEntityVisibility(entity_t* ent, bool includeChildren) {
SetEntityVisibility(ent, newVisible, includeChildren); SetEntityVisibility(ent, newVisible, includeChildren);
} }
void COutlinerDlg::ShowOnlyEntityAndChildren(entity_t* ent) { void COutlinerDlg::ShowOnlyEntityAndChildren(idEditorEntity* ent) {
if (ent == NULL) { if (ent == NULL) {
return; return;
} }
@@ -1287,7 +1287,7 @@ void COutlinerDlg::ShowOnlyEntityAndChildren(entity_t* ent) {
CollectEntityAndChildren(ent, keepVisible, stack); CollectEntityAndChildren(ent, keepVisible, stack);
for (int i = 0; i < m_entities.GetSize(); i++) { for (int i = 0; i < m_entities.GetSize(); i++) {
entity_t* candidate = (entity_t*)m_entities.GetAt(i); idEditorEntity* candidate = (idEditorEntity*)m_entities.GetAt(i);
if (i == 0) if (i == 0)
{ {
Outliner_SetEntityVisible(candidate, true); Outliner_SetEntityVisible(candidate, true);
@@ -1307,7 +1307,7 @@ void COutlinerDlg::ShowAllEntities() {
void COutlinerDlg::UpdateAllCheckmarks(HTREEITEM start) { void COutlinerDlg::UpdateAllCheckmarks(HTREEITEM start) {
HTREEITEM item = start; HTREEITEM item = start;
while (item != NULL) { while (item != NULL) {
entity_t* ent = EntityFromItem(item); idEditorEntity* ent = EntityFromItem(item);
if (ent != NULL) { if (ent != NULL) {
m_tree.SetCheck(item, Outliner_IsEntityVisible(ent) ? TRUE : FALSE); m_tree.SetCheck(item, Outliner_IsEntityVisible(ent) ? TRUE : FALSE);
} }
@@ -1352,7 +1352,7 @@ void COutlinerDlg::OnTreeRightClick(NMHDR* pNMHDR, LRESULT* pResult) {
m_tree.SelectItem(item); m_tree.SelectItem(item);
} }
entity_t* ent = SelectedEntity(); idEditorEntity* ent = SelectedEntity();
const bool entVisible = Outliner_IsEntityVisible(ent); const bool entVisible = Outliner_IsEntityVisible(ent);
CString toggleSelfText; CString toggleSelfText;
@@ -1408,7 +1408,7 @@ void COutlinerDlg::OnTreeRightClick(NMHDR* pNMHDR, LRESULT* pResult) {
*pResult = 0; *pResult = 0;
} }
void COutlinerDlg::SelectEntityInMap(entity_t* ent, bool updateInspector) { void COutlinerDlg::SelectEntityInMap(idEditorEntity* ent, bool updateInspector) {
if (ent == NULL) { if (ent == NULL) {
return; return;
} }
@@ -1416,7 +1416,7 @@ void COutlinerDlg::SelectEntityInMap(entity_t* ent, bool updateInspector) {
Select_Deselect(); Select_Deselect();
if (ent != world_entity) { if (ent != world_entity) {
brush_t* firstBrush = ent->brushes.onext; idEditorBrush* firstBrush = ent->brushes.onext;
if (firstBrush != NULL && firstBrush != &ent->brushes) { if (firstBrush != NULL && firstBrush != &ent->brushes) {
Select_Brush(firstBrush, true, true); Select_Brush(firstBrush, true, true);
} }
@@ -1433,7 +1433,7 @@ void COutlinerDlg::SelectEntityInMap(entity_t* ent, bool updateInspector) {
Sys_UpdateWindows(W_ALL); Sys_UpdateWindows(W_ALL);
} }
void COutlinerDlg::OpenEntityProperties(entity_t* ent) { void COutlinerDlg::OpenEntityProperties(idEditorEntity* ent) {
if (ent == NULL || g_Inspectors == NULL) { if (ent == NULL || g_Inspectors == NULL) {
return; return;
} }
@@ -1442,12 +1442,12 @@ void COutlinerDlg::OpenEntityProperties(entity_t* ent) {
g_Inspectors->SetMode(W_ENTITY); g_Inspectors->SetMode(W_ENTITY);
} }
bool COutlinerDlg::GetEntityCenter(entity_t* ent, idVec3& center) const { bool COutlinerDlg::GetEntityCenter(idEditorEntity* ent, idVec3& center) const {
if (ent == NULL) { if (ent == NULL) {
return false; return false;
} }
if (GetVectorForKey(ent, "origin", center)) { if (ent->GetVectorForKey("origin", center)) {
return true; return true;
} }
@@ -1455,7 +1455,7 @@ bool COutlinerDlg::GetEntityCenter(entity_t* ent, idVec3& center) const {
bounds.Clear(); bounds.Clear();
bool haveBounds = false; bool haveBounds = false;
for (brush_t* b = ent->brushes.onext; b != NULL && b != &ent->brushes; b = b->onext) { for (idEditorBrush* b = ent->brushes.onext; b != NULL && b != &ent->brushes; b = b->onext) {
bounds.AddPoint(b->mins); bounds.AddPoint(b->mins);
bounds.AddPoint(b->maxs); bounds.AddPoint(b->maxs);
haveBounds = true; haveBounds = true;
@@ -1470,7 +1470,7 @@ bool COutlinerDlg::GetEntityCenter(entity_t* ent, idVec3& center) const {
return false; return false;
} }
void COutlinerDlg::MoveToEntity(entity_t* ent) { void COutlinerDlg::MoveToEntity(idEditorEntity* ent) {
if (ent == NULL || g_pParentWnd == NULL) { if (ent == NULL || g_pParentWnd == NULL) {
return; return;
} }
+29 -30
View File
@@ -27,8 +27,7 @@ along with IceTech Source Code. If not, see <http://www.gnu.org/licenses/>.
#include "afxcmn.h" #include "afxcmn.h"
#include "afxtempl.h" #include "afxtempl.h"
struct entity_s; class idEditorEntity;
typedef struct entity_s entity_t;
class idVec3; class idVec3;
class COutlinerDlg : public CWnd { class COutlinerDlg : public CWnd {
@@ -59,9 +58,9 @@ public:
void Refresh(bool force = false); void Refresh(bool force = false);
void RefreshIfNeeded(); void RefreshIfNeeded();
void OpenEntityProperties(entity_t* ent); void OpenEntityProperties(idEditorEntity* ent);
void MoveToEntity(entity_t* ent); void MoveToEntity(idEditorEntity* ent);
void SelectEntityInMap(entity_t* ent, bool updateInspector = false); void SelectEntityInMap(idEditorEntity* ent, bool updateInspector = false);
protected: protected:
DECLARE_MESSAGE_MAP() DECLARE_MESSAGE_MAP()
@@ -84,12 +83,12 @@ protected:
private: private:
struct outlinerEdge_t { struct outlinerEdge_t {
entity_t* source; idEditorEntity* source;
entity_t* target; idEditorEntity* target;
}; };
struct outlinerItemData_t { struct outlinerItemData_t {
entity_t* entity; idEditorEntity* entity;
bool cycleRef; bool cycleRef;
}; };
@@ -111,45 +110,45 @@ private:
CString m_lastMapName; CString m_lastMapName;
int m_lastMapModified; int m_lastMapModified;
int m_lastEntityCount; int m_lastEntityCount;
entity_t* m_lastWorldEntity; idEditorEntity* m_lastWorldEntity;
void BuildGraph(); void BuildGraph();
void AddEntityNode(entity_t* ent); void AddEntityNode(idEditorEntity* ent);
void AddEdge(entity_t* source, entity_t* target); void AddEdge(idEditorEntity* source, idEditorEntity* target);
bool HasEdge(entity_t* source, entity_t* target) const; bool HasEdge(idEditorEntity* source, idEditorEntity* target) const;
int FindNode(entity_t* ent) const; int FindNode(idEditorEntity* ent) const;
int FindNodeByName(const char* name) const; int FindNodeByName(const char* name) const;
bool IsTargetKey(const char* key) const; bool IsTargetKey(const char* key) const;
void ClearItemData(); void ClearItemData();
outlinerItemData_t* AllocItemData(entity_t* ent, bool cycleRef); outlinerItemData_t* AllocItemData(idEditorEntity* ent, bool cycleRef);
entity_t* EntityFromItem(HTREEITEM item) const; idEditorEntity* EntityFromItem(HTREEITEM item) const;
entity_t* SelectedEntity() const; idEditorEntity* SelectedEntity() const;
CString EntityDisplayName(entity_t* ent) const; CString EntityDisplayName(idEditorEntity* ent) const;
bool EntityMatchesFilter(entity_t* ent) const; bool EntityMatchesFilter(idEditorEntity* ent) const;
bool EntityOrDescendantMatches(entity_t* ent, CPtrArray& stack) const; bool EntityOrDescendantMatches(idEditorEntity* ent, CPtrArray& stack) const;
bool ArrayContains(const CPtrArray& array, entity_t* ent) const; bool ArrayContains(const CPtrArray& array, idEditorEntity* ent) const;
HTREEITEM InsertEntityRecursive(entity_t* ent, HTREEITEM parent, CPtrArray& stack); HTREEITEM InsertEntityRecursive(idEditorEntity* ent, HTREEITEM parent, CPtrArray& stack);
HTREEITEM FindTreeItemForEntity(entity_t* ent, HTREEITEM start) const; HTREEITEM FindTreeItemForEntity(idEditorEntity* ent, HTREEITEM start) const;
void ExpandAll(HTREEITEM start); void ExpandAll(HTREEITEM start);
void CollectEntityAndChildren(entity_t* ent, CPtrArray& out, CPtrArray& stack) const; void CollectEntityAndChildren(idEditorEntity* ent, CPtrArray& out, CPtrArray& stack) const;
void SetEntityVisibility(entity_t* ent, bool visible, bool includeChildren); void SetEntityVisibility(idEditorEntity* ent, bool visible, bool includeChildren);
void ToggleEntityVisibility(entity_t* ent, bool includeChildren); void ToggleEntityVisibility(idEditorEntity* ent, bool includeChildren);
void ShowOnlyEntityAndChildren(entity_t* ent); void ShowOnlyEntityAndChildren(idEditorEntity* ent);
void ShowAllEntities(); void ShowAllEntities();
void UpdateAllCheckmarks(HTREEITEM start); void UpdateAllCheckmarks(HTREEITEM start);
void ApplyVisibilityChange(); void ApplyVisibilityChange();
bool NeedsRefresh() const; bool NeedsRefresh() const;
bool GetEntityCenter(entity_t* ent, idVec3& center) const; bool GetEntityCenter(idEditorEntity* ent, idVec3& center) const;
void ApplyFont(); void ApplyFont();
}; };
bool Outliner_IsEntityVisible(entity_t* ent); bool Outliner_IsEntityVisible(idEditorEntity* ent);
void Outliner_SetEntityVisible(entity_t* ent, bool visible); void Outliner_SetEntityVisible(idEditorEntity* ent, bool visible);
void Outliner_ResetEntityVisibility(); void Outliner_ResetEntityVisibility();
bool Outliner_HasHiddenEntities(); bool Outliner_HasHiddenEntities();
bool Outliner_IsEntityLinkVisible(entity_t* source, entity_t* target); bool Outliner_IsEntityLinkVisible(idEditorEntity* source, idEditorEntity* target);
+84 -83
View File
@@ -813,7 +813,8 @@ void Patch_CalcBounds( patchMesh_t *p,idVec3 &vMin,idVec3 &vMax ) {
Brush_RebuildBrush Brush_RebuildBrush
================== ==================
*/ */
void Brush_RebuildBrush( brush_t *b,idVec3 vMins,idVec3 vMaxs,bool patch ) { void idEditorBrush::Brush_RebuildBrush(idVec3 vMins,idVec3 vMaxs,bool patch ) {
idEditorBrush *b = this;
// //
// Total hack job // Total hack job
// Rebuilds a brush // Rebuilds a brush
@@ -898,13 +899,13 @@ void Brush_RebuildBrush( brush_t *b,idVec3 vMins,idVec3 vMaxs,bool patch ) {
VectorCopy(pts[1][0], f->planepts[1]); VectorCopy(pts[1][0], f->planepts[1]);
VectorCopy(pts[0][0], f->planepts[2]); VectorCopy(pts[0][0], f->planepts[2]);
Brush_Build(b); b->Brush_Build();
} }
void WINAPI Patch_Rebuild( patchMesh_t *p ) { void WINAPI Patch_Rebuild( patchMesh_t *p ) {
idVec3 vMin, vMax; idVec3 vMin, vMax;
Patch_CalcBounds(p, vMin, vMax); Patch_CalcBounds(p, vMin, vMax);
Brush_RebuildBrush(p->pSymbiot, vMin, vMax); p->pSymbiot->Brush_RebuildBrush(vMin, vMax);
Patch_MakeDirty(p); Patch_MakeDirty(p);
} }
@@ -914,7 +915,7 @@ AddBrushForPatch
================== ==================
adds a patch brush and ties it to this patch id adds a patch brush and ties it to this patch id
*/ */
brush_t * AddBrushForPatch( patchMesh_t *pm,bool bLinkToWorld ) { idEditorBrush * AddBrushForPatch( patchMesh_t *pm,bool bLinkToWorld ) {
// find the farthest points in x,y,z // find the farthest points in x,y,z
idVec3 vMin, vMax; idVec3 vMin, vMax;
Patch_CalcBounds(pm, vMin, vMax); Patch_CalcBounds(pm, vMin, vMax);
@@ -928,8 +929,8 @@ brush_t * AddBrushForPatch( patchMesh_t *pm,bool bLinkToWorld ) {
texdef_t td; texdef_t td;
//td.SetName(pm->d_texture->getName()); //td.SetName(pm->d_texture->getName());
brush_t *b = Brush_Create(vMin, vMax, &td); idEditorBrush *b = Brush_Create(vMin, vMax, &td);
//brush_t *b = Brush_Create(vMin, vMax, &g_qeglobals.d_texturewin.texdef); //idEditorBrush *b = Brush_Create(vMin, vMax, &g_qeglobals.d_texturewin.texdef);
// FIXME: this entire type of linkage needs to be fixed // FIXME: this entire type of linkage needs to be fixed
b->pPatch = pm; b->pPatch = pm;
@@ -940,9 +941,9 @@ brush_t * AddBrushForPatch( patchMesh_t *pm,bool bLinkToWorld ) {
pm->nListIDCam = -1; pm->nListIDCam = -1;
if ( bLinkToWorld ) { if ( bLinkToWorld ) {
Brush_AddToList(b, &active_brushes); b->Brush_AddToList(&active_brushes);
Entity_LinkBrush(world_entity, b); world_entity->Entity_LinkBrush(b);
Brush_Build(b); b->Brush_Build();
} }
return b; return b;
@@ -1119,7 +1120,7 @@ int Interior5ByCount = sizeof(Interior5By) / sizeof(int[2]);
face_t * Patch_GetAxisFace( patchMesh_t *p ) { face_t * Patch_GetAxisFace( patchMesh_t *p ) {
face_t *f = NULL; face_t *f = NULL;
idVec3 vTemp; idVec3 vTemp;
brush_t *b = p->pSymbiot; idEditorBrush *b = p->pSymbiot;
for ( f = b->brush_faces ; f ; f = f->next ) { for ( f = b->brush_faces ; f ; f = f->next ) {
vTemp = (*f->face_winding)[1].ToVec3() - (*f->face_winding)[0].ToVec3(); vTemp = (*f->face_winding)[1].ToVec3() - (*f->face_winding)[0].ToVec3();
@@ -1146,7 +1147,7 @@ face_t * Patch_GetAxisFace( patchMesh_t *p ) {
int g_nFaceCycle = 0; int g_nFaceCycle = 0;
face_t * nextFace( patchMesh_t *p ) { face_t * nextFace( patchMesh_t *p ) {
brush_t *b = p->pSymbiot; idEditorBrush *b = p->pSymbiot;
face_t *f = NULL; face_t *f = NULL;
int n = 0; int n = 0;
for ( f = b->brush_faces ; f && n <= g_nFaceCycle; f = f->next ) { for ( f = b->brush_faces ; f && n <= g_nFaceCycle; f = f->next ) {
@@ -1215,8 +1216,8 @@ void FillPatch( patchMesh_t *p,idVec3 v ) {
} }
} }
brush_t * Cap( patchMesh_t *pParent,bool bByColumn,bool bFirst ) { idEditorBrush * Cap( patchMesh_t *pParent,bool bByColumn,bool bFirst ) {
brush_t *b; idEditorBrush *b;
patchMesh_t *p; patchMesh_t *p;
idVec3 vMin, vMax; idVec3 vMin, vMax;
int i, j; int i, j;
@@ -1302,8 +1303,8 @@ brush_t * Cap( patchMesh_t *pParent,bool bByColumn,bool bFirst ) {
return p->pSymbiot; return p->pSymbiot;
} }
brush_t * CapSpecial( patchMesh_t *pParent,int nType,bool bFirst ) { idEditorBrush * CapSpecial( patchMesh_t *pParent,int nType,bool bFirst ) {
brush_t *b; idEditorBrush *b;
patchMesh_t *p; patchMesh_t *p;
idVec3 vMin, vMax, vTemp; idVec3 vMin, vMax, vTemp;
int i, j; int i, j;
@@ -1422,7 +1423,7 @@ brush_t * CapSpecial( patchMesh_t *pParent,int nType,bool bFirst ) {
} }
//--Patch_CalcBounds(p, vMin, vMax); //--Patch_CalcBounds(p, vMin, vMax);
//--Brush_RebuildBrush(p->pSymbiot, vMin, vMax); //--p->pSymbiot->Brush_RebuildBrush(vMin, vMax);
Patch_Rebuild(p); Patch_Rebuild(p);
Patch_CapTexture(p); Patch_CapTexture(p);
return p->pSymbiot; return p->pSymbiot;
@@ -1431,8 +1432,8 @@ brush_t * CapSpecial( patchMesh_t *pParent,int nType,bool bFirst ) {
void Patch_CapCurrent( bool bInvertedBevel,bool bInvertedEndcap ) { void Patch_CapCurrent( bool bInvertedBevel,bool bInvertedEndcap ) {
patchMesh_t *pParent = NULL; patchMesh_t *pParent = NULL;
brush_t *b[4]; idEditorBrush *b[4];
brush_t *pCap = NULL; idEditorBrush *pCap = NULL;
b[0] = b[1] = b[2] = b[3] = NULL; b[0] = b[1] = b[2] = b[3] = NULL;
int nIndex = 0; int nIndex = 0;
@@ -1442,7 +1443,7 @@ void Patch_CapCurrent( bool bInvertedBevel,bool bInvertedEndcap ) {
} }
for ( brush_t*pb = selected_brushes.next ; pb != NULL && pb != &selected_brushes ; pb = pb->next ) { for ( idEditorBrush*pb = selected_brushes.next ; pb != NULL && pb != &selected_brushes ; pb = pb->next ) {
if ( pb->pPatch ) { if ( pb->pPatch ) {
pParent = pb->pPatch; pParent = pb->pPatch;
// decide which if any ends we are going to cap // decide which if any ends we are going to cap
@@ -1495,8 +1496,8 @@ void Patch_CapCurrent( bool bInvertedBevel,bool bInvertedEndcap ) {
} }
eclass_t*pecNew = Eclass_ForName("func_static", false); eclass_t*pecNew = Eclass_ForName("func_static", false);
if ( pecNew ) { if ( pecNew ) {
entity_t*e = Entity_Create(pecNew); idEditorEntity*e = idEditorEntity::Entity_Create(pecNew);
SetKeyValue(e, "type", "patchCapped"); e->SetKeyValue("type", "patchCapped");
} }
} }
} }
@@ -1505,8 +1506,8 @@ void Patch_CapCurrent( bool bInvertedBevel,bool bInvertedEndcap ) {
//FIXME: Table drive all this crap //FIXME: Table drive all this crap
// //
void GenerateEndCaps( brush_t *brushParent,bool bBevel,bool bEndcap,bool bInverted ) { void GenerateEndCaps( idEditorBrush *brushParent,bool bBevel,bool bEndcap,bool bInverted ) {
brush_t *b, *b2; idEditorBrush *b, *b2;
patchMesh_t *p, *p2, *pParent; patchMesh_t *p, *p2, *pParent;
idVec3 vTemp, vMin, vMax; idVec3 vTemp, vMin, vMax;
int i, j; int i, j;
@@ -1545,7 +1546,7 @@ void GenerateEndCaps( brush_t *brushParent,bool bBevel,bool bEndcap,bool bInvert
} }
Patch_CalcBounds(p, vMin, vMax); Patch_CalcBounds(p, vMin, vMax);
Brush_RebuildBrush(p->pSymbiot, vMin, vMax); p->pSymbiot->Brush_RebuildBrush(vMin, vMax);
Select_Brush(p->pSymbiot); Select_Brush(p->pSymbiot);
return; return;
@@ -1703,9 +1704,9 @@ void GenerateEndCaps( brush_t *brushParent,bool bBevel,bool bEndcap,bool bInvert
//Select_Delete(); //Select_Delete();
Patch_CalcBounds(p, vMin, vMax); Patch_CalcBounds(p, vMin, vMax);
Brush_RebuildBrush(p->pSymbiot, vMin, vMax); p->pSymbiot->Brush_RebuildBrush(vMin, vMax);
Patch_CalcBounds(p2, vMin, vMax); Patch_CalcBounds(p2, vMin, vMax);
Brush_RebuildBrush(p2->pSymbiot, vMin, vMax); p2->pSymbiot->Brush_RebuildBrush(vMin, vMax);
Select_Brush(p->pSymbiot); Select_Brush(p->pSymbiot);
Select_Brush(p2->pSymbiot); Select_Brush(p2->pSymbiot);
} else { } else {
@@ -1722,7 +1723,7 @@ BrushToPatchMesh
=============== ===============
*/ */
void Patch_BrushToMesh( bool bCone,bool bBevel,bool bEndcap,bool bSquare,int nHeight ) { void Patch_BrushToMesh( bool bCone,bool bBevel,bool bEndcap,bool bSquare,int nHeight ) {
brush_t *b; idEditorBrush *b;
patchMesh_t *p; patchMesh_t *p;
int i, j; int i, j;
@@ -1900,7 +1901,7 @@ patchMesh_t * Patch_GenerateGeneric( int width,int height,int orientation,const
Patch_GenericMesh Patch_GenericMesh
================== ==================
*/ */
brush_t * Patch_GenericMesh( int width,int height,int orientation,bool bDeleteSource,bool bOverride,patchMesh_t *parent ) { idEditorBrush * Patch_GenericMesh( int width,int height,int orientation,bool bDeleteSource,bool bOverride,patchMesh_t *parent ) {
if ( height < 3 || height> 15 || width < 3 || width> 15 ) { if ( height < 3 || height> 15 || width < 3 || width> 15 ) {
Sys_Status("Invalid patch width or height.\n"); Sys_Status("Invalid patch width or height.\n");
return NULL; return NULL;
@@ -1911,7 +1912,7 @@ brush_t * Patch_GenericMesh( int width,int height,int orientation,bool bDeleteSo
return NULL; return NULL;
} }
brush_t *b = selected_brushes.next; idEditorBrush *b = selected_brushes.next;
patchMesh_t *p = Patch_GenerateGeneric(width, height, orientation, b->mins, b->maxs); patchMesh_t *p = Patch_GenerateGeneric(width, height, orientation, b->mins, b->maxs);
@@ -2107,7 +2108,7 @@ void AddPatchMovePoint( idVec3 v,bool bMulti,bool bFull ) {
return; return;
} }
for ( brush_t*pb = selected_brushes.next ; pb != &selected_brushes ; pb = pb->next ) { for ( idEditorBrush*pb = selected_brushes.next ; pb != &selected_brushes ; pb = pb->next ) {
if ( pb->pPatch ) { if ( pb->pPatch ) {
patchMesh_t *p = pb->pPatch; patchMesh_t *p = pb->pPatch;
for ( int i = 0 ; i < p->width ; i++ ) { for ( int i = 0 ; i < p->width ; i++ ) {
@@ -2159,7 +2160,7 @@ void Patch_UpdateSelected( idVec3 vMove ) {
} }
//--patchMesh_t* p = &patchMeshes[g_nSelectedPatch]; //--patchMesh_t* p = &patchMeshes[g_nSelectedPatch];
for ( brush_t*pb = selected_brushes.next ; pb != &selected_brushes ; pb = pb->next ) { for ( idEditorBrush*pb = selected_brushes.next ; pb != &selected_brushes ; pb = pb->next ) {
if ( pb->pPatch ) { if ( pb->pPatch ) {
patchMesh_t *p = pb->pPatch; patchMesh_t *p = pb->pPatch;
@@ -2176,7 +2177,7 @@ void Patch_UpdateSelected( idVec3 vMove ) {
idVec3 vMin, vMax; idVec3 vMin, vMax;
Patch_CalcBounds(p, vMin, vMax); Patch_CalcBounds(p, vMin, vMax);
Brush_RebuildBrush(p->pSymbiot, vMin, vMax); p->pSymbiot->Brush_RebuildBrush(vMin, vMax);
} }
} }
//Brush_Free(p->pSymbiot); //Brush_Free(p->pSymbiot);
@@ -2185,7 +2186,7 @@ void Patch_UpdateSelected( idVec3 vMove ) {
void Patch_AdjustSubdivisions( float hadj,float vadj ) { void Patch_AdjustSubdivisions( float hadj,float vadj ) {
brush_t *pb; idEditorBrush *pb;
for ( pb = selected_brushes.next ; pb != &selected_brushes ; pb = pb->next ) { for ( pb = selected_brushes.next ; pb != &selected_brushes ; pb = pb->next ) {
if ( pb->pPatch ) { if ( pb->pPatch ) {
patchMesh_t *p = pb->pPatch; patchMesh_t *p = pb->pPatch;
@@ -2599,7 +2600,7 @@ void Patch_Move( patchMesh_t *pm,const idVec3 vMove,bool bRebuild ) {
if ( bRebuild ) { if ( bRebuild ) {
idVec3 vMin, vMax; idVec3 vMin, vMax;
Patch_CalcBounds(pm, vMin, vMax); Patch_CalcBounds(pm, vMin, vMax);
//Brush_RebuildBrush(patchMeshes[n].pSymbiot, vMin, vMax); //patchMeshes[n].pSymbiot->Brush_RebuildBrush(vMin, vMax);
} }
UpdatePatchInspector(); UpdatePatchInspector();
} }
@@ -2624,7 +2625,7 @@ void Patch_ApplyMatrix( patchMesh_t *p,const idVec3 vOrigin,const idMat3 matrix,
} }
idVec3 vMin, vMax; idVec3 vMin, vMax;
Patch_CalcBounds(p, vMin, vMax); Patch_CalcBounds(p, vMin, vMax);
Brush_RebuildBrush(p->pSymbiot, vMin, vMax); p->pSymbiot->Brush_RebuildBrush(vMin, vMax);
} }
/* /*
@@ -2637,7 +2638,7 @@ void Patch_EditPatch() {
g_qeglobals.d_numpoints = 0; g_qeglobals.d_numpoints = 0;
g_qeglobals.d_num_move_points = 0; g_qeglobals.d_num_move_points = 0;
for ( brush_t*pb = selected_brushes.next ; pb != &selected_brushes ; pb = pb->next ) { for ( idEditorBrush*pb = selected_brushes.next ; pb != &selected_brushes ; pb = pb->next ) {
if ( pb->pPatch ) { if ( pb->pPatch ) {
patchMesh_t *p = pb->pPatch; patchMesh_t *p = pb->pPatch;
for ( int i = 0 ; i < p->width ; i++ ) { for ( int i = 0 ; i < p->width ; i++ ) {
@@ -2666,7 +2667,7 @@ void Patch_Deselect() {
//--g_nSelectedPatch = -1; //--g_nSelectedPatch = -1;
g_qeglobals.d_select_mode = sel_brush; g_qeglobals.d_select_mode = sel_brush;
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 ) { if ( b->pPatch ) {
b->pPatch->bSelected = false; b->pPatch->bSelected = false;
} }
@@ -2747,7 +2748,7 @@ void Patch_Scale( patchMesh_t *p,const idVec3 vOrigin,const idVec3 vAmt,bool bRe
if ( bRebuild ) { if ( bRebuild ) {
idVec3 vMin, vMax; idVec3 vMin, vMax;
Patch_CalcBounds(p, vMin, vMax); Patch_CalcBounds(p, vMin, vMax);
Brush_RebuildBrush(p->pSymbiot, vMin, vMax); p->pSymbiot->Brush_RebuildBrush(vMin, vMax);
} }
UpdatePatchInspector(); UpdatePatchInspector();
} }
@@ -3022,7 +3023,7 @@ void Patch_DisperseRows() {
int i, w, h; int i, w, h;
for ( brush_t*pb = selected_brushes.next ; pb != &selected_brushes ; pb = pb->next ) { for ( idEditorBrush*pb = selected_brushes.next ; pb != &selected_brushes ; pb = pb->next ) {
if ( pb->pPatch ) { if ( pb->pPatch ) {
patchMesh_t *p = pb->pPatch; patchMesh_t *p = pb->pPatch;
Patch_Rebuild(p); Patch_Rebuild(p);
@@ -3064,7 +3065,7 @@ void Patch_DisperseColumns() {
idVec3 vTemp, vTemp2; idVec3 vTemp, vTemp2;
int i, w, h; int i, w, h;
for ( brush_t*pb = selected_brushes.next ; pb != &selected_brushes ; pb = pb->next ) { for ( idEditorBrush*pb = selected_brushes.next ; pb != &selected_brushes ; pb = pb->next ) {
if ( pb->pPatch ) { if ( pb->pPatch ) {
patchMesh_t *p = pb->pPatch; patchMesh_t *p = pb->pPatch;
Patch_Rebuild(p); Patch_Rebuild(p);
@@ -3101,7 +3102,7 @@ Patch_AdjustSelected
*/ */
void Patch_AdjustSelected( bool bInsert,bool bColumn,bool bFlag ) { void Patch_AdjustSelected( bool bInsert,bool bColumn,bool bFlag ) {
bool bUpdate = false; bool bUpdate = false;
for ( brush_t*pb = selected_brushes.next ; pb != &selected_brushes ; pb = pb->next ) { for ( idEditorBrush*pb = selected_brushes.next ; pb != &selected_brushes ; pb = pb->next ) {
if ( pb->pPatch ) { if ( pb->pPatch ) {
if ( bInsert ) { if ( bInsert ) {
if ( bColumn ) { if ( bColumn ) {
@@ -3120,7 +3121,7 @@ void Patch_AdjustSelected( bool bInsert,bool bColumn,bool bFlag ) {
idVec3 vMin, vMax; idVec3 vMin, vMax;
patchMesh_t *p = pb->pPatch; patchMesh_t *p = pb->pPatch;
Patch_CalcBounds(p, vMin, vMax); Patch_CalcBounds(p, vMin, vMax);
Brush_RebuildBrush(p->pSymbiot, vMin, vMax); p->pSymbiot->Brush_RebuildBrush(vMin, vMax);
} }
} }
if ( bUpdate ) { if ( bUpdate ) {
@@ -3154,7 +3155,7 @@ void Parse3DMatrix( int z,int y,int x,float *p ) {
} }
// parses a patch // parses a patch
brush_t * Patch_Parse( bool bOld ) { idEditorBrush * Patch_Parse( bool bOld ) {
const idMaterial *tex = declManager->FindMaterial(NULL); const idMaterial *tex = declManager->FindMaterial(NULL);
GetToken(true); GetToken(true);
@@ -3166,7 +3167,7 @@ brush_t * Patch_Parse( bool bOld ) {
if ( g_qeglobals.bSurfacePropertiesPlugin ) { if ( g_qeglobals.bSurfacePropertiesPlugin ) {
assert(true); assert(true);
//GETPLUGINTEXDEF(pm)->ParsePatchTexdef(); //GETPLUGINTEXDEFpm->ParsePatchTexdef();
} else { } else {
// texture def // texture def
GetToken(true); GetToken(true);
@@ -3256,7 +3257,7 @@ brush_t * Patch_Parse( bool bOld ) {
return NULL; return NULL;
} }
brush_t *b = AddBrushForPatch(pm, false); idEditorBrush *b = AddBrushForPatch(pm, false);
return b; return b;
} }
@@ -3450,7 +3451,7 @@ Patch_ToggleInverted
void Patch_ToggleInverted() { void Patch_ToggleInverted() {
bool bUpdate = false; bool bUpdate = false;
for ( brush_t*pb = selected_brushes.next ; pb != &selected_brushes ; pb = pb->next ) { for ( idEditorBrush*pb = selected_brushes.next ; pb != &selected_brushes ; pb = pb->next ) {
if ( pb->pPatch ) { if ( pb->pPatch ) {
bUpdate = true; bUpdate = true;
patchInvert(pb->pPatch); patchInvert(pb->pPatch);
@@ -3493,7 +3494,7 @@ Patch_ToggleInverted
*/ */
void Patch_InvertTexture( bool bY ) { void Patch_InvertTexture( bool bY ) {
bool bUpdate = false; bool bUpdate = false;
for ( brush_t*pb = selected_brushes.next ; pb != &selected_brushes ; pb = pb->next ) { for ( idEditorBrush*pb = selected_brushes.next ; pb != &selected_brushes ; pb = pb->next ) {
if ( pb->pPatch ) { if ( pb->pPatch ) {
bUpdate = true; bUpdate = true;
Patch_FlipTexture(pb->pPatch, bY); Patch_FlipTexture(pb->pPatch, bY);
@@ -3555,7 +3556,7 @@ void Patch_FitTexture( patchMesh_t *p,float fx,float fy ) {
} }
void Patch_ResetTexturing( float fx,float fy ) { void Patch_ResetTexturing( float fx,float fy ) {
for ( brush_t*pb = selected_brushes.next ; pb != &selected_brushes ; pb = pb->next ) { for ( idEditorBrush*pb = selected_brushes.next ; pb != &selected_brushes ; pb = pb->next ) {
if ( pb->pPatch ) { if ( pb->pPatch ) {
patchMesh_t *p = pb->pPatch; patchMesh_t *p = pb->pPatch;
Patch_MakeDirty(p); Patch_MakeDirty(p);
@@ -3571,7 +3572,7 @@ void Patch_ResetTexturing( float fx,float fy ) {
void Patch_FitTexturing() { void Patch_FitTexturing() {
for ( brush_t*pb = selected_brushes.next ; pb != &selected_brushes ; pb = pb->next ) { for ( idEditorBrush*pb = selected_brushes.next ; pb != &selected_brushes ; pb = pb->next ) {
if ( pb->pPatch ) { if ( pb->pPatch ) {
patchMesh_t *p = pb->pPatch; patchMesh_t *p = pb->pPatch;
Patch_MakeDirty(p); Patch_MakeDirty(p);
@@ -3586,7 +3587,7 @@ void Patch_FitTexturing() {
} }
void Patch_SetTextureInfo( texdef_t *pt ) { void Patch_SetTextureInfo( texdef_t *pt ) {
for ( brush_t*pb = selected_brushes.next ; pb != &selected_brushes ; pb = pb->next ) { for ( idEditorBrush*pb = selected_brushes.next ; pb != &selected_brushes ; pb = pb->next ) {
if ( pb->pPatch ) { if ( pb->pPatch ) {
if ( pt->rotate ) if ( pt->rotate )
Patch_RotateTexture(pb->pPatch, pt->rotate); Patch_RotateTexture(pb->pPatch, pt->rotate);
@@ -3607,7 +3608,7 @@ bool WINAPI OnlyPatchesSelected() {
if ( g_ptrSelectedFaces.GetSize() > 0 || selected_brushes.next == &selected_brushes ) { if ( g_ptrSelectedFaces.GetSize() > 0 || selected_brushes.next == &selected_brushes ) {
return false; return false;
} }
for ( brush_t*pb = selected_brushes.next ; pb != &selected_brushes ; pb = pb->next ) { for ( idEditorBrush*pb = selected_brushes.next ; pb != &selected_brushes ; pb = pb->next ) {
if ( !pb->pPatch ) { if ( !pb->pPatch ) {
return false; return false;
} }
@@ -3619,7 +3620,7 @@ bool WINAPI AnyPatchesSelected() {
if ( g_ptrSelectedFaces.GetSize() > 0 || selected_brushes.next == &selected_brushes ) { if ( g_ptrSelectedFaces.GetSize() > 0 || selected_brushes.next == &selected_brushes ) {
return false; return false;
} }
for ( brush_t*pb = selected_brushes.next ; pb != &selected_brushes ; pb = pb->next ) { for ( idEditorBrush*pb = selected_brushes.next ; pb != &selected_brushes ; pb = pb->next ) {
if ( pb->pPatch ) { if ( pb->pPatch ) {
return true; return true;
} }
@@ -3642,7 +3643,7 @@ void Patch_BendToggle() {
return; return;
} }
brush_t *b = selected_brushes.next; idEditorBrush *b = selected_brushes.next;
if ( !QE_SingleBrush() || !b->pPatch ) { if ( !QE_SingleBrush() || !b->pPatch ) {
Sys_Status("Must bend a single patch"); Sys_Status("Must bend a single patch");
@@ -3662,7 +3663,7 @@ void Patch_BendHandleTAB() {
return; return;
} }
brush_t *b = selected_brushes.next; idEditorBrush *b = selected_brushes.next;
if ( !QE_SingleBrush() || !b->pPatch ) { if ( !QE_SingleBrush() || !b->pPatch ) {
Patch_BendToggle(); Patch_BendToggle();
Sys_Status("No patch to bend!"); Sys_Status("No patch to bend!");
@@ -3744,7 +3745,7 @@ void Patch_BendHandleESC() {
return; return;
} }
Patch_BendToggle(); Patch_BendToggle();
brush_t *b = selected_brushes.next; idEditorBrush *b = selected_brushes.next;
if ( QE_SingleBrush() && b->pPatch ) { if ( QE_SingleBrush() && b->pPatch ) {
Patch_Restore(b->pPatch); Patch_Restore(b->pPatch);
} }
@@ -3761,7 +3762,7 @@ void Patch_SetBendRotateOrigin( patchMesh_t *p ) {
// also sets the rotational origin // also sets the rotational origin
void Patch_SelectBendAxis() { void Patch_SelectBendAxis() {
brush_t *b = selected_brushes.next; idEditorBrush *b = selected_brushes.next;
if ( !QE_SingleBrush() || !b->pPatch ) { if ( !QE_SingleBrush() || !b->pPatch ) {
// should not ever happen // should not ever happen
Patch_BendToggle(); Patch_BendToggle();
@@ -3779,7 +3780,7 @@ void Patch_SelectBendAxis() {
} }
void Patch_SelectBendNormal() { void Patch_SelectBendNormal() {
brush_t *b = selected_brushes.next; idEditorBrush *b = selected_brushes.next;
if ( !QE_SingleBrush() || !b->pPatch ) { if ( !QE_SingleBrush() || !b->pPatch ) {
// should not ever happen // should not ever happen
Patch_BendToggle(); Patch_BendToggle();
@@ -3819,7 +3820,7 @@ void Patch_InsDelToggle() {
return; return;
} }
brush_t *b = selected_brushes.next; idEditorBrush *b = selected_brushes.next;
if ( !QE_SingleBrush() || !b->pPatch ) { if ( !QE_SingleBrush() || !b->pPatch ) {
Sys_Status("Must work with a single patch"); Sys_Status("Must work with a single patch");
@@ -3852,7 +3853,7 @@ void Patch_InsDelHandleTAB() {
return; return;
} }
brush_t *b = selected_brushes.next; idEditorBrush *b = selected_brushes.next;
if ( !QE_SingleBrush() || !b->pPatch ) { if ( !QE_SingleBrush() || !b->pPatch ) {
Patch_BendToggle(); Patch_BendToggle();
common->Printf("No patch to bend!"); common->Printf("No patch to bend!");
@@ -3952,7 +3953,7 @@ void _Write3DMatrix( CMemFile *f,int z,int y,int x,float *m ) {
void Patch_NaturalizeSelected( bool bCap,bool bCycleCap,bool alt ) { void Patch_NaturalizeSelected( bool bCap,bool bCycleCap,bool alt ) {
for ( brush_t*pb = selected_brushes.next ; pb != &selected_brushes ; pb = pb->next ) { for ( idEditorBrush*pb = selected_brushes.next ; pb != &selected_brushes ; pb = pb->next ) {
if ( pb->pPatch ) { if ( pb->pPatch ) {
if ( bCap ) { if ( bCap ) {
Patch_CapTexture(pb->pPatch, bCycleCap, alt); Patch_CapTexture(pb->pPatch, bCycleCap, alt);
@@ -3964,7 +3965,7 @@ void Patch_NaturalizeSelected( bool bCap,bool bCycleCap,bool alt ) {
} }
void Patch_SubdivideSelected( bool subdivide,int horz,int vert ) { void Patch_SubdivideSelected( bool subdivide,int horz,int vert ) {
for ( brush_t*pb = selected_brushes.next ; pb != &selected_brushes ; pb = pb->next ) { for ( idEditorBrush*pb = selected_brushes.next ; pb != &selected_brushes ; pb = pb->next ) {
if ( pb->pPatch ) { if ( pb->pPatch ) {
pb->pPatch->explicitSubdivisions = subdivide; pb->pPatch->explicitSubdivisions = subdivide;
if ( horz <= 0 ) { if ( horz <= 0 ) {
@@ -3999,7 +4000,7 @@ void Patch_SelectAreaPoints() {
//g_qeglobals.d_num_move_points = 0; //g_qeglobals.d_num_move_points = 0;
g_nPatchClickedView = -1; g_nPatchClickedView = -1;
for ( brush_t*pb = selected_brushes.next ; pb != &selected_brushes ; pb = pb->next ) { for ( idEditorBrush*pb = selected_brushes.next ; pb != &selected_brushes ; pb = pb->next ) {
if ( pb->pPatch ) { if ( pb->pPatch ) {
patchMesh_t *p = pb->pPatch; patchMesh_t *p = pb->pPatch;
for ( int i = 0; i < p->width; i++ ) { for ( int i = 0; i < p->width; i++ ) {
@@ -4014,7 +4015,7 @@ void Patch_SelectAreaPoints() {
} }
const char * Patch_GetTextureName() { const char * Patch_GetTextureName() {
brush_t *b = selected_brushes.next; idEditorBrush *b = selected_brushes.next;
if ( b->pPatch ) { if ( b->pPatch ) {
patchMesh_t *p = b->pPatch; patchMesh_t *p = b->pPatch;
if ( p->d_texture->GetName() ) if ( p->d_texture->GetName() )
@@ -4044,7 +4045,7 @@ patchMesh_t * Patch_Duplicate( patchMesh_t *pFrom ) {
void Patch_Thicken( int nAmount,bool bSeam ) { void Patch_Thicken( int nAmount,bool bSeam ) {
int i, j, h, w; int i, j, h, w;
brush_t *b; idEditorBrush *b;
patchMesh_t *pSeam; patchMesh_t *pSeam;
idVec3 vMin, vMax; idVec3 vMin, vMax;
CPtrArray brushes; CPtrArray brushes;
@@ -4057,7 +4058,7 @@ void Patch_Thicken( int nAmount,bool bSeam ) {
return; return;
} }
for ( brush_t*pb = selected_brushes.next ; pb != &selected_brushes ; pb = pb->next ) { for ( idEditorBrush*pb = selected_brushes.next ; pb != &selected_brushes ; pb = pb->next ) {
if ( !pb->pPatch ) { if ( !pb->pPatch ) {
return; return;
} }
@@ -4091,7 +4092,7 @@ void Patch_Thicken( int nAmount,bool bSeam ) {
Patch_CalcBounds(pSeam, vMin, vMax); Patch_CalcBounds(pSeam, vMin, vMax);
Brush_RebuildBrush(pSeam->pSymbiot, vMin, vMax); pSeam->pSymbiot->Brush_RebuildBrush(vMin, vMax);
//--Patch_CapTexture(pSeam); //--Patch_CapTexture(pSeam);
Patch_Naturalize(pSeam); Patch_Naturalize(pSeam);
patchInvert(pSeam); patchInvert(pSeam);
@@ -4108,7 +4109,7 @@ void Patch_Thicken( int nAmount,bool bSeam ) {
VectorScale(pSeam->ctrl(1, i).xyz, 0.5, pSeam->ctrl(1, i).xyz); VectorScale(pSeam->ctrl(1, i).xyz, 0.5, pSeam->ctrl(1, i).xyz);
} }
Patch_CalcBounds(pSeam, vMin, vMax); Patch_CalcBounds(pSeam, vMin, vMax);
Brush_RebuildBrush(pSeam->pSymbiot, vMin, vMax); pSeam->pSymbiot->Brush_RebuildBrush(vMin, vMax);
//--Patch_CapTexture(pSeam); //--Patch_CapTexture(pSeam);
Patch_Naturalize(pSeam); Patch_Naturalize(pSeam);
brushes.Add(b); brushes.Add(b);
@@ -4128,7 +4129,7 @@ void Patch_Thicken( int nAmount,bool bSeam ) {
Patch_CalcBounds(pSeam, vMin, vMax); Patch_CalcBounds(pSeam, vMin, vMax);
Brush_RebuildBrush(pSeam->pSymbiot, vMin, vMax); pSeam->pSymbiot->Brush_RebuildBrush(vMin, vMax);
//--Patch_CapTexture(pSeam); //--Patch_CapTexture(pSeam);
Patch_Naturalize(pSeam); Patch_Naturalize(pSeam);
patchInvert(pSeam); patchInvert(pSeam);
@@ -4145,7 +4146,7 @@ void Patch_Thicken( int nAmount,bool bSeam ) {
VectorScale(pSeam->ctrl(i, 1).xyz, 0.5, pSeam->ctrl(i, 1).xyz); VectorScale(pSeam->ctrl(i, 1).xyz, 0.5, pSeam->ctrl(i, 1).xyz);
} }
Patch_CalcBounds(pSeam, vMin, vMax); Patch_CalcBounds(pSeam, vMin, vMax);
Brush_RebuildBrush(pSeam->pSymbiot, vMin, vMax); pSeam->pSymbiot->Brush_RebuildBrush(vMin, vMax);
//--Patch_CapTexture(pSeam); //--Patch_CapTexture(pSeam);
Patch_Naturalize(pSeam); Patch_Naturalize(pSeam);
brushes.Add(b); brushes.Add(b);
@@ -4155,14 +4156,14 @@ void Patch_Thicken( int nAmount,bool bSeam ) {
} }
for ( i = 0; i < brushes.GetSize(); i++ ) { for ( i = 0; i < brushes.GetSize(); i++ ) {
Select_Brush(reinterpret_cast< brush_t*>(brushes.GetAt(i))); Select_Brush(reinterpret_cast< idEditorBrush*>(brushes.GetAt(i)));
} }
if ( brushes.GetSize() > 0 ) { if ( brushes.GetSize() > 0 ) {
eclass_t*pecNew = Eclass_ForName("func_static", false); eclass_t*pecNew = Eclass_ForName("func_static", false);
if ( pecNew ) { if ( pecNew ) {
entity_t*e = Entity_Create(pecNew); idEditorEntity*e = idEditorEntity::Entity_Create(pecNew);
SetKeyValue(e, "type", "patchThick"); e->SetKeyValue("type", "patchThick");
} }
} }
@@ -4190,7 +4191,7 @@ clear clipboard
*/ */
void Patch_SetOverlays() { void Patch_SetOverlays() {
for ( brush_t*pb = selected_brushes.next ; pb != &selected_brushes ; pb = pb->next ) { for ( idEditorBrush*pb = selected_brushes.next ; pb != &selected_brushes ; pb = pb->next ) {
if ( pb->pPatch ) { if ( pb->pPatch ) {
pb->pPatch->bOverlay = true; pb->pPatch->bOverlay = true;
} }
@@ -4200,7 +4201,7 @@ void Patch_SetOverlays() {
void Patch_ClearOverlays() { void Patch_ClearOverlays() {
brush_t *pb; idEditorBrush *pb;
for ( pb = selected_brushes.next ; pb != &selected_brushes ; pb = pb->next ) { for ( pb = selected_brushes.next ; pb != &selected_brushes ; pb = pb->next ) {
if ( pb->pPatch ) { if ( pb->pPatch ) {
pb->pPatch->bOverlay = false; pb->pPatch->bOverlay = false;
@@ -4216,7 +4217,7 @@ void Patch_ClearOverlays() {
// freezes selected vertices // freezes selected vertices
void Patch_Freeze() { void Patch_Freeze() {
brush_t *pb; idEditorBrush *pb;
for ( pb = selected_brushes.next ; pb != &selected_brushes ; pb = pb->next ) { for ( pb = selected_brushes.next ; pb != &selected_brushes ; pb = pb->next ) {
if ( pb->pPatch ) { if ( pb->pPatch ) {
pb->pPatch->bOverlay = false; pb->pPatch->bOverlay = false;
@@ -4237,7 +4238,7 @@ void Patch_UnFreeze( bool bAll ) {
void Patch_Transpose() { void Patch_Transpose() {
int i, j, w; int i, j, w;
idDrawVert dv; idDrawVert dv;
for ( brush_t*pb = selected_brushes.next ; pb != &selected_brushes ; pb = pb->next ) { for ( idEditorBrush*pb = selected_brushes.next ; pb != &selected_brushes ; pb = pb->next ) {
if ( pb->pPatch ) { if ( pb->pPatch ) {
patchMesh_t *p = pb->pPatch; patchMesh_t *p = pb->pPatch;
@@ -4284,7 +4285,7 @@ void Patch_Transpose() {
void Select_SnapToGrid() { void Select_SnapToGrid() {
int i, j, k; int i, j, k;
for ( brush_t*pb = selected_brushes.next ; pb != &selected_brushes ; pb = pb->next ) { for ( idEditorBrush*pb = selected_brushes.next ; pb != &selected_brushes ; pb = pb->next ) {
if ( pb->pPatch ) { if ( pb->pPatch ) {
patchMesh_t *p = pb->pPatch; patchMesh_t *p = pb->pPatch;
for ( i = 0; i < p->width; i++ ) { for ( i = 0; i < p->width; i++ ) {
@@ -4296,15 +4297,15 @@ void Select_SnapToGrid() {
} }
idVec3 vMin, vMax; idVec3 vMin, vMax;
Patch_CalcBounds(p, vMin, vMax); Patch_CalcBounds(p, vMin, vMax);
Brush_RebuildBrush(p->pSymbiot, vMin, vMax); p->pSymbiot->Brush_RebuildBrush(vMin, vMax);
} else { } else {
Brush_SnapToGrid(pb); pb->Brush_SnapToGrid();
} }
} }
} }
void Patch_FindReplaceTexture( brush_t *pb,const char *pFind,const char *pReplace,bool bForce ) { void Patch_FindReplaceTexture( idEditorBrush *pb,const char *pFind,const char *pReplace,bool bForce ) {
if ( pb->pPatch ) { if ( pb->pPatch ) {
patchMesh_t *p = pb->pPatch; patchMesh_t *p = pb->pPatch;
if ( bForce || idStr::Icmp(p->d_texture->GetName(), pFind) == 0 ) { if ( bForce || idStr::Icmp(p->d_texture->GetName(), pFind) == 0 ) {
@@ -4314,7 +4315,7 @@ void Patch_FindReplaceTexture( brush_t *pb,const char *pFind,const char *pReplac
} }
} }
void Patch_ReplaceQTexture( brush_t *pb,idMaterial *pOld,idMaterial *pNew ) { void Patch_ReplaceQTexture( idEditorBrush *pb,idMaterial *pOld,idMaterial *pNew ) {
if ( pb->pPatch ) { if ( pb->pPatch ) {
patchMesh_t *p = pb->pPatch; patchMesh_t *p = pb->pPatch;
if ( p->d_texture == pOld ) { if ( p->d_texture == pOld ) {
@@ -4323,7 +4324,7 @@ void Patch_ReplaceQTexture( brush_t *pb,idMaterial *pOld,idMaterial *pNew ) {
} }
} }
void Patch_Clone( patchMesh_t *p,brush_t *pNewOwner ) { void Patch_Clone( patchMesh_t *p,idEditorBrush *pNewOwner ) {
} }
void Patch_FromTriangle( idVec5 vx,idVec5 vy,idVec5 vz ) { void Patch_FromTriangle( idVec5 vx,idVec5 vy,idVec5 vz ) {
@@ -4385,7 +4386,7 @@ void Patch_FromTriangle( idVec5 vx,idVec5 vy,idVec5 vz ) {
//Patch_Naturalize(p); //Patch_Naturalize(p);
brush_t *b = AddBrushForPatch(p); idEditorBrush *b = AddBrushForPatch(p);
} }
+6 -6
View File
@@ -28,11 +28,11 @@ If you have questions concerning this license or the applicable additional terms
// patch stuff // patch stuff
patchMesh_t* MakeNewPatch(int width, int height); patchMesh_t* MakeNewPatch(int width, int height);
brush_t* AddBrushForPatch(patchMesh_t *pm, bool bLinkToWorld = true); idEditorBrush* AddBrushForPatch(patchMesh_t *pm, bool bLinkToWorld = true);
brush_t* Patch_GenericMesh(int nWidth, int nHeight, int nOrientation = 2, bool bDeleteSource = true, bool bOverride = false, patchMesh_t *parent = NULL); idEditorBrush* Patch_GenericMesh(int nWidth, int nHeight, int nOrientation = 2, bool bDeleteSource = true, bool bOverride = false, patchMesh_t *parent = NULL);
void Patch_ReadFile (char *name); void Patch_ReadFile (char *name);
void Patch_WriteFile (char *name); void Patch_WriteFile (char *name);
void Patch_BuildPoints (brush_t *b); void Patch_BuildPoints (idEditorBrush *b);
void Patch_Move(patchMesh_t *p, const idVec3 vMove, bool bRebuild = false); void Patch_Move(patchMesh_t *p, const idVec3 vMove, bool bRebuild = false);
//++timo had to add a default value for bSnap (see Patch_ApplyMatrix call from Select_ApplyMatrix in select.cpp) //++timo had to add a default value for bSnap (see Patch_ApplyMatrix call from Select_ApplyMatrix in select.cpp)
void Patch_ApplyMatrix(patchMesh_t *p, const idVec3 vOrigin, const idMat3 matrix, bool bSnap = false); void Patch_ApplyMatrix(patchMesh_t *p, const idVec3 vOrigin, const idMat3 matrix, bool bSnap = false);
@@ -53,7 +53,7 @@ void Patch_ReadBuffer(char* pBuff, bool bSelect = false);
void Patch_WriteFile (CMemFile* pMemFile); void Patch_WriteFile (CMemFile* pMemFile);
void Patch_UpdateSelected(idVec3 vMove); void Patch_UpdateSelected(idVec3 vMove);
void Patch_AddRow(patchMesh_t *p); void Patch_AddRow(patchMesh_t *p);
brush_t* Patch_Parse(bool bOld); idEditorBrush* Patch_Parse(bool bOld);
void Patch_Write (patchMesh_t *p, FILE *f); void Patch_Write (patchMesh_t *p, FILE *f);
void Patch_Write (patchMesh_t *p, CMemFile *file); void Patch_Write (patchMesh_t *p, CMemFile *file);
void Patch_AdjustColumns(patchMesh_t *p, int nCols); void Patch_AdjustColumns(patchMesh_t *p, int nCols);
@@ -103,8 +103,8 @@ void Patch_Freeze();
void Patch_MakeDirty(patchMesh_t *p); void Patch_MakeDirty(patchMesh_t *p);
void Patch_UnFreeze(bool bAll); void Patch_UnFreeze(bool bAll);
const char* Patch_GetTextureName(); const char* Patch_GetTextureName();
void Patch_FindReplaceTexture(brush_t *pb, const char *pFind, const char *pReplace, bool bForce); void Patch_FindReplaceTexture(idEditorBrush *pb, const char *pFind, const char *pReplace, bool bForce);
void Patch_ReplaceQTexture(brush_t *pb, idMaterial *pOld, idMaterial *pNew); void Patch_ReplaceQTexture(idEditorBrush *pb, idMaterial *pOld, idMaterial *pNew);
void Select_SnapToGrid(); void Select_SnapToGrid();
void Patch_FromTriangle(idVec5 vx, idVec5 vy, idVec5 vz); void Patch_FromTriangle(idVec5 vx, idVec5 vy, idVec5 vz);
const char* Patch_GetKeyValue(patchMesh_t *p, const char *pKey); const char* Patch_GetKeyValue(patchMesh_t *p, const char *pKey);
+16 -17
View File
@@ -175,7 +175,7 @@ void QE_CheckAutoSave(void) {
if (g_PrefsDlg.m_bSnapShots && stricmp(currentmap, "unnamed.map") != 0) { if (g_PrefsDlg.m_bSnapShots && stricmp(currentmap, "unnamed.map") != 0) {
Map_Snapshot(); Map_Snapshot();
} else { } else {
Map_SaveFile(ValueForKey(g_qeglobals.d_project_entity, (autoToggle == 0) ? "autosave1" : "autosave2" ), false, true); Map_SaveFile(g_qeglobals.d_project_entity->ValueForKey((autoToggle == 0) ? "autosave1" : "autosave2" ), false, true);
autoToggle ^= 1; autoToggle ^= 1;
} }
Sys_Status("Autosaving...Saved.", 0); Sys_Status("Autosaving...Saved.", 0);
@@ -231,19 +231,19 @@ bool QE_LoadProject(char *projectfile) {
fileSystem->FreeFile( data ); fileSystem->FreeFile( data );
StartTokenParsing(strData.GetBuffer(0)); StartTokenParsing(strData.GetBuffer(0));
g_qeglobals.d_project_entity = Entity_Parse(true); g_qeglobals.d_project_entity = idEditorEntity::Entity_Parse(true);
if (!g_qeglobals.d_project_entity) { if (!g_qeglobals.d_project_entity) {
Error("Couldn't parse %s", projectfile); Error("Couldn't parse %s", projectfile);
} }
// set here some default project settings you need // set here some default project settings you need
if (strlen(ValueForKey(g_qeglobals.d_project_entity, "brush_primit")) == 0) { if (strlen(g_qeglobals.d_project_entity->ValueForKey("brush_primit")) == 0) {
SetKeyValue(g_qeglobals.d_project_entity, "brush_primit", "0"); g_qeglobals.d_project_entity->SetKeyValue("brush_primit", "0");
} }
g_qeglobals.m_bBrushPrimitMode = IntForKey(g_qeglobals.d_project_entity, "brush_primit"); g_qeglobals.m_bBrushPrimitMode = g_qeglobals.d_project_entity->IntForKey("brush_primit");
Eclass_InitForSourceDirectory(ValueForKey(g_qeglobals.d_project_entity, "entitypath")); Eclass_InitForSourceDirectory(g_qeglobals.d_project_entity->ValueForKey("entitypath"));
g_Inspectors->FillClassList(); // list in entity window g_Inspectors->FillClassList(); // list in entity window
Map_New(); Map_New();
@@ -256,7 +256,7 @@ bool QE_LoadProject(char *projectfile) {
/* /*
======================================================================================================================= =======================================================================================================================
QE_SaveProject £ QE_SaveProject
======================================================================================================================= =======================================================================================================================
*/ */
bool QE_SaveProject(const char *pProjectFile) { bool QE_SaveProject(const char *pProjectFile) {
@@ -290,7 +290,7 @@ bool QE_SaveProject(const char *pProjectFile) {
======================================================================================================================= =======================================================================================================================
*/ */
void ConnectEntities(void) { void ConnectEntities(void) {
entity_t *e1; idEditorEntity *e1;
const char *target; const char *target;
idStr strTarget; idStr strTarget;
int i, t; int i, t;
@@ -319,10 +319,10 @@ void ConnectEntities(void) {
} }
} }
target = ValueForKey(e1, "target"); target = e1->ValueForKey("target");
if ( target && *target) { if ( target && *target) {
for (t = 1; t < 2048; t++) { for (t = 1; t < 2048; t++) {
target = ValueForKey(e1, va("target%i", t)); target = e1->ValueForKey(va("target%i", t));
if (target && *target) { if (target && *target) {
continue; continue;
} else { } else {
@@ -334,16 +334,16 @@ void ConnectEntities(void) {
} }
for (i = 1; i < g_qeglobals.d_select_count; i++) { for (i = 1; i < g_qeglobals.d_select_count; i++) {
target = ValueForKey(g_qeglobals.d_select_order[i]->owner, "name"); target = g_qeglobals.d_select_order[i]->owner->ValueForKey("name");
if (target && *target) { if (target && *target) {
strTarget = target; strTarget = target;
} else { } else {
UniqueTargetName(strTarget); UniqueTargetName(strTarget);
} }
if (t == 0) { if (t == 0) {
SetKeyValue(e1, "target", strTarget); e1->SetKeyValue("target", strTarget);
} else { } else {
SetKeyValue(e1, va("target%i", t), strTarget); e1->SetKeyValue(va("target%i", t), strTarget);
} }
t++; t++;
} }
@@ -388,7 +388,7 @@ void QE_Init(void) {
g_qeglobals.d_showgrid = true; g_qeglobals.d_showgrid = true;
/* /*
* other stuff £ * other stuff
* FIXME: idMaterial Texture_Init (true); Cam_Init (); XY_Init (); * FIXME: idMaterial Texture_Init (true); Cam_Init (); XY_Init ();
*/ */
Z_Init(); Z_Init();
@@ -405,8 +405,8 @@ void QE_CountBrushesAndUpdateStatusBar(void) {
static int s_lastbrushcount, s_lastentitycount; static int s_lastbrushcount, s_lastentitycount;
static bool s_didonce; static bool s_didonce;
// entity_t *e; // idEditorEntity *e;
brush_t *b, *next; idEditorBrush *b, *next;
g_numbrushes = 0; g_numbrushes = 0;
g_numentities = 0; g_numentities = 0;
@@ -437,4 +437,3 @@ void QE_CountBrushesAndUpdateStatusBar(void) {
s_didonce = true; s_didonce = true;
} }
} }
+7 -9
View File
@@ -162,7 +162,7 @@ typedef struct
int d_num_entities; int d_num_entities;
entity_t *d_project_entity; idEditorEntity *d_project_entity;
idVec3 d_new_brush_bottom, d_new_brush_top; idVec3 d_new_brush_bottom, d_new_brush_top;
@@ -193,7 +193,7 @@ typedef struct
// connect entities uses the last two brushes selected // connect entities uses the last two brushes selected
int d_select_count; int d_select_count;
brush_t *d_select_order[MAX_MAP_ENTITIES]; idEditorBrush *d_select_order[MAX_MAP_ENTITIES];
idVec3 d_select_translate; // for dragging w/o making new display lists idVec3 d_select_translate; // for dragging w/o making new display lists
select_t d_select_mode; select_t d_select_mode;
idPointListInterface *selectObject; // idPointListInterface *selectObject; //
@@ -206,7 +206,7 @@ typedef struct
// Timo // Timo
// tells if we are internally using brush primitive (texture coordinates and map format) // tells if we are internally using brush primitive (texture coordinates and map format)
// this is a shortcut for IntForKey( g_qeglobals.d_project_entity, "brush_primit" ) // this is a shortcut for g_qeglobals.d_project_entity->IntForKey("brush_primit" )
// NOTE: must keep the two ones in sync // NOTE: must keep the two ones in sync
BOOL m_bBrushPrimitMode; BOOL m_bBrushPrimitMode;
@@ -374,7 +374,6 @@ extern int g_axialAnchor;
extern int g_axialDest; extern int g_axialDest;
extern void Face_FlipTexture_BrushPrimit(face_t *face, bool y); extern void Face_FlipTexture_BrushPrimit(face_t *face, bool y);
extern void Brush_FlipTexture_BrushPrimit(brush_t *b, bool y);
// Timo // Timo
// new brush primitive stuff // new brush primitive stuff
@@ -383,7 +382,6 @@ void FaceToBrushPrimitFace(face_t *f);
void EmitBrushPrimitTextureCoordinates(face_t *, idWinding *, patchMesh_t *patch = NULL); void EmitBrushPrimitTextureCoordinates(face_t *, idWinding *, patchMesh_t *patch = NULL);
// EmitTextureCoordinates, is old code used for brush to brush primitive conversion // EmitTextureCoordinates, is old code used for brush to brush primitive conversion
void EmitTextureCoordinates ( idVec5 &xyzst, const idMaterial *q, face_t *f, bool force = false); void EmitTextureCoordinates ( idVec5 &xyzst, const idMaterial *q, face_t *f, bool force = false);
void BrushPrimit_Parse(brush_t *, bool newFormat, const idVec3 origin);
// compute a fake shift scale rot representation from the texture matrix // compute a fake shift scale rot representation from the texture matrix
void TexMatToFakeTexCoords( float texMat[2][3], float shift[2], float *rot, float scale[2] ); void TexMatToFakeTexCoords( float texMat[2][3], float shift[2], float *rot, float scale[2] );
void FakeTexCoordsToTexMat( float shift[2], float rot, float scale[2], float texMat[2][3] ); void FakeTexCoordsToTexMat( float shift[2], float rot, float scale[2], float texMat[2][3] );
@@ -472,11 +470,11 @@ extern void Map_ImportFile (char *filename);
extern void Map_SaveSelected(char* pFilename); extern void Map_SaveSelected(char* pFilename);
extern bool g_bNewFace; extern bool g_bNewFace;
extern bool g_bSwitch; extern bool g_bSwitch;
extern brush_t g_brFrontSplits; extern idEditorBrush g_brFrontSplits;
extern brush_t g_brBackSplits; extern idEditorBrush g_brBackSplits;
extern CClipPoint g_Clip1; extern CClipPoint g_Clip1;
extern CClipPoint g_Clip2; extern CClipPoint g_Clip2;
extern brush_t* g_pSplitList; extern idEditorBrush* g_pSplitList;
extern CClipPoint g_PathPoints[256]; extern CClipPoint g_PathPoints[256];
extern void AcquirePath(int nCount, PFNPathCallback* pFunc); extern void AcquirePath(int nCount, PFNPathCallback* pFunc);
extern bool g_bScreenUpdates; extern bool g_bScreenUpdates;
@@ -501,7 +499,7 @@ extern void DoPatchInspector();
void UpdatePatchInspector(); void UpdatePatchInspector();
extern int g_nSmartX; extern int g_nSmartX;
extern int g_nSmartY; extern int g_nSmartY;
extern brush_t* CreateEntityBrush(int x, int y, CXYWnd* pWnd); extern idEditorBrush* CreateEntityBrush(int x, int y, CXYWnd* pWnd);
int PointInMoveList( idVec3 *pf ); int PointInMoveList( idVec3 *pf );
extern bool ByeByeSurfaceDialog(); extern bool ByeByeSurfaceDialog();
+64 -11
View File
@@ -225,8 +225,9 @@ typedef struct {
#define PATCH_STYLEMASK 0xffff0000 // #define PATCH_STYLEMASK 0xffff0000 //
struct brush_s; class idEditorBrush;
typedef struct brush_s brush_t; class idEditorEntity;
class CMemFile;
typedef struct { typedef struct {
int width, height; // in control points, not patches int width, height; // in control points, not patches
@@ -237,7 +238,7 @@ typedef struct {
const idMaterial *d_texture; const idMaterial *d_texture;
idDrawVert *verts; idDrawVert *verts;
//idDrawVert *ctrl; //idDrawVert *ctrl;
brush_t * pSymbiot; idEditorBrush * pSymbiot;
bool bSelected; bool bSelected;
bool bOverlay; bool bOverlay;
int nListID; int nListID;
@@ -274,12 +275,12 @@ enum {
}; };
typedef struct brush_s class idEditorBrush {
{ public:
struct brush_s *prev, *next; // links in active/selected idEditorBrush *prev, *next; // links in active/selected
struct brush_s *oprev, *onext; // links in entity idEditorBrush *oprev, *onext; // links in entity
brush_t * list; //keep a handy link to the list its in idEditorBrush * list; //keep a handy link to the list its in
struct entity_s *owner; idEditorEntity *owner;
idVec3 mins, maxs; idVec3 mins, maxs;
idVec3 lightCenter; // for moving the shading center of point lights idVec3 lightCenter; // for moving the shading center of point lights
@@ -309,7 +310,7 @@ typedef struct brush_s
bool forceVisibile; bool forceVisibile;
patchMesh_t *pPatch; patchMesh_t *pPatch;
struct entity_s *pUndoOwner; idEditorEntity *pUndoOwner;
int undoId; //undo ID int undoId; //undo ID
int redoId; //redo ID int redoId; //redo ID
@@ -329,7 +330,59 @@ typedef struct brush_s
// brush primitive only // brush primitive only
idDict epairs; idDict epairs;
} brush_t; const char *Brush_Name();
int Brush_MemorySize();
void Brush_Move(const idVec3 move, bool bSnap = true, bool updateOrigin = true);
int Brush_MoveVertex(const idVec3& vertex, const idVec3& delta, idVec3& end, bool bSnap);
void Brush_ResetFaceOriginals();
void Brush_MakeFacePlanes();
face_t *Brush_Ray(idVec3 origin, idVec3 dir, float *dist, bool testPrimitive = false);
face_t *Brush_Point(idVec3 origin);
void Brush_RemoveFromList();
void Brush_AddToList(idEditorBrush *list);
void Brush_Build(bool bSnap = true, bool bMarkMap = true, bool bConvert = false, bool updateLights = true);
void Brush_BuildWindings(bool bSnap = true, bool keepOnPlaneWinding = false, bool updateLights = true, bool makeFacePlanes = true);
bool Brush_ModelIntersect(idVec3 origin, idVec3 dir, float& scale);
void Brush_Draw(bool bSelected = false);
void Brush_DrawXY(int nViewType, bool bSelected = false, bool ignoreViewType = false);
void Brush_DrawCurve(bool bSelected, bool cam);
void Brush_DrawFacingAngle(idEditorEntity *e, bool particle);
void Brush_DrawModel(bool camera, bool bSelected);
void Brush_DrawAxis();
void Brush_DrawModelInfo(bool selected);
void Brush_DrawEmitter(bool bSelected, bool cam);
void Brush_DrawEnv(bool cameraView, bool bSelected);
void Brush_DrawCombatNode(bool cameraView, bool bSelected);
void Brush_SelectFaceForDragging(face_t *f, bool shear);
void Brush_SetTexture(texdef_t *texdef, brushprimit_texdef_t *brushprimit_texdef, bool bFitScale = false);
void Brush_SideSelect(idVec3 origin, idVec3 dir, bool shear);
void Brush_SnapToGrid();
void Brush_Rotate(idMat3 matrix, idVec3 origin, bool bBuild = true);
void Brush_Rotate(idVec3 vAngle, idVec3 vOrigin, bool bBuild = true);
void Brush_Center(idVec3 vNewCenter);
void Brush_Resize(idVec3 vMin, idVec3 vMax);
void Brush_Scale();
void Brush_Write(FILE *f, const idVec3& origin, bool newFormat);
void Brush_Write(CMemFile *pMemFile, const idVec3& origin, bool newFormat);
void Brush_RemoveEmptyFaces();
idWinding *Brush_MakeFaceWinding(face_t *face, bool keepOnPlaneWinding = false);
int Brush_Convex();
int Brush_InsertVertexBetween(idVec3 p1, idVec3 p2);
face_t *Brush_BestSplitFace();
void Brush_SetTextureName(const char *name);
void Brush_Print();
void Brush_FitTexture(float height, float width);
void Brush_SetEpair(const char *pKey, const char *pValue);
const char *Brush_GetKeyValue(const char *pKey);
void Brush_RebuildBrush(idVec3 vMins, idVec3 vMaxs, bool patch = true);
void Brush_GetBounds(idBounds& bo);
void Brush_GetBounds(idVec3& mins, idVec3& maxs);
idMat3 Brush_RotationMatrix();
idVec3 Brush_TransformedPoint(const idVec3& in);
void Brush_UpdateLightPoints(const idVec3& offset);
void BrushPrimit_Parse(bool newFormat, const idVec3 origin);
void Brush_FlipTexture_BrushPrimit(bool y);
};
#define MAX_FLAGS 8 #define MAX_FLAGS 8
+144 -149
View File
@@ -38,14 +38,12 @@ CPtrArray g_SelectedFaceBrushes;
CPtrArray &g_ptrSelectedFaces = g_SelectedFaces; CPtrArray &g_ptrSelectedFaces = g_SelectedFaces;
CPtrArray &g_ptrSelectedFaceBrushes = g_SelectedFaceBrushes; 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) { qertrace_t Test_Ray(const idVec3 &origin, const idVec3 &dir, int flags) {
brush_t *brush; idEditorBrush *brush;
face_t *face; face_t *face;
float dist; float dist;
qertrace_t t; qertrace_t t;
@@ -66,7 +64,7 @@ qertrace_t Test_Ray(const idVec3 &origin, const idVec3 &dir, int flags) {
if (flags & SF_CYCLE) { if (flags & SF_CYCLE) {
CPtrArray array; 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(); Select_Deselect();
// go through active brushes and accumulate all "hit" brushes // 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; // if (!g_bShowPatchBounds && brush->pPatch) continue;
face = Brush_Ray(origin, dir, brush, &dist, true); face = brush->Brush_Ray(origin, dir, &dist, true);
if (face) { if (face) {
array.Add(brush); array.Add(brush);
@@ -100,25 +98,25 @@ qertrace_t Test_Ray(const idVec3 &origin, const idVec3 &dir, int flags) {
if (nSize > 0) { if (nSize > 0) {
bool bFound = false; bool bFound = false;
for (int i = 0; i < nSize; i++) { 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 ? // did we hit the last one selected yet ?
if (b == pToSelect) { if (b == pToSelect) {
// yes we want to select the next one in the list // yes we want to select the next one in the list
int n = (i > 0) ? i - 1 : nSize - 1; 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; bFound = true;
break; break;
} }
} }
if (!bFound) { if (!bFound) {
pToSelect = reinterpret_cast < brush_t * > (array.GetAt(0)); pToSelect = reinterpret_cast < idEditorBrush * > (array.GetAt(0));
} }
} }
if (pToSelect) { if (pToSelect) {
face = Brush_Ray(origin, dir, pToSelect, &dist, true); face = pToSelect->Brush_Ray(origin, dir, &dist, true);
t.dist = dist; t.dist = dist;
t.brush = pToSelect; t.brush = pToSelect;
t.face = face; 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) { if (dist > 0 && dist < t.dist) {
t.dist = dist; t.dist = dist;
t.brush = brush; 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) { if (dist > 0 && dist < t.dist) {
t.dist = dist; t.dist = dist;
t.brush = brush; t.brush = brush;
@@ -197,18 +195,17 @@ qertrace_t Test_Ray(const idVec3 &origin, const idVec3 &dir, int flags) {
return t; return t;
} }
extern void AddSelectablePoint(brush_t *b, idVec3 v, int type, bool priority); extern void AddSelectablePoint(idEditorBrush *b, idVec3 v, int type, bool priority);
extern void ClearSelectablePoints(brush_t *b); extern void ClearSelectablePoints(idEditorBrush *b);
extern idVec3 Brush_TransformedPoint(brush_t *b, const idVec3 &in);
/* /*
======================================================================================================================= =======================================================================================================================
Select_Brush Select_Brush
======================================================================================================================= =======================================================================================================================
*/ */
void Select_Brush(brush_t *brush, bool bComplete, bool bStatus) { void Select_Brush(idEditorBrush *brush, bool bComplete, bool bStatus) {
brush_t *b; idEditorBrush *b;
entity_t *e; idEditorEntity *e;
g_ptrSelectedFaces.RemoveAll(); g_ptrSelectedFaces.RemoveAll();
g_ptrSelectedFaceBrushes.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) { for (b = e->brushes.onext; b != &e->brushes; b = b->onext) {
Brush_RemoveFromList(b); b->Brush_RemoveFromList();
Brush_AddToList(b, &selected_brushes); b->Brush_AddToList(&selected_brushes);
} }
} }
else else
{ {
singleselect: singleselect:
Brush_RemoveFromList(brush); brush->Brush_RemoveFromList();
Brush_AddToList(brush, &selected_brushes); brush->Brush_AddToList(&selected_brushes);
UpdateSurfaceDialog(); UpdateSurfaceDialog();
UpdatePatchInspector(); UpdatePatchInspector();
UpdateLightInspector(); UpdateLightInspector();
@@ -252,7 +249,7 @@ singleselect:
if (e->eclass) { if (e->eclass) {
g_Inspectors->UpdateEntitySel(brush->owner->eclass); g_Inspectors->UpdateEntitySel(brush->owner->eclass);
if ( radiant_entityMode.GetBool() && e->eclass->nShowFlags & (ECLASS_LIGHT | ECLASS_SPEAKER) ) { 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) { if (p && *p) {
g_Inspectors->mediaDlg.SelectCurrentItem(true, p, CDialogTextures::SOUNDS); g_Inspectors->mediaDlg.SelectCurrentItem(true, p, CDialogTextures::SOUNDS);
} }
@@ -262,16 +259,16 @@ singleselect:
if (brush->pointLight) { if (brush->pointLight) {
// add center drag point if not at the origin // add center drag point if not at the origin
if (brush->lightCenter[0] || brush->lightCenter[1] || brush->lightCenter[2]) { 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 { else {
AddSelectablePoint(brush, Brush_TransformedPoint(brush, brush->lightTarget), LIGHT_TARGET, true); AddSelectablePoint(brush, brush->Brush_TransformedPoint(brush->lightTarget), LIGHT_TARGET, true);
AddSelectablePoint(brush, Brush_TransformedPoint(brush, brush->lightUp), LIGHT_UP, false); AddSelectablePoint(brush, brush->Brush_TransformedPoint(brush->lightUp), LIGHT_UP, false);
AddSelectablePoint(brush, Brush_TransformedPoint(brush, brush->lightRight), LIGHT_RIGHT, false); AddSelectablePoint(brush, brush->Brush_TransformedPoint(brush->lightRight), LIGHT_RIGHT, false);
if (brush->startEnd) { if (brush->startEnd) {
AddSelectablePoint(brush, Brush_TransformedPoint(brush, brush->lightStart), LIGHT_START, false); AddSelectablePoint(brush, brush->Brush_TransformedPoint(brush->lightStart), LIGHT_START, false);
AddSelectablePoint(brush, Brush_TransformedPoint(brush, brush->lightEnd), LIGHT_END, false); AddSelectablePoint(brush, brush->Brush_TransformedPoint(brush->lightEnd), LIGHT_END, false);
} }
} }
UpdateLightInspector(); UpdateLightInspector();
@@ -326,8 +323,8 @@ void Select_Ray(idVec3 origin, idVec3 dir, int flags) {
face_t *face; face_t *face;
// DeSelect brush // DeSelect brush
Brush_RemoveFromList(t.brush); t.brush->Brush_RemoveFromList();
Brush_AddToList(t.brush, &active_brushes); t.brush->Brush_AddToList(&active_brushes);
// Select all brush faces // Select all brush faces
for ( face = t.brush->brush_faces; face; face = face->next ) { 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; g_qeglobals.d_select_mode = sel_brush;
if (t.selected) { if (t.selected) {
Brush_RemoveFromList(t.brush); t.brush->Brush_RemoveFromList();
Brush_AddToList(t.brush, &active_brushes); t.brush->Brush_AddToList(&active_brushes);
UpdatePatchInspector(); UpdatePatchInspector();
UpdateSurfaceDialog(); UpdateSurfaceDialog();
entity_t *e = t.brush->owner; idEditorEntity *e = t.brush->owner;
if (e->eclass->nShowFlags & ECLASS_LIGHT && !t.brush->entityModel) { if (e->eclass->nShowFlags & ECLASS_LIGHT && !t.brush->entityModel) {
if (t.brush->pointLight) { if (t.brush->pointLight) {
} }
@@ -396,7 +393,7 @@ void Select_Ray(idVec3 origin, idVec3 dir, int flags) {
======================================================================================================================= =======================================================================================================================
*/ */
void Select_Delete(void) { void Select_Delete(void) {
brush_t *brush; idEditorBrush *brush;
g_ptrSelectedFaces.RemoveAll(); g_ptrSelectedFaces.RemoveAll();
g_ptrSelectedFaceBrushes.RemoveAll(); g_ptrSelectedFaceBrushes.RemoveAll();
@@ -425,7 +422,7 @@ void Select_Delete(void) {
======================================================================================================================= =======================================================================================================================
*/ */
void Select_Deselect(bool bDeselectFaces) { void Select_Deselect(bool bDeselectFaces) {
brush_t *b; idEditorBrush *b;
ClearSelectablePoints(NULL); ClearSelectablePoints(NULL);
Patch_Deselect(); Patch_Deselect();
@@ -481,14 +478,14 @@ void Select_Deselect(bool bDeselectFaces) {
======================================================================================================================= =======================================================================================================================
*/ */
void Select_Move(idVec3 delta, bool bSnap) { void Select_Move(idVec3 delta, bool bSnap) {
brush_t *b; idEditorBrush *b;
// actually move the selected brushes // actually move the selected brushes
bool updateOrigin = true; 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) { 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) { if (updateOrigin) {
updateOrigin = false; 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) { 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(); int nCount = g_ptrSelectedFaces.GetSize();
if (nCount > 0) { if (nCount > 0) {
Undo_Start("set face textures"); Undo_Start("set face textures");
ASSERT(g_ptrSelectedFaces.GetSize() == g_ptrSelectedFaceBrushes.GetSize()); ASSERT(g_ptrSelectedFaces.GetSize() == g_ptrSelectedFaceBrushes.GetSize());
for (int i = 0; i < nCount; i++) { for (int i = 0; i < nCount; i++) {
face_t *selFace = reinterpret_cast < face_t * > (g_ptrSelectedFaces.GetAt(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); Undo_AddBrush(selBrush);
SetFaceTexdef(selBrush,selFace,texdef,brushprimit_texdef,bFitScale); SetFaceTexdef(selBrush,selFace,texdef,brushprimit_texdef,bFitScale);
Brush_Build(selBrush, bFitScale); selBrush->Brush_Build(bFitScale);
Undo_EndBrush(selBrush); 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) { for (b = selected_brushes.next; b != &selected_brushes; b = b->next) {
if (!b->owner->eclass->fixedsize) { if (!b->owner->eclass->fixedsize) {
Undo_AddBrush(b); Undo_AddBrush(b);
Brush_SetTexture(b, texdef, brushprimit_texdef, bFitScale); b->Brush_SetTexture(texdef, brushprimit_texdef, bFitScale);
Undo_EndBrush(b); Undo_EndBrush(b);
} else if (b->owner->eclass->nShowFlags & ECLASS_LIGHT) { } else if (b->owner->eclass->nShowFlags & ECLASS_LIGHT) {
if ( idStr::Cmpn(texdef->name, "lights/", strlen("lights/")) == 0 ) { 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); g_Inspectors->UpdateEntitySel(b->owner->eclass);
UpdateLightInspector(); UpdateLightInspector();
Brush_Build(b); b->Brush_Build();
} else { } else {
Undo_AddBrush(b); Undo_AddBrush(b);
Brush_SetTexture(b, texdef, brushprimit_texdef, bFitScale); b->Brush_SetTexture(texdef, brushprimit_texdef, bFitScale);
Undo_EndBrush(b); 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) { void Select_GetBounds(idVec3 &mins, idVec3 &maxs) {
brush_t *b; idEditorBrush *b;
int i; int i;
for (i = 0; i < 3; i++) { for (i = 0; i < 3; i++) {
@@ -656,7 +653,7 @@ int select_flipAxis;
float select_orgDeg; float select_orgDeg;
void Select_InitializeRotation() { 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 (face_t *f = b->brush_faces; f; f = f->next) {
for (int i = 0; i < 3; i++) { for (int i = 0; i < 3; i++) {
f->orgplanepts[i] = f->planepts[i]; f->orgplanepts[i] = f->planepts[i];
@@ -671,7 +668,7 @@ void Select_FinalizeRotation() {
} }
bool Select_OnlyModelsSelected() { 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) { if (!b->modelHandle) {
return false; return false;
} }
@@ -679,7 +676,7 @@ bool Select_OnlyModelsSelected() {
return true; return true;
} }
bool OkForRotationKey(brush_t *b) { bool OkForRotationKey(idEditorBrush *b) {
if (b->owner->eclass->nShowFlags & ECLASS_WORLDSPAWN) { if (b->owner->eclass->nShowFlags & ECLASS_WORLDSPAWN) {
return false; 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) { void Select_ApplyMatrix(bool bSnap, bool rotateOrigins) {
brush_t *b; idEditorBrush *b;
face_t *f; face_t *f;
int i; int i;
idVec3 temp; idVec3 temp;
idStr str; idStr str;
char text[128]; char text[128];
entity_t *lastOwner = NULL; idEditorEntity *lastOwner = NULL;
for (b = selected_brushes.next; b != &selected_brushes; b = b->next) { for (b = selected_brushes.next; b != &selected_brushes; b = b->next) {
@@ -765,11 +760,11 @@ void Select_ApplyMatrix(bool bSnap, bool rotateOrigins) {
if (rotateOrigins) { if (rotateOrigins) {
b->owner->rotation *= select_matrix; b->owner->rotation *= select_matrix;
b->owner->origin *= select_rotation; b->owner->origin *= select_rotation;
SetKeyVec3(b->owner, "origin", b->owner->origin); b->owner->SetKeyVec3("origin", b->owner->origin);
if (b->trackLightOrigin) { if (b->trackLightOrigin) {
b->owner->lightRotation *= select_matrix; b->owner->lightRotation *= select_matrix;
b->owner->lightOrigin *= select_rotation; b->owner->lightOrigin *= select_rotation;
SetKeyVec3(b->owner, "light_origin", b->owner->lightOrigin); b->owner->SetKeyVec3("light_origin", b->owner->lightOrigin);
} }
} else { } else {
@@ -806,7 +801,7 @@ void Select_ApplyMatrix(bool bSnap, bool rotateOrigins) {
bo2 = b->modelHandle->Bounds(); bo2 = b->modelHandle->Bounds();
} }
bo.FromTransformedBounds(bo2, b->owner->origin, b->owner->rotation); 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; doBrush = false;
} }
if (b->owner->eclass->fixedsize) { if (b->owner->eclass->fixedsize) {
@@ -820,7 +815,7 @@ void Select_ApplyMatrix(bool bSnap, bool rotateOrigins) {
b->owner->origin += select_origin; 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]); 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], 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[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]); b->owner->rotation[2][1],b->owner->rotation[2][2]);
SetKeyValue(b->owner, "rotation", str); b->owner->SetKeyValue("rotation", str);
} }
if (b->trackLightOrigin) { 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], 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[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]); 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"); b->owner->DeleteKey("angle");
DeleteKey(b->owner, "angles"); b->owner->DeleteKey("angles");
} }
if (doBrush) { if (doBrush) {
@@ -865,9 +860,9 @@ void Select_ApplyMatrix(bool bSnap, bool rotateOrigins) {
min = b->owner->origin + b->owner->eclass->mins; min = b->owner->origin + b->owner->eclass->mins;
max = b->owner->origin + b->owner->eclass->maxs; max = b->owner->origin + b->owner->eclass->maxs;
} }
Brush_Resize(b, min, max); b->Brush_Resize(min, max);
} else { } else {
Brush_Build(b, bSnap); b->Brush_Build(bSnap);
} }
if (b->pPatch) { if (b->pPatch) {
@@ -923,7 +918,7 @@ void RotateFaceTexture(face_t *f, int nAxis, float fDeg) {
======================================================================================================================= =======================================================================================================================
*/ */
void RotateTextures(int nAxis, float fDeg, idVec3 vOrigin) { 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) { for (face_t * f = b->brush_faces; f; f = f->next) {
if (g_qeglobals.m_bBrushPrimitMode) { if (g_qeglobals.m_bBrushPrimitMode) {
RotateFaceTexture_BrushPrimit(f, nAxis, fDeg, vOrigin); RotateFaceTexture_BrushPrimit(f, nAxis, fDeg, vOrigin);
@@ -932,10 +927,10 @@ void RotateTextures(int nAxis, float fDeg, idVec3 vOrigin) {
RotateFaceTexture(f, nAxis, fDeg); 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() { 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) { for (face_t * f = b->brush_faces; f; f = f->next) {
ApplyMatrix_BrushPrimit(f, select_matrix, select_origin); 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) { void Select_Scale(float x, float y, float z) {
Select_GetMid(select_origin); 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 (face_t * f = b->brush_faces; f; f = f->next) {
for (int i = 0; i < 3; i++) { for (int i = 0; i < 3; i++) {
f->planepts[i][0] -= select_origin[0]; 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) { if (b->pPatch) {
idVec3 v; idVec3 v;
v[0] = x; v[0] = x;
@@ -1278,7 +1273,7 @@ void Select_Scale(float x, float y, float z) {
======================================================================================================================= =======================================================================================================================
*/ */
void Select_CompleteTall(void) { void Select_CompleteTall(void) {
brush_t *b, *next; idEditorBrush *b, *next;
// int i; // int i;
idVec3 mins, maxs; idVec3 mins, maxs;
@@ -1312,8 +1307,8 @@ void Select_CompleteTall(void) {
continue; continue;
} }
Brush_RemoveFromList(b); b->Brush_RemoveFromList();
Brush_AddToList(b, &selected_brushes); b->Brush_AddToList(&selected_brushes);
} }
Sys_UpdateWindows(W_ALL); Sys_UpdateWindows(W_ALL);
@@ -1324,7 +1319,7 @@ void Select_CompleteTall(void) {
======================================================================================================================= =======================================================================================================================
*/ */
void Select_PartialTall(void) { void Select_PartialTall(void) {
brush_t *b, *next; idEditorBrush *b, *next;
// int i; // int i;
idVec3 mins, maxs; idVec3 mins, maxs;
@@ -1357,8 +1352,8 @@ void Select_PartialTall(void) {
continue; continue;
} }
Brush_RemoveFromList(b); b->Brush_RemoveFromList();
Brush_AddToList(b, &selected_brushes); b->Brush_AddToList(&selected_brushes);
#if 0 #if 0
// old stuff // old stuff
@@ -1369,8 +1364,8 @@ void Select_PartialTall(void) {
} }
if (i == 2) { if (i == 2) {
Brush_RemoveFromList(b); b->Brush_RemoveFromList();
Brush_AddToList(b, &selected_brushes); b->Brush_AddToList(&selected_brushes);
} }
#endif #endif
} }
@@ -1383,7 +1378,7 @@ void Select_PartialTall(void) {
======================================================================================================================= =======================================================================================================================
*/ */
void Select_Touching(void) { void Select_Touching(void) {
brush_t *b, *next; idEditorBrush *b, *next;
int i; int i;
idVec3 mins, maxs; idVec3 mins, maxs;
@@ -1410,8 +1405,8 @@ void Select_Touching(void) {
} }
if (i == 3) { if (i == 3) {
Brush_RemoveFromList(b); b->Brush_RemoveFromList();
Brush_AddToList(b, &selected_brushes); b->Brush_AddToList(&selected_brushes);
} }
} }
@@ -1423,7 +1418,7 @@ void Select_Touching(void) {
======================================================================================================================= =======================================================================================================================
*/ */
void Select_Inside(void) { void Select_Inside(void) {
brush_t *b, *next; idEditorBrush *b, *next;
int i; int i;
idVec3 mins, maxs; idVec3 mins, maxs;
@@ -1451,8 +1446,8 @@ void Select_Inside(void) {
} }
if (i == 3) { if (i == 3) {
Brush_RemoveFromList(b); b->Brush_RemoveFromList();
Brush_AddToList(b, &selected_brushes); b->Brush_AddToList(&selected_brushes);
} }
} }
@@ -1466,8 +1461,8 @@ void Select_Inside(void) {
*/ */
void Select_Ungroup() { void Select_Ungroup() {
int numselectedgroups; int numselectedgroups;
entity_t *e; idEditorEntity *e;
brush_t *b, *sb; idEditorBrush *b, *sb;
numselectedgroups = 0; numselectedgroups = 0;
for (sb = selected_brushes.next; sb != &selected_brushes; sb = sb->next) { 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) { for (b = e->brushes.onext; b != &e->brushes; b = e->brushes.onext) {
Entity_UnlinkBrush(b); idEditorEntity::Entity_UnlinkBrush(b);
Entity_LinkBrush(world_entity, b); world_entity->Entity_LinkBrush(b);
Brush_Build(b); b->Brush_Build();
b->owner = world_entity; b->owner = world_entity;
} }
Entity_Free(e); idEditorEntity::Entity_Free(e);
numselectedgroups++; numselectedgroups++;
} }
@@ -1502,7 +1497,7 @@ void Select_Ungroup() {
======================================================================================================================= =======================================================================================================================
*/ */
void Select_ShiftTexture(float x, float y, bool autoAdjust) { void Select_ShiftTexture(float x, float y, bool autoAdjust) {
brush_t *b; idEditorBrush *b;
face_t *f; face_t *f;
int nFaceCount = g_ptrSelectedFaces.GetSize(); 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) { if (b->pPatch) {
// Patch_ShiftTexture(b->nPatchID, x, y); // Patch_ShiftTexture(b->nPatchID, x, y);
Patch_ShiftTexture(b->pPatch, x, y, autoAdjust); Patch_ShiftTexture(b->pPatch, x, y, autoAdjust);
@@ -1536,7 +1531,7 @@ void Select_ShiftTexture(float x, float y, bool autoAdjust) {
if (nFaceCount > 0) { if (nFaceCount > 0) {
for (int i = 0; i < nFaceCount; i++) { for (int i = 0; i < nFaceCount; i++) {
face_t *selFace = reinterpret_cast < face_t * > (g_ptrSelectedFaces.GetAt(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 (g_qeglobals.m_bBrushPrimitMode) {
// //
// use face normal to compute a true translation Select_ShiftTexture_BrushPrimit( // 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; 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) { void Select_ScaleTexture(float x, float y, bool update, bool absolute) {
brush_t *b; idEditorBrush *b;
face_t *f; face_t *f;
int nFaceCount = g_ptrSelectedFaces.GetSize(); 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) { if (b->pPatch) {
Patch_ScaleTexture(b->pPatch, x, y, absolute); 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) { if (nFaceCount > 0) {
for (int i = 0; i < nFaceCount; i++) { for (int i = 0; i < nFaceCount; i++) {
face_t *selFace = reinterpret_cast < face_t * > (g_ptrSelectedFaces.GetAt(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 (g_qeglobals.m_bBrushPrimitMode) {
if (absolute) { if (absolute) {
Face_SetExplicitScale_BrushPrimit(selFace, x, y); 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; 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) { void Select_RotateTexture(float amt, bool absolute) {
brush_t *b; idEditorBrush *b;
face_t *f; face_t *f;
int nFaceCount = g_ptrSelectedFaces.GetSize(); 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) { if (b->pPatch) {
// Patch_RotateTexture(b->nPatchID, amt); // Patch_RotateTexture(b->nPatchID, amt);
Patch_RotateTexture(b->pPatch, amt); Patch_RotateTexture(b->pPatch, amt);
@@ -1660,7 +1655,7 @@ void Select_RotateTexture(float amt, bool absolute) {
if (nFaceCount > 0) { if (nFaceCount > 0) {
for (int i = 0; i < nFaceCount; i++) { for (int i = 0; i < nFaceCount; i++) {
face_t *selFace = reinterpret_cast < face_t * > (g_ptrSelectedFaces.GetAt(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 (g_qeglobals.m_bBrushPrimitMode) {
idVec3 org; idVec3 org;
org.Zero(); org.Zero();
@@ -1672,7 +1667,7 @@ void Select_RotateTexture(float amt, bool absolute) {
selFace->texdef.rotate = static_cast<int>(selFace->texdef.rotate) % 360; 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) { 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) { if (!bSelected) {
Select_Deselect(); 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) { if (pBrush->pPatch) {
Patch_FindReplaceTexture(pBrush, pFind, pReplace, bForce); 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); Sys_UpdateWindows(W_CAMERA);
@@ -1715,8 +1710,8 @@ void FindReplaceTextures(const char *pFind, const char *pReplace, bool bSelected
======================================================================================================================= =======================================================================================================================
*/ */
void Select_AllOfType() { void Select_AllOfType() {
brush_t *b, *next; idEditorBrush *b, *next;
entity_t *e; idEditorEntity *e;
if ((selected_brushes.next == &selected_brushes) || (selected_brushes.next->next != &selected_brushes)) { if ((selected_brushes.next == &selected_brushes) || (selected_brushes.next->next != &selected_brushes)) {
CString strName; CString strName;
if (g_ptrSelectedFaces.GetSize() == 0) { if (g_ptrSelectedFaces.GetSize() == 0) {
@@ -1737,15 +1732,15 @@ void Select_AllOfType() {
if (b->pPatch) { if (b->pPatch) {
if ( idStr::Icmp(strName, b->pPatch->d_texture->GetName()) == 0 ) { if ( idStr::Icmp(strName, b->pPatch->d_texture->GetName()) == 0 ) {
Brush_RemoveFromList(b); b->Brush_RemoveFromList();
Brush_AddToList(b, &selected_brushes); b->Brush_AddToList(&selected_brushes);
} }
} }
else { else {
for (face_t * pFace = b->brush_faces; pFace; pFace = pFace->next) { for (face_t * pFace = b->brush_faces; pFace; pFace = pFace->next) {
if ( idStr::Icmp(strName, pFace->texdef.name) == 0 ) { if ( idStr::Icmp(strName, pFace->texdef.name) == 0 ) {
Brush_RemoveFromList(b); b->Brush_RemoveFromList();
Brush_AddToList(b, &selected_brushes); b->Brush_AddToList(&selected_brushes);
} }
} }
} }
@@ -1777,15 +1772,15 @@ void Select_AllOfType() {
if ( idStr::Icmp(e->eclass->name, strName) == 0 ) { if ( idStr::Icmp(e->eclass->name, strName) == 0 ) {
bool doIt = true; bool doIt = true;
if (bCriteria) { if (bCriteria) {
CString str = ValueForKey(e, strKey); CString str = e->ValueForKey(strKey);
if (str.CompareNoCase(strVal) != 0) { if (str.CompareNoCase(strVal) != 0) {
doIt = false; doIt = false;
} }
} }
if (doIt) { if (doIt) {
Brush_RemoveFromList(b); b->Brush_RemoveFromList();
Brush_AddToList(b, &selected_brushes); b->Brush_AddToList(&selected_brushes);
} }
} }
} }
@@ -1807,14 +1802,14 @@ void Select_AllOfType() {
*/ */
void Select_Reselect() { void Select_Reselect() {
CPtrArray holdArray; CPtrArray holdArray;
brush_t *b; idEditorBrush *b;
for ( b = selected_brushes.next; b && b != &selected_brushes; b = b->next ) { for ( b = selected_brushes.next; b && b != &selected_brushes; b = b->next ) {
holdArray.Add(reinterpret_cast < void * > (b)); holdArray.Add(reinterpret_cast < void * > (b));
} }
int n = holdArray.GetSize(); int n = holdArray.GetSize();
while (n-- > 0) { while (n-- > 0) {
b = reinterpret_cast < brush_t * > (holdArray.GetAt(n)); b = reinterpret_cast < idEditorBrush * > (holdArray.GetAt(n));
Select_Brush(b); Select_Brush(b);
} }
@@ -1826,7 +1821,7 @@ void Select_Reselect() {
======================================================================================================================= =======================================================================================================================
*/ */
void Select_FitTexture(float height, float width) { void Select_FitTexture(float height, float width) {
brush_t *b; idEditorBrush *b;
int nFaceCount = g_ptrSelectedFaces.GetSize(); int nFaceCount = g_ptrSelectedFaces.GetSize();
if (selected_brushes.next == &selected_brushes && nFaceCount == 0) { 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); Patch_FitTexture(b->pPatch, width, height);
} }
else { else {
Brush_FitTexture(b, height, width); b->Brush_FitTexture(height, width);
Brush_Build(b); b->Brush_Build();
} }
} }
if (nFaceCount > 0) { if (nFaceCount > 0) {
for (int i = 0; i < nFaceCount; i++) { for (int i = 0; i < nFaceCount; i++) {
face_t *selFace = reinterpret_cast < face_t * > (g_ptrSelectedFaces.GetAt(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); Face_FitTexture(selFace, height, width);
Brush_Build(selBrush); selBrush->Brush_Build();
} }
} }
@@ -1871,11 +1866,11 @@ void Select_AxialTexture() {
void Select_Hide(bool invert) { void Select_Hide(bool invert) {
if (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; b->hiddenBrush = true;
} }
} else { } 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; b->hiddenBrush = true;
} }
} }
@@ -1883,14 +1878,14 @@ void Select_Hide(bool invert) {
} }
void Select_WireFrame( bool wireFrame ) { 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; b->forceWireFrame = wireFrame;
} }
Sys_UpdateWindows(W_ALL); Sys_UpdateWindows(W_ALL);
} }
void Select_ForceVisible( bool visible ) { 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; b->forceVisibile = visible;
} }
Sys_UpdateWindows(W_ALL); Sys_UpdateWindows(W_ALL);
@@ -1901,7 +1896,7 @@ void Select_ForceVisible( bool visible ) {
======================================================================================================================= =======================================================================================================================
*/ */
void Select_ShowAllHidden() { void Select_ShowAllHidden() {
brush_t *b; idEditorBrush *b;
for (b = selected_brushes.next; b && b != &selected_brushes; b = b->next) { for (b = selected_brushes.next; b && b != &selected_brushes; b = b->next) {
b->hiddenBrush = false; b->hiddenBrush = false;
} }
@@ -1919,7 +1914,7 @@ void Select_ShowAllHidden() {
======================================================================================================================= =======================================================================================================================
*/ */
void Select_Invert(void) { void Select_Invert(void) {
brush_t *next, *prev; idEditorBrush *next, *prev;
Sys_Status("inverting selection...\n"); Sys_Status("inverting selection...\n");
@@ -1959,8 +1954,8 @@ void Select_Invert(void) {
*/ */
void Select_Name(const char *pName) { void Select_Name(const char *pName) {
if (g_qeglobals.m_bBrushPrimitMode) { if (g_qeglobals.m_bBrushPrimitMode) {
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) {
Brush_SetEpair(b, "Name", pName); b->Brush_SetEpair("Name", pName);
} }
} }
} }
@@ -1975,13 +1970,13 @@ void Select_CenterOrigin() {
Select_GetTrueMid(mid); Select_GetTrueMid(mid);
mid.Snap(); mid.Snap();
brush_t *b = selected_brushes.next; idEditorBrush *b = selected_brushes.next;
entity_t *e = b->owner; idEditorEntity *e = b->owner;
if (e != NULL) { if (e != NULL) {
if (e != world_entity) { if (e != world_entity) {
char text[1024]; char text[1024];
sprintf(text, "%i %i %i", (int)mid[0], (int)mid[1], (int)mid[2]); 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); 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()); 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) { void Select_UpdateTextureName(const char *name) {
brush_t *b; idEditorBrush *b;
int nCount = g_ptrSelectedFaces.GetSize(); int nCount = g_ptrSelectedFaces.GetSize();
if (nCount > 0) { if (nCount > 0) {
Undo_Start("set face texture name"); Undo_Start("set face texture name");
ASSERT(g_ptrSelectedFaces.GetSize() == g_ptrSelectedFaceBrushes.GetSize()); ASSERT(g_ptrSelectedFaces.GetSize() == g_ptrSelectedFaceBrushes.GetSize());
for (int i = 0; i < nCount; i++) { for (int i = 0; i < nCount; i++) {
face_t *selFace = reinterpret_cast < face_t * > (g_ptrSelectedFaces.GetAt(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); Undo_AddBrush(selBrush);
selFace->texdef.SetName(name); selFace->texdef.SetName(name);
Brush_Build(selBrush); selBrush->Brush_Build();
Undo_EndBrush(selBrush); Undo_EndBrush(selBrush);
} }
@@ -2072,14 +2067,14 @@ void Select_UpdateTextureName(const char *name) {
for (b = selected_brushes.next; b != &selected_brushes; b = b->next) { for (b = selected_brushes.next; b != &selected_brushes; b = b->next) {
if (!b->owner->eclass->fixedsize) { if (!b->owner->eclass->fixedsize) {
Undo_AddBrush(b); Undo_AddBrush(b);
Brush_SetTextureName(b, name); b->Brush_SetTextureName(name);
Undo_EndBrush(b); Undo_EndBrush(b);
} else if (b->owner->eclass->nShowFlags & ECLASS_LIGHT) { } else if (b->owner->eclass->nShowFlags & ECLASS_LIGHT) {
if ( idStr::Cmpn(name, "lights/", strlen("lights/")) == 0 ) { if ( idStr::Cmpn(name, "lights/", strlen("lights/")) == 0 ) {
SetKeyValue(b->owner, "texture", name); b->owner->SetKeyValue("texture", name);
g_Inspectors->UpdateEntitySel(b->owner->eclass); g_Inspectors->UpdateEntitySel(b->owner->eclass);
UpdateLightInspector(); UpdateLightInspector();
Brush_Build(b); b->Brush_Build();
} }
} }
} }
@@ -2100,18 +2095,18 @@ void Select_FlipTexture(bool y) {
int faceCount = g_ptrSelectedFaces.GetSize(); int faceCount = g_ptrSelectedFaces.GetSize();
Undo_Start("Select_FlipTexture"); 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) { if (b->pPatch) {
Patch_FlipTexture(b->pPatch, y); Patch_FlipTexture(b->pPatch, y);
} else { } else {
Brush_FlipTexture_BrushPrimit(b, y); b->Brush_FlipTexture_BrushPrimit(y);
} }
} }
if (faceCount > 0) { if (faceCount > 0) {
for (int i = 0; i < faceCount; i++) { for (int i = 0; i < faceCount; i++) {
face_t *selFace = reinterpret_cast < face_t * > (g_ptrSelectedFaces.GetAt(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); Face_FlipTexture_BrushPrimit(selFace, y);
} }
} }
@@ -2130,9 +2125,9 @@ void Select_FlipTexture(bool y) {
======================================================================================================================= =======================================================================================================================
*/ */
void Select_SetKeyVal(const char *key, const char *val) { 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) { 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 ) { 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) {
if ( b->pPatch->width <= p->width && b->pPatch->height <= p->height ) { if ( b->pPatch->width <= p->width && b->pPatch->height <= p->height ) {
for ( int i = 0; i < b->pPatch->width; i ++ ) { 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 ) { 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) { if (b->pPatch) {
EmitBrushPrimitTextureCoordinates(face, NULL, b->pPatch); EmitBrushPrimitTextureCoordinates(face, NULL, b->pPatch);
Patch_MakeDirty(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_Width(patchMesh_t *p);
extern float Patch_Height(patchMesh_t *p); extern float Patch_Height(patchMesh_t *p);
void Select_SetPatchFit(float dim1, float dim2, float srcWidth, float srcHeight, float rot) { 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) { if (b->pPatch) {
float w = Patch_Width(b->pPatch); float w = Patch_Width(b->pPatch);
float h = Patch_Height(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() { 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) { if (b->owner != world_entity) {
const idKeyValue *kv = b->owner->epairs.MatchPrefix("target", NULL); const idKeyValue *kv = b->owner->epairs.MatchPrefix("target", NULL);
while (kv) { while (kv) {
entity_t *ent = FindEntity("name", kv->GetValue()); idEditorEntity *ent = idEditorEntity::FindEntity("name", kv->GetValue());
if (ent) { if (ent) {
Select_Brush(ent->brushes.onext, true, false); Select_Brush(ent->brushes.onext, true, false);
} }
+5 -5
View File
@@ -46,18 +46,18 @@ typedef enum
class CDragPoint { class CDragPoint {
public: public:
idVec3 vec; idVec3 vec;
brush_t *pBrush; idEditorBrush *pBrush;
int nType; int nType;
bool priority; bool priority;
CDragPoint() {}; CDragPoint() {};
CDragPoint(brush_t *b, idVec3 v, int type, bool p) { CDragPoint(idEditorBrush *b, idVec3 v, int type, bool p) {
pBrush = b; pBrush = b;
VectorCopy(v, vec); VectorCopy(v, vec);
nType = type; nType = type;
priority = p; priority = p;
} }
void Set(brush_t *b, idVec3 v, int type) { void Set(idEditorBrush *b, idVec3 v, int type) {
pBrush = b; pBrush = b;
VectorCopy(v, vec); VectorCopy(v, vec);
nType = type; nType = type;
@@ -69,7 +69,7 @@ public:
typedef struct typedef struct
{ {
brush_t *brush; idEditorBrush *brush;
face_t *face; face_t *face;
CDragPoint *point; CDragPoint *point;
float dist; float dist;
@@ -91,7 +91,7 @@ void SelectCurvePointByRay( const idVec3 &org, const idVec3 &dir, int buttons);
void SelectSplinePointByRay( const idVec3 &org, const idVec3 &dir, int buttons); void SelectSplinePointByRay( const idVec3 &org, const idVec3 &dir, int buttons);
void Select_GetBounds (idVec3 &mins, idVec3 &maxs); void Select_GetBounds (idVec3 &mins, idVec3 &maxs);
void Select_Brush (brush_t *b, bool bComplete = true, bool bStatus = true); void Select_Brush (idEditorBrush *b, bool bComplete = true, bool bStatus = true);
void Select_Ray (idVec3 origin, idVec3 dir, int flags); void Select_Ray (idVec3 origin, idVec3 dir, int flags);
void Select_Delete (void); void Select_Delete (void);
void Select_Deselect (bool bDeselectFaces = true); void Select_Deselect (bool bDeselectFaces = true);
+2 -2
View File
@@ -713,7 +713,7 @@ void CSurfaceDlg::SetTexMods() {
} }
else { else {
if (selected_brushes.next != &selected_brushes) { if (selected_brushes.next != &selected_brushes) {
brush_t* b = selected_brushes.next; idEditorBrush* b = selected_brushes.next;
if (!b->pPatch) { if (!b->pPatch) {
selFace = b->brush_faces; selFace = b->brush_faces;
} }
@@ -1059,7 +1059,7 @@ void CSurfaceDlg::OnBtnBrushfit() {
void CSurfaceDlg::OnBtnFacefit() { void CSurfaceDlg::OnBtnFacefit() {
UpdateData(TRUE); UpdateData(TRUE);
/* /*
brush_t *b; idEditorBrush *b;
for (b=selected_brushes.next ; b != &selected_brushes ; b=b->next) { for (b=selected_brushes.next ; b != &selected_brushes ; b=b->next) {
if (!b->patchBrush) { if (!b->patchBrush) {
for (face_t* pFace = b->brush_faces; pFace; pFace = pFace->next) { for (face_t* pFace = b->brush_faces; pFace; pFace = pFace->next) {
+85 -85
View File
@@ -55,8 +55,8 @@ typedef struct undo_s
int id; //every undo has an unique id int id; //every undo has an unique id
int done; //true when undo is build int done; //true when undo is build
char *operation; //name of the operation char *operation; //name of the operation
brush_t brushlist; //deleted brushes idEditorBrush brushlist; //deleted brushes
entity_t entitylist; //deleted entities idEditorEntity entitylist; //deleted entities
struct undo_s *prev, *next; //next and prev undo in list struct undo_s *prev, *next; //next and prev undo in list
} undo_t; } undo_t;
@@ -82,19 +82,19 @@ int Undo_MemorySize(void)
/* /*
int size; int size;
undo_t *undo; undo_t *undo;
brush_t *pBrush; idEditorBrush *pBrush;
entity_t *pEntity; idEditorEntity *pEntity;
size = 0; size = 0;
for (undo = g_undolist; undo; undo = undo->next) for (undo = g_undolist; undo; undo = undo->next)
{ {
for (pBrush = undo->brushlist.next ; pBrush != NULL && pBrush != &undo->brushlist ; pBrush = pBrush->next) for (pBrush = undo->brushlist.next ; pBrush != NULL && pBrush != &undo->brushlist ; pBrush = pBrush->next)
{ {
size += Brush_MemorySize(pBrush); size += pBrush->Brush_MemorySize();
} }
for (pEntity = undo->entitylist.next; pEntity != NULL && pEntity != &undo->entitylist; pEntity = pEntity->next) for (pEntity = undo->entitylist.next; pEntity != NULL && pEntity != &undo->entitylist; pEntity = pEntity->next)
{ {
size += Entity_MemorySize(pEntity); size += pEntity->Entity_MemorySize();
} }
size += sizeof(undo_t); size += sizeof(undo_t);
} }
@@ -111,8 +111,8 @@ Undo_ClearRedo
void Undo_ClearRedo(void) void Undo_ClearRedo(void)
{ {
undo_t *redo, *nextredo; undo_t *redo, *nextredo;
brush_t *pBrush, *pNextBrush; idEditorBrush *pBrush, *pNextBrush;
entity_t *pEntity, *pNextEntity; idEditorEntity *pEntity, *pNextEntity;
for (redo = g_redolist; redo; redo = nextredo) for (redo = g_redolist; redo; redo = nextredo)
{ {
@@ -125,7 +125,7 @@ void Undo_ClearRedo(void)
for (pEntity = redo->entitylist.next; pEntity != NULL && pEntity != &redo->entitylist; pEntity = pNextEntity) for (pEntity = redo->entitylist.next; pEntity != NULL && pEntity != &redo->entitylist; pEntity = pNextEntity)
{ {
pNextEntity = pEntity->next; pNextEntity = pEntity->next;
Entity_Free(pEntity); idEditorEntity::Entity_Free(pEntity);
} }
Mem_Free(redo); Mem_Free(redo);
} }
@@ -144,8 +144,8 @@ Undo_Clear
void Undo_Clear(void) void Undo_Clear(void)
{ {
undo_t *undo, *nextundo; undo_t *undo, *nextundo;
brush_t *pBrush, *pNextBrush; idEditorBrush *pBrush, *pNextBrush;
entity_t *pEntity, *pNextEntity; idEditorEntity *pEntity, *pNextEntity;
Undo_ClearRedo(); Undo_ClearRedo();
for (undo = g_undolist; undo; undo = nextundo) for (undo = g_undolist; undo; undo = nextundo)
@@ -154,14 +154,14 @@ void Undo_Clear(void)
for (pBrush = undo->brushlist.next ; pBrush != NULL && pBrush != &undo->brushlist ; pBrush = pNextBrush) for (pBrush = undo->brushlist.next ; pBrush != NULL && pBrush != &undo->brushlist ; pBrush = pNextBrush)
{ {
pNextBrush = pBrush->next; pNextBrush = pBrush->next;
g_undoMemorySize -= Brush_MemorySize(pBrush); g_undoMemorySize -= pBrush->Brush_MemorySize();
Brush_Free(pBrush); Brush_Free(pBrush);
} }
for (pEntity = undo->entitylist.next; pEntity != NULL && pEntity != &undo->entitylist; pEntity = pNextEntity) for (pEntity = undo->entitylist.next; pEntity != NULL && pEntity != &undo->entitylist; pEntity = pNextEntity)
{ {
pNextEntity = pEntity->next; pNextEntity = pEntity->next;
g_undoMemorySize -= Entity_MemorySize(pEntity); g_undoMemorySize -= pEntity->Entity_MemorySize();
Entity_Free(pEntity); idEditorEntity::Entity_Free(pEntity);
} }
g_undoMemorySize -= sizeof(undo_t); g_undoMemorySize -= sizeof(undo_t);
Mem_Free(undo); Mem_Free(undo);
@@ -225,8 +225,8 @@ Undo_FreeFirstUndo
void Undo_FreeFirstUndo(void) void Undo_FreeFirstUndo(void)
{ {
undo_t *undo; undo_t *undo;
brush_t *pBrush, *pNextBrush; idEditorBrush *pBrush, *pNextBrush;
entity_t *pEntity, *pNextEntity; idEditorEntity *pEntity, *pNextEntity;
//remove the oldest undo from the undo buffer //remove the oldest undo from the undo buffer
undo = g_undolist; undo = g_undolist;
@@ -236,14 +236,14 @@ void Undo_FreeFirstUndo(void)
for (pBrush = undo->brushlist.next ; pBrush != NULL && pBrush != &undo->brushlist ; pBrush = pNextBrush) for (pBrush = undo->brushlist.next ; pBrush != NULL && pBrush != &undo->brushlist ; pBrush = pNextBrush)
{ {
pNextBrush = pBrush->next; pNextBrush = pBrush->next;
g_undoMemorySize -= Brush_MemorySize(pBrush); g_undoMemorySize -= pBrush->Brush_MemorySize();
Brush_Free(pBrush); Brush_Free(pBrush);
} }
for (pEntity = undo->entitylist.next; pEntity != NULL && pEntity != &undo->entitylist; pEntity = pNextEntity) for (pEntity = undo->entitylist.next; pEntity != NULL && pEntity != &undo->entitylist; pEntity = pNextEntity)
{ {
pNextEntity = pEntity->next; pNextEntity = pEntity->next;
g_undoMemorySize -= Entity_MemorySize(pEntity); g_undoMemorySize -= pEntity->Entity_MemorySize();
Entity_Free(pEntity); idEditorEntity::Entity_Free(pEntity);
} }
g_undoMemorySize -= sizeof(undo_t); g_undoMemorySize -= sizeof(undo_t);
Mem_Free(undo); Mem_Free(undo);
@@ -258,8 +258,8 @@ Undo_GeneralStart
void Undo_GeneralStart(char *operation) void Undo_GeneralStart(char *operation)
{ {
undo_t *undo; undo_t *undo;
brush_t *pBrush; idEditorBrush *pBrush;
entity_t *pEntity; idEditorEntity *pEntity;
if (g_lastundo) if (g_lastundo)
@@ -327,9 +327,9 @@ void Undo_GeneralStart(char *operation)
Undo_BrushInUndo Undo_BrushInUndo
============= =============
*/ */
int Undo_BrushInUndo(undo_t *undo, brush_t *brush) int Undo_BrushInUndo(undo_t *undo, idEditorBrush *brush)
{ {
brush_t *b; idEditorBrush *b;
for (b = undo->brushlist.next; b != &undo->brushlist; b = b->next) for (b = undo->brushlist.next; b != &undo->brushlist; b = b->next)
{ {
@@ -343,9 +343,9 @@ int Undo_BrushInUndo(undo_t *undo, brush_t *brush)
Undo_EntityInUndo Undo_EntityInUndo
============= =============
*/ */
int Undo_EntityInUndo(undo_t *undo, entity_t *ent) int Undo_EntityInUndo(undo_t *undo, idEditorEntity *ent)
{ {
entity_t *e; idEditorEntity *e;
for (e = undo->entitylist.next; e != &undo->entitylist; e = e->next) for (e = undo->entitylist.next; e != &undo->entitylist; e = e->next)
{ {
@@ -370,7 +370,7 @@ void Undo_Start(char *operation)
Undo_AddBrush Undo_AddBrush
============= =============
*/ */
void Undo_AddBrush(brush_t *pBrush) void Undo_AddBrush(idEditorBrush *pBrush)
{ {
if (!g_lastundo) if (!g_lastundo)
{ {
@@ -385,7 +385,7 @@ void Undo_AddBrush(brush_t *pBrush)
if (Undo_BrushInUndo(g_lastundo, pBrush)) if (Undo_BrushInUndo(g_lastundo, pBrush))
return; return;
//clone the brush //clone the brush
brush_t* pClone = Brush_FullClone(pBrush); idEditorBrush* pClone = Brush_FullClone(pBrush);
//save the ID of the owner entity //save the ID of the owner entity
pClone->ownerId = pBrush->owner->entityId; pClone->ownerId = pBrush->owner->entityId;
@@ -395,9 +395,9 @@ void Undo_AddBrush(brush_t *pBrush)
//save the old undo ID for previous undos //save the old undo ID for previous undos
pClone->undoId = pBrush->undoId; pClone->undoId = pBrush->undoId;
Brush_AddToList (pClone, &g_lastundo->brushlist); pClone->Brush_AddToList(&g_lastundo->brushlist);
// //
g_undoMemorySize += Brush_MemorySize(pClone); g_undoMemorySize += pClone->Brush_MemorySize();
} }
/* /*
@@ -405,9 +405,9 @@ void Undo_AddBrush(brush_t *pBrush)
Undo_AddBrushList Undo_AddBrushList
============= =============
*/ */
void Undo_AddBrushList(brush_t *brushlist) void Undo_AddBrushList(idEditorBrush *brushlist)
{ {
brush_t *pBrush; idEditorBrush *pBrush;
if (!g_lastundo) if (!g_lastundo)
{ {
@@ -425,7 +425,7 @@ void Undo_AddBrushList(brush_t *brushlist)
if (Undo_BrushInUndo(g_lastundo, pBrush)) if (Undo_BrushInUndo(g_lastundo, pBrush))
continue; continue;
//clone the brush //clone the brush
brush_t* pClone = Brush_FullClone(pBrush); idEditorBrush* pClone = Brush_FullClone(pBrush);
//save the ID of the owner entity //save the ID of the owner entity
pClone->ownerId = pBrush->owner->entityId; pClone->ownerId = pBrush->owner->entityId;
//save the old undo ID from previous undos //save the old undo ID from previous undos
@@ -436,9 +436,9 @@ void Undo_AddBrushList(brush_t *brushlist)
} }
Brush_AddToList (pClone, &g_lastundo->brushlist); pClone->Brush_AddToList(&g_lastundo->brushlist);
// //
g_undoMemorySize += Brush_MemorySize(pClone); g_undoMemorySize += pClone->Brush_MemorySize();
} }
} }
@@ -447,7 +447,7 @@ void Undo_AddBrushList(brush_t *brushlist)
Undo_EndBrush Undo_EndBrush
============= =============
*/ */
void Undo_EndBrush(brush_t *pBrush) void Undo_EndBrush(idEditorBrush *pBrush)
{ {
if (!g_lastundo) if (!g_lastundo)
{ {
@@ -467,7 +467,7 @@ void Undo_EndBrush(brush_t *pBrush)
Undo_EndBrushList Undo_EndBrushList
============= =============
*/ */
void Undo_EndBrushList(brush_t *brushlist) void Undo_EndBrushList(idEditorBrush *brushlist)
{ {
if (!g_lastundo) if (!g_lastundo)
{ {
@@ -479,7 +479,7 @@ void Undo_EndBrushList(brush_t *brushlist)
//Sys_Status("Undo_End: last undo already finished.\n"); //Sys_Status("Undo_End: last undo already finished.\n");
return; return;
} }
for (brush_t* pBrush = brushlist->next; pBrush != NULL && pBrush != brushlist; pBrush=pBrush->next) for (idEditorBrush* pBrush = brushlist->next; pBrush != NULL && pBrush != brushlist; pBrush=pBrush->next)
{ {
pBrush->undoId = g_lastundo->id; pBrush->undoId = g_lastundo->id;
} }
@@ -490,9 +490,9 @@ void Undo_EndBrushList(brush_t *brushlist)
Undo_AddEntity Undo_AddEntity
============= =============
*/ */
void Undo_AddEntity(entity_t *entity) void Undo_AddEntity(idEditorEntity *entity)
{ {
entity_t* pClone; idEditorEntity* pClone;
if (!g_lastundo) if (!g_lastundo)
{ {
@@ -503,18 +503,18 @@ void Undo_AddEntity(entity_t *entity)
if (Undo_EntityInUndo(g_lastundo, entity)) if (Undo_EntityInUndo(g_lastundo, entity))
return; return;
//clone the entity //clone the entity
pClone = Entity_Clone(entity); pClone = idEditorEntity::Entity_Clone(entity);
//NOTE: Entity_Clone adds the entity to the entity list //NOTE: Entity_Clone adds the entity to the entity list
// so we remove it from that list here // so we remove it from that list here
Entity_RemoveFromList(pClone); pClone->Entity_RemoveFromList();
//save the old undo ID for previous undos //save the old undo ID for previous undos
pClone->undoId = entity->undoId; pClone->undoId = entity->undoId;
//save the entity ID (we need a full clone) //save the entity ID (we need a full clone)
pClone->entityId = entity->entityId; pClone->entityId = entity->entityId;
// //
Entity_AddToList(pClone, &g_lastundo->entitylist); pClone->Entity_AddToList(&g_lastundo->entitylist);
// //
g_undoMemorySize += Entity_MemorySize(pClone); g_undoMemorySize += pClone->Entity_MemorySize();
} }
/* /*
@@ -522,7 +522,7 @@ void Undo_AddEntity(entity_t *entity)
Undo_EndEntity Undo_EndEntity
============= =============
*/ */
void Undo_EndEntity(entity_t *entity) void Undo_EndEntity(idEditorEntity *entity)
{ {
if (!g_lastundo) if (!g_lastundo)
{ {
@@ -582,8 +582,8 @@ Undo_Undo
void Undo_Undo(void) void Undo_Undo(void)
{ {
undo_t *undo, *redo; undo_t *undo, *redo;
brush_t *pBrush, *pNextBrush; idEditorBrush *pBrush, *pNextBrush;
entity_t *pEntity, *pNextEntity, *pUndoEntity; idEditorEntity *pEntity, *pNextEntity, *pUndoEntity;
if (!g_lastundo) if (!g_lastundo)
{ {
@@ -652,12 +652,12 @@ void Undo_Undo(void)
{ {
//Brush_Free(pBrush); //Brush_Free(pBrush);
//move the brush to the redo //move the brush to the redo
Brush_RemoveFromList(pBrush); pBrush->Brush_RemoveFromList();
Brush_AddToList(pBrush, &redo->brushlist); pBrush->Brush_AddToList(&redo->brushlist);
//make sure the ID of the owner is stored //make sure the ID of the owner is stored
pBrush->ownerId = pBrush->owner->entityId; pBrush->ownerId = pBrush->owner->entityId;
//unlink the brush from the owner entity //unlink the brush from the owner entity
Entity_UnlinkBrush(pBrush); idEditorEntity::Entity_UnlinkBrush(pBrush);
} }
} }
// move "created" entities to the redo // move "created" entities to the redo
@@ -679,54 +679,54 @@ void Undo_Undo(void)
} }
} }
// //
//Entity_Free(pEntity); //idEditorEntity::Entity_Free(pEntity);
//move the entity to the redo //move the entity to the redo
Entity_RemoveFromList(pEntity); pEntity->Entity_RemoveFromList();
Entity_AddToList(pEntity, &redo->entitylist); pEntity->Entity_AddToList(&redo->entitylist);
} }
} }
// add the undo entities back into the entity list // add the undo entities back into the entity list
for (pEntity = undo->entitylist.next; pEntity != NULL && pEntity != &undo->entitylist; pEntity = undo->entitylist.next) for (pEntity = undo->entitylist.next; pEntity != NULL && pEntity != &undo->entitylist; pEntity = undo->entitylist.next)
{ {
g_undoMemorySize -= Entity_MemorySize(pEntity); g_undoMemorySize -= pEntity->Entity_MemorySize();
//if this is the world entity //if this is the world entity
if (pEntity->entityId == world_entity->entityId) if (pEntity->entityId == world_entity->entityId)
{ {
//free the epairs of the world entity //free the epairs of the world entity
Entity_FreeEpairs(world_entity); world_entity->Entity_FreeEpairs();
//set back the original epairs //set back the original epairs
world_entity->epairs = pEntity->epairs; world_entity->epairs = pEntity->epairs;
//free the world_entity clone that stored the epairs //free the world_entity clone that stored the epairs
Entity_Free(pEntity); idEditorEntity::Entity_Free(pEntity);
} }
else else
{ {
Entity_RemoveFromList(pEntity); pEntity->Entity_RemoveFromList();
Entity_AddToList(pEntity, &entities); pEntity->Entity_AddToList(&entities);
pEntity->redoId = redo->id; pEntity->redoId = redo->id;
} }
} }
// add the undo brushes back into the selected brushes // add the undo brushes back into the selected brushes
for (pBrush = undo->brushlist.next; pBrush != NULL && pBrush != &undo->brushlist; pBrush = undo->brushlist.next) for (pBrush = undo->brushlist.next; pBrush != NULL && pBrush != &undo->brushlist; pBrush = undo->brushlist.next)
{ {
g_undoMemorySize -= Brush_MemorySize(pBrush); g_undoMemorySize -= pBrush->Brush_MemorySize();
Brush_RemoveFromList(pBrush); pBrush->Brush_RemoveFromList();
Brush_AddToList(pBrush, &active_brushes); pBrush->Brush_AddToList(&active_brushes);
for (pEntity = entities.next; pEntity != NULL && pEntity != &entities; pEntity = pEntity->next) for (pEntity = entities.next; pEntity != NULL && pEntity != &entities; pEntity = pEntity->next)
{ {
if (pEntity->entityId == pBrush->ownerId) if (pEntity->entityId == pBrush->ownerId)
{ {
Entity_LinkBrush(pEntity, pBrush); pEntity->Entity_LinkBrush(pBrush);
break; break;
} }
} }
//if the brush is not linked then it should be linked into the world entity //if the brush is not linked then it should be linked into the world entity
if (pEntity == NULL || pEntity == &entities) if (pEntity == NULL || pEntity == &entities)
{ {
Entity_LinkBrush(world_entity, pBrush); world_entity->Entity_LinkBrush(pBrush);
} }
//build the brush //build the brush
//Brush_Build(pBrush); //pBrush->Brush_Build();
Select_Brush(pBrush); Select_Brush(pBrush);
pBrush->redoId = redo->id; pBrush->redoId = redo->id;
} }
@@ -741,14 +741,14 @@ void Undo_Undo(void)
// //
Sys_BeginWait(); Sys_BeginWait();
brush_t *b, *next; idEditorBrush *b, *next;
for (b = active_brushes.next ; b != NULL && b != &active_brushes ; b=next) { for (b = active_brushes.next ; b != NULL && b != &active_brushes ; b=next) {
next = b->next; next = b->next;
Brush_Build( b, true, false, false ); b->Brush_Build(true, false, false );
} }
for (b = selected_brushes.next ; b != NULL && b != &selected_brushes ; b=next) { for (b = selected_brushes.next ; b != NULL && b != &selected_brushes ; b=next) {
next = b->next; next = b->next;
Brush_Build( b, true, false, false ); b->Brush_Build(true, false, false );
} }
Sys_EndWait(); Sys_EndWait();
@@ -764,8 +764,8 @@ Undo_Redo
void Undo_Redo(void) void Undo_Redo(void)
{ {
undo_t *redo; undo_t *redo;
brush_t *pBrush, *pNextBrush; idEditorBrush *pBrush, *pNextBrush;
entity_t *pEntity, *pNextEntity, *pRedoEntity; idEditorEntity *pEntity, *pNextEntity, *pRedoEntity;
if (!g_lastredo) if (!g_lastredo)
{ {
@@ -795,11 +795,11 @@ void Undo_Redo(void)
if (pBrush->redoId == redo->id) if (pBrush->redoId == redo->id)
{ {
//move the brush to the undo //move the brush to the undo
Brush_RemoveFromList(pBrush); pBrush->Brush_RemoveFromList();
Brush_AddToList(pBrush, &g_lastundo->brushlist); pBrush->Brush_AddToList(&g_lastundo->brushlist);
g_undoMemorySize += Brush_MemorySize(pBrush); g_undoMemorySize += pBrush->Brush_MemorySize();
pBrush->ownerId = pBrush->owner->entityId; pBrush->ownerId = pBrush->owner->entityId;
Entity_UnlinkBrush(pBrush); idEditorEntity::Entity_UnlinkBrush(pBrush);
} }
} }
// move "created" entities back to the last undo // move "created" entities back to the last undo
@@ -821,11 +821,11 @@ void Undo_Redo(void)
} }
} }
// //
//Entity_Free(pEntity); //idEditorEntity::Entity_Free(pEntity);
//move the entity to the redo //move the entity to the redo
Entity_RemoveFromList(pEntity); pEntity->Entity_RemoveFromList();
Entity_AddToList(pEntity, &g_lastundo->entitylist); pEntity->Entity_AddToList(&g_lastundo->entitylist);
g_undoMemorySize += Entity_MemorySize(pEntity); g_undoMemorySize += pEntity->Entity_MemorySize();
} }
} }
// add the undo entities back into the entity list // add the undo entities back into the entity list
@@ -835,38 +835,38 @@ void Undo_Redo(void)
if (pEntity->entityId == world_entity->entityId) if (pEntity->entityId == world_entity->entityId)
{ {
//free the epairs of the world entity //free the epairs of the world entity
Entity_FreeEpairs(world_entity); world_entity->Entity_FreeEpairs();
//set back the original epairs //set back the original epairs
world_entity->epairs = pEntity->epairs; world_entity->epairs = pEntity->epairs;
//free the world_entity clone that stored the epairs //free the world_entity clone that stored the epairs
Entity_Free(pEntity); idEditorEntity::Entity_Free(pEntity);
} }
else else
{ {
Entity_RemoveFromList(pEntity); pEntity->Entity_RemoveFromList();
Entity_AddToList(pEntity, &entities); pEntity->Entity_AddToList(&entities);
} }
} }
// add the redo brushes back into the selected brushes // add the redo brushes back into the selected brushes
for (pBrush = redo->brushlist.next; pBrush != NULL && pBrush != &redo->brushlist; pBrush = redo->brushlist.next) for (pBrush = redo->brushlist.next; pBrush != NULL && pBrush != &redo->brushlist; pBrush = redo->brushlist.next)
{ {
Brush_RemoveFromList(pBrush); pBrush->Brush_RemoveFromList();
Brush_AddToList(pBrush, &active_brushes); pBrush->Brush_AddToList(&active_brushes);
for (pEntity = entities.next; pEntity != NULL && pEntity != &entities; pEntity = pEntity->next) for (pEntity = entities.next; pEntity != NULL && pEntity != &entities; pEntity = pEntity->next)
{ {
if (pEntity->entityId == pBrush->ownerId) if (pEntity->entityId == pBrush->ownerId)
{ {
Entity_LinkBrush(pEntity, pBrush); pEntity->Entity_LinkBrush(pBrush);
break; break;
} }
} }
//if the brush is not linked then it should be linked into the world entity //if the brush is not linked then it should be linked into the world entity
if (pEntity == NULL || pEntity == &entities) if (pEntity == NULL || pEntity == &entities)
{ {
Entity_LinkBrush(world_entity, pBrush); world_entity->Entity_LinkBrush(pBrush);
} }
//build the brush //build the brush
//Brush_Build(pBrush); //pBrush->Brush_Build();
Select_Brush(pBrush); Select_Brush(pBrush);
} }
// //
+6 -6
View File
@@ -31,17 +31,17 @@ void Undo_Start(char *operation);
//end operation //end operation
void Undo_End(void); void Undo_End(void);
//add brush to the undo //add brush to the undo
void Undo_AddBrush(brush_t *pBrush); void Undo_AddBrush(idEditorBrush *pBrush);
//add a list with brushes to the undo //add a list with brushes to the undo
void Undo_AddBrushList(brush_t *brushlist); void Undo_AddBrushList(idEditorBrush *brushlist);
//end a brush after the operation is performed //end a brush after the operation is performed
void Undo_EndBrush(brush_t *pBrush); void Undo_EndBrush(idEditorBrush *pBrush);
//end a list with brushes after the operation is performed //end a list with brushes after the operation is performed
void Undo_EndBrushList(brush_t *brushlist); void Undo_EndBrushList(idEditorBrush *brushlist);
//add entity to undo //add entity to undo
void Undo_AddEntity(entity_t *entity); void Undo_AddEntity(idEditorEntity *entity);
//end an entity after the operation is performed //end an entity after the operation is performed
void Undo_EndEntity(entity_t *entity); void Undo_EndEntity(idEditorEntity *entity);
//undo last operation //undo last operation
void Undo_Undo(void); void Undo_Undo(void);
//redo last undone operation //redo last undone operation
+11 -11
View File
@@ -86,7 +86,7 @@ int FindEdge(int p1, int p2, face_t *f) {
} }
#ifdef NEWEDGESEL #ifdef NEWEDGESEL
void MakeFace (brush_t * b, face_t * f) void MakeFace (idEditorBrush * b, face_t * f)
#else #else
void MakeFace (face_t * f) void MakeFace (face_t * f)
#endif #endif
@@ -96,9 +96,9 @@ void MakeFace (face_t * f)
int pnum[128]; int pnum[128];
#ifdef NEWEDGESEL #ifdef NEWEDGESEL
w = Brush_MakeFaceWinding(b, f); w = b->Brush_MakeFaceWinding(f);
#else #else
w = Brush_MakeFaceWinding(selected_brushes.next, f); w = selected_brushes.next->Brush_MakeFaceWinding(f);
#endif #endif
if (!w) { if (!w) {
return; return;
@@ -118,7 +118,7 @@ void MakeFace (face_t * f)
*/ */
void SetupVertexSelection(void) { void SetupVertexSelection(void) {
face_t *f; face_t *f;
brush_t *b; idEditorBrush *b;
g_qeglobals.d_numpoints = 0; g_qeglobals.d_numpoints = 0;
g_qeglobals.d_numedges = 0; g_qeglobals.d_numedges = 0;
@@ -143,7 +143,7 @@ void SetupVertexSelection(void) {
} }
#ifdef NEWEDGESEL #ifdef NEWEDGESEL
void SelectFaceEdge (brush_t * b, face_t * f, int p1, int p2) void SelectFaceEdge (idEditorBrush * b, face_t * f, int p1, int p2)
#else #else
void SelectFaceEdge (face_t * f, int p1, int p2) void SelectFaceEdge (face_t * f, int p1, int p2)
#endif #endif
@@ -153,9 +153,9 @@ void SelectFaceEdge (face_t * f, int p1, int p2)
int pnum[128]; int pnum[128];
#ifdef NEWEDGESEL #ifdef NEWEDGESEL
w = Brush_MakeFaceWinding(b, f); w = b->Brush_MakeFaceWinding(f);
#else #else
w = Brush_MakeFaceWinding(selected_brushes.next, f); w = selected_brushes.next->Brush_MakeFaceWinding(f);
#endif #endif
if (!w) { if (!w) {
return; return;
@@ -190,7 +190,7 @@ void SelectFaceEdge (face_t * f, int p1, int p2)
======================================================================================================================= =======================================================================================================================
*/ */
void SelectVertex(int p1) { void SelectVertex(int p1) {
brush_t *b; idEditorBrush *b;
idWinding *w; idWinding *w;
int i, j, k; int i, j, k;
face_t *f; face_t *f;
@@ -198,7 +198,7 @@ void SelectVertex(int p1) {
#ifdef NEWEDGESEL #ifdef NEWEDGESEL
for (b = selected_brushes.next; b != &selected_brushes; b = b->next) { for (b = selected_brushes.next; b != &selected_brushes; b = b->next) {
for (f = b->brush_faces; f; f = f->next) { for (f = b->brush_faces; f; f = f->next) {
w = Brush_MakeFaceWinding(b, f); w = b->Brush_MakeFaceWinding(f);
if (!w) { if (!w) {
continue; continue;
} }
@@ -228,7 +228,7 @@ void SelectVertex(int p1) {
#else #else
b = selected_brushes.next; b = selected_brushes.next;
for (f = b->brush_faces; f; f = f->next) { for (f = b->brush_faces; f; f = f->next) {
w = Brush_MakeFaceWinding(b, f); w = b->Brush_MakeFaceWinding(f);
if (!w) { if (!w) {
continue; continue;
} }
@@ -300,7 +300,7 @@ void SelectEdgeByRay(idVec3 org, idVec3 dir) {
g_qeglobals.d_num_move_points = 0; g_qeglobals.d_num_move_points = 0;
e = &g_qeglobals.d_edges[besti]; e = &g_qeglobals.d_edges[besti];
#ifdef NEWEDGESEL #ifdef NEWEDGESEL
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) {
SelectFaceEdge(b, e->f1, e->p1, e->p2); SelectFaceEdge(b, e->f1, e->p1, e->p2);
SelectFaceEdge(b, e->f2, e->p2, e->p1); SelectFaceEdge(b, e->f2, e->p2, e->p1);
} }
+24 -24
View File
@@ -53,7 +53,7 @@ BOOL CALLBACK EditCommandDlgProc (
if (index >= 0) if (index >= 0)
{ {
SendDlgItemMessage(hOwner, IDC_CMD_LIST, LB_GETTEXT, index, (LPARAM) (LPCTSTR) key); SendDlgItemMessage(hOwner, IDC_CMD_LIST, LB_GETTEXT, index, (LPARAM) (LPCTSTR) key);
temp = ValueForKey (g_qeglobals.d_project_entity, key); temp = g_qeglobals.d_project_entity->ValueForKey(key);
strcpy (value, temp); strcpy (value, temp);
SetDlgItemText(hwndDlg, IDC_CMDMENUTEXT, key); SetDlgItemText(hwndDlg, IDC_CMDMENUTEXT, key);
SetDlgItemText(hwndDlg, IDC_CMDCOMMAND, value); SetDlgItemText(hwndDlg, IDC_CMDCOMMAND, value);
@@ -79,7 +79,7 @@ BOOL CALLBACK EditCommandDlgProc (
//if (key[0] == 'b' && key[1] == 's' && key[2] == 'p') //if (key[0] == 'b' && key[1] == 's' && key[2] == 'p')
//{ //{
SetKeyValue (g_qeglobals.d_project_entity, key, value); g_qeglobals.d_project_entity->SetKeyValue(key, value);
FillBSPMenu (); FillBSPMenu ();
//} //}
//else //else
@@ -126,7 +126,7 @@ INT_PTR CALLBACK AddCommandDlgProc (
if (key[0] == 'b' && key[1] == 's' && key[2] == 'p') if (key[0] == 'b' && key[1] == 's' && key[2] == 'p')
{ {
SetKeyValue (g_qeglobals.d_project_entity, key, value); g_qeglobals.d_project_entity->SetKeyValue(key, value);
FillBSPMenu (); FillBSPMenu ();
} }
else else
@@ -175,12 +175,12 @@ BOOL CALLBACK ProjectDlgProc (
switch (uMsg) switch (uMsg)
{ {
case WM_INITDIALOG: case WM_INITDIALOG:
SetDlgItemText(hwndDlg, IDC_PRJBASEPATH, ValueForKey (g_qeglobals.d_project_entity, "basepath")); SetDlgItemText(hwndDlg, IDC_PRJBASEPATH, g_qeglobals.d_project_entity->ValueForKey("basepath"));
SetDlgItemText(hwndDlg, IDC_PRJMAPSPATH, ValueForKey (g_qeglobals.d_project_entity, "mapspath")); SetDlgItemText(hwndDlg, IDC_PRJMAPSPATH, g_qeglobals.d_project_entity->ValueForKey("mapspath"));
SetDlgItemText(hwndDlg, IDC_PRJRSHCMD, ValueForKey (g_qeglobals.d_project_entity, "rshcmd")); SetDlgItemText(hwndDlg, IDC_PRJRSHCMD, g_qeglobals.d_project_entity->ValueForKey("rshcmd"));
SetDlgItemText(hwndDlg, IDC_PRJREMOTEBASE, ValueForKey (g_qeglobals.d_project_entity, "remotebasepath")); SetDlgItemText(hwndDlg, IDC_PRJREMOTEBASE, g_qeglobals.d_project_entity->ValueForKey("remotebasepath"));
SetDlgItemText(hwndDlg, IDC_PRJENTITYPATH, ValueForKey (g_qeglobals.d_project_entity, "entitypath")); SetDlgItemText(hwndDlg, IDC_PRJENTITYPATH, g_qeglobals.d_project_entity->ValueForKey("entitypath"));
SetDlgItemText(hwndDlg, IDC_PRJTEXPATH, ValueForKey (g_qeglobals.d_project_entity, "texturepath")); SetDlgItemText(hwndDlg, IDC_PRJTEXPATH, g_qeglobals.d_project_entity->ValueForKey("texturepath"));
UpdateBSPCommandList (hwndDlg); UpdateBSPCommandList (hwndDlg);
// Timo // Timo
// additional fields // additional fields
@@ -206,24 +206,24 @@ BOOL CALLBACK ProjectDlgProc (
case IDC_REMCMD: case IDC_REMCMD:
index = SendDlgItemMessage (hwndDlg, IDC_CMD_LIST, LB_GETCURSEL, 0, 0); index = SendDlgItemMessage (hwndDlg, IDC_CMD_LIST, LB_GETCURSEL, 0, 0);
SendDlgItemMessage(hwndDlg, IDC_CMD_LIST, LB_GETTEXT, index, (LPARAM) (LPCTSTR) key); SendDlgItemMessage(hwndDlg, IDC_CMD_LIST, LB_GETTEXT, index, (LPARAM) (LPCTSTR) key);
DeleteKey (g_qeglobals.d_project_entity, key); g_qeglobals.d_project_entity->DeleteKey(key);
common->Printf ("Selected %d\n", index); common->Printf ("Selected %d\n", index);
UpdateBSPCommandList (hwndDlg); UpdateBSPCommandList (hwndDlg);
break; break;
case IDOK: case IDOK:
GetDlgItemText(hwndDlg, IDC_PRJBASEPATH, value, 1024); GetDlgItemText(hwndDlg, IDC_PRJBASEPATH, value, 1024);
SetKeyValue (g_qeglobals.d_project_entity, "basepath", value); g_qeglobals.d_project_entity->SetKeyValue("basepath", value);
GetDlgItemText(hwndDlg, IDC_PRJMAPSPATH, value, 1024); GetDlgItemText(hwndDlg, IDC_PRJMAPSPATH, value, 1024);
SetKeyValue (g_qeglobals.d_project_entity, "mapspath", value); g_qeglobals.d_project_entity->SetKeyValue("mapspath", value);
GetDlgItemText(hwndDlg, IDC_PRJRSHCMD, value, 1024); GetDlgItemText(hwndDlg, IDC_PRJRSHCMD, value, 1024);
SetKeyValue (g_qeglobals.d_project_entity, "rshcmd", value); g_qeglobals.d_project_entity->SetKeyValue("rshcmd", value);
GetDlgItemText(hwndDlg, IDC_PRJREMOTEBASE, value, 1024); GetDlgItemText(hwndDlg, IDC_PRJREMOTEBASE, value, 1024);
SetKeyValue (g_qeglobals.d_project_entity, "remotebasepath", value); g_qeglobals.d_project_entity->SetKeyValue("remotebasepath", value);
GetDlgItemText(hwndDlg, IDC_PRJENTITYPATH, value, 1024); GetDlgItemText(hwndDlg, IDC_PRJENTITYPATH, value, 1024);
SetKeyValue (g_qeglobals.d_project_entity, "entitypath", value); g_qeglobals.d_project_entity->SetKeyValue("entitypath", value);
GetDlgItemText(hwndDlg, IDC_PRJTEXPATH, value, 1024); GetDlgItemText(hwndDlg, IDC_PRJTEXPATH, value, 1024);
SetKeyValue (g_qeglobals.d_project_entity, "texturepath", value); g_qeglobals.d_project_entity->SetKeyValue("texturepath", value);
// Timo // Timo
// read additional fields // read additional fields
if ( IsDlgButtonChecked( hwndDlg, IDC_CHECK_BPRIMIT ) ) if ( IsDlgButtonChecked( hwndDlg, IDC_CHECK_BPRIMIT ) )
@@ -234,7 +234,7 @@ BOOL CALLBACK ProjectDlgProc (
{ {
g_qeglobals.m_bBrushPrimitMode = FALSE; g_qeglobals.m_bBrushPrimitMode = FALSE;
} }
SetKeyValue ( g_qeglobals.d_project_entity, "brush_primit", ( g_qeglobals.m_bBrushPrimitMode ? "1" : "0" ) ); g_qeglobals.d_project_entity->SetKeyValue("brush_primit", ( g_qeglobals.m_bBrushPrimitMode ? "1" : "0" ) );
EndDialog(hwndDlg, 1); EndDialog(hwndDlg, 1);
QE_SaveProject(g_strProject); QE_SaveProject(g_strProject);
@@ -302,8 +302,8 @@ void DoGamma(void)
void SelectBrush (int entitynum, int brushnum) void SelectBrush (int entitynum, int brushnum)
{ {
entity_t *e; idEditorEntity *e;
brush_t *b; idEditorBrush *b;
int i; int i;
if (entitynum == 0) if (entitynum == 0)
@@ -338,8 +338,8 @@ void SelectBrush (int entitynum, int brushnum)
} }
} }
Brush_RemoveFromList (b); b->Brush_RemoveFromList();
Brush_AddToList (b, &selected_brushes); b->Brush_AddToList(&selected_brushes);
Sys_UpdateWindows (W_ALL); Sys_UpdateWindows (W_ALL);
@@ -365,8 +365,8 @@ GetSelectionIndex
*/ */
void GetSelectionIndex (int *ent, int *brush) void GetSelectionIndex (int *ent, int *brush)
{ {
brush_t *b, *b2; idEditorBrush *b, *b2;
entity_t *entity; idEditorEntity *entity;
*ent = *brush = 0; *ent = *brush = 0;
@@ -585,7 +585,7 @@ BOOL CALLBACK AboutDlgProc( HWND hwndDlg,
case WM_INITDIALOG: case WM_INITDIALOG:
{ {
char buffer[1024]; char buffer[1024];
idStr::snPrintf(buffer, 1024, "DOOM Radiant Build %d\nCopyright ©1999-2004 Id Software, Inc.\n", BUILD_NUMBER); idStr::snPrintf(buffer, 1024, "DOOM Radiant Build %d\nCopyright 1999-2004 Id Software, Inc.\n", BUILD_NUMBER);
// SetDlgItemText( hwndDlg, IDC_ABOUT_INFO, buffer); // SetDlgItemText( hwndDlg, IDC_ABOUT_INFO, buffer);
idStr::snPrintf( buffer, 1024, "Renderer:\t%s", glGetString( GL_RENDERER ) ); idStr::snPrintf( buffer, 1024, "Renderer:\t%s", glGetString( GL_RENDERER ) );
+5 -5
View File
@@ -329,9 +329,9 @@ static HANDLE hf; /* file handle */
*/ */
void OpenDialog(void) { void OpenDialog(void) {
/* Obtain the system directory name and store it in szDirName. */ /* Obtain the system directory name and store it in szDirName. */
strcpy(szDirName, ValueForKey(g_qeglobals.d_project_entity, "mapspath")); strcpy(szDirName, g_qeglobals.d_project_entity->ValueForKey("mapspath"));
if (strlen(szDirName) == 0) { if (strlen(szDirName) == 0) {
strcpy(szDirName, ValueForKey(g_qeglobals.d_project_entity, "basepath")); strcpy(szDirName, g_qeglobals.d_project_entity->ValueForKey("basepath"));
strcat(szDirName, "\\maps"); strcat(szDirName, "\\maps");
} }
@@ -378,7 +378,7 @@ void OpenDialog(void) {
*/ */
void ProjectDialog(void) { void ProjectDialog(void) {
/* Obtain the system directory name and store it in szDirName. */ /* Obtain the system directory name and store it in szDirName. */
strcpy(szDirName, ValueForKey(g_qeglobals.d_project_entity, "basepath")); strcpy(szDirName, g_qeglobals.d_project_entity->ValueForKey("basepath"));
/* Place the terminating null character in the szFile. */ /* Place the terminating null character in the szFile. */
szFile[0] = '\0'; szFile[0] = '\0';
@@ -416,7 +416,7 @@ extern void AddSlash(CString &strPath);
======================================================================================================================= =======================================================================================================================
*/ */
void SaveAsDialog(bool bRegion) { void SaveAsDialog(bool bRegion) {
strcpy(szDirName, ValueForKey(g_qeglobals.d_project_entity, "basepath")); strcpy(szDirName, g_qeglobals.d_project_entity->ValueForKey("basepath"));
CString strPath = szDirName; CString strPath = szDirName;
AddSlash(strPath); AddSlash(strPath);
@@ -462,7 +462,7 @@ void SaveAsDialog(bool bRegion) {
} }
/* /*
* Menu modifications £ * Menu modifications
* FillBSPMenu * FillBSPMenu
*/ */
const char *bsp_commands[256]; const char *bsp_commands[256];
+149 -151
View File
@@ -419,12 +419,12 @@ CClipPoint g_Clip1;
CClipPoint g_Clip2; CClipPoint g_Clip2;
CClipPoint g_Clip3; CClipPoint g_Clip3;
CClipPoint *g_pMovingClip; CClipPoint *g_pMovingClip;
brush_t g_brFrontSplits; idEditorBrush g_brFrontSplits;
brush_t g_brBackSplits; idEditorBrush g_brBackSplits;
brush_t g_brClipboard; idEditorBrush g_brClipboard;
brush_t g_brUndo; idEditorBrush g_brUndo;
entity_t g_enClipboard; idEditorEntity g_enClipboard;
idVec3 g_vRotateOrigin; idVec3 g_vRotateOrigin;
idVec3 g_vRotation; 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) { if (b == NULL) {
dragPoints.RemoveAll(); 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)); 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(); int count = dragPoints.GetSize();
for (int i = 0; i < count; i++) { for (int i = 0; i < count; i++) {
CDragPoint *drag = reinterpret_cast < CDragPoint * > (dragPoints.GetAt(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) { bool UpdateActiveDragPoint(const idVec3 &move) {
if (activeDrag) { if (activeDrag) {
idMat3 mat = Brush_RotationMatrix(activeDrag->pBrush); idMat3 mat = activeDrag->pBrush->Brush_RotationMatrix();
idMat3 invmat = mat.Transpose(); idMat3 invmat = mat.Transpose();
idVec3 target, up, right, start, end; idVec3 target, up, right, start, end;
CString str; CString str;
if (activeDrag->nType == LIGHT_TARGET) { if (activeDrag->nType == LIGHT_TARGET) {
GetVectorForKey(activeDrag->pBrush->owner, "light_target", target); activeDrag->pBrush->owner->GetVectorForKey("light_target", target);
GetVectorForKey(activeDrag->pBrush->owner, "light_up", up); activeDrag->pBrush->owner->GetVectorForKey("light_up", up);
GetVectorForKey(activeDrag->pBrush->owner, "light_right", right); activeDrag->pBrush->owner->GetVectorForKey("light_right", right);
target *= mat; target *= mat;
up *= mat; up *= mat;
right *= mat; right *= mat;
@@ -2553,68 +2551,68 @@ bool UpdateActiveDragPoint(const idVec3 &move) {
target *= invmat; target *= invmat;
up *= invmat; up *= invmat;
right *= invmat; right *= invmat;
SetKeyVec3(activeDrag->pBrush->owner, "light_target", target); activeDrag->pBrush->owner->SetKeyVec3("light_target", target);
SetKeyVec3(activeDrag->pBrush->owner, "light_up", up); activeDrag->pBrush->owner->SetKeyVec3("light_up", up);
SetKeyVec3(activeDrag->pBrush->owner, "light_right", right); activeDrag->pBrush->owner->SetKeyVec3("light_right", right);
target += (activeDrag->pBrush->trackLightOrigin) ? activeDrag->pBrush->owner->lightOrigin : activeDrag->pBrush->owner->origin; 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; up += target;
UpdateSelectablePoint(activeDrag->pBrush, Brush_TransformedPoint(activeDrag->pBrush,up), LIGHT_UP); UpdateSelectablePoint(activeDrag->pBrush, activeDrag->pBrush->Brush_TransformedPoint(up), LIGHT_UP);
right += target; 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) { else if (activeDrag->nType == LIGHT_UP) {
GetVectorForKey(activeDrag->pBrush->owner, "light_up", up); activeDrag->pBrush->owner->GetVectorForKey("light_up", up);
up *= mat; up *= mat;
up += move; up += move;
up *= invmat; up *= invmat;
SetKeyVec3(activeDrag->pBrush->owner, "light_up", up); activeDrag->pBrush->owner->SetKeyVec3("light_up", up);
GetVectorForKey(activeDrag->pBrush->owner, "light_target", target); activeDrag->pBrush->owner->GetVectorForKey("light_target", target);
target += (activeDrag->pBrush->trackLightOrigin) ? activeDrag->pBrush->owner->lightOrigin : activeDrag->pBrush->owner->origin; target += (activeDrag->pBrush->trackLightOrigin) ? activeDrag->pBrush->owner->lightOrigin : activeDrag->pBrush->owner->origin;
up += target; 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) { else if (activeDrag->nType == LIGHT_RIGHT) {
GetVectorForKey(activeDrag->pBrush->owner, "light_right", right); activeDrag->pBrush->owner->GetVectorForKey("light_right", right);
right *= mat; right *= mat;
right += move; right += move;
right *= invmat; right *= invmat;
SetKeyVec3(activeDrag->pBrush->owner, "light_right", right); activeDrag->pBrush->owner->SetKeyVec3("light_right", right);
GetVectorForKey(activeDrag->pBrush->owner, "light_target", target); activeDrag->pBrush->owner->GetVectorForKey("light_target", target);
target += (activeDrag->pBrush->trackLightOrigin) ? activeDrag->pBrush->owner->lightOrigin : activeDrag->pBrush->owner->origin; target += (activeDrag->pBrush->trackLightOrigin) ? activeDrag->pBrush->owner->lightOrigin : activeDrag->pBrush->owner->origin;
right += target; 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) { else if (activeDrag->nType == LIGHT_START) {
GetVectorForKey(activeDrag->pBrush->owner, "light_start", start); activeDrag->pBrush->owner->GetVectorForKey("light_start", start);
start *= mat; start *= mat;
start += move; start += move;
start *= invmat; 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; 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) { else if (activeDrag->nType == LIGHT_END) {
GetVectorForKey(activeDrag->pBrush->owner, "light_end", end); activeDrag->pBrush->owner->GetVectorForKey("light_end", end);
end *= mat; end *= mat;
end += move; end += move;
end *= invmat; 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; 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) { else if (activeDrag->nType == LIGHT_CENTER) {
GetVectorForKey(activeDrag->pBrush->owner, "light_center", end); activeDrag->pBrush->owner->GetVectorForKey("light_center", end);
end *= mat; end *= mat;
end += move; end += move;
end *= invmat; 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; 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 // FIXME: just build the frustrum values
Brush_Build(activeDrag->pBrush); activeDrag->pBrush->Brush_Build();
return true; 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; *pFront = NULL;
*pBack = NULL; *pBack = NULL;
if (ClipMode()) { if (ClipMode()) {
@@ -3153,10 +3151,10 @@ void CXYWnd::ProduceSplits(brush_t **pFront, brush_t **pBack) {
======================================================================================================================= =======================================================================================================================
======================================================================================================================= =======================================================================================================================
*/ */
void CleanList(brush_t *pList) { void CleanList(idEditorBrush *pList) {
brush_t *pBrush = pList->next; idEditorBrush *pBrush = pList->next;
while (pBrush != NULL && pBrush != pList) { while (pBrush != NULL && pBrush != pList) {
brush_t *pNext = pBrush->next; idEditorBrush *pNext = pBrush->next;
Brush_Free(pBrush); Brush_Free(pBrush);
pBrush = pNext; pBrush = pNext;
} }
@@ -3170,12 +3168,12 @@ void CXYWnd::ProduceSplitLists() {
if (AnyPatchesSelected()) { if (AnyPatchesSelected()) {
Sys_Status("Deslecting patches for clip operation.\n"); Sys_Status("Deslecting patches for clip operation.\n");
brush_t *next; idEditorBrush *next;
for (brush_t * pb = selected_brushes.next; pb != &selected_brushes; pb = next) { for (idEditorBrush * pb = selected_brushes.next; pb != &selected_brushes; pb = next) {
next = pb->next; next = pb->next;
if (pb->pPatch) { if (pb->pPatch) {
Brush_RemoveFromList(pb); pb->Brush_RemoveFromList();
Brush_AddToList(pb, &active_brushes); pb->Brush_AddToList(&active_brushes);
UpdatePatchInspector(); UpdatePatchInspector();
} }
} }
@@ -3186,10 +3184,10 @@ void CXYWnd::ProduceSplitLists() {
g_brFrontSplits.next = &g_brFrontSplits; g_brFrontSplits.next = &g_brFrontSplits;
g_brBackSplits.next = &g_brBackSplits; g_brBackSplits.next = &g_brBackSplits;
brush_t *pBrush; idEditorBrush *pBrush;
for (pBrush = selected_brushes.next; pBrush != NULL && pBrush != &selected_brushes; pBrush = pBrush->next) { for (pBrush = selected_brushes.next; pBrush != NULL && pBrush != &selected_brushes; pBrush = pBrush->next) {
brush_t *pFront = NULL; idEditorBrush *pFront = NULL;
brush_t *pBack = NULL; idEditorBrush *pBack = NULL;
if (ClipMode()) { if (ClipMode()) {
if (g_Clip1.Set() && g_Clip2.Set()) { if (g_Clip1.Set() && g_Clip2.Set()) {
face_t face; face_t face;
@@ -3222,11 +3220,11 @@ void CXYWnd::ProduceSplitLists() {
Brush_SplitBrushByFace(pBrush, &face, &pFront, &pBack); Brush_SplitBrushByFace(pBrush, &face, &pFront, &pBack);
if (pBack) { if (pBack) {
Brush_AddToList(pBack, &g_brBackSplits); pBack->Brush_AddToList(&g_brBackSplits);
} }
if (pFront) { 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) { void Brush_CopyList(idEditorBrush *pFrom, idEditorBrush *pTo) {
brush_t *pBrush = pFrom->next; idEditorBrush *pBrush = pFrom->next;
while (pBrush != NULL && pBrush != pFrom) { while (pBrush != NULL && pBrush != pFrom) {
brush_t *pNext = pBrush->next; idEditorBrush *pNext = pBrush->next;
Brush_RemoveFromList(pBrush); pBrush->Brush_RemoveFromList();
Brush_AddToList(pBrush, pTo); pBrush->Brush_AddToList(pTo);
pBrush = pNext; pBrush = pNext;
} }
} }
@@ -3727,8 +3725,8 @@ void CXYWnd::OnPaint() {
if (g_Clip1.Set() && g_Clip2.Set() && selected_brushes.next != &selected_brushes) { if (g_Clip1.Set() && g_Clip2.Set() && selected_brushes.next != &selected_brushes) {
ProduceSplitLists(); ProduceSplitLists();
brush_t *pBrush; idEditorBrush *pBrush;
brush_t *pList = ((m_nViewType == XZ) ? !g_bSwitch : g_bSwitch) ? &g_brBackSplits : &g_brFrontSplits; idEditorBrush *pList = ((m_nViewType == XZ) ? !g_bSwitch : g_bSwitch) ? &g_brBackSplits : &g_brFrontSplits;
for (pBrush = pList->next; pBrush != NULL && pBrush != pList; pBrush = pBrush->next) { for (pBrush = pList->next; pBrush != NULL && pBrush != pList; pBrush = pBrush->next) {
glColor3f(1, 1, 0); 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; eclass_t *pecNew;
entity_t *petNew; idEditorEntity *petNew;
if (stricmp(pName, "worldspawn") == 0) { if (stricmp(pName, "worldspawn") == 0) {
g_pParentWnd->MessageBox("Can't create an entity with worldspawn.", "info", 0); g_pParentWnd->MessageBox("Can't create an entity with worldspawn.", "info", 0);
return; return;
@@ -3814,21 +3812,21 @@ void CreateEntityFromName(char *pName, brush_t *pBrush, bool forceFixed, idVec3
} }
// create it // create it
petNew = Entity_Create(pecNew, forceFixed); petNew = idEditorEntity::Entity_Create(pecNew, forceFixed);
if (petNew && idStr::Icmp(pName, "light") == 0 ) { if (petNew && idStr::Icmp(pName, "light") == 0 ) {
idVec3 rad = max - min; idVec3 rad = max - min;
rad *= 0.5; rad *= 0.5;
if (rad.x != 0 && rad.y != 0 && rad.z != 0) { 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))); petNew->SetKeyValue("light_radius", va("%g %g %g", idMath::Fabs(rad.x), idMath::Fabs(rad.y), idMath::Fabs(rad.z)));
DeleteKey(petNew, "light"); petNew->DeleteKey("light");
} }
} }
if (petNew == NULL) { if (petNew == NULL) {
if (!((selected_brushes.next == &selected_brushes) || (selected_brushes.next->next != &selected_brushes))) { 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)) { if (b->owner != world_entity && ((b->owner->eclass->fixedsize && pecNew->fixedsize) || forceFixed)) {
idVec3 mins, maxs; idVec3 mins, maxs;
idVec3 origin; idVec3 origin;
@@ -3839,13 +3837,13 @@ void CreateEntityFromName(char *pName, brush_t *pBrush, bool forceFixed, idVec3
VectorAdd(pecNew->mins, origin, mins); VectorAdd(pecNew->mins, origin, mins);
VectorAdd(pecNew->maxs, origin, maxs); VectorAdd(pecNew->maxs, origin, maxs);
brush_t *nb = Brush_Create(mins, maxs, &pecNew->texdef); idEditorBrush *nb = Brush_Create(mins, maxs, &pecNew->texdef);
Entity_LinkBrush(b->owner, nb); b->owner->Entity_LinkBrush(nb);
nb->owner->eclass = pecNew; nb->owner->eclass = pecNew;
SetKeyValue(nb->owner, "classname", pName); nb->owner->SetKeyValue("classname", pName);
Brush_Free(b); Brush_Free(b);
Brush_Build(nb); nb->Brush_Build();
Brush_AddToList(nb, &active_brushes); nb->Brush_AddToList(&active_brushes);
Select_Brush(nb); Select_Brush(nb);
return; return;
} }
@@ -3858,11 +3856,11 @@ void CreateEntityFromName(char *pName, brush_t *pBrush, bool forceFixed, idVec3
Select_Deselect(); 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; // &selected_brushes) pEntity = selected_brushes.next->owner;
// //
Select_Brush(petNew->brushes.onext); 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; idVec3 mins, maxs;
int i; int i;
float temp; float temp;
brush_t *n; idEditorBrush *n;
pWnd->SnapToPoint(x, y, mins); pWnd->SnapToPoint(x, y, mins);
x += 32; x += 32;
@@ -3906,9 +3904,9 @@ brush_t *CreateEntityBrush(int x, int y, CXYWnd *pWnd) {
return NULL; return NULL;
} }
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();
return n; return n;
} }
@@ -3924,7 +3922,7 @@ void CreateRightClickEntity(CXYWnd *pWnd, int x, int y, char *pName) {
CRect rctZ; CRect rctZ;
pWnd->GetClientRect(rctZ); pWnd->GetClientRect(rctZ);
brush_t *pBrush; idEditorBrush *pBrush;
if (selected_brushes.next == &selected_brushes) { if (selected_brushes.next == &selected_brushes) {
pBrush = CreateEntityBrush(x, rctZ.Height() - 1 - y, pWnd); pBrush = CreateEntityBrush(x, rctZ.Height() - 1 - y, pWnd);
min.Zero(); 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; idVec3 mins, maxs;
int i; int i;
brush_t *n; idEditorBrush *n;
for (i = 0; i < 3; i++) { for (i = 0; i < 3; i++) {
mins[i] = v[i] - 16; mins[i] = v[i] - 16;
@@ -3956,10 +3954,10 @@ brush_t *CreateSmartBrush(idVec3 v) {
return NULL; return NULL;
} }
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();
return n; 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)); array.Add(reinterpret_cast < void * > (selected_brushes.next));
Select_Deselect(); Select_Deselect();
brush_t *pBrush = CreateSmartBrush(g_PathPoints[0]); idEditorBrush *pBrush = CreateSmartBrush(g_PathPoints[0]);
array.Add(pBrush); array.Add(pBrush);
Select_Deselect(); Select_Deselect();
Select_Brush(reinterpret_cast < brush_t * > (array.GetAt(0))); Select_Brush(reinterpret_cast < idEditorBrush * > (array.GetAt(0)));
Select_Brush(reinterpret_cast < brush_t * > (array.GetAt(1))); Select_Brush(reinterpret_cast < idEditorBrush * > (array.GetAt(1)));
ConnectEntities(); ConnectEntities();
g_bScreenUpdates = true; g_bScreenUpdates = true;
} }
@@ -4034,7 +4032,7 @@ void FinishSmartCreation() {
CPtrArray array; CPtrArray array;
HideInfoDialog(); HideInfoDialog();
brush_t *pEntities = NULL; idEditorBrush *pEntities = NULL;
if (g_strSmartEntity.Find("Smart_Train") >= 0) { if (g_strSmartEntity.Find("Smart_Train") >= 0) {
g_bScreenUpdates = false; g_bScreenUpdates = false;
CreateRightClickEntity(g_pParentWnd->ActiveXY(), g_nSmartX, g_nSmartY, "func_train"); CreateRightClickEntity(g_pParentWnd->ActiveXY(), g_nSmartX, g_nSmartY, "func_train");
@@ -4054,8 +4052,8 @@ void FinishSmartCreation() {
for (n = 0; n < g_nPathCount; n++) { for (n = 0; n < g_nPathCount; n++) {
Select_Deselect(); Select_Deselect();
Select_Brush(reinterpret_cast < brush_t * > (array.GetAt(n))); Select_Brush(reinterpret_cast < idEditorBrush * > (array.GetAt(n)));
Select_Brush(reinterpret_cast < brush_t * > (array.GetAt(n + 1))); Select_Brush(reinterpret_cast < idEditorBrush * > (array.GetAt(n + 1)));
ConnectEntities(); ConnectEntities();
} }
@@ -4102,7 +4100,7 @@ void CXYWnd::OnEntityCreate(unsigned int nID) {
} }
else if (strItem.CompareNoCase("Remove") == 0) { else if (strItem.CompareNoCase("Remove") == 0) {
// remove selected brushes from their current group // remove selected brushes from their current group
brush_t *b; idEditorBrush *b;
for (b = selected_brushes.next; b != &selected_brushes; b = b->next) { 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; idVec3 mins, maxs, junk;
int i; int i;
float temp; float temp;
brush_t *n; idEditorBrush *n;
if ( radiant_entityMode.GetBool() ) { if ( radiant_entityMode.GetBool() ) {
return; 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_strStatus.Format("Size X:: %.1f Y:: %.1f Z:: %.1f", vSize[0], vSize[1], vSize[2]);
g_pParentWnd->SetStatusText(2, g_strStatus); 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_ALL);
Sys_UpdateWindows(W_XY | W_CAMERA); Sys_UpdateWindows(W_XY | W_CAMERA);
@@ -5327,7 +5325,7 @@ void CXYWnd::DrawZIcon(void) {
FilterBrush FilterBrush
======================================================================================================================= =======================================================================================================================
*/ */
bool FilterBrush(brush_t *pb) { bool FilterBrush(idEditorBrush *pb) {
if (!pb->owner) { if (!pb->owner) {
return false; // during construction return false; // during construction
@@ -5476,8 +5474,8 @@ bool FilterBrush(brush_t *pb) {
*/ */
struct pathLineNamedEntity_t { struct pathLineNamedEntity_t {
const char* name; const char* name;
entity_t* entity; idEditorEntity* entity;
brush_t* brush; idEditorBrush* brush;
}; };
static bool DrawPathLines_IsTargetKey(const char* key) { static bool DrawPathLines_IsTargetKey(const char* key) {
@@ -5502,22 +5500,22 @@ static bool DrawPathLines_IsTargetKey(const char* key) {
return true; return true;
} }
static brush_t* DrawPathLines_FirstBrush(entity_t* ent) { static idEditorBrush* DrawPathLines_FirstBrush(idEditorEntity* ent) {
if (ent == NULL) { if (ent == NULL) {
return NULL; return NULL;
} }
brush_t* brush = ent->brushes.onext; idEditorBrush* brush = ent->brushes.onext;
return (brush != &ent->brushes) ? brush : NULL; return (brush != &ent->brushes) ? brush : NULL;
} }
static void DrawPathLines_AppendNamedEntity(idList<pathLineNamedEntity_t>& namedEntities, idHashIndex& nameHash, entity_t* ent) { static void DrawPathLines_AppendNamedEntity(idList<pathLineNamedEntity_t>& namedEntities, idHashIndex& nameHash, idEditorEntity* ent) {
const char* name = ValueForKey(ent, "name"); const char* name = ent->ValueForKey("name");
if (name == NULL || name[0] == '\0') { if (name == NULL || name[0] == '\0') {
return; return;
} }
brush_t* brush = DrawPathLines_FirstBrush(ent); idEditorBrush* brush = DrawPathLines_FirstBrush(ent);
if (brush == NULL) { if (brush == NULL) {
return; return;
} }
@@ -5531,7 +5529,7 @@ static void DrawPathLines_AppendNamedEntity(idList<pathLineNamedEntity_t>& named
nameHash.Add(nameHash.GenerateKey(name, true), index); 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) { if (namedTarget.entity == NULL || namedTarget.entity->eclass == NULL || source == NULL || sourceBrush == NULL) {
return; return;
} }
@@ -5577,12 +5575,12 @@ void DrawPathLines(void) {
idHashIndex nameHash(1024, 1024); idHashIndex nameHash(1024, 1024);
namedEntities.SetGranularity(256); 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); DrawPathLines_AppendNamedEntity(namedEntities, nameHash, ent);
} }
for (entity_t* source = entities.next; source != &entities; source = source->next) { for (idEditorEntity* source = entities.next; source != &entities; source = source->next) {
brush_t* sourceBrush = DrawPathLines_FirstBrush(source); idEditorBrush* sourceBrush = DrawPathLines_FirstBrush(source);
if (sourceBrush == NULL) { if (sourceBrush == NULL) {
continue; continue;
} }
@@ -5736,7 +5734,7 @@ void CXYWnd::PaintSizeInfo(int nDim1, int nDim2, idVec3 vMinBounds, idVec3 vMaxB
/* XY_Draw */ /* XY_Draw */
long g_lCount = 0; long g_lCount = 0;
long g_lTotal = 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; return;
} }
brush_t *brush; idEditorBrush *brush;
float w, h; float w, h;
entity_t *e; idEditorEntity *e;
idVec3 mins, maxs; idVec3 mins, maxs;
int drawn, culled; int drawn, culled;
int i; int i;
@@ -5837,7 +5835,7 @@ void CXYWnd::XY_Draw() {
glColor3fv(g_qeglobals.d_savedinfo.colors[COLOR_BRUSHES].ToFloatPtr()); glColor3fv(g_qeglobals.d_savedinfo.colors[COLOR_BRUSHES].ToFloatPtr());
} }
Brush_DrawXY( brush, m_nViewType ); brush->Brush_DrawXY(m_nViewType );
} }
DrawPathLines(); DrawPathLines();
@@ -5901,7 +5899,7 @@ void CXYWnd::XY_Draw() {
bool bFixedSize = false; bool bFixedSize = false;
for (brush = selected_brushes.next; brush != &selected_brushes; brush = brush->next) { for (brush = selected_brushes.next; brush != &selected_brushes; brush = brush->next) {
drawn++; drawn++;
Brush_DrawXY(brush, m_nViewType, true); brush->Brush_DrawXY(m_nViewType, true);
if (!bFixedSize) { if (!bFixedSize) {
if (brush->owner->eclass->fixedsize) { if (brush->owner->eclass->fixedsize) {
@@ -6073,7 +6071,7 @@ void CXYWnd::OnSize(UINT nType, int cx, int cy) {
InvalidateRect(NULL, false); InvalidateRect(NULL, false);
} }
brush_t hold_brushes; idEditorBrush hold_brushes;
/* /*
======================================================================================================================= =======================================================================================================================
@@ -6084,8 +6082,8 @@ void CXYWnd::Clip() {
hold_brushes.next = &hold_brushes; hold_brushes.next = &hold_brushes;
ProduceSplitLists(); ProduceSplitLists();
// brush_t* pList = (g_bSwitch) ? &g_brFrontSplits : &g_brBackSplits; // idEditorBrush* pList = (g_bSwitch) ? &g_brFrontSplits : &g_brBackSplits;
brush_t *pList; idEditorBrush *pList;
if (g_PrefsDlg.m_bSwitchClip) { if (g_PrefsDlg.m_bSwitchClip) {
pList = ((m_nViewType == XZ) ? g_bSwitch : !g_bSwitch) ? &g_brFrontSplits : &g_brBackSplits; pList = ((m_nViewType == XZ) ? g_bSwitch : !g_bSwitch) ? &g_brFrontSplits : &g_brBackSplits;
} }
@@ -6159,7 +6157,7 @@ void CXYWnd::FlipClip() {
void CXYWnd::PositionView() { void CXYWnd::PositionView() {
int nDim1 = (m_nViewType == YZ) ? 1 : 0; int nDim1 = (m_nViewType == YZ) ? 1 : 0;
int nDim2 = (m_nViewType == XY) ? 1 : 2; int nDim2 = (m_nViewType == XY) ? 1 : 2;
brush_t *b = selected_brushes.next; idEditorBrush *b = selected_brushes.next;
if (b && b->next != b) { if (b && b->next != b) {
m_vOrigin[nDim1] = b->mins[nDim1]; m_vOrigin[nDim1] = b->mins[nDim1];
m_vOrigin[nDim2] = b->mins[nDim2]; m_vOrigin[nDim2] = b->mins[nDim2];
@@ -6292,12 +6290,12 @@ void CXYWnd::OnSelectMouserotate() {
======================================================================================================================= =======================================================================================================================
*/ */
void CleanCopyEntities() { void CleanCopyEntities() {
entity_t *pe = g_enClipboard.next; idEditorEntity *pe = g_enClipboard.next;
while (pe != NULL && pe != &g_enClipboard) { while (pe != NULL && pe != &g_enClipboard) {
entity_t *next = pe->next; idEditorEntity *next = pe->next;
pe->epairs.Clear(); pe->epairs.Clear();
Entity_Free(pe); idEditorEntity::Entity_Free(pe);
pe = next; pe = next;
} }
@@ -6308,10 +6306,10 @@ void CleanCopyEntities() {
======================================================================================================================= =======================================================================================================================
======================================================================================================================= =======================================================================================================================
*/ */
entity_t *Entity_CopyClone(entity_t *e) { idEditorEntity *Entity_CopyClone(idEditorEntity *e) {
entity_t *n; idEditorEntity *n;
n = Entity_New(); n = idEditorEntity::Entity_New();
n->brushes.onext = n->brushes.oprev = &n->brushes; n->brushes.onext = n->brushes.oprev = &n->brushes;
n->eclass = e->eclass; n->eclass = e->eclass;
n->rotation = e->rotation; 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(); int nSize = pList->GetSize();
while (nSize-- > 0) { while (nSize-- > 0) {
entity_t *pEntity = reinterpret_cast < entity_t * > (pList->GetAt(nSize)); idEditorEntity *pEntity = reinterpret_cast < idEditorEntity * > (pList->GetAt(nSize));
if (pEntity == pFind) { if (pEntity == pFind) {
return true; return true;
} }
@@ -6391,24 +6389,24 @@ void CXYWnd::Copy()
CPtrArray holdArray; CPtrArray holdArray;
CleanList(&g_brClipboard); CleanList(&g_brClipboard);
CleanCopyEntities(); 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) { if (pBrush->owner == world_entity) {
brush_t *pClone = Brush_Clone(pBrush); idEditorBrush *pClone = Brush_Clone(pBrush);
pClone->owner = NULL; pClone->owner = NULL;
Brush_AddToList(pClone, &g_brClipboard); pClone->Brush_AddToList(&g_brClipboard);
} }
else { else {
if (!OnList(pBrush->owner, &holdArray)) { if (!OnList(pBrush->owner, &holdArray)) {
entity_t *e = pBrush->owner; idEditorEntity *e = pBrush->owner;
holdArray.Add(reinterpret_cast < void * > (e)); holdArray.Add(reinterpret_cast < void * > (e));
entity_t *pEClone = Entity_CopyClone(e); idEditorEntity *pEClone = Entity_CopyClone(e);
for (brush_t * pEB = e->brushes.onext; pEB != &e->brushes; pEB = pEB->onext) { for (idEditorBrush * pEB = e->brushes.onext; pEB != &e->brushes; pEB = pEB->onext) {
brush_t *pClone = Brush_Clone(pEB); idEditorBrush *pClone = Brush_Clone(pEB);
// Brush_AddToList (pClone, &g_brClipboard); // pClone->Brush_AddToList(&g_brClipboard);
Entity_LinkBrush(pEClone, pClone); pEClone->Entity_LinkBrush(pClone);
Brush_Build(pClone); pClone->Brush_Build();
} }
} }
} }
@@ -6423,10 +6421,10 @@ void CXYWnd::Copy()
void CXYWnd::Undo() { void CXYWnd::Undo() {
/* /*
* if (g_brUndo.next != &g_brUndo) { g_bScreenUpdates = false; Select_Delete(); * if (g_brUndo.next != &g_brUndo) { g_bScreenUpdates = false; Select_Delete();
* for (brush_t* pBrush = g_brUndo.next ; pBrush != NULL && pBrush != &g_brUndo ; * for (idEditorBrush* pBrush = g_brUndo.next ; pBrush != NULL && pBrush != &g_brUndo ;
* pBrush=pBrush->next) { brush_t* pClone = Brush_Clone(pBrush); Brush_AddToList * pBrush=pBrush->next) { idEditorBrush* pClone = Brush_Clone(pBrush); Brush_AddToList
* (pClone, &active_brushes); Entity_LinkBrush (pBrush->pUndoOwner, pClone); * (pClone, &active_brushes); pBrush->pUndoOwner->Entity_LinkBrush(pClone);
* Brush_Build(pClone); Select_Brush(pClone); } CleanList(&g_brUndo); * pClone->Brush_Build(); Select_Brush(pClone); } CleanList(&g_brUndo);
* g_bScreenUpdates = true; Sys_UpdateWindows(W_ALL); } else common->Printf("Nothing * g_bScreenUpdates = true; Sys_UpdateWindows(W_ALL); } else common->Printf("Nothing
* to undo.../n"); * to undo.../n");
*/ */
@@ -6446,8 +6444,8 @@ void CXYWnd::UndoClear() {
*/ */
void CXYWnd::UndoCopy() { void CXYWnd::UndoCopy() {
/* /*
* CleanList(&g_brUndo); for (brush_t* pBrush = selected_brushes.next ; pBrush != * CleanList(&g_brUndo); for (idEditorBrush* pBrush = selected_brushes.next ; pBrush !=
* NULL && pBrush != &selected_brushes ; pBrush=pBrush->next) { brush_t* pClone = * NULL && pBrush != &selected_brushes ; pBrush=pBrush->next) { idEditorBrush* pClone =
* Brush_Clone(pBrush); pClone->pUndoOwner = pBrush->owner; Brush_AddToList * Brush_Clone(pBrush); pClone->pUndoOwner = pBrush->owner; Brush_AddToList
* (pClone, &g_brUndo); } * (pClone, &g_brUndo); }
*/ */
@@ -6516,30 +6514,30 @@ void CXYWnd::Paste()
if (g_brClipboard.next != &g_brClipboard || g_enClipboard.next != &g_enClipboard) { if (g_brClipboard.next != &g_brClipboard || g_enClipboard.next != &g_enClipboard) {
Select_Deselect(); Select_Deselect();
for (brush_t * pBrush = g_brClipboard.next; pBrush != NULL && pBrush != &g_brClipboard; pBrush = pBrush->next) { for (idEditorBrush * pBrush = g_brClipboard.next; pBrush != NULL && pBrush != &g_brClipboard; pBrush = pBrush->next) {
brush_t *pClone = Brush_Clone(pBrush); idEditorBrush *pClone = Brush_Clone(pBrush);
// pClone->owner = pBrush->owner; // pClone->owner = pBrush->owner;
if (pClone->owner == NULL) { if (pClone->owner == NULL) {
Entity_LinkBrush(world_entity, pClone); world_entity->Entity_LinkBrush(pClone);
} }
Brush_AddToList(pClone, &selected_brushes); pClone->Brush_AddToList(&selected_brushes);
Brush_Build(pClone); pClone->Brush_Build();
} }
for for
( (
entity_t * pEntity = g_enClipboard.next; idEditorEntity * pEntity = g_enClipboard.next;
pEntity != NULL && pEntity != &g_enClipboard; pEntity != NULL && pEntity != &g_enClipboard;
pEntity = pEntity->next pEntity = pEntity->next
) { ) {
entity_t *pEClone = Entity_Clone(pEntity); idEditorEntity *pEClone = idEditorEntity::Entity_Clone(pEntity);
for (brush_t * pEB = pEntity->brushes.onext; pEB != &pEntity->brushes; pEB = pEB->onext) { for (idEditorBrush * pEB = pEntity->brushes.onext; pEB != &pEntity->brushes; pEB = pEB->onext) {
brush_t *pClone = Brush_Clone(pEB); idEditorBrush *pClone = Brush_Clone(pEB);
Brush_AddToList(pClone, &selected_brushes); pClone->Brush_AddToList(&selected_brushes);
Entity_LinkBrush(pEClone, pClone); pEClone->Entity_LinkBrush(pClone);
Brush_Build(pClone); pClone->Brush_Build();
if (pClone->owner && pClone->owner != world_entity) { if (pClone->owner && pClone->owner != world_entity) {
g_Inspectors->UpdateEntitySel(pClone->owner->eclass); g_Inspectors->UpdateEntitySel(pClone->owner->eclass);
} }
+2 -2
View File
@@ -322,7 +322,7 @@ const int SCALE_X = 0x01;
const int SCALE_Y = 0x02; const int SCALE_Y = 0x02;
const int SCALE_Z = 0x04; const int SCALE_Z = 0x04;
bool FilterBrush(brush_t *pb); bool FilterBrush(idEditorBrush *pb);
typedef void (PFNPathCallback)(bool, int); typedef void (PFNPathCallback)(bool, int);
// as i didn't really encapsulate anything this // as i didn't really encapsulate anything this
@@ -499,7 +499,7 @@ protected:
void OriginalButtonUp(UINT nFlags, CPoint point); void OriginalButtonUp(UINT nFlags, CPoint point);
void OriginalButtonDown(UINT nFlags, CPoint point); void OriginalButtonDown(UINT nFlags, CPoint point);
void ProduceSplits(brush_t** pFront, brush_t** pBack); void ProduceSplits(idEditorBrush** pFront, idEditorBrush** pBack);
void ProduceSplitLists(); void ProduceSplitLists();
void HandleDrop(); void HandleDrop();
void PaintSizeInfo(int nDim1, int nDim2, idVec3 vMinBounds, idVec3 vMaxBounds); void PaintSizeInfo(int nDim1, int nDim2, idVec3 vMinBounds, idVec3 vMaxBounds);
+9 -9
View File
@@ -58,7 +58,7 @@ static int cursorx, cursory;
*/ */
void Z_MouseDown(int x, int y, int buttons) { void Z_MouseDown(int x, int y, int buttons) {
idVec3 org, dir, vup, vright; idVec3 org, dir, vup, vright;
brush_t *b; idEditorBrush *b;
Sys_GetCursorPos(&cursorx, &cursory); Sys_GetCursorPos(&cursorx, &cursory);
@@ -220,7 +220,7 @@ void Z_MouseMoved(int x, int y, int buttons) {
/* /*
======================================================================================================================= =======================================================================================================================
DRAWING £ DRAWING
Z_DrawGrid Z_DrawGrid
======================================================================================================================= =======================================================================================================================
*/ */
@@ -339,7 +339,7 @@ GLbitfield glbitClear = GL_COLOR_BUFFER_BIT; // HACK
======================================================================================================================= =======================================================================================================================
*/ */
void Z_Draw(void) { void Z_Draw(void) {
brush_t *brush; idEditorBrush *brush;
float w, h; float w, h;
float top, bottom; float top, bottom;
idVec3 org_top, org_bottom, dir_up, dir_down; idVec3 org_top, org_bottom, dir_up, dir_down;
@@ -362,10 +362,10 @@ void Z_Draw(void) {
); );
/* /*
* GL Bug £ * GL Bug
* When not using hw acceleration, gl will fault if we clear the depth buffer bit * When not using hw acceleration, gl will fault if we clear the depth buffer bit
* on the first pass. The hack fix is to set the GL_DEPTH_BUFFER_BIT only after * on the first pass. The hack fix is to set the GL_DEPTH_BUFFER_BIT only after
* Z_Draw() has been called once. Yeah, right. £ * Z_Draw() has been called once. Yeah, right.
* glClear(glbitClear); * glClear(glbitClear);
*/ */
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
@@ -418,12 +418,12 @@ void Z_Draw(void) {
continue; continue;
} }
if (!Brush_Ray(org_top, dir_down, brush, &top)) { if (!brush->Brush_Ray(org_top, dir_down, &top)) {
continue; continue;
} }
top = org_top[2] - top; top = org_top[2] - top;
if (!Brush_Ray(org_bottom, dir_up, brush, &bottom)) { if (!brush->Brush_Ray(org_bottom, dir_up, &bottom)) {
continue; continue;
} }
@@ -458,9 +458,9 @@ void Z_Draw(void) {
brush->maxs[1] <= z.origin[1] brush->maxs[1] <= z.origin[1]
) )
) { ) {
if (Brush_Ray(org_top, dir_down, brush, &top)) { if (brush->Brush_Ray(org_top, dir_down, &top)) {
top = org_top[2] - top; top = org_top[2] - top;
if (Brush_Ray(org_bottom, dir_up, brush, &bottom)) { if (brush->Brush_Ray(org_bottom, dir_up, &bottom)) {
bottom = org_bottom[2] + bottom; bottom = org_bottom[2] + bottom;
//q = declManager->FindMaterial(brush->brush_faces->texdef.name); //q = declManager->FindMaterial(brush->brush_faces->texdef.name);
+7 -7
View File
@@ -90,7 +90,7 @@ static LPCSTR vtos(idVec3 &v3)
struct PairBrushFace_t struct PairBrushFace_t
{ {
face_t* pFace; face_t* pFace;
brush_t* pBrush; idEditorBrush* pBrush;
}; };
idList < PairBrushFace_t > FacesToCaulk; idList < PairBrushFace_t > FacesToCaulk;
void Select_AutoCaulk() void Select_AutoCaulk()
@@ -102,8 +102,8 @@ void Select_AutoCaulk()
int iSystemBrushesSkipped = 0; int iSystemBrushesSkipped = 0;
face_t *pSelectedFace; face_t *pSelectedFace;
brush_t *next; idEditorBrush *next;
for (brush_t *pSelectedBrush = selected_brushes.next ; pSelectedBrush != &selected_brushes ; pSelectedBrush = next) for (idEditorBrush *pSelectedBrush = selected_brushes.next ; pSelectedBrush != &selected_brushes ; pSelectedBrush = next)
{ {
next = pSelectedBrush->next; next = pSelectedBrush->next;
@@ -129,8 +129,8 @@ void Select_AutoCaulk()
for (int iBrushListToScan = 0; iBrushListToScan<2; iBrushListToScan++) for (int iBrushListToScan = 0; iBrushListToScan<2; iBrushListToScan++)
{ {
brush_t *snext; idEditorBrush *snext;
for (brush_t *pScannedBrush = (iBrushListToScan?active_brushes.next:selected_brushes.next); pScannedBrush != (iBrushListToScan?&active_brushes:&selected_brushes) ; pScannedBrush = snext) for (idEditorBrush *pScannedBrush = (iBrushListToScan?active_brushes.next:selected_brushes.next); pScannedBrush != (iBrushListToScan?&active_brushes:&selected_brushes) ; pScannedBrush = snext)
{ {
snext = pScannedBrush->next; snext = pScannedBrush->next;
@@ -311,13 +311,13 @@ void Select_AutoCaulk()
{ {
PairBrushFace_t &PairBrushFace = FacesToCaulk[iListEntry]; PairBrushFace_t &PairBrushFace = FacesToCaulk[iListEntry];
face_t *pFace = PairBrushFace.pFace; face_t *pFace = PairBrushFace.pFace;
brush_t*pBrush= PairBrushFace.pBrush; idEditorBrush*pBrush= PairBrushFace.pBrush;
pFace->d_texture = pCaulk; pFace->d_texture = pCaulk;
pFace->texdef = tex; pFace->texdef = tex;
Face_FitTexture(pFace, 1, 1); // this doesn't work here for some reason... duh. Face_FitTexture(pFace, 1, 1); // this doesn't work here for some reason... duh.
Brush_Build(pBrush); pBrush->Brush_Build();
iFacesCaulked++; iFacesCaulked++;
} }