예제 #1
0
	BOOST_FOREACH(Entity * e, entities) {
		if(e) {
			
			for(size_t j = 0; j < MAX_ANIMS; j++) {
				EERIE_ANIMMANAGER_ReleaseHandle(e->anims[j]);
				e->anims[j] = NULL;
			}
			
			for(size_t count = 0; count < MAX_ANIM_LAYERS; count++) {
				memset(&e->animlayer[count], 0, sizeof(ANIM_USE));
				e->animlayer[count].cur_anim = NULL;
				e->animlayer[count].next_anim = NULL;
			}
		}
	}
예제 #2
0
void ReleaseAnimFromIO(Entity * io, long num) {

	for(long count = 0; count < MAX_ANIM_LAYERS; count++) {
		AnimLayer & layer = io->animlayer[count];
		
		if(layer.cur_anim == io->anims[num]) {
			layer = AnimLayer();
			layer.cur_anim = NULL;
		}

		if(layer.next_anim == io->anims[num])
			layer.next_anim = NULL;
	}

	EERIE_ANIMMANAGER_ReleaseHandle(io->anims[num]);
	io->anims[num] = NULL;
}
예제 #3
0
Entity::~Entity() {
	
	cleanReferences();
	
	if(g_cameraEntity == this) {
		g_cameraEntity = NULL;
	}
	
	// Releases ToBeDrawn Transparent Polys linked to this object !
	tweaks.clear();
	
	if(obj && !(ioflags & IO_CAMERA) && !(ioflags & IO_MARKER) && !(ioflags & IO_GOLD)) {
		delete obj, obj = NULL;
	}
	
	spells.removeTarget(this);
	
	delete tweakerinfo;
	delete tweaky, tweaky = NULL;
	
	ReleaseScript(&script);
	ReleaseScript(&over_script);
	
	for(size_t n = 0; n < MAX_ANIMS; n++) {
		if(anims[n]) {
			EERIE_ANIMMANAGER_ReleaseHandle(anims[n]);
			anims[n] = NULL;
		}
	}
	
	lightHandleDestroy(dynlight);
	
	delete usepath;
	
	delete symboldraw;
	symboldraw = NULL;
	
	if(ioflags & IO_NPC) {
		delete _npcdata;
	} else if(ioflags & IO_ITEM) {
		free(_itemdata->equipitem);
		delete _itemdata;
	} else if(ioflags & IO_FIX) {
		delete _fixdata;
	} else if(ioflags & IO_CAMERA && _camdata) {
		if(g_camera == &_camdata->cam) {
			SetActiveCamera(&g_playerCamera);
		}
		delete _camdata;
	}
	
	if(SecondaryInventory && SecondaryInventory->io == this) {
		SecondaryInventory = NULL;
	}
	
	if(TSecondaryInventory && TSecondaryInventory->io == this) {
		TSecondaryInventory = NULL;
	}
	
	delete inventory;
	
	if(m_index != size_t(-1)) {
		entities.remove(m_index);
	}
	
}
예제 #4
0
Entity::~Entity() {
	
	cleanReferences();
	
	if(!FAST_RELEASE) {
		TREATZONE_RemoveIO(this);
	}
	
	if(ignit_light > -1) {
		DynLight[ignit_light].exist = 0, ignit_light = -1;
	}
	
	if(ignit_sound != audio::INVALID_ID) {
		ARX_SOUND_Stop(ignit_sound), ignit_sound = audio::INVALID_ID;
	}
	
	if(FlyingOverIO == this) {
		FlyingOverIO = NULL;
	}
	
	if((MasterCamera.exist & 1) && MasterCamera.io == this) {
		MasterCamera.exist = 0;
	}
	
	if((MasterCamera.exist & 2) && MasterCamera.want_io == this) {
		MasterCamera.exist = 0;
	}
	
	ARX_INTERACTIVE_DestroyDynamicInfo(this);
	IO_UnlinkAllLinkedObjects(this);
	
	// Releases ToBeDrawn Transparent Polys linked to this object !
	tweaks.clear();
	ARX_SCRIPT_Timer_Clear_For_IO(this);
	
	if(obj && !(ioflags & IO_CAMERA) && !(ioflags & IO_MARKER) && !(ioflags & IO_GOLD)) {
		delete obj, obj = NULL;
	}
	
	ARX_SPELLS_RemoveAllSpellsOn(this);
	
	delete tweakerinfo;
	delete tweaky, tweaky = NULL;
	
	RemoveFromAllInventories(this);
	
	ReleaseScript(&script);
	ReleaseScript(&over_script);
	
	for(long n = 0; n < MAX_ANIMS; n++) {
		if(anims[n]) {
			EERIE_ANIMMANAGER_ReleaseHandle(anims[n]);
			anims[n] = NULL;
		}
	}
	
	if(damagedata >= 0) {
		damages[damagedata].exist = 0;
	}
	
	if(ValidDynLight(dynlight)) {
		DynLight[dynlight].exist = 0, dynlight = -1;
	}
	
	if(ValidDynLight(halo.dynlight)) {
		DynLight[halo.dynlight].exist = 0, halo.dynlight = -1;
	}
	
	free(usepath);
	free(symboldraw), symboldraw = NULL;
	
	if(ioflags & IO_NPC) {
		delete _npcdata;
		
	} else if(ioflags & IO_ITEM) {
		free(_itemdata->equipitem);
		free(_itemdata);
		
	} else if(ioflags & IO_FIX) {
		free(_fixdata);
		
	} else if(ioflags & IO_CAMERA && _camdata) {
		if(ACTIVECAM == &_camdata->cam) {
			ACTIVECAM = &subj;
		}
		free(_camdata);
	}
	
	if(TSecondaryInventory && TSecondaryInventory->io == this) {
		TSecondaryInventory = NULL;
	}
	
	free(inventory);
	
	if(m_index != size_t(-1)) {
		entities.remove(m_index);
	}
	
	if(pIOChangeWeapon == this) {
		pIOChangeWeapon = NULL; // TODO we really need a proper weak_ptr
	}
}