mirror of
https://github.com/photonstorm/phaser
synced 2024-11-24 05:33:35 +00:00
Correctly interpret binaryString as a sequence of uint32-le values
The previous implementation was ignoring the 3 most significant bytes of each value and would result on improper parsing of any map with tile ids higher than 255
This commit is contained in:
parent
a8e972b25a
commit
f52ca58d7d
1 changed files with 6 additions and 1 deletions
|
@ -239,8 +239,13 @@ Phaser.TilemapParser = {
|
|||
var binaryString = window.atob(curl.data);
|
||||
var len = binaryString.length;
|
||||
var bytes = new Array( len );
|
||||
// Interpret binaryString as an array of bytes representing
|
||||
// little-endian encoded uint32 values.
|
||||
for (var i = 0; i < len; i+=4) {
|
||||
bytes[i/4] = binaryString.charCodeAt(i);
|
||||
bytes[i/4] = binaryString.charCodeAt(i) |
|
||||
binaryString.charCodeAt(i+1) << 8 |
|
||||
binaryString.charCodeAt(i+2) << 16 |
|
||||
binaryString.charCodeAt(i+3) << 24;
|
||||
}
|
||||
curl.data = bytes;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue