//--------------------------------------------------------------------------------- // Purpose: Setup the skins for auto download to client //--------------------------------------------------------------------------------- static void SetupActionModelsAutoDownloads(void) { INetworkStringTable *pDownloadablesTable = networkstringtable->FindTable("downloadables"); bool save = engine->LockNetworkStringTables(false); char res_string[256]; for (int i = 0; i < action_model_list_size; i++) { for (int j = 0; j < action_model_list[i].sound_list_size; j ++) { if (action_model_list[i].sound_list[j].auto_download != 1) continue; // Set up .res downloadables if (pDownloadablesTable) { snprintf(res_string, sizeof(res_string), "sound/%s", action_model_list[i].sound_list[j].sound_file); if (filesystem->FileExists(res_string)) { #ifdef GAME_ORANGE pDownloadablesTable->AddString(true, res_string, sizeof(res_string)); #else pDownloadablesTable->AddString(res_string, sizeof(res_string)); #endif } else { // MMsg("Sound file [%s] does not exist on server !!\n", res_string); } } } } engine->LockNetworkStringTables(save); }
//--------------------------------------------------------------------------------- // Purpose: Setup the skins for auto download to client //--------------------------------------------------------------------------------- static void SetupSkinsAutoDownloads(void) { if (mani_skins_auto_download.GetInt() == 0) return; INetworkStringTable *pDownloadablesTable = networkstringtable->FindTable("downloadables"); bool save = engine->LockNetworkStringTables(false); char res_string[256]; for (int i = 0; i < skin_list_size; i++) { for (int j = 0; j < skin_list[i].resource_list_size; j ++) { // Set up .res downloadables if (pDownloadablesTable) { snprintf(res_string, sizeof(res_string), "%s", skin_list[i].resource_list[j].resource); #ifdef GAME_ORANGE pDownloadablesTable->AddString(true, res_string, sizeof(res_string)); #else pDownloadablesTable->AddString(res_string, sizeof(res_string)); #endif } } } engine->LockNetworkStringTables(save); }
//--------------------------------------------------------------------------------- // Purpose: Load and pre-cache the quake style sounds //--------------------------------------------------------------------------------- static void SetupActionAutoDownloads(void) { if (mani_sounds_auto_download.GetInt() == 0) return; INetworkStringTable *pDownloadablesTable = networkstringtable->FindTable("downloadables"); bool save = engine->LockNetworkStringTables(false); char res_string[512]; for (int i = 0; i < MANI_MAX_ACTION_SOUNDS; i++) { if (action_sound_list[i].in_use) { // Set up .res downloadables if (pDownloadablesTable) { snprintf(res_string, sizeof(res_string), "sound/%s", action_sound_list[i].sound_file); #ifdef GAME_ORANGE pDownloadablesTable->AddString(true, res_string, sizeof(res_string)); #else pDownloadablesTable->AddString(res_string, sizeof(res_string)); #endif } } } engine->LockNetworkStringTables(save); }
//--------------------------------------------------------------------------------- // Purpose: Setup auto res of sound files //--------------------------------------------------------------------------------- static void SetupSoundAutoDownloads(void) { if (mani_sounds_auto_download.GetInt() == 0) return; INetworkStringTable *pDownloadablesTable = networkstringtable->FindTable("downloadables"); bool save = engine->LockNetworkStringTables(false); for (int i = 0; i < sound_list_size; i++) { // Set up .res downloadables if (pDownloadablesTable) { char res_string[512]; snprintf(res_string, sizeof(res_string), "sound/%s", sound_list[i].sound_name); #ifdef GAME_ORANGE pDownloadablesTable->AddString(true, res_string, sizeof(res_string)); #else pDownloadablesTable->AddString(res_string, sizeof(res_string)); #endif } } engine->LockNetworkStringTables(save); }
//--------------------------------------------------------------------------------- // Purpose: Add downloads to source engine //--------------------------------------------------------------------------------- void ManiDownloads::AddToDownloads(const char *filename) { INetworkStringTable *pDownloadablesTable = networkstringtable->FindTable("downloadables"); bool save = engine->LockNetworkStringTables(false); char res_string[512]; // Set up .res downloadables if (pDownloadablesTable) { snprintf(res_string, sizeof(res_string), "%s", filename); #ifdef GAME_ORANGE pDownloadablesTable->AddString(true, res_string, sizeof(res_string)); #else pDownloadablesTable->AddString(res_string, sizeof(res_string)); #endif } engine->LockNetworkStringTables(save); }
static int sourceop_adddownloadable(lua_State *L) { size_t filelen; const char *file = luaL_checklstring(L, 1, &filelen); // TODO: Optimize this to only load the table once INetworkStringTable *pDownloadablesTable = networkstringtable->FindTable("downloadables"); if(pDownloadablesTable) { pDownloadablesTable->AddString(true, file, filelen); } return 0; }
bool AddToDownloadables( const char *file ) { INetworkStringTable *pDownloadablesTable = networkstringtable->FindTable( "downloadables" ); // Actually, it would be desirable to add the last line to // ServerActivate and store the pointer, so each time you // add a download you dont have to find it again. if ( pDownloadablesTable ) { bool save = engine->LockNetworkStringTables( false ); int iRet = pDownloadablesTable->FindStringIndex( file ); if ( iRet == INVALID_STRING_INDEX ) { pDownloadablesTable->AddString( CBaseEntity::IsServer(), file, sizeof( file ) + 1 ); engine->LockNetworkStringTables( save ); } else { DevMsg( "AddDownload: Multiple download of \"%s\"", file ); } return true; } DevMsg("Table downloadables not found!\n"); return false; }