2013-07-01 18:14:48 +02:00
|
|
|
/* ScummVM - Graphic Adventure Engine
|
|
|
|
*
|
|
|
|
* ScummVM is the legal property of its developers, whose names
|
|
|
|
* are too numerous to list here. Please refer to the COPYRIGHT
|
|
|
|
* file distributed with this source distribution.
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU General Public License
|
|
|
|
* as published by the Free Software Foundation; either version 2
|
|
|
|
* of the License, or (at your option) any later version.
|
|
|
|
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
/*
|
|
|
|
* This code is based on the original source code of Lord Avalot d'Argent version 1.3.
|
|
|
|
* Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman.
|
|
|
|
*/
|
|
|
|
|
|
|
|
/* DROPDOWN A customised version of Oopmenu (qv). */
|
|
|
|
|
2013-09-07 09:00:34 +02:00
|
|
|
#ifndef AVALANCHE_DROPDOWN2_H
|
|
|
|
#define AVALANCHE_DROPDOWN2_H
|
2013-07-01 18:14:48 +02:00
|
|
|
|
|
|
|
#include "avalanche/color.h"
|
|
|
|
|
|
|
|
#include "common/scummsys.h"
|
|
|
|
#include "common/str.h"
|
|
|
|
|
2013-09-04 18:12:06 +02:00
|
|
|
|
|
|
|
|
2013-07-01 18:14:48 +02:00
|
|
|
namespace Avalanche {
|
|
|
|
class AvalancheEngine;
|
|
|
|
|
|
|
|
class Dropdown;
|
|
|
|
|
2013-09-04 18:12:06 +02:00
|
|
|
typedef void (Dropdown::*DropdownFunc)();
|
|
|
|
|
|
|
|
class HeadType {
|
|
|
|
public:
|
|
|
|
Common::String _title;
|
|
|
|
char _trigger, _altTrigger;
|
|
|
|
byte _position;
|
|
|
|
int16 _xpos, _xright;
|
|
|
|
DropdownFunc _setupFunc, _chooseFunc;
|
|
|
|
|
|
|
|
void init(char trig, char alTtrig, Common::String title, byte pos, DropdownFunc setupFunc, DropdownFunc chooseFunc, Dropdown *dr);
|
|
|
|
void draw();
|
2013-07-01 18:14:48 +02:00
|
|
|
void highlight();
|
2013-09-04 18:12:06 +02:00
|
|
|
bool parseAltTrigger(char key);
|
2013-07-01 18:14:48 +02:00
|
|
|
|
|
|
|
private:
|
|
|
|
Dropdown *_dr;
|
|
|
|
};
|
|
|
|
|
2013-09-04 18:12:06 +02:00
|
|
|
struct OptionType {
|
|
|
|
Common::String _title;
|
|
|
|
byte _trigger;
|
|
|
|
Common::String _shortcut;
|
|
|
|
bool _valid;
|
2013-07-01 18:14:48 +02:00
|
|
|
};
|
|
|
|
|
2013-09-04 18:12:06 +02:00
|
|
|
class MenuItem {
|
2013-07-01 18:14:48 +02:00
|
|
|
public:
|
2013-09-04 18:12:06 +02:00
|
|
|
OptionType _options[12];
|
|
|
|
byte _optionNum;
|
|
|
|
uint16 _width, _left;
|
|
|
|
bool _firstlix;
|
2013-09-18 00:05:14 +02:00
|
|
|
int16 _flx1, _flx2, _fly;
|
2013-09-04 18:12:06 +02:00
|
|
|
byte _oldY; // used by lightUp */
|
|
|
|
bool _activeNow; // Is there an active option now?
|
|
|
|
byte _activeNum; // And if so, which is it?
|
|
|
|
byte _choiceNum; // Your choice?
|
|
|
|
byte _highlightNum;
|
2013-07-01 18:14:48 +02:00
|
|
|
|
2013-09-01 17:15:55 +02:00
|
|
|
void init(Dropdown *dr);
|
2013-09-04 18:12:06 +02:00
|
|
|
void reset();
|
|
|
|
void setupOption(Common::String title, char trigger, Common::String shortcut, bool valid);
|
2013-07-01 18:14:48 +02:00
|
|
|
void display();
|
|
|
|
void wipe();
|
2013-09-04 18:12:06 +02:00
|
|
|
void lightUp(Common::Point cursorPos); // This makes the menu highlight follow the mouse.
|
|
|
|
void displayOption(byte y, bool highlit);
|
|
|
|
void moveHighlight(int8 inc);
|
|
|
|
void select(byte which); // Choose which one you want.
|
|
|
|
void parseKey(char c);
|
2013-07-01 18:14:48 +02:00
|
|
|
|
|
|
|
private:
|
|
|
|
Dropdown *_dr;
|
|
|
|
};
|
|
|
|
|
2013-09-04 18:12:06 +02:00
|
|
|
class MenuBar {
|
2013-07-01 18:14:48 +02:00
|
|
|
public:
|
2013-09-04 18:12:06 +02:00
|
|
|
HeadType _menuItems[8];
|
|
|
|
byte _menuNum;
|
2013-07-01 18:14:48 +02:00
|
|
|
|
2013-09-01 17:15:55 +02:00
|
|
|
void init(Dropdown *dr);
|
2013-09-04 18:12:06 +02:00
|
|
|
void createMenuItem(char trig, Common::String title, char altTrig, DropdownFunc setupFunc, DropdownFunc chooseFunc);
|
|
|
|
void draw();
|
|
|
|
void parseAltTrigger(char c);
|
|
|
|
void setupMenuItem(byte which);
|
|
|
|
void chooseMenuItem(int16 x);
|
2013-07-01 18:14:48 +02:00
|
|
|
|
|
|
|
private:
|
|
|
|
Dropdown *_dr;
|
|
|
|
};
|
|
|
|
|
|
|
|
class Dropdown {
|
|
|
|
public:
|
2013-09-04 19:17:32 +02:00
|
|
|
friend class HeadType;
|
|
|
|
friend class MenuItem;
|
|
|
|
friend class MenuBar;
|
2013-07-01 18:14:48 +02:00
|
|
|
|
2013-09-04 18:12:06 +02:00
|
|
|
MenuItem _activeMenuItem;
|
|
|
|
MenuBar _menuBar;
|
2013-07-01 18:14:48 +02:00
|
|
|
|
|
|
|
Common::String people;
|
|
|
|
|
2013-07-24 19:43:10 +02:00
|
|
|
Dropdown(AvalancheEngine *vm);
|
|
|
|
|
2013-09-04 18:12:06 +02:00
|
|
|
void parseKey(char r, char re);
|
|
|
|
void updateMenu();
|
|
|
|
void setupMenu(); // Standard menu bar.
|
2013-07-01 18:14:48 +02:00
|
|
|
|
|
|
|
private:
|
2013-09-04 18:12:06 +02:00
|
|
|
static const byte kIndent = 5;
|
|
|
|
static const byte kSpacing = 10;
|
2013-07-01 18:14:48 +02:00
|
|
|
|
2013-09-05 23:07:08 +02:00
|
|
|
static const byte kMenuBackgroundColor = kColorLightgray;
|
|
|
|
static const byte kMenuFontColor = kColorBlack;
|
|
|
|
static const byte kMenuBorderColor = kColorBlack;
|
|
|
|
static const byte kHighlightBackgroundColor = kColorBlack;
|
|
|
|
static const byte kHighlightFontColor = kColorWhite;
|
|
|
|
static const byte kDisabledColor = kColorDarkgray;
|
2013-07-01 18:14:48 +02:00
|
|
|
|
2013-09-04 18:12:06 +02:00
|
|
|
AvalancheEngine *_vm;
|
2013-07-01 18:14:48 +02:00
|
|
|
|
2013-09-04 18:12:06 +02:00
|
|
|
Common::String selectGender(byte x); // Returns "im" for boys, and "er" for girls.
|
|
|
|
void findWhatYouCanDoWithIt();
|
2013-09-04 20:57:25 +02:00
|
|
|
void drawMenuText(int16 x, int16 y, char trigger, Common::String text, bool valid, bool highlighted);
|
2013-09-04 18:12:06 +02:00
|
|
|
void bleep();
|
2013-07-01 18:14:48 +02:00
|
|
|
|
2013-09-04 18:12:06 +02:00
|
|
|
void setupMenuGame();
|
|
|
|
void setupMenuFile();
|
|
|
|
void setupMenuAction();
|
|
|
|
void setupMenuPeople();
|
|
|
|
void setupMenuObjects();
|
|
|
|
void setupMenuWith();
|
|
|
|
|
|
|
|
void runMenuGame();
|
|
|
|
void runMenuFile();
|
|
|
|
void runMenuAction();
|
|
|
|
void runMenuObjects();
|
|
|
|
void runMenuPeople();
|
|
|
|
void runMenuWith();
|
2013-07-01 18:14:48 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
} // End of namespace Avalanche.
|
|
|
|
|
2013-09-07 09:00:34 +02:00
|
|
|
#endif // AVALANCHE_DROPDOWN2_H
|