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 AGS_PLUGINS_AGS_WAVES_VARS_H
24 #define AGS_PLUGINS_AGS_WAVES_VARS_H
25 
26 #include "audio/audiostream.h"
27 
28 namespace AGS3 {
29 namespace Plugins {
30 namespace AGSWaves {
31 
32 #define texWidth 240
33 #define texHeight 240
34 #define screenWidth 640
35 #define screenHeight 360
36 
37 // TODO: Dummy definitions that need to be fixed
38 typedef void *stb_vorbis;
39 typedef void *Mix_Chunk;
40 typedef int SDL_AudioSpec;
41 typedef int SDL_AudioDeviceID;
42 
43 struct Particle {
44 	int x;
45 	int y;
46 	int transp;
47 	int life;
48 	bool active;
49 	int dx;
50 	int dy;
51 	int mlay;
52 	int timlay;
53 	int movedport;
54 	int translay;
55 	int translayHold;
56 	int width;
57 	int height;
58 	int fx;
59 	int fy;
60 	bool doingcircle;
61 	float angle;
62 	float radius;
63 	int doingCircleChance;
64 	float angleLay;
65 	int frame;
66 	float anglespeed;
67 };
68 
69 /*---------------------------------------------*/
70 
71 typedef int (*SCAPI_CHARACTER_GETX)(AGSCharacter *ch);
72 typedef int (*SCAPI_CHARACTER_GETY)(AGSCharacter *ch);
73 typedef int (*SCAPI_CHARACTER_ID) (AGSCharacter *ch);
74 
75 //WAVE SOUNDS FILES
76 struct SoundEffect {
77 	Audio::SoundHandle _soundHandle;
78 	int _repeat = 0;
79 	int _volume = 0;
80 	int _allow = 0;
81 	int _channel = 0;
82 	int _filter = 0;
83 	int _playing = 0;
84 };
85 
86 struct Aud {
87 	int NumOfChannels = 0;
88 	bool Initialized = false;
89 	bool Disabled = false;
90 	int FilterFrequency = 0;
91 	int SoundValue = 0;
92 };
93 
94 struct Mus {
95 	int ID = 0;
96 	int FadeTime = 0;
97 	float FadeRate = 0;
98 	float FadeVolume = 0;
99 	int Channel = 0;
100 	bool Switch = 0;
101 	bool HaltedZero = 0;
102 	bool HaltedOne = 0;
103 	Audio::SoundHandle _soundHandle;
104 };
105 
106 struct RainParticle {
107 	int x = 0;
108 	int y = 0;
109 	int fx = 0;
110 	int fy = 0;
111 	int life = 0;
112 	int trans = 0;
113 	bool active = 0;
114 	int translay = 0;
115 	int transhold = 0;
116 };
117 
118 struct MusicStream {
119 	int volume = 0;
120 	const char *Filename = nullptr;
121 	int repeat = 0;
122 	stb_vorbis *Vorbis = 0;
123 	bool fix_click = false;
124 };
125 
126 struct DustParticle {
127 	int x = 0;
128 	int y = 0;
129 	int transp = 0;
130 	int life = 0;
131 	bool active = false;
132 	int dx = 0;
133 	int dy = 0;
134 	int mlay = 0;
135 	int timlay = 0;
136 	int movedport = 0;
137 	int translay = 0;
138 	int translayHold = 0;
139 };
140 
141 struct Vars {
142 	int32 screen_width = 640;
143 	int32 screen_height = 360;
144 	int32 screen_color_depth = 32;
145 	AGSCharacter *playerCharacter = nullptr;
146 
147 	PluginMethod Character_GetX;
148 	PluginMethod Character_GetY;
149 	PluginMethod Character_ID;
150 
151 	SoundEffect SFX[500];
152 	RainParticle RainParticles[400];
153 	RainParticle RainParticlesFore[400];
154 	RainParticle RainParticlesBack[800];
155 	Aud GeneralAudio;
156 	Mus MFXStream;
157 
158 	int currentMusic = -1;
159 	int currentMusicRepeat = -1;
160 	int currentMusicFadein = 0;
161 
162 	double xv[3];
163 	double yv[3];
164 	double xvOGG[3];
165 	double yvOGG[3];
166 
167 	Particle particles[110];
168 	Particle particlesF[10];
169 	Particle particles2[12];
170 	int WForceX[400];
171 	int WForceY[400];
172 
173 	int raysizeF = 4;
174 	int dsizeF = 0;
175 	int raysize = 100;
176 	int dsize = 0;
177 	int raysize2 = 12;
178 	int dsize2 = 0;
179 	int creationdelayf = 0;
180 	int ww;
181 	int hh;
182 	int proom;
183 	int prevroom;
184 	bool OGG_Filter = false;
185 
186 	SDL_AudioSpec spec[2];
187 	MusicStream globalStream[2];
188 	SDL_AudioDeviceID getDevice[2];
189 	bool AudioEnabled = false;
190 	float ix = 0, iy = 0, ua = 0;
191 	float b_time[5];
192 	float d_time = 0;
193 
194 	// Y-coordinate first because we use horizontal scanlines
195 	uint32 texture[texHeight][texWidth];
196 	int distanceTable[screenHeight][screenWidth];
197 	int angleTable[screenHeight][screenWidth];
198 	bool generateonce = false;
199 
200 	DustParticle dusts[200];
201 	int waitBy = 6;
202 	int raysizeDust = 200;
203 	int dsizeDust = 0;
204 	int creationdelay = 0;
205 	int Walkbehind[20];
206 	char *GameDatavalue[40000];
207 	char *Token[10000];
208 	int TokenUnUsed[10000];
209 	int usedTokens = 0;
210 
211 	int dY[30];
212 	int tDy[30];
213 	int direction[30];
214 
215 	// Warper fields
216 	int _newWidth = 0, _newHeight = 0;
217 	int _y2 = 0;
218 	int _x3 = 0, _y3 = 0;
219 	int _x4 = 0, _y4 = 0;
220 };
221 
222 } // namespace AGSWaves
223 } // namespace Plugins
224 } // namespace AGS3
225 
226 #endif
227