ScummVM API documentation
computer.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 PELROCK_COMPUTER_H
23#define PELROCK_COMPUTER_H
24
25namespace Pelrock {
26
27class PelrockEventManager;
28
29// Book data location in ALFRED.7
30static const uint32 kBookDataOffset = 0x309E0;
31static const uint32 kBookDataEnd = 0x33F05;
32
33// Field sizes
34static const int kBookTitleSize = 55;
35static const int kBookAuthorSize = 30;
36static const int kBookGenreSize = 20;
37
39 Common::StringArray title; // 55 bytes for title
40 Common::StringArray author; // 30 bytes for author
41 Common::String genre; // 20 bytes for genre
42 byte inventoryIndex;
43 byte shelf; // 1-3 for row number
44 bool available; // true = can be found on shelf, false = catalog only
45};
46
47class Computer {
48public:
50 ~Computer();
51
55 int run();
56 Common::String _memorizedMsg; // "Bueno... Tendre que buscar en la estanteria de la %c"
57
58private:
59 enum ComputerState {
60 STATE_MAIN_MENU,
61 STATE_SEARCH_BY_TITLE,
62 STATE_SEARCH_BY_AUTHOR,
63 STATE_SHOW_RESULTS,
64 STATE_EXIT
65 };
66
67 PelrockEventManager *_events = nullptr;
68 Graphics::ManagedSurface _backgroundScreen;
69 byte *_palette = nullptr;
70
71 // State variables
72 ComputerState _state;
73 char _searchLetter = ' ';
74 int _searchType = 0; // 0 = title, 1 = author
75 Common::Array<int> _searchResults;
76 Common::Array<LibraryBook> _libraryBooks;
77 uint _currentResult;
78 int _memorizedBookIndex; // Index of book that was memorized (-1 if none)
79 int _lineHeight = 0;
80 Common::String _titleMsg;
81 Common::String _authorMsg;
82
84
85 void loadBackground();
86 void cleanup();
87 void handleMainMenu();
88 void handleSearchInput();
89 void handleResultsDisplay();
90 void performSearch();
91 void drawScreen();
92 void memorizeBook(int bookIndex);
93 void init();
94};
95
96} // End of namespace Pelrock
97
98#endif
Definition: str.h:59
Definition: managed_surface.h:51
Definition: computer.h:47
Definition: events.h:28
Definition: computer.h:38