Restore the night-vision equipment item.
This commit is contained in:
parent
9f9def03f3
commit
be938177a4
4 changed files with 44 additions and 3 deletions
|
@ -17,11 +17,11 @@
|
|||
void
|
||||
ClientGame_PreDraw(void)
|
||||
{
|
||||
|
||||
Nightvision_PreFrame();
|
||||
}
|
||||
|
||||
void
|
||||
ClientGame_PostDraw(void)
|
||||
{
|
||||
|
||||
Nightvision_PostFrame();
|
||||
}
|
||||
|
|
|
@ -107,6 +107,9 @@ ClientGame_Init(float apilevel, string enginename, float engineversion)
|
|||
registercommand("enemydown");
|
||||
|
||||
Obituary_Init();
|
||||
|
||||
Sound_Precache("nvg.on");
|
||||
Sound_Precache("nvg.off");
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
@ -17,21 +17,49 @@
|
|||
void
|
||||
Nightvision_Toggle(void)
|
||||
{
|
||||
player pl = (player)pSeat->m_ePlayer;
|
||||
|
||||
if (!(pl.g_items & ITEM_NIGHTVISION)) {
|
||||
pSeat->m_iNightvision = 0;
|
||||
return;
|
||||
}
|
||||
|
||||
pSeat->m_iNightvision = 1 - pSeat->m_iNightvision;
|
||||
|
||||
if (pSeat->m_iNightvision)
|
||||
Sound_Play(self, CHAN_AUTO, "nvg.on");
|
||||
else
|
||||
Sound_Play(self, CHAN_AUTO, "nvg.off");
|
||||
}
|
||||
|
||||
void
|
||||
Nightvision_PreFrame(void)
|
||||
{
|
||||
player pl = (player)pSeat->m_ePlayer;
|
||||
|
||||
if (!pSeat->m_iNightvision)
|
||||
return;
|
||||
|
||||
|
||||
if (!(pl.g_items & ITEM_NIGHTVISION)) {
|
||||
pSeat->m_iNightvision = 0;
|
||||
return;
|
||||
}
|
||||
|
||||
dynamiclight_add(pSeat->m_vecPredictedOrigin, 768, [1,1,1]);
|
||||
}
|
||||
|
||||
void
|
||||
Nightvision_PostFrame(void)
|
||||
{
|
||||
player pl = (player)pSeat->m_ePlayer;
|
||||
|
||||
if (!pSeat->m_iNightvision)
|
||||
return;
|
||||
|
||||
if (!(pl.g_items & ITEM_NIGHTVISION)) {
|
||||
pSeat->m_iNightvision = 0;
|
||||
return;
|
||||
}
|
||||
|
||||
drawpic(video_mins, "fade_modulate", g_hudres, [0,1,0], 1.0f, 0);
|
||||
}
|
||||
|
|
|
@ -12,3 +12,13 @@ buy.ammo
|
|||
{
|
||||
sample items/9mmclip1.wav
|
||||
}
|
||||
|
||||
nvg.on
|
||||
{
|
||||
sample items/nvg_on.wav
|
||||
}
|
||||
|
||||
nvg.off
|
||||
{
|
||||
sample items/nvg_off.wav
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue