Browse Source

Bitwise access in NESTile should be fixed. *fingers crossed*

dev-tmpl
Bryan Miller 5 years ago
parent
commit
344ec3bda1
1 changed files with 7 additions and 3 deletions
  1. +7
    -3
      app/js/models/NESTile.js

+ 7
- 3
app/js/models/NESTile.js View File

function SetDataArrayColor(arr, x, y, ci){ function SetDataArrayColor(arr, x, y, ci){
var index = (y*8)+x; var index = (y*8)+x;
var dindex = Math.floor(index*0.25); var dindex = Math.floor(index*0.25);
var bitoffset = 6 - ((index % 4) * 2);
arr[dindex] = (arr[dindex] & BitMask(bitoffset)) ^ (ci << bitoffset);
var bitoffset = (index % 4);
arr[dindex] = (arr[dindex] & BitMask(bitoffset)) ^ (ci << ((3 - bitoffset)*2));
//if (dindex === 1){
// console.log("index: ", dindex, " | value: ", arr[dindex], " | (x,y): (", x, ",", y, ") | Bit Offset: ", bitoffset, "Color: ", ci);
//}
} }




(flag == 2 || flag == 3) ? 7 - y: y, (flag == 2 || flag == 3) ? 7 - y: y,
ci ci
); );
console.log(newData);
//console.log(newData);
//newData[r[0]] = 2; //newData[r[0]] = 2;
//newData[r[0]] = r[1]; //newData[r[0]] = r[1];
} }
} }
//console.log(newData);
this.__data = newData; this.__data = newData;
} }
return this; return this;

Loading…
Cancel
Save