mirror of
https://github.com/edubart/otclient.git
synced 2025-10-15 03:54:54 +02:00
skulls, shields and emblems are now rendered, thanks to joao
This commit is contained in:
@@ -368,6 +368,37 @@ namespace Otc
|
||||
StandWhileFighting = 0,
|
||||
ChaseOpponent = 1
|
||||
};
|
||||
|
||||
enum PlayerSkulls {
|
||||
SkullNone = 0,
|
||||
SkullYellow = 1,
|
||||
SkullGreen = 2,
|
||||
SkullWhite = 3,
|
||||
SkullRed = 4,
|
||||
SkullBlack = 5,
|
||||
SkullOrange = 6
|
||||
};
|
||||
|
||||
enum PlayerShields {
|
||||
ShieldNone = 0,
|
||||
ShieldWhiteYellow = 1,
|
||||
ShieldWhiteBlue = 2,
|
||||
ShieldBlue = 3,
|
||||
ShieldYellow = 4,
|
||||
ShieldBlueSharedExp = 5,
|
||||
ShieldYellowSharedExp = 6,
|
||||
ShieldBlueNoSharedExpBlink = 7,
|
||||
ShieldYellowNoSharedExpBlink = 8,
|
||||
ShieldBlueNoSharedExp = 9,
|
||||
ShieldYellowNoSharedExp = 10
|
||||
};
|
||||
|
||||
enum PlayerEmblems {
|
||||
EmblemNone = 0,
|
||||
EmblemGreen = 1,
|
||||
EmblemRed = 2,
|
||||
EmblemBlue = 3
|
||||
};
|
||||
}
|
||||
|
||||
#endif
|
||||
|
@@ -34,6 +34,7 @@
|
||||
|
||||
#include <framework/graphics/paintershaderprogram.h>
|
||||
#include <framework/graphics/paintershadersources.h>
|
||||
#include <framework/graphics/texturemanager.h>
|
||||
#include "spritemanager.h"
|
||||
|
||||
Creature::Creature() : Thing()
|
||||
@@ -158,6 +159,19 @@ void Creature::drawInformation(int x, int y, bool useGray, const Rect& visibleRe
|
||||
|
||||
if(m_informationFont)
|
||||
m_informationFont->renderText(m_name, textRect, Fw::AlignTopCenter, fillColor);
|
||||
|
||||
if(m_skull != Otc::SkullNone && m_skullTexture) {
|
||||
g_painter.setColor(Fw::white);
|
||||
g_painter.drawTexturedRect(Rect(x + 12, y + 5, m_skullTexture->getSize()), m_skullTexture);
|
||||
}
|
||||
if(m_shield != Otc::ShieldNone && m_shieldTexture) {
|
||||
g_painter.setColor(Fw::white);
|
||||
g_painter.drawTexturedRect(Rect(x, y + 5, m_shieldTexture->getSize()), m_shieldTexture);
|
||||
}
|
||||
if(m_emblem != Otc::EmblemNone && m_emblemTexture) {
|
||||
g_painter.setColor(Fw::white);
|
||||
g_painter.drawTexturedRect(Rect(x + 12, y + 16, m_emblemTexture->getSize()), m_emblemTexture);
|
||||
}
|
||||
}
|
||||
|
||||
void Creature::walk(const Position& position, bool inverse)
|
||||
@@ -325,6 +339,40 @@ void Creature::setOutfit(const Outfit& outfit)
|
||||
m_outfit.resetClothes();
|
||||
}
|
||||
|
||||
void Creature::setSkull(uint8 skull)
|
||||
{
|
||||
m_skull = skull;
|
||||
g_lua.callGlobalField("Creature","onSkullChange", asCreature(), m_skull);
|
||||
}
|
||||
|
||||
void Creature::setShield(uint8 shield)
|
||||
{
|
||||
m_shield = shield;
|
||||
g_lua.callGlobalField("Creature","onShieldChange", asCreature(), m_shield);
|
||||
}
|
||||
|
||||
void Creature::setEmblem(uint8 emblem)
|
||||
{
|
||||
m_emblem = emblem;
|
||||
|
||||
g_lua.callGlobalField("Creature","onEmblemChange", asCreature(), m_emblem);
|
||||
}
|
||||
|
||||
void Creature::setSkullTexture(const std::string& filename)
|
||||
{
|
||||
m_skullTexture = g_textures.getTexture(filename);
|
||||
}
|
||||
|
||||
void Creature::setShieldTexture(const std::string& filename)
|
||||
{
|
||||
m_shieldTexture = g_textures.getTexture(filename);
|
||||
}
|
||||
|
||||
void Creature::setEmblemTexture(const std::string& filename)
|
||||
{
|
||||
m_emblemTexture = g_textures.getTexture(filename);
|
||||
}
|
||||
|
||||
void Creature::addVolatileSquare(uint8 color)
|
||||
{
|
||||
m_showVolatileSquare = true;
|
||||
|
@@ -46,9 +46,12 @@ public:
|
||||
void setOutfit(const Outfit& outfit);
|
||||
void setLight(const Light& light) { m_light = light; }
|
||||
void setSpeed(uint16 speed) { m_speed = speed; }
|
||||
void setSkull(uint8 skull) { m_skull = skull; }
|
||||
void setShield(uint8 shield) { m_shield = shield; }
|
||||
void setEmblem(uint8 emblem) { m_emblem = emblem; }
|
||||
void setSkull(uint8 skull);
|
||||
void setShield(uint8 shield);
|
||||
void setEmblem(uint8 emblem);
|
||||
void setSkullTexture(const std::string& filename);
|
||||
void setShieldTexture(const std::string& filename);
|
||||
void setEmblemTexture(const std::string& filename);
|
||||
void setPassable(bool passable) { m_passable = passable; }
|
||||
|
||||
void addVolatileSquare(uint8 color);
|
||||
@@ -88,9 +91,8 @@ protected:
|
||||
Outfit m_outfit;
|
||||
Light m_light;
|
||||
uint16 m_speed;
|
||||
uint8 m_skull;
|
||||
uint8 m_shield;
|
||||
uint8 m_emblem;
|
||||
uint8 m_skull, m_shield, m_emblem;
|
||||
TexturePtr m_skullTexture, m_shieldTexture, m_emblemTexture;
|
||||
bool m_passable;
|
||||
Color m_volatileSquareColor, m_staticSquareColor;
|
||||
bool m_showVolatileSquare, m_showStaticSquare;
|
||||
|
@@ -80,6 +80,9 @@ void OTClient::registerLuaFunctions()
|
||||
g_lua.bindClassMemberFunction<Creature>("getName", &Creature::getName);
|
||||
g_lua.bindClassMemberFunction<Creature>("setOutfit", &Creature::setOutfit);
|
||||
g_lua.bindClassMemberFunction<Creature>("getOutfit", &Creature::getOutfit);
|
||||
g_lua.bindClassMemberFunction<Creature>("setSkullTexture", &Creature::setSkullTexture);
|
||||
g_lua.bindClassMemberFunction<Creature>("setShieldTexture", &Creature::setShieldTexture);
|
||||
g_lua.bindClassMemberFunction<Creature>("setEmblemTexture", &Creature::setEmblemTexture);
|
||||
|
||||
g_lua.registerClass<Player, Creature>();
|
||||
g_lua.registerClass<LocalPlayer, Player>();
|
||||
|
Reference in New Issue
Block a user