Rename fret/truck to cargo/transporter

master
Piotr Dziwinski 2015-06-29 23:05:31 +02:00
parent f0374dca38
commit f6bc8f94bf
41 changed files with 497 additions and 497 deletions

View File

@ -46,13 +46,13 @@ void SetTransparency(CObject* obj, float value)
{
obj->SetTransparency(value);
CObject *fret = obj->GetFret();
if (fret != NULL)
fret->SetTransparency(value);
CObject *cargo = obj->GetCargo();
if (cargo != NULL)
cargo->SetTransparency(value);
fret = obj->GetPower();
if (fret != NULL)
fret->SetTransparency(value);
cargo = obj->GetPower();
if (cargo != NULL)
cargo->SetTransparency(value);
}
@ -245,7 +245,7 @@ void CCamera::SetType(CameraType type)
{
for (CObject* obj : CObjectManager::GetInstancePointer()->GetAllObjects())
{
if (obj->GetTruck())
if (obj->GetTransporter())
continue; // battery or cargo?
SetTransparency(obj, 0.0f); // opaque object
@ -890,7 +890,7 @@ bool CCamera::IsCollisionBack(Math::Vector &eye, Math::Vector lookat)
for (CObject* obj : CObjectManager::GetInstancePointer()->GetAllObjects())
{
if (obj->GetTruck()) continue; // battery or cargo?
if (obj->GetTransporter()) continue; // battery or cargo?
SetTransparency(obj, 0.0f); // opaque object

View File

@ -320,7 +320,7 @@ CObject* CLightning::SearchObject(Math::Vector pos)
for (CObject* obj : CObjectManager::GetInstancePointer()->GetAllObjects())
{
if (!obj->GetActive()) continue; // inactive object?
if (obj->GetTruck() != nullptr) continue; // object transported?
if (obj->GetTransporter() != nullptr) continue; // object transported?
ObjectType type = obj->GetType();
if ( type == OBJECT_BASE ||

View File

@ -1374,24 +1374,24 @@ void CPyro::DeleteObject(bool primary, bool secondary)
m_object->SetPower(nullptr);
}
sub = m_object->GetFret();
sub = m_object->GetCargo();
if ( sub != nullptr )
{
CObjectManager::GetInstancePointer()->DeleteObject(sub);
m_object->SetFret(nullptr);
m_object->SetCargo(nullptr);
}
}
if (primary)
{
CObject* truck = m_object->GetTruck();
if ( truck != nullptr ) // object carries?
CObject* transporter = m_object->GetTransporter();
if ( transporter != nullptr ) // object carries?
{
if (truck->GetPower() == m_object)
truck->SetPower(nullptr);
if (transporter->GetPower() == m_object)
transporter->SetPower(nullptr);
if (truck->GetFret() == m_object)
truck->SetFret(nullptr);
if (transporter->GetCargo() == m_object)
transporter->SetCargo(nullptr);
}
CObjectManager::GetInstancePointer()->DeleteObject(m_object);
@ -2262,7 +2262,7 @@ CObject* CPyro::FallSearchBeeExplo()
oType != OBJECT_POWER &&
oType != OBJECT_ATOMIC ) continue;
if ( obj->GetTruck() != nullptr ) continue; // object transported?
if ( obj->GetTransporter() != nullptr ) continue; // object transported?
Math::Vector oPos = obj->GetPosition(0);

View File

@ -1244,7 +1244,7 @@ void CAutoBase::FreezeCargo(bool freeze)
obj->SetSpaceshipCargo(false);
if ( obj == m_object ) continue; // yourself?
if ( obj->GetTruck() != nullptr ) continue; // transport object?
if ( obj->GetTransporter() != nullptr ) continue; // transport object?
Math::Vector oPos = obj->GetPosition(0);
float dist = Math::DistanceProjected(m_pos, oPos);

View File

@ -58,10 +58,10 @@ void CAutoConvert::DeleteObject(bool all)
{
if ( !all )
{
CObject* fret = SearchStone(OBJECT_STONE);
if ( fret != nullptr )
CObject* cargo = SearchStone(OBJECT_STONE);
if ( cargo != nullptr )
{
CObjectManager::GetInstancePointer()->DeleteObject(fret);
CObjectManager::GetInstancePointer()->DeleteObject(cargo);
}
}
@ -95,7 +95,7 @@ void CAutoConvert::Init()
bool CAutoConvert::EventProcess(const Event &event)
{
CObject* fret;
CObject* cargo;
Math::Vector pos, speed;
Math::Point dim, c, p;
float angle;
@ -133,8 +133,8 @@ bool CAutoConvert::EventProcess(const Event &event)
{
if ( m_progress >= 1.0f )
{
fret = SearchStone(OBJECT_STONE); // Has stone transformed?
if ( fret == 0 || SearchVehicle() )
cargo = SearchStone(OBJECT_STONE); // Has stone transformed?
if ( cargo == 0 || SearchVehicle() )
{
m_phase = ACP_WAIT; // still waiting ...
m_progress = 0.0f;
@ -142,7 +142,7 @@ bool CAutoConvert::EventProcess(const Event &event)
}
else
{
fret->SetLock(true); // stone usable
cargo->SetLock(true); // stone usable
SetBusy(true);
InitProgressTotal(3.0f+10.0f+1.5f);
@ -229,12 +229,12 @@ bool CAutoConvert::EventProcess(const Event &event)
m_object->SetAngleY(2, 0.0f);
m_object->SetAngleY(3, Math::PI);
fret = SearchStone(OBJECT_STONE);
if ( fret != nullptr )
cargo = SearchStone(OBJECT_STONE);
if ( cargo != nullptr )
{
m_bResetDelete = ( fret->GetResetCap() != RESET_NONE );
m_bResetDelete = ( cargo->GetResetCap() != RESET_NONE );
CObjectManager::GetInstancePointer()->DeleteObject(fret);
CObjectManager::GetInstancePointer()->DeleteObject(cargo);
}
CreateMetal(); // Create the metal
@ -401,7 +401,7 @@ CObject* CAutoConvert::SearchStone(ObjectType type)
{
ObjectType oType = obj->GetType();
if ( oType != type ) continue;
if ( obj->GetTruck() != nullptr ) continue;
if ( obj->GetTransporter() != nullptr ) continue;
Math::Vector oPos = obj->GetPosition(0);
float dist = Math::Distance(oPos, cPos);
@ -480,11 +480,11 @@ void CAutoConvert::CreateMetal()
Math::Vector pos = m_object->GetPosition(0);
float angle = m_object->GetAngleY(0);
CObject* fret = CObjectManager::GetInstancePointer()->CreateObject(pos, angle, OBJECT_METAL);
CObject* cargo = CObjectManager::GetInstancePointer()->CreateObject(pos, angle, OBJECT_METAL);
if ( m_bResetDelete )
{
fret->SetResetCap(RESET_DELETE);
cargo->SetResetCap(RESET_DELETE);
}
m_main->DisplayError(INFO_CONVERT, m_object);

View File

@ -65,10 +65,10 @@ void CAutoDerrick::DeleteObject(bool all)
{
if ( !all )
{
CObject* fret = SearchFret();
if ( fret != nullptr && fret->GetLock() )
CObject* cargo = SearchCargo();
if ( cargo != nullptr && cargo->GetLock() )
{
CObjectManager::GetInstancePointer()->DeleteObject(fret);
CObjectManager::GetInstancePointer()->DeleteObject(cargo);
}
}
@ -129,7 +129,7 @@ void CAutoDerrick::Init()
mat = m_object->GetWorldMatrix(0);
pos = Math::Transform(*mat, pos);
m_terrain->AdjustToFloor(pos);
m_fretPos = pos;
m_cargoPos = pos;
}
@ -137,7 +137,7 @@ void CAutoDerrick::Init()
bool CAutoDerrick::EventProcess(const Event &event)
{
CObject* fret;
CObject* cargo;
Math::Vector pos, speed;
Math::Point dim;
float angle, duration, factor;
@ -309,10 +309,10 @@ bool CAutoDerrick::EventProcess(const Event &event)
{
if ( m_progress == 0.0f )
{
if ( SearchFree(m_fretPos) )
if ( SearchFree(m_cargoPos) )
{
angle = m_object->GetAngleY(0);
CreateFret(m_fretPos, angle, m_type, 16.0f);
CreateCargo(m_cargoPos, angle, m_type, 16.0f);
}
else
{
@ -323,9 +323,9 @@ bool CAutoDerrick::EventProcess(const Event &event)
}
}
fret = SearchFret();
cargo = SearchCargo();
if ( fret != 0 &&
if ( cargo != 0 &&
m_progress <= 0.5f &&
m_lastParticle+m_engine->ParticleAdapt(0.1f) <= m_time )
{
@ -333,7 +333,7 @@ bool CAutoDerrick::EventProcess(const Event &event)
if ( m_progress < 0.3f )
{
pos = fret->GetPosition(0);
pos = cargo->GetPosition(0);
pos.x += (Math::Rand()-0.5f)*5.0f;
pos.z += (Math::Rand()-0.5f)*5.0f;
pos.y += (Math::Rand()-0.5f)*5.0f;
@ -344,7 +344,7 @@ bool CAutoDerrick::EventProcess(const Event &event)
}
else
{
pos = fret->GetPosition(0);
pos = cargo->GetPosition(0);
pos.x += (Math::Rand()-0.5f)*5.0f;
pos.z += (Math::Rand()-0.5f)*5.0f;
pos.y += Math::Rand()*2.5f;
@ -357,21 +357,21 @@ bool CAutoDerrick::EventProcess(const Event &event)
if ( m_progress < 1.0f )
{
if ( fret != 0 )
if ( cargo != 0 )
{
pos = fret->GetPosition(0);
pos = cargo->GetPosition(0);
pos.y -= event.rTime*20.0f; // grave
if ( !m_bSoundFall && pos.y < m_fretPos.y )
if ( !m_bSoundFall && pos.y < m_cargoPos.y )
{
m_sound->Play(SOUND_BOUM, m_fretPos);
m_sound->Play(SOUND_BOUM, m_cargoPos);
m_bSoundFall = true;
}
if ( pos.y < m_fretPos.y )
if ( pos.y < m_cargoPos.y )
{
pos.y = m_fretPos.y;
fret->SetLock(false); // object usable
pos.y = m_cargoPos.y;
cargo->SetLock(false); // object usable
}
fret->SetPosition(0, pos);
cargo->SetPosition(0, pos);
}
}
else
@ -459,7 +459,7 @@ bool CAutoDerrick::Read(CLevelParserLine* line)
// Seeks the subject cargo.
CObject* CAutoDerrick::SearchFret()
CObject* CAutoDerrick::SearchCargo()
{
for (CObject* obj : CObjectManager::GetInstancePointer()->GetAllObjects())
{
@ -468,8 +468,8 @@ CObject* CAutoDerrick::SearchFret()
Math::Vector oPos = obj->GetPosition(0);
if ( oPos.x == m_fretPos.x &&
oPos.z == m_fretPos.z ) return obj;
if ( oPos.x == m_cargoPos.x &&
oPos.z == m_cargoPos.z ) return obj;
}
return nullptr;
@ -500,20 +500,20 @@ bool CAutoDerrick::SearchFree(Math::Vector pos)
// Create a transportable object.
void CAutoDerrick::CreateFret(Math::Vector pos, float angle, ObjectType type,
void CAutoDerrick::CreateCargo(Math::Vector pos, float angle, ObjectType type,
float height)
{
CObject* fret = CObjectManager::GetInstancePointer()->CreateObject(pos, angle, type);
fret->SetLock(true); // object not yet usable
CObject* cargo = CObjectManager::GetInstancePointer()->CreateObject(pos, angle, type);
cargo->SetLock(true); // object not yet usable
if ( m_object->GetResetCap() == RESET_MOVE )
{
fret->SetResetCap(RESET_DELETE);
cargo->SetResetCap(RESET_DELETE);
}
pos = fret->GetPosition(0);
pos = cargo->GetPosition(0);
pos.y += height;
fret->SetPosition(0, pos);
cargo->SetPosition(0, pos);
}
// Look if there is already a key.

View File

@ -55,9 +55,9 @@ public:
bool Read(CLevelParserLine* line);
protected:
CObject* SearchFret();
CObject* SearchCargo();
bool SearchFree(Math::Vector pos);
void CreateFret(Math::Vector pos, float angle, ObjectType type, float height);
void CreateCargo(Math::Vector pos, float angle, ObjectType type, float height);
bool ExistKey();
protected:
@ -67,7 +67,7 @@ protected:
float m_timeVirus;
float m_lastParticle;
float m_lastTrack;
Math::Vector m_fretPos;
Math::Vector m_cargoPos;
int m_soundChannel;
bool m_bSoundFall;
};

View File

@ -92,7 +92,7 @@ Error CAutoDestroyer::StartAction(int param)
if ( m_phase == ADEP_WAIT )
{
scrap->SetLock(true); // usable waste
//? scrap->SetTruck(m_object); // usable waste
//? scrap->SetTransporter(m_object); // usable waste
m_sound->Play(SOUND_PSHHH2, m_object->GetPosition(0), 1.0f, 1.0f);

View File

@ -276,7 +276,7 @@ CObject* CAutoEgg::SearchAlien()
CObject* best = nullptr;
for (CObject* obj : CObjectManager::GetInstancePointer()->GetAllObjects())
{
if ( obj->GetTruck() != nullptr ) continue;
if ( obj->GetTransporter() != nullptr ) continue;
ObjectType type = obj->GetType();
if ( type != OBJECT_ANT &&

View File

@ -71,16 +71,16 @@ void CAutoEnergy::DeleteObject(bool all)
if ( !all )
{
CObject* fret = SearchMetal();
if ( fret != nullptr )
CObject* cargo = SearchMetal();
if ( cargo != nullptr )
{
CObjectManager::GetInstancePointer()->DeleteObject(fret);
CObjectManager::GetInstancePointer()->DeleteObject(cargo);
}
fret = SearchPower();
if ( fret != nullptr )
cargo = SearchPower();
if ( cargo != nullptr )
{
CObjectManager::GetInstancePointer()->DeleteObject(fret);
CObjectManager::GetInstancePointer()->DeleteObject(cargo);
}
}
@ -109,7 +109,7 @@ void CAutoEnergy::Init()
bool CAutoEnergy::EventProcess(const Event &event)
{
CObject* fret;
CObject* cargo;
Math::Vector pos, ppos, speed;
Math::Point dim, c, p;
Gfx::TerrainRes res;
@ -162,10 +162,10 @@ bool CAutoEnergy::EventProcess(const Event &event)
if ( m_progress >= 1.0f )
{
bGO = false;
fret = SearchMetal(); // transform metal?
if ( fret != 0 )
cargo = SearchMetal(); // transform metal?
if ( cargo != 0 )
{
if ( fret->GetType() == OBJECT_METAL )
if ( cargo->GetType() == OBJECT_METAL )
{
if ( big > ENERGY_POWER ) bGO = true;
}
@ -177,9 +177,9 @@ bool CAutoEnergy::EventProcess(const Event &event)
if ( bGO )
{
if ( fret->GetType() == OBJECT_METAL )
if ( cargo->GetType() == OBJECT_METAL )
{
fret->SetLock(true); // usable metal
cargo->SetLock(true); // usable metal
CreatePower(); // creates the battery
}
@ -245,10 +245,10 @@ bool CAutoEnergy::EventProcess(const Event &event)
{
if ( m_progress < 1.0f )
{
fret = SearchMetal();
if ( fret != 0 )
cargo = SearchMetal();
if ( cargo != 0 )
{
if ( fret->GetType() == OBJECT_METAL )
if ( cargo->GetType() == OBJECT_METAL )
{
big -= event.rTime/ENERGY_DELAY*ENERGY_POWER;
}
@ -256,13 +256,13 @@ bool CAutoEnergy::EventProcess(const Event &event)
{
big += event.rTime/ENERGY_DELAY*0.25f;
}
fret->SetZoom(0, 1.0f-m_progress);
cargo->SetZoom(0, 1.0f-m_progress);
}
fret = SearchPower();
if ( fret != 0 )
cargo = SearchPower();
if ( cargo != 0 )
{
fret->SetZoom(0, m_progress);
cargo->SetZoom(0, m_progress);
}
if ( m_lastParticle+m_engine->ParticleAdapt(0.10f) <= m_time )
@ -307,21 +307,21 @@ bool CAutoEnergy::EventProcess(const Event &event)
}
else
{
fret = SearchMetal();
if ( fret != nullptr )
cargo = SearchMetal();
if ( cargo != nullptr )
{
m_object->SetPower(nullptr);
CObjectManager::GetInstancePointer()->DeleteObject(fret);
CObjectManager::GetInstancePointer()->DeleteObject(cargo);
}
fret = SearchPower();
if ( fret != 0 )
cargo = SearchPower();
if ( cargo != 0 )
{
fret->SetZoom(0, 1.0f);
fret->SetLock(false); // usable battery
fret->SetTruck(m_object);
fret->SetPosition(0, Math::Vector(0.0f, 3.0f, 0.0f));
m_object->SetPower(fret);
cargo->SetZoom(0, 1.0f);
cargo->SetLock(false); // usable battery
cargo->SetTransporter(m_object);
cargo->SetPosition(0, Math::Vector(0.0f, 3.0f, 0.0f));
m_object->SetPower(cargo);
m_main->DisplayError(INFO_ENERGY, m_object);
}

View File

@ -66,10 +66,10 @@ void CAutoFactory::DeleteObject(bool all)
{
if ( !all )
{
CObject* fret = SearchFret(); // transform metal?
if ( fret != nullptr )
CObject* cargo = SearchCargo(); // transform metal?
if ( cargo != nullptr )
{
CObjectManager::GetInstancePointer()->DeleteObject(fret);
CObjectManager::GetInstancePointer()->DeleteObject(cargo);
}
CObject* vehicle = SearchVehicle();
@ -101,7 +101,7 @@ void CAutoFactory::Init()
m_time = 0.0f;
m_lastParticle = 0.0f;
m_fretPos = m_object->GetPosition(0);
m_cargoPos = m_object->GetPosition(0);
m_program = nullptr;
@ -113,7 +113,7 @@ void CAutoFactory::Init()
Error CAutoFactory::StartAction(int param)
{
CObject* fret;
CObject* cargo;
ObjectType type = static_cast<ObjectType>(param);
if ( type != OBJECT_NULL )
@ -125,8 +125,8 @@ Error CAutoFactory::StartAction(int param)
m_type = type;
fret = SearchFret(); // transform metal?
if ( fret == 0 )
cargo = SearchCargo(); // transform metal?
if ( cargo == 0 )
{
return ERR_FACTORY_NULL;
}
@ -139,7 +139,7 @@ Error CAutoFactory::StartAction(int param)
InitProgressTotal(3.0f+2.0f+15.0f+2.0f+3.0f);
UpdateInterface();
fret->SetLock(true); // usable metal
cargo->SetLock(true); // usable metal
SoundManip(3.0f, 1.0f, 0.5f);
m_phase = AFP_CLOSE_S;
@ -165,7 +165,7 @@ void CAutoFactory::SetProgram(const char* program)
bool CAutoFactory::EventProcess(const Event &event)
{
ObjectType type;
CObject* fret;
CObject* cargo;
CObject* vehicle;
Math::Matrix* mat;
CPhysics* physics;
@ -296,10 +296,10 @@ bool CAutoFactory::EventProcess(const Event &event)
{
if ( !CreateVehicle() )
{
fret = SearchFret(); // transform metal?
if ( fret != 0 )
cargo = SearchCargo(); // transform metal?
if ( cargo != 0 )
{
fret->SetLock(false); // metal usable again
cargo->SetLock(false); // metal usable again
}
if ( m_channelSound != -1 )
@ -339,10 +339,10 @@ bool CAutoFactory::EventProcess(const Event &event)
vehicle->SetZoom(0, m_progress);
}
fret = SearchFret(); // transform metal?
if ( fret != 0 )
cargo = SearchCargo(); // transform metal?
if ( cargo != 0 )
{
fret->SetZoom(0, 1.0f-m_progress);
cargo->SetZoom(0, 1.0f-m_progress);
}
if ( m_lastParticle+m_engine->ParticleAdapt(0.05f) <= m_time )
@ -350,7 +350,7 @@ bool CAutoFactory::EventProcess(const Event &event)
m_lastParticle = m_time;
#if 0
pos = m_fretPos;
pos = m_cargoPos;
pos.x += (Math::Rand()-0.5f)*20.0f;
pos.z += (Math::Rand()-0.5f)*20.0f;
pos.y += 1.0f;
@ -381,10 +381,10 @@ bool CAutoFactory::EventProcess(const Event &event)
m_main->DisplayError(INFO_FACTORY, m_object);
SoundManip(2.0f, 1.0f, 1.2f);
fret = SearchFret(); // transform metal?
if ( fret != nullptr )
cargo = SearchCargo(); // transform metal?
if ( cargo != nullptr )
{
CObjectManager::GetInstancePointer()->DeleteObject(fret);
CObjectManager::GetInstancePointer()->DeleteObject(cargo);
}
m_vehicle = vehicle = SearchVehicle();
@ -425,7 +425,7 @@ bool CAutoFactory::EventProcess(const Event &event)
{
m_lastParticle = m_time;
pos = m_fretPos;
pos = m_cargoPos;
pos.x += (Math::Rand()-0.5f)*10.0f;
pos.z += (Math::Rand()-0.5f)*10.0f;
pos.y += Math::Rand()*10.0f;
@ -468,7 +468,7 @@ bool CAutoFactory::EventProcess(const Event &event)
{
m_lastParticle = m_time;
pos = m_fretPos;
pos = m_cargoPos;
pos.x += (Math::Rand()-0.5f)*10.0f;
pos.z += (Math::Rand()-0.5f)*10.0f;
pos.y += Math::Rand()*10.0f;
@ -537,7 +537,7 @@ bool CAutoFactory::Read(CLevelParserLine* line)
m_speed = line->GetParam("aSpeed")->AsFloat(1.0f);
m_lastParticle = 0.0f;
m_fretPos = m_object->GetPosition(0);
m_cargoPos = m_object->GetPosition(0);
return true;
}
@ -545,16 +545,16 @@ bool CAutoFactory::Read(CLevelParserLine* line)
//Seeks the cargo.
CObject* CAutoFactory::SearchFret()
CObject* CAutoFactory::SearchCargo()
{
for (CObject* obj : CObjectManager::GetInstancePointer()->GetAllObjects())
{
ObjectType type = obj->GetType();
if ( type != OBJECT_METAL ) continue;
if ( obj->GetTruck() != nullptr ) continue;
if ( obj->GetTransporter() != nullptr ) continue;
Math::Vector oPos = obj->GetPosition(0);
float dist = Math::Distance(oPos, m_fretPos);
float dist = Math::Distance(oPos, m_cargoPos);
if ( dist < 8.0f ) return obj;
}
@ -676,10 +676,10 @@ CObject* CAutoFactory::SearchVehicle()
ObjectType type = obj->GetType();
if ( type != m_type ) continue;
if ( obj->GetTruck() != nullptr ) continue;
if ( obj->GetTransporter() != nullptr ) continue;
Math::Vector oPos = obj->GetPosition(0);
float dist = Math::Distance(oPos, m_fretPos);
float dist = Math::Distance(oPos, m_cargoPos);
if ( dist < 8.0f ) return obj;
}

View File

@ -62,7 +62,7 @@ protected:
void UpdateInterface();
void UpdateButton(Ui::CWindow *pw, EventType event, bool bBusy);
CObject* SearchFret();
CObject* SearchCargo();
bool NearestVehicle();
bool CreateVehicle();
CObject* SearchVehicle();
@ -74,7 +74,7 @@ protected:
float m_progress;
float m_speed;
float m_lastParticle;
Math::Vector m_fretPos;
Math::Vector m_cargoPos;
int m_channelSound;
CObject* m_vehicle;

View File

@ -52,10 +52,10 @@ void CAutoNest::DeleteObject(bool all)
{
if ( !all )
{
CObject* fret = SearchFret();
if ( fret != nullptr )
CObject* cargo = SearchCargo();
if ( cargo != nullptr )
{
CObjectManager::GetInstancePointer()->DeleteObject(fret);
CObjectManager::GetInstancePointer()->DeleteObject(cargo);
}
}
@ -78,7 +78,7 @@ void CAutoNest::Init()
pos = m_object->GetPosition(0);
m_terrain->AdjustToFloor(pos);
m_fretPos = pos;
m_cargoPos = pos;
}
@ -86,7 +86,7 @@ void CAutoNest::Init()
bool CAutoNest::EventProcess(const Event &event)
{
CObject* fret;
CObject* cargo;
CAuto::EventProcess(event);
@ -99,7 +99,7 @@ bool CAutoNest::EventProcess(const Event &event)
{
if ( m_progress >= 1.0f )
{
if ( !SearchFree(m_fretPos) )
if ( !SearchFree(m_cargoPos) )
{
m_phase = ANP_WAIT;
m_progress = 0.0f;
@ -107,7 +107,7 @@ bool CAutoNest::EventProcess(const Event &event)
}
else
{
CreateFret(m_fretPos, 0.0f, OBJECT_BULLET);
CreateCargo(m_cargoPos, 0.0f, OBJECT_BULLET);
m_phase = ANP_BIRTH;
m_progress = 0.0f;
m_speed = 1.0f/5.0f;
@ -117,21 +117,21 @@ bool CAutoNest::EventProcess(const Event &event)
if ( m_phase == ANP_BIRTH )
{
fret = SearchFret();
cargo = SearchCargo();
if ( m_progress < 1.0f )
{
if ( fret != 0 )
if ( cargo != 0 )
{
fret->SetZoom(0, m_progress);
cargo->SetZoom(0, m_progress);
}
}
else
{
if ( fret != 0 )
if ( cargo != 0 )
{
fret->SetZoom(0, 1.0f);
fret->SetLock(false);
cargo->SetZoom(0, 1.0f);
cargo->SetLock(false);
}
m_phase = ANP_WAIT;
@ -169,16 +169,16 @@ bool CAutoNest::SearchFree(Math::Vector pos)
// Create a transportable object.
void CAutoNest::CreateFret(Math::Vector pos, float angle, ObjectType type)
void CAutoNest::CreateCargo(Math::Vector pos, float angle, ObjectType type)
{
CObject* fret = CObjectManager::GetInstancePointer()->CreateObject(pos, angle, type);
fret->SetLock(true); // not usable
fret->SetZoom(0, 0.0f);
CObject* cargo = CObjectManager::GetInstancePointer()->CreateObject(pos, angle, type);
cargo->SetLock(true); // not usable
cargo->SetZoom(0, 0.0f);
}
// Looking for the ball during manufacture.
CObject* CAutoNest::SearchFret()
CObject* CAutoNest::SearchCargo()
{
for (CObject* obj : CObjectManager::GetInstancePointer()->GetAllObjects())
{
@ -188,8 +188,8 @@ CObject* CAutoNest::SearchFret()
if ( type != OBJECT_BULLET ) continue;
Math::Vector oPos = obj->GetPosition(0);
if ( oPos.x == m_fretPos.x &&
oPos.z == m_fretPos.z )
if ( oPos.x == m_cargoPos.x &&
oPos.z == m_cargoPos.z )
{
return obj;
}

View File

@ -51,14 +51,14 @@ public:
protected:
bool SearchFree(Math::Vector pos);
void CreateFret(Math::Vector pos, float angle, ObjectType type);
CObject* SearchFret();
void CreateCargo(Math::Vector pos, float angle, ObjectType type);
CObject* SearchCargo();
protected:
AutoNestPhase m_phase;
float m_progress;
float m_speed;
float m_lastParticle;
Math::Vector m_fretPos;
Math::Vector m_cargoPos;
};

View File

@ -61,10 +61,10 @@ void CAutoNuclear::DeleteObject(bool all)
{
if ( !all )
{
CObject* fret = SearchUranium();
if ( fret != nullptr )
CObject* cargo = SearchUranium();
if ( cargo != nullptr )
{
CObjectManager::GetInstancePointer()->DeleteObject(fret);
CObjectManager::GetInstancePointer()->DeleteObject(cargo);
}
}
@ -104,7 +104,7 @@ void CAutoNuclear::Init()
bool CAutoNuclear::EventProcess(const Event &event)
{
CObject* fret;
CObject* cargo;
Math::Matrix* mat;
Math::Vector pos, goal, speed;
Math::Point dim, rot;
@ -134,8 +134,8 @@ bool CAutoNuclear::EventProcess(const Event &event)
{
if ( m_progress >= 1.0f )
{
fret = SearchUranium(); // transform uranium?
if ( fret == 0 || SearchVehicle() )
cargo = SearchUranium(); // transform uranium?
if ( cargo == 0 || SearchVehicle() )
{
m_phase = ANUP_WAIT; // still waiting ...
m_progress = 0.0f;
@ -143,7 +143,7 @@ bool CAutoNuclear::EventProcess(const Event &event)
}
else
{
fret->SetLock(true); // usable uranium
cargo->SetLock(true); // usable uranium
SetBusy(true);
InitProgressTotal(1.5f+NUCLEAR_DELAY+1.5f);
@ -227,10 +227,10 @@ bool CAutoNuclear::EventProcess(const Event &event)
}
else
{
fret = SearchUranium();
if ( fret != nullptr )
cargo = SearchUranium();
if ( cargo != nullptr )
{
CObjectManager::GetInstancePointer()->DeleteObject(fret);
CObjectManager::GetInstancePointer()->DeleteObject(cargo);
m_object->SetPower(nullptr);
}
@ -389,7 +389,7 @@ void CAutoNuclear::CreatePower()
float powerLevel = 1.0f;
CObject* power = CObjectManager::GetInstancePointer()->CreateObject(pos, angle, OBJECT_ATOMIC, powerLevel);
power->SetTruck(m_object);
power->SetTransporter(m_object);
power->SetPosition(0, Math::Vector(22.0f, 3.0f, 0.0f));
m_object->SetPower(power);
}

View File

@ -251,7 +251,7 @@ void CAutoPara::ChargeObject(float rTime)
float dist = Math::Distance(oPos, sPos);
if ( dist > 20.0f ) continue;
if ( obj->GetTruck() == nullptr && obj->GetType() == OBJECT_POWER )
if ( obj->GetTransporter() == nullptr && obj->GetType() == OBJECT_POWER )
{
float energy = obj->GetEnergy();
energy += rTime/2.0f;
@ -268,7 +268,7 @@ void CAutoPara::ChargeObject(float rTime)
power->SetEnergy(energy);
}
power = obj->GetFret();
power = obj->GetCargo();
if ( power != nullptr && power->GetType() == OBJECT_POWER )
{
float energy = power->GetEnergy();

View File

@ -396,7 +396,7 @@ int CAutoSafe::CountKeys()
for (CObject* obj : CObjectManager::GetInstancePointer()->GetAllObjects())
{
if ( obj->GetTruck() != nullptr ) continue;
if ( obj->GetTransporter() != nullptr ) continue;
ObjectType oType = obj->GetType();
if ( oType != OBJECT_KEYa &&
@ -468,7 +468,7 @@ void CAutoSafe::LockKeys()
for (CObject* obj : CObjectManager::GetInstancePointer()->GetAllObjects())
{
ObjectType oType = obj->GetType();
if ( obj->GetTruck() != nullptr ) continue;
if ( obj->GetTransporter() != nullptr ) continue;
if ( oType != OBJECT_KEYa &&
oType != OBJECT_KEYb &&
@ -492,7 +492,7 @@ void CAutoSafe::DownKeys(float progress)
for (CObject* obj : CObjectManager::GetInstancePointer()->GetAllObjects())
{
ObjectType oType = obj->GetType();
if ( obj->GetTruck() != nullptr ) continue;
if ( obj->GetTransporter() != nullptr ) continue;
if ( oType != OBJECT_KEYa &&
oType != OBJECT_KEYb &&
@ -521,7 +521,7 @@ void CAutoSafe::DeleteKeys()
for (CObject* obj : CObjectManager::GetInstancePointer()->GetAllObjects())
{
ObjectType oType = obj->GetType();
if ( obj->GetTruck() != nullptr ) continue;
if ( obj->GetTransporter() != nullptr ) continue;
if ( oType != OBJECT_KEYa &&
oType != OBJECT_KEYb &&
@ -549,7 +549,7 @@ CObject* CAutoSafe::SearchVehicle()
for (CObject* obj : CObjectManager::GetInstancePointer()->GetAllObjects())
{
if ( obj == m_object ) continue;
if ( obj->GetTruck() != nullptr ) continue;
if ( obj->GetTransporter() != nullptr ) continue;
Math::Vector oPos = obj->GetPosition(0);
float dist = Math::DistanceProjected(oPos, cPos);

View File

@ -151,7 +151,7 @@ bool CAutoStation::EventProcess(const Event &event)
big -= add/4.0f; // discharge the large battery
}
power = vehicle->GetFret();
power = vehicle->GetCargo();
if ( power != 0 && power->GetType() == OBJECT_POWER )
{
energy = power->GetEnergy();

View File

@ -52,7 +52,7 @@ protected:
float m_lastUpdateTime;
float m_lastParticle;
int m_soundChannel;
Math::Vector m_fretPos;
Math::Vector m_cargoPos;
bool m_bLastVirus;
float m_energyVirus;
};

View File

@ -2394,7 +2394,7 @@ void CBrain::UpdateInterface()
bFly = bEnable;
if ( bFly && (type == OBJECT_HUMAN || type == OBJECT_TECH) )
{
if ( m_object->GetFret() != 0 ) bFly = false; // if holder -> not fly
if ( m_object->GetCargo() != 0 ) bFly = false; // if holder -> not fly
}
EnableInterface(pw, EVENT_OBJECT_GASUP, bFly && m_main->CanPlayerInteract());
EnableInterface(pw, EVENT_OBJECT_GASDOWN, bFly && m_main->CanPlayerInteract());

View File

@ -436,7 +436,7 @@ bool CMotionBee::EventFrame(const Event &event)
action = MB_MARCH; // flying
m_actionType = -1;
if ( m_object->GetFret() != 0 ) m_actionType = MBS_HOLD; // carries the ball
if ( m_object->GetCargo() != 0 ) m_actionType = MBS_HOLD; // carries the ball
if ( m_object->GetRuin() ) // destroyed?
{

View File

@ -739,7 +739,7 @@ bool CMotionHuman::EventFrame(const Event &event)
s = 0.0f;
}
if ( m_object->GetFret() != 0 ) // carries something?
if ( m_object->GetCargo() != 0 ) // carries something?
{
s *= 1.3f;
}
@ -771,7 +771,7 @@ bool CMotionHuman::EventFrame(const Event &event)
s = 0.0f;
}
if ( m_object->GetFret() != 0 ) // carries something?
if ( m_object->GetCargo() != 0 ) // carries something?
{
s *= 1.3f;
}
@ -836,7 +836,7 @@ bool CMotionHuman::EventFrame(const Event &event)
else
{
action = MH_MARCH; // walking
if ( m_object->GetFret() != 0 ) action = MH_MARCHTAKE; // take walking
if ( m_object->GetCargo() != 0 ) action = MH_MARCHTAKE; // take walking
rTime[0] = rTime[1] = m_armMember;
lTime[0] = lTime[1] = m_armMember+0.5f;
}
@ -875,7 +875,7 @@ bool CMotionHuman::EventFrame(const Event &event)
armAction = action;
legAction = action;
if ( m_object->GetFret() != 0 ) // carries something?
if ( m_object->GetCargo() != 0 ) // carries something?
{
armAction = MH_MARCHTAKE; // take walking
}
@ -989,7 +989,7 @@ bool CMotionHuman::EventFrame(const Event &event)
aa = 0.5f;
if ( i%2 == 0 ) // arm?
{
if ( m_object->GetFret() == 0 ) // does nothing?
if ( m_object->GetCargo() == 0 ) // does nothing?
{
aa = 2.0f; // moves a lot
}
@ -1620,7 +1620,7 @@ bool CMotionHuman::EventFrame(const Event &event)
float speedX = m_physics->GetLinMotionX(MO_REASPEED);
if ( m_object->GetFret() == 0 )
if ( m_object->GetCargo() == 0 )
{
if ( speedX > 0.0f ) synchro = 0.21f; // synchro forward
else synchro = 0.29f; // synchro backward
@ -1637,7 +1637,7 @@ bool CMotionHuman::EventFrame(const Event &event)
{
volume[0] = 0.5f;
freq[0] = 1.0f;
if ( m_object->GetFret() != 0 )
if ( m_object->GetCargo() != 0 )
{
//? volume[0] *= 2.0f;
freq[0] = 0.7f;

View File

@ -939,7 +939,7 @@ void CMotionVehicle::Create(Math::Vector pos, float angle, ObjectType type,
powerCell->SetPosition(0, powerCellPos);
powerCell->SetAngle(0, Math::Vector(0.0f, powerCellAngle, 0.0f));
powerCell->SetTruck(m_object);
powerCell->SetTransporter(m_object);
m_object->SetPower(powerCell);
}

View File

@ -84,7 +84,7 @@ void uObject(CBotVar* botThis, void* user)
{
CObject* object = static_cast<CObject*>(user);
CObject* power;
CObject* fret;
CObject* cargo;
CPhysics* physics;
CBotVar *pVar, *pSub;
ObjectType type;
@ -102,7 +102,7 @@ void uObject(CBotVar* botThis, void* user)
// Updates the position of the object.
pVar = pVar->GetNext(); // "position"
if ( object->GetTruck() == 0 )
if ( object->GetTransporter() == 0 )
{
pos = object->GetPosition(0);
float waterLevel = Gfx::CEngine::GetInstancePointer()->GetWater()->GetLevel();
@ -169,9 +169,9 @@ void uObject(CBotVar* botThis, void* user)
// Updates the transported object's type.
pVar = pVar->GetNext(); // "load"
fret = object->GetFret();
if ( fret == 0 ) pVar->SetPointer(0);
else pVar->SetPointer(fret->GetBotVar());
cargo = object->GetCargo();
if ( cargo == 0 ) pVar->SetPointer(0);
else pVar->SetPointer(cargo->GetBotVar());
pVar = pVar->GetNext(); // "id"
value = object->GetID();
@ -205,9 +205,9 @@ CObject::CObject(int id)
m_tilt = Math::Vector(0.0f, 0.0f, 0.0f);
m_power = 0;
m_fret = 0;
m_truck = 0;
m_truckLink = 0;
m_cargo = 0;
m_transporter = 0;
m_transporterLink = 0;
m_energy = 1.0f;
m_capacity = 1.0f;
m_shield = 1.0f;
@ -483,7 +483,7 @@ void CObject::Simplify()
}
// Detonates an object, when struck by a shot.
// Detonates an object, when stransporter by a shot.
// If false is returned, the object is still screwed.
// If true is returned, the object is destroyed.
@ -1677,36 +1677,36 @@ CObject* CObject::GetPower()
// Management of the object transport.
void CObject::SetFret(CObject* fret)
void CObject::SetCargo(CObject* cargo)
{
m_fret = fret;
m_cargo = cargo;
}
CObject* CObject::GetFret()
CObject* CObject::GetCargo()
{
return m_fret;
return m_cargo;
}
// Management of the object "truck" that transports it.
// Management of the object "transporter" that transports it.
void CObject::SetTruck(CObject* truck)
void CObject::SetTransporter(CObject* transporter)
{
m_truck = truck;
m_transporter = transporter;
// Invisible shadow if the object is transported.
m_engine->SetObjectShadowHide(m_objectPart[0].object, (m_truck != 0));
m_engine->SetObjectShadowHide(m_objectPart[0].object, (m_transporter != 0));
}
CObject* CObject::GetTruck()
CObject* CObject::GetTransporter()
{
return m_truck;
return m_transporter;
}
// Management of the conveying portion.
void CObject::SetTruckPart(int part)
void CObject::SetTransporterPart(int part)
{
m_truckLink = part;
m_transporterLink = part;
}
void CObject::SetInfoReturn(float value)
@ -1912,7 +1912,7 @@ bool CObject::UpdateTransformObject(int part, bool bForceUpdate)
bool bModif = false;
int parent;
if ( m_truck != 0 ) // transported by truck?
if ( m_transporter != 0 ) // transported by transporter?
{
m_objectPart[part].bTranslate = true;
m_objectPart[part].bRotate = true;
@ -1971,11 +1971,11 @@ bool CObject::UpdateTransformObject(int part, bool bForceUpdate)
{
parent = m_objectPart[part].parentPart;
if ( part == 0 && m_truck != 0 ) // transported by a truck?
if ( part == 0 && m_transporter != 0 ) // transported by a transporter?
{
Math::Matrix* matWorldTruck;
matWorldTruck = m_truck->GetWorldMatrix(m_truckLink);
m_objectPart[part].matWorld = Math::MultiplyMatrices(*matWorldTruck,
Math::Matrix* matWorldTransporter;
matWorldTransporter = m_transporter->GetWorldMatrix(m_transporterLink);
m_objectPart[part].matWorld = Math::MultiplyMatrices(*matWorldTransporter,
m_objectPart[part].matTransform);
}
else

View File

@ -218,11 +218,11 @@ public:
void SetPower(CObject* power);
CObject* GetPower();
void SetFret(CObject* fret);
CObject* GetFret();
void SetTruck(CObject* truck);
CObject* GetTruck();
void SetTruckPart(int part);
void SetCargo(CObject* cargo);
CObject* GetCargo();
void SetTransporter(CObject* transporter);
CObject* GetTransporter();
void SetTransporterPart(int part);
bool SetCmdLine(int rank, float value);
float GetCmdLine(int rank);
@ -400,9 +400,9 @@ protected:
Math::Vector m_cirVibration; // circular vibration
Math::Vector m_tilt; // tilt
CObject* m_power; // battery used by the vehicle
CObject* m_fret; // object transported
CObject* m_truck; // object with the latter
int m_truckLink; // part
CObject* m_cargo; // object transported
CObject* m_transporter; // object with the latter
int m_transporterLink; // part
float m_energy; // energy contained (if battery)
float m_lastEnergy;
float m_capacity; // capacity (if battery)

View File

@ -1091,7 +1091,7 @@ CObjectUPtr CObjectFactory::CreateBuilding(const ObjectCreateParams& params)
pPower->obj->CreateCrashSphere(Math::Vector(0.0f, 1.0f, 0.0f), 1.0f, SOUND_BOUMm, 0.45f);
pPower->obj->SetGlobalSphere(Math::Vector(0.0f, 1.0f, 0.0f), 1.5f);
pPower->SetTruck(obj.get());
pPower->SetTransporter(obj.get());
SetPower(pPower);
if ( power <= 1.0f ) pPower->obj->SetEnergy(power);

View File

@ -201,7 +201,7 @@ CObject* CObjectManager::Radar(CObject* pThis, Math::Vector thisPosition, float
pObj = it->second.get();
if ( pObj == pThis ) continue; // pThis may be nullptr but it doesn't matter
if ( pObj->GetTruck() != 0 ) continue; // object transported?
if ( pObj->GetTransporter() != 0 ) continue; // object transported?
if ( !pObj->GetActive() ) continue;
if ( pObj->GetProxyActivate() ) continue;

View File

@ -1996,8 +1996,8 @@ CObject* CRobotMain::DetectObject(Math::Point pos)
for (CObject* obj : m_objMan->GetAllObjects())
{
if (!obj->GetActive()) continue;
CObject* truck = obj->GetTruck();
if (truck != nullptr && !truck->GetActive()) continue;
CObject* transporter = obj->GetTransporter();
if (transporter != nullptr && !transporter->GetActive()) continue;
if (obj->GetProxyActivate()) continue;
CObject* target = nullptr;
@ -2113,7 +2113,7 @@ CObject* CRobotMain::DetectObject(Math::Point pos)
}
else if (type == OBJECT_POWER || type == OBJECT_ATOMIC)
{
target = obj->GetTruck(); // battery connected
target = obj->GetTransporter(); // battery connected
if (!target) target = obj; // standalone battery
}
@ -2617,7 +2617,7 @@ bool CRobotMain::EventFrame(const Event &event)
for (CObject* obj : m_objMan->GetAllObjects())
{
if (pm != nullptr) pm->UpdateObject(obj);
if (obj->GetTruck() != nullptr) continue;
if (obj->GetTransporter() != nullptr) continue;
ObjectType type = obj->GetType();
if (type == OBJECT_TOTO)
toto = obj;
@ -2627,7 +2627,7 @@ bool CRobotMain::EventFrame(const Event &event)
// Advances all objects transported by robots.
for (CObject* obj : m_objMan->GetAllObjects())
{
if (obj->GetTruck() == nullptr) continue;
if (obj->GetTransporter() == nullptr) continue;
obj->EventProcess(event);
}
@ -4189,7 +4189,7 @@ float CRobotMain::SearchNearestObject(Math::Vector center, CObject *exclu)
for (CObject* obj : m_objMan->GetAllObjects())
{
if (!obj->GetActive()) continue; // inactive?
if (obj->GetTruck() != nullptr) continue; // object carries?
if (obj->GetTransporter() != nullptr) continue; // object carries?
if (obj == exclu) continue;
ObjectType type = obj->GetType();
@ -4325,7 +4325,7 @@ void CRobotMain::HideDropZone(CObject* metal)
}
//! Shows the buildable area when a cube of metal is deposited
void CRobotMain::ShowDropZone(CObject* metal, CObject* truck)
void CRobotMain::ShowDropZone(CObject* metal, CObject* transporter)
{
if (metal == nullptr) return;
@ -4337,9 +4337,9 @@ void CRobotMain::ShowDropZone(CObject* metal, CObject* truck)
for (CObject* obj : m_objMan->GetAllObjects())
{
if (!obj->GetActive()) continue; // inactive?
if (obj->GetTruck() != nullptr) continue; // object carried?
if (obj->GetTransporter() != nullptr) continue; // object carried?
if (obj == metal) continue;
if (obj == truck) continue;
if (obj == transporter) continue;
Math::Vector oPos;
float oRadius;
@ -4540,7 +4540,7 @@ void CRobotMain::CompileScript(bool soluce)
nbError = 0;
for (CObject* obj : m_objMan->GetAllObjects())
{
if (obj->GetTruck() != nullptr) continue;
if (obj->GetTransporter() != nullptr) continue;
CBrain* brain = obj->GetBrain();
if (brain == nullptr) continue;
@ -4568,7 +4568,7 @@ void CRobotMain::CompileScript(bool soluce)
{
for (CObject* obj : m_objMan->GetAllObjects())
{
if (obj->GetTruck() != 0) continue;
if (obj->GetTransporter() != 0) continue;
CBrain* brain = obj->GetBrain();
if (brain == 0) continue;
@ -4584,7 +4584,7 @@ void CRobotMain::CompileScript(bool soluce)
// Start all programs according to the command "run".
for (CObject* obj : m_objMan->GetAllObjects())
{
if (obj->GetTruck() != nullptr) continue;
if (obj->GetTransporter() != nullptr) continue;
CBrain* brain = obj->GetBrain();
if (brain == nullptr) continue;
@ -4949,18 +4949,18 @@ bool CRobotMain::IOWriteScene(const char *filename, const char *filecbot, char *
{
if (obj->GetType() == OBJECT_TOTO) continue;
if (obj->GetType() == OBJECT_FIX) continue;
if (obj->GetTruck() != nullptr) continue;
if (obj->GetTransporter() != nullptr) continue;
if (obj->GetBurn()) continue;
if (obj->GetDead()) continue;
if (obj->IsExploding()) continue;
CObject* power = obj->GetPower();
CObject* fret = obj->GetFret();
CObject* cargo = obj->GetCargo();
if (fret != nullptr) // object transported?
if (cargo != nullptr) // object transported?
{
line.reset(new CLevelParserLine("CreateFret"));
IOWriteObject(line.get(), fret);
IOWriteObject(line.get(), cargo);
levelParser.AddLine(std::move(line));
}
@ -5002,7 +5002,7 @@ bool CRobotMain::IOWriteScene(const char *filename, const char *filecbot, char *
{
if (obj->GetType() == OBJECT_TOTO) continue;
if (obj->GetType() == OBJECT_FIX) continue;
if (obj->GetTruck() != nullptr) continue;
if (obj->GetTransporter() != nullptr) continue;
if (obj->GetBurn()) continue;
if (obj->GetDead()) continue;
@ -5102,7 +5102,7 @@ CObject* CRobotMain::IOReadScene(const char *filename, const char *filecbot)
levelParser.Load();
m_base = nullptr;
CObject* fret = nullptr;
CObject* cargo = nullptr;
CObject* power = nullptr;
CObject* sel = nullptr;
int objRank = 0;
@ -5124,7 +5124,7 @@ CObject* CRobotMain::IOReadScene(const char *filename, const char *filecbot)
}
if (line->GetCommand() == "CreateFret")
fret = IOReadObject(line.get(), filename, -1);
cargo = IOReadObject(line.get(), filename, -1);
if (line->GetCommand() == "CreatePower")
power = IOReadObject(line.get(), filename, -1);
@ -5136,9 +5136,9 @@ CObject* CRobotMain::IOReadScene(const char *filename, const char *filecbot)
if (line->GetParam("select")->AsBool(false))
sel = obj;
if (fret != nullptr)
if (cargo != nullptr)
{
obj->SetFret(fret);
obj->SetCargo(cargo);
CTaskManip* task = new CTaskManip(obj);
task->Start(TMO_AUTO, TMA_GRAB); // holds the object!
delete task;
@ -5147,10 +5147,10 @@ CObject* CRobotMain::IOReadScene(const char *filename, const char *filecbot)
if (power != nullptr)
{
obj->SetPower(power);
power->SetTruck(obj);
power->SetTransporter(obj);
}
fret = nullptr;
cargo = nullptr;
power = nullptr;
}
}
@ -5164,7 +5164,7 @@ CObject* CRobotMain::IOReadScene(const char *filename, const char *filecbot)
nbError = 0;
for (CObject* obj : m_objMan->GetAllObjects())
{
if (obj->GetTruck() != nullptr) continue;
if (obj->GetTransporter() != nullptr) continue;
objRank = obj->GetDefRank();
if (objRank == -1) continue;
@ -5177,7 +5177,7 @@ CObject* CRobotMain::IOReadScene(const char *filename, const char *filecbot)
// Starts scripts
for (CObject* obj : m_objMan->GetAllObjects())
{
if (obj->GetTruck() != nullptr) continue;
if (obj->GetTransporter() != nullptr) continue;
if (obj->GetDefRank() == -1) continue;
CBrain* brain = obj->GetBrain();
@ -5206,7 +5206,7 @@ CObject* CRobotMain::IOReadScene(const char *filename, const char *filecbot)
{
if (obj->GetType() == OBJECT_TOTO) continue;
if (obj->GetType() == OBJECT_FIX) continue;
if (obj->GetTruck() != nullptr) continue;
if (obj->GetTransporter() != nullptr) continue;
if (obj->GetBurn()) continue;
if (obj->GetDead()) continue;
@ -5277,7 +5277,7 @@ void CRobotMain::ResetObject()
// TODO: ?
#if 0
CObject* obj;
CObject* truck;
CObject* transporter;
CAuto* objAuto;
CBrain* brain;
CPyro* pyro;
@ -5313,11 +5313,11 @@ void CRobotMain::ResetObject()
if ( cap == RESET_DELETE )
{
truck = obj->GetTruck();
if ( truck != 0 )
transporter = obj->GetTransporter();
if ( transporter != 0 )
{
truck->SetFret(0);
obj->SetTruck(0);
transporter->SetCargo(0);
obj->SetTransporter(0);
}
obj->DeleteObject();
delete obj;
@ -5471,10 +5471,10 @@ void CRobotMain::UpdateAudio(bool frame)
if (energyLevel < m_audioChange[t].powermin || energyLevel > m_audioChange[t].powermax)
continue;
if (obj->GetTruck() == 0)
if (obj->GetTransporter() == 0)
oPos = obj->GetPosition(0);
else
oPos = obj->GetTruck()->GetPosition(0);
oPos = obj->GetTransporter()->GetPosition(0);
oPos.y = 0.0f;
@ -5566,7 +5566,7 @@ Error CRobotMain::CheckEndMission(bool frame)
if (!m_endTake[t].countTransported)
{
if (obj->GetTruck() != nullptr) continue;
if (obj->GetTransporter() != nullptr) continue;
}
ObjectType type = obj->GetType();
@ -5610,10 +5610,10 @@ Error CRobotMain::CheckEndMission(bool frame)
}
if (energyLevel < m_endTake[t].powermin || energyLevel > m_endTake[t].powermax) continue;
if (obj->GetTruck() == 0)
if (obj->GetTransporter() == 0)
oPos = obj->GetPosition(0);
else
oPos = obj->GetTruck()->GetPosition(0);
oPos = obj->GetTransporter()->GetPosition(0);
oPos.y = 0.0f;

View File

@ -308,7 +308,7 @@ public:
bool FreeSpace(Math::Vector &center, float minRadius, float maxRadius, float space, CObject *exclu);
float GetFlatZoneRadius(Math::Vector center, float maxRadius, CObject *exclu);
void HideDropZone(CObject* metal);
void ShowDropZone(CObject* metal, CObject* truck);
void ShowDropZone(CObject* metal, CObject* transporter);
void FlushShowLimit(int i);
void SetShowLimit(int i, Gfx::ParticleType parti, CObject *pObj, Math::Vector pos,
float radius, float duration=SHOWLIMITTIME);

View File

@ -346,7 +346,7 @@ Error CTaskBuild::Start(ObjectType type)
if ( speed.x != 0.0f ||
speed.z != 0.0f ) return ERR_BUILD_MOTOR;
if ( m_object->GetFret() != 0 ) return ERR_MANIP_BUSY;
if ( m_object->GetCargo() != 0 ) return ERR_MANIP_BUSY;
m_metal = SearchMetalObject(oAngle, 2.0f, 100.0f, Math::PI*0.25f, err);
if ( err == ERR_BUILD_METALNEAR && m_metal != 0 )
@ -592,7 +592,7 @@ Error CTaskBuild::FlatFloor()
for (CObject* pObj : CObjectManager::GetInstancePointer()->GetAllObjects())
{
if ( !pObj->GetActive() ) continue; // inactive?
if ( pObj->GetTruck() != 0 ) continue; // object transported?
if ( pObj->GetTransporter() != 0 ) continue; // object transported?
if ( pObj == m_metal ) continue;
if ( pObj == m_object ) continue;
@ -637,7 +637,7 @@ Error CTaskBuild::FlatFloor()
for (CObject* pObj : CObjectManager::GetInstancePointer()->GetAllObjects())
{
if ( !pObj->GetActive() ) continue; // inactive?
if ( pObj->GetTruck() != 0 ) continue; // object transported?
if ( pObj->GetTransporter() != 0 ) continue; // object transported?
if ( pObj == m_metal ) continue;
if ( pObj == m_object ) continue;
@ -705,7 +705,7 @@ CObject* CTaskBuild::SearchMetalObject(float &angle, float dMin, float dMax,
for (CObject* pObj : CObjectManager::GetInstancePointer()->GetAllObjects())
{
if ( !pObj->GetActive() ) continue; // objet inactive?
if ( pObj->GetTruck() != 0 ) continue; // object transported?
if ( pObj->GetTransporter() != 0 ) continue; // object transported?
type = pObj->GetType();
if ( type != OBJECT_METAL ) continue;

View File

@ -85,7 +85,7 @@ Error CTaskFlag::Start(TaskFlagOrder order, int rank)
if ( speed.x != 0.0f ||
speed.z != 0.0f ) return ERR_FLAG_MOTOR;
if ( m_object->GetFret() != 0 ) return ERR_FLAG_BUSY;
if ( m_object->GetCargo() != 0 ) return ERR_FLAG_BUSY;
if ( order == TFL_CREATE )
{

View File

@ -144,7 +144,7 @@ bool CTaskGoto::EventProcess(const Event &event)
pos = m_object->GetPosition(0);
if ( m_bmFretObject == 0 )
if ( m_bmCargoObject == 0 )
{
goal = m_goal;
dist = 0.0f;
@ -153,7 +153,7 @@ bool CTaskGoto::EventProcess(const Event &event)
{
goal = m_goalObject;
dist = TAKE_DIST+2.0f;
if ( m_bmFretObject->GetType() == OBJECT_BASE ) dist = 12.0f;
if ( m_bmCargoObject->GetType() == OBJECT_BASE ) dist = 12.0f;
}
ret = BeamSearch(pos, goal, dist);
@ -647,7 +647,7 @@ Error CTaskGoto::Start(Math::Vector goal, float altitude,
m_phase = TGP_ADVANCE;
m_error = ERR_OK;
m_try = 0;
m_bmFretObject = 0;
m_bmCargoObject = 0;
m_bmFinalMove = 0.0f;
pos = m_object->GetPosition(0);
@ -715,7 +715,7 @@ Error CTaskGoto::Start(Math::Vector goal, float altitude,
dist = 4.0f;
if ( AdjustTarget(target, m_goal, dist) )
{
m_bmFretObject = target; // cargo on the ground
m_bmCargoObject = target; // cargo on the ground
}
else
{
@ -737,7 +737,7 @@ Error CTaskGoto::Start(Math::Vector goal, float altitude,
BeamStart();
if ( m_bmFretObject == 0 )
if ( m_bmCargoObject == 0 )
{
x = static_cast<int>((m_goal.x+1600.0f)/BM_DIM_STEP);
y = static_cast<int>((m_goal.z+1600.0f)/BM_DIM_STEP);
@ -1148,7 +1148,7 @@ bool CTaskGoto::AdjustBuilding(Math::Vector &pos, float margin, float &distance)
for (CObject* obj : CObjectManager::GetInstancePointer()->GetAllObjects())
{
if ( !obj->GetActive() ) continue;
if ( obj->GetTruck() != nullptr ) continue; // object transported?
if ( obj->GetTransporter() != nullptr ) continue; // object transported?
Math::Vector oPos;
float suppl = 0.0f;
@ -1309,7 +1309,7 @@ bool CTaskGoto::LeakSearch(Math::Vector &pos, float &delay)
{
if ( pObj == m_object ) continue;
if ( !pObj->GetActive() ) continue;
if ( pObj->GetTruck() != 0 ) continue; // object transported?
if ( pObj->GetTransporter() != 0 ) continue; // object transported?
j = 0;
while ( pObj->GetCrashSphere(j++, oPos, oRadius) )
@ -1366,7 +1366,7 @@ void CTaskGoto::ComputeRepulse(Math::Point &dir)
if ( pObj == 0 ) break;
if ( pObj == m_object ) continue;
if ( pObj->GetTruck() != 0 ) continue;
if ( pObj->GetTransporter() != 0 ) continue;
oPos = pObj->GetPosition(0);
dist = Math::Distance(oPos, m_goalObject);
@ -1485,7 +1485,7 @@ void CTaskGoto::ComputeRepulse(Math::Point &dir)
for (CObject* pObj : CObjectManager::GetInstancePointer()->GetAllObjects())
{
if ( pObj == m_object ) continue;
if ( pObj->GetTruck() != 0 ) continue;
if ( pObj->GetTransporter() != 0 ) continue;
oType = pObj->GetType();
@ -1573,7 +1573,7 @@ void CTaskGoto::ComputeFlyingRepulse(float &dir)
for (CObject* pObj : CObjectManager::GetInstancePointer()->GetAllObjects())
{
if ( pObj == m_object ) continue;
if ( pObj->GetTruck() != 0 ) continue;
if ( pObj->GetTransporter() != 0 ) continue;
oType = pObj->GetType();
@ -1885,8 +1885,8 @@ void CTaskGoto::BitmapObject()
type = pObj->GetType();
if ( pObj == m_object ) continue;
if ( pObj == m_bmFretObject ) continue;
if ( pObj->GetTruck() != 0 ) continue;
if ( pObj == m_bmCargoObject ) continue;
if ( pObj->GetTransporter() != 0 ) continue;
h = m_terrain->GetFloorLevel(pObj->GetPosition(0), false);
if ( m_physics->GetType() == TYPE_FLYING && m_altitude > 0.0f )

View File

@ -145,7 +145,7 @@ protected:
Math::Vector m_bmPoints[MAXPOINTS+2];
char m_bmIter[MAXPOINTS+2];
int m_bmIterCounter;
CObject* m_bmFretObject;
CObject* m_bmCargoObject;
float m_bmFinalMove; // final advance distance
float m_bmFinalDist; // effective distance to advance
Math::Vector m_bmFinalPos; // initial position before advance

View File

@ -317,22 +317,22 @@ Error CTaskManip::Start(TaskManipOrder order, TaskManipArm arm)
type = m_object->GetType();
if ( type == OBJECT_BEE ) // bee?
{
if ( m_object->GetFret() == 0 )
if ( m_object->GetCargo() == 0 )
{
if ( !m_physics->GetLand() ) return ERR_MANIP_FLY;
other = SearchTakeUnderObject(m_targetPos, MARGIN_BEE);
if ( other == 0 ) return ERR_MANIP_NIL;
m_object->SetFret(other); // takes the ball
other->SetTruck(m_object);
other->SetTruckPart(0); // taken with the base
m_object->SetCargo(other); // takes the ball
other->SetTransporter(m_object);
other->SetTransporterPart(0); // taken with the base
other->SetPosition(0, Math::Vector(0.0f, -3.0f, 0.0f));
}
else
{
other = m_object->GetFret(); // other = ball
m_object->SetFret(0); // lick the ball
other->SetTruck(0);
other = m_object->GetCargo(); // other = ball
m_object->SetCargo(0); // lick the ball
other->SetTransporter(0);
pos = m_object->GetPosition(0);
pos.y -= 3.0f;
other->SetPosition(0, pos);
@ -354,7 +354,7 @@ Error CTaskManip::Start(TaskManipOrder order, TaskManipArm arm)
if ( m_arm == TMA_GRAB ) // takes immediately?
{
TruckTakeObject();
TransporterTakeObject();
Abort();
return ERR_OK;
}
@ -384,7 +384,7 @@ Error CTaskManip::Start(TaskManipOrder order, TaskManipArm arm)
if ( order == TMO_AUTO )
{
if ( m_object->GetFret() == 0 )
if ( m_object->GetCargo() == 0 )
{
m_order = TMO_GRAB;
}
@ -398,11 +398,11 @@ Error CTaskManip::Start(TaskManipOrder order, TaskManipArm arm)
m_order = order;
}
if ( m_order == TMO_GRAB && m_object->GetFret() != 0 )
if ( m_order == TMO_GRAB && m_object->GetCargo() != 0 )
{
return ERR_MANIP_BUSY;
}
if ( m_order == TMO_DROP && m_object->GetFret() == 0 )
if ( m_order == TMO_DROP && m_object->GetCargo() == 0 )
{
return ERR_MANIP_EMPTY;
}
@ -498,7 +498,7 @@ Error CTaskManip::Start(TaskManipOrder order, TaskManipArm arm)
if ( m_timeLimit < 0.5f ) m_timeLimit = 0.5f;
}
if ( m_object->GetFret() == 0 ) // not carrying anything?
if ( m_object->GetCargo() == 0 ) // not carrying anything?
{
m_hand = TMH_OPEN; // open clamp
}
@ -534,7 +534,7 @@ Error CTaskManip::Start(TaskManipOrder order, TaskManipArm arm)
Error CTaskManip::IsEnded()
{
CObject* fret;
CObject* cargo;
Math::Vector pos;
float angle, dist;
int i;
@ -622,8 +622,8 @@ Error CTaskManip::IsEnded()
if ( m_step == 2 )
{
if ( m_bSubm ) m_speed = 1.0f/1.5f;
if ( !TruckTakeObject() &&
m_object->GetFret() == 0 )
if ( !TransporterTakeObject() &&
m_object->GetCargo() == 0 )
{
m_hand = TMH_OPEN; // reopens the clamp
m_arm = TMA_NEUTRAL;
@ -634,8 +634,8 @@ Error CTaskManip::IsEnded()
{
if ( (m_arm == TMA_OTHER ||
m_arm == TMA_POWER ) &&
(m_fretType == OBJECT_POWER ||
m_fretType == OBJECT_ATOMIC ) )
(m_cargoType == OBJECT_POWER ||
m_cargoType == OBJECT_ATOMIC ) )
{
m_sound->Play(SOUND_POWEROFF, m_object->GetPosition(0));
}
@ -652,19 +652,19 @@ Error CTaskManip::IsEnded()
if ( m_step == 1 )
{
if ( m_bSubm ) m_speed = 1.0f/0.7f;
fret = m_object->GetFret();
if ( TruckDeposeObject() )
cargo = m_object->GetCargo();
if ( TransporterDeposeObject() )
{
if ( (m_arm == TMA_OTHER ||
m_arm == TMA_POWER ) &&
(m_fretType == OBJECT_POWER ||
m_fretType == OBJECT_ATOMIC ) )
(m_cargoType == OBJECT_POWER ||
m_cargoType == OBJECT_ATOMIC ) )
{
m_sound->Play(SOUND_POWERON, m_object->GetPosition(0));
}
if ( fret != 0 && m_fretType == OBJECT_METAL && m_arm == TMA_FFRONT )
if ( cargo != 0 && m_cargoType == OBJECT_METAL && m_arm == TMA_FFRONT )
{
m_main->ShowDropZone(fret, m_object); // shows buildable area
m_main->ShowDropZone(cargo, m_object); // shows buildable area
}
m_hand = TMH_OPEN; // opens the clamp to deposit
SoundManip(1.0f/m_speed, 0.8f, 1.5f);
@ -692,7 +692,7 @@ bool CTaskManip::Abort()
{
int i;
if ( m_object->GetFret() == 0 ) // not carrying anything?
if ( m_object->GetCargo() == 0 ) // not carrying anything?
{
m_hand = TMH_OPEN; // open clamp
m_arm = TMA_NEUTRAL;
@ -749,7 +749,7 @@ CObject* CTaskManip::SearchTakeUnderObject(Math::Vector &pos, float dLimit)
type != OBJECT_KEYd &&
type != OBJECT_TNT ) continue;
if ( pObj->GetTruck() != 0 ) continue; // object transported?
if ( pObj->GetTransporter() != 0 ) continue; // object transported?
if ( pObj->GetLock() ) continue;
if ( pObj->GetZoomY(0) != 1.0f ) continue;
@ -821,7 +821,7 @@ CObject* CTaskManip::SearchTakeFrontObject(bool bAdvance, Math::Vector &pos,
type != OBJECT_SCRAP4 &&
type != OBJECT_SCRAP5 ) continue;
if ( pObj->GetTruck() != 0 ) continue; // object transported?
if ( pObj->GetTransporter() != 0 ) continue; // object transported?
if ( pObj->GetLock() ) continue;
if ( pObj->GetZoomY(0) != 1.0f ) continue;
@ -908,7 +908,7 @@ CObject* CTaskManip::SearchTakeBackObject(bool bAdvance, Math::Vector &pos,
type != OBJECT_SCRAP4 &&
type != OBJECT_SCRAP5 ) continue;
if ( pObj->GetTruck() != 0 ) continue; // object transported?
if ( pObj->GetTransporter() != 0 ) continue; // object transported?
if ( pObj->GetLock() ) continue;
if ( pObj->GetZoomY(0) != 1.0f ) continue;
@ -1077,9 +1077,9 @@ CObject* CTaskManip::SearchOtherObject(bool bAdvance, Math::Vector &pos,
// Takes the object placed in front.
bool CTaskManip::TruckTakeObject()
bool CTaskManip::TransporterTakeObject()
{
CObject* fret;
CObject* cargo;
CObject* other;
Math::Matrix matRotate;
Math::Vector pos;
@ -1087,112 +1087,112 @@ bool CTaskManip::TruckTakeObject()
if ( m_arm == TMA_GRAB ) // takes immediately?
{
fret = m_object->GetFret();
if ( fret == 0 ) return false; // nothing to take?
m_fretType = fret->GetType();
cargo = m_object->GetCargo();
if ( cargo == 0 ) return false; // nothing to take?
m_cargoType = cargo->GetType();
if ( m_object->GetType() == OBJECT_HUMAN ||
m_object->GetType() == OBJECT_TECH )
{
fret->SetTruck(m_object);
fret->SetTruckPart(4); // takes with the hand
cargo->SetTransporter(m_object);
cargo->SetTransporterPart(4); // takes with the hand
fret->SetPosition(0, Math::Vector(1.7f, -0.5f, 1.1f));
fret->SetAngleY(0, 0.1f);
fret->SetAngleX(0, 0.0f);
fret->SetAngleZ(0, 0.8f);
cargo->SetPosition(0, Math::Vector(1.7f, -0.5f, 1.1f));
cargo->SetAngleY(0, 0.1f);
cargo->SetAngleX(0, 0.0f);
cargo->SetAngleZ(0, 0.8f);
}
else if ( m_bSubm )
{
fret->SetTruck(m_object);
fret->SetTruckPart(2); // takes with the right claw
cargo->SetTransporter(m_object);
cargo->SetTransporterPart(2); // takes with the right claw
pos = Math::Vector(1.1f, -1.0f, 1.0f); // relative
fret->SetPosition(0, pos);
fret->SetAngleX(0, 0.0f);
fret->SetAngleY(0, 0.0f);
fret->SetAngleZ(0, 0.0f);
cargo->SetPosition(0, pos);
cargo->SetAngleX(0, 0.0f);
cargo->SetAngleY(0, 0.0f);
cargo->SetAngleZ(0, 0.0f);
}
else
{
fret->SetTruck(m_object);
fret->SetTruckPart(3); // takes with the hand
cargo->SetTransporter(m_object);
cargo->SetTransporterPart(3); // takes with the hand
pos = Math::Vector(4.7f, 0.0f, 0.0f); // relative to the hand (lem4)
fret->SetPosition(0, pos);
fret->SetAngleX(0, 0.0f);
fret->SetAngleZ(0, Math::PI/2.0f);
fret->SetAngleY(0, 0.0f);
cargo->SetPosition(0, pos);
cargo->SetAngleX(0, 0.0f);
cargo->SetAngleZ(0, Math::PI/2.0f);
cargo->SetAngleY(0, 0.0f);
}
m_object->SetFret(fret); // takes
m_object->SetCargo(cargo); // takes
}
if ( m_arm == TMA_FFRONT ) // takes on the ground in front?
{
fret = SearchTakeFrontObject(false, pos, dist, angle);
if ( fret == 0 ) return false; // nothing to take?
m_fretType = fret->GetType();
cargo = SearchTakeFrontObject(false, pos, dist, angle);
if ( cargo == 0 ) return false; // nothing to take?
m_cargoType = cargo->GetType();
if ( m_bSubm )
{
fret->SetTruck(m_object);
fret->SetTruckPart(2); // takes with the right claw
cargo->SetTransporter(m_object);
cargo->SetTransporterPart(2); // takes with the right claw
pos = Math::Vector(1.1f, -1.0f, 1.0f); // relative
fret->SetPosition(0, pos);
fret->SetAngleX(0, 0.0f);
fret->SetAngleY(0, 0.0f);
fret->SetAngleZ(0, 0.0f);
cargo->SetPosition(0, pos);
cargo->SetAngleX(0, 0.0f);
cargo->SetAngleY(0, 0.0f);
cargo->SetAngleZ(0, 0.0f);
}
else
{
fret->SetTruck(m_object);
fret->SetTruckPart(3); // takes with the hand
cargo->SetTransporter(m_object);
cargo->SetTransporterPart(3); // takes with the hand
pos = Math::Vector(4.7f, 0.0f, 0.0f); // relative to the hand (lem4)
fret->SetPosition(0, pos);
fret->SetAngleX(0, 0.0f);
fret->SetAngleZ(0, Math::PI/2.0f);
fret->SetAngleY(0, 0.0f);
cargo->SetPosition(0, pos);
cargo->SetAngleX(0, 0.0f);
cargo->SetAngleZ(0, Math::PI/2.0f);
cargo->SetAngleY(0, 0.0f);
}
m_object->SetFret(fret); // takes
m_object->SetCargo(cargo); // takes
}
if ( m_arm == TMA_FBACK ) // takes on the ground behind?
{
fret = SearchTakeBackObject(false, pos, dist, angle);
if ( fret == 0 ) return false; // nothing to take?
m_fretType = fret->GetType();
cargo = SearchTakeBackObject(false, pos, dist, angle);
if ( cargo == 0 ) return false; // nothing to take?
m_cargoType = cargo->GetType();
fret->SetTruck(m_object);
fret->SetTruckPart(3); // takes with the hand
cargo->SetTransporter(m_object);
cargo->SetTransporterPart(3); // takes with the hand
pos = Math::Vector(4.7f, 0.0f, 0.0f); // relative to the hand (lem4)
fret->SetPosition(0, pos);
fret->SetAngleX(0, 0.0f);
fret->SetAngleZ(0, Math::PI/2.0f);
fret->SetAngleY(0, 0.0f);
cargo->SetPosition(0, pos);
cargo->SetAngleX(0, 0.0f);
cargo->SetAngleZ(0, Math::PI/2.0f);
cargo->SetAngleY(0, 0.0f);
m_object->SetFret(fret); // takes
m_object->SetCargo(cargo); // takes
}
if ( m_arm == TMA_POWER ) // takes battery in the back?
{
fret = m_object->GetPower();
if ( fret == 0 ) return false; // no battery?
m_fretType = fret->GetType();
cargo = m_object->GetPower();
if ( cargo == 0 ) return false; // no battery?
m_cargoType = cargo->GetType();
pos = Math::Vector(4.7f, 0.0f, 0.0f); // relative to the hand (lem4)
fret->SetPosition(0, pos);
fret->SetAngleX(0, 0.0f);
fret->SetAngleZ(0, Math::PI/2.0f);
fret->SetAngleY(0, 0.0f);
fret->SetTruckPart(3); // takes with the hand
cargo->SetPosition(0, pos);
cargo->SetAngleX(0, 0.0f);
cargo->SetAngleZ(0, Math::PI/2.0f);
cargo->SetAngleY(0, 0.0f);
cargo->SetTransporterPart(3); // takes with the hand
m_object->SetPower(0);
m_object->SetFret(fret); // takes
m_object->SetCargo(cargo); // takes
}
if ( m_arm == TMA_OTHER ) // battery takes from friend?
@ -1200,21 +1200,21 @@ bool CTaskManip::TruckTakeObject()
other = SearchOtherObject(false, pos, dist, angle, m_height);
if ( other == 0 ) return false;
fret = other->GetPower();
if ( fret == 0 ) return false; // the other does not have a battery?
m_fretType = fret->GetType();
cargo = other->GetPower();
if ( cargo == 0 ) return false; // the other does not have a battery?
m_cargoType = cargo->GetType();
other->SetPower(0);
fret->SetTruck(m_object);
fret->SetTruckPart(3); // takes with the hand
cargo->SetTransporter(m_object);
cargo->SetTransporterPart(3); // takes with the hand
pos = Math::Vector(4.7f, 0.0f, 0.0f); // relative to the hand (lem4)
fret->SetPosition(0, pos);
fret->SetAngleX(0, 0.0f);
fret->SetAngleZ(0, Math::PI/2.0f);
fret->SetAngleY(0, 0.0f);
cargo->SetPosition(0, pos);
cargo->SetAngleX(0, 0.0f);
cargo->SetAngleZ(0, Math::PI/2.0f);
cargo->SetAngleY(0, 0.0f);
m_object->SetFret(fret); // takes
m_object->SetCargo(cargo); // takes
}
return true;
@ -1222,10 +1222,10 @@ bool CTaskManip::TruckTakeObject()
// Deposes the object taken.
bool CTaskManip::TruckDeposeObject()
bool CTaskManip::TransporterDeposeObject()
{
Character* character;
CObject* fret;
CObject* cargo;
CObject* other;
Math::Matrix* mat;
Math::Vector pos;
@ -1233,60 +1233,60 @@ bool CTaskManip::TruckDeposeObject()
if ( m_arm == TMA_FFRONT ) // deposits on the ground in front?
{
fret = m_object->GetFret();
if ( fret == 0 ) return false; // nothing transported?
m_fretType = fret->GetType();
cargo = m_object->GetCargo();
if ( cargo == 0 ) return false; // nothing transported?
m_cargoType = cargo->GetType();
mat = fret->GetWorldMatrix(0);
mat = cargo->GetWorldMatrix(0);
pos = Transform(*mat, Math::Vector(0.0f, 1.0f, 0.0f));
m_terrain->AdjustToFloor(pos);
fret->SetPosition(0, pos);
fret->SetAngleY(0, m_object->GetAngleY(0)+Math::PI/2.0f);
fret->SetAngleX(0, 0.0f);
fret->SetAngleZ(0, 0.0f);
fret->FloorAdjust(); // plate well on the ground
cargo->SetPosition(0, pos);
cargo->SetAngleY(0, m_object->GetAngleY(0)+Math::PI/2.0f);
cargo->SetAngleX(0, 0.0f);
cargo->SetAngleZ(0, 0.0f);
cargo->FloorAdjust(); // plate well on the ground
fret->SetTruck(0);
m_object->SetFret(0); // deposit
cargo->SetTransporter(0);
m_object->SetCargo(0); // deposit
}
if ( m_arm == TMA_FBACK ) // deposited on the ground behind?
{
fret = m_object->GetFret();
if ( fret == 0 ) return false; // nothing transported?
m_fretType = fret->GetType();
cargo = m_object->GetCargo();
if ( cargo == 0 ) return false; // nothing transported?
m_cargoType = cargo->GetType();
mat = fret->GetWorldMatrix(0);
mat = cargo->GetWorldMatrix(0);
pos = Transform(*mat, Math::Vector(0.0f, 1.0f, 0.0f));
m_terrain->AdjustToFloor(pos);
fret->SetPosition(0, pos);
fret->SetAngleY(0, m_object->GetAngleY(0)+Math::PI/2.0f);
fret->SetAngleX(0, 0.0f);
fret->SetAngleZ(0, 0.0f);
cargo->SetPosition(0, pos);
cargo->SetAngleY(0, m_object->GetAngleY(0)+Math::PI/2.0f);
cargo->SetAngleX(0, 0.0f);
cargo->SetAngleZ(0, 0.0f);
fret->SetTruck(0);
m_object->SetFret(0); // deposit
cargo->SetTransporter(0);
m_object->SetCargo(0); // deposit
}
if ( m_arm == TMA_POWER ) // deposits battery in the back?
{
fret = m_object->GetFret();
if ( fret == 0 ) return false; // nothing transported?
m_fretType = fret->GetType();
cargo = m_object->GetCargo();
if ( cargo == 0 ) return false; // nothing transported?
m_cargoType = cargo->GetType();
if ( m_object->GetPower() != 0 ) return false;
fret->SetTruck(m_object);
fret->SetTruckPart(0); // carried by the base
cargo->SetTransporter(m_object);
cargo->SetTransporterPart(0); // carried by the base
character = m_object->GetCharacter();
fret->SetPosition(0, character->posPower);
fret->SetAngleY(0, 0.0f);
fret->SetAngleX(0, 0.0f);
fret->SetAngleZ(0, 0.0f);
cargo->SetPosition(0, character->posPower);
cargo->SetAngleY(0, 0.0f);
cargo->SetAngleX(0, 0.0f);
cargo->SetAngleZ(0, 0.0f);
m_object->SetPower(fret); // uses
m_object->SetFret(0);
m_object->SetPower(cargo); // uses
m_object->SetCargo(0);
}
if ( m_arm == TMA_OTHER ) // deposits battery on friend?
@ -1294,24 +1294,24 @@ bool CTaskManip::TruckDeposeObject()
other = SearchOtherObject(false, pos, dist, angle, m_height);
if ( other == 0 ) return false;
fret = other->GetPower();
if ( fret != 0 ) return false; // the other already has a battery?
cargo = other->GetPower();
if ( cargo != 0 ) return false; // the other already has a battery?
fret = m_object->GetFret();
if ( fret == 0 ) return false;
m_fretType = fret->GetType();
cargo = m_object->GetCargo();
if ( cargo == 0 ) return false;
m_cargoType = cargo->GetType();
other->SetPower(fret);
fret->SetTruck(other);
other->SetPower(cargo);
cargo->SetTransporter(other);
character = other->GetCharacter();
fret->SetPosition(0, character->posPower);
fret->SetAngleY(0, 0.0f);
fret->SetAngleX(0, 0.0f);
fret->SetAngleZ(0, 0.0f);
fret->SetTruckPart(0); // carried by the base
cargo->SetPosition(0, character->posPower);
cargo->SetAngleY(0, 0.0f);
cargo->SetAngleX(0, 0.0f);
cargo->SetAngleZ(0, 0.0f);
cargo->SetTransporterPart(0); // carried by the base
m_object->SetFret(0); // deposit
m_object->SetCargo(0); // deposit
}
return true;
@ -1328,7 +1328,7 @@ bool CTaskManip::IsFreeDeposeObject(Math::Vector pos)
{
if ( obj == m_object ) continue;
if ( !obj->GetActive() ) continue; // inactive?
if ( obj->GetTruck() != nullptr ) continue; // object transported?
if ( obj->GetTransporter() != nullptr ) continue; // object transported?
Math::Vector oPos;
float oRadius = 0.0f;

View File

@ -72,8 +72,8 @@ protected:
CObject* SearchTakeFrontObject(bool bAdvance, Math::Vector &pos, float &distance, float &angle);
CObject* SearchTakeBackObject(bool bAdvance, Math::Vector &pos, float &distance, float &angle);
CObject* SearchOtherObject(bool bAdvance, Math::Vector &pos, float &distance, float &angle, float &height);
bool TruckTakeObject();
bool TruckDeposeObject();
bool TransporterTakeObject();
bool TransporterDeposeObject();
bool IsFreeDeposeObject(Math::Vector pos);
void SoundManip(float time, float amplitude=1.0f, float frequency=1.0f);
@ -97,6 +97,6 @@ protected:
float m_move;
Math::Vector m_targetPos;
float m_timeLimit;
ObjectType m_fretType;
ObjectType m_cargoType;
};

View File

@ -163,14 +163,14 @@ bool CTaskReset::EventProcess(const Event &event)
Error CTaskReset::Start(Math::Vector goal, Math::Vector angle)
{
CObject* fret;
CObject* cargo;
int i;
fret = m_object->GetFret();
if ( fret != 0 && fret->GetResetCap() == RESET_MOVE )
cargo = m_object->GetCargo();
if ( cargo != 0 && cargo->GetResetCap() == RESET_MOVE )
{
fret->SetTruck(0);
m_object->SetFret(0); // does nothing
cargo->SetTransporter(0);
m_object->SetCargo(0); // does nothing
}
if ( !m_main->GetNiceReset() ) // quick return?

View File

@ -112,7 +112,7 @@ Error CTaskTake::Start()
m_physics->SetMotorSpeed(Math::Vector(0.0f, 0.0f, 0.0f));
if ( m_object->GetFret() == 0 )
if ( m_object->GetCargo() == 0 )
{
m_order = TTO_TAKE;
}
@ -192,7 +192,7 @@ Error CTaskTake::Start()
Error CTaskTake::IsEnded()
{
CObject* fret;
CObject* cargo;
float angle;
if ( m_engine->GetPause() ) return ERR_CONTINUE;
@ -238,11 +238,11 @@ Error CTaskTake::IsEnded()
{
if ( m_step == 1 )
{
if ( TruckTakeObject() )
if ( TransporterTakeObject() )
{
if ( m_arm == TTA_FRIEND &&
(m_fretType == OBJECT_POWER ||
m_fretType == OBJECT_ATOMIC ) )
(m_cargoType == OBJECT_POWER ||
m_cargoType == OBJECT_ATOMIC ) )
{
m_sound->Play(SOUND_POWEROFF, m_object->GetPosition(0));
}
@ -259,17 +259,17 @@ Error CTaskTake::IsEnded()
{
if ( m_step == 1 )
{
fret = m_object->GetFret();
TruckDeposeObject();
cargo = m_object->GetCargo();
TransporterDeposeObject();
if ( m_arm == TTA_FRIEND &&
(m_fretType == OBJECT_POWER ||
m_fretType == OBJECT_ATOMIC ) )
(m_cargoType == OBJECT_POWER ||
m_cargoType == OBJECT_ATOMIC ) )
{
m_sound->Play(SOUND_POWERON, m_object->GetPosition(0));
}
if ( fret != 0 && m_fretType == OBJECT_METAL && m_arm == TTA_FFRONT )
if ( cargo != 0 && m_cargoType == OBJECT_METAL && m_arm == TTA_FFRONT )
{
m_main->ShowDropZone(fret, m_object); // shows buildable area
m_main->ShowDropZone(cargo, m_object); // shows buildable area
}
m_motion->SetAction(-1); // gets up
m_progress = 0.0f;
@ -329,7 +329,7 @@ CObject* CTaskTake::SearchTakeObject(float &angle,
type != OBJECT_KEYd &&
type != OBJECT_TNT ) continue;
if ( pObj->GetTruck() != 0 ) continue; // object transported?
if ( pObj->GetTransporter() != 0 ) continue; // object transported?
if ( pObj->GetLock() ) continue;
if ( pObj->GetZoomY(0) != 1.0f ) continue;
@ -442,30 +442,30 @@ CObject* CTaskTake::SearchFriendObject(float &angle,
// Takes the object in front.
bool CTaskTake::TruckTakeObject()
bool CTaskTake::TransporterTakeObject()
{
CObject* fret;
CObject* cargo;
CObject* other;
Math::Matrix matRotate;
float angle;
if ( m_arm == TTA_FFRONT ) // takes on the ground in front?
{
//? fret = SearchTakeObject(angle, 1.5f, Math::PI*0.04f);
fret = SearchTakeObject(angle, 1.5f, Math::PI*0.15f); //OK 1.9
if ( fret == 0 ) return false; // rien <20> prendre ?
m_fretType = fret->GetType();
//? cargo = SearchTakeObject(angle, 1.5f, Math::PI*0.04f);
cargo = SearchTakeObject(angle, 1.5f, Math::PI*0.15f); //OK 1.9
if ( cargo == 0 ) return false; // rien <20> prendre ?
m_cargoType = cargo->GetType();
fret->SetTruck(m_object);
fret->SetTruckPart(4); // takes with the hand
cargo->SetTransporter(m_object);
cargo->SetTransporterPart(4); // takes with the hand
//? fret->SetPosition(0, Math::Vector(2.2f, -1.0f, 1.1f));
fret->SetPosition(0, Math::Vector(1.7f, -0.5f, 1.1f));
fret->SetAngleY(0, 0.1f);
fret->SetAngleX(0, 0.0f);
fret->SetAngleZ(0, 0.8f);
//? cargo->SetPosition(0, Math::Vector(2.2f, -1.0f, 1.1f));
cargo->SetPosition(0, Math::Vector(1.7f, -0.5f, 1.1f));
cargo->SetAngleY(0, 0.1f);
cargo->SetAngleX(0, 0.0f);
cargo->SetAngleZ(0, 0.8f);
m_object->SetFret(fret); // takes
m_object->SetCargo(cargo); // takes
}
if ( m_arm == TTA_FRIEND ) // takes friend's battery?
@ -473,21 +473,21 @@ bool CTaskTake::TruckTakeObject()
other = SearchFriendObject(angle, 1.5f, Math::PI*0.04f);
if ( other == 0 ) return false;
fret = other->GetPower();
if ( fret == 0 ) return false; // the other does not have a battery?
m_fretType = fret->GetType();
cargo = other->GetPower();
if ( cargo == 0 ) return false; // the other does not have a battery?
m_cargoType = cargo->GetType();
other->SetPower(0);
fret->SetTruck(m_object);
fret->SetTruckPart(4); // takes with the hand
cargo->SetTransporter(m_object);
cargo->SetTransporterPart(4); // takes with the hand
//? fret->SetPosition(0, Math::Vector(2.2f, -1.0f, 1.1f));
fret->SetPosition(0, Math::Vector(1.7f, -0.5f, 1.1f));
fret->SetAngleY(0, 0.1f);
fret->SetAngleX(0, 0.0f);
fret->SetAngleZ(0, 0.8f);
//? cargo->SetPosition(0, Math::Vector(2.2f, -1.0f, 1.1f));
cargo->SetPosition(0, Math::Vector(1.7f, -0.5f, 1.1f));
cargo->SetAngleY(0, 0.1f);
cargo->SetAngleX(0, 0.0f);
cargo->SetAngleZ(0, 0.8f);
m_object->SetFret(fret); // takes
m_object->SetCargo(cargo); // takes
}
return true;
@ -495,10 +495,10 @@ bool CTaskTake::TruckTakeObject()
// Deposes the object taken.
bool CTaskTake::TruckDeposeObject()
bool CTaskTake::TransporterDeposeObject()
{
Character* character;
CObject* fret;
CObject* cargo;
CObject* other;
Math::Matrix* mat;
Math::Vector pos;
@ -506,21 +506,21 @@ bool CTaskTake::TruckDeposeObject()
if ( m_arm == TTA_FFRONT ) // deposes on the ground in front?
{
fret = m_object->GetFret();
if ( fret == 0 ) return false; // does nothing?
m_fretType = fret->GetType();
cargo = m_object->GetCargo();
if ( cargo == 0 ) return false; // does nothing?
m_cargoType = cargo->GetType();
mat = fret->GetWorldMatrix(0);
mat = cargo->GetWorldMatrix(0);
pos = Transform(*mat, Math::Vector(-0.5f, 1.0f, 0.0f));
m_terrain->AdjustToFloor(pos);
fret->SetPosition(0, pos);
fret->SetAngleY(0, m_object->GetAngleY(0)+Math::PI/2.0f);
fret->SetAngleX(0, 0.0f);
fret->SetAngleZ(0, 0.0f);
fret->FloorAdjust(); // plate well on the ground
cargo->SetPosition(0, pos);
cargo->SetAngleY(0, m_object->GetAngleY(0)+Math::PI/2.0f);
cargo->SetAngleX(0, 0.0f);
cargo->SetAngleZ(0, 0.0f);
cargo->FloorAdjust(); // plate well on the ground
fret->SetTruck(0);
m_object->SetFret(0); // deposit
cargo->SetTransporter(0);
m_object->SetCargo(0); // deposit
}
if ( m_arm == TTA_FRIEND ) // deposes battery on friends?
@ -528,24 +528,24 @@ bool CTaskTake::TruckDeposeObject()
other = SearchFriendObject(angle, 1.5f, Math::PI*0.04f);
if ( other == 0 ) return false;
fret = other->GetPower();
if ( fret != 0 ) return false; // the other already has a battery?
cargo = other->GetPower();
if ( cargo != 0 ) return false; // the other already has a battery?
fret = m_object->GetFret();
if ( fret == 0 ) return false;
m_fretType = fret->GetType();
cargo = m_object->GetCargo();
if ( cargo == 0 ) return false;
m_cargoType = cargo->GetType();
other->SetPower(fret);
fret->SetTruck(other);
other->SetPower(cargo);
cargo->SetTransporter(other);
character = other->GetCharacter();
fret->SetPosition(0, character->posPower);
fret->SetAngleY(0, 0.0f);
fret->SetAngleX(0, 0.0f);
fret->SetAngleZ(0, 0.0f);
fret->SetTruckPart(0); // carried by the base
cargo->SetPosition(0, character->posPower);
cargo->SetAngleY(0, 0.0f);
cargo->SetAngleX(0, 0.0f);
cargo->SetAngleZ(0, 0.0f);
cargo->SetTransporterPart(0); // carried by the base
m_object->SetFret(0); // deposit
m_object->SetCargo(0); // deposit
}
return true;
@ -567,7 +567,7 @@ bool CTaskTake::IsFreeDeposeObject(Math::Vector pos)
{
if ( pObj == m_object ) continue;
if ( !pObj->GetActive() ) continue; // inactive?
if ( pObj->GetTruck() != 0 ) continue; // object transported?
if ( pObj->GetTransporter() != 0 ) continue; // object transported?
j = 0;
while ( pObj->GetCrashSphere(j++, oPos, oRadius) )

View File

@ -57,8 +57,8 @@ public:
protected:
CObject* SearchTakeObject(float &angle, float dLimit, float aLimit);
CObject* SearchFriendObject(float &angle, float dLimit, float aLimit);
bool TruckTakeObject();
bool TruckDeposeObject();
bool TransporterTakeObject();
bool TransporterDeposeObject();
bool IsFreeDeposeObject(Math::Vector pos);
protected:
@ -74,6 +74,6 @@ protected:
bool m_bError;
bool m_bTurn;
float m_angle;
ObjectType m_fretType;
ObjectType m_cargoType;
};

View File

@ -810,7 +810,7 @@ void CPhysics::MotorUpdate(float aTime, float rTime)
type == OBJECT_TECH )
{
power = 0;
if ( m_object->GetFret() != 0 && // carries something?
if ( m_object->GetCargo() != 0 && // carries something?
!m_object->IsSpaceshipCargo() )
{
motorSpeed.x *= 0.7f; // forward more slowly
@ -825,7 +825,7 @@ void CPhysics::MotorUpdate(float aTime, float rTime)
motorSpeed.z *= 0.5f;
motorSpeed.y *= 0.5f;
if ( m_object->GetFret() != 0 ) // carries something?
if ( m_object->GetCargo() != 0 ) // carries something?
{
motorSpeed.x *= 0.2f;
motorSpeed.z *= 0.9f;
@ -1780,7 +1780,7 @@ void CPhysics::WaterFrame(float aTime, float rTime)
level = m_water->GetLevel();
if ( level == 0.0f ) return; // no water?
if ( m_object->GetTruck() != 0 ) return; // object transported?
if ( m_object->GetTransporter() != 0 ) return; // object transported?
// Management of flames into the lava.
pos = m_object->GetPosition(0);
@ -2529,7 +2529,7 @@ int CPhysics::ObjectAdapt(const Math::Vector &pos, const Math::Vector &angle)
for (CObject* pObj : CObjectManager::GetInstancePointer()->GetAllObjects())
{
if ( pObj == m_object ) continue; // yourself?
if ( pObj->GetTruck() != 0 ) continue; // object transported?
if ( pObj->GetTransporter() != 0 ) continue; // object transported?
if ( !pObj->GetEnable() ) continue; // inactive?
if ( pObj->GetRuin() ) continue; // is burning or exploding?
if ( pObj->GetDead() ) continue; // dead man?
@ -3039,15 +3039,15 @@ void CPhysics::FrameParticle(float aTime, float rTime)
void CPhysics::PowerParticle(float factor, bool bBreak)
{
Character* character;
CObject* fret;
CObject* cargo;
Math::Matrix* mat;
Math::Vector pos, ppos, eye, speed;
Math::Point dim;
bool bCarryPower;
bCarryPower = false;
fret = m_object->GetFret();
if ( fret != 0 && fret->GetType() == OBJECT_POWER &&
cargo = m_object->GetCargo();
if ( cargo != 0 && cargo->GetType() == OBJECT_POWER &&
m_object->GetAngleZ(1) == ARM_STOCK_ANGLE1 )
{
bCarryPower = true; // carries a battery

View File

@ -1159,7 +1159,7 @@ void CMap::UpdateObject(CObject* pObj)
if ( !pObj->GetActive() ) return;
if ( !pObj->GetSelectable() ) return;
if ( pObj->GetProxyActivate() ) return;
if ( pObj->GetTruck() != 0 ) return;
if ( pObj->GetTransporter() != 0 ) return;
type = pObj->GetType();
pos = pObj->GetPosition(0);

View File

@ -245,9 +245,9 @@ CObject* CTarget::DetectFriendObject(Math::Point pos)
}
else if ( (type == OBJECT_POWER ||
type == OBJECT_ATOMIC ) &&
obj->GetTruck() != nullptr ) // battery used?
obj->GetTransporter() != nullptr ) // battery used?
{
target = obj->GetTruck();
target = obj->GetTransporter();
if ( target->GetType() == OBJECT_MOBILEtg )
{
target = nullptr;