Big improvements to sprays. No more infokeys, support for colored sprays and much more.
This commit is contained in:
parent
e3b1dc88a2
commit
47c43544bf
11 changed files with 62 additions and 20 deletions
|
@ -46,6 +46,7 @@ var int autocvar_cl_thirdperson = FALSE;
|
|||
var int autocvar_cl_radar = 1;
|
||||
|
||||
var string autocvar_cl_logofile = "lambda";
|
||||
var vector autocvar_cl_logocolor = '255 0 0';
|
||||
|
||||
// Particle stuff
|
||||
var float PARTICLE_SPARK;
|
||||
|
@ -164,4 +165,4 @@ void Animation_ReloadWeapon( entity ePlayer );
|
|||
void CSQC_DrawText( vector vPos, string sString, vector vSize, vector vColor, float fAlpha, float fFlags, float fFont ) {
|
||||
drawfont = fFont;
|
||||
drawstring( vPos, sString, vSize, vColor, fAlpha, fFlags );
|
||||
}
|
||||
}
|
||||
|
|
|
@ -89,9 +89,12 @@ void CSQC_Ent_Update( float flIsNew ) {
|
|||
self.angles_y = readcoord();
|
||||
self.angles_z = readcoord();
|
||||
|
||||
// TODO: This doesn't cache them to be player specific yet, make it so!
|
||||
self.model = sprintf( "logos/%s.bmp" ,getplayerkeyvalue( readbyte() - 1, "logo" ) );
|
||||
shaderforname( self.classname, sprintf("{\npolygonOffset\n{\nmap %s\nblendfunc blendFunc add\n\nrgbgen vertex\n}\n}\n", self.model ) );
|
||||
self.color_x = 1.0f - ( readbyte() / 255 );
|
||||
self.color_y = 1.0f - ( readbyte() / 255 );
|
||||
self.color_z = 1.0f - ( readbyte() / 255 );
|
||||
string sLogo = readstring();
|
||||
|
||||
self.classname = sprintf( "spray_%s", sLogo );
|
||||
self.predraw = Effect_Spraypaint;
|
||||
self.drawmask = MASK_ENGINE;
|
||||
}
|
||||
|
|
|
@ -120,7 +120,8 @@ float CSQC_ConsoleCommand( string sCMD ) {
|
|||
pSeat = &seats[ s ];
|
||||
|
||||
tokenize( sCMD );
|
||||
switch ( argv(0) ) {
|
||||
|
||||
switch ( argv( 0 ) ) {
|
||||
case "minimap":
|
||||
pSeat.iMapExpand = 1 - pSeat.iMapExpand;
|
||||
return TRUE;
|
||||
|
@ -638,6 +639,16 @@ void CSQC_Input_Frame( void ) {
|
|||
return;
|
||||
}
|
||||
|
||||
if ( input_impulse == 101 ) {
|
||||
print( "This aint Half-Life.\n" );
|
||||
input_impulse = 0;
|
||||
}
|
||||
|
||||
if ( input_impulse == 201 ) {
|
||||
tokenize( cvar_string( "cl_logocolor" ) );
|
||||
sendevent( "EffectSpray", "sfff", autocvar_cl_logofile, stof( argv( 0 ) ), stof( argv( 1 ) ), stof( argv( 2 ) ) );
|
||||
}
|
||||
|
||||
if ( iInputAttack2 == TRUE ) {
|
||||
input_buttons |= INPUT_BUTTON5;
|
||||
}
|
||||
|
|
|
@ -101,8 +101,6 @@ void CSQC_Init(float apilevel, string enginename, float engineversion) {
|
|||
FONT_16 = loadfont( "16", "gfx/conchars_16", "16", -1 );
|
||||
|
||||
SHADER_CULLED = shaderforname( "mirror_cull" );
|
||||
|
||||
localcmd( sprintf( "setinfo logo %s\n", autocvar_cl_logofile ) );
|
||||
|
||||
Radio_InitSounds();
|
||||
|
||||
|
|
|
@ -32,6 +32,7 @@ var vector vVideoSize;
|
|||
var vector vMenuOffset;
|
||||
var vector autocvar_menu_fgcolor = '1 0.59 0.19';
|
||||
var string autocvar_cl_logofile = "lambda";
|
||||
var vector autocvar_cl_logocolor = '255 0 0';
|
||||
|
||||
var vector vMousePos;
|
||||
var float fInputKeyCode;
|
||||
|
@ -60,6 +61,9 @@ int iMenu;
|
|||
string *sMapList;
|
||||
int iMapCount;
|
||||
|
||||
string *sLogos;
|
||||
var int iLogos;
|
||||
|
||||
var float FONT_MENU;
|
||||
|
||||
#define MENU_COUNT 11
|
||||
|
@ -192,4 +196,4 @@ typedef struct {
|
|||
} color;
|
||||
|
||||
void Menu_SetClipArea( vector vPosition, vector vRegion );
|
||||
void Menu_ResetClipArea( void );
|
||||
void Menu_ResetClipArea( void );
|
||||
|
|
|
@ -50,6 +50,25 @@ void m_init( void ) {
|
|||
if ( whichpack( "sound/items/9mmclip1.wav" ) ) {
|
||||
iHLContent = TRUE;
|
||||
}
|
||||
|
||||
// Initialize all the spraylogos
|
||||
searchhandle shSprays = search_begin( "logos/*.bmp", TRUE, TRUE );
|
||||
sLogos = memalloc( sizeof( string ) * search_getsize( shSprays ) );
|
||||
for ( int i = 0; i < search_getsize( shSprays ); i++ ) {
|
||||
string sShadername;
|
||||
string sShortname = search_getfilename( shSprays, i );
|
||||
precache_pic( sShortname );
|
||||
sShortname = substring( sShortname, 6, strlen( sShortname ) - 10 );
|
||||
sLogos[ i ] = sShortname;
|
||||
sShadername = sprintf( "spray_%s", sShortname );
|
||||
if ( substring( sShortname, 0, 1 ) == "#" ) {
|
||||
shaderforname( sShadername, sprintf("{\ncull disable\npolygonOffset\n{\nmap %s\n}\n}\n", search_getfilename( shSprays, i ) ) );
|
||||
} else {
|
||||
shaderforname( sShadername, sprintf("{\ncull disable\npolygonOffset\n{\nmap %s\nblendFunc GL_ZERO GL_ONE_MINUS_SRC_COLOR\n\nrgbgen vertex\n}\n}\n", search_getfilename( shSprays, i ) ) );
|
||||
}
|
||||
iLogos += 1;
|
||||
}
|
||||
search_end( shSprays );
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
@ -75,9 +75,5 @@ void Input_Handle( void ) {
|
|||
Weapon_Release();
|
||||
}
|
||||
|
||||
if ( self.impulse == 201 ) {
|
||||
Effect_Spraypaint();
|
||||
}
|
||||
|
||||
self.impulse = 0;
|
||||
}
|
||||
|
|
|
@ -28,7 +28,7 @@ void Effect_RemoveSpray( entity eOwner ) {
|
|||
}
|
||||
}
|
||||
|
||||
void Effect_Spraypaint( void ) {
|
||||
void Effect_Spraypaint( string sLogo, float fR, float fG, float fB ) {
|
||||
static float Effect_Spraypaint_Send( entity ePVSEnt, float fChanged ) {
|
||||
WriteByte( MSG_ENTITY, ENT_SPRAY );
|
||||
WriteCoord( MSG_ENTITY, self.origin_x );
|
||||
|
@ -37,7 +37,10 @@ void Effect_Spraypaint( void ) {
|
|||
WriteCoord( MSG_ENTITY, self.angles_x );
|
||||
WriteCoord( MSG_ENTITY, self.angles_y );
|
||||
WriteCoord( MSG_ENTITY, self.angles_z );
|
||||
WriteByte( MSG_ENTITY, num_for_edict( self.owner ) );
|
||||
WriteByte( MSG_ENTITY, self.color_x );
|
||||
WriteByte( MSG_ENTITY, self.color_y );
|
||||
WriteByte( MSG_ENTITY, self.color_z );
|
||||
WriteString( MSG_ENTITY, self.model );
|
||||
return TRUE;
|
||||
}
|
||||
vector vSrc;
|
||||
|
@ -47,8 +50,6 @@ void Effect_Spraypaint( void ) {
|
|||
if ( self.health <= 0 ) {
|
||||
return;
|
||||
}
|
||||
|
||||
Effect_RemoveSpray( self );
|
||||
|
||||
vSrc = self.origin + self.view_ofs;
|
||||
vEnd = vSrc + v_forward * 128;
|
||||
|
@ -56,10 +57,17 @@ void Effect_Spraypaint( void ) {
|
|||
|
||||
// Found a wall
|
||||
if ( trace_fraction != 1.0f ) {
|
||||
Effect_RemoveSpray( self );
|
||||
|
||||
entity eSpray = spawn();
|
||||
eSpray.classname = "spray";
|
||||
eSpray.owner = self;
|
||||
eSpray.solid = SOLID_NOT;
|
||||
eSpray.color_x = fR;
|
||||
eSpray.color_y = fG;
|
||||
eSpray.color_z = fB;
|
||||
eSpray.model = sLogo;
|
||||
|
||||
setorigin( eSpray, trace_endpos );
|
||||
|
||||
// Align it
|
||||
|
@ -69,8 +77,6 @@ void Effect_Spraypaint( void ) {
|
|||
|
||||
vector vCoplanar = v_forward - ( v_forward * trace_plane_normal ) * trace_plane_normal;
|
||||
|
||||
centerprint( self, sprintf( "Coplanar: %f %f %f\n", vCoplanar_x, vCoplanar_y, vCoplanar_z ) );
|
||||
|
||||
if ( trace_plane_normal_z == 0 ) {
|
||||
vCoplanar = '0 0 1';
|
||||
}
|
||||
|
@ -84,13 +90,17 @@ void Effect_Spraypaint( void ) {
|
|||
#else
|
||||
float Effect_Spraypaint( void ) {
|
||||
makevectors( self.angles );
|
||||
// Temporary string, will getinfo from player later
|
||||
adddecal( self.classname, self.origin, v_up / 32, v_forward / 32, '1 0 0', 1.0f );
|
||||
adddecal( self.classname, self.origin, v_up / 32, v_forward / 32, self.color, 1.0f );
|
||||
addentity( self );
|
||||
return PREDRAW_NEXT;
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifdef SSQC
|
||||
void CSEv_EffectSpray_sfff( string sLogo, float fR, float fG, float fB ) {
|
||||
Effect_Spraypaint( sLogo, fR, fG, fB );
|
||||
}
|
||||
#endif
|
||||
|
||||
void Effect_CreateExplosion( vector vPos ) {
|
||||
#ifdef SSQC
|
||||
|
|
Binary file not shown.
BIN
freecs/menu.dat
BIN
freecs/menu.dat
Binary file not shown.
BIN
freecs/progs.dat
BIN
freecs/progs.dat
Binary file not shown.
Loading…
Reference in a new issue