22 #ifndef AGS_ENGINE_AC_GAME_STATE_H 23 #define AGS_ENGINE_AC_GAME_STATE_H 25 #include "common/std/memory.h" 26 #include "common/std/unordered_set.h" 27 #include "common/std/vector.h" 28 #include "ags/shared/ac/character_info.h" 29 #include "ags/shared/ac/keycode.h" 30 #include "ags/engine/ac/runtime_defines.h" 31 #include "ags/engine/ac/speech.h" 32 #include "ags/engine/ac/timer.h" 33 #include "ags/shared/game/room_struct.h" 34 #include "ags/engine/game/viewport.h" 35 #include "ags/engine/gfx/graphics_driver.h" 36 #include "ags/engine/media/audio/queued_audio_item.h" 37 #include "ags/shared/util/geometry.h" 38 #include "ags/shared/util/string_types.h" 39 #include "ags/shared/util/string.h" 57 struct ScriptViewport;
61 #define MAX_GAME_STATE_NAME_LENGTH 100 62 #define GAME_STATE_RESERVED_INTS 5 63 #define LEGACY_GAMESTATE_GAMENAMELENGTH 100 66 #define PLAYMP3FILE_MAX_FILENAME_LEN 50 69 enum GameStateSvgVersion {
70 kGSSvgVersion_OldFormat = -1,
71 kGSSvgVersion_Initial = 0,
72 kGSSvgVersion_350 = 1,
73 kGSSvgVersion_350_9 = 2,
74 kGSSvgVersion_350_10 = 3,
75 kGSSvgVersion_361_14 = 4,
85 int disabled_user_interface = 0;
86 int gscript_timer = 0;
88 int32_t globalvars[MAXGLOBALVARS]{};
96 int inv_numinline = 0;
98 int sierra_inv_color = 0;
99 int talkanim_speed = 0;
100 int inv_item_wid = 0;
101 int inv_item_hit = 0;
102 int speech_text_shadow = 0;
103 int swap_portrait_side = 0;
104 int speech_textwindow_gui = 0;
105 int follow_change_room_timer = 0;
107 int skip_display = 0;
108 int no_multiloop_repeat = 0;
109 int roomscript_finished = 0;
111 int no_textbg_when_voice = 0;
112 int max_dialogoption_width = 0;
113 int no_hicolor_fadein = 0;
114 int bgspeech_game_speed = 0;
115 int bgspeech_stay_on_display = 0;
116 int unfactor_speech_from_textlength = 0;
117 int mp3_loop_before_end = 0;
118 int speech_music_drop = 0;
120 int fast_forward = 0;
125 int game_speed_modifier = 0;
127 int takeover_data = 0;
128 int replay_hotkey_unused = 0;
129 int dialog_options_x = 0;
130 int dialog_options_y = 0;
131 int narrator_speech = 0;
132 int ambient_sounds_persist = 0;
133 int lipsync_speed = 0;
134 int close_mouth_speech_time = 0;
136 int disable_antialiasing = 0;
137 int text_speed_modifier = 0;
138 HorAlignment text_align = kHAlignNone;
139 int speech_bubble_width = 0;
140 int min_dialogoption_width = 0;
141 int disable_dialog_parser = 0;
142 int anim_background_speed = 0;
143 int top_bar_backcolor = 0;
144 int top_bar_textcolor = 0;
145 int top_bar_bordercolor = 0;
146 int top_bar_borderwidth = 0;
147 int top_bar_ypos = 0;
148 int screenshot_width = 0;
149 int screenshot_height = 0;
150 int top_bar_font = 0;
151 HorAlignment speech_text_align = kHAlignNone;
152 int auto_use_walkto_points = 0;
153 int inventory_greys_out = 0;
154 int skip_speech_specific_key = 0;
157 int fade_to_green = 0;
158 int fade_to_blue = 0;
159 int show_single_dialog_option = 0;
160 int keep_screen_during_instant_transition = 0;
161 int read_dialog_option_colour = 0;
162 int stop_dialog_at_end = 0;
163 int speech_portrait_placement = 0;
164 int speech_portrait_x = 0;
165 int speech_portrait_y = 0;
166 int speech_display_post_time_ms = 0;
168 int dialog_options_highlight_color = 0;
169 int32_t reserved[GAME_STATE_RESERVED_INTS]{};
174 int player_on_region = 0;
175 int screen_is_faded_out = 0;
176 int check_interaction_only = 0;
177 int bg_frame = 0, bg_anim_delay = 0;
178 int music_vol_was = 0;
179 short wait_counter = 0;
180 int8 wait_skipped_by = 0;
181 int wait_skipped_by_data = 0;
187 int bg_frame_locked = 0;
188 int32_t globalscriptvars[MAXGSVALUES]{};
189 int cur_music_number = 0;
190 int music_repeat = 0;
191 int music_master_volume = 0;
192 int digital_master_volume = 0;
193 char walkable_areas_on[MAX_WALK_AREAS]{};
194 short screen_flipped = 0;
195 int entered_at_x = 0;
196 int entered_at_y = 0;
197 int entered_edge = 0;
199 SpeechMode speech_mode;
200 int speech_skip_style = 0;
201 int32_t script_timers[MAX_TIMERS]{};
202 int sound_volume = 0;
203 int speech_volume = 0;
206 int8 key_skip_wait = 0;
207 int swap_portrait_lastchar = 0;
208 int swap_portrait_lastlastchar = 0;
209 bool separate_music_lib =
false;
210 int in_conversation = 0;
212 int num_parsed_words = 0;
213 short parsed_words[MAX_PARSED_WORDS]{};
214 char bad_parsed_word[100]{};
216 int32_t raw_modified[MAX_ROOM_BGFRAMES]{};
218 short filenumbers[MAXSAVEGAMES]{};
219 int room_changes = 0;
220 int mouse_cursor_hidden = 0;
222 int silent_midi_channel = 0;
223 int current_music_repeating = 0;
224 unsigned long shakesc_delay = 0;
225 int shakesc_amount = 0;
226 int shakesc_length = 0;
232 bool rtint_enabled =
false;
233 int end_cutscene_music = 0;
234 int skip_until_char_stops = 0;
235 int get_loc_name_last_time = 0;
236 int get_loc_name_save_cursor = 0;
237 int restore_cursor_mode_to = 0;
238 int restore_cursor_image_to = 0;
239 short music_queue_size = 0;
240 short music_queue[MAX_QUEUED_MUSIC]{};
241 short new_music_queue_size = 0;
242 short crossfading_out_channel = 0;
243 short crossfade_step = 0;
244 short crossfade_out_volume_per_step = 0;
245 short crossfade_initial_volume_out = 0;
246 short crossfading_in_channel = 0;
247 short crossfade_in_volume_per_step = 0;
248 short crossfade_final_volume_in = 0;
250 char takeover_from[50]{};
253 char globalstrings[MAXGLOBALSTRINGS][MAX_MAXSTRLEN]{};
254 char lastParserEntry[MAX_MAXSTRLEN]{};
256 int ground_level_areas_disabled = 0;
257 int next_screen_transition = 0;
258 int gamma_adjustment = 0;
259 short temporarily_turned_off_character = 0;
260 short inv_backwards_compatibility = 0;
263 int text_min_display_time_ms = 0;
264 int ignore_user_input_after_text_timeout_ms = 0;
265 int32_t default_audio_type_volumes[MAX_AUDIO_TYPES]{};
274 bool speech_has_voice =
false;
279 bool speech_voice_blocking =
false;
281 bool speech_in_post_state =
false;
286 int overlay_count = 0;
291 int overlay_creation_id = 0;
293 int complete_overlay_on = 0;
295 int text_overlay_on = 0;
299 int speech_text_schandle = 0;
301 int speech_face_schandle = 0;
304 int shake_screen_yoff = 0;
315 const Rect &GetMainViewport()
const;
317 const Rect &GetUIViewport()
const;
321 bool IsAutoRoomViewport()
const;
323 PViewport GetRoomViewport(
int index)
const;
327 PViewport GetRoomViewportAt(
int x,
int y)
const;
330 Rect GetRoomViewportAbs(
int index)
const;
332 void SetAutoRoomViewport(
bool on);
335 void SetMainViewport(
const Rect &viewport);
337 void SetUIViewport(
const Rect &viewport);
341 void UpdateViewports();
343 void InvalidateViewportZOrder();
345 PCamera GetRoomCamera(
int index)
const;
347 void UpdateRoomCameras();
351 Point RoomToScreen(
int roomx,
int roomy);
352 int RoomToScreenX(
int roomx);
353 int RoomToScreenY(
int roomy);
360 VpPoint ScreenToRoom(
int scrx,
int scry,
bool clip_viewport =
true);
361 VpPoint ScreenToRoomDivDown(
int scrx,
int scry);
364 void CreatePrimaryViewportAndCamera();
368 ScriptViewport *RegisterRoomViewport(
int index, int32_t handle = 0);
370 void DeleteRoomViewport(
int index);
372 int GetRoomViewportCount()
const;
376 ScriptCamera *RegisterRoomCamera(
int index, int32_t handle = 0);
378 void DeleteRoomCamera(
int index);
380 int GetRoomCameraCount()
const;
394 bool IsIgnoringInput()
const;
396 void SetIgnoreInput(
int timeout_ms);
398 void ClearIgnoreInput();
401 void SetWaitSkipResult(
int how,
int data = 0);
402 void SetWaitKeySkip(
const KeyInput &kp) {
403 SetWaitSkipResult(SKIP_KEYPRESS, AGSKeyToScriptKey(kp.Key) | kp.Mod);
409 int GetWaitSkipResult()
const;
415 bool IsBlockingVoiceSpeech()
const;
417 bool IsNonBlockingVoiceSpeech()
const;
419 bool ShouldPlayVoiceSpeech()
const;
424 void ReadCustomProperties_v340(
Shared::Stream *in, GameDataVersion data_ver);
425 void WriteCustomProperties_v340(
Shared::Stream *out, GameDataVersion data_ver)
const;
430 void FreeProperties();
431 void FreeViewportsAndCameras();
434 VpPoint ScreenToRoomImpl(
int scrx,
int scry,
int view_index,
bool clip_viewport,
bool convert_cam_to_data);
435 void UpdateRoomCamera(
int index);
438 bool _isAutoRoomViewport =
true;
458 bool _mainViewportHasChanged =
false;
460 bool _roomViewportZOrderChanged =
false;
462 AGS_Clock::time_point _ignoreUserInputUntilTime = 0;
466 HorAlignment ConvertLegacyScriptAlignment(LegacyScriptAlignment align);
470 HorAlignment ReadScriptAlignment(int32_t align);
Definition: achievements_tables.h:27
Definition: savegame_internal.h:78
Definition: geometry.h:87
Definition: queued_audio_item.h:37
Definition: script_viewport.h:30
Definition: geometry.h:219
Definition: script_camera.h:30
Definition: game_state.h:80
Definition: unordered_set.h:43