Skip to content

Commit e990beb

Browse files
committed
fix: timer now starts on screen fade-in
1 parent df73806 commit e990beb

File tree

1 file changed

+24
-25
lines changed

1 file changed

+24
-25
lines changed

waw-split.gsc

Lines changed: 24 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -4,17 +4,20 @@
44

55
init()
66
{
7-
7+
88
// ============================================================================================================
99
// _ __ _ __ _____ ____ __ __________
1010
// | | / /___ | | / / / ___// __ \/ / / _/_ __/
11-
// | | /| / / __ `/ | /| / / ______ \__ \/ /_/ / / / / / / WaW-Split (Version 1)
11+
// | | /| / / __ `/ | /| / / ______ \__ \/ /_/ / / / / / / WaW-Split (Version 1.1)
1212
// | |/ |/ / /_/ /| |/ |/ / /_____/ ___/ / ____/ /____/ / / /
1313
// |__/|__/\__,_/ |__/|__/ /____/_/ /_____/___/ /_/
1414
//
1515
//
16-
// Customizable speedrun split timer for World at War (Plutonium) w/ optional backspeed fix
17-
// Complies with ZWR world record rules: https://zwr.gg/rules/#section-21
16+
// Customizable speedrun split timer for World at War (Plutonium) w/ optional backspeed fix.
17+
// Complies with ZWR world record rules:
18+
// https://zwr.gg/rules/#section-1
19+
// https://zwr.gg/rules/#section-19
20+
// https://zwr.gg/leaderboards/waw/100-speedrun/shi-no-numa/
1821
//
1922
// ============================================== TIMER SETTINGS ============================================
2023
//
@@ -29,12 +32,12 @@ init()
2932
// Color values are (RED, GREEN, YELLOW) each with a value between 0.0 and 1.0
3033
// Alpha values are between 0.0 and 1.0
3134

32-
level.FIX_BACKSPEED = true; // Disable this to revert the backspeed fix
35+
level.FIX_BACKSPEED = true; // Disable this to revert the backspeed fix
3336

34-
level.HUD_X_COORD = -100; // Move the timer HUD on X axis (left=negative, right=positive)
35-
level.HUD_Y_COORD = 0; // Move the timer HUD on Y axis (up=negative, down=positive)
36-
level.HUD_COL_SPACING = 70; // Space between the label/value columns
37-
level.HUD_ROW_SPACING = 10; // Space between the data rows
37+
level.HUD_X_COORD = -100; // Move the timer on X axis (left=negative)
38+
level.HUD_Y_COORD = 0; // Move the timer on Y axis (up=negative)
39+
level.HUD_COL_SPACING = 70; // Space between the label/value columns
40+
level.HUD_ROW_SPACING = 10; // Space between the data rows
3841

3942
level.GAME_TIME_COLOR = (1, 0, 0);
4043
level.GAME_TIME_ALPHA = 1;
@@ -51,11 +54,11 @@ init()
5154
level.HISTORY_ALPHA = 0.9;
5255
level.HISTORY_LABEL_TEXT = "Round";
5356
level.HISTORY_LABEL_DELIMITER = ":";
54-
55-
level.MILESTONES_HIDDEN = false; // Hide the Round milestones section
56-
level.MILESTONES = []; // Cumulative time will show on HUD upon reaching certain rounds
57-
level.MILESTONES[0] = 10; // Usefull for world record attempts (30, 50, 70, 100)
58-
level.MILESTONES[1] = 30; // WARNING: Don't add too many! keep [index] increasing by 1
57+
58+
level.MILESTONES_HIDDEN = false; // Hide the Round milestones section
59+
level.MILESTONES = []; // Cumulative time will show on HUD upon reaching certain rounds
60+
level.MILESTONES[0] = 10; // Usefull for world record attempts (ex: 30, 50, 70, 100)
61+
level.MILESTONES[1] = 30; // WARNING: Don't add too many! keep [index] increasing by 1
5962
level.MILESTONES[2] = 50;
6063
level.MILESTONES[3] = 70;
6164
level.MILESTONES[4] = 100;
@@ -83,8 +86,6 @@ game_timer()
8386
hud.alpha = level.GAME_TIME_ALPHA;
8487
hud.color = level.GAME_TIME_COLOR;
8588
hud.fontscale = 2;
86-
hud SetText("--:--");
87-
level waittill("round_transition");
8889
hud setTimerUp(0);
8990
}
9091

@@ -101,7 +102,6 @@ round_timer()
101102
label.alpha = level.ROUND_TIME_ALPHA;
102103
label.color = level.ROUND_TIME_LABEL_COLOR;
103104
label.fontscale = 1;
104-
label SetText("Round starting...");
105105

106106
time = create_simple_hud( self );
107107
time.foreground = true;
@@ -116,15 +116,18 @@ round_timer()
116116
time.fontscale = 1;
117117

118118
roundHistory = spawnStruct();
119-
level waittill("round_transition");
120119
init_round_history(roundHistory);
121120

122121
for (;;)
123122
{
124-
currentRound = level.round_number;
125123
time setTimerUp(0);
126124
roundStart = GetTime() / 1000;
125+
currentRound = level.round_number;
126+
if (!isdefined(currentRound)) currentRound = 1;
127127
label SetText(level.HISTORY_LABEL_TEXT + " " + currentRound + level.HISTORY_LABEL_DELIMITER);
128+
129+
// Don't do anything when starting round 1
130+
if (currentRound == 1) level waittill("round_transition");
128131
level waittill("round_transition");
129132

130133
if (level.HISTORY_MAX_COUNT == 0) continue;
@@ -201,7 +204,6 @@ milestone_timers()
201204

202205
init_round_history(roundHistory)
203206
{
204-
// Crude circular queue implementation to store limited round history
205207
roundHistory.queue = [];
206208

207209
// Index starts at last position and becomes 0 on round 1
@@ -327,12 +329,11 @@ patch_notifier()
327329
{
328330
backspeedStatus = "+ backspeed ";
329331
}
330-
hud SetText("Custom timer " + backspeedStatus + "patch in use (WaW-Split v1)");
332+
hud SetText("Custom timer " + backspeedStatus + "patch in use (waw-split v1.1)");
331333
wait(10);
332334
hud destroy();
333335
}
334336

335-
// Not the best way to do this but it works for all maps and is accurate enough
336337
round_monitor()
337338
{
338339
for (;;) {
@@ -357,14 +358,12 @@ on_connect()
357358
on_player_spawned()
358359
{
359360
level waittill("connected", player);
360-
361-
// Custom timer functions
362361
self thread round_monitor();
363362
self thread game_timer();
364363
if (!level.ROUND_TIME_HIDDEN) self thread round_timer();
365364
if (!level.MILESTONES_HIDDEN) self thread milestone_timers();
366365

367-
// Backspeed fix - (enforce the default values)
366+
// Backspeed fix (enforce the default values first)
368367
self SetClientDvars("player_backSpeedScale", "0.7", "player_strafeSpeedScale", "0.8");
369368
if(level.FIX_BACKSPEED)
370369
{

0 commit comments

Comments
 (0)