コード例 #1
0
ファイル: SpellsLvl09.cpp プロジェクト: BSzili/ArxLibertatis
void NegateMagicSpell::Update() {
	
	LaunchAntiMagicField();
	
	if(m_target == EntityHandle_Player) {
		m_pos = player.basePosition();
	} else {
		Entity * target = entities.get(m_target);
		if(target) {
			m_pos = target->pos;
		}
	}
	
	Vec3f stitepos = m_pos - Vec3f(0.f, 10.f, 0.f);
	
	RenderMaterial mat;
	mat.setLayer(RenderMaterial::Decal);
	mat.setDepthTest(true);
	mat.setTexture(tex_sol);
	mat.setBlendType(RenderMaterial::Additive);
	
	for(int i = 0; i < 360; i++) {
		float t = Random::getf();
		if(t < 0.04f) {
			
			PARTICLE_DEF * pd = createParticle();
			if(!pd) {
				break;
			}
			
			pd->ov = stitepos + arx::randomOffsetXZ(150.f);
			pd->move = Vec3f(0.f, Random::getf(-3.f, 0.f), 0.f);
			pd->siz = 0.3f;
			pd->tolive = Random::getu(2000, 4000);
			pd->tc = tex_p2;
			pd->m_flags = FADE_IN_AND_OUT | ROTATING | DISSIPATING | SUBSTRACT;
			pd->m_rotation = 0.0000001f;
		}
	}
	
	float rot = timeWaveSaw(g_gameTime.now(), GameDurationMs(18000)) * 360.f;
	
	Anglef stiteangle(0.f, -rot, 0.f);
	float scalediff = timeWaveSin(g_gameTime.now(), GameDurationMsf(1570.79632f));
	
	{
	Color3f stitecolor = Color3f::gray(.4f);
	Vec3f stitescale = Vec3f(3.f + 0.5f * scalediff);
	Draw3DObject(ssol, stiteangle, stitepos, stitescale, stitecolor, mat);
	}
	
	{
	Color3f stitecolor = Color3f(.5f, 0.f, .5f);
	Vec3f stitescale = Vec3f(3.1f + 0.2f * scalediff);
	Draw3DObject(ssol, stiteangle, stitepos, stitescale, stitecolor, mat);
	}
}
コード例 #2
0
ファイル: SpellsLvl09.cpp プロジェクト: nemyax/ArxLibertatis
void NegateMagicSpell::Update() {
	
	LaunchAntiMagicField();
	
	if(m_target == PlayerEntityHandle) {
		m_pos = player.basePosition();
	} else {
		m_pos = entities[m_target]->pos;
	}
	
	Vec3f stitepos = m_pos - Vec3f(0.f, 10.f, 0.f);
	
	RenderMaterial mat;
	mat.setLayer(RenderMaterial::Decal);
	mat.setDepthTest(true);
	mat.setTexture(tex_sol);
	mat.setBlendType(RenderMaterial::Additive);
	
	for(int i = 0; i < 360; i++) {
		float t = Random::getf();
		if(t < 0.04f) {
			
			PARTICLE_DEF * pd = createParticle();
			if(!pd) {
				break;
			}
			
			pd->ov = stitepos + Vec3f(Random::getf(-150.f, 150.f), 0.f, Random::getf(-150.f, 150.f));
			pd->move = Vec3f(0.f, Random::getf(-3.f, 0.f), 0.f);
			pd->siz = 0.3f;
			pd->tolive = Random::getu(2000, 4000);
			pd->tc = tex_p2;
			pd->special = FADE_IN_AND_OUT | ROTATING | MODULATE_ROTATION | DISSIPATING
			              | SUBSTRACT;
			pd->fparam = 0.0000001f;
		}
	}
	
	float now = arxtime.now_f();
	
	Anglef stiteangle(0.f, -now * 0.02f, 0.f);
	float scalediff = std::sin(now * 0.004f);
	
	{
	Color3f stitecolor = Color3f::gray(.4f);
	Vec3f stitescale = Vec3f(3.f + 0.5f * scalediff);
	Draw3DObject(ssol, stiteangle, stitepos, stitescale, stitecolor, mat);
	}
	
	{
	Color3f stitecolor = Color3f(.5f, 0.f, .5f);
	Vec3f stitescale = Vec3f(3.1f + 0.2f * scalediff);
	Draw3DObject(ssol, stiteangle, stitepos, stitescale, stitecolor, mat);
	}
}
コード例 #3
0
ファイル: Spells09.cpp プロジェクト: HerculesCE/ArxLibertatis
void CNegateMagic::Render() {
	
	int i = 0;
	
	Vec3f stitepos = eSrc - Vec3f(0.f, 10.f, 0.f);

	if(ulCurrentTime >= ulDuration)
		return;
	
	RenderMaterial mat;
	mat.setLayer(RenderMaterial::Decal);
	mat.setDepthTest(true);
	mat.setTexture(tex_sol);
	mat.setBlendType(RenderMaterial::Additive);
	
	for(i = 0; i < 360; i++) {
		float t = rnd();
		if(t < 0.04f) {
			
			PARTICLE_DEF * pd = createParticle();
			if(!pd) {
				break;
			}
			
			pd->ov = stitepos + Vec3f(frand2() * 150.f, 0.f, frand2() * 150.f);
			pd->move = Vec3f(0.f, -3.0f * rnd(), 0.f);
			pd->siz = 0.3f;
			pd->tolive = Random::get(2000, 4000);
			pd->tc = tex_p2;
			pd->special = FADE_IN_AND_OUT | ROTATING | MODULATE_ROTATION | DISSIPATING
			              | SUBSTRACT;
			pd->fparam = 0.0000001f;
		}
	}
	
	Anglef stiteangle(0.f, -(float) ulCurrentTime * 0.02f, 0.f);
	Color3f stitecolor = Color3f::gray(.4f);
	float scalediff = std::sin(ulCurrentTime * 0.004f);
	Vec3f stitescale = Vec3f(3.f + 0.5f * scalediff);
	Draw3DObject(ssol, stiteangle, stitepos, stitescale, stitecolor, mat);
	
	stitecolor = Color3f(.5f, 0.f, .5f);
	stitescale = Vec3f(3.1f + 0.2f * scalediff);
	Draw3DObject(ssol, stiteangle, stitepos, stitescale, stitecolor, mat);
}
コード例 #4
0
ファイル: Spells04.cpp プロジェクト: Eli2/ArxLibertatis
float CTelekinesis::Render() {
	
	if(ulCurrentTime >= ulDuration) {
		return 0.f;
	}
	
	GRenderer->SetRenderState(Renderer::DepthWrite, false);
	GRenderer->SetRenderState(Renderer::AlphaBlending, true);
	GRenderer->SetTexture(0, tex_p2);
	
	Anglef stiteangle(0.f, float(ulCurrentTime) * fOneOnDuration * 180.f, 0.f);
	Vec3f stitepos = player.pos + Vec3f(0.f, 80.f, 0.f);
	Color3f stitecolor = Color3f::white;
	Vec3f stitescale = Vec3f::repeat(2.f);
	DrawEERIEObjEx(ssol, &stiteangle, &stitepos, &stitescale, &stitecolor);
	
	stitepos.y = player.pos.y + 20;
	stitecolor = Color3f::white;
	stitescale = Vec3f::repeat(1.8f);
	DrawEERIEObjEx(srune, &stiteangle, &stitepos, &stitescale, &stitecolor);
	
	return 1;
}
コード例 #5
0
ファイル: Spells09.cpp プロジェクト: fourks/ArxLibertatis
//---------------------------------------------------------------------
float CNegateMagic::Render()
{
    int i = 0;

    if (spells[spellinstance].caster == 0)
    {
        eSrc.x = player.pos.x;
        eSrc.y = player.pos.y + 170.f;
        eSrc.z = player.pos.z;
    }
    else
    {
        eSrc.x = inter.iobj[spells[spellinstance].caster]->pos.x;
        eSrc.y = inter.iobj[spells[spellinstance].caster]->pos.y;
        eSrc.z = inter.iobj[spells[spellinstance].caster]->pos.z;
    }

    float x = eSrc.x;
    float y = eSrc.y - 10.f;
    float z = eSrc.z;

    if (ulCurrentTime >= ulDuration)
    {
        return 0.f;
    }

    GRenderer->SetRenderState(Renderer::DepthWrite, false);
    GRenderer->SetRenderState(Renderer::AlphaBlending, true);
    GRenderer->SetTexture(0, tex_sol);

    GRenderer->SetBlendFunc(Renderer::BlendOne, Renderer::BlendOne);
    GRenderer->SetRenderState(Renderer::AlphaBlending, true);

    fSize = ulCurrentTime * fOneOnDuration * 200;

    for (i = 0; i < 360; i++)
    {

        float t = rnd();

        if (t < 0.04f)
        {

            int j = ARX_PARTICLES_GetFree();

            if ((j != -1) && (!arxtime.is_paused()))
            {
                ParticleCount++;
                particle[j].exist = 1;
                particle[j].zdec = 0;

                particle[j].ov.x		=	x + frand2() * 150.f;
                particle[j].ov.y		=	y;
                particle[j].ov.z		=	z + frand2() * 150.f;
                particle[j].move.x		=	0;
                particle[j].move.y		=	- 3.0f * rnd();
                particle[j].move.z		=	0;
                particle[j].siz			=	 0.3f;
                particle[j].tolive		=	Random::get(2000, 4000);
                particle[j].scale.x		=	1.f;
                particle[j].scale.y		=	1.f;
                particle[j].scale.z		=	1.f;
                particle[j].timcreation	=	(long)arxtime;
                particle[j].tc			=	tex_p2;
                particle[j].special		=	FADE_IN_AND_OUT | ROTATING | MODULATE_ROTATION | DISSIPATING | SUBSTRACT;
                particle[j].fparam		=	0.0000001f;
                particle[j].rgb = Color3f::white;
            }
        }
    }


    GRenderer->SetRenderState(Renderer::AlphaBlending, true);

    Anglef stiteangle(0.f, -(float) ulCurrentTime * fOneOnDuration * 120, 0.f);
    Vec3f stitepos(x, y, z);

    Color3f stitecolor(.4f, .4f, .4f);
    Vec3f stitescale(3.f, 3.f, 3.f);
    DrawEERIEObjEx(ssol, &stiteangle, &stitepos, &stitescale, &stitecolor);
    GRenderer->SetBlendFunc(Renderer::BlendOne, Renderer::BlendOne);
    stitecolor = Color3f(.5f, 0.f, .5f);
    stitescale = Vec3f(3.1f, 3.1f, 3.1f);
    DrawEERIEObjEx(ssol, &stiteangle, &stitepos, &stitescale, &stitecolor);

    return 1;
}
コード例 #6
0
ファイル: SpellsLvl07.cpp プロジェクト: bsxf-47/ArxLibertatis
void IceFieldSpell::Update() {
	
	EERIE_LIGHT * el = dynLightCreate(m_light);
	if(el) {
		el->pos = m_pos + Vec3f(0.f, -120.f, 0.f);
		el->intensity = 4.6f;
		el->fallstart = Random::getf(150.f, 180.f);
		el->fallend   = Random::getf(290.f, 320.f);
		el->rgb = Color3f(0.76f, 0.76f, 1.0f) + Color3f(0.f, 0.f, Random::getf(-0.1f, 0.f));
		el->duration = GameDurationMs(600);
		el->extras = 0;
	}

	if(!VisibleSphere(Sphere(m_pos - Vec3f(0.f, 120.f, 0.f), 350.f))) {
		return;
	}
	
	RenderMaterial mat;
	mat.setDepthTest(true);
	mat.setBlendType(RenderMaterial::Additive);
	
	for(int i = 0; i < iMax; i++) {
		
		tSize[i] += Vec3f(0.1f);
		tSize[i] = glm::min(tSize[i], tSizeMax[i]);
		
		Anglef stiteangle(0.f, glm::cos(glm::radians(tPos[i].x)) * 360, 0.f);
		Vec3f stitepos(tPos[i].x, m_pos.y, tPos[i].z);
		Vec3f stitescale(tSize[i].z, tSize[i].y, tSize[i].x);
		Color3f stitecolor = Color3f(0.7f, 0.7f, 0.9f) * tSizeMax[i].y;
		
		if(stitecolor.r > 1) {
			stitecolor.r = 1;
		}
		
		if(stitecolor.g > 1) {
			stitecolor.g = 1;
		}
		
		if(stitecolor.b > 1) {
			stitecolor.b = 1;
		}
		
		EERIE_3DOBJ * obj = (tType[i] == 0) ? smotte : stite;
		
		Draw3DObject(obj, stiteangle, stitepos, stitescale, stitecolor, mat);
	}
	
	for(int i = 0; i < iMax * 0.5f; i++) {
		
		float t = Random::getf();
		if(t < 0.01f) {
			
			PARTICLE_DEF * pd = createParticle();
			if(pd) {
				pd->ov = tPos[i] + arx::randomVec(-5.f, 5.f);
				pd->move = arx::randomVec(-2.f, 2.f);
				pd->siz = 20.f;
				pd->tolive = Random::getu(2000, 6000);
				pd->tc = tex_p2;
				pd->m_flags = FADE_IN_AND_OUT | ROTATING | DISSIPATING;
				pd->m_rotation = 0.0000001f;
				pd->rgb = Color3f(0.7f, 0.7f, 1.f);
			}
			
		} else if(t > 0.095f) {
			
			PARTICLE_DEF * pd = createParticle();
			if(pd) {
				pd->ov = tPos[i] + arx::randomVec(-5.f, 5.f) + Vec3f(0.f, 50.f, 0.f);
				pd->move = Vec3f(0.f, Random::getf(-2.f, 2.f), 0.f);
				pd->siz = 0.5f;
				pd->tolive = Random::getu(2000, 6000);
				pd->tc = tex_p1;
				pd->m_flags = FADE_IN_AND_OUT | ROTATING | DISSIPATING;
				pd->m_rotation = 0.0000001f;
				pd->rgb = Color3f(0.7f, 0.7f, 1.f);
			}
			
		}
		
	}
	
}