simplify outfit render

master
Eduardo Bart 13 years ago
parent fbabe6b3ed
commit ba8f8b889e

@ -58,7 +58,7 @@ namespace Fw
};
enum BlendFunc {
BlendNormal,
BlendDefault,
BlendColorzing
};

@ -51,7 +51,7 @@ void Graphics::init()
m_emptyTexture = TexturePtr(new Texture);
bindColor(Fw::white);
bindBlendFunc(Fw::BlendNormal);
bindBlendFunc(Fw::BlendDefault);
}
void Graphics::terminate()
@ -302,7 +302,7 @@ void Graphics::bindTexture(const TexturePtr& texture)
void Graphics::bindBlendFunc(Fw::BlendFunc blendType)
{
switch(blendType) {
case Fw::BlendNormal:
case Fw::BlendDefault:
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
break;
case Fw::BlendColorzing:

@ -117,25 +117,27 @@ void Creature::draw(int x, int y)
// draw mask if exists
if(attributes.blendframes > 1) {
// switch to blend color mode
g_graphics.bindBlendFunc(Fw::BlendColorzing);
for(int mask = 0; mask < 4; ++mask) {
// head
g_graphics.bindColor(Otc::OutfitColors[m_outfit.head]);
internalDraw(x, y, 1, m_direction, ydiv, 0, m_animation, Otc::SpriteYellowMask);
int outfitColorId = 0;
if(mask == Otc::SpriteYellowMask)
outfitColorId = m_outfit.head;
else if(mask == Otc::SpriteRedMask)
outfitColorId = m_outfit.body;
else if(mask == Otc::SpriteGreenMask)
outfitColorId = m_outfit.legs;
else if(mask == Otc::SpriteBlueMask)
outfitColorId = m_outfit.feet;
// body
g_graphics.bindColor(Otc::OutfitColors[m_outfit.body]);
internalDraw(x, y, 1, m_direction, ydiv, 0, m_animation, Otc::SpriteRedMask);
g_graphics.bindColor(Otc::OutfitColors[outfitColorId]);
internalDraw(x, y, 1, m_direction, ydiv, 0, m_animation, (Otc::SpriteMask)mask);
}
// legs
g_graphics.bindColor(Otc::OutfitColors[m_outfit.legs]);
internalDraw(x, y, 1, m_direction, ydiv, 0, m_animation, Otc::SpriteGreenMask);
g_graphics.bindBlendFunc(Fw::BlendNormal);
// feet
g_graphics.bindColor(Otc::OutfitColors[m_outfit.feet]);
internalDraw(x, y, 1, m_direction, ydiv, 0, m_animation, Otc::SpriteBlueMask);
// restore default blend func
g_graphics.bindBlendFunc(Fw::BlendDefault);
g_graphics.bindColor(Fw::white);
}
}

Loading…
Cancel
Save