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 8 * modify it under the terms of the GNU General Public License 9 * as published by the Free Software Foundation; either version 2 10 * of the License, or (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, write to the Free Software 19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 20 * 21 */ 22 23 //============================================================================= 24 // 25 // AGS Runtime header 26 // 27 //============================================================================= 28 29 #ifndef AGS_ENGINE_AC_GAME_H 30 #define AGS_ENGINE_AC_GAME_H 31 32 #include "ags/engine/ac/dynobj/script_view_frame.h" 33 #include "ags/engine/main/game_file.h" 34 #include "ags/shared/util/string.h" 35 36 namespace AGS3 { 37 38 namespace AGS { 39 namespace Shared { 40 class Bitmap; 41 class Stream; 42 } // namespace Shared 43 } // namespace AGS 44 45 using namespace AGS; // FIXME later 46 47 #define RAGMODE_PRESERVEGLOBALINT 1 48 #define RAGMODE_LOADNOW 0x8000000 // just to make sure it's non-zero 49 50 // Game parameter constants for backward-compatibility functions 51 #define GP_SPRITEWIDTH 1 52 #define GP_SPRITEHEIGHT 2 53 #define GP_NUMLOOPS 3 54 #define GP_NUMFRAMES 4 55 #define GP_ISRUNNEXTLOOP 5 56 #define GP_FRAMESPEED 6 57 #define GP_FRAMEIMAGE 7 58 #define GP_FRAMESOUND 8 59 #define GP_NUMGUIS 9 60 #define GP_NUMOBJECTS 10 61 #define GP_NUMCHARACTERS 11 62 #define GP_NUMINVITEMS 12 63 #define GP_ISFRAMEFLIPPED 13 64 65 enum CutsceneSkipStyle { 66 kSkipSceneUndefined = 0, 67 eSkipSceneEscOnly = 1, 68 eSkipSceneAnyKey = 2, 69 eSkipSceneMouse = 3, 70 eSkipSceneKeyMouse = 4, 71 eSkipSceneEscOrRMB = 5, 72 eSkipSceneScriptOnly = 6 73 }; 74 75 //============================================================================= 76 // Audio 77 //============================================================================= 78 #define VOL_CHANGEEXISTING 1678 79 #define VOL_SETFUTUREDEFAULT 1679 80 #define VOL_BOTH 1680 81 82 void Game_StopAudio(int audioType); 83 int Game_IsAudioPlaying(int audioType); 84 void Game_SetAudioTypeSpeechVolumeDrop(int audioType, int volumeDrop); 85 void Game_SetAudioTypeVolume(int audioType, int volume, int changeType); 86 87 int Game_GetMODPattern(); 88 89 //============================================================================= 90 // --- 91 //============================================================================= 92 int Game_GetDialogCount(); 93 94 // Defines a custom save parent directory, which will replace $MYDOCS$/GameName 95 // when a new save directory is set from the script 96 bool SetCustomSaveParent(const Shared::String &path); 97 // If explicit_path flag is false, the actual path will be constructed 98 // as a relative to system's user saves directory 99 bool SetSaveGameDirectoryPath(const Shared::String &newFolder, bool explicit_path = false); 100 int Game_SetSaveGameDirectory(const Shared::String &newFolder); 101 const char *Game_GetSaveSlotDescription(int slnum); 102 103 const char *Game_GetGlobalStrings(int index); 104 105 int Game_GetInventoryItemCount(); 106 int Game_GetFontCount(); 107 int Game_GetMouseCursorCount(); 108 int Game_GetCharacterCount(); 109 int Game_GetGUICount(); 110 int Game_GetViewCount(); 111 int Game_GetUseNativeCoordinates(); 112 int Game_GetSpriteWidth(int spriteNum); 113 int Game_GetSpriteHeight(int spriteNum); 114 int Game_GetLoopCountForView(int viewNumber); 115 int Game_GetRunNextSettingForLoop(int viewNumber, int loopNumber); 116 int Game_GetFrameCountForLoop(int viewNumber, int loopNumber); 117 ScriptViewFrame *Game_GetViewFrame(int viewNumber, int loopNumber, int frame); 118 int Game_DoOnceOnly(const char *token); 119 120 int Game_GetTextReadingSpeed(); 121 void Game_SetTextReadingSpeed(int newTextSpeed); 122 int Game_GetMinimumTextDisplayTimeMs(); 123 void Game_SetMinimumTextDisplayTimeMs(int newTextMinTime); 124 int Game_GetIgnoreUserInputAfterTextTimeoutMs(); 125 void Game_SetIgnoreUserInputAfterTextTimeoutMs(int newValueMs); 126 const char *Game_GetFileName(); 127 const char *Game_GetName(); 128 void Game_SetName(const char *newName); 129 130 int Game_GetSkippingCutscene(); 131 int Game_GetInSkippableCutscene(); 132 133 int Game_GetColorFromRGB(int red, int grn, int blu); 134 const char *Game_InputBox(const char *msg); 135 const char *Game_GetLocationName(int x, int y); 136 137 const char *Game_GetGlobalMessages(int index); 138 139 int Game_GetSpeechFont(); 140 int Game_GetNormalFont(); 141 142 const char *Game_GetTranslationFilename(); 143 int Game_ChangeTranslation(const char *newFilename); 144 145 //============================================================================= 146 147 void set_debug_mode(bool on); 148 void set_game_speed(int new_fps); 149 void setup_for_dialog(); 150 void restore_after_dialog(); 151 Shared::String get_save_game_directory(); 152 Shared::String get_save_game_suffix(); 153 void set_save_game_suffix(const Shared::String &suffix); 154 // Returns full path to the save for the given slot number 155 Shared::String get_save_game_path(int slotNum); 156 void restore_game_dialog(); 157 void save_game_dialog(); 158 void free_do_once_tokens(); 159 // Free all the memory associated with the game 160 void unload_game_file(); 161 void save_game(int slotn, const char *descript); 162 bool read_savedgame_description(const Shared::String &savedgame, Shared::String &description); 163 bool read_savedgame_screenshot(const Shared::String &savedgame, int &want_shot); 164 // Tries to restore saved game and displays an error on failure; if the error occured 165 // too late, when the game data was already overwritten, shuts engine down. 166 bool try_restore_save(int slot); 167 bool try_restore_save(const Shared::String &path, int slot); 168 void serialize_bitmap(const Shared::Bitmap *thispic, Shared::Stream *out); 169 // On Windows we could just use IIDFromString but this is platform-independant 170 void convert_guid_from_text_to_binary(const char *guidText, unsigned char *buffer); 171 Shared::Bitmap *read_serialized_bitmap(Shared::Stream *in); 172 void skip_serialized_bitmap(Shared::Stream *in); 173 long write_screen_shot_for_vista(Shared::Stream *out, Shared::Bitmap *screenshot); 174 175 bool is_in_cutscene(); 176 CutsceneSkipStyle get_cutscene_skipstyle(); 177 void start_skipping_cutscene(); 178 bool check_skip_cutscene_keypress(int kgn); 179 bool check_skip_cutscene_mclick(int mbut); 180 void initialize_skippable_cutscene(); 181 void stop_fast_forwarding(); 182 183 int __GetLocationType(int xxx, int yyy, int allowHotspot0); 184 185 // Called whenever game looses input focus 186 void display_switch_out(); 187 // Called whenever game gets input focus 188 void display_switch_in(); 189 // Called when the game looses input focus and must suspend 190 void display_switch_out_suspend(); 191 // Called when the game gets input focus and should resume 192 void display_switch_in_resume(); 193 194 void replace_tokens(const char *srcmes, char *destm, int maxlen = 99999); 195 const char *get_global_message(int msnum); 196 void get_message_text(int msnum, char *buffer, char giveErr = 1); 197 198 bool unserialize_audio_script_object(int index, const char *objectType, const char *serializedData, int dataSize); 199 200 // Notifies the game objects that certain sprite was updated. 201 // This make them update their render states, caches, and so on. 202 void game_sprite_updated(int sprnum); 203 // Notifies the game objects that certain sprite was deleted. 204 // Those which used that sprite will reset to dummy sprite 0, update their render states and caches. 205 void game_sprite_deleted(int sprnum); 206 207 208 extern void set_loop_counter(unsigned int new_counter); 209 210 } // namespace AGS3 211 212 #endif 213