quake2ts 0.0.196 → 0.0.198
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/package.json +1 -1
- package/packages/cgame/dist/index.cjs.map +1 -1
- package/packages/cgame/dist/index.d.cts +3 -3
- package/packages/cgame/dist/index.d.ts +3 -3
- package/packages/cgame/dist/index.js.map +1 -1
- package/packages/client/dist/browser/index.global.js +13 -5
- package/packages/client/dist/browser/index.global.js.map +1 -1
- package/packages/client/dist/cjs/index.cjs +116 -0
- package/packages/client/dist/cjs/index.cjs.map +1 -1
- package/packages/client/dist/esm/index.js +117 -1
- package/packages/client/dist/esm/index.js.map +1 -1
- package/packages/client/dist/tsconfig.tsbuildinfo +1 -1
- package/packages/client/dist/types/cgameBridge.d.ts +4 -0
- package/packages/client/dist/types/cgameBridge.d.ts.map +1 -0
- package/packages/client/dist/types/index.d.ts +4 -2
- package/packages/client/dist/types/index.d.ts.map +1 -1
- package/packages/game/dist/browser/index.global.js +2 -2
- package/packages/game/dist/browser/index.global.js.map +1 -1
- package/packages/game/dist/cjs/index.cjs +52 -35
- package/packages/game/dist/cjs/index.cjs.map +1 -1
- package/packages/game/dist/esm/index.js +52 -35
- package/packages/game/dist/esm/index.js.map +1 -1
- package/packages/game/dist/tsconfig.tsbuildinfo +1 -1
- package/packages/game/dist/types/entities/entity.d.ts +1 -0
- package/packages/game/dist/types/entities/entity.d.ts.map +1 -1
- package/packages/game/dist/types/entities/targets.d.ts.map +1 -1
|
@@ -3843,6 +3843,118 @@ var AMMO_TYPE_COUNT2 = Object.keys(AmmoType2).length / 2;
|
|
|
3843
3843
|
var import_cgame2 = require("@quake2ts/cgame");
|
|
3844
3844
|
var import_cgame3 = require("@quake2ts/cgame");
|
|
3845
3845
|
|
|
3846
|
+
// src/cgameBridge.ts
|
|
3847
|
+
function createCGameImport(imports) {
|
|
3848
|
+
const getRenderer = () => imports.engine.renderer;
|
|
3849
|
+
return {
|
|
3850
|
+
// Frame timing - stubbed for now until we fix the access pattern
|
|
3851
|
+
get tick_rate() {
|
|
3852
|
+
return 10;
|
|
3853
|
+
},
|
|
3854
|
+
get frame_time_s() {
|
|
3855
|
+
return 0;
|
|
3856
|
+
},
|
|
3857
|
+
get frame_time_ms() {
|
|
3858
|
+
return 0;
|
|
3859
|
+
},
|
|
3860
|
+
// Console
|
|
3861
|
+
Com_Print: (msg) => {
|
|
3862
|
+
console.log(`[CGAME] ${msg}`);
|
|
3863
|
+
},
|
|
3864
|
+
Com_Error: (msg) => {
|
|
3865
|
+
console.error(`[CGAME ERROR] ${msg}`);
|
|
3866
|
+
},
|
|
3867
|
+
// Config strings
|
|
3868
|
+
get_configstring: (num) => {
|
|
3869
|
+
return "";
|
|
3870
|
+
},
|
|
3871
|
+
// Memory (No-op in JS)
|
|
3872
|
+
TagMalloc: (size, tag) => ({}),
|
|
3873
|
+
TagFree: (ptr) => {
|
|
3874
|
+
},
|
|
3875
|
+
FreeTags: (tag) => {
|
|
3876
|
+
},
|
|
3877
|
+
// Cvars
|
|
3878
|
+
cvar: (name, value, flags) => {
|
|
3879
|
+
return null;
|
|
3880
|
+
},
|
|
3881
|
+
cvar_set: (name, value) => {
|
|
3882
|
+
if (imports.host?.cvars) {
|
|
3883
|
+
imports.host.cvars.setValue(name, value);
|
|
3884
|
+
}
|
|
3885
|
+
},
|
|
3886
|
+
cvar_forceset: (name, value) => {
|
|
3887
|
+
if (imports.host?.cvars) {
|
|
3888
|
+
imports.host.cvars.setValue(name, value);
|
|
3889
|
+
}
|
|
3890
|
+
},
|
|
3891
|
+
// Client state
|
|
3892
|
+
CL_FrameValid: () => true,
|
|
3893
|
+
CL_FrameTime: () => 0,
|
|
3894
|
+
CL_ClientTime: () => 0,
|
|
3895
|
+
CL_ServerFrame: () => 0,
|
|
3896
|
+
CL_ServerProtocol: () => 34,
|
|
3897
|
+
// Client info
|
|
3898
|
+
CL_GetClientName: (playerNum) => {
|
|
3899
|
+
return `Player ${playerNum}`;
|
|
3900
|
+
},
|
|
3901
|
+
CL_GetClientPic: (playerNum) => {
|
|
3902
|
+
return "";
|
|
3903
|
+
},
|
|
3904
|
+
CL_GetClientDogtag: (playerNum) => {
|
|
3905
|
+
return "";
|
|
3906
|
+
},
|
|
3907
|
+
CL_GetKeyBinding: (key) => {
|
|
3908
|
+
return `[${key}]`;
|
|
3909
|
+
},
|
|
3910
|
+
// Drawing
|
|
3911
|
+
Draw_RegisterPic: (name) => {
|
|
3912
|
+
if (imports.engine.assets) {
|
|
3913
|
+
return name;
|
|
3914
|
+
}
|
|
3915
|
+
return name;
|
|
3916
|
+
},
|
|
3917
|
+
Draw_GetPicSize: (pic) => {
|
|
3918
|
+
return { width: 32, height: 32 };
|
|
3919
|
+
},
|
|
3920
|
+
SCR_DrawChar: (x, y, char) => {
|
|
3921
|
+
getRenderer()?.drawString(x, y, String.fromCharCode(char));
|
|
3922
|
+
},
|
|
3923
|
+
SCR_DrawPic: (x, y, pic) => {
|
|
3924
|
+
const name = pic;
|
|
3925
|
+
},
|
|
3926
|
+
SCR_DrawColorPic: (x, y, pic, color, alpha) => {
|
|
3927
|
+
},
|
|
3928
|
+
SCR_DrawFontString: (x, y, str3) => {
|
|
3929
|
+
getRenderer()?.drawString(x, y, str3);
|
|
3930
|
+
},
|
|
3931
|
+
SCR_DrawCenterString: (y, str3) => {
|
|
3932
|
+
getRenderer()?.drawCenterString(y, str3);
|
|
3933
|
+
},
|
|
3934
|
+
SCR_MeasureFontString: (str3) => {
|
|
3935
|
+
const stripped = str3.replace(/\^[0-9]/g, "");
|
|
3936
|
+
return stripped.length * 8;
|
|
3937
|
+
},
|
|
3938
|
+
SCR_FontLineHeight: () => 8,
|
|
3939
|
+
SCR_SetAltTypeface: (alt) => {
|
|
3940
|
+
},
|
|
3941
|
+
SCR_DrawBind: (x, y, command) => {
|
|
3942
|
+
getRenderer()?.drawString(x, y, `[${command}]`);
|
|
3943
|
+
},
|
|
3944
|
+
// Localization
|
|
3945
|
+
Localize: (key) => key,
|
|
3946
|
+
// State queries
|
|
3947
|
+
CL_GetTextInput: () => "",
|
|
3948
|
+
CL_GetWarnAmmoCount: () => 5,
|
|
3949
|
+
// Low ammo threshold
|
|
3950
|
+
CL_InAutoDemoLoop: () => false,
|
|
3951
|
+
// Prediction Trace
|
|
3952
|
+
PM_Trace: (start, end, mins, maxs) => {
|
|
3953
|
+
return imports.engine.trace(start, end);
|
|
3954
|
+
}
|
|
3955
|
+
};
|
|
3956
|
+
}
|
|
3957
|
+
|
|
3846
3958
|
// src/hud/crosshair.ts
|
|
3847
3959
|
var crosshairPic = null;
|
|
3848
3960
|
var crosshairIndex = 0;
|
|
@@ -6154,6 +6266,8 @@ function createClient(imports) {
|
|
|
6154
6266
|
let lastRendered;
|
|
6155
6267
|
let lastView;
|
|
6156
6268
|
let camera;
|
|
6269
|
+
const cgameImport = createCGameImport(imports);
|
|
6270
|
+
const cg = (0, import_cgame2.GetCGameAPI)(cgameImport);
|
|
6157
6271
|
let fovValue = 90;
|
|
6158
6272
|
let isZooming = false;
|
|
6159
6273
|
if (imports.host) {
|
|
@@ -6230,6 +6344,7 @@ function createClient(imports) {
|
|
|
6230
6344
|
if (initial?.state) {
|
|
6231
6345
|
prediction.setAuthoritative(initial);
|
|
6232
6346
|
}
|
|
6347
|
+
cg.Init();
|
|
6233
6348
|
if (imports.engine.assets && imports.engine.renderer) {
|
|
6234
6349
|
loadingScreen.start(100, "Loading assets...");
|
|
6235
6350
|
Init_Hud(imports.engine.renderer, imports.engine.assets).then(() => {
|
|
@@ -6459,6 +6574,7 @@ function createClient(imports) {
|
|
|
6459
6574
|
this.Shutdown();
|
|
6460
6575
|
},
|
|
6461
6576
|
Shutdown() {
|
|
6577
|
+
cg.Shutdown();
|
|
6462
6578
|
latestFrame = void 0;
|
|
6463
6579
|
lastRendered = void 0;
|
|
6464
6580
|
if (imports.host?.cvars) {
|