From a6b4f88f7192e1e11ddaa35b4ca40ff09e2c9b8d Mon Sep 17 00:00:00 2001
From: Tazpn <tazpn@users.sourceforge.net>
Date: Tue, 2 Sep 2008 01:21:47 +0000
Subject: [PATCH] max: Remove afxwin.h dependence and fix the x64 code for
 wildmagic again.

---
 NifExport/NifExport.rc           |  4 ++--
 NifFurniture/NifFurniture.rc     |  4 ++--
 NifImport/MaxNifImport.rc        |  4 ++--
 NifPlugins/NifPlugins.rc         |  4 ++--
 NifProps/NifProps.rc             | 10 ++++++----
 NifProps/bhkHelperFuncs.cpp      |  4 ++--
 NifProps/bhkProxyObj.cpp         |  2 +-
 NifProps/bhkRigidBodyModifer.cpp |  5 ++---
 8 files changed, 19 insertions(+), 18 deletions(-)

diff --git a/NifExport/NifExport.rc b/NifExport/NifExport.rc
index 12a6994..c72a72a 100755
--- a/NifExport/NifExport.rc
+++ b/NifExport/NifExport.rc
@@ -7,7 +7,7 @@
 //
 // Generated from the TEXTINCLUDE 2 resource.
 //
-#include "afxres.h"
+#include "winres.h"
 
 #ifndef NIFPLUGINS
 #define DLLNAME "NifExporter.dle"  // DLL Name
@@ -65,7 +65,7 @@ END
 
 2 TEXTINCLUDE 
 BEGIN
-    "#include ""afxres.h""\r\n"
+    "#include ""winrex.h""\r\n"
     "\r\n"
     "#ifndef NIFPLUGINS\r\n"
     "#define DLLNAME ""NifExporter.dle""  // DLL Name\r\n"
diff --git a/NifFurniture/NifFurniture.rc b/NifFurniture/NifFurniture.rc
index f26088c..f5738d1 100755
--- a/NifFurniture/NifFurniture.rc
+++ b/NifFurniture/NifFurniture.rc
@@ -7,7 +7,7 @@
 //
 // Generated from the TEXTINCLUDE 2 resource.
 //
-#include "afxres.h"
+#include "winres.h"
 
 #ifndef NIFPLUGINS
 #define DLLNAME "NifFurniture.dlu"  // DLL Name
@@ -66,7 +66,7 @@ END
 
 2 TEXTINCLUDE 
 BEGIN
-    "#include ""afxres.h""\r\n"
+    "#include ""winres.h""\r\n"
     "\r\n"
     "#ifndef NIFPLUGINS\r\n"
     "#define DLLNAME ""NifFurniture.dlu""  // DLL Name\r\n"
diff --git a/NifImport/MaxNifImport.rc b/NifImport/MaxNifImport.rc
index 5c73c8c..2f548f6 100644
--- a/NifImport/MaxNifImport.rc
+++ b/NifImport/MaxNifImport.rc
@@ -7,7 +7,7 @@
 //
 // Generated from the TEXTINCLUDE 2 resource.
 //
-#include "afxres.h"
+#include "winres.h"
 
 #ifndef NIFPLUGINS
 #define DLLNAME "NifImport.dlu"  // DLL Name
@@ -133,7 +133,7 @@ END
 
 2 TEXTINCLUDE 
 BEGIN
-    "#include ""afxres.h""\r\n"
+    "#include ""winres.h""\r\n"
     "\r\n"
     "#ifndef NIFPLUGINS\r\n"
     "#define DLLNAME ""NifImport.dlu""  // DLL Name\r\n"
diff --git a/NifPlugins/NifPlugins.rc b/NifPlugins/NifPlugins.rc
index 57c6ae2..e7bc801 100644
--- a/NifPlugins/NifPlugins.rc
+++ b/NifPlugins/NifPlugins.rc
@@ -7,7 +7,7 @@
 //
 // Generated from the TEXTINCLUDE 2 resource.
 //
-#include "afxres.h"
+#include "winres.h"
 
 #ifdef NIFPLUGINS
 #define DLLNAME "NifPlugins.dlu"  // DLL Name
@@ -40,7 +40,7 @@ END
 
 2 TEXTINCLUDE 
 BEGIN
-    "#include ""afxres.h""\r\n"
+    "#include ""winres.h""\r\n"
     "\r\n"
     "#ifdef NIFPLUGINS\r\n"
     "#define DLLNAME ""NifPlugins.dlu""  // DLL Name\r\n"
diff --git a/NifProps/NifProps.rc b/NifProps/NifProps.rc
index 08abe00..0ddb2b9 100755
--- a/NifProps/NifProps.rc
+++ b/NifProps/NifProps.rc
@@ -7,13 +7,14 @@
 //
 // Generated from the TEXTINCLUDE 2 resource.
 //
-#include "afxres.h"
+#include "winres.h"
 
 #ifndef NIFPLUGINS
 #define DLLNAME "NifProps.dlu"  // DLL Name
 #define DLLDESCRIPTION "3ds Max Nif Reactor Properites Plugin"
 #include "..\nifcommon\nifversion.rc"  
-#endif

+#endif
+
 /////////////////////////////////////////////////////////////////////////////
 #undef APSTUDIO_READONLY_SYMBOLS
 
@@ -65,7 +66,7 @@ END
 
 2 TEXTINCLUDE 
 BEGIN
-    "#include ""afxres.h""\r\n"
+    "#include ""winres.h""\r\n"
     "\r\n"
     "#ifndef NIFPLUGINS\r\n"
     "#define DLLNAME ""NifProps.dlu""  // DLL Name\r\n"
@@ -1151,7 +1152,8 @@ END
 //
 // Generated from the TEXTINCLUDE 3 resource.
 //
-

+
+
 /////////////////////////////////////////////////////////////////////////////
 #endif    // not APSTUDIO_INVOKED
 
diff --git a/NifProps/bhkHelperFuncs.cpp b/NifProps/bhkHelperFuncs.cpp
index 9e7508e..cc06746 100644
--- a/NifProps/bhkHelperFuncs.cpp
+++ b/NifProps/bhkHelperFuncs.cpp
@@ -8,7 +8,7 @@
 #include "meshadj.h"
 
 // Includes for WildMagic so we can do the Capsule fitting
-#if defined(USES_WILDMAGIC)
+#if defined(USES_WILDMAGIC) && !defined(_M_X64)
 #  if _MSC_VER >= 1500
 #    ifdef _DEBUG
 #      pragma comment (lib, "Wm4Foundation90d")
@@ -784,7 +784,7 @@ void BuildScubaMesh(Mesh &mesh, int segs, int smooth, int llsegs,
 //   currently calculate then differently.
 extern void CalcCapsule(Mesh &mesh, Point3& pt1, Point3& pt2, float& r1, float& r2)
 {
-#if defined(USES_WILDMAGIC)
+#if defined(USES_WILDMAGIC) && !defined(_M_X64)
 	int nv = mesh.getNumVerts();
 	Wm4::Vector3<float>* akPoint = new Wm4::Vector3<float>[nv];
 	for (int i=0; i<nv; i++)
diff --git a/NifProps/bhkProxyObj.cpp b/NifProps/bhkProxyObj.cpp
index aebc6dd..7cf1b8d 100644
--- a/NifProps/bhkProxyObj.cpp
+++ b/NifProps/bhkProxyObj.cpp
@@ -365,7 +365,7 @@ INT_PTR ProxyParamDlgProc::DlgProc(TimeValue t,IParamMap2 *map,HWND hWnd,UINT ms
 		  so->pblock2->GetValue( PB_MATERIAL, 0, sel, valid);
 		  mCbMaterial.select( sel + 1 );
 		 // Disable all types not currently implemented
-#if defined(USES_WILDMAGIC)
+#if !defined(USES_WILDMAGIC) || defined(_M_X64)
 		 EnableWindow(GetDlgItem(hWnd, IDC_RDO_CAPSULE), FALSE);
 #endif
 		 //EnableWindow(GetDlgItem(hWnd, IDC_RDO_PACKED_STRIPS), FALSE);
diff --git a/NifProps/bhkRigidBodyModifer.cpp b/NifProps/bhkRigidBodyModifer.cpp
index f84bd4e..fc0af9b 100644
--- a/NifProps/bhkRigidBodyModifer.cpp
+++ b/NifProps/bhkRigidBodyModifer.cpp
@@ -269,9 +269,8 @@ INT_PTR bhkRigidBodyModifierDlgProc::DlgProc (TimeValue t,IParamMap2 *map,HWND h
 		   int sel = NP_INVALID_HVK_MATERIAL;
 		   mod->pblock->GetValue( PB_MATERIAL, 0, sel, valid);
 		   mCbMaterial.select( sel + 1 );
-
-#if defined(USES_WILDMAGIC)
-				EnableWindow(GetDlgItem(hWnd, IDC_RDO_CAPSULE), FALSE);
+#if !defined(USES_WILDMAGIC) || defined(_M_X64)
+		   EnableWindow(GetDlgItem(hWnd, IDC_RDO_CAPSULE), FALSE);
 #endif
 		   Update(t);
 		   break;
-- 
GitLab