Colobot
motion.h
1 /*
2  * This file is part of the Colobot: Gold Edition source code
3  * Copyright (C) 2001-2016, Daniel Roux, EPSITEC SA & TerranovaTeam
4  * http://epsitec.ch; http://colobot.info; http://github.com/colobot
5  *
6  * This program is free software: you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation, either version 3 of the License, or
9  * (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
14  * See the GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program. If not, see http://gnu.org/licenses
18  */
19 
20 #pragma once
21 
22 #include "common/error.h"
23 
24 #include "math/vector.h"
25 
26 #include "object/object_type.h"
27 
28 namespace Gfx
29 {
30 class CEngine;
31 class CParticle;
32 class CTerrain;
33 class CWater;
34 class CCamera;
35 class COldModelManager;
36 } // namespace Gfx
37 
38 class CApplication;
39 class CPhysics;
40 class COldObject;
41 class CRobotMain;
42 class CSoundInterface;
43 class CLevelParserLine;
44 struct Event;
45 
46 
47 class CMotion
48 {
49 public:
50  CMotion(COldObject* object);
51  virtual ~CMotion();
52 
53  void SetPhysics(CPhysics* physics);
54 
55  virtual void DeleteObject(bool bAll=false) = 0;
56  virtual void Create(Math::Vector pos, float angle, ObjectType type, float power, Gfx::COldModelManager* modelManager) = 0;
57  virtual bool EventProcess(const Event &event);
58  virtual Error SetAction(int action, float time=0.2f);
59  virtual int GetAction();
60 
61  virtual bool SetParam(int rank, float value);
62  virtual float GetParam(int rank);
63 
64  virtual bool Write(CLevelParserLine* line);
65  virtual bool Read(CLevelParserLine* line);
66 
67  virtual void SetLinVibration(Math::Vector dir);
68  virtual Math::Vector GetLinVibration();
69  virtual void SetCirVibration(Math::Vector dir);
70  virtual Math::Vector GetCirVibration();
71  virtual void SetTilt(Math::Vector dir);
72  virtual Math::Vector GetTilt();
73 
74 protected:
75  CApplication* m_app;
76  Gfx::CEngine* m_engine;
77  Gfx::CParticle* m_particle;
78  Gfx::CTerrain* m_terrain;
79  Gfx::CWater* m_water;
80  Gfx::CCamera* m_camera;
81  COldObject* m_object;
82  CPhysics* m_physics;
83  CRobotMain* m_main;
84  CSoundInterface* m_sound;
85 
86  int m_actionType;
87  float m_actionTime;
88  float m_progress;
89 
90  Math::Vector m_linVibration; // linear vibration
91  Math::Vector m_cirVibration; // circular vibration
92  Math::Vector m_inclinaison; // tilt
93 };
Manager for static models.
Definition: oldmodelmanager.h:54
Definition: old_object.h:79
Definition: physics.h:97
ObjectType enum.
Definition: parserline.h:37
Definition: robotmain.h:159
Particle engine.
Definition: particle.h:223
Main application.
Definition: app.h:180
Camera moving in 3D scene.
Definition: camera.h:128
Terrain loader/generator and manager.
Definition: terrain.h:147
Namespace for (new) graphics code.
Definition: app.h:49
Definition: motion.h:47
Vector struct and related functions.
The graphics engine.
Definition: engine.h:585
ObjectType
Type of game object.
Definition: object_type.h:33
Water manager/renderer.
Definition: water.h:72
3D (3x1) vector
Definition: vector.h:53
Event sent by system, interface or game.
Definition: event.h:735
Sound plugin interface.
Definition: sound.h:60