From a204d2b11e6a4b620877ab6c5b80a818eaa7d476 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Sun, 28 Dec 2014 18:14:58 +0300 Subject: Add fake commands to change pet direction. --- src/actions/pets.cpp | 24 ++++++++++++++++++++++++ src/actions/pets.h | 4 ++++ src/being/beingdirection.h | 2 +- src/input/inputaction.h | 4 ++++ src/input/inputactionmap.h | 36 ++++++++++++++++++++++++++++++++++++ src/net/eathena/pethandler.cpp | 4 ++++ src/net/eathena/pethandler.h | 3 +++ src/net/pethandler.h | 2 ++ src/net/tmwa/pethandler.cpp | 4 ++++ src/net/tmwa/pethandler.h | 3 +++ 10 files changed, 85 insertions(+), 1 deletion(-) diff --git a/src/actions/pets.cpp b/src/actions/pets.cpp index e30e7f529..64ac81e83 100644 --- a/src/actions/pets.cpp +++ b/src/actions/pets.cpp @@ -177,4 +177,28 @@ impHandler0(petMoveRight) return true; } +impHandler0(petDirectUp) +{ + petHandler->setDirection(BeingDirection::UP); + return true; +} + +impHandler0(petDirectDown) +{ + petHandler->setDirection(BeingDirection::DOWN); + return true; +} + +impHandler0(petDirectLeft) +{ + petHandler->setDirection(BeingDirection::LEFT); + return true; +} + +impHandler0(petDirectRight) +{ + petHandler->setDirection(BeingDirection::RIGHT); + return true; +} + } // namespace Actions diff --git a/src/actions/pets.h b/src/actions/pets.h index 37bd85713..4aed1d94c 100644 --- a/src/actions/pets.h +++ b/src/actions/pets.h @@ -36,6 +36,10 @@ namespace Actions decHandler(petMoveDown); decHandler(petMoveLeft); decHandler(petMoveRight); + decHandler(petDirectUp); + decHandler(petDirectDown); + decHandler(petDirectLeft); + decHandler(petDirectRight); } // namespace Actions #undef decHandler diff --git a/src/being/beingdirection.h b/src/being/beingdirection.h index 6e4d394ed..9f462d54c 100644 --- a/src/being/beingdirection.h +++ b/src/being/beingdirection.h @@ -28,7 +28,7 @@ namespace BeingDirection /** * Directions, to be used as bitmask values */ - enum BeingDirection + enum Type { DOWN = 1, LEFT = 2, diff --git a/src/input/inputaction.h b/src/input/inputaction.h index 67ac8f446..67bf95161 100644 --- a/src/input/inputaction.h +++ b/src/input/inputaction.h @@ -520,6 +520,10 @@ namespace InputAction PET_MOVE_DOWN, PET_MOVE_LEFT, PET_MOVE_RIGHT, + PET_DIRECT_UP, + PET_DIRECT_DOWN, + PET_DIRECT_LEFT, + PET_DIRECT_RIGHT, TOTAL }; } // namespace InputAction diff --git a/src/input/inputactionmap.h b/src/input/inputactionmap.h index 4dc84bb71..c5d9d9d76 100644 --- a/src/input/inputactionmap.h +++ b/src/input/inputactionmap.h @@ -4424,6 +4424,42 @@ static const InputActionData inputActionData[InputAction::TOTAL] = { InputCondition::INGAME, "petmoveright|moverightpet", false}, + {"keyPetDirectUp", + InputType::UNKNOWN, InputAction::NO_VALUE, + InputType::UNKNOWN, InputAction::NO_VALUE, + Input::GRP_DEFAULT, + &Actions::petDirectUp, + InputAction::NO_VALUE, 50, + InputCondition::INGAME, + "petdirectup|directuppet", + false}, + {"keyPetDirectDown", + InputType::UNKNOWN, InputAction::NO_VALUE, + InputType::UNKNOWN, InputAction::NO_VALUE, + Input::GRP_DEFAULT, + &Actions::petDirectDown, + InputAction::NO_VALUE, 50, + InputCondition::INGAME, + "petdirectdown|directdownpet", + false}, + {"keyPetDirectLeft", + InputType::UNKNOWN, InputAction::NO_VALUE, + InputType::UNKNOWN, InputAction::NO_VALUE, + Input::GRP_DEFAULT, + &Actions::petDirectLeft, + InputAction::NO_VALUE, 50, + InputCondition::INGAME, + "petdirectleft|directleftpet", + false}, + {"keyPetDirectRight", + InputType::UNKNOWN, InputAction::NO_VALUE, + InputType::UNKNOWN, InputAction::NO_VALUE, + Input::GRP_DEFAULT, + &Actions::petDirectRight, + InputAction::NO_VALUE, 50, + InputCondition::INGAME, + "petdirectright|directrightpet", + false}, }; #endif // INPUT_INPUTACTIONMAP_H diff --git a/src/net/eathena/pethandler.cpp b/src/net/eathena/pethandler.cpp index 9c78787cf..b18cc83d0 100644 --- a/src/net/eathena/pethandler.cpp +++ b/src/net/eathena/pethandler.cpp @@ -319,4 +319,8 @@ void PetHandler::unequip() const outMsg.writeInt8(4, "action"); } +void PetHandler::setDirection(const BeingDirection::Type type A_UNUSED) const +{ +} + } // namespace EAthena diff --git a/src/net/eathena/pethandler.h b/src/net/eathena/pethandler.h index 42a03452b..b397d98d4 100644 --- a/src/net/eathena/pethandler.h +++ b/src/net/eathena/pethandler.h @@ -65,6 +65,9 @@ class PetHandler final : public MessageHandler, public Net::PetHandler void unequip() const override final; + void setDirection(const BeingDirection::Type type) const + override final; + protected: static void processPetRoulette(Net::MessageIn &msg); diff --git a/src/net/pethandler.h b/src/net/pethandler.h index 1eaf011d8..20e4b945e 100644 --- a/src/net/pethandler.h +++ b/src/net/pethandler.h @@ -56,6 +56,8 @@ class PetHandler notfinal virtual void returnToEgg() const = 0; virtual void unequip() const = 0; + + virtual void setDirection(const BeingDirection::Type type) const = 0; }; } // namespace Net diff --git a/src/net/tmwa/pethandler.cpp b/src/net/tmwa/pethandler.cpp index 0156ef7c2..079caae37 100644 --- a/src/net/tmwa/pethandler.cpp +++ b/src/net/tmwa/pethandler.cpp @@ -105,4 +105,8 @@ void PetHandler::unequip() const { } +void PetHandler::setDirection(const BeingDirection::Type type) const +{ +} + } // namespace TmwAthena diff --git a/src/net/tmwa/pethandler.h b/src/net/tmwa/pethandler.h index fa46256c2..49f32e84d 100644 --- a/src/net/tmwa/pethandler.h +++ b/src/net/tmwa/pethandler.h @@ -63,6 +63,9 @@ class PetHandler final : public MessageHandler, public Net::PetHandler void unequip() const override final; + void setDirection(const BeingDirection::Type type) const + override final; + protected: int mRandCounter; }; -- cgit v1.2.3-60-g2f50