mirror of
https://gitlab.com/dosowisko.net/libsuperderpy.git
synced 2025-03-04 09:11:27 +01:00
character: use Spritesheet structs instead of strings with names in callbacks
This commit is contained in:
parent
c77c91e570
commit
60b960ab2c
2 changed files with 7 additions and 7 deletions
|
@ -388,20 +388,20 @@ SYMBOL_EXPORT void AnimateCharacter(struct Game* game, struct Character* charact
|
||||||
if (character->repeats > 0) {
|
if (character->repeats > 0) {
|
||||||
character->repeats--;
|
character->repeats--;
|
||||||
if (character->callback) {
|
if (character->callback) {
|
||||||
character->callback(game, character, NULL, character->spritesheet->name, character->callbackData);
|
character->callback(game, character, NULL, character->spritesheet, character->callbackData);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if ((!character->reversed) && (character->successor)) {
|
if ((!character->reversed) && (character->successor)) {
|
||||||
char* old = character->spritesheet->name;
|
struct Spritesheet* old = character->spritesheet;
|
||||||
SelectSpritesheet(game, character, character->successor);
|
SelectSpritesheet(game, character, character->successor);
|
||||||
if (character->callback) {
|
if (character->callback) {
|
||||||
character->callback(game, character, character->spritesheet->name, old, character->callbackData);
|
character->callback(game, character, character->spritesheet, old, character->callbackData);
|
||||||
}
|
}
|
||||||
} else if ((character->reversed) && (character->predecessor)) {
|
} else if ((character->reversed) && (character->predecessor)) {
|
||||||
char* old = character->spritesheet->name;
|
struct Spritesheet* old = character->spritesheet;
|
||||||
SelectSpritesheet(game, character, character->predecessor);
|
SelectSpritesheet(game, character, character->predecessor);
|
||||||
if (character->callback) {
|
if (character->callback) {
|
||||||
character->callback(game, character, character->spritesheet->name, old, character->callbackData);
|
character->callback(game, character, character->spritesheet, old, character->callbackData);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (character->repeats == 0) {
|
if (character->repeats == 0) {
|
||||||
|
@ -411,7 +411,7 @@ SYMBOL_EXPORT void AnimateCharacter(struct Game* game, struct Character* charact
|
||||||
character->pos = character->spritesheet->frameCount - 1;
|
character->pos = character->spritesheet->frameCount - 1;
|
||||||
}
|
}
|
||||||
if (character->callback) {
|
if (character->callback) {
|
||||||
character->callback(game, character, NULL, character->spritesheet->name, character->callbackData);
|
character->callback(game, character, NULL, character->spritesheet, character->callbackData);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -94,7 +94,7 @@ struct Character {
|
||||||
bool reversed; /*!< Whether the current animation has been requested as reversed. */
|
bool reversed; /*!< Whether the current animation has been requested as reversed. */
|
||||||
bool hidden;
|
bool hidden;
|
||||||
void* data; /*!< Additional, custom character data (HP etc.). */
|
void* data; /*!< Additional, custom character data (HP etc.). */
|
||||||
void (*callback)(struct Game*, struct Character*, char* newAnim, char* oldAnim, void*);
|
void (*callback)(struct Game*, struct Character*, struct Spritesheet* newAnim, struct Spritesheet* oldAnim, void*);
|
||||||
void* callbackData;
|
void* callbackData;
|
||||||
bool shared; /*!< Marks the list of spritesheets as shared, so it won't be freed together with the character. */
|
bool shared; /*!< Marks the list of spritesheets as shared, so it won't be freed together with the character. */
|
||||||
ALLEGRO_TRANSFORM transform;
|
ALLEGRO_TRANSFORM transform;
|
||||||
|
|
Loading…
Add table
Reference in a new issue