Esempio n. 1
0
void RepelUndeadSpell::End() {
	
	ARX_SOUND_Stop(m_snd_loop);
	m_snd_loop = audio::SourcedSample();
	
	endLightDelayed(m_light, GameDurationMs(500));
}
Esempio n. 2
0
void IceFieldSpell::End() {
	
	DamageRequestEnd(m_damage);
	
	ARX_SOUND_Stop(m_snd_loop); 
	ARX_SOUND_PlaySFX(SND_SPELL_ICE_FIELD_END);
}
Esempio n. 3
0
void CurrentTorchIconGui::updateInput() {
	if(player.torch) {
		
		if(m_rect.contains(Vec2f(DANAEMouse))) {
			eMouseState = MOUSE_IN_TORCH_ICON;
			cursorSetInteraction();
			
			if(!DRAGINTER && !PLAYER_MOUSELOOK_ON && DRAGGING) {
				Entity * io = player.torch;
				player.torch->show = SHOW_FLAG_IN_SCENE;
				ARX_SOUND_PlaySFX(SND_TORCH_END);
				ARX_SOUND_Stop(SND_TORCH_LOOP);
				player.torch = NULL;
				lightHandleGet(torchLightHandle)->exist = 0;
				io->ignition = 1;
				Set_DragInter(io);
			} else {
				if(eeMouseDoubleClick1() && !COMBINE) {
					COMBINE = player.torch;
				}
				
				if(eeMouseUp2()) {
					ARX_PLAYER_ClickedOnTorch(player.torch);
					TRUE_PLAYER_MOUSELOOK_ON = false;
				}
			}
		}
	}
}
Esempio n. 4
0
void LightningStrikeSpell::End()
{
	ARX_SOUND_PlaySFX(SND_SPELL_ELECTRIC, &entities[m_caster]->pos);
	
	ARX_SOUND_Stop(m_snd_loop);
	ARX_SOUND_PlaySFX(SND_SPELL_LIGHTNING_END, &entities[m_caster]->pos);
}
Esempio n. 5
0
void MagicSightSpell::End()
{
	if(m_caster == EntityHandle_Player) {
		player.m_improve = false;
		ARX_SOUND_Stop(m_snd_loop);
	}
	ARX_SOUND_PlaySFX(SND_SPELL_VISION_START, &entities[m_caster]->pos);
}
Esempio n. 6
0
void LevitateSpell::End()
{
	ARX_SOUND_Stop(m_snd_loop);
	ARX_SOUND_PlaySFX(SND_SPELL_LEVITATE_END, &entities[m_target]->pos);
	m_targets.clear();
	
	if(m_target == PlayerEntityHandle)
		player.levitate = false;
}
Esempio n. 7
0
void IceFieldSpell::End() {
	
	DamageRequestEnd(m_damage);
	
	ARX_SOUND_Stop(m_snd_loop);
	m_snd_loop = audio::SourcedSample();
	
	ARX_SOUND_PlaySFX(g_snd.SPELL_ICE_FIELD_END);
}
Esempio n. 8
0
void ColdProtectionSpell::End()
{
	ARX_SOUND_Stop(m_snd_loop);
	ARX_SOUND_PlaySFX(SND_SPELL_COLD_PROTECTION_END, &entities[m_target]->pos);
	m_targets.clear();
	
	if(ValidIONum(m_target))
		ARX_HALO_SetToNative(entities[m_target]);
}
Esempio n. 9
0
void StopSoundKeyFramer() {
	
	for(size_t i = 0; i < TabSound.size(); i++) {
		if(TabSound[i].exists && TabSound[i].handle != audio::SourcedSample()) {
			ARX_SOUND_Stop(TabSound[i].handle);
			TabSound[i].handle = audio::SourcedSample();
		}
	}
}
Esempio n. 10
0
void StopSoundKeyFramer() {
	
	for(size_t i = 0; i < ARRAY_SIZE(TabSound); i++) {
		if(TabSound[i].exists && TabSound[i].handle != audio::INVALID_ID) {
			ARX_SOUND_Stop(TabSound[i].handle);
			TabSound[i].handle = audio::INVALID_ID;
		}
	}
}
Esempio n. 11
0
void CheckForIgnition(const Vec3f & pos, float radius, bool mode, long flag) {
	
	if(!(flag & 1))
		for(size_t i = 0; i < MAX_LIGHTS; i++) {
			EERIE_LIGHT * el = GLight[i];

			if(el == NULL)
				continue;

			if((el->extras & EXTRAS_EXTINGUISHABLE) && (el->extras & (EXTRAS_SEMIDYNAMIC | EXTRAS_SPAWNFIRE | EXTRAS_SPAWNSMOKE)))
			{
				if((el->extras & EXTRAS_FIREPLACE) && (flag & 2))
					continue;

				if(!fartherThan(pos, el->pos, radius)) {
					if(mode) {
						if (!(el->extras & EXTRAS_NO_IGNIT))
							el->m_ignitionStatus = true;
					} else {
						el->m_ignitionStatus = false;
					}
				}

			}
		}

	for(size_t i = 0; i < entities.size(); i++) {
		const EntityHandle handle = EntityHandle(i);
		Entity * io = entities[handle];

		if(   io
		   && io->show == SHOW_FLAG_IN_SCENE
		   && io->obj
		   && !(io->ioflags & IO_UNDERWATER)
		   && io->obj->fastaccess.fire >= 0
		) {
			if(closerThan(pos, io->obj->vertexlist3[io->obj->fastaccess.fire].v, radius)) {

				if(mode && io->ignition <= 0 && io->obj->fastaccess.fire >= 0) {
					io->ignition = 1;
				} else if(!mode && io->ignition > 0) {
					if(io->obj->fastaccess.fire >= 0) {
						io->ignition = 0; 
						lightHandleDestroy(io->ignit_light);

						if(io->ignit_sound != audio::INVALID_ID) {
							ARX_SOUND_Stop(io->ignit_sound);
							io->ignit_sound = audio::INVALID_ID;
						}
					}
					else if(!(flag & 2))
						io->ignition = 0.00001f;
				}
			}
		}
	}
}
Esempio n. 12
0
void LightningStrikeSpell::End() {
	
	ARX_SOUND_Stop(m_snd_loop);
	m_snd_loop = audio::SourcedSample();
	
	Entity * caster = entities.get(m_caster);
	if(caster) {
		ARX_SOUND_PlaySFX(g_snd.SPELL_ELECTRIC, &caster->pos);
		ARX_SOUND_PlaySFX(g_snd.SPELL_LIGHTNING_END, &caster->pos);
	}
}
void MassLightningStrikeSpell::End() {
	
	endLightDelayed(m_light, 200);
	
	ARX_SOUND_Stop(m_snd_loop);
	ARX_SOUND_PlaySFX(SND_SPELL_LIGHTNING_END);
	
	for(std::vector<CLightning *>::iterator it = pTab.begin(); it != pTab.end(); ++it) {
		delete *it;
	}
	pTab.clear();
}
Esempio n. 14
0
void ColdProtectionSpell::End() {
	
	ARX_SOUND_Stop(m_snd_loop);
	
	Entity * target = entities.get(m_target);
	if(target) {
		ARX_SOUND_PlaySFX(SND_SPELL_COLD_PROTECTION_END, &target->pos);
		ARX_HALO_SetToNative(target);
	}
	
	m_targets.clear();
}
Esempio n. 15
0
CMagicMissile::~CMagicMissile()
{
	smissile_count--;

	if(smissile && smissile_count <= 0) {
		smissile_count = 0;
		delete smissile;
		smissile = NULL;
	}

	lLightId = LightHandle::Invalid;

	ARX_SOUND_Stop(snd_loop);
}
Esempio n. 16
0
static void ARX_SPEECH_Release(long i) {
	
	if(aspeech[i].exist) {
		
		ARX_SOUND_Stop(aspeech[i].sample);
		
		if(ValidIOAddress(aspeech[i].io) && aspeech[i].io->animlayer[2].cur_anim) {
			AcquireLastAnim(aspeech[i].io);
			aspeech[i].io->animlayer[2].cur_anim = NULL;
		}
		
		aspeech[i].clear();
	}
}
Esempio n. 17
0
void LevitateSpell::End() {
	
	ARX_SOUND_Stop(m_snd_loop);
	
	Entity * target = entities.get(m_target);
	if(target) {
		ARX_SOUND_PlaySFX(SND_SPELL_LEVITATE_END, &target->pos);
	}
	
	m_targets.clear();
	
	if(m_target == EntityHandle_Player)
		player.levitate = false;
}
Esempio n. 18
0
CMagicMissile::~CMagicMissile()
{
	smissile_count--;

	if(smissile && smissile_count <= 0) {
		smissile_count = 0;
		delete smissile;
		smissile = NULL;
	}

	if(this->lLightId != -1) {
		this->lLightId = -1;
	}

	ARX_SOUND_Stop(snd_loop);
}
Esempio n. 19
0
//-----------------------------------------------------------------------------
CMagicMissile::~CMagicMissile()
{
	smissile_count--;

	if (smissile && (smissile_count <= 0))
	{
		smissile_count = 0;
		ReleaseEERIE3DObj(smissile);
		smissile = NULL;
	}

	if (this->lLightId != -1)
	{
		this->lLightId = -1;
	}

	ARX_SOUND_Stop(snd_loop);
}
Esempio n. 20
0
void Entity::cleanReferences() {
	
	ARX_INTERACTIVE_DestroyIOdelayedRemove(this);
	
	if(DRAGINTER == this) {
		Set_DragInter(NULL);
	}
	
	if(FlyingOverIO == this) {
		FlyingOverIO = NULL;
	}
	
	if(COMBINE == this) {
		COMBINE = NULL;
	}
	
	if(pIOChangeWeapon == this) {
		pIOChangeWeapon = NULL; // TODO we really need a proper weak_ptr
	}
	
	if(ioSteal == this) {
		ioSteal = NULL;
	}
	
	if(!FAST_RELEASE) {
		TREATZONE_RemoveIO(this);
	}
	gameFlags &= ~GFLAG_ISINTREATZONE;
	
	ARX_INTERACTIVE_DestroyDynamicInfo(this);
	
	RemoveFromAllInventories(this);
	
	ARX_SCRIPT_Timer_Clear_For_IO(this);
	
	spells.endByCaster(index());
	
	lightHandleDestroy(ignit_light);
	
	if(ignit_sound != audio::INVALID_ID) {
		ARX_SOUND_Stop(ignit_sound), ignit_sound = audio::INVALID_ID;
	}
	
}
Esempio n. 21
0
CMagicMissile::~CMagicMissile() {

	lLightId = LightHandle::Invalid;

	ARX_SOUND_Stop(snd_loop);
}
Esempio n. 22
0
static void ARX_INTERFACE_RenderCursorInternal(bool flag) {
	
	if(SelectSpellTargetCursorRender()) {
		return;
	}
	
	if(!(flag || (!BLOCK_PLAYER_CONTROLS && PLAYER_INTERFACE_HIDE_COUNT))) {
		return;
	}
		
	if(!SPECIAL_DRAGINTER_RENDER)
		GRenderer->SetCulling(Renderer::CullNone);
	
	if(COMBINE || COMBINEGOLD) {
		if(SpecialCursor == CURSOR_INTERACTION_ON)
			SpecialCursor = CURSOR_COMBINEON;
		else
			SpecialCursor = CURSOR_COMBINEOFF;
	}
	
	if(!SPECIAL_DRAGINTER_RENDER) {
		if(FlyingOverIO || DRAGINTER) {
			fHighLightAng += (float)(framedelay*0.5);
			
			if(fHighLightAng > 90.f)
				fHighLightAng = 90.f;
			
			float fHLight = 100.f * glm::sin(glm::radians(fHighLightAng));
			
			iHighLight = checked_range_cast<int>(fHLight);
		} else {
			fHighLightAng = 0.f;
			iHighLight = 0;
		}
	}
	
	if(   SpecialCursor
	   || !PLAYER_MOUSELOOK_ON
	   || DRAGINTER
	   ||  (FlyingOverIO
		 && PLAYER_MOUSELOOK_ON
		 && !g_cursorOverBook
		 && (eMouseState != MOUSE_IN_NOTE)
		 && (FlyingOverIO->ioflags & IO_ITEM)
		 && (FlyingOverIO->gameFlags & GFLAG_INTERACTIVITY)
		 && (config.input.autoReadyWeapon == false))
	   || (MAGICMODE && PLAYER_MOUSELOOK_ON)
	) {
		CANNOT_PUT_IT_HERE=0;
		float ag=player.angle.getYaw();
		
		if(ag > 180)
			ag = ag - 360;
		
		float drop_miny=(float)(g_size.center().y)-g_size.center().y*(ag*( 1.0f / 70 ));
		
		if(   DANAEMouse.y > drop_miny
		   && DRAGINTER
		   && !InInventoryPos(DANAEMouse)
		   && !g_cursorOverBook
		) {
			if(!Manage3DCursor(DRAGINTER, true))
				CANNOT_PUT_IT_HERE = -1;
			
			if(SPECIAL_DRAGINTER_RENDER) {
				CANNOT_PUT_IT_HERE=0;
				return;
			}
		} else {
			CANNOT_PUT_IT_HERE = -1;
		}
		
		if(SPECIAL_DRAGINTER_RENDER)
			return;
		
		Vec2f mousePos = Vec2f(DANAEMouse);
		
		if(SpecialCursor && !DRAGINTER) {
			if((COMBINE && COMBINE->inv) || COMBINEGOLD) {
				if(TRUE_PLAYER_MOUSELOOK_ON && (config.input.autoReadyWeapon)) {
					mousePos = MemoMouse;
				}
				
				TextureContainer * tc;
				
				if(COMBINEGOLD)
					tc = GoldCoinsTC[5];
				else
					tc = COMBINE->inv;
				
				Vec2f size(tc->m_dwWidth, tc->m_dwHeight);
				
				if(SpecialCursor == CURSOR_COMBINEON) {
					EERIEDrawBitmap(Rectf(mousePos, size.x, size.y), .00001f, tc, Color::white);
					
					if(FlyingOverIO && (FlyingOverIO->ioflags & IO_BLACKSMITH)) {
						float v=ARX_DAMAGES_ComputeRepairPrice(COMBINE,FlyingOverIO);
						
						if(v > 0.f) {
							long t = v;
							Vec2f nuberOffset = Vec2f(-16, -10);
							ARX_INTERFACE_DrawNumber(mousePos + nuberOffset, t, 6, Color::cyan);
						}
					}
				} else {
					EERIEDrawBitmap(Rectf(mousePos, size.x, size.y), 0.00001f, tc, Color(255, 170, 102, 255));
				}
			}
			
			TextureContainer * surf;
			
			switch(SpecialCursor) {
			case CURSOR_REDIST:
				surf = cursorRedist;
				break;
			case CURSOR_COMBINEOFF:
				surf = cursorTargetOff;
				mousePos.x -= 16.f;
				mousePos.y -= 16.f;
				break;
			case CURSOR_COMBINEON:
				surf = cursorTargetOn;
				arx_assert(surf);
				
				mousePos.x -= 16.f;
				mousePos.y -= 16.f;
				break;
			case CURSOR_FIREBALLAIM: {
				surf = cursorTargetOn;
				arx_assert(surf);
				
				Vec2i size = Vec2i(surf->m_dwWidth, surf->m_dwHeight);
				
				mousePos.x = 320.f - size.x / 2.f;
				mousePos.y = 280.f - size.y / 2.f;
				break;
			}
			case CURSOR_INTERACTION_ON:
				cursorAnimatedHand.update1();
				surf = cursorAnimatedHand.getCurrentTexture();
				break;
			default:
				cursorAnimatedHand.update2();
				surf = cursorAnimatedHand.getCurrentTexture();
				break;
			}
			
			arx_assert(surf);
			
			if(SpecialCursor == CURSOR_REDIST) {
				EERIEDrawBitmap(Rectf(mousePos, surf->m_dwWidth * g_sizeRatio.x, surf->m_dwHeight * g_sizeRatio.y),
								0.f, surf, Color::white);
				
				Vec2f textPos = Vec2f(DANAEMouse);
				textPos += Vec2f(6, 11) * g_sizeRatio;
				
				std::stringstream ss;
				ss << std::setw(3) << lCursorRedistValue;
				ARX_TEXT_Draw(hFontInBook, textPos, ss.str(), Color::black);
			} else {
				
				EERIEDrawBitmap(Rectf(mousePos, surf->m_dwWidth, surf->m_dwHeight), 0.f, surf, Color::white);
			}
			
			SpecialCursor = 0;
		} else {
			if(   !(player.Current_Movement & PLAYER_CROUCH)
			   && !BLOCK_PLAYER_CONTROLS
			   && GInput->actionPressed(CONTROLS_CUST_MAGICMODE)
			   && ARXmenu.currentmode == AMCM_OFF
			) {
				if(!MAGICMODE) {
					if(player.Interface & INTER_MAP) {
						ARX_INTERFACE_BookClose(); // Forced Closing
					}
					MAGICMODE = true;
				}
				
				TextureContainer * surf = cursorMagic;
				
				Vec2f pos = Vec2f(DANAEMouse);
				
				if(TRUE_PLAYER_MOUSELOOK_ON) {
					pos = MemoMouse;
				}
				
				Vec2f size(surf->m_dwWidth, surf->m_dwHeight);
				
				pos += -size * 0.5f;
				
				EERIEDrawBitmap(Rectf(pos, size.x, size.y), 0.f, surf, Color::white);
			} else {
				if(MAGICMODE) {
					ARX_SOUND_Stop(SND_MAGIC_DRAW);
					MAGICMODE = false;
				}
				
				if(DRAGINTER && DRAGINTER->inv) {
					TextureContainer * tc = DRAGINTER->inv;
					TextureContainer * haloTc = NULL;
					
					if(NeedHalo(DRAGINTER))
						haloTc = DRAGINTER->inv->getHalo();//>_itemdata->halo_tc;
					
					Color color = (DRAGINTER->poisonous && DRAGINTER->poisonous_count != 0) ? Color::green : Color::white;
					
					Vec2f pos = mousePos;
					
					if(TRUE_PLAYER_MOUSELOOK_ON && config.input.autoReadyWeapon) {
						pos = MemoMouse;
					}
					
					Rectf rect(pos, tc->m_dwWidth, tc->m_dwHeight);
					
					if(!(DRAGINTER->ioflags & IO_MOVABLE)) {
						EERIEDrawBitmap(rect, .00001f, tc, color);
						
						if((DRAGINTER->ioflags & IO_ITEM) && DRAGINTER->_itemdata->count != 1) {
							Vec2f nuberOffset = Vec2f(2.f, 13.f);
							ARX_INTERFACE_DrawNumber(pos + nuberOffset, DRAGINTER->_itemdata->count, 3, Color::white);
						}
					} else {
						if((InInventoryPos(DANAEMouse) || InSecondaryInventoryPos(DANAEMouse)) || CANNOT_PUT_IT_HERE != -1) {
							EERIEDrawBitmap(rect, .00001f, tc, color);
						}
					}
					
					//cross not over inventory icon
					if(   CANNOT_PUT_IT_HERE
					   && (eMouseState != MOUSE_IN_INVENTORY_ICON)
					   && !InInventoryPos(DANAEMouse)
					   && !InSecondaryInventoryPos(DANAEMouse)
					   && !ARX_INTERFACE_MouseInBook()) {
						TextureContainer * tcc = cursorMovable;
						
						if(CANNOT_PUT_IT_HERE == -1)
							tcc = cursorThrowObject;
						
						if(tcc && tcc != tc) // to avoid movable double red cross...
							EERIEDrawBitmap(Rectf(Vec2f(pos.x + 16, pos.y), tcc->m_dwWidth, tcc->m_dwHeight), 0.00001f, tcc, Color::white);
					}
					
					if(haloTc) {
						ARX_INTERFACE_HALO_Draw(DRAGINTER, tc, haloTc, pos);
					}
				} else {
					cursorAnimatedHand.update2();
					TextureContainer * surf = cursorAnimatedHand.getCurrentTexture();
					
					if(surf) {
						EERIEDrawBitmap(Rectf(mousePos, surf->m_dwWidth, surf->m_dwHeight), 0.f, surf, Color::white);
					}
				}
			}
		}
	} else { //mode system shock
		if(SPECIAL_DRAGINTER_RENDER)
			return;
		
		if(   TRUE_PLAYER_MOUSELOOK_ON
		   && config.video.showCrosshair
		   && !(player.Interface & (INTER_COMBATMODE | INTER_NOTE | INTER_MAP))) {
			
			cursorAnimatedHand.reset();
			
			TextureContainer * surf = cursorCrossHair;
			arx_assert(surf);
			
			GRenderer->SetRenderState(Renderer::AlphaBlending, true);
			GRenderer->SetBlendFunc(Renderer::BlendOne, Renderer::BlendOne);
			
			float POSX = g_size.center().x - surf->m_dwWidth * .5f;
			float POSY = g_size.center().y - surf->m_dwHeight * .5f;
			
			EERIEDrawBitmap(Rectf(Vec2f(POSX, POSY), surf->m_dwWidth, surf->m_dwHeight), 0.f, surf, Color3f::gray(.5f).to<u8>());
			
			GRenderer->SetRenderState(Renderer::AlphaBlending, false);
		}
	}
}
Esempio n. 23
0
void RepelUndeadSpell::End() {
	ARX_SOUND_Stop(m_snd_loop);
}
Esempio n. 24
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
	}
}
void MassIncinerateSpell::End()
{
	m_targets.clear();
	ARX_SOUND_Stop(m_snd_loop);
	ARX_SOUND_PlaySFX(SND_SPELL_INCINERATE_END);
}
Esempio n. 26
0
// Draws Flame Particles
void TreatBackgroundActions() {
	
	ARX_PROFILE_FUNC();
	
	float fZFar = square(ACTIVECAM->cdepth * fZFogEnd * 1.3f);
	
	for(size_t i = 0; i < g_staticLightsMax; i++) {
		
		EERIE_LIGHT * gl = g_staticLights[i];
		if(!gl) {
			continue;
		}
		
		float dist = arx::distance2(gl->pos,	ACTIVECAM->orgTrans.pos);
		if(dist > fZFar) {
			// Out of treat range
			ARX_SOUND_Stop(gl->sample);
			gl->sample = audio::INVALID_ID;
			continue;
		}
		
		if((gl->extras & EXTRAS_SPAWNFIRE) && gl->m_ignitionStatus) {
			DamageParameters damage;
			damage.radius = gl->ex_radius;
			damage.damages = gl->ex_radius * (1.0f / 7);
			damage.area = DAMAGE_FULL;
			damage.duration = ArxDurationMs(1);
			damage.source = EntityHandle();
			damage.flags = 0;
			damage.type = DAMAGE_TYPE_MAGICAL | DAMAGE_TYPE_FIRE | DAMAGE_TYPE_NO_FIX;
			damage.pos = gl->pos;
			DamageCreate(damage);
		}
		
		if(!(gl->extras & (EXTRAS_SPAWNFIRE | EXTRAS_SPAWNSMOKE)) || !gl->m_ignitionStatus) {
			if(!gl->m_ignitionStatus && gl->sample != audio::INVALID_ID) {
				ARX_SOUND_Stop(gl->sample);
				gl->sample = audio::INVALID_ID;
			}
			continue;
		}
		
		if(gl->sample == audio::INVALID_ID) {
			gl->sample = SND_FIREPLACE;
			ARX_SOUND_PlaySFX(gl->sample, &gl->pos, Random::getf(0.95f, 1.05f), ARX_SOUND_PLAY_LOOPED);
		} else {
			ARX_SOUND_RefreshPosition(gl->sample, gl->pos);
		}
		
		float amount = 2.f;
		if(dist < square(ACTIVECAM->cdepth * (1.f / 6))) {
			amount = 3.f;
		} else if(dist < square(ACTIVECAM->cdepth * (1.f / 3))) {
			amount = 2.5f;
		}
		const float targetFPS = 61.f;
		const float targetDelay = 1000.f / targetFPS;
		long count = gl->m_storedFlameTime.update(amount * g_framedelay * (1.f / targetDelay));
		
		for(long n = 0; n < count; n++) {
			
			if(Random::getf() < gl->ex_frequency) {
				PARTICLE_DEF * pd = createParticle();
				if(pd) {
					float t = Random::getf() * glm::pi<float>();
					Vec3f s = Vec3f(std::sin(t), std::sin(t), std::cos(t)) * randomVec();
					pd->ov = gl->pos + s * gl->ex_radius;
					pd->move = Vec3f(2.f, 2.f, 2.f) - Vec3f(4.f, 22.f, 4.f) * randomVec3f();
					pd->move *= gl->ex_speed;
					pd->siz = 7.f * gl->ex_size;
					pd->tolive = 500 + Random::getu(0, 1000 * gl->ex_speed);
					if((gl->extras & EXTRAS_SPAWNFIRE) && (gl->extras & EXTRAS_SPAWNSMOKE)) {
						pd->m_flags = FIRE_TO_SMOKE;
					}
					pd->tc = (gl->extras & EXTRAS_SPAWNFIRE) ? fire2 : smokeparticle;
					pd->m_flags |= ROTATING;
					pd->m_rotation = 0.1f - Random::getf(0.f, 0.2f) * gl->ex_speed;
					pd->scale = Vec3f(-8.f);
					pd->rgb = (gl->extras & EXTRAS_COLORLEGACY) ? gl->rgb : Color3f::white;
				}
			}
			
			if(!(gl->extras & EXTRAS_SPAWNFIRE) || Random::getf() <= 0.95f) {
				continue;
			}
			
			if(Random::getf() < gl->ex_frequency) {
				PARTICLE_DEF * pd = createParticle();
				if(pd) {
					float t = Random::getf() * (glm::pi<float>() * 2.f) - glm::pi<float>();
					Vec3f s = Vec3f(std::sin(t), std::sin(t), std::cos(t)) * randomVec();
					pd->ov = gl->pos + s * gl->ex_radius;
					Vec3f vect = glm::normalize(pd->ov - gl->pos);
					float d = (gl->extras & EXTRAS_FIREPLACE) ? 6.f : 4.f;
					pd->move = Vec3f(vect.x * d, Random::getf(-18.f, -10.f), vect.z * d) * gl->ex_speed;
					pd->siz = 4.f * gl->ex_size * 0.3f;
					pd->tolive = 1200 + Random::getu(0, 500 * gl->ex_speed);
					pd->tc = fire2;
					pd->m_flags |= ROTATING | GRAVITY;
					pd->m_rotation = 0.1f - Random::getf(0.f, 0.2f) * gl->ex_speed;
					pd->scale = Vec3f(-3.f);
					pd->rgb = (gl->extras & EXTRAS_COLORLEGACY) ? gl->rgb : Color3f::white;
				}
			}
			
		}
	}
}
Esempio n. 27
0
void RepelUndeadSpell::End() {
	ARX_SOUND_Stop(m_snd_loop);
	
	endLightDelayed(m_light, 500);
}
Esempio n. 28
0
void RepelUndeadSpell::End() {
	ARX_SOUND_Stop(m_snd_loop);
	
	endLightDelayed(m_light, GameDurationMs(500));
}