ScummVM API documentation
ws_load.h
1 
2 /* ScummVM - Graphic Adventure Engine
3  *
4  * ScummVM is the legal property of its developers, whose names
5  * are too numerous to list here. Please refer to the COPYRIGHT
6  * file distributed with this source distribution.
7  *
8  * This program is free software: you can redistribute it and/or modify
9  * it under the terms of the GNU General Public License as published by
10  * the Free Software Foundation, either version 3 of the License, or
11  * (at your option) any later version.
12  *
13  * This program is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16  * GNU General Public License for more details.
17  *
18  * You should have received a copy of the GNU General Public License
19  * along with this program. If not, see <http://www.gnu.org/licenses/>.
20  *
21  */
22 
23 #ifndef M4_WSCRIPT_WS_LOAD_H
24 #define M4_WSCRIPT_WS_LOAD_H
25 
26 #include "m4/m4_types.h"
27 #include "m4/fileio/sys_file.h"
28 #include "m4/mem/reloc.h"
29 #include "m4/wscript/ws_machine.h"
30 #include "m4/wscript/ws_univ.h"
31 
32 namespace M4 {
33 
34 #define _WS_ASSET_MACH 0
35 #define _WS_ASSET_SEQU 1
36 #define _WS_ASSET_CELS 2
37 #define _WS_ASSET_DATA 3
38 
39 #define CHUNK_MACH 0x4D414348 //'MACH'
40 #define CHUNK_SEQU 0x53455155 //'SEQU'
41 #define CHUNK_DATA 0x44415441 //'DATA'
42 #define CHUNK_CELS 0x43454C53 //'CELS'
43 
44 #define CHUNK_NECS 0x4E454353 //INTEL 'SCEN'
45 #define CHUNK_HCAM 0x4843414D //INTEL 'MACH'
46 #define CHUNK_UQES 0x55514553 //INTEL 'SEQU'
47 #define CHUNK_SLEC 0x534C4543 //INTEL 'CELS'
48 #define CHUNK_ATAD 0x41544144 //INTEL 'DATA'
49 
50 #define MACH_NUM_STATES 0
51 #define MACH_OFFSETS 1
52 
53 #define SEQU_NUM_VARS 0
54 #define SEQU_SEQU_START 1
55 
56 #define DATA_REC_COUNT 0
57 #define DATA_REC_SIZE 1
58 #define DATA_REC_START 2
59 
60 #define MAX_ASSET_HASH 255
61 
63  bool _wsloaderInitialized = false;
64  char **_globalMACHnames = nullptr;
65  char **_globalSEQUnames = nullptr;
66  char **_globalDATAnames = nullptr;
67  char **_globalCELSnames = nullptr;
68 
69  MemHandle *_globalMACHHandles = nullptr;
70  int32 *_globalMACHoffsets = nullptr;
71  MemHandle *_globalSEQUHandles = nullptr;
72  int32 *_globalSEQUoffsets = nullptr;
73  MemHandle *_globalDATAHandles = nullptr;
74  int32 *_globalDATAoffsets = nullptr;
75  MemHandle *_globalCELSHandles = nullptr;
76  int32 *_globalCELSoffsets = nullptr;
77  int32 *_globalCELSPaloffsets = nullptr;
78 };
79 
80 bool InitWSAssets();
81 bool ClearWSAssets(uint32 assetType, int32 minHash, int32 maxHash);
82 void ShutdownWSAssets();
83 
84 bool LoadWSAssets(const char *wsAssetName);
85 bool LoadWSAssets(const char *wsAssetName, RGB8 *myPalette);
86 int32 AddWSAssetCELS(const char *wsAssetName, int32 hash, RGB8 *myPalette);
87 M4sprite *GetWSAssetSprite(char *spriteName, uint32 hash, uint32 index, M4sprite *mySprite, bool *streamSeries);
88 
89 CCB *GetWSAssetCEL(uint32 hash, uint32 index, CCB *myCCB);
90 int32 GetWSAssetCELCount(uint32 hash);
91 int32 GetWSAssetCELFrameRate(uint32 hash);
92 int32 GetWSAssetCELPixSpeed(uint32 hash);
93 int32 ws_get_sprite_width(uint32 hash, int32 index);
94 int32 ws_get_sprite_height(uint32 hash, int32 index);
95 MemHandle ws_GetSEQU(uint32 hash, int32 *numLocalVars, int32 *offset);
96 MemHandle ws_GetMACH(uint32 hash, int32 *numStates, int32 *stateTableOffset, int32 *machInstrOffset);
97 MemHandle ws_GetDATA(uint32 hash, uint32 index, int32 *rowOffset);
98 int32 ws_GetDATACount(uint32 hash);
99 int32 GetSSHeaderInfo(Common::SeekableReadStream *stream, uint32 **data, RGB8 *myPalette);
100 bool ws_GetSSMaxWH(MemHandle ssHandle, int32 ssOffset, int32 *maxW, int32 *maxH);
101 
102 // USING SPRITES WITHOUT GOING THROUGH THE WOODSCRIPT TREE
103 int32 LoadSpriteSeries(const char *assetName, MemHandle *seriesHandle, int32 *celsOffset, int32 *palOffset, RGB8 *myPalette);
104 int32 LoadSpriteSeriesDirect(const char *assetName, MemHandle *seriesHandle, int32 *celsOffset, int32 *palOffset, RGB8 *myPalette);
105 M4sprite *CreateSprite(MemHandle resourceHandle, int32 handleOffset, int32 index, M4sprite *mySprite, bool *streamSeries);
106 
107 // WOODSCRIPT STREAMING API
108 bool ws_OpenSSstream(SysFile *streamFile, Anim8 *anim8);
109 bool ws_GetNextSSstreamCel(Anim8 *anim8);
110 void ws_CloseSSstream(CCB *myCCB);
111 
112 } // End of namespace M4
113 
114 #endif
Definition: ws_load.h:62
Definition: ws_machine.h:92
Definition: stream.h:745
Definition: m4_types.h:88
Definition: database.h:28
Definition: gui.h:31
Definition: sys_file.h:47
Definition: ws_machine.h:76