@quake2ts/cgame 0.0.739
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 +10 -0
- package/dist/browser/index.global.js.map +1 -0
- package/dist/cjs/index.cjs +947 -0
- package/dist/cjs/index.cjs.map +1 -0
- package/dist/esm/index.js +940 -0
- package/dist/esm/index.js.map +1 -0
- package/dist/index.cjs +1353 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +202 -0
- package/dist/index.d.ts +202 -0
- package/dist/index.js +1346 -0
- package/dist/index.js.map +1 -0
- package/dist/tsconfig.tsbuildinfo +1 -0
- package/dist/types/hud/blends.d.ts +4 -0
- package/dist/types/hud/blends.d.ts.map +1 -0
- package/dist/types/hud/crosshair.d.ts +7 -0
- package/dist/types/hud/crosshair.d.ts.map +1 -0
- package/dist/types/hud/damage.d.ts +5 -0
- package/dist/types/hud/damage.d.ts.map +1 -0
- package/dist/types/hud/diagnostics.d.ts +3 -0
- package/dist/types/hud/diagnostics.d.ts.map +1 -0
- package/dist/types/hud/icons.d.ts +12 -0
- package/dist/types/hud/icons.d.ts.map +1 -0
- package/dist/types/hud/layout.d.ts +30 -0
- package/dist/types/hud/layout.d.ts.map +1 -0
- package/dist/types/hud/messages.d.ts +15 -0
- package/dist/types/hud/messages.d.ts.map +1 -0
- package/dist/types/hud/numbers.d.ts +3 -0
- package/dist/types/hud/numbers.d.ts.map +1 -0
- package/dist/types/hud/pickup.d.ts +4 -0
- package/dist/types/hud/pickup.d.ts.map +1 -0
- package/dist/types/hud/statusbar.d.ts +16 -0
- package/dist/types/hud/statusbar.d.ts.map +1 -0
- package/dist/types/hud/subtitles.d.ts +7 -0
- package/dist/types/hud/subtitles.d.ts.map +1 -0
- package/dist/types/hud/types.d.ts +39 -0
- package/dist/types/hud/types.d.ts.map +1 -0
- package/dist/types/index.d.ts +21 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/parse.d.ts +7 -0
- package/dist/types/parse.d.ts.map +1 -0
- package/dist/types/prediction/index.d.ts +53 -0
- package/dist/types/prediction/index.d.ts.map +1 -0
- package/dist/types/screen.d.ts +64 -0
- package/dist/types/screen.d.ts.map +1 -0
- package/dist/types/types.d.ts +109 -0
- package/dist/types/types.d.ts.map +1 -0
- package/dist/types/view/camera.d.ts +4 -0
- package/dist/types/view/camera.d.ts.map +1 -0
- package/dist/types/view/effects.d.ts +42 -0
- package/dist/types/view/effects.d.ts.map +1 -0
- package/package.json +56 -0
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { CGameImport } from '../types.js';
|
|
2
|
+
/**
|
|
3
|
+
* Global map of loaded HUD icons.
|
|
4
|
+
* This is imported and used by statusbar.ts for rendering.
|
|
5
|
+
*/
|
|
6
|
+
export declare const iconPics: Map<string, unknown>;
|
|
7
|
+
/**
|
|
8
|
+
* Initialize and precache all HUD icon images.
|
|
9
|
+
* Called during level load via CG_TouchPics().
|
|
10
|
+
*/
|
|
11
|
+
export declare const Init_Icons: (cgi: CGameImport) => void;
|
|
12
|
+
//# sourceMappingURL=icons.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"icons.d.ts","sourceRoot":"","sources":["../../../src/hud/icons.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAE1C;;;GAGG;AACH,eAAO,MAAM,QAAQ,sBAA6B,CAAC;AAkBnD;;;GAGG;AACH,eAAO,MAAM,UAAU,GAAI,KAAK,WAAW,SAS1C,CAAC"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
export declare const getHudLayout: (width: number, height: number) => {
|
|
2
|
+
HEALTH_X: number;
|
|
3
|
+
HEALTH_Y: number;
|
|
4
|
+
ARMOR_X: number;
|
|
5
|
+
ARMOR_Y: number;
|
|
6
|
+
AMMO_X: number;
|
|
7
|
+
AMMO_Y: number;
|
|
8
|
+
CENTER_PRINT_X: number;
|
|
9
|
+
CENTER_PRINT_Y: number;
|
|
10
|
+
WEAPON_ICON_X: number;
|
|
11
|
+
WEAPON_ICON_Y: number;
|
|
12
|
+
POWERUP_X: number;
|
|
13
|
+
POWERUP_Y: number;
|
|
14
|
+
scale: number;
|
|
15
|
+
};
|
|
16
|
+
export declare const HUD_LAYOUT: {
|
|
17
|
+
HEALTH_X: number;
|
|
18
|
+
HEALTH_Y: number;
|
|
19
|
+
ARMOR_X: number;
|
|
20
|
+
ARMOR_Y: number;
|
|
21
|
+
AMMO_X: number;
|
|
22
|
+
AMMO_Y: number;
|
|
23
|
+
CENTER_PRINT_X: number;
|
|
24
|
+
CENTER_PRINT_Y: number;
|
|
25
|
+
WEAPON_ICON_X: number;
|
|
26
|
+
WEAPON_ICON_Y: number;
|
|
27
|
+
POWERUP_X: number;
|
|
28
|
+
POWERUP_Y: number;
|
|
29
|
+
};
|
|
30
|
+
//# sourceMappingURL=layout.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"layout.d.ts","sourceRoot":"","sources":["../../../src/hud/layout.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,YAAY,GAAI,OAAO,MAAM,EAAE,QAAQ,MAAM;;;;;;;;;;;;;;CA8CzD,CAAC;AAGF,eAAO,MAAM,UAAU;;;;;;;;;;;;;CAatB,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { CGameImport } from '../types.js';
|
|
2
|
+
import { getHudLayout } from './layout.js';
|
|
3
|
+
export declare class MessageSystem {
|
|
4
|
+
private centerPrintMsg;
|
|
5
|
+
private notifyMessages;
|
|
6
|
+
addCenterPrint(text: string, now: number): void;
|
|
7
|
+
addNotify(text: string, now: number): void;
|
|
8
|
+
setCenterPrint(text: string, now: number): void;
|
|
9
|
+
addNotification(text: string, is_chat: boolean, now: number): void;
|
|
10
|
+
clearNotifications(): void;
|
|
11
|
+
clearCenterPrint(): void;
|
|
12
|
+
drawCenterPrint(cgi: CGameImport, now: number, layout: ReturnType<typeof getHudLayout>): void;
|
|
13
|
+
drawNotifications(cgi: CGameImport, now: number): void;
|
|
14
|
+
}
|
|
15
|
+
//# sourceMappingURL=messages.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"messages.d.ts","sourceRoot":"","sources":["../../../src/hud/messages.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC/C,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAY3C,qBAAa,aAAa;IACxB,OAAO,CAAC,cAAc,CAAwB;IAC9C,OAAO,CAAC,cAAc,CAAiB;IAEvC,cAAc,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM;IAQxC,SAAS,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM;IAanC,cAAc,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM;IAQxC,eAAe,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,GAAG,EAAE,MAAM;IAY3D,kBAAkB;IAIlB,gBAAgB;IAIhB,eAAe,CAAC,GAAG,EAAE,WAAW,EAAE,GAAG,EAAE,MAAM,EAAE,MAAM,EAAE,UAAU,CAAC,OAAO,YAAY,CAAC;IActF,iBAAiB,CAAC,GAAG,EAAE,WAAW,EAAE,GAAG,EAAE,MAAM;CAYhD"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"numbers.d.ts","sourceRoot":"","sources":["../../../src/hud/numbers.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAE1C,eAAO,MAAM,WAAW,GAAI,KAAK,WAAW,EAAE,GAAG,MAAM,EAAE,GAAG,MAAM,EAAE,OAAO,MAAM,EAAE,MAAM,SAAS,OAAO,EAAE,EAAE,OAAO,MAAM,EAAE,QAAQ,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,SAenK,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pickup.d.ts","sourceRoot":"","sources":["../../../src/hud/pickup.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC1C,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAG/C,eAAO,MAAM,WAAW,GAAI,KAAK,WAAW,EAAE,IAAI,WAAW,EAAE,OAAO,MAAM,EAAE,QAAQ,MAAM,SAU3F,CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { CGameImport } from '../types.js';
|
|
2
|
+
import { getHudLayout } from './layout.js';
|
|
3
|
+
import { PlayerState } from '@quake2ts/shared';
|
|
4
|
+
export declare const Set_ColorblindMode: (enabled: boolean) => void;
|
|
5
|
+
/**
|
|
6
|
+
* Draws the status bar (health, armor, ammo, icons) using ps.stats.
|
|
7
|
+
*
|
|
8
|
+
* NOTE: This implementation relies on the server correctly populating ps.stats
|
|
9
|
+
* (STAT_HEALTH, STAT_ARMOR, STAT_AMMO, etc.) and valid configstring mappings
|
|
10
|
+
* for icons (STAT_SELECTED_ICON, STAT_ARMOR_ICON, etc.).
|
|
11
|
+
*
|
|
12
|
+
* If ps.stats is not yet populated by the server (or is empty), the HUD will
|
|
13
|
+
* display zeros or nothing. This is expected behavior during the migration phase.
|
|
14
|
+
*/
|
|
15
|
+
export declare const Draw_StatusBar: (cgi: CGameImport, ps: PlayerState, hudNumberPics: readonly unknown[], numberWidth: number, timeMs: number, layout: ReturnType<typeof getHudLayout>) => void;
|
|
16
|
+
//# sourceMappingURL=statusbar.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"statusbar.d.ts","sourceRoot":"","sources":["../../../src/hud/statusbar.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAE1C,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAC3C,OAAO,EAAE,WAAW,EAAiC,MAAM,kBAAkB,CAAC;AAI9E,eAAO,MAAM,kBAAkB,GAAI,SAAS,OAAO,SAElD,CAAC;AAEF;;;;;;;;;GASG;AACH,eAAO,MAAM,cAAc,GACvB,KAAK,WAAW,EAChB,IAAI,WAAW,EACf,eAAe,SAAS,OAAO,EAAE,EACjC,aAAa,MAAM,EACnB,QAAQ,MAAM,EACd,QAAQ,UAAU,CAAC,OAAO,YAAY,CAAC,SA2E1C,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"subtitles.d.ts","sourceRoot":"","sources":["../../../src/hud/subtitles.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAU1C,qBAAa,cAAc;IACzB,OAAO,CAAC,QAAQ,CAAyB;IAEzC,WAAW,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM;IAQrC,aAAa,CAAC,GAAG,EAAE,WAAW,EAAE,GAAG,EAAE,MAAM;CA0B5C"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import type { PlayerState } from '@quake2ts/shared';
|
|
2
|
+
import { WeaponId, PowerupId } from '@quake2ts/shared';
|
|
3
|
+
export interface ArmorState {
|
|
4
|
+
armorType: string;
|
|
5
|
+
armorCount: number;
|
|
6
|
+
}
|
|
7
|
+
export interface InventoryState {
|
|
8
|
+
armor: ArmorState | null;
|
|
9
|
+
currentWeapon?: WeaponId;
|
|
10
|
+
powerups: Map<PowerupId, number | null>;
|
|
11
|
+
keys: Set<string>;
|
|
12
|
+
}
|
|
13
|
+
export interface ClientState {
|
|
14
|
+
inventory: InventoryState;
|
|
15
|
+
}
|
|
16
|
+
export interface HUDContext {
|
|
17
|
+
isplit: number;
|
|
18
|
+
data: unknown;
|
|
19
|
+
hud_vrect: {
|
|
20
|
+
x: number;
|
|
21
|
+
y: number;
|
|
22
|
+
width: number;
|
|
23
|
+
height: number;
|
|
24
|
+
};
|
|
25
|
+
hud_safe: {
|
|
26
|
+
x: number;
|
|
27
|
+
y: number;
|
|
28
|
+
width: number;
|
|
29
|
+
height: number;
|
|
30
|
+
};
|
|
31
|
+
scale: number;
|
|
32
|
+
playernum: number;
|
|
33
|
+
ps: PlayerState;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Mapping from WeaponId to HUD icon names.
|
|
37
|
+
*/
|
|
38
|
+
export declare const WEAPON_ICON_MAP: Record<WeaponId, string>;
|
|
39
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/hud/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAe,WAAW,EAAE,MAAM,kBAAkB,CAAC;AACjE,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAGvD,MAAM,WAAW,UAAU;IACzB,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,WAAW,cAAc;IAC7B,KAAK,EAAE,UAAU,GAAG,IAAI,CAAC;IACzB,aAAa,CAAC,EAAE,QAAQ,CAAC;IACzB,QAAQ,EAAE,GAAG,CAAC,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC,CAAC;IACxC,IAAI,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC;CACnB;AAED,MAAM,WAAW,WAAW;IAC1B,SAAS,EAAE,cAAc,CAAC;CAC3B;AAED,MAAM,WAAW,UAAU;IACzB,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,OAAO,CAAC;IACd,SAAS,EAAE;QAAE,CAAC,EAAE,MAAM,CAAC;QAAC,CAAC,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE,CAAC;IACnE,QAAQ,EAAE;QAAE,CAAC,EAAE,MAAM,CAAC;QAAC,CAAC,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE,CAAC;IAClE,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,EAAE,MAAM,CAAC;IAClB,EAAE,EAAE,WAAW,CAAC;CACjB;AAED;;GAEG;AACH,eAAO,MAAM,eAAe,EAAE,MAAM,CAAC,QAAQ,EAAE,MAAM,CAqBpD,CAAC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* CGame Module Entry Point
|
|
3
|
+
* Reference: rerelease/cg_main.cpp
|
|
4
|
+
*
|
|
5
|
+
* This module provides the GetCGameAPI() function that returns the cgame_export_t
|
|
6
|
+
* interface to the client engine.
|
|
7
|
+
*/
|
|
8
|
+
import type { CGameImport, CGameExport } from './types.js';
|
|
9
|
+
export type { CGameImport, CGameExport } from './types.js';
|
|
10
|
+
export * from './view/camera.js';
|
|
11
|
+
export * from './view/effects.js';
|
|
12
|
+
export * from './prediction/index.js';
|
|
13
|
+
/**
|
|
14
|
+
* Main entry point for CGame module.
|
|
15
|
+
* Reference: rerelease/cg_main.cpp GetCGameAPI()
|
|
16
|
+
*
|
|
17
|
+
* @param imports - Functions provided by the client engine
|
|
18
|
+
* @returns CGame export interface
|
|
19
|
+
*/
|
|
20
|
+
export declare function GetCGameAPI(imports: CGameImport): CGameExport;
|
|
21
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,WAAW,EAAE,WAAW,EAAa,MAAM,YAAY,CAAC;AAMtE,YAAY,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAG3D,cAAc,kBAAkB,CAAC;AACjC,cAAc,mBAAmB,CAAC;AAClC,cAAc,uBAAuB,CAAC;AAwOtC;;;;;;GAMG;AACH,wBAAgB,WAAW,CAAC,OAAO,EAAE,WAAW,GAAG,WAAW,CA2C7D"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { CGameImport } from './types.js';
|
|
2
|
+
/**
|
|
3
|
+
* Parses a config string update and precaches assets if necessary.
|
|
4
|
+
* Reference: rerelease/cg_main.cpp CL_ParseConfigString
|
|
5
|
+
*/
|
|
6
|
+
export declare function CG_ParseConfigString(cgi: CGameImport, i: number, s: string): void;
|
|
7
|
+
//# sourceMappingURL=parse.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"parse.d.ts","sourceRoot":"","sources":["../../src/parse.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAG9C;;;GAGG;AACH,wBAAgB,oBAAoB,CAAC,GAAG,EAAE,WAAW,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,GAAG,IAAI,CAQjF"}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { type Vec3, PmType, WaterLevel, type PmFlags, type UserCommand, PlayerState, PmoveTraceFn } from '@quake2ts/shared';
|
|
2
|
+
import type { GameFrameResult } from '@quake2ts/engine';
|
|
3
|
+
import type { PlayerClient } from '@quake2ts/game';
|
|
4
|
+
export interface PredictionState extends PlayerState {
|
|
5
|
+
deltaAngles?: Vec3;
|
|
6
|
+
pmFlags: PmFlags;
|
|
7
|
+
pmType: PmType;
|
|
8
|
+
gravity?: number;
|
|
9
|
+
waterLevel: WaterLevel;
|
|
10
|
+
client?: PlayerClient;
|
|
11
|
+
health?: number;
|
|
12
|
+
armor?: number;
|
|
13
|
+
ammo?: number;
|
|
14
|
+
}
|
|
15
|
+
export interface PredictionSettings {
|
|
16
|
+
readonly pmFriction: number;
|
|
17
|
+
readonly pmStopSpeed: number;
|
|
18
|
+
readonly pmAccelerate: number;
|
|
19
|
+
readonly pmAirAccelerate: number;
|
|
20
|
+
readonly pmWaterAccelerate: number;
|
|
21
|
+
readonly pmWaterFriction: number;
|
|
22
|
+
readonly pmMaxSpeed: number;
|
|
23
|
+
readonly pmDuckSpeed: number;
|
|
24
|
+
readonly pmWaterSpeed: number;
|
|
25
|
+
readonly groundIsSlick: boolean;
|
|
26
|
+
readonly errorTolerance: number;
|
|
27
|
+
readonly errorSnapThreshold: number;
|
|
28
|
+
}
|
|
29
|
+
export declare function defaultPredictionState(): PredictionState;
|
|
30
|
+
export declare function interpolatePredictionState(previous: PredictionState, latest: PredictionState, alpha: number): PredictionState;
|
|
31
|
+
export interface PredictionPhysics {
|
|
32
|
+
trace: PmoveTraceFn;
|
|
33
|
+
pointContents: (p: Vec3) => number;
|
|
34
|
+
}
|
|
35
|
+
export declare class ClientPrediction {
|
|
36
|
+
private readonly settings;
|
|
37
|
+
private readonly physics;
|
|
38
|
+
private enabled;
|
|
39
|
+
private baseFrame;
|
|
40
|
+
private commands;
|
|
41
|
+
private predicted;
|
|
42
|
+
private predictionError;
|
|
43
|
+
constructor(physics: PredictionPhysics, settings?: Partial<PredictionSettings>);
|
|
44
|
+
setPredictionEnabled(enabled: boolean): void;
|
|
45
|
+
setAuthoritative(frame: GameFrameResult<PredictionState>): PredictionState;
|
|
46
|
+
getPredictionError(): Vec3;
|
|
47
|
+
decayError(frametime: number): void;
|
|
48
|
+
enqueueCommand(cmd: UserCommand): PredictionState;
|
|
49
|
+
getCommand(sequence: number): UserCommand | undefined;
|
|
50
|
+
getPredictedState(): PredictionState;
|
|
51
|
+
private recompute;
|
|
52
|
+
}
|
|
53
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/prediction/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAML,KAAK,IAAI,EAMT,MAAM,EACN,UAAU,EACV,KAAK,OAAO,EACZ,KAA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,eAAe,CAgCjB;AAiDD,MAAM,WAAW,iBAAiB;IAChC,KAAK,EAAE,YAAY,CAAC;IACpB,aAAa,EAAE,CAAC,CAAC,EAAE,IAAI,KAAK,MAAM,CAAC;CACpC;AAED,qBAAa,gBAAgB;IAC3B,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAqB;IAC9C,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAoB;IAC5C,OAAO,CAAC,OAAO,CAAQ;IACvB,OAAO,CAAC,SAAS,CAI4B;IAC7C,OAAO,CAAC,QAAQ,CAAqB;IACrC,OAAO,CAAC,SAAS,CAA6C;IAC9D,OAAO,CAAC,eAAe,CAAmB;gBAE9B,OAAO,EAAE,iBAAiB,EAAE,QAAQ,GAAE,OAAO,CAAC,kBAAkB,CAAM;IAMlF,oBAAoB,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI;IAI5C,gBAAgB,CAAC,KAAK,EAAE,eAAe,CAAC,eAAe,CAAC,GAAG,eAAe;IA+D1E,kBAAkB,IAAI,IAAI;IAK1B,UAAU,CAAC,SAAS,EAAE,MAAM;IAS5B,cAAc,CAAC,GAAG,EAAE,WAAW,GAAG,eAAe;IAQjD,UAAU,CAAC,QAAQ,EAAE,MAAM,GAAG,WAAW,GAAG,SAAS;IAIrD,iBAAiB,IAAI,eAAe;IAIpC,OAAO,CAAC,SAAS;CAYlB"}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* CGame HUD Screen Drawing
|
|
3
|
+
* Reference: rerelease/cg_screen.cpp
|
|
4
|
+
*
|
|
5
|
+
* This module handles all HUD rendering for the cgame package, including:
|
|
6
|
+
* - Status bar (health, armor, ammo)
|
|
7
|
+
* - Crosshair
|
|
8
|
+
* - Damage indicators
|
|
9
|
+
* - Pickup notifications
|
|
10
|
+
* - Messages and center print
|
|
11
|
+
* - Subtitles
|
|
12
|
+
*/
|
|
13
|
+
import type { PlayerState } from '@quake2ts/shared';
|
|
14
|
+
import type { CGameImport } from './types.js';
|
|
15
|
+
import { MessageSystem } from './hud/messages.js';
|
|
16
|
+
import { SubtitleSystem } from './hud/subtitles.js';
|
|
17
|
+
/**
|
|
18
|
+
* Initialize the CGame screen module with import functions.
|
|
19
|
+
* Reference: rerelease/cg_screen.cpp InitCGame()
|
|
20
|
+
*/
|
|
21
|
+
export declare function CG_InitScreen(imports: CGameImport): void;
|
|
22
|
+
/**
|
|
23
|
+
* Precache all HUD images.
|
|
24
|
+
* Reference: rerelease/cg_screen.cpp:1689 (TouchPics)
|
|
25
|
+
*
|
|
26
|
+
* This is called during level load to register all required HUD assets.
|
|
27
|
+
*/
|
|
28
|
+
export declare function CG_TouchPics(): void;
|
|
29
|
+
/**
|
|
30
|
+
* Main HUD drawing function.
|
|
31
|
+
* Reference: rerelease/cg_screen.cpp CG_DrawHUD()
|
|
32
|
+
*
|
|
33
|
+
* Called each frame by the client to render the HUD overlay.
|
|
34
|
+
*
|
|
35
|
+
* @param isplit - Split-screen index (0 for single player)
|
|
36
|
+
* @param data - Additional HUD data (unused in initial implementation)
|
|
37
|
+
* @param hud_vrect - Virtual HUD rectangle (screen coordinates)
|
|
38
|
+
* @param hud_safe - Safe area rectangle (for overscan)
|
|
39
|
+
* @param scale - HUD scale factor
|
|
40
|
+
* @param playernum - Player number
|
|
41
|
+
* @param ps - Current player state
|
|
42
|
+
*/
|
|
43
|
+
export declare function CG_DrawHUD(isplit: number, data: unknown, hud_vrect: {
|
|
44
|
+
x: number;
|
|
45
|
+
y: number;
|
|
46
|
+
width: number;
|
|
47
|
+
height: number;
|
|
48
|
+
}, hud_safe: {
|
|
49
|
+
x: number;
|
|
50
|
+
y: number;
|
|
51
|
+
width: number;
|
|
52
|
+
height: number;
|
|
53
|
+
}, scale: number, playernum: number, ps: PlayerState): void;
|
|
54
|
+
/**
|
|
55
|
+
* Get message system instance.
|
|
56
|
+
* Used by parsing functions to add messages.
|
|
57
|
+
*/
|
|
58
|
+
export declare function CG_GetMessageSystem(): MessageSystem;
|
|
59
|
+
/**
|
|
60
|
+
* Get subtitle system instance.
|
|
61
|
+
* Used by audio system to display subtitles.
|
|
62
|
+
*/
|
|
63
|
+
export declare function CG_GetSubtitleSystem(): SubtitleSystem;
|
|
64
|
+
//# sourceMappingURL=screen.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"screen.d.ts","sourceRoot":"","sources":["../../src/screen.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AACpD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAO9C,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAClD,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAepD;;;GAGG;AACH,wBAAgB,aAAa,CAAC,OAAO,EAAE,WAAW,GAAG,IAAI,CAExD;AAED;;;;;GAKG;AACH,wBAAgB,YAAY,IAAI,IAAI,CAqBnC;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,UAAU,CACtB,MAAM,EAAE,MAAM,EACd,IAAI,EAAE,OAAO,EACb,SAAS,EAAE;IAAE,CAAC,EAAE,MAAM,CAAC;IAAC,CAAC,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,EAClE,QAAQ,EAAE;IAAE,CAAC,EAAE,MAAM,CAAC;IAAC,CAAC,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,EACjE,KAAK,EAAE,MAAM,EACb,SAAS,EAAE,MAAM,EACjB,EAAE,EAAE,WAAW,GAChB,IAAI,CAyCN;AAED;;;GAGG;AACH,wBAAgB,mBAAmB,IAAI,aAAa,CAEnD;AAED;;;GAGG;AACH,wBAAgB,oBAAoB,IAAI,cAAc,CAErD"}
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
import type { Vec3, PlayerState, PmoveTraceResult, LayoutFlags, UserCommand } from '@quake2ts/shared';
|
|
2
|
+
import { WeaponId, PowerupId } from '@quake2ts/shared';
|
|
3
|
+
export interface ArmorState {
|
|
4
|
+
armorType: string;
|
|
5
|
+
armorCount: number;
|
|
6
|
+
}
|
|
7
|
+
export interface InventoryState {
|
|
8
|
+
armor: ArmorState | null;
|
|
9
|
+
currentWeapon?: WeaponId;
|
|
10
|
+
powerups: Map<PowerupId, number | null>;
|
|
11
|
+
keys: Set<string>;
|
|
12
|
+
}
|
|
13
|
+
export interface ClientState {
|
|
14
|
+
inventory: InventoryState;
|
|
15
|
+
}
|
|
16
|
+
export interface PmoveInfo {
|
|
17
|
+
s: PlayerState;
|
|
18
|
+
cmd: UserCommand;
|
|
19
|
+
}
|
|
20
|
+
export declare const WEAPON_ICON_MAP: Record<WeaponId, string>;
|
|
21
|
+
export declare const KEY_ICON_MAP: Record<string, string>;
|
|
22
|
+
/**
|
|
23
|
+
* Interface provided by the Engine to the CGame module.
|
|
24
|
+
* Mirrors `cgame_import_t` from `rerelease/game.h`.
|
|
25
|
+
*/
|
|
26
|
+
export interface CGameImport {
|
|
27
|
+
tick_rate: number;
|
|
28
|
+
frame_time_s: number;
|
|
29
|
+
frame_time_ms: number;
|
|
30
|
+
Com_Print(msg: string): void;
|
|
31
|
+
Com_Error(msg: string): void;
|
|
32
|
+
get_configstring(num: number): string;
|
|
33
|
+
TagMalloc(size: number, tag: number): unknown;
|
|
34
|
+
TagFree(ptr: unknown): void;
|
|
35
|
+
FreeTags(tag: number): void;
|
|
36
|
+
cvar(name: string, value: string, flags: number): unknown;
|
|
37
|
+
Cvar_Get(name: string, value: string, flags: number): {
|
|
38
|
+
value: number;
|
|
39
|
+
};
|
|
40
|
+
cvar_set(name: string, value: string): void;
|
|
41
|
+
cvar_forceset(name: string, value: string): void;
|
|
42
|
+
CL_FrameValid(): boolean;
|
|
43
|
+
CL_FrameTime(): number;
|
|
44
|
+
CL_ClientTime(): number;
|
|
45
|
+
CL_ServerFrame(): number;
|
|
46
|
+
CL_ServerProtocol(): number;
|
|
47
|
+
CL_GetClientName(playerNum: number): string;
|
|
48
|
+
CL_GetClientPic(playerNum: number): string;
|
|
49
|
+
CL_GetClientDogtag(playerNum: number): string;
|
|
50
|
+
CL_GetKeyBinding(key: string): string;
|
|
51
|
+
RegisterModel(name: string): void;
|
|
52
|
+
RegisterSound(name: string): void;
|
|
53
|
+
Draw_RegisterPic(name: string): unknown;
|
|
54
|
+
Draw_GetPicSize(pic: unknown): {
|
|
55
|
+
width: number;
|
|
56
|
+
height: number;
|
|
57
|
+
};
|
|
58
|
+
SCR_DrawChar(x: number, y: number, char: number): void;
|
|
59
|
+
SCR_DrawPic(x: number, y: number, pic: unknown): void;
|
|
60
|
+
SCR_DrawColorPic(x: number, y: number, pic: unknown, color: Vec3, alpha: number): void;
|
|
61
|
+
SCR_DrawFontString(x: number, y: number, str: string): void;
|
|
62
|
+
SCR_DrawCenterString(y: number, str: string): void;
|
|
63
|
+
SCR_MeasureFontString(str: string): number;
|
|
64
|
+
SCR_FontLineHeight(): number;
|
|
65
|
+
SCR_SetAltTypeface(alt: boolean): void;
|
|
66
|
+
SCR_DrawBind(x: number, y: number, command: string): void;
|
|
67
|
+
Localize(key: string): string;
|
|
68
|
+
CL_GetTextInput(): string;
|
|
69
|
+
CL_GetWarnAmmoCount(): number;
|
|
70
|
+
CL_InAutoDemoLoop(): boolean;
|
|
71
|
+
PM_Trace(start: Vec3, end: Vec3, mins: Vec3, maxs: Vec3): PmoveTraceResult;
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* Interface exported by the CGame module to the Engine.
|
|
75
|
+
* Mirrors `cgame_export_t` from `rerelease/game.h`.
|
|
76
|
+
*/
|
|
77
|
+
export interface CGameExport {
|
|
78
|
+
Init(): void;
|
|
79
|
+
Shutdown(): void;
|
|
80
|
+
DrawHUD(isplit: number, data: unknown, // Placeholder, likely specific HUD data structure
|
|
81
|
+
hud_vrect: {
|
|
82
|
+
x: number;
|
|
83
|
+
y: number;
|
|
84
|
+
width: number;
|
|
85
|
+
height: number;
|
|
86
|
+
}, hud_safe: {
|
|
87
|
+
x: number;
|
|
88
|
+
y: number;
|
|
89
|
+
width: number;
|
|
90
|
+
height: number;
|
|
91
|
+
}, scale: number, playernum: number, ps: PlayerState): void;
|
|
92
|
+
TouchPics(): void;
|
|
93
|
+
LayoutFlags(ps: PlayerState): LayoutFlags;
|
|
94
|
+
GetActiveWeaponWheelWeapon(ps: PlayerState): number;
|
|
95
|
+
GetOwnedWeaponWheelWeapons(ps: PlayerState): number[];
|
|
96
|
+
GetWeaponWheelAmmoCount(ps: PlayerState, weapon: number): number;
|
|
97
|
+
GetPowerupWheelCount(ps: PlayerState): number;
|
|
98
|
+
GetHitMarkerDamage(ps: PlayerState): number;
|
|
99
|
+
Pmove(pmove: unknown): void;
|
|
100
|
+
ParseConfigString(i: number, s: string): void;
|
|
101
|
+
ParseCenterPrint(str: string, isplit: number, instant: boolean): void;
|
|
102
|
+
NotifyMessage(isplit: number, msg: string, is_chat: boolean): void;
|
|
103
|
+
ShowSubtitle(text: string, soundName: string): void;
|
|
104
|
+
ClearNotify(isplit: number): void;
|
|
105
|
+
ClearCenterprint(isplit: number): void;
|
|
106
|
+
GetMonsterFlashOffset(id: number): Vec3;
|
|
107
|
+
GetExtension(name: string): unknown;
|
|
108
|
+
}
|
|
109
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,WAAW,EAAY,gBAAgB,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAChH,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAGvD,MAAM,WAAW,UAAU;IACz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":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAC1C,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAQ1C,eAAO,MAAM,YAAY,GAAI,QAAQ,MAAM,EAAE,YAAY,UAAU,SAIlE,CAAC"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { type Vec3 } from '@quake2ts/shared';
|
|
2
|
+
import type { PredictionState } from '../prediction/index.js';
|
|
3
|
+
export interface ViewEffectSettings {
|
|
4
|
+
readonly runPitch: number;
|
|
5
|
+
readonly runRoll: number;
|
|
6
|
+
readonly bobUp: number;
|
|
7
|
+
readonly bobPitch: number;
|
|
8
|
+
readonly bobRoll: number;
|
|
9
|
+
readonly maxBobHeight: number;
|
|
10
|
+
readonly maxBobAngle: number;
|
|
11
|
+
}
|
|
12
|
+
export interface ViewKick {
|
|
13
|
+
readonly pitch: number;
|
|
14
|
+
readonly roll: number;
|
|
15
|
+
readonly durationMs: number;
|
|
16
|
+
readonly origin?: Vec3;
|
|
17
|
+
}
|
|
18
|
+
export interface ActiveKick extends ViewKick {
|
|
19
|
+
remainingMs: number;
|
|
20
|
+
}
|
|
21
|
+
export interface ViewSample {
|
|
22
|
+
readonly angles: Vec3;
|
|
23
|
+
readonly offset: Vec3;
|
|
24
|
+
readonly bobCycle: number;
|
|
25
|
+
readonly bobCycleRun: number;
|
|
26
|
+
readonly bobFracSin: number;
|
|
27
|
+
readonly xyspeed: number;
|
|
28
|
+
}
|
|
29
|
+
export declare class ViewEffects {
|
|
30
|
+
private readonly settings;
|
|
31
|
+
private bobTime;
|
|
32
|
+
private bobCycle;
|
|
33
|
+
private bobCycleRun;
|
|
34
|
+
private bobFracSin;
|
|
35
|
+
private kick;
|
|
36
|
+
private lastSample;
|
|
37
|
+
constructor(settings?: Partial<ViewEffectSettings>);
|
|
38
|
+
addKick(kick: ViewKick): void;
|
|
39
|
+
get last(): ViewSample | undefined;
|
|
40
|
+
sample(state: Predict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,WAAW;IACtB,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAqB;IAC9C,OAAO,CAAC,OAAO,CAAK;IACpB,OAAO,CAAC,QAAQ,CAAK;IACrB,OAAO,CAAC,WAAW,CAAK;IACxB,OAAO,CAAC,UAAU,CAAK;IACvB,OAAO,CAAC,IAAI,CAAyB;IACrC,OAAO,CAAC,UAAU,CAAyB;gBAE/B,QAAQ,GAAE,OAAO,CAAC,kBAAkB,CAAM;IAItD,OAAO,CAAC,IAAI,EAAE,QAAQ,GAAG,IAAI;IAK7B,IAAI,IAAI,IAAI,UAAU,GAAG,SAAS,CAEjC;IAED,MAAM,CAAC,KAAK,EAAE,eAAe,EAAE,WAAW,EAAE,MAAM,GAAG,UAAU;CAmFhE"}
|
package/package.json
ADDED
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@quake2ts/cgame",
|
|
3
|
+
"version": "0.0.739",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"main": "./dist/cjs/index.cjs",
|
|
6
|
+
"module": "./dist/esm/index.js",
|
|
7
|
+
"types": "./dist/types/index.d.ts",
|
|
8
|
+
"exports": {
|
|
9
|
+
".": {
|
|
10
|
+
"types": "./dist/types/index.d.ts",
|
|
11
|
+
"import": "./dist/esm/index.js",
|
|
12
|
+
"require": "./dist/cjs/index.cjs",
|
|
13
|
+
"default": "./dist/esm/index.js"
|
|
14
|
+
},
|
|
15
|
+
"./browser": {
|
|
16
|
+
"types": "./dist/types/index.d.ts",
|
|
17
|
+
"default": "./dist/browser/index.js"
|
|
18
|
+
}
|
|
19
|
+
},
|
|
20
|
+
"unpkg": "./dist/browser/index.js",
|
|
21
|
+
"jsdelivr": "./dist/browser/index.js",
|
|
22
|
+
"files": [
|
|
23
|
+
"dist"
|
|
24
|
+
],
|
|
25
|
+
"sideEffects": false,
|
|
26
|
+
"repository": {
|
|
27
|
+
"type": "git",
|
|
28
|
+
"url": "https://github.com/jburnhams/quake2.git",
|
|
29
|
+
"directory": "quake2ts/packages/cgame"
|
|
30
|
+
},
|
|
31
|
+
"peerDependencies": {
|
|
32
|
+
"gl-matrix": "^3.4.4",
|
|
33
|
+
"@quake2ts/engine": "0.0.739",
|
|
34
|
+
"@quake2ts/game": "0.0.739",
|
|
35
|
+
"@quake2ts/shared": "0.0.739"
|
|
36
|
+
},
|
|
37
|
+
"devDependencies": {
|
|
38
|
+
"gl-matrix": "^3.4.4",
|
|
39
|
+
"@types/node": "^20.11.24",
|
|
40
|
+
"tsup": "^8.0.2",
|
|
41
|
+
"typescript": "^5.4.2",
|
|
42
|
+
"vitest": "^1.3.1",
|
|
43
|
+
"@quake2ts/engine": "0.0.739",
|
|
44
|
+
"@quake2ts/game": "0.0.739",
|
|
45
|
+
"@quake2ts/shared": "0.0.739"
|
|
46
|
+
},
|
|
47
|
+
"scripts": {
|
|
48
|
+
"build": "pnpm run build:types && pnpm run build:bundles",
|
|
49
|
+
"build:types": "tsc -b",
|
|
50
|
+
"build:bundles": "tsup",
|
|
51
|
+
"dev": "tsup --watch",
|
|
52
|
+
"lint": "eslint .",
|
|
53
|
+
"test": "vitest run",
|
|
54
|
+
"typecheck": "tsc --noEmit"
|
|
55
|
+
}
|
|
56
|
+
}
|