Skip to content

Commit

Permalink
Don't change frame for inanimate objects
Browse files Browse the repository at this point in the history
  • Loading branch information
GriffinRichards authored and huderlem committed Dec 27, 2021
1 parent f6552c5 commit de0a5b5
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 1 deletion.
1 change: 1 addition & 0 deletions include/core/event.h
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ class Event
int frame = 0;
bool hFlip = false;
bool usingSprite;
bool inanimate;

DraggablePixmapItem *pixmapItem = nullptr;
void setPixmapItem(DraggablePixmapItem *item) { pixmapItem = item; }
Expand Down
5 changes: 4 additions & 1 deletion src/core/event.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down Expand Up @@ -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;
Expand Down
2 changes: 2 additions & 0 deletions src/project.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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);
Expand Down

0 comments on commit de0a5b5

Please sign in to comment.