mirror of
https://github.com/jmarshall23/DoomRTX.git
synced 2026-08-17 11:00:38 +02:00
entity_t and brush_t now converted to idEditorEntity and idEditorBrush
This commit is contained in:
@@ -50,7 +50,7 @@ static char THIS_FILE[] = __FILE__;
|
||||
extern void DrawPathLines();
|
||||
|
||||
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_ScaleTexture(float x, float y);
|
||||
extern void Select_RotateTexture(float amt, bool absolute);
|
||||
@@ -798,10 +798,10 @@ static void CameraNav_BuildEntityInfo(CCamWnd* cam, idStr* lines, int& numLines)
|
||||
return;
|
||||
}
|
||||
|
||||
entity_t* ent = trace.brush->owner;
|
||||
idEditorEntity* ent = trace.brush->owner;
|
||||
CameraNav_AddLine(lines, numLines, "Entity");
|
||||
CameraNav_AddLine(lines, numLines, va("class: %s", ValueForKey(ent, "classname")));
|
||||
CameraNav_AddLine(lines, numLines, va("name: %s", ValueForKey(ent, "name")));
|
||||
CameraNav_AddLine(lines, numLines, va("class: %s", ent->ValueForKey("classname")));
|
||||
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++) {
|
||||
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;
|
||||
}
|
||||
|
||||
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') {
|
||||
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) {
|
||||
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) {
|
||||
return true;
|
||||
}
|
||||
@@ -948,12 +948,12 @@ static bool CamWnd_EntityNameMatches(entity_t* ent, const char* name) {
|
||||
return false;
|
||||
}
|
||||
|
||||
static bool CamWnd_GetEntityLinePoint(entity_t* ent, idVec3& point) {
|
||||
static bool CamWnd_GetEntityLinePoint(idEditorEntity* ent, idVec3& point) {
|
||||
if (ent == NULL) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (GetVectorForKey(ent, "origin", point)) {
|
||||
if (ent->GetVectorForKey("origin", point)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -961,7 +961,7 @@ static bool CamWnd_GetEntityLinePoint(entity_t* ent, idVec3& point) {
|
||||
bounds.Clear();
|
||||
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->maxs);
|
||||
haveBounds = true;
|
||||
@@ -975,7 +975,7 @@ static bool CamWnd_GetEntityLinePoint(entity_t* ent, idVec3& point) {
|
||||
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) {
|
||||
return;
|
||||
}
|
||||
@@ -994,7 +994,7 @@ static void CamWnd_DrawVisibleTargetLine(entity_t* source, entity_t* target) {
|
||||
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') {
|
||||
return;
|
||||
}
|
||||
@@ -1007,14 +1007,14 @@ static void CamWnd_DrawVisibleTargetLinesForName(entity_t* source, const char* t
|
||||
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)) {
|
||||
CamWnd_DrawVisibleTargetLine(source, target);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void CamWnd_DrawVisibleTargetLinesForEntity(entity_t* source) {
|
||||
static void CamWnd_DrawVisibleTargetLinesForEntity(idEditorEntity* source) {
|
||||
if (source == NULL || !Outliner_IsEntityVisible(source)) {
|
||||
return;
|
||||
}
|
||||
@@ -1051,7 +1051,7 @@ static void CamWnd_DrawVisiblePathLines() {
|
||||
CamWnd_DrawVisibleTargetLinesForEntity(world_entity);
|
||||
}
|
||||
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);
|
||||
}
|
||||
}
|
||||
@@ -1070,7 +1070,7 @@ all GL viewports/scissors use the reduced camera height, which keeps the camera
|
||||
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_PROP_MENU_BAR = "QER_CamWnd_MenuBar";
|
||||
@@ -1733,7 +1733,7 @@ static bool CamWnd_IsUtilityMaterial(const idMaterial* material) {
|
||||
return false;
|
||||
}
|
||||
|
||||
static bool CamWnd_BrushUsesOnlyUtilityMaterials(brush_t* brush) {
|
||||
static bool CamWnd_BrushUsesOnlyUtilityMaterials(idEditorBrush* brush) {
|
||||
if (brush == NULL) {
|
||||
return false;
|
||||
}
|
||||
@@ -1761,12 +1761,12 @@ static bool CamWnd_BrushUsesOnlyUtilityMaterials(brush_t* brush) {
|
||||
return foundMaterial;
|
||||
}
|
||||
|
||||
static bool CamWnd_IsTriggerLikeBrushEntity(brush_t* brush) {
|
||||
static bool CamWnd_IsTriggerLikeBrushEntity(idEditorBrush* brush) {
|
||||
if (brush == NULL || brush->owner == NULL) {
|
||||
return false;
|
||||
}
|
||||
|
||||
const char* className = ValueForKey(brush->owner, "classname");
|
||||
const char* className = brush->owner->ValueForKey("classname");
|
||||
if (className == NULL || className[0] == '\0') {
|
||||
return false;
|
||||
}
|
||||
@@ -1802,7 +1802,7 @@ static bool CamWnd_TargetLinesVisible(const camWndBrushFilterContext_t& filter)
|
||||
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) {
|
||||
return false;
|
||||
}
|
||||
@@ -1852,7 +1852,7 @@ static bool CamWnd_MenuFilterBrush(const camWndBrushFilterContext_t& filter, bru
|
||||
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);
|
||||
return CamWnd_MenuFilterBrush(filter, brush);
|
||||
}
|
||||
@@ -1873,7 +1873,7 @@ struct camFaceExtrudeState_t {
|
||||
bool active;
|
||||
bool moved;
|
||||
CCamWnd* cam;
|
||||
brush_t* sourceBrush;
|
||||
idEditorBrush* sourceBrush;
|
||||
face_t* sourceFace;
|
||||
idWinding* sourceWinding;
|
||||
idVec3 normal;
|
||||
@@ -2141,7 +2141,7 @@ static bool CamWnd_DecalClick(CCamWnd* cam, const CPoint& point, UINT nFlags) {
|
||||
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) {
|
||||
return false;
|
||||
}
|
||||
@@ -2275,7 +2275,7 @@ static void CamWnd_FaceExtrudeEnd(CCamWnd* cam, bool commit) {
|
||||
return;
|
||||
}
|
||||
|
||||
brush_t* sourceBrush = s_faceExtrudeState.sourceBrush;
|
||||
idEditorBrush* sourceBrush = s_faceExtrudeState.sourceBrush;
|
||||
face_t* sourceFace = s_faceExtrudeState.sourceFace;
|
||||
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) {
|
||||
brush_t* newBrush = Brush_CreateFaceExtrusion(sourceBrush, sourceFace, distance);
|
||||
idEditorBrush* newBrush = Brush_CreateFaceExtrusion(sourceBrush, sourceFace, distance);
|
||||
if (newBrush != NULL) {
|
||||
Brush_AddToList(newBrush, &selected_brushes);
|
||||
Entity_LinkBrush(sourceBrush->owner ? sourceBrush->owner : world_entity, newBrush);
|
||||
Brush_Build(newBrush, true, true);
|
||||
Brush_RemoveEmptyFaces(newBrush);
|
||||
newBrush->Brush_AddToList(&selected_brushes);
|
||||
(sourceBrush->owner ? sourceBrush->owner : world_entity)->Entity_LinkBrush(newBrush);
|
||||
newBrush->Brush_Build(true, true);
|
||||
newBrush->Brush_RemoveEmptyFaces();
|
||||
|
||||
if (newBrush->brush_faces == NULL) {
|
||||
Brush_Free(newBrush);
|
||||
@@ -2359,7 +2359,7 @@ static void CamWnd_FaceExtrudeDrawPreview(CCamWnd* cam) {
|
||||
return;
|
||||
}
|
||||
|
||||
brush_t* previewBrush = Brush_CreateFaceExtrusion(
|
||||
idEditorBrush* previewBrush = Brush_CreateFaceExtrusion(
|
||||
s_faceExtrudeState.sourceBrush,
|
||||
s_faceExtrudeState.sourceFace,
|
||||
s_faceExtrudeState.distance);
|
||||
@@ -2367,8 +2367,8 @@ static void CamWnd_FaceExtrudeDrawPreview(CCamWnd* cam) {
|
||||
return;
|
||||
}
|
||||
|
||||
Brush_Build(previewBrush, true, false, false, false);
|
||||
Brush_RemoveEmptyFaces(previewBrush);
|
||||
previewBrush->Brush_Build(true, false, false, false);
|
||||
previewBrush->Brush_RemoveEmptyFaces();
|
||||
if (previewBrush->brush_faces == NULL) {
|
||||
Brush_Free(previewBrush);
|
||||
return;
|
||||
@@ -2450,7 +2450,7 @@ static bool CamWnd_GizmoSelectionBounds(idVec3& mins, idVec3& maxs) {
|
||||
maxs[0] = maxs[1] = maxs[2] = -999999.0f;
|
||||
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) {
|
||||
continue;
|
||||
}
|
||||
@@ -3306,7 +3306,7 @@ void CCamWnd::OnChar(UINT nChar, UINT nRepCnt, UINT 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) {
|
||||
brush_t* b;
|
||||
idEditorBrush* b;
|
||||
float d, bestd, current;
|
||||
idVec3 start, dir;
|
||||
|
||||
@@ -3688,7 +3688,7 @@ void CCamWnd::Cam_ChangeFloor(bool up) {
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
@@ -3938,7 +3938,7 @@ void CCamWnd::InitCull() {
|
||||
=======================================================================================================================
|
||||
=======================================================================================================================
|
||||
*/
|
||||
bool CCamWnd::CullBrush(brush_t* b, bool cubicOnly) {
|
||||
bool CCamWnd::CullBrush(idEditorBrush* b, bool cubicOnly) {
|
||||
int i;
|
||||
idVec3 point;
|
||||
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
|
||||
int nRadius = Brush_LightRadius(pBrush);
|
||||
if (nRadius > 0) {
|
||||
@@ -4062,7 +4062,7 @@ struct camWndWorldFaceBatch_t {
|
||||
std::vector<face_t*> faces;
|
||||
};
|
||||
|
||||
static bool CamWnd_IsFastWorldBrush(brush_t* brush) {
|
||||
static bool CamWnd_IsFastWorldBrush(idEditorBrush* brush) {
|
||||
if (brush == NULL || brush->hiddenBrush) {
|
||||
return false;
|
||||
}
|
||||
@@ -4112,7 +4112,7 @@ static camWndWorldFaceBatch_t* CamWnd_FindWorldFaceBatch(std::vector<camWndWorld
|
||||
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);
|
||||
|
||||
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) {
|
||||
std::vector<camWndWorldFaceBatch_t> batches;
|
||||
std::vector<brush_t*> slowBrushes;
|
||||
std::vector<idEditorBrush*> slowBrushes;
|
||||
batches.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)) {
|
||||
continue;
|
||||
}
|
||||
@@ -4215,7 +4215,7 @@ static void CamWnd_DrawActiveBrushes(CCamWnd* cam, bool renderMode, bool entityM
|
||||
|
||||
for (size_t i = 0; i < slowBrushes.size(); i++) {
|
||||
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);
|
||||
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")) {
|
||||
continue;
|
||||
}
|
||||
@@ -4279,12 +4279,12 @@ static bool CamWnd_FaceHasAllPlanePointsSelected(face_t* face) {
|
||||
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) {
|
||||
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)) {
|
||||
continue;
|
||||
}
|
||||
@@ -4402,7 +4402,7 @@ void CCamWnd::SetProjectionMatrix() {
|
||||
}
|
||||
|
||||
void CCamWnd::Cam_Draw() {
|
||||
brush_t* brush;
|
||||
idEditorBrush* brush;
|
||||
face_t* face;
|
||||
|
||||
// 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]);
|
||||
|
||||
brush_t* pList = (g_bClipMode && g_pSplitList) ? g_pSplitList : &selected_brushes;
|
||||
idEditorBrush* pList = (g_bClipMode && g_pSplitList) ? g_pSplitList : &selected_brushes;
|
||||
|
||||
if (!renderMode) {
|
||||
// draw normally
|
||||
@@ -4467,7 +4467,7 @@ void CCamWnd::Cam_Draw() {
|
||||
continue;
|
||||
}
|
||||
setGLMode(m_Camera.draw_mode);
|
||||
Brush_Draw(brush, true);
|
||||
brush->Brush_Draw(true);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4485,7 +4485,7 @@ void CCamWnd::Cam_Draw() {
|
||||
continue;
|
||||
}
|
||||
if (brush->pPatch || brush->modelHandle > 0) {
|
||||
Brush_Draw(brush, true);
|
||||
brush->Brush_Draw(true);
|
||||
|
||||
// DHM - Nerve:: patch display lists/models mess with the state
|
||||
glEnable(GL_BLEND);
|
||||
@@ -4699,10 +4699,10 @@ void CCamWnd::ShiftTexture_BrushPrimit(face_t* f, int x, int y) {
|
||||
}
|
||||
|
||||
|
||||
bool IsBModel(brush_t* b) {
|
||||
const char* v = ValueForKey(b->owner, "model");
|
||||
bool IsBModel(idEditorBrush* b) {
|
||||
const char* v = b->owner->ValueForKey("model");
|
||||
if (v && *v) {
|
||||
const char* n = ValueForKey(b->owner, "name");
|
||||
const char* n = b->owner->ValueForKey("name");
|
||||
return (stricmp(n, v) == 0);
|
||||
}
|
||||
return false;
|
||||
@@ -4715,7 +4715,7 @@ BuildEntityRenderState
|
||||
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
|
||||
|
||||
struct editorRenderWorldBrushState_t {
|
||||
brush_t* brush;
|
||||
idEditorBrush* brush;
|
||||
idRenderModel* model;
|
||||
int modelDef;
|
||||
unsigned int geometryHash;
|
||||
@@ -4748,14 +4748,14 @@ struct editorRenderWorldBrushState_t {
|
||||
};
|
||||
|
||||
struct editorRenderEntityState_t {
|
||||
entity_t* ent;
|
||||
idEditorEntity* ent;
|
||||
int modelDef;
|
||||
int lightDef;
|
||||
bool touched;
|
||||
};
|
||||
|
||||
struct editorRenderBModelState_t {
|
||||
entity_t* ent;
|
||||
idEditorEntity* ent;
|
||||
idRenderModel* model;
|
||||
idStr modelName;
|
||||
unsigned int geometryHash;
|
||||
@@ -4821,13 +4821,13 @@ static bool EditorVec3Changed(const idVec3& a, const idVec3& b) {
|
||||
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[1] = (brush->mins[1] + brush->maxs[1]) * 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;
|
||||
|
||||
hash = EditorHashInt(hash, brush->pPatch ? 1 : 0);
|
||||
@@ -4876,11 +4876,11 @@ static unsigned int EditorHashBrushGeometry(brush_t* brush, const idVec3& origin
|
||||
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;
|
||||
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)) {
|
||||
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);
|
||||
idMatList mats(1024);
|
||||
|
||||
@@ -4935,11 +4935,11 @@ static idRenderModel* EditorBuildSingleBrushModel(brush_t* brush, const idVec3&
|
||||
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);
|
||||
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)) {
|
||||
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++) {
|
||||
if (s_editorWorldBrushStates[i].brush == brush) {
|
||||
return i;
|
||||
@@ -5034,7 +5034,7 @@ static void EditorFreeWorldBrushState(int index) {
|
||||
s_editorWorldBrushStates.RemoveIndex(index);
|
||||
}
|
||||
|
||||
static bool EditorWorldBrushRenderable(CCamWnd* cam, brush_t* brush) {
|
||||
static bool EditorWorldBrushRenderable(CCamWnd* cam, idEditorBrush* brush) {
|
||||
if (brush->hiddenBrush) {
|
||||
return false;
|
||||
}
|
||||
@@ -5059,7 +5059,7 @@ static bool EditorWorldBrushRenderable(CCamWnd* cam, brush_t* brush) {
|
||||
return true;
|
||||
}
|
||||
|
||||
static void EditorReconcileWorldBrushState(CCamWnd* cam, brush_t* brush) {
|
||||
static void EditorReconcileWorldBrushState(CCamWnd* cam, idEditorBrush* brush) {
|
||||
if (!EditorWorldBrushRenderable(cam, brush)) {
|
||||
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++) {
|
||||
if (s_editorEntityStates[i].ent == ent) {
|
||||
return i;
|
||||
@@ -5141,7 +5141,7 @@ static int EditorFindEntityState(entity_t* ent) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
static editorRenderEntityState_t* EditorTouchEntityState(entity_t* ent) {
|
||||
static editorRenderEntityState_t* EditorTouchEntityState(idEditorEntity* ent) {
|
||||
int index = EditorFindEntityState(ent);
|
||||
|
||||
if (index < 0) {
|
||||
@@ -5170,26 +5170,26 @@ static editorRenderEntityState_t* EditorTouchEntityState(entity_t* ent) {
|
||||
return &state;
|
||||
}
|
||||
|
||||
static void EditorFreeEntityModelDef(editorRenderEntityState_t* state, entity_t* ent) {
|
||||
static void EditorFreeEntityModelDef(editorRenderEntityState_t* state, idEditorEntity* ent) {
|
||||
EditorFreeRenderEntityDef(state->modelDef);
|
||||
if (ent) {
|
||||
ent->modelDef = state->modelDef;
|
||||
}
|
||||
}
|
||||
|
||||
static void EditorFreeEntityLightDef(editorRenderEntityState_t* state, entity_t* ent) {
|
||||
static void EditorFreeEntityLightDef(editorRenderEntityState_t* state, idEditorEntity* ent) {
|
||||
EditorFreeRenderLightDef(state->lightDef);
|
||||
if (ent) {
|
||||
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);
|
||||
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) {
|
||||
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++) {
|
||||
if (s_editorBModelStates[i].ent == ent) {
|
||||
return i;
|
||||
@@ -5229,7 +5229,7 @@ static int EditorFindBModelState(entity_t* ent) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
static editorRenderBModelState_t* EditorTouchBModelState(entity_t* ent) {
|
||||
static editorRenderBModelState_t* EditorTouchBModelState(idEditorEntity* ent) {
|
||||
int index = EditorFindBModelState(ent);
|
||||
|
||||
if (index < 0) {
|
||||
@@ -5259,7 +5259,7 @@ static void EditorFreeBModelState(int index) {
|
||||
s_editorBModelStates.RemoveIndex(index);
|
||||
}
|
||||
|
||||
static void EditorFreeBModelStateForEntity(entity_t* ent) {
|
||||
static void EditorFreeBModelStateForEntity(idEditorEntity* ent) {
|
||||
const int index = EditorFindBModelState(ent);
|
||||
if (index >= 0) {
|
||||
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;
|
||||
idDict spawnArgs;
|
||||
const char* name = NULL;
|
||||
@@ -5287,7 +5287,7 @@ void CCamWnd::BuildEntityRenderState(entity_t* ent, bool update) {
|
||||
// UpdateLightDef when possible.
|
||||
(void)update;
|
||||
|
||||
Entity_UpdateSoundEmitter(ent);
|
||||
ent->Entity_UpdateSoundEmitter();
|
||||
|
||||
// If the entity is no longer renderable, remove only this entity's defs.
|
||||
if (ent->brushes.onext == &ent->brushes ||
|
||||
@@ -5307,7 +5307,7 @@ void CCamWnd::BuildEntityRenderState(entity_t* ent, bool update) {
|
||||
}
|
||||
|
||||
// any entity can have a model
|
||||
name = ValueForKey(ent, "name");
|
||||
name = ent->ValueForKey("name");
|
||||
v = spawnArgs.GetString("model");
|
||||
if (v && *v) {
|
||||
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;
|
||||
if (brush->modelHandle > 0) {
|
||||
idRenderModel* model = brush->modelHandle;
|
||||
if (model) {
|
||||
float a = FloatForKey(brush->owner, "angle");
|
||||
float a = brush->owner->FloatForKey("angle");
|
||||
float s, c;
|
||||
//FIXME: support full rotation matrix
|
||||
bool matrix = false;
|
||||
@@ -5490,7 +5490,7 @@ int Brush_TransformModel(brush_t* brush, idTriList* tris, idMatList* mats) {
|
||||
c = cos(DEG2RAD(a));
|
||||
}
|
||||
idMat3 mat;
|
||||
if (GetMatrixForKey(brush->owner, "rotation", mat)) {
|
||||
if (brush->owner->GetMatrixForKey("rotation", mat)) {
|
||||
matrix = true;
|
||||
}
|
||||
|
||||
@@ -5531,7 +5531,7 @@ int Brush_TransformModel(brush_t* brush, idTriList* tris, idMatList* mats) {
|
||||
|
||||
|
||||
#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;
|
||||
srfTriangles_t* tri;
|
||||
//
|
||||
@@ -5670,7 +5670,7 @@ void Select_ToOBJ() {
|
||||
idTriList tris(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) {
|
||||
continue;
|
||||
@@ -5706,7 +5706,7 @@ void Select_ToCM() {
|
||||
mapEnt = new idMapEntity();
|
||||
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) {
|
||||
continue;
|
||||
@@ -5738,8 +5738,8 @@ so it can be rendered by the game renderSystem
|
||||
=================
|
||||
*/
|
||||
void CCamWnd::BuildRendererState() {
|
||||
entity_t* ent;
|
||||
brush_t* brush;
|
||||
idEditorEntity* ent;
|
||||
idEditorBrush* brush;
|
||||
|
||||
if (!s_editorRenderWorldInitialized) {
|
||||
// First build, or after FreeRendererState(). Do not do this on every
|
||||
@@ -5762,7 +5762,7 @@ void CCamWnd::BuildRendererState() {
|
||||
|
||||
EditorBeginWorldBrushReconcile();
|
||||
|
||||
for (brush_t* brushList = &active_brushes; brushList;
|
||||
for (idEditorBrush* brushList = &active_brushes; brushList;
|
||||
brushList = (brushList == &active_brushes) ? &selected_brushes : NULL) {
|
||||
|
||||
for (brush = brushList->next; brush != brushList; brush = brush->next) {
|
||||
@@ -5808,7 +5808,7 @@ bool CCamWnd::UpdateRenderEntities() {
|
||||
bool ret = false;
|
||||
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);
|
||||
if (!ret && (ent->modelDef >= 0 || ent->lightDef >= 0)) {
|
||||
ret = true;
|
||||
@@ -5838,7 +5838,7 @@ void CCamWnd::FreeRendererState() {
|
||||
|
||||
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->lightDef = -1;
|
||||
}
|
||||
@@ -5962,8 +5962,8 @@ void CCamWnd::ToggleSoundMode() {
|
||||
|
||||
UpdateCaption();
|
||||
|
||||
for (entity_t* ent = entities.next; ent != &entities; ent = ent->next) {
|
||||
Entity_UpdateSoundEmitter(ent);
|
||||
for (idEditorEntity* ent = entities.next; ent != &entities; ent = ent->next) {
|
||||
ent->Entity_UpdateSoundEmitter();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6030,10 +6030,10 @@ void CCamWnd::DrawEntityData() {
|
||||
glColor3fv(color.ToFloatPtr());
|
||||
|
||||
const camWndBrushFilterContext_t brushFilter = CamWnd_MakeBrushFilterContext(this);
|
||||
brush_t* brushList = &active_brushes;
|
||||
idEditorBrush* brushList = &active_brushes;
|
||||
int pass = 0;
|
||||
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)) {
|
||||
continue;
|
||||
@@ -6048,7 +6048,7 @@ void CCamWnd::DrawEntityData() {
|
||||
}
|
||||
|
||||
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() {
|
||||
if (QE_SingleBrush(true, true)) {
|
||||
brush_t* b = selected_brushes.next;
|
||||
idEditorBrush* b = selected_brushes.next;
|
||||
if (b->owner->eclass->nShowFlags & ECLASS_CAMERAVIEW) {
|
||||
// find the entity that targets this
|
||||
const char* name = ValueForKey(b->owner, "name");
|
||||
entity_t* ent = FindEntity("target", name);
|
||||
const char* name = b->owner->ValueForKey("name");
|
||||
idEditorEntity* ent = idEditorEntity::FindEntity("target", name);
|
||||
if (ent) {
|
||||
if (!saveValid) {
|
||||
saveOrg = m_Camera.origin;
|
||||
|
||||
Reference in New Issue
Block a user