More updates and work on sound zones for global sounds ...

... not what I want it to be but I need a break.
This commit is contained in:
Walter Julius Hennecke 2013-07-21 15:24:57 +02:00
parent dfd8dea02e
commit 97f3cb7eba
14 changed files with 197 additions and 136 deletions

View file

@ -54,7 +54,7 @@ static void TryUse( gentity_t* ent )
target = &g_entities[trace.entityNum];
//Check for a use command
if ( target && target->use && Q_stricmp("func_usable", target->classname) == 0 )
if ( (target != NULL) && (target->use != NULL) && (ent->type == ENT_FUNC_USABLE) )
{//usable brush
if ( target->team && atoi( target->team ) != 0 )
{//usable has a team
@ -72,7 +72,7 @@ static void TryUse( gentity_t* ent )
#endif
return;
}
else if ( target && target->use && Q_stricmp("misc_ammo_station", target->classname) == 0 )
else if ( (target != NULL) && (target->use != NULL) && (ent->type == ENT_MISC_AMMOSTATION) )
{//ammo station
if ( sess->sessionTeam )
{

View file

@ -39,7 +39,7 @@ void breakable_die( gentity_t *self, gentity_t *inflictor, gentity_t *attacker,
eState->solid = 0;
eShared->contents = 0;
self->clipmask = 0;
if(((self->spawnflags & 256) != 0) && (strcmp(self->classname, "func_breakable") == 0)) {
if(((self->spawnflags & 256) != 0) && (self->type == ENT_FUNC_BREAKABLE)) {
eShared->svFlags |= SVF_NOCLIENT;
eState->eFlags |= EF_NODRAW;
}
@ -783,7 +783,7 @@ void target_repair_link(gentity_t *ent) {
ent->lastEnemy = target;
if(Q_stricmp(target->classname, "func_breakable") != 0) {
if(target->type != ENT_FUNC_BREAKABLE) {
DEVELOPER(G_Printf(S_COLOR_YELLOW "[Entity-Error] target_repair at %s with an invalid target entity %s\n", vtos(ent->s.origin), target->classname););
return;
}

View file

@ -62,7 +62,7 @@ void SP_info_player_deathmatch( gentity_t *ent ) {
ent->type = ENT_INFO_PLAYER_START;
if(strcmp(ent->classname, "info_player_deathmatch") != 0) {
ent->classname = G_NewString("info_player_deathmatch");
ent->classname = "info_player_deathmatch";
}
G_SpawnInt( "nobots", "0", &i);
@ -1443,7 +1443,7 @@ static void G_SendHoloData(int32_t clientNum) {
gentity_t *holoTent;
holoTent = G_Spawn();
holoTent->classname = G_NewString("holoTent");
holoTent->classname = "holoTent";
holoTent->target_ent = g_entities + clientNum;
@ -1475,7 +1475,7 @@ static void G_SendTransData(int32_t clientNum) {
gentity_t *transTent;
transTent = G_Spawn();
transTent->classname = G_NewString("transTent");
transTent->classname = "transTent";
transTent->target_ent = g_entities + clientNum;
@ -2756,7 +2756,41 @@ void G_Client_CalculateRanks( qboolean fromExit ) {
}
}
void G_Client_UpdateSoundZones() {
int32_t i = 0;
int32_t b = 0;
int32_t entlist[MAX_GENTITIES];
int32_t zones[MAX_CLIENTS];
int32_t count = 0;
char supdate[MAX_STRING_CHARS];
memset(&zones, 0, sizeof(zones));
memset(&supdate, 0, sizeof(supdate));
for( ; i < MAX_GENTITIES; i++) {
if((g_entities[i].type == ENT_TARGET_ZONE) && (g_entities[i].count == 3)) {
memset(&entlist, 0, sizeof(entlist));
count = trap_EntitiesInBox(g_entities[i].r.mins, g_entities[i].r.maxs, &entlist, MAX_GENTITIES);
for(b = 0; b < count; b++) {
if(g_entities[entlist[b]].client != NULL) {
zones[g_entities[entlist[b]].client->ps.clientNum] = g_entities[i].s.number;
}
}
}
}
for(i = 0; i < MAX_CLIENTS; i++) {
if(strlen(supdate) != 0) {
Com_sprintf(supdate, sizeof(supdate), "%s\\c%d\\%d", supdate, i, zones[i]);
} else {
Com_sprintf(supdate, sizeof(supdate), "cd%\\%d", i, zones[i]);
}
}
for(i = 0; i < MAX_GENTITIES; i++) {
if(g_entities[i].client != NULL) {
trap_SendServerCommand(i, va("slup %s", supdate));
}
}
}

View file

@ -3690,9 +3690,10 @@ static void Cmd_UseEnt_f ( gentity_t *ent ) {
//TiM: Hack. Well... since we can use usables anyway, I'ma gonna disable them here.
//Doing it this way can screw up maps bigtime. >.<
//RPG_Chambers may never be the same again.... :S
if ( ( targetEnt && targetEnt->use) ) {
if ( !Q_stricmp( targetEnt->classname, "func_usable" ) )
if ( ( (targetEnt != NULL) && (targetEnt->use != NULL) ) ) {
if ( targetEnt->type == ENT_FUNC_USABLE ) {
return;
}
targetEnt->use( targetEnt, ent, ent ); //Activate the Ent
}
@ -3733,7 +3734,7 @@ static void Cmd_EntList_f ( gentity_t *ent ) {
i < level.num_entities;
i++, mapEnt++) {
if ( ( !Q_stricmpn( mapEnt->classname, "fx_", 3) ) || ( !Q_stricmp( mapEnt->classname, "func_usable" ) && ent->targetname ) ) {
if ( (Q_stricmpn( mapEnt->classname, "fx_", 3) == 0) || ((mapEnt->type == ENT_FUNC_USABLE) && (ent->targetname != NULL)) ) {
if ( mapEnt->use ) {
memset( &entBuffer, 0, sizeof( entBuffer ) );
@ -3863,7 +3864,7 @@ static void Cmd_BeamToLoc_f( gentity_t *ent ) {
for ( i=0, locEnt=g_entities; i < level.num_entities; locEnt++, i++ )
{
if ( !Q_stricmp( locEnt->classname, "target_location" ) ) {
if (locEnt->type == ENT_TARGET_LOCATION) {
//if we have a health index (which will always be above 0 coz 0 is a default 'unknown' value)
if ( locEnt->health == locIndex && locEnt->health >= 1 && locIndex >= 1 ) {
break;
@ -3877,7 +3878,7 @@ static void Cmd_BeamToLoc_f( gentity_t *ent ) {
}
}
if ( !locEnt || Q_stricmp( locEnt->classname, "target_location" ) ) {
if ( (locEnt == NULL) || (locEnt->type != ENT_TARGET_LOCATION )) {
trap_SendServerCommand( ent-g_entities, va("chat \"Invalid Beam Entity.\n\" " ) );
return;
}
@ -5083,7 +5084,7 @@ static void Cmd_Turbolift_f( gentity_t* ent )
continue;
//found our ent!
if ( !Q_stricmp( lift->classname, "target_turbolift" ) )
if ( lift->type == ENT_TARGET_TURBOLIFT )
{
break;
}
@ -5379,9 +5380,9 @@ static void Cmd_lockDoor_f(gentity_t *ent) {
//Doing it this way can screw up maps bigtime. >.<
//RPG_Chambers may never be the same again.... :S
if ( ( targetEnt ) ) {
if ( Q_stricmp( targetEnt->classname, "func_door" ) ) {
if ( targetEnt->type != ENT_FUNC_DOOR ) {
//GSIO01 not a func_door?? well then check wheter its a rotating door
if( Q_stricmp(targetEnt->classname, "func_door_rotating") ) {
if( targetEnt->type != ENT_FUNC_DOOR_ROTATING ) {
trap_SendServerCommand( ent-g_entities, va( " print \"Entity %i isn't a door.\n\" ", index ) );
return;
}
@ -5498,10 +5499,11 @@ static void Cmd_unlockAll_f(gentity_t *ent) {
#endif
for(i = g_maxclients.integer; i < MAX_GENTITIES ; i++) {
if(Q_stricmp(g_entities[i].classname, "func_door") == 0 && (g_entities[i].flags & FL_LOCKED))
if((g_entities[i].type == ENT_FUNC_DOOR) && ((g_entities[i].flags & FL_LOCKED) != 0)) {
g_entities[i].flags ^= FL_LOCKED;
else if(Q_stricmp(g_entities[i].classname, "func_door_rotating") == 0 && (g_entities[i].flags & FL_LOCKED))
} else if((g_entities[i].type == ENT_FUNC_DOOR_ROTATING) && ((g_entities[i].flags & FL_LOCKED) != 0)) {
g_entities[i].flags ^= FL_LOCKED;
}
}
G_PrintfClient(ent, "All doors unlocked.\n");
}
@ -5551,10 +5553,11 @@ static void Cmd_lockAll_f(gentity_t *ent) {
#endif
for(i = g_maxclients.integer; i < MAX_GENTITIES; i++) {
if(Q_stricmp(g_entities[i].classname, "func_door") == 0 && !(g_entities[i].flags & FL_LOCKED))
if((g_entities[i].type == ENT_FUNC_DOOR) && ((g_entities[i].flags & FL_LOCKED) == 0)) {
g_entities[i].flags ^= FL_LOCKED;
else if(Q_stricmp(g_entities[i].classname, "func_door_rotating") == 0 && !(g_entities[i].flags & FL_LOCKED))
} else if((g_entities[i].type == ENT_FUNC_DOOR_ROTATING) && !(g_entities[i].flags & FL_LOCKED)) {
g_entities[i].flags ^= FL_LOCKED;
}
}
G_PrintfClient(ent, "All doors locked.\n");
}
@ -6181,10 +6184,11 @@ static void Cmd_listSPs(gentity_t *ent) {
G_Printf("Spawnpoint list: \n");
for(i = 0; i < MAX_GENTITIES; i++) {
if(!Q_stricmp(g_entities[i].classname, "info_player_start"))
if(g_entities[i].type == ENT_INFO_PLAYER_START) {
G_Printf("Spawnpoint type: info_player_start Origin: %s\n", vtos(ent->s.origin));
if(!Q_stricmp(g_entities[i].classname, "info_player_deathmatch"))
} else if(Q_stricmp(g_entities[i].classname, "info_player_deathmatch") == 0) {
G_Printf("Spawnpoint type: info_player_deathmatch Origin: %s\n", vtos(ent->s.origin));
}
}
}
@ -6353,7 +6357,7 @@ static void Cmd_getEntByTarget_f(gentity_t *ent) {
continue;
}
if(!t->classname) {
if(t->classname == NULL) {
continue;
}
@ -6559,7 +6563,7 @@ static void Cmd_spawnTentity_f(gentity_t *ent) {
//check wether this is a valid entity
if(!Q_stricmpn(arg, "trigger_", 8)) {
if(!Q_stricmp(arg, "trigger_teleport")) {
newEnt->classname = G_NewString("trigger_teleport");
newEnt->classname = "trigger_teleport";
if(numArgs < 5) {
G_FreeEntity(newEnt);
trap_SendServerCommand(clientNum, "print \"Insufficent number of arguments for trigger_teleport!\n\"");
@ -6598,7 +6602,7 @@ static void Cmd_spawnTentity_f(gentity_t *ent) {
}
G_CallSpawn(newEnt);
}else if(!Q_stricmp(arg, "trigger_once")) { //actually trigger_multiple with wait of -1
newEnt->classname = G_NewString("trigger_multiple");
newEnt->classname = "trigger_multiple";
if(numArgs < 5) {
G_FreeEntity(newEnt);
trap_SendServerCommand(clientNum, "print \"Insufficent number of argmuments for trigger_once!\n\"");
@ -6626,7 +6630,7 @@ static void Cmd_spawnTentity_f(gentity_t *ent) {
G_CallSpawn(newEnt);
newEnt->wait = -1;
} else if(!Q_stricmp(arg, "trigger_multiple")) {
newEnt->classname = G_NewString("trigger_multiple");
newEnt->classname = "trigger_multiple";
if(numArgs < 6) {
G_FreeEntity(newEnt);
trap_SendServerCommand(clientNum, "print \"Insufficent number of argmuments for trigger_multple!\n\"");
@ -6656,7 +6660,7 @@ static void Cmd_spawnTentity_f(gentity_t *ent) {
newEnt->wait = atof(arg);
} else if(!Q_stricmp(arg, "trigger_hurt")) {
//newEnt = G_Spawn();
newEnt->classname = G_NewString("trigger_hurt");
newEnt->classname = "trigger_hurt";
if(numArgs < 4) {
G_FreeEntity(newEnt);
trap_SendServerCommand(clientNum, "print \"Insufficent number of arguments for trigger_hurt!\n\"");
@ -6690,7 +6694,7 @@ static void Cmd_spawnTentity_f(gentity_t *ent) {
} else if (!Q_stricmpn(arg, "fx_", 3)) {
if(!Q_stricmp(arg, "fx_spark")) {
//newEnt = G_Spawn();
newEnt->classname = G_NewString("fx_spark");
newEnt->classname = "fx_spark";
if(numArgs < 3) {
G_FreeEntity(ent);
trap_SendServerCommand(clientNum, "print \"Insufficent number of arguments for fx_spark!\n\"");
@ -6711,7 +6715,7 @@ static void Cmd_spawnTentity_f(gentity_t *ent) {
trap_Argv(2, arg, sizeof(arg));
newEnt->wait = atof(arg);
} else if(!Q_stricmp(arg, "fx_surface_explosion")) {
newEnt->classname = G_NewString("fx_surface_explosion");
newEnt->classname = "fx_surface_explosion";
if(numArgs < 2) {
G_FreeEntity(newEnt);
trap_SendServerCommand(clientNum, "print \"Insufficent number of arguments for fx_surface_explosion!\n\"");
@ -6742,7 +6746,7 @@ static void Cmd_spawnTentity_f(gentity_t *ent) {
}
G_CallSpawn(newEnt);
} else if(!Q_stricmp(arg, "fx_blow_chunks")) {
newEnt->classname = G_NewString("fx_blow_chunks");
newEnt->classname = "fx_blow_chunks";
if(numArgs < 3) {
G_FreeEntity(newEnt);
trap_SendServerCommand(clientNum, "print \"Insufficent number of arguments for fx_blow_chunks!\n\"");
@ -6763,7 +6767,7 @@ static void Cmd_spawnTentity_f(gentity_t *ent) {
}
G_CallSpawn(newEnt);
} else if(!Q_stricmp(arg, "fx_electrical_explosion")) {
newEnt->classname = G_NewString("fx_electrical_explosion");
newEnt->classname = "fx_electrical_explosion";
if(numArgs < 2) {
G_FreeEntity(newEnt);
trap_SendServerCommand(clientNum, "print \"Insufficent number of arguments for fx_electrical_explosion!\n\"");
@ -6788,7 +6792,7 @@ static void Cmd_spawnTentity_f(gentity_t *ent) {
}
} else if(!Q_stricmpn(arg, "info_", 5)) {
if(!Q_stricmp(arg, "info_notnull")) {
newEnt->classname = G_NewString("info_notnull");
newEnt->classname = "info_notnull";
if(numArgs < 2) {
G_FreeEntity(newEnt);
trap_SendServerCommand(clientNum, "print \"Insufficent number of arguments for info_notnull!\n\"");
@ -6796,15 +6800,15 @@ static void Cmd_spawnTentity_f(gentity_t *ent) {
return;
}
trap_Argv(2, arg, sizeof(arg));
newEnt->targetname = G_NewString(arg);
newEnt->targetname = arg;
G_CallSpawn(newEnt);
} else if(!Q_stricmp(arg, "info_player_deathmatch") || !Q_stricmp(arg, "info_player_start")) {
newEnt->classname = G_NewString("info_player_deathmatch");
newEnt->classname = "info_player_deathmatch";
G_CallSpawn(newEnt);
}
} else if(!Q_stricmpn(arg, "target_", 7)) {
if(!Q_stricmp(arg, "target_boolean")) {
newEnt->classname = G_NewString("target_boolean");
newEnt->classname = "target_boolean";
if(numArgs < 5) {
G_FreeEntity(newEnt);
trap_SendServerCommand(clientNum, "print \"Insufficent number of arguments for target_boolean!\n\"");
@ -6834,7 +6838,7 @@ static void Cmd_spawnTentity_f(gentity_t *ent) {
}
G_CallSpawn(newEnt);
} else if(!Q_stricmp(arg, "target_counter")) {
newEnt->classname = G_NewString("target_counter");
newEnt->classname = "target_counter";
if(numArgs < 4) {
G_FreeEntity(newEnt);
trap_SendServerCommand(clientNum, "print \"Insufficent number of arguments for target_count!\n\"");
@ -6849,7 +6853,7 @@ static void Cmd_spawnTentity_f(gentity_t *ent) {
newEnt->count = atoi(arg);
G_CallSpawn(newEnt);
} else if(!Q_stricmp(arg, "target_deactivate")) {
newEnt->classname = G_NewString("target_deactivate");
newEnt->classname = "target_deactivate";
if(numArgs < 3) {
G_FreeEntity(newEnt);
trap_SendServerCommand(clientNum, "print \"Insufficent number of arguments for target_deactivate!\n\"");
@ -6862,7 +6866,7 @@ static void Cmd_spawnTentity_f(gentity_t *ent) {
newEnt->target = G_NewString(arg);
G_CallSpawn(newEnt);
} else if(!Q_stricmp(arg, "target_doorlock")) {
newEnt->classname = G_NewString("target_doorlock");
newEnt->classname = "target_doorlock";
if(numArgs < 3) {
G_FreeEntity(newEnt);
trap_SendServerCommand(clientNum, "print \"Insufficent number of arguments for target_doorlock!\n\"");
@ -6887,7 +6891,7 @@ static void Cmd_spawnTentity_f(gentity_t *ent) {
}
G_CallSpawn(newEnt);
} else if(!Q_stricmp(arg, "target_relay")) {
newEnt->classname = G_NewString("target_relay");
newEnt->classname = "target_relay";
if(numArgs < 3) {
G_FreeEntity(newEnt);
trap_SendServerCommand(clientNum, "print \"Insufficent number of arguments for target_relay!\n\"");
@ -6904,7 +6908,7 @@ static void Cmd_spawnTentity_f(gentity_t *ent) {
}
G_CallSpawn(newEnt);
} else if(!Q_stricmp(arg, "target_delay")) {
newEnt->classname = G_NewString("target_delay");
newEnt->classname = "target_delay";
if(numArgs < 3) {
G_FreeEntity(newEnt);
trap_SendServerCommand(clientNum, "print \"Insufficent number of arguments for target_delay!\n\"");
@ -6927,7 +6931,7 @@ static void Cmd_spawnTentity_f(gentity_t *ent) {
trap_Argv(4, arg, sizeof(arg));
newEnt->wait = atoi(arg);
} else if(!Q_stricmp(arg, "target_evosuit")) {
newEnt->classname = G_NewString("target_evosuit");
newEnt->classname = "target_evosuit";
if(numArgs < 2) {
G_FreeEntity(newEnt);
trap_SendServerCommand(clientNum, "print \"Insufficent number of arguments for target_evosuit!\n\"");
@ -6938,7 +6942,7 @@ static void Cmd_spawnTentity_f(gentity_t *ent) {
newEnt->targetname = G_NewString(arg);
G_CallSpawn(newEnt);
} else if(!Q_stricmp(arg, "target_give")) {
newEnt->classname = G_NewString("target_give");
newEnt->classname = "target_give";
if(numArgs < 3) {
G_FreeEntity(newEnt);
trap_SendServerCommand(clientNum, "print \"Insufficent number of arguments for target_give!\n\"");
@ -6951,7 +6955,7 @@ static void Cmd_spawnTentity_f(gentity_t *ent) {
newEnt->target = G_NewString(arg);
G_CallSpawn(newEnt);
} else if(!Q_stricmp(arg, "target_gravity")) {
newEnt->classname = G_NewString("target_gravity");
newEnt->classname = "target_gravity";
if(numArgs < 3) {
G_FreeEntity(newEnt);
trap_SendServerCommand(clientNum, "print \"Insufficent number of arguments for target_gravity!\n\"");
@ -6968,7 +6972,7 @@ static void Cmd_spawnTentity_f(gentity_t *ent) {
}
G_CallSpawn(newEnt);
} else if(!Q_stricmp(arg, "target_kill")) {
newEnt->classname = G_NewString("target_kill");
newEnt->classname = "target_kill";
if(numArgs < 2) {
G_FreeEntity(newEnt);
trap_SendServerCommand(clientNum, "print \"Insufficent number of arguments for target_kill!\n\"");
@ -6979,7 +6983,7 @@ static void Cmd_spawnTentity_f(gentity_t *ent) {
newEnt->targetname = G_NewString(arg);
G_CallSpawn(newEnt);
} else if(!Q_stricmp(arg, "target_print")) {
newEnt->classname = G_NewString("target_print");
newEnt->classname = "target_print";
if(numArgs < 3) {
G_FreeEntity(newEnt);
trap_SendServerCommand(clientNum, "print \"Insufficent number of arguments for target_print!\n\"");
@ -6996,7 +7000,7 @@ static void Cmd_spawnTentity_f(gentity_t *ent) {
}
G_CallSpawn(newEnt);
} else if(!Q_stricmp(arg, "target_repair")) {
newEnt->classname = G_NewString("target_repair");
newEnt->classname = "target_repair";
if(numArgs < 3) {
G_FreeEntity(newEnt);
trap_SendServerCommand(clientNum, "print \"Insufficent number of arguments for target_repair!\n\"");
@ -7009,7 +7013,7 @@ static void Cmd_spawnTentity_f(gentity_t *ent) {
newEnt->target = G_NewString(arg);
G_CallSpawn(newEnt);
} else if(!Q_stricmp(arg, "target_shake")) {
newEnt->classname = G_NewString("target_shake");
newEnt->classname = "target_shake";
if(numArgs < 4) {
G_FreeEntity(newEnt);
trap_SendServerCommand(clientNum, "print \"Insufficent number of arguments for target_shake!\n\"");
@ -7024,7 +7028,7 @@ static void Cmd_spawnTentity_f(gentity_t *ent) {
trap_Argv(4, arg, sizeof(arg));
newEnt->wait = atof(arg);
} else if(!Q_stricmp(arg, "target_teleporter")) {
newEnt->classname = G_NewString("target_teleporter");
newEnt->classname = "target_teleporter";
if(numArgs < 3) {
G_FreeEntity(newEnt);
trap_SendServerCommand(clientNum, "print \"Insufficent number of arguments for target_teleporter!\n\"");
@ -7045,7 +7049,7 @@ static void Cmd_spawnTentity_f(gentity_t *ent) {
}
G_CallSpawn(newEnt);
} else if(!Q_stricmp(arg, "target_speaker")) {
newEnt->classname = G_NewString("target_speaker");
newEnt->classname = "target_speaker";
if(numArgs < 3) {
G_FreeEntity(newEnt);
trap_SendServerCommand(clientNum, "print \"Insufficent number of arguments for target_speaker!\n\"");
@ -7079,7 +7083,7 @@ static void Cmd_spawnTentity_f(gentity_t *ent) {
if(newEnt) {
Com_sprintf(tmp, sizeof(tmp), "%s%s", "tmp_", newEnt->classname);
newEnt->classname = G_NewString(tmp);
if(!Q_stricmp(newEnt->classname, "tmp_trigger_multiple") && ent->wait == -1)
if((Q_stricmp(newEnt->classname, "tmp_trigger_multiple") == 0) && (ent->wait == -1))
newEnt->classname = G_NewString("tmp_trigger_once");
trap_SendServerCommand(clientNum, va("print \"Spawned entity of type %s with entity number %i.\"", newEnt->classname, newEnt->s.number));
}
@ -7120,7 +7124,7 @@ static void Cmd_UiTransporterLoc_f(gentity_t *ent) {
delay *= 1000;
for(i = 0; i < MAX_GENTITIES; i++) {
if(!Q_stricmp(g_entities[i].classname, "target_location")) {
if(g_entities[i].type == ENT_TARGET_LOCATION) {
if(g_entities[i].health == targetLoc && g_entities[i].health >= 1 && targetLoc >= 1) {
locTarget = &g_entities[i];
break;
@ -7506,7 +7510,7 @@ void Cmd_GeneratePrecacheFile(gentity_t *ent) {
for(i = 0; i < MAX_GENTITIES; i++) {
if(!g_entities[i].inuse) continue;
if(g_entities[i].classname != NULL && !strcmp(g_entities[i].classname, "target_turbolift")) {
if(g_entities[i].type == ENT_TARGET_TURBOLIFT) {
if(g_entities[i].falsename != NULL && g_entities[i].falsename[0] != 0) {
addShaderToList(shaders, g_entities[i].falsename);
}

View file

@ -1039,17 +1039,17 @@ void G_Damage( gentity_t *targ, gentity_t *inflictor, gentity_t *attacker,
}
// shootable doors / buttons don't actually have any health
if ( (targ->s.eType == ET_MOVER && Q_stricmp("func_breakable", targ->classname) != 0 && Q_stricmp("misc_model_breakable", targ->classname) != 0) ||
(targ->s.eType == ET_MOVER_STR && Q_stricmp("func_breakable", targ->classname) != 0 && Q_stricmp("misc_model_breakable", targ->classname) != 0)) //RPG-X | GSIO01 | 13/05/2009
if ( ((targ->s.eType == ET_MOVER) && (targ->type != ENT_FUNC_BREAKABLE) && (targ->type != ENT_MISC_MODEL_BREAKABLE)) ||
((targ->s.eType == ET_MOVER_STR) && (targ->type != ENT_FUNC_BREAKABLE) && (targ->type != ENT_MISC_MODEL_BREAKABLE))) //RPG-X | GSIO01 | 13/05/2009
{
if ( !Q_stricmp( targ->classname, "func_forcefield" ) )
if ( targ->type == ENT_FUNC_FORCEFIELD )
{
if ( targ->pain )
{
targ->pain( targ, inflictor, take );
}
}
else if ( targ->use && (targ->moverState == MOVER_POS1 || targ->moverState == ROTATOR_POS1) && Q_stricmp(targ->classname, "func_door") && Q_stricmp(targ->classname, "func_door_rotating") )
else if ( (targ->use != NULL) && ((targ->moverState == MOVER_POS1) || (targ->moverState == ROTATOR_POS1)) && (targ->type != ENT_FUNC_DOOR) && (targ->type != ENT_FUNC_DOOR_ROTATING) )
{
targ->use( targ, inflictor, attacker );
}
@ -1237,7 +1237,7 @@ void G_Damage( gentity_t *targ, gentity_t *inflictor, gentity_t *attacker,
targ->health = targ->health - take;
//RPG-X: RedTechie - If medicrevive is on then health only goes down to 1 so we can simulate fake death
if(rpg_medicsrevive.integer == 1 && Q_stricmp("func_breakable", targ->classname) && Q_stricmp("misc_model_breakable", targ->classname ) ){
if((rpg_medicsrevive.integer == 1) && (targ->type != ENT_FUNC_BREAKABLE) && (targ->type != ENT_MISC_MODEL_BREAKABLE) ){
if(targ->health <= 0){
targ->health = 1;
}
@ -1455,7 +1455,7 @@ void G_Repair(gentity_t *ent, gentity_t *tr_ent, float rate) {
float max = 0;
// if count isn't 0 the breakable is not damaged and if target is no breakable it does not make sense to go on
if(tr_ent->count != 0 || strstr(tr_ent->classname, "breakable") == NULL) {
if((tr_ent->count != 0) || strstr(tr_ent->classname, "breakable") == NULL) {
return;
}
@ -1497,7 +1497,7 @@ void G_Repair(gentity_t *ent, gentity_t *tr_ent, float rate) {
if(tr_ent->target) {
G_UseTargets2(tr_ent, tr_ent, tr_ent->target);
}
if(!strcmp(tr_ent->classname, "func_breakable")) {
if(tr_ent->type == ENT_FUNC_BREAKABLE) {
tr_ent->s.solid = CONTENTS_BODY;
trap_SetBrushModel(tr_ent, tr_ent->model);
tr_ent->r.svFlags &= ~SVF_NOCLIENT;
@ -1516,7 +1516,7 @@ void G_Repair(gentity_t *ent, gentity_t *tr_ent, float rate) {
tr_ent->clipmask = 0;
tr_ent->count = 1;
} else if(!strcmp(tr_ent->classname, "misc_model_breakable")) {
} else if(tr_ent->type == ENT_MISC_MODEL_BREAKABLE) {
SP_misc_model_breakable(tr_ent);
}
}

View file

@ -185,6 +185,7 @@ typedef enum {
typedef enum {
ENT_FREE = 0,
ENT_UNKNOWN,
ENT_TEMPORAL,
ENT_CUSTOM,
ENT_LIGHT,
ENT_PATH_CORNER,

View file

@ -1434,7 +1434,7 @@ static void G_LoadLocationsFile( void )
return;
}
ent->classname = G_NewString("target_location");
ent->classname = "target_location";
//copy position data
VectorCopy( origin, ent->s.origin );
@ -1553,7 +1553,7 @@ static void G_FindTeams( void ) {
continue;
if ((e->flags & FL_TEAMSLAVE) != 0)
continue;
if ( (e->classname != NULL) && Q_stricmp( "func_door", e->classname ) != 0 )
if ( (e->classname != NULL) && (e->type != ENT_FUNC_DOOR) )
{//not a door
if ( Q_stricmp( "1", e->team ) == 0 || Q_stricmp( "2", e->team ) == 0 )
{//is trying to tell us it belongs to the TEAM_RED or TEAM_BLUE
@ -1674,15 +1674,21 @@ static void Dev_ShowTriggers(gentity_t *ent) {
for(i = 0; i < MAX_GENTITIES; i++) {
if((tar = &g_entities[i]) == NULL) continue;
if(Q_stricmpn(tar->classname, "trigger_", 8) == 0) {
if(Q_stricmp(tar->classname, "trigger_always") == 0) continue;
if((tar->r.svFlags & SVF_NOCLIENT) != 0)
if(tar->type >= ENT_TRIGGER_ALWAYS && tar->type < ENT_TARGET_REMOVE_POWERUPS) {
if(tar->type == ENT_TRIGGER_ALWAYS) {
continue;
}
if((tar->r.svFlags & SVF_NOCLIENT) != 0) {
tar->r.svFlags ^= SVF_NOCLIENT;
}
trap_LinkEntity(ent);
if(Q_stricmpn(tar->classname, "trigger_push", 13) == 0)
if(tar->type == ENT_TRIGGER_PUSH) {
G_AddEvent(tar, EV_TRIGGER_SHOW, 1);
else
} else {
G_AddEvent(tar, EV_TRIGGER_SHOW, 0);
}
}
}
}

View file

@ -90,13 +90,14 @@ none
*/
void SP_info_notnull( gentity_t *self ){
if(!Q_stricmp(self->classname, "ref_tag") && !rpg_allowspmaps.integer)
if((Q_stricmp(self->classname, "ref_tag") == 0) && (rpg_allowspmaps.integer == 0)) {
G_FreeEntity(self);
}
self->type = ENT_INFO_NOTNULL;
if(strcmp(self->classname, "info_notnull")) {
self->classname = G_NewString("info_notnull");
self->classname = "info_notnull";
}
G_SetOrigin( self, self->s.origin );
}

View file

@ -233,7 +233,7 @@ void G_MissileImpact( gentity_t *ent, trace_t *trace ) {
if ( ( ent->s.eFlags & EF_MISSILE_STICK ) )
{
// kinda cheap, but if a sticky grenade hits a forcefield or a moving, explode
if ( other && ( (other->classname && !Q_stricmp(other->classname, "holdable_shield")) || (!VectorCompare( vec3_origin, other->s.pos.trDelta ) && other->s.pos.trType!=TR_STATIONARY) || (!VectorCompare( vec3_origin, other->s.apos.trDelta ) && other->s.apos.trType!=TR_STATIONARY) ) )
if ( (other != NULL) && ( ((other->classname != NULL) && !Q_stricmp(other->classname, "holdable_shield")) || (VectorCompare( vec3_origin, other->s.pos.trDelta == 0) && (other->s.pos.trType != TR_STATIONARY)) || ((VectorCompare( vec3_origin, other->s.apos.trDelta ) == 0) && (other->s.apos.trType != TR_STATIONARY))))
{
//RPG-X: - Our forcefield killer :D
if(other && ((other->classname && !Q_stricmp(other->classname, "holdable_shield")))){

View file

@ -508,7 +508,7 @@ ReturnToPos1
void ReturnToPos1( gentity_t *ent )
{
//if it's a crushing door, make sure there are no ents in the way
if ( !Q_stricmp( ent->classname, "func_door" ) && ent->targetname && !(ent->spawnflags&32) && ent->wait > 0 ) //OVERRIDE
if ( (ent->type == ENT_FUNC_DOOR) && (ent->targetname != NULL) && ((ent->spawnflags & 32) == 0) && (ent->wait > 0) ) //OVERRIDE
{
gentity_t *t;
trace_t tr;
@ -517,7 +517,7 @@ void ReturnToPos1( gentity_t *ent )
//FIX: make sure it isn't a turbolift door either
//A turbolift door should only be targetted by its turbolift parent
t = G_Find(NULL, FOFS(target), ent->targetname);
if ( t && Q_stricmp( t->classname, "target_turbolift" ) )
if ( (t != NULL) && (t->type != ENT_TARGET_TURBOLIFT) )
{
VectorCopy( ent->r.mins, mins );
VectorCopy( ent->r.maxs, maxs );
@ -559,7 +559,7 @@ TiM: To make toggle doors
void ReturnToPos1_Use( gentity_t* ent, gentity_t* other, gentity_t* activator)
{
//if it's a crushing door, make sure there are no ents in the way
if ( !Q_stricmp( ent->classname, "func_door" ) && ent->targetname && !(ent->spawnflags&32) && ent->wait > 0 ) //OVERRIDE
if ( (ent->type == ENT_FUNC_DOOR) && (ent->targetname != NULL) && ((ent->spawnflags & 32) == 0) && (ent->wait > 0) ) //OVERRIDE
{
gentity_t *t;
trace_t tr;
@ -568,7 +568,7 @@ void ReturnToPos1_Use( gentity_t* ent, gentity_t* other, gentity_t* activator)
//FIX: make sure it isn't a turbolift door either
//A turbolift door should only be targetted by its turbolift parent
t = G_Find(NULL, FOFS(target), ent->targetname);
if ( t && Q_stricmp( t->classname, "target_turbolift" ) )
if ( (t != NULL) && (t->type != ENT_TARGET_TURBOLIFT) )
{
VectorCopy( ent->r.mins, mins );
VectorCopy( ent->r.maxs, maxs );
@ -777,7 +777,7 @@ void G_Mover_UseBinaryMover( gentity_t *ent, gentity_t *other, gentity_t *activa
//GSIO01 -> is this a train and is called by the swapname
if(activator && activator->target && ent->swapname) {
if(!Q_stricmp(ent->classname, "func_train") && !Q_stricmp(activator->target, ent->swapname)) {
if((ent->type == ENT_FUNC_TRAIN) && !Q_stricmp(activator->target, ent->swapname)) {
if(ent->count == 1) {
ent->s.solid = 0;
ent->r.contents = 0;
@ -808,10 +808,11 @@ void G_Mover_UseBinaryMover( gentity_t *ent, gentity_t *other, gentity_t *activa
}
//GSIO01 | 09/05/2009: do engage if door is admin only and player isn admin
if((!Q_stricmp(ent->classname, "func_door") && (ent->spawnflags & 128))
|| (!Q_stricmp(ent->classname, "func_door_rotating") && (ent->spawnflags & 64))) {
if(activator && !IsAdmin(activator))
if(((ent->type == ENT_FUNC_DOOR) && ((ent->spawnflags & 128) != 0))
|| ((ent->type == ENT_FUNC_DOOR_ROTATING) && ((ent->spawnflags & 64) != 0))) {
if((activator != NULL) && !IsAdmin(activator)) {
return;
}
}
// only the master should be used
@ -1009,13 +1010,14 @@ void InitMover( gentity_t *ent ) {
ent->use = G_Mover_UseBinaryMover;
if(Q_stricmp(ent->classname, "func_mover"))
if(ent->type != ENT_FUNC_MOVER) {
ent->reached = Reached_BinaryMover;
else
} else {
ent->reached = Reached_AdvancedMover;
}
// if this is a func_mover we have to make sure it is a bit away from it's first target
if(!Q_stricmp(ent->classname, "func_mover")) {
if(ent->type == ENT_FUNC_MOVER) {
VectorSubtract(ent->pos1, ent->pos2, move);
distance = VectorLength(move);
if(distance < 32) {
@ -1059,7 +1061,7 @@ void InitMover( gentity_t *ent ) {
ent->s.apos.trDuration = 1;
}
if(!Q_stricmp(ent->classname, "func_rotating")) {
if(ent->type == ENT_FUNC_ROTATING) {
ent->reached = 0;
}
}
@ -1170,7 +1172,7 @@ void Blocked_Door( gentity_t *ent, gentity_t *other ) {
if ( ent->damage ) {
G_Damage( other, ent, ent, NULL, NULL, ent->damage, 0, MOD_CRUSH );
}
if ( ent->spawnflags & 4 || (!Q_stricmp(ent->classname, "func_door_rotating") && (ent->spawnflags & 2))) { // GSIO01: added support for fucn_door_roating
if ( ((ent->spawnflags & 4) != 0) || ((ent->type == ENT_FUNC_DOOR_ROTATING) && ((ent->spawnflags & 2) != 0)) ) { // GSIO01: added support for fucn_door_roating
return; // crushers don't reverse
}
@ -1312,12 +1314,12 @@ void Think_SpawnNewDoorTrigger( gentity_t *ent ) {
}
// should we have a big old trigger volume, or a small one?
if(((ent->spawnflags & 256) && !Q_stricmp(ent->classname, "func_door")) ||
((ent->spawnflags & 128) && !Q_stricmp(ent->classname, "func_door_rotating"))) {
if((((ent->spawnflags & 256) != 0) && (ent->type == ENT_FUNC_DOOR)) ||
(((ent->spawnflags & 128) != 0) && (ent->type == ENT_FUNC_DOOR_ROTATING))) {
maxs[best] += 12;
mins[best] -= 12;
}
else if (ent->spawnflags & 8 && !Q_stricmp(ent->classname, "func_door"))
else if (((ent->spawnflags & 8) != 0) && (ent->type == ENT_FUNC_DOOR))
{
maxs[best] += 48;
mins[best] -= 48;
@ -2006,7 +2008,7 @@ void Think_SetupTrainTargets( gentity_t *ent ) {
vtos(path->s.origin) ););
return;
}
} while ( strcmp( next->classname, "path_corner" ) );
} while ( next->type != ENT_PATH_CORNER );
path->nextTrain = next;
}
@ -3001,7 +3003,7 @@ void func_lightchange_setup(gentity_t *ent) {
G_FreeEntity(ent);
return;
}
if(Q_stricmp(bmodel->classname, "func_brushmodel")) {
if(ent->type != ENT_FUNC_BRUSHMODEL) {
DEVELOPER(G_Printf(S_COLOR_YELLOW "[Entity-Error] func_lightchange with invalid target entity of class %s at %s!\n", bmodel->classname, vtos(ent->s.origin)););
G_FreeEntity(ent);
return;

View file

@ -330,7 +330,7 @@ qboolean G_CallSpawn( gentity_t *ent ) {
spawn_t *s;
gitem_t *item;
if ( !ent->classname )
if ( ent->classname == NULL )
{
G_Printf ("G_CallSpawn: NULL classname\n");
return qfalse;

View file

@ -672,7 +672,7 @@ static void target_location_linkup(/*@shared@*/ gentity_t *ent)
for (i = 0, ent = g_entities, n = 1;
i < level.num_entities;
i++, ent++) {
if (ent->classname != NULL && Q_stricmp(ent->classname, "target_location") == 0) {
if ((ent->classname != NULL) && (ent->type == ENT_TARGET_LOCATION)) {
// lets overload some variables!
ent->health = n; // use for location marking
trap_SetConfigstring( CS_LOCATIONS + n, ent->message );
@ -1082,7 +1082,7 @@ static void target_turbolift_unlock ( /*@shared@*/ gentity_t *ent )
if(ent->target != NULL) {
while ( ( door = G_Find( door, FOFS( targetname ), ent->target )) != NULL )
{
if ( Q_stricmp( door->classname, "func_door" ) == 0 )
if ( door->type == ENT_FUNC_DOOR )
{
door->flags &= ~FL_CLAMPED;
}
@ -1094,7 +1094,7 @@ static void target_turbolift_unlock ( /*@shared@*/ gentity_t *ent )
{
while ( ( door = G_Find( door, FOFS( targetname ), otherLift->target )) != NULL )
{
if ( Q_stricmp( door->classname, "func_door" ) == 0 )
if ( door->type == ENT_FUNC_DOOR )
{
door->flags &= ~FL_CLAMPED;
}
@ -1145,7 +1145,7 @@ static void target_turbolift_endMove ( /*@shared@*/ gentity_t *ent )
if(ent->target != NULL) {
while ( ( lights = G_Find( lights, FOFS( targetname ), ent->target ) ) != NULL )
{
if ( Q_stricmp( lights->classname, "func_usable" ) == 0 )
if ( lights->type == ENT_FUNC_USABLE )
{
if(rpg_calcLiftTravelDuration.integer == 0) {
lights->use( lights, lights, ent );
@ -1191,7 +1191,7 @@ static void target_turbolift_endMove ( /*@shared@*/ gentity_t *ent )
if(otherLift != NULL && otherLift->target != NULL) {
while ( ( lights = G_Find( lights, FOFS( targetname ), otherLift->target ) ) != NULL )
{
if ( Q_stricmp( lights->classname, "func_usable" ) == 0 )
if ( lights->type == ENT_FUNC_USABLE )
{
if(rpg_calcLiftTravelDuration.integer == 0) {
lights->use( lights, lights, ent );
@ -1439,7 +1439,7 @@ static void target_turbolift_startMove (/*@shared@*/ gentity_t *ent )
if(ent->target != NULL) {
while ( ( lights = G_Find( lights, FOFS( targetname ), ent->target ) ) != NULL )
{
if ( Q_stricmp( lights->classname, "func_usable" ) == 0 )
if ( lights->type == ENT_FUNC_USABLE )
{
if(rpg_calcLiftTravelDuration.integer == 0) {
lights->use( lights, lights, ent );
@ -1485,7 +1485,7 @@ static void target_turbolift_startMove (/*@shared@*/ gentity_t *ent )
if(otherLift->target != NULL) {
while ( ( lights = G_Find( lights, FOFS( targetname ), otherLift->target ) ) != NULL )
{
if ( Q_stricmp( lights->classname, "func_usable" ) == 0 )
if ( lights->type == ENT_FUNC_USABLE )
{
if(rpg_calcLiftTravelDuration.integer == 0) {
lights->use( lights, lights, ent );
@ -1576,7 +1576,7 @@ static void target_turbolift_shutDoors (/*@shared@*/ gentity_t *ent )
if(ent->target != NULL) {
while ( ( door = G_Find( door, FOFS( targetname ), ent->target )) != NULL )
{
if ( Q_stricmp( door->classname, "func_door" ) == 0 )
if ( door->type == ENT_FUNC_DOOR )
{
if ( door->moverState != MOVER_POS1 ) {
ent->nextthink = level.time + 500;
@ -1590,7 +1590,7 @@ static void target_turbolift_shutDoors (/*@shared@*/ gentity_t *ent )
if(otherLift->target != NULL) {
while ( ( door = G_Find( door, FOFS( targetname ), otherLift->target )) != NULL )
{
if ( Q_stricmp( door->classname, "func_door" ) == 0 )
if ( door->type == ENT_FUNC_DOOR )
{
if ( door->moverState != MOVER_POS1 ) {
ent->nextthink = level.time + 500;
@ -1626,7 +1626,7 @@ void target_turbolift_start ( gentity_t *self )
if(self->target != NULL) {
while ( ( door = G_Find( door, FOFS( targetname ), self->target )) != NULL )
{
if ( Q_stricmp( door->classname, "func_door" ) == 0 )
if ( door->type == ENT_FUNC_DOOR )
{
door->flags |= FL_CLAMPED;
if ( door->moverState != MOVER_POS1 )
@ -1641,7 +1641,7 @@ void target_turbolift_start ( gentity_t *self )
if(otherLift->target != NULL) {
while ( ( door = G_Find( door, FOFS( targetname ), otherLift->target )) != NULL )
{
if ( Q_stricmp( door->classname, "func_door" ) == 0 )
if ( door->type == ENT_FUNC_DOOR )
{
door->flags |= FL_CLAMPED;
if ( door->moverState != MOVER_POS1 )
@ -1955,7 +1955,7 @@ void target_doorLock_use(/*@shared@*/ gentity_t *ent, /*@shared@*/ /*@unused@*/
}
}
if(Q_stricmp(target->classname, "func_door") == 0 || Q_stricmp(target->classname, "func_door_rotating") == 0) {
if((target->type == ENT_FUNC_DOOR) || (target->type == ENT_FUNC_DOOR_ROTATING)) {
target->flags ^= FL_LOCKED;
} else {
DEVELOPER(G_Printf(S_COLOR_YELLOW "[Entity-Error] Target %s of target_doorlock at %s is not a door!\n", ent->target, vtos(ent->s.origin)););
@ -2560,7 +2560,7 @@ void target_warp_use(/*@shared@*/ gentity_t *ent, /*@shared@*/ /*@unused@*/ gent
continue;
}
if(Q_stricmp(g_entities[i].classname, "func_train") != 0 && Q_stricmp(g_entities[i].swapname, ent->bluename) == 0) {
if((g_entities[i].type != ENT_FUNC_TRAIN) && Q_stricmp(g_entities[i].swapname, ent->bluename) == 0) {
target = &g_entities[i];
if(target == NULL) {
continue;
@ -2581,7 +2581,7 @@ void target_warp_use(/*@shared@*/ gentity_t *ent, /*@shared@*/ /*@unused@*/ gent
}
#endif
}
} else if(Q_stricmp(g_entities[i].classname, "func_train") == 0 && Q_stricmp(g_entities[i].swapname, ent->bluename) == 0) {
} else if((g_entities[i].type == ENT_FUNC_TRAIN) && Q_stricmp(g_entities[i].swapname, ent->bluename) == 0) {
target = &g_entities[i];
if(target == NULL) {
continue;
@ -2727,7 +2727,7 @@ void target_deactivate_use(/*@shared@*/ gentity_t *ent, /*@shared@*/ /*@unused@*
}
while((target = G_Find(target, FOFS(targetname2), ent->target)) != NULL) {
if(Q_stricmp(target->classname, "func_usable") == 0) {
if(target->type == ENT_FUNC_USABLE) {
target->flags ^= FL_LOCKED;
}
}
@ -3202,7 +3202,7 @@ void SP_target_zone(gentity_t *ent) {
if(Q_stricmp(ent->classname, "target_zone") != 0){
ent->count = 1;
ent->classname = G_NewString("target_zone");
ent->classname = "target_zone";
}
if(ent->count == 0) {
@ -3213,8 +3213,7 @@ void SP_target_zone(gentity_t *ent) {
if(strcmp(ent->classname, "target_zone") != 0){
ent->count = 1;
//ent->classname = G_NewString("target_zone");
strcpy(ent->classname, "target_zone");
ent->classname = "target_zone";
}
if(ent->luaEntity == qfalse && ent->model != NULL) {
@ -3571,14 +3570,14 @@ void target_shiphealth_think(/*@shared@*/ gentity_t *ent) {
//shield reenstatement
if(ent->splashDamage == -1) { //else we don't need to run this
if((ent->count * pow(ent->health, -1)) > 0.5) {
if(alertEnt != NULL && alertEnt->damage == 0 && Q_stricmp(alertEnt->classname, "target_alert") == 0) {
if(alertEnt != NULL && alertEnt->damage == 0 && (alertEnt->type == ENT_TARGET_ALERT)) {
ent->splashDamage = 0;
} else {
ent->splashDamage = 1;
}
} else {
if((ent->count * pow(ent->health, -1) * flrandom(0, 1)) > 0.75){
if(alertEnt != NULL && alertEnt->damage == 0 && Q_stricmp(alertEnt->classname, "target_alert") == 0) {
if(alertEnt != NULL && alertEnt->damage == 0 && (alertEnt->type == ENT_TARGET_ALERT)) {
ent->splashDamage = 0;
} else {
ent->splashDamage = 1;

View file

@ -152,9 +152,11 @@ void ui_msd_use(gentity_t *ent, gentity_t *other, gentity_t *activator) {
shieldstate = target->splashDamage;
if(target->falsetarget){
while((temp = G_Find(temp, FOFS(truename), target->falsetarget)) != NULL){
if(!Q_stricmp(temp->classname, "target_warp")) break;
if(temp->type == ENT_TARGET_WARP) {
break;
}
}
if(temp){
if(temp != NULL){
if(temp->sound2to1)//core ejected, we don't really care if it is online
warpstate = 2;
if(!temp->sound2to1 && temp->sound1to2)//not ejected and not deactivated -> core active
@ -166,7 +168,9 @@ void ui_msd_use(gentity_t *ent, gentity_t *other, gentity_t *activator) {
}
if(target->bluename){
while((temp = G_Find(temp, FOFS(swapname), target->bluename)) != NULL){
if(!Q_stricmp(temp->classname, "target_turbolift")) break;
if(temp->type == ENT_TARGET_TURBOLIFT) {
break;
}
}
if(temp){
if (temp->flags & FL_LOCKED)
@ -178,7 +182,9 @@ void ui_msd_use(gentity_t *ent, gentity_t *other, gentity_t *activator) {
}
if(target->bluesound){
while((temp = G_Find(temp, FOFS(swapname), target->bluesound)) != NULL){
if(!Q_stricmp(temp->classname, "ui_transporter")) break;
if(temp->type == ENT_UI_TRANSPORTER) {
break;
}
}
if(temp){
if (temp->flags & FL_LOCKED)
@ -190,7 +196,7 @@ void ui_msd_use(gentity_t *ent, gentity_t *other, gentity_t *activator) {
}
if(target->falsename){
while((temp = G_Find(temp, FOFS(falsename), target->falsename)) != NULL){
if(!Q_stricmp(temp->classname, "target_alert")) break;
if(temp->type == ENT_TARGET_ALERT) break;
}
if(temp){
alertstate = temp->damage;
@ -214,7 +220,9 @@ void ui_msd_setup(gentity_t *ent) {
gentity_t *target = NULL;
while((target = G_Find(target, FOFS(targetname), ent->target)) != NULL){
if(!Q_stricmp(target->classname, "target_shiphealth")) break;
if(target->type == ENT_TARGET_SHIPHEALTH) {
break;
}
}
if(!target) {

View file

@ -754,7 +754,7 @@ static int Entity_DelayedCallSpawn(lua_State *L) {
return 1;
}
if(!Q_stricmp(lent->e->classname, "target_selfdestruct")) {
if(lent->e->type == ENT_TARGET_SELFDESTRUCT) {
LUA_DEBUG("ERROR - entity.DelayedCallSpawn - entity is target_selfdestruct");
lua_pushboolean(L, qfalse);
return 1; //we will not selfdestruct this way
@ -795,7 +795,7 @@ static int Entity_CallSpawn(lua_State *L) {
}
e = lent->e;
if(!Q_stricmp(lent->e->classname, "target_selfdestruct")) {
if(lent->e->type == ENT_TARGET_SELFDESTRUCT) {
LUA_DEBUG("ERROR - entity.CallSpawn - entity is target_selfdestruct");
lua_pushboolean(L, qfalse);
return 1; //we will not selfdestruct this way
@ -824,9 +824,15 @@ static int Entity_RemoveUnnamedSpawns(lua_State *L) {
LUA_DEBUG("BEGIN - entity.RemoveUnnamedSpawns");
for(i = 0; i < MAX_GENTITIES; i++) {
if(!&g_entities[i]) continue;
if(&g_entities[i] == NULL) {
continue;
}
ent = &g_entities[i];
if(!ent->classname) continue;
if(ent->classname == NULL) {
continue;
}
if(!Q_stricmp(ent->classname, "info_player_deathmatch"))
if(!ent->targetname) {
G_FreeEntity(ent);
@ -1042,15 +1048,15 @@ static int Entity_Lock(lua_State *L) {
ent = lent->e;
if(!strncmp(ent->classname, "func_door", 9) ||
!strncmp(ent->classname, "func_door_rotating", 18) ||
!strncmp(ent->classname, "target_teleporter", 17) ||
!strncmp(ent->classname, "target_turbolift", 16) ||
!strncmp(ent->classname, "func_usable", 11) ||
!strncmp(ent->classname, "target_serverchange", 19) ||
!strncmp(ent->classname, "trigger_teleport", 16) ||
!strncmp(ent->classname, "ui_transporter", 14) ||
!strncmp(ent->classname, "ui_holodeck", 11)
if((ent->type == ENT_FUNC_DOOR) ||
(ent->type == ENT_FUNC_DOOR_ROTATING) ||
(ent->type == ENT_TARGET_TELEPORTER) ||
(ent->type == ENT_TARGET_TURBOLIFT) ||
(ent->type == ENT_FUNC_USABLE) ||
(ent->type == ENT_TARGET_SERVERCHANGE) ||
(ent->type == ENT_TRIGGER_TELEPORT) ||
(ent->type == ENT_UI_TRANSPORTER) ||
(ent->type == ENT_UI_HOLODECK)
) {
if(ent->flags & FL_LOCKED) {
LUA_DEBUG("INFO - entity.Lock - already locked");
@ -1090,15 +1096,15 @@ static int Entity_Unlock(lua_State *L) {
}
ent = lent->e;
if(!strncmp(ent->classname, "func_door", 9) ||
!strncmp(ent->classname, "func_door_rotating", 18) ||
!strncmp(ent->classname, "target_teleporter", 17) ||
!strncmp(ent->classname, "target_turbolift", 16) ||
!strncmp(ent->classname, "func_usable", 11) ||
!strncmp(ent->classname, "target_serverchange", 19) ||
!strncmp(ent->classname, "trigger_teleport", 16) ||
!strncmp(ent->classname, "ui_transporter", 14) ||
!strncmp(ent->classname, "ui_holodeck", 11)
if((ent->type == ENT_FUNC_DOOR) ||
(ent->type == ENT_FUNC_DOOR_ROTATING) ||
(ent->type == ENT_TARGET_TELEPORTER) ||
(ent->type == ENT_TARGET_TURBOLIFT) ||
(ent->type == ENT_FUNC_USABLE) ||
(ent->type == ENT_TARGET_SERVERCHANGE) ||
(ent->type == ENT_TRIGGER_TELEPORT) ||
(ent->type == ENT_UI_TRANSPORTER) ||
(ent->type == ENT_UI_HOLODECK)
) {
if(ent->flags & FL_LOCKED) {
ent->flags ^= FL_LOCKED;