character: SwitchSpritesheet: Don't switch when already on requested sheet

This commit is contained in:
Sebastian Krzyszkowiak 2022-07-14 00:19:19 +02:00
parent 844a55019a
commit 2ee41d0899
No known key found for this signature in database
GPG key ID: E8F235CF3BDBC3FF

View file

@ -86,6 +86,9 @@ SYMBOL_EXPORT void SwitchSpritesheet(struct Game* game, struct Character* charac
int pos = character->pos;
struct Spritesheet* old = character->spritesheet;
bool oldrev = character->reversing;
if (old && strcmp(name, old->name) == 0) {
return;
}
SelectSpritesheet(game, character, name);
if (old && old->bidir && character->spritesheet->bidir && oldrev) {
character->reversing = oldrev;