X-Git-Url: http://git.localhorst.tv/?a=blobdiff_plain;f=src%2Fmap%2FEntity.cpp;h=6bce2adfde82b28d092cd08a03eae7fd39246f7e;hb=e1dab8a680a76f8621e967a693dbf2b481ba8f75;hp=d239844ea2ef420bd76fd5e47a57dbe7082359e0;hpb=85aa2343f438894dd19e6ad1228eaca47bfb83a9;p=l2e.git diff --git a/src/map/Entity.cpp b/src/map/Entity.cpp index d239844..6bce2ad 100644 --- a/src/map/Entity.cpp +++ b/src/map/Entity.cpp @@ -26,6 +26,7 @@ Entity::Entity() , partyLayout(0) , monsters(0) , numMonsters(0) +, direction(ORIENTATION_NORTH) , orientation(ORIENTATION_NORTH) , speed(0) , flags(0) { @@ -35,12 +36,17 @@ Entity::Entity() void Entity::SetOrientation(Orientation o) { orientation = o; - UpdateVelocity(); if (CanTurn()) { - runner.SetColOffset(orientation); + runner.SetColOffset(o); } } +void Entity::SetDirection(Orientation o) { + direction = o; + UpdateVelocity(); + SetOrientation(o); +} + void Entity::SetSpeed(Fixed<8> s) { speed = s; UpdateVelocity(); @@ -103,7 +109,7 @@ void Entity::UpdateVelocity() { velocity = Vector >(); return; } - switch (orientation) { + switch (direction) { case ORIENTATION_NORTH: velocity = Vector >(0, -speed); break;