Engine/Core: Move precache_event() to core
This commit is contained in:
		@@ -2806,6 +2806,14 @@ static cell AMX_NATIVE_CALL precache_generic(AMX *amx, cell *params)
 | 
			
		||||
	return PRECACHE_GENERIC((char*)STRING(ALLOC_STRING(sptemp)));
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static cell AMX_NATIVE_CALL precache_event(AMX *amx, cell *params)
 | 
			
		||||
{
 | 
			
		||||
	int len;
 | 
			
		||||
	char *sptemp = format_amxstring(amx, params, 2, len);
 | 
			
		||||
 | 
			
		||||
	return PRECACHE_EVENT(params[1], (char*)STRING(ALLOC_STRING(sptemp)));
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static cell AMX_NATIVE_CALL random_float(AMX *amx, cell *params) /* 2 param */
 | 
			
		||||
{
 | 
			
		||||
	float one = amx_ctof(params[1]);
 | 
			
		||||
 
 | 
			
		||||
@@ -366,14 +366,6 @@ static cell AMX_NATIVE_CALL get_decal_index(AMX *amx, cell *params)
 | 
			
		||||
	return DECAL_INDEX(szDecal);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static cell AMX_NATIVE_CALL precache_event(AMX *amx, cell *params)
 | 
			
		||||
{
 | 
			
		||||
	int len;
 | 
			
		||||
	char *szEvent = MF_FormatAmxString(amx, params, 2, &len);
 | 
			
		||||
	return PRECACHE_EVENT(params[1], (char *)STRING(ALLOC_STRING(szEvent)));
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static cell AMX_NATIVE_CALL get_info_keybuffer(AMX *amx, cell *params)
 | 
			
		||||
{
 | 
			
		||||
	int iEnt = params[1];
 | 
			
		||||
@@ -1032,7 +1024,6 @@ AMX_NATIVE_INFO engine_Natives[] = {
 | 
			
		||||
	{"set_speak",			set_speak},
 | 
			
		||||
	{"get_speak",			get_speak},
 | 
			
		||||
 | 
			
		||||
	{"precache_event",		precache_event},
 | 
			
		||||
	{"playback_event",		playback_event},
 | 
			
		||||
 | 
			
		||||
	{"set_view",			set_view},
 | 
			
		||||
 
 | 
			
		||||
@@ -248,6 +248,25 @@ native precache_sound(const name[]);
 | 
			
		||||
 */
 | 
			
		||||
native precache_generic(const szFile[]);
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Precaches an event file.
 | 
			
		||||
 *
 | 
			
		||||
 * @note The event type should always be 1.
 | 
			
		||||
 * @note Contrary to the other precache_* natives, this can be used outside of
 | 
			
		||||
 *       the plugin_precache() forward, e.g. in plugin_init() or plugin_cfg().
 | 
			
		||||
 *       A bug in some clients makes this necessary, as plugin_precache() is
 | 
			
		||||
 *       called before the mod has precached its own, default event files. This
 | 
			
		||||
 *       can cause the event table to be misaligned on the client, leading to
 | 
			
		||||
 *       visual and audio bugs that are hard to diagnose.
 | 
			
		||||
 *
 | 
			
		||||
 * @param type  Event type
 | 
			
		||||
 * @param Name  Formatting rules, path to the event file
 | 
			
		||||
 * @param ...   Variable number of formatting parameters
 | 
			
		||||
 *
 | 
			
		||||
 * @return      Unique cache id of the event
 | 
			
		||||
 */
 | 
			
		||||
native precache_event(type, const Name[], any:...);
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Changes the map.
 | 
			
		||||
 *
 | 
			
		||||
 
 | 
			
		||||
@@ -151,25 +151,6 @@ native unregister_touch(registerid);
 | 
			
		||||
 */
 | 
			
		||||
native unregister_think(registerid);
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Precaches an event file.
 | 
			
		||||
 *
 | 
			
		||||
 * @note The event type should always be 1.
 | 
			
		||||
 * @note Contrary to the other precache_* natives, this can be used outside of
 | 
			
		||||
 *       the plugin_precache() forward, e.g. in plugin_init() or plugin_cfg().
 | 
			
		||||
 *       A bug in some clients makes this necessary, as plugin_precache() is
 | 
			
		||||
 *       called before the mod has precached its own, default event files. This
 | 
			
		||||
 *       can cause the event table to be misaligned on the client, leading to
 | 
			
		||||
 *       visual and audio bugs that are hard to diagnose.
 | 
			
		||||
 *
 | 
			
		||||
 * @param type  Event type
 | 
			
		||||
 * @param Name  Formatting rules, path to the event file
 | 
			
		||||
 * @param ...   Variable number of formatting parameters
 | 
			
		||||
 *
 | 
			
		||||
 * @return      Unique cache id of the event
 | 
			
		||||
 */
 | 
			
		||||
native precache_event(type, const Name[], any:...);
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Sets the engine module speak flags on a client.
 | 
			
		||||
 *
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user