Merge branch 'DDRace64' of github.com:def-/teeworlds into DDRace64

This commit is contained in:
def 2014-02-03 04:32:29 +01:00
commit c907071d4c
20 changed files with 118 additions and 49 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 296 KiB

After

Width:  |  Height:  |  Size: 261 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 308 KiB

After

Width:  |  Height:  |  Size: 274 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 44 KiB

After

Width:  |  Height:  |  Size: 44 KiB

BIN
data/skins/Kirby.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

View file

@ -2023,7 +2023,7 @@ void CClient::Run()
Update();
if(!g_Config.m_GfxAsyncRender || m_pGraphics->IsIdle())
if(m_pGraphics->WindowOpen() && (!g_Config.m_GfxAsyncRender || m_pGraphics->IsIdle()))
{
m_RenderFrames++;

View file

@ -206,6 +206,7 @@ MACRO_CONFIG_INT(ClBackgroundEntitiesSat, cl_background_entities_sat, 0, 0, 255,
MACRO_CONFIG_INT(ClBackgroundEntitiesLht, cl_background_entities_lht, 128, 0, 255, CFGFLAG_CLIENT|CFGFLAG_SAVE, "Background (entities) color lightness")
MACRO_CONFIG_INT(SvShowOthers, sv_show_others, 1, 0, 1, CFGFLAG_SERVER, "Whether players can user the command showothers or not")
MACRO_CONFIG_INT(SvShowOthersDefault, sv_show_others_default, 0, 0, 1, CFGFLAG_SERVER, "Whether players see others by default")
MACRO_CONFIG_INT(SvShowAllDefault, sv_show_all_default, 0, 0, 1, CFGFLAG_SERVER, "Whether players see all tees by default")
MACRO_CONFIG_INT(SvMaxAfkTime, sv_max_afk_time, 0, 0, 9999, CFGFLAG_SERVER, "The time in seconds a player is allowed to be afk (0 = disabled)")
MACRO_CONFIG_INT(SvMaxAfkVoteTime, sv_max_afk_vote_time, 300, 0, 9999, CFGFLAG_SERVER, "The time in seconds a player can be afk and his votes still count (0 = disabled)")
MACRO_CONFIG_INT(SvPlasmaRange, sv_plasma_range, 700, 1, 99999, CFGFLAG_SERVER, "How far will the plasma gun track tees")

View file

@ -181,20 +181,20 @@ void CMenus::RenderPlayers(CUIRect MainView)
continue;
int Index = m_pClient->m_Snap.m_paInfoByTeam[i]->m_ClientID;
CListboxItem Item = UiDoListboxNextItem(&m_pClient->m_aClients[Index]);
if(Index == m_pClient->m_Snap.m_LocalClientID)
continue;
CListboxItem Item = UiDoListboxNextItem(&m_pClient->m_aClients[Index]);
Count++;
if(!Item.m_Visible)
continue;
Item.m_Rect.HSplitTop(24.0f, &ButtonBar, &Item.m_Rect);
if(Count%2 == 1)
RenderTools()->DrawUIRect(&ButtonBar, vec4(1.0f, 1.0f, 1.0f, 0.25f), CUI::CORNER_ALL, 10.0f);
ButtonBar.VSplitRight(200.0f, &Player, &ButtonBar);
RenderTools()->DrawUIRect(&Item.m_Rect, vec4(1.0f, 1.0f, 1.0f, 0.25f), CUI::CORNER_ALL, 10.0f);
Item.m_Rect.VSplitRight(200.0f, &Player, &Item.m_Rect);
// player info
Player.VSplitLeft(28.0f, &Button, &Player);
@ -214,8 +214,8 @@ void CMenus::RenderPlayers(CUIRect MainView)
TextRender()->TextEx(&Cursor, m_pClient->m_aClients[Index].m_aClan, -1);
// ignore button
ButtonBar.HMargin(2.0f, &ButtonBar);
ButtonBar.VSplitLeft(Width, &Button, &ButtonBar);
Item.m_Rect.HMargin(2.0f, &Item.m_Rect);
Item.m_Rect.VSplitLeft(Width, &Button, &Item.m_Rect);
Button.VSplitLeft((Width-Button.h)/4.0f, 0, &Button);
Button.VSplitLeft(Button.h, &Button, 0);
if(g_Config.m_ClShowChatFriends && !m_pClient->m_aClients[Index].m_Friend)
@ -225,8 +225,8 @@ void CMenus::RenderPlayers(CUIRect MainView)
m_pClient->m_aClients[Index].m_ChatIgnore ^= 1;
// friend button
ButtonBar.VSplitLeft(20.0f, &Button, &ButtonBar);
ButtonBar.VSplitLeft(Width, &Button, &ButtonBar);
Item.m_Rect.VSplitLeft(20.0f, &Button, &Item.m_Rect);
Item.m_Rect.VSplitLeft(Width, &Button, &Item.m_Rect);
Button.VSplitLeft((Width-Button.h)/4.0f, 0, &Button);
Button.VSplitLeft(Button.h, &Button, 0);
if(DoButton_Toggle(&s_aPlayerIDs[Index][1], m_pClient->m_aClients[Index].m_Friend, &Button, true))

View file

@ -273,7 +273,7 @@ void CScoreboard::RenderScoreboard(float x, float y, float w, int Team, const ch
{
LineHeight = 50.0f;
TeeSizeMod = 0.9f;
Spacing = 8.0f;
Spacing = 5.0f;
RoundRadius = 15.0f;
}
@ -359,10 +359,8 @@ void CScoreboard::RenderScoreboard(float x, float y, float w, int Team, const ch
{
Graphics()->TextureSet(-1);
Graphics()->QuadsBegin();
float r = (DDTeam % 22) / 22.0f;
float g = ((DDTeam - 22) % 22) / 22.0f;
float b = ((DDTeam - 44) % 22) / 22.0f;
Graphics()->SetColor(r, g, b, 0.5f);
vec3 rgb = HslToRgb(vec3(DDTeam / 64.0f, 1.0f, 0.5f));
Graphics()->SetColor(rgb.r, rgb.g, rgb.b, 0.5f);
int Corners = 0;

View file

@ -526,6 +526,19 @@ int CCollision::IsCheckTeleport(int Index)
return 0;
}
int CCollision::IsCheckEvilTeleport(int Index)
{
if(Index < 0)
return 0;
if(!m_pTele)
return 0;
if(m_pTele[Index].m_Type == TILE_TELECHECKINEVIL)
return m_pTele[Index].m_Number;
return 0;
}
int CCollision::IsTCheckpoint(int Index)
{
if(Index < 0)
@ -684,7 +697,7 @@ bool CCollision::TileExists(int Index)
return true;
if(m_pFront && m_pFront[Index].m_Index >= TILE_FREEZE && m_pFront[Index].m_Index <= TILE_NPH_START)
return true;
if(m_pTele && (m_pTele[Index].m_Type == TILE_TELEIN || m_pTele[Index].m_Type == TILE_TELEINEVIL || m_pTele[Index].m_Type == TILE_TELECHECK || m_pTele[Index].m_Type == TILE_TELECHECKIN))
if(m_pTele && (m_pTele[Index].m_Type == TILE_TELEIN || m_pTele[Index].m_Type == TILE_TELEINEVIL || m_pTele[Index].m_Type == TILE_TELECHECKINEVIL ||m_pTele[Index].m_Type == TILE_TELECHECK || m_pTele[Index].m_Type == TILE_TELECHECKIN))
return true;
if(m_pSpeedup && m_pSpeedup[Index].m_Force > 0)
return true;

View file

@ -78,6 +78,7 @@ public:
int IsTeleport(int Index);
int IsEvilTeleport(int Index);
int IsCheckTeleport(int Index);
int IsCheckEvilTeleport(int Index);
int IsTeleportWeapon(int Index);
int IsTeleportHook(int Index);
int IsTCheckpoint(int Index);

View file

@ -31,7 +31,8 @@ CONSOLE_COMMAND("move", "ii", CFGFLAG_SERVER|CMDFLAG_TEST, ConMove, this, "Moves
CONSOLE_COMMAND("move_raw", "ii", CFGFLAG_SERVER|CMDFLAG_TEST, ConMoveRaw, this, "Moves to the point with x/y-coordinates ii")
CONSOLE_COMMAND("force_pause", "ii", CFGFLAG_SERVER, ConForcePause, this, "Force i to pause for i seconds")
CONSOLE_COMMAND("force_unpause", "i", CFGFLAG_SERVER, ConForcePause, this, "Set force-pause timer of v to 0.")
CONSOLE_COMMAND("showothers", "?i", CFGFLAG_CHAT, ConShowOthers, this, "Whether to showplayers from other teams or not (off by default), optional i = 0 for off else for on")
CONSOLE_COMMAND("showothers", "?i", CFGFLAG_CHAT, ConShowOthers, this, "Whether to show players from other teams or not (off by default), optional i = 0 for off else for on")
CONSOLE_COMMAND("showall", "?i", CFGFLAG_CHAT, ConShowAll, this, "Whether to show players at any distance (off by default), optional i = 0 for off else for on")
CONSOLE_COMMAND("list", "?s", CFGFLAG_CHAT, ConList, this, "List connected players with optional case-insensitive substring matching filter")

View file

@ -709,6 +709,8 @@ int CEditorMap::Load(class IStorage *pStorage, const char *pFileName, int Storag
((CLayerTiles*)pTiles)->m_pTiles[i].m_Index = TILE_TELECHECK;
else if(((CLayerTele*)pTiles)->m_pTeleTile[i].m_Type == TILE_TELECHECKIN)
((CLayerTiles*)pTiles)->m_pTiles[i].m_Index = TILE_TELECHECKIN;
else if(((CLayerTele*)pTiles)->m_pTeleTile[i].m_Type == TILE_TELECHECKINEVIL)
((CLayerTiles*)pTiles)->m_pTiles[i].m_Index = TILE_TELECHECKINEVIL;
else if(((CLayerTele*)pTiles)->m_pTeleTile[i].m_Type == TILE_TELECHECKOUT)
((CLayerTiles*)pTiles)->m_pTiles[i].m_Index = TILE_TELECHECKOUT;
else if(((CLayerTele*)pTiles)->m_pTeleTile[i].m_Type == TILE_TELEINWEAPON)

View file

@ -180,7 +180,7 @@ int CLayerTiles::BrushGrab(CLayerGroup *pBrush, CUIRect Rect)
for(int x = 0; x < r.w; x++)
{
pGrabbed->m_pTeleTile[y*pGrabbed->m_Width+x] = ((CLayerTele*)this)->m_pTeleTile[(r.y+y)*m_Width+(r.x+x)];
if(pGrabbed->m_pTeleTile[y*pGrabbed->m_Width+x].m_Type == TILE_TELEIN || pGrabbed->m_pTeleTile[y*pGrabbed->m_Width+x].m_Type == TILE_TELEOUT || pGrabbed->m_pTeleTile[y*pGrabbed->m_Width+x].m_Type == TILE_TELEINEVIL || pGrabbed->m_pTeleTile[y*pGrabbed->m_Width+x].m_Type == TILE_TELECHECK || pGrabbed->m_pTeleTile[y*pGrabbed->m_Width+x].m_Type == TILE_TELECHECKOUT || pGrabbed->m_pTeleTile[y*pGrabbed->m_Width+x].m_Type == TILE_TELECHECKIN || pGrabbed->m_pTeleTile[y*pGrabbed->m_Width+x].m_Type == TILE_TELEINWEAPON || pGrabbed->m_pTeleTile[y*pGrabbed->m_Width+x].m_Type == TILE_TELEINHOOK)
if(pGrabbed->m_pTeleTile[y*pGrabbed->m_Width+x].m_Type == TILE_TELEIN || pGrabbed->m_pTeleTile[y*pGrabbed->m_Width+x].m_Type == TILE_TELEOUT || pGrabbed->m_pTeleTile[y*pGrabbed->m_Width+x].m_Type == TILE_TELEINEVIL || pGrabbed->m_pTeleTile[y*pGrabbed->m_Width+x].m_Type == TILE_TELECHECKINEVIL || pGrabbed->m_pTeleTile[y*pGrabbed->m_Width+x].m_Type == TILE_TELECHECK || pGrabbed->m_pTeleTile[y*pGrabbed->m_Width+x].m_Type == TILE_TELECHECKOUT || pGrabbed->m_pTeleTile[y*pGrabbed->m_Width+x].m_Type == TILE_TELECHECKIN || pGrabbed->m_pTeleTile[y*pGrabbed->m_Width+x].m_Type == TILE_TELEINWEAPON || pGrabbed->m_pTeleTile[y*pGrabbed->m_Width+x].m_Type == TILE_TELEINHOOK)
m_pEditor->m_TeleNumber = pGrabbed->m_pTeleTile[y*pGrabbed->m_Width+x].m_Number;
}
pGrabbed->m_TeleNum = m_pEditor->m_TeleNumber;
@ -762,7 +762,7 @@ void CLayerTele::BrushDraw(CLayer *pBrush, float wx, float wy)
if(fx<0 || fx >= m_Width || fy < 0 || fy >= m_Height)
continue;
if(l->m_pTiles[y*l->m_Width+x].m_Index == TILE_TELEIN || l->m_pTiles[y*l->m_Width+x].m_Index == TILE_TELEINEVIL || l->m_pTiles[y*l->m_Width+x].m_Index == TILE_TELEOUT || l->m_pTiles[y*l->m_Width+x].m_Index == TILE_TELECHECK || l->m_pTiles[y*l->m_Width+x].m_Index == TILE_TELECHECKOUT || l->m_pTiles[y*l->m_Width+x].m_Index == TILE_TELECHECKIN || l->m_pTiles[y*l->m_Width+x].m_Index == TILE_TELEINWEAPON || l->m_pTiles[y*l->m_Width+x].m_Index == TILE_TELEINHOOK)
if(l->m_pTiles[y*l->m_Width+x].m_Index == TILE_TELEIN || l->m_pTiles[y*l->m_Width+x].m_Index == TILE_TELEINEVIL || l->m_pTiles[y*l->m_Width+x].m_Index == TILE_TELECHECKINEVIL || l->m_pTiles[y*l->m_Width+x].m_Index == TILE_TELEOUT || l->m_pTiles[y*l->m_Width+x].m_Index == TILE_TELECHECK || l->m_pTiles[y*l->m_Width+x].m_Index == TILE_TELECHECKOUT || l->m_pTiles[y*l->m_Width+x].m_Index == TILE_TELECHECKIN || l->m_pTiles[y*l->m_Width+x].m_Index == TILE_TELEINWEAPON || l->m_pTiles[y*l->m_Width+x].m_Index == TILE_TELEINHOOK)
{
if(m_pEditor->m_TeleNumber != l->m_TeleNum)
{

View file

@ -123,6 +123,7 @@ enum
TILE_STOP = 60,
TILE_STOPS,
TILE_STOPA,
TILE_TELECHECKINEVIL = 63,
TILE_CP = 64,
TILE_CP_F,
TILE_OLDLASER = 71,

View file

@ -12,7 +12,6 @@
#endif
bool CheckClientID(int ClientID);
char* TimerType(int TimerType);
void CGameContext::ConCredits(IConsole::IResult *pResult, void *pUserData)
{
@ -898,6 +897,22 @@ void CGameContext::ConShowOthers(IConsole::IResult *pResult, void *pUserData)
"Showing players from other teams is disabled by the server admin");
}
void CGameContext::ConShowAll(IConsole::IResult *pResult, void *pUserData)
{
CGameContext *pSelf = (CGameContext *) pUserData;
if (!CheckClientID(pResult->m_ClientID))
return;
CPlayer *pPlayer = pSelf->m_apPlayers[pResult->m_ClientID];
if (!pPlayer)
return;
if (pResult->NumArguments())
pPlayer->m_ShowAll = pResult->GetInteger(0);
else
pPlayer->m_ShowAll = !pPlayer->m_ShowAll;
}
bool CheckClientID(int ClientID)
{
dbg_assert(ClientID >= 0 || ClientID < MAX_CLIENTS,
@ -907,11 +922,6 @@ bool CheckClientID(int ClientID)
return true;
}
char* TimerType(int TimerType)
{
char msg[3][128] = {"game/round timer.", "broadcast.", "both game/round timer and broadcast."};
return msg[TimerType];
}
void CGameContext::ConSayTime(IConsole::IResult *pResult, void *pUserData)
{
CGameContext *pSelf = (CGameContext *) pUserData;
@ -995,9 +1005,10 @@ void CGameContext::ConSetTimerType(IConsole::IResult *pResult, void *pUserData)
if (!pPlayer)
return;
const char msg[3][128] = {"game/round timer.", "broadcast.", "both game/round timer and broadcast."};
char aBuf[128];
if(pPlayer->m_TimerType <= 2 && pPlayer->m_TimerType >= 0)
str_format(aBuf, sizeof(aBuf), "Timer is displayed in", TimerType(pPlayer->m_TimerType));
str_format(aBuf, sizeof(aBuf), "Timer is displayed in", msg[pPlayer->m_TimerType]);
else if(pPlayer->m_TimerType == 3)
str_format(aBuf, sizeof(aBuf), "Timer isn't displayed.");

View file

@ -1048,6 +1048,17 @@ int CCharacter::NetworkClipped(int SnappingClient)
int CCharacter::NetworkClipped(int SnappingClient, vec2 CheckPos)
{
if(SnappingClient == -1 || GameServer()->m_apPlayers[SnappingClient]->m_ShowAll)
return 0;
float dx = GameServer()->m_apPlayers[SnappingClient]->m_ViewPos.x-CheckPos.x;
float dy = GameServer()->m_apPlayers[SnappingClient]->m_ViewPos.y-CheckPos.y;
if(absolute(dx) > 1000.0f || absolute(dy) > 800.0f)
return 1;
if(distance(GameServer()->m_apPlayers[SnappingClient]->m_ViewPos, CheckPos) > 4000.0f)
return 1;
return 0;
}
@ -1107,13 +1118,18 @@ void CCharacter::HandleSkippableTiles(int Index)
GameServer()->Collision()->GetFCollisionAt(m_Pos.x+m_ProximityRadius/3.f, m_Pos.y-m_ProximityRadius/3.f)&CCollision::COLFLAG_DEATH ||
GameServer()->Collision()->GetFCollisionAt(m_Pos.x+m_ProximityRadius/3.f, m_Pos.y+m_ProximityRadius/3.f)&CCollision::COLFLAG_DEATH ||
GameServer()->Collision()->GetFCollisionAt(m_Pos.x-m_ProximityRadius/3.f, m_Pos.y-m_ProximityRadius/3.f)&CCollision::COLFLAG_DEATH ||
GameServer()->Collision()->GetCollisionAt(m_Pos.x-m_ProximityRadius/3.f, m_Pos.y+m_ProximityRadius/3.f)&CCollision::COLFLAG_DEATH ||
GameLayerClipped(m_Pos)) &&
GameServer()->Collision()->GetCollisionAt(m_Pos.x-m_ProximityRadius/3.f, m_Pos.y+m_ProximityRadius/3.f)&CCollision::COLFLAG_DEATH) &&
!m_Super && !(Team() && Teams()->TeeFinished(m_pPlayer->GetCID())))
{
Die(m_pPlayer->GetCID(), WEAPON_WORLD);
return;
}
{
Die(m_pPlayer->GetCID(), WEAPON_WORLD);
return;
}
if (GameLayerClipped(m_Pos) && !(Team() && Teams()->TeeFinished(m_pPlayer->GetCID())))
{
Die(m_pPlayer->GetCID(), WEAPON_WORLD);
return;
}
if(Index < 0)
return;
@ -1569,6 +1585,42 @@ void CCharacter::HandleTiles(int Index)
}
return;
}
if(GameServer()->Collision()->IsCheckEvilTeleport(MapIndex))
{
if (m_Super)
return;
// first check if there is a TeleCheckOut for the current recorded checkpoint, if not check previous checkpoints
for(int k=m_TeleCheckpoint-1; k >= 0; k--)
{
if(Controller->m_TeleCheckOuts[k].size())
{
m_Core.m_HookedPlayer = -1;
m_Core.m_HookState = HOOK_RETRACTED;
m_Core.m_TriggeredEvents |= COREEVENT_HOOK_RETRACT;
m_Core.m_HookState = HOOK_RETRACTED;
int Num = Controller->m_TeleCheckOuts[k].size();
m_Core.m_Pos = Controller->m_TeleCheckOuts[k][(!Num)?Num:rand() % Num];
GameWorld()->ReleaseHooked(GetPlayer()->GetCID());
m_Core.m_Vel = vec2(0,0);
m_Core.m_HookPos = m_Core.m_Pos;
return;
}
}
// if no checkpointout have been found (or if there no recorded checkpoint), teleport to start
vec2 SpawnPos;
if(GameServer()->m_pController->CanSpawn(m_pPlayer->GetTeam(), &SpawnPos))
{
m_Core.m_HookedPlayer = -1;
m_Core.m_HookState = HOOK_RETRACTED;
m_Core.m_TriggeredEvents |= COREEVENT_HOOK_RETRACT;
m_Core.m_HookState = HOOK_RETRACTED;
m_Core.m_Pos = SpawnPos;
GameWorld()->ReleaseHooked(GetPlayer()->GetCID());
m_Core.m_Vel = vec2(0,0);
m_Core.m_HookPos = m_Core.m_Pos;
}
return;
}
if(GameServer()->Collision()->IsCheckTeleport(MapIndex))
{
if (m_Super)

View file

@ -262,6 +262,7 @@ private:
static void ConToggleBroadcast(IConsole::IResult *pResult, void *pUserData);
static void ConEyeEmote(IConsole::IResult *pResult, void *pUserData);
static void ConShowOthers(IConsole::IResult *pResult, void *pUserData);
static void ConShowAll(IConsole::IResult *pResult, void *pUserData);
static void ConNinjaJetpack(IConsole::IResult *pResult, void *pUserData);
static void ConSayTime(IConsole::IResult *pResult, void *pUserData);
static void ConSayTimeAll(IConsole::IResult *pResult, void *pUserData);

View file

@ -75,6 +75,7 @@ CPlayer::CPlayer(CGameContext *pGameServer, int ClientID, int Team)
m_ClientVersion = VERSION_VANILLA;
m_ShowOthers = g_Config.m_SvShowOthersDefault;
m_ShowAll = g_Config.m_SvShowAllDefault;
m_NinjaJetpack = false;
m_Paused = PAUSED_NONE;
@ -300,7 +301,7 @@ void CPlayer::OnDisconnect(const char *pReason)
}
CGameControllerDDRace* Controller = (CGameControllerDDRace*)GameServer()->m_pController;
Controller->m_Teams.m_Core.Team(m_ClientID, 0);
Controller->m_Teams.SetForceCharacterTeam(m_ClientID, 0);
}
void CPlayer::OnPredictedInput(CNetObj_PlayerInput *NewInput)

View file

@ -139,6 +139,7 @@ public:
int m_Authed;
int m_ClientVersion;
bool m_ShowOthers;
bool m_ShowAll;
bool m_NinjaJetpack;
bool m_Afk;

View file

@ -314,27 +314,13 @@ void CGameTeams::SendTeamsState(int ClientID)
if (g_Config.m_SvTeam == 3)
return;
if (!m_pGameContext->m_apPlayers[ClientID] || m_pGameContext->m_apPlayers[ClientID]->m_ClientVersion < VERSION_DDRACE)
if (!m_pGameContext->m_apPlayers[ClientID] || m_pGameContext->m_apPlayers[ClientID]->m_ClientVersion <= VERSION_DDRACE)
return;
CMsgPacker Msg(NETMSGTYPE_SV_TEAMSSTATE);
if (m_pGameContext->m_apPlayers[ClientID]->m_ClientVersion == VERSION_DDRACE)
{
for(unsigned i = 0; i < VANILLA_MAX_CLIENTS; i++)
{
int target = 0;
Server()->ReverseTranslate(target, i);
Msg.AddInt(m_Core.Team(target));
}
}
else
{
for(unsigned i = 0; i < MAX_CLIENTS; i++)
{
Msg.AddInt(m_Core.Team(i));
}
}
for(unsigned i = 0; i < MAX_CLIENTS; i++)
Msg.AddInt(m_Core.Team(i));
Server()->SendMsg(&Msg, MSGFLAG_VITAL, ClientID);
}