ScummVM API documentation
savegame_internal.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 #ifndef AGS_ENGINE_GAME_SAVEGAME_INTERNAL_H
23 #define AGS_ENGINE_GAME_SAVEGAME_INTERNAL_H
24 
25 #include "common/std/memory.h"
26 #include "common/std/vector.h"
27 #include "ags/shared/ac/common_defines.h"
28 #include "ags/shared/game/room_struct.h"
29 #include "ags/shared/gfx/bitmap.h"
30 #include "ags/engine/media/audio/audio_defines.h"
31 
32 namespace AGS3 {
33 namespace AGS {
34 namespace Engine {
35 
36 using AGS::Shared::Bitmap;
37 
38 typedef std::shared_ptr<Bitmap> PBitmap;
39 
40 // PreservedParams keeps old values of particular gameplay
41 // parameters that are saved before the save restoration
42 // and either applied or compared to new values after
43 // loading save data
45  // Whether speech and audio packages available
46  bool SpeechVOX = false;
47  bool MusicVOX = false;
48  // Game options, to preserve ones that must not change at runtime
49  int GameOptions[GameSetupStructBase::MAX_OPTIONS]{};
50  // Script global data sizes
51  size_t GlScDataSize = 0u;
52  std::vector<size_t> ScMdDataSize;
53 
55 };
56 
57 enum GameViewCamFlags {
58  kSvgGameAutoRoomView = 0x01
59 };
60 
61 enum CameraSaveFlags {
62  kSvgCamPosLocked = 0x01
63 };
64 
65 enum ViewportSaveFlags {
66  kSvgViewportVisible = 0x01
67 };
68 
69 // RestoredData keeps certain temporary data to help with
70 // the restoration process
71 struct RestoredData {
72  int FPS;
73  // Unserialized bitmaps for dynamic surfaces
74  std::vector<Bitmap *> DynamicSurfaces;
75  // Scripts global data
76  struct ScriptData {
77  std::vector<char> Data;
78  size_t Len;
79 
80  ScriptData();
81  };
82  ScriptData GlobalScript;
83  std::vector<ScriptData> ScriptModules;
84  // Room data (has to be be preserved until room is loaded)
85  PBitmap RoomBkgScene[MAX_ROOM_BGFRAMES];
86  int16_t RoomLightLevels[MAX_ROOM_REGIONS];
87  int32_t RoomTintLevels[MAX_ROOM_REGIONS];
88  int16_t RoomZoomLevels1[MAX_WALK_AREAS + 1];
89  int16_t RoomZoomLevels2[MAX_WALK_AREAS + 1];
90  RoomVolumeMod RoomVolume;
91  // Mouse cursor parameters
92  int CursorID;
93  int CursorMode;
94  // General audio
95  struct ChannelInfo {
96  int ClipID = -1;
97  int Pos = 0;
98  int Priority = 0;
99  int Repeat = 0;
100  int Vol = 0;
101  int VolAsPercent = 0;
102  int Pan = 0;
103  int Speed = 0;
104  // since version 1
105  int XSource = -1;
106  int YSource = -1;
107  int MaxDist = 0;
108  };
109  ChannelInfo AudioChans[TOTAL_AUDIO_CHANNELS];
110  // Ambient sounds
111  int DoAmbient[MAX_GAME_CHANNELS];
112  // Viewport and camera data, has to be preserved and applied only after
113  // room gets loaded, because we must clamp these to room parameters.
114  struct ViewportData {
115  int ID = -1;
116  int Flags = 0;
117  int Left = 0;
118  int Top = 0;
119  int Width = 0;
120  int Height = 0;
121  int ZOrder = 0;
122  int CamID = -1;
123  };
124  struct CameraData {
125  int ID = -1;
126  int Flags = 0;
127  int Left = 0;
128  int Top = 0;
129  int Width = 0;
130  int Height = 0;
131  };
132  std::vector<ViewportData> Viewports;
133  std::vector<CameraData> Cameras;
134  int32_t Camera0_Flags = 0; // flags for primary camera, when data is read in legacy order
135 
136  RestoredData();
137 };
138 
139 } // namespace Engine
140 } // namespace AGS
141 } // namespace AGS3
142 
143 #endif
Definition: achievements_tables.h:27
Definition: savegame_internal.h:124
Definition: savegame_internal.h:71
Definition: audio.h:36
Definition: ptr.h:159
Definition: savegame_internal.h:114
Definition: engine.h:143
Definition: ags.h:40
Definition: savegame_internal.h:95
Definition: savegame_internal.h:44
Definition: savegame_internal.h:76