ScummVM API documentation
actor_walk.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 BLADERUNNER_ACTOR_WALK_H
23 #define BLADERUNNER_ACTOR_WALK_H
24 
25 #include "bladerunner/vector.h"
26 #include "common/hashmap.h"
27 
28 namespace BladeRunner {
29 
30 class BladeRunnerEngine;
31 class SaveFileReadStream;
32 class SaveFileWriteStream;
33 
34 class ActorWalk {
35  BladeRunnerEngine *_vm;
36 
37  int _walking;
38  int _running;
39  Vector3 _destination;
40  Vector3 _originalDestination;
41  Vector3 _current;
42  Vector3 _next;
43  int _facing;
44  Common::HashMap<int, bool> _nearActors;
45  int _status;
46 
47 public:
49  ~ActorWalk();
50 
51  void reset(); // added method for bug fix (bad new game state for player actor) and better management of object
52 
53  bool setup(int actorId, bool runFlag, const Vector3 &from, const Vector3 &to, bool mustReach, bool *arrived);
54  void getCurrentPosition(int actorId, Vector3 *pos, int *facing) const;
55  bool tick(int actorId, float stepDistance, bool flag);
56 
57  bool isWalking() const { return _walking; }
58  bool isRunning() const { return _running; }
59 
60  bool isXYZOccupied(float x, float y, float z, int actorId) const;
61  bool findEmptyPositionAround(int actorId, const Vector3 &from, int distance, Vector3 &out) const;
62 
63  void stop(int actorId, bool immediately, int combatAnimationMode, int animationMode);
64  void run(int actorId);
65 
66  void save(SaveFileWriteStream &f);
67  void load(SaveFileReadStream &f);
68 
69 private:
70  int nextOnPath(int actorId, const Vector3 &from, const Vector3 &to, Vector3 &next) const;
71 
72  bool findEmptyPositionAroundToOriginalDestination(int actorId, Vector3 &out) const;
73 
74  bool addNearActors(int skipActorId);
75 
76  void obstaclesAddNearActors(int actorId) const;
77  void obstaclesRestore() const;
78 };
79 
80 } // End of namespace BladeRunner
81 
82 #endif
Definition: savefile.h:88
Definition: actor.h:31
Definition: savefile.h:113
Definition: actor_walk.h:34
Definition: vector.h:47
Definition: bladerunner.h:113