[object/motion] Folder compiles

dev-ui
Michał Konopacki 2012-09-13 17:40:39 +02:00
parent 8b223eb096
commit 8f285465e8
13 changed files with 543 additions and 543 deletions

View File

@ -115,15 +115,15 @@ graphics/opengl/gldevice.cpp
# object/auto/autotower.cpp
# object/brain.cpp
# object/mainmovie.cpp
# object/motion/motion.cpp
# object/motion/motionant.cpp
# object/motion/motionbee.cpp
# object/motion/motionhuman.cpp
# object/motion/motionmother.cpp
# object/motion/motionspider.cpp
# object/motion/motiontoto.cpp
# object/motion/motionvehicle.cpp
# object/motion/motionworm.cpp
object/motion/motion.cpp
object/motion/motionant.cpp
object/motion/motionbee.cpp
object/motion/motionhuman.cpp
object/motion/motionmother.cpp
object/motion/motionspider.cpp
object/motion/motiontoto.cpp
object/motion/motionvehicle.cpp
object/motion/motionworm.cpp
object/object.cpp
# object/robotmain.cpp
object/task/task.cpp

View File

@ -36,7 +36,7 @@ CMotion::CMotion(CInstanceManager* iMan, CObject* object)
m_engine = static_cast< Gfx::CEngine* >(m_iMan->SearchInstance(CLASS_ENGINE));
m_light = static_cast< Gfx::CLight* >(m_iMan->SearchInstance(CLASS_LIGHT));
m_particule = static_cast< Gfx::CParticle* >(m_iMan->SearchInstance(CLASS_PARTICULE));
m_particle = static_cast< Gfx::CParticle* >(m_iMan->SearchInstance(CLASS_PARTICULE));
m_terrain = static_cast< Gfx::CTerrain* >(m_iMan->SearchInstance(CLASS_TERRAIN));
m_water = static_cast< Gfx::CWater* >(m_iMan->SearchInstance(CLASS_WATER));
m_camera = static_cast< Gfx::CCamera* >(m_iMan->SearchInstance(CLASS_CAMERA));

View File

@ -76,7 +76,7 @@ protected:
CInstanceManager* m_iMan;
Gfx::CEngine* m_engine;
Gfx::CLight* m_light;
Gfx::CParticle* m_particule;
Gfx::CParticle* m_particle;
Gfx::CTerrain* m_terrain;
Gfx::CWater* m_water;
Gfx::CCamera* m_camera;

View File

@ -686,7 +686,7 @@ bool CMotionAnt::EventFrame(const Event &event)
speed.y = Math::Rand()*5.0f;
dim.x = Math::Rand()*3.0f+2.0f;
dim.y = dim.x;
m_particule->CreateParticle(pos, speed, dim, Gfx::PARTICRASH, 2.0f);
m_particle->CreateParticle(pos, speed, dim, Gfx::PARTICRASH, 2.0f);
}
if ( m_progress < 0.5f )
@ -733,7 +733,7 @@ bool CMotionAnt::EventFrame(const Event &event)
speed.y = Math::Rand()*2.0f;
dim.x = Math::Rand()*1.0f+1.0f;
dim.y = dim.x;
m_particule->CreateParticle(pos, speed, dim, Gfx::PARTICRASH, 2.0f);
m_particle->CreateParticle(pos, speed, dim, Gfx::PARTICRASH, 2.0f);
}
}
@ -777,7 +777,7 @@ bool CMotionAnt::EventFrame(const Event &event)
speed.y = Math::Rand()*5.0f;
dim.x = Math::Rand()*3.0f+2.0f;
dim.y = dim.x;
m_particule->CreateParticle(pos, speed, dim, Gfx::PARTICRASH, 2.0f);
m_particle->CreateParticle(pos, speed, dim, Gfx::PARTICRASH, 2.0f);
}
if ( m_progress < 0.5f )

View File

@ -21,9 +21,9 @@
#include "object/motion/motionhuman.h"
#include "old/modfile.h"
#include "old/terrain.h"
#include "old/water.h"
#include "graphics/engine/modelfile.h"
#include "graphics/engine/terrain.h"
#include "graphics/engine/water.h"
#include "math/geometry.h"
#include "object/robotmain.h"
#include "physics/physics.h"
@ -72,7 +72,7 @@ void CMotionHuman::DeleteObject(bool bAll)
{
if ( m_partiReactor != -1 )
{
m_particule->DeleteParticule(m_partiReactor);
m_particle->DeleteParticle(m_partiReactor);
m_partiReactor = -1;
}
}
@ -93,32 +93,32 @@ Error CMotionHuman::SetAction(int action, float time)
bool CMotionHuman::Create(Math::Vector pos, float angle, ObjectType type,
float power)
{
CModFile* pModFile;
Gfx::CModelFile* pModFile;
char filename[100];
int rank, option, face, glasses;
if ( m_engine->RetRestCreate() < 16 ) return false;
// if ( m_engine->GetRestCreate() < 16 ) return false;
pModFile = new CModFile(m_iMan);
pModFile = new Gfx::CModelFile(m_iMan);
m_object->SetType(type);
option = m_object->RetOption();
option = m_object->GetOption();
if ( m_main->RetGamerOnlyHead() )
if ( m_main->GetGamerOnlyHead() )
{
rank = m_engine->CreateObject();
m_engine->SetObjectType(rank, TYPEVEHICULE); // this is a moving object
m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_VEHICULE); // this is a moving object
m_object->SetObjectRank(0, rank);
face = m_main->RetGamerFace();
face = m_main->GetGamerFace();
sprintf(filename, "objects\\human2h%d.mod", face+1);
pModFile->ReadModel(filename);
pModFile->CreateEngineObject(rank);
glasses = m_main->RetGamerGlasses();
glasses = m_main->GetGamerGlasses();
if ( glasses != 0 )
{
rank = m_engine->CreateObject();
m_engine->SetObjectType(rank, TYPEDESCENDANT);
m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_DESCENDANT);
m_object->SetObjectRank(1, rank);
m_object->SetObjectParent(1, 0);
sprintf(filename, "objects\\human2g%d.mod", glasses);
@ -129,7 +129,7 @@ bool CMotionHuman::Create(Math::Vector pos, float angle, ObjectType type,
CreatePhysics(type);
m_object->SetFloorHeight(0.0f);
m_engine->LoadAllTexture();
m_engine->LoadAllTextures();
delete pModFile;
return true;
@ -137,7 +137,7 @@ bool CMotionHuman::Create(Math::Vector pos, float angle, ObjectType type,
// Creates the main base.
rank = m_engine->CreateObject();
m_engine->SetObjectType(rank, TYPEVEHICULE); // this is a moving object
m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_VEHICULE); // this is a moving object
m_object->SetObjectRank(0, rank);
if ( option == 0 ) // head in helmet?
@ -163,7 +163,7 @@ bool CMotionHuman::Create(Math::Vector pos, float angle, ObjectType type,
// Creates the head.
rank = m_engine->CreateObject();
m_engine->SetObjectType(rank, TYPEDESCENDANT);
m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_DESCENDANT);
m_object->SetObjectRank(1, rank);
m_object->SetObjectParent(1, 0);
@ -171,14 +171,14 @@ bool CMotionHuman::Create(Math::Vector pos, float angle, ObjectType type,
{
if ( option == 0 ) // head in helmet?
{
face = m_main->RetGamerFace();
face = m_main->GetGamerFace();
sprintf(filename, "objects\\human2c%d.mod", face+1);
pModFile->ReadModel(filename);
}
if ( option == 1 || // head without helmet?
option == 2 ) // without a backpack?
{
face = m_main->RetGamerFace();
face = m_main->GetGamerFace();
sprintf(filename, "objects\\human2h%d.mod", face+1);
pModFile->ReadModel(filename);
}
@ -196,11 +196,11 @@ bool CMotionHuman::Create(Math::Vector pos, float angle, ObjectType type,
}
// Creates the glasses.
glasses = m_main->RetGamerGlasses();
glasses = m_main->GetGamerGlasses();
if ( glasses != 0 && type == OBJECT_HUMAN )
{
rank = m_engine->CreateObject();
m_engine->SetObjectType(rank, TYPEDESCENDANT);
m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_DESCENDANT);
m_object->SetObjectRank(15, rank);
m_object->SetObjectParent(15, 1);
sprintf(filename, "objects\\human2g%d.mod", glasses);
@ -210,7 +210,7 @@ bool CMotionHuman::Create(Math::Vector pos, float angle, ObjectType type,
// Creates the right arm.
rank = m_engine->CreateObject();
m_engine->SetObjectType(rank, TYPEDESCENDANT);
m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_DESCENDANT);
m_object->SetObjectRank(2, rank);
m_object->SetObjectParent(2, 0);
pModFile->ReadModel("objects\\human3.mod");
@ -220,7 +220,7 @@ bool CMotionHuman::Create(Math::Vector pos, float angle, ObjectType type,
// Creates the right forearm.
rank = m_engine->CreateObject();
m_engine->SetObjectType(rank, TYPEDESCENDANT);
m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_DESCENDANT);
m_object->SetObjectRank(3, rank);
m_object->SetObjectParent(3, 2);
pModFile->ReadModel("objects\\human4r.mod");
@ -230,7 +230,7 @@ bool CMotionHuman::Create(Math::Vector pos, float angle, ObjectType type,
// Creates right hand.
rank = m_engine->CreateObject();
m_engine->SetObjectType(rank, TYPEDESCENDANT);
m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_DESCENDANT);
m_object->SetObjectRank(4, rank);
m_object->SetObjectParent(4, 3);
pModFile->ReadModel("objects\\human5.mod");
@ -239,7 +239,7 @@ bool CMotionHuman::Create(Math::Vector pos, float angle, ObjectType type,
// Creates the right thigh.
rank = m_engine->CreateObject();
m_engine->SetObjectType(rank, TYPEDESCENDANT);
m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_DESCENDANT);
m_object->SetObjectRank(5, rank);
m_object->SetObjectParent(5, 0);
pModFile->ReadModel("objects\\human6.mod");
@ -249,7 +249,7 @@ bool CMotionHuman::Create(Math::Vector pos, float angle, ObjectType type,
// Creates the right leg.
rank = m_engine->CreateObject();
m_engine->SetObjectType(rank, TYPEDESCENDANT);
m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_DESCENDANT);
m_object->SetObjectRank(6, rank);
m_object->SetObjectParent(6, 5);
pModFile->ReadModel("objects\\human7.mod");
@ -259,7 +259,7 @@ bool CMotionHuman::Create(Math::Vector pos, float angle, ObjectType type,
// Creates the right foot.
rank = m_engine->CreateObject();
m_engine->SetObjectType(rank, TYPEDESCENDANT);
m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_DESCENDANT);
m_object->SetObjectRank(7, rank);
m_object->SetObjectParent(7, 6);
pModFile->ReadModel("objects\\human8.mod");
@ -269,7 +269,7 @@ bool CMotionHuman::Create(Math::Vector pos, float angle, ObjectType type,
// Creates the left arm.
rank = m_engine->CreateObject();
m_engine->SetObjectType(rank, TYPEDESCENDANT);
m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_DESCENDANT);
m_object->SetObjectRank(8, rank);
m_object->SetObjectParent(8, 0);
pModFile->ReadModel("objects\\human3.mod");
@ -280,7 +280,7 @@ bool CMotionHuman::Create(Math::Vector pos, float angle, ObjectType type,
// Creates the left forearm.
rank = m_engine->CreateObject();
m_engine->SetObjectType(rank, TYPEDESCENDANT);
m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_DESCENDANT);
m_object->SetObjectRank(9, rank);
m_object->SetObjectParent(9, 8);
pModFile->ReadModel("objects\\human4l.mod");
@ -291,7 +291,7 @@ bool CMotionHuman::Create(Math::Vector pos, float angle, ObjectType type,
// Creates left hand.
rank = m_engine->CreateObject();
m_engine->SetObjectType(rank, TYPEDESCENDANT);
m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_DESCENDANT);
m_object->SetObjectRank(10, rank);
m_object->SetObjectParent(10, 9);
pModFile->ReadModel("objects\\human5.mod");
@ -301,7 +301,7 @@ bool CMotionHuman::Create(Math::Vector pos, float angle, ObjectType type,
// Creates the left thigh.
rank = m_engine->CreateObject();
m_engine->SetObjectType(rank, TYPEDESCENDANT);
m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_DESCENDANT);
m_object->SetObjectRank(11, rank);
m_object->SetObjectParent(11, 0);
pModFile->ReadModel("objects\\human6.mod");
@ -312,7 +312,7 @@ bool CMotionHuman::Create(Math::Vector pos, float angle, ObjectType type,
// Creates the left leg.
rank = m_engine->CreateObject();
m_engine->SetObjectType(rank, TYPEDESCENDANT);
m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_DESCENDANT);
m_object->SetObjectRank(12, rank);
m_object->SetObjectParent(12, 11);
pModFile->ReadModel("objects\\human7.mod");
@ -323,7 +323,7 @@ bool CMotionHuman::Create(Math::Vector pos, float angle, ObjectType type,
// Creates the left foot.
rank = m_engine->CreateObject();
m_engine->SetObjectType(rank, TYPEDESCENDANT);
m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_DESCENDANT);
m_object->SetObjectRank(13, rank);
m_object->SetObjectParent(13, 12);
pModFile->ReadModel("objects\\human8.mod");
@ -336,7 +336,7 @@ bool CMotionHuman::Create(Math::Vector pos, float angle, ObjectType type,
if ( option != 2 ) // with backpack?
{
rank = m_engine->CreateObject();
m_engine->SetObjectType(rank, TYPEDESCENDANT);
m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_DESCENDANT);
m_object->SetObjectRank(14, rank);
m_object->SetObjectParent(14, 0);
pModFile->ReadModel("objects\\human9.mod");
@ -350,10 +350,10 @@ bool CMotionHuman::Create(Math::Vector pos, float angle, ObjectType type,
CreatePhysics(type);
m_object->SetFloorHeight(0.0f);
pos = m_object->RetPosition(0);
pos = m_object->GetPosition(0);
m_object->SetPosition(0, pos); // to display the shadows immediately
m_engine->LoadAllTexture();
m_engine->LoadAllTextures();
delete pModFile;
return true;
@ -560,7 +560,7 @@ void CMotionHuman::CreatePhysics(ObjectType type)
m_physics->SetType(TYPE_FLYING);
character = m_object->RetCharacter();
character = m_object->GetCharacter();
character->wheelFront = 4.0f;
character->wheelBack = 4.0f;
character->wheelLeft = 4.0f;
@ -653,12 +653,12 @@ bool CMotionHuman::EventProcess(const Event &event)
{
CMotion::EventProcess(event);
if ( event.event == EVENT_FRAME )
if ( event.type == EVENT_FRAME )
{
return EventFrame(event);
}
if ( event.event == EVENT_KEYDOWN )
if ( event.type == EVENT_KEY_DOWN )
{
#if ADJUST_ANGLE
int i;
@ -712,7 +712,7 @@ bool CMotionHuman::EventFrame(const Event &event)
int i, ii, st, nd, action, legAction, armAction;
bool bOnBoard, bSwim, bStop;
if ( m_engine->RetPause() )
if ( m_engine->GetPause() )
{
if ( m_actionType == MHS_SATCOM )
{
@ -725,35 +725,35 @@ bool CMotionHuman::EventFrame(const Event &event)
}
bOnBoard = false;
if ( m_object->RetSelect() &&
m_camera->RetType() == CAMERA_ONBOARD )
if ( m_object->GetSelect() &&
m_camera->GetType() == Gfx::CAM_TYPE_ONBOARD )
{
bOnBoard = true;
}
if ( m_bDisplayPerso && m_main->RetGamerOnlyHead() )
if ( m_bDisplayPerso && m_main->GetGamerOnlyHead() )
{
m_time += event.rTime;
m_object->SetLinVibration(Math::Vector(0.0f, -0.55f, 0.0f));
m_object->SetCirVibration(Math::Vector(0.0f, m_main->RetPersoAngle(), 0.0f));
m_object->SetCirVibration(Math::Vector(0.0f, m_main->GetPersoAngle(), 0.0f));
return true;
}
if ( m_bDisplayPerso )
{
m_object->SetCirVibration(Math::Vector(0.0f, m_main->RetPersoAngle()+0.2f, 0.0f));
m_object->SetCirVibration(Math::Vector(0.0f, m_main->GetPersoAngle()+0.2f, 0.0f));
}
shield = m_object->RetShield();
shield = m_object->GetShield();
shield += event.rTime*(1.0f/120.0f); // regeneration in 120 seconds
if ( shield > 1.0f ) shield = 1.0f;
m_object->SetShield(shield);
bSwim = m_physics->RetSwim();
bSwim = m_physics->GetSwim();
#if 0
rot = m_physics->RetCirMotionY(MO_MOTSPEED);
s = m_physics->RetLinMotionX(MO_REASPEED)*2.0f;
a = m_physics->RetLinMotionX(MO_TERSPEED);
rot = m_physics->GetCirMotionY(MO_MOTSPEED);
s = m_physics->GetLinMotionX(MO_REASPEED)*2.0f;
a = m_physics->GetLinMotionX(MO_TERSPEED);
if ( a < 0.0f ) // rises?
{
if ( s > 0.0f && s < 20.0f ) s = 20.0f; // moving slowly?
@ -766,44 +766,44 @@ bool CMotionHuman::EventFrame(const Event &event)
}
a = fabs(rot*12.0f);
if ( !m_physics->RetLand() && !bSwim ) // in flight?
if ( !m_physics->GetLand() && !bSwim ) // in flight?
{
s = 0.0f;
}
if ( m_object->RetFret() != 0 ) // carries something?
if ( m_object->GetFret() != 0 ) // carries something?
{
s *= 1.3f;
}
#else
rot = m_physics->RetCirMotionY(MO_MOTSPEED);
rot = m_physics->GetCirMotionY(MO_MOTSPEED);
#if 0
s = m_physics->RetLinMotionX(MO_REASPEED);
s = m_physics->GetLinMotionX(MO_REASPEED);
#else
a = m_physics->RetLinMotionX(MO_REASPEED);
s = m_physics->RetLinMotionX(MO_MOTSPEED)*0.2f;
a = m_physics->GetLinMotionX(MO_REASPEED);
s = m_physics->GetLinMotionX(MO_MOTSPEED)*0.2f;
if ( fabs(a) > fabs(s) ) s = a; // the highest value
#endif
a = m_physics->RetLinMotionX(MO_TERSPEED);
a = m_physics->GetLinMotionX(MO_TERSPEED);
if ( a < 0.0f ) // rises?
{
a += m_physics->RetLinMotionX(MO_TERSLIDE);
a += m_physics->GetLinMotionX(MO_TERSLIDE);
if ( a < 0.0f ) s -= a;
}
if ( a > 0.0f ) // falls?
{
a -= m_physics->RetLinMotionX(MO_TERSLIDE);
a -= m_physics->GetLinMotionX(MO_TERSLIDE);
if ( a > 0.0f ) s -= a;
}
s *= 2.0f;
a = fabs(rot*12.0f);
if ( !m_physics->RetLand() && !bSwim ) // in flight?
if ( !m_physics->GetLand() && !bSwim ) // in flight?
{
s = 0.0f;
}
if ( m_object->RetFret() != 0 ) // carries something?
if ( m_object->GetFret() != 0 ) // carries something?
{
s *= 1.3f;
}
@ -815,7 +815,7 @@ bool CMotionHuman::EventFrame(const Event &event)
m_armMember += s*event.rTime*0.05f;
// Fatigue management when short.
if ( m_physics->RetLand() && s != 0.0f ) // on the ground?
if ( m_physics->GetLand() && s != 0.0f ) // on the ground?
{
m_tired += event.rTime*0.1f;
if ( m_tired > 1.0f )
@ -832,7 +832,7 @@ bool CMotionHuman::EventFrame(const Event &event)
if ( bSwim ) // swims?
{
s += fabs(m_physics->RetLinMotionY(MO_REASPEED)*2.0f);
s += fabs(m_physics->GetLinMotionY(MO_REASPEED)*2.0f);
a *= 2.0f;
m_armTimeSwim += Math::Min(Math::Max(s,a,3.0f),15.0f)*event.rTime*0.05f;
}
@ -840,7 +840,7 @@ bool CMotionHuman::EventFrame(const Event &event)
bStop = ( s == 0.0f ); // stop?
prog = 0.0f;
if ( m_physics->RetLand() ) // on the ground?
if ( m_physics->GetLand() ) // on the ground?
{
if ( s == 0.0f && a == 0.0f )
{
@ -869,7 +869,7 @@ bool CMotionHuman::EventFrame(const Event &event)
else
{
action = MH_MARCH; // walking
if ( m_object->RetFret() != 0 ) action = MH_MARCHTAKE; // take walking
if ( m_object->GetFret() != 0 ) action = MH_MARCHTAKE; // take walking
rTime[0] = rTime[1] = m_armMember;
lTime[0] = lTime[1] = m_armMember+0.5f;
}
@ -908,34 +908,34 @@ bool CMotionHuman::EventFrame(const Event &event)
armAction = action;
legAction = action;
if ( m_object->RetFret() != 0 ) // carries something?
if ( m_object->GetFret() != 0 ) // carries something?
{
armAction = MH_MARCHTAKE; // take walking
}
if ( m_physics->RetLand() ) // on the ground?
if ( m_physics->GetLand() ) // on the ground?
{
a = m_object->RetAngleY(0);
pos = m_object->RetPosition(0);
m_terrain->MoveOnFloor(pos);
a = m_object->GetAngleY(0);
pos = m_object->GetPosition(0);
m_terrain->AdjustToFloor(pos);
pf.x = pos.x+cosf(a+Math::PI*1.5f)*0.7f;
pf.y = pos.y;
pf.z = pos.z-sinf(a+Math::PI*1.5f)*0.7f;
m_terrain->MoveOnFloor(pf);
m_terrain->AdjustToFloor(pf);
al = atanf((pf.y-pos.y)/0.7f); // angle for left leg
pf = pos;
pf.x = pos.x+cosf(a+Math::PI*0.5f)*0.7f;
pf.y = pos.y;
pf.z = pos.z-sinf(a+Math::PI*0.5f)*0.7f;
m_terrain->MoveOnFloor(pf);
m_terrain->AdjustToFloor(pf);
ar = atanf((pf.y-pos.y)/0.7f); // angle to right leg
pf.x = pos.x+cosf(a+Math::PI)*0.3f;
pf.y = pos.y;
pf.z = pos.z-sinf(a+Math::PI)*0.3f;
m_terrain->MoveOnFloor(pf);
m_terrain->AdjustToFloor(pf);
af = atanf((pf.y-pos.y)/0.3f); // angle for feet
}
else
@ -1022,7 +1022,7 @@ bool CMotionHuman::EventFrame(const Event &event)
aa = 0.5f;
if ( i%2 == 0 ) // arm?
{
if ( m_object->RetFret() == 0 ) // does nothing?
if ( m_object->GetFret() == 0 ) // does nothing?
{
aa = 2.0f; // moves a lot
}
@ -1074,15 +1074,15 @@ bool CMotionHuman::EventFrame(const Event &event)
if ( a < -0.2f ) a = -0.2f;
if ( a > 0.2f ) a = 0.2f;
pos = m_object->RetPosition(ii+0);
pos = m_object->GetPosition(ii+0);
pos.y = 0.0f+a;
m_object->SetPosition(ii+0, pos); // lengthens / shortcuts thigh
pos = m_object->RetPosition(ii+1);
pos = m_object->GetPosition(ii+1);
pos.y = -1.5f+a;
m_object->SetPosition(ii+1, pos); // lengthens / shortcuts leg
pos = m_object->RetPosition(ii+2);
pos = m_object->GetPosition(ii+2);
pos.y = -1.5f+a;
m_object->SetPosition(ii+2, pos); // lengthens / shortcuts foot
@ -1147,32 +1147,32 @@ bool CMotionHuman::EventFrame(const Event &event)
if ( i < 2 ) // right member (0..1) ?
{
m_object->SetAngleX(2+3*i+0, Math::Smooth(m_object->RetAngleX(2+3*i+0), Math::PropAngle(tSt[0], tNd[0], prog), time));
m_object->SetAngleY(2+3*i+0, Math::Smooth(m_object->RetAngleY(2+3*i+0), Math::PropAngle(tSt[1], tNd[1], prog), time));
m_object->SetAngleZ(2+3*i+0, Math::Smooth(m_object->RetAngleZ(2+3*i+0), Math::PropAngle(tSt[2], tNd[2], prog), time));
m_object->SetAngleX(2+3*i+1, Math::Smooth(m_object->RetAngleX(2+3*i+1), Math::PropAngle(tSt[3], tNd[3], prog), time));
m_object->SetAngleY(2+3*i+1, Math::Smooth(m_object->RetAngleY(2+3*i+1), Math::PropAngle(tSt[4], tNd[4], prog), time));
m_object->SetAngleZ(2+3*i+1, Math::Smooth(m_object->RetAngleZ(2+3*i+1), Math::PropAngle(tSt[5], tNd[5], prog), time));
m_object->SetAngleX(2+3*i+2, Math::Smooth(m_object->RetAngleX(2+3*i+2), Math::PropAngle(tSt[6], tNd[6], prog), time));
m_object->SetAngleY(2+3*i+2, Math::Smooth(m_object->RetAngleY(2+3*i+2), Math::PropAngle(tSt[7], tNd[7], prog), time));
m_object->SetAngleZ(2+3*i+2, Math::Smooth(m_object->RetAngleZ(2+3*i+2), Math::PropAngle(tSt[8], tNd[8], prog), time));
m_object->SetAngleX(2+3*i+0, Math::Smooth(m_object->GetAngleX(2+3*i+0), Math::PropAngle(tSt[0], tNd[0], prog), time));
m_object->SetAngleY(2+3*i+0, Math::Smooth(m_object->GetAngleY(2+3*i+0), Math::PropAngle(tSt[1], tNd[1], prog), time));
m_object->SetAngleZ(2+3*i+0, Math::Smooth(m_object->GetAngleZ(2+3*i+0), Math::PropAngle(tSt[2], tNd[2], prog), time));
m_object->SetAngleX(2+3*i+1, Math::Smooth(m_object->GetAngleX(2+3*i+1), Math::PropAngle(tSt[3], tNd[3], prog), time));
m_object->SetAngleY(2+3*i+1, Math::Smooth(m_object->GetAngleY(2+3*i+1), Math::PropAngle(tSt[4], tNd[4], prog), time));
m_object->SetAngleZ(2+3*i+1, Math::Smooth(m_object->GetAngleZ(2+3*i+1), Math::PropAngle(tSt[5], tNd[5], prog), time));
m_object->SetAngleX(2+3*i+2, Math::Smooth(m_object->GetAngleX(2+3*i+2), Math::PropAngle(tSt[6], tNd[6], prog), time));
m_object->SetAngleY(2+3*i+2, Math::Smooth(m_object->GetAngleY(2+3*i+2), Math::PropAngle(tSt[7], tNd[7], prog), time));
m_object->SetAngleZ(2+3*i+2, Math::Smooth(m_object->GetAngleZ(2+3*i+2), Math::PropAngle(tSt[8], tNd[8], prog), time));
}
else // left member (2..3) ?
{
m_object->SetAngleX(2+3*i+0, Math::Smooth(m_object->RetAngleX(2+3*i+0), Math::PropAngle(-tSt[0], -tNd[0], prog), time));
m_object->SetAngleY(2+3*i+0, Math::Smooth(m_object->RetAngleY(2+3*i+0), Math::PropAngle(-tSt[1], -tNd[1], prog), time));
m_object->SetAngleZ(2+3*i+0, Math::Smooth(m_object->RetAngleZ(2+3*i+0), Math::PropAngle( tSt[2], tNd[2], prog), time));
m_object->SetAngleX(2+3*i+1, Math::Smooth(m_object->RetAngleX(2+3*i+1), Math::PropAngle(-tSt[3], -tNd[3], prog), time));
m_object->SetAngleY(2+3*i+1, Math::Smooth(m_object->RetAngleY(2+3*i+1), Math::PropAngle(-tSt[4], -tNd[4], prog), time));
m_object->SetAngleZ(2+3*i+1, Math::Smooth(m_object->RetAngleZ(2+3*i+1), Math::PropAngle( tSt[5], tNd[5], prog), time));
m_object->SetAngleX(2+3*i+2, Math::Smooth(m_object->RetAngleX(2+3*i+2), Math::PropAngle(-tSt[6], -tNd[6], prog), time));
m_object->SetAngleY(2+3*i+2, Math::Smooth(m_object->RetAngleY(2+3*i+2), Math::PropAngle(-tSt[7], -tNd[7], prog), time));
m_object->SetAngleZ(2+3*i+2, Math::Smooth(m_object->RetAngleZ(2+3*i+2), Math::PropAngle( tSt[8], tNd[8], prog), time));
m_object->SetAngleX(2+3*i+0, Math::Smooth(m_object->GetAngleX(2+3*i+0), Math::PropAngle(-tSt[0], -tNd[0], prog), time));
m_object->SetAngleY(2+3*i+0, Math::Smooth(m_object->GetAngleY(2+3*i+0), Math::PropAngle(-tSt[1], -tNd[1], prog), time));
m_object->SetAngleZ(2+3*i+0, Math::Smooth(m_object->GetAngleZ(2+3*i+0), Math::PropAngle( tSt[2], tNd[2], prog), time));
m_object->SetAngleX(2+3*i+1, Math::Smooth(m_object->GetAngleX(2+3*i+1), Math::PropAngle(-tSt[3], -tNd[3], prog), time));
m_object->SetAngleY(2+3*i+1, Math::Smooth(m_object->GetAngleY(2+3*i+1), Math::PropAngle(-tSt[4], -tNd[4], prog), time));
m_object->SetAngleZ(2+3*i+1, Math::Smooth(m_object->GetAngleZ(2+3*i+1), Math::PropAngle( tSt[5], tNd[5], prog), time));
m_object->SetAngleX(2+3*i+2, Math::Smooth(m_object->GetAngleX(2+3*i+2), Math::PropAngle(-tSt[6], -tNd[6], prog), time));
m_object->SetAngleY(2+3*i+2, Math::Smooth(m_object->GetAngleY(2+3*i+2), Math::PropAngle(-tSt[7], -tNd[7], prog), time));
m_object->SetAngleZ(2+3*i+2, Math::Smooth(m_object->GetAngleZ(2+3*i+2), Math::PropAngle( tSt[8], tNd[8], prog), time));
}
}
#if ADJUST_ANGLE
if ( m_object->RetSelect() )
if ( m_object->GetSelect() )
{
char s[100];
sprintf(s, "A:time=%d Q:part=%d W:member=%d", m_armTimeIndex, m_armPartIndex, m_armMemberIndex);
@ -1182,14 +1182,14 @@ bool CMotionHuman::EventFrame(const Event &event)
// calculates the height lowering as a function
// of the position of the legs.
hr = 1.5f*(1.0f-cosf(m_object->RetAngleZ(5))) +
1.5f*(1.0f-cosf(m_object->RetAngleZ(5)+m_object->RetAngleZ(6)));
a = 1.0f*sinf(m_object->RetAngleZ(5)+m_object->RetAngleZ(6)+m_object->RetAngleZ(7));
hr = 1.5f*(1.0f-cosf(m_object->GetAngleZ(5))) +
1.5f*(1.0f-cosf(m_object->GetAngleZ(5)+m_object->GetAngleZ(6)));
a = 1.0f*sinf(m_object->GetAngleZ(5)+m_object->GetAngleZ(6)+m_object->GetAngleZ(7));
if ( a < 0.0f ) hr += a;
hl = 1.5f*(1.0f-cosf(m_object->RetAngleZ(11))) +
1.5f*(1.0f-cosf(m_object->RetAngleZ(11)+m_object->RetAngleZ(12)));
a = 1.0f*sinf(m_object->RetAngleZ(11)+m_object->RetAngleZ(12)+m_object->RetAngleZ(13));
hl = 1.5f*(1.0f-cosf(m_object->GetAngleZ(11))) +
1.5f*(1.0f-cosf(m_object->GetAngleZ(11)+m_object->GetAngleZ(12)));
a = 1.0f*sinf(m_object->GetAngleZ(11)+m_object->GetAngleZ(12)+m_object->GetAngleZ(13));
if ( a < 0.0f ) hl += a;
hr = Math::Min(hr, hl);
@ -1201,7 +1201,7 @@ bool CMotionHuman::EventFrame(const Event &event)
dir.x = (Math::Rand()-0.5f)/8.0f;
dir.z = (Math::Rand()-0.5f)/8.0f;
dir.y = -0.5f; // slightly lower
actual = m_object->RetLinVibration();
actual = m_object->GetLinVibration();
dir.x = Math::Smooth(actual.x, dir.x, time);
//? dir.y = Math::Smooth(actual.y, dir.y, time);
dir.y = -hr;
@ -1211,7 +1211,7 @@ bool CMotionHuman::EventFrame(const Event &event)
dir.x = 0.0f;
dir.y = (Math::Rand()-0.5f)/3.0f;
dir.z = -0.1f; // slightly leaning forward
actual = m_object->RetInclinaison();
actual = m_object->GetInclinaison();
dir.x = Math::Smooth(actual.x, dir.x, time);
dir.y = Math::Smooth(actual.y, dir.y, time);
dir.z = Math::Smooth(actual.z, dir.z, time);
@ -1225,7 +1225,7 @@ bool CMotionHuman::EventFrame(const Event &event)
dir.x = 0.0f;
dir.z = 0.0f;
dir.y = -1.5f; // slightly lower
actual = m_object->RetLinVibration();
actual = m_object->GetLinVibration();
dir.x = Math::Smooth(actual.x, dir.x, time);
//? dir.y = Math::Smooth(actual.y, dir.y, time);
dir.y = -hr;
@ -1235,7 +1235,7 @@ bool CMotionHuman::EventFrame(const Event &event)
dir.x = 0.0f;
dir.y = 0.0f;
dir.z = -0.2f;
actual = m_object->RetInclinaison();
actual = m_object->GetInclinaison();
dir.x = Math::Smooth(actual.x, dir.x, time);
dir.y = Math::Smooth(actual.y, dir.y, time);
dir.z = Math::Smooth(actual.z, dir.z, time);
@ -1248,7 +1248,7 @@ bool CMotionHuman::EventFrame(const Event &event)
dir.x = 0.4f; // slightly forward
dir.z = 0.0f;
dir.y = 0.0f;
actual = m_object->RetLinVibration();
actual = m_object->GetLinVibration();
dir.x = Math::Smooth(actual.x, dir.x, time);
//? dir.y = Math::Smooth(actual.y, dir.y, time);
dir.y = -hr;
@ -1258,7 +1258,7 @@ bool CMotionHuman::EventFrame(const Event &event)
dir.x = 0.0f;
dir.y = 0.0f;
dir.z = -0.2f;
actual = m_object->RetInclinaison();
actual = m_object->GetInclinaison();
dir.x = Math::Smooth(actual.x, dir.x, time);
dir.y = Math::Smooth(actual.y, dir.y, time);
dir.z = Math::Smooth(actual.z, dir.z, time);
@ -1271,7 +1271,7 @@ bool CMotionHuman::EventFrame(const Event &event)
dir.x = 0.0f;
dir.z = 0.0f;
dir.y = -2.0f; // slightly lower
actual = m_object->RetLinVibration();
actual = m_object->GetLinVibration();
dir.x = Math::Smooth(actual.x, dir.x, time);
//? dir.y = Math::Smooth(actual.y, dir.y, time);
dir.y = -hr;
@ -1281,7 +1281,7 @@ bool CMotionHuman::EventFrame(const Event &event)
dir.x = 0.0f;
dir.y = 0.0f;
dir.z = -0.4f;
actual = m_object->RetInclinaison();
actual = m_object->GetInclinaison();
dir.x = Math::Smooth(actual.x, dir.x, time);
dir.y = Math::Smooth(actual.y, dir.y, time);
dir.z = Math::Smooth(actual.z, dir.z, time);
@ -1289,7 +1289,7 @@ bool CMotionHuman::EventFrame(const Event &event)
}
else if ( m_actionType == MHS_DEADg ) // shooting death (falls)?
{
if ( m_physics->RetLand() ) // on the ground?
if ( m_physics->GetLand() ) // on the ground?
{
SetAction(MHS_DEADg1, 0.5f); // knees
}
@ -1303,16 +1303,16 @@ bool CMotionHuman::EventFrame(const Event &event)
for ( i=0 ; i<10 ; i++ )
{
pos = m_object->RetPosition(0);
pos = m_object->GetPosition(0);
pos.x += (Math::Rand()-0.5f)*4.0f;
pos.z += (Math::Rand()-0.5f)*4.0f;
m_terrain->MoveOnFloor(pos);
m_terrain->AdjustToFloor(pos);
speed = Math::Vector(0.0f, 0.0f, 0.0f);
dim.x = 1.2f+Math::Rand()*1.2f;
dim.y = dim.x;
m_particule->CreateParticule(pos, speed, dim, PARTICRASH, 2.0f, 0.0f, 0.0f);
m_particle->CreateParticle(pos, speed, dim, Gfx::PARTICRASH, 2.0f, 0.0f, 0.0f);
}
m_sound->Play(SOUND_BOUMv, m_object->RetPosition(0));
m_sound->Play(SOUND_BOUMv, m_object->GetPosition(0));
SetAction(MHS_DEADg2, 1.0f); // expects knees
}
@ -1322,7 +1322,7 @@ bool CMotionHuman::EventFrame(const Event &event)
dir.x = 0.0f;
dir.z = 0.0f;
dir.y = -1.5f*prog;
actual = m_object->RetLinVibration();
actual = m_object->GetLinVibration();
dir.x = Math::Smooth(actual.x, dir.x, time);
dir.y = Math::Smooth(actual.y, dir.y, time);
dir.z = Math::Smooth(actual.z, dir.z, time);
@ -1331,7 +1331,7 @@ bool CMotionHuman::EventFrame(const Event &event)
dir.x = 0.0f;
dir.y = 0.0f;
dir.z = -(20.0f*Math::PI/180.0f)*prog;
actual = m_object->RetInclinaison();
actual = m_object->GetInclinaison();
dir.x = Math::Smooth(actual.x, dir.x, time);
dir.y = Math::Smooth(actual.y, dir.y, time);
dir.z = Math::Smooth(actual.z, dir.z, time);
@ -1349,7 +1349,7 @@ bool CMotionHuman::EventFrame(const Event &event)
dir.x = 0.0f;
dir.z = 0.0f;
dir.y = -1.5f;
actual = m_object->RetLinVibration();
actual = m_object->GetLinVibration();
dir.x = Math::Smooth(actual.x, dir.x, time);
dir.y = Math::Smooth(actual.y, dir.y, time);
dir.z = Math::Smooth(actual.z, dir.z, time);
@ -1358,7 +1358,7 @@ bool CMotionHuman::EventFrame(const Event &event)
dir.x = 0.0f;
dir.y = 0.0f;
dir.z = -(20.0f*Math::PI/180.0f);
actual = m_object->RetInclinaison();
actual = m_object->GetInclinaison();
dir.x = Math::Smooth(actual.x, dir.x, time);
dir.y = Math::Smooth(actual.y, dir.y, time);
dir.z = Math::Smooth(actual.z, dir.z, time);
@ -1373,16 +1373,16 @@ bool CMotionHuman::EventFrame(const Event &event)
for ( i=0 ; i<20 ; i++ )
{
pos = m_object->RetPosition(0);
pos = m_object->GetPosition(0);
pos.x += (Math::Rand()-0.5f)*8.0f;
pos.z += (Math::Rand()-0.5f)*8.0f;
m_terrain->MoveOnFloor(pos);
m_terrain->AdjustToFloor(pos);
speed = Math::Vector(0.0f, 0.0f, 0.0f);
dim.x = 2.0f+Math::Rand()*1.5f;
dim.y = dim.x;
m_particule->CreateParticule(pos, speed, dim, PARTICRASH, 2.0f, 0.0f, 0.0f);
m_particle->CreateParticle(pos, speed, dim, Gfx::PARTICRASH, 2.0f, 0.0f, 0.0f);
}
m_sound->Play(SOUND_BOUMv, m_object->RetPosition(0));
m_sound->Play(SOUND_BOUMv, m_object->GetPosition(0));
SetAction(MHS_DEADg4, 3.0f); // expects face down
}
@ -1393,7 +1393,7 @@ bool CMotionHuman::EventFrame(const Event &event)
dir.y = -(1.5f+1.5f*prog);
dir.x = 0.0f;
dir.z = 0.0f;
actual = m_object->RetLinVibration();
actual = m_object->GetLinVibration();
dir.x = Math::Smooth(actual.x, dir.x, time);
dir.y = Math::Smooth(actual.y, dir.y, time);
dir.z = Math::Smooth(actual.z, dir.z, time);
@ -1402,7 +1402,7 @@ bool CMotionHuman::EventFrame(const Event &event)
dir.z = -((20.0f*Math::PI/180.0f)+(70.0f*Math::PI/180.0f)*prog);
dir.x = 0.0f;
dir.y = 0.0f;
actual = m_object->RetInclinaison();
actual = m_object->GetInclinaison();
dir.x = Math::Smooth(actual.x, dir.x, time);
dir.y = Math::Smooth(actual.y, dir.y, time);
dir.z = Math::Smooth(actual.z, dir.z, time);
@ -1420,7 +1420,7 @@ bool CMotionHuman::EventFrame(const Event &event)
dir.y = -(1.5f+1.5f);
dir.x = 0.0f;
dir.z = 0.0f;
actual = m_object->RetLinVibration();
actual = m_object->GetLinVibration();
dir.x = Math::Smooth(actual.x, dir.x, time);
dir.y = Math::Smooth(actual.y, dir.y, time);
dir.z = Math::Smooth(actual.z, dir.z, time);
@ -1429,7 +1429,7 @@ bool CMotionHuman::EventFrame(const Event &event)
dir.z = -((20.0f*Math::PI/180.0f)+(70.0f*Math::PI/180.0f));
dir.x = 0.0f;
dir.y = 0.0f;
actual = m_object->RetInclinaison();
actual = m_object->GetInclinaison();
dir.x = Math::Smooth(actual.x, dir.x, time);
dir.y = Math::Smooth(actual.y, dir.y, time);
dir.z = Math::Smooth(actual.z, dir.z, time);
@ -1437,8 +1437,8 @@ bool CMotionHuman::EventFrame(const Event &event)
}
else if ( m_actionType == MHS_DEADw ) // drowned?
{
pos = m_object->RetPosition(0);
level = m_water->RetLevel()-0.5f;
pos = m_object->GetPosition(0);
level = m_water->GetLevel()-0.5f;
if ( pos.y < level )
{
pos.y += 4.0f*event.rTime; // back to the surface
@ -1467,7 +1467,7 @@ bool CMotionHuman::EventFrame(const Event &event)
dir.z = -(90.0f*Math::PI/180.0f)*prog;
dir.x = Math::Rand()*0.3f*deadFactor;
dir.y = Math::Rand()*0.3f*deadFactor;
actual = m_object->RetInclinaison();
actual = m_object->GetInclinaison();
dir.x = Math::Smooth(actual.x, dir.x, time);
dir.y = Math::Smooth(actual.y, dir.y, time);
dir.z = Math::Smooth(actual.z, dir.z, time);
@ -1494,7 +1494,7 @@ bool CMotionHuman::EventFrame(const Event &event)
m_object->SetLinVibration(dir);
SetLinVibration(dir);
mat = m_object->RetWorldMatrix(0);
mat = m_object->GetWorldMatrix(0);
pos = Math::Vector(0.5f, 3.7f, 0.0f);
pos.x += (Math::Rand()-0.5f)*1.0f;
pos.y += (Math::Rand()-0.5f)*1.0f;
@ -1505,7 +1505,7 @@ bool CMotionHuman::EventFrame(const Event &event)
speed.z = (Math::Rand()-0.5f)*0.5f;
dim.x = 0.5f+Math::Rand()*0.5f;
dim.y = dim.x;
m_particule->CreateParticule(pos, speed, dim, PARTILENS1, 5.0f, 0.0f, 0.0f);
m_particle->CreateParticle(pos, speed, dim, Gfx::PARTILENS1, 5.0f, 0.0f, 0.0f);
}
else if ( m_actionType == MHS_SATCOM ) // look at the SatCom?
{
@ -1515,7 +1515,7 @@ bool CMotionHuman::EventFrame(const Event &event)
}
else
{
if ( m_physics->RetLand() ) // on the ground?
if ( m_physics->GetLand() ) // on the ground?
{
time = event.rTime*8.0f;
if ( bSwim ) time *= 0.25f;
@ -1524,25 +1524,25 @@ bool CMotionHuman::EventFrame(const Event &event)
{
dir.x = sinf(Math::Mod(rTime[0]+0.5f, 1.0f)*Math::PI*2.0f)*0.10f;
dir.y = sinf(Math::Mod(rTime[0]+0.6f, 1.0f)*Math::PI*2.0f)*0.20f;
s = m_physics->RetLinMotionX(MO_REASPEED)*0.03f;
s = m_physics->GetLinMotionX(MO_REASPEED)*0.03f;
}
else if ( action == MH_MARCHTAKE ) // takes walking?
{
dir.x = sinf(Math::Mod(rTime[0]+0.5f, 1.0f)*Math::PI*2.0f)*0.10f;
dir.y = sinf(Math::Mod(rTime[0]+0.6f, 1.0f)*Math::PI*2.0f)*0.15f;
s = m_physics->RetLinMotionX(MO_REASPEED)*0.02f;
s = m_physics->GetLinMotionX(MO_REASPEED)*0.02f;
}
else
{
dir.x = 0.0f;
dir.y = 0.0f;
s = m_physics->RetLinMotionX(MO_REASPEED)*0.03f;
s = m_physics->GetLinMotionX(MO_REASPEED)*0.03f;
}
if ( s < 0.0f ) s *= 0.5f;
dir.z = -s*0.7f;
actual = m_object->RetInclinaison();
actual = m_object->GetInclinaison();
dir.x = Math::Smooth(actual.x, dir.x, time);
dir.y = Math::Smooth(actual.y, dir.y, time);
dir.z = Math::Smooth(actual.z, dir.z, time);
@ -1554,7 +1554,7 @@ bool CMotionHuman::EventFrame(const Event &event)
{
p2.x = 0.0f;
p2.y = sinf(Math::Mod(rTime[0]+0.5f, 1.0f)*Math::PI*2.0f)*0.5f;
p2 = Math::RotatePoint(-m_object->RetAngleY(0), p2);
p2 = Math::RotatePoint(-m_object->GetAngleY(0), p2);
dir.x = p2.x;
dir.z = p2.y;
dir.y = sinf(Math::Mod(rTime[0]*2.0f, 1.0f)*Math::PI*2.0f)*0.3f;
@ -1563,7 +1563,7 @@ bool CMotionHuman::EventFrame(const Event &event)
{
p2.x = 0.0f;
p2.y = sinf(Math::Mod(rTime[0]+0.5f, 1.0f)*Math::PI*2.0f)*0.25f;
p2 = Math::RotatePoint(-m_object->RetAngleY(0), p2);
p2 = Math::RotatePoint(-m_object->GetAngleY(0), p2);
dir.x = p2.x;
dir.z = p2.y;
dir.y = sinf(Math::Mod(rTime[0]*2.0f, 1.0f)*Math::PI*2.0f)*0.05f-0.3f;
@ -1575,7 +1575,7 @@ bool CMotionHuman::EventFrame(const Event &event)
dir.y = 0.0f;
}
actual = m_object->RetLinVibration();
actual = m_object->GetLinVibration();
dir.x = Math::Smooth(actual.x, dir.x, time);
if ( action == MH_MARCHTAKE ) // takes walking?
{
@ -1602,16 +1602,16 @@ bool CMotionHuman::EventFrame(const Event &event)
if ( m_actionType == MHS_TAKE || // takes?
m_actionType == MHS_FLAG ) // takes?
{
m_object->SetAngleZ(1, Math::Smooth(m_object->RetAngleZ(1), sinf(m_armTimeAbs*1.0f)*0.2f-0.6f, event.rTime*5.0f));
m_object->SetAngleZ(1, Math::Smooth(m_object->GetAngleZ(1), sinf(m_armTimeAbs*1.0f)*0.2f-0.6f, event.rTime*5.0f));
m_object->SetAngleX(1, sinf(m_armTimeAbs*1.1f)*0.1f);
m_object->SetAngleY(1, Math::Smooth(m_object->RetAngleY(1), sinf(m_armTimeAbs*1.3f)*0.2f+rot*0.3f, event.rTime*5.0f));
m_object->SetAngleY(1, Math::Smooth(m_object->GetAngleY(1), sinf(m_armTimeAbs*1.3f)*0.2f+rot*0.3f, event.rTime*5.0f));
}
else if ( m_actionType == MHS_TAKEOTHER || // takes?
m_actionType == MHS_TAKEHIGH ) // takes?
{
m_object->SetAngleZ(1, Math::Smooth(m_object->RetAngleZ(1), sinf(m_armTimeAbs*1.0f)*0.2f-0.3f, event.rTime*5.0f));
m_object->SetAngleZ(1, Math::Smooth(m_object->GetAngleZ(1), sinf(m_armTimeAbs*1.0f)*0.2f-0.3f, event.rTime*5.0f));
m_object->SetAngleX(1, sinf(m_armTimeAbs*1.1f)*0.1f);
m_object->SetAngleY(1, Math::Smooth(m_object->RetAngleY(1), sinf(m_armTimeAbs*1.3f)*0.2f+rot*0.3f, event.rTime*5.0f));
m_object->SetAngleY(1, Math::Smooth(m_object->GetAngleY(1), sinf(m_armTimeAbs*1.3f)*0.2f+rot*0.3f, event.rTime*5.0f));
}
else if ( m_actionType == MHS_WIN ) // win
{
@ -1627,14 +1627,14 @@ bool CMotionHuman::EventFrame(const Event &event)
m_object->SetAngleX(1, sinf(m_armTimeAbs*0.7f)*0.10f);
m_object->SetAngleY(1, sinf(m_armTimeAbs*3.0f)*0.30f*factor);
}
else if ( m_object->RetDead() ) // dead?
else if ( m_object->GetDead() ) // dead?
{
}
else
{
m_object->SetAngleZ(1, Math::Smooth(m_object->RetAngleZ(1), sinf(m_armTimeAbs*1.0f)*0.2f, event.rTime*5.0f));
m_object->SetAngleZ(1, Math::Smooth(m_object->GetAngleZ(1), sinf(m_armTimeAbs*1.0f)*0.2f, event.rTime*5.0f));
m_object->SetAngleX(1, sinf(m_armTimeAbs*1.1f)*0.1f);
m_object->SetAngleY(1, Math::Smooth(m_object->RetAngleY(1), sinf(m_armTimeAbs*1.3f)*0.2f+rot*0.3f, event.rTime*5.0f));
m_object->SetAngleY(1, Math::Smooth(m_object->GetAngleY(1), sinf(m_armTimeAbs*1.3f)*0.2f+rot*0.3f, event.rTime*5.0f));
}
if ( bOnBoard )
@ -1651,9 +1651,9 @@ bool CMotionHuman::EventFrame(const Event &event)
Sound sound[2];
float speed, synchro, volume[2], freq[2], hard, level;
speed = m_physics->RetLinMotionX(MO_REASPEED);
speed = m_physics->GetLinMotionX(MO_REASPEED);
if ( m_object->RetFret() == 0 )
if ( m_object->GetFret() == 0 )
{
if ( speed > 0.0f ) synchro = 0.21f; // synchro forward
else synchro = 0.29f; // synchro backward
@ -1670,7 +1670,7 @@ bool CMotionHuman::EventFrame(const Event &event)
{
volume[0] = 0.5f;
freq[0] = 1.0f;
if ( m_object->RetFret() != 0 )
if ( m_object->GetFret() != 0 )
{
//? volume[0] *= 2.0f;
freq[0] = 0.7f;
@ -1680,16 +1680,16 @@ bool CMotionHuman::EventFrame(const Event &event)
sound[0] = SOUND_CLICK;
sound[1] = SOUND_CLICK;
pos = m_object->RetPosition(0);
pos = m_object->GetPosition(0);
level = m_water->RetLevel();
level = m_water->GetLevel();
if ( pos.y <= level+3.0f ) // underwater?
{
sound[0] = SOUND_STEPw;
}
else
{
hard = m_terrain->RetHardness(pos);
hard = m_terrain->GetHardness(pos);
if ( hard >= 0.875 )
{
@ -1737,17 +1737,17 @@ bool CMotionHuman::EventFrame(const Event &event)
if ( fabs(m_lastSoundMarch-time) > 0.9f &&
Math::Mod(time, 1.0f) < 0.1f )
{
m_sound->Play(SOUND_SWIM, m_object->RetPosition(0), 0.5f);
m_sound->Play(SOUND_SWIM, m_object->GetPosition(0), 0.5f);
m_lastSoundMarch = time;
}
}
m_lastSoundHhh -= event.rTime;
if ( m_lastSoundHhh <= 0.0f &&
m_object->RetSelect() &&
m_object->RetOption() == 0 ) // helmet?
m_object->GetSelect() &&
m_object->GetOption() == 0 ) // helmet?
{
m_sound->Play(SOUND_HUMAN1, m_object->RetPosition(0), (0.5f+m_tired*0.2f));
m_sound->Play(SOUND_HUMAN1, m_object->GetPosition(0), (0.5f+m_tired*0.2f));
m_lastSoundHhh = (4.0f-m_tired*2.5f)+(4.0f-m_tired*2.5f)*Math::Rand();
}

View File

@ -21,7 +21,7 @@
#include "object/motion/motionmother.h"
#include "old/modfile.h"
#include "graphics/engine/modelfile.h"
#include "physics/physics.h"
@ -67,18 +67,18 @@ void CMotionMother::DeleteObject(bool bAll)
bool CMotionMother::Create(Math::Vector pos, float angle, ObjectType type,
float power)
{
CModFile* pModFile;
Gfx::CModelFile* pModFile;
int rank;
if ( m_engine->RetRestCreate() < 2+12+6 ) return false;
// if ( m_engine->GetRestCreate() < 2+12+6 ) return false;
pModFile = new CModFile(m_iMan);
pModFile = new Gfx::CModelFile(m_iMan);
m_object->SetType(type);
// Creates main base.
rank = m_engine->CreateObject();
m_engine->SetObjectType(rank, TYPEVEHICULE); // this is a moving object
m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_VEHICULE); // this is a moving object
m_object->SetObjectRank(0, rank);
pModFile->ReadModel("objects\\mother1.mod");
@ -94,7 +94,7 @@ bool CMotionMother::Create(Math::Vector pos, float angle, ObjectType type,
// Creates the head.
rank = m_engine->CreateObject();
m_engine->SetObjectType(rank, TYPEDESCENDANT);
m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_DESCENDANT);
m_object->SetObjectRank(1, rank);
m_object->SetObjectParent(1, 0);
pModFile->ReadModel("objects\\mother2.mod");
@ -103,7 +103,7 @@ bool CMotionMother::Create(Math::Vector pos, float angle, ObjectType type,
// Creates a right-back leg.
rank = m_engine->CreateObject();
m_engine->SetObjectType(rank, TYPEDESCENDANT);
m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_DESCENDANT);
m_object->SetObjectRank(2, rank);
m_object->SetObjectParent(2, 0);
pModFile->ReadModel("objects\\mother3.mod");
@ -112,7 +112,7 @@ bool CMotionMother::Create(Math::Vector pos, float angle, ObjectType type,
// Creates a right-back foot.
rank = m_engine->CreateObject();
m_engine->SetObjectType(rank, TYPEDESCENDANT);
m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_DESCENDANT);
m_object->SetObjectRank(3, rank);
m_object->SetObjectParent(3, 2);
pModFile->ReadModel("objects\\mother4.mod");
@ -121,7 +121,7 @@ bool CMotionMother::Create(Math::Vector pos, float angle, ObjectType type,
// Creates a middle-right leg.
rank = m_engine->CreateObject();
m_engine->SetObjectType(rank, TYPEDESCENDANT);
m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_DESCENDANT);
m_object->SetObjectRank(4, rank);
m_object->SetObjectParent(4, 0);
pModFile->ReadModel("objects\\mother3.mod");
@ -130,7 +130,7 @@ bool CMotionMother::Create(Math::Vector pos, float angle, ObjectType type,
// Creates a middle-right foot.
rank = m_engine->CreateObject();
m_engine->SetObjectType(rank, TYPEDESCENDANT);
m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_DESCENDANT);
m_object->SetObjectRank(5, rank);
m_object->SetObjectParent(5, 4);
pModFile->ReadModel("objects\\mother4.mod");
@ -139,7 +139,7 @@ bool CMotionMother::Create(Math::Vector pos, float angle, ObjectType type,
// Creates a right-front leg.
rank = m_engine->CreateObject();
m_engine->SetObjectType(rank, TYPEDESCENDANT);
m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_DESCENDANT);
m_object->SetObjectRank(6, rank);
m_object->SetObjectParent(6, 0);
pModFile->ReadModel("objects\\mother3.mod");
@ -148,7 +148,7 @@ bool CMotionMother::Create(Math::Vector pos, float angle, ObjectType type,
// Creates a right-front foot.
rank = m_engine->CreateObject();
m_engine->SetObjectType(rank, TYPEDESCENDANT);
m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_DESCENDANT);
m_object->SetObjectRank(7, rank);
m_object->SetObjectParent(7, 6);
pModFile->ReadModel("objects\\mother4.mod");
@ -157,7 +157,7 @@ bool CMotionMother::Create(Math::Vector pos, float angle, ObjectType type,
// Creates a left-back leg.
rank = m_engine->CreateObject();
m_engine->SetObjectType(rank, TYPEDESCENDANT);
m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_DESCENDANT);
m_object->SetObjectRank(8, rank);
m_object->SetObjectParent(8, 0);
pModFile->ReadModel("objects\\mother3.mod");
@ -167,7 +167,7 @@ bool CMotionMother::Create(Math::Vector pos, float angle, ObjectType type,
// Creates a left-back foot.
rank = m_engine->CreateObject();
m_engine->SetObjectType(rank, TYPEDESCENDANT);
m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_DESCENDANT);
m_object->SetObjectRank(9, rank);
m_object->SetObjectParent(9, 8);
pModFile->ReadModel("objects\\mother4.mod");
@ -176,7 +176,7 @@ bool CMotionMother::Create(Math::Vector pos, float angle, ObjectType type,
// Creates a middle-left leg.
rank = m_engine->CreateObject();
m_engine->SetObjectType(rank, TYPEDESCENDANT);
m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_DESCENDANT);
m_object->SetObjectRank(10, rank);
m_object->SetObjectParent(10, 0);
pModFile->ReadModel("objects\\mother3.mod");
@ -186,7 +186,7 @@ bool CMotionMother::Create(Math::Vector pos, float angle, ObjectType type,
// Creates a middle-left foot.
rank = m_engine->CreateObject();
m_engine->SetObjectType(rank, TYPEDESCENDANT);
m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_DESCENDANT);
m_object->SetObjectRank(11, rank);
m_object->SetObjectParent(11, 10);
pModFile->ReadModel("objects\\mother4.mod");
@ -195,7 +195,7 @@ bool CMotionMother::Create(Math::Vector pos, float angle, ObjectType type,
// Creates a left-front leg.
rank = m_engine->CreateObject();
m_engine->SetObjectType(rank, TYPEDESCENDANT);
m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_DESCENDANT);
m_object->SetObjectRank(12, rank);
m_object->SetObjectParent(12, 0);
pModFile->ReadModel("objects\\mother3.mod");
@ -205,7 +205,7 @@ bool CMotionMother::Create(Math::Vector pos, float angle, ObjectType type,
// Creates a left-front foot.
rank = m_engine->CreateObject();
m_engine->SetObjectType(rank, TYPEDESCENDANT);
m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_DESCENDANT);
m_object->SetObjectRank(13, rank);
m_object->SetObjectParent(13, 12);
pModFile->ReadModel("objects\\mother4.mod");
@ -214,7 +214,7 @@ bool CMotionMother::Create(Math::Vector pos, float angle, ObjectType type,
// Creates the right antenna.
rank = m_engine->CreateObject();
m_engine->SetObjectType(rank, TYPEDESCENDANT);
m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_DESCENDANT);
m_object->SetObjectRank(14, rank);
m_object->SetObjectParent(14, 1);
pModFile->ReadModel("objects\\mother5.mod");
@ -222,7 +222,7 @@ bool CMotionMother::Create(Math::Vector pos, float angle, ObjectType type,
m_object->SetPosition(14, Math::Vector(6.0f, 1.0f, -2.5f));
rank = m_engine->CreateObject();
m_engine->SetObjectType(rank, TYPEDESCENDANT);
m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_DESCENDANT);
m_object->SetObjectRank(15, rank);
m_object->SetObjectParent(15, 14);
pModFile->ReadModel("objects\\mother6.mod");
@ -231,7 +231,7 @@ bool CMotionMother::Create(Math::Vector pos, float angle, ObjectType type,
// Creates the left antenna.
rank = m_engine->CreateObject();
m_engine->SetObjectType(rank, TYPEDESCENDANT);
m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_DESCENDANT);
m_object->SetObjectRank(16, rank);
m_object->SetObjectParent(16, 1);
pModFile->ReadModel("objects\\mother5.mod");
@ -239,7 +239,7 @@ bool CMotionMother::Create(Math::Vector pos, float angle, ObjectType type,
m_object->SetPosition(16, Math::Vector(6.0f, 1.0f, 2.5f));
rank = m_engine->CreateObject();
m_engine->SetObjectType(rank, TYPEDESCENDANT);
m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_DESCENDANT);
m_object->SetObjectRank(17, rank);
m_object->SetObjectParent(17, 16);
pModFile->ReadModel("objects\\mother6.mod");
@ -248,7 +248,7 @@ bool CMotionMother::Create(Math::Vector pos, float angle, ObjectType type,
// Creates the right claw.
rank = m_engine->CreateObject();
m_engine->SetObjectType(rank, TYPEDESCENDANT);
m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_DESCENDANT);
m_object->SetObjectRank(18, rank);
m_object->SetObjectParent(18, 1);
pModFile->ReadModel("objects\\mother7.mod");
@ -258,7 +258,7 @@ bool CMotionMother::Create(Math::Vector pos, float angle, ObjectType type,
// Creates the left claw.
rank = m_engine->CreateObject();
m_engine->SetObjectType(rank, TYPEDESCENDANT);
m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_DESCENDANT);
m_object->SetObjectRank(19, rank);
m_object->SetObjectParent(19, 1);
pModFile->ReadModel("objects\\mother7.mod");
@ -272,10 +272,10 @@ bool CMotionMother::Create(Math::Vector pos, float angle, ObjectType type,
CreatePhysics();
m_object->SetFloorHeight(0.0f);
pos = m_object->RetPosition(0);
pos = m_object->GetPosition(0);
m_object->SetPosition(0, pos); // to display the shadows immediately
m_engine->LoadAllTexture();
m_engine->LoadAllTextures();
delete pModFile;
return true;
@ -306,7 +306,7 @@ void CMotionMother::CreatePhysics()
m_physics->SetType(TYPE_ROLLING);
character = m_object->RetCharacter();
character = m_object->GetCharacter();
character->wheelFront = 10.0f;
character->wheelBack = 10.0f;
character->wheelLeft = 20.0f;
@ -343,12 +343,12 @@ bool CMotionMother::EventProcess(const Event &event)
{
CMotion::EventProcess(event);
if ( event.event == EVENT_FRAME )
if ( event.type == EVENT_FRAME )
{
return EventFrame(event);
}
if ( event.event == EVENT_KEYDOWN )
if ( event.type == EVENT_KEY_DOWN )
{
#if ADJUST_ANGLE
int i;
@ -390,11 +390,11 @@ bool CMotionMother::EventFrame(const Event &event)
int i, st, nd;
bool bStop;
if ( m_engine->RetPause() ) return true;
if ( !m_engine->IsVisiblePoint(m_object->RetPosition(0)) ) return true;
if ( m_engine->GetPause() ) return true;
if ( !m_engine->IsVisiblePoint(m_object->GetPosition(0)) ) return true;
s = m_physics->RetLinMotionX(MO_MOTSPEED)*1.5f;
a = fabs(m_physics->RetCirMotionY(MO_MOTSPEED)*26.0f);
s = m_physics->GetLinMotionX(MO_MOTSPEED)*1.5f;
a = fabs(m_physics->GetCirMotionY(MO_MOTSPEED)*26.0f);
if ( s == 0.0f && a != 0.0f ) a *= 1.5f;
@ -418,7 +418,7 @@ bool CMotionMother::EventFrame(const Event &event)
else prog = Math::Mod(m_armMember+(2.0f-(i%3))*0.33f+0.3f, 1.0f);
if ( m_bArmStop )
{
prog = (float)m_armTimeIndex/3.0f;
prog = static_cast< float >(m_armTimeIndex/3.0f);
}
if ( prog < 0.33f ) // t0..t1 ?
{
@ -461,7 +461,7 @@ bool CMotionMother::EventFrame(const Event &event)
}
#if ADJUST_ANGLE
if ( m_object->RetSelect() )
if ( m_object->GetSelect() )
{
char s[100];
sprintf(s, "A:time=%d Q:part=%d W:member=%d", m_armTimeIndex, m_armPartIndex, m_armMemberIndex);
@ -469,7 +469,7 @@ bool CMotionMother::EventFrame(const Event &event)
}
#endif
if ( !bStop && !m_object->RetRuin() )
if ( !bStop && !m_object->GetRuin() )
{
a = Math::Mod(m_armTimeMarch, 1.0f);
if ( a < 0.5f ) a = -1.0f+4.0f*a; // -1..1

View File

@ -21,8 +21,8 @@
#include "object/motion/motionspider.h"
#include "old/modfile.h"
#include "old/particule.h"
#include "graphics/engine/modelfile.h"
#include "graphics/engine/particle.h"
#include "physics/physics.h"
@ -46,7 +46,7 @@ CMotionSpider::CMotionSpider(CInstanceManager* iMan, CObject* object)
m_armMemberIndex = 0;
m_armLastAction = -1;
m_bArmStop = false;
m_lastParticule = 0.0f;
m_lastParticle = 0.0f;
}
// Object's destructor.
@ -68,7 +68,7 @@ void CMotionSpider::DeleteObject(bool bAll)
bool CMotionSpider::Create(Math::Vector pos, float angle, ObjectType type,
float power)
{
CModFile* pModFile;
Gfx::CModelFile* pModFile;
int rank, i, j, parent;
char name[50];
@ -96,15 +96,15 @@ bool CMotionSpider::Create(Math::Vector pos, float angle, ObjectType type,
0.0f, 0.0f, -2.0f,
};
if ( m_engine->RetRestCreate() < 3+32+2 ) return false;
// if ( m_engine->GetRestCreate() < 3+32+2 ) return false;
pModFile = new CModFile(m_iMan);
pModFile = new Gfx::CModelFile(m_iMan);
m_object->SetType(type);
// Creates the main base.
rank = m_engine->CreateObject();
m_engine->SetObjectType(rank, TYPEVEHICULE); // this is a moving object
m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_VEHICULE); // this is a moving object
m_object->SetObjectRank(0, rank);
pModFile->ReadModel("objects\\spider0.mod"); // doesn't exist
pModFile->CreateEngineObject(rank);
@ -118,7 +118,7 @@ bool CMotionSpider::Create(Math::Vector pos, float angle, ObjectType type,
// Creates the abdomen.
rank = m_engine->CreateObject();
m_engine->SetObjectType(rank, TYPEDESCENDANT);
m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_DESCENDANT);
m_object->SetObjectRank(1, rank);
m_object->SetObjectParent(1, 0);
pModFile->ReadModel("objects\\spider1.mod");
@ -127,7 +127,7 @@ bool CMotionSpider::Create(Math::Vector pos, float angle, ObjectType type,
// Creates the head.
rank = m_engine->CreateObject();
m_engine->SetObjectType(rank, TYPEDESCENDANT);
m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_DESCENDANT);
m_object->SetObjectRank(2, rank);
m_object->SetObjectParent(2, 0);
pModFile->ReadModel("objects\\spider2.mod");
@ -143,7 +143,7 @@ bool CMotionSpider::Create(Math::Vector pos, float angle, ObjectType type,
// Creates the right leg.
rank = m_engine->CreateObject();
m_engine->SetObjectType(rank, TYPEDESCENDANT);
m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_DESCENDANT);
m_object->SetObjectRank(3+i*4+j, rank);
if ( j == 0 ) parent = 0;
else parent = 3+i*4+j-1;
@ -157,7 +157,7 @@ bool CMotionSpider::Create(Math::Vector pos, float angle, ObjectType type,
// Creates the left leg.
rank = m_engine->CreateObject();
m_engine->SetObjectType(rank, TYPEDESCENDANT);
m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_DESCENDANT);
m_object->SetObjectRank(19+i*4+j, rank);
if ( j == 0 ) parent = 0;
else parent = 19+i*4+j-1;
@ -174,7 +174,7 @@ bool CMotionSpider::Create(Math::Vector pos, float angle, ObjectType type,
// Creates the right mandible.
rank = m_engine->CreateObject();
m_engine->SetObjectType(rank, TYPEDESCENDANT);
m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_DESCENDANT);
m_object->SetObjectRank(35, rank);
m_object->SetObjectParent(35, 1);
pModFile->ReadModel("objects\\spider7.mod");
@ -183,7 +183,7 @@ bool CMotionSpider::Create(Math::Vector pos, float angle, ObjectType type,
// Creates the left mandible.
rank = m_engine->CreateObject();
m_engine->SetObjectType(rank, TYPEDESCENDANT);
m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_DESCENDANT);
m_object->SetObjectRank(36, rank);
m_object->SetObjectParent(36, 1);
pModFile->ReadModel("objects\\spider7.mod");
@ -196,10 +196,10 @@ bool CMotionSpider::Create(Math::Vector pos, float angle, ObjectType type,
CreatePhysics();
m_object->SetFloorHeight(0.0f);
pos = m_object->RetPosition(0);
pos = m_object->GetPosition(0);
m_object->SetPosition(0, pos); // to display the shadows immediately
m_engine->LoadAllTexture();
m_engine->LoadAllTextures();
delete pModFile;
return true;
@ -286,7 +286,7 @@ void CMotionSpider::CreatePhysics()
m_physics->SetType(TYPE_ROLLING);
character = m_object->RetCharacter();
character = m_object->GetCharacter();
character->wheelFront = 4.0f;
character->wheelBack = 4.0f;
character->wheelLeft = 6.0f;
@ -331,12 +331,12 @@ bool CMotionSpider::EventProcess(const Event &event)
{
CMotion::EventProcess(event);
if ( event.event == EVENT_FRAME )
if ( event.type == EVENT_FRAME )
{
return EventFrame(event);
}
if ( event.event == EVENT_KEYDOWN )
if ( event.type == EVENT_KEY_DOWN )
{
#if ADJUST_ANGLE
int i;
@ -381,11 +381,11 @@ bool CMotionSpider::EventFrame(const Event &event)
int i, ii, st, nd, action;
bool bStop;
if ( m_engine->RetPause() ) return true;
if ( !m_engine->IsVisiblePoint(m_object->RetPosition(0)) ) return true;
if ( m_engine->GetPause() ) return true;
if ( !m_engine->IsVisiblePoint(m_object->GetPosition(0)) ) return true;
s = m_physics->RetLinMotionX(MO_MOTSPEED)*1.5f;
a = fabs(m_physics->RetCirMotionY(MO_MOTSPEED)*2.0f);
s = m_physics->GetLinMotionX(MO_MOTSPEED)*1.5f;
a = fabs(m_physics->GetCirMotionY(MO_MOTSPEED)*2.0f);
if ( s == 0.0f && a != 0.0f ) a *= 1.5f;
@ -410,13 +410,13 @@ bool CMotionSpider::EventFrame(const Event &event)
m_armMember += a;
}
if ( m_object->RetRuin() ) // destroyed?
if ( m_object->GetRuin() ) // destroyed?
{
m_actionType = MSS_RUIN;
}
if ( m_object->RetBurn() ) // burning?
if ( m_object->GetBurn() ) // burning?
{
if ( m_object->RetFixed() )
if ( m_object->GetFixed() )
{
m_actionType = MSS_BURN;
}
@ -443,7 +443,7 @@ bool CMotionSpider::EventFrame(const Event &event)
else prog = Math::Mod(m_armMember+(2.0f-(i%4))*0.25f+0.5f, 1.0f);
if ( m_bArmStop )
{
prog = (float)m_armTimeIndex/3.0f;
prog = static_cast< float >(m_armTimeIndex/3.0f);
action = MS_MARCH;
}
if ( prog < 0.33f ) // t0..t1 ?
@ -511,38 +511,38 @@ bool CMotionSpider::EventFrame(const Event &event)
if ( i < 4 ) // right leg (1..4) ?
{
m_object->SetAngleX(3+4*i+0, Math::Smooth(m_object->RetAngleX(3+4*i+0), Math::PropAngle(tSt[ 0], tNd[ 0], prog), time));
m_object->SetAngleY(3+4*i+0, Math::Smooth(m_object->RetAngleY(3+4*i+0), Math::PropAngle(tSt[ 1], tNd[ 1], prog), time));
m_object->SetAngleZ(3+4*i+0, Math::Smooth(m_object->RetAngleZ(3+4*i+0), Math::PropAngle(tSt[ 2], tNd[ 2], prog), time));
m_object->SetAngleX(3+4*i+1, Math::Smooth(m_object->RetAngleX(3+4*i+1), Math::PropAngle(tSt[ 3], tNd[ 3], prog), time));
m_object->SetAngleY(3+4*i+1, Math::Smooth(m_object->RetAngleY(3+4*i+1), Math::PropAngle(tSt[ 4], tNd[ 4], prog), time));
m_object->SetAngleZ(3+4*i+1, Math::Smooth(m_object->RetAngleZ(3+4*i+1), Math::PropAngle(tSt[ 5], tNd[ 5], prog), time));
m_object->SetAngleX(3+4*i+2, Math::Smooth(m_object->RetAngleX(3+4*i+2), Math::PropAngle(tSt[ 6], tNd[ 6], prog), time));
m_object->SetAngleY(3+4*i+2, Math::Smooth(m_object->RetAngleY(3+4*i+2), Math::PropAngle(tSt[ 7], tNd[ 7], prog), time));
m_object->SetAngleZ(3+4*i+2, Math::Smooth(m_object->RetAngleZ(3+4*i+2), Math::PropAngle(tSt[ 8], tNd[ 8], prog), time));
m_object->SetAngleX(3+4*i+3, Math::Smooth(m_object->RetAngleX(3+4*i+3), Math::PropAngle(tSt[ 9], tNd[ 9], prog), time));
m_object->SetAngleY(3+4*i+3, Math::Smooth(m_object->RetAngleY(3+4*i+3), Math::PropAngle(tSt[10], tNd[10], prog), time));
m_object->SetAngleZ(3+4*i+3, Math::Smooth(m_object->RetAngleZ(3+4*i+3), Math::PropAngle(tSt[11], tNd[11], prog), time));
m_object->SetAngleX(3+4*i+0, Math::Smooth(m_object->GetAngleX(3+4*i+0), Math::PropAngle(tSt[ 0], tNd[ 0], prog), time));
m_object->SetAngleY(3+4*i+0, Math::Smooth(m_object->GetAngleY(3+4*i+0), Math::PropAngle(tSt[ 1], tNd[ 1], prog), time));
m_object->SetAngleZ(3+4*i+0, Math::Smooth(m_object->GetAngleZ(3+4*i+0), Math::PropAngle(tSt[ 2], tNd[ 2], prog), time));
m_object->SetAngleX(3+4*i+1, Math::Smooth(m_object->GetAngleX(3+4*i+1), Math::PropAngle(tSt[ 3], tNd[ 3], prog), time));
m_object->SetAngleY(3+4*i+1, Math::Smooth(m_object->GetAngleY(3+4*i+1), Math::PropAngle(tSt[ 4], tNd[ 4], prog), time));
m_object->SetAngleZ(3+4*i+1, Math::Smooth(m_object->GetAngleZ(3+4*i+1), Math::PropAngle(tSt[ 5], tNd[ 5], prog), time));
m_object->SetAngleX(3+4*i+2, Math::Smooth(m_object->GetAngleX(3+4*i+2), Math::PropAngle(tSt[ 6], tNd[ 6], prog), time));
m_object->SetAngleY(3+4*i+2, Math::Smooth(m_object->GetAngleY(3+4*i+2), Math::PropAngle(tSt[ 7], tNd[ 7], prog), time));
m_object->SetAngleZ(3+4*i+2, Math::Smooth(m_object->GetAngleZ(3+4*i+2), Math::PropAngle(tSt[ 8], tNd[ 8], prog), time));
m_object->SetAngleX(3+4*i+3, Math::Smooth(m_object->GetAngleX(3+4*i+3), Math::PropAngle(tSt[ 9], tNd[ 9], prog), time));
m_object->SetAngleY(3+4*i+3, Math::Smooth(m_object->GetAngleY(3+4*i+3), Math::PropAngle(tSt[10], tNd[10], prog), time));
m_object->SetAngleZ(3+4*i+3, Math::Smooth(m_object->GetAngleZ(3+4*i+3), Math::PropAngle(tSt[11], tNd[11], prog), time));
}
else // left leg (5..8) ?
{
m_object->SetAngleX(3+4*i+0, Math::Smooth(m_object->RetAngleX(3+4*i+0), Math::PropAngle(-tSt[ 0], -tNd[ 0], prog), time));
m_object->SetAngleY(3+4*i+0, Math::Smooth(m_object->RetAngleY(3+4*i+0), Math::PropAngle(-tSt[ 1], -tNd[ 1], prog), time));
m_object->SetAngleZ(3+4*i+0, Math::Smooth(m_object->RetAngleZ(3+4*i+0), Math::PropAngle( tSt[ 2], tNd[ 2], prog), time));
m_object->SetAngleX(3+4*i+1, Math::Smooth(m_object->RetAngleX(3+4*i+1), Math::PropAngle(-tSt[ 3], -tNd[ 3], prog), time));
m_object->SetAngleY(3+4*i+1, Math::Smooth(m_object->RetAngleY(3+4*i+1), Math::PropAngle(-tSt[ 4], -tNd[ 4], prog), time));
m_object->SetAngleZ(3+4*i+1, Math::Smooth(m_object->RetAngleZ(3+4*i+1), Math::PropAngle( tSt[ 5], tNd[ 5], prog), time));
m_object->SetAngleX(3+4*i+2, Math::Smooth(m_object->RetAngleX(3+4*i+2), Math::PropAngle(-tSt[ 6], -tNd[ 6], prog), time));
m_object->SetAngleY(3+4*i+2, Math::Smooth(m_object->RetAngleY(3+4*i+2), Math::PropAngle(-tSt[ 7], -tNd[ 7], prog), time));
m_object->SetAngleZ(3+4*i+2, Math::Smooth(m_object->RetAngleZ(3+4*i+2), Math::PropAngle( tSt[ 8], tNd[ 8], prog), time));
m_object->SetAngleX(3+4*i+3, Math::Smooth(m_object->RetAngleX(3+4*i+3), Math::PropAngle(-tSt[ 9], -tNd[ 9], prog), time));
m_object->SetAngleY(3+4*i+3, Math::Smooth(m_object->RetAngleY(3+4*i+3), Math::PropAngle(-tSt[10], -tNd[10], prog), time));
m_object->SetAngleZ(3+4*i+3, Math::Smooth(m_object->RetAngleZ(3+4*i+3), Math::PropAngle( tSt[11], tNd[11], prog), time));
m_object->SetAngleX(3+4*i+0, Math::Smooth(m_object->GetAngleX(3+4*i+0), Math::PropAngle(-tSt[ 0], -tNd[ 0], prog), time));
m_object->SetAngleY(3+4*i+0, Math::Smooth(m_object->GetAngleY(3+4*i+0), Math::PropAngle(-tSt[ 1], -tNd[ 1], prog), time));
m_object->SetAngleZ(3+4*i+0, Math::Smooth(m_object->GetAngleZ(3+4*i+0), Math::PropAngle( tSt[ 2], tNd[ 2], prog), time));
m_object->SetAngleX(3+4*i+1, Math::Smooth(m_object->GetAngleX(3+4*i+1), Math::PropAngle(-tSt[ 3], -tNd[ 3], prog), time));
m_object->SetAngleY(3+4*i+1, Math::Smooth(m_object->GetAngleY(3+4*i+1), Math::PropAngle(-tSt[ 4], -tNd[ 4], prog), time));
m_object->SetAngleZ(3+4*i+1, Math::Smooth(m_object->GetAngleZ(3+4*i+1), Math::PropAngle( tSt[ 5], tNd[ 5], prog), time));
m_object->SetAngleX(3+4*i+2, Math::Smooth(m_object->GetAngleX(3+4*i+2), Math::PropAngle(-tSt[ 6], -tNd[ 6], prog), time));
m_object->SetAngleY(3+4*i+2, Math::Smooth(m_object->GetAngleY(3+4*i+2), Math::PropAngle(-tSt[ 7], -tNd[ 7], prog), time));
m_object->SetAngleZ(3+4*i+2, Math::Smooth(m_object->GetAngleZ(3+4*i+2), Math::PropAngle( tSt[ 8], tNd[ 8], prog), time));
m_object->SetAngleX(3+4*i+3, Math::Smooth(m_object->GetAngleX(3+4*i+3), Math::PropAngle(-tSt[ 9], -tNd[ 9], prog), time));
m_object->SetAngleY(3+4*i+3, Math::Smooth(m_object->GetAngleY(3+4*i+3), Math::PropAngle(-tSt[10], -tNd[10], prog), time));
m_object->SetAngleZ(3+4*i+3, Math::Smooth(m_object->GetAngleZ(3+4*i+3), Math::PropAngle( tSt[11], tNd[11], prog), time));
}
}
#if ADJUST_ANGLE
if ( m_object->RetSelect() )
if ( m_object->GetSelect() )
{
char s[100];
sprintf(s, "A:time=%d Q:part=%d W:member=%d", m_armTimeIndex, m_armPartIndex, m_armMemberIndex);
@ -559,7 +559,7 @@ bool CMotionSpider::EventFrame(const Event &event)
SetInclinaison(dir);
time = event.rTime*1.0f;
m_object->SetAngleZ(1, Math::Smooth(m_object->RetAngleZ(1), 0.0f, time)); // head
m_object->SetAngleZ(1, Math::Smooth(m_object->GetAngleZ(1), 0.0f, time)); // head
}
else if ( m_actionType == MSS_RUIN ) // destroyed?
{
@ -581,17 +581,17 @@ bool CMotionSpider::EventFrame(const Event &event)
}
else if ( m_actionType == MSS_BACK1 ) // turns on the back?
{
if ( m_lastParticule+m_engine->ParticuleAdapt(0.05f) <= m_armTimeAbs )
if ( m_lastParticle+m_engine->ParticleAdapt(0.05f) <= m_armTimeAbs )
{
m_lastParticule = m_armTimeAbs;
m_lastParticle = m_armTimeAbs;
pos = m_object->RetPosition(0);
pos = m_object->GetPosition(0);
speed.x = (Math::Rand()-0.5f)*10.0f;
speed.z = (Math::Rand()-0.5f)*10.0f;
speed.y = Math::Rand()*5.0f;
dim.x = Math::Rand()*3.0f+2.0f;
dim.y = dim.x;
m_particule->CreateParticule(pos, speed, dim, PARTICRASH, 2.0f);
m_particle->CreateParticle(pos, speed, dim, Gfx::PARTICRASH, 2.0f);
}
if ( m_progress < 0.5f )
@ -623,13 +623,13 @@ bool CMotionSpider::EventFrame(const Event &event)
}
else if ( m_actionType == MSS_BACK2 ) // moves on the back?
{
if ( m_lastParticule+m_engine->ParticuleAdapt(0.05f) <= m_armTimeAbs )
if ( m_lastParticle+m_engine->ParticleAdapt(0.05f) <= m_armTimeAbs )
{
m_lastParticule = m_armTimeAbs;
m_lastParticle = m_armTimeAbs;
if ( rand()%10 == 0 )
{
pos = m_object->RetPosition(0);
pos = m_object->GetPosition(0);
pos.x += (Math::Rand()-0.5f)*8.0f;
pos.z += (Math::Rand()-0.5f)*8.0f;
pos.y -= 1.0f;
@ -638,7 +638,7 @@ bool CMotionSpider::EventFrame(const Event &event)
speed.y = Math::Rand()*2.0f;
dim.x = Math::Rand()*1.0f+1.0f;
dim.y = dim.x;
m_particule->CreateParticule(pos, speed, dim, PARTICRASH, 2.0f);
m_particle->CreateParticle(pos, speed, dim, Gfx::PARTICRASH, 2.0f);
}
}
@ -672,17 +672,17 @@ bool CMotionSpider::EventFrame(const Event &event)
}
else if ( m_actionType == MSS_BACK3 ) // recovers on the legs?
{
if ( m_lastParticule+m_engine->ParticuleAdapt(0.05f) <= m_armTimeAbs )
if ( m_lastParticle+m_engine->ParticleAdapt(0.05f) <= m_armTimeAbs )
{
m_lastParticule = m_armTimeAbs;
m_lastParticle = m_armTimeAbs;
pos = m_object->RetPosition(0);
pos = m_object->GetPosition(0);
speed.x = (Math::Rand()-0.5f)*10.0f;
speed.z = (Math::Rand()-0.5f)*10.0f;
speed.y = Math::Rand()*5.0f;
dim.x = Math::Rand()*3.0f+2.0f;
dim.y = dim.x;
m_particule->CreateParticule(pos, speed, dim, PARTICRASH, 2.0f);
m_particle->CreateParticle(pos, speed, dim, Gfx::PARTICRASH, 2.0f);
}
if ( m_progress < 0.5f )

View File

@ -66,6 +66,6 @@ protected:
int m_armMemberIndex;
int m_armLastAction;
bool m_bArmStop;
float m_lastParticule;
float m_lastParticle;
};

View File

@ -22,9 +22,9 @@
#include "object/motion/motiontoto.h"
#include "math/geometry.h"
#include "old/terrain.h"
#include "old/water.h"
#include "old/modfile.h"
#include "graphics/engine/terrain.h"
#include "graphics/engine/water.h"
#include "graphics/engine/modelfile.h"
#include "object/robotmain.h"
@ -49,7 +49,7 @@ CMotionToto::CMotionToto(CInstanceManager* iMan, CObject* object)
m_clownTime = 0.0f;
m_blinkTime = 0.0f;
m_blinkProgress = -1.0f;
m_lastMotorParticule = 0.0f;
m_lastMotorParticle = 0.0f;
m_type = OBJECT_NULL;
m_mousePos = Math::Point(0.0f, 0.0f);
}
@ -78,18 +78,18 @@ void CMotionToto::DeleteObject(bool bAll)
bool CMotionToto::Create(Math::Vector pos, float angle, ObjectType type,
float power)
{
CModFile* pModFile;
Gfx::CModelFile* pModFile;
int rank;
if ( m_engine->RetRestCreate() < 10 ) return false;
// if ( m_engine->GetRestCreate() < 10 ) return false;
pModFile = new CModFile(m_iMan);
pModFile = new Gfx::CModelFile(m_iMan);
m_object->SetType(type);
// Creates the head.
rank = m_engine->CreateObject();
m_engine->SetObjectType(rank, TYPEVEHICULE); // this is a moving object
m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_VEHICULE); // this is a moving object
m_object->SetObjectRank(0, rank);
pModFile->ReadModel("objects\\toto1.mod");
pModFile->CreateEngineObject(rank);
@ -98,7 +98,7 @@ bool CMotionToto::Create(Math::Vector pos, float angle, ObjectType type,
// Creates mouth.
rank = m_engine->CreateObject();
m_engine->SetObjectType(rank, TYPEDESCENDANT);
m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_DESCENDANT);
m_object->SetObjectRank(1, rank);
m_object->SetObjectParent(1, 0);
pModFile->ReadModel("objects\\toto2.mod");
@ -107,7 +107,7 @@ bool CMotionToto::Create(Math::Vector pos, float angle, ObjectType type,
// Creates the left eye.
rank = m_engine->CreateObject();
m_engine->SetObjectType(rank, TYPEDESCENDANT);
m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_DESCENDANT);
m_object->SetObjectRank(2, rank);
m_object->SetObjectParent(2, 0);
pModFile->ReadModel("objects\\toto3.mod");
@ -118,7 +118,7 @@ bool CMotionToto::Create(Math::Vector pos, float angle, ObjectType type,
// Creates the right eye.
rank = m_engine->CreateObject();
m_engine->SetObjectType(rank, TYPEDESCENDANT);
m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_DESCENDANT);
m_object->SetObjectRank(3, rank);
m_object->SetObjectParent(3, 0);
pModFile->ReadModel("objects\\toto3.mod");
@ -128,7 +128,7 @@ bool CMotionToto::Create(Math::Vector pos, float angle, ObjectType type,
// Creates left antenna.
rank = m_engine->CreateObject();
m_engine->SetObjectType(rank, TYPEDESCENDANT);
m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_DESCENDANT);
m_object->SetObjectRank(4, rank);
m_object->SetObjectParent(4, 0);
pModFile->ReadModel("objects\\toto4.mod");
@ -137,7 +137,7 @@ bool CMotionToto::Create(Math::Vector pos, float angle, ObjectType type,
m_object->SetAngleX(4, 30.0f*Math::PI/180.0f);
rank = m_engine->CreateObject();
m_engine->SetObjectType(rank, TYPEDESCENDANT);
m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_DESCENDANT);
m_object->SetObjectRank(5, rank);
m_object->SetObjectParent(5, 4);
pModFile->ReadModel("objects\\toto4.mod");
@ -146,7 +146,7 @@ bool CMotionToto::Create(Math::Vector pos, float angle, ObjectType type,
m_object->SetAngleX(5, 30.0f*Math::PI/180.0f);
rank = m_engine->CreateObject();
m_engine->SetObjectType(rank, TYPEDESCENDANT);
m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_DESCENDANT);
m_object->SetObjectRank(6, rank);
m_object->SetObjectParent(6, 5);
pModFile->ReadModel("objects\\toto5.mod");
@ -156,7 +156,7 @@ bool CMotionToto::Create(Math::Vector pos, float angle, ObjectType type,
// Creates right antenna.
rank = m_engine->CreateObject();
m_engine->SetObjectType(rank, TYPEDESCENDANT);
m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_DESCENDANT);
m_object->SetObjectRank(7, rank);
m_object->SetObjectParent(7, 0);
pModFile->ReadModel("objects\\toto4.mod");
@ -165,7 +165,7 @@ bool CMotionToto::Create(Math::Vector pos, float angle, ObjectType type,
m_object->SetAngleX(7, -30.0f*Math::PI/180.0f);
rank = m_engine->CreateObject();
m_engine->SetObjectType(rank, TYPEDESCENDANT);
m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_DESCENDANT);
m_object->SetObjectRank(8, rank);
m_object->SetObjectParent(8, 7);
pModFile->ReadModel("objects\\toto4.mod");
@ -174,7 +174,7 @@ bool CMotionToto::Create(Math::Vector pos, float angle, ObjectType type,
m_object->SetAngleX(8, -30.0f*Math::PI/180.0f);
rank = m_engine->CreateObject();
m_engine->SetObjectType(rank, TYPEDESCENDANT);
m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_DESCENDANT);
m_object->SetObjectRank(9, rank);
m_object->SetObjectParent(9, 8);
pModFile->ReadModel("objects\\toto5.mod");
@ -185,10 +185,10 @@ bool CMotionToto::Create(Math::Vector pos, float angle, ObjectType type,
m_object->SetZoom(0, 0.5f); // is little
m_object->SetFloorHeight(0.0f);
pos = m_object->RetPosition(0);
pos = m_object->GetPosition(0);
m_object->SetPosition(0, pos); // to display the shadows immediately
m_engine->LoadAllTexture();
m_engine->LoadAllTextures();
delete pModFile;
return true;
@ -233,7 +233,7 @@ bool CMotionToto::EventProcess(const Event &event)
{
CMotion::EventProcess(event);
if ( event.event == EVENT_FRAME )
if ( event.type == EVENT_FRAME )
{
return EventFrame(event);
}
@ -249,15 +249,15 @@ bool CMotionToto::EventFrame(const Event &event)
Math::Vector eye, lookat, dir, perp, nPos, aPos, pos, speed;
Math::Vector vibLin, vibCir, dirSpeed, aAntenna;
Math::Point dim;
POINT wDim;
ParticuleType type;
Math::IntPoint wDim;
Gfx::ParticleType type;
float progress, focus, distance, shift, verti, level, zoom;
float aAngle, nAngle, mAngle, angle, linSpeed, cirSpeed;
int sheet, i, r;
bool bHidden;
if ( m_engine->RetPause() &&
!m_main->RetInfoLock() ) return true;
if ( m_engine->GetPause() &&
!m_main->GetInfoLock() ) return true;
if ( m_bDisplayInfo ) // "looks" mouse?
{
@ -267,13 +267,13 @@ bool CMotionToto::EventFrame(const Event &event)
{
bHidden = false;
if ( m_main->RetMovieLock() ) // current movie?
if ( m_main->GetMovieLock() ) // current movie?
{
bHidden = true;
}
if ( !m_engine->RetTotoMode() )
if ( !m_engine->GetTotoMode() )
{
if ( !m_main->RetEditLock() ) // current edition?
if ( !m_main->GetEditLock() ) // current edition?
{
bHidden = true;
}
@ -282,8 +282,8 @@ bool CMotionToto::EventFrame(const Event &event)
if ( bHidden )
{
nPos = m_object->RetPosition(0);
m_terrain->MoveOnFloor(nPos, true);
nPos = m_object->GetPosition(0);
m_terrain->AdjustToFloor(nPos, true);
nPos.y -= 100.0f; // hidden under the ground!
m_object->SetPosition(0, nPos);
return true;
@ -319,9 +319,9 @@ bool CMotionToto::EventFrame(const Event &event)
m_clownDelay = 0.0f;
}
focus = m_engine->RetFocus();
eye = m_engine->RetEyePt();
lookat = m_engine->RetLookatPt();
focus = m_engine->GetFocus();
eye = m_engine->GetEyePt();
lookat = m_engine->GetLookatPt();
vibLin = Math::Vector(0.0f, 0.0f, 0.0f);
vibCir = Math::Vector(0.0f, 0.0f, 0.0f);
@ -331,8 +331,8 @@ bool CMotionToto::EventFrame(const Event &event)
// Calculates the new position.
if ( m_bDisplayInfo )
{
wDim = m_engine->RetDim();
nPos.x = -4.0f*((float)wDim.x/(float)wDim.y)/(640.0f/480.0f);
wDim = m_engine->GetWindowSize();
nPos.x = -4.0f*(static_cast< float >(wDim.x)/static_cast< float >(wDim.y))/(640.0f/480.0f);
nPos.y = -0.5f;
nPos.z = 7.0f; // in the left margin
@ -394,8 +394,8 @@ bool CMotionToto::EventFrame(const Event &event)
m_clownRadius = 0.0f;
m_clownDelay = 2.0f+Math::Rand()*2.0f;
}
pos = m_object->RetPosition(0);
if ( pos.y < m_water->RetLevel() ) // underwater?
pos = m_object->GetPosition(0);
if ( pos.y < m_water->GetLevel() ) // underwater?
{
m_clownRadius /= 1.5f;
m_clownDelay *= 2.0f;
@ -432,7 +432,7 @@ bool CMotionToto::EventFrame(const Event &event)
}
else
{
aPos = m_object->RetPosition(0);
aPos = m_object->GetPosition(0);
if ( m_actionType == -1 )
{
level = 4.0f;
@ -468,7 +468,7 @@ bool CMotionToto::EventFrame(const Event &event)
}
level = Math::Min(linSpeed*0.1f, 1.0f);
nAngle = nAngle*(1.0f-level) + mAngle*level;
aAngle = Math::NormAngle(m_object->RetAngleY(0));
aAngle = Math::NormAngle(m_object->GetAngleY(0));
if ( nAngle < aAngle )
{
@ -579,7 +579,7 @@ bool CMotionToto::EventFrame(const Event &event)
else
{
nPos.y += vibLin.y;
level = m_terrain->RetFloorLevel(nPos);
level = m_terrain->GetFloorLevel(nPos);
if ( nPos.y < level+2.0f )
{
nPos.y = level+2.0f; // just above the ground
@ -717,19 +717,19 @@ bool CMotionToto::EventFrame(const Event &event)
m_object->SetAngleX(3, 0.0f);
}
mat = m_object->RetWorldMatrix(0); // must be done every time!
mat = m_object->GetWorldMatrix(0); // must be done every time!
// Generates particles.
if ( m_time-m_lastMotorParticule >= m_engine->ParticuleAdapt(0.05f) )
if ( m_time-m_lastMotorParticle >= m_engine->ParticleAdapt(0.05f) )
{
m_lastMotorParticule = m_time;
m_lastMotorParticle = m_time;
if ( m_bDisplayInfo ) sheet = SH_FRONT;
else sheet = SH_WORLD;
if ( m_bDisplayInfo ) sheet = Gfx::SH_FRONT;
else sheet = Gfx::SH_WORLD;
pos = m_object->RetPosition(0);
pos = m_object->GetPosition(0);
if ( !m_bDisplayInfo &&
pos.y < m_water->RetLevel() ) // underwater?
pos.y < m_water->GetLevel() ) // underwater?
{
float t = Math::Mod(m_time, 3.5f);
if ( t >= 2.2f || ( t >= 1.2f && t <= 1.4f ) ) // breathe?
@ -747,7 +747,7 @@ bool CMotionToto::EventFrame(const Event &event)
dim.x = 0.12f;
dim.y = dim.x;
m_particule->CreateParticule(pos, speed, dim, PARTIBUBBLE, 3.0f, 0.0f, 0.0f);
m_particle->CreateParticle(pos, speed, dim, Gfx::PARTIBUBBLE, 3.0f, 0.0f, 0.0f);
}
}
else // out of water?
@ -760,13 +760,13 @@ bool CMotionToto::EventFrame(const Event &event)
speed.x += (Math::Rand()-0.5f)*2.0f;
speed.z += (Math::Rand()-0.5f)*2.0f;
// mat = m_object->RetWorldMatrix(0);
// mat = m_object->GetWorldMatrix(0);
pos = Transform(*mat, pos);
speed = Transform(*mat, speed)-pos;
dim.x = (Math::Rand()*0.4f+0.4f)*(1.0f+Math::Min(linSpeed*0.1f, 5.0f));
dim.y = dim.x;
m_particule->CreateParticule(pos, speed, dim, PARTITOTO, 1.0f+Math::Rand()*1.0f, 0.0f, 1.0f, sheet);
m_particle->CreateParticle(pos, speed, dim, Gfx::PARTITOTO, 1.0f+Math::Rand()*1.0f, 0.0f, 1.0f, sheet);
}
if ( m_actionType != -1 && // current action?
@ -779,21 +779,21 @@ bool CMotionToto::EventFrame(const Event &event)
speed = Math::Vector(0.0f, 0.0f, 0.0f);
dim.x = (Math::Rand()*0.3f+0.3f);
dim.y = dim.x;
if ( m_actionType == MT_ERROR ) type = PARTIERROR;
if ( m_actionType == MT_WARNING ) type = PARTIWARNING;
if ( m_actionType == MT_INFO ) type = PARTIINFO;
if ( m_actionType == MT_MESSAGE ) type = PARTIWARNING;
m_particule->CreateParticule(pos, speed, dim, type, 0.5f+Math::Rand()*0.5f, 0.0f, 1.0f, sheet);
if ( m_actionType == MT_ERROR ) type = Gfx::PARTIERROR;
if ( m_actionType == MT_WARNING ) type = Gfx::PARTIWARNING;
if ( m_actionType == MT_INFO ) type = Gfx::PARTIINFO;
if ( m_actionType == MT_MESSAGE ) type = Gfx::PARTIWARNING;
m_particle->CreateParticle(pos, speed, dim, type, 0.5f+Math::Rand()*0.5f, 0.0f, 1.0f, sheet);
pos.x = 0.50f+(Math::Rand()-0.5f)*0.80f;
pos.y = 0.86f+(Math::Rand()-0.5f)*0.08f;
pos.z = 0.00f;
dim.x = (Math::Rand()*0.04f+0.04f);
dim.y = dim.x/0.75f;
m_particule->CreateParticule(pos, speed, dim, type, 0.5f+Math::Rand()*0.5f, 0.0f, 1.0f, SH_INTERFACE);
m_particle->CreateParticle(pos, speed, dim, type, 0.5f+Math::Rand()*0.5f, 0.0f, 1.0f, Gfx::SH_INTERFACE);
}
//? if ( m_bDisplayInfo && m_main->RetGlint() )
//? if ( m_bDisplayInfo && m_main->GetGlint() )
if ( false )
{
pos.x = (Math::Rand()-0.5f)*1.4f;
@ -803,7 +803,7 @@ bool CMotionToto::EventFrame(const Event &event)
speed = Math::Vector(0.0f, 0.0f, 0.0f);
dim.x = (Math::Rand()*0.5f+0.5f);
dim.y = dim.x;
m_particule->CreateParticule(pos, speed, dim, PARTIERROR, 0.5f+Math::Rand()*0.5f, 0.0f, 1.0f, sheet);
m_particle->CreateParticle(pos, speed, dim, Gfx::PARTIERROR, 0.5f+Math::Rand()*0.5f, 0.0f, 1.0f, sheet);
for ( i=0 ; i<10 ; i++ )
{
@ -817,7 +817,7 @@ bool CMotionToto::EventFrame(const Event &event)
else pos.y = 0.92f; // on the upper edge
dim.x = (Math::Rand()*0.02f+0.02f);
dim.y = dim.x/0.75f;
m_particule->CreateParticule(pos, speed, dim, PARTIERROR, 0.5f+Math::Rand()*0.5f, 0.0f, 1.0f, SH_INTERFACE);
m_particle->CreateParticle(pos, speed, dim, Gfx::PARTIERROR, 0.5f+Math::Rand()*0.5f, 0.0f, 1.0f, Gfx::SH_INTERFACE);
}
}
}
@ -825,7 +825,7 @@ bool CMotionToto::EventFrame(const Event &event)
// Move the sound.
if ( m_soundChannel != -1 )
{
if ( !m_sound->Position(m_soundChannel, m_object->RetPosition(0)) )
if ( !m_sound->Position(m_soundChannel, m_object->GetPosition(0)) )
{
m_soundChannel = -1;
}
@ -853,7 +853,7 @@ Error CMotionToto::SetAction(int action, float time)
if ( sound != SOUND_CLICK )
{
m_soundChannel = m_sound->Play(sound, m_object->RetPosition(0));
m_soundChannel = m_sound->Play(sound, m_object->GetPosition(0));
}
return ERR_OK;

View File

@ -53,7 +53,7 @@ protected:
protected:
float m_time;
float m_lastMotorParticule;
float m_lastMotorParticle;
bool m_bDisplayInfo;
bool m_bQuickPos;
bool m_bStartAction;

File diff suppressed because it is too large Load Diff

View File

@ -21,9 +21,9 @@
#include "object/motion/motionworm.h"
#include "old/modfile.h"
#include "old/particule.h"
#include "old/terrain.h"
#include "graphics/engine/modelfile.h"
#include "graphics/engine/particle.h"
#include "graphics/engine/terrain.h"
#include "math/geometry.h"
#include "physics/physics.h"
@ -55,7 +55,7 @@ CMotionWorm::CMotionWorm(CInstanceManager* iMan, CObject* object)
m_armCirSpeed = 0.0f;
m_armLastAction = -1;
m_specAction = -1;
m_lastParticule = 0.0f;
m_lastParticle = 0.0f;
m_bArmStop = false;
}
@ -78,19 +78,19 @@ void CMotionWorm::DeleteObject(bool bAll)
bool CMotionWorm::Create(Math::Vector pos, float angle, ObjectType type,
float power)
{
CModFile* pModFile;
Gfx::CModelFile* pModFile;
int rank, i;
float px;
if ( m_engine->RetRestCreate() < 2+WORM_PART+1 ) return false;
// if ( m_engine->GetRestCreate() < 2+WORM_PART+1 ) return false;
pModFile = new CModFile(m_iMan);
pModFile = new Gfx::CModelFile(m_iMan);
m_object->SetType(type);
// Creates the main base.
rank = m_engine->CreateObject();
m_engine->SetObjectType(rank, TYPEVEHICULE); // this is a moving object
m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_VEHICULE); // this is a moving object
m_object->SetObjectRank(0, rank);
pModFile->ReadModel("objects\\worm0.mod"); // there is no purpose!
pModFile->CreateEngineObject(rank);
@ -105,7 +105,7 @@ bool CMotionWorm::Create(Math::Vector pos, float angle, ObjectType type,
// Creates the head.
rank = m_engine->CreateObject();
m_engine->SetObjectType(rank, TYPEDESCENDANT);
m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_DESCENDANT);
m_object->SetObjectRank(1, rank);
m_object->SetObjectParent(1, 0);
pModFile->ReadModel("objects\\worm1.mod");
@ -117,7 +117,7 @@ bool CMotionWorm::Create(Math::Vector pos, float angle, ObjectType type,
for ( i=0 ; i<WORM_PART ; i++ )
{
rank = m_engine->CreateObject();
m_engine->SetObjectType(rank, TYPEDESCENDANT);
m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_DESCENDANT);
m_object->SetObjectRank(2+i, rank);
m_object->SetObjectParent(2+i, 0);
pModFile->ReadModel("objects\\worm2.mod");
@ -128,22 +128,22 @@ bool CMotionWorm::Create(Math::Vector pos, float angle, ObjectType type,
// Creates the tail.
rank = m_engine->CreateObject();
m_engine->SetObjectType(rank, TYPEDESCENDANT);
m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_DESCENDANT);
m_object->SetObjectRank(2+WORM_PART, rank);
m_object->SetObjectParent(2+WORM_PART, 0);
pModFile->ReadModel("objects\\worm3.mod");
pModFile->CreateEngineObject(rank);
m_object->SetPosition(2+WORM_PART, Math::Vector(px, 0.0f, 0.0f));
m_object->CreateShadowCircle(0.0f, 1.0f, D3DSHADOWWORM);
m_object->CreateShadowCircle(0.0f, 1.0f, Gfx::ENG_SHADOW_WORM);
CreatePhysics();
m_object->SetFloorHeight(0.0f);
pos = m_object->RetPosition(0);
pos = m_object->GetPosition(0);
m_object->SetPosition(0, pos); // to display the shadows immediately
m_engine->LoadAllTexture();
m_engine->LoadAllTextures();
delete pModFile;
return true;
@ -157,7 +157,7 @@ void CMotionWorm::CreatePhysics()
m_physics->SetType(TYPE_ROLLING);
character = m_object->RetCharacter();
character = m_object->GetCharacter();
character->wheelFront = 10.0f;
character->wheelBack = 10.0f;
character->wheelLeft = 2.0f;
@ -203,7 +203,7 @@ bool CMotionWorm::SetParam(int rank, float value)
return false;
}
float CMotionWorm::RetParam(int rank)
float CMotionWorm::GetParam(int rank)
{
if ( rank == 0 ) return m_timeDown;
if ( rank == 1 ) return m_timeUp;
@ -218,12 +218,12 @@ bool CMotionWorm::EventProcess(const Event &event)
{
CMotion::EventProcess(event);
if ( event.event == EVENT_FRAME )
if ( event.type == EVENT_FRAME )
{
return EventFrame(event);
}
if ( event.event == EVENT_KEYDOWN )
if ( event.type == EVENT_KEY_DOWN )
{
}
@ -241,10 +241,10 @@ bool CMotionWorm::EventFrame(const Event &event)
float floor, a, s, px, curve, phase, h, zoom, radius;
int i, under;
if ( m_engine->RetPause() ) return true;
if ( m_engine->GetPause() ) return true;
s = m_physics->RetLinMotionX(MO_MOTSPEED)/m_physics->RetLinMotionX(MO_ADVSPEED);
a = m_physics->RetCirMotionY(MO_MOTSPEED)/m_physics->RetCirMotionY(MO_ADVSPEED);
s = m_physics->GetLinMotionX(MO_MOTSPEED)/m_physics->GetLinMotionX(MO_ADVSPEED);
a = m_physics->GetCirMotionY(MO_MOTSPEED)/m_physics->GetCirMotionY(MO_ADVSPEED);
if ( s == 0.0f && a != 0.0f ) s = a;
@ -275,7 +275,7 @@ bool CMotionWorm::EventFrame(const Event &event)
{
h = 0.0f;
}
if ( m_object->RetBurn() ) // is burning?
if ( m_object->GetBurn() ) // is burning?
{
h = 0.0f; // remains on earth
}
@ -284,12 +284,12 @@ bool CMotionWorm::EventFrame(const Event &event)
}
m_object->SetVisible(under!=WORM_PART+2);
if ( !m_engine->IsVisiblePoint(m_object->RetPosition(0)) ) return true;
if ( !m_engine->IsVisiblePoint(m_object->GetPosition(0)) ) return true;
pos = m_object->RetPosition(0);
floor = m_terrain->RetFloorLevel(pos, true);
pos = m_object->GetPosition(0);
floor = m_terrain->GetFloorLevel(pos, true);
mat = m_object->RetWorldMatrix(0);
mat = m_object->GetWorldMatrix(0);
px = 1.0f+WORM_PART/2;
for ( i=0 ; i<WORM_PART+2 ; i++ )
@ -298,14 +298,14 @@ bool CMotionWorm::EventFrame(const Event &event)
radius = radius*1.3f-0.3f;
if ( radius < 0.0f ) radius = 0.0f;
radius *= 5.0f;
m_engine->SetObjectShadowRadius(m_object->RetObjectRank(0), radius);
m_engine->SetObjectShadowRadius(m_object->GetObjectRank(0), radius);
pos.x = px+ sinf(m_armTimeMarch*4.0f+0.5f*i)*0.6f;
pos.y = height[i]+sinf(m_armTimeMarch*4.0f+0.5f*i)*0.2f*m_armLinSpeed;
pos.y += sinf(m_armTimeAbs *1.3f+0.2f*i)*0.1f;
pos.z = sinf(m_armTimeAbs *2.0f+0.7f*i)*0.2f;
curve = ((float)i-(WORM_PART+2)/2)*m_armCirSpeed*0.1f;
curve = (static_cast< float >(i) -(WORM_PART+2)/2)*m_armCirSpeed*0.1f;
center.x = 0.0f;
center.y = 0.0f;
pp.x = pos.x;
@ -315,7 +315,7 @@ bool CMotionWorm::EventFrame(const Event &event)
pos.z = pp.y;
p = Transform(*mat, pos);
pos.y += m_terrain->RetFloorLevel(p, true)-floor;
pos.y += m_terrain->GetFloorLevel(p, true)-floor;
m_object->SetPosition(i+1, pos);
zoom = Math::Mod(m_armTimeAbs*0.5f+100.0f-i*0.1f, 2.0f);
@ -326,9 +326,9 @@ bool CMotionWorm::EventFrame(const Event &event)
m_object->SetZoomZ(i+1, zoom);
if ( height[i] >= -1.0f && height[i] < -0.2f &&
m_lastParticule+m_engine->ParticuleAdapt(0.2f) <= m_armTimeMarch )
m_lastParticle+m_engine->ParticleAdapt(0.2f) <= m_armTimeMarch )
{
m_lastParticule = m_armTimeMarch;
m_lastParticle = m_armTimeMarch;
pos = p;
pos.y += -height[i];
@ -337,7 +337,7 @@ bool CMotionWorm::EventFrame(const Event &event)
speed = Math::Vector(0.0f, 0.0f, 0.0f);
dim.x = Math::Rand()*2.0f+1.5f;
dim.y = dim.x;
m_particule->CreateParticule(pos, speed, dim, PARTICRASH, 2.0f);
m_particle->CreateParticle(pos, speed, dim, Gfx::PARTICRASH, 2.0f);
}
px -= 1.0f;
@ -345,8 +345,8 @@ bool CMotionWorm::EventFrame(const Event &event)
for ( i=0 ; i<WORM_PART+1 ; i++ )
{
pos = m_object->RetPosition(i+2);
pos -= m_object->RetPosition(i+1);
pos = m_object->GetPosition(i+2);
pos -= m_object->GetPosition(i+1);
angle.z = -Math::RotateAngle(Math::Point(pos.x, pos.z).Length(), pos.y);
angle.y = Math::PI-Math::RotateAngle(pos.x, pos.z);

View File

@ -34,7 +34,7 @@ public:
bool EventProcess(const Event &event);
bool SetParam(int rank, float value);
float RetParam(int rank);
float GetParam(int rank);
protected:
void CreatePhysics();
@ -57,6 +57,6 @@ protected:
int m_specAction;
float m_specTime;
bool m_bArmStop;
float m_lastParticule;
float m_lastParticle;
};