forked from fuzzie/unity
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathunity.h
180 lines (137 loc) · 4.42 KB
/
unity.h
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
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
/*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library 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
* Lesser General Public License for more details.
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#ifndef UNITY_UNITY_H
#define UNITY_UNITY_H
#include "engines/engine.h"
#include "common/random.h"
#include "unity/console.h"
#include "data.h"
namespace Unity {
class Graphics;
class Sound;
class SpritePlayer;
class Object;
class Trigger;
class UIScreen;
enum AwayTeamMode {
mode_Look,
mode_Use,
mode_Walk,
mode_Talk
};
// Engine Debug Flags
enum {
kDebugResource = (1 << 0),
kDebugSaveLoad = (1 << 1),
kDebugScript = (1 << 2),
kDebugGraphics = (1 << 3),
kDebugSound = (1 << 4)
};
enum ScreenType {
NoScreenType,
AstrogationScreenType,
BridgeScreenType,
ComputerScreenType,
DeathScreenType,
EngineeringScreenType,
HolodeckScreenType,
TacticalScreenType,
TransporterScreenType,
ViewscreenScreenType
};
class UnityEngine : public Engine {
public:
UnityEngine(class OSystem *syst);
~UnityEngine();
Common::Error init();
Common::Error run();
GUI::Debugger *getDebugger() { return _console; }
Object *objectAt(unsigned int x, unsigned int y);
void clearObjects();
void removeObject(Object *obj);
Common::RandomSource *_rnd;
UnityData data;
Sound *_snd;
Graphics *_gfx;
bool _on_away_team;
AwayTeamMode _mode;
Object *_current_away_team_member;
SpritePlayer *_current_away_team_icon;
Common::Array<Object *> _away_team_members;
Common::Array<Object *> _inventory_items;
Common::Array<SpritePlayer *> _inventory_icons;
unsigned int _inventory_index;
void addToInventory(Object *obj);
void removeFromInventory(Object *obj);
Common::String _status_text;
unsigned int _dialog_x, _dialog_y;
bool _in_dialog;
bool _dialog_choosing;
Common::String _dialog_text;
Common::Array<Common::String> _choice_list;
void setSpeaker(objectID s);
// TODO: horrible hack
unsigned int _dialog_choice_situation;
Common::Array<unsigned int> _dialog_choice_states;
Conversation *_next_conversation;
unsigned int _next_situation;
uint16 _beam_world, _beam_screen;
unsigned int _viewscreen_sprite_id;
unsigned int runDialogChoice(Conversation *conversation);
void runDialog();
void startBridge();
void endAwayTeam();
void startAwayTeam(unsigned int world, unsigned int screen, byte entrance = 0);
ResultType performAction(ActionType action_type, Object *target, objectID who = objectID(), objectID other = objectID(), unsigned int target_x = 0xffff, unsigned int target_y = 0xffff);
void playDescriptionFor(Object *obj);
Common::String voiceFileFor(byte voice_group, byte voice_subgroup, objectID speaker, byte voice_id, char type = 0);
void changeToScreen(ScreenType screenType);
protected:
UnityConsole *_console;
objectID _speaker;
SpritePlayer *_icon;
UIScreen *_currScreen;
ScreenType _currScreenType;
class BridgeScreen *_bridgeScreen;
class ComputerScreen *_computerScreen;
class ViewscreenScreen *_viewscreenScreen;
void openLocation(unsigned int world, unsigned int screen);
void checkEvents();
void handleAwayTeamMouseMove(const Common::Point &pos);
void handleAwayTeamMouseClick(const Common::Point &pos);
void drawObjects();
void processTriggers();
void processTimers();
void startupScreen();
uint _dialogSelected;
uint _dialogStartLine;
Common::Array<Common::Array<Common::String> > _dialogLines;
Common::Array<Common::Rect> _dialogRects;
uint _dialogWidth;
void drawDialogFrameAround(unsigned int x, unsigned int y, unsigned int width,
unsigned int height, bool use_thick_frame, bool with_icon, bool with_buttons);
void initDialog();
void dialogMouseMove(const Common::Point &pos);
void dialogMouseClick(const Common::Point &pos);
void drawDialogWindow();
void drawAwayTeamUI();
void handleLook(Object *obj);
void handleUse(Object *obj);
void handleWalk(Object *obj);
void handleTalk(Object *obj);
void DebugNextScreen();
};
} // Unity
#endif