]> git.localhorst.tv Git - l2e.git/commitdiff
workaround for map lock with int steps
authorDaniel Karbach <daniel.karbach@localhorst.tv>
Tue, 20 Aug 2013 08:19:28 +0000 (10:19 +0200)
committerDaniel Karbach <daniel.karbach@localhorst.tv>
Wed, 4 Sep 2013 16:42:21 +0000 (18:42 +0200)
src/main.cpp
src/map/MapState.cpp
src/map/MapState.h

index 672c41bfa8fa5c01024b2a154f45c4346d6c2548..8fa276ce73f07566b182b465b2457aea7af4580c 100644 (file)
@@ -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);
 
index 0e0a3ee44ea7e916ef0cb026c8f1428bf5dca257..b18d75da38f685c877618de0796d0dcc3a15ea62 100644 (file)
@@ -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<int> nowLock(ToInt(controlled->Position()));
index b243c3b07258cf9529d0bfe6e6309e56826569cf..8b9532db3bbbf7fb684bc4909a9dc6f77edba1ee 100644 (file)
@@ -44,7 +44,7 @@ public:
 
        math::Vector<math::Fixed<8> > TrackPoint() const { return *camera.GetTarget(); }
 
-       void SetWalkingSpeed(math::Fixed<8> s) { walkingSpeed = s; }
+       void SetWalkingSpeed(int s);
 
        void Transition(Map *, const math::Vector<int> &coordinates);