Untitled

mail@pastecode.io avatar
unknown
javascript
2 years ago
747 B
4
Indexable
Never
let scnEffect = 0

function TIC() {
  scnEffect += 0.35
}

function SCN(scn: number) {
  // Loop through colors in ram
  for (let i = 0; i < 16; i++) {
    // Grayscale effect
    if (scn >= l - 1 && scn <= l + 1) {
      const [r, g, b] = [
        peek(0x3fc0 + i * 3 + 0),
        peek(0x3fc0 + i * 3 + 1),
        peek(0x3fc0 + i * 3 + 2),
      ]
      let linear = r * 0.2126 + g * 0.7152 + b * 0.0722
      poke(0x3fc0 + i * 3 + 0, linear)
      poke(0x3fc0 + i * 3 + 1, linear)
      poke(0x3fc0 + i * 3 + 2, linear)
    }

    // reset rgb values
    else {
      sync(32, 0, false)
      // poke(0x3fc0 + i * 3 + 0, colors[i][0])
      // poke(0x3fc0 + i * 3 + 1, colors[i][1])
      // poke(0x3fc0 + i * 3 + 2, colors[i][2])
    }
  }
}