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 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284
|
/* 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 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://www.gnu.org/licenses/>.
*
*/
#ifndef BLADERUNNER_ESPER_H
#define BLADERUNNER_ESPER_H
#include "common/array.h"
#include "common/rect.h"
#include "graphics/surface.h"
namespace BladeRunner {
class BladeRunnerEngine;
class Font;
class Shape;
class Shapes;
class VQAPlayer;
class UIImagePicker;
class ESPERScript;
// CD-changing logic has been removed
enum EsperMainStates {
kEsperMainStateOpening = 0,
kEsperMainStateList = 1,
kEsperMainStatePhotoOpening = 2,
kEsperMainStateClear = 3,
kEsperMainStatePhoto = 5
};
enum EsperPhotoStates {
kEsperPhotoStateShow = 0,
kEsperPhotoStateOpening = 1,
kEsperPhotoStateScrolling = 2,
kEsperPhotoStateSelectionZooming = 3,
kEsperPhotoStateSelectionBlinking = 4,
kEsperPhotoStatePhotoZooming = 5,
kEsperPhotoStatePhotoSharpening = 6,
kEsperPhotoStatePhotoZoomOut = 7,
kEsperPhotoStateVideoZooming = 8,
kEsperPhotoStateVideoShow = 9,
kEsperPhotoStateVideoZoomOut = 10
};
class ESPER {
static const int kPhotoCount = 12;
static const int kRegionCount = 6;
static const int kPhotoWidth = 1280;
static const int kPhotoHeight = 960;
static const int kSelectionZoomSteps = 6;
static const Common::Rect kScreen;
struct Photo {
bool isPresent;
int photoId;
int shapeId;
Common::String name;
};
struct Region {
bool isPresent;
int regionId;
Common::Rect rectInner;
Common::Rect rectOuter;
Common::Rect rectSelection;
Common::String name;
};
BladeRunnerEngine *_vm;
ESPERScript *_script;
bool _isWaiting;
bool _isOpen;
UIImagePicker *_buttons;
Graphics::Surface _surfacePhoto;
Graphics::Surface _surfaceViewport;
VQAPlayer *_vqaPlayerMain;
VQAPlayer *_vqaPlayerPhoto;
int _vqaLastFrame;
Shapes *_shapesButtons;
Shapes *_shapesPhotos;
const Shape *_shapeThumbnail;
Photo _photos[kPhotoCount];
int _photoIdSelected;
Region _regions[kRegionCount];
int _regionSelected;
bool _regionSelectedAck;
EsperMainStates _stateMain;
EsperPhotoStates _statePhoto;
bool _isDrawingSelection;
bool _isMouseDown;
int _mouseOverScroll;
float _zoomHorizontal;
float _zoomVertical;
float _zoom;
float _zoomMin;
float _zoomTarget;
float _zoomDelta;
float _blur;
int _zoomSteps;
int _zoomStep;
uint32 _timeZoomNextDiff;
uint32 _timeZoomNextStart;
bool _isZoomingOut;
uint32 _timeZoomOutNextStart;
Common::Rect _screen;
Common::Rect _viewport;
Common::Rect _viewportNext;
int _viewportPositionX;
int _viewportPositionY;
float _viewportPositionXCurrent;
float _viewportPositionYCurrent;
int _viewportPositionXTarget;
int _viewportPositionYTarget;
float _viewportPositionXDelta;
float _viewportPositionYDelta;
int _viewportWidth;
int _viewportHeight;
int _screenHalfWidth;
int _screenHalfHeight;
int _flash;
Common::Rect _selection;
Common::Rect _selectionTarget;
Common::Rect _selectionDelta;
int _selectionCrosshairX;
int _selectionCrosshairY;
int _selectionBlinkingCounter;
int _selectionBlinkingStyle;
uint32 _timeSelectionBlinkingNextStart;
int _selectionZoomStep;
uint32 _timeSelectionZoomNextStart;
int _photoOpeningWidth;
int _photoOpeningHeight;
uint32 _timePhotoOpeningNextDiff;
uint32 _timePhotoOpeningNextStart;
bool _isScrolling;
int _scrollingDirection;
uint32 _timeScrollNextStart;
int _soundId1;
int _volume1; // should be in [0, 100]
int _soundId2;
int _volume2; // should be in [0, 100]
int _soundId3;
int _volume3; // should be in [0, 100]
int _ambientVolumeFactorOutsideEsper;
public:
ESPER(BladeRunnerEngine *vm);
~ESPER();
void open(Graphics::Surface *surface);
void close();
bool isOpen() const;
void handleMouseUp(int x, int y, bool buttonLeft);
void handleMouseDown(int x, int y, bool buttonLeft);
void tick();
void addPhoto(const char *name, int photoId, int shapeId);
void defineRegion(int regionId, Common::Rect inner, Common::Rect outer, Common::Rect selection, const char *name);
private:
static void mouseDownCallback(int, void *);
static void mouseUpCallback(int, void *);
void reset();
void resetData();
void resetPhotos();
void resetRegions();
void resetViewport();
void resetSelectionRect();
void resetSelectionBlinking();
void resetPhotoZooming();
void resetPhotoOpening();
void updateViewport();
void activate(bool withOpening);
void setStateMain(EsperMainStates state);
void setStatePhoto(EsperPhotoStates state);
void wait(uint32 timeout);
void playSound(int soundId, int volume);
void draw(Graphics::Surface &surface);
void drawPhotoOpening(Graphics::Surface &surface);
bool drawSelectionZooming(Graphics::Surface &surface);
bool drawSelectionBlinking(Graphics::Surface &surface);
void drawPhotoZooming(Graphics::Surface &surface);
void drawPhotoSharpening(Graphics::Surface &surface);
void drawPhotoZoomOut(Graphics::Surface &surface);
void drawVideoZooming(Graphics::Surface &surface);
void drawVideoZoomOut(Graphics::Surface &surface);
void drawPhoto(Graphics::Surface &surface);
void drawGrid(Graphics::Surface &surface);
void drawPhotoWithGrid(Graphics::Surface &surface);
void drawSelection(Graphics::Surface &surface, bool crosshair, int style);
void drawVideoFrame(Graphics::Surface &surface);
void drawTextCoords(Graphics::Surface &surface);
void drawMouse(Graphics::Surface &surface);
void flashViewport();
void copyImageScale(Graphics::Surface &src, Common::Rect srcRect, Graphics::Surface &dst, Common::Rect dstRect);
void copyImageBlur(Graphics::Surface &src, Common::Rect srcRect, Graphics::Surface &dst, Common::Rect dstRect, float u);
void copyImageBlit(Graphics::Surface &src, Common::Rect srcRect, Graphics::Surface &dst, Common::Rect dstRect);
void tickSound();
void tickScroll();
int findEmptyPhoto();
void selectPhoto(int photoId);
void unloadPhotos();
int findEmptyRegion();
int findRegion(Common::Rect where);
void zoomingStart();
void zoomOutStart();
void zoomOutStop();
void scrollingStart(int direction);
void scrollingStop();
void scrollUpdate();
void scrollLeft();
void scrollUp();
void scrollRight();
void scrollDown();
void goBack();
void prepareZoom();
void updateSelection();
int viewportXToScreenX(int x);
int viewportYToScreenY(int y);
};
} // End of namespace BladeRunner
#endif
|