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::blue (0x00, 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 "game.h"
|
||||
|
||||
#include <GL/gl.h>
|
||||
#include <GL/glu.h>
|
||||
#include <GL/glext.h>
|
||||
|
||||
Creature::Creature() : Thing(THING_CREATURE)
|
||||
{
|
||||
m_healthPercent = 0;
|
||||
|
@ -22,9 +18,6 @@ void Creature::draw(int x, int y)
|
|||
// draw outfit
|
||||
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
|
||||
static const Color outfitColors[] = {
|
||||
Color(255,255,255),
|
||||
|
|
|
@ -88,7 +88,7 @@ TexturePtr SpriteManager::loadSprite(int id)
|
|||
return TexturePtr(new Texture(32, 32, 4, pixels));
|
||||
}
|
||||
|
||||
TexturePtr SpriteManager::getSpriteTexture(int id)
|
||||
TexturePtr SpriteManager::getSpriteTexture(int id, SpriteMask mask)
|
||||
{
|
||||
if(id == 0)
|
||||
return g_graphics.getEmptyTexture();
|
||||
|
@ -105,13 +105,8 @@ TexturePtr SpriteManager::getSpriteTexture(int id)
|
|||
//TODO: release unused sprites textures after X seconds
|
||||
// to avoid massive texture allocations
|
||||
|
||||
return texture;
|
||||
}
|
||||
|
||||
TexturePtr SpriteManager::getSpriteMask(int id, SpriteMask mask)
|
||||
{
|
||||
TexturePtr tex = getSpriteTexture(id);
|
||||
auto pixels = tex->getPixels();
|
||||
if(mask != SpriteMaskNone) {
|
||||
auto pixels = texture->getPixels();
|
||||
|
||||
static RGBA maskColors[4] = { Color::red.rgba(), Color::green.rgba(), Color::blue.rgba(), Color::yellow.rgba() };
|
||||
RGBA maskColor = maskColors[mask];
|
||||
|
@ -131,4 +126,7 @@ TexturePtr SpriteManager::getSpriteMask(int id, SpriteMask mask)
|
|||
|
||||
//TODO: cache sprites mask into a texture
|
||||
return TexturePtr(new Texture(32, 32, 4, &pixels[0]));
|
||||
}
|
||||
|
||||
return texture;
|
||||
}
|
||||
|
|
|
@ -15,8 +15,7 @@ public:
|
|||
uint32 getSignature() { return m_signature; }
|
||||
int getSpritesCount() { return m_spritesCount; }
|
||||
|
||||
TexturePtr getSpriteTexture(int id);
|
||||
TexturePtr getSpriteMask(int id, SpriteMask mask);
|
||||
TexturePtr getSpriteTexture(int id, SpriteMask mask = SpriteMaskNone);
|
||||
|
||||
private:
|
||||
TexturePtr loadSprite(int id);
|
||||
|
|
|
@ -24,11 +24,7 @@ void Thing::internalDraw(int x, int y, int blendframes, int xdiv, int ydiv, int
|
|||
if(!spriteId)
|
||||
continue;
|
||||
|
||||
TexturePtr spriteTex;
|
||||
if(mask == SpriteMaskNone) {
|
||||
spriteTex = g_sprites.getSpriteTexture(spriteId);
|
||||
} else
|
||||
spriteTex = g_sprites.getSpriteMask(spriteId, mask);
|
||||
TexturePtr spriteTex = g_sprites.getSpriteTexture(spriteId, mask);
|
||||
|
||||
Rect drawRect((x - xi*32) - attributes.xOffset,
|
||||
(y - yi*32) - attributes.xOffset,
|
||||
|
|
Loading…
Reference in New Issue