25 #include "ags/shared/core/platform.h" 26 #define AGS_PLATFORM_DEFINES_PSP_VARS (AGS_PLATFORM_OS_IOS || AGS_PLATFORM_OS_ANDROID) 28 #include "common/std/queue.h" 29 #include "ags/shared/ac/game_version.h" 30 #include "ags/shared/ac/keycode.h" 31 #include "ags/shared/util/stdio_compat.h" 32 #include "ags/shared/util/string.h" 33 #include "ags/shared/util/string_types.h" 34 #include "ags/shared/util/version.h" 35 #include "ags/shared/font/wfn_font.h" 36 #include "ags/shared/gui/gui_main.h" 37 #include "ags/shared/script/cc_script.h" 38 #include "ags/engine/ac/dynobj/script_game.h" 39 #include "ags/engine/ac/dynobj/script_user_object.h" 40 #include "ags/engine/ac/event.h" 41 #include "ags/engine/ac/file.h" 42 #include "ags/engine/ac/runtime_defines.h" 43 #include "ags/engine/ac/walk_behind.h" 44 #include "ags/engine/main/engine.h" 45 #include "ags/engine/main/graphics_mode.h" 46 #include "ags/engine/media/audio/audio_defines.h" 47 #include "ags/engine/script/script.h" 48 #include "ags/engine/script/script_runtime.h" 49 #include "common/std/array.h" 50 #include "common/std/chrono.h" 51 #include "common/std/memory.h" 52 #include "common/std/set.h" 53 #include "ags/lib/allegro/color.h" 54 #include "ags/lib/allegro/fixed.h" 55 #include "ags/lib/allegro/aintern.h" 56 #include "common/events.h" 66 using String = AGS::Shared::String;
67 using Version = AGS::Shared::Version;
82 struct InteractionVariable;
92 class ConsoleOutputTarget;
94 class IDriverDependantBitmap;
95 class IGfxDriverFactory;
96 class IGraphicsDriver;
112 class TTFFontRenderer;
113 class WFNFontRenderer;
115 struct AGSCCStaticObject;
116 struct AGSDeSerializer;
117 struct AGSPlatformDriver;
119 struct AnimatingGUIButton;
120 struct CachedActSpsData;
121 struct CCAudioChannel;
125 struct CCDynamicArray;
133 struct CharacterCache;
134 struct CharacterExtras;
135 struct CharacterInfo;
142 struct ExecutingScript;
143 struct EventHappened;
145 struct GameSetupStruct;
147 struct IAGSEditorDebugger;
148 struct ICCStringClass;
149 struct ManagedObjectPool;
153 struct NonBlockingScriptFunction;
155 struct OnScreenWindow;
156 struct PluginObjectReader;
158 struct ResourcePaths;
160 struct RoomCameraDrawData;
163 struct RuntimeScriptValue;
164 struct ScreenOverlay;
165 struct ScriptAudioChannel;
167 struct ScriptDialogOptionsRendering;
168 struct ScriptDrawingSurface;
171 struct ScriptHotspot;
172 struct ScriptInvItem;
175 struct ScriptPosition;
180 struct SpeechLipSyncLine;
181 struct SpriteListEntry;
183 struct CCStaticArray;
185 struct SystemImports;
186 struct TopBarSettings;
191 enum SimdFlags : uint {
193 SIMD_NEON = (1 << 0),
194 SIMD_SSE2 = (1 << 1),
195 SIMD_AVX2 = (1 << 2),
211 int *_allegro_errno = &_errnum;
213 int __color_depth = 0;
214 int __rgb_r_shift_15 = DEFAULT_RGB_R_SHIFT_15;
215 int __rgb_g_shift_15 = DEFAULT_RGB_G_SHIFT_15;
216 int __rgb_b_shift_15 = DEFAULT_RGB_B_SHIFT_15;
217 int __rgb_r_shift_16 = DEFAULT_RGB_R_SHIFT_16;
218 int __rgb_g_shift_16 = DEFAULT_RGB_G_SHIFT_16;
219 int __rgb_b_shift_16 = DEFAULT_RGB_B_SHIFT_16;
220 int __rgb_r_shift_24 = DEFAULT_RGB_R_SHIFT_24;
221 int __rgb_g_shift_24 = DEFAULT_RGB_G_SHIFT_24;
222 int __rgb_b_shift_24 = DEFAULT_RGB_B_SHIFT_24;
223 int __rgb_r_shift_32 = DEFAULT_RGB_R_SHIFT_32;
224 int __rgb_g_shift_32 = DEFAULT_RGB_G_SHIFT_32;
225 int __rgb_b_shift_32 = DEFAULT_RGB_B_SHIFT_32;
226 int __rgb_a_shift_32 = DEFAULT_RGB_A_SHIFT_32;
230 int _trans_blend_alpha = 0;
231 int _trans_blend_red = 0;
232 int _trans_blend_green = 0;
233 int _trans_blend_blue = 0;
234 BlenderMode __blender_mode = kRgbToRgbBlender;
235 uint _simd_flags = SIMD_NONE;
240 PALETTE _black_palette;
241 PALETTE _current_palette;
242 PALETTE _prev_current_palette;
244 volatile int _mouse_x = 0;
245 volatile int _mouse_y = 0;
246 volatile int _mouse_z = 0;
247 volatile int _mouse_b = 0;
248 volatile int _mouse_pos = 0;
253 volatile int _sys_mouse_x = 0;
254 volatile int _sys_mouse_y = 0;
255 volatile int _sys_mouse_z = 0;
257 volatile int _freeze_mouse_flag = 0;
260 int _mouse_accum_relx = 0, _mouse_accum_rely = 0;
262 int _mouse_button_state = 0;
263 int _mouse_accum_button_state = 0;
264 uint32 _mouse_clear_at_time = 0;
265 eAGSMouseButton _wasbutdown = kMouseNone;
289 const std::chrono::milliseconds _MaximumDelayBetweenPolling = std::chrono::milliseconds(16);
325 int _reserved_channel_count = 0;
329 int _current_music_type = 0;
332 int _crossFading = 0, _crossFadeVolumePerStep = 0, _crossFadeStep = 0;
333 int _crossFadeVolumeAtStart = 0;
338 bool _music_update_scheduled =
false;
339 uint32 _music_update_at = 0;
369 ICCStringClass *_stringClassImpl =
nullptr;
419 int _currentline = 0;
421 const char *_scfilesig =
"SCOM";
441 int _use_cdplayer = 0;
442 bool _triedToUseCdAudioCommand =
false;
443 int _need_to_stop_cd = 0;
454 int32_t _sc_PlayerCharPtr = 0;
455 int _char_lowest_yp = 0;
458 int _face_talking = -1, _facetalkview = 0, _facetalkwait = 0, _facetalkframe = 0;
459 int _facetalkloop = 0, _facetalkrepeat = 0, _facetalkAllowBlink = 1;
460 int _facetalkBlinkLoop = 0;
463 bool _facetalk_qfg4_override_placement_x =
false;
464 bool _facetalk_qfg4_override_placement_y =
false;
467 int _loops_per_character = 0, _text_lips_offset = 0, _char_speaking = -1;
468 int _char_thinking = -1;
469 const char *_text_lips_text =
nullptr;
471 int _numLipLines = 0, _curLipLine = -1, _curLipLinePhoneme = 0;
481 int _windowbackgroundcolor, _pushbuttondarkcolor;
482 int _pushbuttonlightcolor;
483 int _topwindowhandle = -1;
485 int _acdialog_font = 0;
491 int _windowcount = 0, _curswas = 0;
492 int _win_x = 0, _win_y = 0, _win_width = 0, _win_height = 0;
502 int _editor_debugging_enabled = 0;
503 int _editor_debugging_initialized = 0;
504 char _editor_debugger_instance_token[100];
506 int _break_on_next_script_step = 0;
507 volatile int _game_paused_in_debugger = 0;
510 char scriptName[80] = { 0 };
516 int _debug_flags = 0;
548 int _said_speech_line = 0;
550 int _longestline = 0;
563 int _display_message_aschar = 0;
564 int _source_text_length = -1;
570 int fulltxtheight = 0;
608 RoomAreaMask _debugRoomMask = kRoomAreaNone;
609 int _debugMoveListChar = -1;
613 bool _current_background_is_dirty =
false;
617 bool _screen_is_dirty =
false;
656 bool _check_dynamic_sprites_at_exit =
true;
667 t_engine_pre_init_callback _engine_pre_init_callback =
nullptr;
677 int _convert_16bit_bgr = 0;
688 int _in_enters_screen = 0, _done_es_error = 0;
689 int _in_leaves_screen = -1;
693 int _inside_processevent = 0;
694 int _eventClaimed = 0;
696 const char *_tsnames[kTS_Num] = {
nullptr, REP_EXEC_NAME,
"on_key_press",
"on_mouse_click",
"on_text_input" };
711 String _installAudioDirectory;
713 String _installVoiceDirectory;
718 int _num_open_script_files = 0;
755 CCGUI *_ccDynamicGUI;
783 bool _want_exit =
false;
784 bool _abort_engine =
false;
790 volatile int _switching_away_from_game = 0;
791 volatile bool _switched_away =
false;
792 int _frames_per_second = 40;
793 int _displayed_room = -10, _starting_room = -1;
794 int _in_new_room = 0, _new_room_was = 0;
795 int _new_room_pos = 0;
796 int _new_room_x = SCR_NO_VALUE, _new_room_y = SCR_NO_VALUE;
797 int _new_room_loop = SCR_NO_VALUE;
798 bool _proper_exit =
true;
803 GameDataVersion _loaded_game_file_version = kGameVersion_Undefined;
805 Version _game_compiled_version;
806 int _game_paused = 0;
807 unsigned int _load_new_game = 0;
808 int _load_new_game_restore = -1;
810 int _getloctype_index = 0, _getloctype_throughgui = 0;
811 char _gamefilenamebuf[200] = { 0 };
812 int _gameHasBeenRestored = 0;
814 int _game_update_suspend = 0;
815 bool _new_room_placeonwalkable =
false;
845 int disabled_for = 0;
847 const void *data_ptr =
nullptr;
854 unsigned int _loopcounter = 0;
855 unsigned int _lastcounter = 0;
856 int _numEventsAtStartOfFunction = 0;
858 int _old_key_shifts = 0;
930 int _obj_lowest_yp = 0;
948 FrameScaleDef _CurFrameSetup = kFrame_Undefined;
960 int _ifacepopped = -1;
961 int _mouse_on_iface = -1;
962 int _mouse_ifacebut_xoffs = -1, _mouse_ifacebut_yoffs = -1;
963 int _eip_guinum = 0, _eip_guiobj = 0;
984 int _windowPosX = 0, _windowPosY = 0, _windowPosWidth = 0, _windowPosHeight = 0;
988 #define MAXSAVEGAMES_20 20 989 int _myscrnwid = 320, _myscrnhit = 200;
990 char *_lpTemp =
nullptr, *_lpTemp2 =
nullptr;
991 int _numsaves = 0, _toomanygames = 0;
992 int _filenumbers[MAXSAVEGAMES_20];
993 unsigned long _filedates[MAXSAVEGAMES_20];
994 char _bufTemp[260], _buffer2[260];
1036 int _guis_need_update = 1;
1037 AGS::Shared::GuiDisableStyle _all_buttons_disabled = AGS::Shared::kGuiDis_Undefined;
1038 int _gui_inv_pic = -1;
1069 int _numGlobalVars = 1;
1079 int _in_inv_screen = 0, _inv_screen_newroom = -1;
1089 uint8_t *_lzbuffer =
nullptr;
1090 int *_node =
nullptr;
1092 size_t _outbytes = 0;
1107 int _override_start_room = 0;
1108 bool _justDisplayHelp =
false;
1109 bool _justDisplayVersion =
false;
1110 bool _justRunSetup =
false;
1111 bool _justTellInfo =
false;
1113 int _loadSaveGameOnStartup = -1;
1116 bool _saveThumbnail =
true;
1117 bool _noScummAutosave =
false;
1118 bool _noScummSaveLoad =
false;
1121 int _psp_rotation = 0;
1123 int _psp_gfx_renderer = 0;
1124 int _psp_gfx_scaling = 1;
1125 int _psp_gfx_smoothing = 0;
1126 int _psp_gfx_super_sampling = 1;
1127 int _psp_gfx_smooth_sprites = 0;
1151 int8 _currentcursor = 0;
1153 int _mousex = 0, _mousey = 0, _numcurso = -1, _hotx = 0, _hoty = 0;
1155 int _real_mouse_x = 0, _real_mouse_y = 0;
1156 int _boundx1 = 0, _boundx2 = 99999, _boundy1 = 0, _boundy2 = 99999;
1157 int8 _ignore_bounds = 0;
1161 int _cur_mode = 0, _cur_cursor = 0;
1162 int _mouse_frame = 0, _mouse_delay = 0;
1163 int _lastmx = -1, _lastmy = -1;
1164 int8 _alpha_blend_cursor = 0;
1178 int _hotxwas = 0, _hotywas = 0;
1191 int _is_complete_overlay = 0;
1209 bool _handledErrorInEditor =
false;
1210 char _return_to_roomedit[30] = {
'\0' };
1211 char _return_to_room[150] = {
'\0' };
1212 char _quit_message[256] = {
'\0' };
1223 int _new_room_flags = 0;
1224 int _gs_to_newroom = -1;
1225 int _bg_just_changed = 0;
1238 int _num_navpoints = 0;
1240 fixed _move_speed_x, _move_speed_y;
1241 int _lastcx = 0, _lastcy = 0;
1254 color *_old_palette;
1268 PScript *_dialogScriptsScript;
1275 int _num_scripts = 0;
1276 int _post_script_cleanup_stack = 0;
1278 int _inside_script = 0, _in_graph_script = 0;
1279 int _no_blocking_functions = 0;
1298 size_t _numScriptModules = 0;
1308 new_line_hook_type _new_line_hook =
nullptr;
1311 unsigned _timeoutCheckMs = 60u;
1314 unsigned _timeoutAbortMs = 0u;
1317 unsigned _maxWhileLoops = 0u;
1318 ccInstance *_loadedInstances[MAX_LOADED_INSTANCES];
1351 int _pluginsWantingDebugHooks = 0;
1352 long _pl_file_handle = -1;
1355 eAGSMouseButton _simulatedClick = kMouseNone;
1356 int _mouse_z_was = 0;
1366 std::chrono::microseconds _tick_duration = std::chrono::microseconds(1000000LL / 40);
1367 bool _framerate_maxed =
false;
1370 uint32 _last_tick_time = 0;
1371 uint32 _next_frame_timestamp = 0;
1383 String _trans_name, _trans_filename;
1384 long _lang_offs_start = 0;
1385 char _transFileName[MAX_PATH_SZ] = { 0 };
1407 char *_walkBehindExists =
nullptr;
1408 int *_walkBehindStartY =
nullptr, *_walkBehindEndY =
nullptr;
1409 int8 _noWalkBehindsAtAll = 0;
1410 int _walkBehindLeft[MAX_WALK_BEHINDS], _walkBehindTop[MAX_WALK_BEHINDS];
1411 int _walkBehindRight[MAX_WALK_BEHINDS], _walkBehindBottom[MAX_WALK_BEHINDS];
1413 int _walkBehindsCachedForBgNum = -1;
1414 int _walk_behind_baselines_changed = 0;
1415 Rect _walkBehindAABB[MAX_WALK_BEHINDS];
1426 const char *_passwencstring =
"Avis Durgan";
1438 #define _G(FIELD) (::AGS3::g_globals->_##FIELD) 1442 #define _GP(FIELD) (*::AGS3::g_globals->_##FIELD) Definition: achievements_tables.h:27
Definition: script_system.h:37
Definition: cc_hotspot.h:29
Definition: cc_dynamic_array.h:33
Definition: globals.h:189
Definition: cc_common.h:46
Definition: gui_dialog_defines.h:115
Definition: cc_ags_dynamic_object.h:108
Definition: managed_object_pool.h:50
Definition: debug_manager.h:109
Definition: allegro_bitmap.h:44
Definition: cc_dialog.h:29
Definition: geometry.h:87
Definition: script_dialog_options_rendering.h:29
Definition: script_string.h:29
Definition: display_client.h:58
Definition: graphics_mode.h:119
Definition: sprite_cache.h:80
Definition: runtime_script_value.h:63
Definition: cc_instance.h:98
Definition: cc_audio_channel.h:29
Definition: cc_static_array.h:60
Definition: script_drawing_surface.h:32
Definition: script_game.h:35
Definition: room_status.h:65
Definition: cc_gui_object.h:29
Definition: cc_region.h:29
Definition: gfxfilter.h:41
Definition: sound_clip.h:53
Definition: room_object.h:58
Definition: script_object.h:30
Definition: new_control.h:31
Definition: draw_software.h:63
Definition: cc_inventory.h:29
Definition: script_inv_item.h:27
Definition: cc_object.h:29
Definition: globals.h:509
Definition: game_setup_struct.h:60
Definition: tra_file.h:64
Definition: wfn_font.h:66
Definition: algorithm.h:29
Definition: graphics_driver.h:98
Definition: interactions.h:185
Definition: gui_dialog_defines.h:121
Definition: script_mouse.h:34
Definition: scaling.h:108
Definition: geometry.h:219
Definition: character_info.h:117
Definition: ttf_font_renderer.h:33
Definition: cc_audio_clip.h:29
Definition: game_setup.h:61
Definition: executing_script.h:61
Definition: room_struct.h:269
Definition: wfn_font_renderer.h:33
Definition: game_state.h:80
Definition: ags_editor_debugger.h:27
Definition: globals.h:843
Definition: script_hotspot.h:27
Definition: route_finder_jps.h:40
Definition: top_bar_settings.h:27
Definition: cc_serializer.h:29
Definition: globals.h:567
Definition: mouse_w32.h:37
Definition: gfx_driver_factory.h:51
Definition: script_audio_channel.h:27
Definition: script_user_object.h:36
Definition: cc_instance.h:114
Definition: system_imports.h:44
Definition: cc_character.h:36
Definition: script_region.h:27
Definition: non_blocking_script_function.h:31