X-Git-Url: https://git.verplant.org/?a=blobdiff_plain;f=src%2Fsprite%2Fsprite.cpp;h=7b818279a641bea00a5fc2d94ea67c4e58f88f3b;hb=6f5f82abb84b33fd400c3b82a5e2be2a6cf8ce21;hp=0c011ef1425f6464c7ac217e4e2086711025567d;hpb=6b50afc6cdd8d3555901b02ce12f15b5bac32aa8;p=supertux.git diff --git a/src/sprite/sprite.cpp b/src/sprite/sprite.cpp index 0c011ef14..7b818279a 100644 --- a/src/sprite/sprite.cpp +++ b/src/sprite/sprite.cpp @@ -33,9 +33,9 @@ Sprite::Sprite(SpriteData& newdata) : data(newdata), - frame(0), - animation_loops(-1), - angle(0.0f), + frame(0), + animation_loops(-1), + angle(0.0f), color(1.0f, 1.0f, 1.0f, 1.0f) { action = data.get_action("normal"); @@ -94,7 +94,7 @@ Sprite::update() if(frame >= get_frames()) { frame = fmodf(frame, get_frames()); - + animation_loops--; if(animation_done()) frame = get_frames()-1; @@ -126,7 +126,7 @@ Sprite::draw_part(DrawingContext& context, const Vector& source, update(); int frameidx = (int) frame; - + if(frameidx >= get_frames() || frameidx < 0) { #ifndef DEBUG // in optimized mode we get some small rounding errors in floating point @@ -135,7 +135,7 @@ Sprite::draw_part(DrawingContext& context, const Vector& source, #endif frameidx = get_frames() - 1; } - + context.draw_surface_part(action->surfaces[frameidx], source, size, pos - Vector(action->x_offset, action->y_offset), layer + action->z_order);