[src/object/auto] Folder rewritten
parent
b3d5491af4
commit
6892d37a4f
|
@ -87,32 +87,32 @@ graphics/engine/terrain.cpp
|
|||
graphics/engine/text.cpp
|
||||
graphics/engine/water.cpp
|
||||
graphics/opengl/gldevice.cpp
|
||||
# object/auto/auto.cpp
|
||||
# object/auto/autobase.cpp
|
||||
# object/auto/autoconvert.cpp
|
||||
# object/auto/autoderrick.cpp
|
||||
# object/auto/autodestroyer.cpp
|
||||
# object/auto/autoegg.cpp
|
||||
# object/auto/autoenergy.cpp
|
||||
# object/auto/autofactory.cpp
|
||||
# object/auto/autoflag.cpp
|
||||
# object/auto/autohuston.cpp
|
||||
# object/auto/autoinfo.cpp
|
||||
# object/auto/autojostle.cpp
|
||||
# object/auto/autokid.cpp
|
||||
# object/auto/autolabo.cpp
|
||||
# object/auto/automush.cpp
|
||||
# object/auto/autonest.cpp
|
||||
# object/auto/autonuclear.cpp
|
||||
# object/auto/autopara.cpp
|
||||
# object/auto/autoportico.cpp
|
||||
# object/auto/autoradar.cpp
|
||||
# object/auto/autorepair.cpp
|
||||
# object/auto/autoresearch.cpp
|
||||
# object/auto/autoroot.cpp
|
||||
# object/auto/autosafe.cpp
|
||||
# object/auto/autostation.cpp
|
||||
# object/auto/autotower.cpp
|
||||
object/auto/auto.cpp
|
||||
object/auto/autobase.cpp
|
||||
object/auto/autoconvert.cpp
|
||||
object/auto/autoderrick.cpp
|
||||
object/auto/autodestroyer.cpp
|
||||
object/auto/autoegg.cpp
|
||||
object/auto/autoenergy.cpp
|
||||
object/auto/autofactory.cpp
|
||||
object/auto/autoflag.cpp
|
||||
object/auto/autohuston.cpp
|
||||
object/auto/autoinfo.cpp
|
||||
object/auto/autojostle.cpp
|
||||
object/auto/autokid.cpp
|
||||
object/auto/autolabo.cpp
|
||||
object/auto/automush.cpp
|
||||
object/auto/autonest.cpp
|
||||
object/auto/autonuclear.cpp
|
||||
object/auto/autopara.cpp
|
||||
object/auto/autoportico.cpp
|
||||
object/auto/autoradar.cpp
|
||||
object/auto/autorepair.cpp
|
||||
object/auto/autoresearch.cpp
|
||||
object/auto/autoroot.cpp
|
||||
object/auto/autosafe.cpp
|
||||
object/auto/autostation.cpp
|
||||
object/auto/autotower.cpp
|
||||
# object/brain.cpp
|
||||
# object/mainmovie.cpp
|
||||
# object/motion/motion.cpp
|
||||
|
|
|
@ -37,22 +37,22 @@ CAuto::CAuto(CInstanceManager* iMan, CObject* object)
|
|||
m_iMan->AddInstance(CLASS_AUTO, this, 100);
|
||||
|
||||
m_object = object;
|
||||
m_event = (CEvent*)m_iMan->SearchInstance(CLASS_EVENT);
|
||||
m_engine = (CD3DEngine*)m_iMan->SearchInstance(CLASS_ENGINE);
|
||||
m_particule = (CParticule*)m_iMan->SearchInstance(CLASS_PARTICULE);
|
||||
m_light = (CLight*)m_iMan->SearchInstance(CLASS_LIGHT);
|
||||
m_terrain = (CTerrain*)m_iMan->SearchInstance(CLASS_TERRAIN);
|
||||
m_water = (CWater*)m_iMan->SearchInstance(CLASS_WATER);
|
||||
m_cloud = (CCloud*)m_iMan->SearchInstance(CLASS_CLOUD);
|
||||
m_planet = (CPlanet*)m_iMan->SearchInstance(CLASS_PLANET);
|
||||
m_blitz = (CBlitz*)m_iMan->SearchInstance(CLASS_BLITZ);
|
||||
m_camera = (CCamera*)m_iMan->SearchInstance(CLASS_CAMERA);
|
||||
m_interface = (CInterface*)m_iMan->SearchInstance(CLASS_INTERFACE);
|
||||
m_main = (CRobotMain*)m_iMan->SearchInstance(CLASS_MAIN);
|
||||
m_displayText = (CDisplayText*)m_iMan->SearchInstance(CLASS_DISPLAYTEXT);
|
||||
m_sound = (CSound*)m_iMan->SearchInstance(CLASS_SOUND);
|
||||
m_event = static_cast< CEventQueue* >(m_iMan->SearchInstance(CLASS_EVENT));
|
||||
m_engine = static_cast< Gfx::CEngine* >(m_iMan->SearchInstance(CLASS_ENGINE));
|
||||
m_particle = static_cast< Gfx::CParticle* >(m_iMan->SearchInstance(CLASS_PARTICULE));
|
||||
m_lightMan = static_cast< Gfx::CLightManager* >(m_iMan->SearchInstance(CLASS_LIGHT));
|
||||
m_terrain = static_cast< Gfx::CTerrain* >(m_iMan->SearchInstance(CLASS_TERRAIN));
|
||||
m_water = static_cast< Gfx::CWater* >(m_iMan->SearchInstance(CLASS_WATER));
|
||||
m_cloud = static_cast< Gfx::CCloud* >(m_iMan->SearchInstance(CLASS_CLOUD));
|
||||
m_planet = static_cast< Gfx::CPlanet* >(m_iMan->SearchInstance(CLASS_PLANET));
|
||||
m_lightning = static_cast< Gfx::CLightning* >(m_iMan->SearchInstance(CLASS_BLITZ));
|
||||
m_camera = static_cast< Gfx::CCamera* >(m_iMan->SearchInstance(CLASS_CAMERA));
|
||||
m_interface = static_cast< Ui::CInterface* >(m_iMan->SearchInstance(CLASS_INTERFACE));
|
||||
m_main = static_cast< CRobotMain* >(m_iMan->SearchInstance(CLASS_MAIN));
|
||||
m_displayText = static_cast< Ui::CDisplayText* >(m_iMan->SearchInstance(CLASS_DISPLAYTEXT));
|
||||
m_sound = static_cast< CSoundInterface* >(m_iMan->SearchInstance(CLASS_SOUND));
|
||||
|
||||
m_type = m_object->RetType();
|
||||
m_type = m_object->GetType();
|
||||
m_time = 0.0f;
|
||||
m_lastUpdateTime = 0.0f;
|
||||
m_bMotor = false;
|
||||
|
@ -117,14 +117,14 @@ bool CAuto::SetString(char *string)
|
|||
|
||||
bool CAuto::EventProcess(const Event &event)
|
||||
{
|
||||
if ( event.event == EVENT_FRAME &&
|
||||
!m_engine->RetPause() )
|
||||
if ( event.type == EVENT_FRAME &&
|
||||
!m_engine->GetPause() )
|
||||
{
|
||||
m_time += event.rTime;
|
||||
UpdateInterface(event.rTime);
|
||||
}
|
||||
|
||||
if ( !m_object->RetSelect() ) // robot not selected?
|
||||
if ( !m_object->GetSelect() ) // robot not selected?
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
@ -151,13 +151,13 @@ bool CAuto::Abort()
|
|||
|
||||
bool CAuto::CreateInterface(bool bSelect)
|
||||
{
|
||||
CWindow* pw;
|
||||
Ui::CWindow* pw;
|
||||
Math::Point pos, dim, ddim;
|
||||
float ox, oy, sx, sy;
|
||||
char name[100];
|
||||
|
||||
pw = (CWindow*)m_interface->SearchControl(EVENT_WINDOW0);
|
||||
if ( pw != 0 )
|
||||
pw = static_cast<Ui::CWindow*>(m_interface->SearchControl(EVENT_WINDOW0));
|
||||
if ( pw != nullptr )
|
||||
{
|
||||
pw->Flush(); // destroys the window buttons
|
||||
m_interface->DeleteControl(EVENT_WINDOW0); // destroys the window
|
||||
|
@ -171,7 +171,7 @@ bool CAuto::CreateInterface(bool bSelect)
|
|||
//? dim.y = 70.0f/480.0f;
|
||||
dim.y = 86.0f/480.0f;
|
||||
m_interface->CreateWindows(pos, dim, 3, EVENT_WINDOW0);
|
||||
pw = (CWindow*)m_interface->SearchControl(EVENT_WINDOW0);
|
||||
pw = static_cast<Ui::CWindow*>(m_interface->SearchControl(EVENT_WINDOW0));
|
||||
if ( pw == 0 ) return false;
|
||||
|
||||
m_object->GetTooltipName(name);
|
||||
|
@ -214,7 +214,7 @@ bool CAuto::CreateInterface(bool bSelect)
|
|||
pos.y = oy+sy*0;
|
||||
pw->CreateButton(pos, dim, 19, EVENT_OBJECT_HELP);
|
||||
|
||||
if ( m_main->RetSceneSoluce() )
|
||||
if ( m_main->GetSceneSoluce() )
|
||||
{
|
||||
pos.x = ox+sx*13.4f;
|
||||
pos.y = oy+sy*1;
|
||||
|
@ -263,62 +263,62 @@ bool CAuto::CreateInterface(bool bSelect)
|
|||
|
||||
// Change the state of a button interface.
|
||||
|
||||
void CAuto::CheckInterface(CWindow *pw, EventMsg event, bool bState)
|
||||
void CAuto::CheckInterface(Ui::CWindow *pw, EventType event, bool bState)
|
||||
{
|
||||
CControl* control;
|
||||
Ui::CControl* control;
|
||||
|
||||
control = pw->SearchControl(event);
|
||||
if ( control == 0 ) return;
|
||||
if ( control == nullptr ) return;
|
||||
|
||||
control->SetState(STATE_CHECK, bState);
|
||||
control->SetState(Ui::STATE_CHECK, bState);
|
||||
}
|
||||
|
||||
// Change the state of a button interface.
|
||||
|
||||
void CAuto::EnableInterface(CWindow *pw, EventMsg event, bool bState)
|
||||
void CAuto::EnableInterface(Ui::CWindow *pw, EventType event, bool bState)
|
||||
{
|
||||
CControl* control;
|
||||
Ui::CControl* control;
|
||||
|
||||
control = pw->SearchControl(event);
|
||||
if ( control == 0 ) return;
|
||||
if ( control == nullptr ) return;
|
||||
|
||||
control->SetState(STATE_ENABLE, bState);
|
||||
control->SetState(Ui::STATE_ENABLE, bState);
|
||||
}
|
||||
|
||||
// Change the state of a button interface.
|
||||
|
||||
void CAuto::VisibleInterface(CWindow *pw, EventMsg event, bool bState)
|
||||
void CAuto::VisibleInterface(Ui::CWindow *pw, EventType event, bool bState)
|
||||
{
|
||||
CControl* control;
|
||||
Ui::CControl* control;
|
||||
|
||||
control = pw->SearchControl(event);
|
||||
if ( control == 0 ) return;
|
||||
if ( control == nullptr ) return;
|
||||
|
||||
control->SetState(STATE_VISIBLE, bState);
|
||||
control->SetState(Ui::STATE_VISIBLE, bState);
|
||||
}
|
||||
|
||||
// Change the state of a button interface.
|
||||
|
||||
void CAuto::DeadInterface(CWindow *pw, EventMsg event, bool bState)
|
||||
void CAuto::DeadInterface(Ui::CWindow *pw, EventType event, bool bState)
|
||||
{
|
||||
CControl* control;
|
||||
Ui::CControl* control;
|
||||
|
||||
control = pw->SearchControl(event);
|
||||
if ( control == 0 ) return;
|
||||
if ( control == nullptr ) return;
|
||||
|
||||
control->SetState(STATE_DEAD, !bState);
|
||||
control->SetState(Ui::STATE_DEAD, !bState);
|
||||
}
|
||||
|
||||
// Change the state of a button interface.
|
||||
|
||||
void CAuto::UpdateInterface()
|
||||
{
|
||||
CWindow* pw;
|
||||
Ui::CWindow* pw;
|
||||
|
||||
if ( !m_object->RetSelect() ) return;
|
||||
if ( !m_object->GetSelect() ) return;
|
||||
|
||||
pw = (CWindow*)m_interface->SearchControl(EVENT_WINDOW0);
|
||||
if ( pw == 0 ) return;
|
||||
pw = static_cast<Ui::CWindow*>(m_interface->SearchControl(EVENT_WINDOW0));
|
||||
if ( pw == nullptr ) return;
|
||||
|
||||
VisibleInterface(pw, EVENT_OBJECT_GPROGRESS, m_bBusy);
|
||||
}
|
||||
|
@ -328,34 +328,34 @@ void CAuto::UpdateInterface()
|
|||
|
||||
void CAuto::UpdateInterface(float rTime)
|
||||
{
|
||||
CWindow* pw;
|
||||
CGauge* pg;
|
||||
Ui::CWindow* pw;
|
||||
Ui::CGauge* pg;
|
||||
|
||||
if ( m_time < m_lastUpdateTime+0.1f ) return;
|
||||
m_lastUpdateTime = m_time;
|
||||
|
||||
if ( !m_object->RetSelect() ) return;
|
||||
if ( !m_object->GetSelect() ) return;
|
||||
|
||||
pw = (CWindow*)m_interface->SearchControl(EVENT_WINDOW0);
|
||||
if ( pw == 0 ) return;
|
||||
pw = static_cast<Ui::CWindow*>(m_interface->SearchControl(EVENT_WINDOW0));
|
||||
if ( pw == nullptr ) return;
|
||||
|
||||
pg = (CGauge*)pw->SearchControl(EVENT_OBJECT_GSHIELD);
|
||||
if ( pg != 0 )
|
||||
pg = static_cast<Ui::CGauge*>(pw->SearchControl(EVENT_OBJECT_GSHIELD));
|
||||
if ( pg != nullptr )
|
||||
{
|
||||
pg->SetLevel(m_object->RetShield());
|
||||
pg->SetLevel(m_object->GetShield());
|
||||
}
|
||||
|
||||
pg = (CGauge*)pw->SearchControl(EVENT_OBJECT_GPROGRESS);
|
||||
if ( pg != 0 )
|
||||
pg = static_cast<Ui::CGauge*>(pw->SearchControl(EVENT_OBJECT_GPROGRESS));
|
||||
if ( pg != nullptr )
|
||||
{
|
||||
pg->SetLevel(m_progressTime);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Returns an error due the state of the automation.
|
||||
// Geturns an error due the state of the automation.
|
||||
|
||||
Error CAuto::RetError()
|
||||
Error CAuto::GetError()
|
||||
{
|
||||
return ERR_OK;
|
||||
}
|
||||
|
@ -363,7 +363,7 @@ Error CAuto::RetError()
|
|||
|
||||
// Management of the occupation.
|
||||
|
||||
bool CAuto::RetBusy()
|
||||
bool CAuto::GetBusy()
|
||||
{
|
||||
return m_bBusy;
|
||||
}
|
||||
|
@ -387,7 +387,7 @@ void CAuto::EventProgress(float rTime)
|
|||
|
||||
// Engine management.
|
||||
|
||||
bool CAuto::RetMotor()
|
||||
bool CAuto::GetMotor()
|
||||
{
|
||||
return m_bMotor;
|
||||
}
|
||||
|
@ -422,11 +422,11 @@ bool CAuto::Write(char *line)
|
|||
return false;
|
||||
}
|
||||
|
||||
// Return all settings to the controller.
|
||||
// Geturn all settings to the controller.
|
||||
|
||||
bool CAuto::Read(char *line)
|
||||
{
|
||||
m_type = (ObjectType)OpInt(line, "aType", OBJECT_NULL);
|
||||
m_type = static_cast<ObjectType>(OpInt(line, "aType", OBJECT_NULL));
|
||||
m_bBusy = OpInt(line, "aBusy", 0);
|
||||
m_time = OpFloat(line, "aTime", 0.0f);
|
||||
m_progressTime = OpFloat(line, "aProgressTime", 0.0f);
|
||||
|
|
|
@ -24,22 +24,27 @@
|
|||
|
||||
|
||||
class CInstanceManager;
|
||||
class CD3DEngine;
|
||||
class CParticule;
|
||||
class CLight;
|
||||
class CTerrain;
|
||||
class CRobotMain;
|
||||
class CSoundInterface;
|
||||
|
||||
namespace Ui {
|
||||
class CDisplayText;
|
||||
class CInterface;
|
||||
class CWindow;
|
||||
} /* Ui */
|
||||
|
||||
namespace Gfx {
|
||||
|
||||
class CEngine;
|
||||
class CParticle;
|
||||
class CLightManager;
|
||||
class CTarrain;
|
||||
class CWater;
|
||||
class CCloud;
|
||||
class CPlanet;
|
||||
class CBlitz;
|
||||
class CCamera;
|
||||
class CInterface;
|
||||
class CRobotMain;
|
||||
class CDisplayText;
|
||||
class CWindow;
|
||||
class CSound;
|
||||
|
||||
|
||||
class CPlanet;
|
||||
class CLightning;
|
||||
} /* Gfx */
|
||||
|
||||
|
||||
class CAuto
|
||||
|
@ -61,44 +66,44 @@ public:
|
|||
virtual bool SetString(char *string);
|
||||
|
||||
virtual bool CreateInterface(bool bSelect);
|
||||
virtual Error RetError();
|
||||
virtual Error GetError();
|
||||
|
||||
virtual bool RetBusy();
|
||||
virtual bool GetBusy();
|
||||
virtual void SetBusy(bool bBuse);
|
||||
virtual void InitProgressTotal(float total);
|
||||
virtual void EventProgress(float rTime);
|
||||
|
||||
virtual bool RetMotor();
|
||||
virtual bool GetMotor();
|
||||
virtual void SetMotor(bool bMotor);
|
||||
|
||||
virtual bool Write(char *line);
|
||||
virtual bool Read(char *line);
|
||||
|
||||
protected:
|
||||
void CheckInterface(CWindow *pw, EventMsg event, bool bState);
|
||||
void EnableInterface(CWindow *pw, EventMsg event, bool bState);
|
||||
void VisibleInterface(CWindow *pw, EventMsg event, bool bState);
|
||||
void DeadInterface(CWindow *pw, EventMsg event, bool bState);
|
||||
void CheckInterface(Ui::CWindow *pw, EventType event, bool bState);
|
||||
void EnableInterface(Ui::CWindow *pw, EventType event, bool bState);
|
||||
void VisibleInterface(Ui::CWindow *pw, EventType event, bool bState);
|
||||
void DeadInterface(Ui::CWindow *pw, EventType event, bool bState);
|
||||
void UpdateInterface();
|
||||
void UpdateInterface(float rTime);
|
||||
|
||||
protected:
|
||||
CInstanceManager* m_iMan;
|
||||
CEvent* m_event;
|
||||
CD3DEngine* m_engine;
|
||||
CParticule* m_particule;
|
||||
CLight* m_light;
|
||||
CTerrain* m_terrain;
|
||||
CWater* m_water;
|
||||
CCloud * m_cloud;
|
||||
CPlanet * m_planet;
|
||||
CBlitz* m_blitz;
|
||||
CCamera* m_camera;
|
||||
CInterface* m_interface;
|
||||
CRobotMain* m_main;
|
||||
CDisplayText* m_displayText;
|
||||
CObject* m_object;
|
||||
CSound* m_sound;
|
||||
CInstanceManager* m_iMan;
|
||||
CEventQueue* m_event;
|
||||
Gfx::CEngine* m_engine;
|
||||
Gfx::CParticle* m_particle;
|
||||
Gfx::CLightManager* m_lightMan;
|
||||
Gfx::CTerrain* m_terrain;
|
||||
Gfx::CWater* m_water;
|
||||
Gfx::CCloud * m_cloud;
|
||||
Gfx::CPlanet * m_planet;
|
||||
Gfx::CLightning* m_lightning;
|
||||
Gfx::CCamera* m_camera;
|
||||
Ui::CInterface* m_interface;
|
||||
Ui::CDisplayText* m_displayText;
|
||||
CRobotMain* m_main;
|
||||
CObject* m_object;
|
||||
CSoundInterface* m_sound;
|
||||
|
||||
ObjectType m_type;
|
||||
bool m_bBusy;
|
||||
|
|
|
@ -20,10 +20,10 @@
|
|||
#include "object/auto/autobase.h"
|
||||
|
||||
#include "common/iman.h"
|
||||
#include "old/terrain.h"
|
||||
#include "old/cloud.h"
|
||||
#include "old/planet.h"
|
||||
#include "old/blitz.h"
|
||||
#include "graphics/engine/terrain.h"
|
||||
#include "graphics/engine/cloud.h"
|
||||
#include "graphics/engine/planet.h"
|
||||
#include "graphics/engine/lightning.h"
|
||||
#include "math/geometry.h"
|
||||
#include "object/robotmain.h"
|
||||
#include "physics/physics.h"
|
||||
|
@ -50,8 +50,8 @@ const float BASE_TRANSIT_TIME = 15.0f; // transit duration
|
|||
CAutoBase::CAutoBase(CInstanceManager* iMan, CObject* object)
|
||||
: CAuto(iMan, object)
|
||||
{
|
||||
m_fogStart = m_engine->RetFogStart();
|
||||
m_deepView = m_engine->RetDeepView();
|
||||
m_fogStart = m_engine->GetFogStart();
|
||||
m_deepView = m_engine->GetDeepView();
|
||||
Init();
|
||||
m_phase = ABP_WAIT;
|
||||
m_soundChannel = -1;
|
||||
|
@ -85,10 +85,10 @@ void CAutoBase::Init()
|
|||
{
|
||||
m_bOpen = false;
|
||||
m_time = 0.0f;
|
||||
m_lastParticule = 0.0f;
|
||||
m_lastMotorParticule = 0.0f;
|
||||
m_lastParticle = 0.0f;
|
||||
m_lastMotorParticle = 0.0f;
|
||||
|
||||
m_pos = m_object->RetPosition(0);
|
||||
m_pos = m_object->GetPosition(0);
|
||||
m_lastPos = m_pos;
|
||||
|
||||
m_phase = ABP_WAIT;
|
||||
|
@ -124,10 +124,10 @@ bool CAutoBase::EventProcess(const Event &event)
|
|||
|
||||
CAuto::EventProcess(event);
|
||||
|
||||
if ( m_engine->RetPause() ) return true;
|
||||
if ( m_engine->GetPause() ) return true;
|
||||
|
||||
begin:
|
||||
iPos = m_object->RetPosition(0);
|
||||
iPos = m_object->GetPosition(0);
|
||||
|
||||
if ( m_phase == ABP_START )
|
||||
{
|
||||
|
@ -152,17 +152,17 @@ begin:
|
|||
m_object->SetPosition(18+i, Math::Vector(23.5f, 0.0f, 11.5f));
|
||||
}
|
||||
|
||||
pObj = m_main->RetSelectObject();
|
||||
pObj = m_main->GetSelectObject();
|
||||
m_main->SelectObject(pObj);
|
||||
m_camera->SetObject(pObj);
|
||||
if ( pObj == 0 )
|
||||
{
|
||||
m_camera->SetType(CAMERA_BACK);
|
||||
m_camera->SetType(Gfx::CAM_TYPE_BACK);
|
||||
}
|
||||
else
|
||||
{
|
||||
m_camera->SetType(pObj->RetCameraType());
|
||||
m_camera->SetDist(pObj->RetCameraDist());
|
||||
m_camera->SetType(pObj->GetCameraType());
|
||||
m_camera->SetDist(pObj->GetCameraDist());
|
||||
}
|
||||
|
||||
m_main->StartMusic();
|
||||
|
@ -193,7 +193,7 @@ begin:
|
|||
m_main->SetMovieLock(true); // blocks everything until the end of the landing
|
||||
m_bMotor = true; // lights the jet engine
|
||||
|
||||
m_camera->SetType(CAMERA_SCRIPT);
|
||||
m_camera->SetType(Gfx::CAM_TYPE_SCRIPT);
|
||||
|
||||
pos = m_pos;
|
||||
pos.x -= 150.0f;
|
||||
|
@ -202,7 +202,7 @@ begin:
|
|||
m_camera->SetScriptEye(pos);
|
||||
m_posSound = pos;
|
||||
|
||||
pos = m_object->RetPosition(0);
|
||||
pos = m_object->GetPosition(0);
|
||||
pos.y += 300.0f+50.0f;
|
||||
m_camera->SetScriptLookat(pos);
|
||||
|
||||
|
@ -223,7 +223,7 @@ begin:
|
|||
|
||||
if ( m_param == PARAM_PORTICO ) // gate on the porch?
|
||||
{
|
||||
pos = m_object->RetPosition(0);
|
||||
pos = m_object->GetPosition(0);
|
||||
m_finalPos = pos;
|
||||
pos.z += BASE_PORTICO_TIME_MOVE*5.0f; // back
|
||||
pos.y += 10.0f; // rises (the gate)
|
||||
|
@ -246,7 +246,7 @@ begin:
|
|||
m_speed = 1.0f/BASE_TRANSIT_TIME;
|
||||
|
||||
m_object->SetAngleZ(0, -Math::PI/2.0f);
|
||||
pos = m_object->RetPosition(0);
|
||||
pos = m_object->GetPosition(0);
|
||||
pos.y += 10000.0f; // in space
|
||||
m_finalPos = pos;
|
||||
m_object->SetPosition(0, pos);
|
||||
|
@ -254,7 +254,7 @@ begin:
|
|||
m_main->SetMovieLock(true); // blocks everything until the end of the landing
|
||||
m_bMotor = true; // lights the jet engine
|
||||
|
||||
m_camera->SetType(CAMERA_SCRIPT);
|
||||
m_camera->SetType(Gfx::CAM_TYPE_SCRIPT);
|
||||
pos.x += 1000.0f;
|
||||
pos.z -= 60.0f;
|
||||
pos.y += 80.0f;
|
||||
|
@ -265,34 +265,34 @@ begin:
|
|||
|
||||
BeginTransit();
|
||||
|
||||
mat = m_object->RetWorldMatrix(0);
|
||||
mat = m_object->GetWorldMatrix(0);
|
||||
speed = Math::Vector(0.0f, 0.0f, 0.0f);
|
||||
dim.x = 10.0f;
|
||||
dim.y = dim.x;
|
||||
pos = Math::Vector(42.0f, -2.0f, 17.0f);
|
||||
pos = Transform(*mat, pos);
|
||||
m_partiChannel[0] = m_particule->CreateParticule(pos, speed, dim, PARTILENS1, BASE_TRANSIT_TIME+1.0f, 0.0f, 0.0f);
|
||||
m_partiChannel[0] = m_particle->CreateParticle(pos, speed, dim, Gfx::PARTILENS1, BASE_TRANSIT_TIME+1.0f, 0.0f, 0.0f);
|
||||
pos = Math::Vector(17.0f, -2.0f, 42.0f);
|
||||
pos = Transform(*mat, pos);
|
||||
m_partiChannel[1] = m_particule->CreateParticule(pos, speed, dim, PARTILENS1, BASE_TRANSIT_TIME+1.0f, 0.0f, 0.0f);
|
||||
m_partiChannel[1] = m_particle->CreateParticle(pos, speed, dim, Gfx::PARTILENS1, BASE_TRANSIT_TIME+1.0f, 0.0f, 0.0f);
|
||||
pos = Math::Vector(42.0f, -2.0f, -17.0f);
|
||||
pos = Transform(*mat, pos);
|
||||
m_partiChannel[2] = m_particule->CreateParticule(pos, speed, dim, PARTILENS1, BASE_TRANSIT_TIME+1.0f, 0.0f, 0.0f);
|
||||
m_partiChannel[2] = m_particle->CreateParticle(pos, speed, dim, Gfx::PARTILENS1, BASE_TRANSIT_TIME+1.0f, 0.0f, 0.0f);
|
||||
pos = Math::Vector(17.0f, -2.0f, -42.0f);
|
||||
pos = Transform(*mat, pos);
|
||||
m_partiChannel[3] = m_particule->CreateParticule(pos, speed, dim, PARTILENS1, BASE_TRANSIT_TIME+1.0f, 0.0f, 0.0f);
|
||||
m_partiChannel[3] = m_particle->CreateParticle(pos, speed, dim, Gfx::PARTILENS1, BASE_TRANSIT_TIME+1.0f, 0.0f, 0.0f);
|
||||
pos = Math::Vector(-42.0f, -2.0f, 17.0f);
|
||||
pos = Transform(*mat, pos);
|
||||
m_partiChannel[4] = m_particule->CreateParticule(pos, speed, dim, PARTILENS1, BASE_TRANSIT_TIME+1.0f, 0.0f, 0.0f);
|
||||
m_partiChannel[4] = m_particle->CreateParticle(pos, speed, dim, Gfx::PARTILENS1, BASE_TRANSIT_TIME+1.0f, 0.0f, 0.0f);
|
||||
pos = Math::Vector(-17.0f, -2.0f, 42.0f);
|
||||
pos = Transform(*mat, pos);
|
||||
m_partiChannel[5] = m_particule->CreateParticule(pos, speed, dim, PARTILENS1, BASE_TRANSIT_TIME+1.0f, 0.0f, 0.0f);
|
||||
m_partiChannel[5] = m_particle->CreateParticle(pos, speed, dim, Gfx::PARTILENS1, BASE_TRANSIT_TIME+1.0f, 0.0f, 0.0f);
|
||||
pos = Math::Vector(-42.0f, -2.0f, -17.0f);
|
||||
pos = Transform(*mat, pos);
|
||||
m_partiChannel[6] = m_particule->CreateParticule(pos, speed, dim, PARTILENS1, BASE_TRANSIT_TIME+1.0f, 0.0f, 0.0f);
|
||||
m_partiChannel[6] = m_particle->CreateParticle(pos, speed, dim, Gfx::PARTILENS1, BASE_TRANSIT_TIME+1.0f, 0.0f, 0.0f);
|
||||
pos = Math::Vector(-17.0f, -2.0f, -42.0f);
|
||||
pos = Transform(*mat, pos);
|
||||
m_partiChannel[7] = m_particule->CreateParticule(pos, speed, dim, PARTILENS1, BASE_TRANSIT_TIME+1.0f, 0.0f, 0.0f);
|
||||
m_partiChannel[7] = m_particle->CreateParticle(pos, speed, dim, Gfx::PARTILENS1, BASE_TRANSIT_TIME+1.0f, 0.0f, 0.0f);
|
||||
|
||||
if ( m_soundChannel == -1 )
|
||||
{
|
||||
|
@ -303,12 +303,12 @@ begin:
|
|||
}
|
||||
}
|
||||
|
||||
if ( event.event == EVENT_UPDINTERFACE )
|
||||
if ( event.type == EVENT_UPDINTERFACE )
|
||||
{
|
||||
if ( m_object->RetSelect() ) CreateInterface(true);
|
||||
if ( m_object->GetSelect() ) CreateInterface(true);
|
||||
}
|
||||
|
||||
if ( event.event == EVENT_OBJECT_BTAKEOFF )
|
||||
if ( event.type == EVENT_OBJECT_BTAKEOFF )
|
||||
{
|
||||
err = CheckCloseDoor();
|
||||
if ( err != ERR_OK )
|
||||
|
@ -328,10 +328,10 @@ begin:
|
|||
m_main->SetMovieLock(true); // blocks everything until the end
|
||||
m_main->DeselectAll();
|
||||
|
||||
m_event->MakeEvent(newEvent, EVENT_UPDINTERFACE);
|
||||
newEvent.type = EVENT_UPDINTERFACE;
|
||||
m_event->AddEvent(newEvent);
|
||||
|
||||
m_camera->SetType(CAMERA_SCRIPT);
|
||||
m_camera->SetType(Gfx::CAM_TYPE_SCRIPT);
|
||||
|
||||
pos = m_pos;
|
||||
pos.x -= 110.0f;
|
||||
|
@ -340,7 +340,7 @@ begin:
|
|||
m_camera->SetScriptEye(pos);
|
||||
m_posSound = pos;
|
||||
|
||||
pos = m_object->RetPosition(0);
|
||||
pos = m_object->GetPosition(0);
|
||||
pos.y += 50.0f;
|
||||
m_camera->SetScriptLookat(pos);
|
||||
|
||||
|
@ -356,7 +356,7 @@ begin:
|
|||
return true;
|
||||
}
|
||||
|
||||
if ( event.event != EVENT_FRAME ) return true;
|
||||
if ( event.type != EVENT_FRAME ) return true;
|
||||
if ( m_phase == ABP_WAIT ) return true;
|
||||
|
||||
m_progress += event.rTime*m_speed;
|
||||
|
@ -386,15 +386,15 @@ begin:
|
|||
pos.y += 10.0f;
|
||||
m_camera->SetScriptEye(pos);
|
||||
|
||||
pos = m_object->RetPosition(0);
|
||||
pos = m_object->GetPosition(0);
|
||||
pos.y += 50.0f;
|
||||
m_camera->SetScriptLookat(pos);
|
||||
|
||||
m_engine->SetFocus(1.0f+(1.0f-m_progress));
|
||||
|
||||
if ( m_lastParticule+m_engine->ParticuleAdapt(0.10f) <= m_time )
|
||||
if ( m_lastParticle+m_engine->ParticleAdapt(0.10f) <= m_time )
|
||||
{
|
||||
m_lastParticule = m_time;
|
||||
m_lastParticle = m_time;
|
||||
|
||||
// Dust thrown to the ground.
|
||||
pos = m_pos;
|
||||
|
@ -410,19 +410,19 @@ begin:
|
|||
dim.y = dim.x;
|
||||
if ( dim.x >= 1.0f )
|
||||
{
|
||||
m_particule->CreateParticule(pos, speed, dim, PARTICRASH, 2.0f, 0.0f, 2.0f);
|
||||
m_particle->CreateParticle(pos, speed, dim, Gfx::PARTICRASH, 2.0f, 0.0f, 2.0f);
|
||||
}
|
||||
|
||||
// Particles are ejected from the jet engine.
|
||||
pos = m_object->RetPosition(0);
|
||||
pos = m_object->GetPosition(0);
|
||||
pos.y += 6.0f;
|
||||
h = m_terrain->RetFloorHeight(pos)/300.0f;
|
||||
h = m_terrain->GetFloorHeight(pos)/300.0f;
|
||||
speed.x = (Math::Rand()-0.5f)*(80.0f-50.0f*h);
|
||||
speed.z = (Math::Rand()-0.5f)*(80.0f-50.0f*h);
|
||||
speed.y = -(Math::Rand()*(h+1.0f)*40.0f+(h+1.0f)*40.0f);
|
||||
dim.x = Math::Rand()*2.0f+2.0f;
|
||||
dim.y = dim.x;
|
||||
m_particule->CreateParticule(pos, speed, dim, PARTIGAS, 2.0f, 10.0f, 2.0f);
|
||||
m_particle->CreateParticle(pos, speed, dim, Gfx::PARTIGAS, 2.0f, 10.0f, 2.0f);
|
||||
|
||||
// Black smoke from the jet engine.
|
||||
if ( m_progress > 0.8f )
|
||||
|
@ -436,7 +436,7 @@ begin:
|
|||
speed.y = 0.0f;
|
||||
dim.x = Math::Rand()*4.0f+4.0f;
|
||||
dim.y = dim.x;
|
||||
m_particule->CreateParticule(pos, speed, dim, PARTISMOKE3, 4.0f, 0.0f, 2.0f);
|
||||
m_particle->CreateParticle(pos, speed, dim, Gfx::PARTISMOKE3, 4.0f, 0.0f, 2.0f);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -449,7 +449,7 @@ begin:
|
|||
MoveCargo(); // all cargo moves
|
||||
|
||||
// Impact with the ground.
|
||||
max = (int)(50.0f*m_engine->RetParticuleDensity());
|
||||
max = static_cast<int>(50.0f*m_engine->GetParticleDensity());
|
||||
for ( i=0 ; i<max ; i++ )
|
||||
{
|
||||
angle = Math::Rand()*(Math::PI*2.0f);
|
||||
|
@ -461,11 +461,11 @@ begin:
|
|||
dim.x = Math::Rand()*10.0f+10.0f;
|
||||
dim.y = dim.x;
|
||||
time = Math::Rand()*2.0f+1.5f;
|
||||
m_particule->CreateParticule(pos, speed, dim, PARTICRASH, time, 0.0f, 2.0f);
|
||||
m_particle->CreateParticle(pos, speed, dim, Gfx::PARTICRASH, time, 0.0f, 2.0f);
|
||||
}
|
||||
|
||||
//? m_camera->StartEffect(CE_CRASH, m_pos, 1.0f);
|
||||
m_camera->StartEffect(CE_EXPLO, m_pos, 2.0f);
|
||||
m_camera->StartEffect(Gfx::CAM_EFFECT_EXPLO, m_pos, 2.0f);
|
||||
m_engine->SetFocus(1.0f);
|
||||
m_sound->Play(SOUND_BOUM, m_posSound, 0.6f, 0.5f);
|
||||
|
||||
|
@ -479,9 +479,9 @@ begin:
|
|||
{
|
||||
if ( m_progress < 1.0f )
|
||||
{
|
||||
if ( m_lastParticule+m_engine->ParticuleAdapt(0.10f) <= m_time )
|
||||
if ( m_lastParticle+m_engine->ParticleAdapt(0.10f) <= m_time )
|
||||
{
|
||||
m_lastParticule = m_time;
|
||||
m_lastParticle = m_time;
|
||||
|
||||
// Black smoke from the reactor.
|
||||
pos = m_pos;
|
||||
|
@ -493,7 +493,7 @@ begin:
|
|||
speed.y = 0.0f;
|
||||
dim.x = Math::Rand()*4.0f+4.0f;
|
||||
dim.y = dim.x;
|
||||
m_particule->CreateParticule(pos, speed, dim, PARTISMOKE3, 4.0f, 0.0f, 2.0f);
|
||||
m_particle->CreateParticle(pos, speed, dim, Gfx::PARTISMOKE3, 4.0f, 0.0f, 2.0f);
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -542,7 +542,7 @@ begin:
|
|||
}
|
||||
|
||||
// Clash the doors with the ground.
|
||||
max = (int)(20.0f*m_engine->RetParticuleDensity());
|
||||
max = static_cast<int>(20.0f*m_engine->GetParticleDensity());
|
||||
for ( i=0 ; i<max ; i++ )
|
||||
{
|
||||
angle = Math::Rand()*(20.0f*Math::PI/180.0f)-(10.0f*Math::PI/180.0f);
|
||||
|
@ -555,7 +555,7 @@ begin:
|
|||
dim.x = Math::Rand()*8.0f+8.0f;
|
||||
dim.y = dim.x;
|
||||
time = Math::Rand()*2.0f+1.5f;
|
||||
m_particule->CreateParticule(pos, speed, dim, PARTICRASH, time, 0.0f, 2.0f);
|
||||
m_particle->CreateParticle(pos, speed, dim, Gfx::PARTICRASH, time, 0.0f, 2.0f);
|
||||
}
|
||||
|
||||
m_soundChannel = m_sound->Play(SOUND_MANIP, m_posSound, 0.3f, 1.5f, true);
|
||||
|
@ -622,19 +622,19 @@ begin:
|
|||
{
|
||||
m_main->SetMovieLock(false); // you can play!
|
||||
|
||||
pObj = m_main->RetSelectObject();
|
||||
pObj = m_main->GetSelectObject();
|
||||
m_main->SelectObject(pObj);
|
||||
m_camera->SetObject(pObj);
|
||||
if ( pObj == 0 )
|
||||
{
|
||||
m_camera->SetType(CAMERA_BACK);
|
||||
m_camera->SetType(Gfx::CAM_TYPE_BACK);
|
||||
}
|
||||
else
|
||||
{
|
||||
m_camera->SetType(pObj->RetCameraType());
|
||||
m_camera->SetDist(pObj->RetCameraDist());
|
||||
m_camera->SetType(pObj->GetCameraType());
|
||||
m_camera->SetDist(pObj->GetCameraDist());
|
||||
}
|
||||
m_sound->Play(SOUND_BOUM, m_object->RetPosition(0));
|
||||
m_sound->Play(SOUND_BOUM, m_object->GetPosition(0));
|
||||
m_soundChannel = -1;
|
||||
|
||||
m_engine->SetFogStart(m_fogStart);
|
||||
|
@ -700,7 +700,7 @@ begin:
|
|||
m_bMotor = true; // lights the jet engine
|
||||
|
||||
// Shock of the closing doors.
|
||||
max = (int)(20.0f*m_engine->RetParticuleDensity());
|
||||
max = static_cast<int>(20.0f*m_engine->GetParticleDensity());
|
||||
for ( i=0 ; i<max ; i++ )
|
||||
{
|
||||
angle = Math::Rand()*Math::PI*2.0f;
|
||||
|
@ -713,9 +713,9 @@ begin:
|
|||
dim.x = Math::Rand()*3.0f+3.0f;
|
||||
dim.y = dim.x;
|
||||
time = Math::Rand()*1.0f+1.0f;
|
||||
m_particule->CreateParticule(pos, speed, dim, PARTICRASH, time);
|
||||
m_particle->CreateParticle(pos, speed, dim, Gfx::PARTICRASH, time);
|
||||
}
|
||||
m_sound->Play(SOUND_BOUM, m_object->RetPosition(0));
|
||||
m_sound->Play(SOUND_BOUM, m_object->GetPosition(0));
|
||||
|
||||
m_soundChannel = -1;
|
||||
m_bOpen = false;
|
||||
|
@ -742,19 +742,19 @@ begin:
|
|||
vibCir *= m_progress*1.0f;
|
||||
m_object->SetCirVibration(vibCir);
|
||||
|
||||
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;
|
||||
|
||||
// Particles are ejected from the reactor.
|
||||
pos = m_object->RetPosition(0);
|
||||
pos = m_object->GetPosition(0);
|
||||
pos.y += 6.0f;
|
||||
speed.x = (Math::Rand()-0.5f)*160.0f;
|
||||
speed.z = (Math::Rand()-0.5f)*160.0f;
|
||||
speed.y = -(Math::Rand()*10.0f+10.0f);
|
||||
dim.x = Math::Rand()*2.0f+2.0f;
|
||||
dim.y = dim.x;
|
||||
m_particule->CreateParticule(pos, speed, dim, PARTIGAS, 2.0f, 10.0f, 2.0f);
|
||||
m_particle->CreateParticle(pos, speed, dim, Gfx::PARTIGAS, 2.0f, 10.0f, 2.0f);
|
||||
}
|
||||
|
||||
m_engine->SetFogStart(m_fogStart+(0.9f-m_fogStart)*m_progress);
|
||||
|
@ -789,15 +789,15 @@ begin:
|
|||
pos.y += 10.0f;
|
||||
m_camera->SetScriptEye(pos);
|
||||
|
||||
pos = m_object->RetPosition(0);
|
||||
pos = m_object->GetPosition(0);
|
||||
pos.y += 50.0f;
|
||||
m_camera->SetScriptLookat(pos);
|
||||
|
||||
m_engine->SetFocus(1.0f+m_progress);
|
||||
|
||||
if ( m_lastParticule+m_engine->ParticuleAdapt(0.10f) <= m_time )
|
||||
if ( m_lastParticle+m_engine->ParticleAdapt(0.10f) <= m_time )
|
||||
{
|
||||
m_lastParticule = m_time;
|
||||
m_lastParticle = m_time;
|
||||
|
||||
// Dust thrown to the ground.
|
||||
pos = m_pos;
|
||||
|
@ -813,11 +813,11 @@ begin:
|
|||
dim.y = dim.x;
|
||||
if ( dim.x >= 1.0f )
|
||||
{
|
||||
m_particule->CreateParticule(pos, speed, dim, PARTICRASH, 2.0f, 0.0f, 2.0f);
|
||||
m_particle->CreateParticle(pos, speed, dim, Gfx::PARTICRASH, 2.0f, 0.0f, 2.0f);
|
||||
}
|
||||
|
||||
// Particles are ejected from the reactor.
|
||||
pos = m_object->RetPosition(0);
|
||||
pos = m_object->GetPosition(0);
|
||||
pos.y += 6.0f;
|
||||
speed.x = (Math::Rand()-0.5f)*40.0f;
|
||||
speed.z = (Math::Rand()-0.5f)*40.0f;
|
||||
|
@ -826,23 +826,23 @@ begin:
|
|||
time = 2.0f+m_progress*12.0f;
|
||||
dim.x = Math::Rand()*time+time;
|
||||
dim.y = dim.x;
|
||||
m_particule->CreateParticule(pos, speed, dim, PARTIGAS, 2.0f, 10.0f, 2.0f);
|
||||
m_particle->CreateParticle(pos, speed, dim, Gfx::PARTIGAS, 2.0f, 10.0f, 2.0f);
|
||||
|
||||
// Black smoke from the reactor.
|
||||
pos = m_object->RetPosition(0);
|
||||
pos = m_object->GetPosition(0);
|
||||
pos.y += 3.0f;
|
||||
speed.x = (Math::Rand()-0.5f)*10.0f*(4.0f-m_progress*3.0f);
|
||||
speed.z = (Math::Rand()-0.5f)*10.0f*(4.0f-m_progress*3.0f);
|
||||
speed.y = 0.0f;
|
||||
dim.x = Math::Rand()*20.0f+20.0f;
|
||||
dim.y = dim.x;
|
||||
m_particule->CreateParticule(pos, speed, dim, PARTISMOKE3, 10.0f, 0.0f, 2.0f);
|
||||
m_particle->CreateParticle(pos, speed, dim, Gfx::PARTISMOKE3, 10.0f, 0.0f, 2.0f);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
m_soundChannel = -1;
|
||||
m_event->MakeEvent(newEvent, EVENT_WIN);
|
||||
newEvent.type = EVENT_WIN;
|
||||
m_event->AddEvent(newEvent);
|
||||
|
||||
m_phase = ABP_WAIT;
|
||||
|
@ -855,7 +855,7 @@ begin:
|
|||
{
|
||||
if ( m_progress < 1.0f )
|
||||
{
|
||||
pos = m_object->RetPosition(0);
|
||||
pos = m_object->GetPosition(0);
|
||||
pos.z -= event.rTime*5.0f;
|
||||
m_object->SetPosition(0, pos);
|
||||
MoveCargo(); // all cargo moves
|
||||
|
@ -882,7 +882,7 @@ begin:
|
|||
{
|
||||
if ( m_progress < 1.0f )
|
||||
{
|
||||
pos = m_object->RetPosition(0);
|
||||
pos = m_object->GetPosition(0);
|
||||
pos.y -= event.rTime*(10.0f/BASE_PORTICO_TIME_DOWN);
|
||||
m_object->SetPosition(0, pos);
|
||||
MoveCargo(); // all cargo moves
|
||||
|
@ -890,7 +890,7 @@ begin:
|
|||
else
|
||||
{
|
||||
// Impact with the ground.
|
||||
max = (int)(50.0f*m_engine->RetParticuleDensity());
|
||||
max = static_cast<int>(50.0f*m_engine->GetParticleDensity());
|
||||
for ( i=0 ; i<max ; i++ )
|
||||
{
|
||||
angle = Math::Rand()*(Math::PI*2.0f);
|
||||
|
@ -902,7 +902,7 @@ begin:
|
|||
dim.x = Math::Rand()*10.0f+10.0f;
|
||||
dim.y = dim.x;
|
||||
time = Math::Rand()*2.0f+1.5f;
|
||||
m_particule->CreateParticule(pos, speed, dim, PARTICRASH, time, 0.0f, 2.0f);
|
||||
m_particle->CreateParticle(pos, speed, dim, Gfx::PARTICRASH, time, 0.0f, 2.0f);
|
||||
}
|
||||
|
||||
m_phase = ABP_PORTICO_WAIT2;
|
||||
|
@ -938,7 +938,7 @@ begin:
|
|||
{
|
||||
if ( m_progress < 1.0f )
|
||||
{
|
||||
pos = m_object->RetPosition(0);
|
||||
pos = m_object->GetPosition(0);
|
||||
pos.x += event.rTime*(2000.0f/BASE_TRANSIT_TIME);
|
||||
m_object->SetPosition(0, pos);
|
||||
pos.x += 60.0f;
|
||||
|
@ -967,11 +967,11 @@ begin:
|
|||
|
||||
if ( m_bMotor )
|
||||
{
|
||||
if ( m_lastMotorParticule+m_engine->ParticuleAdapt(0.02f) <= m_time )
|
||||
if ( m_lastMotorParticle+m_engine->ParticleAdapt(0.02f) <= m_time )
|
||||
{
|
||||
m_lastMotorParticule = m_time;
|
||||
m_lastMotorParticle = m_time;
|
||||
|
||||
mat = m_object->RetWorldMatrix(0);
|
||||
mat = m_object->GetWorldMatrix(0);
|
||||
|
||||
if ( event.rTime == 0.0f )
|
||||
{
|
||||
|
@ -979,7 +979,7 @@ begin:
|
|||
}
|
||||
else
|
||||
{
|
||||
pos = m_object->RetPosition(0);
|
||||
pos = m_object->GetPosition(0);
|
||||
if ( m_phase == ABP_TRANSIT_MOVE )
|
||||
{
|
||||
vSpeed = (pos.x-iPos.x)/event.rTime;
|
||||
|
@ -1003,7 +1003,7 @@ begin:
|
|||
dim.x = 4.0f+Math::Rand()*4.0f;
|
||||
dim.y = dim.x;
|
||||
|
||||
m_particule->CreateParticule(pos, speed, dim, PARTIBASE, 3.0f, 0.0f, 0.0f);
|
||||
m_particle->CreateParticle(pos, speed, dim, Gfx::PARTIBASE, 3.0f, 0.0f, 0.0f);
|
||||
|
||||
if ( m_phase == ABP_TRANSIT_MOVE )
|
||||
{
|
||||
|
@ -1013,7 +1013,7 @@ begin:
|
|||
pos = Math::Vector(0.0f, 7.0f, 0.0f);
|
||||
pos.x += (Math::Rand()-0.5f)*2.0f; pos.z += (Math::Rand()-0.5f)*2.0f;
|
||||
pos = Transform(*mat, pos);
|
||||
m_particule->CreateParticule(pos, speed, dim, PARTIGAS, 1.0f, 0.0f, 0.0f);
|
||||
m_particle->CreateParticle(pos, speed, dim, Gfx::PARTIGAS, 1.0f, 0.0f, 0.0f);
|
||||
|
||||
speed = Math::Vector(0.0f, 0.0f, 0.0f);
|
||||
dim.x = 4.0f;
|
||||
|
@ -1021,67 +1021,67 @@ begin:
|
|||
pos = Math::Vector(42.0f, 0.0f, 17.0f);
|
||||
pos.x += (Math::Rand()-0.5f)*2.0f; pos.z += (Math::Rand()-0.5f)*2.0f;
|
||||
pos = Transform(*mat, pos);
|
||||
m_particule->CreateParticule(pos, speed, dim, PARTIGAS, 0.5f, 0.0f, 0.0f);
|
||||
m_particle->CreateParticle(pos, speed, dim, Gfx::PARTIGAS, 0.5f, 0.0f, 0.0f);
|
||||
pos = Math::Vector(17.0f, 0.0f, 42.0f);
|
||||
pos.x += (Math::Rand()-0.5f)*2.0f; pos.z += (Math::Rand()-0.5f)*2.0f;
|
||||
pos = Transform(*mat, pos);
|
||||
m_particule->CreateParticule(pos, speed, dim, PARTIGAS, 0.5f, 0.0f, 0.0f);
|
||||
m_particle->CreateParticle(pos, speed, dim, Gfx::PARTIGAS, 0.5f, 0.0f, 0.0f);
|
||||
pos = Math::Vector(42.0f, 0.0f, -17.0f);
|
||||
pos.x += (Math::Rand()-0.5f)*2.0f; pos.z += (Math::Rand()-0.5f)*2.0f;
|
||||
pos = Transform(*mat, pos);
|
||||
m_particule->CreateParticule(pos, speed, dim, PARTIGAS, 0.5f, 0.0f, 0.0f);
|
||||
m_particle->CreateParticle(pos, speed, dim, Gfx::PARTIGAS, 0.5f, 0.0f, 0.0f);
|
||||
pos = Math::Vector(17.0f, 0.0f, -42.0f);
|
||||
pos.x += (Math::Rand()-0.5f)*2.0f; pos.z += (Math::Rand()-0.5f)*2.0f;
|
||||
pos = Transform(*mat, pos);
|
||||
m_particule->CreateParticule(pos, speed, dim, PARTIGAS, 0.5f, 0.0f, 0.0f);
|
||||
m_particle->CreateParticle(pos, speed, dim, Gfx::PARTIGAS, 0.5f, 0.0f, 0.0f);
|
||||
pos = Math::Vector(-42.0f, 0.0f, 17.0f);
|
||||
pos.x += (Math::Rand()-0.5f)*2.0f; pos.z += (Math::Rand()-0.5f)*2.0f;
|
||||
pos = Transform(*mat, pos);
|
||||
m_particule->CreateParticule(pos, speed, dim, PARTIGAS, 0.5f, 0.0f, 0.0f);
|
||||
m_particle->CreateParticle(pos, speed, dim, Gfx::PARTIGAS, 0.5f, 0.0f, 0.0f);
|
||||
pos = Math::Vector(-17.0f, 0.0f, 42.0f);
|
||||
pos.x += (Math::Rand()-0.5f)*2.0f; pos.z += (Math::Rand()-0.5f)*2.0f;
|
||||
pos = Transform(*mat, pos);
|
||||
m_particule->CreateParticule(pos, speed, dim, PARTIGAS, 0.5f, 0.0f, 0.0f);
|
||||
m_particle->CreateParticle(pos, speed, dim, Gfx::PARTIGAS, 0.5f, 0.0f, 0.0f);
|
||||
pos = Math::Vector(-42.0f, 0.0f, -17.0f);
|
||||
pos.x += (Math::Rand()-0.5f)*2.0f; pos.z += (Math::Rand()-0.5f)*2.0f;
|
||||
pos = Transform(*mat, pos);
|
||||
m_particule->CreateParticule(pos, speed, dim, PARTIGAS, 0.5f, 0.0f, 0.0f);
|
||||
m_particle->CreateParticle(pos, speed, dim, Gfx::PARTIGAS, 0.5f, 0.0f, 0.0f);
|
||||
pos = Math::Vector(-17.0f, 0.0f, -42.0f);
|
||||
pos.x += (Math::Rand()-0.5f)*2.0f; pos.z += (Math::Rand()-0.5f)*2.0f;
|
||||
pos = Transform(*mat, pos);
|
||||
m_particule->CreateParticule(pos, speed, dim, PARTIGAS, 0.5f, 0.0f, 0.0f);
|
||||
m_particle->CreateParticle(pos, speed, dim, Gfx::PARTIGAS, 0.5f, 0.0f, 0.0f);
|
||||
|
||||
pos = Math::Vector(42.0f, -2.0f, 17.0f);
|
||||
pos = Transform(*mat, pos);
|
||||
m_particule->SetPosition(m_partiChannel[0], pos);
|
||||
m_particle->SetPosition(m_partiChannel[0], pos);
|
||||
pos = Math::Vector(17.0f, -2.0f, 42.0f);
|
||||
pos = Transform(*mat, pos);
|
||||
m_particule->SetPosition(m_partiChannel[1], pos);
|
||||
m_particle->SetPosition(m_partiChannel[1], pos);
|
||||
pos = Math::Vector(42.0f, -2.0f, -17.0f);
|
||||
pos = Transform(*mat, pos);
|
||||
m_particule->SetPosition(m_partiChannel[2], pos);
|
||||
m_particle->SetPosition(m_partiChannel[2], pos);
|
||||
pos = Math::Vector(17.0f, -2.0f, -42.0f);
|
||||
pos = Transform(*mat, pos);
|
||||
m_particule->SetPosition(m_partiChannel[3], pos);
|
||||
m_particle->SetPosition(m_partiChannel[3], pos);
|
||||
pos = Math::Vector(-42.0f, -2.0f, 17.0f);
|
||||
pos = Transform(*mat, pos);
|
||||
m_particule->SetPosition(m_partiChannel[4], pos);
|
||||
m_particle->SetPosition(m_partiChannel[4], pos);
|
||||
pos = Math::Vector(-17.0f, -2.0f, 42.0f);
|
||||
pos = Transform(*mat, pos);
|
||||
m_particule->SetPosition(m_partiChannel[5], pos);
|
||||
m_particle->SetPosition(m_partiChannel[5], pos);
|
||||
pos = Math::Vector(-42.0f, -2.0f, -17.0f);
|
||||
pos = Transform(*mat, pos);
|
||||
m_particule->SetPosition(m_partiChannel[6], pos);
|
||||
m_particle->SetPosition(m_partiChannel[6], pos);
|
||||
pos = Math::Vector(-17.0f, -2.0f, -42.0f);
|
||||
pos = Transform(*mat, pos);
|
||||
m_particule->SetPosition(m_partiChannel[7], pos);
|
||||
m_particle->SetPosition(m_partiChannel[7], pos);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ( m_soundChannel != -1 )
|
||||
{
|
||||
pos = m_engine->RetEyePt();
|
||||
pos = m_engine->GetEyePt();
|
||||
m_sound->Position(m_soundChannel, pos);
|
||||
}
|
||||
|
||||
|
@ -1154,17 +1154,17 @@ bool CAutoBase::Abort()
|
|||
|
||||
m_main->SetMovieLock(false); // you can play!
|
||||
|
||||
pObj = m_main->RetSelectObject();
|
||||
pObj = m_main->GetSelectObject();
|
||||
m_main->SelectObject(pObj);
|
||||
m_camera->SetObject(pObj);
|
||||
if ( pObj == 0 )
|
||||
{
|
||||
m_camera->SetType(CAMERA_BACK);
|
||||
m_camera->SetType(Gfx::CAM_TYPE_BACK);
|
||||
}
|
||||
else
|
||||
{
|
||||
m_camera->SetType(pObj->RetCameraType());
|
||||
m_camera->SetDist(pObj->RetCameraDist());
|
||||
m_camera->SetType(pObj->GetCameraType());
|
||||
m_camera->SetDist(pObj->GetCameraDist());
|
||||
}
|
||||
|
||||
m_engine->SetFogStart(m_fogStart);
|
||||
|
@ -1175,7 +1175,7 @@ bool CAutoBase::Abort()
|
|||
m_phase == ABP_TOWAIT ||
|
||||
m_phase == ABP_TAKEOFF ) // off?
|
||||
{
|
||||
m_event->MakeEvent(newEvent, EVENT_WIN);
|
||||
newEvent.type = EVENT_WIN;
|
||||
m_event->AddEvent(newEvent);
|
||||
}
|
||||
}
|
||||
|
@ -1198,9 +1198,9 @@ bool CAutoBase::Abort()
|
|||
}
|
||||
|
||||
|
||||
// Returns an error due the state of the automation.
|
||||
// Geturns an error due the state of the automation.
|
||||
|
||||
Error CAutoBase::RetError()
|
||||
Error CAutoBase::GetError()
|
||||
{
|
||||
return ERR_OK;
|
||||
}
|
||||
|
@ -1210,7 +1210,7 @@ Error CAutoBase::RetError()
|
|||
|
||||
bool CAutoBase::CreateInterface(bool bSelect)
|
||||
{
|
||||
CWindow* pw;
|
||||
Ui::CWindow* pw;
|
||||
Math::Point pos, dim, ddim;
|
||||
float ox, oy, sx, sy;
|
||||
float sleep, delay, magnetic, progress;
|
||||
|
@ -1219,8 +1219,8 @@ bool CAutoBase::CreateInterface(bool bSelect)
|
|||
|
||||
if ( !bSelect ) return true;
|
||||
|
||||
pw = (CWindow*)m_interface->SearchControl(EVENT_WINDOW0);
|
||||
if ( pw == 0 ) return false;
|
||||
pw = static_cast<Ui::CWindow*>(m_interface->SearchControl(EVENT_WINDOW0));
|
||||
if ( pw == nullptr ) return false;
|
||||
|
||||
dim.x = 33.0f/640.0f;
|
||||
dim.y = 33.0f/480.0f;
|
||||
|
@ -1240,7 +1240,7 @@ bool CAutoBase::CreateInterface(bool bSelect)
|
|||
pos.y = oy+sy*0.25f;
|
||||
pw->CreateButton(pos, ddim, 28, EVENT_OBJECT_BTAKEOFF);
|
||||
|
||||
if ( m_blitz->GetStatus(sleep, delay, magnetic, progress) )
|
||||
if ( m_lightning->GetStatus(sleep, delay, magnetic, progress) )
|
||||
{
|
||||
pos.x = ox+sx*10.2f;
|
||||
pos.y = oy+sy*0.5f;
|
||||
|
@ -1264,13 +1264,13 @@ bool CAutoBase::CreateInterface(bool bSelect)
|
|||
|
||||
void CAutoBase::UpdateInterface()
|
||||
{
|
||||
CWindow* pw;
|
||||
// Ui::CWindow* pw;
|
||||
|
||||
if ( !m_object->RetSelect() ) return;
|
||||
if ( !m_object->GetSelect() ) return;
|
||||
|
||||
CAuto::UpdateInterface();
|
||||
|
||||
pw = (CWindow*)m_interface->SearchControl(EVENT_WINDOW0);
|
||||
// pw = static_cast< Ui::CWindow* >( m_interface->SearchControl(EVENT_WINDOW0));
|
||||
}
|
||||
|
||||
|
||||
|
@ -1286,15 +1286,15 @@ void CAutoBase::FreezeCargo(bool bFreeze)
|
|||
|
||||
for ( i=0 ; i<1000000 ; i++ )
|
||||
{
|
||||
pObj = (CObject*)m_iMan->SearchInstance(CLASS_OBJECT, i);
|
||||
pObj = static_cast<CObject*>(m_iMan->SearchInstance(CLASS_OBJECT, i));
|
||||
if ( pObj == 0 ) break;
|
||||
|
||||
pObj->SetCargo(false);
|
||||
|
||||
if ( pObj == m_object ) continue; // yourself?
|
||||
if ( pObj->RetTruck() != 0 ) continue; // transport object?
|
||||
if ( pObj->GetTruck() != 0 ) continue; // transport object?
|
||||
|
||||
oPos = pObj->RetPosition(0);
|
||||
oPos = pObj->GetPosition(0);
|
||||
dist = Math::DistanceProjected(m_pos, oPos);
|
||||
if ( dist < 32.0f )
|
||||
{
|
||||
|
@ -1303,7 +1303,7 @@ void CAutoBase::FreezeCargo(bool bFreeze)
|
|||
pObj->SetCargo(true);
|
||||
}
|
||||
|
||||
physics = pObj->RetPhysics();
|
||||
physics = pObj->GetPhysics();
|
||||
if ( physics != 0 )
|
||||
{
|
||||
physics->SetFreeze(bFreeze);
|
||||
|
@ -1320,18 +1320,18 @@ void CAutoBase::MoveCargo()
|
|||
Math::Vector oPos, sPos;
|
||||
int i;
|
||||
|
||||
sPos = m_object->RetPosition(0);
|
||||
sPos = m_object->GetPosition(0);
|
||||
|
||||
for ( i=0 ; i<1000000 ; i++ )
|
||||
{
|
||||
pObj = (CObject*)m_iMan->SearchInstance(CLASS_OBJECT, i);
|
||||
pObj = static_cast < CObject* > (m_iMan->SearchInstance(CLASS_OBJECT, i));
|
||||
if ( pObj == 0 ) break;
|
||||
|
||||
if ( !pObj->RetCargo() ) continue;
|
||||
if ( !pObj->GetCargo() ) continue;
|
||||
|
||||
oPos = pObj->RetPosition(0);
|
||||
oPos = pObj->GetPosition(0);
|
||||
oPos.y = sPos.y+30.0f;
|
||||
oPos.y += pObj->RetCharacter()->height;
|
||||
oPos.y += pObj->GetCharacter()->height;
|
||||
oPos.x += sPos.x-m_lastPos.x;
|
||||
oPos.z += sPos.z-m_lastPos.z;
|
||||
pObj->SetPosition(0, oPos);
|
||||
|
@ -1353,13 +1353,13 @@ Error CAutoBase::CheckCloseDoor()
|
|||
|
||||
for ( i=0 ; i<1000000 ; i++ )
|
||||
{
|
||||
pObj = (CObject*)m_iMan->SearchInstance(CLASS_OBJECT, i);
|
||||
pObj = static_cast< CObject* > (m_iMan->SearchInstance(CLASS_OBJECT, i));
|
||||
if ( pObj == 0 ) break;
|
||||
|
||||
if ( pObj == m_object ) continue; // yourself?
|
||||
if ( !pObj->RetActif() ) continue; // inactive?
|
||||
if ( !pObj->GetActif() ) continue; // inactive?
|
||||
|
||||
type = pObj->RetType();
|
||||
type = pObj->GetType();
|
||||
if ( type == OBJECT_PORTICO ) continue;
|
||||
|
||||
j = 0;
|
||||
|
@ -1391,18 +1391,18 @@ void CAutoBase::BeginTransit()
|
|||
|
||||
if ( m_param == PARAM_TRANSIT2 )
|
||||
{
|
||||
strcpy(m_bgBack, "back01.tga"); // clouds orange / blue
|
||||
m_bgBack = "back01.tga"; // clouds orange / blue
|
||||
}
|
||||
else if ( m_param == PARAM_TRANSIT3 )
|
||||
{
|
||||
strcpy(m_bgBack, "back22.tga"); // blueberries clouds
|
||||
m_bgBack = "back22.tga"; // blueberries clouds
|
||||
}
|
||||
else
|
||||
{
|
||||
#if _DEMO
|
||||
strcpy(m_bgBack, "back46b.tga"); // paintings
|
||||
m_bgBack = "back46b.tga"; // paintings
|
||||
#else
|
||||
strcpy(m_bgBack, "back46.tga"); // paintings
|
||||
m_bgBack = "back46.tga"; // paintings
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -1410,8 +1410,8 @@ void CAutoBase::BeginTransit()
|
|||
m_engine->SetDeepView(2000.0f); // we see very far
|
||||
m_engine->ApplyChange();
|
||||
|
||||
m_engine->RetBackground(m_bgName, m_bgUp, m_bgDown, m_bgCloudUp, m_bgCloudDown, bFull, bQuarter);
|
||||
m_engine->FreeTexture(m_bgName);
|
||||
m_engine->GetBackground(m_bgName, m_bgUp, m_bgDown, m_bgCloudUp, m_bgCloudDown, bFull, bQuarter);
|
||||
m_engine->DeleteTexture(m_bgName);
|
||||
|
||||
m_engine->SetBackground(m_bgBack, 0x00000000, 0x00000000, 0x00000000, 0x00000000);
|
||||
m_engine->LoadTexture(m_bgBack);
|
||||
|
@ -1428,7 +1428,7 @@ void CAutoBase::EndTransit()
|
|||
m_engine->SetDeepView(m_deepView); // gives initial depth
|
||||
m_engine->ApplyChange();
|
||||
|
||||
m_engine->FreeTexture(m_bgBack);
|
||||
m_engine->DeleteTexture(m_bgBack);
|
||||
|
||||
m_engine->SetBackground(m_bgName, m_bgUp, m_bgDown, m_bgCloudUp, m_bgCloudDown);
|
||||
m_engine->LoadTexture(m_bgName);
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
// * This file is part of the COLOBOT source code
|
||||
// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch
|
||||
// * Copyright (C) 2012 Polish Portal of Colobot (PPC)
|
||||
// *
|
||||
// * This program is free software: you can redistribute it and/or modify
|
||||
// * it under the terms of the GNU General Public License as published by
|
||||
|
@ -73,7 +74,7 @@ public:
|
|||
void Start(int param);
|
||||
bool EventProcess(const Event &event);
|
||||
bool Abort();
|
||||
Error RetError();
|
||||
Error GetError();
|
||||
|
||||
bool CreateInterface(bool bSelect);
|
||||
|
||||
|
@ -90,23 +91,23 @@ protected:
|
|||
bool m_bOpen;
|
||||
float m_progress;
|
||||
float m_speed;
|
||||
float m_lastParticule;
|
||||
float m_lastMotorParticule;
|
||||
float m_lastParticle;
|
||||
float m_lastMotorParticle;
|
||||
float m_fogStart;
|
||||
float m_deepView;
|
||||
Math::Vector m_pos;
|
||||
Math::Vector m_posSound;
|
||||
Math::Vector m_finalPos;
|
||||
Math::Vector m_lastPos;
|
||||
Math::Vector m_pos;
|
||||
Math::Vector m_posSound;
|
||||
Math::Vector m_finalPos;
|
||||
Math::Vector m_lastPos;
|
||||
int m_param;
|
||||
int m_soundChannel;
|
||||
int m_partiChannel[8];
|
||||
|
||||
char m_bgBack[100];
|
||||
char m_bgName[100];
|
||||
D3DCOLOR m_bgUp;
|
||||
D3DCOLOR m_bgDown;
|
||||
D3DCOLOR m_bgCloudUp;
|
||||
D3DCOLOR m_bgCloudDown;
|
||||
std::string m_bgBack;
|
||||
std::string m_bgName;
|
||||
Gfx::Color m_bgUp;
|
||||
Gfx::Color m_bgDown;
|
||||
Gfx::Color m_bgCloudUp;
|
||||
Gfx::Color m_bgCloudDown;
|
||||
};
|
||||
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
// * This file is part of the COLOBOT source code
|
||||
// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch
|
||||
// * Copyright (C) 2012 Polish Portal of Colobot (PPC)
|
||||
// *
|
||||
// * This program is free software: you can redistribute it and/or modify
|
||||
// * it under the terms of the GNU General Public License as published by
|
||||
|
@ -83,7 +84,7 @@ void CAutoConvert::Init()
|
|||
m_speed = 1.0f/2.0f;
|
||||
m_time = 0.0f;
|
||||
m_timeVirus = 0.0f;
|
||||
m_lastParticule = 0.0f;
|
||||
m_lastParticle = 0.0f;
|
||||
|
||||
CAuto::Init();
|
||||
}
|
||||
|
@ -100,13 +101,13 @@ bool CAutoConvert::EventProcess(const Event &event)
|
|||
|
||||
CAuto::EventProcess(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_progress += event.rTime*m_speed;
|
||||
m_timeVirus -= event.rTime;
|
||||
|
||||
if ( m_object->RetVirusMode() ) // contaminated by a virus?
|
||||
if ( m_object->GetVirusMode() ) // contaminated by a virus?
|
||||
{
|
||||
if ( m_timeVirus <= 0.0f )
|
||||
{
|
||||
|
@ -146,7 +147,7 @@ bool CAutoConvert::EventProcess(const Event &event)
|
|||
InitProgressTotal(3.0f+10.0f+1.5f);
|
||||
UpdateInterface();
|
||||
|
||||
m_sound->Play(SOUND_OPEN, m_object->RetPosition(0), 1.0f, 1.0f);
|
||||
m_sound->Play(SOUND_OPEN, m_object->GetPosition(0), 1.0f, 1.0f);
|
||||
m_bSoundClose = false;
|
||||
|
||||
m_phase = ACP_CLOSE;
|
||||
|
@ -163,7 +164,7 @@ bool CAutoConvert::EventProcess(const Event &event)
|
|||
if ( m_progress >= 0.8f && !m_bSoundClose )
|
||||
{
|
||||
m_bSoundClose = true;
|
||||
m_sound->Play(SOUND_CLOSE, m_object->RetPosition(0), 1.0f, 0.8f);
|
||||
m_sound->Play(SOUND_CLOSE, m_object->GetPosition(0), 1.0f, 0.8f);
|
||||
}
|
||||
angle = -Math::PI*0.35f*(1.0f-Math::Bounce(m_progress, 0.85f, 0.05f));
|
||||
m_object->SetAngleX(2, angle);
|
||||
|
@ -174,7 +175,7 @@ bool CAutoConvert::EventProcess(const Event &event)
|
|||
m_object->SetAngleX(2, 0.0f);
|
||||
m_object->SetAngleX(3, 0.0f);
|
||||
|
||||
m_soundChannel = m_sound->Play(SOUND_CONVERT, m_object->RetPosition(0), 0.0f, 0.25f, true);
|
||||
m_soundChannel = m_sound->Play(SOUND_CONVERT, m_object->GetPosition(0), 0.0f, 0.25f, true);
|
||||
m_sound->AddEnvelope(m_soundChannel, 1.0f, 0.25f, 0.5f, SOPER_CONTINUE);
|
||||
m_sound->AddEnvelope(m_soundChannel, 1.0f, 1.00f, 4.5f, SOPER_CONTINUE);
|
||||
m_sound->AddEnvelope(m_soundChannel, 1.0f, 0.25f, 4.5f, SOPER_CONTINUE);
|
||||
|
@ -202,11 +203,11 @@ bool CAutoConvert::EventProcess(const Event &event)
|
|||
m_object->SetAngleY(2, angle);
|
||||
m_object->SetAngleY(3, angle+Math::PI);
|
||||
|
||||
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_object->RetPosition(0);
|
||||
pos = m_object->GetPosition(0);
|
||||
c.x = pos.x;
|
||||
c.y = pos.z;
|
||||
p.x = c.x;
|
||||
|
@ -218,7 +219,7 @@ bool CAutoConvert::EventProcess(const Event &event)
|
|||
speed = Math::Vector(0.0f, 0.0f, 0.0f);
|
||||
dim.x = Math::Rand()*2.0f+1.0f;
|
||||
dim.y = dim.x;
|
||||
m_particule->CreateParticule(pos, speed, dim, PARTIGAS, 1.0f, 0.0f, 0.0f);
|
||||
m_particle->CreateParticle(pos, speed, dim, Gfx::PARTIGAS, 1.0f, 0.0f, 0.0f);
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -230,13 +231,13 @@ bool CAutoConvert::EventProcess(const Event &event)
|
|||
fret = SearchStone(OBJECT_STONE);
|
||||
if ( fret != 0 )
|
||||
{
|
||||
m_bResetDelete = ( fret->RetResetCap() != RESET_NONE );
|
||||
m_bResetDelete = ( fret->GetResetCap() != RESET_NONE );
|
||||
fret->DeleteObject(); // destroy the stone
|
||||
delete fret;
|
||||
}
|
||||
|
||||
CreateMetal(); // Create the metal
|
||||
m_sound->Play(SOUND_OPEN, m_object->RetPosition(0), 1.0f, 1.5f);
|
||||
m_sound->Play(SOUND_OPEN, m_object->GetPosition(0), 1.0f, 1.5f);
|
||||
|
||||
m_phase = ACP_OPEN;
|
||||
m_progress = 0.0f;
|
||||
|
@ -253,18 +254,18 @@ bool CAutoConvert::EventProcess(const Event &event)
|
|||
m_object->SetAngleX(3, angle);
|
||||
|
||||
if ( m_progress < 0.9f &&
|
||||
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;
|
||||
|
||||
pos = m_object->RetPosition(0);
|
||||
pos = m_object->GetPosition(0);
|
||||
pos.x += (Math::Rand()-0.5f)*6.0f;
|
||||
pos.z += (Math::Rand()-0.5f)*6.0f;
|
||||
pos.y += Math::Rand()*4.0f;
|
||||
speed = Math::Vector(0.0f, 0.0f, 0.0f);
|
||||
dim.x = Math::Rand()*4.0f+3.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);
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -285,11 +286,11 @@ bool CAutoConvert::EventProcess(const Event &event)
|
|||
return true;
|
||||
}
|
||||
|
||||
// Returns an error due the state of the automation.
|
||||
// Geturns an error due the state of the automation.
|
||||
|
||||
Error CAutoConvert::RetError()
|
||||
Error CAutoConvert::GetError()
|
||||
{
|
||||
if ( m_object->RetVirusMode() )
|
||||
if ( m_object->GetVirusMode() )
|
||||
{
|
||||
return ERR_BAT_VIRUS;
|
||||
}
|
||||
|
@ -330,7 +331,7 @@ bool CAutoConvert::Abort()
|
|||
|
||||
bool CAutoConvert::CreateInterface(bool bSelect)
|
||||
{
|
||||
CWindow* pw;
|
||||
Ui::CWindow* pw;
|
||||
Math::Point pos, ddim;
|
||||
float ox, oy, sx, sy;
|
||||
|
||||
|
@ -338,8 +339,8 @@ bool CAutoConvert::CreateInterface(bool bSelect)
|
|||
|
||||
if ( !bSelect ) return true;
|
||||
|
||||
pw = (CWindow*)m_interface->SearchControl(EVENT_WINDOW0);
|
||||
if ( pw == 0 ) return false;
|
||||
pw = static_cast< Ui::CWindow* >(m_interface->SearchControl(EVENT_WINDOW0));
|
||||
if ( pw == nullptr ) return false;
|
||||
|
||||
ox = 3.0f/640.0f;
|
||||
oy = 3.0f/480.0f;
|
||||
|
@ -390,11 +391,11 @@ bool CAutoConvert::Read(char *line)
|
|||
|
||||
CAuto::Read(line);
|
||||
|
||||
m_phase = (AutoConvertPhase)OpInt(line, "aPhase", ACP_WAIT);
|
||||
m_phase = static_cast< AutoConvertPhase >(OpInt(line, "aPhase", ACP_WAIT));
|
||||
m_progress = OpFloat(line, "aProgress", 0.0f);
|
||||
m_speed = OpFloat(line, "aSpeed", 1.0f);
|
||||
|
||||
m_lastParticule = 0.0f;
|
||||
m_lastParticle = 0.0f;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -410,18 +411,18 @@ CObject* CAutoConvert::SearchStone(ObjectType type)
|
|||
float dist;
|
||||
int i;
|
||||
|
||||
cPos = m_object->RetPosition(0);
|
||||
cPos = m_object->GetPosition(0);
|
||||
|
||||
for ( i=0 ; i<1000000 ; i++ )
|
||||
{
|
||||
pObj = (CObject*)m_iMan->SearchInstance(CLASS_OBJECT, i);
|
||||
pObj = static_cast< CObject* >(m_iMan->SearchInstance(CLASS_OBJECT, i));
|
||||
if ( pObj == 0 ) break;
|
||||
|
||||
oType = pObj->RetType();
|
||||
oType = pObj->GetType();
|
||||
if ( oType != type ) continue;
|
||||
if ( pObj->RetTruck() != 0 ) continue;
|
||||
if ( pObj->GetTruck() != 0 ) continue;
|
||||
|
||||
oPos = pObj->RetPosition(0);
|
||||
oPos = pObj->GetPosition(0);
|
||||
dist = Math::Distance(oPos, cPos);
|
||||
|
||||
if ( dist <= 5.0f ) return pObj;
|
||||
|
@ -440,14 +441,14 @@ bool CAutoConvert::SearchVehicle()
|
|||
float oRadius, dist;
|
||||
int i;
|
||||
|
||||
cPos = m_object->RetPosition(0);
|
||||
cPos = m_object->GetPosition(0);
|
||||
|
||||
for ( i=0 ; i<1000000 ; i++ )
|
||||
{
|
||||
pObj = (CObject*)m_iMan->SearchInstance(CLASS_OBJECT, i);
|
||||
pObj = static_cast< CObject* >(m_iMan->SearchInstance(CLASS_OBJECT, i));
|
||||
if ( pObj == 0 ) break;
|
||||
|
||||
type = pObj->RetType();
|
||||
type = pObj->GetType();
|
||||
if ( type != OBJECT_HUMAN &&
|
||||
type != OBJECT_MOBILEfa &&
|
||||
type != OBJECT_MOBILEta &&
|
||||
|
@ -506,8 +507,8 @@ void CAutoConvert::CreateMetal()
|
|||
float angle;
|
||||
CObject* fret;
|
||||
|
||||
pos = m_object->RetPosition(0);
|
||||
angle = m_object->RetAngleY(0);
|
||||
pos = m_object->GetPosition(0);
|
||||
angle = m_object->GetAngleY(0);
|
||||
|
||||
fret = new CObject(m_iMan);
|
||||
if ( !fret->CreateResource(pos, angle, OBJECT_METAL) )
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
// * This file is part of the COLOBOT source code
|
||||
// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch
|
||||
// * Copyright (C) 2012 Polish Portal of Colobot (PPC)
|
||||
// *
|
||||
// * This program is free software: you can redistribute it and/or modify
|
||||
// * it under the terms of the GNU General Public License as published by
|
||||
|
@ -44,7 +45,7 @@ public:
|
|||
|
||||
void Init();
|
||||
bool EventProcess(const Event &event);
|
||||
Error RetError();
|
||||
Error GetError();
|
||||
bool Abort();
|
||||
|
||||
bool CreateInterface(bool bSelect);
|
||||
|
@ -62,7 +63,7 @@ protected:
|
|||
float m_progress;
|
||||
float m_speed;
|
||||
float m_timeVirus;
|
||||
float m_lastParticule;
|
||||
float m_lastParticle;
|
||||
bool m_bResetDelete;
|
||||
bool m_bSoundClose;
|
||||
int m_soundChannel;
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
// * This file is part of the COLOBOT source code
|
||||
// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch
|
||||
// * Copyright (C) 2012 Polish Portal of Colobot (PPC)
|
||||
// *
|
||||
// * This program is free software: you can redistribute it and/or modify
|
||||
// * it under the terms of the GNU General Public License as published by
|
||||
|
@ -20,7 +21,7 @@
|
|||
#include "object/auto/autoderrick.h"
|
||||
|
||||
#include "common/iman.h"
|
||||
#include "old/terrain.h"
|
||||
#include "graphics/engine/terrain.h"
|
||||
#include "math/geometry.h"
|
||||
#include "script/cmdtoken.h"
|
||||
#include "ui/interface.h"
|
||||
|
@ -62,7 +63,7 @@ void CAutoDerrick::DeleteObject(bool bAll)
|
|||
if ( !bAll )
|
||||
{
|
||||
fret = SearchFret();
|
||||
if ( fret != 0 && fret->RetLock() )
|
||||
if ( fret != 0 && fret->GetLock() )
|
||||
{
|
||||
fret->DeleteObject();
|
||||
delete fret;
|
||||
|
@ -86,25 +87,25 @@ void CAutoDerrick::Init()
|
|||
{
|
||||
Math::Matrix* mat;
|
||||
Math::Vector pos;
|
||||
TerrainRes res;
|
||||
Gfx::TerrainRes res;
|
||||
|
||||
pos = m_object->RetPosition(0);
|
||||
res = m_terrain->RetResource(pos);
|
||||
pos = m_object->GetPosition(0);
|
||||
res = m_terrain->GetResource(pos);
|
||||
|
||||
if ( res == TR_STONE ||
|
||||
res == TR_URANIUM ||
|
||||
res == TR_KEYa ||
|
||||
res == TR_KEYb ||
|
||||
res == TR_KEYc ||
|
||||
res == TR_KEYd )
|
||||
if ( res == Gfx::TR_STONE ||
|
||||
res == Gfx::TR_URANIUM ||
|
||||
res == Gfx::TR_KEY_A ||
|
||||
res == Gfx::TR_KEY_B ||
|
||||
res == Gfx::TR_KEY_C ||
|
||||
res == Gfx::TR_KEY_D )
|
||||
{
|
||||
m_type = OBJECT_FRET;
|
||||
if ( res == TR_STONE ) m_type = OBJECT_STONE;
|
||||
if ( res == TR_URANIUM ) m_type = OBJECT_URANIUM;
|
||||
if ( res == TR_KEYa ) m_type = OBJECT_KEYa;
|
||||
if ( res == TR_KEYb ) m_type = OBJECT_KEYb;
|
||||
if ( res == TR_KEYc ) m_type = OBJECT_KEYc;
|
||||
if ( res == TR_KEYd ) m_type = OBJECT_KEYd;
|
||||
if ( res == Gfx::TR_STONE ) m_type = OBJECT_STONE;
|
||||
if ( res == Gfx::TR_URANIUM ) m_type = OBJECT_URANIUM;
|
||||
if ( res == Gfx::TR_KEY_A ) m_type = OBJECT_KEYa;
|
||||
if ( res == Gfx::TR_KEY_B ) m_type = OBJECT_KEYb;
|
||||
if ( res == Gfx::TR_KEY_C ) m_type = OBJECT_KEYc;
|
||||
if ( res == Gfx::TR_KEY_D ) m_type = OBJECT_KEYd;
|
||||
|
||||
m_phase = ADP_EXCAVATE;
|
||||
m_progress = 0.0f;
|
||||
|
@ -119,11 +120,11 @@ void CAutoDerrick::Init()
|
|||
|
||||
m_time = 0.0f;
|
||||
m_timeVirus = 0.0f;
|
||||
m_lastParticule = 0.0f;
|
||||
m_lastParticle = 0.0f;
|
||||
m_lastTrack = 0.0f;
|
||||
|
||||
pos = Math::Vector(7.0f, 0.0f, 0.0f);
|
||||
mat = m_object->RetWorldMatrix(0);
|
||||
mat = m_object->GetWorldMatrix(0);
|
||||
pos = Math::Transform(*mat, pos);
|
||||
m_terrain->MoveOnFloor(pos);
|
||||
m_fretPos = pos;
|
||||
|
@ -141,14 +142,14 @@ bool CAutoDerrick::EventProcess(const Event &event)
|
|||
|
||||
CAuto::EventProcess(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;
|
||||
if ( m_phase == ADP_WAIT ) return true;
|
||||
|
||||
m_progress += event.rTime*m_speed;
|
||||
m_timeVirus -= event.rTime;
|
||||
|
||||
if ( m_object->RetVirusMode() ) // contaminated by a virus?
|
||||
if ( m_object->GetVirusMode() ) // contaminated by a virus?
|
||||
{
|
||||
if ( m_timeVirus <= 0.0f )
|
||||
{
|
||||
|
@ -176,7 +177,7 @@ bool CAutoDerrick::EventProcess(const Event &event)
|
|||
{
|
||||
factor = 1.0f;
|
||||
}
|
||||
m_soundChannel = m_sound->Play(SOUND_DERRICK, m_object->RetPosition(0), 1.0f, 0.5f, true);
|
||||
m_soundChannel = m_sound->Play(SOUND_DERRICK, m_object->GetPosition(0), 1.0f, 0.5f, true);
|
||||
m_sound->AddEnvelope(m_soundChannel, 1.0f, 0.5f, 4.0f*factor, SOPER_CONTINUE);
|
||||
m_sound->AddEnvelope(m_soundChannel, 1.0f, 0.3f, 6.0f*factor, SOPER_CONTINUE);
|
||||
m_sound->AddEnvelope(m_soundChannel, 1.0f, 0.5f, 1.0f, SOPER_CONTINUE);
|
||||
|
@ -184,25 +185,25 @@ bool CAutoDerrick::EventProcess(const Event &event)
|
|||
}
|
||||
|
||||
if ( m_progress >= 6.0f/16.0f && // penetrates into the ground?
|
||||
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;
|
||||
|
||||
pos = m_object->RetPosition(0);
|
||||
pos = m_object->GetPosition(0);
|
||||
speed.x = (Math::Rand()-0.5f)*10.0f;
|
||||
speed.z = (Math::Rand()-0.5f)*10.0f;
|
||||
speed.y = Math::Rand()*5.0f;
|
||||
dim.x = Math::Rand()*3.0f+2.0f;
|
||||
dim.y = dim.x;
|
||||
m_particule->CreateParticule(pos, speed, dim, PARTICRASH, 2.0f);
|
||||
m_particle->CreateParticle(pos, speed, dim, Gfx::PARTICRASH, 2.0f);
|
||||
}
|
||||
|
||||
if ( m_progress >= 6.0f/16.0f && // penetrates into the ground?
|
||||
m_lastTrack+m_engine->ParticuleAdapt(0.5f) <= m_time )
|
||||
m_lastTrack+m_engine->ParticleAdapt(0.5f) <= m_time )
|
||||
{
|
||||
m_lastTrack = m_time;
|
||||
|
||||
pos = m_object->RetPosition(0);
|
||||
pos = m_object->GetPosition(0);
|
||||
speed.x = (Math::Rand()-0.5f)*12.0f;
|
||||
speed.z = (Math::Rand()-0.5f)*12.0f;
|
||||
speed.y = Math::Rand()*10.0f+10.0f;
|
||||
|
@ -210,7 +211,7 @@ bool CAutoDerrick::EventProcess(const Event &event)
|
|||
dim.y = dim.x;
|
||||
pos.y += dim.y;
|
||||
duration = Math::Rand()*2.0f+2.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);
|
||||
}
|
||||
|
@ -222,7 +223,7 @@ bool CAutoDerrick::EventProcess(const Event &event)
|
|||
pos.y = -m_progress*16.0f;
|
||||
m_object->SetPosition(1, pos); // down the drill
|
||||
|
||||
angle = m_object->RetAngleY(1);
|
||||
angle = m_object->GetAngleY(1);
|
||||
angle += event.rTime*8.0f;
|
||||
m_object->SetAngleY(1, angle); // rotates the drill
|
||||
}
|
||||
|
@ -237,25 +238,25 @@ bool CAutoDerrick::EventProcess(const Event &event)
|
|||
if ( m_phase == ADP_ASCEND )
|
||||
{
|
||||
if ( m_progress <= 7.0f/16.0f &&
|
||||
m_lastParticule+m_engine->ParticuleAdapt(0.1f) <= m_time )
|
||||
m_lastParticle+m_engine->ParticleAdapt(0.1f) <= m_time )
|
||||
{
|
||||
m_lastParticule = m_time;
|
||||
m_lastParticle = m_time;
|
||||
|
||||
pos = m_object->RetPosition(0);
|
||||
pos = m_object->GetPosition(0);
|
||||
speed.x = (Math::Rand()-0.5f)*10.0f;
|
||||
speed.z = (Math::Rand()-0.5f)*10.0f;
|
||||
speed.y = Math::Rand()*5.0f;
|
||||
dim.x = Math::Rand()*3.0f+2.0f;
|
||||
dim.y = dim.x;
|
||||
m_particule->CreateParticule(pos, speed, dim, PARTICRASH, 2.0f);
|
||||
m_particle->CreateParticle(pos, speed, dim, Gfx::PARTICRASH, 2.0f);
|
||||
}
|
||||
|
||||
if ( m_progress <= 4.0f/16.0f &&
|
||||
m_lastTrack+m_engine->ParticuleAdapt(1.0f) <= m_time )
|
||||
m_lastTrack+m_engine->ParticleAdapt(1.0f) <= m_time )
|
||||
{
|
||||
m_lastTrack = m_time;
|
||||
|
||||
pos = m_object->RetPosition(0);
|
||||
pos = m_object->GetPosition(0);
|
||||
speed.x = (Math::Rand()-0.5f)*12.0f;
|
||||
speed.z = (Math::Rand()-0.5f)*12.0f;
|
||||
speed.y = Math::Rand()*10.0f+10.0f;
|
||||
|
@ -263,7 +264,7 @@ bool CAutoDerrick::EventProcess(const Event &event)
|
|||
dim.y = dim.x;
|
||||
pos.y += dim.y;
|
||||
duration = Math::Rand()*2.0f+2.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);
|
||||
}
|
||||
|
@ -275,7 +276,7 @@ bool CAutoDerrick::EventProcess(const Event &event)
|
|||
pos.y = -(1.0f-m_progress)*16.0f;
|
||||
m_object->SetPosition(1, pos); // back the drill
|
||||
|
||||
angle = m_object->RetAngleY(1);
|
||||
angle = m_object->GetAngleY(1);
|
||||
angle -= event.rTime*2.0f;
|
||||
m_object->SetAngleY(1, angle); // rotates the drill
|
||||
}
|
||||
|
@ -308,7 +309,7 @@ bool CAutoDerrick::EventProcess(const Event &event)
|
|||
{
|
||||
if ( SearchFree(m_fretPos) )
|
||||
{
|
||||
angle = m_object->RetAngleY(0);
|
||||
angle = m_object->GetAngleY(0);
|
||||
CreateFret(m_fretPos, angle, m_type, 16.0f);
|
||||
}
|
||||
else
|
||||
|
@ -324,31 +325,31 @@ bool CAutoDerrick::EventProcess(const Event &event)
|
|||
|
||||
if ( fret != 0 &&
|
||||
m_progress <= 0.5f &&
|
||||
m_lastParticule+m_engine->ParticuleAdapt(0.1f) <= m_time )
|
||||
m_lastParticle+m_engine->ParticleAdapt(0.1f) <= m_time )
|
||||
{
|
||||
m_lastParticule = m_time;
|
||||
m_lastParticle = m_time;
|
||||
|
||||
if ( m_progress < 0.3f )
|
||||
{
|
||||
pos = fret->RetPosition(0);
|
||||
pos = fret->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;
|
||||
speed = Math::Vector(0.0f, 0.0f, 0.0f);
|
||||
dim.x = 3.0f;
|
||||
dim.y = dim.x;
|
||||
m_particule->CreateParticule(pos, speed, dim, PARTIFIRE, 1.0f, 0.0f, 0.0f);
|
||||
m_particle->CreateParticle(pos, speed, dim, Gfx::PARTIFIRE, 1.0f, 0.0f, 0.0f);
|
||||
}
|
||||
else
|
||||
{
|
||||
pos = fret->RetPosition(0);
|
||||
pos = fret->GetPosition(0);
|
||||
pos.x += (Math::Rand()-0.5f)*5.0f;
|
||||
pos.z += (Math::Rand()-0.5f)*5.0f;
|
||||
pos.y += Math::Rand()*2.5f;
|
||||
speed = Math::Vector(0.0f, 0.0f, 0.0f);
|
||||
dim.x = 1.0f;
|
||||
dim.y = dim.x;
|
||||
m_particule->CreateParticule(pos, speed, dim, PARTIGLINT, 2.0f, 0.0f, 0.0f);
|
||||
m_particle->CreateParticle(pos, speed, dim, Gfx::PARTIGLINT, 2.0f, 0.0f, 0.0f);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -356,7 +357,7 @@ bool CAutoDerrick::EventProcess(const Event &event)
|
|||
{
|
||||
if ( fret != 0 )
|
||||
{
|
||||
pos = fret->RetPosition(0);
|
||||
pos = fret->GetPosition(0);
|
||||
pos.y -= event.rTime*20.0f; // grave
|
||||
if ( !m_bSoundFall && pos.y < m_fretPos.y )
|
||||
{
|
||||
|
@ -396,7 +397,7 @@ bool CAutoDerrick::EventProcess(const Event &event)
|
|||
|
||||
bool CAutoDerrick::CreateInterface(bool bSelect)
|
||||
{
|
||||
CWindow* pw;
|
||||
Ui::CWindow* pw;
|
||||
Math::Point pos, ddim;
|
||||
float ox, oy, sx, sy;
|
||||
|
||||
|
@ -404,7 +405,7 @@ bool CAutoDerrick::CreateInterface(bool bSelect)
|
|||
|
||||
if ( !bSelect ) return true;
|
||||
|
||||
pw = (CWindow*)m_interface->SearchControl(EVENT_WINDOW0);
|
||||
pw = static_cast< Ui::CWindow* >(m_interface->SearchControl(EVENT_WINDOW0));
|
||||
if ( pw == 0 ) return false;
|
||||
|
||||
ox = 3.0f/640.0f;
|
||||
|
@ -455,11 +456,11 @@ bool CAutoDerrick::Read(char *line)
|
|||
|
||||
CAuto::Read(line);
|
||||
|
||||
m_phase = (AutoDerrickPhase)OpInt(line, "aPhase", ADP_WAIT);
|
||||
m_phase = static_cast< AutoDerrickPhase >(OpInt(line, "aPhase", ADP_WAIT));
|
||||
m_progress = OpFloat(line, "aProgress", 0.0f);
|
||||
m_speed = OpFloat(line, "aSpeed", 1.0f);
|
||||
|
||||
m_lastParticule = 0.0f;
|
||||
m_lastParticle = 0.0f;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -476,13 +477,13 @@ CObject* CAutoDerrick::SearchFret()
|
|||
|
||||
for ( i=0 ; i<1000000 ; i++ )
|
||||
{
|
||||
pObj = (CObject*)m_iMan->SearchInstance(CLASS_OBJECT, i);
|
||||
pObj = static_cast< CObject* >(m_iMan->SearchInstance(CLASS_OBJECT, i));
|
||||
if ( pObj == 0 ) break;
|
||||
|
||||
type = pObj->RetType();
|
||||
type = pObj->GetType();
|
||||
if ( type == OBJECT_DERRICK ) continue;
|
||||
|
||||
oPos = pObj->RetPosition(0);
|
||||
oPos = pObj->GetPosition(0);
|
||||
|
||||
if ( oPos.x == m_fretPos.x &&
|
||||
oPos.z == m_fretPos.z ) return pObj;
|
||||
|
@ -503,10 +504,10 @@ bool CAutoDerrick::SearchFree(Math::Vector pos)
|
|||
|
||||
for ( i=0 ; i<1000000 ; i++ )
|
||||
{
|
||||
pObj = (CObject*)m_iMan->SearchInstance(CLASS_OBJECT, i);
|
||||
pObj = static_cast< CObject* >(m_iMan->SearchInstance(CLASS_OBJECT, i));
|
||||
if ( pObj == 0 ) break;
|
||||
|
||||
type = pObj->RetType();
|
||||
type = pObj->GetType();
|
||||
if ( type == OBJECT_DERRICK ) continue;
|
||||
|
||||
j = 0;
|
||||
|
@ -537,12 +538,12 @@ void CAutoDerrick::CreateFret(Math::Vector pos, float angle, ObjectType type,
|
|||
}
|
||||
fret->SetLock(true); // object not yet usable
|
||||
|
||||
if ( m_object->RetResetCap() == RESET_MOVE )
|
||||
if ( m_object->GetResetCap() == RESET_MOVE )
|
||||
{
|
||||
fret->SetResetCap(RESET_DELETE);
|
||||
}
|
||||
|
||||
pos = fret->RetPosition(0);
|
||||
pos = fret->GetPosition(0);
|
||||
pos.y += height;
|
||||
fret->SetPosition(0, pos);
|
||||
}
|
||||
|
@ -562,10 +563,10 @@ bool CAutoDerrick::ExistKey()
|
|||
|
||||
for ( i=0 ; i<1000000 ; i++ )
|
||||
{
|
||||
pObj = (CObject*)m_iMan->SearchInstance(CLASS_OBJECT, i);
|
||||
pObj = static_cast< CObject* >(m_iMan->SearchInstance(CLASS_OBJECT, i));
|
||||
if ( pObj == 0 ) break;
|
||||
|
||||
type = pObj->RetType();
|
||||
type = pObj->GetType();
|
||||
if ( type == m_type ) return true;
|
||||
}
|
||||
|
||||
|
@ -573,11 +574,11 @@ bool CAutoDerrick::ExistKey()
|
|||
}
|
||||
|
||||
|
||||
// Returns an error due the state of the automaton.
|
||||
// returns an error due the state of the automaton.
|
||||
|
||||
Error CAutoDerrick::RetError()
|
||||
Error CAutoDerrick::GetError()
|
||||
{
|
||||
if ( m_object->RetVirusMode() )
|
||||
if ( m_object->GetVirusMode() )
|
||||
{
|
||||
return ERR_BAT_VIRUS;
|
||||
}
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
// * This file is part of the COLOBOT source code
|
||||
// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch
|
||||
// * Copyright (C) 2012 Polish Portal of Colobot (PPC)
|
||||
// *
|
||||
// * This program is free software: you can redistribute it and/or modify
|
||||
// * it under the terms of the GNU General Public License as published by
|
||||
|
@ -44,7 +45,7 @@ public:
|
|||
|
||||
void Init();
|
||||
bool EventProcess(const Event &event);
|
||||
Error RetError();
|
||||
Error GetError();
|
||||
|
||||
bool CreateInterface(bool bSelect);
|
||||
|
||||
|
@ -62,7 +63,7 @@ protected:
|
|||
float m_progress;
|
||||
float m_speed;
|
||||
float m_timeVirus;
|
||||
float m_lastParticule;
|
||||
float m_lastParticle;
|
||||
float m_lastTrack;
|
||||
Math::Vector m_fretPos;
|
||||
int m_soundChannel;
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
// * This file is part of the COLOBOT source code
|
||||
// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch
|
||||
// * Copyright (C) 2012 Polish Portal of Colobot (PPC)
|
||||
// *
|
||||
// * This program is free software: you can redistribute it and/or modify
|
||||
// * it under the terms of the GNU General Public License as published by
|
||||
|
@ -61,7 +62,7 @@ void CAutoDestroyer::Init()
|
|||
|
||||
m_time = 0.0f;
|
||||
m_timeVirus = 0.0f;
|
||||
m_lastParticule = 0.0f;
|
||||
m_lastParticle = 0.0f;
|
||||
|
||||
CAuto::Init();
|
||||
}
|
||||
|
@ -72,19 +73,19 @@ void CAutoDestroyer::Init()
|
|||
bool CAutoDestroyer::EventProcess(const Event &event)
|
||||
{
|
||||
CObject* scrap;
|
||||
CPyro* pyro;
|
||||
Gfx::CPyro* pyro;
|
||||
Math::Vector pos, speed;
|
||||
Math::Point dim;
|
||||
|
||||
CAuto::EventProcess(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_progress += event.rTime*m_speed;
|
||||
m_timeVirus -= event.rTime;
|
||||
|
||||
if ( m_object->RetVirusMode() ) // contaminated by a virus?
|
||||
if ( m_object->GetVirusMode() ) // contaminated by a virus?
|
||||
{
|
||||
if ( m_timeVirus <= 0.0f )
|
||||
{
|
||||
|
@ -117,7 +118,7 @@ bool CAutoDestroyer::EventProcess(const Event &event)
|
|||
}
|
||||
else
|
||||
{
|
||||
m_sound->Play(SOUND_PSHHH2, m_object->RetPosition(0), 1.0f, 1.0f);
|
||||
m_sound->Play(SOUND_PSHHH2, m_object->GetPosition(0), 1.0f, 1.0f);
|
||||
|
||||
m_phase = ADEP_DOWN;
|
||||
m_progress = 0.0f;
|
||||
|
@ -133,10 +134,10 @@ bool CAutoDestroyer::EventProcess(const Event &event)
|
|||
if ( m_progress >= 0.3f-0.05f && !m_bExplo )
|
||||
{
|
||||
scrap = SearchPlastic();
|
||||
if ( scrap != 0 )
|
||||
if ( scrap != nullptr )
|
||||
{
|
||||
pyro = new CPyro(m_iMan);
|
||||
pyro->Create(PT_FRAGT, scrap);
|
||||
pyro = new Gfx::CPyro(m_iMan);
|
||||
pyro->Create(Gfx::PT_FRAGT, scrap);
|
||||
}
|
||||
m_bExplo = true;
|
||||
}
|
||||
|
@ -150,7 +151,7 @@ bool CAutoDestroyer::EventProcess(const Event &event)
|
|||
else
|
||||
{
|
||||
m_object->SetPosition(1, Math::Vector(0.0f, -10.0f, 0.0f));
|
||||
m_sound->Play(SOUND_REPAIR, m_object->RetPosition(0));
|
||||
m_sound->Play(SOUND_REPAIR, m_object->GetPosition(0));
|
||||
|
||||
m_phase = ADEP_REPAIR;
|
||||
m_progress = 0.0f;
|
||||
|
@ -165,7 +166,7 @@ bool CAutoDestroyer::EventProcess(const Event &event)
|
|||
}
|
||||
else
|
||||
{
|
||||
m_sound->Play(SOUND_OPEN, m_object->RetPosition(0), 1.0f, 0.8f);
|
||||
m_sound->Play(SOUND_OPEN, m_object->GetPosition(0), 1.0f, 0.8f);
|
||||
|
||||
m_phase = ADEP_UP;
|
||||
m_progress = 0.0f;
|
||||
|
@ -199,7 +200,7 @@ bool CAutoDestroyer::EventProcess(const Event &event)
|
|||
|
||||
bool CAutoDestroyer::CreateInterface(bool bSelect)
|
||||
{
|
||||
CWindow* pw;
|
||||
Ui::CWindow* pw;
|
||||
Math::Point pos, ddim;
|
||||
float ox, oy, sx, sy;
|
||||
|
||||
|
@ -207,8 +208,8 @@ bool CAutoDestroyer::CreateInterface(bool bSelect)
|
|||
|
||||
if ( !bSelect ) return true;
|
||||
|
||||
pw = (CWindow*)m_interface->SearchControl(EVENT_WINDOW0);
|
||||
if ( pw == 0 ) return false;
|
||||
pw = static_cast< Ui::CWindow* >(m_interface->SearchControl(EVENT_WINDOW0));
|
||||
if ( pw == nullptr ) return false;
|
||||
|
||||
ox = 3.0f/640.0f;
|
||||
oy = 3.0f/480.0f;
|
||||
|
@ -235,23 +236,23 @@ CObject* CAutoDestroyer::SearchPlastic()
|
|||
float dist;
|
||||
int i;
|
||||
|
||||
sPos = m_object->RetPosition(0);
|
||||
sPos = m_object->GetPosition(0);
|
||||
|
||||
for ( i=0 ; i<1000000 ; i++ )
|
||||
{
|
||||
pObj = (CObject*)m_iMan->SearchInstance(CLASS_OBJECT, i);
|
||||
if ( pObj == 0 ) break;
|
||||
pObj = static_cast< CObject* >(m_iMan->SearchInstance(CLASS_OBJECT, i));
|
||||
if ( pObj == nullptr ) break;
|
||||
|
||||
type = pObj->RetType();
|
||||
type = pObj->GetType();
|
||||
if ( type != OBJECT_SCRAP4 &&
|
||||
type != OBJECT_SCRAP5 ) continue;
|
||||
|
||||
oPos = pObj->RetPosition(0);
|
||||
oPos = pObj->GetPosition(0);
|
||||
dist = Math::Distance(oPos, sPos);
|
||||
if ( dist <= 5.0f ) return pObj;
|
||||
}
|
||||
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
// Seeks if one vehicle is too close.
|
||||
|
@ -264,14 +265,14 @@ bool CAutoDestroyer::SearchVehicle()
|
|||
float oRadius, dist;
|
||||
int i;
|
||||
|
||||
cPos = m_object->RetPosition(0);
|
||||
cPos = m_object->GetPosition(0);
|
||||
|
||||
for ( i=0 ; i<1000000 ; i++ )
|
||||
{
|
||||
pObj = (CObject*)m_iMan->SearchInstance(CLASS_OBJECT, i);
|
||||
if ( pObj == 0 ) break;
|
||||
pObj = static_cast< CObject* >(m_iMan->SearchInstance(CLASS_OBJECT, i));
|
||||
if ( pObj == nullptr ) break;
|
||||
|
||||
type = pObj->RetType();
|
||||
type = pObj->GetType();
|
||||
if ( type != OBJECT_HUMAN &&
|
||||
type != OBJECT_MOBILEfa &&
|
||||
type != OBJECT_MOBILEta &&
|
||||
|
@ -316,11 +317,11 @@ bool CAutoDestroyer::SearchVehicle()
|
|||
}
|
||||
|
||||
|
||||
// Returns an error due the state of the automation.
|
||||
// Geturns an error due the state of the automation.
|
||||
|
||||
Error CAutoDestroyer::RetError()
|
||||
Error CAutoDestroyer::GetError()
|
||||
{
|
||||
if ( m_object->RetVirusMode() )
|
||||
if ( m_object->GetVirusMode() )
|
||||
{
|
||||
return ERR_BAT_VIRUS;
|
||||
}
|
||||
|
@ -362,11 +363,11 @@ bool CAutoDestroyer::Read(char *line)
|
|||
|
||||
CAuto::Read(line);
|
||||
|
||||
m_phase = (AutoDestroyerPhase)OpInt(line, "aPhase", ADEP_WAIT);
|
||||
m_phase = static_cast< AutoDestroyerPhase >(OpInt(line, "aPhase", ADEP_WAIT));
|
||||
m_progress = OpFloat(line, "aProgress", 0.0f);
|
||||
m_speed = OpFloat(line, "aSpeed", 1.0f);
|
||||
|
||||
m_lastParticule = 0.0f;
|
||||
m_lastParticle = 0.0f;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
// * This file is part of the COLOBOT source code
|
||||
// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch
|
||||
// * Copyright (C) 2012 Polish Portal of Colobot (PPC)
|
||||
// *
|
||||
// * This program is free software: you can redistribute it and/or modify
|
||||
// * it under the terms of the GNU General Public License as published by
|
||||
|
@ -43,7 +44,7 @@ public:
|
|||
|
||||
void Init();
|
||||
bool EventProcess(const Event &event);
|
||||
Error RetError();
|
||||
Error GetError();
|
||||
|
||||
bool CreateInterface(bool bSelect);
|
||||
|
||||
|
@ -59,7 +60,7 @@ protected:
|
|||
float m_progress;
|
||||
float m_speed;
|
||||
float m_timeVirus;
|
||||
float m_lastParticule;
|
||||
float m_lastParticle;
|
||||
bool m_bExplo;
|
||||
};
|
||||
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
// * This file is part of the COLOBOT source code
|
||||
// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch
|
||||
// * Copyright (C) 2012 Polish Portal of Colobot (PPC)
|
||||
// *
|
||||
// * This program is free software: you can redistribute it and/or modify
|
||||
// * it under the terms of the GNU General Public License as published by
|
||||
|
@ -61,8 +62,8 @@ void CAutoEgg::DeleteObject(bool bAll)
|
|||
if ( alien != 0 )
|
||||
{
|
||||
// Probably the intended action
|
||||
// Original code: ( alien->RetZoom(0) == 1.0f )
|
||||
if ( alien->RetZoomY(0) == 1.0f )
|
||||
// Original code: ( alien->GetZoom(0) == 1.0f )
|
||||
if ( alien->GetZoomY(0) == 1.0f )
|
||||
{
|
||||
alien->SetLock(false);
|
||||
alien->SetActivity(true); // the insect is active
|
||||
|
@ -98,7 +99,7 @@ void CAutoEgg::Init()
|
|||
m_speed = 1.0f/5.0f;
|
||||
m_time = 0.0f;
|
||||
|
||||
m_type = alien->RetType();
|
||||
m_type = alien->GetType();
|
||||
|
||||
if ( m_type == OBJECT_ANT ||
|
||||
m_type == OBJECT_SPIDER ||
|
||||
|
@ -164,9 +165,9 @@ bool CAutoEgg::EventProcess(const Event &event)
|
|||
|
||||
CAuto::EventProcess(event);
|
||||
|
||||
if ( m_engine->RetPause() ) return true;
|
||||
if ( m_engine->GetPause() ) return true;
|
||||
|
||||
if ( event.event != EVENT_FRAME ) return true;
|
||||
if ( event.type != EVENT_FRAME ) return true;
|
||||
if ( m_phase == AEP_NULL ) return true;
|
||||
|
||||
if ( m_phase == AEP_DELAY )
|
||||
|
@ -175,7 +176,7 @@ bool CAutoEgg::EventProcess(const Event &event)
|
|||
if ( m_progress < 1.0f ) return true;
|
||||
|
||||
alien = new CObject(m_iMan);
|
||||
if ( !alien->CreateInsect(m_object->RetPosition(0), m_object->RetAngleY(0), m_type) )
|
||||
if ( !alien->CreateInsect(m_object->GetPosition(0), m_object->GetAngleY(0), m_type) )
|
||||
{
|
||||
delete alien;
|
||||
m_phase = AEP_DELAY;
|
||||
|
@ -213,7 +214,7 @@ bool CAutoEgg::EventProcess(const Event &event)
|
|||
Error CAutoEgg::IsEnded()
|
||||
{
|
||||
CObject* alien;
|
||||
CPyro* pyro;
|
||||
Gfx::CPyro* pyro;
|
||||
|
||||
if ( m_phase == AEP_DELAY )
|
||||
{
|
||||
|
@ -236,8 +237,8 @@ Error CAutoEgg::IsEnded()
|
|||
{
|
||||
if ( m_progress < 1.0f ) return ERR_CONTINUE;
|
||||
|
||||
pyro = new CPyro(m_iMan);
|
||||
pyro->Create(PT_EGG, m_object); // exploding egg
|
||||
pyro = new Gfx::CPyro(m_iMan);
|
||||
pyro->Create(Gfx::PT_EGG, m_object); // exploding egg
|
||||
|
||||
alien->SetZoom(0, 1.0f); // this is a big boy now
|
||||
|
||||
|
@ -258,9 +259,9 @@ Error CAutoEgg::IsEnded()
|
|||
}
|
||||
|
||||
|
||||
// Returns an error due the state of the automation.
|
||||
// Geturns an error due the state of the automation.
|
||||
|
||||
Error CAutoEgg::RetError()
|
||||
Error CAutoEgg::GetError()
|
||||
{
|
||||
return ERR_OK;
|
||||
}
|
||||
|
@ -277,23 +278,23 @@ CObject* CAutoEgg::SearchAlien()
|
|||
float dist, min;
|
||||
int i;
|
||||
|
||||
cPos = m_object->RetPosition(0);
|
||||
cPos = m_object->GetPosition(0);
|
||||
min = 100000.0f;
|
||||
pBest = 0;
|
||||
for ( i=0 ; i<1000000 ; i++ )
|
||||
{
|
||||
pObj = (CObject*)m_iMan->SearchInstance(CLASS_OBJECT, i);
|
||||
pObj = static_cast< CObject* >(m_iMan->SearchInstance(CLASS_OBJECT, i));
|
||||
if ( pObj == 0 ) break;
|
||||
|
||||
if ( pObj->RetTruck() != 0 ) continue;
|
||||
if ( pObj->GetTruck() != 0 ) continue;
|
||||
|
||||
type = pObj->RetType();
|
||||
type = pObj->GetType();
|
||||
if ( type != OBJECT_ANT &&
|
||||
type != OBJECT_BEE &&
|
||||
type != OBJECT_SPIDER &&
|
||||
type != OBJECT_WORM ) continue;
|
||||
|
||||
oPos = pObj->RetPosition(0);
|
||||
oPos = pObj->GetPosition(0);
|
||||
dist = Math::DistanceProjected(oPos, cPos);
|
||||
if ( dist < 8.0f && dist < min )
|
||||
{
|
||||
|
@ -347,7 +348,7 @@ bool CAutoEgg::Read(char *line)
|
|||
|
||||
CAuto::Read(line);
|
||||
|
||||
m_phase = (AutoEggPhase)OpInt(line, "aPhase", AEP_NULL);
|
||||
m_phase = static_cast< AutoEggPhase >(OpInt(line, "aPhase", AEP_NULL));
|
||||
m_progress = OpFloat(line, "aProgress", 0.0f);
|
||||
m_speed = OpFloat(line, "aSpeed", 1.0f);
|
||||
m_type = OpTypeObject(line, "aParamType", OBJECT_NULL);
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
// * This file is part of the COLOBOT source code
|
||||
// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch
|
||||
// * Copyright (C) 2012 Polish Portal of Colobot (PPC)
|
||||
// *
|
||||
// * This program is free software: you can redistribute it and/or modify
|
||||
// * it under the terms of the GNU General Public License as published by
|
||||
|
@ -45,7 +46,7 @@ public:
|
|||
void Start(int param);
|
||||
bool EventProcess(const Event &event);
|
||||
Error IsEnded();
|
||||
Error RetError();
|
||||
Error GetError();
|
||||
|
||||
bool SetType(ObjectType type);
|
||||
bool SetValue(int rank, float value);
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
// * This file is part of the COLOBOT source code
|
||||
// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch
|
||||
// * Copyright (C) 2012 Polish Portal of Colobot (PPC)
|
||||
// *
|
||||
// * This program is free software: you can redistribute it and/or modify
|
||||
// * it under the terms of the GNU General Public License as published by
|
||||
|
@ -20,7 +21,7 @@
|
|||
#include "object/auto/autoenergy.h"
|
||||
|
||||
#include "common/iman.h"
|
||||
#include "old/terrain.h"
|
||||
#include "graphics/engine/terrain.h"
|
||||
#include "math/geometry.h"
|
||||
#include "script/cmdtoken.h"
|
||||
#include "ui/interface.h"
|
||||
|
@ -60,7 +61,7 @@ void CAutoEnergy::DeleteObject(bool bAll)
|
|||
|
||||
if ( m_partiSphere != -1 )
|
||||
{
|
||||
m_particule->DeleteParticule(m_partiSphere);
|
||||
m_particle->DeleteParticle(m_partiSphere);
|
||||
m_partiSphere = -1;
|
||||
}
|
||||
|
||||
|
@ -92,7 +93,7 @@ void CAutoEnergy::Init()
|
|||
m_time = 0.0f;
|
||||
m_timeVirus = 0.0f;
|
||||
m_lastUpdateTime = 0.0f;
|
||||
m_lastParticule = 0.0f;
|
||||
m_lastParticle = 0.0f;
|
||||
|
||||
m_phase = AENP_WAIT; // waiting ...
|
||||
m_progress = 0.0f;
|
||||
|
@ -109,35 +110,35 @@ bool CAutoEnergy::EventProcess(const Event &event)
|
|||
CObject* fret;
|
||||
Math::Vector pos, ppos, speed;
|
||||
Math::Point dim, c, p;
|
||||
TerrainRes res;
|
||||
Gfx::TerrainRes res;
|
||||
float big;
|
||||
bool bGO;
|
||||
|
||||
CAuto::EventProcess(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_progress += event.rTime*m_speed;
|
||||
m_timeVirus -= event.rTime;
|
||||
|
||||
if ( m_object->RetVirusMode() ) // contaminated by a virus?
|
||||
if ( m_object->GetVirusMode() ) // contaminated by a virus?
|
||||
{
|
||||
if ( m_timeVirus <= 0.0f )
|
||||
{
|
||||
m_timeVirus = 0.1f+Math::Rand()*0.3f;
|
||||
|
||||
if ( m_lastParticule+m_engine->ParticuleAdapt(0.05f) <= m_time )
|
||||
if ( m_lastParticle+m_engine->ParticleAdapt(0.05f) <= m_time )
|
||||
{
|
||||
m_lastParticule = m_time;
|
||||
pos = m_object->RetPosition(0);
|
||||
m_lastParticle = m_time;
|
||||
pos = m_object->GetPosition(0);
|
||||
pos.y += 10.0f;
|
||||
speed.x = (Math::Rand()-0.5f)*10.0f;
|
||||
speed.z = (Math::Rand()-0.5f)*10.0f;
|
||||
speed.y = -7.0f;
|
||||
dim.x = Math::Rand()*0.5f+0.5f;
|
||||
dim.y = dim.x;
|
||||
m_particule->CreateParticule(pos, speed, dim, PARTIFIREZ, 1.0f, 0.0f, 0.0f);
|
||||
m_particle->CreateParticle(pos, speed, dim, Gfx::PARTIFIREZ, 1.0f, 0.0f, 0.0f);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
|
@ -146,10 +147,10 @@ bool CAutoEnergy::EventProcess(const Event &event)
|
|||
UpdateInterface(event.rTime);
|
||||
EventProgress(event.rTime);
|
||||
|
||||
big = m_object->RetEnergy();
|
||||
big = m_object->GetEnergy();
|
||||
|
||||
res = m_terrain->RetResource(m_object->RetPosition(0));
|
||||
if ( res == TR_POWER )
|
||||
res = m_terrain->GetResource(m_object->GetPosition(0));
|
||||
if ( res == Gfx::TR_POWER )
|
||||
{
|
||||
big += event.rTime*0.01f; // recharges the big pile
|
||||
}
|
||||
|
@ -162,7 +163,7 @@ bool CAutoEnergy::EventProcess(const Event &event)
|
|||
fret = SearchMetal(); // transform metal?
|
||||
if ( fret != 0 )
|
||||
{
|
||||
if ( fret->RetType() == OBJECT_METAL )
|
||||
if ( fret->GetType() == OBJECT_METAL )
|
||||
{
|
||||
if ( big > ENERGY_POWER ) bGO = true;
|
||||
}
|
||||
|
@ -174,7 +175,7 @@ bool CAutoEnergy::EventProcess(const Event &event)
|
|||
|
||||
if ( bGO )
|
||||
{
|
||||
if ( fret->RetType() == OBJECT_METAL )
|
||||
if ( fret->GetType() == OBJECT_METAL )
|
||||
{
|
||||
fret->SetLock(true); // usable metal
|
||||
CreatePower(); // creates the battery
|
||||
|
@ -184,12 +185,12 @@ bool CAutoEnergy::EventProcess(const Event &event)
|
|||
InitProgressTotal(ENERGY_DELAY);
|
||||
CAuto::UpdateInterface();
|
||||
|
||||
pos = m_object->RetPosition(0);
|
||||
pos = m_object->GetPosition(0);
|
||||
pos.y += 4.0f;
|
||||
speed = Math::Vector(0.0f, 0.0f, 0.0f);
|
||||
dim.x = 3.0f;
|
||||
dim.y = dim.x;
|
||||
m_partiSphere = m_particule->CreateParticule(pos, speed, dim, PARTISPHERE1, ENERGY_DELAY, 0.0f, 0.0f);
|
||||
m_partiSphere = m_particle->CreateParticle(pos, speed, dim, Gfx::PARTISPHERE1, ENERGY_DELAY, 0.0f, 0.0f);
|
||||
|
||||
m_phase = AENP_CREATE;
|
||||
m_progress = 0.0f;
|
||||
|
@ -217,17 +218,17 @@ bool CAutoEnergy::EventProcess(const Event &event)
|
|||
{
|
||||
if ( m_progress < 1.0f && big > 0.01f )
|
||||
{
|
||||
if ( m_lastParticule+m_engine->ParticuleAdapt(0.05f) <= m_time )
|
||||
if ( m_lastParticle+m_engine->ParticleAdapt(0.05f) <= m_time )
|
||||
{
|
||||
m_lastParticule = m_time;
|
||||
pos = m_object->RetPosition(0);
|
||||
m_lastParticle = m_time;
|
||||
pos = m_object->GetPosition(0);
|
||||
pos.y += 10.0f;
|
||||
speed.x = (Math::Rand()-0.5f)*1.0f;
|
||||
speed.z = (Math::Rand()-0.5f)*1.0f;
|
||||
speed.y = -7.0f;
|
||||
dim.x = Math::Rand()*0.5f+0.5f;
|
||||
dim.y = dim.x;
|
||||
m_particule->CreateParticule(pos, speed, dim, PARTIFIREZ, 1.0f, 0.0f, 0.0f);
|
||||
m_particle->CreateParticle(pos, speed, dim, Gfx::PARTIFIREZ, 1.0f, 0.0f, 0.0f);
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -245,7 +246,7 @@ bool CAutoEnergy::EventProcess(const Event &event)
|
|||
fret = SearchMetal();
|
||||
if ( fret != 0 )
|
||||
{
|
||||
if ( fret->RetType() == OBJECT_METAL )
|
||||
if ( fret->GetType() == OBJECT_METAL )
|
||||
{
|
||||
big -= event.rTime/ENERGY_DELAY*ENERGY_POWER;
|
||||
}
|
||||
|
@ -262,11 +263,11 @@ bool CAutoEnergy::EventProcess(const Event &event)
|
|||
fret->SetZoom(0, m_progress);
|
||||
}
|
||||
|
||||
if ( m_lastParticule+m_engine->ParticuleAdapt(0.10f) <= m_time )
|
||||
if ( m_lastParticle+m_engine->ParticleAdapt(0.10f) <= m_time )
|
||||
{
|
||||
m_lastParticule = m_time;
|
||||
m_lastParticle = m_time;
|
||||
|
||||
pos = m_object->RetPosition(0);
|
||||
pos = m_object->GetPosition(0);
|
||||
c.x = pos.x;
|
||||
c.y = pos.z;
|
||||
p.x = c.x;
|
||||
|
@ -278,27 +279,27 @@ bool CAutoEnergy::EventProcess(const Event &event)
|
|||
speed = Math::Vector(0.0f, 0.0f, 0.0f);
|
||||
dim.x = Math::Rand()*2.0f+1.0f;
|
||||
dim.y = dim.x;
|
||||
m_particule->CreateParticule(pos, speed, dim, PARTIGLINT, 1.0f, 0.0f, 0.0f);
|
||||
m_particle->CreateParticle(pos, speed, dim, Gfx::PARTIGLINT, 1.0f, 0.0f, 0.0f);
|
||||
|
||||
pos = m_object->RetPosition(0);
|
||||
pos = m_object->GetPosition(0);
|
||||
pos.y += 3.0f;
|
||||
speed.x = (Math::Rand()-0.5f)*30.0f;
|
||||
speed.z = (Math::Rand()-0.5f)*30.0f;
|
||||
speed.y = Math::Rand()*20.0f+10.0f;
|
||||
dim.x = Math::Rand()*0.4f+0.4f;
|
||||
dim.y = dim.x;
|
||||
m_particule->CreateTrack(pos, speed, dim, PARTITRACK2, 2.0f, 50.0f, 1.2f, 1.2f);
|
||||
m_particle->CreateTrack(pos, speed, dim, Gfx::PARTITRACK2, 2.0f, 50.0f, 1.2f, 1.2f);
|
||||
|
||||
pos = m_object->RetPosition(0);
|
||||
pos = m_object->GetPosition(0);
|
||||
pos.y += 10.0f;
|
||||
speed.x = (Math::Rand()-0.5f)*1.5f;
|
||||
speed.z = (Math::Rand()-0.5f)*1.5f;
|
||||
speed.y = -6.0f;
|
||||
dim.x = Math::Rand()*1.0f+1.0f;
|
||||
dim.y = dim.x;
|
||||
m_particule->CreateParticule(pos, speed, dim, PARTIFIREZ, 1.0f, 0.0f, 0.0f);
|
||||
m_particle->CreateParticle(pos, speed, dim, Gfx::PARTIFIREZ, 1.0f, 0.0f, 0.0f);
|
||||
|
||||
m_sound->Play(SOUND_ENERGY, m_object->RetPosition(0),
|
||||
m_sound->Play(SOUND_ENERGY, m_object->GetPosition(0),
|
||||
1.0f, 1.0f+Math::Rand()*1.5f);
|
||||
}
|
||||
}
|
||||
|
@ -337,11 +338,11 @@ bool CAutoEnergy::EventProcess(const Event &event)
|
|||
{
|
||||
if ( m_progress < 1.0f )
|
||||
{
|
||||
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_object->RetPosition(0);
|
||||
pos = m_object->GetPosition(0);
|
||||
pos.y += 17.0f;
|
||||
pos.x += (Math::Rand()-0.5f)*3.0f;
|
||||
pos.z += (Math::Rand()-0.5f)*3.0f;
|
||||
|
@ -350,7 +351,7 @@ bool CAutoEnergy::EventProcess(const Event &event)
|
|||
speed.y = 6.0f+Math::Rand()*6.0f;
|
||||
dim.x = Math::Rand()*1.5f+1.0f;
|
||||
dim.y = dim.x;
|
||||
m_particule->CreateParticule(pos, speed, dim, PARTISMOKE3, 4.0f);
|
||||
m_particle->CreateParticle(pos, speed, dim, Gfx::PARTISMOKE3, 4.0f);
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -376,10 +377,10 @@ CObject* CAutoEnergy::SearchMetal()
|
|||
CObject* pObj;
|
||||
ObjectType type;
|
||||
|
||||
pObj = m_object->RetPower();
|
||||
pObj = m_object->GetPower();
|
||||
if ( pObj == 0 ) return 0;
|
||||
|
||||
type = pObj->RetType();
|
||||
type = pObj->GetType();
|
||||
if ( type == OBJECT_METAL ||
|
||||
type == OBJECT_SCRAP1 ||
|
||||
type == OBJECT_SCRAP2 ||
|
||||
|
@ -398,14 +399,14 @@ bool CAutoEnergy::SearchVehicle()
|
|||
float oRadius, dist;
|
||||
int i;
|
||||
|
||||
cPos = m_object->RetPosition(0);
|
||||
cPos = m_object->GetPosition(0);
|
||||
|
||||
for ( i=0 ; i<1000000 ; i++ )
|
||||
{
|
||||
pObj = (CObject*)m_iMan->SearchInstance(CLASS_OBJECT, i);
|
||||
pObj = static_cast< CObject* >(m_iMan->SearchInstance(CLASS_OBJECT, i));
|
||||
if ( pObj == 0 ) break;
|
||||
|
||||
type = pObj->RetType();
|
||||
type = pObj->GetType();
|
||||
if ( type != OBJECT_HUMAN &&
|
||||
type != OBJECT_MOBILEfa &&
|
||||
type != OBJECT_MOBILEta &&
|
||||
|
@ -457,8 +458,8 @@ void CAutoEnergy::CreatePower()
|
|||
Math::Vector pos;
|
||||
float angle;
|
||||
|
||||
pos = m_object->RetPosition(0);
|
||||
angle = m_object->RetAngleY(0);
|
||||
pos = m_object->GetPosition(0);
|
||||
angle = m_object->GetAngleY(0);
|
||||
|
||||
power = new CObject(m_iMan);
|
||||
if ( !power->CreateResource(pos, angle, OBJECT_POWER) )
|
||||
|
@ -469,7 +470,7 @@ void CAutoEnergy::CreatePower()
|
|||
}
|
||||
power->SetLock(true); // battery not yet usable
|
||||
|
||||
pos = power->RetPosition(0);
|
||||
pos = power->GetPosition(0);
|
||||
pos.y += 3.0f;
|
||||
power->SetPosition(0, pos);
|
||||
}
|
||||
|
@ -483,19 +484,19 @@ CObject* CAutoEnergy::SearchPower()
|
|||
ObjectType type;
|
||||
int i;
|
||||
|
||||
cPos = m_object->RetPosition(0);
|
||||
cPos = m_object->GetPosition(0);
|
||||
|
||||
for ( i=0 ; i<1000000 ; i++ )
|
||||
{
|
||||
pObj = (CObject*)m_iMan->SearchInstance(CLASS_OBJECT, i);
|
||||
pObj = static_cast< CObject* >(m_iMan->SearchInstance(CLASS_OBJECT, i));
|
||||
if ( pObj == 0 ) break;
|
||||
|
||||
if ( !pObj->RetLock() ) continue;
|
||||
if ( !pObj->GetLock() ) continue;
|
||||
|
||||
type = pObj->RetType();
|
||||
type = pObj->GetType();
|
||||
if ( type != OBJECT_POWER ) continue;
|
||||
|
||||
oPos = pObj->RetPosition(0);
|
||||
oPos = pObj->GetPosition(0);
|
||||
if ( oPos.x == cPos.x &&
|
||||
oPos.z == cPos.z )
|
||||
{
|
||||
|
@ -507,15 +508,15 @@ CObject* CAutoEnergy::SearchPower()
|
|||
}
|
||||
|
||||
|
||||
// Returns an error due the state of the automation.
|
||||
// Geturns an error due the state of the automation.
|
||||
|
||||
Error CAutoEnergy::RetError()
|
||||
Error CAutoEnergy::GetError()
|
||||
{
|
||||
CObject* pObj;
|
||||
ObjectType type;
|
||||
TerrainRes res;
|
||||
Gfx::TerrainRes res;
|
||||
|
||||
if ( m_object->RetVirusMode() )
|
||||
if ( m_object->GetVirusMode() )
|
||||
{
|
||||
return ERR_BAT_VIRUS;
|
||||
}
|
||||
|
@ -523,14 +524,14 @@ Error CAutoEnergy::RetError()
|
|||
if ( m_phase != AENP_WAIT &&
|
||||
m_phase != AENP_BLITZ ) return ERR_OK;
|
||||
|
||||
res = m_terrain->RetResource(m_object->RetPosition(0));
|
||||
if ( res != TR_POWER ) return ERR_ENERGY_NULL;
|
||||
res = m_terrain->GetResource(m_object->GetPosition(0));
|
||||
if ( res != Gfx::TR_POWER ) return ERR_ENERGY_NULL;
|
||||
|
||||
if ( m_object->RetEnergy() < ENERGY_POWER ) return ERR_ENERGY_LOW;
|
||||
if ( m_object->GetEnergy() < ENERGY_POWER ) return ERR_ENERGY_LOW;
|
||||
|
||||
pObj = m_object->RetPower();
|
||||
pObj = m_object->GetPower();
|
||||
if ( pObj == 0 ) return ERR_ENERGY_EMPTY;
|
||||
type = pObj->RetType();
|
||||
type = pObj->GetType();
|
||||
if ( type == OBJECT_POWER ) return ERR_OK;
|
||||
if ( type != OBJECT_METAL &&
|
||||
type != OBJECT_SCRAP1 &&
|
||||
|
@ -545,7 +546,7 @@ Error CAutoEnergy::RetError()
|
|||
|
||||
bool CAutoEnergy::CreateInterface(bool bSelect)
|
||||
{
|
||||
CWindow* pw;
|
||||
Ui::CWindow* pw;
|
||||
Math::Point pos, ddim;
|
||||
float ox, oy, sx, sy;
|
||||
|
||||
|
@ -553,7 +554,7 @@ bool CAutoEnergy::CreateInterface(bool bSelect)
|
|||
|
||||
if ( !bSelect ) return true;
|
||||
|
||||
pw = (CWindow*)m_interface->SearchControl(EVENT_WINDOW0);
|
||||
pw = static_cast< Ui::CWindow* >(m_interface->SearchControl(EVENT_WINDOW0));
|
||||
if ( pw == 0 ) return false;
|
||||
|
||||
ox = 3.0f/640.0f;
|
||||
|
@ -581,23 +582,23 @@ bool CAutoEnergy::CreateInterface(bool bSelect)
|
|||
|
||||
void CAutoEnergy::UpdateInterface(float rTime)
|
||||
{
|
||||
CWindow* pw;
|
||||
CGauge* pg;
|
||||
Ui::CWindow* pw;
|
||||
Ui::CGauge* pg;
|
||||
|
||||
CAuto::UpdateInterface(rTime);
|
||||
|
||||
if ( m_time < m_lastUpdateTime+0.1f ) return;
|
||||
m_lastUpdateTime = m_time;
|
||||
|
||||
if ( !m_object->RetSelect() ) return;
|
||||
if ( !m_object->GetSelect() ) return;
|
||||
|
||||
pw = (CWindow*)m_interface->SearchControl(EVENT_WINDOW0);
|
||||
pw = static_cast< Ui::CWindow* >(m_interface->SearchControl(EVENT_WINDOW0));
|
||||
if ( pw == 0 ) return;
|
||||
|
||||
pg = (CGauge*)pw->SearchControl(EVENT_OBJECT_GENERGY);
|
||||
pg = static_cast< Ui::CGauge* >(pw->SearchControl(EVENT_OBJECT_GENERGY));
|
||||
if ( pg != 0 )
|
||||
{
|
||||
pg->SetLevel(m_object->RetEnergy());
|
||||
pg->SetLevel(m_object->GetEnergy());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -636,12 +637,12 @@ bool CAutoEnergy::Read(char *line)
|
|||
|
||||
CAuto::Read(line);
|
||||
|
||||
m_phase = (AutoEnergyPhase)OpInt(line, "aPhase", AENP_WAIT);
|
||||
m_phase = static_cast< AutoEnergyPhase >(OpInt(line, "aPhase", AENP_WAIT));
|
||||
m_progress = OpFloat(line, "aProgress", 0.0f);
|
||||
m_speed = OpFloat(line, "aSpeed", 1.0f);
|
||||
|
||||
m_lastUpdateTime = 0.0f;
|
||||
m_lastParticule = 0.0f;
|
||||
m_lastParticle = 0.0f;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
// * This file is part of the COLOBOT source code
|
||||
// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch
|
||||
// * Copyright (C) 2012 Polish Portal of Colobot (PPC)
|
||||
// *
|
||||
// * This program is free software: you can redistribute it and/or modify
|
||||
// * it under the terms of the GNU General Public License as published by
|
||||
|
@ -44,7 +45,7 @@ public:
|
|||
|
||||
void Init();
|
||||
bool EventProcess(const Event &event);
|
||||
Error RetError();
|
||||
Error GetError();
|
||||
|
||||
bool CreateInterface(bool bSelect);
|
||||
|
||||
|
@ -65,7 +66,7 @@ protected:
|
|||
float m_speed;
|
||||
float m_timeVirus;
|
||||
float m_lastUpdateTime;
|
||||
float m_lastParticule;
|
||||
float m_lastParticle;
|
||||
int m_partiSphere;
|
||||
};
|
||||
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
// * This file is part of the COLOBOT source code
|
||||
// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch
|
||||
// * Copyright (C) 2012 Polish Portal of Colobot (PPC)
|
||||
// *
|
||||
// * This program is free software: you can redistribute it and/or modify
|
||||
// * it under the terms of the GNU General Public License as published by
|
||||
|
@ -95,9 +96,9 @@ void CAutoFactory::Init()
|
|||
m_speed = 1.0f/2.0f;
|
||||
|
||||
m_time = 0.0f;
|
||||
m_lastParticule = 0.0f;
|
||||
m_lastParticle = 0.0f;
|
||||
|
||||
m_fretPos = m_object->RetPosition(0);
|
||||
m_fretPos = m_object->GetPosition(0);
|
||||
|
||||
CAuto::Init();
|
||||
}
|
||||
|
@ -119,37 +120,37 @@ bool CAutoFactory::EventProcess(const Event &event)
|
|||
|
||||
CAuto::EventProcess(event);
|
||||
|
||||
if ( m_engine->RetPause() ) return true;
|
||||
if ( m_engine->GetPause() ) return true;
|
||||
|
||||
if ( m_object->RetSelect() ) // factory selected?
|
||||
if ( m_object->GetSelect() ) // factory selected?
|
||||
{
|
||||
if ( event.event == EVENT_UPDINTERFACE )
|
||||
if ( event.type == EVENT_UPDINTERFACE )
|
||||
{
|
||||
CreateInterface(true);
|
||||
}
|
||||
|
||||
type = OBJECT_NULL;
|
||||
if ( event.event == EVENT_OBJECT_FACTORYwa ) type = OBJECT_MOBILEwa;
|
||||
if ( event.event == EVENT_OBJECT_FACTORYta ) type = OBJECT_MOBILEta;
|
||||
if ( event.event == EVENT_OBJECT_FACTORYfa ) type = OBJECT_MOBILEfa;
|
||||
if ( event.event == EVENT_OBJECT_FACTORYia ) type = OBJECT_MOBILEia;
|
||||
if ( event.event == EVENT_OBJECT_FACTORYws ) type = OBJECT_MOBILEws;
|
||||
if ( event.event == EVENT_OBJECT_FACTORYts ) type = OBJECT_MOBILEts;
|
||||
if ( event.event == EVENT_OBJECT_FACTORYfs ) type = OBJECT_MOBILEfs;
|
||||
if ( event.event == EVENT_OBJECT_FACTORYis ) type = OBJECT_MOBILEis;
|
||||
if ( event.event == EVENT_OBJECT_FACTORYwc ) type = OBJECT_MOBILEwc;
|
||||
if ( event.event == EVENT_OBJECT_FACTORYtc ) type = OBJECT_MOBILEtc;
|
||||
if ( event.event == EVENT_OBJECT_FACTORYfc ) type = OBJECT_MOBILEfc;
|
||||
if ( event.event == EVENT_OBJECT_FACTORYic ) type = OBJECT_MOBILEic;
|
||||
if ( event.event == EVENT_OBJECT_FACTORYwi ) type = OBJECT_MOBILEwi;
|
||||
if ( event.event == EVENT_OBJECT_FACTORYti ) type = OBJECT_MOBILEti;
|
||||
if ( event.event == EVENT_OBJECT_FACTORYfi ) type = OBJECT_MOBILEfi;
|
||||
if ( event.event == EVENT_OBJECT_FACTORYii ) type = OBJECT_MOBILEii;
|
||||
if ( event.event == EVENT_OBJECT_FACTORYrt ) type = OBJECT_MOBILErt;
|
||||
if ( event.event == EVENT_OBJECT_FACTORYrc ) type = OBJECT_MOBILErc;
|
||||
if ( event.event == EVENT_OBJECT_FACTORYrr ) type = OBJECT_MOBILErr;
|
||||
if ( event.event == EVENT_OBJECT_FACTORYrs ) type = OBJECT_MOBILErs;
|
||||
if ( event.event == EVENT_OBJECT_FACTORYsa ) type = OBJECT_MOBILEsa;
|
||||
if ( event.type == EVENT_OBJECT_FACTORYwa ) type = OBJECT_MOBILEwa;
|
||||
if ( event.type == EVENT_OBJECT_FACTORYta ) type = OBJECT_MOBILEta;
|
||||
if ( event.type == EVENT_OBJECT_FACTORYfa ) type = OBJECT_MOBILEfa;
|
||||
if ( event.type == EVENT_OBJECT_FACTORYia ) type = OBJECT_MOBILEia;
|
||||
if ( event.type == EVENT_OBJECT_FACTORYws ) type = OBJECT_MOBILEws;
|
||||
if ( event.type == EVENT_OBJECT_FACTORYts ) type = OBJECT_MOBILEts;
|
||||
if ( event.type == EVENT_OBJECT_FACTORYfs ) type = OBJECT_MOBILEfs;
|
||||
if ( event.type == EVENT_OBJECT_FACTORYis ) type = OBJECT_MOBILEis;
|
||||
if ( event.type == EVENT_OBJECT_FACTORYwc ) type = OBJECT_MOBILEwc;
|
||||
if ( event.type == EVENT_OBJECT_FACTORYtc ) type = OBJECT_MOBILEtc;
|
||||
if ( event.type == EVENT_OBJECT_FACTORYfc ) type = OBJECT_MOBILEfc;
|
||||
if ( event.type == EVENT_OBJECT_FACTORYic ) type = OBJECT_MOBILEic;
|
||||
if ( event.type == EVENT_OBJECT_FACTORYwi ) type = OBJECT_MOBILEwi;
|
||||
if ( event.type == EVENT_OBJECT_FACTORYti ) type = OBJECT_MOBILEti;
|
||||
if ( event.type == EVENT_OBJECT_FACTORYfi ) type = OBJECT_MOBILEfi;
|
||||
if ( event.type == EVENT_OBJECT_FACTORYii ) type = OBJECT_MOBILEii;
|
||||
if ( event.type == EVENT_OBJECT_FACTORYrt ) type = OBJECT_MOBILErt;
|
||||
if ( event.type == EVENT_OBJECT_FACTORYrc ) type = OBJECT_MOBILErc;
|
||||
if ( event.type == EVENT_OBJECT_FACTORYrr ) type = OBJECT_MOBILErr;
|
||||
if ( event.type == EVENT_OBJECT_FACTORYrs ) type = OBJECT_MOBILErs;
|
||||
if ( event.type == EVENT_OBJECT_FACTORYsa ) type = OBJECT_MOBILEsa;
|
||||
|
||||
if ( type != OBJECT_NULL )
|
||||
{
|
||||
|
@ -186,7 +187,7 @@ bool CAutoFactory::EventProcess(const Event &event)
|
|||
}
|
||||
}
|
||||
|
||||
if ( event.event != EVENT_FRAME ) return true;
|
||||
if ( event.type != EVENT_FRAME ) return true;
|
||||
|
||||
m_progress += event.rTime*m_speed;
|
||||
EventProgress(event.rTime);
|
||||
|
@ -249,7 +250,7 @@ bool CAutoFactory::EventProcess(const Event &event)
|
|||
m_object->SetAngleZ(10+i, 0.0f);
|
||||
}
|
||||
|
||||
m_channelSound = m_sound->Play(SOUND_FACTORY, m_object->RetPosition(0), 0.0f, 1.0f, true);
|
||||
m_channelSound = m_sound->Play(SOUND_FACTORY, m_object->GetPosition(0), 0.0f, 1.0f, true);
|
||||
m_sound->AddEnvelope(m_channelSound, 1.0f, 1.0f, 2.0f, SOPER_CONTINUE);
|
||||
m_sound->AddEnvelope(m_channelSound, 1.0f, 1.0f, 11.0f, SOPER_CONTINUE);
|
||||
m_sound->AddEnvelope(m_channelSound, 0.0f, 1.0f, 2.0f, SOPER_STOP);
|
||||
|
@ -300,7 +301,7 @@ bool CAutoFactory::EventProcess(const Event &event)
|
|||
{
|
||||
prog = 1.0f-m_progress;
|
||||
}
|
||||
angle = powf(prog*10.0f, 2.0f)+m_object->RetAngleY(0);
|
||||
angle = powf(prog*10.0f, 2.0f)+m_object->GetAngleY(0);
|
||||
|
||||
vehicle = SearchVehicle();
|
||||
if ( vehicle != 0 )
|
||||
|
@ -315,9 +316,9 @@ bool CAutoFactory::EventProcess(const Event &event)
|
|||
fret->SetZoom(0, 1.0f-m_progress);
|
||||
}
|
||||
|
||||
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;
|
||||
|
||||
#if 0
|
||||
pos = m_fretPos;
|
||||
|
@ -329,9 +330,9 @@ bool CAutoFactory::EventProcess(const Event &event)
|
|||
speed.y = Math::Rand()*12.0f;
|
||||
dim.x = Math::Rand()*12.0f+10.0f;
|
||||
dim.y = dim.x;
|
||||
m_particule->CreateParticule(pos, speed, dim, PARTIBLUE, 1.0f, 0.0f, 0.0f);
|
||||
m_particle->CreateParticle(pos, speed, dim, PARTIBLUE, 1.0f, 0.0f, 0.0f);
|
||||
#else
|
||||
mat = m_object->RetWorldMatrix(0);
|
||||
mat = m_object->GetWorldMatrix(0);
|
||||
pos = Math::Vector(-12.0f, 20.0f, -4.0f); // position of chimney
|
||||
pos = Math::Transform(*mat, pos);
|
||||
pos.y += 2.0f;
|
||||
|
@ -342,7 +343,7 @@ bool CAutoFactory::EventProcess(const Event &event)
|
|||
speed.y = 6.0f+Math::Rand()*6.0f;
|
||||
dim.x = Math::Rand()*1.5f+1.0f;
|
||||
dim.y = dim.x;
|
||||
m_particule->CreateParticule(pos, speed, dim, PARTISMOKE3, 4.0f);
|
||||
m_particle->CreateParticle(pos, speed, dim, Gfx::PARTISMOKE3, 4.0f);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
@ -361,15 +362,15 @@ bool CAutoFactory::EventProcess(const Event &event)
|
|||
vehicle = SearchVehicle();
|
||||
if ( vehicle != 0 )
|
||||
{
|
||||
physics = vehicle->RetPhysics();
|
||||
physics = vehicle->GetPhysics();
|
||||
if ( physics != 0 )
|
||||
{
|
||||
physics->SetFreeze(false); // can move
|
||||
}
|
||||
|
||||
vehicle->SetLock(false); // vehicle useable
|
||||
//? vehicle->RetPhysics()->RetBrain()->StartTaskAdvance(16.0f);
|
||||
vehicle->SetAngleY(0, m_object->RetAngleY(0)+Math::PI);
|
||||
//? vehicle->GetPhysics()->GetBrain()->StartTaskAdvance(16.0f);
|
||||
vehicle->SetAngleY(0, m_object->GetAngleY(0)+Math::PI);
|
||||
vehicle->SetZoom(0, 1.0f);
|
||||
}
|
||||
|
||||
|
@ -392,9 +393,9 @@ bool CAutoFactory::EventProcess(const Event &event)
|
|||
m_object->SetAngleZ(10+i, -angle);
|
||||
}
|
||||
|
||||
if ( m_lastParticule+m_engine->ParticuleAdapt(0.1f) <= m_time )
|
||||
if ( m_lastParticle+m_engine->ParticleAdapt(0.1f) <= m_time )
|
||||
{
|
||||
m_lastParticule = m_time;
|
||||
m_lastParticle = m_time;
|
||||
|
||||
pos = m_fretPos;
|
||||
pos.x += (Math::Rand()-0.5f)*10.0f;
|
||||
|
@ -403,7 +404,7 @@ bool CAutoFactory::EventProcess(const Event &event)
|
|||
speed = Math::Vector(0.0f, 0.0f, 0.0f);
|
||||
dim.x = 2.0f;
|
||||
dim.y = dim.x;
|
||||
m_particule->CreateParticule(pos, speed, dim, PARTIGLINT, 2.0f, 0.0f, 0.0f);
|
||||
m_particle->CreateParticle(pos, speed, dim, Gfx::PARTIGLINT, 2.0f, 0.0f, 0.0f);
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -435,9 +436,9 @@ bool CAutoFactory::EventProcess(const Event &event)
|
|||
m_object->SetZoomZ(10+i, zoom);
|
||||
}
|
||||
|
||||
if ( m_lastParticule+m_engine->ParticuleAdapt(0.1f) <= m_time )
|
||||
if ( m_lastParticle+m_engine->ParticleAdapt(0.1f) <= m_time )
|
||||
{
|
||||
m_lastParticule = m_time;
|
||||
m_lastParticle = m_time;
|
||||
|
||||
pos = m_fretPos;
|
||||
pos.x += (Math::Rand()-0.5f)*10.0f;
|
||||
|
@ -446,7 +447,7 @@ bool CAutoFactory::EventProcess(const Event &event)
|
|||
speed = Math::Vector(0.0f, 0.0f, 0.0f);
|
||||
dim.x = 2.0f;
|
||||
dim.y = dim.x;
|
||||
m_particule->CreateParticule(pos, speed, dim, PARTIGLINT, 2.0f, 0.0f, 0.0f);
|
||||
m_particle->CreateParticle(pos, speed, dim, Gfx::PARTIGLINT, 2.0f, 0.0f, 0.0f);
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -503,12 +504,12 @@ bool CAutoFactory::Read(char *line)
|
|||
|
||||
CAuto::Read(line);
|
||||
|
||||
m_phase = (AutoFactoryPhase)OpInt(line, "aPhase", AFP_WAIT);
|
||||
m_phase = static_cast< AutoFactoryPhase >(OpInt(line, "aPhase", AFP_WAIT));
|
||||
m_progress = OpFloat(line, "aProgress", 0.0f);
|
||||
m_speed = OpFloat(line, "aSpeed", 1.0f);
|
||||
|
||||
m_lastParticule = 0.0f;
|
||||
m_fretPos = m_object->RetPosition(0);
|
||||
m_lastParticle = 0.0f;
|
||||
m_fretPos = m_object->GetPosition(0);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -526,14 +527,14 @@ CObject* CAutoFactory::SearchFret()
|
|||
|
||||
for ( i=0 ; i<1000000 ; i++ )
|
||||
{
|
||||
pObj = (CObject*)m_iMan->SearchInstance(CLASS_OBJECT, i);
|
||||
pObj = static_cast< CObject* >(m_iMan->SearchInstance(CLASS_OBJECT, i));
|
||||
if ( pObj == 0 ) break;
|
||||
|
||||
type = pObj->RetType();
|
||||
type = pObj->GetType();
|
||||
if ( type != OBJECT_METAL ) continue;
|
||||
if ( pObj->RetTruck() != 0 ) continue;
|
||||
if ( pObj->GetTruck() != 0 ) continue;
|
||||
|
||||
oPos = pObj->RetPosition(0);
|
||||
oPos = pObj->GetPosition(0);
|
||||
dist = Math::Distance(oPos, m_fretPos);
|
||||
|
||||
if ( dist < 8.0f ) return pObj;
|
||||
|
@ -552,14 +553,14 @@ bool CAutoFactory::NearestVehicle()
|
|||
float oRadius, dist;
|
||||
int i;
|
||||
|
||||
cPos = m_object->RetPosition(0);
|
||||
cPos = m_object->GetPosition(0);
|
||||
|
||||
for ( i=0 ; i<1000000 ; i++ )
|
||||
{
|
||||
pObj = (CObject*)m_iMan->SearchInstance(CLASS_OBJECT, i);
|
||||
pObj = static_cast< CObject* >(m_iMan->SearchInstance(CLASS_OBJECT, i));
|
||||
if ( pObj == 0 ) break;
|
||||
|
||||
type = pObj->RetType();
|
||||
type = pObj->GetType();
|
||||
if ( type != OBJECT_HUMAN &&
|
||||
type != OBJECT_MOBILEfa &&
|
||||
type != OBJECT_MOBILEta &&
|
||||
|
@ -616,9 +617,9 @@ bool CAutoFactory::CreateVehicle()
|
|||
char* name;
|
||||
int i;
|
||||
|
||||
angle = m_object->RetAngleY(0);
|
||||
angle = m_object->GetAngleY(0);
|
||||
|
||||
mat = m_object->RetWorldMatrix(0);
|
||||
mat = m_object->GetWorldMatrix(0);
|
||||
if ( m_type == OBJECT_MOBILErt ||
|
||||
m_type == OBJECT_MOBILErc ||
|
||||
m_type == OBJECT_MOBILErr ||
|
||||
|
@ -643,7 +644,7 @@ bool CAutoFactory::CreateVehicle()
|
|||
vehicle->SetLock(true); // not usable
|
||||
vehicle->SetRange(30.0f);
|
||||
|
||||
physics = vehicle->RetPhysics();
|
||||
physics = vehicle->GetPhysics();
|
||||
if ( physics != 0 )
|
||||
{
|
||||
physics->SetFreeze(true); // it doesn't move
|
||||
|
@ -651,7 +652,7 @@ bool CAutoFactory::CreateVehicle()
|
|||
|
||||
for ( i=0 ; i<10 ; i++ )
|
||||
{
|
||||
name = m_main->RetNewScriptName(m_type, i);
|
||||
name = m_main->GetNewScriptName(m_type, i);
|
||||
if ( name == 0 ) break;
|
||||
vehicle->ReadProgram(i, name);
|
||||
}
|
||||
|
@ -671,16 +672,16 @@ CObject* CAutoFactory::SearchVehicle()
|
|||
|
||||
for ( i=0 ; i<1000000 ; i++ )
|
||||
{
|
||||
pObj = (CObject*)m_iMan->SearchInstance(CLASS_OBJECT, i);
|
||||
pObj = static_cast< CObject* >(m_iMan->SearchInstance(CLASS_OBJECT, i));
|
||||
if ( pObj == 0 ) break;
|
||||
|
||||
if ( !pObj->RetLock() ) continue;
|
||||
if ( !pObj->GetLock() ) continue;
|
||||
|
||||
type = pObj->RetType();
|
||||
type = pObj->GetType();
|
||||
if ( type != m_type ) continue;
|
||||
if ( pObj->RetTruck() != 0 ) continue;
|
||||
if ( pObj->GetTruck() != 0 ) continue;
|
||||
|
||||
oPos = pObj->RetPosition(0);
|
||||
oPos = pObj->GetPosition(0);
|
||||
dist = Math::Distance(oPos, m_fretPos);
|
||||
|
||||
if ( dist < 8.0f ) return pObj;
|
||||
|
@ -694,7 +695,7 @@ CObject* CAutoFactory::SearchVehicle()
|
|||
|
||||
bool CAutoFactory::CreateInterface(bool bSelect)
|
||||
{
|
||||
CWindow* pw;
|
||||
Ui::CWindow* pw;
|
||||
Math::Point pos, dim, ddim;
|
||||
float ox, oy, sx, sy;
|
||||
|
||||
|
@ -702,8 +703,8 @@ bool CAutoFactory::CreateInterface(bool bSelect)
|
|||
|
||||
if ( !bSelect ) return true;
|
||||
|
||||
pw = (CWindow*)m_interface->SearchControl(EVENT_WINDOW0);
|
||||
if ( pw == 0 ) return false;
|
||||
pw = static_cast< Ui::CWindow* >(m_interface->SearchControl(EVENT_WINDOW0));
|
||||
if ( pw == nullptr ) return false;
|
||||
|
||||
dim.x = 33.0f/640.0f;
|
||||
dim.y = 33.0f/480.0f;
|
||||
|
@ -786,13 +787,13 @@ bool CAutoFactory::CreateInterface(bool bSelect)
|
|||
|
||||
void CAutoFactory::UpdateInterface()
|
||||
{
|
||||
CWindow* pw;
|
||||
Ui::CWindow* pw;
|
||||
|
||||
if ( !m_object->RetSelect() ) return;
|
||||
if ( !m_object->GetSelect() ) return;
|
||||
|
||||
CAuto::UpdateInterface();
|
||||
|
||||
pw = (CWindow*)m_interface->SearchControl(EVENT_WINDOW0);
|
||||
pw = static_cast< Ui::CWindow* >(m_interface->SearchControl(EVENT_WINDOW0));
|
||||
|
||||
UpdateButton(pw, EVENT_OBJECT_FACTORYwa, m_bBusy);
|
||||
UpdateButton(pw, EVENT_OBJECT_FACTORYta, m_bBusy);
|
||||
|
@ -819,7 +820,7 @@ void CAutoFactory::UpdateInterface()
|
|||
|
||||
// Updates the status of one interface button.
|
||||
|
||||
void CAutoFactory::UpdateButton(CWindow *pw, EventMsg event, bool bBusy)
|
||||
void CAutoFactory::UpdateButton(Ui::CWindow *pw, EventType event, bool bBusy)
|
||||
{
|
||||
bool bEnable = true;
|
||||
|
||||
|
@ -933,7 +934,7 @@ void CAutoFactory::SoundManip(float time, float amplitude, float frequency)
|
|||
{
|
||||
int i;
|
||||
|
||||
i = m_sound->Play(SOUND_MANIP, m_object->RetPosition(0), 0.0f, 0.3f*frequency, true);
|
||||
i = m_sound->Play(SOUND_MANIP, m_object->GetPosition(0), 0.0f, 0.3f*frequency, true);
|
||||
m_sound->AddEnvelope(i, 0.5f*amplitude, 1.0f*frequency, 0.1f, SOPER_CONTINUE);
|
||||
m_sound->AddEnvelope(i, 0.5f*amplitude, 1.0f*frequency, time-0.1f, SOPER_CONTINUE);
|
||||
m_sound->AddEnvelope(i, 0.0f, 0.3f*frequency, 0.1f, SOPER_STOP);
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
// * This file is part of the COLOBOT source code
|
||||
// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch
|
||||
// * Copyright (C) 2012 Polish Portal of Colobot (PPC)
|
||||
// *
|
||||
// * This program is free software: you can redistribute it and/or modify
|
||||
// * it under the terms of the GNU General Public License as published by
|
||||
|
@ -54,7 +55,7 @@ public:
|
|||
|
||||
protected:
|
||||
void UpdateInterface();
|
||||
void UpdateButton(CWindow *pw, EventMsg event, bool bBusy);
|
||||
void UpdateButton(Ui::CWindow *pw, EventType event, bool bBusy);
|
||||
|
||||
CObject* SearchFret();
|
||||
bool NearestVehicle();
|
||||
|
@ -67,7 +68,7 @@ protected:
|
|||
AutoFactoryPhase m_phase;
|
||||
float m_progress;
|
||||
float m_speed;
|
||||
float m_lastParticule;
|
||||
float m_lastParticle;
|
||||
Math::Vector m_fretPos;
|
||||
int m_channelSound;
|
||||
};
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
// * This file is part of the COLOBOT source code
|
||||
// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch
|
||||
// * Copyright (C) 2012 Polish Portal of Colobot (PPC)
|
||||
// *
|
||||
// * This program is free software: you can redistribute it and/or modify
|
||||
// * it under the terms of the GNU General Public License as published by
|
||||
|
@ -20,7 +21,7 @@
|
|||
#include "object/auto/autoflag.h"
|
||||
|
||||
#include "math/geometry.h"
|
||||
#include "old/terrain.h"
|
||||
#include "graphics/engine/terrain.h"
|
||||
|
||||
|
||||
|
||||
|
@ -68,7 +69,7 @@ void CAutoFlag::Init()
|
|||
m_param = 0;
|
||||
m_progress = 0.0f;
|
||||
|
||||
wind = m_terrain->RetWind();
|
||||
wind = m_terrain->GetWind();
|
||||
angle = Math::RotateAngle(wind.x, -wind.z);
|
||||
m_object->SetAngleY(0, angle); // directs the flag in the wind
|
||||
|
||||
|
@ -98,7 +99,7 @@ bool CAutoFlag::EventProcess(const Event &event)
|
|||
CAuto::EventProcess(event);
|
||||
|
||||
#if ADJUST_ANGLE
|
||||
if ( event.event == EVENT_KEYDOWN )
|
||||
if ( event.type == EVENT_KEYDOWN )
|
||||
{
|
||||
if ( event.param == 'E' ) g_flag1 += 0.1f;
|
||||
if ( event.param == 'D' ) g_flag1 -= 0.1f;
|
||||
|
@ -109,8 +110,8 @@ bool CAutoFlag::EventProcess(const Event &event)
|
|||
}
|
||||
#endif
|
||||
|
||||
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_param == 1 ) // shakes?
|
||||
{
|
||||
|
@ -152,9 +153,9 @@ bool CAutoFlag::EventProcess(const Event &event)
|
|||
}
|
||||
|
||||
|
||||
// Returns an error due the state of the automation
|
||||
// Geturns an error due the state of the automation
|
||||
|
||||
Error CAutoFlag::RetError()
|
||||
Error CAutoFlag::GetError()
|
||||
{
|
||||
return ERR_OK;
|
||||
}
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
// * This file is part of the COLOBOT source code
|
||||
// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch
|
||||
// * Copyright (C) 2012 Polish Portal of Colobot (PPC)
|
||||
// *
|
||||
// * This program is free software: you can redistribute it and/or modify
|
||||
// * it under the terms of the GNU General Public License as published by
|
||||
|
@ -34,7 +35,7 @@ public:
|
|||
void Init();
|
||||
void Start(int param);
|
||||
bool EventProcess(const Event &event);
|
||||
Error RetError();
|
||||
Error GetError();
|
||||
|
||||
protected:
|
||||
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
// * This file is part of the COLOBOT source code
|
||||
// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch
|
||||
// * Copyright (C) 2012 Polish Portal of Colobot (PPC)
|
||||
// *
|
||||
// * This program is free software: you can redistribute it and/or modify
|
||||
// * it under the terms of the GNU General Public License as published by
|
||||
|
@ -38,11 +39,11 @@ CAutoHuston::CAutoHuston(CInstanceManager* iMan, CObject* object)
|
|||
m_lens[i].parti = -1;
|
||||
}
|
||||
|
||||
pos = m_object->RetPosition(0);
|
||||
m_lens[0].type = PARTISELR;
|
||||
m_lens[1].type = PARTISELR;
|
||||
m_lens[2].type = PARTISELR;
|
||||
m_lens[3].type = PARTISELR;
|
||||
pos = m_object->GetPosition(0);
|
||||
m_lens[0].type = Gfx::PARTISELR;
|
||||
m_lens[1].type = Gfx::PARTISELR;
|
||||
m_lens[2].type = Gfx::PARTISELR;
|
||||
m_lens[3].type = Gfx::PARTISELR;
|
||||
m_lens[0].pos = pos+Math::Vector(0.0f+13.0f, 34.0f, 30.0f );
|
||||
m_lens[1].pos = pos+Math::Vector(0.0f-13.0f, 34.0f, 30.0f );
|
||||
m_lens[2].pos = pos+Math::Vector(0.0f , 34.0f, 30.0f+13.0f);
|
||||
|
@ -62,46 +63,46 @@ CAutoHuston::CAutoHuston(CInstanceManager* iMan, CObject* object)
|
|||
|
||||
// Part under the radar.
|
||||
i = 4;
|
||||
m_lens[i].type = PARTISELR;
|
||||
m_lens[i].type = Gfx::PARTISELR;
|
||||
m_lens[i].pos = pos+Math::Vector(-7.0f, 9.9f, 40.1f);
|
||||
m_lens[i].dim = 1.8f;
|
||||
m_lens[i].total = 0.4f;
|
||||
m_lens[i].off = 0.2f;
|
||||
i ++;
|
||||
|
||||
m_lens[i].type = PARTISELY;
|
||||
m_lens[i].type = Gfx::PARTISELY;
|
||||
m_lens[i].pos = pos+Math::Vector(-7.0f, 7.2f, 34.8f);
|
||||
m_lens[i].dim = 0.4f;
|
||||
m_lens[i].total = 0.7f;
|
||||
m_lens[i].off = 0.3f;
|
||||
i ++;
|
||||
m_lens[i].type = PARTISELY;
|
||||
m_lens[i].type = Gfx::PARTISELY;
|
||||
m_lens[i].pos = pos+Math::Vector(-7.0f, 6.5f, 34.3f);
|
||||
m_lens[i].dim = 0.4f;
|
||||
m_lens[i].total = 0.7f;
|
||||
m_lens[i].off = 0.3f;
|
||||
i ++;
|
||||
m_lens[i].type = PARTISELR;
|
||||
m_lens[i].type = Gfx::PARTISELR;
|
||||
m_lens[i].pos = pos+Math::Vector(-7.0f, 6.5f, 33.4f);
|
||||
m_lens[i].dim = 0.4f;
|
||||
m_lens[i].total = 0.0f;
|
||||
m_lens[i].off = 0.0f;
|
||||
i ++;
|
||||
m_lens[i].type = PARTISELR;
|
||||
m_lens[i].type = Gfx::PARTISELR;
|
||||
m_lens[i].pos = pos+Math::Vector(-7.0f, 6.5f, 33.0f);
|
||||
m_lens[i].dim = 0.4f;
|
||||
m_lens[i].total = 1.0f;
|
||||
m_lens[i].off = 0.5f;
|
||||
i ++;
|
||||
|
||||
m_lens[i].type = PARTISELY;
|
||||
m_lens[i].type = Gfx::PARTISELY;
|
||||
m_lens[i].pos = pos+Math::Vector(-7.0f, 8.5f, 14.0f);
|
||||
m_lens[i].dim = 1.2f;
|
||||
m_lens[i].total = 0.8f;
|
||||
m_lens[i].off = 0.2f;
|
||||
i ++;
|
||||
|
||||
m_lens[i].type = PARTISELR;
|
||||
m_lens[i].type = Gfx::PARTISELR;
|
||||
m_lens[i].pos = pos+Math::Vector(4.0f, 6.0f, 8.6f);
|
||||
m_lens[i].dim = 1.0f;
|
||||
m_lens[i].total = 0.9f;
|
||||
|
@ -109,53 +110,53 @@ CAutoHuston::CAutoHuston(CInstanceManager* iMan, CObject* object)
|
|||
i ++;
|
||||
|
||||
// Part with three windows.
|
||||
m_lens[i].type = PARTISELR;
|
||||
m_lens[i].type = Gfx::PARTISELR;
|
||||
m_lens[i].pos = pos+Math::Vector(-7.0f, 9.9f, -19.9f);
|
||||
m_lens[i].dim = 1.0f;
|
||||
m_lens[i].total = 0.6f;
|
||||
m_lens[i].off = 0.3f;
|
||||
i ++;
|
||||
|
||||
m_lens[i].type = PARTISELY;
|
||||
m_lens[i].type = Gfx::PARTISELY;
|
||||
m_lens[i].pos = pos+Math::Vector(-7.0f, 7.2f, 34.8f-60.0f);
|
||||
m_lens[i].dim = 0.4f;
|
||||
m_lens[i].total = 0.7f;
|
||||
m_lens[i].off = 0.3f;
|
||||
i ++;
|
||||
m_lens[i].type = PARTISELY;
|
||||
m_lens[i].type = Gfx::PARTISELY;
|
||||
m_lens[i].pos = pos+Math::Vector(-7.0f, 6.5f, 34.3f-60.0f);
|
||||
m_lens[i].dim = 0.4f;
|
||||
m_lens[i].total = 0.0f;
|
||||
m_lens[i].off = 0.0f;
|
||||
i ++;
|
||||
m_lens[i].type = PARTISELR;
|
||||
m_lens[i].type = Gfx::PARTISELR;
|
||||
m_lens[i].pos = pos+Math::Vector(-7.0f, 6.5f, 33.4f-60.0f);
|
||||
m_lens[i].dim = 0.4f;
|
||||
m_lens[i].total = 0.6f;
|
||||
m_lens[i].off = 0.4f;
|
||||
i ++;
|
||||
m_lens[i].type = PARTISELR;
|
||||
m_lens[i].type = Gfx::PARTISELR;
|
||||
m_lens[i].pos = pos+Math::Vector(-7.0f, 6.5f, 33.0f-60.0f);
|
||||
m_lens[i].dim = 0.4f;
|
||||
m_lens[i].total = 0.8f;
|
||||
m_lens[i].off = 0.2f;
|
||||
i ++;
|
||||
|
||||
m_lens[i].type = PARTISELY;
|
||||
m_lens[i].type = Gfx::PARTISELY;
|
||||
m_lens[i].pos = pos+Math::Vector(-6.5f, 13.5f, -37.0f);
|
||||
m_lens[i].dim = 1.0f;
|
||||
m_lens[i].total = 0.0f;
|
||||
m_lens[i].off = 0.0f;
|
||||
i ++;
|
||||
|
||||
m_lens[i].type = PARTISELY;
|
||||
m_lens[i].type = Gfx::PARTISELY;
|
||||
m_lens[i].pos = pos+Math::Vector(-7.0f, 12.2f, -39.8f);
|
||||
m_lens[i].dim = 1.8f;
|
||||
m_lens[i].total = 1.5f;
|
||||
m_lens[i].off = 0.5f;
|
||||
i ++;
|
||||
|
||||
m_lens[i].type = PARTISELY;
|
||||
m_lens[i].type = Gfx::PARTISELY;
|
||||
m_lens[i].pos = pos+Math::Vector(-7.0f, 8.5f, -47.0f);
|
||||
m_lens[i].dim = 0.6f;
|
||||
m_lens[i].total = 0.7f;
|
||||
|
@ -211,14 +212,14 @@ bool CAutoHuston::EventProcess(const Event &event)
|
|||
|
||||
CAuto::EventProcess(event);
|
||||
|
||||
if ( m_engine->RetPause() ) return true;
|
||||
if ( m_engine->GetPause() ) return true;
|
||||
|
||||
angle = -m_time*1.0f;
|
||||
m_object->SetAngleY(1, angle); // rotates the radar
|
||||
angle = sinf(m_time*4.0f)*0.3f;
|
||||
m_object->SetAngleX(2, angle);
|
||||
|
||||
if ( event.event != EVENT_FRAME ) return true;
|
||||
if ( event.type != EVENT_FRAME ) return true;
|
||||
|
||||
m_progress += event.rTime*m_speed;
|
||||
|
||||
|
@ -231,7 +232,7 @@ bool CAutoHuston::EventProcess(const Event &event)
|
|||
{
|
||||
if ( m_lens[i].parti != -1 )
|
||||
{
|
||||
m_particule->DeleteParticule(m_lens[i].parti);
|
||||
m_particle->DeleteParticle(m_lens[i].parti);
|
||||
m_lens[i].parti = -1;
|
||||
}
|
||||
}
|
||||
|
@ -241,7 +242,7 @@ bool CAutoHuston::EventProcess(const Event &event)
|
|||
{
|
||||
dim.x = m_lens[i].dim;
|
||||
dim.y = dim.x;
|
||||
m_lens[i].parti = m_particule->CreateParticule(m_lens[i].pos, speed, dim, m_lens[i].type, 1.0f, 0.0f, 0.0f);
|
||||
m_lens[i].parti = m_particle->CreateParticle(m_lens[i].pos, speed, dim, m_lens[i].type, 1.0f, 0.0f, 0.0f);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -261,7 +262,7 @@ bool CAutoHuston::Abort()
|
|||
|
||||
bool CAutoHuston::CreateInterface(bool bSelect)
|
||||
{
|
||||
CWindow* pw;
|
||||
Ui::CWindow* pw;
|
||||
Math::Point pos, ddim;
|
||||
float ox, oy, sx, sy;
|
||||
|
||||
|
@ -269,8 +270,8 @@ bool CAutoHuston::CreateInterface(bool bSelect)
|
|||
|
||||
if ( !bSelect ) return true;
|
||||
|
||||
pw = (CWindow*)m_interface->SearchControl(EVENT_WINDOW0);
|
||||
if ( pw == 0 ) return false;
|
||||
pw = static_cast< Ui::CWindow* >(m_interface->SearchControl(EVENT_WINDOW0));
|
||||
if ( pw == nullptr ) return false;
|
||||
|
||||
ox = 3.0f/640.0f;
|
||||
oy = 3.0f/480.0f;
|
||||
|
@ -287,9 +288,9 @@ bool CAutoHuston::CreateInterface(bool bSelect)
|
|||
}
|
||||
|
||||
|
||||
// Returns an error due to state of the automation.
|
||||
// Geturns an error due to state of the automation.
|
||||
|
||||
Error CAutoHuston::RetError()
|
||||
Error CAutoHuston::GetError()
|
||||
{
|
||||
return ERR_OK;
|
||||
}
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
// * This file is part of the COLOBOT source code
|
||||
// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch
|
||||
// * Copyright (C) 2012 Polish Portal of Colobot (PPC)
|
||||
// *
|
||||
// * This program is free software: you can redistribute it and/or modify
|
||||
// * it under the terms of the GNU General Public License as published by
|
||||
|
@ -20,18 +21,18 @@
|
|||
|
||||
|
||||
#include "object/auto/auto.h"
|
||||
#include "old/particule.h"
|
||||
#include "graphics/engine/particle.h"
|
||||
|
||||
|
||||
|
||||
struct HustonLens
|
||||
{
|
||||
int parti;
|
||||
ParticuleType type;
|
||||
int parti;
|
||||
Gfx::ParticleType type;
|
||||
Math::Vector pos;
|
||||
float dim;
|
||||
float total;
|
||||
float off;
|
||||
float dim;
|
||||
float total;
|
||||
float off;
|
||||
};
|
||||
|
||||
|
||||
|
@ -50,7 +51,7 @@ public:
|
|||
void Start(int param);
|
||||
bool EventProcess(const Event &event);
|
||||
bool Abort();
|
||||
Error RetError();
|
||||
Error GetError();
|
||||
|
||||
bool CreateInterface(bool bSelect);
|
||||
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
// * This file is part of the COLOBOT source code
|
||||
// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch
|
||||
// * Copyright (C) 2012 Polish Portal of Colobot (PPC)
|
||||
// *
|
||||
// * This program is free software: you can redistribute it and/or modify
|
||||
// * it under the terms of the GNU General Public License as published by
|
||||
|
@ -90,8 +91,8 @@ void CAutoInfo::Start(int param)
|
|||
m_speed = 1.0f/2.0f;
|
||||
}
|
||||
|
||||
m_lastParticule = 0;
|
||||
m_goal = m_object->RetPosition(0);
|
||||
m_lastParticle = 0;
|
||||
m_goal = m_object->GetPosition(0);
|
||||
|
||||
if ( m_phase == AIP_EMETTE )
|
||||
{
|
||||
|
@ -100,7 +101,7 @@ void CAutoInfo::Start(int param)
|
|||
speed = Math::Vector(0.0f, 0.0f, 0.0f);
|
||||
dim.x = 30.0f;
|
||||
dim.y = dim.x;
|
||||
m_particule->CreateParticule(pos, speed, dim, PARTISPHERE4, 1.5f, 0.0f, 0.0f);
|
||||
m_particle->CreateParticle(pos, speed, dim, Gfx::PARTISPHERE4, 1.5f, 0.0f, 0.0f);
|
||||
|
||||
m_sound->Play(SOUND_LABO, pos, 1.0f, 2.0f);
|
||||
}
|
||||
|
@ -111,7 +112,7 @@ void CAutoInfo::Start(int param)
|
|||
speed = Math::Vector(0.0f, 0.0f, 0.0f);
|
||||
dim.x = 50.0f;
|
||||
dim.y = dim.x;
|
||||
m_particule->CreateParticule(pos, speed, dim, PARTISPHERE6, 1.5f, 0.0f, 0.0f);
|
||||
m_particle->CreateParticle(pos, speed, dim, Gfx::PARTISPHERE6, 1.5f, 0.0f, 0.0f);
|
||||
|
||||
m_sound->Play(SOUND_LABO, pos, 1.0f, 2.0f);
|
||||
}
|
||||
|
@ -133,18 +134,18 @@ bool CAutoInfo::EventProcess(const Event &event)
|
|||
|
||||
CAuto::EventProcess(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_timeVirus -= event.rTime;
|
||||
|
||||
if ( m_object->RetVirusMode() ) // contaminated by a virus?
|
||||
if ( m_object->GetVirusMode() ) // contaminated by a virus?
|
||||
{
|
||||
if ( m_timeVirus <= 0.0f )
|
||||
{
|
||||
m_timeVirus = 0.1f+Math::Rand()*0.3f;
|
||||
|
||||
angle = m_object->RetAngleY(1);
|
||||
angle = m_object->GetAngleY(1);
|
||||
angle += Math::Rand()*0.3f;
|
||||
m_object->SetAngleY(1, angle);
|
||||
|
||||
|
@ -170,7 +171,7 @@ bool CAutoInfo::EventProcess(const Event &event)
|
|||
}
|
||||
else
|
||||
{
|
||||
if ( m_object->RetInfoUpdate() )
|
||||
if ( m_object->GetInfoUpdate() )
|
||||
{
|
||||
UpdateList(); // updates the list
|
||||
}
|
||||
|
@ -184,9 +185,9 @@ bool CAutoInfo::EventProcess(const Event &event)
|
|||
if ( m_phase == AIP_EMETTE ) // instruction "receive" ?
|
||||
{
|
||||
if ( m_progress < 0.5f &&
|
||||
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;
|
||||
|
||||
for ( i=0 ; i<4 ; i++ )
|
||||
{
|
||||
|
@ -199,7 +200,7 @@ bool CAutoInfo::EventProcess(const Event &event)
|
|||
dim.x = 0.6f;
|
||||
dim.y = dim.x;
|
||||
duration = Math::Rand()*0.5f+0.5f;
|
||||
m_particule->CreateTrack(pos, speed, dim, PARTITRACK6,
|
||||
m_particle->CreateTrack(pos, speed, dim, Gfx::PARTITRACK6,
|
||||
duration, 0.0f,
|
||||
duration*0.9f, 0.7f);
|
||||
}
|
||||
|
@ -230,9 +231,9 @@ bool CAutoInfo::EventProcess(const Event &event)
|
|||
if ( m_phase == AIP_RECEIVE ) // instruction "send" ?
|
||||
{
|
||||
if ( m_progress < 0.5f &&
|
||||
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;
|
||||
|
||||
for ( i=0 ; i<4 ; i++ )
|
||||
{
|
||||
|
@ -247,7 +248,7 @@ bool CAutoInfo::EventProcess(const Event &event)
|
|||
dim.x = 0.6f;
|
||||
dim.y = dim.x;
|
||||
duration = Math::Rand()*0.5f+0.5f;
|
||||
m_particule->CreateTrack(pos, speed, dim, PARTITRACK6,
|
||||
m_particle->CreateTrack(pos, speed, dim, Gfx::PARTITRACK6,
|
||||
duration, 0.0f,
|
||||
duration*0.9f, 0.7f);
|
||||
}
|
||||
|
@ -278,9 +279,9 @@ bool CAutoInfo::EventProcess(const Event &event)
|
|||
if ( m_phase == AIP_ERROR )
|
||||
{
|
||||
if ( m_progress < 0.5f &&
|
||||
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;
|
||||
|
||||
pos = m_goal;
|
||||
speed.x = (Math::Rand()-0.5f)*5.0f;
|
||||
|
@ -289,7 +290,7 @@ bool CAutoInfo::EventProcess(const Event &event)
|
|||
dim.x = 5.0f+Math::Rand()*5.0f;
|
||||
dim.y = dim.x;
|
||||
duration = Math::Rand()*0.5f+0.5f;
|
||||
m_particule->CreateParticule(pos, speed, dim, PARTISMOKE1, 4.0f);
|
||||
m_particle->CreateParticle(pos, speed, dim, Gfx::PARTISMOKE1, 4.0f);
|
||||
}
|
||||
|
||||
if ( m_progress < 1.0f )
|
||||
|
@ -327,7 +328,7 @@ bool CAutoInfo::EventProcess(const Event &event)
|
|||
}
|
||||
}
|
||||
|
||||
angle = m_object->RetAngleY(1);
|
||||
angle = m_object->GetAngleY(1);
|
||||
angle += rTime*0.5f;
|
||||
m_object->SetAngleY(1, angle);
|
||||
|
||||
|
@ -339,11 +340,11 @@ bool CAutoInfo::EventProcess(const Event &event)
|
|||
}
|
||||
|
||||
|
||||
// Returns an error due the state of the automation.
|
||||
// Geturns an error due the state of the automation.
|
||||
|
||||
Error CAutoInfo::RetError()
|
||||
Error CAutoInfo::GetError()
|
||||
{
|
||||
if ( m_object->RetVirusMode() )
|
||||
if ( m_object->GetVirusMode() )
|
||||
{
|
||||
return ERR_BAT_VIRUS;
|
||||
}
|
||||
|
@ -356,8 +357,8 @@ Error CAutoInfo::RetError()
|
|||
|
||||
bool CAutoInfo::CreateInterface(bool bSelect)
|
||||
{
|
||||
CWindow* pw;
|
||||
CList* pl;
|
||||
Ui::CWindow* pw;
|
||||
Ui::CList* pl;
|
||||
Math::Point pos, ddim;
|
||||
float ox, oy, sx, sy;
|
||||
|
||||
|
@ -365,7 +366,7 @@ bool CAutoInfo::CreateInterface(bool bSelect)
|
|||
|
||||
if ( !bSelect ) return true;
|
||||
|
||||
pw = (CWindow*)m_interface->SearchControl(EVENT_WINDOW0);
|
||||
pw = static_cast< Ui::CWindow* >(m_interface->SearchControl(EVENT_WINDOW0));
|
||||
if ( pw == 0 ) return false;
|
||||
|
||||
ox = 3.0f/640.0f;
|
||||
|
@ -403,31 +404,31 @@ void CAutoInfo::UpdateInterface(float rTime)
|
|||
|
||||
void CAutoInfo::UpdateList()
|
||||
{
|
||||
CWindow* pw;
|
||||
CList* pl;
|
||||
Ui::CWindow* pw;
|
||||
Ui::CList* pl;
|
||||
Info info;
|
||||
int total, i;
|
||||
char text[100];
|
||||
|
||||
pw = (CWindow*)m_interface->SearchControl(EVENT_WINDOW0);
|
||||
if ( pw == 0 ) return;
|
||||
pw = static_cast< Ui::CWindow* >(m_interface->SearchControl(EVENT_WINDOW0));
|
||||
if ( pw == nullptr ) return;
|
||||
|
||||
pl = (CList*)pw->SearchControl(EVENT_OBJECT_GINFO);
|
||||
if ( pl == 0 ) return;
|
||||
pl = static_cast< Ui::CList* >(pw->SearchControl(EVENT_OBJECT_GINFO));
|
||||
if ( pl == nullptr ) return;
|
||||
|
||||
pl->Flush();
|
||||
total = m_object->RetInfoTotal();
|
||||
total = m_object->GetInfoTotal();
|
||||
if ( total == 0 )
|
||||
{
|
||||
pl->ClearState(STATE_ENABLE);
|
||||
pl->ClearState(Ui::STATE_ENABLE);
|
||||
}
|
||||
else
|
||||
{
|
||||
pl->SetState(STATE_ENABLE);
|
||||
pl->SetState(Ui::STATE_ENABLE);
|
||||
|
||||
for ( i=0 ; i<total ; i++ )
|
||||
{
|
||||
info = m_object->RetInfo(i);
|
||||
info = m_object->GetInfo(i);
|
||||
sprintf(text, "%s = %.2f", info.name, info.value);
|
||||
pl->SetName(i, text);
|
||||
}
|
||||
|
@ -440,28 +441,28 @@ void CAutoInfo::UpdateList()
|
|||
|
||||
void CAutoInfo::UpdateListVirus()
|
||||
{
|
||||
CWindow* pw;
|
||||
CList* pl;
|
||||
Ui::CWindow* pw;
|
||||
Ui::CList* pl;
|
||||
int i, j, max;
|
||||
char text[100];
|
||||
|
||||
pw = (CWindow*)m_interface->SearchControl(EVENT_WINDOW0);
|
||||
pw = static_cast< Ui::CWindow* >(m_interface->SearchControl(EVENT_WINDOW0));
|
||||
if ( pw == 0 ) return;
|
||||
|
||||
pl = (CList*)pw->SearchControl(EVENT_OBJECT_GINFO);
|
||||
pl = static_cast< Ui::CList* >(pw->SearchControl(EVENT_OBJECT_GINFO));
|
||||
if ( pl == 0 ) return;
|
||||
|
||||
pl->SetState(STATE_ENABLE);
|
||||
pl->SetState(Ui::STATE_ENABLE);
|
||||
|
||||
pl->Flush();
|
||||
for ( i=0 ; i<4 ; i++ )
|
||||
{
|
||||
max = (int)(2.0f+Math::Rand()*10.0f);
|
||||
max = static_cast< int >(2.0f+Math::Rand()*10.0f);
|
||||
for ( j=0 ; j<max ; j++ )
|
||||
{
|
||||
do
|
||||
{
|
||||
text[j] = ' '+(int)(Math::Rand()*94.0f);
|
||||
text[j] = ' '+static_cast< int >(Math::Rand()*94.0f);
|
||||
}
|
||||
while ( text[j] == '\\' );
|
||||
}
|
||||
|
@ -505,11 +506,11 @@ bool CAutoInfo::Read(char *line)
|
|||
|
||||
CAuto::Read(line);
|
||||
|
||||
m_phase = (AutoInfoPhase)OpInt(line, "aPhase", AIP_WAIT);
|
||||
m_phase = static_cast< AutoInfoPhase > (OpInt(line, "aPhase", AIP_WAIT));
|
||||
m_progress = OpFloat(line, "aProgress", 0.0f);
|
||||
m_speed = OpFloat(line, "aSpeed", 1.0f);
|
||||
|
||||
m_lastParticule = 0.0f;
|
||||
m_lastParticle = 0.0f;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
// * This file is part of the COLOBOT source code
|
||||
// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch
|
||||
// * Copyright (C) 2012 Polish Portal of Colobot (PPC)
|
||||
// *
|
||||
// * This program is free software: you can redistribute it and/or modify
|
||||
// * it under the terms of the GNU General Public License as published by
|
||||
|
@ -44,7 +45,7 @@ public:
|
|||
void Init();
|
||||
void Start(int param);
|
||||
bool EventProcess(const Event &event);
|
||||
Error RetError();
|
||||
Error GetError();
|
||||
|
||||
bool CreateInterface(bool bSelect);
|
||||
|
||||
|
@ -61,7 +62,7 @@ protected:
|
|||
float m_progress;
|
||||
float m_speed;
|
||||
float m_timeVirus;
|
||||
float m_lastParticule;
|
||||
float m_lastParticle;
|
||||
Math::Vector m_goal;
|
||||
bool m_bLastVirus;
|
||||
};
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
// * This file is part of the COLOBOT source code
|
||||
// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch
|
||||
// * Copyright (C) 2012 Polish Portal of Colobot (PPC)
|
||||
// *
|
||||
// * This program is free software: you can redistribute it and/or modify
|
||||
// * it under the terms of the GNU General Public License as published by
|
||||
|
@ -71,7 +72,7 @@ void CAutoJostle::Start(int param, float force)
|
|||
m_time = 0.0f;
|
||||
m_error = ERR_CONTINUE;
|
||||
|
||||
type = m_object->RetType();
|
||||
type = m_object->GetType();
|
||||
if ( type >= OBJECT_PLANT5 &&
|
||||
type <= OBJECT_PLANT7 ) // clover?
|
||||
{
|
||||
|
@ -89,8 +90,8 @@ bool CAutoJostle::EventProcess(const Event &event)
|
|||
|
||||
CAuto::EventProcess(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;
|
||||
|
||||
if ( m_progress < 1.0f )
|
||||
{
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
// * This file is part of the COLOBOT source code
|
||||
// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch
|
||||
// * Copyright (C) 2012 Polish Portal of Colobot (PPC)
|
||||
// *
|
||||
// * This program is free software: you can redistribute it and/or modify
|
||||
// * it under the terms of the GNU General Public License as published by
|
||||
|
@ -42,7 +43,7 @@ protected:
|
|||
float m_force;
|
||||
float m_progress;
|
||||
float m_speed;
|
||||
float m_lastParticule;
|
||||
float m_lastParticle;
|
||||
Error m_error;
|
||||
};
|
||||
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
// * This file is part of the COLOBOT source code
|
||||
// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch
|
||||
// * Copyright (C) 2012, Polish Portal of Colobot (PPC)
|
||||
// *
|
||||
// * This program is free software: you can redistribute it and/or modify
|
||||
// * it under the terms of the GNU General Public License as published by
|
||||
|
@ -19,8 +20,8 @@
|
|||
|
||||
#include "object/auto/autokid.h"
|
||||
|
||||
#include "old/particule.h"
|
||||
#include "old/water.h"
|
||||
#include "graphics/engine/particle.h"
|
||||
#include "graphics/engine/water.h"
|
||||
|
||||
|
||||
|
||||
|
@ -62,18 +63,18 @@ void CAutoKid::Init()
|
|||
|
||||
m_speed = 1.0f/1.0f;
|
||||
m_progress = 0.0f;
|
||||
m_lastParticule = 0.0f;
|
||||
m_lastParticle = 0.0f;
|
||||
|
||||
if ( m_type == OBJECT_TEEN36 ) // trunk ?
|
||||
{
|
||||
pos = m_object->RetPosition(0);
|
||||
pos = m_object->GetPosition(0);
|
||||
m_speed = 1.0f/(1.0f+(Math::Mod(pos.x/10.0f-0.5f, 1.0f)*0.2f));
|
||||
m_progress = Math::Mod(pos.x/10.0f, 1.0f);
|
||||
}
|
||||
|
||||
if ( m_type == OBJECT_TEEN37 ) // boat?
|
||||
{
|
||||
pos = m_object->RetPosition(0);
|
||||
pos = m_object->GetPosition(0);
|
||||
m_speed = 1.0f/(1.0f+(Math::Mod(pos.x/10.0f-0.5f, 1.0f)*0.2f))*2.5f;
|
||||
m_progress = Math::Mod(pos.x/10.0f, 1.0f);
|
||||
}
|
||||
|
@ -82,7 +83,7 @@ void CAutoKid::Init()
|
|||
{
|
||||
if ( m_soundChannel == -1 )
|
||||
{
|
||||
//? m_soundChannel = m_sound->Play(SOUND_MANIP, m_object->RetPosition(0), 1.0f, 0.5f, true);
|
||||
//? m_soundChannel = m_sound->Play(SOUND_MANIP, m_object->GetPosition(0), 1.0f, 0.5f, true);
|
||||
m_bSilent = false;
|
||||
}
|
||||
}
|
||||
|
@ -100,7 +101,7 @@ bool CAutoKid::EventProcess(const Event &event)
|
|||
|
||||
if ( m_soundChannel != -1 )
|
||||
{
|
||||
if ( m_engine->RetPause() )
|
||||
if ( m_engine->GetPause() )
|
||||
{
|
||||
if ( !m_bSilent )
|
||||
{
|
||||
|
@ -118,8 +119,8 @@ bool CAutoKid::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_progress += event.rTime*m_speed;
|
||||
|
||||
|
@ -135,12 +136,12 @@ bool CAutoKid::EventProcess(const Event &event)
|
|||
vib.z = sinf(m_progress*0.5f)*0.05f;
|
||||
m_object->SetCirVibration(vib);
|
||||
|
||||
if ( m_lastParticule+m_engine->ParticuleAdapt(0.15f) <= m_time )
|
||||
if ( m_lastParticle+m_engine->ParticleAdapt(0.15f) <= m_time )
|
||||
{
|
||||
m_lastParticule = m_time;
|
||||
m_lastParticle = m_time;
|
||||
|
||||
pos = m_object->RetPosition(0);
|
||||
pos.y = m_water->RetLevel()+1.0f;
|
||||
pos = m_object->GetPosition(0);
|
||||
pos.y = m_water->GetLevel()+1.0f;
|
||||
pos.x += (Math::Rand()-0.5f)*50.0f;
|
||||
pos.z += (Math::Rand()-0.5f)*50.0f;
|
||||
speed.y = 0.0f;
|
||||
|
@ -148,7 +149,7 @@ bool CAutoKid::EventProcess(const Event &event)
|
|||
speed.z = 0.0f;
|
||||
dim.x = 50.0f;
|
||||
dim.y = dim.x;
|
||||
m_particule->CreateParticule(pos, speed, dim, PARTIFLIC, 3.0f, 0.0f, 0.0f);
|
||||
m_particle->CreateParticle(pos, speed, dim, Gfx::PARTIFLIC, 3.0f, 0.0f, 0.0f);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -164,12 +165,12 @@ bool CAutoKid::EventProcess(const Event &event)
|
|||
vib.z = sinf(m_progress*0.5f)*0.15f;
|
||||
m_object->SetCirVibration(vib);
|
||||
|
||||
if ( m_lastParticule+m_engine->ParticuleAdapt(0.15f) <= m_time )
|
||||
if ( m_lastParticle+m_engine->ParticleAdapt(0.15f) <= m_time )
|
||||
{
|
||||
m_lastParticule = m_time;
|
||||
m_lastParticle = m_time;
|
||||
|
||||
pos = m_object->RetPosition(0);
|
||||
pos.y = m_water->RetLevel()+1.0f;
|
||||
pos = m_object->GetPosition(0);
|
||||
pos.y = m_water->GetLevel()+1.0f;
|
||||
pos.x += (Math::Rand()-0.5f)*20.0f;
|
||||
pos.z += (Math::Rand()-0.5f)*20.0f;
|
||||
speed.y = 0.0f;
|
||||
|
@ -177,7 +178,7 @@ bool CAutoKid::EventProcess(const Event &event)
|
|||
speed.z = 0.0f;
|
||||
dim.x = 20.0f;
|
||||
dim.y = dim.x;
|
||||
m_particule->CreateParticule(pos, speed, dim, PARTIFLIC, 3.0f, 0.0f, 0.0f);
|
||||
m_particle->CreateParticle(pos, speed, dim, Gfx::PARTIFLIC, 3.0f, 0.0f, 0.0f);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -191,9 +192,9 @@ bool CAutoKid::EventProcess(const Event &event)
|
|||
}
|
||||
|
||||
|
||||
// Returns an error due the state of the automation.
|
||||
// Geturns an error due the state of the automation.
|
||||
|
||||
Error CAutoKid::RetError()
|
||||
Error CAutoKid::GetError()
|
||||
{
|
||||
return ERR_OK;
|
||||
}
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
// * This file is part of the COLOBOT source code
|
||||
// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch
|
||||
// * Copyright (C) 2012, Polish Portal of Colobot (PPC)
|
||||
// *
|
||||
// * This program is free software: you can redistribute it and/or modify
|
||||
// * it under the terms of the GNU General Public License as published by
|
||||
|
@ -33,14 +34,14 @@ public:
|
|||
|
||||
void Init();
|
||||
bool EventProcess(const Event &event);
|
||||
Error RetError();
|
||||
Error GetError();
|
||||
|
||||
protected:
|
||||
|
||||
protected:
|
||||
float m_speed;
|
||||
float m_progress;
|
||||
float m_lastParticule;
|
||||
float m_lastParticle;
|
||||
int m_soundChannel;
|
||||
bool m_bSilent;
|
||||
};
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
// * This file is part of the COLOBOT source code
|
||||
// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch
|
||||
// * Copyright (C) 2012, Polish Portal of Colobot (PPC)
|
||||
// *
|
||||
// * This program is free software: you can redistribute it and/or modify
|
||||
// * it under the terms of the GNU General Public License as published by
|
||||
|
@ -69,14 +70,14 @@ void CAutoLabo::DeleteObject(bool bAll)
|
|||
{
|
||||
if ( m_partiRank[i] != -1 )
|
||||
{
|
||||
m_particule->DeleteParticule(m_partiRank[i]);
|
||||
m_particle->DeleteParticle(m_partiRank[i]);
|
||||
m_partiRank[i] = -1;
|
||||
}
|
||||
}
|
||||
|
||||
if ( m_partiSphere != -1 )
|
||||
{
|
||||
m_particule->DeleteParticule(m_partiSphere);
|
||||
m_particle->DeleteParticle(m_partiSphere);
|
||||
m_partiSphere = -1;
|
||||
}
|
||||
|
||||
|
@ -97,7 +98,7 @@ void CAutoLabo::Init()
|
|||
{
|
||||
m_time = 0.0f;
|
||||
m_timeVirus = 0.0f;
|
||||
m_lastParticule = 0.0f;
|
||||
m_lastParticle = 0.0f;
|
||||
|
||||
m_phase = ALAP_WAIT; // waiting ...
|
||||
m_progress = 0.0f;
|
||||
|
@ -119,23 +120,23 @@ bool CAutoLabo::EventProcess(const Event &event)
|
|||
|
||||
CAuto::EventProcess(event);
|
||||
|
||||
if ( m_engine->RetPause() ) return true;
|
||||
if ( m_engine->GetPause() ) return true;
|
||||
|
||||
if ( event.event == EVENT_UPDINTERFACE )
|
||||
if ( event.type == EVENT_UPDINTERFACE )
|
||||
{
|
||||
if ( m_object->RetSelect() ) CreateInterface(true);
|
||||
if ( m_object->GetSelect() ) CreateInterface(true);
|
||||
}
|
||||
|
||||
if ( m_object->RetSelect() && // center selected?
|
||||
(event.event == EVENT_OBJECT_RiPAW ||
|
||||
event.event == EVENT_OBJECT_RiGUN) )
|
||||
if ( m_object->GetSelect() && // center selected?
|
||||
(event.type == EVENT_OBJECT_RiPAW ||
|
||||
event.type == EVENT_OBJECT_RiGUN) )
|
||||
{
|
||||
if ( m_phase != ALAP_WAIT )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
m_research = event.event;
|
||||
m_research = event.type;
|
||||
|
||||
if ( TestResearch(m_research) )
|
||||
{
|
||||
|
@ -143,13 +144,13 @@ bool CAutoLabo::EventProcess(const Event &event)
|
|||
return false;
|
||||
}
|
||||
|
||||
power = m_object->RetPower();
|
||||
power = m_object->GetPower();
|
||||
if ( power == 0 )
|
||||
{
|
||||
m_displayText->DisplayError(ERR_LABO_NULL, m_object);
|
||||
return false;
|
||||
}
|
||||
if ( power->RetType() != OBJECT_BULLET )
|
||||
if ( power->GetType() != OBJECT_BULLET )
|
||||
{
|
||||
m_displayText->DisplayError(ERR_LABO_BAD, m_object);
|
||||
return false;
|
||||
|
@ -168,12 +169,12 @@ bool CAutoLabo::EventProcess(const Event &event)
|
|||
return true;
|
||||
}
|
||||
|
||||
if ( event.event != EVENT_FRAME ) return true;
|
||||
if ( event.type != EVENT_FRAME ) return true;
|
||||
|
||||
m_progress += event.rTime*m_speed;
|
||||
m_timeVirus -= event.rTime;
|
||||
|
||||
if ( m_object->RetVirusMode() ) // contaminated by a virus?
|
||||
if ( m_object->GetVirusMode() ) // contaminated by a virus?
|
||||
{
|
||||
if ( m_timeVirus <= 0.0f )
|
||||
{
|
||||
|
@ -247,31 +248,32 @@ bool CAutoLabo::EventProcess(const Event &event)
|
|||
{
|
||||
m_object->SetAngleZ(1, 0.0f);
|
||||
|
||||
goal = m_object->RetPosition(0);
|
||||
goal = m_object->GetPosition(0);
|
||||
goal.y += 3.0f;
|
||||
pos = goal;
|
||||
pos.x -= 4.0f;
|
||||
pos.y += 4.0f;
|
||||
for ( i=0 ; i<3 ; i++ )
|
||||
{
|
||||
m_partiRank[i] = m_particule->CreateRay(pos, goal,
|
||||
PARTIRAY2,
|
||||
m_partiRank[i] = m_particle->CreateRay(pos, goal,
|
||||
Gfx::PARTIRAY2,
|
||||
Math::Point(2.9f, 2.9f),
|
||||
LABO_DELAY);
|
||||
}
|
||||
|
||||
m_soundChannel = m_sound->Play(SOUND_LABO, m_object->RetPosition(0), 0.0f, 0.25f, true);
|
||||
m_soundChannel = m_sound->Play(SOUND_LABO, m_object->GetPosition(0), 0.0f, 0.25f, true);
|
||||
m_sound->AddEnvelope(m_soundChannel, 1.0f, 0.60f, 2.0f, SOPER_CONTINUE);
|
||||
m_sound->AddEnvelope(m_soundChannel, 1.0f, 2.00f, 8.0f, SOPER_CONTINUE);
|
||||
m_sound->AddEnvelope(m_soundChannel, 1.0f, 0.60f, 8.0f, SOPER_CONTINUE);
|
||||
m_sound->AddEnvelope(m_soundChannel, 0.0f, 0.25f, 2.0f, SOPER_STOP);
|
||||
|
||||
pos = m_object->RetPosition(0);
|
||||
pos = m_object->GetPosition(0);
|
||||
pos.y += 4.0f;
|
||||
speed = Math::Vector(0.0f, 0.0f, 0.0f);
|
||||
dim.x = 4.0f;
|
||||
dim.y = dim.x;
|
||||
m_partiSphere = m_particule->CreateParticule(pos, speed, dim, PARTISPHERE2, LABO_DELAY, 0.0f, 0.0f);
|
||||
m_partiSphere = m_particle->CreateParticle(pos, speed,
|
||||
dim, Gfx::PARTISPHERE2, LABO_DELAY, 0.0f, 0.0f);
|
||||
|
||||
m_phase = ALAP_ANALYSE;
|
||||
m_progress = 0.0f;
|
||||
|
@ -283,13 +285,13 @@ bool CAutoLabo::EventProcess(const Event &event)
|
|||
{
|
||||
if ( m_progress < 1.0f )
|
||||
{
|
||||
power = m_object->RetPower();
|
||||
power = m_object->GetPower();
|
||||
if ( power != 0 )
|
||||
{
|
||||
power->SetZoom(0, 1.0f-m_progress);
|
||||
}
|
||||
|
||||
angle = m_object->RetAngleY(2);
|
||||
angle = m_object->GetAngleY(2);
|
||||
if ( m_progress < 0.5f )
|
||||
{
|
||||
angle -= event.rTime*m_progress*20.0f;
|
||||
|
@ -300,27 +302,27 @@ bool CAutoLabo::EventProcess(const Event &event)
|
|||
}
|
||||
m_object->SetAngleY(2, angle); // rotates the analyzer
|
||||
|
||||
angle += m_object->RetAngleY(0);
|
||||
angle += m_object->GetAngleY(0);
|
||||
for ( i=0 ; i<3 ; i++ )
|
||||
{
|
||||
rot = Math::RotatePoint(-angle, -4.0f);
|
||||
pos = m_object->RetPosition(0);
|
||||
pos = m_object->GetPosition(0);
|
||||
pos.x += rot.x;
|
||||
pos.z += rot.y;
|
||||
pos.y += 3.0f+4.0f;;
|
||||
m_particule->SetPosition(m_partiRank[i], pos); // adjusts ray
|
||||
m_particle->SetPosition(m_partiRank[i], pos); // adjusts ray
|
||||
|
||||
angle += Math::PI*2.0f/3.0f;
|
||||
}
|
||||
|
||||
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;
|
||||
|
||||
if ( m_progress > 0.25f &&
|
||||
m_progress < 0.80f )
|
||||
{
|
||||
pos = m_object->RetPosition(0);
|
||||
pos = m_object->GetPosition(0);
|
||||
pos.y += 3.0f;
|
||||
pos.x += (Math::Rand()-0.5f)*2.0f;
|
||||
pos.z += (Math::Rand()-0.5f)*2.0f;
|
||||
|
@ -329,7 +331,7 @@ bool CAutoLabo::EventProcess(const Event &event)
|
|||
speed.z = (Math::Rand()-0.5f)*10.0f;
|
||||
dim.x = Math::Rand()*0.4f*m_progress+1.0f;
|
||||
dim.y = dim.x;
|
||||
m_particule->CreateTrack(pos, speed, dim, PARTITRACK2,
|
||||
m_particle->CreateTrack(pos, speed, dim, Gfx::PARTITRACK2,
|
||||
2.0f+2.0f*m_progress, 10.0f, 1.5f, 1.4f);
|
||||
}
|
||||
}
|
||||
|
@ -338,7 +340,7 @@ bool CAutoLabo::EventProcess(const Event &event)
|
|||
{
|
||||
SetResearch(m_research); // research done
|
||||
|
||||
power = m_object->RetPower();
|
||||
power = m_object->GetPower();
|
||||
if ( power != 0 )
|
||||
{
|
||||
m_object->SetPower(0);
|
||||
|
@ -421,21 +423,21 @@ bool CAutoLabo::EventProcess(const Event &event)
|
|||
}
|
||||
|
||||
|
||||
// Returns an error due the state of the automation.
|
||||
// Geturns an error due the state of the automation.
|
||||
|
||||
Error CAutoLabo::RetError()
|
||||
Error CAutoLabo::GetError()
|
||||
{
|
||||
CObject* pObj;
|
||||
ObjectType type;
|
||||
|
||||
if ( m_object->RetVirusMode() )
|
||||
if ( m_object->GetVirusMode() )
|
||||
{
|
||||
return ERR_BAT_VIRUS;
|
||||
}
|
||||
|
||||
pObj = m_object->RetPower();
|
||||
pObj = m_object->GetPower();
|
||||
if ( pObj == 0 ) return ERR_LABO_NULL;
|
||||
type = pObj->RetType();
|
||||
type = pObj->GetType();
|
||||
if ( type != OBJECT_BULLET ) return ERR_LABO_BAD;
|
||||
|
||||
return ERR_OK;
|
||||
|
@ -446,7 +448,7 @@ Error CAutoLabo::RetError()
|
|||
|
||||
bool CAutoLabo::CreateInterface(bool bSelect)
|
||||
{
|
||||
CWindow* pw;
|
||||
Ui::CWindow* pw;
|
||||
Math::Point pos, dim, ddim;
|
||||
float ox, oy, sx, sy;
|
||||
|
||||
|
@ -454,7 +456,7 @@ bool CAutoLabo::CreateInterface(bool bSelect)
|
|||
|
||||
if ( !bSelect ) return true;
|
||||
|
||||
pw = (CWindow*)m_interface->SearchControl(EVENT_WINDOW0);
|
||||
pw = static_cast< Ui::CWindow* >(m_interface->SearchControl(EVENT_WINDOW0));
|
||||
if ( pw == 0 ) return false;
|
||||
|
||||
dim.x = 33.0f/640.0f;
|
||||
|
@ -487,13 +489,13 @@ bool CAutoLabo::CreateInterface(bool bSelect)
|
|||
|
||||
void CAutoLabo::UpdateInterface()
|
||||
{
|
||||
CWindow* pw;
|
||||
Ui::CWindow* pw;
|
||||
|
||||
if ( !m_object->RetSelect() ) return;
|
||||
if ( !m_object->GetSelect() ) return;
|
||||
|
||||
CAuto::UpdateInterface();
|
||||
|
||||
pw = (CWindow*)m_interface->SearchControl(EVENT_WINDOW0);
|
||||
pw = static_cast< Ui::CWindow* >(m_interface->SearchControl(EVENT_WINDOW0));
|
||||
if ( pw == 0 ) return;
|
||||
|
||||
DeadInterface(pw, EVENT_OBJECT_RiPAW, g_researchEnable&RESEARCH_iPAW);
|
||||
|
@ -508,20 +510,20 @@ void CAutoLabo::UpdateInterface()
|
|||
|
||||
// Indicates the research conducted for a button.
|
||||
|
||||
void CAutoLabo::OkayButton(CWindow *pw, EventMsg event)
|
||||
void CAutoLabo::OkayButton(Ui::CWindow *pw, EventType event)
|
||||
{
|
||||
CControl* control;
|
||||
Ui::CControl* control;
|
||||
|
||||
control = pw->SearchControl(event);
|
||||
if ( control == 0 ) return;
|
||||
|
||||
control->SetState(STATE_OKAY, TestResearch(event));
|
||||
control->SetState(Ui::STATE_OKAY, TestResearch(event));
|
||||
}
|
||||
|
||||
|
||||
// Test whether a search has already been done.
|
||||
|
||||
bool CAutoLabo::TestResearch(EventMsg event)
|
||||
bool CAutoLabo::TestResearch(EventType event)
|
||||
{
|
||||
if ( event == EVENT_OBJECT_RiPAW ) return (g_researchDone & RESEARCH_iPAW);
|
||||
if ( event == EVENT_OBJECT_RiGUN ) return (g_researchDone & RESEARCH_iGUN);
|
||||
|
@ -531,16 +533,17 @@ bool CAutoLabo::TestResearch(EventMsg event)
|
|||
|
||||
// Indicates a search as made.
|
||||
|
||||
void CAutoLabo::SetResearch(EventMsg event)
|
||||
void CAutoLabo::SetResearch(EventType event)
|
||||
{
|
||||
Event newEvent;
|
||||
|
||||
|
||||
if ( event == EVENT_OBJECT_RiPAW ) g_researchDone |= RESEARCH_iPAW;
|
||||
if ( event == EVENT_OBJECT_RiGUN ) g_researchDone |= RESEARCH_iGUN;
|
||||
|
||||
m_main->WriteFreeParam();
|
||||
|
||||
m_event->MakeEvent(newEvent, EVENT_UPDINTERFACE);
|
||||
Event newEvent(EVENT_UPDINTERFACE);
|
||||
// m_event->MakeEvent(newEvent, EVENT_UPDINTERFACE);
|
||||
m_event->AddEvent(newEvent);
|
||||
UpdateInterface();
|
||||
}
|
||||
|
@ -551,7 +554,7 @@ void CAutoLabo::SoundManip(float time, float amplitude, float frequency)
|
|||
{
|
||||
int i;
|
||||
|
||||
i = m_sound->Play(SOUND_MANIP, m_object->RetPosition(0), 0.0f, 0.3f*frequency, true);
|
||||
i = m_sound->Play(SOUND_MANIP, m_object->GetPosition(0), 0.0f, 0.3f*frequency, true);
|
||||
m_sound->AddEnvelope(i, 0.5f*amplitude, 1.0f*frequency, 0.1f, SOPER_CONTINUE);
|
||||
m_sound->AddEnvelope(i, 0.5f*amplitude, 1.0f*frequency, time-0.1f, SOPER_CONTINUE);
|
||||
m_sound->AddEnvelope(i, 0.0f, 0.3f*frequency, 0.1f, SOPER_STOP);
|
||||
|
@ -597,12 +600,12 @@ bool CAutoLabo::Read(char *line)
|
|||
|
||||
CAuto::Read(line);
|
||||
|
||||
m_phase = (AutoLaboPhase)OpInt(line, "aPhase", ALAP_WAIT);
|
||||
m_phase = static_cast< AutoLaboPhase >(OpInt(line, "aPhase", ALAP_WAIT));
|
||||
m_progress = OpFloat(line, "aProgress", 0.0f);
|
||||
m_speed = OpFloat(line, "aSpeed", 1.0f);
|
||||
m_research = (EventMsg)OpInt(line, "aResearch", 0);
|
||||
m_research = static_cast< EventType >(OpInt(line, "aResearch", 0));
|
||||
|
||||
m_lastParticule = 0.0f;
|
||||
m_lastParticle = 0.0f;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
// * This file is part of the COLOBOT source code
|
||||
// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch
|
||||
// * Copyright (C) 2012, Polish Portal of Colobot (PPC)
|
||||
// *
|
||||
// * This program is free software: you can redistribute it and/or modify
|
||||
// * it under the terms of the GNU General Public License as published by
|
||||
|
@ -47,7 +48,7 @@ public:
|
|||
|
||||
void Init();
|
||||
bool EventProcess(const Event &event);
|
||||
Error RetError();
|
||||
Error GetError();
|
||||
|
||||
bool CreateInterface(bool bSelect);
|
||||
|
||||
|
@ -56,9 +57,9 @@ public:
|
|||
|
||||
protected:
|
||||
void UpdateInterface();
|
||||
void OkayButton(CWindow *pw, EventMsg event);
|
||||
bool TestResearch(EventMsg event);
|
||||
void SetResearch(EventMsg event);
|
||||
void OkayButton(Ui::CWindow *pw, EventType event);
|
||||
bool TestResearch(EventType event);
|
||||
void SetResearch(EventType event);
|
||||
void SoundManip(float time, float amplitude, float frequency);
|
||||
|
||||
protected:
|
||||
|
@ -66,8 +67,8 @@ protected:
|
|||
float m_progress;
|
||||
float m_speed;
|
||||
float m_timeVirus;
|
||||
float m_lastParticule;
|
||||
EventMsg m_research;
|
||||
float m_lastParticle;
|
||||
EventType m_research;
|
||||
int m_partiRank[3];
|
||||
int m_partiSphere;
|
||||
int m_soundChannel;
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
// * This file is part of the COLOBOT source code
|
||||
// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch
|
||||
// * Copyright (C) 2012, Polish Portal of Colobot (PPC)
|
||||
// *
|
||||
// * This program is free software: you can redistribute it and/or modify
|
||||
// * it under the terms of the GNU General Public License as published by
|
||||
|
@ -57,7 +58,7 @@ void CAutoMush::Init()
|
|||
m_speed = 1.0f/4.0f;
|
||||
|
||||
m_time = 0.0f;
|
||||
m_lastParticule = 0.0f;
|
||||
m_lastParticle = 0.0f;
|
||||
}
|
||||
|
||||
|
||||
|
@ -72,8 +73,8 @@ bool CAutoMush::EventProcess(const Event &event)
|
|||
|
||||
CAuto::EventProcess(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_progress += event.rTime*m_speed;
|
||||
|
||||
|
@ -122,7 +123,7 @@ bool CAutoMush::EventProcess(const Event &event)
|
|||
}
|
||||
else
|
||||
{
|
||||
m_sound->Play(SOUND_MUSHROOM, m_object->RetPosition(0));
|
||||
m_sound->Play(SOUND_MUSHROOM, m_object->GetPosition(0));
|
||||
|
||||
m_phase = AMP_FIRE;
|
||||
m_progress = 0.0f;
|
||||
|
@ -137,21 +138,21 @@ bool CAutoMush::EventProcess(const Event &event)
|
|||
factor = 1.0f-m_progress;
|
||||
size = 1.0f+(1.0f-m_progress)*0.3f;
|
||||
|
||||
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;
|
||||
|
||||
for ( i=0 ; i<10 ; i++ )
|
||||
{
|
||||
pos = m_object->RetPosition(0);
|
||||
pos = m_object->GetPosition(0);
|
||||
pos.y += 5.0f;
|
||||
speed.x = (Math::Rand()-0.5f)*200.0f;
|
||||
speed.z = (Math::Rand()-0.5f)*200.0f;
|
||||
speed.y = -(20.0f+Math::Rand()*20.0f);
|
||||
dim.x = 1.0f;
|
||||
dim.y = dim.x;
|
||||
channel = m_particule->CreateParticule(pos, speed, dim, PARTIGUN2, 2.0f, 100.0f, 0.0f);
|
||||
m_particule->SetObjectFather(channel, m_object);
|
||||
channel = m_particle->CreateParticle(pos, speed, dim, Gfx::PARTIGUN2, 2.0f, 100.0f, 0.0f);
|
||||
m_particle->SetObjectFather(channel, m_object);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -167,18 +168,18 @@ bool CAutoMush::EventProcess(const Event &event)
|
|||
{
|
||||
if ( m_progress < 1.0f )
|
||||
{
|
||||
if ( m_lastParticule+m_engine->ParticuleAdapt(0.10f) <= m_time )
|
||||
if ( m_lastParticle+m_engine->ParticleAdapt(0.10f) <= m_time )
|
||||
{
|
||||
m_lastParticule = m_time;
|
||||
m_lastParticle = m_time;
|
||||
|
||||
pos = m_object->RetPosition(0);
|
||||
pos = m_object->GetPosition(0);
|
||||
pos.y += 5.0f;
|
||||
speed.x = (Math::Rand()-0.5f)*4.0f;
|
||||
speed.z = (Math::Rand()-0.5f)*4.0f;
|
||||
speed.y = -(0.5f+Math::Rand()*0.5f);
|
||||
dim.x = Math::Rand()*2.5f+2.0f;
|
||||
dim.y = dim.x;
|
||||
m_particule->CreateParticule(pos, speed, dim, PARTISMOKE3, 4.0f, 0.0f, 0.0f);
|
||||
m_particle->CreateParticle(pos, speed, dim, Gfx::PARTISMOKE3, 4.0f, 0.0f, 0.0f);
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -226,16 +227,16 @@ bool CAutoMush::SearchTarget()
|
|||
float dist;
|
||||
int i;
|
||||
|
||||
iPos = m_object->RetPosition(0);
|
||||
iPos = m_object->GetPosition(0);
|
||||
|
||||
for ( i=0 ; i<1000000 ; i++ )
|
||||
{
|
||||
pObj = (CObject*)m_iMan->SearchInstance(CLASS_OBJECT, i);
|
||||
pObj = static_cast< CObject* >(m_iMan->SearchInstance(CLASS_OBJECT, i));
|
||||
if ( pObj == 0 ) break;
|
||||
|
||||
if ( pObj->RetLock() ) continue;
|
||||
if ( pObj->GetLock() ) continue;
|
||||
|
||||
type = pObj->RetType();
|
||||
type = pObj->GetType();
|
||||
if ( type != OBJECT_MOBILEfa &&
|
||||
type != OBJECT_MOBILEta &&
|
||||
type != OBJECT_MOBILEwa &&
|
||||
|
@ -279,7 +280,7 @@ bool CAutoMush::SearchTarget()
|
|||
type != OBJECT_PARA &&
|
||||
type != OBJECT_HUMAN ) continue;
|
||||
|
||||
oPos = pObj->RetPosition(0);
|
||||
oPos = pObj->GetPosition(0);
|
||||
dist = Math::Distance(oPos, iPos);
|
||||
if ( dist < 50.0f ) return true;
|
||||
}
|
||||
|
@ -288,9 +289,9 @@ bool CAutoMush::SearchTarget()
|
|||
}
|
||||
|
||||
|
||||
// Returns an error due the state of the automation.
|
||||
// Geturns an error due the state of the automation.
|
||||
|
||||
Error CAutoMush::RetError()
|
||||
Error CAutoMush::GetError()
|
||||
{
|
||||
return ERR_OK;
|
||||
}
|
||||
|
@ -332,11 +333,11 @@ bool CAutoMush::Read(char *line)
|
|||
|
||||
CAuto::Read(line);
|
||||
|
||||
m_phase = (AutoMushPhase)OpInt(line, "aPhase", AMP_WAIT);
|
||||
m_phase = static_cast< AutoMushPhase >(OpInt(line, "aPhase", AMP_WAIT));
|
||||
m_progress = OpFloat(line, "aProgress", 0.0f);
|
||||
m_speed = OpFloat(line, "aSpeed", 1.0f);
|
||||
|
||||
m_lastParticule = 0.0f;
|
||||
m_lastParticle = 0.0f;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
// * This file is part of the COLOBOT source code
|
||||
// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch
|
||||
// * Copyright (C) 2012, Polish Portal of Colobot (PPC)
|
||||
// *
|
||||
// * This program is free software: you can redistribute it and/or modify
|
||||
// * it under the terms of the GNU General Public License as published by
|
||||
|
@ -44,7 +45,7 @@ public:
|
|||
|
||||
void Init();
|
||||
bool EventProcess(const Event &event);
|
||||
Error RetError();
|
||||
Error GetError();
|
||||
|
||||
bool Write(char *line);
|
||||
bool Read(char *line);
|
||||
|
@ -56,6 +57,6 @@ protected:
|
|||
AutoMushPhase m_phase;
|
||||
float m_progress;
|
||||
float m_speed;
|
||||
float m_lastParticule;
|
||||
float m_lastParticle;
|
||||
};
|
||||
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
// * This file is part of the COLOBOT source code
|
||||
// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch
|
||||
// * Copyright (C) 2012, Polish Portal of Colobot (PPC)
|
||||
// *
|
||||
// * This program is free software: you can redistribute it and/or modify
|
||||
// * it under the terms of the GNU General Public License as published by
|
||||
|
@ -20,7 +21,7 @@
|
|||
#include "object/auto/autonest.h"
|
||||
|
||||
#include "common/iman.h"
|
||||
#include "old/terrain.h"
|
||||
#include "graphics/engine/terrain.h"
|
||||
#include "script/cmdtoken.h"
|
||||
|
||||
|
||||
|
@ -72,9 +73,9 @@ void CAutoNest::Init()
|
|||
m_speed = 1.0f/4.0f;
|
||||
|
||||
m_time = 0.0f;
|
||||
m_lastParticule = 0.0f;
|
||||
m_lastParticle = 0.0f;
|
||||
|
||||
pos = m_object->RetPosition(0);
|
||||
pos = m_object->GetPosition(0);
|
||||
m_terrain->MoveOnFloor(pos);
|
||||
m_fretPos = pos;
|
||||
}
|
||||
|
@ -88,8 +89,8 @@ bool CAutoNest::EventProcess(const Event &event)
|
|||
|
||||
CAuto::EventProcess(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_progress += event.rTime*m_speed;
|
||||
|
||||
|
@ -154,10 +155,10 @@ bool CAutoNest::SearchFree(Math::Vector pos)
|
|||
|
||||
for ( i=0 ; i<1000000 ; i++ )
|
||||
{
|
||||
pObj = (CObject*)m_iMan->SearchInstance(CLASS_OBJECT, i);
|
||||
pObj = static_cast< CObject* >(m_iMan->SearchInstance(CLASS_OBJECT, i));
|
||||
if ( pObj == 0 ) break;
|
||||
|
||||
type = pObj->RetType();
|
||||
type = pObj->GetType();
|
||||
if ( type == OBJECT_NEST ) continue;
|
||||
|
||||
j = 0;
|
||||
|
@ -199,15 +200,15 @@ CObject* CAutoNest::SearchFret()
|
|||
|
||||
for ( i=0 ; i<1000000 ; i++ )
|
||||
{
|
||||
pObj = (CObject*)m_iMan->SearchInstance(CLASS_OBJECT, i);
|
||||
pObj = static_cast< CObject* >(m_iMan->SearchInstance(CLASS_OBJECT, i));
|
||||
if ( pObj == 0 ) break;
|
||||
|
||||
if ( !pObj->RetLock() ) continue;
|
||||
if ( !pObj->GetLock() ) continue;
|
||||
|
||||
type = pObj->RetType();
|
||||
type = pObj->GetType();
|
||||
if ( type != OBJECT_BULLET ) continue;
|
||||
|
||||
oPos = pObj->RetPosition(0);
|
||||
oPos = pObj->GetPosition(0);
|
||||
if ( oPos.x == m_fretPos.x &&
|
||||
oPos.z == m_fretPos.z )
|
||||
{
|
||||
|
@ -219,9 +220,9 @@ CObject* CAutoNest::SearchFret()
|
|||
}
|
||||
|
||||
|
||||
// Returns an error due the state of the automation.
|
||||
// Geturns an error due the state of the automation.
|
||||
|
||||
Error CAutoNest::RetError()
|
||||
Error CAutoNest::GetError()
|
||||
{
|
||||
return ERR_OK;
|
||||
}
|
||||
|
@ -263,11 +264,11 @@ bool CAutoNest::Read(char *line)
|
|||
|
||||
CAuto::Read(line);
|
||||
|
||||
m_phase = (AutoNestPhase)OpInt(line, "aPhase", ANP_WAIT);
|
||||
m_phase = static_cast< AutoNestPhase >(OpInt(line, "aPhase", ANP_WAIT));
|
||||
m_progress = OpFloat(line, "aProgress", 0.0f);
|
||||
m_speed = OpFloat(line, "aSpeed", 1.0f);
|
||||
|
||||
m_lastParticule = 0.0f;
|
||||
m_lastParticle = 0.0f;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
// * This file is part of the COLOBOT source code
|
||||
// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch
|
||||
// * Copyright (C) 2012, Polish Portal of Colobot (PPC)
|
||||
// *
|
||||
// * This program is free software: you can redistribute it and/or modify
|
||||
// * it under the terms of the GNU General Public License as published by
|
||||
|
@ -41,7 +42,7 @@ public:
|
|||
|
||||
void Init();
|
||||
bool EventProcess(const Event &event);
|
||||
Error RetError();
|
||||
Error GetError();
|
||||
|
||||
bool Write(char *line);
|
||||
bool Read(char *line);
|
||||
|
@ -55,7 +56,7 @@ protected:
|
|||
AutoNestPhase m_phase;
|
||||
float m_progress;
|
||||
float m_speed;
|
||||
float m_lastParticule;
|
||||
Math::Vector m_fretPos;
|
||||
float m_lastParticle;
|
||||
Math::Vector m_fretPos;
|
||||
};
|
||||
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
// * This file is part of the COLOBOT source code
|
||||
// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch
|
||||
// * Copyright (C) 2012, Polish Portal of Colobot (PPC)
|
||||
// *
|
||||
// * This program is free software: you can redistribute it and/or modify
|
||||
// * it under the terms of the GNU General Public License as published by
|
||||
|
@ -84,9 +85,9 @@ void CAutoNuclear::Init()
|
|||
|
||||
m_time = 0.0f;
|
||||
m_timeVirus = 0.0f;
|
||||
m_lastParticule = 0.0f;
|
||||
m_lastParticle = 0.0f;
|
||||
|
||||
mat = m_object->RetWorldMatrix(0);
|
||||
mat = m_object->GetWorldMatrix(0);
|
||||
m_pos = Math::Transform(*mat, Math::Vector(22.0f, 4.0f, 0.0f));
|
||||
|
||||
m_phase = ANUP_WAIT; // waiting ...
|
||||
|
@ -110,13 +111,13 @@ bool CAutoNuclear::EventProcess(const Event &event)
|
|||
|
||||
CAuto::EventProcess(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_progress += event.rTime*m_speed;
|
||||
m_timeVirus -= event.rTime;
|
||||
|
||||
if ( m_object->RetVirusMode() ) // contaminated by a virus?
|
||||
if ( m_object->GetVirusMode() ) // contaminated by a virus?
|
||||
{
|
||||
if ( m_timeVirus <= 0.0f )
|
||||
{
|
||||
|
@ -146,7 +147,7 @@ bool CAutoNuclear::EventProcess(const Event &event)
|
|||
InitProgressTotal(1.5f+NUCLEAR_DELAY+1.5f);
|
||||
UpdateInterface();
|
||||
|
||||
m_sound->Play(SOUND_OPEN, m_object->RetPosition(0), 1.0f, 1.4f);
|
||||
m_sound->Play(SOUND_OPEN, m_object->GetPosition(0), 1.0f, 1.4f);
|
||||
|
||||
m_phase = ANUP_CLOSE;
|
||||
m_progress = 0.0f;
|
||||
|
@ -166,8 +167,8 @@ bool CAutoNuclear::EventProcess(const Event &event)
|
|||
{
|
||||
m_object->SetAngleZ(1, 0.0f);
|
||||
|
||||
mat = m_object->RetWorldMatrix(0);
|
||||
max = (int)(10.0f*m_engine->RetParticuleDensity());
|
||||
mat = m_object->GetWorldMatrix(0);
|
||||
max = static_cast< int >(10.0f*m_engine->GetParticleDensity());
|
||||
for ( i=0 ; i<max ; i++ )
|
||||
{
|
||||
pos.x = 27.0f;
|
||||
|
@ -179,12 +180,12 @@ bool CAutoNuclear::EventProcess(const Event &event)
|
|||
speed.z = 0.0f;
|
||||
dim.x = Math::Rand()*1.0f+1.0f;
|
||||
dim.y = dim.x;
|
||||
m_particule->CreateParticule(pos, speed, dim, PARTICRASH);
|
||||
m_particle->CreateParticle(pos, speed, dim, Gfx::PARTICRASH);
|
||||
}
|
||||
|
||||
m_sound->Play(SOUND_CLOSE, m_object->RetPosition(0), 1.0f, 1.0f);
|
||||
m_sound->Play(SOUND_CLOSE, m_object->GetPosition(0), 1.0f, 1.0f);
|
||||
|
||||
m_channelSound = m_sound->Play(SOUND_NUCLEAR, m_object->RetPosition(0), 1.0f, 0.1f, true);
|
||||
m_channelSound = m_sound->Play(SOUND_NUCLEAR, m_object->GetPosition(0), 1.0f, 0.1f, true);
|
||||
m_sound->AddEnvelope(m_channelSound, 1.0f, 1.0f, NUCLEAR_DELAY-1.0f, SOPER_CONTINUE);
|
||||
m_sound->AddEnvelope(m_channelSound, 0.0f, 1.0f, 2.0f, SOPER_STOP);
|
||||
|
||||
|
@ -198,11 +199,11 @@ bool CAutoNuclear::EventProcess(const Event &event)
|
|||
{
|
||||
if ( m_progress < 1.0f )
|
||||
{
|
||||
if ( m_lastParticule+m_engine->ParticuleAdapt(0.10f) <= m_time )
|
||||
if ( m_lastParticle+m_engine->ParticleAdapt(0.10f) <= m_time )
|
||||
{
|
||||
m_lastParticule = m_time;
|
||||
m_lastParticle = m_time;
|
||||
|
||||
pos = m_object->RetPosition(0);
|
||||
pos = m_object->GetPosition(0);
|
||||
pos.y += 30.0f;
|
||||
pos.x += (Math::Rand()-0.5f)*6.0f;
|
||||
pos.z += (Math::Rand()-0.5f)*6.0f;
|
||||
|
@ -211,7 +212,7 @@ bool CAutoNuclear::EventProcess(const Event &event)
|
|||
speed.z = 0.0f;
|
||||
dim.x = Math::Rand()*8.0f+8.0f;
|
||||
dim.y = dim.x;
|
||||
m_particule->CreateParticule(pos, speed, dim, PARTICRASH);
|
||||
m_particle->CreateParticle(pos, speed, dim, Gfx::PARTICRASH);
|
||||
|
||||
pos = m_pos;
|
||||
speed.x = (Math::Rand()-0.5f)*20.0f;
|
||||
|
@ -219,7 +220,7 @@ bool CAutoNuclear::EventProcess(const Event &event)
|
|||
speed.z = (Math::Rand()-0.5f)*20.0f;
|
||||
dim.x = 2.0f;
|
||||
dim.y = dim.x;
|
||||
m_particule->CreateParticule(pos, speed, dim, PARTIBLITZ, 1.0f, 0.0f, 0.0f);
|
||||
m_particle->CreateParticle(pos, speed, dim, Gfx::PARTIBLITZ, 1.0f, 0.0f, 0.0f);
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -234,7 +235,7 @@ bool CAutoNuclear::EventProcess(const Event &event)
|
|||
|
||||
CreatePower(); // creates the atomic cell
|
||||
|
||||
max = (int)(20.0f*m_engine->RetParticuleDensity());
|
||||
max = static_cast< int >(20.0f*m_engine->GetParticleDensity());
|
||||
for ( i=0 ; i<max ; i++ )
|
||||
{
|
||||
pos = m_pos;
|
||||
|
@ -246,10 +247,10 @@ bool CAutoNuclear::EventProcess(const Event &event)
|
|||
speed.z = 0.0f;
|
||||
dim.x = Math::Rand()*2.0f+2.0f;
|
||||
dim.y = dim.x;
|
||||
m_particule->CreateParticule(pos, speed, dim, PARTIBLUE, Math::Rand()*5.0f+5.0f, 0.0f, 0.0f);
|
||||
m_particle->CreateParticle(pos, speed, dim, Gfx::PARTIBLUE, Math::Rand()*5.0f+5.0f, 0.0f, 0.0f);
|
||||
}
|
||||
|
||||
m_sound->Play(SOUND_OPEN, m_object->RetPosition(0), 1.0f, 1.4f);
|
||||
m_sound->Play(SOUND_OPEN, m_object->GetPosition(0), 1.0f, 1.4f);
|
||||
|
||||
m_phase = ANUP_OPEN;
|
||||
m_progress = 0.0f;
|
||||
|
@ -287,7 +288,7 @@ bool CAutoNuclear::EventProcess(const Event &event)
|
|||
|
||||
bool CAutoNuclear::CreateInterface(bool bSelect)
|
||||
{
|
||||
CWindow* pw;
|
||||
Ui::CWindow* pw;
|
||||
Math::Point pos, ddim;
|
||||
float ox, oy, sx, sy;
|
||||
|
||||
|
@ -295,7 +296,7 @@ bool CAutoNuclear::CreateInterface(bool bSelect)
|
|||
|
||||
if ( !bSelect ) return true;
|
||||
|
||||
pw = (CWindow*)m_interface->SearchControl(EVENT_WINDOW0);
|
||||
pw = static_cast< Ui::CWindow* >(m_interface->SearchControl(EVENT_WINDOW0));
|
||||
if ( pw == 0 ) return false;
|
||||
|
||||
ox = 3.0f/640.0f;
|
||||
|
@ -319,9 +320,9 @@ CObject* CAutoNuclear::SearchUranium()
|
|||
{
|
||||
CObject* pObj;
|
||||
|
||||
pObj = m_object->RetPower();
|
||||
pObj = m_object->GetPower();
|
||||
if ( pObj == 0 ) return 0;
|
||||
if ( pObj->RetType() == OBJECT_URANIUM ) return pObj;
|
||||
if ( pObj->GetType() == OBJECT_URANIUM ) return pObj;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -337,10 +338,10 @@ bool CAutoNuclear::SearchVehicle()
|
|||
|
||||
for ( i=0 ; i<1000000 ; i++ )
|
||||
{
|
||||
pObj = (CObject*)m_iMan->SearchInstance(CLASS_OBJECT, i);
|
||||
pObj = static_cast< CObject* >(m_iMan->SearchInstance(CLASS_OBJECT, i));
|
||||
if ( pObj == 0 ) break;
|
||||
|
||||
type = pObj->RetType();
|
||||
type = pObj->GetType();
|
||||
if ( type != OBJECT_HUMAN &&
|
||||
type != OBJECT_MOBILEfa &&
|
||||
type != OBJECT_MOBILEta &&
|
||||
|
@ -392,8 +393,8 @@ void CAutoNuclear::CreatePower()
|
|||
Math::Vector pos;
|
||||
float angle;
|
||||
|
||||
pos = m_object->RetPosition(0);
|
||||
angle = m_object->RetAngleY(0);
|
||||
pos = m_object->GetPosition(0);
|
||||
angle = m_object->GetAngleY(0);
|
||||
|
||||
power = new CObject(m_iMan);
|
||||
if ( !power->CreateResource(pos, angle, OBJECT_ATOMIC) )
|
||||
|
@ -409,28 +410,28 @@ void CAutoNuclear::CreatePower()
|
|||
}
|
||||
|
||||
|
||||
// Returns an error due the state of the automation.
|
||||
// Geturns an error due the state of the automation.
|
||||
|
||||
Error CAutoNuclear::RetError()
|
||||
Error CAutoNuclear::GetError()
|
||||
{
|
||||
CObject* pObj;
|
||||
ObjectType type;
|
||||
//? TerrainRes res;
|
||||
|
||||
if ( m_object->RetVirusMode() )
|
||||
if ( m_object->GetVirusMode() )
|
||||
{
|
||||
return ERR_BAT_VIRUS;
|
||||
}
|
||||
|
||||
//? res = m_terrain->RetResource(m_object->RetPosition(0));
|
||||
//? res = m_terrain->GetResource(m_object->GetPosition(0));
|
||||
//? if ( res != TR_POWER ) return ERR_NUCLEAR_NULL;
|
||||
|
||||
//? if ( m_object->RetEnergy() < ENERGY_POWER ) return ERR_NUCLEAR_LOW;
|
||||
//? if ( m_object->GetEnergy() < ENERGY_POWER ) return ERR_NUCLEAR_LOW;
|
||||
|
||||
pObj = m_object->RetPower();
|
||||
pObj = m_object->GetPower();
|
||||
if ( pObj == 0 ) return ERR_NUCLEAR_EMPTY;
|
||||
if ( pObj->RetLock() ) return ERR_OK;
|
||||
type = pObj->RetType();
|
||||
if ( pObj->GetLock() ) return ERR_OK;
|
||||
type = pObj->GetType();
|
||||
if ( type == OBJECT_ATOMIC ) return ERR_OK;
|
||||
if ( type != OBJECT_URANIUM ) return ERR_NUCLEAR_BAD;
|
||||
|
||||
|
@ -472,11 +473,11 @@ bool CAutoNuclear::Read(char *line)
|
|||
|
||||
CAuto::Read(line);
|
||||
|
||||
m_phase = (AutoNuclearPhase)OpInt(line, "aPhase", ANUP_WAIT);
|
||||
m_phase = static_cast< AutoNuclearPhase >(OpInt(line, "aPhase", ANUP_WAIT));
|
||||
m_progress = OpFloat(line, "aProgress", 0.0f);
|
||||
m_speed = OpFloat(line, "aSpeed", 1.0f);
|
||||
|
||||
m_lastParticule = 0.0f;
|
||||
m_lastParticle = 0.0f;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
// * This file is part of the COLOBOT source code
|
||||
// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch
|
||||
// * Copyright (C) 2012, Polish Portal of Colobot (PPC)
|
||||
// *
|
||||
// * This program is free software: you can redistribute it and/or modify
|
||||
// * it under the terms of the GNU General Public License as published by
|
||||
|
@ -44,7 +45,7 @@ public:
|
|||
|
||||
void Init();
|
||||
bool EventProcess(const Event &event);
|
||||
Error RetError();
|
||||
Error GetError();
|
||||
|
||||
bool CreateInterface(bool bSelect);
|
||||
|
||||
|
@ -61,7 +62,7 @@ protected:
|
|||
float m_progress;
|
||||
float m_speed;
|
||||
float m_timeVirus;
|
||||
float m_lastParticule;
|
||||
float m_lastParticle;
|
||||
Math::Vector m_pos;
|
||||
int m_channelSound;
|
||||
};
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
// * This file is part of the COLOBOT source code
|
||||
// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch
|
||||
// * Copyright (C) 2012, Polish Portal of Colobot (PPC)
|
||||
// *
|
||||
// * This program is free software: you can redistribute it and/or modify
|
||||
// * it under the terms of the GNU General Public License as published by
|
||||
|
@ -68,9 +69,9 @@ void CAutoPara::Init()
|
|||
|
||||
m_time = 0.0f;
|
||||
m_timeVirus = 0.0f;
|
||||
m_lastParticule = 0.0f;
|
||||
m_lastParticle = 0.0f;
|
||||
|
||||
mat = m_object->RetWorldMatrix(0);
|
||||
mat = m_object->GetWorldMatrix(0);
|
||||
m_pos = Math::Transform(*mat, Math::Vector(22.0f, 4.0f, 0.0f));
|
||||
|
||||
m_phase = APAP_WAIT; // waiting ...
|
||||
|
@ -83,9 +84,9 @@ void CAutoPara::Init()
|
|||
|
||||
// Reception of lightning.
|
||||
|
||||
void CAutoPara::StartBlitz()
|
||||
void CAutoPara::StartLightning()
|
||||
{
|
||||
m_phase = APAP_BLITZ;
|
||||
m_phase = APAP_LIGHTNING;
|
||||
m_progress = 0.0f;
|
||||
m_speed = 1.0f/2.0f;
|
||||
}
|
||||
|
@ -101,13 +102,13 @@ bool CAutoPara::EventProcess(const Event &event)
|
|||
|
||||
CAuto::EventProcess(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_progress += event.rTime*m_speed;
|
||||
m_timeVirus -= event.rTime;
|
||||
|
||||
if ( m_object->RetVirusMode() ) // contaminated by a virus?
|
||||
if ( m_object->GetVirusMode() ) // contaminated by a virus?
|
||||
{
|
||||
if ( m_timeVirus <= 0.0f )
|
||||
{
|
||||
|
@ -118,17 +119,17 @@ bool CAutoPara::EventProcess(const Event &event)
|
|||
|
||||
EventProgress(event.rTime);
|
||||
|
||||
if ( m_phase == APAP_BLITZ )
|
||||
if ( m_phase == APAP_LIGHTNING )
|
||||
{
|
||||
if ( m_progress < 1.0f )
|
||||
{
|
||||
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;
|
||||
|
||||
for ( i=0 ; i<10 ; i++ )
|
||||
{
|
||||
pos = m_object->RetPosition(0);
|
||||
pos = m_object->GetPosition(0);
|
||||
pos.x += (Math::Rand()-0.5f)*m_progress*40.0f;
|
||||
pos.z += (Math::Rand()-0.5f)*m_progress*40.0f;
|
||||
pos.y += 50.0f-m_progress*50.0f;
|
||||
|
@ -137,7 +138,7 @@ bool CAutoPara::EventProcess(const Event &event)
|
|||
speed.y = 5.0f+Math::Rand()*5.0f;
|
||||
dim.x = 2.0f;
|
||||
dim.y = dim.x;
|
||||
m_particule->CreateParticule(pos, speed, dim, PARTIBLITZ, 1.0f, 20.0f, 0.5f);
|
||||
m_particle->CreateParticle(pos, speed, dim, Gfx::PARTIBLITZ, 1.0f, 20.0f, 0.5f);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -153,20 +154,20 @@ bool CAutoPara::EventProcess(const Event &event)
|
|||
{
|
||||
if ( m_progress < 1.0f )
|
||||
{
|
||||
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;
|
||||
|
||||
for ( i=0 ; i<2 ; i++ )
|
||||
{
|
||||
pos = m_object->RetPosition(0);
|
||||
pos = m_object->GetPosition(0);
|
||||
pos.y += 16.0f;
|
||||
speed.x = (Math::Rand()-0.5f)*10.0f;
|
||||
speed.z = (Math::Rand()-0.5f)*10.0f;
|
||||
speed.y = -Math::Rand()*30.0f;
|
||||
dim.x = 1.0f;
|
||||
dim.y = dim.x;
|
||||
m_particule->CreateParticule(pos, speed, dim, PARTIBLITZ, 1.0f, 0.0f, 0.0f);
|
||||
m_particle->CreateParticle(pos, speed, dim, Gfx::PARTIBLITZ, 1.0f, 0.0f, 0.0f);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -188,7 +189,7 @@ bool CAutoPara::EventProcess(const Event &event)
|
|||
|
||||
bool CAutoPara::CreateInterface(bool bSelect)
|
||||
{
|
||||
CWindow* pw;
|
||||
Ui::CWindow* pw;
|
||||
Math::Point pos, ddim;
|
||||
float ox, oy, sx, sy;
|
||||
|
||||
|
@ -196,7 +197,7 @@ bool CAutoPara::CreateInterface(bool bSelect)
|
|||
|
||||
if ( !bSelect ) return true;
|
||||
|
||||
pw = (CWindow*)m_interface->SearchControl(EVENT_WINDOW0);
|
||||
pw = static_cast< Ui::CWindow* >(m_interface->SearchControl(EVENT_WINDOW0));
|
||||
if ( pw == 0 ) return false;
|
||||
|
||||
ox = 3.0f/640.0f;
|
||||
|
@ -220,11 +221,11 @@ bool CAutoPara::CreateInterface(bool bSelect)
|
|||
}
|
||||
|
||||
|
||||
// Returns an error due the state of the automation.
|
||||
// Geturns an error due the state of the automation.
|
||||
|
||||
Error CAutoPara::RetError()
|
||||
Error CAutoPara::GetError()
|
||||
{
|
||||
if ( m_object->RetVirusMode() )
|
||||
if ( m_object->GetVirusMode() )
|
||||
{
|
||||
return ERR_BAT_VIRUS;
|
||||
}
|
||||
|
@ -242,38 +243,38 @@ void CAutoPara::ChargeObject(float rTime)
|
|||
float dist, energy;
|
||||
int i;
|
||||
|
||||
sPos = m_object->RetPosition(0);
|
||||
sPos = m_object->GetPosition(0);
|
||||
|
||||
for ( i=0 ; i<1000000 ; i++ )
|
||||
{
|
||||
pObj = (CObject*)m_iMan->SearchInstance(CLASS_OBJECT, i);
|
||||
pObj = static_cast< CObject* >(m_iMan->SearchInstance(CLASS_OBJECT, i));
|
||||
if ( pObj == 0 ) break;
|
||||
|
||||
oPos = pObj->RetPosition(0);
|
||||
oPos = pObj->GetPosition(0);
|
||||
dist = Math::Distance(oPos, sPos);
|
||||
if ( dist > 20.0f ) continue;
|
||||
|
||||
if ( pObj->RetTruck() == 0 && pObj->RetType() == OBJECT_POWER )
|
||||
if ( pObj->GetTruck() == 0 && pObj->GetType() == OBJECT_POWER )
|
||||
{
|
||||
energy = pObj->RetEnergy();
|
||||
energy = pObj->GetEnergy();
|
||||
energy += rTime/2.0f;
|
||||
if ( energy > 1.0f ) energy = 1.0f;
|
||||
pObj->SetEnergy(energy);
|
||||
}
|
||||
|
||||
power = pObj->RetPower();
|
||||
if ( power != 0 && power->RetType() == OBJECT_POWER )
|
||||
power = pObj->GetPower();
|
||||
if ( power != 0 && power->GetType() == OBJECT_POWER )
|
||||
{
|
||||
energy = power->RetEnergy();
|
||||
energy = power->GetEnergy();
|
||||
energy += rTime/2.0f;
|
||||
if ( energy > 1.0f ) energy = 1.0f;
|
||||
power->SetEnergy(energy);
|
||||
}
|
||||
|
||||
power = pObj->RetFret();
|
||||
if ( power != 0 && power->RetType() == OBJECT_POWER )
|
||||
power = pObj->GetFret();
|
||||
if ( power != 0 && power->GetType() == OBJECT_POWER )
|
||||
{
|
||||
energy = power->RetEnergy();
|
||||
energy = power->GetEnergy();
|
||||
energy += rTime/2.0f;
|
||||
if ( energy > 1.0f ) energy = 1.0f;
|
||||
power->SetEnergy(energy);
|
||||
|
@ -315,11 +316,11 @@ bool CAutoPara::Read(char *line)
|
|||
|
||||
CAuto::Read(line);
|
||||
|
||||
m_phase = (AutoParaPhase)OpInt(line, "aPhase", APAP_WAIT);
|
||||
m_phase = static_cast< AutoParaPhase >(OpInt(line, "aPhase", APAP_WAIT));
|
||||
m_progress = OpFloat(line, "aProgress", 0.0f);
|
||||
m_speed = OpFloat(line, "aSpeed", 1.0f);
|
||||
|
||||
m_lastParticule = 0.0f;
|
||||
m_lastParticle = 0.0f;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
// * This file is part of the COLOBOT source code
|
||||
// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch
|
||||
// * Copyright (C) 2012, Polish Portal of Colobot (PPC)
|
||||
// *
|
||||
// * This program is free software: you can redistribute it and/or modify
|
||||
// * it under the terms of the GNU General Public License as published by
|
||||
|
@ -26,7 +27,7 @@
|
|||
enum AutoParaPhase
|
||||
{
|
||||
APAP_WAIT = 1,
|
||||
APAP_BLITZ = 2,
|
||||
APAP_LIGHTNING = 2,
|
||||
APAP_CHARGE = 3,
|
||||
};
|
||||
|
||||
|
@ -42,8 +43,8 @@ public:
|
|||
|
||||
void Init();
|
||||
bool EventProcess(const Event &event);
|
||||
Error RetError();
|
||||
void StartBlitz();
|
||||
Error GetError();
|
||||
void StartLightning();
|
||||
|
||||
bool CreateInterface(bool bSelect);
|
||||
|
||||
|
@ -58,7 +59,7 @@ protected:
|
|||
float m_progress;
|
||||
float m_speed;
|
||||
float m_timeVirus;
|
||||
float m_lastParticule;
|
||||
float m_lastParticle;
|
||||
Math::Vector m_pos;
|
||||
int m_channelSound;
|
||||
};
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
// * This file is part of the COLOBOT source code
|
||||
// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch
|
||||
// * Copyright (C) 2012, Polish Portal of Colobot (PPC)
|
||||
// *
|
||||
// * This program is free software: you can redistribute it and/or modify
|
||||
// * it under the terms of the GNU General Public License as published by
|
||||
|
@ -90,7 +91,7 @@ void CAutoPortico::DeleteObject(bool bAll)
|
|||
void CAutoPortico::Init()
|
||||
{
|
||||
m_time = 0.0f;
|
||||
m_lastParticule = 0.0f;
|
||||
m_lastParticle = 0.0f;
|
||||
m_posTrack = 0.0f;
|
||||
|
||||
m_phase = APOP_WAIT;
|
||||
|
@ -108,7 +109,7 @@ void CAutoPortico::Start(int param)
|
|||
{
|
||||
Math::Vector pos;
|
||||
|
||||
pos = m_object->RetPosition(0);
|
||||
pos = m_object->GetPosition(0);
|
||||
m_finalPos = pos;
|
||||
pos.z += PORTICO_TIME_MOVE*5.0f; // back to start
|
||||
m_object->SetPosition(0, pos);
|
||||
|
@ -140,15 +141,15 @@ bool CAutoPortico::EventProcess(const Event &event)
|
|||
|
||||
CAuto::EventProcess(event);
|
||||
|
||||
if ( m_engine->RetPause() ) return true;
|
||||
if ( m_engine->GetPause() ) return true;
|
||||
|
||||
if ( m_phase == APOP_START )
|
||||
{
|
||||
if ( m_param == PARAM_DEPOSE ) // deposits the ship?
|
||||
{
|
||||
m_startPos = m_object->RetPosition(0);
|
||||
m_startPos = m_object->GetPosition(0);
|
||||
|
||||
m_soundChannel = m_sound->Play(SOUND_MOTORr, m_object->RetPosition(0), 0.0f, 0.3f, true);
|
||||
m_soundChannel = m_sound->Play(SOUND_MOTORr, m_object->GetPosition(0), 0.0f, 0.3f, true);
|
||||
m_sound->AddEnvelope(m_soundChannel, 0.5f, 0.6f, 0.5f, SOPER_CONTINUE);
|
||||
m_sound->AddEnvelope(m_soundChannel, 0.5f, 0.6f, PORTICO_TIME_MOVE-0.5f, SOPER_CONTINUE);
|
||||
m_sound->AddEnvelope(m_soundChannel, 0.0f, 0.3f, 0.5f, SOPER_STOP);
|
||||
|
@ -159,7 +160,7 @@ bool CAutoPortico::EventProcess(const Event &event)
|
|||
|
||||
m_main->SetMovieLock(true); // blocks everything until the end of the landing
|
||||
|
||||
m_camera->SetType(CAMERA_SCRIPT);
|
||||
m_camera->SetType(Gfx::CAM_TYPE_SCRIPT);
|
||||
|
||||
pos = m_startPos;
|
||||
pos.x += -100.0f;
|
||||
|
@ -167,7 +168,7 @@ bool CAutoPortico::EventProcess(const Event &event)
|
|||
pos.z += -200.0f;
|
||||
m_camera->SetScriptEye(pos);
|
||||
|
||||
pos = m_object->RetPosition(0);
|
||||
pos = m_object->GetPosition(0);
|
||||
pos.x += 0.0f;
|
||||
pos.y += 10.0f;
|
||||
pos.z += -40.0f;
|
||||
|
@ -187,7 +188,7 @@ bool CAutoPortico::EventProcess(const Event &event)
|
|||
angle = sinf(m_time*4.0f)*0.3f;
|
||||
m_object->SetAngleX(11, angle);
|
||||
|
||||
if ( event.event != EVENT_FRAME ) return true;
|
||||
if ( event.type != EVENT_FRAME ) return true;
|
||||
if ( m_phase == APOP_WAIT ) return true;
|
||||
|
||||
m_progress += event.rTime*m_speed;
|
||||
|
@ -197,7 +198,7 @@ bool CAutoPortico::EventProcess(const Event &event)
|
|||
{
|
||||
if ( m_progress < 1.0f )
|
||||
{
|
||||
pos = m_object->RetPosition(0);
|
||||
pos = m_object->GetPosition(0);
|
||||
pos.z -= event.rTime*5.0f; // advance
|
||||
m_object->SetPosition(0, pos);
|
||||
|
||||
|
@ -216,7 +217,7 @@ bool CAutoPortico::EventProcess(const Event &event)
|
|||
{
|
||||
if ( m_progress >= 1.0f )
|
||||
{
|
||||
m_soundChannel = m_sound->Play(SOUND_MANIP, m_object->RetPosition(0), 0.0f, 0.3f, true);
|
||||
m_soundChannel = m_sound->Play(SOUND_MANIP, m_object->GetPosition(0), 0.0f, 0.3f, true);
|
||||
m_sound->AddEnvelope(m_soundChannel, 0.3f, 0.5f, 1.0f, SOPER_CONTINUE);
|
||||
m_sound->AddEnvelope(m_soundChannel, 0.3f, 0.6f, PORTICO_TIME_DOWN-1.5f, SOPER_CONTINUE);
|
||||
m_sound->AddEnvelope(m_soundChannel, 0.0f, 0.3f, 1.0f, SOPER_STOP);
|
||||
|
@ -253,12 +254,12 @@ bool CAutoPortico::EventProcess(const Event &event)
|
|||
{
|
||||
if ( m_progress >= 1.0f )
|
||||
{
|
||||
m_soundChannel = m_sound->Play(SOUND_MANIP, m_object->RetPosition(0), 0.0f, 0.5f, true);
|
||||
m_soundChannel = m_sound->Play(SOUND_MANIP, m_object->GetPosition(0), 0.0f, 0.5f, true);
|
||||
m_sound->AddEnvelope(m_soundChannel, 0.5f, 1.0f, 0.5f, SOPER_CONTINUE);
|
||||
m_sound->AddEnvelope(m_soundChannel, 0.5f, 1.0f, PORTICO_TIME_OPEN/2.0f-0.5f, SOPER_CONTINUE);
|
||||
m_sound->AddEnvelope(m_soundChannel, 0.0f, 0.5f, 0.5f, SOPER_STOP);
|
||||
|
||||
m_soundChannel = m_sound->Play(SOUND_MOTORr, m_object->RetPosition(0), 0.0f, 0.3f, true);
|
||||
m_soundChannel = m_sound->Play(SOUND_MOTORr, m_object->GetPosition(0), 0.0f, 0.3f, true);
|
||||
m_sound->AddEnvelope(m_soundChannel, 0.5f, 0.6f, 0.5f, SOPER_CONTINUE);
|
||||
m_sound->AddEnvelope(m_soundChannel, 0.5f, 0.6f, PORTICO_TIME_OPEN-0.5f, SOPER_CONTINUE);
|
||||
m_sound->AddEnvelope(m_soundChannel, 0.0f, 0.3f, 0.5f, SOPER_STOP);
|
||||
|
@ -273,7 +274,7 @@ bool CAutoPortico::EventProcess(const Event &event)
|
|||
{
|
||||
if ( m_progress < 1.0f )
|
||||
{
|
||||
pos = m_object->RetPosition(0);
|
||||
pos = m_object->GetPosition(0);
|
||||
pos.z += event.rTime*5.3f; // back
|
||||
m_object->SetPosition(0, pos);
|
||||
|
||||
|
@ -309,7 +310,7 @@ bool CAutoPortico::EventProcess(const Event &event)
|
|||
pObj = m_main->SearchHuman();
|
||||
m_main->SelectObject(pObj);
|
||||
m_camera->SetObject(pObj);
|
||||
m_camera->SetType(CAMERA_BACK);
|
||||
m_camera->SetType(Gfx::CAM_TYPE_BACK);
|
||||
|
||||
m_phase = APOP_WAIT;
|
||||
m_progress = 0.0f;
|
||||
|
@ -319,8 +320,8 @@ bool CAutoPortico::EventProcess(const Event &event)
|
|||
|
||||
if ( m_soundChannel != -1 )
|
||||
{
|
||||
//? m_sound->Position(m_soundChannel, m_object->RetPosition(0));
|
||||
pos = m_engine->RetEyePt();
|
||||
//? m_sound->Position(m_soundChannel, m_object->GetPosition(0));
|
||||
pos = m_engine->GetEyePt();
|
||||
m_sound->Position(m_soundChannel, pos);
|
||||
}
|
||||
|
||||
|
@ -338,7 +339,7 @@ bool CAutoPortico::EventProcess(const Event &event)
|
|||
m_camera->SetScriptEye(pos);
|
||||
}
|
||||
|
||||
pos = m_object->RetPosition(0);
|
||||
pos = m_object->GetPosition(0);
|
||||
pos.x += 0.0f;
|
||||
pos.y += 10.0f;
|
||||
pos.z += -40.0f;
|
||||
|
@ -368,7 +369,7 @@ bool CAutoPortico::Abort()
|
|||
pObj = m_main->SearchHuman();
|
||||
m_main->SelectObject(pObj);
|
||||
m_camera->SetObject(pObj);
|
||||
m_camera->SetType(CAMERA_BACK);
|
||||
m_camera->SetType(Gfx::CAM_TYPE_BACK);
|
||||
|
||||
if ( m_soundChannel != -1 )
|
||||
{
|
||||
|
@ -385,9 +386,9 @@ bool CAutoPortico::Abort()
|
|||
}
|
||||
|
||||
|
||||
// Returns an error due the state of the automation.
|
||||
// Geturns an error due the state of the automation.
|
||||
|
||||
Error CAutoPortico::RetError()
|
||||
Error CAutoPortico::GetError()
|
||||
{
|
||||
return ERR_OK;
|
||||
}
|
||||
|
@ -397,11 +398,11 @@ Error CAutoPortico::RetError()
|
|||
|
||||
void CAutoPortico::UpdateTrackMapping(float left, float right)
|
||||
{
|
||||
D3DMATERIAL7 mat;
|
||||
Gfx::Material mat;
|
||||
float limit[2];
|
||||
int rank;
|
||||
|
||||
ZeroMemory( &mat, sizeof(D3DMATERIAL7) );
|
||||
memset( &mat, 0, sizeof(Gfx::Material));
|
||||
mat.diffuse.r = 1.0f;
|
||||
mat.diffuse.g = 1.0f;
|
||||
mat.diffuse.b = 1.0f; // blank
|
||||
|
@ -409,17 +410,17 @@ void CAutoPortico::UpdateTrackMapping(float left, float right)
|
|||
mat.ambient.g = 0.5f;
|
||||
mat.ambient.b = 0.5f;
|
||||
|
||||
rank = m_object->RetObjectRank(0);
|
||||
rank = m_object->GetObjectRank(0);
|
||||
|
||||
limit[0] = 0.0f;
|
||||
limit[1] = 1000000.0f;
|
||||
|
||||
m_engine->TrackTextureMapping(rank, mat, D3DSTATEPART1, "lemt.tga", "",
|
||||
limit[0], limit[1], D3DMAPPINGX,
|
||||
m_engine->TrackTextureMapping(rank, mat, Gfx::ENG_RSTATE_PART1, "lemt.tga", "",
|
||||
limit[0], limit[1], Gfx::ENG_TEX_MAPPING_X,
|
||||
right, 8.0f, 8.0f, 192.0f, 256.0f);
|
||||
|
||||
m_engine->TrackTextureMapping(rank, mat, D3DSTATEPART2, "lemt.tga", "",
|
||||
limit[0], limit[1], D3DMAPPINGX,
|
||||
m_engine->TrackTextureMapping(rank, mat, Gfx::ENG_RSTATE_PART2, "lemt.tga", "",
|
||||
limit[0], limit[1], Gfx::ENG_TEX_MAPPING_X,
|
||||
left, 8.0f, 8.0f, 192.0f, 256.0f);
|
||||
}
|
||||
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
// * This file is part of the COLOBOT source code
|
||||
// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch
|
||||
// * Copyright (C) 2012, Polish Portal of Colobot (PPC)
|
||||
// *
|
||||
// * This program is free software: you can redistribute it and/or modify
|
||||
// * it under the terms of the GNU General Public License as published by
|
||||
|
@ -48,7 +49,7 @@ public:
|
|||
void Start(int param);
|
||||
bool EventProcess(const Event &event);
|
||||
bool Abort();
|
||||
Error RetError();
|
||||
Error GetError();
|
||||
|
||||
protected:
|
||||
void UpdateTrackMapping(float left, float right);
|
||||
|
@ -59,7 +60,7 @@ protected:
|
|||
float m_speed;
|
||||
float m_cameraProgress;
|
||||
float m_cameraSpeed;
|
||||
float m_lastParticule;
|
||||
float m_lastParticle;
|
||||
Math::Vector m_finalPos;
|
||||
Math::Vector m_startPos;
|
||||
float m_posTrack;
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
// * This file is part of the COLOBOT source code
|
||||
// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch
|
||||
// * Copyright (C) 2012, Polish Portal of Colobot (PPC)
|
||||
// *
|
||||
// * This program is free software: you can redistribute it and/or modify
|
||||
// * it under the terms of the GNU General Public License as published by
|
||||
|
@ -74,31 +75,31 @@ bool CAutoRadar::EventProcess(const Event &event)
|
|||
|
||||
CAuto::EventProcess(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;
|
||||
if ( m_phase == ARAP_WAIT ) return true;
|
||||
|
||||
m_progress += event.rTime*m_speed;
|
||||
m_aTime += event.rTime;
|
||||
m_timeVirus -= event.rTime;
|
||||
|
||||
if ( m_object->RetVirusMode() ) // contaminated by a virus?
|
||||
if ( m_object->GetVirusMode() ) // contaminated by a virus?
|
||||
{
|
||||
if ( m_timeVirus <= 0.0f )
|
||||
{
|
||||
m_timeVirus = 0.1f+Math::Rand()*0.3f;
|
||||
|
||||
angle = m_object->RetAngleY(1);
|
||||
angle = m_object->GetAngleY(1);
|
||||
angle += (Math::Rand()-0.2f)*0.5f;
|
||||
m_object->SetAngleY(1, angle);
|
||||
|
||||
angle = m_object->RetAngleY(2);
|
||||
angle = m_object->GetAngleY(2);
|
||||
angle += (Math::Rand()-0.8f)*1.0f;
|
||||
m_object->SetAngleY(2, angle);
|
||||
|
||||
m_object->SetAngleX(3, (Math::Rand()-0.5f)*0.3f);
|
||||
|
||||
m_totalDetect = (int)(Math::Rand()*10.0f);
|
||||
m_totalDetect = static_cast< int >(Math::Rand()*10.0f);
|
||||
UpdateInterface();
|
||||
}
|
||||
return true;
|
||||
|
@ -109,7 +110,7 @@ bool CAutoRadar::EventProcess(const Event &event)
|
|||
if ( m_progress < 1.0f )
|
||||
{
|
||||
speed = Math::Min(10.0f, m_progress*50.0f);
|
||||
angle = m_object->RetAngleY(1);
|
||||
angle = m_object->GetAngleY(1);
|
||||
angle += event.rTime*speed;
|
||||
m_object->SetAngleY(1, angle);
|
||||
}
|
||||
|
@ -123,11 +124,11 @@ bool CAutoRadar::EventProcess(const Event &event)
|
|||
}
|
||||
else
|
||||
{
|
||||
pos = m_object->RetPosition(0);
|
||||
m_start = m_object->RetAngleY(1);
|
||||
pos = m_object->GetPosition(0);
|
||||
m_start = m_object->GetAngleY(1);
|
||||
m_angle = m_start-Math::NormAngle(m_start)+Math::PI*2.0f;
|
||||
m_angle += Math::RotateAngle(pos.x-ePos.x, ePos.z-pos.z);
|
||||
m_angle += Math::PI-m_object->RetAngleY(0);
|
||||
m_angle += Math::PI-m_object->GetAngleY(0);
|
||||
|
||||
m_phase = ARAP_SHOW;
|
||||
m_progress = 0.0f;
|
||||
|
@ -145,7 +146,7 @@ bool CAutoRadar::EventProcess(const Event &event)
|
|||
}
|
||||
else
|
||||
{
|
||||
m_sound->Play(SOUND_RADAR, m_object->RetPosition(0));
|
||||
m_sound->Play(SOUND_RADAR, m_object->GetPosition(0));
|
||||
|
||||
m_phase = ARAP_SINUS;
|
||||
m_progress = 0.0f;
|
||||
|
@ -182,11 +183,11 @@ bool CAutoRadar::EventProcess(const Event &event)
|
|||
}
|
||||
|
||||
|
||||
// Returns an error due the state of the automation.
|
||||
// Geturns an error due the state of the automation.
|
||||
|
||||
Error CAutoRadar::RetError()
|
||||
Error CAutoRadar::GetError()
|
||||
{
|
||||
if ( m_object->RetVirusMode() )
|
||||
if ( m_object->GetVirusMode() )
|
||||
{
|
||||
return ERR_BAT_VIRUS;
|
||||
}
|
||||
|
@ -199,7 +200,7 @@ Error CAutoRadar::RetError()
|
|||
|
||||
bool CAutoRadar::CreateInterface(bool bSelect)
|
||||
{
|
||||
CWindow* pw;
|
||||
Ui::CWindow* pw;
|
||||
Math::Point pos, dim, ddim;
|
||||
float ox, oy, sx, sy;
|
||||
|
||||
|
@ -207,7 +208,7 @@ bool CAutoRadar::CreateInterface(bool bSelect)
|
|||
|
||||
if ( !bSelect ) return true;
|
||||
|
||||
pw = (CWindow*)m_interface->SearchControl(EVENT_WINDOW0);
|
||||
pw = static_cast< Ui::CWindow* >(m_interface->SearchControl(EVENT_WINDOW0));
|
||||
if ( pw == 0 ) return false;
|
||||
|
||||
ox = 3.0f/640.0f;
|
||||
|
@ -235,21 +236,21 @@ bool CAutoRadar::CreateInterface(bool bSelect)
|
|||
|
||||
void CAutoRadar::UpdateInterface()
|
||||
{
|
||||
CWindow* pw;
|
||||
CGauge* pg;
|
||||
Ui::CWindow* pw;
|
||||
Ui::CGauge* pg;
|
||||
float level;
|
||||
|
||||
if ( !m_object->RetSelect() ) return;
|
||||
if ( !m_object->GetSelect() ) return;
|
||||
|
||||
CAuto::UpdateInterface();
|
||||
|
||||
pw = (CWindow*)m_interface->SearchControl(EVENT_WINDOW0);
|
||||
pw = static_cast< Ui::CWindow* >(m_interface->SearchControl(EVENT_WINDOW0));
|
||||
if ( pw == 0 ) return;
|
||||
|
||||
pg = (CGauge*)pw->SearchControl(EVENT_OBJECT_GRADAR);
|
||||
pg = static_cast< Ui::CGauge* >(pw->SearchControl(EVENT_OBJECT_GRADAR));
|
||||
if ( pg != 0 )
|
||||
{
|
||||
level = (float)m_totalDetect*(1.0f/8.0f);
|
||||
level = static_cast< float >(m_totalDetect*(1.0f/8.0f));
|
||||
if ( level > 1.0f ) level = 1.0f;
|
||||
pg->SetLevel(level);
|
||||
}
|
||||
|
@ -267,18 +268,18 @@ bool CAutoRadar::SearchEnemy(Math::Vector &pos)
|
|||
float distance, min;
|
||||
int i;
|
||||
|
||||
iPos = m_object->RetPosition(0);
|
||||
iPos = m_object->GetPosition(0);
|
||||
min = 1000000.0f;
|
||||
m_totalDetect = 0;
|
||||
|
||||
for ( i=0 ; i<1000000 ; i++ )
|
||||
{
|
||||
pObj = (CObject*)m_iMan->SearchInstance(CLASS_OBJECT, i);
|
||||
pObj = static_cast< CObject* >(m_iMan->SearchInstance(CLASS_OBJECT, i));
|
||||
if ( pObj == 0 ) break;
|
||||
|
||||
if ( !pObj->RetActif() ) continue;
|
||||
if ( !pObj->GetActif() ) continue;
|
||||
|
||||
oType = pObj->RetType();
|
||||
oType = pObj->GetType();
|
||||
if ( oType != OBJECT_ANT &&
|
||||
oType != OBJECT_SPIDER &&
|
||||
oType != OBJECT_BEE &&
|
||||
|
@ -287,7 +288,7 @@ bool CAutoRadar::SearchEnemy(Math::Vector &pos)
|
|||
|
||||
m_totalDetect ++;
|
||||
|
||||
oPos = pObj->RetPosition(0);
|
||||
oPos = pObj->GetPosition(0);
|
||||
distance = Math::Distance(oPos, iPos);
|
||||
if ( distance < min )
|
||||
{
|
||||
|
@ -299,7 +300,7 @@ bool CAutoRadar::SearchEnemy(Math::Vector &pos)
|
|||
UpdateInterface();
|
||||
|
||||
if ( pBest == 0 ) return false;
|
||||
pos = pBest->RetPosition(0);
|
||||
pos = pBest->GetPosition(0);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
// * This file is part of the COLOBOT source code
|
||||
// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch
|
||||
// * Copyright (C) 2012, Polish Portal of Colobot (PPC)
|
||||
// *
|
||||
// * This program is free software: you can redistribute it and/or modify
|
||||
// * it under the terms of the GNU General Public License as published by
|
||||
|
@ -44,7 +45,7 @@ public:
|
|||
void Init();
|
||||
bool EventProcess(const Event &event);
|
||||
bool CreateInterface(bool bSelect);
|
||||
Error RetError();
|
||||
Error GetError();
|
||||
|
||||
protected:
|
||||
void UpdateInterface();
|
||||
|
@ -56,7 +57,7 @@ protected:
|
|||
float m_speed;
|
||||
float m_aTime;
|
||||
float m_timeVirus;
|
||||
float m_lastParticule;
|
||||
float m_lastParticle;
|
||||
float m_angle;
|
||||
float m_start;
|
||||
int m_totalDetect;
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
// * This file is part of the COLOBOT source code
|
||||
// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch
|
||||
// * Copyright (C) 2012, Polish Portal of Colobot (PPC)
|
||||
// *
|
||||
// * This program is free software: you can redistribute it and/or modify
|
||||
// * it under the terms of the GNU General Public License as published by
|
||||
|
@ -60,7 +61,7 @@ void CAutoRepair::Init()
|
|||
|
||||
m_time = 0.0f;
|
||||
m_timeVirus = 0.0f;
|
||||
m_lastParticule = 0.0f;
|
||||
m_lastParticle = 0.0f;
|
||||
|
||||
CAuto::Init();
|
||||
}
|
||||
|
@ -77,13 +78,13 @@ bool CAutoRepair::EventProcess(const Event &event)
|
|||
|
||||
CAuto::EventProcess(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_progress += event.rTime*m_speed;
|
||||
m_timeVirus -= event.rTime;
|
||||
|
||||
if ( m_object->RetVirusMode() ) // contaminated by a virus?
|
||||
if ( m_object->GetVirusMode() ) // contaminated by a virus?
|
||||
{
|
||||
if ( m_timeVirus <= 0.0f )
|
||||
{
|
||||
|
@ -104,7 +105,7 @@ bool CAutoRepair::EventProcess(const Event &event)
|
|||
}
|
||||
else
|
||||
{
|
||||
m_sound->Play(SOUND_OPEN, m_object->RetPosition(0), 1.0f, 0.8f);
|
||||
m_sound->Play(SOUND_OPEN, m_object->GetPosition(0), 1.0f, 0.8f);
|
||||
|
||||
m_phase = ARP_DOWN;
|
||||
m_progress = 0.0f;
|
||||
|
@ -123,7 +124,7 @@ bool CAutoRepair::EventProcess(const Event &event)
|
|||
else
|
||||
{
|
||||
m_object->SetAngleZ(1, 0.0f);
|
||||
m_sound->Play(SOUND_REPAIR, m_object->RetPosition(0));
|
||||
m_sound->Play(SOUND_REPAIR, m_object->GetPosition(0));
|
||||
|
||||
m_phase = ARP_REPAIR;
|
||||
m_progress = 0.0f;
|
||||
|
@ -135,21 +136,21 @@ bool CAutoRepair::EventProcess(const Event &event)
|
|||
{
|
||||
vehicule = SearchVehicle();
|
||||
if ( m_progress < 1.0f ||
|
||||
(vehicule != 0 && vehicule->RetShield() < 1.0f) )
|
||||
(vehicule != 0 && vehicule->GetShield() < 1.0f) )
|
||||
{
|
||||
if ( vehicule != 0 )
|
||||
{
|
||||
shield = vehicule->RetShield();
|
||||
shield = vehicule->GetShield();
|
||||
shield += event.rTime*0.2f;
|
||||
if ( shield > 1.0f ) shield = 1.0f;
|
||||
vehicule->SetShield(shield);
|
||||
}
|
||||
|
||||
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_object->RetPosition(0);
|
||||
pos = m_object->GetPosition(0);
|
||||
pos.x += (Math::Rand()-0.5f)*5.0f;
|
||||
pos.z += (Math::Rand()-0.5f)*5.0f;
|
||||
pos.y += 1.0f;
|
||||
|
@ -158,12 +159,12 @@ bool CAutoRepair::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);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
m_sound->Play(SOUND_OPEN, m_object->RetPosition(0), 1.0f, 0.8f);
|
||||
m_sound->Play(SOUND_OPEN, m_object->GetPosition(0), 1.0f, 0.8f);
|
||||
|
||||
m_phase = ARP_UP;
|
||||
m_progress = 0.0f;
|
||||
|
@ -196,7 +197,7 @@ bool CAutoRepair::EventProcess(const Event &event)
|
|||
|
||||
bool CAutoRepair::CreateInterface(bool bSelect)
|
||||
{
|
||||
CWindow* pw;
|
||||
Ui::CWindow* pw;
|
||||
Math::Point pos, ddim;
|
||||
float ox, oy, sx, sy;
|
||||
|
||||
|
@ -204,7 +205,7 @@ bool CAutoRepair::CreateInterface(bool bSelect)
|
|||
|
||||
if ( !bSelect ) return true;
|
||||
|
||||
pw = (CWindow*)m_interface->SearchControl(EVENT_WINDOW0);
|
||||
pw = static_cast< Ui::CWindow* >(m_interface->SearchControl(EVENT_WINDOW0));
|
||||
if ( pw == 0 ) return false;
|
||||
|
||||
ox = 3.0f/640.0f;
|
||||
|
@ -233,14 +234,14 @@ CObject* CAutoRepair::SearchVehicle()
|
|||
float dist;
|
||||
int i;
|
||||
|
||||
sPos = m_object->RetPosition(0);
|
||||
sPos = m_object->GetPosition(0);
|
||||
|
||||
for ( i=0 ; i<1000000 ; i++ )
|
||||
{
|
||||
pObj = (CObject*)m_iMan->SearchInstance(CLASS_OBJECT, i);
|
||||
pObj = static_cast< CObject* >(m_iMan->SearchInstance(CLASS_OBJECT, i));
|
||||
if ( pObj == 0 ) break;
|
||||
|
||||
type = pObj->RetType();
|
||||
type = pObj->GetType();
|
||||
if ( type != OBJECT_MOBILEfa &&
|
||||
type != OBJECT_MOBILEta &&
|
||||
type != OBJECT_MOBILEwa &&
|
||||
|
@ -269,10 +270,10 @@ CObject* CAutoRepair::SearchVehicle()
|
|||
type != OBJECT_MOBILEit &&
|
||||
type != OBJECT_MOBILEdr ) continue;
|
||||
|
||||
physics = pObj->RetPhysics();
|
||||
if ( physics != 0 && !physics->RetLand() ) continue; // in flight?
|
||||
physics = pObj->GetPhysics();
|
||||
if ( physics != 0 && !physics->GetLand() ) continue; // in flight?
|
||||
|
||||
oPos = pObj->RetPosition(0);
|
||||
oPos = pObj->GetPosition(0);
|
||||
dist = Math::Distance(oPos, sPos);
|
||||
if ( dist <= 5.0f ) return pObj;
|
||||
}
|
||||
|
@ -281,11 +282,11 @@ CObject* CAutoRepair::SearchVehicle()
|
|||
}
|
||||
|
||||
|
||||
// Returns an error due the state of the automation.
|
||||
// Geturns an error due the state of the automation.
|
||||
|
||||
Error CAutoRepair::RetError()
|
||||
Error CAutoRepair::GetError()
|
||||
{
|
||||
if ( m_object->RetVirusMode() )
|
||||
if ( m_object->GetVirusMode() )
|
||||
{
|
||||
return ERR_BAT_VIRUS;
|
||||
}
|
||||
|
@ -327,11 +328,11 @@ bool CAutoRepair::Read(char *line)
|
|||
|
||||
CAuto::Read(line);
|
||||
|
||||
m_phase = (AutoRepairPhase)OpInt(line, "aPhase", ARP_WAIT);
|
||||
m_phase = static_cast< AutoRepairPhase >(OpInt(line, "aPhase", ARP_WAIT));
|
||||
m_progress = OpFloat(line, "aProgress", 0.0f);
|
||||
m_speed = OpFloat(line, "aSpeed", 1.0f);
|
||||
|
||||
m_lastParticule = 0.0f;
|
||||
m_lastParticle = 0.0f;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
// * This file is part of the COLOBOT source code
|
||||
// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch
|
||||
// * Copyright (C) 2012, Polish Portal of Colobot (PPC)
|
||||
// *
|
||||
// * This program is free software: you can redistribute it and/or modify
|
||||
// * it under the terms of the GNU General Public License as published by
|
||||
|
@ -44,7 +45,7 @@ public:
|
|||
|
||||
void Init();
|
||||
bool EventProcess(const Event &event);
|
||||
Error RetError();
|
||||
Error GetError();
|
||||
|
||||
bool CreateInterface(bool bSelect);
|
||||
|
||||
|
@ -59,7 +60,7 @@ protected:
|
|||
float m_progress;
|
||||
float m_speed;
|
||||
float m_timeVirus;
|
||||
float m_lastParticule;
|
||||
float m_lastParticle;
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
// * This file is part of the COLOBOT source code
|
||||
// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch
|
||||
// * Copyright (C) 2012, Polish Portal of Colobot (PPC)
|
||||
// *
|
||||
// * This program is free software: you can redistribute it and/or modify
|
||||
// * it under the terms of the GNU General Public License as published by
|
||||
|
@ -84,7 +85,7 @@ void CAutoResearch::Init()
|
|||
m_time = 0.0f;
|
||||
m_timeVirus = 0.0f;
|
||||
m_lastUpdateTime = 0.0f;
|
||||
m_lastParticule = 0.0f;
|
||||
m_lastParticle = 0.0f;
|
||||
}
|
||||
|
||||
|
||||
|
@ -100,29 +101,29 @@ bool CAutoResearch::EventProcess(const Event &event)
|
|||
|
||||
CAuto::EventProcess(event);
|
||||
|
||||
if ( m_engine->RetPause() ) return true;
|
||||
if ( m_engine->GetPause() ) return true;
|
||||
|
||||
if ( event.event == EVENT_UPDINTERFACE )
|
||||
if ( event.type == EVENT_UPDINTERFACE )
|
||||
{
|
||||
if ( m_object->RetSelect() ) CreateInterface(true);
|
||||
if ( m_object->GetSelect() ) CreateInterface(true);
|
||||
}
|
||||
|
||||
if ( m_object->RetSelect() && // center selected?
|
||||
(event.event == EVENT_OBJECT_RTANK ||
|
||||
event.event == EVENT_OBJECT_RFLY ||
|
||||
event.event == EVENT_OBJECT_RTHUMP ||
|
||||
event.event == EVENT_OBJECT_RCANON ||
|
||||
event.event == EVENT_OBJECT_RTOWER ||
|
||||
event.event == EVENT_OBJECT_RPHAZER ||
|
||||
event.event == EVENT_OBJECT_RSHIELD ||
|
||||
event.event == EVENT_OBJECT_RATOMIC ) )
|
||||
if ( m_object->GetSelect() && // center selected?
|
||||
(event.type == EVENT_OBJECT_RTANK ||
|
||||
event.type == EVENT_OBJECT_RFLY ||
|
||||
event.type == EVENT_OBJECT_RTHUMP ||
|
||||
event.type == EVENT_OBJECT_RCANON ||
|
||||
event.type == EVENT_OBJECT_RTOWER ||
|
||||
event.type == EVENT_OBJECT_RPHAZER ||
|
||||
event.type == EVENT_OBJECT_RSHIELD ||
|
||||
event.type == EVENT_OBJECT_RATOMIC ) )
|
||||
{
|
||||
if ( m_phase != ALP_WAIT )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
m_research = event.event;
|
||||
m_research = event.type;
|
||||
|
||||
if ( TestResearch(m_research) )
|
||||
{
|
||||
|
@ -130,33 +131,33 @@ bool CAutoResearch::EventProcess(const Event &event)
|
|||
return false;
|
||||
}
|
||||
|
||||
power = m_object->RetPower();
|
||||
power = m_object->GetPower();
|
||||
if ( power == 0 )
|
||||
{
|
||||
m_displayText->DisplayError(ERR_RESEARCH_POWER, m_object);
|
||||
return false;
|
||||
}
|
||||
if ( power->RetCapacity() > 1.0f )
|
||||
if ( power->GetCapacity() > 1.0f )
|
||||
{
|
||||
m_displayText->DisplayError(ERR_RESEARCH_TYPE, m_object);
|
||||
return false;
|
||||
}
|
||||
if ( power->RetEnergy() < 1.0f )
|
||||
if ( power->GetEnergy() < 1.0f )
|
||||
{
|
||||
m_displayText->DisplayError(ERR_RESEARCH_ENERGY, m_object);
|
||||
return false;
|
||||
}
|
||||
|
||||
time = SEARCH_TIME;
|
||||
if ( event.event == EVENT_OBJECT_RTANK ) time *= 0.3f;
|
||||
if ( event.event == EVENT_OBJECT_RFLY ) time *= 0.3f;
|
||||
if ( event.event == EVENT_OBJECT_RATOMIC ) time *= 2.0f;
|
||||
if ( event.type == EVENT_OBJECT_RTANK ) time *= 0.3f;
|
||||
if ( event.type == EVENT_OBJECT_RFLY ) time *= 0.3f;
|
||||
if ( event.type == EVENT_OBJECT_RATOMIC ) time *= 2.0f;
|
||||
|
||||
SetBusy(true);
|
||||
InitProgressTotal(time);
|
||||
UpdateInterface();
|
||||
|
||||
m_channelSound = m_sound->Play(SOUND_RESEARCH, m_object->RetPosition(0), 0.0f, 1.0f, true);
|
||||
m_channelSound = m_sound->Play(SOUND_RESEARCH, m_object->GetPosition(0), 0.0f, 1.0f, true);
|
||||
m_sound->AddEnvelope(m_channelSound, 1.0f, 1.0f, 2.0f, SOPER_CONTINUE);
|
||||
m_sound->AddEnvelope(m_channelSound, 1.0f, 1.0f, time-4.0f, SOPER_CONTINUE);
|
||||
m_sound->AddEnvelope(m_channelSound, 0.0f, 1.0f, 2.0f, SOPER_STOP);
|
||||
|
@ -167,12 +168,12 @@ bool CAutoResearch::EventProcess(const Event &event)
|
|||
return true;
|
||||
}
|
||||
|
||||
if ( event.event != EVENT_FRAME ) return true;
|
||||
if ( event.type != EVENT_FRAME ) return true;
|
||||
|
||||
m_progress += event.rTime*m_speed;
|
||||
m_timeVirus -= event.rTime;
|
||||
|
||||
if ( m_object->RetVirusMode() ) // contaminated by a virus?
|
||||
if ( m_object->GetVirusMode() ) // contaminated by a virus?
|
||||
{
|
||||
if ( m_timeVirus <= 0.0f )
|
||||
{
|
||||
|
@ -201,7 +202,7 @@ bool CAutoResearch::EventProcess(const Event &event)
|
|||
FireStopUpdate(m_progress, true); // flashes
|
||||
if ( m_progress < 1.0f )
|
||||
{
|
||||
power = m_object->RetPower();
|
||||
power = m_object->GetPower();
|
||||
if ( power == 0 ) // more battery?
|
||||
{
|
||||
SetBusy(false);
|
||||
|
@ -214,11 +215,11 @@ bool CAutoResearch::EventProcess(const Event &event)
|
|||
}
|
||||
power->SetEnergy(1.0f-m_progress);
|
||||
|
||||
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_object->RetPosition(0);
|
||||
pos = m_object->GetPosition(0);
|
||||
pos.x += (Math::Rand()-0.5f)*6.0f;
|
||||
pos.z += (Math::Rand()-0.5f)*6.0f;
|
||||
pos.y += 11.0f;
|
||||
|
@ -227,7 +228,7 @@ bool CAutoResearch::EventProcess(const Event &event)
|
|||
speed.y = Math::Rand()*20.0f;
|
||||
dim.x = Math::Rand()*1.0f+1.0f;
|
||||
dim.y = dim.x;
|
||||
m_particule->CreateParticule(pos, speed, dim, PARTIVAPOR);
|
||||
m_particle->CreateParticle(pos, speed, dim, Gfx::PARTIVAPOR);
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -262,9 +263,9 @@ bool CAutoResearch::EventProcess(const Event &event)
|
|||
}
|
||||
|
||||
|
||||
// Returns an error due the state of the automation.
|
||||
// Geturns an error due the state of the automation.
|
||||
|
||||
Error CAutoResearch::RetError()
|
||||
Error CAutoResearch::GetError()
|
||||
{
|
||||
CObject* power;
|
||||
|
||||
|
@ -273,21 +274,21 @@ Error CAutoResearch::RetError()
|
|||
return ERR_OK;
|
||||
}
|
||||
|
||||
if ( m_object->RetVirusMode() )
|
||||
if ( m_object->GetVirusMode() )
|
||||
{
|
||||
return ERR_BAT_VIRUS;
|
||||
}
|
||||
|
||||
power = m_object->RetPower();
|
||||
power = m_object->GetPower();
|
||||
if ( power == 0 )
|
||||
{
|
||||
return ERR_RESEARCH_POWER;
|
||||
}
|
||||
if ( power != 0 && power->RetCapacity() > 1.0f )
|
||||
if ( power != 0 && power->GetCapacity() > 1.0f )
|
||||
{
|
||||
return ERR_RESEARCH_TYPE;
|
||||
}
|
||||
if ( power != 0 && power->RetEnergy() < 1.0f )
|
||||
if ( power != 0 && power->GetEnergy() < 1.0f )
|
||||
{
|
||||
return ERR_RESEARCH_ENERGY;
|
||||
}
|
||||
|
@ -300,7 +301,7 @@ Error CAutoResearch::RetError()
|
|||
|
||||
bool CAutoResearch::CreateInterface(bool bSelect)
|
||||
{
|
||||
CWindow* pw;
|
||||
Ui::CWindow* pw;
|
||||
Math::Point pos, dim, ddim;
|
||||
float ox, oy, sx, sy;
|
||||
|
||||
|
@ -308,7 +309,7 @@ bool CAutoResearch::CreateInterface(bool bSelect)
|
|||
|
||||
if ( !bSelect ) return true;
|
||||
|
||||
pw = (CWindow*)m_interface->SearchControl(EVENT_WINDOW0);
|
||||
pw = static_cast< Ui::CWindow* >(m_interface->SearchControl(EVENT_WINDOW0));
|
||||
if ( pw == 0 ) return false;
|
||||
|
||||
dim.x = 33.0f/640.0f;
|
||||
|
@ -371,13 +372,13 @@ bool CAutoResearch::CreateInterface(bool bSelect)
|
|||
|
||||
void CAutoResearch::UpdateInterface()
|
||||
{
|
||||
CWindow* pw;
|
||||
Ui::CWindow* pw;
|
||||
|
||||
if ( !m_object->RetSelect() ) return;
|
||||
if ( !m_object->GetSelect() ) return;
|
||||
|
||||
CAuto::UpdateInterface();
|
||||
|
||||
pw = (CWindow*)m_interface->SearchControl(EVENT_WINDOW0);
|
||||
pw = static_cast< Ui::CWindow* >(m_interface->SearchControl(EVENT_WINDOW0));
|
||||
if ( pw == 0 ) return;
|
||||
|
||||
DeadInterface(pw, EVENT_OBJECT_RTANK, g_researchEnable&RESEARCH_TANK);
|
||||
|
@ -413,8 +414,8 @@ void CAutoResearch::UpdateInterface()
|
|||
|
||||
void CAutoResearch::UpdateInterface(float rTime)
|
||||
{
|
||||
CWindow* pw;
|
||||
CGauge* pg;
|
||||
Ui::CWindow* pw;
|
||||
Ui::CGauge* pg;
|
||||
CObject* power;
|
||||
float energy;
|
||||
|
||||
|
@ -423,19 +424,19 @@ void CAutoResearch::UpdateInterface(float rTime)
|
|||
if ( m_time < m_lastUpdateTime+0.1f ) return;
|
||||
m_lastUpdateTime = m_time;
|
||||
|
||||
if ( !m_object->RetSelect() ) return;
|
||||
if ( !m_object->GetSelect() ) return;
|
||||
|
||||
pw = (CWindow*)m_interface->SearchControl(EVENT_WINDOW0);
|
||||
pw = static_cast< Ui::CWindow* >(m_interface->SearchControl(EVENT_WINDOW0));
|
||||
if ( pw == 0 ) return;
|
||||
|
||||
pg = (CGauge*)pw->SearchControl(EVENT_OBJECT_GENERGY);
|
||||
pg = static_cast< Ui::CGauge* >(pw->SearchControl(EVENT_OBJECT_GENERGY));
|
||||
if ( pg != 0 )
|
||||
{
|
||||
energy = 0.0f;
|
||||
power = m_object->RetPower();
|
||||
power = m_object->GetPower();
|
||||
if ( power != 0 )
|
||||
{
|
||||
energy = power->RetEnergy();
|
||||
energy = power->GetEnergy();
|
||||
}
|
||||
pg->SetLevel(energy);
|
||||
}
|
||||
|
@ -443,20 +444,20 @@ void CAutoResearch::UpdateInterface(float rTime)
|
|||
|
||||
// Research shows already performed button.
|
||||
|
||||
void CAutoResearch::OkayButton(CWindow *pw, EventMsg event)
|
||||
void CAutoResearch::OkayButton(Ui::CWindow *pw, EventType event)
|
||||
{
|
||||
CControl* control;
|
||||
Ui::CControl* control;
|
||||
|
||||
control = pw->SearchControl(event);
|
||||
if ( control == 0 ) return;
|
||||
|
||||
control->SetState(STATE_OKAY, TestResearch(event));
|
||||
control->SetState(Ui::STATE_OKAY, TestResearch(event));
|
||||
}
|
||||
|
||||
|
||||
// Test whether a search has already been done.
|
||||
|
||||
bool CAutoResearch::TestResearch(EventMsg event)
|
||||
bool CAutoResearch::TestResearch(EventType event)
|
||||
{
|
||||
if ( event == EVENT_OBJECT_RTANK ) return (g_researchDone & RESEARCH_TANK );
|
||||
if ( event == EVENT_OBJECT_RFLY ) return (g_researchDone & RESEARCH_FLY );
|
||||
|
@ -472,9 +473,8 @@ bool CAutoResearch::TestResearch(EventMsg event)
|
|||
|
||||
// Indicates a search as made.
|
||||
|
||||
void CAutoResearch::SetResearch(EventMsg event)
|
||||
void CAutoResearch::SetResearch(EventType event)
|
||||
{
|
||||
Event newEvent;
|
||||
|
||||
if ( event == EVENT_OBJECT_RTANK ) g_researchDone |= RESEARCH_TANK;
|
||||
if ( event == EVENT_OBJECT_RFLY ) g_researchDone |= RESEARCH_FLY;
|
||||
|
@ -487,7 +487,7 @@ void CAutoResearch::SetResearch(EventMsg event)
|
|||
|
||||
m_main->WriteFreeParam();
|
||||
|
||||
m_event->MakeEvent(newEvent, EVENT_UPDINTERFACE);
|
||||
Event newEvent(EVENT_UPDINTERFACE);
|
||||
m_event->AddEvent(newEvent);
|
||||
UpdateInterface();
|
||||
}
|
||||
|
@ -518,14 +518,14 @@ void CAutoResearch::FireStopUpdate(float progress, bool bLightOn)
|
|||
{
|
||||
if ( m_partiStop[i] != -1 )
|
||||
{
|
||||
m_particule->DeleteParticule(m_partiStop[i]);
|
||||
m_particle->DeleteParticle(m_partiStop[i]);
|
||||
m_partiStop[i] = -1;
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
mat = m_object->RetWorldMatrix(0);
|
||||
mat = m_object->GetWorldMatrix(0);
|
||||
|
||||
speed = Math::Vector(0.0f, 0.0f, 0.0f);
|
||||
dim.x = 2.0f;
|
||||
|
@ -537,7 +537,7 @@ void CAutoResearch::FireStopUpdate(float progress, bool bLightOn)
|
|||
{
|
||||
if ( m_partiStop[i] != -1 )
|
||||
{
|
||||
m_particule->DeleteParticule(m_partiStop[i]);
|
||||
m_particle->DeleteParticle(m_partiStop[i]);
|
||||
m_partiStop[i] = -1;
|
||||
}
|
||||
}
|
||||
|
@ -549,8 +549,8 @@ void CAutoResearch::FireStopUpdate(float progress, bool bLightOn)
|
|||
pos.y = 11.5f;
|
||||
pos.z = listpos[i*2+1];
|
||||
pos = Math::Transform(*mat, pos);
|
||||
m_partiStop[i] = m_particule->CreateParticule(pos, speed,
|
||||
dim, PARTISELY,
|
||||
m_partiStop[i] = m_particle->CreateParticle(pos, speed,
|
||||
dim, Gfx::PARTISELY,
|
||||
1.0f, 0.0f, 0.0f);
|
||||
}
|
||||
}
|
||||
|
@ -594,13 +594,13 @@ bool CAutoResearch::Read(char *line)
|
|||
|
||||
CAuto::Read(line);
|
||||
|
||||
m_phase = (AutoResearchPhase)OpInt(line, "aPhase", ALP_WAIT);
|
||||
m_phase = static_cast< AutoResearchPhase >(OpInt(line, "aPhase", ALP_WAIT));
|
||||
m_progress = OpFloat(line, "aProgress", 0.0f);
|
||||
m_speed = OpFloat(line, "aSpeed", 1.0f);
|
||||
m_research = (EventMsg)OpInt(line, "aResearch", 0);
|
||||
m_research = static_cast< EventType >(OpInt(line, "aResearch", 0));
|
||||
|
||||
m_lastUpdateTime = 0.0f;
|
||||
m_lastParticule = 0.0f;
|
||||
m_lastParticle = 0.0f;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
// * This file is part of the COLOBOT source code
|
||||
// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch
|
||||
// * Copyright (C) 2012, Polish Portal of Colobot (PPC)
|
||||
// *
|
||||
// * This program is free software: you can redistribute it and/or modify
|
||||
// * it under the terms of the GNU General Public License as published by
|
||||
|
@ -41,7 +42,7 @@ public:
|
|||
|
||||
void Init();
|
||||
bool EventProcess(const Event &event);
|
||||
Error RetError();
|
||||
Error GetError();
|
||||
|
||||
bool CreateInterface(bool bSelect);
|
||||
|
||||
|
@ -51,9 +52,9 @@ public:
|
|||
protected:
|
||||
void UpdateInterface();
|
||||
void UpdateInterface(float rTime);
|
||||
void OkayButton(CWindow *pw, EventMsg event);
|
||||
bool TestResearch(EventMsg event);
|
||||
void SetResearch(EventMsg event);
|
||||
void OkayButton(Ui::CWindow *pw, EventType event);
|
||||
bool TestResearch(EventType event);
|
||||
void SetResearch(EventType event);
|
||||
void FireStopUpdate(float progress, bool bLightOn);
|
||||
|
||||
protected:
|
||||
|
@ -62,8 +63,8 @@ protected:
|
|||
float m_speed;
|
||||
float m_timeVirus;
|
||||
float m_lastUpdateTime;
|
||||
float m_lastParticule;
|
||||
EventMsg m_research;
|
||||
float m_lastParticle;
|
||||
EventType m_research;
|
||||
int m_partiStop[6];
|
||||
int m_channelSound;
|
||||
};
|
||||
|
|
|
@ -19,8 +19,8 @@
|
|||
|
||||
#include "object/auto/autoroot.h"
|
||||
|
||||
#include "old/particule.h"
|
||||
#include "old/terrain.h"
|
||||
#include "graphics/engine/particle.h"
|
||||
#include "graphics/engine/terrain.h"
|
||||
#include "math/geometry.h"
|
||||
|
||||
|
||||
|
@ -58,9 +58,9 @@ void CAutoRoot::Init()
|
|||
Math::Point dim;
|
||||
|
||||
m_time = 0.0f;
|
||||
m_lastParticule = 0.0f;
|
||||
m_lastParticle = 0.0f;
|
||||
|
||||
mat = m_object->RetWorldMatrix(0);
|
||||
mat = m_object->GetWorldMatrix(0);
|
||||
pos = Math::Vector(-5.0f, 28.0f, -4.0f); // peak position
|
||||
pos = Math::Transform(*mat, pos);
|
||||
m_center = pos;
|
||||
|
@ -68,7 +68,7 @@ void CAutoRoot::Init()
|
|||
speed = Math::Vector(0.0f, 0.0f, 0.0f);
|
||||
dim.x = 100.0f;
|
||||
dim.y = dim.x;
|
||||
m_particule->CreateParticule(m_center, speed, dim, PARTISPHERE5, 0.5f, 0.0f, 0.0f);
|
||||
m_particle->CreateParticle(m_center, speed, dim, Gfx::PARTISPHERE5, 0.5f, 0.0f, 0.0f);
|
||||
|
||||
m_terrain->AddFlyingLimit(pos, 100.0f, 80.0f, pos.y-60.0f);
|
||||
}
|
||||
|
@ -83,16 +83,16 @@ bool CAutoRoot::EventProcess(const Event &event)
|
|||
|
||||
CAuto::EventProcess(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_object->SetZoomX(1, 1.0f+sinf(m_time*2.0f)*0.2f);
|
||||
m_object->SetZoomY(1, 1.0f+sinf(m_time*2.3f)*0.2f);
|
||||
m_object->SetZoomZ(1, 1.0f+sinf(m_time*2.7f)*0.2f);
|
||||
|
||||
if ( m_lastParticule+m_engine->ParticuleAdapt(0.10f) <= m_time )
|
||||
if ( m_lastParticle+m_engine->ParticleAdapt(0.10f) <= m_time )
|
||||
{
|
||||
m_lastParticule = m_time;
|
||||
m_lastParticle = m_time;
|
||||
|
||||
pos = m_center;
|
||||
pos.x += (Math::Rand()-0.5f)*8.0f;
|
||||
|
@ -103,16 +103,16 @@ bool CAutoRoot::EventProcess(const Event &event)
|
|||
speed.y = Math::Rand()*12.0f;
|
||||
dim.x = Math::Rand()*6.0f+4.0f;
|
||||
dim.y = dim.x;
|
||||
m_particule->CreateParticule(pos, speed, dim, PARTIROOT, 1.0f, 0.0f, 0.0f);
|
||||
m_particle->CreateParticle(pos, speed, dim, Gfx::PARTIROOT, 1.0f, 0.0f, 0.0f);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
// Returns an error due the state of the automation.
|
||||
// Geturns an error due the state of the automation.
|
||||
|
||||
Error CAutoRoot::RetError()
|
||||
Error CAutoRoot::GetError()
|
||||
{
|
||||
return ERR_OK;
|
||||
}
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
// * This file is part of the COLOBOT source code
|
||||
// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch
|
||||
// * Copyright (C) 2012, Polish Portal of Colobot (PPC)
|
||||
// *
|
||||
// * This program is free software: you can redistribute it and/or modify
|
||||
// * it under the terms of the GNU General Public License as published by
|
||||
|
@ -33,12 +34,12 @@ public:
|
|||
|
||||
void Init();
|
||||
bool EventProcess(const Event &event);
|
||||
Error RetError();
|
||||
Error GetError();
|
||||
|
||||
protected:
|
||||
|
||||
protected:
|
||||
float m_lastParticule;
|
||||
float m_lastParticle;
|
||||
Math::Vector m_center;
|
||||
};
|
||||
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
// * This file is part of the COLOBOT source code
|
||||
// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch
|
||||
// * Copyright (C) 2012, Polish Portal of Colobot (PPC)
|
||||
// *
|
||||
// * This program is free software: you can redistribute it and/or modify
|
||||
// * it under the terms of the GNU General Public License as published by
|
||||
|
@ -44,7 +45,7 @@ CAutoSafe::CAutoSafe(CInstanceManager* iMan, CObject* object)
|
|||
}
|
||||
|
||||
m_bLock = false;
|
||||
m_lastParticule = 0.0f;
|
||||
m_lastParticle = 0.0f;
|
||||
m_channelSound = -1;
|
||||
Init();
|
||||
}
|
||||
|
@ -86,7 +87,7 @@ void CAutoSafe::Init()
|
|||
{
|
||||
m_time = 0.0f;
|
||||
m_timeVirus = 0.0f;
|
||||
m_lastParticule = 0.0f;
|
||||
m_lastParticle = 0.0f;
|
||||
|
||||
m_countKeys = 0;
|
||||
m_actualAngle = 0.0f;
|
||||
|
@ -111,13 +112,13 @@ bool CAutoSafe::EventProcess(const Event &event)
|
|||
|
||||
CAuto::EventProcess(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_progress += event.rTime*m_speed;
|
||||
m_timeVirus -= event.rTime;
|
||||
|
||||
if ( m_object->RetVirusMode() ) // contaminated by a virus?
|
||||
if ( m_object->GetVirusMode() ) // contaminated by a virus?
|
||||
{
|
||||
if ( m_timeVirus <= 0.0f )
|
||||
{
|
||||
|
@ -158,7 +159,7 @@ bool CAutoSafe::EventProcess(const Event &event)
|
|||
{
|
||||
LockKeys();
|
||||
|
||||
m_channelSound = m_sound->Play(SOUND_MANIP, m_object->RetPosition(0), 1.0f, 0.25f, true);
|
||||
m_channelSound = m_sound->Play(SOUND_MANIP, m_object->GetPosition(0), 1.0f, 0.25f, true);
|
||||
m_sound->AddEnvelope(m_channelSound, 1.0f, 2.00f, OPEN_DELAY, SOPER_STOP);
|
||||
|
||||
m_phase = ASAP_OPEN;
|
||||
|
@ -168,7 +169,7 @@ bool CAutoSafe::EventProcess(const Event &event)
|
|||
}
|
||||
else
|
||||
{
|
||||
m_channelSound = m_sound->Play(SOUND_MANIP, m_object->RetPosition(0), 1.0f, 0.25f, true);
|
||||
m_channelSound = m_sound->Play(SOUND_MANIP, m_object->GetPosition(0), 1.0f, 0.25f, true);
|
||||
m_sound->AddEnvelope(m_channelSound, 1.0f, 0.35f, 0.5f, SOPER_STOP);
|
||||
}
|
||||
}
|
||||
|
@ -185,13 +186,13 @@ bool CAutoSafe::EventProcess(const Event &event)
|
|||
{
|
||||
DownKeys(m_progress);
|
||||
|
||||
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;
|
||||
|
||||
for ( i=0 ; i<10 ; i++ )
|
||||
{
|
||||
pos = m_object->RetPosition(0);
|
||||
pos = m_object->GetPosition(0);
|
||||
pos.x += (Math::Rand()-0.5f)*10.0f;
|
||||
pos.z += (Math::Rand()-0.5f)*10.0f;
|
||||
speed.x = (Math::Rand()-0.5f)*4.0f;
|
||||
|
@ -199,10 +200,10 @@ bool CAutoSafe::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);
|
||||
}
|
||||
|
||||
pos = m_object->RetPosition(0);
|
||||
pos = m_object->GetPosition(0);
|
||||
pos.x += (Math::Rand()-0.5f)*10.0f;
|
||||
pos.z += (Math::Rand()-0.5f)*10.0f;
|
||||
speed.x = (Math::Rand()-0.5f)*4.0f;
|
||||
|
@ -210,7 +211,7 @@ bool CAutoSafe::EventProcess(const Event &event)
|
|||
speed.y = Math::Rand()*10.0f;
|
||||
dim.x = Math::Rand()*3.0f+2.0f;
|
||||
dim.y = dim.x;
|
||||
m_particule->CreateParticule(pos, speed, dim, PARTIGLINT, 1.0f, 0.0f, 0.0f);
|
||||
m_particle->CreateParticle(pos, speed, dim, Gfx::PARTIGLINT, 1.0f, 0.0f, 0.0f);
|
||||
|
||||
for ( i=0 ; i<4 ; i++ )
|
||||
{
|
||||
|
@ -220,7 +221,7 @@ bool CAutoSafe::EventProcess(const Event &event)
|
|||
speed.y = 1.0f+Math::Rand()*1.0f;
|
||||
dim.x = Math::Rand()*1.5f+1.5f;
|
||||
dim.y = dim.x;
|
||||
m_particule->CreateParticule(pos, speed, dim, PARTISMOKE3, 4.0f, 0.0f, 0.0f);
|
||||
m_particle->CreateParticle(pos, speed, dim, Gfx::PARTISMOKE3, 4.0f, 0.0f, 0.0f);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -238,7 +239,7 @@ bool CAutoSafe::EventProcess(const Event &event)
|
|||
m_object->FlushCrashShere();
|
||||
m_object->SetGlobalSphere(Math::Vector(0.0f, 0.0f, 0.0f), 0.0f);
|
||||
|
||||
m_sound->Play(SOUND_FINDING, m_object->RetPosition(0));
|
||||
m_sound->Play(SOUND_FINDING, m_object->GetPosition(0));
|
||||
|
||||
m_phase = ASAP_FINISH;
|
||||
m_progress = 0.0f;
|
||||
|
@ -283,7 +284,7 @@ bool CAutoSafe::EventProcess(const Event &event)
|
|||
{
|
||||
if ( m_keyParti[i] != -1 )
|
||||
{
|
||||
m_particule->DeleteParticule(m_keyParti[i]);
|
||||
m_particle->DeleteParticle(m_keyParti[i]);
|
||||
m_keyParti[i] = -1;
|
||||
}
|
||||
}
|
||||
|
@ -293,7 +294,7 @@ bool CAutoSafe::EventProcess(const Event &event)
|
|||
{
|
||||
pos = m_keyPos[i];
|
||||
pos.y += 2.2f;
|
||||
m_keyParti[i] = m_particule->CreateParticule(pos, speed, dim, PARTISELY, 1.0f, 0.0f, 0.0f);
|
||||
m_keyParti[i] = m_particle->CreateParticle(pos, speed, dim, Gfx::PARTISELY, 1.0f, 0.0f, 0.0f);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -306,7 +307,7 @@ bool CAutoSafe::EventProcess(const Event &event)
|
|||
|
||||
bool CAutoSafe::CreateInterface(bool bSelect)
|
||||
{
|
||||
CWindow* pw;
|
||||
Ui::CWindow* pw;
|
||||
Math::Point pos, ddim;
|
||||
float ox, oy, sx, sy;
|
||||
|
||||
|
@ -314,7 +315,7 @@ bool CAutoSafe::CreateInterface(bool bSelect)
|
|||
|
||||
if ( !bSelect ) return true;
|
||||
|
||||
pw = (CWindow*)m_interface->SearchControl(EVENT_WINDOW0);
|
||||
pw = static_cast< Ui::CWindow* >(m_interface->SearchControl(EVENT_WINDOW0));
|
||||
if ( pw == 0 ) return false;
|
||||
|
||||
ox = 3.0f/640.0f;
|
||||
|
@ -332,11 +333,11 @@ bool CAutoSafe::CreateInterface(bool bSelect)
|
|||
}
|
||||
|
||||
|
||||
// Returns an error due the state of the automation.
|
||||
// Geturns an error due the state of the automation.
|
||||
|
||||
Error CAutoSafe::RetError()
|
||||
Error CAutoSafe::GetError()
|
||||
{
|
||||
if ( m_object->RetVirusMode() )
|
||||
if ( m_object->GetVirusMode() )
|
||||
{
|
||||
return ERR_BAT_VIRUS;
|
||||
}
|
||||
|
@ -377,11 +378,11 @@ bool CAutoSafe::Read(char *line)
|
|||
|
||||
CAuto::Read(line);
|
||||
|
||||
m_phase = (AutoSafePhase)OpInt(line, "aPhase", ASAP_WAIT);
|
||||
m_phase = static_cast< AutoSafePhase >(OpInt(line, "aPhase", ASAP_WAIT));
|
||||
m_progress = OpFloat(line, "aProgress", 0.0f);
|
||||
m_speed = OpFloat(line, "aSpeed", 1.0f);
|
||||
|
||||
m_lastParticule = 0.0f;
|
||||
m_lastParticle = 0.0f;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -398,8 +399,8 @@ int CAutoSafe::CountKeys()
|
|||
float dist, angle, limit, cAngle, oAngle;
|
||||
int i, index;
|
||||
|
||||
cPos = m_object->RetPosition(0);
|
||||
cAngle = m_object->RetAngleY(0);
|
||||
cPos = m_object->GetPosition(0);
|
||||
cAngle = m_object->GetAngleY(0);
|
||||
|
||||
for ( index=0 ; index<4 ; index++ )
|
||||
{
|
||||
|
@ -409,18 +410,18 @@ int CAutoSafe::CountKeys()
|
|||
|
||||
for ( i=0 ; i<1000000 ; i++ )
|
||||
{
|
||||
pObj = (CObject*)m_iMan->SearchInstance(CLASS_OBJECT, i);
|
||||
pObj = static_cast< CObject* >(m_iMan->SearchInstance(CLASS_OBJECT, i));
|
||||
if ( pObj == 0 ) break;
|
||||
|
||||
oType = pObj->RetType();
|
||||
if ( pObj->RetTruck() != 0 ) continue;
|
||||
oType = pObj->GetType();
|
||||
if ( pObj->GetTruck() != 0 ) continue;
|
||||
|
||||
if ( oType != OBJECT_KEYa &&
|
||||
oType != OBJECT_KEYb &&
|
||||
oType != OBJECT_KEYc &&
|
||||
oType != OBJECT_KEYd ) continue;
|
||||
|
||||
oPos = pObj->RetPosition(0);
|
||||
oPos = pObj->GetPosition(0);
|
||||
dist = Math::DistanceProjected(oPos, cPos);
|
||||
if ( dist > 20.0f ) continue;
|
||||
|
||||
|
@ -482,22 +483,22 @@ void CAutoSafe::LockKeys()
|
|||
float dist;
|
||||
int i;
|
||||
|
||||
cPos = m_object->RetPosition(0);
|
||||
cPos = m_object->GetPosition(0);
|
||||
|
||||
for ( i=0 ; i<1000000 ; i++ )
|
||||
{
|
||||
pObj = (CObject*)m_iMan->SearchInstance(CLASS_OBJECT, i);
|
||||
pObj = static_cast< CObject* >(m_iMan->SearchInstance(CLASS_OBJECT, i));
|
||||
if ( pObj == 0 ) break;
|
||||
|
||||
oType = pObj->RetType();
|
||||
if ( pObj->RetTruck() != 0 ) continue;
|
||||
oType = pObj->GetType();
|
||||
if ( pObj->GetTruck() != 0 ) continue;
|
||||
|
||||
if ( oType != OBJECT_KEYa &&
|
||||
oType != OBJECT_KEYb &&
|
||||
oType != OBJECT_KEYc &&
|
||||
oType != OBJECT_KEYd ) continue;
|
||||
|
||||
oPos = pObj->RetPosition(0);
|
||||
oPos = pObj->GetPosition(0);
|
||||
dist = Math::DistanceProjected(oPos, cPos);
|
||||
if ( dist > 20.0f ) continue;
|
||||
|
||||
|
@ -515,22 +516,22 @@ void CAutoSafe::DownKeys(float progress)
|
|||
float dist;
|
||||
int i;
|
||||
|
||||
cPos = m_object->RetPosition(0);
|
||||
cPos = m_object->GetPosition(0);
|
||||
|
||||
for ( i=0 ; i<1000000 ; i++ )
|
||||
{
|
||||
pObj = (CObject*)m_iMan->SearchInstance(CLASS_OBJECT, i);
|
||||
pObj = static_cast< CObject* >(m_iMan->SearchInstance(CLASS_OBJECT, i));
|
||||
if ( pObj == 0 ) break;
|
||||
|
||||
oType = pObj->RetType();
|
||||
if ( pObj->RetTruck() != 0 ) continue;
|
||||
oType = pObj->GetType();
|
||||
if ( pObj->GetTruck() != 0 ) continue;
|
||||
|
||||
if ( oType != OBJECT_KEYa &&
|
||||
oType != OBJECT_KEYb &&
|
||||
oType != OBJECT_KEYc &&
|
||||
oType != OBJECT_KEYd ) continue;
|
||||
|
||||
oPos = pObj->RetPosition(0);
|
||||
oPos = pObj->GetPosition(0);
|
||||
dist = Math::DistanceProjected(oPos, cPos);
|
||||
if ( dist > 20.0f ) continue;
|
||||
|
||||
|
@ -550,25 +551,25 @@ void CAutoSafe::DeleteKeys()
|
|||
int i;
|
||||
bool bDelete;
|
||||
|
||||
cPos = m_object->RetPosition(0);
|
||||
cPos = m_object->GetPosition(0);
|
||||
|
||||
do
|
||||
{
|
||||
bDelete = false;
|
||||
for ( i=0 ; i<1000000 ; i++ )
|
||||
{
|
||||
pObj = (CObject*)m_iMan->SearchInstance(CLASS_OBJECT, i);
|
||||
pObj = static_cast< CObject* >(m_iMan->SearchInstance(CLASS_OBJECT, i));
|
||||
if ( pObj == 0 ) break;
|
||||
|
||||
oType = pObj->RetType();
|
||||
if ( pObj->RetTruck() != 0 ) continue;
|
||||
oType = pObj->GetType();
|
||||
if ( pObj->GetTruck() != 0 ) continue;
|
||||
|
||||
if ( oType != OBJECT_KEYa &&
|
||||
oType != OBJECT_KEYb &&
|
||||
oType != OBJECT_KEYc &&
|
||||
oType != OBJECT_KEYd ) continue;
|
||||
|
||||
oPos = pObj->RetPosition(0);
|
||||
oPos = pObj->GetPosition(0);
|
||||
dist = Math::DistanceProjected(oPos, cPos);
|
||||
if ( dist > 20.0f ) continue;
|
||||
|
||||
|
@ -590,18 +591,18 @@ CObject* CAutoSafe::SearchVehicle()
|
|||
float dist;
|
||||
int i;
|
||||
|
||||
cPos = m_object->RetPosition(0);
|
||||
cPos = m_object->GetPosition(0);
|
||||
|
||||
for ( i=0 ; i<1000000 ; i++ )
|
||||
{
|
||||
pObj = (CObject*)m_iMan->SearchInstance(CLASS_OBJECT, i);
|
||||
pObj = static_cast< CObject* >(m_iMan->SearchInstance(CLASS_OBJECT, i));
|
||||
if ( pObj == 0 ) break;
|
||||
|
||||
oType = pObj->RetType();
|
||||
oType = pObj->GetType();
|
||||
if ( pObj == m_object ) continue;
|
||||
if ( pObj->RetTruck() != 0 ) continue;
|
||||
if ( pObj->GetTruck() != 0 ) continue;
|
||||
|
||||
oPos = pObj->RetPosition(0);
|
||||
oPos = pObj->GetPosition(0);
|
||||
dist = Math::DistanceProjected(oPos, cPos);
|
||||
if ( dist <= 4.0f ) return pObj;
|
||||
}
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
// * This file is part of the COLOBOT source code
|
||||
// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch
|
||||
// * Copyright (C) 2012, Polish Portal of Colobot (PPC)
|
||||
// *
|
||||
// * This program is free software: you can redistribute it and/or modify
|
||||
// * it under the terms of the GNU General Public License as published by
|
||||
|
@ -42,7 +43,7 @@ public:
|
|||
|
||||
void Init();
|
||||
bool EventProcess(const Event &event);
|
||||
Error RetError();
|
||||
Error GetError();
|
||||
|
||||
bool CreateInterface(bool bSelect);
|
||||
|
||||
|
@ -61,7 +62,7 @@ protected:
|
|||
float m_progress;
|
||||
float m_speed;
|
||||
float m_timeVirus;
|
||||
float m_lastParticule;
|
||||
float m_lastParticle;
|
||||
int m_channelSound;
|
||||
bool m_bLock;
|
||||
int m_countKeys;
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
// * This file is part of the COLOBOT source code
|
||||
// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch
|
||||
// * Copyright (C) 2012, Polish Portal of Colobot (PPC)
|
||||
// *
|
||||
// * This program is free software: you can redistribute it and/or modify
|
||||
// * it under the terms of the GNU General Public License as published by
|
||||
|
@ -20,8 +21,8 @@
|
|||
#include "object/auto/autostation.h"
|
||||
|
||||
#include "common/iman.h"
|
||||
#include "old/particule.h"
|
||||
#include "old/terrain.h"
|
||||
#include "graphics/engine/particle.h"
|
||||
#include "graphics/engine/terrain.h"
|
||||
#include "math/geometry.h"
|
||||
#include "ui/interface.h"
|
||||
#include "ui/gauge.h"
|
||||
|
@ -66,7 +67,7 @@ void CAutoStation::Init()
|
|||
m_time = 0.0f;
|
||||
m_timeVirus = 0.0f;
|
||||
m_lastUpdateTime = 0.0f;
|
||||
m_lastParticule = 0.0f;
|
||||
m_lastParticle = 0.0f;
|
||||
m_soundChannel = -1;
|
||||
m_bLastVirus = false;
|
||||
|
||||
|
@ -83,22 +84,22 @@ bool CAutoStation::EventProcess(const Event &event)
|
|||
Math::Point dim;
|
||||
CObject* vehicule;
|
||||
CObject* power;
|
||||
TerrainRes res;
|
||||
Gfx::TerrainRes res;
|
||||
float big, energy, used, add, freq;
|
||||
|
||||
CAuto::EventProcess(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_timeVirus -= event.rTime;
|
||||
|
||||
if ( m_object->RetVirusMode() ) // contaminated by a virus?
|
||||
if ( m_object->GetVirusMode() ) // contaminated by a virus?
|
||||
{
|
||||
if ( !m_bLastVirus )
|
||||
{
|
||||
m_bLastVirus = true;
|
||||
m_energyVirus = m_object->RetEnergy();
|
||||
m_energyVirus = m_object->GetEnergy();
|
||||
}
|
||||
|
||||
if ( m_timeVirus <= 0.0f )
|
||||
|
@ -120,10 +121,10 @@ bool CAutoStation::EventProcess(const Event &event)
|
|||
|
||||
UpdateInterface(event.rTime);
|
||||
|
||||
big = m_object->RetEnergy();
|
||||
big = m_object->GetEnergy();
|
||||
|
||||
res = m_terrain->RetResource(m_object->RetPosition(0));
|
||||
if ( res == TR_POWER )
|
||||
res = m_terrain->GetResource(m_object->GetPosition(0));
|
||||
if ( res == Gfx::TR_POWER )
|
||||
{
|
||||
big += event.rTime*0.01f; // recharges the large battery
|
||||
}
|
||||
|
@ -135,10 +136,10 @@ bool CAutoStation::EventProcess(const Event &event)
|
|||
vehicule = SearchVehicle();
|
||||
if ( vehicule != 0 )
|
||||
{
|
||||
power = vehicule->RetPower();
|
||||
if ( power != 0 && power->RetCapacity() == 1.0f )
|
||||
power = vehicule->GetPower();
|
||||
if ( power != 0 && power->GetCapacity() == 1.0f )
|
||||
{
|
||||
energy = power->RetEnergy();
|
||||
energy = power->GetEnergy();
|
||||
add = event.rTime*0.2f;
|
||||
if ( add > big*4.0f ) add = big*4.0f;
|
||||
if ( add > 1.0f-energy ) add = 1.0f-energy;
|
||||
|
@ -148,10 +149,10 @@ bool CAutoStation::EventProcess(const Event &event)
|
|||
big -= add/4.0f; // discharge the large battery
|
||||
}
|
||||
|
||||
power = vehicule->RetFret();
|
||||
if ( power != 0 && power->RetType() == OBJECT_POWER )
|
||||
power = vehicule->GetFret();
|
||||
if ( power != 0 && power->GetType() == OBJECT_POWER )
|
||||
{
|
||||
energy = power->RetEnergy();
|
||||
energy = power->GetEnergy();
|
||||
add = event.rTime*0.2f;
|
||||
if ( add > big*4.0f ) add = big*4.0f;
|
||||
if ( add > 1.0f-energy ) add = 1.0f-energy;
|
||||
|
@ -169,7 +170,7 @@ bool CAutoStation::EventProcess(const Event &event)
|
|||
freq = 1.0f+3.0f*freq;
|
||||
if ( m_soundChannel == -1 )
|
||||
{
|
||||
m_soundChannel = m_sound->Play(SOUND_STATION, m_object->RetPosition(0),
|
||||
m_soundChannel = m_sound->Play(SOUND_STATION, m_object->GetPosition(0),
|
||||
0.3f, freq, true);
|
||||
}
|
||||
m_sound->Frequency(m_soundChannel, freq);
|
||||
|
@ -184,11 +185,11 @@ bool CAutoStation::EventProcess(const Event &event)
|
|||
}
|
||||
|
||||
if ( used != 0.0f &&
|
||||
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(-15.0f, 7.0f, 0.0f); // battery position
|
||||
pos = Math::Transform(*mat, pos);
|
||||
speed.x = (Math::Rand()-0.5f)*20.0f;
|
||||
|
@ -199,7 +200,7 @@ bool CAutoStation::EventProcess(const Event &event)
|
|||
ppos.z = pos.z;
|
||||
dim.x = 1.5f;
|
||||
dim.y = 1.5f;
|
||||
m_particule->CreateParticule(ppos, speed, dim, PARTIBLITZ, 1.0f, 0.0f, 0.0f);
|
||||
m_particle->CreateParticle(ppos, speed, dim, Gfx::PARTIBLITZ, 1.0f, 0.0f, 0.0f);
|
||||
|
||||
#if 0
|
||||
ppos = pos;
|
||||
|
@ -211,7 +212,7 @@ bool CAutoStation::EventProcess(const Event &event)
|
|||
speed.y = 2.5f+Math::Rand()*6.0f;
|
||||
dim.x = Math::Rand()*1.5f+1.0f;
|
||||
dim.y = dim.x;
|
||||
m_particule->CreateParticule(ppos, speed, dim, PARTISMOKE3, 4.0f);
|
||||
m_particle->CreateParticle(ppos, speed, dim, Gfx::PARTISMOKE3, 4.0f);
|
||||
#else
|
||||
ppos = pos;
|
||||
ppos.y += 1.0f;
|
||||
|
@ -222,7 +223,7 @@ bool CAutoStation::EventProcess(const Event &event)
|
|||
speed.y = 2.5f+Math::Rand()*5.0f;
|
||||
dim.x = Math::Rand()*1.0f+0.6f;
|
||||
dim.y = dim.x;
|
||||
m_particule->CreateParticule(ppos, speed, dim, PARTIVAPOR, 3.0f);
|
||||
m_particle->CreateParticle(ppos, speed, dim, Gfx::PARTIVAPOR, 3.0f);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -244,14 +245,14 @@ CObject* CAutoStation::SearchVehicle()
|
|||
float dist;
|
||||
int i;
|
||||
|
||||
sPos = m_object->RetPosition(0);
|
||||
sPos = m_object->GetPosition(0);
|
||||
|
||||
for ( i=0 ; i<1000000 ; i++ )
|
||||
{
|
||||
pObj = (CObject*)m_iMan->SearchInstance(CLASS_OBJECT, i);
|
||||
pObj = static_cast< CObject* >(m_iMan->SearchInstance(CLASS_OBJECT, i));
|
||||
if ( pObj == 0 ) break;
|
||||
|
||||
type = pObj->RetType();
|
||||
type = pObj->GetType();
|
||||
if ( type != OBJECT_HUMAN &&
|
||||
type != OBJECT_MOBILEfa &&
|
||||
type != OBJECT_MOBILEta &&
|
||||
|
@ -280,7 +281,7 @@ CObject* CAutoStation::SearchVehicle()
|
|||
type != OBJECT_MOBILEit &&
|
||||
type != OBJECT_MOBILEdr ) continue;
|
||||
|
||||
oPos = pObj->RetPosition(0);
|
||||
oPos = pObj->GetPosition(0);
|
||||
dist = Math::Distance(oPos, sPos);
|
||||
if ( dist <= 5.0f ) return pObj;
|
||||
}
|
||||
|
@ -289,19 +290,19 @@ CObject* CAutoStation::SearchVehicle()
|
|||
}
|
||||
|
||||
|
||||
// Returns an error due the state of the automation.
|
||||
// Geturns an error due the state of the automation.
|
||||
|
||||
Error CAutoStation::RetError()
|
||||
Error CAutoStation::GetError()
|
||||
{
|
||||
TerrainRes res;
|
||||
Gfx::TerrainRes res;
|
||||
|
||||
if ( m_object->RetVirusMode() )
|
||||
if ( m_object->GetVirusMode() )
|
||||
{
|
||||
return ERR_BAT_VIRUS;
|
||||
}
|
||||
|
||||
res = m_terrain->RetResource(m_object->RetPosition(0));
|
||||
if ( res != TR_POWER ) return ERR_STATION_NULL;
|
||||
res = m_terrain->GetResource(m_object->GetPosition(0));
|
||||
if ( res != Gfx::TR_POWER ) return ERR_STATION_NULL;
|
||||
|
||||
return ERR_OK;
|
||||
}
|
||||
|
@ -311,7 +312,7 @@ Error CAutoStation::RetError()
|
|||
|
||||
bool CAutoStation::CreateInterface(bool bSelect)
|
||||
{
|
||||
CWindow* pw;
|
||||
Ui::CWindow* pw;
|
||||
Math::Point pos, ddim;
|
||||
float ox, oy, sx, sy;
|
||||
|
||||
|
@ -319,7 +320,7 @@ bool CAutoStation::CreateInterface(bool bSelect)
|
|||
|
||||
if ( !bSelect ) return true;
|
||||
|
||||
pw = (CWindow*)m_interface->SearchControl(EVENT_WINDOW0);
|
||||
pw = static_cast< Ui::CWindow* >(m_interface->SearchControl(EVENT_WINDOW0));
|
||||
if ( pw == 0 ) return false;
|
||||
|
||||
ox = 3.0f/640.0f;
|
||||
|
@ -347,23 +348,23 @@ bool CAutoStation::CreateInterface(bool bSelect)
|
|||
|
||||
void CAutoStation::UpdateInterface(float rTime)
|
||||
{
|
||||
CWindow* pw;
|
||||
CGauge* pg;
|
||||
Ui::CWindow* pw;
|
||||
Ui::CGauge* pg;
|
||||
|
||||
CAuto::UpdateInterface(rTime);
|
||||
|
||||
if ( m_time < m_lastUpdateTime+0.1f ) return;
|
||||
m_lastUpdateTime = m_time;
|
||||
|
||||
if ( !m_object->RetSelect() ) return;
|
||||
if ( !m_object->GetSelect() ) return;
|
||||
|
||||
pw = (CWindow*)m_interface->SearchControl(EVENT_WINDOW0);
|
||||
pw = static_cast< Ui::CWindow* >(m_interface->SearchControl(EVENT_WINDOW0));
|
||||
if ( pw == 0 ) return;
|
||||
|
||||
pg = (CGauge*)pw->SearchControl(EVENT_OBJECT_GENERGY);
|
||||
pg = static_cast< Ui::CGauge* >(pw->SearchControl(EVENT_OBJECT_GENERGY));
|
||||
if ( pg != 0 )
|
||||
{
|
||||
pg->SetLevel(m_object->RetEnergy());
|
||||
pg->SetLevel(m_object->GetEnergy());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
// * This file is part of the COLOBOT source code
|
||||
// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch
|
||||
// * Copyright (C) 2012, Polish Portal of Colobot (PPC)
|
||||
// *
|
||||
// * This program is free software: you can redistribute it and/or modify
|
||||
// * it under the terms of the GNU General Public License as published by
|
||||
|
@ -33,7 +34,7 @@ public:
|
|||
|
||||
void Init();
|
||||
bool EventProcess(const Event &event);
|
||||
Error RetError();
|
||||
Error GetError();
|
||||
|
||||
bool CreateInterface(bool bSelect);
|
||||
|
||||
|
@ -47,7 +48,7 @@ protected:
|
|||
float m_speed;
|
||||
float m_timeVirus;
|
||||
float m_lastUpdateTime;
|
||||
float m_lastParticule;
|
||||
float m_lastParticle;
|
||||
int m_soundChannel;
|
||||
Math::Vector m_fretPos;
|
||||
bool m_bLastVirus;
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
// * This file is part of the COLOBOT source code
|
||||
// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch
|
||||
// * Copyright (C) 2012, Polish Portal of Colobot (PPC)
|
||||
// *
|
||||
// * This program is free software: you can redistribute it and/or modify
|
||||
// * it under the terms of the GNU General Public License as published by
|
||||
|
@ -78,7 +79,7 @@ void CAutoTower::Init()
|
|||
m_time = 0.0f;
|
||||
m_timeVirus = 0.0f;
|
||||
m_lastUpdateTime = 0.0f;
|
||||
m_lastParticule = 0.0f;
|
||||
m_lastParticle = 0.0f;
|
||||
}
|
||||
|
||||
|
||||
|
@ -93,18 +94,18 @@ bool CAutoTower::EventProcess(const Event &event)
|
|||
|
||||
CAuto::EventProcess(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_timeVirus -= event.rTime;
|
||||
|
||||
if ( m_object->RetVirusMode() ) // contaminated by a virus?
|
||||
if ( m_object->GetVirusMode() ) // contaminated by a virus?
|
||||
{
|
||||
if ( m_timeVirus <= 0.0f )
|
||||
{
|
||||
m_timeVirus = 0.1f+Math::Rand()*0.3f;
|
||||
|
||||
angle = m_object->RetAngleY(1);
|
||||
angle = m_object->GetAngleY(1);
|
||||
angle += Math::Rand()*0.5f;
|
||||
m_object->SetAngleY(1, angle);
|
||||
|
||||
|
@ -125,10 +126,10 @@ bool CAutoTower::EventProcess(const Event &event)
|
|||
if ( m_progress < 1.0f )
|
||||
{
|
||||
energy = 0.0f;
|
||||
power = m_object->RetPower();
|
||||
power = m_object->GetPower();
|
||||
if ( power != 0 )
|
||||
{
|
||||
energy = power->RetEnergy();
|
||||
energy = power->GetEnergy();
|
||||
}
|
||||
if ( energy >= ENERGY_FIRE )
|
||||
{
|
||||
|
@ -153,11 +154,11 @@ bool CAutoTower::EventProcess(const Event &event)
|
|||
quick = 1.0f;
|
||||
//? if ( g_researchDone & RESEARCH_QUICK ) quick = 3.0f;
|
||||
|
||||
angle = m_object->RetAngleY(1);
|
||||
angle = m_object->GetAngleY(1);
|
||||
angle -= event.rTime*quick*2.0f;
|
||||
m_object->SetAngleY(1, angle);
|
||||
|
||||
angle = m_object->RetAngleZ(2);
|
||||
angle = m_object->GetAngleZ(2);
|
||||
angle += event.rTime*quick*0.5f;
|
||||
if ( angle > 0.0f ) angle = 0.0f;
|
||||
m_object->SetAngleZ(2, angle);
|
||||
|
@ -165,10 +166,10 @@ bool CAutoTower::EventProcess(const Event &event)
|
|||
else
|
||||
{
|
||||
energy = 0.0f;
|
||||
power = m_object->RetPower();
|
||||
power = m_object->GetPower();
|
||||
if ( power != 0 )
|
||||
{
|
||||
energy = power->RetEnergy();
|
||||
energy = power->GetEnergy();
|
||||
}
|
||||
|
||||
target = SearchTarget(m_targetPos);
|
||||
|
@ -184,16 +185,16 @@ bool CAutoTower::EventProcess(const Event &event)
|
|||
}
|
||||
else
|
||||
{
|
||||
pos = m_object->RetPosition(0);
|
||||
pos = m_object->GetPosition(0);
|
||||
pos.y += 24.5f;
|
||||
m_angleYfinal = Math::RotateAngle(m_targetPos.x-pos.x, pos.z-m_targetPos.z); // CW !
|
||||
m_angleYfinal += Math::PI*2.0f;
|
||||
m_angleYfinal -= m_object->RetAngleY(0);
|
||||
m_angleYactual = Math::NormAngle(m_object->RetAngleY(1));
|
||||
m_angleYfinal -= m_object->GetAngleY(0);
|
||||
m_angleYactual = Math::NormAngle(m_object->GetAngleY(1));
|
||||
|
||||
m_angleZfinal = -Math::PI/2.0f;
|
||||
m_angleZfinal -= Math::RotateAngle(Math::DistanceProjected(m_targetPos, pos), pos.y-m_targetPos.y); // CW !
|
||||
m_angleZactual = m_object->RetAngleZ(2);
|
||||
m_angleZactual = m_object->GetAngleZ(2);
|
||||
|
||||
m_phase = ATP_TURN;
|
||||
m_progress = 0.0f;
|
||||
|
@ -218,15 +219,15 @@ bool CAutoTower::EventProcess(const Event &event)
|
|||
m_object->SetAngleY(1, m_angleYfinal);
|
||||
m_object->SetAngleZ(2, m_angleZfinal);
|
||||
|
||||
power = m_object->RetPower();
|
||||
power = m_object->GetPower();
|
||||
if ( power != 0 )
|
||||
{
|
||||
energy = power->RetEnergy();
|
||||
energy -= ENERGY_FIRE/power->RetCapacity();
|
||||
energy = power->GetEnergy();
|
||||
energy -= ENERGY_FIRE/power->GetCapacity();
|
||||
power->SetEnergy(energy);
|
||||
}
|
||||
|
||||
m_sound->Play(SOUND_GGG, m_object->RetPosition(0));
|
||||
m_sound->Play(SOUND_GGG, m_object->GetPosition(0));
|
||||
|
||||
m_phase = ATP_FIRE;
|
||||
m_progress = 0.0f;
|
||||
|
@ -238,9 +239,9 @@ bool CAutoTower::EventProcess(const Event &event)
|
|||
{
|
||||
if ( m_progress == 0.0f )
|
||||
{
|
||||
pos = m_object->RetPosition(0);
|
||||
pos = m_object->GetPosition(0);
|
||||
pos.y += 24.5f;
|
||||
m_particule->CreateRay(pos, m_targetPos, PARTIRAY1,
|
||||
m_particle->CreateRay(pos, m_targetPos, Gfx::PARTIRAY1,
|
||||
Math::Point(5.0f, 5.0f), 1.5f);
|
||||
}
|
||||
if ( m_progress >= 1.0f )
|
||||
|
@ -267,30 +268,30 @@ CObject* CAutoTower::SearchTarget(Math::Vector &impact)
|
|||
float distance, min, radius, speed;
|
||||
int i;
|
||||
|
||||
iPos = m_object->RetPosition(0);
|
||||
iPos = m_object->GetPosition(0);
|
||||
min = 1000000.0f;
|
||||
|
||||
for ( i=0 ; i<1000000 ; i++ )
|
||||
{
|
||||
pObj = (CObject*)m_iMan->SearchInstance(CLASS_OBJECT, i);
|
||||
pObj = static_cast< CObject* >(m_iMan->SearchInstance(CLASS_OBJECT, i));
|
||||
if ( pObj == 0 ) break;
|
||||
|
||||
oType = pObj->RetType();
|
||||
oType = pObj->GetType();
|
||||
if ( oType != OBJECT_MOTHER &&
|
||||
oType != OBJECT_ANT &&
|
||||
oType != OBJECT_SPIDER &&
|
||||
oType != OBJECT_BEE &&
|
||||
oType != OBJECT_WORM ) continue;
|
||||
|
||||
if ( !pObj->RetActif() ) continue; // inactive?
|
||||
if ( !pObj->GetActif() ) continue; // inactive?
|
||||
|
||||
//? if ( g_researchDone & RESEARCH_QUICK )
|
||||
if ( false )
|
||||
{
|
||||
physics = pObj->RetPhysics();
|
||||
physics = pObj->GetPhysics();
|
||||
if ( physics != 0 )
|
||||
{
|
||||
speed = fabs(physics->RetLinMotionX(MO_REASPEED));
|
||||
speed = fabs(physics->GetLinMotionX(MO_REASPEED));
|
||||
if ( speed > 20.0f ) continue; // moving too fast?
|
||||
}
|
||||
}
|
||||
|
@ -306,30 +307,30 @@ CObject* CAutoTower::SearchTarget(Math::Vector &impact)
|
|||
}
|
||||
if ( pBest == 0 ) return 0;
|
||||
|
||||
impact = pBest->RetPosition(0);
|
||||
impact = pBest->GetPosition(0);
|
||||
return pBest;
|
||||
}
|
||||
|
||||
|
||||
// Returns an error due the state of the automation.
|
||||
// Geturns an error due the state of the automation.
|
||||
|
||||
Error CAutoTower::RetError()
|
||||
Error CAutoTower::GetError()
|
||||
{
|
||||
CObject* power;
|
||||
|
||||
if ( m_object->RetVirusMode() )
|
||||
if ( m_object->GetVirusMode() )
|
||||
{
|
||||
return ERR_BAT_VIRUS;
|
||||
}
|
||||
|
||||
power = m_object->RetPower();
|
||||
power = m_object->GetPower();
|
||||
if ( power == 0 )
|
||||
{
|
||||
return ERR_TOWER_POWER; // no battery
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( power->RetEnergy() < ENERGY_FIRE )
|
||||
if ( power->GetEnergy() < ENERGY_FIRE )
|
||||
{
|
||||
return ERR_TOWER_ENERGY; // not enough energy
|
||||
}
|
||||
|
@ -361,14 +362,14 @@ void CAutoTower::FireStopUpdate(float progress, bool bLightOn)
|
|||
{
|
||||
if ( m_partiStop[i] != -1 )
|
||||
{
|
||||
m_particule->DeleteParticule(m_partiStop[i]);
|
||||
m_particle->DeleteParticle(m_partiStop[i]);
|
||||
m_partiStop[i] = -1;
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
mat = m_object->RetWorldMatrix(0);
|
||||
mat = m_object->GetWorldMatrix(0);
|
||||
|
||||
speed = Math::Vector(0.0f, 0.0f, 0.0f);
|
||||
dim.x = 2.0f;
|
||||
|
@ -380,7 +381,7 @@ void CAutoTower::FireStopUpdate(float progress, bool bLightOn)
|
|||
{
|
||||
if ( m_partiStop[i] != -1 )
|
||||
{
|
||||
m_particule->DeleteParticule(m_partiStop[i]);
|
||||
m_particle->DeleteParticle(m_partiStop[i]);
|
||||
m_partiStop[i] = -1;
|
||||
}
|
||||
}
|
||||
|
@ -392,8 +393,9 @@ void CAutoTower::FireStopUpdate(float progress, bool bLightOn)
|
|||
pos.y = 18.0f;
|
||||
pos.z = listpos[i*2+1];
|
||||
pos = Transform(*mat, pos);
|
||||
m_partiStop[i] = m_particule->CreateParticule(pos, speed,
|
||||
dim, PARTISELR,
|
||||
|
||||
m_partiStop[i] = m_particle->CreateParticle(pos, speed,
|
||||
dim, Gfx::PARTISELR,
|
||||
1.0f, 0.0f, 0.0f);
|
||||
}
|
||||
}
|
||||
|
@ -405,7 +407,7 @@ void CAutoTower::FireStopUpdate(float progress, bool bLightOn)
|
|||
|
||||
bool CAutoTower::CreateInterface(bool bSelect)
|
||||
{
|
||||
CWindow* pw;
|
||||
Ui::CWindow* pw;
|
||||
Math::Point pos, ddim;
|
||||
float ox, oy, sx, sy;
|
||||
|
||||
|
@ -413,7 +415,7 @@ bool CAutoTower::CreateInterface(bool bSelect)
|
|||
|
||||
if ( !bSelect ) return true;
|
||||
|
||||
pw = (CWindow*)m_interface->SearchControl(EVENT_WINDOW0);
|
||||
pw = static_cast< Ui::CWindow* >(m_interface->SearchControl(EVENT_WINDOW0));
|
||||
if ( pw == 0 ) return false;
|
||||
|
||||
ox = 3.0f/640.0f;
|
||||
|
@ -447,8 +449,8 @@ bool CAutoTower::CreateInterface(bool bSelect)
|
|||
|
||||
void CAutoTower::UpdateInterface(float rTime)
|
||||
{
|
||||
CWindow* pw;
|
||||
CGauge* pg;
|
||||
Ui::CWindow* pw;
|
||||
Ui::CGauge* pg;
|
||||
CObject* power;
|
||||
float energy;
|
||||
|
||||
|
@ -457,19 +459,19 @@ void CAutoTower::UpdateInterface(float rTime)
|
|||
if ( m_time < m_lastUpdateTime+0.1f ) return;
|
||||
m_lastUpdateTime = m_time;
|
||||
|
||||
if ( !m_object->RetSelect() ) return;
|
||||
if ( !m_object->GetSelect() ) return;
|
||||
|
||||
pw = (CWindow*)m_interface->SearchControl(EVENT_WINDOW0);
|
||||
pw = static_cast< Ui::CWindow* >(m_interface->SearchControl(EVENT_WINDOW0));
|
||||
if ( pw == 0 ) return;
|
||||
|
||||
pg = (CGauge*)pw->SearchControl(EVENT_OBJECT_GENERGY);
|
||||
pg = static_cast< Ui::CGauge* >(pw->SearchControl(EVENT_OBJECT_GENERGY));
|
||||
if ( pg != 0 )
|
||||
{
|
||||
energy = 0.0f;
|
||||
power = m_object->RetPower();
|
||||
power = m_object->GetPower();
|
||||
if ( power != 0 )
|
||||
{
|
||||
energy = power->RetEnergy();
|
||||
energy = power->GetEnergy();
|
||||
}
|
||||
pg->SetLevel(energy);
|
||||
}
|
||||
|
@ -524,7 +526,7 @@ bool CAutoTower::Read(char *line)
|
|||
|
||||
CAuto::Read(line);
|
||||
|
||||
m_phase = (AutoTowerPhase)OpInt(line, "aPhase", ATP_WAIT);
|
||||
m_phase = static_cast< AutoTowerPhase >(OpInt(line, "aPhase", ATP_WAIT));
|
||||
m_progress = OpFloat(line, "aProgress", 0.0f);
|
||||
m_speed = OpFloat(line, "aSpeed", 1.0f);
|
||||
m_targetPos = OpDir(line, "aTargetPos");
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
// * This file is part of the COLOBOT source code
|
||||
// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch
|
||||
// * Copyright (C) 2012, Polish Portal of Colobot (PPC)
|
||||
// *
|
||||
// * This program is free software: you can redistribute it and/or modify
|
||||
// * it under the terms of the GNU General Public License as published by
|
||||
|
@ -44,7 +45,7 @@ public:
|
|||
|
||||
void Init();
|
||||
bool EventProcess(const Event &event);
|
||||
Error RetError();
|
||||
Error GetError();
|
||||
|
||||
bool CreateInterface(bool bSelect);
|
||||
|
||||
|
@ -63,7 +64,7 @@ protected:
|
|||
float m_speed;
|
||||
float m_timeVirus;
|
||||
float m_lastUpdateTime;
|
||||
float m_lastParticule;
|
||||
float m_lastParticle;
|
||||
Math::Vector m_targetPos;
|
||||
float m_angleYactual;
|
||||
float m_angleZactual;
|
||||
|
|
Loading…
Reference in New Issue