From e4ab945b41796912f11b3b51eea8bc9f27dff6ae Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Fri, 26 Jan 2018 07:55:57 -0500 Subject: XEEN: Added further enum values to make falling code clearer --- engines/xeen/interface.cpp | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/engines/xeen/interface.cpp b/engines/xeen/interface.cpp index a46883b028..e8adee383b 100644 --- a/engines/xeen/interface.cpp +++ b/engines/xeen/interface.cpp @@ -40,7 +40,7 @@ namespace Xeen { enum { - SCENE_WINDOW = 11 + SCENE_WINDOW = 11, SCENE_WIDTH = 216, SCENE_HEIGHT = 132 }; PartyDrawer::PartyDrawer(XeenEngine *vm): _vm(vm) { @@ -1297,13 +1297,13 @@ void Interface::handleFalling() { sound.playFX(11); sound.playSound("scream.voc"); - for (int idx = 0, incr = 2; idx < 133; ++incr, idx += incr) { + for (int idx = 0, incr = 2; idx <= SCENE_HEIGHT; ++incr, idx += incr) { fall(idx); assembleBorder(); w.update(); } - fall(132); + fall(SCENE_HEIGHT); assembleBorder(); w.update(); @@ -1311,19 +1311,19 @@ void Interface::handleFalling() { sound.playSound("unnh.voc"); sound.playFX(31); - fall(127); + fall(SCENE_HEIGHT - 5); assembleBorder(); w.update(); - fall(132); + fall(SCENE_HEIGHT); assembleBorder(); w.update(); - fall(129); + fall(SCENE_HEIGHT - 3); assembleBorder(); w.update(); - fall(132); + fall(SCENE_HEIGHT); assembleBorder(); w.update(); @@ -1335,16 +1335,15 @@ void Interface::handleFalling() { void Interface::setupFallSurface(bool isTop) { Window &w = (*g_vm->_windows)[SCENE_WINDOW]; - const Common::Rect &r = w.getBounds(); if (_fallSurface.empty()) - _fallSurface.create(r.width(), r.height() * 2); - _fallSurface.blitFrom(w, Common::Point(0, isTop ? 0 : r.height())); + _fallSurface.create(SCENE_WIDTH, SCENE_HEIGHT * 2); + _fallSurface.blitFrom(w, Common::Point(0, isTop ? 0 : SCENE_HEIGHT)); } void Interface::fall(int yp) { Window &w = (*g_vm->_windows)[SCENE_WINDOW]; - w.blitFrom(_fallSurface, Common::Rect(0, yp, _fallSurface.w, yp + (_fallSurface.h / 2)), Common::Point(0, 0)); + w.blitFrom(_fallSurface, Common::Rect(0, yp, SCENE_WIDTH, yp + SCENE_HEIGHT), Common::Point(0, 0)); } void Interface::shake(int time) { -- cgit v1.2.3