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 8 * modify it under the terms of the GNU General Public License 9 * as published by the Free Software Foundation; either version 2 10 * of the License, or (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, write to the Free Software 19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 20 * 21 */ 22 23 #ifndef BLADERUNNER_ACTOR_WALK_H 24 #define BLADERUNNER_ACTOR_WALK_H 25 26 #include "bladerunner/vector.h" 27 #include "common/hashmap.h" 28 29 namespace BladeRunner { 30 31 class BladeRunnerEngine; 32 class SaveFileReadStream; 33 class SaveFileWriteStream; 34 35 class ActorWalk { 36 BladeRunnerEngine *_vm; 37 38 int _walking; 39 int _running; 40 Vector3 _destination; 41 Vector3 _originalDestination; 42 Vector3 _current; 43 Vector3 _next; 44 int _facing; 45 Common::HashMap<int, bool> _nearActors; 46 int _status; 47 48 public: 49 ActorWalk(BladeRunnerEngine *vm); 50 ~ActorWalk(); 51 52 void reset(); // added method for bug fix (bad new game state for player actor) and better management of object 53 54 bool setup(int actorId, bool runFlag, const Vector3 &from, const Vector3 &to, bool mustReach, bool *arrived); 55 void getCurrentPosition(int actorId, Vector3 *pos, int *facing) const; 56 bool tick(int actorId, float stepDistance, bool flag); 57 isWalking()58 bool isWalking() const { return _walking; } isRunning()59 bool isRunning() const { return _running; } 60 61 bool isXYZOccupied(float x, float y, float z, int actorId) const; 62 bool findEmptyPositionAround(int actorId, const Vector3 &from, int distance, Vector3 &out) const; 63 64 void stop(int actorId, bool immediately, int combatAnimationMode, int animationMode); 65 void run(int actorId); 66 67 void save(SaveFileWriteStream &f); 68 void load(SaveFileReadStream &f); 69 70 private: 71 int nextOnPath(int actorId, const Vector3 &from, const Vector3 &to, Vector3 &next) const; 72 73 bool findEmptyPositionAroundToOriginalDestination(int actorId, Vector3 &out) const; 74 75 bool addNearActors(int skipActorId); 76 77 void obstaclesAddNearActors(int actorId) const; 78 void obstaclesRestore() const; 79 }; 80 81 } // End of namespace BladeRunner 82 83 #endif 84