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); } }
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); } }
void NegateMagicSpell::Launch() { if(m_caster == PlayerEntityHandle) { m_target = PlayerEntityHandle; } ARX_SOUND_PlaySFX(SND_SPELL_NEGATE_MAGIC, &entities[m_target]->pos); m_hasDuration = true; m_fManaCostPerSecond = 2.f; m_duration = (m_launchDuration > -1) ? m_launchDuration : 1000000; m_pos = getTargetPos(m_caster, m_target); tex_p2 = TextureContainer::Load("graph/obj3d/textures/(fx)_tsu_bluepouf"); tex_sol = TextureContainer::Load("graph/obj3d/textures/(fx)_negate_magic"); LaunchAntiMagicField(); }