1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107
|
/* ScummVM - Graphic Adventure Engine
*
* ScummVM is the legal property of its developers, whose names
* are too numerous to list here. Please refer to the COPYRIGHT
* file distributed with this source distribution.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
#ifndef ULTIMA4_MAP_MOVEMENT_H
#define ULTIMA4_MAP_MOVEMENT_H
#include "ultima/ultima4/map/direction.h"
#include "ultima/ultima4/map/map.h"
namespace Ultima {
namespace Ultima4 {
class Object;
class Map;
class Tile;
enum SlowedType {
SLOWED_BY_NOTHING,
SLOWED_BY_TILE,
SLOWED_BY_WIND
};
enum MoveResult {
MOVE_SUCCEEDED = 0x0001,
MOVE_END_TURN = 0x0002,
MOVE_BLOCKED = 0x0004,
MOVE_MAP_CHANGE = 0x0008,
MOVE_TURNED = 0x0010, /* dungeons and ship movement */
MOVE_DRIFT_ONLY = 0x0020, /* balloon -- no movement */
MOVE_EXIT_TO_PARENT = 0x0040,
MOVE_SLOWED = 0x0080,
MOVE_MUST_USE_SAME_EXIT = 0x0100
};
class MoveEvent {
public:
MoveEvent(Direction d, bool user) : _dir(d), _userEvent(user), _result(MOVE_SUCCEEDED) {}
Direction _dir; /**< the direction of the move */
bool _userEvent; /**< whether the user initiated the move */
MoveResult _result; /**< how the movement was resolved */
};
/**
* Attempt to move the avatar in the given direction. User event
* should be set if the avatar is being moved in response to a
* keystroke. Returns zero if the avatar is blocked.
*/
void moveAvatar(MoveEvent &event);
/**
* Moves the avatar while in dungeon view
*/
void moveAvatarInDungeon(MoveEvent &event);
/**
* Moves an object on the map according to its movement behavior
* Returns 1 if the object was moved successfully, 0 if slowed,
* tile direction changed, or object simply cannot move
* (fixed objects, nowhere to go, etc.)
*/
int moveObject(class Map *map, class Creature *obj, MapCoords avatar);
/**
* Moves an object in combat according to its chosen combat action
*/
int moveCombatObject(int action, class Map *map, class Creature *obj, MapCoords target);
/**
* Moves a party member during combat screens
*/
void movePartyMember(MoveEvent &event);
/**
* Default handler for slowing movement.
* Returns true if slowed, false if not slowed
*/
bool slowedByTile(const Tile *tile);
/**
* Slowed depending on the direction of object with respect to wind direction
* Returns true if slowed, false if not slowed
*/
bool slowedByWind(int direction);
} // End of namespace Ultima4
} // End of namespace Ultima
#endif
|