Colobot
auto.h
1 /*
2  * This file is part of the Colobot: Gold Edition source code
3  * Copyright (C) 2001-2015, 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 
23 #include "common/event.h"
24 #include "common/error.h"
25 
26 #include "object/object_type.h"
27 
28 
29 class CRobotMain;
30 class CSoundInterface;
31 class CLevelParserLine;
32 class COldObject;
33 
34 namespace Ui
35 {
36 class CInterface;
37 class CWindow;
38 } /* Ui */
39 
40 namespace Gfx
41 {
42 
43 class CEngine;
44 class CParticle;
45 class CLightManager;
46 class CTarrain;
47 class CWater;
48 class CCloud;
49 class CCamera;
50 class CPlanet;
51 class CLightning;
52 class CTerrain;
53 } /* Gfx */
54 
55 
56 class CAuto
57 {
58 public:
59  CAuto(COldObject* object);
60  virtual ~CAuto();
61 
62  virtual void DeleteObject(bool bAll=false);
63 
64  virtual void Init();
65  virtual void Start(int param);
66  virtual bool EventProcess(const Event &event);
67  virtual Error IsEnded();
68  virtual bool Abort();
69 
70  virtual Error StartAction(int param);
71 
72  virtual bool SetType(ObjectType type);
73  virtual bool SetValue(int rank, float value);
74  virtual bool SetString(char *string);
75 
76  virtual bool CreateInterface(bool bSelect);
77  virtual Error GetError();
78 
79  virtual bool GetBusy();
80  virtual void SetBusy(bool bBuse);
81  virtual void InitProgressTotal(float total);
82  virtual void EventProgress(float rTime);
83 
84  virtual bool GetMotor();
85  virtual void SetMotor(bool bMotor);
86 
87  virtual bool Write(CLevelParserLine* line);
88  virtual bool Read(CLevelParserLine* line);
89 
90 protected:
91  void CheckInterface(Ui::CWindow *pw, EventType event, bool bState);
92  void EnableInterface(Ui::CWindow *pw, EventType event, bool bState);
93  void VisibleInterface(Ui::CWindow *pw, EventType event, bool bState);
94  void DeadInterface(Ui::CWindow *pw, EventType event, bool bState);
95  void UpdateInterface();
96  void UpdateInterface(float rTime);
97 
98 protected:
99  CEventQueue* m_eventQueue = nullptr;
100  Gfx::CEngine* m_engine = nullptr;
101  Gfx::CParticle* m_particle = nullptr;
102  Gfx::CTerrain* m_terrain = nullptr;
103  Gfx::CWater* m_water = nullptr;
104  Gfx::CCloud* m_cloud = nullptr;
105  Gfx::CPlanet* m_planet = nullptr;
106  Gfx::CLightning* m_lightning = nullptr;
107  Gfx::CCamera* m_camera = nullptr;
108  Ui::CInterface* m_interface = nullptr;
109  CRobotMain* m_main = nullptr;
110  COldObject* m_object = nullptr;
111  CSoundInterface* m_sound = nullptr;
112 
113  ObjectType m_type = OBJECT_NULL;
114  bool m_bBusy = false;
115  bool m_bMotor = false;
116  float m_time = 0.0f;
117  float m_lastUpdateTime = 0.0f;
118  float m_progressTime = 0.0f;
119  float m_progressTotal = 0.0f;
120 };
Definition: robotmain.h:107
Definition: old_object.h:77
Definition: auto.h:56
Global event queue.
Definition: event.h:840
ObjectType enum.
Definition: parserline.h:37
Definition: robotmain.h:151
Cloud layer renderer.
Definition: cloud.h:54
Lightning effect renderer.
Definition: lightning.h:55
Particle engine.
Definition: particle.h:223
Planet manager.
Definition: planet.h:49
Camera moving in 3D scene.
Definition: camera.h:134
Terrain loader/generator and manager.
Definition: terrain.h:145
Namespace for (new) graphics code.
Definition: app.h:49
The graphics engine.
Definition: engine.h:620
Event types, structs and event queue.
ObjectType
Type of game object.
Definition: object_type.h:33
Water manager/renderer.
Definition: water.h:74
EventType
Type of event message.
Definition: event.h:41
Event sent by system, interface or game.
Definition: event.h:709
Definition: window.h:50
Definition: interface.h:58
Sound plugin interface.
Definition: sound.h:57