ScummVM API documentation
player_movement.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_PLAYER_MOVEMENT_H
23 #define HARVESTER_PLAYER_MOVEMENT_H
24 
25 #include "harvester/player/player.h"
26 
27 namespace Harvester {
28 namespace PlayerMovement {
29 
31  HarvesterEngine &engine;
32  const RoomSetupState &state;
33  const Common::Array<ObjectRecord> &sceneObjects;
34  const Common::Array<AnimRecord> &sceneAnimations;
35  RoomPlayerState &playerState;
36 };
37 
39  int centerX;
40  int bottomY;
41  float z;
42 };
43 
46  PlayerAnimationRange(int walkFirstFrame, int walkLastFrame, int idleFrame)
47  : walkFirstFrame(walkFirstFrame), walkLastFrame(walkLastFrame), idleFrame(idleFrame) {}
48 
49  int walkFirstFrame = 0;
50  int walkLastFrame = 0;
51  int idleFrame = 0;
52 };
53 
54 extern const float kRoomDepthCompareEpsilon;
55 
56 PlayerAnimationRange resolvePlayerAnimationRange(int facing);
57 int clampRoomMovementY(const RoomSetupState &state, int screenY);
58 float mapRoomScreenYToDepth(const RoomSetupState &state, int screenY);
59 float clampRoomDepth(const RoomSetupState &state, float z);
60 int mapRoomDepthToScreenY(const RoomSetupState &state, float z);
61 int computeRoomPlayerHorizontalStep(const RoomSetupState &state, float z);
62 float computeRoomPlayerDepthStep(const RoomSetupState &state);
63 int computePlayerFrameLeftX(const RoomPlayerState &playerState);
64 float computePlayerRenderZ(const RoomPlayerState &playerState);
65 float clampPlayerMovementDepth(const RoomSetupState &state,
66  const RoomPlayerState &playerState, float z);
67 int clampPlayerCenterXToNativeBounds(const RoomPlayerState &playerState, int centerX);
68 bool consumePlayerMovementTick(RoomPlayerState &playerState);
69 void setPlayerCurrentBlocker(RoomPlayerState &playerState, const Entity *blocker);
70 void refreshPlayerCurrentBlocker(const MovementContext &context);
71 void reinsertPlayerSceneEntity(HarvesterEngine &engine, const RoomPlayerState &playerState);
72 bool isPlayerMovementBlocked(const MovementContext &context, const MovementPosition &candidate,
73  const Common::String *ignoredBlockerName = nullptr, const Entity **blockerOut = nullptr);
74 bool tryApplyPlayerMovement(const MovementContext &context, MovementPosition candidate,
75  const Common::String *ignoredBlockerName = nullptr, const Entity **blockerOut = nullptr);
76 bool tryApplyPlayerWalkMovement(const MovementContext &context, const MovementPosition &candidate,
77  int horizontalDirection, int depthDirection, const Entity **blockerOut = nullptr);
78 bool isPathfindingDebugEnabled();
79 void syncPlayerAnimationPlacement(RoomPlayerState &playerState);
80 
81 int resolveFacingFromMoveDirection(int horizontalDirection, int depthDirection, int fallbackFacing);
82 bool setPlayerWalkAnimation(RoomPlayerState &playerState, int facing);
83 
84 } // End of namespace PlayerMovement
85 } // End of namespace Harvester
86 
87 #endif // HARVESTER_PLAYER_MOVEMENT_H
Definition: script.h:237
Definition: str.h:59
Definition: art.h:31
Definition: player_movement.h:30
Definition: array.h:52
Definition: player.h:36
Definition: entity.h:66
Definition: player_movement.h:44
Definition: harvester.h:47
Definition: player_movement.h:38