Compare commits
5 Commits
14645dbc90
...
13aeceeedd
Author | SHA1 | Date | |
---|---|---|---|
13aeceeedd | |||
7b28cd0777 | |||
ec982d10c3 | |||
f3ec32384a | |||
07dca46c92 |
@ -371,19 +371,37 @@ local function findMap(player, ...)
|
||||
return
|
||||
end
|
||||
|
||||
local hell = "\x85HELL"
|
||||
local tol = {
|
||||
[TOL_SP] = "\x81Race\x80", -- Nuked race maps
|
||||
[TOL_COOP] = "\x8D\Battle\x80", -- Nuked battle maps
|
||||
[TOL_RACE] = "\x88Race\x80",
|
||||
[TOL_MATCH] = "\x87\Battle\x80"
|
||||
}
|
||||
local lvltype, map
|
||||
|
||||
for i = 1, #mapheaderinfo do
|
||||
local map = mapheaderinfo[i]
|
||||
map = mapheaderinfo[i]
|
||||
if map == nil then
|
||||
continue
|
||||
end
|
||||
|
||||
if map.lvlttl:lower():find(search:lower()) then
|
||||
-- Only care for up to TOL_MATCH (0x10)
|
||||
lvltype = tol[map.typeoflevel & 0x1F] or map.typeoflevel
|
||||
|
||||
-- If not battle print numlaps
|
||||
lvltype = (map.typeoflevel & (TOL_MATCH | TOL_COOP) and lvltype) or string.format("%s \x82%-2d\x80", lvltype, map.numlaps)
|
||||
|
||||
CONS_Printf(
|
||||
player,
|
||||
string.format(
|
||||
"%s - %s",
|
||||
"%s %-9s %-25s - %s\t%s",
|
||||
G_BuildMapName(i),
|
||||
map.lvlttl
|
||||
lvltype,
|
||||
map.lvlttl,
|
||||
map.subttl,
|
||||
(map.menuflags & LF2_HIDEINMENU and hell) or ""
|
||||
)
|
||||
)
|
||||
end
|
||||
@ -395,8 +413,6 @@ local function mapNotExists(player, map)
|
||||
CONS_Printf(player, string.format("Map doesn't exist: %s", map:upper()))
|
||||
end
|
||||
|
||||
local ALPH = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
|
||||
|
||||
local function changelevel(player, ...)
|
||||
if not doyoudare(player) then
|
||||
return
|
||||
@ -418,6 +434,8 @@ local function changelevel(player, ...)
|
||||
end
|
||||
|
||||
local mapnum = 0
|
||||
local A = string.byte("A")
|
||||
|
||||
if tonumber(p) != nil then
|
||||
-- Non extended map numbers
|
||||
if tonumber(q) == nil then
|
||||
@ -427,11 +445,12 @@ local function changelevel(player, ...)
|
||||
mapnum = tonumber(p) * 10 + tonumber(q)
|
||||
else
|
||||
--Extended map numbers
|
||||
p = ALPH:find(p) - 1
|
||||
p = string.byte(p) - A
|
||||
local qn = tonumber(q)
|
||||
if qn == nil then
|
||||
qn = ALPH:find(q) + 9
|
||||
qn = string.byte(q) - A + 10
|
||||
end
|
||||
|
||||
mapnum = 36 * p + qn + 100
|
||||
end
|
||||
|
||||
@ -440,6 +459,12 @@ local function changelevel(player, ...)
|
||||
return
|
||||
end
|
||||
|
||||
-- Verify valid race level
|
||||
if not (mapheaderinfo[mapnum].typeoflevel & (TOL_SP | TOL_RACE)) then
|
||||
CONS_Printf(player, "Battle maps are not supported")
|
||||
return
|
||||
end
|
||||
|
||||
nextMap = G_BuildMapName(mapnum)
|
||||
end
|
||||
COM_AddCommand("changelevel", changelevel)
|
||||
@ -1152,11 +1177,13 @@ local function getGamer()
|
||||
end
|
||||
end
|
||||
|
||||
local function changeMap()
|
||||
COM_BufInsertText(server, "map " + nextMap + " -force -gametype race")
|
||||
nextMap = nil
|
||||
end
|
||||
|
||||
local function think()
|
||||
if nextMap then
|
||||
COM_BufInsertText(server, "map " + nextMap)
|
||||
nextMap = nil
|
||||
end
|
||||
if nextMap then changeMap() end
|
||||
|
||||
if disable then
|
||||
if AntiAFK then
|
||||
@ -1309,10 +1336,7 @@ end
|
||||
addHook("ThinkFrame", think)
|
||||
|
||||
local function interThink()
|
||||
if nextMap then
|
||||
COM_BufInsertText(server, "map " + nextMap)
|
||||
nextMap = nil
|
||||
end
|
||||
if nextMap then changeMap() end
|
||||
|
||||
if not cv_teamchange then
|
||||
cv_teamchange = CV_FindVar("allowteamchange")
|
||||
|
Loading…
x
Reference in New Issue
Block a user