ScummVM API documentation
actor_path_controller.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 HOLLYWOOD_MONSTERS_SCENES_PLAYABLE_ACTOR_PATH_CONTROLLER_H
23#define HOLLYWOOD_MONSTERS_SCENES_PLAYABLE_ACTOR_PATH_CONTROLLER_H
24
25#include "common/array.h"
26#include "common/types.h"
27
28#include "hollywood/monsters/scenes/playable/actor_types.h"
29#include "hollywood/monsters/scenes/scene_data.h"
30
31namespace Hollywood {
32
33enum {
34 kActorPathStepDeltaTableSize = 72
35};
36
37// Canonical six-facing, twelve-cel movement tables shared by scene resources.
38extern const byte kActorPathStepDeltaTableSet00[kActorPathStepDeltaTableSize];
39extern const byte kActorPathStepDeltaTableSetB4[kActorPathStepDeltaTableSize];
40extern const byte kActorPathStepDeltaTableSet87[kActorPathStepDeltaTableSize];
41extern const byte kActorPathStepDeltaTableSet5A[kActorPathStepDeltaTableSize];
42
51public:
53
54 virtual byte paletteRegionAt(int x, int y) const = 0;
55 virtual bool customizeRouteSegment(byte currentRegion, byte nextRegion, const ActorPathBuildState &state,
56 const ScenePoint &boundary, int &requestedFacing, bool &restoredStepDeltas) = 0;
57 virtual bool customizeRouteFinal(byte currentRegion, byte targetRegion, const ActorPathBuildState &state,
58 int targetX, int targetY, int &requestedFacing, bool &restoredStepDeltas) = 0;
59};
60
69public:
71
72 void initialize(uint routeBoundaryPointCount, uint routeStepCount, uint paletteRegionCount,
73 uint boundaryCandidateCount, uint routeStepCountPerRegionPair,
74 const byte *defaultStepDeltas, uint defaultStepDeltaCount);
75 bool loadRouteTables(const Common::Array<byte> &metadata, uint routeBoundaryOffset,
76 uint routeStepsOffset, const char *archiveName);
77 void resetStepDeltas(const byte *table, uint tableSize);
78 void queueWithPaletteRegionRouting(ActorPathControllerDelegate &delegate, int startX, int startY,
79 int targetX, int targetY, byte initialDrawOrderMode, byte initialFacing, byte initialCel,
80 byte finalFacing, byte finalCel, byte invalidFacing, byte invalidCel,
81 const byte *baseStepDeltas, uint baseStepDeltaCount);
82
83 byte calculateFacingTowardPoint(int fromX, int fromY, int toX, int toY) const;
84
85 Common::Array<ScenePoint> _routeBoundaryPoints;
86 Common::Array<byte> _routeSteps;
88 Common::Array<byte> _stepDeltas;
89
90private:
91 void buildFramesBetweenPoints(ActorPathBuildState &state, int targetX, int targetY,
92 byte finalFacing, byte finalCel, int requestedFacing, byte invalidFacing, byte invalidCel);
93 void appendFrame(const ActorPathBuildState &state);
94 ScenePoint nearestPaletteRouteBoundaryPoint(int startX, int startY, byte currentRegion, byte nextRegion) const;
95 ScenePoint bestPaletteRouteBoundaryPoint(int startX, int startY, int targetX, int targetY,
96 byte currentRegion, byte targetRegion) const;
97 byte calculateMovementFacingForPath(int fromX, int fromY, int toX, int toY, int requestedFacing) const;
98 uint calculateWalkStepCountForAxisDelta(int startAxis, int targetAxis, byte facing, byte cel) const;
99 byte nextCel(byte cel) const;
100 uint stepDelta(byte facing, byte cel) const;
101
102 uint _paletteRegionCount;
103 uint _boundaryCandidateCount;
104 uint _routeStepCountPerRegionPair;
105};
106
107const byte *defaultActorPathStepDeltaTable();
108uint defaultActorPathStepDeltaTableSize();
109
110} // End of namespace Hollywood
111
112#endif // HOLLYWOOD_MONSTERS_SCENES_PLAYABLE_ACTOR_PATH_CONTROLLER_H
Definition: actor_path_controller.h:50
Definition: actor_path_controller.h:68
Definition: actor_types.h:59
Definition: scene_data.h:29