ScummVM API documentation
myst_card.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 MYST_CARD_H
23
#define MYST_CARD_H
24
25
#include "common/rect.h"
26
27
#include "mohawk/myst.h"
28
29
namespace
Mohawk
{
30
39
class
MystCard
{
40
public
:
41
MystCard
(
MohawkEngine_Myst
*vm, uint16
id
);
42
~
MystCard
();
43
45
uint16
getId
()
const
;
46
48
void
enter
();
49
51
void
leave
();
52
54
template
<
class
T>
55
T *
getResource
(uint index);
56
58
Common::Array<MystArea *>
_resources
;
59
61
void
setResourceEnabled
(uint16 resourceIndex,
bool
enable);
62
64
void
updateActiveResource
(
const
Common::Point
&mouse);
65
67
MystArea
*
forceUpdateClickedResource
(
const
Common::Point
&mouse);
68
74
void
resetClickedResource
();
75
82
int16
getActiveResourceCursor
();
83
90
void
updateResourcesForInput
(
const
Common::Point
&mouse,
bool
mouseClicked,
bool
mouseMoved);
91
93
bool
isDraggingResource
()
const
;
94
96
uint16
getBackgroundImageId
();
97
99
void
drawBackground
();
100
102
void
drawResourceImages
();
103
105
void
drawResourceRects
();
106
108
void
redrawArea
(uint16 var,
bool
updateScreen =
true
);
109
110
private
:
111
// View flags
112
enum
{
113
kMystZipDestination = (1 << 0)
114
};
115
116
struct
MystCursorHint {
117
uint16 id;
118
int16 cursor;
119
120
MystCondition
variableHint;
121
};
122
123
MohawkEngine_Myst
*_vm;
124
125
// General card data
126
uint16 _id;
127
uint16 _flags;
128
129
// Image Data
130
Common::Array<MystCondition>
_conditionalImages;
131
uint16 _mainImage;
132
133
// Sound Data
134
MystSoundBlock
_soundBlock;
135
136
// Script Resources
137
enum
ScriptResourceType {
138
kResourceImage = 1,
139
kResourceSound = 2,
140
kResourceSwitch = 3,
141
kResourceImageNoCache = 4,
142
kResourceSoundNoCache = 5
143
};
144
145
struct
ScriptResource {
146
ScriptResourceType type;
147
uint16 id;
148
uint16 switchVar;
149
ScriptResourceType switchResourceType;
150
Common::Array<int16>
switchResourceIds;
151
};
152
Common::Array<ScriptResource>
_scriptResources;
153
154
uint16 _resourceListId;
155
uint16 _hintResourceId;
156
uint16 _initScriptId;
157
uint16 _exitScriptId;
158
159
Common::Array<MystCursorHint>
_cursorHints;
160
162
MystAreaHover
*_hoverResource;
163
165
MystArea
*_activeResource;
166
168
MystArea
*_clickedResource;
169
170
void
loadView();
171
void
loadResources();
172
void
loadCursorHints();
173
174
void
runInitScript();
175
void
runExitScript();
176
};
177
178
template
<
class
T>
179
T *
MystCard::getResource
(uint index) {
180
T *resource =
dynamic_cast<
T *
>
(
_resources
[index]);
181
182
if
(!resource) {
183
error
(
"View resource '%d' has unexpected type"
, index);
184
}
185
186
return
resource;
187
}
188
189
}
// End of namespace Mohawk
190
191
#endif
Mohawk::MystCard::_resources
Common::Array< MystArea * > _resources
Definition:
myst_card.h:58
Mohawk::MystCard::leave
void leave()
Mohawk::MystAreaHover
Definition:
myst_areas.h:253
Common::Array
Definition:
array.h:52
Mohawk::MystCard::setResourceEnabled
void setResourceEnabled(uint16 resourceIndex, bool enable)
Mohawk::MystCard::drawBackground
void drawBackground()
Mohawk::MystCondition
Definition:
myst.h:100
Mohawk::MystCard::getBackgroundImageId
uint16 getBackgroundImageId()
Mohawk::MystCard::getId
uint16 getId() const
Mohawk::MystCard::drawResourceRects
void drawResourceRects()
Mohawk::MystCard::enter
void enter()
Mohawk::MystCard::getActiveResourceCursor
int16 getActiveResourceCursor()
Mohawk::MohawkEngine_Myst
Definition:
myst.h:129
Mohawk::MystCard::updateActiveResource
void updateActiveResource(const Common::Point &mouse)
Mohawk::MystCard::redrawArea
void redrawArea(uint16 var, bool updateScreen=true)
Mohawk::MystCard::getResource
T * getResource(uint index)
Definition:
myst_card.h:179
Common::Point
Definition:
rect.h:45
Mohawk::MystSoundBlock
Definition:
myst.h:105
error
void NORETURN_PRE error(MSVC_PRINTF const char *s,...) GCC_PRINTF(1
Mohawk::MystArea
Definition:
myst_areas.h:59
Mohawk::MystCard::forceUpdateClickedResource
MystArea * forceUpdateClickedResource(const Common::Point &mouse)
Mohawk::MystCard::isDraggingResource
bool isDraggingResource() const
Mohawk::MystCard
Definition:
myst_card.h:39
Mohawk::MystCard::updateResourcesForInput
void updateResourcesForInput(const Common::Point &mouse, bool mouseClicked, bool mouseMoved)
Mohawk::MystCard::resetClickedResource
void resetClickedResource()
Mohawk::MystCard::drawResourceImages
void drawResourceImages()
Mohawk
Definition:
bitmap.h:32
engines
mohawk
myst_card.h
Generated on Sun Dec 22 2024 09:15:24 for ScummVM API documentation by
1.8.13