ScummVM API documentation
peepholepuzzle.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 NANCY_ACTION_PEEPHOLEPUZZLE_H
23
#define NANCY_ACTION_PEEPHOLEPUZZLE_H
24
25
#include "engines/nancy/action/autotext.h"
26
#include "engines/nancy/action/puzzlerecord.h"
27
28
namespace
Nancy
{
29
namespace
Action {
30
31
// Action record that, despite what its name suggests, is mostly used
32
// to render Nancy's diary in nancy6 and up.
33
class
PeepholePuzzle
:
public
PuzzleRecord
{
34
public
:
35
PeepholePuzzle
() :
PuzzleRecord
(7) {}
36
virtual
~
PeepholePuzzle
() {}
37
38
void
init()
override
;
39
40
void
readData(
Common::SeekableReadStream
&stream)
override
;
41
void
execute()
override
;
42
void
handleInput(
NancyInput
&input)
override
;
43
44
bool
isViewportRelative()
const override
{
return
true
; }
45
46
protected
:
47
Common::String
getRecordTypeName()
const override
{
return
"PeepholePuzzle"
; }
48
49
void
drawInner();
50
void
checkButtons();
51
52
Common::Path
_innerImageName;
53
Common::Path
_buttonsImageName;
54
55
uint16 _transparency = 0;
56
57
Common::Rect
_innerBounds;
58
Common::Rect
_startSrc;
59
Common::Rect
_dest;
60
61
// Order: up, down, left, right
62
Common::Array<Common::Rect>
_buttonDests;
63
Common::Array<Common::Rect>
_buttonSrcs;
64
Common::Array<Common::Rect>
_buttonDisabledSrcs;
65
66
byte _pixelsToScroll = 0;
67
68
Graphics::ManagedSurface
_innerImage;
69
Graphics::ManagedSurface
_buttonsImage;
70
71
Common::Rect
_currentSrc;
72
int
_pressedButton = -1;
73
uint32 _pressStart = 0;
74
Common::Array<bool>
_disabledButtons =
Common::Array<bool>
(4,
false
);
75
};
76
77
// Combines the Peephole with the Autotext used to supply its text data
78
// Implementing this with diamond-shaped multiple inheritance is bad,
79
// but so is the original design, where a Peephole is constructed
80
// on the fly and replaces the TextScroll/AutotextEntryList
81
class
TextScroll
:
public
Autotext
,
public
PeepholePuzzle
{
82
public
:
83
enum
ScrollType { kTextScroll, kAutotextEntryList };
84
85
TextScroll
(ScrollType scrollType) : _scrollType(scrollType) { _selfDisplay =
false
; _hasPlacementDescriptor =
false
; }
86
87
void
init()
override
;
88
void
execute()
override
{ PeepholePuzzle::execute(); }
89
void
handleInput(
NancyInput
&input)
override
;
90
91
void
readData(
Common::SeekableReadStream
&stream)
override
;
92
93
protected
:
94
Common::String
getRecordTypeName()
const override
{
return
_scrollType == kAutotextEntryList ?
"AutotextEntryList"
:
"TextScroll"
; }
95
void
readExtraData(
Common::SeekableReadStream
&stream)
override
;
96
97
ScrollType _scrollType;
98
};
99
100
}
// End of namespace Action
101
}
// End of namespace Nancy
102
103
#endif // NANCY_ACTION_PEEPHOLEPUZZLE_H
Graphics::ManagedSurface
Definition:
managed_surface.h:51
Common::String
Definition:
str.h:59
Common::Array< Common::Rect >
Nancy::Action::PeepholePuzzle
Definition:
peepholepuzzle.h:33
Common::Rect
Definition:
rect.h:536
Common::Path
Definition:
path.h:52
Common::SeekableReadStream
Definition:
stream.h:745
Nancy::NancyInput
Definition:
input.h:41
Nancy::Action::Autotext
Definition:
autotext.h:47
Nancy::Action::PuzzleRecord
Definition:
puzzlerecord.h:37
Nancy::Action::TextScroll
Definition:
peepholepuzzle.h:81
Nancy
Definition:
actionmanager.h:32
engines
nancy
action
puzzle
peepholepuzzle.h
Generated on Thu Oct 22 2026 09:23:47 for ScummVM API documentation by
1.8.13