aboutsummaryrefslogtreecommitdiff
path: root/engines/tsage/ringworld2
diff options
context:
space:
mode:
authorPaul Gilbert2014-02-09 10:45:21 -0500
committerPaul Gilbert2014-02-09 10:45:21 -0500
commit4ae6d57a03a013f3072a548548b3ca24743055f7 (patch)
tree4b1183067c4b7124444e914a3615d4486f66cc75 /engines/tsage/ringworld2
parent8c9d7f93436b62ff8f1f8bc98ae3a821ab36c1b6 (diff)
downloadscummvm-rg350-4ae6d57a03a013f3072a548548b3ca24743055f7.tar.gz
scummvm-rg350-4ae6d57a03a013f3072a548548b3ca24743055f7.tar.bz2
scummvm-rg350-4ae6d57a03a013f3072a548548b3ca24743055f7.zip
TSAGE: Fix smoke transparency effect in the R2R drive room
Diffstat (limited to 'engines/tsage/ringworld2')
-rw-r--r--engines/tsage/ringworld2/ringworld2_scenes0.cpp49
-rw-r--r--engines/tsage/ringworld2/ringworld2_scenes0.h2
2 files changed, 37 insertions, 14 deletions
diff --git a/engines/tsage/ringworld2/ringworld2_scenes0.cpp b/engines/tsage/ringworld2/ringworld2_scenes0.cpp
index 9e02fb8a5d..fc7e34bc16 100644
--- a/engines/tsage/ringworld2/ringworld2_scenes0.cpp
+++ b/engines/tsage/ringworld2/ringworld2_scenes0.cpp
@@ -5765,24 +5765,47 @@ bool Scene600::Smoke::startAction(CursorType action, Event &event) {
return false;
}
-GfxSurface Scene600::Smoke::getFrame() {
- GfxSurface frame = SceneActor::getFrame();
+void Scene600::Smoke::draw() {
+ // Effect should always be active on smoke, but since the original had this
+ // check, include it here too
+ if (_effect == EFFECT_NONE) {
+ SceneActor::draw();
+ return;
+ }
- if (_effect != EFFECT_NONE) {
- // Translate the frame using the scene's pixel map
- byte *pixelMap = static_cast<Scene600 *>(R2_GLOBALS._sceneManager._scene)->_pixelMap;
- Graphics::Surface surface = frame.lockSurface();
- byte *srcP = (byte *)surface.getPixels();
+ // Determine the area of the screen to be updated
+ Rect destRect = _bounds;
+ destRect.translate(-g_globals->_sceneManager._scene->_sceneBounds.left,
+ -g_globals->_sceneManager._scene->_sceneBounds.top);
- while (srcP < ((byte *)surface.getBasePtr(0, surface.h))) {
- *srcP = pixelMap[*srcP];
- srcP++;
- }
+ // Get the smoke frame, screen reference, and pixel palette translation map
+ GfxSurface frame = getFrame();
+ Graphics::Surface s = frame.lockSurface();
+ Graphics::Surface screen = g_globals->gfxManager().getSurface().lockSurface();
+ byte *pixelMap = static_cast<Scene600 *>(R2_GLOBALS._sceneManager._scene)->_pixelMap;
- frame.unlockSurface();
+ // Loop through every pixel of the frame. Any pixel of the frame that's not a
+ // tranparency, get the same pixel from the screen background, and shade it using
+ // the scene's pixel translation map
+ for (int yp = 0; yp < s.h; ++yp) {
+ byte *frameSrcP = (byte *)s.getBasePtr(0, yp);
+ byte *screenP = (byte *)screen.getBasePtr(destRect.left, destRect.top + yp);
+
+ for (int xp = 0; xp < s.w; ++xp, ++frameSrcP, ++screenP) {
+ if (*frameSrcP != frame._transColor) {
+ *frameSrcP = pixelMap[*screenP];
+ }
+ }
}
- return frame;
+ // Finished updating the frame
+ frame.unlockSurface();
+ g_globals->gfxManager().getSurface().unlockSurface();
+
+ // Draw the processed frame
+ Region *priorityRegion = g_globals->_sceneManager._scene->_priorities.find(_priority);
+ g_globals->gfxManager().copyFrom(frame, destRect, priorityRegion);
+
}
bool Scene600::Doorway::startAction(CursorType action, Event &event) {
diff --git a/engines/tsage/ringworld2/ringworld2_scenes0.h b/engines/tsage/ringworld2/ringworld2_scenes0.h
index 216039a348..ba93dda652 100644
--- a/engines/tsage/ringworld2/ringworld2_scenes0.h
+++ b/engines/tsage/ringworld2/ringworld2_scenes0.h
@@ -661,7 +661,7 @@ class Scene600 : public SceneExt {
public:
virtual void signal();
virtual bool startAction(CursorType action, Event &event);
- virtual GfxSurface getFrame();
+ virtual void draw();
};
class Doorway : public SceneActor {
public: