Refactor Character::posPower
parent
98748d757f
commit
6534978dea
|
@ -48,6 +48,11 @@ public:
|
||||||
virtual CObject* GetPower() = 0;
|
virtual CObject* GetPower() = 0;
|
||||||
//! Sets power cell
|
//! Sets power cell
|
||||||
virtual void SetPower(CObject* power) = 0;
|
virtual void SetPower(CObject* power) = 0;
|
||||||
|
|
||||||
|
//! Returns the relative position of power cell
|
||||||
|
virtual Math::Vector GetPowerPosition() = 0;
|
||||||
|
//! Sets the relative position of power cell
|
||||||
|
virtual void SetPowerPosition(const Math::Vector& powerPosition) = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
inline float GetObjectEnergy(CObject* object)
|
inline float GetObjectEnergy(CObject* object)
|
||||||
|
|
|
@ -920,7 +920,7 @@ void CMotionVehicle::Create(Math::Vector pos, float angle, ObjectType type,
|
||||||
m_object->CreateEffectLight(20.0f, color);
|
m_object->CreateEffectLight(20.0f, color);
|
||||||
|
|
||||||
CObject* powerCell = nullptr;
|
CObject* powerCell = nullptr;
|
||||||
Math::Vector powerCellPos = m_object->GetCharacter()->posPower;
|
Math::Vector powerCellPos = m_object->GetPowerPosition();
|
||||||
float powerCellAngle = 0.0f;
|
float powerCellAngle = 0.0f;
|
||||||
if (power <= 1.0f)
|
if (power <= 1.0f)
|
||||||
{
|
{
|
||||||
|
@ -963,7 +963,7 @@ void CMotionVehicle::CreatePhysics(ObjectType type)
|
||||||
character->wheelBack = 4.0f;
|
character->wheelBack = 4.0f;
|
||||||
character->wheelLeft = 4.0f;
|
character->wheelLeft = 4.0f;
|
||||||
character->wheelRight = 4.0f;
|
character->wheelRight = 4.0f;
|
||||||
character->posPower = Math::Vector(-3.2f, 3.0f, 0.0f);
|
m_object->SetPowerPosition(Math::Vector(-3.2f, 3.0f, 0.0f));
|
||||||
|
|
||||||
m_physics->SetLinMotionX(MO_ADVSPEED, 20.0f);
|
m_physics->SetLinMotionX(MO_ADVSPEED, 20.0f);
|
||||||
m_physics->SetLinMotionX(MO_RECSPEED, 10.0f);
|
m_physics->SetLinMotionX(MO_RECSPEED, 10.0f);
|
||||||
|
@ -989,7 +989,7 @@ void CMotionVehicle::CreatePhysics(ObjectType type)
|
||||||
character->wheelBack = 3.0f;
|
character->wheelBack = 3.0f;
|
||||||
character->wheelLeft = 4.0f;
|
character->wheelLeft = 4.0f;
|
||||||
character->wheelRight = 4.0f;
|
character->wheelRight = 4.0f;
|
||||||
character->posPower = Math::Vector(-3.2f, 3.0f, 0.0f);
|
m_object->SetPowerPosition(Math::Vector(-3.2f, 3.0f, 0.0f));
|
||||||
|
|
||||||
m_physics->SetLinMotionX(MO_ADVSPEED, 20.0f);
|
m_physics->SetLinMotionX(MO_ADVSPEED, 20.0f);
|
||||||
m_physics->SetLinMotionX(MO_RECSPEED, 10.0f);
|
m_physics->SetLinMotionX(MO_RECSPEED, 10.0f);
|
||||||
|
@ -1018,7 +1018,7 @@ void CMotionVehicle::CreatePhysics(ObjectType type)
|
||||||
character->wheelBack = 4.0f;
|
character->wheelBack = 4.0f;
|
||||||
character->wheelLeft = 4.8f;
|
character->wheelLeft = 4.8f;
|
||||||
character->wheelRight = 4.8f;
|
character->wheelRight = 4.8f;
|
||||||
character->posPower = Math::Vector(-3.2f, 3.0f, 0.0f);
|
m_object->SetPowerPosition(Math::Vector(-3.2f, 3.0f, 0.0f));
|
||||||
|
|
||||||
m_physics->SetLinMotionX(MO_ADVSPEED, 15.0f);
|
m_physics->SetLinMotionX(MO_ADVSPEED, 15.0f);
|
||||||
m_physics->SetLinMotionX(MO_RECSPEED, 8.0f);
|
m_physics->SetLinMotionX(MO_RECSPEED, 8.0f);
|
||||||
|
@ -1047,7 +1047,7 @@ void CMotionVehicle::CreatePhysics(ObjectType type)
|
||||||
character->wheelBack = 4.0f;
|
character->wheelBack = 4.0f;
|
||||||
character->wheelLeft = 5.0f;
|
character->wheelLeft = 5.0f;
|
||||||
character->wheelRight = 5.0f;
|
character->wheelRight = 5.0f;
|
||||||
character->posPower = Math::Vector(-3.2f, 3.0f, 0.0f);
|
m_object->SetPowerPosition(Math::Vector(-3.2f, 3.0f, 0.0f));
|
||||||
|
|
||||||
m_physics->SetLinMotionX(MO_ADVSPEED, 15.0f);
|
m_physics->SetLinMotionX(MO_ADVSPEED, 15.0f);
|
||||||
m_physics->SetLinMotionX(MO_RECSPEED, 8.0f);
|
m_physics->SetLinMotionX(MO_RECSPEED, 8.0f);
|
||||||
|
@ -1078,7 +1078,7 @@ void CMotionVehicle::CreatePhysics(ObjectType type)
|
||||||
character->wheelBack = 4.0f;
|
character->wheelBack = 4.0f;
|
||||||
character->wheelLeft = 4.5f;
|
character->wheelLeft = 4.5f;
|
||||||
character->wheelRight = 4.5f;
|
character->wheelRight = 4.5f;
|
||||||
character->posPower = Math::Vector(-3.2f, 3.0f, 0.0f);
|
m_object->SetPowerPosition(Math::Vector(-3.2f, 3.0f, 0.0f));
|
||||||
|
|
||||||
m_physics->SetLinMotionX(MO_ADVSPEED, 50.0f);
|
m_physics->SetLinMotionX(MO_ADVSPEED, 50.0f);
|
||||||
m_physics->SetLinMotionX(MO_RECSPEED, 50.0f);
|
m_physics->SetLinMotionX(MO_RECSPEED, 50.0f);
|
||||||
|
@ -1112,7 +1112,7 @@ void CMotionVehicle::CreatePhysics(ObjectType type)
|
||||||
character->wheelBack = 5.0f;
|
character->wheelBack = 5.0f;
|
||||||
character->wheelLeft = 6.0f;
|
character->wheelLeft = 6.0f;
|
||||||
character->wheelRight = 6.0f;
|
character->wheelRight = 6.0f;
|
||||||
character->posPower = Math::Vector(-5.8f, 4.0f, 0.0f);
|
m_object->SetPowerPosition(Math::Vector(-5.8f, 4.0f, 0.0f));
|
||||||
|
|
||||||
m_physics->SetLinMotionX(MO_ADVSPEED, 10.0f);
|
m_physics->SetLinMotionX(MO_ADVSPEED, 10.0f);
|
||||||
m_physics->SetLinMotionX(MO_RECSPEED, 5.0f);
|
m_physics->SetLinMotionX(MO_RECSPEED, 5.0f);
|
||||||
|
@ -1138,7 +1138,7 @@ void CMotionVehicle::CreatePhysics(ObjectType type)
|
||||||
character->wheelBack = 4.0f;
|
character->wheelBack = 4.0f;
|
||||||
character->wheelLeft = 4.0f;
|
character->wheelLeft = 4.0f;
|
||||||
character->wheelRight = 4.0f;
|
character->wheelRight = 4.0f;
|
||||||
character->posPower = Math::Vector(-5.0f, 3.0f, 0.0f);
|
m_object->SetPowerPosition(Math::Vector(-5.0f, 3.0f, 0.0f));
|
||||||
|
|
||||||
m_physics->SetLinMotionX(MO_ADVSPEED, 15.0f);
|
m_physics->SetLinMotionX(MO_ADVSPEED, 15.0f);
|
||||||
m_physics->SetLinMotionX(MO_RECSPEED, 10.0f);
|
m_physics->SetLinMotionX(MO_RECSPEED, 10.0f);
|
||||||
|
@ -1164,7 +1164,7 @@ void CMotionVehicle::CreatePhysics(ObjectType type)
|
||||||
character->wheelBack = 4.0f;
|
character->wheelBack = 4.0f;
|
||||||
character->wheelLeft = 4.0f;
|
character->wheelLeft = 4.0f;
|
||||||
character->wheelRight = 4.0f;
|
character->wheelRight = 4.0f;
|
||||||
character->posPower = Math::Vector(-5.0f, 3.0f, 0.0f);
|
m_object->SetPowerPosition(Math::Vector(-5.0f, 3.0f, 0.0f));
|
||||||
|
|
||||||
m_physics->SetLinMotionX(MO_ADVSPEED, 15.0f);
|
m_physics->SetLinMotionX(MO_ADVSPEED, 15.0f);
|
||||||
m_physics->SetLinMotionX(MO_RECSPEED, 10.0f);
|
m_physics->SetLinMotionX(MO_RECSPEED, 10.0f);
|
||||||
|
|
|
@ -1551,6 +1551,17 @@ CObject* COldObject::GetPower()
|
||||||
return m_power;
|
return m_power;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void COldObject::SetPowerPosition(const Math::Vector& powerPosition)
|
||||||
|
{
|
||||||
|
m_powerPosition = powerPosition;
|
||||||
|
}
|
||||||
|
|
||||||
|
Math::Vector COldObject::GetPowerPosition()
|
||||||
|
{
|
||||||
|
return m_powerPosition;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// Management of the object transport.
|
// Management of the object transport.
|
||||||
|
|
||||||
void COldObject::SetCargo(CObject* cargo)
|
void COldObject::SetCargo(CObject* cargo)
|
||||||
|
|
|
@ -175,6 +175,8 @@ public:
|
||||||
|
|
||||||
void SetPower(CObject* power) override;
|
void SetPower(CObject* power) override;
|
||||||
CObject* GetPower() override;
|
CObject* GetPower() override;
|
||||||
|
Math::Vector GetPowerPosition();
|
||||||
|
void SetPowerPosition(const Math::Vector& powerPosition);
|
||||||
void SetCargo(CObject* cargo) override;
|
void SetCargo(CObject* cargo) override;
|
||||||
CObject* GetCargo() override;
|
CObject* GetCargo() override;
|
||||||
void SetTransporter(CObject* transporter) override;
|
void SetTransporter(CObject* transporter) override;
|
||||||
|
@ -302,8 +304,6 @@ protected:
|
||||||
void TransformCrashSphere(Math::Sphere &crashSphere) override;
|
void TransformCrashSphere(Math::Sphere &crashSphere) override;
|
||||||
void TransformCameraCollisionSphere(Math::Sphere& collisionSphere) override;
|
void TransformCameraCollisionSphere(Math::Sphere& collisionSphere) override;
|
||||||
|
|
||||||
Error EndedTask();
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
Gfx::CEngine* m_engine;
|
Gfx::CEngine* m_engine;
|
||||||
Gfx::CLightManager* m_lightMan;
|
Gfx::CLightManager* m_lightMan;
|
||||||
|
@ -329,6 +329,7 @@ protected:
|
||||||
Math::Vector m_cirVibration; // circular vibration
|
Math::Vector m_cirVibration; // circular vibration
|
||||||
Math::Vector m_tilt; // tilt
|
Math::Vector m_tilt; // tilt
|
||||||
CObject* m_power; // battery used by the vehicle
|
CObject* m_power; // battery used by the vehicle
|
||||||
|
Math::Vector m_powerPosition;
|
||||||
CObject* m_cargo; // object transported
|
CObject* m_cargo; // object transported
|
||||||
CObject* m_transporter; // object with the latter
|
CObject* m_transporter; // object with the latter
|
||||||
int m_transporterLink; // part
|
int m_transporterLink; // part
|
||||||
|
|
|
@ -24,20 +24,13 @@
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "graphics/engine/camera.h"
|
#include "math/matrix.h"
|
||||||
#include "graphics/engine/engine.h"
|
#include "math/vector.h"
|
||||||
|
|
||||||
#include "object/object_type.h"
|
#include "object/object_type.h"
|
||||||
|
|
||||||
#include "sound/sound_type.h"
|
|
||||||
|
|
||||||
#include <string>
|
|
||||||
|
|
||||||
class CPhysics;
|
|
||||||
class CMotion;
|
|
||||||
class CAuto;
|
class CAuto;
|
||||||
class CBotVar;
|
|
||||||
class CScript;
|
|
||||||
|
|
||||||
|
|
||||||
struct Character
|
struct Character
|
||||||
|
@ -47,7 +40,6 @@ struct Character
|
||||||
float wheelLeft = 0.0f; // position Z of the left wheels
|
float wheelLeft = 0.0f; // position Z of the left wheels
|
||||||
float wheelRight = 0.0f; // position Z of the right wheels
|
float wheelRight = 0.0f; // position Z of the right wheels
|
||||||
float height = 0.0f; // normal height on top of ground
|
float height = 0.0f; // normal height on top of ground
|
||||||
Math::Vector posPower; // position of the battery
|
|
||||||
};
|
};
|
||||||
|
|
||||||
class COldObjectInterface
|
class COldObjectInterface
|
||||||
|
|
|
@ -297,7 +297,7 @@ std::unique_ptr<CBaseBuilding> CBaseBuilding::Create(
|
||||||
obj->AddCrashSphere(CrashSphere(Math::Vector(0.0f, 14.0f, 0.0f), 7.0f, SOUND_BOUMm, 0.45f));
|
obj->AddCrashSphere(CrashSphere(Math::Vector(0.0f, 14.0f, 0.0f), 7.0f, SOUND_BOUMm, 0.45f));
|
||||||
obj->SetCameraCollisionSphere(Math::Sphere(Math::Vector(0.0f, 8.0f, 0.0f), 12.0f));
|
obj->SetCameraCollisionSphere(Math::Sphere(Math::Vector(0.0f, 8.0f, 0.0f), 12.0f));
|
||||||
|
|
||||||
obj->GetCharacter()->posPower = Math::Vector(7.5f, 3.0f, 0.0f);
|
obj->SetPowerPosition(Math::Vector(7.5f, 3.0f, 0.0f));
|
||||||
|
|
||||||
obj->CreateShadowCircle(12.0f, 1.0f);
|
obj->CreateShadowCircle(12.0f, 1.0f);
|
||||||
}
|
}
|
||||||
|
@ -350,7 +350,7 @@ std::unique_ptr<CBaseBuilding> CBaseBuilding::Create(
|
||||||
obj->AddCrashSphere(CrashSphere(Math::Vector( 0.0f, 1.0f, 0.0f), 1.5f, SOUND_BOUMm, 0.45f));
|
obj->AddCrashSphere(CrashSphere(Math::Vector( 0.0f, 1.0f, 0.0f), 1.5f, SOUND_BOUMm, 0.45f));
|
||||||
obj->SetCameraCollisionSphere(Math::Sphere(Math::Vector(-7.0f, 5.0f, 0.0f), 5.0f));
|
obj->SetCameraCollisionSphere(Math::Sphere(Math::Vector(-7.0f, 5.0f, 0.0f), 5.0f));
|
||||||
|
|
||||||
obj->GetCharacter()->posPower = Math::Vector(0.0f, 3.0f, 0.0f);
|
obj->SetPowerPosition(Math::Vector(0.0f, 3.0f, 0.0f));
|
||||||
obj->SetEnergyLevel(params.power); // initializes the energy level
|
obj->SetEnergyLevel(params.power); // initializes the energy level
|
||||||
|
|
||||||
obj->CreateShadowCircle(6.0f, 0.5f);
|
obj->CreateShadowCircle(6.0f, 0.5f);
|
||||||
|
@ -411,7 +411,7 @@ std::unique_ptr<CBaseBuilding> CBaseBuilding::Create(
|
||||||
obj->AddCrashSphere(CrashSphere(Math::Vector(-12.0f, 3.0f, -3.0f), 4.0f, SOUND_BOUMm, 0.45f));
|
obj->AddCrashSphere(CrashSphere(Math::Vector(-12.0f, 3.0f, -3.0f), 4.0f, SOUND_BOUMm, 0.45f));
|
||||||
obj->SetCameraCollisionSphere(Math::Sphere(Math::Vector(-10.0f, 5.0f, 0.0f), 7.0f));
|
obj->SetCameraCollisionSphere(Math::Sphere(Math::Vector(-10.0f, 5.0f, 0.0f), 7.0f));
|
||||||
|
|
||||||
obj->GetCharacter()->posPower = Math::Vector(0.0f, 3.0f, 0.0f);
|
obj->SetPowerPosition(Math::Vector(0.0f, 3.0f, 0.0f));
|
||||||
|
|
||||||
obj->CreateShadowCircle(7.0f, 0.5f);
|
obj->CreateShadowCircle(7.0f, 0.5f);
|
||||||
}
|
}
|
||||||
|
@ -606,7 +606,7 @@ std::unique_ptr<CBaseBuilding> CBaseBuilding::Create(
|
||||||
obj->AddCrashSphere(CrashSphere(Math::Vector(0.0f, 24.0f, 0.0f), 5.0f, SOUND_BOUMm, 0.45f));
|
obj->AddCrashSphere(CrashSphere(Math::Vector(0.0f, 24.0f, 0.0f), 5.0f, SOUND_BOUMm, 0.45f));
|
||||||
obj->SetCameraCollisionSphere(Math::Sphere(Math::Vector(0.0f, 5.0f, 0.0f), 7.0f));
|
obj->SetCameraCollisionSphere(Math::Sphere(Math::Vector(0.0f, 5.0f, 0.0f), 7.0f));
|
||||||
|
|
||||||
obj->GetCharacter()->posPower = Math::Vector(5.0f, 3.0f, 0.0f);
|
obj->SetPowerPosition(Math::Vector(5.0f, 3.0f, 0.0f));
|
||||||
|
|
||||||
obj->CreateShadowCircle(6.0f, 1.0f);
|
obj->CreateShadowCircle(6.0f, 1.0f);
|
||||||
}
|
}
|
||||||
|
@ -631,7 +631,7 @@ std::unique_ptr<CBaseBuilding> CBaseBuilding::Create(
|
||||||
obj->AddCrashSphere(CrashSphere(Math::Vector(22.0f, 1.0f, 0.0f), 1.5f, SOUND_BOUMm, 0.45f));
|
obj->AddCrashSphere(CrashSphere(Math::Vector(22.0f, 1.0f, 0.0f), 1.5f, SOUND_BOUMm, 0.45f));
|
||||||
obj->SetCameraCollisionSphere(Math::Sphere(Math::Vector(0.0f, 17.0f, 0.0f), 26.0f));
|
obj->SetCameraCollisionSphere(Math::Sphere(Math::Vector(0.0f, 17.0f, 0.0f), 26.0f));
|
||||||
|
|
||||||
obj->GetCharacter()->posPower = Math::Vector(22.0f, 3.0f, 0.0f);
|
obj->SetPowerPosition(Math::Vector(22.0f, 3.0f, 0.0f));
|
||||||
|
|
||||||
obj->CreateShadowCircle(21.0f, 1.0f);
|
obj->CreateShadowCircle(21.0f, 1.0f);
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,6 +21,7 @@
|
||||||
|
|
||||||
#include "common/make_unique.h"
|
#include "common/make_unique.h"
|
||||||
|
|
||||||
|
#include "graphics/engine/engine.h"
|
||||||
#include "graphics/engine/terrain.h"
|
#include "graphics/engine/terrain.h"
|
||||||
|
|
||||||
#include "graphics/model/model.h"
|
#include "graphics/model/model.h"
|
||||||
|
|
|
@ -21,6 +21,7 @@
|
||||||
|
|
||||||
#include "object/object.h"
|
#include "object/object.h"
|
||||||
|
|
||||||
|
#include <memory>
|
||||||
#include <unordered_map>
|
#include <unordered_map>
|
||||||
|
|
||||||
namespace Gfx
|
namespace Gfx
|
||||||
|
@ -28,6 +29,7 @@ namespace Gfx
|
||||||
class CModelManager;
|
class CModelManager;
|
||||||
class CEngine;
|
class CEngine;
|
||||||
class CModel;
|
class CModel;
|
||||||
|
class CTerrain;
|
||||||
} // namespace Gfx
|
} // namespace Gfx
|
||||||
|
|
||||||
class CStaticObject;
|
class CStaticObject;
|
||||||
|
|
|
@ -1023,7 +1023,6 @@ CObject* CTaskGoto::SearchTarget(Math::Vector pos, float margin)
|
||||||
bool CTaskGoto::AdjustTarget(CObject* pObj, Math::Vector &pos, float &distance)
|
bool CTaskGoto::AdjustTarget(CObject* pObj, Math::Vector &pos, float &distance)
|
||||||
{
|
{
|
||||||
ObjectType type;
|
ObjectType type;
|
||||||
Character* character;
|
|
||||||
Math::Matrix* mat;
|
Math::Matrix* mat;
|
||||||
Math::Vector goal;
|
Math::Vector goal;
|
||||||
float dist, suppl;
|
float dist, suppl;
|
||||||
|
@ -1090,8 +1089,8 @@ bool CTaskGoto::AdjustTarget(CObject* pObj, Math::Vector &pos, float &distance)
|
||||||
type == OBJECT_MOBILEit ||
|
type == OBJECT_MOBILEit ||
|
||||||
type == OBJECT_MOBILEdr )
|
type == OBJECT_MOBILEdr )
|
||||||
{
|
{
|
||||||
character = pObj->GetCharacter();
|
assert(pObj->Implements(ObjectInterfaceType::Powered));
|
||||||
pos = character->posPower;
|
pos = dynamic_cast<CPoweredObject*>(pObj)->GetPowerPosition();
|
||||||
pos.x -= TAKE_DIST+TAKE_DIST_OTHER+distance;
|
pos.x -= TAKE_DIST+TAKE_DIST_OTHER+distance;
|
||||||
mat = pObj->GetWorldMatrix(0);
|
mat = pObj->GetWorldMatrix(0);
|
||||||
pos = Transform(*mat, pos);
|
pos = Transform(*mat, pos);
|
||||||
|
|
|
@ -939,8 +939,7 @@ CObject* CTaskManip::SearchOtherObject(bool bAdvance, Math::Vector &pos,
|
||||||
}
|
}
|
||||||
|
|
||||||
mat = pObj->GetWorldMatrix(0);
|
mat = pObj->GetWorldMatrix(0);
|
||||||
character = pObj->GetCharacter();
|
Math::Vector oPos = Transform(*mat, dynamic_cast<CPoweredObject*>(pObj)->GetPowerPosition());
|
||||||
Math::Vector oPos = Transform(*mat, character->posPower);
|
|
||||||
|
|
||||||
oAngle = pObj->GetRotationY();
|
oAngle = pObj->GetRotationY();
|
||||||
if ( type == OBJECT_TOWER ||
|
if ( type == OBJECT_TOWER ||
|
||||||
|
@ -975,8 +974,8 @@ CObject* CTaskManip::SearchOtherObject(bool bAdvance, Math::Vector &pos,
|
||||||
angle = Math::RotateAngle(oPos.x-iPos.x, iPos.z-oPos.z); // CW !
|
angle = Math::RotateAngle(oPos.x-iPos.x, iPos.z-oPos.z); // CW !
|
||||||
if ( Math::TestAngle(angle, iAngle-aLimit, iAngle+aLimit) )
|
if ( Math::TestAngle(angle, iAngle-aLimit, iAngle+aLimit) )
|
||||||
{
|
{
|
||||||
character = pObj->GetCharacter();
|
Math::Vector powerPos = dynamic_cast<CPoweredObject*>(pObj)->GetPowerPosition();
|
||||||
height = character->posPower.y;
|
height = powerPos.y;
|
||||||
pos = oPos;
|
pos = oPos;
|
||||||
return pObj;
|
return pObj;
|
||||||
}
|
}
|
||||||
|
@ -1204,8 +1203,7 @@ bool CTaskManip::TransporterDeposeObject()
|
||||||
dynamic_cast<CTransportableObject*>(cargo)->SetTransporter(m_object);
|
dynamic_cast<CTransportableObject*>(cargo)->SetTransporter(m_object);
|
||||||
dynamic_cast<CTransportableObject*>(cargo)->SetTransporterPart(0); // carried by the base
|
dynamic_cast<CTransportableObject*>(cargo)->SetTransporterPart(0); // carried by the base
|
||||||
|
|
||||||
Character* character = m_object->GetCharacter();
|
cargo->SetPosition(m_object->GetPowerPosition());
|
||||||
cargo->SetPosition(character->posPower);
|
|
||||||
cargo->SetRotationY(0.0f);
|
cargo->SetRotationY(0.0f);
|
||||||
cargo->SetRotationX(0.0f);
|
cargo->SetRotationX(0.0f);
|
||||||
cargo->SetRotationZ(0.0f);
|
cargo->SetRotationZ(0.0f);
|
||||||
|
@ -1235,8 +1233,7 @@ bool CTaskManip::TransporterDeposeObject()
|
||||||
dynamic_cast<CPoweredObject*>(other)->SetPower(cargo);
|
dynamic_cast<CPoweredObject*>(other)->SetPower(cargo);
|
||||||
dynamic_cast<CTransportableObject*>(cargo)->SetTransporter(other);
|
dynamic_cast<CTransportableObject*>(cargo)->SetTransporter(other);
|
||||||
|
|
||||||
Character* character = other->GetCharacter();
|
cargo->SetPosition(dynamic_cast<CPoweredObject*>(other)->GetPowerPosition());
|
||||||
cargo->SetPosition(character->posPower);
|
|
||||||
cargo->SetRotationY(0.0f);
|
cargo->SetRotationY(0.0f);
|
||||||
cargo->SetRotationX(0.0f);
|
cargo->SetRotationX(0.0f);
|
||||||
cargo->SetRotationZ(0.0f);
|
cargo->SetRotationZ(0.0f);
|
||||||
|
|
|
@ -421,8 +421,7 @@ CObject* CTaskTake::SearchFriendObject(float &angle,
|
||||||
}
|
}
|
||||||
|
|
||||||
Math::Matrix* mat = pObj->GetWorldMatrix(0);
|
Math::Matrix* mat = pObj->GetWorldMatrix(0);
|
||||||
Character* character = pObj->GetCharacter();
|
Math::Vector oPos = Math::Transform(*mat, dynamic_cast<CPoweredObject*>(pObj)->GetPowerPosition());
|
||||||
Math::Vector oPos = Transform(*mat, character->posPower);
|
|
||||||
|
|
||||||
float distance = fabs(Math::Distance(oPos, iPos) - (iRad+1.0f));
|
float distance = fabs(Math::Distance(oPos, iPos) - (iRad+1.0f));
|
||||||
if ( distance <= dLimit )
|
if ( distance <= dLimit )
|
||||||
|
@ -430,8 +429,8 @@ CObject* CTaskTake::SearchFriendObject(float &angle,
|
||||||
angle = Math::RotateAngle(oPos.x-iPos.x, iPos.z-oPos.z); // CW !
|
angle = Math::RotateAngle(oPos.x-iPos.x, iPos.z-oPos.z); // CW !
|
||||||
if ( Math::TestAngle(angle, iAngle-aLimit, iAngle+aLimit) )
|
if ( Math::TestAngle(angle, iAngle-aLimit, iAngle+aLimit) )
|
||||||
{
|
{
|
||||||
character = pObj->GetCharacter();
|
Math::Vector powerPos = dynamic_cast<CPoweredObject*>(pObj)->GetPowerPosition();
|
||||||
m_height = character->posPower.y;
|
m_height = powerPos.y;
|
||||||
return pObj;
|
return pObj;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -538,8 +537,7 @@ bool CTaskTake::TransporterDeposeObject()
|
||||||
dynamic_cast<CPoweredObject*>(other)->SetPower(cargo);
|
dynamic_cast<CPoweredObject*>(other)->SetPower(cargo);
|
||||||
dynamic_cast<CTransportableObject*>(cargo)->SetTransporter(other);
|
dynamic_cast<CTransportableObject*>(cargo)->SetTransporter(other);
|
||||||
|
|
||||||
Character* character = other->GetCharacter();
|
cargo->SetPosition(dynamic_cast<CPoweredObject*>(other)->GetPowerPosition());
|
||||||
cargo->SetPosition(character->posPower);
|
|
||||||
cargo->SetRotationY(0.0f);
|
cargo->SetRotationY(0.0f);
|
||||||
cargo->SetRotationX(0.0f);
|
cargo->SetRotationX(0.0f);
|
||||||
cargo->SetRotationZ(0.0f);
|
cargo->SetRotationZ(0.0f);
|
||||||
|
|
|
@ -2978,7 +2978,7 @@ void CPhysics::PowerParticle(float factor, bool bBreak)
|
||||||
mat = m_object->GetWorldMatrix(0);
|
mat = m_object->GetWorldMatrix(0);
|
||||||
character = m_object->GetCharacter();
|
character = m_object->GetCharacter();
|
||||||
|
|
||||||
pos = character->posPower;
|
pos = m_object->GetPowerPosition();
|
||||||
pos.x -= 0.3f;
|
pos.x -= 0.3f;
|
||||||
pos.y += 1.0f; // battery center position
|
pos.y += 1.0f; // battery center position
|
||||||
pos = Transform(*mat, pos);
|
pos = Transform(*mat, pos);
|
||||||
|
|
Loading…
Reference in New Issue