ScummVM API documentation
amiga_decode.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  */
21 
22 #ifndef MACS2_AMIGA_DECODE_H
23 #define MACS2_AMIGA_DECODE_H
24 
25 #include "common/array.h"
26 #include "common/scummsys.h"
27 
28 namespace Macs2 {
29 
43 struct AmigaMxooInfo {
44  uint32 scriptOffset = 0;
45  uint32 stringOffset = 0;
46  uint32 slotOffsets[21];
47  uint32 extraOffset = 0;
48  uint32 bodyOffset = 12; // start of body within MXOO
49  uint32 bodySize = 0;
50 
51  AmigaMxooInfo() {
52  for (uint i = 0; i < 21; i++)
53  slotOffsets[i] = 0xFFFFFFFF;
54  }
55 };
56 
58  uint16 frameCount = 0;
59  uint16 width = 0;
60  uint16 height = 0;
61  uint16 seqPos = 0;
62  uint16 repeatCounter = 0;
63  uint16 loopStart = 0;
64  uint16 headerHint = 0;
65  uint32 pixelOffset = 0; // absolute offset in MXOO of first planar byte
66  uint32 headerSize = 0; // bytes from slot start to pixel data
67  bool valid = false;
68 };
69 
70 bool parseAmigaMxoo(const byte *mxoo, uint32 mxooSize, AmigaMxooInfo &out);
71 bool inspectAmigaAnimSlot(const byte *mxoo, uint32 mxooSize, uint32 bodyRelativeOffset, AmigaAnimSlotInfo &out);
72 
74 bool decodeAmigaPlanarFrame(const byte *planar, uint16 width, uint16 height, uint16 frameIndex,
75  uint16 frameCount, Common::Array<byte> &outPixels);
76 
81 bool convertAmigaAnimSlotToDosBlob(const byte *mxoo, uint32 mxooSize, uint32 bodyRelativeOffset,
82  Common::Array<byte> &outBlob);
83 
85 bool extractAmigaScript(const byte *mxoo, uint32 mxooSize, Common::Array<byte> &outScript);
86 
91 bool extractAmigaStringBlock(const byte *mxoo, uint32 mxooSize, Common::Array<byte> &outStrings);
92 
94 bool convertAmigaSimpleSpriteToDosBlob(const byte *mxoo, uint32 mxooSize, Common::Array<byte> &outBlob);
95 
103 bool convertAmigaPortraitAtlasToDosBlob(const byte *mxoo, uint32 mxooSize, uint32 bodyRelativeExtraOffset,
104  Common::Array<byte> &outBlob);
105 
107 enum : uint32 {
108  kAmigaSceneScreenSize = 54432, // 0xD4A0
109  kAmigaSceneCopperOffset = 0xBB80,
110  kAmigaSceneCopperSize = 0x1920, // 16 base colors + 200x16 line colors
111  kAmigaScenePlaneBytes = 8000 // 40x200
112 };
113 enum : uint16 {
114  kAmigaSceneWidth = 320,
115  kAmigaSceneHeight = 200,
116  kAmigaScenePlanes = 6 // BPLCON0 = 0x6200 -> EHB
117 };
118 
131 bool decodeAmigaMxmmSceneBackground(const byte *mxmm, uint32 mxmmSize,
132  Common::Array<byte> &outPixels,
133  byte outPaletteRgb[768],
134  uint &outColorCount);
135 
150 bool extractAmigaMxmmSceneScript(const byte *mxmm, uint32 mxmmSize,
151  Common::Array<byte> &outScript,
152  Common::Array<byte> &outStrings);
153 
169 bool extractAmigaMxmmSceneWalkParams(const byte *mxmm, uint32 mxmmSize,
170  uint16 &outWalkDepthThresholdY,
171  uint16 &outWalkDepthScaleFactor,
172  uint16 &outWalkBaseSpeedPct,
173  uint16 &outScenePaletteMode,
174  uint16 &outPaletteDarkenPercent);
175 
185  uint16 x = 0;
186  uint16 y = 0;
187  byte adjacent[4] = {0, 0, 0, 0};
188  uint16 numConnections = 0;
189 };
190 
197 bool extractAmigaMxmmScenePathfinding(const byte *mxmm, uint32 mxmmSize,
198  uint16 &outNumPoints,
200 
208 bool extractAmigaMxmmSceneMaps(const byte *mxmm, uint32 mxmmSize,
209  Common::Array<byte> &outPathfinding,
210  Common::Array<byte> &outDepth,
211  Common::Array<byte> &outShadow);
212 
219 bool extractAmigaMxmmSceneHotspotColors(const byte *mxmm, uint32 mxmmSize,
220  uint16 &outNumHotspots,
221  Common::Array<uint16> &outColorTable);
222 
230 bool extractAmigaMxmmMxccHotspotMap(const byte *mxmm, uint32 mxmmSize,
231  Common::Array<byte> &outHotspotMap);
232 
237 bool amigaMxmmHasMxaaOverlay(const byte *mxmm, uint32 mxmmSize);
238 
244  byte ascii = 0;
245  uint16 width = 0;
246  uint16 height = 0;
247  Common::Array<byte> pixels; // width * height
248 };
249 
259 bool decodeAmigaMxffFont(const byte *mxff, uint32 mxffSize, Common::Array<AmigaMxffGlyph> &outGlyphs);
260 
266 bool extractAmigaMxosPcm(const byte *mxos, uint32 mxosSize, Common::Array<byte> &outPcm, uint16 &outRateHz);
267 
268 } // End of namespace Macs2
269 
270 #endif // MACS2_AMIGA_DECODE_H
Definition: amiga_decode.h:243
Definition: amiga_decode.h:184
Definition: amiga_decode.h:43
Definition: amiga_decode.h:57
Definition: actionbar.h:31