GS-EntBase: Add func_detail_illusionary definition.

Half-Life: Add sound/trail for Egon, WIP
This commit is contained in:
Marco Cawthorne 2021-02-17 16:21:17 +01:00
parent e1df585677
commit 110ce2b607
4 changed files with 138 additions and 92 deletions

View file

@ -163,12 +163,6 @@ w_flame_primary(void)
pl.w_idle_next = 2.5f;
}
void
w_flame_secondary(void)
{
w_egon_secondary();
}
void
w_flame_reload(void)
{
@ -238,7 +232,7 @@ weapon_t w_flame =
.draw = w_flame_draw,
.holster = w_egon_holster,
.primary = w_flame_primary,
.secondary = w_flame_secondary,
.secondary = w_flame_release,
.reload = __NULL__,
.release = w_flame_release,
.crosshair = w_flame_crosshair,

View file

@ -0,0 +1,25 @@
/*
* 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.
*/
/*QUAKED func_detail_illusionary (0 .5 .8) ?
A "fake" entity for level editors.
It is almost identical to func_detail except that it has no collision.
Think of it as an alternative to func_illusionary and nonsolid surfaceparms,
except that it does not use an entity slot or require custom materials.
Trivia:
This entity was introduced in Half-Life 2 (2004).
*/

View file

@ -1,76 +1,15 @@
r_part railtrailinner
r_part beam
{
step 30
scale 5
die 1
alpha 0.5
rgb 255 255 255
blend add
type beam
spawnvel 2 2
}
r_part railtrail240
{
step 15
scale 3
die 1
alpha 0
rgb 32 32 255
rampmode delta
ramp -255 -255 0 -2.5 0
ramp 0 0 0 0.65 0
ramp 0 0 0 0.65 0
ramp 0 0 0 0.65 0
ramp 0 0 -128 0.65 10
blend add
type beam
spawnmode spiral
spawnparam1 256
spawnparam2 240
spawnvel 12
assoc railtrailinner
}
r_part railtrail120
{
step 15
scale 3
die 1
alpha 0
rgb 32 32 255
rampmode delta
ramp -255 -255 0 -2.5 0
ramp 0 0 0 0.65 0
ramp 0 0 0 0.65 0
ramp 0 0 0 0.65 0
ramp 0 0 -128 0.65 10
blend add
type beam
spawnmode spiral
spawnparam1 256
spawnparam2 120
spawnvel 12
assoc railtrail240
}
r_part railtrail
{
step 15
scale 3
die 1
alpha 0
rgb 32 32 255
rampmode delta
ramp -255 -255 0 -2.5 0
ramp 0 0 0 0.65 0
ramp 0 0 0 0.65 0
ramp 0 0 0 0.65 0
ramp 0 0 -128 0.65 10
blend add
type beam
spawnmode spiral
spawnparam1 256
spawnvel 12
assoc railtrail120
texture "classicparticle"
tcoords 0 0 16 16 32
scale 1
scalefactor 0.8
step 0.25
alpha 0.1
spawnmode spiral 32
spawnorg 3
spawnvel 6
blend adda
rgbf 0.25 0.25 1.0
die 0.5
}

View file

@ -23,6 +23,47 @@ Egon/Gluon-Gun Weapon
*/
#ifdef CLIENT
var float TRAIL_EGONBEAM;
#define FXGAUSS_BEAMCOLOR [1,0.5,0]
class FXEgon:CBaseFX
{
int m_iBeams;
vector m_vecStart;
vector m_vecAngle;
void(void) FXEgon;
virtual void(void) Draw;
};
void
FXEgon::Draw(void)
{
player pl = (player)self;
int iLoop = 6;
vector src, endpos;
vector gunpos = gettaginfo(pSeat->m_eViewModel, 33);
if (alpha <= 0.0f) {
return;
}
src = m_vecStart;
makevectors(input_angles);
endpos = src + v_forward * 1024;
traceline(src, endpos, FALSE, pl);
trailparticles(TRAIL_EGONBEAM, pl, gunpos, endpos);
}
void
FXEgon::FXEgon(void)
{
CBaseFX::CBaseFX();
}
#endif
enum
{
EGON_IDLE1,
@ -43,6 +84,7 @@ void w_egon_precache(void)
#ifdef SERVER
precache_model("models/w_egon.mdl");
#else
TRAIL_EGONBEAM = particleeffectnum("weapon_egon.beam");
precache_model("models/v_egon.mdl");
precache_model("models/p_egon.mdl");
#endif
@ -50,7 +92,7 @@ void w_egon_precache(void)
void w_egon_updateammo(player pl)
{
#ifdef SERVER
Weapons_UpdateAmmo(pl, __NULL__, pl.ammo_uranium, __NULL__);
Weapons_UpdateAmmo(pl, -1, pl.ammo_uranium, -1);
#endif
}
string w_egon_wmodel(void)
@ -86,12 +128,22 @@ void w_egon_draw(void)
Weapons_SetModel("models/v_egon.mdl");
Weapons_ViewAnimation(EGON_DRAW);
pl.w_idle_next = 1.0f;
/* link the FX class */
#ifdef CLIENT
entity eold = self;
self = pSeat->m_pWeaponFX;
spawnfunc_FXEgon();
self = eold;
#endif
}
void w_egon_holster(void)
{
Weapons_ViewAnimation(EGON_HOLSTER);
}
void w_egon_release(void);
void w_egon_primary(void)
{
player pl = (player)self;
@ -102,10 +154,12 @@ void w_egon_primary(void)
/* Ammo check */
#ifdef CLIENT
if (pl.a_ammo2 <= 0) {
w_egon_release();
return;
}
#else
if (pl.ammo_uranium <= 0) {
w_egon_release();
return;
}
#endif
@ -117,6 +171,11 @@ void w_egon_primary(void)
Weapons_ViewAnimation(EGON_ALTFIRECYCLE);
pl.a_ammo2--;
FXEgon p = (FXEgon)pSeat->m_pWeaponFX;
p.m_vecAngle = input_angles;
p.m_vecStart = pl.origin + pl.view_ofs;
p.alpha = 1.0f;
#else
Weapons_MakeVectors();
vector src = Weapons_GetCameraPos();
@ -124,24 +183,53 @@ void w_egon_primary(void)
traceline(src, endpos, FALSE, pl);
Damage_Radius(trace_endpos, pl, 14, 64, TRUE, DMG_ELECTRO);
pl.ammo_uranium--;
Weapons_UpdateAmmo(pl, __NULL__, pl.ammo_uranium, __NULL__);
#endif
if (pl.a_ammo1 == 0) {
#ifdef SERVER
sound(pl, CHAN_WEAPON, "weapons/egon_windup2.wav", 1, ATTN_NORM, 100, 0);
#endif
pl.a_ammo1 = 1;
Weapons_ViewPunchAngle([-3,0,0]);
pl.w_idle_next = 3.0f;
} else if not (pl.w_idle_next > 0.0f) {
/* wait 3 seconds (idle next) */
if (pl.a_ammo1 == 1) {
#ifdef SERVER
sound(pl, CHAN_WEAPON, "weapons/egon_run3.wav", 1, ATTN_NORM, 100);
#endif
pl.a_ammo1 = 2;
}
pl.w_idle_next = 3.0f;
}
pl.w_attack_next = 0.2f;
pl.w_idle_next = 2.5f;
}
void w_egon_secondary(void)
{
w_egon_primary();
}
void w_egon_reload(void)
{
}
void w_egon_release(void)
{
#ifdef CLIENT
player pl = (player)self;
#ifdef CLIENT
FXEgon p = (FXEgon)pSeat->m_pWeaponFX;
p.m_vecAngle = input_angles;
p.m_vecStart = pl.origin + pl.view_ofs;
p.alpha = 0.0f;
#endif
if (pl.a_ammo1 != 0) {
#ifdef SERVER
sound(pl, CHAN_WEAPON, "weapons/egon_off1.wav", 1, ATTN_NORM, 100, 0);
#endif
pl.a_ammo1 = 0;
Weapons_ViewPunchAngle([-2,0,0]);
}
#ifndef SERVER
if (Weapons_GetAnimation() == EGON_ALTFIRECYCLE) {
Weapons_ViewAnimation(EGON_ALTFIREOFF);
pl.w_idle_next = 1.0f;
@ -158,7 +246,7 @@ void w_egon_release(void)
pl.w_idle_next = 2.0f;
}
}
#endif
#endif
}
void w_egon_crosshair(void)
{
@ -191,13 +279,13 @@ void w_egon_hudpic(int selected, vector pos, float a)
weapon_t w_egon =
{
.name = "egon",
.id = ITEM_EGON,
.id = ITEM_EGON,
.slot = 3,
.slot_pos = 2,
.draw = w_egon_draw,
.holster = w_egon_holster,
.primary = w_egon_primary,
.secondary = w_egon_secondary,
.secondary = w_egon_release,
.reload = w_egon_reload,
.release = w_egon_release,
.crosshair = w_egon_crosshair,