mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-10 10:08:18 +00:00
Tune reset clean up (fix #50)
* Removing old unused DDRaceTunesReset() function. * Adding ResetTuning() function to reset tunes. * Adding ResetTuning() and some settings reset (sv_hit/sv_endless_drag/sv_old_laser) to CGameContext::OnInit() which is loaded on each map load. GreYFoX: Repositioned the new Functions
This commit is contained in:
parent
1d8f3fffe4
commit
813f689957
|
@ -1704,21 +1704,6 @@ void CServer::GetClientAddr(int ClientID, NETADDR *pAddr)
|
|||
*pAddr = m_NetServer.ClientAddr(ClientID);
|
||||
}
|
||||
|
||||
void DDRaceTunesReset(CConsole* pConsole)
|
||||
{
|
||||
pConsole->ExecuteLine("tune_reset", -1, IConsole::CONSOLELEVEL_CONFIG, 0, 0);
|
||||
pConsole->ExecuteLine("tune gun_speed 1400", -1, IConsole::CONSOLELEVEL_CONFIG, 0, 0);
|
||||
pConsole->ExecuteLine("tune shotgun_curvature 0", -1, IConsole::CONSOLELEVEL_CONFIG, 0, 0);
|
||||
pConsole->ExecuteLine("tune shotgun_speed 500", -1, IConsole::CONSOLELEVEL_CONFIG, 0, 0);
|
||||
pConsole->ExecuteLine("tune shotgun_speeddiff 0", -1, IConsole::CONSOLELEVEL_CONFIG, 0, 0);
|
||||
pConsole->ExecuteLine("tune gun_curvature 0", -1, IConsole::CONSOLELEVEL_CONFIG, 0, 0);
|
||||
pConsole->ExecuteLine("sv_hit 1", -1, IConsole::CONSOLELEVEL_CONFIG, 0, 0);
|
||||
pConsole->ExecuteLine("sv_npc 0", -1, IConsole::CONSOLELEVEL_CONFIG, 0, 0);
|
||||
pConsole->ExecuteLine("sv_phook 1", -1, IConsole::CONSOLELEVEL_CONFIG, 0, 0);
|
||||
pConsole->ExecuteLine("sv_endless_drag 0", -1, IConsole::CONSOLELEVEL_CONFIG, 0, 0);
|
||||
pConsole->ExecuteLine("sv_old_laser 0", -1, IConsole::CONSOLELEVEL_CONFIG, 0, 0);
|
||||
}
|
||||
|
||||
void CServer::SetRconLevel(int ClientID, int Level)
|
||||
{
|
||||
char aBuf[128];
|
||||
|
|
|
@ -238,9 +238,6 @@ public:
|
|||
static void ConAddBanmaster(IConsole::IResult *pResult, void *pUser, int ClientID);
|
||||
static void ConBanmasters(IConsole::IResult *pResult, void *pUser, int ClientID);
|
||||
static void ConClearBanmasters(IConsole::IResult *pResult, void *pUser, int ClientID);
|
||||
|
||||
private:
|
||||
void DDRaceTunesReset(CConsole* pConsole);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
@ -53,16 +53,6 @@ void CGameContext::Construct(int Resetting)
|
|||
m_pScore = 0;
|
||||
m_NumMutes = 0;
|
||||
}
|
||||
|
||||
// DDRace Tunes
|
||||
Tuning()->Set("gun_speed", 1400);
|
||||
Tuning()->Set("gun_curvature", 0);
|
||||
Tuning()->Set("shotgun_speed", 500);
|
||||
Tuning()->Set("shotgun_speeddiff", 0);
|
||||
Tuning()->Set("shotgun_curvature", 0);
|
||||
g_Config.m_SvHit = 1;
|
||||
g_Config.m_SvEndlessDrag = 0;
|
||||
g_Config.m_SvOldLaser = 0;
|
||||
}
|
||||
|
||||
CGameContext::CGameContext(int Resetting)
|
||||
|
@ -1275,9 +1265,7 @@ void CGameContext::ConTuneParam(IConsole::IResult *pResult, void *pUserData, int
|
|||
void CGameContext::ConTuneReset(IConsole::IResult *pResult, void *pUserData, int ClientID)
|
||||
{
|
||||
CGameContext *pSelf = (CGameContext *)pUserData;
|
||||
CTuningParams TuningParams;
|
||||
*pSelf->Tuning() = TuningParams;
|
||||
pSelf->SendTuningParams(-1);
|
||||
pSelf->ResetTuning();
|
||||
pResult->Print(IConsole::OUTPUT_LEVEL_STANDARD, "tuning", "Tuning reset");
|
||||
}
|
||||
|
||||
|
@ -1643,6 +1631,12 @@ void CGameContext::OnInit(/*class IKernel *pKernel*/)
|
|||
//world = new GAMEWORLD;
|
||||
//players = new CPlayer[MAX_CLIENTS];
|
||||
|
||||
// Reset Tuning
|
||||
ResetTuning();
|
||||
g_Config.m_SvHit = 1;
|
||||
g_Config.m_SvEndlessDrag = 0;
|
||||
g_Config.m_SvOldLaser = 0;
|
||||
|
||||
char buf[512];
|
||||
str_format(buf, sizeof(buf), "data/maps/%s.cfg", g_Config.m_SvMap);
|
||||
Console()->ExecuteFile(buf, -1, IConsole::CONSOLELEVEL_CONFIG, 0, 0);
|
||||
|
@ -1955,3 +1949,15 @@ int CGameContext::GetDDRaceTeam(int ClientID)
|
|||
CGameControllerDDRace* pController = (CGameControllerDDRace*)m_pController;
|
||||
return pController->m_Teams.m_Core.Team(ClientID);
|
||||
}
|
||||
|
||||
void CGameContext::ResetTuning()
|
||||
{
|
||||
CTuningParams TuningParams;
|
||||
m_Tuning = TuningParams;
|
||||
Tuning()->Set("gun_speed", 1400);
|
||||
Tuning()->Set("gun_curvature", 0);
|
||||
Tuning()->Set("shotgun_speed", 500);
|
||||
Tuning()->Set("shotgun_speeddiff", 0);
|
||||
Tuning()->Set("shotgun_curvature", 0);
|
||||
SendTuningParams(-1);
|
||||
}
|
||||
|
|
|
@ -273,6 +273,8 @@ public:
|
|||
virtual void OnSetAuthed(int ClientID,int Level);
|
||||
virtual bool PlayerCollision();
|
||||
virtual bool PlayerHooking();
|
||||
|
||||
void ResetTuning();
|
||||
};
|
||||
|
||||
inline int CmaskAll() { return -1; }
|
||||
|
|
Loading…
Reference in a new issue