From 736b7ab85e115e33ab5392c1d0d0297ce401780c Mon Sep 17 00:00:00 2001 From: Peter Slattery Date: Sun, 6 Sep 2020 21:18:49 -0700 Subject: [PATCH] Prevented array index out of bounds error when accessing animation procs form the GlobalAnimationClips array --- src/app/foldhaus_app.cpp | 25 ++++--------------------- src/todo.txt | 1 - 2 files changed, 4 insertions(+), 22 deletions(-) diff --git a/src/app/foldhaus_app.cpp b/src/app/foldhaus_app.cpp index 1e4f33b..4f6bbc1 100644 --- a/src/app/foldhaus_app.cpp +++ b/src/app/foldhaus_app.cpp @@ -359,27 +359,10 @@ UPDATE_AND_RENDER(UpdateAndRender) u32 FramesIntoBlock = CurrentFrame - Block.Range.Min; r32 SecondsIntoBlock = FramesIntoBlock * State->AnimationSystem.SecondsPerFrame; - // TODO(Peter): Temporary - switch(Block.AnimationProcHandle) - { - case 1: - { - TestPatternOne(&LayerLEDBuffers[Layer], *Assembly, SecondsIntoBlock, &State->Transient); - }break; - - case 2: - { - TestPatternTwo(&LayerLEDBuffers[Layer], *Assembly, SecondsIntoBlock, &State->Transient); - }break; - - case 3: - { - TestPatternThree(&LayerLEDBuffers[Layer], *Assembly, SecondsIntoBlock, &State->Transient); - }break; - - // NOTE(Peter): Zero is invalid - InvalidDefaultCase; - } + + u32 AnimationProcIndex = Block.AnimationProcHandle - 1; + animation_proc* AnimationProc = GlobalAnimationClips[AnimationProcIndex].Proc; + AnimationProc(&LayerLEDBuffers[Layer], *Assembly, SecondsIntoBlock, &State->Transient); } // Consolidate Temp Buffers diff --git a/src/todo.txt b/src/todo.txt index a9edcb9..be2a476 100644 --- a/src/todo.txt +++ b/src/todo.txt @@ -29,7 +29,6 @@ STREAM #1: 3D Overhaul - custom sculpture update functions (for motion) - placing sculptures - editing sculpture files (change universe output) - - led groups & subgroups - defined in file - motion - Sculpture View