Esempio n. 1
0
void CModAPI_Component_Items::RenderModAPIAnimatedSpriteCharacter(const CNetObj_ModAPI_AnimatedSpriteCharacter *pPrev, const CNetObj_ModAPI_AnimatedSpriteCharacter *pCurrent)
{
    if(pCurrent->m_ItemLayer != GetLayer()) return;
    if(!ModAPIGraphics()||!m_pClient->m_Snap.m_aCharacters[pCurrent->m_ClientId].m_Active) return;

    float Angle = mix(2.0*pi*static_cast<float>(pPrev->m_Angle)/360.0f, 2.0*pi*static_cast<float>(pCurrent->m_Angle)/360.0f, Client()->IntraGameTick());
    float Size = mix(pPrev->m_Size, pCurrent->m_Size, Client()->IntraGameTick());
    vec2 Pos = mix(vec2(pPrev->m_X, pPrev->m_Y), vec2(pCurrent->m_X, pCurrent->m_Y), Client()->IntraGameTick());
    vec2 Offset = mix(vec2(pPrev->m_OffsetX, pPrev->m_OffsetY), vec2(pCurrent->m_OffsetX, pCurrent->m_OffsetY), Client()->IntraGameTick());

    if(m_pClient->m_LocalClientID != -1 && m_pClient->m_LocalClientID == pCurrent->m_ClientId)
    {
        Pos = m_pClient->m_LocalCharacterPos + Pos;
    }
    else
    {
        CNetObj_Character PrevChar = m_pClient->m_Snap.m_aCharacters[pCurrent->m_ClientId].m_Prev;
        CNetObj_Character CurChar = m_pClient->m_Snap.m_aCharacters[pCurrent->m_ClientId].m_Cur;
        Pos = mix(vec2(PrevChar.m_X, PrevChar.m_Y), vec2(CurChar.m_X, CurChar.m_Y), Client()->IntraGameTick()) + Pos;
    }

    float Time = Client()->GameTick() + Client()->IntraGameTick() - pCurrent->m_StartTick;
    Time = (Time/static_cast<float>(SERVER_TICK_SPEED)) * 1000.0f;
    Time = Time / (static_cast<float>(pCurrent->m_Duration)/1000.f);

    ModAPIGraphics()->DrawAnimatedSprite(RenderTools(), pCurrent->m_SpriteId, Pos, Size, Angle, 0, pCurrent->m_AnimationId, Time, Offset);
}
Esempio n. 2
0
void CModAPI_Component_Items::UpdateEvents(float DeltaTime)
{
    {
        std::list<CTextEventState>::iterator Iter = m_TextEvent.begin();
        while(Iter != m_TextEvent.end())
        {
            Iter->m_Time += DeltaTime;
            float Time = Iter->m_Time / Iter->m_Duration;

            ModAPIGraphics()->DrawAnimatedText(
                TextRender(),
                Iter->m_aText,
                Iter->m_Pos,
                Iter->m_Color,
                Iter->m_Size,
                Iter->m_Alignment,
                Iter->m_AnimationId,
                Time,
                Iter->m_Offset);

            const CModAPI_Animation* pAnimation = ModAPIGraphics()->GetAnimation(Iter->m_AnimationId);
            if(!pAnimation || Time > pAnimation->GetDuration())
            {
                Iter = m_TextEvent.erase(Iter);
            }
            else
            {
                Iter++;
            }
        }
    }
}
Esempio n. 3
0
void CItems::RenderModAPISprite(const CNetObj_ModAPI_Sprite *pPrev, const CNetObj_ModAPI_Sprite *pCurrent)
{
	if(!ModAPIGraphics()) return;

	float Angle = 2.0*pi*static_cast<float>(pCurrent->m_Angle)/360.0f;
	float Size = pCurrent->m_Size;
	vec2 Pos = mix(vec2(pPrev->m_X, pPrev->m_Y), vec2(pCurrent->m_X, pCurrent->m_Y), Client()->IntraGameTick());
	
	ModAPIGraphics()->DrawSprite(RenderTools(),pCurrent->m_SpriteId, Pos, Size, Angle);
}
Esempio n. 4
0
void CModAPI_Component_Items::RenderModAPISprite(const CNetObj_ModAPI_Sprite *pPrev, const CNetObj_ModAPI_Sprite *pCurrent)
{
    if(pCurrent->m_ItemLayer != GetLayer()) return;
    if(!ModAPIGraphics()) return;

    float Angle = mix(2.0*pi*static_cast<float>(pPrev->m_Angle)/360.0f, 2.0*pi*static_cast<float>(pCurrent->m_Angle)/360.0f, Client()->IntraGameTick());
    float Size = mix(pPrev->m_Size, pCurrent->m_Size, Client()->IntraGameTick());
    vec2 Pos = mix(vec2(pPrev->m_X, pPrev->m_Y), vec2(pCurrent->m_X, pCurrent->m_Y), Client()->IntraGameTick());

    ModAPIGraphics()->DrawSprite(RenderTools(), pCurrent->m_SpriteId, Pos, Size, Angle, 0);
}
Esempio n. 5
0
void CModAPI_Component_Items::RenderModAPILine(const struct CNetObj_ModAPI_Line *pCurrent)
{
    if(pCurrent->m_ItemLayer != GetLayer()) return;
    if(!ModAPIGraphics())
        return;
    //Geometry
    vec2 StartPos = vec2(pCurrent->m_StartX, pCurrent->m_StartY);
    vec2 EndPos = vec2(pCurrent->m_EndX, pCurrent->m_EndY);

    float Time = Client()->GameTick() + Client()->IntraGameTick() - pCurrent->m_StartTick;
    Time = (Time/static_cast<float>(SERVER_TICK_SPEED)) * 1000.0f;

    ModAPIGraphics()->DrawLine(RenderTools(),pCurrent->m_LineStyleId, StartPos, EndPos, Time);
}
Esempio n. 6
0
void CItems::RenderModAPILine(const struct CNetObj_ModAPI_Line *pCurrent)
{
	if(!ModAPIGraphics())
		return;
	//Geometry
	vec2 StartPos = vec2(pCurrent->m_StartX, pCurrent->m_StartY);
	vec2 EndPos = vec2(pCurrent->m_EndX, pCurrent->m_EndY);
	
	//easier to do that little part here 
	float Ticks = Client()->GameTick() + Client()->IntraGameTick() - pCurrent->m_StartTick;
	Ticks = (Ticks/static_cast<float>(SERVER_TICK_SPEED)) * 1000.0f;
	
	ModAPIGraphics()->DrawLine(RenderTools(),pCurrent->m_LineStyleId, StartPos, EndPos, Ticks);
}
Esempio n. 7
0
void CModAPI_Component_Items::RenderModAPIAnimatedSprite(const CNetObj_ModAPI_AnimatedSprite *pPrev, const CNetObj_ModAPI_AnimatedSprite *pCurrent)
{
    if(pCurrent->m_ItemLayer != GetLayer()) return;
    if(!ModAPIGraphics()) return;

    float Angle = mix(2.0*pi*static_cast<float>(pPrev->m_Angle)/360.0f, 2.0*pi*static_cast<float>(pCurrent->m_Angle)/360.0f, Client()->IntraGameTick());
    float Size = mix(pPrev->m_Size, pCurrent->m_Size, Client()->IntraGameTick());
    vec2 Pos = mix(vec2(pPrev->m_X, pPrev->m_Y), vec2(pCurrent->m_X, pCurrent->m_Y), Client()->IntraGameTick());
    vec2 Offset = mix(vec2(pPrev->m_OffsetX, pPrev->m_OffsetY), vec2(pCurrent->m_OffsetX, pCurrent->m_OffsetY), Client()->IntraGameTick());

    float Time = Client()->GameTick() + Client()->IntraGameTick() - pCurrent->m_StartTick;
    Time = (Time/static_cast<float>(SERVER_TICK_SPEED)) * 1000.0f;
    Time = Time / (static_cast<float>(pCurrent->m_Duration)/1000.f);

    ModAPIGraphics()->DrawAnimatedSprite(RenderTools(), pCurrent->m_SpriteId, Pos, Size, Angle, 0, pCurrent->m_AnimationId, Time, Offset);
}
Esempio n. 8
0
void CModAPI_Component_Items::RenderModAPIAnimatedTextCharacter(const CNetObj_ModAPI_AnimatedTextCharacter *pPrev, const CNetObj_ModAPI_AnimatedTextCharacter *pCurrent)
{
    if(pCurrent->m_ItemLayer != GetLayer()) return;
    if(!TextRender()||!m_pClient->m_Snap.m_aCharacters[pCurrent->m_ClientId].m_Active) return;

    vec2 Pos = mix(vec2(pPrev->m_X, pPrev->m_Y), vec2(pCurrent->m_X, pCurrent->m_Y), Client()->IntraGameTick());
    vec2 Offset = mix(vec2(pPrev->m_OffsetX, pPrev->m_OffsetY), vec2(pCurrent->m_OffsetX, pCurrent->m_OffsetY), Client()->IntraGameTick());

    if(m_pClient->m_LocalClientID != -1 && m_pClient->m_LocalClientID == pCurrent->m_ClientId)
    {
        Pos = m_pClient->m_LocalCharacterPos + Pos;
    }
    else
    {
        CNetObj_Character PrevChar = m_pClient->m_Snap.m_aCharacters[pCurrent->m_ClientId].m_Prev;
        CNetObj_Character CurChar = m_pClient->m_Snap.m_aCharacters[pCurrent->m_ClientId].m_Cur;
        Pos = mix(vec2(PrevChar.m_X, PrevChar.m_Y), vec2(CurChar.m_X, CurChar.m_Y), Client()->IntraGameTick()) + Pos;
    }

    float Time = Client()->GameTick() + Client()->IntraGameTick() - pCurrent->m_StartTick;
    Time = (Time/static_cast<float>(SERVER_TICK_SPEED)) * 1000.0f;
    Time = Time / (static_cast<float>(pCurrent->m_Duration)/1000.f);

    char aText[64];
    IntsToStr(pCurrent->m_aText, 16, &aText[0]);

    ModAPIGraphics()->DrawAnimatedText(TextRender(), aText, Pos, ModAPI_IntToColor(pCurrent->m_Color), pCurrent->m_Size, pCurrent->m_Alignment, pCurrent->m_AnimationId, Time, Offset);
}
Esempio n. 9
0
void CModAPI_Component_Items::RenderModAPIText(const CNetObj_ModAPI_Text *pPrev, const CNetObj_ModAPI_Text *pCurrent)
{
    if(pCurrent->m_ItemLayer != GetLayer()) return;
    if(!TextRender()) return;

    vec2 Pos = mix(vec2(pPrev->m_X, pPrev->m_Y), vec2(pCurrent->m_X, pCurrent->m_Y), Client()->IntraGameTick());

    char aText[64];
    IntsToStr(pCurrent->m_aText, 16, &aText[0]);

    ModAPIGraphics()->DrawText(TextRender(), aText, Pos, ModAPI_IntToColor(pCurrent->m_Color), pCurrent->m_Size, pCurrent->m_Alignment);
}
Esempio n. 10
0
void CModAPI_Component_Items::RenderModAPISpriteCharacter(const CNetObj_ModAPI_SpriteCharacter *pPrev, const CNetObj_ModAPI_SpriteCharacter *pCurrent)
{
    if(pCurrent->m_ItemLayer != GetLayer()) return;
    if(!ModAPIGraphics()||!m_pClient->m_Snap.m_aCharacters[pCurrent->m_ClientId].m_Active) return;

    float Angle = mix(2.0*pi*static_cast<float>(pPrev->m_Angle)/360.0f, 2.0*pi*static_cast<float>(pCurrent->m_Angle)/360.0f, Client()->IntraGameTick());
    float Size = mix(pPrev->m_Size, pCurrent->m_Size, Client()->IntraGameTick());
    vec2 Pos = mix(vec2(pPrev->m_X, pPrev->m_Y), vec2(pCurrent->m_X, pCurrent->m_Y), Client()->IntraGameTick());

    if(m_pClient->m_LocalClientID != -1 && m_pClient->m_LocalClientID == pCurrent->m_ClientId)
    {
        Pos = m_pClient->m_LocalCharacterPos + Pos;
    }
    else
    {
        CNetObj_Character PrevChar = m_pClient->m_Snap.m_aCharacters[pCurrent->m_ClientId].m_Prev;
        CNetObj_Character CurChar = m_pClient->m_Snap.m_aCharacters[pCurrent->m_ClientId].m_Cur;
        Pos = mix(vec2(PrevChar.m_X, PrevChar.m_Y), vec2(CurChar.m_X, CurChar.m_Y), Client()->IntraGameTick()) + Pos;
    }

    ModAPIGraphics()->DrawSprite(RenderTools(),pCurrent->m_SpriteId, Pos, Size, Angle, 0);
}
Esempio n. 11
0
void CModAPI_Component_Items::RenderModAPIAnimatedText(const CNetObj_ModAPI_AnimatedText *pPrev, const CNetObj_ModAPI_AnimatedText *pCurrent)
{
    if(pCurrent->m_ItemLayer != GetLayer()) return;
    if(!TextRender()) return;

    vec2 Pos = mix(vec2(pPrev->m_X, pPrev->m_Y), vec2(pCurrent->m_X, pCurrent->m_Y), Client()->IntraGameTick());
    vec2 Offset = mix(vec2(pPrev->m_OffsetX, pPrev->m_OffsetY), vec2(pCurrent->m_OffsetX, pCurrent->m_OffsetY), Client()->IntraGameTick());

    float Time = Client()->GameTick() + Client()->IntraGameTick() - pCurrent->m_StartTick;
    Time = (Time/static_cast<float>(SERVER_TICK_SPEED)) * 1000.0f;
    Time = Time / (static_cast<float>(pCurrent->m_Duration)/1000.f);

    char aText[64];
    IntsToStr(pCurrent->m_aText, 16, &aText[0]);

    ModAPIGraphics()->DrawAnimatedText(TextRender(), aText, Pos, ModAPI_IntToColor(pCurrent->m_Color), pCurrent->m_Size, pCurrent->m_Alignment, pCurrent->m_AnimationId, Time, Offset);
}
Esempio n. 12
0
void CModAPI_Component_Items::RenderModAPITextCharacter(const CNetObj_ModAPI_TextCharacter *pPrev, const CNetObj_ModAPI_TextCharacter *pCurrent)
{
    if(pCurrent->m_ItemLayer != GetLayer()) return;
    if(!TextRender()||!m_pClient->m_Snap.m_aCharacters[pCurrent->m_ClientId].m_Active) return;

    vec2 Pos = mix(vec2(pPrev->m_X, pPrev->m_Y), vec2(pCurrent->m_X, pCurrent->m_Y), Client()->IntraGameTick());

    if(m_pClient->m_LocalClientID != -1 && m_pClient->m_LocalClientID == pCurrent->m_ClientId)
    {
        Pos = m_pClient->m_LocalCharacterPos + Pos;
    }
    else
    {
        CNetObj_Character PrevChar = m_pClient->m_Snap.m_aCharacters[pCurrent->m_ClientId].m_Prev;
        CNetObj_Character CurChar = m_pClient->m_Snap.m_aCharacters[pCurrent->m_ClientId].m_Cur;
        Pos = mix(vec2(PrevChar.m_X, PrevChar.m_Y), vec2(CurChar.m_X, CurChar.m_Y), Client()->IntraGameTick()) + Pos;
    }

    char aText[64];
    IntsToStr(pCurrent->m_aText, 16, &aText[0]);

    ModAPIGraphics()->DrawText(TextRender(), aText, Pos, ModAPI_IntToColor(pCurrent->m_Color), pCurrent->m_Size, pCurrent->m_Alignment);
}