missing files, color fix

This commit is contained in:
Henrique 2011-08-15 02:12:42 -03:00
parent e8448cddb9
commit fd7f191cb2
5 changed files with 162 additions and 8 deletions

64
src/creature.cpp Normal file
View File

@ -0,0 +1,64 @@
#include "creature.h"
#include "tibiadat.h"
#include "graphics/graphics.h"
#include <graphics/framebuffer.h>
#include "game.h"
#include <GL/gl.h>
#include <GL/glu.h>
#include <GL/glext.h>
// 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();
}

51
src/creature.h Normal file
View File

@ -0,0 +1,51 @@
#ifndef CREATURE_H
#define CREATURE_H
#include <global.h>
#include "thing.h"
struct Outfit
{
uint16 type;
uint8 head;
uint8 body;
uint8 legs;
uint8 feet;
uint8 addons;
};
class Creature;
typedef std::shared_ptr<Creature> 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

18
src/effect.cpp Normal file
View File

@ -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);
}

21
src/effect.h Normal file
View File

@ -0,0 +1,21 @@
#ifndef EFFECT_H
#define EFFECT_H
#include <global.h>
#include "thing.h"
class Effect;
typedef std::shared_ptr<Effect> EffectPtr;
class Effect : public Thing
{
public:
Effect();
virtual ThingAttributes *getAttributes();
void draw(int x, int y);
private:
};
#endif // EFFECT_H

View File

@ -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);