quake2ts 0.0.206 → 0.0.208

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "quake2ts",
3
- "version": "0.0.206",
3
+ "version": "0.0.208",
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",
@@ -171,23 +171,22 @@ var MessageSystem = class {
171
171
  clearCenterPrint() {
172
172
  this.centerPrintMsg = null;
173
173
  }
174
- drawCenterPrint(renderer, now, layout) {
174
+ drawCenterPrint(cgi3, now, layout) {
175
175
  if (!this.centerPrintMsg) return;
176
176
  if (now > this.centerPrintMsg.startTime + this.centerPrintMsg.duration) {
177
177
  this.centerPrintMsg = null;
178
178
  return;
179
179
  }
180
- this.centerPrintMsg.text.length * 8;
181
180
  const y = layout.CENTER_PRINT_Y;
182
- renderer.drawCenterString(y, this.centerPrintMsg.text);
181
+ cgi3.SCR_DrawCenterString(y, this.centerPrintMsg.text);
183
182
  }
184
- drawNotifications(renderer, now) {
183
+ drawNotifications(cgi3, now) {
185
184
  while (this.notifyMessages.length > 0 && now > this.notifyMessages[0].startTime + this.notifyMessages[0].duration) {
186
185
  this.notifyMessages.shift();
187
186
  }
188
187
  let y = 10;
189
188
  for (const msg of this.notifyMessages) {
190
- renderer.drawString(10, y, msg.text);
189
+ cgi3.SCR_DrawFontString(10, y, msg.text);
191
190
  y += 10;
192
191
  }
193
192
  }
@@ -230,8 +229,7 @@ var Draw_StatusBar = (cgi3, ps, hudNumberPics2, numberWidth2, timeMs, layout) =>
230
229
  const health = ps.stats[shared.PlayerStat.STAT_HEALTH] || 0;
231
230
  const armor = ps.stats[shared.PlayerStat.STAT_ARMOR] || 0;
232
231
  const ammo = ps.stats[shared.PlayerStat.STAT_AMMO] || 0;
233
- ps.stats[shared.PlayerStat.STAT_ARMOR_ICON] || 0;
234
- ps.stats[shared.PlayerStat.STAT_AMMO_ICON] || 0;
232
+ const armorIconIdx = ps.stats[shared.PlayerStat.STAT_ARMOR_ICON] || 0;
235
233
  let healthColor = void 0;
236
234
  if (health <= 25) {
237
235
  {
@@ -243,11 +241,31 @@ var Draw_StatusBar = (cgi3, ps, hudNumberPics2, numberWidth2, timeMs, layout) =>
243
241
  Draw_Number(cgi3, layout.ARMOR_X, layout.ARMOR_Y, armor, hudNumberPics2, numberWidth2);
244
242
  Draw_Number(cgi3, layout.AMMO_X, layout.AMMO_Y, ammo, hudNumberPics2, numberWidth2);
245
243
  }
244
+ if (armorIconIdx > 0) {
245
+ const iconName = cgi3.get_configstring(shared.ConfigStringIndex.Images + armorIconIdx);
246
+ if (iconName) {
247
+ const icon = cgi3.Draw_RegisterPic(iconName);
248
+ if (icon) {
249
+ cgi3.SCR_DrawPic(layout.ARMOR_X - 24, layout.ARMOR_Y - 2, icon);
250
+ }
251
+ }
252
+ }
246
253
  if (ps.pickupIcon) {
247
254
  const icon = cgi3.Draw_RegisterPic(ps.pickupIcon);
248
255
  if (icon) {
249
256
  cgi3.SCR_DrawPic(layout.WEAPON_ICON_X, layout.WEAPON_ICON_Y, icon);
250
257
  }
258
+ } else {
259
+ const selectedIconIdx = ps.stats[shared.PlayerStat.STAT_SELECTED_ICON] || 0;
260
+ if (selectedIconIdx > 0) {
261
+ const iconName = cgi3.get_configstring(shared.ConfigStringIndex.Images + selectedIconIdx);
262
+ if (iconName) {
263
+ const icon = cgi3.Draw_RegisterPic(iconName);
264
+ if (icon) {
265
+ cgi3.SCR_DrawPic(layout.WEAPON_ICON_X, layout.WEAPON_ICON_Y, icon);
266
+ }
267
+ }
268
+ }
251
269
  }
252
270
  };
253
271
 
@@ -327,6 +345,8 @@ function CG_DrawHUD(isplit, data, hud_vrect, hud_safe, scale2, playernum, ps) {
327
345
  y += 16;
328
346
  }
329
347
  }
348
+ messageSystem.drawCenterPrint(cgi, timeMs, layout);
349
+ messageSystem.drawNotifications(cgi, timeMs);
330
350
  Draw_Crosshair(cgi, hud_vrect.width, hud_vrect.height);
331
351
  }
332
352
  function CG_GetMessageSystem() {