Browse Source

Merge pull request #145 from Hoikas/physx

PhysX (Contined)
Branan Purvine-Riley 13 years ago
parent
commit
deb28a85a5
  1. 19
      Sources/Plasma/PubUtilLib/plAvatar/plArmatureMod.cpp
  2. 2
      Sources/Plasma/PubUtilLib/plAvatar/plArmatureMod.h
  3. 8
      Sources/Plasma/PubUtilLib/plPhysX/plPXPhysicalControllerCore.cpp
  4. 20
      Sources/Plasma/PubUtilLib/plPhysical/plCollisionDetector.cpp
  5. 3
      Sources/Plasma/PubUtilLib/plPhysical/plCollisionDetector.h

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

@ -650,6 +650,7 @@ void plArmatureMod::IInitDefaults()
fStealthLevel = 0; fStealthLevel = 0;
fMouseFrameTurnStrength = 0.f; fMouseFrameTurnStrength = 0.f;
fSuspendInputCount = 0; fSuspendInputCount = 0;
fIsLinkedIn = false;
fMidLink = false; fMidLink = false;
fAlreadyPanicLinking = false; fAlreadyPanicLinking = false;
fReverseFBOnIdle = false; fReverseFBOnIdle = false;
@ -1375,16 +1376,21 @@ hsBool plArmatureMod::MsgReceive(plMessage* msg)
plLinkInDoneMsg *doneMsg = plLinkInDoneMsg::ConvertNoRef(msg); plLinkInDoneMsg *doneMsg = plLinkInDoneMsg::ConvertNoRef(msg);
if (doneMsg) if (doneMsg)
{ {
fIsLinkedIn = true;
IFireBehaviorNotify(plHBehavior::kBehaviorTypeLinkIn, false); IFireBehaviorNotify(plHBehavior::kBehaviorTypeLinkIn, false);
return true; return true;
} }
plAgeLoadedMsg *ageLoadMsg = plAgeLoadedMsg::ConvertNoRef(msg); plAgeLoadedMsg *ageLoadMsg = plAgeLoadedMsg::ConvertNoRef(msg);
if (ageLoadMsg && ageLoadMsg->fLoaded) if (ageLoadMsg)
{ {
// only the local player gets these if (ageLoadMsg->fLoaded)
NetworkSynch(hsTimer::GetSysSeconds(), true); {
EnablePhysics(true); // only the local player gets these
NetworkSynch(hsTimer::GetSysSeconds(), true);
EnablePhysics(true);
} else
fIsLinkedIn = false;
return true; return true;
} }
@ -2518,6 +2524,11 @@ bool plArmatureMod::IsMidLink()
return fMidLink; return fMidLink;
} }
bool plArmatureMod::IsLinkedIn()
{
return fIsLinkedIn;
}
hsBool plArmatureMod::ConsumeJump() hsBool plArmatureMod::ConsumeJump()
{ {
if (!GetInputFlag(B_CONTROL_CONSUMABLE_JUMP)) if (!GetInputFlag(B_CONTROL_CONSUMABLE_JUMP))

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

@ -318,6 +318,7 @@ public:
int GetStealthLevel() const { return fStealthLevel; } int GetStealthLevel() const { return fStealthLevel; }
bool IsOpaque(); bool IsOpaque();
bool IsLinkedIn();
bool IsMidLink(); bool IsMidLink();
hsBool ConsumeJump(); // returns true if the jump keypress was available to consume hsBool ConsumeJump(); // returns true if the jump keypress was available to consume
@ -401,6 +402,7 @@ protected:
plArmatureUpdateMsg *fUpdateMsg; plArmatureUpdateMsg *fUpdateMsg;
// Trying to be a good lad here and align all our bools and bytes... // Trying to be a good lad here and align all our bools and bytes...
bool fIsLinkedIn; // We have finished playing the LinkEffects and are properly in the age
bool fMidLink; // We're in between a LeaveAge and an EnterAge bool fMidLink; // We're in between a LeaveAge and an EnterAge
bool fAlreadyPanicLinking; // Cleared when you enter an age. Prevents spamming the server with panic link requests. bool fAlreadyPanicLinking; // Cleared when you enter an age. Prevents spamming the server with panic link requests.
bool fUnconsumedJump; // We've pressed the jump key, but haven't jumped yet bool fUnconsumedJump; // We've pressed the jump key, but haven't jumped yet

8
Sources/Plasma/PubUtilLib/plPhysX/plPXPhysicalControllerCore.cpp

@ -395,7 +395,7 @@ void plPXPhysicalControllerCore::IMatchKinematicToController()
kinPos.z = (NxReal)cPos.z; kinPos.z = (NxReal)cPos.z;
if (plSimulationMgr::fExtraProfile) if (plSimulationMgr::fExtraProfile)
SimLog("Match setting kinematic from %f,%f,%f to %f,%f,%f",prevKinPos.x,prevKinPos.y,prevKinPos.z,kinPos.x,kinPos.y,kinPos.z ); SimLog("Match setting kinematic from %f,%f,%f to %f,%f,%f",prevKinPos.x,prevKinPos.y,prevKinPos.z,kinPos.x,kinPos.y,kinPos.z );
if (fBehavingLikeAnimatedPhys && fKinematic) // if NX_BF_KINEMATIC && (avatar is on a ladder or something) if (fKinematicActor->readBodyFlag(NX_BF_KINEMATIC))
fKinematicActor->moveGlobalPosition(kinPos); fKinematicActor->moveGlobalPosition(kinPos);
else else
fKinematicActor->setGlobalPosition(kinPos); fKinematicActor->setGlobalPosition(kinPos);
@ -409,7 +409,7 @@ void plPXPhysicalControllerCore::UpdateControllerAndPhysicalRep()
{//this means we are moving the controller and then synchnig the kin {//this means we are moving the controller and then synchnig the kin
NxExtendedVec3 ControllerPos= fController->getPosition(); NxExtendedVec3 ControllerPos= fController->getPosition();
NxVec3 NewKinPos((NxReal)ControllerPos.x, (NxReal)ControllerPos.y, (NxReal)ControllerPos.z); NxVec3 NewKinPos((NxReal)ControllerPos.x, (NxReal)ControllerPos.y, (NxReal)ControllerPos.z);
if (fEnabled || fKinematic) if (fKinematicActor->readBodyFlag(NX_BF_KINEMATIC))
{ {
if (plSimulationMgr::fExtraProfile) if (plSimulationMgr::fExtraProfile)
SimLog("Moving kinematic to %f,%f,%f",NewKinPos.x, NewKinPos.y, NewKinPos.z ); SimLog("Moving kinematic to %f,%f,%f",NewKinPos.x, NewKinPos.y, NewKinPos.z );
@ -449,7 +449,7 @@ void plPXPhysicalControllerCore::MoveKinematicToController(hsPoint3& pos)
newPos.x = (NxReal)pos.fX; newPos.x = (NxReal)pos.fX;
newPos.y = (NxReal)pos.fY; newPos.y = (NxReal)pos.fY;
newPos.z = (NxReal)pos.fZ+kPhysZOffset; newPos.z = (NxReal)pos.fZ+kPhysZOffset;
if (fBehavingLikeAnimatedPhys) if (fKinematicActor->readBodyFlag(NX_BF_KINEMATIC))
{ {
if (plSimulationMgr::fExtraProfile) if (plSimulationMgr::fExtraProfile)
SimLog("Moving kinematic from %f,%f,%f to %f,%f,%f",pos.fX,pos.fY,pos.fZ+kPhysZOffset,kinPos.x,kinPos.y,kinPos.z ); SimLog("Moving kinematic from %f,%f,%f to %f,%f,%f",pos.fX,pos.fY,pos.fZ+kPhysZOffset,kinPos.x,kinPos.y,kinPos.z );
@ -491,7 +491,7 @@ void plPXPhysicalControllerCore::ISetKinematicLoc(const hsMatrix44& l2w)
// add z offset // add z offset
kPos.fZ += kPhysZOffset; kPos.fZ += kPhysZOffset;
// Update the physical position of kinematic // Update the physical position of kinematic
if (fBehavingLikeAnimatedPhys) if (fKinematicActor->readBodyFlag(NX_BF_KINEMATIC))
fKinematicActor->moveGlobalPosition(plPXConvert::Point(kPos)); fKinematicActor->moveGlobalPosition(plPXConvert::Point(kPos));
else else
fKinematicActor->setGlobalPosition(plPXConvert::Point(kPos)); fKinematicActor->setGlobalPosition(plPXConvert::Point(kPos));

20
Sources/Plasma/PubUtilLib/plPhysical/plCollisionDetector.cpp

@ -928,9 +928,7 @@ void plSubworldRegionDetector::Write(hsStream* stream, hsResMgr* mgr)
/////////////////////////////////// ///////////////////////////////////
hsBool plPanicLinkRegion::MsgReceive(plMessage* msg) hsBool plPanicLinkRegion::MsgReceive(plMessage* msg)
{ {
plCollideMsg* pCollMsg = plCollideMsg::ConvertNoRef(msg); if (plCollideMsg* pCollMsg = plCollideMsg::ConvertNoRef(msg))
if (pCollMsg)
{ {
if (plNetClientApp::GetInstance()->GetLocalPlayerKey() != pCollMsg->fOtherKey) if (plNetClientApp::GetInstance()->GetLocalPlayerKey() != pCollMsg->fOtherKey)
return true; return true;
@ -940,13 +938,17 @@ hsBool plPanicLinkRegion::MsgReceive(plMessage* msg)
plArmatureMod* avMod = IGetAvatarModifier(pCollMsg->fOtherKey); plArmatureMod* avMod = IGetAvatarModifier(pCollMsg->fOtherKey);
if (avMod) if (avMod)
{ {
hsPoint3 kinPos; if (avMod->IsLinkedIn())
if (avMod->GetController())
{ {
avMod->GetController()->GetKinematicPosition(kinPos); hsPoint3 kinPos;
DetectorLogSpecial("Avatar is panic linking. KinPos at %f,%f,%f and is %s",kinPos.fX,kinPos.fY,kinPos.fZ,avMod->GetController()->IsEnabled() ? "enabled" : "disabled"); if (avMod->GetController())
} {
avMod->PanicLink(fPlayLinkOutAnim); avMod->GetController()->GetKinematicPosition(kinPos);
DetectorLogSpecial("Avatar is panic linking. KinPos at %f,%f,%f and is %s",kinPos.fX,kinPos.fY,kinPos.fZ,avMod->GetController()->IsEnabled() ? "enabled" : "disabled");
}
avMod->PanicLink(fPlayLinkOutAnim);
} else
DetectorLogRed("PANIC LINK %s before we actually linked in!", GetKey()->GetName());
} }
} }

3
Sources/Plasma/PubUtilLib/plPhysical/plCollisionDetector.h

@ -237,8 +237,7 @@ class plPanicLinkRegion : public plCollisionDetector
public: public:
hsBool fPlayLinkOutAnim; hsBool fPlayLinkOutAnim;
plPanicLinkRegion() : fPlayLinkOutAnim(true) {;} plPanicLinkRegion() : fPlayLinkOutAnim(true) { }
~plPanicLinkRegion(){;}
virtual hsBool MsgReceive(plMessage* msg); virtual hsBool MsgReceive(plMessage* msg);

Loading…
Cancel
Save