Browse Source

Fix plAvatar.

Darryl Pogue 13 years ago
parent
commit
745378f9be
  1. 10
      Sources/Plasma/PubUtilLib/plAvatar/plArmatureMod.cpp
  2. 2
      Sources/Plasma/PubUtilLib/plAvatar/plAvBehaviors.cpp
  3. 4
      Sources/Plasma/PubUtilLib/plAvatar/plAvBrainCritter.cpp
  4. 2
      Sources/Plasma/PubUtilLib/plAvatar/plAvBrainSwim.cpp
  5. 8
      Sources/Plasma/PubUtilLib/plAvatar/plAvCallbackAction.cpp
  6. 2
      Sources/Plasma/PubUtilLib/plAvatar/plAvLadderModifier.h
  7. 3
      Sources/Plasma/PubUtilLib/plAvatar/plAvTaskSeek.cpp
  8. 2
      Sources/Plasma/PubUtilLib/plAvatar/plAvatarClothing.cpp
  9. 2
      Sources/Plasma/PubUtilLib/plAvatar/plAvatarMgr.cpp
  10. 2
      Sources/Plasma/PubUtilLib/plAvatar/plClothingSDLModifier.h
  11. 4
      Sources/Plasma/PubUtilLib/plAvatar/plPhysicalControllerCore.cpp
  12. 2
      Sources/Plasma/PubUtilLib/plAvatar/plPointChannel.h
  13. 4
      Sources/Plasma/PubUtilLib/plAvatar/plSittingModifier.h
  14. 6
      Sources/Plasma/PubUtilLib/plAvatar/plSwimRegion.cpp

10
Sources/Plasma/PubUtilLib/plAvatar/plArmatureMod.cpp

@ -438,9 +438,9 @@ void plArmatureModBase::AdjustLOD()
hsPoint3 delta = ourPos - camPos; hsPoint3 delta = ourPos - camPos;
float distanceSquared = delta.MagnitudeSquared(); float distanceSquared = delta.MagnitudeSquared();
if (distanceSquared < fLODDistance * fLODDistance) if (distanceSquared < fLODDistance * fLODDistance)
SetLOD(__max(0, fMinLOD)); SetLOD(max(0, fMinLOD));
else if (distanceSquared < fLODDistance * fLODDistance * 4.0) else if (distanceSquared < fLODDistance * fLODDistance * 4.0)
SetLOD(__max(1, fMinLOD)); SetLOD(max(1, fMinLOD));
else else
SetLOD(2); SetLOD(2);
} }
@ -1102,7 +1102,7 @@ hsBool plArmatureMod::MsgReceive(plMessage* msg)
plCorrectionMsg *corMsg = plCorrectionMsg::ConvertNoRef(msg); plCorrectionMsg *corMsg = plCorrectionMsg::ConvertNoRef(msg);
if (corMsg) if (corMsg)
{ {
hsMatrix44 &correction = corMsg->fWorldToLocal * GetTarget(0)->GetLocalToWorld(); hsMatrix44 correction = corMsg->fWorldToLocal * GetTarget(0)->GetLocalToWorld();
if (fBoneRootAnimator) if (fBoneRootAnimator)
fBoneRootAnimator->SetCorrection(correction); fBoneRootAnimator->SetCorrection(correction);
} }
@ -2678,14 +2678,14 @@ void plArmatureMod::DumpToDebugDisplay(int &x, int &y, int lineHeight, char *str
hsMatrix44 l2w = SO->GetLocalToWorld(); hsMatrix44 l2w = SO->GetLocalToWorld();
hsPoint3 worldPos = l2w.GetTranslate(); hsPoint3 worldPos = l2w.GetTranslate();
char *opaque = IsOpaque() ? "yes" : "no"; const char *opaque = IsOpaque() ? "yes" : "no";
sprintf(strBuf, "position(world): %.2f, %.2f, %.2f Opaque: %3s", sprintf(strBuf, "position(world): %.2f, %.2f, %.2f Opaque: %3s",
worldPos.fX, worldPos.fY, worldPos.fZ, opaque); worldPos.fX, worldPos.fY, worldPos.fZ, opaque);
debugTxt.DrawString(x, y, strBuf); debugTxt.DrawString(x, y, strBuf);
y += lineHeight; y += lineHeight;
hsPoint3 kPos; hsPoint3 kPos;
char *kinematic = "n.a."; const char *kinematic = "n.a.";
const char* frozen = "n.a."; const char* frozen = "n.a.";
if (fController) if (fController)
{ {

2
Sources/Plasma/PubUtilLib/plAvatar/plAvBehaviors.cpp

@ -104,7 +104,7 @@ void plArmatureBehavior::DumpDebug(int &x, int &y, int lineHeight, char *strBuf,
float strength = GetStrength(); float strength = GetStrength();
const char *onOff = strength > 0 ? "on" : "off"; const char *onOff = strength > 0 ? "on" : "off";
char blendBar[11] = "||||||||||"; char blendBar[11] = "||||||||||";
int bars = (int)__min(10 * strength, 10); int bars = (int)min(10 * strength, 10);
blendBar[bars] = '\0'; blendBar[bars] = '\0';
if (fAnim) if (fAnim)

4
Sources/Plasma/PubUtilLib/plAvatar/plAvBrainCritter.cpp

@ -330,8 +330,8 @@ void plAvBrainCritter::SightCone(float coneRad)
fSightConeAngle = coneRad; fSightConeAngle = coneRad;
// calculate the minimum dot product for the cone of sight (angle/2 vector dotted with straight ahead) // calculate the minimum dot product for the cone of sight (angle/2 vector dotted with straight ahead)
hsVector3 straightVector(1, 0, 0), viewVector(1, 0, 0); hsVector3 straightVector(1, 0, 0), viewVector(1, 0, 0), up(0, 1, 0);
hsQuat rotation(fSightConeAngle/2, &hsVector3(0, 1, 0)); hsQuat rotation(fSightConeAngle/2, &up);
viewVector = hsVector3(rotation.Rotate(&viewVector)); viewVector = hsVector3(rotation.Rotate(&viewVector));
viewVector.Normalize(); viewVector.Normalize();
fSightConeDotMin = straightVector * viewVector; fSightConeDotMin = straightVector * viewVector;

2
Sources/Plasma/PubUtilLib/plAvatar/plAvBrainSwim.cpp

@ -183,7 +183,7 @@ public:
// hsAssert(0, "fixme physx"); // hsAssert(0, "fixme physx");
float oldSpeed = fabs(fSwimBrain->fCallbackAction->GetTurnStrength()); float oldSpeed = fabs(fSwimBrain->fCallbackAction->GetTurnStrength());
float thisInc = elapsed * incPerSec; float thisInc = elapsed * incPerSec;
float newSpeed = __min(oldSpeed + thisInc, maxTurnSpeed); float newSpeed = min(oldSpeed + thisInc, maxTurnSpeed);
fSwimBrain->fCallbackAction->SetTurnStrength(newSpeed * fAvMod->GetKeyTurnStrength() + fAvMod->GetAnalogTurnStrength()); fSwimBrain->fCallbackAction->SetTurnStrength(newSpeed * fAvMod->GetKeyTurnStrength() + fAvMod->GetAnalogTurnStrength());
// the turn is actually applied during PhysicsUpdate // the turn is actually applied during PhysicsUpdate
} }

8
Sources/Plasma/PubUtilLib/plAvatar/plAvCallbackAction.cpp

@ -48,9 +48,9 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
#include "plPhysicalControllerCore.h" #include "plPhysicalControllerCore.h"
// Generic geom utils. // Generic geom utils.
hsBool LinearVelocity(hsVector3 &outputV, float elapsed, hsMatrix44 &prevMat, hsMatrix44 &curMat); static hsBool LinearVelocity(hsVector3 &outputV, float elapsed, hsMatrix44 &prevMat, hsMatrix44 &curMat);
void AngularVelocity(float &outputV, float elapsed, hsMatrix44 &prevMat, hsMatrix44 &curMat); static void AngularVelocity(float &outputV, float elapsed, hsMatrix44 &prevMat, hsMatrix44 &curMat);
float AngleRad2d (float x1, float y1, float x3, float y3); static float AngleRad2d (float x1, float y1, float x3, float y3);
inline hsVector3 GetYAxis(hsMatrix44 &mat) inline hsVector3 GetYAxis(hsMatrix44 &mat)
{ {
return hsVector3(mat.fMap[1][0], mat.fMap[1][1], mat.fMap[1][2]); return hsVector3(mat.fMap[1][0], mat.fMap[1][1], mat.fMap[1][2]);
@ -195,7 +195,7 @@ bool plWalkingController::EnableControlledFlight(bool status)
fWaitingForGround = true; fWaitingForGround = true;
} }
else else
fControlledFlight = __max(--fControlledFlight, 0); fControlledFlight = max(--fControlledFlight, 0);
return status; return status;
} }

2
Sources/Plasma/PubUtilLib/plAvatar/plAvLadderModifier.h

@ -100,4 +100,4 @@ protected:
// Don't try to trigger during this time. // Don't try to trigger during this time.
}; };
#endif plAvLadderMod_INC #endif //plAvLadderMod_INC

3
Sources/Plasma/PubUtilLib/plAvatar/plAvTaskSeek.cpp

@ -314,7 +314,8 @@ void plAvTaskSeek::LeaveAge(plArmatureMod *avatar)
hsBool plAvTaskSeek::IAnalyze(plArmatureMod *avatar) hsBool plAvTaskSeek::IAnalyze(plArmatureMod *avatar)
{ {
avatar->GetPositionAndRotationSim(&fPosition, &fRotation); avatar->GetPositionAndRotationSim(&fPosition, &fRotation);
fGoalVec.Set(&(hsScalarTriple)(fSeekPos - fPosition)); hsScalarTriple tmp(fSeekPos - fPosition);
fGoalVec.Set(&tmp);
hsVector3 normalizedGoalVec(fGoalVec); hsVector3 normalizedGoalVec(fGoalVec);
normalizedGoalVec.Normalize(); normalizedGoalVec.Normalize();

2
Sources/Plasma/PubUtilLib/plAvatar/plAvatarClothing.cpp

@ -43,7 +43,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
#include "hsTemplates.h" #include "hsTemplates.h"
#include "hsStream.h" #include "hsStream.h"
#include "hsResMgr.h" #include "hsResMgr.h"
#include "plGDispatch.h" #include "plgDispatch.h"
#include "pnKeyedObject/plKey.h" #include "pnKeyedObject/plKey.h"
#include "pnKeyedObject/plFixedKey.h" #include "pnKeyedObject/plFixedKey.h"
#include "pnSceneObject/plSceneObject.h" #include "pnSceneObject/plSceneObject.h"

2
Sources/Plasma/PubUtilLib/plAvatar/plAvatarMgr.cpp

@ -636,7 +636,7 @@ void plAvatarMgr::RemoveOneShot(plOneShotMod *oneshot)
if(oneshot == thisOneshot) if(oneshot == thisOneshot)
{ {
i = fOneShots.erase(i); fOneShots.erase(i);
// destroy our copy of the target name // destroy our copy of the target name
delete[] name; delete[] name;
} else { } else {

2
Sources/Plasma/PubUtilLib/plAvatar/plClothingSDLModifier.h

@ -99,7 +99,7 @@ public:
static void HandleSingleSDR(const plStateDataRecord *sdr, plClothingOutfit *clothing = nil, plClosetItem *closetItem = nil); static void HandleSingleSDR(const plStateDataRecord *sdr, plClothingOutfit *clothing = nil, plClosetItem *closetItem = nil);
static void PutSingleItemIntoSDR(plClosetItem *item, plStateDataRecord *sdr); static void PutSingleItemIntoSDR(plClosetItem *item, plStateDataRecord *sdr);
static const plClothingSDLModifier *plClothingSDLModifier::FindClothingSDLModifier(const plSceneObject *obj); static const plClothingSDLModifier *FindClothingSDLModifier(const plSceneObject *obj);
}; };
#endif // plClothingSDLModifier_inc #endif // plClothingSDLModifier_inc

4
Sources/Plasma/PubUtilLib/plAvatar/plPhysicalControllerCore.cpp

@ -48,8 +48,8 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
#include "plArmatureMod.h" // for LOS enum type #include "plArmatureMod.h" // for LOS enum type
#include "plMatrixChannel.h" #include "plMatrixChannel.h"
#include "hsTimer.h" #include "hsTimer.h"
#include "plPhysx/plSimulationMgr.h" #include "plPhysX/plSimulationMgr.h"
#include "plPhysx/plPXPhysical.h" #include "plPhysX/plPXPhysical.h"
#include "pnMessage/plSetNetGroupIDMsg.h" #include "pnMessage/plSetNetGroupIDMsg.h"
#define kSWIMRADIUS 1.1f #define kSWIMRADIUS 1.1f
#define kSWIMHEIGHT 2.8f #define kSWIMHEIGHT 2.8f

2
Sources/Plasma/PubUtilLib/plAvatar/plPointChannel.h

@ -158,7 +158,7 @@ public:
plPointBlend(plPointChannel *channelA, plPointChannel *channelB, plScalarChannel *channelBias); plPointBlend(plPointChannel *channelA, plPointChannel *channelB, plScalarChannel *channelBias);
virtual ~plPointBlend(); virtual ~plPointBlend();
plAGChannel * plPointBlend::Remove(plAGChannel *srceToRemove); plAGChannel * Remove(plAGChannel *srceToRemove);
const plPointChannel * GetPointChannelA() const { return fPointA; } const plPointChannel * GetPointChannelA() const { return fPointA; }
void SetPointChannelA(plPointChannel *the_PointA) { fPointA = the_PointA; } void SetPointChannelA(plPointChannel *the_PointA) { fPointA = the_PointA; }

4
Sources/Plasma/PubUtilLib/plAvatar/plSittingModifier.h

@ -49,7 +49,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
///////////////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////////
#include "pnModifier/plSingleModifier.h" // base class #include "pnModifier/plSingleModifier.h" // base class
#include "pnKeyedobject/plKey.h" // for the notification keys #include "pnKeyedObject/plKey.h" // for the notification keys
#include "hsTemplates.h" // for the array they're kept in #include "hsTemplates.h" // for the array they're kept in
///////////////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////////
@ -125,4 +125,4 @@ protected:
#endif plSittingModifier_inc #endif //plSittingModifier_inc

6
Sources/Plasma/PubUtilLib/plAvatar/plSwimRegion.cpp

@ -136,7 +136,8 @@ void plSwimCircularCurrentRegion::GetCurrent(plPhysicalControllerCore *physical,
} }
hsPoint3 center, pos; hsPoint3 center, pos;
center.Set(&fCurrentSO->GetLocalToWorld().GetTranslate()); hsScalarTriple xlate = fCurrentSO->GetLocalToWorld().GetTranslate();
center.Set(&xlate);
plKey worldKey = physical->GetSubworld(); plKey worldKey = physical->GetSubworld();
if (worldKey) if (worldKey)
@ -254,7 +255,8 @@ void plSwimStraightCurrentRegion::GetCurrent(plPhysicalControllerCore *physical,
hsPoint3 center, pos; hsPoint3 center, pos;
hsVector3 current = fCurrentSO->GetLocalToWorld() * hsVector3(0.f, 1.f, 0.f); hsVector3 current = fCurrentSO->GetLocalToWorld() * hsVector3(0.f, 1.f, 0.f);
center.Set(&fCurrentSO->GetLocalToWorld().GetTranslate()); hsScalarTriple xlate = fCurrentSO->GetLocalToWorld().GetTranslate();
center.Set(&xlate);
physical->GetPositionSim(pos); physical->GetPositionSim(pos);
plKey worldKey = physical->GetSubworld(); plKey worldKey = physical->GetSubworld();

Loading…
Cancel
Save