aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStrangerke2013-09-18 07:47:52 +0200
committerStrangerke2013-09-18 07:47:52 +0200
commit8be433b96066bbdee815ef719815a2904ef2621b (patch)
tree5ce9f8e75cd3c1878bbb302d390702d90e99cd69
parent7790b4cc5bbbc895d9ee8f2dc09d259f231b85f0 (diff)
downloadscummvm-rg350-8be433b96066bbdee815ef719815a2904ef2621b.tar.gz
scummvm-rg350-8be433b96066bbdee815ef719815a2904ef2621b.tar.bz2
scummvm-rg350-8be433b96066bbdee815ef719815a2904ef2621b.zip
AVALANCHE: Rename DropDown into Menu, add some access functions
-rw-r--r--engines/avalanche/animation.cpp4
-rw-r--r--engines/avalanche/avalanche.cpp6
-rw-r--r--engines/avalanche/avalanche.h4
-rw-r--r--engines/avalanche/avalot.cpp8
-rw-r--r--engines/avalanche/celer.cpp2
-rw-r--r--engines/avalanche/gyro.cpp2
-rw-r--r--engines/avalanche/gyro.h1
-rw-r--r--engines/avalanche/lucerna.cpp6
-rw-r--r--engines/avalanche/menu.cpp (renamed from engines/avalanche/dropdown.cpp)166
-rw-r--r--engines/avalanche/menu.h (renamed from engines/avalanche/dropdown.h)35
-rw-r--r--engines/avalanche/module.mk2
-rw-r--r--engines/avalanche/parser.cpp4
-rw-r--r--engines/avalanche/timer.cpp2
13 files changed, 125 insertions, 117 deletions
diff --git a/engines/avalanche/animation.cpp b/engines/avalanche/animation.cpp
index edcc53cdcf..e3634e0677 100644
--- a/engines/avalanche/animation.cpp
+++ b/engines/avalanche/animation.cpp
@@ -1226,7 +1226,7 @@ void Animation::drawSprites() {
* @remarks Originally called 'trippancy_link'
*/
void Animation::animLink() {
- if (_vm->_gyro->_dropdownActive | _vm->_gyro->_onToolbar | _vm->_gyro->_seeScroll)
+ if (_vm->_menu->isActive() | _vm->_gyro->_onToolbar | _vm->_gyro->_seeScroll)
return;
for (int16 i = 0; i < kSpriteNumbMax; i++) {
if (_sprites[i]._quick && _sprites[i]._visible)
@@ -1377,7 +1377,7 @@ void Animation::handleMoveKey(const Common::Event &event) {
if (!_vm->_gyro->_userMovesAvvy)
return;
- if (_vm->_dropdown->_activeMenuItem._activeNow)
+ if (_vm->_menu->_activeMenuItem._activeNow)
_vm->_parser->tryDropdown();
else {
switch (event.kbd.keycode) {
diff --git a/engines/avalanche/avalanche.cpp b/engines/avalanche/avalanche.cpp
index 33c72c848f..980fcab96a 100644
--- a/engines/avalanche/avalanche.cpp
+++ b/engines/avalanche/avalanche.cpp
@@ -70,7 +70,7 @@ AvalancheEngine::~AvalancheEngine() {
delete _timer;
delete _animation;
delete _acci;
- delete _dropdown;
+ delete _menu;
delete _closing;
delete _gyro;
}
@@ -89,7 +89,7 @@ Common::ErrorCode AvalancheEngine::initialize() {
_timer = new Timer(this);
_animation = new Animation(this);
_acci = new Acci(this);
- _dropdown = new Dropdown(this);
+ _menu = new Menu(this);
_closing = new Closing(this);
_graphics->init();
@@ -440,7 +440,7 @@ bool AvalancheEngine::loadGame(const int16 slot) {
_celer->forgetBackgroundSprites();
_lucerna->minorRedraw();
- _dropdown->setupMenu();
+ _menu->setup();
_gyro->_whereIs[Gyro::kPeopleAvalot - 150] = _gyro->_room;
_gyro->_alive = true;
_lucerna->refreshObjectList();
diff --git a/engines/avalanche/avalanche.h b/engines/avalanche/avalanche.h
index 8da159165d..4a01c729d2 100644
--- a/engines/avalanche/avalanche.h
+++ b/engines/avalanche/avalanche.h
@@ -43,7 +43,7 @@
#include "avalanche/timer.h"
#include "avalanche/animation.h"
#include "avalanche/acci.h"
-#include "avalanche/dropdown.h"
+#include "avalanche/menu.h"
#include "avalanche/closing.h"
#include "common/serializer.h"
@@ -78,7 +78,7 @@ public:
Timer *_timer;
Animation *_animation;
Acci *_acci;
- Dropdown *_dropdown;
+ Menu *_menu;
Closing *_closing;
OSystem *_system;
diff --git a/engines/avalanche/avalot.cpp b/engines/avalanche/avalot.cpp
index 2d93ed8954..687572c2af 100644
--- a/engines/avalanche/avalot.cpp
+++ b/engines/avalanche/avalot.cpp
@@ -28,7 +28,6 @@
/* AVALOT The kernel of the program. */
#include "avalanche/avalanche.h"
-
#include "avalanche/graphics.h"
#include "avalanche/avalot.h"
#include "avalanche/gyro.h"
@@ -36,7 +35,7 @@
#include "avalanche/gyro.h"
#include "avalanche/lucerna.h"
#include "avalanche/scrolls.h"
-#include "avalanche/dropdown.h"
+#include "avalanche/menu.h"
#include "avalanche/pingo.h"
#include "avalanche/timer.h"
#include "avalanche/celer.h"
@@ -136,7 +135,6 @@ void Avalot::setup() {
_vm->_gyro->setMousePointerWait();
_vm->_gyro->_dropsOk = true;
_vm->_gyro->_mouseText = "";
- _vm->_gyro->_dropdownActive = false;
_vm->_lucerna->loadDigits();
_vm->_gyro->_cheat = false;
_vm->_gyro->_cp = 0;
@@ -161,7 +159,7 @@ void Avalot::setup() {
_vm->_animation->_sprites[0]._speedX = _vm->_gyro->kWalk;
_vm->_animation->updateSpeed();
-
+ _vm->_menu->init();
int16 loadSlot = Common::ConfigManager::instance().getInt("save_slot");
if (loadSlot >= 0) {
@@ -190,7 +188,7 @@ void Avalot::run(Common::String arg) {
_vm->updateEvents(); // The event handler.
_vm->_lucerna->_clock.update();
- _vm->_dropdown->updateMenu();
+ _vm->_menu->update();
_vm->_celer->updateBackgroundSprites();
_vm->_animation->animLink();
_vm->_lucerna->checkClick();
diff --git a/engines/avalanche/celer.cpp b/engines/avalanche/celer.cpp
index 6edb4d2bb4..61a45c7e26 100644
--- a/engines/avalanche/celer.cpp
+++ b/engines/avalanche/celer.cpp
@@ -54,7 +54,7 @@ Celer::~Celer() {
* @remarks Originally called 'pics_link'
*/
void Celer::updateBackgroundSprites() {
- if (_vm->_gyro->_dropdownActive)
+ if (_vm->_menu->isActive())
return; // No animation when the menus are up.
switch (_vm->_gyro->_room) {
diff --git a/engines/avalanche/gyro.cpp b/engines/avalanche/gyro.cpp
index 2cb9d0e6e8..ec695947bf 100644
--- a/engines/avalanche/gyro.cpp
+++ b/engines/avalanche/gyro.cpp
@@ -356,7 +356,7 @@ void Gyro::newGame() {
_vm->_lucerna->enterRoom(1, 1);
avvy->_visible = false;
_vm->_lucerna->drawScore();
- _vm->_dropdown->setupMenu();
+ _vm->_menu->setup();
_vm->_lucerna->_clock.update();
_vm->_lucerna->spriteRun();
}
diff --git a/engines/avalanche/gyro.h b/engines/avalanche/gyro.h
index 977a2e79ae..b01f3e1a06 100644
--- a/engines/avalanche/gyro.h
+++ b/engines/avalanche/gyro.h
@@ -348,7 +348,6 @@ public:
byte _buffer[2000];
uint16 _bufSize;
int16 _underScroll; // Y-coord of just under the scroll text.
- bool _dropdownActive; // Kludge so we don't have to keep referring to Dropdown
Common::String _roomnName; // Name of actual room
Common::String _subject; // What you're talking to them about.
byte _subjectNum; // The same thing.
diff --git a/engines/avalanche/lucerna.cpp b/engines/avalanche/lucerna.cpp
index 2b75d5abcc..336c686a6f 100644
--- a/engines/avalanche/lucerna.cpp
+++ b/engines/avalanche/lucerna.cpp
@@ -380,7 +380,7 @@ void Lucerna::exitRoom(byte x) {
* @remarks Originally called 'new_town'
*/
void Lucerna::enterNewTown() {
- _vm->_dropdown->setupMenu();
+ _vm->_menu->setup();
switch (_vm->_gyro->_room) {
case kRoomOutsideNottsPub: // Entry into Nottingham.
@@ -1080,7 +1080,7 @@ void Lucerna::checkClick() {
_vm->_gyro->newMouse(8); //I-beam
else if ((340 <= cursorPos.y) && (cursorPos.y <= 399))
_vm->_gyro->newMouse(2); // screwdriver
- else if (!_vm->_gyro->_dropdownActive) { // Dropdown can handle its own pointers.
+ else if (!_vm->_menu->isActive()) { // Dropdown can handle its own pointers.
if (_holdLeftMouse) {
_vm->_gyro->newMouse(7); // Mark's crosshairs
guideAvvy(cursorPos); // Normally, if you click on the picture, you're guiding Avvy around.
@@ -1091,7 +1091,7 @@ void Lucerna::checkClick() {
if (_holdLeftMouse) {
if ((0 <= cursorPos.y) && (cursorPos.y <= 21)) { // Click on the dropdown menu.
if (_vm->_gyro->_dropsOk)
- _vm->_dropdown->updateMenu();
+ _vm->_menu->update();
} else if ((317 <= cursorPos.y) && (cursorPos.y <= 339)) { // Click on the command line.
_vm->_parser->_inputTextPos = (cursorPos.x - 23) / 8;
if (_vm->_parser->_inputTextPos > _vm->_parser->_inputText.size() + 1)
diff --git a/engines/avalanche/dropdown.cpp b/engines/avalanche/menu.cpp
index 8ae3af0db1..69267da55c 100644
--- a/engines/avalanche/dropdown.cpp
+++ b/engines/avalanche/menu.cpp
@@ -28,8 +28,7 @@
/* DROPDOWN A customised version of Oopmenu (qv). */
#include "avalanche/avalanche.h"
-
-#include "avalanche/dropdown.h"
+#include "avalanche/menu.h"
#include "avalanche/lucerna.h"
#include "avalanche/gyro.h"
#include "avalanche/acci.h"
@@ -39,7 +38,7 @@
namespace Avalanche {
-void HeadType::init(char trig, char altTrig, Common::String title, byte pos, DropdownFunc setupFunc, DropdownFunc chooseFunc, Dropdown *dr) {
+void HeadType::init(char trig, char altTrig, Common::String title, byte pos, MenuFunc setupFunc, MenuFunc chooseFunc, Menu *dr) {
_trigger = trig;
_altTrigger = altTrig;
_title = title;
@@ -69,8 +68,8 @@ void HeadType::highlight() {
_dr->_activeMenuItem._left = _xpos;
_dr->_activeMenuItem._activeNow = true;
- _dr->_vm->_gyro->_dropdownActive = true;
_dr->_activeMenuItem._activeNum = _position;
+ _dr->_menuActive = true;
_dr->_vm->_gyro->_currentMouse = 177; // Force redraw of cursor.
}
@@ -81,11 +80,12 @@ bool HeadType::parseAltTrigger(char key) {
return false;
}
-void MenuItem::init(Dropdown *dr) {
+void MenuItem::init(Menu *dr) {
_dr = dr;
+
_activeNow = false;
- _dr->_vm->_gyro->_dropdownActive = false;
_activeNum = 1;
+ _dr->_menuActive = false;
}
void MenuItem::reset() {
@@ -135,7 +135,7 @@ void MenuItem::display() {
_flx2 = _left + _width;
_fly = 15 + _optionNum * 10;
_activeNow = true;
- _dr->_vm->_gyro->_dropdownActive = true;
+ _dr->_menuActive = true;
_dr->_vm->_graphics->_surface.fillRect(Common::Rect((_flx1 + 1) * 8, 12, (_flx2 + 1) * 8, _fly), _dr->kMenuBackgroundColor);
_dr->_vm->_graphics->_surface.frameRect(Common::Rect((_flx1 + 1) * 8 - 1, 11, (_flx2 + 1) * 8 + 1, _fly + 1), _dr->kMenuBorderColor);
@@ -157,7 +157,7 @@ void MenuItem::wipe() {
_dr->drawMenuText(_dr->_menuBar._menuItems[_dr->_activeMenuItem._activeNum]._xpos, 1, _dr->_menuBar._menuItems[_dr->_activeMenuItem._activeNum]._trigger, _dr->_menuBar._menuItems[_dr->_activeMenuItem._activeNum]._title, true, false);
_activeNow = false;
- _dr->_vm->_gyro->_dropdownActive = false;
+ _dr->_menuActive = false;
_firstlix = false;
_dr->_vm->_gyro->_defaultLed = 2;
@@ -217,12 +217,12 @@ void MenuItem::parseKey(char c) {
_dr->_vm->_gyro->blip();
}
-void MenuBar::init(Dropdown *dr) {
+void MenuBar::init(Menu *dr) {
_dr = dr;
_menuNum = 0;
}
-void MenuBar::createMenuItem(char trig, Common::String title, char altTrig, DropdownFunc setupFunc, DropdownFunc chooseFunc) {
+void MenuBar::createMenuItem(char trig, Common::String title, char altTrig, MenuFunc setupFunc, MenuFunc chooseFunc) {
_menuItems[_menuNum].init(trig, altTrig, title, _menuNum, setupFunc, chooseFunc, _dr);
_menuNum++;
}
@@ -269,13 +269,13 @@ void MenuBar::chooseMenuItem(int16 x) {
}
}
-Dropdown::Dropdown(AvalancheEngine *vm) {
+Menu::Menu(AvalancheEngine *vm) {
_vm = vm;
_activeMenuItem.init(this);
_menuBar.init(this);
}
-void Dropdown::findWhatYouCanDoWithIt() {
+void Menu::findWhatYouCanDoWithIt() {
switch (_vm->_gyro->_thinks) {
case Gyro::kObjectWine:
case Gyro::kObjectPotion:
@@ -303,7 +303,7 @@ void Dropdown::findWhatYouCanDoWithIt() {
}
}
-void Dropdown::drawMenuText(int16 x, int16 y, char trigger, Common::String text, bool valid, bool highlighted) {
+void Menu::drawMenuText(int16 x, int16 y, char trigger, Common::String text, bool valid, bool highlighted) {
byte fontColor;
byte backgroundColor;
if (highlighted) {
@@ -352,64 +352,67 @@ void Dropdown::drawMenuText(int16 x, int16 y, char trigger, Common::String text,
_vm->_graphics->refreshScreen();
}
-void Dropdown::bleep() {
+void Menu::bleep() {
warning("STUB: Dropdown::bleep()");
}
-void Dropdown::parseKey(char r, char re) {
- //switch (r) {
- //case 0:
- //case 224: {
- // switch (re) {
- // case 'K':
- // if (_activeMenuItem._activeNum > 1) {
- // _activeMenuItem.wipe();
- // _menuBar.setupMenuItem(_activeMenuItem._activeNum - 1);
- // } else {
- // // Get menu on the left-hand side.
- // _activeMenuItem.wipe();
- // _menuBar.chooseMenuItem((_menuBar._menuNum - 1) * kSpacing + kIndent);
- // }
- // break;
- // case 'M':
- // if (_activeMenuItem._activeNum < _menuBar._menuNum) {
- // _activeMenuItem.wipe();
- // _menuBar.setupMenuItem(_activeMenuItem._activeNum + 1);
- // } else {
- // // Get menu on the far right-hand side.
- // _activeMenuItem.wipe();
- // _menuBar.chooseMenuItem(kIndent);
- // }
- // break;
- // case 'H':
- // _activeMenuItem.moveHighlight(-1);
- // break;
- // case 'P':
- // _activeMenuItem.moveHighlight(1);
- // break;
- // default:
- // _menuBar.parseAltTrigger(re);
- // }
- //}
- //break;
- //case 13:
- // _activeMenuItem.select(_activeMenuItem._highlightNum);
- // break;
- //default:
- // if (_activeMenuItem._activeNow)
- // _activeMenuItem.parseKey(r);
- //}
+void Menu::parseKey(char r, char re) {
+#if 0
+ switch (r) {
+ case 0:
+ case 224: {
+ switch (re) {
+ case 'K':
+ if (_activeMenuItem._activeNum > 1) {
+ _activeMenuItem.wipe();
+ _menuBar.setupMenuItem(_activeMenuItem._activeNum - 1);
+ } else {
+ // Get menu on the left-hand side.
+ _activeMenuItem.wipe();
+ _menuBar.chooseMenuItem((_menuBar._menuNum - 1) * kSpacing + kIndent);
+ }
+ break;
+ case 'M':
+ if (_activeMenuItem._activeNum < _menuBar._menuNum) {
+ _activeMenuItem.wipe();
+ _menuBar.setupMenuItem(_activeMenuItem._activeNum + 1);
+ } else {
+ // Get menu on the far right-hand side.
+ _activeMenuItem.wipe();
+ _menuBar.chooseMenuItem(kIndent);
+ }
+ break;
+ case 'H':
+ _activeMenuItem.moveHighlight(-1);
+ break;
+ case 'P':
+ _activeMenuItem.moveHighlight(1);
+ break;
+ default:
+ _menuBar.parseAltTrigger(re);
+ }
+ }
+ break;
+ case 13:
+ _activeMenuItem.select(_activeMenuItem._highlightNum);
+ break;
+ default:
+ if (_activeMenuItem._activeNow)
+ _activeMenuItem.parseKey(r);
+ }
+#endif
+
warning("STUB: Dropdown::parseKey()"); // To be implemented properly later! Don't remove the comment above!
}
-Common::String Dropdown::selectGender(byte x) {
+Common::String Menu::selectGender(byte x) {
if (x < 175)
return "im";
else
return "er";
}
-void Dropdown::setupMenuGame() {
+void Menu::setupMenuGame() {
_activeMenuItem.reset();
_activeMenuItem.setupOption("Help...", 'H', "f1", true);
_activeMenuItem.setupOption("Boss Key", 'B', "alt-B", true);
@@ -419,7 +422,7 @@ void Dropdown::setupMenuGame() {
_activeMenuItem.display();
}
-void Dropdown::setupMenuFile() {
+void Menu::setupMenuFile() {
_activeMenuItem.reset();
_activeMenuItem.setupOption("New game", 'N', "f4", true);
_activeMenuItem.setupOption("Load...", 'L', "^f3", true);
@@ -430,7 +433,7 @@ void Dropdown::setupMenuFile() {
_activeMenuItem.display();
}
-void Dropdown::setupMenuAction() {
+void Menu::setupMenuAction() {
_activeMenuItem.reset();
Common::String f5Does = _vm->_gyro->f5Does();
@@ -456,7 +459,7 @@ void Dropdown::setupMenuAction() {
_activeMenuItem.display();
}
-void Dropdown::setupMenuPeople() {
+void Menu::setupMenuPeople() {
if (!people.empty())
people.clear();
@@ -472,7 +475,7 @@ void Dropdown::setupMenuPeople() {
_activeMenuItem.display();
}
-void Dropdown::setupMenuObjects() {
+void Menu::setupMenuObjects() {
_activeMenuItem.reset();
for (int i = 0; i < kObjectNum; i++) {
if (_vm->_gyro->_objects[i])
@@ -481,7 +484,7 @@ void Dropdown::setupMenuObjects() {
_activeMenuItem.display();
}
-void Dropdown::setupMenuWith() {
+void Menu::setupMenuWith() {
_activeMenuItem.reset();
if (_vm->_gyro->_thinkThing) {
@@ -538,7 +541,7 @@ void Dropdown::setupMenuWith() {
_activeMenuItem.display();
}
-void Dropdown::runMenuGame() {
+void Menu::runMenuGame() {
// Help, boss, untrash screen.
switch (_activeMenuItem._choiceNum) {
case 0:
@@ -559,7 +562,7 @@ void Dropdown::runMenuGame() {
}
}
-void Dropdown::runMenuFile() {
+void Menu::runMenuFile() {
// New game, load, save, save as, DOS shell, about, quit.
switch (_activeMenuItem._choiceNum) {
case 0:
@@ -588,7 +591,7 @@ void Dropdown::runMenuFile() {
}
}
-void Dropdown::runMenuAction() {
+void Menu::runMenuAction() {
Common::String f5Does;
// Get up, pause game, open door, look, inventory, walk/run.
switch (_activeMenuItem._choiceNum) {
@@ -624,16 +627,16 @@ void Dropdown::runMenuAction() {
}
}
-void Dropdown::runMenuObjects() {
+void Menu::runMenuObjects() {
_vm->_lucerna->thinkAbout(_vm->_gyro->_objectList[_activeMenuItem._choiceNum], Gyro::kThing);
}
-void Dropdown::runMenuPeople() {
+void Menu::runMenuPeople() {
_vm->_lucerna->thinkAbout(people[_activeMenuItem._choiceNum], Gyro::kPerson);
_vm->_gyro->_lastPerson = people[_activeMenuItem._choiceNum];
}
-void Dropdown::runMenuWith() {
+void Menu::runMenuWith() {
_vm->_acci->_thing = _vm->_gyro->_thinks;
if (_vm->_gyro->_thinkThing) {
@@ -678,21 +681,21 @@ void Dropdown::runMenuWith() {
_vm->_lucerna->callVerb(_vm->_gyro->_verbStr[_activeMenuItem._choiceNum]);
}
-void Dropdown::setupMenu() {
+void Menu::setup() {
_menuBar.init(this);
_activeMenuItem.init(this);
- _menuBar.createMenuItem('F', "File", '!', &Avalanche::Dropdown::setupMenuFile, &Avalanche::Dropdown::runMenuFile);
- _menuBar.createMenuItem('G', "Game", 34, &Avalanche::Dropdown::setupMenuGame, &Avalanche::Dropdown::runMenuGame);
- _menuBar.createMenuItem('A', "Action", 30, &Avalanche::Dropdown::setupMenuAction, &Avalanche::Dropdown::runMenuAction);
- _menuBar.createMenuItem('O', "Objects", 24, &Avalanche::Dropdown::setupMenuObjects, &Avalanche::Dropdown::runMenuObjects);
- _menuBar.createMenuItem('P', "People", 25, &Avalanche::Dropdown::setupMenuPeople, &Avalanche::Dropdown::runMenuPeople);
- _menuBar.createMenuItem('W', "With", 17, &Avalanche::Dropdown::setupMenuWith, &Avalanche::Dropdown::runMenuWith);
+ _menuBar.createMenuItem('F', "File", '!', &Avalanche::Menu::setupMenuFile, &Avalanche::Menu::runMenuFile);
+ _menuBar.createMenuItem('G', "Game", 34, &Avalanche::Menu::setupMenuGame, &Avalanche::Menu::runMenuGame);
+ _menuBar.createMenuItem('A', "Action", 30, &Avalanche::Menu::setupMenuAction, &Avalanche::Menu::runMenuAction);
+ _menuBar.createMenuItem('O', "Objects", 24, &Avalanche::Menu::setupMenuObjects, &Avalanche::Menu::runMenuObjects);
+ _menuBar.createMenuItem('P', "People", 25, &Avalanche::Menu::setupMenuPeople, &Avalanche::Menu::runMenuPeople);
+ _menuBar.createMenuItem('W', "With", 17, &Avalanche::Menu::setupMenuWith, &Avalanche::Menu::runMenuWith);
_menuBar.draw();
}
-void Dropdown::updateMenu() { // TODO: Optimize it ASAP!!! It really needs it...
+void Menu::update() { // TODO: Optimize it ASAP!!! It really needs it...
Common::Point cursorPos = _vm->getMousePos();
::Graphics::Surface backup;
backup.copyFrom(_vm->_graphics->_surface);
@@ -786,4 +789,11 @@ void Dropdown::updateMenu() { // TODO: Optimize it ASAP!!! It really needs it...
backup.free();
}
+bool Menu::isActive() {
+ return _menuActive;
+}
+
+void Menu::init() {
+ _menuActive = false;
+}
} // End of namespace Avalanche.
diff --git a/engines/avalanche/dropdown.h b/engines/avalanche/menu.h
index b14f4cb196..ad0821e932 100644
--- a/engines/avalanche/dropdown.h
+++ b/engines/avalanche/menu.h
@@ -31,18 +31,15 @@
#define AVALANCHE_DROPDOWN2_H
#include "avalanche/color.h"
-
#include "common/scummsys.h"
#include "common/str.h"
-
-
namespace Avalanche {
class AvalancheEngine;
-class Dropdown;
+class Menu;
-typedef void (Dropdown::*DropdownFunc)();
+typedef void (Menu::*MenuFunc)();
class HeadType {
public:
@@ -50,15 +47,15 @@ public:
char _trigger, _altTrigger;
byte _position;
int16 _xpos, _xright;
- DropdownFunc _setupFunc, _chooseFunc;
+ MenuFunc _setupFunc, _chooseFunc;
- void init(char trig, char alTtrig, Common::String title, byte pos, DropdownFunc setupFunc, DropdownFunc chooseFunc, Dropdown *dr);
+ void init(char trig, char alTtrig, Common::String title, byte pos, MenuFunc setupFunc, MenuFunc chooseFunc, Menu *dr);
void draw();
void highlight();
bool parseAltTrigger(char key);
private:
- Dropdown *_dr;
+ Menu *_dr;
};
struct OptionType {
@@ -81,7 +78,7 @@ public:
byte _choiceNum; // Your choice?
byte _highlightNum;
- void init(Dropdown *dr);
+ void init(Menu *dr);
void reset();
void setupOption(Common::String title, char trigger, Common::String shortcut, bool valid);
void display();
@@ -93,7 +90,7 @@ public:
void parseKey(char c);
private:
- Dropdown *_dr;
+ Menu *_dr;
};
class MenuBar {
@@ -101,18 +98,18 @@ public:
HeadType _menuItems[8];
byte _menuNum;
- void init(Dropdown *dr);
- void createMenuItem(char trig, Common::String title, char altTrig, DropdownFunc setupFunc, DropdownFunc chooseFunc);
+ void init(Menu *dr);
+ void createMenuItem(char trig, Common::String title, char altTrig, MenuFunc setupFunc, MenuFunc chooseFunc);
void draw();
void parseAltTrigger(char c);
void setupMenuItem(byte which);
void chooseMenuItem(int16 x);
private:
- Dropdown *_dr;
+ Menu *_dr;
};
-class Dropdown {
+class Menu {
public:
friend class HeadType;
friend class MenuItem;
@@ -123,11 +120,13 @@ public:
Common::String people;
- Dropdown(AvalancheEngine *vm);
+ Menu(AvalancheEngine *vm);
void parseKey(char r, char re);
- void updateMenu();
- void setupMenu(); // Standard menu bar.
+ void update();
+ void setup(); // Standard menu bar.
+ bool isActive();
+ void init();
private:
static const byte kIndent = 5;
@@ -140,6 +139,8 @@ private:
static const byte kHighlightFontColor = kColorWhite;
static const byte kDisabledColor = kColorDarkgray;
+ bool _menuActive; // Kludge so we don't have to keep referring to Dropdown
+
AvalancheEngine *_vm;
Common::String selectGender(byte x); // Returns "im" for boys, and "er" for girls.
diff --git a/engines/avalanche/module.mk b/engines/avalanche/module.mk
index 0da172cf9f..4a0c7034b6 100644
--- a/engines/avalanche/module.mk
+++ b/engines/avalanche/module.mk
@@ -16,7 +16,7 @@ MODULE_OBJS = \
timer.o \
animation.o \
acci.o \
- dropdown.o \
+ menu.o \
closing.o
# This module can be built as a plugin
diff --git a/engines/avalanche/parser.cpp b/engines/avalanche/parser.cpp
index 4bf05884f7..903a01b796 100644
--- a/engines/avalanche/parser.cpp
+++ b/engines/avalanche/parser.cpp
@@ -65,7 +65,7 @@ void Parser::handleInputText(const Common::Event &event) {
}
void Parser::handleBackspace() {
- if (!_vm->_dropdown->_activeMenuItem._activeNow) {
+ if (!_vm->_menu->_activeMenuItem._activeNow) {
if (_inputTextPos > _leftMargin) {
_inputTextPos--;
if ((_inputText[_inputTextPos] == '"') || (_inputText[_inputTextPos] == '`'))
@@ -78,7 +78,7 @@ void Parser::handleBackspace() {
}
void Parser::handleReturn() {
- if (_vm->_dropdown->_activeMenuItem._activeNow)
+ if (_vm->_menu->_activeMenuItem._activeNow)
_vm->_parser->tryDropdown();
else if (!_inputText.empty()) {
_inputTextBackup = _inputText;
diff --git a/engines/avalanche/timer.cpp b/engines/avalanche/timer.cpp
index ebace781e2..8038f01bf1 100644
--- a/engines/avalanche/timer.cpp
+++ b/engines/avalanche/timer.cpp
@@ -80,7 +80,7 @@ void Timer::addTimer(int32 duration, byte action, byte reason) {
* @remarks Originally called 'one_tick'
*/
void Timer::updateTimer() {
- if (_vm->_gyro->_dropdownActive)
+ if (_vm->_menu->isActive())
return;
for (int i = 0; i < 7; i++) {