From 005c03c4a688703afe6ca6b42fc820c5fdfc1098 Mon Sep 17 00:00:00 2001 From: Timothee 'TTimo' Besset Date: Fri, 11 Nov 2022 15:17:10 -0600 Subject: [PATCH] prune dead code --- radiant/brush.cpp | 80 --------------------------------------- radiant/select.cpp | 48 ----------------------- radiant/surfaceplugin.cpp | 4 +- 3 files changed, 2 insertions(+), 130 deletions(-) diff --git a/radiant/brush.cpp b/radiant/brush.cpp index f98e9905..4578b505 100644 --- a/radiant/brush.cpp +++ b/radiant/brush.cpp @@ -2365,74 +2365,6 @@ void Brush_RemoveFromList( brush_t *b ){ b->next = b->prev = NULL; } -/* - =============== - SetFaceTexdef - - Doesn't set the curve flags - - NOTE : ( TTimo ) - never trust f->d_texture here, f->texdef and f->d_texture are out of sync when called by Brush_SetTexture - use Texture_ForName() to find the right shader - FIXME : send the right shader ( qtexture_t * ) in the parameters ? - - TTimo: surface plugin, added an IPluginTexdef* parameter - if not NULL, get ->Copy() of it into the face ( and remember to hook ) - if NULL, ask for a default - - TTimo - shader code cleanup - added IShader* parameter - =============== - */ -void SetFaceTexdef2( brush_t *b, face_t *f, IShader *pShader, texdef_t *texdef, brushprimit_texdef_t *brushprimit_texdef, bool bFitScale, IPluginTexdef* pPlugTexdef ) { - int oldFlags; - int oldContents; - face_t *tf; - - oldFlags = f->texdef.flags; - oldContents = f->texdef.contents; - if ( g_qeglobals.m_bBrushPrimitMode ) { - f->texdef = *texdef; - ConvertTexMatWithQTexture( brushprimit_texdef, NULL, &f->brushprimit_texdef, QERApp_Shader_ForName( f->texdef.GetName() )->getTexture() ); - } - else - if ( bFitScale ) { - f->texdef = *texdef; - // fit the scaling of the texture on the actual plane - vec3_t p1,p2,p3; // absolute coordinates - // compute absolute coordinates - ComputeAbsolute( f,p1,p2,p3 ); - // compute the scale - vec3_t vx,vy; - VectorSubtract( p2,p1,vx ); - VectorNormalize( vx, vx ); - VectorSubtract( p3,p1,vy ); - VectorNormalize( vy, vy ); - // assign scale - VectorScale( vx,texdef->scale[0],vx ); - VectorScale( vy,texdef->scale[1],vy ); - VectorAdd( p1,vx,p2 ); - VectorAdd( p1,vy,p3 ); - // compute back shift scale rot - AbsoluteToLocal( f->plane,f,p1,p2,p3 ); - } - else{ - f->texdef = *texdef; - } - f->texdef.flags = ( f->texdef.flags & ~SURF_KEEP ) | ( oldFlags & SURF_KEEP ); - f->texdef.contents = ( f->texdef.contents & ~CONTENTS_KEEP ) | ( oldContents & CONTENTS_KEEP ); - - // if this is a curve face, set all other curve faces to the same texdef - if ( f->texdef.flags & SURF_CURVE ) { - for ( tf = b->brush_faces ; tf ; tf = tf->next ) - { - if ( tf->texdef.flags & SURF_CURVE ) { - tf->texdef = f->texdef; - } - } - } -} - /* =============== SetFaceTexdef @@ -2495,18 +2427,6 @@ void SetFaceTexdef( face_t *f, texdef_t *texdef, brushprimit_texdef_t *brushprim f->texdef.contents = ( f->texdef.contents & ~CONTENTS_KEEP ) | ( oldContents & CONTENTS_KEEP ); } -#ifdef _DEBUG -void Brush_SetTexture2( brush_t *b, IShader *pShader, texdef_t *texdef, brushprimit_texdef_t *brushprimit_texdef, bool bFitScale, IPluginTexdef* pTexdef ){ - for ( face_t* f = b->brush_faces ; f ; f = f->next ) - SetFaceTexdef2( b, f, pShader, texdef, brushprimit_texdef, bFitScale, pTexdef ); - Brush_Build( b ); - if ( b->patchBrush ) { - Patch_SetTexture( b->pPatch, texdef, pTexdef ); - b->bFiltered = FilterBrush( b ); - } -} -#endif - void Brush_SetTexture( brush_t *b, texdef_t *texdef, brushprimit_texdef_t *brushprimit_texdef, bool bFitScale, IPluginTexdef* pTexdef ){ for ( face_t* f = b->brush_faces ; f ; f = f->next ) SetFaceTexdef( f, texdef, brushprimit_texdef, bFitScale, pTexdef ); diff --git a/radiant/select.cpp b/radiant/select.cpp index b0584136..32ea7818 100644 --- a/radiant/select.cpp +++ b/radiant/select.cpp @@ -555,54 +555,6 @@ void Select_Clone( void ){ Sys_UpdateWindows( W_ALL ); } -//++timo clean -#if 0 -/* - ============ - Select_SetTexture - Timo : bFitScale to compute scale on the plane and counteract plane / axial plane snapping - Timo : brush primitive texturing - the brushprimit_texdef given must be understood as a qtexture_t width=2 height=2 ( HiRes ) - Timo : texture plugin, added an IPluginTexdef* parameter - must be casted to an IPluginTexdef! - if not NULL, get ->Copy() of it into each face or brush ( and remember to hook ) - if NULL, means we have no information, ask for a default - TTimo - shader code cleanup - added IShader* parameter - ============ - */ -void WINAPI Select_SetTexture2( IShader* pShader, texdef_t *texdef, brushprimit_texdef_t *brushprimit_texdef, bool bFitScale, void* pPlugTexdef ){ - brush_t *b; - int nCount = g_ptrSelectedFaces.GetSize(); - if ( nCount > 0 ) { - Undo_Start( "set face textures" ); - ASSERT( g_ptrSelectedFaces.GetSize() == g_ptrSelectedFaceBrushes.GetSize() ); - for ( int i = 0; i < nCount; i++ ) - { - face_t *selFace = reinterpret_cast( g_ptrSelectedFaces.GetAt( i ) ); - brush_t *selBrush = reinterpret_cast( g_ptrSelectedFaceBrushes.GetAt( i ) ); - Undo_AddBrush( selBrush ); - //++timo TODO: propagate the IShader* .. - SetFaceTexdef( selFace, texdef, brushprimit_texdef, bFitScale, static_cast( pPlugTexdef ) ); - Brush_Build( selBrush, bFitScale ); - Undo_EndBrush( selBrush ); - } - Undo_End(); - } - else if ( selected_brushes.next != &selected_brushes ) { - Undo_Start( "set brush textures" ); - for ( b = selected_brushes.next ; b != &selected_brushes ; b = b->next ) - if ( !b->owner->eclass->fixedsize ) { - Undo_AddBrush( b ); - Brush_SetTexture2( b, pShader, texdef, brushprimit_texdef, bFitScale, static_cast( pPlugTexdef ) ); - Undo_EndBrush( b ); - } - Undo_End(); - } - Sys_UpdateWindows( W_ALL ); -} -#endif - /* ============ Select_SetTexture diff --git a/radiant/surfaceplugin.cpp b/radiant/surfaceplugin.cpp index 8b215235..fa973884 100644 --- a/radiant/surfaceplugin.cpp +++ b/radiant/surfaceplugin.cpp @@ -187,8 +187,8 @@ void SI_SetTexdef_FaceList( texdef_to_face_t* texdef_face_list, bool b_SetUndoPo else if ( ( selected_brushes.next != &selected_brushes ) || ( g_ptrSelectedFaces.GetSize() == 1 ) ) { // Give something to undo to for ( texdef_to_face = texdef_face_list; texdef_to_face; texdef_to_face = texdef_to_face->next ) { - SetFaceTexdef( texdef_to_face->face, &texdef_to_face->orig_texdef, &texdef_to_face->orig_bp_texdef, bFit_to_Scale ); - } + SetFaceTexdef( texdef_to_face->face, &texdef_to_face->orig_texdef, &texdef_to_face->orig_bp_texdef, bFit_to_Scale ); + } Undo_Start( "set facelist texdefs" );