ScummVM API documentation
journal.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/*
23 * This code is based on the CRAB engine
24 *
25 * Copyright (c) Arvind Raja Yadav
26 *
27 * Licensed under MIT
28 *
29 */
30
31#ifndef CRAB_JOURNAL_H
32#define CRAB_JOURNAL_H
33
34#include "crab/ui/ImageData.h"
35#include "crab/ui/questmenu.h"
36#include "crab/ui/StateButton.h"
37
38namespace Crab {
39
40#define JE_CUR_NAME "cur"
41#define JE_DONE_NAME "done"
42#define JE_PEOPLE_NAME "people"
43#define JE_LOCATION_NAME "location"
44#define JE_HISTORY_NAME "history"
45
46namespace pyrodactyl {
47namespace ui {
48// The categories of journal entries
49enum JournalCategory {
50 JE_CUR, // Quests in progress
51 JE_DONE, // Completed quests
52 JE_PEOPLE, // Info about characters
53 JE_LOCATION, // Info about locations
54 JE_HISTORY, // All the other info
55 JE_TOTAL // The total number of categories
56};
57
58class Journal {
59 // The background image data
60 ImageData _bg;
61
62 // The menu to select the category to display
63 Menu<StateButton> _category;
64
65 // The selected category
66 int _select;
67
68 // A group contains the entire journal for a single character
69 struct Group {
70 // Id of the character who this journal belongs to
72
73 // The set of menus containing all categories of journals
74 QuestMenu _menu[JE_TOTAL];
75 };
76
77 // This contains journal entries for all characters
78 Common::Array<Group> _journal;
79
80 // The reference quest menu, used to copy layouts
81 QuestMenu _ref;
82
83 // This button is the "go to map" button, shown if the quest has a corresponding map marker
84 Button _bu_map;
85
86 void select(const Common::String &id, const int &choice);
87
88public:
89 // The title of the quest selected by the "show in map" button
90 Common::String _markerTitle;
91
92 Journal() {
93 _select = 0;
94 }
95
96 ~Journal() {}
97
98 void load(const Common::Path &filename);
99 void draw(const Common::String &id);
100
101 // Return true if "go to map" is selected
102 bool handleEvents(const Common::String &id, const Common::Event &event);
103
104 void add(const Common::String &id, const Common::String &category, const Common::String &title, const Common::String &text);
105 void move(const Common::String &id, const Common::String &title, const bool &completed);
106 void marker(const Common::String &id, const Common::String &title, const bool &val);
107
108 // Open a specific entry in the journal
109 void open(const Common::String &id, const JournalCategory &category, const Common::String &title);
110
111 // Prepare a new character's journal
112 void init(const Common::String &id);
113
114 void saveState(rapidxml::xml_document<char> &doc, rapidxml::xml_node<char> *root);
115 void loadState(rapidxml::xml_node<char> *node);
116
117 void setUI();
118};
119} // End of namespace ui
120} // End of namespace pyrodactyl
121
122} // End of namespace Crab
123
124#endif // CRAB_JOURNAL_H
Definition: path.h:52
Definition: str.h:59
Definition: button.h:86
Definition: ImageData.h:40
Definition: journal.h:58
Definition: menu.h:47
Definition: questmenu.h:42
Definition: events.h:218