@@ -150,17 +150,11 @@ RenderObjClass * W3DPrototypeClass::Create(void)
150
150
// ---------------------------------------------------------------------
151
151
W3DAssetManager::W3DAssetManager (void )
152
152
{
153
- #ifdef INCLUDE_GRANNY_IN_BUILD
154
- m_GrannyAnimManager = NEW GrannyAnimManagerClass;
155
- #endif
156
153
}
157
154
158
155
// ---------------------------------------------------------------------
159
156
W3DAssetManager::~W3DAssetManager (void )
160
157
{
161
- #ifdef INCLUDE_GRANNY_IN_BUILD
162
- delete m_GrannyAnimManager;
163
- #endif
164
158
}
165
159
166
160
#ifdef DUMP_PERF_STATS
@@ -700,12 +694,6 @@ RenderObjClass * W3DAssetManager::Create_Render_Obj(
700
694
GetPrecisionTimer (&startTime64);
701
695
#endif
702
696
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
709
697
Bool reallyscale = (WWMath::Fabs (scale - ident_scale) > scale_epsilon);
710
698
Bool reallycolor = (color & 0xFFFFFF ) != 0 ; // black is not a valid color and assumes no custom coloring.
711
699
Bool reallytexture = (oldTexture != NULL && newTexture != NULL );
@@ -727,24 +715,13 @@ RenderObjClass * W3DAssetManager::Create_Render_Obj(
727
715
// see if we got a cached version
728
716
RenderObjClass *rendobj = NULL ;
729
717
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
736
718
Set_WW3D_Load_On_Demand (false ); // munged name will never be found in a file.
737
719
rendobj = WW3DAssetManager::Create_Render_Obj (newname);
738
720
if (rendobj)
739
721
{ // store the color that we used to create asset so we can read it back out
740
722
// when we need to save this render object to a file. Used during saving
741
723
// of fog of war ghost objects.
742
724
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
748
725
Set_WW3D_Load_On_Demand (true ); // Auto Load.
749
726
750
727
#ifdef DUMP_PERF_STATS
@@ -767,16 +744,11 @@ RenderObjClass * W3DAssetManager::Create_Render_Obj(
767
744
{
768
745
// If we didn't find one, try to load on demand
769
746
char filename [MAX_PATH];
770
- const char *mesh_name = :: strchr (name, ' .' );
747
+ const char *mesh_name = strchr (name, ' .' );
771
748
if (mesh_name != NULL )
772
749
{
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" );
780
752
} else {
781
753
sprintf ( filename, " %s.w3d" , name);
782
754
}
@@ -785,15 +757,7 @@ RenderObjClass * W3DAssetManager::Create_Render_Obj(
785
757
if ( Load_3D_Assets ( filename ) == false )
786
758
{
787
759
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 );
797
761
}
798
762
799
763
proto = Find_Prototype (name); // try again
@@ -823,33 +787,21 @@ RenderObjClass * W3DAssetManager::Create_Render_Obj(
823
787
#endif
824
788
return NULL ;
825
789
}
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);
841
790
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)
847
793
{
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);
851
799
}
852
- #endif
800
+ if (reallyscale)
801
+ rendobj->Scale (scale);
802
+
803
+ if (reallycolor)
804
+ Recolor_Asset (rendobj,color);
853
805
854
806
W3DPrototypeClass *w3dproto = newInstance (W3DPrototypeClass)(rendobj, newname);
855
807
rendobj->Release_Ref ();
@@ -986,14 +938,6 @@ bool W3DAssetManager::Load_3D_Assets( const char * filename )
986
938
GetPrecisionTimer (&startTime64);
987
939
#endif
988
940
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
-
997
941
// Try to find an existing prototype
998
942
char basename[512 ];
999
943
strcpy (basename, filename);
@@ -1038,40 +982,6 @@ bool W3DAssetManager::Load_3D_Assets( const char * filename )
1038
982
#endif
1039
983
return result;
1040
984
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
1075
985
}
1076
986
1077
987
#ifdef DUMP_PERF_STATS
@@ -1089,47 +999,17 @@ HAnimClass * W3DAssetManager::Get_HAnim(const char * name)
1089
999
#endif
1090
1000
WWPROFILE ( " WW3DAssetManager::Get_HAnim" );
1091
1001
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);
1101
1003
#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;
1130
1008
}
1131
- return anim ;
1009
+ HAnim_Recursions-- ;
1132
1010
#endif
1011
+ return anim;
1012
+
1133
1013
}
1134
1014
1135
1015
// ---------------------------------------------------------------------
@@ -1420,11 +1300,6 @@ static inline void Munge_Texture_Name(char *newname, const char *oldname, const
1420
1300
RenderObjClass * W3DAssetManager::Create_Render_Obj(const char * name,float scale, const Vector3 &hsv_shift)
1421
1301
{
1422
1302
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
1428
1303
Bool reallyscale = (WWMath::Fabs(scale - ident_scale) > scale_epsilon);
1429
1304
Bool reallyhsv_shift = (WWMath::Fabs(hsv_shift.X - ident_HSV.X) > H_epsilon ||
1430
1305
WWMath::Fabs(hsv_shift.Y - ident_HSV.Y) > S_epsilon || WWMath::Fabs(hsv_shift.Z - ident_HSV.Z) > V_epsilon);
0 commit comments