void CBuildings::RenderReactor(const struct CNetObj_Building *pCurrent) { int Anim = ANIM_IDLE; int s = pCurrent->m_Status; bool Repair = s & (1<<BSTATUS_REPAIR); float Time = pCurrent->m_X * 0.432f + pCurrent->m_Y * 0.2354f + CustomStuff()->m_SawbladeAngle * 0.1f; if (Repair) Time += CustomStuff()->m_SawbladeAngle * 0.15f; m_pClient->m_pEffects->Light(vec2(pCurrent->m_X, pCurrent->m_Y-30), 320); m_pClient->m_pEffects->Light(vec2(pCurrent->m_X, pCurrent->m_Y-0), 320); RenderTools()->RenderSkeleton(vec2(pCurrent->m_X, pCurrent->m_Y+16+50), ATLAS_REACTOR, aAnimList[Anim], Time, vec2(1.0f, 1.0f)*0.8f, 1, 0); // damage mask if (Repair) { Graphics()->TextureSet(g_pData->m_aImages[IMAGE_REACTOR_DAMAGE].m_Id); Graphics()->QuadsBegin(); RenderTools()->SelectSprite(SPRITE_REACTOR_DAMAGE); Graphics()->SetColor(1, 1, 1, 1); Graphics()->QuadsSetRotation(0); RenderTools()->DrawSprite(pCurrent->m_X, pCurrent->m_Y, 70); Graphics()->QuadsEnd(); } // repair sprite if (Repair && (CustomStuff()->LocalTick()/12+(pCurrent->m_X/8 + pCurrent->m_Y/32))%8 < 4) { Graphics()->TextureSet(g_pData->m_aImages[IMAGE_BUILDINGS].m_Id); Graphics()->QuadsBegin(); RenderTools()->SelectSprite(SPRITE_STATUS_REPAIR); Graphics()->SetColor(1, 1, 1, 1); Graphics()->QuadsSetRotation(0); RenderTools()->DrawSprite(pCurrent->m_X-20, pCurrent->m_Y-102, 52); Graphics()->QuadsEnd(); } //int f = CustomStuff()->m_SawbladeAngle * 100; if (Repair && frandom() < 0.15f) m_pClient->m_pEffects->Electrospark(vec2(pCurrent->m_X, pCurrent->m_Y-10+frandom()*30-frandom()*30)+vec2(frandom()-frandom(), frandom()-frandom()) * 20.0f, 20+frandom()*20, vec2(0, 0)); /* if (Repair && CustomStuff()->LocalTick()%30 == 1) m_pClient->m_pEffects->Electrospark(vec2(pCurrent->m_X, pCurrent->m_Y-30-frandom()*10)+vec2(frandom()-frandom(), frandom()-frandom()) * 20.0f, 20+frandom()*20, vec2(0, 0)); if (Repair && CustomStuff()->LocalTick()%30 == 11) m_pClient->m_pEffects->Electrospark(vec2(pCurrent->m_X, pCurrent->m_Y+20-frandom()*10)+vec2(frandom()-frandom(), frandom()-frandom()) * 20.0f, 20+frandom()*20, vec2(0, 0)); */ }
void CBuildings::RenderScreen(const struct CNetObj_Building *pCurrent) { float Time = CustomStuff()->m_SawbladeAngle*0.1f; int Anim = ANIM_IDLE1+(pCurrent->m_X/32)%3; RenderTools()->RenderSkeleton(vec2(pCurrent->m_X, pCurrent->m_Y+18), ATLAS_SCREEN, aAnimList[Anim], Time, vec2(1.0f, 1.0f)*0.7f, 0, 0); }
void CBuildings::RenderDoor1(const struct CNetObj_Building *pCurrent) { float Time = 0.0f; int Anim = pCurrent->m_Status & (1<<BSTATUS_ON) ? ANIM_OPENED : ANIM_CLOSED; if (Anim == ANIM_CLOSED && pCurrent->m_Status & (1<<BSTATUS_EVENT)) { Anim = ANIM_OPEN; if (CustomStuff()->m_DoorTimer == 0.0f) CustomStuff()->m_DoorTimer = 0.01f; Time = CustomStuff()->m_DoorTimer * 0.5f; } RenderTools()->RenderSkeleton(vec2(pCurrent->m_X, pCurrent->m_Y+16), ATLAS_DOOR1, aAnimList[Anim], Time, vec2(1.0f, 1.0f)*0.3f, 1, 0); }
void CBuildings::RenderShop(const CNetObj_Shop *pCurrent) { float Time = CustomStuff()->m_SawbladeAngle*0.1f; int Anim = ANIM_IDLE; RenderTools()->RenderSkeleton(vec2(pCurrent->m_X, pCurrent->m_Y+18), ATLAS_SHOP, aAnimList[Anim], Time, vec2(1.0f, 1.0f)*0.7f, 0, 0); // shop items rendered in inventory.cpp }
void CBuildings::RenderTeslacoil(const CNetObj_Building *pCurrent, const CNetObj_Building *pPrev) { vec2 Pos = mix(vec2(pPrev->m_X, pPrev->m_Y), vec2(pCurrent->m_X, pCurrent->m_Y), Client()->IntraGameTick()); int Anim = ANIM_IDLE; int s = pCurrent->m_Status; bool Repair = s & (1<<BSTATUS_REPAIR); s = pCurrent->m_Status; int FlipY = (s & (1<<BSTATUS_MIRROR)) ? -1 : 1; float Time = Pos.x * 0.432f + Pos.y * 0.2354f + CustomStuff()->m_SawbladeAngle * 0.06f; if (Repair) Time += CustomStuff()->m_SawbladeAngle * 0.1f; //m_pClient->m_pEffects->Light(vec2(pCurrent->m_X, pCurrent->m_Y-30), 320); //m_pClient->m_pEffects->Light(vec2(pCurrent->m_X, pCurrent->m_Y-0), 320); RenderTools()->RenderSkeleton(vec2(Pos.x, Pos.y+20*FlipY), ATLAS_TESLACOIL, aAnimList[Anim], Time, vec2(1.0f, 1.0f*FlipY)*0.55f, 1, 0, pCurrent->m_Team); // repair sprite if (Repair && (CustomStuff()->LocalTick()/12+int(Pos.x/8 + Pos.y/32))%8 < 4) { Graphics()->TextureSet(g_pData->m_aImages[IMAGE_BUILDINGS].m_Id); Graphics()->QuadsBegin(); RenderTools()->SelectSprite(SPRITE_STATUS_REPAIR); Graphics()->SetColor(1, 1, 1, 1); Graphics()->QuadsSetRotation(0); RenderTools()->DrawSprite(Pos.x-20, Pos.y-30-70*FlipY, 52); Graphics()->QuadsEnd(); } //int f = CustomStuff()->m_SawbladeAngle * 100; if (Repair && frandom() < 0.15f) m_pClient->m_pEffects->Electrospark(vec2(Pos.x, Pos.y-(10+frandom()*30)*FlipY)+vec2(frandom()-frandom(), frandom()-frandom()) * 20.0f, 20+frandom()*20, vec2(0, 0)); }
void CBuildings::RenderStand(const CNetObj_Building *pCurrent, const CNetObj_Building *pPrev) { vec2 Pos = mix(vec2(pPrev->m_X, pPrev->m_Y), vec2(pCurrent->m_X, pCurrent->m_Y), Client()->IntraGameTick()); int s = pCurrent->m_Status; bool Flip = s & (1<<BSTATUS_MIRROR); int FlipY = Flip ? -1 : 1; Graphics()->TextureSet(g_pData->m_aImages[IMAGE_BUILDINGS].m_Id); Graphics()->QuadsBegin(); RenderTools()->SelectSprite(SPRITE_STAND, Flip ? SPRITE_FLAG_FLIP_Y : 0); Graphics()->SetColor(1, 1, 1, 1); Graphics()->QuadsSetRotation(0); //RenderTools()->DrawSprite(pCurrent->m_X, pCurrent->m_Y-24, 96*1.3f); float Scale = 0.8f; IGraphics::CQuadItem QuadItem(Pos.x, Pos.y-25*FlipY, 96*Scale, 128*Scale); // -37 Graphics()->QuadsDraw(&QuadItem, 1); Graphics()->QuadsEnd(); // skip tip if local player is undead if (m_pClient->m_Snap.m_pGameInfoObj) { int Flags = m_pClient->m_Snap.m_pGameInfoObj->m_GameFlags; if (Flags & GAMEFLAG_INFECTION && CustomStuff()->m_LocalTeam == TEAM_BLUE) return; } // render drop weapon tip for local player if (distance(CustomStuff()->m_LocalPos, vec2(Pos.x, Pos.y+15)) < 45 && ValidForTurret(CustomStuff()->m_LocalWeapon)) { TextRender()->TextColor(0.2f, 0.7f, 0.2f, 1); TextRender()->Text(0, Pos.x + 22, Pos.y - 30 - 60*FlipY, 32, m_pClient->m_pBinds->GetKey("+dropweapon"), -1); TextRender()->TextColor(1, 1, 1, 1); } }
void CBuildings::RenderPowerupper(const struct CNetObj_Powerupper *pCurrent) { // draw base Graphics()->TextureSet(g_pData->m_aImages[IMAGE_BUILDINGS].m_Id); Graphics()->QuadsBegin(); RenderTools()->SelectSprite(SPRITE_POWERUPPER); Graphics()->SetColor(1, 1, 1, 1); Graphics()->QuadsSetRotation(0); RenderTools()->DrawSprite(pCurrent->m_X, pCurrent->m_Y-12, 96); Graphics()->QuadsEnd(); if (pCurrent->m_Item >= 0) { // draw background effect { Graphics()->ShaderBegin(SHADER_SPAWN, 0.5f); Graphics()->TextureSet(g_pData->m_aImages[IMAGE_ITEMS].m_Id); Graphics()->QuadsBegin(); RenderTools()->SelectSprite(SPRITE_ITEM1+pCurrent->m_Item); if (g_Config.m_GfxShaders) Graphics()->SetColor(1, 1, 1, 1); else Graphics()->SetColor(1, 1, 1, 0.3f); Graphics()->QuadsSetRotation(0); RenderTools()->DrawSprite(pCurrent->m_X, pCurrent->m_Y-64, 96); Graphics()->QuadsEnd(); Graphics()->ShaderEnd(); } // draw pickable item / buff { Graphics()->TextureSet(g_pData->m_aImages[IMAGE_ITEMS].m_Id); Graphics()->QuadsBegin(); RenderTools()->SelectSprite(SPRITE_ITEM1+pCurrent->m_Item); Graphics()->SetColor(1, 1, 1, 1); Graphics()->QuadsSetRotation(0); RenderTools()->DrawSprite(pCurrent->m_X+sin(CustomStuff()->m_SawbladeAngle/8)*2.0f, pCurrent->m_Y+cos(CustomStuff()->m_SawbladeAngle/4)*4.0f-64, 64); Graphics()->QuadsEnd(); } } }
void CBuildings::RenderTurret(const CNetObj_Turret *pCurrent, const CNetObj_Turret *pPrev) { vec2 Pos = mix(vec2(pPrev->m_X, pPrev->m_Y), vec2(pCurrent->m_X, pCurrent->m_Y), Client()->IntraGameTick()); float Scale = 0.8f; int s = pCurrent->m_Status; bool Flip = s & (1<<BSTATUS_MIRROR); int FlipY = Flip ? -1 : 1; // stand Graphics()->TextureSet(g_pData->m_aImages[IMAGE_BUILDINGS].m_Id); Graphics()->QuadsBegin(); RenderTools()->SelectSprite(SPRITE_STAND, Flip ? SPRITE_FLAG_FLIP_Y : 0); Graphics()->SetColor(1, 1, 1, 1); Graphics()->QuadsSetRotation(0); //RenderTools()->DrawSprite(pCurrent->m_X, pCurrent->m_Y-24-9, 96*1.3f); IGraphics::CQuadItem Stand(Pos.x, Pos.y-25*FlipY, 96*Scale, 128*Scale); // -37 Graphics()->QuadsDraw(&Stand, 1); Graphics()->QuadsEnd(); int Weapon = pCurrent->m_Weapon; float Angle = (pCurrent->m_Angle+90) / (180/pi); vec2 p = Pos + vec2(cosf(Angle)*12, sinf(Angle)*12+(-40-9)*FlipY); //+ vec2(cosf(Angle)*90, sinf(Angle)*90-71); vec2 Dir = GetDirection((int)(Angle*256)); // render weapon RenderTools()->SetShadersForWeapon(Weapon); Graphics()->TextureSet(g_pData->m_aImages[IMAGE_WEAPONS].m_Id); Graphics()->QuadsBegin(); Graphics()->QuadsSetRotation(Angle); RenderTools()->RenderWeapon(Weapon, p, Dir, WEAPON_GAME_SIZE); Graphics()->QuadsEnd(); // render muzzle if (GetWeaponFiringType(Weapon) != WFT_HOLD) { CustomStuff()->SetTurretMuzzle(ivec2(Pos.x, Pos.y), pCurrent->m_AttackTick, pCurrent->m_Weapon); CTurretMuzzle Muzzle = CustomStuff()->GetTurretMuzzle(ivec2(Pos.x, Pos.y)); if (Muzzle.m_Weapon) { Graphics()->TextureSet(g_pData->m_aImages[IMAGE_MUZZLE].m_Id); Graphics()->QuadsBegin(); Graphics()->QuadsSetRotation(Angle); vec2 Moff = GetMuzzleRenderOffset(Muzzle.m_Weapon)+vec2(-3, -6); RenderTools()->SelectSprite(SPRITE_MUZZLE1_1 + Muzzle.m_Muzzle*4 + Muzzle.m_Time*4, SPRITE_FLAG_FLIP_X); vec2 DirY(-Dir.y,Dir.x); vec2 MuzzlePos = p + Dir * Moff.x + DirY * Moff.y; RenderTools()->DrawSprite(MuzzlePos.x, MuzzlePos.y, 60); Graphics()->QuadsEnd(); } } Graphics()->ShaderEnd(); vec2 Offset = vec2(0, 0); // fastener Graphics()->TextureSet(g_pData->m_aImages[IMAGE_BUILDINGS].m_Id); Graphics()->QuadsBegin(); RenderTools()->SelectSprite(SPRITE_TURRET_FASTENER, Dir.x < 0 ? SPRITE_FLAG_FLIP_Y : 0); Graphics()->SetColor(1, 1, 1, 1); if (m_pClient->m_Snap.m_pGameInfoObj) { int Flags = m_pClient->m_Snap.m_pGameInfoObj->m_GameFlags; int Team = pCurrent->m_Team; if ((Flags & GAMEFLAG_TEAMS) && !(Flags & GAMEFLAG_INFECTION)) { if (Team == TEAM_RED) Graphics()->SetColor(1.0f, 0.8f, 0.0f, 1.0f); else if (Team == TEAM_BLUE) Graphics()->SetColor(0.3f, 0.5f, 1.0f, 1.0f); } } // local player's turret else if (pCurrent->m_Team == TEAM_BLUE) { vec4 c = CustomStuff()->m_LocalColor; Graphics()->SetColor(c.r, c.g, c.b, 1); } Graphics()->QuadsSetRotation(Angle); RenderTools()->DrawSprite(Pos.x+Offset.x, Pos.y+(-40-9)*FlipY+Offset.y, 64*1.3f); Graphics()->QuadsEnd(); // no ammo & low health status s = pCurrent->m_Status; bool Repair = s & (1<<BSTATUS_REPAIR); //s = pCurrent->m_Status; //bool NoAmmo = s & (1<<BSTATUS_NOPE); bool NoAmmo = false; if (Repair && int(CustomStuff()->LocalTick()/12+(Pos.x/8 + Pos.y/32))%8 < 4) { Graphics()->TextureSet(g_pData->m_aImages[IMAGE_BUILDINGS].m_Id); Graphics()->QuadsBegin(); RenderTools()->SelectSprite(SPRITE_STATUS_REPAIR); Graphics()->SetColor(1, 1, 1, 1); Graphics()->QuadsSetRotation(0); RenderTools()->DrawSprite(Pos.x - (NoAmmo ? 24 : 0), Pos.y-50-52*FlipY, 52); Graphics()->QuadsEnd(); } }
void CBuildings::RenderGenerator(const struct CNetObj_Building *pCurrent, const CNetObj_Building *pPrev) { vec2 Pos = mix(vec2(pPrev->m_X, pPrev->m_Y), vec2(pCurrent->m_X, pCurrent->m_Y), Client()->IntraGameTick()); // render Graphics()->TextureSet(g_pData->m_aImages[IMAGE_BUILDINGS].m_Id); Graphics()->QuadsBegin(); Graphics()->SetColor(1, 1, 1, 1); Graphics()->QuadsSetRotation(0); RenderTools()->SelectSprite(SPRITE_GENERATOR); RenderTools()->DrawSprite(Pos.x, Pos.y, 192); float c = sin(CustomStuff()->m_SawbladeAngle*0.25f)*0.3f + 0.7f; //team color if (m_pClient->m_Snap.m_pGameInfoObj) { int Flags = m_pClient->m_Snap.m_pGameInfoObj->m_GameFlags; int Team = pCurrent->m_Team; if ((Flags & GAMEFLAG_TEAMS) && !(Flags & GAMEFLAG_INFECTION)) { if (Team == TEAM_RED) Graphics()->SetColor(1, c, 0, 1); else if (Team == TEAM_BLUE) Graphics()->SetColor(0, c, 1, 1); } else if (Team == TEAM_RED) { vec4 pc = CustomStuff()->m_LocalColor; Graphics()->SetColor(pc.r, pc.g, pc.b, 1); } else Graphics()->SetColor(0.5f, c, 1, 1); } else Graphics()->SetColor(0.5f, c, 1, 1); RenderTools()->SelectSprite(SPRITE_GENERATOR_COLOR); RenderTools()->DrawSprite(Pos.x, Pos.y, 192); Graphics()->QuadsEnd(); bool Repair = pCurrent->m_Status & (1<<BSTATUS_REPAIR); float Time = Pos.x * 0.432f + pCurrent->m_Y * 0.2354f + CustomStuff()->m_SawbladeAngle * 0.1f; if (Repair) { Time += CustomStuff()->m_SawbladeAngle * 0.15f; if (frandom() < 0.15f) m_pClient->m_pEffects->Electrospark(vec2(Pos.x, Pos.y)+vec2(frandom()-frandom(), frandom()-frandom()) * 50.0f, 40+frandom()*20, vec2(0, 0)); } // repair sprite if (Repair && (CustomStuff()->LocalTick()/12+(pCurrent->m_X/8 + pCurrent->m_Y/32))%8 < 4) { Graphics()->QuadsBegin(); RenderTools()->SelectSprite(SPRITE_STATUS_REPAIR); Graphics()->SetColor(1, 1, 1, 1); Graphics()->QuadsSetRotation(0); RenderTools()->DrawSprite(Pos.x-34, Pos.y-52, 52); Graphics()->QuadsEnd(); } }
void CBlood::RenderGroup(int Group) { // render acid layer to screen if (Group == GROUP_ACIDLAYER) { if (!g_Config.m_GfxMultiBuffering) return; CUIRect Screen; Graphics()->GetScreen(&Screen.x, &Screen.y, &Screen.w, &Screen.h); Graphics()->MapScreen(0,0,Graphics()->ScreenWidth(),Graphics()->ScreenHeight()); Graphics()->RenderToScreen(); Graphics()->BlendNormal(); // blood Graphics()->ShaderBegin(SHADER_ACID, CustomStuff()->m_SawbladeAngle*0.1f); Graphics()->TextureSet(-2, RENDERBUFFER_ACID); Graphics()->QuadsBegin(); Graphics()->QuadsSetRotation(0); Graphics()->SetColor(0.0f, 1.0f, 0, 0.8f); { IGraphics::CQuadItem QuadItem(Graphics()->ScreenWidth() / 2, Graphics()->ScreenHeight() / 2, Graphics()->ScreenWidth(), -Graphics()->ScreenHeight()); Graphics()->QuadsDraw(&QuadItem, 1); } Graphics()->QuadsEnd(); Graphics()->ShaderEnd(); // reset the screen like it was before Graphics()->MapScreen(Screen.x, Screen.y, Screen.w, Screen.h); return; } // render particles to texture buffers if (g_Config.m_GfxMultiBuffering) { if (Group == GROUP_BLOOD) Graphics()->RenderToTexture(RENDERBUFFER_BLOOD); else if (Group == GROUP_ACID) Graphics()->RenderToTexture(RENDERBUFFER_ACID); Graphics()->BlendAdditive(); Graphics()->TextureSet(g_pData->m_aImages[IMAGE_LIGHTS].m_Id); Graphics()->QuadsBegin(); int i = m_aFirstPart[Group]; while(i != -1) { float a = m_aBlood[i].m_Life / m_aBlood[i].m_LifeSpan; vec2 p = m_aBlood[i].m_Pos; float Size = mix(m_aBlood[i].m_StartSize, m_aBlood[i].m_EndSize, a); Graphics()->QuadsSetRotation(m_aBlood[i].m_Rot); Graphics()->SetColor(1.0f, 1.0f, 1.0f, 1.0f); IGraphics::CQuadItem QuadItem(p.x, p.y, Size, Size*0.7f); Graphics()->QuadsDraw(&QuadItem, 1); i = m_aBlood[i].m_NextPart; } Graphics()->QuadsEnd(); Graphics()->BlendNormal(); } // ...or render particles to screen else if (Group == GROUP_BLOOD) { Graphics()->BlendNormal(); Graphics()->TextureSet(g_pData->m_aImages[IMAGE_GORE].m_Id); Graphics()->QuadsBegin(); int i = m_aFirstPart[Group]; while(i != -1) { RenderTools()->SelectSprite(m_aBlood[i].m_Spr); float a = m_aBlood[i].m_Life / m_aBlood[i].m_LifeSpan; vec2 p = m_aBlood[i].m_Pos; float Size = mix(m_aBlood[i].m_StartSize, m_aBlood[i].m_EndSize, a); Graphics()->QuadsSetRotation(m_aBlood[i].m_Rot); Graphics()->SetColor( m_aBlood[i].m_Color.r, m_aBlood[i].m_Color.g, m_aBlood[i].m_Color.b, 1.2f-a); IGraphics::CQuadItem QuadItem(p.x, p.y, Size, Size / 2.0f); Graphics()->QuadsDraw(&QuadItem, 1); i = m_aBlood[i].m_NextPart; } Graphics()->QuadsEnd(); } }