From 41495b8e0384cb01d29dc77423a53b897a3edd31 Mon Sep 17 00:00:00 2001 From: Darryl Pogue Date: Fri, 28 Oct 2011 23:18:22 -0700 Subject: [PATCH] Fix errors in plDrawable. It builds almost the whole project now... until it hits plVisLOSMgr :( --- .../plDrawable/plDrawableGenerator.cpp | 3 ++- .../PubUtilLib/plDrawable/plDrawableSpans.cpp | 5 +++-- .../PubUtilLib/plDrawable/plDynaBulletMgr.cpp | 2 +- .../PubUtilLib/plDrawable/plDynaDecalMgr.cpp | 10 +++++----- .../PubUtilLib/plDrawable/plDynaDecalMgr.h | 4 ++-- .../PubUtilLib/plDrawable/plDynaFootMgr.cpp | 4 ++-- .../PubUtilLib/plDrawable/plDynaPuddleMgr.cpp | 2 +- .../PubUtilLib/plDrawable/plDynaRippleMgr.cpp | 7 ++++--- .../plDrawable/plDynaRippleMgrVS.cpp | 5 +++-- .../PubUtilLib/plDrawable/plDynaTorpedoMgr.cpp | 2 +- .../PubUtilLib/plDrawable/plDynaWakeMgr.cpp | 7 ++++--- .../PubUtilLib/plDrawable/plParticleFiller.cpp | 18 ++++++++++++------ .../PubUtilLib/plDrawable/plSpaceTreeMaker.cpp | 5 +++-- 13 files changed, 43 insertions(+), 31 deletions(-) diff --git a/Sources/Plasma/PubUtilLib/plDrawable/plDrawableGenerator.cpp b/Sources/Plasma/PubUtilLib/plDrawable/plDrawableGenerator.cpp index e66db335..4a8465ee 100644 --- a/Sources/Plasma/PubUtilLib/plDrawable/plDrawableGenerator.cpp +++ b/Sources/Plasma/PubUtilLib/plDrawable/plDrawableGenerator.cpp @@ -547,7 +547,8 @@ plDrawableSpans *plDrawableGenerator::GenerateConicalDrawable( hsScalar radi direction.Set( 0, 0, height ); - return GenerateConicalDrawable( hsPoint3( 0, 0, 0 ), direction, radius, material, localToWorld, blended, + hsPoint3 zero(0, 0, 0); + return GenerateConicalDrawable(zero, direction, radius, material, localToWorld, blended, multColor, retIndex, toAddTo ); } diff --git a/Sources/Plasma/PubUtilLib/plDrawable/plDrawableSpans.cpp b/Sources/Plasma/PubUtilLib/plDrawable/plDrawableSpans.cpp index b7544f78..adb532b6 100644 --- a/Sources/Plasma/PubUtilLib/plDrawable/plDrawableSpans.cpp +++ b/Sources/Plasma/PubUtilLib/plDrawable/plDrawableSpans.cpp @@ -3549,8 +3549,9 @@ plParticleSpan *plDrawableSpans::ICreateParticleIcicle( hsGMaterial *material, icicle->fLocalBounds.MakeEmpty(); icicle->fWorldBounds.MakeEmpty(); - icicle->fLocalBounds.Union( &hsPoint3(0,0,0) ); - icicle->fWorldBounds.Union( &hsPoint3(0,0,0) ); + hsPoint3 zero(0, 0, 0); + icicle->fLocalBounds.Union( &zero ); + icicle->fWorldBounds.Union( &zero ); icicle->fGroupIdx = set->fGroupIdx; icicle->fVBufferIdx = set->fVBufferIdx; diff --git a/Sources/Plasma/PubUtilLib/plDrawable/plDynaBulletMgr.cpp b/Sources/Plasma/PubUtilLib/plDrawable/plDynaBulletMgr.cpp index 3c98180b..7854d8e6 100644 --- a/Sources/Plasma/PubUtilLib/plDrawable/plDynaBulletMgr.cpp +++ b/Sources/Plasma/PubUtilLib/plDrawable/plDynaBulletMgr.cpp @@ -103,7 +103,7 @@ hsBool plDynaBulletMgr::IHandleShot(plBulletMsg* bull) fCutter->SetLength(hsVector3(bull->Radius() * fScale.fX, bull->Radius() * fScale.fY, bull->Range())); fCutter->Set(pos, up, -bull->Dir()); - plDynaDecalInfo& info = IGetDecalInfo(UInt32(this), GetKey()); + plDynaDecalInfo& info = IGetDecalInfo(unsigned_ptr(this), GetKey()); if( bull->PartyTime() > 0 ) fPartyTime = bull->PartyTime(); diff --git a/Sources/Plasma/PubUtilLib/plDrawable/plDynaDecalMgr.cpp b/Sources/Plasma/PubUtilLib/plDrawable/plDynaDecalMgr.cpp index 5fc6eb07..69f00005 100644 --- a/Sources/Plasma/PubUtilLib/plDrawable/plDynaDecalMgr.cpp +++ b/Sources/Plasma/PubUtilLib/plDrawable/plDynaDecalMgr.cpp @@ -348,7 +348,7 @@ hsBool plDynaDecalMgr::IWetParts(const plDynaDecalEnableMsg* enaMsg) const plPrintShape* shape = IGetPrintShape(enaMsg->GetShapeKey()); if( shape ) { - plDynaDecalInfo& info = IGetDecalInfo(UInt32(shape), shape->GetKey()); + plDynaDecalInfo& info = IGetDecalInfo(unsigned_ptr(shape), shape->GetKey()); IWetInfo(info, enaMsg); } } @@ -362,7 +362,7 @@ hsBool plDynaDecalMgr::IWetParts(const plDynaDecalEnableMsg* enaMsg) const plPrintShape* shape = IGetPrintShape(avMod, fPartIDs[i]); if( shape ) { - plDynaDecalInfo& info = IGetDecalInfo(UInt32(shape), shape->GetKey()); + plDynaDecalInfo& info = IGetDecalInfo(unsigned_ptr(shape), shape->GetKey()); IWetInfo(info, enaMsg); } } @@ -381,7 +381,7 @@ hsBool plDynaDecalMgr::IWetPart(UInt32 id, const plDynaDecalEnableMsg* enaMsg) const plPrintShape* shape = IGetPrintShape(avMod, id); if( shape ) { - plDynaDecalInfo& info = IGetDecalInfo(UInt32(shape), shape->GetKey()); + plDynaDecalInfo& info = IGetDecalInfo(unsigned_ptr(shape), shape->GetKey()); IWetInfo(info, enaMsg); } return true; @@ -484,7 +484,7 @@ hsBool plDynaDecalMgr::MsgReceive(plMessage* msg) return true; case kRefAvatar: if( refMsg->GetContext() & (plRefMsg::kOnRemove|plRefMsg::kOnDestroy) ) - IRemoveDecalInfo(UInt32(refMsg->GetRef())); + IRemoveDecalInfo(unsigned_ptr(refMsg->GetRef())); return true; } } @@ -537,7 +537,7 @@ plDynaDecalInfo& plDynaDecalInfo::Init(const plKey& key) return *this; } -plDynaDecalInfo& plDynaDecalMgr::IGetDecalInfo(UInt32 id, const plKey& key) +plDynaDecalInfo& plDynaDecalMgr::IGetDecalInfo(unsigned_ptr id, const plKey& key) { plDynaDecalMap::iterator iter = fDecalMap.find(id); if( iter == fDecalMap.end() ) diff --git a/Sources/Plasma/PubUtilLib/plDrawable/plDynaDecalMgr.h b/Sources/Plasma/PubUtilLib/plDrawable/plDynaDecalMgr.h index c766bfba..b8d54268 100644 --- a/Sources/Plasma/PubUtilLib/plDrawable/plDynaDecalMgr.h +++ b/Sources/Plasma/PubUtilLib/plDrawable/plDynaDecalMgr.h @@ -104,7 +104,7 @@ public: plDynaDecalInfo& Init(const plKey& key); }; -typedef std::map< UInt32, plDynaDecalInfo, std::less > plDynaDecalMap; +typedef std::map< unsigned_ptr, plDynaDecalInfo, std::less > plDynaDecalMap; // plDynaDecalMgr // Primary responsibilities: @@ -189,7 +189,7 @@ protected: hsBool IWetPart(UInt32 id, const plDynaDecalEnableMsg* enaMsg); void IWetInfo(plDynaDecalInfo& info, const plDynaDecalEnableMsg* enaMsg) const; hsScalar IHowWet(plDynaDecalInfo& info, double t) const; - plDynaDecalInfo& IGetDecalInfo(UInt32 id, const plKey& key); + plDynaDecalInfo& IGetDecalInfo(unsigned_ptr id, const plKey& key); void IRemoveDecalInfo(UInt32 id); void IRemoveDecalInfos(const plKey& key); diff --git a/Sources/Plasma/PubUtilLib/plDrawable/plDynaFootMgr.cpp b/Sources/Plasma/PubUtilLib/plDrawable/plDynaFootMgr.cpp index f89f01d1..2b68e621 100644 --- a/Sources/Plasma/PubUtilLib/plDrawable/plDynaFootMgr.cpp +++ b/Sources/Plasma/PubUtilLib/plDrawable/plDynaFootMgr.cpp @@ -115,7 +115,7 @@ hsBool plDynaFootMgr::MsgReceive(plMessage* msg) const plPrintShape* shape = IGetPrintShape(armMod, id); if( shape ) { - plDynaDecalInfo& info = IGetDecalInfo(UInt32(shape), shape->GetKey()); + plDynaDecalInfo& info = IGetDecalInfo(unsigned_ptr(shape), shape->GetKey()); if( IPrintFromShape(shape, footMsg->IsLeft()) ) { INotifyActive(info, armMod->GetKey(), id); @@ -138,7 +138,7 @@ hsBool plDynaFootMgr::IPrintFromShape(const plPrintShape* shape, hsBool flip) if( shape ) { - plDynaDecalInfo& info = IGetDecalInfo(UInt32(shape), shape->GetKey()); + plDynaDecalInfo& info = IGetDecalInfo(unsigned_ptr(shape), shape->GetKey()); double secs = hsTimer::GetSysSeconds(); hsScalar wetness = IHowWet(info, secs); diff --git a/Sources/Plasma/PubUtilLib/plDrawable/plDynaPuddleMgr.cpp b/Sources/Plasma/PubUtilLib/plDrawable/plDynaPuddleMgr.cpp index a00878c5..e389d7b0 100644 --- a/Sources/Plasma/PubUtilLib/plDrawable/plDynaPuddleMgr.cpp +++ b/Sources/Plasma/PubUtilLib/plDrawable/plDynaPuddleMgr.cpp @@ -94,7 +94,7 @@ hsBool plDynaPuddleMgr::MsgReceive(plMessage* msg) const plPrintShape* shape = IGetPrintShape(armMod, fPartIDs[i]); if( shape ) { - plDynaDecalInfo& info = IGetDecalInfo(UInt32(shape), shape->GetKey()); + plDynaDecalInfo& info = IGetDecalInfo(unsigned_ptr(shape), shape->GetKey()); if( IRippleFromShape(shape, true) ) { INotifyActive(info, armMod->GetKey(), fPartIDs[i]); diff --git a/Sources/Plasma/PubUtilLib/plDrawable/plDynaRippleMgr.cpp b/Sources/Plasma/PubUtilLib/plDrawable/plDynaRippleMgr.cpp index 9d1ca2c7..209a7994 100644 --- a/Sources/Plasma/PubUtilLib/plDrawable/plDynaRippleMgr.cpp +++ b/Sources/Plasma/PubUtilLib/plDrawable/plDynaRippleMgr.cpp @@ -146,7 +146,7 @@ hsBool plDynaRippleMgr::MsgReceive(plMessage* msg) const plPrintShape* shape = IGetPrintShape(armMsg->fArmature, fPartIDs[i]); if( shape ) { - plDynaDecalInfo& info = IGetDecalInfo(UInt32(shape), shape->GetKey()); + plDynaDecalInfo& info = IGetDecalInfo(unsigned_ptr(shape), shape->GetKey()); if( IRippleFromShape(shape, false) ) { INotifyActive(info, armMsg->fArmature->GetKey(), fPartIDs[i]); @@ -182,7 +182,7 @@ hsBool plDynaRippleMgr::IRippleFromShape(const plPrintShape* shape, hsBool force hsBool retVal = false; - plDynaDecalInfo& info = IGetDecalInfo(UInt32(shape), shape->GetKey()); + plDynaDecalInfo& info = IGetDecalInfo(unsigned_ptr(shape), shape->GetKey()); const hsMatrix44& shapeL2W = shape->GetOwner()->GetLocalToWorld(); @@ -191,7 +191,8 @@ hsBool plDynaRippleMgr::IRippleFromShape(const plPrintShape* shape, hsBool force double t = hsTimer::GetSysSeconds(); hsScalar dt = hsScalar(t - info.fLastTime) * sRand.RandZeroToOne(); hsBool longEnough = (dt >= kMinTime); - hsBool farEnough = (hsVector3(&info.fLastPos, &shapeL2W.GetTranslate()).Magnitude() > kMinDist); + hsPoint3 xlate = shapeL2W.GetTranslate(); + hsBool farEnough = (hsVector3(&info.fLastPos, &xlate).Magnitude() > kMinDist); if( force || longEnough || farEnough ) { hsPoint3 pos = shapeL2W.GetTranslate(); diff --git a/Sources/Plasma/PubUtilLib/plDrawable/plDynaRippleMgrVS.cpp b/Sources/Plasma/PubUtilLib/plDrawable/plDynaRippleMgrVS.cpp index 21a81c1d..9c546208 100644 --- a/Sources/Plasma/PubUtilLib/plDrawable/plDynaRippleMgrVS.cpp +++ b/Sources/Plasma/PubUtilLib/plDrawable/plDynaRippleMgrVS.cpp @@ -172,7 +172,7 @@ hsBool plDynaRippleVSMgr::IRippleFromShape(const plPrintShape* shape, hsBool for hsBool retVal = false; - plDynaDecalInfo& info = IGetDecalInfo(UInt32(shape), shape->GetKey()); + plDynaDecalInfo& info = IGetDecalInfo(unsigned_ptr(shape), shape->GetKey()); const hsMatrix44& shapeL2W = shape->GetOwner()->GetLocalToWorld(); @@ -181,7 +181,8 @@ hsBool plDynaRippleVSMgr::IRippleFromShape(const plPrintShape* shape, hsBool for double t = hsTimer::GetSysSeconds(); hsScalar dt = hsScalar(t - info.fLastTime) * sRand.RandZeroToOne(); hsBool longEnough = (dt >= kMinTime); - hsBool farEnough = (hsVector3(&info.fLastPos, &shapeL2W.GetTranslate()).Magnitude() > kMinDist); + hsPoint3 xlate = shapeL2W.GetTranslate(); + hsBool farEnough = (hsVector3(&info.fLastPos, &xlate).Magnitude() > kMinDist); if( force || longEnough || farEnough ) { hsPoint3 pos = shapeL2W.GetTranslate(); diff --git a/Sources/Plasma/PubUtilLib/plDrawable/plDynaTorpedoMgr.cpp b/Sources/Plasma/PubUtilLib/plDrawable/plDynaTorpedoMgr.cpp index eb9d8eb6..632b062e 100644 --- a/Sources/Plasma/PubUtilLib/plDrawable/plDynaTorpedoMgr.cpp +++ b/Sources/Plasma/PubUtilLib/plDrawable/plDynaTorpedoMgr.cpp @@ -124,7 +124,7 @@ hsBool plDynaTorpedoMgr::IHandleShot(plBulletMsg* bull) fCutter->SetLength(hsVector3(scaleX, scaleY, bull->Range())); fCutter->Set(pos, up, -bull->Dir()); - plDynaDecalInfo& info = IGetDecalInfo(UInt32(this), GetKey()); + plDynaDecalInfo& info = IGetDecalInfo(unsigned_ptr(this), GetKey()); if( bull->PartyTime() > 0 ) fPartyTime = bull->PartyTime(); diff --git a/Sources/Plasma/PubUtilLib/plDrawable/plDynaWakeMgr.cpp b/Sources/Plasma/PubUtilLib/plDrawable/plDynaWakeMgr.cpp index c9a40939..6480f085 100644 --- a/Sources/Plasma/PubUtilLib/plDrawable/plDynaWakeMgr.cpp +++ b/Sources/Plasma/PubUtilLib/plDrawable/plDynaWakeMgr.cpp @@ -173,7 +173,7 @@ hsBool plDynaWakeMgr::IRippleFromShape(const plPrintShape* shape, hsBool force) hsBool retVal = false; - plDynaDecalInfo& info = IGetDecalInfo(UInt32(shape), shape->GetKey()); + plDynaDecalInfo& info = IGetDecalInfo(unsigned_ptr(shape), shape->GetKey()); const hsMatrix44& shapeL2W = shape->GetOwner()->GetLocalToWorld(); @@ -182,7 +182,8 @@ hsBool plDynaWakeMgr::IRippleFromShape(const plPrintShape* shape, hsBool force) double t = hsTimer::GetSysSeconds(); hsScalar dt = hsScalar(t - info.fLastTime) * sRand.RandZeroToOne(); hsBool longEnough = (dt >= kMinTime); - hsBool farEnough = (hsVector3(&info.fLastPos, &shapeL2W.GetTranslate()).Magnitude() > kMinDist); + hsPoint3 xlate = shapeL2W.GetTranslate(); + hsBool farEnough = (hsVector3(&info.fLastPos, &xlate).Magnitude() > kMinDist); if( force || longEnough || farEnough ) { hsPoint3 pos = shapeL2W.GetTranslate(); @@ -225,4 +226,4 @@ hsBool plDynaWakeMgr::IRippleFromShape(const plPrintShape* shape, hsBool force) retVal = true; } return retVal; -} \ No newline at end of file +} diff --git a/Sources/Plasma/PubUtilLib/plDrawable/plParticleFiller.cpp b/Sources/Plasma/PubUtilLib/plDrawable/plParticleFiller.cpp index 4ff42cb4..45dd04a7 100644 --- a/Sources/Plasma/PubUtilLib/plDrawable/plParticleFiller.cpp +++ b/Sources/Plasma/PubUtilLib/plDrawable/plParticleFiller.cpp @@ -104,7 +104,8 @@ void inline IInlSetParticlePathFollow( const plParticleCore &particle, const hsM /// Follow path specified by interpreting orientation as a velocity vector. - hsVector3 viewDir(&particle.fPos, &viewToWorld.GetTranslate()); + hsPoint3 xlate = viewToWorld.GetTranslate(); + hsVector3 viewDir(&particle.fPos, &xlate); hsFastMath::NormalizeAppr(viewDir); zVec = viewDir; @@ -152,7 +153,8 @@ void inline IInlSetParticlePathStretch( const plParticleCore &particle, const hs // Note that we could probably slim away a normalize or two, but the actual number // of normalizes we're doing hasn't gone up, I've just moved them up from IInlSetParticlePoints(). - hsVector3 viewDir(&particle.fPos, &viewToWorld.GetTranslate()); + hsPoint3 xlate = viewToWorld.GetTranslate(); + hsVector3 viewDir(&particle.fPos, &xlate); hsScalar invD = hsFastMath::InvSqrtAppr(viewDir.MagnitudeSquared()); viewDir *= invD; @@ -191,7 +193,8 @@ void inline IInlSetParticlePathFlow( const plParticleCore &particle, const hsMat // difference is that we're going to keep the area of the particle constant, // so the longer it stretches, the narrower it gets orthogonal to the velocity. - hsVector3 viewDir(&particle.fPos, &viewToWorld.GetTranslate()); + hsPoint3 xlate = viewToWorld.GetTranslate(); + hsVector3 viewDir(&particle.fPos, &xlate); hsScalar invD = hsFastMath::InvSqrtAppr(viewDir.MagnitudeSquared()); viewDir *= invD; @@ -242,10 +245,12 @@ void inline IInlSetParticleExplicit( const hsMatrix44 &viewToWorld, const plPart // to calculate the vector from camera to particle and normalize it than // to transform the vector (0,0,-1) (though not as fast as pulling the // camera direction directly from the viewToWorld). - hsVector3 del(&particle.fPos, &viewToWorld.GetTranslate()); + hsPoint3 xlate = viewToWorld.GetTranslate(); + hsVector3 del(&particle.fPos, &xlate); hsFastMath::NormalizeAppr(del); zVec = del; - yVec.Set(&(viewToWorld * orientation)); + hsVector3 tmp = viewToWorld * orientation; + yVec.Set(&tmp); xVec = yVec % zVec; #endif // See notes below - mf @@ -320,7 +325,8 @@ void inline IInlSetNormalStrongestLight( hsVector3 &partNorm, const plParticleCo { if( omniLight != nil ) { - partNorm.Set( &particle.fPos, &omniLight->GetWorldPosition() ); + hsPoint3 pos = omniLight->GetWorldPosition(); + partNorm.Set( &particle.fPos, &pos ); partNorm = -partNorm; } else if( directionLight != nil ) diff --git a/Sources/Plasma/PubUtilLib/plDrawable/plSpaceTreeMaker.cpp b/Sources/Plasma/PubUtilLib/plDrawable/plSpaceTreeMaker.cpp index 2eeab115..932bced2 100644 --- a/Sources/Plasma/PubUtilLib/plDrawable/plSpaceTreeMaker.cpp +++ b/Sources/Plasma/PubUtilLib/plDrawable/plSpaceTreeMaker.cpp @@ -551,7 +551,8 @@ plSpaceTree* plSpaceTreeMaker::IMakeEmptyTree() plSpaceTree* tree = TRACKED_NEW plSpaceTree; tree->fTree.SetCount(1); - tree->fTree[0].fWorldBounds.Reset(&hsPoint3(0,0,0)); + hsPoint3 zero(0, 0, 0); + tree->fTree[0].fWorldBounds.Reset(&zero); tree->fTree[0].fFlags = plSpaceTreeNode::kEmpty; tree->fRoot = 0; tree->fNumLeaves = 0; @@ -734,4 +735,4 @@ void plSpaceTreeMaker::IMakeSpaceTreeRecur(plSpacePrepNode* sub, plSpaceTree* tr IMakeSpaceTreeRecur(sub->fChildren[1], tree, targetLevel, currLevel+1); } -#endif // Leaves first \ No newline at end of file +#endif // Leaves first