Browse Source

NESNameTable now stores the NESBank.rp property into a class level object, reducing the amount of time NESBank needs to create a proxy object.

dev
Bryan Miller 5 years ago
parent
commit
86c4b4353d
1 changed files with 3 additions and 1 deletions
  1. +3
    -1
      app/js/models/NESNameTable.js

+ 3
- 1
app/js/models/NESNameTable.js View File

constructor(){ constructor(){
super(); super();
this.__bank = null; this.__bank = null;
this.__bankrp = null;
this.__palette = null; this.__palette = null;
this.__tiles = []; this.__tiles = [];
this.__attribs = []; this.__attribs = [];
if (b !== null && !(b instanceof NESBank)) if (b !== null && !(b instanceof NESBank))
throw new TypeError("Expected a NESBank object."); throw new TypeError("Expected a NESBank object.");
this.__bank = b; this.__bank = b;
this.__bankrp = (b !== null) ? this.__bank.rp : null;
this.emit("data_changed"); this.emit("data_changed");
} }


var tileX = Math.floor(x / 8); var tileX = Math.floor(x / 8);
var tileY = Math.floor(y / 8); var tileY = Math.floor(y / 8);


ci = this.__bank.rp[this.__tiles[(tileY * 32) + tileX]].getPixelIndex(_x, _y);
ci = this.__bankrp[this.__tiles[(tileY * 32) + tileX]].getPixelIndex(_x, _y);
pi = this._PaletteFromCoords(x, y); pi = this._PaletteFromCoords(x, y);
} }
return {pi:pi, ci:ci}; return {pi:pi, ci:ci};

Loading…
Cancel
Save