ScummVM API documentation
notebook.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 TINSEL_NOTEBOOK_H // prevent multiple includes
23 #define TINSEL_NOTEBOOK_H
24 
25 #include "common/scummsys.h"
26 
27 #include "notebook_page.h"
28 #include "tinsel/anim.h"
29 #include "tinsel/events.h"
30 #include "tinsel/object.h"
31 
32 namespace Tinsel {
33 // links two clue/title objects together
34 struct HYPERLINK {
35  int32 id1 = 0;
36  int32 id2 = 0;
37 };
38 
39 // 6 bytes large
40 struct ENTRY {
41  int32 id;
42  bool active;
43  int32 page1;
44  int32 indexOnPage1;
45  int32 page2;
46  int32 indexOnPage2;
47 };
48 
49 enum class BOOKSTATE {
50  CLOSED = 0,
51  OPEN_UNKNOWN = 1,
52  OPEN_ANIMATING = 2,
53  OPENED = 3,
54  PAGEFLIP = 4
55 };
56 
57 class NoteBookPolygons;
58 class InventoryObjectT3;
59 
60 class Notebook {
61 public:
62  Notebook();
63  ~Notebook();
64 
65  // Adds a connection between a clue/title
66  void addHyperlink(int32 id1, int32 id2);
67  void addClue(int id);
68  void crossClue(int id);
69  // Called within InventoryProcess loop
70  void redraw();
71 
72  // Called from OPENNOTEBOOK
73  void show(bool isOpen);
74  bool isOpen() const;
75  void close();
76 
77  bool handlePointer(const Common::Point &point);
78  bool handleEvent(PLR_EVENT pEvent, const Common::Point &coOrds);
79  void stepAnimScripts();
80  void refresh();
81 
82  NoteBookPolygons *_polygons = nullptr;
83 private:
84  int addTitle(const InventoryObjectT3 &invObject);
85  void addClue(const InventoryObjectT3 &invObject);
86  int getPageWithTitle(int id);
87 
88  void pageFlip(bool up);
89 
90  int32 GetPointedClue(const Common::Point &point) const;
91 
92  void clearNotebookPage();
93 
94  void setNextPage(int pageIndex);
95 
96  const static uint32 MAX_PAGES = 0x15;
97  const static uint32 MAX_HYPERS = 0xf;
98 
99  HYPERLINK _hyperlinks[MAX_HYPERS];
100 
101  uint32 _numPages = 1;
102  int32 _prevPage = -1;
103  uint32 _currentPage = 1;
104 
105  NotebookPage _pages[MAX_PAGES] = {};
106 
107  ANIM _anim = {};
108  OBJECT *_object = nullptr;
109 
110  ANIM _pageAnim = {};
111  OBJECT *_pageObject = nullptr;
112 
113  BOOKSTATE _state = BOOKSTATE::CLOSED;
114 };
115 
116 } // End of namespace Tinsel
117 
118 #endif
Definition: inv_objects.h:80
Definition: anim.h:33
Definition: object.h:73
Definition: notebook.h:60
Definition: actors.h:36
Definition: rect.h:45
Definition: polygons.h:178
Definition: notebook_page.h:46
Definition: notebook.h:40
Definition: notebook.h:34