Skip to content

Commit

Permalink
feat: no longer export NaivePathFinder intersects function
Browse files Browse the repository at this point in the history
  • Loading branch information
ultraviolet-jordan committed Apr 24, 2024
1 parent 6ffa89a commit 286b73a
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 95 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@2004scape/rsmod-pathfinder",
"version": "4.2.8",
"version": "4.2.9",
"description": "A breadth-first search path finder.",
"main": "dist/rsmod-pathfinder.js",
"types": "dist/rsmod-pathfinder.d.ts",
Expand Down
23 changes: 0 additions & 23 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -89,29 +89,6 @@ export function findNaivePath(
);
}

// prettier-ignore
export function intersects(
srcX: i32,
srcZ: i32,
srcWidth: i32,
srcHeight: i32,
destX: i32,
destZ: i32,
destWidth: i32,
destHeight: i32
): bool {
return naivePathfinder.intersects(
srcX,
srcZ,
srcWidth,
srcHeight,
destX,
destZ,
destWidth,
destHeight
);
}

export function changeFloor(x: i32, z: i32, level: i32, add: bool): void {
if (add) {
flags.add(x, z, level, CollisionFlag.FLOOR);
Expand Down
37 changes: 5 additions & 32 deletions src/rsmod.wat
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
(type $3 (func (param i32 i32 i32 i32)))
(type $4 (func (param i32 i32 i32) (result i32)))
(type $5 (func (param i32 i32)))
(type $6 (func (param i32 i32 i32 i32 i32 i32 i32 i32) (result i32)))
(type $7 (func (param i32 i32 i32 i32 i32)))
(type $8 (func (param i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32) (result i32)))
(type $6 (func (param i32 i32 i32 i32 i32)))
(type $7 (func (param i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32) (result i32)))
(type $8 (func (param i32 i32 i32 i32 i32 i32 i32 i32) (result i32)))
(type $9 (func))
(type $10 (func (param i32 i32 i32)))
(type $11 (func (param i32 i32 i32 i32 i32 i32 i32)))
Expand Down Expand Up @@ -248,7 +248,6 @@
(data $59 (i32.const 5980) "\1c\00\00\00\03\00\00\00\00\00\00\00\14\00\00\00\0c\00\00\00 \17\00\00\00\00\00\000\0f")
(export "findPath" (func $src/index/findPath@varargs))
(export "findNaivePath" (func $src/index/findNaivePath@varargs))
(export "intersects" (func $src/index/intersects))
(export "changeFloor" (func $src/index/changeFloor))
(export "changeLoc" (func $src/index/changeLoc))
(export "changeNpc" (func $src/index/changeNpc))
Expand Down Expand Up @@ -2242,7 +2241,7 @@
i32.const 1840
call $~lib/staticarray/StaticArray<~lib/string/String>#join
i32.const 3680
i32.const 543
i32.const 520
i32.const 9
call $~lib/builtins/abort
unreachable
Expand Down Expand Up @@ -39526,32 +39525,6 @@
local.get $10
call $src/index/findNaivePath
)
(func $src/index/intersects (param $0 i32) (param $1 i32) (param $2 i32) (param $3 i32) (param $4 i32) (param $5 i32) (param $6 i32) (param $7 i32) (result i32)
local.get $4
local.get $6
i32.add
local.get $0
i32.le_s
local.get $4
local.get $0
local.get $2
i32.add
i32.ge_s
i32.or
local.get $5
local.get $1
local.get $3
i32.add
i32.ge_s
i32.or
local.get $5
local.get $7
i32.add
local.get $1
i32.le_s
i32.or
i32.eqz
)
(func $src/rsmod/collision/CollisionFlagMap/CollisionFlagMap#allocateIfAbsent (param $0 i32) (param $1 i32) (param $2 i32) (param $3 i32) (result i32)
local.get $0
i32.load
Expand Down Expand Up @@ -56835,7 +56808,7 @@
i32.const 6000
call $~lib/staticarray/StaticArray<~lib/string/String>#join
i32.const 3680
i32.const 537
i32.const 514
i32.const 13
call $~lib/builtins/abort
unreachable
Expand Down
2 changes: 1 addition & 1 deletion src/rsmod/NaivePathFinder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ export default class NaivePathFinder {
* @param destHeight The end length on the Z axis.
*/
@inline
intersects(srcX: i32, srcZ: i32, srcWidth: i32, srcHeight: i32, destX: i32, destZ: i32, destWidth: i32, destHeight: i32): bool {
private intersects(srcX: i32, srcZ: i32, srcWidth: i32, srcHeight: i32, destX: i32, destZ: i32, destWidth: i32, destHeight: i32): bool {
const srcHorizontal: i32 = srcX + srcWidth;
const srcVertical: i32 = srcZ + srcHeight;
const destHorizontal: i32 = destX + destWidth;
Expand Down
38 changes: 0 additions & 38 deletions test/rsmod/NaivePathFinder.test.ts

This file was deleted.

0 comments on commit 286b73a

Please sign in to comment.