All files / src/shared/lib/helpers sprites.ts

0% Statements 0/13
0% Branches 0/5
0% Functions 0/1
0% Lines 0/12

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22                                           
export const maxSpriteTilesForBackgroundTilesLength = (
  backgroundTilesLength: number,
  isCGBOnly: boolean
) => {
  Iif (isCGBOnly) {
    Iif (backgroundTilesLength <= 256) {
      return 192;
    }
    Iif (backgroundTilesLength * 0.5 < 192) {
      return 192 - Math.ceil((backgroundTilesLength / 2 - 128) / 2) * 2;
    }
    return 128;
  }
  Iif (backgroundTilesLength <= 128) {
    return 96;
  }
  Iif (backgroundTilesLength < 192) {
    return 96 - Math.ceil((backgroundTilesLength - 128) / 2);
  }
  return 64;
};