@quake2ts/shared 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/browser/index.global.js +2 -0
- package/dist/browser/index.global.js.map +1 -0
- package/dist/cjs/index.cjs +6569 -0
- package/dist/cjs/index.cjs.map +1 -0
- package/dist/esm/index.js +6200 -0
- package/dist/esm/index.js.map +1 -0
- package/dist/tsconfig.tsbuildinfo +1 -0
- package/dist/types/audio/constants.d.ts +24 -0
- package/dist/types/audio/constants.d.ts.map +1 -0
- package/dist/types/bsp/collision.d.ts +201 -0
- package/dist/types/bsp/collision.d.ts.map +1 -0
- package/dist/types/bsp/contents.d.ts +72 -0
- package/dist/types/bsp/contents.d.ts.map +1 -0
- package/dist/types/bsp/spatial.d.ts +13 -0
- package/dist/types/bsp/spatial.d.ts.map +1 -0
- package/dist/types/index.d.ts +38 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/inventory-helpers.d.ts +19 -0
- package/dist/types/inventory-helpers.d.ts.map +1 -0
- package/dist/types/io/binaryStream.d.ts +38 -0
- package/dist/types/io/binaryStream.d.ts.map +1 -0
- package/dist/types/io/binaryWriter.d.ts +26 -0
- package/dist/types/io/binaryWriter.d.ts.map +1 -0
- package/dist/types/io/index.d.ts +4 -0
- package/dist/types/io/index.d.ts.map +1 -0
- package/dist/types/io/messageBuilder.d.ts +21 -0
- package/dist/types/io/messageBuilder.d.ts.map +1 -0
- package/dist/types/items/ammo.d.ts +40 -0
- package/dist/types/items/ammo.d.ts.map +1 -0
- package/dist/types/items/index.d.ts +8 -0
- package/dist/types/items/index.d.ts.map +1 -0
- package/dist/types/items/powerups.d.ts +31 -0
- package/dist/types/items/powerups.d.ts.map +1 -0
- package/dist/types/items/weaponInfo.d.ts +5 -0
- package/dist/types/items/weaponInfo.d.ts.map +1 -0
- package/dist/types/items/weapons.d.ts +27 -0
- package/dist/types/items/weapons.d.ts.map +1 -0
- package/dist/types/math/angles.d.ts +19 -0
- package/dist/types/math/angles.d.ts.map +1 -0
- package/dist/types/math/anorms.d.ts +2 -0
- package/dist/types/math/anorms.d.ts.map +1 -0
- package/dist/types/math/color.d.ts +12 -0
- package/dist/types/math/color.d.ts.map +1 -0
- package/dist/types/math/mat4.d.ts +7 -0
- package/dist/types/math/mat4.d.ts.map +1 -0
- package/dist/types/math/random.d.ts +60 -0
- package/dist/types/math/random.d.ts.map +1 -0
- package/dist/types/math/vec3.d.ts +79 -0
- package/dist/types/math/vec3.d.ts.map +1 -0
- package/dist/types/net/driver.d.ts +10 -0
- package/dist/types/net/driver.d.ts.map +1 -0
- package/dist/types/net/index.d.ts +3 -0
- package/dist/types/net/index.d.ts.map +1 -0
- package/dist/types/net/netchan.d.ts +85 -0
- package/dist/types/net/netchan.d.ts.map +1 -0
- package/dist/types/pmove/apply.d.ts +5 -0
- package/dist/types/pmove/apply.d.ts.map +1 -0
- package/dist/types/pmove/categorize.d.ts +36 -0
- package/dist/types/pmove/categorize.d.ts.map +1 -0
- package/dist/types/pmove/config.d.ts +5 -0
- package/dist/types/pmove/config.d.ts.map +1 -0
- package/dist/types/pmove/constants.d.ts +76 -0
- package/dist/types/pmove/constants.d.ts.map +1 -0
- package/dist/types/pmove/currents.d.ts +58 -0
- package/dist/types/pmove/currents.d.ts.map +1 -0
- package/dist/types/pmove/dimensions.d.ts +14 -0
- package/dist/types/pmove/dimensions.d.ts.map +1 -0
- package/dist/types/pmove/duck.d.ts +39 -0
- package/dist/types/pmove/duck.d.ts.map +1 -0
- package/dist/types/pmove/fly.d.ts +34 -0
- package/dist/types/pmove/fly.d.ts.map +1 -0
- package/dist/types/pmove/index.d.ts +18 -0
- package/dist/types/pmove/index.d.ts.map +1 -0
- package/dist/types/pmove/jump.d.ts +28 -0
- package/dist/types/pmove/jump.d.ts.map +1 -0
- package/dist/types/pmove/move.d.ts +78 -0
- package/dist/types/pmove/move.d.ts.map +1 -0
- package/dist/types/pmove/pmove.d.ts +40 -0
- package/dist/types/pmove/pmove.d.ts.map +1 -0
- package/dist/types/pmove/slide.d.ts +63 -0
- package/dist/types/pmove/slide.d.ts.map +1 -0
- package/dist/types/pmove/snap.d.ts +40 -0
- package/dist/types/pmove/snap.d.ts.map +1 -0
- package/dist/types/pmove/special.d.ts +39 -0
- package/dist/types/pmove/special.d.ts.map +1 -0
- package/dist/types/pmove/stuck.d.ts +21 -0
- package/dist/types/pmove/stuck.d.ts.map +1 -0
- package/dist/types/pmove/types.d.ts +72 -0
- package/dist/types/pmove/types.d.ts.map +1 -0
- package/dist/types/pmove/view.d.ts +19 -0
- package/dist/types/pmove/view.d.ts.map +1 -0
- package/dist/types/pmove/water.d.ts +21 -0
- package/dist/types/pmove/water.d.ts.map +1 -0
- package/dist/types/protocol/bitpack.d.ts +17 -0
- package/dist/types/protocol/bitpack.d.ts.map +1 -0
- package/dist/types/protocol/configstrings.d.ts +73 -0
- package/dist/types/protocol/configstrings.d.ts.map +1 -0
- package/dist/types/protocol/constants.d.ts +36 -0
- package/dist/types/protocol/constants.d.ts.map +1 -0
- package/dist/types/protocol/contracts.d.ts +17 -0
- package/dist/types/protocol/contracts.d.ts.map +1 -0
- package/dist/types/protocol/crc.d.ts +5 -0
- package/dist/types/protocol/crc.d.ts.map +1 -0
- package/dist/types/protocol/cvar.d.ts +15 -0
- package/dist/types/protocol/cvar.d.ts.map +1 -0
- package/dist/types/protocol/effects.d.ts +33 -0
- package/dist/types/protocol/effects.d.ts.map +1 -0
- package/dist/types/protocol/entity.d.ts +46 -0
- package/dist/types/protocol/entity.d.ts.map +1 -0
- package/dist/types/protocol/entityEvent.d.ts +13 -0
- package/dist/types/protocol/entityEvent.d.ts.map +1 -0
- package/dist/types/protocol/entityState.d.ts +26 -0
- package/dist/types/protocol/entityState.d.ts.map +1 -0
- package/dist/types/protocol/index.d.ts +19 -0
- package/dist/types/protocol/index.d.ts.map +1 -0
- package/dist/types/protocol/layout.d.ts +9 -0
- package/dist/types/protocol/layout.d.ts.map +1 -0
- package/dist/types/protocol/ops.d.ts +44 -0
- package/dist/types/protocol/ops.d.ts.map +1 -0
- package/dist/types/protocol/player-state.d.ts +40 -0
- package/dist/types/protocol/player-state.d.ts.map +1 -0
- package/dist/types/protocol/player.d.ts +28 -0
- package/dist/types/protocol/player.d.ts.map +1 -0
- package/dist/types/protocol/renderFx.d.ts +23 -0
- package/dist/types/protocol/renderFx.d.ts.map +1 -0
- package/dist/types/protocol/stats.d.ts +61 -0
- package/dist/types/protocol/stats.d.ts.map +1 -0
- package/dist/types/protocol/tempEntity.d.ts +67 -0
- package/dist/types/protocol/tempEntity.d.ts.map +1 -0
- package/dist/types/protocol/usercmd.d.ts +33 -0
- package/dist/types/protocol/usercmd.d.ts.map +1 -0
- package/dist/types/protocol/writeUserCmd.d.ts +4 -0
- package/dist/types/protocol/writeUserCmd.d.ts.map +1 -0
- package/dist/types/replay/index.d.ts +3 -0
- package/dist/types/replay/index.d.ts.map +1 -0
- package/dist/types/replay/io.d.ts +7 -0
- package/dist/types/replay/io.d.ts.map +1 -0
- package/dist/types/replay/schema.d.ts +41 -0
- package/dist/types/replay/schema.d.ts.map +1 -0
- package/dist/types/testing.d.ts +6 -0
- package/dist/types/testing.d.ts.map +1 -0
- package/package.json +43 -0
- package/src/audio/constants.ts +35 -0
- package/src/bsp/collision.ts +1075 -0
- package/src/bsp/contents.ts +108 -0
- package/src/bsp/spatial.ts +116 -0
- package/src/index.ts +37 -0
- package/src/inventory-helpers.ts +81 -0
- package/src/io/binaryStream.ts +159 -0
- package/src/io/binaryWriter.ts +146 -0
- package/src/io/index.ts +3 -0
- package/src/io/messageBuilder.ts +117 -0
- package/src/items/ammo.ts +47 -0
- package/src/items/index.ts +8 -0
- package/src/items/powerups.ts +32 -0
- package/src/items/weaponInfo.ts +45 -0
- package/src/items/weapons.ts +28 -0
- package/src/math/angles.ts +135 -0
- package/src/math/anorms.ts +165 -0
- package/src/math/color.ts +42 -0
- package/src/math/mat4.ts +58 -0
- package/src/math/random.ts +182 -0
- package/src/math/vec3.ts +379 -0
- package/src/net/driver.ts +9 -0
- package/src/net/index.ts +2 -0
- package/src/net/netchan.ts +451 -0
- package/src/pmove/apply.ts +151 -0
- package/src/pmove/categorize.ts +162 -0
- package/src/pmove/config.ts +5 -0
- package/src/pmove/constants.ts +94 -0
- package/src/pmove/currents.ts +287 -0
- package/src/pmove/dimensions.ts +40 -0
- package/src/pmove/duck.ts +154 -0
- package/src/pmove/fly.ts +197 -0
- package/src/pmove/index.ts +18 -0
- package/src/pmove/jump.ts +92 -0
- package/src/pmove/move.ts +527 -0
- package/src/pmove/pmove.ts +446 -0
- package/src/pmove/slide.ts +267 -0
- package/src/pmove/snap.ts +89 -0
- package/src/pmove/special.ts +207 -0
- package/src/pmove/stuck.ts +258 -0
- package/src/pmove/types.ts +82 -0
- package/src/pmove/view.ts +57 -0
- package/src/pmove/water.ts +56 -0
- package/src/protocol/bitpack.ts +139 -0
- package/src/protocol/configstrings.ts +104 -0
- package/src/protocol/constants.ts +40 -0
- package/src/protocol/contracts.ts +149 -0
- package/src/protocol/crc.ts +32 -0
- package/src/protocol/cvar.ts +15 -0
- package/src/protocol/effects.ts +33 -0
- package/src/protocol/entity.ts +304 -0
- package/src/protocol/entityEvent.ts +14 -0
- package/src/protocol/entityState.ts +28 -0
- package/src/protocol/index.ts +19 -0
- package/src/protocol/layout.ts +9 -0
- package/src/protocol/ops.ts +49 -0
- package/src/protocol/player-state.ts +51 -0
- package/src/protocol/player.ts +165 -0
- package/src/protocol/renderFx.ts +22 -0
- package/src/protocol/stats.ts +161 -0
- package/src/protocol/tempEntity.ts +69 -0
- package/src/protocol/usercmd.ts +63 -0
- package/src/protocol/writeUserCmd.ts +30 -0
- package/src/replay/index.ts +2 -0
- package/src/replay/io.ts +37 -0
- package/src/replay/schema.ts +42 -0
- package/src/testing.ts +200 -0
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Mirrors the Quake II rerelease `water_level_t` enumeration from `game.h`
|
|
3
|
+
* (lines 443-449). These numeric values are relied upon throughout the
|
|
4
|
+
* movement code when checking how submerged a player is, so we keep the same
|
|
5
|
+
* ordering to make future porting work straightforward.
|
|
6
|
+
*/
|
|
7
|
+
export declare enum WaterLevel {
|
|
8
|
+
None = 0,
|
|
9
|
+
Feet = 1,
|
|
10
|
+
Waist = 2,
|
|
11
|
+
Under = 3
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Utility that matches the common rerelease checks that treat any level at or
|
|
15
|
+
* above the `WATER_WAIST` constant as "significantly submerged" for friction
|
|
16
|
+
* and current calculations.
|
|
17
|
+
*/
|
|
18
|
+
export declare function isAtLeastWaistDeep(level: WaterLevel): boolean;
|
|
19
|
+
/**
|
|
20
|
+
* Returns true when the player is considered underwater (the `WATER_UNDER`
|
|
21
|
+
* case in the rerelease). This mirrors the places in `p_move.cpp` that gate
|
|
22
|
+
* effects such as breath timers and screen warping.
|
|
23
|
+
*/
|
|
24
|
+
export declare function isUnderwater(level: WaterLevel): boolean;
|
|
25
|
+
/**
|
|
26
|
+
* Matches the Quake II rerelease `pmflags_t` bit layout from `game.h` so the
|
|
27
|
+
* shared helpers can manipulate the same flag words as the authoritative game
|
|
28
|
+
* and the client prediction layer.
|
|
29
|
+
*/
|
|
30
|
+
export declare const enum PmFlag {
|
|
31
|
+
Ducked = 1,
|
|
32
|
+
JumpHeld = 2,
|
|
33
|
+
OnGround = 4,
|
|
34
|
+
TimeWaterJump = 8,
|
|
35
|
+
TimeLand = 16,
|
|
36
|
+
TimeTeleport = 32,
|
|
37
|
+
NoPositionalPrediction = 64,
|
|
38
|
+
OnLadder = 128,
|
|
39
|
+
NoAngularPrediction = 256,
|
|
40
|
+
IgnorePlayerCollision = 512,
|
|
41
|
+
TimeTrick = 1024
|
|
42
|
+
}
|
|
43
|
+
export type PmFlags = number;
|
|
44
|
+
export declare function hasPmFlag(flags: PmFlags, flag: PmFlag): boolean;
|
|
45
|
+
export declare function addPmFlag(flags: PmFlags, flag: PmFlag): PmFlags;
|
|
46
|
+
export declare function removePmFlag(flags: PmFlags, flag: PmFlag): PmFlags;
|
|
47
|
+
/**
|
|
48
|
+
* Player movement types mirrored from the rerelease `pmtype_t` enumeration.
|
|
49
|
+
* The exact numeric values matter when syncing pmove state across the network
|
|
50
|
+
* so we keep the same order as the C++ definition.
|
|
51
|
+
*/
|
|
52
|
+
export declare enum PmType {
|
|
53
|
+
Normal = 0,
|
|
54
|
+
Grapple = 1,
|
|
55
|
+
NoClip = 2,
|
|
56
|
+
Spectator = 3,
|
|
57
|
+
Dead = 4,
|
|
58
|
+
Gib = 5,
|
|
59
|
+
Freeze = 6
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* Bitmask constants for the `buttons` field on the Quake II player command
|
|
63
|
+
* structure. These mirror the rerelease `BUTTON_*` definitions so logic such as
|
|
64
|
+
* jump/crouch checks can be shared between the server and client.
|
|
65
|
+
*/
|
|
66
|
+
export declare const enum PlayerButton {
|
|
67
|
+
None = 0,
|
|
68
|
+
Attack = 1,
|
|
69
|
+
Use = 2,
|
|
70
|
+
Holster = 4,
|
|
71
|
+
Jump = 8,
|
|
72
|
+
Crouch = 16,
|
|
73
|
+
Attack2 = 32,
|
|
74
|
+
Any = 128
|
|
75
|
+
}
|
|
76
|
+
//# sourceMappingURL=constants.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../src/pmove/constants.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,oBAAY,UAAU;IACpB,IAAI,IAAI;IACR,IAAI,IAAI;IACR,KAAK,IAAI;IACT,KAAK,IAAI;CACV;AAED;;;;GAIG;AACH,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,UAAU,GAAG,OAAO,CAE7D;AAED;;;;GAIG;AACH,wBAAgB,YAAY,CAAC,KAAK,EAAE,UAAU,GAAG,OAAO,CAEvD;AAED;;;;GAIG;AACH,0BAAkB,MAAM;IACtB,MAAM,IAAS;IACf,QAAQ,IAAS;IACjB,QAAQ,IAAS;IACjB,aAAa,IAAS;IACtB,QAAQ,KAAS;IACjB,YAAY,KAAS;IACrB,sBAAsB,KAAS;IAC/B,QAAQ,MAAS;IACjB,mBAAmB,MAAS;IAC5B,qBAAqB,MAAS;IAC9B,SAAS,OAAU;CACpB;AAED,MAAM,MAAM,OAAO,GAAG,MAAM,CAAC;AAE7B,wBAAgB,SAAS,CAAC,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAE/D;AAED,wBAAgB,SAAS,CAAC,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAE/D;AAED,wBAAgB,YAAY,CAAC,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAElE;AAED;;;;GAIG;AACH,oBAAY,MAAM;IAChB,MAAM,IAAI;IACV,OAAO,IAAI;IACX,MAAM,IAAI;IACV,SAAS,IAAI;IACb,IAAI,IAAI;IACR,GAAG,IAAI;IACP,MAAM,IAAI;CACX;AAED;;;;GAIG;AACH,0BAAkB,YAAY;IAC5B,IAAI,IAAI;IACR,MAAM,IAAS;IACf,GAAG,IAAS;IACZ,OAAO,IAAS;IAChB,IAAI,IAAS;IACb,MAAM,KAAS;IACf,OAAO,KAAS;IAChB,GAAG,MAAS;CACb"}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import type { ContentsFlag } from '../bsp/contents.js';
|
|
2
|
+
import { type Vec3 } from '../math/vec3.js';
|
|
3
|
+
import { WaterLevel } from './constants.js';
|
|
4
|
+
import type { PmoveCmd, PmoveTraceFn } from './types.js';
|
|
5
|
+
export interface WaterCurrentParams {
|
|
6
|
+
readonly watertype: ContentsFlag;
|
|
7
|
+
readonly waterlevel: WaterLevel;
|
|
8
|
+
readonly onGround: boolean;
|
|
9
|
+
readonly waterSpeed: number;
|
|
10
|
+
}
|
|
11
|
+
export interface GroundCurrentParams {
|
|
12
|
+
readonly groundContents: ContentsFlag;
|
|
13
|
+
readonly scale?: number;
|
|
14
|
+
}
|
|
15
|
+
export interface AddCurrentsParams {
|
|
16
|
+
readonly wishVelocity: Vec3;
|
|
17
|
+
readonly onLadder: boolean;
|
|
18
|
+
readonly onGround: boolean;
|
|
19
|
+
readonly waterlevel: WaterLevel;
|
|
20
|
+
readonly watertype: ContentsFlag;
|
|
21
|
+
readonly groundContents: ContentsFlag;
|
|
22
|
+
readonly cmd: PmoveCmd;
|
|
23
|
+
readonly viewPitch: number;
|
|
24
|
+
readonly maxSpeed: number;
|
|
25
|
+
readonly ladderMod: number;
|
|
26
|
+
readonly waterSpeed: number;
|
|
27
|
+
readonly forward: Vec3;
|
|
28
|
+
readonly origin: Vec3;
|
|
29
|
+
readonly mins: Vec3;
|
|
30
|
+
readonly maxs: Vec3;
|
|
31
|
+
readonly trace?: PmoveTraceFn;
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Mirrors the rerelease pattern in `p_move.cpp` (lines 730-765) that turns the
|
|
35
|
+
* directional CONTENTS_CURRENT_* flags into a unit-ish direction vector.
|
|
36
|
+
*/
|
|
37
|
+
export declare function currentVectorFromContents(contents: ContentsFlag): Vec3;
|
|
38
|
+
/**
|
|
39
|
+
* Computes the velocity contribution from water currents using the same rules
|
|
40
|
+
* as `PM_WaterMove`: the CONTENTS_CURRENT_* bits are turned into a direction
|
|
41
|
+
* vector, scaled by `pm_waterspeed`, and halved when the player only has their
|
|
42
|
+
* feet submerged while standing on solid ground.
|
|
43
|
+
*/
|
|
44
|
+
export declare function waterCurrentVelocity(params: WaterCurrentParams): Vec3;
|
|
45
|
+
/**
|
|
46
|
+
* Computes the conveyor-style velocity that should be applied while touching a
|
|
47
|
+
* ground plane that carries CONTENTS_CURRENT_* bits. The rerelease multiplies
|
|
48
|
+
* the direction vector by 100 units per second, so we expose the same default
|
|
49
|
+
* while allowing callers to override the scalar for tests.
|
|
50
|
+
*/
|
|
51
|
+
export declare function groundCurrentVelocity(params: GroundCurrentParams): Vec3;
|
|
52
|
+
/**
|
|
53
|
+
* Pure mirror of PM_AddCurrents from rerelease `p_move.cpp`: handles ladder
|
|
54
|
+
* specific motion tweaks, water currents, and conveyor-style ground currents
|
|
55
|
+
* before pmove acceleration is applied.
|
|
56
|
+
*/
|
|
57
|
+
export declare function applyPmoveAddCurrents(params: AddCurrentsParams): Vec3;
|
|
58
|
+
//# sourceMappingURL=currents.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"currents.d.ts","sourceRoot":"","sources":["../../../src/pmove/currents.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAWvD,OAAO,EAA2D,KAAK,IAAI,EAAE,MAAM,iBAAiB,CAAC;AACrG,OAAO,EAAgB,UAAU,EAAsB,MAAM,gBAAgB,CAAC;AAC9E,OAAO,KAAK,EAAE,QAAQ,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAEzD,MAAM,WAAW,kBAAkB;IACjC,QAAQ,CAAC,SAAS,EAAE,YAAY,CAAC;IACjC,QAAQ,CAAC,UAAU,EAAE,UAAU,CAAC;IAChC,QAAQ,CAAC,QAAQ,EAAE,OAAO,CAAC;IAC3B,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;CAC7B;AAED,MAAM,WAAW,mBAAmB;IAClC,QAAQ,CAAC,cAAc,EAAE,YAAY,CAAC;IACtC,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC;CACzB;AAED,MAAM,WAAW,iBAAiB;IAChC,QAAQ,CAAC,YAAY,EAAE,IAAI,CAAC;IAC5B,QAAQ,CAAC,QAAQ,EAAE,OAAO,CAAC;IAC3B,QAAQ,CAAC,QAAQ,EAAE,OAAO,CAAC;IAC3B,QAAQ,CAAC,UAAU,EAAE,UAAU,CAAC;IAChC,QAAQ,CAAC,SAAS,EAAE,YAAY,CAAC;IACjC,QAAQ,CAAC,cAAc,EAAE,YAAY,CAAC;IACtC,QAAQ,CAAC,GAAG,EAAE,QAAQ,CAAC;IACvB,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,OAAO,EAAE,IAAI,CAAC;IACvB,QAAQ,CAAC,MAAM,EAAE,IAAI,CAAC;IACtB,QAAQ,CAAC,IAAI,EAAE,IAAI,CAAC;IACpB,QAAQ,CAAC,IAAI,EAAE,IAAI,CAAC;IACpB,QAAQ,CAAC,KAAK,CAAC,EAAE,YAAY,CAAC;CAC/B;AAiBD;;;GAGG;AACH,wBAAgB,yBAAyB,CAAC,QAAQ,EAAE,YAAY,GAAG,IAAI,CA6BtE;AAED;;;;;GAKG;AACH,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,kBAAkB,GAAG,IAAI,CAkBrE;AAED;;;;;GAKG;AACH,wBAAgB,qBAAqB,CAAC,MAAM,EAAE,mBAAmB,GAAG,IAAI,CASvE;AAED;;;;GAIG;AACH,wBAAgB,qBAAqB,CAAC,MAAM,EAAE,iBAAiB,GAAG,IAAI,CAoDrE"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { Vec3 } from '../math/vec3.js';
|
|
2
|
+
import { type PmFlags, PmType } from './constants.js';
|
|
3
|
+
export interface PlayerDimensions {
|
|
4
|
+
readonly mins: Vec3;
|
|
5
|
+
readonly maxs: Vec3;
|
|
6
|
+
readonly viewheight: number;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* Pure mirror of PM_SetDimensions from rerelease `p_move.cpp`.
|
|
10
|
+
* Computes the mins/maxs/viewheight triplet for a player based on
|
|
11
|
+
* their movement type and ducked flag without mutating inputs.
|
|
12
|
+
*/
|
|
13
|
+
export declare function computePlayerDimensions(pmType: PmType, pmFlags: PmFlags): PlayerDimensions;
|
|
14
|
+
//# sourceMappingURL=dimensions.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dimensions.d.ts","sourceRoot":"","sources":["../../../src/pmove/dimensions.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAC;AAC5C,OAAO,EAAU,KAAK,OAAO,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AAE9D,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,CAAC,IAAI,EAAE,IAAI,CAAC;IACpB,QAAQ,CAAC,IAAI,EAAE,IAAI,CAAC;IACpB,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;CAC7B;AAMD;;;;GAIG;AACH,wBAAgB,uBAAuB,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,GAAG,gBAAgB,CAqB1F"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { type ContentsFlag } from '../bsp/contents.js';
|
|
2
|
+
import type { Vec3 } from '../math/vec3.js';
|
|
3
|
+
import { type PmFlags, PmType, WaterLevel } from './constants.js';
|
|
4
|
+
import type { PmoveTraceResult } from './types.js';
|
|
5
|
+
import { type PlayerDimensions } from './dimensions.js';
|
|
6
|
+
export interface DuckTraceParams {
|
|
7
|
+
readonly start: Vec3;
|
|
8
|
+
readonly end: Vec3;
|
|
9
|
+
readonly mins: Vec3;
|
|
10
|
+
readonly maxs: Vec3;
|
|
11
|
+
readonly mask: ContentsFlag;
|
|
12
|
+
}
|
|
13
|
+
export type DuckTraceFn = (params: DuckTraceParams) => PmoveTraceResult;
|
|
14
|
+
export interface CheckDuckParams {
|
|
15
|
+
readonly pmType: PmType;
|
|
16
|
+
readonly pmFlags: PmFlags;
|
|
17
|
+
readonly buttons: number;
|
|
18
|
+
readonly waterlevel: WaterLevel;
|
|
19
|
+
readonly hasGroundEntity: boolean;
|
|
20
|
+
readonly onLadder: boolean;
|
|
21
|
+
readonly n64Physics: boolean;
|
|
22
|
+
readonly origin: Vec3;
|
|
23
|
+
readonly mins: Vec3;
|
|
24
|
+
readonly maxs: Vec3;
|
|
25
|
+
readonly trace: DuckTraceFn;
|
|
26
|
+
}
|
|
27
|
+
export interface CheckDuckResult extends PlayerDimensions {
|
|
28
|
+
readonly pmFlags: PmFlags;
|
|
29
|
+
readonly ducked: boolean;
|
|
30
|
+
readonly changed: boolean;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Pure port of PM_CheckDuck from rerelease `p_move.cpp`. Updates the PMF_DUCKED flag
|
|
34
|
+
* based on crouch input, obstruction traces, and special cases (dead bodies) without
|
|
35
|
+
* mutating the provided mins/maxs. Returns the updated flag word plus the dimensions
|
|
36
|
+
* computed from PM_SetDimensions so callers can update collision bounds atomically.
|
|
37
|
+
*/
|
|
38
|
+
export declare function checkDuckState(params: CheckDuckParams): CheckDuckResult;
|
|
39
|
+
//# sourceMappingURL=duck.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"duck.d.ts","sourceRoot":"","sources":["../../../src/pmove/duck.ts"],"names":[],"mappings":"AAAA,OAAO,EAA0B,KAAK,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAC/E,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAC;AAC5C,OAAO,EAGL,KAAK,OAAO,EACZ,MAAM,EACN,UAAU,EAIX,MAAM,gBAAgB,CAAC;AACxB,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AACnD,OAAO,EAA2B,KAAK,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AAMjF,MAAM,WAAW,eAAe;IAC9B,QAAQ,CAAC,KAAK,EAAE,IAAI,CAAC;IACrB,QAAQ,CAAC,GAAG,EAAE,IAAI,CAAC;IACnB,QAAQ,CAAC,IAAI,EAAE,IAAI,CAAC;IACpB,QAAQ,CAAC,IAAI,EAAE,IAAI,CAAC;IACpB,QAAQ,CAAC,IAAI,EAAE,YAAY,CAAC;CAC7B;AAED,MAAM,MAAM,WAAW,GAAG,CAAC,MAAM,EAAE,eAAe,KAAK,gBAAgB,CAAC;AAExE,MAAM,WAAW,eAAe;IAC9B,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC;IAC1B,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,UAAU,EAAE,UAAU,CAAC;IAChC,QAAQ,CAAC,eAAe,EAAE,OAAO,CAAC;IAClC,QAAQ,CAAC,QAAQ,EAAE,OAAO,CAAC;IAC3B,QAAQ,CAAC,UAAU,EAAE,OAAO,CAAC;IAC7B,QAAQ,CAAC,MAAM,EAAE,IAAI,CAAC;IACtB,QAAQ,CAAC,IAAI,EAAE,IAAI,CAAC;IACpB,QAAQ,CAAC,IAAI,EAAE,IAAI,CAAC;IACpB,QAAQ,CAAC,KAAK,EAAE,WAAW,CAAC;CAC7B;AAED,MAAM,WAAW,eAAgB,SAAQ,gBAAgB;IACvD,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC;IAC1B,QAAQ,CAAC,MAAM,EAAE,OAAO,CAAC;IACzB,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC;CAC3B;AAED;;;;;GAKG;AACH,wBAAgB,cAAc,CAAC,MAAM,EAAE,eAAe,GAAG,eAAe,CA8BvE"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { type Vec3 } from '../math/vec3.js';
|
|
2
|
+
import { type StepSlideMoveOutcome } from './slide.js';
|
|
3
|
+
import type { PmoveCmd, PmoveTraceFn } from './types.js';
|
|
4
|
+
export interface FlyMoveParams {
|
|
5
|
+
readonly origin: Vec3;
|
|
6
|
+
readonly velocity: Vec3;
|
|
7
|
+
readonly cmd: PmoveCmd;
|
|
8
|
+
readonly forward: Vec3;
|
|
9
|
+
readonly right: Vec3;
|
|
10
|
+
readonly frametime: number;
|
|
11
|
+
readonly pmFriction: number;
|
|
12
|
+
readonly pmStopSpeed: number;
|
|
13
|
+
readonly pmMaxSpeed: number;
|
|
14
|
+
readonly pmAccelerate: number;
|
|
15
|
+
readonly pmWaterSpeed: number;
|
|
16
|
+
readonly doclip: boolean;
|
|
17
|
+
readonly mins?: Vec3;
|
|
18
|
+
readonly maxs?: Vec3;
|
|
19
|
+
readonly trace?: PmoveTraceFn;
|
|
20
|
+
readonly overbounce?: number;
|
|
21
|
+
readonly stepSize?: number;
|
|
22
|
+
readonly maxBumps?: number;
|
|
23
|
+
readonly maxClipPlanes?: number;
|
|
24
|
+
}
|
|
25
|
+
export type FlyMoveResult = StepSlideMoveOutcome;
|
|
26
|
+
/**
|
|
27
|
+
* Pure translation of PM_FlyMove from rerelease `p_move.cpp`: applies the
|
|
28
|
+
* spectator/noclip friction and acceleration rules, then either advances the
|
|
29
|
+
* origin freely or resolves movement through `stepSlideMove` when clipping is
|
|
30
|
+
* requested. This keeps the spectator and noclip physics deterministic between
|
|
31
|
+
* the client and server.
|
|
32
|
+
*/
|
|
33
|
+
export declare function applyPmoveFlyMove(params: FlyMoveParams): FlyMoveResult;
|
|
34
|
+
//# sourceMappingURL=fly.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fly.d.ts","sourceRoot":"","sources":["../../../src/pmove/fly.ts"],"names":[],"mappings":"AAAA,OAAO,EAAiD,KAAK,IAAI,EAAE,MAAM,iBAAiB,CAAC;AAG3F,OAAO,EAAiB,KAAK,oBAAoB,EAAE,MAAM,YAAY,CAAC;AACtE,OAAO,KAAK,EAAE,QAAQ,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAMzD,MAAM,WAAW,aAAa;IAC5B,QAAQ,CAAC,MAAM,EAAE,IAAI,CAAC;IACtB,QAAQ,CAAC,QAAQ,EAAE,IAAI,CAAC;IACxB,QAAQ,CAAC,GAAG,EAAE,QAAQ,CAAC;IACvB,QAAQ,CAAC,OAAO,EAAE,IAAI,CAAC;IACvB,QAAQ,CAAC,KAAK,EAAE,IAAI,CAAC;IACrB,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC;IAC9B,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC;IAC9B,QAAQ,CAAC,MAAM,EAAE,OAAO,CAAC;IACzB,QAAQ,CAAC,IAAI,CAAC,EAAE,IAAI,CAAC;IACrB,QAAQ,CAAC,IAAI,CAAC,EAAE,IAAI,CAAC;IACrB,QAAQ,CAAC,KAAK,CAAC,EAAE,YAAY,CAAC;IAC9B,QAAQ,CAAC,UAAU,CAAC,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,aAAa,CAAC,EAAE,MAAM,CAAC;CACjC;AAED,MAAM,MAAM,aAAa,GAAG,oBAAoB,CAAC;AAEjD;;;;;;GAMG;AACH,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,aAAa,GAAG,aAAa,CAwEtE"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export * from './apply.js';
|
|
2
|
+
export * from './categorize.js';
|
|
3
|
+
export * from './constants.js';
|
|
4
|
+
export * from './currents.js';
|
|
5
|
+
export * from './dimensions.js';
|
|
6
|
+
export * from './duck.js';
|
|
7
|
+
export * from './fly.js';
|
|
8
|
+
export * from './jump.js';
|
|
9
|
+
export * from './move.js';
|
|
10
|
+
export * from './pmove.js';
|
|
11
|
+
export * from './slide.js';
|
|
12
|
+
export * from './snap.js';
|
|
13
|
+
export * from './special.js';
|
|
14
|
+
export * from './stuck.js';
|
|
15
|
+
export * from './types.js';
|
|
16
|
+
export * from './view.js';
|
|
17
|
+
export * from './water.js';
|
|
18
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/pmove/index.ts"],"names":[],"mappings":"AACA,cAAc,YAAY,CAAC;AAC3B,cAAc,iBAAiB,CAAC;AAChC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,eAAe,CAAC;AAC9B,cAAc,iBAAiB,CAAC;AAChC,cAAc,WAAW,CAAC;AAC1B,cAAc,UAAU,CAAC;AACzB,cAAc,WAAW,CAAC;AAC1B,cAAc,WAAW,CAAC;AAC1B,cAAc,YAAY,CAAC;AAC3B,cAAc,YAAY,CAAC;AAC3B,cAAc,WAAW,CAAC;AAC1B,cAAc,cAAc,CAAC;AAC7B,cAAc,YAAY,CAAC;AAC3B,cAAc,YAAY,CAAC;AAC3B,cAAc,WAAW,CAAC;AAC1B,cAAc,YAAY,CAAC"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import type { Vec3 } from '../math/vec3.js';
|
|
2
|
+
import { WaterLevel, type PmFlags, PmType } from './constants.js';
|
|
3
|
+
export interface CheckJumpParams {
|
|
4
|
+
readonly pmFlags: PmFlags;
|
|
5
|
+
readonly pmType: PmType;
|
|
6
|
+
readonly buttons: number;
|
|
7
|
+
readonly waterlevel: WaterLevel;
|
|
8
|
+
readonly onGround: boolean;
|
|
9
|
+
readonly velocity: Vec3;
|
|
10
|
+
readonly origin: Vec3;
|
|
11
|
+
readonly jumpHeight?: number;
|
|
12
|
+
}
|
|
13
|
+
export interface CheckJumpResult {
|
|
14
|
+
readonly pmFlags: PmFlags;
|
|
15
|
+
readonly onGround: boolean;
|
|
16
|
+
readonly velocity: Vec3;
|
|
17
|
+
readonly origin: Vec3;
|
|
18
|
+
readonly jumpSound: boolean;
|
|
19
|
+
readonly jumped: boolean;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Pure translation of the rerelease `PM_CheckJump` helper from `p_move.cpp`.
|
|
23
|
+
* The function takes in the minimal pmove state that the original C++ logic
|
|
24
|
+
* touches and returns the updated flag/origin/velocity tuple so callers can
|
|
25
|
+
* apply the same semantics on both the server and client.
|
|
26
|
+
*/
|
|
27
|
+
export declare function checkJump(params: CheckJumpParams): CheckJumpResult;
|
|
28
|
+
//# sourceMappingURL=jump.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"jump.d.ts","sourceRoot":"","sources":["../../../src/pmove/jump.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAC;AAC5C,OAAO,EAAE,UAAU,EAAE,KAAK,OAAO,EAAU,MAAM,EAAyC,MAAM,gBAAgB,CAAC;AAIjH,MAAM,WAAW,eAAe;IAC9B,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC;IAC1B,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,UAAU,EAAE,UAAU,CAAC;IAChC,QAAQ,CAAC,QAAQ,EAAE,OAAO,CAAC;IAC3B,QAAQ,CAAC,QAAQ,EAAE,IAAI,CAAC;IACxB,QAAQ,CAAC,MAAM,EAAE,IAAI,CAAC;IACtB,QAAQ,CAAC,UAAU,CAAC,EAAE,MAAM,CAAC;CAC9B;AAED,MAAM,WAAW,eAAe;IAC9B,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC;IAC1B,QAAQ,CAAC,QAAQ,EAAE,OAAO,CAAC;IAC3B,QAAQ,CAAC,QAAQ,EAAE,IAAI,CAAC;IACxB,QAAQ,CAAC,MAAM,EAAE,IAAI,CAAC;IACtB,QAAQ,CAAC,SAAS,EAAE,OAAO,CAAC;IAC5B,QAAQ,CAAC,MAAM,EAAE,OAAO,CAAC;CAC1B;AAMD;;;;;GAKG;AACH,wBAAgB,SAAS,CAAC,MAAM,EAAE,eAAe,GAAG,eAAe,CAoDlE"}
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import type { Vec3 } from '../math/vec3.js';
|
|
2
|
+
import { type StepSlideMoveOutcome } from './slide.js';
|
|
3
|
+
import type { PmoveCmd, PmoveTraceFn } from './types.js';
|
|
4
|
+
import { type PmFlags, PmType, WaterLevel } from './constants.js';
|
|
5
|
+
interface BaseMoveParams {
|
|
6
|
+
readonly origin: Vec3;
|
|
7
|
+
readonly velocity: Vec3;
|
|
8
|
+
readonly frametime: number;
|
|
9
|
+
readonly mins: Vec3;
|
|
10
|
+
readonly maxs: Vec3;
|
|
11
|
+
readonly trace: PmoveTraceFn;
|
|
12
|
+
readonly overbounce?: number;
|
|
13
|
+
readonly stepSize?: number;
|
|
14
|
+
readonly maxBumps?: number;
|
|
15
|
+
readonly maxClipPlanes?: number;
|
|
16
|
+
readonly hasTime?: boolean;
|
|
17
|
+
}
|
|
18
|
+
export interface AirMoveParams extends BaseMoveParams {
|
|
19
|
+
readonly cmd: PmoveCmd;
|
|
20
|
+
readonly forward: Vec3;
|
|
21
|
+
readonly right: Vec3;
|
|
22
|
+
readonly pmFlags: PmFlags;
|
|
23
|
+
readonly onGround: boolean;
|
|
24
|
+
readonly gravity: number;
|
|
25
|
+
readonly pmType: PmType;
|
|
26
|
+
readonly pmAccelerate: number;
|
|
27
|
+
readonly pmAirAccelerate?: number;
|
|
28
|
+
readonly pmMaxSpeed: number;
|
|
29
|
+
readonly pmDuckSpeed: number;
|
|
30
|
+
readonly onLadder: boolean;
|
|
31
|
+
readonly waterlevel: WaterLevel;
|
|
32
|
+
readonly watertype: number;
|
|
33
|
+
readonly groundContents: number;
|
|
34
|
+
readonly viewPitch: number;
|
|
35
|
+
readonly ladderMod: number;
|
|
36
|
+
readonly pmWaterSpeed: number;
|
|
37
|
+
}
|
|
38
|
+
export interface WaterMoveParams extends BaseMoveParams {
|
|
39
|
+
readonly cmd: PmoveCmd;
|
|
40
|
+
readonly forward: Vec3;
|
|
41
|
+
readonly right: Vec3;
|
|
42
|
+
readonly pmFlags: PmFlags;
|
|
43
|
+
readonly onGround: boolean;
|
|
44
|
+
readonly pmMaxSpeed: number;
|
|
45
|
+
readonly pmDuckSpeed: number;
|
|
46
|
+
readonly pmWaterAccelerate: number;
|
|
47
|
+
readonly pmWaterSpeed: number;
|
|
48
|
+
readonly onLadder: boolean;
|
|
49
|
+
readonly watertype: number;
|
|
50
|
+
readonly groundContents: number;
|
|
51
|
+
readonly waterlevel: WaterLevel;
|
|
52
|
+
readonly viewPitch: number;
|
|
53
|
+
readonly ladderMod: number;
|
|
54
|
+
}
|
|
55
|
+
export interface WalkMoveParams extends BaseMoveParams {
|
|
56
|
+
readonly cmd: PmoveCmd;
|
|
57
|
+
readonly forward: Vec3;
|
|
58
|
+
readonly right: Vec3;
|
|
59
|
+
readonly pmFlags: PmFlags;
|
|
60
|
+
readonly onGround: boolean;
|
|
61
|
+
readonly gravity: number;
|
|
62
|
+
readonly pmType: PmType;
|
|
63
|
+
readonly pmAccelerate: number;
|
|
64
|
+
readonly pmMaxSpeed: number;
|
|
65
|
+
readonly pmDuckSpeed: number;
|
|
66
|
+
readonly onLadder: boolean;
|
|
67
|
+
readonly waterlevel: WaterLevel;
|
|
68
|
+
readonly watertype: number;
|
|
69
|
+
readonly groundContents: number;
|
|
70
|
+
readonly viewPitch: number;
|
|
71
|
+
readonly ladderMod: number;
|
|
72
|
+
readonly pmWaterSpeed: number;
|
|
73
|
+
}
|
|
74
|
+
export declare function applyPmoveAirMove(params: AirMoveParams): StepSlideMoveOutcome;
|
|
75
|
+
export declare function applyPmoveWaterMove(params: WaterMoveParams): StepSlideMoveOutcome;
|
|
76
|
+
export declare function applyPmoveWalkMove(params: WalkMoveParams): StepSlideMoveOutcome;
|
|
77
|
+
export {};
|
|
78
|
+
//# sourceMappingURL=move.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"move.d.ts","sourceRoot":"","sources":["../../../src/pmove/move.ts"],"names":[],"mappings":"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"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import type { Vec3 } from '../math/vec3.js';
|
|
2
|
+
import type { PmoveAccelerateParams, PmoveCmd, PmoveFrictionParams, PmoveWishParams, PmoveWishResult, PmoveState, PmoveImports } from './types.js';
|
|
3
|
+
/**
|
|
4
|
+
* Pure version of PM_Friction from rerelease p_move.cpp.
|
|
5
|
+
* Handles ground and water friction and returns a new velocity.
|
|
6
|
+
*/
|
|
7
|
+
export declare function applyPmoveFriction(params: PmoveFrictionParams): Vec3;
|
|
8
|
+
/**
|
|
9
|
+
* Pure version of PM_Accelerate from rerelease p_move.cpp.
|
|
10
|
+
* Returns a new velocity with wishdir/wishspeed acceleration applied.
|
|
11
|
+
*/
|
|
12
|
+
export declare function applyPmoveAccelerate(params: PmoveAccelerateParams): Vec3;
|
|
13
|
+
/**
|
|
14
|
+
* Mirrors PM_AirAccelerate in rerelease `p_move.cpp` (lines ~612-636): wishspeed is clamped
|
|
15
|
+
* to 30 for the addspeed calculation but the acceleration magnitude still uses the full wishspeed.
|
|
16
|
+
*/
|
|
17
|
+
export declare function applyPmoveAirAccelerate(params: PmoveAccelerateParams): Vec3;
|
|
18
|
+
/**
|
|
19
|
+
* Pure mirror of PM_CmdScale from rerelease `p_move.cpp`. Computes the scalar applied to
|
|
20
|
+
* the command directional inputs so that the resulting wish velocity caps at `maxSpeed`
|
|
21
|
+
* regardless of the directional mix.
|
|
22
|
+
*/
|
|
23
|
+
export declare function pmoveCmdScale(cmd: PmoveCmd, maxSpeed: number): number;
|
|
24
|
+
/**
|
|
25
|
+
* Computes wishdir/wishspeed for ground/air movement as done in PM_AirMove and
|
|
26
|
+
* PM_GroundMove. Z is forced to zero and wishspeed is clamped to maxSpeed, matching
|
|
27
|
+
* the rerelease p_move.cpp helpers before they call PM_Accelerate/PM_AirAccelerate.
|
|
28
|
+
*/
|
|
29
|
+
export declare function buildAirGroundWish(params: PmoveWishParams): PmoveWishResult;
|
|
30
|
+
/**
|
|
31
|
+
* Computes the wishdir/wishspeed mix for water movement, matching PM_WaterMove in
|
|
32
|
+
* rerelease p_move.cpp: includes the upward bias when no strong upmove is requested,
|
|
33
|
+
* clamps wishspeed to maxSpeed, and halves the returned wishspeed before acceleration.
|
|
34
|
+
*/
|
|
35
|
+
export declare function buildWaterWish(params: PmoveWishParams): PmoveWishResult;
|
|
36
|
+
/**
|
|
37
|
+
* Runs the full player movement simulation for a single frame.
|
|
38
|
+
*/
|
|
39
|
+
export declare function runPmove(state: PmoveState, imports: PmoveImports): PmoveState;
|
|
40
|
+
//# sourceMappingURL=pmove.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pmove.d.ts","sourceRoot":"","sources":["../../../src/pmove/pmove.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAC;AAG5C,OAAO,KAAK,EACV,qBAAqB,EACrB,QAAQ,EACR,mBAAmB,EACnB,eAAe,EACf,eAAe,EACf,UAAU,EACV,YAAY,EAEb,MAAM,YAAY,CAAC;AAUpB;;;GAGG;AACH,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,mBAAmB,GAAG,IAAI,CA6CpE;AAED;;;GAGG;AACH,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,qBAAqB,GAAG,IAAI,CAoBxE;AAED;;;GAGG;AACH,wBAAgB,uBAAuB,CAAC,MAAM,EAAE,qBAAqB,GAAG,IAAI,CAqB3E;AAED;;;;GAIG;AACH,wBAAgB,aAAa,CAAC,GAAG,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,GAAG,MAAM,CAYrE;AAED;;;;GAIG;AACH,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,eAAe,GAAG,eAAe,CAoB3E;AAED;;;;GAIG;AACH,wBAAgB,cAAc,CAAC,MAAM,EAAE,eAAe,GAAG,eAAe,CAqCvE;AAED;;GAEG;AACH,wBAAgB,QAAQ,CAAC,KAAK,EAAE,UAAU,EAAE,OAAO,EAAE,YAAY,GAAG,UAAU,CAkO7E"}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { type Vec3 } from '../math/vec3.js';
|
|
2
|
+
import type { PmoveTraceFn } from './types.js';
|
|
3
|
+
export declare const SLIDEMOVE_BLOCKED_FLOOR = 1;
|
|
4
|
+
export declare const SLIDEMOVE_BLOCKED_WALL = 2;
|
|
5
|
+
export interface SlideMoveResult {
|
|
6
|
+
readonly velocity: Vec3;
|
|
7
|
+
readonly planes: readonly Vec3[];
|
|
8
|
+
readonly stopped: boolean;
|
|
9
|
+
}
|
|
10
|
+
export interface SlideMoveParams {
|
|
11
|
+
readonly origin: Vec3;
|
|
12
|
+
readonly velocity: Vec3;
|
|
13
|
+
readonly frametime: number;
|
|
14
|
+
readonly overbounce: number;
|
|
15
|
+
readonly trace: PmoveTraceFn;
|
|
16
|
+
readonly maxBumps?: number;
|
|
17
|
+
readonly maxClipPlanes?: number;
|
|
18
|
+
readonly mins?: Vec3;
|
|
19
|
+
readonly maxs?: Vec3;
|
|
20
|
+
/**
|
|
21
|
+
* Mirrors the pm->s.pm_time check in PM_StepSlideMove_Generic: if true, the
|
|
22
|
+
* returned velocity is reset to the primal velocity after collision
|
|
23
|
+
* resolution so time-based effects (like knockbacks) don't dampen.
|
|
24
|
+
*/
|
|
25
|
+
readonly hasTime?: boolean;
|
|
26
|
+
}
|
|
27
|
+
export interface SlideMoveOutcome extends SlideMoveResult {
|
|
28
|
+
readonly origin: Vec3;
|
|
29
|
+
readonly blocked: number;
|
|
30
|
+
}
|
|
31
|
+
export interface StepSlideMoveParams extends SlideMoveParams {
|
|
32
|
+
readonly mins: Vec3;
|
|
33
|
+
readonly maxs: Vec3;
|
|
34
|
+
readonly stepSize?: number;
|
|
35
|
+
}
|
|
36
|
+
export interface StepSlideMoveOutcome extends SlideMoveOutcome {
|
|
37
|
+
readonly stepped: boolean;
|
|
38
|
+
readonly stepHeight: number;
|
|
39
|
+
readonly stepNormal?: Vec3;
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Resolves a sequence of collision planes against a primal velocity using the same
|
|
43
|
+
* plane iteration logic seen in PM_StepSlideMove_Generic (rerelease p_move.cpp).
|
|
44
|
+
* The incoming planes should be ordered as they were encountered during traces;
|
|
45
|
+
* the function will accumulate them, clip the velocity to be parallel to all planes,
|
|
46
|
+
* and return zero velocity when three planes form an unresolvable corner or when
|
|
47
|
+
* the adjusted velocity would oppose the primal direction.
|
|
48
|
+
*/
|
|
49
|
+
export declare function resolveSlideMove(initialVelocity: Vec3, planesEncountered: readonly Vec3[], overbounce: number, maxClipPlanes?: number, primalVelocity?: Vec3): SlideMoveResult;
|
|
50
|
+
/**
|
|
51
|
+
* Pure mirror of PM_SlideMoveGeneric from rerelease `p_move.cpp` (minus gravity/step handling).
|
|
52
|
+
* Uses a caller-provided trace to collect collision planes, accumulates them through
|
|
53
|
+
* `resolveSlideMove`, and returns the resulting origin/velocity/blocking state.
|
|
54
|
+
*/
|
|
55
|
+
export declare function slideMove(params: SlideMoveParams): SlideMoveOutcome;
|
|
56
|
+
/**
|
|
57
|
+
* Mirrors PM_StepSlideMove (rerelease p_move.cpp) in a pure form: attempts a
|
|
58
|
+
* regular slide move, then retries from a stepped-up position when the first
|
|
59
|
+
* attempt was blocked. The function compares planar distance traveled and the
|
|
60
|
+
* steepness of the landing plane to decide whether to keep the step.
|
|
61
|
+
*/
|
|
62
|
+
export declare function stepSlideMove(params: StepSlideMoveParams): StepSlideMoveOutcome;
|
|
63
|
+
//# sourceMappingURL=slide.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"slide.d.ts","sourceRoot":"","sources":["../../../src/pmove/slide.ts"],"names":[],"mappings":"AAAA,OAAO,EAAuE,KAAK,IAAI,EAAE,MAAM,iBAAiB,CAAC;AACjH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAO/C,eAAO,MAAM,uBAAuB,IAAI,CAAC;AACzC,eAAO,MAAM,sBAAsB,IAAI,CAAC;AAExC,MAAM,WAAW,eAAe;IAC9B,QAAQ,CAAC,QAAQ,EAAE,IAAI,CAAC;IACxB,QAAQ,CAAC,MAAM,EAAE,SAAS,IAAI,EAAE,CAAC;IACjC,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC;CAC3B;AAED,MAAM,WAAW,eAAe;IAC9B,QAAQ,CAAC,MAAM,EAAE,IAAI,CAAC;IACtB,QAAQ,CAAC,QAAQ,EAAE,IAAI,CAAC;IACxB,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,KAAK,EAAE,YAAY,CAAC;IAC7B,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,aAAa,CAAC,EAAE,MAAM,CAAC;IAChC,QAAQ,CAAC,IAAI,CAAC,EAAE,IAAI,CAAC;IACrB,QAAQ,CAAC,IAAI,CAAC,EAAE,IAAI,CAAC;IACrB;;;;OAIG;IACH,QAAQ,CAAC,OAAO,CAAC,EAAE,OAAO,CAAC;CAC5B;AAED,MAAM,WAAW,gBAAiB,SAAQ,eAAe;IACvD,QAAQ,CAAC,MAAM,EAAE,IAAI,CAAC;IACtB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;CAC1B;AAED,MAAM,WAAW,mBAAoB,SAAQ,eAAe;IAC1D,QAAQ,CAAC,IAAI,EAAE,IAAI,CAAC;IACpB,QAAQ,CAAC,IAAI,EAAE,IAAI,CAAC;IACpB,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;CAC5B;AAED,MAAM,WAAW,oBAAqB,SAAQ,gBAAgB;IAC5D,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC;IAC1B,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,UAAU,CAAC,EAAE,IAAI,CAAC;CAC5B;AAED;;;;;;;GAOG;AACH,wBAAgB,gBAAgB,CAC9B,eAAe,EAAE,IAAI,EACrB,iBAAiB,EAAE,SAAS,IAAI,EAAE,EAClC,UAAU,EAAE,MAAM,EAClB,aAAa,SAA0B,EACvC,cAAc,GAAE,IAAsB,GACrC,eAAe,CA0DjB;AAED;;;;GAIG;AACH,wBAAgB,SAAS,CAAC,MAAM,EAAE,eAAe,GAAG,gBAAgB,CA8EnE;AAED;;;;;GAKG;AACH,wBAAgB,aAAa,CAAC,MAAM,EAAE,mBAAmB,GAAG,oBAAoB,CAiD/E"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import type { Vec3 } from '../math/vec3.js';
|
|
2
|
+
import type { PmoveTraceFn } from './types.js';
|
|
3
|
+
export interface GoodPositionParams {
|
|
4
|
+
readonly origin: Vec3;
|
|
5
|
+
readonly mins: Vec3;
|
|
6
|
+
readonly maxs: Vec3;
|
|
7
|
+
readonly trace: PmoveTraceFn;
|
|
8
|
+
}
|
|
9
|
+
export declare function goodPosition(params: GoodPositionParams): boolean;
|
|
10
|
+
export type SnapResolution = 'unchanged' | 'fixed' | 'reverted';
|
|
11
|
+
export interface SnapPositionParams extends GoodPositionParams {
|
|
12
|
+
readonly velocity: Vec3;
|
|
13
|
+
readonly previousOrigin: Vec3;
|
|
14
|
+
}
|
|
15
|
+
export interface SnapPositionResult {
|
|
16
|
+
readonly origin: Vec3;
|
|
17
|
+
readonly velocity: Vec3;
|
|
18
|
+
readonly resolution: SnapResolution;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Pure translation of PM_SnapPosition from rerelease `p_move.cpp`.
|
|
22
|
+
* Attempts to keep the caller's origin in a valid location by first
|
|
23
|
+
* checking the current origin against collision traces, then falling
|
|
24
|
+
* back to the shared `fixStuckObjectGeneric` helper before finally
|
|
25
|
+
* reverting to the provided previous origin when no fix is possible.
|
|
26
|
+
*/
|
|
27
|
+
export declare function snapPosition(params: SnapPositionParams): SnapPositionResult;
|
|
28
|
+
export interface InitialSnapPositionParams extends GoodPositionParams {
|
|
29
|
+
}
|
|
30
|
+
export interface InitialSnapPositionResult {
|
|
31
|
+
readonly origin: Vec3;
|
|
32
|
+
readonly snapped: boolean;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Pure translation of PM_InitialSnapPosition from rerelease `p_move.cpp`.
|
|
36
|
+
* Tries a 3x3x3 grid of +/-1 unit offsets around the base origin to find
|
|
37
|
+
* a valid collision-free spot, mirroring the search order of the C++ code.
|
|
38
|
+
*/
|
|
39
|
+
export declare function initialSnapPosition(params: InitialSnapPositionParams): InitialSnapPositionResult;
|
|
40
|
+
//# sourceMappingURL=snap.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"snap.d.ts","sourceRoot":"","sources":["../../../src/pmove/snap.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAC;AAE5C,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAI/C,MAAM,WAAW,kBAAkB;IACjC,QAAQ,CAAC,MAAM,EAAE,IAAI,CAAC;IACtB,QAAQ,CAAC,IAAI,EAAE,IAAI,CAAC;IACpB,QAAQ,CAAC,IAAI,EAAE,IAAI,CAAC;IACpB,QAAQ,CAAC,KAAK,EAAE,YAAY,CAAC;CAC9B;AAED,wBAAgB,YAAY,CAAC,MAAM,EAAE,kBAAkB,GAAG,OAAO,CAIhE;AAED,MAAM,MAAM,cAAc,GAAG,WAAW,GAAG,OAAO,GAAG,UAAU,CAAC;AAEhE,MAAM,WAAW,kBAAmB,SAAQ,kBAAkB;IAC5D,QAAQ,CAAC,QAAQ,EAAE,IAAI,CAAC;IACxB,QAAQ,CAAC,cAAc,EAAE,IAAI,CAAC;CAC/B;AAED,MAAM,WAAW,kBAAkB;IACjC,QAAQ,CAAC,MAAM,EAAE,IAAI,CAAC;IACtB,QAAQ,CAAC,QAAQ,EAAE,IAAI,CAAC;IACxB,QAAQ,CAAC,UAAU,EAAE,cAAc,CAAC;CACrC;AAED;;;;;;GAMG;AACH,wBAAgB,YAAY,CAAC,MAAM,EAAE,kBAAkB,GAAG,kBAAkB,CAmB3E;AAED,MAAM,WAAW,yBAA0B,SAAQ,kBAAkB;CAAG;AAExE,MAAM,WAAW,yBAAyB;IACxC,QAAQ,CAAC,MAAM,EAAE,IAAI,CAAC;IACtB,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC;CAC3B;AAED;;;;GAIG;AACH,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,yBAAyB,GAAG,yBAAyB,CAgBhG"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { type Vec3 } from '../math/vec3.js';
|
|
2
|
+
import { type PmFlags, WaterLevel } from './constants.js';
|
|
3
|
+
import type { PmoveCmd, PmovePointContentsFn, PmoveTraceFn } from './types.js';
|
|
4
|
+
export interface SpecialMovementParams {
|
|
5
|
+
readonly pmFlags: PmFlags;
|
|
6
|
+
readonly pmTime: number;
|
|
7
|
+
readonly waterlevel: WaterLevel;
|
|
8
|
+
readonly watertype: number;
|
|
9
|
+
readonly gravity: number;
|
|
10
|
+
readonly cmd: PmoveCmd;
|
|
11
|
+
readonly forward: Vec3;
|
|
12
|
+
readonly origin: Vec3;
|
|
13
|
+
readonly velocity: Vec3;
|
|
14
|
+
readonly mins: Vec3;
|
|
15
|
+
readonly maxs: Vec3;
|
|
16
|
+
readonly viewheight: number;
|
|
17
|
+
readonly trace: PmoveTraceFn;
|
|
18
|
+
readonly pointContents: PmovePointContentsFn;
|
|
19
|
+
readonly onGround: boolean;
|
|
20
|
+
readonly overbounce?: number;
|
|
21
|
+
readonly stepSize?: number;
|
|
22
|
+
readonly maxBumps?: number;
|
|
23
|
+
readonly maxClipPlanes?: number;
|
|
24
|
+
}
|
|
25
|
+
export interface SpecialMovementResult {
|
|
26
|
+
readonly pmFlags: PmFlags;
|
|
27
|
+
readonly pmTime: number;
|
|
28
|
+
readonly velocity: Vec3;
|
|
29
|
+
readonly performedWaterJump: boolean;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Mirrors the ladder detection and water-jump probing logic from
|
|
33
|
+
* `PM_CheckSpecialMovement` in `rerelease/p_move.cpp`. The helper clears and
|
|
34
|
+
* re-adds the ladder flag based on nearby CONTENTS_LADDER brushes, then
|
|
35
|
+
* simulates a potential water jump by firing the same 40-unit probe and
|
|
36
|
+
* step-slide loop the C++ uses before committing to the upward velocity.
|
|
37
|
+
*/
|
|
38
|
+
export declare function checkSpecialMovement(params: SpecialMovementParams): SpecialMovementResult;
|
|
39
|
+
//# sourceMappingURL=special.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"special.d.ts","sourceRoot":"","sources":["../../../src/pmove/special.ts"],"names":[],"mappings":"AACA,OAAO,EAAwD,KAAK,IAAI,EAAE,MAAM,iBAAiB,CAAC;AAClG,OAAO,EAAwB,KAAK,OAAO,EAA2B,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAEzG,OAAO,KAAK,EAAE,QAAQ,EAAE,oBAAoB,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAgB/E,MAAM,WAAW,qBAAqB;IACpC,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC;IAC1B,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,UAAU,EAAE,UAAU,CAAC;IAChC,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,GAAG,EAAE,QAAQ,CAAC;IACvB,QAAQ,CAAC,OAAO,EAAE,IAAI,CAAC;IACvB,QAAQ,CAAC,MAAM,EAAE,IAAI,CAAC;IACtB,QAAQ,CAAC,QAAQ,EAAE,IAAI,CAAC;IACxB,QAAQ,CAAC,IAAI,EAAE,IAAI,CAAC;IACpB,QAAQ,CAAC,IAAI,EAAE,IAAI,CAAC;IACpB,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,KAAK,EAAE,YAAY,CAAC;IAC7B,QAAQ,CAAC,aAAa,EAAE,oBAAoB,CAAC;IAC7C,QAAQ,CAAC,QAAQ,EAAE,OAAO,CAAC;IAC3B,QAAQ,CAAC,UAAU,CAAC,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,aAAa,CAAC,EAAE,MAAM,CAAC;CACjC;AAED,MAAM,WAAW,qBAAqB;IACpC,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC;IAC1B,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,QAAQ,EAAE,IAAI,CAAC;IACxB,QAAQ,CAAC,kBAAkB,EAAE,OAAO,CAAC;CACtC;AAED;;;;;;GAMG;AACH,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,qBAAqB,GAAG,qBAAqB,CA0IzF"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { type Vec3 } from '../math/vec3.js';
|
|
2
|
+
import type { PmoveTraceResult } from './types.js';
|
|
3
|
+
export interface FixStuckParams {
|
|
4
|
+
readonly origin: Vec3;
|
|
5
|
+
readonly mins: Vec3;
|
|
6
|
+
readonly maxs: Vec3;
|
|
7
|
+
readonly trace: FixStuckTraceFn;
|
|
8
|
+
}
|
|
9
|
+
export type FixStuckResult = 'good-position' | 'fixed' | 'no-good-position';
|
|
10
|
+
export interface FixStuckOutcome {
|
|
11
|
+
readonly result: FixStuckResult;
|
|
12
|
+
readonly origin: Vec3;
|
|
13
|
+
}
|
|
14
|
+
export type FixStuckTraceFn = (start: Vec3, mins: Vec3, maxs: Vec3, end: Vec3) => PmoveTraceResult;
|
|
15
|
+
/**
|
|
16
|
+
* TypeScript port of G_FixStuckObject_Generic from rerelease p_move.cpp. Attempts to
|
|
17
|
+
* nudge a stuck bounding box out of solid space by probing the faces of the box and
|
|
18
|
+
* moving towards the opposite side, keeping the smallest successful displacement.
|
|
19
|
+
*/
|
|
20
|
+
export declare function fixStuckObjectGeneric(params: FixStuckParams): FixStuckOutcome;
|
|
21
|
+
//# sourceMappingURL=stuck.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"stuck.d.ts","sourceRoot":"","sources":["../../../src/pmove/stuck.ts"],"names":[],"mappings":"AAAA,OAAO,EAKL,KAAK,IAAI,EACV,MAAM,iBAAiB,CAAC;AACzB,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAuBnD,MAAM,WAAW,cAAc;IAC7B,QAAQ,CAAC,MAAM,EAAE,IAAI,CAAC;IACtB,QAAQ,CAAC,IAAI,EAAE,IAAI,CAAC;IACpB,QAAQ,CAAC,IAAI,EAAE,IAAI,CAAC;IACpB,QAAQ,CAAC,KAAK,EAAE,eAAe,CAAC;CACjC;AAED,MAAM,MAAM,cAAc,GAAG,eAAe,GAAG,OAAO,GAAG,kBAAkB,CAAC;AAE5E,MAAM,WAAW,eAAe;IAC9B,QAAQ,CAAC,MAAM,EAAE,cAAc,CAAC;IAChC,QAAQ,CAAC,MAAM,EAAE,IAAI,CAAC;CACvB;AAED,MAAM,MAAM,eAAe,GAAG,CAC5B,KAAK,EAAE,IAAI,EACX,IAAI,EAAE,IAAI,EACV,IAAI,EAAE,IAAI,EACV,GAAG,EAAE,IAAI,KACN,gBAAgB,CAAC;AA2HtB;;;;GAIG;AACH,wBAAgB,qBAAqB,CAAC,MAAM,EAAE,cAAc,GAAG,eAAe,CAgF7E"}
|