summaryrefslogtreecommitdiffstats
path: root/src/object/auto/autobase.h
blob: c0b2b883b1e29cf14f51cc05cd7b0b9f7375fbda (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
/*
 * This file is part of the Colobot: Gold Edition source code
 * Copyright (C) 2001-2014, Daniel Roux, EPSITEC SA & TerranovaTeam
 * http://epsiteс.ch; http://colobot.info; http://github.com/colobot
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 * See the GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program. If not, see http://gnu.org/licenses
 */

// autobase.h

#pragma once


#include "object/auto/auto.h"



enum AutoBaseParam
{
    PARAM_STOP      = 0,        // run=0 -> stops and open
    PARAM_LANDING   = 1,        // run=1 -> landing
    PARAM_PORTICO   = 2,        // run=2 -> gate on the ground
    PARAM_FIXSCENE  = 3,        // run=3 -> open and stops to win / lost
    PARAM_TRANSIT1  = 11,       // run=11 -> transit in space
    PARAM_TRANSIT2  = 12,       // run=12 -> transit in space
    PARAM_TRANSIT3  = 13        // run=13 -> transit in space
};

enum AutoBasePhase
{
    ABP_WAIT        = 1,    // expected
    ABP_START       = 2,    // start-up

    ABP_LAND        = 3,    // landing
    ABP_OPENWAIT        = 4,    // wait before opening
    ABP_OPEN        = 5,    // opens the gate
    ABP_OPEN2       = 6,    // opens supplements
    ABP_LDWAIT      = 7,    // expected

    ABP_CLOSE2      = 8,    // closes supplements
    ABP_CLOSE       = 9,    // closes gate
    ABP_TOWAIT      = 10,   // wait before takeoff
    ABP_TAKEOFF     = 11,   // take-off

    ABP_PORTICO_MOVE = 12,  // gate advance
    ABP_PORTICO_WAIT1= 13,  // gate expected
    ABP_PORTICO_DOWN = 14,  // gate down
    ABP_PORTICO_WAIT2= 15,  // gate expected
    ABP_PORTICO_OPEN = 16,  // gate opens

    ABP_TRANSIT_MOVE = 17,  // transit - moving
};



class CAutoBase : public CAuto
{
public:
    CAutoBase(CObject* object);
    ~CAutoBase();

    void        DeleteObject(bool bAll=false);

    void        Init();
    void        Start(int param);
    bool        EventProcess(const Event &event);
    bool        Abort();
    Error       GetError();

    bool        CreateInterface(bool bSelect);
    
    Error		TakeOff(bool printMsg);

protected:
    void        UpdateInterface();
    void        FreezeCargo(bool bFreeze);
    void        MoveCargo();
    Error       CheckCloseDoor();
    void        BeginTransit();
    void        EndTransit();

protected:
    AutoBasePhase   m_phase;
    bool            m_bOpen;
    float           m_progress;
    float           m_speed;
    float           m_lastParticle;
    float           m_lastMotorParticle;
    float           m_fogStart;
    float           m_deepView;
    Math::Vector    m_pos;
    Math::Vector    m_posSound;
    Math::Vector    m_finalPos;
    Math::Vector    m_lastPos;
    int             m_param;
    int             m_soundChannel;
    int             m_partiChannel[8];

    std::string     m_bgBack;
    std::string     m_bgName;
    Gfx::Color      m_bgUp;
    Gfx::Color      m_bgDown;
    Gfx::Color      m_bgCloudUp;
    Gfx::Color      m_bgCloudDown;
};