path_.js
// Lots of crazy unrolled JPS stuff
Lots of crazy unrolled JPS stuff
Lots of crazy unrolled JPS stuff
function jumpX(cost, xx, yy, dx) {
	let tmp = look(xx, yy + 1);
	let prevIteration = (tmp !== cost ? 0x01 : 0) | (tmp === Infinity ? 0x02 : 0);
	tmp = look(xx, yy - 1);
	prevIteration |= (tmp !== cost ? 0x04 : 0) | (tmp === Infinity ? 0x08 : 0);
	while (true) {
		let jumpCost = look(xx, yy);
		if (jumpCost === Infinity) {
			return;
		} else if (jumpCost !== cost) {
			return new WorldPosition(xx - dx, yy);
		} else if (checkDestination(xx, yy)) {
			return new WorldPosition(xx, yy);
		}
		let tmp = look(xx + dx, yy + 1);
		let thisIteration = (tmp !== cost ? 0 : 0x01) | (tmp === Infinity ? 0 : 0x02);
		if (prevIteration & thisIteration) {
			return new WorldPosition(xx, yy);
		}
		tmp = look(xx + dx, yy - 1);
		thisIteration |= (tmp !== cost ? 0 : 0x04) | (tmp === Infinity ? 0 : 0x08);
		if (prevIteration & thisIteration) {
			return new WorldPosition(xx, yy);
		}
		prevIteration = ~thisIteration;
		xx += dx;
	}
}
function jumpX ( cost , xx , yy , dx ) { let tmp = look ( xx , yy + 1 ) ; let prevIteration = ( tmp !== cost ? 0x01 : 0 ) | ( tmp === Infinity ? 0x02 : 0 ) ; tmp = look ( xx , yy - 1 ) ; prevIteration |= ( tmp !== cost ? 0x04 : 0 ) | ( tmp === Infinity ? 0x08 : 0 ) ; while ( true ) { let jumpCost = look ( xx , yy ) ; if ( jumpCost === Infinity ) { return ; } else if ( jumpCost !== cost ) { return new WorldPosition ( xx - dx , yy ) ; } else if ( checkDestination ( xx , yy ) ) { return new WorldPosition ( xx , yy ) ; } let tmp = look ( xx + dx , yy + 1 ) ; let thisIteration = ( tmp !== cost ? 0 : 0x01 ) | ( tmp === Infinity ? 0 : 0x02 ) ; if ( prevIteration & thisIteration ) { return new WorldPosition ( xx , yy ) ; } tmp = look ( xx + dx , yy - 1 ) ; thisIteration |= ( tmp !== cost ? 0 : 0x04 ) | ( tmp === Infinity ? 0 : 0x08 ) ; if ( prevIteration & thisIteration ) { return new WorldPosition ( xx , yy ) ; } prevIteration = ~ thisIteration ; xx += dx ; } }
Lots of crazy unrolled JPS stuff
Lots of crazy unrolled JPS stuff