Colobot
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Pages
autobase.h
1 // * This file is part of the COLOBOT source code
2 // * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch
3 // * Copyright (C) 2012 Polish Portal of Colobot (PPC)
4 // *
5 // * This program is free software: you can redistribute it and/or modify
6 // * it under the terms of the GNU General Public License as published by
7 // * the Free Software Foundation, either version 3 of the License, or
8 // * (at your option) any later version.
9 // *
10 // * This program is distributed in the hope that it will be useful,
11 // * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 // * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 // * GNU General Public License for more details.
14 // *
15 // * You should have received a copy of the GNU General Public License
16 // * along with this program. If not, see http://www.gnu.org/licenses/.
17 
18 // autobase.h
19 
20 #pragma once
21 
22 
23 #include "object/auto/auto.h"
24 
25 
26 
27 enum AutoBaseParam
28 {
29  PARAM_STOP = 0, // run=0 -> stops and open
30  PARAM_LANDING = 1, // run=1 -> landing
31  PARAM_PORTICO = 2, // run=2 -> gate on the ground
32  PARAM_FIXSCENE = 3, // run=3 -> open and stops to win / lost
33  PARAM_TRANSIT1 = 11, // run=11 -> transit in space
34  PARAM_TRANSIT2 = 12, // run=12 -> transit in space
35  PARAM_TRANSIT3 = 13 // run=13 -> transit in space
36 };
37 
38 enum AutoBasePhase
39 {
40  ABP_WAIT = 1, // expected
41  ABP_START = 2, // start-up
42 
43  ABP_LAND = 3, // landing
44  ABP_OPENWAIT = 4, // wait before opening
45  ABP_OPEN = 5, // opens the gate
46  ABP_OPEN2 = 6, // opens supplements
47  ABP_LDWAIT = 7, // expected
48 
49  ABP_CLOSE2 = 8, // closes supplements
50  ABP_CLOSE = 9, // closes gate
51  ABP_TOWAIT = 10, // wait before takeoff
52  ABP_TAKEOFF = 11, // take-off
53 
54  ABP_PORTICO_MOVE = 12, // gate advance
55  ABP_PORTICO_WAIT1= 13, // gate expected
56  ABP_PORTICO_DOWN = 14, // gate down
57  ABP_PORTICO_WAIT2= 15, // gate expected
58  ABP_PORTICO_OPEN = 16, // gate opens
59 
60  ABP_TRANSIT_MOVE = 17, // transit - moving
61 };
62 
63 
64 
65 class CAutoBase : public CAuto
66 {
67 public:
68  CAutoBase(CObject* object);
69  ~CAutoBase();
70 
71  void DeleteObject(bool bAll=false);
72 
73  void Init();
74  void Start(int param);
75  bool EventProcess(const Event &event);
76  bool Abort();
77  Error GetError();
78 
79  bool CreateInterface(bool bSelect);
80 
81 protected:
82  void UpdateInterface();
83  void FreezeCargo(bool bFreeze);
84  void MoveCargo();
85  Error CheckCloseDoor();
86  void BeginTransit();
87  void EndTransit();
88 
89 protected:
90  AutoBasePhase m_phase;
91  bool m_bOpen;
92  float m_progress;
93  float m_speed;
94  float m_lastParticle;
95  float m_lastMotorParticle;
96  float m_fogStart;
97  float m_deepView;
98  Math::Vector m_pos;
99  Math::Vector m_posSound;
100  Math::Vector m_finalPos;
101  Math::Vector m_lastPos;
102  int m_param;
103  int m_soundChannel;
104  int m_partiChannel[8];
105 
106  std::string m_bgBack;
107  std::string m_bgName;
108  Gfx::Color m_bgUp;
109  Gfx::Color m_bgDown;
110  Gfx::Color m_bgCloudUp;
111  Gfx::Color m_bgCloudDown;
112 };
113 
Definition: auto.h:49
Error
Type of error or info message.
Definition: global.h:29
3D (3x1) vector
Definition: vector.h:49
RGBA color.
Definition: color.h:35
Event sent by system, interface or game.
Definition: event.h:687
Definition: object.h:372
Definition: autobase.h:65