Player spray decals are local texture files that get uploaded to the server by the client and distributed to all the other clients in the game allowing them all to see your custom decal image.
I want to allow each player to have MORE THAN ONE custom spray image. I'm working with the Alien Swarm SDK code base. Alien Swarm Skeleton to be specific (http://code.google.com/p/sourcesdk-skeleton/).
Examining cdll_int.h shows the following typedef for player_info_s:
- Code: Select all
typedef struct player_info_s
{
DECLARE_BYTESWAP_DATADESC();
// network xuid
uint64 xuid;
// scoreboard information
char name[MAX_PLAYER_NAME_LENGTH];
// local server user ID, unique while server is running
int userID;
// global unique player identifer
char guid[SIGNED_GUID_LEN + 1];
// friends identification number
uint32 friendsID;
// friends name
char friendsName[MAX_PLAYER_NAME_LENGTH];
// true, if player is a bot controlled by game.dll
bool fakeplayer;
// true if player is the HLTV proxy
bool ishltv;
// true if player is the Replay proxy
bool isreplay;
// custom files CRC for this player
CRC32_t customFiles[MAX_CUSTOM_FILES];
// this counter increases each time the server downloaded a new file
unsigned char filesDownloaded;
} player_info_t;
What caught my eye was the CRC32_t array customFiles. The define for MAX_CUSTOM_FILES defaults to 4, and as far as I can tell 0 is the player's spray decal and 1 is some sort of custom "jingle" sound file.
The customFiles array of the player_info_t struct is used in many places, including in c_baseplayer.cpp as shown here:
- Code: Select all
void C_BasePlayer::PlayPlayerJingle()
{
if ( !cl_customsounds.GetBool() )
return;
// Find player sound for shooter
player_info_t info;
engine->GetPlayerInfo( entindex(), &info );
// Doesn't have a jingle sound
if ( !info.customFiles[1] )
return;
char soundhex[ 16 ];
Q_binarytohex( (byte *)&info.customFiles[1], sizeof( info.customFiles[1] ), soundhex, sizeof( soundhex ) );
// See if logo has been downloaded.
char fullsoundname[ 512 ];
Q_snprintf( fullsoundname, sizeof( fullsoundname ), "sound/temp/%s.wav", soundhex );
if ( !filesystem->FileExists( fullsoundname ) )
{
char custname[ 512 ];
Q_snprintf( custname, sizeof( custname ), "downloads/%s.dat", soundhex );
// it may have been downloaded but not copied under materials folder
if ( !filesystem->FileExists( custname ) )
return; // not downloaded yet
// copy from download folder to materials/temp folder
// this is done since material system can access only materials/*.vtf files
if ( !engine->CopyFile( custname, fullsoundname) )
return;
}
Q_snprintf( fullsoundname, sizeof( fullsoundname ), "temp/%s.wav", soundhex );
CLocalPlayerFilter filter;
EmitSound_t ep;
ep.m_nChannel = CHAN_VOICE;
ep.m_pSoundName = fullsoundname;
ep.m_flVolume = VOL_NORM;
ep.m_SoundLevel = SNDLVL_NORM;
C_BaseEntity::EmitSound( filter, GetSoundSourceIndex(), ep );
}
Doesn't seem to be very much info on these "Custom Files" for Alien Swarm, but it seems like they are allowing for a custom sound file to be used a lot like the custom spray decals.
If I could find the code where the customFiles array of the player_info_t gets populated, it should be easy to make the modifications I need.
Does anybody know where or when this happens?
