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  * Should really be called "moving actors.h"
22  */
23 
24 #ifndef TINSEL_SAVESCN_H
25 #define TINSEL_SAVESCN_H
26 
27 #include "tinsel/actors.h"	// SAVED_ACTOR
28 #include "tinsel/dw.h"	// SCNHANDLE
29 #include "tinsel/movers.h"	// SAVED_MOVER
30 #include "tinsel/pcode.h"	// INT_CONTEXT
31 #include "tinsel/play.h"
32 #include "tinsel/polygons.h"
33 #include "tinsel/scroll.h"	// SCROLLDATA
34 #include "tinsel/sysvar.h"
35 
36 namespace Tinsel {
37 
38 #define SG_DESC_LEN 40 // Max. saved game description length
39 #define MAX_SAVED_FILES 100
40 
41 struct SAVED_DATA {
42 	SCNHANDLE	SavedSceneHandle;		// Scene handle
43 	SCNHANDLE	SavedBgroundHandle;		// Background handle
44 	SAVED_MOVER	SavedMoverInfo[MAX_MOVERS];	// Moving actors
45 	SAVED_ACTOR	SavedActorInfo[MAX_SAVED_ACTORS];	// } Actors
46 	int			NumSavedActors;				// }
47 	int			SavedLoffset, SavedToffset;	// Screen offsets
48 	INT_CONTEXT	SavedICInfo[MAX_INTERPRET];	// Interpret contexts
49 	bool		SavedDeadPolys[MAX_POLY];
50 	bool		SavedControl;
51 	SCNHANDLE	SavedMidi;			// }
52 	bool		SavedLoop;			// } Midi
53 	bool		SavedNoBlocking;
54 	SCROLLDATA	SavedNoScrollData;
55 
56 	// Tinsel 2 fields
57 	Z_POSITIONS	zPositions[NUM_ZPOSITIONS];
58 	byte		savedActorZ[MAX_SAVED_ACTOR_Z];
59 	POLY_VOLATILE	SavedPolygonStuff[MAX_POLY];
60 	uint32		SavedTune[3];			// Music
61 	bool		bTinselDim;
62 	int			SavedScrollFocus;
63 	int			SavedSystemVars[SV_TOPVALID];
64 	SOUNDREELS	SavedSoundReels[MAX_SOUNDREELS];
65 };
66 
67 
68 enum SRSTATE {
69 	SR_IDLE, SR_DORESTORE, SR_DONERESTORE,
70 	SR_DOSAVE, SR_DONESAVE,	SR_ABORTED
71 };
72 
73 void TinselRestoreScene(bool bFade);
74 void TinselSaveScene(CORO_PARAM);
75 void DoRestoreScene(SAVED_DATA *sd, bool bFadeOut);
76 void DoSaveScene(SAVED_DATA *sd);
77 
78 bool IsRestoringScene();
79 
80 
81 enum letype{
82 	LE_NAME, LE_DESC
83 };
84 
85 char *ListEntry(int i, letype which);
86 int getList();
87 void setNeedLoad();
88 
89 void RestoreGame(int num);
90 void SaveGame(char *name, char *desc);
91 
92 void ProcessSRQueue();
93 
94 void RequestSaveGame(char *name, char *desc, SAVED_DATA *sd, int *ssCount, SAVED_DATA *ssData);
95 void RequestRestoreGame(int num, SAVED_DATA *sd, int *ssCount, SAVED_DATA *ssData);
96 
97 void InitializeSaveScenes();
98 void FreeSaveScenes();
99 
100 } // End of namespace Tinsel
101 
102 #endif	/* TINSEL_SAVESCN_H */
103