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 
31 namespace M4 {
32 
33 #define _WS_ASSET_MACH 0
34 #define _WS_ASSET_SEQU 1
35 #define _WS_ASSET_CELS 2
36 #define _WS_ASSET_DATA 3
37 
38 #define CHUNK_MACH 0x4D414348 //'MACH'
39 #define CHUNK_SEQU 0x53455155 //'SEQU'
40 #define CHUNK_DATA 0x44415441 //'DATA'
41 #define CHUNK_CELS 0x43454C53 //'CELS'
42 
43 #define CHUNK_NECS 0x4E454353 //INTEL 'SCEN'
44 #define CHUNK_HCAM 0x4843414D //INTEL 'MACH'
45 #define CHUNK_UQES 0x55514553 //INTEL 'SEQU'
46 #define CHUNK_SLEC 0x534C4543 //INTEL 'CELS'
47 #define CHUNK_ATAD 0x41544144 //INTEL 'DATA'
48 
49 #define MACH_NUM_STATES 0
50 #define MACH_OFFSETS 1
51 
52 #define SEQU_NUM_VARS 0
53 #define SEQU_SEQU_START 1
54 
55 #define DATA_REC_COUNT 0
56 #define DATA_REC_SIZE 1
57 #define DATA_REC_START 2
58 
59 #define MAX_ASSET_HASH 255
60 
62  bool _wsloaderInitialized = false;
63  char **_globalMACHnames = nullptr;
64  char **_globalSEQUnames = nullptr;
65  char **_globalDATAnames = nullptr;
66  char **_globalCELSnames = nullptr;
67 
68  MemHandle *_globalMACHHandles = nullptr;
69  int32 *_globalMACHoffsets = nullptr;
70  MemHandle *_globalSEQUHandles = nullptr;
71  int32 *_globalSEQUoffsets = nullptr;
72  MemHandle *_globalDATAHandles = nullptr;
73  int32 *_globalDATAoffsets = nullptr;
74  MemHandle *_globalCELSHandles = nullptr;
75  int32 *_globalCELSoffsets = nullptr;
76  int32 *_globalCELSPaloffsets = nullptr;
77 };
78 
79 bool InitWSAssets();
80 bool ClearWSAssets(uint32 assetType, int32 minHash, int32 maxHash);
81 void ShutdownWSAssets();
82 
83 bool LoadWSAssets(const char *wsAssetName);
84 bool LoadWSAssets(const char *wsAssetName, RGB8 *myPalette);
85 int32 AddWSAssetCELS(const char *wsAssetName, int32 hash, RGB8 *myPalette);
86 M4sprite *GetWSAssetSprite(char *spriteName, uint32 hash, uint32 index, M4sprite *mySprite, bool *streamSeries);
87 
88 CCB *GetWSAssetCEL(uint32 hash, uint32 index, CCB *myCCB);
89 int32 GetWSAssetCELCount(uint32 hash);
90 int32 GetWSAssetCELFrameRate(uint32 hash);
91 int32 GetWSAssetCELPixSpeed(uint32 hash);
92 int32 ws_get_sprite_width(uint32 hash, int32 index);
93 int32 ws_get_sprite_height(uint32 hash, int32 index);
94 MemHandle ws_GetSEQU(uint32 hash, int32 *numLocalVars, int32 *offset);
95 MemHandle ws_GetMACH(uint32 hash, int32 *numStates, int32 *stateTableOffset, int32 *machInstrOffset);
96 MemHandle ws_GetDATA(uint32 hash, uint32 index, int32 *rowOffset);
97 int32 ws_GetDATACount(uint32 hash);
98 int32 GetSSHeaderInfo(Common::SeekableReadStream *stream, uint32 **data, RGB8 *myPalette);
99 bool ws_GetSSMaxWH(MemHandle ssHandle, int32 ssOffset, int32 *maxW, int32 *maxH);
100 
101 // USING SPRITES WITHOUT GOING THROUGH THE WOODSCRIPT TREE
102 int32 LoadSpriteSeries(const char *assetName, MemHandle *seriesHandle, int32 *celsOffset, int32 *palOffset, RGB8 *myPalette);
103 int32 LoadSpriteSeriesDirect(const char *assetName, MemHandle *seriesHandle, int32 *celsOffset, int32 *palOffset, RGB8 *myPalette);
104 M4sprite *CreateSprite(MemHandle resourceHandle, int32 handleOffset, int32 index, M4sprite *mySprite, bool *streamSeries);
105 
106 // WOODSCRIPT STREAMING API
107 bool ws_OpenSSstream(SysFile *streamFile, Anim8 *anim8);
108 bool ws_GetNextSSstreamCel(Anim8 *anim8);
109 void ws_CloseSSstream(CCB *myCCB);
110 
111 } // End of namespace M4
112 
113 #endif
Definition: ws_load.h:61
Definition: ws_machine.h:117
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:101