/* 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 . * */ #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