X-Git-Url: http://git.localhorst.tv/?a=blobdiff_plain;f=src%2Fmap%2FMapState.cpp;h=2ae4bb362082c00a62fb3c0a6f70404cd7d56a92;hb=667e1d9c6a78d0b608b518a4e5b5c31bc30e4e89;hp=baefdc5ef59c91e5095bc0999dcd14e95125549f;hpb=7011e3c622be7d4f24c0166a1ad5aeb4f8c5f851;p=l2e.git diff --git a/src/map/MapState.cpp b/src/map/MapState.cpp index baefdc5..2ae4bb3 100644 --- a/src/map/MapState.cpp +++ b/src/map/MapState.cpp @@ -118,17 +118,19 @@ void MapState::OnTileLock() { return; } + const Tile *tile(map->TileAt(nowLock)); + if (nextDirection >= 0) { if (afterLock) { bool blocked(CheckBlocking()); OnMove(!blocked); - controlled->SetOrientation(Entity::Orientation(nextDirection)); + controlled->SetDirection(Entity::Orientation(nextDirection)); if (!blocked) { afterLock = false; controlled->SetSpeed(walkingSpeed); moveTimer.Clear(); if (pushed) { - pushed->SetOrientation(Entity::Orientation(nextDirection)); + pushed->SetDirection(Entity::Orientation(nextDirection)); pushed->SetSpeed(walkingSpeed); controlled->SetPushing(); } else { @@ -138,7 +140,7 @@ void MapState::OnTileLock() { controlled->SetSpeed(0); StopFollowers(*controlled); if (!moveTimer.Running()) { - int tileSize((controlled->GetOrientation() % 2) ? map->Tileset()->Width() : map->Tileset()->Height()); + int tileSize((controlled->GetDirection() % 2) ? map->Tileset()->Width() : map->Tileset()->Height()); Fixed<8> walkingInterval(tileSize); walkingInterval /= walkingSpeed; moveTimer = PhysicsTimers().StartInterval(walkingInterval.Int()); @@ -160,6 +162,11 @@ void MapState::OnTileLock() { } } + if (controlled->GetDirection() == Entity::ORIENTATION_SOUTH + && tile && tile->IsLadder()) { + controlled->SetOrientation(Entity::ORIENTATION_NORTH); + } + lastLock = nowLock; } @@ -365,19 +372,19 @@ void MapState::UpdateFollower(Entity &e) { Vector direction(coords - fCoords); if (direction.Y() < 0) { - f.SetOrientation(Entity::ORIENTATION_NORTH); + f.SetDirection(Entity::ORIENTATION_NORTH); f.SetSpeed(walkingSpeed); f.StartAnimation(*this); } else if (direction.X() > 0) { - f.SetOrientation(Entity::ORIENTATION_EAST); + f.SetDirection(Entity::ORIENTATION_EAST); f.SetSpeed(walkingSpeed); f.StartAnimation(*this); } else if (direction.Y() > 0) { - f.SetOrientation(Entity::ORIENTATION_SOUTH); + f.SetDirection(Entity::ORIENTATION_SOUTH); f.SetSpeed(walkingSpeed); f.StartAnimation(*this); } else if (direction.X() < 0) { - f.SetOrientation(Entity::ORIENTATION_WEST); + f.SetDirection(Entity::ORIENTATION_WEST); f.SetSpeed(walkingSpeed); f.StartAnimation(*this); } else { @@ -399,7 +406,7 @@ void MapState::Transition(Map *newMap, const Vector &coordinates) { Vector position(coordinates * map->Tileset()->Size()); for (Entity *e(controlled); e; e = e->Follower()) { e->Position() = position; - e->SetOrientation(controlled->GetOrientation()); + e->SetDirection(controlled->GetDirection()); } LoadMap(newMap); skipLock = true;