Don't change frame for inanimate objects

This commit is contained in:
GriffinR 2021-12-27 15:35:58 -05:00 committed by huderlem
parent f6552c57af
commit de0a5b526b
3 changed files with 7 additions and 1 deletions

View file

@ -99,6 +99,7 @@ public:
int frame = 0;
bool hFlip = false;
bool usingSprite;
bool inanimate;
DraggablePixmapItem *pixmapItem = nullptr;
void setPixmapItem(DraggablePixmapItem *item) { pixmapItem = item; }

View file

@ -26,7 +26,8 @@ Event::Event(const Event& toCopy) :
spriteHeight(toCopy.spriteHeight),
frame(toCopy.frame),
hFlip(toCopy.hFlip),
usingSprite(toCopy.usingSprite)
usingSprite(toCopy.usingSprite),
inanimate(toCopy.inanimate)
{ }
Event::Event(QJsonObject obj, QString type) : Event()
@ -427,6 +428,8 @@ void Event::setFrameFromMovement(QString facingDir) {
// defaults
this->frame = 0;
this->hFlip = false;
if (this->inanimate)
return;
if (facingDir == "DIR_NORTH") {
this->frame = 1;
this->hFlip = false;

View file

@ -2441,6 +2441,7 @@ void Project::loadEventPixmaps(QList<Event*> objects) {
object->spriteWidth = 16;
object->spriteHeight = 16;
object->usingSprite = false;
object->inanimate = true;
QString event_type = object->get("event_type");
if (event_type == EventType::Object) {
object->pixmap = QPixmap(":/images/Entities_16x16.png").copy(0, 0, 16, 16);
@ -2457,6 +2458,7 @@ void Project::loadEventPixmaps(QList<Event*> objects) {
if (event_type == EventType::Object) {
QString info_label = pointerHash[object->get("sprite")].replace("&", "");
QStringList gfx_info = parser.readCArray("src/data/object_events/object_event_graphics_info.h", info_label);
object->inanimate = (gfx_info.value(8) == "TRUE");
QString pic_label = gfx_info.value(14);
QString dimensions_label = gfx_info.value(11);
QString subsprites_label = gfx_info.value(12);