1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
|
/* 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.
*
*/
#ifndef CRYOMNI3D_VERSAILLES_DOCUMENTATION_H
#define CRYOMNI3D_VERSAILLES_DOCUMENTATION_H
#include "common/hashmap.h"
#include "common/hash-str.h"
#include "common/rect.h"
#include "common/str-array.h"
#include "graphics/managed_surface.h"
namespace CryOmni3D {
class FontManager;
class MouseBoxes;
class Sprites;
class CryOmni3DEngine;
namespace Versailles {
class Versailles_Documentation {
public:
Versailles_Documentation() : _engine(nullptr), _fontManager(nullptr), _messages(nullptr),
_linksData(nullptr), _linksSize(0) { }
~Versailles_Documentation() { delete _linksData; }
void init(const Sprites *sprites, FontManager *fontManager, const Common::StringArray *messages,
CryOmni3DEngine *engine);
void handleDocArea();
void handleDocInGame(const Common::String &record);
private:
Common::String docAreaHandleSummary();
Common::String docAreaHandleTimeline();
Common::String docAreaHandleGeneralMap();
Common::String docAreaHandleCastleMap();
unsigned int docAreaHandleRecords(const Common::String &record);
void docAreaPrepareNavigation();
void docAreaPrepareRecord(Graphics::ManagedSurface &surface, MouseBoxes &boxes);
unsigned int docAreaHandleRecord(Graphics::ManagedSurface &surface, MouseBoxes &boxes,
Common::String &nextRecord);
void inGamePrepareRecord(Graphics::ManagedSurface &surface, MouseBoxes &boxes);
unsigned int inGameHandleRecord(Graphics::ManagedSurface &surface, MouseBoxes &boxes,
Common::String &nextRecord);
void setupRecordBoxes(bool inDocArea, MouseBoxes &boxes);
void setupTimelineBoxes(MouseBoxes &boxes);
void drawRecordData(Graphics::ManagedSurface &surface,
const Common::String &text, const Common::String &title,
const Common::String &subtitle, const Common::String &caption);
void drawRecordBoxes(Graphics::ManagedSurface &surface, bool inDocArea, MouseBoxes &boxes);
unsigned int handlePopupMenu(const Graphics::ManagedSurface &surface,
const Common::Point &anchor, bool rightAligned, unsigned int itemHeight,
const Common::StringArray &items);
struct RecordInfo {
unsigned int id;
unsigned int position;
unsigned int size;
};
struct LinkInfo {
Common::String record;
Common::String title;
};
struct TimelineEntry {
char year[8];
unsigned int x;
unsigned int y;
};
static const TimelineEntry kTimelineEntries[];
static char *getDocPartAddress(char *start, char *end, const char *patterns[]);
static const char *getDocTextAddress(char *start, char *end);
static const char *getRecordTitle(char *start, char *end);
static const char *getRecordSubtitle(char *start, char *end);
static const char *getRecordCaption(char *start, char *end);
static void getRecordHyperlinks(char *start, char *end, Common::StringArray &hyperlinks);
Common::String getRecordTitle(const Common::String &record);
Common::String getRecordData(const Common::String &record, Common::String &title,
Common::String &subtitle, Common::String &caption,
Common::StringArray &hyperlinks);
void convertHyperlinks(const Common::StringArray &hyperlinks, Common::Array<LinkInfo> &links);
void loadLinksFile();
void getLinks(const Common::String &record, Common::Array<LinkInfo> &links);
static const char *kAllDocsFile;
static const char *kLinksDocsFile;
static const unsigned int kPopupMenuMargin = 5;
CryOmni3DEngine *_engine;
FontManager *_fontManager;
const Sprites *_sprites;
const Common::StringArray *_messages;
Common::StringArray _recordsOrdered;
Common::HashMap<Common::String, RecordInfo> _records;
char *_linksData;
unsigned int _linksSize;
Common::Array<LinkInfo> _allLinks;
Common::StringArray _visitTrace;
Common::String _currentRecord;
Common::String _categoryStartRecord;
Common::String _categoryEndRecord;
Common::String _categoryTitle;
Common::Array<LinkInfo> _currentLinks;
bool _currentInTimeline;
bool _currentMapLayout;
bool _currentHasMap;
};
} // End of namespace Versailles
} // End of namespace CryOmni3D
#endif
|