X-Git-Url: http://git.localhorst.tv/?a=blobdiff_plain;f=src%2Fmap%2FMapState.cpp;h=b18d75da38f685c877618de0796d0dcc3a15ea62;hb=5cca794c5b6549b7750c88b5c2217d659fa963dd;hp=b8b5eb629d8601a2de2ce2a4a03044df9b28fcad;hpb=d97b7038c28058a76e7214e0dce0394fd8b67cff;p=l2e.git diff --git a/src/map/MapState.cpp b/src/map/MapState.cpp index b8b5eb6..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) @@ -43,7 +43,7 @@ MapState::MapState(GameConfig *g, Map *map) void MapState::OnEnterState(SDL_Surface *screen) { - camera.Resize(screen->w, screen->h); + OnResize(screen->w, screen->h); tileAnimation = GraphicsTimers().StartInterval(512); LoadMap(map); } @@ -53,7 +53,7 @@ void MapState::OnExitState(SDL_Surface *screen) { } void MapState::OnResumeState(SDL_Surface *screen) { - camera.Resize(screen->w, screen->h); + OnResize(screen->w, screen->h); } void MapState::OnPauseState(SDL_Surface *screen) { @@ -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()));