ScummVM API documentation
handle.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  * Graphics Memory Manager data structures
21  */
22 
23 #ifndef TINSEL_HANDLE_H
24 #define TINSEL_HANDLE_H
25 
26 #include "common/path.h"
27 #include "tinsel/dw.h" // new data types
28 
29 namespace Common {
30 class File;
31 }
32 
33 namespace Tinsel {
34 
35 struct FONT;
36 struct MEMHANDLE;
37 struct PALETTE;
38 struct IMAGE;
39 struct ACTORDATA;
40 struct PROCESS_STRUC;
41 
42 class Handle {
43 public:
44  Handle();
45  virtual ~Handle();
46 
50  void SetupHandleTable();
51 
52  FONT *GetFont(SCNHANDLE offset);
53  PALETTE *GetPalette(SCNHANDLE offset);
54  const IMAGE *GetImage(SCNHANDLE offset);
55  void SetImagePalette(SCNHANDLE offset, SCNHANDLE palHandle);
56  SCNHANDLE GetFontImageHandle(SCNHANDLE offset);
57  const ACTORDATA *GetActorData(SCNHANDLE offset, uint32 count);
58  const PROCESS_STRUC *GetProcessData(SCNHANDLE offset, uint32 count);
59  byte *LockMem(SCNHANDLE offset);
60 
61  void LockScene(SCNHANDLE offset);
62  void UnlockScene(SCNHANDLE offset);
63 
64  bool IsCdPlayHandle(SCNHANDLE offset);
65 
66  void TouchMem(SCNHANDLE offset);
67 
68  // Called at scene startup
69  void SetCdPlaySceneDetails(const char *fileName);
70 
71  // Called at game startup
72  void SetCdPlayHandle(int fileNum);
73 
74  void LoadExtraGraphData(
75  SCNHANDLE start, // Handle of start of range
76  SCNHANDLE next); // Handle of end of range + 1
77 
78  int CdNumber(SCNHANDLE offset);
79 
80  // Noir
81  SCNHANDLE FindLanguageSceneHandle(const char *fileName);
82 
83 #ifdef BODGE
84  bool ValidHandle(SCNHANDLE offset);
85 #endif
86 
87 private:
88  void LoadFile(MEMHANDLE *pH); // load a memory block as a file
89  void OpenCDGraphFile();
90  void LoadCDGraphData(MEMHANDLE *pH);
91 
92  // handle table gets loaded from index file at runtime
93  MEMHANDLE *_handleTable;
94 
95  // number of handles in the handle table
96  uint _numHandles;
97 
98  uint32 _cdPlayHandle;
99 
100  SCNHANDLE _cdBaseHandle, _cdTopHandle;
101  Common::File *_cdGraphStream;
102 
103  Common::Path _szCdPlayFile;
104 };
105 
106 } // End of namespace Tinsel
107 
108 #endif // TINSEL_HANDLE_H
uint32 SCNHANDLE
Definition: dw.h:31
Definition: handle.h:42
Definition: text.h:52
Definition: object.h:58
Definition: path.h:52
Definition: actors.h:81
Definition: sched.h:35
Definition: palette.h:62
Definition: file.h:47
Definition: algorithm.h:29
Definition: actors.h:36