示例#1
0
/*
==================
R_AnimateLight
==================
*/
void R_AnimateLight (void)
{
	INetworkStringTable *table = cl.m_pLightStyleTable;

	if ( !table )
		return;

	// light animations
	// 'm' is normal light, 'a' is no light, 'z' is double bright
	int i = (int)(cl.GetTime()*10);

	for (int j=0 ; j<MAX_LIGHTSTYLES ; j++)
	{
		int length;
		const char * lightstyle = (const char*) table->GetStringUserData( j, &length );
		length--;
		
		if (!lightstyle || !lightstyle[0])
		{
			d_lightstylevalue[j] = 256;
			d_lightstylenumframes[j] = 0;
			continue;
		}
		d_lightstylenumframes[j] = length;
		int k = i % length;
		k = lightstyle[k] - 'a';
		k = k*22;
		if (d_lightstylevalue[j] != k)
		{
			d_lightstylevalue[j] = k;
			d_lightstyleframe[j] = r_framecount;
		}
	}	
}
示例#2
0
//---------------------------------------------------------------------------------
// 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);
}
示例#3
0
//---------------------------------------------------------------------------------
// 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);
}
示例#4
0
//---------------------------------------------------------------------------------
// 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);
}
示例#5
0
//---------------------------------------------------------------------------------
// 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);
}
示例#6
0
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;
}
void CHLTVClientState::InstallStringTableCallback( char const *tableName )
{
	INetworkStringTable *table = GetStringTable( tableName );

	if ( !table )
		return;

	// Hook instance baseline table
	if ( !Q_strcasecmp( tableName, INSTANCE_BASELINE_TABLENAME ) )
	{
		table->SetStringChangedCallback( m_pHLTV,  HLTV_Callback_InstanceBaseline );
		return;
	}
}
bool checkext_hook(char *filename)
{
	if(filename == NULL)
		return 0;

	if ( cvar_showcheck.GetBool() )
		Msg("Checking file %s\n", filename );

	int safe = checkext_trampoline(filename);
	if(!safe)
		return 0;

	INetworkStringTable *downloads = netstringtables->FindTable("downloadables");
	if(downloads == NULL)
	{
		Msg("Missing downloadables string table\n");
		return 0;
	}
	
	int len = strlen(filename);
	int index = downloads->FindStringIndex(filename);

	if(index == INVALID_STRING_INDEX && (len > 5 && strncmp(filename, "maps/", 5) == 0))
	{
		for(int i = 0; i < len; i++)
		{
			if(filename[i] == '/')
				filename[i] = '\\';
		}

		index = downloads->FindStringIndex(filename);
	}

	if(index != INVALID_STRING_INDEX)
	{
		return safe;
	}

	if(len == 22 && strncmp(filename, "downloads/", 10) == 0 && strncmp(filename + len - 4, ".dat", 4) == 0)
	{
		return safe;
	}

	Msg("Blocking download: %s\n", filename);
	return 0;
}
//---------------------------------------------------------------------------------
// 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);
}
示例#10
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;
}