Skip to content

Commit

Permalink
AGS.Native: fixed crop_sprite_edges copies flags from wrong sprite idx
Browse files Browse the repository at this point in the history
Was broken by f2a922a
  • Loading branch information
ivan-mogilko committed Dec 5, 2023
1 parent 363b336 commit fb10447
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions Editor/AGS.Native/agsnative.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -355,13 +355,14 @@ int crop_sprite_edges(int numSprites, int *sprites, bool symmetric) {
}

for (aa = 0; aa < numSprites; aa++) {
Common::Bitmap *sprit = get_sprite(sprites[aa]);
int sprnum = sprites[aa];
AGSBitmap *sprit = get_sprite(sprnum);
// create a new, smaller sprite and copy across
Common::Bitmap *newsprit = Common::BitmapHelper::CreateBitmap(newWidth, newHeight, sprit->GetColorDepth());
AGSBitmap *newsprit = BitmapHelper::CreateBitmap(newWidth, newHeight, sprit->GetColorDepth());
newsprit->Blit(sprit, left, top, 0, 0, newWidth, newHeight);
delete sprit;
// set new image and keep old flags
spriteset.SetSprite(sprites[aa], newsprit, thisgame.SpriteInfos[aa].Flags);
spriteset.SetSprite(sprnum, newsprit, thisgame.SpriteInfos[sprnum].Flags);
}

spritesModified = true;
Expand Down

0 comments on commit fb10447

Please sign in to comment.