more ecologically friendly infodecal entities
fixed autoreload behaviour! it's now like in 1.5 added some glsl replacements that are more performance friendly
This commit is contained in:
parent
a21d0d597b
commit
afc8d8dbb2
13 changed files with 140 additions and 15 deletions
|
@ -138,11 +138,21 @@ void CSQC_Ent_Update( float flIsNew ) {
|
|||
self.color_y = 1.0f - ( readbyte() / 255 );
|
||||
self.color_z = 1.0f - ( readbyte() / 255 );
|
||||
self.classname = readstring();
|
||||
decalname = sprintf("decal_%s", self.classname);
|
||||
decalshader = sprintf("{\npolygonOffset\n{\nclampmap %s\nblendFunc filter\n}\n}", self.classname);
|
||||
shaderforname(decalname, decalshader);
|
||||
self.size = drawgetimagesize(self.classname);
|
||||
self.classname = decalname;
|
||||
|
||||
if (serverkeyfloat("*bspversion") != 30) {
|
||||
decalname = sprintf("decal_%s", self.classname);
|
||||
decalshader = sprintf("{\npolygonOffset\n{\nclampmap %s\nblendFunc filter\n}\n}", self.classname);
|
||||
shaderforname(decalname, decalshader);
|
||||
self.classname = decalname;
|
||||
}
|
||||
|
||||
makevectors( self.angles );
|
||||
float surf = getsurfacenearpoint(world, self.origin);
|
||||
vector s_dir = getsurfacepointattribute(world, surf, 0, SPA_S_AXIS);
|
||||
vector t_dir = getsurfacepointattribute(world, surf, 0, SPA_T_AXIS);
|
||||
self.mins = v_up / self.size[0];
|
||||
self.maxs = t_dir / self.size[1];
|
||||
|
||||
self.predraw = Effect_Decal;
|
||||
self.drawmask = MASK_ENGINE;
|
||||
|
|
6
Source/Makefile
Normal file
6
Source/Makefile
Normal file
|
@ -0,0 +1,6 @@
|
|||
CC=fteqcc
|
||||
|
||||
qc-progs:
|
||||
$(CC) Client/progs.src
|
||||
$(CC) Server/progs.src
|
||||
$(CC) Menu/progs.src
|
|
@ -49,7 +49,6 @@ var int autocvar_fcs_penalty_pain = -150;
|
|||
var int autocvar_fcs_penalty_kill = -1500;
|
||||
var int autocvar_fcs_maxmoney = 16000;
|
||||
var int autocvar_fcs_fillweapons = FALSE; // This will automatically get ammo for the weapon you buy
|
||||
var int autocvar_fcs_autoreload = FALSE; // When pressing fire and the gun is empty, it will reload instead
|
||||
|
||||
// Mapcycle features
|
||||
var string autocvar_mapcyclefile = "mapcycle.txt";
|
||||
|
|
|
@ -57,6 +57,15 @@ void infodecal(void)
|
|||
int b = 0;
|
||||
float frac = 1.0f;
|
||||
vector vpos = self.origin;
|
||||
|
||||
if (serverkeyfloat("*bspversion") != 30) {
|
||||
self.texture = sprintf( "materials/%s", self.texture );
|
||||
}
|
||||
|
||||
if (!self.texture) {
|
||||
remove(self);
|
||||
return;
|
||||
}
|
||||
|
||||
/* Unrolled because I'm lazy */
|
||||
makevectors([0, 0, 0]);
|
||||
|
|
|
@ -141,9 +141,6 @@ Returns whether or not to play an animation
|
|||
float BaseGun_PrimaryFire( void ) {
|
||||
// Nothing in the clip anymore? Don't even attempt
|
||||
if ( ( self.(wptTable[ self.weapon ].iMagfld) - 1 ) < 0 ) {
|
||||
if ( autocvar_fcs_autoreload == TRUE ) {
|
||||
Weapon_Reload( self.weapon );
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
|
|
@ -426,13 +426,7 @@ void Effect_BreakModel( vector vMins, vector vMaxs, vector vVel, float fStyle )
|
|||
|
||||
#ifdef CSQC
|
||||
float Effect_Decal( void ) {
|
||||
makevectors( self.angles );
|
||||
|
||||
float surf = getsurfacenearpoint(world, self.origin);
|
||||
vector s_dir = getsurfacepointattribute(world, surf, 0, SPA_S_AXIS);
|
||||
vector t_dir = getsurfacepointattribute(world, surf, 0, SPA_T_AXIS);
|
||||
|
||||
adddecal( self.classname, self.origin, v_up / self.size[0], t_dir / self.size[1], self.color, 1.0f );
|
||||
adddecal( self.classname, self.origin, self.mins, self.maxs, self.color, 1.0f );
|
||||
addentity( self );
|
||||
return PREDRAW_NEXT;
|
||||
}
|
||||
|
|
|
@ -256,6 +256,10 @@ void Weapon_Release( void ) {
|
|||
WeaponSMOKEGRENADE_Release();
|
||||
} else if ( self.weapon == WEAPON_C4BOMB ) {
|
||||
WeaponC4BOMB_Release();
|
||||
} else {
|
||||
if (self.(wptTable[ self.weapon ].iMagfld) == 0 && self.(wptTable[ self.weapon ].iCaliberfld)) {
|
||||
Weapon_Reload(self.weapon);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Binary file not shown.
36
freecs/glsl/defaultskin.glsl
Normal file
36
freecs/glsl/defaultskin.glsl
Normal file
|
@ -0,0 +1,36 @@
|
|||
!!ver 110
|
||||
!!permu FRAMEBLEND
|
||||
!!permu SKELETAL
|
||||
!!permu FOG
|
||||
!!samps diffuse
|
||||
|
||||
#include "sys/defs.h"
|
||||
|
||||
varying vec2 tex_c;
|
||||
varying vec3 light;
|
||||
|
||||
#ifdef VERTEX_SHADER
|
||||
#include "sys/skeletal.h"
|
||||
|
||||
float hl( vec3 normal, vec3 dir ) {
|
||||
return ( dot( normal, dir ) * 0.5 ) + 0.5;
|
||||
}
|
||||
|
||||
void main ()
|
||||
{
|
||||
vec3 n, s, t, w;
|
||||
gl_Position = skeletaltransform_wnst(w,n,s,t);
|
||||
tex_c = v_texcoord;
|
||||
light = ( hl( n, e_light_dir ) * e_light_mul ) + e_light_ambient;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef FRAGMENT_SHADER
|
||||
void main ()
|
||||
{
|
||||
vec4 diffuse_f = texture2D( s_diffuse, tex_c );
|
||||
diffuse_f.rgb *= light;
|
||||
gl_FragColor = diffuse_f * e_colourident;
|
||||
}
|
||||
#endif
|
15
freecs/glsl/defaultsky.glsl
Normal file
15
freecs/glsl/defaultsky.glsl
Normal file
|
@ -0,0 +1,15 @@
|
|||
!!ver 110
|
||||
|
||||
#ifdef VERTEX_SHADER
|
||||
void main ()
|
||||
{
|
||||
gl_Position = ftetransform();
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef FRAGMENT_SHADER
|
||||
void main ()
|
||||
{
|
||||
discard;
|
||||
}
|
||||
#endif
|
23
freecs/glsl/defaultskybox.glsl
Normal file
23
freecs/glsl/defaultskybox.glsl
Normal file
|
@ -0,0 +1,23 @@
|
|||
!!ver 110
|
||||
!!permu FOG
|
||||
!!samps reflectcube
|
||||
|
||||
#include "sys/defs.h"
|
||||
#include "sys/fog.h"
|
||||
|
||||
varying vec3 pos;
|
||||
#ifdef VERTEX_SHADER
|
||||
void main ()
|
||||
{
|
||||
pos = v_position.xyz - e_eyepos;
|
||||
pos.y = -pos.y;
|
||||
gl_Position = ftetransform();
|
||||
}
|
||||
#endif
|
||||
#ifdef FRAGMENT_SHADER
|
||||
void main ()
|
||||
{
|
||||
vec4 skybox = textureCube(s_reflectcube, pos);
|
||||
gl_FragColor = vec4(fog3(skybox.rgb), 1.0);
|
||||
}
|
||||
#endif
|
32
freecs/glsl/defaultwall.glsl
Normal file
32
freecs/glsl/defaultwall.glsl
Normal file
|
@ -0,0 +1,32 @@
|
|||
!!ver 110
|
||||
!!samps diffuse lightmap
|
||||
|
||||
#include "sys/defs.h"
|
||||
|
||||
varying vec2 tex_c;
|
||||
varying vec2 lm_c;
|
||||
|
||||
#ifdef VERTEX_SHADER
|
||||
void main ()
|
||||
{
|
||||
tex_c = v_texcoord;
|
||||
lm_c = v_lmcoord;
|
||||
gl_Position = ftetransform();
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef FRAGMENT_SHADER
|
||||
void main ( void )
|
||||
{
|
||||
vec4 diffuse_f = texture2D( s_diffuse, tex_c );
|
||||
|
||||
if ( diffuse_f.a < 0.5 ) {
|
||||
discard;
|
||||
}
|
||||
|
||||
diffuse_f.rgb *= texture2D( s_lightmap, lm_c ).rgb * e_lmscale.rgb;
|
||||
diffuse_f *= e_colourident;
|
||||
|
||||
gl_FragColor = diffuse_f;
|
||||
}
|
||||
#endif
|
BIN
freecs/progs.dat
BIN
freecs/progs.dat
Binary file not shown.
Loading…
Reference in a new issue