Merge branch 'master' of github.com:GreYFoXGTi/DDRace

This commit is contained in:
GreYFoXGTi 2010-12-16 04:11:02 +02:00
commit 73dbc159bc
101 changed files with 2552 additions and 980 deletions

9
.gitignore vendored
View file

@ -28,4 +28,11 @@ DDRace_Trunk_d*
*.patch
*.prefs
*.lnk
*.pdb
*.pdb
*.sdf
*.sln
*.suo
*.vcxproj
*.filters
*.user
*.cmd

View file

@ -1,43 +0,0 @@
Dear Mac OSX User...
to get this mod compiled with MySQL on a Mac running OSX 10.5 or newer you need to download and unzip three little things first.
1. Download:
* the appropiate Version (e.g. 32 vs. 64 bit) of the MySQL Community Server at
http://www.mysql.com/downloads/mysql/
* the appropiate Version (e.g. 32 vs. 64 bit) of the MySQL Connector/C++ at
http://www.mysql.com/downloads/connector/cpp/
* boost at (the connector needs it)
http://www.boost.org/
2. Unzip:
* the MySQL Community Server files and move them to
/usr/local/mysql/
* Unzip the MySQL Connector/C++ files and move them to
/usr/local/mysql/
* Unzip the boost files and move the boost folder >inside of< boost to (it will be a collection of header files) to
/usr/local/mysql/includes
Of course you could extract only the needed lib and header files and put them somewhere else (e.g. in your teeworlds folder) but above solution is intended to be easy and quick to apply.
Thanks for reading
Allisone
DDRace README is as follows
This is a mod (DDRace) and it's for the game Teeworlds and it's being maintained by GreYFoX@GTi & btd with the help of others like heinrich5991 & 3da, in the previous versions Floff, noother and Fluxid.
DDRace has been rebuilt from scratch by btd based on DDRace-Beta to Teeworlds Trunk 0.5, GreYFoX@GTi helped re-adding features once it was Trunk, you can track this in the commit log.
Teeworlds README is as follows:
Copyright (c) 2010 Magnus Auvinen
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
arising from the use of this software.
Please visit http://www.teeworlds.com for up-to-date information about
the game, including new versions, custom maps and much more

View file

@ -1 +1,2 @@
Please Visit DDRace.info to report any bugs Thanks
#This File must always have a line break at the end of file

View file

@ -1,327 +0,0 @@
CheckVersion("0.4")
Import("configure.lua")
Import("other/sdl/sdl.lua")
Import("other/freetype/freetype.lua")
--- Setup Config -------
config = NewConfig()
config:Add(OptCCompiler("compiler"))
config:Add(OptTestCompileC("stackprotector", "int main(){return 0;}", "-fstack-protector -fstack-protector-all"))
config:Add(OptLibrary("zlib", "zlib.h", false))
config:Add(SDL.OptFind("sdl", true))
config:Add(FreeType.OptFind("freetype", true))
config:Finalize("config.lua")
-- data compiler
function Script(name)
if family == "windows" then
return str_replace(name, "/", "\\")
end
return "python " .. name
end
function CHash(output, ...)
local inputs = TableFlatten({...})
output = Path(output)
-- compile all the files
local cmd = Script("scripts/cmd5.py") .. " "
for index, inname in ipairs(inputs) do
cmd = cmd .. Path(inname) .. " "
end
cmd = cmd .. " > " .. output
AddJob(output, "cmd5 " .. output, cmd)
for index, inname in ipairs(inputs) do
AddDependency(output, inname)
end
AddDependency(output, "scripts/cmd5.py")
return output
end
--[[
function DuplicateDirectoryStructure(orgpath, srcpath, dstpath)
for _,v in pairs(CollectDirs(srcpath .. "/")) do
MakeDirectory(dstpath .. "/" .. string.sub(v, string.len(orgpath)+2))
DuplicateDirectoryStructure(orgpath, v, dstpath)
end
end
DuplicateDirectoryStructure("src", "src", "objs")
]]
function ResCompile(scriptfile)
scriptfile = Path(scriptfile)
if config.compiler.driver == "cl" then
output = PathBase(scriptfile) .. ".res"
AddJob(output, "rc " .. scriptfile, "rc /fo " .. output .. " " .. scriptfile)
elseif config.compiler.driver == "gcc" then
output = PathBase(scriptfile) .. ".coff"
AddJob(output, "windres " .. scriptfile, "windres -i " .. scriptfile .. " -o " .. output)
end
AddDependency(output, scriptfile)
return output
end
function Dat2c(datafile, sourcefile, arrayname)
datafile = Path(datafile)
sourcefile = Path(sourcefile)
AddJob(
sourcefile,
"dat2c " .. PathFilename(sourcefile) .. " = " .. PathFilename(datafile),
Script("scripts/dat2c.py").. "\" " .. sourcefile .. " " .. datafile .. " " .. arrayname
)
AddDependency(sourcefile, datafile)
return sourcefile
end
function ContentCompile(action, output)
output = Path(output)
AddJob(
output,
action .. " > " .. output,
--Script("datasrc/compile.py") .. "\" ".. Path(output) .. " " .. action
Script("datasrc/compile.py") .. " " .. action .. " > " .. Path(output)
)
AddDependency(output, Path("datasrc/content.py")) -- do this more proper
AddDependency(output, Path("datasrc/network.py"))
AddDependency(output, Path("datasrc/compile.py"))
AddDependency(output, Path("datasrc/datatypes.py"))
return output
end
-- Content Compile
network_source = ContentCompile("network_source", "src/game/generated/protocol.cpp")
network_header = ContentCompile("network_header", "src/game/generated/protocol.h")
client_content_source = ContentCompile("client_content_source", "src/game/generated/client_data.cpp")
client_content_header = ContentCompile("client_content_header", "src/game/generated/client_data.h")
server_content_source = ContentCompile("server_content_source", "src/game/generated/server_data.cpp")
server_content_header = ContentCompile("server_content_header", "src/game/generated/server_data.h")
AddDependency(network_source, network_header)
AddDependency(client_content_source, client_content_header)
AddDependency(server_content_source, server_content_header)
nethash = CHash("src/game/generated/nethash.c", "src/engine/shared/protocol.h", "src/game/generated/protocol.h", "src/game/tuning.h", "src/game/gamecore.cpp", network_header)
client_link_other = {}
client_depends = {}
if family == "windows" then
table.insert(client_depends, CopyToDirectory(".", "other\\sdl\\vc2005libs\\SDL.dll"))
if config.compiler.driver == "cl" then
client_link_other = {ResCompile("other/icons/teeworlds_cl.rc")}
elseif config.compiler.driver == "gcc" then
client_link_other = {ResCompile("other/icons/teeworlds_gcc.rc")}
end
end
function Intermediate_Output(settings, input)
return "objs/" .. string.sub(PathBase(input), string.len("src/")+1) .. settings.config_ext
end
function build(settings)
--settings.objdir = Path("objs")
settings.cc.Output = Intermediate_Output
if config.compiler.driver == "cl" then
settings.cc.flags:Add("/wd4244")
settings.cc.flags:Add("/EHsc")
else
settings.cc.flags:Add("-Wall")
if platform == "macosx" then
settings.cc.flags:Add("-mmacosx-version-min=10.4", "-isysroot /Developer/SDKs/MacOSX10.4u.sdk")
settings.link.flags:Add("-mmacosx-version-min=10.4", "-isysroot /Developer/SDKs/MacOSX10.4u.sdk")
elseif config.stackprotector.value == 1 then
settings.cc.flags:Add("-fstack-protector", "-fstack-protector-all")
settings.link.flags:Add("-fstack-protector", "-fstack-protector-all")
end
end
-- set some platform specific settings
settings.cc.includes:Add("src")
if family == "unix" then
if platform == "macosx" then
settings.link.frameworks:Add("Carbon")
settings.link.frameworks:Add("AppKit")
else
settings.link.libs:Add("pthread")
end
elseif family == "windows" then
settings.link.flags:Add("/FORCE:MULTIPLE")
settings.link.libs:Add("gdi32")
settings.link.libs:Add("user32")
settings.link.libs:Add("ws2_32")
settings.link.libs:Add("ole32")
settings.link.libs:Add("shell32")
end
-- compile zlib if needed
if config.zlib.value == 1 then
settings.link.libs:Add("z")
if config.zlib.include_path then
settings.cc.includes:Add(config.zlib.include_path)
end
zlib = {}
else
zlib = Compile(settings, Collect("src/engine/external/zlib/*.c"))
settings.cc.includes:Add("src/engine/external/zlib")
end
-- build the small libraries
wavpack = Compile(settings, Collect("src/engine/external/wavpack/*.c"))
pnglite = Compile(settings, Collect("src/engine/external/pnglite/*.c"))
-- build game components
engine_settings = settings:Copy()
server_settings = engine_settings:Copy()
client_settings = engine_settings:Copy()
launcher_settings = engine_settings:Copy()
if family == "unix" then
if platform == "macosx" then
client_settings.link.frameworks:Add("OpenGL")
client_settings.link.frameworks:Add("AGL")
client_settings.link.frameworks:Add("Carbon")
client_settings.link.frameworks:Add("Cocoa")
launcher_settings.link.frameworks:Add("Cocoa")
else
client_settings.link.libs:Add("X11")
client_settings.link.libs:Add("GL")
client_settings.link.libs:Add("GLU")
end
elseif family == "windows" then
client_settings.link.libs:Add("opengl32")
client_settings.link.libs:Add("glu32")
client_settings.link.libs:Add("winmm")
end
-- apply sdl settings
config.sdl:Apply(client_settings)
-- apply freetype settings
config.freetype:Apply(client_settings)
engine = Compile(engine_settings, Collect("src/engine/shared/*.cpp", "src/base/*.c"))
client = Compile(client_settings, Collect("src/engine/client/*.cpp"))
server = Compile(server_settings, Collect("src/engine/server/*.cpp"))
versionserver = Compile(settings, Collect("src/versionsrv/*.cpp"))
masterserver = Compile(settings, Collect("src/mastersrv/*.cpp"))
game_shared = Compile(settings, Collect("src/game/*.cpp"), nethash, network_source)
game_client = Compile(settings, CollectRecursive("src/game/client/*.cpp"), client_content_source)
game_server = Compile(settings, CollectRecursive("src/game/server/*.cpp"), server_content_source)
game_editor = Compile(settings, Collect("src/game/editor/*.cpp"))
-- build tools (TODO: fix this so we don't get double _d_d stuff)
tools_src = Collect("src/tools/*.cpp", "src/tools/*.c")
client_osxlaunch = {}
server_osxlaunch = {}
if platform == "macosx" then
client_osxlaunch = Compile(client_settings, "src/osxlaunch/client.m")
server_osxlaunch = Compile(launcher_settings, "src/osxlaunch/server.m")
end
tools = {}
for i,v in ipairs(tools_src) do
toolname = PathFilename(PathBase(v))
tools[i] = Link(settings, toolname, Compile(settings, v), engine, zlib)
end
-- build client, server, version server and master server
client_exe = Link(client_settings, "DDRace_Trunk-Client", game_shared, game_client,
engine, client, game_editor, zlib, pnglite, wavpack,
client_link_other, client_osxlaunch)
server_exe = Link(server_settings, "DDRace_Trunk-Server", engine, server,
game_shared, game_server, zlib)
serverlaunch = {}
if platform == "macosx" then
serverlaunch = Link(launcher_settings, "serverlaunch", server_osxlaunch)
end
versionserver_exe = Link(server_settings, "versionsrv", versionserver,
engine, zlib)
masterserver_exe = Link(server_settings, "mastersrv", masterserver,
engine, zlib)
-- make targets
c = PseudoTarget("client".."_"..settings.config_name, client_exe, client_depends)
s = PseudoTarget("server".."_"..settings.config_name, server_exe, serverlaunch, server_depends)
g = PseudoTarget("game".."_"..settings.config_name, client_exe, server_exe)
v = PseudoTarget("versionserver".."_"..settings.config_name, versionserver_exe)
m = PseudoTarget("masterserver".."_"..settings.config_name, masterserver_exe)
t = PseudoTarget("tools".."_"..settings.config_name, tools)
all = PseudoTarget(settings.config_name, c, s, v, m, t)
return all
end
debug_settings = NewSettings()
debug_settings.config_name = "debug"
debug_settings.config_ext = "_d"
debug_settings.debug = 1
debug_settings.optimize = 0
debug_settings.cc.defines:Add("CONF_DEBUG")
release_settings = NewSettings()
release_settings.config_name = "release"
release_settings.config_ext = ""
release_settings.debug = 0
release_settings.optimize = 1
release_settings.cc.defines:Add("CONF_RELEASE")
if platform == "macosx" and arch == "ia32" then
debug_settings_ppc = debug_settings:Copy()
debug_settings_ppc.config_name = "debug_ppc"
debug_settings_ppc.config_ext = "_ppc_d"
debug_settings_ppc.cc.flags:Add("-arch ppc")
debug_settings_ppc.link.flags:Add("-arch ppc")
debug_settings_ppc.cc.defines:Add("CONF_DEBUG")
release_settings_ppc = release_settings:Copy()
release_settings_ppc.config_name = "release_ppc"
release_settings_ppc.config_ext = "_ppc"
release_settings_ppc.cc.flags:Add("-arch ppc")
release_settings_ppc.link.flags:Add("-arch ppc")
release_settings_ppc.cc.defines:Add("CONF_RELEASE")
debug_settings_x86 = debug_settings:Copy()
debug_settings_x86.config_name = "debug_x86"
debug_settings_x86.config_ext = "_x86_d"
debug_settings_x86.cc.defines:Add("CONF_DEBUG")
release_settings_x86 = release_settings:Copy()
release_settings_x86.config_name = "release_x86"
release_settings_x86.config_ext = "_x86"
release_settings_x86.cc.defines:Add("CONF_RELEASE")
ppc_d = build(debug_settings_ppc)
x86_d = build(debug_settings_x86)
ppc_r = build(release_settings_ppc)
x86_r = build(release_settings_x86)
DefaultTarget("game_debug_x86")
PseudoTarget("release", ppc_r, x86_r)
PseudoTarget("debug", ppc_d, x86_d)
PseudoTarget("server_release", "server_release_x86", "server_release_ppc")
PseudoTarget("server_debug", "server_debug_x86", "server_debug_ppc")
PseudoTarget("client_release", "client_release_x86", "client_release_ppc")
PseudoTarget("client_debug", "client_debug_x86", "client_debug_ppc")
else
build(debug_settings)
build(release_settings)
DefaultTarget("game_debug")
end

153
bam.lua
View file

@ -16,7 +16,7 @@ config:Finalize("config.lua")
-- data compiler
function Script(name)
if family == "windows" then
return str_replace(name, "/", "\\")
return str_replace(name, "/", "\\")
end
return "python " .. name
end
@ -110,13 +110,13 @@ nethash = CHash("src/game/generated/nethash.c", "src/engine/shared/protocol.h",
client_link_other = {}
client_depends = {}
server_depends = {}
server_sql_depends = {}
if family == "windows" then
table.insert(client_depends, CopyToDirectory(".", "other\\sdl\\vc2005libs\\SDL.dll"))
table.insert(server_depends, CopyToDirectory(".", "other\\mysql\\vc2005libs\\mysqlcppconn.dll"))
table.insert(server_depends, CopyToDirectory(".", "other\\mysql\\vc2005libs\\libmysql.dll"))
table.insert(server_sql_depends, CopyToDirectory(".", "other\\mysql\\vc2005libs\\mysqlcppconn.dll"))
table.insert(server_sql_depends, CopyToDirectory(".", "other\\mysql\\vc2005libs\\libmysql.dll"))
if config.compiler.driver == "cl" then
client_link_other = {ResCompile("other/icons/teeworlds_cl.rc")}
elseif config.compiler.driver == "gcc" then
@ -138,8 +138,8 @@ function build(settings)
else
settings.cc.flags:Add("-Wall")
if platform == "macosx" then
settings.cc.flags:Add("-mmacosx-version-min=10.5", "-isysroot /Developer/SDKs/MacOSX10.6.sdk")
settings.link.flags:Add("-mmacosx-version-min=10.5", "-isysroot /Developer/SDKs/MacOSX10.6.sdk")
settings.cc.flags:Add("-mmacosx-version-min=10.5", "-isysroot /Developer/SDKs/MacOSX10.5.sdk")
settings.link.flags:Add("-mmacosx-version-min=10.5", "-isysroot /Developer/SDKs/MacOSX10.5.sdk")
elseif config.stackprotector.value == 1 then
settings.cc.flags:Add("-fstack-protector", "-fstack-protector-all")
settings.link.flags:Add("-fstack-protector", "-fstack-protector-all")
@ -148,38 +148,21 @@ function build(settings)
-- set some platform specific settings
settings.cc.includes:Add("src")
settings.cc.includes:Add("other/mysql/include")
if family == "unix" then
if family == "unix" then
if platform == "macosx" then
settings.link.frameworks:Add("Carbon")
settings.link.frameworks:Add("AppKit")
settings.cc.includes:Add("/usr/local/mysql/include")
settings.cc.includes:Add("/usr/local/mysql/include/cppconn")
settings.link.libpath:Add("/usr/local/mysql/lib")
settings.link.libs:Add("mysqlcppconn-static")
settings.link.libs:Add("mysqlclient")
else
settings.link.libs:Add("pthread")
settings.cc.includes:Add("other/mysql/include")
settings.cc.includes:Add("other/mysql/include/cppconn")
if arch == "amd64" then
settings.link.libpath:Add("other/mysql/lib64")
else
settings.link.libpath:Add("other/mysql/lib32")
end
settings.link.libs:Add("mysqlcppconn-static")
settings.link.libs:Add("mysqlclient")
end
elseif family == "windows" then
settings.link.flags:Add("/FORCE:MULTIPLE")
settings.link.libs:Add("gdi32")
settings.link.libs:Add("user32")
settings.link.libs:Add("ws2_32")
settings.link.libs:Add("ole32")
settings.link.libs:Add("shell32")
settings.cc.includes:Add("other/mysql/include")
settings.link.libpath:Add("other/mysql/vc2005libs")
settings.link.libs:Add("mysqlcppconn")
end
-- compile zlib if needed
@ -205,22 +188,41 @@ function build(settings)
launcher_settings = engine_settings:Copy()
if family == "unix" then
if not string.find(settings.config_name, "nosql") then
server_settings.link.libs:Add("mysqlcppconn-static")
server_settings.link.libs:Add("mysqlclient")
end
if platform == "macosx" then
client_settings.link.frameworks:Add("OpenGL")
client_settings.link.frameworks:Add("AGL")
client_settings.link.frameworks:Add("Carbon")
client_settings.link.frameworks:Add("Cocoa")
launcher_settings.link.frameworks:Add("Cocoa")
client_settings.link.frameworks:Add("AGL")
client_settings.link.frameworks:Add("Carbon")
client_settings.link.frameworks:Add("Cocoa")
launcher_settings.link.frameworks:Add("Cocoa")
if not string.find(settings.config_name, "nosql") then
server_settings.link.libpath:Add("other/mysql/mac/lib32")
end
else
client_settings.link.libs:Add("X11")
client_settings.link.libs:Add("GL")
client_settings.link.libs:Add("GLU")
if not string.find(settings.config_name, "nosql") then
if arch == "amd64" then
server_settings.link.libpath:Add("other/mysql/linux/lib64")
else
server_settings.link.libpath:Add("other/mysql/linux/lib32")
end
end
end
elseif family == "windows" then
client_settings.link.libs:Add("opengl32")
client_settings.link.libs:Add("glu32")
client_settings.link.libs:Add("winmm")
if not string.find(settings.config_name, "nosql") then
server_settings.link.libpath:Add("other/mysql/vc2005libs")
server_settings.link.libs:Add("mysqlcppconn")
end
end
-- apply sdl settings
@ -256,11 +258,11 @@ function build(settings)
end
-- build client, server, version server and master server
client_exe = Link(client_settings, "DDRace_Trunk-Client", game_shared, game_client,
client_exe = Link(client_settings, "DDRace", game_shared, game_client,
engine, client, game_editor, zlib, pnglite, wavpack,
client_link_other, client_osxlaunch)
server_exe = Link(server_settings, "DDRace_Trunk-Server", engine, server,
server_exe = Link(server_settings, "DDRace-Server", engine, server,
game_shared, game_server, zlib)
serverlaunch = {}
@ -276,7 +278,19 @@ function build(settings)
-- make targets
c = PseudoTarget("client".."_"..settings.config_name, client_exe, client_depends)
s = PseudoTarget("server".."_"..settings.config_name, server_exe, serverlaunch, server_depends)
if string.find(settings.config_name, "nosql") then
s = PseudoTarget("server".."_"..settings.config_name, server_exe, serverlaunch)
else
if family == "windows" then
if string.find(settings.config_name, "sql") or not string.find(settings.config_name, "release") then
s = PseudoTarget("server".."_"..settings.config_name, server_exe, serverlaunch, server_sql_depends)
else
s = PseudoTarget("server".."_"..settings.config_name, server_exe, serverlaunch)
end
else
s = PseudoTarget("server".."_"..settings.config_name, server_exe, serverlaunch, server_sql_depends)
end
end
g = PseudoTarget("game".."_"..settings.config_name, client_exe, server_exe)
v = PseudoTarget("versionserver".."_"..settings.config_name, versionserver_exe)
@ -295,12 +309,40 @@ debug_settings.debug = 1
debug_settings.optimize = 0
debug_settings.cc.defines:Add("CONF_DEBUG", "CONF_SQL")
debug_nosql_settings = NewSettings()
debug_nosql_settings.config_name = "nosql_debug"
debug_nosql_settings.config_ext = "_nosql_d"
debug_nosql_settings.debug = 1
debug_nosql_settings.optimize = 0
debug_nosql_settings.cc.defines:Add("CONF_DEBUG")
release_settings = NewSettings()
release_settings.config_name = "release"
release_settings.config_ext = ""
release_settings.debug = 0
release_settings.optimize = 1
release_settings.cc.defines:Add("CONF_RELEASE", "CONF_SQL")
if family == "windows" then
release_settings.cc.defines:Add("CONF_RELEASE")
release_settings.config_ext = ""
release_nosql_settings = NewSettings()
release_nosql_settings.config_name = "sql_release"
release_nosql_settings.config_ext = "_sql"
release_nosql_settings.debug = 0
release_nosql_settings.optimize = 1
release_nosql_settings.cc.defines:Add("CONF_RELEASE", "CONF_SQL")
else
release_settings.cc.defines:Add("CONF_RELEASE", "CONF_SQL")
release_settings.config_ext = ""
release_nosql_settings = NewSettings()
release_nosql_settings.config_name = "nosql_release"
release_nosql_settings.config_ext = "_nosql"
release_nosql_settings.debug = 0
release_nosql_settings.optimize = 1
release_nosql_settings.cc.defines:Add("CONF_RELEASE")
end
if platform == "macosx" and arch == "ia32" then
debug_settings_ppc = debug_settings:Copy()
@ -310,38 +352,79 @@ if platform == "macosx" and arch == "ia32" then
debug_settings_ppc.link.flags:Add("-arch ppc")
debug_settings_ppc.cc.defines:Add("CONF_DEBUG", "CONF_SQL")
debug_nosql_settings_ppc = debug_sql_settings:Copy()
debug_nosql_settings_ppc.config_name = "nosql_debug_ppc"
debug_nosql_settings_ppc.config_ext = "_nosql_ppc_d"
debug_nosql_settings_ppc.cc.flags:Add("-arch ppc")
debug_nosql_settings_ppc.link.flags:Add("-arch ppc")
debug_nosql_settings_ppc.cc.defines:Add("CONF_DEBUG")
release_settings_ppc = release_settings:Copy()
release_settings_ppc.config_name = "release_ppc"
release_settings_ppc.config_ext = "_ppc"
release_settings_ppc.cc.flags:Add("-arch ppc")
release_settings_ppc.link.flags:Add("-arch ppc")
release_settings_ppc.cc.defines:Add("CONF_RELEASE", "CONF_SQL")
release_nosql_settings_ppc = release_sql_settings:Copy()
release_nosql_settings_ppc.config_name = "nosql_release_ppc"
release_nosql_settings_ppc.config_ext = "_nosql_ppc"
release_nosql_settings_ppc.cc.flags:Add("-arch ppc")
release_nosql_settings_ppc.link.flags:Add("-arch ppc")
release_nosql_settings_ppc.cc.defines:Add("CONF_RELEASE")
debug_settings_x86 = debug_settings:Copy()
debug_settings_x86.config_name = "debug_x86"
debug_settings_x86.config_ext = "_x86_d"
debug_settings_x86.cc.flags:Add("-arch i386")
debug_settings_x86.link.flags:Add("-arch i386")
debug_settings_x86.cc.defines:Add("CONF_DEBUG", "CONF_SQL")
debug_nosql_settings_x86 = debug_sql_settings:Copy()
debug_nosql_settings_x86.config_name = "nosql_debug_x86"
debug_nosql_settings_x86.config_ext = "_nosql_x86_d"
debug_nosql_settings_x86.cc.flags:Add("-arch i386")
debug_nosql_settings_x86.link.flags:Add("-arch i386")
debug_nosql_settings_x86.cc.defines:Add("CONF_DEBUG")
release_settings_x86 = release_settings:Copy()
release_settings_x86.config_name = "release_x86"
release_settings_x86.config_ext = "_x86"
release_settings_x86.cc.flags:Add("-arch i386")
release_settings_x86.link.flags:Add("-arch i386")
release_settings_x86.cc.defines:Add("CONF_RELEASE", "CONF_SQL")
release_nosql_settings_x86 = release_sql_settings:Copy()
release_nosql_settings_x86.config_name = "nosql_release_x86"
release_nosql_settings_x86.config_ext = "_nosql_x86"
release_nosql_settings_x86.cc.flags:Add("-arch i386")
release_nosql_settings_x86.link.flags:Add("-arch i386")
release_nosql_settings_x86.cc.defines:Add("CONF_RELEASE")
ppc_d = build(debug_settings_ppc)
x86_d = build(debug_settings_x86)
sql_ppc_d = build(debug_sql_settings_ppc)
sql_x86_d = build(debug_sql_settings_x86)
ppc_r = build(release_settings_ppc)
x86_r = build(release_settings_x86)
sql_ppc_r = build(release_sql_settings_ppc)
sql_x86_r = build(release_sql_settings_x86)
DefaultTarget("game_debug_x86")
PseudoTarget("release", ppc_r, x86_r)
PseudoTarget("nosql_release", nosql_ppc_r, nosql_x86_r)
PseudoTarget("debug", ppc_d, x86_d)
PseudoTarget("nosql_debug", nosql_ppc_d, nosql_x86_d)
PseudoTarget("server_release", "server_release_x86", "server_release_ppc")
PseudoTarget("server_nosql_release", "server_nosql_release_x86", "server_nosql_release_ppc")
PseudoTarget("server_debug", "server_debug_x86", "server_debug_ppc")
PseudoTarget("server_nosql_debug", "server_nosql_debug_x86", "server_nosql_debug_ppc")
PseudoTarget("client_release", "client_release_x86", "client_release_ppc")
PseudoTarget("client_debug", "client_debug_x86", "client_debug_ppc")
else
build(debug_settings)
build(debug_nosql_settings)
build(release_settings)
build(release_nosql_settings)
DefaultTarget("game_debug")
end

Binary file not shown.

Before

Width:  |  Height:  |  Size: 222 KiB

After

Width:  |  Height:  |  Size: 223 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 204 KiB

After

Width:  |  Height:  |  Size: 217 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 20 KiB

After

Width:  |  Height:  |  Size: 29 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 119 KiB

After

Width:  |  Height:  |  Size: 142 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 28 KiB

After

Width:  |  Height:  |  Size: 37 KiB

View file

@ -510,6 +510,12 @@ Are you sure that you want to delete the demo?
Aspect ratio
==
Automatically record demos
==
Automatically take game over screenshot
==
Blue value of the envelope
==
@ -696,6 +702,12 @@ Make collision
Make external
==
Max Screenshots
==
Max demos
==
Name:
==
@ -933,5 +945,8 @@ ZO
[ctrl+p] Toggles proof borders. These borders represent what a player maximum can see.
==
no limit
==
##### old translations #####

View file

@ -486,6 +486,12 @@ Are you sure that you want to delete the demo?
Aspect ratio
==
Automatically record demos
==
Automatically take game over screenshot
==
Blue value of the envelope
==
@ -684,6 +690,12 @@ Make collision
Make external
==
Max Screenshots
==
Max demos
==
Name:
==
@ -933,5 +945,8 @@ ZO
[ctrl+p] Toggles proof borders. These borders represent what a player maximum can see.
==
no limit
==
##### old translations #####

View file

@ -1,3 +1,4 @@
##### translated strings #####
%d of %d servers, %d players
@ -658,12 +659,12 @@ Reset to defaults
Resizes the current Quad based on the aspect ratio of the image
== Verkleint/vergroot de huidige quad gebaseerd op de verhouding van de afbeelding.
Right
== Rechts
Rifle
== Laser
Right
== Rechts
Rotation of the brush in degrees. Use left mouse button to drag and change the value. Hold shift to be more precise.
== Rotatie van de kwast in graden. Linkermuisknop om te slepen en de waarde te veranderen. Shift om meer precies te zijn.
@ -933,7 +934,24 @@ ZO
##### needs translation #####
Automatically record demos
==
Automatically take game over screenshot
==
Max Screenshots
==
Max demos
==
no limit
==
Loading DDRace Client
== Laden DDRace Client
##### old translations #####

View file

@ -510,6 +510,12 @@ Are you sure that you want to delete the demo?
Aspect ratio
==
Automatically record demos
==
Automatically take game over screenshot
==
Blue value of the envelope
==
@ -696,6 +702,12 @@ Make collision
Make external
==
Max Screenshots
==
Max demos
==
Name:
==
@ -933,5 +945,8 @@ ZO
[ctrl+p] Toggles proof borders. These borders represent what a player maximum can see.
==
no limit
==
##### old translations #####

View file

@ -746,6 +746,12 @@ Alpha value of the envelope
Aspect ratio
==
Automatically record demos
==
Automatically take game over screenshot
==
Blue value of the envelope
==
@ -818,6 +824,12 @@ Left mouse button to move. Hold shift to move the texture.
Left mouse to drag. Hold ctrl to be more precise. Hold shift to alter time point aswell. Right click to delete.
==
Max Screenshots
==
Max demos
==
Next Envelope
==
@ -935,6 +947,9 @@ Y-axis of the envelope
[ctrl+p] Toggles proof borders. These borders represent what a player maximum can see.
==
no limit
==
Loading DDRace Client
== Chargement DDRace Client
##### old translations #####

View file

@ -936,5 +936,20 @@ Loading DDRace Client
##### needs translation #####
Automatically record demos
==
Automatically take game over screenshot
==
Max Screenshots
==
Max demos
==
no limit
==
##### old translations #####

View file

@ -36,3 +36,6 @@ serbian
swedish
== Svenska
ukrainian
== Українська

View file

@ -480,6 +480,12 @@ Are you sure that you want to delete the demo?
Aspect ratio
==
Automatically record demos
==
Automatically take game over screenshot
==
Blue value of the envelope
==
@ -681,6 +687,12 @@ Make collision
Make external
==
Max Screenshots
==
Max demos
==
Name:
==
@ -933,5 +945,8 @@ ZO
[ctrl+p] Toggles proof borders. These borders represent what a player maximum can see.
==
no limit
==
##### old translations #####

View file

@ -792,6 +792,12 @@ Are you sure that you want to delete the demo?
Aspect ratio
==
Automatically record demos
==
Automatically take game over screenshot
==
Blue value of the envelope
==
@ -852,6 +858,12 @@ Load
Load map
==
Max Screenshots
==
Max demos
==
New folder
==
@ -933,5 +945,8 @@ Y-axis of the envelope
[HOME] Restore map focus
==
no limit
==
##### old translations #####

View file

@ -507,6 +507,12 @@ Are you sure that you want to delete the demo?
Aspect ratio
==
Automatically record demos
==
Automatically take game over screenshot
==
Blue value of the envelope
==
@ -696,6 +702,12 @@ Make collision
Make external
==
Max Screenshots
==
Max demos
==
Name:
==
@ -933,5 +945,8 @@ ZO
[ctrl+p] Toggles proof borders. These borders represent what a player maximum can see.
==
no limit
==
##### old translations #####

View file

@ -804,6 +804,12 @@ Are you sure that you want to delete the demo?
Aspect ratio
==
Automatically record demos
==
Automatically take game over screenshot
==
Blue value of the envelope
==
@ -858,6 +864,12 @@ Left mouse to drag. Hold ctrl to be more precise. Hold shift to alter time point
Load map
==
Max Screenshots
==
Max demos
==
New folder
==
@ -933,6 +945,11 @@ Y-axis of the envelope
[HOME] Restore map focus
==
no limit
==
==
Loading DDRace Client
== Загрузка DDRace Client

View file

@ -510,6 +510,12 @@ Are you sure that you want to delete the demo?
Aspect ratio
==
Automatically record demos
==
Automatically take game over screenshot
==
Blue value of the envelope
==
@ -696,6 +702,12 @@ Make collision
Make external
==
Max Screenshots
==
Max demos
==
Name:
==
@ -933,5 +945,8 @@ ZO
[ctrl+p] Toggles proof borders. These borders represent what a player maximum can see.
==
no limit
==
##### old translations #####

View file

@ -480,6 +480,12 @@ Are you sure that you want to delete the demo?
Aspect ratio
==
Automatically record demos
==
Automatically take game over screenshot
==
Blue value of the envelope
==
@ -681,6 +687,12 @@ Make collision
Make external
==
Max Screenshots
==
Max demos
==
Name:
==
@ -933,5 +945,8 @@ ZO
[ctrl+p] Toggles proof borders. These borders represent what a player maximum can see.
==
no limit
==
##### old translations #####

View file

@ -0,0 +1,952 @@
##### translated strings #####
%d of %d servers, %d players
== %d/%d серверів, %d гравців
%d%% loaded
== %d%% завантажено
%ds left
== залишилось %d сек.
%s Right click for context menu.
== %s Права кнопка миші для контекстного меню
Abort
== Відміна
Add
== Додати
Add Image
== Додати зображення
Add Quad
== Додати квад
Add group
== Додати групу
Add quads layer
== Додати шар квадів
Add tile layer
== Додати шар тайлів
Address
== Адреса
Adds a new group
== Додати нову групу
Adds a new quad
== Додати новий квад
All
== Всі
Alpha
== Прозор..
Always show name plates
== Завжди показувати ніки гравців
Anim
== Анім.
Append
== Вставити
Append map
== Вставити карту в поточну
Are you sure that you want to delete the demo?
== Ви впевнені, що хочете видалити демо?
Are you sure that you want to quit?
== Ви дійсно бажаєте вийти?
As this is the first time you launch the game, please enter your nick name below. It's recommended that you check the settings to adjust them to your liking before joining a server.
== Так як це ваш перший запуск гри, будь ласка, введіть свій нік у полі нижче. Також рекомендуємо перевірити налаштування гри і змінити деякі з них, перед тим, як почати грати.
Aspect ratio
== Співвідношення сторін
Blue team
== Сині
Blue team wins!
== Сині перемогли!
Body
== Тіло
Border
== Створити межі
CCW
== CCW
CW
== CW
Call vote
== Голосувати
Cancel
== Відміна
Chat
== Чат
Clear collision
== Очистити колізію
Close
== Закрити
Color Env
== Колір. Env.
Color TO
== Колір. TO
Color+
== Колір+
Compatible version
== Сумісна версія
Connect
== Під’єднатись
Connecting to
== Підключення до
Connection Problems...
== Проблеми зі з'єднанням...
Console
== Консоль
Constructs collision from this layer
== Створити колізії з цього шару
Controls
== Управління
Creates a new color envelope
== Створити нову криву кольору
Creates a new map
== Створити нову карту
Creates a new pos envelope
== Створити нову криву позиції
Creates a new quad layer
== Створити новий шар квадів
Creates a new tile layer
== Створити новий шар тайлів
Current
== Поточний
Current version: %s
== Поточна версія: %s
Custom colors
== Особистий колір
Decrease
== Зменшити
Decrease animation speed
== Зменшити швидкість анімації
Delete
== Видалити
Delete group
== Видалити групу
Delete layer
== Видалити шар
Deletes the current quad
== Видалити поточний квад
Deletes the layer
== Видалити шар
Demos
== Демо
Detail
== Детальний
Disconnect
== # Відключитись
Disconnected
== Відключено
Display Modes
== Режими дисплея
Down
== Вниз
Downloading map
== Завантаження карти
Draw!
== Нічия!
Dynamic Camera
== Динамічна камера
Embed
== Вбудувати
Embedded
== Вбудовані
Embeds the image into the map file.
== Вмонтувати зображення в саму карту
Emoticon
== Емоція
Enable/disable group for saving
== Включити / виключити групу для збереження
Enable/disable layer for saving
== Включити / виключити шар для збереження
Enter
== Вхід
Envelopes
== Криві
Error
== Помилка
Error loading demo
== Помилка при завантаженні демо
Exit
== Вихід
Exits from the editor
== Вихід з редактора
External
== зовнішні
FSAA samples
== Семплів FSAA
Favorite
== Обраний
Favorites
== Обрані
Feet
== Ноги
File
== Файл
Filename:
== Назва файлу:
Filter
== Фільтр
Fire
== Постріл
Folder
== Папка
Force vote
== Форсувати
Fullscreen
== Повноекранний режим
Game
== Гра
Game info
== Інфо по грі
Game over
== Гра закінчена
Game type
== Тип гри
Game types:
== Тип гри:
General
== Основні
Graphics
== Графіка
Grenade
== Граната
Group
== Група
HD
== HD
Hammer
== Молоток
Has people playing
== Сервер не порожній
Height
== Висота
High Detail
== Висока деталізація
Hook
== Гак
Host address
== Адреса сервера
Hue
== Відтінок
Image
== Зображення
Images
== Зображення
Increase
== Збільшити
Increase animation speed
== Збільшити швидкість анімації
Info
== Інфо
Internet
== Інтернет
Invalid Demo
== Невірне демо
Join blue
== За синіх
Join game
== Приєднатись до гри
Join red
== За червоних
Jump
== Стрибок
Kick
== Викинути
LAN
== LAN
Language
== Мова
Layers
== Шари
Left
== Вліво
Left mouse button to move. Hold shift to move pivot. Hold ctrl to rotate.
== Ліва кнопка миші для переміщення. Затисніть Shift для переміщення опори. Затисніть Ctrl для повороту.
Left mouse button to move. Hold shift to move the texture.
== Ліва кнопка миші для переміщення. Затисніть Shift для переміщення текстури.
Lht.
== Яскравість
Load
== Завантажити
Load a new image to use in the map
== Завантажити нове зображення для використання його в карті
Loading
== Завантиження
MOTD
== MOTD
Make collision
== Створити колізії
Make external
== Зробити зовнішнім
Map
== Карта
Maximum ping:
== Макс. пінг:
Miscellaneous
== Додатково
Mouse sens.
== Чутлив. миші
Move left
== Вліво
Move right
== Вправо
Movement
== Переміщення
Mute when not active
== Глушити звуки, коли гра неактивна
Name
== Імя
Name:
== Ім'я:
New
== Новий
New folder
== нова папка
News
== Новини
Next Envelope
== Наступна крива
Next weapon
== Наступ. зброя
Nickname
== Нік
No
== Ні
No password
== Без пароля
No servers found
== Сервера не знайдені
No servers match your filter criteria
== Не знайдено ні одного сервара, який би відповідав вашим критеріям
None
== Нічого
Normal animation speed
== Нормальна швидкість анімації
Ok
== Ок
Open
== Відкрити
Opens a map and adds everything from that map to the current one
== Відкрити карту і додати з неї все в поточну
Opens a map for editing
== Відкрити карту для редагування
Order
== ордер
Password
== Пароль
Password incorrect
== пароль введено невірно
Ping
== Пінг
Pistol
== Пістолет
Play
== Перегляд
Player
== Гравець
Players
== Гравці
Please balance teams!
== Збалансуйте команди!
Pos. Env
== Поз. крив.
Pos. TO
== Поз. TO
Pos.+
== Поз.+
Press right mouse button to create a new point
== Натисніть праву кнопку миші для створення нової точки
Prev. weapon
== Попер. зброя
Previous Envelope
== Попередня крива
Proof
== Межі
Quality Textures
== Якісні текстури
Quick search:
== Швидкий пошук:
Quit
== Вихід
Reason:
== Причина:
Record demo
== Запис демо
Red team
== Червоні
Red team wins!
== Червоні перемогли!
Refocus
== Повернути фокус
Refresh
== Оновити
Refreshing master servers
== Оновлення списку майстер-сервера
Remote console
== Консоль сервера
Remove
== Видалити
Removes collision from this layer
== Видалити колізії з цього шару
Removes the image from the map
== Видалити зображення з карти
Removes the image from the map file.
== Видалити зображення з файлу з картою
Replace
== Замінити
Replace Image
== Замінити зображення
Replaces the image with a new one
== Замінити це зображення нове
Reset filter
== Сикнути фільтри
Reset to defaults
== Скинути налаштування
Resizes the current Quad based on the aspect ratio of the image
== Змінює поточний квад на основі пропорції зображення
Rifle
== Лазер
Right
== Право
Rotation of the brush in degrees. Use left mouse button to drag and change the value. Hold shift to be more precise.
== Обертання щітки в градусах. Використовуйте ліву кнопку миші щоб перетягнути і змінити його значення. Утримуйте Shift більшої точності#####
Round
== Раунд
Sample rate
== Частота
Sat.
== Контраст.
Save
== Зберегти
Save As
== Зберегти як
Save map
== Зберегти карту
Saves the current map
== Зберегти поточну карту
Saves the current map under a new name
== Зберегти поточну карту під новою назвою
Score
== Очки
Score board
== Табло
Score limit
== Ліміт очок
Scoreboard
== Хід гри
Screenshot
== Скріншот
Select group. Right click for properties.
== Виберіть групу. Правий клік відкриває властивості.
Select image
== Виберіть зображення
Select layer. Right click for properties.
== Виберіть шар. Правий клік відкриває властивості.
Server details
== Деталі сервера
Server info
== Інформація
Server not full
== Сервер не заповнений
Settings
== Налаштування
Shotgun
== Дробовик
Show chat
== Показати чат
Show name plates
== Показувати ніки гравців
Show only supported
== Тільки підтримувані режими
Skins
== Скіни
Sound
== Звук
Sound volume
== Гучність звуку
Spectate
== Спостерігати
Spectators
== Спостерігачі
Square
== Квадрат
Squares the current quad
== Перетворити поточний квад в квадрат
Standard gametype
== Стандартний тип гри
Standard map
== Стандартна карта
Stop record
== Зупинити запис
Sudden Death
== Швидка смерть
Switch between images and layers managment.
== Переключитися між управлінням шарами і зображеннями
Switch curve type
== Змінити тип кривої
Switch weapon on pickup
== Перемикати зброю при підборі
Team
== Команда
Team chat
== Командний чат
Teeworlds %s is out! Download it at www.teeworlds.com!
== Вийшла Teeworlds %s! Завантажуйте на www.teeworlds.com!
Texture Compression
== Стиснення текстур
The server is running a non-standard tuning on a pure game type.
== Сервер запущено з нестандартними налаштуваннями на стандартному типі гри.
Tiles
== Тайли
Time limit
== Ліміт часу
Time limit: %d min
== Ліміт часу: %d хв
Toggle group visibility
== Переключити видимість групи
Toggle layer visibility
== Переключити видимість шару
Toggles the envelope editor.
== Показати або приховати редактор кривих
Try again
== Спробувати знову
Type
== Тип
UI Color
== колір інтерфейсу
Use left mouse button to drag and change the color value. Hold shift to be more precise.
== Використовуйте ліву кнопку миші щоб перетягнути або змінити значення кольору. Утримуйте Shift для більшої точності
Use left mouse button to drag and change the value. Hold shift to be more precise.
== Використовуйте ліву кнопку миші щоб перетягувати і змінювати його значення. Утримуйте Shift для більшої точності.
Use left mouse button to drag and create a brush.
== Використовуйте ліву кнопку миші для переміщення і створення кисті
Use left mouse button to paint with the brush. Right button clears the brush.
== Використовуйте ліву кнопку миші для малювання пензлем. Права кнопка миші очищає кисть.
Use sounds
== Використовувати звуки
V-Sync
== Вертикальна синхронізація
Version
== Версія
Vote no
== Проти
Vote yes
== За
Voting
== Голосування
Warmup
== Розминка
Weapon
== зброя
Welcome to Teeworlds
== Ласкаво просимо в Teeworlds!
Width
== Ширина
Yes
== Так
You must restart the game for all settings to take effect.
== Перезапустіть гру для застосування змін.
Your skin
== Ваш скін
ZI
== Z+
ZO
== Z-
[M] Flip brush vertical
== [M] Віддзеркалювати кисть по вертикалі
[N] Flip brush horizontal
== [N] Віддзеркалювати кисть по горизонталі
[NumPad*] Zoom to normal and remove editor offset
== [NumPad*] Встановити нормальне збільшення і прибрати зсув редактора
[NumPad+] Zoom in
== [ClavierNum+] Збільшити
[NumPad-] Zoom out
== [ClavierNum-] Зменшити
[R] Rotates the brush counter clockwise
== [R] Повернути кисть проти годинникової стрілки
[T] Rotates the brush clockwise
== [T] Повернути кисть по годинниковій стрілці
[ctrl+h] Toggle High Detail
== [ctrl+h] Переключити на високу деталізацію
[ctrl+m] Toggle animation
== [ctrl+m] Переключити анімацію
[ctrl+p] Toggles proof borders. These borders represent what a player maximum can see.
== [ctrl+p] Показати або приховати межі, в яких гравець може бачити карту#####
##### needs translation #####
Alpha value of the envelope
==
Automatically record demos
==
Automatically take game over screenshot
==
Blue value of the envelope
==
Clip H
==
Clip W
==
Clip X
==
Clip Y
==
Color
==
Delete demo
==
Delete this envelope
==
File: %s
==
Green value of the envelope
==
Left mouse to drag. Hold ctrl to be more precise. Hold shift to alter time point aswell. Right click to delete.
==
Load map
==
Max Screenshots
==
Max demos
==
Para X
==
Para Y
==
Parent Folder
==
Pos X
==
Pos Y
==
Quads
==
REC
==
Red value of the envelope
==
Rotation of the envelope
==
Shift
==
Up
==
Use Clipping
==
X-axis of the envelope
==
Y-axis of the envelope
==
[HOME] Restore map focus
==
no limit
==
##### old translations #####

Binary file not shown.

Before

Width:  |  Height:  |  Size: 211 KiB

After

Width:  |  Height:  |  Size: 248 KiB

View file

@ -35,7 +35,7 @@
/* #undef HAVE_UINT32_T */
/* #undef HAVE_INT64_T */
/* #undef HAVE_UINT64_T */
//#define HAVE_MS_INT8 1
#define HAVE_MS_INT8 1
#define HAVE_MS_UINT8 1
#define HAVE_MS_INT16 1
#define HAVE_MS_UINT16 1

Binary file not shown.

Binary file not shown.

View file

View file

@ -7,7 +7,7 @@ if len(sys.argv) != 3:
print sys.argv[0], "VERSION PLATFORM"
sys.exit(-1)
name = "teeworlds"
name = "DDRace"
version = sys.argv[1]
platform = sys.argv[2]
exe_ext = ""
@ -62,6 +62,7 @@ print "adding files"
shutil.copy("readme.txt", package_dir)
shutil.copy("license.txt", package_dir)
shutil.copy("storage.cfg", package_dir)
shutil.copy("announcement.txt", package_dir)
if include_data and not use_bundle:
os.mkdir(os.path.join(package_dir, "data"))
@ -72,17 +73,18 @@ if include_data and not use_bundle:
if include_exe and not use_bundle:
shutil.copy(name+exe_ext, package_dir)
shutil.copy(name+"_srv"+exe_ext, package_dir)
shutil.copy(name+"-Server"+exe_ext, package_dir)
if include_src:
for p in ["src", "scripts", "datasrc", "other", "objs"]:
os.mkdir(os.path.join(package_dir, p))
copydir(p, package_dir)
shutil.copy("default.bam", package_dir)
shutil.copy("bam.lua", package_dir)
shutil.copy("configure.lua", package_dir)
if use_bundle:
os.system("lipo -create -output teeworlds_srv teeworlds_srv_ppc teeworlds_srv_x86")
os.system("lipo -create -output teeworlds teeworlds_ppc teeworlds_x86")
os.system("lipo -create -output "+name+"_srv "+name+"_srv"+"_ppc "+name+"_srv"+"_x86")
os.system("lipo -create -output "+name+" "+name+"_ppc "+name+"_x86")
os.system("lipo -create -output serverlaunch serverlaunch_ppc serverlaunch_x86")
# create Teeworlds appfolder
@ -137,8 +139,8 @@ if use_bundle:
os.mkdir(os.path.join(serverbundle_resource_dir, "data/mapres"))
copydir("data/maps", serverbundle_resource_dir)
shutil.copy("other/icons/Teeworlds_srv.icns", serverbundle_resource_dir)
shutil.copy(name+"_srv"+exe_ext, serverbundle_bin_dir)
shutil.copy("serverlaunch"+exe_ext, serverbundle_bin_dir + "/teeworlds_server")
shutil.copy(name+"-Server"+exe_ext, serverbundle_bin_dir)
shutil.copy("serverlaunch"+exe_ext, serverbundle_bin_dir + "/"+name+"_server")
file(os.path.join(serverbundle_content_dir, "Info.plist"), "w").write("""
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
@ -185,4 +187,4 @@ if use_dmg:
os.system("hdiutil convert %s_temp.dmg -format UDBZ -o %s.dmg -quiet" % (package, package))
os.system("rm -f %s_temp.dmg" % package)
print "done"
print "done"

View file

@ -1,4 +1,7 @@
import sys, os
import os, re, sys
match = re.search("(.*?)/[^/]*?$", sys.argv[0])
if match != None:
os.chdir(os.getcwd() + "/" + match.group(1))
source_exts = [".c", ".cpp", ".h"]

View file

@ -999,6 +999,17 @@ int fs_chdir(const char *path)
return 1;
}
char *fs_getcwd(char *buffer, int buffer_size)
{
if(buffer == 0)
return 0;
#if defined(CONF_FAMILY_WINDOWS)
return _getcwd(buffer, buffer_size);
#else
return getcwd(buffer, buffer_size);
#endif
}
int fs_parent_dir(char *path)
{
char *parent = 0;
@ -1016,6 +1027,20 @@ int fs_parent_dir(char *path)
return 1;
}
int fs_remove(const char *filename)
{
if(remove(filename) != 0)
return 1;
return 0;
}
int fs_rename(const char *oldname, const char *newname)
{
if(rename(oldname, newname) != 0)
return 1;
return 0;
}
void swap_endian(void *data, unsigned elem_size, unsigned num)
{
char *src = (char*) data;
@ -1266,6 +1291,17 @@ void str_hex(char *dst, int dst_size, const void *data, int data_size)
}
}
void str_timestamp(char *buffer, int buffer_size)
{
time_t time_data;
struct tm *time_info;
time(&time_data);
time_info = localtime(&time_data);
strftime(buffer, buffer_size, "%Y-%m-%d_%H-%M-%S", time_info);
buffer[buffer_size-1] = 0; /* assure null termination */
}
int mem_comp(const void *a, const void *b, int size)
{
return memcmp(a,b,size);

View file

@ -914,6 +914,19 @@ const char *str_find(const char *haystack, const char *needle);
*/
void str_hex(char *dst, int dst_size, const void *data, int data_size);
/*
Function: str_timestamp
Copies a time stamp in the format year-month-day_hour-minute-second to the string.
Parameters:
buffer - Pointer to a buffer that shall receive the time stamp string.
buffer_size - Size of the buffer.
Remarks:
- Guarantees that buffer string will contain zero-termination.
*/
void str_timestamp(char *buffer, int buffer_size);
/* Group: Filesystem */
/*
@ -980,6 +993,15 @@ int fs_is_dir(const char *path);
*/
int fs_chdir(const char *path);
/*
Function: fs_getcwd
Gets the current working directory.
Returns:
Returns a pointer to the buffer on success, 0 on failure.
*/
char *fs_getcwd(char *buffer, int buffer_size);
/*
Function: fs_parent_dir
Get the parent directory of a directory
@ -995,6 +1017,37 @@ int fs_chdir(const char *path);
*/
int fs_parent_dir(char *path);
/*
Function: fs_remove
Deletes the file with the specified name.
Parameters:
filename - The file to delete
Returns:
Returns 0 on success, 1 on failure.
Remarks:
- The strings are treated as zero-terminated strings.
*/
int fs_remove(const char *filename);
/*
Function: fs_rename
Renames the file or directory. If the paths differ the file will be moved.
Parameters:
oldname - The actual name
newname - The new name
Returns:
Returns 0 on success, 1 on failure.
Remarks:
- The strings are treated as zero-terminated strings.
*/
int fs_rename(const char *oldname, const char *newname);
/*
Group: Undocumented
*/

View file

@ -76,7 +76,9 @@ public:
virtual void Disconnect() = 0;
virtual void Quit() = 0;
virtual const char *DemoPlayer_Play(const char *pFilename, int StorageType) = 0;
virtual void DemoRecorder_Start(const char *pFilename) = 0;
virtual void DemoRecorder_Start(const char *pFilename, bool WithTimestamp) = 0;
virtual void DemoRecorder_Stop() = 0;
virtual void AutoScreenshot_Start() = 0;
// networking
virtual void EnterGame() = 0;

View file

@ -3,8 +3,8 @@
#include <stdlib.h> // qsort
#include <stdarg.h>
#include <math.h>
#include <base/math.h>
#include <base/system.h>
#include <engine/shared/engine.h>
@ -217,6 +217,183 @@ void CSmoothTime::Update(CGraph *pGraph, int64 Target, int TimeLeft, int AdjustD
}
bool CFileCollection::IsFilenameValid(const char *pFilename)
{
if(str_length(pFilename) != m_FileDescLength+TIMESTAMP_LENGTH+m_FileExtLength ||
str_comp_num(pFilename, m_aFileDesc, m_FileDescLength) ||
str_comp(pFilename+m_FileDescLength+TIMESTAMP_LENGTH, m_aFileExt))
return false;
pFilename += m_FileDescLength;
if(pFilename[0] == '_' &&
pFilename[1] >= '0' && pFilename[1] <= '9' &&
pFilename[2] >= '0' && pFilename[2] <= '9' &&
pFilename[3] >= '0' && pFilename[3] <= '9' &&
pFilename[4] >= '0' && pFilename[4] <= '9' &&
pFilename[5] == '-' &&
pFilename[6] >= '0' && pFilename[6] <= '9' &&
pFilename[7] >= '0' && pFilename[7] <= '9' &&
pFilename[8] == '-' &&
pFilename[9] >= '0' && pFilename[9] <= '9' &&
pFilename[10] >= '0' && pFilename[10] <= '9' &&
pFilename[11] == '_' &&
pFilename[12] >= '0' && pFilename[12] <= '9' &&
pFilename[13] >= '0' && pFilename[13] <= '9' &&
pFilename[14] == '-' &&
pFilename[15] >= '0' && pFilename[15] <= '9' &&
pFilename[16] >= '0' && pFilename[16] <= '9' &&
pFilename[17] == '-' &&
pFilename[18] >= '0' && pFilename[18] <= '9' &&
pFilename[19] >= '0' && pFilename[19] <= '9')
return true;
return false;
}
int64 CFileCollection::ExtractTimestamp(const char *pTimestring)
{
int64 Timestamp = pTimestring[0]-'0'; Timestamp <<= 4;
Timestamp += pTimestring[1]-'0'; Timestamp <<= 4;
Timestamp += pTimestring[2]-'0'; Timestamp <<= 4;
Timestamp += pTimestring[3]-'0'; Timestamp <<= 4;
Timestamp += pTimestring[5]-'0'; Timestamp <<= 4;
Timestamp += pTimestring[6]-'0'; Timestamp <<= 4;
Timestamp += pTimestring[8]-'0'; Timestamp <<= 4;
Timestamp += pTimestring[9]-'0'; Timestamp <<= 4;
Timestamp += pTimestring[11]-'0'; Timestamp <<= 4;
Timestamp += pTimestring[12]-'0'; Timestamp <<= 4;
Timestamp += pTimestring[14]-'0'; Timestamp <<= 4;
Timestamp += pTimestring[15]-'0'; Timestamp <<= 4;
Timestamp += pTimestring[17]-'0'; Timestamp <<= 4;
Timestamp += pTimestring[18]-'0';
return Timestamp;
}
void CFileCollection::BuildTimestring(int64 Timestamp, char *pTimestring)
{
pTimestring[19] = 0;
pTimestring[18] = (Timestamp&0xF)+'0'; Timestamp >>= 4;
pTimestring[17] = (Timestamp&0xF)+'0'; Timestamp >>= 4;
pTimestring[16] = '-';
pTimestring[15] = (Timestamp&0xF)+'0'; Timestamp >>= 4;
pTimestring[14] = (Timestamp&0xF)+'0'; Timestamp >>= 4;
pTimestring[13] = '-';
pTimestring[12] = (Timestamp&0xF)+'0'; Timestamp >>= 4;
pTimestring[11] = (Timestamp&0xF)+'0'; Timestamp >>= 4;
pTimestring[10] = '_';
pTimestring[9] = (Timestamp&0xF)+'0'; Timestamp >>= 4;
pTimestring[8] = (Timestamp&0xF)+'0'; Timestamp >>= 4;
pTimestring[7] = '-';
pTimestring[6] = (Timestamp&0xF)+'0'; Timestamp >>= 4;
pTimestring[5] = (Timestamp&0xF)+'0'; Timestamp >>= 4;
pTimestring[4] = '-';
pTimestring[3] = (Timestamp&0xF)+'0'; Timestamp >>= 4;
pTimestring[2] = (Timestamp&0xF)+'0'; Timestamp >>= 4;
pTimestring[1] = (Timestamp&0xF)+'0'; Timestamp >>= 4;
pTimestring[0] = (Timestamp&0xF)+'0';
}
void CFileCollection::Init(IStorage *pStorage, const char *pPath, const char *pFileDesc, const char *pFileExt, int MaxEntries)
{
mem_zero(m_aTimestamps, sizeof(m_aTimestamps));
m_NumTimestamps = 0;
m_MaxEntries = clamp(MaxEntries, 1, static_cast<int>(MAX_ENTRIES));
str_copy(m_aFileDesc, pFileDesc, sizeof(m_aFileDesc));
m_FileDescLength = str_length(m_aFileDesc);
str_copy(m_aFileExt, pFileExt, sizeof(m_aFileExt));
m_FileExtLength = str_length(m_aFileExt);
str_copy(m_aPath, pPath, sizeof(m_aPath));
m_pStorage = pStorage;
m_pStorage->ListDirectory(IStorage::TYPE_SAVE, m_aPath, FilelistCallback, this);
}
void CFileCollection::AddEntry(int64 Timestamp)
{
if(m_NumTimestamps == 0)
{
// empty list
m_aTimestamps[m_NumTimestamps++] = Timestamp;
}
else
{
// remove old file
if(m_NumTimestamps == m_MaxEntries)
{
char aBuf[512];
char aTimestring[TIMESTAMP_LENGTH];
BuildTimestring(m_aTimestamps[0], aTimestring);
str_format(aBuf, sizeof(aBuf), "%s/%s_%s%s", m_aPath, m_aFileDesc, aTimestring, m_aFileExt);
m_pStorage->RemoveFile(aBuf, IStorage::TYPE_SAVE);
}
// add entry to the sorted list
if(m_aTimestamps[0] > Timestamp)
{
// first entry
if(m_NumTimestamps < m_MaxEntries)
{
mem_move(m_aTimestamps+1, m_aTimestamps, m_NumTimestamps*sizeof(int64));
m_aTimestamps[0] = Timestamp;
++m_NumTimestamps;
}
}
else if(m_aTimestamps[m_NumTimestamps-1] <= Timestamp)
{
// last entry
if(m_NumTimestamps == m_MaxEntries)
{
mem_move(m_aTimestamps, m_aTimestamps+1, (m_NumTimestamps-1)*sizeof(int64));
m_aTimestamps[m_NumTimestamps-1] = Timestamp;
}
else
m_aTimestamps[m_NumTimestamps++] = Timestamp;
}
else
{
// middle entry
int Left = 0, Right = m_NumTimestamps-1;
while(Right-Left > 1)
{
int Mid = (Left+Right)/2;
if(m_aTimestamps[Mid] > Timestamp)
Right = Mid;
else
Left = Mid;
}
if(m_NumTimestamps == m_MaxEntries)
{
mem_move(m_aTimestamps, m_aTimestamps+1, (Right-1)*sizeof(int64));
m_aTimestamps[Right-1] = Timestamp;
}
else
{
mem_move(m_aTimestamps+Right+1, m_aTimestamps+Right, (m_NumTimestamps-Right)*sizeof(int64));
m_aTimestamps[Right] = Timestamp;
++m_NumTimestamps;
}
}
}
}
void CFileCollection::FilelistCallback(const char *pFilename, int IsDir, int StorageType, void *pUser)
{
CFileCollection *pThis = static_cast<CFileCollection *>(pUser);
// check for valid file name format
if(IsDir || !pThis->IsFilenameValid(pFilename))
return;
// extract the timestamp
int64 Timestamp = pThis->ExtractTimestamp(pFilename+pThis->m_FileDescLength+1);
// add the entry
pThis->AddEntry(Timestamp);
}
CClient::CClient() : m_DemoPlayer(&m_SnapshotDelta), m_DemoRecorder(&m_SnapshotDelta)
{
m_pEditor = 0;
@ -236,6 +413,7 @@ CClient::CClient() : m_DemoPlayer(&m_SnapshotDelta), m_DemoRecorder(&m_SnapshotD
m_WindowMustRefocus = 0;
m_SnapCrcErrors = 0;
m_AutoScreenshotRecycle = false;
m_AckGameTick = -1;
m_CurrentRecvTick = 0;
@ -526,7 +704,7 @@ void CClient::Connect(const char *pAddress)
SetState(IClient::STATE_CONNECTING);
if(m_DemoRecorder.IsRecording())
m_DemoRecorder.Stop();
DemoRecorder_Stop();
m_InputtimeMarginGraph.Init(-150.0f, 150.0f);
m_GametimeMarginGraph.Init(-150.0f, 150.0f);
@ -540,7 +718,7 @@ void CClient::DisconnectWithReason(const char *pReason)
// stop demo playback and recorder
m_DemoPlayer.Stop();
m_DemoRecorder.Stop();
DemoRecorder_Stop();
//
m_RconAuthed = 0;
@ -780,7 +958,7 @@ const char *CClient::LoadMap(const char *pName, const char *pFilename, unsigned
}
// stop demo recording if we loaded a new map
m_DemoRecorder.Stop();
DemoRecorder_Stop();
char aBuf[256];
str_format(aBuf, sizeof(aBuf), "loaded map '%s'", pFilename);
@ -1279,6 +1457,7 @@ void CClient::ProcessPacket(CNetChunk *pPacket)
m_aSnapshots[SNAP_CURRENT] = m_SnapshotStorage.m_pLast;
m_LocalStartTime = time_get();
SetState(IClient::STATE_ONLINE);
DemoRecorder_HandleAutoStart();
}
// adjust game time
@ -1629,6 +1808,8 @@ void CClient::Run()
if(!LoadData())
return;
DemoRecorder_Init();
GameClient()->OnInit();
char aBuf[256];
str_format(aBuf, sizeof(aBuf), "version %s", GameClient()->NetVersion());
@ -1676,7 +1857,8 @@ void CClient::Run()
}
// update input
Input()->Update();
if(Input()->Update())
break; // SDL_QUIT
// update sound
Sound()->Update();
@ -1757,6 +1939,8 @@ void CClient::Run()
}
}
AutoScreenshot_Cleanup();
// check conditions
if(State() == IClient::STATE_QUITING)
break;
@ -1842,10 +2026,33 @@ void CClient::Con_Ping(IConsole::IResult *pResult, void *pUserData, int ClientID
pSelf->m_PingStartTime = time_get();
}
void CClient::AutoScreenshot_Start()
{
if(g_Config.m_ClAutoScreenshot)
{
Graphics()->TakeScreenshot("auto/autoscreen");
m_AutoScreenshotRecycle = true;
}
}
void CClient::AutoScreenshot_Cleanup()
{
if(m_AutoScreenshotRecycle)
{
if(g_Config.m_ClAutoScreenshotMax)
{
// clean up auto taken screens
CFileCollection AutoScreens;
AutoScreens.Init(Storage(), "screenshots/auto", "autoscreen", ".png", g_Config.m_ClAutoScreenshotMax);
}
m_AutoScreenshotRecycle = false;
}
}
void CClient::Con_Screenshot(IConsole::IResult *pResult, void *pUserData, int ClientID)
{
CClient *pSelf = (CClient *)pUserData;
pSelf->Graphics()->TakeScreenshot();
pSelf->Graphics()->TakeScreenshot(0);
}
void CClient::Con_Rcon(IConsole::IResult *pResult, void *pUserData, int ClientID)
@ -1926,28 +2133,63 @@ void CClient::Con_Play(IConsole::IResult *pResult, void *pUserData, int ClientID
pSelf->DemoPlayer_Play(pResult->GetString(0), IStorage::TYPE_ALL);
}
void CClient::DemoRecorder_Start(const char *pFilename)
void CClient::DemoRecorder_Init()
{
if(!Storage()->CreateFolder("demos/auto", IStorage::TYPE_SAVE))
m_pConsole->Print(IConsole::OUTPUT_LEVEL_STANDARD, "demorec/record", "unable to create auto record folder");
}
void CClient::DemoRecorder_Start(const char *pFilename, bool WithTimestamp)
{
if(State() != IClient::STATE_ONLINE)
m_pConsole->Print(IConsole::OUTPUT_LEVEL_STANDARD, "demorec/record", "client is not online");
else
{
char aFilename[512];
str_format(aFilename, sizeof(aFilename), "demos/%s.demo", pFilename);
char aFilename[128];
if(WithTimestamp)
{
char aDate[20];
str_timestamp(aDate, sizeof(aDate));
str_format(aFilename, sizeof(aFilename), "demos/%s_%s.demo", pFilename, aDate);
}
else
str_format(aFilename, sizeof(aFilename), "demos/%s.demo", pFilename);
m_DemoRecorder.Start(Storage(), m_pConsole, aFilename, GameClient()->NetVersion(), m_aCurrentMap, m_CurrentMapCrc, "client");
}
}
void CClient::DemoRecorder_HandleAutoStart()
{
if(g_Config.m_ClAutoDemoRecord)
{
DemoRecorder_Start("auto/autorecord", true);
if(g_Config.m_ClAutoDemoMax)
{
// clean up auto recorded demos
CFileCollection AutoDemos;
AutoDemos.Init(Storage(), "demos/auto", "autorecord", ".demo", g_Config.m_ClAutoDemoMax);
}
}
}
void CClient::DemoRecorder_Stop()
{
m_DemoRecorder.Stop();
}
void CClient::Con_Record(IConsole::IResult *pResult, void *pUserData, int ClientID)
{
CClient *pSelf = (CClient *)pUserData;
pSelf->DemoRecorder_Start(pResult->GetString(0));
if(pResult->NumArguments())
pSelf->DemoRecorder_Start(pResult->GetString(0), false);
else
pSelf->DemoRecorder_Start("demo", true);
}
void CClient::Con_StopRecord(IConsole::IResult *pResult, void *pUserData, int ClientID)
{
CClient *pSelf = (CClient *)pUserData;
pSelf->m_DemoRecorder.Stop();
pSelf->DemoRecorder_Stop();
}
void CClient::RegisterCommands()
@ -1960,7 +2202,7 @@ void CClient::RegisterCommands()
m_pConsole->Register("bans", "", CFGFLAG_SERVER, 0, 0, "Show banlist", 0);
m_pConsole->Register("status", "", CFGFLAG_SERVER, 0, 0, "List players", 0);
m_pConsole->Register("shutdown", "", CFGFLAG_SERVER, 0, 0, "Shut down", 0);
m_pConsole->Register("record", "s", CFGFLAG_SERVER, 0, 0, "Record to a file", 0);
m_pConsole->Register("record", "?s", CFGFLAG_SERVER, 0, 0, "Record to a file", 0);
m_pConsole->Register("stoprecord", "", CFGFLAG_SERVER, 0, 0, "Stop recording", 0);
m_pConsole->Register("reload", "", CFGFLAG_SERVER, 0, 0, "Reload the map", 0);
m_pConsole->Register("login", "?s", CFGFLAG_SERVER, 0, 0, "Allows you access to rcon if no password is given, or changes your level if a password is given", -1);
@ -1981,7 +2223,7 @@ void CClient::RegisterCommands()
m_pConsole->Register("rcon", "r", CFGFLAG_CLIENT, Con_Rcon, this, "Send specified command to rcon", 0);
m_pConsole->Register("rcon_auth", "s", CFGFLAG_CLIENT, Con_RconAuth, this, "Authenticate to rcon", 0);
m_pConsole->Register("play", "r", CFGFLAG_CLIENT, Con_Play, this, "Play the file specified", 0);
m_pConsole->Register("record", "s", CFGFLAG_CLIENT, Con_Record, this, "Record to the file", 0);
m_pConsole->Register("record", "?s", CFGFLAG_CLIENT, Con_Record, this, "Record to the file", 0);
m_pConsole->Register("stoprecord", "", CFGFLAG_CLIENT, Con_StopRecord, this, "Stop recording", 0);
m_pConsole->Register("add_favorite", "s", CFGFLAG_CLIENT, Con_AddFavorite, this, "Add a server as a favorite", 0);

View file

@ -73,6 +73,36 @@ public:
};
class CFileCollection
{
enum
{
MAX_ENTRIES=1000,
TIMESTAMP_LENGTH=20, // _YYYY-MM-DD_HH-MM-SS
};
int64 m_aTimestamps[MAX_ENTRIES];
int m_NumTimestamps;
int m_MaxEntries;
char m_aFileDesc[128];
int m_FileDescLength;
char m_aFileExt[32];
int m_FileExtLength;
char m_aPath[512];
IStorage *m_pStorage;
bool IsFilenameValid(const char *pFilename);
int64 ExtractTimestamp(const char *pTimestring);
void BuildTimestring(int64 Timestamp, char *pTimestring);
public:
void Init(IStorage *pStorage, const char *pPath, const char *pFileDesc, const char *pFileExt, int MaxEntries);
void AddEntry(int64 Timestamp);
static void FilelistCallback(const char *pFilename, int IsDir, int StorageType, void *pUser);
};
class CClient : public IClient, public CDemoPlayer::IListner
{
// needed interfaces
@ -110,6 +140,7 @@ class CClient : public IClient, public CDemoPlayer::IListner
NETADDR m_ServerAddress;
int m_WindowMustRefocus;
int m_SnapCrcErrors;
bool m_AutoScreenshotRecycle;
int m_AckGameTick;
int m_CurrentRecvTick;
@ -284,7 +315,13 @@ public:
void RegisterCommands();
const char *DemoPlayer_Play(const char *pFilename, int StorageType);
void DemoRecorder_Start(const char *pFilename);
void DemoRecorder_Init();
void DemoRecorder_Start(const char *pFilename, bool WithTimestamp);
void DemoRecorder_HandleAutoStart();
void DemoRecorder_Stop();
void AutoScreenshot_Start();
void AutoScreenshot_Cleanup();
virtual class CEngine *Engine() { return &m_Engine; }
};

View file

@ -29,7 +29,6 @@
#include <engine/console.h>
#include <math.h>
#include <time.h>
#include "graphics.h"
@ -874,8 +873,11 @@ int CGraphics_SDL::WindowOpen()
}
void CGraphics_SDL::TakeScreenshot()
void CGraphics_SDL::TakeScreenshot(const char *pFilename)
{
char aDate[20];
str_timestamp(aDate, sizeof(aDate));
str_format(m_aScreenshotName, sizeof(m_aScreenshotName), "screenshots/%s_%s.png", pFilename?pFilename:"screenshot", aDate);
m_DoScreenshot = true;
}
@ -883,29 +885,7 @@ void CGraphics_SDL::Swap()
{
if(m_DoScreenshot)
{
// find filename
char aFilename[128];
static int Index = 1;
time_t Time;
char aDate[20];
time(&Time);
tm* TimeInfo = localtime(&Time);
strftime(aDate, sizeof(aDate), "%Y-%m-%d_%I-%M", TimeInfo);
for(; Index < 10000; Index++)
{
IOHANDLE io;
str_format(aFilename, sizeof(aFilename), "screenshots/screenshot%s-%05d.png", aDate, Index);
io = m_pStorage->OpenFile(aFilename, IOFLAG_READ, IStorage::TYPE_SAVE);
if(io)
io_close(io);
else
break;
}
ScreenshotDirect(aFilename);
ScreenshotDirect(m_aScreenshotName);
m_DoScreenshot = false;
}

View file

@ -41,6 +41,7 @@ protected:
float m_Rotation;
int m_Drawing;
bool m_DoScreenshot;
char m_aScreenshotName[128];
float m_ScreenX0;
float m_ScreenY0;
@ -136,7 +137,7 @@ public:
virtual int WindowActive();
virtual int WindowOpen();
virtual void TakeScreenshot();
virtual void TakeScreenshot(const char *pFilename);
virtual void Swap();
virtual int GetVideoModes(CVideoMode *pModes, int MaxModes);

View file

@ -108,7 +108,7 @@ int CInput::KeyState(int Key)
return m_aInputState[m_InputCurrent][Key];
}
void CInput::Update()
int CInput::Update()
{
if(m_InputGrabbed && !Graphics()->WindowActive())
MouseModeAbsolute();
@ -185,9 +185,7 @@ void CInput::Update()
// other messages
case SDL_QUIT:
// TODO: cleaner exit
exit(0); // ignore_convention
break;
return 1;
}
//
@ -201,6 +199,8 @@ void CInput::Update()
}
}
return 0;
}

View file

@ -31,7 +31,7 @@ public:
int ButtonPressed(int Button) { return m_aInputState[m_InputCurrent][Button]; }
virtual void Update();
virtual int Update();
};
#endif

View file

@ -57,7 +57,7 @@ public:
virtual void Register(const char *pName, const char *pParams,
int Flags, FCommandCallback pfnFunc, void *pUser, const char *pHelp, const int Level) = 0;
virtual void List(const int Level, int Flags, int Page = 0) = 0;
virtual void List(const int Level, int Flags) = 0;
virtual void Chain(const char *pName, FChainCommandCallback pfnChainFunc, void *pUser) = 0;
virtual void StoreCommands(bool Store, int ClientId) = 0;

View file

@ -127,7 +127,7 @@ public:
virtual void SetColorVertex(const CColorVertex *pArray, int Num) = 0;
virtual void SetColor(float r, float g, float b, float a) = 0;
virtual void TakeScreenshot() = 0;
virtual void TakeScreenshot(const char *pFilename) = 0;
virtual int GetVideoModes(CVideoMode *pModes, int MaxModes) = 0;
virtual void Swap() = 0;

View file

@ -83,7 +83,7 @@ class IEngineInput : public IInput
MACRO_INTERFACE("engineinput", 0)
public:
virtual void Init() = 0;
virtual void Update() = 0;
virtual int Update() = 0;
};
extern IEngineInput *CreateEngineInput();

View file

@ -305,6 +305,7 @@ int CServer::Init()
}
m_CurrentGameTick = 0;
m_AnnouncementLastLine = 0;
return 0;
}
@ -1214,6 +1215,7 @@ int CServer::Run()
Console()->ExecuteLine("sv_npc 0",4,-1);
Console()->ExecuteLine("sv_phook 1",4,-1);
Console()->ExecuteLine("sv_endless_drag 0",4,-1);
Console()->ExecuteLine("sv_old_laser 0",4,-1);
// new map loaded
GameServer()->OnShutdown();
@ -1324,11 +1326,10 @@ int CServer::Run()
void CServer::ConKick(IConsole::IResult *pResult, void *pUser, int ClientId)
{
int Victim = pResult->GetVictim();
char buf[128];
if(pResult->NumArguments() >= 1)
{
char aBuf[128];
str_format(aBuf, sizeof(aBuf), "Kicked by console (%s)", pResult->GetString(0));
str_format(aBuf, sizeof(aBuf), "Kicked by (%s)", pResult->GetString(0));
((CServer *)pUser)->Kick(Victim, aBuf);
}
else
@ -1493,9 +1494,18 @@ void CServer::ConShutdown(IConsole::IResult *pResult, void *pUser, int ClientId)
void CServer::ConRecord(IConsole::IResult *pResult, void *pUser, int ClientId)
{
char aFilename[512];
str_format(aFilename, sizeof(aFilename), "demos/%s.demo", pResult->GetString(0));
((CServer *)pUser)->m_DemoRecorder.Start(((CServer *)pUser)->Storage(), ((CServer *)pUser)->Console(), aFilename, ((CServer *)pUser)->GameServer()->NetVersion(), ((CServer *)pUser)->m_aCurrentMap, ((CServer *)pUser)->m_CurrentMapCrc, "server");
CServer* pServer = (CServer *)pUser;
char aFilename[128];
if(pResult->NumArguments())
str_format(aFilename, sizeof(aFilename), "demos/%s.demo", pResult->GetString(0));
else
{
char aDate[20];
str_timestamp(aDate, sizeof(aDate));
str_format(aFilename, sizeof(aFilename), "demos/demo_%s.demo", aDate);
}
pServer->m_DemoRecorder.Start(pServer->Storage(), pServer->Console(), aFilename, pServer->GameServer()->NetVersion(), pServer->m_aCurrentMap, pServer->m_CurrentMapCrc, "server");
}
void CServer::ConStopRecord(IConsole::IResult *pResult, void *pUser, int ClientId)
@ -1512,10 +1522,12 @@ void CServer::ConCmdList(IConsole::IResult *pResult, void *pUserData, int Client
{
CServer *pSelf = (CServer *)pUserData;
if(pResult->NumArguments())
pSelf->Console()->List(pSelf->m_aClients[ClientId].m_Authed, CFGFLAG_SERVER, pResult->GetInteger(0));
if(pResult->NumArguments() == 0)
pSelf->Console()->List((pSelf->m_aClients[ClientId].m_Authed != 0) ? pSelf->m_aClients[ClientId].m_Authed : -1, CFGFLAG_SERVER);
else if (pResult->GetInteger(0) == 0)
pSelf->Console()->List(-1, CFGFLAG_SERVER);
else
pSelf->Console()->List(pSelf->m_aClients[ClientId].m_Authed, CFGFLAG_SERVER);
pSelf->Console()->List(pResult->GetInteger(0), CFGFLAG_SERVER);
}
@ -1572,7 +1584,7 @@ void CServer::RegisterCommands()
Console()->Register("status", "", CFGFLAG_SERVER, ConStatus, this, "", 1);
Console()->Register("shutdown", "", CFGFLAG_SERVER, ConShutdown, this, "", 3);
Console()->Register("record", "s", CFGFLAG_SERVER|CFGFLAG_STORE, ConRecord, this, "", 3);
Console()->Register("record", "?s", CFGFLAG_SERVER|CFGFLAG_STORE, ConRecord, this, "", 3);
Console()->Register("stoprecord", "", CFGFLAG_SERVER, ConStopRecord, this, "", 3);
Console()->Register("reload", "", CFGFLAG_SERVER, ConMapReload, this, "", 3);
@ -1585,7 +1597,7 @@ void CServer::RegisterCommands()
Console()->Register("login", "?s", CFGFLAG_SERVER, ConLogin, this, "Allows you access to rcon if no password is given, or changes your level if a password is given", -1);
Console()->Register("auth", "?s", CFGFLAG_SERVER, ConLogin, this, "Allows you access to rcon if no password is given, or changes your level if a password is given", -1);
Console()->Register("cmdlist", "?i", CFGFLAG_SERVER, ConCmdList, this, "With Parameter i Shows a Certain Page of the Commands, Without Shows the page Count", -1);
Console()->Register("cmdlist", "?i", CFGFLAG_SERVER, ConCmdList, this, "Shows you the commands available for your remote console access. Specify the level if you want to see other level's commands", -1);
}
@ -1679,6 +1691,7 @@ int main(int argc, const char **argv) // ignore_convention
pConsole->ExecuteLine("sv_npc 0",4,-1);
pConsole->ExecuteLine("sv_phook 1",4,-1);
pConsole->ExecuteLine("sv_endless_drag 0",4,-1);
pConsole->ExecuteLine("sv_old_laser 0",4,-1);
// execute autoexec file
pConsole->ExecuteFile("autoexec.cfg", 0, 0, 0, 0, 4);
@ -1813,7 +1826,7 @@ void CServer::CheckPass(int ClientId, const char *pPw)
}
char *CServer::GetLine(char const *FileName, int Line)
char *CServer::GetAnnouncementLine(char const *FileName)
{
IOHANDLE File = m_pStorage->OpenFile(FileName, IOFLAG_READ, IStorage::TYPE_ALL);
if(File)
@ -1822,12 +1835,29 @@ char *CServer::GetLine(char const *FileName, int Line)
char *pLine;
CLineReader *lr = new CLineReader();
lr->Init(File);
while(pLine = lr->Get())
while((pLine = lr->Get()))
if(str_length(pLine))
v.push_back(pLine);
if(Line >= v.size())
Line %= v.size();
return v[Line];
if(pLine[0]!='#')
v.push_back(pLine);
if(v.size() == 1)
{
m_AnnouncementLastLine = 0;
}
else if(!g_Config.m_SvAnnouncementRandom)
{
if(m_AnnouncementLastLine >= v.size())
m_AnnouncementLastLine %= v.size();
}
else
{
unsigned Rand;
do
Rand = rand() % v.size();
while(Rand == m_AnnouncementLastLine);
m_AnnouncementLastLine = Rand;
}
return v[m_AnnouncementLastLine];
}
return 0;
}

View file

@ -221,7 +221,8 @@ public:
void SetRconLevel(int ClientId, int Level);
void CheckPass(int ClientId, const char *pPw);
char *GetLine(char const *FileName, int Line);
char *GetAnnouncementLine(char const *FileName);
unsigned m_AnnouncementLastLine;
virtual int SnapNewID();
virtual void SnapFreeID(int ID);

View file

@ -123,7 +123,7 @@ public:
}
};
void dbg_msg1(char * where, char * format, ...) {
void dbg_msg1(const char * where,const char * format, ...) {
if(g_Config.m_DbgMsg == 1) {
const size_t buffer_size = 1024;//i hope this will enought
char buffer[buffer_size];

View file

@ -16,7 +16,7 @@ extern CConfiguration g_Config;
void dbg_msg1(char * where, char * format, ...);
void dbg_msg1(const char * where, const char * format, ...);

View file

@ -14,8 +14,13 @@ MACRO_CONFIG_STR(Password, password, 32, "", CFGFLAG_CLIENT|CFGFLAG_SERVER, "Pas
MACRO_CONFIG_STR(Logfile, logfile, 128, "", CFGFLAG_SAVE|CFGFLAG_CLIENT|CFGFLAG_SERVER, "Filename to log all output to", 3)
MACRO_CONFIG_INT(ConsoleOutputLevel, console_output_level, 0, 0, 2, CFGFLAG_CLIENT|CFGFLAG_SERVER, "Adjusts the amount of information in the console", 3)
MACRO_CONFIG_INT(ClAutoDemoRecord, cl_auto_demo_record, 0, 0, 1, CFGFLAG_SAVE|CFGFLAG_CLIENT, "Automatically record demos", -1)
MACRO_CONFIG_INT(ClCpuThrottle, cl_cpu_throttle, 0, 0, 1, CFGFLAG_SAVE|CFGFLAG_CLIENT, "", -1)
MACRO_CONFIG_INT(ClEditor, cl_editor, 0, 0, 1, CFGFLAG_CLIENT, "", -1)
MACRO_CONFIG_INT(ClAutoDemoMax, cl_auto_demo_max, 10, 0, 1000, CFGFLAG_SAVE|CFGFLAG_CLIENT, "Maximum number of automatically recorded demos (0 = no limit)", -1)
MACRO_CONFIG_INT(ClAutoScreenshot, cl_auto_screenshot, 0, 0, 1, CFGFLAG_SAVE|CFGFLAG_CLIENT, "Automatically take game over screenshot", -1)
MACRO_CONFIG_INT(ClAutoScreenshotMax, cl_auto_screenshot_max, 10, 0, 1000, CFGFLAG_SAVE|CFGFLAG_CLIENT, "Maximum number of automatically created screenshots (0 = no limit)", -1)
MACRO_CONFIG_INT(ClEventthread, cl_eventthread, 0, 0, 1, CFGFLAG_CLIENT, "Enables the usage of a thread to pump the events", -1)
@ -94,15 +99,15 @@ MACRO_CONFIG_STR(SvReservedSlotsPass, sv_reserved_slots_pass, 32, "", CFGFLAG_SE
MACRO_CONFIG_STR(SvRconPasswordAdmin, sv_admin_pass, 32, "", CFGFLAG_SERVER, "Remote console administrator password", 4)
MACRO_CONFIG_STR(SvRconPasswordModer, sv_mod_pass, 32, "", CFGFLAG_SERVER, "Remote console moderator password", 4)
MACRO_CONFIG_STR(SvRconPasswordHelper, sv_helper_pass, 32, "", CFGFLAG_SERVER, "Remote console helper password", 4)
MACRO_CONFIG_INT(SvHit, sv_hit, 1, 0, 1, CFGFLAG_SERVER, "Whether players can hammer/grenade/laser eachother or not", 3)
MACRO_CONFIG_INT(SvEndlessDrag, sv_endless_drag, 0, 0, 1, CFGFLAG_SERVER, "Turns endless hooking on/off", 3)
MACRO_CONFIG_INT(SvHit, sv_hit, 1, 0, 1, CFGFLAG_SERVER, "Whether players can hammer/grenade/laser eachother or not", 4)
MACRO_CONFIG_INT(SvEndlessDrag, sv_endless_drag, 0, 0, 1, CFGFLAG_SERVER, "Turns endless hooking on/off", 4)
MACRO_CONFIG_INT(SvCheats, sv_cheats, 0, 0, 1, CFGFLAG_SERVER, "Turns cheats on/off", 4)
MACRO_CONFIG_INT(SvCheatTime, sv_cheattime, 0, 0, 1, CFGFLAG_SERVER, "Whether the time of players will be stopped on cheating or not", 3)
MACRO_CONFIG_INT(SvEndlessSuperHook, sv_endless_super_hook, 0, 0, 1, CFGFLAG_SERVER, "Endless hook for super players on/off", 3)
MACRO_CONFIG_INT(SvCheatTime, sv_cheattime, 0, 0, 1, CFGFLAG_SERVER, "Whether the time of players will be stopped on cheating or not", 4)
MACRO_CONFIG_INT(SvEndlessSuperHook, sv_endless_super_hook, 0, 0, 1, CFGFLAG_SERVER, "Endless hook for super players on/off", 4)
MACRO_CONFIG_INT(SvAllowColorChange, sv_allow_color_change, 1, 0, 1, CFGFLAG_SERVER, "Whether color change is allowed (to block rainbow mod)", 3)
MACRO_CONFIG_INT(SvHideScore, sv_hide_score, 0, 0, 1, CFGFLAG_SERVER, "Whether players scores will be announced or not", 3)
//MACRO_CONFIG_INT(SvAllowColorChange, sv_allow_color_change, 1, 0, 1, CFGFLAG_SERVER, "Whether color change is allowed (to block rainbow mod)", 3)
MACRO_CONFIG_INT(SvHideScore, sv_hide_score, 0, 0, 1, CFGFLAG_SERVER, "Whether players scores will be announced or not", 4)
MACRO_CONFIG_INT(SvTimer, sv_timer, 0, 0, 1, CFGFLAG_SERVER, "Whether timer commands are allowed or not", 3)
MACRO_CONFIG_INT(SvPauseable, sv_pauseable, 1, 0, 1, CFGFLAG_SERVER, "Whether players can pause their char or not", 3)
MACRO_CONFIG_INT(SvPauseTime, sv_pause_time, 0, 0, 1, CFGFLAG_SERVER, "Whether '/pause' and 'sv_max_dc_restore' pauses the time of player or not", 3)
@ -112,19 +117,21 @@ MACRO_CONFIG_INT(SvEmoticonDelay, sv_emoticon_delay, 3, 0, 9999, CFGFLAG_SERVER,
MACRO_CONFIG_INT(SvChatDelay, sv_chat_delay, 1, 0, 9999, CFGFLAG_SERVER, "The time in seconds between chat messages", 3)
MACRO_CONFIG_INT(SvTeamChangeDelay, sv_team_change_delay, 3, 0, 9999, CFGFLAG_SERVER, "The time in seconds between team changes (spectator/in game)", 3)
MACRO_CONFIG_INT(SvInfoChangeDelay, sv_info_change_delay, 5, 0, 9999, CFGFLAG_SERVER, "The time in seconds between info changes (name/skin/color)", 3)
MACRO_CONFIG_INT(SvInfoChangeDelay, sv_info_change_delay, 5, 0, 9999, CFGFLAG_SERVER, "The time in seconds between info changes (name/skin/color), to avoid ranbow mod set this to a very high time", 3)
MACRO_CONFIG_INT(SvVoteMapTimeDelay, sv_vote_map_delay,0,0,9999,CFGFLAG_SERVER, "The minimum time in seconds between map votes", 3)
MACRO_CONFIG_INT(SvVoteDelay, sv_vote_delay, 3, 0, 9999, CFGFLAG_SERVER, "The time in seconds between any vote", 3)
MACRO_CONFIG_INT(SvVoteKickTimeDelay, sv_vote_kick_delay,0,0,9999,CFGFLAG_SERVER, "The minimum time in seconds between kick votes", 3)
MACRO_CONFIG_INT(SvKillDelay, sv_kill_delay,3,0,9999,CFGFLAG_SERVER, "The minimum time in seconds between kills", 3)
MACRO_CONFIG_INT(SvSuicidePenalty, sv_suicide_penalty,0,0,9999,CFGFLAG_SERVER, "The minimum time in seconds between kill or /kills and respawn", 3)
MACRO_CONFIG_INT(SvVotePercentage, sv_vote_percentage, 50, 1, 100, CFGFLAG_SERVER, "The percent of people that need to agree or deny for the vote to succeed/fail", 3)
MACRO_CONFIG_INT(SvVotePercentage, sv_vote_percentage, 50, 1, 100, CFGFLAG_SERVER, "The percent of people that need to agree or deny for the vote to succeed/fail", 4)
MACRO_CONFIG_INT(SvShotgunBulletSound, sv_shotgun_bullet_sound, 0, 0, 1, CFGFLAG_SERVER, "Crazy shotgun bullet sound on/off", 3)
MACRO_CONFIG_INT(SvCheckpointSave, sv_checkpoint_save, 1, 0, 1, CFGFLAG_SERVER, "Whether to save checkpoint times to the score file", 3)
MACRO_CONFIG_STR(SvScoreFolder, sv_score_folder, 32, "records", CFGFLAG_SERVER, "Folder to save score files to", 3)
#if defined(CONF_SQL)
MACRO_CONFIG_INT(SvUseSQL, sv_use_sql, 0, 0, 1, CFGFLAG_SERVER, "Enables SQL DB instead of record file", 4)
MACRO_CONFIG_STR(SvSqlUser, sv_sql_user, 32, "nameless", CFGFLAG_SERVER, "SQL User", 4)
MACRO_CONFIG_STR(SvSqlPw, sv_sql_pw, 32, "tee", CFGFLAG_SERVER, "SQL Password", 4)
@ -132,6 +139,7 @@ MACRO_CONFIG_STR(SvSqlIp, sv_sql_ip, 32, "127.0.0.1", CFGFLAG_SERVER, "SQL Datab
MACRO_CONFIG_INT(SvSqlPort, sv_sql_port, 3306, 0, 65535, CFGFLAG_SERVER, "SQL Database port", 4)
MACRO_CONFIG_STR(SvSqlDatabase, sv_sql_database, 16, "teeworlds", CFGFLAG_SERVER, "SQL Database name", 4)
MACRO_CONFIG_STR(SvSqlPrefix, sv_sql_prefix, 16, "record", CFGFLAG_SERVER, "SQL Database table prefix", 4)
#endif
MACRO_CONFIG_INT(SvDDRaceRules, sv_ddrace_rules, 1, 0, 1, CFGFLAG_SERVER, "Whether the default mod rules are displayed or not", 4)
MACRO_CONFIG_STR(SvRulesLine1, sv_rules_line1, 40, "", CFGFLAG_SERVER, "Rules line 1", 4)
@ -146,13 +154,17 @@ MACRO_CONFIG_STR(SvRulesLine9, sv_rules_line9, 40, "", CFGFLAG_SERVER, "Rules li
MACRO_CONFIG_STR(SvRulesLine10, sv_rules_line10, 40, "", CFGFLAG_SERVER, "Rules line 10", 4)
//MACRO_CONFIG_INT(SvReconnectTime, sv_reconnect_time,5,0,9999,CFGFLAG_SERVER, "The time in seconds between leaves and joins of clients with the same ip", 3)
MACRO_CONFIG_INT(SvTeam, sv_team, 0, -1, 1, CFGFLAG_SERVER, "Teams configuration", 3)
MACRO_CONFIG_INT(SvTeam, sv_team, 0, -1, 1, CFGFLAG_SERVER, "Teams configuration", 4)
MACRO_CONFIG_INT(SvTeamStrict, sv_team_strict, 0, 0, 1, CFGFLAG_SERVER, "Kill or not all team if someone left game in team", 4)
MACRO_CONFIG_STR(SvAnnouncementFileName, sv_announcement_filename, 24, "announcement.txt", CFGFLAG_SERVER, "file which will have the announcement, each one at a line", 3)
MACRO_CONFIG_INT(SvAnnouncementInterval, sv_announcement_interval, 30, 15, 9999, CFGFLAG_SERVER, "time(minutes) in which the announcement will be displayed from the announcement file", 3)
MACRO_CONFIG_INT(SvAnnouncementRandom, sv_announcement_random, 1, 0, 1, CFGFLAG_SERVER, "Whether announcements are sequential or random", 3)
MACRO_CONFIG_INT(SvOldLaser, sv_old_laser, 0, 0, 1, CFGFLAG_SERVER, "Whether lasers can hit you if you shot them and that they pull you towards the bounce origin (0 for DDRace Beta) or lasers can't hit you if you shot them, and they pull others towards the shooter", 4)
MACRO_CONFIG_INT(SvSlashMe, sv_slash_me, 0, 0, 1, CFGFLAG_SERVER, "Whether /me is active on the server or not", 4)
MACRO_CONFIG_INT(ConnTimeout, conn_timeout, 15, 5, 100, CFGFLAG_CLIENT|CFGFLAG_SERVER, "Network timeout", 4)
MACRO_CONFIG_INT(DbgMsg, dbg_msg, 0, 0, 1, CFGFLAG_CLIENT|CFGFLAG_SERVER, "Display or not debug messages", 4)
MACRO_CONFIG_INT(DbgMsg, dbg_msg, 0, 0, 1, CFGFLAG_CLIENT|CFGFLAG_SERVER, "Display or not debug messages", 3)
#endif

View file

@ -345,8 +345,6 @@ void CConsole::ExecuteLineStroked(int Stroke, const char *pStr, const int Client
FPrintCallback pfnAlternativePrintCallback, void *pUserData,
FPrintCallback pfnAlternativePrintResponseCallback, void *pResponseUserData)
{
CResult *pResult = new(&m_ExecutionQueue.m_pLast->m_Result) CResult;
while(pStr && *pStr)
{
CResult *pResult = new(&m_ExecutionQueue.m_pLast->m_Result) CResult;
@ -631,7 +629,7 @@ void CConsole::Con_Exec(IResult *pResult, void *pUserData, int ClientId)
struct CIntVariableData
{
IConsole *m_pConsole;
char *m_Name;
const char *m_Name;
int *m_pVariable;
int m_Min;
int m_Max;
@ -640,7 +638,7 @@ struct CIntVariableData
struct CStrVariableData
{
IConsole *m_pConsole;
char *m_Name;
const char *m_Name;
char *m_pStr;
int m_MaxSize;
};
@ -776,7 +774,7 @@ void CConsole::ParseArguments(int NumArgs, const char **ppArguments)
if(ppArguments[i][0] == '-' && ppArguments[i][1] == 'f' && ppArguments[i][2] == 0)
{
if(NumArgs - i > 1)
ExecuteFile(ppArguments[i+1]);
ExecuteFile(ppArguments[i+1], 0, 0, 0, 0, 4);
i++;
}
else if(!str_comp("-s", ppArguments[i]) || !str_comp("--silent", ppArguments[i]))
@ -809,37 +807,56 @@ void CConsole::Register(const char *pName, const char *pParams,
m_aCommandCount[pCommand->m_Level]++;
}
void CConsole::List(const int Level, int Flags, int Page)
void CConsole::List(const int Level, int Flags)
{
int Count = 0;
if(!Page)
switch(Level)
{
for (int i = 0; i <= Level; ++i)
{
Count += m_aCommandCount[i];
}
char aBuf[300];
str_format(aBuf,sizeof(aBuf),"The Number of Pages is %d, use 'CMDList i' (where i is the page number)", Count);
PrintResponse(IConsole::OUTPUT_LEVEL_STANDARD, "Console", aBuf);
return;
case 4: PrintResponse(IConsole::OUTPUT_LEVEL_STANDARD, "console", "command cmdlist is not allowed for config files"); return;
case 3: PrintResponse(IConsole::OUTPUT_LEVEL_STANDARD, "console", "=== cmdlist for admins ==="); break;
case 2: PrintResponse(IConsole::OUTPUT_LEVEL_STANDARD, "console", "=== cmdlist for mods ==="); break;
case 1: PrintResponse(IConsole::OUTPUT_LEVEL_STANDARD, "console", "=== cmdlist for helpers ==="); break;
default: PrintResponse(IConsole::OUTPUT_LEVEL_STANDARD, "console", "=== cmdlist ==="); break;
}
char aBuf[50 + 1] = { 0 };
CCommand *pCommand = m_pFirstCommand;
unsigned Length = 0;
while(pCommand)
{
if(pCommand)
if((pCommand->m_Level <= Level))
if((!Flags)?true:pCommand->m_Flags&Flags)
if(str_comp_num(pCommand->m_pName, "sv_", 3) && str_comp_num(pCommand->m_pName, "dbg_", 4)) // ignore configs and debug commands
{
if((pCommand->m_Flags & Flags) == Flags && (pCommand->m_Level == Level || (Level == 1 && (pCommand->m_Flags & CMDFLAG_HELPERCMD))))
{
unsigned CommandLength = str_length(pCommand->m_pName);
if(Length + CommandLength + 2 >= sizeof(aBuf) || aBuf[0] == 0)
{
if(++Count/5 == Page)
{
char aBuf[300];
str_format(aBuf,sizeof(aBuf),"Name: %s, Parameters: %s, Help: %s",pCommand->m_pName, (!str_length(pCommand->m_pParams))?"None.":pCommand->m_pParams, (!str_length(pCommand->m_pHelp))?"No Help String Given":pCommand->m_pHelp);
PrintResponse(IConsole::OUTPUT_LEVEL_STANDARD, "Console", aBuf);
}
if(aBuf[0])
PrintResponse(IConsole::OUTPUT_LEVEL_STANDARD, "console", aBuf);
aBuf[0] = 0;
Length = CommandLength;
str_copy(aBuf, pCommand->m_pName, sizeof(aBuf));
}
else
{
str_format(aBuf, sizeof(aBuf), "%s, %s", aBuf, pCommand->m_pName);
Length += CommandLength + 2;
}
}
}
pCommand = pCommand->m_pNext;
}
if (aBuf[0])
PrintResponse(IConsole::OUTPUT_LEVEL_STANDARD, "Console", aBuf);
switch(Level)
{
case 3: PrintResponse(IConsole::OUTPUT_LEVEL_STANDARD, "console", "see 'cmdlist 0,1,2' for more commands, which don't require admin rights"); break;
case 2: PrintResponse(IConsole::OUTPUT_LEVEL_STANDARD, "console", "see 'cmdlist 0,1' for more commands, which don't require mod rights"); break;
case 1: PrintResponse(IConsole::OUTPUT_LEVEL_STANDARD, "console", "see 'cmdlist 0' for more commands, which don't require helper rights"); break;
default: break;
}
}
void CConsole::Con_Chain(IResult *pResult, void *pUserData, int ClientId)

View file

@ -148,7 +148,7 @@ public:
virtual void ParseArguments(int NumArgs, const char **ppArguments);
virtual void Register(const char *pName, const char *pParams, int Flags, FCommandCallback pfnFunc, void *pUser, const char *pHelp, const int Level);
virtual void List(const int Level, int Flags, int Page = 0);
virtual void List(const int Level, int Flags);
virtual void Chain(const char *pName, FChainCommandCallback pfnChainFunc, void *pUser);
virtual void StoreCommands(bool Store, int ClientId);

View file

@ -105,6 +105,7 @@ int CDemoRecorder::Start(class IStorage *pStorage, class IConsole *pConsole, con
m_LastKeyFrame = -1;
m_LastTickMarker = -1;
m_FirstTick = -1;
char aBuf[256];
str_format(aBuf, sizeof(aBuf), "Recording to '%s'", pFilename);
@ -164,6 +165,8 @@ void CDemoRecorder::WriteTickMarker(int Tick, int Keyframe)
}
m_LastTickMarker = Tick;
if(m_FirstTick < 0)
m_FirstTick = Tick;
}
void CDemoRecorder::Write(int Type, const void *pData, int Size)

View file

@ -22,6 +22,7 @@ class CDemoRecorder : public IDemoRecorder
IOHANDLE m_File;
int m_LastTickMarker;
int m_LastKeyFrame;
int m_FirstTick;
unsigned char m_aLastSnapshotData[CSnapshot::MAX_SIZE];
class CSnapshotDelta *m_pSnapshotDelta;
@ -37,6 +38,8 @@ public:
void RecordMessage(const void *pData, int Size);
bool IsRecording() const { return m_File != 0; }
int TickCount() const { return m_LastTickMarker - m_FirstTick; }
};
class CDemoPlayer : public IDemoPlayer

View file

@ -1,6 +1,5 @@
/* (c) Magnus Auvinen. See licence.txt in the root of the distribution for more information. */
/* If you are missing that file, acquire a complete release at teeworlds.com. */
#include <stdio.h> //remove()
#include <base/system.h>
#include <engine/storage.h>
#include "engine.h"
@ -22,6 +21,7 @@ public:
int m_NumPaths;
char m_aDatadir[MAX_PATH_LENGTH];
char m_aUserdir[MAX_PATH_LENGTH];
char m_aCurrentdir[MAX_PATH_LENGTH];
CStorage()
{
@ -39,6 +39,10 @@ public:
// get datadir
FindDatadir(ppArguments[0]);
// get currentdir
if(!fs_getcwd(m_aCurrentdir, sizeof(m_aCurrentdir)))
m_aCurrentdir[0] = 0;
// load paths from storage.cfg
LoadPaths(ppArguments[0]);
@ -53,10 +57,12 @@ public:
{
char aPath[MAX_PATH_LENGTH];
fs_makedir(GetPath(TYPE_SAVE, "screenshots", aPath, sizeof(aPath)));
fs_makedir(GetPath(TYPE_SAVE, "screenshots/auto", aPath, sizeof(aPath)));
fs_makedir(GetPath(TYPE_SAVE, "maps", aPath, sizeof(aPath)));
fs_makedir(GetPath(TYPE_SAVE, "dumps", aPath, sizeof(aPath)));
fs_makedir(GetPath(TYPE_SAVE, "downloadedmaps", aPath, sizeof(aPath)));
fs_makedir(GetPath(TYPE_SAVE, "demos", aPath, sizeof(aPath)));
fs_makedir(GetPath(TYPE_SAVE, "demos/auto", aPath, sizeof(aPath)));
}
return m_NumPaths ? 0 : 1;
@ -135,7 +141,7 @@ public:
else if(!str_comp(pPath, "$CURRENTDIR"))
{
m_aaStoragePaths[m_NumPaths++][0] = 0;
dbg_msg("storage", "added path '$CURRENTDIR'");
dbg_msg("storage", "added path '$CURRENTDIR' ('%s')", m_aCurrentdir);
}
else
{
@ -188,18 +194,20 @@ public:
// 4) check for all default locations
{
const char *aDirs[] = {
"/usr/share/teeworlds/data/mapres",
"/usr/share/games/teeworlds/data/mapres",
"/usr/local/share/teeworlds/data/mapres",
"/usr/local/share/games/teeworlds/data/mapres",
"/opt/teeworlds/data/mapres"
"/usr/share/teeworlds/data",
"/usr/share/games/teeworlds/data",
"/usr/local/share/teeworlds/data",
"/usr/local/share/games/teeworlds/data",
"/opt/teeworlds/data"
};
const int DirsCount = sizeof(aDirs) / sizeof(aDirs[0]);
int i;
for (i = 0; i < DirsCount; i++)
{
if (fs_is_dir(aDirs[i]))
char aBuf[128];
str_format(aBuf, sizeof(aBuf), "%s/mapres", aDirs[i]);
if(fs_is_dir(aBuf))
{
str_copy(m_aDatadir, aDirs[i], sizeof(m_aDatadir));
return;
@ -280,7 +288,16 @@ public:
return false;
char aBuffer[MAX_PATH_LENGTH];
return remove(GetPath(Type, pFilename, aBuffer, sizeof(aBuffer)));
return !fs_remove(GetPath(Type, pFilename, aBuffer, sizeof(aBuffer)));
}
virtual bool RenameFile(const char* pOldFilename, const char* pNewFilename, int Type)
{
if(Type < 0 || Type >= m_NumPaths)
return false;
char aOldBuffer[MAX_PATH_LENGTH];
char aNewBuffer[MAX_PATH_LENGTH];
return !fs_rename(GetPath(Type, pOldFilename, aOldBuffer, sizeof(aOldBuffer)), GetPath(Type, pNewFilename, aNewBuffer, sizeof (aNewBuffer)));
}
virtual bool CreateFolder(const char *pFoldername, int Type)
@ -289,7 +306,7 @@ public:
return false;
char aBuffer[MAX_PATH_LENGTH];
return fs_makedir(GetPath(Type, pFoldername, aBuffer, sizeof(aBuffer)));
return !fs_makedir(GetPath(Type, pFoldername, aBuffer, sizeof(aBuffer)));
}
static IStorage *Create(const char *pApplicationName, int NumArgs, const char **ppArguments)

View file

@ -18,6 +18,7 @@ public:
virtual void ListDirectory(int Type, const char *pPath, FS_LISTDIR_CALLBACK pfnCallback, void *pUser) = 0;
virtual IOHANDLE OpenFile(const char *pFilename, int Flags, int Type, char *pBuffer = 0, int BufferSize = 0) = 0;
virtual bool RemoveFile(const char *pFilename, int Type) = 0;
virtual bool RenameFile(const char* pOldFilename, const char* pNewFilename, int Type) = 0;
virtual bool CreateFolder(const char *pFoldername, int Type) = 0;
};

View file

@ -1,7 +1,6 @@
/* (c) Magnus Auvinen. See licence.txt in the root of the distribution for more information. */
/* If you are missing that file, acquire a complete release at teeworlds.com. */
#include <math.h>
#include <time.h>
#include <game/generated/client_data.h>
@ -593,34 +592,25 @@ void CGameConsole::Dump(int Type)
{
CInstance *pConsole = Type == CONSOLETYPE_REMOTE ? &m_RemoteConsole : &m_LocalConsole;
char aFilename[128];
time_t Time;
char aDate[20];
time(&Time);
tm* TimeInfo = localtime(&Time);
strftime(aDate, sizeof(aDate), "%Y-%m-%d_%I-%M", TimeInfo);
for(int i = 0; i < 10; i++)
str_timestamp(aDate, sizeof(aDate));
str_format(aFilename, sizeof(aFilename), "dumps/%s_dump_%s.txt", Type==CONSOLETYPE_REMOTE?"remote_console":"local_console", aDate);
IOHANDLE io = Storage()->OpenFile(aFilename, IOFLAG_WRITE, IStorage::TYPE_SAVE);
if(io)
{
IOHANDLE io;
str_format(aFilename, sizeof(aFilename), "dumps/%s_dump%s-%05d.txt", Type==CONSOLETYPE_REMOTE?"remote_console":"local_console", aDate, i);
io = Storage()->OpenFile(aFilename, IOFLAG_WRITE, IStorage::TYPE_SAVE);
if(io)
{
#if defined(CONF_FAMILY_WINDOWS)
static const char Newline[] = "\r\n";
#else
static const char Newline[] = "\n";
#endif
#if defined(CONF_FAMILY_WINDOWS)
static const char Newline[] = "\r\n";
#else
static const char Newline[] = "\n";
#endif
for(CInstance::CBacklogEntry *pEntry = pConsole->m_Backlog.First(); pEntry; pEntry = pConsole->m_Backlog.Next(pEntry))
{
io_write(io, pEntry->m_aText, str_length(pEntry->m_aText));
io_write(io, Newline, sizeof(Newline)-1);
}
io_close(io);
break;
for(CInstance::CBacklogEntry *pEntry = pConsole->m_Backlog.First(); pEntry; pEntry = pConsole->m_Backlog.Next(pEntry))
{
io_write(io, pEntry->m_aText, str_length(pEntry->m_aText));
io_write(io, Newline, sizeof(Newline)-1);
}
io_close(io);
}
}

View file

@ -1,6 +1,7 @@
/* (c) Magnus Auvinen. See licence.txt in the root of the distribution for more information. */
/* If you are missing that file, acquire a complete release at teeworlds.com. */
#include <engine/demo.h>
#include <engine/shared/config.h>
#include <game/generated/client_data.h>
@ -153,9 +154,14 @@ void CEffects::PlayerDeath(vec2 Pos, int Cid)
if(Cid >= 0)
{
const CSkins::CSkin *s = m_pClient->m_pSkins->Get(m_pClient->m_aClients[Cid].m_SkinId);
if(s)
BloodColor = s->m_BloodColor;
if(m_pClient->m_aClients[Cid].m_UseCustomColor)
BloodColor = m_pClient->m_pSkins->GetColorV3(m_pClient->m_aClients[Cid].m_ColorBody);
else
{
const CSkins::CSkin *s = m_pClient->m_pSkins->Get(m_pClient->m_aClients[Cid].m_SkinId);
if(s)
BloodColor = s->m_BloodColor;
}
}
for(int i = 0; i < 64; i++)

View file

@ -56,9 +56,12 @@ void CHud::RenderGameTimer()
else
Time = (Client()->GameTick()-m_pClient->m_Snap.m_pGameobj->m_RoundStartTick)/Client()->GameTickSpeed();
str_format(Buf, sizeof(Buf), "%d:%02d", Time/60, Time%60);
if(Time <= 0)
str_format(Buf, sizeof(Buf), "00:00.0");
else
str_format(Buf, sizeof(Buf), "%02d:%02d.%d", Time/60, Time%60, m_DDRaceTick/10);
float FontSize = 10.0f;
float w = TextRender()->TextWidth(0, FontSize, Buf, -1);
float w = TextRender()->TextWidth(0, 12,"00:00.0",-1);
TextRender()->Text(0, Half-w/2, 2, FontSize, Buf, -1);
}
}
@ -319,7 +322,7 @@ void CHud::RenderHealthAndAmmo()
Graphics()->QuadsEnd();
}
void CHud::RenderTime()
void CHud::RenderDDRaceEffects()
{
// check racestate
if(m_FinishTime && m_LastReceivedTimeTick + Client()->GameTickSpeed()*2 < Client()->GameTick())
@ -337,13 +340,7 @@ void CHud::RenderTime()
str_format(aBuf, sizeof(aBuf), "Finish time: %02d:%02d.%02d", m_DDRaceTime/6000, m_DDRaceTime/100-m_DDRaceTime/6000 * 60, m_DDRaceTime % 100);
TextRender()->Text(0, 150*Graphics()->ScreenAspect()-TextRender()->TextWidth(0,12,aBuf,-1)/2, 20, 12, aBuf, -1);
}
else if(m_DDRaceTimeReceived)
{
str_format(aBuf, sizeof(aBuf), "%02d:%02d.%d", m_DDRaceTime/60, m_DDRaceTime%60, m_DDRaceTick/10);
TextRender()->Text(0, 150*Graphics()->ScreenAspect()-TextRender()->TextWidth(0,12,"00:00.0",-1)/2, 20, 12, aBuf, -1); // use fixed value for text width so its not shaky
}
if(m_CheckpointTick+Client()->GameTickSpeed()*6 > Client()->GameTick())
else if(m_CheckpointTick + Client()->GameTickSpeed()*6 > Client()->GameTick())
{
str_format(aBuf, sizeof(aBuf), "%+5.2f", m_CheckpointDiff);
@ -361,11 +358,18 @@ void CHud::RenderTime()
TextRender()->TextColor(0.5f,1.0f,0.5f,a); // green
else if(!m_CheckpointDiff)
TextRender()->TextColor(1,1,1,a); // white
TextRender()->Text(0, 150*Graphics()->ScreenAspect()-TextRender()->TextWidth(0, 10, aBuf, -1)/2, 33, 10, aBuf, -1);
TextRender()->Text(0, 150*Graphics()->ScreenAspect()-TextRender()->TextWidth(0, 10, aBuf, -1)/2, 20, 10, aBuf, -1);
TextRender()->TextColor(1,1,1,1);
}
}
/*else if(m_DDRaceTimeReceived)
{
str_format(aBuf, sizeof(aBuf), "%02d:%02d.%d", m_DDRaceTime/60, m_DDRaceTime%60, m_DDRaceTick/10);
TextRender()->Text(0, 150*Graphics()->ScreenAspect()-TextRender()->TextWidth(0, 12,"00:00.0",-1)/2, 20, 12, aBuf, -1); // use fixed value for text width so its not shaky
}*/
static int LastChangeTick = 0;
if(LastChangeTick != Client()->PredGameTick())
@ -412,7 +416,7 @@ void CHud::OnRender()
if(m_pClient->m_Snap.m_pLocalCharacter && !Spectate && !(m_pClient->m_Snap.m_pGameobj && m_pClient->m_Snap.m_pGameobj->m_GameOver)) {
RenderHealthAndAmmo();
RenderTime();
RenderDDRaceEffects();
}

View file

@ -31,7 +31,7 @@ class CHud : public CComponent
void RenderSuddenDeath();
void RenderScoreHud();
void RenderWarmupTimer();
void RenderTime();
void RenderDDRaceEffects();
void RenderRecord();
void MapscreenToGroup(float CenterX, float CenterY, struct CMapItemGroup *PGroup);

View file

@ -743,7 +743,7 @@ void CMenus::OnInit()
// */
if(g_Config.m_ClShowWelcome)
m_Popup = POPUP_FIRST_LAUNCH;
m_Popup = POPUP_LANGUAGE;
g_Config.m_ClShowWelcome = 0;
Console()->Chain("add_favorite", ConchainServerbrowserUpdate, this);
@ -979,6 +979,23 @@ int CMenus::Render()
static float Offset = 0.0f;
DoEditBox(&g_Config.m_Password, &TextBox, g_Config.m_Password, sizeof(g_Config.m_Password), 12.0f, &Offset, true);
}
else if(m_Popup == POPUP_LANGUAGE)
{
Box = Screen;
Box.VMargin(150.0f, &Box);
Box.HMargin(150.0f, &Box);
Box.HSplitTop(20.f, &Part, &Box);
Box.HSplitBottom(20.f, &Box, &Part);
Box.HSplitBottom(24.f, &Box, &Part);
Box.HSplitBottom(20.f, &Box, 0);
Box.VMargin(20.0f, &Box);
RenderLanguageSelection(Box);
Part.VMargin(120.0f, &Part);
static int s_Button = 0;
if(DoButton_Menu(&s_Button, Localize("Ok"), 0, &Part) || m_EscapePressed || m_EnterPressed)
m_Popup = POPUP_FIRST_LAUNCH;
}
else if(m_Popup == POPUP_DELETE_DEMO)
{
CUIRect Yes, No;

View file

@ -95,6 +95,7 @@ class CMenus : public CComponent
POPUP_MESSAGE,
POPUP_DISCONNECTED,
POPUP_PURE,
POPUP_LANGUAGE,
POPUP_DELETE_DEMO,
POPUP_PASSWORD,
POPUP_QUIT,
@ -212,6 +213,7 @@ class CMenus : public CComponent
static void ConchainServerbrowserUpdate(IConsole::IResult *pResult, void *pUserData, IConsole::FCommandCallback pfnCallback, void *pCallbackUserData);
// found in menus_settings.cpp
void RenderLanguageSelection(CUIRect MainView);
void RenderSettingsGeneral(CUIRect MainView);
void RenderSettingsPlayer(CUIRect MainView);
void RenderSettingsControls(CUIRect MainView);

View file

@ -484,9 +484,11 @@ void CMenus::RenderDemoList(CUIRect MainView)
{
char aBuf[512];
str_format(aBuf, sizeof(aBuf), "%s/%s", m_aCurrentDemoFolder, m_lDemos[m_DemolistSelectedIndex].m_aFilename);
Storage()->RemoveFile(aBuf, m_lDemos[m_DemolistSelectedIndex].m_StorageType);
DemolistPopulate();
DemolistOnUpdate(false);
if(Storage()->RemoveFile(aBuf, m_lDemos[m_DemolistSelectedIndex].m_StorageType))
{
DemolistPopulate();
DemolistOnUpdate(false);
}
}
m_DemolistDelEntry = false;
}

View file

@ -1,7 +1,5 @@
/* (c) Magnus Auvinen. See licence.txt in the root of the distribution for more information. */
/* If you are missing that file, acquire a complete release at teeworlds.com. */
#include <time.h>
#include <base/math.h>
#include <engine/demo.h>
@ -101,16 +99,9 @@ void CMenus::RenderGame(CUIRect MainView)
if(DoButton_Menu(&s_DemoButton, Localize(Recording ? "Stop record" : "Record demo"), 0, &Button)) // Localize("Stop record");Localize("Record demo");
{
if(!Recording)
{
char aFilename[128];
time_t Time;
time(&Time);
tm* TimeInfo = localtime(&Time);
strftime(aFilename, sizeof(aFilename), "demo-%Y-%m-%d_%H-%M-%S", TimeInfo);
Client()->DemoRecorder_Start(aFilename);
}
Client()->DemoRecorder_Start("demo", true);
else
DemoRecorder()->Stop();
Client()->DemoRecorder_Stop();
}
/*

View file

@ -116,8 +116,8 @@ void CMenus::RenderSettingsPlayer(CUIRect MainView)
if(g_Config.m_PlayerUseCustomColor)
{
OwnSkinInfo.m_ColorBody = m_pClient->m_pSkins->GetColor(g_Config.m_PlayerColorBody);
OwnSkinInfo.m_ColorFeet = m_pClient->m_pSkins->GetColor(g_Config.m_PlayerColorFeet);
OwnSkinInfo.m_ColorBody = m_pClient->m_pSkins->GetColorV4(g_Config.m_PlayerColorBody);
OwnSkinInfo.m_ColorFeet = m_pClient->m_pSkins->GetColorV4(g_Config.m_PlayerColorFeet);
OwnSkinInfo.m_Texture = pOwnSkin->m_ColorTexture;
}
@ -250,8 +250,8 @@ void CMenus::RenderSettingsPlayer(CUIRect MainView)
if(g_Config.m_PlayerUseCustomColor)
{
Info.m_ColorBody = m_pClient->m_pSkins->GetColor(g_Config.m_PlayerColorBody);
Info.m_ColorFeet = m_pClient->m_pSkins->GetColor(g_Config.m_PlayerColorFeet);
Info.m_ColorBody = m_pClient->m_pSkins->GetColorV4(g_Config.m_PlayerColorBody);
Info.m_ColorFeet = m_pClient->m_pSkins->GetColorV4(g_Config.m_PlayerColorFeet);
Info.m_Texture = s->m_ColorTexture;
}
@ -261,9 +261,10 @@ void CMenus::RenderSettingsPlayer(CUIRect MainView)
if(g_Config.m_Debug)
{
vec3 BloodColor = g_Config.m_PlayerUseCustomColor ? m_pClient->m_pSkins->GetColorV3(g_Config.m_PlayerColorBody) : s->m_BloodColor;
Graphics()->TextureSet(-1);
Graphics()->QuadsBegin();
Graphics()->SetColor(s->m_BloodColor.r, s->m_BloodColor.g, s->m_BloodColor.b, 1.0f);
Graphics()->SetColor(BloodColor.r, BloodColor.g, BloodColor.b, 1.0f);
IGraphics::CQuadItem QuadItem(Item.m_Rect.x, Item.m_Rect.y, 12, 12);
Graphics()->QuadsDrawTL(&QuadItem, 1);
Graphics()->QuadsEnd();
@ -707,7 +708,7 @@ void LoadLanguageIndexfile(IStorage *pStorage, IConsole *pConsole, sorted_array<
io_close(File);
}
void CMenus::RenderSettingsGeneral(CUIRect MainView)
void CMenus::RenderLanguageSelection(CUIRect MainView)
{
static int s_LanguageList = 0;
static int s_SelectedLanguage = 0;
@ -728,8 +729,7 @@ void CMenus::RenderSettingsGeneral(CUIRect MainView)
int OldSelected = s_SelectedLanguage;
CUIRect List = MainView;
UiDoListboxStart(&s_LanguageList , &List, 24.0f, Localize("Language"), "", s_Languages.size(), 1, s_SelectedLanguage, s_ScrollValue);
UiDoListboxStart(&s_LanguageList , &MainView, 24.0f, Localize("Language"), "", s_Languages.size(), 1, s_SelectedLanguage, s_ScrollValue);
for(sorted_array<CLanguage>::range r = s_Languages.all(); !r.empty(); r.pop_front())
{
@ -748,6 +748,51 @@ void CMenus::RenderSettingsGeneral(CUIRect MainView)
}
}
void CMenus::RenderSettingsGeneral(CUIRect MainView)
{
CUIRect List, Button, Label, Left, Right;
MainView.HSplitBottom(10.0f, &MainView, 0);
MainView.HSplitBottom(70.0f, &MainView, &Left);
Left.VSplitMid(&Left, &Right);
MainView.HSplitBottom(20.0f, &List, &MainView);
// auto demo settings
{
Left.HSplitTop(20.0f, &Button, &Left);
if(DoButton_CheckBox(&g_Config.m_ClAutoDemoRecord, Localize("Automatically record demos"), g_Config.m_ClAutoDemoRecord, &Button))
g_Config.m_ClAutoDemoRecord ^= 1;
Right.HSplitTop(20.0f, &Button, &Right);
if(DoButton_CheckBox(&g_Config.m_ClAutoScreenshot, Localize("Automatically take game over screenshot"), g_Config.m_ClAutoScreenshot, &Button))
g_Config.m_ClAutoScreenshot ^= 1;
Left.HSplitTop(10.0f, 0, &Left);
Left.VSplitLeft(20.0f, 0, &Left);
Left.HSplitTop(20.0f, &Label, &Button);
Button.VSplitRight(20.0f, &Button, 0);
char aBuf[64];
if(g_Config.m_ClAutoDemoMax)
str_format(aBuf, sizeof(aBuf), "%s: %i", Localize("Max demos"), g_Config.m_ClAutoDemoMax);
else
str_format(aBuf, sizeof(aBuf), "%s: %s", Localize("Max demos"), Localize("no limit"));
UI()->DoLabel(&Label, aBuf, 13.0f, -1);
g_Config.m_ClAutoDemoMax = static_cast<int>(DoScrollbarH(&g_Config.m_ClAutoDemoMax, &Button, g_Config.m_ClAutoDemoMax/1000.0f)*1000.0f+0.1f);
Right.HSplitTop(10.0f, 0, &Right);
Right.VSplitLeft(20.0f, 0, &Right);
Right.HSplitTop(20.0f, &Label, &Button);
Button.VSplitRight(20.0f, &Button, 0);
if(g_Config.m_ClAutoScreenshotMax)
str_format(aBuf, sizeof(aBuf), "%s: %i", Localize("Max Screenshots"), g_Config.m_ClAutoScreenshotMax);
else
str_format(aBuf, sizeof(aBuf), "%s: %s", Localize("Max Screenshots"), Localize("no limit"));
UI()->DoLabel(&Label, aBuf, 13.0f, -1);
g_Config.m_ClAutoScreenshotMax = static_cast<int>(DoScrollbarH(&g_Config.m_ClAutoScreenshotMax, &Button, g_Config.m_ClAutoScreenshotMax/1000.0f)*1000.0f+0.1f);
}
RenderLanguageSelection(List);
}
void CMenus::RenderSettings(CUIRect MainView)
{
static int s_SettingsPage = 0;

View file

@ -50,7 +50,8 @@ void CParticles::Add(int Group, CParticle *pPart)
// remove from the free list
int Id = m_FirstFree;
m_FirstFree = m_aParticles[Id].m_NextPart;
m_aParticles[m_FirstFree].m_PrevPart = -1;
if(m_FirstFree != -1)
m_aParticles[m_FirstFree].m_PrevPart = -1;
// copy data
m_aParticles[Id] = *pPart;

View file

@ -158,11 +158,11 @@ void CScoreboard::RenderScoreboard(float x, float y, float w, int Team, const ch
{
TextRender()->Text(0, x+10, y, 48, pTitle, -1);
if(m_pClient->m_Snap.m_pGameobj)
/*if(m_pClient->m_Snap.m_pGameobj) // This is Useless
{
char aBuf[128];
int Score = Team ? m_pClient->m_Snap.m_pGameobj->m_TeamscoreBlue : m_pClient->m_Snap.m_pGameobj->m_TeamscoreRed;
}
}*/
}
y += 54.0f;
@ -263,12 +263,15 @@ void CScoreboard::RenderScoreboard(float x, float y, float w, int Team, const ch
while(TextRender()->TextWidth(0, FontSizeResize, m_pClient->m_aClients[pInfo->m_ClientId].m_aName, -1) > w-163.0f-Offset-PingWidth)
--FontSizeResize;
if (g_Config.m_ClShowIds) {
if (g_Config.m_ClShowIds)
{
char aId[64] = "";
str_format(aId, sizeof(aId),"%d:", pInfo->m_ClientId);
str_append(aId, m_pClient->m_aClients[pInfo->m_ClientId].m_aName,sizeof(aId));
TextRender()->Text(0, x+128.0f+Offset, y+(FontSize-FontSizeResize)/2, FontSizeResize, aId, -1);
}
TextRender()->Text(0, x+128.0f+Offset, y+(FontSize-FontSizeResize)/2, FontSizeResize, m_pClient->m_aClients[pInfo->m_ClientId].m_aName, -1);
else
TextRender()->Text(0, x+128.0f+Offset, y+(FontSize-FontSizeResize)/2, FontSizeResize, m_pClient->m_aClients[pInfo->m_ClientId].m_aName, -1);
FontSizeResize = FontSize;

View file

@ -179,7 +179,12 @@ static vec3 HslToRgb(vec3 in)
return Out;
}
vec4 CSkins::GetColor(int v)
vec3 CSkins::GetColorV3(int v)
{
return HslToRgb(vec3(((v>>16)&0xff)/255.0f, ((v>>8)&0xff)/255.0f, 0.5f+(v&0xff)/255.0f*0.5f));
}
vec4 CSkins::GetColorV4(int v)
{
vec3 r = HslToRgb(vec3(((v>>16)&0xff)/255.0f, ((v>>8)&0xff)/255.0f, 0.5f+(v&0xff)/255.0f*0.5f));
return vec4(r.r, r.g, r.b, 1.0f);

View file

@ -22,7 +22,8 @@ public:
void Init();
vec4 GetColor(int v);
vec3 GetColorV3(int v);
vec4 GetColorV4(int v);
int Num();
const CSkin *Get(int Index);
int Find(const char *pName);

View file

@ -623,6 +623,12 @@ void CGameClient::OnStateChange(int NewState, int OldState)
void CGameClient::OnShutdown() {}
void CGameClient::OnEnterGame() {}
void CGameClient::OnGameOver()
{
if(Client()->State() != IClient::STATE_DEMOPLAYBACK)
Client()->AutoScreenshot_Start();
}
void CGameClient::OnRconLine(const char *pLine)
{
m_pGameConsole->PrintLine(CGameConsole::CONSOLETYPE_REMOTE, pLine);
@ -745,8 +751,8 @@ void CGameClient::OnNewSnapshot()
if(m_aClients[Cid].m_aSkinName[0] == 'x' || m_aClients[Cid].m_aSkinName[1] == '_')
str_copy(m_aClients[Cid].m_aSkinName, "default", 64);
m_aClients[Cid].m_SkinInfo.m_ColorBody = m_pSkins->GetColor(m_aClients[Cid].m_ColorBody);
m_aClients[Cid].m_SkinInfo.m_ColorFeet = m_pSkins->GetColor(m_aClients[Cid].m_ColorFeet);
m_aClients[Cid].m_SkinInfo.m_ColorBody = m_pSkins->GetColorV4(m_aClients[Cid].m_ColorBody);
m_aClients[Cid].m_SkinInfo.m_ColorFeet = m_pSkins->GetColorV4(m_aClients[Cid].m_ColorFeet);
m_aClients[Cid].m_SkinInfo.m_Size = 64;
// find new skin
@ -808,7 +814,13 @@ void CGameClient::OnNewSnapshot()
}
}
else if(Item.m_Type == NETOBJTYPE_GAME)
{
static int s_GameOver = 0;
m_Snap.m_pGameobj = (CNetObj_Game *)pData;
if(s_GameOver == 0 && m_Snap.m_pGameobj->m_GameOver != 0)
OnGameOver();
s_GameOver = m_Snap.m_pGameobj->m_GameOver;
}
else if(Item.m_Type == NETOBJTYPE_FLAG)
m_Snap.m_paFlags[Item.m_Id%2] = (const CNetObj_Flag *)pData;
}
@ -993,8 +1005,8 @@ void CGameClient::CClientData::UpdateRenderInfo()
if(m_Team >= 0 && m_Team <= 1)
{
m_RenderInfo.m_Texture = g_GameClient.m_pSkins->Get(m_SkinId)->m_ColorTexture;
m_RenderInfo.m_ColorBody = g_GameClient.m_pSkins->GetColor(TeamColors[m_Team]);
m_RenderInfo.m_ColorFeet = g_GameClient.m_pSkins->GetColor(TeamColors[m_Team]);
m_RenderInfo.m_ColorBody = g_GameClient.m_pSkins->GetColorV4(TeamColors[m_Team]);
m_RenderInfo.m_ColorFeet = g_GameClient.m_pSkins->GetColorV4(TeamColors[m_Team]);
}
}
}

View file

@ -186,6 +186,7 @@ public:
virtual void OnShutdown();
virtual void OnEnterGame();
virtual void OnRconLine(const char *pLine);
virtual void OnGameOver();
virtual const char *GetItemName(int Type);
virtual const char *Version();

View file

@ -118,7 +118,7 @@ void CCollision::Init(class CLayers *pLayers)
}
// DDRace tiles
if(Index == TILE_THROUGH || (Index >= TILE_FREEZE && Index <= TILE_UNFREEZE) || (Index >= TILE_SWITCHOPEN && Index<=TILE_BOOST) || (Index >= TILE_BEGIN && Index <= TILE_STOPA) || Index == TILE_CP || Index == TILE_CP_F || (Index >= TILE_NPC && Index <= TILE_NPH))
if(Index == TILE_THROUGH || (Index >= TILE_FREEZE && Index <= TILE_UNFREEZE) || (Index >= TILE_SWITCHOPEN && Index<=TILE_BOOST) || (Index >= TILE_BEGIN && Index <= TILE_STOPA) || Index == TILE_CP || Index == TILE_CP_F || (Index >= TILE_OLDLASER && Index <= TILE_NPH))
m_pFront[i].m_Index = Index;
}
}
@ -144,7 +144,7 @@ void CCollision::Init(class CLayers *pLayers)
}
// DDRace tiles
if(Index == TILE_THROUGH || (Index >= TILE_FREEZE && Index <= TILE_UNFREEZE) || (Index >= TILE_SWITCHOPEN && Index<=TILE_BOOST) || (Index >= TILE_BEGIN && Index <= TILE_STOPA) || Index == TILE_CP || Index == TILE_CP_F || (Index >= TILE_NPC && Index <= TILE_NPH))
if(Index == TILE_THROUGH || (Index >= TILE_FREEZE && Index <= TILE_UNFREEZE) || (Index >= TILE_SWITCHOPEN && Index<=TILE_BOOST) || (Index >= TILE_BEGIN && Index <= TILE_STOPA) || Index == TILE_CP || Index == TILE_CP_F || (Index >= TILE_OLDLASER && Index <= TILE_NPH))
m_pTiles[i].m_Index = Index;
}
}
@ -346,7 +346,7 @@ int CCollision::Entity(int x, int y, int Layer)
default:
str_format(aBuf,sizeof(aBuf), "Unknown");
}
dbg_msg("CCollision::Entity","Something is VERY wrong in the layer %s please report this at http://DDRace.info, but you may haven't read the news section so go there and read first", aBuf);
dbg_msg("CCollision::Entity","Something is VERY wrong with the %s layer please report this at http://DDRace.info, you will need to post the map as well and any steps tht u think may led to this, Please Also Read the News Section every once and a while", aBuf);
return 0;
}
switch (Layer)

View file

@ -7,57 +7,56 @@
#endif
CONSOLE_COMMAND("clear_votes", "", CFGFLAG_SERVER, ConClearVotes, this, "Clears the vote list", 4)
CONSOLE_COMMAND("kill", "v", CFGFLAG_SERVER, ConKillPlayer, this, "Kills player i and announces the kill", 2)
CONSOLE_COMMAND("logout", "v", CFGFLAG_SERVER, ConLogOut, this, "If you are a helper or didn't specify [i] it logs you out, otherwise it logs player i out", 0)
CONSOLE_COMMAND("helper", "v", CFGFLAG_SERVER, ConSetlvl1, this, "Authenticates player i to the Level of 1", 2)
CONSOLE_COMMAND("moder", "v", CFGFLAG_SERVER, ConSetlvl2, this, "Authenticates player i to the Level of 2", 3)
CONSOLE_COMMAND("admin", "v", CFGFLAG_SERVER, ConSetlvl3, this, "Authenticates player i to the Level of 3 (CAUTION: Irreversible, once he is an admin you can't control him)", 3)
CONSOLE_COMMAND("mute", "vi", CFGFLAG_SERVER, ConMute, this, "Mutes player i1 for i2 seconds", 2)
CONSOLE_COMMAND("invis", "v", CFGFLAG_SERVER|CMDFLAG_CHEAT|CMDFLAG_HELPERCMD, ConInvis, this, "Makes player i invisible", 2)
CONSOLE_COMMAND("vis", "v", CFGFLAG_SERVER|CMDFLAG_CHEAT|CMDFLAG_HELPERCMD, ConVis, this, "Makes player i visible again", 2)
CONSOLE_COMMAND("timerstop", "v", CFGFLAG_SERVER|CMDFLAG_TIMER, ConTimerStop, this, "Stops the timer of player i", 2)
CONSOLE_COMMAND("timerstart", "v", CFGFLAG_SERVER|CMDFLAG_TIMER, ConTimerStart, this, "Starts the timer of player i", 2)
CONSOLE_COMMAND("timerrestart", "v", CFGFLAG_SERVER|CMDFLAG_TIMER, ConTimerReStart, this, "Sets the timer of player i to 0 and starts it", 2)
CONSOLE_COMMAND("timerzero", "v", CFGFLAG_SERVER|CMDFLAG_TIMER, ConTimerZero, this, "Sets the timer of player i to 0 and stops it", 2)
CONSOLE_COMMAND("tele", "vi", CFGFLAG_SERVER|CMDFLAG_CHEAT|CMDFLAG_HELPERCMD, ConTeleport, this, "Teleports player i1 to player i2", 2)
CONSOLE_COMMAND("freeze", "v?i", CFGFLAG_SERVER|CMDFLAG_CHEAT|CMDFLAG_HELPERCMD, ConFreeze, this, "Freezes player i1 for i2 seconds (infinity by default)", 2)
CONSOLE_COMMAND("unfreeze", "v", CFGFLAG_SERVER|CMDFLAG_CHEAT|CMDFLAG_HELPERCMD, ConUnFreeze, this, "Unfreezes player i", 2)
CONSOLE_COMMAND("addweapon", "v?i", CFGFLAG_SERVER|CMDFLAG_CHEAT|CMDFLAG_HELPERCMD, ConAddWeapon, this, "First optional parameter is client id, next parameter is weapon (all = -1, hammer = 0, gun = 1, shotgun = 2, grenade = 3, rifle = 4, ninja = 5)", 1)
CONSOLE_COMMAND("removeweapon", "v?i", CFGFLAG_SERVER|CMDFLAG_CHEAT|CMDFLAG_HELPERCMD, ConRemoveWeapon, this, "First optional parameter is client id, next parameter is weapon (all = -1, hammer = 0, gun = 1, shotgun = 2, grenade = 3, rifle = 4)", 1)
CONSOLE_COMMAND("shotgun", "v", CFGFLAG_SERVER|CMDFLAG_CHEAT|CMDFLAG_HELPERCMD, ConShotgun, this, "Gives a shotgun to player i", 2)
CONSOLE_COMMAND("grenade", "v", CFGFLAG_SERVER|CMDFLAG_CHEAT|CMDFLAG_HELPERCMD, ConGrenade, this, "Gives a grenade launcher to player i", 2)
CONSOLE_COMMAND("rifle", "v", CFGFLAG_SERVER|CMDFLAG_CHEAT|CMDFLAG_HELPERCMD, ConRifle, this, "Gives a rifle to player i", 2)
CONSOLE_COMMAND("weapons", "v", CFGFLAG_SERVER|CMDFLAG_CHEAT|CMDFLAG_HELPERCMD, ConWeapons, this, "Gives all weapons to player i", 2)
CONSOLE_COMMAND("unshotgun", "v", CFGFLAG_SERVER|CMDFLAG_HELPERCMD, ConUnShotgun, this, "Takes a shotgun from player i", 2)
CONSOLE_COMMAND("ungrenade", "v", CFGFLAG_SERVER|CMDFLAG_HELPERCMD, ConUnGrenade, this, "Takes a grenade launcher from player i", 2)
CONSOLE_COMMAND("unrifle", "v", CFGFLAG_SERVER|CMDFLAG_HELPERCMD, ConUnRifle, this, "Takes a rifle from player i", 2)
CONSOLE_COMMAND("unweapons", "v", CFGFLAG_SERVER|CMDFLAG_HELPERCMD, ConUnWeapons, this, "Takes all weapons from player i", 2)
CONSOLE_COMMAND("ninja", "v", CFGFLAG_SERVER|CMDFLAG_CHEAT|CMDFLAG_HELPERCMD, ConNinja, this, "Makes player i a ninja", 2)
CONSOLE_COMMAND("hammer", "vi", CFGFLAG_SERVER|CMDFLAG_CHEAT|CMDFLAG_HELPERCMD, ConHammer, this, "Sets the hammer power of player i1 to i2", 2)
CONSOLE_COMMAND("super", "v", CFGFLAG_SERVER|CMDFLAG_CHEAT|CMDFLAG_HELPERCMD, ConSuper, this, "Makes player i super", 2)
CONSOLE_COMMAND("unsuper", "v", CFGFLAG_SERVER|CMDFLAG_HELPERCMD, ConUnSuper, this, "Removes super from player i", 2)
CONSOLE_COMMAND("left", "v", CFGFLAG_SERVER|CMDFLAG_CHEAT|CMDFLAG_HELPERCMD, ConGoLeft, this, "Makes you or player i move 1 tile left", 1)
CONSOLE_COMMAND("right", "v", CFGFLAG_SERVER|CMDFLAG_CHEAT|CMDFLAG_HELPERCMD, ConGoRight, this, "Makes you or player i move 1 tile right", 1)
CONSOLE_COMMAND("up", "v", CFGFLAG_SERVER|CMDFLAG_CHEAT|CMDFLAG_HELPERCMD, ConGoUp, this, "Makes you or player i move 1 tile up", 1)
CONSOLE_COMMAND("down", "v", CFGFLAG_SERVER|CMDFLAG_CHEAT|CMDFLAG_HELPERCMD, ConGoDown, this, "Makes you or player i move 1 tile down", 1)
CONSOLE_COMMAND("move", "vii", CFGFLAG_SERVER|CMDFLAG_CHEAT|CMDFLAG_HELPERCMD, ConMove, this, "First optional parameter is client id, next parameters are x-axis change and y-axis change (1 = 1 tile)", 1)
CONSOLE_COMMAND("move_raw", "vii", CFGFLAG_SERVER|CMDFLAG_CHEAT|CMDFLAG_HELPERCMD, ConMoveRaw, this, "First optional parameter is client id, next parameters are x-axis change and y-axis change (1 = 1 pixel)", 1)
CONSOLE_COMMAND("broadtime", "", CFGFLAG_SERVER, ConBroadTime, this, "Toggles Showing the time string in race", -1)
CONSOLE_COMMAND("kill_pl", "v", CFGFLAG_SERVER, ConKillPlayer, this, "Kills player v and announces the kill", 2)
CONSOLE_COMMAND("logout", "v", CFGFLAG_SERVER, ConLogOut, this, "Logs player v out from the console", -1)
CONSOLE_COMMAND("helper", "v", CFGFLAG_SERVER, ConSetlvl1, this, "Authenticates player v to the level of 1", 2)
CONSOLE_COMMAND("moder", "v", CFGFLAG_SERVER, ConSetlvl2, this, "Authenticates player v to the level of 2", 3)
CONSOLE_COMMAND("admin", "v", CFGFLAG_SERVER, ConSetlvl3, this, "Authenticates player v to the level of 3 (CAUTION: Irreversible, once he is an admin you can't remove his status)", 3)
CONSOLE_COMMAND("mute", "vi", CFGFLAG_SERVER, ConMute, this, "Mutes player v for i seconds", 2)
CONSOLE_COMMAND("invis", "v", CFGFLAG_SERVER|CMDFLAG_CHEAT|CMDFLAG_HELPERCMD, ConInvis, this, "Makes player v invisible", 2)
CONSOLE_COMMAND("vis", "v", CFGFLAG_SERVER|CMDFLAG_CHEAT|CMDFLAG_HELPERCMD, ConVis, this, "Makes player v visible again", 2)
CONSOLE_COMMAND("timerstop", "v", CFGFLAG_SERVER|CMDFLAG_TIMER, ConTimerStop, this, "Stops the timer of player v", 2)
CONSOLE_COMMAND("timerstart", "v", CFGFLAG_SERVER|CMDFLAG_TIMER, ConTimerStart, this, "Starts the timer of player v", 2)
CONSOLE_COMMAND("timerrestart", "v", CFGFLAG_SERVER|CMDFLAG_TIMER, ConTimerReStart, this, "Sets the timer of player v to 0 and starts it", 2)
CONSOLE_COMMAND("timerzero", "v", CFGFLAG_SERVER|CMDFLAG_TIMER, ConTimerZero, this, "Sets the timer of player v to 0 and stops it", 2)
CONSOLE_COMMAND("tele", "vi", CFGFLAG_SERVER|CMDFLAG_CHEAT|CMDFLAG_HELPERCMD, ConTeleport, this, "Teleports player v to player i", 2)
CONSOLE_COMMAND("freeze", "v?i", CFGFLAG_SERVER|CMDFLAG_CHEAT|CMDFLAG_HELPERCMD, ConFreeze, this, "Freezes player v for i seconds (infinite by default)", 2)
CONSOLE_COMMAND("unfreeze", "v", CFGFLAG_SERVER|CMDFLAG_CHEAT|CMDFLAG_HELPERCMD, ConUnFreeze, this, "Unfreezes player v", 2)
CONSOLE_COMMAND("addweapon", "v?i", CFGFLAG_SERVER|CMDFLAG_CHEAT|CMDFLAG_HELPERCMD, ConAddWeapon, this, "Gives weapon with id i to player v (all = -1, hammer = 0, gun = 1, shotgun = 2, grenade = 3, rifle = 4, ninja = 5)", 1)
CONSOLE_COMMAND("removeweapon", "v?i", CFGFLAG_SERVER|CMDFLAG_CHEAT|CMDFLAG_HELPERCMD, ConRemoveWeapon, this, "removes weapon with id i from player v (all = -1, hammer = 0, gun = 1, shotgun = 2, grenade = 3, rifle = 4)", 1)
CONSOLE_COMMAND("shotgun", "v", CFGFLAG_SERVER|CMDFLAG_CHEAT|CMDFLAG_HELPERCMD, ConShotgun, this, "Gives a shotgun to player v", 2)
CONSOLE_COMMAND("grenade", "v", CFGFLAG_SERVER|CMDFLAG_CHEAT|CMDFLAG_HELPERCMD, ConGrenade, this, "Gives a grenade launcher to player v", 2)
CONSOLE_COMMAND("rifle", "v", CFGFLAG_SERVER|CMDFLAG_CHEAT|CMDFLAG_HELPERCMD, ConRifle, this, "Gives a rifle to player v", 2)
CONSOLE_COMMAND("weapons", "v", CFGFLAG_SERVER|CMDFLAG_CHEAT|CMDFLAG_HELPERCMD, ConWeapons, this, "Gives all weapons to player v", 2)
CONSOLE_COMMAND("unshotgun", "v", CFGFLAG_SERVER|CMDFLAG_HELPERCMD, ConUnShotgun, this, "Takes the shotgun from player v", 2)
CONSOLE_COMMAND("ungrenade", "v", CFGFLAG_SERVER|CMDFLAG_HELPERCMD, ConUnGrenade, this, "Takes the grenade launcher from player v", 2)
CONSOLE_COMMAND("unrifle", "v", CFGFLAG_SERVER|CMDFLAG_HELPERCMD, ConUnRifle, this, "Takes the rifle from player v", 2)
CONSOLE_COMMAND("unweapons", "v", CFGFLAG_SERVER|CMDFLAG_HELPERCMD, ConUnWeapons, this, "Takes all weapons from player v", 2)
CONSOLE_COMMAND("ninja", "v", CFGFLAG_SERVER|CMDFLAG_CHEAT|CMDFLAG_HELPERCMD, ConNinja, this, "Makes player v a ninja", 2)
CONSOLE_COMMAND("hammer", "vi", CFGFLAG_SERVER|CMDFLAG_CHEAT|CMDFLAG_HELPERCMD, ConHammer, this, "Sets the hammer power of player v to i", 2)
CONSOLE_COMMAND("super", "v", CFGFLAG_SERVER|CMDFLAG_CHEAT|CMDFLAG_HELPERCMD, ConSuper, this, "Makes player v super", 2)
CONSOLE_COMMAND("unsuper", "v", CFGFLAG_SERVER|CMDFLAG_HELPERCMD, ConUnSuper, this, "Removes super from player v", 2)
CONSOLE_COMMAND("left", "v", CFGFLAG_SERVER|CMDFLAG_CHEAT|CMDFLAG_HELPERCMD, ConGoLeft, this, "Makes you or player v move 1 tile left", 1)
CONSOLE_COMMAND("right", "v", CFGFLAG_SERVER|CMDFLAG_CHEAT|CMDFLAG_HELPERCMD, ConGoRight, this, "Makes you or player v move 1 tile right", 1)
CONSOLE_COMMAND("up", "v", CFGFLAG_SERVER|CMDFLAG_CHEAT|CMDFLAG_HELPERCMD, ConGoUp, this, "Makes you or player v move 1 tile up", 1)
CONSOLE_COMMAND("down", "v", CFGFLAG_SERVER|CMDFLAG_CHEAT|CMDFLAG_HELPERCMD, ConGoDown, this, "Makes you or player v move 1 tile down", 1)
CONSOLE_COMMAND("move", "vii", CFGFLAG_SERVER|CMDFLAG_CHEAT|CMDFLAG_HELPERCMD, ConMove, this, "Moves player i to the tile with x/y-number ii", 1)
CONSOLE_COMMAND("move_raw", "vii", CFGFLAG_SERVER|CMDFLAG_CHEAT|CMDFLAG_HELPERCMD, ConMoveRaw, this, "Moves player i to the point with x/y-coordinates ii", 1)
CONSOLE_COMMAND("credits", "", CFGFLAG_SERVER, ConCredits, this, "Shows the credits of the DDRace mod", -1)
CONSOLE_COMMAND("emote", "?si", CFGFLAG_SERVER, ConEyeEmote, this, "Sets your tee's eye emote", -1)
CONSOLE_COMMAND("broadmsg", "", CFGFLAG_SERVER, ConToggleBroadcast, this, "Toggle Showing the Server's Broadcast message during race", -1)
CONSOLE_COMMAND("eyeemote", "", CFGFLAG_SERVER, ConEyeEmote, this, "Toggles whether you automatically use eyeemotes with standard emotes", -1)
CONSOLE_COMMAND("flags", "", CFGFLAG_SERVER, ConFlags, this, "Shows gameplay information for this server", -1)
CONSOLE_COMMAND("fly", "", CFGFLAG_SERVER, ConToggleFly, this, "Toggles whether you fly by pressing jump", 1)
CONSOLE_COMMAND("help", "?r", CFGFLAG_SERVER, ConHelp, this, "Helps you with commands", -1)
CONSOLE_COMMAND("broadmsg", "", CFGFLAG_SERVER, ConToggleBroadcast, this, "Toggles showing the server's broadcast message during race on/off", -1)
CONSOLE_COMMAND("eyeemote", "", CFGFLAG_SERVER, ConEyeEmote, this, "Toggles use of standard eye-emotes on/off", -1)
CONSOLE_COMMAND("settings", "?s", CFGFLAG_SERVER, ConSettings, this, "Shows gameplay information for this server", -1)
CONSOLE_COMMAND("fly", "", CFGFLAG_SERVER, ConToggleFly, this, "Toggles super-fly (holding space) on/off", 1)
CONSOLE_COMMAND("help", "?r", CFGFLAG_SERVER, ConHelp, this, "Shows help to command r, general help if left blank", -1)
CONSOLE_COMMAND("info", "", CFGFLAG_SERVER, ConInfo, this, "Shows info about this server", -1)
CONSOLE_COMMAND("kill", "", CFGFLAG_SERVER, ConKill, this, "Kills you", -1)
CONSOLE_COMMAND("me", "r", CFGFLAG_SERVER, ConMe, this, "Like the famous irc commands /me says hi, will display YOURNAME says hi", -1)
CONSOLE_COMMAND("pause", "", CFGFLAG_SERVER, ConTogglePause, this, "If enabled on this server it pauses the game for you", -1)
CONSOLE_COMMAND("rank", "?r", CFGFLAG_SERVER, ConRank, this, "Shows either your rank or the rank of the given player", -1)
CONSOLE_COMMAND("rules", "", CFGFLAG_SERVER, ConRules, this, "Shows the rules of this server", -1)
CONSOLE_COMMAND("team", "?i", CFGFLAG_SERVER, ConJoinTeam, this, "Lets you join the specified team", -1)
CONSOLE_COMMAND("top5", "?i", CFGFLAG_SERVER, ConTop5, this, "Shows the top 5 from the 1st, or starting at the specified number", -1)
CONSOLE_COMMAND("me", "r", CFGFLAG_SERVER, ConMe, this, "Like the famous irc command '/me says hi' will display '<yourname> says hi'", -1)
CONSOLE_COMMAND("pause", "", CFGFLAG_SERVER, ConTogglePause, this, "Toggles pause on/off (if activated on server)", -1)
CONSOLE_COMMAND("rank", "?r", CFGFLAG_SERVER, ConRank, this, "Shows the rank of player with name r (your rank by default)", -1)
CONSOLE_COMMAND("rules", "", CFGFLAG_SERVER, ConRules, this, "Shows the server rules", -1)
CONSOLE_COMMAND("team", "?i", CFGFLAG_SERVER, ConJoinTeam, this, "Lets you join team i (shows your team if left blank)", -1)
CONSOLE_COMMAND("top5", "?i", CFGFLAG_SERVER, ConTop5, this, "Shows five ranks of the ladder beginning with rank i (1 by default)", -1)
#undef CONSOLE_COMMAND

View file

@ -2419,12 +2419,14 @@ void CEditor::RenderFileDialog()
{
char aBuf[512];
str_format(aBuf, sizeof(aBuf), "%s/%s", m_pFileDialogPath, m_aFileDialogFileName);
Storage()->CreateFolder(aBuf, IStorage::TYPE_SAVE);
FilelistPopulate(IStorage::TYPE_SAVE);
if(m_FilesSelectedIndex >= 0 && !m_FileList[m_FilesSelectedIndex].m_IsDir)
str_copy(m_aFileDialogFileName, m_FileList[m_FilesSelectedIndex].m_aFilename, sizeof(m_aFileDialogFileName));
else
m_aFileDialogFileName[0] = 0;
if(Storage()->CreateFolder(aBuf, IStorage::TYPE_SAVE))
{
FilelistPopulate(IStorage::TYPE_SAVE);
if(m_FilesSelectedIndex >= 0 && !m_FileList[m_FilesSelectedIndex].m_IsDir)
str_copy(m_aFileDialogFileName, m_FileList[m_FilesSelectedIndex].m_aFilename, sizeof(m_aFileDialogFileName));
else
m_aFileDialogFileName[0] = 0;
}
}
}
}
@ -2539,6 +2541,19 @@ void CEditor::RenderEnvelopeEditor(CUIRect View)
CUIRect Button;
CEnvelope *pNewEnv = 0;
// Delete button
if(m_Map.m_lEnvelopes.size())
{
ToolBar.VSplitRight(5.0f, &ToolBar, &Button);
ToolBar.VSplitRight(50.0f, &ToolBar, &Button);
static int s_DelButton = 0;
if(DoButton_Editor(&s_DelButton, Localize("Delete"), 0, &Button, 0, Localize("Delete this envelope")))
m_Map.DeleteEnvelope(m_SelectedEnvelope);
// little space
ToolBar.VSplitRight(10.0f, &ToolBar, &Button);
}
ToolBar.VSplitRight(50.0f, &ToolBar, &Button);
static int s_New4dButton = 0;
if(DoButton_Editor(&s_New4dButton, Localize("Color+"), 0, &Button, 0, Localize("Creates a new color envelope")))
@ -2549,7 +2564,7 @@ void CEditor::RenderEnvelopeEditor(CUIRect View)
static int s_New2dButton = 0;
if(DoButton_Editor(&s_New2dButton, Localize("Pos.+"), 0, &Button, 0, Localize("Creates a new pos envelope")))
pNewEnv = m_Map.NewEnvelope(3);
// Delete button
if(m_SelectedEnvelope >= 0)
{
@ -3412,7 +3427,7 @@ void CEditor::UpdateAndRender()
if(Input()->KeyDown(KEY_F10))
{
Graphics()->TakeScreenshot();
Graphics()->TakeScreenshot(0);
m_ShowMousePointer = true;
}

View file

@ -454,6 +454,7 @@ public:
~CLayerTele();
CTeleTile *m_pTeleTile;
unsigned char m_TeleNum;
virtual void Resize(int NewW, int NewH);
virtual void Shift(int Direction);
@ -468,6 +469,9 @@ public:
~CLayerSpeedup();
CSpeedupTile *m_pSpeedupTile;
unsigned char m_SpeedupForce;
unsigned char m_SpeedupMaxSpeed;
unsigned char m_SpeedupAngle;
virtual void Resize(int NewW, int NewH);
virtual void Shift(int Direction);
@ -492,6 +496,8 @@ public:
~CLayerSwitch();
CSwitchTile *m_pSwitchTile;
unsigned char m_SwitchNumber;
unsigned char m_SwitchDelay;
virtual void Resize(int NewW, int NewH);
virtual void Shift(int Direction);
@ -598,7 +604,7 @@ public:
ms_pUiGotContext = 0;
m_TeleNum = 1;
m_TeleNumber = 1;
m_SwitchNum = 1;
m_SwitchDelay = 0;
@ -797,7 +803,7 @@ public:
str_copy(pName, pExtractedName, Length);
}
unsigned char m_TeleNum;
unsigned char m_TeleNumber;
unsigned char m_SpeedupForce;
unsigned char m_SpeedupMaxSpeed;

View file

@ -608,8 +608,8 @@ int CEditorMap::Load(class IStorage *pStorage, const char *pFileName, int Storag
((CLayerTiles*)pTiles)->m_pTiles[i].m_Index = TILE_TELEINEVIL;
else if(((CLayerTele*)pTiles)->m_pTeleTile[i].m_Type == TILE_TELEOUT)
((CLayerTiles*)pTiles)->m_pTiles[i].m_Index = TILE_TELEOUT;
else
((CLayerTiles*)pTiles)->m_pTiles[i].m_Index = 0;
/*else
((CLayerTiles*)pTiles)->m_pTiles[i].m_Index = 0;*/
}
DataFile.UnloadData(pTilemapItem->m_Tele);
}
@ -620,10 +620,16 @@ int CEditorMap::Load(class IStorage *pStorage, const char *pFileName, int Storag
for(int i = 0; i < pTiles->m_Width*pTiles->m_Height; i++)
{
if(((CLayerSpeedup*)pTiles)->m_pSpeedupTile[i].m_Force > 0 && (((CLayerSpeedup*)pTiles)->m_pSpeedupTile[i].m_Type == TILE_BOOST))
((CLayerTiles*)pTiles)->m_pTiles[i].m_Index = ((CLayerSpeedup*)pTiles)->m_pSpeedupTile[i].m_Type;
if(((CLayerSpeedup*)pTiles)->m_pSpeedupTile[i].m_Force > 0)
{
((CLayerTiles*)pTiles)->m_pTiles[i].m_Index = TILE_BOOST;
((CLayerSpeedup*)pTiles)->m_pSpeedupTile[i].m_Type = TILE_BOOST;
}
else
{
((CLayerTiles*)pTiles)->m_pTiles[i].m_Index = 0;
((CLayerSpeedup*)pTiles)->m_pSpeedupTile[i].m_Type = 0;
}
}
DataFile.UnloadData(pTilemapItem->m_Speedup);
@ -660,7 +666,7 @@ int CEditorMap::Load(class IStorage *pStorage, const char *pFileName, int Storag
for(int i = 0; i < pTiles->m_Width*pTiles->m_Height; i++)
{
if((((CLayerSwitch*)pTiles)->m_pSwitchTile[i].m_Type > (ENTITY_CRAZY_SHOTGUN + ENTITY_OFFSET) && ((CLayerSwitch*)pTiles)->m_pSwitchTile[i].m_Type < (ENTITY_DRAGGER_WEAK + ENTITY_OFFSET) || ((CLayerSwitch*)pTiles)->m_pSwitchTile[i].m_Type == (ENTITY_LASER_O_FAST + 1 + ENTITY_OFFSET)))
if(((((CLayerSwitch*)pTiles)->m_pSwitchTile[i].m_Type > (ENTITY_CRAZY_SHOTGUN + ENTITY_OFFSET) && ((CLayerSwitch*)pTiles)->m_pSwitchTile[i].m_Type < (ENTITY_DRAGGER_WEAK + ENTITY_OFFSET)) || ((CLayerSwitch*)pTiles)->m_pSwitchTile[i].m_Type == (ENTITY_LASER_O_FAST + 1 + ENTITY_OFFSET)))
continue;
if(((CLayerSwitch*)pTiles)->m_pSwitchTile[i].m_Type == TILE_SWITCHTIMEDOPEN)
{

View file

@ -164,8 +164,9 @@ int CLayerTiles::BrushGrab(CLayerGroup *pBrush, CUIRect Rect)
{
pGrabbed->m_pTeleTile[y*pGrabbed->m_Width+x] = ((CLayerTele*)this)->m_pTeleTile[(r.y+y)*m_Width+(r.x+x)];
if(pGrabbed->m_pTeleTile[y*pGrabbed->m_Width+x].m_Type == TILE_TELEIN || pGrabbed->m_pTeleTile[y*pGrabbed->m_Width+x].m_Type == TILE_TELEOUT || pGrabbed->m_pTeleTile[y*pGrabbed->m_Width+x].m_Type == TILE_TELEINEVIL)
m_pEditor->m_TeleNum = pGrabbed->m_pTeleTile[y*pGrabbed->m_Width+x].m_Number;
m_pEditor->m_TeleNumber = pGrabbed->m_pTeleTile[y*pGrabbed->m_Width+x].m_Number;
}
pGrabbed->m_TeleNum = m_pEditor->m_TeleNumber;
}
else if(m_pEditor->GetSelectedLayer(0) == m_pEditor->m_Map.m_pSpeedupLayer)
{
@ -195,6 +196,9 @@ int CLayerTiles::BrushGrab(CLayerGroup *pBrush, CUIRect Rect)
m_pEditor->m_SpeedupMaxSpeed = pGrabbed->m_pSpeedupTile[y*pGrabbed->m_Width+x].m_MaxSpeed;
}
}
pGrabbed->m_SpeedupForce = m_pEditor->m_SpeedupForce;
pGrabbed->m_SpeedupMaxSpeed = m_pEditor->m_SpeedupMaxSpeed;
pGrabbed->m_SpeedupAngle = m_pEditor->m_SpeedupAngle;
}
else if(m_pEditor->GetSelectedLayer(0) == m_pEditor->m_Map.m_pSwitchLayer)
{
@ -223,6 +227,8 @@ int CLayerTiles::BrushGrab(CLayerGroup *pBrush, CUIRect Rect)
m_pEditor->m_SwitchDelay = pGrabbed->m_pSwitchTile[y*pGrabbed->m_Width+x].m_Delay;
}
}
pGrabbed->m_SwitchNumber = m_pEditor->m_SwitchNum;
pGrabbed->m_SwitchDelay = m_pEditor->m_SwitchDelay;
}
else
{
@ -333,13 +339,13 @@ void CLayerTiles::BrushFlipY()
void CLayerTiles::BrushRotate(float Amount)
{
int Rotation = (round(360.0f*Amount/(pi*2))/90)%4; // 0=0°, 1=90°, 2=180°, 3=270°
int Rotation = (round(360.0f*Amount/(pi*2))/90)%4; // 0=0<EFBFBD>, 1=90<39>, 2=180<38>, 3=270<37>
if(Rotation < 0)
Rotation +=4;
if(Rotation == 1 || Rotation == 3)
{
// 90° rotation
// 90<EFBFBD> rotation
CTile *pTempData = new CTile[m_Width*m_Height];
mem_copy(pTempData, m_pTiles, m_Width*m_Height*sizeof(CTile));
CTile *pDst = m_pTiles;
@ -620,11 +626,15 @@ void CLayerTele::BrushDraw(CLayer *pBrush, float wx, float wy)
if(l->m_pTiles[y*l->m_Width+x].m_Index == TILE_TELEIN || l->m_pTiles[y*l->m_Width+x].m_Index == TILE_TELEINEVIL || l->m_pTiles[y*l->m_Width+x].m_Index == TILE_TELEOUT)
{
/*if(l->m_pTeleTile[y*l->m_Width+x].m_Number)
m_pTeleTile[fy*m_Width+fx].m_Number = l->m_pTeleTile[y*l->m_Width+x].m_Number;
else*/
if(m_pEditor->m_TeleNumber != l->m_TeleNum)
{
if(!m_pEditor->m_TeleNum)
m_pTeleTile[fy*m_Width+fx].m_Number = m_pEditor->m_TeleNumber;
}
else if(l->m_pTeleTile[y*l->m_Width+x].m_Number)
m_pTeleTile[fy*m_Width+fx].m_Number = l->m_pTeleTile[y*l->m_Width+x].m_Number;
else
{
if(!m_pEditor->m_TeleNumber)
{
m_pTeleTile[fy*m_Width+fx].m_Number = 0;
m_pTeleTile[fy*m_Width+fx].m_Type = 0;
@ -632,7 +642,7 @@ void CLayerTele::BrushDraw(CLayer *pBrush, float wx, float wy)
continue;
}
else
m_pTeleTile[fy*m_Width+fx].m_Number = m_pEditor->m_TeleNum;
m_pTeleTile[fy*m_Width+fx].m_Number = m_pEditor->m_TeleNumber;
}
m_pTeleTile[fy*m_Width+fx].m_Type = l->m_pTiles[y*l->m_Width+x].m_Index;
@ -672,15 +682,20 @@ void CLayerTele::FillSelection(bool Empty, CLayer *pBrush, CUIRect Rect)
if(Empty)
{
m_pTiles[fy*m_Width+fx].m_Index = 0;
m_pTeleTile[fy*m_Width+fx].m_Type = 0;
m_pTeleTile[fy*m_Width+fx].m_Number = 0;
}
else
{
m_pTiles[fy*m_Width+fx] = pLt->m_pTiles[(y*pLt->m_Width + x%pLt->m_Width) % (pLt->m_Width*pLt->m_Height)];
if(!pLt->m_pTeleTile[(y*pLt->m_Width + x%pLt->m_Width) % (pLt->m_Width*pLt->m_Height)].m_Number && m_pEditor->m_TeleNum && m_pTiles[fy*m_Width+fx].m_Index > 0)
m_pTeleTile[fy*m_Width+fx].m_Number = m_pEditor->m_TeleNum;
else
m_pTeleTile[fy*m_Width+fx].m_Number = pLt->m_pTeleTile[(y*pLt->m_Width + x%pLt->m_Width) % (pLt->m_Width*pLt->m_Height)].m_Number;
m_pTeleTile[fy*m_Width+fx].m_Type = m_pTiles[fy*m_Width+fx].m_Index;
if(m_pTiles[fy*m_Width+fx].m_Index > 0)
{
if((!pLt->m_pTeleTile[(y*pLt->m_Width + x%pLt->m_Width) % (pLt->m_Width*pLt->m_Height)].m_Number && m_pEditor->m_TeleNumber) || m_pEditor->m_TeleNumber != pLt->m_TeleNum)
m_pTeleTile[fy*m_Width+fx].m_Number = m_pEditor->m_TeleNumber;
else
m_pTeleTile[fy*m_Width+fx].m_Number = pLt->m_pTeleTile[(y*pLt->m_Width + x%pLt->m_Width) % (pLt->m_Width*pLt->m_Height)].m_Number;
}
}
}
}
@ -772,18 +787,26 @@ void CLayerSpeedup::BrushDraw(CLayer *pBrush, float wx, float wy)
int fy = y+sy;
if(fx<0 || fx >= m_Width || fy < 0 || fy >= m_Height)
continue;
if(l->m_pTiles[y*l->m_Width+x].m_Index == TILE_BOOST)
{
/*if(l->m_pSpeedupTile[y*l->m_Width+x].m_Force || l->m_pSpeedupTile[y*l->m_Width+x].m_Angle)
if(m_pEditor->m_SpeedupAngle != l->m_SpeedupAngle || m_pEditor->m_SpeedupForce != l->m_SpeedupForce || m_pEditor->m_SpeedupMaxSpeed != l->m_SpeedupMaxSpeed)
{
m_pSpeedupTile[fy*m_Width+fx].m_Force = l->m_pSpeedupTile[y*l->m_Width+x].m_Force;
m_pSpeedupTile[fy*m_Width+fx].m_Angle = l->m_pSpeedupTile[y*l->m_Width+x].m_Angle;
m_pSpeedupTile[fy*m_Width+fx].m_Force = m_pEditor->m_SpeedupForce;
m_pSpeedupTile[fy*m_Width+fx].m_MaxSpeed = m_pEditor->m_SpeedupMaxSpeed;
m_pSpeedupTile[fy*m_Width+fx].m_Angle = m_pEditor->m_SpeedupAngle;
m_pSpeedupTile[fy*m_Width+fx].m_Type = l->m_pTiles[y*l->m_Width+x].m_Index;
m_pTiles[fy*m_Width+fx].m_Index = l->m_pTiles[y*l->m_Width+x].m_Index;
}
else */
if(m_pEditor->m_SpeedupForce)
else if(l->m_pSpeedupTile[y*l->m_Width+x].m_Force)
{
m_pSpeedupTile[fy*m_Width+fx].m_Force = l->m_pSpeedupTile[y*l->m_Width+x].m_Force;
m_pSpeedupTile[fy*m_Width+fx].m_Angle = l->m_pSpeedupTile[y*l->m_Width+x].m_Angle;
m_pSpeedupTile[fy*m_Width+fx].m_MaxSpeed = l->m_pSpeedupTile[y*l->m_Width+x].m_MaxSpeed;
m_pSpeedupTile[fy*m_Width+fx].m_Type = l->m_pTiles[y*l->m_Width+x].m_Index;
m_pTiles[fy*m_Width+fx].m_Index = l->m_pTiles[y*l->m_Width+x].m_Index;
}
else if(m_pEditor->m_SpeedupForce)
{
m_pSpeedupTile[fy*m_Width+fx].m_Force = m_pEditor->m_SpeedupForce;
m_pSpeedupTile[fy*m_Width+fx].m_MaxSpeed = m_pEditor->m_SpeedupMaxSpeed;
@ -840,17 +863,21 @@ void CLayerSpeedup::FillSelection(bool Empty, CLayer *pBrush, CUIRect Rect)
else
{
m_pTiles[fy*m_Width+fx] = pLt->m_pTiles[(y*pLt->m_Width + x%pLt->m_Width) % (pLt->m_Width*pLt->m_Height)];
if(!pLt->m_pSpeedupTile[(y*pLt->m_Width + x%pLt->m_Width) % (pLt->m_Width*pLt->m_Height)].m_Force && m_pEditor->m_SpeedupForce && m_pTiles[fy*m_Width+fx].m_Index > 0)
m_pSpeedupTile[fy*m_Width+fx].m_Type = m_pTiles[fy*m_Width+fx].m_Index;
if(m_pTiles[fy*m_Width+fx].m_Index > 0)
{
m_pSpeedupTile[fy*m_Width+fx].m_Force = m_pEditor->m_SpeedupForce;
m_pSpeedupTile[fy*m_Width+fx].m_MaxSpeed = m_pEditor->m_SpeedupMaxSpeed;
m_pSpeedupTile[fy*m_Width+fx].m_Angle = m_pEditor->m_SpeedupAngle;
}
else
{
m_pSpeedupTile[fy*m_Width+fx].m_Force = pLt->m_pSpeedupTile[(y*pLt->m_Width + x%pLt->m_Width) % (pLt->m_Width*pLt->m_Height)].m_Force;
m_pSpeedupTile[fy*m_Width+fx].m_MaxSpeed = pLt->m_pSpeedupTile[(y*pLt->m_Width + x%pLt->m_Width) % (pLt->m_Width*pLt->m_Height)].m_MaxSpeed;
m_pSpeedupTile[fy*m_Width+fx].m_Angle = pLt->m_pSpeedupTile[(y*pLt->m_Width + x%pLt->m_Width) % (pLt->m_Width*pLt->m_Height)].m_Angle;
if((!pLt->m_pSpeedupTile[(y*pLt->m_Width + x%pLt->m_Width) % (pLt->m_Width*pLt->m_Height)].m_Force && m_pEditor->m_SpeedupForce) || m_pEditor->m_SpeedupForce != pLt->m_SpeedupForce)
m_pSpeedupTile[fy*m_Width+fx].m_Force = m_pEditor->m_SpeedupForce;
else
m_pSpeedupTile[fy*m_Width+fx].m_Force = pLt->m_pSpeedupTile[(y*pLt->m_Width + x%pLt->m_Width) % (pLt->m_Width*pLt->m_Height)].m_Force;
if((!pLt->m_pSpeedupTile[(y*pLt->m_Width + x%pLt->m_Width) % (pLt->m_Width*pLt->m_Height)].m_Angle && m_pEditor->m_SpeedupAngle) || m_pEditor->m_SpeedupAngle != pLt->m_SpeedupAngle)
m_pSpeedupTile[fy*m_Width+fx].m_Angle = m_pEditor->m_SpeedupAngle;
else
m_pSpeedupTile[fy*m_Width+fx].m_Angle = pLt->m_pSpeedupTile[(y*pLt->m_Width + x%pLt->m_Width) % (pLt->m_Width*pLt->m_Height)].m_Angle;
if((!pLt->m_pSpeedupTile[(y*pLt->m_Width + x%pLt->m_Width) % (pLt->m_Width*pLt->m_Height)].m_MaxSpeed && m_pEditor->m_SpeedupMaxSpeed) || m_pEditor->m_SpeedupMaxSpeed != pLt->m_SpeedupMaxSpeed)
m_pSpeedupTile[fy*m_Width+fx].m_MaxSpeed = m_pEditor->m_SpeedupMaxSpeed;
else
m_pSpeedupTile[fy*m_Width+fx].m_MaxSpeed = pLt->m_pSpeedupTile[(y*pLt->m_Width + x%pLt->m_Width) % (pLt->m_Width*pLt->m_Height)].m_MaxSpeed;
}
}
}
@ -929,7 +956,7 @@ void CLayerFront::BrushDraw(CLayer *pBrush, float wx, float wy)
continue;
// dont allow tele in and out tiles... same with speedup tile and alot more in front
if(m_pEditor->GetSelectedLayer(0) == m_pEditor->m_Map.m_pFrontLayer && (l->m_pTiles[y*l->m_Width+x].m_Index == TILE_TELEIN || l->m_pTiles[y*l->m_Width+x].m_Index == TILE_TELEINEVIL || l->m_pTiles[y*l->m_Width+x].m_Index == TILE_TELEOUT || l->m_pTiles[y*l->m_Width+x].m_Index == TILE_BOOST || l->m_pTiles[y*l->m_Width+x].m_Index == TILE_SWITCHOPEN || l->m_pTiles[y*l->m_Width+x].m_Index == TILE_SWITCHCLOSE || l->m_pTiles[y*l->m_Width+x].m_Index == TILE_SWITCHTIMEDOPEN || l->m_pTiles[y*l->m_Width+x].m_Index == TILE_SWITCHTIMEDCLOSE || l->m_pTiles[y*l->m_Width+x].m_Index == (ENTITY_DOOR + ENTITY_OFFSET)) || l->m_pTiles[y*l->m_Width+x].m_Index == (TILE_SOLID) || l->m_pTiles[y*l->m_Width+x].m_Index == (TILE_NOHOOK) || l->m_pTiles[y*l->m_Width+x].m_Index ==TILE_CP || l->m_pTiles[y*l->m_Width+x].m_Index ==TILE_CP_F)
if(m_pEditor->GetSelectedLayer(0) == m_pEditor->m_Map.m_pFrontLayer && ((l->m_pTiles[y*l->m_Width+x].m_Index == TILE_TELEIN || l->m_pTiles[y*l->m_Width+x].m_Index == TILE_TELEINEVIL || l->m_pTiles[y*l->m_Width+x].m_Index == TILE_TELEOUT || l->m_pTiles[y*l->m_Width+x].m_Index == TILE_BOOST || l->m_pTiles[y*l->m_Width+x].m_Index == TILE_SWITCHOPEN || l->m_pTiles[y*l->m_Width+x].m_Index == TILE_SWITCHCLOSE || l->m_pTiles[y*l->m_Width+x].m_Index == TILE_SWITCHTIMEDOPEN || l->m_pTiles[y*l->m_Width+x].m_Index == TILE_SWITCHTIMEDCLOSE || l->m_pTiles[y*l->m_Width+x].m_Index == (ENTITY_DOOR + ENTITY_OFFSET)) || l->m_pTiles[y*l->m_Width+x].m_Index == (TILE_SOLID) || l->m_pTiles[y*l->m_Width+x].m_Index == (TILE_NOHOOK) || l->m_pTiles[y*l->m_Width+x].m_Index ==TILE_CP || l->m_pTiles[y*l->m_Width+x].m_Index ==TILE_CP_F))
continue;
m_pTiles[fy*m_Width+fx] = l->m_pTiles[y*l->m_Width+x];
}
@ -1022,11 +1049,19 @@ void CLayerSwitch::BrushDraw(CLayer *pBrush, float wx, float wy)
if(fx<0 || fx >= m_Width || fy < 0 || fy >= m_Height)
continue;
if(l->m_pTiles[y*l->m_Width+x].m_Index >= (ENTITY_ARMOR_1 + ENTITY_OFFSET) && l->m_pTiles[y*l->m_Width+x].m_Index <= (ENTITY_DOOR + ENTITY_OFFSET) || l->m_pTiles[y*l->m_Width+x].m_Index == TILE_SWITCHOPEN || l->m_pTiles[y*l->m_Width+x].m_Index == TILE_SWITCHCLOSE || l->m_pTiles[y*l->m_Width+x].m_Index == TILE_SWITCHTIMEDOPEN || l->m_pTiles[y*l->m_Width+x].m_Index == TILE_SWITCHTIMEDCLOSE)
if((l->m_pTiles[y*l->m_Width+x].m_Index >= (ENTITY_ARMOR_1 + ENTITY_OFFSET) && l->m_pTiles[y*l->m_Width+x].m_Index <= (ENTITY_DOOR + ENTITY_OFFSET)) || l->m_pTiles[y*l->m_Width+x].m_Index == TILE_SWITCHOPEN || l->m_pTiles[y*l->m_Width+x].m_Index == TILE_SWITCHCLOSE || l->m_pTiles[y*l->m_Width+x].m_Index == TILE_SWITCHTIMEDOPEN || l->m_pTiles[y*l->m_Width+x].m_Index == TILE_SWITCHTIMEDCLOSE)
{
/*if(l->m_pSwitchTile[y*l->m_Width+x].m_Number)
if(m_pEditor->m_SwitchNum != l->m_SwitchNumber || m_pEditor->m_SwitchDelay != l->m_SwitchDelay)
{
m_pSwitchTile[fy*m_Width+fx].m_Number = m_pEditor->m_SwitchNum;
m_pSwitchTile[fy*m_Width+fx].m_Delay = m_pEditor->m_SwitchDelay;
}
else if(l->m_pSwitchTile[y*l->m_Width+x].m_Number)
{
m_pSwitchTile[fy*m_Width+fx].m_Number = l->m_pSwitchTile[y*l->m_Width+x].m_Number;
else*/
m_pSwitchTile[fy*m_Width+fx].m_Delay = l->m_pSwitchTile[y*l->m_Width+x].m_Delay;
}
else
{
if(!m_pEditor->m_SwitchNum)
{
@ -1038,12 +1073,14 @@ void CLayerSwitch::BrushDraw(CLayer *pBrush, float wx, float wy)
continue;
}
else
{
m_pSwitchTile[fy*m_Width+fx].m_Number = m_pEditor->m_SwitchNum;
m_pSwitchTile[fy*m_Width+fx].m_Delay = m_pEditor->m_SwitchDelay;
}
}
m_pSwitchTile[fy*m_Width+fx].m_Type = l->m_pTiles[y*l->m_Width+x].m_Index;
m_pSwitchTile[fy*m_Width+fx].m_Flags = l->m_pTiles[y*l->m_Width+x].m_Flags;
m_pSwitchTile[fy*m_Width+fx].m_Delay = m_pEditor->m_SwitchDelay;
m_pTiles[fy*m_Width+fx].m_Index = l->m_pTiles[y*l->m_Width+x].m_Index;
}
else
@ -1082,15 +1119,25 @@ void CLayerSwitch::FillSelection(bool Empty, CLayer *pBrush, CUIRect Rect)
if(Empty)
{
m_pTiles[fy*m_Width+fx].m_Index = 0;
m_pSwitchTile[fy*m_Width+fx].m_Type = 0;
m_pSwitchTile[fy*m_Width+fx].m_Number = 0;
}
else
{
m_pTiles[fy*m_Width+fx] = pLt->m_pTiles[(y*pLt->m_Width + x%pLt->m_Width) % (pLt->m_Width*pLt->m_Height)];
if(!pLt->m_pSwitchTile[(y*pLt->m_Width + x%pLt->m_Width) % (pLt->m_Width*pLt->m_Height)].m_Number && m_pEditor->m_SwitchNum && m_pTiles[fy*m_Width+fx].m_Index > 0)
m_pSwitchTile[fy*m_Width+fx].m_Number = m_pEditor->m_SwitchNum;
else
m_pSwitchTile[fy*m_Width+fx].m_Number = pLt->m_pSwitchTile[(y*pLt->m_Width + x%pLt->m_Width) % (pLt->m_Width*pLt->m_Height)].m_Number;
m_pSwitchTile[fy*m_Width+fx].m_Type = m_pTiles[fy*m_Width+fx].m_Index;
if(m_pEditor->m_SwitchNum && m_pTiles[fy*m_Width+fx].m_Index > 0)
{
if((!pLt->m_pSwitchTile[(y*pLt->m_Width + x%pLt->m_Width) % (pLt->m_Width*pLt->m_Height)].m_Number) || m_pEditor->m_SwitchNum != pLt->m_SwitchNumber)
m_pSwitchTile[fy*m_Width+fx].m_Number = m_pEditor->m_SwitchNum;
else
m_pSwitchTile[fy*m_Width+fx].m_Number = pLt->m_pSwitchTile[(y*pLt->m_Width + x%pLt->m_Width) % (pLt->m_Width*pLt->m_Height)].m_Number;
if((!pLt->m_pSwitchTile[(y*pLt->m_Width + x%pLt->m_Width) % (pLt->m_Width*pLt->m_Height)].m_Delay) || m_pEditor->m_SwitchDelay != pLt->m_SwitchDelay)
m_pSwitchTile[fy*m_Width+fx].m_Delay = m_pEditor->m_SwitchNum;
else
m_pSwitchTile[fy*m_Width+fx].m_Delay = pLt->m_pSwitchTile[(y*pLt->m_Width + x%pLt->m_Width) % (pLt->m_Width*pLt->m_Height)].m_Delay;
m_pSwitchTile[fy*m_Width+fx].m_Flags = pLt->m_pSwitchTile[(y*pLt->m_Width + x%pLt->m_Width) % (pLt->m_Width*pLt->m_Height)].m_Flags;
}
}
}
}

View file

@ -558,7 +558,7 @@ int CEditor::PopupTele(CEditor *pEditor, CUIRect View)
};
CProperty aProps[] = {
{"Number", pEditor->m_TeleNum, PROPTYPE_INT_STEP, 0, 255},
{"Number", pEditor->m_TeleNumber, PROPTYPE_INT_STEP, 0, 255},
{0},
};
@ -567,7 +567,7 @@ int CEditor::PopupTele(CEditor *pEditor, CUIRect View)
int Prop = pEditor->DoProperties(&View, aProps, s_aIds, &NewVal);
if(Prop == PROP_TELE)
pEditor->m_TeleNum = clamp(NewVal, 0, 255);
pEditor->m_TeleNumber = clamp(NewVal, 0, 255);
return 0;
}

View file

@ -92,8 +92,6 @@ bool CCharacterCore::IsRightTeam(int MapIndex)
if(Collision()->m_pSwitchers)
if(m_pTeams->Team(m_Id) != TEAM_SUPER)
return Collision()->m_pSwitchers[Collision()->GetDTileNumber(MapIndex)].m_Status[m_pTeams->Team(m_Id)];
else
return false;
return false;
}
@ -274,10 +272,12 @@ void CCharacterCore::Tick(bool UseInput)
for(int i = 0; i < MAX_CLIENTS; i++)
{
CCharacterCore *p = m_pWorld->m_apCharacters[i];
dbg_msg1("GameCore", "ThisId = %d Id = %d Team = %d", m_Id, i, m_pTeams->Team(i));
if(!p || p == this || !m_pTeams->CanCollide(i, m_Id))
{
dbg_msg1("GameCore Continue", "ThisId = %d Id = %d Team = %d", m_Id, i, m_pTeams->Team(i));
continue;
}
dbg_msg1("GameCore Past Continue", "ThisId = %d Id = %d Team = %d", m_Id, i, m_pTeams->Team(i));
vec2 ClosestPoint = closest_point_on_line(m_HookPos, NewPos, p->m_Pos);
if(distance(p->m_Pos, ClosestPoint) < PhysSize+2.0f)
@ -288,6 +288,7 @@ void CCharacterCore::Tick(bool UseInput)
m_HookState = HOOK_GRABBED;
m_HookedPlayer = i;
Dist = distance(m_HookPos, p->m_Pos);
dbg_msg1("GameCore Hooked", "ThisId = %d Id = %d Team = %d", m_Id, i, m_pTeams->Team(i));
}
}
}

View file

@ -51,11 +51,15 @@ void CLayers::Init(class IKernel *pKernel)
m_pGameGroup->m_OffsetY = 0;
m_pGameGroup->m_ParallaxX = 100;
m_pGameGroup->m_ParallaxY = 100;
m_pGameGroup->m_UseClipping = 0;
m_pGameGroup->m_ClipX = 0;
m_pGameGroup->m_ClipY = 0;
m_pGameGroup->m_ClipW = 0;
m_pGameGroup->m_ClipH = 0;
if(m_pGameGroup->m_Version >= 2)
{
m_pGameGroup->m_UseClipping = 0;
m_pGameGroup->m_ClipX = 0;
m_pGameGroup->m_ClipY = 0;
m_pGameGroup->m_ClipW = 0;
m_pGameGroup->m_ClipH = 0;
}
//break;
}

View file

@ -105,7 +105,8 @@ enum
TILE_STOPA,
TILE_CP = 64,
TILE_CP_F,
TILE_NPC = 72,
TILE_OLDLASER = 71,
TILE_NPC,
TILE_EHOOK,
TILE_NOHIT,
TILE_NPH,//Remember to change this in collision.cpp if you add anymore tiles

View file

@ -287,7 +287,7 @@ void CGameContext::ModifyWeapons(int ClientId, int Victim, int Weapon, bool Remo
if(Weapon == -1)
{
if(Remove && pChr->m_ActiveWeapon == WEAPON_SHOTGUN || pChr->m_ActiveWeapon == WEAPON_GRENADE || pChr->m_ActiveWeapon == WEAPON_RIFLE)
if(Remove && (pChr->m_ActiveWeapon == WEAPON_SHOTGUN || pChr->m_ActiveWeapon == WEAPON_GRENADE || pChr->m_ActiveWeapon == WEAPON_RIFLE))
pChr->m_ActiveWeapon = WEAPON_GUN;
if(Remove)
@ -517,7 +517,7 @@ void CGameContext::ConInfo(IConsole::IResult *pResult, void *pUserData, int Clie
pSelf->Console()->PrintResponse(IConsole::OUTPUT_LEVEL_STANDARD, "info", "DDRace Mod. Version: " DDRACE_VERSION);
pSelf->Console()->PrintResponse(IConsole::OUTPUT_LEVEL_STANDARD, "info", "Official site: DDRace.info");
pSelf->Console()->PrintResponse(IConsole::OUTPUT_LEVEL_STANDARD, "info", "For more Info /CMDList");
pSelf->Console()->PrintResponse(IConsole::OUTPUT_LEVEL_STANDARD, "info", "For more Info /cmdlist");
pSelf->Console()->PrintResponse(IConsole::OUTPUT_LEVEL_STANDARD, "info", "Or visit DDRace.info");
}
@ -529,7 +529,7 @@ void CGameContext::ConHelp(IConsole::IResult *pResult, void *pUserData, int Clie
{
pSelf->Console()->PrintResponse(IConsole::OUTPUT_LEVEL_STANDARD, "info", "/cmdlist will show a list of all chat commands");
pSelf->Console()->PrintResponse(IConsole::OUTPUT_LEVEL_STANDARD, "info", "/help + any command will show you the help for this command");
pSelf->Console()->PrintResponse(IConsole::OUTPUT_LEVEL_STANDARD, "info", "Example /help flags will display the help about ");
pSelf->Console()->PrintResponse(IConsole::OUTPUT_LEVEL_STANDARD, "info", "Example /help settings will display the help about ");
}
else
{
@ -542,29 +542,87 @@ void CGameContext::ConHelp(IConsole::IResult *pResult, void *pUserData, int Clie
}
}
void CGameContext::ConFlags(IConsole::IResult *pResult, void *pUserData, int ClientId)
void CGameContext::ConSettings(IConsole::IResult *pResult, void *pUserData, int ClientId)
{
CGameContext *pSelf = (CGameContext *)pUserData;
char buf[64];
float temp1;
float temp2;
pSelf->m_Tuning.Get("player_collision",&temp1);
pSelf->m_Tuning.Get("player_hooking",&temp2);
str_format(buf, sizeof(buf), "Flags: cheats[%s]%s%s collision[%s] hooking[%s]",
g_Config.m_SvCheats?"yes":"no",
(g_Config.m_SvCheats)?" w/Time":"",
(g_Config.m_SvCheats)?(g_Config.m_SvCheatTime)?"[yes]":"[no]":"",
temp1?"yes":"no",
temp2?"yes":"no");
pSelf->Console()->PrintResponse(IConsole::OUTPUT_LEVEL_STANDARD, "info", buf);
str_format(buf, sizeof(buf), "endless hook[%s] weapons effect others[%s]",g_Config.m_SvEndlessDrag?"yes":"no",g_Config.m_SvHit?"yes":"no");
pSelf->Console()->PrintResponse(IConsole::OUTPUT_LEVEL_STANDARD, "info", buf);
if(g_Config.m_SvPauseable)
if(pResult->NumArguments() == 0)
{
str_format(buf, sizeof(buf), "Server Allows /pause with%s",g_Config.m_SvPauseTime?" time pause.":"out time pause.");
pSelf->Console()->PrintResponse(IConsole::OUTPUT_LEVEL_STANDARD, "info", buf);
pSelf->Console()->PrintResponse(IConsole::OUTPUT_LEVEL_STANDARD, "info", "to check a server setting say /settings and setting's name, setting names are:");
pSelf->Console()->PrintResponse(IConsole::OUTPUT_LEVEL_STANDARD, "info", "teams, cheats, collision, hooking, endlesshooking, me, ");
pSelf->Console()->PrintResponse(IConsole::OUTPUT_LEVEL_STANDARD, "info", "hitting, oldlaser, timeout, votes, pause and scores");
}
else
{
const char *pArg = pResult->GetString(0);
char aBuf[256];
float ColTemp;
float HookTemp;
pSelf->m_Tuning.Get("player_collision", &ColTemp);
pSelf->m_Tuning.Get("player_hooking", &HookTemp);
if(str_comp(pArg, "cheats") == 0)
{
str_format(aBuf, sizeof(aBuf), "%s%s",
g_Config.m_SvCheats?"People can cheat":"People can't cheat",
(g_Config.m_SvCheats)?(g_Config.m_SvCheatTime)?" with time":" without time":"");
pSelf->Console()->PrintResponse(IConsole::OUTPUT_LEVEL_STANDARD, "info", aBuf);
if(g_Config.m_SvCheats)
{
str_format(aBuf, sizeof(aBuf), "%s", g_Config.m_SvEndlessSuperHook?"super can hook you forever":"super can only hook you for limited time");
pSelf->Console()->PrintResponse(IConsole::OUTPUT_LEVEL_STANDARD, "info", aBuf);
str_format(aBuf, sizeof(aBuf), "%s", g_Config.m_SvTimer?"admins have the power to control your time":"admins have no power over your time");
pSelf->Console()->PrintResponse(IConsole::OUTPUT_LEVEL_STANDARD, "info", aBuf);
}
}
else if(str_comp(pArg, "teams") == 0)
{
str_format(aBuf, sizeof(aBuf), "%s %s", !g_Config.m_SvTeam?"Teams are available on this server":g_Config.m_SvTeam==-1?"Teams are not available on this server":"You have to be in a team to play on this server", !g_Config.m_SvTeamStrict?"and if you die in a team only you die":"and if you die in a team all of you die");
pSelf->Console()->PrintResponse(IConsole::OUTPUT_LEVEL_STANDARD, "info", aBuf);
}
else if(str_comp(pArg, "collision") == 0)
{
pSelf->Console()->PrintResponse(IConsole::OUTPUT_LEVEL_STANDARD, "info", ColTemp?"Players can collide on this server":"Players Can't collide on this server");
}
else if(str_comp(pArg, "hooking") == 0)
{
pSelf->Console()->PrintResponse(IConsole::OUTPUT_LEVEL_STANDARD, "info", HookTemp?"Players can hook each other on this server":"Players Can't hook each other on this server");
}
else if(str_comp(pArg, "endlesshooking") == 0)
{
pSelf->Console()->PrintResponse(IConsole::OUTPUT_LEVEL_STANDARD, "info", g_Config.m_SvEndlessDrag?"Players can hook time is unlimited":"Players can hook time is limited");
}
else if(str_comp(pArg, "hitting") == 0)
{
pSelf->Console()->PrintResponse(IConsole::OUTPUT_LEVEL_STANDARD, "info", g_Config.m_SvHit?"Player's weapons affect each other":"Player's weapons has no affect on each other");
}
else if(str_comp(pArg, "oldlaser") == 0)
{
pSelf->Console()->PrintResponse(IConsole::OUTPUT_LEVEL_STANDARD, "info", g_Config.m_SvOldLaser?"Lasers can hit you if you shot them and that they pull you towards the bounce origin (Like DDRace Beta)":"Lasers can't hit you if you shot them, and they pull others towards the shooter");
}
else if(str_comp(pArg, "me") == 0)
{
pSelf->Console()->PrintResponse(IConsole::OUTPUT_LEVEL_STANDARD, "info", g_Config.m_SvSlashMe?"Players can use /me commands the famous IRC Command":"Players Can't use the /me command");
}
else if(str_comp(pArg, "timeout") == 0)
{
str_format(aBuf, sizeof(aBuf), "The Server Timeout is currently set to %d", g_Config.m_ConnTimeout);
pSelf->Console()->PrintResponse(IConsole::OUTPUT_LEVEL_STANDARD, "info", aBuf);
}
else if(str_comp(pArg, "votes") == 0)
{
pSelf->Console()->PrintResponse(IConsole::OUTPUT_LEVEL_STANDARD, "info", g_Config.m_SvVoteKick?"Players can use Callvote menu tab to kick offenders":"Players Can't use the Callvote menu tab to kick offenders");
if(g_Config.m_SvVoteKick)
str_format(aBuf, sizeof(aBuf), "Players are banned for %d second(s) if they get voted off", g_Config.m_SvVoteKickBantime);
pSelf->Console()->PrintResponse(IConsole::OUTPUT_LEVEL_STANDARD, "info", g_Config.m_SvVoteKickBantime?aBuf:"Players are just kicked and not banned if they get voted off");
}
else if(str_comp(pArg, "pause") == 0)
{
pSelf->Console()->PrintResponse(IConsole::OUTPUT_LEVEL_STANDARD, "info", g_Config.m_SvPauseable?g_Config.m_SvPauseTime?"/pause is available on this server and it pauses your time too":"/pause is available on this server but it doesn't pause your time":"/pause is NOT available on this server");
}
else if(str_comp(pArg, "scores") == 0)
{
pSelf->Console()->PrintResponse(IConsole::OUTPUT_LEVEL_STANDARD, "info", g_Config.m_SvHideScore?"Scores are private on this server":"Scores are public on this server");
}
}
}
@ -717,15 +775,6 @@ void CGameContext::ConRank(IConsole::IResult *pResult, void *pUserData, int Clie
pSelf->Score()->ShowRank(pPlayer->GetCID(), pSelf->Server()->ClientName(ClientId));
}
void CGameContext::ConBroadTime(IConsole::IResult *pResult, void *pUserData, int ClientId)
{
CGameContext *pSelf = (CGameContext *)pUserData;
CCharacter* pChr = pSelf->m_apPlayers[ClientId]->GetCharacter();
if(pChr)
pChr->m_BroadTime = !pChr->m_BroadTime;
}
void CGameContext::ConJoinTeam(IConsole::IResult *pResult, void *pUserData, int ClientId)
{
@ -792,7 +841,10 @@ void CGameContext::ConMe(IConsole::IResult *pResult, void *pUserData, int Client
char aBuf[256 + 24];
str_format(aBuf, 256 + 24, "'%s' %s", pSelf->Server()->ClientName(ClientId), pResult->GetString(0));
pSelf->SendChat(-2, CGameContext::CHAT_ALL, aBuf, ClientId);
if(g_Config.m_SvSlashMe)
pSelf->SendChat(-2, CGameContext::CHAT_ALL, aBuf, ClientId);
else
pSelf->Console()->PrintResponse(IConsole::OUTPUT_LEVEL_STANDARD, "info", "/me is disabled on this server, admin can enable it by using sv_slash_me");
}
void CGameContext::ConToggleEyeEmote(IConsole::IResult *pResult, void *pUserData, int ClientId)

View file

@ -74,17 +74,17 @@ bool CCharacter::Spawn(CPlayer *pPlayer, vec2 Pos)
m_DDRaceState = DDRACE_NONE;
m_PrevPos = Pos;
m_Core.Reset();
m_BroadTime = true;
m_BroadCast = true;
m_EyeEmote = true;
m_Fly = true;
m_TimerReseted = false;
m_LastBroadcast = 0;
m_TeamBeforeSuper = 0;
CGameControllerDDRace* Controller = (CGameControllerDDRace*)GameServer()->m_pController;
m_Core.Init(&GameServer()->m_World.m_Core, GameServer()->Collision(), &Controller->m_Teams.m_Core);
m_Core.m_Pos = m_Pos;
m_Core.m_Id = GetPlayer()->GetCID();
GameServer()->m_World.m_Core.m_apCharacters[m_pPlayer->GetCID()] = &m_Core;
dbg_msg("CCHaracter::Spawn", "ID %d Player %d m_Core %d", GetPlayer()->GetCID() ,GetPlayer() ,&m_Core);
m_ReckoningTick = 0;
mem_zero(&m_SendCore, sizeof(m_SendCore));
@ -104,7 +104,8 @@ bool CCharacter::Spawn(CPlayer *pPlayer, vec2 Pos)
void CCharacter::Destroy()
{
GameServer()->m_World.m_Core.m_apCharacters[m_pPlayer->GetCID()] = 0;
//GameServer()->m_World.m_Core.m_apCharacters[m_MarkedId] = 0; This caused the Marked Char for delete to always Delete ID 0 Core
dbg_msg("CCHaracter::Destroy", "ID %d Player %d m_Core %d", GetPlayer()->GetCID() ,GetPlayer() ,&m_Core);
m_Alive = false;
CEntity::Destroy();
}
@ -659,9 +660,9 @@ void CCharacter::OnFinish()
m_DDRaceState = DDRACE_NONE;
// set player score
if(!GameServer()->Score()->PlayerData(m_pPlayer->GetCID())->m_CurrentTime || GameServer()->Score()->PlayerData(m_pPlayer->GetCID())->m_CurrentTime > time)
if(!pData->m_CurrentTime || pData->m_CurrentTime > time)
{
GameServer()->Score()->PlayerData(m_pPlayer->GetCID())->m_CurrentTime = time;
pData->m_CurrentTime = time;
NeedToSendNewRecord = true;
for(int i = 0; i < MAX_CLIENTS; i++)
{
@ -693,6 +694,12 @@ void CCharacter::OnFinish()
Msg.m_Time = (int)(time * 100.0f);
Msg.m_Check = 0;
Msg.m_Finish = 1;
if(pData->m_BestTime)
{
float Diff = (time - pData->m_BestTime)*100;
Msg.m_Check = (int)Diff;
}
Server()->SendPackMsg(&Msg, MSGFLAG_VITAL, m_pPlayer->GetCID());
}
@ -722,7 +729,6 @@ void CCharacter::HandleFly()
void CCharacter::Tick()
{
CGameControllerDDRace* Controller = (CGameControllerDDRace*)GameServer()->m_pController;
std::list < int > Indices = GameServer()->Collision()->GetMapIndices(m_PrevPos, m_Pos);
//dbg_msg("Indices","%d",Indices.size());
/*if(m_pPlayer->m_ForceBalanced)
@ -769,88 +775,58 @@ void CCharacter::Tick()
m_Core.m_HookTick = 0;
/*dbg_msg("character","m_TileIndex=%d , m_TileFIndex=%d",m_TileIndex,m_TileFIndex); //REMOVE*/
//DDRace
char aBuftime[128];
char aBroadcast[128];
m_Time = (float)(Server()->Tick() - m_StartTime) / ((float)Server()->TickSpeed());
CPlayerData *pData = GameServer()->Score()->PlayerData(m_pPlayer->GetCID());
if(!m_TimerReseted && m_DDRaceState == DDRACE_CHEAT) {
m_TimerReseted = true;
CNetMsg_Sv_DDRaceTime Msg;
Msg.m_Time = 0;
Msg.m_Check = 0;
Msg.m_Finish = 0;
Server()->SendPackMsg(&Msg, MSGFLAG_VITAL, m_pPlayer->GetCID());
}
if(Server()->Tick() - m_RefreshTime >= Server()->TickSpeed())
{
if (m_DDRaceState == DDRACE_STARTED) {
int IntTime = (int)m_Time;
if(m_pPlayer->m_IsUsingDDRaceClient) {
CNetMsg_Sv_DDRaceTime Msg;
Msg.m_Time = IntTime;
Msg.m_Check = 0;
Msg.m_Finish = 0;
if(m_CpActive != -1 && m_CpTick > Server()->Tick())
if (m_DDRaceState == DDRACE_STARTED)
{
if(m_CpActive != -1 && m_CpTick > Server()->Tick() && !m_pPlayer->m_IsUsingDDRaceClient)
{
if(pData->m_BestTime && pData->m_aBestCpTime[m_CpActive] != 0)
{
if(pData->m_BestTime && pData->m_aBestCpTime[m_CpActive] != 0)
{
float Diff = (m_CpCurrent[m_CpActive] - pData->m_aBestCpTime[m_CpActive])*100;
Msg.m_Check = (int)Diff;
}
}
Server()->SendPackMsg(&Msg, MSGFLAG_VITAL, m_pPlayer->GetCID());
} else {
if(m_BroadTime)
str_format(aBuftime, sizeof(aBuftime), "%s%d:%s%d", ((IntTime/60) > 9)?"":"0", IntTime/60, ((IntTime%60) > 9)?"":"0", IntTime%60);
else
str_format(aBuftime, sizeof(aBuftime), "");
if(m_CpActive != -1 && m_CpTick > Server()->Tick())
{
if(pData->m_BestTime && pData->m_aBestCpTime[m_CpActive] != 0)
{
char aTmp[128];
float Diff = m_CpCurrent[m_CpActive] - pData->m_aBestCpTime[m_CpActive];
str_format(aTmp, sizeof(aTmp), "\nCheckpoint | Diff : %+5.2f", Diff);
strcat(aBuftime, aTmp);
}
}
if( g_Config.m_SvBroadcast[0] != 0 && m_BroadCast)
{
char aTmp[128];
str_format(aTmp, sizeof(aTmp), "\n%s\n", g_Config.m_SvBroadcast);
strcat(aBuftime, aTmp);
}
if(Server()->Tick() >= (m_LastBroadcast + Server()->TickSpeed()))
{
GameServer()->SendBroadcast(aBuftime, m_pPlayer->GetCID());
float Diff = m_CpCurrent[m_CpActive] - pData->m_aBestCpTime[m_CpActive];
str_format(aBroadcast, sizeof(aBroadcast), "Checkpoint | Diff : %+5.2f", Diff);
GameServer()->SendBroadcast(aBroadcast, m_pPlayer->GetCID());
m_LastBroadcast = Server()->Tick();
}
}
} else {
else if( g_Config.m_SvBroadcast[0] != 0 && m_BroadCast)
{
str_format(aBroadcast, sizeof(aBroadcast), "%s", g_Config.m_SvBroadcast);
if(Server()->Tick() >= (m_LastBroadcast + Server()->TickSpeed()))
{
GameServer()->SendBroadcast(aBroadcast, m_pPlayer->GetCID());
m_LastBroadcast = Server()->Tick();
}
}
}
else
{
char aTmp[128];
if(!m_pPlayer->m_IsUsingDDRaceClient)
{
if( g_Config.m_SvBroadcast[0] != 0 && (Server()->Tick() > (m_LastBroadcast + (Server()->TickSpeed() * 9)))) {
char aTmp[128], aYourBest[64],aServerBest[64];
if( g_Config.m_SvBroadcast[0] != 0 && (Server()->Tick() > (m_LastBroadcast + (Server()->TickSpeed() * 9))))
{
char aYourBest[64],aServerBest[64];
str_format(aYourBest, sizeof(aYourBest), "Your Best:'%s%d:%s%d'", ((pData->m_BestTime / 60) < 10)?"0":"", (int)(pData->m_BestTime / 60), (((int)pData->m_BestTime % 60) < 10)?"0":"", (int)pData->m_BestTime % 60);
CPlayerData *pData = GameServer()->Score()->PlayerData(m_pPlayer->GetCID());
str_format(aServerBest, sizeof(aServerBest), "Server Best:'%s%d:%s%d'", ((GameServer()->m_pController->m_CurrentRecord / 60) < 10)?"0":"", (int)(GameServer()->m_pController->m_CurrentRecord / 60), (((int)GameServer()->m_pController->m_CurrentRecord % 60) < 10)?"0":"", (int)GameServer()->m_pController->m_CurrentRecord % 60);
str_format(aTmp, sizeof(aTmp), "%s\n%s %s", g_Config.m_SvBroadcast, (GameServer()->m_pController->m_CurrentRecord)?aServerBest:"", (pData->m_BestTime)?aYourBest:"");
str_format(aTmp, sizeof(aTmp), "%s %s", (GameServer()->m_pController->m_CurrentRecord)?aServerBest:"", (pData->m_BestTime)?aYourBest:"");
GameServer()->SendBroadcast(aTmp, m_pPlayer->GetCID());
m_LastBroadcast = Server()->Tick();
}
} else {
//make there smthing with broadcast
}
else if( g_Config.m_SvBroadcast[0] != 0 && (Server()->Tick() > (m_LastBroadcast + (Server()->TickSpeed() * 9))))
{
str_format(aTmp, sizeof(aTmp), "%s", g_Config.m_SvBroadcast);
GameServer()->SendBroadcast(aTmp, m_pPlayer->GetCID());
m_LastBroadcast = Server()->Tick();
}
}
m_RefreshTime = Server()->Tick();
@ -889,6 +865,7 @@ void CCharacter::HandleTiles(int Index)
{//dbg_msg("num","%d",++num);
CGameControllerDDRace* Controller = (CGameControllerDDRace*)GameServer()->m_pController;
int MapIndex = Index;
int PureMapIndex = GameServer()->Collision()->GetPureMapIndex(m_Pos);
float Offset = 4;
int MapIndexL = GameServer()->Collision()->GetPureMapIndex(vec2(m_Pos.x + (m_ProximityRadius/2)+Offset,m_Pos.y));
int MapIndexR = GameServer()->Collision()->GetPureMapIndex(vec2(m_Pos.x - (m_ProximityRadius/2)-Offset,m_Pos.y));
@ -948,6 +925,24 @@ void CCharacter::HandleTiles(int Index)
m_CpActive = cp;
m_CpCurrent[cp] = m_Time;
m_CpTick = Server()->Tick() + Server()->TickSpeed()*2;
if(m_pPlayer->m_IsUsingDDRaceClient) {
CPlayerData *pData = GameServer()->Score()->PlayerData(m_pPlayer->GetCID());
CNetMsg_Sv_DDRaceTime Msg;
Msg.m_Time = (int)m_Time;
Msg.m_Check = 0;
Msg.m_Finish = 0;
if(m_CpActive != -1 && m_CpTick > Server()->Tick())
{
if(pData->m_BestTime && pData->m_aBestCpTime[m_CpActive] != 0)
{
float Diff = (m_CpCurrent[m_CpActive] - pData->m_aBestCpTime[m_CpActive])*100;
Msg.m_Check = (int)Diff;
}
}
Server()->SendPackMsg(&Msg, MSGFLAG_VITAL, m_pPlayer->GetCID());
}
}
int cpf = GameServer()->Collision()->IsFCheckpoint(MapIndex);
if(cpf != -1 && m_DDRaceState == DDRACE_STARTED && cpf > m_CpActive)
@ -955,6 +950,24 @@ void CCharacter::HandleTiles(int Index)
m_CpActive = cpf;
m_CpCurrent[cpf] = m_Time;
m_CpTick = Server()->Tick() + Server()->TickSpeed()*2;
if(m_pPlayer->m_IsUsingDDRaceClient) {
CPlayerData *pData = GameServer()->Score()->PlayerData(m_pPlayer->GetCID());
CNetMsg_Sv_DDRaceTime Msg;
Msg.m_Time = (int)m_Time;
Msg.m_Check = 0;
Msg.m_Finish = 0;
if(m_CpActive != -1 && m_CpTick > Server()->Tick())
{
if(pData->m_BestTime && pData->m_aBestCpTime[m_CpActive] != 0)
{
float Diff = (m_CpCurrent[m_CpActive] - pData->m_aBestCpTime[m_CpActive])*100;
Msg.m_Check = (int)Diff;
}
}
Server()->SendPackMsg(&Msg, MSGFLAG_VITAL, m_pPlayer->GetCID());
}
}
if(((m_TileIndex == TILE_BEGIN) || (m_TileFIndex == TILE_BEGIN) || FTile1 == TILE_BEGIN || FTile2 == TILE_BEGIN || FTile3 == TILE_BEGIN || FTile4 == TILE_BEGIN || Tile1 == TILE_BEGIN || Tile2 == TILE_BEGIN || Tile3 == TILE_BEGIN || Tile4 == TILE_BEGIN) && (m_DDRaceState == DDRACE_NONE || (m_DDRaceState == DDRACE_STARTED && !Team())))
{
@ -1039,12 +1052,11 @@ void CCharacter::HandleTiles(int Index)
GameServer()->Collision()->m_pSwitchers[GameServer()->Collision()->GetSwitchNumber(MapIndex)].m_Type[Team()] = TILE_SWITCHCLOSE;
}
// handle speedup tiles
if(GameServer()->Collision()->IsSpeedup(MapIndex) == TILE_BOOST)
if(GameServer()->Collision()->IsSpeedup(PureMapIndex) == TILE_BOOST)
{
vec2 Direction, MaxVel, TempVel = m_Core.m_Vel;
int Force, MaxSpeed = 0;
float TeeAngle, SpeederAngle, DiffAngle, SpeedLeft, TeeSpeed;
const float Zero=0;
GameServer()->Collision()->GetSpeedup(MapIndex, &Direction, &Force, &MaxSpeed);
if(Force == 255 && MaxSpeed)
{
@ -1395,6 +1407,7 @@ void CCharacter::Die(int Killer, int Weapon)
m_Alive = false;
MarkDestroy();
GameServer()->m_World.m_Core.m_apCharacters[m_pPlayer->GetCID()] = 0;
dbg_msg("CCHaracter::Die", "ID %d Player %d m_Core %d", GetPlayer()->GetCID() ,GetPlayer() ,&m_Core);
GameServer()->CreateDeath(m_Pos, m_pPlayer->GetCID());
// we got to wait 0.5 secs before respawning

View file

@ -132,9 +132,6 @@ public:
// weapon info
CEntity *m_apHitObjects[10];
int m_NumObjectsHit;
bool m_TimerReseted;
int m_QueuedWeapon;
@ -185,11 +182,8 @@ public:
int m_CpActive;
float m_CpCurrent[25];
int m_BroadTime;
int m_BroadCast;
/*int m_CurrentTile;
int m_CurrentFTile;*/
int m_TileIndex;
int m_TileFlags;
int m_TileFIndex;

View file

@ -56,7 +56,6 @@ void CDoor::Tick()
void CDoor::Snap(int SnappingClient)
{
CGameControllerDDRace* Controller = (CGameControllerDDRace*)GameServer()->m_pController;
if(NetworkClipped(SnappingClient, m_Pos) && NetworkClipped(SnappingClient, m_To))
return;

View file

@ -26,7 +26,7 @@ CDragger::CDragger(CGameWorld *pGameWorld, vec2 Pos, float Strength, bool NW, in
void CDragger::Move()
{
if(m_Target && m_Target->m_Alive && (m_Target->m_Super || m_Layer == LAYER_SWITCH && !GameServer()->Collision()->m_pSwitchers[m_Number].m_Status[m_Target->Team()]))
if(m_Target && m_Target->m_Alive && (m_Target->m_Super || (m_Layer == LAYER_SWITCH && !GameServer()->Collision()->m_pSwitchers[m_Number].m_Status[m_Target->Team()])))
m_Target = 0;
if(m_Target)
return;

View file

@ -25,14 +25,18 @@ bool CLaser::HitCharacter(vec2 From, vec2 To)
vec2 At;
CCharacter *OwnerChar = GameServer()->GetPlayerChar(m_Owner);
CCharacter *Hit = GameServer()->m_World.IntersectCharacter(m_Pos, To, 0.f, At, m_Bounces != 0 ? 0: OwnerChar, m_Owner);
if(!Hit)
if(!Hit || (Hit == OwnerChar && g_Config.m_SvOldLaser))
return false;
m_From = From;
m_Pos = At;
m_Energy = -1;
if (m_Type == 1 && g_Config.m_SvHit)
{
vec2 Temp = Hit->m_Core.m_Vel + normalize(m_PrevPos - Hit->m_Core.m_Pos) * 10;
vec2 Temp;
if(!g_Config.m_SvOldLaser)
Temp = Hit->m_Core.m_Vel + normalize(m_PrevPos - Hit->m_Core.m_Pos) * 10;
else
Temp = Hit->m_Core.m_Vel + normalize(OwnerChar->m_Core.m_Pos-Hit->m_Core.m_Pos)*10;
if(Temp.x > 0 && ((Hit->m_TileIndex == TILE_STOP && Hit->m_TileFlags == ROTATION_270) || (Hit->m_TileIndexL == TILE_STOP && Hit->m_TileFlagsL == ROTATION_270) || (Hit->m_TileIndexL == TILE_STOPS && (Hit->m_TileFlagsL == ROTATION_90 || Hit->m_TileFlagsL ==ROTATION_270)) || (Hit->m_TileIndexL == TILE_STOPA) || (Hit->m_TileFIndex == TILE_STOP && Hit->m_TileFFlags == ROTATION_270) || (Hit->m_TileFIndexL == TILE_STOP && Hit->m_TileFFlagsL == ROTATION_270) || (Hit->m_TileFIndexL == TILE_STOPS && (Hit->m_TileFFlagsL == ROTATION_90 || Hit->m_TileFFlagsL == ROTATION_270)) || (Hit->m_TileFIndexL == TILE_STOPA) || (Hit->m_TileSIndex == TILE_STOP && Hit->m_TileSFlags == ROTATION_270) || (Hit->m_TileSIndexL == TILE_STOP && Hit->m_TileSFlagsL == ROTATION_270) || (Hit->m_TileSIndexL == TILE_STOPS && (Hit->m_TileSFlagsL == ROTATION_90 || Hit->m_TileSFlagsL == ROTATION_270)) || (Hit->m_TileSIndexL == TILE_STOPA)))
Temp.x = 0;
if(Temp.x < 0 && ((Hit->m_TileIndex == TILE_STOP && Hit->m_TileFlags == ROTATION_90) || (Hit->m_TileIndexR == TILE_STOP && Hit->m_TileFlagsR == ROTATION_90) || (Hit->m_TileIndexR == TILE_STOPS && (Hit->m_TileFlagsR == ROTATION_90 || Hit->m_TileFlagsR == ROTATION_270)) || (Hit->m_TileIndexR == TILE_STOPA) || (Hit->m_TileFIndex == TILE_STOP && Hit->m_TileFFlags == ROTATION_90) || (Hit->m_TileFIndexR == TILE_STOP && Hit->m_TileFFlagsR == ROTATION_90) || (Hit->m_TileFIndexR == TILE_STOPS && (Hit->m_TileFFlagsR == ROTATION_90 || Hit->m_TileFFlagsR == ROTATION_270)) || (Hit->m_TileFIndexR == TILE_STOPA) || (Hit->m_TileSIndex == TILE_STOP && Hit->m_TileSFlags == ROTATION_90) || (Hit->m_TileSIndexR == TILE_STOP && Hit->m_TileSFlagsR == ROTATION_90) || (Hit->m_TileSIndexR == TILE_STOPS && (Hit->m_TileSFlagsR == ROTATION_90 || Hit->m_TileSFlagsR == ROTATION_270)) || (Hit->m_TileSIndexR == TILE_STOPA)))
@ -126,8 +130,14 @@ void CLaser::Snap(int SnappingClient)
{
if(NetworkClipped(SnappingClient))
return;
CCharacter * Char = GameServer()->GetPlayerChar(SnappingClient);
if(Char && Char->m_Alive && m_Owner != -1 && GameServer()->GetPlayerChar(m_Owner)->m_Alive && Char->Team() != GameServer()->GetPlayerChar(m_Owner)->Team()) return;
CCharacter * SnappingChar = GameServer()->GetPlayerChar(SnappingClient);
CCharacter * OwnerChar = 0;
if(m_Owner >= 0)
OwnerChar = GameServer()->GetPlayerChar(m_Owner);
if(!SnappingChar || !OwnerChar)
return;
if(SnappingChar->m_Alive && OwnerChar->m_Alive && SnappingChar->Team() != OwnerChar->Team())
return;
CNetObj_Laser *pObj = static_cast<CNetObj_Laser *>(Server()->SnapNewItem(NETOBJTYPE_LASER, m_Id, sizeof(CNetObj_Laser)));
pObj->m_X = (int)m_Pos.x;
pObj->m_Y = (int)m_Pos.y;

View file

@ -69,7 +69,6 @@ void CPickup::Tick()
if(m_Layer == LAYER_SWITCH && !GameServer()->Collision()->m_pSwitchers[m_Number].m_Status[pChr->Team()]) continue;
bool sound = false;
// player picked us up, is someone was hooking us, let them go
int RespawnTime = -1;
switch (m_Type)
{
case POWERUP_HEALTH:

View file

@ -4,6 +4,7 @@
#include <stdio.h>
#include <string.h>
#include <base/math.h>
#include <base/tl/sorted_array.h>
#include <engine/shared/config.h>
#include <engine/server/server.h>
#include <engine/map.h>
@ -276,11 +277,13 @@ void CGameContext::SendChatResponse(const char *pLine, void *pUser)
void CGameContext::SendChat(int ChatterClientId, int Team, const char *pText, int SpamProtectionClientId)
{
if(SpamProtectionClientId >= 0 && SpamProtectionClientId < MAX_CLIENTS)
if(/*g_Config.m_SvSpamprotection && */m_apPlayers[SpamProtectionClientId]->m_Last_Chat
{
if(g_Config.m_SvSpamprotection && m_apPlayers[SpamProtectionClientId]->m_Last_Chat
&& m_apPlayers[SpamProtectionClientId]->m_Last_Chat + Server()->TickSpeed() + g_Config.m_SvChatDelay > Server()->Tick())
return;
else
m_apPlayers[SpamProtectionClientId]->m_Last_Chat = Server()->Tick();
}
char aBuf[256], aText[256];
str_copy(aText, pText, sizeof(aText));
@ -579,14 +582,14 @@ void CGameContext::OnTick()
}
}
if(Server()->Tick() % Server()->TickSpeed() * 60 == g_Config.m_SvAnnouncementInterval)
if(Server()->Tick() % (g_Config.m_SvAnnouncementInterval * Server()->TickSpeed() * 60) == 0)
{
char *Line = ((CServer *) Server())->GetLine(g_Config.m_SvAnnouncementFileName, m_AnnouncementLine++);
char *Line = ((CServer *) Server())->GetAnnouncementLine(g_Config.m_SvAnnouncementFileName);
if(Line)
SendChat(-1, CGameContext::CHAT_ALL, Line);
}
if(Collision()->m_NumSwitchers)
if(Collision()->m_NumSwitchers > 0)
for (int i = 0; i < Collision()->m_NumSwitchers+1; ++i)
{
for (int j = 0; j < 16; ++j)
@ -650,7 +653,7 @@ void CGameContext::OnClientEnter(int ClientId)
SendChatTarget(ClientId, "DDRace Mod. Version: " DDRACE_VERSION);
SendChatTarget(ClientId, "Official site: DDRace.info");
SendChatTarget(ClientId, "For more Info /CMDList");
SendChatTarget(ClientId, "For more Info /cmdlist");
SendChatTarget(ClientId, "Or visit DDRace.info");
SendChatTarget(ClientId, "To see this again say /info");
SendChatTarget(ClientId, "Note This is an Alpha release, just for testing, your feedback is important!!");
@ -729,7 +732,7 @@ void CGameContext::OnClientDrop(int ClientId)
void CGameContext::OnMessage(int MsgId, CUnpacker *pUnpacker, int ClientId)
{
void *pRawMsg = m_NetObjHandler.SecureUnpackMsg(MsgId, pUnpacker);
CPlayer *pPlayer = m_apPlayers[ClientId];
CPlayer *p = m_apPlayers[ClientId];
if(!pRawMsg)
{
@ -744,9 +747,9 @@ void CGameContext::OnMessage(int MsgId, CUnpacker *pUnpacker, int ClientId)
CNetMsg_Cl_Say *pMsg = (CNetMsg_Cl_Say *)pRawMsg;
int Team = pMsg->m_Team;
//if(Team)
int GameTeam = ((CGameControllerDDRace*)m_pController)->m_Teams.m_Core.Team(pPlayer->GetCID());
int GameTeam = ((CGameControllerDDRace*)m_pController)->m_Teams.m_Core.Team(p->GetCID());
if(Team) {
Team = (pPlayer->GetTeam() == -1) ? CHAT_SPEC : (GameTeam == 0 ? CHAT_ALL : GameTeam);
Team = (p->GetTeam() == -1) ? CHAT_SPEC : (GameTeam == 0 ? CHAT_ALL : GameTeam);
} else {
Team = CHAT_ALL;
}
@ -773,8 +776,6 @@ void CGameContext::OnMessage(int MsgId, CUnpacker *pUnpacker, int ClientId)
Console()->ExecuteLine(pMsg->m_pMessage + 1, ((CServer *) Server())->m_aClients[ClientId].m_Authed, ClientId, CServer::SendRconLineAuthed, Server(), SendChatResponse, &Info);
}
else if(!str_comp_nocase(pMsg->m_pMessage, "kill"))
SendChatTarget(ClientId, "kill does nothing, say /kill if you want to die, also you can press f1 and type kill");
else
{
if(m_apPlayers[ClientId]->m_Muted == 0)
@ -788,17 +789,15 @@ void CGameContext::OnMessage(int MsgId, CUnpacker *pUnpacker, int ClientId)
SendChatTarget(ClientId, aBuf);
}
}
}
else if(MsgId == NETMSGTYPE_CL_CALLVOTE)
{
if(/*g_Config.m_SvSpamprotection && */pPlayer->m_Last_VoteTry && pPlayer->m_Last_VoteTry + Server()->TickSpeed() * g_Config.m_SvVoteDelay > Server()->Tick())
if(g_Config.m_SvSpamprotection && p->m_Last_VoteTry && p->m_Last_VoteTry + Server()->TickSpeed() * g_Config.m_SvVoteDelay > Server()->Tick())
return;
int64 Now = Server()->Tick();
pPlayer->m_Last_VoteTry = Now;
if(pPlayer->GetTeam() == -1)
p->m_Last_VoteTry = Now;
if(p->GetTeam() == -1)
{
SendChatTarget(ClientId, "Spectators aren't allowed to start a vote.");
return;
@ -810,8 +809,8 @@ void CGameContext::OnMessage(int MsgId, CUnpacker *pUnpacker, int ClientId)
return;
}
int Timeleft = pPlayer->m_Last_VoteCall + Server()->TickSpeed()*60 - Now;
if(pPlayer->m_Last_VoteCall && Timeleft > 0)
int Timeleft = p->m_Last_VoteCall + Server()->TickSpeed()*60 - Now;
if(p->m_Last_VoteCall && Timeleft > 0)
{
char aChatmsg[512] = {0};
str_format(aChatmsg, sizeof(aChatmsg), "You must wait %d seconds before making another vote", (Timeleft/Server()->TickSpeed())+1);
@ -852,7 +851,7 @@ void CGameContext::OnMessage(int MsgId, CUnpacker *pUnpacker, int ClientId)
if(!pOption)
{
if (pPlayer->m_Authed < 3) // allow admins to call any vote they want
if (p->m_Authed < 3) // allow admins to call any vote they want
{
str_format(aChatmsg, sizeof(aChatmsg), "'%s' isn't an option on this server", pMsg->m_Value);
SendChatTarget(ClientId, aChatmsg);
@ -884,7 +883,7 @@ void CGameContext::OnMessage(int MsgId, CUnpacker *pUnpacker, int ClientId)
m_apPlayers[ClientId]->m_Last_KickVote = time_get();
return;
}
else if(!g_Config.m_SvVoteKick && pPlayer->m_Authed < 2) // allow admins to call kick votes even if they are forbidden
else if(!g_Config.m_SvVoteKick && p->m_Authed < 2) // allow admins to call kick votes even if they are forbidden
{
SendChatTarget(ClientId, "Server does not allow voting to kick players");
m_apPlayers[ClientId]->m_Last_KickVote = time_get();
@ -902,7 +901,7 @@ void CGameContext::OnMessage(int MsgId, CUnpacker *pUnpacker, int ClientId)
SendChatTarget(ClientId, "You can't kick yourself");
return;
}
if(ComparePlayers(m_apPlayers[KickId], pPlayer))
if(ComparePlayers(m_apPlayers[KickId], p))
{
SendChatTarget(ClientId, "You can't kick admins");
m_apPlayers[ClientId]->m_Last_KickVote = time_get();
@ -945,10 +944,10 @@ void CGameContext::OnMessage(int MsgId, CUnpacker *pUnpacker, int ClientId)
{
SendChat(-1, CGameContext::CHAT_ALL, aChatmsg);
StartVote(aDesc, aCmd);
pPlayer->m_Vote = 1;
pPlayer->m_VotePos = m_VotePos = 1;
p->m_Vote = 1;
p->m_VotePos = m_VotePos = 1;
m_VoteCreator = ClientId;
pPlayer->m_Last_VoteCall = Now;
p->m_Last_VoteCall = Now;
}
}
else if(MsgId == NETMSGTYPE_CL_VOTE)
@ -956,14 +955,14 @@ void CGameContext::OnMessage(int MsgId, CUnpacker *pUnpacker, int ClientId)
if(!m_VoteCloseTime)
return;
if(pPlayer->m_Vote == 0)
if(p->m_Vote == 0)
{
CNetMsg_Cl_Vote *pMsg = (CNetMsg_Cl_Vote *)pRawMsg;
if(!pMsg->m_Vote)
return;
pPlayer->m_Vote = pMsg->m_Vote;
pPlayer->m_VotePos = ++m_VotePos;
p->m_Vote = pMsg->m_Vote;
p->m_VotePos = ++m_VotePos;
m_VoteUpdate = true;
}
}
@ -971,7 +970,7 @@ void CGameContext::OnMessage(int MsgId, CUnpacker *pUnpacker, int ClientId)
{
CNetMsg_Cl_SetTeam *pMsg = (CNetMsg_Cl_SetTeam *)pRawMsg;
if(pPlayer->GetTeam() == pMsg->m_Team || (/*g_Config.m_SvSpamprotection &&*/ pPlayer->m_Last_SetTeam && pPlayer->m_Last_SetTeam+Server()->TickSpeed() * g_Config.m_SvTeamChangeDelay > Server()->Tick()))
if(p->GetTeam() == pMsg->m_Team || (g_Config.m_SvSpamprotection && p->m_Last_SetTeam && p->m_Last_SetTeam+Server()->TickSpeed() * g_Config.m_SvTeamChangeDelay > Server()->Tick()))
return;
// Switch team on given client and kill/respawn him
@ -980,13 +979,13 @@ void CGameContext::OnMessage(int MsgId, CUnpacker *pUnpacker, int ClientId)
//if(m_pController->CanChangeTeam(pPlayer, pMsg->m_Number))
//{
//CCharacter* pChr=GetPlayerChar(ClientId);
if(pPlayer->GetTeam()==-1 && pPlayer->m_InfoSaved)
if(p->GetTeam()==-1 && p->m_InfoSaved)
SendChatTarget(ClientId,"Use /pause first then you can kill");
else{
pPlayer->m_Last_SetTeam = Server()->Tick();
if(pPlayer->GetTeam() == -1 || pMsg->m_Team == -1)
p->m_Last_SetTeam = Server()->Tick();
if(p->GetTeam() == -1 || pMsg->m_Team == -1)
m_VoteUpdate = true;
pPlayer->SetTeam(pMsg->m_Team);
p->SetTeam(pMsg->m_Team);
}
//if(pChr && pMsg->m_Number!=-1 && pChr->m_Paused)
@ -1007,7 +1006,7 @@ void CGameContext::OnMessage(int MsgId, CUnpacker *pUnpacker, int ClientId)
}
else if (MsgId == NETMSGTYPE_CL_ISDDRACE)
{
pPlayer->m_IsUsingDDRaceClient = true;
p->m_IsUsingDDRaceClient = true;
char aBuf[128];
str_format(aBuf, sizeof(aBuf), "%d use DDRace Client", ClientId);
@ -1043,20 +1042,18 @@ void CGameContext::OnMessage(int MsgId, CUnpacker *pUnpacker, int ClientId)
Server()->SendPackMsg(&Msg, MSGFLAG_VITAL, -1);
}
}
else if(MsgId == NETMSGTYPE_CL_CHANGEINFO || MsgId == NETMSGTYPE_CL_STARTINFO)
else if (MsgId == NETMSGTYPE_CL_CHANGEINFO || MsgId == NETMSGTYPE_CL_STARTINFO)
{
CNetMsg_Cl_ChangeInfo *pMsg = (CNetMsg_Cl_ChangeInfo *)pRawMsg;
if(/*g_Config.m_SvSpamprotection &&*/ pPlayer->m_Last_ChangeInfo && pPlayer->m_Last_ChangeInfo + Server()->TickSpeed() * g_Config.m_SvInfoChangeDelay > Server()->Tick())
if(g_Config.m_SvSpamprotection && p->m_Last_ChangeInfo && p->m_Last_ChangeInfo + Server()->TickSpeed() * g_Config.m_SvInfoChangeDelay > Server()->Tick())
return;
pPlayer->m_Last_ChangeInfo = time_get();
if(!pPlayer->m_ColorSet|| g_Config.m_SvAllowColorChange)
{
pPlayer->m_TeeInfos.m_UseCustomColor = pMsg->m_UseCustomColor;
pPlayer->m_TeeInfos.m_ColorBody = pMsg->m_ColorBody;
pPlayer->m_TeeInfos.m_ColorFeet = pMsg->m_ColorFeet;
}
p->m_Last_ChangeInfo = Server()->Tick();
p->m_TeeInfos.m_UseCustomColor = pMsg->m_UseCustomColor;
p->m_TeeInfos.m_ColorBody = pMsg->m_ColorBody;
p->m_TeeInfos.m_ColorFeet = pMsg->m_ColorFeet;
// copy old name
char aOldName[MAX_NAME_LENGTH];
@ -1071,9 +1068,9 @@ void CGameContext::OnMessage(int MsgId, CUnpacker *pUnpacker, int ClientId)
}
// set skin
str_copy(pPlayer->m_TeeInfos.m_SkinName, pMsg->m_pSkin, sizeof(pPlayer->m_TeeInfos.m_SkinName));
str_copy(p->m_TeeInfos.m_SkinName, pMsg->m_pSkin, sizeof(p->m_TeeInfos.m_SkinName));
//m_pController->OnPlayerInfoChange(pPlayer);
//m_pController->OnPlayerInfoChange(p);
if(MsgId == NETMSGTYPE_CL_STARTINFO)
{
@ -1101,13 +1098,13 @@ void CGameContext::OnMessage(int MsgId, CUnpacker *pUnpacker, int ClientId)
{
CNetMsg_Cl_Emoticon *pMsg = (CNetMsg_Cl_Emoticon *)pRawMsg;
if(/*g_Config.m_SvSpamprotection &&*/ pPlayer->m_Last_Emote && pPlayer->m_Last_Emote+Server()->TickSpeed()*g_Config.m_SvEmoticonDelay > Server()->Tick())
if(g_Config.m_SvSpamprotection && p->m_Last_Emote && p->m_Last_Emote+Server()->TickSpeed()*g_Config.m_SvEmoticonDelay > Server()->Tick())
return;
pPlayer->m_Last_Emote = Server()->Tick();
p->m_Last_Emote = Server()->Tick();
SendEmoticon(ClientId, pMsg->m_Emoticon);
CCharacter* pChr = pPlayer->GetCharacter();
CCharacter* pChr = p->GetCharacter();
if(pChr && g_Config.m_SvEmotionalTees && pChr->m_EyeEmote)
{
switch(pMsg->m_Emoticon)
@ -1144,12 +1141,12 @@ void CGameContext::OnMessage(int MsgId, CUnpacker *pUnpacker, int ClientId)
else if(MsgId == NETMSGTYPE_CL_KILL && !m_World.m_Paused)
{
if(pPlayer->m_Last_Kill && pPlayer->m_Last_Kill+Server()->TickSpeed() * g_Config.m_SvKillDelay > Server()->Tick())
if(p->m_Last_Kill && p->m_Last_Kill+Server()->TickSpeed() * g_Config.m_SvKillDelay > Server()->Tick())
return;
pPlayer->m_Last_Kill = Server()->Tick();
pPlayer->KillCharacter(WEAPON_SELF);
pPlayer->m_RespawnTick = Server()->Tick()+Server()->TickSpeed() * g_Config.m_SvSuicidePenalty;
p->m_Last_Kill = Server()->Tick();
p->KillCharacter(WEAPON_SELF);
p->m_RespawnTick = Server()->Tick()+Server()->TickSpeed() * g_Config.m_SvSuicidePenalty;
}
}
void CGameContext::ConTuneParam(IConsole::IResult *pResult, void *pUserData, int ClientId)
@ -1231,7 +1228,7 @@ void CGameContext::ConSetTeam(IConsole::IResult *pResult, void *pUserData, int C
str_format(aBuf, sizeof(aBuf), "moved client %d to team %d", Victim, Team);
pSelf->Console()->PrintResponse(IConsole::OUTPUT_LEVEL_STANDARD, "server", aBuf);
pSelf->m_apPlayers[ClientId]->SetTeam(Team);
pSelf->m_apPlayers[Victim]->SetTeam(Team);
//(void)pSelf->m_pController->CheckTeamBalance();
}
@ -1241,7 +1238,7 @@ void CGameContext::ConAddVote(IConsole::IResult *pResult, void *pUserData, int C
const char *pString = pResult->GetString(0);
// check for valid option
if(!pSelf->Console()->LineIsValid(pResult->GetString(0)))
if(!pSelf->Console()->LineIsValid(pResult->GetString(0)) && pResult->GetString(0)[0] != '#')
{
char aBuf[256];
str_format(aBuf, sizeof(aBuf), "skipped invalid option '%s'", pResult->GetString(0));
@ -1401,14 +1398,31 @@ void CGameContext::OnInit(/*class IKernel *pKernel*/)
for(int x = 0; x < pTileMap->m_Width; x++)
{
int Index = pTiles[y*pTileMap->m_Width+x].m_Index;
if(Index == TILE_NPC)
if(Index == TILE_OLDLASER)
{
g_Config.m_SvOldLaser = 1;
dbg_msg("MapTile","Old Laser");
}
else if(Index == TILE_NPC)
{
m_Tuning.Set("player_collision",0);
dbg_msg("MapTile","No Collision");
}
else if(Index == TILE_EHOOK)
{
g_Config.m_SvEndlessDrag = 1;
dbg_msg("MapTile","No Unlimited hook time");
}
else if(Index == TILE_NOHIT)
{
g_Config.m_SvHit = 0;
dbg_msg("MapTile","No Weapons Hitting others");
}
else if(Index == TILE_NPH)
{
m_Tuning.Set("player_hooking",0);
dbg_msg("MapTile","No Player Hooking");
}
if(Index >= ENTITY_OFFSET)
{
vec2 Pos(x*32.0f+16.0f, y*32.0f+16.0f);
@ -1417,7 +1431,9 @@ void CGameContext::OnInit(/*class IKernel *pKernel*/)
if(pFront)
{
Index = pFront[y*pTileMap->m_Width+x].m_Index;
if(Index == TILE_NPC)
if(Index == TILE_OLDLASER)
g_Config.m_SvOldLaser = 1;
else if(Index == TILE_NPC)
m_Tuning.Set("player_collision",0);
else if(Index == TILE_EHOOK)
g_Config.m_SvEndlessDrag = 1;
@ -1442,7 +1458,6 @@ void CGameContext::OnInit(/*class IKernel *pKernel*/)
}
}
}
m_AnnouncementLine = 0;
#ifdef CONF_DEBUG
if(g_Config.m_DbgDummies)
{

View file

@ -113,7 +113,7 @@ class CGameContext : public IGameServer
static void ConCredits(IConsole::IResult *pResult, void *pUserData, int ClientId);
static void ConInfo(IConsole::IResult *pResult, void *pUserData, int ClientId);
static void ConHelp(IConsole::IResult *pResult, void *pUserData, int ClientId);
static void ConFlags(IConsole::IResult *pResult, void *pUserData, int ClientId);
static void ConSettings(IConsole::IResult *pResult, void *pUserData, int ClientId);
static void ConRules(IConsole::IResult *pResult, void *pUserData, int ClientId);
static void ConKill(IConsole::IResult *pResult, void *pUserData, int ClientId);
static void ConTogglePause(IConsole::IResult *pResult, void *pUserData, int ClientId);
@ -132,7 +132,6 @@ class CGameContext : public IGameServer
int m_VoteEnforcer;
bool m_Resetting;
int m_AnnouncementLine;
public:
IServer *Server() const { return m_pServer; }
class IConsole *Console() { return m_pConsole; }

View file

@ -127,8 +127,6 @@ bool IGameController::OnEntity(int Index, vec2 Pos, int Layer, int Flags, int Nu
{
if (Index<0)
return false;
int temp1=Pos.x;
int temp2=Pos.y;
int Type = -1;
int SubType = 0;
@ -741,7 +739,13 @@ void IGameController::Snap(int SnappingClient)
//pGameObj->m_ScoreLimit = g_Config.m_SvScorelimit;
//pGameObj->m_TimeLimit = g_Config.m_SvTimelimit;
pGameObj->m_RoundStartTick = m_RoundStartTick;
CCharacter *pChar;
CPlayer *pPlayer;
if ((pPlayer = GameServer()->m_apPlayers[SnappingClient]))
if((pChar = pPlayer->GetCharacter()))
pGameObj->m_RoundStartTick = (pChar->m_DDRaceState == DDRACE_STARTED)?pChar->m_StartTime:Server()->Tick();
pGameObj->m_Flags = m_GameFlags;
pGameObj->m_Warmup = m_Warmup;

View file

@ -2,12 +2,6 @@
/* If you are missing that file, acquire a complete release at teeworlds.com. */
/*#include <game/mapitems.h>
=======
// copyright (c) 2007 magnus auvinen, see licence.txt for more info
/* (c) Magnus Auvinen. See licence.txt in the root of the distribution for more information. */
/* If you are missing that file, acquire a complete release at teeworlds.com. */
/*
#include <game/mapitems.h>
>>>>>>> 72e05efc53009137a398e1ec19d9e61a94bb6262
#include <game/server/entities/character.h>
#include <game/server/entities/flag.h>
#include <game/server/player.h>
@ -220,4 +214,3 @@ void CGameControllerCTF::Tick()
}
}
*/

View file

@ -188,6 +188,7 @@ CCharacter *CGameWorld::IntersectCharacter(vec2 Pos0, vec2 Pos1, float Radius, v
float Len = distance(p->m_Pos, IntersectPos);
if(Len < p->m_ProximityRadius+Radius)
{
Len = distance(Pos0, IntersectPos);
if(Len < ClosestLen)
{
NewPos = IntersectPos;

View file

@ -134,7 +134,7 @@ void CPlayer::OnDisconnect()
str_format(aBuf, sizeof(aBuf), "leave player='%d:%s'", m_ClientID, Server()->ClientName(m_ClientID));
GameServer()->Console()->Print(IConsole::OUTPUT_LEVEL_STANDARD, "game", aBuf);
if(m_Muted > 0) {
str_format(Cmd, sizeof(Cmd), "ban %d %d '%s'", m_ClientID, m_Muted/Server()->TickSpeed(), "ppc");
str_format(Cmd, sizeof(Cmd), "ban %d %d '%s'", m_ClientID, m_Muted/Server()->TickSpeed(), "Mute evasion");
GameServer()->Console()->ExecuteLine(Cmd, 3, -1);
}
}
@ -254,10 +254,12 @@ void CPlayer::LoadCharacter()
for(int i = 0; i < NUM_WEAPONS; ++i)
{
if(m_PauseInfo.m_aHasWeapon[i])
if(!m_PauseInfo.m_FreezeTime)
Character->GiveWeapon(i, -1);
else
Character->GiveWeapon(i, 0);
{
if(!m_PauseInfo.m_FreezeTime)
Character->GiveWeapon(i, -1);
else
Character->GiveWeapon(i, 0);
}
}
Character->m_FreezeTime = m_PauseInfo.m_FreezeTime;
Character->m_Doored = m_PauseInfo.m_Doored;

View file

@ -92,8 +92,6 @@ public:
bool m_IsUsingDDRaceClient;
bool m_ColorSet; // Set if player changed color at least once
int m_Starttime;
int m_Refreshtime;
int m_DDRaceState;

View file

@ -20,7 +20,6 @@ CSqlScore::CSqlScore(CGameContext *pGameServer)
m_Port(g_Config.m_SvSqlPort)
{
str_copy(m_aMap, g_Config.m_SvMap, sizeof(m_aMap));
ClearString(m_aMap);
NormalizeMapname(m_aMap);
if(gs_SqlLock == 0)
@ -59,6 +58,43 @@ bool CSqlScore::Connect()
}
catch (sql::SQLException &e)
{
char aBuf[256];
str_format(aBuf, sizeof(aBuf), "MySQL Error: %s", e.what());
dbg_msg("SQL", aBuf);
dbg_msg("SQL", "ERROR: SQL connection failed");
return false;
}
catch (const std::exception& ex) {
// ...
dbg_msg("SQL", "1 %s",ex.what());
} catch (const std::string& ex) {
// ...
dbg_msg("SQL", "2 %s",ex.c_str());
}
catch( int )
{
dbg_msg("SQL", "3 %s");
}
catch( float )
{
dbg_msg("SQL", "4 %s");
}
catch( char[] )
{
dbg_msg("SQL", "5 %s");
}
catch( char )
{
dbg_msg("SQL", "6 %s");
}
catch (...)
{
dbg_msg("SQL", "Unknown Error cause by the MySQL/C++ Connector, my advice compile server_debug and use it");
dbg_msg("SQL", "ERROR: SQL connection failed");
return false;
}
@ -88,7 +124,7 @@ void CSqlScore::Init()
{
// create tables
char aBuf[768];
str_format(aBuf, sizeof(aBuf), "CREATE TABLE IF NOT EXISTS %s_%s_race (Name VARCHAR(%d) NOT NULL, Time FLOAT DEFAULT 0, cp1 FLOAT DEFAULT 0, cp2 FLOAT DEFAULT 0, cp3 FLOAT DEFAULT 0, cp4 FLOAT DEFAULT 0, cp5 FLOAT DEFAULT 0, cp6 FLOAT DEFAULT 0, cp7 FLOAT DEFAULT 0, cp8 FLOAT DEFAULT 0, cp9 FLOAT DEFAULT 0, cp10 FLOAT DEFAULT 0, cp11 FLOAT DEFAULT 0, cp12 FLOAT DEFAULT 0, cp13 FLOAT DEFAULT 0, cp14 FLOAT DEFAULT 0, cp15 FLOAT DEFAULT 0, cp16 FLOAT DEFAULT 0, cp17 FLOAT DEFAULT 0, cp18 FLOAT DEFAULT 0, cp19 FLOAT DEFAULT 0, cp20 FLOAT DEFAULT 0, cp21 FLOAT DEFAULT 0, cp22 FLOAT DEFAULT 0, cp23 FLOAT DEFAULT 0, cp24 FLOAT DEFAULT 0, cp25 FLOAT DEFAULT 0);", m_pPrefix, m_aMap, MAX_NAME_LENGTH);
str_format(aBuf, sizeof(aBuf), "CREATE TABLE IF NOT EXISTS %s_%s_race (Name VARCHAR(%d) NOT NULL, Time FLOAT DEFAULT 0, cp1 FLOAT DEFAULT 0, cp2 FLOAT DEFAULT 0, cp3 FLOAT DEFAULT 0, cp4 FLOAT DEFAULT 0, cp5 FLOAT DEFAULT 0, cp6 FLOAT DEFAULT 0, cp7 FLOAT DEFAULT 0, cp8 FLOAT DEFAULT 0, cp9 FLOAT DEFAULT 0, cp10 FLOAT DEFAULT 0, cp11 FLOAT DEFAULT 0, cp12 FLOAT DEFAULT 0, cp13 FLOAT DEFAULT 0, cp14 FLOAT DEFAULT 0, cp15 FLOAT DEFAULT 0, cp16 FLOAT DEFAULT 0, cp17 FLOAT DEFAULT 0, cp18 FLOAT DEFAULT 0, cp19 FLOAT DEFAULT 0, cp20 FLOAT DEFAULT 0, cp21 FLOAT DEFAULT 0, cp22 FLOAT DEFAULT 0, cp23 FLOAT DEFAULT 0, cp24 FLOAT DEFAULT 0, cp25 FLOAT DEFAULT 0) CHARACTER SET utf8 ;", m_pPrefix, m_aMap, MAX_NAME_LENGTH);
m_pStatement->execute(aBuf);
dbg_msg("SQL", "Tables were created successfully");
@ -111,6 +147,9 @@ void CSqlScore::Init()
}
catch (sql::SQLException &e)
{
char aBuf[256];
str_format(aBuf, sizeof(aBuf), "MySQL Error: %s", e.what());
dbg_msg("SQL", aBuf);
dbg_msg("SQL", "ERROR: Tables were NOT created");
}
@ -161,7 +200,10 @@ void CSqlScore::LoadScoreThread(void *pUser)
delete pData->m_pSqlData->m_pResults;
}
catch (sql::SQLException &e)
{
{
char aBuf[256];
str_format(aBuf, sizeof(aBuf), "MySQL Error: %s", e.what());
dbg_msg("SQL", aBuf);
dbg_msg("SQL", "ERROR: Could not update account");
}
@ -245,6 +287,9 @@ void CSqlScore::SaveScoreThread(void *pUser)
}
catch (sql::SQLException &e)
{
char aBuf[256];
str_format(aBuf, sizeof(aBuf), "MySQL Error: %s", e.what());
dbg_msg("SQL", aBuf);
dbg_msg("SQL", "ERROR: Could not update time");
}
@ -285,40 +330,36 @@ void CSqlScore::ShowRankThread(void *pUser)
try
{
// check strings
char originalName[MAX_NAME_LENGTH];
strcpy(originalName,pData->m_aName);
pData->m_pSqlData->ClearString(pData->m_aName);
// check sort methode
char aBuf[512];
str_format(aBuf, sizeof(aBuf), "SELECT Name, Time FROM %s_%s_race ORDER BY `Time` ASC;", pData->m_pSqlData->m_pPrefix, pData->m_pSqlData->m_aMap);
pData->m_pSqlData->m_pStatement->execute("SET @rownum := 0;");
str_format(aBuf, sizeof(aBuf), "SELECT Rank, Name, Time "
"FROM ("
"SELECT @rownum := @rownum + 1 AS RANK, Name, Time FROM %s_%s_race ORDER BY Time ASC"
") as Query "
"WHERE Name = '%s';", pData->m_pSqlData->m_pPrefix, pData->m_pSqlData->m_aMap,pData->m_aName);
pData->m_pSqlData->m_pResults = pData->m_pSqlData->m_pStatement->executeQuery(aBuf);
int RowCount = 0;
bool Found = false;
while(pData->m_pSqlData->m_pResults->next())
{
RowCount++;
if(pData->m_Search)
{
if(str_find_nocase(pData->m_pSqlData->m_pResults->getString("Name").c_str(), pData->m_aName))
{
Found = true;
break;
}
}
}
if(!Found)
if(pData->m_pSqlData->m_pResults->rowsCount() != 1)
{
str_format(aBuf, sizeof(aBuf), "%s is not ranked", pData->m_aName);
str_format(aBuf, sizeof(aBuf), "%s is not ranked", originalName);
pData->m_pSqlData->GameServer()->SendChatTarget(pData->m_ClientID, aBuf);
}
else
{
float Time = (float)pData->m_pSqlData->m_pResults->getDouble("Time");
pData->m_pSqlData->m_pResults->next();
float Time = (float)pData->m_pSqlData->m_pResults->getDouble("Time");
int Rank = (float)pData->m_pSqlData->m_pResults->getInt("Rank");
if(g_Config.m_SvHideScore)
str_format(aBuf, sizeof(aBuf), "Your time: %d minute(s) %5.2f second(s)", (int)(Time/60), Time-((int)Time/60*60));
else
str_format(aBuf, sizeof(aBuf), "%d. %s Time: %d minute(s) %5.2f second(s)", RowCount, pData->m_pSqlData->m_pResults->getString("Name").c_str(), (int)(Time/60), Time-((int)Time/60*60));
str_format(aBuf, sizeof(aBuf), "%d. %s Time: %d minute(s) %5.2f second(s)", Rank, pData->m_pSqlData->m_pResults->getString("Name").c_str(), (int)(Time/60), Time-((int)Time/60*60));
if(pData->m_Search)
strcat(aBuf, pData->m_aRequestingPlayer);
@ -334,6 +375,9 @@ void CSqlScore::ShowRankThread(void *pUser)
}
catch (sql::SQLException &e)
{
char aBuf[256];
str_format(aBuf, sizeof(aBuf), "MySQL Error: %s", e.what());
dbg_msg("SQL", aBuf);
dbg_msg("SQL", "ERROR: Could not show rank");
}
@ -399,6 +443,9 @@ void CSqlScore::ShowTop5Thread(void *pUser)
}
catch (sql::SQLException &e)
{
char aBuf[256];
str_format(aBuf, sizeof(aBuf), "MySQL Error: %s", e.what());
dbg_msg("SQL", aBuf);
dbg_msg("SQL", "ERROR: Could not show top5");
}
@ -425,47 +472,30 @@ void CSqlScore::ShowTop5(int ClientID, int Debut)
}
// anti SQL injection
void CSqlScore::ClearString(char *pString)
{
// replace ' ' ' with ' \' ' and remove '\'
for(int i = 0; i < str_length(pString); i++)
{
// replace '-' with '_'
if(pString[i] == '-')
pString[i] = '_';
if(pString[i] == '\'')
{
// count \ before the '
int SlashCount = 0;
for(int j = i-1; j >= 0; j--)
{
if(pString[i] != '\\')
break;
SlashCount++;
}
if(SlashCount % 2 == 0)
{
for(int j = str_length(pString)-1; j > i; j--)
{
pString[j] = pString[j-1];
}
pString[i] = '\\';
i++;
}
{
char newString[MAX_NAME_LENGTH*2-1];
int pos = 0;
for(int i=0;i<str_length(pString);i++) {
if(pString[i] == '\\') {
newString[pos++] = '\\';
newString[pos++] = '\\';
} else if(pString[i] == '\'') {
newString[pos++] = '\\';
newString[pos++] = '\'';
} else if(pString[i] == '"') {
newString[pos++] = '\\';
newString[pos++] = '"';
} else {
newString[pos++] = pString[i];
}
}
// aaand remove spaces and \ at the end xD
for(int i = str_length(pString)-1; i >= 0; i--)
{
if(pString[i] == ' ' || pString[i] == '\\')
pString[i] = '\0';
else
break;
}
newString[pos] = '\0';
strcpy(pString,newString);
}
void CSqlScore::NormalizeMapname(char *pString) {

View file

@ -1,5 +1,4 @@
/* CSqlScore Class by Sushi Tee*/
#if defined(CONF_SQL)
#ifndef GAME_SERVER_SQLSCORE_H
#define GAME_SERVER_SQLSCORE_H
@ -64,7 +63,12 @@ struct CSqlScoreData
{
CSqlScore *m_pSqlData;
int m_ClientID;
char m_aName[MAX_NAME_LENGTH];
#if defined(CONF_FAMILY_WINDOWS)
char m_aName[47];
#else
char m_aName[MAX_NAME_LENGTH*2-1];
#endif
float m_Time;
float m_aCpCurrent[NUM_CHECKPOINTS];
int m_Num;
@ -73,4 +77,3 @@ struct CSqlScoreData
};
#endif
#endif

View file

@ -7,7 +7,7 @@
// client
MACRO_CONFIG_INT(ClPredict, cl_predict, 1, 0, 1, CFGFLAG_CLIENT|CFGFLAG_SAVE, "Predict client movements", -1)
MACRO_CONFIG_INT(ClNameplates, cl_nameplates, 0, 0, 1, CFGFLAG_CLIENT|CFGFLAG_SAVE, "Show nameplates", -1)
MACRO_CONFIG_INT(ClNameplates, cl_nameplates, 1, 0, 1, CFGFLAG_CLIENT|CFGFLAG_SAVE, "Show nameplates", -1)
MACRO_CONFIG_INT(ClNameplatesAlways, cl_nameplates_always, 0, 0, 1, CFGFLAG_CLIENT|CFGFLAG_SAVE, "Always show nameplats disregarding of distance", -1)
MACRO_CONFIG_INT(ClAutoswitchWeapons, cl_autoswitch_weapons, 0, 0, 1, CFGFLAG_CLIENT|CFGFLAG_SAVE, "Auto switch weapon on pickup", -1)
@ -63,7 +63,7 @@ MACRO_CONFIG_INT(SvScorelimit, sv_scorelimit, 20, 0, 1000, CFGFLAG_SERVER, "Scor
MACRO_CONFIG_INT(SvTimelimit, sv_timelimit, 0, 0, 1000, CFGFLAG_SERVER, "Time limit in minutes (0 disables)")
MACRO_CONFIG_STR(SvGametype, sv_gametype, 32, "dm", CFGFLAG_SERVER, "Game type (dm, tdm, ctf)")*/
MACRO_CONFIG_INT(SvTournamentMode, sv_tournament_mode, 0, 0, 1, CFGFLAG_SERVER, "Tournament mode. When enabled, players joins the server as spectator", 3)
//MACRO_CONFIG_INT(SvSpamprotection, sv_spamprotection, 1, 0, 1, CFGFLAG_SERVER, "Spam protection")
MACRO_CONFIG_INT(SvSpamprotection, sv_spamprotection, 1, 0, 1, CFGFLAG_SERVER, "Spam protection",3)
MACRO_CONFIG_INT(SvSpectatorSlots, sv_spectator_slots, 0, 0, MAX_CLIENTS, CFGFLAG_SERVER, "Number of slots to reserve for spectators", 3)
//MACRO_CONFIG_INT(SvTeambalanceTime, sv_teambalance_time, 1, 0, 1000, CFGFLAG_SERVER, "How many minutes to wait before autobalancing teams")

Some files were not shown because too many files have changed in this diff Show more