diff options
Diffstat (limited to 'engines/wintermute/base/base_sub_frame.cpp')
-rw-r--r-- | engines/wintermute/base/base_sub_frame.cpp | 59 |
1 files changed, 55 insertions, 4 deletions
diff --git a/engines/wintermute/base/base_sub_frame.cpp b/engines/wintermute/base/base_sub_frame.cpp index e8e62fb6bc..039e481fe3 100644 --- a/engines/wintermute/base/base_sub_frame.cpp +++ b/engines/wintermute/base/base_sub_frame.cpp @@ -119,7 +119,7 @@ bool BaseSubFrame::loadBuffer(char *buffer, int lifeTime, bool keepLoaded) { Rect32 rect; int r = 255, g = 255, b = 255; int ar = 255, ag = 255, ab = 255, alpha = 255; - bool custoTrans = false; + bool customTrans = false; rect.setEmpty(); char *surfaceFile = nullptr; @@ -134,7 +134,7 @@ bool BaseSubFrame::loadBuffer(char *buffer, int lifeTime, bool keepLoaded) { case TOKEN_TRANSPARENT: parser.scanStr(params, "%d,%d,%d", &r, &g, &b); - custoTrans = true; + customTrans = true; break; case TOKEN_RECT: @@ -191,7 +191,7 @@ bool BaseSubFrame::loadBuffer(char *buffer, int lifeTime, bool keepLoaded) { } if (surfaceFile != nullptr) { - if (custoTrans) { + if (customTrans) { setSurface(surfaceFile, false, r, g, b, lifeTime, keepLoaded); } else { setSurface(surfaceFile, true, 0, 0, 0, lifeTime, keepLoaded); @@ -199,7 +199,7 @@ bool BaseSubFrame::loadBuffer(char *buffer, int lifeTime, bool keepLoaded) { } _alpha = BYTETORGBA(ar, ag, ab, alpha); - if (custoTrans) { + if (customTrans) { _transparent = BYTETORGBA(r, g, b, 0xFF); } @@ -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 ////////////////////////////////////////////////////////////////////////// |