mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-20 15:08:19 +00:00
Merge #2368
2368: Make spec character rendering a bit cleaner r=def- a=heinrich5991 Co-authored-by: heinrich5991 <heinrich5991@gmail.com>
This commit is contained in:
commit
97c7525438
|
@ -270,13 +270,9 @@ Objects = [
|
||||||
NetIntAny("m_Test"),
|
NetIntAny("m_Test"),
|
||||||
]),
|
]),
|
||||||
|
|
||||||
NetObjectEx("SpecChar", "spec-char-2@netobj.ddnet.tw", [
|
NetObjectEx("SpecChar", "spec-char@netobj.ddnet.tw", [
|
||||||
NetIntAny("m_X"),
|
NetIntAny("m_X"),
|
||||||
NetIntAny("m_Y"),
|
NetIntAny("m_Y"),
|
||||||
NetIntAny("m_HookState"),
|
|
||||||
NetIntAny("m_HookedPlayer"),
|
|
||||||
NetIntAny("m_HookX"),
|
|
||||||
NetIntAny("m_HookY"),
|
|
||||||
]),
|
]),
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
|
@ -339,8 +339,8 @@ void CGhost::OnRender()
|
||||||
|
|
||||||
Player.m_AttackTick += Client()->GameTick(g_Config.m_ClDummy) - GhostTick;
|
Player.m_AttackTick += Client()->GameTick(g_Config.m_ClDummy) - GhostTick;
|
||||||
|
|
||||||
m_pClient->m_pPlayers->RenderHook(&Prev, &Player, &pGhost->m_RenderInfo , -2, false, IntraTick);
|
m_pClient->m_pPlayers->RenderHook(&Prev, &Player, &pGhost->m_RenderInfo , -2, IntraTick);
|
||||||
m_pClient->m_pPlayers->RenderPlayer(&Prev, &Player, &pGhost->m_RenderInfo, -2, false, IntraTick);
|
m_pClient->m_pPlayers->RenderPlayer(&Prev, &Player, &pGhost->m_RenderInfo, -2, IntraTick);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -35,12 +35,13 @@ void CNamePlates::RenderNameplate(
|
||||||
else
|
else
|
||||||
Position = mix(vec2(pPrevChar->m_X, pPrevChar->m_Y), vec2(pPlayerChar->m_X, pPlayerChar->m_Y), Client()->IntraGameTick(g_Config.m_ClDummy));
|
Position = mix(vec2(pPrevChar->m_X, pPrevChar->m_Y), vec2(pPlayerChar->m_X, pPlayerChar->m_Y), Client()->IntraGameTick(g_Config.m_ClDummy));
|
||||||
|
|
||||||
if(m_pClient->m_aClients[ClientID].m_Spec)
|
RenderNameplatePos(Position, pPlayerInfo, 1.0f);
|
||||||
{
|
|
||||||
Position.x = m_pClient->m_aClients[ClientID].m_SpecChar.m_X;
|
|
||||||
Position.y = m_pClient->m_aClients[ClientID].m_SpecChar.m_Y;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CNamePlates::RenderNameplatePos(vec2 Position, const CNetObj_PlayerInfo *pPlayerInfo, float Alpha)
|
||||||
|
{
|
||||||
|
int ClientID = pPlayerInfo->m_ClientID;
|
||||||
|
|
||||||
bool OtherTeam = m_pClient->IsOtherTeam(ClientID);
|
bool OtherTeam = m_pClient->IsOtherTeam(ClientID);
|
||||||
|
|
||||||
float FontSize = 18.0f + 20.0f * g_Config.m_ClNameplatesSize / 100.0f;
|
float FontSize = 18.0f + 20.0f * g_Config.m_ClNameplatesSize / 100.0f;
|
||||||
|
@ -119,18 +120,10 @@ void CNamePlates::RenderNameplate(
|
||||||
TColor.Set(rgb.r, rgb.g, rgb.b, g_Config.m_ClShowOthersAlpha / 100.0f);
|
TColor.Set(rgb.r, rgb.g, rgb.b, g_Config.m_ClShowOthersAlpha / 100.0f);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
|
||||||
if(m_pClient->m_aClients[ClientID].m_Spec)
|
|
||||||
{
|
|
||||||
TOutlineColor.Set(0.0f, 0.0f, 0.0f, 0.2f * g_Config.m_ClShowOthersAlpha / 100.0f);
|
|
||||||
TColor.Set(rgb.r, rgb.g, rgb.b, g_Config.m_ClShowOthersAlpha / 100.0f);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
{
|
||||||
TOutlineColor.Set(0.0f, 0.0f, 0.0f, 0.5f*a);
|
TOutlineColor.Set(0.0f, 0.0f, 0.0f, 0.5f*a);
|
||||||
TColor.Set(rgb.r, rgb.g, rgb.b, a);
|
TColor.Set(rgb.r, rgb.g, rgb.b, a);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
if(g_Config.m_ClNameplatesTeamcolors && m_pClient->m_Snap.m_pGameInfoObj && m_pClient->m_Snap.m_pGameInfoObj->m_GameFlags&GAMEFLAG_TEAMS)
|
if(g_Config.m_ClNameplatesTeamcolors && m_pClient->m_Snap.m_pGameInfoObj && m_pClient->m_Snap.m_pGameInfoObj->m_GameFlags&GAMEFLAG_TEAMS)
|
||||||
{
|
{
|
||||||
if(m_pClient->m_aClients[ClientID].m_Team == TEAM_RED)
|
if(m_pClient->m_aClients[ClientID].m_Team == TEAM_RED)
|
||||||
|
@ -139,6 +132,9 @@ void CNamePlates::RenderNameplate(
|
||||||
TColor.Set(0.7f, 0.7f, 1.0f, a);
|
TColor.Set(0.7f, 0.7f, 1.0f, a);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TOutlineColor.m_A *= Alpha;
|
||||||
|
TColor.m_A *= Alpha;
|
||||||
|
|
||||||
if(m_aNamePlates[ClientID].m_NameTextContainerIndex != -1)
|
if(m_aNamePlates[ClientID].m_NameTextContainerIndex != -1)
|
||||||
TextRender()->RenderTextContainer(m_aNamePlates[ClientID].m_NameTextContainerIndex, &TColor, &TOutlineColor, Position.x - tw / 2.0f, Position.y - FontSize - 38.0f);
|
TextRender()->RenderTextContainer(m_aNamePlates[ClientID].m_NameTextContainerIndex, &TColor, &TOutlineColor, Position.x - tw / 2.0f, Position.y - FontSize - 38.0f);
|
||||||
|
|
||||||
|
@ -172,18 +168,25 @@ void CNamePlates::OnRender()
|
||||||
|
|
||||||
for(int i = 0; i < MAX_CLIENTS; i++)
|
for(int i = 0; i < MAX_CLIENTS; i++)
|
||||||
{
|
{
|
||||||
// only render active characters
|
const void *pInfoRaw = Client()->SnapFindItem(IClient::SNAP_CURRENT, NETOBJTYPE_PLAYERINFO, i);
|
||||||
if(!m_pClient->m_Snap.m_aCharacters[i].m_Active && (!m_pClient->m_aClients[i].m_Spec || !g_Config.m_ClShowSpecTee))
|
const CNetObj_PlayerInfo *pInfo = (CNetObj_PlayerInfo *)pInfoRaw;
|
||||||
|
if(!pInfo)
|
||||||
|
{
|
||||||
continue;
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
const void *pInfo = Client()->SnapFindItem(IClient::SNAP_CURRENT, NETOBJTYPE_PLAYERINFO, i);
|
if(m_pClient->m_aClients[i].m_SpecCharPresent)
|
||||||
|
{
|
||||||
|
RenderNameplatePos(m_pClient->m_aClients[i].m_SpecChar, pInfo, 0.4f);
|
||||||
|
}
|
||||||
|
|
||||||
if(pInfo)
|
// only render active characters
|
||||||
|
if(m_pClient->m_Snap.m_aCharacters[i].m_Active)
|
||||||
{
|
{
|
||||||
RenderNameplate(
|
RenderNameplate(
|
||||||
&m_pClient->m_Snap.m_aCharacters[i].m_Prev,
|
&m_pClient->m_Snap.m_aCharacters[i].m_Prev,
|
||||||
&m_pClient->m_Snap.m_aCharacters[i].m_Cur,
|
&m_pClient->m_Snap.m_aCharacters[i].m_Cur,
|
||||||
(const CNetObj_PlayerInfo *)pInfo);
|
pInfo);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -39,6 +39,7 @@ class CNamePlates : public CComponent
|
||||||
const CNetObj_Character *pPlayerChar,
|
const CNetObj_Character *pPlayerChar,
|
||||||
const CNetObj_PlayerInfo *pPlayerInfo
|
const CNetObj_PlayerInfo *pPlayerInfo
|
||||||
);
|
);
|
||||||
|
void RenderNameplatePos(vec2 Position, const CNetObj_PlayerInfo *pPlayerInfo, float Alpha);
|
||||||
|
|
||||||
SPlayerNamePlate m_aNamePlates[MAX_CLIENTS];
|
SPlayerNamePlate m_aNamePlates[MAX_CLIENTS];
|
||||||
class CPlayers* m_pPlayers;
|
class CPlayers* m_pPlayers;
|
||||||
|
|
|
@ -81,7 +81,6 @@ void CPlayers::RenderHook(
|
||||||
const CNetObj_Character *pPlayerChar,
|
const CNetObj_Character *pPlayerChar,
|
||||||
const CTeeRenderInfo *pRenderInfo,
|
const CTeeRenderInfo *pRenderInfo,
|
||||||
int ClientID,
|
int ClientID,
|
||||||
bool Spec,
|
|
||||||
float Intra
|
float Intra
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
|
@ -92,13 +91,8 @@ void CPlayers::RenderHook(
|
||||||
|
|
||||||
CTeeRenderInfo RenderInfo = *pRenderInfo;
|
CTeeRenderInfo RenderInfo = *pRenderInfo;
|
||||||
|
|
||||||
int HookedPlayer = pPlayerChar->m_HookedPlayer;
|
|
||||||
|
|
||||||
if(Spec)
|
|
||||||
HookedPlayer = m_pClient->m_aClients[ClientID].m_SpecChar.m_HookedPlayer;
|
|
||||||
|
|
||||||
// don't render hooks to not active character cores
|
// don't render hooks to not active character cores
|
||||||
if(HookedPlayer != -1 && !m_pClient->m_Snap.m_aCharacters[HookedPlayer].m_Active)
|
if(pPlayerChar->m_HookedPlayer != -1 && !m_pClient->m_Snap.m_aCharacters[pPlayerChar->m_HookedPlayer].m_Active)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
float IntraTick = Intra;
|
float IntraTick = Intra;
|
||||||
|
@ -115,14 +109,8 @@ void CPlayers::RenderHook(
|
||||||
else
|
else
|
||||||
Position = mix(vec2(Prev.m_X, Prev.m_Y), vec2(Player.m_X, Player.m_Y), IntraTick);
|
Position = mix(vec2(Prev.m_X, Prev.m_Y), vec2(Player.m_X, Player.m_Y), IntraTick);
|
||||||
|
|
||||||
if(Spec)
|
|
||||||
{
|
|
||||||
Position.x = m_pClient->m_aClients[ClientID].m_SpecChar.m_X;
|
|
||||||
Position.y = m_pClient->m_aClients[ClientID].m_SpecChar.m_Y;
|
|
||||||
}
|
|
||||||
|
|
||||||
// draw hook
|
// draw hook
|
||||||
if((Prev.m_HookState>0 && Player.m_HookState>0) || (Spec && m_pClient->m_aClients[ClientID].m_SpecChar.m_HookState>0))
|
if(Prev.m_HookState>0 && Player.m_HookState>0)
|
||||||
{
|
{
|
||||||
Graphics()->TextureSet(g_pData->m_aImages[IMAGE_GAME].m_Id);
|
Graphics()->TextureSet(g_pData->m_aImages[IMAGE_GAME].m_Id);
|
||||||
|
|
||||||
|
@ -133,13 +121,8 @@ void CPlayers::RenderHook(
|
||||||
vec2 Pos = Position;
|
vec2 Pos = Position;
|
||||||
vec2 HookPos;
|
vec2 HookPos;
|
||||||
|
|
||||||
if(in_range(HookedPlayer, MAX_CLIENTS-1))
|
if(in_range(pPlayerChar->m_HookedPlayer, MAX_CLIENTS-1))
|
||||||
HookPos = m_pClient->m_aClients[HookedPlayer].m_RenderPos;
|
HookPos = m_pClient->m_aClients[pPlayerChar->m_HookedPlayer].m_RenderPos;
|
||||||
else if(Spec)
|
|
||||||
{
|
|
||||||
HookPos.x = m_pClient->m_aClients[ClientID].m_SpecChar.m_HookX;
|
|
||||||
HookPos.y = m_pClient->m_aClients[ClientID].m_SpecChar.m_HookY;
|
|
||||||
}
|
|
||||||
else
|
else
|
||||||
HookPos = mix(vec2(Prev.m_HookX, Prev.m_HookY), vec2(Player.m_HookX, Player.m_HookY), IntraTick);
|
HookPos = mix(vec2(Prev.m_HookX, Prev.m_HookY), vec2(Player.m_HookX, Player.m_HookY), IntraTick);
|
||||||
|
|
||||||
|
@ -150,7 +133,7 @@ void CPlayers::RenderHook(
|
||||||
Graphics()->QuadsSetRotation(GetAngle(Dir)+pi);
|
Graphics()->QuadsSetRotation(GetAngle(Dir)+pi);
|
||||||
// render head
|
// render head
|
||||||
int QuadOffset = NUM_WEAPONS * 2 + 2;
|
int QuadOffset = NUM_WEAPONS * 2 + 2;
|
||||||
if(OtherTeam || Spec)
|
if(OtherTeam)
|
||||||
Graphics()->SetColor(1.0f, 1.0f, 1.0f, g_Config.m_ClShowOthersAlpha / 100.0f);
|
Graphics()->SetColor(1.0f, 1.0f, 1.0f, g_Config.m_ClShowOthersAlpha / 100.0f);
|
||||||
Graphics()->RenderQuadContainerAsSprite(m_WeaponEmoteQuadContainerIndex, QuadOffset, HookPos.x, HookPos.y);
|
Graphics()->RenderQuadContainerAsSprite(m_WeaponEmoteQuadContainerIndex, QuadOffset, HookPos.x, HookPos.y);
|
||||||
|
|
||||||
|
@ -173,7 +156,7 @@ void CPlayers::RenderHook(
|
||||||
Graphics()->QuadsSetRotation(0);
|
Graphics()->QuadsSetRotation(0);
|
||||||
Graphics()->SetColor(1.0f, 1.0f, 1.0f, 1.0f);
|
Graphics()->SetColor(1.0f, 1.0f, 1.0f, 1.0f);
|
||||||
|
|
||||||
RenderHand(&RenderInfo, Position, normalize(HookPos-Pos), -pi/2, vec2(20, 0), (OtherTeam || Spec) ? g_Config.m_ClShowOthersAlpha / 100.0f : 1.0f);
|
RenderHand(&RenderInfo, Position, normalize(HookPos-Pos), -pi/2, vec2(20, 0), OtherTeam ? g_Config.m_ClShowOthersAlpha / 100.0f : 1.0f);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -182,7 +165,6 @@ void CPlayers::RenderPlayer(
|
||||||
const CNetObj_Character *pPlayerChar,
|
const CNetObj_Character *pPlayerChar,
|
||||||
const CTeeRenderInfo *pRenderInfo,
|
const CTeeRenderInfo *pRenderInfo,
|
||||||
int ClientID,
|
int ClientID,
|
||||||
bool Spec,
|
|
||||||
float Intra
|
float Intra
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
|
@ -195,7 +177,7 @@ void CPlayers::RenderPlayer(
|
||||||
|
|
||||||
bool Local = m_pClient->m_Snap.m_LocalClientID == ClientID;
|
bool Local = m_pClient->m_Snap.m_LocalClientID == ClientID;
|
||||||
bool OtherTeam = m_pClient->IsOtherTeam(ClientID);
|
bool OtherTeam = m_pClient->IsOtherTeam(ClientID);
|
||||||
float Alpha = (OtherTeam || Spec) ? g_Config.m_ClShowOthersAlpha / 100.0f : 1.0f;
|
float Alpha = OtherTeam ? g_Config.m_ClShowOthersAlpha / 100.0f : 1.0f;
|
||||||
|
|
||||||
// set size
|
// set size
|
||||||
RenderInfo.m_Size = 64.0f;
|
RenderInfo.m_Size = 64.0f;
|
||||||
|
@ -253,12 +235,6 @@ void CPlayers::RenderPlayer(
|
||||||
else
|
else
|
||||||
Position = mix(vec2(Prev.m_X, Prev.m_Y), vec2(Player.m_X, Player.m_Y), IntraTick);
|
Position = mix(vec2(Prev.m_X, Prev.m_Y), vec2(Player.m_X, Player.m_Y), IntraTick);
|
||||||
|
|
||||||
if(Spec)
|
|
||||||
{
|
|
||||||
Position.x = m_pClient->m_aClients[ClientID].m_SpecChar.m_X;
|
|
||||||
Position.y = m_pClient->m_aClients[ClientID].m_SpecChar.m_Y;
|
|
||||||
}
|
|
||||||
|
|
||||||
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);
|
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);
|
m_pClient->m_pFlow->Add(Position, Vel*100.0f, 10.0f);
|
||||||
|
@ -304,7 +280,6 @@ void CPlayers::RenderPlayer(
|
||||||
}
|
}
|
||||||
|
|
||||||
// draw gun
|
// draw gun
|
||||||
if(!Spec)
|
|
||||||
{
|
{
|
||||||
#if defined(CONF_VIDEORECORDER)
|
#if defined(CONF_VIDEORECORDER)
|
||||||
if(ClientID >= 0 && ((GameClient()->m_GameInfo.m_AllowHookColl && g_Config.m_ClShowHookCollAlways) || (Player.m_PlayerFlags&PLAYERFLAG_AIM && ((!Local && ((!IVideo::Current()&&g_Config.m_ClShowHookCollOther)||(IVideo::Current()&&g_Config.m_ClVideoShowHookCollOther))) || (Local && g_Config.m_ClShowHookCollOwn)))))
|
if(ClientID >= 0 && ((GameClient()->m_GameInfo.m_AllowHookColl && g_Config.m_ClShowHookCollAlways) || (Player.m_PlayerFlags&PLAYERFLAG_AIM && ((!Local && ((!IVideo::Current()&&g_Config.m_ClShowHookCollOther)||(IVideo::Current()&&g_Config.m_ClVideoShowHookCollOther))) || (Local && g_Config.m_ClShowHookCollOwn)))))
|
||||||
|
@ -586,14 +561,11 @@ void CPlayers::RenderPlayer(
|
||||||
Graphics()->QuadsSetRotation(0);
|
Graphics()->QuadsSetRotation(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(OtherTeam || Spec || ClientID < 0)
|
if(OtherTeam || ClientID < 0)
|
||||||
RenderTools()->RenderTee(&State, &RenderInfo, Player.m_Emote, Direction, Position, g_Config.m_ClShowOthersAlpha / 100.0f);
|
RenderTools()->RenderTee(&State, &RenderInfo, Player.m_Emote, Direction, Position, g_Config.m_ClShowOthersAlpha / 100.0f);
|
||||||
else
|
else
|
||||||
RenderTools()->RenderTee(&State, &RenderInfo, Player.m_Emote, Direction, Position);
|
RenderTools()->RenderTee(&State, &RenderInfo, Player.m_Emote, Direction, Position);
|
||||||
|
|
||||||
if(Spec)
|
|
||||||
return;
|
|
||||||
|
|
||||||
int QuadOffsetToEmoticon = NUM_WEAPONS * 2 + 2 + 2;
|
int QuadOffsetToEmoticon = NUM_WEAPONS * 2 + 2 + 2;
|
||||||
if(Player.m_PlayerFlags&PLAYERFLAG_CHATTING)
|
if(Player.m_PlayerFlags&PLAYERFLAG_CHATTING)
|
||||||
{
|
{
|
||||||
|
@ -680,57 +652,53 @@ void CPlayers::OnRender()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
m_RenderInfoSpec.m_Texture = m_pClient->m_pSkins->Get(m_pClient->m_pSkins->Find("x_spec"))->m_OrgTexture;
|
||||||
|
m_RenderInfoSpec.m_Size = 64.0f;
|
||||||
|
|
||||||
// render other players in two passes, first pass we render the other, second pass we render our self
|
// render other players in three passes, first pass we render spectees,
|
||||||
for(int p = 0; p < 4; p++)
|
// then everyone but us, and finally we render ourselves
|
||||||
|
for(int p = 0; p < 6; p++)
|
||||||
{
|
{
|
||||||
for(int i = 0; i < MAX_CLIENTS; i++)
|
for(int i = 0; i < MAX_CLIENTS; i++)
|
||||||
{
|
{
|
||||||
// only render active characters
|
// only render active characters
|
||||||
if(!m_pClient->m_Snap.m_aCharacters[i].m_Active && (!m_pClient->m_aClients[i].m_Spec || !g_Config.m_ClShowSpecTee))
|
if(p % 3 == 0 && !m_pClient->m_aClients[i].m_SpecCharPresent)
|
||||||
|
continue;
|
||||||
|
if(p % 3 != 0 && !m_pClient->m_Snap.m_aCharacters[i].m_Active)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
if(p % 3 == 0)
|
||||||
|
{
|
||||||
|
if(p < 3)
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
vec2 Pos = m_pClient->m_aClients[i].m_SpecChar;
|
||||||
|
RenderTools()->RenderTee(CAnimState::GetIdle(), &m_RenderInfoSpec, EMOTE_BLINK, vec2(1, 0), Pos, 1.0f);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
const void *pPrevInfo = Client()->SnapFindItem(IClient::SNAP_PREV, NETOBJTYPE_PLAYERINFO, i);
|
const void *pPrevInfo = Client()->SnapFindItem(IClient::SNAP_PREV, NETOBJTYPE_PLAYERINFO, i);
|
||||||
const void *pInfo = Client()->SnapFindItem(IClient::SNAP_CURRENT, NETOBJTYPE_PLAYERINFO, i);
|
const void *pInfo = Client()->SnapFindItem(IClient::SNAP_CURRENT, NETOBJTYPE_PLAYERINFO, i);
|
||||||
|
if(!pPrevInfo || !pInfo)
|
||||||
if(pPrevInfo && pInfo)
|
|
||||||
{
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
bool Local = m_pClient->m_Snap.m_LocalClientID == i;
|
bool Local = m_pClient->m_Snap.m_LocalClientID == i;
|
||||||
if((p % 2) == 0 && Local) continue;
|
if((p % 3) == 1 && Local) continue;
|
||||||
if((p % 2) == 1 && !Local) continue;
|
if((p % 3) == 2 && !Local) continue;
|
||||||
|
|
||||||
CNetObj_Character PrevChar = m_pClient->m_aClients[i].m_RenderPrev;
|
CNetObj_Character PrevChar = m_pClient->m_aClients[i].m_RenderPrev;
|
||||||
CNetObj_Character CurChar = m_pClient->m_aClients[i].m_RenderCur;
|
CNetObj_Character CurChar = m_pClient->m_aClients[i].m_RenderCur;
|
||||||
|
|
||||||
|
if(p<3)
|
||||||
if(m_pClient->m_aClients[i].m_Spec && !m_pClient->m_Snap.m_aCharacters[i].m_Active)
|
|
||||||
{
|
{
|
||||||
int Skin = m_pClient->m_pSkins->Find("x_spec");
|
RenderHook(&PrevChar, &CurChar, &m_aRenderInfo[i], i);
|
||||||
if(Skin != -1)
|
|
||||||
{
|
|
||||||
m_aRenderInfo[i].m_Texture = m_pClient->m_pSkins->Get(Skin)->m_ColorTexture;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if(p<2)
|
|
||||||
{
|
|
||||||
RenderHook(
|
|
||||||
&PrevChar,
|
|
||||||
&CurChar,
|
|
||||||
&m_aRenderInfo[i],
|
|
||||||
i,
|
|
||||||
m_pClient->m_aClients[i].m_Spec && !m_pClient->m_Snap.m_aCharacters[i].m_Active
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
RenderPlayer(
|
RenderPlayer(&PrevChar, &CurChar, &m_aRenderInfo[i], i);
|
||||||
&PrevChar,
|
|
||||||
&CurChar,
|
|
||||||
&m_aRenderInfo[i],
|
|
||||||
i,
|
|
||||||
m_pClient->m_aClients[i].m_Spec && !m_pClient->m_Snap.m_aCharacters[i].m_Active
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,6 +8,7 @@ class CPlayers : public CComponent
|
||||||
{
|
{
|
||||||
friend class CGhost;
|
friend class CGhost;
|
||||||
|
|
||||||
|
CTeeRenderInfo m_RenderInfoSpec;
|
||||||
CTeeRenderInfo m_aRenderInfo[MAX_CLIENTS];
|
CTeeRenderInfo m_aRenderInfo[MAX_CLIENTS];
|
||||||
void RenderHand(class CTeeRenderInfo *pInfo, vec2 CenterPos, vec2 Dir, float AngleOffset, vec2 PostRotOffset, float Alpha = 1.0f);
|
void RenderHand(class CTeeRenderInfo *pInfo, vec2 CenterPos, vec2 Dir, float AngleOffset, vec2 PostRotOffset, float Alpha = 1.0f);
|
||||||
void RenderPlayer(
|
void RenderPlayer(
|
||||||
|
@ -15,7 +16,6 @@ class CPlayers : public CComponent
|
||||||
const CNetObj_Character *pPlayerChar,
|
const CNetObj_Character *pPlayerChar,
|
||||||
const CTeeRenderInfo *pRenderInfo,
|
const CTeeRenderInfo *pRenderInfo,
|
||||||
int ClientID,
|
int ClientID,
|
||||||
bool Spec,
|
|
||||||
float Intra = 0.f
|
float Intra = 0.f
|
||||||
);
|
);
|
||||||
void RenderHook(
|
void RenderHook(
|
||||||
|
@ -23,7 +23,6 @@ class CPlayers : public CComponent
|
||||||
const CNetObj_Character *pPlayerChar,
|
const CNetObj_Character *pPlayerChar,
|
||||||
const CTeeRenderInfo *pRenderInfo,
|
const CTeeRenderInfo *pRenderInfo,
|
||||||
int ClientID,
|
int ClientID,
|
||||||
bool Spec,
|
|
||||||
float Intra = 0.f
|
float Intra = 0.f
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
|
@ -1135,6 +1135,11 @@ void CGameClient::OnNewSnapshot()
|
||||||
|
|
||||||
bool FoundGameInfoEx = false;
|
bool FoundGameInfoEx = false;
|
||||||
|
|
||||||
|
for(int i = 0; i < MAX_CLIENTS; i++)
|
||||||
|
{
|
||||||
|
m_aClients[i].m_SpecCharPresent = false;
|
||||||
|
}
|
||||||
|
|
||||||
// go trough all the items in the snapshot and gather the info we want
|
// go trough all the items in the snapshot and gather the info we want
|
||||||
{
|
{
|
||||||
m_Snap.m_aTeamSize[TEAM_RED] = m_Snap.m_aTeamSize[TEAM_BLUE] = 0;
|
m_Snap.m_aTeamSize[TEAM_RED] = m_Snap.m_aTeamSize[TEAM_BLUE] = 0;
|
||||||
|
@ -1288,12 +1293,9 @@ void CGameClient::OnNewSnapshot()
|
||||||
{
|
{
|
||||||
const CNetObj_SpecChar *pSpecCharData = (const CNetObj_SpecChar *)pData;
|
const CNetObj_SpecChar *pSpecCharData = (const CNetObj_SpecChar *)pData;
|
||||||
|
|
||||||
m_aClients[Item.m_ID].m_SpecChar.m_X = pSpecCharData->m_X;
|
m_aClients[Item.m_ID].m_SpecCharPresent = true;
|
||||||
m_aClients[Item.m_ID].m_SpecChar.m_Y = pSpecCharData->m_Y;
|
m_aClients[Item.m_ID].m_SpecChar.x = pSpecCharData->m_X;
|
||||||
m_aClients[Item.m_ID].m_SpecChar.m_HookState = pSpecCharData->m_HookState;
|
m_aClients[Item.m_ID].m_SpecChar.y = pSpecCharData->m_Y;
|
||||||
m_aClients[Item.m_ID].m_SpecChar.m_HookedPlayer = pSpecCharData->m_HookedPlayer;
|
|
||||||
m_aClients[Item.m_ID].m_SpecChar.m_HookX = pSpecCharData->m_HookX;
|
|
||||||
m_aClients[Item.m_ID].m_SpecChar.m_HookY = pSpecCharData->m_HookY;
|
|
||||||
}
|
}
|
||||||
else if(Item.m_Type == NETOBJTYPE_SPECTATORINFO)
|
else if(Item.m_Type == NETOBJTYPE_SPECTATORINFO)
|
||||||
{
|
{
|
||||||
|
@ -1864,8 +1866,8 @@ void CGameClient::CClientData::Reset()
|
||||||
|
|
||||||
m_Evolved.m_Tick = -1;
|
m_Evolved.m_Tick = -1;
|
||||||
|
|
||||||
m_SpecChar.m_X = 0;
|
m_SpecChar = vec2(0, 0);
|
||||||
m_SpecChar.m_Y = 0;
|
m_SpecCharPresent = false;
|
||||||
|
|
||||||
UpdateRenderInfo();
|
UpdateRenderInfo();
|
||||||
}
|
}
|
||||||
|
|
|
@ -290,16 +290,8 @@ public:
|
||||||
int64 m_SmoothLen[2];
|
int64 m_SmoothLen[2];
|
||||||
vec2 m_PredPos[200];
|
vec2 m_PredPos[200];
|
||||||
int m_PredTick[200];
|
int m_PredTick[200];
|
||||||
|
bool m_SpecCharPresent;
|
||||||
struct SpecChar
|
vec2 m_SpecChar;
|
||||||
{
|
|
||||||
int m_X;
|
|
||||||
int m_Y;
|
|
||||||
int m_HookState;
|
|
||||||
int m_HookedPlayer;
|
|
||||||
int m_HookX;
|
|
||||||
int m_HookY;
|
|
||||||
} m_SpecChar;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
CClientData m_aClients[MAX_CLIENTS];
|
CClientData m_aClients[MAX_CLIENTS];
|
||||||
|
|
|
@ -404,15 +404,11 @@ void CPlayer::Snap(int SnappingClient)
|
||||||
pRaceInfo->m_RaceStartTick = m_pCharacter->m_StartTime;
|
pRaceInfo->m_RaceStartTick = m_pCharacter->m_StartTime;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(m_Paused == PAUSE_SPEC && m_pCharacter && m_pCharacter->Core())
|
if(m_pCharacter && m_pCharacter->IsPaused())
|
||||||
{
|
{
|
||||||
CNetObj_SpecChar *pSpecChar = static_cast<CNetObj_SpecChar *>(Server()->SnapNewItem(NETOBJTYPE_SPECCHAR, id, sizeof(CNetObj_SpecChar)));
|
CNetObj_SpecChar *pSpecChar = static_cast<CNetObj_SpecChar *>(Server()->SnapNewItem(NETOBJTYPE_SPECCHAR, id, sizeof(CNetObj_SpecChar)));
|
||||||
pSpecChar->m_X = m_pCharacter->Core()->m_Pos.x;
|
pSpecChar->m_X = m_pCharacter->Core()->m_Pos.x;
|
||||||
pSpecChar->m_Y = m_pCharacter->Core()->m_Pos.y;
|
pSpecChar->m_Y = m_pCharacter->Core()->m_Pos.y;
|
||||||
pSpecChar->m_HookState = m_pCharacter->Core()->m_HookState;
|
|
||||||
pSpecChar->m_HookedPlayer = m_pCharacter->Core()->m_HookedPlayer;
|
|
||||||
pSpecChar->m_HookX = m_pCharacter->Core()->m_HookPos.x;
|
|
||||||
pSpecChar->m_HookY = m_pCharacter->Core()->m_HookPos.y;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue