diff options
Diffstat (limited to 'src/game/client/components/players.cpp')
| -rw-r--r-- | src/game/client/components/players.cpp | 48 |
1 files changed, 24 insertions, 24 deletions
diff --git a/src/game/client/components/players.cpp b/src/game/client/components/players.cpp index 74a48503..6811c2ad 100644 --- a/src/game/client/components/players.cpp +++ b/src/game/client/components/players.cpp @@ -25,7 +25,7 @@ void CPlayers::RenderHand(CTeeRenderInfo *pInfo, vec2 CenterPos, vec2 Dir, float { // for drawing hand //const skin *s = skin_get(skin_id); - + float BaseSize = 10.0f; //dir = normalize(hook_pos-pos); @@ -102,7 +102,7 @@ void CPlayers::RenderHook( if(m_pClient->m_Snap.m_pGameInfoObj) IsTeamplay = (m_pClient->m_Snap.m_pGameInfoObj->m_GameFlags&GAMEFLAG_TEAMS) != 0; - // check for ninja + // check for ninja if (Player.m_Weapon == WEAPON_NINJA) { // change the skin for the player to the ninja @@ -117,7 +117,7 @@ void CPlayers::RenderHook( RenderInfo.m_ColorBody = vec4(1,1,1,1); RenderInfo.m_ColorFeet = vec4(1,1,1,1); } - } + } } float IntraTick = Client()->IntraGameTick(); @@ -125,7 +125,7 @@ void CPlayers::RenderHook( // set size RenderInfo.m_Size = 64.0f; - + // use preditect players if needed if(pInfo.m_Local && g_Config.m_ClPredict && Client()->State() != IClient::STATE_DEMOPLAYBACK) { @@ -152,7 +152,7 @@ void CPlayers::RenderHook( vec2 Pos = Position; vec2 HookPos; - + if(pPlayerChar->m_HookedPlayer != -1) { if(m_pClient->m_Snap.m_pLocalInfo && pPlayerChar->m_HookedPlayer == m_pClient->m_Snap.m_pLocalInfo->m_ClientID) @@ -226,7 +226,7 @@ void CPlayers::RenderPlayer( if(m_pClient->m_Snap.m_pGameInfoObj) IsTeamplay = (m_pClient->m_Snap.m_pGameInfoObj->m_GameFlags&GAMEFLAG_TEAMS) != 0; - // check for ninja + // check for ninja if (Player.m_Weapon == WEAPON_NINJA) { // change the skin for the player to the ninja @@ -241,18 +241,18 @@ void CPlayers::RenderPlayer( RenderInfo.m_ColorBody = vec4(1,1,1,1); RenderInfo.m_ColorFeet = vec4(1,1,1,1); } - } + } } - + // set size RenderInfo.m_Size = 64.0f; float IntraTick = Client()->IntraGameTick(); - + float Angle = mix((float)Prev.m_Angle, (float)Player.m_Angle, IntraTick)/256.0f; - + //float angle = 0; - + if(pInfo.m_Local && Client()->State() != IClient::STATE_DEMOPLAYBACK) { // just use the direct input if it's local player we are rendering @@ -264,14 +264,14 @@ void CPlayers::RenderPlayer( float mixspeed = Client()->FrameTime()*2.5f; if(player.attacktick != prev.attacktick) // shooting boosts the mixing speed mixspeed *= 15.0f; - + // move the delta on a constant speed on a x^2 curve float current = g_GameClient.m_aClients[info.cid].angle; float target = player.angle/256.0f; float delta = angular_distance(current, target); float sign = delta < 0 ? -1 : 1; float new_delta = delta - 2*mixspeed*sqrt(delta*sign)*sign + mixspeed*mixspeed; - + // make sure that it doesn't vibrate when it's still if(fabs(delta) < 2/256.0f) angle = target; @@ -280,7 +280,7 @@ void CPlayers::RenderPlayer( g_GameClient.m_aClients[info.cid].angle = angle;*/ } - + // use preditect players if needed if(pInfo.m_Local && g_Config.m_ClPredict && Client()->State() != IClient::STATE_DEMOPLAYBACK) { @@ -296,16 +296,16 @@ void CPlayers::RenderPlayer( NewTick = m_pClient->m_NewPredictedTick; } } - + vec2 Direction = GetDirection((int)(Angle*256.0f)); vec2 Position = mix(vec2(Prev.m_X, Prev.m_Y), vec2(Player.m_X, Player.m_Y), IntraTick); vec2 Vel = mix(vec2(Prev.m_VelX/256.0f, Prev.m_VelY/256.0f), vec2(Player.m_VelX/256.0f, Player.m_VelY/256.0f), IntraTick); - + m_pClient->m_pFlow->Add(Position, Vel*100.0f, 10.0f); - + RenderInfo.m_GotAirJump = Player.m_Jumped&2?0:1; - - + + // detect events if(NewTick) { @@ -340,7 +340,7 @@ void CPlayers::RenderPlayer( float ct = (Client()->PrevGameTick()-Player.m_AttackTick)/(float)SERVER_TICK_SPEED + Client()->GameTickTime(); State.Add(&g_pData->m_aAnimations[ANIM_NINJA_SWING], clamp(ct*2.0f,0.0f,1.0f), 1.0f); } - + // do skidding if(!InAir && WantOtherDir && length(Vel*50) > 500.0f) { @@ -350,7 +350,7 @@ void CPlayers::RenderPlayer( m_pClient->m_pSounds->Play(CSounds::CHN_WORLD, SOUND_PLAYER_SKID, 0.25f, Position); SkidSoundTime = time_get(); } - + m_pClient->m_pEffects->SkidTrail( Position+vec2(-Player.m_Direction*6,12), vec2(-Player.m_Direction*100*length(Vel),-50) @@ -422,7 +422,7 @@ void CPlayers::RenderPlayer( { vec2 Dir = vec2(pPlayerChar->m_X,pPlayerChar->m_Y) - vec2(pPrevChar->m_X, pPrevChar->m_Y); Dir = normalize(Dir); - float HadOkenAngle = GetAngle(Dir); + float HadOkenAngle = GetAngle(Dir); Graphics()->QuadsSetRotation(HadOkenAngle ); //float offsety = -data->weapons[iw].muzzleoffsety; RenderTools()->SelectSprite(g_pData->m_Weapons.m_aId[iw].m_aSpriteMuzzles[IteX], 0); @@ -564,7 +564,7 @@ void CPlayers::OnRender() bool Local = ((const CNetObj_PlayerInfo *)pInfo)->m_Local !=0; if((p % 2) == 0 && Local) continue; if((p % 2) == 1 && !Local) continue; - + CNetObj_Character PrevChar = m_pClient->m_Snap.m_aCharacters[i].m_Prev; CNetObj_Character CurChar = m_pClient->m_Snap.m_aCharacters[i].m_Cur; @@ -582,7 +582,7 @@ void CPlayers::OnRender() (const CNetObj_PlayerInfo *)pPrevInfo, (const CNetObj_PlayerInfo *)pInfo ); - } + } } } } |