From: Daniel Karbach Date: Tue, 20 Aug 2013 08:19:28 +0000 (+0200) Subject: workaround for map lock with int steps X-Git-Url: http://git.localhorst.tv/?p=l2e.git;a=commitdiff_plain;h=d8cbd000400a1d6f9fcf77e414b6b4d13b1ead96 workaround for map lock with int steps --- diff --git a/src/main.cpp b/src/main.cpp index 672c41b..8fa276c 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -95,7 +95,7 @@ int main(int argc, char **argv) { const int width = 512; const int height = 448; - const Fixed<8> walkSpeed = Fixed<8>(1, 8); + const int walkSpeed = 8; bool battle(false); diff --git a/src/map/MapState.cpp b/src/map/MapState.cpp index 0e0a3ee..b18d75d 100644 --- a/src/map/MapState.cpp +++ b/src/map/MapState.cpp @@ -32,7 +32,7 @@ MapState::MapState(GameConfig *g, Map *map) , pushed(0) , lastLock(-1, -1) , camera(100, 100, 0) -, walkingSpeed(64) +, walkingSpeed(1) , nextDirection(-1) , afterLock(false) , skipLock(false) @@ -65,6 +65,12 @@ void MapState::OnResize(int width, int height) { } +void MapState::SetWalkingSpeed(int s) { + walkingSpeed = math::Fixed<8>(1, s); + Timestep(s); +} + + void MapState::HandleEvents(const Input &input) { if (input.JustPressed(Input::ACTION_X)) { Ctrl().PushState(new PartyMenu(game)); @@ -102,6 +108,7 @@ void MapState::UpdateWorld(Uint32 deltaT) { } void MapState::OnTileLock() { + // moveTimer is running when the pc is walking against a wall if (moveTimer.Running() && !moveTimer.JustHit()) return; Vector nowLock(ToInt(controlled->Position())); diff --git a/src/map/MapState.h b/src/map/MapState.h index b243c3b..8b9532d 100644 --- a/src/map/MapState.h +++ b/src/map/MapState.h @@ -44,7 +44,7 @@ public: math::Vector > TrackPoint() const { return *camera.GetTarget(); } - void SetWalkingSpeed(math::Fixed<8> s) { walkingSpeed = s; } + void SetWalkingSpeed(int s); void Transition(Map *, const math::Vector &coordinates);