aboutsummaryrefslogtreecommitdiff
path: root/engines/mads/nebular
diff options
context:
space:
mode:
authorPaul Gilbert2014-09-03 22:09:50 -0400
committerPaul Gilbert2014-09-03 22:09:50 -0400
commit82b2b2d65d0398cb1f3a17f421cbf78f52286faa (patch)
tree6926e98ede2ef29bdf89b3ccc08755da8a0a7fd7 /engines/mads/nebular
parent4be8aa8906d1fd72826efcf138f62de5b8cd39b1 (diff)
downloadscummvm-rg350-82b2b2d65d0398cb1f3a17f421cbf78f52286faa.tar.gz
scummvm-rg350-82b2b2d65d0398cb1f3a17f421cbf78f52286faa.tar.bz2
scummvm-rg350-82b2b2d65d0398cb1f3a17f421cbf78f52286faa.zip
MADS: Properly implement drawing to a subset of the screen
Diffstat (limited to 'engines/mads/nebular')
-rw-r--r--engines/mads/nebular/dialogs_nebular.cpp30
-rw-r--r--engines/mads/nebular/dialogs_nebular.h2
-rw-r--r--engines/mads/nebular/menu_nebular.cpp8
3 files changed, 24 insertions, 16 deletions
diff --git a/engines/mads/nebular/dialogs_nebular.cpp b/engines/mads/nebular/dialogs_nebular.cpp
index 5b0fb7b538..ff119536ec 100644
--- a/engines/mads/nebular/dialogs_nebular.cpp
+++ b/engines/mads/nebular/dialogs_nebular.cpp
@@ -346,7 +346,6 @@ void DialogsNebular::showScummVMSaveDialog() {
}
scene->_spriteSlots.reset();
- _vm->_screen._offset.y = 0;
scene->loadScene(scene->_currentSceneId, game._aaName, true);
scene->_userInterface.noInventoryAnim();
game._scene.drawElements(kTransitionFadeIn, false);
@@ -560,7 +559,8 @@ FullScreenDialog::FullScreenDialog(MADSEngine *vm) : _vm(vm) {
}
FullScreenDialog::~FullScreenDialog() {
- _vm->_screen._offset.y = 0;
+ _vm->_screen.resetClipBounds();
+ _vm->_game->_scene.restrictScene();
}
void FullScreenDialog::display() {
@@ -577,7 +577,6 @@ void FullScreenDialog::display() {
scene._currentSceneId = currentSceneId;
scene._nextSceneId = nextSceneId;
- _vm->_screen._offset.y = 22;
_vm->_events->initVars();
game._kernelMode = KERNEL_ROOM_INIT;
@@ -590,11 +589,7 @@ void FullScreenDialog::display() {
_vm->_palette->fadeOut(pal, nullptr, 0, PALETTE_COUNT, 0, 1, 1, 16);
}
- _vm->_screen.empty();
- _vm->_screen.hLine(0, 20, MADS_SCREEN_WIDTH, 2);
- _vm->_screen.hLine(0, 179, MADS_SCREEN_WIDTH, 2);
- game._scene._spriteSlots.fullRefresh();
-
+ // Set Fx state and palette entries
game._fx = _vm->_screenFade == SCREEN_FADE_SMOOTH ? kTransitionFadeIn : kCenterVertTransition;
game._trigger = 0;
@@ -604,6 +599,18 @@ void FullScreenDialog::display() {
_vm->_palette->setEntry(13, 45, 45, 0);
_vm->_palette->setEntry(14, 63, 63, 63);
_vm->_palette->setEntry(15, 45, 45, 45);
+
+
+ // Clear the screen and draw the upper and lower horizontal lines
+ _vm->_screen.empty();
+ _vm->_screen.hLine(0, 20, MADS_SCREEN_WIDTH, 2);
+ _vm->_screen.hLine(0, 179, MADS_SCREEN_WIDTH, 2);
+ _vm->_screen.copyRectToScreen(Common::Rect(0, 0, MADS_SCREEN_WIDTH, MADS_SCREEN_HEIGHT));
+
+ // Restrict the screen to the area between the two lines
+ _vm->_screen.setClipBounds(Common::Rect(0, DIALOG_TOP, MADS_SCREEN_WIDTH,
+ DIALOG_TOP + MADS_SCENE_HEIGHT));
+ _vm->_game->_scene.restrictScene();
}
/*------------------------------------------------------------------------*/
@@ -667,7 +674,7 @@ void GameDialog::display() {
}
GameDialog::~GameDialog() {
- _vm->_screen._offset.y = 0;
+ _vm->_screen.resetClipBounds();
}
void GameDialog::clearLines() {
@@ -868,10 +875,11 @@ void GameDialog::handleEvents() {
_vm->_events->pollEvents();
// Scan for objects in the dialog
- int objIndex = screenObjects.scan(events.currentPos() - _vm->_screen._offset, LAYER_GUI);
+ Common::Point mousePos = events.currentPos() - Common::Point(0, DIALOG_TOP);
+ int objIndex = screenObjects.scan(mousePos, LAYER_GUI);
if (_movedFlag) {
- int yp = events.currentPos().y - _vm->_screen._offset.y;
+ int yp = mousePos.y;
if (yp < screenObjects[1]._bounds.top) {
if (!events._mouseReleased)
_lines[1]._state = DLGSTATE_SELECTED;
diff --git a/engines/mads/nebular/dialogs_nebular.h b/engines/mads/nebular/dialogs_nebular.h
index 1468db38c8..f64f992611 100644
--- a/engines/mads/nebular/dialogs_nebular.h
+++ b/engines/mads/nebular/dialogs_nebular.h
@@ -31,6 +31,8 @@ namespace MADS {
namespace Nebular {
+#define DIALOG_TOP 22
+
enum CapitalizationMode { kUppercase = 0, kLowercase = 1, kUpperAndLower = 2 };
class DialogsNebular : public Dialogs {
diff --git a/engines/mads/nebular/menu_nebular.cpp b/engines/mads/nebular/menu_nebular.cpp
index b0b0c5e003..d5a1d8538d 100644
--- a/engines/mads/nebular/menu_nebular.cpp
+++ b/engines/mads/nebular/menu_nebular.cpp
@@ -35,7 +35,6 @@ namespace Nebular {
#define NEBULAR_MENUSCREEN 990
#define MADS_MENU_Y ((MADS_SCREEN_HEIGHT - MADS_SCENE_HEIGHT) / 2)
#define MADS_MENU_ANIM_DELAY 70
-#define DIALOG_TOP 22
MenuView::MenuView(MADSEngine *vm) : FullScreenDialog(vm) {
_breakFlag = false;
@@ -57,7 +56,6 @@ void MenuView::show() {
while (!_breakFlag && !_vm->shouldQuit()) {
if (_redrawFlag) {
_vm->_game->_scene.drawElements(_vm->_game->_fx, _vm->_game->_fx);
- _vm->_screen.copyRectToScreen(Common::Rect(0, 0, 320, 200));
_redrawFlag = false;
}
@@ -111,10 +109,10 @@ void MainMenu::display() {
// Register the menu item area in the screen objects
MSprite *frame0 = _menuItems[i]->getFrame(0);
Common::Point pt(frame0->_offset.x - (frame0->w / 2),
- frame0->_offset.y - frame0->h + _vm->_screen._offset.y);
+ frame0->_offset.y - frame0->h);
screenObjects.add(
- Common::Rect(pt.x, pt.y, pt.x + frame0->w, pt.y + frame0->h),
- LAYER_GUI, CAT_COMMAND, i);
+ Common::Rect(pt.x, pt.y + DIALOG_TOP, pt.x + frame0->w,
+ pt.y + frame0->h + DIALOG_TOP), LAYER_GUI, CAT_COMMAND, i);
}
// Set the cursor for when it's shown