Skip to content

Commit 3d4b5c7

Browse files
authored
[GEN][ZH] Remove unused granny related code (#708)
1 parent bcfe2e4 commit 3d4b5c7

File tree

10 files changed

+50
-426
lines changed

10 files changed

+50
-426
lines changed

Generals/Code/GameEngineDevice/Include/W3DDevice/GameClient/W3DAssetManager.h

-3
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,6 @@
5454

5555
class Vector3;
5656
class VertexMaterialClass;
57-
class GrannyAnimManagerClass;
5857

5958
class W3DAssetManager: public WW3DAssetManager
6059
{
@@ -103,8 +102,6 @@ class W3DAssetManager: public WW3DAssetManager
103102
int replaceHLODTexture(RenderObjClass *robj, TextureClass *oldTex, TextureClass *newTex);
104103
int replaceMeshTexture(RenderObjClass *robj, TextureClass *oldTex, TextureClass *newTex);
105104

106-
GrannyAnimManagerClass *m_GrannyAnimManager;
107-
108105
//'E&B' customizations
109106
/* virtual RenderObjClass * Create_Render_Obj(const char * name, float scale, const Vector3 &hsv_shift);
110107
TextureClass * Get_Texture_With_HSV_Shift(const char * filename, const Vector3 &hsv_shift, MipCountType mip_level_count = MIP_LEVELS_ALL);

Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/Shadow/W3DVolumetricShadow.cpp

+1-38
Original file line numberDiff line numberDiff line change
@@ -748,43 +748,6 @@ Int W3DShadowGeometry::initFromMesh(RenderObjClass *robj)
748748
Int W3DShadowGeometry::init(RenderObjClass *robj)
749749
{
750750
return TRUE;
751-
// m_robj=robj;
752-
/* //code to deal with granny - don't think we'll use shadow volumes on these!?
753-
granny_file *fileInfo=robj->getPrototype().m_file;
754-
755-
for (Int modelIndex=0; modelIndex<fileInfo->ModelCount; modelIndex++)
756-
{
757-
granny_model *sourceModel = fileInfo->Models[modelIndex];
758-
if (stricmp(sourceModel->Name,"AABOX") == 0)
759-
{ //found a collision box, copy out data
760-
int MeshCount = sourceModel->MeshBindingCount;
761-
if (MeshCount==1)
762-
{
763-
granny_mesh *sourceMesh = sourceModel->MeshBindings[0].Mesh;
764-
granny_pn33_vertex *Vertices = (granny_pn33_vertex *)sourceMesh->PrimaryVertexData->Vertices;
765-
Vector3 points[24];
766-
767-
assert (sourceMesh->PrimaryVertexData->VertexCount <= 24);
768-
769-
for (Int boxVertex=0; boxVertex<sourceMesh->PrimaryVertexData->VertexCount; boxVertex++)
770-
{ points[boxVertex].Set(Vertices[boxVertex].Position[0],
771-
Vertices[boxVertex].Position[1],
772-
Vertices[boxVertex].Position[2]);
773-
}
774-
box.Init(points,sourceMesh->PrimaryVertexData->VertexCount);
775-
}
776-
}
777-
else
778-
{ //mesh is part of model
779-
int meshCount = sourceModel->MeshBindingCount;
780-
for (Int meshIndex=0; meshIndex<meshCount; meshIndex++)
781-
{
782-
granny_mesh *sourceMesh = sourceModel->MeshBindings[meshIndex].Mesh;
783-
if (sourceMesh->PrimaryVertexData)
784-
vertexCount+=sourceMesh->PrimaryVertexData->VertexCount;
785-
}
786-
}
787-
}*/
788751
}
789752

790753
///////////////////////////////////////////////////////////////////////////////
@@ -3944,7 +3907,7 @@ int W3DShadowGeometryManager::Load_Geom(RenderObjClass *robj, const char *name)
39443907
}
39453908

39463909
/*
3947-
** Iterator converter from HashableClass to GrannyAnimClass
3910+
** Iterator converter from HashableClass to W3DShadowGeometry
39483911
*/
39493912
W3DShadowGeometry * W3DShadowGeometryManagerIterator::Get_Current_Geom( void )
39503913
{

Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DAssetManager.cpp

+24-149
Original file line numberDiff line numberDiff line change
@@ -150,17 +150,11 @@ RenderObjClass * W3DPrototypeClass::Create(void)
150150
//---------------------------------------------------------------------
151151
W3DAssetManager::W3DAssetManager(void)
152152
{
153-
#ifdef INCLUDE_GRANNY_IN_BUILD
154-
m_GrannyAnimManager = NEW GrannyAnimManagerClass;
155-
#endif
156153
}
157154

158155
//---------------------------------------------------------------------
159156
W3DAssetManager::~W3DAssetManager(void)
160157
{
161-
#ifdef INCLUDE_GRANNY_IN_BUILD
162-
delete m_GrannyAnimManager;
163-
#endif
164158
}
165159

166160
#ifdef DUMP_PERF_STATS
@@ -700,12 +694,6 @@ RenderObjClass * W3DAssetManager::Create_Render_Obj(
700694
GetPrecisionTimer(&startTime64);
701695
#endif
702696

703-
#ifdef INCLUDE_GRANNY_IN_BUILD
704-
Bool isGranny = false;
705-
char *pext=strrchr(name,'.'); //find file extension
706-
if (pext)
707-
isGranny=(strnicmp(pext,".GR2",4) == 0);
708-
#endif
709697
Bool reallyscale = (WWMath::Fabs(scale - ident_scale) > scale_epsilon);
710698
Bool reallycolor = (color & 0xFFFFFF) != 0; //black is not a valid color and assumes no custom coloring.
711699
Bool reallytexture = (oldTexture != NULL && newTexture != NULL);
@@ -727,24 +715,13 @@ RenderObjClass * W3DAssetManager::Create_Render_Obj(
727715
// see if we got a cached version
728716
RenderObjClass *rendobj = NULL;
729717

730-
#ifdef INCLUDE_GRANNY_IN_BUILD
731-
if (isGranny)
732-
{ //Granny objects share the same prototype since they allow instance scaling.
733-
strcpy(newname,name); //use same name for all granny objects at any scale.
734-
}
735-
#endif
736718
Set_WW3D_Load_On_Demand(false); // munged name will never be found in a file.
737719
rendobj = WW3DAssetManager::Create_Render_Obj(newname);
738720
if (rendobj)
739721
{ //store the color that we used to create asset so we can read it back out
740722
//when we need to save this render object to a file. Used during saving
741723
//of fog of war ghost objects.
742724
rendobj->Set_ObjectColor(color);
743-
#ifdef INCLUDE_GRANNY_IN_BUILD
744-
if (isGranny)
745-
///@todo Granny objects are realtime scaled - fix to scale like W3D.
746-
rendobj->Set_ObjectScale(scale);
747-
#endif
748725
Set_WW3D_Load_On_Demand(true); // Auto Load.
749726

750727
#ifdef DUMP_PERF_STATS
@@ -767,16 +744,11 @@ RenderObjClass * W3DAssetManager::Create_Render_Obj(
767744
{
768745
// If we didn't find one, try to load on demand
769746
char filename [MAX_PATH];
770-
const char *mesh_name = ::strchr (name, '.');
747+
const char *mesh_name = strchr (name, '.');
771748
if (mesh_name != NULL)
772749
{
773-
::lstrcpyn(filename, name, ((int)mesh_name) - ((int)name) + 1);
774-
#ifdef INCLUDE_GRANNY_IN_BUILD
775-
if (isGranny)
776-
::lstrcat(filename, ".gr2");
777-
else
778-
#endif
779-
::lstrcat(filename, ".w3d");
750+
lstrcpyn(filename, name, ((int)mesh_name) - ((int)name) + 1);
751+
lstrcat(filename, ".w3d");
780752
} else {
781753
sprintf( filename, "%s.w3d", name);
782754
}
@@ -785,15 +757,7 @@ RenderObjClass * W3DAssetManager::Create_Render_Obj(
785757
if ( Load_3D_Assets( filename ) == false )
786758
{
787759
StringClass new_filename = StringClass("..\\") + filename;
788-
if (Load_3D_Assets( new_filename ) == false)
789-
{
790-
#ifdef INCLUDE_GRANNY_IN_BUILD
791-
char *mesh_name = ::strchr (filename, '.');
792-
::lstrcpyn (mesh_name, ".gr2",5);
793-
Load_3D_Assets( filename );
794-
isGranny=true;
795-
#endif
796-
}
760+
Load_3D_Assets( new_filename );
797761
}
798762

799763
proto = Find_Prototype(name); // try again
@@ -823,33 +787,21 @@ RenderObjClass * W3DAssetManager::Create_Render_Obj(
823787
#endif
824788
return NULL;
825789
}
826-
#ifdef INCLUDE_GRANNY_IN_BUILD
827-
if (!isGranny)
828-
#endif
829-
{
830-
Make_Unique(rendobj,reallyscale,reallycolor);
831-
if (reallytexture)
832-
{
833-
TextureClass *oldTex = Get_Texture(oldTexture);
834-
TextureClass *newTex = Get_Texture(newTexture);
835-
replaceAssetTexture(rendobj,oldTex,newTex);
836-
REF_PTR_RELEASE(newTex);
837-
REF_PTR_RELEASE(oldTex);
838-
}
839-
if (reallyscale)
840-
rendobj->Scale(scale);
841790

842-
if (reallycolor)
843-
Recolor_Asset(rendobj,color);
844-
}
845-
#ifdef INCLUDE_GRANNY_IN_BUILD
846-
else
791+
Make_Unique(rendobj,reallyscale,reallycolor);
792+
if (reallytexture)
847793
{
848-
///@todo Granny objects are realtime scaled - fix to scale like W3D.
849-
rendobj->Set_ObjectScale(scale);
850-
return rendobj;
794+
TextureClass *oldTex = Get_Texture(oldTexture);
795+
TextureClass *newTex = Get_Texture(newTexture);
796+
replaceAssetTexture(rendobj,oldTex,newTex);
797+
REF_PTR_RELEASE(newTex);
798+
REF_PTR_RELEASE(oldTex);
851799
}
852-
#endif
800+
if (reallyscale)
801+
rendobj->Scale(scale);
802+
803+
if (reallycolor)
804+
Recolor_Asset(rendobj,color);
853805

854806
W3DPrototypeClass *w3dproto = newInstance(W3DPrototypeClass)(rendobj, newname);
855807
rendobj->Release_Ref();
@@ -986,14 +938,6 @@ bool W3DAssetManager::Load_3D_Assets( const char * filename )
986938
GetPrecisionTimer(&startTime64);
987939
#endif
988940

989-
#ifdef INCLUDE_GRANNY_IN_BUILD
990-
Bool isGranny = false;
991-
char *pext=strrchr(filename,'.'); //find file extension
992-
if (pext)
993-
isGranny=(strnicmp(pext,".GR2",4) == 0);
994-
if (!isGranny)
995-
#endif
996-
997941
// Try to find an existing prototype
998942
char basename[512];
999943
strcpy(basename, filename);
@@ -1038,40 +982,6 @@ bool W3DAssetManager::Load_3D_Assets( const char * filename )
1038982
#endif
1039983
return result;
1040984

1041-
#ifdef INCLUDE_GRANNY_IN_BUILD
1042-
//Loading assets for Granny File
1043-
PrototypeClass * newproto = NULL;
1044-
newproto = _GrannyLoader.Load_W3D(filename);
1045-
/*
1046-
** Now, see if the prototype that we loaded has a duplicate
1047-
** name with any of our currently loaded prototypes (can't have that!)
1048-
*/
1049-
if (newproto != NULL) {
1050-
if (!Render_Obj_Exists(newproto->Get_Name())) {
1051-
/*
1052-
** Add the new, unique prototype to our list
1053-
*/
1054-
Add_Prototype(newproto);
1055-
} else {
1056-
/*
1057-
** Warn the user about a name collision with this prototype
1058-
** and dump it
1059-
*/
1060-
WWDEBUG_SAY(("Render Object Name Collision: %s\r\n",newproto->Get_Name()));
1061-
delete newproto;
1062-
newproto = NULL;
1063-
return false;
1064-
}
1065-
} else {
1066-
/*
1067-
** Warn user that a prototype was not generated from this
1068-
** chunk type
1069-
*/
1070-
WWDEBUG_SAY(("Could not generate Granny prototype! File = %d\r\n",filename));
1071-
return false;
1072-
}
1073-
return true;
1074-
#endif
1075985
}
1076986

1077987
#ifdef DUMP_PERF_STATS
@@ -1089,47 +999,17 @@ HAnimClass * W3DAssetManager::Get_HAnim(const char * name)
1089999
#endif
10901000
WWPROFILE( "WW3DAssetManager::Get_HAnim" );
10911001

1092-
#ifdef INCLUDE_GRANNY_IN_BUILD
1093-
Bool isGranny = false;
1094-
char *pext=strrchr(name,'.'); //find file extension
1095-
if (pext)
1096-
isGranny=(strnicmp(pext,".GR2",4) == 0);
1097-
if (!isGranny)
1098-
#endif
1099-
{
1100-
HAnimClass *anim=WW3DAssetManager::Get_HAnim(name); //we only do custom granny processing.
1002+
HAnimClass *anim=WW3DAssetManager::Get_HAnim(name);
11011003
#ifdef DUMP_PERF_STATS
1102-
if (HAnim_Recursions == 1)
1103-
{
1104-
GetPrecisionTimer(&endTime64);
1105-
Total_Get_HAnim_Time += endTime64-startTime64;
1106-
}
1107-
HAnim_Recursions--;
1108-
#endif
1109-
return anim;
1110-
}
1111-
1112-
#ifdef INCLUDE_GRANNY_IN_BUILD
1113-
// Try to find the hanim
1114-
HAnimClass * anim = m_GrannyAnimManager->Get_Anim(name);
1115-
if (WW3D_Load_On_Demand && anim == NULL) { // If we didn't find it, try to load on demand
1116-
if ( !m_GrannyAnimManager->Is_Missing( name ) ) { // if this is NOT a known missing anim
1117-
1118-
// If we can't find it, try the parent directory
1119-
if ( m_GrannyAnimManager->Load_Anim(name) == 1 ) {
1120-
StringClass new_filename = StringClass("..\\") + name;
1121-
m_GrannyAnimManager->Load_Anim( new_filename );
1122-
}
1123-
1124-
anim = m_GrannyAnimManager->Get_Anim(name); // Try again
1125-
if (anim == NULL) {
1126-
// WWDEBUG_SAY(("WARNING: Animation %s not found!\n", name));
1127-
m_GrannyAnimManager->Register_Missing( name ); // This is now a KNOWN missing anim
1128-
}
1129-
}
1004+
if (HAnim_Recursions == 1)
1005+
{
1006+
GetPrecisionTimer(&endTime64);
1007+
Total_Get_HAnim_Time += endTime64-startTime64;
11301008
}
1131-
return anim;
1009+
HAnim_Recursions--;
11321010
#endif
1011+
return anim;
1012+
11331013
}
11341014

11351015
//---------------------------------------------------------------------
@@ -1420,11 +1300,6 @@ static inline void Munge_Texture_Name(char *newname, const char *oldname, const
14201300
RenderObjClass * W3DAssetManager::Create_Render_Obj(const char * name,float scale, const Vector3 &hsv_shift)
14211301
{
14221302
Bool isGranny = false;
1423-
#ifdef INCLUDE_GRANNY_IN_BUILD
1424-
char *pext=strrchr(name,'.'); //find file extension
1425-
if (pext)
1426-
isGranny=(strnicmp(pext,".GR2",4) == 0);
1427-
#endif
14281303
Bool reallyscale = (WWMath::Fabs(scale - ident_scale) > scale_epsilon);
14291304
Bool reallyhsv_shift = (WWMath::Fabs(hsv_shift.X - ident_HSV.X) > H_epsilon ||
14301305
WWMath::Fabs(hsv_shift.Y - ident_HSV.Y) > S_epsilon || WWMath::Fabs(hsv_shift.Z - ident_HSV.Z) > V_epsilon);

Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DScene.cpp

-10
Original file line numberDiff line numberDiff line change
@@ -1124,16 +1124,6 @@ void RTS3DScene::Customized_Render( RenderInfoClass &rinfo )
11241124
renderOneObject(rinfo, robj, localPlayerIndex);
11251125
}
11261126
}
1127-
1128-
#ifdef INCLUDE_GRANNY_IN_BUILD
1129-
if (TheGrannyRenderObjSystem)
1130-
{ //we only want to update granny animations once per frame, so only queue
1131-
//them up if this is not a mirror pass.
1132-
if (!ShaderClass::Is_Backface_Culling_Inverted())
1133-
TheGrannyRenderObjSystem->queueUpdate();
1134-
TheGrannyRenderObjSystem->Flush();
1135-
}
1136-
#endif
11371127

11381128
//Tell shadow manager to render shadows at the end of this frame
11391129
//Don't draw shadows if there is no terrain present.

Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DTerrainVisual.cpp

-13
Original file line numberDiff line numberDiff line change
@@ -84,14 +84,6 @@ W3DTerrainVisual::~W3DTerrainVisual()
8484
TheTerrainTracksRenderObjClassSystem=NULL;
8585
}
8686

87-
#ifdef INCLUDE_GRANNY_IN_BUILD
88-
if (TheGrannyRenderObjSystem)
89-
{
90-
delete TheGrannyRenderObjSystem;
91-
TheGrannyRenderObjSystem=NULL;
92-
}
93-
#endif
94-
9587
if (TheW3DShadowManager)
9688
{
9789
delete TheW3DShadowManager;
@@ -121,11 +113,6 @@ void W3DTerrainVisual::init( void )
121113
TheTerrainTracksRenderObjClassSystem = NEW TerrainTracksRenderObjClassSystem;
122114
TheTerrainTracksRenderObjClassSystem->init(W3DDisplay::m_3DScene);
123115

124-
#ifdef INCLUDE_GRANNY_IN_BUILD
125-
// initialize Granny model drawing system
126-
TheGrannyRenderObjSystem = NEW GrannyRenderObjSystem;
127-
#endif
128-
129116
// initialize object shadow drawing system
130117
TheW3DShadowManager = NEW W3DShadowManager;
131118
TheW3DShadowManager->init();

GeneralsMD/Code/GameEngineDevice/Include/W3DDevice/GameClient/W3DAssetManager.h

-3
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,6 @@
5454

5555
class Vector3;
5656
class VertexMaterialClass;
57-
class GrannyAnimManagerClass;
5857

5958
class W3DAssetManager: public WW3DAssetManager
6059
{
@@ -108,8 +107,6 @@ class W3DAssetManager: public WW3DAssetManager
108107
int replaceHLODTexture(RenderObjClass *robj, TextureClass *oldTex, TextureClass *newTex);
109108
int replaceMeshTexture(RenderObjClass *robj, TextureClass *oldTex, TextureClass *newTex);
110109

111-
GrannyAnimManagerClass *m_GrannyAnimManager;
112-
113110
//'E&B' customizations
114111
/* virtual RenderObjClass * Create_Render_Obj(const char * name, float scale, const Vector3 &hsv_shift);
115112
TextureClass * Get_Texture_With_HSV_Shift(const char * filename, const Vector3 &hsv_shift, TextureClass::MipCountType mip_level_count = TextureClass::MIP_LEVELS_ALL);

0 commit comments

Comments
 (0)