uiitem and outfit class fixes

This commit is contained in:
Henrique 2011-11-14 20:47:36 -02:00
parent a95d0bcc1f
commit 591f8c2c7c
6 changed files with 43 additions and 23 deletions

View File

@ -16,10 +16,7 @@ function Outfit.test()
end
function Outfit.create(creature, outfitList)
if window ~= nil then
Outfit.destroy()
end
window = loadUI("/outfit/outfit.otui", UI.root)
local creatureWidget = window:getChildById('creature')
@ -27,9 +24,11 @@ function Outfit.create(creature, outfitList)
end
function Outfit.destroy()
if window ~= nil then
window:destroy()
window = nil
end
end
-- private functions

View File

@ -70,19 +70,19 @@ void Creature::draw(const Point& p)
g_graphics.bindBlendFunc(Fw::BlendColorzing);
// head
g_graphics.bindColor(m_outfit.getHead());
g_graphics.bindColor(m_outfit.getHeadColor());
internalDraw(p + m_walkOffset, 1, Otc::SpriteYellowMask);
// body
g_graphics.bindColor(m_outfit.getBody());
g_graphics.bindColor(m_outfit.getBodyColor());
internalDraw(p + m_walkOffset, 1, Otc::SpriteRedMask);
// legs
g_graphics.bindColor(m_outfit.getLegs());
g_graphics.bindColor(m_outfit.getLegsColor());
internalDraw(p + m_walkOffset, 1, Otc::SpriteGreenMask);
// feet
g_graphics.bindColor(m_outfit.getFeet());
g_graphics.bindColor(m_outfit.getFeetColor());
internalDraw(p + m_walkOffset, 1, Otc::SpriteBlueMask);
// restore default blend func

View File

@ -36,22 +36,27 @@ public:
static Color getColor(int color);
void setType(int type) { m_type = type; }
void setHead(int head) { m_head = getColor(head); }
void setBody(int body) { m_body = getColor(body); }
void setLegs(int legs) { m_legs = getColor(legs); }
void setFeet(int feet) { m_feet = getColor(feet); }
void setHead(int head) { m_head = head; m_headColor = getColor(head); }
void setBody(int body) { m_body = body; m_bodyColor = getColor(body); }
void setLegs(int legs) { m_legs = legs; m_legsColor = getColor(legs); }
void setFeet(int feet) { m_feet = feet; m_feetColor = getColor(feet); }
void setAddons(int addons) { m_addons = addons; }
int getType() { return m_type; }
Color getHead() { return m_head; }
Color getBody() { return m_body; }
Color getLegs() { return m_legs; }
Color getFeet() { return m_feet; }
int getAddons() { return m_addons; }
int getType() const { return m_type; }
int getHead() const { return m_head; }
int getBody() const { return m_body; }
int getLegs() const { return m_legs; }
int getFeet() const { return m_feet; }
int getAddons() const { return m_addons; }
Color getHeadColor() { return m_headColor; }
Color getBodyColor() { return m_bodyColor; }
Color getLegsColor() { return m_legsColor; }
Color getFeetColor() { return m_feetColor; }
private:
int m_type, m_addons;
Color m_head, m_body, m_legs, m_feet;
int m_type, m_head, m_body, m_legs, m_feet, m_addons;
Color m_headColor, m_bodyColor, m_legsColor, m_feetColor;
};
#endif

View File

@ -57,6 +57,7 @@ public:
void sendUseItem(const Position& position, int itemId, int stackpos, int index);
void sendTalk(int channelType, int channelId, const std::string& receiver, const std::string& message);
void sendGetOutfit();
void sendSetOutfit(const Outfit& outfit);
void sendAddVip(const std::string& name);
void sendRemoveVip(int id);

View File

@ -202,6 +202,21 @@ void ProtocolGame::sendGetOutfit()
send(oMsg);
}
void ProtocolGame::sendSetOutfit(const Outfit& outfit)
{
OutputMessage oMsg;
oMsg.addU8(Otc::ClientSetOutfit);
oMsg.addU16(outfit.getType());
oMsg.addU8(outfit.getHead());
oMsg.addU8(outfit.getBody());
oMsg.addU8(outfit.getLegs());
oMsg.addU8(outfit.getFeet());
oMsg.addU8(outfit.getAddons());
send(oMsg);
}
void ProtocolGame::sendAddVip(const std::string& name)
{
OutputMessage oMsg;

View File

@ -35,7 +35,7 @@ void UIItem::render()
if(m_item) {
g_graphics.bindColor(Fw::white);
m_item->draw(m_rect.topLeft() + m_itemMargin);
m_item->draw(m_rect.bottomRight() - Point(32, 32) + m_itemMargin);
}
renderChildren();