Beispiel #1
0
//===========================================================================
//
// Parameter:				-
// Returns:					-
// Changes Globals:		-
//===========================================================================
int AAS_AlwaysTriggered(char *targetname)
{
	int i;

	if (!strlen(targetname))
	{
		return false;
	}
	//
	for (i = 0; i < num_entities; i++)
	{
		//if the entity will activate the given targetname
		if (!strcmp(targetname, ValueForKey(&entities[i], "target")))
		{
			//if this activator is present in deathmatch
			if (!(atoi(ValueForKey(&entities[i], "spawnflags")) & SPAWNFLAG_NOT_DEATHMATCH))
			{
				//if it is a trigger_always entity
				if (!strcmp("trigger_always", ValueForKey(&entities[i], "classname")))
				{
					return true;
				} //end if
				  //check for possible trigger_always entities activating this entity
				if (AAS_AlwaysTriggered(ValueForKey(&entities[i], "targetname")))
				{
					return true;
				} //end if
			} //end if
		} //end if
	} //end for
	return false;
} //end of the function AAS_AlwaysTriggered
//===========================================================================
//
// Parameter:				-
// Returns:					-
// Changes Globals:		-
//===========================================================================
int AAS_ValidEntity(entity_t *mapent)
{
	int i;
	char target[1024];

	//all world brushes are used for AAS
	if (mapent == &entities[0])
	{
		return true;
	} //end if
	//some of the func_wall brushes are also used for AAS
	else if (!strcmp("func_wall", ValueForKey(mapent, "classname")))
	{
		//Log_Print("found func_wall entity %d\n", mapent - entities);
		//if the func wall is used in deathmatch
		if (!(atoi(ValueForKey(mapent, "spawnflags")) & SPAWNFLAG_NOT_DEATHMATCH))
		{
			//Log_Print("func_wall USED in deathmatch mode %d\n", atoi(ValueForKey(mapent, "spawnflags")));
			return true;
		} //end if
	} //end else if
	else if (!strcmp("func_door_rotating", ValueForKey(mapent, "classname")))
	{
		//if the func_door_rotating is present in deathmatch
		if (!(atoi(ValueForKey(mapent, "spawnflags")) & SPAWNFLAG_NOT_DEATHMATCH))
		{
			//if the func_door_rotating is always activated in deathmatch
			if (AAS_AlwaysTriggered(ValueForKey(mapent, "targetname")))
			{
				//Log_Print("found func_door_rotating in deathmatch\ntargetname %s\n", ValueForKey(mapent, "targetname"));
				return true;
			} //end if
		} //end if
	} //end else if
	else if (!strcmp("trigger_hurt", ValueForKey(mapent, "classname")))
	{
		//"dmg" is the damage, for instance: "dmg" "666"
		return true;
	} //end else if
	else if (!strcmp("trigger_push", ValueForKey(mapent, "classname")))
	{
		return true;
	} //end else if
	else if (!strcmp("trigger_multiple", ValueForKey(mapent, "classname")))
	{
		//find out if the trigger_multiple is pointing to a target_teleporter
		strcpy(target, ValueForKey(mapent, "target"));
		for (i = 0; i < num_entities; i++)
		{
			//if the entity will activate the given targetname
			if (!strcmp(target, ValueForKey(&entities[i], "targetname")))
			{
				if (!strcmp("target_teleporter", ValueForKey(&entities[i], "classname")))
				{
					return true;
				} //end if
			} //end if
		} //end for
	} //end else if
	else if (!strcmp("trigger_teleport", ValueForKey(mapent, "classname")))
	{
		return true;
	} //end else if
	else if (!strcmp("func_static", ValueForKey(mapent, "classname")))
	{
		//FIXME: easy/medium/hard/deathmatch specific?
		return true;
	} //end else if
	else if (!strcmp("func_door", ValueForKey(mapent, "classname")))
	{
		return true;
	} //end else if
	return false;
} //end of the function AAS_ValidEntity
Beispiel #3
0
//===========================================================================
//
// Parameter:				-
// Returns:					-
// Changes Globals:		-
//===========================================================================
int AAS_ValidEntity(entity_t *mapent)
{
	int  i;
	char target[1024];

	//all world brushes are used for AAS
	if (mapent == &entities[0])
	{
		return true;
	} //end if
	  //some of the func_wall brushes are also used for AAS
	else if (!strcmp("func_wall", ValueForKey(mapent, "classname")))
	{
		//Log_Print("found func_wall entity %d\n", mapent - entities);
		//if the func wall is used in deathmatch
		//if (!(atoi(ValueForKey(mapent, "spawnflags")) & SPAWNFLAG_NOT_DEATHMATCH))
		{
			//Log_Print("func_wall USED in deathmatch mode %d\n", atoi(ValueForKey(mapent, "spawnflags")));
			return true;
		} //end if
	} //end else if
	else if (!strcmp("func_door_rotating", ValueForKey(mapent, "classname")) ||
	         !strcmp("func_door", ValueForKey(mapent, "classname")) ||
	         !strcmp("func_invisible_user", ValueForKey(mapent, "classname")))
	{
		//if the func_door_rotating is present in deathmatch
		//if (!(atoi(ValueForKey(mapent, "spawnflags")) & SPAWNFLAG_NOT_DEATHMATCH))
		{
			//if the func_door_rotating is always activated in deathmatch
			if (AAS_AlwaysTriggered(ValueForKey(mapent, "targetname")))
			{
				//Log_Print("found func_door_rotating in deathmatch\ntargetname %s\n", ValueForKey(mapent, "targetname"));
				return true;
			} //end if
		} //end if
	} //end else if
	else if (!strcmp("trigger_hurt", ValueForKey(mapent, "classname")))
	{
		// RF, spawnflag & 1 is for delayed spawn, so ignore it
		if (atoi(ValueForKey(mapent, "spawnflags")) & 1)
		{
			return false;
		}

		//"dmg" is the damage, for instance: "dmg" "666"
		return false;
	} //end else if
	else if (!strcmp("trigger_push", ValueForKey(mapent, "classname")))
	{
		return true;
	} //end else if
	else if (!strcmp("trigger_multiple", ValueForKey(mapent, "classname")))
	{
		//find out if the trigger_multiple is pointing to a target_teleporter
		strcpy(target, ValueForKey(mapent, "target"));
		for (i = 0; i < num_entities; i++)
		{
			//if the entity will activate the given targetname
			if (!strcmp(target, ValueForKey(&entities[i], "targetname")))
			{
				if (!strcmp("target_teleporter", ValueForKey(&entities[i], "classname")))
				{
					return true;
				} //end if
			} //end if
		} //end for
	} //end else if
	else if (!strcmp("trigger_teleport", ValueForKey(mapent, "classname")))
	{
		return true;
	} //end else if
	else if (!strcmp("func_tramcar", ValueForKey(mapent, "classname")))
	{
		return true;
	} //end else if
	else if (!strcmp("func_invisible_user", ValueForKey(mapent, "classname")))
	{
		return true;
	}
	else if (!strcmp("func_static", ValueForKey(mapent, "classname")))
	{
		//FIXME: easy/medium/hard/deathmatch specific?
		return true;
	} //end else if
	  // RF, missionpack
	else if (!strcmp("func_constructible", ValueForKey(mapent, "classname")))
	{
// RF, debugging
		if (strcmp("reardump", ValueForKey(mapent, "targetname")))
		{
			Log_Print("\n\n\nTEMP!!!\nTEMP!!!\nIgnoring all func_constructibles except \"reardump\"\nTEMP!!!\nTEMP!!!\n\n\n");
			return false;
		}

		if ((atoi(ValueForKey(mapent, "spawnflags")) & 512))
		{
			// ignored by AAS
			return false;
		}
		// constructibles are used now by default
		return true;
	} //end else if
	else if (!strcmp("func_explosive", ValueForKey(mapent, "classname")))
	{
		// explosives are now used as MOVER so they only disable areas inside them
		return true;
	} //end else if

	return false;
} //end of the function AAS_ValidEntity