ScummVM API documentation
input.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 HARVESTER_INPUT_H
23
#define HARVESTER_INPUT_H
24
25
#include "common/array.h"
26
#include "common/error.h"
27
#include "common/events.h"
28
#include "common/rect.h"
29
#include "common/str.h"
30
31
namespace
Harvester {
32
33
class
Art;
34
class
CheatSystem;
35
class
DialogueSystem;
36
class
Entity;
37
class
Flow;
38
class
HarvesterEngine;
39
class
InventorySystem;
40
class
Interaction;
41
class
ItemInteractions;
42
class
Scene;
43
struct
CheatActivation;
44
struct
InteractionResult;
45
struct
InventorySecondaryAction;
46
struct
MenuTextConfig;
47
struct
NpcRecord;
48
struct
ObjectRecord;
49
struct
RegionRecord;
50
struct
ResolvedText;
51
struct
RoomHoverState;
52
struct
RoomPresentationState;
53
struct
RoomSetupState;
54
struct
SceneState;
55
56
enum
GameAction {
57
kActionMoveLeft,
58
kActionMoveRight,
59
kActionMoveUp,
60
kActionMoveDown,
61
kActionAttackModifier,
62
kActionEvasiveModifier,
63
kActionSpeedUp,
64
kActionInventory,
65
kActionMenu,
66
kActionHelp,
67
kActionHighAttack,
68
kActionMediumAttack,
69
kActionLowAttack,
70
kActionDuck,
71
kActionJump
72
};
73
74
struct
InputState
{
75
bool
moveLeft =
false
;
76
bool
moveRight =
false
;
77
bool
moveUp =
false
;
78
bool
moveDown =
false
;
79
bool
attackModifierHeld =
false
;
80
bool
evasiveModifierHeld =
false
;
81
bool
speedUpActive =
false
;
82
bool
highAttackHeld =
false
;
83
bool
mediumAttackHeld =
false
;
84
bool
lowAttackHeld =
false
;
85
bool
duckHeld =
false
;
86
bool
jumpHeld =
false
;
87
uint32 lastLeftButtonReleaseTick = 0;
88
uint32 nextKeyboardAttackAllowedTick = 0;
89
90
void
clearHeldActions() {
91
moveLeft = moveRight = moveUp = moveDown =
false
;
92
attackModifierHeld = evasiveModifierHeld = speedUpActive =
false
;
93
highAttackHeld = mediumAttackHeld = lowAttackHeld = duckHeld = jumpHeld =
false
;
94
}
95
};
96
97
// Enter and closeup exits return from runRoomLoop even when the error is kNoError.
98
struct
InputResult
{
99
Common::Error
error;
100
bool
returnFromRoom =
false
;
101
102
static
InputResult
leaveRoom(
const
Common::Error
&
error
) {
103
InputResult
result;
104
result.error =
error
;
105
result.returnFromRoom =
true
;
106
return
result;
107
}
108
};
109
110
class
Input
{
111
public
:
112
Input
(
HarvesterEngine
&engine,
Flow
&flow,
Scene
&session,
SceneState
&scene,
113
InventorySystem
&inventory,
CheatSystem
&cheats,
114
ItemInteractions
&roomItems,
Interaction
&interactionProcessor,
115
RoomPresentationState
&presentationState,
116
const
Art
&art,
bool
canExitCloseupToParent);
117
118
InputResult
handleEvent(
const
Common::Event
&event,
bool
&needsRedraw);
119
120
static
const
ObjectRecord
*findRoomObjectAtPoint(
HarvesterEngine
&engine,
121
const
Common::Array<ObjectRecord>
&sceneObjects,
const
Common::Point
&point);
122
static
RoomHoverState
resolveRoomHoverState(
HarvesterEngine
&engine,
const
RoomSetupState
&state,
123
const
Common::Array<ObjectRecord>
&sceneObjects,
124
const
Common::Array<NpcRecord>
&npcs,
125
const
Common::Array<RegionRecord>
®ions,
126
const
Common::Point
&mousePos,
const
MenuTextConfig
&menuTextConfig,
127
const
DialogueSystem
*dialogue =
nullptr
);
128
129
private
:
130
void
handleMouseMove(
bool
&needsRedraw);
131
InputResult
handleRightButtonDown(
bool
&needsRedraw);
132
void
handleLeftButtonUp();
133
InputResult
handleLeftButtonDown(
bool
&needsRedraw);
134
InputResult
handleSceneClick(
bool
isFastExitClick,
bool
&needsRedraw);
135
InputResult
handleSelectedItemClick(
const
RoomHoverState
&clickHoverState,
136
const
Entity
*itemTarget,
bool
&needsRedraw);
137
InputResult
handleSceneTargetClick(
const
RoomHoverState
&hoverState,
138
bool
isFastExitClick,
bool
&needsRedraw);
139
InputResult
handleWalkClick(
const
RoomHoverState
&hoverState,
bool
&needsRedraw);
140
InputResult
handleObjectClick(
ObjectRecord
&
object
,
bool
&needsRedraw);
141
InputResult
handleInventoryLeftClick(
bool
&needsRedraw);
142
InputResult
handleInventoryRightClick(
bool
&needsRedraw);
143
InputResult
applyInventorySecondaryAction(
const
ObjectRecord
&
object
,
144
const
InventorySecondaryAction
&secondaryAction,
bool
&needsRedraw);
145
InputResult
handleInventoryKeyDown(
const
Common::KeyState
&key,
bool
&needsRedraw);
146
InputResult
handleKeyDown(
const
Common::KeyState
&key,
bool
&needsRedraw,
bool
gameAction =
false
);
147
InputResult
handleGameplayKeyDown(
const
Common::KeyState
&key,
bool
&needsRedraw,
bool
gameAction);
148
void
handleKeyUp(
const
Common::KeyState
&key,
bool
gameAction =
false
);
149
InputResult
handleGameAction(GameAction action,
bool
pressed,
bool
&needsRedraw);
150
InputResult
applyCheatActivation(
InteractionResult
&cheatInteraction,
151
const
CheatActivation
&cheatActivation,
bool
&needsRedraw);
152
InputResult
openRoomMenu(
bool
&needsRedraw);
153
InputResult
openHelpScreen(
bool
&needsRedraw);
154
void
beginInspectText(
const
ObjectRecord
&
object
,
const
ResolvedText
&text);
155
InputResult
finishInspectText(
bool
&needsRedraw);
156
InputResult
applyObjectInteraction(
InteractionResult
&interaction,
bool
&needsRedraw);
157
void
queueCombatLoadoutStatusMessage(
const
Common::String
&message,
bool
&needsRedraw);
158
bool
openInventoryOverlay();
159
void
capturePlayerAttackTarget();
160
161
HarvesterEngine
&_engine;
162
Flow
&_flow;
163
Scene
&_session;
164
SceneState
&_scene;
165
InventorySystem
&_inventory;
166
CheatSystem
&_cheats;
167
ItemInteractions
&_roomItems;
168
Interaction
&_interactionProcessor;
169
RoomPresentationState
&_presentationState;
170
const
Art
&_art;
171
bool
_canExitCloseupToParent;
172
Common::String
_pendingInspectObjectName;
173
bool
_inspectDismissPressed =
false
;
174
};
175
176
}
// End of namespace Harvester
177
178
#endif
// HARVESTER_INPUT_H
Common::Array
Definition:
array.h:52
Common::Error
Definition:
error.h:81
Common::String
Definition:
str.h:59
Harvester::Art
Definition:
art.h:35
Harvester::CheatSystem
Definition:
cheats.h:52
Harvester::DialogueSystem
Definition:
dialogue.h:44
Harvester::Entity
Definition:
entity.h:66
Harvester::Flow
Definition:
flow.h:45
Harvester::HarvesterEngine
Definition:
harvester.h:47
Harvester::Input
Definition:
input.h:110
Harvester::Interaction
Definition:
interaction.h:104
Harvester::InventorySystem
Definition:
inventory.h:54
Harvester::ItemInteractions
Definition:
interaction.h:63
Harvester::Scene
Definition:
scene.h:62
error
void NORETURN_PRE error(MSVC_PRINTF const char *s,...) GCC_PRINTF(1
Common::Event
Definition:
events.h:218
Common::KeyState
Definition:
keyboard.h:294
Common::Point
Definition:
rect.h:144
Harvester::CheatActivation
Definition:
cheats.h:44
Harvester::InputResult
Definition:
input.h:98
Harvester::InputState
Definition:
input.h:74
Harvester::InteractionResult
Definition:
script.h:311
Harvester::InventorySecondaryAction
Definition:
inventory.h:49
Harvester::MenuTextConfig
Definition:
menu.h:45
Harvester::ObjectRecord
Definition:
script.h:86
Harvester::ResolvedText
Definition:
script.h:306
Harvester::RoomHoverState
Definition:
room_support.h:57
Harvester::RoomPresentationState
Definition:
room_presentation.h:51
Harvester::RoomSetupState
Definition:
script.h:237
Harvester::SceneState
Definition:
room_support.h:46
engines
harvester
scene
input.h
Generated on Wed Nov 25 2026 09:16:28 for ScummVM API documentation by
1.9.4