head outfit color fix
This commit is contained in:
parent
66e58c5914
commit
817234a660
|
@ -7,4 +7,4 @@ Color Color::red (0xFF, 0x00, 0x00, 0xFF);
|
||||||
Color Color::green (0x00, 0xFF, 0x00, 0xFF);
|
Color Color::green (0x00, 0xFF, 0x00, 0xFF);
|
||||||
Color Color::blue (0x00, 0x00, 0xFF, 0xFF);
|
Color Color::blue (0x00, 0x00, 0xFF, 0xFF);
|
||||||
Color Color::pink (0xFF, 0x00, 0xFF, 0xFF);
|
Color Color::pink (0xFF, 0x00, 0xFF, 0xFF);
|
||||||
Color Color::yellow(0x00, 0xFF, 0xFF, 0xFF);
|
Color Color::yellow(0xFF, 0xFF, 0x00, 0xFF);
|
||||||
|
|
|
@ -4,10 +4,6 @@
|
||||||
#include <framework/graphics/framebuffer.h>
|
#include <framework/graphics/framebuffer.h>
|
||||||
#include "game.h"
|
#include "game.h"
|
||||||
|
|
||||||
#include <GL/gl.h>
|
|
||||||
#include <GL/glu.h>
|
|
||||||
#include <GL/glext.h>
|
|
||||||
|
|
||||||
Creature::Creature() : Thing(THING_CREATURE)
|
Creature::Creature() : Thing(THING_CREATURE)
|
||||||
{
|
{
|
||||||
m_healthPercent = 0;
|
m_healthPercent = 0;
|
||||||
|
@ -22,9 +18,6 @@ void Creature::draw(int x, int y)
|
||||||
// draw outfit
|
// draw outfit
|
||||||
internalDraw(x, y, 0, m_direction, 0, 0, anim);
|
internalDraw(x, y, 0, m_direction, 0, 0, anim);
|
||||||
|
|
||||||
// draw outfit colors
|
|
||||||
glBlendFunc(GL_DST_COLOR, GL_ONE_MINUS_SRC_ALPHA);
|
|
||||||
|
|
||||||
// TODO: move this shit hahaha
|
// TODO: move this shit hahaha
|
||||||
static const Color outfitColors[] = {
|
static const Color outfitColors[] = {
|
||||||
Color(255,255,255),
|
Color(255,255,255),
|
||||||
|
|
|
@ -88,7 +88,7 @@ TexturePtr SpriteManager::loadSprite(int id)
|
||||||
return TexturePtr(new Texture(32, 32, 4, pixels));
|
return TexturePtr(new Texture(32, 32, 4, pixels));
|
||||||
}
|
}
|
||||||
|
|
||||||
TexturePtr SpriteManager::getSpriteTexture(int id)
|
TexturePtr SpriteManager::getSpriteTexture(int id, SpriteMask mask)
|
||||||
{
|
{
|
||||||
if(id == 0)
|
if(id == 0)
|
||||||
return g_graphics.getEmptyTexture();
|
return g_graphics.getEmptyTexture();
|
||||||
|
@ -105,13 +105,8 @@ TexturePtr SpriteManager::getSpriteTexture(int id)
|
||||||
//TODO: release unused sprites textures after X seconds
|
//TODO: release unused sprites textures after X seconds
|
||||||
// to avoid massive texture allocations
|
// to avoid massive texture allocations
|
||||||
|
|
||||||
return texture;
|
if(mask != SpriteMaskNone) {
|
||||||
}
|
auto pixels = texture->getPixels();
|
||||||
|
|
||||||
TexturePtr SpriteManager::getSpriteMask(int id, SpriteMask mask)
|
|
||||||
{
|
|
||||||
TexturePtr tex = getSpriteTexture(id);
|
|
||||||
auto pixels = tex->getPixels();
|
|
||||||
|
|
||||||
static RGBA maskColors[4] = { Color::red.rgba(), Color::green.rgba(), Color::blue.rgba(), Color::yellow.rgba() };
|
static RGBA maskColors[4] = { Color::red.rgba(), Color::green.rgba(), Color::blue.rgba(), Color::yellow.rgba() };
|
||||||
RGBA maskColor = maskColors[mask];
|
RGBA maskColor = maskColors[mask];
|
||||||
|
@ -132,3 +127,6 @@ TexturePtr SpriteManager::getSpriteMask(int id, SpriteMask mask)
|
||||||
//TODO: cache sprites mask into a texture
|
//TODO: cache sprites mask into a texture
|
||||||
return TexturePtr(new Texture(32, 32, 4, &pixels[0]));
|
return TexturePtr(new Texture(32, 32, 4, &pixels[0]));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return texture;
|
||||||
|
}
|
||||||
|
|
|
@ -15,8 +15,7 @@ public:
|
||||||
uint32 getSignature() { return m_signature; }
|
uint32 getSignature() { return m_signature; }
|
||||||
int getSpritesCount() { return m_spritesCount; }
|
int getSpritesCount() { return m_spritesCount; }
|
||||||
|
|
||||||
TexturePtr getSpriteTexture(int id);
|
TexturePtr getSpriteTexture(int id, SpriteMask mask = SpriteMaskNone);
|
||||||
TexturePtr getSpriteMask(int id, SpriteMask mask);
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
TexturePtr loadSprite(int id);
|
TexturePtr loadSprite(int id);
|
||||||
|
|
|
@ -24,11 +24,7 @@ void Thing::internalDraw(int x, int y, int blendframes, int xdiv, int ydiv, int
|
||||||
if(!spriteId)
|
if(!spriteId)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
TexturePtr spriteTex;
|
TexturePtr spriteTex = g_sprites.getSpriteTexture(spriteId, mask);
|
||||||
if(mask == SpriteMaskNone) {
|
|
||||||
spriteTex = g_sprites.getSpriteTexture(spriteId);
|
|
||||||
} else
|
|
||||||
spriteTex = g_sprites.getSpriteMask(spriteId, mask);
|
|
||||||
|
|
||||||
Rect drawRect((x - xi*32) - attributes.xOffset,
|
Rect drawRect((x - xi*32) - attributes.xOffset,
|
||||||
(y - yi*32) - attributes.xOffset,
|
(y - yi*32) - attributes.xOffset,
|
||||||
|
|
Loading…
Reference in New Issue