diff --git a/Source/Client/Defs.h b/Source/Client/Defs.h index 15a8b2db..82ee639b 100755 --- a/Source/Client/Defs.h +++ b/Source/Client/Defs.h @@ -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 ); -} \ No newline at end of file +} diff --git a/Source/Client/Entities.c b/Source/Client/Entities.c index 7f5e5806..4b9be00f 100755 --- a/Source/Client/Entities.c +++ b/Source/Client/Entities.c @@ -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; } diff --git a/Source/Client/Event.c b/Source/Client/Event.c index 7711a0a1..f4cf85bd 100755 --- a/Source/Client/Event.c +++ b/Source/Client/Event.c @@ -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; } diff --git a/Source/Client/Init.c b/Source/Client/Init.c index d280a28e..6bd02b74 100755 --- a/Source/Client/Init.c +++ b/Source/Client/Init.c @@ -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(); diff --git a/Source/Menu/Defs.h b/Source/Menu/Defs.h index 51b47535..bbb7ec6d 100755 --- a/Source/Menu/Defs.h +++ b/Source/Menu/Defs.h @@ -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 ); \ No newline at end of file +void Menu_ResetClipArea( void ); diff --git a/Source/Menu/Init.c b/Source/Menu/Init.c index 27740504..283f1e24 100755 --- a/Source/Menu/Init.c +++ b/Source/Menu/Init.c @@ -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 ); } /* diff --git a/Source/Server/Input.c b/Source/Server/Input.c index a9dc360f..e32fc9da 100755 --- a/Source/Server/Input.c +++ b/Source/Server/Input.c @@ -75,9 +75,5 @@ void Input_Handle( void ) { Weapon_Release(); } - if ( self.impulse == 201 ) { - Effect_Spraypaint(); - } - self.impulse = 0; } diff --git a/Source/Shared/Effects.c b/Source/Shared/Effects.c index f92f3250..d52e5d22 100755 --- a/Source/Shared/Effects.c +++ b/Source/Shared/Effects.c @@ -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 diff --git a/freecs/csprogs.dat b/freecs/csprogs.dat index 357de998..e3582230 100755 Binary files a/freecs/csprogs.dat and b/freecs/csprogs.dat differ diff --git a/freecs/menu.dat b/freecs/menu.dat index 693e2ebf..a56d8c7e 100755 Binary files a/freecs/menu.dat and b/freecs/menu.dat differ diff --git a/freecs/progs.dat b/freecs/progs.dat index 908a0fed..a4b71240 100755 Binary files a/freecs/progs.dat and b/freecs/progs.dat differ