X-Git-Url: http://git.localhorst.tv/?a=blobdiff_plain;f=src%2Fmap%2FEntity.cpp;h=6bce2adfde82b28d092cd08a03eae7fd39246f7e;hb=667e1d9c6a78d0b608b518a4e5b5c31bc30e4e89;hp=d239844ea2ef420bd76fd5e47a57dbe7082359e0;hpb=7011e3c622be7d4f24c0166a1ad5aeb4f8c5f851;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;