From b5b55914ff6978e2b6fa6a96cb169c867abc37d2 Mon Sep 17 00:00:00 2001 From: Treeki Date: Tue, 28 Aug 2012 19:58:25 +0200 Subject: fixed opacity animations and reversible loop --- src/koopatlas/map.cpp | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'src/koopatlas') diff --git a/src/koopatlas/map.cpp b/src/koopatlas/map.cpp index e37ee4b..65d71b8 100644 --- a/src/koopatlas/map.cpp +++ b/src/koopatlas/map.cpp @@ -303,6 +303,7 @@ void dWMMap_c::renderer_c::renderDoodadLayer(dKPLayer_s *layer) { float effectiveX = doodad->x, effectiveY = doodad->y; float effectiveWidth = doodad->width, effectiveHeight = doodad->height; float effectiveAngle = doodad->angle; + int effectiveAlpha = layer->alpha; if (doodad->animationCount > 0) { for (int j = 0; j < doodad->animationCount; j++) { @@ -315,9 +316,9 @@ void dWMMap_c::renderer_c::renderDoodadLayer(dKPLayer_s *layer) { } u32 elapsed = GlobalTickCount - baseTick; - u32 elapsedAdjusted = elapsed; if (anim->isReversed) elapsed = anim->frameCount - 1 - elapsed; + u32 elapsedAdjusted = elapsed; if (elapsed >= anim->frameCount) { if (elapsed >= (anim->frameCount + anim->delay)) { @@ -342,8 +343,10 @@ void dWMMap_c::renderer_c::renderDoodadLayer(dKPLayer_s *layer) { anim->baseTick = GlobalTickCount; break; } + elapsedAdjusted = elapsed; + } else { + elapsedAdjusted = anim->frameCount; } - elapsedAdjusted = anim->frameCount; } // now calculate the thing @@ -393,7 +396,7 @@ void dWMMap_c::renderer_c::renderDoodadLayer(dKPLayer_s *layer) { effectiveY += scaleYMod; break; case dKPDoodad_s::animation_s::OPACITY: - // TODO + effectiveAlpha = (effectiveAlpha * (frame * 2.55f)) / 255; break; } } @@ -415,6 +418,8 @@ void dWMMap_c::renderer_c::renderDoodadLayer(dKPLayer_s *layer) { MTXConcat(doodadMtx, rotMtx, doodadMtx); } + GXSetTevColor(GX_TEVREG0, (GXColor){255,255,255,effectiveAlpha}); + loadCamera(doodadMtx); loadTexture(doodad->texObj); -- cgit v1.2.3