[Scummvm-cvs-logs] scummvm master -> b87723f34bfd58019d38b20fc9d97a8106e0aecd
dreammaster
dreammaster at scummvm.org
Sun Jul 27 01:40:57 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:
b87723f34b MADS: Cleanup of menu item positioning
Commit: b87723f34bfd58019d38b20fc9d97a8106e0aecd
https://github.com/scummvm/scummvm/commit/b87723f34bfd58019d38b20fc9d97a8106e0aecd
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2014-07-26T19:40:05-04:00
Commit Message:
MADS: Cleanup of menu item positioning
Changed paths:
engines/mads/nebular/menu_nebular.cpp
engines/mads/nebular/menu_nebular.h
diff --git a/engines/mads/nebular/menu_nebular.cpp b/engines/mads/nebular/menu_nebular.cpp
index 2fbbe3c..b9fc390 100644
--- a/engines/mads/nebular/menu_nebular.cpp
+++ b/engines/mads/nebular/menu_nebular.cpp
@@ -78,13 +78,6 @@ void MenuView::handleEvents() {
/*------------------------------------------------------------------------*/
MainMenu::MainMenu(MADSEngine *vm): MenuView(vm) {
- _itemPosList[0] = Common::Point(12, 68);
- _itemPosList[1] = Common::Point(12, 87);
- _itemPosList[2] = Common::Point(12, 107);
- _itemPosList[3] = Common::Point(184, 75);
- _itemPosList[4] = Common::Point(245, 75);
- _itemPosList[5] = Common::Point(184, 99);
-
Common::fill(&_menuItems[0], &_menuItems[7], (SpriteAsset *)nullptr);
Common::fill(&_menuItemIndexes[0], &_menuItemIndexes[7], -1);
_delayTimeout = 0;
@@ -107,8 +100,17 @@ void MainMenu::display() {
'A', i + 1, EXT_SS, "");
_menuItems[i] = new SpriteAsset(_vm, spritesName, 0);
_menuItemIndexes[i] = scene._sprites.add(_menuItems[i]);
+
+ // 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 / 2));
+ _vm->_game->_screenObjects.add(
+ Common::Rect(pt.x, pt.y, pt.x + frame0->w, pt.y + frame0->h),
+ LAYER_GUI, CAT_COMMAND, i);
}
+ // Set the cursor for when it's shown
_vm->_events->setCursor(CURSOR_ARROW);
}
@@ -127,6 +129,8 @@ void MainMenu::doFrame() {
// Delete any previous sprite slots
scene._spriteSlots.deleteTimer(1);
+ if (_menuItemIndex == -1)
+ scene._spriteSlots.deleteTimer(2);
// If the user has chosen to skip the animation, show the full menu immediately
if (_skipFlag && _menuItemIndex >= 0) {
@@ -176,7 +180,6 @@ void MainMenu::addSpriteSlot() {
}
bool MainMenu::onEvent(Common::Event &event) {
- /*
// Handle keypresses - these can be done at any time, even when the menu items are being drawn
if (event.type == Common::EVENT_KEYDOWN) {
switch (event.kbd.keycode) {
@@ -208,7 +211,7 @@ bool MainMenu::onEvent(Common::Event &event) {
case Common::KEYCODE_s: {
// Goodness knows why, but Rex has a key to restart the menuitem animations
// Restart the animation
- _menuItemIndex = 0;
+ _menuItemIndex = -1;
_skipFlag = false;
_vm->_events->hideCursor();
break;
@@ -222,7 +225,7 @@ bool MainMenu::onEvent(Common::Event &event) {
return true;
}
-
+ /*
int menuIndex;
switch (event.type) {
diff --git a/engines/mads/nebular/menu_nebular.h b/engines/mads/nebular/menu_nebular.h
index 8d0e37d..71a1fec 100644
--- a/engines/mads/nebular/menu_nebular.h
+++ b/engines/mads/nebular/menu_nebular.h
@@ -58,7 +58,6 @@ public:
class MainMenu: public MenuView {
private:
- Common::Point _itemPosList[6];
SpriteAsset *_menuItems[7];
int _menuItemIndexes[7];
int _menuItemIndex;
More information about the Scummvm-git-logs
mailing list