- Статус
- Оффлайн
- Регистрация
- 7 Авг 2018
- Сообщения
- 306
- Реакции
- 106
Обратите внимание, пользователь заблокирован на форуме. Не рекомендуется проводить сделки.
Всем плазменный\пламенный привет :blush:
C++:
//Новые адреса
#define SystemGlobalEnvironment 0x141EF7480
#define IsSameTeam 0x1410A15E0
#define RequestReloadSv 0x1413C5DA0
#define RequestShootHitBegin 0x141305350
#define RequestShootHitEnd 0x142189CA8
struct ITimer
{
enum ETimer
{
ETIMER_GAME,
ETIMER_UI,
ETIMER_LAST,
};
virtual ~ITimer() = 0;//0
virtual void ResetTimer() = 0;//1
virtual void UpdateOnFrameStart() = 0;//2
virtual float GetCurrTime(ETimer which = ETIMER_GAME) const = 0;//3
virtual const CTimeValue& GetFrameStartTime(ETimer which = ETIMER_GAME) const = 0;//4
virtual CTimeValue GetAsyncTime() const = 0;//5
virtual float GetAsyncCurTime() = 0;//6
virtual float GetFrameTime(ETimer which = ETIMER_GAME) const = 0;//7
virtual float GetRealFrameTime() const = 0;//8
virtual float GetTimeScale() const = 0;//9
virtual void SetTimeScale(float s) = 0;//10
virtual void EnableTimer(const bool bEnable) = 0;//11
virtual bool IsTimerEnabled() const = 0;//12
virtual float GetFrameRate() = 0;//13
virtual float GetProfileFrameBlending(float* pfBlendTime = 0, int* piBlendMode = 0) = 0;//14
virtual void Serialize(TSerialize ser) = 0;//15
virtual bool PauseTimer(ETimer which, bool bPause) = 0;//16
virtual bool IsTimerPaused(ETimer which) = 0;//17
virtual bool SetTimer(ETimer which, float timeInSeconds) = 0;//18
virtual void SecondsToDateUTC(time_t time, struct tm& outDateUTC) = 0;//19
virtual time_t DateToSecondsUTC(struct tm& timePtr) = 0;//20
virtual float TicksToMillis(int64 ticks) const = 0;//21
virtual float TicksToSeconds(int64 ticks) = 0;//22
virtual ITimer* CreateNewTimer() = 0;//23
};
struct CTimer : ITimer
{
typedef int64(*TimeUpdateFunc)();
int64_t CryGetTicks()
{
return m_pfnUpdate ? m_pfnUpdate() : 0;
}
float GetCurrTime(ETimer which = ETIMER_GAME)
{
return m_CurrTime[which].GetSeconds();
}
CTimeValue GetAsyncTime()
{
return CryGetTicks() * m_dPrecisionOverTicksPerSec;
}
float TicksToSeconds(int64_t ticks)
{
return float((double)ticks / m_lTicksPerSec);
}
float GetAsyncCurTime()
{
return TicksToSeconds(CryGetTicks() - m_lBaseTime);
}
float GetFrameTime(ETimer which = ETIMER_GAME)
{
if (m_bEnabled && (which || !m_bGameTimerPaused)) return m_fFrameTime;
return 0.0f;
}
float GetRealFrameTime()
{
if (m_bEnabled) return m_fRealFrameTime;
return 0.0f;
}
float GetTimeScale()
{
return m_time_scale;
}
void SetTimeScale(float scale)
{
m_time_scale = scale;
}
void EnableTimer(const bool bEnable)
{
m_bEnabled = bEnable;
}
float GetFrameRate()
{
if (m_fRealFrameTime != 0.f) return 1.f / m_fRealFrameTime;
return 0.f;
}
bool IsTimerEnabled()
{
return m_bEnabled;
}
void RefreshGameTime(int64_t curTime)
{
m_CurrTime[ETIMER_GAME].SetSeconds(TicksToSeconds(curTime + m_lOffsetTime));
}
void SetOffsetToMatchGameTime(int64_t ticks)
{
const int64_t previousOffset = m_lOffsetTime;
const float previousGameTime = GetCurrTime(ETIMER_GAME);
m_lOffsetTime = ticks - m_lLastTime;
RefreshGameTime(m_lLastTime);
if (m_bGameTimerPaused) m_lGameTimerPausedTime = ticks;
}
bool PauseTimer(ETimer which, bool bPause)
{
if (which != ETIMER_GAME) return false;
if (m_bGameTimerPaused == bPause) return false;
m_bGameTimerPaused = bPause;
if (bPause)
{
m_lGameTimerPausedTime = m_lLastTime + m_lOffsetTime;
}
else
{
SetOffsetToMatchGameTime(m_lGameTimerPausedTime);
m_lGameTimerPausedTime = 0;
}
return true;
}
bool IsTimerPaused(ETimer which = ETIMER_GAME)
{
if (which != ETIMER_GAME) return false;
return m_bGameTimerPaused;
}
int64_t SecondsToTicks(double seconds)
{
return int64_t(seconds * (double)m_lTicksPerSec);
}
bool SetTimer(ETimer which, float timeInSeconds)
{
if (which != ETIMER_GAME) return false;
SetOffsetToMatchGameTime(SecondsToTicks(timeInSeconds));
return true;
}
void RefreshUITime(int64_t curTime)
{
m_CurrTime[ETIMER_UI].SetSeconds(TicksToSeconds(curTime));
}
CTimeValue GetFrameStartTime(ETimer which = ETIMER_GAME)
{
return m_CurrTime[which];
}
private:
CTimeValue m_CurrTime[ETIMER_LAST];
TimeUpdateFunc m_pfnUpdate;
int64_t m_lBaseTime;
int64_t m_lLastTime;
int64_t m_lOffsetTime;
int64_t m_lTicksPerSec;
int64_t m_lConvTicksPerSec;
double m_dPrecisionOverTicksPerSec;
int64_t m_lCurrentTime;
float m_fFrameTime;
float m_fRealFrameTime;
int64_t m_lForcedGameTime;
bool m_bEnabled;
float m_previousTimes[16];
float m_arrFrameTimes[100];
float m_fAverageFrameTime;
int m_timecount;
float m_fProfileBlend;
float m_fAvgFrameTime;
float m_fixed_time_step;
float m_max_time_step;
float m_time_scale;
int m_TimeSmoothing;
int m_TimeDebug;
float m_profile_smooth_time;
int m_profile_weighting;
ISystem* m_pSystem;
uint32_t m_nFrameCounter;
bool m_bGameTimerPaused;
int64_t m_lGameTimerPausedTime;
int64_t m_lBaseTimeACCheck;
int64_t m_lLastTimeACCheck;
};