예제 #1
0
파일: genieCon.c 프로젝트: bowhan/kent
struct entity *addToEntityList(struct entity *entityList, struct cdaAli *ali)
/* If ali is non-null, make a new entity around it and add it to list. */
{
struct entity *entity;
if (ali == NULL)
    return entityList;
entity = newEntity(ali);
slAddTail(&entityList, entity);
return entityList;
}
예제 #2
0
/* Create a new file collection record */
REFID newFileCollection(ProvObjectPtr p_prov, const char** filenames, int n_files, const char* type)
{
    RecordPtr p_record = ((ProvPtr)p_prov)->p_record;
    IDREF id = newEntity(p_record);
    int i;
    if (type == NULL)
	addAttribute(p_record, id, "prov", "xsd:QName", "type", "ni:filelist");
    else
	addAttribute(p_record, id, "prov", "xsd:string", "type", type);
    for(i=0; i<n_files; i++)
	addAttribute(p_record, id, "ni", NULL, "path", filenames[i]);
    assert(id);
    return((REFID)id);
}
예제 #3
0
//! When a level is created, we can set  the final steps for the window creation and connect widgets between one another
void MainWindow::setFinalCreationStep(){

    //Scene creation and connection with the element panel
    m_scene = new Scene(m_project->getLayerList(), this);
    m_panelWidget->init();

    connect(m_scene, SIGNAL(newEntity()), m_panelWidget, SLOT(newEntityWidget()));
    connect(m_scene, SIGNAL(selectedItemsChanged(QList<QGraphicsItem *>)), m_panelWidget, SLOT(setCurrentSelectionWidget(QList<QGraphicsItem *>)));

    //Window title
    setWindowTitle("Indielib Editor | " + m_project->getName() + " - " + m_project->getCurrentLevel());

    m_viewer->setScene(m_scene);
}
예제 #4
0
void createMinotaurTimer(Entity* entity, map_t* map)
{
	Entity* childEntity = newEntity(37, 0, map->entities, nullptr); //Timer entity.
	childEntity->sizex = 2;
	childEntity->sizey = 2;
	childEntity->x = entity->x;
	childEntity->y = entity->y;
	childEntity->behavior = &actMinotaurTimer;
	childEntity->flags[SPRITE] = true;
	childEntity->flags[INVISIBLE] = true;
	childEntity->flags[PASSABLE] = true;
	childEntity->flags[NOUPDATE] = true;
	childEntity->setUID(-3);
	entity_uids--;
}
예제 #5
0
int TEST_updatePlayerfacing()
{
  entity *e=NULL;
  e=newEntity(10,10,10,10);
  direction direct=LEFT;
  updatePlayerfacing(e,direct,DOWN);
  if(e->x!=10){
    printf("%25s %s\n",__func__, FAIL );
    return ERROR;
  }
  else{
    printf("%25s %s\n",__func__, PASS );
    return SUCCESS;
  }
}
예제 #6
0
	std::shared_ptr<C> EntityManager::AddComponent(Entity::ID id, std::shared_ptr<C> component)
	{
		AUTO_PROFILE("EntityManager::AddComponent");
		Entity newEntity(shared_from_this(), id);
		if (C::GetTypeID() < emannlib_MAX_COMPONENTS)
		{
			std::shared_ptr<BaseComponent> base(std::static_pointer_cast<BaseComponent>(component));
			AllocateSpaceForComponent(C::GetTypeID());
			m_EntityComponents[C::GetTypeID()][id.GetIndex()] = base;
			m_EntityComponentMask[id.GetIndex()] |= (uint64_t) (1) << C::GetTypeID();
			m_EventManager->Emit<ComponentAddedEvent<C > >(newEntity, component);
			return component;
		}
		return nullptr;
	}
예제 #7
0
파일: baliseProcess.c 프로젝트: icule/CLE
void processEntityBalise(char* line, exo_content* ex)
{
   int decalage=0;
     while((line[decalage] == '\t' || line[decalage] == ' ') && line[decalage]!='\n')
	++decalage;
     if(line[decalage]=='\n')
   {
     printf("Erreur lors du décriptage de la balise entity\n");
     return;
   }
   int x, y;
   double ang;
   sscanf(line+decalage,"%d %d %lf", &x, &y, &ang);
   addEntityToExoContent(ex, newEntity(x,y,ang));
}
예제 #8
0
/* Associate an output with a process */
REFID newProcessOutput(ProvObjectPtr p_prov, ProcessPtr p_proc, const char* name, const char* value, const char* type)
{
    RecordPtr p_record = ((ProvPtr)p_prov)->p_record;
    IDREF id = newEntity(p_record);
    assert(id);
    if (type == NULL)
	addAttribute(p_record, id, "prov", "xsd:QName", "type", "ni:output");
    else
	addAttribute(p_record, id, "prov", "xsd:string", "type", type);
    addAttribute(p_record, id, "ni", "xsd:string", "name", name);
    addAttribute(p_record, id, "ni", "xsd:string", "value", value);
    IDREF gen_id = newGeneratedByRecord(p_record, id, (IDREF)p_proc, NULL);
    assert(gen_id);
    freeID(gen_id);
    return((REFID)id);
}
예제 #9
0
void Text::SetContext(const GraphicsContext& context) {
	assert(context.engine);
	assert(context.scene);

	if (m_context.scene) {
		m_context.scene->GetEntities<gxeng::ITextEntity>().Remove(m_entity.get());
	}

	std::unique_ptr<gxeng::ITextEntity> newEntity(context.engine->CreateTextEntity());

	CopyProperties(*m_entity, *newEntity);

	m_entity = std::move(newEntity);
	m_context = context;
	m_context.scene->GetEntities<gxeng::ITextEntity>().Add(m_entity.get());
}
예제 #10
0
AS3_Val initializeEntity( void* self, AS3_Val args )
{
	Entity * entity;

	SceneNode * node;

	Mesh * mesh;

	char * name;

	AS3_ArrayValue( args, "StrType, PtrType",  &name, &mesh );

	entity = newEntity();

	entity->name = name;

	if ( mesh ) entity->mesh = mesh;

	if( ( node = ( SceneNode * )malloc( sizeof( SceneNode ) ) ) == NULL )
	{
		exit( TRUE );
	}

	node -> entity = entity;
	node -> ID     = 0;
	node -> next   = NULL;

	return AS3_Array( "PtrType, PtrType, PtrType, PtrType, PtrType, PtrType, PtrType, PtrType, PtrType, PtrType, PtrType, PtrType, PtrType, PtrType, PtrType, PtrType, PtrType, PtrType",
		entity, 
		entity->position, 
		entity->direction, 
		entity->scale, 
		entity->w_pos, 
		& entity->mesh, 
		& entity->transformDirty, 
		node, 
		&node->ID, 
		&entity->isBone, 
		entity->transform, 
		&entity->matrixDirty, 
		&entity->morphChannel, 
		&entity->skeletalChannel,
		&entity->terrainTrace,
		entity->aabb,
		entity->worldAABB,
		&entity->visible);
}
예제 #11
0
파일: LoadPCD.cpp 프로젝트: eile/trunk
int LoadPCD::compute()
{
	//for each selected filename
	for (int k = 0; k < m_filenames.size(); ++k)
	{
		QString filename = m_filenames[k];

        boost::shared_ptr<PCLCloud> cloud_ptr_in = loadSensorMessage(filename);
        
		if (!cloud_ptr_in) //loading failed?
			return 0;

		PCLCloud::Ptr cloud_ptr;
        if (!cloud_ptr_in->is_dense) //data may contain nans. Remove them
        {
            //now we need to remove nans
            pcl::PassThrough<PCLCloud> passFilter;
            passFilter.setInputCloud(cloud_ptr_in);

			cloud_ptr = PCLCloud::Ptr(new PCLCloud);
            passFilter.filter(*cloud_ptr);
        }
        else
		{
            cloud_ptr = cloud_ptr_in;
		}

        ccPointCloud* out_cloud = sm2ccConverter(cloud_ptr).getCCloud();
		if (!out_cloud)
			return -31;

		QString cloud_name = QFileInfo(filename).baseName();
		out_cloud->setName(cloud_name);

		QFileInfo fi(filename);
		QString containerName = QString("%1 (%2)").arg(fi.fileName()).arg(fi.absolutePath());

		ccHObject* cloudContainer = new ccHObject(containerName);
		assert(out_cloud);
		cloudContainer->addChild(out_cloud);

		emit newEntity(cloudContainer);
	}

	return 1;
}
예제 #12
0
/* Create a new file record */
REFID newFile(ProvObjectPtr p_prov, const char* filename, const char* type)
{
    RecordPtr p_record = ((ProvPtr)p_prov)->p_record;
    IDREF id = newEntity(p_record);
    unsigned char* p_hash;
    if (type == NULL)
	addAttribute(p_record, id, "prov", "xsd:QName", "type", "ni:file");
    else
	addAttribute(p_record, id, "prov", "xsd:QName", "type", type);
    //addAttribute(p_record, id, "ni", "xsd:string", "path", filename);
    p_hash = get_md5_hash(filename);
    if (p_hash != NULL){
	addAttribute(p_record, id, "ni", NULL, "md5sum", p_hash);
        free(p_hash);
    }
    assert(id);
    return((REFID)id);
}
예제 #13
0
void gnomeDie(Entity *my) {
	node_t *node, *nextnode;
	int c;
	for( c=0; c<6; c++ ) {
		Entity *entity = spawnGib(my);
		if( entity )
			serverSpawnGibForClient(entity);
	}
	if (spawn_blood) {
		int x, y;
		x = std::min<unsigned int>(std::max<int>(0,my->x/16),map.width-1);
		y = std::min<unsigned int>(std::max<int>(0,my->y/16),map.height-1);
		if( map.tiles[y*MAPLAYERS+x*MAPLAYERS*map.height] ) {
			if( !checkObstacle(my->x,my->y,my,NULL) ) {
				Entity *entity = newEntity(160,1,map.entities);
				entity->x = my->x;
				entity->y = my->y;
				entity->z = 7.4+(rand()%20)/100.f;
				entity->parent = my->uid;
				entity->sizex = 2;
				entity->sizey = 2;
				entity->yaw = (rand()%360)*PI/180.0;
				entity->flags[UPDATENEEDED] = TRUE;
				entity->flags[PASSABLE] = TRUE;
			}
		}
	}
	int i = 0;
	for( node=my->children.first; node!=NULL; node=nextnode ) {
		nextnode = node->next;
		if( node->element != NULL && i >= 2 ) {
			Entity *entity=(Entity *)node->element;
			if( entity->light != NULL )
				list_RemoveNode(entity->light->node);
			entity->light = NULL;
			list_RemoveNode(entity->mynode);
		}
		list_RemoveNode(node);
		i++;
	}
	playSoundEntity(my,225+rand()%4,128);
	list_RemoveNode(my->mynode);
	return;
}
예제 #14
0
entity_t *newPointLight(char *enttype, int code) {
    entity_t *ent;
    pointlight_t *pointlight = malloc(sizeof(pointlight_t));
    assert(pointlight != NULL);
    
    ent = newEntity(enttype, code);
    ent->entDerived = pointlight;
    
    pointlight->color = (pixel_t){255,255,255};
    pointlight->brightness = 1.0;
    pointlight->center = (point_t){0,0,0};
    
    ent->load = loadPointLight;
    ent->complete = completePointLight;
    ent->dump = dumpPointLight;

    pointlight->magic = POINTLIGHT_T;

    return(ent);
}
예제 #15
0
	std::shared_ptr<C> EntityManager::RemoveComponent(Entity::ID id)
	{
		AUTO_PROFILE("EntityManager::RemoveComponent");
		uint32_t id1 = id.GetIndex();
		uint32_t id2 = C::GetTypeID();

		if (id.GetIndex() < m_EntityComponentMask.size() &&
			id.GetVersion() == m_EntityVersionNumbers[id.GetIndex()] &&
			C::GetTypeID() < m_EntityComponents.size() &&
			m_EntityComponentMask[id.GetIndex()].test(C::GetTypeID()))
		{
			std::shared_ptr<C> ret(std::static_pointer_cast<C>(m_EntityComponents[C::GetTypeID()][id.GetIndex()]));
			m_EntityComponentMask[id.GetIndex()].reset(C::GetTypeID());

			Entity newEntity(shared_from_this(), id);
			m_EventManager->Emit<ComponentRemovedEvent<C > >(newEntity, ret);

			return ret;
		}
		return nullptr;
	}
예제 #16
0
파일: entityrecipe.cpp 프로젝트: peteb/TGen
TGen::Engine::Entity * TGen::Engine::EntityRecipe::createEntity() const {
    std::auto_ptr<TGen::Engine::Entity> newEntity(new TGen::Engine::Entity(name));

    for (RecipeList::const_iterator iter = componentRecipes.begin(); iter != componentRecipes.end(); ++iter) {
        TGen::Engine::Component * newComponent = (*iter)->createComponent(*this, *newEntity.get());
        newEntity->addComponent(newComponent, newComponent->getName());
    }

    for (int i = 0; i < componentRecipes.size(); ++i) {
        componentRecipes[i]->link(TGen::Engine::ComponentLinker(NULL, newEntity.get(), (*newEntity).getComponent(i, std::nothrow), const_cast<TGen::Engine::EntityRecipe *>(this)));
    }

    TGen::Engine::WorldObject * worldInterface = NULL;

    if (getWorldInterfaceIndex() > -1)
        worldInterface = dynamic_cast<TGen::Engine::WorldObject *>(newEntity->getComponent(getWorldInterfaceIndex(), std::nothrow));

    newEntity->setWorldInterface(worldInterface);

    //newEntity->initialize();

    return newEntity.release();
}
예제 #17
0
Player* newPlayer(float x, float y, float speedX, float speedY, float width, float height, int lifePoints, GLuint textureId){
	Player* player = malloc(sizeof(Player));
	if(NULL == player) {
		fprintf(stderr, "Not enough memory!\n");
		exit(EXIT_FAILURE);
	}

	Entity* entity = newEntity(x, y, speedX, speedY);
	if(NULL == entity) {
		fprintf(stderr, "Not enough memory!\n");
		exit(EXIT_FAILURE);
	}
	
	player->entity = entity;
	player->lifePoints = lifePoints;
	player->width = width;
	player->height = height;
	
	player->isPressedLeft = 0;
	player->isPressedRight = 0;
	player->textureId = textureId;
	player->activatedBonus = 0;
	return player;
}
예제 #18
0
void initSkeleton(Entity *my, stat_t *myStats) {
	int c;
	node_t *node;

	my->sprite = 229; //Skeleton head model

	my->flags[UPDATENEEDED]=TRUE;
	my->flags[BLOCKSIGHT]=TRUE;
	my->flags[INVISIBLE]=FALSE;

	if( multiplayer!=CLIENT ) {
		MONSTER_SPOTSND = -1;
		MONSTER_SPOTVAR = 1;
		MONSTER_IDLESND = -1;
		MONSTER_IDLEVAR = 1;
	}
	if( multiplayer!=CLIENT && !MONSTER_INIT ) {
		myStats->sex = static_cast<sex_t>(rand()%2);
		myStats->appearance = rand();
		strcpy(myStats->name,"");
		myStats->inventory.first = NULL;
		myStats->inventory.last = NULL;
		myStats->HP = 40; myStats->MAXHP = 40;
		myStats->MP = 30; myStats->MAXMP = 30;
		myStats->OLDHP = myStats->HP;
		myStats->STR = 1;
		myStats->DEX = -1;
		myStats->CON = 0;
		myStats->INT = -1;
		myStats->PER = 1;
		myStats->CHR = -3;
		myStats->EXP = 0;
		myStats->LVL = 2;
		myStats->GOLD = 0;
		myStats->HUNGER = 900;
		if( !myStats->leader_uid )
			myStats->leader_uid = 0;
		myStats->FOLLOWERS.first=NULL; myStats->FOLLOWERS.last=NULL;
		for( c=0; c<std::max(NUMPROFICIENCIES,NUMEFFECTS); c++ ) {
			if( c<NUMPROFICIENCIES )
				myStats->PROFICIENCIES[c]=0;
			if( c<NUMEFFECTS )
				myStats->EFFECTS[c]=FALSE;
			if( c<NUMEFFECTS )
				myStats->EFFECTS_TIMERS[c]=0;
		}
		myStats->PROFICIENCIES[PRO_SWORD]=35;
		myStats->PROFICIENCIES[PRO_MACE]=50;
		myStats->PROFICIENCIES[PRO_AXE]=45;
		myStats->PROFICIENCIES[PRO_POLEARM]=25;
		myStats->PROFICIENCIES[PRO_RANGED]=35;
		myStats->PROFICIENCIES[PRO_SHIELD]=35;
		myStats->helmet = NULL;
		myStats->breastplate = NULL;
		myStats->gloves = NULL;
		myStats->shoes = NULL;
		myStats->shield = NULL;
		myStats->weapon = NULL;
		myStats->cloak = NULL;
		myStats->amulet = NULL;
		myStats->ring = NULL;
		myStats->mask = NULL;
	}

	// torso
	Entity *entity = newEntity(230, 0, map.entities);
	entity->sizex = 4;
	entity->sizey = 4;
	entity->skill[2] = my->uid;
	entity->flags[PASSABLE]=TRUE;
	entity->flags[NOUPDATE]=TRUE;
	entity->flags[USERFLAG2]=my->flags[USERFLAG2];
	entity->focalx = limbs[SKELETON][1][0]; // 0
	entity->focaly = limbs[SKELETON][1][1]; // 0
	entity->focalz = limbs[SKELETON][1][2]; // 0
	entity->behavior=&actSkeletonLimb;
	entity->parent=my->uid;
	node = list_AddNodeLast(&my->children);
	node->element = entity;
	node->deconstructor = &emptyDeconstructor;
	node->size = sizeof(Entity *);

	// right leg
	entity = newEntity(236, 0, map.entities);
	entity->sizex = 4;
	entity->sizey = 4;
	entity->skill[2] = my->uid;
	entity->flags[PASSABLE]=TRUE;
	entity->flags[NOUPDATE]=TRUE;
	entity->flags[USERFLAG2]=my->flags[USERFLAG2];
	entity->focalx = limbs[SKELETON][2][0]; // 0
	entity->focaly = limbs[SKELETON][2][1]; // 0
	entity->focalz = limbs[SKELETON][2][2]; // 2
	entity->behavior=&actSkeletonLimb;
	entity->parent=my->uid;
	node = list_AddNodeLast(&my->children);
	node->element = entity;
	node->deconstructor = &emptyDeconstructor;
	node->size = sizeof(Entity *);

	// left leg
	entity = newEntity(235, 0, map.entities);
	entity->sizex = 4;
	entity->sizey = 4;
	entity->skill[2] = my->uid;
	entity->flags[PASSABLE]=TRUE;
	entity->flags[NOUPDATE]=TRUE;
	entity->flags[USERFLAG2]=my->flags[USERFLAG2];
	entity->focalx = limbs[SKELETON][3][0]; // 0
	entity->focaly = limbs[SKELETON][3][1]; // 0
	entity->focalz = limbs[SKELETON][3][2]; // 2
	entity->behavior=&actSkeletonLimb;
	entity->parent=my->uid;
	node = list_AddNodeLast(&my->children);
	node->element = entity;
	node->deconstructor = &emptyDeconstructor;
	node->size = sizeof(Entity *);

	// right arm
	entity = newEntity(233, 0, map.entities);
	entity->sizex = 4;
	entity->sizey = 4;
	entity->skill[2] = my->uid;
	entity->flags[PASSABLE]=TRUE;
	entity->flags[NOUPDATE]=TRUE;
	entity->flags[USERFLAG2]=my->flags[USERFLAG2];
	entity->focalx = limbs[SKELETON][4][0]; // 0
	entity->focaly = limbs[SKELETON][4][1]; // 0
	entity->focalz = limbs[SKELETON][4][2]; // 2
	entity->behavior=&actSkeletonLimb;
	entity->parent=my->uid;
	node = list_AddNodeLast(&my->children);
	node->element = entity;
	node->deconstructor = &emptyDeconstructor;
	node->size = sizeof(Entity *);

	// left arm
	entity = newEntity(231, 0, map.entities);
	entity->sizex = 4;
	entity->sizey = 4;
	entity->skill[2] = my->uid;
	entity->flags[PASSABLE]=TRUE;
	entity->flags[NOUPDATE]=TRUE;
	entity->flags[USERFLAG2]=my->flags[USERFLAG2];
	entity->focalx = limbs[SKELETON][5][0]; // 0
	entity->focaly = limbs[SKELETON][5][1]; // 0
	entity->focalz = limbs[SKELETON][5][2]; // 2
	entity->behavior=&actSkeletonLimb;
	entity->parent=my->uid;
	node = list_AddNodeLast(&my->children);
	node->element = entity;
	node->deconstructor = &emptyDeconstructor;
	node->size = sizeof(Entity *);

	// world weapon
	entity = newEntity(-1, 0, map.entities);
	entity->sizex = 4;
	entity->sizey = 4;
	entity->skill[2] = my->uid;
	entity->flags[PASSABLE]=TRUE;
	entity->flags[NOUPDATE]=TRUE;
	entity->flags[INVISIBLE]=TRUE;
	entity->flags[USERFLAG2]=my->flags[USERFLAG2];
	entity->focalx = limbs[SKELETON][6][0]; // 2.5
	entity->focaly = limbs[SKELETON][6][1]; // 0
	entity->focalz = limbs[SKELETON][6][2]; // 0
	entity->behavior=&actSkeletonLimb;
	entity->parent=my->uid;
	entity->pitch=.25;
	node = list_AddNodeLast(&my->children);
	node->element = entity;
	node->deconstructor = &emptyDeconstructor;
	node->size = sizeof(Entity *);

	// shield
	entity = newEntity(-1, 0, map.entities);
	entity->sizex = 4;
	entity->sizey = 4;
	entity->skill[2] = my->uid;
	entity->flags[PASSABLE]=TRUE;
	entity->flags[NOUPDATE]=TRUE;
	entity->flags[INVISIBLE]=TRUE;
	entity->flags[USERFLAG2]=my->flags[USERFLAG2];
	entity->focalx = limbs[SKELETON][7][0]; // 2
	entity->focaly = limbs[SKELETON][7][1]; // 0
	entity->focalz = limbs[SKELETON][7][2]; // 0
	entity->behavior=&actSkeletonLimb;
	entity->parent=my->uid;
	node = list_AddNodeLast(&my->children);
	node->element = entity;
	node->deconstructor = &emptyDeconstructor;
	node->size = sizeof(Entity *);

	// cloak
	entity = newEntity(-1, 0, map.entities);
	entity->sizex = 4;
	entity->sizey = 4;
	entity->skill[2] = my->uid;
	entity->scalex = 1.01;
	entity->scaley = 1.01;
	entity->scalez = 1.01;
	entity->flags[PASSABLE]=TRUE;
	entity->flags[NOUPDATE]=TRUE;
	entity->flags[INVISIBLE]=TRUE;
	entity->flags[USERFLAG2]=my->flags[USERFLAG2];
	entity->focalx = limbs[SKELETON][8][0]; // 0
	entity->focaly = limbs[SKELETON][8][1]; // 0
	entity->focalz = limbs[SKELETON][8][2]; // 4
	entity->behavior=&actSkeletonLimb;
	entity->parent=my->uid;
	node = list_AddNodeLast(&my->children);
	node->element = entity;
	node->deconstructor = &emptyDeconstructor;
	node->size = sizeof(Entity *);

	// helmet
	entity = newEntity(-1, 0, map.entities);
	entity->sizex = 4;
	entity->sizey = 4;
	entity->skill[2] = my->uid;
	entity->scalex = 1.01;
	entity->scaley = 1.01;
	entity->scalez = 1.01;
	entity->flags[PASSABLE]=TRUE;
	entity->flags[NOUPDATE]=TRUE;
	entity->flags[INVISIBLE]=TRUE;
	entity->flags[USERFLAG2]=my->flags[USERFLAG2];
	entity->focalx = limbs[SKELETON][9][0]; // 0
	entity->focaly = limbs[SKELETON][9][1]; // 0
	entity->focalz = limbs[SKELETON][9][2]; // -2
	entity->behavior=&actSkeletonLimb;
	entity->parent=my->uid;
	node = list_AddNodeLast(&my->children);
	node->element = entity;
	node->deconstructor = &emptyDeconstructor;
	node->size = sizeof(Entity *);

	// mask
	entity = newEntity(-1, 0, map.entities);
	entity->sizex = 4;
	entity->sizey = 4;
	entity->skill[2] = my->uid;
	entity->flags[PASSABLE]=TRUE;
	entity->flags[NOUPDATE]=TRUE;
	entity->flags[INVISIBLE]=TRUE;
	entity->flags[USERFLAG2]=my->flags[USERFLAG2];
	entity->focalx = limbs[SKELETON][10][0]; // 0
	entity->focaly = limbs[SKELETON][10][1]; // 0
	entity->focalz = limbs[SKELETON][10][2]; // .5
	entity->behavior=&actSkeletonLimb;
	entity->parent=my->uid;
	node = list_AddNodeLast(&my->children);
	node->element = entity;
	node->deconstructor = &emptyDeconstructor;
	node->size = sizeof(Entity *);
	
	if( multiplayer==CLIENT || MONSTER_INIT )
		return;
	
	// give helmet
	switch( rand()%10 ) {
		case 0:
		case 1:
		case 2:
		case 3:
		case 4:
			break;
		case 5:
			myStats->helmet = newItem(LEATHER_HELM,DECREPIT,-1+rand()%2,1,0,FALSE,NULL);
			break;
		case 6:
		case 7:
		case 8:
		case 9:
			myStats->helmet = newItem(IRON_HELM,DECREPIT,-1+rand()%2,1,0,FALSE,NULL);
			break;
	}
	
	// give shield
	switch( rand()%10 ) {
		case 0:
		case 1:
		case 2:
		case 3:
		case 4:
		case 5:
			break;
		case 6:
		case 7:
			myStats->shield = newItem(WOODEN_SHIELD,DECREPIT,-1+rand()%2,1,rand(),FALSE,NULL);
			break;
		case 8:
			myStats->shield = newItem(BRONZE_SHIELD,DECREPIT,-1+rand()%2,1,rand(),FALSE,NULL);
			break;
		case 9:
			myStats->shield = newItem(IRON_SHIELD,DECREPIT,-1+rand()%2,1,rand(),FALSE,NULL);
			break;
	}
	
	// give weapon
	if( rand()%50 || my->flags[USERFLAG2] ) {
		if( strncmp(map.name,"Underworld",10) ) {
			switch( rand()%10 ) {
				case 0:
				case 1:
					myStats->weapon = newItem(BRONZE_AXE,WORN,-1+rand()%2,1,rand(),FALSE,NULL);
					break;
				case 2:
				case 3:
					myStats->weapon = newItem(BRONZE_SWORD,WORN,-1+rand()%2,1,rand(),FALSE,NULL);
					break;
				case 4:
				case 5:
					myStats->weapon = newItem(IRON_SPEAR,WORN,-1+rand()%2,1,rand(),FALSE,NULL);
					break;
				case 6:
				case 7:
					myStats->weapon = newItem(IRON_AXE,WORN,-1+rand()%2,1,rand(),FALSE,NULL);
					break;
				case 8:
				case 9:
					myStats->weapon = newItem(IRON_SWORD,WORN,-1+rand()%2,1,rand(),FALSE,NULL);
					break;
			}
		} else {
			switch( rand()%10 ) {
				case 0:
				case 1:
				case 2:
				case 3:
					myStats->weapon = newItem(SHORTBOW,WORN,-1+rand()%2,1,rand(),FALSE,NULL);
					break;
				case 4:
				case 5:
				case 6:
				case 7:
					myStats->weapon = newItem(CROSSBOW,WORN,-1+rand()%2,1,rand(),FALSE,NULL);
					break;
				case 8:
				case 9:
					myStats->weapon = newItem(MAGICSTAFF_COLD,EXCELLENT,-1+rand()%2,1,rand(),FALSE,NULL);
					break;
			}
		}
	} else {
		myStats->HP = 100; myStats->MAXHP = 100;
		strcpy(myStats->name,"Funny Bones");
		myStats->weapon = newItem(ARTIFACT_AXE,EXCELLENT,1,1,rand(),TRUE,NULL);
		myStats->cloak = newItem(CLOAK_PROTECTION,WORN,0,1,2,TRUE,NULL);
	}
}
예제 #19
0
void initGoblin(Entity *my, Stat *myStats) {
	int c;
	node_t *node;

	my->sprite = 180; //Goblin head model

	//my->flags[GENIUS] = TRUE;
	my->flags[UPDATENEEDED]=TRUE;
	my->flags[BLOCKSIGHT]=TRUE;
	my->flags[INVISIBLE]=FALSE;

	if( multiplayer!=CLIENT ) {
		MONSTER_SPOTSND = 60;
		MONSTER_SPOTVAR = 3;
		MONSTER_IDLESND = 98;
		MONSTER_IDLEVAR = 3;
	}
	if( multiplayer!=CLIENT && !MONSTER_INIT ) {
		myStats->sex = static_cast<sex_t>(rand()%2);
		myStats->appearance = rand();
		strcpy(myStats->name,"");
		myStats->inventory.first = NULL;
		myStats->inventory.last = NULL;
		myStats->HP = 60; myStats->MAXHP = 60;
		myStats->MP = 20; myStats->MAXMP = 20;
		myStats->OLDHP = myStats->HP;
		myStats->STR = 6;
		myStats->DEX = 0;
		myStats->CON = 2;
		myStats->INT = -1;
		myStats->PER = 0;
		myStats->CHR = -1;
		myStats->EXP = 0;
		myStats->LVL = 6;
		if( rand()%3==0 ) {
			myStats->GOLD = 10+rand()%20;
		} else {
			myStats->GOLD = 0;
		}
		myStats->HUNGER = 900;
		if( !myStats->leader_uid )
			myStats->leader_uid = 0;
		myStats->FOLLOWERS.first=NULL; myStats->FOLLOWERS.last=NULL;
		for( c=0; c<std::max(NUMPROFICIENCIES,NUMEFFECTS); c++ ) {
			if( c<NUMPROFICIENCIES )
				myStats->PROFICIENCIES[c]=0;
			if( c<NUMEFFECTS )
				myStats->EFFECTS[c]=FALSE;
			if( c<NUMEFFECTS )
				myStats->EFFECTS_TIMERS[c]=0;
		}
		myStats->PROFICIENCIES[PRO_SWORD]=35;
		myStats->PROFICIENCIES[PRO_MACE]=50;
		myStats->PROFICIENCIES[PRO_AXE]=45;
		myStats->PROFICIENCIES[PRO_POLEARM]=25;
		myStats->PROFICIENCIES[PRO_RANGED]=35;
		myStats->PROFICIENCIES[PRO_SHIELD]=35;
		myStats->helmet = NULL;
		myStats->breastplate = NULL;
		myStats->gloves = NULL;
		myStats->shoes = NULL;
		myStats->shield = NULL;
		myStats->weapon = NULL;
		myStats->cloak = NULL;
		myStats->amulet = NULL;
		myStats->ring = NULL;
		myStats->mask = NULL;

		if( rand()%8==0 ) {
			myStats->EFFECTS[EFF_ASLEEP] = TRUE;
			myStats->EFFECTS_TIMERS[EFF_ASLEEP] = 1800+rand()%1800;
		}
	}

	// torso
	Entity *entity = newEntity(183, 0, map.entities);
	entity->sizex = 4;
	entity->sizey = 4;
	entity->skill[2] = my->uid;
	entity->scalex = 1.01;
	entity->scaley = 1.01;
	entity->scalez = 1.01;
	entity->flags[PASSABLE]=TRUE;
	entity->flags[NOUPDATE]=TRUE;
	entity->flags[USERFLAG2]=my->flags[USERFLAG2];
	entity->focalx=limbs[GOBLIN][1][0]; // 0
	entity->focaly=limbs[GOBLIN][1][1]; // 0
	entity->focalz=limbs[GOBLIN][1][2]; // 0
	entity->behavior=&actGoblinLimb;
	entity->parent=my->uid;
	node = list_AddNodeLast(&my->children);
	node->element = entity;
	node->deconstructor = &emptyDeconstructor;
	node->size = sizeof(Entity *);

	// right leg
	entity = newEntity(182, 0, map.entities);
	entity->sizex = 4;
	entity->sizey = 4;
	entity->skill[2] = my->uid;
	entity->flags[PASSABLE]=TRUE;
	entity->flags[NOUPDATE]=TRUE;
	entity->flags[USERFLAG2]=my->flags[USERFLAG2];
	entity->focalx=limbs[GOBLIN][2][0]; // 0
	entity->focaly=limbs[GOBLIN][2][1]; // 0
	entity->focalz=limbs[GOBLIN][2][2]; // 2
	entity->behavior=&actGoblinLimb;
	entity->parent=my->uid;
	node = list_AddNodeLast(&my->children);
	node->element = entity;
	node->deconstructor = &emptyDeconstructor;
	node->size = sizeof(Entity *);

	// left leg
	entity = newEntity(181, 0, map.entities);
	entity->sizex = 4;
	entity->sizey = 4;
	entity->skill[2] = my->uid;
	entity->flags[PASSABLE]=TRUE;
	entity->flags[NOUPDATE]=TRUE;
	entity->flags[USERFLAG2]=my->flags[USERFLAG2];
	entity->focalx=limbs[GOBLIN][3][0]; // 0
	entity->focaly=limbs[GOBLIN][3][1]; // 0
	entity->focalz=limbs[GOBLIN][3][2]; // 2
	entity->behavior=&actGoblinLimb;
	entity->parent=my->uid;
	node = list_AddNodeLast(&my->children);
	node->element = entity;
	node->deconstructor = &emptyDeconstructor;
	node->size = sizeof(Entity *);

	// right arm
	entity = newEntity(178, 0, map.entities);
	entity->sizex = 4;
	entity->sizey = 4;
	entity->skill[2] = my->uid;
	entity->flags[PASSABLE]=TRUE;
	entity->flags[NOUPDATE]=TRUE;
	entity->flags[USERFLAG2]=my->flags[USERFLAG2];
	entity->focalx=limbs[GOBLIN][4][0]; // 0
	entity->focaly=limbs[GOBLIN][4][1]; // 0
	entity->focalz=limbs[GOBLIN][4][2]; // 1.5
	entity->behavior=&actGoblinLimb;
	entity->parent=my->uid;
	node = list_AddNodeLast(&my->children);
	node->element = entity;
	node->deconstructor = &emptyDeconstructor;
	node->size = sizeof(Entity *);

	// left arm
	entity = newEntity(176, 0, map.entities);
	entity->sizex = 4;
	entity->sizey = 4;
	entity->skill[2] = my->uid;
	entity->flags[PASSABLE]=TRUE;
	entity->flags[NOUPDATE]=TRUE;
	entity->flags[USERFLAG2]=my->flags[USERFLAG2];
	entity->focalx=limbs[GOBLIN][5][0]; // 0
	entity->focaly=limbs[GOBLIN][5][1]; // 0
	entity->focalz=limbs[GOBLIN][5][2]; // 1.5
	entity->behavior=&actGoblinLimb;
	entity->parent=my->uid;
	node = list_AddNodeLast(&my->children);
	node->element = entity;
	node->deconstructor = &emptyDeconstructor;
	node->size = sizeof(Entity *);

	// world weapon
	entity = newEntity(-1, 0, map.entities);
	entity->sizex = 4;
	entity->sizey = 4;
	entity->skill[2] = my->uid;
	entity->flags[PASSABLE]=TRUE;
	entity->flags[NOUPDATE]=TRUE;
	entity->flags[USERFLAG2]=my->flags[USERFLAG2];
	entity->focalx=limbs[GOBLIN][6][0]; // 1.5
	entity->focaly=limbs[GOBLIN][6][1]; // 0
	entity->focalz=limbs[GOBLIN][6][2]; // -.5
	entity->behavior=&actGoblinLimb;
	entity->parent=my->uid;
	entity->pitch=.25;
	node = list_AddNodeLast(&my->children);
	node->element = entity;
	node->deconstructor = &emptyDeconstructor;
	node->size = sizeof(Entity *);

	// shield
	entity = newEntity(-1, 0, map.entities);
	entity->sizex = 4;
	entity->sizey = 4;
	entity->skill[2] = my->uid;
	entity->flags[PASSABLE]=TRUE;
	entity->flags[NOUPDATE]=TRUE;
	entity->flags[USERFLAG2]=my->flags[USERFLAG2];
	entity->focalx=limbs[GOBLIN][7][0]; // 2
	entity->focaly=limbs[GOBLIN][7][1]; // 0
	entity->focalz=limbs[GOBLIN][7][2]; // 0
	entity->behavior=&actGoblinLimb;
	entity->parent=my->uid;
	node = list_AddNodeLast(&my->children);
	node->element = entity;
	node->deconstructor = &emptyDeconstructor;
	node->size = sizeof(Entity *);

	// cloak
	entity = newEntity(-1, 0, map.entities);
	entity->sizex = 4;
	entity->sizey = 4;
	entity->skill[2] = my->uid;
	entity->flags[PASSABLE]=TRUE;
	entity->flags[NOUPDATE]=TRUE;
	entity->flags[USERFLAG2]=my->flags[USERFLAG2];
	entity->focalx=limbs[GOBLIN][8][0]; // 0
	entity->focaly=limbs[GOBLIN][8][1]; // 0
	entity->focalz=limbs[GOBLIN][8][2]; // 4
	entity->behavior=&actGoblinLimb;
	entity->parent=my->uid;
	node = list_AddNodeLast(&my->children);
	node->element = entity;
	node->deconstructor = &emptyDeconstructor;
	node->size = sizeof(Entity *);

	// helmet
	entity = newEntity(-1, 0, map.entities);
	entity->sizex = 4;
	entity->sizey = 4;
	entity->skill[2] = my->uid;
	entity->scalex = 1.01;
	entity->scaley = 1.01;
	entity->scalez = 1.01;
	entity->flags[PASSABLE]=TRUE;
	entity->flags[NOUPDATE]=TRUE;
	entity->flags[USERFLAG2]=my->flags[USERFLAG2];
	entity->focalx=limbs[GOBLIN][9][0]; // 0
	entity->focaly=limbs[GOBLIN][9][1]; // 0
	entity->focalz=limbs[GOBLIN][9][2]; // -2
	entity->behavior=&actGoblinLimb;
	entity->parent=my->uid;
	node = list_AddNodeLast(&my->children);
	node->element = entity;
	node->deconstructor = &emptyDeconstructor;
	node->size = sizeof(Entity *);

	// mask
	entity = newEntity(-1, 0, map.entities);
	entity->sizex = 4;
	entity->sizey = 4;
	entity->skill[2] = my->uid;
	entity->flags[PASSABLE]=TRUE;
	entity->flags[NOUPDATE]=TRUE;
	entity->flags[USERFLAG2]=my->flags[USERFLAG2];
	entity->focalx=limbs[GOBLIN][10][0]; // 0
	entity->focaly=limbs[GOBLIN][10][1]; // 0
	entity->focalz=limbs[GOBLIN][10][2]; // .25
	entity->behavior=&actGoblinLimb;
	entity->parent=my->uid;
	node = list_AddNodeLast(&my->children);
	node->element = entity;
	node->deconstructor = &emptyDeconstructor;
	node->size = sizeof(Entity *);
	
	if( multiplayer==CLIENT || MONSTER_INIT )
		return;
	
	// give cloak
	switch( rand()%10 ) {
		case 0:
		case 1:
		case 2:
		case 3:
		case 4:
		case 5:
			break;
		case 6:
		case 7:
		case 8:
			myStats->cloak = newItem(CLOAK,WORN,-1+rand()%3,1,rand(),FALSE,NULL);
			break;
		case 9:
			myStats->cloak = newItem(CLOAK_MAGICREFLECTION,WORN,0,1,rand(),FALSE,NULL);
			break;
	}
	
	// give shield
	switch( rand()%10 ) {
		case 0:
		case 1:
			myStats->shield = newItem(TOOL_TORCH,SERVICABLE,-1+rand()%3,1,rand(),FALSE,NULL);
			break;
		case 2:
		case 3:
		case 4:
			break;
		case 5:
		case 6:
			myStats->shield = newItem(WOODEN_SHIELD,DECREPIT,-1+rand()%3,1,rand(),FALSE,NULL);
			break;
		case 7:
		case 8:
			myStats->shield = newItem(BRONZE_SHIELD,DECREPIT,-1+rand()%3,1,rand(),FALSE,NULL);
			break;
		case 9:
			myStats->shield = newItem(IRON_SHIELD,DECREPIT,-1+rand()%3,1,rand(),FALSE,NULL);
			break;
	}
	
	// give armor
	switch( rand()%10 ) {
		case 0:
		case 1:
		case 2:
		case 3:
		case 4:
			break;
		case 5:
		case 6:
		case 7:
			myStats->breastplate = newItem(LEATHER_BREASTPIECE,DECREPIT,-1+rand()%3,1,rand(),FALSE,NULL);
			break;
		case 8:
		case 9:
			myStats->breastplate = newItem(IRON_BREASTPIECE,DECREPIT,-1+rand()%3,1,rand(),FALSE,NULL);
			break;
	}
	
	if( rand()%50 || my->flags[USERFLAG2] ) {
		// give weapon
		switch( rand()%10 ) {
			case 0:
			case 1:
			case 2:
				myStats->weapon = newItem(SHORTBOW,WORN,-1+rand()%3,1,rand(),FALSE,NULL);
				break;
			case 3:
			case 4:
			case 5:
				myStats->weapon = newItem(BRONZE_AXE,WORN,-1+rand()%3,1,rand(),FALSE,NULL);
				break;
			case 6:
			case 7:
				myStats->weapon = newItem(IRON_MACE,WORN,-1+rand()%3,1,rand(),FALSE,NULL);
				break;
			case 8:
				myStats->weapon = newItem(IRON_AXE,WORN,-1+rand()%3,1,rand(),FALSE,NULL);
				break;
			case 9:
				myStats->weapon = newItem(MAGICSTAFF_FIRE,EXCELLENT,-1+rand()%3,1,rand(),FALSE,NULL);
				break;
		}
	
		// give helmet
		switch( rand()%10 ) {
			case 0:
			case 1:
			case 2:
				break;
			case 3:
			case 4:
				myStats->helmet = newItem(HAT_PHRYGIAN,WORN,-1+rand()%3,1,0,FALSE,NULL);
				break;
			case 5:
				myStats->helmet = newItem(HAT_WIZARD,WORN,-1+rand()%3,1,0,FALSE,NULL);
				break;
			case 6:
			case 7:
				myStats->helmet = newItem(LEATHER_HELM,WORN,-1+rand()%3,1,0,FALSE,NULL);
				break;
			case 8:
			case 9:
				myStats->helmet = newItem(IRON_HELM,WORN,-1+rand()%3,1,0,FALSE,NULL);
				break;
		}
	} else {
		myStats->HP = 120; myStats->MAXHP = 120;
		myStats->OLDHP = myStats->HP;
		strcpy(myStats->name,"The Potato King");
		myStats->weapon = newItem(ARTIFACT_MACE,EXCELLENT,1,1,rand(),TRUE,NULL);
		myStats->helmet = newItem(HAT_JESTER,SERVICABLE,3+rand()%3,1,0,FALSE,NULL);

		int c;
		for( c=0; c<3; c++ ) {
			Entity *entity = summonMonster(GOBLIN,my->x,my->y);
			if( entity )
				entity->parent = my->uid;
		}
	}
}
예제 #20
0
int ExtractSIFT::compute()
{
	ccPointCloud* cloud = getSelectedEntityAsCCPointCloud();
	if (!cloud)
		return -1;

	PCLCloud::Ptr sm_cloud (new PCLCloud);

	std::vector<std::string> req_fields;
	req_fields.resize(2);
	req_fields[0] = "xyz"; // always needed
	switch (m_mode)
	{
	case RGB:
		req_fields[1] = "rgb";
		break;
	case SCALAR_FIELD:
		req_fields[1] = m_field_to_use;
		break;
	}

	cc2smReader converter;
	converter.setInputCloud(cloud);
	converter.getAsSM(req_fields, *sm_cloud);

	//Now change the name of the field to use to a standard name, only if in OTHER_FIELD mode
	if (m_mode == SCALAR_FIELD)
	{
		int field_index = pcl::getFieldIndex(*sm_cloud, m_field_to_use_no_space);
		sm_cloud->fields.at(field_index).name = "intensity"; //we always use intensity as name... even if it is curvature or another field.
	}

	//initialize all possible clouds
	pcl::PointCloud<pcl::PointXYZI>::Ptr cloud_i (new pcl::PointCloud<pcl::PointXYZI>);
	pcl::PointCloud<pcl::PointXYZRGB>::Ptr cloud_rgb (new pcl::PointCloud<pcl::PointXYZRGB>);
	pcl::PointCloud<pcl::PointXYZ>::Ptr out_cloud (new pcl::PointCloud<pcl::PointXYZ>);

	//Now do the actual computation
	if (m_mode == SCALAR_FIELD)
	{
		FROM_PCL_CLOUD(*sm_cloud, *cloud_i);
		estimateSIFT<pcl::PointXYZI, pcl::PointXYZ>(cloud_i, out_cloud, m_nr_octaves, m_min_scale, m_nr_scales_per_octave, m_min_contrast );
	}
	else if (m_mode == RGB)
	{
		FROM_PCL_CLOUD(*sm_cloud, *cloud_rgb);
		estimateSIFT<pcl::PointXYZRGB, pcl::PointXYZ>(cloud_rgb, out_cloud, m_nr_octaves, m_min_scale, m_nr_scales_per_octave, m_min_contrast );
	}

	PCLCloud::Ptr out_cloud_sm (new PCLCloud);
	TO_PCL_CLOUD(*out_cloud, *out_cloud_sm);

	if ( (out_cloud_sm->height * out_cloud_sm->width) == 0)
	{
		//cloud is empty
		return -53;
	}

	ccPointCloud* out_cloud_cc = sm2ccConverter(out_cloud_sm).getCCloud();
	if (!out_cloud_cc)
	{
		//conversion failed (not enough memory?)
		return -1;
	}

	std::stringstream name;
	if (m_mode == RGB)
		name << "SIFT Keypoints_" << m_nr_octaves << "_" << "rgb" << "_" << m_min_scale << "_" << m_nr_scales_per_octave << "_" << m_min_contrast;
	else
		name << "SIFT Keypoints_" << m_nr_octaves << "_" << m_field_to_use_no_space  << "_" << m_min_scale << "_" << m_nr_scales_per_octave << "_" << m_min_contrast;

	out_cloud_cc->setName(name.str().c_str());
	out_cloud_cc->setDisplay(cloud->getDisplay());
	if (cloud->getParent())
		cloud->getParent()->addChild(out_cloud_cc);

	emit newEntity(out_cloud_cc);

	return 1;
}
예제 #21
0
int main(void)
{
  Display *d = newDisplay();
  cell grid[H][W];
  entity *player, *door1, *door2;
  int in,gamesPlayed[2];
  srand(time(NULL));
  gamesPlayed[0]=gamesPlayed[1]=0;

  mediaLoad(d);
  intro(d);
  initGrid(grid);
   // place player
  player = grid[10][2].foreground = newEntity(passable,P_R1 ,2,10);
   // Creates the boundary walls
  makeBoundariesLobby(grid);

  door1 = grid[4][W-6].background = newEntity(passable,DOORINVIS, W-6,4);
  door2 = grid[7][W-11].background = newEntity(passable,DOORINVIS ,W-11,7);

  /* layer of floortiles -
  must be the last entity placement*/
  fillGrid(grid);


  while(in!=10){
    if(gamesPlayed[0]!=MAXPLAYTIMES||gamesPlayed[1]!=MAXPLAYTIMES){
      lobbyDraw(d, grid);
      in=input(d);
      if( (in > 0) && (in < 5) ){ /*checks for arrowkeys */
        move(&grid[player->y][player->x],player->x,player->y,(direction)in,grid);
        printGrid(grid);
      }
    }
    else{
          GameOver(d,&in);
          if(in!=10){
          gamesPlayed[0]=gamesPlayed[1]=0;
        }
        else{
          /*in==10 the same as d->finished=true;*/
          in=10;
          d->finished=(SDL_bool)true;
        }
    }
    if (grid[player->y][player->x].background == door1&&gamesPlayed[0]<MAXPLAYTIMES) {
      bgame(d);
      gamesPlayed[0]++;
      move(&grid[player->y][player->x],player->x,player->y,DOWN,grid);
      changeEntity(player, P_DOWN1);
    }
    if (grid[player->y][player->x].background == door2&&gamesPlayed[1]<MAXPLAYTIMES) {
      quizGame(d);
      gamesPlayed[1]++;
      move(&grid[player->y][player->x],player->x,player->y,DOWN,grid);
      changeEntity(player, P_DOWN1);
    }
  }
  freeEntityMem(grid);  /* free memory */
  closeDisplay(d);
  d->finished=(SDL_bool)true;
  fprintf(OUTPUT, "\n\n");
  return(0);
}
예제 #22
0
int boulderCheckAgainstEntity(Entity *my, Entity *entity) {
	if (!my || !entity)
		return 0;

	if( entity->behavior == &actPlayer || entity->behavior == &actMonster ) {
		if( entityInsideEntity( my, entity ) ) {
			Stat *stats = entity->getStats();
			if( stats ) {
				if( entity->behavior==&actPlayer ) {
					Uint32 color = SDL_MapRGB(mainsurface->format,255,0,0);
					messagePlayerColor(entity->skill[2],color,language[455]);
					if( entity->skill[2] == clientnum ) {
						camera_shakex += .1;
						camera_shakey += 10;
					} else {
						strcpy((char *)net_packet->data,"SHAK");
						net_packet->data[4]=10; // turns into .1
						net_packet->data[5]=10;
						net_packet->address.host = net_clients[entity->skill[2]-1].host;
						net_packet->address.port = net_clients[entity->skill[2]-1].port;
						net_packet->len = 6;
						sendPacketSafe(net_sock, -1, net_packet, entity->skill[2]-1);
					}
				}
				playSoundEntity(my,181,128);
				playSoundEntity(entity,28,64);
				spawnGib(entity);
				entity->modHP(-80);
				entity->setObituary(language[1505]);
				if( entity->behavior==&actPlayer )
					if( stats->HP<=0 )
						steamAchievementClient(entity->skill[2],"BARONY_ACH_THROW_ME_THE_WHIP");
				if( stats->HP > 0 ) {
					// spawn several rock items
					int i = 8+rand()%4;
					
					int c;
					for( c=0; c<i; c++ ) {
						Entity *entity = newEntity(-1,1,map.entities);
						entity->flags[INVISIBLE]=TRUE;
						entity->flags[UPDATENEEDED]=TRUE;
						entity->x = my->x - 4 + rand()%8;
						entity->y = my->y - 4 + rand()%8;
						entity->z = -6+rand()%12;
						entity->sizex = 4;
						entity->sizey = 4;
						entity->yaw = rand()%360 * PI/180;
						entity->vel_x = (rand()%20-10)/10.0;
						entity->vel_y = (rand()%20-10)/10.0;
						entity->vel_z = -.25 - (rand()%5)/10.0;
						entity->flags[PASSABLE] = TRUE;
						entity->behavior = &actItem;
						entity->flags[USERFLAG1] = TRUE; // no collision: helps performance
						entity->skill[10] = GEM_ROCK;    // type
						entity->skill[11] = WORN;        // status
						entity->skill[12] = 0;           // beatitude
						entity->skill[13] = 1;           // count
						entity->skill[14] = 0;           // appearance
						entity->skill[15] = FALSE;       // identified
					}

					double ox = my->x;
					double oy = my->y;
					
					// destroy the boulder
					playSoundEntity(my,67,128);
					list_RemoveNode(my->mynode);

					// on sokoban, destroying boulders spawns scorpions
					if( !strcmp(map.name,"Sokoban") ) {
						Entity *monster = summonMonster(SCORPION,ox,oy);
						if( monster ) {
							int c;
							for( c=0; c<MAXPLAYERS; c++ ) {
								Uint32 color = SDL_MapRGB(mainsurface->format,255,128,0);
								messagePlayerColor(c,color,language[406]);
							}
						}
					}

					return 1;
				}
			}
		}
	} else if( entity->behavior == &actGate || entity->behavior == &actBoulder || entity->behavior==&actChest || entity->behavior==&actHeadstone || entity->behavior==&actFountain || entity->behavior==&actSink ) {
		if( !entity->flags[PASSABLE] ) {
			if( entityInsideEntity( my, entity ) ) {
				// stop the boulder
				BOULDER_STOPPED=1;
				BOULDER_ROLLING=0;
				playSoundEntity(my,181,128);
				if( my->flags[PASSABLE] ) {
					my->flags[PASSABLE] = FALSE;
					if( multiplayer==SERVER )
						serverUpdateEntityFlag(my,PASSABLE);
				}
			}
		}
	} else if( entity->behavior == &actDoor ) {
		if( entityInsideEntity( my, entity ) ) {
			playSoundEntity(entity,28,64);
			entity->skill[4] = 0;
			if( !entity->skill[0] )
				entity->skill[6] = (my->x > entity->x);
			else
				entity->skill[6] = (my->y < entity->y);
			playSoundEntity(my,181,128);
		}
	}
	return 0;
}
예제 #23
0
void initGnome(Entity *my, Stat *myStats) {
	int c;
	node_t *node;

	my->sprite = 295; //Gnome head model

	my->flags[UPDATENEEDED]=TRUE;
	my->flags[BLOCKSIGHT]=TRUE;
	my->flags[INVISIBLE]=FALSE;

	if( multiplayer!=CLIENT ) {
		MONSTER_SPOTSND = 220;
		MONSTER_SPOTVAR = 5;
		MONSTER_IDLESND = 217;
		MONSTER_IDLEVAR = 3;
	}
	if( multiplayer!=CLIENT && !MONSTER_INIT ) {
		myStats->sex = static_cast<sex_t>(rand()%2);
		myStats->appearance = rand();
		strcpy(myStats->name,"");
		myStats->inventory.first = NULL;
		myStats->inventory.last = NULL;
		myStats->HP = 50; myStats->MAXHP = 50;
		myStats->MP = 50; myStats->MAXMP = 50;
		myStats->OLDHP = myStats->HP;
		myStats->STR = 2;
		myStats->DEX = 0;
		myStats->CON = 4;
		myStats->INT = 0;
		myStats->PER = 2;
		myStats->CHR = -1;
		myStats->EXP = 0;
		myStats->LVL = 5;
		myStats->GOLD = 40+rand()%20;
		myStats->HUNGER = 900;
		if( !myStats->leader_uid )
			myStats->leader_uid = 0;
		myStats->FOLLOWERS.first=NULL; myStats->FOLLOWERS.last=NULL;
		for( c=0; c<std::max(NUMPROFICIENCIES,NUMEFFECTS); c++ ) {
			if( c<NUMPROFICIENCIES )
				myStats->PROFICIENCIES[c]=0;
			if( c<NUMEFFECTS )
				myStats->EFFECTS[c]=FALSE;
			if( c<NUMEFFECTS )
				myStats->EFFECTS_TIMERS[c]=0;
		}
		myStats->PROFICIENCIES[PRO_SWORD]=35;
		myStats->PROFICIENCIES[PRO_MACE]=50;
		myStats->PROFICIENCIES[PRO_AXE]=45;
		myStats->PROFICIENCIES[PRO_POLEARM]=25;
		myStats->PROFICIENCIES[PRO_RANGED]=35;
		myStats->PROFICIENCIES[PRO_SHIELD]=35;
		myStats->helmet = NULL;
		myStats->breastplate = NULL;
		myStats->gloves = NULL;
		myStats->shoes = NULL;
		myStats->shield = NULL;
		myStats->weapon = NULL;
		myStats->cloak = NULL;
		myStats->amulet = NULL;
		myStats->ring = NULL;
		myStats->mask = NULL;

		if( rand()%8==0 ) {
			myStats->EFFECTS[EFF_ASLEEP] = TRUE;
			myStats->EFFECTS_TIMERS[EFF_ASLEEP] = 1800+rand()%1800;
		}

		if( rand()%3==0 )
			newItem( FOOD_FISH, EXCELLENT, 0, 1, rand(), FALSE, &myStats->inventory );

		if( rand()%50==0 )
			newItem( READABLE_BOOK, EXCELLENT, 0, 1, getBook("Winny's Report"), FALSE, &myStats->inventory );

		if( rand()%10==0 ) {
			int i = 1+rand()%4;
			for( c=0; c<i; c++ )
				newItem( static_cast<ItemType>(GEM_GARNET+rand()%15), static_cast<Status>(1+rand()%4), 0, 1, rand(), FALSE, &myStats->inventory );
		}

		if( rand()%50==0 && !my->flags[USERFLAG2] ) {
			strcpy(myStats->name,"Rumplewort");
			myStats->LVL += 10;
			newItem( GEM_DIAMOND, static_cast<Status>(1+rand()%4), 0, 1, rand(), TRUE, &myStats->inventory );

			int c;
			for( c=0; c<3; c++ ) {
				Entity *entity = summonMonster(GNOME,my->x,my->y);
				if( entity )
					entity->parent = my->uid;
			}
		}
	}

	// torso
	Entity *entity = newEntity(296, 0, map.entities);
	entity->sizex = 4;
	entity->sizey = 4;
	entity->skill[2] = my->uid;
	entity->flags[PASSABLE]=TRUE;
	entity->flags[NOUPDATE]=TRUE;
	entity->flags[USERFLAG2]=my->flags[USERFLAG2];
	entity->focalx = limbs[GNOME][1][0]; // 0
	entity->focaly = limbs[GNOME][1][1]; // 0
	entity->focalz = limbs[GNOME][1][2]; // 0
	entity->behavior=&actGnomeLimb;
	entity->parent=my->uid;
	node = list_AddNodeLast(&my->children);
	node->element = entity;
	node->deconstructor = &emptyDeconstructor;
	node->size = sizeof(Entity *);

	// right leg
	entity = newEntity(297, 0, map.entities);
	entity->sizex = 4;
	entity->sizey = 4;
	entity->skill[2] = my->uid;
	entity->flags[PASSABLE]=TRUE;
	entity->flags[NOUPDATE]=TRUE;
	entity->flags[USERFLAG2]=my->flags[USERFLAG2];
	entity->focalx = limbs[GNOME][2][0]; // .25
	entity->focaly = limbs[GNOME][2][1]; // 0
	entity->focalz = limbs[GNOME][2][2]; // 1.5
	entity->behavior=&actGnomeLimb;
	entity->parent=my->uid;
	node = list_AddNodeLast(&my->children);
	node->element = entity;
	node->deconstructor = &emptyDeconstructor;
	node->size = sizeof(Entity *);

	// left leg
	entity = newEntity(298, 0, map.entities);
	entity->sizex = 4;
	entity->sizey = 4;
	entity->skill[2] = my->uid;
	entity->flags[PASSABLE]=TRUE;
	entity->flags[NOUPDATE]=TRUE;
	entity->flags[USERFLAG2]=my->flags[USERFLAG2];
	entity->focalx = limbs[GNOME][3][0]; // .25
	entity->focaly = limbs[GNOME][3][1]; // 0
	entity->focalz = limbs[GNOME][3][2]; // 1.5
	entity->behavior=&actGnomeLimb;
	entity->parent=my->uid;
	node = list_AddNodeLast(&my->children);
	node->element = entity;
	node->deconstructor = &emptyDeconstructor;
	node->size = sizeof(Entity *);

	// right arm
	entity = newEntity(299, 0, map.entities);
	entity->sizex = 4;
	entity->sizey = 4;
	entity->skill[2] = my->uid;
	entity->flags[PASSABLE]=TRUE;
	entity->flags[NOUPDATE]=TRUE;
	entity->flags[USERFLAG2]=my->flags[USERFLAG2];
	entity->focalx = limbs[GNOME][4][0]; // 0
	entity->focaly = limbs[GNOME][4][1]; // 0
	entity->focalz = limbs[GNOME][4][2]; // 2
	entity->behavior=&actGnomeLimb;
	entity->parent=my->uid;
	node = list_AddNodeLast(&my->children);
	node->element = entity;
	node->deconstructor = &emptyDeconstructor;
	node->size = sizeof(Entity *);

	// left arm
	entity = newEntity(301, 0, map.entities);
	entity->sizex = 4;
	entity->sizey = 4;
	entity->skill[2] = my->uid;
	entity->flags[PASSABLE]=TRUE;
	entity->flags[NOUPDATE]=TRUE;
	entity->flags[USERFLAG2]=my->flags[USERFLAG2];
	entity->focalx = limbs[GNOME][5][0]; // 0
	entity->focaly = limbs[GNOME][5][1]; // 0
	entity->focalz = limbs[GNOME][5][2]; // 2
	entity->behavior=&actGnomeLimb;
	entity->parent=my->uid;
	node = list_AddNodeLast(&my->children);
	node->element = entity;
	node->deconstructor = &emptyDeconstructor;
	node->size = sizeof(Entity *);

	// world weapon
	entity = newEntity(-1, 0, map.entities);
	entity->sizex = 4;
	entity->sizey = 4;
	entity->skill[2] = my->uid;
	entity->flags[PASSABLE]=TRUE;
	entity->flags[NOUPDATE]=TRUE;
	entity->flags[INVISIBLE]=TRUE;
	entity->flags[USERFLAG2]=my->flags[USERFLAG2];
	entity->focalx = limbs[GNOME][6][0]; // 2
	entity->focaly = limbs[GNOME][6][1]; // 0
	entity->focalz = limbs[GNOME][6][2]; // -.5
	entity->behavior=&actGnomeLimb;
	entity->parent=my->uid;
	entity->pitch=.25;
	node = list_AddNodeLast(&my->children);
	node->element = entity;
	node->deconstructor = &emptyDeconstructor;
	node->size = sizeof(Entity *);

	// shield
	entity = newEntity(-1, 0, map.entities);
	entity->sizex = 4;
	entity->sizey = 4;
	entity->skill[2] = my->uid;
	entity->flags[PASSABLE]=TRUE;
	entity->flags[NOUPDATE]=TRUE;
	entity->flags[INVISIBLE]=TRUE;
	entity->flags[USERFLAG2]=my->flags[USERFLAG2];
	entity->focalx = limbs[GNOME][7][0]; // 0
	entity->focaly = limbs[GNOME][7][1]; // 0
	entity->focalz = limbs[GNOME][7][2]; // 1.5
	entity->behavior=&actGnomeLimb;
	entity->parent=my->uid;
	node = list_AddNodeLast(&my->children);
	node->element = entity;
	node->deconstructor = &emptyDeconstructor;
	node->size = sizeof(Entity *);

	// cloak
	entity = newEntity(-1, 0, map.entities);
	entity->sizex = 4;
	entity->sizey = 4;
	entity->skill[2] = my->uid;
	entity->scalex = 1.01;
	entity->scaley = 1.01;
	entity->scalez = 1.01;
	entity->flags[PASSABLE]=TRUE;
	entity->flags[NOUPDATE]=TRUE;
	entity->flags[INVISIBLE]=TRUE;
	entity->flags[USERFLAG2]=my->flags[USERFLAG2];
	entity->focalx = limbs[GNOME][8][0]; // 0
	entity->focaly = limbs[GNOME][8][1]; // 0
	entity->focalz = limbs[GNOME][8][2]; // 4
	entity->behavior=&actGnomeLimb;
	entity->parent=my->uid;
	node = list_AddNodeLast(&my->children);
	node->element = entity;
	node->deconstructor = &emptyDeconstructor;
	node->size = sizeof(Entity *);
	
	if( multiplayer==CLIENT || MONSTER_INIT )
		return;
	
	// give shield
	switch( rand()%10 ) {
		case 0:
		case 1:
			myStats->shield = newItem(TOOL_LANTERN,EXCELLENT,-1+rand()%3,1,rand(),FALSE,NULL);
			break;
		case 2:
		case 3:
		case 4:
		case 5:
		case 6:
			break;
		case 7:
		case 8:
		case 9:
			myStats->shield = newItem(WOODEN_SHIELD,static_cast<Status>(WORN+rand()%2),-1+rand()%3,1,rand(),FALSE,NULL);
			break;
	}
	
	// give weapon
	switch( rand()%10 ) {
		case 0:
		case 1:
		case 2:
		case 3:
		case 4:
			myStats->weapon = newItem(TOOL_PICKAXE,EXCELLENT,-1+rand()%3,1,rand(),FALSE,NULL);
			break;
		case 5:
		case 6:
		case 7:
		case 8:
		case 9:
			myStats->GOLD += 100;
			myStats->weapon = newItem(MAGICSTAFF_LIGHTNING,EXCELLENT,-1+rand()%3,1,rand(),FALSE,NULL);
			break;
	}
	
	// give cloak
	switch( rand()%10 ) {
		case 0:
		case 1:
		case 2:
		case 3:
		case 4:
		case 5:
			break;
		case 6:
		case 7:
		case 8:
		case 9:
			myStats->cloak = newItem(CLOAK,SERVICABLE,-1+rand()%3,1,rand(),FALSE,NULL);
			break;
	}
}
예제 #24
0
파일: LoadPCD.cpp 프로젝트: RobH616/trunk
int LoadPCD::compute()
{
	//for each selected filename
	for (int k = 0; k < m_filenames.size(); ++k)
	{
		Eigen::Vector4f origin;
		Eigen::Quaternionf orientation;

		QString filename = m_filenames[k];

		boost::shared_ptr<PCLCloud> cloud_ptr_in = loadSensorMessage(filename, origin, orientation);

		if (!cloud_ptr_in) //loading failed?
			return 0;

		PCLCloud::Ptr cloud_ptr;
		if (!cloud_ptr_in->is_dense) //data may contain nans. Remove them
		{
			//now we need to remove nans
			pcl::PassThrough<PCLCloud> passFilter;
			passFilter.setInputCloud(cloud_ptr_in);

			cloud_ptr = PCLCloud::Ptr(new PCLCloud);
			passFilter.filter(*cloud_ptr);
		}
		else
		{
			cloud_ptr = cloud_ptr_in;
		}

		//now we construct a ccGBLSensor with these characteristics
		ccGBLSensor * sensor = new ccGBLSensor;

		// get orientation as rot matrix
		Eigen::Matrix3f eigrot = orientation.toRotationMatrix();

		// and copy it into a ccGLMatrix
		ccGLMatrix ccRot;
		for (int i = 0; i < 3; ++i)
		{
			for (int j = 0; j < 3; ++j)
			{
				ccRot.getColumn(j)[i] = eigrot(i,j);
			}
		}

		ccRot.getColumn(3)[3] = 1.0;

		// now in a format good for CloudComapre
		//ccGLMatrix ccRot = ccGLMatrix::FromQuaternion(orientation.coeffs().data());

		//ccRot = ccRot.transposed();
		ccRot.setTranslation(origin.data());

		sensor->setRigidTransformation(ccRot);
		sensor->setDeltaPhi(static_cast<PointCoordinateType>(0.05));
		sensor->setDeltaTheta(static_cast<PointCoordinateType>(0.05));
		sensor->setVisible(true);

		//uncertainty to some default
		sensor->setUncertainty(static_cast<PointCoordinateType>(0.01));

		ccPointCloud* out_cloud = sm2ccConverter(cloud_ptr).getCloud();
		if (!out_cloud)
			return -31;

		sensor->setGraphicScale(out_cloud->getBB().getDiagNorm() / 10);

		//do the projection on sensor
		ccGenericPointCloud* cloud = ccHObjectCaster::ToGenericPointCloud(out_cloud);
		int errorCode;
		CCLib::SimpleCloud* projectedCloud = sensor->project(cloud,errorCode,true);
		if (projectedCloud)
		{
			//DGM: we don't use it but we still have to delete it!
			delete projectedCloud;
			projectedCloud = 0;
		}

		QString cloud_name = QFileInfo(filename).baseName();
		out_cloud->setName(cloud_name);

		QFileInfo fi(filename);
		QString containerName = QString("%1 (%2)").arg(fi.fileName()).arg(fi.absolutePath());

		ccHObject* cloudContainer = new ccHObject(containerName);
		out_cloud->addChild(sensor);
		cloudContainer->addChild(out_cloud);

		emit newEntity(cloudContainer);
	}

	return 1;
}
예제 #25
0
/* A simple example on using the provenance library
*/
int
main(int argc, char **argv, char** envp)
{
    ProvPtr p_prov = newProvenanceFactory("1");
    RecordPtr p_record = p_prov->p_record;
    IDREF id, act_id, used_id, genby_id;
    char arg[50];
    int i;

    addNamespace(p_prov, "https://github.com/INCF/ProvenanceLibrary/wiki/terms", "ni");

    // Add program information
    act_id = newActivity(p_record, NULL, "11/30/11 00:13:20.650432 EST", "11/30/11 00:13:20.650550 EST");
    addAttribute(p_record, act_id, "prov", "xsd:string", "type", "program");
    addAttribute(p_record, act_id, "ni", NULL, "name", argv[0]);
    addAttribute(p_record, act_id, "ni", NULL, "version", version);
    char * cmdline = get_cmdline(argc, argv);
    addAttribute(p_record, act_id, "ni", NULL, "cmdline", cmdline);
    free(cmdline);

    //Add all input parameters. if you use getopt this can be refined further
    for(i=1;i<argc; i++){
        id = newEntity(p_record);
	addAttribute(p_record, id, "prov", "xsd:string", "type", "input");
        sprintf(arg, "arg%d", i);
	addAttribute(p_record, id, NULL, NULL, arg, argv[i]);
	used_id = newUsedRecord(p_record, act_id, id, NULL);
	freeID(used_id);
	freeID(id);
    }

    id = newEntity(p_record);
    addAttribute(p_record, id, "prov", "xsd:string", "type", "environment");
    // add all environment variables
    char** env;
    for (env = envp; *env != 0; env++)
    {
       char* thisEnv = *env;
       char *name;
       char* p_index = thisEnv;
       int pos = 0;
       while (thisEnv[pos++] != '=');
       name = strndup(thisEnv, pos-1);
       if (name[0] != '_')
	   addAttribute(p_record, id, "ni", "xsd:string", name, &thisEnv[pos]);
       free(name);
    }
    freeID(id);

    id = newEntity(p_record);
    addAttribute(p_record, id, "prov", "xsd:string", "type", "runtime");
    // add runtime info such as walltime, cputime, host,
    freeID(id);

    id = newEntity(p_record);
    addAttribute(p_record, id, "prov", "xsd:string", "type", "output:file");
    addAttribute(p_record, id, "ni", NULL, "warped_file", "/full/path/to/file");
    genby_id = newGeneratedByRecord(p_record, id, act_id, NULL);
    freeID(id);
    freeID(genby_id);

    id = newEntity(p_record);
    addAttribute(p_record, id, "prov", "xsd:string", "type", "output:stat");
    addAttribute(p_record, id, "ni", NULL, "pearson_correlation_coefficient", ".234");
    genby_id = newGeneratedByRecord(p_record, id, act_id, NULL);
    freeID(id);
    freeID(genby_id);
    freeID(act_id);

    /* Test i/o manipulations */
    char *buffer;
    int bufsize;
    //print_provenance(p_prov, NULL);
    //fprintf(stdout, "==============\n");
    print_provenance(p_prov, "testprov.xml");
    dumpToMemoryBuffer(p_prov, &buffer, &bufsize);
    delProvenanceFactory(p_prov);
    p_prov = newProvenanceFactoryFromMemoryBuffer(buffer, bufsize);
    freeMemoryBuffer(buffer);
    delProvenanceFactory(p_prov);
    p_prov = newProvenanceFactoryFromFile("testprov.xml");
    ProvPtr p_prov2 = newProvenanceFactory("1");
    addProvAsAccount(p_prov2->p_record, p_prov, NULL);
    print_provenance(p_prov2, NULL);
    print_provenance(p_prov2, "testprov2.xml");
    delProvenanceFactory(p_prov);
    delProvenanceFactory(p_prov2);
    return(0);
}
예제 #26
0
int Analyzer::compute()
{

    ccHObject::Container outcrops = vombat::theInstance()->getAllObjectsSelectedBySPCDti(&spc::VirtualOutcrop::Type);

    if (outcrops.size() > 1 )
    {
        LOG(INFO) << "please select only one virtual outcrop on which to operate";
        return 1;
    }

    else if (outcrops.size() == 1)
    {
        m_root_outcrop = dynamic_cast<ccVirtualOutcrop *>(outcrops.at(0));
    }
    else
        m_root_outcrop = new ccVirtualOutcrop();


    ccHObject::Container regions, traces, links;

    regions = m_dialog->comboRegions->getChildrenOfSelectedObject(CC_TYPES::POLY_LINE);

    traces = m_dialog->comboTraces->getChildrenOfSelectedObject(CC_TYPES::POLY_LINE);

    links = m_dialog->comboLinks->getChildrenOfSelectedObject(CC_TYPES::POLY_LINE);


    LOG(INFO) << "found " << regions.size()  << " to be processed";
    LOG(INFO) << "Found " << links.size() << " links";
    LOG(INFO) << "Found " << traces.size() << " polylines";


    //    if (m_dialog->generateRegions())

    // this will be used to create links
    std::map<ccPolyline *, std::vector<std::vector<ccSample *>> > mapping;

    // first create selections out of regions
    for (ccHObject * obj : regions)
    {
        ccPolyline * line = ccHObjectCaster::ToPolyline(obj);

        ccPlanarSelection * sel = ccPlanarSelection::fromPolyline(*line);
        sel->setVisible(true);
        sel->setDepth(m_dialog->spinRegionDepth->value());
        m_root_outcrop->addChild(sel);

        ccHObject::Container  fittables;

        // for each region we crop polylines
        for (ccHObject * trace: traces)
        {
            ccPolyline * pline =  ccHObjectCaster::ToPolyline(trace);

            ccPointCloud * vertices = dynamic_cast<ccPointCloud *> (pline->getAssociatedCloud());

            ccPointCloud * cropped_vertices = sel->crop(vertices);

            if (cropped_vertices)
            {
                ccPolyline *cropped_pline = new ccPolyline(cropped_vertices);

                cropped_pline->addPointIndex(0, cropped_vertices->size()-1);
                cropped_pline->setVisible(true);
                if (m_dialog->checkBoxCropStrataTraces->checkState())
                    sel->addChild(cropped_pline);
            }

            fittables.push_back(cropped_vertices);
        }

        // for each region we try to find the links
        for (ccHObject * link: links)
        {
            // we need to see this link
            ccPolyline * pline =  ccHObjectCaster::ToPolyline(link);

            if (!pline)
                continue;

            ccPointCloud * vertices = dynamic_cast<ccPointCloud *> (pline->getAssociatedCloud());

            ccPointCloud * cropped_vertices = sel->crop(vertices);

            std::vector<ccSample * > mysamples;

            if (cropped_vertices && cropped_vertices->size() == 1) // we create just a point-like geoloical feature
            {

                    CCVector3 p;
                    cropped_vertices->getPoint(0, p);

                    ccSample * sample =  new ccSample(p);

                    mysamples.push_back(sample);

                    sample->setVisible(true);
                    sel->addChild(sample);
                    emit newEntity(sample); // notify we got a new entity
            }
            else if (cropped_vertices)
            {

                    ccLinearGeologicalFeature * linfeat = ccLinearGeologicalFeature::fromPointCloud(*cropped_vertices);
//                    CCVector3 p;
//                    cropped_vertices->getPoint(i, p);

//                    ccSample * sample =  new ccSample(p);

//                    mysamples.push_back(sample);

//                    mapping[cropped_pline].push_back(sample);

                    linfeat->setVisible(true);
                    sel->addChild(linfeat);
                    emit newEntity(linfeat); // notify we got a new entity
//                }
            }


            if (!mysamples.empty())
                mapping[pline].push_back(mysamples);

            fittables.push_back(cropped_vertices);

        }

        ccAttitude * attitude = FitAttitude::fitAttitude(fittables);
        if (m_dialog->checkBoxGenerateAttitudes->checkState())
            sel->addChild(attitude);


        if (m_dialog->checkBoxGenerateRulers->checkState())
        {
            spc::StratigraphicModelSingleAttitude::Ptr spcmodel( new spc::StratigraphicModelSingleAttitude( *attitude->getAttitude()));
            ccSingleAttitudeModel * model = new ccSingleAttitudeModel(spcmodel);

            sel->addChild(model);
        }


    }



    // create links

//    std::vector<ccStratigraphicConstrain * > constrains;

//    for (std::pair<ccPolyline *, std::vector<std::vector<ccSample *>>> pair : mapping)
//    {
//        std::vector<std::vector<ccSample *>> set = pair.second;

//        ccStratigraphicConstrain * constrain = new ccStratigraphicConstrain();

//        for (std::vector<ccSample *> c: set)
//        {
//            for (ccSample * sample: c)
//            {
//                constrain->getSPCElement<spc::StratigraphicConstrain>()->addVertex(sample->getSample());

//            }
//        }

//        constrain->setVisible(true);
//        emit newEntity(constrain);

//    }

    newEntity(m_root_outcrop);


    return 1;
}
예제 #27
0
void actBoulderTrap(Entity *my) {
	int x, y;
	int c;

	BOULDERTRAP_AMBIENCE--;
	if( BOULDERTRAP_AMBIENCE<=0 ) {
		BOULDERTRAP_AMBIENCE = TICKS_PER_SECOND*30;
		playSoundEntity( my, 149, 64 );
	}
	
	if( !my->skill[28] )
		return;

	// received on signal
	if( my->skill[28] == 2) {
		if( !BOULDERTRAP_FIRED ) {
			playSoundEntity(my, 150, 128);
			for( c=0; c<MAXPLAYERS; c++ )
				playSoundPlayer(c, 150, 64);
			BOULDERTRAP_FIRED = 1;
			for( c=0; c<4; c++ ) {
				switch( c ) {
					case 0:
						x = 16;
						y = 0;
						break;
					case 1:
						x = 0;
						y = 16;
						break;
					case 2:
						x = -16;
						y = 0;
						break;
					case 3:
						x = 0;
						y = -16;
						break;
				}
				x = ((int)(x+my->x))>>4;
				y = ((int)(y+my->y))>>4;
				if( x>=0 && y>=0 && x<map.width && y<map.height ) {
					if( !map.tiles[OBSTACLELAYER+y*MAPLAYERS+x*MAPLAYERS*map.height] ) {
						Entity *entity = newEntity(245, 1, map.entities); // boulder
						entity->parent = my->uid;
						entity->x = (x<<4)+8;
						entity->y = (y<<4)+8;
						entity->z = -64;
						entity->yaw = c*(PI/2.f);
						entity->sizex = 7;
						entity->sizey = 7;
						if( checkObstacle( entity->x+cos(entity->yaw)*16, entity->y+sin(entity->yaw)*16, entity, NULL ) ) {
							entity->yaw += PI*(rand()%2)-PI/2;
							if( entity->yaw >= PI*2 )
								entity->yaw -= PI*2;
							else if( entity->yaw < 0 )
								entity->yaw += PI*2;
						}
						entity->behavior = &actBoulder;
						entity->flags[UPDATENEEDED] = TRUE;
						entity->flags[PASSABLE] = TRUE;
					}
				}
			}
		}
	}
예제 #28
0
void initMinotaur(Entity* my, Stat* myStats)
{
	int c;
	node_t* node;

	my->initMonster(239);

	if ( multiplayer != CLIENT )
	{
		MONSTER_SPOTSND = 107;
		MONSTER_SPOTVAR = 3;
		MONSTER_IDLESND = 110;
		MONSTER_IDLEVAR = 3;
	}
	if ( multiplayer != CLIENT && !MONSTER_INIT )
	{
		if ( myStats != NULL )
		{
			if ( !myStats->leader_uid )
			{
				myStats->leader_uid = 0;
			}

			// apply random stat increases if set in stat_shared.cpp or editor
			setRandomMonsterStats(myStats);

			// generate 6 items max, less if there are any forced items from boss variants
			int customItemsToGenerate = ITEM_CUSTOM_SLOT_LIMIT;

			// boss variants
			if ( strcmp(map.name, "Hell Boss") == 0 )
			{
				myStats->STR = 50;
				myStats->DEX = 20;
				myStats->CON = 20;
			}
			else if ( currentlevel >= 25 )
			{
				myStats->HP += 400;
				myStats->MAXHP += 400;
				myStats->STR = 60;
				myStats->DEX = 20;
				myStats->CON = 20;
				myStats->EFFECTS[EFF_VAMPIRICAURA] = true;
				myStats->EFFECTS_TIMERS[EFF_VAMPIRICAURA] = -1;
			}


			// random effects
			// minotaurs can traverse waters and pits (pits with magic :))
			myStats->EFFECTS[EFF_LEVITATING] = true;
			myStats->EFFECTS_TIMERS[EFF_LEVITATING] = 0;

			// generates equipment and weapons if available from editor
			createMonsterEquipment(myStats);

			// create any custom inventory items from editor if available
			createCustomInventory(myStats, customItemsToGenerate);

			// count if any custom inventory items from editor
			int customItems = countCustomItems(myStats); //max limit of 6 custom items per entity.

														 // count any inventory items set to default in edtior
			int defaultItems = countDefaultItems(myStats);

			my->setHardcoreStats(*myStats);

			// generate the default inventory items for the monster, provided the editor sprite allowed enough default slots

			ItemType gemtype = GEM_RUBY;

			switch ( defaultItems )
			{
				case 6:
				case 5:
				case 4:
				case 3:
				case 2:
				case 1:
					switch ( rand() % 4 )
					{
						case 0:
							gemtype = GEM_RUBY;
							break;
						case 1:
							gemtype = GEM_EMERALD;
							break;
						case 2:
							gemtype = GEM_SAPPHIRE;
							break;
						case 3:
							gemtype = GEM_DIAMOND;
							break;
					}
					newItem(gemtype, EXCELLENT, 0, 1, rand(), true, &myStats->inventory);
					break;
				default:
					break;
			}
		}
	}

	// head
	Entity* entity = newEntity(237, 0, map.entities, nullptr); //Limb entity.
	entity->sizex = 4;
	entity->sizey = 4;
	entity->skill[2] = my->getUID();
	entity->flags[PASSABLE] = true;
	entity->flags[NOUPDATE] = true;
	entity->flags[USERFLAG2] = my->flags[USERFLAG2];
	entity->focalx = limbs[MINOTAUR][1][0]; // 0
	entity->focaly = limbs[MINOTAUR][1][1]; // 0
	entity->focalz = limbs[MINOTAUR][1][2]; // 0
	entity->behavior = &actMinotaurLimb;
	entity->parent = my->getUID();
	node = list_AddNodeLast(&my->children);
	node->element = entity;
	node->deconstructor = &emptyDeconstructor;
	node->size = sizeof(Entity*);
	my->bodyparts.push_back(entity);

	// chest
	entity = newEntity(238, 0, map.entities, nullptr); //Limb entity.
	entity->sizex = 4;
	entity->sizey = 4;
	entity->skill[2] = my->getUID();
	entity->flags[PASSABLE] = true;
	entity->flags[NOUPDATE] = true;
	entity->flags[USERFLAG2] = my->flags[USERFLAG2];
	entity->focalx = limbs[MINOTAUR][2][0]; // 0
	entity->focaly = limbs[MINOTAUR][2][1]; // 0
	entity->focalz = limbs[MINOTAUR][2][2]; // 0
	entity->behavior = &actMinotaurLimb;
	entity->parent = my->getUID();
	node = list_AddNodeLast(&my->children);
	node->element = entity;
	node->deconstructor = &emptyDeconstructor;
	node->size = sizeof(Entity*);
	my->bodyparts.push_back(entity);

	// right leg
	entity = newEntity(243, 0, map.entities, nullptr); //Limb entity.
	entity->sizex = 4;
	entity->sizey = 4;
	entity->skill[2] = my->getUID();
	entity->flags[PASSABLE] = true;
	entity->flags[NOUPDATE] = true;
	entity->flags[USERFLAG2] = my->flags[USERFLAG2];
	entity->focalx = limbs[MINOTAUR][3][0]; // 1
	entity->focaly = limbs[MINOTAUR][3][1]; // 0
	entity->focalz = limbs[MINOTAUR][3][2]; // 5
	entity->behavior = &actMinotaurLimb;
	entity->parent = my->getUID();
	node = list_AddNodeLast(&my->children);
	node->element = entity;
	node->deconstructor = &emptyDeconstructor;
	node->size = sizeof(Entity*);
	my->bodyparts.push_back(entity);

	// left leg
	entity = newEntity(242, 0, map.entities, nullptr); //Limb entity.
	entity->sizex = 4;
	entity->sizey = 4;
	entity->skill[2] = my->getUID();
	entity->flags[PASSABLE] = true;
	entity->flags[NOUPDATE] = true;
	entity->flags[USERFLAG2] = my->flags[USERFLAG2];
	entity->focalx = limbs[MINOTAUR][4][0]; // 1
	entity->focaly = limbs[MINOTAUR][4][1]; // 0
	entity->focalz = limbs[MINOTAUR][4][2]; // 5
	entity->behavior = &actMinotaurLimb;
	entity->parent = my->getUID();
	node = list_AddNodeLast(&my->children);
	node->element = entity;
	node->deconstructor = &emptyDeconstructor;
	node->size = sizeof(Entity*);
	my->bodyparts.push_back(entity);

	// right arm
	entity = newEntity(241, 0, map.entities, nullptr); //Limb entity.
	entity->sizex = 4;
	entity->sizey = 4;
	entity->skill[2] = my->getUID();
	entity->flags[PASSABLE] = true;
	entity->flags[NOUPDATE] = true;
	entity->flags[USERFLAG2] = my->flags[USERFLAG2];
	entity->focalx = limbs[MINOTAUR][5][0]; // 2.5
	entity->focaly = limbs[MINOTAUR][5][1]; // 7
	entity->focalz = limbs[MINOTAUR][5][2]; // 3.5
	entity->behavior = &actMinotaurLimb;
	entity->parent = my->getUID();
	node = list_AddNodeLast(&my->children);
	node->element = entity;
	node->deconstructor = &emptyDeconstructor;
	node->size = sizeof(Entity*);
	my->bodyparts.push_back(entity);

	// left arm
	entity = newEntity(240, 0, map.entities, nullptr); //Limb entity.
	entity->sizex = 4;
	entity->sizey = 4;
	entity->skill[2] = my->getUID();
	entity->flags[PASSABLE] = true;
	entity->flags[NOUPDATE] = true;
	entity->flags[USERFLAG2] = my->flags[USERFLAG2];
	entity->focalx = limbs[MINOTAUR][6][0]; // 2.5
	entity->focaly = limbs[MINOTAUR][6][1]; // -7
	entity->focalz = limbs[MINOTAUR][6][2]; // 3.5
	entity->behavior = &actMinotaurLimb;
	entity->parent = my->getUID();
	node = list_AddNodeLast(&my->children);
	node->element = entity;
	node->deconstructor = &emptyDeconstructor;
	node->size = sizeof(Entity*);
	my->bodyparts.push_back(entity);
}
예제 #29
0
void actMinotaurCeilingBuster(Entity* my)
{
	double x, y;

	// levitate particles
	int u = std::min<unsigned int>(std::max<int>(0, my->x / 16), map.width - 1);
	int v = std::min<unsigned int>(std::max<int>(0, my->y / 16), map.height - 1);
	if ( !map.tiles[v * MAPLAYERS + u * MAPLAYERS * map.height] )
	{
		int c;
		for ( c = 0; c < 2; c++ )
		{
			Entity* entity = newEntity(171, 1, map.entities, nullptr); //Particle entity.
			entity->x = my->x - 8 + rand() % 17;
			entity->y = my->y - 8 + rand() % 17;
			entity->z = 10 + rand() % 3;
			entity->scalex = 0.7;
			entity->scaley = 0.7;
			entity->scalez = 0.7;
			entity->sizex = 1;
			entity->sizey = 1;
			entity->yaw = (rand() % 360) * PI / 180.f;
			entity->flags[PASSABLE] = true;
			entity->flags[BRIGHT] = true;
			entity->flags[NOUPDATE] = true;
			entity->flags[UNCLICKABLE] = true;
			entity->behavior = &actMagicParticle;
			if ( multiplayer != CLIENT )
			{
				entity_uids--;
			}
			entity->setUID(-3);
		}
	}

	// bust ceilings
	for ( x = my->x - my->sizex - 1; x <= my->x + my->sizex + 1; x += 1 )
	{
		for ( y = my->y - my->sizey - 1; y <= my->y + my->sizey + 1; y += 1 )
		{
			if ( x >= 0 && y >= 0 && x < map.width << 4 && y < map.height << 4 )
			{
				int index = (MAPLAYERS - 1) + ((int)floor(y / 16)) * MAPLAYERS + ((int)floor(x / 16)) * MAPLAYERS * map.height;
				if ( map.tiles[index] )
				{
					if ( my->monsterAttack == 0 )
					{
						if ( multiplayer != CLIENT )
						{
							my->attack(MONSTER_POSE_MELEE_WINDUP2, 0, nullptr);
						}
						return;
					}
					else if ( my->monsterAttack == MONSTER_POSE_MELEE_WINDUP2 )
					{
						return;
					}
					map.tiles[index] = 0;
					if ( multiplayer != CLIENT )
					{
						playSoundEntity(my, 67, 128);
						//MONSTER_ATTACK = 1;
						Stat* myStats = my->getStats();
						if ( myStats )
						{
							// easy hack to stop the minotaur while he breaks stuff
							myStats->EFFECTS[EFF_PARALYZED] = true;
							myStats->EFFECTS_TIMERS[EFF_PARALYZED] = 10;
						}
					}

					// spawn several rock particles (NOT items)
					int c, i = 6 + rand() % 4;
					for ( c = 0; c < i; c++ )
					{
						Entity *entity = nullptr;
						if ( multiplayer == SERVER )
						{
							entity = spawnGib(my);
						}
						else
						{
							entity = spawnGibClient(my->x, my->y, my->z, 5);
						}
						if ( entity )
						{
							entity->x = ((int)(my->x / 16)) * 16 + rand() % 16;
							entity->y = ((int)(my->y / 16)) * 16 + rand() % 16;
							entity->z = -8;
							entity->flags[PASSABLE] = true;
							entity->flags[INVISIBLE] = false;
							entity->flags[NOUPDATE] = true;
							entity->flags[UPDATENEEDED] = false;
							entity->sprite = items[GEM_ROCK].index;
							entity->yaw = rand() % 360 * PI / 180;
							entity->pitch = rand() % 360 * PI / 180;
							entity->roll = rand() % 360 * PI / 180;
							entity->vel_x = (rand() % 20 - 10) / 10.0;
							entity->vel_y = (rand() % 20 - 10) / 10.0;
							entity->vel_z = -.25;
							entity->fskill[3] = 0.03;
						}
					}
				}
				node_t* node, *nextnode;
				std::vector<list_t*> entLists = TileEntityList.getEntitiesWithinRadiusAroundEntity(my, 2);
				for ( std::vector<list_t*>::iterator it = entLists.begin(); it != entLists.end(); ++it )
				{
					list_t* currentList = *it;
					for ( node = currentList->first; node != nullptr; node = nextnode )
					{
						nextnode = node->next;
						Entity* entity = (Entity*)node->element;
						if ( (int)(x / 16) == (int)(entity->x / 16) && (int)(y / 16) == (int)(entity->y / 16) )
						{
							if ( entity->behavior == &actDoorFrame )
							{
								// spawn several rock items
								int c, i = 8 + rand() % 4;
								for ( c = 0; c < i; c++ )
								{
									Entity *entity = nullptr;
									if ( multiplayer == SERVER )
									{
										entity = spawnGib(my);
									}
									else
									{
										entity = spawnGibClient(my->x, my->y, my->z, 5);
									}
									if ( entity )
									{
										entity->x = ((int)(my->x / 16)) * 16 + rand() % 16;
										entity->y = ((int)(my->y / 16)) * 16 + rand() % 16;
										entity->z = -8;
										entity->flags[PASSABLE] = true;
										entity->flags[INVISIBLE] = false;
										entity->flags[NOUPDATE] = true;
										entity->flags[UPDATENEEDED] = false;
										entity->sprite = items[GEM_ROCK].index;
										entity->yaw = rand() % 360 * PI / 180;
										entity->pitch = rand() % 360 * PI / 180;
										entity->roll = rand() % 360 * PI / 180;
										entity->vel_x = (rand() % 20 - 10) / 10.0;
										entity->vel_y = (rand() % 20 - 10) / 10.0;
										entity->vel_z = -.25;
										entity->fskill[3] = 0.03;
									}
								}
								list_RemoveNode(entity->mynode);
							}
							else if ( entity->behavior == &actDoor )
							{
								if ( multiplayer != CLIENT )
								{
									entity->skill[4] = 0; // destroy the door
								}
							}
							else if ( entity->behavior == &actGate )
							{
								if ( multiplayer != CLIENT )
								{
									playSoundEntity(entity, 76, 64);
									list_RemoveNode(entity->mynode);
								}
							}
							else if (	entity->behavior == &actStalagCeiling	||
										entity->behavior == &actStalagFloor		||
										entity->behavior == &actStalagColumn
									)
							{
								// spawn several rock items
								int c, i = rand() % 4;
								for ( c = 0; c < i; ++c )
								{
									//Entity* childEntity = spawnGib(my);
									Entity *childEntity = nullptr;
									if ( multiplayer == SERVER )
									{
										childEntity = spawnGib(my);
									}
									else
									{
										childEntity = spawnGibClient(my->x, my->y, my->z, 5);
									}
									if ( entity )
									{
										childEntity->x = ((int)(my->x / 16)) * 16 + rand() % 16;
										childEntity->y = ((int)(my->y / 16)) * 16 + rand() % 16;
										childEntity->z = -8;
										childEntity->flags[PASSABLE] = true;
										childEntity->flags[INVISIBLE] = false;
										childEntity->flags[NOUPDATE] = true;
										childEntity->flags[UPDATENEEDED] = false;
										childEntity->sprite = items[GEM_ROCK].index;
										childEntity->yaw = rand() % 360 * PI / 180;
										childEntity->pitch = rand() % 360 * PI / 180;
										childEntity->roll = rand() % 360 * PI / 180;
										childEntity->vel_x = (rand() % 20 - 10) / 10.0;
										childEntity->vel_y = (rand() % 20 - 10) / 10.0;
										childEntity->vel_z = -.25;
										childEntity->fskill[3] = 0.03;
									}
								}
								list_RemoveNode(entity->mynode);
							}
						}
					}
				}
			}
		}
	}
}
예제 #30
0
void EntityFactory::LoadEntity(const std::string& aEntityPath, float aDifficultScale)
{
	XMLReader entityDocument;
	entityDocument.OpenDocument(aEntityPath);

	EntityData newEntity(*myDummyScene);
	tinyxml2::XMLElement* entityElement;
	tinyxml2::XMLElement* rootElement = entityDocument.FindFirstChild("root");
	if (rootElement == nullptr)
	{
		entityElement = entityDocument.FindFirstChild("Entity");
	}
	else
	{
		entityElement = entityDocument.FindFirstChild(rootElement, "Entity");
	}

	std::string entityName = "";
	entityDocument.ForceReadAttribute(entityElement, "name", entityName);

	if (myEntities.find(entityName) != myEntities.end())
	{
		std::string errorMessage = "[EntityFactory] Entity there is already a object named " + entityName;
		DL_ASSERT(errorMessage.c_str());
	}
	newEntity.myEntity->SetName(entityName);
	if (entityName != "E_projectile_enemy_fast")
	{
		aDifficultScale = 1.f;
	}
	else {
		aDifficultScale = aDifficultScale;
	}
	ENTITY_LOG("Load entity %s starting", entityName.c_str());
	for (tinyxml2::XMLElement* e = entityDocument.FindFirstChild(entityElement); e != nullptr;
		e = entityDocument.FindNextElement(e))
	{
		std::string childName = e->Name();
		if (std::strcmp(CU::ToLower(e->Name()).c_str(), CU::ToLower("GraphicsComponent").c_str()) == 0)
		{
			LoadGraphicsComponent(newEntity, entityDocument, e);
			ENTITY_LOG("Entity %s loaded %s", entityName.c_str(), e->Name());
		}
		else if (std::strcmp(CU::ToLower(e->Name()).c_str(), CU::ToLower("AIComponent").c_str()) == 0)
		{
			LoadAIComponent(newEntity, entityDocument, e);
			ENTITY_LOG("Entity %s loaded %s", entityName.c_str(), e->Name());
		}
		else if (std::strcmp(CU::ToLower(e->Name()).c_str(), CU::ToLower("ShootingComponent").c_str()) == 0)
		{
			LoadShootingComponent(newEntity, entityDocument, e);
			ENTITY_LOG("Entity %s loaded %s", entityName.c_str(), e->Name());
		}
		else if (std::strcmp(CU::ToLower(e->Name()).c_str(), CU::ToLower("CollisionComponent").c_str()) == 0)
		{
			LoadCollisionComponent(newEntity, entityDocument, e, eCollisionType::NORMAL);
			ENTITY_LOG("Entity %s loaded %s", entityName.c_str(), e->Name());
		}
		else if (std::strcmp(CU::ToLower(e->Name()).c_str(), CU::ToLower("PlanetCollisionComponent").c_str()) == 0)
		{
			LoadCollisionComponent(newEntity, entityDocument, e, eCollisionType::PLANET);
			ENTITY_LOG("Entity %s loaded %s", entityName.c_str(), e->Name());
		}
		else if (std::strcmp(CU::ToLower(e->Name()).c_str(), CU::ToLower("PhysicsComponent").c_str()) == 0)
		{
			LoadPhysicsComponent(newEntity, entityDocument, e);
			ENTITY_LOG("Entity %s loaded %s", entityName.c_str(), e->Name());
		}
		else if (std::strcmp(CU::ToLower(e->Name()).c_str(), CU::ToLower("BulletComponent").c_str()) == 0)
		{
			LoadBulletComponent(newEntity, entityDocument, e, aDifficultScale);
			ENTITY_LOG("Entity %s loaded %s", entityName.c_str(), e->Name());
		}
		else if (std::strcmp(CU::ToLower(e->Name()).c_str(), CU::ToLower("HealthComponent").c_str()) == 0)
		{
			LoadHealthComponent(newEntity, entityDocument, e);
			ENTITY_LOG("Entity %s loaded %s", entityName.c_str(), e->Name());
		}
		else if (std::strcmp(CU::ToLower(e->Name()).c_str(), CU::ToLower("PowerUpComponent").c_str()) == 0)
		{
			LoadPowerUpComponent(newEntity, entityDocument, e);
			ENTITY_LOG("Entity %s loaded %s", entityName.c_str(), e->Name());
		}
		else if (std::strcmp(CU::ToLower(e->Name()).c_str(), CU::ToLower("ParticleEmitterComponent").c_str()) == 0)
		{
			LoadParticleEmitterComponent(newEntity, entityDocument, e);
			ENTITY_LOG("Entity %s loaded %s", entityName.c_str(), e->Name());
		}
		else if (std::strcmp(CU::ToLower(e->Name()).c_str(), CU::ToLower("StreakEmitterComponent").c_str()) == 0)
		{
			LoadStreakEmitterComponent(newEntity, entityDocument, e);
			ENTITY_LOG("Entity %s loaded %s", entityName.c_str(), e->Name());
		}
		else if (std::strcmp(CU::ToLower(e->Name()).c_str(), CU::ToLower("rotate").c_str()) == 0)
		{
			bool rotate;
			entityDocument.ReadAttribute(e, "value", rotate);
			newEntity.myEntity->SetShouldRotate(rotate);

			entityDocument.ReadAttribute(e, "xAxis", rotate);
			newEntity.myEntity->SetShouldRotateX(rotate);

			entityDocument.ReadAttribute(e, "yAxis", rotate);
			newEntity.myEntity->SetShouldRotateY(rotate);

			entityDocument.ReadAttribute(e, "zAxis", rotate);
			newEntity.myEntity->SetShouldRotateZ(rotate);

		}
		else if (std::strcmp(CU::ToLower(e->Name()).c_str(), CU::ToLower("SoundComponent").c_str()) == 0)
		{
			LoadSoundComponent(newEntity, entityDocument, e);
			ENTITY_LOG("Entity %s loaded %s", entityName.c_str(), e->Name());
		}

		else
		{
			std::string errorMessage = "[EntityFactory]: Entity could not find the component "
				+ static_cast<std::string>(e->Name());
			DL_ASSERT(errorMessage.c_str());
		}
	}
	if (entityName != "")
	{
		myEntities.insert(std::pair<std::string, EntityData>(entityName, newEntity));
		ENTITY_LOG("Load entity %s ending", entityName.c_str());
	}
	else
	{
		DL_ASSERT("[EntityFactory]: Entity could not be created missing a name.");
	}

	entityDocument.CloseDocument();
}