imported jghg2 support

This commit is contained in:
David Anderson 2004-03-24 05:01:33 +00:00
parent f566ac2eb7
commit 8110271bdd
3 changed files with 201 additions and 1 deletions

View File

@ -59,6 +59,9 @@ native set_offset_float(id, offset, Float:value);
native set_offset_short(id, offset, value); native set_offset_short(id, offset, value);
native set_offset_char(id, offset, value); native set_offset_char(id, offset, value);
/* Get entity pointer into string pointer[]. If pointer/len is 0 pointer is returned as integer. */
native get_entity_pointer(index, pointer[] = 0, len = 0);
/* Precaches any file. */ /* Precaches any file. */
native precache_generic(szFile[]); native precache_generic(szFile[]);
/* Precaches an event. */ /* Precaches an event. */
@ -110,10 +113,13 @@ native create_entity(szClassname[]);
/* Finds an entity in the world, will return 0 if nothing is found */ /* Finds an entity in the world, will return 0 if nothing is found */
native find_ent_by_class(iIndex, szClass[]); native find_ent_by_class(iIndex, szClass[]);
native find_ent_by_owner(iIndex, szClass[], iOwner); //optionally you can set a jghg2 type
// 1: target, 2:targetname, 0:classname (default)
native find_ent_by_owner(iIndex, szClass[], iOwner, iJghgType=0);
native find_ent_by_target(iIndex, szClass[]); native find_ent_by_target(iIndex, szClass[]);
native find_ent_by_tname(iIndex, szClass[]); native find_ent_by_tname(iIndex, szClass[]);
native find_ent_by_model(iIndex, szClass[], szModel[]); native find_ent_by_model(iIndex, szClass[], szModel[]);
native find_ent_in_sphere(start_from_ent, Float:origin[3], Float:radius);
//this will CBaseEntity::Think() or something from the entity //this will CBaseEntity::Think() or something from the entity
native call_think(entity) native call_think(entity)
@ -200,4 +206,12 @@ forward client_kill(id);
forward client_PreThink(id); forward client_PreThink(id);
forward client_PostThink(id); forward client_PostThink(id);
//from jghg2
/* As above, but returns number of ents stored in entlist. Use to find a specific type of entity classname (specify in _lookforclassname) around a
* certain entity specified in aroundent. All matching ents are stored in entlist. Specify max amount of entities to find in maxents.
* If aroundent is 0 its origin is not used, but origin in 6th parameter. Ie, do not specify 6th parameter (origin) if you specified an entity
* in aroundent.
*/
native find_sphere_class(aroundent, _lookforclassname[], Float:radius, entlist[], maxents, Float:origin[3] = {0.0, 0.0, 0.0});
#include <engine_stocks> #include <engine_stocks>

View File

@ -309,6 +309,10 @@ enum {
#define EF_LIGHT 64 /* rocket flare glow sprite */ #define EF_LIGHT 64 /* rocket flare glow sprite */
#define EF_NODRAW 128 /* don't draw entity */ #define EF_NODRAW 128 /* don't draw entity */
#if defined _jghg_enums
#endinput
#endif
#define _jghg_enums
enum { enum {
// Edict // Edict
GL_trace_ent = 0, GL_trace_ent = 0,

182
plugins/include/jghg2.inc Executable file
View File

@ -0,0 +1,182 @@
// JGHG2 module
//This file is provided for backwards compatibility.
//It includes the engine and cstrike modules automatically.
//It is intended for AMX Mod X
#if defined INCLUDED_JGHG
#endinput
#endif
#define INCLUDED_JGHG
#include <engine>
#include <cstrike>
#if defined _jghg_enums
#endinput
#endif
#define _jghg_enums
// Global member variables
enum {
// Edict
GL_trace_ent = 0,
// Float
GL_coop,
GL_deathmatch,
GL_force_retouch,
GL_found_secrets,
GL_frametime,
GL_serverflags,
GL_teamplay,
GL_time,
GL_trace_allsolid,
GL_trace_fraction,
GL_trace_inopen,
GL_trace_inwater,
GL_trace_plane_dist,
GL_trace_startsolid,
// Int
GL_cdAudioTrack,
GL_maxClients,
GL_maxEntities,
GL_msg_entity,
GL_trace_flags,
GL_trace_hitgroup,
// String
GL_pStringBase,
GL_mapname,
GL_startspot,
// Vector
GL_trace_endpos,
GL_trace_plane_normal,
GL_v_forward,
GL_v_right,
GL_v_up,
GL_vecLandmarkOffset,
// Void (not supported)
GL_pSaveData
}
// jghg_categories
enum {
jghg2_classname = 0,
jghg2_target = 1,
jghg2_targetname = 2
}
stock jghg_find_ent_owner(start_from_ent, jghg_category, value[], owner_index)
{
find_ent_by_owner(start_from_ent, value[], owner_index, jghg_category)
}
stock find_ent_sphere(start_from_ent, Float:origin[3], Float:radius)
{
find_ent_in_sphere(start_from_ent, Float:origin[3], Float:radius)
}
stock get_hostage_id(hostage)
{
return cs_get_hostage_id(hostage)
}
stock get_owner(id)
{
return entity_get_edict(id, EV_ENT_owner)
}
stock get_pdata(entity, offset)
{
return get_offset_int(entity, offset)
}
stock Float:get_pdata_float(entity, offset)
{
return get_offset_float(entity, offset)
}
stock get_pdata_char(entity, offset)
{
return get_offset_char(entity, offset)
}
stock get_offset_short(entity, offset)
{
return get_offset_short(entity, offset)
}
stock set_pdata(entity, offset, value)
{
return set_offset(entity, offset, value)
}
stock set_pdata_float(entity, offset, Float:value)
{
return set_offset_float(entity, offset, value)
}
stock set_pdata_char(entity, offset, value)
{
return set_offset_char(entity, offset, value)
}
stock set_pdata_short(entity, offset, value)
{
return set_offset_short(entity, offset, value)
}
stock get_entity_pointer(index, pointer[] = 0, len = 0)
{
return set_offset_pointer(
}
stock is_ent_valid(id)
{
return is_valid_ent(id)
}
stock number_of_entities()
{
return entity_count()
}
stock use(used, user)
{
return force_use(user, used)
}
stock Float:globals_get_float(variable)
{
get_global_float(variable)
}
stock globals_get_int(variable)
{
get_global_int(variable)
}
stock globals_get_string(variable, string[], maxlen)
{
get_global_string(variable, string, maxlen)
}
stock globals_get_vector(variable, Float:vector[3])
{
get_global_vector(variable, vector)
}
stock globals_get_edict(variable)
{
get_global_edict(variable)
}
stock get_max_entities() {
return get_global_int(GL_maxEntities)
}
stock jghg2_set_size(index, Float:mins[3], Float:maxs[3])
{
return set_size(index, mins, maxs)
}
stock jghg2_think(index)
{
return call_think(index)
}
#endif // INCLUDED_JGHG