Skip to content

Zero Hour rebuilt from EA's source: x64, Direct3D 11, VS2022/CMake, ~60 original bugs fixed, an AI that builds a base. Bring your own game.

build(cmake): drop /Zc:forScope- and compile sources with /MP

Olcay Seygan5b763c8d5414
diff --git a/GeneralsMD/Code/CMakeLists.txt b/GeneralsMD/Code/CMakeLists.txt
index bf3190003..872deadc7 100644
--- a/GeneralsMD/Code/CMakeLists.txt
+++ b/GeneralsMD/Code/CMakeLists.txt
@@ -41,6 +41,11 @@ if(MSVC)
# C1041, or worse, only some of them do and the library is left half-built against an old
# header. /FS serializes the writes in the compilers themselves instead.
add_compile_options(/Oy- /Zi /FS)
+ # /MP: build a project's own sources in parallel too, not just one project at a
+ # time. MSBuild already runs projects concurrently, but gameengine alone is ~580
+ # sources in a single project and was the long pole. /FS above is what makes this
+ # safe - the PDB writes are serialized in the compilers.
+ add_compile_options(/MP)
add_link_options(/DEBUG)
endif()
@@ -219,9 +224,11 @@ target_link_libraries(ww3d2
# The 2001 d3dx8.lib predates SAFESEH and was built against the long-gone
# libci.lib CRT, so anything linking it has to opt out of both.
target_link_options(ww3d2 INTERFACE /SAFESEH:NO /NODEFAULTLIB:libci.lib)
-# ponytail: VC6 for-scope leaks at ~40 sites across ww3d2; scoped flag beats mass
-# edits in render code. Burn the sites down later, then drop the flag.
-target_compile_options(ww3d2 PRIVATE /Zc:forScope-)
+# dx8webbrowser.cpp is the one file /MP cannot have: MSVC rejects #import under
+# multi-process compilation (C2813) and finds the directive by a lexical scan, so
+# even though ENABLE_EMBEDDED_BROWSER's block is what holds it, disabling the block
+# would not help. /MP1 puts just this file back on a single process.
+set_source_files_properties(${WW}/WW3D2/dx8webbrowser.cpp PROPERTIES COMPILE_OPTIONS /MP1)
# Phase 8: 1 kHz EIP sampler that symbolizes against the linker map - the
# machine has no debugger, so this is how hotspots get names.
@@ -507,13 +514,10 @@ target_include_directories(test_wwutil PRIVATE ${WW}/Wwutil ${WW}/WWLib ${WW}/WW
add_lib_test(test_compression compression)
-# ww3d2 needs the same /Zc:forScope- as the library: its headers are included
-# here and dx8fvf.h et al were written for VC6 for-scope rules.
add_lib_test(test_ww3d2 ww3d2 wwsaveload wwlib wwmath wwdebug)
target_include_directories(test_ww3d2 PRIVATE
${WW}/WW3D2 ${WW}/WWLib ${WW}/WWMath ${WW}/WWDebug ${WW}/WWSaveLoad ${WW}/Wwutil
${CMAKE_CURRENT_SOURCE_DIR}/Libraries/DirectX/Include)
-target_compile_options(test_ww3d2 PRIVATE /Zc:forScope-)
add_lib_test(test_wwdownload wwdownload)
target_include_directories(test_wwdownload PRIVATE ${WW}/WWDownload)
diff --git a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/animatedsoundmgr.cpp b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/animatedsoundmgr.cpp
index d5f9bcff8..c42a72df8 100644
--- a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/animatedsoundmgr.cpp
+++ b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/animatedsoundmgr.cpp
@@ -114,7 +114,8 @@ Build_List_From_String
//
// Determine how many entries there will be in the list
//
- for (const char *entry = buffer;
+ const char *entry;
+ for (entry = buffer;
(entry != NULL) && (entry[1] != 0);
entry = ::strstr (entry, delimiter))
{
diff --git a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/assetmgr.cpp b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/assetmgr.cpp
index 7f6023a55..2adcaaf86 100644
--- a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/assetmgr.cpp
+++ b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/assetmgr.cpp
@@ -540,7 +540,8 @@ void WW3DAssetManager::Free_Assets_With_Exclusion_List(const DynamicVectorClass<
exclude_array.Set_Growth_Step(DEFAULT_EXCLUDE_ARRAY_SIZE);
// iterate the array of prototypes saving each one that should be excluded from deletion
- for (int i=0; i<Prototypes.Count(); i++) {
+ int i;
+ for (i =0; i<Prototypes.Count(); i++) {
PrototypeClass * proto = Prototypes[i];
if (proto != NULL) {
diff --git a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/dazzle.cpp b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/dazzle.cpp
index 0c10ccc08..0e5dc7ecc 100644
--- a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/dazzle.cpp
+++ b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/dazzle.cpp
@@ -684,7 +684,8 @@ void DazzleRenderObjClass::Init_Type(const DazzleInitClass& i)
if (i.type>=type_count) {
unsigned new_count=i.type+1;
DazzleTypeClass** new_types=W3DNEWARRAY DazzleTypeClass*[new_count];
- for (unsigned a=0;a<type_count;++a) {
+ unsigned a;
+ for (a =0;a<type_count;++a) {
new_types[a]=types[a];
}
for (;a<new_count;++a) {
@@ -707,7 +708,8 @@ void DazzleRenderObjClass::Init_Lensflare(const LensflareInitClass& i)
if (i.type>=lensflare_count) {
unsigned new_count=i.type+1;
LensflareTypeClass** new_lensflares=W3DNEWARRAY LensflareTypeClass*[new_count];
- for (unsigned a=0;a<lensflare_count;++a) {
+ unsigned a;
+ for (a =0;a<lensflare_count;++a) {
new_lensflares[a]=lensflares[a];
}
for (;a<new_count;++a) {
diff --git a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/ddsfile.cpp b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/ddsfile.cpp
index 602fc0825..c21d555fd 100644
--- a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/ddsfile.cpp
+++ b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/ddsfile.cpp
@@ -144,7 +144,8 @@ DDSFileClass::DDSFileClass(const char* name,unsigned reduction_factor)
LevelSizes=W3DNEWARRAY unsigned[MipLevels];
LevelOffsets=W3DNEWARRAY unsigned[MipLevels];
- for (unsigned level=0;level<ReductionFactor;++level)
+ unsigned level;
+ for (level =0;level<ReductionFactor;++level)
{
if (level_size>16)
{ // If surface is bigger than one block (8 or 16 bytes)...
diff --git a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/distlod.cpp b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/distlod.cpp
index 300db6e14..f91c45096 100644
--- a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/distlod.cpp
+++ b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/distlod.cpp
@@ -108,7 +108,8 @@ RenderObjClass * DistLODPrototypeClass::Create(void)
int count = dist->Get_Num_Sub_Objects();
RenderObjClass ** robj = W3DNEWARRAY RenderObjClass * [count];
- for (int i=0; i<count; i++) {
+ int i;
+ for (i =0; i<count; i++) {
robj[count - 1 - i] = dist->Get_Sub_Object(i);
WWASSERT(robj[count - 1 - i] != NULL);
diff --git a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/dx8renderer.cpp b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/dx8renderer.cpp
index 627e94dbc..85d8e07c4 100644
--- a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/dx8renderer.cpp
+++ b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/dx8renderer.cpp
@@ -261,7 +261,8 @@ void DX8TextureCategoryClass::Remove_Polygon_Renderer(DX8PolygonRendererClass* p
void DX8FVFCategoryContainer::Remove_Texture_Category(DX8TextureCategoryClass* tex_category)
{
- for (unsigned pass=0;pass<passes;++pass) {
+ unsigned pass;
+ for (pass =0;pass<passes;++pass) {
texture_category_list[pass].Remove(tex_category);
}
for (pass=0; pass<passes; pass++) {
@@ -2097,7 +2098,8 @@ void DX8MeshRendererClass::Register_Mesh_Type(MeshModelClass* mmc)
/*
** Search for an existing FVF Category Container that matches this mesh
*/
- for (int i=0;i<texture_category_container_lists_rigid.Count();++i) {
+ int i;
+ for (i =0;i<texture_category_container_lists_rigid.Count();++i) {
FVFCategoryList * list=texture_category_container_lists_rigid[i];
WWASSERT(list);
DX8FVFCategoryContainer * container=list->Peek_Head();
diff --git a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/dx8wrapper.cpp b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/dx8wrapper.cpp
index 7df395012..520e61465 100644
--- a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/dx8wrapper.cpp
+++ b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/dx8wrapper.cpp
@@ -843,7 +843,8 @@ void DX8Wrapper::Enumerate_Devices()
bool DX8Wrapper::Set_Any_Render_Device(void)
{
// Then fullscreen
- for (int dev_number = 0; dev_number < _RenderDeviceNameTable.Count(); dev_number++) {
+ int dev_number;
+ for (dev_number = 0; dev_number < _RenderDeviceNameTable.Count(); dev_number++) {
if (Set_Render_Device(dev_number,-1,-1,-1,0,false)) {
return true;
}
@@ -1527,7 +1528,8 @@ bool DX8Wrapper::Find_Color_And_Z_Mode(int resx,int resy,int bitdepth,D3DFORMAT
bool found = false;
unsigned int mode = 0;
- for (int format_index=0; format_index < format_count; format_index++) {
+ int format_index;
+ for (format_index =0; format_index < format_count; format_index++) {
found |= Find_Color_Mode(format_table[format_index],resx,resy,&mode);
if (found) break;
}
@@ -2313,7 +2315,8 @@ void DX8Wrapper::Apply_Render_State_Changes()
}
unsigned mask=TEXTURE0_CHANGED;
- for (int i=0;i<CurrentCaps->Get_Max_Textures_Per_Pass();++i,mask<<=1)
+ int i;
+ for (i =0;i<CurrentCaps->Get_Max_Textures_Per_Pass();++i,mask<<=1)
{
if (render_state_changed&mask)
{
@@ -3154,7 +3157,8 @@ void DX8Wrapper::Set_Light_Environment(LightEnvironmentClass* light_env)
}
D3DLIGHT8 light;
- for (int l=0;l<light_count;++l) {
+ int l;
+ for (l =0;l<light_count;++l) {
::ZeroMemory(&light, sizeof(D3DLIGHT8));
diff --git a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/dynamesh.cpp b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/dynamesh.cpp
index 45eeaf702..c4151bd2a 100644
--- a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/dynamesh.cpp
+++ b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/dynamesh.cpp
@@ -715,7 +715,8 @@ int DynamicMeshClass::Set_Vertex_Material(VertexMaterialClass *material, bool do
// list. if we are not supposed to search the list for it then just add
// it.
if (!dont_search) {
- for (int lp = 0, found = 0; lp < Peek_Material_Info()->Vertex_Material_Count(); lp ++) {
+ int found = 0;
+ for (int lp = 0; lp < Peek_Material_Info()->Vertex_Material_Count(); lp ++) {
VertexMaterialClass *mat = Peek_Material_Info()->Get_Vertex_Material(lp);
if (material == mat) {
VertexMaterialIdx[pass] = lp;
@@ -776,7 +777,8 @@ int DynamicMeshClass::Set_Texture(TextureClass *texture, bool dont_search, int p
// list. if we are not supposed to search the list for it then just add
// it.
if (!dont_search) {
- for (int lp = 0, found = 0; lp < Peek_Material_Info()->Texture_Count(); lp ++) {
+ int found = 0;
+ for (int lp = 0; lp < Peek_Material_Info()->Texture_Count(); lp ++) {
TextureClass *tex = Peek_Material_Info()->Get_Texture(lp);
if (texture == tex) {
TextureIdx[pass] = lp;
diff --git a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/formconv.cpp b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/formconv.cpp
index fd15d09ab..707e63f9a 100644
--- a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/formconv.cpp
+++ b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/formconv.cpp
@@ -209,7 +209,8 @@ WW3DZFormat D3DFormat_To_WW3DZFormat(D3DFORMAT d3d_format)
void Init_D3D_To_WW3_Conversion()
{
// <=: the arrays are sized HIGHEST+1, so the last slot needs seeding too.
- for (int i=0;i<=HIGHEST_SUPPORTED_D3DFORMAT;++i) {
+ int i;
+ for (i =0;i<=HIGHEST_SUPPORTED_D3DFORMAT;++i) {
D3DFormatToWW3DFormatConversionArray[i]=WW3D_FORMAT_UNKNOWN;
}
diff --git a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/hmorphanim.cpp b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/hmorphanim.cpp
index 291ecc6a5..ffce69d4e 100644
--- a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/hmorphanim.cpp
+++ b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/hmorphanim.cpp
@@ -252,7 +252,8 @@ static int Build_List_From_String
//
// Determine how many entries there will be in the list
//
- for (const char *entry = buffer;
+ const char *entry;
+ for (entry = buffer;
(entry != NULL) && (entry[1] != 0);
entry = ::strstr (entry, delimiter))
{
diff --git a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/htree.cpp b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/htree.cpp
index 689c6f164..27be29c42 100644
--- a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/htree.cpp
+++ b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/htree.cpp
@@ -808,7 +808,8 @@ void HTreeClass::Combo_Update
float weight_total = 0;
int wcount = 0;
- for ( int anim_num = 0; anim_num < anim->Get_Num_Anims(); anim_num++ ) {
+ int anim_num;
+ for ( anim_num = 0; anim_num < anim->Get_Num_Anims(); anim_num++ ) {
HAnimClass *motion = anim->Get_Motion( anim_num );
diff --git a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/htreemgr.cpp b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/htreemgr.cpp
index bea4284d0..650c14346 100644
--- a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/htreemgr.cpp
+++ b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/htreemgr.cpp
@@ -149,7 +149,8 @@ void HTreeManagerClass::Free_All_Trees_With_Exclusion_List(const W3DExclusionLis
// or copying it to the new tail index if it is excluded.
int new_tail = 0;
- for (int treeidx=0; treeidx < MAX_TREES; treeidx++) {
+ int treeidx;
+ for (treeidx =0; treeidx < MAX_TREES; treeidx++) {
if (TreePtr[treeidx] != NULL) {
if (exclusion_list.Is_Excluded(TreePtr[treeidx])) {
diff --git a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/meshbuild.cpp b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/meshbuild.cpp
index 75d301db0..3b0954062 100644
--- a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/meshbuild.cpp
+++ b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/meshbuild.cpp
@@ -296,7 +296,8 @@ public:
}
// colors, and material id's must match for all passes
- for (int pass=0; pass < MeshBuilderClass::MAX_PASSES; pass++) {
+ int pass;
+ for (pass =0; pass < MeshBuilderClass::MAX_PASSES; pass++) {
if (v0.DiffuseColor[pass] != v1.DiffuseColor[pass]) return 0;
if (v0.SpecularColor[pass] != v1.SpecularColor[pass]) return 0;
diff --git a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/meshgeometry.cpp b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/meshgeometry.cpp
index e12d248f4..834e9ceac 100644
--- a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/meshgeometry.cpp
+++ b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/meshgeometry.cpp
@@ -2110,7 +2110,8 @@ void MeshGeometryClass::get_deformed_screenspace_vertices(Vector4 *dst_vert,cons
Matrix4x4 tm = prj * htree->Get_Transform(idx);
// Count equal matrices (the vertices should be pre-sorted by matrices they use)
- for (int cnt = vi; cnt < vertex_count; cnt++) if (idx!=bonelink[cnt]) break;
+ int cnt;
+ for (cnt = vi; cnt < vertex_count; cnt++) if (idx!=bonelink[cnt]) break;
// Transform to screenspace (x,y,z,w)
VectorProcessorClass::Transform(
diff --git a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/meshmatdesc.cpp b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/meshmatdesc.cpp
index fb6695a44..efb0551d6 100644
--- a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/meshmatdesc.cpp
+++ b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/meshmatdesc.cpp
@@ -647,7 +647,8 @@ void MeshMatDescClass::Post_Load_Process(bool lighting_enabled,MeshModelClass *
** Pre-multiply the vertex color arrays.
*/
bool set_lighting_to_false=true;
- for (int pass=0; pass<PassCount; pass++) {
+ int pass;
+ for (pass =0; pass<PassCount; pass++) {
/*
** If this pass doesn't have a vertex material, create one
diff --git a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/meshmdl.cpp b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/meshmdl.cpp
index 62867b535..8c60dc4ea 100644
--- a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/meshmdl.cpp
+++ b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/meshmdl.cpp
@@ -665,7 +665,8 @@ void MeshModelClass::Init_For_NPatch_Rendering()
DuplicateLocationHash.Remove_All();
SideHash.Remove_All();
- for (unsigned i=0;i<vertex_count;++i) {
+ unsigned i;
+ for (i =0;i<vertex_count;++i) {
if (LocationHash.Exists(locations[i])) {
if (!DuplicateLocationHash.Exists(locations[i])) {
DuplicateLocationHash.Insert(locations[i],i);
diff --git a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/meshmdlio.cpp b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/meshmdlio.cpp
index aeb9687a2..305858e42 100644
--- a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/meshmdlio.cpp
+++ b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/meshmdlio.cpp
@@ -2090,7 +2090,8 @@ void MeshLoadContextClass::Add_Legacy_Material(ShaderClass shader,VertexMaterial
LegacyMaterialClass * mat = W3DNEW LegacyMaterialClass;
// add the shader if it is unique
- for (int si=0; si<Shaders.Count(); si++) {
+ int si;
+ for (si =0; si<Shaders.Count(); si++) {
if (Shaders[si] == shader) break;
}
if (si == Shaders.Count()) {
@@ -2104,7 +2105,8 @@ void MeshLoadContextClass::Add_Legacy_Material(ShaderClass shader,VertexMaterial
mat->VertexMaterialIdx = -1;
} else {
unsigned long crc = vmat->Get_CRC();
- for (int vi=0; vi<VertexMaterialCrcs.Count(); vi++) {
+ int vi;
+ for (vi =0; vi<VertexMaterialCrcs.Count(); vi++) {
if (VertexMaterialCrcs[vi] == crc) break;
}
if (vi == VertexMaterials.Count()) {
@@ -2120,7 +2122,8 @@ void MeshLoadContextClass::Add_Legacy_Material(ShaderClass shader,VertexMaterial
if (tex == NULL) {
mat->TextureIdx = -1;
} else {
- for (int ti=0; ti<Textures.Count(); ti++) {
+ int ti;
+ for (ti =0; ti<Textures.Count(); ti++) {
if (Textures[ti] == tex) break;
if (stricmp(Textures[ti]->Get_Texture_Name(),tex->Get_Texture_Name()) == 0) break;
}
diff --git a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/metalmap.cpp b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/metalmap.cpp
index 5519d3e68..ae708f994 100644
--- a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/metalmap.cpp
+++ b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/metalmap.cpp
@@ -95,7 +95,8 @@ MetalMapManagerClass::MetalMapManagerClass(INIClass &ini) :
// Determine how many metals are in this file
char section[255];
- for (int lp = 0; ; lp++) {
+ int lp;
+ for (lp = 0; ; lp++) {
sprintf(section, "Metal%02d", lp);
if (!ini.Find_Section(section)) {
break; // NAK - Mar 8, 2000: changed to a break to fix off by one error in lp
diff --git a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/motchan.cpp b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/motchan.cpp
index 72e4285a0..b5e1655ea 100644
--- a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/motchan.cpp
+++ b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/motchan.cpp
@@ -1280,7 +1280,8 @@ return;
float value_min=FLT_MAX;
float value_max=-FLT_MAX;
int count=datasize/sizeof(float);
- for (int i=0;i<count;i++) {
+ int i;
+ for (i =0;i<count;i++) {
float value=Data[i];
if (_isnan(value)) value=0.0f;
if (value>100000.0f) value=0.0f;
diff --git a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/part_buf.cpp b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/part_buf.cpp
index 934ddb0af..cd91894f7 100644
--- a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/part_buf.cpp
+++ b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/part_buf.cpp
@@ -1476,7 +1476,8 @@ void ParticleBufferClass::Reset_Colors(ParticlePropertyStruct<Vector3> &new_prop
// keytime of MaxAge or larger. (If all keyframes below MaxAge, color is
// constant during the last segment between last keyframe and MaxAge).
ui_previous_key_time = 0;
- for (unsigned int ckey = 0; ckey < new_props.NumKeyFrames; ckey++) {
+ unsigned int ckey;
+ for (ckey = 0; ckey < new_props.NumKeyFrames; ckey++) {
ui_current_key_time = (unsigned int)(new_props.KeyTimes[ckey] * 1000.0f);
WWASSERT(ui_current_key_time > ui_previous_key_time);
if (ui_current_key_time >= MaxAge) break;
@@ -1635,7 +1636,8 @@ void ParticleBufferClass::Reset_Opacity(ParticlePropertyStruct<float> &new_props
// keytime of MaxAge or larger. (If all keyframes below MaxAge, alpha is
// constant during the last segment between last keyframe and MaxAge).
ui_previous_key_time = 0;
- for (unsigned int akey = 0; akey < new_props.NumKeyFrames; akey++) {
+ unsigned int akey;
+ for (akey = 0; akey < new_props.NumKeyFrames; akey++) {
ui_current_key_time = (unsigned int)(new_props.KeyTimes[akey] * 1000.0f);
WWASSERT(ui_current_key_time > ui_previous_key_time);
if (ui_current_key_time >= MaxAge) break;
@@ -1791,7 +1793,8 @@ void ParticleBufferClass::Reset_Size(ParticlePropertyStruct<float> &new_props)
// keytime of MaxAge or larger. (If all keyframes below MaxAge, size is
// constant during the last segment between last keyframe and MaxAge).
ui_previous_key_time = 0;
- for (unsigned int skey = 0; skey < new_props.NumKeyFrames; skey++) {
+ unsigned int skey;
+ for (skey = 0; skey < new_props.NumKeyFrames; skey++) {
ui_current_key_time = (unsigned int)(new_props.KeyTimes[skey] * 1000.0f);
WWASSERT(ui_current_key_time > ui_previous_key_time);
if (ui_current_key_time >= MaxAge) break;
@@ -1960,7 +1963,8 @@ void ParticleBufferClass::Reset_Rotations(ParticlePropertyStruct<float> &new_pro
// keytime of MaxAge or larger. (If all keyframes below MaxAge, the value is
// constant during the last segment between last keyframe and MaxAge).
ui_previous_key_time = 0;
- for (unsigned int key = 0; key < new_props.NumKeyFrames; key++) {
+ unsigned int key;
+ for (key = 0; key < new_props.NumKeyFrames; key++) {
ui_current_key_time = (unsigned int)(new_props.KeyTimes[key] * 1000.0f);
WWASSERT(ui_current_key_time > ui_previous_key_time);
if (ui_current_key_time >= MaxAge) break;
@@ -2174,7 +2178,8 @@ void ParticleBufferClass::Reset_Frames(ParticlePropertyStruct<float> &new_props)
// keytime of MaxAge or larger. (If all keyframes below MaxAge, the value is
// constant during the last segment between last keyframe and MaxAge).
ui_previous_key_time = 0;
- for (unsigned int key = 0; key < new_props.NumKeyFrames; key++) {
+ unsigned int key;
+ for (key = 0; key < new_props.NumKeyFrames; key++) {
ui_current_key_time = (unsigned int)(new_props.KeyTimes[key] * 1000.0f);
WWASSERT(ui_current_key_time > ui_previous_key_time);
if (ui_current_key_time >= MaxAge) break;
@@ -2321,7 +2326,8 @@ void ParticleBufferClass::Reset_Blur_Times(ParticlePropertyStruct<float> &new_bl
// keytime of MaxAge or larger. (If all keyframes below MaxAge, the value is
// constant during the last segment between last keyframe and MaxAge).
ui_previous_key_time = 0;
- for (unsigned int key = 0; key < new_blur_times.NumKeyFrames; key++) {
+ unsigned int key;
+ for (key = 0; key < new_blur_times.NumKeyFrames; key++) {
ui_current_key_time = (unsigned int)(new_blur_times.KeyTimes[key] * 1000.0f);
WWASSERT(ui_current_key_time > ui_previous_key_time);
if (ui_current_key_time >= MaxAge) break;
diff --git a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/sphereobj.cpp b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/sphereobj.cpp
index b0c6f1c08..5dc229aaf 100644
--- a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/sphereobj.cpp
+++ b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/sphereobj.cpp
@@ -1591,7 +1591,8 @@ void SphereMeshClass::Generate(float radius, int slices, int stacks)
fans = W3DNEWARRAY int[fan_size * fan_ct];
// Do Fan #1
- for (int ct = 0; ct < fan_size; ct++) {
+ int ct;
+ for (ct = 0; ct < fan_size; ct++) {
fans[ct] = ct;
}
//fans[ct] = 1;
diff --git a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/stripoptimizer.cpp b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/stripoptimizer.cpp
index 9fa588347..43eda1cd9 100644
--- a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/stripoptimizer.cpp
+++ b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/stripoptimizer.cpp
@@ -161,7 +161,8 @@ void StripOptimizerClass::Optimize_Strip_Order (int* strips, int strip_count)
int** ss = W3DNEWARRAY int*[strip_count]; // pointers to beginning of strips
int* s = strips;
- for (int i = 0; i < strip_count; i++)
+ int i;
+ for (i = 0; i < strip_count; i++)
{
ss[i] = s;
int len = *s++; // read len
@@ -245,7 +246,8 @@ void StripOptimizerClass::Optimize_Triangle_Order (int *tris, int triangle_count
WWASSERT(tris);
Tri** t = W3DNEWARRAY Tri*[triangle_count];
- for (int i = 0; i < triangle_count; i++)
+ int i;
+ for (i = 0; i < triangle_count; i++)
{
t[i] = (Tri*)(tris + i*3);
}
@@ -706,7 +708,8 @@ inline TriangleQueue::TriangleQueue (Triangle* tris, int N)
inline Vector3i Stripify::getTriangleNodeConnectivityWeights (const TriangleQueue& queue, const Triangle& tri)
{
int weight[3];
- for (int i = 0; i < 3; i++)
+ int i;
+ for (i = 0; i < 3; i++)
{
weight[i] = queue.getVertexConnectivity(tri.m_vertices[i]);
}
diff --git a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/texturefilter.cpp b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/texturefilter.cpp
index 59cab76b0..3af9b8e57 100644
--- a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/texturefilter.cpp
+++ b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/texturefilter.cpp
@@ -147,7 +147,8 @@ void TextureFilterClass::_Init_Filters(TextureFilterMode filter_type)
#endif
// For stages above zero, set best filter to the same as the stage zero, except if anisotropic
- for (int i=1;i<MAX_TEXTURE_STAGES;++i) {
+ int i;
+ for (i =1;i<MAX_TEXTURE_STAGES;++i) {
/* _MinTextureFilters[i][FILTER_TYPE_NONE]=D3DTEXF_POINT;
_MagTextureFilters[i][FILTER_TYPE_NONE]=D3DTEXF_POINT;
_MipMapFilters[i][FILTER_TYPE_NONE]=D3DTEXF_NONE;