1
0
mirror of https://foundry.openuru.org/gitblit/r/CWE-ou-minkata.git synced 2025-07-20 04:09:16 +00:00

Refactor avatar movement code

plMovementStrategy classes have been reworked and completely replace all plAvatarControllers.
While based on the old implementation, plPhysicalControllerCore has essentially been rewritten.
Remnants of long gone physical "actions" have been removed.

4 files removed -
plAVCallbackAction.h & plAVCallbackAction.cpp
plAntiGravAction.h & plAntiGravAction.cpp

This revision will not compile, requires new plPXPhysicalControllerCore implementation.
This commit is contained in:
Skoader
2012-06-24 12:51:45 +10:00
committed by Adam Johnson
parent 75793e5182
commit 769cd60617
33 changed files with 1019 additions and 2356 deletions

View File

@ -40,7 +40,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
*==LICENSE==*/
#include "plAvCallbackAction.h"
#include "plPhysicalControllerCore.h"
#include "plAvBrainCritter.h"
#include "plAvBrainHuman.h"
#include "plArmatureMod.h"
@ -125,7 +125,7 @@ protected:
///////////////////////////////////////////////////////////////////////////////
plAvBrainCritter::plAvBrainCritter(): fCallbackAction(nil), fCurMode(kIdle), fNextMode(kIdle), fFadingNextBehavior(true),
plAvBrainCritter::plAvBrainCritter(): fWalkingStrategy(nil), fCurMode(kIdle), fNextMode(kIdle), fFadingNextBehavior(true),
fAvoidingAvatars(false), fFinalGoalPos(0, 0, 0), fImmediateGoalPos(0, 0, 0), fDotGoal(0),
fAngRight(0)
{
@ -143,8 +143,8 @@ plAvBrainCritter::~plAvBrainCritter()
fBehaviors[i] = nil;
}
delete fCallbackAction;
fCallbackAction = nil;
delete fWalkingStrategy;
fWalkingStrategy = nil;
fUserBehaviors.clear();
fReceivers.clear();
@ -167,8 +167,8 @@ bool plAvBrainCritter::Apply(double time, float elapsed)
IProcessBehavior(time, elapsed); // just continue with the currently running one
// update our controller to keep us turned and moving to where we want to go
fCallbackAction->RecalcVelocity(time, time - elapsed);
fCallbackAction->SetTurnStrength(IGetTurnStrength(time));
fWalkingStrategy->SetTurnStrength(IGetTurnStrength(time));
fWalkingStrategy->RecalcVelocity(time, elapsed);
return plArmatureBrain::Apply(time, elapsed);
}
@ -188,13 +188,13 @@ void plAvBrainCritter::Activate(plArmatureModBase* avMod)
IInitBaseAnimations();
// create the controller if we haven't done so already
if (!fCallbackAction)
if (!fWalkingStrategy)
{
plSceneObject* avObj = fArmature->GetTarget(0);
plAGModifier* agMod = const_cast<plAGModifier*>(plAGModifier::ConvertNoRef(FindModifierByClass(avObj, plAGModifier::Index())));
plPhysicalControllerCore* controller = avMod->GetController();
fCallbackAction = new plWalkingController(avObj, agMod->GetApplicator(kAGPinTransform), controller);
fCallbackAction->ActivateController();
fWalkingStrategy = new plWalkingStrategy(agMod->GetApplicator(kAGPinTransform), controller);
controller->SetMovementStrategy(fWalkingStrategy);
}
// tell people that care that we are good to go
@ -224,7 +224,7 @@ void plAvBrainCritter::Resume()
// fade in the idle
fNextMode = kIdle;
fCallbackAction->Reset(false);
fWalkingStrategy->Reset(false);
plArmatureBrain::Resume();
}