reverse bit ordering in getValidPetPoses
This commit is contained in:
parent
da0398b50b
commit
01c6cbcfdb
1 changed files with 11 additions and 8 deletions
|
@ -37,18 +37,21 @@ export default async function getValidPetPoses() {
|
|||
for (let colorId = 1; colorId <= numColors; colorId++) {
|
||||
const colorIndex = colorId - 1;
|
||||
|
||||
// We fill in the high bits first. If we add more things later, write
|
||||
// them first, so that they fill in the currently-empty high bits and
|
||||
// everything else stays in the same position as before!
|
||||
let byte = 0;
|
||||
byte += hasPose(speciesId, colorId, "HAPPY", "MASCULINE") ? 1 : 0;
|
||||
byte <<= 1;
|
||||
byte += hasPose(speciesId, colorId, "SAD", "MASCULINE") ? 1 : 0;
|
||||
byte <<= 1;
|
||||
byte += hasPose(speciesId, colorId, "SICK", "MASCULINE") ? 1 : 0;
|
||||
byte <<= 1;
|
||||
byte += hasPose(speciesId, colorId, "HAPPY", "FEMININE") ? 1 : 0;
|
||||
byte += hasPose(speciesId, colorId, "SICK", "FEMININE") ? 1 : 0;
|
||||
byte <<= 1;
|
||||
byte += hasPose(speciesId, colorId, "SAD", "FEMININE") ? 1 : 0;
|
||||
byte <<= 1;
|
||||
byte += hasPose(speciesId, colorId, "SICK", "FEMININE") ? 1 : 0;
|
||||
byte += hasPose(speciesId, colorId, "HAPPY", "FEMININE") ? 1 : 0;
|
||||
byte <<= 1;
|
||||
byte += hasPose(speciesId, colorId, "SICK", "MASCULINE") ? 1 : 0;
|
||||
byte <<= 1;
|
||||
byte += hasPose(speciesId, colorId, "SAD", "MASCULINE") ? 1 : 0;
|
||||
byte <<= 1;
|
||||
byte += hasPose(speciesId, colorId, "HAPPY", "MASCULINE") ? 1 : 0;
|
||||
|
||||
buffer.writeUInt8(byte, speciesIndex * numColors + colorIndex);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue