From 2b03cd7afed88b7f405e5ec8ae325880e34ba279 Mon Sep 17 00:00:00 2001 From: Adam Johnson Date: Mon, 28 Jan 2013 21:20:16 -0500 Subject: [PATCH] Fix compile for ancient max versions --- Sources/Tools/MaxComponent/Pch.h | 25 +++++------ Sources/Tools/MaxComponent/plComponentBase.h | 3 +- .../Tools/MaxComponent/plMiscComponents.cpp | 2 +- Sources/Tools/MaxComponent/plMiscComponents.h | 2 +- Sources/Tools/MaxConvert/Pch.h | 9 ++-- .../Tools/MaxConvert/hsMaterialConverter.cpp | 6 +-- .../Tools/MaxConvert/hsMaterialConverter.h | 3 +- Sources/Tools/MaxExport/Pch.h | 2 +- Sources/Tools/MaxMain/MaxCompat.h | 41 ++++++++++--------- Sources/Tools/MaxMain/Pch.h | 18 ++++---- Sources/Tools/MaxMain/plComponentDlg.h | 9 +++- Sources/Tools/MaxMain/plMaxNodeBase.cpp | 3 +- Sources/Tools/MaxPlasmaLights/Pch.h | 9 ++-- .../Tools/MaxPlasmaLights/plRTProjDirLight.h | 1 - Sources/Tools/MaxPlasmaMtls/Pch.h | 10 ++--- 15 files changed, 78 insertions(+), 65 deletions(-) diff --git a/Sources/Tools/MaxComponent/Pch.h b/Sources/Tools/MaxComponent/Pch.h index 50773a0f..9de18dd7 100644 --- a/Sources/Tools/MaxComponent/Pch.h +++ b/Sources/Tools/MaxComponent/Pch.h @@ -79,6 +79,19 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #include #include +// 3ds Max SDK +// This stuff should ALWAYS come after hsWindows.h +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + // These MaxComponent headers will trigger a rebuild if they are changed // So it's probably best to precompile them anyway. // Some of these may include 3dsm headers, so ensure they come after hsWindows.h @@ -103,18 +116,6 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #include "MaxMain/plMaxNode.h" #include "MaxMain/plMaxNodeData.h" -// 3ds Max SDK -// This stuff should ALWAYS come after hsWindows.h -#include -#include -#include -#include -#include -#include -#include -#include -#include - #if MAX_VERSION_MAJOR >= 13 # include #endif diff --git a/Sources/Tools/MaxComponent/plComponentBase.h b/Sources/Tools/MaxComponent/plComponentBase.h index 841faed7..4a00021f 100644 --- a/Sources/Tools/MaxComponent/plComponentBase.h +++ b/Sources/Tools/MaxComponent/plComponentBase.h @@ -45,8 +45,8 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #include "pnKeyedObject/plKey.h" #include "hsWindows.h" -#include #include +#include extern TCHAR *GetString(int id); extern HINSTANCE hInstance; @@ -67,7 +67,6 @@ class INode; class INodeTab; class IObjParam; class ObjectState; -enum IOResult; class IParamBlock2; enum RefResult; class RemapDir; diff --git a/Sources/Tools/MaxComponent/plMiscComponents.cpp b/Sources/Tools/MaxComponent/plMiscComponents.cpp index 574fecfb..c138df01 100644 --- a/Sources/Tools/MaxComponent/plMiscComponents.cpp +++ b/Sources/Tools/MaxComponent/plMiscComponents.cpp @@ -694,7 +694,7 @@ void plPageInfoComponent::IUpdateSeqNumbersFromAgeFile( plErrorMsg *errMsg ) fCompPB->SetValue( kInfoSeqSuffix, 0, (int)page->GetSeqSuffix() ); // Also re-copy the page name, just to make sure the case is correct - fCompPB->SetValue( kInfoPage, 0, (const char *)page->GetName().c_str() ); + fCompPB->SetValue( kInfoPage, 0, const_cast(page->GetName().c_str()) ); return; } } diff --git a/Sources/Tools/MaxComponent/plMiscComponents.h b/Sources/Tools/MaxComponent/plMiscComponents.h index a2536513..681fda46 100644 --- a/Sources/Tools/MaxComponent/plMiscComponents.h +++ b/Sources/Tools/MaxComponent/plMiscComponents.h @@ -44,6 +44,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #define plMiscComponents_inc #include "plComponent.h" +#include #define ROOM_CID Class_ID(0x70a1570d, 0x472f5647) #define PAGEINFO_CID Class_ID(0x54ee40f1, 0x4de45acc) @@ -55,7 +56,6 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com class plFileName; class plAgeDescription; class plComponentBase; -struct NotifyInfo; const char* LocCompGetPage(plComponentBase* comp); diff --git a/Sources/Tools/MaxConvert/Pch.h b/Sources/Tools/MaxConvert/Pch.h index 46f4a87c..3e488d02 100644 --- a/Sources/Tools/MaxConvert/Pch.h +++ b/Sources/Tools/MaxConvert/Pch.h @@ -77,18 +77,16 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #include #include -// MaxComponent -#include "MaxComponent/plComponent.h" - // 3ds Max SDK // This stuff should ALWAYS come after hsWindows.h +#include #include #include #include #include +#include // needs to be above ISkin.h for Max 7 #include #include -#include #include #include #include @@ -96,6 +94,9 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #include #include +// MaxComponent +#include "MaxComponent/plComponent.h" + #if MAX_VERSION_MAJOR >= 13 # include #endif diff --git a/Sources/Tools/MaxConvert/hsMaterialConverter.cpp b/Sources/Tools/MaxConvert/hsMaterialConverter.cpp index 0c7f7356..434f634a 100644 --- a/Sources/Tools/MaxConvert/hsMaterialConverter.cpp +++ b/Sources/Tools/MaxConvert/hsMaterialConverter.cpp @@ -3944,7 +3944,7 @@ bool hsMaterialConverter::IClearDoneMaterial(Mtl* mtl, plMaxNode* node) static BMM_Color_64 green64 = BMMCOLOR(0, (1<<16)-1, 0, (1<<16)-1) -BMM_Color_64 hsMaterialConverter::ICubeSample(Bitmap *bitmap[6], double phi, double theta) +static BMM_Color_64 ICubeSample(plErrorMsg* const msg, Bitmap *bitmap[6], double phi, double theta) { hsGuardBegin("hsMaterialConverter::ICubeSample"); @@ -4024,7 +4024,7 @@ BMM_Color_64 hsMaterialConverter::ICubeSample(Bitmap *bitmap[6], double phi, dou iMap = (int)(xMap * (map->Width()-1)); jMap = (int)(yMap * (map->Height()-1)); - fErrorMsg->Set(!map, "CubeSample", "Bad fallthrough in spherefromcube").Check(); + msg->Set(!map, "CubeSample", "Bad fallthrough in spherefromcube").Check(); BMM_Color_64 c; map->GetLinearPixels(iMap,jMap,1,&c); return c; @@ -4050,7 +4050,7 @@ void hsMaterialConverter::IBuildSphereMap(Bitmap *bitmap[6], Bitmap *bm) phi = (0.5 + j) * delPhi; theta = PI - (0.5 + i) * delThe; - pb[i] = ICubeSample(bitmap, phi, theta); + pb[i] = ICubeSample(fErrorMsg, bitmap, phi, theta); } bm->PutPixels(0,j, bm->Width(), pb); } diff --git a/Sources/Tools/MaxConvert/hsMaterialConverter.h b/Sources/Tools/MaxConvert/hsMaterialConverter.h index 2f77f1c3..7ff6f913 100644 --- a/Sources/Tools/MaxConvert/hsMaterialConverter.h +++ b/Sources/Tools/MaxConvert/hsMaterialConverter.h @@ -43,6 +43,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #define __HSMATERIALCONVERTER_H #include "HeadSpin.h" +#include class hsStream; class hsScene; @@ -62,7 +63,6 @@ class plString; class plLocation; class Animatable; -struct BMM_Color_64; class Bitmap; class BitmapTex; class Color; @@ -306,7 +306,6 @@ private: hsGMaterial *ICheckForProjectedTexture(plMaxNode *node); hsGMaterial *IWrapTextureInMaterial(Texmap *texMap, plMaxNode *node); - BMM_Color_64 ICubeSample(Bitmap *bitmap[6], double phi, double theta); void IBuildSphereMap(Bitmap *bitmap[6], Bitmap *bm); #if 0 // DEFER_ANIM_MAT void IProcessAnimMaterial(BitmapTex *bitmapTex, hsGAnimLayer* at, uint32_t texFlags, uint32_t procFlags); diff --git a/Sources/Tools/MaxExport/Pch.h b/Sources/Tools/MaxExport/Pch.h index c58286d8..a8cafd05 100644 --- a/Sources/Tools/MaxExport/Pch.h +++ b/Sources/Tools/MaxExport/Pch.h @@ -66,10 +66,10 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com // 3ds Max SDK // This stuff should ALWAYS come after hsWindows.h +#include #include #include #include -#include #include #endif // _MaxExport_Pch_inc_ diff --git a/Sources/Tools/MaxMain/MaxCompat.h b/Sources/Tools/MaxMain/MaxCompat.h index dcd2abdd..2f1700f9 100644 --- a/Sources/Tools/MaxMain/MaxCompat.h +++ b/Sources/Tools/MaxMain/MaxCompat.h @@ -51,43 +51,46 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #include #if MAX_VERSION_MAJOR <= 9 -#define BMMCOLOR(x, y, z, w) \ - {x, y, x, w}; +# define BMMCOLOR(x, y, z, w) \ + {x, y, x, w}; -#define DEFAULTREMAP NoRemap() +# define DEFAULTREMAP NoRemap() -#define ENUMDEPENDENTS(maxObject, proc) \ - maxObject->EnumDependents(proc); +# define ENUMDEPENDENTS(maxObject, proc) \ + maxObject->EnumDependents(proc); -typedef TCHAR MCHAR; + typedef TCHAR MCHAR; #else -#define BMMCOLOR(x, y, z, w) \ - BMM_Color_64(x, y, z, w); +# define BMMCOLOR(x, y, z, w) \ + BMM_Color_64(x, y, z, w); -#define DEFAULTREMAP DefaultRemapDir() +# define DEFAULTREMAP DefaultRemapDir() -#define ENUMDEPENDENTS(maxObject, proc) \ - maxObject->DoEnumDependents(proc); +# define ENUMDEPENDENTS(maxObject, proc) \ + maxObject->DoEnumDependents(proc); #endif //MAX_VERSION_MAJOR #if MAX_VERSION_MAJOR <= 13 -#define GetParamBlock2Controller(pb, id) pb->GetController(id) -#define SetParamBlock2Controller(pb, id, tab, ctl) pb->SetController(id, tab, ctl) +# define GetParamBlock2Controller(pb, id) pb->GetController(id) +# define SetParamBlock2Controller(pb, id, tab, ctl) pb->SetController(id, tab, ctl) #else -#define GetParamBlock2Controller(pb, id) pb->GetControllerByID(id) -#define SetParamBlock2Controller(pb, id, tab, ctl) pb->SetControllerByID(id, tab, ctl) +# define GetParamBlock2Controller(pb, id) pb->GetControllerByID(id) +# define SetParamBlock2Controller(pb, id, tab, ctl) pb->SetControllerByID(id, tab, ctl) #endif // MAX_VERSION_MAJOR #if MAX_VERSION_MAJOR <= 11 // max 2009. Just a guess, really. 2010 doesn't need this function. -#define INIT_CUSTOM_CONTROLS(instance) InitCustomControls(instance) +# define INIT_CUSTOM_CONTROLS(instance) InitCustomControls(instance) #else -#define INIT_CUSTOM_CONTROLS(instance) +# define INIT_CUSTOM_CONTROLS(instance) #endif #if MAX_VERSION_MAJOR <= 10 // Max 2008 -#define GETNAME_RETURN_TYPE TCHAR* +# define GETNAME_RETURN_TYPE TCHAR* #else -#define GETNAME_RETURN_TYPE const TCHAR* +# define GETNAME_RETURN_TYPE const TCHAR* #endif +// Old versions of Max define this as an integer, not a Class_ID +#define XREFOBJ_COMPAT_CLASS_ID Class_ID(0x92aab38c, 0) + #endif // _PLASMA_MAXCOMPAT_H \ No newline at end of file diff --git a/Sources/Tools/MaxMain/Pch.h b/Sources/Tools/MaxMain/Pch.h index 31b44f0b..3ed12265 100644 --- a/Sources/Tools/MaxMain/Pch.h +++ b/Sources/Tools/MaxMain/Pch.h @@ -78,14 +78,8 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #include #include -// PlasmaMax Stuff included everywhere -// Some of these files may pull in Max SDK headers, so put this below hsWindows.h! -#include "plMaxNode.h" -#include "plMaxNodeData.h" -#include "MaxComponent/plComponent.h" -#include "MaxComponent/plComponentReg.h" - // Misc Max SDK +#include #include #include #include @@ -93,7 +87,8 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #include #include #include -#include +#include // above ISkin.h for Max 7 +#include #include #include #include @@ -101,6 +96,13 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #include #include +// PlasmaMax Stuff included everywhere +// Some of these files may pull in Max SDK headers, so put this below hsWindows.h! +#include "plMaxNode.h" +#include "plMaxNodeData.h" +#include "MaxComponent/plComponent.h" +#include "MaxComponent/plComponentReg.h" + // Utility #include "MaxCompat.h" #include "resource.h" diff --git a/Sources/Tools/MaxMain/plComponentDlg.h b/Sources/Tools/MaxMain/plComponentDlg.h index 8bdd5f21..1b2862e9 100644 --- a/Sources/Tools/MaxMain/plComponentDlg.h +++ b/Sources/Tools/MaxMain/plComponentDlg.h @@ -43,7 +43,14 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com class Class_ID; class Interface; class plMaxNode; -struct NotifyInfo; + +#include +#if MAX_VERSION_MAJOR >= 9 + struct NotifyInfo; +#else + // Max headers are more minimalistic in pre-9 maxes +# include +#endif class plComponentDlg { diff --git a/Sources/Tools/MaxMain/plMaxNodeBase.cpp b/Sources/Tools/MaxMain/plMaxNodeBase.cpp index 408b4d12..7c07917c 100644 --- a/Sources/Tools/MaxMain/plMaxNodeBase.cpp +++ b/Sources/Tools/MaxMain/plMaxNodeBase.cpp @@ -48,6 +48,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #include "plMaxNodeBase.h" #include "plMaxNodeData.h" #include "MaxComponent/plComponentBase.h" +#include "MaxCompat.h" #include #include @@ -483,7 +484,7 @@ bool plMaxNodeBase::IsXRef() { // Is this an XRef'd object? Object *obj = GetObjectRef(); - if (obj->SuperClassID() == SYSTEM_CLASS_ID && obj->ClassID() == XREFOBJ_CLASS_ID) + if (obj->SuperClassID() == SYSTEM_CLASS_ID && obj->ClassID() == XREFOBJ_COMPAT_CLASS_ID) return true; // diff --git a/Sources/Tools/MaxPlasmaLights/Pch.h b/Sources/Tools/MaxPlasmaLights/Pch.h index 62fb1039..21f6dd0b 100644 --- a/Sources/Tools/MaxPlasmaLights/Pch.h +++ b/Sources/Tools/MaxPlasmaLights/Pch.h @@ -54,14 +54,15 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com // Windows #include "hsWindows.h" -// Base MaxPlasmaLights stuff... -#include "plRealTimeLightBase.h" -#include "plRealTimeLights.h" - // Max SDK +#include #include #include +// Base MaxPlasmaLights stuff... +#include "plRealTimeLightBase.h" +#include "plRealTimeLights.h" + // Utility #include "MaxMain/MaxCompat.h" #include "resource.h" diff --git a/Sources/Tools/MaxPlasmaLights/plRTProjDirLight.h b/Sources/Tools/MaxPlasmaLights/plRTProjDirLight.h index a84ae4e6..1bcd99e3 100644 --- a/Sources/Tools/MaxPlasmaLights/plRTProjDirLight.h +++ b/Sources/Tools/MaxPlasmaLights/plRTProjDirLight.h @@ -56,7 +56,6 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com class Class_ID; class IParamBlock2; -struct PB2Value; class ReferenceMaker; diff --git a/Sources/Tools/MaxPlasmaMtls/Pch.h b/Sources/Tools/MaxPlasmaMtls/Pch.h index 58990f75..d9ff94af 100644 --- a/Sources/Tools/MaxPlasmaMtls/Pch.h +++ b/Sources/Tools/MaxPlasmaMtls/Pch.h @@ -59,15 +59,11 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #include #include -// MaxMain -#include "MaxMain/plMaxNode.h" -#include "MaxMain/MaxCompat.h" - // Misc 3dsm SDK +#include #include #include #include -#include #include #include #include @@ -75,6 +71,10 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #include #include +// MaxMain +#include "MaxMain/plMaxNode.h" +#include "MaxMain/MaxCompat.h" + // Local #include "resource.h"