Compare commits
2 Commits
e6aac8b7a1
...
dfecef7225
Author | SHA1 | Date | |
---|---|---|---|
dfecef7225 | |||
e03c9beecc |
@ -1221,9 +1221,45 @@ local function writeStats()
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
local function saveTime(player)
|
local function checkFlags(p)
|
||||||
|
local flags = 0
|
||||||
|
|
||||||
scoreTable = $ or {}
|
-- Encore
|
||||||
|
if encoremode then
|
||||||
|
flags = $ | F_ENCORE
|
||||||
|
end
|
||||||
|
|
||||||
|
if not cv_spbatk then
|
||||||
|
cv_spbatk = CV_FindVar("spbatk")
|
||||||
|
end
|
||||||
|
|
||||||
|
-- SPBAttack
|
||||||
|
if server.SPBArunning and cv_spbatk.value then
|
||||||
|
flags = $ | F_SPBATK
|
||||||
|
|
||||||
|
if server.SPBAexpert then
|
||||||
|
flags = $ | F_SPBEXP
|
||||||
|
end
|
||||||
|
if p.SPBAKARTBIG then
|
||||||
|
flags = $ | F_SPBBIG
|
||||||
|
end
|
||||||
|
if p.SPBAjustice then
|
||||||
|
flags = $ | F_SPBJUS
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
return flags
|
||||||
|
end
|
||||||
|
|
||||||
|
local function saveTime(player)
|
||||||
|
-- Disqualify if the flags changed mid trial.
|
||||||
|
if checkFlags(player) != Flags then
|
||||||
|
print("Game mode change detected! Time has been disqualified.")
|
||||||
|
S_StartSound(nil, 110)
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
scoreTable = $ or {}
|
||||||
|
|
||||||
local pskin = skins[player.mo.skin]
|
local pskin = skins[player.mo.skin]
|
||||||
local newscore = score_t(
|
local newscore = score_t(
|
||||||
@ -1387,13 +1423,7 @@ local function think()
|
|||||||
end
|
end
|
||||||
|
|
||||||
-- Autospec
|
-- Autospec
|
||||||
-- Encore
|
|
||||||
if leveltime == 1 then
|
if leveltime == 1 then
|
||||||
Flags = $ & !F_ENCORE
|
|
||||||
if encoremode then
|
|
||||||
Flags = $ | F_ENCORE
|
|
||||||
end
|
|
||||||
|
|
||||||
if p then
|
if p then
|
||||||
for s in players.iterate do
|
for s in players.iterate do
|
||||||
if s.valid and s.spectator then
|
if s.valid and s.spectator then
|
||||||
@ -1402,49 +1432,30 @@ local function think()
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
if not cv_spbatk then
|
|
||||||
cv_spbatk = CV_FindVar("spbatk")
|
|
||||||
end
|
|
||||||
|
|
||||||
-- Gamemode flags
|
Flags = 0
|
||||||
Flags = $ & !(F_SPBATK | F_SPBEXP | F_SPBBIG | F_SPBJUS)
|
if leveltime > START_TIME - (3 * TICRATE) / 2 then
|
||||||
if server.SPBArunning
|
|
||||||
and cv_spbatk.value
|
|
||||||
and leveltime > START_TIME - (3 * TICRATE) / 2 then
|
|
||||||
Flags = $ | F_SPBATK
|
|
||||||
if server.SPBAexpert then
|
|
||||||
Flags = $ | F_SPBEXP
|
|
||||||
end
|
|
||||||
if clearcheats then
|
if clearcheats then
|
||||||
clearcheats = false
|
clearcheats = false
|
||||||
for q in players.iterate do
|
if p then
|
||||||
q.SPBAKARTBIG = false
|
p.SPBAKARTBIG = false
|
||||||
q.SPBAjustice = false
|
p.SPBAjustice = false
|
||||||
q.SPBAshutup = false
|
p.SPBAshutup = false
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
if p then
|
Flags = checkFlags(p)
|
||||||
if p.SPBAKARTBIG then
|
|
||||||
Flags = $ | F_SPBBIG
|
|
||||||
end
|
|
||||||
if p.SPBAjustice then
|
|
||||||
Flags = $ | F_SPBJUS
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
-- make sure the spb actually spawned
|
-- make sure the spb actually spawned
|
||||||
if leveltime == START_TIME - 1 then
|
if server.SPBArunning and leveltime == START_TIME - 1 then
|
||||||
if not (server.SPBAbomb and server.SPBAbomb.valid) then
|
if not (server.SPBAbomb and server.SPBAbomb.valid) then
|
||||||
-- it didn't spawn, clear spb flags
|
-- it didn't spawn, clear spb flags
|
||||||
Flags = $ & !(F_SPBATK | F_SPBEXP | F_SPBBIG | F_SPBJUS)
|
Flags = $ & !(F_SPBATK | F_SPBEXP | F_SPBBIG | F_SPBJUS)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
else
|
else
|
||||||
hud.enable("freeplay")
|
hud.enable("freeplay")
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
scoreTable = getScoreTable(gamemap, Flags)
|
scoreTable = getScoreTable(gamemap, Flags)
|
||||||
@ -1454,6 +1465,12 @@ local function think()
|
|||||||
end
|
end
|
||||||
|
|
||||||
if p then
|
if p then
|
||||||
|
-- must be done before browser control
|
||||||
|
if p.laps >= mapheaderinfo[gamemap].numlaps and timeFinished == 0 then
|
||||||
|
timeFinished = p.realtime
|
||||||
|
saveTime(p)
|
||||||
|
end
|
||||||
|
|
||||||
-- Scroll controller
|
-- Scroll controller
|
||||||
-- Spectators can't input buttons so let the gamer do it
|
-- Spectators can't input buttons so let the gamer do it
|
||||||
if drawState == DS_SCROLL then
|
if drawState == DS_SCROLL then
|
||||||
@ -1478,7 +1495,7 @@ local function think()
|
|||||||
end
|
end
|
||||||
|
|
||||||
-- disable spba hud
|
-- disable spba hud
|
||||||
if server.SPBAdone then
|
if server.SPBArunning and server.SPBAdone then
|
||||||
server.SPBArunning = false
|
server.SPBArunning = false
|
||||||
p.pflags = $ & !(PF_TIMEOVER)
|
p.pflags = $ & !(PF_TIMEOVER)
|
||||||
p.exiting = 100
|
p.exiting = 100
|
||||||
@ -1509,10 +1526,6 @@ local function think()
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
if p.laps >= mapheaderinfo[gamemap].numlaps and timeFinished == 0 then
|
|
||||||
timeFinished = p.realtime
|
|
||||||
saveTime(p)
|
|
||||||
end
|
|
||||||
regLap(p)
|
regLap(p)
|
||||||
elseif cv_teamchange.value == 0 then
|
elseif cv_teamchange.value == 0 then
|
||||||
allowJoin(true)
|
allowJoin(true)
|
||||||
|
Loading…
Reference in New Issue
Block a user