aboutsummaryrefslogtreecommitdiff
path: root/engines/bladerunner/ui/kia.h
blob: 47ea63946d2a69b5a32c85628d6b041d8799c6cb (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
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
/* ScummVM - Graphic Adventure Engine
 *
 * ScummVM is the legal property of its developers, whose names
 * are too numerous to list here. Please refer to the COPYRIGHT
 * file distributed with this source distribution.
 *
 * 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 2
 * 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, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
 *
 */

#ifndef BLADERUNNER_KIA_H
#define BLADERUNNER_KIA_H

#include "common/str.h"

#include "graphics/surface.h"

namespace Common {
struct KeyState;
}

namespace BladeRunner {

class BladeRunnerEngine;
class KIALog;
class KIAScript;
class KIASectionBase;
class KIASectionClues;
class KIASectionDiagnostic;
class KIASectionCrimes;
class KIASectionHelp;
class KIASectionLoad;
class KIASectionSettings;
class KIASectionPogo;
class KIASectionSave;
class KIASectionSuspects;
class KIAShapes;
class Shape;
class UIImagePicker;
class VQAPlayer;

enum KIASections {
	kKIASectionNone       = 0,
	kKIASectionCrimes     = 1,
	kKIASectionSuspects   = 2,
	kKIASectionClues      = 3,
	kKIASectionSettings   = 4,
	kKIASectionHelp       = 5,
	kKIASectionSave       = 6,
	kKIASectionLoad       = 7,
	kKIASectionQuit       = 8,
	kKIASectionDiagnostic = 9,
	kKIASectionPogo       = 10
};

class KIA {
	static const char *kPogo;
	static const int kPlayerActorDialogueQueueCapacity = 31;

	struct ActorDialogueQueueEntry {
		int actorId;
		int sentenceId;
	};

	BladeRunnerEngine *_vm;

	int _transitionId;

	int                _playerVqaTimeLast;
	VQAPlayer         *_playerVqaPlayer;
	int                _playerVqaFrame;
	int                _playerVisualizerState;
	int                _playerPhotographId;
	Shape             *_playerPhotograph;
	int                _playerSliceModelId;
	float              _playerSliceModelAngle;
	Graphics::Surface  _playerImage;
	int                _timeLast;

	ActorDialogueQueueEntry _playerActorDialogueQueue[kPlayerActorDialogueQueueCapacity];
	int                     _playerActorDialogueQueuePosition;
	int                     _playerActorDialogueQueueSize;
	int                     _playerActorDialogueState;

	KIASections           _currentSectionId;
	KIASections           _lastSectionIdKIA;
	KIASections           _lastSectionIdOptions;
	KIASectionBase       *_currentSection;

	KIASectionClues      *_cluesSection;
	KIASectionCrimes     *_crimesSection;
	KIASectionDiagnostic *_diagnosticSection;
	KIASectionHelp       *_helpSection;
	KIASectionLoad       *_loadSection;
	KIASectionSettings   *_settingsSection;
	KIASectionPogo       *_pogoSection;
	KIASectionSave       *_saveSection;
	KIASectionSuspects   *_suspectsSection;

	UIImagePicker        *_buttons;

	VQAPlayer            *_mainVqaPlayer;

	int                   _pogoPos;


public:
	bool              _forceOpen;

	KIALog           *_log;
	KIAScript        *_script;
	KIAShapes        *_shapes;

	Graphics::Surface _thumbnail;

public:
	KIA(BladeRunnerEngine *vm);
	~KIA();

	void reset();

	void openLastOpened();
	void open(KIASections sectionId);
	bool isOpen() const;

	void tick();

	void resume();

	void handleMouseDown(int mouseX, int mouseY, bool mainButton);
	void handleMouseUp(int mouseX, int mouseY, bool mainButton);
	void handleMouseScroll(int mouseX, int mouseY, int direction); // Added by ScummVM team
	void handleKeyUp(const Common::KeyState &kbd);
	void handleKeyDown(const Common::KeyState &kbd);

	void playerReset();
	void playActorDialogue(int actorId, int sentenceId);
	void playSliceModel(int sliceModelId);
	void playPhotograph(int photographId);
	void playImage(const Graphics::Surface &image);

private:
	static void mouseDownCallback(int buttonId, void *callbackData);
	static void mouseUpCallback(int buttonId, void *callbackData);
	static void loopEnded(void *callbackData, int frame, int loopId);

	void init();
	void unload();
	void switchSection(int sectionId);

	void createButtons(int sectionId);
	void buttonClicked(int buttonId);

	const char *getSectionVqaName(int sectionId);
	int getVqaLoopMain(int sectionId);
	int getVqaLoopTransition(int transitionId);

	int getTransitionId(int oldSectionId, int newSectionId);
	void playTransitionSound(int transitionId);

	void playPrivateAddon();
};

} // End of namespace BladeRunner
#endif