ScummVM API documentation
kia.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_KIA_H
23 #define BLADERUNNER_KIA_H
24 
25 #include "common/str.h"
26 
27 #include "graphics/surface.h"
28 
29 namespace Common {
30 struct KeyState;
31 struct Event;
32 }
33 
34 namespace BladeRunner {
35 
36 class BladeRunnerEngine;
37 class KIALog;
38 class KIAScript;
39 class KIASectionBase;
40 class KIASectionClues;
41 class KIASectionDiagnostic;
42 class KIASectionCrimes;
43 class KIASectionHelp;
44 class KIASectionLoad;
45 class KIASectionSettings;
46 class KIASectionPogo;
47 class KIASectionSave;
48 class KIASectionSuspects;
49 class Shape;
50 class Shapes;
51 class UIImagePicker;
52 class VQAPlayer;
53 
54 enum KIASections {
55  kKIASectionNone = 0,
56  kKIASectionCrimes = 1,
57  kKIASectionSuspects = 2,
58  kKIASectionClues = 3,
59  kKIASectionSettings = 4,
60  kKIASectionHelp = 5,
61  kKIASectionSave = 6,
62  kKIASectionLoad = 7,
63  kKIASectionQuit = 8,
64  kKIASectionDiagnostic = 9,
65  kKIASectionPogo = 10
66 };
67 
68 class KIA {
69  static const char *kPogo;
70  static const int kPlayerActorDialogueQueueCapacity = 31;
71 
72  struct ActorDialogueQueueEntry {
73  int actorId;
74  int sentenceId;
75  };
76 
77  BladeRunnerEngine *_vm;
78 
79  int _transitionId;
80 
81  uint32 _playerVqaTimeLast;
82  VQAPlayer *_playerVqaPlayer;
83  uint32 _playerVqaFrame;
84  uint32 _playerVisualizerState;
85  int _playerPhotographId;
86  Shapes *_playerPhotographs;
87  int _playerSliceModelId;
88  float _playerSliceModelAngle;
89  Graphics::Surface _playerImage;
90  uint32 _timeLast;
91 
92  ActorDialogueQueueEntry _playerActorDialogueQueue[kPlayerActorDialogueQueueCapacity];
93  int _playerActorDialogueQueuePosition;
94  int _playerActorDialogueQueueSize;
95  int _playerActorDialogueState;
96 
97  KIASections _currentSectionId;
98  KIASections _lastSectionIdKIA;
99  KIASections _lastSectionIdOptions;
100  KIASectionBase *_currentSection;
101 
102  KIASectionClues *_cluesSection;
103  KIASectionCrimes *_crimesSection;
104  KIASectionDiagnostic *_diagnosticSection;
105  KIASectionHelp *_helpSection;
106  KIASectionLoad *_loadSection;
107  KIASectionSettings *_settingsSection;
108  KIASectionPogo *_pogoSection;
109  KIASectionSave *_saveSection;
110  KIASectionSuspects *_suspectsSection;
111 
112  UIImagePicker *_buttons;
113 
114  VQAPlayer *_mainVqaPlayer;
115 
116  int _pogoPos;
117 
118 
119 public:
120  // Indicates when KIA opens after player has died
121  // or the game just launched and there are existing saved games to load.
122  // In forced open mode, certain KIA tabs are not available,
123  // such as the Save Game tab and the Crime Scene, Suspect, Clue database tabs.
124  bool _forceOpen;
125 
126  KIALog *_log;
127  KIAScript *_script;
128  Shapes *_shapes;
129 
130  Graphics::Surface _thumbnail;
131 
132 public:
133  KIA(BladeRunnerEngine *vm);
134  ~KIA();
135 
136  void reset();
137 
138  void openLastOpened();
139  void open(KIASections sectionId);
140  bool isOpen() const;
141 
142  void tick();
143 
144  void resume();
145 
146  void handleMouseDown(int mouseX, int mouseY, bool mainButton);
147  void handleMouseUp(int mouseX, int mouseY, bool mainButton);
148  void handleMouseScroll(int mouseX, int mouseY, int direction); // Added by ScummVM team
149  void handleKeyUp(const Common::KeyState &kbd);
150  void handleKeyDown(const Common::KeyState &kbd);
151  void handleCustomEventStop(const Common::Event &evt);
152  void handleCustomEventStart(const Common::Event &evt);
153 
154  void playerReset();
155  void playActorDialogue(int actorId, int sentenceId);
156  void playSliceModel(int sliceModelId);
157  void playPhotograph(int photographId);
158  void playImage(const Graphics::Surface &image);
159 
160  const char *scrambleSuspectsName(const char *name);
161 
162 private:
163  static void mouseDownCallback(int buttonId, void *callbackData);
164  static void mouseUpCallback(int buttonId, void *callbackData);
165  static void loopEnded(void *callbackData, int frame, int loopId);
166 
167  void init();
168  void unload();
169  void switchSection(int sectionId);
170 
171  void createButtons(int sectionId);
172  void buttonClicked(int buttonId);
173 
174  const char *getSectionVqaName(int sectionId);
175  int getVqaLoopMain(int sectionId);
176  int getVqaLoopTransition(int transitionId);
177 
178  int getTransitionId(int oldSectionId, int newSectionId);
179  void playTransitionSound(int transitionId);
180 
181  void playPrivateAddon();
182  void playObjectDescription(); // for restored content mode
183 };
184 
185 } // End of namespace BladeRunner
186 #endif
Definition: surface.h:67
Definition: actor.h:31
Definition: kia_section_save.h:43
Definition: kia_section_base.h:40
Definition: kia.h:68
Definition: kia_section_crimes.h:38
Definition: kia_section_diagnostic.h:32
Definition: kia_section_load.h:41
Definition: vqa_player.h:45
Definition: kia_log.h:29
Definition: kia_section_clues.h:37
Definition: events.h:199
Definition: algorithm.h:29
Definition: ui_image_picker.h:40
Definition: kia_section_pogo.h:30
Definition: kia_section_settings.h:42
Definition: keyboard.h:294
Definition: bladerunner.h:113
Definition: kia_section_suspects.h:39
Definition: shape.h:61
Definition: kia_script.h:31
Definition: kia_section_help.h:33