From 8b223eb0965a74693963726efb4e884ef454b97a Mon Sep 17 00:00:00 2001 From: Zaba999 Date: Wed, 12 Sep 2012 22:34:40 +0200 Subject: all tasks compile. --- src/CMakeLists.txt | 14 +-- src/object/task/tasksearch.cpp | 69 +++++++-------- src/object/task/tasksearch.h | 2 +- src/object/task/taskshield.cpp | 170 ++++++++++++++++++------------------ src/object/task/taskshield.h | 6 +- src/object/task/taskspiderexplo.cpp | 19 ++-- src/object/task/tasktake.cpp | 120 ++++++++++++------------- src/object/task/taskterraform.cpp | 90 +++++++++---------- src/object/task/taskterraform.h | 4 +- src/object/task/taskturn.cpp | 21 ++--- src/object/task/taskwait.cpp | 13 +-- 11 files changed, 255 insertions(+), 273 deletions(-) (limited to 'src') diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 64051d1..9f7bbec 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -140,13 +140,13 @@ object/task/taskmanip.cpp object/task/taskpen.cpp object/task/taskrecover.cpp object/task/taskreset.cpp -# object/task/tasksearch.cpp -# object/task/taskshield.cpp -# object/task/taskspiderexplo.cpp -# object/task/tasktake.cpp -# object/task/taskterraform.cpp -# object/task/taskturn.cpp -# object/task/taskwait.cpp +object/task/tasksearch.cpp +object/task/taskshield.cpp +object/task/taskspiderexplo.cpp +object/task/tasktake.cpp +object/task/taskterraform.cpp +object/task/taskturn.cpp +object/task/taskwait.cpp physics/physics.cpp script/cbottoken.cpp script/cmdtoken.cpp diff --git a/src/object/task/tasksearch.cpp b/src/object/task/tasksearch.cpp index 8c083dd..578b41e 100644 --- a/src/object/task/tasksearch.cpp +++ b/src/object/task/tasksearch.cpp @@ -16,15 +16,12 @@ // tasksearch.cpp - -#include - #include "object/task/tasksearch.h" #include "math/geometry.h" #include "common/iman.h" -#include "old/particule.h" -#include "old/terrain.h" +#include "graphics/engine/particle.h" +#include "graphics/engine/terrain.h" #include "physics/physics.h" #include "ui/displaytext.h" @@ -56,8 +53,8 @@ bool CTaskSearch::EventProcess(const Event &event) float angle; int i; - if ( m_engine->RetPause() ) return true; - if ( event.event != EVENT_FRAME ) return true; + if ( m_engine->GetPause() ) return true; + if ( event.type != EVENT_FRAME ) return true; if ( m_bError ) return false; m_progress += event.rTime*m_speed; // others advance @@ -75,11 +72,11 @@ bool CTaskSearch::EventProcess(const Event &event) } if ( m_phase == TSP_SEARCH && - m_lastParticule+m_engine->ParticuleAdapt(0.05f) <= m_time ) + m_lastParticle+m_engine->ParticleAdapt(0.05f) <= m_time ) { - m_lastParticule = m_time; + m_lastParticle = m_time; - mat = m_object->RetWorldMatrix(0); + mat = m_object->GetWorldMatrix(0); pos = Math::Vector(6.5f, 0.2f, 0.0f); pos = Math::Transform(*mat, pos); // sensor position @@ -88,7 +85,7 @@ bool CTaskSearch::EventProcess(const Event &event) speed.y = 0.0f; dim.x = Math::Rand()*1.0f+1.0f; dim.y = dim.x; - m_particule->CreateParticule(pos, speed, dim, PARTIGAS); + m_particle->CreateParticle(pos, speed, dim, Gfx::PARTIGAS); } return true; @@ -116,7 +113,7 @@ void CTaskSearch::InitAngle() for ( i=0 ; i<3 ; i++ ) { - m_initialAngle[i] = m_object->RetAngleZ(i+1); + m_initialAngle[i] = m_object->GetAngleZ(i+1); } } @@ -130,13 +127,13 @@ Error CTaskSearch::Start() int i; m_bError = true; - if ( !m_physics->RetLand() ) return ERR_SEARCH_FLY; + if ( !m_physics->GetLand() ) return ERR_SEARCH_FLY; - speed = m_physics->RetMotorSpeed(); + speed = m_physics->GetMotorSpeed(); if ( speed.x != 0.0f || speed.z != 0.0f ) return ERR_SEARCH_MOTOR; - type = m_object->RetType(); + type = m_object->GetType(); if ( type != OBJECT_MOBILEfs && type != OBJECT_MOBILEts && type != OBJECT_MOBILEws && @@ -147,14 +144,14 @@ Error CTaskSearch::Start() m_progress = 0.0f; m_speed = 1.0f/1.0f; m_time = 0.0f; - m_lastParticule = 0.0f; + m_lastParticle = 0.0f; InitAngle(); m_bError = false; // ok m_camera->StartCentering(m_object, Math::PI*0.50f, 99.9f, 0.0f, 1.0f); - i = m_sound->Play(SOUND_MANIP, m_object->RetPosition(0), 0.0f, 0.3f, true); + i = m_sound->Play(SOUND_MANIP, m_object->GetPosition(0), 0.0f, 0.3f, true); m_sound->AddEnvelope(i, 0.5f, 1.0f, 0.1f, SOPER_CONTINUE); m_sound->AddEnvelope(i, 0.5f, 1.0f, 0.9f, SOPER_CONTINUE); m_sound->AddEnvelope(i, 0.0f, 0.3f, 0.1f, SOPER_STOP); @@ -170,7 +167,7 @@ Error CTaskSearch::IsEnded() { int i; - if ( m_engine->RetPause() ) return ERR_CONTINUE; + if ( m_engine->GetPause() ) return ERR_CONTINUE; if ( m_bError ) return ERR_STOP; if ( m_progress < 1.0f ) return ERR_CONTINUE; @@ -187,7 +184,7 @@ Error CTaskSearch::IsEnded() if ( m_phase == TSP_DOWN ) { - m_sound->Play(SOUND_REPAIR, m_object->RetPosition(0)); + m_sound->Play(SOUND_REPAIR, m_object->GetPosition(0)); m_phase = TSP_SEARCH; m_speed = 1.0f/4.0f; @@ -201,7 +198,7 @@ Error CTaskSearch::IsEnded() m_hand = TSH_UP; InitAngle(); - i = m_sound->Play(SOUND_MANIP, m_object->RetPosition(0), 0.0f, 0.3f, true); + i = m_sound->Play(SOUND_MANIP, m_object->GetPosition(0), 0.0f, 0.3f, true); m_sound->AddEnvelope(i, 0.5f, 1.0f, 0.1f, SOPER_CONTINUE); m_sound->AddEnvelope(i, 0.5f, 1.0f, 0.9f, SOPER_CONTINUE); m_sound->AddEnvelope(i, 0.0f, 0.3f, 0.1f, SOPER_STOP); @@ -229,52 +226,52 @@ bool CTaskSearch::Abort() bool CTaskSearch::CreateMark() { - CObject* fret; - ObjectType type; + CObject* fret; + ObjectType type; Math::Matrix* mat; Math::Vector pos; - TerrainRes res; - Error info; + Gfx::TerrainRes res; + Error info; - mat = m_object->RetWorldMatrix(0); + mat = m_object->GetWorldMatrix(0); pos = Math::Vector(7.5f, 0.0f, 0.0f); pos = Math::Transform(*mat, pos); // sensor position - res = m_terrain->RetResource(pos); - if ( res == TR_NULL ) return false; + res = m_terrain->GetResource(pos); + if ( res == Gfx::TR_NULL ) return false; type = OBJECT_NULL; - if ( res == TR_STONE ) + if ( res == Gfx::TR_STONE ) { type = OBJECT_MARKSTONE; info = INFO_MARKSTONE; } - if ( res == TR_URANIUM ) + if ( res == Gfx::TR_URANIUM ) { type = OBJECT_MARKURANIUM; info = INFO_MARKURANIUM; } - if ( res == TR_POWER ) + if ( res == Gfx::TR_POWER ) { type = OBJECT_MARKPOWER; info = INFO_MARKPOWER; } - if ( res == TR_KEYa ) + if ( res == Gfx::TR_KEY_A ) { type = OBJECT_MARKKEYa; info = INFO_MARKKEYa; } - if ( res == TR_KEYb ) + if ( res == Gfx::TR_KEY_B ) { type = OBJECT_MARKKEYb; info = INFO_MARKKEYb; } - if ( res == TR_KEYc ) + if ( res == Gfx::TR_KEY_C ) { type = OBJECT_MARKKEYc; info = INFO_MARKKEYc; } - if ( res == TR_KEYd ) + if ( res == Gfx::TR_KEY_D ) { type = OBJECT_MARKKEYd; info = INFO_MARKKEYd; @@ -306,10 +303,10 @@ void CTaskSearch::DeleteMark(ObjectType type) for ( i=0 ; i<1000000 ; i++ ) { - pObj = (CObject*)m_iMan->SearchInstance(CLASS_OBJECT, i); + pObj = static_cast(m_iMan->SearchInstance(CLASS_OBJECT, i)); if ( pObj == 0 ) break; - if ( type == pObj->RetType() ) + if ( type == pObj->GetType() ) { pObj->DeleteObject(); // removes the mark delete pObj; diff --git a/src/object/task/tasksearch.h b/src/object/task/tasksearch.h index 304473d..bffec16 100644 --- a/src/object/task/tasksearch.h +++ b/src/object/task/tasksearch.h @@ -62,7 +62,7 @@ protected: float m_progress; float m_speed; float m_time; - float m_lastParticule; + float m_lastParticle; float m_initialAngle[3]; float m_finalAngle[3]; bool m_bError; diff --git a/src/object/task/taskshield.cpp b/src/object/task/taskshield.cpp index aa62f7b..f6dc897 100644 --- a/src/object/task/taskshield.cpp +++ b/src/object/task/taskshield.cpp @@ -16,14 +16,12 @@ // taskshield.cpp - -#include - #include "object/task/taskshield.h" #include "common/iman.h" -#include "old/light.h" -#include "old/particule.h" +#include "graphics/core/light.h" +#include "graphics/engine/particle.h" +#include "graphics/engine/lightman.h" #include "math/geometry.h" #include "object/brain.h" #include "physics/physics.h" @@ -56,32 +54,32 @@ CTaskShield::~CTaskShield() bool CTaskShield::EventProcess(const Event &event) { CObject* power; - Math::Matrix* mat; - Math::Matrix matrix; - Math::Vector pos, speed, goal, angle; - D3DCOLORVALUE color; - Math::Point dim; + Math::Matrix* mat; + Math::Matrix matrix; + Math::Vector pos, speed, goal, angle; + Gfx::Color color; + Math::Point dim; float energy; - if ( m_engine->RetPause() ) return true; - if ( event.event != EVENT_FRAME ) return true; + if ( m_engine->GetPause() ) return true; + if ( event.type != EVENT_FRAME ) return true; if ( m_bError ) return false; m_progress += event.rTime*m_speed; // others advance m_time += event.rTime; m_delay -= event.rTime; - mat = m_object->RetWorldMatrix(0); + mat = m_object->GetWorldMatrix(0); pos = Math::Vector(7.0f, 15.0f, 0.0f); pos = Math::Transform(*mat, pos); // sphere position m_shieldPos = pos; if ( m_rankSphere != -1 ) { - m_particule->SetPosition(m_rankSphere, m_shieldPos); - dim.x = RetRadius(); + m_particle->SetPosition(m_rankSphere, m_shieldPos); + dim.x = GetRadius(); dim.y = dim.x; - m_particule->SetDimension(m_rankSphere, dim); + m_particle->SetDimension(m_rankSphere, dim); } if ( m_phase == TS_UP1 ) @@ -103,11 +101,11 @@ bool CTaskShield::EventProcess(const Event &event) if ( m_phase == TS_SHIELD ) { energy = (1.0f/ENERGY_TIME)*event.rTime; - energy *= RetRadius()/RADIUS_SHIELD_MAX; - power = m_object->RetPower(); + energy *= GetRadius()/RADIUS_SHIELD_MAX; + power = m_object->GetPower(); if ( power != 0 ) { - power->SetEnergy(power->RetEnergy()-energy/power->RetCapacity()); + power->SetEnergy(power->GetEnergy()-energy/power->GetCapacity()); } m_energyUsed += energy; @@ -123,25 +121,25 @@ bool CTaskShield::EventProcess(const Event &event) } pos = m_shieldPos; - pos.y += RetRadius()*(2.0f+sinf(m_time*9.0f)*0.2f); + pos.y += GetRadius()*(2.0f+sinf(m_time*9.0f)*0.2f); if ( m_effectLight == -1 ) { CreateLight(pos); } else { - m_light->SetLightPos(m_effectLight, pos); + m_lightMan->SetLightPos(m_effectLight, pos); color.r = 0.0f+sinf(m_time*33.2f)*0.2f; color.g = 0.5f+sinf(m_time*20.0f)*0.5f; color.b = 0.5f+sinf(m_time*21.3f)*1.0f; color.a = 0.0f; - m_light->SetLightColor(m_effectLight, color); + m_lightMan->SetLightColor(m_effectLight, color); } - if ( m_lastParticule+m_engine->ParticuleAdapt(0.05f) <= m_time ) + if ( m_lastParticle+m_engine->ParticleAdapt(0.05f) <= m_time ) { - m_lastParticule = m_time; + m_lastParticle = m_time; pos = m_shieldPos; pos.x += (Math::Rand()-0.5f)*5.0f; @@ -151,23 +149,23 @@ bool CTaskShield::EventProcess(const Event &event) speed.y = Math::Rand()*15.0f; dim.x = Math::Rand()*6.0f+4.0f; dim.y = dim.x; - m_particule->CreateParticule(pos, speed, dim, PARTIBLUE, 1.0f, 0.0f, 0.0f); + m_particle->CreateParticle(pos, speed, dim, Gfx::PARTIBLUE, 1.0f, 0.0f, 0.0f); } - if ( m_lastRay+m_engine->ParticuleAdapt(0.05f) <= m_time ) + if ( m_lastRay+m_engine->ParticleAdapt(0.05f) <= m_time ) { m_lastRay = m_time; pos = m_shieldPos; - dim.x = RetRadius()/20.0f; + dim.x = GetRadius()/20.0f; dim.y = dim.x; angle.x = (Math::Rand()-0.5f)*Math::PI*1.2f; angle.y = 0.0f; angle.z = (Math::Rand()-0.5f)*Math::PI*1.2f; Math::LoadRotationXZYMatrix(matrix, angle); - goal = Math::Transform(matrix, Math::Vector(0.0f, RetRadius()-dim.x, 0.0f)); + goal = Math::Transform(matrix, Math::Vector(0.0f, GetRadius()-dim.x, 0.0f)); goal += pos; - m_particule->CreateRay(pos, goal, PARTIRAY2, dim, 0.3f); + m_particle->CreateRay(pos, goal, Gfx::PARTIRAY2, dim, 0.3f); } if ( m_lastIncrease+0.2f <= m_time ) @@ -186,9 +184,9 @@ bool CTaskShield::EventProcess(const Event &event) m_soundChannel = -1; } - if ( m_lastParticule+m_engine->ParticuleAdapt(0.05f) <= m_time ) + if ( m_lastParticle+m_engine->ParticleAdapt(0.05f) <= m_time ) { - m_lastParticule = m_time; + m_lastParticle = m_time; pos = m_shieldPos; pos.x += (Math::Rand()-0.5f)*5.0f; @@ -198,7 +196,7 @@ bool CTaskShield::EventProcess(const Event &event) speed.y = (Math::Rand()-0.5f)*3.0f; dim.x = Math::Rand()*1.5f+2.0f; dim.y = dim.x; - m_particule->CreateParticule(pos, speed, dim, PARTISMOKE3, 4.0f); + m_particle->CreateParticle(pos, speed, dim, Gfx::PARTISMOKE3, 4.0f); } } @@ -240,25 +238,25 @@ Error CTaskShield::Start(TaskShieldMode mode, float delay) if ( mode == TSM_UPDATE ) { - if ( m_object->RetSelect() ) + if ( m_object->GetSelect() ) { m_brain->UpdateInterface(); } return ERR_OK; } - type = m_object->RetType(); + type = m_object->GetType(); if ( type != OBJECT_MOBILErs ) return ERR_SHIELD_VEH; m_bError = true; // operation impossible - if ( !m_physics->RetLand() ) return ERR_SHIELD_VEH; + if ( !m_physics->GetLand() ) return ERR_SHIELD_VEH; - power = m_object->RetPower(); + power = m_object->GetPower(); if ( power == 0 ) return ERR_SHIELD_ENERGY; - energy = power->RetEnergy(); + energy = power->GetEnergy(); if ( energy == 0.0f ) return ERR_SHIELD_ENERGY; - mat = m_object->RetWorldMatrix(0); + mat = m_object->GetWorldMatrix(0); pos = Math::Vector(7.0f, 15.0f, 0.0f); pos = Transform(*mat, pos); // sphere position m_shieldPos = pos; @@ -270,18 +268,18 @@ Error CTaskShield::Start(TaskShieldMode mode, float delay) m_speed = 1.0f/1.0f; m_time = 0.0f; m_delay = delay; - m_lastParticule = 0.0f; + m_lastParticle = 0.0f; m_lastRay = 0.0f; m_lastIncrease = 0.0f; m_energyUsed = 0.0f; m_bError = false; // ok - if ( m_object->RetSelect() ) + if ( m_object->GetSelect() ) { m_brain->UpdateInterface(); } -//? m_camera->StartCentering(m_object, Math::PI*0.85f, -Math::PI*0.15f, RetRadius()+40.0f, 3.0f); +//? m_camera->StartCentering(m_object, Math::PI*0.85f, -Math::PI*0.15f, GetRadius()+40.0f, 3.0f); return ERR_OK; } @@ -297,13 +295,13 @@ Error CTaskShield::Stop() if ( m_rankSphere != -1 ) { - m_particule->SetPhase(m_rankSphere, PARPHEND, 3.0f); + m_particle->SetPhase(m_rankSphere, Gfx::PARPHEND, 3.0f); m_rankSphere = -1; } if ( m_effectLight != -1 ) { - m_light->DeleteLight(m_effectLight); + m_lightMan->DeleteLight(m_effectLight); m_effectLight = -1; } @@ -316,7 +314,7 @@ Error CTaskShield::Stop() m_camera->StopCentering(m_object, 4.0f); - if ( m_object->RetSelect() ) + if ( m_object->GetSelect() ) { m_brain->UpdateInterface(); } @@ -335,21 +333,21 @@ Error CTaskShield::IsEnded() Math::Point dim; float energy; - if ( m_engine->RetPause() ) return ERR_CONTINUE; + if ( m_engine->GetPause() ) return ERR_CONTINUE; if ( m_bError ) return ERR_STOP; if ( m_phase == TS_SHIELD ) { - m_object->SetShieldRadius(RetRadius()); + m_object->SetShieldRadius(GetRadius()); - power = m_object->RetPower(); + power = m_object->GetPower(); if ( power == 0 ) { energy = 0.0f; } else { - energy = power->RetEnergy(); + energy = power->GetEnergy(); } if ( energy == 0.0f || m_delay <= 0.0f ) @@ -383,18 +381,18 @@ Error CTaskShield::IsEnded() pos.z = 0.0f; m_object->SetPosition(3, pos); - m_object->SetShieldRadius(RetRadius()); + m_object->SetShieldRadius(GetRadius()); pos = m_shieldPos; speed = Math::Vector(0.0f, 0.0f, 0.0f); - dim.x = RetRadius(); + dim.x = GetRadius(); dim.y = dim.x; - m_rankSphere = m_particule->CreateParticule(pos, speed, dim, PARTISPHERE3, 2.0f, 0.0f, 0.0f); + m_rankSphere = m_particle->CreateParticle(pos, speed, dim, Gfx::PARTISPHERE3, 2.0f, 0.0f, 0.0f); m_phase = TS_SHIELD; m_speed = 1.0f/999.9f; - if ( m_object->RetSelect() ) + if ( m_object->GetSelect() ) { m_brain->UpdateInterface(); } @@ -462,13 +460,13 @@ bool CTaskShield::Abort() if ( m_rankSphere != -1 ) { - m_particule->SetPhase(m_rankSphere, PARPHEND, 3.0f); + m_particle->SetPhase(m_rankSphere, Gfx::PARPHEND, 3.0f); m_rankSphere = -1; } if ( m_effectLight != -1 ) { - m_light->DeleteLight(m_effectLight); + m_lightMan->DeleteLight(m_effectLight); m_effectLight = -1; } @@ -481,34 +479,32 @@ bool CTaskShield::Abort() bool CTaskShield::CreateLight(Math::Vector pos) { - D3DLIGHT7 light; - - if ( !m_engine->RetLightMode() ) return true; - - ZeroMemory( &light, sizeof(light) ); - light.dltType = D3DLIGHT_SPOT; - light.dcvDiffuse.r = 0.0f; - light.dcvDiffuse.g = 1.0f; - light.dcvDiffuse.b = 2.0f; - light.dvPosition.x = pos.x; - light.dvPosition.y = pos.y; - light.dvPosition.z = pos.z; - light.dvDirection.x = 0.0f; - light.dvDirection.y = -1.0f; // against the bottom - light.dvDirection.z = 0.0f; - light.dvRange = D3DLIGHT_RANGE_MAX; - light.dvFalloff = 1.0f; - light.dvAttenuation0 = 1.0f; - light.dvAttenuation1 = 0.0f; - light.dvAttenuation2 = 0.0f; - light.dvTheta = 0.0f; - light.dvPhi = Math::PI/4.0f; - - m_effectLight = m_light->CreateLight(); + Gfx::Light light; + + if ( !m_engine->GetLightMode() ) return true; + + memset(&light, 0, sizeof(light)); + light.type = Gfx::LIGHT_SPOT; + light.diffuse.r = 0.0f; + light.diffuse.g = 1.0f; + light.diffuse.b = 2.0f; + light.position.x = pos.x; + light.position.y = pos.y; + light.position.z = pos.z; + light.direction.x = 0.0f; + light.direction.y = -1.0f; // against the bottom + light.direction.z = 0.0f; + light.spotIntensity = 128; + light.attenuation0 = 1.0f; + light.attenuation1 = 0.0f; + light.attenuation2 = 0.0f; + light.spotAngle = 90; + + m_effectLight = m_lightMan->CreateLight(); if ( m_effectLight == -1 ) return false; - m_light->SetLight(m_effectLight, light); - m_light->SetLightIntensity(m_effectLight, 1.0f); + m_lightMan->SetLight(m_effectLight, light); + m_lightMan->SetLightIntensity(m_effectLight, 1.0f); return true; } @@ -526,21 +522,21 @@ void CTaskShield::IncreaseShield() for ( i=0 ; i<1000000 ; i++ ) { - pObj = (CObject*)m_iMan->SearchInstance(CLASS_OBJECT, i); + pObj = static_cast(m_iMan->SearchInstance(CLASS_OBJECT, i)); if ( pObj == 0 ) break; - type = pObj->RetType(); + type = pObj->GetType(); if ( type == OBJECT_MOTHER || type == OBJECT_ANT || type == OBJECT_SPIDER || type == OBJECT_BEE || type == OBJECT_WORM ) continue; - oPos = pObj->RetPosition(0); + oPos = pObj->GetPosition(0); dist = Math::Distance(oPos, m_shieldPos); - if ( dist <= RetRadius()+10.0f ) + if ( dist <= GetRadius()+10.0f ) { - shield = pObj->RetShield(); + shield = pObj->GetShield(); shield += 0.1f; if ( shield > 1.0f ) shield = 1.0f; pObj->SetShield(shield); @@ -551,9 +547,9 @@ void CTaskShield::IncreaseShield() // Returns the radius of the shield. -float CTaskShield::RetRadius() +float CTaskShield::GetRadius() { - return RADIUS_SHIELD_MIN + (RADIUS_SHIELD_MAX-RADIUS_SHIELD_MIN)*m_object->RetParam(); + return RADIUS_SHIELD_MIN + (RADIUS_SHIELD_MAX-RADIUS_SHIELD_MIN)*m_object->GetParam(); } diff --git a/src/object/task/taskshield.h b/src/object/task/taskshield.h index 5842ae0..4a6811c 100644 --- a/src/object/task/taskshield.h +++ b/src/object/task/taskshield.h @@ -63,7 +63,7 @@ protected: Error Stop(); bool CreateLight(Math::Vector pos); void IncreaseShield(); - float RetRadius(); + float GetRadius(); protected: TaskShieldPhase m_phase; @@ -71,12 +71,12 @@ protected: float m_speed; float m_time; float m_delay; - float m_lastParticule; + float m_lastParticle; float m_lastRay; float m_lastIncrease; float m_energyUsed; bool m_bError; - Math::Vector m_shieldPos; + Math::Vector m_shieldPos; int m_rankSphere; int m_soundChannel; int m_effectLight; diff --git a/src/object/task/taskspiderexplo.cpp b/src/object/task/taskspiderexplo.cpp index fa505b1..8110870 100644 --- a/src/object/task/taskspiderexplo.cpp +++ b/src/object/task/taskspiderexplo.cpp @@ -16,12 +16,9 @@ // taskspiderexplo.cpp - -#include - #include "object/task/taskspiderexplo.h" -#include "old/pyro.h" +#include "graphics/engine/pyro.h" #include "object/motion/motionspider.h" #include "physics/physics.h" @@ -48,11 +45,11 @@ CTaskSpiderExplo::~CTaskSpiderExplo() bool CTaskSpiderExplo::EventProcess(const Event &event) { - if ( m_engine->RetPause() ) return true; - if ( event.event != EVENT_FRAME ) return true; + if ( m_engine->GetPause() ) return true; + if ( event.type != EVENT_FRAME ) return true; // Momentarily stationary object (ant on the back)? - if ( m_object->RetFixed() ) + if ( m_object->GetFixed() ) { m_bError = true; return true; @@ -82,9 +79,9 @@ Error CTaskSpiderExplo::Start() Error CTaskSpiderExplo::IsEnded() { - CPyro* pyro; + Gfx::CPyro* pyro; - if ( m_engine->RetPause() ) return ERR_CONTINUE; + if ( m_engine->GetPause() ) return ERR_CONTINUE; if ( m_bError ) { @@ -94,8 +91,8 @@ Error CTaskSpiderExplo::IsEnded() if ( m_time < 1.0f ) return ERR_CONTINUE; - pyro = new CPyro(m_iMan); - pyro->Create(PT_SPIDER, m_object); // the spider explodes (suicide) + pyro = new Gfx::CPyro(m_iMan); + pyro->Create(Gfx::PT_SPIDER, m_object); // the spider explodes (suicide) Abort(); return ERR_STOP; diff --git a/src/object/task/tasktake.cpp b/src/object/task/tasktake.cpp index f9f957f..2737324 100644 --- a/src/object/task/tasktake.cpp +++ b/src/object/task/tasktake.cpp @@ -34,7 +34,7 @@ CTaskTake::CTaskTake(CInstanceManager* iMan, CObject* object) : CTask(iMan, object) { - m_terrain = (CTerrain*)m_iMan->SearchInstance(CLASS_TERRAIN); + m_terrain = static_cast(m_iMan->SearchInstance(CLASS_TERRAIN)); m_arm = TTA_NEUTRAL; } @@ -52,13 +52,13 @@ bool CTaskTake::EventProcess(const Event &event) { float a, g, cirSpeed; - if ( m_engine->RetPause() ) return true; - if ( event.event != EVENT_FRAME ) return true; + if ( m_engine->GetPause() ) return true; + if ( event.type != EVENT_FRAME ) return true; if ( m_bError ) return false; if ( m_bTurn ) // preliminary rotation? { - a = m_object->RetAngleY(0); + a = m_object->GetAngleY(0); g = m_angle; cirSpeed = Math::Direction(a, g)*2.0f; if ( cirSpeed > 1.0f ) cirSpeed = 1.0f; @@ -89,26 +89,26 @@ Error CTaskTake::Start() m_step = 0; m_progress = 0.0f; - iAngle = m_object->RetAngleY(0); + iAngle = m_object->GetAngleY(0); iAngle = Math::NormAngle(iAngle); // 0..2*Math::PI oAngle = iAngle; m_bError = true; // operation impossible - if ( !m_physics->RetLand() ) + if ( !m_physics->GetLand() ) { - pos = m_object->RetPosition(0); - h = m_water->RetLevel(m_object); + pos = m_object->GetPosition(0); + h = m_water->GetLevel(m_object); if ( pos.y < h ) return ERR_MANIP_WATER; // impossible under water return ERR_MANIP_FLY; } - type = m_object->RetType(); + type = m_object->GetType(); if ( type != OBJECT_HUMAN && type != OBJECT_TECH ) return ERR_MANIP_VEH; m_physics->SetMotorSpeed(Math::Vector(0.0f, 0.0f, 0.0f)); - if ( m_object->RetFret() == 0 ) + if ( m_object->GetFret() == 0 ) { m_order = TTO_TAKE; } @@ -119,14 +119,14 @@ Error CTaskTake::Start() if ( m_order == TTO_TAKE ) { - pos = m_object->RetPosition(0); - h = m_water->RetLevel(m_object); + pos = m_object->GetPosition(0); + h = m_water->GetLevel(m_object); if ( pos.y < h ) return ERR_MANIP_WATER; // impossible under water other = SearchFriendObject(oAngle, 1.5f, Math::PI*0.50f); - if ( other != 0 && other->RetPower() != 0 ) + if ( other != 0 && other->GetPower() != 0 ) { - type = other->RetPower()->RetType(); + type = other->GetPower()->GetType(); if ( type == OBJECT_URANIUM ) return ERR_MANIP_RADIO; if ( type != OBJECT_FRET && type != OBJECT_STONE && @@ -147,7 +147,7 @@ Error CTaskTake::Start() { other = SearchTakeObject(oAngle, 1.5f, Math::PI*0.45f); if ( other == 0 ) return ERR_MANIP_NIL; - type = other->RetType(); + type = other->GetType(); if ( type == OBJECT_URANIUM ) return ERR_MANIP_RADIO; //? m_camera->StartCentering(m_object, Math::PI*0.3f, 99.9f, 0.0f, 0.8f); m_arm = TTA_FFRONT; @@ -157,12 +157,12 @@ Error CTaskTake::Start() if ( m_order == TTO_DEPOSE ) { -//? speed = m_physics->RetMotorSpeed(); +//? speed = m_physics->GetMotorSpeed(); //? if ( speed.x != 0.0f || //? speed.z != 0.0f ) return ERR_MANIP_MOTOR; other = SearchFriendObject(oAngle, 1.5f, Math::PI*0.50f); - if ( other != 0 && other->RetPower() == 0 ) + if ( other != 0 && other->GetPower() == 0 ) { //? m_camera->StartCentering(m_object, Math::PI*0.3f, -Math::PI*0.1f, 0.0f, 0.8f); m_arm = TTA_FRIEND; @@ -191,12 +191,12 @@ Error CTaskTake::IsEnded() CObject* fret; float angle; - if ( m_engine->RetPause() ) return ERR_CONTINUE; + if ( m_engine->GetPause() ) return ERR_CONTINUE; if ( m_bError ) return ERR_STOP; if ( m_bTurn ) // preliminary rotation? { - angle = m_object->RetAngleY(0); + angle = m_object->GetAngleY(0); angle = Math::NormAngle(angle); // 0..2*Math::PI if ( Math::TestAngle(angle, m_angle-Math::PI*0.01f, m_angle+Math::PI*0.01f) ) @@ -240,7 +240,7 @@ Error CTaskTake::IsEnded() (m_fretType == OBJECT_POWER || m_fretType == OBJECT_ATOMIC ) ) { - m_sound->Play(SOUND_POWEROFF, m_object->RetPosition(0)); + m_sound->Play(SOUND_POWEROFF, m_object->GetPosition(0)); } } m_motion->SetAction(MHS_UPRIGHT, 0.4f); // gets up @@ -255,13 +255,13 @@ Error CTaskTake::IsEnded() { if ( m_step == 1 ) { - fret = m_object->RetFret(); + fret = m_object->GetFret(); TruckDeposeObject(); if ( m_arm == TTA_FRIEND && (m_fretType == OBJECT_POWER || m_fretType == OBJECT_ATOMIC ) ) { - m_sound->Play(SOUND_POWERON, m_object->RetPosition(0)); + m_sound->Play(SOUND_POWERON, m_object->GetPosition(0)); } if ( fret != 0 && m_fretType == OBJECT_METAL && m_arm == TTA_FFRONT ) { @@ -301,8 +301,8 @@ CObject* CTaskTake::SearchTakeObject(float &angle, float min, iAngle, bAngle, a, distance; int i; - iPos = m_object->RetPosition(0); - iAngle = m_object->RetAngleY(0); + iPos = m_object->GetPosition(0); + iAngle = m_object->GetAngleY(0); iAngle = Math::NormAngle(iAngle); // 0..2*Math::PI min = 1000000.0f; @@ -310,10 +310,10 @@ CObject* CTaskTake::SearchTakeObject(float &angle, bAngle = 0.0f; for ( i=0 ; i<1000000 ; i++ ) { - pObj = (CObject*)m_iMan->SearchInstance(CLASS_OBJECT, i); + pObj = static_cast(m_iMan->SearchInstance(CLASS_OBJECT, i)); if ( pObj == 0 ) break; - type = pObj->RetType(); + type = pObj->GetType(); if ( type != OBJECT_FRET && type != OBJECT_STONE && @@ -329,11 +329,11 @@ CObject* CTaskTake::SearchTakeObject(float &angle, type != OBJECT_KEYd && type != OBJECT_TNT ) continue; - if ( pObj->RetTruck() != 0 ) continue; // object transported? - if ( pObj->RetLock() ) continue; - if ( pObj->RetZoomY(0) != 1.0f ) continue; + if ( pObj->GetTruck() != 0 ) continue; // object transported? + if ( pObj->GetLock() ) continue; + if ( pObj->GetZoomY(0) != 1.0f ) continue; - oPos = pObj->RetPosition(0); + oPos = pObj->GetPosition(0); distance = Math::Distance(oPos, iPos); if ( distance >= 4.0f-dLimit && distance <= 4.0f+dLimit ) @@ -371,17 +371,17 @@ CObject* CTaskTake::SearchFriendObject(float &angle, int i; if ( !m_object->GetCrashSphere(0, iPos, iRad) ) return 0; - iAngle = m_object->RetAngleY(0); + iAngle = m_object->GetAngleY(0); iAngle = Math::NormAngle(iAngle); // 0..2*Math::PI for ( i=0 ; i<1000000 ; i++ ) { - pObj = (CObject*)m_iMan->SearchInstance(CLASS_OBJECT, i); + pObj = static_cast(m_iMan->SearchInstance(CLASS_OBJECT, i)); if ( pObj == 0 ) break; if ( pObj == m_object ) continue; // yourself? - type = pObj->RetType(); + type = pObj->GetType(); if ( type != OBJECT_MOBILEfa && type != OBJECT_MOBILEta && type != OBJECT_MOBILEwa && @@ -414,19 +414,19 @@ CObject* CTaskTake::SearchFriendObject(float &angle, type != OBJECT_LABO && type != OBJECT_NUCLEAR ) continue; - pPower = pObj->RetPower(); + pPower = pObj->GetPower(); if ( pPower != 0 ) { - if ( pPower->RetLock() ) continue; - if ( pPower->RetZoomY(0) != 1.0f ) continue; + if ( pPower->GetLock() ) continue; + if ( pPower->GetZoomY(0) != 1.0f ) continue; - powerType = pPower->RetType(); + powerType = pPower->GetType(); if ( powerType == OBJECT_NULL || powerType == OBJECT_FIX ) continue; } - mat = pObj->RetWorldMatrix(0); - character = pObj->RetCharacter(); + mat = pObj->GetWorldMatrix(0); + character = pObj->GetCharacter(); oPos = Transform(*mat, character->posPower); distance = fabs(Math::Distance(oPos, iPos) - (iRad+1.0f)); @@ -435,7 +435,7 @@ CObject* CTaskTake::SearchFriendObject(float &angle, angle = Math::RotateAngle(oPos.x-iPos.x, iPos.z-oPos.z); // CW ! if ( Math::TestAngle(angle, iAngle-aLimit, iAngle+aLimit) ) { - character = pObj->RetCharacter(); + character = pObj->GetCharacter(); m_height = character->posPower.y; return pObj; } @@ -449,17 +449,17 @@ CObject* CTaskTake::SearchFriendObject(float &angle, bool CTaskTake::TruckTakeObject() { - CObject* fret; - CObject* other; - Math::Matrix matRotate; - float angle; + CObject* fret; + 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 � prendre ? - m_fretType = fret->RetType(); + m_fretType = fret->GetType(); fret->SetTruck(m_object); fret->SetTruckPart(4); // takes with the hand @@ -478,9 +478,9 @@ bool CTaskTake::TruckTakeObject() other = SearchFriendObject(angle, 1.5f, Math::PI*0.04f); if ( other == 0 ) return false; - fret = other->RetPower(); + fret = other->GetPower(); if ( fret == 0 ) return false; // the other does not have a battery? - m_fretType = fret->RetType(); + m_fretType = fret->GetType(); other->SetPower(0); fret->SetTruck(m_object); @@ -511,15 +511,15 @@ bool CTaskTake::TruckDeposeObject() if ( m_arm == TTA_FFRONT ) // deposes on the ground in front? { - fret = m_object->RetFret(); + fret = m_object->GetFret(); if ( fret == 0 ) return false; // does nothing? - m_fretType = fret->RetType(); + m_fretType = fret->GetType(); - mat = fret->RetWorldMatrix(0); + mat = fret->GetWorldMatrix(0); pos = Transform(*mat, Math::Vector(-0.5f, 1.0f, 0.0f)); - m_terrain->MoveOnFloor(pos); + m_terrain->AdjustToFloor(pos); fret->SetPosition(0, pos); - fret->SetAngleY(0, m_object->RetAngleY(0)+Math::PI/2.0f); + 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 @@ -533,17 +533,17 @@ bool CTaskTake::TruckDeposeObject() other = SearchFriendObject(angle, 1.5f, Math::PI*0.04f); if ( other == 0 ) return false; - fret = other->RetPower(); + fret = other->GetPower(); if ( fret != 0 ) return false; // the other already has a battery? - fret = m_object->RetFret(); + fret = m_object->GetFret(); if ( fret == 0 ) return false; - m_fretType = fret->RetType(); + m_fretType = fret->GetType(); other->SetPower(fret); fret->SetTruck(other); - character = other->RetCharacter(); + character = other->GetCharacter(); fret->SetPosition(0, character->posPower); fret->SetAngleY(0, 0.0f); fret->SetAngleX(0, 0.0f); @@ -566,17 +566,17 @@ bool CTaskTake::IsFreeDeposeObject(Math::Vector pos) float oRadius; int i, j; - mat = m_object->RetWorldMatrix(0); + mat = m_object->GetWorldMatrix(0); iPos = Transform(*mat, pos); for ( i=0 ; i<1000000 ; i++ ) { - pObj = (CObject*)m_iMan->SearchInstance(CLASS_OBJECT, i); + pObj = static_cast(m_iMan->SearchInstance(CLASS_OBJECT, i)); if ( pObj == 0 ) break; if ( pObj == m_object ) continue; - if ( !pObj->RetActif() ) continue; // inactive? - if ( pObj->RetTruck() != 0 ) continue; // object transported? + if ( !pObj->GetActif() ) continue; // inactive? + if ( pObj->GetTruck() != 0 ) continue; // object transported? j = 0; while ( pObj->GetCrashSphere(j++, oPos, oRadius) ) diff --git a/src/object/task/taskterraform.cpp b/src/object/task/taskterraform.cpp index 3a16008..6afece4 100644 --- a/src/object/task/taskterraform.cpp +++ b/src/object/task/taskterraform.cpp @@ -23,10 +23,10 @@ #include "math/geometry.h" #include "common/iman.h" -#include "old/particule.h" -#include "old/terrain.h" +#include "graphics/engine/pyro.h" +#include "graphics/engine/particle.h" +#include "graphics/engine/terrain.h" #include "physics/physics.h" -#include "old/pyro.h" #include "object/brain.h" #include "object/motion/motionant.h" #include "object/motion/motionspider.h" @@ -42,7 +42,7 @@ const float ACTION_RADIUS = 400.0f; CTaskTerraform::CTaskTerraform(CInstanceManager* iMan, CObject* object) : CTask(iMan, object) { - m_lastParticule = 0.0f; + m_lastParticle = 0.0f; m_soundChannel = -1; } @@ -63,8 +63,8 @@ bool CTaskTerraform::EventProcess(const Event &event) Math::Point dim; float energy; - if ( m_engine->RetPause() ) return true; - if ( event.event != EVENT_FRAME ) return true; + if ( m_engine->GetPause() ) return true; + if ( event.type != EVENT_FRAME ) return true; if ( m_bError ) return false; m_progress += event.rTime*m_speed; // others advance @@ -75,11 +75,11 @@ bool CTaskTerraform::EventProcess(const Event &event) if ( m_soundChannel == -1 ) { #if _TEEN - m_soundChannel = m_sound->Play(SOUND_GGG, m_object->RetPosition(0), 1.0f, 0.5f, true); + m_soundChannel = m_sound->Play(SOUND_GGG, m_object->GetPosition(0), 1.0f, 0.5f, true); m_sound->AddEnvelope(m_soundChannel, 1.0f, 2.0f, 1.5f, SOPER_CONTINUE); m_sound->AddEnvelope(m_soundChannel, 0.0f, 0.5f, 0.5f, SOPER_STOP); #else - m_soundChannel = m_sound->Play(SOUND_GGG, m_object->RetPosition(0), 1.0f, 0.5f, true); + m_soundChannel = m_sound->Play(SOUND_GGG, m_object->GetPosition(0), 1.0f, 0.5f, true); m_sound->AddEnvelope(m_soundChannel, 1.0f, 2.0f, 4.0f, SOPER_CONTINUE); m_sound->AddEnvelope(m_soundChannel, 0.0f, 0.5f, 0.5f, SOPER_STOP); #endif @@ -92,13 +92,13 @@ bool CTaskTerraform::EventProcess(const Event &event) m_object->SetZoom(0, 1.0f+m_progress*0.2f); - power = m_object->RetPower(); + power = m_object->GetPower(); if ( power != 0 ) { power->SetZoom(0, 1.0f+m_progress*1.0f); - energy = power->RetEnergy(); - energy -= event.rTime*ENERGY_TERRA/power->RetCapacity()/4.0f; + energy = power->GetEnergy(); + energy -= event.rTime*ENERGY_TERRA/power->GetCapacity()/4.0f; if ( energy < 0.0f ) energy = 0.0f; power->SetEnergy(energy); } @@ -131,18 +131,18 @@ bool CTaskTerraform::EventProcess(const Event &event) dir.x = 0.0f; dir.y = 0.0f; dir.z = 0.0f; - pos = m_object->RetPosition(2); + pos = m_object->GetPosition(2); if ( pos.y < 0.0f ) { dir.z = -atanf((pos.y/2.0f)/9.0f); } m_object->SetInclinaison(dir); - if ( m_time-m_lastParticule >= m_engine->ParticuleAdapt(0.05f) ) + if ( m_time-m_lastParticle >= m_engine->ParticleAdapt(0.05f) ) { - m_lastParticule = m_time; + m_lastParticle = m_time; - mat = m_object->RetWorldMatrix(0); + mat = m_object->GetWorldMatrix(0); if ( m_phase == TTP_CHARGE ) { @@ -156,7 +156,7 @@ bool CTaskTerraform::EventProcess(const Event &event) speed.y = 6.0f+Math::Rand()*4.0f*(1.0f+m_progress*2.0f); dim.x = 0.5f+1.5f*m_progress; dim.y = dim.x; - m_particule->CreateParticule(pos, speed, dim, PARTIBLITZ, 2.0f, 20.0f); + m_particle->CreateParticle(pos, speed, dim, Gfx::PARTIBLITZ, 2.0f, 20.0f); } if ( m_phase != TTP_CHARGE ) @@ -170,10 +170,10 @@ bool CTaskTerraform::EventProcess(const Event &event) speed.z = Math::Rand()*2.0f; speed.y = 2.5f+Math::Rand()*1.0f; speed = Math::Transform(*mat, speed); - speed -= m_object->RetPosition(0); + speed -= m_object->GetPosition(0); dim.x = Math::Rand()*1.0f+1.0f; dim.y = dim.x; - m_particule->CreateParticule(pos, speed, dim, PARTISMOKE1, 3.0f); + m_particle->CreateParticle(pos, speed, dim, Gfx::PARTISMOKE1, 3.0f); // Right grid. pos = Math::Vector(-1.0f, 5.8f, -3.5f); @@ -184,10 +184,10 @@ bool CTaskTerraform::EventProcess(const Event &event) speed.z = -Math::Rand()*2.0f; speed.y = 2.5f+Math::Rand()*1.0f; speed = Math::Transform(*mat, speed); - speed -= m_object->RetPosition(0); + speed -= m_object->GetPosition(0); dim.x = Math::Rand()*1.0f+1.0f; dim.y = dim.x; - m_particule->CreateParticule(pos, speed, dim, PARTISMOKE1, 3.0f); + m_particle->CreateParticle(pos, speed, dim, Gfx::PARTISMOKE1, 3.0f); } } @@ -207,21 +207,21 @@ Error CTaskTerraform::Start() ObjectType type; m_bError = true; // operation impossible - if ( !m_physics->RetLand() ) return ERR_TERRA_VEH; + if ( !m_physics->GetLand() ) return ERR_TERRA_VEH; - type = m_object->RetType(); + type = m_object->GetType(); if ( type != OBJECT_MOBILErt ) return ERR_TERRA_VEH; - power = m_object->RetPower(); + power = m_object->GetPower(); if ( power == 0 ) return ERR_TERRA_ENERGY; - energy = power->RetEnergy(); - if ( energy < ENERGY_TERRA/power->RetCapacity()+0.05f ) return ERR_TERRA_ENERGY; + energy = power->GetEnergy(); + if ( energy < ENERGY_TERRA/power->GetCapacity()+0.05f ) return ERR_TERRA_ENERGY; - speed = m_physics->RetMotorSpeed(); + speed = m_physics->GetMotorSpeed(); if ( speed.x != 0.0f || speed.z != 0.0f ) return ERR_MANIP_MOTOR; - mat = m_object->RetWorldMatrix(0); + mat = m_object->GetWorldMatrix(0); pos = Math::Vector(9.0f, 0.0f, 0.0f); pos = Math::Transform(*mat, pos); // battery position m_terraPos = pos; @@ -251,7 +251,7 @@ Error CTaskTerraform::IsEnded() float dist, duration; int i, max; - if ( m_engine->RetPause() ) return ERR_CONTINUE; + if ( m_engine->GetPause() ) return ERR_CONTINUE; if ( m_bError ) return ERR_STOP; if ( m_progress < 1.0f ) return ERR_CONTINUE; @@ -277,24 +277,24 @@ Error CTaskTerraform::IsEnded() m_object->SetCirVibration(Math::Vector(0.0f, 0.0f, 0.0f)); m_object->SetZoom(0, 1.0f); - power = m_object->RetPower(); + power = m_object->GetPower(); if ( power != 0 ) { power->SetZoom(0, 1.0f); } - max= (int)(50.0f*m_engine->RetParticuleDensity()); + max= static_cast(50.0f*m_engine->GetParticleDensity()); for ( i=0 ; iMoveOnFloor(pos); + m_terrain->AdjustToFloor(pos); dist = Math::Distance(pos, m_terraPos); speed = Math::Vector(0.0f, 0.0f, 0.0f); dim.x = 2.0f+(40.0f-dist)/(1.0f+Math::Rand()*4.0f); dim.y = dim.x; - m_particule->CreateParticule(pos, speed, dim, PARTICRASH, 2.0f); + m_particle->CreateParticle(pos, speed, dim, Gfx::PARTICRASH, 2.0f); pos = m_terraPos; speed.x = (Math::Rand()-0.5f)*40.0f; @@ -304,7 +304,7 @@ Error CTaskTerraform::IsEnded() dim.y = dim.x; pos.y += dim.y; duration = Math::Rand()*3.0f+3.0f; - m_particule->CreateTrack(pos, speed, dim, PARTITRACK5, + m_particle->CreateTrack(pos, speed, dim, Gfx::PARTITRACK5, duration, Math::Rand()*10.0f+15.0f, duration*0.2f, 1.0f); } @@ -343,7 +343,7 @@ bool CTaskTerraform::Abort() m_object->SetCirVibration(Math::Vector(0.0f, 0.0f, 0.0f)); m_object->SetZoom(0, 1.0f); - power = m_object->RetPower(); + power = m_object->GetPower(); if ( power != 0 ) { power->SetZoom(0, 1.0f); @@ -361,49 +361,49 @@ bool CTaskTerraform::Terraform() CObject* pObj; CBrain* brain; CMotion* motion; - CPyro* pyro; + Gfx::CPyro* pyro; ObjectType type; float dist; int i; - m_camera->StartEffect(CE_TERRAFORM, m_terraPos, 1.0f); + m_camera->StartEffect(Gfx::CAM_EFFECT_TERRAFORM, m_terraPos, 1.0f); m_sound->Play(SOUND_THUMP, m_terraPos); for ( i=0 ; i<1000000 ; i++ ) { - pObj = (CObject*)m_iMan->SearchInstance(CLASS_OBJECT, i); + pObj = static_cast(m_iMan->SearchInstance(CLASS_OBJECT, i)); if ( pObj == 0 ) break; - type = pObj->RetType(); + type = pObj->GetType(); if ( type == OBJECT_NULL ) continue; if ( type == OBJECT_TEEN34 ) // stone? { - dist = Math::Distance(m_terraPos, pObj->RetPosition(0)); + dist = Math::Distance(m_terraPos, pObj->GetPosition(0)); if ( dist > 20.0f ) continue; - pyro = new CPyro(m_iMan); - pyro->Create(PT_FRAGT, pObj); + pyro = new Gfx::CPyro(m_iMan); + pyro->Create(Gfx::PT_FRAGT, pObj); } else { - motion = pObj->RetMotion(); + motion = pObj->GetMotion(); if ( motion == 0 ) continue; - dist = Math::Distance(m_terraPos, pObj->RetPosition(0)); + dist = Math::Distance(m_terraPos, pObj->GetPosition(0)); if ( dist > ACTION_RADIUS ) continue; if ( type == OBJECT_ANT ) { - brain = pObj->RetBrain(); + brain = pObj->GetBrain(); if ( brain != 0 ) brain->StopTask(); motion->SetAction(MAS_BACK1, 0.8f+Math::Rand()*0.3f); pObj->SetFixed(true); // not moving } if ( type == OBJECT_SPIDER ) { - brain = pObj->RetBrain(); + brain = pObj->GetBrain(); if ( brain != 0 ) brain->StopTask(); motion->SetAction(MSS_BACK1, 0.8f+Math::Rand()*0.3f); pObj->SetFixed(true); // not moving diff --git a/src/object/task/taskterraform.h b/src/object/task/taskterraform.h index 5c9c114..91526b6 100644 --- a/src/object/task/taskterraform.h +++ b/src/object/task/taskterraform.h @@ -54,9 +54,9 @@ protected: float m_progress; float m_speed; float m_time; - float m_lastParticule; + float m_lastParticle; int m_soundChannel; bool m_bError; - Math::Vector m_terraPos; + Math::Vector m_terraPos; }; diff --git a/src/object/task/taskturn.cpp b/src/object/task/taskturn.cpp index f8bf26c..8f4bbd2 100644 --- a/src/object/task/taskturn.cpp +++ b/src/object/task/taskturn.cpp @@ -16,12 +16,9 @@ // taskturn.cpp - -#include - #include "object/task/taskturn.h" -#include "old/terrain.h" +#include "graphics/engine/terrain.h" #include "physics/physics.h" @@ -45,11 +42,11 @@ CTaskTurn::~CTaskTurn() bool CTaskTurn::EventProcess(const Event &event) { - if ( m_engine->RetPause() ) return true; - if ( event.event != EVENT_FRAME ) return true; + if ( m_engine->GetPause() ) return true; + if ( event.type != EVENT_FRAME ) return true; // Momentarily stationary object (ant on the back)? - if ( m_object->RetFixed() ) + if ( m_object->GetFixed() ) { m_physics->SetMotorSpeedX(0.0f); // stops the advance m_physics->SetMotorSpeedZ(0.0f); // stops the rotation @@ -66,18 +63,18 @@ bool CTaskTurn::EventProcess(const Event &event) Error CTaskTurn::Start(float angle) { - m_startAngle = m_object->RetAngleY(0); + m_startAngle = m_object->GetAngleY(0); m_finalAngle = m_startAngle+angle; if ( angle < 0.0f ) { - m_angle = angle+m_physics->RetCirStopLength(); + m_angle = angle+m_physics->GetCirStopLength(); m_physics->SetMotorSpeedZ(-1.0f); // turns left m_bLeft = true; } else { - m_angle = angle-m_physics->RetCirStopLength(); + m_angle = angle-m_physics->GetCirStopLength(); m_physics->SetMotorSpeedZ(1.0f); // turns right m_bLeft = false; } @@ -94,14 +91,14 @@ Error CTaskTurn::IsEnded() { float angle; - if ( m_engine->RetPause() ) return ERR_CONTINUE; + if ( m_engine->GetPause() ) return ERR_CONTINUE; if ( m_bError ) { return ERR_STOP; } - angle = m_object->RetAngleY(0); + angle = m_object->GetAngleY(0); if ( m_bLeft ) { diff --git a/src/object/task/taskwait.cpp b/src/object/task/taskwait.cpp index 03bddcb..f612c24 100644 --- a/src/object/task/taskwait.cpp +++ b/src/object/task/taskwait.cpp @@ -16,14 +16,9 @@ // taskwait.cpp - -#include - #include "object/task/taskwait.h" -#include "old/d3dengine.h" - - +#include "graphics/engine/engine.h" // Object's constructor. @@ -43,8 +38,8 @@ CTaskWait::~CTaskWait() bool CTaskWait::EventProcess(const Event &event) { - if ( m_engine->RetPause() ) return true; - if ( event.event != EVENT_FRAME ) return true; + if ( m_engine->GetPause() ) return true; + if ( event.type != EVENT_FRAME ) return true; m_passTime += event.rTime; m_bEnded = (m_passTime >= m_waitTime); @@ -66,7 +61,7 @@ Error CTaskWait::Start(float time) Error CTaskWait::IsEnded() { - if ( m_engine->RetPause() ) return ERR_CONTINUE; + if ( m_engine->GetPause() ) return ERR_CONTINUE; if ( m_bEnded ) return ERR_STOP; return ERR_CONTINUE; } -- cgit v1.2.3-1-g7c22