mirror of
https://github.com/UberGames/rpgxEF.git
synced 2025-02-22 12:01:18 +00:00
Merge remote-tracking branch 'origin/list' into locations
This commit is contained in:
commit
063f85b6a7
4 changed files with 233 additions and 97 deletions
|
@ -689,7 +689,7 @@ SetTeam
|
|||
qboolean SetTeam( gentity_t *ent, char *s ) {
|
||||
int team, oldTeam;
|
||||
gclient_t *client;
|
||||
int clientNum, clNum;
|
||||
int clientNum;
|
||||
spectatorState_t specState;
|
||||
int specClient;
|
||||
int isBot;
|
||||
|
@ -708,7 +708,6 @@ qboolean SetTeam( gentity_t *ent, char *s ) {
|
|||
|
||||
specState = SPECTATOR_NOT;
|
||||
|
||||
clNum = client->ps.clientNum;
|
||||
sess = &client->sess;
|
||||
|
||||
if ( g_gametype.integer >= GT_TEAM && !isBot )
|
||||
|
@ -6349,9 +6348,10 @@ Cmd_getEntByTarget_f
|
|||
*/
|
||||
static void Cmd_getEntByTarget_f(gentity_t *ent) {
|
||||
char arg[MAX_STRING_TOKENS];
|
||||
int cnt;
|
||||
int i;
|
||||
gentity_t *entities[MAX_GENTITIES];
|
||||
struct list entities;
|
||||
list_iter_p iter;
|
||||
container_p c;
|
||||
gentity_t* t;
|
||||
|
||||
#ifndef SQL
|
||||
if ( !IsAdmin( ent ) ) {
|
||||
|
@ -6367,12 +6367,25 @@ static void Cmd_getEntByTarget_f(gentity_t *ent) {
|
|||
|
||||
trap_Argv(1, arg, sizeof(arg));
|
||||
|
||||
cnt = G_GetEntityByTarget(arg, entities);
|
||||
list_init(&entities, free);
|
||||
G_GetEntityByTarget(arg, &entities);
|
||||
|
||||
for(i = 0; i < cnt; i++) {
|
||||
if(!entities[i] || !entities[i]->classname) continue;
|
||||
G_PrintfClient(ent, "ENT %i: %s\n\"", entities[i]->s.number, entities[i]->classname);
|
||||
iter = list_iterator(&entities, LIST_FRONT);
|
||||
for(c = list_next(iter); c != NULL; c = list_next(iter)) {
|
||||
t = c->data;
|
||||
|
||||
if(t == NULL) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if(!t->classname) {
|
||||
continue;
|
||||
}
|
||||
|
||||
G_PrintfClient(ent, "ENT %i: %s\n\"", t->s.number, t->classname);
|
||||
}
|
||||
destroy_iterator(iter);
|
||||
list_clear(&entities);
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -7362,8 +7375,11 @@ static void Cmd_findEntitiesInRadius(gentity_t *ent) {
|
|||
char *classname = NULL;
|
||||
qboolean all = qfalse;
|
||||
qboolean takeDamage = qfalse;
|
||||
gentity_t *entities[MAX_GENTITIES];
|
||||
int numEntities;
|
||||
struct list entities;
|
||||
struct list ignore;
|
||||
list_iter_p iter;
|
||||
container_p c;
|
||||
gentity_t* t;
|
||||
|
||||
#ifndef SQL
|
||||
if ( !IsAdmin( ent ) ) {
|
||||
|
@ -7393,16 +7409,30 @@ static void Cmd_findEntitiesInRadius(gentity_t *ent) {
|
|||
trap_Argv(3, arg, sizeof(arg));
|
||||
takeDamage = (qboolean)atoi(arg);
|
||||
|
||||
numEntities = G_RadiusList(ent->r.currentOrigin, radius, ent, takeDamage, entities);
|
||||
list_init(&entities, free);
|
||||
list_init(&ignore, free);
|
||||
list_append_ptr(&ignore, ent, LT_DATA);
|
||||
G_RadiusList(ent->r.currentOrigin, radius, &ignore, takeDamage, &entities);
|
||||
list_clear(&ignore);
|
||||
|
||||
for(radius = 0; radius < numEntities; radius++) {
|
||||
if(all)
|
||||
G_PrintfClient(ent, "Entity: %i, Classname: %s", entities[radius]-g_entities, entities[radius]->classname);
|
||||
else {
|
||||
if(!Q_stricmpn(entities[radius]->classname, classname, strlen(classname)))
|
||||
G_PrintfClient(ent, "Entity: %i Classname: %s", entities[radius]-g_entities, classname);
|
||||
iter = list_iterator(&entities, LIST_FRONT);
|
||||
for(c = list_next(iter); c != NULL; c = list_next(iter)) {
|
||||
t = c->data;
|
||||
|
||||
if(t == NULL) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if(all) {
|
||||
G_PrintfClient(ent, "Entity: %i, Classname: %s", t-g_entities, t->classname);
|
||||
} else {
|
||||
if(!Q_stricmpn(t->classname, classname, strlen(classname))) {
|
||||
G_PrintfClient(ent, "Entity: %i Classname: %s", t-g_entities, classname);
|
||||
}
|
||||
}
|
||||
}
|
||||
destroy_iterator(iter);
|
||||
list_clear(&entities);
|
||||
}
|
||||
|
||||
// CCAM
|
||||
|
|
|
@ -847,7 +847,18 @@ void G_AddPredictableEvent( gentity_t* ent, int event, int eventParm );
|
|||
void G_AddEvent( gentity_t* ent, int event, int eventParm );
|
||||
void G_SetOrigin( gentity_t* ent, vec3_t origin );
|
||||
void G_SetAngles( gentity_t* ent, vec3_t anlges ); //RPG-X | GSIO01 | 24.08.2009
|
||||
int G_RadiusList ( vec3_t origin, float radius, gentity_t* ignore, qboolean takeDamage, gentity_t* ent_list[MAX_GENTITIES]);
|
||||
|
||||
/**
|
||||
* Get a list of entities in a specified radous around an origin.
|
||||
*
|
||||
* \param origin Origin to search around.
|
||||
* \param radius Radius to serach in.
|
||||
* \param ignore List of entities to ignore.
|
||||
* \param takeDamage Only return entities matching this value for takeDamage.
|
||||
* \param ent_list List to store found entities in.
|
||||
* \return Count of entities found.
|
||||
*/
|
||||
int G_RadiusList ( vec3_t origin, float radius, list_p ignore, qboolean takeDamage, list_p ent_list);
|
||||
|
||||
/**
|
||||
* Get a list of specified entity classes in a specified radius.
|
||||
|
@ -863,13 +874,33 @@ int G_RadiusList ( vec3_t origin, float radius, gentity_t* ignore, qboolean ta
|
|||
* \return count of found entities
|
||||
*/
|
||||
int G_RadiusListOfTypes(list_p classnames, vec3_t origin, float radius, list_p ignore, list_p ent_list);
|
||||
gentity_t* G_GetNearestEnt(char* classname, vec3_t origin, float radius, gentity_t* ignore, qboolean takeDamage);
|
||||
gentity_t* G_GetNearestPlayer(vec3_t origin, float radius, gentity_t* ignore );
|
||||
|
||||
/**
|
||||
* Get the neares entity to an origin.
|
||||
*
|
||||
* \param classname Filter by this classname.
|
||||
* \param origin Origin to search around.
|
||||
* \param radius Radius to search in.
|
||||
* \param ignore List of entities to ignore.
|
||||
* \param takeDamage Only return entities that match this value for takeDamage.
|
||||
* \return Nearest entity found.
|
||||
*/
|
||||
gentity_t* G_GetNearestEnt(char* classname, vec3_t origin, float radius, list_p ignore, qboolean takeDamage);
|
||||
|
||||
/**
|
||||
* Get the nearest player orund an origin.
|
||||
*
|
||||
* \param origin Origin to search around.
|
||||
* \param radius Radius to search in.
|
||||
* \param ignore List of entities to ignore.
|
||||
* \return Nearest player.
|
||||
*/
|
||||
gentity_t* G_GetNearestPlayer(vec3_t origin, float radius, list_p ignore );
|
||||
|
||||
// GSIO - additional util funcs to make life easier with spawnfile
|
||||
int G_GetEntityByTargetname(const char* targetname, gentity_t* entities[MAX_GENTITIES]);
|
||||
int G_GetEntityByTarget(const char* target, gentity_t* entities[MAX_GENTITIES]);
|
||||
int G_GetEntityByBmodel(char* bmodel, gentity_t* entities[MAX_GENTITIES]);
|
||||
int G_GetEntityByTargetname(const char* targetname, list_p entities);
|
||||
int G_GetEntityByTarget(const char* target, list_p entities);
|
||||
int G_GetEntityByBmodel(char* bmodel,list_p entities);
|
||||
|
||||
/* shader remapping */
|
||||
void AddRemap(const char* oldShader, const char* newShader, float timeOffset);
|
||||
|
|
|
@ -537,9 +537,12 @@ void turret_base_think (gentity_t *self)
|
|||
|
||||
if ( !self->enemy )
|
||||
{/* Find one */
|
||||
gentity_t *entity_list[MAX_GENTITIES], *target;
|
||||
int count, i;
|
||||
gentity_t *target;
|
||||
float bestDist = self->random * self->random;
|
||||
struct list entity_list;
|
||||
struct list ignore;
|
||||
list_iter_p iter;
|
||||
container_p c;
|
||||
|
||||
if ( self->last_move_time > level.time )
|
||||
{/* We're active and alert, had an enemy in the last 5 secs */
|
||||
|
@ -550,13 +553,25 @@ void turret_base_think (gentity_t *self)
|
|||
}
|
||||
}
|
||||
|
||||
if(lastEnemy && lastEnemy->lastEnemy)
|
||||
count = G_RadiusList( self->r.currentOrigin, self->random, lastEnemy->lastEnemy, qtrue, entity_list );
|
||||
else
|
||||
count = G_RadiusList( self->r.currentOrigin, self->random, NULL, qtrue, entity_list );
|
||||
for ( i = 0; i < count; i++ )
|
||||
{
|
||||
target = entity_list[i];
|
||||
list_init(&entity_list, free);
|
||||
list_init(&ignore, free);
|
||||
|
||||
if(lastEnemy && lastEnemy->lastEnemy) {
|
||||
list_append_ptr(&ignore, lastEnemy->lastEnemy, LT_DATA);
|
||||
G_RadiusList( self->r.currentOrigin, self->random, &ignore, qtrue, &entity_list );
|
||||
} else {
|
||||
G_RadiusList( self->r.currentOrigin, self->random, NULL, qtrue, &entity_list );
|
||||
}
|
||||
list_clear(&ignore);
|
||||
|
||||
iter = list_iterator(&entity_list, LIST_FRONT);
|
||||
for(c = list_next(iter); c != NULL; c = list_next(iter)) {
|
||||
target = c->data;
|
||||
|
||||
if(target == NULL) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if ( target == self )
|
||||
{
|
||||
continue;
|
||||
|
@ -600,6 +615,8 @@ void turret_base_think (gentity_t *self)
|
|||
}
|
||||
}
|
||||
}
|
||||
destroy_iterator(iter);
|
||||
list_clear(&entity_list);
|
||||
}
|
||||
|
||||
if ( self->enemy )
|
||||
|
|
|
@ -1022,16 +1022,23 @@ void G_SetAngles(gentity_t *ent, vec3_t angles) {
|
|||
*
|
||||
* @return the number of found entities in the list
|
||||
*/
|
||||
int G_RadiusList ( vec3_t origin, float radius, gentity_t *ignore, qboolean takeDamage, gentity_t *ent_list[MAX_GENTITIES])
|
||||
int G_RadiusList ( vec3_t origin, float radius, list_p ignore, qboolean takeDamage, list_p ent_list)
|
||||
{
|
||||
float dist;
|
||||
gentity_t *ent;
|
||||
gentity_t* ent;
|
||||
gentity_t* t = NULL;
|
||||
int entityList[MAX_GENTITIES];
|
||||
int numListedEntities;
|
||||
int i, e;
|
||||
vec3_t mins, maxs;
|
||||
vec3_t v;
|
||||
int i, e;
|
||||
int ent_count = 0;
|
||||
list_iter_p iter;
|
||||
container_p c;
|
||||
qboolean n = qfalse;
|
||||
|
||||
if(ent_list == NULL) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
if ( radius < 1 )
|
||||
{
|
||||
|
@ -1048,10 +1055,33 @@ int G_RadiusList ( vec3_t origin, float radius, gentity_t *ignore, qboolean take
|
|||
|
||||
for ( e = 0 ; e < numListedEntities ; e++ )
|
||||
{
|
||||
n = qfalse;
|
||||
ent = &g_entities[entityList[e]];
|
||||
|
||||
if ((ent == ignore) || !(ent->inuse) || ent->takedamage != takeDamage)
|
||||
if (!(ent->inuse) || ent->takedamage != takeDamage) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if(ignore != NULL) {
|
||||
iter = list_iterator(ignore, LIST_FRONT);
|
||||
for(c = list_next(iter); c != NULL; c = list_next(iter)) {
|
||||
t = c->data;
|
||||
|
||||
if(t == NULL) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if(t == ent) {
|
||||
n = qtrue;
|
||||
break;
|
||||
}
|
||||
}
|
||||
destroy_iterator(iter);
|
||||
}
|
||||
|
||||
if(n == qtrue) {
|
||||
continue;
|
||||
}
|
||||
|
||||
/* find the distance from the edge of the bounding box */
|
||||
for ( i = 0 ; i < 3 ; i++ )
|
||||
|
@ -1075,18 +1105,16 @@ int G_RadiusList ( vec3_t origin, float radius, gentity_t *ignore, qboolean take
|
|||
}
|
||||
|
||||
/* ok, we are within the radius, add us to the incoming list */
|
||||
ent_list[ent_count] = ent;
|
||||
ent_count++;
|
||||
|
||||
list_append_ptr(ent_list, ent, LT_DATA);
|
||||
}
|
||||
/* we are done, return how many we found */
|
||||
return(ent_count);
|
||||
return ent_list->length;
|
||||
}
|
||||
|
||||
int G_RadiusListOfTypes(list_p classnames, vec3_t origin, float radius, list_p ignore, list_p ent_list) {
|
||||
float dist;
|
||||
gentity_t *ent;
|
||||
gentity_t *t;
|
||||
gentity_t *t = NULL;
|
||||
int entityList[MAX_GENTITIES];
|
||||
int numListedEntities;
|
||||
vec3_t mins, maxs;
|
||||
|
@ -1098,7 +1126,7 @@ int G_RadiusListOfTypes(list_p classnames, vec3_t origin, float radius, list_p i
|
|||
qboolean n = qfalse;
|
||||
|
||||
if(ent_list == NULL) {
|
||||
ent_list = create_list();
|
||||
return 0;
|
||||
}
|
||||
|
||||
if(classnames == NULL || classnames->length == 0) {
|
||||
|
@ -1120,6 +1148,7 @@ int G_RadiusListOfTypes(list_p classnames, vec3_t origin, float radius, list_p i
|
|||
|
||||
for ( e = 0 ; e < numListedEntities ; e++ )
|
||||
{
|
||||
n = qfalse;
|
||||
ent = &g_entities[entityList[e]];
|
||||
|
||||
if(!(ent->inuse)) {
|
||||
|
@ -1203,46 +1232,56 @@ int G_RadiusListOfTypes(list_p classnames, vec3_t origin, float radius, list_p i
|
|||
*
|
||||
* @return the nearest entity
|
||||
*/
|
||||
gentity_t *G_GetNearestEnt(char *classname, vec3_t origin, float radius, gentity_t *ignore, qboolean takeDamage) {
|
||||
gentity_t *entList[MAX_GENTITIES], *nearest = NULL;
|
||||
int count, i;
|
||||
gentity_t *G_GetNearestEnt(char *classname, vec3_t origin, float radius, list_p ignore, qboolean takeDamage) {
|
||||
gentity_t* nearest = NULL;
|
||||
gentity_t* t = NULL;
|
||||
float distance, minDist;
|
||||
vec3_t dist;
|
||||
struct list entList;
|
||||
list_iter_p iter;
|
||||
container_p c;
|
||||
|
||||
if(!radius) { /* we don't care how far it is away */
|
||||
radius = 9999999;
|
||||
}
|
||||
|
||||
minDist = radius;
|
||||
|
||||
count = G_RadiusList(origin, radius, ignore, takeDamage, entList);
|
||||
list_init(&entList, free);
|
||||
G_RadiusList(origin, radius, ignore, takeDamage, &entList);
|
||||
|
||||
for(i = 0; i < count; i++) {
|
||||
if(entList[i] != ignore) {
|
||||
if(entList[i]->s.origin[0] || entList[i]->s.origin[1] || entList[i]->s.origin[2]) {
|
||||
VectorSubtract(origin, entList[i]->s.origin, dist);
|
||||
} else if(entList[i]->r.currentOrigin[0] || entList[i]->r.currentOrigin[1] || entList[i]->r.currentOrigin[2]) {
|
||||
VectorSubtract(origin, entList[i]->r.currentOrigin, dist);
|
||||
} else if(entList[i]->s.pos.trBase[0] || entList[i]->s.pos.trBase[1] || entList[i]->s.pos.trBase[2]) {
|
||||
VectorSubtract(origin, entList[i]->s.pos.trBase, dist);
|
||||
} else { /* wow none of above ... well then assume it's origin is 0 0 0*/
|
||||
VectorCopy(origin, dist);
|
||||
}
|
||||
distance = VectorLength(dist);
|
||||
if(distance < 0) {
|
||||
distance *= -1;
|
||||
}
|
||||
if(distance < minDist) {
|
||||
if(classname && !Q_stricmp(classname, entList[i]->classname)) {
|
||||
minDist = distance;
|
||||
nearest = entList[i];
|
||||
} else if(!classname) {
|
||||
minDist = distance;
|
||||
nearest = entList[i];
|
||||
}
|
||||
iter = list_iterator(&entList, LIST_FRONT);
|
||||
for(c = list_next(iter); c != NULL; c = list_next(iter)) {
|
||||
t = c->data;
|
||||
|
||||
if(t == NULL) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if(t->s.origin[0] || t->s.origin[1] || t->s.origin[2]) {
|
||||
VectorSubtract(origin, t->s.origin, dist);
|
||||
} else if(t->r.currentOrigin[0] || t->r.currentOrigin[1] || t->r.currentOrigin[2]) {
|
||||
VectorSubtract(origin, t->r.currentOrigin, dist);
|
||||
} else if(t->s.pos.trBase[0] || t->s.pos.trBase[1] || t->s.pos.trBase[2]) {
|
||||
VectorSubtract(origin, t->s.pos.trBase, dist);
|
||||
} else { /* wow none of above ... well then assume it's origin is 0 0 0*/
|
||||
VectorCopy(origin, dist);
|
||||
}
|
||||
distance = VectorLength(dist);
|
||||
if(distance < 0) {
|
||||
distance *= -1;
|
||||
}
|
||||
if(distance < minDist) {
|
||||
if(classname && !Q_stricmp(classname, t->classname)) {
|
||||
minDist = distance;
|
||||
nearest = t;
|
||||
} else if(!classname) {
|
||||
minDist = distance;
|
||||
nearest = t;
|
||||
}
|
||||
}
|
||||
}
|
||||
destroy_iterator(iter);
|
||||
list_clear(&entList);
|
||||
|
||||
return nearest;
|
||||
}
|
||||
|
@ -1258,31 +1297,44 @@ gentity_t *G_GetNearestEnt(char *classname, vec3_t origin, float radius, gentity
|
|||
*
|
||||
* @return the nearest player
|
||||
*/
|
||||
gentity_t *G_GetNearestPlayer(vec3_t origin, float radius, gentity_t *ignore ) {
|
||||
gentity_t *entList[MAX_GENTITIES], *nearest = NULL;
|
||||
int i;
|
||||
gentity_t *G_GetNearestPlayer(vec3_t origin, float radius, list_p ignore ) {
|
||||
gentity_t* nearest = NULL;
|
||||
gentity_t* t;
|
||||
float distance, minDist;
|
||||
vec3_t dist;
|
||||
struct list entList;
|
||||
list_iter_p iter;
|
||||
container_p c;
|
||||
|
||||
if(!radius)
|
||||
if(!radius) {
|
||||
radius = 999999;
|
||||
|
||||
}
|
||||
minDist = radius;
|
||||
|
||||
G_RadiusList(origin, radius, ignore, qtrue, entList);
|
||||
list_init(&entList, free);
|
||||
G_RadiusList(origin, radius, ignore, qtrue, &entList);
|
||||
|
||||
for(i = 0; i < MAX_CLIENTS; i++) {
|
||||
if(entList[i]->client) {
|
||||
VectorSubtract(origin, entList[i]->r.currentOrigin, dist);
|
||||
iter = list_iterator(&entList, LIST_FRONT);
|
||||
for(c = list_next(iter); c != NULL; c = list_next(iter)) {
|
||||
t = c->data;
|
||||
|
||||
if(t == NULL) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if(t->client) {
|
||||
VectorSubtract(origin, t->r.currentOrigin, dist);
|
||||
distance = VectorLength(dist);
|
||||
if(distance < 0)
|
||||
distance *= -1;
|
||||
if(distance < minDist) {
|
||||
minDist = distance;
|
||||
nearest = entList[i];
|
||||
nearest = t;
|
||||
}
|
||||
}
|
||||
}
|
||||
destroy_iterator(iter);
|
||||
list_clear(&entList);
|
||||
|
||||
return nearest;
|
||||
}
|
||||
|
@ -1298,21 +1350,23 @@ gentity_t *G_GetNearestPlayer(vec3_t origin, float radius, gentity_t *ignore ) {
|
|||
*
|
||||
* @return number of entities found
|
||||
*/
|
||||
int G_GetEntityByTargetname(const char *targetname, gentity_t *entities[MAX_GENTITIES]) {
|
||||
int G_GetEntityByTargetname(const char *targetname, list_p entities) {
|
||||
int i;
|
||||
int cnt = 0;
|
||||
gentity_t *t;
|
||||
|
||||
if(entities == NULL) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
for(i = MAX_GENTITIES - 1; i > -1; i--) {
|
||||
if(!&g_entities[i]) continue;
|
||||
t = &g_entities[i];
|
||||
if(t->targetname && !Q_strncmp(t->targetname, targetname, strlen(targetname))) {
|
||||
entities[cnt] = t;
|
||||
cnt++;
|
||||
list_append_ptr(entities, t, LT_DATA);
|
||||
}
|
||||
}
|
||||
|
||||
return cnt;
|
||||
return entities->length;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1326,21 +1380,23 @@ int G_GetEntityByTargetname(const char *targetname, gentity_t *entities[MAX_GENT
|
|||
*
|
||||
* @return number of matches found
|
||||
*/
|
||||
int G_GetEntityByTarget(const char *target, gentity_t *entities[MAX_GENTITIES]) {
|
||||
int G_GetEntityByTarget(const char *target, list_p entities) {
|
||||
int i;
|
||||
int cnt = 0;
|
||||
gentity_t *t;
|
||||
|
||||
if(entities == NULL) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
for(i = MAX_GENTITIES - 1; i > -1; i--) {
|
||||
if(!&g_entities[i]) continue;
|
||||
t = &g_entities[i];
|
||||
if(t->target && !Q_strncmp(t->target, target, strlen(target))) {
|
||||
entities[cnt] = t;
|
||||
cnt++;
|
||||
list_append_ptr(entities, t, LT_DATA);
|
||||
}
|
||||
}
|
||||
|
||||
return cnt;
|
||||
return entities->length;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1355,21 +1411,23 @@ int G_GetEntityByTarget(const char *target, gentity_t *entities[MAX_GENTITIES])
|
|||
*
|
||||
* @return number of matches found
|
||||
*/
|
||||
int G_GetEntityByBmodel(char *bmodel, gentity_t *entities[MAX_GENTITIES]) {
|
||||
int G_GetEntityByBmodel(char *bmodel, list_p entities) {
|
||||
int i;
|
||||
int cnt = 0;
|
||||
gentity_t *t;
|
||||
|
||||
if(entities == NULL) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
for(i = MAX_GENTITIES - 1; i > -1; i--) {
|
||||
if(!&g_entities[i]) continue;
|
||||
t = &g_entities[i];
|
||||
if(t->model && !Q_strncmp(t->model, bmodel, strlen(bmodel))) {
|
||||
entities[cnt] = t;
|
||||
cnt++;
|
||||
list_append_ptr(entities, t, LT_DATA);
|
||||
}
|
||||
}
|
||||
|
||||
return cnt;
|
||||
return entities->length;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in a new issue