Updated a whole bunch of stuff related to weapons and whatnot. I'm too tired to clean this up too. Will fix tomorrow.
This commit is contained in:
parent
777c52eb7d
commit
2081fa790a
23 changed files with 291 additions and 20 deletions
|
@ -80,6 +80,7 @@ vgui.cpp
|
|||
cstrike/vgui_buymenu.cpp
|
||||
cstrike/vgui_chooseteam.cpp
|
||||
cstrike/vgui_motd.cpp
|
||||
valve/scoreboard.c
|
||||
|
||||
cstrike/draw.c
|
||||
cstrike/entities.c
|
||||
|
|
|
@ -31,6 +31,11 @@ void CSQC_Ent_Update(float new)
|
|||
case ENT_DECAL:
|
||||
Decal_Parse();
|
||||
break;
|
||||
#ifdef VALVE
|
||||
case ENT_TRIPMINE:
|
||||
w_tripmine_parse();
|
||||
break;
|
||||
#endif
|
||||
default:
|
||||
error("Unknown entity type update received.\n");
|
||||
}
|
||||
|
|
|
@ -95,7 +95,7 @@ void CSQC_Init(float apilevel, string enginename, float engineversion)
|
|||
/* Game specific inits */
|
||||
HUD_Init();
|
||||
|
||||
//Scores_Init();
|
||||
Scores_Init();
|
||||
Client_Init(apilevel, enginename, engineversion);
|
||||
DSP_Init();
|
||||
}
|
||||
|
@ -103,7 +103,6 @@ void CSQC_Init(float apilevel, string enginename, float engineversion)
|
|||
void CSQC_UpdateView(float w, float h, float focus)
|
||||
{
|
||||
player pl;
|
||||
float needcursor;
|
||||
int s;
|
||||
|
||||
if (w == 0 || h == 0) {
|
||||
|
@ -285,10 +284,10 @@ void CSQC_UpdateView(float w, float h, float focus)
|
|||
|
||||
// Don't even try to draw centerprints and VGUI menus when scores are shown
|
||||
if (pSeat->iShowScores == TRUE) {
|
||||
//Scores_Draw();
|
||||
Scores_Draw();
|
||||
} else {
|
||||
VGUI_Draw();
|
||||
CSQC_DrawCenterprint();
|
||||
needcursor |= VGUI_Draw();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -13,6 +13,7 @@
|
|||
../events.h
|
||||
../entities.h
|
||||
valve/defs.h
|
||||
valve/particles.h
|
||||
defs.h
|
||||
|
||||
../vgui/include.src
|
||||
|
|
|
@ -12,6 +12,7 @@
|
|||
../events.h
|
||||
../entities.h
|
||||
valve/defs.h
|
||||
valve/particles.h
|
||||
defs.h
|
||||
|
||||
../vgui/include.src
|
||||
|
|
|
@ -53,6 +53,8 @@ void Client_Init(float apilevel, string enginename, float engineversion)
|
|||
precache_model("sprites/hammer.spr");
|
||||
precache_model("sprites/w_cannon.spr");
|
||||
|
||||
BEAM_TRIPMINE = particleeffectnum("beam_tripmine");
|
||||
|
||||
/* FIXME: Replace with manual networking once I've got time? */
|
||||
deltalisten("models/scientist.mdl", Scientist_Update, 0);
|
||||
}
|
||||
|
|
|
@ -12,6 +12,7 @@
|
|||
../events.h
|
||||
../entities.h
|
||||
valve/defs.h
|
||||
valve/particles.h
|
||||
defs.h
|
||||
|
||||
../vgui/include.src
|
||||
|
|
|
@ -21,6 +21,8 @@ void Client_Init(float apilevel, string enginename, float engineversion)
|
|||
precache_model("sprites/640hud4.spr");
|
||||
precache_model("sprites/640hud5.spr");
|
||||
precache_model("sprites/640hud6.spr");
|
||||
|
||||
BEAM_TRIPMINE = particleeffectnum("beam_tripmine");
|
||||
}
|
||||
|
||||
void Client_InitDone(void)
|
||||
|
|
1
Source/client/valve/particles.h
Normal file
1
Source/client/valve/particles.h
Normal file
|
@ -0,0 +1 @@
|
|||
var float BEAM_TRIPMINE;
|
|
@ -11,5 +11,8 @@ enum {
|
|||
ENT_AMBIENTSOUND,
|
||||
ENT_SPRITE,
|
||||
ENT_SPRAY,
|
||||
#ifdef VALVE
|
||||
ENT_TRIPMINE,
|
||||
#endif
|
||||
ENT_DECAL
|
||||
};
|
||||
|
|
|
@ -15,6 +15,8 @@ cstrike/defs.h
|
|||
../entities.h
|
||||
defs.h
|
||||
cstrike/defsfields.h
|
||||
|
||||
plugins.c
|
||||
|
||||
../gs-entbase/server.src
|
||||
|
||||
|
|
|
@ -70,12 +70,16 @@ void SetChangeParms(void)
|
|||
|
||||
void SV_RunClientCommand(void)
|
||||
{
|
||||
Game_RunClientCommand();
|
||||
if (!Plugin_RunClientCommand()) {
|
||||
Game_RunClientCommand();
|
||||
}
|
||||
}
|
||||
|
||||
void SV_ParseClientCommand(string cmd)
|
||||
{
|
||||
Game_ParseClientCommand(cmd);
|
||||
if (!Plugin_ParseClientCommand(cmd)) {
|
||||
Game_ParseClientCommand(cmd);
|
||||
}
|
||||
}
|
||||
|
||||
void init(float prevprogs)
|
||||
|
@ -101,6 +105,7 @@ void init(float prevprogs)
|
|||
}
|
||||
|
||||
PMove_Init();
|
||||
Plugin_Init();
|
||||
}
|
||||
|
||||
void initents(void)
|
||||
|
|
51
Source/server/plugins.c
Normal file
51
Source/server/plugins.c
Normal file
|
@ -0,0 +1,51 @@
|
|||
|
||||
var int g_plugins_enabled;
|
||||
var int autocvar_sv_plugins = 1;
|
||||
|
||||
void Plugin_Init(void)
|
||||
{
|
||||
if (autocvar_sv_plugins) {
|
||||
print("Initializing plugins...\n");
|
||||
g_plugins_enabled = 1;
|
||||
} else {
|
||||
print("Initializing plugins...\n");
|
||||
g_plugins_enabled = 0;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
=================
|
||||
Plugin_RunClientCommand
|
||||
|
||||
Funtion that can interrupt client commands before physics are run
|
||||
=================
|
||||
*/
|
||||
int Plugin_RunClientCommand(void)
|
||||
{
|
||||
int(void) vFunc = externvalue( -2, "FMX_RunClientCommand" );
|
||||
|
||||
if (vFunc || g_plugins_enabled == 0) {
|
||||
return vFunc();
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/*
|
||||
=================
|
||||
Plugin_ParseClientCommand
|
||||
|
||||
Intercepts 'cmd' calls. We use it to intercept
|
||||
chat messages and handle distribution ourselves.
|
||||
=================
|
||||
*/
|
||||
int Plugin_ParseClientCommand(string msg)
|
||||
{
|
||||
int(void) vFunc = externvalue( -2, "FMX_ParseClientCommand" );
|
||||
|
||||
if (vFunc || g_plugins_enabled == 0) {
|
||||
return vFunc(msg);
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
|
@ -14,6 +14,8 @@ valve/defs.h
|
|||
../entities.h
|
||||
../shared/valve/animations.h
|
||||
defs.h
|
||||
|
||||
plugins.c
|
||||
|
||||
../gs-entbase/server.src
|
||||
valve/monster_rat.cpp
|
||||
|
|
|
@ -15,6 +15,8 @@ valve/defs.h
|
|||
../entities.h
|
||||
../shared/valve/animations.h
|
||||
defs.h
|
||||
|
||||
plugins.c
|
||||
|
||||
../gs-entbase/server.src
|
||||
valve/monster_rat.cpp
|
||||
|
|
|
@ -512,7 +512,7 @@ void monster_scientist::vPain(int iHitBody)
|
|||
return;
|
||||
}
|
||||
|
||||
if (random() < 0.75f) {
|
||||
if (random() < 0.25f) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -522,7 +522,7 @@ void monster_scientist::vPain(int iHitBody)
|
|||
frame = SCIA_FLINCH + floor(random(0, 5));
|
||||
m_iFlags |= SCIF_FEAR;
|
||||
|
||||
m_flPainTime = time + 1.0f;
|
||||
m_flPainTime = time + 0.25f;
|
||||
}
|
||||
|
||||
void monster_scientist::vDeath(int iHitBody)
|
||||
|
|
|
@ -14,6 +14,8 @@ valve/defs.h
|
|||
../entities.h
|
||||
../shared/valve/animations.h
|
||||
defs.h
|
||||
|
||||
plugins.c
|
||||
|
||||
../gs-entbase/server.src
|
||||
valve/monster_rat.cpp
|
||||
|
|
|
@ -114,6 +114,38 @@ void Decals_PlaceScorch(vector pos)
|
|||
#endif
|
||||
}
|
||||
|
||||
void Decals_PlaceDent(vector pos)
|
||||
{
|
||||
if (serverkeyfloat("*bspversion") != 30) {
|
||||
return;
|
||||
}
|
||||
#ifdef CSQC
|
||||
// TODO
|
||||
#else
|
||||
entity decal = Decals_Next(pos);
|
||||
setorigin(decal, pos);
|
||||
decal.texture = sprintf("{dent%d", floor(random(1,7)));
|
||||
decal.think = infodecal;
|
||||
decal.nextthink = time /*+ 0.1f*/;
|
||||
#endif
|
||||
}
|
||||
|
||||
void Decals_PlaceGauss(vector pos)
|
||||
{
|
||||
if (serverkeyfloat("*bspversion") != 30) {
|
||||
return;
|
||||
}
|
||||
#ifdef CSQC
|
||||
// TODO
|
||||
#else
|
||||
entity decal = Decals_Next(pos);
|
||||
setorigin(decal, pos);
|
||||
decal.texture = "{gaussshot1";
|
||||
decal.think = infodecal;
|
||||
decal.nextthink = time /*+ 0.1f*/;
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifdef CSQC
|
||||
|
||||
const string g_decalshader = \
|
||||
|
|
|
@ -62,6 +62,60 @@ void w_gauss_holster(void)
|
|||
Weapons_ViewAnimation(GAUSS_HOLSTER);
|
||||
}
|
||||
|
||||
#ifdef CSQC
|
||||
void w_gauss_placeorbs(vector org)
|
||||
{
|
||||
static float glow_think(void) {
|
||||
if (self.alpha <= 0.0f) {
|
||||
remove(self);
|
||||
}
|
||||
self.alpha -= (clframetime * 0.25);
|
||||
addentity(self);
|
||||
return PREDRAW_NEXT;
|
||||
}
|
||||
entity glow = spawn();
|
||||
glow.drawmask = MASK_ENGINE;
|
||||
setmodel(glow, "sprites/yelflare1.spr");
|
||||
setsize(glow, [0,0,0], [0,0,0]);
|
||||
setorigin(glow, org);
|
||||
glow.predraw = glow_think;
|
||||
glow.effects = EF_ADDITIVE;
|
||||
glow.alpha = 1.0f;
|
||||
glow.scale = 0.25f;
|
||||
glow.colormod = [255, 255, 0] / 255;
|
||||
glow.movetype = MOVETYPE_BOUNCE;
|
||||
glow.velocity[0] = random() - 0.5;
|
||||
glow.velocity[1] = random() - 0.5;
|
||||
glow.velocity[2] = random() * 8;
|
||||
glow.velocity *= 64;
|
||||
}
|
||||
void w_gauss_placeimpact(vector org)
|
||||
{
|
||||
static float glow_think(void) {
|
||||
if (self.alpha <= 0.0f) {
|
||||
remove(self);
|
||||
return;
|
||||
}
|
||||
self.alpha -= (clframetime * 0.5);
|
||||
dynamiclight_add(self.origin, 256 * self.alpha, self.colormod);
|
||||
addentity(self);
|
||||
return PREDRAW_NEXT;
|
||||
}
|
||||
entity glow = spawn();
|
||||
glow.drawmask = MASK_ENGINE;
|
||||
setmodel(glow, "sprites/yelflare1.spr");
|
||||
setorigin(glow, org);
|
||||
glow.predraw = glow_think;
|
||||
glow.effects = EF_ADDITIVE;
|
||||
glow.alpha = 1.0f;
|
||||
glow.colormod = [255, 200, 0] / 255;
|
||||
|
||||
for (int i = 0; i < 3; i++) {
|
||||
w_gauss_placeorbs(org);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
void w_gauss_fire(int one)
|
||||
{
|
||||
player pl = (player)self;
|
||||
|
@ -76,15 +130,32 @@ void w_gauss_fire(int one)
|
|||
sound(pl, CHAN_WEAPON, "weapons/gauss2.wav", 1, ATTN_NORM);
|
||||
iDamage = one ? 20 : 200;
|
||||
|
||||
if (getsurfacetexture(trace_ent, getsurfacenearpoint(trace_ent, trace_endpos)) == "sky") {
|
||||
return;
|
||||
}
|
||||
|
||||
if (trace_ent.takedamage == DAMAGE_YES) {
|
||||
Damage_Apply(trace_ent, self, iDamage, trace_endpos, FALSE);
|
||||
sound(trace_ent, CHAN_ITEM, sprintf("weapons/electro%d.wav", random(0,3)+4), 1, ATTN_NORM);
|
||||
}
|
||||
#else
|
||||
te_beam(world, src, trace_endpos);
|
||||
te_beam(world, gettaginfo(pSeat->eViewModel, 33), trace_endpos);
|
||||
|
||||
if (getsurfacetexture(trace_ent, getsurfacenearpoint(trace_ent, trace_endpos)) != "sky") {
|
||||
w_gauss_placeimpact(trace_endpos);
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
if (one) {
|
||||
return;
|
||||
} else {
|
||||
/* Apply force */
|
||||
if (pl.flags & FL_ONGROUND) {
|
||||
pl.velocity += v_forward * -400;
|
||||
} else {
|
||||
pl.velocity += v_forward * -800;
|
||||
}
|
||||
}
|
||||
|
||||
// reflection equation:
|
||||
|
@ -105,8 +176,19 @@ void w_gauss_fire(int one)
|
|||
Damage_Apply(trace_ent, self, iDamage, trace_endpos, FALSE);
|
||||
sound(trace_ent, CHAN_ITEM, sprintf("weapons/electro%d.wav", random(0,3)+4), 1, ATTN_NORM);
|
||||
}
|
||||
|
||||
if (getsurfacetexture(trace_ent, getsurfacenearpoint(trace_ent, trace_endpos)) != "sky") {
|
||||
Decals_PlaceGauss(trace_endpos);
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
#else
|
||||
te_beam(world, src, trace_endpos);
|
||||
if (getsurfacetexture(trace_ent, getsurfacenearpoint(trace_ent, trace_endpos)) != "sky") {
|
||||
te_beam(world, src, trace_endpos);
|
||||
w_gauss_placeimpact(trace_endpos);
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -132,12 +214,22 @@ void w_gauss_secondary(void)
|
|||
player pl = (player)self;
|
||||
|
||||
#ifdef CSQC
|
||||
print(sprintf("%i\n", pl.a_ammo2));
|
||||
|
||||
if (pl.a_ammo3)
|
||||
soundupdate(pl, CHAN_WEAPON, "", 2, ATTN_NORM, 150, 0, 0);
|
||||
soundupdate(pl, CHAN_WEAPON, "", 2, ATTN_NORM, 100 + (200 * (pl.a_ammo2/255)), 0, 0);
|
||||
#endif
|
||||
|
||||
if (pl.w_attack_next) {
|
||||
return;
|
||||
}
|
||||
pl.w_attack_next = 0.1f;
|
||||
|
||||
/* Set pitch sound shift */
|
||||
pl.a_ammo2 += 16;
|
||||
if (pl.a_ammo2 > 255) {
|
||||
pl.a_ammo2 = 255;
|
||||
}
|
||||
|
||||
if (pl.a_ammo3 == 1) {
|
||||
#ifdef CSQC
|
||||
|
@ -152,7 +244,7 @@ void w_gauss_secondary(void)
|
|||
#endif
|
||||
pl.a_ammo3 = 1;
|
||||
}
|
||||
pl.w_attack_next = 1.0f;
|
||||
|
||||
}
|
||||
void w_gauss_reload(void)
|
||||
{
|
||||
|
@ -165,6 +257,9 @@ void w_gauss_release(void)
|
|||
return;
|
||||
}
|
||||
|
||||
/* Reset the pitch sound shift */
|
||||
pl.a_ammo2 = 0;
|
||||
|
||||
if (pl.a_ammo3 == 1) {
|
||||
pl.w_attack_next = 0.0f;
|
||||
pl.w_idle_next = 4.0f;
|
||||
|
|
|
@ -54,6 +54,9 @@ void w_handgrenade_throw(void)
|
|||
|
||||
static void WeaponFrag_Throw_Touch( void )
|
||||
{
|
||||
if (other.takedamage == DAMAGE_YES) {
|
||||
Damage_Apply(other, self.owner, 15, self.origin, FALSE);
|
||||
}
|
||||
sound( self, CHAN_BODY, "weapons/grenade/land.wav", 1, ATTN_NORM );
|
||||
self.frame = 0;
|
||||
}
|
||||
|
@ -89,7 +92,7 @@ void w_handgrenade_throw(void)
|
|||
setmodel( eGrenade, "models/w_grenade.mdl" );
|
||||
eGrenade.frame = 1;
|
||||
setorigin( eGrenade, vecSrc );
|
||||
setsize( eGrenade, [-4,-4,-4], [4,4,4] );
|
||||
setsize( eGrenade, [0,0,0], [0,0,0] );
|
||||
}
|
||||
#endif
|
||||
|
||||
|
|
|
@ -77,6 +77,7 @@ void w_tripmine_ready(void)
|
|||
traceline(self.origin, self.origin + v_forward * 2048, FALSE, self);
|
||||
|
||||
if (!self.health) {
|
||||
self.SendFlags = 1;
|
||||
self.health = 1;
|
||||
self.vDeath =
|
||||
self.vPain = w_tripmine_trip;
|
||||
|
@ -94,6 +95,55 @@ void w_tripmine_ready(void)
|
|||
}
|
||||
#endif
|
||||
|
||||
#ifdef SSQC
|
||||
float w_tripmine_sendentity(entity pvsent, float flags)
|
||||
{
|
||||
WriteByte(MSG_ENTITY, ENT_TRIPMINE);
|
||||
WriteCoord(MSG_ENTITY, self.origin[0]);
|
||||
WriteCoord(MSG_ENTITY, self.origin[1]);
|
||||
WriteCoord(MSG_ENTITY, self.origin[2]);
|
||||
WriteCoord(MSG_ENTITY, self.angles[0]);
|
||||
WriteCoord(MSG_ENTITY, self.angles[1]);
|
||||
WriteCoord(MSG_ENTITY, self.angles[2]);
|
||||
WriteFloat(MSG_ENTITY, self.armor);
|
||||
WriteByte(MSG_ENTITY, self.health);
|
||||
WriteShort(MSG_ENTITY, self.modelindex);
|
||||
return TRUE;
|
||||
}
|
||||
#else
|
||||
.float health;
|
||||
.float armor;
|
||||
float w_tripmine_predraw(void)
|
||||
{
|
||||
if (self.health) {
|
||||
makevectors(self.angles);
|
||||
traceline(self.origin, self.origin + v_forward * 8196, FALSE, self);
|
||||
trailparticles(BEAM_TRIPMINE, self, self.origin, trace_endpos);
|
||||
}
|
||||
addentity(self);
|
||||
return PREDRAW_NEXT;
|
||||
}
|
||||
float w_tripmine_parse(void)
|
||||
{
|
||||
self.origin[0] = readcoord();
|
||||
self.origin[1] = readcoord();
|
||||
self.origin[2] = readcoord();
|
||||
self.angles[0] = readcoord();
|
||||
self.angles[1] = readcoord();
|
||||
self.angles[2] = readcoord();
|
||||
self.armor = readfloat();
|
||||
self.health = readbyte();
|
||||
self.modelindex = readshort();
|
||||
self.solid = SOLID_BBOX;
|
||||
self.movetype = MOVETYPE_NONE;
|
||||
self.predraw = w_tripmine_predraw;
|
||||
self.drawmask = MASK_ENGINE;
|
||||
self.frame = TRIPMINE_WORLD;
|
||||
setcustomskin(self, "", "geomset 0 2\ngeomset 1 2\n");
|
||||
setorigin(self, self.origin);
|
||||
}
|
||||
#endif
|
||||
|
||||
void w_tripmine_primary(void)
|
||||
{
|
||||
player pl = (player)self;
|
||||
|
@ -114,11 +164,12 @@ void w_tripmine_primary(void)
|
|||
entity mine = spawn();
|
||||
setmodel(mine, "models/v_tripmine.mdl");
|
||||
setorigin(mine, trace_endpos);
|
||||
mine.frame = TRIPMINE_WORLD;
|
||||
mine.angles = vectoangles( trace_plane_normal );
|
||||
setorigin(mine, trace_endpos - (v_forward * 4));
|
||||
setorigin(mine, trace_endpos - (v_forward * 8));
|
||||
mine.think = w_tripmine_ready;
|
||||
mine.nextthink = time + 4.0f;
|
||||
mine.SendEntity = w_tripmine_sendentity;
|
||||
mine.SendFlags = 1;
|
||||
//mine.owner = pl;
|
||||
sound(mine, CHAN_WEAPON, "weapons/mine_charge.wav", 1, ATTN_NORM);
|
||||
sound(self, CHAN_WEAPON, "weapons/mine_deploy.wav", 1, ATTN_NORM);
|
||||
|
|
|
@ -39,11 +39,6 @@ varying mat3 invsurface;
|
|||
vec4 diffuse_f = texture2D(s_diffuse, tex_c);
|
||||
vec3 light = texture2D(s_lightmap, lm_c).rgb;
|
||||
|
||||
if (diffuse_f.rgb == vec3(0,0,1)) {
|
||||
diffuse_f.rgb = vec3(0,0,0);
|
||||
discard;
|
||||
}
|
||||
|
||||
#ifdef REFLECTCUBE
|
||||
#ifdef BUMP
|
||||
#ifndef FLATTENNORM
|
||||
|
|
|
@ -1,3 +1,18 @@
|
|||
r_part beam_tripmine
|
||||
{
|
||||
texture "particles/fteparticlefont.tga"
|
||||
tcoords 97 97 191 191 256
|
||||
scale 1
|
||||
scaledelta 0.5
|
||||
alpha 0.4
|
||||
step 4
|
||||
randomvel 0
|
||||
rgb 0 255 200
|
||||
rgbdelta 0 -150 -150
|
||||
type beam
|
||||
blend add
|
||||
}
|
||||
|
||||
r_part te_beam
|
||||
{
|
||||
texture "particles/fteparticlefont.tga"
|
||||
|
|
Loading…
Reference in a new issue