Conflicts:
	src/game/server/entities/character.cpp
	src/game/server/entities/flag.cpp
	src/game/server/player.cpp
	src/game/variables.h
This commit is contained in:
GreYFoXGTi 2010-12-16 06:06:23 +02:00
commit e803f30f52
15 changed files with 268 additions and 137 deletions

View file

@ -1,10 +1,49 @@
import os, sys, shutil, httplib, zipfile
import imp, optparse, os, re, shutil, sys, zipfile
from optparse import OptionParser
if sys.version_info[0] == 2:
import urllib
url_lib = urllib
elif sys.version_info[0] == 3:
import urllib.request
url_lib = urllib.request
match = re.search("(.*?)/[^/]*?$", sys.argv[0])
if match != None:
os.chdir(os.getcwd() + "/" + match.group(1))
url_bam = "http://github.com/matricks/bam/zipball/master"
url_teeworlds = "http://github.com/oy/teeworlds/zipball/master"
release_type = "server_release client_release"
arguments = OptionParser()
arguments.add_option("-b", "--url_bam", dest = "url_bam")
arguments.add_option("-t", "--url_teeworlds", dest = "url_teeworlds")
arguments.add_option("-r", "--release_type", dest = "release_type")
(options, arguments) = arguments.parse_args()
if options.url_bam == None:
options.url_bam = url_bam
if options.url_teeworlds == None:
options.url_teeworlds = url_teeworlds
if options.release_type == None:
options.release_type = release_type
bam = options.url_bam[7:].split("/")
version_bam = re.search(r"\d\.\d\.\d", bam[len(bam)-1])
if version_bam:
version_bam = version_bam.group(0)
else:
version_bam = "trunk"
teeworlds = options.url_teeworlds[7:].split("/")
version_teeworlds = re.search(r"\d\.\d\.\d", teeworlds[len(teeworlds)-1])
if version_teeworlds:
version_teeworlds = version_teeworlds.group(0)
else:
version_teeworlds = "trunk"
bam_execution_path = ""
if version_bam < "0.3.0":
bam_execution_path = "src%s" % os.sep
name = "teeworlds"
domain = "www.%s.com" % name
version = sys.argv[1]
bam_version = "bam-0.2.0"
flag_download = True
flag_clean = True
@ -16,138 +55,197 @@ else:
osname = os.popen("uname").readline().strip().lower()
if osname == "darwin":
osname = "osx"
# get arch
machine = os.popen("uname -m").readline().strip().lower()
arch = "unknown"
if machine[0] == "i" and machine[2:] == "86":
arch = "x86"
elif machine == "x86_64":
arch = "x86_64"
elif "power" in machine.lower():
arch = "ppc"
platform = osname + "_" + arch
print "%s-%s-%s" % (name,version, platform)
print("%s-%s-%s" % (name, version_teeworlds, platform))
src_package = "%s-%s-src.zip" % (name, version)
root_dir = os.getcwd() + os.sep
work_dir = root_dir + "work"
root_dir = os.getcwd() + "/work"
src_dir = ""
def fetch_file(server, url, local):
def fetch_file(url):
try:
conn = httplib.HTTPConnection(server)
print "trying %s%s" % (server, url)
conn.request("GET", url)
response = conn.getresponse()
if response.status != 200:
return False
f = file(local, "wb")
f.write(response.read())
f.close()
conn.close()
return True
print("trying %s" % url)
real_url = url_lib.urlopen(url).geturl()
local = real_url.split("/")
local = local[len(local)-1].split("?")
local = local[0]
url_lib.urlretrieve(real_url, local)
return local
except:
pass
return False
return False
def unzip(filename, where):
z = zipfile.ZipFile(filename, "r")
try:
z = zipfile.ZipFile(filename, "r")
except:
return False
list = "\n"
for name in z.namelist():
list += "%s\n" % name
try: os.makedirs(where+"/"+os.path.dirname(name))
except: pass
try:
f = file(where+"/"+name, "wb")
f = open(where+"/"+name, "wb")
f.write(z.read(name))
f.close()
except: pass
z.close()
def path_exist(d):
try: os.stat(d)
except: return False
return True
directory = "[^/\n]*?/"
part_1 = "(?<=\n)"
part_2 = "[^/\n]+(?=\n)"
regular_expression = r"%s%s" % (part_1, part_2)
main_directory = re.search(regular_expression, list)
while main_directory == None:
part_1 += directory
regular_expression = r"%s%s" % (part_1, part_2)
main_directory = re.search(regular_expression, list)
main_directory = re.search(r".*/", "./%s" % main_directory.group(0))
return main_directory.group(0)
def bail(reason):
print reason
os.chdir(root_dir)
print(reason)
os.chdir(work_dir)
sys.exit(-1)
def clean():
print("*** cleaning ***")
try: shutil.rmtree("work")
except: pass
def file_exists(file):
try:
open(file).close()
return True
except:
return False;
# clean
if flag_clean:
print "*** cleaning ***"
try: shutil.rmtree("work")
except: pass
clean()
# make dir
try: os.mkdir("work")
except: pass
# change dir
os.chdir(root_dir)
os.chdir(work_dir)
# download
if flag_download:
print "*** downloading bam source package ***"
if not fetch_file(domain, "trac/bam/browser/releases/"+bam_version+".zip?format=raw", "bam.zip"):
bail("couldn't find source package and couldn't download it")
print "*** downloading %s source package ***" % name
if not fetch_file(domain, "/files/%s" % src_package, src_package):
if not fetch_file(domain, "/files/beta/%s" % src_package, src_package):
bail("couldn't find source package and couldn't download it")
print("*** downloading bam source package ***")
src_package_bam = fetch_file(options.url_bam)
if src_package_bam:
if version_bam == 'trunk':
version = re.search(r"-[^-]*?([^-]*?)\.[^.]*$", src_package_bam)
if version:
version_bam = version.group(1)
else:
bail("couldn't find source package and couldn't download it")
print("*** downloading %s source package ***" % name)
src_package_teeworlds = fetch_file(options.url_teeworlds)
if src_package_teeworlds:
if version_teeworlds == 'trunk':
version = re.search(r"-[^-]*?([^-]*?)\.[^.]*$", src_package_teeworlds)
if version:
version_teeworlds = version.group(1)
else:
bail("couldn't find source package and couldn't download it")
# unpack
print "*** unpacking source ***"
unzip("bam.zip", ".")
unzip(src_package, name)
src_dir = name+"/"+ os.listdir(name+"/")[0]
print("*** unpacking source ***")
src_dir_bam = unzip(src_package_bam, ".")
if not src_dir_bam:
bail("couldn't unpack source package")
src_dir_teeworlds = unzip(src_package_teeworlds, ".")
if not src_dir_teeworlds:
bail("couldn't unpack source package")
# build bam
if 1:
print "*** building bam ***"
os.chdir(bam_version)
output = "bam"
bam_cmd = "./bam"
print("*** building bam ***")
os.chdir("%s/%s" % (work_dir, src_dir_bam))
if os.name == "nt":
if os.system("make_win32_msvc.bat") != 0:
bam_compiled = False
compiler_bam = ["cl", "gcc"]
for compiler in compiler_bam:
if compiler == "cl":
os.system("make_win32_msvc.bat")
elif compiler == "gcc":
os.system("make_win32_mingw.bat")
if file_exists("%sbam.exe" % bam_execution_path) == True:
bam_compiled = True
break
if bam_compiled == False:
bail("failed to build bam")
output += ".exe"
bam_cmd = "bam"
else:
if os.system("sh make_unix.sh") != 0:
os.system("sh make_unix.sh")
if file_exists("%sbam" % bam_execution_path) == False:
bail("failed to build bam")
os.chdir(root_dir)
shutil.copy(bam_version+"/src/"+output, src_dir+"/"+output)
os.chdir(work_dir)
# build the game
if 1:
print "*** building %s ***" % name
os.chdir(src_dir)
if os.system("%s server_release client_release" % bam_cmd) != 0:
print("*** building %s ***" % name)
command = 1
if os.name == "nt":
file = open("build.bat", "wb")
content = "@echo off\n"
content += "@REM check if we already have the tools in the environment\n"
content += "if exist \"%VCINSTALLDIR%\" (\ngoto compile\n)\n"
content += "@REM Check for Visual Studio\n"
content += "if exist \"%VS100COMNTOOLS%\" (\nset VSPATH=\"%VS100COMNTOOLS%\"\ngoto set_env\n)\n"
content += "if exist \"%VS90COMNTOOLS%\" (\nset VSPATH=\"%VS90COMNTOOLS%\"\ngoto set_env\n)\n"
content += "if exist \"%VS80COMNTOOLS%\" (\nset VSPATH=\"%VS80COMNTOOLS%\"\ngoto set_env\n)\n\n"
content += "echo You need Microsoft Visual Studio 8, 9 or 10 installed\n"
content += "exit\n"
content += "@ setup the environment\n"
content += ":set_env\n"
content += "call %VSPATH%vsvars32.bat\n\n"
content += ":compile\n"
content += 'cd %s\n"%s\\%s%sbam" config\n"%s\\%s%sbam" %s' % (src_dir_teeworlds, work_dir, src_dir_bam, bam_execution_path, work_dir, src_dir_bam, bam_execution_path, options.release_type)
file.write(content)
file.close()
command = os.system("build.bat")
else:
os.chdir(src_dir_teeworlds)
command = os.system("%s/%s%sbam %s" % (work_dir, src_dir_bam, bam_execution_path, options.release_type))
if command != 0:
bail("failed to build %s" % name)
os.chdir(root_dir)
os.chdir(work_dir)
# make release
if 1:
print "*** making release ***"
os.chdir(src_dir)
if os.system("python scripts/make_release.py %s %s" % (version, platform)) != 0:
bail("failed to make a relase of %s"%name)
print("*** making release ***")
os.chdir(src_dir_teeworlds)
command = '"%smake_release.py" %s %s' % (root_dir, version_teeworlds, platform)
if os.name != "nt":
command = "python %s" % command
if os.system(command) != 0:
bail("failed to make a relase of %s" % name)
final_output = "FAIL"
for f in os.listdir("."):
if version in f and platform in f and name in f and (".zip" in f or ".tar.gz" in f):
if version_teeworlds in f and platform in f and name in f and (".zip" in f or ".tar.gz" in f):
final_output = f
os.chdir(work_dir)
shutil.copy("%s/%s" % (src_dir_teeworlds, final_output), "../"+final_output)
os.chdir(root_dir)
shutil.copy("%s/%s" % (src_dir, final_output), "../"+final_output)
clean()
print "*** all done ***"
print("*** all done ***")

View file

@ -119,6 +119,8 @@ int CSnapIDPool::NewID()
int Id = m_FirstFree;
dbg_assert(Id != -1, "id error");
if(Id == -1)
return Id;
m_FirstFree = m_aIDs[m_FirstFree].m_Next;
m_aIDs[Id].m_State = 1;
m_Usage++;
@ -135,6 +137,8 @@ void CSnapIDPool::TimeoutIDs()
void CSnapIDPool::FreeID(int Id)
{
if(Id < 0)
return;
dbg_assert(m_aIDs[Id].m_State == 1, "id is not alloced");
m_InUsage--;
@ -1616,7 +1620,7 @@ void *CServer::SnapNewItem(int Type, int Id, int Size)
{
dbg_assert(Type >= 0 && Type <=0xffff, "incorrect type");
dbg_assert(Id >= 0 && Id <=0xffff, "incorrect id");
return m_SnapshotBuilder.NewItem(Type, Id, Size);
return Id < 0 ? 0 : m_SnapshotBuilder.NewItem(Type, Id, Size);
}
void CServer::SnapSetStaticsize(int ItemType, int Size)

View file

@ -21,8 +21,10 @@ void CBroadcast::OnRender()
if(time_get() < m_BroadcastTime)
{
float w = TextRender()->TextWidth(0, 14, m_aBroadcastText, -1);
TextRender()->Text(0, 150*Graphics()->ScreenAspect()-w/2, 35, 14, m_aBroadcastText, -1);
CTextCursor Cursor;
TextRender()->SetCursor(&Cursor, m_BroadcastRenderOffset, 40.0f, 12.0f, TEXTFLAG_RENDER|TEXTFLAG_STOP_AT_END);
Cursor.m_LineWidth = 300*Graphics()->ScreenAspect()-2*m_BroadcastRenderOffset;
TextRender()->TextEx(&Cursor, m_aBroadcastText, -1);
}
}
@ -32,6 +34,11 @@ void CBroadcast::OnMessage(int MsgType, void *pRawMsg)
{
CNetMsg_Sv_Broadcast *pMsg = (CNetMsg_Sv_Broadcast *)pRawMsg;
str_copy(m_aBroadcastText, pMsg->m_pMessage, sizeof(m_aBroadcastText));
CTextCursor Cursor;
TextRender()->SetCursor(&Cursor, 0, 0, 12.0f, TEXTFLAG_STOP_AT_END);
Cursor.m_LineWidth = 300*Graphics()->ScreenAspect();
TextRender()->TextEx(&Cursor, m_aBroadcastText, -1);
m_BroadcastRenderOffset = 150*Graphics()->ScreenAspect()-Cursor.m_X/2;
m_BroadcastTime = time_get()+time_freq()*10;
}
}

View file

@ -6,11 +6,12 @@
class CBroadcast : public CComponent
{
public:
// broadcasts
char m_aBroadcastText[1024];
int64 m_BroadcastTime;
float m_BroadcastRenderOffset;
public:
virtual void OnReset();
virtual void OnRender();
virtual void OnMessage(int MsgType, void *pRawMsg);

View file

@ -324,7 +324,7 @@ void CChat::OnRender()
for(int i = 0; i < MAX_LINES; i++)
{
int r = ((m_CurrentLine-i)+MAX_LINES)%MAX_LINES;
if(Now > m_aLines[r].m_Time+15*time_freq() && !m_Show)
if(Now > m_aLines[r].m_Time+16*time_freq() && !m_Show)
break;
// get the y offset (calculate it if we haven't done that yet)
@ -342,35 +342,37 @@ void CChat::OnRender()
if(y < HeightLimit)
break;
float Blend = Now > m_aLines[r].m_Time+14*time_freq() && !m_Show ? 1.0f-(Now-m_aLines[r].m_Time-14*time_freq())/(2.0f*time_freq()) : 1.0f;
// reset the cursor
TextRender()->SetCursor(&Cursor, Begin, y, FontSize, TEXTFLAG_RENDER);
Cursor.m_LineWidth = LineWidth;
// render name
if(m_aLines[r].m_ClientId == -1)
TextRender()->TextColor(1.0f, 1.0f, 0.5f, 1.0f); // system
TextRender()->TextColor(1.0f, 1.0f, 0.5f, Blend); // system
else if(m_aLines[r].m_Team)
TextRender()->TextColor(0.45f, 0.9f, 0.45f, 1.0f); // team message
TextRender()->TextColor(0.45f, 0.9f, 0.45f, Blend); // team message
else if(m_aLines[r].m_NameColor == 0)
TextRender()->TextColor(1.0f, 0.5f, 0.5f, 1.0f); // red
TextRender()->TextColor(1.0f, 0.5f, 0.5f, Blend); // red
else if(m_aLines[r].m_NameColor == 1)
TextRender()->TextColor(0.7f, 0.7f, 1.0f, 1.0f); // blue
TextRender()->TextColor(0.7f, 0.7f, 1.0f, Blend); // blue
else if(m_aLines[r].m_NameColor == -1)
TextRender()->TextColor(0.75f, 0.5f, 0.75f, 1.0f); // spectator
TextRender()->TextColor(0.75f, 0.5f, 0.75f, Blend); // spectator
else
TextRender()->TextColor(0.8f, 0.8f, 0.8f, 1.0f);
TextRender()->TextColor(0.8f, 0.8f, 0.8f, Blend);
TextRender()->TextEx(&Cursor, m_aLines[r].m_aName, -1);
// render line
if(m_aLines[r].m_ClientId == -1)
TextRender()->TextColor(1.0f, 1.0f, 0.5f, 1.0f); // system
TextRender()->TextColor(1.0f, 1.0f, 0.5f, Blend); // system
else if(m_aLines[r].m_Highlighted)
TextRender()->TextColor(1.0f, 0.5f, 0.5f, 1.0f); // highlighted
TextRender()->TextColor(1.0f, 0.5f, 0.5f, Blend); // highlighted
else if(m_aLines[r].m_Team)
TextRender()->TextColor(0.65f, 1.0f, 0.65f, 1.0f); // team message
TextRender()->TextColor(0.65f, 1.0f, 0.65f, Blend); // team message
else
TextRender()->TextColor(1.0f, 1.0f, 1.0f, 1.0f);
TextRender()->TextColor(1.0f, 1.0f, 1.0f, Blend);
TextRender()->TextEx(&Cursor, m_aLines[r].m_aText, -1);
}

View file

@ -756,7 +756,7 @@ void CEditor::DoToolbar(CUIRect ToolBar)
s_RotationAmount = max(90, (s_RotationAmount/90)*90);
break;
}
s_RotationAmount = UiDoValueSelector(&s_RotationAmount, &Button, "", s_RotationAmount, TileLayer?90:1, 360, TileLayer?90:1, TileLayer?10.0f:2.0f, Localize("Rotation of the brush in degrees. Use left mouse button to drag and change the value. Hold shift to be more precise."));
s_RotationAmount = UiDoValueSelector(&s_RotationAmount, &Button, "", s_RotationAmount, TileLayer?90:1, 359, TileLayer?90:1, TileLayer?10.0f:2.0f, Localize("Rotation of the brush in degrees. Use left mouse button to drag and change the value. Hold shift to be more precise."));
TB_Top.VSplitLeft(5.0f, &Button, &TB_Top);
TB_Top.VSplitLeft(30.0f, &Button, &TB_Top);

View file

@ -1527,25 +1527,27 @@ void CCharacter::Snap(int SnappingClient)
GameServer()->m_apPlayers[SnappingClient]->m_Authed < GetPlayer()->m_Authed
)
return;
CNetObj_Character *Character = static_cast<CNetObj_Character *>(Server()->SnapNewItem(NETOBJTYPE_CHARACTER, m_pPlayer->GetCID(), sizeof(CNetObj_Character)));
CNetObj_Character *pCharacter = static_cast<CNetObj_Character *>(Server()->SnapNewItem(NETOBJTYPE_CHARACTER, m_pPlayer->GetCID(), sizeof(CNetObj_Character)));
if(!pCharacter)
return;
// write down the m_Core
if(!m_ReckoningTick || GameServer()->m_World.m_Paused)
{
// no dead reckoning when paused because the client doesn't know
// how far to perform the reckoning
Character->m_Tick = 0;
m_Core.Write(Character);
pCharacter->m_Tick = 0;
m_Core.Write(pCharacter);
}
else
{
Character->m_Tick = m_ReckoningTick;
m_SendCore.Write(Character);
pCharacter->m_Tick = m_ReckoningTick;
m_SendCore.Write(pCharacter);
}
if(m_DoSplash)
{
Character->m_Jumped = 3;
pCharacter->m_Jumped = 3;
}
// set emote
if (m_EmoteStop < Server()->Tick())
@ -1554,37 +1556,37 @@ void CCharacter::Snap(int SnappingClient)
m_EmoteStop = -1;
}
Character->m_Emote = m_EmoteType;
pCharacter->m_Emote = m_EmoteType;
Character->m_AmmoCount = 0;
Character->m_Health = 0;
Character->m_Armor = 0;
pCharacter->m_AmmoCount = 0;
pCharacter->m_Health = 0;
pCharacter->m_Armor = 0;
if (m_FreezeTime > 0 || m_FreezeTime == -1)
{
Character->m_Emote = EMOTE_BLINK;
Character->m_Weapon = WEAPON_NINJA;
Character->m_AmmoCount = 0;
pCharacter->m_Emote = EMOTE_BLINK;
pCharacter->m_Weapon = WEAPON_NINJA;
pCharacter->m_AmmoCount = 0;
}
else
Character->m_Weapon = m_ActiveWeapon;
Character->m_AttackTick = m_AttackTick;
pCharacter->m_Weapon = m_ActiveWeapon;
pCharacter->m_AttackTick = m_AttackTick;
Character->m_Direction = m_Input.m_Direction;
pCharacter->m_Direction = m_Input.m_Direction;
if(m_pPlayer->GetCID() == SnappingClient)
{
Character->m_Health = m_Health;
Character->m_Armor = m_Armor;
pCharacter->m_Health = m_Health;
pCharacter->m_Armor = m_Armor;
if(m_aWeapons[m_ActiveWeapon].m_Ammo > 0)
Character->m_AmmoCount = (!m_FreezeTime)?m_aWeapons[m_ActiveWeapon].m_Ammo:0;
pCharacter->m_AmmoCount = (!m_FreezeTime)?m_aWeapons[m_ActiveWeapon].m_Ammo:0;
}
if (Character->m_Emote == EMOTE_NORMAL)
if(pCharacter->m_Emote == EMOTE_NORMAL)
{
if(250 - ((Server()->Tick() - m_LastAction)%(250)) < 5)
Character->m_Emote = EMOTE_BLINK;
pCharacter->m_Emote = EMOTE_BLINK;
}
Character->m_PlayerState = m_PlayerState;
pCharacter->m_PlayerState = m_PlayerState;
}

View file

@ -27,6 +27,9 @@ void CFlag::Reset()
void CFlag::Snap(int SnappingClient)
{
CNetObj_Flag *pFlag = (CNetObj_Flag *)Server()->SnapNewItem(NETOBJTYPE_FLAG, m_Number, 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;

View file

@ -139,6 +139,9 @@ void CLaser::Snap(int SnappingClient)
if(SnappingChar->m_Alive && OwnerChar->m_Alive && SnappingChar->Team() != OwnerChar->Team())
return;
CNetObj_Laser *pObj = static_cast<CNetObj_Laser *>(Server()->SnapNewItem(NETOBJTYPE_LASER, m_Id, sizeof(CNetObj_Laser)));
if(!pObj)
return;
pObj->m_X = (int)m_Pos.x;
pObj->m_Y = (int)m_Pos.y;
pObj->m_FromX = (int)m_From.x;

View file

@ -158,6 +158,9 @@ void CPickup::Snap(int SnappingClient)
int Tick = (Server()->Tick()%Server()->TickSpeed())%11;
if (SnapChar && SnapChar->m_Alive && (m_Layer == LAYER_SWITCH && !GameServer()->Collision()->m_pSwitchers[m_Number].m_Status[SnapChar->Team()]) && (!Tick)) return;
CNetObj_Pickup *pP = static_cast<CNetObj_Pickup *>(Server()->SnapNewItem(NETOBJTYPE_PICKUP, m_Id, sizeof(CNetObj_Pickup)));
if(!pP)
return;
pP->m_X = (int)m_Pos.x;
pP->m_Y = (int)m_Pos.y;
pP->m_Type = m_Type;

View file

@ -184,5 +184,6 @@ void CProjectile::Snap(int SnappingClient)
)
return;
CNetObj_Projectile *pProj = static_cast<CNetObj_Projectile *>(Server()->SnapNewItem(NETOBJTYPE_PROJECTILE, m_Id, sizeof(CNetObj_Projectile)));
FillInfo(pProj);
if(pProj)
FillInfo(pProj);
}

View file

@ -50,7 +50,8 @@ void CEventHandler::Snap(int SnappingClient)
if(SnappingClient == -1 || distance(GameServer()->m_apPlayers[SnappingClient]->m_ViewPos, vec2(ev->m_X, ev->m_Y)) < 1500.0f)
{
void *d = GameServer()->Server()->SnapNewItem(m_aTypes[i], i, m_aSizes[i]);
mem_copy(d, &m_aData[m_aOffsets[i]], m_aSizes[i]);
if(d)
mem_copy(d, &m_aData[m_aOffsets[i]], m_aSizes[i]);
}
}
}

View file

@ -733,6 +733,9 @@ bool IGameController::IsTeamplay() const
void IGameController::Snap(int SnappingClient)
{
CNetObj_Game *pGameObj = (CNetObj_Game *)Server()->SnapNewItem(NETOBJTYPE_GAME, 0, sizeof(CNetObj_Game));
if(!pGameObj)
return;
pGameObj->m_Paused = GameServer()->m_World.m_Paused;
pGameObj->m_GameOver = m_GameOverTick==-1?0:1;
pGameObj->m_SuddenDeath = m_SuddenDeath;

View file

@ -94,31 +94,34 @@ void CPlayer::Snap(int SnappingClient)
if(!Server()->ClientIngame(m_ClientID))
return;
CNetObj_ClientInfo *ClientInfo = static_cast<CNetObj_ClientInfo *>(Server()->SnapNewItem(NETOBJTYPE_CLIENTINFO, m_ClientID, sizeof(CNetObj_ClientInfo)));
StrToInts(&ClientInfo->m_Name0, 6, Server()->ClientName(m_ClientID));
StrToInts(&ClientInfo->m_Skin0, 6, m_TeeInfos.m_SkinName);
ClientInfo->m_UseCustomColor = m_TeeInfos.m_UseCustomColor;
ClientInfo->m_ColorBody = m_TeeInfos.m_ColorBody;
ClientInfo->m_ColorFeet = m_TeeInfos.m_ColorFeet;
CNetObj_ClientInfo *pClientInfo = static_cast<CNetObj_ClientInfo *>(Server()->SnapNewItem(NETOBJTYPE_CLIENTINFO, m_ClientID, sizeof(CNetObj_ClientInfo)));
if(!pClientInfo)
return;
CNetObj_PlayerInfo *Info = static_cast<CNetObj_PlayerInfo *>(Server()->SnapNewItem(NETOBJTYPE_PLAYERINFO, m_ClientID, sizeof(CNetObj_PlayerInfo)));
Info->m_Latency = m_Latency.m_Min;
Info->m_LatencyFlux = m_Latency.m_Max-m_Latency.m_Min;
Info->m_Local = 0;
Info->m_ClientId = m_ClientID;
StrToInts(&pClientInfo->m_Name0, 6, Server()->ClientName(m_ClientID));
StrToInts(&pClientInfo->m_Skin0, 6, m_TeeInfos.m_SkinName);
pClientInfo->m_UseCustomColor = m_TeeInfos.m_UseCustomColor;
pClientInfo->m_ColorBody = m_TeeInfos.m_ColorBody;
pClientInfo->m_ColorFeet = m_TeeInfos.m_ColorFeet;
CNetObj_PlayerInfo *pPlayerInfo = static_cast<CNetObj_PlayerInfo *>(Server()->SnapNewItem(NETOBJTYPE_PLAYERINFO, m_ClientID, sizeof(CNetObj_PlayerInfo)));
if(!pPlayerInfo)
return;
pPlayerInfo->m_Latency = m_Latency.m_Min;
pPlayerInfo->m_LatencyFlux = m_Latency.m_Max-m_Latency.m_Min;
pPlayerInfo->m_Local = 0;
pPlayerInfo->m_ClientId = m_ClientID;
if(m_ClientID == SnappingClient)
Info->m_Local = 1;
pPlayerInfo->m_Local = 1;
// send 0 if times of others are not shown
if(SnappingClient != m_ClientID && g_Config.m_SvHideScore)
Info->m_Score = 0;
pPlayerInfo->m_Score = 0;
else
Info->m_Score = m_Score;
pPlayerInfo->m_Score = m_Score;
Info->m_Team = m_Team;
pPlayerInfo->m_Team = m_Team;
}
void CPlayer::OnDisconnect()

View file

@ -8,7 +8,7 @@
// client
MACRO_CONFIG_INT(ClPredict, cl_predict, 1, 0, 1, CFGFLAG_CLIENT|CFGFLAG_SAVE, "Predict client movements", -1)
MACRO_CONFIG_INT(ClNameplates, cl_nameplates, 1, 0, 1, CFGFLAG_CLIENT|CFGFLAG_SAVE, "Show nameplates", -1)
MACRO_CONFIG_INT(ClNameplatesAlways, cl_nameplates_always, 0, 0, 1, CFGFLAG_CLIENT|CFGFLAG_SAVE, "Always show nameplats disregarding of distance", -1)
MACRO_CONFIG_INT(ClNameplatesAlways, cl_nameplates_always, 1, 0, 1, CFGFLAG_CLIENT|CFGFLAG_SAVE, "Always show nameplats disregarding of distance", -1)
MACRO_CONFIG_INT(ClAutoswitchWeapons, cl_autoswitch_weapons, 0, 0, 1, CFGFLAG_CLIENT|CFGFLAG_SAVE, "Auto switch weapon on pickup", -1)
MACRO_CONFIG_INT(ClShowfps, cl_showfps, 0, 0, 1, CFGFLAG_CLIENT|CFGFLAG_SAVE, "Show ingame FPS counter", -1)