//--------------------------------------------------------------------- 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; }
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); } } } }