, pushed(0)
, lastLock(-1, -1)
, camera(100, 100, 0)
-, walkingSpeed(64)
+, walkingSpeed(1)
, nextDirection(-1)
, afterLock(false)
, skipLock(false)
void MapState::OnEnterState(SDL_Surface *screen) {
- camera.Resize(screen->w, screen->h);
+ OnResize(screen->w, screen->h);
+ tileAnimation = GraphicsTimers().StartInterval(512);
LoadMap(map);
}
}
void MapState::OnResumeState(SDL_Surface *screen) {
- camera.Resize(screen->w, screen->h);
+ OnResize(screen->w, screen->h);
}
void MapState::OnPauseState(SDL_Surface *screen) {
}
+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));
}
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()));
for (std::vector<Entity *>::iterator e(entities.begin()), end(entities.end()); e != end; ++e) {
if ((*e)->Hostile() && map->TileCoordinates(ToInt((*e)->Position())) == neighbor[i]) {
// TODO: move entity erase to happen after the transition or battle
+ LoadBattle(*controlled, **e);
entities.erase(e);
return true;
}
SDL_FillRect(screen, 0, SDL_MapRGB(screen->format, 0, 0, 0));
Vector<int> offset(camera.CalculateOffset());
- map->Render(screen, offset);
+ map->Render(screen, offset, tileAnimation.Iteration());
if (debug) {
map->RenderDebug(screen, offset);