ScummVM API documentation
menu.h
1/* ScummVM - Graphic Adventure Engine
2 *
3 * ScummVM is the legal property of its developers, whose names
4 * are too numerous to list here. Please refer to the COPYRIGHT
5 * file distributed with this source distribution.
6 *
7 * This program is free software: you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation, either version 3 of the License, or
10 * (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program. If not, see <http://www.gnu.org/licenses/>.
19 *
20 */
21
22#ifndef SWORD1_MENU_H
23#define SWORD1_MENU_H
24
25#include "sword1/sworddefs.h"
26#include "sword1/object.h"
27#include "common/mutex.h"
28
29namespace Sword1 {
30
31class Screen;
32class Mouse;
33class ResMan;
34
35#define MENU_TOP 0
36#define MENU_BOT 1
37
38struct Subject {
39 uint32 subjectRes;
40 uint32 frameNo;
41};
42
43struct MenuObject {
44 int32 textDesc;
45 uint32 bigIconRes;
46 uint32 bigIconFrame;
47 uint32 luggageIconRes;
48 uint32 useScript;
49};
50
51class MenuIcon {
52public:
53 MenuIcon(uint8 menuType, uint8 menuPos, uint32 resId, uint32 frame, Screen *screen);
54 bool wasClicked(uint16 mouseX, uint16 mouseY);
55 void setSelect(bool pSel);
56 void draw(const byte *fadeMask = NULL, int8 fadeStatus = 0);
57
58private:
59 uint8 _menuType, _menuPos;
60 uint32 _resId, _frame;
61 bool _selected;
62 Screen *_screen;
63};
64
65class Menu {
66public:
67 Menu(Screen *pScreen, Mouse *pMouse);
68 ~Menu();
69 void fnChooser(Object *compact);
70 void fnEndChooser();
71 void fnAddSubject(int32 sub);
72 void cfnReleaseMenu();
73 int logicChooser(Object *compact);
74 void engine();
75 void refresh(uint8 menuType);
76 void fnStartMenu();
77 void fnEndMenu();
78 void checkTopMenu();
79 void setToTargetState();
80 static const MenuObject _objectDefs[TOTAL_pockets + 1];
81
82private:
83 void buildSubjects();
84 void buildMenu();
85 void showMenu(uint8 menuType);
86 byte _subjectBarStatus;
87 byte _objectBarStatus;
88 int8 _fadeSubject;
89 int8 _fadeObject;
90 void refreshMenus();
91 uint8 checkMenuClick(uint8 menuType);
92 //- lower menu, speech subjects:
93 MenuIcon *_subjects[16];
94 uint32 _subjectBar[16];
95 //- top menu, items
96 MenuIcon *_objects[TOTAL_pockets];
97 uint32 _menuList[TOTAL_pockets];
98 uint32 _inMenu;
99
100 Screen *_screen;
101 Mouse *_mouse;
102 static const Subject _subjectList[TOTAL_subjects];
103
104 static const byte _fadeEffectTop[64];
105 static const byte _fadeEffectBottom[64];
106
107 Common::Mutex _menuMutex;
108};
109
110} // End of namespace Sword1
111
112#endif //BSMENU_H
Definition: mutex.h:67
Definition: menu.h:65
Definition: menu.h:51
Definition: mouse.h:70
Definition: screen.h:75
Definition: animation.h:38
Definition: atari-screen.h:58
Definition: menu.h:43
Definition: object.h:62
Definition: menu.h:38