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

9
.gitignore vendored
View file

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

View file

@ -136,7 +136,7 @@ function build(settings)
settings.cc.flags:Add("/wd4244")
settings.cc.flags:Add("/EHsc")
else
settings.cc.flags:Add("-Wall")
settings.cc.flags:Add("-Wall", "-fno-exceptions")
if platform == "macosx" then
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")
@ -150,8 +150,8 @@ function build(settings)
settings.cc.includes:Add("src")
settings.cc.includes:Add("other/mysql/include")
if family == "unix" then
if platform == "macosx" then
if family == "unix" then
if platform == "macosx" then
settings.link.frameworks:Add("Carbon")
settings.link.frameworks:Add("AppKit")
else
@ -193,7 +193,7 @@ function build(settings)
server_settings.link.libs:Add("mysqlclient")
end
if platform == "macosx" then
if platform == "macosx" then
client_settings.link.frameworks:Add("OpenGL")
client_settings.link.frameworks:Add("AGL")
client_settings.link.frameworks:Add("Carbon")
@ -428,3 +428,4 @@ else
build(release_nosql_settings)
DefaultTarget("game_debug")
end

View file

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

View file

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

View file

@ -1,4 +1,4 @@

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

View file

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

View file

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

View file

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

View file

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

View file

@ -1,4 +1,4 @@

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

View file

@ -1,4 +1,4 @@

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

View file

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

View file

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

View file

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

View file

@ -1,4 +1,4 @@

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

View file

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

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.
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:
Copyright (c) 2011 Magnus Auvinen
@ -11,5 +14,5 @@ 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
Please visit http://www.teeworlds.com for up-to-date information about
the game, including new versions, custom maps and much more.

View file

@ -187,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

@ -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)
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;
else
Info.m_Flags &= SERVER_FLAGS_ALL;
@ -2222,7 +2222,7 @@ void CClient::RegisterCommands()
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("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

@ -748,4 +748,4 @@ void CServerBrowser::ConfigSaveCallback(IConfig *pConfig, void *pUserData)
str_format(aBuffer, sizeof(aBuffer), "add_favorite %s", aAddrStr);
pConfig->WriteLine(aBuffer);
}
}
}

View file

@ -55,7 +55,7 @@ public:
virtual void PossibleCommands(const char *pStr, int FlagMask, FPossibleCallback pfnCallback, void *pUser) = 0;
virtual void ParseArguments(int NumArgs, const char **ppArguments) = 0;
virtual void Register(const char *pName, const char *pParams,
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) = 0;
virtual void Chain(const char *pName, FChainCommandCallback pfnChainFunc, void *pUser) = 0;

View file

@ -203,9 +203,10 @@ int CServer::TrySetClientName(int ClientID, const char *pName)
// trim the name
str_copy(aTrimmedName, StrLtrim(pName), sizeof(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);
Console()->Print(IConsole::OUTPUT_LEVEL_ADDINFO, "server", aBuf);*/
Console()->Print(IConsole::OUTPUT_LEVEL_ADDINFO, "server", aBuf);
pName = aTrimmedName;
@ -1565,8 +1566,6 @@ void CServer::ConCmdList(IConsole::IResult *pResult, void *pUserData, int Client
pSelf->Console()->List(pResult->GetInteger(0), CFGFLAG_SERVER);
}
void CServer::ConchainSpecialInfoupdate(IConsole::IResult *pResult, void *pUserData, IConsole::FCommandCallback pfnCallback, void *pCallbackUserData)
{
pfnCallback(pResult, pCallbackUserData, -1);
@ -1832,7 +1831,7 @@ void CServer::CheckPass(int ClientId, const char *pPw)
else
{
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);
}

View file

@ -19,7 +19,7 @@ class CSnapIDPool
{
enum
{
MAX_IDS = 32*1024,
MAX_IDS = 16*1024,//TODO
};
class CID
@ -102,7 +102,7 @@ public:
int m_Score;
int m_Authed;
int m_AuthTries;
NETADDR m_Addr;
void Reset();
@ -175,6 +175,7 @@ public:
void SendMap(int ClientId);
void SendRconLine(int ClientId, const char *pLine);
static void SendRconLineAuthed(const char *pLine, void *pUser);
static void SendRconResponse(const char *pLine, void *pUser);
struct RconResponseInfo
@ -212,9 +213,10 @@ public:
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 ConchainMaxclientsperipUpdate(IConsole::IResult *pResult, void *pUserData, IConsole::FCommandCallback pfnCallback, void *pCallbackUserData);
static void ConLogin(IConsole::IResult *pResult, void *pUser, int ClientId);
static void ConCmdList(IConsole::IResult *pResult, void *pUser, int ClientId);
static bool CompareClients(int ClientId, int Victim, void *pUser);
static bool ClientOnline(int ClientId, void *pUser);

View file

@ -125,7 +125,7 @@ public:
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
const size_t buffer_size = 1024;//i hope this will be enough
char buffer[buffer_size];
va_list ap;
va_start(ap, format);

View file

@ -14,21 +14,18 @@ struct CConfiguration
extern CConfiguration g_Config;
void dbg_msg1(const char * where, const char * format, ...);
enum
{
CFGFLAG_SAVE=1,
CFGFLAG_CLIENT=2,
CFGFLAG_SERVER=4,
CFGFLAG_STORE=8,
//DDRace
CMDFLAG_CHEAT=16,
CMDFLAG_TIMER=32,
CMDFLAG_HELPERCMD=64,
CMDFLAG_HELPERCMD=64
};
#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_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(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(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)
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_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(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(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_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)
@ -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(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_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(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_STR(SvRconPassword, sv_rcon_password, 32, "", CFGFLAG_SERVER, "Remote console password")
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, 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(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(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

View file

@ -61,7 +61,6 @@ void CConsole::CResult::SetVictim(const char *pVictim)
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
@ -197,50 +196,6 @@ void CConsole::RegisterPrintCallback(FPrintCallback pfnPrintCallback, void *pUse
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)
{
dbg_msg(pFrom ,"%s", pStr);
@ -249,9 +204,9 @@ void CConsole::Print(int Level, const char *pFrom, const char *pStr)
char aBuf[1024];
str_format(aBuf, sizeof(aBuf), "[%s]: %s", pFrom, pStr);
if (!m_pfnAlternativePrintCallback || m_PrintUsed == 0)
m_pfnPrintCallback(aBuf, m_pPrintCallbackUserdata);
else
m_pfnAlternativePrintCallback(aBuf, m_pAlternativePrintCallbackUserdata);
m_pfnPrintCallback(aBuf, m_pPrintCallbackUserdata);
else
m_pfnAlternativePrintCallback(aBuf, m_pAlternativePrintCallbackUserdata);
}
}
@ -304,46 +259,8 @@ bool CConsole::LineIsValid(const char *pStr)
return true;
}
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::ExecuteLineStroked(int Stroke, const char *pStr, const int ClientLevel, const int ClientId,
FPrintCallback pfnAlternativePrintCallback, void *pUserData,
FPrintCallback pfnAlternativePrintResponseCallback, void *pResponseUserData)
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)
{
@ -802,63 +719,12 @@ void CConsole::Register(const char *pName, const char *pParams,
pCommand->m_Flags = Flags;
pCommand->m_Level = Level;
pCommand->m_pNext = m_pFirstCommand;
m_pFirstCommand = pCommand;
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)
{
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); }
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,37 +71,38 @@ enum
enum
{
SERVER_TICK_SPEED=50,
//SERVER_FLAG_PASSWORD = 0x1,
SERVER_FLAG_PASSWORD = 0x1, // A
SERVER_FLAG_TEAMS = 0x100, // B
SERVER_FLAG_STRICTTEAMS = 0x200, // C
SERVER_FLAG_CHEATS = 0x1000, // D
SERVER_FLAG_PAUSE = 0x2000, // E
SERVER_FLAG_ENDLESSSUPERHOOKING = 0x4000, // F
SERVER_FLAG_TIMERCOMMANDS = 0x10000, // G
SERVER_FLAG_TIMECHEAT = 0x20000, // H
SERVER_FLAG_PAUSETIME = 0x40000, // I
SERVER_FLAG_PLAYERCOLLISION = 0x100000, // K
SERVER_FLAG_PLAYERHOOKING = 0x200000, // L
SERVER_FLAG_ENDLESSHOOKING = 0x400000, // M
SERVER_FLAG_HIT = 0x800000, // N
SERVER_FLAG_MAPTEST = 0x1000000, // O
SERVER_FLAG_SERVERTEST = 0x2000000, // P
SERVER_FLAG_PASSWORD = 0x1, // A
SERVER_FLAG_TEAMS = 0x100, // B
SERVER_FLAG_STRICTTEAMS = 0x200, // C
SERVER_FLAG_CHEATS = 0x1000, // D
SERVER_FLAG_PAUSE = 0x2000, // E
SERVER_FLAG_ENDLESSSUPERHOOKING = 0x4000, // F
SERVER_FLAG_TIMERCOMMANDS = 0x10000, // G
SERVER_FLAG_TIMECHEAT = 0x20000, // H
SERVER_FLAG_PAUSETIME = 0x40000, // I
SERVER_FLAG_PLAYERCOLLISION = 0x100000, // K
SERVER_FLAG_PLAYERHOOKING = 0x200000, // L
SERVER_FLAG_ENDLESSHOOKING = 0x400000, // M
SERVER_FLAG_HIT = 0x800000, // N
SERVER_FLAG_MAPTEST = 0x1000000, // O
SERVER_FLAG_SERVERTEST = 0x2000000, // P
SERVER_FLAG_VERSION = 0x10000000,
SERVER_FLAG_VERSION = 0x10000000,
SERVER_FLAGS_DEFAULT = 0x1,
SERVER_FLAGS_TEAMS = 0x30,
SERVER_FLAGS_CHEATS = 0x700,
SERVER_FLAGS_TIME = 0x7000,
SERVER_FLAGS_GAMEPLAY = 0xF0000,
SERVER_FLAGS_TESTING = 0x300000,
SERVER_FLAGS_VERSION = 0xF000000,
SERVER_FLAGS_DEFAULT = 0x1,
SERVER_FLAGS_TEAMS = 0x30,
SERVER_FLAGS_CHEATS = 0x700,
SERVER_FLAGS_TIME = 0x7000,
SERVER_FLAGS_GAMEPLAY = 0xF0000,
SERVER_FLAGS_TESTING = 0x300000,
SERVER_FLAGS_VERSION = 0xF000000,
SERVER_FLAGS_ALL = 0xF3F7731,
SERVER_FLAGS_ALL = 0xF3F7731,
// version | testing | gameplay | time | cheats | teams | unused | default
// 0001 | 00PO | NMLK | 0IHG | 0FED | 00CB | 0000 | 000A - 0 means unused, letter means used
// version | testing | gameplay | time | cheats | teams | unused | default
// 0001 | 00PO | NMLK | 0IHG | 0FED | 00CB | 0000 | 000A - 0 means unused, letter means used
MAX_CLIENTS=16,

View file

@ -10,20 +10,6 @@
#include "camera.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()
{
m_Zoom = 1.0f;
@ -33,7 +19,6 @@ CCamera::CCamera()
void CCamera::OnRender()
{
//vec2 center;
// update camera center
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, 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();
}
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()
{
// 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 OnRelease();
bool Active();
};

View file

@ -44,6 +44,7 @@
#include "components/skins.h"
#include "components/sounds.h"
#include "components/voting.h"
#include <base/tl/sorted_array.h>
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");
}
#include <base/tl/sorted_array.h>
const char *CGameClient::Version() { return GAME_VERSION; }
const char *CGameClient::NetVersion() { return GAME_NETVERSION; }
const char *CGameClient::GetItemName(int Type) { return m_NetObjHandler.GetObjName(Type); }
@ -306,7 +305,7 @@ void CGameClient::OnInit()
Console()->Print(IConsole::OUTPUT_LEVEL_DEBUG, "gameclient", aBuf);
m_ServerMode = SERVERMODE_PURE;
m_DDRaceMsgSent = false;
}
@ -394,6 +393,7 @@ void CGameClient::OnReset()
for(int i = 0; i < m_All.m_Num; i++)
m_All.m_paComponents[i]->OnReset();
m_Teams.Reset();
m_DDRaceMsgSent = false;
}
@ -425,6 +425,7 @@ static void Evolve(CNetObj_Character *pCharacter, int Tick)
CCharacterCore TempCore;
CTeamsCore TempTeams;
mem_zero(&TempCore, sizeof(TempCore));
mem_zero(&TempTeams, sizeof(TempTeams));
TempCore.Init(&TempWorld, g_GameClient.Collision(), &TempTeams);
TempCore.Read(pCharacter);
@ -579,7 +580,7 @@ void CGameClient::OnMessage(int MsgId, CUnpacker *pUnpacker)
g_GameClient.m_pSounds->Enqueue(pMsg->m_Soundid);
else
g_GameClient.m_pSounds->Play(CSounds::CHN_GLOBAL, pMsg->m_Soundid, 1.0f, vec2(0,0));
}
}
else if(MsgId == NETMSGTYPE_CL_TEAMSSTATE) {
CNetMsg_Cl_TeamsState *pMsg = (CNetMsg_Cl_TeamsState *)pRawMsg;
m_Teams.Team(0, pMsg->m_Tee0);
@ -606,7 +607,6 @@ void CGameClient::OnMessage(int MsgId, CUnpacker *pUnpacker)
CNetMsg_Sv_PlayerTime *pMsg = (CNetMsg_Sv_PlayerTime *)pRawMsg;
m_aClients[pMsg->m_Cid].m_Score = pMsg->m_Time;
}
}
void CGameClient::OnStateChange(int NewState, int OldState)
@ -857,7 +857,7 @@ void CGameClient::OnNewSnapshot()
else
m_ServerMode = SERVERMODE_PUREMOD;
}
if(!m_DDRaceMsgSent && m_Snap.m_pLocalInfo)
{
CNetMsg_Cl_IsDDRace Msg;
@ -1072,4 +1072,4 @@ void CGameClient::ConchainSpecialInfoupdate(IConsole::IResult *pResult, void *pU
IGameClient *CreateGameClient()
{
return &g_GameClient;
}
}

View file

@ -56,7 +56,7 @@ class CGameClient : public IGameClient
int m_LastNewPredictedTick;
int64 m_LastSendInfo;
bool m_DDRaceMsgSent;
static void ConTeam(IConsole::IResult *pResult, void *pUserData, int ClientID);
@ -157,7 +157,7 @@ public:
CCharacterCore m_Predicted;
int m_Score;
CTeeRenderInfo m_SkinInfo; // this is what the server reports
CTeeRenderInfo m_RenderInfo; // this is what we use

View file

@ -442,4 +442,4 @@ void CRenderTools::RenderSwitchmap(CSwitchTile *pSwitch, int w, int h, float Sca
}
Graphics()->MapScreen(ScreenX0, ScreenY0, ScreenX1, ScreenY1);
}
}

View file

@ -53,6 +53,7 @@ void CCollision::Init(class CLayers *pLayers)
m_Width = m_pLayers->GameLayer()->m_Width;
m_Height = m_pLayers->GameLayer()->m_Height;
m_pTiles = static_cast<CTile *>(m_pLayers->Map()->GetData(m_pLayers->GameLayer()->m_Data));
if(m_pLayers->TeleLayer())
m_pTele = static_cast<CTeleTile *>(m_pLayers->Map()->GetData(m_pLayers->TeleLayer()->m_Tele));
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 nx = clamp(x/32, 0, m_Width-1);
@ -307,255 +184,29 @@ int CCollision::GetTile(int x, int y)
return 0;
}
int CCollision::GetFTile(int x, int y)
/*bool CCollision::IsTileSolid(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;
}
return GetTile(x,y)&COLFLAG_SOLID;
}*/
// 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)
{
float d = distance(Pos0, Pos1);
int End(d+1);
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++)
{
float a = i/d;
vec2 Pos = mix(Pos0, Pos1, a);
ix = round(Pos.x);
iy = round(Pos.y);
if(CheckPoint(ix, iy) && !(AllowThrough && IsThrough(ix + dx, iy + dy)))
if(CheckPoint(Pos.x, Pos.y))
{
if(pOutCollision)
*pOutCollision = Pos;
if(pOutBeforeCollision)
*pOutBeforeCollision = Last;
return GetCollisionAt(ix, iy);
}
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));
return GetCollisionAt(Pos.x, Pos.y);
}
Last = Pos;
}
@ -571,7 +222,7 @@ void CCollision::MovePoint(vec2 *pInoutPos, vec2 *pInoutVel, float Elasticity, i
{
if(pBounces)
*pBounces = 0;
vec2 Pos = *pInoutPos;
vec2 Vel = *pInoutVel;
if(CheckPoint(Pos + Vel))
@ -581,7 +232,7 @@ void CCollision::MovePoint(vec2 *pInoutPos, vec2 *pInoutVel, float Elasticity, i
{
pInoutVel->x *= -Elasticity;
if(pBounces)
(*pBounces)++;
(*pBounces)++;
Affected++;
}
@ -589,10 +240,10 @@ void CCollision::MovePoint(vec2 *pInoutPos, vec2 *pInoutVel, float Elasticity, i
{
pInoutVel->y *= -Elasticity;
if(pBounces)
(*pBounces)++;
(*pBounces)++;
Affected++;
}
if(Affected == 0)
{
pInoutVel->x *= -Elasticity;
@ -605,64 +256,6 @@ void CCollision::MovePoint(vec2 *pInoutPos, vec2 *pInoutVel, float Elasticity, i
}
}
void CCollision::MoveBox(vec2 *pInoutPos, vec2 *pInoutVel, vec2 Size, float Elasticity)
{
// do the move
vec2 Pos = *pInoutPos;
vec2 Vel = *pInoutVel;
float Distance = length(Vel);
int Max = (int)Distance;
if(Distance > 0.00001f)
{
//vec2 old_pos = pos;
float Fraction = 1.0f/(float)(Max+1);
for(int i = 0; i <= Max; i++)
{
//float amount = i/(float)max;
//if(max == 0)
//amount = 0;
vec2 NewPos = Pos + Vel*Fraction; // TODO: this row is not nice
if(TestBox(vec2(NewPos.x, NewPos.y), Size))
{
int Hits = 0;
if(TestBox(vec2(Pos.x, NewPos.y), Size))
{
NewPos.y = Pos.y;
Vel.y *= -Elasticity;
Hits++;
}
if(TestBox(vec2(NewPos.x, Pos.y), Size))
{
NewPos.x = Pos.x;
Vel.x *= -Elasticity;
Hits++;
}
// neither of the tests got a collision.
// this is a real _corner case_!
if(Hits == 0)
{
NewPos.y = Pos.y;
Vel.y *= -Elasticity;
NewPos.x = Pos.x;
Vel.x *= -Elasticity;
}
}
Pos = NewPos;
}
}
*pInoutPos = Pos;
*pInoutVel = Vel;
}
bool CCollision::TestBox(vec2 Pos, vec2 Size)
{
Size *= 0.5f;
@ -677,6 +270,64 @@ bool CCollision::TestBox(vec2 Pos, vec2 Size)
return false;
}
void CCollision::MoveBox(vec2 *pInoutPos, vec2 *pInoutVel, vec2 Size, float Elasticity)
{
// do the move
vec2 Pos = *pInoutPos;
vec2 Vel = *pInoutVel;
float Distance = length(Vel);
int Max = (int)Distance;
if(Distance > 0.00001f)
{
//vec2 old_pos = pos;
float Fraction = 1.0f/(float)(Max+1);
for(int i = 0; i <= Max; i++)
{
//float amount = i/(float)max;
//if(max == 0)
//amount = 0;
vec2 NewPos = Pos + Vel*Fraction; // TODO: this row is not nice
if(TestBox(vec2(NewPos.x, NewPos.y), Size))
{
int Hits = 0;
if(TestBox(vec2(Pos.x, NewPos.y), Size))
{
NewPos.y = Pos.y;
Vel.y *= -Elasticity;
Hits++;
}
if(TestBox(vec2(NewPos.x, Pos.y), Size))
{
NewPos.x = Pos.x;
Vel.x *= -Elasticity;
Hits++;
}
// neither of the tests got a collision.
// this is a real _corner case_!
if(Hits == 0)
{
NewPos.y = Pos.y;
Vel.y *= -Elasticity;
NewPos.x = Pos.x;
Vel.x *= -Elasticity;
}
}
Pos = NewPos;
}
}
*pInoutPos = Pos;
*pInoutVel = Vel;
}
int CCollision::IsSolid(int x, int y)
{
return (GetTile(x,y)&COLFLAG_SOLID);
@ -844,32 +495,378 @@ vec2 CCollision::CpSpeed(int Index, int Flags)
{
if(Index < 0)
return vec2(0,0);
vec2 target;
if(Index == TILE_CP || Index == TILE_CP_F)
switch(Flags)
{
case ROTATION_0:
target.x=0;
target.y=-4;
break;
case ROTATION_90:
target.x=4;
target.y=0;
break;
case ROTATION_180:
target.x=0;
target.y=4;
break;
case ROTATION_270:
target.x=-4;
target.y=0;
break;
default:
target=vec2(0,0);
break;
}
if (Index == TILE_CP_F)
vec2 target;
if(Index == TILE_CP || Index == TILE_CP_F)
switch(Flags)
{
case ROTATION_0:
target.x=0;
target.y=-4;
break;
case ROTATION_90:
target.x=4;
target.y=0;
break;
case ROTATION_180:
target.x=0;
target.y=4;
break;
case ROTATION_270:
target.x=-4;
target.y=0;
break;
default:
target=vec2(0,0);
break;
}
if(Index == TILE_CP_F)
target*=4;
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];
};
//bool IsTileSolid(int x, int y);
public:
enum
{
COLFLAG_SOLID=1,
COLFLAG_DEATH=2,
COLFLAG_NOHOOK=4,
//DDRace
COLFLAG_NOLASER=8,
COLFLAG_THROUGH=16
};
CCollision();
void Dest();
void Init(class CLayers *pLayers);

View file

@ -2564,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)
{
@ -3427,4 +3427,4 @@ void CEditor::UpdateAndRender()
Input()->ClearEvents();
}
IEditor *CreateEditor() { return new CEditor; }
IEditor *CreateEditor() { return new CEditor; }

View file

@ -634,4 +634,4 @@ int CEditor::PopupSwitch(CEditor *pEditor, CUIRect View)
pEditor->m_SwitchDelay = clamp(NewVal, 0, 255);
return 0;
}
}

View file

@ -77,24 +77,6 @@ void CCharacterCore::Reset()
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)
{
float PhysSize = 28.0f;
@ -317,11 +299,8 @@ void CCharacterCore::Tick(bool UseInput)
if(m_HookedPlayer != -1)
{
CCharacterCore *p = m_pWorld->m_apCharacters[m_HookedPlayer];
if(p)
{
m_HookPos = p->m_Pos;
}
m_HookPos = p->m_Pos;
else
{
// release hook
@ -492,3 +471,22 @@ void CCharacterCore::Quantize()
Write(&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 "mapitems.h"
class CTuneParam
{
int m_Value;
@ -170,7 +171,6 @@ public:
}
CTuningParams m_Tuning;
class CCharacterCore *m_apCharacters[MAX_CLIENTS];
};

View file

@ -17,14 +17,6 @@ CLayers::CLayers()
m_pMap = 0;
}
void CLayers::Dest()
{
m_pTeleLayer = 0;
m_pSpeedupLayer = 0;
m_pFrontLayer = 0;
m_pSwitchLayer = 0;
}
void CLayers::Init(class IKernel *pKernel)
{
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));
}
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)
: CEntity(pGameWorld, NETOBJTYPE_FLAG)
{
m_Number = Team;
m_Team = Team;
m_ProximityRadius = ms_PhysSize;
m_pCarryingCharacter = NULL;
m_GrabTick = 0;
@ -26,13 +26,13 @@ void CFlag::Reset()
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)
return;
pFlag->m_X = (int)m_Pos.x;
pFlag->m_Y = (int)m_Pos.y;
pFlag->m_Number = m_Number;
pFlag->m_Team = m_Team;
pFlag->m_CarriedBy = -1;
if(m_AtStand)

View file

@ -1,6 +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. */
/*#ifndef GAME_SERVER_ENTITIES_FLAG_H
/*
#ifndef GAME_SERVER_ENTITIES_FLAG_H
#define GAME_SERVER_ENTITIES_FLAG_H
@ -14,7 +14,7 @@ public:
vec2 m_Vel;
vec2 m_StandPos;
int m_Number;
int m_Team;
int m_AtStand;
int m_DropTick;
int m_GrabTick;
@ -26,4 +26,4 @@ public:
};
#endif
*/
*/

View file

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

View file

@ -1,7 +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 <game/mapitems.h>
=======
/*
#include <game/mapitems.h>
#include <game/server/entities/character.h>
#include <game/server/entities/flag.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))
continue;
if(apCloseCCharacters[i]->GetPlayer()->GetTeam() == F->m_Number)
if(apCloseCCharacters[i]->GetPlayer()->GetTeam() == F->m_Team)
{
// return the flag
if(!F->m_AtStand)
@ -213,4 +213,4 @@ void CGameControllerCTF::Tick()
}
}
}
*/
*/

View file

@ -1,6 +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. */
/* #ifndef GAME_SERVER_GAMEMODES_CTF_H
/*
#ifndef GAME_SERVER_GAMEMODES_CTF_H
#define GAME_SERVER_GAMEMODES_CTF_H
#include <game/server/gamecontroller.h>
@ -21,4 +21,4 @@ public:
#endif
*/
*/

View file

@ -15,4 +15,4 @@ void CGameControllerDM::Tick()
DoPlayerScoreWincheck();
IGameController::Tick();
}
*/
*/

View file

@ -1,6 +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. */
/*#ifndef GAME_SERVER_GAMEMODES_DM_H
/*
#ifndef GAME_SERVER_GAMEMODES_DM_H
#define GAME_SERVER_GAMEMODES_DM_H
#include <game/server/gamecontroller.h>
@ -12,4 +12,4 @@ public:
virtual void Tick();
};
#endif
*/
*/

View file

@ -21,4 +21,4 @@ void CGameControllerMOD::Tick()
IGameController::Tick();
}
*/
*/

View file

@ -15,4 +15,4 @@ public:
// add more virtual functions here if you wish
};
#endif
*/
*/

View file

@ -33,4 +33,4 @@ void CGameControllerTDM::Tick()
DoTeamScoreWincheck();
IGameController::Tick();
}
*/
*/

View file

@ -1,6 +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. */
/* #ifndef GAME_SERVER_GAMEMODES_TDM_H
/*
#ifndef GAME_SERVER_GAMEMODES_TDM_H
#define GAME_SERVER_GAMEMODES_TDM_H
#include <game/server/gamecontroller.h>
@ -14,4 +14,4 @@ public:
virtual void Tick();
};
#endif
*/
*/

View file

@ -12,7 +12,7 @@ CGameWorld::CGameWorld()
{
m_pGameServer = 0x0;
m_pServer = 0x0;
m_Paused = false;
m_ResetRequested = false;
m_pFirstEntity = 0x0;
@ -161,7 +161,7 @@ void CGameWorld::Tick()
// update all objects
for(CEntity *pEnt = m_pFirstEntity; pEnt; pEnt = pEnt->m_pNextEntity)
pEnt->Tick();
for(CEntity *pEnt = m_pFirstEntity; pEnt; pEnt = pEnt->m_pNextEntity)
pEnt->TickDefered();
}
@ -197,22 +197,23 @@ CCharacter *CGameWorld::IntersectCharacter(vec2 Pos0, vec2 Pos1, float Radius, v
}
}
}
return pClosest;
}
CCharacter *CGameWorld::ClosestCharacter(vec2 Pos, float Radius, CEntity *pNotThis)
{
// Find other players
float ClosestRange = Radius*2;
CCharacter *pClosest = 0;
CCharacter *p = (CCharacter *)GameServer()->m_World.FindFirst(NETOBJTYPE_CHARACTER);
for(; p; p = (CCharacter *)p->TypeNext())
{
if(p == pNotThis)
continue;
float Len = distance(Pos, p->m_Pos);
if(Len < p->m_ProximityRadius+Radius)
{
@ -223,10 +224,9 @@ CCharacter *CGameWorld::ClosestCharacter(vec2 Pos, float Radius, CEntity *pNotTh
}
}
}
return pClosest;
}
std::list<class CCharacter *> CGameWorld::IntersectedCharacters(vec2 Pos0, vec2 Pos1, float Radius, class CEntity *pNotThis)
{
std::list< CCharacter * > listOfChars;
@ -262,4 +262,4 @@ void CGameWorld::ReleaseHooked(int ClientId)
p->m_Core.m_HookState = HOOK_RETRACTED;
}
}
}

View file

@ -63,18 +63,18 @@ public:
Number of entities found and added to the ents array.
*/
int FindEntities(vec2 Pos, float Radius, CEntity **ppEnts, int Max, int Type = -1);
/*
Function: InterserctCharacters
Finds the CCharacters that intersects the line. // made for types lasers=1 and doors=0
Arguments:
pos0 - Start position
pos2 - End position
radius - How for from the line the CCharacter is allowed to be.
new_pos - Intersection position
notthis - Entity to ignore intersecting with
Returns:
Returns a pointer to the closest hit or NULL of there is no intersection.
*/
@ -140,7 +140,6 @@ public:
*/
void Tick();
std::list<class CCharacter *> IntersectedCharacters(vec2 Pos0, vec2 Pos1, float Radius, vec2 &NewPos, class CEntity *pNotThis);
void ReleaseHooked(int ClientId);

View file

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