mirror of
https://github.com/vcmi/vcmi.git
synced 2025-08-10 22:31:40 +02:00
Fix corrupted image of university
This commit is contained in:
@@ -32,6 +32,16 @@
|
|||||||
#include "../../lib/texts/CGeneralTextHandler.h" //for Unicode related stuff
|
#include "../../lib/texts/CGeneralTextHandler.h" //for Unicode related stuff
|
||||||
#include "../../lib/CRandomGenerator.h"
|
#include "../../lib/CRandomGenerator.h"
|
||||||
|
|
||||||
|
static EImageBlitMode getModeForFlags( uint8_t flags)
|
||||||
|
{
|
||||||
|
if (flags & CCreatureAnim::CREATURE_MODE)
|
||||||
|
return EImageBlitMode::WITH_SHADOW_AND_SELECTION;
|
||||||
|
if (flags & CCreatureAnim::MAP_OBJECT_MODE)
|
||||||
|
return EImageBlitMode::WITH_SHADOW;
|
||||||
|
|
||||||
|
return EImageBlitMode::COLORKEY;
|
||||||
|
}
|
||||||
|
|
||||||
CPicture::CPicture(std::shared_ptr<IImage> image, const Point & position)
|
CPicture::CPicture(std::shared_ptr<IImage> image, const Point & position)
|
||||||
: bg(image)
|
: bg(image)
|
||||||
, needRefresh(false)
|
, needRefresh(false)
|
||||||
@@ -195,12 +205,12 @@ CAnimImage::CAnimImage(const AnimationPath & name, size_t Frame, size_t Group, i
|
|||||||
{
|
{
|
||||||
pos.x += x;
|
pos.x += x;
|
||||||
pos.y += y;
|
pos.y += y;
|
||||||
anim = GH.renderHandler().loadAnimation(name, (Flags & CCreatureAnim::CREATURE_MODE) ? EImageBlitMode::WITH_SHADOW_AND_SELECTION: EImageBlitMode::COLORKEY);
|
anim = GH.renderHandler().loadAnimation(name, getModeForFlags(Flags));
|
||||||
init();
|
init();
|
||||||
}
|
}
|
||||||
|
|
||||||
CAnimImage::CAnimImage(const AnimationPath & name, size_t Frame, Rect targetPos, size_t Group, ui8 Flags):
|
CAnimImage::CAnimImage(const AnimationPath & name, size_t Frame, Rect targetPos, size_t Group, ui8 Flags):
|
||||||
anim(GH.renderHandler().loadAnimation(name, (Flags & CCreatureAnim::CREATURE_MODE) ? EImageBlitMode::WITH_SHADOW_AND_SELECTION : EImageBlitMode::COLORKEY)),
|
anim(GH.renderHandler().loadAnimation(name, getModeForFlags(Flags))),
|
||||||
frame(Frame),
|
frame(Frame),
|
||||||
group(Group),
|
group(Group),
|
||||||
flags(Flags),
|
flags(Flags),
|
||||||
@@ -318,7 +328,7 @@ bool CAnimImage::isPlayerColored() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
CShowableAnim::CShowableAnim(int x, int y, const AnimationPath & name, ui8 Flags, ui32 frameTime, size_t Group, uint8_t alpha):
|
CShowableAnim::CShowableAnim(int x, int y, const AnimationPath & name, ui8 Flags, ui32 frameTime, size_t Group, uint8_t alpha):
|
||||||
anim(GH.renderHandler().loadAnimation(name, (Flags & CREATURE_MODE) ? EImageBlitMode::WITH_SHADOW_AND_SELECTION : EImageBlitMode::COLORKEY)),
|
anim(GH.renderHandler().loadAnimation(name, getModeForFlags(Flags))),
|
||||||
group(Group),
|
group(Group),
|
||||||
frame(0),
|
frame(0),
|
||||||
first(0),
|
first(0),
|
||||||
|
@@ -151,7 +151,8 @@ public:
|
|||||||
BASE=1, //base frame will be blitted before current one
|
BASE=1, //base frame will be blitted before current one
|
||||||
HORIZONTAL_FLIP=2, //TODO: will be displayed rotated
|
HORIZONTAL_FLIP=2, //TODO: will be displayed rotated
|
||||||
VERTICAL_FLIP=4, //TODO: will be displayed rotated
|
VERTICAL_FLIP=4, //TODO: will be displayed rotated
|
||||||
CREATURE_MODE=8, // use alpha channel for images with palette. Required for creatures in battle and map objects
|
CREATURE_MODE=8, // use alpha channel for images with palette. Required for creatures in battle
|
||||||
|
MAP_OBJECT_MODE=16, // use alpha channel for images with palette. Required for map objects
|
||||||
PLAY_ONCE=32 //play animation only once and stop at last frame
|
PLAY_ONCE=32 //play animation only once and stop at last frame
|
||||||
};
|
};
|
||||||
protected:
|
protected:
|
||||||
|
@@ -749,7 +749,7 @@ CShipyardWindow::CShipyardWindow(const TResources & cost, int state, BoatId boat
|
|||||||
AnimationPath boatFilename = boatConstructor->getBoatAnimationName();
|
AnimationPath boatFilename = boatConstructor->getBoatAnimationName();
|
||||||
|
|
||||||
Point waterCenter = Point(bgWater->pos.x+bgWater->pos.w/2, bgWater->pos.y+bgWater->pos.h/2);
|
Point waterCenter = Point(bgWater->pos.x+bgWater->pos.w/2, bgWater->pos.y+bgWater->pos.h/2);
|
||||||
bgShip = std::make_shared<CShowableAnim>(120, 96, boatFilename, CShowableAnim::CREATURE_MODE, 100, 7);
|
bgShip = std::make_shared<CShowableAnim>(120, 96, boatFilename, CShowableAnim::MAP_OBJECT_MODE, 100, 7);
|
||||||
bgShip->center(waterCenter);
|
bgShip->center(waterCenter);
|
||||||
bgWater->needRefresh = true;
|
bgWater->needRefresh = true;
|
||||||
}
|
}
|
||||||
@@ -953,7 +953,7 @@ CUniversityWindow::CUniversityWindow(const CGHeroInstance * _hero, BuildingID bu
|
|||||||
}
|
}
|
||||||
else if(auto uni = dynamic_cast<const CGUniversity *>(_market); uni->appearance)
|
else if(auto uni = dynamic_cast<const CGUniversity *>(_market); uni->appearance)
|
||||||
{
|
{
|
||||||
titlePic = std::make_shared<CAnimImage>(uni->appearance->animationFile, 0, 0, 0, 0, CShowableAnim::CREATURE_MODE);
|
titlePic = std::make_shared<CAnimImage>(uni->appearance->animationFile, 0, 0, 0, 0, CShowableAnim::MAP_OBJECT_MODE);
|
||||||
titleStr = uni->getObjectName();
|
titleStr = uni->getObjectName();
|
||||||
speechStr = uni->getSpeechTranslated();
|
speechStr = uni->getSpeechTranslated();
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user