Пример #1
0
EERIE_LIGHT * dynLightCreate(LightHandle & handle) {
	if(!lightHandleGet(handle)) {
		handle = GetFreeDynLight();
	}
	
	return lightHandleGet(handle);
}
Пример #2
0
void IgnitSpell::Update(float timeDelta)
{
	if(m_elapsed < m_duration) {
		float a = (((float)m_elapsed)) / ((float)m_duration);
		
		if(a >= 1.f)
			a = 1.f;
		
		std::vector<T_LINKLIGHTTOFX>::iterator itr;
		for(itr = m_lights.begin(); itr != m_lights.end(); ++itr) {
			Vec3f pos = glm::mix(m_srcPos, itr->poslight, a);
			
				LightHandle id = itr->idl;
				
				if(lightHandleIsValid(id)) {
					EERIE_LIGHT * light = lightHandleGet(id);
					
					light->intensity = 0.7f + 2.f * rnd();
					light->pos = pos;
				}
		}
	}
	
	if(!arxtime.is_paused())
		m_elapsed += timeDelta;
}
Пример #3
0
void SummonCreatureSpell::Launch()
{
	m_hasDuration = true;
	m_fManaCostPerSecond = 1.9f;
	m_requestSummon = false;
	m_summonedEntity = EntityHandle();
	m_duration = (m_launchDuration > -1) ? m_launchDuration : 2000000;
	
	Vec3f target;
	float beta;
	GetTargetAndBeta(target, beta);
	
	m_megaCheat = (m_caster == PlayerEntityHandle && cur_mega == 10);
	m_targetPos = target;
	ARX_SOUND_PlaySFX(SND_SPELL_SUMMON_CREATURE, &m_targetPos);
	
	m_fissure.Create(target, MAKEANGLE(player.angle.getPitch()));
	m_fissure.SetDuration(2000, 500, 1500);
	m_fissure.SetColorBorder(Color3f::red);
	m_fissure.SetColorRays1(Color3f::red);
	m_fissure.SetColorRays2(Color3f::yellow * .5f);
	
	m_light = GetFreeDynLight();
	if(lightHandleIsValid(m_light)) {
		EERIE_LIGHT * light = lightHandleGet(m_light);
		
		light->intensity = 0.3f;
		light->fallend = 500.f;
		light->fallstart = 400.f;
		light->rgb = Color3f::red;
		light->pos = m_fissure.m_eSrc;
	}
}
Пример #4
0
void IgnitSpell::Update()
{
	if(m_elapsed < m_duration) {
		float a = float(m_elapsed) / float(m_duration);
		
		if(a >= 1.f)
			a = 1.f;
		
		std::vector<T_LINKLIGHTTOFX>::iterator itr;
		for(itr = m_lights.begin(); itr != m_lights.end(); ++itr) {
			
			EERIE_LIGHT * targetLight = g_staticLights[itr->m_targetLight];
			
			Vec3f pos = glm::mix(m_srcPos, targetLight->pos, a);
			
			LightHandle id = itr->m_effectLight;
			
			EERIE_LIGHT * light = lightHandleGet(id);
			if(light) {
				light->intensity = Random::getf(0.7f, 2.7f);
				light->pos = pos;
			}
		}
	}
	
	if(!arxtime.is_paused())
		m_elapsed += g_framedelay;
}
Пример #5
0
void SummonCreatureSpell::End() {
	
	lightHandleDestroy(m_light);
	// need to killio
	
	if(ValidIONum(m_summonedEntity)) {
		Entity * io = entities[m_summonedEntity];
		
		ARX_SOUND_PlaySFX(SND_SPELL_ELECTRIC, &io->pos);
		
		if(io->scriptload && (io->ioflags & IO_NOSAVE)) {
			
			AddRandomSmoke(io, 100);
			Vec3f posi = io->pos;
			posi.y -= 100.f;
			MakeCoolFx(posi);
		
			LightHandle nn = GetFreeDynLight();
			if(lightHandleIsValid(nn)) {
				EERIE_LIGHT * light = lightHandleGet(nn);
				
				light->intensity = Random::getf(0.7f, 2.7f);
				light->fallend = 600.f;
				light->fallstart = 400.f;
				light->rgb = Color3f(1.0f, 0.8f, 0.0f);
				light->pos = posi;
				light->duration = 600;
			}
			
			io->destroyOne();
		}
	}
	
	m_summonedEntity = EntityHandle();
}
Пример #6
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;
				}
			}
		}
	}
}
Пример #7
0
void FakeSummonSpell::Launch()
{
	m_hasDuration = true;
	m_fManaCostPerSecond = 1.9f;
	m_duration = 4000;
	
	Vec3f target = entities[m_target]->pos;
	if(m_target != PlayerEntityHandle) {
		target.y += player.baseHeight();
	}
	m_targetPos = target;
	ARX_SOUND_PlaySFX(SND_SPELL_SUMMON_CREATURE, &m_targetPos);
	
	m_fissure.Create(target, MAKEANGLE(player.angle.getPitch()));
	m_fissure.SetDuration(2000, 500, 1500);
	m_fissure.SetColorBorder(Color3f::red);
	m_fissure.SetColorRays1(Color3f::red);
	m_fissure.SetColorRays2(Color3f::yellow * .5f);
	
	m_light = GetFreeDynLight();
	
	if(lightHandleIsValid(m_light)) {
		EERIE_LIGHT * light = lightHandleGet(m_light);
		
		light->intensity = 0.3f;
		light->fallend = 500.f;
		light->fallstart = 400.f;
		light->rgb = Color3f::red;
		light->pos = m_fissure.m_eSrc;
	}
}
Пример #8
0
void RiseDeadSpell::End()
{
	if(ValidIONum(m_entity)) {
		Entity *entity = entities[m_entity];
		
		ARX_SOUND_PlaySFX(SND_SPELL_ELECTRIC, &entity->pos);
		
		if(entity->scriptload && (entity->ioflags & IO_NOSAVE)) {
			AddRandomSmoke(entity,100);
			Vec3f posi = entity->pos;
			posi.y-=100.f;
			MakeCoolFx(posi);
			
			LightHandle nn = GetFreeDynLight();

			if(lightHandleIsValid(nn)) {
				EERIE_LIGHT * light = lightHandleGet(nn);
				
				light->intensity = Random::getf(0.7f, 2.7f);
				light->fallend = 600.f;
				light->fallstart = 400.f;
				light->rgb = Color3f(1.0f, 0.8f, 0.f);
				light->pos = posi;
				light->duration = 600;
			}

			entity->destroyOne();
		}
	}
	
	endLightDelayed(m_light, 500);
}
Пример #9
0
static void CheckExp(long i) {
	
	if((Thrown[i].flags & ATO_FIERY) && !(Thrown[i].flags & ATO_UNDERWATER)) {
		const Vec3f & pos = Thrown[i].position;

		ARX_BOOMS_Add(pos);
		LaunchFireballBoom(pos, 10);
		DoSphericDamage(Sphere(pos, 50.f), 4.f * 2, DAMAGE_AREA, DAMAGE_TYPE_FIRE | DAMAGE_TYPE_MAGICAL, PlayerEntityHandle);
		ARX_SOUND_PlaySFX(SND_SPELL_FIRE_HIT, &pos);
		ARX_NPC_SpawnAudibleSound(pos, entities.player());
		LightHandle id = GetFreeDynLight();

		if(lightHandleIsValid(id) && framedelay > 0) {
			EERIE_LIGHT * light = lightHandleGet(id);
			
			light->intensity = 3.9f;
			light->fallstart = 400.f;
			light->fallend   = 440.f;
			light->rgb = Color3f(1.f, .8f, .6f) - randomColor3f() * Color3f(.2f, .2f, .2f);
			light->pos = pos;
			light->ex_flaresize = 40.f;
			light->duration = 1500;
		}
	}
}
Пример #10
0
void RuneOfGuardingSpell::Launch()
{
	spells.endByCaster(m_caster, SPELL_RUNE_OF_GUARDING);
	
	ARX_SOUND_PlaySFX(SND_SPELL_RUNE_OF_GUARDING);
	
	m_duration = (m_launchDuration > -1) ? m_launchDuration : 99999999;
	
	m_pos = entities[m_caster]->pos;
	
	tex_p2 = TextureContainer::Load("graph/obj3d/textures/(fx)_tsu_blueting");
	
	m_light = GetFreeDynLight();
	if(lightHandleIsValid(m_light)) {
		EERIE_LIGHT * light = lightHandleGet(m_light);
		
		light->intensity = 0.7f + 2.3f;
		light->fallend = 500.f;
		light->fallstart = 400.f;
		light->rgb = Color3f(1.0f, 0.2f, 0.2f);
		light->pos = m_pos - Vec3f(0.f, 50.f, 0.f);
		light->time_creation = (unsigned long)(arxtime);
		light->duration = 200;
	}
}
Пример #11
0
void CMultiPoisonProjectile::Create(Vec3f srcPos, float afBeta) {
	
	long lMax = 0;

	for(size_t i = 0; i < m_projectiles.size(); i++) {
		CPoisonProjectile * projectile = m_projectiles[i];
		
		projectile->Create(srcPos, afBeta + frand2() * 10.0f);
		long lTime = ulDuration + Random::get(0, 5000);
		projectile->SetDuration(lTime);
		lMax = std::max(lMax, lTime);

		projectile->lLightId = GetFreeDynLight();

		if(lightHandleIsValid(projectile->lLightId)) {
			EERIE_LIGHT * light = lightHandleGet(projectile->lLightId);
			
			light->intensity		= 2.3f;
			light->fallend		= 250.f;
			light->fallstart		= 150.f;
			light->rgb = Color3f::green;
			light->pos = projectile->eSrc;
			light->time_creation	= (unsigned long)(arxtime);
			light->duration		= 200;
		}
	}

	SetDuration(lMax + 1000);
}
void MassLightningStrikeSpell::Launch()
{
	spells.endByType(SPELL_MASS_LIGHTNING_STRIKE);
	
	m_duration = 5000; // TODO probably never read
	m_soundEffectPlayed = false;
	
	float beta;
	if(m_caster == PlayerEntityHandle) {
		m_pos = player.pos + Vec3f(0.f, 150.f, 0.f);
		beta = player.angle.getPitch();
	} else {
		Entity * io = entities[m_caster];
		m_pos = io->pos + Vec3f(0.f, -20.f, 0.f);
		beta = io->angle.getPitch();
	}
	m_pos += angleToVectorXZ(beta) * 500.f;
	
	long minDuration = long(500 * m_level);
	long maxDuration = 0;
	
	int number = glm::clamp(int(m_level), 1, 10);
	float ft = 360.0f / (float)number;
	
	for(int i = 0; i < number; i++) {
		Vec3f target = m_pos + angleToVectorXZ(i * ft) * 500.0f;
		long duration = minDuration + Random::get(0, 5000);
		maxDuration = std::max(maxDuration, duration);
		
		CLightning * lightning = new CLightning();
		lightning->m_isMassLightning = true;
		lightning->m_fDamage = 2;
		lightning->Create(m_pos, target);
		lightning->SetDuration(duration);
		pTab.push_back(lightning);
	}
	
	m_duration = maxDuration + 1000;
	
	m_light = GetFreeDynLight();
	if(lightHandleIsValid(m_light)) {
		EERIE_LIGHT * light = lightHandleGet(m_light);
		
		light->intensity = 1.8f;
		light->fallend = 850.f;
		light->fallstart = 500.f;
		light->rgb = Color3f::red; // Color3f(1.f, 0.75f, 0.75f);
		light->pos = m_pos;
	}
	
	ARX_SOUND_PlaySFX(SND_SPELL_LIGHTNING_START);
	m_snd_loop = ARX_SOUND_PlaySFX(SND_SPELL_LIGHTNING_LOOP, &m_pos, 1.f, ARX_SOUND_PLAY_LOOPED);
	
	// Draws White Flash on Screen
	GRenderer->SetBlendFunc(BlendOne, BlendOne);
	GRenderer->SetRenderState(Renderer::AlphaBlending, true);
	EERIEDrawBitmap(Rectf(g_size), 0.00009f, NULL, Color::white);
	GRenderer->SetRenderState(Renderer::AlphaBlending, false);
}
Пример #13
0
void FireFieldSpell::Update(float timeDelta) {
	
	pPSStream.Update(timeDelta);
	pPSStream1.Update(timeDelta);
	
	
	if(!lightHandleIsValid(m_light))
		m_light = GetFreeDynLight();
	
	if(lightHandleIsValid(m_light)) {
		EERIE_LIGHT * el = lightHandleGet(m_light);
		
		el->pos = m_pos + Vec3f(0.f, -120.f, 0.f);
		el->intensity = 4.6f;
		el->fallstart = 150.f+rnd()*30.f;
		el->fallend   = 290.f+rnd()*30.f;
		el->rgb = Color3f(1.f, 0.8f, 0.6f) - Color3f(rnd()*(1.0f/10), 0.f, 0.f);
		el->duration = 600;
		el->extras=0;
	}
	
	if(VisibleSphere(Sphere(m_pos - Vec3f(0.f, 120.f, 0.f), 350.f))) {
		
		pPSStream.Render();
		pPSStream1.Render();
		
		float fDiff = timeDelta / 8.f;
		int nTime = checked_range_cast<int>(fDiff);
		
		for(long nn=0;nn<=nTime+1;nn++) {
			
			PARTICLE_DEF * pd = createParticle();
			if(!pd) {
				break;
			}
			
			float t = rnd() * (PI * 2.f) - PI;
			float ts = std::sin(t);
			float tc = std::cos(t);
			pd->ov = m_pos + Vec3f(120.f * ts, 15.f * ts, 120.f * tc) * randomVec();
			pd->move = Vec3f(2.f, 1.f, 2.f) + Vec3f(-4.f, -8.f, -4.f) * Vec3f(rnd(), rnd(), rnd());
			pd->siz = 7.f;
			pd->tolive = Random::get(500, 1500);
			pd->tc = fire2;
			pd->special = ROTATING | MODULATE_ROTATION | FIRE_TO_SMOKE;
			pd->fparam = 0.1f - rnd() * 0.2f;
			pd->scale = Vec3f(-8.f);
			
			PARTICLE_DEF * pd2 = createParticle();
			if(!pd2) {
				break;
			}
			
			*pd2 = *pd;
			pd2->delay = Random::get(60, 210);
		}
		
	}
}
Пример #14
0
void lightHandleDestroy(LightHandle & handle) {
	
	if(EERIE_LIGHT * light = lightHandleGet(handle)) {
		light->m_exists = false;
	}
	
	handle = LightHandle();
}
Пример #15
0
void endLightDelayed(LightHandle & handle, GameDuration delay) {
	
	if(EERIE_LIGHT * light = lightHandleGet(handle)) {
		light->duration = delay;
		light->creationTime = g_gameTime.now();
	}
	
}
Пример #16
0
void CRepelUndead::Render() {
	
	if(ulCurrentTime >= ulDuration)
		return;
	
	RenderMaterial mat;
	mat.setDepthTest(true);
	mat.setBlendType(RenderMaterial::Additive);
	
	Anglef  eObjAngle;

	eObjAngle.setPitch(m_yaw);
	eObjAngle.setYaw(0);
	eObjAngle.setRoll(0);

	float vv = 1.f + (std::sin(arxtime.get_updated() * ( 1.0f / 1000 ))); 
	vv *= ( 1.0f / 2 );
	vv += 1.1f;
	
	Draw3DObject(ssol, eObjAngle, eSrc + Vec3f(0.f, -5.f, 0.f), Vec3f(vv), Color3f(0.6f, 0.6f, 0.8f), mat);
	
	vv *= 100.f;
	
	for(int n = 0; n < 4; n++) {
		
		PARTICLE_DEF * pd = createParticle();
		if(!pd) {
			break;
		}
		
		float dx = -std::sin(frand2() * 360.f) * vv;
		float dz =  std::cos(frand2() * 360.f) * vv;
		pd->ov = eSrc + Vec3f(dx, 0.f, dz);
		pd->move = Vec3f(0.8f * frand2(), -4.f * rnd(), 0.8f * frand2());
		pd->scale = Vec3f(-0.1f);
		pd->tolive = Random::get(2600, 3200);
		pd->tc = tex_p2;
		pd->siz = 0.3f;
		pd->rgb = Color3f(.4f, .4f, .6f);
	}
	
	if(!lightHandleIsValid(lLightId)) {
		lLightId = GetFreeDynLight();
	}
	
	if(lightHandleIsValid(lLightId)) {
		EERIE_LIGHT * light = lightHandleGet(lLightId);
		
		light->intensity = 2.3f;
		light->fallend = 350.f;
		light->fallstart = 150.f;
		light->rgb = Color3f(0.8f, 0.8f, 1.f);
		light->pos = eSrc + Vec3f(0.f, -50.f, 0.f);
		light->duration = 200;
		light->time_creation = (unsigned long)(arxtime);
	}
}
Пример #17
0
void CMultiMagicMissile::Create(Vec3f aePos, float afAlpha, float afBeta)
{
	
	long lMax = 0;
	
	for(size_t i = 0; i < pTab.size(); i++) {
		Anglef angles(afAlpha, afBeta, 0.f);
		
		if(i > 0) {
			angles.setYaw(angles.getYaw() + frand2() * 4.0f);
			angles.setPitch(angles.getPitch() + frand2() * 6.0f);
		}
		
		pTab[i]->Create(aePos, angles);  
		
		float fTime = ulDuration + frand2() * 1000.0f;
		long lTime = checked_range_cast<long>(fTime);
		
		lTime		= std::max(1000L, lTime);
		lMax		= std::max(lMax, lTime);
		
		CMagicMissile * pMM = (CMagicMissile *)pTab[i];
		
		pMM->SetDuration(lTime);
		
		if(m_mrCheat) {
			pMM->SetColor(Color3f(0.9f, 0.2f, 0.5f));
		} else {
			pMM->SetColor(Color3f(0.9f + rnd() * 0.1f, 0.9f + rnd() * 0.1f, 0.7f + rnd() * 0.3f));
		}
		
		pTab[i]->lLightId = GetFreeDynLight();
		
		if(lightHandleIsValid(pTab[i]->lLightId)) {
			EERIE_LIGHT * el = lightHandleGet(pTab[i]->lLightId);
			
			el->intensity	= 0.7f + 2.3f;
			el->fallend		= 190.f;
			el->fallstart	= 80.f;
			
			if(m_mrCheat) {
				el->rgb.r = 1;
				el->rgb.g = 0.3f;
				el->rgb.b = 0.8f;
			} else {
				el->rgb.r = 0;
				el->rgb.g = 0;
				el->rgb.b = 1;
			}
			
			el->pos	 = pMM->eSrc;
			el->duration = 300;
		}
	}
	
	SetDuration(lMax + 1000);
}
Пример #18
0
void endLightDelayed(LightHandle & handle, long delay) {

    if(lightHandleIsValid(handle)) {
        EERIE_LIGHT * light = lightHandleGet(handle);

        light->duration = delay;
        light->time_creation = (unsigned long)(arxtime);
    }
}
Пример #19
0
void CurePoisonSpell::Update(float timeDelta) {
	
	ulCurrentTime += timeDelta;
	
	m_pos = entities[m_target]->pos;
	
	if(m_target == PlayerEntityHandle)
		m_pos.y += 200;
	
	unsigned long ulCalc = m_duration - ulCurrentTime ;
	arx_assert(ulCalc <= LONG_MAX);
	long ff = 	static_cast<long>(ulCalc);

	if(ff < 1500) {
		pPS.m_parameters.m_spawnFlags = PARTICLE_CIRCULAR;
		pPS.m_parameters.m_gravity = Vec3f_ZERO;

		std::list<Particle *>::iterator i;

		for(i = pPS.listParticle.begin(); i != pPS.listParticle.end(); ++i) {
			Particle * pP = *i;

			if(pP->isAlive()) {
				pP->fColorEnd.a = 0;

				if(pP->m_age + ff < pP->m_timeToLive) {
					pP->m_age = pP->m_timeToLive - ff;
				}
			}
		}
	}

	pPS.SetPos(m_pos);
	pPS.Update(timeDelta);

	if(!lightHandleIsValid(m_light))
		m_light = GetFreeDynLight();

	if(lightHandleIsValid(m_light)) {
		EERIE_LIGHT * light = lightHandleGet(m_light);
		
		light->intensity = 2.3f;
		light->fallstart = 200.f;
		light->fallend   = 350.f;
		light->rgb = Color3f(0.4f, 1.f, 0.4f);
		light->pos = m_pos + Vec3f(0.f, -50.f, 0.f);
		light->duration = 200;
		light->time_creation = (unsigned long)(arxtime);
		light->extras = 0;
	}
	
	pPS.Render();
}
Пример #20
0
void ManageTorch() {
	arx_assert(entities.player());
	
	EERIE_LIGHT * el = lightHandleGet(torchLightHandle);
	
	if(player.torch) {
		
		float rr = Random::getf();
		el->pos = player.pos;
		el->intensity = 1.6f;
		el->fallstart = 280.f + rr * 20.f;
		el->fallend = el->fallstart + 280.f;
		el->exist = 1;
		el->rgb = player.m_torchColor - Color3f(rr, rr, rr) * Color3f(0.1f, 0.1f, 0.1f);
		el->duration = ArxDuration_ZERO;
		el->extras = 0;
		
	} else if(cur_mr == 3) {
		
		el->pos = player.pos;
		el->intensity = 1.8f;
		el->fallstart = 480.f;
		el->fallend = el->fallstart + 480.f; 
		el->exist = 1;
		el->rgb = Color3f(1.f, .5f, .8f);
		el->duration = ArxDuration_ZERO;
		el->extras = 0;
		
	} else {
		
		long count = MagicFlareCountNonFlagged();
		
		if(count) {
			float rr = Random::getf();
			el->pos = player.pos;
			el->fallstart = 140.f + float(count) * 0.333333f + rr * 5.f;
			el->fallend = 220.f + float(count) * 0.5f + rr * 5.f;
			el->intensity = 1.6f;
			el->exist = 1;
			el->rgb = Color3f(0.01f * count, 0.009f * count, 0.008f * count);
		} else {
			el->exist = 0;
		}
	}
	
	if(   entities.player()->obj
	   && entities.player()->obj->fastaccess.head_group_origin != ObjVertHandle()
	) {
		s32 vertex = entities.player()->obj->fastaccess.head_group_origin.handleData();
		el->pos.y = entities.player()->obj->vertexlist3[vertex].v.y;
	}
}
Пример #21
0
void CCurePoison::Update(float timeDelta)
{
	ulCurrentTime += timeDelta;

	if(ulCurrentTime >= ulDuration)
		return;
	
	unsigned long ulCalc = ulDuration - ulCurrentTime ;
	arx_assert(ulCalc <= LONG_MAX);
	long ff = 	static_cast<long>(ulCalc);

	if(ff < 1500) {
		pPS->m_parameters.m_spawnFlags = PARTICLE_CIRCULAR;
		pPS->m_parameters.m_gravity = Vec3f_ZERO;

		std::list<Particle *>::iterator i;

		for(i = pPS->listParticle.begin(); i != pPS->listParticle.end(); ++i) {
			Particle * pP = *i;

			if(pP->isAlive()) {
				pP->fColorEnd.a = 0;

				if(pP->m_age + ff < pP->m_timeToLive) {
					pP->m_age = pP->m_timeToLive - ff;
				}
			}
		}
	}

	pPS->SetPos(eSrc);
	pPS->Update(timeDelta);

	if(!lightHandleIsValid(pPS->m_lightHandle))
		pPS->m_lightHandle = GetFreeDynLight();

	if(lightHandleIsValid(pPS->m_lightHandle)) {
		EERIE_LIGHT * light = lightHandleGet(pPS->m_lightHandle);
		
		light->intensity = 2.3f;
		light->fallstart = 200.f;
		light->fallend   = 350.f;
		light->rgb = Color3f(0.4f, 1.f, 0.4f);
		light->pos = eSrc + Vec3f(0.f, -50.f, 0.f);
		light->duration = 200;
		light->time_creation = (unsigned long)(arxtime);
		light->extras = 0;
	}
}
Пример #22
0
void CMultiMagicMissile::Render()
{ 
	for(size_t i = 0; i < pTab.size(); i++) {
		pTab[i]->Render();
		
		CMagicMissile * pMM = (CMagicMissile *) pTab[i];
		
		if(lightHandleIsValid(pMM->lLightId)) {
			EERIE_LIGHT * el	= lightHandleGet(pMM->lLightId);
			el->intensity		= 0.7f + 2.3f * pMM->lightIntensityFactor;
			el->pos = pMM->eCurPos;
			el->time_creation	= (unsigned long)(arxtime);
		}
	}
}
Пример #23
0
void CHeal::Create() {
	
	pPS->m_lightHandle = GetFreeDynLight();

	if(lightHandleIsValid(pPS->m_lightHandle)) {
		EERIE_LIGHT * light = lightHandleGet(pPS->m_lightHandle);
		
		light->intensity = 2.3f;
		light->fallstart = 200.f;
		light->fallend   = 350.f;
		light->rgb = Color3f(0.4f, 0.4f, 1.0f);
		light->pos = eSrc + Vec3f(0.f, -50.f, 0.f);
		light->duration = 200;
		light->extras = 0;
	}

	pPS->SetPos(eSrc);
	ParticleParams cp = ParticleParams();
	cp.m_nbMax = 350;
	cp.m_life = 800;
	cp.m_lifeRandom = 2000;
	cp.m_pos = Vec3f(100, 200, 100);
	cp.m_direction = Vec3f(0, -10, 0) * 0.1f;
	cp.m_angle = glm::radians(5.f);
	cp.m_speed = 120;
	cp.m_speedRandom = 84;
	cp.m_gravity = Vec3f(0, -10, 0);
	cp.m_flash = 0;
	cp.m_rotation = 1.0f / (101 - 80);

	cp.m_startSegment.m_size = 8;
	cp.m_startSegment.m_sizeRandom = 8;
	cp.m_startSegment.m_color = Color(205, 205, 255, 245).to<float>();
	cp.m_startSegment.m_colorRandom = Color(50, 50, 0, 10).to<float>();

	cp.m_endSegment.m_size = 6;
	cp.m_endSegment.m_sizeRandom = 4;
	cp.m_endSegment.m_color = Color(20, 20, 30, 0).to<float>();
	cp.m_endSegment.m_colorRandom = Color(0, 0, 40, 0).to<float>();
	
	cp.m_blendMode = RenderMaterial::Additive;
	cp.m_texture.set("graph/particles/heal_0005", 0, 100);
	cp.m_spawnFlags = PARTICLE_CIRCULAR | PARTICLE_BORDER;
	
	pPS->SetParams(cp);
}
Пример #24
0
CMultiPoisonProjectile::~CMultiPoisonProjectile()
{
	for(size_t i = 0; i < m_projectiles.size(); i++) {
		CPoisonProjectile * projectile = m_projectiles[i];
		
		if(lightHandleIsValid(projectile->lLightId)) {
			EERIE_LIGHT * light = lightHandleGet(projectile->lLightId);
			
			light->duration = 2000;
			light->time_creation = (unsigned long)(arxtime);
			
			projectile->lLightId = LightHandle::Invalid;
		}

		delete projectile;
	}
}
Пример #25
0
// Kills a missile
static void ARX_MISSILES_Kill(long i) {
	
	switch (missiles[i].type)
	{
		case MISSILE_FIREBALL :

			if(lightHandleIsValid(missiles[i].longinfo)) {
				EERIE_LIGHT * light = lightHandleGet(missiles[i].longinfo);
				
				light->duration = 150;
			}

			break;
		case MISSILE_NONE: break;
	}

	missiles[i].type = MISSILE_NONE;
}
Пример #26
0
void CRuneOfGuarding::Update(float timeDelta) {
	
	ulCurrentTime += timeDelta;
	
	float fa = 1.0f - rnd() * 0.15f;
	
	if(lightHandleIsValid(lLightId)) {
		EERIE_LIGHT * light = lightHandleGet(lLightId);
		
		light->intensity = 0.7f + 2.3f * fa;
		light->fallend = 350.f;
		light->fallstart = 150.f;
		light->rgb.r = 1.0f;
		light->rgb.g = 0.2f;
		light->rgb.b = 0.2f;
		light->time_creation = (unsigned long)(arxtime);
		light->duration = 200;
	}
}
void MassLightningStrikeSpell::Update(float timeDelta) {
	
	for(size_t i = 0; i < pTab.size(); i++) {
		CLightning * lightning = pTab[i];
		
		lightning->m_caster = m_caster;
		lightning->m_level = m_level;
		
		lightning->Update(timeDelta);
	}
	
	for(size_t i = 0; i < pTab.size(); i++) {
		pTab[i]->Render();
	}
	
	Vec3f position;

	position = m_pos + randomVec(-250.f, 250.f);
	ARX_SOUND_RefreshPosition(m_snd_loop, position);
	ARX_SOUND_RefreshVolume(m_snd_loop, 1.f);
	ARX_SOUND_RefreshPitch(m_snd_loop, Random::getf(0.8f, 1.2f));
	
	if(Random::getf() > 0.62f) {
		position = m_pos + randomVec(-250.f, 250.f);
		ARX_SOUND_PlaySFX(SND_SPELL_SPARK, &position, Random::getf(0.8f, 1.2f));
	}
	
	if(Random::getf() > 0.82f) {
		position = m_pos + randomVec(-250.f, 250.f);
		ARX_SOUND_PlaySFX(SND_SPELL_ELECTRIC, &position, Random::getf(0.8f, 1.2f));
	}
	
	if(0 > (long(m_duration) - 1800) && !m_soundEffectPlayed) {
		m_soundEffectPlayed = true;
		ARX_SOUND_PlaySFX(SND_SPELL_ELECTRIC, NULL, Random::getf(0.8f, 1.2f));
	}

	if(lightHandleIsValid(m_light)) {
		EERIE_LIGHT * light = lightHandleGet(m_light);
		
		light->intensity = Random::getf(1.3f, 2.3f);
	}	
}
Пример #28
0
void PoisonProjectileSpell::Update(float timeDelta) {
	
	for(size_t i = 0; i < m_projectiles.size(); i++) {
		CPoisonProjectile * projectile = m_projectiles[i];
		
		projectile->Update(timeDelta);
	}
	
	for(size_t i = 0; i < m_projectiles.size(); i++) {
		CPoisonProjectile * projectile = m_projectiles[i];
		
		projectile->Render();
		
		if(lightHandleIsValid(projectile->lLightId)) {
			EERIE_LIGHT * light = lightHandleGet(projectile->lLightId);
			
			light->intensity	= 2.3f * projectile->lightIntensityFactor;
			light->fallend	= 250.f;
			light->fallstart	= 150.f;
			light->rgb = Color3f::green;
			light->pos = projectile->eCurPos;
			light->time_creation = (unsigned long)(arxtime);
			light->duration	= 200;
		}

		AddPoisonFog(projectile->eCurPos, m_level + 7);

		if(m_timcreation + 1600 < (unsigned long)(arxtime)) {
			
			DamageParameters damage;
			damage.pos = projectile->eCurPos;
			damage.radius = 120.f;
			float v = 4.f + m_level * ( 1.0f / 10 ) * 6.f ;
			damage.damages = v * ( 1.0f / 1000 ) * framedelay;
			damage.area = DAMAGE_FULL;
			damage.duration = static_cast<long>(framedelay);
			damage.source = m_caster;
			damage.flags = 0;
			damage.type = DAMAGE_TYPE_MAGICAL | DAMAGE_TYPE_POISON;
			DamageCreate(damage);
		}
	}
}
Пример #29
0
void PoisonProjectileSpell::Update() {
	
	for(size_t i = 0; i < m_projectiles.size(); i++) {
		CPoisonProjectile * projectile = m_projectiles[i];
		
		projectile->Update(g_gameTime.lastFrameDuration());
	}
	
	for(size_t i = 0; i < m_projectiles.size(); i++) {
		CPoisonProjectile * projectile = m_projectiles[i];
		
		projectile->Render();
		
		EERIE_LIGHT * light = lightHandleGet(projectile->lLightId);
		if(light) {
			light->intensity = 2.3f * projectile->lightIntensityFactor;
			light->fallend = 250.f;
			light->fallstart = 150.f;
			light->rgb = Color3f::green;
			light->pos = projectile->eCurPos;
			light->creationTime = g_gameTime.now();
			light->duration = GameDurationMs(200);
		}

		AddPoisonFog(projectile->eCurPos, m_level + 7);

		if(m_elapsed > GameDurationMs(1600)) {
			DamageParameters damage;
			damage.pos = projectile->eCurPos;
			damage.radius = 120.f;
			damage.damages = (4.f + m_level * 0.6f) * 0.001f * g_framedelay;
			damage.area = DAMAGE_FULL;
			damage.duration = g_gameTime.lastFrameDuration();
			damage.source = m_caster;
			damage.flags = 0;
			damage.type = DAMAGE_TYPE_MAGICAL | DAMAGE_TYPE_POISON;
			DamageCreate(damage);
		}
		
	}
	
}
Пример #30
0
void EERIE_LIGHT_GlobalInit() {

    static long init = 0;

    if(!init) {
        memset(GLight, 0, sizeof(*GLight) * MAX_LIGHTS);
        init = 1;
        return;
    }

    for(size_t i = 0; i < MAX_LIGHTS; i++) {
        if(GLight[i]) {
            if(lightHandleIsValid(GLight[i]->m_ignitionLightHandle)) {
                lightHandleGet(GLight[i]->m_ignitionLightHandle)->exist = 0;
            }
            free(GLight[i]);
            GLight[i] = NULL;
        }
    }
}