[Scummvm-cvs-logs] scummvm master -> 456ce2a678557c7b9e15493448a18be3040efcf7

dreammaster dreammaster at scummvm.org
Fri Jun 27 04:08:15 CEST 2014


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

Summary:
456ce2a678 MADS: Implement the difficulty selection dialog


Commit: 456ce2a678557c7b9e15493448a18be3040efcf7
    https://github.com/scummvm/scummvm/commit/456ce2a678557c7b9e15493448a18be3040efcf7
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2014-06-26T22:07:33-04:00

Commit Message:
MADS: Implement the difficulty selection dialog

Changed paths:
    engines/mads/messages.cpp
    engines/mads/nebular/dialogs_nebular.cpp
    engines/mads/nebular/dialogs_nebular.h
    engines/mads/screen.cpp
    engines/mads/sprites.cpp



diff --git a/engines/mads/messages.cpp b/engines/mads/messages.cpp
index 9b2d6f3..d416960 100644
--- a/engines/mads/messages.cpp
+++ b/engines/mads/messages.cpp
@@ -546,10 +546,10 @@ void TextDisplayList::draw(MSurface *s) {
 	for (uint idx = 0; idx < size(); ++idx) {
 		TextDisplay &td = (*this)[idx];
 		if (td._active && (td._expire >= 0)) {
+			Common::Point destPos(td._bounds.left + _vm->_screen._offset.x,
+				td._bounds.top + _vm->_screen._offset.y);
 			td._font->setColors(0xFF, td._color1, td._color2, 0);
-			td._font->writeString(s, td._msg,
-				Common::Point(td._bounds.left, td._bounds.top),
-				td._spacing, td._bounds.width());
+			td._font->writeString(s, td._msg, destPos, td._spacing, td._bounds.width());
 		}
 	}
 }
diff --git a/engines/mads/nebular/dialogs_nebular.cpp b/engines/mads/nebular/dialogs_nebular.cpp
index 36858a4..6f75c21 100644
--- a/engines/mads/nebular/dialogs_nebular.cpp
+++ b/engines/mads/nebular/dialogs_nebular.cpp
@@ -270,11 +270,9 @@ void DialogsNebular::showDialog() {
 		//GameMenuDialog::show();
 		break;
 	case DIALOG_DIFFICULTY: {
-/*
 		DifficultyDialog *dlg = new DifficultyDialog(_vm);
 		dlg->show();
 		delete dlg;
-*/
 		break;
 	}
 	default:
@@ -526,7 +524,7 @@ ScreenDialog::ScreenDialog(MADSEngine *vm) : _vm(vm) {
 	scene._priorSceneId = priorSceneId;
 	scene._currentSceneId = currentSceneId;
 	scene._nextSceneId = nextSceneId;
-	scene._posAdjust.y = 22;
+	_vm->_screen._offset.y = 22;
 	_vm->_sound->pauseNewCommands();
 	_vm->_events->initVars();
 	game._kernelMode = KERNEL_ROOM_INIT;
@@ -544,7 +542,8 @@ ScreenDialog::ScreenDialog(MADSEngine *vm) : _vm(vm) {
 	}
 
 	_vm->_screen.empty();
-	_vm->_screen.hLine(0, 0, MADS_SCREEN_WIDTH, 2);
+	_vm->_screen.hLine(0, 20, MADS_SCREEN_WIDTH, 2);
+	_vm->_screen.hLine(0, 179, MADS_SCREEN_WIDTH, 2);
 
 	game._fx = _vm->_screenFade == SCREEN_FADE_SMOOTH ? kTransitionFadeIn : kCenterVertTransition;
 	game._trigger = 0;
@@ -560,6 +559,10 @@ ScreenDialog::ScreenDialog(MADSEngine *vm) : _vm(vm) {
 	_lineIndex = -1;
 }
 
+ScreenDialog::~ScreenDialog() {
+	_vm->_screen._offset.y = 0;
+}
+
 void ScreenDialog::clearLines() {
 	Scene &scene = _vm->_game->_scene;
 	_v2 = 0;
@@ -704,11 +707,17 @@ void ScreenDialog::chooseBackground() {
 
 void ScreenDialog::setFrame(int frameNumber, int depth) {
 	Scene &scene = _vm->_game->_scene;
+	SpriteAsset *menuSprites = scene._sprites[_menuSpritesIndex];
+	MSprite *frame = menuSprites->getFrame(frameNumber - 1);
+
 	SpriteSlot &spriteSlot = scene._spriteSlots[scene._spriteSlots.add()];
 	spriteSlot._flags = IMG_UPDATE;
 	spriteSlot._seqIndex = 1;
 	spriteSlot._spritesIndex = _menuSpritesIndex;
 	spriteSlot._frameNumber = frameNumber;
+	spriteSlot._position = frame->_offset;
+	spriteSlot._depth = depth;
+	spriteSlot._scale = 100;
 }
 
 void ScreenDialog::show() {
@@ -861,13 +870,13 @@ void DifficultyDialog::show() {
 
 	switch (_selectedLine) {
 	case 1:
-		game._difficulty = Nebular::DIFFICULTY_HARD;
+		game._difficulty = Nebular::DIFFICULTY_EASY;
 		break;
 	case 2:
 		game._difficulty = Nebular::DIFFICULTY_MEDIUM;
 		break;
 	case 3:
-		game._difficulty = Nebular::DIFFICULTY_EASY;
+		game._difficulty = Nebular::DIFFICULTY_HARD;
 		break;
 	default:
 		_vm->quitGame();
diff --git a/engines/mads/nebular/dialogs_nebular.h b/engines/mads/nebular/dialogs_nebular.h
index a144ee9..39d0a31 100644
--- a/engines/mads/nebular/dialogs_nebular.h
+++ b/engines/mads/nebular/dialogs_nebular.h
@@ -182,7 +182,7 @@ public:
 	/**
 	 * Destructor
 	 */
-	virtual ~ScreenDialog() {}
+	virtual ~ScreenDialog();
 
 	/**
 	 * Show the dialog
diff --git a/engines/mads/screen.cpp b/engines/mads/screen.cpp
index 7e8710d..2842686 100644
--- a/engines/mads/screen.cpp
+++ b/engines/mads/screen.cpp
@@ -212,9 +212,11 @@ void DirtyAreas::copy(MSurface *srcSurface, MSurface *destSurface, const Common:
 
 		Common::Rect bounds(srcBounds.left + posAdjust.x, srcBounds.top + posAdjust.y,
 			srcBounds.right + posAdjust.x, srcBounds.bottom + posAdjust.y);
+		Common::Point destPos(bounds.left + _vm->_screen._offset.x,
+			bounds.top + _vm->_screen._offset.y);
 
 		if ((*this)[i]._active && bounds.isValidRect()) {
-			srcSurface->copyTo(destSurface, bounds, Common::Point(bounds.left, bounds.top));
+			srcSurface->copyTo(destSurface, bounds, destPos);
 		}
 	}
 }
diff --git a/engines/mads/sprites.cpp b/engines/mads/sprites.cpp
index cd35807..2bf13ee 100644
--- a/engines/mads/sprites.cpp
+++ b/engines/mads/sprites.cpp
@@ -331,6 +331,8 @@ void SpriteSlots::drawSprites(MSurface *s) {
 				xp = slot._position.x - (sprite->w / 2) - scene._posAdjust.x;
 				yp = slot._position.y - sprite->h - scene._posAdjust.y + 1;
 			}
+			xp += _vm->_screen._offset.x;
+			yp += _vm->_screen._offset.y;
 
 			if (slot._depth > 1) {
 				// Draw the frame with depth processing






More information about the Scummvm-git-logs mailing list