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