diff options
author | Treeki <treeki@gmail.com> | 2012-08-28 19:58:25 +0200 |
---|---|---|
committer | Treeki <treeki@gmail.com> | 2012-08-28 19:58:25 +0200 |
commit | b5b55914ff6978e2b6fa6a96cb169c867abc37d2 (patch) | |
tree | eb850574d5c64820d6e78c8d764e8eb6c60e6726 /src/koopatlas/map.cpp | |
parent | ef835d9dd72a5d70e5361f87654e6aa1f0ae35a5 (diff) | |
download | kamek-b5b55914ff6978e2b6fa6a96cb169c867abc37d2.tar.gz kamek-b5b55914ff6978e2b6fa6a96cb169c867abc37d2.zip |
fixed opacity animations and reversible loop
Diffstat (limited to '')
-rw-r--r-- | src/koopatlas/map.cpp | 11 |
1 files changed, 8 insertions, 3 deletions
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); |