ScummVM API documentation
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
game.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 //=============================================================================
23 //
24 // AGS Runtime header
25 //
26 //=============================================================================
27 
28 #ifndef AGS_ENGINE_AC_GAME_H
29 #define AGS_ENGINE_AC_GAME_H
30 
31 #include "ags/engine/ac/dynobj/script_view_frame.h"
32 #include "ags/engine/main/game_file.h"
33 #include "ags/shared/util/string.h"
34 
35 namespace AGS3 {
36 
37 namespace AGS {
38 namespace Shared {
39 class Bitmap;
40 class Stream;
41 } // namespace Shared
42 } // namespace AGS
43 
44 using namespace AGS; // FIXME later
45 
46 #define RAGMODE_PRESERVEGLOBALINT 1
47 #define RAGMODE_LOADNOW 0x8000000 // just to make sure it's non-zero
48 
49 // Game parameter constants for backward-compatibility functions
50 #define GP_SPRITEWIDTH 1
51 #define GP_SPRITEHEIGHT 2
52 #define GP_NUMLOOPS 3
53 #define GP_NUMFRAMES 4
54 #define GP_ISRUNNEXTLOOP 5
55 #define GP_FRAMESPEED 6
56 #define GP_FRAMEIMAGE 7
57 #define GP_FRAMESOUND 8
58 #define GP_NUMGUIS 9
59 #define GP_NUMOBJECTS 10
60 #define GP_NUMCHARACTERS 11
61 #define GP_NUMINVITEMS 12
62 #define GP_ISFRAMEFLIPPED 13
63 
64 enum CutsceneSkipStyle {
65  kSkipSceneUndefined = 0,
66  eSkipSceneEscOnly = 1,
67  eSkipSceneAnyKey = 2,
68  eSkipSceneMouse = 3,
69  eSkipSceneKeyMouse = 4,
70  eSkipSceneEscOrRMB = 5,
71  eSkipSceneScriptOnly = 6
72 };
73 
74 //=============================================================================
75 // Audio
76 //=============================================================================
77 #define VOL_CHANGEEXISTING 1678
78 #define VOL_SETFUTUREDEFAULT 1679
79 #define VOL_BOTH 1680
80 
81 void Game_StopAudio(int audioType);
82 int Game_IsAudioPlaying(int audioType);
83 void Game_SetAudioTypeSpeechVolumeDrop(int audioType, int volumeDrop);
84 void Game_SetAudioTypeVolume(int audioType, int volume, int changeType);
85 
86 int Game_GetMODPattern();
87 
88 //=============================================================================
89 // ---
90 //=============================================================================
91 int Game_GetDialogCount();
92 
93 // Sets a default save directory, based on platform driver settings and user config
94 void SetDefaultSaveDirectory();
95 // Sets a new save directory within the save parent; copies "restart" slot if available
96 int Game_SetSaveGameDirectory(const char *newFolder);
97 const char *Game_GetSaveSlotDescription(int slnum);
98 
99 const char *Game_GetGlobalStrings(int index);
100 
101 // View, loop, frame parameter assertions.
102 // WARNING: these functions assume that view is already in an internal 0-based range.
103 void AssertView(const char *apiname, int view);
104 void AssertViewHasLoops(const char *apiname, int view);
105 void AssertLoop(const char *apiname, int view, int loop);
106 void AssertFrame(const char *apiname, int view, int loop, int frame);
107 
108 int Game_GetInventoryItemCount();
109 int Game_GetFontCount();
110 int Game_GetMouseCursorCount();
111 int Game_GetCharacterCount();
112 int Game_GetGUICount();
113 int Game_GetViewCount();
114 int Game_GetUseNativeCoordinates();
115 int Game_GetSpriteWidth(int spriteNum);
116 int Game_GetSpriteHeight(int spriteNum);
117 int Game_GetLoopCountForView(int viewNumber);
118 int Game_GetRunNextSettingForLoop(int viewNumber, int loopNumber);
119 int Game_GetFrameCountForLoop(int viewNumber, int loopNumber);
120 ScriptViewFrame *Game_GetViewFrame(int viewNumber, int loopNumber, int frame);
121 int Game_DoOnceOnly(const char *token);
122 
123 int Game_GetTextReadingSpeed();
124 void Game_SetTextReadingSpeed(int newTextSpeed);
125 int Game_GetMinimumTextDisplayTimeMs();
126 void Game_SetMinimumTextDisplayTimeMs(int newTextMinTime);
127 int Game_GetIgnoreUserInputAfterTextTimeoutMs();
128 void Game_SetIgnoreUserInputAfterTextTimeoutMs(int newValueMs);
129 const char *Game_GetFileName();
130 const char *Game_GetName();
131 void Game_SetName(const char *newName);
132 
133 int Game_GetSkippingCutscene();
134 int Game_GetInSkippableCutscene();
135 
136 int Game_GetColorFromRGB(int red, int grn, int blu);
137 const char *Game_InputBox(const char *msg);
138 const char *Game_GetLocationName(int x, int y);
139 
140 const char *Game_GetGlobalMessages(int index);
141 
142 int Game_GetSpeechFont();
143 int Game_GetNormalFont();
144 
145 const char *Game_GetTranslationFilename();
146 int Game_ChangeTranslation(const char *newFilename);
147 const char *Game_GetSpeechVoxFilename();
148 bool Game_ChangeSpeechVox(const char *newFilename);
149 
150 //=============================================================================
151 
152 void set_debug_mode(bool on);
153 // Sets logical game FPS, telling how often the game should update
154 void set_game_speed(int new_fps);
155 // Gets strictly logical game FPS, regardless of whether this is real FPS right now or not.
156 float get_game_speed();
157 void setup_for_dialog();
158 void restore_after_dialog();
159 Shared::String get_save_game_directory();
160 Shared::String get_save_game_suffix();
161 void set_save_game_suffix(const Shared::String &suffix);
162 // Returns full path to the save for the given slot number
163 Shared::String get_save_game_path(int slotNum);
164 // Try calling built-in restore game dialog;
165 // NOTE: this is a script command; may be aborted according to the game & room settings
166 void restore_game_dialog();
167 // Unconditionally display a built-in restore game dialog
168 bool do_restore_game_dialog();
169 // Try calling built-in save game dialog;
170 // NOTE: this is a script command; may be aborted according to the game & room settings
171 void save_game_dialog();
172 // Unconditionally display a built-in save game dialog
173 bool do_save_game_dialog();
174 void free_do_once_tokens();
175 // Free all the memory associated with the game
176 void unload_game();
177 void save_game(int slotn, const char *descript);
178 bool read_savedgame_description(const Shared::String &savedgame, Shared::String &description);
179 std::unique_ptr<Shared::Bitmap> read_savedgame_screenshot(const Shared::String &savedgame);
180 // Tries to restore saved game and displays an error on failure; if the error occurred
181 // too late, when the game data was already overwritten, shuts engine down.
182 bool try_restore_save(int slot);
183 bool try_restore_save(const Shared::String &path, int slot);
184 void serialize_bitmap(const Shared::Bitmap *thispic, Shared::Stream *out);
185 // On Windows we could just use IIDFromString but this is platform-independent
186 void convert_guid_from_text_to_binary(const char *guidText, unsigned char *buffer);
187 Shared::Bitmap *read_serialized_bitmap(Shared::Stream *in);
188 void skip_serialized_bitmap(Shared::Stream *in);
189 long write_screen_shot_for_vista(Shared::Stream *out, Shared::Bitmap *screenshot);
190 
191 bool is_in_cutscene();
192 CutsceneSkipStyle get_cutscene_skipstyle();
193 void start_skipping_cutscene();
194 bool check_skip_cutscene_keypress(int kgn);
195 bool check_skip_cutscene_mclick(int mbut);
196 void initialize_skippable_cutscene();
197 void stop_fast_forwarding();
198 
199 int __GetLocationType(int xxx, int yyy, int allowHotspot0);
200 
201 // Called whenever game loses input focus
202 void display_switch_out();
203 // Called whenever game gets input focus
204 void display_switch_in();
205 // Called when the game looses input focus and must suspend
206 void display_switch_out_suspend();
207 // Called when the game gets input focus and should resume
208 void display_switch_in_resume();
209 
210 void replace_tokens(const char *srcmes, char *destm, size_t maxlen);
211 const char *get_global_message(int msnum);
212 void get_message_text(int msnum, char *buffer, char giveErr = 1);
213 
214 // Notifies the game objects that certain sprite was updated.
215 // This make them update their render states, caches, and so on.
216 void game_sprite_updated(int sprnum, bool deleted = false);
217 // Precaches sprites for a view, within a selected range of loops.
218 void precache_view(int view, int first_loop = 0, int last_loop = INT32_MAX, bool with_sounds = false);
219 
220 extern void set_loop_counter(unsigned int new_counter);
221 
222 } // namespace AGS3
223 
224 #endif
Definition: achievements_tables.h:27
Definition: ptr.h:572
Definition: ags.h:40