Fix for creature lights.

* Will now load the dat values for creature lights (ed if you know a more conventional way for this please let me know).
* No need to draw light for the outfit the creature draw will handle it.
Note: not sure if the from8bit method should limit at 256 or not, but tibia dat contains colors 216+.
This commit is contained in:
BeniS 2012-12-03 13:17:41 +13:00
parent b806b57628
commit 617e6b302b
6 changed files with 18 additions and 8 deletions

View File

@ -50,7 +50,7 @@ function g_game.getSupportedProtocols()
return {
810, 853, 854, 860, 861, 862, 870,
910, 940, 944, 953, 954, 960, 961,
963, 970
963, 970, 971
}
end

View File

@ -71,7 +71,7 @@ public:
bool operator!=(const Color& other) const { return other.rgba() != rgba(); }
static Color from8bit(int color) {
if(color >= 216 || color <= 0)
if(color >= 256 || color <= 0)
return Color(0, 0, 0);
int r = int(color / 36) % 6 * 51;

View File

@ -78,7 +78,7 @@ void Creature::draw(const Point& dest, float scaleFactor, bool animate, LightVie
g_painter->setColor(Color::white);
}
internalDrawOutfit(dest + animationOffset * scaleFactor, scaleFactor, animate, animate, m_direction, lightView);
internalDrawOutfit(dest + animationOffset * scaleFactor, scaleFactor, animate, animate, m_direction);
m_footStepDrawn = true;
if(lightView) {

View File

@ -30,11 +30,11 @@
LightView::LightView()
{
m_lightbuffer = g_framebuffers.createFrameBuffer();
generateLightBuble();
generateLightBubble();
reset();
}
void LightView::generateLightBuble()
void LightView::generateLightBubble()
{
m_lightRadius = 128;
int circleDiameter = m_lightRadius * 2;

View File

@ -47,7 +47,7 @@ public:
private:
void drawGlobalLight(const Light& light);
void drawLightSource(const Point& center, const Color& color, int radius);
void generateLightBuble();
void generateLightBubble();
TexturePtr m_lightTexture;
int m_lightRadius;

View File

@ -1638,13 +1638,23 @@ CreaturePtr ProtocolGame::getCreature(const InputMessagePtr& msg, int type)
creature->setHealthPercent(healthPercent);
creature->setDirection(direction);
creature->setOutfit(outfit);
creature->setLight(light);
creature->setSpeed(speed);
creature->setSkull(skull);
creature->setShield(shield);
creature->setPassable(!unpass);
if(emblem != -1)
creature->setEmblem(emblem);
creature->setPassable(!unpass);
ThingTypePtr thing = creature->getThingType();
if(thing) {
Light newLight = thing->getLight();
if(light.color > 0 && light.color != 215)
newLight.color = light.color;
if(light.intensity > 0)
newLight.intensity = light.intensity;
creature->setLight(newLight);
}
if(creature == m_localPlayer && !m_localPlayer->isKnown())
m_localPlayer->setKnown(true);