diff options
Diffstat (limited to 'src/game')
| -rw-r--r-- | src/game/client/components/damageind.cpp | 17 | ||||
| -rw-r--r-- | src/game/client/components/damageind.h | 2 | ||||
| -rw-r--r-- | src/game/client/components/hud.cpp | 2 | ||||
| -rw-r--r-- | src/game/client/components/items.cpp | 3 | ||||
| -rw-r--r-- | src/game/client/components/menus.cpp | 2 | ||||
| -rw-r--r-- | src/game/client/gameclient.cpp | 12 |
6 files changed, 21 insertions, 17 deletions
diff --git a/src/game/client/components/damageind.cpp b/src/game/client/components/damageind.cpp index cba47666..9be6722a 100644 --- a/src/game/client/components/damageind.cpp +++ b/src/game/client/components/damageind.cpp @@ -38,7 +38,7 @@ void CDamageInd::Create(vec2 Pos, vec2 Dir) if (i) { i->m_Pos = Pos; - i->m_Life = 0.75f; + i->m_StartTime = Client()->LocalTime(); i->m_Dir = Dir*-1; i->m_StartAngle = (( (float)rand()/(float)RAND_MAX) - 1.0f) * 2.0f * pi; } @@ -46,19 +46,19 @@ void CDamageInd::Create(vec2 Pos, vec2 Dir) void CDamageInd::OnRender() { + Graphics()->TextureSet(g_pData->m_aImages[IMAGE_GAME].m_Id); Graphics()->QuadsBegin(); for(int i = 0; i < m_NumItems;) { - vec2 Pos = mix(m_aItems[i].m_Pos+m_aItems[i].m_Dir*75.0f, m_aItems[i].m_Pos, clamp((m_aItems[i].m_Life-0.60f)/0.15f, 0.0f, 1.0f)); - - m_aItems[i].m_Life -= Client()->FrameTime(); - if(m_aItems[i].m_Life < 0.0f) + float Life = 0.75f - (Client()->LocalTime() - m_aItems[i].m_StartTime); + if(Life < 0.0f) DestroyI(&m_aItems[i]); else { - Graphics()->SetColor(1.0f,1.0f,1.0f, m_aItems[i].m_Life/0.1f); - Graphics()->QuadsSetRotation(m_aItems[i].m_StartAngle + m_aItems[i].m_Life * 2.0f); + vec2 Pos = mix(m_aItems[i].m_Pos+m_aItems[i].m_Dir*75.0f, m_aItems[i].m_Pos, clamp((Life-0.60f)/0.15f, 0.0f, 1.0f)); + Graphics()->SetColor(1.0f,1.0f,1.0f, Life/0.1f); + Graphics()->QuadsSetRotation(m_aItems[i].m_StartAngle + Life * 2.0f); RenderTools()->SelectSprite(SPRITE_STAR1); RenderTools()->DrawSprite(Pos.x, Pos.y, 48.0f); i++; @@ -66,3 +66,6 @@ void CDamageInd::OnRender() } Graphics()->QuadsEnd(); } + + + diff --git a/src/game/client/components/damageind.h b/src/game/client/components/damageind.h index 2f89e422..4a5975a8 100644 --- a/src/game/client/components/damageind.h +++ b/src/game/client/components/damageind.h @@ -12,7 +12,7 @@ class CDamageInd : public CComponent { vec2 m_Pos; vec2 m_Dir; - float m_Life; + float m_StartTime; float m_StartAngle; }; diff --git a/src/game/client/components/hud.cpp b/src/game/client/components/hud.cpp index 17365116..df3afdea 100644 --- a/src/game/client/components/hud.cpp +++ b/src/game/client/components/hud.cpp @@ -248,7 +248,7 @@ void CHud::RenderFps() if(g_Config.m_ClShowfps) { // calculate avg. fps - float FPS = 1.0f / Client()->FrameTime(); + float FPS = 1.0f / Client()->RenderFrameTime(); m_AverageFPS = (m_AverageFPS*(1.0f-(1.0f/m_AverageFPS))) + (FPS*(1.0f/m_AverageFPS)); char Buf[512]; str_format(Buf, sizeof(Buf), "%d", (int)m_AverageFPS); diff --git a/src/game/client/components/items.cpp b/src/game/client/components/items.cpp index 1c338994..9f787a4b 100644 --- a/src/game/client/components/items.cpp +++ b/src/game/client/components/items.cpp @@ -22,7 +22,6 @@ void CItems::OnReset() void CItems::RenderProjectile(const CNetObj_Projectile *pCurrent, int ItemID) { - // get positions float Curvature = 0; float Speed = 0; @@ -64,7 +63,6 @@ void CItems::RenderProjectile(const CNetObj_Projectile *pCurrent, int ItemID) if(pCurrent->m_Type == WEAPON_GRENADE) { m_pClient->m_pEffects->SmokeTrail(Pos, Vel*-1); - m_pClient->m_pFlow->Add(Pos, Vel*1000*Client()->FrameTime(), 10.0f); if(Client()->State() == IClient::STATE_DEMOPLAYBACK) { @@ -85,7 +83,6 @@ void CItems::RenderProjectile(const CNetObj_Projectile *pCurrent, int ItemID) else { m_pClient->m_pEffects->BulletTrail(Pos); - m_pClient->m_pFlow->Add(Pos, Vel*1000*Client()->FrameTime(), 10.0f); if(length(Vel) > 0.00001f) Graphics()->QuadsSetRotation(GetAngle(Vel)); diff --git a/src/game/client/components/menus.cpp b/src/game/client/components/menus.cpp index a39139c8..0e61ec6e 100644 --- a/src/game/client/components/menus.cpp +++ b/src/game/client/components/menus.cpp @@ -627,6 +627,8 @@ int CMenus::RenderMenubar(CUIRect r) void CMenus::RenderLoading() { + // TODO: not supported right now due to separate render thread + static int64 LastLoadRender = 0; float Percent = m_LoadCurrent++/(float)m_LoadTotal; diff --git a/src/game/client/gameclient.cpp b/src/game/client/gameclient.cpp index 836e7a9d..6bcf21de 100644 --- a/src/game/client/gameclient.cpp +++ b/src/game/client/gameclient.cpp @@ -95,7 +95,6 @@ void CGameClient::OnConsoleInit() { m_pEngine = Kernel()->RequestInterface<IEngine>(); m_pClient = Kernel()->RequestInterface<IClient>(); - m_pGraphics = Kernel()->RequestInterface<IGraphics>(); m_pTextRender = Kernel()->RequestInterface<ITextRender>(); m_pSound = Kernel()->RequestInterface<ISound>(); m_pInput = Kernel()->RequestInterface<IInput>(); @@ -198,10 +197,6 @@ void CGameClient::OnConsoleInit() Console()->Register("shuffle_teams", "", CFGFLAG_SERVER, 0, 0, "Shuffle the current teams"); - // propagate pointers - m_UI.SetGraphics(Graphics(), TextRender()); - m_RenderTools.m_pGraphics = Graphics(); - m_RenderTools.m_pUI = UI(); for(int i = 0; i < m_All.m_Num; i++) m_All.m_paComponents[i]->m_pClient = this; @@ -225,6 +220,13 @@ void CGameClient::OnConsoleInit() void CGameClient::OnInit() { + m_pGraphics = Kernel()->RequestInterface<IGraphics>(); + + // propagate pointers + m_UI.SetGraphics(Graphics(), TextRender()); + m_RenderTools.m_pGraphics = Graphics(); + m_RenderTools.m_pUI = UI(); + int64 Start = time_get(); // set the language |