Skip to content

Commit e701692

Browse files
author
newby
committed
Remove legacy timer implementation
1 parent bb266f1 commit e701692

File tree

1 file changed

+2
-44
lines changed

1 file changed

+2
-44
lines changed

csqc/events.qc

+2-44
Original file line numberDiff line numberDiff line change
@@ -317,30 +317,6 @@ string GetGrenTimerSound() {
317317
return wav;
318318
}
319319

320-
void OldPlayGren(float offset) {
321-
local float channel = CHAN_GREN_START;
322-
local float soundtime;
323-
local float highest_soundtime = -1;
324-
325-
for(float i = CHAN_GREN_START; i <= CHAN_GREN_END; i++) {
326-
soundtime = getsoundtime(world, i);
327-
328-
if (soundtime < 0) {
329-
channel = i;
330-
break;
331-
}
332-
333-
if (soundtime > highest_soundtime) {
334-
highest_soundtime = soundtime;
335-
channel = i;
336-
}
337-
}
338-
339-
local string wav = GetGrenTimerSound();
340-
localsound(wav, channel, CVARF(FOCMD_GRENTIMERVOLUME)); // required because soundupdate doesn't reset getsoundtime
341-
soundupdate(self, channel, wav, CVARF(FOCMD_GRENTIMERVOLUME), 0, 0, 0, offset);
342-
}
343-
344320
void CsGrenTimer::Set(float primed_at, float expires_at, float _grentype,
345321
float timer_flags) {
346322
grentype_ = _grentype;
@@ -377,11 +353,6 @@ void StopGrenTimers() {
377353
// New style.
378354
for (float i = 0; i < NUM_GREN_TIMERS; i++)
379355
grentimers[i].Stop();
380-
381-
// Old style.
382-
for (float i = CHAN_GREN_START; i <= CHAN_GREN_END; i++) {
383-
soundupdate(self, i, "", 0, 0, 0, 0, 0);
384-
}
385356
}
386357

387358
void ParseGrenPrimed(float grentype, float primed_at, float explodes_at) {
@@ -400,32 +371,19 @@ void ParseGrenPrimed(float grentype, float primed_at, float explodes_at) {
400371
}
401372

402373
float debug_print_state = CVARF(fo_grentimer_debug) & 1;
403-
float debug_use_old_sound = CVARF(fo_grentimer_debug) & 4;
404-
405-
float play_old_sound = FALSE;
406-
if (debug_use_old_sound) {
407-
play_old_sound = timer_flags & FL_GT_SOUND;
408-
timer_flags &= ~FL_GT_SOUND;
409-
}
410374

411375
CsGrenTimer timer = CsGrenTimer::GetNext();
412376
timer.Set(primed_at, explodes_at, grentype, timer_flags);
413377

414-
if (play_old_sound)
415-
OldPlayGren(timer.sound_offset());
416-
417378
if (debug_print_state) {
418379
float ping = getplayerkeyfloat(player_localnum, INFOKEY_P_PING) / 1000;
419380

420381
float expires_old = time + 3.8 - ping;
421382
float expires_new = timer.expiry();
422383
float expires_ideal = explodes_at - ping/2;
423384

424-
print(sprintf("primed_at=%0.2f explodes_at=%0.2f fuse=%0.2f new=%d\n",
425-
primed_at, explodes_at, explodes_at - primed_at,
426-
!debug_use_old_sound));
427-
print(sprintf("ideal=%0.2f new=%0.2f old=%0.2f\n",
428-
expires_ideal, expires_new, expires_old));
385+
print(sprintf("primed_at=%0.2f explodes_at=%0.2f fuse=%0.2f\n",
386+
primed_at, explodes_at, explodes_at - primed_at));
429387
}
430388
}
431389

0 commit comments

Comments
 (0)