mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-10 10:08:18 +00:00
add buffering for dmg indicator, map items, particles and players
This commit is contained in:
parent
59f9d021ce
commit
a59d7401b5
|
@ -48,7 +48,6 @@ void CDamageInd::Create(vec2 Pos, vec2 Dir)
|
|||
void CDamageInd::OnRender()
|
||||
{
|
||||
Graphics()->TextureSet(g_pData->m_aImages[IMAGE_GAME].m_Id);
|
||||
Graphics()->QuadsBegin();
|
||||
static float s_LastLocalTime = Client()->LocalTime();
|
||||
for(int i = 0; i < m_NumItems;)
|
||||
{
|
||||
|
@ -74,13 +73,24 @@ void CDamageInd::OnRender()
|
|||
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);
|
||||
Graphics()->RenderQuadContainerAsSprite(m_DmgIndQuadContainerIndex, 0, Pos.x, Pos.y);
|
||||
i++;
|
||||
}
|
||||
}
|
||||
s_LastLocalTime = Client()->LocalTime();
|
||||
Graphics()->QuadsEnd();
|
||||
|
||||
Graphics()->QuadsSetRotation(0);
|
||||
Graphics()->SetColor(1.f, 1.f, 1.f, 1.f);
|
||||
}
|
||||
|
||||
void CDamageInd::OnInit()
|
||||
{
|
||||
Graphics()->QuadsSetRotation(0);
|
||||
Graphics()->SetColor(1.f, 1.f, 1.f, 1.f);
|
||||
|
||||
m_DmgIndQuadContainerIndex = Graphics()->CreateQuadContainer();
|
||||
RenderTools()->SelectSprite(SPRITE_STAR1);
|
||||
RenderTools()->QuadContainerAddSprite(m_DmgIndQuadContainerIndex, 48.f);
|
||||
}
|
||||
|
||||
void CDamageInd::Reset()
|
||||
|
|
|
@ -27,11 +27,13 @@ class CDamageInd : public CComponent
|
|||
CItem *CreateI();
|
||||
void DestroyI(CItem *i);
|
||||
|
||||
int m_DmgIndQuadContainerIndex;
|
||||
public:
|
||||
CDamageInd();
|
||||
|
||||
void Create(vec2 Pos, vec2 Dir);
|
||||
void Reset();
|
||||
virtual void OnRender();
|
||||
virtual void OnInit();
|
||||
};
|
||||
#endif
|
||||
|
|
|
@ -82,9 +82,10 @@ void CItems::RenderProjectile(const CNetObj_Projectile *pCurrent, int ItemID)
|
|||
|
||||
|
||||
Graphics()->TextureSet(g_pData->m_aImages[IMAGE_GAME].m_Id);
|
||||
Graphics()->QuadsBegin();
|
||||
Graphics()->SetColor(1.f, 1.f, 1.f, 1.f);
|
||||
|
||||
int QuadOffset = 2 + 4 + NUM_WEAPONS + clamp(pCurrent->m_Type, 0, NUM_WEAPONS - 1);
|
||||
|
||||
RenderTools()->SelectSprite(g_pData->m_Weapons.m_aId[clamp(pCurrent->m_Type, 0, NUM_WEAPONS-1)].m_pSpriteProj);
|
||||
vec2 Vel = Pos-PrevPos;
|
||||
//vec2 pos = mix(vec2(prev->x, prev->y), vec2(current->x, current->y), Client()->IntraGameTick());
|
||||
|
||||
|
@ -122,25 +123,23 @@ void CItems::RenderProjectile(const CNetObj_Projectile *pCurrent, int ItemID)
|
|||
|
||||
}
|
||||
|
||||
IGraphics::CQuadItem QuadItem(Pos.x, Pos.y, 32, 32);
|
||||
Graphics()->QuadsDraw(&QuadItem, 1);
|
||||
|
||||
Graphics()->QuadsSetRotation(0);
|
||||
Graphics()->QuadsEnd();
|
||||
Graphics()->RenderQuadContainerAsSprite(m_ItemsQuadContainerIndex, QuadOffset, Pos.x, Pos.y);
|
||||
}
|
||||
|
||||
void CItems::RenderPickup(const CNetObj_Pickup *pPrev, const CNetObj_Pickup *pCurrent)
|
||||
{
|
||||
Graphics()->TextureSet(g_pData->m_aImages[IMAGE_GAME].m_Id);
|
||||
Graphics()->QuadsBegin();
|
||||
Graphics()->QuadsSetRotation(0);
|
||||
Graphics()->SetColor(1.f, 1.f, 1.f, 1.f);
|
||||
|
||||
int QuadOffset = 2;
|
||||
|
||||
vec2 Pos = mix(vec2(pPrev->m_X, pPrev->m_Y), vec2(pCurrent->m_X, pCurrent->m_Y), Client()->IntraGameTick());
|
||||
float Angle = 0.0f;
|
||||
float Size = 64.0f;
|
||||
if(pCurrent->m_Type == POWERUP_WEAPON)
|
||||
{
|
||||
Angle = 0; //-pi/6;//-0.25f * pi * 2.0f;
|
||||
RenderTools()->SelectSprite(g_pData->m_Weapons.m_aId[clamp(pCurrent->m_Subtype, 0, NUM_WEAPONS-1)].m_pSpriteBody);
|
||||
Size = g_pData->m_Weapons.m_aId[clamp(pCurrent->m_Subtype, 0, NUM_WEAPONS-1)].m_VisualSize;
|
||||
QuadOffset += 4 + clamp(pCurrent->m_Subtype, 0, NUM_WEAPONS - 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -150,12 +149,11 @@ void CItems::RenderPickup(const CNetObj_Pickup *pPrev, const CNetObj_Pickup *pCu
|
|||
SPRITE_PICKUP_WEAPON,
|
||||
SPRITE_PICKUP_NINJA
|
||||
};
|
||||
RenderTools()->SelectSprite(c[pCurrent->m_Type]);
|
||||
QuadOffset += pCurrent->m_Type;
|
||||
|
||||
if(c[pCurrent->m_Type] == SPRITE_PICKUP_NINJA)
|
||||
{
|
||||
m_pClient->m_pEffects->PowerupShine(Pos, vec2(96,18));
|
||||
Size *= 2.0f;
|
||||
Pos.x -= 10.0f;
|
||||
}
|
||||
}
|
||||
|
@ -179,8 +177,8 @@ void CItems::RenderPickup(const CNetObj_Pickup *pPrev, const CNetObj_Pickup *pCu
|
|||
Pos.x += cosf(s_Time*2.0f+Offset)*2.5f;
|
||||
Pos.y += sinf(s_Time*2.0f+Offset)*2.5f;
|
||||
s_LastLocalTime = Client()->LocalTime();
|
||||
RenderTools()->DrawSprite(Pos.x, Pos.y, Size);
|
||||
Graphics()->QuadsEnd();
|
||||
|
||||
Graphics()->RenderQuadContainerAsSprite(m_ItemsQuadContainerIndex, QuadOffset, Pos.x, Pos.y);
|
||||
}
|
||||
|
||||
void CItems::RenderFlag(const CNetObj_Flag *pPrev, const CNetObj_Flag *pCurrent, const CNetObj_GameData *pPrevGameData, const CNetObj_GameData *pCurGameData)
|
||||
|
@ -188,14 +186,13 @@ void CItems::RenderFlag(const CNetObj_Flag *pPrev, const CNetObj_Flag *pCurrent,
|
|||
float Angle = 0.0f;
|
||||
float Size = 42.0f;
|
||||
|
||||
Graphics()->BlendNormal();
|
||||
Graphics()->TextureSet(g_pData->m_aImages[IMAGE_GAME].m_Id);
|
||||
Graphics()->QuadsBegin();
|
||||
Graphics()->QuadsSetRotation(0);
|
||||
Graphics()->SetColor(1.f, 1.f, 1.f, 1.f);
|
||||
int QuadOffset = 0;
|
||||
|
||||
if(pCurrent->m_Team == TEAM_RED)
|
||||
RenderTools()->SelectSprite(SPRITE_FLAG_RED);
|
||||
else
|
||||
RenderTools()->SelectSprite(SPRITE_FLAG_BLUE);
|
||||
if(pCurrent->m_Team != TEAM_RED)
|
||||
++QuadOffset;
|
||||
|
||||
Graphics()->QuadsSetRotation(Angle);
|
||||
|
||||
|
@ -216,9 +213,7 @@ void CItems::RenderFlag(const CNetObj_Flag *pPrev, const CNetObj_Flag *pCurrent,
|
|||
Pos = m_pClient->m_LocalCharacterPos;
|
||||
}
|
||||
|
||||
IGraphics::CQuadItem QuadItem(Pos.x, Pos.y-Size*0.75f, Size, Size*2);
|
||||
Graphics()->QuadsDraw(&QuadItem, 1);
|
||||
Graphics()->QuadsEnd();
|
||||
Graphics()->RenderQuadContainerAsSprite(m_ItemsQuadContainerIndex, QuadOffset, Pos.x, Pos.y-Size*0.75f);
|
||||
}
|
||||
|
||||
|
||||
|
@ -237,13 +232,9 @@ void CItems::RenderLaser(const struct CNetObj_Laser *pCurrent)
|
|||
|
||||
vec2 Out, Border;
|
||||
|
||||
Graphics()->BlendNormal();
|
||||
Graphics()->TextureSet(-1);
|
||||
Graphics()->QuadsBegin();
|
||||
|
||||
//vec4 inner_color(0.15f,0.35f,0.75f,1.0f);
|
||||
//vec4 outer_color(0.65f,0.85f,1.0f,1.0f);
|
||||
|
||||
// do outline
|
||||
RGB = HslToRgb(vec3(g_Config.m_ClLaserOutlineHue / 255.0f, g_Config.m_ClLaserOutlineSat / 255.0f, g_Config.m_ClLaserOutlineLht / 255.0f));
|
||||
vec4 OuterColor(RGB.r, RGB.g, RGB.b, 1.0f);
|
||||
|
@ -274,23 +265,15 @@ void CItems::RenderLaser(const struct CNetObj_Laser *pCurrent)
|
|||
|
||||
// render head
|
||||
{
|
||||
Graphics()->BlendNormal();
|
||||
Graphics()->TextureSet(g_pData->m_aImages[IMAGE_PARTICLES].m_Id);
|
||||
Graphics()->QuadsBegin();
|
||||
int QuadOffset = 2 + 4 + NUM_WEAPONS * 2 + (Client()->GameTick() % 3);
|
||||
|
||||
int Sprites[] = {SPRITE_PART_SPLAT01, SPRITE_PART_SPLAT02, SPRITE_PART_SPLAT03};
|
||||
RenderTools()->SelectSprite(Sprites[Client()->GameTick()%3]);
|
||||
Graphics()->TextureSet(g_pData->m_aImages[IMAGE_PARTICLES].m_Id);
|
||||
Graphics()->QuadsSetRotation(Client()->GameTick());
|
||||
Graphics()->SetColor(OuterColor.r, OuterColor.g, OuterColor.b, 1.0f);
|
||||
IGraphics::CQuadItem QuadItem(Pos.x, Pos.y, 24, 24);
|
||||
Graphics()->QuadsDraw(&QuadItem, 1);
|
||||
Graphics()->RenderQuadContainerAsSprite(m_ItemsQuadContainerIndex, QuadOffset, Pos.x, Pos.y);
|
||||
Graphics()->SetColor(InnerColor.r, InnerColor.g, InnerColor.b, 1.0f);
|
||||
QuadItem = IGraphics::CQuadItem(Pos.x, Pos.y, 20, 20);
|
||||
Graphics()->QuadsDraw(&QuadItem, 1);
|
||||
Graphics()->QuadsEnd();
|
||||
Graphics()->RenderQuadContainerAsSprite(m_ItemsQuadContainerIndex, QuadOffset, Pos.x, Pos.y, 20.f/24.f, 20.f / 24.f);
|
||||
}
|
||||
|
||||
Graphics()->BlendNormal();
|
||||
}
|
||||
|
||||
void CItems::OnRender()
|
||||
|
@ -349,6 +332,51 @@ void CItems::OnRender()
|
|||
else
|
||||
RenderProjectile(&m_aExtraProjectiles[i], 0);
|
||||
}
|
||||
|
||||
Graphics()->QuadsSetRotation(0);
|
||||
Graphics()->SetColor(1.f, 1.f, 1.f, 1.f);
|
||||
}
|
||||
|
||||
void CItems::OnInit()
|
||||
{
|
||||
Graphics()->QuadsSetRotation(0);
|
||||
Graphics()->SetColor(1.f, 1.f, 1.f, 1.f);
|
||||
|
||||
m_ItemsQuadContainerIndex = Graphics()->CreateQuadContainer();
|
||||
|
||||
RenderTools()->SelectSprite(SPRITE_FLAG_RED);
|
||||
RenderTools()->QuadContainerAddSprite(m_ItemsQuadContainerIndex, -21.f, -42.f, 42.f, 84.f);
|
||||
RenderTools()->SelectSprite(SPRITE_FLAG_BLUE);
|
||||
RenderTools()->QuadContainerAddSprite(m_ItemsQuadContainerIndex, -21.f, -42.f, 42.f, 84.f);
|
||||
|
||||
|
||||
RenderTools()->SelectSprite(SPRITE_PICKUP_HEALTH);
|
||||
RenderTools()->QuadContainerAddSprite(m_ItemsQuadContainerIndex, 64.f);
|
||||
RenderTools()->SelectSprite(SPRITE_PICKUP_ARMOR);
|
||||
RenderTools()->QuadContainerAddSprite(m_ItemsQuadContainerIndex, 64.f);
|
||||
RenderTools()->SelectSprite(SPRITE_PICKUP_WEAPON);
|
||||
RenderTools()->QuadContainerAddSprite(m_ItemsQuadContainerIndex, 64.f);
|
||||
RenderTools()->SelectSprite(SPRITE_PICKUP_NINJA);
|
||||
RenderTools()->QuadContainerAddSprite(m_ItemsQuadContainerIndex, 128.f);
|
||||
|
||||
for(int i = 0; i < NUM_WEAPONS; ++i)
|
||||
{
|
||||
RenderTools()->SelectSprite(g_pData->m_Weapons.m_aId[i].m_pSpriteBody);
|
||||
RenderTools()->QuadContainerAddSprite(m_ItemsQuadContainerIndex, g_pData->m_Weapons.m_aId[i].m_VisualSize);
|
||||
}
|
||||
|
||||
for(int i = 0; i < NUM_WEAPONS; ++i)
|
||||
{
|
||||
RenderTools()->SelectSprite(g_pData->m_Weapons.m_aId[i].m_pSpriteProj);
|
||||
RenderTools()->QuadContainerAddSprite(m_ItemsQuadContainerIndex, 32.f, false);
|
||||
}
|
||||
|
||||
RenderTools()->SelectSprite(SPRITE_PART_SPLAT01);
|
||||
RenderTools()->QuadContainerAddSprite(m_ItemsQuadContainerIndex, 24.f, false);
|
||||
RenderTools()->SelectSprite(SPRITE_PART_SPLAT02);
|
||||
RenderTools()->QuadContainerAddSprite(m_ItemsQuadContainerIndex, 24.f, false);
|
||||
RenderTools()->SelectSprite(SPRITE_PART_SPLAT03);
|
||||
RenderTools()->QuadContainerAddSprite(m_ItemsQuadContainerIndex, 24.f, false);
|
||||
}
|
||||
|
||||
void CItems::AddExtraProjectile(CNetObj_Projectile *pProj)
|
||||
|
|
|
@ -19,9 +19,11 @@ class CItems : public CComponent
|
|||
void RenderFlag(const CNetObj_Flag *pPrev, const CNetObj_Flag *pCurrent, const CNetObj_GameData *pPrevGameData, const CNetObj_GameData *pCurGameData);
|
||||
void RenderLaser(const struct CNetObj_Laser *pCurrent);
|
||||
|
||||
int m_ItemsQuadContainerIndex;
|
||||
public:
|
||||
virtual void OnReset();
|
||||
virtual void OnRender();
|
||||
virtual void OnInit();
|
||||
|
||||
void AddExtraProjectile(CNetObj_Projectile *pProj);
|
||||
};
|
||||
|
|
|
@ -156,14 +156,101 @@ void CParticles::OnRender()
|
|||
LastTime = t;
|
||||
}
|
||||
|
||||
void CParticles::OnInit()
|
||||
{
|
||||
Graphics()->QuadsSetRotation(0);
|
||||
Graphics()->SetColor(1.f, 1.f, 1.f, 1.f);
|
||||
|
||||
m_ParticleQuadContainerIndex = Graphics()->CreateQuadContainer();
|
||||
|
||||
for(int i = 0; i <= (SPRITE_PART9 - SPRITE_PART_SLICE); ++i)
|
||||
{
|
||||
RenderTools()->SelectSprite(i);
|
||||
RenderTools()->QuadContainerAddSprite(m_ParticleQuadContainerIndex, 1.f, false);
|
||||
}
|
||||
}
|
||||
|
||||
void CParticles::RenderGroup(int Group)
|
||||
{
|
||||
Graphics()->TextureSet(g_pData->m_aImages[IMAGE_PARTICLES].m_Id);
|
||||
|
||||
// don't use the buffer methods here, else the old renderer gets many draw calls
|
||||
if(Graphics()->IsBufferingEnabled())
|
||||
{
|
||||
int i = m_aFirstPart[Group];
|
||||
|
||||
static IGraphics::SRenderSpriteInfo s_aParticleRenderInfo[MAX_PARTICLES];
|
||||
|
||||
int CurParticleRenderCount = 0;
|
||||
|
||||
// batching makes sense for stuff like ninja particles
|
||||
float LastColor[4];
|
||||
int LastQuadOffset = 0;
|
||||
|
||||
if(i != -1)
|
||||
{
|
||||
LastColor[0] = m_aParticles[i].m_Color.r;
|
||||
LastColor[1] = m_aParticles[i].m_Color.g;
|
||||
LastColor[2] = m_aParticles[i].m_Color.b;
|
||||
LastColor[3] = m_aParticles[i].m_Color.a;
|
||||
|
||||
Graphics()->SetColor(
|
||||
m_aParticles[i].m_Color.r,
|
||||
m_aParticles[i].m_Color.g,
|
||||
m_aParticles[i].m_Color.b,
|
||||
m_aParticles[i].m_Color.a);
|
||||
|
||||
LastQuadOffset = m_aParticles[i].m_Spr;
|
||||
}
|
||||
|
||||
while(i != -1)
|
||||
{
|
||||
int QuadOffset = m_aParticles[i].m_Spr;
|
||||
float a = m_aParticles[i].m_Life / m_aParticles[i].m_LifeSpan;
|
||||
vec2 p = m_aParticles[i].m_Pos;
|
||||
float Size = mix(m_aParticles[i].m_StartSize, m_aParticles[i].m_EndSize, a);
|
||||
|
||||
if(LastColor[0] != m_aParticles[i].m_Color.r || LastColor[1] != m_aParticles[i].m_Color.g || LastColor[2] != m_aParticles[i].m_Color.b || LastColor[3] != m_aParticles[i].m_Color.a || LastQuadOffset != QuadOffset)
|
||||
{
|
||||
Graphics()->RenderQuadContainerAsSpriteMultiple(m_ParticleQuadContainerIndex, LastQuadOffset, CurParticleRenderCount, s_aParticleRenderInfo);
|
||||
CurParticleRenderCount = 0;
|
||||
LastQuadOffset = QuadOffset;
|
||||
|
||||
Graphics()->SetColor(
|
||||
m_aParticles[i].m_Color.r,
|
||||
m_aParticles[i].m_Color.g,
|
||||
m_aParticles[i].m_Color.b,
|
||||
m_aParticles[i].m_Color.a);
|
||||
|
||||
LastColor[0] = m_aParticles[i].m_Color.r;
|
||||
LastColor[1] = m_aParticles[i].m_Color.g;
|
||||
LastColor[2] = m_aParticles[i].m_Color.b;
|
||||
LastColor[3] = m_aParticles[i].m_Color.a;
|
||||
}
|
||||
|
||||
s_aParticleRenderInfo[CurParticleRenderCount].m_Pos[0] = p.x;
|
||||
s_aParticleRenderInfo[CurParticleRenderCount].m_Pos[1] = p.y;
|
||||
|
||||
s_aParticleRenderInfo[CurParticleRenderCount].m_Scale = Size;
|
||||
s_aParticleRenderInfo[CurParticleRenderCount].m_Rotation = m_aParticles[i].m_Rot;
|
||||
|
||||
++CurParticleRenderCount;
|
||||
|
||||
i = m_aParticles[i].m_NextPart;
|
||||
}
|
||||
|
||||
Graphics()->RenderQuadContainerAsSpriteMultiple(m_ParticleQuadContainerIndex, LastQuadOffset, CurParticleRenderCount, s_aParticleRenderInfo);
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
int i = m_aFirstPart[Group];
|
||||
|
||||
Graphics()->BlendNormal();
|
||||
//gfx_blend_additive();
|
||||
Graphics()->TextureSet(g_pData->m_aImages[IMAGE_PARTICLES].m_Id);
|
||||
Graphics()->QuadsBegin();
|
||||
|
||||
int i = m_aFirstPart[Group];
|
||||
while(i != -1)
|
||||
{
|
||||
RenderTools()->SelectSprite(m_aParticles[i].m_Spr);
|
||||
|
@ -187,3 +274,4 @@ void CParticles::RenderGroup(int Group)
|
|||
Graphics()->QuadsEnd();
|
||||
Graphics()->BlendNormal();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -66,8 +66,9 @@ public:
|
|||
|
||||
virtual void OnReset();
|
||||
virtual void OnRender();
|
||||
|
||||
virtual void OnInit();
|
||||
private:
|
||||
int m_ParticleQuadContainerIndex;
|
||||
|
||||
enum
|
||||
{
|
||||
|
|
|
@ -29,12 +29,6 @@
|
|||
|
||||
void CPlayers::RenderHand(CTeeRenderInfo *pInfo, vec2 CenterPos, vec2 Dir, float AngleOffset, vec2 PostRotOffset)
|
||||
{
|
||||
// for drawing hand
|
||||
//const skin *s = skin_get(skin_id);
|
||||
|
||||
float BaseSize = 10.0f;
|
||||
//dir = normalize(hook_pos-pos);
|
||||
|
||||
vec2 HandPos = CenterPos + Dir;
|
||||
float Angle = GetAngle(Dir);
|
||||
if(Dir.x < 0)
|
||||
|
@ -53,22 +47,16 @@ void CPlayers::RenderHand(CTeeRenderInfo *pInfo, vec2 CenterPos, vec2 Dir, float
|
|||
|
||||
//Graphics()->TextureSet(data->m_aImages[IMAGE_CHAR_DEFAULT].id);
|
||||
Graphics()->TextureSet(pInfo->m_Texture);
|
||||
Graphics()->QuadsBegin();
|
||||
Graphics()->SetColor(pInfo->m_ColorBody.r, pInfo->m_ColorBody.g, pInfo->m_ColorBody.b, pInfo->m_ColorBody.a);
|
||||
|
||||
// two passes
|
||||
for(int i = 0; i < 2; i++)
|
||||
{
|
||||
bool OutLine = i == 0;
|
||||
|
||||
RenderTools()->SelectSprite(OutLine?SPRITE_TEE_HAND_OUTLINE:SPRITE_TEE_HAND, 0, 0, 0);
|
||||
int QuadOffset = NUM_WEAPONS * 2 + i;
|
||||
Graphics()->QuadsSetRotation(Angle);
|
||||
IGraphics::CQuadItem QuadItem(HandPos.x, HandPos.y, 2*BaseSize, 2*BaseSize);
|
||||
Graphics()->QuadsDraw(&QuadItem, 1);
|
||||
Graphics()->RenderQuadContainerAsSprite(m_WeaponEmoteQuadContainerIndex, QuadOffset, HandPos.x, HandPos.y);
|
||||
}
|
||||
|
||||
Graphics()->QuadsSetRotation(0);
|
||||
Graphics()->QuadsEnd();
|
||||
}
|
||||
|
||||
inline float NormalizeAngular(float f)
|
||||
|
@ -307,9 +295,8 @@ void CPlayers::RenderHook(
|
|||
if(Prev.m_HookState>0 && Player.m_HookState>0)
|
||||
{
|
||||
Graphics()->TextureSet(g_pData->m_aImages[IMAGE_GAME].m_Id);
|
||||
Graphics()->QuadsBegin();
|
||||
//Graphics()->QuadsBegin();
|
||||
|
||||
Graphics()->SetColor(1.0f, 1.0f, 1.0f, 1.0f);
|
||||
if(ClientID < 0)
|
||||
Graphics()->SetColor(1.0f, 1.0f, 1.0f, 0.5f);
|
||||
|
||||
|
@ -354,29 +341,30 @@ void CPlayers::RenderHook(
|
|||
vec2 Dir = normalize(Pos-HookPos);
|
||||
|
||||
Graphics()->QuadsSetRotation(GetAngle(Dir)+pi);
|
||||
|
||||
// render head
|
||||
RenderTools()->SelectSprite(SPRITE_HOOK_HEAD);
|
||||
IGraphics::CQuadItem QuadItem(HookPos.x, HookPos.y, 24,16);
|
||||
int QuadOffset = NUM_WEAPONS * 2 + 2;
|
||||
if(OtherTeam)
|
||||
Graphics()->SetColor(1.0f, 1.0f, 1.0f, g_Config.m_ClShowOthersAlpha / 100.0f);
|
||||
Graphics()->QuadsDraw(&QuadItem, 1);
|
||||
Graphics()->RenderQuadContainerAsSprite(m_WeaponEmoteQuadContainerIndex, QuadOffset, HookPos.x, HookPos.y);
|
||||
|
||||
// render chain
|
||||
RenderTools()->SelectSprite(SPRITE_HOOK_CHAIN);
|
||||
IGraphics::CQuadItem Array[1024];
|
||||
int i = 0;
|
||||
for(float f = 24; f < d && i < 1024; f += 24, i++)
|
||||
++QuadOffset;
|
||||
static IGraphics::SRenderSpriteInfo s_HookChainRenderInfo[1024];
|
||||
int HookChainCount = 0;
|
||||
for(float f = 24; f < d && HookChainCount < 1024; f += 24, ++HookChainCount)
|
||||
{
|
||||
vec2 p = HookPos + Dir*f;
|
||||
Array[i] = IGraphics::CQuadItem(p.x, p.y,24,16);
|
||||
}
|
||||
s_HookChainRenderInfo[HookChainCount].m_Pos[0] = p.x;
|
||||
s_HookChainRenderInfo[HookChainCount].m_Pos[1] = p.y;
|
||||
|
||||
s_HookChainRenderInfo[HookChainCount].m_Scale = 1;
|
||||
s_HookChainRenderInfo[HookChainCount].m_Rotation = GetAngle(Dir) + pi;
|
||||
++HookChainCount;
|
||||
}
|
||||
Graphics()->RenderQuadContainerAsSpriteMultiple(m_WeaponEmoteQuadContainerIndex, QuadOffset, HookChainCount, s_HookChainRenderInfo);
|
||||
|
||||
if (OtherTeam)
|
||||
Graphics()->SetColor(1.0f, 1.0f, 1.0f, g_Config.m_ClShowOthersAlpha / 100.0f);
|
||||
Graphics()->QuadsDraw(Array, i);
|
||||
Graphics()->QuadsSetRotation(0);
|
||||
Graphics()->QuadsEnd();
|
||||
Graphics()->SetColor(1.0f, 1.0f, 1.0f, 1.0f);
|
||||
|
||||
RenderHand(&RenderInfo, Position, normalize(HookPos-Pos), -pi/2, vec2(20, 0));
|
||||
}
|
||||
|
@ -627,7 +615,7 @@ void CPlayers::RenderPlayer(
|
|||
}
|
||||
|
||||
Graphics()->TextureSet(g_pData->m_aImages[IMAGE_GAME].m_Id);
|
||||
Graphics()->QuadsBegin();
|
||||
Graphics()->SetColor(1.0f, 1.0f, 1.0f, 1.0f);
|
||||
Graphics()->QuadsSetRotation(State.GetAttach()->m_Angle*pi*2+Angle);
|
||||
|
||||
if(ClientID < 0)
|
||||
|
@ -635,7 +623,7 @@ void CPlayers::RenderPlayer(
|
|||
|
||||
// normal weapons
|
||||
int iw = clamp(Player.m_Weapon, 0, NUM_WEAPONS-1);
|
||||
RenderTools()->SelectSprite(g_pData->m_Weapons.m_aId[iw].m_pSpriteBody, Direction.x < 0 ? SPRITE_FLAG_FLIP_Y : 0);
|
||||
int QuadOffset = iw * 2 + (Direction.x < 0 ? 1 : 0);
|
||||
|
||||
if(OtherTeam)
|
||||
Graphics()->SetColor(1.0f, 1.0f, 1.0f, g_Config.m_ClShowOthersAlpha / 100.0f);
|
||||
|
@ -658,7 +646,7 @@ void CPlayers::RenderPlayer(
|
|||
{
|
||||
Graphics()->QuadsSetRotation(-pi/2+State.GetAttach()->m_Angle*pi*2);
|
||||
}
|
||||
RenderTools()->DrawSprite(p.x, p.y, g_pData->m_Weapons.m_aId[iw].m_VisualSize);
|
||||
Graphics()->RenderQuadContainerAsSprite(m_WeaponEmoteQuadContainerIndex, QuadOffset, p.x, p.y);
|
||||
}
|
||||
else if(Player.m_Weapon == WEAPON_NINJA)
|
||||
{
|
||||
|
@ -676,7 +664,7 @@ void CPlayers::RenderPlayer(
|
|||
Graphics()->QuadsSetRotation(-pi/2+State.GetAttach()->m_Angle*pi*2);
|
||||
m_pClient->m_pEffects->PowerupShine(p-vec2(32,0), vec2(32,12));
|
||||
}
|
||||
RenderTools()->DrawSprite(p.x, p.y, g_pData->m_Weapons.m_aId[iw].m_VisualSize);
|
||||
Graphics()->RenderQuadContainerAsSprite(m_WeaponEmoteQuadContainerIndex, QuadOffset, p.x, p.y);
|
||||
|
||||
// HADOKEN
|
||||
if((Client()->GameTick()-Player.m_AttackTick) <= (SERVER_TICK_SPEED / 6) && g_pData->m_Weapons.m_aId[iw].m_NumSpriteMuzzles)
|
||||
|
@ -704,13 +692,12 @@ void CPlayers::RenderPlayer(
|
|||
Dir = normalize(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);
|
||||
int QuadOffset = IteX * 2;
|
||||
vec2 DirY(-Dir.y,Dir.x);
|
||||
p = Position;
|
||||
float OffsetX = g_pData->m_Weapons.m_aId[iw].m_Muzzleoffsetx;
|
||||
p -= Dir * OffsetX;
|
||||
RenderTools()->DrawSprite(p.x, p.y, 160.0f);
|
||||
Graphics()->RenderQuadContainerAsSprite(m_WeaponSpriteMuzzleQuadContainerIndex[iw], QuadOffset, p.x, p.y);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -729,7 +716,7 @@ void CPlayers::RenderPlayer(
|
|||
p.y += g_pData->m_Weapons.m_aId[iw].m_Offsety;
|
||||
if(Player.m_Weapon == WEAPON_GUN && g_Config.m_ClOldGunPosition)
|
||||
p.y -= 8;
|
||||
RenderTools()->DrawSprite(p.x, p.y, g_pData->m_Weapons.m_aId[iw].m_VisualSize);
|
||||
Graphics()->RenderQuadContainerAsSprite(m_WeaponEmoteQuadContainerIndex, QuadOffset, p.x, p.y);
|
||||
}
|
||||
|
||||
if(Player.m_Weapon == WEAPON_GUN || Player.m_Weapon == WEAPON_SHOTGUN)
|
||||
|
@ -765,18 +752,18 @@ void CPlayers::RenderPlayer(
|
|||
if(Alpha > 0.0f && g_pData->m_Weapons.m_aId[iw].m_aSpriteMuzzles[IteX])
|
||||
{
|
||||
float OffsetY = -g_pData->m_Weapons.m_aId[iw].m_Muzzleoffsety;
|
||||
RenderTools()->SelectSprite(g_pData->m_Weapons.m_aId[iw].m_aSpriteMuzzles[IteX], Direction.x < 0 ? SPRITE_FLAG_FLIP_Y : 0);
|
||||
int QuadOffset = IteX * 2 + (Direction.x < 0 ? 1 : 0);
|
||||
if(Direction.x < 0)
|
||||
OffsetY = -OffsetY;
|
||||
|
||||
vec2 DirY(-Dir.y,Dir.x);
|
||||
vec2 MuzzlePos = p + Dir * g_pData->m_Weapons.m_aId[iw].m_Muzzleoffsetx + DirY * OffsetY;
|
||||
|
||||
RenderTools()->DrawSprite(MuzzlePos.x, MuzzlePos.y, g_pData->m_Weapons.m_aId[iw].m_VisualSize);
|
||||
Graphics()->RenderQuadContainerAsSprite(m_WeaponSpriteMuzzleQuadContainerIndex[iw], QuadOffset, MuzzlePos.x, MuzzlePos.y);
|
||||
}
|
||||
}
|
||||
}
|
||||
Graphics()->QuadsEnd();
|
||||
Graphics()->SetColor(1.0f, 1.0f, 1.0f, 1.0f);
|
||||
Graphics()->QuadsSetRotation(0);
|
||||
|
||||
if(OtherTeam)
|
||||
{
|
||||
|
@ -811,54 +798,50 @@ void CPlayers::RenderPlayer(
|
|||
RenderInfo.m_ColorFeet.a = g_Config.m_ClShowOthersAlpha / 100.0f;
|
||||
}
|
||||
|
||||
Graphics()->SetColor(1.0f, 1.0f, 1.0f, 1.0f);
|
||||
Graphics()->QuadsSetRotation(0);
|
||||
if(g_Config.m_ClShowDirection && ClientID >= 0 && (!Local || DemoPlayer()->IsPlaying()))
|
||||
{
|
||||
if(Player.m_Direction == -1)
|
||||
{
|
||||
Graphics()->TextureSet(g_pData->m_aImages[IMAGE_ARROW].m_Id);
|
||||
Graphics()->QuadsBegin();
|
||||
if(OtherTeam)
|
||||
Graphics()->SetColor(1.0f, 1.0f, 1.0f, g_Config.m_ClShowOthersAlpha / 100.0f);
|
||||
IGraphics::CQuadItem QuadItem(Position.x-30, Position.y - 70, 22, 22);
|
||||
Graphics()->QuadsSetRotation(pi);
|
||||
Graphics()->QuadsDraw(&QuadItem, 1);
|
||||
Graphics()->QuadsEnd();
|
||||
Graphics()->RenderQuadContainerAsSprite(m_DirectionQuadContainerIndex, 0, Position.x - 30.f, Position.y - 70.f);
|
||||
}
|
||||
else if(Player.m_Direction == 1)
|
||||
{
|
||||
Graphics()->TextureSet(g_pData->m_aImages[IMAGE_ARROW].m_Id);
|
||||
Graphics()->QuadsBegin();
|
||||
if(OtherTeam)
|
||||
Graphics()->SetColor(1.0f, 1.0f, 1.0f, g_Config.m_ClShowOthersAlpha / 100.0f);
|
||||
IGraphics::CQuadItem QuadItem(Position.x+30, Position.y - 70, 22, 22);
|
||||
Graphics()->QuadsDraw(&QuadItem, 1);
|
||||
Graphics()->QuadsEnd();
|
||||
Graphics()->RenderQuadContainerAsSprite(m_DirectionQuadContainerIndex, 0, Position.x + 30.f, Position.y - 70.f);
|
||||
}
|
||||
if(Player.m_Jumped&1)
|
||||
{
|
||||
Graphics()->TextureSet(g_pData->m_aImages[IMAGE_ARROW].m_Id);
|
||||
Graphics()->QuadsBegin();
|
||||
if(OtherTeam)
|
||||
Graphics()->SetColor(1.0f, 1.0f, 1.0f, g_Config.m_ClShowOthersAlpha / 100.0f);
|
||||
IGraphics::CQuadItem QuadItem(Position.x, Position.y - 70, 22, 22);
|
||||
Graphics()->QuadsSetRotation(pi * 3 / 2);
|
||||
Graphics()->QuadsDraw(&QuadItem, 1);
|
||||
Graphics()->QuadsEnd();
|
||||
Graphics()->RenderQuadContainerAsSprite(m_DirectionQuadContainerIndex, 0, Position.x, Position.y - 70.f);
|
||||
}
|
||||
Graphics()->SetColor(1.0f, 1.0f, 1.0f, 1.0f);
|
||||
Graphics()->QuadsSetRotation(0);
|
||||
}
|
||||
|
||||
RenderTools()->RenderTee(&State, &RenderInfo, Player.m_Emote, Direction, Position, OtherTeam || ClientID < 0);
|
||||
|
||||
int QuadOffsetToEmoticon = NUM_WEAPONS * 2 + 2 + 2;
|
||||
if(Player.m_PlayerFlags&PLAYERFLAG_CHATTING)
|
||||
{
|
||||
Graphics()->TextureSet(g_pData->m_aImages[IMAGE_EMOTICONS].m_Id);
|
||||
Graphics()->QuadsBegin();
|
||||
RenderTools()->SelectSprite(SPRITE_DOTDOT);
|
||||
int QuadOffset = QuadOffsetToEmoticon + (SPRITE_DOTDOT - SPRITE_OOP);
|
||||
if(OtherTeam)
|
||||
Graphics()->SetColor(1.0f, 1.0f, 1.0f, g_Config.m_ClShowOthersAlpha / 100.0f);
|
||||
IGraphics::CQuadItem QuadItem(Position.x + 24, Position.y - 40, 64,64);
|
||||
Graphics()->QuadsDraw(&QuadItem, 1);
|
||||
Graphics()->QuadsEnd();
|
||||
Graphics()->RenderQuadContainerAsSprite(m_WeaponEmoteQuadContainerIndex, QuadOffset, Position.x + 24.f, Position.y - 40.f);
|
||||
|
||||
Graphics()->SetColor(1.0f, 1.0f, 1.0f, 1.0f);
|
||||
Graphics()->QuadsSetRotation(0);
|
||||
}
|
||||
|
||||
if(ClientID < 0)
|
||||
|
@ -867,7 +850,6 @@ void CPlayers::RenderPlayer(
|
|||
if(g_Config.m_ClShowEmotes && m_pClient->m_aClients[ClientID].m_EmoticonStart != -1 && m_pClient->m_aClients[ClientID].m_EmoticonStart + 2 * Client()->GameTickSpeed() > Client()->GameTick())
|
||||
{
|
||||
Graphics()->TextureSet(g_pData->m_aImages[IMAGE_EMOTICONS].m_Id);
|
||||
Graphics()->QuadsBegin();
|
||||
|
||||
int SinceStart = Client()->GameTick() - m_pClient->m_aClients[ClientID].m_EmoticonStart;
|
||||
int FromEnd = m_pClient->m_aClients[ClientID].m_EmoticonStart + 2 * Client()->GameTickSpeed() - Client()->GameTick();
|
||||
|
@ -893,69 +875,11 @@ void CPlayers::RenderPlayer(
|
|||
if(OtherTeam)
|
||||
Graphics()->SetColor(1.0f, 1.0f, 1.0f, a * (float)g_Config.m_ClShowOthersAlpha / 100.0f);
|
||||
// client_datas::emoticon is an offset from the first emoticon
|
||||
RenderTools()->SelectSprite(SPRITE_OOP + m_pClient->m_aClients[ClientID].m_Emoticon);
|
||||
IGraphics::CQuadItem QuadItem(Position.x, Position.y - 23 - 32*h, 64, 64*h);
|
||||
Graphics()->QuadsDraw(&QuadItem, 1);
|
||||
Graphics()->QuadsEnd();
|
||||
}
|
||||
int QuadOffset = QuadOffsetToEmoticon + m_pClient->m_aClients[ClientID].m_Emoticon;
|
||||
Graphics()->RenderQuadContainerAsSprite(m_WeaponEmoteQuadContainerIndex, QuadOffset, Position.x, Position.y - 23.f - 32.f * h, 1.f, (64.f*h) / 64.f);
|
||||
|
||||
if(g_Config.m_ClNameplates && AntiPingPlayers)
|
||||
{
|
||||
float FontSize = 18.0f + 20.0f * g_Config.m_ClNameplatesSize / 100.0f;
|
||||
float FontSizeClan = 18.0f + 20.0f * g_Config.m_ClNameplatesClanSize / 100.0f;
|
||||
// render name plate
|
||||
if(!Local)
|
||||
{
|
||||
float a = 1;
|
||||
if(g_Config.m_ClNameplatesAlways == 0)
|
||||
a = clamp(1-powf(distance(m_pClient->m_pControls->m_TargetPos[g_Config.m_ClDummy], Position)/200.0f,16.0f), 0.0f, 1.0f);
|
||||
|
||||
const char *pName = m_pClient->m_aClients[ClientID].m_aName;
|
||||
float tw = TextRender()->TextWidth(0, FontSize, pName, -1);
|
||||
|
||||
vec3 rgb = vec3(1.0f, 1.0f, 1.0f);
|
||||
if(g_Config.m_ClNameplatesTeamcolors && m_pClient->m_Teams.Team(ClientID))
|
||||
rgb = HslToRgb(vec3(m_pClient->m_Teams.Team(ClientID) / 64.0f, 1.0f, 0.75f));
|
||||
|
||||
if (OtherTeam)
|
||||
{
|
||||
TextRender()->TextOutlineColor(0.0f, 0.0f, 0.0f, 0.2f);
|
||||
TextRender()->TextColor(rgb.r, rgb.g, rgb.b, g_Config.m_ClShowOthersAlpha / 100.0f);
|
||||
}
|
||||
else
|
||||
{
|
||||
TextRender()->TextOutlineColor(0.0f, 0.0f, 0.0f, 0.5f*a);
|
||||
TextRender()->TextColor(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(m_pClient->m_aClients[ClientID].m_Team == TEAM_RED)
|
||||
TextRender()->TextColor(1.0f, 0.5f, 0.5f, a);
|
||||
else if(m_pClient->m_aClients[ClientID].m_Team == TEAM_BLUE)
|
||||
TextRender()->TextColor(0.7f, 0.7f, 1.0f, a);
|
||||
}
|
||||
|
||||
TextRender()->Text(0, Position.x-tw/2.0f, Position.y-FontSize-38.0f, FontSize, pName, -1);
|
||||
|
||||
if(g_Config.m_ClNameplatesClan)
|
||||
{
|
||||
const char *pClan = m_pClient->m_aClients[ClientID].m_aClan;
|
||||
float tw_clan = TextRender()->TextWidth(0, FontSizeClan, pClan, -1);
|
||||
TextRender()->Text(0, Position.x-tw_clan/2.0f, Position.y-FontSize-FontSizeClan-38.0f, FontSizeClan, pClan, -1);
|
||||
}
|
||||
|
||||
if(g_Config.m_Debug) // render client id when in debug as well
|
||||
{
|
||||
char aBuf[128];
|
||||
str_format(aBuf, sizeof(aBuf),"%d", ClientID);
|
||||
float Offset = g_Config.m_ClNameplatesClan ? (FontSize * 2 + FontSizeClan) : (FontSize * 2);
|
||||
float tw_id = TextRender()->TextWidth(0, FontSize, aBuf, -1);
|
||||
TextRender()->Text(0, Position.x-tw_id/2.0f, Position.y-Offset-38.0f, 28.0f, aBuf, -1);
|
||||
}
|
||||
|
||||
TextRender()->TextColor(1,1,1,1);
|
||||
TextRender()->TextOutlineColor(0.0f, 0.0f, 0.0f, 0.3f);
|
||||
}
|
||||
Graphics()->SetColor(1.0f, 1.0f, 1.0f, 1.0f);
|
||||
Graphics()->QuadsSetRotation(0);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -989,7 +913,6 @@ void CPlayers::OnRender()
|
|||
static vec2 PrevPos[MAX_CLIENTS];
|
||||
static vec2 SmoothPos[MAX_CLIENTS];
|
||||
static int MoveCnt[MAX_CLIENTS] = {0};
|
||||
static vec2 PredictedPos[MAX_CLIENTS];
|
||||
|
||||
static int predcnt = 0;
|
||||
|
||||
|
@ -1015,7 +938,7 @@ void CPlayers::OnRender()
|
|||
PrevPos[i],
|
||||
SmoothPos[i],
|
||||
MoveCnt[i],
|
||||
PredictedPos[i]
|
||||
m_CurPredictedPos[i]
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@ -1067,8 +990,8 @@ void CPlayers::OnRender()
|
|||
&CurChar,
|
||||
&m_aRenderInfo[i],
|
||||
i,
|
||||
PredictedPos[i],
|
||||
PredictedPos[PrevChar.m_HookedPlayer]
|
||||
m_CurPredictedPos[i],
|
||||
m_CurPredictedPos[PrevChar.m_HookedPlayer]
|
||||
);
|
||||
else
|
||||
RenderHook(
|
||||
|
@ -1076,8 +999,8 @@ void CPlayers::OnRender()
|
|||
&CurChar,
|
||||
&m_aRenderInfo[i],
|
||||
i,
|
||||
PredictedPos[i],
|
||||
PredictedPos[i]
|
||||
m_CurPredictedPos[i],
|
||||
m_CurPredictedPos[i]
|
||||
);
|
||||
}
|
||||
else
|
||||
|
@ -1087,10 +1010,76 @@ void CPlayers::OnRender()
|
|||
&CurChar,
|
||||
&m_aRenderInfo[i],
|
||||
i,
|
||||
PredictedPos[i]
|
||||
m_CurPredictedPos[i]
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void CPlayers::OnInit()
|
||||
{
|
||||
m_WeaponEmoteQuadContainerIndex = Graphics()->CreateQuadContainer();
|
||||
|
||||
Graphics()->SetColor(1.f, 1.f, 1.f, 1.f);
|
||||
|
||||
for(int i = 0; i < NUM_WEAPONS; ++i)
|
||||
{
|
||||
RenderTools()->SelectSprite(g_pData->m_Weapons.m_aId[i].m_pSpriteBody, 0);
|
||||
RenderTools()->QuadContainerAddSprite(m_WeaponEmoteQuadContainerIndex, g_pData->m_Weapons.m_aId[i].m_VisualSize);
|
||||
RenderTools()->SelectSprite(g_pData->m_Weapons.m_aId[i].m_pSpriteBody, SPRITE_FLAG_FLIP_Y);
|
||||
RenderTools()->QuadContainerAddSprite(m_WeaponEmoteQuadContainerIndex, g_pData->m_Weapons.m_aId[i].m_VisualSize);
|
||||
}
|
||||
|
||||
// at the end the hand
|
||||
RenderTools()->SelectSprite(SPRITE_TEE_HAND_OUTLINE, 0, 0, 0);
|
||||
RenderTools()->QuadContainerAddSprite(m_WeaponEmoteQuadContainerIndex, 20.f, false);
|
||||
RenderTools()->SelectSprite(SPRITE_TEE_HAND, 0, 0, 0);
|
||||
RenderTools()->QuadContainerAddSprite(m_WeaponEmoteQuadContainerIndex, 20.f, false);
|
||||
|
||||
RenderTools()->SelectSprite(SPRITE_HOOK_HEAD);
|
||||
RenderTools()->QuadContainerAddSprite(m_WeaponEmoteQuadContainerIndex, -12.f, -8.f, 24.f, 16.f);
|
||||
RenderTools()->SelectSprite(SPRITE_HOOK_CHAIN);
|
||||
RenderTools()->QuadContainerAddSprite(m_WeaponEmoteQuadContainerIndex, -12.f, -8.f, 24.f, 16.f);
|
||||
|
||||
for(int i = 0; i < NUM_EMOTICONS; ++i)
|
||||
{
|
||||
RenderTools()->SelectSprite(SPRITE_OOP + i);
|
||||
RenderTools()->QuadContainerAddSprite(m_WeaponEmoteQuadContainerIndex, 64.f, false);
|
||||
}
|
||||
|
||||
for(int i = 0; i < NUM_WEAPONS; ++i)
|
||||
{
|
||||
m_WeaponSpriteMuzzleQuadContainerIndex[i] = Graphics()->CreateQuadContainer();
|
||||
for(int n = 0; n < g_pData->m_Weapons.m_aId[i].m_NumSpriteMuzzles; ++n)
|
||||
{
|
||||
if(g_pData->m_Weapons.m_aId[i].m_aSpriteMuzzles[n])
|
||||
{
|
||||
RenderTools()->SelectSprite(g_pData->m_Weapons.m_aId[i].m_aSpriteMuzzles[n], 0);
|
||||
}
|
||||
if(WEAPON_NINJA == i)
|
||||
RenderTools()->QuadContainerAddSprite(m_WeaponSpriteMuzzleQuadContainerIndex[i], 160.f);
|
||||
else
|
||||
RenderTools()->QuadContainerAddSprite(m_WeaponSpriteMuzzleQuadContainerIndex[i], g_pData->m_Weapons.m_aId[i].m_VisualSize);
|
||||
|
||||
if(g_pData->m_Weapons.m_aId[i].m_aSpriteMuzzles[n])
|
||||
{
|
||||
RenderTools()->SelectSprite(g_pData->m_Weapons.m_aId[i].m_aSpriteMuzzles[n], SPRITE_FLAG_FLIP_Y);
|
||||
}
|
||||
if(WEAPON_NINJA == i)
|
||||
RenderTools()->QuadContainerAddSprite(m_WeaponSpriteMuzzleQuadContainerIndex[i], 160.f);
|
||||
else
|
||||
RenderTools()->QuadContainerAddSprite(m_WeaponSpriteMuzzleQuadContainerIndex[i], g_pData->m_Weapons.m_aId[i].m_VisualSize);
|
||||
}
|
||||
}
|
||||
|
||||
Graphics()->QuadsSetSubset(0.f, 0.f, 1.f, 1.f);
|
||||
Graphics()->QuadsSetRotation(0.f);
|
||||
// the direction
|
||||
m_DirectionQuadContainerIndex = Graphics()->CreateQuadContainer();
|
||||
|
||||
IGraphics::CQuadItem QuadItem(0.f, 0.f, 22.f, 22.f);
|
||||
Graphics()->QuadContainerAddQuads(m_DirectionQuadContainerIndex, &QuadItem, 1);
|
||||
|
||||
}
|
||||
|
|
|
@ -43,7 +43,12 @@ class CPlayers : public CComponent
|
|||
vec2 &Position
|
||||
);
|
||||
|
||||
int m_WeaponEmoteQuadContainerIndex;
|
||||
int m_DirectionQuadContainerIndex;
|
||||
int m_WeaponSpriteMuzzleQuadContainerIndex[NUM_WEAPONS];
|
||||
public:
|
||||
vec2 m_CurPredictedPos[MAX_CLIENTS];
|
||||
virtual void OnInit();
|
||||
virtual void OnRender();
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in a new issue