Browse Source

Update Max plugin for renamed endian functions.

Joseph Davies 13 years ago committed by Darryl Pogue
parent
commit
32218c36ad
  1. 4
      Sources/Tools/MaxComponent/plMultistageBehComponent.cpp
  2. 26
      Sources/Tools/MaxComponent/plMultistageStage.cpp
  3. 16
      Sources/Tools/MaxMain/plPhysXCooking.cpp

4
Sources/Tools/MaxComponent/plMultistageBehComponent.cpp

@ -518,7 +518,7 @@ IOResult plMultistageBehComponent::Save(ISave* isave)
{ {
isave->BeginChunk(kMultiStage); isave->BeginChunk(kMultiStage);
MaxStream multiChunk(isave); MaxStream multiChunk(isave);
multiChunk.WriteSwap32(3); multiChunk.WriteLE32(3);
multiChunk.Writebool(fFreezePhys); multiChunk.Writebool(fFreezePhys);
multiChunk.Writebool(fSmartSeek); multiChunk.Writebool(fSmartSeek);
multiChunk.Writebool(fReverseFBOnRelease); multiChunk.Writebool(fReverseFBOnRelease);
@ -554,7 +554,7 @@ IOResult plMultistageBehComponent::Load(ILoad* iload)
{ {
MaxStream multiChunk(iload); MaxStream multiChunk(iload);
// all versions do this // all versions do this
int version = multiChunk.ReadSwap32(); int version = multiChunk.ReadLE32();
fFreezePhys = multiChunk.Readbool(); fFreezePhys = multiChunk.Readbool();
if(version > 1) if(version > 1)

26
Sources/Tools/MaxComponent/plMultistageStage.cpp

@ -54,11 +54,11 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
char* MyReadSafeString(hsStream* s) char* MyReadSafeString(hsStream* s)
{ {
char *name = nil; char *name = nil;
UInt16 numChars = s->ReadSwap16(); UInt16 numChars = s->ReadLE16();
bool oldFormat = !(numChars & 0xf000); bool oldFormat = !(numChars & 0xf000);
if (oldFormat) if (oldFormat)
s->ReadSwap16(); s->ReadLE16();
numChars &= ~0xf000; numChars &= ~0xf000;
hsAssert(numChars <= s->GetSizeLeft(), "Bad string"); hsAssert(numChars <= s->GetSizeLeft(), "Bad string");
@ -76,7 +76,7 @@ void MyWriteSafeString(hsStream* s, const char* str)
{ {
int len = hsStrlen(str); int len = hsStrlen(str);
hsAssert(len<0xf000, "String too long"); hsAssert(len<0xf000, "String too long");
s->WriteSwap16(len | 0xf000); s->WriteLE16(len | 0xf000);
if (len > 0) if (len > 0)
s->Write(len, str); s->Write(len, str);
} }
@ -139,14 +139,14 @@ void plBaseStage::SetName(const char* name)
void plBaseStage::Read(hsStream *stream) void plBaseStage::Read(hsStream *stream)
{ {
int version = stream->ReadSwap16(); int version = stream->ReadLE16();
delete [] fName; delete [] fName;
fName = MyReadSafeString(stream); fName = MyReadSafeString(stream);
} }
void plBaseStage::Write(hsStream *stream) void plBaseStage::Write(hsStream *stream)
{ {
stream->WriteSwap16(1); stream->WriteLE16(1);
MyWriteSafeString(stream, fName); MyWriteSafeString(stream, fName);
} }
@ -186,11 +186,11 @@ void plStandardStage::Read(hsStream *stream)
{ {
plBaseStage::Read(stream); plBaseStage::Read(stream);
UInt16 version = stream->ReadSwap16(); UInt16 version = stream->ReadLE16();
delete [] fAnimName; delete [] fAnimName;
fAnimName = MyReadSafeString(stream); fAnimName = MyReadSafeString(stream);
fNumLoops = stream->ReadSwap32(); fNumLoops = stream->ReadLE32();
fLoopForever = stream->Readbool(); fLoopForever = stream->Readbool();
fForward = stream->ReadByte(); fForward = stream->ReadByte();
fBackward = stream->ReadByte(); fBackward = stream->ReadByte();
@ -202,9 +202,9 @@ void plStandardStage::Read(hsStream *stream)
{ {
// these guys were added in version 2 // these guys were added in version 2
fDoAdvanceTo = stream->Readbool(); fDoAdvanceTo = stream->Readbool();
fAdvanceTo = stream->ReadSwap32(); fAdvanceTo = stream->ReadLE32();
fDoRegressTo = stream->Readbool(); fDoRegressTo = stream->Readbool();
fRegressTo = stream->ReadSwap32(); fRegressTo = stream->ReadLE32();
} }
} }
@ -212,10 +212,10 @@ void plStandardStage::Write(hsStream *stream)
{ {
plBaseStage::Write(stream); plBaseStage::Write(stream);
stream->WriteSwap16(2); stream->WriteLE16(2);
MyWriteSafeString(stream, fAnimName); MyWriteSafeString(stream, fAnimName);
stream->WriteSwap32(fNumLoops); stream->WriteLE32(fNumLoops);
stream->Writebool(fLoopForever); stream->Writebool(fLoopForever);
stream->WriteByte(fForward); stream->WriteByte(fForward);
stream->WriteByte(fBackward); stream->WriteByte(fBackward);
@ -226,9 +226,9 @@ void plStandardStage::Write(hsStream *stream)
// these next 4 were added in version 2 // these next 4 were added in version 2
stream->Writebool(fDoAdvanceTo); stream->Writebool(fDoAdvanceTo);
stream->WriteSwap32(fAdvanceTo); stream->WriteLE32(fAdvanceTo);
stream->Writebool(fDoRegressTo); stream->Writebool(fDoRegressTo);
stream->WriteSwap32(fRegressTo); stream->WriteLE32(fRegressTo);
} }
void plStandardStage::CreateDlg() void plStandardStage::CreateDlg()

16
Sources/Tools/MaxMain/plPhysXCooking.cpp

@ -218,13 +218,13 @@ hsVectorStream* plPhysXCooking::CookHull(int nVerts, hsPoint3* verts, bool infla
/* /*
NxTriangleMesh* ReadExplicit(hsStream* stream) NxTriangleMesh* ReadExplicit(hsStream* stream)
{ {
const int nVertices = stream->ReadSwap32(); const int nVertices = stream->ReadLE32();
hsPoint3* pVertices = TRACKED_NEW hsPoint3[nVertices]; hsPoint3* pVertices = TRACKED_NEW hsPoint3[nVertices];
stream->ReadSwapScalar(nVertices*3, (float*)pVertices); stream->ReadLEScalar(nVertices*3, (float*)pVertices);
const int nFaces = stream->ReadSwap32(); const int nFaces = stream->ReadLE32();
unsigned short* pTriangles = TRACKED_NEW unsigned short[nFaces * 3]; unsigned short* pTriangles = TRACKED_NEW unsigned short[nFaces * 3];
stream->ReadSwap16(nFaces * 3, pTriangles); stream->ReadLE16(nFaces * 3, pTriangles);
NxTriangleMeshDesc triDesc; NxTriangleMeshDesc triDesc;
triDesc.numVertices = nVertices; triDesc.numVertices = nVertices;
@ -256,9 +256,9 @@ NxTriangleMesh* ReadExplicit(hsStream* stream)
NxConvexMesh* ReadConvexHull(hsStream* stream) NxConvexMesh* ReadConvexHull(hsStream* stream)
{ {
const int nVertices = stream->ReadSwap32(); const int nVertices = stream->ReadLE32();
hsPoint3* pVertices = TRACKED_NEW hsPoint3[nVertices]; hsPoint3* pVertices = TRACKED_NEW hsPoint3[nVertices];
stream->ReadSwapScalar(nVertices*3, (float*)pVertices); stream->ReadLEScalar(nVertices*3, (float*)pVertices);
NxConvexMeshDesc convexDesc; NxConvexMeshDesc convexDesc;
convexDesc.numVertices = nVertices; convexDesc.numVertices = nVertices;
@ -286,9 +286,9 @@ NxConvexMesh* ReadConvexHull(hsStream* stream)
void ReadBoxFromHull(hsStream* stream, NxBoxShapeDesc& box) void ReadBoxFromHull(hsStream* stream, NxBoxShapeDesc& box)
{ {
const int nVertices = stream->ReadSwap32(); const int nVertices = stream->ReadLE32();
hsPoint3* pVertices = TRACKED_NEW hsPoint3[nVertices]; hsPoint3* pVertices = TRACKED_NEW hsPoint3[nVertices];
stream->ReadSwapScalar(nVertices*3, (float*)pVertices); stream->ReadLEScalar(nVertices*3, (float*)pVertices);
hsScalar minX, minY, minZ, maxX, maxY, maxZ; hsScalar minX, minY, minZ, maxX, maxY, maxZ;
minX = minY = minZ = FLT_MAX; minX = minY = minZ = FLT_MAX;

Loading…
Cancel
Save