MADS: Implement the difficulty selection dialog

This commit is contained in:
Paul Gilbert 2014-06-26 22:07:33 -04:00
parent bdee71f279
commit 456ce2a678
5 changed files with 24 additions and 11 deletions

View File

@ -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());
}
}
}

View File

@ -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();

View File

@ -182,7 +182,7 @@ public:
/**
* Destructor
*/
virtual ~ScreenDialog() {}
virtual ~ScreenDialog();
/**
* Show the dialog

View File

@ -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);
}
}
}

View File

@ -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