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