From 8caed23e8b91864b20dd65f6776db854a863c713 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 18 Jul 2021 14:28:30 -0700 Subject: [PATCH] AGS: Refactoring the plugins for new instance scheme --- engines/ags/module.mk | 5 +- engines/ags/plugins/ags_agi/ags_agi.cpp | 21 +- engines/ags/plugins/ags_agi/ags_agi.h | 13 +- engines/ags/plugins/ags_blend/ags_blend.cpp | 23 +- engines/ags/plugins/ags_blend/ags_blend.h | 49 +- .../plugins/ags_clipboard/ags_clipboard.cpp | 24 +- .../ags/plugins/ags_clipboard/ags_clipboard.h | 15 +- .../plugins/ags_controller/ags_controller.cpp | 41 +- .../plugins/ags_controller/ags_controller.h | 47 +- .../ags/plugins/ags_creditz/ags_creditz.cpp | 15 +- engines/ags/plugins/ags_creditz/ags_creditz.h | 159 +++--- .../ags/plugins/ags_creditz/ags_creditz1.cpp | 54 +- .../ags/plugins/ags_creditz/ags_creditz1.h | 53 +- .../ags/plugins/ags_creditz/ags_creditz2.cpp | 44 +- .../ags/plugins/ags_creditz/ags_creditz2.h | 45 +- engines/ags/plugins/ags_fire/ags_fire.cpp | 27 +- engines/ags/plugins/ags_fire/ags_fire.h | 14 +- .../plugins/ags_flashlight/ags_flashlight.cpp | 141 ++---- .../plugins/ags_flashlight/ags_flashlight.h | 155 +++--- .../ags_galaxy_steam/ags_galaxy_steam.cpp | 138 +++-- .../ags_galaxy_steam/ags_galaxy_steam.h | 35 +- .../ags_galaxy_steam/ags_wadjeteye_steam.cpp | 51 +- .../ags_galaxy_steam/ags_wadjeteye_steam.h | 7 +- engines/ags/plugins/ags_joy/ags_joy.cpp | 41 +- engines/ags/plugins/ags_joy/ags_joy.h | 47 +- .../ags_nickenstien_gfx.cpp | 167 +++--- .../ags_nickenstien_gfx/ags_nickenstien_gfx.h | 169 +++---- .../plugins/ags_pal_render/ags_pal_render.cpp | 475 +++++++++--------- .../plugins/ags_pal_render/ags_pal_render.h | 244 ++++++++- .../ags/plugins/ags_pal_render/pal_render.h | 9 +- .../ags/plugins/ags_pal_render/raycast.cpp | 172 ++++--- engines/ags/plugins/ags_pal_render/raycast.h | 100 ---- .../ags/plugins/ags_parallax/ags_parallax.cpp | 26 +- .../ags/plugins/ags_parallax/ags_parallax.h | 45 +- engines/ags/plugins/ags_shell/ags_shell.cpp | 11 +- engines/ags/plugins/ags_shell/ags_shell.h | 17 +- .../plugins/ags_snow_rain/ags_snow_rain.cpp | 142 +++--- .../ags/plugins/ags_snow_rain/ags_snow_rain.h | 71 ++- engines/ags/plugins/ags_snow_rain/weather.cpp | 9 +- engines/ags/plugins/ags_snow_rain/weather.h | 140 +++--- engines/ags/plugins/ags_sock/ags_sock.cpp | 105 ++-- engines/ags/plugins/ags_sock/ags_sock.h | 16 +- .../ags_sprite_font/ags_sprite_font.cpp | 28 +- .../plugins/ags_sprite_font/ags_sprite_font.h | 30 +- .../ags_sprite_font_clifftop.cpp | 6 +- .../ags_sprite_font_clifftop.h | 10 +- .../ags_sprite_font/sprite_font_renderer.cpp | 1 - .../ags_sprite_font/sprite_font_renderer.h | 39 +- .../ags_sprite_font/variable_width_font.cpp | 12 - .../ags_sprite_font/variable_width_font.h | 22 +- .../variable_width_sprite_font.cpp | 4 - .../variable_width_sprite_font.h | 46 +- .../variable_width_sprite_font_clifftop.h | 16 +- engines/ags/plugins/ags_tcp_ip/ags_tcp_ip.cpp | 7 - engines/ags/plugins/ags_tcp_ip/ags_tcp_ip.h | 13 +- .../ags_wadjet_util/ags_wadjet_util.cpp | 29 +- .../plugins/ags_wadjet_util/ags_wadjet_util.h | 35 +- engines/ags/plugins/ags_waves/ags_waves.cpp | 111 ++-- engines/ags/plugins/ags_waves/ags_waves.h | 14 +- engines/ags/plugins/plugin_base.cpp | 6 +- 60 files changed, 1716 insertions(+), 1895 deletions(-) diff --git a/engines/ags/module.mk b/engines/ags/module.mk index c3fe0374796..65f6f9dcd1a 100644 --- a/engines/ags/module.mk +++ b/engines/ags/module.mk @@ -317,8 +317,7 @@ MODULE_OBJS = \ plugins/core/string.o \ plugins/core/system.o \ plugins/core/textbox.o \ - plugins/core/view_frame.o -/* + plugins/core/view_frame.o \ plugins/ags_agi/ags_agi.o \ plugins/ags_blend/ags_blend.o \ plugins/ags_clipboard/ags_clipboard.o \ @@ -353,7 +352,7 @@ MODULE_OBJS = \ plugins/ags_tcp_ip/ags_tcp_ip.o \ plugins/ags_wadjet_util/ags_wadjet_util.o \ plugins/ags_waves/ags_waves.o -*/ + ifdef ENABLE_AGS_TESTS MODULE_OBJS += \ tests/test_all.o \ diff --git a/engines/ags/plugins/ags_agi/ags_agi.cpp b/engines/ags/plugins/ags_agi/ags_agi.cpp index 9cc225b5cf6..2f3910195eb 100644 --- a/engines/ags/plugins/ags_agi/ags_agi.cpp +++ b/engines/ags/plugins/ags_agi/ags_agi.cpp @@ -26,29 +26,16 @@ namespace AGS3 { namespace Plugins { namespace AGSAgi { -int screen_mode = 0; - -AGSAgi::AGSAgi() : PluginBase() { - _engine = nullptr; - _enabled = 0; - _scaling_mode = 0; - - DLL_METHOD(AGS_GetPluginName); - DLL_METHOD(AGS_EngineStartup); -} - const char *AGSAgi::AGS_GetPluginName() { return "AGS AGI Plugin stub (ags_agi.dll)"; } void AGSAgi::AGS_EngineStartup(IAGSEngine *engine) { - _engine = engine; - _enabled = 0; - _scaling_mode = 0; + PluginBase::AGS_EngineStartup(engine); - SCRIPT_METHOD(SetAGIScalingMode); - SCRIPT_METHOD(GetAGIScalingMode); - SCRIPT_METHOD(UseAGIScaling); + SCRIPT_METHOD(SetAGIScalingMode, AGSAgi::SetAGIScalingMode); + SCRIPT_METHOD(GetAGIScalingMode, AGSAgi::GetAGIScalingMode); + SCRIPT_METHOD(UseAGIScaling, AGSAgi::UseAGIScaling); } void AGSAgi::SetAGIScalingMode(ScriptMethodParams ¶ms) { diff --git a/engines/ags/plugins/ags_agi/ags_agi.h b/engines/ags/plugins/ags_agi/ags_agi.h index 8d7d424e78b..f46eee773eb 100644 --- a/engines/ags/plugins/ags_agi/ags_agi.h +++ b/engines/ags/plugins/ags_agi/ags_agi.h @@ -23,28 +23,29 @@ #ifndef AGS_PLUGINS_AGS_AGI_AGS_AGI_H #define AGS_PLUGINS_AGS_AGI_AGS_AGI_H -#include "ags/plugins/plugin_base.h" +#include "ags/plugins/ags_plugin.h" namespace AGS3 { namespace Plugins { namespace AGSAgi { class AGSAgi : public PluginBase { + SCRIPT_HASH(AGSAgi) private: int _enabled = 0; int _scaling_mode = 0; -private: - const char *AGS_GetPluginName() override; - void AGS_EngineStartup(IAGSEngine *engine) override; - private: void SetAGIScalingMode(ScriptMethodParams ¶ms); void GetAGIScalingMode(ScriptMethodParams ¶ms); void UseAGIScaling(ScriptMethodParams ¶ms); public: - AGSAgi(); + AGSAgi() : PluginBase() {} + virtual ~AGSAgi() {} + + const char *AGS_GetPluginName() override; + void AGS_EngineStartup(IAGSEngine *engine) override; }; } // namespace AGSAgi diff --git a/engines/ags/plugins/ags_blend/ags_blend.cpp b/engines/ags/plugins/ags_blend/ags_blend.cpp index 1b165027b54..9ccd6f5b73d 100644 --- a/engines/ags/plugins/ags_blend/ags_blend.cpp +++ b/engines/ags/plugins/ags_blend/ags_blend.cpp @@ -77,32 +77,25 @@ namespace AGSBlend { #pragma endregion -IAGSEngine *AGSBlend::_engine; - -AGSBlend::AGSBlend() : PluginBase() { - DLL_METHOD(AGS_GetPluginName); - DLL_METHOD(AGS_EngineStartup); -} - const char *AGSBlend::AGS_GetPluginName() { return "AGSBlend"; } void AGSBlend::AGS_EngineStartup(IAGSEngine *engine) { - _engine = engine; + PluginBase::AGS_EngineStartup(engine); // Make sure it's got the version with the features we need if (_engine->version < MIN_ENGINE_VERSION) _engine->AbortGame("Plugin needs engine version " STRINGIFY(MIN_ENGINE_VERSION) " or newer."); // Register functions - SCRIPT_METHOD(GetAlpha); - SCRIPT_METHOD(PutAlpha); - SCRIPT_METHOD(DrawAlpha); - SCRIPT_METHOD(Blur); - SCRIPT_METHOD(HighPass); - SCRIPT_METHOD(DrawAdd); - SCRIPT_METHOD(DrawSprite); + SCRIPT_METHOD(GetAlpha, AGSBlend::GetAlpha); + SCRIPT_METHOD(PutAlpha, AGSBlend::PutAlpha); + SCRIPT_METHOD(DrawAlpha, AGSBlend::DrawAlpha); + SCRIPT_METHOD(Blur, AGSBlend::Blur); + SCRIPT_METHOD(HighPass, AGSBlend::HighPass); + SCRIPT_METHOD(DrawAdd, AGSBlend::DrawAdd); + SCRIPT_METHOD(DrawSprite, AGSBlend::DrawSprite); } //------------------------------------------------------------------------------ diff --git a/engines/ags/plugins/ags_blend/ags_blend.h b/engines/ags/plugins/ags_blend/ags_blend.h index 74d967fcc31..6030ff6a84a 100644 --- a/engines/ags/plugins/ags_blend/ags_blend.h +++ b/engines/ags/plugins/ags_blend/ags_blend.h @@ -23,7 +23,7 @@ #ifndef AGS_PLUGINS_AGS_BLEND_AGS_BLEND_H #define AGS_PLUGINS_AGS_BLEND_AGS_BLEND_H -#include "ags/plugins/plugin_base.h" +#include "ags/plugins/ags_plugin.h" namespace AGS3 { namespace Plugins { @@ -34,36 +34,35 @@ namespace AGSBlend { * Description: An AGS Plugin to allow true Alpha Blending */ class AGSBlend : public PluginBase { + SCRIPT_HASH(AGSBlend) private: -IAGSEngine *_engine; -private: -const char *AGS_GetPluginName(); -void AGS_EngineStartup(IAGSEngine *lpEngine); + /** + * Gets the alpha value at coords x,y + */ + void GetAlpha(ScriptMethodParams ¶ms); -private: -/** - * Gets the alpha value at coords x,y - */ -void GetAlpha(ScriptMethodParams ¶ms); + /** + * Sets the alpha value at coords x,y + */ + void PutAlpha(ScriptMethodParams ¶ms); -/** - * Sets the alpha value at coords x,y - */ -void PutAlpha(ScriptMethodParams ¶ms); + /** + * Translates index from a 2D array to a 1D array + */ + int xytolocale(int x, int y, int width); -/** - * Translates index from a 2D array to a 1D array - */ -int xytolocale(int x, int y, int width); - -void HighPass(ScriptMethodParams ¶ms); -void Blur(ScriptMethodParams ¶ms); -void DrawSprite(ScriptMethodParams ¶ms); -void DrawAdd(ScriptMethodParams ¶ms); -void DrawAlpha(ScriptMethodParams ¶ms); + void HighPass(ScriptMethodParams ¶ms); + void Blur(ScriptMethodParams ¶ms); + void DrawSprite(ScriptMethodParams ¶ms); + void DrawAdd(ScriptMethodParams ¶ms); + void DrawAlpha(ScriptMethodParams ¶ms); public: -AGSBlend(); + AGSBlend() : PluginBase() {} + virtual ~AGSBlend() {} + + const char *AGS_GetPluginName() override; + void AGS_EngineStartup(IAGSEngine *lpEngine) override; }; } // namespace AGSBlend diff --git a/engines/ags/plugins/ags_clipboard/ags_clipboard.cpp b/engines/ags/plugins/ags_clipboard/ags_clipboard.cpp index 8a5231b44fe..ac01d6cbb1f 100644 --- a/engines/ags/plugins/ags_clipboard/ags_clipboard.cpp +++ b/engines/ags/plugins/ags_clipboard/ags_clipboard.cpp @@ -27,36 +27,22 @@ namespace AGS3 { namespace Plugins { namespace AGSClipboard { -IAGSEngine *AGSClipboard::_engine; -Common::String *AGSClipboard::_text; - -AGSClipboard::AGSClipboard() : PluginBase() { - _engine = nullptr; - _text = new Common::String(); - - DLL_METHOD(AGS_GetPluginName); - DLL_METHOD(AGS_EngineStartup); - DLL_METHOD(AGS_EngineShutdown); -} - const char *AGSClipboard::AGS_GetPluginName() { return "AGS Clipboard Plugin v0.4"; } void AGSClipboard::AGS_EngineStartup(IAGSEngine *engine) { - SCRIPT_METHOD_EXT(Clipboard::PasteText, Clipboard_PasteText); - SCRIPT_METHOD_EXT(Clipboard::CopyText^1, Clipboard_CopyText); -} + AGS_EngineStartup(engine); -void AGSClipboard::AGS_EngineShutdown() { - delete _text; + SCRIPT_METHOD(Clipboard::PasteText, AGSClipboard::Clipboard_PasteText); + SCRIPT_METHOD(Clipboard::CopyText^1, AGSClipboard::Clipboard_CopyText); } void AGSClipboard::Clipboard_PasteText(ScriptMethodParams ¶ms) { Common::U32String text = g_system->getTextFromClipboard(); - *_text = Common::String(text); + _text = text; - params._result = _text->c_str(); + params._result = _text.c_str(); } void AGSClipboard::Clipboard_CopyText(ScriptMethodParams ¶ms) { diff --git a/engines/ags/plugins/ags_clipboard/ags_clipboard.h b/engines/ags/plugins/ags_clipboard/ags_clipboard.h index 697f867b9f8..b5d735b4810 100644 --- a/engines/ags/plugins/ags_clipboard/ags_clipboard.h +++ b/engines/ags/plugins/ags_clipboard/ags_clipboard.h @@ -23,25 +23,26 @@ #ifndef AGS_PLUGINS_AGS_CLIPBOARD_H #define AGS_PLUGINS_AGS_CLIPBOARD_H -#include "ags/plugins/plugin_base.h" +#include "ags/plugins/ags_plugin.h" namespace AGS3 { namespace Plugins { namespace AGSClipboard { class AGSClipboard : public PluginBase { + SCRIPT_HASH(AGSClipboard) private: - IAGSEngine *_engine; - Common::String *_text; + Common::String _text; private: - const char *AGS_GetPluginName(); - void AGS_EngineStartup(IAGSEngine *engine) override; - void AGS_EngineShutdown(); void Clipboard_PasteText(ScriptMethodParams ¶ms); void Clipboard_CopyText(ScriptMethodParams ¶ms); public: - AGSClipboard(); + AGSClipboard() : PluginBase() {} + virtual ~AGSClipboard() {} + + const char *AGS_GetPluginName() override; + void AGS_EngineStartup(IAGSEngine *engine) override; }; } // namespace AGSClipboard diff --git a/engines/ags/plugins/ags_controller/ags_controller.cpp b/engines/ags/plugins/ags_controller/ags_controller.cpp index a9cb1492643..3985a0b66c3 100644 --- a/engines/ags/plugins/ags_controller/ags_controller.cpp +++ b/engines/ags/plugins/ags_controller/ags_controller.cpp @@ -29,43 +29,30 @@ namespace AGS3 { namespace Plugins { namespace AGSController { -IAGSEngine *AGSController::_engine; - -AGSController::AGSController() : PluginBase() { - _engine = nullptr; - DLL_METHOD(AGS_GetPluginName); - DLL_METHOD(AGS_EngineStartup); - DLL_METHOD(AGS_EngineShutdown); - DLL_METHOD(AGS_EngineOnEvent); -} - const char *AGSController::AGS_GetPluginName() { return "AGSController"; } void AGSController::AGS_EngineStartup(IAGSEngine *engine) { - _engine = engine; + PluginBase::AGS_EngineStartup(engine); - SCRIPT_METHOD_EXT(ControllerCount, ControllerCount); - SCRIPT_METHOD_EXT(Controller::Open, Controller_Open); - SCRIPT_METHOD_EXT(Controller::Close, Controller_Close); - SCRIPT_METHOD_EXT(Controller::Plugged, Controller_Plugged); - SCRIPT_METHOD_EXT(Controller::GetAxis, Controller_GetAxis); - SCRIPT_METHOD_EXT(Controller::GetPOV, Controller_GetPOV); - SCRIPT_METHOD_EXT(Controller::IsButtonDown, Controller_IsButtonDown); - SCRIPT_METHOD_EXT(Controller::GetName ^ 0, Controller_GetName); - SCRIPT_METHOD_EXT(Controller::Rumble, Controller_Rumble); - SCRIPT_METHOD_EXT(Controller::IsButtonDownOnce, Controller_IsButtonDownOnce); - SCRIPT_METHOD_EXT(Controller::PressAnyKey, Controller_PressAnyKey); - SCRIPT_METHOD_EXT(Controller::BatteryStatus, Controller_BatteryStatus); - SCRIPT_METHOD_EXT(ClickMouse, ClickMouse); + SCRIPT_METHOD(ControllerCount, AGSController::ControllerCount); + SCRIPT_METHOD(Controller::Open, AGSController::Controller_Open); + SCRIPT_METHOD(Controller::Close, AGSController::Controller_Close); + SCRIPT_METHOD(Controller::Plugged, AGSController::Controller_Plugged); + SCRIPT_METHOD(Controller::GetAxis, AGSController::Controller_GetAxis); + SCRIPT_METHOD(Controller::GetPOV, AGSController::Controller_GetPOV); + SCRIPT_METHOD(Controller::IsButtonDown, AGSController::Controller_IsButtonDown); + SCRIPT_METHOD(Controller::GetName ^ 0, AGSController::Controller_GetName); + SCRIPT_METHOD(Controller::Rumble, AGSController::Controller_Rumble); + SCRIPT_METHOD(Controller::IsButtonDownOnce, AGSController::Controller_IsButtonDownOnce); + SCRIPT_METHOD(Controller::PressAnyKey, AGSController::Controller_PressAnyKey); + SCRIPT_METHOD(Controller::BatteryStatus, AGSController::Controller_BatteryStatus); + SCRIPT_METHOD(ClickMouse, AGSController::ClickMouse); _engine->RequestEventHook(AGSE_PREGUIDRAW); } -void AGSController::AGS_EngineShutdown() { -} - int64 AGSController::AGS_EngineOnEvent(int event, NumberPtr data) { if (event == AGSE_PREGUIDRAW) { Controller_Update(); diff --git a/engines/ags/plugins/ags_controller/ags_controller.h b/engines/ags/plugins/ags_controller/ags_controller.h index 986bab0125e..7bc96cf205c 100644 --- a/engines/ags/plugins/ags_controller/ags_controller.h +++ b/engines/ags/plugins/ags_controller/ags_controller.h @@ -23,40 +23,37 @@ #ifndef AGS_PLUGINS_AGSCONTROLLER_AGSCONTROLLER_H #define AGS_PLUGINS_AGSCONTROLLER_AGSCONTROLLER_H -#include "ags/plugins/plugin_base.h" +#include "ags/plugins/ags_plugin.h" namespace AGS3 { namespace Plugins { namespace AGSController { class AGSController : public PluginBase { + SCRIPT_HASH(AGSController) private: -IAGSEngine *_engine; + void Controller_Update(); -private: -const char *AGS_GetPluginName(); -void AGS_EngineStartup(IAGSEngine *engine) override; -void AGS_EngineShutdown(); -int64 AGS_EngineOnEvent(int event, NumberPtr data); - -private: -void Controller_Update(); - -void ControllerCount(ScriptMethodParams ¶ms); -void Controller_Open(ScriptMethodParams ¶ms); -void Controller_Plugged(ScriptMethodParams ¶ms); -void Controller_GetAxis(ScriptMethodParams ¶ms); -void Controller_GetPOV(ScriptMethodParams ¶ms); -void Controller_IsButtonDown(ScriptMethodParams ¶ms); -void Controller_Close(ScriptMethodParams ¶ms); -void Controller_GetName(ScriptMethodParams ¶ms); -void Controller_Rumble(ScriptMethodParams ¶ms); -void Controller_IsButtonDownOnce(ScriptMethodParams ¶ms); -void Controller_PressAnyKey(ScriptMethodParams ¶ms); -void Controller_BatteryStatus(ScriptMethodParams ¶ms); -void ClickMouse(ScriptMethodParams ¶ms); + void ControllerCount(ScriptMethodParams ¶ms); + void Controller_Open(ScriptMethodParams ¶ms); + void Controller_Plugged(ScriptMethodParams ¶ms); + void Controller_GetAxis(ScriptMethodParams ¶ms); + void Controller_GetPOV(ScriptMethodParams ¶ms); + void Controller_IsButtonDown(ScriptMethodParams ¶ms); + void Controller_Close(ScriptMethodParams ¶ms); + void Controller_GetName(ScriptMethodParams ¶ms); + void Controller_Rumble(ScriptMethodParams ¶ms); + void Controller_IsButtonDownOnce(ScriptMethodParams ¶ms); + void Controller_PressAnyKey(ScriptMethodParams ¶ms); + void Controller_BatteryStatus(ScriptMethodParams ¶ms); + void ClickMouse(ScriptMethodParams ¶ms); public: -AGSController(); + AGSController() : PluginBase() {} + virtual ~AGSController() {} + + const char *AGS_GetPluginName() override; + void AGS_EngineStartup(IAGSEngine *engine) override; + int64 AGS_EngineOnEvent(int event, NumberPtr data) override; }; } // namespace AGSController diff --git a/engines/ags/plugins/ags_creditz/ags_creditz.cpp b/engines/ags/plugins/ags_creditz/ags_creditz.cpp index e9a38ae1d63..36bdeab6dde 100644 --- a/engines/ags/plugins/ags_creditz/ags_creditz.cpp +++ b/engines/ags/plugins/ags_creditz/ags_creditz.cpp @@ -27,12 +27,7 @@ namespace AGS3 { namespace Plugins { namespace AGSCreditz { -AGSCreditz::Version AGSCreditz::_version; -State *AGSCreditz::_state; -IAGSEngine *AGSCreditz::_engine; -IntFunction AGSCreditz::_playSound; - -AGSCreditz::AGSCreditz() { +AGSCreditz::AGSCreditz() : PluginBase(), Drawing() { _state = new State(); _engine = nullptr; } @@ -74,7 +69,7 @@ void AGSCreditz::draw() { } else { // credits if (!_state->_singleStatic.bool_) { - if (_state->_current< (int)_state->_stCredits[_state->_creditSequence].size()) { + if (_state->_currentStatic < (int)_state->_stCredits[_state->_creditSequence].size()) { if (_state->_stCredits[_state->_creditSequence][_state->_currentStatic].pause > 0) { // Pause if (_state->_timer <= _state->_stCredits[_state->_creditSequence][_state->_currentStatic].pause) { @@ -93,7 +88,7 @@ void AGSCreditz::draw() { _state->_timer = 0; _state->_currentStatic++; if (_state->_stCredits[_state->_creditSequence][_state->_currentStatic].pause <= 0 && - _state->_current< (int)_state->_stCredits[_state->_creditSequence].size()) + _state->_currentStatic< (int)_state->_stCredits[_state->_creditSequence].size()) drawCredit(_state->_creditSequence, _state->_currentStatic); else return; @@ -109,7 +104,7 @@ void AGSCreditz::draw() { _state->_timer = 0; _state->_currentStatic++; if (_state->_stCredits[_state->_creditSequence][_state->_currentStatic].pause <= 0 && - (int)_state->_current<= (int)_state->_stCredits[_state->_creditSequence].size()) + (int)_state->_currentStatic<= (int)_state->_stCredits[_state->_creditSequence].size()) drawCredit(_state->_creditSequence, _state->_currentStatic); else return; @@ -121,7 +116,7 @@ void AGSCreditz::draw() { _state->_creditsRunning = false; _state->_creditSequence = -1; _state->_timer = 0; - _state->_current= 1; + _state->_currentStatic= 1; return; } } else { diff --git a/engines/ags/plugins/ags_creditz/ags_creditz.h b/engines/ags/plugins/ags_creditz/ags_creditz.h index 60330f6f958..73daf328efc 100644 --- a/engines/ags/plugins/ags_creditz/ags_creditz.h +++ b/engines/ags/plugins/ags_creditz/ags_creditz.h @@ -23,7 +23,7 @@ #ifndef AGS_PLUGINS_AGSCREDITZ_AGSCREDITZ_H #define AGS_PLUGINS_AGSCREDITZ_AGSCREDITZ_H -#include "ags/plugins/plugin_base.h" +#include "ags/plugins/ags_plugin.h" #include "ags/plugins/ags_creditz/drawing.h" #include "common/array.h" #include "common/rect.h" @@ -36,113 +36,112 @@ namespace AGSCreditz { typedef int (*IntFunction)(int val1); struct Credit { -Common::String _text; -int _x = 0; -int _y = 0; -int _fontSlot = 0; -int _colorHeight = 0; -bool _isSet = false; -bool _image = false; -bool _outline = false; + Common::String _text; + int _x = 0; + int _y = 0; + int _fontSlot = 0; + int _colorHeight = 0; + bool _isSet = false; + bool _image = false; + bool _outline = false; }; struct SequenceSettings { -int startpoint = 0; -int endpoint = 0; -int speed = 0; -bool finished = false; -int automatic = 0; -int endwait = 0; -int topmask = 0; -int bottommask = 0; + int startpoint = 0; + int endpoint = 0; + int speed = 0; + bool finished = false; + int automatic = 0; + int endwait = 0; + int topmask = 0; + int bottommask = 0; }; struct StCredit { -Common::String credit; -Common::String title; -int x = 0; -int y = 0; -int font = 0; -int color = 0; -int title_x = 0; -int title_y = 0; -int title_font = 0; -int title_color = 0; -bool title_centered = false; -bool title_outline = false; -int pause = 0; -bool image = false; -int image_slot = 0; -int image_time = 0; -bool outline = false; + Common::String credit; + Common::String title; + int x = 0; + int y = 0; + int font = 0; + int color = 0; + int title_x = 0; + int title_y = 0; + int title_font = 0; + int title_color = 0; + bool title_centered = false; + bool title_outline = false; + int pause = 0; + bool image = false; + int image_slot = 0; + int image_time = 0; + bool outline = false; }; struct StSequenceSettings { -int speed = 0; -bool finished = false; + int speed = 0; + bool finished = false; }; -struct Single{ -int id = 0; -int time = 0; -int style = 0; -int settings1 = 01; -int settings2 = 0; -bool bool_ = false; +struct SingleStatic { + int id = 0; + int time = 0; + int style = 0; + int settings1 = 01; + int settings2 = 0; + bool bool_ = false; }; typedef Common::Array CreditArray; typedef Common::Array StCreditArray; struct State { -CreditArray _credits[10]; -StCreditArray _stCredits[10]; -bool _creditsRunning = 0, _paused = 0, _staticCredits = 0; -int _creditSequence = 0, _yPos = 0, _sequenceHeight = 0, _speedPoint = 0; -int _calculatedSequenceHeight = 0, _timer = 0, _current= 0; -int _numChars = 0, _timer2 = 0; -int _emptyLineHeight = 10; -int _strCredit[10]; -SequenceSettings _seqSettings[10]; -StSequenceSettings _stSeqSettings[10]; -Single_singleStatic; + CreditArray _credits[10]; + StCreditArray _stCredits[10]; + bool _creditsRunning = 0, _paused = 0, _staticCredits = 0; + int _creditSequence = 0, _yPos = 0, _sequenceHeight = 0, _speedPoint = 0; + int _calculatedSequenceHeight = 0, _timer = 0, _currentStatic = 0; + int _numChars = 0, _timer2 = 0; + int _emptyLineHeight = 10; + int _strCredit[10]; + SequenceSettings _seqSettings[10]; + StSequenceSettings _stSeqSettings[10]; + SingleStatic _singleStatic; -// Version 1.1 specific -bool _resolutionFlag = false; -int32 _screenWidth = 0, _screenHeight = 0, _screenColorDepth = 0; -int32 _staticScreenWidth = 0; -bool _staticWidthMatches = false; + // Version 1.1 specific + bool _resolutionFlag = false; + int32 _screenWidth = 0, _screenHeight = 0, _screenColorDepth = 0; + int32 _staticScreenWidth = 0; + bool _staticWidthMatches = false; }; class AGSCreditz : public PluginBase, public Drawing { private: -int drawCredit(int sequence, int credit); -void doCredits(); -int countLines(const Common::String &text); -Common::String extractParameter(Common::String &line, const Common::String &separator); -void specialEffect(int sequence, int credit, const Common::String &text, - int font, int color, int32 x_pos); -void drawStEffects(int sequence, int id, int style); -void speeder(int sequence); + int drawCredit(int sequence, int credit); + void doCredits(); + int countLines(const Common::String &text); + Common::String extractParameter(Common::String &line, const Common::String &separator); + void specialEffect(int sequence, int credit, const Common::String &text, + int font, int color, int32 x_pos); + void drawStEffects(int sequence, int id, int style); + void speeder(int sequence); protected: -enum Version { - VERSION_11 = 11, VERSION_20 = 20 -}; + enum Version { + VERSION_11 = 11, VERSION_20 = 20 + }; -Version _version; -State *_state; -IAGSEngine *_engine; -IntFunction _playSound; + Version _version; + State *_state; + IntFunction _playSound; -void draw(); -void calculateSequenceHeight(int sequence); -int VGACheck(int value); -void startSequence(int sequence); + void draw(); + void calculateSequenceHeight(int sequence); + int VGACheck(int value); + void startSequence(int sequence); public: -AGSCreditz(); -~AGSCreditz(); + AGSCreditz(); + virtual ~AGSCreditz(); }; } // namespace AGSCreditz diff --git a/engines/ags/plugins/ags_creditz/ags_creditz1.cpp b/engines/ags/plugins/ags_creditz/ags_creditz1.cpp index 20970fd1db2..5dc24507cb2 100644 --- a/engines/ags/plugins/ags_creditz/ags_creditz1.cpp +++ b/engines/ags/plugins/ags_creditz/ags_creditz1.cpp @@ -31,10 +31,6 @@ const char *IMAGE_TEXT = "*i*m*a*g*e*"; AGSCreditz1::AGSCreditz1() : AGSCreditz() { _version = VERSION_11; - - DLL_METHOD(AGS_GetPluginName); - DLL_METHOD(AGS_EngineStartup); - DLL_METHOD(AGS_EngineOnEvent); } const char *AGSCreditz1::AGS_GetPluginName() { @@ -42,33 +38,33 @@ const char *AGSCreditz1::AGS_GetPluginName() { } void AGSCreditz1::AGS_EngineStartup(IAGSEngine *engine) { - _engine = engine; + PluginBase::AGS_EngineStartup(engine); engine->RequestEventHook(AGSE_POSTSCREENDRAW); _engine->GetScreenDimensions(&_state->_screenWidth, &_state->_screenHeight, &_state->_screenColorDepth); - SCRIPT_METHOD(SetCredit); - SCRIPT_METHOD(ScrollCredits); - SCRIPT_METHOD(GetCredit); - SCRIPT_METHOD(IsCreditScrollingFinished); - SCRIPT_METHOD_EXT(IsFinished, IsCreditScrollingFinished); - SCRIPT_METHOD(SetCreditImage); - SCRIPT_METHOD(PauseScroll); - SCRIPT_METHOD(ScrollReset); - SCRIPT_METHOD(SetEmptyLineHeight); - SCRIPT_METHOD(GetEmptyLineHeight); - SCRIPT_METHOD(SetStaticCredit); - SCRIPT_METHOD(GetStaticCredit); - SCRIPT_METHOD(StartEndStaticCredits); - SCRIPT_METHOD(GetCurrentStaticCredit); - SCRIPT_METHOD(SetDefaultStaticDelay); - SCRIPT_METHOD(SetStaticPause); - SCRIPT_METHOD(SetStaticCreditTitle); - SCRIPT_METHOD(ShowStaticCredit); - SCRIPT_METHOD(StaticReset); - SCRIPT_METHOD(GetStaticCreditTitle); - SCRIPT_METHOD(SetStaticCreditImage); - SCRIPT_METHOD(IsStaticCreditsFinished); + SCRIPT_METHOD(SetCredit, AGSCreditz1::SetCredit); + SCRIPT_METHOD(ScrollCredits, AGSCreditz1::ScrollCredits); + SCRIPT_METHOD(GetCredit, AGSCreditz1::GetCredit); + SCRIPT_METHOD(IsCreditScrollingFinished, AGSCreditz1::IsCreditScrollingFinished); + SCRIPT_METHOD(IsFinished, AGSCreditz1::IsCreditScrollingFinished); + SCRIPT_METHOD(SetCreditImage, AGSCreditz1::SetCreditImage); + SCRIPT_METHOD(PauseScroll, AGSCreditz1::PauseScroll); + SCRIPT_METHOD(ScrollReset, AGSCreditz1::ScrollReset); + SCRIPT_METHOD(SetEmptyLineHeight, AGSCreditz1::SetEmptyLineHeight); + SCRIPT_METHOD(GetEmptyLineHeight, AGSCreditz1::GetEmptyLineHeight); + SCRIPT_METHOD(SetStaticCredit, AGSCreditz1::SetStaticCredit); + SCRIPT_METHOD(GetStaticCredit, AGSCreditz1::GetStaticCredit); + SCRIPT_METHOD(StartEndStaticCredits, AGSCreditz1::StartEndStaticCredits); + SCRIPT_METHOD(GetCurrentStaticCredit, AGSCreditz1::GetCurrentStaticCredit); + SCRIPT_METHOD(SetDefaultStaticDelay, AGSCreditz1::SetDefaultStaticDelay); + SCRIPT_METHOD(SetStaticPause, AGSCreditz1::SetStaticPause); + SCRIPT_METHOD(SetStaticCreditTitle, AGSCreditz1::SetStaticCreditTitle); + SCRIPT_METHOD(ShowStaticCredit, AGSCreditz1::ShowStaticCredit); + SCRIPT_METHOD(StaticReset, AGSCreditz1::StaticReset); + SCRIPT_METHOD(GetStaticCreditTitle, AGSCreditz1::GetStaticCreditTitle); + SCRIPT_METHOD(SetStaticCreditImage, AGSCreditz1::SetStaticCreditImage); + SCRIPT_METHOD(IsStaticCreditsFinished, AGSCreditz1::IsStaticCreditsFinished); } int64 AGSCreditz1::AGS_EngineOnEvent(int event, NumberPtr data) { @@ -215,7 +211,7 @@ void AGSCreditz1::StartEndStaticCredits(ScriptMethodParams ¶ms) { _engine->AbortGame("StartEndStaticCredits: Wrong resolution"); } else { - _state->_current= 0; + _state->_currentStatic = 0; _engine->GetScreenDimensions(&_state->_screenWidth, &_state->_screenHeight, &_state->_screenColorDepth); @@ -271,7 +267,7 @@ void AGSCreditz1::ShowStaticCredit(ScriptMethodParams ¶ms) { _state->_staticScreenWidth = (res == 1) ? 320 : 640; _state->_staticWidthMatches = _state->_screenWidth == _state->_staticScreenWidth; - _state->_current= ID; + _state->_currentStatic = ID; // TODO: Final setup } diff --git a/engines/ags/plugins/ags_creditz/ags_creditz1.h b/engines/ags/plugins/ags_creditz/ags_creditz1.h index 9cc50b81dfe..00868793143 100644 --- a/engines/ags/plugins/ags_creditz/ags_creditz1.h +++ b/engines/ags/plugins/ags_creditz/ags_creditz1.h @@ -30,35 +30,36 @@ namespace Plugins { namespace AGSCreditz { class AGSCreditz1 : public AGSCreditz { + SCRIPT_HASH(AGSCreditz1) private: -const char *AGS_GetPluginName(); -void AGS_EngineStartup(IAGSEngine *engine) override; -int64 AGS_EngineOnEvent(int event, NumberPtr data); - -void SetCredit(ScriptMethodParams ¶ms); -void ScrollCredits(ScriptMethodParams ¶ms); -void GetCredit(ScriptMethodParams ¶ms); -void IsCreditScrollingFinished(ScriptMethodParams ¶ms); -void SetCreditImage(ScriptMethodParams ¶ms); -void PauseScroll(ScriptMethodParams ¶ms); -void ScrollReset(ScriptMethodParams ¶ms); -void SetEmptyLineHeight(ScriptMethodParams ¶ms); -void GetEmptyLineHeight(ScriptMethodParams ¶ms); -void SetStaticCredit(ScriptMethodParams ¶ms); -void GetStaticCredit(ScriptMethodParams ¶ms); -void StartEndStaticCredits(ScriptMethodParams ¶ms); -void GetCurrentStaticCredit(ScriptMethodParams ¶ms); -void SetDefaultStaticDelay(ScriptMethodParams ¶ms); -void SetStaticPause(ScriptMethodParams ¶ms); -void SetStaticCreditTitle(ScriptMethodParams ¶ms); -void ShowStaticCredit(ScriptMethodParams ¶ms); -void StaticReset(ScriptMethodParams ¶ms); -void GetStaticCreditTitle(ScriptMethodParams ¶ms); -void SetStaticCreditImage(ScriptMethodParams ¶ms); -void IsStaticCreditsFinished(ScriptMethodParams ¶ms); + void SetCredit(ScriptMethodParams ¶ms); + void ScrollCredits(ScriptMethodParams ¶ms); + void GetCredit(ScriptMethodParams ¶ms); + void IsCreditScrollingFinished(ScriptMethodParams ¶ms); + void SetCreditImage(ScriptMethodParams ¶ms); + void PauseScroll(ScriptMethodParams ¶ms); + void ScrollReset(ScriptMethodParams ¶ms); + void SetEmptyLineHeight(ScriptMethodParams ¶ms); + void GetEmptyLineHeight(ScriptMethodParams ¶ms); + void SetStaticCredit(ScriptMethodParams ¶ms); + void GetStaticCredit(ScriptMethodParams ¶ms); + void StartEndStaticCredits(ScriptMethodParams ¶ms); + void GetCurrentStaticCredit(ScriptMethodParams ¶ms); + void SetDefaultStaticDelay(ScriptMethodParams ¶ms); + void SetStaticPause(ScriptMethodParams ¶ms); + void SetStaticCreditTitle(ScriptMethodParams ¶ms); + void ShowStaticCredit(ScriptMethodParams ¶ms); + void StaticReset(ScriptMethodParams ¶ms); + void GetStaticCreditTitle(ScriptMethodParams ¶ms); + void SetStaticCreditImage(ScriptMethodParams ¶ms); + void IsStaticCreditsFinished(ScriptMethodParams ¶ms); public: -AGSCreditz1(); + AGSCreditz1(); + + const char *AGS_GetPluginName() override; + void AGS_EngineStartup(IAGSEngine *engine) override; + int64 AGS_EngineOnEvent(int event, NumberPtr data) override; }; } // namespace AGSCreditz diff --git a/engines/ags/plugins/ags_creditz/ags_creditz2.cpp b/engines/ags/plugins/ags_creditz/ags_creditz2.cpp index bbd88e67d2d..63162ca04a4 100644 --- a/engines/ags/plugins/ags_creditz/ags_creditz2.cpp +++ b/engines/ags/plugins/ags_creditz/ags_creditz2.cpp @@ -28,10 +28,6 @@ namespace AGSCreditz { AGSCreditz2::AGSCreditz2() : AGSCreditz() { _version = VERSION_20; - - DLL_METHOD(AGS_GetPluginName); - DLL_METHOD(AGS_EngineStartup); - DLL_METHOD(AGS_EngineOnEvent); } const char *AGSCreditz2::AGS_GetPluginName() { @@ -39,28 +35,28 @@ const char *AGSCreditz2::AGS_GetPluginName() { } void AGSCreditz2::AGS_EngineStartup(IAGSEngine *engine) { - _engine = engine; + PluginBase::AGS_EngineStartup(engine); _playSound = (IntFunction)_engine->GetScriptFunctionAddress("PlaySound"); engine->RequestEventHook(AGSE_POSTSCREENDRAW); - SCRIPT_METHOD(RunCreditSequence); - SCRIPT_METHOD(SetCredit); - SCRIPT_METHOD(GetCredit); - SCRIPT_METHOD(CreditsSettings); - SCRIPT_METHOD(SequenceSettings); - SCRIPT_METHOD(IsSequenceFinished); - SCRIPT_METHOD(PauseScrolling); - SCRIPT_METHOD(SetCreditImage); - SCRIPT_METHOD(ResetSequence); + SCRIPT_METHOD(RunCreditSequence, AGSCreditz2::RunCreditSequence); + SCRIPT_METHOD(SetCredit, AGSCreditz2::SetCredit); + SCRIPT_METHOD(GetCredit, AGSCreditz2::GetCredit); + SCRIPT_METHOD(CreditsSettings, AGSCreditz2::CreditsSettings); + SCRIPT_METHOD(SequenceSettings, AGSCreditz2::SequenceSettings); + SCRIPT_METHOD(IsSequenceFinished, AGSCreditz2::IsSequenceFinished); + SCRIPT_METHOD(PauseScrolling, AGSCreditz2::PauseScrolling); + SCRIPT_METHOD(SetCreditImage, AGSCreditz2::SetCreditImage); + SCRIPT_METHOD(ResetSequence, AGSCreditz2::ResetSequence); - SCRIPT_METHOD(SetStaticCredit); - SCRIPT_METHOD(SetStaticCreditTitle); - SCRIPT_METHOD(SetStaticPause); - SCRIPT_METHOD(RunStaticCreditSequence); - SCRIPT_METHOD(IsStaticSequenceFinished); - SCRIPT_METHOD(ShowStaticCredit); - SCRIPT_METHOD(SetStaticImage); - SCRIPT_METHOD(GetCurrentStaticCredit); + SCRIPT_METHOD(SetStaticCredit, AGSCreditz2::SetStaticCredit); + SCRIPT_METHOD(SetStaticCreditTitle, AGSCreditz2::SetStaticCreditTitle); + SCRIPT_METHOD(SetStaticPause, AGSCreditz2::SetStaticPause); + SCRIPT_METHOD(RunStaticCreditSequence, AGSCreditz2::RunStaticCreditSequence); + SCRIPT_METHOD(IsStaticSequenceFinished, AGSCreditz2::IsStaticSequenceFinished); + SCRIPT_METHOD(ShowStaticCredit, AGSCreditz2::ShowStaticCredit); + SCRIPT_METHOD(SetStaticImage, AGSCreditz2::SetStaticImage); + SCRIPT_METHOD(GetCurrentStaticCredit, AGSCreditz2::GetCurrentStaticCredit); } int64 AGSCreditz2::AGS_EngineOnEvent(int event, NumberPtr data) { @@ -215,7 +211,7 @@ void AGSCreditz2::RunStaticCreditSequence(ScriptMethodParams ¶ms) { _state->_creditSequence = sequence; _state->_staticCredits = true; _state->_creditsRunning = true; - _state->_current= 1; + _state->_currentStatic = 1; _state->_timer = 0; draw(); @@ -224,7 +220,7 @@ void AGSCreditz2::RunStaticCreditSequence(ScriptMethodParams ¶ms) { _state->_creditSequence = -1; _state->_stSeqSettings[sequence].finished = false; _state->_creditsRunning = false; - _state->_current= 0; + _state->_currentStatic = 0; _state->_timer = 0; } } diff --git a/engines/ags/plugins/ags_creditz/ags_creditz2.h b/engines/ags/plugins/ags_creditz/ags_creditz2.h index a5c4493986a..643a629808b 100644 --- a/engines/ags/plugins/ags_creditz/ags_creditz2.h +++ b/engines/ags/plugins/ags_creditz/ags_creditz2.h @@ -30,32 +30,33 @@ namespace Plugins { namespace AGSCreditz { class AGSCreditz2 : public AGSCreditz { + SCRIPT_HASH(AGSCreditz2) private: -const char *AGS_GetPluginName(); -void AGS_EngineStartup(IAGSEngine *engine) override; -int64 AGS_EngineOnEvent(int event, NumberPtr data); + void RunCreditSequence(ScriptMethodParams ¶ms); + void SetCredit(ScriptMethodParams ¶ms); + void GetCredit(ScriptMethodParams ¶ms); + void CreditsSettings(ScriptMethodParams ¶ms); + void SequenceSettings(ScriptMethodParams ¶ms); + void IsSequenceFinished(ScriptMethodParams ¶ms); + void PauseScrolling(ScriptMethodParams ¶ms); + void SetCreditImage(ScriptMethodParams ¶ms); + void ResetSequence(ScriptMethodParams ¶ms); -void RunCreditSequence(ScriptMethodParams ¶ms); -void SetCredit(ScriptMethodParams ¶ms); -void GetCredit(ScriptMethodParams ¶ms); -void CreditsSettings(ScriptMethodParams ¶ms); -void SequenceSettings(ScriptMethodParams ¶ms); -void IsSequenceFinished(ScriptMethodParams ¶ms); -void PauseScrolling(ScriptMethodParams ¶ms); -void SetCreditImage(ScriptMethodParams ¶ms); -void ResetSequence(ScriptMethodParams ¶ms); - -void SetStaticCredit(ScriptMethodParams ¶ms); -void SetStaticCreditTitle(ScriptMethodParams ¶ms); -void SetStaticPause(ScriptMethodParams ¶ms); -void RunStaticCreditSequence(ScriptMethodParams ¶ms); -void IsStaticSequenceFinished(ScriptMethodParams ¶ms); -void ShowStaticCredit(ScriptMethodParams ¶ms); -void SetStaticImage(ScriptMethodParams ¶ms); -void GetCurrentStaticCredit(ScriptMethodParams ¶ms); + void SetStaticCredit(ScriptMethodParams ¶ms); + void SetStaticCreditTitle(ScriptMethodParams ¶ms); + void SetStaticPause(ScriptMethodParams ¶ms); + void RunStaticCreditSequence(ScriptMethodParams ¶ms); + void IsStaticSequenceFinished(ScriptMethodParams ¶ms); + void ShowStaticCredit(ScriptMethodParams ¶ms); + void SetStaticImage(ScriptMethodParams ¶ms); + void GetCurrentStaticCredit(ScriptMethodParams ¶ms); public: -AGSCreditz2(); + AGSCreditz2(); + + const char *AGS_GetPluginName() override; + void AGS_EngineStartup(IAGSEngine *engine) override; + int64 AGS_EngineOnEvent(int event, NumberPtr data) override; }; } // namespace AGSCreditz diff --git a/engines/ags/plugins/ags_fire/ags_fire.cpp b/engines/ags/plugins/ags_fire/ags_fire.cpp index 42bf0baf464..bb042a2ce39 100644 --- a/engines/ags/plugins/ags_fire/ags_fire.cpp +++ b/engines/ags/plugins/ags_fire/ags_fire.cpp @@ -26,30 +26,21 @@ namespace AGS3 { namespace Plugins { namespace AGSFire { -IAGSEngine *AGSFire::_engine; - -AGSFire::AGSFire() : PluginBase() { - _engine = nullptr; - - DLL_METHOD(AGS_GetPluginName); - DLL_METHOD(AGS_EngineStartup); -} - const char *AGSFire::AGS_GetPluginName() { return "Fire Plugin stub (ags_fire.dll)"; } void AGSFire::AGS_EngineStartup(IAGSEngine *engine) { - _engine = engine; + PluginBase::AGS_EngineStartup(engine); - SCRIPT_METHOD(FireAddObject); - SCRIPT_METHOD(FirePreHeat); - SCRIPT_METHOD(FireDisableSeeding); - SCRIPT_METHOD(FireEnableSeeding); - SCRIPT_METHOD(FireSetStrength); - SCRIPT_METHOD(FireRemoveObject); - SCRIPT_METHOD(FireUpdate); - SCRIPT_METHOD(FireStop); + SCRIPT_METHOD(FireAddObject, AGSFire::FireAddObject); + SCRIPT_METHOD(FirePreHeat, AGSFire::FirePreHeat); + SCRIPT_METHOD(FireDisableSeeding, AGSFire::FireDisableSeeding); + SCRIPT_METHOD(FireEnableSeeding, AGSFire::FireEnableSeeding); + SCRIPT_METHOD(FireSetStrength, AGSFire::FireSetStrength); + SCRIPT_METHOD(FireRemoveObject, AGSFire::FireRemoveObject); + SCRIPT_METHOD(FireUpdate, AGSFire::FireUpdate); + SCRIPT_METHOD(FireStop, AGSFire::FireStop); } void AGSFire::FireAddObject(ScriptMethodParams ¶ms) { diff --git a/engines/ags/plugins/ags_fire/ags_fire.h b/engines/ags/plugins/ags_fire/ags_fire.h index c19ce42b7b3..31a892b6627 100644 --- a/engines/ags/plugins/ags_fire/ags_fire.h +++ b/engines/ags/plugins/ags_fire/ags_fire.h @@ -23,18 +23,14 @@ #ifndef AGS_PLUGINS_AGS_FIRE_AGS_FIRE_H #define AGS_PLUGINS_AGS_FIRE_AGS_FIRE_H -#include "ags/plugins/plugin_base.h" +#include "ags/plugins/ags_plugin.h" namespace AGS3 { namespace Plugins { namespace AGSFire { class AGSFire : public PluginBase { -private: - IAGSEngine *_engine; - const char *AGS_GetPluginName(); - void AGS_EngineStartup(IAGSEngine *engine) override; - + SCRIPT_HASH(AGSFire) private: void FireAddObject(ScriptMethodParams ¶ms); void FirePreHeat(ScriptMethodParams ¶ms); @@ -46,7 +42,11 @@ private: void FireStop(ScriptMethodParams ¶ms); public: - AGSFire(); + AGSFire() : PluginBase() {} + virtual ~AGSFire() {} + + const char *AGS_GetPluginName() override; + void AGS_EngineStartup(IAGSEngine *engine) override; }; } // namespace AGSFire diff --git a/engines/ags/plugins/ags_flashlight/ags_flashlight.cpp b/engines/ags/plugins/ags_flashlight/ags_flashlight.cpp index 39189d44464..89ac4da79b3 100644 --- a/engines/ags/plugins/ags_flashlight/ags_flashlight.cpp +++ b/engines/ags/plugins/ags_flashlight/ags_flashlight.cpp @@ -33,133 +33,51 @@ const uint32 Magic = 0xBABE0000; const uint32 Version = 2; const uint32 SaveMagic = Magic + Version; -int32 AGSFlashlight::AGSFlashlight::screen_width = 320; -int32 AGSFlashlight::screen_height = 200; -int32 AGSFlashlight::screen_color_depth = 16; - -bool AGSFlashlight::g_BitmapMustBeUpdated = true; - -int AGSFlashlight::g_RedTint = 0; -int AGSFlashlight::g_GreenTint = 0; -int AGSFlashlight::g_BlueTint = 0; - -int AGSFlashlight::g_DarknessLightLevel = 100; -int AGSFlashlight::g_BrightnessLightLevel = 100; -int AGSFlashlight::g_DarknessSize = 0; -int AGSFlashlight::g_DarknessDiameter = 0; -int AGSFlashlight::g_BrightnessSize = 0; - -int32 AGSFlashlight::g_FlashlightX = 0; -int32 AGSFlashlight::g_FlashlightY = 0; -int32 AGSFlashlight::g_FlashlightDrawAtX = 0; -int32 AGSFlashlight::g_FlashlightDrawAtY = 0; - -bool AGSFlashlight::g_FlashlightFollowMouse = false; - -int AGSFlashlight::g_FollowCharacterId = 0; -int AGSFlashlight::g_FollowCharacterDx = 0; -int AGSFlashlight::g_FollowCharacterDy = 0; -int AGSFlashlight::g_FollowCharacterHorz = 0; -int AGSFlashlight::g_FollowCharacterVert = 0; - -AGSCharacter *AGSFlashlight::g_FollowCharacter = nullptr; - -BITMAP *AGSFlashlight::g_LightBitmap = nullptr; - -uint32 AGSFlashlight::flashlight_x; -uint32 AGSFlashlight::flashlight_n; - - -IAGSEngine *AGSFlashlight::_engine; - -AGSFlashlight::AGSFlashlight() : PluginBase() { - _engine = nullptr; - screen_width = 320; - screen_height = 200; - screen_color_depth = 16; - - g_BitmapMustBeUpdated = true; - - g_RedTint = 0; - g_GreenTint = 0; - g_BlueTint = 0; - - g_DarknessLightLevel = 100; - g_BrightnessLightLevel = 100; - g_DarknessSize = 0; - g_DarknessDiameter = 0; - g_BrightnessSize = 0; - - g_FlashlightX = 0; - g_FlashlightY = 0; - g_FlashlightDrawAtX = 0; - g_FlashlightDrawAtY = 0; - - g_FlashlightFollowMouse = false; - - g_FollowCharacterId = 0; - g_FollowCharacterDx = 0; - g_FollowCharacterDy = 0; - g_FollowCharacterHorz = 0; - g_FollowCharacterVert = 0; - - g_FollowCharacter = nullptr; - g_LightBitmap = nullptr; - flashlight_x = 0; - flashlight_n = 0; - - - DLL_METHOD(AGS_GetPluginName); - DLL_METHOD(AGS_EngineStartup); - DLL_METHOD(AGS_EngineShutdown); - DLL_METHOD(AGS_EngineOnEvent); -} - const char *AGSFlashlight::AGS_GetPluginName() { return "Flashlight plugin recreation"; } void AGSFlashlight::AGS_EngineStartup(IAGSEngine *engine) { - _engine = engine; + PluginBase::AGS_EngineStartup(engine); if (_engine->version < 13) _engine->AbortGame("Engine interface is too old, need newer version of AGS."); - SCRIPT_METHOD(SetFlashlightTint); - SCRIPT_METHOD(GetFlashlightTintRed); - SCRIPT_METHOD(GetFlashlightTintGreen); - SCRIPT_METHOD(GetFlashlightTintBlue); + SCRIPT_METHOD(SetFlashlightTint, AGSFlashlight::SetFlashlightTint); + SCRIPT_METHOD(GetFlashlightTintRed, AGSFlashlight::GetFlashlightTintRed); + SCRIPT_METHOD(GetFlashlightTintGreen, AGSFlashlight::GetFlashlightTintGreen); + SCRIPT_METHOD(GetFlashlightTintBlue, AGSFlashlight::GetFlashlightTintBlue); - SCRIPT_METHOD(GetFlashlightMinLightLevel); - SCRIPT_METHOD(GetFlashlightMaxLightLevel); + SCRIPT_METHOD(GetFlashlightMinLightLevel, AGSFlashlight::GetFlashlightMinLightLevel); + SCRIPT_METHOD(GetFlashlightMaxLightLevel, AGSFlashlight::GetFlashlightMaxLightLevel); - SCRIPT_METHOD(SetFlashlightDarkness); - SCRIPT_METHOD(GetFlashlightDarkness); - SCRIPT_METHOD(SetFlashlightDarknessSize); - SCRIPT_METHOD(GetFlashlightDarknessSize); + SCRIPT_METHOD(SetFlashlightDarkness, AGSFlashlight::SetFlashlightDarkness); + SCRIPT_METHOD(GetFlashlightDarkness, AGSFlashlight::GetFlashlightDarkness); + SCRIPT_METHOD(SetFlashlightDarknessSize, AGSFlashlight::SetFlashlightDarknessSize); + SCRIPT_METHOD(GetFlashlightDarknessSize, AGSFlashlight::GetFlashlightDarknessSize); - SCRIPT_METHOD(SetFlashlightBrightness); - SCRIPT_METHOD(GetFlashlightBrightness); - SCRIPT_METHOD(SetFlashlightBrightnessSize); - SCRIPT_METHOD(GetFlashlightBrightnessSize); + SCRIPT_METHOD(SetFlashlightBrightness, AGSFlashlight::SetFlashlightBrightness); + SCRIPT_METHOD(GetFlashlightBrightness, AGSFlashlight::GetFlashlightBrightness); + SCRIPT_METHOD(SetFlashlightBrightnessSize, AGSFlashlight::SetFlashlightBrightnessSize); + SCRIPT_METHOD(GetFlashlightBrightnessSize, AGSFlashlight::GetFlashlightBrightnessSize); - SCRIPT_METHOD(SetFlashlightPosition); - SCRIPT_METHOD(GetFlashlightPositionX); - SCRIPT_METHOD(GetFlashlightPositionY); + SCRIPT_METHOD(SetFlashlightPosition, AGSFlashlight::SetFlashlightPosition); + SCRIPT_METHOD(GetFlashlightPositionX, AGSFlashlight::GetFlashlightPositionX); + SCRIPT_METHOD(GetFlashlightPositionY, AGSFlashlight::GetFlashlightPositionY); - SCRIPT_METHOD(SetFlashlightFollowMouse); - SCRIPT_METHOD(GetFlashlightFollowMouse); + SCRIPT_METHOD(SetFlashlightFollowMouse, AGSFlashlight::SetFlashlightFollowMouse); + SCRIPT_METHOD(GetFlashlightFollowMouse, AGSFlashlight::GetFlashlightFollowMouse); - SCRIPT_METHOD(SetFlashlightFollowCharacter); - SCRIPT_METHOD(GetFlashlightFollowCharacter); - SCRIPT_METHOD(GetFlashlightCharacterDX); - SCRIPT_METHOD(GetFlashlightCharacterDY); - SCRIPT_METHOD(GetFlashlightCharacterHorz); - SCRIPT_METHOD(GetFlashlightCharacterVert); + SCRIPT_METHOD(SetFlashlightFollowCharacter, AGSFlashlight::SetFlashlightFollowCharacter); + SCRIPT_METHOD(GetFlashlightFollowCharacter, AGSFlashlight::GetFlashlightFollowCharacter); + SCRIPT_METHOD(GetFlashlightCharacterDX, AGSFlashlight::GetFlashlightCharacterDX); + SCRIPT_METHOD(GetFlashlightCharacterDY, AGSFlashlight::GetFlashlightCharacterDY); + SCRIPT_METHOD(GetFlashlightCharacterHorz, AGSFlashlight::GetFlashlightCharacterHorz); + SCRIPT_METHOD(GetFlashlightCharacterVert, AGSFlashlight::GetFlashlightCharacterVert); - SCRIPT_METHOD(SetFlashlightMask); - SCRIPT_METHOD(GetFlashlightMask); + SCRIPT_METHOD(SetFlashlightMask, AGSFlashlight::SetFlashlightMask); + SCRIPT_METHOD(GetFlashlightMask, AGSFlashlight::GetFlashlightMask); _engine->RequestEventHook(AGSE_PREGUIDRAW); _engine->RequestEventHook(AGSE_PRESCREENDRAW); @@ -167,9 +85,6 @@ void AGSFlashlight::AGS_EngineStartup(IAGSEngine *engine) { _engine->RequestEventHook(AGSE_RESTOREGAME); } -void AGSFlashlight::AGS_EngineShutdown() { -} - int64 AGSFlashlight::AGS_EngineOnEvent(int event, NumberPtr data) { if (event == AGSE_PREGUIDRAW) { Update(); diff --git a/engines/ags/plugins/ags_flashlight/ags_flashlight.h b/engines/ags/plugins/ags_flashlight/ags_flashlight.h index 0dc4fb97386..a63ad61a871 100644 --- a/engines/ags/plugins/ags_flashlight/ags_flashlight.h +++ b/engines/ags/plugins/ags_flashlight/ags_flashlight.h @@ -23,7 +23,7 @@ #ifndef AGS_PLUGINS_AGSFLASHLIGHT_AGSFLASHLIGHT_H #define AGS_PLUGINS_AGSFLASHLIGHT_AGSFLASHLIGHT_H -#include "ags/plugins/plugin_base.h" +#include "ags/plugins/ags_plugin.h" #include "ags/plugins/serializer.h" #include "ags/lib/allegro.h" @@ -36,88 +36,87 @@ namespace AGSFlashlight { * but a workalike plugin originally created for the AGS engine PSP port. */ class AGSFlashlight : public PluginBase { + SCRIPT_HASH(AGSFlashlight) private: -IAGSEngine *_engine; -int32 screen_width; -int32 screen_height; -int32 screen_color_depth; -bool g_BitmapMustBeUpdated; -int g_RedTint; -int g_GreenTint; -int g_BlueTint; -int g_DarknessLightLevel; -int g_BrightnessLightLevel; -int g_DarknessSize; -int g_DarknessDiameter; -int g_BrightnessSize; -int32 g_FlashlightX; -int32 g_FlashlightY; -int32 g_FlashlightDrawAtX; -int32 g_FlashlightDrawAtY; -bool g_FlashlightFollowMouse; -int g_FollowCharacterId; -int g_FollowCharacterDx; -int g_FollowCharacterDy; -int g_FollowCharacterHorz; -int g_FollowCharacterVert; -AGSCharacter *g_FollowCharacter; -BITMAP *g_LightBitmap; -uint32 flashlight_x, flashlight_n; + int32 screen_width = 320; + int32 screen_height = 200; + int32 screen_color_depth = 16; + bool g_BitmapMustBeUpdated = true; + int g_RedTint = 0; + int g_GreenTint = 0; + int g_BlueTint = 0; + int g_DarknessLightLevel = 100; + int g_BrightnessLightLevel = 100; + int g_DarknessSize = 0; + int g_DarknessDiameter = 0; + int g_BrightnessSize = 0; + int32 g_FlashlightX = 0; + int32 g_FlashlightY = 0; + int32 g_FlashlightDrawAtX = 0; + int32 g_FlashlightDrawAtY = 0; + bool g_FlashlightFollowMouse = false; + int g_FollowCharacterId = 0; + int g_FollowCharacterDx = 0; + int g_FollowCharacterDy = 0; + int g_FollowCharacterHorz = 0; + int g_FollowCharacterVert = 0; + AGSCharacter *g_FollowCharacter = nullptr; + BITMAP *g_LightBitmap = nullptr; + uint32 flashlight_x = 0, flashlight_n = 0; private: -const char *AGS_GetPluginName(); -void AGS_EngineStartup(IAGSEngine *engine) override; -void AGS_EngineShutdown(); -int64 AGS_EngineOnEvent(int event, NumberPtr data); + /** + * This function is from Allegro, split for more performance. + * Combines a 32 bit RGBA sprite with a 16 bit RGB destination, optimised + * for when one pixel is in an RGB layout and the other is BGR. + */ + inline uint32 _blender_alpha16_bgr(uint32 y); + inline void calc_x_n(uint32 x); + inline void setPixel(int x, int y, uint32 color, uint32 *pixel); + void plotCircle(int xm, int ym, int r, uint32 color); + void ClipToRange(int &variable, int min, int max); + void AlphaBlendBitmap(); + void DrawTint(); + void DrawDarkness(); + void CreateLightBitmap(); + void Update(); + uint32 blendPixel(uint32 col, bool isAlpha24, int light); + void syncGame(Serializer &s); -private: -/** - * This function is from Allegro, split for more performance. - * Combines a 32 bit RGBA sprite with a 16 bit RGB destination, optimised - * for when one pixel is in an RGB layout and the other is BGR. - */ -inline uint32 _blender_alpha16_bgr(uint32 y); -inline void calc_x_n(uint32 x); -inline void setPixel(int x, int y, uint32 color, uint32 *pixel); -void plotCircle(int xm, int ym, int r, uint32 color); -void ClipToRange(int &variable, int min, int max); -void AlphaBlendBitmap(); -void DrawTint(); -void DrawDarkness(); -void CreateLightBitmap(); -void Update(); -uint32 blendPixel(uint32 col, bool isAlpha24, int light); -void syncGame(Serializer &s); - -void SetFlashlightTint(ScriptMethodParams ¶ms); -void GetFlashlightTintRed(ScriptMethodParams ¶ms); -void GetFlashlightTintGreen(ScriptMethodParams ¶ms); -void GetFlashlightTintBlue(ScriptMethodParams ¶ms); -void GetFlashlightMinLightLevel(ScriptMethodParams ¶ms); -void GetFlashlightMaxLightLevel(ScriptMethodParams ¶ms); -void SetFlashlightDarkness(ScriptMethodParams ¶ms); -void GetFlashlightDarkness(ScriptMethodParams ¶ms); -void SetFlashlightDarknessSize(ScriptMethodParams ¶ms); -void GetFlashlightDarknessSize(ScriptMethodParams ¶ms); -void SetFlashlightBrightness(ScriptMethodParams ¶ms); -void GetFlashlightBrightness(ScriptMethodParams ¶ms); -void SetFlashlightBrightnessSize(ScriptMethodParams ¶ms); -void GetFlashlightBrightnessSize(ScriptMethodParams ¶ms); -void SetFlashlightPosition(ScriptMethodParams ¶ms); -void GetFlashlightPositionX(ScriptMethodParams ¶ms); -void GetFlashlightPositionY(ScriptMethodParams ¶ms); -void SetFlashlightFollowMouse(ScriptMethodParams ¶ms); -void GetFlashlightFollowMouse(ScriptMethodParams ¶ms); -void SetFlashlightFollowCharacter(ScriptMethodParams ¶ms); -void GetFlashlightFollowCharacter(ScriptMethodParams ¶ms); -void GetFlashlightCharacterDX(ScriptMethodParams ¶ms); -void GetFlashlightCharacterDY(ScriptMethodParams ¶ms); -void GetFlashlightCharacterHorz(ScriptMethodParams ¶ms); -void GetFlashlightCharacterVert(ScriptMethodParams ¶ms); -void SetFlashlightMask(ScriptMethodParams ¶ms); -void GetFlashlightMask(ScriptMethodParams ¶ms); + void SetFlashlightTint(ScriptMethodParams ¶ms); + void GetFlashlightTintRed(ScriptMethodParams ¶ms); + void GetFlashlightTintGreen(ScriptMethodParams ¶ms); + void GetFlashlightTintBlue(ScriptMethodParams ¶ms); + void GetFlashlightMinLightLevel(ScriptMethodParams ¶ms); + void GetFlashlightMaxLightLevel(ScriptMethodParams ¶ms); + void SetFlashlightDarkness(ScriptMethodParams ¶ms); + void GetFlashlightDarkness(ScriptMethodParams ¶ms); + void SetFlashlightDarknessSize(ScriptMethodParams ¶ms); + void GetFlashlightDarknessSize(ScriptMethodParams ¶ms); + void SetFlashlightBrightness(ScriptMethodParams ¶ms); + void GetFlashlightBrightness(ScriptMethodParams ¶ms); + void SetFlashlightBrightnessSize(ScriptMethodParams ¶ms); + void GetFlashlightBrightnessSize(ScriptMethodParams ¶ms); + void SetFlashlightPosition(ScriptMethodParams ¶ms); + void GetFlashlightPositionX(ScriptMethodParams ¶ms); + void GetFlashlightPositionY(ScriptMethodParams ¶ms); + void SetFlashlightFollowMouse(ScriptMethodParams ¶ms); + void GetFlashlightFollowMouse(ScriptMethodParams ¶ms); + void SetFlashlightFollowCharacter(ScriptMethodParams ¶ms); + void GetFlashlightFollowCharacter(ScriptMethodParams ¶ms); + void GetFlashlightCharacterDX(ScriptMethodParams ¶ms); + void GetFlashlightCharacterDY(ScriptMethodParams ¶ms); + void GetFlashlightCharacterHorz(ScriptMethodParams ¶ms); + void GetFlashlightCharacterVert(ScriptMethodParams ¶ms); + void SetFlashlightMask(ScriptMethodParams ¶ms); + void GetFlashlightMask(ScriptMethodParams ¶ms); public: -AGSFlashlight(); + AGSFlashlight() : PluginBase() {} + virtual ~AGSFlashlight() {} + + const char *AGS_GetPluginName() override; + void AGS_EngineStartup(IAGSEngine *engine) override; + int64 AGS_EngineOnEvent(int event, NumberPtr data) override; }; } // namespace AGSFlashlight diff --git a/engines/ags/plugins/ags_galaxy_steam/ags_galaxy_steam.cpp b/engines/ags/plugins/ags_galaxy_steam/ags_galaxy_steam.cpp index 84afb137559..9e877a118e0 100644 --- a/engines/ags/plugins/ags_galaxy_steam/ags_galaxy_steam.cpp +++ b/engines/ags/plugins/ags_galaxy_steam/ags_galaxy_steam.cpp @@ -29,32 +29,30 @@ namespace AGS3 { namespace Plugins { namespace AGSGalaxySteam { -AGS2Client::AGS2Client() : PluginBase() { - DLL_METHOD(AGS_EngineStartup); -} - void AGS2Client::AGS_EngineStartup(IAGSEngine *engine) { - SCRIPT_METHOD_EXT(AGS2Client::IsAchievementAchieved^1, IsAchievementAchieved); - SCRIPT_METHOD_EXT(AGS2Client::SetAchievementAchieved^1, SetAchievementAchieved); - SCRIPT_METHOD_EXT(AGS2Client::ResetAchievement^1, ResetAchievement); - SCRIPT_METHOD_EXT(AGS2Client::GetIntStat^1, GetIntStat); - SCRIPT_METHOD_EXT(AGS2Client::GetFloatStat^1, GetFloatStat); - SCRIPT_METHOD_EXT(AGS2Client::GetAverageRateStat^1, GetAverageRateStat); - SCRIPT_METHOD_EXT(AGS2Client::SetIntStat^2, SetIntStat); - SCRIPT_METHOD_EXT(AGS2Client::SetFloatStat^2, SetFloatStat); - SCRIPT_METHOD_EXT(AGS2Client::UpdateAverageRateStat^3, UpdateAverageRateStat); - SCRIPT_METHOD_EXT(AGS2Client::ResetStatsAndAchievements^0, ResetStatsAndAchievements); - SCRIPT_METHOD_EXT(AGS2Client::get_Initialized, get_Initialized); - SCRIPT_METHOD_EXT(AGS2Client::get_CurrentLeaderboardName, get_CurrentLeaderboardName); - SCRIPT_METHOD_EXT(AGS2Client::RequestLeaderboard^3, RequestLeaderboard); - SCRIPT_METHOD_EXT(AGS2Client::UploadScore^1, UploadScore); - SCRIPT_METHOD_EXT(AGS2Client::geti_LeaderboardNames, geti_LeaderboardNames); - SCRIPT_METHOD_EXT(AGS2Client::geti_LeaderboardScores, geti_LeaderboardScores); - SCRIPT_METHOD_EXT(AGS2Client::get_LeaderboardCount, get_LeaderboardCount); - SCRIPT_METHOD_EXT(AGS2Client::GetUserName^0, GetUserName); - SCRIPT_METHOD_EXT(AGS2Client::GetCurrentGameLanguage^0, GetCurrentGameLanguage); - SCRIPT_METHOD_EXT(AGS2Client::FindLeaderboard^1, FindLeaderboard); - SCRIPT_METHOD_EXT(AGS2Client::Initialize^2, Initialize); + PluginBase::AGS_EngineStartup(engine); + + SCRIPT_METHOD(AGS2Client::IsAchievementAchieved^1, AGS2Client::IsAchievementAchieved); + SCRIPT_METHOD(AGS2Client::SetAchievementAchieved^1, AGS2Client::SetAchievementAchieved); + SCRIPT_METHOD(AGS2Client::ResetAchievement^1, AGS2Client::ResetAchievement); + SCRIPT_METHOD(AGS2Client::GetIntStat^1, AGS2Client::GetIntStat); + SCRIPT_METHOD(AGS2Client::GetFloatStat^1, AGS2Client::GetFloatStat); + SCRIPT_METHOD(AGS2Client::GetAverageRateStat^1, AGS2Client::GetAverageRateStat); + SCRIPT_METHOD(AGS2Client::SetIntStat^2, AGS2Client::SetIntStat); + SCRIPT_METHOD(AGS2Client::SetFloatStat^2, AGS2Client::SetFloatStat); + SCRIPT_METHOD(AGS2Client::UpdateAverageRateStat^3, AGS2Client::UpdateAverageRateStat); + SCRIPT_METHOD(AGS2Client::ResetStatsAndAchievements^0, AGS2Client::ResetStatsAndAchievements); + SCRIPT_METHOD(AGS2Client::get_Initialized, AGS2Client::get_Initialized); + SCRIPT_METHOD(AGS2Client::get_CurrentLeaderboardName, AGS2Client::get_CurrentLeaderboardName); + SCRIPT_METHOD(AGS2Client::RequestLeaderboard^3, AGS2Client::RequestLeaderboard); + SCRIPT_METHOD(AGS2Client::UploadScore^1, AGS2Client::UploadScore); + SCRIPT_METHOD(AGS2Client::geti_LeaderboardNames, AGS2Client::geti_LeaderboardNames); + SCRIPT_METHOD(AGS2Client::geti_LeaderboardScores, AGS2Client::geti_LeaderboardScores); + SCRIPT_METHOD(AGS2Client::get_LeaderboardCount, AGS2Client::get_LeaderboardCount); + SCRIPT_METHOD(AGS2Client::GetUserName^0, AGS2Client::GetUserName); + SCRIPT_METHOD(AGS2Client::GetCurrentGameLanguage^0, AGS2Client::GetCurrentGameLanguage); + SCRIPT_METHOD(AGS2Client::FindLeaderboard^1, AGS2Client::FindLeaderboard); + SCRIPT_METHOD(AGS2Client::Initialize^2, AGS2Client::Initialize); Common::String gameTarget = ConfMan.getActiveDomainName(); const MetaEngine *meta = ::AGS::g_vm->getMetaEngine(); @@ -178,11 +176,6 @@ void AGS2Client::Initialize(ScriptMethodParams ¶ms) { /*------------------------------------------------------------------*/ -AGSGalaxy::AGSGalaxy() : AGS2Client() { - DLL_METHOD(AGS_GetPluginName); - DLL_METHOD(AGS_EngineStartup); -} - const char *AGSGalaxy::AGS_GetPluginName() { return "AGSGalaxy"; } @@ -190,35 +183,30 @@ const char *AGSGalaxy::AGS_GetPluginName() { void AGSGalaxy::AGS_EngineStartup(IAGSEngine *engine) { AGS2Client::AGS_EngineStartup(engine); - SCRIPT_METHOD_EXT(AGSGalaxy::IsAchievementAchieved^1, IsAchievementAchieved); - SCRIPT_METHOD_EXT(AGSGalaxy::SetAchievementAchieved^1, SetAchievementAchieved); - SCRIPT_METHOD_EXT(AGSGalaxy::ResetAchievement^1, ResetAchievement); - SCRIPT_METHOD_EXT(AGSGalaxy::GetIntStat^1, GetIntStat); - SCRIPT_METHOD_EXT(AGSGalaxy::GetFloatStat^1, GetFloatStat); - SCRIPT_METHOD_EXT(AGSGalaxy::GetAverageRateStat^1, GetAverageRateStat); - SCRIPT_METHOD_EXT(AGSGalaxy::SetIntStat^2, SetIntStat); - SCRIPT_METHOD_EXT(AGSGalaxy::SetFloatStat^2, SetFloatStat); - SCRIPT_METHOD_EXT(AGSGalaxy::UpdateAverageRateStat^3, UpdateAverageRateStat); - SCRIPT_METHOD_EXT(AGSGalaxy::ResetStatsAndAchievements^0, ResetStatsAndAchievements); - SCRIPT_METHOD_EXT(AGSGalaxy::get_Initialized, get_Initialized); - SCRIPT_METHOD_EXT(AGSGalaxy::get_CurrentLeaderboardName, get_CurrentLeaderboardName); - SCRIPT_METHOD_EXT(AGSGalaxy::RequestLeaderboard^3, RequestLeaderboard); - SCRIPT_METHOD_EXT(AGSGalaxy::UploadScore^1, UploadScore); - SCRIPT_METHOD_EXT(AGSGalaxy::geti_LeaderboardNames, geti_LeaderboardNames); - SCRIPT_METHOD_EXT(AGSGalaxy::geti_LeaderboardScores, geti_LeaderboardScores); - SCRIPT_METHOD_EXT(AGSGalaxy::get_LeaderboardCount, get_LeaderboardCount); - SCRIPT_METHOD_EXT(AGSGalaxy::GetUserName^0, GetUserName); - SCRIPT_METHOD_EXT(AGSGalaxy::GetCurrentGameLanguage^0, GetCurrentGameLanguage); - SCRIPT_METHOD_EXT(AGSGalaxy::Initialize^2, Initialize); + SCRIPT_METHOD(AGSGalaxy::IsAchievementAchieved^1, AGSGalaxy::IsAchievementAchieved); + SCRIPT_METHOD(AGSGalaxy::SetAchievementAchieved^1, AGSGalaxy::SetAchievementAchieved); + SCRIPT_METHOD(AGSGalaxy::ResetAchievement^1, AGSGalaxy::ResetAchievement); + SCRIPT_METHOD(AGSGalaxy::GetIntStat^1, AGSGalaxy::GetIntStat); + SCRIPT_METHOD(AGSGalaxy::GetFloatStat^1, AGSGalaxy::GetFloatStat); + SCRIPT_METHOD(AGSGalaxy::GetAverageRateStat^1, AGSGalaxy::GetAverageRateStat); + SCRIPT_METHOD(AGSGalaxy::SetIntStat^2, AGSGalaxy::SetIntStat); + SCRIPT_METHOD(AGSGalaxy::SetFloatStat^2, AGSGalaxy::SetFloatStat); + SCRIPT_METHOD(AGSGalaxy::UpdateAverageRateStat^3, AGSGalaxy::UpdateAverageRateStat); + SCRIPT_METHOD(AGSGalaxy::ResetStatsAndAchievements^0, AGSGalaxy::ResetStatsAndAchievements); + SCRIPT_METHOD(AGSGalaxy::get_Initialized, AGSGalaxy::get_Initialized); + SCRIPT_METHOD(AGSGalaxy::get_CurrentLeaderboardName, AGSGalaxy::get_CurrentLeaderboardName); + SCRIPT_METHOD(AGSGalaxy::RequestLeaderboard^3, AGSGalaxy::RequestLeaderboard); + SCRIPT_METHOD(AGSGalaxy::UploadScore^1, AGSGalaxy::UploadScore); + SCRIPT_METHOD(AGSGalaxy::geti_LeaderboardNames, AGSGalaxy::geti_LeaderboardNames); + SCRIPT_METHOD(AGSGalaxy::geti_LeaderboardScores, AGSGalaxy::geti_LeaderboardScores); + SCRIPT_METHOD(AGSGalaxy::get_LeaderboardCount, AGSGalaxy::get_LeaderboardCount); + SCRIPT_METHOD(AGSGalaxy::GetUserName^0, AGSGalaxy::GetUserName); + SCRIPT_METHOD(AGSGalaxy::GetCurrentGameLanguage^0, AGSGalaxy::GetCurrentGameLanguage); + SCRIPT_METHOD(AGSGalaxy::Initialize^2, AGSGalaxy::Initialize); } /*------------------------------------------------------------------*/ -AGSSteam::AGSSteam() : AGS2Client() { - DLL_METHOD(AGS_GetPluginName); - DLL_METHOD(AGS_EngineStartup); -} - const char *AGSSteam::AGS_GetPluginName() { return "AGSSteam"; } @@ -226,26 +214,26 @@ const char *AGSSteam::AGS_GetPluginName() { void AGSSteam::AGS_EngineStartup(IAGSEngine *engine) { AGS2Client::AGS_EngineStartup(engine); - SCRIPT_METHOD_EXT(AGSteam::IsAchievementAchieved^1, IsAchievementAchieved); - SCRIPT_METHOD_EXT(AGSteam::SetAchievementAchieved^1, SetAchievementAchieved); - SCRIPT_METHOD_EXT(AGSteam::ResetAchievement^1, ResetAchievement); - SCRIPT_METHOD_EXT(AGSteam::GetIntStat^1, GetIntStat); - SCRIPT_METHOD_EXT(AGSteam::GetFloatStat^1, GetFloatStat); - SCRIPT_METHOD_EXT(AGSteam::GetAverageRateStat^1, GetAverageRateStat); - SCRIPT_METHOD_EXT(AGSteam::SetIntStat^2, SetIntStat); - SCRIPT_METHOD_EXT(AGSteam::SetFloatStat^2, SetFloatStat); - SCRIPT_METHOD_EXT(AGSteam::UpdateAverageRateStat^3, UpdateAverageRateStat); - SCRIPT_METHOD_EXT(AGSteam::ResetStatsAndAchievements^0, ResetStatsAndAchievements); - SCRIPT_METHOD_EXT(AGSteam::get_Initialized, get_Initialized); - SCRIPT_METHOD_EXT(AGSteam::get_CurrentLeaderboardName, get_CurrentLeaderboardName); - SCRIPT_METHOD_EXT(AGSteam::RequestLeaderboard^3, RequestLeaderboard); - SCRIPT_METHOD_EXT(AGSteam::UploadScore^1, UploadScore); - SCRIPT_METHOD_EXT(AGSteam::geti_LeaderboardNames, geti_LeaderboardNames); - SCRIPT_METHOD_EXT(AGSteam::geti_LeaderboardScores, geti_LeaderboardScores); - SCRIPT_METHOD_EXT(AGSteam::get_LeaderboardCount, get_LeaderboardCount); - SCRIPT_METHOD_EXT(AGSteam::GetUserName^0, GetUserName); - SCRIPT_METHOD_EXT(AGSteam::GetCurrentGameLanguage^0, GetCurrentGameLanguage); - SCRIPT_METHOD_EXT(AGSteam::FindLeaderboard^1, FindLeaderboard); + SCRIPT_METHOD(AGSteam::IsAchievementAchieved^1, AGSSteam::IsAchievementAchieved); + SCRIPT_METHOD(AGSteam::SetAchievementAchieved^1, AGSSteam::SetAchievementAchieved); + SCRIPT_METHOD(AGSteam::ResetAchievement^1, AGSSteam::ResetAchievement); + SCRIPT_METHOD(AGSteam::GetIntStat^1, AGSSteam::GetIntStat); + SCRIPT_METHOD(AGSteam::GetFloatStat^1, AGSSteam::GetFloatStat); + SCRIPT_METHOD(AGSteam::GetAverageRateStat^1, AGSSteam::GetAverageRateStat); + SCRIPT_METHOD(AGSteam::SetIntStat^2, AGSSteam::SetIntStat); + SCRIPT_METHOD(AGSteam::SetFloatStat^2, AGSSteam::SetFloatStat); + SCRIPT_METHOD(AGSteam::UpdateAverageRateStat^3, AGSSteam::UpdateAverageRateStat); + SCRIPT_METHOD(AGSteam::ResetStatsAndAchievements^0, AGSSteam::ResetStatsAndAchievements); + SCRIPT_METHOD(AGSteam::get_Initialized, AGSSteam::get_Initialized); + SCRIPT_METHOD(AGSteam::get_CurrentLeaderboardName, AGSSteam::get_CurrentLeaderboardName); + SCRIPT_METHOD(AGSteam::RequestLeaderboard^3, AGSSteam::RequestLeaderboard); + SCRIPT_METHOD(AGSteam::UploadScore^1, AGSSteam::UploadScore); + SCRIPT_METHOD(AGSteam::geti_LeaderboardNames, AGSSteam::geti_LeaderboardNames); + SCRIPT_METHOD(AGSteam::geti_LeaderboardScores, AGSSteam::geti_LeaderboardScores); + SCRIPT_METHOD(AGSteam::get_LeaderboardCount, AGSSteam::get_LeaderboardCount); + SCRIPT_METHOD(AGSteam::GetUserName^0, AGSSteam::GetUserName); + SCRIPT_METHOD(AGSteam::GetCurrentGameLanguage^0, AGSSteam::GetCurrentGameLanguage); + SCRIPT_METHOD(AGSteam::FindLeaderboard^1, AGSSteam::FindLeaderboard); } } // namespace AGSGalaxySteam diff --git a/engines/ags/plugins/ags_galaxy_steam/ags_galaxy_steam.h b/engines/ags/plugins/ags_galaxy_steam/ags_galaxy_steam.h index d3ef7dbd71a..8bb387e0712 100644 --- a/engines/ags/plugins/ags_galaxy_steam/ags_galaxy_steam.h +++ b/engines/ags/plugins/ags_galaxy_steam/ags_galaxy_steam.h @@ -23,7 +23,7 @@ #ifndef AGS_PLUGINS_AGS_GALAXY_STEAM_AGS_GALAXY_STEAM_H #define AGS_PLUGINS_AGS_GALAXY_STEAM_AGS_GALAXY_STEAM_H -#include "ags/plugins/plugin_base.h" +#include "ags/plugins/ags_plugin.h" #include "common/array.h" #include "common/rect.h" #include "common/str.h" @@ -34,6 +34,7 @@ namespace Plugins { namespace AGSGalaxySteam { class AGS2Client : public PluginBase { + SCRIPT_HASH(AGS2Client) protected: void IsAchievementAchieved(ScriptMethodParams ¶ms); void SetAchievementAchieved(ScriptMethodParams ¶ms); @@ -57,31 +58,31 @@ protected: void FindLeaderboard(ScriptMethodParams ¶ms); void Initialize(ScriptMethodParams ¶ms); -protected: - void AGS_EngineStartup(IAGSEngine *engine) override; - public: - AGS2Client(); + AGS2Client() : PluginBase() {} + virtual ~AGS2Client() {} + + void AGS_EngineStartup(IAGSEngine *engine) override; }; class AGSGalaxy : public AGS2Client { -private: - const char *AGS_GetPluginName(); - void AGS_EngineStartup(IAGSEngine *engine) override; - + SCRIPT_HASH(AGSGalaxy) public: - AGSGalaxy(); + AGSGalaxy() : AGS2Client() {} + virtual ~AGSGalaxy() {} + + const char *AGS_GetPluginName() override; + void AGS_EngineStartup(IAGSEngine *engine) override; }; class AGSSteam : public AGS2Client { -private: - const char *AGS_GetPluginName(); - -protected: - void AGS_EngineStartup(IAGSEngine *engine) override; - + SCRIPT_HASH(AGSSteam) public: - AGSSteam(); + AGSSteam() : AGS2Client() {} + virtual ~AGSSteam() {} + + const char *AGS_GetPluginName() override; + void AGS_EngineStartup(IAGSEngine *engine) override; }; } // namespace AGSGalaxySteam diff --git a/engines/ags/plugins/ags_galaxy_steam/ags_wadjeteye_steam.cpp b/engines/ags/plugins/ags_galaxy_steam/ags_wadjeteye_steam.cpp index ca7ed00b626..579a5238930 100644 --- a/engines/ags/plugins/ags_galaxy_steam/ags_wadjeteye_steam.cpp +++ b/engines/ags/plugins/ags_galaxy_steam/ags_wadjeteye_steam.cpp @@ -26,10 +26,6 @@ namespace AGS3 { namespace Plugins { namespace AGSGalaxySteam { -AGSWadjetEyeSteam::AGSWadjetEyeSteam() : AGSSteam() { - DLL_METHOD(AGS_EngineStartup); -} - void AGSWadjetEyeSteam::AddAchievement(ScriptMethodParams ¶ms) { warning("AGSWadjetEyeSteam::AddAchievement() is not implemented"); params._result = 0; @@ -42,29 +38,30 @@ void AGSWadjetEyeSteam::AddStat(ScriptMethodParams ¶ms) { void AGSWadjetEyeSteam::AGS_EngineStartup(IAGSEngine *engine) { AGSSteam::AGS_EngineStartup(engine); - SCRIPT_METHOD_EXT(Steam::AddAchievement^1, AddAchievement); - SCRIPT_METHOD_EXT(Steam::AddStat^2, AddStat); - SCRIPT_METHOD_EXT(Steam::IsAchievementAchieved^1, IsAchievementAchieved); - SCRIPT_METHOD_EXT(Steam::SetAchievementAchieved^1, SetAchievementAchieved); - SCRIPT_METHOD_EXT(Steam::ResetAchievement^1, ResetAchievement); - SCRIPT_METHOD_EXT(Steam::GetIntStat^1, GetIntStat); - SCRIPT_METHOD_EXT(Steam::GetFloatStat^1, GetFloatStat); - SCRIPT_METHOD_EXT(Steam::GetAverageRateStat^1, GetAverageRateStat); - SCRIPT_METHOD_EXT(Steam::SetIntStat^2, SetIntStat); - SCRIPT_METHOD_EXT(Steam::SetFloatStat^2, SetFloatStat); - SCRIPT_METHOD_EXT(Steam::UpdateAverageRateStat^3, UpdateAverageRateStat); - SCRIPT_METHOD_EXT(Steam::ResetStatsAndAchievements^0, ResetStatsAndAchievements); - SCRIPT_METHOD_EXT(Steam::get_Initialized, get_Initialized); - SCRIPT_METHOD_EXT(Steam::get_CurrentLeaderboardName, get_CurrentLeaderboardName); - SCRIPT_METHOD_EXT(Steam::RequestLeaderboard^3, RequestLeaderboard); - SCRIPT_METHOD_EXT(Steam::UploadScore^1, UploadScore); - SCRIPT_METHOD_EXT(Steam::geti_LeaderboardNames, geti_LeaderboardNames); - SCRIPT_METHOD_EXT(Steam::geti_LeaderboardScores, geti_LeaderboardScores); - SCRIPT_METHOD_EXT(Steam::get_LeaderboardCount, get_LeaderboardCount); - SCRIPT_METHOD_EXT(Steam::GetUserName^0, GetUserName); - SCRIPT_METHOD_EXT(Steam::GetCurrentGameLanguage^0, GetCurrentGameLanguage); - SCRIPT_METHOD_EXT(Steam::FindLeaderboard^1, FindLeaderboard); - SCRIPT_METHOD_EXT(Steam::Initialize^2, Initialize); + + SCRIPT_METHOD(Steam::AddAchievement^1, AGSWadjetEyeSteam::AddAchievement); + SCRIPT_METHOD(Steam::AddStat^2, AGSWadjetEyeSteam::AddStat); + SCRIPT_METHOD(Steam::IsAchievementAchieved^1, AGSWadjetEyeSteam::IsAchievementAchieved); + SCRIPT_METHOD(Steam::SetAchievementAchieved^1, AGSWadjetEyeSteam::SetAchievementAchieved); + SCRIPT_METHOD(Steam::ResetAchievement^1, AGSWadjetEyeSteam::ResetAchievement); + SCRIPT_METHOD(Steam::GetIntStat^1, AGSWadjetEyeSteam::GetIntStat); + SCRIPT_METHOD(Steam::GetFloatStat^1, AGSWadjetEyeSteam::GetFloatStat); + SCRIPT_METHOD(Steam::GetAverageRateStat^1, AGSWadjetEyeSteam::GetAverageRateStat); + SCRIPT_METHOD(Steam::SetIntStat^2, AGSWadjetEyeSteam::SetIntStat); + SCRIPT_METHOD(Steam::SetFloatStat^2, AGSWadjetEyeSteam::SetFloatStat); + SCRIPT_METHOD(Steam::UpdateAverageRateStat^3, AGSWadjetEyeSteam::UpdateAverageRateStat); + SCRIPT_METHOD(Steam::ResetStatsAndAchievements^0, AGSWadjetEyeSteam::ResetStatsAndAchievements); + SCRIPT_METHOD(Steam::get_Initialized, AGSWadjetEyeSteam::get_Initialized); + SCRIPT_METHOD(Steam::get_CurrentLeaderboardName, AGSWadjetEyeSteam::get_CurrentLeaderboardName); + SCRIPT_METHOD(Steam::RequestLeaderboard^3, AGSWadjetEyeSteam::RequestLeaderboard); + SCRIPT_METHOD(Steam::UploadScore^1, AGSWadjetEyeSteam::UploadScore); + SCRIPT_METHOD(Steam::geti_LeaderboardNames, AGSWadjetEyeSteam::geti_LeaderboardNames); + SCRIPT_METHOD(Steam::geti_LeaderboardScores, AGSWadjetEyeSteam::geti_LeaderboardScores); + SCRIPT_METHOD(Steam::get_LeaderboardCount, AGSWadjetEyeSteam::get_LeaderboardCount); + SCRIPT_METHOD(Steam::GetUserName^0, AGSWadjetEyeSteam::GetUserName); + SCRIPT_METHOD(Steam::GetCurrentGameLanguage^0, AGSWadjetEyeSteam::GetCurrentGameLanguage); + SCRIPT_METHOD(Steam::FindLeaderboard^1, AGSWadjetEyeSteam::FindLeaderboard); + SCRIPT_METHOD(Steam::Initialize^2, AGSWadjetEyeSteam::Initialize); } } // namespace AGSGalaxySteam diff --git a/engines/ags/plugins/ags_galaxy_steam/ags_wadjeteye_steam.h b/engines/ags/plugins/ags_galaxy_steam/ags_wadjeteye_steam.h index 9445834c7aa..775fd492ce6 100644 --- a/engines/ags/plugins/ags_galaxy_steam/ags_wadjeteye_steam.h +++ b/engines/ags/plugins/ags_galaxy_steam/ags_wadjeteye_steam.h @@ -30,13 +30,16 @@ namespace Plugins { namespace AGSGalaxySteam { class AGSWadjetEyeSteam : public AGSSteam { + SCRIPT_HASH(AGSWadjetEyeSteam) private: - void AGS_EngineStartup(IAGSEngine *engine) override; void AddAchievement(ScriptMethodParams ¶ms); void AddStat(ScriptMethodParams ¶ms); public: - AGSWadjetEyeSteam(); + AGSWadjetEyeSteam() : AGSSteam() {} + virtual ~AGSWadjetEyeSteam() {} + + void AGS_EngineStartup(IAGSEngine *engine) override; }; } // namespace AGSGalaxySteam diff --git a/engines/ags/plugins/ags_joy/ags_joy.cpp b/engines/ags/plugins/ags_joy/ags_joy.cpp index dbc8b89e55e..05f957f1df3 100644 --- a/engines/ags/plugins/ags_joy/ags_joy.cpp +++ b/engines/ags/plugins/ags_joy/ags_joy.cpp @@ -27,37 +27,30 @@ namespace AGS3 { namespace Plugins { namespace AGSJoy { -IAGSEngine *AGSJoy::_engine; - -AGSJoy::AGSJoy() : PluginBase() { - DLL_METHOD(AGS_GetPluginName); - DLL_METHOD(AGS_EngineStartup); -} - const char *AGSJoy::AGS_GetPluginName() { return "AGSJoy"; } void AGSJoy::AGS_EngineStartup(IAGSEngine *engine) { - _engine = engine; + PluginBase::AGS_EngineStartup(engine); // Register functions - SCRIPT_METHOD_EXT(JoystickCount, Count); - SCRIPT_METHOD_EXT(JoystickName, Name); - SCRIPT_METHOD_EXT(JoystickRescan, Rescan); - SCRIPT_METHOD_EXT(Joystick::Open, Open); - SCRIPT_METHOD_EXT(Joystick::IsOpen, IsOpen); - SCRIPT_METHOD_EXT(Joystick::Click, Click); - SCRIPT_METHOD_EXT(Joystick::Close, Close); - SCRIPT_METHOD_EXT(Joystick::Valid, Valid); - SCRIPT_METHOD_EXT(Joystick::Unplugged, Unplugged); - SCRIPT_METHOD_EXT(Joystick::GetName, GetName); - SCRIPT_METHOD_EXT(Joystick::GetAxis, GetAxis); - SCRIPT_METHOD_EXT(Joystick::IsButtonDown, IsButtonDown); - SCRIPT_METHOD_EXT(Joystick::IsJoyBtnDown, IsJoyBtnDown); - SCRIPT_METHOD_EXT(Joystick::Update, Update); - SCRIPT_METHOD_EXT(Joystick::DisableEvents, DisableEvents); - SCRIPT_METHOD_EXT(Joystick::EnableEvents, EnableEvents); + SCRIPT_METHOD(JoystickCount, AGSJoy::Count); + SCRIPT_METHOD(JoystickName, AGSJoy::Name); + SCRIPT_METHOD(JoystickRescan, AGSJoy::Rescan); + SCRIPT_METHOD(Joystick::Open, AGSJoy::Open); + SCRIPT_METHOD(Joystick::IsOpen, AGSJoy::IsOpen); + SCRIPT_METHOD(Joystick::Click, AGSJoy::Click); + SCRIPT_METHOD(Joystick::Close, AGSJoy::Close); + SCRIPT_METHOD(Joystick::Valid, AGSJoy::Valid); + SCRIPT_METHOD(Joystick::Unplugged, AGSJoy::Unplugged); + SCRIPT_METHOD(Joystick::GetName, AGSJoy::GetName); + SCRIPT_METHOD(Joystick::GetAxis, AGSJoy::GetAxis); + SCRIPT_METHOD(Joystick::IsButtonDown, AGSJoy::IsButtonDown); + SCRIPT_METHOD(Joystick::IsJoyBtnDown, AGSJoy::IsJoyBtnDown); + SCRIPT_METHOD(Joystick::Update, AGSJoy::Update); + SCRIPT_METHOD(Joystick::DisableEvents, AGSJoy::DisableEvents); + SCRIPT_METHOD(Joystick::EnableEvents, AGSJoy::EnableEvents); } void AGSJoy::Count(ScriptMethodParams ¶ms) { diff --git a/engines/ags/plugins/ags_joy/ags_joy.h b/engines/ags/plugins/ags_joy/ags_joy.h index 76cf9fa7c8e..08ece7a6567 100644 --- a/engines/ags/plugins/ags_joy/ags_joy.h +++ b/engines/ags/plugins/ags_joy/ags_joy.h @@ -23,39 +23,38 @@ #ifndef AGS_PLUGINS_AGS_JOY_AGS_JOY_H #define AGS_PLUGINS_AGS_JOY_AGS_JOY_H -#include "ags/plugins/plugin_base.h" +#include "ags/plugins/ags_plugin.h" namespace AGS3 { namespace Plugins { namespace AGSJoy { class AGSJoy : public PluginBase { + SCRIPT_HASH(AGSJoy) private: -IAGSEngine *_engine; -private: -const char *AGS_GetPluginName(); -void AGS_EngineStartup(IAGSEngine *lpEngine); - -private: -void Count(ScriptMethodParams ¶ms); -void Name(ScriptMethodParams ¶ms); -void Rescan(ScriptMethodParams ¶ms); -void Open(ScriptMethodParams ¶ms); -void IsOpen(ScriptMethodParams ¶ms); -void Click(ScriptMethodParams ¶ms); -void Close(ScriptMethodParams ¶ms); -void Valid(ScriptMethodParams ¶ms); -void Unplugged(ScriptMethodParams ¶ms); -void GetName(ScriptMethodParams ¶ms); -void GetAxis(ScriptMethodParams ¶ms); -void IsButtonDown(ScriptMethodParams ¶ms); -void IsJoyBtnDown(ScriptMethodParams ¶ms); -void Update(ScriptMethodParams ¶ms); -void DisableEvents(ScriptMethodParams ¶ms); -void EnableEvents(ScriptMethodParams ¶ms); + void Count(ScriptMethodParams ¶ms); + void Name(ScriptMethodParams ¶ms); + void Rescan(ScriptMethodParams ¶ms); + void Open(ScriptMethodParams ¶ms); + void IsOpen(ScriptMethodParams ¶ms); + void Click(ScriptMethodParams ¶ms); + void Close(ScriptMethodParams ¶ms); + void Valid(ScriptMethodParams ¶ms); + void Unplugged(ScriptMethodParams ¶ms); + void GetName(ScriptMethodParams ¶ms); + void GetAxis(ScriptMethodParams ¶ms); + void IsButtonDown(ScriptMethodParams ¶ms); + void IsJoyBtnDown(ScriptMethodParams ¶ms); + void Update(ScriptMethodParams ¶ms); + void DisableEvents(ScriptMethodParams ¶ms); + void EnableEvents(ScriptMethodParams ¶ms); public: -AGSJoy(); + AGSJoy() : PluginBase() {} + virtual ~AGSJoy() {} + + const char *AGS_GetPluginName() override; + void AGS_EngineStartup(IAGSEngine *lpEngine) override; }; } // namespace AGSJoy diff --git a/engines/ags/plugins/ags_nickenstien_gfx/ags_nickenstien_gfx.cpp b/engines/ags/plugins/ags_nickenstien_gfx/ags_nickenstien_gfx.cpp index 5ed2979c370..55122fb0130 100644 --- a/engines/ags/plugins/ags_nickenstien_gfx/ags_nickenstien_gfx.cpp +++ b/engines/ags/plugins/ags_nickenstien_gfx/ags_nickenstien_gfx.cpp @@ -26,103 +26,94 @@ namespace AGS3 { namespace Plugins { namespace AGSNickenstienGFX { -IAGSEngine *AGSNickenstienGFX::_engine; - -AGSNickenstienGFX::AGSNickenstienGFX() : PluginBase() { - _engine = nullptr; - - DLL_METHOD(AGS_GetPluginName); - DLL_METHOD(AGS_EngineStartup); -} - const char *AGSNickenstienGFX::AGS_GetPluginName() { return "Nickenstien\'s NGFX Graphics Library."; } void AGSNickenstienGFX::AGS_EngineStartup(IAGSEngine *engine) { - _engine = engine; + PluginBase::AGS_EngineStartup(engine); if (_engine->version < 3) _engine->AbortGame("Engine interface is too old, need newer version of AGS."); - SCRIPT_METHOD(NGFX_GRAPHICS_Initialise); - SCRIPT_METHOD(NGFX_GRAPHICS_Enable); - SCRIPT_METHOD(NGFX_GRAPHICS_SetTimeScalar); - SCRIPT_METHOD(NGFX_GRAPHICS_FullScreenFadeOut); - SCRIPT_METHOD(NGFX_GRAPHICS_FullScreenFadeIn); - SCRIPT_METHOD(NGFX_GRAPHICS_FullScreenFadeOut_2); - SCRIPT_METHOD(NGFX_GRAPHICS_FullScreenFadeOut_2_SetBackgroundColour); - SCRIPT_METHOD(NGFX_GRAPHICS_FullScreenFadeIn_2); - SCRIPT_METHOD(NGFX_GRAPHICS_SetAnisotropicFilter); - SCRIPT_METHOD(NGFX_TEXTURE_Load); - SCRIPT_METHOD(NGFX_TEXTURE_Release); - SCRIPT_METHOD(NGFX_TEXTURE_GetWidth); - SCRIPT_METHOD(NGFX_TEXTURE_GetHeight); - SCRIPT_METHOD(NGFX_PARTICLE_EMITTER_Create); - SCRIPT_METHOD(NGFX_PARTICLE_EMITTER_Release); - SCRIPT_METHOD(NGFX_PARTICLE_EMITTER_SetType); - SCRIPT_METHOD(NGFX_PARTICLE_EMITTER_SetLife); - SCRIPT_METHOD(NGFX_PARTICLE_EMITTER_SetEmittionRate); - SCRIPT_METHOD(NGFX_PARTICLE_EMITTER_SetParticlesPerEmittion); - SCRIPT_METHOD(NGFX_PARTICLE_EMITTER_SetPosition1); - SCRIPT_METHOD(NGFX_PARTICLE_EMITTER_SetPosition2); - SCRIPT_METHOD(NGFX_PARTICLE_EMITTER_SetStartVelocity); - SCRIPT_METHOD(NGFX_PARTICLE_EMITTER_SetStartVelocity_Deviation); - SCRIPT_METHOD(NGFX_PARTICLE_EMITTER_SetEndVelocity); - SCRIPT_METHOD(NGFX_PARTICLE_EMITTER_SetEndVelocity_Deviation); - SCRIPT_METHOD(NGFX_PARTICLE_EMITTER_SetStartWidth); - SCRIPT_METHOD(NGFX_PARTICLE_EMITTER_SetStartWidth_Deviation); - SCRIPT_METHOD(NGFX_PARTICLE_EMITTER_SetEndWidth); - SCRIPT_METHOD(NGFX_PARTICLE_EMITTER_SetEndWidth_Deviation); - SCRIPT_METHOD(NGFX_PARTICLE_EMITTER_SetStartHeight); - SCRIPT_METHOD(NGFX_PARTICLE_EMITTER_SetStartHeight_Deviation); - SCRIPT_METHOD(NGFX_PARTICLE_EMITTER_SetEndHeight); - SCRIPT_METHOD(NGFX_PARTICLE_EMITTER_SetEndHeight_Deviation); - SCRIPT_METHOD(NGFX_PARTICLE_EMITTER_SetStartAngle); - SCRIPT_METHOD(NGFX_PARTICLE_EMITTER_SetStartAngle_Deviation); - SCRIPT_METHOD(NGFX_PARTICLE_EMITTER_SetRotation); - SCRIPT_METHOD(NGFX_PARTICLE_EMITTER_SetRotation_Deviation); - SCRIPT_METHOD(NGFX_PARTICLE_EMITTER_SetStartColour); - SCRIPT_METHOD(NGFX_PARTICLE_EMITTER_SetStartColour_Deviation); - SCRIPT_METHOD(NGFX_PARTICLE_EMITTER_SetEndColour); - SCRIPT_METHOD(NGFX_PARTICLE_EMITTER_SetEndColour_Deviation); - SCRIPT_METHOD(NGFX_PARTICLE_EMITTER_SetBlendMode); - SCRIPT_METHOD(NGFX_PARTICLE_EMITTER_SetTexture); - SCRIPT_METHOD(NGFX_PARTICLE_EMITTER_SetForce); - SCRIPT_METHOD(NGFX_PARTICLE_EMITTER_SetParticleLife); - SCRIPT_METHOD(NGFX_PARTICLE_EMITTER_SetParticleLife_Deviation); - SCRIPT_METHOD(NGFX_PARTICLE_EMITTER_SetNoTimeOut); - SCRIPT_METHOD(NGFX_PARTICLE_EMITTER_SetDrawOrderReversed); - SCRIPT_METHOD(NGFX_PARTICLE_EMITTER_SetProcessWhenOffScreen); - SCRIPT_METHOD(NGFX_PARTICLE_EMITTER_SetUseVelocityParticles); - SCRIPT_METHOD(NGFX_PARTICLE_EMITTER_SetChannelID); - SCRIPT_METHOD(NGFX_PARTICLE_EMITTER_Start); - SCRIPT_METHOD(NGFX_PARTICLE_EMITTER_Clone); - SCRIPT_METHOD(NGFX_PARTICLE_EMITTER_ReleaseAll); - SCRIPT_METHOD(NGFX_PARTICLE_EMITTER_Evolve); - SCRIPT_METHOD(NGFX_HasGameRoomChanged); - SCRIPT_METHOD(NGFX_HasGameRoomChanged_SecondTest); - SCRIPT_METHOD(NGFX_SPRITE_ResetForNewRoom); - SCRIPT_METHOD(NGFX_SPRITE_Create); - SCRIPT_METHOD(NGFX_SPRITE_Release); - SCRIPT_METHOD(NGFX_SPRITE_SetChannelID); - SCRIPT_METHOD(NGFX_SPRITE_SetPosition); - SCRIPT_METHOD(NGFX_SPRITE_SetPivot); - SCRIPT_METHOD(NGFX_SPRITE_SetTexture); - SCRIPT_METHOD(NGFX_SPRITE_SetBlendMode); - SCRIPT_METHOD(NGFX_SPRITE_SetWidth); - SCRIPT_METHOD(NGFX_SPRITE_SetHeight); - SCRIPT_METHOD(NGFX_SPRITE_SetAngle); - SCRIPT_METHOD(NGFX_SPRITE_SetColour_1); - SCRIPT_METHOD(NGFX_SPRITE_SetColour_2); - SCRIPT_METHOD(NGFX_SPRITE_SetColour_3); - SCRIPT_METHOD(NGFX_SPRITE_SetColour_4); - SCRIPT_METHOD(NGFX_SPRITE_SetClipRectangle); - SCRIPT_METHOD(NGFX_SPRITE_SetGourard); - SCRIPT_METHOD(NGFX_SPRITE_SetFlipped_H); - SCRIPT_METHOD(NGFX_SPRITE_SetFlipped_V); - SCRIPT_METHOD(NGFX_SPRITE_AddToDrawList); - SCRIPT_METHOD(NGFX_InitForNewGameLoop); + SCRIPT_METHOD(NGFX_GRAPHICS_Initialise, AGSNickenstienGFX::NGFX_GRAPHICS_Initialise); + SCRIPT_METHOD(NGFX_GRAPHICS_Enable, AGSNickenstienGFX::NGFX_GRAPHICS_Enable); + SCRIPT_METHOD(NGFX_GRAPHICS_SetTimeScalar, AGSNickenstienGFX::NGFX_GRAPHICS_SetTimeScalar); + SCRIPT_METHOD(NGFX_GRAPHICS_FullScreenFadeOut, AGSNickenstienGFX::NGFX_GRAPHICS_FullScreenFadeOut); + SCRIPT_METHOD(NGFX_GRAPHICS_FullScreenFadeIn, AGSNickenstienGFX::NGFX_GRAPHICS_FullScreenFadeIn); + SCRIPT_METHOD(NGFX_GRAPHICS_FullScreenFadeOut_2, AGSNickenstienGFX::NGFX_GRAPHICS_FullScreenFadeOut_2); + SCRIPT_METHOD(NGFX_GRAPHICS_FullScreenFadeOut_2_SetBackgroundColour, AGSNickenstienGFX::NGFX_GRAPHICS_FullScreenFadeOut_2_SetBackgroundColour); + SCRIPT_METHOD(NGFX_GRAPHICS_FullScreenFadeIn_2, AGSNickenstienGFX::NGFX_GRAPHICS_FullScreenFadeIn_2); + SCRIPT_METHOD(NGFX_GRAPHICS_SetAnisotropicFilter, AGSNickenstienGFX::NGFX_GRAPHICS_SetAnisotropicFilter); + SCRIPT_METHOD(NGFX_TEXTURE_Load, AGSNickenstienGFX::NGFX_TEXTURE_Load); + SCRIPT_METHOD(NGFX_TEXTURE_Release, AGSNickenstienGFX::NGFX_TEXTURE_Release); + SCRIPT_METHOD(NGFX_TEXTURE_GetWidth, AGSNickenstienGFX::NGFX_TEXTURE_GetWidth); + SCRIPT_METHOD(NGFX_TEXTURE_GetHeight, AGSNickenstienGFX::NGFX_TEXTURE_GetHeight); + SCRIPT_METHOD(NGFX_PARTICLE_EMITTER_Create, AGSNickenstienGFX::NGFX_PARTICLE_EMITTER_Create); + SCRIPT_METHOD(NGFX_PARTICLE_EMITTER_Release, AGSNickenstienGFX::NGFX_PARTICLE_EMITTER_Release); + SCRIPT_METHOD(NGFX_PARTICLE_EMITTER_SetType, AGSNickenstienGFX::NGFX_PARTICLE_EMITTER_SetType); + SCRIPT_METHOD(NGFX_PARTICLE_EMITTER_SetLife, AGSNickenstienGFX::NGFX_PARTICLE_EMITTER_SetLife); + SCRIPT_METHOD(NGFX_PARTICLE_EMITTER_SetEmittionRate, AGSNickenstienGFX::NGFX_PARTICLE_EMITTER_SetEmittionRate); + SCRIPT_METHOD(NGFX_PARTICLE_EMITTER_SetParticlesPerEmittion, AGSNickenstienGFX::NGFX_PARTICLE_EMITTER_SetParticlesPerEmittion); + SCRIPT_METHOD(NGFX_PARTICLE_EMITTER_SetPosition1, AGSNickenstienGFX::NGFX_PARTICLE_EMITTER_SetPosition1); + SCRIPT_METHOD(NGFX_PARTICLE_EMITTER_SetPosition2, AGSNickenstienGFX::NGFX_PARTICLE_EMITTER_SetPosition2); + SCRIPT_METHOD(NGFX_PARTICLE_EMITTER_SetStartVelocity, AGSNickenstienGFX::NGFX_PARTICLE_EMITTER_SetStartVelocity); + SCRIPT_METHOD(NGFX_PARTICLE_EMITTER_SetStartVelocity_Deviation, AGSNickenstienGFX::NGFX_PARTICLE_EMITTER_SetStartVelocity_Deviation); + SCRIPT_METHOD(NGFX_PARTICLE_EMITTER_SetEndVelocity, AGSNickenstienGFX::NGFX_PARTICLE_EMITTER_SetEndVelocity); + SCRIPT_METHOD(NGFX_PARTICLE_EMITTER_SetEndVelocity_Deviation, AGSNickenstienGFX::NGFX_PARTICLE_EMITTER_SetEndVelocity_Deviation); + SCRIPT_METHOD(NGFX_PARTICLE_EMITTER_SetStartWidth, AGSNickenstienGFX::NGFX_PARTICLE_EMITTER_SetStartWidth); + SCRIPT_METHOD(NGFX_PARTICLE_EMITTER_SetStartWidth_Deviation, AGSNickenstienGFX::NGFX_PARTICLE_EMITTER_SetStartWidth_Deviation); + SCRIPT_METHOD(NGFX_PARTICLE_EMITTER_SetEndWidth, AGSNickenstienGFX::NGFX_PARTICLE_EMITTER_SetEndWidth); + SCRIPT_METHOD(NGFX_PARTICLE_EMITTER_SetEndWidth_Deviation, AGSNickenstienGFX::NGFX_PARTICLE_EMITTER_SetEndWidth_Deviation); + SCRIPT_METHOD(NGFX_PARTICLE_EMITTER_SetStartHeight, AGSNickenstienGFX::NGFX_PARTICLE_EMITTER_SetStartHeight); + SCRIPT_METHOD(NGFX_PARTICLE_EMITTER_SetStartHeight_Deviation, AGSNickenstienGFX::NGFX_PARTICLE_EMITTER_SetStartHeight_Deviation); + SCRIPT_METHOD(NGFX_PARTICLE_EMITTER_SetEndHeight, AGSNickenstienGFX::NGFX_PARTICLE_EMITTER_SetEndHeight); + SCRIPT_METHOD(NGFX_PARTICLE_EMITTER_SetEndHeight_Deviation, AGSNickenstienGFX::NGFX_PARTICLE_EMITTER_SetEndHeight_Deviation); + SCRIPT_METHOD(NGFX_PARTICLE_EMITTER_SetStartAngle, AGSNickenstienGFX::NGFX_PARTICLE_EMITTER_SetStartAngle); + SCRIPT_METHOD(NGFX_PARTICLE_EMITTER_SetStartAngle_Deviation, AGSNickenstienGFX::NGFX_PARTICLE_EMITTER_SetStartAngle_Deviation); + SCRIPT_METHOD(NGFX_PARTICLE_EMITTER_SetRotation, AGSNickenstienGFX::NGFX_PARTICLE_EMITTER_SetRotation); + SCRIPT_METHOD(NGFX_PARTICLE_EMITTER_SetRotation_Deviation, AGSNickenstienGFX::NGFX_PARTICLE_EMITTER_SetRotation_Deviation); + SCRIPT_METHOD(NGFX_PARTICLE_EMITTER_SetStartColour, AGSNickenstienGFX::NGFX_PARTICLE_EMITTER_SetStartColour); + SCRIPT_METHOD(NGFX_PARTICLE_EMITTER_SetStartColour_Deviation, AGSNickenstienGFX::NGFX_PARTICLE_EMITTER_SetStartColour_Deviation); + SCRIPT_METHOD(NGFX_PARTICLE_EMITTER_SetEndColour, AGSNickenstienGFX::NGFX_PARTICLE_EMITTER_SetEndColour); + SCRIPT_METHOD(NGFX_PARTICLE_EMITTER_SetEndColour_Deviation, AGSNickenstienGFX::NGFX_PARTICLE_EMITTER_SetEndColour_Deviation); + SCRIPT_METHOD(NGFX_PARTICLE_EMITTER_SetBlendMode, AGSNickenstienGFX::NGFX_PARTICLE_EMITTER_SetBlendMode); + SCRIPT_METHOD(NGFX_PARTICLE_EMITTER_SetTexture, AGSNickenstienGFX::NGFX_PARTICLE_EMITTER_SetTexture); + SCRIPT_METHOD(NGFX_PARTICLE_EMITTER_SetForce, AGSNickenstienGFX::NGFX_PARTICLE_EMITTER_SetForce); + SCRIPT_METHOD(NGFX_PARTICLE_EMITTER_SetParticleLife, AGSNickenstienGFX::NGFX_PARTICLE_EMITTER_SetParticleLife); + SCRIPT_METHOD(NGFX_PARTICLE_EMITTER_SetParticleLife_Deviation, AGSNickenstienGFX::NGFX_PARTICLE_EMITTER_SetParticleLife_Deviation); + SCRIPT_METHOD(NGFX_PARTICLE_EMITTER_SetNoTimeOut, AGSNickenstienGFX::NGFX_PARTICLE_EMITTER_SetNoTimeOut); + SCRIPT_METHOD(NGFX_PARTICLE_EMITTER_SetDrawOrderReversed, AGSNickenstienGFX::NGFX_PARTICLE_EMITTER_SetDrawOrderReversed); + SCRIPT_METHOD(NGFX_PARTICLE_EMITTER_SetProcessWhenOffScreen, AGSNickenstienGFX::NGFX_PARTICLE_EMITTER_SetProcessWhenOffScreen); + SCRIPT_METHOD(NGFX_PARTICLE_EMITTER_SetUseVelocityParticles, AGSNickenstienGFX::NGFX_PARTICLE_EMITTER_SetUseVelocityParticles); + SCRIPT_METHOD(NGFX_PARTICLE_EMITTER_SetChannelID, AGSNickenstienGFX::NGFX_PARTICLE_EMITTER_SetChannelID); + SCRIPT_METHOD(NGFX_PARTICLE_EMITTER_Start, AGSNickenstienGFX::NGFX_PARTICLE_EMITTER_Start); + SCRIPT_METHOD(NGFX_PARTICLE_EMITTER_Clone, AGSNickenstienGFX::NGFX_PARTICLE_EMITTER_Clone); + SCRIPT_METHOD(NGFX_PARTICLE_EMITTER_ReleaseAll, AGSNickenstienGFX::NGFX_PARTICLE_EMITTER_ReleaseAll); + SCRIPT_METHOD(NGFX_PARTICLE_EMITTER_Evolve, AGSNickenstienGFX::NGFX_PARTICLE_EMITTER_Evolve); + SCRIPT_METHOD(NGFX_HasGameRoomChanged, AGSNickenstienGFX::NGFX_HasGameRoomChanged); + SCRIPT_METHOD(NGFX_HasGameRoomChanged_SecondTest, AGSNickenstienGFX::NGFX_HasGameRoomChanged_SecondTest); + SCRIPT_METHOD(NGFX_SPRITE_ResetForNewRoom, AGSNickenstienGFX::NGFX_SPRITE_ResetForNewRoom); + SCRIPT_METHOD(NGFX_SPRITE_Create, AGSNickenstienGFX::NGFX_SPRITE_Create); + SCRIPT_METHOD(NGFX_SPRITE_Release, AGSNickenstienGFX::NGFX_SPRITE_Release); + SCRIPT_METHOD(NGFX_SPRITE_SetChannelID, AGSNickenstienGFX::NGFX_SPRITE_SetChannelID); + SCRIPT_METHOD(NGFX_SPRITE_SetPosition, AGSNickenstienGFX::NGFX_SPRITE_SetPosition); + SCRIPT_METHOD(NGFX_SPRITE_SetPivot, AGSNickenstienGFX::NGFX_SPRITE_SetPivot); + SCRIPT_METHOD(NGFX_SPRITE_SetTexture, AGSNickenstienGFX::NGFX_SPRITE_SetTexture); + SCRIPT_METHOD(NGFX_SPRITE_SetBlendMode, AGSNickenstienGFX::NGFX_SPRITE_SetBlendMode); + SCRIPT_METHOD(NGFX_SPRITE_SetWidth, AGSNickenstienGFX::NGFX_SPRITE_SetWidth); + SCRIPT_METHOD(NGFX_SPRITE_SetHeight, AGSNickenstienGFX::NGFX_SPRITE_SetHeight); + SCRIPT_METHOD(NGFX_SPRITE_SetAngle, AGSNickenstienGFX::NGFX_SPRITE_SetAngle); + SCRIPT_METHOD(NGFX_SPRITE_SetColour_1, AGSNickenstienGFX::NGFX_SPRITE_SetColour_1); + SCRIPT_METHOD(NGFX_SPRITE_SetColour_2, AGSNickenstienGFX::NGFX_SPRITE_SetColour_2); + SCRIPT_METHOD(NGFX_SPRITE_SetColour_3, AGSNickenstienGFX::NGFX_SPRITE_SetColour_3); + SCRIPT_METHOD(NGFX_SPRITE_SetColour_4, AGSNickenstienGFX::NGFX_SPRITE_SetColour_4); + SCRIPT_METHOD(NGFX_SPRITE_SetClipRectangle, AGSNickenstienGFX::NGFX_SPRITE_SetClipRectangle); + SCRIPT_METHOD(NGFX_SPRITE_SetGourard, AGSNickenstienGFX::NGFX_SPRITE_SetGourard); + SCRIPT_METHOD(NGFX_SPRITE_SetFlipped_H, AGSNickenstienGFX::NGFX_SPRITE_SetFlipped_H); + SCRIPT_METHOD(NGFX_SPRITE_SetFlipped_V, AGSNickenstienGFX::NGFX_SPRITE_SetFlipped_V); + SCRIPT_METHOD(NGFX_SPRITE_AddToDrawList, AGSNickenstienGFX::NGFX_SPRITE_AddToDrawList); + SCRIPT_METHOD(NGFX_InitForNewGameLoop, AGSNickenstienGFX::NGFX_InitForNewGameLoop); // TODO unnamed functions? } diff --git a/engines/ags/plugins/ags_nickenstien_gfx/ags_nickenstien_gfx.h b/engines/ags/plugins/ags_nickenstien_gfx/ags_nickenstien_gfx.h index e23b6893d7c..362f237ed0a 100644 --- a/engines/ags/plugins/ags_nickenstien_gfx/ags_nickenstien_gfx.h +++ b/engines/ags/plugins/ags_nickenstien_gfx/ags_nickenstien_gfx.h @@ -24,99 +24,100 @@ #define AGS_PLUGINS_AGS_NICKENSTIEN_GFX_AGS_NICKENSTIEN_GFX_H #include "common/str.h" -#include "ags/plugins/plugin_base.h" +#include "ags/plugins/ags_plugin.h" namespace AGS3 { namespace Plugins { namespace AGSNickenstienGFX { class AGSNickenstienGFX : public PluginBase { + SCRIPT_HASH(AGSNickenstienGFX) private: -IAGSEngine *_engine; -const char *AGS_GetPluginName(); -void AGS_EngineStartup(IAGSEngine *engine) override; - -void NGFX_GRAPHICS_Initialise(ScriptMethodParams ¶ms); -void NGFX_GRAPHICS_Enable(ScriptMethodParams ¶ms); -void NGFX_GRAPHICS_SetTimeScalar(ScriptMethodParams ¶ms); -void NGFX_GRAPHICS_FullScreenFadeOut(ScriptMethodParams ¶ms); -void NGFX_GRAPHICS_FullScreenFadeIn(ScriptMethodParams ¶ms); -void NGFX_GRAPHICS_FullScreenFadeOut_2(ScriptMethodParams ¶ms); -void NGFX_GRAPHICS_FullScreenFadeOut_2_SetBackgroundColour(ScriptMethodParams ¶ms); -void NGFX_GRAPHICS_FullScreenFadeIn_2(ScriptMethodParams ¶ms); -void NGFX_GRAPHICS_SetAnisotropicFilter(ScriptMethodParams ¶ms); -void NGFX_TEXTURE_Load(ScriptMethodParams ¶ms); -void NGFX_TEXTURE_Release(ScriptMethodParams ¶ms); -void NGFX_TEXTURE_GetWidth(ScriptMethodParams ¶ms); -void NGFX_TEXTURE_GetHeight(ScriptMethodParams ¶ms); -void NGFX_PARTICLE_EMITTER_Create(ScriptMethodParams ¶ms); -void NGFX_PARTICLE_EMITTER_Release(ScriptMethodParams ¶ms); -void NGFX_PARTICLE_EMITTER_SetType(ScriptMethodParams ¶ms); -void NGFX_PARTICLE_EMITTER_SetLife(ScriptMethodParams ¶ms); -void NGFX_PARTICLE_EMITTER_SetEmittionRate(ScriptMethodParams ¶ms); -void NGFX_PARTICLE_EMITTER_SetParticlesPerEmittion(ScriptMethodParams ¶ms); -void NGFX_PARTICLE_EMITTER_SetPosition1(ScriptMethodParams ¶ms); -void NGFX_PARTICLE_EMITTER_SetPosition2(ScriptMethodParams ¶ms); -void NGFX_PARTICLE_EMITTER_SetStartVelocity(ScriptMethodParams ¶ms); -void NGFX_PARTICLE_EMITTER_SetStartVelocity_Deviation(ScriptMethodParams ¶ms); -void NGFX_PARTICLE_EMITTER_SetEndVelocity(ScriptMethodParams ¶ms); -void NGFX_PARTICLE_EMITTER_SetEndVelocity_Deviation(ScriptMethodParams ¶ms); -void NGFX_PARTICLE_EMITTER_SetStartWidth(ScriptMethodParams ¶ms); -void NGFX_PARTICLE_EMITTER_SetStartWidth_Deviation(ScriptMethodParams ¶ms); -void NGFX_PARTICLE_EMITTER_SetEndWidth(ScriptMethodParams ¶ms); -void NGFX_PARTICLE_EMITTER_SetEndWidth_Deviation(ScriptMethodParams ¶ms); -void NGFX_PARTICLE_EMITTER_SetStartHeight(ScriptMethodParams ¶ms); -void NGFX_PARTICLE_EMITTER_SetStartHeight_Deviation(ScriptMethodParams ¶ms); -void NGFX_PARTICLE_EMITTER_SetEndHeight(ScriptMethodParams ¶ms); -void NGFX_PARTICLE_EMITTER_SetEndHeight_Deviation(ScriptMethodParams ¶ms); -void NGFX_PARTICLE_EMITTER_SetStartAngle(ScriptMethodParams ¶ms); -void NGFX_PARTICLE_EMITTER_SetStartAngle_Deviation(ScriptMethodParams ¶ms); -void NGFX_PARTICLE_EMITTER_SetRotation(ScriptMethodParams ¶ms); -void NGFX_PARTICLE_EMITTER_SetRotation_Deviation(ScriptMethodParams ¶ms); -void NGFX_PARTICLE_EMITTER_SetStartColour(ScriptMethodParams ¶ms); -void NGFX_PARTICLE_EMITTER_SetStartColour_Deviation(ScriptMethodParams ¶ms); -void NGFX_PARTICLE_EMITTER_SetEndColour(ScriptMethodParams ¶ms); -void NGFX_PARTICLE_EMITTER_SetEndColour_Deviation(ScriptMethodParams ¶ms); -void NGFX_PARTICLE_EMITTER_SetBlendMode(ScriptMethodParams ¶ms); -void NGFX_PARTICLE_EMITTER_SetTexture(ScriptMethodParams ¶ms); -void NGFX_PARTICLE_EMITTER_SetForce(ScriptMethodParams ¶ms); -void NGFX_PARTICLE_EMITTER_SetParticleLife(ScriptMethodParams ¶ms); -void NGFX_PARTICLE_EMITTER_SetParticleLife_Deviation(ScriptMethodParams ¶ms); -void NGFX_PARTICLE_EMITTER_SetNoTimeOut(ScriptMethodParams ¶ms); -void NGFX_PARTICLE_EMITTER_SetDrawOrderReversed(ScriptMethodParams ¶ms); -void NGFX_PARTICLE_EMITTER_SetProcessWhenOffScreen(ScriptMethodParams ¶ms); -void NGFX_PARTICLE_EMITTER_SetUseVelocityParticles(ScriptMethodParams ¶ms); -void NGFX_PARTICLE_EMITTER_SetChannelID(ScriptMethodParams ¶ms); -void NGFX_PARTICLE_EMITTER_Start(ScriptMethodParams ¶ms); -void NGFX_PARTICLE_EMITTER_Clone(ScriptMethodParams ¶ms); -void NGFX_PARTICLE_EMITTER_ReleaseAll(ScriptMethodParams ¶ms); -void NGFX_PARTICLE_EMITTER_Evolve(ScriptMethodParams ¶ms); -void NGFX_HasGameRoomChanged(ScriptMethodParams ¶ms); -void NGFX_HasGameRoomChanged_SecondTest(ScriptMethodParams ¶ms); -void NGFX_SPRITE_ResetForNewRoom(ScriptMethodParams ¶ms); -void NGFX_SPRITE_Create(ScriptMethodParams ¶ms); -void NGFX_SPRITE_Release(ScriptMethodParams ¶ms); -void NGFX_SPRITE_SetChannelID(ScriptMethodParams ¶ms); -void NGFX_SPRITE_SetPosition(ScriptMethodParams ¶ms); -void NGFX_SPRITE_SetPivot(ScriptMethodParams ¶ms); -void NGFX_SPRITE_SetTexture(ScriptMethodParams ¶ms); -void NGFX_SPRITE_SetBlendMode(ScriptMethodParams ¶ms); -void NGFX_SPRITE_SetWidth(ScriptMethodParams ¶ms); -void NGFX_SPRITE_SetHeight(ScriptMethodParams ¶ms); -void NGFX_SPRITE_SetAngle(ScriptMethodParams ¶ms); -void NGFX_SPRITE_SetColour_1(ScriptMethodParams ¶ms); -void NGFX_SPRITE_SetColour_2(ScriptMethodParams ¶ms); -void NGFX_SPRITE_SetColour_3(ScriptMethodParams ¶ms); -void NGFX_SPRITE_SetColour_4(ScriptMethodParams ¶ms); -void NGFX_SPRITE_SetClipRectangle(ScriptMethodParams ¶ms); -void NGFX_SPRITE_SetGourard(ScriptMethodParams ¶ms); -void NGFX_SPRITE_SetFlipped_H(ScriptMethodParams ¶ms); -void NGFX_SPRITE_SetFlipped_V(ScriptMethodParams ¶ms); -void NGFX_SPRITE_AddToDrawList(ScriptMethodParams ¶ms); -void NGFX_InitForNewGameLoop(ScriptMethodParams ¶ms); + void NGFX_GRAPHICS_Initialise(ScriptMethodParams ¶ms); + void NGFX_GRAPHICS_Enable(ScriptMethodParams ¶ms); + void NGFX_GRAPHICS_SetTimeScalar(ScriptMethodParams ¶ms); + void NGFX_GRAPHICS_FullScreenFadeOut(ScriptMethodParams ¶ms); + void NGFX_GRAPHICS_FullScreenFadeIn(ScriptMethodParams ¶ms); + void NGFX_GRAPHICS_FullScreenFadeOut_2(ScriptMethodParams ¶ms); + void NGFX_GRAPHICS_FullScreenFadeOut_2_SetBackgroundColour(ScriptMethodParams ¶ms); + void NGFX_GRAPHICS_FullScreenFadeIn_2(ScriptMethodParams ¶ms); + void NGFX_GRAPHICS_SetAnisotropicFilter(ScriptMethodParams ¶ms); + void NGFX_TEXTURE_Load(ScriptMethodParams ¶ms); + void NGFX_TEXTURE_Release(ScriptMethodParams ¶ms); + void NGFX_TEXTURE_GetWidth(ScriptMethodParams ¶ms); + void NGFX_TEXTURE_GetHeight(ScriptMethodParams ¶ms); + void NGFX_PARTICLE_EMITTER_Create(ScriptMethodParams ¶ms); + void NGFX_PARTICLE_EMITTER_Release(ScriptMethodParams ¶ms); + void NGFX_PARTICLE_EMITTER_SetType(ScriptMethodParams ¶ms); + void NGFX_PARTICLE_EMITTER_SetLife(ScriptMethodParams ¶ms); + void NGFX_PARTICLE_EMITTER_SetEmittionRate(ScriptMethodParams ¶ms); + void NGFX_PARTICLE_EMITTER_SetParticlesPerEmittion(ScriptMethodParams ¶ms); + void NGFX_PARTICLE_EMITTER_SetPosition1(ScriptMethodParams ¶ms); + void NGFX_PARTICLE_EMITTER_SetPosition2(ScriptMethodParams ¶ms); + void NGFX_PARTICLE_EMITTER_SetStartVelocity(ScriptMethodParams ¶ms); + void NGFX_PARTICLE_EMITTER_SetStartVelocity_Deviation(ScriptMethodParams ¶ms); + void NGFX_PARTICLE_EMITTER_SetEndVelocity(ScriptMethodParams ¶ms); + void NGFX_PARTICLE_EMITTER_SetEndVelocity_Deviation(ScriptMethodParams ¶ms); + void NGFX_PARTICLE_EMITTER_SetStartWidth(ScriptMethodParams ¶ms); + void NGFX_PARTICLE_EMITTER_SetStartWidth_Deviation(ScriptMethodParams ¶ms); + void NGFX_PARTICLE_EMITTER_SetEndWidth(ScriptMethodParams ¶ms); + void NGFX_PARTICLE_EMITTER_SetEndWidth_Deviation(ScriptMethodParams ¶ms); + void NGFX_PARTICLE_EMITTER_SetStartHeight(ScriptMethodParams ¶ms); + void NGFX_PARTICLE_EMITTER_SetStartHeight_Deviation(ScriptMethodParams ¶ms); + void NGFX_PARTICLE_EMITTER_SetEndHeight(ScriptMethodParams ¶ms); + void NGFX_PARTICLE_EMITTER_SetEndHeight_Deviation(ScriptMethodParams ¶ms); + void NGFX_PARTICLE_EMITTER_SetStartAngle(ScriptMethodParams ¶ms); + void NGFX_PARTICLE_EMITTER_SetStartAngle_Deviation(ScriptMethodParams ¶ms); + void NGFX_PARTICLE_EMITTER_SetRotation(ScriptMethodParams ¶ms); + void NGFX_PARTICLE_EMITTER_SetRotation_Deviation(ScriptMethodParams ¶ms); + void NGFX_PARTICLE_EMITTER_SetStartColour(ScriptMethodParams ¶ms); + void NGFX_PARTICLE_EMITTER_SetStartColour_Deviation(ScriptMethodParams ¶ms); + void NGFX_PARTICLE_EMITTER_SetEndColour(ScriptMethodParams ¶ms); + void NGFX_PARTICLE_EMITTER_SetEndColour_Deviation(ScriptMethodParams ¶ms); + void NGFX_PARTICLE_EMITTER_SetBlendMode(ScriptMethodParams ¶ms); + void NGFX_PARTICLE_EMITTER_SetTexture(ScriptMethodParams ¶ms); + void NGFX_PARTICLE_EMITTER_SetForce(ScriptMethodParams ¶ms); + void NGFX_PARTICLE_EMITTER_SetParticleLife(ScriptMethodParams ¶ms); + void NGFX_PARTICLE_EMITTER_SetParticleLife_Deviation(ScriptMethodParams ¶ms); + void NGFX_PARTICLE_EMITTER_SetNoTimeOut(ScriptMethodParams ¶ms); + void NGFX_PARTICLE_EMITTER_SetDrawOrderReversed(ScriptMethodParams ¶ms); + void NGFX_PARTICLE_EMITTER_SetProcessWhenOffScreen(ScriptMethodParams ¶ms); + void NGFX_PARTICLE_EMITTER_SetUseVelocityParticles(ScriptMethodParams ¶ms); + void NGFX_PARTICLE_EMITTER_SetChannelID(ScriptMethodParams ¶ms); + void NGFX_PARTICLE_EMITTER_Start(ScriptMethodParams ¶ms); + void NGFX_PARTICLE_EMITTER_Clone(ScriptMethodParams ¶ms); + void NGFX_PARTICLE_EMITTER_ReleaseAll(ScriptMethodParams ¶ms); + void NGFX_PARTICLE_EMITTER_Evolve(ScriptMethodParams ¶ms); + void NGFX_HasGameRoomChanged(ScriptMethodParams ¶ms); + void NGFX_HasGameRoomChanged_SecondTest(ScriptMethodParams ¶ms); + void NGFX_SPRITE_ResetForNewRoom(ScriptMethodParams ¶ms); + void NGFX_SPRITE_Create(ScriptMethodParams ¶ms); + void NGFX_SPRITE_Release(ScriptMethodParams ¶ms); + void NGFX_SPRITE_SetChannelID(ScriptMethodParams ¶ms); + void NGFX_SPRITE_SetPosition(ScriptMethodParams ¶ms); + void NGFX_SPRITE_SetPivot(ScriptMethodParams ¶ms); + void NGFX_SPRITE_SetTexture(ScriptMethodParams ¶ms); + void NGFX_SPRITE_SetBlendMode(ScriptMethodParams ¶ms); + void NGFX_SPRITE_SetWidth(ScriptMethodParams ¶ms); + void NGFX_SPRITE_SetHeight(ScriptMethodParams ¶ms); + void NGFX_SPRITE_SetAngle(ScriptMethodParams ¶ms); + void NGFX_SPRITE_SetColour_1(ScriptMethodParams ¶ms); + void NGFX_SPRITE_SetColour_2(ScriptMethodParams ¶ms); + void NGFX_SPRITE_SetColour_3(ScriptMethodParams ¶ms); + void NGFX_SPRITE_SetColour_4(ScriptMethodParams ¶ms); + void NGFX_SPRITE_SetClipRectangle(ScriptMethodParams ¶ms); + void NGFX_SPRITE_SetGourard(ScriptMethodParams ¶ms); + void NGFX_SPRITE_SetFlipped_H(ScriptMethodParams ¶ms); + void NGFX_SPRITE_SetFlipped_V(ScriptMethodParams ¶ms); + void NGFX_SPRITE_AddToDrawList(ScriptMethodParams ¶ms); + void NGFX_InitForNewGameLoop(ScriptMethodParams ¶ms); public: -AGSNickenstienGFX(); + AGSNickenstienGFX() : PluginBase() {} + virtual ~AGSNickenstienGFX() {} + + const char *AGS_GetPluginName() override; + void AGS_EngineStartup(IAGSEngine *engine) override; }; } // namespace AGSNickenstienGFX diff --git a/engines/ags/plugins/ags_pal_render/ags_pal_render.cpp b/engines/ags/plugins/ags_pal_render/ags_pal_render.cpp index 9245a7f8813..58814a979bb 100644 --- a/engines/ags/plugins/ags_pal_render/ags_pal_render.cpp +++ b/engines/ags/plugins/ags_pal_render/ags_pal_render.cpp @@ -46,7 +46,6 @@ const float pisquared = PI * PI; const float picubed = PI * PI * PI; IAGSEngine *engine; - //unsigned char clut[256][256]; unsigned char clut[65536]; @@ -136,23 +135,23 @@ BITMAP *backgroundimage; PALSTRUCT objectivepal[256]; int bgimgspr; -void WriteObjectivePalette(ScriptMethodParams ¶ms) { +void AGSPalRender::WriteObjectivePalette(ScriptMethodParams ¶ms) { PARAMS4(unsigned char, index, unsigned char, r, unsigned char, b, unsigned char, g); objectivepal[index].r = r; objectivepal[index].b = b; objectivepal[index].g = g; } -void ReadObjectivePaletteR(ScriptMethodParams ¶ms) { +void AGSPalRender::ReadObjectivePaletteR(ScriptMethodParams ¶ms) { PARAMS1(unsigned char, index); params._result = (int)objectivepal[index].r; } -void ReadObjectivePaletteB(ScriptMethodParams ¶ms) { +void AGSPalRender::ReadObjectivePaletteB(ScriptMethodParams ¶ms) { PARAMS1(unsigned char, index); params._result = (int)objectivepal[index].b; } -void ReadObjectivePaletteG(ScriptMethodParams ¶ms) { +void AGSPalRender::ReadObjectivePaletteG(ScriptMethodParams ¶ms) { PARAMS1(unsigned char, index); params._result = (int)objectivepal[index].g; } @@ -188,7 +187,7 @@ void PreMultiply_Alphas () //Ha ha, this isn't the kind of premultiplcation you' } */ -void GetModifiedBackgroundImage(ScriptMethodParams ¶ms) { +void AGSPalRender::GetModifiedBackgroundImage(ScriptMethodParams ¶ms) { params._result = bgimgspr; } @@ -238,20 +237,20 @@ float FastCos(float x) { return FastSin(x + halfpi); } -void AGSFastRoot(ScriptMethodParams ¶ms) { +void AGSPalRender::AGSFastRoot(ScriptMethodParams ¶ms) { PARAMS1(unsigned short, x); x = root(x); params._result = (int)x; } -void AGSFastSin(ScriptMethodParams ¶ms) { +void AGSPalRender::AGSFastSin(ScriptMethodParams ¶ms) { PARAMS1(int32, xi); float x = PARAM_TO_FLOAT(xi); x = FastSin(x); params._result = PARAM_FROM_FLOAT(x); } -void AGSFastCos(ScriptMethodParams ¶ms) { +void AGSPalRender::AGSFastCos(ScriptMethodParams ¶ms) { PARAMS1(int32, xi); float x = PARAM_TO_FLOAT(xi); x = FastSin(x + halfpi); @@ -314,51 +313,51 @@ void DrawLens(int ox, int oy) { engine->FreeBitmap(lenswrite); } -void SetLensPos(ScriptMethodParams ¶ms) { +void AGSPalRender::SetLensPos(ScriptMethodParams ¶ms) { PARAMS2(int, x, int, y); LensOption.x = x; LensOption.y = y; } -void GetLensX(ScriptMethodParams ¶ms) { +void AGSPalRender::GetLensX(ScriptMethodParams ¶ms) { params._result = LensOption.x; } -void GetLensY(ScriptMethodParams ¶ms) { +void AGSPalRender::GetLensY(ScriptMethodParams ¶ms) { params._result = LensOption.y; } -void SetLensDrawn(ScriptMethodParams ¶ms) { +void AGSPalRender::SetLensDrawn(ScriptMethodParams ¶ms) { PARAMS1(int, toggle); if (toggle > 0) LensOption.draw = 1; else LensOption.draw = 0; } -void GetLensDrawn(ScriptMethodParams ¶ms) { +void AGSPalRender::GetLensDrawn(ScriptMethodParams ¶ms) { params._result = LensOption.draw; } -void SetLensOffsetClamp(ScriptMethodParams ¶ms) { +void AGSPalRender::SetLensOffsetClamp(ScriptMethodParams ¶ms) { PARAMS1(int, clamp); if (clamp < 0) LensOption.clampoffset = LensOption.lenswidth; else LensOption.clampoffset = clamp; } -void GetLensOffsetClamp(ScriptMethodParams ¶ms) { +void AGSPalRender::GetLensOffsetClamp(ScriptMethodParams ¶ms) { params._result = LensOption.clampoffset; } -void GetLensLevel(ScriptMethodParams ¶ms) { +void AGSPalRender::GetLensLevel(ScriptMethodParams ¶ms) { params._result = LensOption.level; } -void SetLensLevel(ScriptMethodParams ¶ms) { +void AGSPalRender::SetLensLevel(ScriptMethodParams ¶ms) { PARAMS1(int, level); if (level < 0 || level > 4) engine->AbortGame("SetLensLevel: Invalid level."); else LensOption.level = level; } -void LensInitialize(ScriptMethodParams ¶ms) { +void AGSPalRender::LensInitialize(ScriptMethodParams ¶ms) { PARAMS5(int, width, int, zoom, int, lensx, int, lensy, int, level); int clamp = -1; if (params.size() > 5) @@ -404,7 +403,7 @@ void LensInitialize(ScriptMethodParams ¶ms) { else LensOption.level = level; } -void ResetRemapping(ScriptMethodParams &) { +void AGSPalRender::ResetRemapping(ScriptMethodParams &) { for (int j = 0; j < 256; ++j) { cycle_remap [j] = j; } @@ -418,17 +417,17 @@ int plasmadata3 [MAX_PLASMA_COMPLEXITY]; int plasmaroottype; -void SetPlasmaRootType(ScriptMethodParams ¶ms) { +void AGSPalRender::SetPlasmaRootType(ScriptMethodParams ¶ms) { PARAMS1(int, real); if (real) plasmaroottype = 1; else plasmaroottype = 0; } -void GetPlasmaRootType(ScriptMethodParams ¶ms) { +void AGSPalRender::GetPlasmaRootType(ScriptMethodParams ¶ms) { params._result = plasmaroottype; } -void SetPlasmaType(ScriptMethodParams ¶ms) { +void AGSPalRender::SetPlasmaType(ScriptMethodParams ¶ms) { PARAMS5(int, component, int, type, int, data, int, data2, int, data3); if (component >= MAX_PLASMA_COMPLEXITY) engine->AbortGame("Plasma too complex!"); else { @@ -445,7 +444,7 @@ void SetPlasmaType(ScriptMethodParams ¶ms) { //4 = Diagonal Bars (data=width) } -void ResetPlasmaSettings(ScriptMethodParams &) { +void AGSPalRender::ResetPlasmaSettings(ScriptMethodParams &) { int i = 0; while (i < MAX_PLASMA_COMPLEXITY) { plasmatype [i] = 0; @@ -456,7 +455,7 @@ void ResetPlasmaSettings(ScriptMethodParams &) { } } -void DrawPlasma(ScriptMethodParams ¶ms) { +void AGSPalRender::DrawPlasma(ScriptMethodParams ¶ms) { PARAMS3(int, slot, int, palstart, int, palend); BITMAP *plasmaspr = engine->GetSpriteGraphic(slot); if (!plasmaspr) engine->AbortGame("Plasma: Not a sprite I can load."); @@ -505,7 +504,7 @@ void DrawPlasma(ScriptMethodParams ¶ms) { engine->NotifySpriteUpdated(slot); } -void DoFire(ScriptMethodParams ¶ms) { +void AGSPalRender::DoFire(ScriptMethodParams ¶ms) { PARAMS8(int, spriteId, int, masksprite, int, palstart, int, palend, int, strength, int, seed, int, cutoff, int, windspeed); BITMAP *firespr = engine->GetSpriteGraphic(masksprite); BITMAP *firecolorspr = engine->GetSpriteGraphic(spriteId); @@ -649,7 +648,7 @@ unsigned char MixColorAdditive (unsigned char fg,unsigned char bg,unsigned char return result; } */ -void GetColor565(ScriptMethodParams ¶ms) { +void AGSPalRender::GetColor565(ScriptMethodParams ¶ms) { PARAMS3(unsigned char, r, unsigned char, g, unsigned char, b); //BITMAP *clutspr = engine->GetSpriteGraphic (clutslot); //if (!clutspr) engine->AbortGame ("MixColorAlpha: Can't load CLUT sprite into memory."); @@ -662,7 +661,7 @@ void GetColor565(ScriptMethodParams ¶ms) { params._result = (int)result; } -void CycleRemap(ScriptMethodParams ¶ms) { +void AGSPalRender::CycleRemap(ScriptMethodParams ¶ms) { PARAMS2(int, start, int, end); if (end > start) { // Rotate left @@ -682,12 +681,12 @@ void CycleRemap(ScriptMethodParams ¶ms) { } } -void GetRemappedSlot(ScriptMethodParams ¶ms) { +void AGSPalRender::GetRemappedSlot(ScriptMethodParams ¶ms) { PARAMS1(unsigned char, slot); params._result = cycle_remap [slot]; } -void LoadCLUT(ScriptMethodParams ¶ms) { +void AGSPalRender::LoadCLUT(ScriptMethodParams ¶ms) { PARAMS1(int, slot); if (engine->GetSpriteWidth(slot) != 256 || engine->GetSpriteHeight(slot) != 256) { params._result = 1; @@ -706,16 +705,16 @@ void LoadCLUT(ScriptMethodParams ¶ms) { params._result = 0; } -void SetReflections(ScriptMethodParams ¶ms) { +void AGSPalRender::SetReflections(ScriptMethodParams ¶ms) { PARAMS1(int, toggle); drawreflections = toggle; } -void IsReflectionsOn(ScriptMethodParams ¶ms) { +void AGSPalRender::IsReflectionsOn(ScriptMethodParams ¶ms) { params._result = drawreflections; } -void GetLuminosityFromPalette(ScriptMethodParams ¶ms) { +void AGSPalRender::GetLuminosityFromPalette(ScriptMethodParams ¶ms) { PARAMS1(int, slot); AGSColor *pal = engine->GetPalette(); int lum = (pal[slot].r + @@ -731,12 +730,12 @@ void GetLuminosityFromPalette(ScriptMethodParams ¶ms) { -void SetStarsOriginPoint(ScriptMethodParams ¶ms) { +void AGSPalRender::SetStarsOriginPoint(ScriptMethodParams ¶ms) { PARAMS2(int, x, int, y); Starfield.originx = x; Starfield.originy = y; } -void InitializeStars(ScriptMethodParams ¶ms) { +void AGSPalRender::InitializeStars(ScriptMethodParams ¶ms) { PARAMS2(int, slot, int, maxstars); int32 sw, sh = 0; BITMAP *canvas = engine->GetSpriteGraphic(slot); @@ -756,7 +755,7 @@ void InitializeStars(ScriptMethodParams ¶ms) { } } -void IterateStars(ScriptMethodParams ¶ms) { +void AGSPalRender::IterateStars(ScriptMethodParams ¶ms) { PARAMS1(int, slot); long sw, sh = 0; sw = engine->GetSpriteWidth(slot); @@ -777,56 +776,56 @@ void IterateStars(ScriptMethodParams ¶ms) { } } } -void GetStarfieldOverscan(ScriptMethodParams ¶ms) { +void AGSPalRender::GetStarfieldOverscan(ScriptMethodParams ¶ms) { params._result = Starfield.overscan; } -void SetStarfieldOverscan(ScriptMethodParams ¶ms) { +void AGSPalRender::SetStarfieldOverscan(ScriptMethodParams ¶ms) { PARAMS1(int, overscan); Starfield.overscan = overscan; } -void GetStarfieldOriginX(ScriptMethodParams ¶ms) { +void AGSPalRender::GetStarfieldOriginX(ScriptMethodParams ¶ms) { params._result = Starfield.originx; } -void GetStarfieldOriginY(ScriptMethodParams ¶ms) { +void AGSPalRender::GetStarfieldOriginY(ScriptMethodParams ¶ms) { params._result = Starfield.originy; } -void SetStarfieldDepthMultiplier(ScriptMethodParams ¶ms) { +void AGSPalRender::SetStarfieldDepthMultiplier(ScriptMethodParams ¶ms) { PARAMS1(int, multi); Starfield.depthmultiplier = multi; } -void GetStarfieldDepthMultiplier(ScriptMethodParams ¶ms) { +void AGSPalRender::GetStarfieldDepthMultiplier(ScriptMethodParams ¶ms) { params._result = Starfield.depthmultiplier; } -void GetStarfieldMaxStars(ScriptMethodParams ¶ms) { +void AGSPalRender::GetStarfieldMaxStars(ScriptMethodParams ¶ms) { params._result = Starfield.maxstars; } -void SetStarSpriteScaleBoost(ScriptMethodParams ¶ms) { +void AGSPalRender::SetStarSpriteScaleBoost(ScriptMethodParams ¶ms) { PARAMS2(int, star, int, boost); stars[star].scaleboost = boost; } -void GetStarSpriteScaleBoost(ScriptMethodParams ¶ms) { +void AGSPalRender::GetStarSpriteScaleBoost(ScriptMethodParams ¶ms) { PARAMS1(int, star); params._result = stars[star].scaleboost; } -void SetStarMaxRadius(ScriptMethodParams ¶ms) { +void AGSPalRender::SetStarMaxRadius(ScriptMethodParams ¶ms) { PARAMS2(int, star, int, radius); stars[star].maxrad = radius; } -void GetStarMaxRadius(ScriptMethodParams ¶ms) { +void AGSPalRender::GetStarMaxRadius(ScriptMethodParams ¶ms) { PARAMS1(int, star); params._result = stars[star].maxrad; } -void RotateStar(ScriptMethodParams ¶ms) { +void AGSPalRender::RotateStar(ScriptMethodParams ¶ms) { PARAMS4(int, star, int, angle, int, px, int, py); float rsin = rot_sine_LUT[angle]; float rcos = rot_cos_LUT[angle]; @@ -843,25 +842,25 @@ void RotateStar(ScriptMethodParams ¶ms) { i++; } -void GetStarX(ScriptMethodParams ¶ms) { +void AGSPalRender::GetStarX(ScriptMethodParams ¶ms) { PARAMS1(int, i); float starx = (float)stars[i].x; params._result = PARAM_FROM_FLOAT(starx); } -void GetStarY(ScriptMethodParams ¶ms) { +void AGSPalRender::GetStarY(ScriptMethodParams ¶ms) { PARAMS1(int, i); float stary = (float)stars[i].y; params._result = PARAM_FROM_FLOAT(stary); } -void GetStarZ(ScriptMethodParams ¶ms) { +void AGSPalRender::GetStarZ(ScriptMethodParams ¶ms) { PARAMS1(int, i); float starz = (float)stars[i].z; params._result = PARAM_FROM_FLOAT(starz); } -void SetStarPosition(ScriptMethodParams ¶ms) { +void AGSPalRender::SetStarPosition(ScriptMethodParams ¶ms) { PARAMS4(int, star, int32, xi, int32, yi, int32, zi); float x = PARAM_TO_FLOAT(xi); float y = PARAM_TO_FLOAT(yi); @@ -871,27 +870,27 @@ void SetStarPosition(ScriptMethodParams ¶ms) { stars[star].z = z; } -void SetStarColor(ScriptMethodParams ¶ms) { +void AGSPalRender::SetStarColor(ScriptMethodParams ¶ms) { PARAMS2(int, star, unsigned char, color); stars[star].color = color; } -void GetStarColor(ScriptMethodParams ¶ms) { +void AGSPalRender::GetStarColor(ScriptMethodParams ¶ms) { PARAMS1(int, star); params._result = (int)stars[star].color; } -void SetStarSprite(ScriptMethodParams ¶ms) { +void AGSPalRender::SetStarSprite(ScriptMethodParams ¶ms) { PARAMS2(int, star, int, slot); stars[star].sprite = slot; } -void GetStarSprite(ScriptMethodParams ¶ms) { +void AGSPalRender::GetStarSprite(ScriptMethodParams ¶ms) { PARAMS1(int, star); params._result = stars[star].sprite; } -void SetStarSpriteRange(ScriptMethodParams ¶ms) { +void AGSPalRender::SetStarSpriteRange(ScriptMethodParams ¶ms) { PARAMS3(int, start, int, end, int, slot); int sfix = start; int efix = end; @@ -901,7 +900,7 @@ void SetStarSpriteRange(ScriptMethodParams ¶ms) { stars[i].sprite = slot; } -void DrawStars(ScriptMethodParams ¶ms) { +void AGSPalRender::DrawStars(ScriptMethodParams ¶ms) { PARAMS2(int, slot, int, maskslot); int32 sw, sh = 0; BITMAP *canvas = engine->GetSpriteGraphic(slot); @@ -1082,7 +1081,7 @@ void DrawStars(ScriptMethodParams ¶ms) { } -void CreateTranslucentOverlay(ScriptMethodParams ¶ms) { +void AGSPalRender::CreateTranslucentOverlay(ScriptMethodParams ¶ms) { PARAMS6(int, id, int, spriteId, int, alpha, int, level, int, ox, int, oy); int mask = 0, blendmode = 0; if (params.size() > 6) @@ -1103,7 +1102,7 @@ void CreateTranslucentOverlay(ScriptMethodParams ¶ms) { params._result = 0; } -void DeleteTranslucentOverlay(ScriptMethodParams ¶ms) { +void AGSPalRender::DeleteTranslucentOverlay(ScriptMethodParams ¶ms) { PARAMS1(int, id); overlay[id].enabled = false; overlay[id].sprite = 0; @@ -1114,44 +1113,44 @@ void DeleteTranslucentOverlay(ScriptMethodParams ¶ms) { params._result = 0; } -void MoveTranslucentOverlay(ScriptMethodParams ¶ms) { +void AGSPalRender::MoveTranslucentOverlay(ScriptMethodParams ¶ms) { PARAMS3(int, id, int, ox, int, oy); overlay[id].x = ox; overlay[id].y = oy; params._result = 0; } -void GetTranslucentOverlayX(ScriptMethodParams ¶ms) { +void AGSPalRender::GetTranslucentOverlayX(ScriptMethodParams ¶ms) { PARAMS1(int, id); params._result = overlay[id].x; } -void GetTranslucentOverlayY(ScriptMethodParams ¶ms) { +void AGSPalRender::GetTranslucentOverlayY(ScriptMethodParams ¶ms) { PARAMS1(int, id); params._result = overlay[id].y; } -void GetTranslucentOverlaySprite(ScriptMethodParams ¶ms) { +void AGSPalRender::GetTranslucentOverlaySprite(ScriptMethodParams ¶ms) { PARAMS1(int, id); params._result = overlay[id].sprite; } -void GetTranslucentOverlayLevel(ScriptMethodParams ¶ms) { +void AGSPalRender::GetTranslucentOverlayLevel(ScriptMethodParams ¶ms) { PARAMS1(int, id); params._result = overlay[id].level; } -void GetTranslucentOverlayEnabled(ScriptMethodParams ¶ms) { +void AGSPalRender::GetTranslucentOverlayEnabled(ScriptMethodParams ¶ms) { PARAMS1(int, id); params._result = overlay[id].enabled; } -void GetTranslucentOverlayAlpha(ScriptMethodParams ¶ms) { +void AGSPalRender::GetTranslucentOverlayAlpha(ScriptMethodParams ¶ms) { PARAMS1(int, id); params._result = overlay[id].trans; } -void SetTranslucentOverlayAlpha(ScriptMethodParams ¶ms) { +void AGSPalRender::SetTranslucentOverlayAlpha(ScriptMethodParams ¶ms) { PARAMS2(int, id, int, alpha); if (alpha >= 0 && alpha < 256) overlay[id].trans = alpha; @@ -1160,7 +1159,7 @@ void SetTranslucentOverlayAlpha(ScriptMethodParams ¶ms) { params._result = 0; } -void SetTranslucentOverlayEnabled(ScriptMethodParams ¶ms) { +void AGSPalRender::SetTranslucentOverlayEnabled(ScriptMethodParams ¶ms) { PARAMS2(int, id, int, toggle); if (toggle > 0) overlay[id].enabled = true; @@ -1169,13 +1168,13 @@ void SetTranslucentOverlayEnabled(ScriptMethodParams ¶ms) { params._result = 0; } -void SetCharacterReflected(ScriptMethodParams ¶ms) { +void AGSPalRender::SetCharacterReflected(ScriptMethodParams ¶ms) { PARAMS2(int, id, int, refl); if (refl > 0) Reflection.Characters[id].reflect = 1; else Reflection.Characters[id].reflect = 0; } -void SetObjectReflected(ScriptMethodParams ¶ms) { +void AGSPalRender::SetObjectReflected(ScriptMethodParams ¶ms) { PARAMS2(int, id, int, refl); if (refl > 0) Reflection.Objects[id].reflect = 1; @@ -1183,22 +1182,22 @@ void SetObjectReflected(ScriptMethodParams ¶ms) { Reflection.Objects[id].reflect = 0; } -void GetCharacterReflected(ScriptMethodParams ¶ms) { +void AGSPalRender::GetCharacterReflected(ScriptMethodParams ¶ms) { PARAMS1(int, id); params._result = Reflection.Characters[id].reflect; } -void GetObjectReflected(ScriptMethodParams ¶ms) { +void AGSPalRender::GetObjectReflected(ScriptMethodParams ¶ms) { PARAMS1(int, id); params._result = Reflection.Objects[id].reflect; } -void ReplaceCharacterReflectionView(ScriptMethodParams ¶ms) { +void AGSPalRender::ReplaceCharacterReflectionView(ScriptMethodParams ¶ms) { PARAMS2(int, id, int, view); Reflection.Characters[id].replaceview = view - 1; } -void SetObjectReflectionIgnoreScaling(ScriptMethodParams ¶ms) { +void AGSPalRender::SetObjectReflectionIgnoreScaling(ScriptMethodParams ¶ms) { PARAMS2(int, id, int, wb); if (wb) Reflection.Objects[id].ignorescaling = 1; else Reflection.Objects[id].ignorescaling = 0; @@ -1370,7 +1369,7 @@ int DrawReflections(int id, int charobj = 0) { } -void DrawTransSprite(ScriptMethodParams ¶ms) { +void AGSPalRender::DrawTransSprite(ScriptMethodParams ¶ms) { PARAMS3(int, spriteId, int, bg, int, translevel); int mask = 0, blendmode = 0, use_objpal = 0; if (params.size() > 3) @@ -1511,189 +1510,185 @@ int DrawTranslucentOverlay(int spriteId, int translevel, int ox, int oy, int mas /*------------------------------------------------------------------*/ -AGSPalRender::AGSPalRender() : PluginBase() { - DLL_METHOD(AGS_GetPluginName); - DLL_METHOD(AGS_EngineStartup); - DLL_METHOD(AGS_EngineShutdown); - DLL_METHOD(AGS_EngineOnEvent); -} - const char *AGSPalRender::AGS_GetPluginName() { return "PALgorithms Translucent Overlay Renderer"; } void AGSPalRender::AGS_EngineStartup(IAGSEngine *lpEngine) { + PluginBase::AGS_EngineStartup(lpEngine); engine = lpEngine; // Make sure it's got the version with the features we need if (engine->version < 3) { engine->AbortGame("Engine interface is too old, need newer version of AGS."); } - engine->RegisterScriptFunction("PALInternal::LoadCLUT^1", (void *)LoadCLUT); - engine->RegisterScriptFunction("PALInternal::CycleRemap^2", (void *)CycleRemap); - engine->RegisterScriptFunction("PALInternal::GetColor565^3", (void *)GetColor565); - engine->RegisterScriptFunction("PALInternal::GetLuminosityFromPalette^1", (void *)GetLuminosityFromPalette); - engine->RegisterScriptFunction("PALInternal::FastSin^1", (void *)AGSFastSin); - engine->RegisterScriptFunction("PALInternal::FastCos^1", (void *)AGSFastCos); - engine->RegisterScriptFunction("PALInternal::FastRoot^1", (void *)AGSFastRoot); - engine->RegisterScriptFunction("PALInternal::GetRemappedSlot^1", (void *)GetRemappedSlot); - engine->RegisterScriptFunction("PALInternal::ResetRemapping^0", (void *)ResetRemapping); - engine->RegisterScriptFunction("PALInternal::GetModifiedBackgroundImage", (void *)GetModifiedBackgroundImage); - engine->RegisterScriptFunction("PALInternal::WriteObjectivePalette^4", (void *)WriteObjectivePalette); - engine->RegisterScriptFunction("PALInternal::ReadObjectivePaletteR^1", (void *)ReadObjectivePaletteR); - engine->RegisterScriptFunction("PALInternal::ReadObjectivePaletteB^1", (void *)ReadObjectivePaletteB); - engine->RegisterScriptFunction("PALInternal::ReadObjectivePaletteG^1", (void *)ReadObjectivePaletteG); - engine->RegisterScriptFunction("Raycast::Render^1", (void *)Raycast_Render); - engine->RegisterScriptFunction("Raycast::LoadMap^4", (void *)LoadMap); - engine->RegisterScriptFunction("Raycast::Initialize", (void *)Init_Raycaster); - engine->RegisterScriptFunction("Raycast::MakeTextures^1", (void *)MakeTextures); - engine->RegisterScriptFunction("Raycast::MoveForward^0", (void *)MoveForward); - engine->RegisterScriptFunction("Raycast::MoveBackward^0", (void *)MoveBackward); - engine->RegisterScriptFunction("Raycast::RotateLeft^0", (void *)RotateLeft); - engine->RegisterScriptFunction("Raycast::RotateRight^0", (void *)RotateRight); - engine->RegisterScriptFunction("Raycast::SetCameraPosition^2", (void *)Ray_SetPlayerPosition); - engine->RegisterScriptFunction("Raycast::GetCameraX^0", (void *)Ray_GetPlayerX); - engine->RegisterScriptFunction("Raycast::GetCameraY^0", (void *)Ray_GetPlayerY); - engine->RegisterScriptFunction("Raycast::GetCameraAngle^0", (void *)Ray_GetPlayerAngle); - engine->RegisterScriptFunction("Raycast::SetCameraAngle^1", (void *)Ray_SetPlayerAngle); - engine->RegisterScriptFunction("Raycast::InitSprite^9", (void *)Ray_InitSprite); - engine->RegisterScriptFunction("Raycast::UnloadEngine^0", (void *)QuitCleanup); - engine->RegisterScriptFunction("Raycast::GetHotspotAtXY^2", (void *)Ray_GetHotspotAt); - engine->RegisterScriptFunction("Raycast::GetObjectAtXY^2", (void *)Ray_GetObjectAt); - engine->RegisterScriptFunction("Raycast::SetSpriteInteractObj^2", (void *)Ray_SetSpriteInteractObj); - engine->RegisterScriptFunction("Raycast::GetSpriteInteractObj^1", (void *)Ray_GetSpriteInteractObj); - engine->RegisterScriptFunction("Raycast::SetSpritePosition^3", (void *)Ray_SetSpritePosition); - engine->RegisterScriptFunction("Raycast::SetSpriteVertOffset^2", (void *)Ray_SetSpriteVertOffset); - engine->RegisterScriptFunction("Raycast::GetSpriteVertOffset^1", (void *)Ray_GetSpriteVertOffset); - engine->RegisterScriptFunction("Raycast::GetSpriteX^1", (void *)Ray_GetSpriteX); - engine->RegisterScriptFunction("Raycast::GetSpriteY^1", (void *)Ray_GetSpriteY); - engine->RegisterScriptFunction("Raycast::SetWallHotspot^2", (void *)Ray_SetWallHotspot); - engine->RegisterScriptFunction("Raycast::SetWallTextures^5", (void *)Ray_SetWallTextures); - engine->RegisterScriptFunction("Raycast::SetWallSolid^5", (void *)Ray_SetWallSolid); - engine->RegisterScriptFunction("Raycast::SetWallIgnoreLighting^5", (void *)Ray_SetWallIgnoreLighting); - engine->RegisterScriptFunction("Raycast::SetWallAlpha^5", (void *)Ray_SetWallAlpha); - engine->RegisterScriptFunction("Raycast::SetWallBlendType^5", (void *)Ray_SetWallBlendType); - engine->RegisterScriptFunction("Raycast::GetMoveSpeed^0", (void *)Ray_GetMoveSpeed); - engine->RegisterScriptFunction("Raycast::SetMoveSpeed^1", (void *)Ray_SetMoveSpeed); - engine->RegisterScriptFunction("Raycast::GetRotSpeed^0", (void *)Ray_GetRotSpeed); - engine->RegisterScriptFunction("Raycast::SetRotSpeed^1", (void *)Ray_SetRotSpeed); - engine->RegisterScriptFunction("Raycast::GetWallAt^2", (void *)Ray_GetWallAt); - engine->RegisterScriptFunction("Raycast::GetLightAt^2", (void *)Ray_GetLightAt); - engine->RegisterScriptFunction("Raycast::SetLightAt^3", (void *)Ray_SetLightAt); - engine->RegisterScriptFunction("Raycast::SetWallAt^3", (void *)Ray_SetWallAt); - engine->RegisterScriptFunction("Raycast::SetPlaneY^1", (void *)Ray_SetPlaneY); - engine->RegisterScriptFunction("Raycast::GetDistanceAt^2", (void *)Ray_GetDistanceAt); - engine->RegisterScriptFunction("Raycast::GetSpriteAngle^1", (void *)Ray_GetSpriteAngle); - engine->RegisterScriptFunction("Raycast::SetSpriteAngle^2", (void *)Ray_SetSpriteAngle); - engine->RegisterScriptFunction("Raycast::SetSpriteView^2", (void *)Ray_SetSpriteView); - engine->RegisterScriptFunction("Raycast::GetSpriteView^1", (void *)Ray_GetSpriteView); - engine->RegisterScriptFunction("Raycast::SetSpriteFrame^2", (void *)Ray_SetSpriteFrame); - engine->RegisterScriptFunction("Raycast::GetSpriteFrame^1", (void *)Ray_GetSpriteFrame); - engine->RegisterScriptFunction("Raycast::SetSpritePic^2", (void *)Ray_SetSpritePic); - engine->RegisterScriptFunction("Raycast::GetSpritePic^1", (void *)Ray_GetSpritePic); - engine->RegisterScriptFunction("Raycast::SetSkyBox^1", (void *)Ray_SetSkyBox); - engine->RegisterScriptFunction("Raycast::SetSpriteAlpha^2", (void *)Ray_SetSpriteAlpha); - engine->RegisterScriptFunction("Raycast::GetSpriteAlpha^1", (void *)Ray_GetSpriteAlpha); - engine->RegisterScriptFunction("Raycast::GetSkyBox^1", (void *)Ray_GetSkyBox); - engine->RegisterScriptFunction("Raycast::SetAmbientLight^1", (void *)Ray_SetAmbientLight); - engine->RegisterScriptFunction("Raycast::SetAmbientColor^2", (void *)Ray_SetAmbientColor); - engine->RegisterScriptFunction("Raycast::GetAmbientLight^0", (void *)Ray_GetAmbientLight); - engine->RegisterScriptFunction("Raycast::GetAmbientWeight^0", (void *)Ray_GetAmbientWeight); - engine->RegisterScriptFunction("Raycast::GetTileX_At^2", (void *)Ray_GetTileX_At); - engine->RegisterScriptFunction("Raycast::GetTileY_At^2", (void *)Ray_GetTileY_At); - engine->RegisterScriptFunction("Raycast::DrawTile^2", (void *)Ray_DrawTile); - engine->RegisterScriptFunction("Raycast::DrawOntoTile^2", (void *)Ray_DrawOntoTile); - engine->RegisterScriptFunction("Raycast::SetNoClip^1", (void *)Ray_SetNoClip); - engine->RegisterScriptFunction("Raycast::GetNoClip^0", (void *)Ray_GetNoClip); - engine->RegisterScriptFunction("Raycast::GetSpriteScaleX^1", (void *)Ray_GetSpriteScaleX); - engine->RegisterScriptFunction("Raycast::SetSpriteScaleX^2", (void *)Ray_SetSpriteScaleX); - engine->RegisterScriptFunction("Raycast::GetSpriteScaleY^1", (void *)Ray_GetSpriteScaleY); - engine->RegisterScriptFunction("Raycast::SetSpriteScaleY^2", (void *)Ray_SetSpriteScaleY); - engine->RegisterScriptFunction("Raycast::GetSpriteBlendType^1", (void *)Ray_GetSpriteBlendType); - engine->RegisterScriptFunction("Raycast::SetSpriteBlendType^2", (void *)Ray_SetSpriteBlendType); + SCRIPT_METHOD(PALInternal::LoadCLUT^1, AGSPalRender::LoadCLUT); + SCRIPT_METHOD(PALInternal::CycleRemap^2, AGSPalRender::CycleRemap); + SCRIPT_METHOD(PALInternal::GetColor565^3, AGSPalRender::GetColor565); + SCRIPT_METHOD(PALInternal::GetLuminosityFromPalette^1, AGSPalRender::GetLuminosityFromPalette); + SCRIPT_METHOD(PALInternal::FastSin^1, AGSPalRender::AGSFastSin); + SCRIPT_METHOD(PALInternal::FastCos^1, AGSPalRender::AGSFastCos); + SCRIPT_METHOD(PALInternal::FastRoot^1, AGSPalRender::AGSFastRoot); + SCRIPT_METHOD(PALInternal::GetRemappedSlot^1, AGSPalRender::GetRemappedSlot); + SCRIPT_METHOD(PALInternal::ResetRemapping^0, AGSPalRender::ResetRemapping); + SCRIPT_METHOD(PALInternal::GetModifiedBackgroundImage, AGSPalRender::GetModifiedBackgroundImage); + SCRIPT_METHOD(PALInternal::WriteObjectivePalette^4, AGSPalRender::WriteObjectivePalette); + SCRIPT_METHOD(PALInternal::ReadObjectivePaletteR^1, AGSPalRender::ReadObjectivePaletteR); + SCRIPT_METHOD(PALInternal::ReadObjectivePaletteB^1, AGSPalRender::ReadObjectivePaletteB); + SCRIPT_METHOD(PALInternal::ReadObjectivePaletteG^1, AGSPalRender::ReadObjectivePaletteG); + + SCRIPT_METHOD(Raycast::Render^1, AGSPalRender::Raycast_Render); + SCRIPT_METHOD(Raycast::LoadMap^4, AGSPalRender::LoadMap); + SCRIPT_METHOD(Raycast::Initialize, AGSPalRender::Init_Raycaster); + SCRIPT_METHOD(Raycast::MakeTextures^1, AGSPalRender::MakeTextures); + SCRIPT_METHOD(Raycast::MoveForward^0, AGSPalRender::MoveForward); + SCRIPT_METHOD(Raycast::MoveBackward^0, AGSPalRender::MoveBackward); + SCRIPT_METHOD(Raycast::RotateLeft^0, AGSPalRender::RotateLeft); + SCRIPT_METHOD(Raycast::RotateRight^0, AGSPalRender::RotateRight); + SCRIPT_METHOD(Raycast::SetCameraPosition^2, AGSPalRender::Ray_SetPlayerPosition); + SCRIPT_METHOD(Raycast::GetCameraX^0, AGSPalRender::Ray_GetPlayerX); + SCRIPT_METHOD(Raycast::GetCameraY^0, AGSPalRender::Ray_GetPlayerY); + SCRIPT_METHOD(Raycast::GetCameraAngle^0, AGSPalRender::Ray_GetPlayerAngle); + SCRIPT_METHOD(Raycast::SetCameraAngle^1, AGSPalRender::Ray_SetPlayerAngle); + SCRIPT_METHOD(Raycast::InitSprite^9, AGSPalRender::Ray_InitSprite); + SCRIPT_METHOD(Raycast::UnloadEngine^0, AGSPalRender::QuitCleanup); + SCRIPT_METHOD(Raycast::GetHotspotAtXY^2, AGSPalRender::Ray_GetHotspotAt); + SCRIPT_METHOD(Raycast::GetObjectAtXY^2, AGSPalRender::Ray_GetObjectAt); + SCRIPT_METHOD(Raycast::SetSpriteInteractObj^2, AGSPalRender::Ray_SetSpriteInteractObj); + SCRIPT_METHOD(Raycast::GetSpriteInteractObj^1, AGSPalRender::Ray_GetSpriteInteractObj); + SCRIPT_METHOD(Raycast::SetSpritePosition^3, AGSPalRender::Ray_SetSpritePosition); + SCRIPT_METHOD(Raycast::SetSpriteVertOffset^2, AGSPalRender::Ray_SetSpriteVertOffset); + SCRIPT_METHOD(Raycast::GetSpriteVertOffset^1, AGSPalRender::Ray_GetSpriteVertOffset); + SCRIPT_METHOD(Raycast::GetSpriteX^1, AGSPalRender::Ray_GetSpriteX); + SCRIPT_METHOD(Raycast::GetSpriteY^1, AGSPalRender::Ray_GetSpriteY); + SCRIPT_METHOD(Raycast::SetWallHotspot^2, AGSPalRender::Ray_SetWallHotspot); + SCRIPT_METHOD(Raycast::SetWallTextures^5, AGSPalRender::Ray_SetWallTextures); + SCRIPT_METHOD(Raycast::SetWallSolid^5, AGSPalRender::Ray_SetWallSolid); + SCRIPT_METHOD(Raycast::SetWallIgnoreLighting^5, AGSPalRender::Ray_SetWallIgnoreLighting); + SCRIPT_METHOD(Raycast::SetWallAlpha^5, AGSPalRender::Ray_SetWallAlpha); + SCRIPT_METHOD(Raycast::SetWallBlendType^5, AGSPalRender::Ray_SetWallBlendType); + SCRIPT_METHOD(Raycast::GetMoveSpeed^0, AGSPalRender::Ray_GetMoveSpeed); + SCRIPT_METHOD(Raycast::SetMoveSpeed^1, AGSPalRender::Ray_SetMoveSpeed); + SCRIPT_METHOD(Raycast::GetRotSpeed^0, AGSPalRender::Ray_GetRotSpeed); + SCRIPT_METHOD(Raycast::SetRotSpeed^1, AGSPalRender::Ray_SetRotSpeed); + SCRIPT_METHOD(Raycast::GetWallAt^2, AGSPalRender::Ray_GetWallAt); + SCRIPT_METHOD(Raycast::GetLightAt^2, AGSPalRender::Ray_GetLightAt); + SCRIPT_METHOD(Raycast::SetLightAt^3, AGSPalRender::Ray_SetLightAt); + SCRIPT_METHOD(Raycast::SetWallAt^3, AGSPalRender::Ray_SetWallAt); + SCRIPT_METHOD(Raycast::SetPlaneY^1, AGSPalRender::Ray_SetPlaneY); + SCRIPT_METHOD(Raycast::GetDistanceAt^2, AGSPalRender::Ray_GetDistanceAt); + SCRIPT_METHOD(Raycast::GetSpriteAngle^1, AGSPalRender::Ray_GetSpriteAngle); + SCRIPT_METHOD(Raycast::SetSpriteAngle^2, AGSPalRender::Ray_SetSpriteAngle); + SCRIPT_METHOD(Raycast::SetSpriteView^2, AGSPalRender::Ray_SetSpriteView); + SCRIPT_METHOD(Raycast::GetSpriteView^1, AGSPalRender::Ray_GetSpriteView); + SCRIPT_METHOD(Raycast::SetSpriteFrame^2, AGSPalRender::Ray_SetSpriteFrame); + SCRIPT_METHOD(Raycast::GetSpriteFrame^1, AGSPalRender::Ray_GetSpriteFrame); + SCRIPT_METHOD(Raycast::SetSpritePic^2, AGSPalRender::Ray_SetSpritePic); + SCRIPT_METHOD(Raycast::GetSpritePic^1, AGSPalRender::Ray_GetSpritePic); + SCRIPT_METHOD(Raycast::SetSkyBox^1, AGSPalRender::Ray_SetSkyBox); + SCRIPT_METHOD(Raycast::SetSpriteAlpha^2, AGSPalRender::Ray_SetSpriteAlpha); + SCRIPT_METHOD(Raycast::GetSpriteAlpha^1, AGSPalRender::Ray_GetSpriteAlpha); + SCRIPT_METHOD(Raycast::GetSkyBox^1, AGSPalRender::Ray_GetSkyBox); + SCRIPT_METHOD(Raycast::SetAmbientLight^1, AGSPalRender::Ray_SetAmbientLight); + SCRIPT_METHOD(Raycast::SetAmbientColor^2, AGSPalRender::Ray_SetAmbientColor); + SCRIPT_METHOD(Raycast::GetAmbientLight^0, AGSPalRender::Ray_GetAmbientLight); + SCRIPT_METHOD(Raycast::GetAmbientWeight^0, AGSPalRender::Ray_GetAmbientWeight); + SCRIPT_METHOD(Raycast::GetTileX_At^2, AGSPalRender::Ray_GetTileX_At); + SCRIPT_METHOD(Raycast::GetTileY_At^2, AGSPalRender::Ray_GetTileY_At); + SCRIPT_METHOD(Raycast::DrawTile^2, AGSPalRender::Ray_DrawTile); + SCRIPT_METHOD(Raycast::DrawOntoTile^2, AGSPalRender::Ray_DrawOntoTile); + SCRIPT_METHOD(Raycast::SetNoClip^1, AGSPalRender::Ray_SetNoClip); + SCRIPT_METHOD(Raycast::GetNoClip^0, AGSPalRender::Ray_GetNoClip); + SCRIPT_METHOD(Raycast::GetSpriteScaleX^1, AGSPalRender::Ray_GetSpriteScaleX); + SCRIPT_METHOD(Raycast::SetSpriteScaleX^2, AGSPalRender::Ray_SetSpriteScaleX); + SCRIPT_METHOD(Raycast::GetSpriteScaleY^1, AGSPalRender::Ray_GetSpriteScaleY); + SCRIPT_METHOD(Raycast::SetSpriteScaleY^2, AGSPalRender::Ray_SetSpriteScaleY); + SCRIPT_METHOD(Raycast::GetSpriteBlendType^1, AGSPalRender::Ray_GetSpriteBlendType); + SCRIPT_METHOD(Raycast::SetSpriteBlendType^2, AGSPalRender::Ray_SetSpriteBlendType); - engine->RegisterScriptFunction("Raycast::SetFloorAt^3", (void *)Ray_SetFloorAt); - engine->RegisterScriptFunction("Raycast::SetCeilingAt^3", (void *)Ray_SetCeilingAt); - engine->RegisterScriptFunction("Raycast::GetCeilingAt^2", (void *)Ray_GetCeilingAt); - engine->RegisterScriptFunction("Raycast::GetFloorAt^2", (void *)Ray_GetFloorAt); - engine->RegisterScriptFunction("Raycast::GetLightingAt^2", (void *)Ray_GetLightingAt); - engine->RegisterScriptFunction("Raycast::SetLightingAt^3", (void *)Ray_SetLightingAt); - engine->RegisterScriptFunction("Raycast::GetWallHotspot^1", (void *)Ray_GetWallHotspot); - engine->RegisterScriptFunction("Raycast::GetWallTexture^2", (void *)Ray_GetWallTexture); - engine->RegisterScriptFunction("Raycast::GetWallSolid^2", (void *)Ray_GetWallSolid); - engine->RegisterScriptFunction("Raycast::GetWallIgnoreLighting^2", (void *)Ray_GetWallIgnoreLighting); - engine->RegisterScriptFunction("Raycast::GetWallAlpha^2", (void *)Ray_GetWallAlpha); - engine->RegisterScriptFunction("Raycast::GetWallBlendType^2", (void *)Ray_GetWallBlendType); - engine->RegisterScriptFunction("Raycast::SelectTile^3", (void *)Ray_SelectTile); - engine->RegisterScriptFunction("Raycast::HasSeenTile^2", (void *)Ray_HasSeenTile); + SCRIPT_METHOD(Raycast::SetFloorAt^3, AGSPalRender::Ray_SetFloorAt); + SCRIPT_METHOD(Raycast::SetCeilingAt^3, AGSPalRender::Ray_SetCeilingAt); + SCRIPT_METHOD(Raycast::GetCeilingAt^2, AGSPalRender::Ray_GetCeilingAt); + SCRIPT_METHOD(Raycast::GetFloorAt^2, AGSPalRender::Ray_GetFloorAt); + SCRIPT_METHOD(Raycast::GetLightingAt^2, AGSPalRender::Ray_GetLightingAt); + SCRIPT_METHOD(Raycast::SetLightingAt^3, AGSPalRender::Ray_SetLightingAt); + SCRIPT_METHOD(Raycast::GetWallHotspot^1, AGSPalRender::Ray_GetWallHotspot); + SCRIPT_METHOD(Raycast::GetWallTexture^2, AGSPalRender::Ray_GetWallTexture); + SCRIPT_METHOD(Raycast::GetWallSolid^2, AGSPalRender::Ray_GetWallSolid); + SCRIPT_METHOD(Raycast::GetWallIgnoreLighting^2, AGSPalRender::Ray_GetWallIgnoreLighting); + SCRIPT_METHOD(Raycast::GetWallAlpha^2, AGSPalRender::Ray_GetWallAlpha); + SCRIPT_METHOD(Raycast::GetWallBlendType^2, AGSPalRender::Ray_GetWallBlendType); + SCRIPT_METHOD(Raycast::SelectTile^3, AGSPalRender::Ray_SelectTile); + SCRIPT_METHOD(Raycast::HasSeenTile^2, AGSPalRender::Ray_HasSeenTile); - engine->RegisterScriptFunction("LensDistort::SetPos^2", (void *)SetLensPos); - engine->RegisterScriptFunction("LensDistort::GetX^0", (void *)GetLensX); - engine->RegisterScriptFunction("LensDistort::GetY^0", (void *)GetLensY); - engine->RegisterScriptFunction("LensDistort::Set^1", (void *)SetLensDrawn); - engine->RegisterScriptFunction("LensDistort::IsDrawn^0", (void *)GetLensDrawn); - engine->RegisterScriptFunction("LensDistort::SetOffsetClamp^1", (void *)SetLensOffsetClamp); - engine->RegisterScriptFunction("LensDistort::GetOffsetClamp^0", (void *)GetLensOffsetClamp); - engine->RegisterScriptFunction("LensDistort::GetLevel^0", (void *)GetLensLevel); - engine->RegisterScriptFunction("LensDistort::SetLevel^1", (void *)SetLensLevel); - engine->RegisterScriptFunction("LensDistort::Initialize^6", (void *)LensInitialize); + SCRIPT_METHOD(LensDistort::SetPos^2, AGSPalRender::SetLensPos); + SCRIPT_METHOD(LensDistort::GetX^0, AGSPalRender::GetLensX); + SCRIPT_METHOD(LensDistort::GetY^0, AGSPalRender::GetLensY); + SCRIPT_METHOD(LensDistort::Set^1, AGSPalRender::SetLensDrawn); + SCRIPT_METHOD(LensDistort::IsDrawn^0, AGSPalRender::GetLensDrawn); + SCRIPT_METHOD(LensDistort::SetOffsetClamp^1, AGSPalRender::SetLensOffsetClamp); + SCRIPT_METHOD(LensDistort::GetOffsetClamp^0, AGSPalRender::GetLensOffsetClamp); + SCRIPT_METHOD(LensDistort::GetLevel^0, AGSPalRender::GetLensLevel); + SCRIPT_METHOD(LensDistort::SetLevel^1, AGSPalRender::SetLensLevel); + SCRIPT_METHOD(LensDistort::Initialize^6, AGSPalRender::LensInitialize); - engine->RegisterScriptFunction("Translucence::CreateOverlay^8", (void *)CreateTranslucentOverlay); - engine->RegisterScriptFunction("Translucence::DeleteOverlay^1", (void *)DeleteTranslucentOverlay); - engine->RegisterScriptFunction("Translucence::Move^3", (void *)MoveTranslucentOverlay); - engine->RegisterScriptFunction("Translucence::GetOverlayX^1", (void *)GetTranslucentOverlayX); - engine->RegisterScriptFunction("Translucence::GetOverlayY^1", (void *)GetTranslucentOverlayY); - engine->RegisterScriptFunction("Translucence::GetOverlaySprite^1", (void *)GetTranslucentOverlaySprite); - engine->RegisterScriptFunction("Translucence::GetOverlayLevel^1", (void *)GetTranslucentOverlayLevel); - engine->RegisterScriptFunction("Translucence::GetOverlayEnabled^1", (void *)GetTranslucentOverlayEnabled); - engine->RegisterScriptFunction("Translucence::GetOverlayAlpha^1", (void *)GetTranslucentOverlayAlpha); - engine->RegisterScriptFunction("Translucence::SetOverlayAlpha^2", (void *)SetTranslucentOverlayAlpha); - engine->RegisterScriptFunction("Translucence::SetOverlayEnabled^2", (void *)SetTranslucentOverlayEnabled); - engine->RegisterScriptFunction("Translucence::DrawTransSprite^6", (void *)DrawTransSprite); + SCRIPT_METHOD(Translucence::CreateOverlay^8, AGSPalRender::CreateTranslucentOverlay); + SCRIPT_METHOD(Translucence::DeleteOverlay^1, AGSPalRender::DeleteTranslucentOverlay); + SCRIPT_METHOD(Translucence::Move^3, AGSPalRender::MoveTranslucentOverlay); + SCRIPT_METHOD(Translucence::GetOverlayX^1, AGSPalRender::GetTranslucentOverlayX); + SCRIPT_METHOD(Translucence::GetOverlayY^1, AGSPalRender::GetTranslucentOverlayY); + SCRIPT_METHOD(Translucence::GetOverlaySprite^1, AGSPalRender::GetTranslucentOverlaySprite); + SCRIPT_METHOD(Translucence::GetOverlayLevel^1, AGSPalRender::GetTranslucentOverlayLevel); + SCRIPT_METHOD(Translucence::GetOverlayEnabled^1, AGSPalRender::GetTranslucentOverlayEnabled); + SCRIPT_METHOD(Translucence::GetOverlayAlpha^1, AGSPalRender::GetTranslucentOverlayAlpha); + SCRIPT_METHOD(Translucence::SetOverlayAlpha^2, AGSPalRender::SetTranslucentOverlayAlpha); + SCRIPT_METHOD(Translucence::SetOverlayEnabled^2, AGSPalRender::SetTranslucentOverlayEnabled); + SCRIPT_METHOD(Translucence::DrawTransSprite^6, AGSPalRender::DrawTransSprite); - engine->RegisterScriptFunction("Starfield::GetOverscan^0", (void *)GetStarfieldOverscan); - engine->RegisterScriptFunction("Starfield::SetOverscan^1", (void *)SetStarfieldOverscan); - engine->RegisterScriptFunction("Starfield::GetOriginX^0", (void *)GetStarfieldOriginX); - engine->RegisterScriptFunction("Starfield::GetOriginY^0", (void *)GetStarfieldOriginY); - engine->RegisterScriptFunction("Starfield::SetDepthMultiplier^1", (void *)SetStarfieldDepthMultiplier); - engine->RegisterScriptFunction("Starfield::GetDepthMultiplier^0", (void *)GetStarfieldDepthMultiplier); - engine->RegisterScriptFunction("Starfield::GetMaxStars^0", (void *)GetStarfieldMaxStars); - engine->RegisterScriptFunction("Starfield::SetStarSpriteScaleBoost^1", (void *)SetStarSpriteScaleBoost); - engine->RegisterScriptFunction("Starfield::GetStarSpriteScaleBoost^0", (void *)GetStarSpriteScaleBoost); - engine->RegisterScriptFunction("Starfield::SetStarMaxRadius^2", (void *)SetStarMaxRadius); - engine->RegisterScriptFunction("Starfield::GetStarMaxRadius^0", (void *)GetStarMaxRadius); - engine->RegisterScriptFunction("Starfield::GetStarX^1", (void *)GetStarX); - engine->RegisterScriptFunction("Starfield::GetStarY^1", (void *)GetStarY); - engine->RegisterScriptFunction("Starfield::GetStarZ^1", (void *)GetStarZ); - engine->RegisterScriptFunction("Starfield::SetStarPosition^4", (void *)SetStarPosition); - engine->RegisterScriptFunction("Starfield::RotateStar^4", (void *)RotateStar); - engine->RegisterScriptFunction("Starfield::SetStarColor^2", (void *)SetStarColor); - engine->RegisterScriptFunction("Starfield::GetStarColor^1", (void *)GetStarColor); - engine->RegisterScriptFunction("Starfield::SetStarSprite^2", (void *)SetStarSprite); - engine->RegisterScriptFunction("Starfield::GetStarSprite^1", (void *)GetStarSprite); - engine->RegisterScriptFunction("Starfield::SetStarSpriteRange^3", (void *)SetStarSpriteRange); - engine->RegisterScriptFunction("Starfield::Initialize^2", (void *)InitializeStars); - engine->RegisterScriptFunction("Starfield::Iterate^1", (void *)IterateStars); - engine->RegisterScriptFunction("Starfield::Draw^2", (void *)DrawStars); - engine->RegisterScriptFunction("Starfield::SetOriginPoint^2", (void *)SetStarsOriginPoint); + SCRIPT_METHOD(Starfield::GetOverscan^0, AGSPalRender::GetStarfieldOverscan); + SCRIPT_METHOD(Starfield::SetOverscan^1, AGSPalRender::SetStarfieldOverscan); + SCRIPT_METHOD(Starfield::GetOriginX^0, AGSPalRender::GetStarfieldOriginX); + SCRIPT_METHOD(Starfield::GetOriginY^0, AGSPalRender::GetStarfieldOriginY); + SCRIPT_METHOD(Starfield::SetDepthMultiplier^1, AGSPalRender::SetStarfieldDepthMultiplier); + SCRIPT_METHOD(Starfield::GetDepthMultiplier^0, AGSPalRender::GetStarfieldDepthMultiplier); + SCRIPT_METHOD(Starfield::GetMaxStars^0, AGSPalRender::GetStarfieldMaxStars); + SCRIPT_METHOD(Starfield::SetStarSpriteScaleBoost^1, AGSPalRender::SetStarSpriteScaleBoost); + SCRIPT_METHOD(Starfield::GetStarSpriteScaleBoost^0, AGSPalRender::GetStarSpriteScaleBoost); + SCRIPT_METHOD(Starfield::SetStarMaxRadius^2, AGSPalRender::SetStarMaxRadius); + SCRIPT_METHOD(Starfield::GetStarMaxRadius^0, AGSPalRender::GetStarMaxRadius); + SCRIPT_METHOD(Starfield::GetStarX^1, AGSPalRender::GetStarX); + SCRIPT_METHOD(Starfield::GetStarY^1, AGSPalRender::GetStarY); + SCRIPT_METHOD(Starfield::GetStarZ^1, AGSPalRender::GetStarZ); + SCRIPT_METHOD(Starfield::SetStarPosition^4, AGSPalRender::SetStarPosition); + SCRIPT_METHOD(Starfield::RotateStar^4, AGSPalRender::RotateStar); + SCRIPT_METHOD(Starfield::SetStarColor^2, AGSPalRender::SetStarColor); + SCRIPT_METHOD(Starfield::GetStarColor^1, AGSPalRender::GetStarColor); + SCRIPT_METHOD(Starfield::SetStarSprite^2, AGSPalRender::SetStarSprite); + SCRIPT_METHOD(Starfield::GetStarSprite^1, AGSPalRender::GetStarSprite); + SCRIPT_METHOD(Starfield::SetStarSpriteRange^3, AGSPalRender::SetStarSpriteRange); + SCRIPT_METHOD(Starfield::Initialize^2, AGSPalRender::InitializeStars); + SCRIPT_METHOD(Starfield::Iterate^1, AGSPalRender::IterateStars); + SCRIPT_METHOD(Starfield::Draw^2, AGSPalRender::DrawStars); + SCRIPT_METHOD(Starfield::SetOriginPoint^2, AGSPalRender::SetStarsOriginPoint); - engine->RegisterScriptFunction("Plasma::DoFire^8", (void *)DoFire); - engine->RegisterScriptFunction("Plasma::SetPlasmaType^5", (void *)SetPlasmaType); - engine->RegisterScriptFunction("Plasma::ResetPlasmaSettings^0", (void *)ResetPlasmaSettings); - engine->RegisterScriptFunction("Plasma::DrawPlasma^3", (void *)DrawPlasma); - engine->RegisterScriptFunction("Plasma::SetRootType^1", (void *)SetPlasmaRootType); - engine->RegisterScriptFunction("Plasma::GetRootType^0", (void *)GetPlasmaRootType); + SCRIPT_METHOD(Plasma::DoFire^8, AGSPalRender::DoFire); + SCRIPT_METHOD(Plasma::SetPlasmaType^5, AGSPalRender::SetPlasmaType); + SCRIPT_METHOD(Plasma::ResetPlasmaSettings^0, AGSPalRender::ResetPlasmaSettings); + SCRIPT_METHOD(Plasma::DrawPlasma^3, AGSPalRender::DrawPlasma); + SCRIPT_METHOD(Plasma::SetRootType^1, AGSPalRender::SetPlasmaRootType); + SCRIPT_METHOD(Plasma::GetRootType^0, AGSPalRender::GetPlasmaRootType); + + SCRIPT_METHOD(Reflections::Set^1, AGSPalRender::SetReflections); + SCRIPT_METHOD(Reflections::IsReflecting^0, AGSPalRender::IsReflectionsOn); + SCRIPT_METHOD(Reflections::SetCharacterReflected^2, AGSPalRender::SetCharacterReflected); + SCRIPT_METHOD(Reflections::GetCharacterReflected^1, AGSPalRender::GetCharacterReflected); + SCRIPT_METHOD(Reflections::SetObjectReflected^2, AGSPalRender::SetObjectReflected); + SCRIPT_METHOD(Reflections::GetObjectReflected^1, AGSPalRender::GetObjectReflected); + SCRIPT_METHOD(Reflections::ReplaceCharacterReflectionView^2, AGSPalRender::ReplaceCharacterReflectionView); + SCRIPT_METHOD(Reflections::SetObjectReflectionIgnoreScaling^2, AGSPalRender::SetObjectReflectionIgnoreScaling); - engine->RegisterScriptFunction("Reflections::Set^1", (void *)SetReflections); - engine->RegisterScriptFunction("Reflections::IsReflecting^0", (void *)IsReflectionsOn); - engine->RegisterScriptFunction("Reflections::SetCharacterReflected^2", (void *)SetCharacterReflected); - engine->RegisterScriptFunction("Reflections::GetCharacterReflected^1", (void *)GetCharacterReflected); - engine->RegisterScriptFunction("Reflections::SetObjectReflected^2", (void *)SetObjectReflected); - engine->RegisterScriptFunction("Reflections::GetObjectReflected^1", (void *)GetObjectReflected); - engine->RegisterScriptFunction("Reflections::ReplaceCharacterReflectionView^2", (void *)ReplaceCharacterReflectionView); - engine->RegisterScriptFunction("Reflections::SetObjectReflectionIgnoreScaling^2", (void *)SetObjectReflectionIgnoreScaling); engine->RequestEventHook(AGSE_PRESCREENDRAW); engine->RequestEventHook(AGSE_PREGUIDRAW); engine->RequestEventHook(AGSE_POSTSCREENDRAW); diff --git a/engines/ags/plugins/ags_pal_render/ags_pal_render.h b/engines/ags/plugins/ags_pal_render/ags_pal_render.h index a59d05be000..145707000d4 100644 --- a/engines/ags/plugins/ags_pal_render/ags_pal_render.h +++ b/engines/ags/plugins/ags_pal_render/ags_pal_render.h @@ -23,7 +23,7 @@ #ifndef AGS_PLUGINS_AGS_PAL_RENDER_AGS_PAL_RENDER_H #define AGS_PLUGINS_AGS_PAL_RENDER_AGS_PAL_RENDER_H -#include "ags/plugins/plugin_base.h" +#include "ags/plugins/ags_plugin.h" #include "ags/plugins/serializer.h" namespace AGS3 { @@ -31,14 +31,246 @@ namespace Plugins { namespace AGSPalRender { class AGSPalRender : public PluginBase { + SCRIPT_HASH(AGSPalRender) private: - const char *AGS_GetPluginName(); - void AGS_EngineStartup(IAGSEngine *lpEngine); - void AGS_EngineShutdown(); - int64 AGS_EngineOnEvent(int event, NumberPtr data); void syncGame(Serializer &s); public: - AGSPalRender(); + AGSPalRender() : PluginBase() {} + virtual ~AGSPalRender() {} + + const char *AGS_GetPluginName() override; + void AGS_EngineStartup(IAGSEngine *lpEngine) override; + void AGS_EngineShutdown() override; + int64 AGS_EngineOnEvent(int event, NumberPtr data) override; + + /** + * @defgroup PALInternal + * @{ + */ + + void LoadCLUT(ScriptMethodParams ¶ms); + void CycleRemap(ScriptMethodParams ¶ms); + void GetColor565(ScriptMethodParams ¶ms); + void GetLuminosityFromPalette(ScriptMethodParams ¶ms); + void AGSFastSin(ScriptMethodParams ¶ms); + void AGSFastCos(ScriptMethodParams ¶ms); + void AGSFastRoot(ScriptMethodParams ¶ms); + void GetRemappedSlot(ScriptMethodParams ¶ms); + void ResetRemapping(ScriptMethodParams ¶ms); + void GetModifiedBackgroundImage(ScriptMethodParams ¶ms); + void WriteObjectivePalette(ScriptMethodParams ¶ms); + void ReadObjectivePaletteR(ScriptMethodParams ¶ms); + void ReadObjectivePaletteB(ScriptMethodParams ¶ms); + void ReadObjectivePaletteG(ScriptMethodParams ¶ms); + + /**@}*/ + + /** + * @defgroup LensDistort + * @{ + */ + + void SetLensPos(ScriptMethodParams ¶ms); + void GetLensX(ScriptMethodParams ¶ms); + void GetLensY(ScriptMethodParams ¶ms); + void SetLensDrawn(ScriptMethodParams ¶ms); + void GetLensDrawn(ScriptMethodParams ¶ms); + void SetLensOffsetClamp(ScriptMethodParams ¶ms); + void GetLensOffsetClamp(ScriptMethodParams ¶ms); + void GetLensLevel(ScriptMethodParams ¶ms); + void SetLensLevel(ScriptMethodParams ¶ms); + void LensInitialize(ScriptMethodParams ¶ms); + + /**@}*/ + + /** + * @defgroup Translucence + * @{ + */ + + void CreateTranslucentOverlay(ScriptMethodParams ¶ms); + void DeleteTranslucentOverlay(ScriptMethodParams ¶ms); + void MoveTranslucentOverlay(ScriptMethodParams ¶ms); + void GetTranslucentOverlayX(ScriptMethodParams ¶ms); + void GetTranslucentOverlayY(ScriptMethodParams ¶ms); + void GetTranslucentOverlaySprite(ScriptMethodParams ¶ms); + void GetTranslucentOverlayLevel(ScriptMethodParams ¶ms); + void GetTranslucentOverlayEnabled(ScriptMethodParams ¶ms); + void GetTranslucentOverlayAlpha(ScriptMethodParams ¶ms); + void SetTranslucentOverlayAlpha(ScriptMethodParams ¶ms); + void SetTranslucentOverlayEnabled(ScriptMethodParams ¶ms); + void DrawTransSprite(ScriptMethodParams ¶ms); + + /**@}*/ + + /** + * @defgroup Starfield + * @{ + */ + + void GetStarfieldOverscan(ScriptMethodParams ¶ms); + void SetStarfieldOverscan(ScriptMethodParams ¶ms); + void GetStarfieldOriginX(ScriptMethodParams ¶ms); + void GetStarfieldOriginY(ScriptMethodParams ¶ms); + void SetStarfieldDepthMultiplier(ScriptMethodParams ¶ms); + void GetStarfieldDepthMultiplier(ScriptMethodParams ¶ms); + void GetStarfieldMaxStars(ScriptMethodParams ¶ms); + void SetStarSpriteScaleBoost(ScriptMethodParams ¶ms); + void GetStarSpriteScaleBoost(ScriptMethodParams ¶ms); + void SetStarMaxRadius(ScriptMethodParams ¶ms); + void GetStarMaxRadius(ScriptMethodParams ¶ms); + void GetStarX(ScriptMethodParams ¶ms); + void GetStarY(ScriptMethodParams ¶ms); + void GetStarZ(ScriptMethodParams ¶ms); + void SetStarPosition(ScriptMethodParams ¶ms); + void RotateStar(ScriptMethodParams ¶ms); + void SetStarColor(ScriptMethodParams ¶ms); + void GetStarColor(ScriptMethodParams ¶ms); + void SetStarSprite(ScriptMethodParams ¶ms); + void GetStarSprite(ScriptMethodParams ¶ms); + void SetStarSpriteRange(ScriptMethodParams ¶ms); + void InitializeStars(ScriptMethodParams ¶ms); + void IterateStars(ScriptMethodParams ¶ms); + void DrawStars(ScriptMethodParams ¶ms); + void SetStarsOriginPoint(ScriptMethodParams ¶ms); + + /**@}*/ + + /** + * @defgroup Plasma + * @{ + */ + + void DoFire(ScriptMethodParams ¶ms); + void SetPlasmaType(ScriptMethodParams ¶ms); + void ResetPlasmaSettings(ScriptMethodParams ¶ms); + void DrawPlasma(ScriptMethodParams ¶ms); + void SetPlasmaRootType(ScriptMethodParams ¶ms); + void GetPlasmaRootType(ScriptMethodParams ¶ms); + + /**@}*/ + + /** + * @defgroup Reflections + * @{ + */ + + void SetReflections(ScriptMethodParams ¶ms); + void IsReflectionsOn(ScriptMethodParams ¶ms); + void SetCharacterReflected(ScriptMethodParams ¶ms); + void GetCharacterReflected(ScriptMethodParams ¶ms); + void SetObjectReflected(ScriptMethodParams ¶ms); + void GetObjectReflected(ScriptMethodParams ¶ms); + void ReplaceCharacterReflectionView(ScriptMethodParams ¶ms); + void SetObjectReflectionIgnoreScaling(ScriptMethodParams ¶ms); + + /**@}*/ + + /** + * @defgroup raycast + * @{ + */ + + void MakeTextures(ScriptMethodParams ¶ms); + void Raycast_Render(ScriptMethodParams ¶ms); + void MoveForward(ScriptMethodParams ¶ms); + void MoveBackward(ScriptMethodParams ¶ms); + void RotateLeft(ScriptMethodParams ¶ms); + void RotateRight(ScriptMethodParams ¶ms); + void Init_Raycaster(ScriptMethodParams ¶ms); + void QuitCleanup(ScriptMethodParams ¶ms); + void LoadMap(ScriptMethodParams ¶ms); + void Ray_InitSprite(ScriptMethodParams ¶ms); + void Ray_SetPlayerPosition(ScriptMethodParams ¶ms); + void Ray_GetPlayerX(ScriptMethodParams ¶ms); + void Ray_GetPlayerY(ScriptMethodParams ¶ms); + void Ray_GetPlayerAngle(ScriptMethodParams ¶ms); + void Ray_SetPlayerAngle(ScriptMethodParams ¶ms); + + void Ray_GetWallHotspot(ScriptMethodParams ¶ms); + void Ray_GetWallTexture(ScriptMethodParams ¶ms); + void Ray_GetWallSolid(ScriptMethodParams ¶ms); + void Ray_GetWallIgnoreLighting(ScriptMethodParams ¶ms); + void Ray_GetWallAlpha(ScriptMethodParams ¶ms); + void Ray_GetWallBlendType(ScriptMethodParams ¶ms); + + void Ray_SelectTile(ScriptMethodParams ¶ms); + + void Ray_GetHotspotAt(ScriptMethodParams ¶ms); + void Ray_GetObjectAt(ScriptMethodParams ¶ms); + + void Ray_DrawTile(ScriptMethodParams ¶ms); + void Ray_DrawOntoTile(ScriptMethodParams ¶ms); + void Ray_SetNoClip(ScriptMethodParams ¶ms); + void Ray_GetNoClip(ScriptMethodParams ¶ms); + void Ray_SetSpriteInteractObj(ScriptMethodParams ¶ms); + void Ray_GetSpriteInteractObj(ScriptMethodParams ¶ms); + void Ray_SetSpritePosition(ScriptMethodParams ¶ms); + void Ray_SetSpriteVertOffset(ScriptMethodParams ¶ms); + void Ray_GetSpriteVertOffset(ScriptMethodParams ¶ms); + void Ray_GetSpriteX(ScriptMethodParams ¶ms); + void Ray_GetSpriteY(ScriptMethodParams ¶ms); + + void Ray_SetWallHotspot(ScriptMethodParams ¶ms); + void Ray_SetWallTextures(ScriptMethodParams ¶ms); + void Ray_SetWallSolid(ScriptMethodParams ¶ms); + void Ray_SetWallIgnoreLighting(ScriptMethodParams ¶ms); + void Ray_SetWallAlpha(ScriptMethodParams ¶ms); + void Ray_SetWallBlendType(ScriptMethodParams ¶ms); + + void Ray_GetMoveSpeed(ScriptMethodParams ¶ms); + void Ray_SetMoveSpeed(ScriptMethodParams ¶ms); + void Ray_GetRotSpeed(ScriptMethodParams ¶ms); + void Ray_SetRotSpeed(ScriptMethodParams ¶ms); + void Ray_GetWallAt(ScriptMethodParams ¶ms); + void Ray_GetLightAt(ScriptMethodParams ¶ms); + void Ray_SetLightAt(ScriptMethodParams ¶ms); + void Ray_SetWallAt(ScriptMethodParams ¶ms); + void Ray_GetPlaneY(ScriptMethodParams ¶ms); + void Ray_SetPlaneY(ScriptMethodParams ¶ms); + void Ray_GetDistanceAt(ScriptMethodParams ¶ms); + void Ray_GetSpriteAngle(ScriptMethodParams ¶ms); + void Ray_SetSpriteAngle(ScriptMethodParams ¶ms); + void Ray_SetSpriteView(ScriptMethodParams ¶ms); + void Ray_GetSpriteView(ScriptMethodParams ¶ms); + void Ray_SetSpriteFrame(ScriptMethodParams ¶ms); + void Ray_GetSpriteFrame(ScriptMethodParams ¶ms); + + void Ray_GetTileX_At(ScriptMethodParams ¶ms); + void Ray_GetTileY_At(ScriptMethodParams ¶ms); + + void Ray_SetSkyBox(ScriptMethodParams ¶ms); + void Ray_GetSkyBox(ScriptMethodParams ¶ms); + + void Ray_SetAmbientLight(ScriptMethodParams ¶ms); + void Ray_GetAmbientLight(ScriptMethodParams ¶ms); + void Ray_SetAmbientColor(ScriptMethodParams ¶ms); + + + void Ray_GetSpriteAlpha(ScriptMethodParams ¶ms); + void Ray_SetSpriteAlpha(ScriptMethodParams ¶ms); + void Ray_GetSpritePic(ScriptMethodParams ¶ms); + void Ray_SetSpritePic(ScriptMethodParams ¶ms); + + void Ray_GetSpriteScaleX(ScriptMethodParams ¶ms); + void Ray_SetSpriteScaleX(ScriptMethodParams ¶ms); + void Ray_GetSpriteScaleY(ScriptMethodParams ¶ms); + void Ray_SetSpriteScaleY(ScriptMethodParams ¶ms); + + void Ray_SetSpriteBlendType(ScriptMethodParams ¶ms); + void Ray_GetSpriteBlendType(ScriptMethodParams ¶ms); + + void Ray_SetFloorAt(ScriptMethodParams ¶ms); + void Ray_SetCeilingAt(ScriptMethodParams ¶ms); + void Ray_GetCeilingAt(ScriptMethodParams ¶ms); + void Ray_GetFloorAt(ScriptMethodParams ¶ms); + void Ray_GetLightingAt(ScriptMethodParams ¶ms); + void Ray_SetLightingAt(ScriptMethodParams ¶ms); + void Ray_GetAmbientWeight(ScriptMethodParams ¶ms); + + void Ray_HasSeenTile(ScriptMethodParams ¶ms); + + /**@}*/ }; } // namespace AGSPalRender diff --git a/engines/ags/plugins/ags_pal_render/pal_render.h b/engines/ags/plugins/ags_pal_render/pal_render.h index 6933b6d5b04..f5ddff10073 100644 --- a/engines/ags/plugins/ags_pal_render/pal_render.h +++ b/engines/ags/plugins/ags_pal_render/pal_render.h @@ -51,7 +51,7 @@ class Mix { public: //unsigned char MixColorAlpha (unsigned char fg,unsigned char bg,unsigned char alpha); //unsigned char MixColorAdditive (unsigned char fg,unsigned char bg,unsigned char alpha); - unsigned char MixColorAlpha(unsigned char fg, unsigned char bg, unsigned char alpha, int use_objpal = 0) { + static unsigned char MixColorAlpha(unsigned char fg, unsigned char bg, unsigned char alpha, int use_objpal = 0) { unsigned char rfg = cycle_remap[fg]; //Automatic remapping of palette slots. //unsigned char rbg = cycle_remap [bg]; //Saves on typing elsewhere. AGSColor *palette = engine->GetPalette(); @@ -88,7 +88,7 @@ public: //engine->ReleaseBitmapSurface (clutspr); } - unsigned char MixColorLightLevel(unsigned char fg, unsigned char intensity) { + static unsigned char MixColorLightLevel(unsigned char fg, unsigned char intensity) { unsigned char rfg = cycle_remap [fg]; //Automatic remapping of palette slots. int i = 0; //int dark_r = (((palette[fg].r>>1) * (intensity))>>8); @@ -102,7 +102,7 @@ public: return cycle_remap [*(clutp + i)]; //Once again, to make sure that the palette slot used is the right one. } - unsigned char MixColorAdditive(unsigned char fg, unsigned char bg, unsigned char alpha, int use_objpal = 0) { + static unsigned char MixColorAdditive(unsigned char fg, unsigned char bg, unsigned char alpha, int use_objpal = 0) { unsigned char rfg = cycle_remap[fg]; //Automatic remapping of palette slots. //unsigned char rbg = cycle_remap[bg]; //Saves on typing elsewhere. //BITMAP *clutspr = engine->GetSpriteGraphic (clutslot); @@ -143,7 +143,7 @@ public: return result; } - unsigned char MixColorMultiply(unsigned char fg, unsigned char bg, unsigned char alpha, int use_objpal = 0) { + static unsigned char MixColorMultiply(unsigned char fg, unsigned char bg, unsigned char alpha, int use_objpal = 0) { unsigned char rfg = cycle_remap [fg]; //Automatic remapping of palette slots. unsigned char rbg = cycle_remap [bg]; //Saves on typing elsewhere. AGSColor *palette = engine->GetPalette(); @@ -173,7 +173,6 @@ public: //engine->ReleaseBitmapSurface (clutspr); return result; } - }; void GetColor565(ScriptMethodParams ¶ms); diff --git a/engines/ags/plugins/ags_pal_render/raycast.cpp b/engines/ags/plugins/ags_pal_render/raycast.cpp index aa7438a1a5a..f319654d7e2 100644 --- a/engines/ags/plugins/ags_pal_render/raycast.cpp +++ b/engines/ags/plugins/ags_pal_render/raycast.cpp @@ -22,7 +22,7 @@ #include "ags/lib/allegro.h" #include "ags/plugins/ags_pal_render/raycast.h" -#include "ags/plugins/plugin_base.h" +#include "ags/plugins/ags_pal_render/ags_pal_render.h" namespace AGS3 { namespace Plugins { @@ -80,7 +80,7 @@ int selectedX; int selectedY; unsigned char selectedColor; -void Ray_SelectTile(ScriptMethodParams ¶ms) { +void AGSPalRender::Ray_SelectTile(ScriptMethodParams ¶ms) { PARAMS3(int, x, int, y, unsigned char, color); if (x < 0 || x >= MAP_WIDTH) selectedX = -1; else if (y < 0 || y >= MAP_HEIGHT) selectedY = -1; @@ -91,23 +91,23 @@ void Ray_SelectTile(ScriptMethodParams ¶ms) { } } -void Ray_HasSeenTile(ScriptMethodParams ¶ms) { +void AGSPalRender::Ray_HasSeenTile(ScriptMethodParams ¶ms) { PARAMS2(int, x, int, y); if (x < 0 || x >= MAP_WIDTH) params._result = -1; else if (y < 0 || y >= MAP_HEIGHT) params._result = -1; else params._result = seenMap [x][y]; } -void Ray_SetNoClip(ScriptMethodParams ¶ms) { +void AGSPalRender::Ray_SetNoClip(ScriptMethodParams ¶ms) { PARAMS1(int, value); noclip = value; } -void Ray_GetNoClip(ScriptMethodParams ¶ms) { +void AGSPalRender::Ray_GetNoClip(ScriptMethodParams ¶ms) { params._result = noclip; } -void Ray_DrawTile(ScriptMethodParams ¶ms) { +void AGSPalRender::Ray_DrawTile(ScriptMethodParams ¶ms) { PARAMS2(int, spr, int, tile); BITMAP *img = engine->GetSpriteGraphic(spr); uint8 *sprarray = engine->GetRawBitmapSurface(img); @@ -118,7 +118,7 @@ void Ray_DrawTile(ScriptMethodParams ¶ms) { engine->ReleaseBitmapSurface(img); } -void Ray_DrawOntoTile(ScriptMethodParams ¶ms) { +void AGSPalRender::Ray_DrawOntoTile(ScriptMethodParams ¶ms) { PARAMS2(int, spr, int, tile); BITMAP *img = engine->GetSpriteGraphic(spr); uint8 *sprarray = engine->GetRawBitmapSurface(img); @@ -129,48 +129,48 @@ void Ray_DrawOntoTile(ScriptMethodParams ¶ms) { engine->ReleaseBitmapSurface(img); } -void Ray_GetTileX_At(ScriptMethodParams ¶ms) { +void AGSPalRender::Ray_GetTileX_At(ScriptMethodParams ¶ms) { PARAMS2(int, x, int, y); if (x < 0 || x >= S_WIDTH || y < 0 || y >= S_HEIGHT) params._result = -1; else params._result = editorMap [x][y] >> 16; } -void Ray_GetTileY_At(ScriptMethodParams ¶ms) { +void AGSPalRender::Ray_GetTileY_At(ScriptMethodParams ¶ms) { PARAMS2(int, x, int, y); if (x < 0 || x >= S_WIDTH || y < 0 || y >= S_HEIGHT) params._result = -1; else params._result = editorMap [x][y] & 0x0000FFFF; } -void Ray_SetWallAt(ScriptMethodParams ¶ms) { +void AGSPalRender::Ray_SetWallAt(ScriptMethodParams ¶ms) { PARAMS3(int, x, int, y, int, id); if (x < 0 || x >= MAP_WIDTH) return; if (y < 0 || y >= MAP_HEIGHT) return; worldMap [x][y] = id; } -void Ray_GetWallAt(ScriptMethodParams ¶ms) { +void AGSPalRender::Ray_GetWallAt(ScriptMethodParams ¶ms) { PARAMS2(int, x, int, y); if (x < 0 || x >= MAP_WIDTH) params._result = -1; else if (y < 0 || y >= MAP_HEIGHT) params._result = -1; else params._result = worldMap [x][y]; } -void Ray_GetAmbientWeight(ScriptMethodParams ¶ms) { +void AGSPalRender::Ray_GetAmbientWeight(ScriptMethodParams ¶ms) { params._result = ambientweight; } -void Ray_SetAmbientLight(ScriptMethodParams ¶ms) { +void AGSPalRender::Ray_SetAmbientLight(ScriptMethodParams ¶ms) { PARAMS1(int, value); ambientlight = MIN(255, MAX(0, value)); } -void Ray_SetAmbientColor(ScriptMethodParams ¶ms) { +void AGSPalRender::Ray_SetAmbientColor(ScriptMethodParams ¶ms) { PARAMS2(int, color, int, amount); ambientcolor = color; ambientcolorAmount = amount; } -void Ray_GetAmbientLight(ScriptMethodParams ¶ms) { +void AGSPalRender::Ray_GetAmbientLight(ScriptMethodParams ¶ms) { params._result = ambientlight; } double fsqrt(double y) { @@ -189,12 +189,12 @@ double fsqrt(double y) { return x * y; } -void Ray_SetWallHotspot(ScriptMethodParams ¶ms) { +void AGSPalRender::Ray_SetWallHotspot(ScriptMethodParams ¶ms) { PARAMS2(int, id, char, hotsp); wallData[id].hotspotinteract = hotsp; } -void Ray_SetWallTextures(ScriptMethodParams ¶ms) { +void AGSPalRender::Ray_SetWallTextures(ScriptMethodParams ¶ms) { PARAMS5(int, id, int, n, int, s, int, w, int, e); wallData[id].texture[0] = n; wallData[id].texture[1] = s; @@ -202,7 +202,7 @@ void Ray_SetWallTextures(ScriptMethodParams ¶ms) { wallData[id].texture[3] = e; } -void Ray_SetWallSolid(ScriptMethodParams ¶ms) { +void AGSPalRender::Ray_SetWallSolid(ScriptMethodParams ¶ms) { PARAMS5(int, id, int, n, int, s, int, w, int, e); wallData[id].solid [0] = MAX(0, MIN(n, 1)); wallData[id].solid [1] = MAX(0, MIN(s, 1)); @@ -210,7 +210,7 @@ void Ray_SetWallSolid(ScriptMethodParams ¶ms) { wallData[id].solid [3] = MAX(0, MIN(e, 1)); } -void Ray_SetWallIgnoreLighting(ScriptMethodParams ¶ms) { +void AGSPalRender::Ray_SetWallIgnoreLighting(ScriptMethodParams ¶ms) { PARAMS5(int, id, int, n, int, s, int, w, int, e); wallData[id].ignorelighting [0] = MAX(0, MIN(n, 1)); wallData[id].ignorelighting [1] = MAX(0, MIN(s, 1)); @@ -218,7 +218,7 @@ void Ray_SetWallIgnoreLighting(ScriptMethodParams ¶ms) { wallData[id].ignorelighting [3] = MAX(0, MIN(e, 1)); } -void Ray_SetWallAlpha(ScriptMethodParams ¶ms) { +void AGSPalRender::Ray_SetWallAlpha(ScriptMethodParams ¶ms) { PARAMS5(int, id, int, n, int, s, int, w, int, e); wallData[id].alpha [0] = MAX(0, MIN(n, 255)); wallData[id].alpha [1] = MAX(0, MIN(s, 255)); @@ -226,7 +226,7 @@ void Ray_SetWallAlpha(ScriptMethodParams ¶ms) { wallData[id].alpha [3] = MAX(0, MIN(e, 255)); } -void Ray_SetWallBlendType(ScriptMethodParams ¶ms) { +void AGSPalRender::Ray_SetWallBlendType(ScriptMethodParams ¶ms) { PARAMS5(int, id, int, n, int, s, int, w, int, e); wallData[id].blendtype [0] = MAX(0, MIN(n, 10)); wallData[id].blendtype [1] = MAX(0, MIN(s, 10)); @@ -237,86 +237,83 @@ void Ray_SetWallBlendType(ScriptMethodParams ¶ms) { -void Ray_GetWallHotspot(ScriptMethodParams ¶ms) { +void AGSPalRender::Ray_GetWallHotspot(ScriptMethodParams ¶ms) { PARAMS1(int, id); params._result = wallData[id].hotspotinteract; } -void Ray_GetWallTexture(ScriptMethodParams ¶ms) { +void AGSPalRender::Ray_GetWallTexture(ScriptMethodParams ¶ms) { PARAMS2(int, id, int, dir); params._result = wallData[id].texture[dir]; } -void Ray_GetWallSolid(ScriptMethodParams ¶ms) { +void AGSPalRender::Ray_GetWallSolid(ScriptMethodParams ¶ms) { PARAMS2(int, id, int, dir); params._result = wallData[id].solid [dir]; } -void Ray_GetWallIgnoreLighting(ScriptMethodParams ¶ms) { +void AGSPalRender::Ray_GetWallIgnoreLighting(ScriptMethodParams ¶ms) { PARAMS2(int, id, int, dir); params._result = wallData[id].ignorelighting [dir]; } -void Ray_GetWallAlpha(ScriptMethodParams ¶ms) { +void AGSPalRender::Ray_GetWallAlpha(ScriptMethodParams ¶ms) { PARAMS2(int, id, int, dir); params._result = wallData[id].alpha [dir]; } -void Ray_GetWallBlendType(ScriptMethodParams ¶ms) { +void AGSPalRender::Ray_GetWallBlendType(ScriptMethodParams ¶ms) { PARAMS2(int, id, int, dir); params._result = wallData[id].blendtype [dir]; } - - - -void Ray_GetMoveSpeed(ScriptMethodParams ¶ms) { +void AGSPalRender::Ray_GetMoveSpeed(ScriptMethodParams ¶ms) { float mSpeed = (float)moveSpeed; params._result = PARAM_FROM_FLOAT(mSpeed); } -void Ray_SetMoveSpeed(ScriptMethodParams ¶ms) { +void AGSPalRender::Ray_SetMoveSpeed(ScriptMethodParams ¶ms) { PARAMS1(int32, speedi); float speed = PARAM_TO_FLOAT(speedi); moveSpeed = (double)speed; } -void Ray_GetRotSpeed(ScriptMethodParams ¶ms) { +void AGSPalRender::Ray_GetRotSpeed(ScriptMethodParams ¶ms) { float rSpeed = (float)rotSpeed; params._result = PARAM_FROM_FLOAT(rSpeed); } -void Ray_SetRotSpeed(ScriptMethodParams ¶ms) { +void AGSPalRender::Ray_SetRotSpeed(ScriptMethodParams ¶ms) { PARAMS1(int32, speedi); float speed = PARAM_TO_FLOAT(speedi); rotSpeed = (double)speed; } -void Ray_GetLightAt(ScriptMethodParams ¶ms) { +void AGSPalRender::Ray_GetLightAt(ScriptMethodParams ¶ms) { PARAMS2(int, x, int, y); params._result = lightMap [x][y]; } -void Ray_SetLightAt(ScriptMethodParams ¶ms) { +void AGSPalRender::Ray_SetLightAt(ScriptMethodParams ¶ms) { PARAMS3(int, x, int, y, int, light); lightMap [x][y] = light; } -void Ray_SetPlaneY(ScriptMethodParams ¶ms) { +void AGSPalRender::Ray_SetPlaneY(ScriptMethodParams ¶ms) { PARAMS1(int32, yi); float y = PARAM_TO_FLOAT(yi); planeY = (double)y; } -void Ray_GetPlaneY(ScriptMethodParams ¶ms) { +void AGSPalRender::Ray_GetPlaneY(ScriptMethodParams ¶ms) { float pY = (float)planeY; params._result = PARAM_FROM_FLOAT(pY); } -void Ray_SetPlayerPosition(ScriptMethodParams ¶ms) { +void AGSPalRender::Ray_SetPlayerPosition(ScriptMethodParams ¶ms) { PARAMS2(int32, xi, int32, yi); float x = PARAM_TO_FLOAT(xi); float y = PARAM_TO_FLOAT(yi); @@ -324,24 +321,24 @@ void Ray_SetPlayerPosition(ScriptMethodParams ¶ms) { posY = (double)y; } -void Ray_GetPlayerX(ScriptMethodParams ¶ms) { +void AGSPalRender::Ray_GetPlayerX(ScriptMethodParams ¶ms) { float x = (float)posX; params._result = PARAM_FROM_FLOAT(x); } -void Ray_GetPlayerY(ScriptMethodParams ¶ms) { +void AGSPalRender::Ray_GetPlayerY(ScriptMethodParams ¶ms) { float y = (float)posY; params._result = PARAM_FROM_FLOAT(y); } -void Ray_GetPlayerAngle(ScriptMethodParams ¶ms) { +void AGSPalRender::Ray_GetPlayerAngle(ScriptMethodParams ¶ms) { double bgrad = atan2(dirY, dirX); int bgdeg = (int)(bgrad / PI * 180.0) + 180; params._result = bgdeg % 360; } -void Ray_SetPlayerAngle(ScriptMethodParams ¶ms) { +void AGSPalRender::Ray_SetPlayerAngle(ScriptMethodParams ¶ms) { PARAMS1(int, angle); int realangle = angle % 360; if (realangle < 0) realangle += 360; @@ -377,7 +374,7 @@ void LoadHeightMap(int heightmapSlot) { heightmapOn = true; } -void LoadMap(ScriptMethodParams ¶ms) { +void AGSPalRender::LoadMap(ScriptMethodParams ¶ms) { PARAMS4(int, worldmapSlot, int, lightmapSlot, int, ceilingmapSlot, int, floormapSlot); int tempw = engine->GetSpriteWidth(worldmapSlot); int temph = engine->GetSpriteHeight(worldmapSlot); @@ -435,104 +432,103 @@ void LoadMap(ScriptMethodParams ¶ms) { //LoadHeightMap (31); //debug only } -void Ray_GetSpriteScaleX(ScriptMethodParams ¶ms) { +void AGSPalRender::Ray_GetSpriteScaleX(ScriptMethodParams ¶ms) { PARAMS1(int, id); float scale = (float)sprite[id].uDivW; params._result = PARAM_FROM_FLOAT(scale); } -void Ray_SetSpriteScaleX(ScriptMethodParams ¶ms) { +void AGSPalRender::Ray_SetSpriteScaleX(ScriptMethodParams ¶ms) { PARAMS2(int, id, int32, scalei); float scale = PARAM_TO_FLOAT(scalei); sprite[id].uDivW = scale; } -void Ray_GetSpriteScaleY(ScriptMethodParams ¶ms) { +void AGSPalRender::Ray_GetSpriteScaleY(ScriptMethodParams ¶ms) { PARAMS1(int, id); float scale = (float)sprite[id].uDivH; params._result = PARAM_FROM_FLOAT(scale); } -void Ray_SetSpriteScaleY(ScriptMethodParams ¶ms) { +void AGSPalRender::Ray_SetSpriteScaleY(ScriptMethodParams ¶ms) { PARAMS2(int, id, int32, scalei); float scale = PARAM_TO_FLOAT(scalei); sprite[id].uDivH = scale; } -void Ray_GetSpriteAlpha(ScriptMethodParams ¶ms) { +void AGSPalRender::Ray_GetSpriteAlpha(ScriptMethodParams ¶ms) { PARAMS1(int, id); params._result = sprite[id].alpha; } -void Ray_SetSpriteAlpha(ScriptMethodParams ¶ms) { +void AGSPalRender::Ray_SetSpriteAlpha(ScriptMethodParams ¶ms) { PARAMS2(int, id, int, alpha); sprite[id].alpha = alpha; } -void Ray_GetSpritePic(ScriptMethodParams ¶ms) { +void AGSPalRender::Ray_GetSpritePic(ScriptMethodParams ¶ms) { PARAMS1(int, id); params._result = sprite[id].texture; } -void Ray_SetSpritePic(ScriptMethodParams ¶ms) { +void AGSPalRender::Ray_SetSpritePic(ScriptMethodParams ¶ms) { PARAMS2(int, id, int, slot); sprite[id].texture = slot; } - -void Ray_GetSpriteAngle(ScriptMethodParams ¶ms) { +void AGSPalRender::Ray_GetSpriteAngle(ScriptMethodParams ¶ms) { PARAMS1(int, id); params._result = sprite[id].angle; } -void Ray_SetSpriteAngle(ScriptMethodParams ¶ms) { +void AGSPalRender::Ray_SetSpriteAngle(ScriptMethodParams ¶ms) { PARAMS2(int, id, int, angle); sprite[id].angle = angle % 360; } -void Ray_GetSpriteInteractObj(ScriptMethodParams ¶ms) { +void AGSPalRender::Ray_GetSpriteInteractObj(ScriptMethodParams ¶ms) { PARAMS1(int, id); params._result = sprite[id].objectinteract; } -void Ray_SetSpriteView(ScriptMethodParams ¶ms) { +void AGSPalRender::Ray_SetSpriteView(ScriptMethodParams ¶ms) { PARAMS2(int, id, int, view); sprite[id].view = view; } -void Ray_SetSpriteBlendType(ScriptMethodParams ¶ms) { +void AGSPalRender::Ray_SetSpriteBlendType(ScriptMethodParams ¶ms) { PARAMS2(int, id, int, type); sprite[id].blendmode = type; } -void Ray_GetSpriteBlendType(ScriptMethodParams ¶ms) { +void AGSPalRender::Ray_GetSpriteBlendType(ScriptMethodParams ¶ms) { PARAMS1(int, id); params._result = sprite[id].blendmode; } -void Ray_GetSpriteView(ScriptMethodParams ¶ms) { +void AGSPalRender::Ray_GetSpriteView(ScriptMethodParams ¶ms) { PARAMS1(int, id); params._result = sprite[id].view; } -void Ray_SetSpriteFrame(ScriptMethodParams ¶ms) { +void AGSPalRender::Ray_SetSpriteFrame(ScriptMethodParams ¶ms) { PARAMS2(int, id, int, frame); sprite[id].frame = frame; } -void Ray_GetSpriteFrame(ScriptMethodParams ¶ms) { +void AGSPalRender::Ray_GetSpriteFrame(ScriptMethodParams ¶ms) { PARAMS1(int, id); params._result = sprite[id].frame; } -void Ray_SetSpriteInteractObj(ScriptMethodParams ¶ms) { +void AGSPalRender::Ray_SetSpriteInteractObj(ScriptMethodParams ¶ms) { PARAMS2(int, id, int, obj); sprite[id].objectinteract = obj; } -void Ray_SetSpritePosition(ScriptMethodParams ¶ms) { +void AGSPalRender::Ray_SetSpritePosition(ScriptMethodParams ¶ms) { PARAMS3(int, id, int32, xi, int32, yi); float x = PARAM_TO_FLOAT(xi); float y = PARAM_TO_FLOAT(yi); @@ -540,32 +536,32 @@ void Ray_SetSpritePosition(ScriptMethodParams ¶ms) { sprite[id].y = y; } -void Ray_SetSpriteVertOffset(ScriptMethodParams ¶ms) { +void AGSPalRender::Ray_SetSpriteVertOffset(ScriptMethodParams ¶ms) { PARAMS2(int, id, int32, vMovei); float vMove = PARAM_TO_FLOAT(vMovei); sprite[id].vMove = vMove; } -void Ray_GetSpriteVertOffset(ScriptMethodParams ¶ms) { +void AGSPalRender::Ray_GetSpriteVertOffset(ScriptMethodParams ¶ms) { PARAMS1(int, id); float x = (float)sprite[id].vMove; params._result = PARAM_FROM_FLOAT(x); } -void Ray_GetSpriteX(ScriptMethodParams ¶ms) { +void AGSPalRender::Ray_GetSpriteX(ScriptMethodParams ¶ms) { PARAMS1(int, id); float x = (float)sprite[id].x; params._result = PARAM_FROM_FLOAT(x); } -void Ray_GetSpriteY(ScriptMethodParams ¶ms) { +void AGSPalRender::Ray_GetSpriteY(ScriptMethodParams ¶ms) { PARAMS1(int, id); float y = (float)sprite[id].y; params._result = PARAM_FROM_FLOAT(y); } -void Ray_InitSprite(ScriptMethodParams ¶ms) { +void AGSPalRender::Ray_InitSprite(ScriptMethodParams ¶ms) { PARAMS9(int, id, int32, xi, int32, yi, int, slot, unsigned char, alpha, int, blendmode, int32, scale_xi, int32, scale_yi, int32, vMovei); float x = PARAM_TO_FLOAT(xi); float y = PARAM_TO_FLOAT(yi); @@ -586,7 +582,7 @@ void Ray_InitSprite(ScriptMethodParams ¶ms) { //function used to sort the sprites void combSort(int *order, double *dist, int amount); -void MakeTextures(ScriptMethodParams ¶ms) { +void AGSPalRender::MakeTextures(ScriptMethodParams ¶ms) { PARAMS1(int, slot); textureSlot = slot; int sourceWidth = engine->GetSpriteWidth(slot); @@ -635,33 +631,33 @@ void MakeTextures(ScriptMethodParams ¶ms) { //double ZBuffer[screenWidth][screenHeight]; -void Ray_SetFloorAt(ScriptMethodParams ¶ms) { +void AGSPalRender::Ray_SetFloorAt(ScriptMethodParams ¶ms) { PARAMS3(int, x, int, y, int, tex); if (x < 0 || x > MAP_WIDTH || y < 0 || y > MAP_HEIGHT || tex > 511) return; else floorMap[x][y] = tex; } -void Ray_SetCeilingAt(ScriptMethodParams ¶ms) { +void AGSPalRender::Ray_SetCeilingAt(ScriptMethodParams ¶ms) { PARAMS3(int, x, int, y, int, tex); if (x < 0 || x > MAP_WIDTH || y < 0 || y > MAP_HEIGHT || tex > 511) return; else ceilingMap[x][y] = tex; } -void Ray_GetCeilingAt(ScriptMethodParams ¶ms) { +void AGSPalRender::Ray_GetCeilingAt(ScriptMethodParams ¶ms) { PARAMS2(int, x, int, y); if (x < 0 || x > MAP_WIDTH || y < 0 || y > MAP_HEIGHT) params._result = -1; else params._result = ceilingMap [x][y]; } -void Ray_GetFloorAt(ScriptMethodParams ¶ms) { +void AGSPalRender::Ray_GetFloorAt(ScriptMethodParams ¶ms) { PARAMS2(int, x, int, y); if (x < 0 || x > MAP_WIDTH || y < 0 || y > MAP_HEIGHT) params._result = -1; else params._result = floorMap [x][y]; } -void Ray_GetLightingAt(ScriptMethodParams ¶ms) { +void AGSPalRender::Ray_GetLightingAt(ScriptMethodParams ¶ms) { PARAMS2(int, x, int, y); if (x < 0 || x > MAP_WIDTH || y < 0 || y > MAP_HEIGHT) params._result = -1; else { @@ -674,7 +670,7 @@ void Ray_GetLightingAt(ScriptMethodParams ¶ms) { } } -void Ray_SetLightingAt(ScriptMethodParams ¶ms) { +void AGSPalRender::Ray_SetLightingAt(ScriptMethodParams ¶ms) { PARAMS3(int, x, int, y, unsigned char, lighting); if (x < 0 || x > MAP_WIDTH || y < 0 || y > MAP_HEIGHT) return; else { @@ -682,7 +678,7 @@ void Ray_SetLightingAt(ScriptMethodParams ¶ms) { } } -void Ray_SetSkyBox(ScriptMethodParams ¶ms) { +void AGSPalRender::Ray_SetSkyBox(ScriptMethodParams ¶ms) { PARAMS1(int, slot); BITMAP *test = engine->GetSpriteGraphic(slot); if (test) { @@ -690,26 +686,26 @@ void Ray_SetSkyBox(ScriptMethodParams ¶ms) { } else engine->AbortGame("Ray_SetSkybox: No such sprite!"); } -void Ray_GetSkyBox(ScriptMethodParams ¶ms) { +void AGSPalRender::Ray_GetSkyBox(ScriptMethodParams ¶ms) { //PARAMS1(int, slot); params._result = skybox; } -void Ray_GetHotspotAt(ScriptMethodParams ¶ms) { +void AGSPalRender::Ray_GetHotspotAt(ScriptMethodParams ¶ms) { PARAMS2(int, x, int, y); if (!interactionmap) params._result = -1; else if (x > S_WIDTH || x < 0 || y > S_HEIGHT || y < 0) params._result = -1; else params._result = interactionmap [x * S_WIDTH + y] & 0x00FF; } -void Ray_GetObjectAt(ScriptMethodParams ¶ms) { +void AGSPalRender::Ray_GetObjectAt(ScriptMethodParams ¶ms) { PARAMS2(int, x, int, y); if (!interactionmap) params._result = -1; else if (x > S_WIDTH || x < 0 || y > S_HEIGHT || y < 0) params._result = -1; else params._result = interactionmap [x * S_WIDTH + y] >> 8; } -void Ray_GetDistanceAt(ScriptMethodParams ¶ms) { +void AGSPalRender::Ray_GetDistanceAt(ScriptMethodParams ¶ms) { PARAMS2(int, x, int, y); float falsereturn = -1.0f; if (!ZBuffer) { @@ -723,7 +719,7 @@ void Ray_GetDistanceAt(ScriptMethodParams ¶ms) { } } -void Init_Raycaster(ScriptMethodParams &) { +void AGSPalRender::Init_Raycaster(ScriptMethodParams &) { if (ZBuffer) return; //if (!worldMap) return; @@ -748,7 +744,7 @@ void Init_Raycaster(ScriptMethodParams &) { } bool rendering; -void Raycast_Render(ScriptMethodParams ¶ms) { +void AGSPalRender::Raycast_Render(ScriptMethodParams ¶ms) { PARAMS1(int, slot); ambientweight = 0; raycastOn = true; @@ -1387,7 +1383,7 @@ void Raycast_Render(ScriptMethodParams ¶ms) { } -void QuitCleanup(ScriptMethodParams &) { +void AGSPalRender::QuitCleanup(ScriptMethodParams &) { if (!rendering) { for (int i = 0; i < S_WIDTH; ++i) { if (transcolorbuffer[i])delete [] transcolorbuffer[i]; @@ -1404,7 +1400,7 @@ void QuitCleanup(ScriptMethodParams &) { } } -void MoveForward(ScriptMethodParams &) { +void AGSPalRender::MoveForward(ScriptMethodParams &) { double newposx = 0; if (dirX > 0) newposx = 0.1 + posX + dirX * moveSpeed; else newposx = -0.1 + posX + dirX * moveSpeed; @@ -1459,7 +1455,7 @@ void MoveForward(ScriptMethodParams &) { } } -void MoveBackward(ScriptMethodParams &) { +void AGSPalRender::MoveBackward(ScriptMethodParams &) { double newposx = 0; if (dirX > 0) newposx = -0.1 + posX - dirX * moveSpeed; else newposx = 0.1 + posX - dirX * moveSpeed; @@ -1531,7 +1527,7 @@ void MoveBackward () } */ -void RotateLeft(ScriptMethodParams &) { +void AGSPalRender::RotateLeft(ScriptMethodParams &) { double oldDirX = dirX; dirX = dirX * cos(rotSpeed) - dirY * sin(rotSpeed); dirY = oldDirX * sin(rotSpeed) + dirY * cos(rotSpeed); @@ -1540,7 +1536,7 @@ void RotateLeft(ScriptMethodParams &) { planeY = oldPlaneX * sin(rotSpeed) + planeY * cos(rotSpeed); } -void RotateRight(ScriptMethodParams &) { +void AGSPalRender::RotateRight(ScriptMethodParams &) { double oldDirX = dirX; dirX = dirX * cos(-rotSpeed) - dirY * sin(-rotSpeed); dirY = oldDirX * sin(-rotSpeed) + dirY * cos(-rotSpeed); diff --git a/engines/ags/plugins/ags_pal_render/raycast.h b/engines/ags/plugins/ags_pal_render/raycast.h index 4e5faa3a4de..d495d69604a 100644 --- a/engines/ags/plugins/ags_pal_render/raycast.h +++ b/engines/ags/plugins/ags_pal_render/raycast.h @@ -102,106 +102,6 @@ extern double *distTable; extern short *interactionmap; extern int skybox; - - -void MakeTextures(ScriptMethodParams ¶ms); -void Raycast_Render(ScriptMethodParams ¶ms); -void MoveForward(ScriptMethodParams ¶ms); -void MoveBackward(ScriptMethodParams ¶ms); -void RotateLeft(ScriptMethodParams ¶ms); -void RotateRight(ScriptMethodParams ¶ms); -void Init_Raycaster(ScriptMethodParams ¶ms); -void QuitCleanup(ScriptMethodParams ¶ms); -void LoadMap(ScriptMethodParams ¶ms); -void Ray_InitSprite(ScriptMethodParams ¶ms); -void Ray_SetPlayerPosition(ScriptMethodParams ¶ms); -void Ray_GetPlayerX(ScriptMethodParams ¶ms); -void Ray_GetPlayerY(ScriptMethodParams ¶ms); -void Ray_GetPlayerAngle(ScriptMethodParams ¶ms); -void Ray_SetPlayerAngle(ScriptMethodParams ¶ms); - -void Ray_GetWallHotspot(ScriptMethodParams ¶ms); -void Ray_GetWallTexture(ScriptMethodParams ¶ms); -void Ray_GetWallSolid(ScriptMethodParams ¶ms); -void Ray_GetWallIgnoreLighting(ScriptMethodParams ¶ms); -void Ray_GetWallAlpha(ScriptMethodParams ¶ms); -void Ray_GetWallBlendType(ScriptMethodParams ¶ms); - -void Ray_SelectTile(ScriptMethodParams ¶ms); - -void Ray_GetHotspotAt(ScriptMethodParams ¶ms); -void Ray_GetObjectAt(ScriptMethodParams ¶ms); - -void Ray_DrawTile(ScriptMethodParams ¶ms); -void Ray_DrawOntoTile(ScriptMethodParams ¶ms); -void Ray_SetNoClip(ScriptMethodParams ¶ms); -void Ray_GetNoClip(ScriptMethodParams ¶ms); -void Ray_SetSpriteInteractObj(ScriptMethodParams ¶ms); -void Ray_GetSpriteInteractObj(ScriptMethodParams ¶ms); -void Ray_SetSpritePosition(ScriptMethodParams ¶ms); -void Ray_SetSpriteVertOffset(ScriptMethodParams ¶ms); -void Ray_GetSpriteVertOffset(ScriptMethodParams ¶ms); -void Ray_GetSpriteX(ScriptMethodParams ¶ms); -void Ray_GetSpriteY(ScriptMethodParams ¶ms); - -void Ray_SetWallHotspot(ScriptMethodParams ¶ms); -void Ray_SetWallTextures(ScriptMethodParams ¶ms); -void Ray_SetWallSolid(ScriptMethodParams ¶ms); -void Ray_SetWallIgnoreLighting(ScriptMethodParams ¶ms); -void Ray_SetWallAlpha(ScriptMethodParams ¶ms); -void Ray_SetWallBlendType(ScriptMethodParams ¶ms); - -void Ray_GetMoveSpeed(ScriptMethodParams ¶ms); -void Ray_SetMoveSpeed(ScriptMethodParams ¶ms); -void Ray_GetRotSpeed(ScriptMethodParams ¶ms); -void Ray_SetRotSpeed(ScriptMethodParams ¶ms); -void Ray_GetWallAt(ScriptMethodParams ¶ms); -void Ray_GetLightAt(ScriptMethodParams ¶ms); -void Ray_SetLightAt(ScriptMethodParams ¶ms); -void Ray_SetWallAt(ScriptMethodParams ¶ms); -void Ray_SetPlaneY(ScriptMethodParams ¶ms); -void Ray_GetDistanceAt(ScriptMethodParams ¶ms); -void Ray_GetSpriteAngle(ScriptMethodParams ¶ms); -void Ray_SetSpriteAngle(ScriptMethodParams ¶ms); -void Ray_SetSpriteView(ScriptMethodParams ¶ms); -void Ray_GetSpriteView(ScriptMethodParams ¶ms); -void Ray_SetSpriteFrame(ScriptMethodParams ¶ms); -void Ray_GetSpriteFrame(ScriptMethodParams ¶ms); - -void Ray_GetTileX_At(ScriptMethodParams ¶ms); -void Ray_GetTileY_At(ScriptMethodParams ¶ms); - -void Ray_SetSkyBox(ScriptMethodParams ¶ms); -void Ray_GetSkyBox(ScriptMethodParams ¶ms); - -void Ray_SetAmbientLight(ScriptMethodParams ¶ms); -void Ray_GetAmbientLight(ScriptMethodParams ¶ms); -void Ray_SetAmbientColor(ScriptMethodParams ¶ms); - - -void Ray_GetSpriteAlpha(ScriptMethodParams ¶ms); -void Ray_SetSpriteAlpha(ScriptMethodParams ¶ms); -void Ray_GetSpritePic(ScriptMethodParams ¶ms); -void Ray_SetSpritePic(ScriptMethodParams ¶ms); - -void Ray_GetSpriteScaleX(ScriptMethodParams ¶ms); -void Ray_SetSpriteScaleX(ScriptMethodParams ¶ms); -void Ray_GetSpriteScaleY(ScriptMethodParams ¶ms); -void Ray_SetSpriteScaleY(ScriptMethodParams ¶ms); - -void Ray_SetSpriteBlendType(ScriptMethodParams ¶ms); -void Ray_GetSpriteBlendType(ScriptMethodParams ¶ms); - -void Ray_SetFloorAt(ScriptMethodParams ¶ms); -void Ray_SetCeilingAt(ScriptMethodParams ¶ms); -void Ray_GetCeilingAt(ScriptMethodParams ¶ms); -void Ray_GetFloorAt(ScriptMethodParams ¶ms); -void Ray_GetLightingAt(ScriptMethodParams ¶ms); -void Ray_SetLightingAt(ScriptMethodParams ¶ms); -void Ray_GetAmbientWeight(ScriptMethodParams ¶ms); - -void Ray_HasSeenTile(ScriptMethodParams ¶ms); - } // namespace AGSPalRender } // namespace Plugins } // namespace AGS3 diff --git a/engines/ags/plugins/ags_parallax/ags_parallax.cpp b/engines/ags/plugins/ags_parallax/ags_parallax.cpp index c1664b3fb0f..36b267f1b36 100644 --- a/engines/ags/plugins/ags_parallax/ags_parallax.cpp +++ b/engines/ags/plugins/ags_parallax/ags_parallax.cpp @@ -32,38 +32,18 @@ const unsigned int Magic = 0xCAFE0000; const unsigned int Version = 2; const unsigned int SaveMagic = Magic + Version; -IAGSEngine *AGSParallax::_engine; -int32 AGSParallax::_screenWidth; -int32 AGSParallax::_screenHeight; -int32 AGSParallax::_screenColorDepth; -bool AGSParallax::_enabled; -Sprite AGSParallax::_sprites[MAX_SPRITES]; - - -AGSParallax::AGSParallax() : PluginBase() { - _engine = nullptr; - _screenWidth = 320; - _screenHeight = 200; - _screenColorDepth = 32; - _enabled = false; - - DLL_METHOD(AGS_GetPluginName); - DLL_METHOD(AGS_EngineStartup); - DLL_METHOD(AGS_EngineOnEvent); -} - const char *AGSParallax::AGS_GetPluginName() { return "Parallax plugin recreation"; } void AGSParallax::AGS_EngineStartup(IAGSEngine *engine) { - _engine = engine; + PluginBase::AGS_EngineStartup(engine); if (_engine->version < 13) _engine->AbortGame("Engine interface is too old, need newer version of AGS."); - SCRIPT_METHOD(pxDrawSprite); - SCRIPT_METHOD(pxDeleteSprite); + SCRIPT_METHOD(pxDrawSprite, AGSParallax::pxDrawSprite); + SCRIPT_METHOD(pxDeleteSprite, AGSParallax::pxDeleteSprite); _engine->RequestEventHook(AGSE_PREGUIDRAW); _engine->RequestEventHook(AGSE_PRESCREENDRAW); diff --git a/engines/ags/plugins/ags_parallax/ags_parallax.h b/engines/ags/plugins/ags_parallax/ags_parallax.h index 14416a0fa50..6d6e02c6d77 100644 --- a/engines/ags/plugins/ags_parallax/ags_parallax.h +++ b/engines/ags/plugins/ags_parallax/ags_parallax.h @@ -31,12 +31,12 @@ namespace Plugins { namespace AGSParallax { struct Sprite { -int32 x = 0; -int32 y = 0; -int slot = -1; -int speed = 0; + int32 x = 0; + int32 y = 0; + int slot = -1; + int speed = 0; -void syncGame(Serializer &s); + void syncGame(Serializer &s); }; #define MAX_SPEED 1000 @@ -47,29 +47,30 @@ void syncGame(Serializer &s); * but a workalike plugin created for the AGS engine ports. */ class AGSParallax : public PluginBase { + SCRIPT_HASH(AGSParallax) private: -IAGSEngine *_engine; -int32 _screenWidth; -int32 _screenHeight; -int32 _screenColorDepth; + int32 _screenWidth = 320; + int32 _screenHeight = 200; + int32 _screenColorDepth = 32; -bool _enabled; -Sprite _sprites[MAX_SPRITES]; -private: -const char *AGS_GetPluginName(); -void AGS_EngineStartup(IAGSEngine *lpEngine); -int64 AGS_EngineOnEvent(int event, NumberPtr data); - -void pxDrawSprite(ScriptMethodParams ¶ms); -void pxDeleteSprite(ScriptMethodParams ¶ms); + bool _enabled = false; + Sprite _sprites[MAX_SPRITES]; private: -void syncGame(Serializer &s); -void Draw(bool foreground); -void clear(); + void pxDrawSprite(ScriptMethodParams ¶ms); + void pxDeleteSprite(ScriptMethodParams ¶ms); + + void syncGame(Serializer &s); + void Draw(bool foreground); + void clear(); public: -AGSParallax(); + AGSParallax() : PluginBase() {} + virtual ~AGSParallax() {} + + const char *AGS_GetPluginName() override; + void AGS_EngineStartup(IAGSEngine *lpEngine) override; + int64 AGS_EngineOnEvent(int event, NumberPtr data) override; }; } // namespace AGSParallax diff --git a/engines/ags/plugins/ags_shell/ags_shell.cpp b/engines/ags/plugins/ags_shell/ags_shell.cpp index 910e5013fbe..74a21da4f50 100644 --- a/engines/ags/plugins/ags_shell/ags_shell.cpp +++ b/engines/ags/plugins/ags_shell/ags_shell.cpp @@ -27,25 +27,18 @@ namespace AGS3 { namespace Plugins { namespace AGSShell { -IAGSEngine *AGSShell::_engine; - -AGSShell::AGSShell() : PluginBase() { - DLL_METHOD(AGS_GetPluginName); - DLL_METHOD(AGS_EngineStartup); -} - const char *AGSShell::AGS_GetPluginName() { return "AGS shell plugin"; } void AGSShell::AGS_EngineStartup(IAGSEngine *engine) { - _engine = engine; + PluginBase::AGS_EngineStartup(engine); // Make sure it's got the version with the features we need if (_engine->version < 3) _engine->AbortGame("Plugin needs engine version 3 or newer."); - SCRIPT_METHOD(ShellExecute); + SCRIPT_METHOD(ShellExecute, AGSShell::ShellExecute); } void AGSShell::ShellExecute(ScriptMethodParams ¶ms) { diff --git a/engines/ags/plugins/ags_shell/ags_shell.h b/engines/ags/plugins/ags_shell/ags_shell.h index bf00399d813..d484ce64c14 100644 --- a/engines/ags/plugins/ags_shell/ags_shell.h +++ b/engines/ags/plugins/ags_shell/ags_shell.h @@ -23,24 +23,23 @@ #ifndef AGS_PLUGINS_AGS_SHELL_H #define AGS_PLUGINS_AGS_SHELL_H -#include "ags/plugins/plugin_base.h" +#include "ags/plugins/ags_plugin.h" namespace AGS3 { namespace Plugins { namespace AGSShell { class AGSShell : public PluginBase { + SCRIPT_HASH(AGSShell) private: -IAGSEngine *_engine; -private: -const char *AGS_GetPluginName(); -void AGS_EngineStartup(IAGSEngine *lpEngine); - -private: -void ShellExecute(ScriptMethodParams ¶ms); + void ShellExecute(ScriptMethodParams ¶ms); public: -AGSShell(); + AGSShell() : PluginBase() {} + virtual ~AGSShell() {} + + const char *AGS_GetPluginName() override; + void AGS_EngineStartup(IAGSEngine *lpEngine) override; }; } // namespace AGSShell diff --git a/engines/ags/plugins/ags_snow_rain/ags_snow_rain.cpp b/engines/ags/plugins/ags_snow_rain/ags_snow_rain.cpp index 774800b8755..cd29fa368ff 100644 --- a/engines/ags/plugins/ags_snow_rain/ags_snow_rain.cpp +++ b/engines/ags/plugins/ags_snow_rain/ags_snow_rain.cpp @@ -26,24 +26,9 @@ namespace AGS3 { namespace Plugins { namespace AGSSnowRain { -IAGSEngine *_engine; -int32 _screenWidth; -int32 _screenHeight; -int32 _screenColorDepth; - -Weather *AGSSnowRain::_rain; -Weather *AGSSnowRain::_snow; - -AGSSnowRain::AGSSnowRain() : PluginBase() { - _engine = nullptr; - _screenWidth = 320; - _screenHeight = 200; - _screenColorDepth = 32; - - DLL_METHOD(AGS_GetPluginName); - DLL_METHOD(AGS_EngineStartup); - DLL_METHOD(AGS_EngineShutdown); - DLL_METHOD(AGS_EngineOnEvent); +AGSSnowRain::AGSSnowRain() : PluginBase(), + _rain(false, _screenWidth, _screenHeight, _engine), + _snow(true, _screenWidth, _screenHeight, _engine) { } const char *AGSSnowRain::AGS_GetPluginName() { @@ -52,69 +37,62 @@ const char *AGSSnowRain::AGS_GetPluginName() { } void AGSSnowRain::AGS_EngineStartup(IAGSEngine *engine) { - _engine = engine; + PluginBase::AGS_EngineStartup(engine); if (_engine->version < 13) _engine->AbortGame("Engine interface is too old, need newer version of AGS."); - SCRIPT_METHOD(srSetSnowDriftRange); - SCRIPT_METHOD(srSetSnowDriftSpeed); - SCRIPT_METHOD(srSetSnowFallSpeed); - SCRIPT_METHOD(srChangeSnowAmount); - SCRIPT_METHOD(srSetSnowBaseline); - SCRIPT_METHOD(srSetSnowTransparency); - SCRIPT_METHOD(srSetSnowDefaultView); - SCRIPT_METHOD(srSetSnowWindSpeed); - SCRIPT_METHOD(srSetSnowAmount); - SCRIPT_METHOD(srSetSnowView); + SCRIPT_METHOD(srSetSnowDriftRange, AGSSnowRain::srSetSnowDriftRange); + SCRIPT_METHOD(srSetSnowDriftSpeed, AGSSnowRain::srSetSnowDriftSpeed); + SCRIPT_METHOD(srSetSnowFallSpeed, AGSSnowRain::srSetSnowFallSpeed); + SCRIPT_METHOD(srChangeSnowAmount, AGSSnowRain::srChangeSnowAmount); + SCRIPT_METHOD(srSetSnowBaseline, AGSSnowRain::srSetSnowBaseline); + SCRIPT_METHOD(srSetSnowTransparency, AGSSnowRain::srSetSnowTransparency); + SCRIPT_METHOD(srSetSnowDefaultView, AGSSnowRain::srSetSnowDefaultView); + SCRIPT_METHOD(srSetSnowWindSpeed, AGSSnowRain::srSetSnowWindSpeed); + SCRIPT_METHOD(srSetSnowAmount, AGSSnowRain::srSetSnowAmount); + SCRIPT_METHOD(srSetSnowView, AGSSnowRain::srSetSnowView); - SCRIPT_METHOD(srSetRainDriftRange); - SCRIPT_METHOD(srSetRainDriftSpeed); - SCRIPT_METHOD(srSetRainFallSpeed); - SCRIPT_METHOD(srChangeRainAmount); - SCRIPT_METHOD(srSetRainBaseline); - SCRIPT_METHOD(srSetRainTransparency); - SCRIPT_METHOD(srSetRainDefaultView); - SCRIPT_METHOD(srSetRainWindSpeed); - SCRIPT_METHOD(srSetRainAmount); - SCRIPT_METHOD(srSetRainView); + SCRIPT_METHOD(srSetRainDriftRange, AGSSnowRain::srSetRainDriftRange); + SCRIPT_METHOD(srSetRainDriftSpeed, AGSSnowRain::srSetRainDriftSpeed); + SCRIPT_METHOD(srSetRainFallSpeed, AGSSnowRain::srSetRainFallSpeed); + SCRIPT_METHOD(srChangeRainAmount, AGSSnowRain::srChangeRainAmount); + SCRIPT_METHOD(srSetRainBaseline, AGSSnowRain::srSetRainBaseline); + SCRIPT_METHOD(srSetRainTransparency, AGSSnowRain::srSetRainTransparency); + SCRIPT_METHOD(srSetRainDefaultView, AGSSnowRain::srSetRainDefaultView); + SCRIPT_METHOD(srSetRainWindSpeed, AGSSnowRain::srSetRainWindSpeed); + SCRIPT_METHOD(srSetRainAmount, AGSSnowRain::srSetRainAmount); + SCRIPT_METHOD(srSetRainView, AGSSnowRain::srSetRainView); - SCRIPT_METHOD(srSetWindSpeed); - SCRIPT_METHOD(srSetBaseline); + SCRIPT_METHOD(srSetWindSpeed, AGSSnowRain::srSetWindSpeed); + SCRIPT_METHOD(srSetBaseline, AGSSnowRain::srSetBaseline); _engine->RequestEventHook(AGSE_PREGUIDRAW); _engine->RequestEventHook(AGSE_PRESCREENDRAW); _engine->RequestEventHook(AGSE_ENTERROOM); _engine->RequestEventHook(AGSE_SAVEGAME); _engine->RequestEventHook(AGSE_RESTOREGAME); - - _rain = new Weather(); - _snow = new Weather(true); } -void AGSSnowRain::AGS_EngineShutdown() { - delete _rain; - delete _snow; -} int64 AGSSnowRain::AGS_EngineOnEvent(int event, NumberPtr data) { if (event == AGSE_PREGUIDRAW) { - if (_rain->IsActive()) - _rain->Update(); + if (_rain.IsActive()) + _rain.Update(); - if (_snow->IsActive()) - _snow->UpdateWithDrift(); + if (_snow.IsActive()) + _snow.UpdateWithDrift(); } else if (event == AGSE_ENTERROOM) { - _rain->EnterRoom(); - _snow->EnterRoom(); + _rain.EnterRoom(); + _snow.EnterRoom(); } else if (event == AGSE_RESTOREGAME) { Serializer s(_engine, data, true); - _rain->syncGame(s); - _snow->syncGame(s); + _rain.syncGame(s); + _snow.syncGame(s); } else if (event == AGSE_SAVEGAME) { Serializer s(_engine, data, false); - _rain->syncGame(s); - _snow->syncGame(s); + _rain.syncGame(s); + _snow.syncGame(s); } else if (event == AGSE_PRESCREENDRAW) { // Get screen size once here _engine->GetScreenDimensions(&_screenWidth, &_screenHeight , &_screenColorDepth); @@ -127,114 +105,114 @@ int64 AGSSnowRain::AGS_EngineOnEvent(int event, NumberPtr data) { void AGSSnowRain::srSetWindSpeed(ScriptMethodParams ¶ms) { PARAMS1(int, value); - _snow->SetWindSpeed(value); - _rain->SetWindSpeed(value); + _snow.SetWindSpeed(value); + _rain.SetWindSpeed(value); } void AGSSnowRain::srSetBaseline(ScriptMethodParams ¶ms) { PARAMS2(int, top, int, bottom); - _snow->SetBaseline(top, bottom); - _rain->SetBaseline(top, bottom); + _snow.SetBaseline(top, bottom); + _rain.SetBaseline(top, bottom); } void AGSSnowRain::srSetSnowDriftRange(ScriptMethodParams ¶ms) { PARAMS2(int, min_value, int, max_value); - _snow->SetDriftRange(min_value, max_value); + _snow.SetDriftRange(min_value, max_value); } void AGSSnowRain::srSetSnowDriftSpeed(ScriptMethodParams ¶ms) { PARAMS2(int, min_value, int, max_value); - _snow->SetDriftSpeed(min_value, max_value); + _snow.SetDriftSpeed(min_value, max_value); } void AGSSnowRain::srChangeSnowAmount(ScriptMethodParams ¶ms) { PARAMS1(int, amount); - _snow->ChangeAmount(amount); + _snow.ChangeAmount(amount); } void AGSSnowRain::srSetSnowView(ScriptMethodParams ¶ms) { PARAMS4(int, kind_id, int, event, int, view, int, loop); - _snow->SetView(kind_id, event, view, loop); + _snow.SetView(kind_id, event, view, loop); } void AGSSnowRain::srSetSnowDefaultView(ScriptMethodParams ¶ms) { PARAMS2(int, view, int, loop); - _snow->SetDefaultView(view, loop); + _snow.SetDefaultView(view, loop); } void AGSSnowRain::srSetSnowTransparency(ScriptMethodParams ¶ms) { PARAMS2(int, min_value, int, max_value); - _snow->SetTransparency(min_value, max_value); + _snow.SetTransparency(min_value, max_value); } void AGSSnowRain::srSetSnowWindSpeed(ScriptMethodParams ¶ms) { PARAMS1(int, value); - _snow->SetWindSpeed(value); + _snow.SetWindSpeed(value); } void AGSSnowRain::srSetSnowBaseline(ScriptMethodParams ¶ms) { PARAMS2(int, top, int, bottom); - _snow->SetBaseline(top, bottom); + _snow.SetBaseline(top, bottom); } void AGSSnowRain::srSetSnowAmount(ScriptMethodParams ¶ms) { PARAMS1(int, amount); - _snow->SetAmount(amount); + _snow.SetAmount(amount); } void AGSSnowRain::srSetSnowFallSpeed(ScriptMethodParams ¶ms) { PARAMS2(int, min_value, int, max_value); - _snow->SetFallSpeed(min_value, max_value); + _snow.SetFallSpeed(min_value, max_value); } void AGSSnowRain::srSetRainDriftRange(ScriptMethodParams ¶ms) { PARAMS2(int, min_value, int, max_value); - _rain->SetDriftRange(min_value, max_value); + _rain.SetDriftRange(min_value, max_value); } void AGSSnowRain::srSetRainDriftSpeed(ScriptMethodParams ¶ms) { PARAMS2(int, min_value, int, max_value); - _rain->SetDriftSpeed(min_value, max_value); + _rain.SetDriftSpeed(min_value, max_value); } void AGSSnowRain::srChangeRainAmount(ScriptMethodParams ¶ms) { PARAMS1(int, amount); - _rain->ChangeAmount(amount); + _rain.ChangeAmount(amount); } void AGSSnowRain::srSetRainView(ScriptMethodParams ¶ms) { PARAMS4(int, kind_id, int, event, int, view, int, loop); - _rain->SetView(kind_id, event, view, loop); + _rain.SetView(kind_id, event, view, loop); } void AGSSnowRain::srSetRainDefaultView(ScriptMethodParams ¶ms) { PARAMS2(int, view, int, loop); - _rain->SetDefaultView(view, loop); + _rain.SetDefaultView(view, loop); } void AGSSnowRain::srSetRainTransparency(ScriptMethodParams ¶ms) { PARAMS2(int, min_value, int, max_value); - _rain->SetTransparency(min_value, max_value); + _rain.SetTransparency(min_value, max_value); } void AGSSnowRain::srSetRainWindSpeed(ScriptMethodParams ¶ms) { PARAMS1(int, value); - _rain->SetWindSpeed(value); + _rain.SetWindSpeed(value); } void AGSSnowRain::srSetRainBaseline(ScriptMethodParams ¶ms) { PARAMS2(int, top, int, bottom); - _rain->SetBaseline(top, bottom); + _rain.SetBaseline(top, bottom); } void AGSSnowRain::srSetRainAmount(ScriptMethodParams ¶ms) { PARAMS1(int, amount); - _rain->SetAmount(amount); + _rain.SetAmount(amount); } void AGSSnowRain::srSetRainFallSpeed(ScriptMethodParams ¶ms) { PARAMS2(int, min_value, int, max_value); - _rain->SetFallSpeed(min_value, max_value); + _rain.SetFallSpeed(min_value, max_value); } } // namespace AGSSnowRain diff --git a/engines/ags/plugins/ags_snow_rain/ags_snow_rain.h b/engines/ags/plugins/ags_snow_rain/ags_snow_rain.h index af15dd3f451..705d5ac36ba 100644 --- a/engines/ags/plugins/ags_snow_rain/ags_snow_rain.h +++ b/engines/ags/plugins/ags_snow_rain/ags_snow_rain.h @@ -23,57 +23,56 @@ #ifndef AGS_PLUGINS_AGS_SNOW_RAIN_AGS_SNOW_RAIN_H #define AGS_PLUGINS_AGS_SNOW_RAIN_AGS_SNOW_RAIN_H -#include "ags/plugins/plugin_base.h" +#include "ags/plugins/ags_plugin.h" #include "ags/plugins/ags_snow_rain/weather.h" namespace AGS3 { namespace Plugins { namespace AGSSnowRain { -extern IAGSEngine *_engine; -extern int32 _screenWidth; -extern int32 _screenHeight; -extern int32 _screenColorDepth; - /** * This is not the original AGS SnowRain plugin, but a workalike * plugin created for the AGS engine PSP port. */ class AGSSnowRain : public PluginBase { + SCRIPT_HASH(AGSSnowRain) private: -Weather *_rain; -Weather *_snow; -private: -const char *AGS_GetPluginName(); -void AGS_EngineStartup(IAGSEngine *lpEngine); -void AGS_EngineShutdown(); -int64 AGS_EngineOnEvent(int event, NumberPtr data); + Weather _rain; + Weather _snow; + int32 _screenWidth = 320; + int32 _screenHeight = 200; + int32 _screenColorDepth = 32; private: -void srSetWindSpeed(ScriptMethodParams ¶ms); -void srSetBaseline(ScriptMethodParams ¶ms); -void srSetSnowDriftRange(ScriptMethodParams ¶ms); -void srSetSnowDriftSpeed(ScriptMethodParams ¶ms); -void srChangeSnowAmount(ScriptMethodParams ¶ms); -void srSetSnowView(ScriptMethodParams ¶ms); -void srSetSnowDefaultView(ScriptMethodParams ¶ms); -void srSetSnowTransparency(ScriptMethodParams ¶ms); -void srSetSnowWindSpeed(ScriptMethodParams ¶ms); -void srSetSnowBaseline(ScriptMethodParams ¶ms); -void srSetSnowAmount(ScriptMethodParams ¶ms); -void srSetSnowFallSpeed(ScriptMethodParams ¶ms); -void srSetRainDriftRange(ScriptMethodParams ¶ms); -void srSetRainDriftSpeed(ScriptMethodParams ¶ms); -void srChangeRainAmount(ScriptMethodParams ¶ms); -void srSetRainView(ScriptMethodParams ¶ms); -void srSetRainDefaultView(ScriptMethodParams ¶ms); -void srSetRainTransparency(ScriptMethodParams ¶ms); -void srSetRainWindSpeed(ScriptMethodParams ¶ms); -void srSetRainBaseline(ScriptMethodParams ¶ms); -void srSetRainAmount(ScriptMethodParams ¶ms); -void srSetRainFallSpeed(ScriptMethodParams ¶ms); + void srSetWindSpeed(ScriptMethodParams ¶ms); + void srSetBaseline(ScriptMethodParams ¶ms); + void srSetSnowDriftRange(ScriptMethodParams ¶ms); + void srSetSnowDriftSpeed(ScriptMethodParams ¶ms); + void srChangeSnowAmount(ScriptMethodParams ¶ms); + void srSetSnowView(ScriptMethodParams ¶ms); + void srSetSnowDefaultView(ScriptMethodParams ¶ms); + void srSetSnowTransparency(ScriptMethodParams ¶ms); + void srSetSnowWindSpeed(ScriptMethodParams ¶ms); + void srSetSnowBaseline(ScriptMethodParams ¶ms); + void srSetSnowAmount(ScriptMethodParams ¶ms); + void srSetSnowFallSpeed(ScriptMethodParams ¶ms); + void srSetRainDriftRange(ScriptMethodParams ¶ms); + void srSetRainDriftSpeed(ScriptMethodParams ¶ms); + void srChangeRainAmount(ScriptMethodParams ¶ms); + void srSetRainView(ScriptMethodParams ¶ms); + void srSetRainDefaultView(ScriptMethodParams ¶ms); + void srSetRainTransparency(ScriptMethodParams ¶ms); + void srSetRainWindSpeed(ScriptMethodParams ¶ms); + void srSetRainBaseline(ScriptMethodParams ¶ms); + void srSetRainAmount(ScriptMethodParams ¶ms); + void srSetRainFallSpeed(ScriptMethodParams ¶ms); public: -AGSSnowRain(); + AGSSnowRain(); + virtual ~AGSSnowRain() {} + + const char *AGS_GetPluginName() override; + void AGS_EngineStartup(IAGSEngine *lpEngine) override; + int64 AGS_EngineOnEvent(int event, NumberPtr data) override; }; } // namespace AGSSnowRain diff --git a/engines/ags/plugins/ags_snow_rain/weather.cpp b/engines/ags/plugins/ags_snow_rain/weather.cpp index 68fd082caf2..a0ee89a2b53 100644 --- a/engines/ags/plugins/ags_snow_rain/weather.cpp +++ b/engines/ags/plugins/ags_snow_rain/weather.cpp @@ -49,16 +49,11 @@ void View::syncGame(Serializer &s) { /*------------------------------------------------------------------*/ -Weather::Weather() : _mIsSnow(false) { +Weather::Weather(bool IsSnow, int32 &scrWidth, int32 &scrHeight, IAGSEngine *&engine) : + _mIsSnow(IsSnow), _screenWidth(scrWidth), _screenHeight(scrHeight), _engine(engine) { Initialize(); } -Weather::Weather(bool IsSnow) : _mIsSnow(IsSnow) { - Initialize(); -} - -Weather::~Weather() {} - void Weather::Update() { if (_mTargetAmount > _mAmount) _mAmount++; diff --git a/engines/ags/plugins/ags_snow_rain/weather.h b/engines/ags/plugins/ags_snow_rain/weather.h index a9dc851cf42..09ca343945e 100644 --- a/engines/ags/plugins/ags_snow_rain/weather.h +++ b/engines/ags/plugins/ags_snow_rain/weather.h @@ -31,101 +31,101 @@ namespace Plugins { namespace AGSSnowRain { struct View { -int view = 0; -int loop = 0; -bool is_default = false; -BITMAP *bitmap = nullptr; + int view = 0; + int loop = 0; + bool is_default = false; + BITMAP *bitmap = nullptr; -void syncGame(Serializer &s); + void syncGame(Serializer &s); }; struct Drop { -float x = 0; -float y = 0; -int alpha = 0; -float speed = 0; -int max_y = 0; -int kind_id = 0; -int drift = 0; -float drift_speed = 0; -float drift_offset = 0; + float x = 0; + float y = 0; + int alpha = 0; + float speed = 0; + int max_y = 0; + int kind_id = 0; + int drift = 0; + float drift_speed = 0; + float drift_offset = 0; -void clear() { - x = 0; - y = 0; - alpha = 0; - speed = 0; - max_y = 0; - kind_id = 0; - drift = 0; - drift_speed = 0; - drift_offset = 0; -} + void clear() { + x = 0; + y = 0; + alpha = 0; + speed = 0; + max_y = 0; + kind_id = 0; + drift = 0; + drift_speed = 0; + drift_offset = 0; + } }; class Weather { private: -void ClipToRange(int &variable, int min, int max); + void ClipToRange(int &variable, int min, int max); -bool _mIsSnow; + bool _mIsSnow; + int32 &_screenWidth; + int32 &_screenHeight; + IAGSEngine *&_engine; -int _mMinDrift = 0; -int _mMaxDrift = 0; -int _mDeltaDrift = 0; + int _mMinDrift = 0; + int _mMaxDrift = 0; + int _mDeltaDrift = 0; -int _mMinDriftSpeed = 0; -int _mMaxDriftSpeed = 0; -int _mDeltaDriftSpeed = 0; + int _mMinDriftSpeed = 0; + int _mMaxDriftSpeed = 0; + int _mDeltaDriftSpeed = 0; -int _mAmount = 0; -int _mTargetAmount = 0; + int _mAmount = 0; + int _mTargetAmount = 0; -int _mMinAlpha = 0; -int _mMaxAlpha = 0; -int _mDeltaAlpha = 0; + int _mMinAlpha = 0; + int _mMaxAlpha = 0; + int _mDeltaAlpha = 0; -float _mWindSpeed = 0; + float _mWindSpeed = 0; -int _mTopBaseline = 0; -int _mBottomBaseline = 0; -int _mDeltaBaseline = 0; + int _mTopBaseline = 0; + int _mBottomBaseline = 0; + int _mDeltaBaseline = 0; -int _mMinFallSpeed = 0; -int _mMaxFallSpeed = 0; -int _mDeltaFallSpeed = 0; + int _mMinFallSpeed = 0; + int _mMaxFallSpeed = 0; + int _mDeltaFallSpeed = 0; -Drop _mParticles[2000]; -View _mViews[5]; + Drop _mParticles[2000]; + View _mViews[5]; -bool _mViewsInitialized; + bool _mViewsInitialized; public: -Weather(); -Weather(bool IsSnow); -~Weather(); + Weather(bool IsSnow, int32 &scrWidth, int32 &scrHeight, IAGSEngine *&engine); -void Initialize(); -void InitializeParticles(); + void Initialize(); + void InitializeParticles(); -void syncGame(Serializer &s); -bool ReinitializeViews(); + void syncGame(Serializer &s); + bool ReinitializeViews(); -bool IsActive(); -void Update(); -void UpdateWithDrift(); -void EnterRoom(); - -void SetDriftRange(int min_value, int max_value); -void SetDriftSpeed(int min_value, int max_value); -void ChangeAmount(int amount); -void SetView(int kind_id, int event, int view, int loop); -void SetDefaultView(int view, int loop); -void SetTransparency(int min_value, int max_value); -void SetWindSpeed(int value); -void SetBaseline(int top, int bottom); -void SetAmount(int amount); -void SetFallSpeed(int min_value, int max_value); + bool IsActive(); + void Update(); + void UpdateWithDrift(); + void EnterRoom(); + void SetDriftRange(int min_value, int max_value); + void SetDriftSpeed(int min_value, int max_value); + void ChangeAmount(int amount); + void SetView(int kind_id, int event, int view, int loop); + void SetDefaultView(int view, int loop); + void SetTransparency(int min_value, int max_value); + void SetWindSpeed(int value); + void SetBaseline(int top, int bottom); + void SetAmount(int amount); + void SetFallSpeed(int min_value, int max_value); }; } // namespace AGSSnowRain diff --git a/engines/ags/plugins/ags_sock/ags_sock.cpp b/engines/ags/plugins/ags_sock/ags_sock.cpp index f1f7049dcda..60e364f118a 100644 --- a/engines/ags/plugins/ags_sock/ags_sock.cpp +++ b/engines/ags/plugins/ags_sock/ags_sock.cpp @@ -29,8 +29,6 @@ namespace AGS3 { namespace Plugins { namespace AGSSock { -IAGSEngine *AGSSock::_engine; - struct SockData : public IAGSScriptManagedObject, public Common::Array { public: int Dispose(const char *address, bool force) override { @@ -88,68 +86,61 @@ public: } }; -AGSSock::AGSSock() : PluginBase() { - _engine = nullptr; - - DLL_METHOD(AGS_GetPluginName); - DLL_METHOD(AGS_EngineStartup); -} const char *AGSSock::AGS_GetPluginName() { return "AGS Sock"; } void AGSSock::AGS_EngineStartup(IAGSEngine *engine) { - _engine = engine; - - SCRIPT_METHOD_EXT(SockData::Create^2, SockData_Create); - SCRIPT_METHOD_EXT(SockData::CreateEmpty^0, SockData_CreateEmpty); - SCRIPT_METHOD_EXT(SockData::CreateFromString^1, SockData_CreateFromString); - SCRIPT_METHOD_EXT(SockData::get_Size, SockData_get_Size); - SCRIPT_METHOD_EXT(SockData::set_Size, SockData_set_Size); - SCRIPT_METHOD_EXT(SockData::geti_Chars, SockData_geti_Chars); - SCRIPT_METHOD_EXT(SockData::seti_Chars, SockData_seti_Chars); - SCRIPT_METHOD_EXT(SockData::AsString^0, SockData_AsString); - SCRIPT_METHOD_EXT(SockData::Clear^0, SockData_Clear); - SCRIPT_METHOD_EXT(SockAddr::Create^1, SockAddr_Create); - SCRIPT_METHOD_EXT(SockAddr::CreateFromString^2, SockAddr_CreateFromString); - SCRIPT_METHOD_EXT(SockAddr::CreateFromData^1, SockAddr_CreateFromData); - SCRIPT_METHOD_EXT(SockAddr::CreateIP^2, SockAddr_CreateIP); - SCRIPT_METHOD_EXT(SockAddr::CreateIPv6^2, SockAddr_CreateIPv6); - SCRIPT_METHOD_EXT(SockAddr::get_Port, SockAddr_get_Port); - SCRIPT_METHOD_EXT(SockAddr::set_Port, SockAddr_set_Port); - SCRIPT_METHOD_EXT(SockAddr::get_Address, SockAddr_get_Address); - SCRIPT_METHOD_EXT(SockAddr::set_Address, SockAddr_set_Address); - SCRIPT_METHOD_EXT(SockAddr::get_IP, SockAddr_get_IP); - SCRIPT_METHOD_EXT(SockAddr::set_IP, SockAddr_set_IP); - SCRIPT_METHOD_EXT(SockAddr::GetData^0, SockAddr_GetData); - SCRIPT_METHOD_EXT(Socket::Create^3, Socket_Create); - SCRIPT_METHOD_EXT(Socket::CreateUDP^0, Socket_CreateUDP); - SCRIPT_METHOD_EXT(Socket::CreateTCP^0, Socket_CreateTCP); - SCRIPT_METHOD_EXT(Socket::CreateUDPv6^0, Socket_CreateUDPv6); - SCRIPT_METHOD_EXT(Socket::CreateTCPv6^0, Socket_CreateTCPv6); - SCRIPT_METHOD_EXT(Socket::get_Tag, Socket_get_Tag); - SCRIPT_METHOD_EXT(Socket::set_Tag, Socket_set_Tag); - SCRIPT_METHOD_EXT(Socket::get_Local, Socket_get_Local); - SCRIPT_METHOD_EXT(Socket::get_Remote, Socket_get_Remote); - SCRIPT_METHOD_EXT(Socket::get_Valid, Socket_get_Valid); - SCRIPT_METHOD_EXT(Socket::ErrorString^0, Socket_ErrorString); - SCRIPT_METHOD_EXT(Socket::Bind^1, Socket_Bind); - SCRIPT_METHOD_EXT(Socket::Listen^1, Socket_Listen); - SCRIPT_METHOD_EXT(Socket::Connect^2, Socket_Connect); - SCRIPT_METHOD_EXT(Socket::Accept^0, Socket_Accept); - SCRIPT_METHOD_EXT(Socket::Close^0, Socket_Close); - SCRIPT_METHOD_EXT(Socket::Send^1, Socket_Send); - SCRIPT_METHOD_EXT(Socket::SendTo^2, Socket_SendTo); - SCRIPT_METHOD_EXT(Socket::Recv^0, Socket_Recv); - SCRIPT_METHOD_EXT(Socket::RecvFrom^1, Socket_RecvFrom); - SCRIPT_METHOD_EXT(Socket::SendData^1, Socket_SendData); - SCRIPT_METHOD_EXT(Socket::SendDataTo^2, Socket_SendDataTo); - SCRIPT_METHOD_EXT(Socket::RecvData^0, Socket_RecvData); - SCRIPT_METHOD_EXT(Socket::RecvDataFrom^1, Socket_RecvDataFrom); - SCRIPT_METHOD_EXT(Socket::GetOption^2, Socket_GetOption); - SCRIPT_METHOD_EXT(Socket::SetOption^3, Socket_SetOption); + PluginBase::AGS_EngineStartup(engine); + SCRIPT_METHOD(SockData::Create^2, AGSSock::SockData_Create); + SCRIPT_METHOD(SockData::CreateEmpty^0, AGSSock::SockData_CreateEmpty); + SCRIPT_METHOD(SockData::CreateFromString^1, AGSSock::SockData_CreateFromString); + SCRIPT_METHOD(SockData::get_Size, AGSSock::SockData_get_Size); + SCRIPT_METHOD(SockData::set_Size, AGSSock::SockData_set_Size); + SCRIPT_METHOD(SockData::geti_Chars, AGSSock::SockData_geti_Chars); + SCRIPT_METHOD(SockData::seti_Chars, AGSSock::SockData_seti_Chars); + SCRIPT_METHOD(SockData::AsString^0, AGSSock::SockData_AsString); + SCRIPT_METHOD(SockData::Clear^0, AGSSock::SockData_Clear); + SCRIPT_METHOD(SockAddr::Create^1, AGSSock::SockAddr_Create); + SCRIPT_METHOD(SockAddr::CreateFromString^2, AGSSock::SockAddr_CreateFromString); + SCRIPT_METHOD(SockAddr::CreateFromData^1, AGSSock::SockAddr_CreateFromData); + SCRIPT_METHOD(SockAddr::CreateIP^2, AGSSock::SockAddr_CreateIP); + SCRIPT_METHOD(SockAddr::CreateIPv6^2, AGSSock::SockAddr_CreateIPv6); + SCRIPT_METHOD(SockAddr::get_Port, AGSSock::SockAddr_get_Port); + SCRIPT_METHOD(SockAddr::set_Port, AGSSock::SockAddr_set_Port); + SCRIPT_METHOD(SockAddr::get_Address, AGSSock::SockAddr_get_Address); + SCRIPT_METHOD(SockAddr::set_Address, AGSSock::SockAddr_set_Address); + SCRIPT_METHOD(SockAddr::get_IP, AGSSock::SockAddr_get_IP); + SCRIPT_METHOD(SockAddr::set_IP, AGSSock::SockAddr_set_IP); + SCRIPT_METHOD(SockAddr::GetData^0, AGSSock::SockAddr_GetData); + SCRIPT_METHOD(Socket::Create^3, AGSSock::Socket_Create); + SCRIPT_METHOD(Socket::CreateUDP^0, AGSSock::Socket_CreateUDP); + SCRIPT_METHOD(Socket::CreateTCP^0, AGSSock::Socket_CreateTCP); + SCRIPT_METHOD(Socket::CreateUDPv6^0, AGSSock::Socket_CreateUDPv6); + SCRIPT_METHOD(Socket::CreateTCPv6^0, AGSSock::Socket_CreateTCPv6); + SCRIPT_METHOD(Socket::get_Tag, AGSSock::Socket_get_Tag); + SCRIPT_METHOD(Socket::set_Tag, AGSSock::Socket_set_Tag); + SCRIPT_METHOD(Socket::get_Local, AGSSock::Socket_get_Local); + SCRIPT_METHOD(Socket::get_Remote, AGSSock::Socket_get_Remote); + SCRIPT_METHOD(Socket::get_Valid, AGSSock::Socket_get_Valid); + SCRIPT_METHOD(Socket::ErrorString^0, AGSSock::Socket_ErrorString); + SCRIPT_METHOD(Socket::Bind^1, AGSSock::Socket_Bind); + SCRIPT_METHOD(Socket::Listen^1, AGSSock::Socket_Listen); + SCRIPT_METHOD(Socket::Connect^2, AGSSock::Socket_Connect); + SCRIPT_METHOD(Socket::Accept^0, AGSSock::Socket_Accept); + SCRIPT_METHOD(Socket::Close^0, AGSSock::Socket_Close); + SCRIPT_METHOD(Socket::Send^1, AGSSock::Socket_Send); + SCRIPT_METHOD(Socket::SendTo^2, AGSSock::Socket_SendTo); + SCRIPT_METHOD(Socket::Recv^0, AGSSock::Socket_Recv); + SCRIPT_METHOD(Socket::RecvFrom^1, AGSSock::Socket_RecvFrom); + SCRIPT_METHOD(Socket::SendData^1, AGSSock::Socket_SendData); + SCRIPT_METHOD(Socket::SendDataTo^2, AGSSock::Socket_SendDataTo); + SCRIPT_METHOD(Socket::RecvData^0, AGSSock::Socket_RecvData); + SCRIPT_METHOD(Socket::RecvDataFrom^1, AGSSock::Socket_RecvDataFrom); + SCRIPT_METHOD(Socket::GetOption^2, AGSSock::Socket_GetOption); + SCRIPT_METHOD(Socket::SetOption^3, AGSSock::Socket_SetOption); } void AGSSock::SockData_Create(ScriptMethodParams ¶ms) { diff --git a/engines/ags/plugins/ags_sock/ags_sock.h b/engines/ags/plugins/ags_sock/ags_sock.h index 8dcbc15f162..8c1de1463ef 100644 --- a/engines/ags/plugins/ags_sock/ags_sock.h +++ b/engines/ags/plugins/ags_sock/ags_sock.h @@ -23,19 +23,16 @@ #ifndef AGS_PLUGINS_AGS_SOCK_H #define AGS_PLUGINS_AGS_SOCK_H -#include "ags/plugins/plugin_base.h" +#include "ags/plugins/ags_plugin.h" namespace AGS3 { namespace Plugins { namespace AGSSock { class AGSSock : public PluginBase { + SCRIPT_HASH(AGSSock) private: - IAGSEngine *_engine; - Common::String *_text; -private: - const char *AGS_GetPluginName(); - void AGS_EngineStartup(IAGSEngine *engine) override; + Common::String _text; /** * Creates a new data container with specified size @@ -295,7 +292,12 @@ private: void Socket_SetOption(ScriptMethodParams ¶ms); public: - AGSSock(); + AGSSock() : PluginBase() {} + virtual ~AGSSock() {} + + const char *AGS_GetPluginName() override; + void AGS_EngineStartup(IAGSEngine *engine) override; + }; } // namespace AGSSock diff --git a/engines/ags/plugins/ags_sprite_font/ags_sprite_font.cpp b/engines/ags/plugins/ags_sprite_font/ags_sprite_font.cpp index e5c28070f8e..f3d7ce2ca44 100644 --- a/engines/ags/plugins/ags_sprite_font/ags_sprite_font.cpp +++ b/engines/ags/plugins/ags_sprite_font/ags_sprite_font.cpp @@ -69,29 +69,15 @@ namespace AGSSpriteFont { #pragma endregion -IAGSEngine *AGSSpriteFont::_engine; -SpriteFontRenderer *AGSSpriteFont::_fontRenderer; -VariableWidthSpriteFontRenderer *AGSSpriteFont::_vWidthRenderer; - #define STRINGIFY(s) STRINGIFY_X(s) #define STRINGIFY_X(s) #s -AGSSpriteFont::AGSSpriteFont() : PluginBase() { - _engine = nullptr; - _fontRenderer = nullptr; - _vWidthRenderer = nullptr; - - DLL_METHOD(AGS_GetPluginName); - DLL_METHOD(AGS_EngineStartup); - DLL_METHOD(AGS_EngineShutdown); -} - const char *AGSSpriteFont::AGS_GetPluginName() { return "AGSSpriteFont"; } void AGSSpriteFont::AGS_EngineStartup(IAGSEngine *engine) { - _engine = engine; + PluginBase::AGS_EngineStartup(engine); if (_fontRenderer == nullptr) { _engine->PrintDebugConsole("AGSSpriteFont: Init fixed width renderer"); @@ -105,13 +91,13 @@ void AGSSpriteFont::AGS_EngineStartup(IAGSEngine *engine) { if (_engine->version < MIN_ENGINE_VERSION) _engine->AbortGame("Plugin needs engine version " STRINGIFY(MIN_ENGINE_VERSION) " or newer."); - //register functions + // Register functions _engine->PrintDebugConsole("AGSSpriteFont: Register functions"); - SCRIPT_METHOD(SetSpriteFont); - SCRIPT_METHOD(SetVariableSpriteFont); - SCRIPT_METHOD(SetGlyph); - SCRIPT_METHOD(SetSpacing); - SCRIPT_METHOD(SetLineHeightAdjust); + SCRIPT_METHOD(SetSpriteFont, AGSSpriteFont::SetSpriteFont); + SCRIPT_METHOD(SetVariableSpriteFont, AGSSpriteFont::SetVariableSpriteFont); + SCRIPT_METHOD(SetGlyph, AGSSpriteFont::SetGlyph); + SCRIPT_METHOD(SetSpacing, AGSSpriteFont::SetSpacing); + SCRIPT_METHOD(SetLineHeightAdjust, AGSSpriteFont::SetLineHeightAdjust); } void AGSSpriteFont::AGS_EngineShutdown() { diff --git a/engines/ags/plugins/ags_sprite_font/ags_sprite_font.h b/engines/ags/plugins/ags_sprite_font/ags_sprite_font.h index 2029a4d5282..dec76c55d8d 100644 --- a/engines/ags/plugins/ags_sprite_font/ags_sprite_font.h +++ b/engines/ags/plugins/ags_sprite_font/ags_sprite_font.h @@ -23,7 +23,7 @@ #ifndef AGS_PLUGINS_AGS_SPRITE_FONT_AGS_SPRITE_FONT_H #define AGS_PLUGINS_AGS_SPRITE_FONT_AGS_SPRITE_FONT_H -#include "ags/plugins/plugin_base.h" +#include "ags/plugins/ags_plugin.h" #include "ags/plugins/ags_sprite_font/sprite_font_renderer.h" #include "ags/plugins/ags_sprite_font/variable_width_sprite_font.h" @@ -36,25 +36,25 @@ namespace Plugins { namespace AGSSpriteFont { class AGSSpriteFont : public PluginBase { + SCRIPT_HASH(AGSSpriteFont) protected: -IAGSEngine *_engine; -SpriteFontRenderer *_fontRenderer; -VariableWidthSpriteFontRenderer *_vWidthRenderer; - -protected: -const char *AGS_GetPluginName(); -void AGS_EngineStartup(IAGSEngine *lpEngine); -void AGS_EngineShutdown(); + SpriteFontRenderer *_fontRenderer; + VariableWidthSpriteFontRenderer *_vWidthRenderer; private: -void SetSpriteFont(ScriptMethodParams ¶ms); -void SetVariableSpriteFont(ScriptMethodParams ¶ms); -void SetGlyph(ScriptMethodParams ¶ms); -void SetSpacing(ScriptMethodParams ¶ms); -void SetLineHeightAdjust(ScriptMethodParams ¶ms); + void SetSpriteFont(ScriptMethodParams ¶ms); + void SetVariableSpriteFont(ScriptMethodParams ¶ms); + void SetGlyph(ScriptMethodParams ¶ms); + void SetSpacing(ScriptMethodParams ¶ms); + void SetLineHeightAdjust(ScriptMethodParams ¶ms); public: -AGSSpriteFont(); + AGSSpriteFont() : PluginBase() {} + virtual ~AGSSpriteFont() {} + + const char *AGS_GetPluginName() override; + void AGS_EngineStartup(IAGSEngine *lpEngine) override; + void AGS_EngineShutdown() override; }; } // namespace AGSSpriteFont diff --git a/engines/ags/plugins/ags_sprite_font/ags_sprite_font_clifftop.cpp b/engines/ags/plugins/ags_sprite_font/ags_sprite_font_clifftop.cpp index 21eb879b7e6..a89e5aa74bb 100644 --- a/engines/ags/plugins/ags_sprite_font/ags_sprite_font_clifftop.cpp +++ b/engines/ags/plugins/ags_sprite_font/ags_sprite_font_clifftop.cpp @@ -28,10 +28,6 @@ namespace AGS3 { namespace Plugins { namespace AGSSpriteFont { -AGSSpriteFontClifftopGames::AGSSpriteFontClifftopGames() : AGSSpriteFont() { - DLL_METHOD(AGS_EngineStartup); -} - void AGSSpriteFontClifftopGames::AGS_EngineStartup(IAGSEngine *engine) { // Use custom font renderers // They need to be set before calling AGSSpriteFont::AGS_EngineStartup() @@ -43,7 +39,7 @@ void AGSSpriteFontClifftopGames::AGS_EngineStartup(IAGSEngine *engine) { AGSSpriteFont::AGS_EngineStartup(engine); - SCRIPT_METHOD(SetLineHeightAdjust); + SCRIPT_METHOD(SetLineHeightAdjust, AGSSpriteFontClifftopGames::SetLineHeightAdjust); } void AGSSpriteFontClifftopGames::SetLineHeightAdjust(ScriptMethodParams ¶ms) { diff --git a/engines/ags/plugins/ags_sprite_font/ags_sprite_font_clifftop.h b/engines/ags/plugins/ags_sprite_font/ags_sprite_font_clifftop.h index c1bb7dc2e4c..ebbf327f168 100644 --- a/engines/ags/plugins/ags_sprite_font/ags_sprite_font_clifftop.h +++ b/engines/ags/plugins/ags_sprite_font/ags_sprite_font_clifftop.h @@ -30,13 +30,15 @@ namespace Plugins { namespace AGSSpriteFont { class AGSSpriteFontClifftopGames : public AGSSpriteFont { + SCRIPT_HASH(AGSSpriteFontClifftopGames) private: -void AGS_EngineStartup(IAGSEngine *engine) override; - -void SetLineHeightAdjust(ScriptMethodParams ¶ms); + void SetLineHeightAdjust(ScriptMethodParams ¶ms); public: -AGSSpriteFontClifftopGames(); + AGSSpriteFontClifftopGames() : AGSSpriteFont() {} + virtual ~AGSSpriteFontClifftopGames() {} + + void AGS_EngineStartup(IAGSEngine *engine) override; }; } // namespace AGSSpriteFont diff --git a/engines/ags/plugins/ags_sprite_font/sprite_font_renderer.cpp b/engines/ags/plugins/ags_sprite_font/sprite_font_renderer.cpp index 61d7d99db57..fdc28ce0b1b 100644 --- a/engines/ags/plugins/ags_sprite_font/sprite_font_renderer.cpp +++ b/engines/ags/plugins/ags_sprite_font/sprite_font_renderer.cpp @@ -31,7 +31,6 @@ SpriteFontRenderer::SpriteFontRenderer(IAGSEngine *engine) { _engine = engine; } - SpriteFontRenderer::~SpriteFontRenderer(void) { for (int i = 0; i < (int)_fonts.size(); i++) delete _fonts[i]; diff --git a/engines/ags/plugins/ags_sprite_font/sprite_font_renderer.h b/engines/ags/plugins/ags_sprite_font/sprite_font_renderer.h index 983b8a63c3e..11825d6af61 100644 --- a/engines/ags/plugins/ags_sprite_font/sprite_font_renderer.h +++ b/engines/ags/plugins/ags_sprite_font/sprite_font_renderer.h @@ -32,26 +32,27 @@ namespace Plugins { namespace AGSSpriteFont { class SpriteFontRenderer : public IAGSFontRenderer { -public: -SpriteFontRenderer(IAGSEngine *engine); -virtual ~SpriteFontRenderer(void); -bool LoadFromDisk(int fontNumber, int fontSize) override { - return true; -} -void FreeMemory(int fontNumber) override { } -bool SupportsExtendedCharacters(int fontNumber) override; -int GetTextWidth(const char *text, int fontNumber) override; -int GetTextHeight(const char *text, int fontNumber) override; -void RenderText(const char *text, int fontNumber, BITMAP *destination, int x, int y, int colour) override; -void AdjustYCoordinateForFont(int *ycoord, int fontNumber) override { } -void EnsureTextValidForFont(char *text, int fontNumber) override; -void SetSpriteFont(int fontNum, int sprite, int rows, int columns, int charWidth, int charHeight, int charMin, int charMax, bool use32bit); - protected: -SpriteFont *getFontFor(int fontNum); -void Draw(BITMAP *src, BITMAP *dest, int destx, int desty, int srcx, int srcy, int width, int height); -std::vector _fonts; -IAGSEngine *_engine; + IAGSEngine *_engine; + SpriteFont *getFontFor(int fontNum); + void Draw(BITMAP *src, BITMAP *dest, int destx, int desty, int srcx, int srcy, int width, int height); + std::vector _fonts; + +public: + SpriteFontRenderer(IAGSEngine *engine); + virtual ~SpriteFontRenderer(); + + bool LoadFromDisk(int fontNumber, int fontSize) override { + return true; + } + void FreeMemory(int fontNumber) override { } + bool SupportsExtendedCharacters(int fontNumber) override; + int GetTextWidth(const char *text, int fontNumber) override; + int GetTextHeight(const char *text, int fontNumber) override; + void RenderText(const char *text, int fontNumber, BITMAP *destination, int x, int y, int colour) override; + void AdjustYCoordinateForFont(int *ycoord, int fontNumber) override { } + void EnsureTextValidForFont(char *text, int fontNumber) override; + void SetSpriteFont(int fontNum, int sprite, int rows, int columns, int charWidth, int charHeight, int charMin, int charMax, bool use32bit); }; } // namespace AGSSpriteFont diff --git a/engines/ags/plugins/ags_sprite_font/variable_width_font.cpp b/engines/ags/plugins/ags_sprite_font/variable_width_font.cpp index 226eaeddac1..afd159526fa 100644 --- a/engines/ags/plugins/ags_sprite_font/variable_width_font.cpp +++ b/engines/ags/plugins/ags_sprite_font/variable_width_font.cpp @@ -26,18 +26,6 @@ namespace AGS3 { namespace Plugins { namespace AGSSpriteFont { -VariableWidthFont::VariableWidthFont(void) { - Spacing = 0; - FontReplaced = 0; - SpriteNumber = 0; - LineHeightAdjust = 0; - LineSpacingAdjust = 0; - LineSpacingOverride = 0; -} - - -VariableWidthFont::~VariableWidthFont(void) {} - void VariableWidthFont::SetGlyph(int character, int x, int y, int width, int height) { characters[character].X = x; characters[character].Y = y; diff --git a/engines/ags/plugins/ags_sprite_font/variable_width_font.h b/engines/ags/plugins/ags_sprite_font/variable_width_font.h index 64b3f00e1f2..3488c16c801 100644 --- a/engines/ags/plugins/ags_sprite_font/variable_width_font.h +++ b/engines/ags/plugins/ags_sprite_font/variable_width_font.h @@ -33,17 +33,17 @@ namespace AGSSpriteFont { class VariableWidthFont { public: -VariableWidthFont(void); -~VariableWidthFont(void); -void SetGlyph(int character, int x, int y, int width, int height); -void SetLineHeightAdjust(int LineHeight, int SpacingHeight, int SpacingOverride); -int SpriteNumber; -int FontReplaced; -int Spacing; -int LineHeightAdjust; -int LineSpacingAdjust; -int LineSpacingOverride; -std::map characters; + int SpriteNumber = 0; + int FontReplaced = 0; + int Spacing = 0; + int LineHeightAdjust = 0; + int LineSpacingAdjust = 0; + int LineSpacingOverride = 0; + std::map characters; + +public: + void SetGlyph(int character, int x, int y, int width, int height); + void SetLineHeightAdjust(int LineHeight, int SpacingHeight, int SpacingOverride); }; } // namespace AGSSpriteFont diff --git a/engines/ags/plugins/ags_sprite_font/variable_width_sprite_font.cpp b/engines/ags/plugins/ags_sprite_font/variable_width_sprite_font.cpp index fc9583310d6..0c3fb30c2b0 100644 --- a/engines/ags/plugins/ags_sprite_font/variable_width_sprite_font.cpp +++ b/engines/ags/plugins/ags_sprite_font/variable_width_sprite_font.cpp @@ -31,16 +31,12 @@ VariableWidthSpriteFontRenderer::VariableWidthSpriteFontRenderer(IAGSEngine *eng _engine = engine; } - VariableWidthSpriteFontRenderer::~VariableWidthSpriteFontRenderer(void) { for (int i = 0; i < (int)_fonts.size(); i++) delete _fonts[i]; _fonts.clear(); } - - - bool VariableWidthSpriteFontRenderer::SupportsExtendedCharacters(int fontNumber) { return false; } diff --git a/engines/ags/plugins/ags_sprite_font/variable_width_sprite_font.h b/engines/ags/plugins/ags_sprite_font/variable_width_sprite_font.h index cd64927b8fe..f6a21950bb6 100644 --- a/engines/ags/plugins/ags_sprite_font/variable_width_sprite_font.h +++ b/engines/ags/plugins/ags_sprite_font/variable_width_sprite_font.h @@ -32,29 +32,31 @@ namespace Plugins { namespace AGSSpriteFont { class VariableWidthSpriteFontRenderer : public IAGSFontRenderer { -public: -VariableWidthSpriteFontRenderer(IAGSEngine *engine); -virtual ~VariableWidthSpriteFontRenderer(); -bool LoadFromDisk(int fontNumber, int fontSize) override { - return true; -} -void FreeMemory(int fontNumber) override { } -bool SupportsExtendedCharacters(int fontNumber) override; -int GetTextWidth(const char *text, int fontNumber) override; -int GetTextHeight(const char *text, int fontNumber) override; -void RenderText(const char *text, int fontNumber, BITMAP *destination, int x, int y, int colour) override; -void AdjustYCoordinateForFont(int *ycoord, int fontNumber) override { } -void EnsureTextValidForFont(char *text, int fontNumber) override; -void SetGlyph(int fontNum, int charNum, int x, int y, int width, int height); -void SetSprite(int fontNum, int spriteNum); -void SetSpacing(int fontNum, int spacing); -void SetLineHeightAdjust(int fontNum, int LineHeight, int SpacingHeight, int SpacingOverride); - protected: -IAGSEngine *_engine; -std::vector _fonts; -VariableWidthFont *getFontFor(int fontNum); -void Draw(BITMAP *src, BITMAP *dest, int destx, int desty, int srcx, int srcy, int width, int height); + IAGSEngine *_engine; + std::vector _fonts; + + VariableWidthFont *getFontFor(int fontNum); + void Draw(BITMAP *src, BITMAP *dest, int destx, int desty, int srcx, int srcy, int width, int height); +public: + VariableWidthSpriteFontRenderer(IAGSEngine *engine); + virtual ~VariableWidthSpriteFontRenderer(); + + bool LoadFromDisk(int fontNumber, int fontSize) override { + return true; + } + + void FreeMemory(int fontNumber) override { } + bool SupportsExtendedCharacters(int fontNumber) override; + int GetTextWidth(const char *text, int fontNumber) override; + int GetTextHeight(const char *text, int fontNumber) override; + void RenderText(const char *text, int fontNumber, BITMAP *destination, int x, int y, int colour) override; + void AdjustYCoordinateForFont(int *ycoord, int fontNumber) override { } + void EnsureTextValidForFont(char *text, int fontNumber) override; + void SetGlyph(int fontNum, int charNum, int x, int y, int width, int height); + void SetSprite(int fontNum, int spriteNum); + void SetSpacing(int fontNum, int spacing); + void SetLineHeightAdjust(int fontNum, int LineHeight, int SpacingHeight, int SpacingOverride); }; } // namespace AGSSpriteFont diff --git a/engines/ags/plugins/ags_sprite_font/variable_width_sprite_font_clifftop.h b/engines/ags/plugins/ags_sprite_font/variable_width_sprite_font_clifftop.h index 7795d99e806..d0c80244706 100644 --- a/engines/ags/plugins/ags_sprite_font/variable_width_sprite_font_clifftop.h +++ b/engines/ags/plugins/ags_sprite_font/variable_width_sprite_font_clifftop.h @@ -31,15 +31,15 @@ namespace Plugins { namespace AGSSpriteFont { class VariableWidthSpriteFontRendererClifftop : public VariableWidthSpriteFontRenderer { -public: -VariableWidthSpriteFontRendererClifftop(IAGSEngine *engine); -virtual ~VariableWidthSpriteFontRendererClifftop(void); - -int GetTextHeight(const char *text, int fontNumber) override; -void RenderText(const char *text, int fontNumber, BITMAP *destination, int x, int y, int colour) override; - private: -void Draw(BITMAP *src, BITMAP *dest, int destx, int desty, int srcx, int srcy, int width, int height, int colour); + void Draw(BITMAP *src, BITMAP *dest, int destx, int desty, int srcx, int srcy, int width, int height, int colour); + +public: + VariableWidthSpriteFontRendererClifftop(IAGSEngine *engine); + virtual ~VariableWidthSpriteFontRendererClifftop(void); + + int GetTextHeight(const char *text, int fontNumber) override; + void RenderText(const char *text, int fontNumber, BITMAP *destination, int x, int y, int colour) override; }; } // namespace AGSSpriteFont diff --git a/engines/ags/plugins/ags_tcp_ip/ags_tcp_ip.cpp b/engines/ags/plugins/ags_tcp_ip/ags_tcp_ip.cpp index bad988c624e..3240a8ae633 100644 --- a/engines/ags/plugins/ags_tcp_ip/ags_tcp_ip.cpp +++ b/engines/ags/plugins/ags_tcp_ip/ags_tcp_ip.cpp @@ -20,19 +20,12 @@ * */ -#include "ags/lib/allegro.h" #include "ags/plugins/ags_tcp_ip/ags_tcp_ip.h" namespace AGS3 { namespace Plugins { namespace AGSTcpIp { - -AGSTcpIp::AGSTcpIp() : PluginBase() { - DLL_METHOD(AGS_GetPluginName); - DLL_METHOD(AGS_EngineStartup); -} - const char *AGSTcpIp::AGS_GetPluginName() { return "TCP/IP (a-v-o)"; } diff --git a/engines/ags/plugins/ags_tcp_ip/ags_tcp_ip.h b/engines/ags/plugins/ags_tcp_ip/ags_tcp_ip.h index f0bb6af2b71..6449518ed71 100644 --- a/engines/ags/plugins/ags_tcp_ip/ags_tcp_ip.h +++ b/engines/ags/plugins/ags_tcp_ip/ags_tcp_ip.h @@ -23,7 +23,7 @@ #ifndef AGS_PLUGINS_AGS_TCP_IP_AGS_TCP_IP_H #define AGS_PLUGINS_AGS_TCP_IP_AGS_TCP_IP_H -#include "ags/plugins/plugin_base.h" +#include "ags/plugins/ags_plugin.h" #include "ags/lib/allegro.h" namespace AGS3 { @@ -31,12 +31,13 @@ namespace Plugins { namespace AGSTcpIp { class AGSTcpIp : public PluginBase { -private: -const char *AGS_GetPluginName(); -void AGS_EngineStartup(IAGSEngine *engine) override; - + SCRIPT_HASH(AGSTcpIp) public: -AGSTcpIp(); + AGSTcpIp() : PluginBase() {} + virtual ~AGSTcpIp() {} + + const char *AGS_GetPluginName() override; + void AGS_EngineStartup(IAGSEngine *engine) override; }; } // namespace AGSTcpIp diff --git a/engines/ags/plugins/ags_wadjet_util/ags_wadjet_util.cpp b/engines/ags/plugins/ags_wadjet_util/ags_wadjet_util.cpp index 1ed5716e33e..423748a656e 100644 --- a/engines/ags/plugins/ags_wadjet_util/ags_wadjet_util.cpp +++ b/engines/ags/plugins/ags_wadjet_util/ags_wadjet_util.cpp @@ -27,31 +27,24 @@ namespace AGS3 { namespace Plugins { namespace AGSWadjetUtil { -IAGSEngine *AGSWadjetUtil::_engine; - -AGSWadjetUtil::AGSWadjetUtil() : PluginBase() { - DLL_METHOD(AGS_GetPluginName); - DLL_METHOD(AGS_EngineStartup); -} - const char *AGSWadjetUtil::AGS_GetPluginName() { return "AGSWadjetUtil"; } void AGSWadjetUtil::AGS_EngineStartup(IAGSEngine *engine) { - _engine = engine; + PluginBase::AGS_EngineStartup(engine); // Register functions - SCRIPT_METHOD(IsOnPhone); - SCRIPT_METHOD(FakeKeypress); - SCRIPT_METHOD(IosSetAchievementValue); - SCRIPT_METHOD(IosGetAchievementValue); - SCRIPT_METHOD(IosShowAchievements); - SCRIPT_METHOD(IosResetAchievements); - SCRIPT_METHOD(MobileGetAchievement); - SCRIPT_METHOD(MobileSetAchievement); - SCRIPT_METHOD(MobileShowAchievements); - SCRIPT_METHOD(MobileResetAchievements); + SCRIPT_METHOD(IsOnPhone, AGSWadjetUtil::IsOnPhone); + SCRIPT_METHOD(FakeKeypress, AGSWadjetUtil::FakeKeypress); + SCRIPT_METHOD(IosSetAchievementValue, AGSWadjetUtil::IosSetAchievementValue); + SCRIPT_METHOD(IosGetAchievementValue, AGSWadjetUtil::IosGetAchievementValue); + SCRIPT_METHOD(IosShowAchievements, AGSWadjetUtil::IosShowAchievements); + SCRIPT_METHOD(IosResetAchievements, AGSWadjetUtil::IosResetAchievements); + SCRIPT_METHOD(MobileGetAchievement, AGSWadjetUtil::MobileGetAchievement); + SCRIPT_METHOD(MobileSetAchievement, AGSWadjetUtil::MobileSetAchievement); + SCRIPT_METHOD(MobileShowAchievements, AGSWadjetUtil::MobileShowAchievements); + SCRIPT_METHOD(MobileResetAchievements, AGSWadjetUtil::MobileResetAchievements); } void AGSWadjetUtil::IsOnPhone(ScriptMethodParams ¶ms) { diff --git a/engines/ags/plugins/ags_wadjet_util/ags_wadjet_util.h b/engines/ags/plugins/ags_wadjet_util/ags_wadjet_util.h index a8a0e0857f2..ec063574895 100644 --- a/engines/ags/plugins/ags_wadjet_util/ags_wadjet_util.h +++ b/engines/ags/plugins/ags_wadjet_util/ags_wadjet_util.h @@ -23,33 +23,32 @@ #ifndef AGS_PLUGINS_AGS_WADJET_UTIL_AGS_WADJET_UTIL_H #define AGS_PLUGINS_AGS_WADJET_UTIL_AGS_WADJET_UTIL_H -#include "ags/plugins/plugin_base.h" +#include "ags/plugins/ags_plugin.h" namespace AGS3 { namespace Plugins { namespace AGSWadjetUtil { class AGSWadjetUtil : public PluginBase { + SCRIPT_HASH(AGSWadjetUtil) private: -IAGSEngine *_engine; -private: -const char *AGS_GetPluginName(); -void AGS_EngineStartup(IAGSEngine *lpEngine); - -private: -void IsOnPhone(ScriptMethodParams ¶ms); -void FakeKeypress(ScriptMethodParams ¶ms); -void IosSetAchievementValue(ScriptMethodParams ¶ms); -void IosGetAchievementValue(ScriptMethodParams ¶ms); -void IosShowAchievements(ScriptMethodParams ¶ms); -void IosResetAchievements(ScriptMethodParams ¶ms); -void MobileGetAchievement(ScriptMethodParams ¶ms); -void MobileSetAchievement(ScriptMethodParams ¶ms); -void MobileShowAchievements(ScriptMethodParams ¶ms); -void MobileResetAchievements(ScriptMethodParams ¶ms); + void IsOnPhone(ScriptMethodParams ¶ms); + void FakeKeypress(ScriptMethodParams ¶ms); + void IosSetAchievementValue(ScriptMethodParams ¶ms); + void IosGetAchievementValue(ScriptMethodParams ¶ms); + void IosShowAchievements(ScriptMethodParams ¶ms); + void IosResetAchievements(ScriptMethodParams ¶ms); + void MobileGetAchievement(ScriptMethodParams ¶ms); + void MobileSetAchievement(ScriptMethodParams ¶ms); + void MobileShowAchievements(ScriptMethodParams ¶ms); + void MobileResetAchievements(ScriptMethodParams ¶ms); public: -AGSWadjetUtil(); + AGSWadjetUtil() : PluginBase() {} + virtual ~AGSWadjetUtil() {} + + const char *AGS_GetPluginName() override; + void AGS_EngineStartup(IAGSEngine *lpEngine) override; }; } // namespace AGSWadjetUtil diff --git a/engines/ags/plugins/ags_waves/ags_waves.cpp b/engines/ags/plugins/ags_waves/ags_waves.cpp index 84837d36ac4..75f97887575 100644 --- a/engines/ags/plugins/ags_waves/ags_waves.cpp +++ b/engines/ags/plugins/ags_waves/ags_waves.cpp @@ -26,72 +26,63 @@ namespace AGS3 { namespace Plugins { namespace AGSWaves { -IAGSEngine *AGSWaves::_engine; - -AGSWaves::AGSWaves() : PluginBase() { - _engine = nullptr; - - DLL_METHOD(AGS_GetPluginName); - DLL_METHOD(AGS_EngineStartup); -} - const char *AGSWaves::AGS_GetPluginName() { return "AGS Waves"; } void AGSWaves::AGS_EngineStartup(IAGSEngine *engine) { - _engine = engine; + PluginBase::AGS_EngineStartup(engine); - SCRIPT_METHOD(DrawScreenEffect); - SCRIPT_METHOD(SFX_Play); - SCRIPT_METHOD(SFX_SetVolume); - SCRIPT_METHOD(SFX_GetVolume); - SCRIPT_METHOD(Music_Play); - SCRIPT_METHOD(Music_GetVolume); - SCRIPT_METHOD(Music_SetVolume); - SCRIPT_METHOD(SFX_Stop); - SCRIPT_METHOD(SFX_SetPosition); - SCRIPT_METHOD(SFX_SetGlobalVolume); - SCRIPT_METHOD(Load_SFX); - SCRIPT_METHOD(Audio_Apply_Filter); - SCRIPT_METHOD(Audio_Remove_Filter); - SCRIPT_METHOD(SFX_AllowOverlap); - SCRIPT_METHOD(SFX_Filter); - SCRIPT_METHOD(DrawBlur); - SCRIPT_METHOD(DrawTunnel); - SCRIPT_METHOD(DrawCylinder); - SCRIPT_METHOD(DrawForceField); - SCRIPT_METHOD(Grayscale); - SCRIPT_METHOD(ReadWalkBehindIntoSprite); - SCRIPT_METHOD(AdjustSpriteFont); - SCRIPT_METHOD(SpriteGradient); - SCRIPT_METHOD(Outline); - SCRIPT_METHOD(OutlineOnly); - SCRIPT_METHOD(SaveVariable); - SCRIPT_METHOD(ReadVariable); - SCRIPT_METHOD(GameDoOnceOnly); - SCRIPT_METHOD(SetGDState); - SCRIPT_METHOD(GetGDState); - SCRIPT_METHOD(ResetAllGD); - SCRIPT_METHOD(SpriteSkew); - SCRIPT_METHOD(FireUpdate); - SCRIPT_METHOD(WindUpdate); - SCRIPT_METHOD(SetWindValues); - SCRIPT_METHOD(ReturnWidth); - SCRIPT_METHOD(ReturnHeight); - SCRIPT_METHOD(ReturnNewHeight); - SCRIPT_METHOD(ReturnNewWidth); - SCRIPT_METHOD(Warper); - SCRIPT_METHOD(SetWarper); - SCRIPT_METHOD(RainUpdate); - SCRIPT_METHOD(BlendTwoSprites); - SCRIPT_METHOD(Blend); - SCRIPT_METHOD(Dissolve); - SCRIPT_METHOD(ReverseTransparency); - SCRIPT_METHOD(NoiseCreator); - SCRIPT_METHOD(TintProper); - SCRIPT_METHOD(GetWalkbehindBaserine); - SCRIPT_METHOD(SetWalkbehindBaserine); + SCRIPT_METHOD(DrawScreenEffect, AGSWaves::DrawScreenEffect); + SCRIPT_METHOD(SFX_Play, AGSWaves::SFX_Play); + SCRIPT_METHOD(SFX_SetVolume, AGSWaves::SFX_SetVolume); + SCRIPT_METHOD(SFX_GetVolume, AGSWaves::SFX_GetVolume); + SCRIPT_METHOD(Music_Play, AGSWaves::Music_Play); + SCRIPT_METHOD(Music_GetVolume, AGSWaves::Music_GetVolume); + SCRIPT_METHOD(Music_SetVolume, AGSWaves::Music_SetVolume); + SCRIPT_METHOD(SFX_Stop, AGSWaves::SFX_Stop); + SCRIPT_METHOD(SFX_SetPosition, AGSWaves::SFX_SetPosition); + SCRIPT_METHOD(SFX_SetGlobalVolume, AGSWaves::SFX_SetGlobalVolume); + SCRIPT_METHOD(Load_SFX, AGSWaves::Load_SFX); + SCRIPT_METHOD(Audio_Apply_Filter, AGSWaves::Audio_Apply_Filter); + SCRIPT_METHOD(Audio_Remove_Filter, AGSWaves::Audio_Remove_Filter); + SCRIPT_METHOD(SFX_AllowOverlap, AGSWaves::SFX_AllowOverlap); + SCRIPT_METHOD(SFX_Filter, AGSWaves::SFX_Filter); + SCRIPT_METHOD(DrawBlur, AGSWaves::DrawBlur); + SCRIPT_METHOD(DrawTunnel, AGSWaves::DrawTunnel); + SCRIPT_METHOD(DrawCylinder, AGSWaves::DrawCylinder); + SCRIPT_METHOD(DrawForceField, AGSWaves::DrawForceField); + SCRIPT_METHOD(Grayscale, AGSWaves::Grayscale); + SCRIPT_METHOD(ReadWalkBehindIntoSprite, AGSWaves::ReadWalkBehindIntoSprite); + SCRIPT_METHOD(AdjustSpriteFont, AGSWaves::AdjustSpriteFont); + SCRIPT_METHOD(SpriteGradient, AGSWaves::SpriteGradient); + SCRIPT_METHOD(Outline, AGSWaves::Outline); + SCRIPT_METHOD(OutlineOnly, AGSWaves::OutlineOnly); + SCRIPT_METHOD(SaveVariable, AGSWaves::SaveVariable); + SCRIPT_METHOD(ReadVariable, AGSWaves::ReadVariable); + SCRIPT_METHOD(GameDoOnceOnly, AGSWaves::GameDoOnceOnly); + SCRIPT_METHOD(SetGDState, AGSWaves::SetGDState); + SCRIPT_METHOD(GetGDState, AGSWaves::GetGDState); + SCRIPT_METHOD(ResetAllGD, AGSWaves::ResetAllGD); + SCRIPT_METHOD(SpriteSkew, AGSWaves::SpriteSkew); + SCRIPT_METHOD(FireUpdate, AGSWaves::FireUpdate); + SCRIPT_METHOD(WindUpdate, AGSWaves::WindUpdate); + SCRIPT_METHOD(SetWindValues, AGSWaves::SetWindValues); + SCRIPT_METHOD(ReturnWidth, AGSWaves::ReturnWidth); + SCRIPT_METHOD(ReturnHeight, AGSWaves::ReturnHeight); + SCRIPT_METHOD(ReturnNewHeight, AGSWaves::ReturnNewHeight); + SCRIPT_METHOD(ReturnNewWidth, AGSWaves::ReturnNewWidth); + SCRIPT_METHOD(Warper, AGSWaves::Warper); + SCRIPT_METHOD(SetWarper, AGSWaves::SetWarper); + SCRIPT_METHOD(RainUpdate, AGSWaves::RainUpdate); + SCRIPT_METHOD(BlendTwoSprites, AGSWaves::BlendTwoSprites); + SCRIPT_METHOD(Blend, AGSWaves::Blend); + SCRIPT_METHOD(Dissolve, AGSWaves::Dissolve); + SCRIPT_METHOD(ReverseTransparency, AGSWaves::ReverseTransparency); + SCRIPT_METHOD(NoiseCreator, AGSWaves::NoiseCreator); + SCRIPT_METHOD(TintProper, AGSWaves::TintProper); + SCRIPT_METHOD(GetWalkbehindBaserine, AGSWaves::GetWalkbehindBaserine); + SCRIPT_METHOD(SetWalkbehindBaserine, AGSWaves::SetWalkbehindBaserine); } void AGSWaves::DrawScreenEffect(ScriptMethodParams ¶ms) { diff --git a/engines/ags/plugins/ags_waves/ags_waves.h b/engines/ags/plugins/ags_waves/ags_waves.h index 0e930a982f9..9a0170838e9 100644 --- a/engines/ags/plugins/ags_waves/ags_waves.h +++ b/engines/ags/plugins/ags_waves/ags_waves.h @@ -23,18 +23,14 @@ #ifndef AGS_PLUGINS_AGS_WAVES_AGS_WAVES_H #define AGS_PLUGINS_AGS_WAVES_AGS_WAVES_H -#include "ags/plugins/plugin_base.h" +#include "ags/plugins/ags_plugin.h" namespace AGS3 { namespace Plugins { namespace AGSWaves { class AGSWaves : public PluginBase { -private: - IAGSEngine *_engine; - const char *AGS_GetPluginName(); - void AGS_EngineStartup(IAGSEngine *engine) override; - + SCRIPT_HASH(AGSWaves) private: void DrawScreenEffect(ScriptMethodParams ¶ms); void SFX_Play(ScriptMethodParams ¶ms); @@ -87,7 +83,11 @@ private: void GetWalkbehindBaserine(ScriptMethodParams ¶ms); void SetWalkbehindBaserine(ScriptMethodParams ¶ms); public: - AGSWaves(); + AGSWaves() : PluginBase() {} + virtual ~AGSWaves() {} + + const char *AGS_GetPluginName() override; + void AGS_EngineStartup(IAGSEngine *engine) override; }; } // namespace AGSWaves diff --git a/engines/ags/plugins/plugin_base.cpp b/engines/ags/plugins/plugin_base.cpp index c86f337fe5c..f5336009c33 100644 --- a/engines/ags/plugins/plugin_base.cpp +++ b/engines/ags/plugins/plugin_base.cpp @@ -22,7 +22,6 @@ #include "ags/lib/allegro.h" #include "ags/plugins/plugin_base.h" -/* #include "ags/plugins/ags_agi/ags_agi.h" #include "ags/plugins/ags_blend/ags_blend.h" #include "ags/plugins/ags_clipboard/ags_clipboard.h" @@ -44,7 +43,6 @@ #include "ags/plugins/ags_tcp_ip/ags_tcp_ip.h" #include "ags/plugins/ags_wadjet_util/ags_wadjet_util.h" #include "ags/plugins/ags_waves/ags_waves.h" -*/ #include "ags/ags.h" #include "ags/detection.h" #include "common/str.h" @@ -64,7 +62,7 @@ Plugins::PluginBase *pluginOpen(const char *filename) { break; } } -/* + if (fname.equalsIgnoreCase("ags_tcp_ip")) return new AGSTcpIp::AGSTcpIp(); @@ -132,7 +130,7 @@ Plugins::PluginBase *pluginOpen(const char *filename) { if (fname.equalsIgnoreCase("agswaves")) return new AGSWaves::AGSWaves(); -*/ + debug("Plugin '%s' is not yet supported", fname.c_str()); return nullptr; }