anchor.diff:  
   var
     I, Step, NextStep, SubStep, StepSprite, StepNextSprite, StepSpriteBase, StepNextSpriteBase, InterpOffset: Integer;
  -  pngWidth, pngHeight, newWidth, newHeight: Word;
  -  pngBase, pngShad, pngTeam, pngCrop, pngCropMask: TKMCardinalArray;
  -  X, Y, MinX, MinY, MaxX, MaxY: Integer;
     OverallMaxX, OverallMinX, OverallMaxY, OverallMinY: Integer;
     BaseMoveX, BaseMoveY: Integer;
  -  NoShadMinX, NoShadMinY, NoShadMaxX, NoShadMaxY: Integer;
     StrList: TStringList;
  -  dirBase, dirShad, dirTeam, suffixPath, outDirLocal: string;
  -  needsMask, Found: Boolean;
  +  suffixPath, outDirLocal, outPrefix: string;
  +  dirBase, dirShad, dirTeam: string;
  +  Found: Boolean;
   begin
     if (A.Count <= 1) or (A.Step[1] = -1) then
     begin
  
positive.code: 
      if aDryRun then
        Continue;
  
      //Interpolate!
      KMDeleteFolder(dirBase);
  
negative.code:     Exit;
    end;
  
    if Is4xAnim(A) then
    begin
      //Custom handler for tree animations that only update every 4 frames
      outDirLocal := fOutDir+IntToStr(Byte(rxTrees)+1)+'\';
      outPrefix := outDirLocal+IntToStr(Byte(rxTrees)+1)+'_';
      ForceDirectories(outDirLocal);
  
      for Step := 1 to 8 do
      begin
        if Step > (A.Count div 4) then
        begin
          for SubStep := 1 to 32 do
            fOutputStream.Write(Integer(-1));
          Continue;
        end;
  
        StepSprite := A.Step[Step*4] + 1;
        StepNextSprite := A.Step[((Step*4) mod A.Count) + 1] + 1;
  
        fOutputStream.Write(StepSprite);
  
        InterpOffset := aPicOffset;
        //Update return values
        Inc(aPicOffset, 31);
        for SubStep := 0 to 30 do
          fOutputStream.Write(InterpOffset+SubStep);
  
        if aDryRun then
          Continue;
  
        Make4xInterpImages(rxTrees, StepSprite, StepNextSprite, fWorkDir+'base\', ietBase);
        Make4xInterpImages(rxTrees, StepSprite, StepNextSprite, fWorkDir+'shad\', ietShadows);
        for SubStep := 0 to 30 do
        begin
          //Filenames are 1-based, and skip the first one since it's the original
          suffixPath := 'interpolated_frames\' + format('%.15d.png', [SubStep+1+1]);
          ProcessInterpImage(InterpOffset+SubStep, suffixPath, outPrefix, $0, 9999, -9999, 9999, -9999);
        end;
      end;
    end
    else
      DoInterp(rxTrees, A, A, False, False, False, $000000, aPicOffset, aDryRun);
  end;
  
  
  