Colobot
autobase.h
1 /*
2  * This file is part of the Colobot: Gold Edition source code
3  * Copyright (C) 2001-2014, Daniel Roux, EPSITEC SA & TerranovaTeam
4  * http://epsiteс.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 // autobase.h
21 
22 #pragma once
23 
24 
25 #include "object/auto/auto.h"
26 
27 
28 
29 enum AutoBaseParam
30 {
31  PARAM_STOP = 0, // run=0 -> stops and open
32  PARAM_LANDING = 1, // run=1 -> landing
33  PARAM_PORTICO = 2, // run=2 -> gate on the ground
34  PARAM_FIXSCENE = 3, // run=3 -> open and stops to win / lost
35  PARAM_TRANSIT1 = 11, // run=11 -> transit in space
36  PARAM_TRANSIT2 = 12, // run=12 -> transit in space
37  PARAM_TRANSIT3 = 13 // run=13 -> transit in space
38 };
39 
40 enum AutoBasePhase
41 {
42  ABP_WAIT = 1, // expected
43  ABP_START = 2, // start-up
44 
45  ABP_LAND = 3, // landing
46  ABP_OPENWAIT = 4, // wait before opening
47  ABP_OPEN = 5, // opens the gate
48  ABP_OPEN2 = 6, // opens supplements
49  ABP_LDWAIT = 7, // expected
50 
51  ABP_CLOSE2 = 8, // closes supplements
52  ABP_CLOSE = 9, // closes gate
53  ABP_TOWAIT = 10, // wait before takeoff
54  ABP_TAKEOFF = 11, // take-off
55 
56  ABP_PORTICO_MOVE = 12, // gate advance
57  ABP_PORTICO_WAIT1= 13, // gate expected
58  ABP_PORTICO_DOWN = 14, // gate down
59  ABP_PORTICO_WAIT2= 15, // gate expected
60  ABP_PORTICO_OPEN = 16, // gate opens
61 
62  ABP_TRANSIT_MOVE = 17, // transit - moving
63 };
64 
65 
66 
67 class CAutoBase : public CAuto
68 {
69 public:
70  CAutoBase(CObject* object);
71  ~CAutoBase();
72 
73  void DeleteObject(bool bAll=false);
74 
75  void Init();
76  void Start(int param);
77  bool EventProcess(const Event &event);
78  bool Abort();
79  Error GetError();
80 
81  bool CreateInterface(bool bSelect);
82 
83  Error TakeOff(bool printMsg);
84 
85 protected:
86  void UpdateInterface();
87  void FreezeCargo(bool bFreeze);
88  void MoveCargo();
89  Error CheckCloseDoor();
90  void BeginTransit();
91  void EndTransit();
92 
93 protected:
94  AutoBasePhase m_phase;
95  bool m_bOpen;
96  float m_progress;
97  float m_speed;
98  float m_lastParticle;
99  float m_lastMotorParticle;
100  float m_fogStart;
101  float m_deepView;
102  Math::Vector m_pos;
103  Math::Vector m_posSound;
104  Math::Vector m_finalPos;
105  Math::Vector m_lastPos;
106  int m_param;
107  int m_soundChannel;
108  int m_partiChannel[8];
109 
110  std::string m_bgBack;
111  std::string m_bgName;
112  Gfx::Color m_bgUp;
113  Gfx::Color m_bgDown;
114  Gfx::Color m_bgCloudUp;
115  Gfx::Color m_bgCloudDown;
116 };
117 
Definition: auto.h:52
Error
Type of error or info message.
Definition: global.h:32
3D (3x1) vector
Definition: vector.h:52
RGBA color.
Definition: color.h:38
Event sent by system, interface or game.
Definition: event.h:678
Definition: object.h:357
Definition: autobase.h:67