Fix direction bits.
This commit is contained in:
parent
10aa79366a
commit
6b596cc766
@ -561,7 +561,7 @@ GAME.Const = {
|
||||
new MATH.Vec2(-2, -1),
|
||||
new MATH.Vec2(-1, 1),
|
||||
|
||||
new MATH.Vec2(1, 3),
|
||||
/*new MATH.Vec2(1, 3),
|
||||
new MATH.Vec2(2, 3),
|
||||
new MATH.Vec2(3, 2),
|
||||
new MATH.Vec2(3, 1),
|
||||
@ -572,7 +572,7 @@ GAME.Const = {
|
||||
new MATH.Vec2(-3, -2),
|
||||
new MATH.Vec2(-3, -1),
|
||||
new MATH.Vec2(-2, 1),
|
||||
new MATH.Vec2(-1, 2),
|
||||
new MATH.Vec2(-1, 2),*/
|
||||
],
|
||||
|
||||
MoveStatus: {
|
||||
@ -632,10 +632,10 @@ GAME.Const = {
|
||||
.add(8)
|
||||
.add(9)
|
||||
.add(11)
|
||||
.add(25)
|
||||
.add(26)
|
||||
.add(28)
|
||||
.add(29),
|
||||
.add(13)
|
||||
.add(14)
|
||||
.add(16)
|
||||
.add(17),
|
||||
/*new GAME.PieceMovement()
|
||||
.add(12)
|
||||
.add(13)
|
||||
@ -752,8 +752,8 @@ GAME.Const = {
|
||||
],
|
||||
|
||||
get_direction(direction_id) {
|
||||
let direction = GAME.Const.Direction[direction_id % 24].copy();
|
||||
direction.mul(Math.ceil((direction_id + 1) / 24));
|
||||
let direction = GAME.Const.Direction[direction_id % GAME.Const.Direction.length].copy();
|
||||
direction.mul(Math.ceil((direction_id + 1) / GAME.Const.Direction.length));
|
||||
return direction;
|
||||
},
|
||||
};
|
||||
|
@ -592,19 +592,11 @@ const INTERFACE = {
|
||||
}
|
||||
|
||||
hints(piece) {
|
||||
let descriptor = GAME.Const.Piece[piece.piece];
|
||||
let moves = piece.moves();
|
||||
//if(((piece.player ^ INTERFACE_DATA.player ^ INTERFACE_DATA.rotate) & 1) != 0) { moves = moves.rotate(); }
|
||||
moves = moves.direction;
|
||||
let movement = piece.moves();
|
||||
let moves = movement.direction;
|
||||
|
||||
for(let mask = BITWISE.lsb(moves); moves > 0; mask = BITWISE.lsb(moves)) {
|
||||
let move = BITWISE.ffs(mask);
|
||||
if(move >= 24) {
|
||||
move -= 24;
|
||||
} else if(move >= 12) {
|
||||
move = Math.floor((move - 12) / 2) + 6;
|
||||
}
|
||||
|
||||
let nmove = move % 12;
|
||||
|
||||
this.ctx.strokeStyle = (piece.player == GAME.Const.Player.Dawn)? INTERFACE.Color.Dawn : INTERFACE.Color.Dusk;
|
||||
|
@ -133,15 +133,15 @@ const BITWISE = {
|
||||
{
|
||||
const r1 = 0x00003F; // first 6 bits
|
||||
const r2 = 0x000FC0; // second 6 bits
|
||||
const r3 = 0xFFF000; // third 12 bits
|
||||
const r3 = 0x03F000; // third 6 bits
|
||||
|
||||
let v1 = (r1 & mask) << 3;
|
||||
let v2 = (r2 & mask) << 3;
|
||||
let v3 = (r3 & mask) << 6;
|
||||
let v3 = (r3 & mask) << 3;
|
||||
|
||||
v1 = (v1 & r1) | ((v1 & ~r1) >> 6);
|
||||
v2 = (v2 & r2) | ((v2 & ~r2) >> 6);
|
||||
v3 = (v3 & r3) | ((v3 & ~r3) >> 12);
|
||||
v3 = (v3 & r3) | ((v3 & ~r3) >> 6);
|
||||
|
||||
return v1 | v2 | v3;
|
||||
},
|
||||
|
Loading…
x
Reference in New Issue
Block a user