|
|
|
|
|
var inputAssignments = { |
|
shiftLeft: ['left'], |
|
shiftRight: ['right'], |
|
softDrop: ['down'], |
|
rotateLeft: ['z'], |
|
rotateRight: ['x', 'up'], |
|
swap: ['shift', 'c'], |
|
hardDrop: ['space'] |
|
}; |
|
|
|
var autoRepeatConfig = 50; |
|
var thresholdConfig = 200; |
|
|
|
function loadGameControls() { |
|
var cookies = ['rotateLeft', |
|
'rotateRight', |
|
'shiftLeft', |
|
'shiftRight', |
|
'softDrop', |
|
'hardDrop', |
|
'swap'], |
|
i, curVal; |
|
|
|
|
|
if (readCookie('customControls') === 'TRUE') { |
|
|
|
for (i = 0; i < cookies.length; i += 1) { |
|
|
|
curVal = readCookie(cookies[i]); |
|
document.getElementById(cookies[i]).innerHTML = curVal; |
|
|
|
inputAssignments[cookies[i]] = [curVal.toLowerCase()]; |
|
} |
|
} |
|
|
|
var autoRepeat = readCookie('autoRepeat'); |
|
if (autoRepeat !== null) { |
|
autoRepeatConfig = parseInt(autoRepeat); |
|
} |
|
var threshold = readCookie('threshold'); |
|
if (threshold != null) { |
|
thresholdConfig = parseInt(threshold); |
|
} |
|
} |