Skip to content

Commit

Permalink
Issue flareteam#58 fix Effect animation
Browse files Browse the repository at this point in the history
  • Loading branch information
clintbellanger committed Sep 28, 2012
1 parent 96a3a61 commit ec3f4fc
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/PowerManager.cpp
Expand Up @@ -1188,9 +1188,11 @@ Renderable PowerManager::renderEffects(StatBlock *src_stats) {
for (unsigned int j=0; j<src_stats->effects.size(); j++) {
for (unsigned int i=0; i<effects.size(); i++) {
if (src_stats->effects[j].type == effects[i].type && effects[i].gfx != NULL) {

if (src_stats->effects[j].frame == effects[i].frame_total)

// TODO: frame reset belogs in the logic phase, e.g. StatBlock::logic
if (src_stats->effects[j].frame >= effects[i].frame_total)
src_stats->effects[j].frame = 0;

r.src.x = (src_stats->effects[j].frame / effects[i].ticks_per_frame) * effects[i].frame_size.w;

r.src.y = effects[i].frame_size.y;
Expand Down
14 changes: 14 additions & 0 deletions src/PowerManager.h
Expand Up @@ -272,6 +272,20 @@ class PowerManager {
Point frame_offset;
int frame_total;
int ticks_per_frame;

Effect() {
type = "";
icon = -1;
gfx = NULL;
frame_size.x = 0;
frame_size.y = 0;
frame_size.w = 1;
frame_size.h = 1;
frame_offset.x = 0;
frame_offset.y = 0;
frame_total = 1;
ticks_per_frame = 1;
}
};

MapCollision *collider;
Expand Down

0 comments on commit ec3f4fc

Please sign in to comment.