ScummVM API documentation
space_map.h
1/* ScummVM - Graphic Adventure Engine
2 *
3 * ScummVM is the legal property of its developers, whose names
4 * are too numerous to list here. Please refer to the COPYRIGHT
5 * file distributed with this source distribution.
6 *
7 * This program is free software: you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation, either version 3 of the License, or
10 * (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program. If not, see <http://www.gnu.org/licenses/>.
19 *
20 */
21
22#ifndef ULTIMA2_VIEWS_SPACE_MAP_H
23#define ULTIMA2_VIEWS_SPACE_MAP_H
24
25#include "common/array.h"
26#include "ultima/shared/engine/view.h"
27#include "ultima/ultima2/views/space_stats.h"
28
29namespace Ultima {
30namespace Ultima2 {
31namespace Views {
32
33using namespace Graphics::Views;
34
41class SpaceMap : public Shared::View {
42private:
43 enum Phase {
44 PHASE_IDLE, PHASE_WARP_TRAILS, PHASE_WARP_ACCELERATE, PHASE_WARP_RUSH,
45 PHASE_SPIN_DOWN, PHASE_SPIN_HOLD
46 };
47
48 static const int STAR_COUNT = 64;
49
50 SpaceStats _stats = SpaceStats(this);
51 byte _starX[STAR_COUNT] = {};
52 byte _starY[STAR_COUNT] = {};
53 byte _seedA = 0, _seedB = 0;
54 byte _shipX = 0x80, _shipY = 0x40;
55 byte _speed = 0x80;
56 Phase _phase = PHASE_IDLE;
57 int _counter = 0;
58
59 // The CGA colors of the starfield, since the composite renderer
60 // colors a pixel by its neighbors and so can't read them back off the screen
61 Common::Array<byte> _staging;
62
63 void seedStars();
64 void plot(Graphics::Views::GfxSurface &s, int x, int y, int color);
65 void drawMarker(Graphics::Views::GfxSurface &s, int color);
66
70 void animate();
71
75 void startWarp();
76
80 void finishWarp();
81
82public:
83 SpaceMap();
84 ~SpaceMap() override {}
85
89 bool busy() const {
90 return _phase != PHASE_IDLE;
91 }
92
96 void setShip(byte x, byte y);
97
102
107
108 bool msgGame(const GameMessage &msg) override;
109 bool msgFocus(const FocusMessage &msg) override;
110 bool msgUnfocus(const UnfocusMessage &msg) override;
111 bool msgAction(const ActionMessage &msg) override;
112 bool msgKeypress(const KeypressMessage &msg) override;
113 void draw() override;
114 bool tick() override;
115};
116
117} // namespace Views
118} // namespace Ultima2
119} // namespace Ultima
120
121#endif
Definition: gfx_surface.h:34
Definition: view.h:35
Definition: space_map.h:41
void setShip(byte x, byte y)
bool busy() const
Definition: space_map.h:89
Definition: space_stats.h:34
Definition: messages.h:118
Definition: messages.h:42
Definition: messages.h:94
Definition: messages.h:54
Definition: messages.h:50