Add the nightvision code to replace the flashlight.
This commit is contained in:
parent
069fa3c80d
commit
bf0083566b
5 changed files with 126 additions and 7 deletions
27
src/client/draw.qc
Normal file
27
src/client/draw.qc
Normal file
|
@ -0,0 +1,27 @@
|
|||
/*
|
||||
* Copyright (c) 2016-2021 Marco Hladik <marco@icculus.org>
|
||||
*
|
||||
* Permission to use, copy, modify, and distribute this software for any
|
||||
* purpose with or without fee is hereby granted, provided that the above
|
||||
* copyright notice and this permission notice appear in all copies.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
* WHATSOEVER RESULTING FROM LOSS OF MIND, USE, DATA OR PROFITS, WHETHER
|
||||
* IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
|
||||
* OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
void
|
||||
ClientGame_PreDraw(void)
|
||||
{
|
||||
Nightvision_PreDraw();
|
||||
}
|
||||
|
||||
void
|
||||
ClientGame_PostDraw(void)
|
||||
{
|
||||
Nightvision_PostDraw();
|
||||
}
|
21
src/client/flashlight.qc
Normal file
21
src/client/flashlight.qc
Normal file
|
@ -0,0 +1,21 @@
|
|||
/*
|
||||
* Copyright (c) 2016-2020 Marco Hladik <marco@icculus.org>
|
||||
*
|
||||
* Permission to use, copy, modify, and distribute this software for any
|
||||
* purpose with or without fee is hereby granted, provided that the above
|
||||
* copyright notice and this permission notice appear in all copies.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
* WHATSOEVER RESULTING FROM LOSS OF MIND, USE, DATA OR PROFITS, WHETHER
|
||||
* IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
|
||||
* OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
void
|
||||
Player_Flashlight(base_player pl)
|
||||
{
|
||||
|
||||
}
|
|
@ -38,6 +38,7 @@ ClientGame_InitDone(void)
|
|||
void
|
||||
ClientGame_RendererRestart(string rstr)
|
||||
{
|
||||
Nightvision_Init();
|
||||
Obituary_Precache();
|
||||
|
||||
FX_Blood_Init();
|
||||
|
@ -47,12 +48,6 @@ ClientGame_RendererRestart(string rstr)
|
|||
FX_Spark_Init();
|
||||
FX_Impact_Init();
|
||||
|
||||
precache_model("sprites/640hud1.spr");
|
||||
precache_model("sprites/640hud2.spr");
|
||||
precache_model("sprites/640hud3.spr");
|
||||
precache_model("sprites/640hud4.spr");
|
||||
precache_model("sprites/640hud5.spr");
|
||||
precache_model("sprites/640hud6.spr");
|
||||
precache_model("sprites/640hudof01.spr");
|
||||
precache_model("sprites/640hudof02.spr");
|
||||
precache_model("sprites/640hudof03.spr");
|
||||
|
|
74
src/client/nightvision.qc
Normal file
74
src/client/nightvision.qc
Normal file
|
@ -0,0 +1,74 @@
|
|||
/*
|
||||
* Copyright (c) 2016-2020 Marco Hladik <marco@icculus.org>
|
||||
*
|
||||
* Permission to use, copy, modify, and distribute this software for any
|
||||
* purpose with or without fee is hereby granted, provided that the above
|
||||
* copyright notice and this permission notice appear in all copies.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
* WHATSOEVER RESULTING FROM LOSS OF MIND, USE, DATA OR PROFITS, WHETHER
|
||||
* IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
|
||||
* OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
var string g_nightvision_a;
|
||||
var string g_nightvision_b;
|
||||
var string g_nightvision_c;
|
||||
var string g_nightvision_d;
|
||||
var string g_nightvision_e;
|
||||
var string g_nightvision_i;
|
||||
|
||||
void
|
||||
Nightvision_Init(void)
|
||||
{
|
||||
g_nightvision_a = spriteframe("sprites/of_nv_a.spr", 0, 0.0f);
|
||||
g_nightvision_b = spriteframe("sprites/of_nv_a.spr", 1, 0.0f);
|
||||
g_nightvision_c = spriteframe("sprites/of_nv_a.spr", 2, 0.0f);
|
||||
g_nightvision_d = spriteframe("sprites/of_nv_a.spr", 3, 0.0f);
|
||||
g_nightvision_e = spriteframe("sprites/of_nv_a.spr", 4, 0.0f);
|
||||
g_nightvision_i = spriteframe("sprites/of_nv_int.spr", 0, 0.0f);
|
||||
}
|
||||
|
||||
void
|
||||
Nightvision_PreDraw(void)
|
||||
{
|
||||
player pl = (player)pSeat->m_ePlayer;
|
||||
|
||||
if (!(pl.gflags & GF_FLASHLIGHT))
|
||||
return;
|
||||
|
||||
dynamiclight_add(pSeat->m_vecPredictedOrigin, 768, [0.35,0.35,0.35]);
|
||||
}
|
||||
|
||||
void
|
||||
Nightvision_PostDraw(void)
|
||||
{
|
||||
player pl = (player)pSeat->m_ePlayer;
|
||||
|
||||
if (!(pl.gflags & GF_FLASHLIGHT))
|
||||
return;
|
||||
|
||||
drawpic(video_mins, "fade_modulate", video_res, [0,1,0], 1.0f, 0);
|
||||
|
||||
int r = (time * 10) % 4;
|
||||
|
||||
switch (r) {
|
||||
case 1:
|
||||
drawpic(video_mins, g_nightvision_a, video_res, [0,1,0], 0.2f, 1);
|
||||
break;
|
||||
case 2:
|
||||
drawpic(video_mins, g_nightvision_b, video_res, [0,1,0], 0.2f, 1);
|
||||
break;
|
||||
case 3:
|
||||
drawpic(video_mins, g_nightvision_c, video_res, [0,1,0], 0.2f, 1);
|
||||
break;
|
||||
default:
|
||||
drawpic(video_mins, g_nightvision_d, video_res, [0,1,0], 0.2f, 1);
|
||||
break;
|
||||
}
|
||||
|
||||
drawpic(video_mins, g_nightvision_i, video_res, [0,1,0], 0.05f, 1);
|
||||
}
|
|
@ -20,7 +20,9 @@
|
|||
../../../src/gs-entbase/shared.src
|
||||
../shared/include.src
|
||||
|
||||
../../../base/src/client/draw.qc
|
||||
flashlight.qc
|
||||
nightvision.qc
|
||||
draw.qc
|
||||
init.qc
|
||||
../../../valve/src/client/player.qc
|
||||
../../../valve/src/client/entities.qc
|
||||
|
|
Loading…
Reference in a new issue