mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-10 18:18:18 +00:00
Merge branch 'master' of http://github.com/btd/DDRace
This commit is contained in:
commit
181d55f125
|
@ -669,7 +669,7 @@ void CCharacter::Tick()
|
||||||
m_RefreshTime = Server()->Tick();
|
m_RefreshTime = Server()->Tick();
|
||||||
m_RaceState = RACE_STARTED;
|
m_RaceState = RACE_STARTED;
|
||||||
}
|
}
|
||||||
int z = GameServer()->Collision()->IsTeleport(m_Pos.x, m_Pos.y);
|
|
||||||
if(((TileIndex1 == TILE_END) || (TileIndex2 == TILE_END)) && m_RaceState == RACE_STARTED)
|
if(((TileIndex1 == TILE_END) || (TileIndex2 == TILE_END)) && m_RaceState == RACE_STARTED)
|
||||||
{
|
{
|
||||||
char aBuf[128];
|
char aBuf[128];
|
||||||
|
@ -699,11 +699,15 @@ void CCharacter::Tick()
|
||||||
}
|
}
|
||||||
|
|
||||||
// update server best time
|
// update server best time
|
||||||
if(!GameServer()->m_pController->m_CurrentRecord || time < GameServer()->m_pController->m_CurrentRecord)
|
if(GameServer()->m_pController->m_CurrentRecord == 0 || time < GameServer()->m_pController->m_CurrentRecord)
|
||||||
{
|
{
|
||||||
// check for nameless
|
// check for nameless
|
||||||
if(str_comp_num(Server()->ClientName(m_pPlayer->GetCID()), "nameless tee", 12) != 0)
|
if(str_comp_num(Server()->ClientName(m_pPlayer->GetCID()), "nameless tee", 12) != 0) {
|
||||||
GameServer()->m_pController->m_CurrentRecord = time;
|
GameServer()->m_pController->m_CurrentRecord = time;
|
||||||
|
//dbg_msg("character", "Finish");
|
||||||
|
// GetPlayer()->SendServerRecord();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
m_RaceState = RACE_NONE;
|
m_RaceState = RACE_NONE;
|
||||||
|
@ -720,11 +724,11 @@ void CCharacter::Tick()
|
||||||
if(g_Config.m_SvHideScore || i == m_pPlayer->GetCID())
|
if(g_Config.m_SvHideScore || i == m_pPlayer->GetCID())
|
||||||
{
|
{
|
||||||
CNetMsg_Sv_PlayerTime Msg;
|
CNetMsg_Sv_PlayerTime Msg;
|
||||||
char aBuf[16];
|
//char aBuf[16];
|
||||||
str_format(aBuf, sizeof(aBuf), "%.0f", time*100.0f); // damn ugly but the only way i know to do it
|
//str_format(aBuf, sizeof(aBuf), "%.0f", time*100.0f); // damn ugly but the only way i know to do it
|
||||||
int TimeToSend;
|
//int TimeToSend;
|
||||||
sscanf(aBuf, "%d", &TimeToSend);
|
//sscanf(aBuf, "%d", &TimeToSend);
|
||||||
Msg.m_Time = TimeToSend;
|
Msg.m_Time = static_cast<int>(time*100.0f);
|
||||||
Msg.m_Cid = m_pPlayer->GetCID();
|
Msg.m_Cid = m_pPlayer->GetCID();
|
||||||
Server()->SendPackMsg(&Msg, MSGFLAG_VITAL, i);
|
Server()->SendPackMsg(&Msg, MSGFLAG_VITAL, i);
|
||||||
}
|
}
|
||||||
|
@ -887,8 +891,11 @@ void CCharacter::Tick()
|
||||||
|
|
||||||
m_Core.m_Vel += Direction*Force;
|
m_Core.m_Vel += Direction*Force;
|
||||||
}
|
}
|
||||||
|
int z = GameServer()->Collision()->IsTeleport(m_Pos.x, m_Pos.y);
|
||||||
|
|
||||||
if(z)
|
if(z)
|
||||||
{
|
{
|
||||||
|
dbg_msg("Collision", "This is teleport");
|
||||||
m_Core.m_HookedPlayer = -1;
|
m_Core.m_HookedPlayer = -1;
|
||||||
m_Core.m_HookState = HOOK_RETRACTED;
|
m_Core.m_HookState = HOOK_RETRACTED;
|
||||||
m_Core.m_TriggeredEvents |= COREEVENT_HOOK_RETRACT;
|
m_Core.m_TriggeredEvents |= COREEVENT_HOOK_RETRACT;
|
||||||
|
|
|
@ -42,6 +42,8 @@ IGameController::IGameController(class CGameContext *pGameServer)
|
||||||
m_aNumSpawnPoints[0] = 0;
|
m_aNumSpawnPoints[0] = 0;
|
||||||
m_aNumSpawnPoints[1] = 0;
|
m_aNumSpawnPoints[1] = 0;
|
||||||
m_aNumSpawnPoints[2] = 0;
|
m_aNumSpawnPoints[2] = 0;
|
||||||
|
|
||||||
|
m_CurrentRecord = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
IGameController::~IGameController()
|
IGameController::~IGameController()
|
||||||
|
|
|
@ -92,14 +92,15 @@ void CPlayer::Tick()
|
||||||
// send best time
|
// send best time
|
||||||
if(m_IsUsingRaceClient)
|
if(m_IsUsingRaceClient)
|
||||||
{
|
{
|
||||||
if(m_LastSentTime > GameServer()->m_pController->m_CurrentRecord || (!m_LastSentTime && GameServer()->m_pController->m_CurrentRecord))
|
if(m_LastSentTime > GameServer()->m_pController->m_CurrentRecord || (m_LastSentTime == 0 && GameServer()->m_pController->m_CurrentRecord > 0))
|
||||||
{
|
{
|
||||||
char aBuf[16];
|
//dbg_msg("player", "Record message sended");
|
||||||
str_format(aBuf, sizeof(aBuf), "%.0f", GameServer()->m_pController->m_CurrentRecord*100.0f); // damn ugly but the only way i know to do it
|
//char aBuf[16];
|
||||||
int TimeToSend;
|
//str_format(aBuf, sizeof(aBuf), "%.0f", GameServer()->m_pController->m_CurrentRecord*100.0f); // damn ugly but the only way i know to do it
|
||||||
sscanf(aBuf, "%d", &TimeToSend);
|
//int TimeToSend;
|
||||||
|
//sscanf(aBuf, "%d", &TimeToSend);
|
||||||
CNetMsg_Sv_Record Msg;
|
CNetMsg_Sv_Record Msg;
|
||||||
Msg.m_Time = TimeToSend;
|
Msg.m_Time = static_cast<int>(GameServer()->m_pController->m_CurrentRecord*100.0f);
|
||||||
Server()->SendPackMsg(&Msg, MSGFLAG_VITAL, m_ClientID);
|
Server()->SendPackMsg(&Msg, MSGFLAG_VITAL, m_ClientID);
|
||||||
|
|
||||||
m_LastSentTime = GameServer()->m_pController->m_CurrentRecord;
|
m_LastSentTime = GameServer()->m_pController->m_CurrentRecord;
|
||||||
|
|
|
@ -22,6 +22,7 @@ public:
|
||||||
int GetTeam() const { return m_Team; };
|
int GetTeam() const { return m_Team; };
|
||||||
int GetCID() const { return m_ClientID; };
|
int GetCID() const { return m_ClientID; };
|
||||||
|
|
||||||
|
|
||||||
void Tick();
|
void Tick();
|
||||||
void Snap(int SnappingClient);
|
void Snap(int SnappingClient);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue