[Scummvm-git-logs] scummvm master -> 7352458d5da1e7f659ac61e33f892f126c4f40f9

aquadran noreply at scummvm.org
Mon Nov 18 05:50:43 UTC 2024


This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
7352458d5d WINTERMUTE: Move ShadowManager plugin under 3d scope only


Commit: 7352458d5da1e7f659ac61e33f892f126c4f40f9
    https://github.com/scummvm/scummvm/commit/7352458d5da1e7f659ac61e33f892f126c4f40f9
Author: Paweł Kołodziejski (aquadran at gmail.com)
Date: 2024-11-18T06:50:37+01:00

Commit Message:
WINTERMUTE: Move ShadowManager plugin under 3d scope only

Changed paths:
    engines/wintermute/ext/plugins.h
    engines/wintermute/ext/wme_shadowmanager.cpp
    engines/wintermute/ext/wme_shadowmanager.h
    engines/wintermute/module.mk
    engines/wintermute/persistent.cpp


diff --git a/engines/wintermute/ext/plugins.h b/engines/wintermute/ext/plugins.h
index ed1d84b6784..b1b3957cf33 100644
--- a/engines/wintermute/ext/plugins.h
+++ b/engines/wintermute/ext/plugins.h
@@ -118,6 +118,7 @@ bool EmulatePluginCall(BaseGame *inGame, ScStack *stack, ScStack *thisStack, cha
 		return STATUS_OK;
 	}
 
+#ifdef ENABLE_WME3D
 	//////////////////////////////////////////////////////////////////////////
 	// ShadowManager (from wme_shadows.dll of "Stroke of Fate" duology games)
 	//////////////////////////////////////////////////////////////////////////
@@ -129,7 +130,7 @@ bool EmulatePluginCall(BaseGame *inGame, ScStack *stack, ScStack *thisStack, cha
 		stack->pushNULL();
 		return STATUS_OK;
 	}
-
+#endif
 
 	return STATUS_FAILED;
 }
diff --git a/engines/wintermute/ext/wme_shadowmanager.cpp b/engines/wintermute/ext/wme_shadowmanager.cpp
index 6c1ba3dd93e..fc7a75c76ad 100644
--- a/engines/wintermute/ext/wme_shadowmanager.cpp
+++ b/engines/wintermute/ext/wme_shadowmanager.cpp
@@ -25,7 +25,7 @@
 #include "engines/wintermute/base/base_engine.h"
 #include "engines/wintermute/base/scriptables/script_stack.h"
 #include "engines/wintermute/base/scriptables/script_value.h"
-#include "engines/wintermute/ad/ad_object.h"
+#include "engines/wintermute/ad/ad_actor_3dx.h"
 #include "engines/wintermute/ext/wme_shadowmanager.h"
 #include "engines/wintermute/ext/plugin_event.h"
 
@@ -102,9 +102,12 @@ bool SXShadowManager::scCallMethod(ScScript *script, ScStack *stack, ScStack *th
 	if (strcmp(name, "AddActor") == 0) {
 		stack->correctParams(1);
 
-		AdObject *actorObj = (AdObject *)stack->pop()->getNative();
-		if (actorObj) {
-			stack->pushBool(addActor(actorObj));
+		AdObject *obj = (AdObject *)stack->pop()->getNative();
+		if (obj) {
+			if (strcmp(obj->scGetProperty("Type")->getString(), "actor3dx") == 0) {
+				AdActor3DX *actor = (AdActor3DX *)obj;
+				stack->pushBool(addActor(actor));
+			}
 		}
 
 		return STATUS_OK;
@@ -341,11 +344,9 @@ bool SXShadowManager::persist(BasePersistenceManager *persistMgr) {
 			event._plugin = this
 		};
 		_gameRef->pluginEvents().subscribeEvent(event);
-#ifdef ENABLE_WME3D
 		_actors.clear();
 		// Actor list is not get restored, plugin is not design work this way.
 		// List get refreshed by game script on scene change.
-#endif
 	}
 
 	persistMgr->transferUint32(TMEMBER(_lastTime));
@@ -368,7 +369,6 @@ void SXShadowManager::callback(void *eventData1, void *eventData2) {
 }
 
 void SXShadowManager::update() {
-#ifdef ENABLE_WME3D
 	if (_useSmartShadows) {
 		// TODO: value should be calculated, but for now it's a const
 		_shadowColor = 0x66000000;
@@ -377,7 +377,6 @@ void SXShadowManager::update() {
 			it->first->_shadowColor = _shadowColor;
 		}
 	}
-#endif
 }
 
 void SXShadowManager::run() {
@@ -387,25 +386,18 @@ void SXShadowManager::run() {
 void SXShadowManager::stop() {
 }
 
-bool SXShadowManager::addActor(AdObject *actorObj) {
-#ifdef ENABLE_WME3D
+bool SXShadowManager::addActor(AdActor3DX *actorObj) {
 	if (_useSmartShadows) {
-		if (strcmp(actorObj->scGetProperty("Type")->getString(), "actor3dx") == 0) {
-			AdActor3DX *actor = (AdActor3DX *)actorObj;
-			_actors.push_back(Common::Pair<AdActor3DX *, uint32>(actor, actor->_shadowColor));
-		}
+		_actors.push_back(Common::Pair<AdActor3DX *, uint32>(actorObj, actorObj->_shadowColor));
 	}
-#endif
 	return true;
 }
 
 bool SXShadowManager::removeAllActors() {
-#ifdef ENABLE_WME3D
 	for (auto it = _actors.begin(); it != _actors.end(); ++it) {
 		it->first->_shadowColor = it->second;
 		_actors.erase(it);
 	}
-#endif
 	return true;
 }
 
diff --git a/engines/wintermute/ext/wme_shadowmanager.h b/engines/wintermute/ext/wme_shadowmanager.h
index fc6606e8322..ce53f6b336a 100644
--- a/engines/wintermute/ext/wme_shadowmanager.h
+++ b/engines/wintermute/ext/wme_shadowmanager.h
@@ -26,12 +26,10 @@
 
 #include "engines/wintermute/base/base_scriptable.h"
 
-#ifdef ENABLE_WME3D
-#include "engines/wintermute/ad/ad_actor_3dx.h"
-#endif
-
 namespace Wintermute {
 
+class AdActor3DX;
+
 class SXShadowManager : public BaseScriptable {
 public:
 	DECLARE_PERSISTENT(SXShadowManager, BaseScriptable)
@@ -47,14 +45,12 @@ private:
 	void update();
 	void run();
 	void stop();
-	bool addActor(AdObject *actorObj);
+	bool addActor(AdActor3DX *actorObj);
 	bool removeAllActors();
 	bool enableLight(const char *lightName);
 	bool disableLight(const char *lightName);
 
-#ifdef ENABLE_WME3D
 	Common::List<Common::Pair<AdActor3DX *, uint32>> _actors;
-#endif
 	uint32 _lastTime{};
 	DXVector3 _defaultLightPos;
 	float _minShadow;
diff --git a/engines/wintermute/module.mk b/engines/wintermute/module.mk
index d9fefae3fe5..c664d32ac54 100644
--- a/engines/wintermute/module.mk
+++ b/engines/wintermute/module.mk
@@ -107,7 +107,6 @@ MODULE_OBJS := \
 	ext/wme_3fstatistics.o \
 	ext/wme_commandlinehelper.o \
 	ext/wme_galaxy.o \
-	ext/wme_shadowmanager.o \
 	ext/wme_steam.o \
 	ext/wme_windowmode.o \
 	ext/wme_vlink.o \
@@ -196,7 +195,8 @@ MODULE_OBJS += \
 	base/gfx/opengl/mesh3ds_opengl_shader.o \
 	base/gfx/opengl/shadow_volume_opengl.o \
 	base/gfx/opengl/shadow_volume_opengl_shader.o \
-	base/base_animation_transition_time.o
+	base/base_animation_transition_time.o \
+	ext/wme_shadowmanager.o
 endif
 
 MODULE_DIRS += \
diff --git a/engines/wintermute/persistent.cpp b/engines/wintermute/persistent.cpp
index 130c7ad1cf3..e1985a8f335 100644
--- a/engines/wintermute/persistent.cpp
+++ b/engines/wintermute/persistent.cpp
@@ -85,7 +85,6 @@
 #include "engines/wintermute/ext/wme_steam.h"
 #include "engines/wintermute/ext/wme_galaxy.h"
 #include "engines/wintermute/ext/wme_vlink.h"
-#include "engines/wintermute/ext/wme_shadowmanager.h"
 #include "engines/wintermute/ui/ui_button.h"
 #include "engines/wintermute/ui/ui_edit.h"
 #include "engines/wintermute/ui/ui_entity.h"
@@ -103,6 +102,7 @@
 #include "engines/wintermute/ad/ad_path_point3d.h"
 #include "engines/wintermute/ad/ad_scene_geometry.h"
 #include "engines/wintermute/base/gfx/xmodel.h"
+#include "engines/wintermute/ext/wme_shadowmanager.h"
 #endif
 
 // SystemClass adds these objects to the registry, thus they aren't as leaked as they look
@@ -177,7 +177,6 @@ void SystemClassRegistry::registerClasses() {
 	REGISTER_CLASS(SXWMEGalaxyAPI, false)
 	REGISTER_CLASS(SXCommandLineHelper, false)
 	REGISTER_CLASS(SXVlink, false)
-	REGISTER_CLASS(SXShadowManager, false)
 
 	REGISTER_CLASS(UIButton, false)
 	REGISTER_CLASS(UIEdit, false)
@@ -198,6 +197,7 @@ void SystemClassRegistry::register3DClasses() {
 	REGISTER_CLASS(AdPathPoint3D, false)
 	REGISTER_CLASS(AdSceneGeometry, false)
 	REGISTER_CLASS(XModel, false)
+	REGISTER_CLASS(SXShadowManager, false)
 }
 #endif
 




More information about the Scummvm-git-logs mailing list