TeaScript, 1816 bytes 18
x%2Ωrx%2Þr(x--xØ)ßl-x/2)
Pretty simple. The special characters are actually just "abbreviations" for longer code sequences.
I still haven't made permalinks so you'll have to copy paste into the interpreter
Explanation
x%2 && // If x is NOT even return falsy, else...
r(x--) // Range 0-input. Subtracts one from input
m(# // Loop through range
l- // Current item in loop, minus...
x/2 // input - 1, divided by two
)
This answer is non-competing