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
8  * modify it under the terms of the GNU General Public License
9  * as published by the Free Software Foundation; either version 2
10  * of the License, or (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, write to the Free Software
19  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
20  *
21  */
22 
23 #ifndef SCUMM_HE_MOONBASE_MOONBASE_H
24 #define SCUMM_HE_MOONBASE_MOONBASE_H
25 
26 #ifdef ENABLE_HE
27 
28 #include "common/winexe_pe.h"
29 
30 namespace Scumm {
31 
32 class AI;
33 class Net;
34 
35 class Moonbase {
36 public:
37 	Moonbase(ScummEngine_v100he *vm);
38 	~Moonbase();
39 
40 	int readFromArray(int array, int y, int x);
41 	void deallocateArray(int array);
42 	int callScummFunction(int scriptNumber, int paramCount,...);
43 
44 	void blitT14WizImage(uint8 *dst, int dstw, int dsth, int dstPitch, const Common::Rect *clipBox,
45 			 uint8 *wizd, int srcx, int srcy, int rawROP, int paramROP);
46 	void blitDistortion(byte *bufferData, const int bufferWidth, const int bufferHeight, const int bufferPitch,
47 			const Common::Rect *optionalClippingRect, byte *dataStream, const int x, const int y, byte *altSourceBuffer);
48 
49 	// FOW Stuff
isFOW(int resNum,int state,uint32 conditionBits)50 	bool isFOW(int resNum, int state, uint32 conditionBits) {
51 		return resNum == _fowSentinelImage && state == _fowSentinelState && conditionBits == _fowSentinelConditionBits;
52 	}
53 
54 	void initFOW();
55 	void releaseFOWResources();
56 
57 	bool setFOWImage(int id);
58 
59 	void setFOWInfo(int fowInfoArray, int downDim, int acrossDim, int viewX, int viewY, int clipX1,
60 		int clipY1, int clipX2, int clipY2, int technique, int nFrame);
61 
62 
63 	void renderFOW(uint8 *destSurface, int dstPitch, int dstType, int dstw, int dsth, int flags);
64 
65 private:
66 	int readFOWVisibilityArray(int array, int y, int x);
67 	void renderFOWState(uint8 *destSurface, int dstPitch, int dstType, int dstw, int dsth, int x, int y, int srcw, int srch, int state, int flags);
68 
69 public:
70 	int _fowSentinelImage;
71 	int _fowSentinelState;
72 	uint32 _fowSentinelConditionBits;
73 
74 	AI *_ai;
75 #ifdef USE_SDL_NET
76 	Net *_net;
77 #endif
78 
79 private:
80 	ScummEngine_v100he *_vm;
81 
82 	int _fowFrameBaseNumber;
83 	int _fowAnimationFrames;
84 	int _fowCurrentFOWFrame;
85 
86 	int32 _fowTileW;
87 	int32 _fowTileH;
88 
89 	uint8 *_fowImage;
90 	int _fowClipX1;
91 	int _fowClipY1;
92 	int _fowClipX2;
93 	int _fowClipY2;
94 
95 	int _fowDrawX;
96 	int _fowDrawY;
97 
98 	int _fowVtx1;
99 	int _fowVty1;
100 	int _fowMvx;
101 	int _fowMvy;
102 	int _fowVw;
103 	int _fowVh;
104 
105 	bool _fowBlackMode;
106 
107 	int32 _fowRenderTable[32768];
108 
109 	Common::PEResources _exe;
110 	Common::String _fileName;
111 };
112 
113 } // End of namespace Scumm
114 
115 #endif // ENABLE_HE
116 
117 #endif // SCUMM_HE_MOONBASE_H
118