1 /* 2 * Copyright (C) 2006-2019 Christopho, Solarus - http://www.solarus-games.org 3 * 4 * Solarus is free software; you can redistribute it and/or modify 5 * it under the terms of the GNU General Public License as published by 6 * the Free Software Foundation, either version 3 of the License, or 7 * (at your option) any later version. 8 * 9 * Solarus is distributed in the hope that it will be useful, 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 * GNU General Public License for more details. 13 * 14 * You should have received a copy of the GNU General Public License along 15 * with this program. If not, see <http://www.gnu.org/licenses/>. 16 */ 17 #ifndef SOLARUS_HERO_FREE_STATE_H 18 #define SOLARUS_HERO_FREE_STATE_H 19 20 #include "solarus/core/Common.h" 21 #include "solarus/hero/PlayerMovementState.h" 22 #include <cstdint> 23 24 namespace Solarus { 25 26 /** 27 * \brief State of the hero where he can walk normally and interact with entities. 28 */ 29 class Hero::FreeState: public Hero::PlayerMovementState { 30 31 public: 32 33 explicit FreeState(Hero& hero); 34 35 void start(const State* previous_state) override; 36 void stop(const State* next_state) override; 37 void update() override; 38 void set_suspended(bool suspended) override; 39 void notify_action_command_pressed() override; 40 void notify_obstacle_reached() override; 41 42 bool is_free() const override; 43 bool get_can_interact_with_npc(Npc& npc) const override; 44 bool get_can_start_sword() const override; 45 bool get_can_start_item(EquipmentItem& item) const override; 46 bool get_can_take_stairs() const override; 47 CarriedObject::Behavior get_previous_carried_object_behavior() const override; 48 void set_animation_stopped() override; 49 void set_animation_walking() override; 50 51 private: 52 53 int pushing_direction4; /**< direction where the hero is trying to 54 * push an obstacle (0 to 3) or -1 */ 55 uint32_t start_pushing_date; /**< date when the state pushing starts */ 56 57 }; 58 59 } 60 61 #endif 62 63