diff --git a/src/creature.cpp b/src/creature.cpp new file mode 100644 index 00000000..431474c9 --- /dev/null +++ b/src/creature.cpp @@ -0,0 +1,64 @@ +#include "creature.h" +#include "tibiadat.h" +#include "graphics/graphics.h" +#include +#include "game.h" + +#include +#include +#include + + + + + + +// OW BART TEM COMO USAR 2 FRAMEBUFFER? +// SERIA O IDEAL PARA DESENHAR A COR DOS BONEQUIN. + + + + + + +Creature::Creature() +{ + m_type = Thing::TYPE_CREATURE; +} + +ThingAttributes *Creature::getAttributes() +{ + return g_tibiaDat.getCreatureAttributes(m_outfit.type); +} + +void Creature::draw(int x, int y) +{ + //ThingAttributes *creatureAttributes = getAttributes(); + int anim = 0; + + // draw outfit + internalDraw(x, y, 0, m_direction, 0, 0, anim); + + // draw addons + //for(int a = 0; a < m_outfit.addons; ++a) { + //internalDraw(x, y, 0, m_direction, m_outfit.addons & (1 << a), 0, anim); + //} + //glPushAttrib(GL_CURRENT_BIT | GL_COLOR_BUFFER_BIT); + + //glBlendFunc(GL_DST_COLOR, GL_ONE_MINUS_SRC_ALPHA); + + //Color colors[4] = {Color::yellow, Color::red, Color::green, Color::blue}; + + //for(int i = 0; i < 4; ++i) { + + + /*g_graphics.bindColor(colors[i]); + internalDraw(creatureAttributes->width*32 - 32, creatureAttributes->height*32 - 32, 1, m_direction, 0, 0, 0); + framebuffer.unbind(); + + + g_graphics.bindColor(Color::green);*/ + //framebuffer.draw(x, y, creatureAttributes->width*32, creatureAttributes->height*32); + //} + //glPopAttrib(); +} diff --git a/src/creature.h b/src/creature.h new file mode 100644 index 00000000..3eb0aee3 --- /dev/null +++ b/src/creature.h @@ -0,0 +1,51 @@ +#ifndef CREATURE_H +#define CREATURE_H + +#include +#include "thing.h" + +struct Outfit +{ + uint16 type; + uint8 head; + uint8 body; + uint8 legs; + uint8 feet; + uint8 addons; +}; + +class Creature; +typedef std::shared_ptr CreaturePtr; + +class Creature : public Thing +{ +public: + Creature(); + + virtual ThingAttributes *getAttributes(); + void draw(int x, int y); + + void setName(const std::string& name) { m_name = name; } + std::string getName() { return m_name; } + + void setHealthPercent(uint8 healthPercent) { m_healthPercent = healthPercent; } + uint8 getHealthPercent() { return m_healthPercent; } + + void setDirection(Direction direction) { m_direction = direction; } + Direction getDirection() { return m_direction; } + + void setOutfit(const Outfit& outfit) { m_outfit = outfit; } + Outfit getOutfit() { return m_outfit; } + + virtual Creature *getCreature() { return this; } + virtual const Creature *getCreature() const { return this; } + +private: + std::string m_name; + uint8 m_healthPercent; + Direction m_direction; + Outfit m_outfit; + +}; + +#endif // CREATURE_H diff --git a/src/effect.cpp b/src/effect.cpp new file mode 100644 index 00000000..fcdec57f --- /dev/null +++ b/src/effect.cpp @@ -0,0 +1,18 @@ +#include "effect.h" +#include "tibiadat.h" + +Effect::Effect() +{ + m_type = Thing::TYPE_EFFECT; +} + +ThingAttributes *Effect::getAttributes() +{ + return g_tibiaDat.getEffectAttributes(m_id); +} + +void Effect::draw(int x, int y) +{ + int anim = 0; + internalDraw(x, y, 0, 0, 0, 0, anim); +} diff --git a/src/effect.h b/src/effect.h new file mode 100644 index 00000000..1a1cc73c --- /dev/null +++ b/src/effect.h @@ -0,0 +1,21 @@ +#ifndef EFFECT_H +#define EFFECT_H + +#include +#include "thing.h" + +class Effect; +typedef std::shared_ptr EffectPtr; + +class Effect : public Thing +{ +public: + Effect(); + + virtual ThingAttributes *getAttributes(); + void draw(int x, int y); + +private: +}; + +#endif // EFFECT_H diff --git a/src/framework/util/color.cpp b/src/framework/util/color.cpp index e9d81799..5c1bcb76 100644 --- a/src/framework/util/color.cpp +++ b/src/framework/util/color.cpp @@ -1,10 +1,10 @@ #include "color.h" -Color Color::white (0xFF, 0xFF, 0xFF, 0xFF); -Color Color::black (0x00, 0x00, 0x00, 0xFF); -Color Color::alpha (0x00, 0x00, 0x00, 0x00); -Color Color::red (0xFF, 0x00, 0x00, 0xFF); -Color Color::green (0x00, 0xFF, 0x00, 0xFF); -Color Color::blue (0x00, 0x00, 0xFF, 0xFF); -Color Color::pink (0xFF, 0x00, 0xFF, 0xFF); -Color Color::yellow (0x00, 0xFF, 0xFF, 0xFF); +Color Color::white (0xFF, 0xFF, 0xFF, 0xFF); +Color Color::black (0x00, 0x00, 0x00, 0xFF); +Color Color::alpha (0x00, 0x00, 0x00, 0x00); +Color Color::red (0xFF, 0x00, 0x00, 0xFF); +Color Color::green (0x00, 0xFF, 0x00, 0xFF); +Color Color::blue (0x00, 0x00, 0xFF, 0xFF); +Color Color::pink (0xFF, 0x00, 0xFF, 0xFF); +Color Color::yellow(0x00, 0xFF, 0xFF, 0xFF);