From 17611348392672fae02c68c7b04b820f3d06aeb6 Mon Sep 17 00:00:00 2001 From: Kayne Ruse Date: Fri, 10 Oct 2014 06:32:53 +1100 Subject: [PATCH] Added LocalCharacter & BaseMonster --- client/renderable/base_character.cpp | 4 +-- client/renderable/base_character.hpp | 24 ++++------------ client/renderable/base_monster.cpp | 23 +++++++++++++++ client/renderable/base_monster.hpp | 36 ++++++++++++++++++++++++ client/renderable/local_character.cpp | 23 +++++++++++++++ client/renderable/local_character.hpp | 40 +++++++++++++++++++++++++++ client/renderable/makefile | 2 +- 7 files changed, 130 insertions(+), 22 deletions(-) create mode 100644 client/renderable/base_monster.cpp create mode 100644 client/renderable/base_monster.hpp create mode 100644 client/renderable/local_character.cpp create mode 100644 client/renderable/local_character.hpp diff --git a/client/renderable/base_character.cpp b/client/renderable/base_character.cpp index 71cc13a..ad31e92 100644 --- a/client/renderable/base_character.cpp +++ b/client/renderable/base_character.cpp @@ -19,9 +19,9 @@ * 3. This notice may not be removed or altered from any source * distribution. */ -#include "character.hpp" +#include "base_character.hpp" -void Character::CorrectSprite() { +void BaseCharacter::CorrectSprite() { //NOTE: These must correspond to the sprite sheet in use if (motion.y > 0) { sprite.SetYIndex(0); diff --git a/client/renderable/base_character.hpp b/client/renderable/base_character.hpp index cd9fc43..1531ba3 100644 --- a/client/renderable/base_character.hpp +++ b/client/renderable/base_character.hpp @@ -19,29 +19,24 @@ * 3. This notice may not be removed or altered from any source * distribution. */ -#ifndef CHARACTER_HPP_ -#define CHARACTER_HPP_ +#ifndef BASECHARACTER_HPP_ +#define BASECHARACTER_HPP_ //components #include "character_defines.hpp" #include "renderable.hpp" -#include "statistics.hpp" //std namespace #include -#include -class Character : public Renderable { +class BaseCharacter : public Renderable { public: - Character() = default; - ~Character() = default; + BaseCharacter() = default; + virtual ~BaseCharacter() = default; //graphics void CorrectSprite(); - //gameplay - Statistics* GetStats() { return &stats; } - //metadata int SetOwner(int i) { return owner = i; } int GetOwner() { return owner; } @@ -51,19 +46,10 @@ public: std::string GetAvatar() const { return avatar; } private: - //base statistics - Statistics stats; - - //gameplay components: equipment, items, buffs, debuffs... - //metadata int owner; std::string handle; std::string avatar; }; -//tmp -#include -typedef std::map CharacterMap; - #endif diff --git a/client/renderable/base_monster.cpp b/client/renderable/base_monster.cpp new file mode 100644 index 0000000..e6350c4 --- /dev/null +++ b/client/renderable/base_monster.cpp @@ -0,0 +1,23 @@ +/* Copyright: (c) Kayne Ruse 2014 + * + * This software is provided 'as-is', without any express or implied + * warranty. In no event will the authors be held liable for any damages + * arising from the use of this software. + * + * Permission is granted to anyone to use this software for any purpose, + * including commercial applications, and to alter it and redistribute it + * freely, subject to the following restrictions: + * + * 1. The origin of this software must not be misrepresented; you must not + * claim that you wrote the original software. If you use this software + * in a product, an acknowledgment in the product documentation would be + * appreciated but is not required. + * + * 2. Altered source versions must be plainly marked as such, and must not be + * misrepresented as being the original software. + * + * 3. This notice may not be removed or altered from any source + * distribution. +*/ +#include "base_monster.hpp" + diff --git a/client/renderable/base_monster.hpp b/client/renderable/base_monster.hpp new file mode 100644 index 0000000..58d8f49 --- /dev/null +++ b/client/renderable/base_monster.hpp @@ -0,0 +1,36 @@ +/* Copyright: (c) Kayne Ruse 2014 + * + * This software is provided 'as-is', without any express or implied + * warranty. In no event will the authors be held liable for any damages + * arising from the use of this software. + * + * Permission is granted to anyone to use this software for any purpose, + * including commercial applications, and to alter it and redistribute it + * freely, subject to the following restrictions: + * + * 1. The origin of this software must not be misrepresented; you must not + * claim that you wrote the original software. If you use this software + * in a product, an acknowledgment in the product documentation would be + * appreciated but is not required. + * + * 2. Altered source versions must be plainly marked as such, and must not be + * misrepresented as being the original software. + * + * 3. This notice may not be removed or altered from any source + * distribution. +*/ +#ifndef BASEMONSTER_HPP_ +#define BASEMONSTER_HPP_ + +#include "renderable.hpp" + +class BaseMonster { +public: + BaseMonster(); + virtual ~BaseMonster(); + +private: + // +}; + +#endif \ No newline at end of file diff --git a/client/renderable/local_character.cpp b/client/renderable/local_character.cpp new file mode 100644 index 0000000..211a6bc --- /dev/null +++ b/client/renderable/local_character.cpp @@ -0,0 +1,23 @@ +/* Copyright: (c) Kayne Ruse 2014 + * + * This software is provided 'as-is', without any express or implied + * warranty. In no event will the authors be held liable for any damages + * arising from the use of this software. + * + * Permission is granted to anyone to use this software for any purpose, + * including commercial applications, and to alter it and redistribute it + * freely, subject to the following restrictions: + * + * 1. The origin of this software must not be misrepresented; you must not + * claim that you wrote the original software. If you use this software + * in a product, an acknowledgment in the product documentation would be + * appreciated but is not required. + * + * 2. Altered source versions must be plainly marked as such, and must not be + * misrepresented as being the original software. + * + * 3. This notice may not be removed or altered from any source + * distribution. +*/ +#include "local_character.hpp" + diff --git a/client/renderable/local_character.hpp b/client/renderable/local_character.hpp new file mode 100644 index 0000000..8407fef --- /dev/null +++ b/client/renderable/local_character.hpp @@ -0,0 +1,40 @@ +/* Copyright: (c) Kayne Ruse 2014 + * + * This software is provided 'as-is', without any express or implied + * warranty. In no event will the authors be held liable for any damages + * arising from the use of this software. + * + * Permission is granted to anyone to use this software for any purpose, + * including commercial applications, and to alter it and redistribute it + * freely, subject to the following restrictions: + * + * 1. The origin of this software must not be misrepresented; you must not + * claim that you wrote the original software. If you use this software + * in a product, an acknowledgment in the product documentation would be + * appreciated but is not required. + * + * 2. Altered source versions must be plainly marked as such, and must not be + * misrepresented as being the original software. + * + * 3. This notice may not be removed or altered from any source + * distribution. +*/ +#ifndef LOCALCHARACTER_HPP_ +#define LOCALCHARACTER_HPP_ + +#include "base_character.hpp" +#include "statistics.hpp" + +class LocalCharacter : public BaseCharacter { +public: + LocalCharacter() = default; + ~LocalCharacter() = default; + + Statistics* GetBaseStats() { return &baseStats; } + +private: + Statistics baseStats; + //TODO: weapons, armour, buffs, debuffs, etc. +}; + +#endif diff --git a/client/renderable/makefile b/client/renderable/makefile index f8d8358..a426eda 100644 --- a/client/renderable/makefile +++ b/client/renderable/makefile @@ -1,5 +1,5 @@ #config -INCLUDES+=. .. ../../common/gameplay ../../common/graphics ../../common/map ../../common/network ../../common/network/packet_types ../../common/ui ../../common/utilities +INCLUDES+=. .. ../../common/gameplay ../../common/graphics ../../common/utilities LIBS+= CXXFLAGS+=-std=c++11 $(addprefix -I,$(INCLUDES))