25 #include "ags/shared/core/platform.h" 26 #define AGS_PLATFORM_DEFINES_PSP_VARS (AGS_PLATFORM_OS_IOS || AGS_PLATFORM_OS_ANDROID) 28 #include "ags/lib/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/event.h" 39 #include "ags/engine/ac/runtime_defines.h" 40 #include "ags/engine/ac/walk_behind.h" 41 #include "ags/engine/main/engine.h" 42 #include "ags/engine/main/graphics_mode.h" 43 #include "ags/engine/media/audio/audio_defines.h" 44 #include "ags/engine/script/script.h" 45 #include "ags/engine/script/script_runtime.h" 46 #include "ags/lib/std/array.h" 47 #include "ags/lib/std/chrono.h" 48 #include "ags/lib/std/memory.h" 49 #include "ags/lib/std/set.h" 50 #include "ags/lib/allegro/color.h" 51 #include "ags/lib/allegro/fixed.h" 52 #include "ags/lib/allegro/aintern.h" 53 #include "common/events.h" 63 using String = AGS::Shared::String;
64 using Version = AGS::Shared::Version;
79 struct InteractionVariable;
89 class ConsoleOutputTarget;
91 class IDriverDependantBitmap;
92 class IGfxDriverFactory;
93 class IGraphicsDriver;
109 class TTFFontRenderer;
110 class WFNFontRenderer;
112 struct AGSDeSerializer;
113 struct AGSPlatformDriver;
114 struct AGSStaticObject;
116 struct AnimatingGUIButton;
117 struct CachedActSpsData;
118 struct CCAudioChannel;
122 struct CCDynamicArray;
130 struct CharacterCache;
131 struct CharacterExtras;
132 struct CharacterInfo;
139 struct ExecutingScript;
140 struct EventHappened;
142 struct GameSetupStruct;
144 struct IAGSEditorDebugger;
145 struct ICCStringClass;
146 struct ManagedObjectPool;
150 struct NonBlockingScriptFunction;
152 struct OnScreenWindow;
153 struct PluginObjectReader;
155 struct ResourcePaths;
157 struct RoomCameraDrawData;
160 struct RuntimeScriptValue;
161 struct ScreenOverlay;
162 struct ScriptAudioChannel;
164 struct ScriptDialogOptionsRendering;
165 struct ScriptDrawingSurface;
168 struct ScriptHotspot;
169 struct ScriptInvItem;
172 struct ScriptPosition;
177 struct SpeechLipSyncLine;
178 struct SpriteListEntry;
181 struct SystemImports;
182 struct TopBarSettings;
187 enum SimdFlags : uint {
189 SIMD_NEON = (1 << 0),
190 SIMD_SSE2 = (1 << 1),
191 SIMD_AVX2 = (1 << 2),
207 int *_allegro_errno = &_errnum;
209 int __color_depth = 0;
210 int __rgb_r_shift_15 = DEFAULT_RGB_R_SHIFT_15;
211 int __rgb_g_shift_15 = DEFAULT_RGB_G_SHIFT_15;
212 int __rgb_b_shift_15 = DEFAULT_RGB_B_SHIFT_15;
213 int __rgb_r_shift_16 = DEFAULT_RGB_R_SHIFT_16;
214 int __rgb_g_shift_16 = DEFAULT_RGB_G_SHIFT_16;
215 int __rgb_b_shift_16 = DEFAULT_RGB_B_SHIFT_16;
216 int __rgb_r_shift_24 = DEFAULT_RGB_R_SHIFT_24;
217 int __rgb_g_shift_24 = DEFAULT_RGB_G_SHIFT_24;
218 int __rgb_b_shift_24 = DEFAULT_RGB_B_SHIFT_24;
219 int __rgb_r_shift_32 = DEFAULT_RGB_R_SHIFT_32;
220 int __rgb_g_shift_32 = DEFAULT_RGB_G_SHIFT_32;
221 int __rgb_b_shift_32 = DEFAULT_RGB_B_SHIFT_32;
222 int __rgb_a_shift_32 = DEFAULT_RGB_A_SHIFT_32;
226 int _trans_blend_alpha = 0;
227 int _trans_blend_red = 0;
228 int _trans_blend_green = 0;
229 int _trans_blend_blue = 0;
230 BlenderMode __blender_mode = kRgbToRgbBlender;
231 uint _simd_flags = SIMD_NONE;
236 PALETTE _black_palette;
237 PALETTE _current_palette;
238 PALETTE _prev_current_palette;
240 volatile int _mouse_x = 0;
241 volatile int _mouse_y = 0;
242 volatile int _mouse_z = 0;
243 volatile int _mouse_b = 0;
244 volatile int _mouse_pos = 0;
249 volatile int _sys_mouse_x = 0;
250 volatile int _sys_mouse_y = 0;
251 volatile int _sys_mouse_z = 0;
253 volatile int _freeze_mouse_flag = 0;
256 int _mouse_accum_relx = 0, _mouse_accum_rely = 0;
258 int _mouse_button_state = 0;
259 int _mouse_accum_button_state = 0;
260 uint32 _mouse_clear_at_time = 0;
261 eAGSMouseButton _wasbutdown = kMouseNone;
320 int _reserved_channel_count = 0;
324 int _current_music_type = 0;
327 int _crossFading = 0, _crossFadeVolumePerStep = 0, _crossFadeStep = 0;
328 int _crossFadeVolumeAtStart = 0;
333 bool _music_update_scheduled =
false;
334 uint32 _music_update_at = 0;
414 int _currentline = 0;
416 const char *_scfilesig =
"SCOM";
436 int _use_cdplayer = 0;
437 bool _triedToUseCdAudioCommand =
false;
438 int _need_to_stop_cd = 0;
449 int32_t _sc_PlayerCharPtr = 0;
450 int _char_lowest_yp = 0;
453 int _face_talking = -1, _facetalkview = 0, _facetalkwait = 0, _facetalkframe = 0;
454 int _facetalkloop = 0, _facetalkrepeat = 0, _facetalkAllowBlink = 1;
455 int _facetalkBlinkLoop = 0;
458 bool _facetalk_qfg4_override_placement_x =
false;
459 bool _facetalk_qfg4_override_placement_y =
false;
462 int _loops_per_character = 0, _text_lips_offset = 0, _char_speaking = -1;
463 int _char_thinking = -1;
464 const char *_text_lips_text =
nullptr;
466 int _numLipLines = 0, _curLipLine = -1, _curLipLinePhoneme = 0;
476 int _windowbackgroundcolor, _pushbuttondarkcolor;
477 int _pushbuttonlightcolor;
478 int _topwindowhandle = -1;
480 int _acdialog_font = 0;
486 int _windowcount = 0, _curswas = 0;
487 int _win_x = 0, _win_y = 0, _win_width = 0, _win_height = 0;
497 int _editor_debugging_enabled = 0;
498 int _editor_debugging_initialized = 0;
499 char _editor_debugger_instance_token[100];
501 int _break_on_next_script_step = 0;
502 volatile int _game_paused_in_debugger = 0;
505 char scriptName[80] = { 0 };
511 int _debug_flags = 0;
514 int _first_debug_line = 0, _last_debug_line = 0, _display_console = 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;
609 RoomAreaMask _debugRoomMask = kRoomAreaNone;
610 int _debugMoveListChar = -1;
612 bool _current_background_is_dirty =
false;
617 bool _screen_is_dirty =
false;
620 int _places_r = 3, _places_g = 2, _places_b = 3;
654 bool _check_dynamic_sprites_at_exit =
true;
665 t_engine_pre_init_callback _engine_pre_init_callback =
nullptr;
675 int _convert_16bit_bgr = 0;
686 int _in_enters_screen = 0, _done_es_error = 0;
687 int _in_leaves_screen = -1;
691 const char *_evblockbasename =
nullptr;
694 int _inside_processevent = 0;
695 int _eventClaimed = 0;
697 const char *_tsnames[TS_NUM] = {
nullptr, REP_EXEC_NAME,
"on_key_press",
"on_mouse_click",
"on_text_input" };
712 String _installAudioDirectory;
714 String _installVoiceDirectory;
751 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;
853 unsigned int _loopcounter = 0;
854 unsigned int _lastcounter = 0;
855 int _numEventsAtStartOfFunction = 0;
857 int _old_key_shifts = 0;
929 int _obj_lowest_yp = 0;
947 FrameScaleDef _CurFrameSetup = kFrame_Undefined;
959 int _ifacepopped = -1;
960 int _mouse_on_iface = -1;
961 int _mouse_ifacebut_xoffs = -1, _mouse_ifacebut_yoffs = -1;
962 int _eip_guinum = 0, _eip_guiobj = 0;
983 int _windowPosX = 0, _windowPosY = 0, _windowPosWidth = 0, _windowPosHeight = 0;
987 #define MAXSAVEGAMES_20 20 988 int _myscrnwid = 320, _myscrnhit = 200;
989 char *_lpTemp =
nullptr, *_lpTemp2 =
nullptr;
990 int _numsaves = 0, _toomanygames = 0;
991 int _filenumbers[MAXSAVEGAMES_20];
992 unsigned long _filedates[MAXSAVEGAMES_20];
993 char _bufTemp[260], _buffer2[260];
1035 int _guis_need_update = 1;
1036 AGS::Shared::GuiDisableStyle _all_buttons_disabled = AGS::Shared::kGuiDis_Undefined;
1037 int _gui_inv_pic = -1;
1068 int _numGlobalVars = 1;
1078 int _in_inv_screen = 0, _inv_screen_newroom = -1;
1088 uint8_t *_lzbuffer =
nullptr;
1089 int *_node =
nullptr;
1091 size_t _outbytes = 0;
1106 int _override_start_room = 0;
1107 bool _justDisplayHelp =
false;
1108 bool _justDisplayVersion =
false;
1109 bool _justRunSetup =
false;
1110 bool _justTellInfo =
false;
1112 int _loadSaveGameOnStartup = -1;
1115 bool _saveThumbnail =
true;
1116 bool _noScummAutosave =
false;
1117 bool _noScummSaveLoad =
false;
1120 int _psp_rotation = 0;
1122 int _psp_gfx_renderer = 0;
1123 int _psp_gfx_scaling = 1;
1124 int _psp_gfx_smoothing = 0;
1125 int _psp_gfx_super_sampling = 1;
1126 int _psp_gfx_smooth_sprites = 0;
1150 int8 _currentcursor = 0;
1152 int _mousex = 0, _mousey = 0, _numcurso = -1, _hotx = 0, _hoty = 0;
1154 int _real_mouse_x = 0, _real_mouse_y = 0;
1155 int _boundx1 = 0, _boundx2 = 99999, _boundy1 = 0, _boundy2 = 99999;
1156 int8 _ignore_bounds = 0;
1160 int _cur_mode = 0, _cur_cursor = 0;
1161 int _mouse_frame = 0, _mouse_delay = 0;
1162 int _lastmx = -1, _lastmy = -1;
1163 int8 _alpha_blend_cursor = 0;
1177 int _hotxwas = 0, _hotywas = 0;
1189 int _is_complete_overlay = 0;
1200 int _numPluginReaders = 0;
1210 bool _handledErrorInEditor =
false;
1211 char _return_to_roomedit[30] = {
'\0' };
1212 char _return_to_room[150] = {
'\0' };
1213 char _quit_message[256] = {
'\0' };
1224 int _new_room_flags = 0;
1225 int _gs_to_newroom = -1;
1226 int _bg_just_changed = 0;
1236 int32_t *_navpoints;
1238 int _num_navpoints = 0;
1240 int _lastcx = 0, _lastcy = 0;
1253 color *_old_palette;
1267 PScript *_dialogScriptsScript;
1268 ccInstance *_gameinst =
nullptr, *_roominst =
nullptr;
1270 ccInstance *_gameinstFork =
nullptr, *_roominstFork =
nullptr;
1272 int _num_scripts = 0;
1273 int _post_script_cleanup_stack = 0;
1275 int _inside_script = 0, _in_graph_script = 0;
1276 int _no_blocking_functions = 0;
1295 size_t _numScriptModules = 0;
1305 new_line_hook_type _new_line_hook =
nullptr;
1308 unsigned _timeoutCheckMs = 60u;
1311 unsigned _timeoutAbortMs = 0u;
1314 unsigned _maxWhileLoops = 0u;
1315 ccInstance *_loadedInstances[MAX_LOADED_INSTANCES];
1325 int _MAXSTRLEN = MAX_MAXSTRLEN;
1348 int _pluginsWantingDebugHooks = 0;
1349 long _pl_file_handle = -1;
1352 eAGSMouseButton _pluginSimulatedClick = kMouseNone;
1353 int _mouse_z_was = 0;
1364 bool _framerate_maxed =
false;
1367 uint32 _last_tick_time = 0;
1368 uint32 _next_frame_timestamp = 0;
1380 String _trans_name, _trans_filename;
1381 long _lang_offs_start = 0;
1382 char _transFileName[MAX_PATH_SZ] = { 0 };
1404 char *_walkBehindExists =
nullptr;
1405 int *_walkBehindStartY =
nullptr, *_walkBehindEndY =
nullptr;
1406 int8 _noWalkBehindsAtAll = 0;
1407 int _walkBehindLeft[MAX_WALK_BEHINDS], _walkBehindTop[MAX_WALK_BEHINDS];
1408 int _walkBehindRight[MAX_WALK_BEHINDS], _walkBehindBottom[MAX_WALK_BEHINDS];
1410 int _walkBehindsCachedForBgNum = 0;
1411 WalkBehindMethodEnum _walkBehindMethod = DrawOverCharSprite;
1412 int _walk_behind_baselines_changed = 0;
1413 Rect _walkBehindAABB[MAX_WALK_BEHINDS];
1424 const char *_passwencstring =
"Avis Durgan";
1436 #define _G(FIELD) (::AGS3::g_globals->_##FIELD) 1440 #define _GP(FIELD) (*::AGS3::g_globals->_##FIELD) Definition: achievements_tables.h:27
Definition: script_system.h:35
Definition: cc_hotspot.h:29
Definition: cc_dynamic_array.h:33
Definition: globals.h:185
Definition: cc_common.h:46
Definition: gui_dialog_defines.h:106
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: plugin_object_reader.h:29
Definition: script_gui.h:28
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:86
Definition: runtime_script_value.h:65
Definition: cc_instance.h:84
Definition: cc_audio_channel.h:29
Definition: script_drawing_surface.h:36
Definition: room_status.h:61
Definition: cc_gui_object.h:29
Definition: cc_region.h:29
Definition: gfxfilter.h:41
Definition: ags_static_object.h:29
Definition: sound_clip.h:53
Definition: room_object.h:48
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: lip_sync.h:27
Definition: globals.h:504
Definition: game_setup_struct.h:53
Definition: cc_dynamic_object.h:103
Definition: tra_file.h:64
Definition: wfn_font.h:66
Definition: algorithm.h:29
Definition: graphics_driver.h:98
Definition: static_array.h:31
Definition: interactions.h:185
Definition: gui_dialog_defines.h:112
Definition: script_mouse.h:28
Definition: scaling.h:108
Definition: geometry.h:215
Definition: character_info.h:74
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:270
Definition: wfn_font_renderer.h:32
Definition: game_state.h:74
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_dialog.h:27
Definition: ags_static_object.h:47
Definition: script_audio_channel.h:27
Definition: cc_instance.h:99
Definition: system_imports.h:45
Definition: cc_character.h:29
Definition: script_region.h:27
Definition: non_blocking_script_function.h:31