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