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 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189
|
/* ScummVM - Graphic Adventure Engine
*
* ScummVM is the legal property of its developers, whose names
* are too numerous to list here. Please refer to the COPYRIGHT
* file distributed with this source distribution.
*
* 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 3 of the License, or
* 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, see <http://www.gnu.org/licenses/>.
*
*/
#ifndef AGS_PLUGINS_AGS_WAVES_AGS_WAVES_H
#define AGS_PLUGINS_AGS_WAVES_AGS_WAVES_H
#include "audio/mixer.h"
#include "common/fs.h"
#include "ags/plugins/ags_plugin.h"
#include "ags/plugins/ags_waves/vars.h"
namespace AGS3 {
namespace Plugins {
namespace AGSWaves {
class AGSWaves : public PluginBase, public Vars {
SCRIPT_HASH(AGSWaves)
private:
Audio::Mixer *_mixer;
private:
void DrawScreenEffect(ScriptMethodParams ¶ms);
void SFX_Play(ScriptMethodParams ¶ms);
void SFX_SetVolume(ScriptMethodParams ¶ms);
void SFX_GetVolume(ScriptMethodParams ¶ms);
void Music_Play(ScriptMethodParams ¶ms);
void Music_GetVolume(ScriptMethodParams ¶ms);
void Music_SetVolume(ScriptMethodParams ¶ms);
void SFX_Stop(ScriptMethodParams ¶ms);
void SFX_SetPosition(ScriptMethodParams ¶ms);
void SFX_SetGlobalVolume(ScriptMethodParams ¶ms);
void Load_SFX(ScriptMethodParams ¶ms);
void Audio_Apply_Filter(ScriptMethodParams ¶ms);
void Audio_Remove_Filter(ScriptMethodParams ¶ms);
void SFX_AllowOverlap(ScriptMethodParams ¶ms);
void SFX_Filter(ScriptMethodParams ¶ms);
void DrawBlur(ScriptMethodParams ¶ms);
void DrawTunnel(ScriptMethodParams ¶ms);
void DrawCylinder(ScriptMethodParams ¶ms);
void DrawForceField(ScriptMethodParams ¶ms);
void Grayscale(ScriptMethodParams ¶ms);
void ReadWalkBehindIntoSprite(ScriptMethodParams ¶ms);
void AdjustSpriteFont(ScriptMethodParams ¶ms);
void SpriteGradient(ScriptMethodParams ¶ms);
void Outline(ScriptMethodParams ¶ms);
void OutlineOnly(ScriptMethodParams ¶ms);
void SaveVariable(ScriptMethodParams ¶ms);
void ReadVariable(ScriptMethodParams ¶ms);
void GameDoOnceOnly(ScriptMethodParams ¶ms);
void SetGDState(ScriptMethodParams ¶ms);
void GetGDState(ScriptMethodParams ¶ms);
void ResetAllGD(ScriptMethodParams ¶ms);
void SpriteSkew(ScriptMethodParams ¶ms);
void FireUpdate(ScriptMethodParams ¶ms);
void WindUpdate(ScriptMethodParams ¶ms);
void SetWindValues(ScriptMethodParams ¶ms);
void ReturnWidth(ScriptMethodParams ¶ms);
void ReturnHeight(ScriptMethodParams ¶ms);
void ReturnNewHeight(ScriptMethodParams ¶ms);
void ReturnNewWidth(ScriptMethodParams ¶ms);
void Warper(ScriptMethodParams ¶ms);
void SetWarper(ScriptMethodParams ¶ms);
void RainUpdate(ScriptMethodParams ¶ms);
void BlendTwoSprites(ScriptMethodParams ¶ms);
void Blend(ScriptMethodParams ¶ms);
void Dissolve(ScriptMethodParams ¶ms);
void ReverseTransparency(ScriptMethodParams ¶ms);
void NoiseCreator(ScriptMethodParams ¶ms);
void TintProper(ScriptMethodParams ¶ms);
void GetWalkbehindBaserine(ScriptMethodParams ¶ms);
void SetWalkbehindBaserine(ScriptMethodParams ¶ms);
private:
void StartingValues();
void Update();
void CastWave(int delayMax, int PixelsWide, int n);
void DrawEffect(int sprite_a, int sprite_b, int id, int n);
int Random(int threshold);
inline static int getRcolor(int color) {
return ((color >> 16) & 0xFF);
}
inline static int getGcolor(int color) {
return ((color >> 8) & 0xFF);
}
inline static int getBcolor(int color) {
return ((color >> 0) & 0xFF);
}
inline static int getAcolor(int color) {
return ((color >> 24) & 0xFF);
}
static int BlendColor(int Ln, int Bn, int perc) {
return ((Ln < 128) ? (2 * Bn * Ln / perc) : (perc - 2 * (perc - Bn) * (perc - Ln) / perc));
}
static int BlendColorScreen(int Ln, int Bn, int perc) {
return (Bn == perc) ? Bn :
MIN(perc, (Ln * Ln / (perc - Bn)));
}
static int SetColorRGBA(int r, int g, int b, int a);
static int ConvertColorToGrayScale(int color);
static bool IsPixelTransparent(int color);
float noiseField(float tx, float ty, float tz);
int IntersectLines(float x1, float y1, float x2, float y2, float x3, float y3, float x4, float y4);
static inline float fracts(float value) {
return value - floor(value);
}
static inline float lerp(float x, float y, float fn) {
return x * (1.0 - fn) + y * fn;
}
static inline float hasher(float n) {
return fracts(sin(n) * 153.5453123);
}
static float min4(float m1, float m2, float m3, float m4) {
return MIN(MIN(m1, m2), MIN(m3, m4));
}
static float max4(float m1, float m2, float m3, float m4) {
return MAX(MAX(m1, m2), MAX(m3, m4));
}
// Weather
void DrawLineCustom(int x1, int y1, int x2, int y2, int graphic, int setR, int setG, int setB, int setA, int TranDif);
void CreateParticle(int xx, int yy, int ForceX, int ForceY);
void CreateParticle2(int xx, int yy, int ForceX, int ForceY);
void CreateParticleF(int xx, int yy, int ForceX, int ForceY);
void CreateDustParticle(int xx, int yy);
void CreateRainParticleMid(int x, int y, int fx, int fy, int maxpart);
void CreateRainParticleFore(int x, int y, int fx, int fy, int maxpart);
void CreateRainParticleBack(int x, int y, int fx, int fy, int maxpart);
// Sound
/**
* Plays a sound from the sounds.sfx in the Sounds/ folder
* @param soundToPlay The sound to play
* @param repeat Times to repeat, -1 for indefine
*/
void PlaySFX(int SoundToPlay, int repeat);
/**
* Stops a playing sound effect
*/
void StopSFX(int sfxNum);
/**
* Loads a ScummVM OGG stream for playback
*/
Audio::AudioStream *loadOGG(const Common::ArchiveMemberPtr member);
void playStream(Audio::Mixer::SoundType type, Audio::SoundHandle *handle, Audio::AudioStream *stream, int repeat);
void stopAllSounds();
void GlitchFix();
void ApplyFilter(int SetFrequency);
void SetFilterFrequency(int setFrequency);
void MusicPlay(int MusicToPlay, int repeat, int fadeinMS, int fadeoutMS, int pos, bool forceplay, bool fixclick);
public:
AGSWaves();
virtual ~AGSWaves();
const char *AGS_GetPluginName() override;
void AGS_EngineStartup(IAGSEngine *engine) override;
int64 AGS_EngineOnEvent(int event, NumberPtr data) override;
};
} // namespace AGSWaves
} // namespace Plugins
} // namespace AGS3
#endif
|