[Scummvm-git-logs] scummvm master -> e4ab945b41796912f11b3b51eea8bc9f27dff6ae

dreammaster dreammaster at scummvm.org
Fri Jan 26 13:56:04 CET 2018


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

Summary:
c5268f6363 XEEN: Further renaming for _falling enum
5b3526e587 XEEN: Implementing falling code
e4ab945b41 XEEN: Added further enum values to make falling code clearer


Commit: c5268f63635f9282b3dc904fb61ebd365a001542
    https://github.com/scummvm/scummvm/commit/c5268f63635f9282b3dc904fb61ebd365a001542
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2018-01-26T07:52:28-05:00

Commit Message:
XEEN: Further renaming for _falling enum

Changed paths:
    engines/xeen/interface.cpp
    engines/xeen/interface.h


diff --git a/engines/xeen/interface.cpp b/engines/xeen/interface.cpp
index 625f9c6..5fec9ad 100644
--- a/engines/xeen/interface.cpp
+++ b/engines/xeen/interface.cpp
@@ -639,7 +639,7 @@ void Interface::doStepCode() {
 		// We can fly, we can.. oh wait, we can't!
 		damage = 100;
 		party._damageType = DT_PHYSICAL;
-		_falling = FALL_1;
+		_falling = FALL_IN_PROGRESS;
 		break;
 	case SURFTYPE_DESERT:
 		// Without navigation skills, simulate getting lost by adding extra time
@@ -649,7 +649,7 @@ void Interface::doStepCode() {
 	case SURFTYPE_CLOUD:
 		if (!party._levitateCount) {
 			party._damageType = DT_PHYSICAL;
-			_falling = FALL_1;
+			_falling = FALL_IN_PROGRESS;
 			damage = 100;
 		}
 		break;
@@ -698,7 +698,7 @@ void Interface::startFalling(bool flag) {
 
 	_falling = FALL_NONE;
 	draw3d(true);
-	_falling = FALL_2;
+	_falling = FALL_START;
 	draw3d(false);
 
 	if (flag && (!isDarkCc || party._fallMaze != 0)) {
@@ -875,7 +875,7 @@ void Interface::startFalling(bool flag) {
 		}
 	}
 
-	_falling = FALL_1;
+	_falling = FALL_IN_PROGRESS;
 	map.load(party._mazeId);
 
 	if (flag) {
@@ -1241,10 +1241,10 @@ void Interface::draw3d(bool updateFlag, bool pauseFlag) {
 	// Handle any darkness-based oscurity
 	obscureScene(_obscurity);
 
-	if (_falling == 1)
+	if (_falling == FALL_IN_PROGRESS)
 		handleFalling();
 
-	if (_falling == 2) {
+	if (_falling == FALL_START) {
 		screen.saveBackground(1);
 	}
 
diff --git a/engines/xeen/interface.h b/engines/xeen/interface.h
index 5051dad..9e6a2a7 100644
--- a/engines/xeen/interface.h
+++ b/engines/xeen/interface.h
@@ -49,8 +49,8 @@ enum IconsMode {
 
 enum FallState {
 	FALL_NONE = 0,
-	FALL_1 = 1,
-	FALL_2 = 2
+	FALL_IN_PROGRESS = 1,
+	FALL_START = 2
 };
 
 #define HILIGHT_CHAR_DISABLED -2


Commit: 5b3526e58712bce866add853418314be33ea1c28
    https://github.com/scummvm/scummvm/commit/5b3526e58712bce866add853418314be33ea1c28
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2018-01-26T07:52:29-05:00

Commit Message:
XEEN: Implementing falling code

Changed paths:
    engines/xeen/interface.cpp
    engines/xeen/interface.h


diff --git a/engines/xeen/interface.cpp b/engines/xeen/interface.cpp
index 5fec9ad..a46883b 100644
--- a/engines/xeen/interface.cpp
+++ b/engines/xeen/interface.cpp
@@ -39,6 +39,10 @@
 
 namespace Xeen {
 
+enum {
+	SCENE_WINDOW = 11
+};
+
 PartyDrawer::PartyDrawer(XeenEngine *vm): _vm(vm) {
 	_restoreSprites.load("restorex.icn");
 	_hpSprites.load("hpbars.icn");
@@ -1220,7 +1224,7 @@ void Interface::draw3d(bool updateFlag, bool pauseFlag) {
 	Windows &windows = *_vm->_windows;
 
 	events.timeMark5();
-	if (windows[11]._enabled)
+	if (windows[SCENE_WINDOW]._enabled)
 		return;
 
 	_flipUIFrame = (_flipUIFrame + 1) % 4;
@@ -1245,7 +1249,7 @@ void Interface::draw3d(bool updateFlag, bool pauseFlag) {
 		handleFalling();
 
 	if (_falling == FALL_START) {
-		screen.saveBackground(1);
+		setupFallSurface(true);
 	}
 
 	assembleBorder();
@@ -1280,10 +1284,12 @@ void Interface::handleFalling() {
 	Sound &sound = *_vm->_sound;
 	Windows &windows = *_vm->_windows;
 	Window &w = windows[3];
-	saveFall();
+
+	Graphics::ManagedSurface savedBg;
+	setupFallSurface(false);
 
 	for (uint idx = 0; idx < party._activeParty.size(); ++idx) {
-		party._activeParty[idx]._faceSprites->draw(windows[0], 4,
+		party._activeParty[idx]._faceSprites->draw(0, 4,
 			Common::Point(Res.CHAR_FACES_X[idx], 150));
 	}
 
@@ -1322,14 +1328,23 @@ void Interface::handleFalling() {
 	w.update();
 
 	shake(10);
+
+	_falling = FALL_NONE;
+	drawParty(true);
 }
 
-void Interface::saveFall() {
-	// TODO
+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()));
 }
 
-void Interface::fall(int v) {
-	// TODO
+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));
 }
 
 void Interface::shake(int time) {
@@ -1861,11 +1876,11 @@ void Interface::spellFX(Character *c) {
 		_spellFxSprites.draw(0, frameNum, Common::Point(
 			Res.CHAR_FACES_X[charIndex], 150));
 
-		if (!windows[11]._enabled)
+		if (!windows[SCENE_WINDOW]._enabled)
 			draw3d(false);
 
 		windows[0].update();
-		events.wait(windows[11]._enabled ? 2 : 1,false);
+		events.wait(windows[SCENE_WINDOW]._enabled ? 2 : 1,false);
 	}
 
 	drawParty(true);
diff --git a/engines/xeen/interface.h b/engines/xeen/interface.h
index 9e6a2a7..321fe52 100644
--- a/engines/xeen/interface.h
+++ b/engines/xeen/interface.h
@@ -92,7 +92,7 @@ private:
 	SpriteResource _blessSprites;
 	SpriteResource _stdIcons;
 	SpriteResource _combatIcons;
-
+	Graphics::ManagedSurface _fallSurface;
 	bool _buttonsLoaded;
 	int _steppingFX;
 	int _blessedUIFrame;
@@ -129,9 +129,18 @@ private:
 	 */
 	void handleFalling();
 
-	void saveFall();
+	/**
+	 * Sets up a passed surface with a double height combination of the previously
+	 * saved scene background and the newly rendered (but not displayed) scene
+	 * below it. This will be used by the fall sequence to vertically shift from the
+	 * prior "upper" scene to the lower ground scene
+	 */
+	void setupFallSurface(bool isTop);
 
-	void fall(int v);
+	/**
+	 * Handles a frame of falling animation
+	 */
+	void fall(int yp);
 
 	/**
 	 * Shake the screen


Commit: e4ab945b41796912f11b3b51eea8bc9f27dff6ae
    https://github.com/scummvm/scummvm/commit/e4ab945b41796912f11b3b51eea8bc9f27dff6ae
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2018-01-26T07:55:57-05:00

Commit Message:
XEEN: Added further enum values to make falling code clearer

Changed paths:
    engines/xeen/interface.cpp


diff --git a/engines/xeen/interface.cpp b/engines/xeen/interface.cpp
index a46883b..e8adee3 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) {





More information about the Scummvm-git-logs mailing list