ScummVM API documentation
vk.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 BLADERUNNER_VK_H
23#define BLADERUNNER_VK_H
24
25#include "common/array.h"
26#include "common/str.h"
27
28#include "graphics/surface.h"
29
30namespace BladeRunner {
31
32class BladeRunnerEngine;
33class VKScript;
34class Shapes;
35class UIImagePicker;
36class VQAPlayer;
37
38class VK {
39 friend class Debugger;
40
41 struct Question {
42 bool isPresent;
43 bool wasAsked;
44 int sentenceId;
45 int relatedSentenceId;
46 };
47
49
50 VKScript *_script;
51
52 UIImagePicker *_buttons;
53 Shapes *_shapes;
54
55 VQAPlayer *_vqaPlayerMain;
56 VQAPlayer *_vqaPlayerEye;
57 int _vqaFrameMain;
58 bool _vqaLoopEnded;
59
60 Graphics::Surface _surfaceEye;
61
62 bool _isOpen;
63 int _actorId;
64 bool _calibrationStarted;
65 bool _testStarted;
66
68
69 int _ambientVolumeFactorOutsideVK; // should be in [0, 100]
70 int _musicVolumeFactorOutsideVK; // should be in [0, 100]
71 int _soundTrackId1;
72 int _soundTrackId2;
73 int _soundTrackId3;
74
75 int _calibration;
76 int _calibrationRatio;
77 int _calibrationCounter;
78
79 int _humanProbability;
80 int _humanGauge;
81 int _humanGaugeTarget;
82 int _humanGaugeDelta;
83 uint32 _timeNextHumanGaugeStepDiff;
84 uint32 _timeNextHumanGaugeStepStart;
85
86 int _replicantProbability;
87 int _replicantGauge;
88 int _replicantGaugeTarget;
89 int _replicantGaugeDelta;
90 uint32 _timeNextReplicantGaugeStepDiff;
91 uint32 _timeNextReplicantGaugeStepStart;
92
93 int _anxiety;
94
95 int _needleValue;
96 int _needleValueMax;
97 int _needleValueTarget;
98 int _needleValueDelta;
99 uint32 _timeNextNeedleStepStart;
100 uint32 _timeNextNeedleOscillateStart;
101 uint32 _timeNeedleReturnStart;
102
103 bool _isClosing;
104 uint32 _timeCloseStart;
105
106 int _blinkState;
107 uint32 _timeNextBlinkStart;
108 uint32 _timeNextGaugesBlinkStart;
109
110 bool _isAdjusting;
111 int _adjustment;
112 int _adjustmentTarget;
113 int _adjustmentDelta;
114 uint32 _timeNextAdjustementStepStart;
115
116 int _eyeLineSelected;
117 int _eyeLineX;
118 int _eyeLineXLast;
119 int _eyeLineY;
120 int _eyeLineYLast;
121 int _eyeLineXDelta;
122 int _eyeLineYDelta;
123 uint32 _timeNextEyeLineStepStart;
124 uint32 _timeNextEyeLineStart;
125
126public:
128 ~VK();
129
130 void open(int actorId, int calibrationRatio);
131 bool isOpen() const;
132 void close();
133
134 void tick();
135
136// void resume();
137
138 void handleMouseDown(int mouseX, int mouseY, bool mainButton);
139 void handleMouseUp(int mouseX, int mouseY, bool mainButton);
140
141 void playSpeechLine(int actorId, int sentenceId, float pauseDuration);
142 void addQuestion(int intensity, int sentenceId, int relatedSentenceId);
143 void subjectReacts(int intensity, int humanResponse, int replicantResponse, int anxiety);
144 void eyeAnimates(int loopId);
145
146private:
147 static void mouseDownCallback(int buttonId, void *callbackData);
148 static void mouseUpCallback(int buttonId, void *callbackData);
149 static void loopEnded(void *callbackData, int frame, int loopId);
150
151 void reset();
152 void init();
153
154 void draw();
155
156 void drawNeedle(Graphics::Surface &surface);
157 void drawEye(Graphics::Surface &surface);
158 void drawEyeCrosshair(Graphics::Surface &surface, uint32 timeNow);
159 void drawMouse(Graphics::Surface &surface);
160 void drawGauge(Graphics::Surface &surface, int value, int x, int y, int width);
161 void drawHumanGauge(Graphics::Surface &surface);
162 void drawReplicantGauge(Graphics::Surface &surface);
163
164 void calibrate();
165 void beginTest();
166
167 void startAdjustement();
168 void stopAdjustement();
169 void animateAdjustment(int target);
170 void setAdjustment(int x);
171 void setAdjustmentFromMouse();
172
173 void findRelatedQuestionBySentenceId(int inSentenceId, int &outRelatedQuestionId, int &outRelatedIntensity);
174 void askQuestion(int intensity);
175};
176
177} // End of namespace BladeRunner
178#endif
Definition: bladerunner.h:113
Definition: debugger.h:56
Definition: shape.h:61
Definition: ui_image_picker.h:40
Definition: vk.h:38
Definition: vk_script.h:31
Definition: vqa_player.h:45
Definition: array.h:52
Definition: surface.h:67