quake2ts 0.0.211 → 0.0.213
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 +37 -0
- package/packages/cgame/dist/index.cjs.map +1 -1
- package/packages/cgame/dist/index.d.cts +1 -0
- package/packages/cgame/dist/index.d.ts +1 -0
- package/packages/cgame/dist/index.js +37 -0
- package/packages/cgame/dist/index.js.map +1 -1
- package/packages/client/dist/browser/index.global.js +13 -13
- package/packages/client/dist/browser/index.global.js.map +1 -1
- package/packages/client/dist/cjs/index.cjs +13 -33
- package/packages/client/dist/cjs/index.cjs.map +1 -1
- package/packages/client/dist/esm/index.js +13 -33
- 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.map +1 -1
- package/packages/client/dist/types/hud.d.ts +1 -2
- package/packages/client/dist/types/hud.d.ts.map +1 -1
- package/packages/client/dist/types/index.d.ts.map +1 -1
- package/packages/client/dist/types/hud/subtitles.d.ts +0 -7
- package/packages/client/dist/types/hud/subtitles.d.ts.map +0 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "quake2ts",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.213",
|
|
4
4
|
"description": "Quake II re-release port to TypeScript with WebGL renderer - A complete game engine with physics, networking, and BSP rendering",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"packageManager": "pnpm@8.15.7",
|
|
@@ -192,6 +192,32 @@ var MessageSystem = class {
|
|
|
192
192
|
}
|
|
193
193
|
};
|
|
194
194
|
|
|
195
|
+
// src/hud/subtitles.ts
|
|
196
|
+
var SUBTITLE_DURATION = 3e3;
|
|
197
|
+
var SubtitleSystem = class {
|
|
198
|
+
constructor() {
|
|
199
|
+
this.subtitle = null;
|
|
200
|
+
}
|
|
201
|
+
addSubtitle(text, now) {
|
|
202
|
+
this.subtitle = {
|
|
203
|
+
text,
|
|
204
|
+
startTime: now,
|
|
205
|
+
duration: SUBTITLE_DURATION
|
|
206
|
+
};
|
|
207
|
+
}
|
|
208
|
+
drawSubtitles(cgi3, now) {
|
|
209
|
+
if (!this.subtitle) {
|
|
210
|
+
return;
|
|
211
|
+
}
|
|
212
|
+
if (now > this.subtitle.startTime + this.subtitle.duration) {
|
|
213
|
+
this.subtitle = null;
|
|
214
|
+
return;
|
|
215
|
+
}
|
|
216
|
+
const y = 200;
|
|
217
|
+
cgi3.SCR_DrawCenterString(y, this.subtitle.text);
|
|
218
|
+
}
|
|
219
|
+
};
|
|
220
|
+
|
|
195
221
|
// src/hud/blends.ts
|
|
196
222
|
var Draw_Blends = (cgi3, ps, width, height) => {
|
|
197
223
|
if (!ps.blend) return;
|
|
@@ -303,6 +329,7 @@ var cgi = null;
|
|
|
303
329
|
var hudNumberPics = [];
|
|
304
330
|
var numberWidth = 0;
|
|
305
331
|
var messageSystem = new MessageSystem();
|
|
332
|
+
var subtitleSystem = new SubtitleSystem();
|
|
306
333
|
function CG_InitScreen(imports) {
|
|
307
334
|
cgi = imports;
|
|
308
335
|
}
|
|
@@ -347,11 +374,15 @@ function CG_DrawHUD(isplit, data, hud_vrect, hud_safe, scale2, playernum, ps) {
|
|
|
347
374
|
}
|
|
348
375
|
messageSystem.drawCenterPrint(cgi, timeMs, layout);
|
|
349
376
|
messageSystem.drawNotifications(cgi, timeMs);
|
|
377
|
+
subtitleSystem.drawSubtitles(cgi, timeMs);
|
|
350
378
|
Draw_Crosshair(cgi, hud_vrect.width, hud_vrect.height);
|
|
351
379
|
}
|
|
352
380
|
function CG_GetMessageSystem() {
|
|
353
381
|
return messageSystem;
|
|
354
382
|
}
|
|
383
|
+
function CG_GetSubtitleSystem() {
|
|
384
|
+
return subtitleSystem;
|
|
385
|
+
}
|
|
355
386
|
function CG_ParseConfigString(cgi3, i, s) {
|
|
356
387
|
if (i >= shared.ConfigStringIndex.Models && i < shared.ConfigStringIndex.Models + shared.MAX_MODELS) {
|
|
357
388
|
cgi3.RegisterModel(s);
|
|
@@ -1146,6 +1177,11 @@ function ClearCenterprint(isplit) {
|
|
|
1146
1177
|
const messageSystem2 = CG_GetMessageSystem();
|
|
1147
1178
|
messageSystem2.clearCenterPrint();
|
|
1148
1179
|
}
|
|
1180
|
+
function ShowSubtitle(text, soundName) {
|
|
1181
|
+
if (!cgi2) return;
|
|
1182
|
+
const subtitleSystem2 = CG_GetSubtitleSystem();
|
|
1183
|
+
subtitleSystem2.addSubtitle(text, cgi2.CL_ClientTime());
|
|
1184
|
+
}
|
|
1149
1185
|
function GetMonsterFlashOffset(id) {
|
|
1150
1186
|
return { x: 0, y: 0, z: 0 };
|
|
1151
1187
|
}
|
|
@@ -1176,6 +1212,7 @@ function GetCGameAPI(imports) {
|
|
|
1176
1212
|
ParseConfigString,
|
|
1177
1213
|
ParseCenterPrint,
|
|
1178
1214
|
NotifyMessage,
|
|
1215
|
+
ShowSubtitle,
|
|
1179
1216
|
// State management
|
|
1180
1217
|
ClearNotify,
|
|
1181
1218
|
ClearCenterprint,
|