character: Maintain bidir status in SwitchSpritesheet

This commit is contained in:
Sebastian Krzyszkowiak 2022-07-11 23:21:05 +02:00
parent a71d0bb0bb
commit 844a55019a
No known key found for this signature in database
GPG key ID: E8F235CF3BDBC3FF

View file

@ -84,7 +84,12 @@ SYMBOL_EXPORT void SelectSpritesheet(struct Game* game, struct Character* charac
SYMBOL_EXPORT void SwitchSpritesheet(struct Game* game, struct Character* character, char* name) {
int pos = character->pos;
struct Spritesheet* old = character->spritesheet;
bool oldrev = character->reversing;
SelectSpritesheet(game, character, name);
if (old && old->bidir && character->spritesheet->bidir && oldrev) {
character->reversing = oldrev;
}
if (pos < character->spritesheet->frame_count && !character->spritesheet->stream) {
character->pos = pos;
character->frame = &character->spritesheet->frames[character->pos];