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
31namespace 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
79bool InitWSAssets();
80bool ClearWSAssets(uint32 assetType, int32 minHash, int32 maxHash);
81void ShutdownWSAssets();
82
83bool LoadWSAssets(const char *wsAssetName);
84bool LoadWSAssets(const char *wsAssetName, RGB8 *myPalette);
85int32 AddWSAssetCELS(const char *wsAssetName, int32 hash, RGB8 *myPalette);
86M4sprite *GetWSAssetSprite(char *spriteName, uint32 hash, uint32 index, M4sprite *mySprite, bool *streamSeries);
87
88CCB *GetWSAssetCEL(uint32 hash, uint32 index, CCB *myCCB);
89int32 GetWSAssetCELCount(uint32 hash);
90int32 GetWSAssetCELFrameRate(uint32 hash);
91int32 GetWSAssetCELPixSpeed(uint32 hash);
92int32 ws_get_sprite_width(uint32 hash, int32 index);
93int32 ws_get_sprite_height(uint32 hash, int32 index);
94MemHandle ws_GetSEQU(uint32 hash, int32 *numLocalVars, int32 *offset);
95MemHandle ws_GetMACH(uint32 hash, int32 *numStates, int32 *stateTableOffset, int32 *machInstrOffset);
96MemHandle ws_GetDATA(uint32 hash, uint32 index, int32 *rowOffset);
97int32 ws_GetDATACount(uint32 hash);
98bool ws_GetSSMaxWH(MemHandle ssHandle, int32 ssOffset, int32 *maxW, int32 *maxH);
99
100// USING SPRITES WITHOUT GOING THROUGH THE WOODSCRIPT TREE
101int32 LoadSpriteSeries(const char *assetName, MemHandle *seriesHandle, int32 *celsOffset, int32 *palOffset, RGB8 *myPalette);
102M4sprite *CreateSprite(MemHandle resourceHandle, int32 handleOffset, int32 index, M4sprite *mySprite, bool *streamSeries);
103
104// WOODSCRIPT STREAMING API
105bool ws_OpenSSstream(SysFile *streamFile, Anim8 *anim8);
106bool ws_GetNextSSstreamCel(Anim8 *anim8);
107void ws_CloseSSstream(CCB *myCCB);
108
109} // End of namespace M4
110
111#endif
Definition: sys_file.h:47
Definition: database.h:28
Definition: ws_machine.h:118
Definition: ws_machine.h:102
Definition: gui.h:31
Definition: m4_types.h:78
Definition: ws_load.h:61