Cleaned up & Re-arranged stuff

This commit is contained in:
GreYFoXGTi 2011-01-06 05:46:10 +02:00
parent 1719ad554e
commit ddc5dd7ab3
55 changed files with 873 additions and 837 deletions

7
.gitignore vendored
View file

@ -1,9 +1,10 @@
.bam .bam
.settings
src/game/generated src/game/generated
objs objs
datasrc/*.pyc datasrc/*.pyc
config.lua config.lua
teeworlds_d
teeworlds_srv_d
Debug Debug
teeworlds_d* teeworlds_d*
teeworlds_srv_d* teeworlds_srv_d*
@ -14,8 +15,6 @@ autoexec.cfg
teeworlds teeworlds
bam.exe bam.exe
*.bat *.bat
teeworlds_d
teeworlds_srv_d
DDRace_Trunk* DDRace_Trunk*
DDRace_Trunk_d* DDRace_Trunk_d*
.cproject .cproject
@ -36,3 +35,5 @@ DDRace_Trunk_d*
*.filters *.filters
*.user *.user
*.cmd *.cmd
.settings

View file

@ -136,7 +136,7 @@ function build(settings)
settings.cc.flags:Add("/wd4244") settings.cc.flags:Add("/wd4244")
settings.cc.flags:Add("/EHsc") settings.cc.flags:Add("/EHsc")
else else
settings.cc.flags:Add("-Wall") settings.cc.flags:Add("-Wall", "-fno-exceptions")
if platform == "macosx" then if platform == "macosx" then
settings.cc.flags:Add("-mmacosx-version-min=10.5", "-isysroot /Developer/SDKs/MacOSX10.5.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") settings.link.flags:Add("-mmacosx-version-min=10.5", "-isysroot /Developer/SDKs/MacOSX10.5.sdk")
@ -428,3 +428,4 @@ else
build(release_nosql_settings) build(release_nosql_settings)
DefaultTarget("game_debug") DefaultTarget("game_debug")
end end

View file

@ -239,7 +239,7 @@ Lht.
== Svjetl. == Svjetl.
Loading Loading
== Učitavam DDRace == Učitavam
MOTD MOTD
== Vijest dana == Vijest dana
@ -965,3 +965,8 @@ no limit
##### old translations ##### ##### old translations #####
##### DDRace #####
Loading DDRace Client
== Učitavam DDRace

View file

@ -190,8 +190,8 @@ Language
Lht. Lht.
== Světel. == Světel.
Loading DDRace Client Loading
== Nahrávám DDRace Client == Nahrávám
MOTD MOTD
== MOTD == MOTD
@ -965,3 +965,8 @@ no limit
##### old translations ##### ##### old translations #####
##### DDRace #####
Loading DDRace Client
== Nahrávám DDRace

View file

@ -1,4 +1,4 @@

##### translated strings ##### ##### translated strings #####
%d of %d servers, %d players %d of %d servers, %d players
@ -442,7 +442,6 @@ Load map
Loading Loading
== Laden == Laden
MOTD MOTD
== MOTD == MOTD
@ -966,9 +965,7 @@ Name plates size
##### old translations ##### ##### old translations #####
##### DDRace ##### ##### DDRace #####
Loading DDRace Client Loading DDRace Client
== Laden DDRace Client == Laden DDRace

View file

@ -206,7 +206,7 @@ Lht.
== Valoisuus == Valoisuus
Loading Loading
== Ladataan DDRace == Ladataan
MOTD MOTD
== Palvelimen viesti == Palvelimen viesti
@ -965,3 +965,8 @@ no limit
##### old translations ##### ##### old translations #####
##### DDRace #####
Loading DDRace Client
== Ladataan DDRace

View file

@ -373,8 +373,6 @@ Load map
Loading Loading
== Chargement == Chargement
MOTD MOTD
== MOTD == MOTD
@ -974,5 +972,5 @@ Y-axis of the envelope
##### DDRace ##### ##### DDRace #####
Loading DDRace Client Loading DDRace Client
== Chargement DDRace Client == Chargement DDRace

View file

@ -965,6 +965,8 @@ Name plates size
##### old translations ##### ##### old translations #####
Loading DDRace Client ##### DDRace #####
== Lade DDRace Client
Loading DDRace Client
== Lade DDRace

View file

@ -187,8 +187,8 @@ Language
Lht. Lht.
== Lum. == Lum.
Loading DDRace Client Loading
== Caricamento DDRace Client == Caricamento
MOTD MOTD
== MDG == MDG
@ -965,3 +965,8 @@ no limit
##### old translations ##### ##### old translations #####
##### DDRace #####
Loading DDRace Client
== Caricamento DDRace

View file

@ -1,4 +1,4 @@

##### translated strings ##### ##### translated strings #####
%d of %d servers, %d players %d of %d servers, %d players
@ -965,3 +965,7 @@ no limit
##### old translations ##### ##### old translations #####
##### DDRace #####
Loading DDRace Client
== Ładowanie DDRace

View file

@ -1,4 +1,4 @@

##### translated strings ##### ##### translated strings #####
%d of %d servers, %d players %d of %d servers, %d players
@ -202,8 +202,8 @@ Language
Lht. Lht.
== Luz == Luz
Loading DDRace Client Loading
== Carregando DDRace Client == Carregando
MOTD MOTD
== MOTD == MOTD
@ -965,3 +965,7 @@ no limit
##### old translations ##### ##### old translations #####
##### DDRace #####
Loading DDRace Client
== Carregando DDRace

View file

@ -963,8 +963,6 @@ Y-axis of the envelope
no limit no limit
== ==
==
##### old translations ##### ##### old translations #####
##### DDRace ##### ##### DDRace #####

View file

@ -206,7 +206,7 @@ Lht.
== Svetl. == Svetl.
Loading Loading
== Učitavam DDRace == Učitavam
MOTD MOTD
== Vest dana == Vest dana
@ -965,3 +965,8 @@ no limit
##### old translations ##### ##### old translations #####
##### DDRace #####
Loading DDRace Client
== Učitavam DDRace

View file

@ -187,8 +187,8 @@ Language
Lht. Lht.
== Ljusstyrka == Ljusstyrka
Loading DDRace Client Loading
== Laddar DDRace Client == Laddar
MOTD MOTD
== Meddelande == Meddelande
@ -965,3 +965,8 @@ no limit
##### old translations ##### ##### old translations #####
##### DDRace #####
Loading DDRace Client
== Laddar DDRace

View file

@ -1,4 +1,4 @@

##### translated strings ##### ##### translated strings #####
%d of %d servers, %d players %d of %d servers, %d players
@ -965,3 +965,7 @@ no limit
##### old translations ##### ##### old translations #####
##### DDRace #####
Loading DDRace Client
== Завантиження DDRace

View file

@ -310,7 +310,6 @@ class NetIntAny(NetVariable):
def emit_pack(self): def emit_pack(self):
return ["pPacker->AddInt(%s);" % self.name] return ["pPacker->AddInt(%s);" % self.name]
class NetIntRange(NetIntAny): class NetIntRange(NetIntAny):
def __init__(self, name, min, max): def __init__(self, name, min, max):
NetIntAny.__init__(self,name) NetIntAny.__init__(self,name)

View file

@ -2,6 +2,9 @@ This is a mod (DDRace) and it's for the game Teeworlds and it's being maintained
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. 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.
Please visit http://www.DDRace.info for up-to-date information about
DDRace, including new versions, custom maps and much more.
Teeworlds README is as follows: Teeworlds README is as follows:
Copyright (c) 2011 Magnus Auvinen Copyright (c) 2011 Magnus Auvinen
@ -12,4 +15,4 @@ arising from the use of this software.
Please visit http://www.teeworlds.com for up-to-date information about Please visit http://www.teeworlds.com for up-to-date information about
the game, including new versions, custom maps and much more the game, including new versions, custom maps and much more.

View file

@ -1084,7 +1084,7 @@ void CClient::ProcessPacket(CNetChunk *pPacket)
if(Info.m_NumPlayers < 0 || Info.m_NumPlayers > MAX_CLIENTS || Info.m_MaxPlayers < 0 || Info.m_MaxPlayers > MAX_CLIENTS) if(Info.m_NumPlayers < 0 || Info.m_NumPlayers > MAX_CLIENTS || Info.m_MaxPlayers < 0 || Info.m_MaxPlayers > MAX_CLIENTS)
return; return;
if((Info.m_Flags | SERVER_FLAGS_VERSION) != SERVER_FLAG_VERSION || !str_find_nocase(Info.m_aGameType, "ddrace")) if((Info.m_Flags | SERVER_FLAGS_VERSION) != SERVER_FLAG_VERSION || !str_find_nocase(Info.m_aGameType, "DDRace"))
Info.m_Flags &= SERVER_FLAGS_DEFAULT; Info.m_Flags &= SERVER_FLAGS_DEFAULT;
else else
Info.m_Flags &= SERVER_FLAGS_ALL; Info.m_Flags &= SERVER_FLAGS_ALL;

View file

@ -203,9 +203,10 @@ int CServer::TrySetClientName(int ClientID, const char *pName)
// trim the name // trim the name
str_copy(aTrimmedName, StrLtrim(pName), sizeof(aTrimmedName)); str_copy(aTrimmedName, StrLtrim(pName), sizeof(aTrimmedName));
StrRtrim(aTrimmedName); StrRtrim(aTrimmedName);
/*char aBuf[256]; //TODO: See if this still needs commenting
char aBuf[256];
str_format(aBuf, sizeof(aBuf), "'%s' -> '%s'", pName, aTrimmedName); str_format(aBuf, sizeof(aBuf), "'%s' -> '%s'", pName, aTrimmedName);
Console()->Print(IConsole::OUTPUT_LEVEL_ADDINFO, "server", aBuf);*/ Console()->Print(IConsole::OUTPUT_LEVEL_ADDINFO, "server", aBuf);
pName = aTrimmedName; pName = aTrimmedName;
@ -1565,8 +1566,6 @@ void CServer::ConCmdList(IConsole::IResult *pResult, void *pUserData, int Client
pSelf->Console()->List(pResult->GetInteger(0), CFGFLAG_SERVER); pSelf->Console()->List(pResult->GetInteger(0), CFGFLAG_SERVER);
} }
void CServer::ConchainSpecialInfoupdate(IConsole::IResult *pResult, void *pUserData, IConsole::FCommandCallback pfnCallback, void *pCallbackUserData) void CServer::ConchainSpecialInfoupdate(IConsole::IResult *pResult, void *pUserData, IConsole::FCommandCallback pfnCallback, void *pCallbackUserData)
{ {
pfnCallback(pResult, pCallbackUserData, -1); pfnCallback(pResult, pCallbackUserData, -1);
@ -1832,7 +1831,7 @@ void CServer::CheckPass(int ClientId, const char *pPw)
else else
{ {
NETADDR Addr = m_NetServer.ClientAddr(ClientId); NETADDR Addr = m_NetServer.ClientAddr(ClientId);
BanAdd(Addr, g_Config.m_SvRconBantime, "Too many remote console authentication tries"); BanAdd(Addr, g_Config.m_SvRconBantime*60, "Too many remote console authentication tries");
} }
} }
} }
@ -1901,3 +1900,4 @@ NETADDR CServer::GetClientIP(int ClientID)//this may exist already but i couldn'
{ {
return m_NetServer.ClientAddr(ClientID); return m_NetServer.ClientAddr(ClientID);
} }

View file

@ -19,7 +19,7 @@ class CSnapIDPool
{ {
enum enum
{ {
MAX_IDS = 32*1024, MAX_IDS = 16*1024,//TODO
}; };
class CID class CID
@ -175,6 +175,7 @@ public:
void SendMap(int ClientId); void SendMap(int ClientId);
void SendRconLine(int ClientId, const char *pLine); void SendRconLine(int ClientId, const char *pLine);
static void SendRconLineAuthed(const char *pLine, void *pUser); static void SendRconLineAuthed(const char *pLine, void *pUser);
static void SendRconResponse(const char *pLine, void *pUser); static void SendRconResponse(const char *pLine, void *pUser);
struct RconResponseInfo struct RconResponseInfo
@ -212,6 +213,7 @@ public:
static void ConMapReload(IConsole::IResult *pResult, void *pUser, int ClientId); static void ConMapReload(IConsole::IResult *pResult, void *pUser, int ClientId);
static void ConchainSpecialInfoupdate(IConsole::IResult *pResult, void *pUserData, IConsole::FCommandCallback pfnCallback, void *pCallbackUserData); static void ConchainSpecialInfoupdate(IConsole::IResult *pResult, void *pUserData, IConsole::FCommandCallback pfnCallback, void *pCallbackUserData);
static void ConchainMaxclientsperipUpdate(IConsole::IResult *pResult, void *pUserData, IConsole::FCommandCallback pfnCallback, void *pCallbackUserData); static void ConchainMaxclientsperipUpdate(IConsole::IResult *pResult, void *pUserData, IConsole::FCommandCallback pfnCallback, void *pCallbackUserData);
static void ConLogin(IConsole::IResult *pResult, void *pUser, int ClientId); static void ConLogin(IConsole::IResult *pResult, void *pUser, int ClientId);
static void ConCmdList(IConsole::IResult *pResult, void *pUser, int ClientId); static void ConCmdList(IConsole::IResult *pResult, void *pUser, int ClientId);

View file

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

View file

@ -14,21 +14,18 @@ struct CConfiguration
extern CConfiguration g_Config; extern CConfiguration g_Config;
void dbg_msg1(const char * where, const char * format, ...); void dbg_msg1(const char * where, const char * format, ...);
enum enum
{ {
CFGFLAG_SAVE=1, CFGFLAG_SAVE=1,
CFGFLAG_CLIENT=2, CFGFLAG_CLIENT=2,
CFGFLAG_SERVER=4, CFGFLAG_SERVER=4,
CFGFLAG_STORE=8, CFGFLAG_STORE=8,
//DDRace
CMDFLAG_CHEAT=16, CMDFLAG_CHEAT=16,
CMDFLAG_TIMER=32, CMDFLAG_TIMER=32,
CMDFLAG_HELPERCMD=64, CMDFLAG_HELPERCMD=64
}; };
#endif #endif

View file

@ -14,18 +14,16 @@ 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_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(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(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(ClEditor, cl_editor, 0, 0, 1, CFGFLAG_CLIENT, "", -1)
MACRO_CONFIG_INT(ClAutoDemoRecord, cl_auto_demo_record, 0, 0, 1, CFGFLAG_SAVE|CFGFLAG_CLIENT, "Automatically record demos", -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(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(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(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) MACRO_CONFIG_INT(ClEventthread, cl_eventthread, 0, 0, 1, CFGFLAG_CLIENT, "Enables the usage of a thread to pump the events", -1)
MACRO_CONFIG_INT(ClShowIds, cl_show_ids, 0, 0, 1, CFGFLAG_SAVE|CFGFLAG_CLIENT, "Whether to show client ids in scoreboard", -1)
MACRO_CONFIG_INT(InpGrab, inp_grab, 0, 0, 1, CFGFLAG_SAVE|CFGFLAG_CLIENT, "Use forceful input grabbing method", -1) MACRO_CONFIG_INT(InpGrab, inp_grab, 0, 0, 1, CFGFLAG_SAVE|CFGFLAG_CLIENT, "Use forceful input grabbing method", -1)
MACRO_CONFIG_STR(BrFilterString, br_filter_string, 25, "", CFGFLAG_SAVE|CFGFLAG_CLIENT, "Server browser filtering string", -1) MACRO_CONFIG_STR(BrFilterString, br_filter_string, 25, "", CFGFLAG_SAVE|CFGFLAG_CLIENT, "Server browser filtering string", -1)
@ -34,7 +32,6 @@ MACRO_CONFIG_INT(BrFilterFull, br_filter_full, 0, 0, 1, CFGFLAG_SAVE|CFGFLAG_CLI
MACRO_CONFIG_INT(BrFilterEmpty, br_filter_empty, 0, 0, 1, CFGFLAG_SAVE|CFGFLAG_CLIENT, "Filter out empty server in browser", -1) MACRO_CONFIG_INT(BrFilterEmpty, br_filter_empty, 0, 0, 1, CFGFLAG_SAVE|CFGFLAG_CLIENT, "Filter out empty server in browser", -1)
MACRO_CONFIG_INT(BrFilterPw, br_filter_pw, 0, 0, 1, CFGFLAG_SAVE|CFGFLAG_CLIENT, "Filter out password protected servers in browser", -1) MACRO_CONFIG_INT(BrFilterPw, br_filter_pw, 0, 0, 1, CFGFLAG_SAVE|CFGFLAG_CLIENT, "Filter out password protected servers in browser", -1)
MACRO_CONFIG_INT(BrFilterPing, br_filter_ping, 999, 0, 999, CFGFLAG_SAVE|CFGFLAG_CLIENT, "Ping to filter by in the server browser", -1) MACRO_CONFIG_INT(BrFilterPing, br_filter_ping, 999, 0, 999, CFGFLAG_SAVE|CFGFLAG_CLIENT, "Ping to filter by in the server browser", -1)
MACRO_CONFIG_INT(BrFilterGametypeStrict, br_filter_gametype_strict, 0, 0, 1, CFGFLAG_SAVE|CFGFLAG_CLIENT, "Filter gametype strict", -1)
MACRO_CONFIG_STR(BrFilterGametype, br_filter_gametype, 128, "", CFGFLAG_SAVE|CFGFLAG_CLIENT, "Game types to filter", -1) MACRO_CONFIG_STR(BrFilterGametype, br_filter_gametype, 128, "", CFGFLAG_SAVE|CFGFLAG_CLIENT, "Game types to filter", -1)
MACRO_CONFIG_INT(BrFilterPure, br_filter_pure, 1, 0, 1, CFGFLAG_SAVE|CFGFLAG_CLIENT, "Filter out non-standard servers in browser", -1) MACRO_CONFIG_INT(BrFilterPure, br_filter_pure, 1, 0, 1, CFGFLAG_SAVE|CFGFLAG_CLIENT, "Filter out non-standard servers in browser", -1)
MACRO_CONFIG_INT(BrFilterPureMap, br_filter_pure_map, 1, 0, 1, CFGFLAG_SAVE|CFGFLAG_CLIENT, "Filter out non-standard maps in browser", -1) MACRO_CONFIG_INT(BrFilterPureMap, br_filter_pure_map, 1, 0, 1, CFGFLAG_SAVE|CFGFLAG_CLIENT, "Filter out non-standard maps in browser", -1)
@ -78,9 +75,9 @@ MACRO_CONFIG_INT(SvMaxClients, sv_max_clients, 16, 1, MAX_CLIENTS, CFGFLAG_SERVE
MACRO_CONFIG_INT(SvMaxClientsPerIP, sv_max_clients_per_ip, 2, 1, MAX_CLIENTS, CFGFLAG_SERVER, "Maximum number of clients with the same IP that can connect to the server", 3) MACRO_CONFIG_INT(SvMaxClientsPerIP, sv_max_clients_per_ip, 2, 1, MAX_CLIENTS, CFGFLAG_SERVER, "Maximum number of clients with the same IP that can connect to the server", 3)
MACRO_CONFIG_INT(SvHighBandwidth, sv_high_bandwidth, 0, 0, 1, CFGFLAG_SERVER, "Use high bandwidth mode. Doubles the bandwidth required for the server. LAN use only", 3) MACRO_CONFIG_INT(SvHighBandwidth, sv_high_bandwidth, 0, 0, 1, CFGFLAG_SERVER, "Use high bandwidth mode. Doubles the bandwidth required for the server. LAN use only", 3)
MACRO_CONFIG_INT(SvRegister, sv_register, 1, 0, 1, CFGFLAG_SERVER, "Register server with master server for public listing", 3) MACRO_CONFIG_INT(SvRegister, sv_register, 1, 0, 1, CFGFLAG_SERVER, "Register server with master server for public listing", 3)
/*MACRO_CONFIG_STR(SvRconPassword, sv_rcon_password, 32, "", CFGFLAG_SERVER, "Remote console password")*/ //MACRO_CONFIG_STR(SvRconPassword, sv_rcon_password, 32, "", CFGFLAG_SERVER, "Remote console password")
MACRO_CONFIG_INT(SvRconMaxTries, sv_rcon_max_tries, 3, 0, 100, CFGFLAG_SERVER, "Maximum number of tries for remote console authentication", 3) MACRO_CONFIG_INT(SvRconMaxTries, sv_rcon_max_tries, 20, 0, 100, CFGFLAG_SERVER, "Maximum number of tries for remote console authentication", 3)
MACRO_CONFIG_INT(SvRconBantime, sv_rcon_bantime, 300, 0, 9999, CFGFLAG_SERVER, "The time a client gets banned if remote console authentication fails. 0 makes it just use kick", 3) MACRO_CONFIG_INT(SvRconBantime, sv_rcon_bantime, 5, 0, 1440, CFGFLAG_SERVER, "The time a client gets banned if remote console authentication fails. 0 makes it just use kick", 3)
MACRO_CONFIG_INT(Debug, debug, 0, 0, 1, CFGFLAG_CLIENT|CFGFLAG_SERVER, "Debug mode", 3) MACRO_CONFIG_INT(Debug, debug, 0, 0, 1, CFGFLAG_CLIENT|CFGFLAG_SERVER, "Debug mode", 3)
MACRO_CONFIG_INT(DbgStress, dbg_stress, 0, 0, 0, CFGFLAG_CLIENT|CFGFLAG_SERVER, "Stress systems", 3) MACRO_CONFIG_INT(DbgStress, dbg_stress, 0, 0, 0, CFGFLAG_CLIENT|CFGFLAG_SERVER, "Stress systems", 3)
@ -178,4 +175,6 @@ MACRO_CONFIG_INT(SvSlashMe, sv_slash_me, 0, 0, 1, CFGFLAG_SERVER, "Whether /me i
MACRO_CONFIG_INT(ConnTimeout, conn_timeout, 15, 5, 100, CFGFLAG_CLIENT|CFGFLAG_SERVER, "Network timeout", 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", 3) MACRO_CONFIG_INT(DbgMsg, dbg_msg, 0, 0, 1, CFGFLAG_CLIENT|CFGFLAG_SERVER, "Display or not debug messages", 3)
MACRO_CONFIG_INT(ClShowIds, cl_show_ids, 0, 0, 1, CFGFLAG_SAVE|CFGFLAG_CLIENT, "Whether to show client ids in scoreboard", -1)
MACRO_CONFIG_INT(BrFilterGametypeStrict, br_filter_gametype_strict, 0, 0, 1, CFGFLAG_SAVE|CFGFLAG_CLIENT, "Filter gametype strict", -1)
#endif #endif

View file

@ -61,7 +61,6 @@ void CConsole::CResult::SetVictim(const char *pVictim)
m_Victim = clamp<int>(str_toint(pVictim), 0, MAX_CLIENTS - 1); m_Victim = clamp<int>(str_toint(pVictim), 0, MAX_CLIENTS - 1);
} }
// the maximum number of tokens occurs in a string of length CONSOLE_MAX_STR_LENGTH with tokens size 1 separated by single spaces // the maximum number of tokens occurs in a string of length CONSOLE_MAX_STR_LENGTH with tokens size 1 separated by single spaces
@ -197,50 +196,6 @@ void CConsole::RegisterPrintCallback(FPrintCallback pfnPrintCallback, void *pUse
m_pPrintCallbackUserdata = pUserData; m_pPrintCallbackUserdata = pUserData;
} }
void CConsole::RegisterAlternativePrintCallback(FPrintCallback pfnAlternativePrintCallback, void *pAlternativeUserData)
{
while (m_pfnAlternativePrintCallback != pfnAlternativePrintCallback && m_PrintUsed)
; // wait for other threads to finish their commands, TODO: implement this with LOCK
m_pfnAlternativePrintCallback = pfnAlternativePrintCallback;
m_pAlternativePrintCallbackUserdata = pAlternativeUserData;
m_PrintUsed++;
}
void CConsole::ReleaseAlternativePrintCallback()
{
m_PrintUsed--;
}
void CConsole::RegisterClientOnlineCallback(FClientOnlineCallback pfnCallback, void *pUserData)
{
m_pfnClientOnlineCallback = pfnCallback;
m_pClientOnlineUserdata = pUserData;
}
void CConsole::RegisterCompareClientsCallback(FCompareClientsCallback pfnCallback, void *pUserData)
{
m_pfnCompareClientsCallback = pfnCallback;
m_pCompareClientsUserdata = pUserData;
}
bool CConsole::ClientOnline(int ClientId)
{
if(!m_pfnClientOnlineCallback)
return true;
return m_pfnClientOnlineCallback(ClientId, m_pClientOnlineUserdata);
}
bool CConsole::CompareClients(int ClientId, int Victim)
{
if(!m_pfnCompareClientsCallback)
return true;
return m_pfnCompareClientsCallback(ClientId, Victim, m_pCompareClientsUserdata);
}
void CConsole::Print(int Level, const char *pFrom, const char *pStr) void CConsole::Print(int Level, const char *pFrom, const char *pStr)
{ {
dbg_msg(pFrom ,"%s", pStr); dbg_msg(pFrom ,"%s", pStr);
@ -304,46 +259,8 @@ bool CConsole::LineIsValid(const char *pStr)
return true; return true;
} }
void CConsole::RegisterPrintResponseCallback(FPrintCallback pfnPrintResponseCallback, void *pUserData)
{
m_pfnPrintResponseCallback = pfnPrintResponseCallback;
m_pPrintResponseCallbackUserdata = pUserData;
}
void CConsole::RegisterAlternativePrintResponseCallback(FPrintCallback pfnAlternativePrintResponseCallback, void *pAlternativeUserData) void CConsole::ExecuteLineStroked(int Stroke, const char *pStr, const int ClientLevel, const int ClientId, FPrintCallback pfnAlternativePrintCallback, void *pUserData, FPrintCallback pfnAlternativePrintResponseCallback, void *pResponseUserData)
{
while (m_pfnAlternativePrintResponseCallback != pfnAlternativePrintResponseCallback && m_PrintResponseUsed)
; // wait for other threads to finish their commands, TODO: implement this with LOCK
m_pfnAlternativePrintResponseCallback = pfnAlternativePrintResponseCallback;
m_pAlternativePrintResponseCallbackUserdata = pAlternativeUserData;
m_PrintResponseUsed++;
}
void CConsole::ReleaseAlternativePrintResponseCallback()
{
m_PrintResponseUsed--;
}
void CConsole::PrintResponse(int Level, const char *pFrom, const char *pStr)
{
dbg_msg(pFrom ,"%s", pStr);
if (Level <= g_Config.m_ConsoleOutputLevel && m_pfnPrintResponseCallback)
{
char aBuf[1024];
str_format(aBuf, sizeof(aBuf), "[%s]: %s", pFrom, pStr);
if (!m_pfnAlternativePrintResponseCallback || m_PrintResponseUsed == 0)
m_pfnPrintResponseCallback(aBuf, m_pPrintResponseCallbackUserdata);
else
m_pfnAlternativePrintResponseCallback(aBuf, m_pAlternativePrintResponseCallbackUserdata);
}
}
void CConsole::ExecuteLineStroked(int Stroke, const char *pStr, const int ClientLevel, const int ClientId,
FPrintCallback pfnAlternativePrintCallback, void *pUserData,
FPrintCallback pfnAlternativePrintResponseCallback, void *pResponseUserData)
{ {
while(pStr && *pStr) while(pStr && *pStr)
{ {
@ -802,63 +719,12 @@ void CConsole::Register(const char *pName, const char *pParams,
pCommand->m_Flags = Flags; pCommand->m_Flags = Flags;
pCommand->m_Level = Level; pCommand->m_Level = Level;
pCommand->m_pNext = m_pFirstCommand; pCommand->m_pNext = m_pFirstCommand;
m_pFirstCommand = pCommand; m_pFirstCommand = pCommand;
m_aCommandCount[pCommand->m_Level]++; m_aCommandCount[pCommand->m_Level]++;
} }
void CConsole::List(const int Level, int Flags)
{
switch(Level)
{
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(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(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) void CConsole::Con_Chain(IResult *pResult, void *pUserData, int ClientId)
{ {
CChain *pInfo = (CChain *)pUserData; CChain *pInfo = (CChain *)pUserData;
@ -911,3 +777,136 @@ IConsole::CCommandInfo *CConsole::GetCommandInfo(const char *pName, int FlagMask
extern IConsole *CreateConsole(int FlagMask) { return new CConsole(FlagMask); } extern IConsole *CreateConsole(int FlagMask) { return new CConsole(FlagMask); }
void CConsole::RegisterAlternativePrintCallback(FPrintCallback pfnAlternativePrintCallback, void *pAlternativeUserData)
{
while (m_pfnAlternativePrintCallback != pfnAlternativePrintCallback && m_PrintUsed)
; // wait for other threads to finish their commands, TODO: implement this with LOCK
m_pfnAlternativePrintCallback = pfnAlternativePrintCallback;
m_pAlternativePrintCallbackUserdata = pAlternativeUserData;
m_PrintUsed++;
}
void CConsole::ReleaseAlternativePrintCallback()
{
m_PrintUsed--;
}
void CConsole::RegisterClientOnlineCallback(FClientOnlineCallback pfnCallback, void *pUserData)
{
m_pfnClientOnlineCallback = pfnCallback;
m_pClientOnlineUserdata = pUserData;
}
void CConsole::RegisterCompareClientsCallback(FCompareClientsCallback pfnCallback, void *pUserData)
{
m_pfnCompareClientsCallback = pfnCallback;
m_pCompareClientsUserdata = pUserData;
}
bool CConsole::ClientOnline(int ClientId)
{
if(!m_pfnClientOnlineCallback)
return true;
return m_pfnClientOnlineCallback(ClientId, m_pClientOnlineUserdata);
}
bool CConsole::CompareClients(int ClientId, int Victim)
{
if(!m_pfnCompareClientsCallback)
return true;
return m_pfnCompareClientsCallback(ClientId, Victim, m_pCompareClientsUserdata);
}
void CConsole::RegisterPrintResponseCallback(FPrintCallback pfnPrintResponseCallback, void *pUserData)
{
m_pfnPrintResponseCallback = pfnPrintResponseCallback;
m_pPrintResponseCallbackUserdata = pUserData;
}
void CConsole::RegisterAlternativePrintResponseCallback(FPrintCallback pfnAlternativePrintResponseCallback, void *pAlternativeUserData)
{
while (m_pfnAlternativePrintResponseCallback != pfnAlternativePrintResponseCallback && m_PrintResponseUsed)
; // wait for other threads to finish their commands, TODO: implement this with LOCK
m_pfnAlternativePrintResponseCallback = pfnAlternativePrintResponseCallback;
m_pAlternativePrintResponseCallbackUserdata = pAlternativeUserData;
m_PrintResponseUsed++;
}
void CConsole::ReleaseAlternativePrintResponseCallback()
{
m_PrintResponseUsed--;
}
void CConsole::PrintResponse(int Level, const char *pFrom, const char *pStr)
{
dbg_msg(pFrom ,"%s", pStr);
if (Level <= g_Config.m_ConsoleOutputLevel && m_pfnPrintResponseCallback)
{
char aBuf[1024];
str_format(aBuf, sizeof(aBuf), "[%s]: %s", pFrom, pStr);
if (!m_pfnAlternativePrintResponseCallback || m_PrintResponseUsed == 0)
m_pfnPrintResponseCallback(aBuf, m_pPrintResponseCallbackUserdata);
else
m_pfnAlternativePrintResponseCallback(aBuf, m_pAlternativePrintResponseCallbackUserdata);
}
}
void CConsole::List(const int Level, int Flags)
{
switch(Level)
{
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(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(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;
}
}

View file

@ -71,6 +71,7 @@ enum
enum enum
{ {
SERVER_TICK_SPEED=50, SERVER_TICK_SPEED=50,
//SERVER_FLAG_PASSWORD = 0x1,
SERVER_FLAG_PASSWORD = 0x1, // A SERVER_FLAG_PASSWORD = 0x1, // A
SERVER_FLAG_TEAMS = 0x100, // B SERVER_FLAG_TEAMS = 0x100, // B

View file

@ -10,20 +10,6 @@
#include "camera.h" #include "camera.h"
#include "controls.h" #include "controls.h"
const float ZoomStep = 0.75f;
void CCamera::ConZoomPlus(IConsole::IResult *pResult, void *pUserData, int ClientID) {
//if(g_Config.m_ClDDRaceCheats == 1 || ((CCamera *)pUserData)->m_pClient->m_IsDDRace)
((CCamera *)pUserData)->m_Zoom *= 1/ZoomStep;
}
void CCamera::ConZoomMinus(IConsole::IResult *pResult, void *pUserData, int ClientID) {
//if(g_Config.m_ClDDRaceCheats == 1 || ((CCamera *)pUserData)->m_pClient->m_IsDDRace)
((CCamera *)pUserData)->m_Zoom *= ZoomStep;
}
void CCamera::ConZoomReset(IConsole::IResult *pResult, void *pUserData, int ClientID) {
//if(g_Config.m_ClDDRaceCheats == 1 || ((CCamera *)pUserData)->m_pClient->m_IsDDRace)
((CCamera *)pUserData)->m_Zoom = 1.0f;
}
CCamera::CCamera() CCamera::CCamera()
{ {
m_Zoom = 1.0f; m_Zoom = 1.0f;
@ -34,7 +20,6 @@ void CCamera::OnRender()
{ {
//vec2 center; //vec2 center;
// update camera center // update camera center
if(m_pClient->m_Snap.m_Spectate) if(m_pClient->m_Snap.m_Spectate)
{ {
@ -71,3 +56,18 @@ void CCamera::OnConsoleInit()
Console()->Register("zoom-", "", CFGFLAG_CLIENT, ConZoomMinus, this, "Zoom decrese", 0); Console()->Register("zoom-", "", CFGFLAG_CLIENT, ConZoomMinus, this, "Zoom decrese", 0);
Console()->Register("zoom", "", CFGFLAG_CLIENT, ConZoomReset, this, "Zoom reset", 0); Console()->Register("zoom", "", CFGFLAG_CLIENT, ConZoomReset, this, "Zoom reset", 0);
} }
const float ZoomStep = 0.75f;
void CCamera::ConZoomPlus(IConsole::IResult *pResult, void *pUserData, int ClientID) {
//if(g_Config.m_ClDDRaceCheats == 1 || ((CCamera *)pUserData)->m_pClient->m_IsDDRace)
((CCamera *)pUserData)->m_Zoom *= 1/ZoomStep;
}
void CCamera::ConZoomMinus(IConsole::IResult *pResult, void *pUserData, int ClientID) {
//if(g_Config.m_ClDDRaceCheats == 1 || ((CCamera *)pUserData)->m_pClient->m_IsDDRace)
((CCamera *)pUserData)->m_Zoom *= ZoomStep;
}
void CCamera::ConZoomReset(IConsole::IResult *pResult, void *pUserData, int ClientID) {
//if(g_Config.m_ClDDRaceCheats == 1 || ((CCamera *)pUserData)->m_pClient->m_IsDDRace)
((CCamera *)pUserData)->m_Zoom = 1.0f;
}

View file

@ -322,6 +322,75 @@ void CHud::RenderHealthAndAmmo()
Graphics()->QuadsEnd(); Graphics()->QuadsEnd();
} }
void CHud::OnRender()
{
if(!m_pClient->m_Snap.m_pGameobj)
return;
m_Width = 300*Graphics()->ScreenAspect();
bool Spectate = false;
if(m_pClient->m_Snap.m_pLocalInfo && m_pClient->m_Snap.m_pLocalInfo->m_Team == TEAM_SPECTATORS)
Spectate = true;
if(m_pClient->m_Snap.m_pLocalCharacter && !Spectate && !(m_pClient->m_Snap.m_pGameobj && m_pClient->m_Snap.m_pGameobj->m_GameOver)) {
RenderHealthAndAmmo();
RenderDDRaceEffects();
}
RenderGameTimer();
RenderSuddenDeath();
RenderScoreHud();
RenderWarmupTimer();
RenderFps();
if(Client()->State() != IClient::STATE_DEMOPLAYBACK)
RenderConnectionWarning();
RenderTeambalanceWarning();
RenderVoting();
RenderRecord();
RenderCursor();
}
void CHud::OnMessage(int MsgType, void *pRawMsg)
{
if(MsgType == NETMSGTYPE_SV_DDRACETIME)
{
m_DDRaceTimeReceived = true;
CNetMsg_Sv_DDRaceTime *pMsg = (CNetMsg_Sv_DDRaceTime *)pRawMsg;
m_DDRaceTime = pMsg->m_Time;
m_DDRaceTick = 0;
m_LastReceivedTimeTick = Client()->GameTick();
m_FinishTime = pMsg->m_Finish ? true : false;
if(pMsg->m_Check)
{
m_CheckpointDiff = (float)pMsg->m_Check/100;
m_CheckpointTick = Client()->GameTick();
}
}
else if(MsgType == NETMSGTYPE_SV_KILLMSG)
{
CNetMsg_Sv_KillMsg *pMsg = (CNetMsg_Sv_KillMsg *)pRawMsg;
if(pMsg->m_Victim == m_pClient->m_Snap.m_LocalCid)
{
m_CheckpointTick = 0;
m_DDRaceTime = 0;
}
}
else if(MsgType == NETMSGTYPE_SV_RECORD)
{
CNetMsg_Sv_Record *pMsg = (CNetMsg_Sv_Record *)pRawMsg;
m_ServerRecord = (float)pMsg->m_ServerTimeBest/100;
m_PlayerRecord = (float)pMsg->m_PlayerTimeBest/100;
}
}
void CHud::RenderDDRaceEffects() void CHud::RenderDDRaceEffects()
{ {
// check racestate // check racestate
@ -403,72 +472,3 @@ void CHud::RenderRecord()
} }
} }
void CHud::OnRender()
{
if(!m_pClient->m_Snap.m_pGameobj)
return;
m_Width = 300*Graphics()->ScreenAspect();
bool Spectate = false;
if(m_pClient->m_Snap.m_pLocalInfo && m_pClient->m_Snap.m_pLocalInfo->m_Team == TEAM_SPECTATORS)
Spectate = true;
if(m_pClient->m_Snap.m_pLocalCharacter && !Spectate && !(m_pClient->m_Snap.m_pGameobj && m_pClient->m_Snap.m_pGameobj->m_GameOver)) {
RenderHealthAndAmmo();
RenderDDRaceEffects();
}
RenderGameTimer();
RenderSuddenDeath();
RenderScoreHud();
RenderWarmupTimer();
RenderFps();
if(Client()->State() != IClient::STATE_DEMOPLAYBACK)
RenderConnectionWarning();
RenderTeambalanceWarning();
RenderVoting();
RenderRecord();
RenderCursor();
}
void CHud::OnMessage(int MsgType, void *pRawMsg)
{
if(MsgType == NETMSGTYPE_SV_DDRACETIME)
{
m_DDRaceTimeReceived = true;
CNetMsg_Sv_DDRaceTime *pMsg = (CNetMsg_Sv_DDRaceTime *)pRawMsg;
m_DDRaceTime = pMsg->m_Time;
m_DDRaceTick = 0;
m_LastReceivedTimeTick = Client()->GameTick();
m_FinishTime = pMsg->m_Finish ? true : false;
if(pMsg->m_Check)
{
m_CheckpointDiff = (float)pMsg->m_Check/100;
m_CheckpointTick = Client()->GameTick();
}
}
else if(MsgType == NETMSGTYPE_SV_KILLMSG)
{
CNetMsg_Sv_KillMsg *pMsg = (CNetMsg_Sv_KillMsg *)pRawMsg;
if(pMsg->m_Victim == m_pClient->m_Snap.m_LocalCid)
{
m_CheckpointTick = 0;
m_DDRaceTime = 0;
}
}
else if(MsgType == NETMSGTYPE_SV_RECORD)
{
CNetMsg_Sv_Record *pMsg = (CNetMsg_Sv_Record *)pRawMsg;
m_ServerRecord = (float)pMsg->m_ServerTimeBest/100;
m_PlayerRecord = (float)pMsg->m_PlayerTimeBest/100;
}
}

View file

@ -22,7 +22,6 @@ public:
virtual void OnRender(); virtual void OnRender();
virtual void OnRelease(); virtual void OnRelease();
bool Active(); bool Active();
}; };

View file

@ -44,6 +44,7 @@
#include "components/skins.h" #include "components/skins.h"
#include "components/sounds.h" #include "components/sounds.h"
#include "components/voting.h" #include "components/voting.h"
#include <base/tl/sorted_array.h>
CGameClient g_GameClient; CGameClient g_GameClient;
@ -106,8 +107,6 @@ static void ConServerDummy(IConsole::IResult *pResult, void *pUserData, int Clie
dbg_msg("client", "this command is not available on the client"); dbg_msg("client", "this command is not available on the client");
} }
#include <base/tl/sorted_array.h>
const char *CGameClient::Version() { return GAME_VERSION; } const char *CGameClient::Version() { return GAME_VERSION; }
const char *CGameClient::NetVersion() { return GAME_NETVERSION; } const char *CGameClient::NetVersion() { return GAME_NETVERSION; }
const char *CGameClient::GetItemName(int Type) { return m_NetObjHandler.GetObjName(Type); } const char *CGameClient::GetItemName(int Type) { return m_NetObjHandler.GetObjName(Type); }
@ -394,6 +393,7 @@ void CGameClient::OnReset()
for(int i = 0; i < m_All.m_Num; i++) for(int i = 0; i < m_All.m_Num; i++)
m_All.m_paComponents[i]->OnReset(); m_All.m_paComponents[i]->OnReset();
m_Teams.Reset(); m_Teams.Reset();
m_DDRaceMsgSent = false; m_DDRaceMsgSent = false;
} }
@ -425,6 +425,7 @@ static void Evolve(CNetObj_Character *pCharacter, int Tick)
CCharacterCore TempCore; CCharacterCore TempCore;
CTeamsCore TempTeams; CTeamsCore TempTeams;
mem_zero(&TempCore, sizeof(TempCore)); mem_zero(&TempCore, sizeof(TempCore));
mem_zero(&TempTeams, sizeof(TempTeams));
TempCore.Init(&TempWorld, g_GameClient.Collision(), &TempTeams); TempCore.Init(&TempWorld, g_GameClient.Collision(), &TempTeams);
TempCore.Read(pCharacter); TempCore.Read(pCharacter);
@ -606,7 +607,6 @@ void CGameClient::OnMessage(int MsgId, CUnpacker *pUnpacker)
CNetMsg_Sv_PlayerTime *pMsg = (CNetMsg_Sv_PlayerTime *)pRawMsg; CNetMsg_Sv_PlayerTime *pMsg = (CNetMsg_Sv_PlayerTime *)pRawMsg;
m_aClients[pMsg->m_Cid].m_Score = pMsg->m_Time; m_aClients[pMsg->m_Cid].m_Score = pMsg->m_Time;
} }
} }
void CGameClient::OnStateChange(int NewState, int OldState) void CGameClient::OnStateChange(int NewState, int OldState)

View file

@ -53,6 +53,7 @@ void CCollision::Init(class CLayers *pLayers)
m_Width = m_pLayers->GameLayer()->m_Width; m_Width = m_pLayers->GameLayer()->m_Width;
m_Height = m_pLayers->GameLayer()->m_Height; m_Height = m_pLayers->GameLayer()->m_Height;
m_pTiles = static_cast<CTile *>(m_pLayers->Map()->GetData(m_pLayers->GameLayer()->m_Data)); m_pTiles = static_cast<CTile *>(m_pLayers->Map()->GetData(m_pLayers->GameLayer()->m_Data));
if(m_pLayers->TeleLayer()) if(m_pLayers->TeleLayer())
m_pTele = static_cast<CTeleTile *>(m_pLayers->Map()->GetData(m_pLayers->TeleLayer()->m_Tele)); m_pTele = static_cast<CTeleTile *>(m_pLayers->Map()->GetData(m_pLayers->TeleLayer()->m_Tele));
if(m_pLayers->SpeedupLayer()) if(m_pLayers->SpeedupLayer())
@ -164,130 +165,6 @@ void CCollision::Init(class CLayers *pLayers)
} }
} }
int CCollision::GetPureMapIndex(vec2 Pos)
{
int nx = clamp((int)Pos.x/32, 0, m_Width-1);
int ny = clamp((int)Pos.y/32, 0, m_Height-1);
return ny*m_Width+nx;
}
std::list<int> CCollision::GetMapIndices(vec2 PrevPos, vec2 Pos, unsigned MaxIndices)
{
std::list< int > Indices;
float d = distance(PrevPos, Pos);
int End(d+1);
if(!d)
{
int nx = clamp((int)Pos.x/32, 0, m_Width-1);
int ny = clamp((int)Pos.y/32, 0, m_Height-1);
/*if (m_pTele && (m_pTele[ny*m_Width+nx].m_Type == TILE_TELEIN)) dbg_msg("m_pTele && TELEIN","ny*m_Width+nx %d",ny*m_Width+nx);
else if (m_pTele && m_pTele[ny*m_Width+nx].m_Type==TILE_TELEOUT) dbg_msg("TELEOUT","ny*m_Width+nx %d",ny*m_Width+nx);
else dbg_msg("GetMapIndex(","ny*m_Width+nx %d",ny*m_Width+nx);//REMOVE */
if(
(m_pTiles[ny*m_Width+nx].m_Index >= TILE_FREEZE && m_pTiles[ny*m_Width+nx].m_Index <= TILE_NPH) ||
(m_pFront && (m_pFront[ny*m_Width+nx].m_Index >= TILE_FREEZE && m_pFront[ny*m_Width+nx].m_Index <= TILE_NPH)) ||
(m_pTele && (m_pTele[ny*m_Width+nx].m_Type == TILE_TELEIN || m_pTele[ny*m_Width+nx].m_Type == TILE_TELEINEVIL || m_pTele[ny*m_Width+nx].m_Type == TILE_TELEOUT)) ||
(m_pSpeedup && m_pSpeedup[ny*m_Width+nx].m_Force > 0) ||
(m_pDoor && m_pDoor[ny*m_Width+nx].m_Index) ||
(m_pSwitch && m_pSwitch[ny*m_Width+nx].m_Type)
)
{
Indices.push_back(ny*m_Width+nx);
return Indices;
}
}
float a = 0.0f;
vec2 Tmp = vec2(0, 0);
int nx = 0;
int ny = 0;
int Index,LastIndex = 0;
for(int i = 0; i < End; i++)
{
a = i/d;
Tmp = mix(PrevPos, Pos, a);
nx = clamp((int)Tmp.x/32, 0, m_Width-1);
ny = clamp((int)Tmp.y/32, 0, m_Height-1);
Index = ny*m_Width+nx;
//dbg_msg("lastindex","%d",LastIndex);
//dbg_msg("index","%d",Index);
if(
(
(m_pTiles[ny*m_Width+nx].m_Index >= TILE_FREEZE && m_pTiles[ny*m_Width+nx].m_Index <= TILE_NPH) ||
(m_pFront && (m_pFront[ny*m_Width+nx].m_Index >= TILE_FREEZE && m_pFront[ny*m_Width+nx].m_Index <= TILE_NPH)) ||
(m_pTele && (m_pTele[ny*m_Width+nx].m_Type == TILE_TELEIN || m_pTele[ny*m_Width+nx].m_Type == TILE_TELEINEVIL || m_pTele[ny*m_Width+nx].m_Type == TILE_TELEOUT)) ||
(m_pSpeedup && m_pSpeedup[ny*m_Width+nx].m_Force > 0) ||
(m_pDoor && m_pDoor[ny*m_Width+nx].m_Index) ||
(m_pSwitch && m_pSwitch[ny*m_Width+nx].m_Type)
) &&
LastIndex != Index
)
{
if(MaxIndices && Indices.size() > MaxIndices) return Indices;
Indices.push_back(Index);
LastIndex = Index;
//dbg_msg("pushed","%d",Index);
}
}
return Indices;
}
vec2 CCollision::GetPos(int Index)
{
if(Index < 0)
return vec2(0,0);
int x = Index%m_Width;
int y = Index/m_Width;
return vec2(16+x*32, 16+y*32);
}
int CCollision::GetTileIndex(int Index)
{
/*dbg_msg("GetTileIndex","m_pTiles[%d].m_Index = %d",Index,m_pTiles[Index].m_Index);//Remove*/
if(Index < 0)
return 0;
return m_pTiles[Index].m_Index;
}
int CCollision::GetFTileIndex(int Index)
{
/*dbg_msg("GetFTileIndex","m_pFront[%d].m_Index = %d",Index,m_pFront[Index].m_Index);//Remove*/
if(Index < 0 || !m_pFront)
return 0;
return m_pFront[Index].m_Index;
}
int CCollision::GetTileFlags(int Index)
{
/*dbg_msg("GetTileIndex","m_pTiles[%d].m_Index = %d",Index,m_pTiles[Index].m_Index);//Remove*/
if(Index < 0)
return 0;
return m_pTiles[Index].m_Flags;
}
int CCollision::GetFTileFlags(int Index)
{
/*dbg_msg("GetFTileIndex","m_pFront[%d].m_Index = %d",Index,m_pFront[Index].m_Index);//Remove*/
if(Index < 0 || !m_pFront)
return 0;
return m_pFront[Index].m_Flags;
}
int CCollision::GetIndex(int nx, int ny) {
return m_pTiles[ny*m_Width+nx].m_Index;
}
int CCollision::GetFIndex(int nx, int ny) {
if(!m_pFront) return 0;
return m_pFront[ny*m_Width+nx].m_Index;
}
int CCollision::GetTile(int x, int y) int CCollision::GetTile(int x, int y)
{ {
int nx = clamp(x/32, 0, m_Width-1); int nx = clamp(x/32, 0, m_Width-1);
@ -307,255 +184,29 @@ int CCollision::GetTile(int x, int y)
return 0; return 0;
} }
int CCollision::GetFTile(int x, int y) /*bool CCollision::IsTileSolid(int x, int y)
{ {
if(!m_pFront) return GetTile(x,y)&COLFLAG_SOLID;
return 0; }*/
int nx = clamp(x/32, 0, m_Width-1);
int ny = clamp(y/32, 0, m_Height-1);
/*dbg_msg("GetFTile","m_Index %d",m_pFront[ny*m_Width+nx].m_Index);//Remove */
if(m_pFront[ny*m_Width+nx].m_Index == COLFLAG_DEATH
|| m_pFront[ny*m_Width+nx].m_Index == COLFLAG_NOLASER)
return m_pFront[ny*m_Width+nx].m_Index;
else
return 0;
}
int CCollision::Entity(int x, int y, int Layer)
{
if((0 > x || x >= m_Width) || (0 > y || y >= m_Height))
{
char aBuf[12];
switch (Layer)
{
case LAYER_GAME:
str_format(aBuf,sizeof(aBuf), "Game");
break;
case LAYER_FRONT:
str_format(aBuf,sizeof(aBuf), "Front");
break;
case LAYER_SWITCH:
str_format(aBuf,sizeof(aBuf), "Switch");
break;
case LAYER_TELE:
str_format(aBuf,sizeof(aBuf), "Tele");
break;
case LAYER_SPEEDUP:
str_format(aBuf,sizeof(aBuf), "Speedup");
break;
default:
str_format(aBuf,sizeof(aBuf), "Unknown");
}
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)
{
case LAYER_GAME:
return m_pTiles[y*m_Width+x].m_Index - ENTITY_OFFSET;
case LAYER_FRONT:
return m_pFront[y*m_Width+x].m_Index - ENTITY_OFFSET;
case LAYER_SWITCH:
return m_pSwitch[y*m_Width+x].m_Type - ENTITY_OFFSET;
case LAYER_TELE:
return m_pTele[y*m_Width+x].m_Type - ENTITY_OFFSET;
case LAYER_SPEEDUP:
return m_pSpeedup[y*m_Width+x].m_Type - ENTITY_OFFSET;
default:
return 0;
break;
}
}
void CCollision::SetCollisionAt(float x, float y, int flag)
{
int nx = clamp(round(x)/32, 0, m_Width-1);
int ny = clamp(round(y)/32, 0, m_Height-1);
m_pTiles[ny * m_Width + nx].m_Index = flag;
}
void CCollision::SetDCollisionAt(float x, float y, int Type, int Flags, int Number)
{
if(!m_pDoor)
return;
int nx = clamp(round(x)/32, 0, m_Width-1);
int ny = clamp(round(y)/32, 0, m_Height-1);
m_pDoor[ny * m_Width + nx].m_Index = Type;
m_pDoor[ny * m_Width + nx].m_Flags = Flags;
m_pDoor[ny * m_Width + nx].m_Number = Number;
}
int CCollision::GetDTileIndex(int Index)
{
if(!m_pDoor || Index < 0 || !m_pDoor[Index].m_Index)
return 0;
return m_pDoor[Index].m_Index;
}
int CCollision::GetDTileNumber(int Index)
{
if(!m_pDoor || Index < 0 || !m_pDoor[Index].m_Index)
return 0;
if(m_pDoor[Index].m_Number) return m_pDoor[Index].m_Number;
return 0;
}
int CCollision::GetDTileFlags(int Index)
{
if(!m_pDoor || Index < 0 || !m_pDoor[Index].m_Index)
return 0;
return m_pDoor[Index].m_Flags;
}
// TODO: rewrite this smarter! // TODO: rewrite this smarter!
void ThroughOffset(vec2 Pos0, vec2 Pos1, int *Ox, int *Oy)
{
float x = Pos0.x - Pos1.x;
float y = Pos0.y - Pos1.y;
if (fabs(x) > fabs(y))
{
if (x < 0)
{
*Ox = -32;
*Oy = 0;
}
else
{
*Ox = 32;
*Oy = 0;
}
}
else
{
if (y < 0)
{
*Ox = 0;
*Oy = -32;
}
else
{
*Ox = 0;
*Oy = 32;
}
}
}
int CCollision::IntersectLine(vec2 Pos0, vec2 Pos1, vec2 *pOutCollision, vec2 *pOutBeforeCollision, bool AllowThrough) int CCollision::IntersectLine(vec2 Pos0, vec2 Pos1, vec2 *pOutCollision, vec2 *pOutBeforeCollision, bool AllowThrough)
{ {
float d = distance(Pos0, Pos1); float d = distance(Pos0, Pos1);
int End(d+1); int End(d+1);
vec2 Last = Pos0; vec2 Last = Pos0;
int ix, iy; // Temporary position for checking collision
int dx, dy; // Offset for checking the "through" tile
if (AllowThrough)
{
ThroughOffset(Pos0, Pos1, &dx, &dy);
}
for(int i = 0; i < End; i++) for(int i = 0; i < End; i++)
{ {
float a = i/d; float a = i/d;
vec2 Pos = mix(Pos0, Pos1, a); vec2 Pos = mix(Pos0, Pos1, a);
ix = round(Pos.x); if(CheckPoint(Pos.x, Pos.y))
iy = round(Pos.y);
if(CheckPoint(ix, iy) && !(AllowThrough && IsThrough(ix + dx, iy + dy)))
{ {
if(pOutCollision) if(pOutCollision)
*pOutCollision = Pos; *pOutCollision = Pos;
if(pOutBeforeCollision) if(pOutBeforeCollision)
*pOutBeforeCollision = Last; *pOutBeforeCollision = Last;
return GetCollisionAt(ix, iy); return GetCollisionAt(Pos.x, Pos.y);
}
Last = Pos;
}
if(pOutCollision)
*pOutCollision = Pos1;
if(pOutBeforeCollision)
*pOutBeforeCollision = Pos1;
return 0;
}
int CCollision::IntersectNoLaser(vec2 Pos0, vec2 Pos1, vec2 *pOutCollision, vec2 *pOutBeforeCollision)
{
float d = distance(Pos0, Pos1);
vec2 Last = Pos0;
for(float f = 0; f < d; f++)
{
float a = f/d;
vec2 Pos = mix(Pos0, Pos1, a);
int nx = clamp(round(Pos.x)/32, 0, m_Width-1);
int ny = clamp(round(Pos.y)/32, 0, m_Height-1);
if(GetIndex(nx, ny) == COLFLAG_SOLID
|| GetIndex(nx, ny) == (COLFLAG_SOLID|COLFLAG_NOHOOK)
|| GetIndex(nx, ny) == COLFLAG_NOLASER
|| GetFIndex(nx, ny) == COLFLAG_NOLASER)
{
if(pOutCollision)
*pOutCollision = Pos;
if(pOutBeforeCollision)
*pOutBeforeCollision = Last;
if (GetFIndex(nx, ny) == COLFLAG_NOLASER) return GetFCollisionAt(Pos.x, Pos.y);
else return GetCollisionAt(Pos.x, Pos.y);
}
Last = Pos;
}
if(pOutCollision)
*pOutCollision = Pos1;
if(pOutBeforeCollision)
*pOutBeforeCollision = Pos1;
return 0;
}
int CCollision::IntersectNoLaserNW(vec2 Pos0, vec2 Pos1, vec2 *pOutCollision, vec2 *pOutBeforeCollision)
{
float d = distance(Pos0, Pos1);
vec2 Last = Pos0;
for(float f = 0; f < d; f++)
{
float a = f/d;
vec2 Pos = mix(Pos0, Pos1, a);
if(IsNoLaser(round(Pos.x), round(Pos.y)) || IsFNoLaser(round(Pos.x), round(Pos.y)))
{
if(pOutCollision)
*pOutCollision = Pos;
if(pOutBeforeCollision)
*pOutBeforeCollision = Last;
if(IsNoLaser(round(Pos.x), round(Pos.y))) return GetCollisionAt(Pos.x, Pos.y);
else return GetFCollisionAt(Pos.x, Pos.y);
}
Last = Pos;
}
if(pOutCollision)
*pOutCollision = Pos1;
if(pOutBeforeCollision)
*pOutBeforeCollision = Pos1;
return 0;
}
int CCollision::IntersectAir(vec2 Pos0, vec2 Pos1, vec2 *pOutCollision, vec2 *pOutBeforeCollision)
{
float d = distance(Pos0, Pos1);
vec2 Last = Pos0;
for(float f = 0; f < d; f++)
{
float a = f/d;
vec2 Pos = mix(Pos0, Pos1, a);
if(IsSolid(round(Pos.x), round(Pos.y)) || (!GetTile(round(Pos.x), round(Pos.y)) && !GetFTile(round(Pos.x), round(Pos.y))))
{
if(pOutCollision)
*pOutCollision = Pos;
if(pOutBeforeCollision)
*pOutBeforeCollision = Last;
if(!GetTile(round(Pos.x), round(Pos.y)) && !GetFTile(round(Pos.x), round(Pos.y)))
return -1;
else
if (!GetTile(round(Pos.x), round(Pos.y))) return GetTile(round(Pos.x), round(Pos.y));
else return GetFTile(round(Pos.x), round(Pos.y));
} }
Last = Pos; Last = Pos;
} }
@ -605,6 +256,20 @@ void CCollision::MovePoint(vec2 *pInoutPos, vec2 *pInoutVel, float Elasticity, i
} }
} }
bool CCollision::TestBox(vec2 Pos, vec2 Size)
{
Size *= 0.5f;
if(CheckPoint(Pos.x-Size.x, Pos.y-Size.y))
return true;
if(CheckPoint(Pos.x+Size.x, Pos.y-Size.y))
return true;
if(CheckPoint(Pos.x-Size.x, Pos.y+Size.y))
return true;
if(CheckPoint(Pos.x+Size.x, Pos.y+Size.y))
return true;
return false;
}
void CCollision::MoveBox(vec2 *pInoutPos, vec2 *pInoutVel, vec2 Size, float Elasticity) void CCollision::MoveBox(vec2 *pInoutPos, vec2 *pInoutVel, vec2 Size, float Elasticity)
{ {
// do the move // do the move
@ -663,20 +328,6 @@ void CCollision::MoveBox(vec2 *pInoutPos, vec2 *pInoutVel, vec2 Size, float Elas
*pInoutVel = Vel; *pInoutVel = Vel;
} }
bool CCollision::TestBox(vec2 Pos, vec2 Size)
{
Size *= 0.5f;
if(CheckPoint(Pos.x-Size.x, Pos.y-Size.y))
return true;
if(CheckPoint(Pos.x+Size.x, Pos.y-Size.y))
return true;
if(CheckPoint(Pos.x-Size.x, Pos.y+Size.y))
return true;
if(CheckPoint(Pos.x+Size.x, Pos.y+Size.y))
return true;
return false;
}
int CCollision::IsSolid(int x, int y) int CCollision::IsSolid(int x, int y)
{ {
return (GetTile(x,y)&COLFLAG_SOLID); return (GetTile(x,y)&COLFLAG_SOLID);
@ -871,5 +522,351 @@ vec2 CCollision::CpSpeed(int Index, int Flags)
if(Index == TILE_CP_F) if(Index == TILE_CP_F)
target*=4; target*=4;
return target; return target;
}
int CCollision::GetPureMapIndex(vec2 Pos)
{
int nx = clamp((int)Pos.x/32, 0, m_Width-1);
int ny = clamp((int)Pos.y/32, 0, m_Height-1);
return ny*m_Width+nx;
}
std::list<int> CCollision::GetMapIndices(vec2 PrevPos, vec2 Pos, unsigned MaxIndices)
{
std::list< int > Indices;
float d = distance(PrevPos, Pos);
int End(d+1);
if(!d)
{
int nx = clamp((int)Pos.x/32, 0, m_Width-1);
int ny = clamp((int)Pos.y/32, 0, m_Height-1);
/*if (m_pTele && (m_pTele[ny*m_Width+nx].m_Type == TILE_TELEIN)) dbg_msg("m_pTele && TELEIN","ny*m_Width+nx %d",ny*m_Width+nx);
else if (m_pTele && m_pTele[ny*m_Width+nx].m_Type==TILE_TELEOUT) dbg_msg("TELEOUT","ny*m_Width+nx %d",ny*m_Width+nx);
else dbg_msg("GetMapIndex(","ny*m_Width+nx %d",ny*m_Width+nx);//REMOVE */
if(
(m_pTiles[ny*m_Width+nx].m_Index >= TILE_FREEZE && m_pTiles[ny*m_Width+nx].m_Index <= TILE_NPH) ||
(m_pFront && (m_pFront[ny*m_Width+nx].m_Index >= TILE_FREEZE && m_pFront[ny*m_Width+nx].m_Index <= TILE_NPH)) ||
(m_pTele && (m_pTele[ny*m_Width+nx].m_Type == TILE_TELEIN || m_pTele[ny*m_Width+nx].m_Type == TILE_TELEINEVIL || m_pTele[ny*m_Width+nx].m_Type == TILE_TELEOUT)) ||
(m_pSpeedup && m_pSpeedup[ny*m_Width+nx].m_Force > 0) ||
(m_pDoor && m_pDoor[ny*m_Width+nx].m_Index) ||
(m_pSwitch && m_pSwitch[ny*m_Width+nx].m_Type)
)
{
Indices.push_back(ny*m_Width+nx);
return Indices;
}
}
float a = 0.0f;
vec2 Tmp = vec2(0, 0);
int nx = 0;
int ny = 0;
int Index,LastIndex = 0;
for(int i = 0; i < End; i++)
{
a = i/d;
Tmp = mix(PrevPos, Pos, a);
nx = clamp((int)Tmp.x/32, 0, m_Width-1);
ny = clamp((int)Tmp.y/32, 0, m_Height-1);
Index = ny*m_Width+nx;
//dbg_msg("lastindex","%d",LastIndex);
//dbg_msg("index","%d",Index);
if(
(
(m_pTiles[ny*m_Width+nx].m_Index >= TILE_FREEZE && m_pTiles[ny*m_Width+nx].m_Index <= TILE_NPH) ||
(m_pFront && (m_pFront[ny*m_Width+nx].m_Index >= TILE_FREEZE && m_pFront[ny*m_Width+nx].m_Index <= TILE_NPH)) ||
(m_pTele && (m_pTele[ny*m_Width+nx].m_Type == TILE_TELEIN || m_pTele[ny*m_Width+nx].m_Type == TILE_TELEINEVIL || m_pTele[ny*m_Width+nx].m_Type == TILE_TELEOUT)) ||
(m_pSpeedup && m_pSpeedup[ny*m_Width+nx].m_Force > 0) ||
(m_pDoor && m_pDoor[ny*m_Width+nx].m_Index) ||
(m_pSwitch && m_pSwitch[ny*m_Width+nx].m_Type)
) &&
LastIndex != Index
)
{
if(MaxIndices && Indices.size() > MaxIndices) return Indices;
Indices.push_back(Index);
LastIndex = Index;
//dbg_msg("pushed","%d",Index);
}
}
return Indices;
}
vec2 CCollision::GetPos(int Index)
{
if(Index < 0)
return vec2(0,0);
int x = Index%m_Width;
int y = Index/m_Width;
return vec2(16+x*32, 16+y*32);
}
int CCollision::GetTileIndex(int Index)
{
/*dbg_msg("GetTileIndex","m_pTiles[%d].m_Index = %d",Index,m_pTiles[Index].m_Index);//Remove*/
if(Index < 0)
return 0;
return m_pTiles[Index].m_Index;
}
int CCollision::GetFTileIndex(int Index)
{
/*dbg_msg("GetFTileIndex","m_pFront[%d].m_Index = %d",Index,m_pFront[Index].m_Index);//Remove*/
if(Index < 0 || !m_pFront)
return 0;
return m_pFront[Index].m_Index;
}
int CCollision::GetTileFlags(int Index)
{
/*dbg_msg("GetTileIndex","m_pTiles[%d].m_Index = %d",Index,m_pTiles[Index].m_Index);//Remove*/
if(Index < 0)
return 0;
return m_pTiles[Index].m_Flags;
}
int CCollision::GetFTileFlags(int Index)
{
/*dbg_msg("GetFTileIndex","m_pFront[%d].m_Index = %d",Index,m_pFront[Index].m_Index);//Remove*/
if(Index < 0 || !m_pFront)
return 0;
return m_pFront[Index].m_Flags;
}
int CCollision::GetIndex(int nx, int ny) {
return m_pTiles[ny*m_Width+nx].m_Index;
}
int CCollision::GetFIndex(int nx, int ny) {
if(!m_pFront) return 0;
return m_pFront[ny*m_Width+nx].m_Index;
}
int CCollision::GetFTile(int x, int y)
{
if(!m_pFront)
return 0;
int nx = clamp(x/32, 0, m_Width-1);
int ny = clamp(y/32, 0, m_Height-1);
/*dbg_msg("GetFTile","m_Index %d",m_pFront[ny*m_Width+nx].m_Index);//Remove */
if(m_pFront[ny*m_Width+nx].m_Index == COLFLAG_DEATH
|| m_pFront[ny*m_Width+nx].m_Index == COLFLAG_NOLASER)
return m_pFront[ny*m_Width+nx].m_Index;
else
return 0;
}
int CCollision::Entity(int x, int y, int Layer)
{
if((0 > x || x >= m_Width) || (0 > y || y >= m_Height))
{
char aBuf[12];
switch (Layer)
{
case LAYER_GAME:
str_format(aBuf,sizeof(aBuf), "Game");
break;
case LAYER_FRONT:
str_format(aBuf,sizeof(aBuf), "Front");
break;
case LAYER_SWITCH:
str_format(aBuf,sizeof(aBuf), "Switch");
break;
case LAYER_TELE:
str_format(aBuf,sizeof(aBuf), "Tele");
break;
case LAYER_SPEEDUP:
str_format(aBuf,sizeof(aBuf), "Speedup");
break;
default:
str_format(aBuf,sizeof(aBuf), "Unknown");
}
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)
{
case LAYER_GAME:
return m_pTiles[y*m_Width+x].m_Index - ENTITY_OFFSET;
case LAYER_FRONT:
return m_pFront[y*m_Width+x].m_Index - ENTITY_OFFSET;
case LAYER_SWITCH:
return m_pSwitch[y*m_Width+x].m_Type - ENTITY_OFFSET;
case LAYER_TELE:
return m_pTele[y*m_Width+x].m_Type - ENTITY_OFFSET;
case LAYER_SPEEDUP:
return m_pSpeedup[y*m_Width+x].m_Type - ENTITY_OFFSET;
default:
return 0;
break;
}
}
void CCollision::SetCollisionAt(float x, float y, int flag)
{
int nx = clamp(round(x)/32, 0, m_Width-1);
int ny = clamp(round(y)/32, 0, m_Height-1);
m_pTiles[ny * m_Width + nx].m_Index = flag;
}
void CCollision::SetDCollisionAt(float x, float y, int Type, int Flags, int Number)
{
if(!m_pDoor)
return;
int nx = clamp(round(x)/32, 0, m_Width-1);
int ny = clamp(round(y)/32, 0, m_Height-1);
m_pDoor[ny * m_Width + nx].m_Index = Type;
m_pDoor[ny * m_Width + nx].m_Flags = Flags;
m_pDoor[ny * m_Width + nx].m_Number = Number;
}
int CCollision::GetDTileIndex(int Index)
{
if(!m_pDoor || Index < 0 || !m_pDoor[Index].m_Index)
return 0;
return m_pDoor[Index].m_Index;
}
int CCollision::GetDTileNumber(int Index)
{
if(!m_pDoor || Index < 0 || !m_pDoor[Index].m_Index)
return 0;
if(m_pDoor[Index].m_Number) return m_pDoor[Index].m_Number;
return 0;
}
int CCollision::GetDTileFlags(int Index)
{
if(!m_pDoor || Index < 0 || !m_pDoor[Index].m_Index)
return 0;
return m_pDoor[Index].m_Flags;
}
void ThroughOffset(vec2 Pos0, vec2 Pos1, int *Ox, int *Oy)
{
float x = Pos0.x - Pos1.x;
float y = Pos0.y - Pos1.y;
if (fabs(x) > fabs(y))
{
if (x < 0)
{
*Ox = -32;
*Oy = 0;
}
else
{
*Ox = 32;
*Oy = 0;
}
}
else
{
if (y < 0)
{
*Ox = 0;
*Oy = -32;
}
else
{
*Ox = 0;
*Oy = 32;
}
}
}
int CCollision::IntersectNoLaser(vec2 Pos0, vec2 Pos1, vec2 *pOutCollision, vec2 *pOutBeforeCollision)
{
float d = distance(Pos0, Pos1);
vec2 Last = Pos0;
for(float f = 0; f < d; f++)
{
float a = f/d;
vec2 Pos = mix(Pos0, Pos1, a);
int nx = clamp(round(Pos.x)/32, 0, m_Width-1);
int ny = clamp(round(Pos.y)/32, 0, m_Height-1);
if(GetIndex(nx, ny) == COLFLAG_SOLID
|| GetIndex(nx, ny) == (COLFLAG_SOLID|COLFLAG_NOHOOK)
|| GetIndex(nx, ny) == COLFLAG_NOLASER
|| GetFIndex(nx, ny) == COLFLAG_NOLASER)
{
if(pOutCollision)
*pOutCollision = Pos;
if(pOutBeforeCollision)
*pOutBeforeCollision = Last;
if (GetFIndex(nx, ny) == COLFLAG_NOLASER) return GetFCollisionAt(Pos.x, Pos.y);
else return GetCollisionAt(Pos.x, Pos.y);
} }
Last = Pos;
}
if(pOutCollision)
*pOutCollision = Pos1;
if(pOutBeforeCollision)
*pOutBeforeCollision = Pos1;
return 0;
}
int CCollision::IntersectNoLaserNW(vec2 Pos0, vec2 Pos1, vec2 *pOutCollision, vec2 *pOutBeforeCollision)
{
float d = distance(Pos0, Pos1);
vec2 Last = Pos0;
for(float f = 0; f < d; f++)
{
float a = f/d;
vec2 Pos = mix(Pos0, Pos1, a);
if(IsNoLaser(round(Pos.x), round(Pos.y)) || IsFNoLaser(round(Pos.x), round(Pos.y)))
{
if(pOutCollision)
*pOutCollision = Pos;
if(pOutBeforeCollision)
*pOutBeforeCollision = Last;
if(IsNoLaser(round(Pos.x), round(Pos.y))) return GetCollisionAt(Pos.x, Pos.y);
else return GetFCollisionAt(Pos.x, Pos.y);
}
Last = Pos;
}
if(pOutCollision)
*pOutCollision = Pos1;
if(pOutBeforeCollision)
*pOutBeforeCollision = Pos1;
return 0;
}
int CCollision::IntersectAir(vec2 Pos0, vec2 Pos1, vec2 *pOutCollision, vec2 *pOutBeforeCollision)
{
float d = distance(Pos0, Pos1);
vec2 Last = Pos0;
for(float f = 0; f < d; f++)
{
float a = f/d;
vec2 Pos = mix(Pos0, Pos1, a);
if(IsSolid(round(Pos.x), round(Pos.y)) || (!GetTile(round(Pos.x), round(Pos.y)) && !GetFTile(round(Pos.x), round(Pos.y))))
{
if(pOutCollision)
*pOutCollision = Pos;
if(pOutBeforeCollision)
*pOutBeforeCollision = Last;
if(!GetTile(round(Pos.x), round(Pos.y)) && !GetFTile(round(Pos.x), round(Pos.y)))
return -1;
else
if (!GetTile(round(Pos.x), round(Pos.y))) return GetTile(round(Pos.x), round(Pos.y));
else return GetFTile(round(Pos.x), round(Pos.y));
}
Last = Pos;
}
if(pOutCollision)
*pOutCollision = Pos1;
if(pOutBeforeCollision)
*pOutBeforeCollision = Pos1;
return 0;
}

View file

@ -24,15 +24,19 @@ class CCollision
int m_Type[16]; int m_Type[16];
}; };
//bool IsTileSolid(int x, int y);
public: public:
enum enum
{ {
COLFLAG_SOLID=1, COLFLAG_SOLID=1,
COLFLAG_DEATH=2, COLFLAG_DEATH=2,
COLFLAG_NOHOOK=4, COLFLAG_NOHOOK=4,
//DDRace
COLFLAG_NOLASER=8, COLFLAG_NOLASER=8,
COLFLAG_THROUGH=16 COLFLAG_THROUGH=16
}; };
CCollision(); CCollision();
void Dest(); void Dest();
void Init(class CLayers *pLayers); void Init(class CLayers *pLayers);

View file

@ -77,24 +77,6 @@ void CCharacterCore::Reset()
m_TriggeredEvents = 0; m_TriggeredEvents = 0;
} }
void CCharacterCore::HandleFly()
{
vec2 Temp = vec2(0,-m_pWorld->m_Tuning.m_AirJumpImpulse);
if(Temp.y < 0 && ((m_TileIndex == TILE_STOP && m_TileFlags == ROTATION_180) || (m_TileIndexB == TILE_STOP && m_TileFlagsB == ROTATION_180) || (m_TileIndexB == TILE_STOPS && (m_TileFlagsB == ROTATION_0 || m_TileFlagsB == ROTATION_180)) || (m_TileIndexB == TILE_STOPA) || (m_TileFIndex == TILE_STOP && m_TileFFlags == ROTATION_180) || (m_TileFIndexB == TILE_STOP && m_TileFFlagsB == ROTATION_180) || (m_TileFIndexB == TILE_STOPS && (m_TileFFlagsB == ROTATION_0 || m_TileFFlagsB == ROTATION_180)) || (m_TileFIndexB == TILE_STOPA) || (m_TileSIndex == TILE_STOP && m_TileSFlags == ROTATION_180) || (m_TileSIndexB == TILE_STOP && m_TileSFlagsB == ROTATION_180) || (m_TileSIndexB == TILE_STOPS && (m_TileSFlagsB == ROTATION_0 || m_TileSFlagsB == ROTATION_180)) || (m_TileSIndexB == TILE_STOPA)))
Temp.y = 0;
if(Temp.y > 0 && ((m_TileIndex == TILE_STOP && m_TileFlags == ROTATION_0) || (m_TileIndexT == TILE_STOP && m_TileFlagsT == ROTATION_0) || (m_TileIndexT == TILE_STOPS && (m_TileFlagsT == ROTATION_0 || m_TileFlagsT == ROTATION_180)) || (m_TileIndexT == TILE_STOPA) || (m_TileFIndex == TILE_STOP && m_TileFFlags == ROTATION_0) || (m_TileFIndexT == TILE_STOP && m_TileFFlagsT == ROTATION_0) || (m_TileFIndexT == TILE_STOPS && (m_TileFFlagsT == ROTATION_0 || m_TileFFlagsT == ROTATION_180)) || (m_TileFIndexT == TILE_STOPA) || (m_TileSIndex == TILE_STOP && m_TileSFlags == ROTATION_0) || (m_TileSIndexT == TILE_STOP && m_TileSFlagsT == ROTATION_0) || (m_TileSIndexT == TILE_STOPS && (m_TileSFlagsT == ROTATION_0 || m_TileSFlagsT == ROTATION_180)) || (m_TileSIndexT == TILE_STOPA)))
Temp.y = 0;
m_Vel.y = Temp.y;
}
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)];
return false;
}
void CCharacterCore::Tick(bool UseInput) void CCharacterCore::Tick(bool UseInput)
{ {
float PhysSize = 28.0f; float PhysSize = 28.0f;
@ -317,11 +299,8 @@ void CCharacterCore::Tick(bool UseInput)
if(m_HookedPlayer != -1) if(m_HookedPlayer != -1)
{ {
CCharacterCore *p = m_pWorld->m_apCharacters[m_HookedPlayer]; CCharacterCore *p = m_pWorld->m_apCharacters[m_HookedPlayer];
if(p) if(p)
{
m_HookPos = p->m_Pos; m_HookPos = p->m_Pos;
}
else else
{ {
// release hook // release hook
@ -492,3 +471,22 @@ void CCharacterCore::Quantize()
Write(&Core); Write(&Core);
Read(&Core); Read(&Core);
} }
void CCharacterCore::HandleFly()
{
vec2 Temp = vec2(0,-m_pWorld->m_Tuning.m_AirJumpImpulse);
if(Temp.y < 0 && ((m_TileIndex == TILE_STOP && m_TileFlags == ROTATION_180) || (m_TileIndexB == TILE_STOP && m_TileFlagsB == ROTATION_180) || (m_TileIndexB == TILE_STOPS && (m_TileFlagsB == ROTATION_0 || m_TileFlagsB == ROTATION_180)) || (m_TileIndexB == TILE_STOPA) || (m_TileFIndex == TILE_STOP && m_TileFFlags == ROTATION_180) || (m_TileFIndexB == TILE_STOP && m_TileFFlagsB == ROTATION_180) || (m_TileFIndexB == TILE_STOPS && (m_TileFFlagsB == ROTATION_0 || m_TileFFlagsB == ROTATION_180)) || (m_TileFIndexB == TILE_STOPA) || (m_TileSIndex == TILE_STOP && m_TileSFlags == ROTATION_180) || (m_TileSIndexB == TILE_STOP && m_TileSFlagsB == ROTATION_180) || (m_TileSIndexB == TILE_STOPS && (m_TileSFlagsB == ROTATION_0 || m_TileSFlagsB == ROTATION_180)) || (m_TileSIndexB == TILE_STOPA)))
Temp.y = 0;
if(Temp.y > 0 && ((m_TileIndex == TILE_STOP && m_TileFlags == ROTATION_0) || (m_TileIndexT == TILE_STOP && m_TileFlagsT == ROTATION_0) || (m_TileIndexT == TILE_STOPS && (m_TileFlagsT == ROTATION_0 || m_TileFlagsT == ROTATION_180)) || (m_TileIndexT == TILE_STOPA) || (m_TileFIndex == TILE_STOP && m_TileFFlags == ROTATION_0) || (m_TileFIndexT == TILE_STOP && m_TileFFlagsT == ROTATION_0) || (m_TileFIndexT == TILE_STOPS && (m_TileFFlagsT == ROTATION_0 || m_TileFFlagsT == ROTATION_180)) || (m_TileFIndexT == TILE_STOPA) || (m_TileSIndex == TILE_STOP && m_TileSFlags == ROTATION_0) || (m_TileSIndexT == TILE_STOP && m_TileSFlagsT == ROTATION_0) || (m_TileSIndexT == TILE_STOPS && (m_TileSFlagsT == ROTATION_0 || m_TileSFlagsT == ROTATION_180)) || (m_TileSIndexT == TILE_STOPA)))
Temp.y = 0;
m_Vel.y = Temp.y;
}
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)];
return false;
}

View file

@ -13,6 +13,7 @@
#include "teamscore.h" #include "teamscore.h"
#include "mapitems.h" #include "mapitems.h"
class CTuneParam class CTuneParam
{ {
int m_Value; int m_Value;
@ -170,7 +171,6 @@ public:
} }
CTuningParams m_Tuning; CTuningParams m_Tuning;
class CCharacterCore *m_apCharacters[MAX_CLIENTS]; class CCharacterCore *m_apCharacters[MAX_CLIENTS];
}; };

View file

@ -17,14 +17,6 @@ CLayers::CLayers()
m_pMap = 0; m_pMap = 0;
} }
void CLayers::Dest()
{
m_pTeleLayer = 0;
m_pSpeedupLayer = 0;
m_pFrontLayer = 0;
m_pSwitchLayer = 0;
}
void CLayers::Init(class IKernel *pKernel) void CLayers::Init(class IKernel *pKernel)
{ {
m_pMap = pKernel->RequestInterface<IMap>(); m_pMap = pKernel->RequestInterface<IMap>();
@ -85,3 +77,12 @@ CMapItemLayer *CLayers::GetLayer(int Index) const
{ {
return static_cast<CMapItemLayer *>(m_pMap->GetItem(m_LayersStart+Index, 0, 0)); return static_cast<CMapItemLayer *>(m_pMap->GetItem(m_LayersStart+Index, 0, 0));
} }
void CLayers::Dest()
{
m_pTeleLayer = 0;
m_pSpeedupLayer = 0;
m_pFrontLayer = 0;
m_pSwitchLayer = 0;
}

View file

@ -7,7 +7,7 @@
CFlag::CFlag(CGameWorld *pGameWorld, int Team) CFlag::CFlag(CGameWorld *pGameWorld, int Team)
: CEntity(pGameWorld, NETOBJTYPE_FLAG) : CEntity(pGameWorld, NETOBJTYPE_FLAG)
{ {
m_Number = Team; m_Team = Team;
m_ProximityRadius = ms_PhysSize; m_ProximityRadius = ms_PhysSize;
m_pCarryingCharacter = NULL; m_pCarryingCharacter = NULL;
m_GrabTick = 0; m_GrabTick = 0;
@ -26,13 +26,13 @@ void CFlag::Reset()
void CFlag::Snap(int SnappingClient) void CFlag::Snap(int SnappingClient)
{ {
CNetObj_Flag *pFlag = (CNetObj_Flag *)Server()->SnapNewItem(NETOBJTYPE_FLAG, m_Number, sizeof(CNetObj_Flag)); CNetObj_Flag *pFlag = (CNetObj_Flag *)Server()->SnapNewItem(NETOBJTYPE_FLAG, m_Team, sizeof(CNetObj_Flag));
if(!pFlag) if(!pFlag)
return; return;
pFlag->m_X = (int)m_Pos.x; pFlag->m_X = (int)m_Pos.x;
pFlag->m_Y = (int)m_Pos.y; pFlag->m_Y = (int)m_Pos.y;
pFlag->m_Number = m_Number; pFlag->m_Team = m_Team;
pFlag->m_CarriedBy = -1; pFlag->m_CarriedBy = -1;
if(m_AtStand) if(m_AtStand)

View file

@ -1,6 +1,6 @@
/* (c) Magnus Auvinen. See licence.txt in the root of the distribution for more information. */ /* (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. */ /* If you are missing that file, acquire a complete release at teeworlds.com. */
/*#ifndef GAME_SERVER_ENTITIES_FLAG_H /*
#ifndef GAME_SERVER_ENTITIES_FLAG_H #ifndef GAME_SERVER_ENTITIES_FLAG_H
#define GAME_SERVER_ENTITIES_FLAG_H #define GAME_SERVER_ENTITIES_FLAG_H
@ -14,7 +14,7 @@ public:
vec2 m_Vel; vec2 m_Vel;
vec2 m_StandPos; vec2 m_StandPos;
int m_Number; int m_Team;
int m_AtStand; int m_AtStand;
int m_DropTick; int m_DropTick;
int m_GrabTick; int m_GrabTick;

View file

@ -14,7 +14,6 @@ CLaser::CLaser(CGameWorld *pGameWorld, vec2 Pos, vec2 Direction, float StartEner
m_Dir = Direction; m_Dir = Direction;
m_Bounces = 0; m_Bounces = 0;
m_EvalTick = 0; m_EvalTick = 0;
m_Type = Type;
GameWorld()->InsertEntity(this); GameWorld()->InsertEntity(this);
DoBounce(); DoBounce();
} }

View file

@ -1,7 +1,7 @@
/* (c) Magnus Auvinen. See licence.txt in the root of the distribution for more information. */ /* (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. */ /* If you are missing that file, acquire a complete release at teeworlds.com. */
/*#include <game/mapitems.h> /*
======= #include <game/mapitems.h>
#include <game/server/entities/character.h> #include <game/server/entities/character.h>
#include <game/server/entities/flag.h> #include <game/server/entities/flag.h>
#include <game/server/player.h> #include <game/server/player.h>
@ -146,7 +146,7 @@ void CGameControllerCTF::Tick()
if(!apCloseCCharacters[i]->IsAlive() || apCloseCCharacters[i]->GetPlayer()->GetTeam() == TEAM_SPECTATORS || GameServer()->Collision()->IntersectLine(F->m_Pos, apCloseCCharacters[i]->m_Pos, NULL, NULL)) if(!apCloseCCharacters[i]->IsAlive() || apCloseCCharacters[i]->GetPlayer()->GetTeam() == TEAM_SPECTATORS || GameServer()->Collision()->IntersectLine(F->m_Pos, apCloseCCharacters[i]->m_Pos, NULL, NULL))
continue; continue;
if(apCloseCCharacters[i]->GetPlayer()->GetTeam() == F->m_Number) if(apCloseCCharacters[i]->GetPlayer()->GetTeam() == F->m_Team)
{ {
// return the flag // return the flag
if(!F->m_AtStand) if(!F->m_AtStand)

View file

@ -1,6 +1,6 @@
/* (c) Magnus Auvinen. See licence.txt in the root of the distribution for more information. */ /* (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. */ /* If you are missing that file, acquire a complete release at teeworlds.com. */
/* #ifndef GAME_SERVER_GAMEMODES_CTF_H /*
#ifndef GAME_SERVER_GAMEMODES_CTF_H #ifndef GAME_SERVER_GAMEMODES_CTF_H
#define GAME_SERVER_GAMEMODES_CTF_H #define GAME_SERVER_GAMEMODES_CTF_H
#include <game/server/gamecontroller.h> #include <game/server/gamecontroller.h>

View file

@ -1,6 +1,6 @@
/* (c) Magnus Auvinen. See licence.txt in the root of the distribution for more information. */ /* (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. */ /* If you are missing that file, acquire a complete release at teeworlds.com. */
/*#ifndef GAME_SERVER_GAMEMODES_DM_H /*
#ifndef GAME_SERVER_GAMEMODES_DM_H #ifndef GAME_SERVER_GAMEMODES_DM_H
#define GAME_SERVER_GAMEMODES_DM_H #define GAME_SERVER_GAMEMODES_DM_H
#include <game/server/gamecontroller.h> #include <game/server/gamecontroller.h>

View file

@ -1,6 +1,6 @@
/* (c) Magnus Auvinen. See licence.txt in the root of the distribution for more information. */ /* (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. */ /* If you are missing that file, acquire a complete release at teeworlds.com. */
/* #ifndef GAME_SERVER_GAMEMODES_TDM_H /*
#ifndef GAME_SERVER_GAMEMODES_TDM_H #ifndef GAME_SERVER_GAMEMODES_TDM_H
#define GAME_SERVER_GAMEMODES_TDM_H #define GAME_SERVER_GAMEMODES_TDM_H
#include <game/server/gamecontroller.h> #include <game/server/gamecontroller.h>

View file

@ -201,6 +201,7 @@ CCharacter *CGameWorld::IntersectCharacter(vec2 Pos0, vec2 Pos1, float Radius, v
return pClosest; return pClosest;
} }
CCharacter *CGameWorld::ClosestCharacter(vec2 Pos, float Radius, CEntity *pNotThis) CCharacter *CGameWorld::ClosestCharacter(vec2 Pos, float Radius, CEntity *pNotThis)
{ {
// Find other players // Find other players
@ -226,7 +227,6 @@ CCharacter *CGameWorld::ClosestCharacter(vec2 Pos, float Radius, CEntity *pNotTh
return pClosest; return pClosest;
} }
std::list<class CCharacter *> CGameWorld::IntersectedCharacters(vec2 Pos0, vec2 Pos1, float Radius, class CEntity *pNotThis) std::list<class CCharacter *> CGameWorld::IntersectedCharacters(vec2 Pos0, vec2 Pos1, float Radius, class CEntity *pNotThis)
{ {
std::list< CCharacter * > listOfChars; std::list< CCharacter * > listOfChars;

View file

@ -140,7 +140,6 @@ public:
*/ */
void Tick(); void Tick();
std::list<class CCharacter *> IntersectedCharacters(vec2 Pos0, vec2 Pos1, float Radius, vec2 &NewPos, class CEntity *pNotThis); std::list<class CCharacter *> IntersectedCharacters(vec2 Pos0, vec2 Pos1, float Radius, vec2 &NewPos, class CEntity *pNotThis);
void ReleaseHooked(int ClientId); void ReleaseHooked(int ClientId);

View file

@ -3,7 +3,7 @@
#ifndef GAME_VERSION_H #ifndef GAME_VERSION_H
#define GAME_VERSION_H #define GAME_VERSION_H
#define DDRACE_VERSION "0.5 trunk, DDRace 1.01a" #define DDRACE_VERSION "0.5 trunk, DDRace 1.02a"
#define GAME_VERSION "0.5 trunk, DDRace 1.01a" #define GAME_VERSION "0.5 trunk, DDRace 1.02a"
#define GAME_NETVERSION "0.5 b67d1f1a1eea234e" #define GAME_NETVERSION "0.5 b67d1f1a1eea234e"
#endif #endif