diff --git a/engines/ags/engine/ac/dynobj/cc_dynamicobject_addr_and_manager.h b/engines/ags/engine/ac/dynobj/cc_dynamicobject_addr_and_manager.h index 416284c8120..91830bee0e5 100644 --- a/engines/ags/engine/ac/dynobj/cc_dynamicobject_addr_and_manager.h +++ b/engines/ags/engine/ac/dynobj/cc_dynamicobject_addr_and_manager.h @@ -23,8 +23,8 @@ #ifndef AGS_ENGINE_AC_DYNOBJ_ADDR_AND_MANAGER_H #define AGS_ENGINE_AC_DYNOBJ_ADDR_AND_MANAGER_H -#include "ags/shared/script/runtimescriptvalue.h" -#include "ags/shared/ac/dynobj/cc_dynamicobject.h" +#include "ags/engine/script/runtimescriptvalue.h" +#include "ags/engine/ac/dynobj/cc_dynamicobject.h" namespace AGS3 { diff --git a/engines/ags/engine/gfx/gfx_util.h b/engines/ags/engine/gfx/gfx_util.h index 7e8f1e6f037..c0ce244f908 100644 --- a/engines/ags/engine/gfx/gfx_util.h +++ b/engines/ags/engine/gfx/gfx_util.h @@ -53,7 +53,7 @@ Bitmap *ConvertBitmap(Bitmap *src, int dst_color_depth); // or fallbacks to common "magic pink" transparency mode; // optionally uses blending alpha (overall image transparency). void DrawSpriteBlend(Bitmap *ds, const Point &ds_at, Bitmap *sprite, - Common::BlendMode blend_mode, bool dst_has_alpha = true, bool src_has_alpha = true, int blend_alpha = 0xFF); + Shared::BlendMode blend_mode, bool dst_has_alpha = true, bool src_has_alpha = true, int blend_alpha = 0xFF); // Draws a bitmap over another one with given alpha level (0 - 255), // takes account of the bitmap's mask color, diff --git a/engines/ags/engine/gui/gui_engine.cpp b/engines/ags/engine/gui/gui_engine.cpp index 97258f53ae1..3a76b334fc2 100644 --- a/engines/ags/engine/gui/gui_engine.cpp +++ b/engines/ags/engine/gui/gui_engine.cpp @@ -27,7 +27,7 @@ //============================================================================= // Headers, as they are in acgui.cpp -#pragma unmanaged +//pragma unmanaged #include "ags/shared/ac/game_version.h" #include "ags/engine/ac/system.h" #include "ags/shared/font/fonts.h" diff --git a/engines/ags/engine/plugin/agsplugin.cpp b/engines/ags/engine/plugin/agsplugin.cpp index 5837511a6cb..6019f9525de 100644 --- a/engines/ags/engine/plugin/agsplugin.cpp +++ b/engines/ags/engine/plugin/agsplugin.cpp @@ -28,58 +28,52 @@ #include "ags/shared/util/wgt2allg.h" #include "ags/shared/ac/common.h" #include "ags/shared/ac/view.h" -#include "ags/shared/ac/charactercache.h" -#include "ags/shared/ac/display.h" -#include "ags/shared/ac/draw.h" -#include "ags/shared/ac/dynamicsprite.h" -#include "ags/shared/ac/gamesetup.h" +#include "ags/engine/ac/charactercache.h" +#include "ags/engine/ac/display.h" +#include "ags/engine/ac/draw.h" +#include "ags/engine/ac/dynamicsprite.h" +#include "ags/engine/ac/gamesetup.h" #include "ags/shared/ac/gamesetupstruct.h" -#include "ags/shared/ac/global_audio.h" -#include "ags/shared/ac/global_plugin.h" -#include "ags/shared/ac/global_walkablearea.h" -#include "ags/shared/ac/keycode.h" -#include "ags/shared/ac/mouse.h" -#include "ags/shared/ac/movelist.h" -#include "ags/shared/ac/objectcache.h" -#include "ags/shared/ac/parser.h" -#include "ags/shared/ac/path_helper.h" -#include "ags/shared/ac/roomstatus.h" -#include "ags/shared/ac/string.h" -#include "ags/shared/ac/dynobj/cc_dynamicobject_addr_and_manager.h" +#include "ags/engine/ac/global_audio.h" +#include "ags/engine/ac/global_plugin.h" +#include "ags/engine/ac/global_walkablearea.h" +#include "ags/engine/ac/keycode.h" +#include "ags/engine/ac/mouse.h" +#include "ags/engine/ac/movelist.h" +#include "ags/engine/ac/objectcache.h" +#include "ags/engine/ac/parser.h" +#include "ags/engine/ac/path_helper.h" +#include "ags/engine/ac/roomstatus.h" +#include "ags/engine/ac/string.h" +#include "ags/engine/ac/dynobj/cc_dynamicobject_addr_and_manager.h" #include "ags/shared/font/fonts.h" #include "ags/shared/util/string_compat.h" -#include "ags/shared/debug/debug_log.h" -#include "ags/shared/debug/debugger.h" -#include "ags/shared/device/mousew32.h" +#include "ags/engine/debugging/debug_log.h" +#include "ags/engine/debugging/debugger.h" +#include "ags/engine/device/mousew32.h" #include "ags/shared/gui/guidefines.h" -#include "ags/shared/main/game_run.h" -#include "ags/shared/main/engine.h" -#include "ags/shared/plugin/agsplugin.h" -#include "ags/shared/plugin/plugin_engine.h" -#include "ags/shared/plugin/plugin_builtin.h" -#include "ags/shared/plugin/pluginobjectreader.h" -#include "ags/shared/script/script.h" -#include "ags/shared/script/script_runtime.h" +#include "ags/engine/main/game_run.h" +#include "ags/engine/main/engine.h" +#include "ags/engine/plugin/agsplugin.h" +#include "ags/engine/plugin/plugin_engine.h" +#include "ags/engine/plugin/plugin_builtin.h" +#include "ags/engine/plugin/pluginobjectreader.h" +#include "ags/engine/script/script.h" +#include "ags/engine/script/script_runtime.h" #include "ags/shared/ac/spritecache.h" #include "ags/shared/util/stream.h" #include "ags/shared/gfx/bitmap.h" -#include "ags/shared/gfx/graphicsdriver.h" -#include "ags/shared/gfx/gfxfilter.h" -#include "ags/shared/script/runtimescriptvalue.h" -#include "ags/shared/debug/out.h" -#include "ags/shared/ac/dynobj/scriptstring.h" -#include "ags/shared/main/graphics_mode.h" -#include "ags/shared/gfx/gfx_util.h" +#include "ags/engine/gfx/graphicsdriver.h" +#include "ags/engine/gfx/gfxfilter.h" +#include "ags/engine/script/runtimescriptvalue.h" +#include "ags/shared/debugging/out.h" +#include "ags/engine/ac/dynobj/scriptstring.h" +#include "ags/engine/main/graphics_mode.h" +#include "ags/engine/gfx/gfx_util.h" #include "ags/shared/util/memory.h" #include "ags/shared/util/filestream.h" -#include "ags/shared/media/audio/audio_system.h" - -namespace AGS3 { - -using namespace AGS::Shared; -using namespace AGS::Shared::Memory; -using namespace AGS::Engine; - +#include "ags/engine/media/audio/audio_system.h" +#include "ags/engine/util/library.h" #if defined(BUILTIN_PLUGINS) #include "ags/shared/../Plugins/AGSflashlight/agsflashlight.h" @@ -92,6 +86,11 @@ using namespace AGS::Engine; #endif // AGS_PLATFORM_OS_IOS #endif // BUILTIN_PLUGINS +namespace AGS3 { + +using namespace AGS::Shared; +using namespace AGS::Shared::Memory; +using namespace AGS::Engine; extern IGraphicsDriver *gfxDriver; extern int mousex, mousey; @@ -117,9 +116,6 @@ extern ScriptString myScriptStringImpl; // **************** PLUGIN IMPLEMENTATION **************** -#include "ags/shared/util/library.h" - - struct EnginePlugin { @@ -260,7 +256,7 @@ unsigned char **IAGSEngine::GetRawBitmapSurface(BITMAP *bmp) { if (stage && bmp == stage->GetAllegroBitmap()) plugins[this->pluginId].invalidatedRegion = 0; - return bmp->line; + return (unsigned char **)bmp->getPixels(); } void IAGSEngine::ReleaseBitmapSurface(BITMAP *bmp) { @@ -554,7 +550,7 @@ void IAGSEngine::PrintDebugConsole(const char *text) { platform->WriteStdOut("[PLUGIN] %s", text); } int IAGSEngine::IsChannelPlaying(int32 channel) { - return ::IsChannelPlaying(channel); + return AGS3::IsChannelPlaying(channel); } void IAGSEngine::PlaySoundChannel(int32 channel, int32 soundType, int32 volume, int32 loop, const char *filename) { stop_and_destroy_channel(channel); @@ -752,19 +748,19 @@ void IAGSEngine::AddManagedObjectReader(const char *typeName, IAGSManagedObjectR numPluginReaders++; } -void IAGSEngine::RegisterUnserializedObject(int key, const void *object, IAGSScriptManagedObject *callback) { +void IAGSEngine::RegisterUnserializedObject(int key_, const void *object, IAGSScriptManagedObject *callback) { GlobalReturnValue.SetPluginObject((void *)object, (ICCDynamicObject *)callback); - ccRegisterUnserializedObject(key, object, (ICCDynamicObject *)callback, true); + ccRegisterUnserializedObject(key_, object, (ICCDynamicObject *)callback, true); } int IAGSEngine::GetManagedObjectKeyByAddress(const char *address) { return ccGetObjectHandleFromAddress(address); } -void *IAGSEngine::GetManagedObjectAddressByKey(int key) { +void *IAGSEngine::GetManagedObjectAddressByKey(int key_) { void *object; ICCDynamicObject *manager; - ScriptValueType obj_type = ccGetObjectAddressAndManagerFromHandle(key, object, manager); + ScriptValueType obj_type = ccGetObjectAddressAndManagerFromHandle(key_, object, manager); if (obj_type == kScValPluginObject) { GlobalReturnValue.SetPluginObject(object, manager); } else { @@ -977,10 +973,10 @@ bool pl_use_builtin_plugin(EnginePlugin *apl) { return false; } -Engine::GameInitError pl_register_plugins(const std::vector &infos) { +Engine::GameInitError pl_register_plugins(const std::vector &infos) { numPlugins = 0; for (size_t inf_index = 0; inf_index < infos.size(); ++inf_index) { - const Common::PluginInfo &info = infos[inf_index]; + const Shared::PluginInfo &info = infos[inf_index]; String name = info.Name; if (name.GetLast() == '!') continue; // editor-only plugin, ignore it diff --git a/engines/ags/engine/plugin/library.cpp b/engines/ags/engine/plugin/library.cpp new file mode 100644 index 00000000000..44c6e1a06a6 --- /dev/null +++ b/engines/ags/engine/plugin/library.cpp @@ -0,0 +1,44 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#include "ags/engine/plugin/library.h" + +namespace AGS3 { + +void *dlopen(const char *filename, bool) { + // TODO: Reimplement plugins as C++ code that's part of the project + return nullptr; +} + +int dlclose(void *) { + return 0; +} + +void *dlsym(void *lib, const char *method) { + return nullptr; +} + +const char *dlerror() { + return nullptr; +} + +} // namespace AGS3 diff --git a/engines/ags/engine/plugin/library.h b/engines/ags/engine/plugin/library.h new file mode 100644 index 00000000000..4679f9c6429 --- /dev/null +++ b/engines/ags/engine/plugin/library.h @@ -0,0 +1,40 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#ifndef AGS_ENGINE_PLUGIN_LIBRARY_H +#define AGS_ENGINE_PLUGIN_LIBRARY_H + +namespace AGS3 { + +#define RTLD_LAZY true + +extern void *dlopen(const char *filename, bool); + +extern int dlclose(void *lib); + +extern void *dlsym(void *lib, const char *method); + +extern const char *dlerror(); + +} // namespace AGS3 + +#endif diff --git a/engines/ags/engine/plugin/plugin_builtin.h b/engines/ags/engine/plugin/plugin_builtin.h index 13538f8a600..3db0f06e60a 100644 --- a/engines/ags/engine/plugin/plugin_builtin.h +++ b/engines/ags/engine/plugin/plugin_builtin.h @@ -35,8 +35,6 @@ namespace AGS3 { class IAGSEngine; -using namespace AGS; // FIXME later - // Initial implementation for apps to register their own inbuilt plugins struct InbuiltPluginDetails { diff --git a/engines/ags/engine/plugin/pluginobjectreader.cpp b/engines/ags/engine/plugin/pluginobjectreader.cpp index 237c7e9370f..c01edae79b3 100644 --- a/engines/ags/engine/plugin/pluginobjectreader.cpp +++ b/engines/ags/engine/plugin/pluginobjectreader.cpp @@ -20,8 +20,8 @@ * */ -#include "ags/shared/plugin/pluginobjectreader.h" -#include "ags/shared/ac/runtime_defines.h" +#include "ags/engine/plugin/pluginobjectreader.h" +#include "ags/engine/ac/runtime_defines.h" namespace AGS3 { diff --git a/engines/ags/engine/util/library.h b/engines/ags/engine/util/library.h index 41d53f5a431..2fe01f20034 100644 --- a/engines/ags/engine/util/library.h +++ b/engines/ags/engine/util/library.h @@ -56,10 +56,10 @@ public: #elif AGS_PLATFORM_OS_LINUX \ || AGS_PLATFORM_OS_MACOS \ || AGS_PLATFORM_OS_ANDROID -#include "ags/shared/library_posix.h" +#include "ags/engine/util/library_posix.h" #elif AGS_PLATFORM_OS_IOS -#include "ags/shared/library_dummy.h" +#include "ags/engine/util/library_dummy.h" #endif diff --git a/engines/ags/engine/util/library_posix.h b/engines/ags/engine/util/library_posix.h index 53692c1f332..ceb39cf21bc 100644 --- a/engines/ags/engine/util/library_posix.h +++ b/engines/ags/engine/util/library_posix.h @@ -26,7 +26,8 @@ //include #include "ags/shared/core/platform.h" #include "ags/shared/util/string.h" -#include "ags/shared/debug/out.h" +#include "ags/shared/debugging/out.h" +#include "ags/engine/plugin/library.h" namespace AGS3 { diff --git a/engines/ags/lib/allegro/color.cpp b/engines/ags/lib/allegro/color.cpp index 45a994e7f7f..6756d1ab2c6 100644 --- a/engines/ags/lib/allegro/color.cpp +++ b/engines/ags/lib/allegro/color.cpp @@ -71,6 +71,13 @@ void set_palette_range(const PALETTE p, int from, int to, int retracesync) { g_system->getPaletteManager()->setPalette(&palette[from], from, to - from + 1); } +int makeacol(int r, int g, int b, int a) { + error("TODO: makeacol"); +} + +int makeacol_depth(int color_depth, int r, int g, int b, int a) { + error("makeacol_depth"); +} int makecol15(int r, int g, int b) { return (((r >> 3) << _rgb_r_shift_15) | @@ -123,4 +130,20 @@ int makecol8(byte r, byte g, byte b) { return (b) | (g << 8) | (r << 16); } +int getr_depth(int color_depth, int c) { + error("TOD: getr_depth"); +} + +int getg_depth(int color_depth, int c) { + error("TOD: getg_depth"); +} + +int getb_depth(int color_depth, int c) { + error("TOD: getb_depth"); +} + +int geta_depth(int color_depth, int c) { + error("TOD: geta_depth"); +} + } // namespace AGS3 diff --git a/engines/ags/lib/allegro/color.h b/engines/ags/lib/allegro/color.h index ddb7ae1e8d6..cc1c86a95e3 100644 --- a/engines/ags/lib/allegro/color.h +++ b/engines/ags/lib/allegro/color.h @@ -70,6 +70,8 @@ AL_FUNC(void, set_color, (int idx, AL_CONST RGB *p)); AL_FUNC(void, set_palette, (AL_CONST PALETTE p)); AL_FUNC(void, set_palette_range, (AL_CONST PALETTE p, int from, int to, int retracesync)); +extern int makeacol(int r, int g, int b, int a); +extern int makeacol_depth(int color_depth, int r, int g, int b, int a); extern int makecol15(int r, int g, int b); extern int makecol16(int r, int g, int b); @@ -82,6 +84,11 @@ extern int getb8(int c); extern int makecol(byte r, byte g, byte b); extern int makecol8(byte r, byte g, byte b); +extern int getr_depth(int color_depth, int c); +extern int getg_depth(int color_depth, int c); +extern int getb_depth(int color_depth, int c); +extern int geta_depth(int color_depth, int c); + } // namespace AGS3 #endif diff --git a/engines/ags/lib/allegro/gfx.cpp b/engines/ags/lib/allegro/gfx.cpp index e5ccd68ec87..153a00be728 100644 --- a/engines/ags/lib/allegro/gfx.cpp +++ b/engines/ags/lib/allegro/gfx.cpp @@ -244,6 +244,10 @@ bool is_planar_bitmap(BITMAP *bmp) { return false; } +bool is_linear_bitmap(BITMAP *bmp) { + return true; +} + void bmp_select(BITMAP *bmp) { // No implementation needed } diff --git a/engines/ags/lib/allegro/gfx.h b/engines/ags/lib/allegro/gfx.h index 737ddb3802c..95cd8104c88 100644 --- a/engines/ags/lib/allegro/gfx.h +++ b/engines/ags/lib/allegro/gfx.h @@ -236,6 +236,7 @@ extern void pivot_sprite(BITMAP *bmp, const BITMAP *sprite, int x, int y, int cx extern bool is_screen_bitmap(BITMAP *bmp); extern bool is_video_bitmap(BITMAP *bmp); +extern bool is_linear_bitmap(BITMAP *bmp); extern bool is_planar_bitmap(BITMAP *bmp); extern void bmp_select(BITMAP *bmp); extern long bmp_write_line(BITMAP *bmp, int line); diff --git a/engines/ags/module.mk b/engines/ags/module.mk index 47674e66428..8df0808d72f 100644 --- a/engines/ags/module.mk +++ b/engines/ags/module.mk @@ -104,7 +104,9 @@ MODULE_OBJS = \ engine/platform/base/agsplatformdriver.o \ engine/platform/windows/acplwin.o \ engine/platform/windows/minidump.o \ - engine/platform/windows/win_ex_handling.o + engine/platform/windows/win_ex_handling.o \ + engine/plugin/agsplugin.o \ + engine/plugin/pluginobjectreader.o # This module can be built as a plugin