aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorlolbot-iichan2019-05-19 21:55:26 +0300
committerFilippos Karapetis2020-01-11 18:05:39 +0200
commit755d6deb171c46bbf1fa328b90ce1f097a9d58e9 (patch)
treeb853fe20c967372ce1b1c5631a99f6fce549196a /engines
parentb3901a3d57654685f81b31e25e32d6c1cc85c86e (diff)
downloadscummvm-rg350-755d6deb171c46bbf1fa328b90ce1f097a9d58e9.tar.gz
scummvm-rg350-755d6deb171c46bbf1fa328b90ce1f097a9d58e9.tar.bz2
scummvm-rg350-755d6deb171c46bbf1fa328b90ce1f097a9d58e9.zip
WINTERMUTE: Add FoxTail dynamic light methods
FoxTail requires access to SubFrame's pixels to set actor.AlphaColor with lighting map pixel value at x,y of actor's position.
Diffstat (limited to 'engines')
-rw-r--r--engines/wintermute/base/base_sub_frame.cpp51
-rw-r--r--engines/wintermute/base/gfx/osystem/base_surface_osystem.h11
2 files changed, 62 insertions, 0 deletions
diff --git a/engines/wintermute/base/base_sub_frame.cpp b/engines/wintermute/base/base_sub_frame.cpp
index e8e62fb6bc..8ae6a736c7 100644
--- a/engines/wintermute/base/base_sub_frame.cpp
+++ b/engines/wintermute/base/base_sub_frame.cpp
@@ -434,6 +434,57 @@ bool BaseSubFrame::scCallMethod(ScScript *script, ScStack *stack, ScStack *thisS
return STATUS_OK;
}
+#ifdef ENABLE_FOXTAIL
+ //////////////////////////////////////////////////////////////////////////
+ // [FoxTail] GetHeight
+ // Used to find sprite center at methods.script in fix_offset()
+ // Return value is integer
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "GetHeight") == 0) {
+ stack->correctParams(0);
+ if (_surface) {
+ stack->pushInt(_surface->getHeight());
+ } else {
+ stack->pushNULL();
+ }
+ return STATUS_OK;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // [FoxTail] GetWidth
+ // Used to find sprite center at methods.script in fix_offset()
+ // Return value is integer
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "GetWidth") == 0) {
+ stack->correctParams(0);
+ if (_surface) {
+ stack->pushInt(_surface->getWidth());
+ } else {
+ stack->pushNULL();
+ }
+ return STATUS_OK;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // [FoxTail] GetPixelAt
+ // Used for dynamic light at mixing.script in make_RGB() and make_HSV()
+ // Return value is passed to Game.GetRValue(), Game.GetGValue(), etc...
+ //////////////////////////////////////////////////////////////////////////
+ else if (strcmp(name, "GetPixelAt") == 0) {
+ stack->correctParams(2);
+ int x = stack->pop()->getInt();
+ int y = stack->pop()->getInt();
+ byte r, g, b, a;
+ if (_surface && _surface->getPixel(x, y, &r, &g, &b, &a)) {
+ uint32 pixel = BYTETORGBA(r, g, b, a);
+ stack->pushInt(pixel);
+ } else {
+ stack->pushNULL();
+ }
+ return STATUS_OK;
+ }
+#endif
+
//////////////////////////////////////////////////////////////////////////
// SetImage
//////////////////////////////////////////////////////////////////////////
diff --git a/engines/wintermute/base/gfx/osystem/base_surface_osystem.h b/engines/wintermute/base/gfx/osystem/base_surface_osystem.h
index 9fbbe1d498..950cabf28c 100644
--- a/engines/wintermute/base/gfx/osystem/base_surface_osystem.h
+++ b/engines/wintermute/base/gfx/osystem/base_surface_osystem.h
@@ -81,6 +81,17 @@ public:
}
return _height;
}
+ bool getPixel(int x, int y, byte *r, byte *g, byte *b, byte *a) override {
+ if (!_loaded) {
+ finishLoad();
+ }
+ if (_surface) {
+ uint32 pixel = getPixelAt(_surface, x, y);
+ _surface->format.colorToARGB(pixel, *a, *r, *g, *b);
+ return STATUS_OK;
+ }
+ return STATUS_FAILED;
+ }
Graphics::AlphaType getAlphaType() const { return _alphaType; }
private: