aboutsummaryrefslogtreecommitdiff
path: root/smush.h
blob: cd325da5d703534842c3cbd626f32d9d803c9563 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
/* ScummVM - Scumm Interpreter
 * Copyright (C) 2001  Ludvig Strigeus
 * Copyright (C) 2001/2002 The ScummVM project
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License
 * as published by the Free Software Foundation; either version 2
 * of the License, or (at your option) any later version.

 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.

 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 *
 * $Header$
 *
 */

#define SP_MAX_FONTS 5

struct PersistentCodecData37 {
        byte *deltaBuf;
        byte *deltaBufs[2];
        uint32 deltaSize;
        uint width, height;
        int curtable;
        int unk2,unk3;

        uint16 flags;

        int16 *table1;
        int table_last_pitch;
        byte table_last_flags;
};

struct CodecData {
        byte *out,*src;
        int x,y;
        int outwidth,outheight;
        int w,h,pitch;

        int flags;
};


struct SmushPlayer {
        FILE *_in;
        bool _paletteChanged;
        byte * _block;
        uint32 _blockTag;
        uint32 _blockSize;
        byte *_cur;
        byte *_renderBitmap;
        uint32 _frameSize;
        uint32 _frmeTag, _frmeSize;

        byte *_deltaBuf; 
        int _deltaBufSize; 

	byte * _fonts[SP_MAX_FONTS];
	byte * _buffer_tres;

        PersistentCodecData37 pcd37;
        
        byte _fluPalette[768];
        uint16 _fluPalMul129[768];
        uint16 _fluPalWords[768];

	byte * loadTres();
	void loadFonts();
	byte * getStringTRES(int32 number);
	void drawStringTRES(uint32 x, uint32 y, byte * txt);
	void drawCharTRES(uint32 * x, uint32 y, uint32 c_line, uint8 c_font, uint8 color, uint8 txt);

		/* PSAD: Full Throttle audio */
		uint32 _saudSize[8], _saudSubSize[8];
		uint16 _psadTrk[8], _strkRate[8];
		uint32 _saudSubTag[8];

		/* IACT: The Dig audio */
		uint32 _imusSize[8], _imusSubSize[8];
		uint32 _imusTrk[8], _imusRate[8], _imusChan[8];
		uint32 _imusSubTag[8];
		byte _imusData[8][3];
		uint32 _imusPos[8], _imusCodec[8];

        void openFile(byte* fileName);
        void nextBlock();

        uint32 fileReadBE32();
        uint32 fileReadLE32();
        void go();

        bool parseTag();		
        void parseAHDR();
        void parseFRME();

        void parseNPAL();
        void parseFOBJ();
        void parsePSAD(); 
        void parseTRES();
        void parseXPAL();
		void parseIACT();
        void fileRead(void *mem, int len);

        uint32 nextBE32();
        void init();
        void deinit();

        void startVideo(short int arg, byte* videofile);

	void setPalette();

	long fileSize;

	Scumm *sm;

	int _frameChanged;

};