void MagicSightSpell::Update() { if(m_caster == EntityHandle_Player) { Vec3f pos = ARX_PLAYER_FrontPos(); ARX_SOUND_RefreshPosition(m_snd_loop, pos); } }
void MassIncinerateSpell::Update(float timeDelta) { ARX_UNUSED(timeDelta); if(ValidIONum(m_caster)) { ARX_SOUND_RefreshPosition(m_snd_loop, entities[m_caster]->pos); } }
void IncinerateSpell::Update() { Entity * target = entities.get(m_target); if(target) { ARX_SOUND_RefreshPosition(m_snd_loop, target->pos); } }
void CMagicMissile::Update(unsigned long aulTime) { ARX_SOUND_RefreshPosition(snd_loop, &eCurPos); ulCurrentTime += aulTime; if(ulCurrentTime >= ulDuration) lightIntensityFactor = 0.f; else lightIntensityFactor = 1 - 0.5f * rnd(); }
void ColdProtectionSpell::Update() { if(ValidIONum(m_target)) { Entity *io = entities[m_target]; io->halo.flags = HALO_ACTIVE; io->halo.color = Color3f(0.2f, 0.2f, 0.45f); io->halo.radius = 45.f; } ARX_SOUND_RefreshPosition(m_snd_loop, entities[m_target]->pos); }
void ColdProtectionSpell::Update() { Entity * io = entities.get(m_target); if(io) { io->halo.flags = HALO_ACTIVE; io->halo.color = Color3f(0.2f, 0.2f, 0.45f); io->halo.radius = 45.f; ARX_SOUND_RefreshPosition(m_snd_loop, io->pos); } }
void CMagicMissile::Update(float timeDelta) { ARX_SOUND_RefreshPosition(snd_loop, eCurPos); ulCurrentTime += timeDelta; if(ulCurrentTime >= ulDuration) lightIntensityFactor = 0.f; else lightIntensityFactor = Random::getf(0.5f, 1.0f); }
void FireProtectionSpell::Update(float timeDelta) { ARX_UNUSED(timeDelta); if(ValidIONum(m_target)) { Entity *io = entities[m_target]; io->halo.flags = HALO_ACTIVE; io->halo.color = Color3f(0.5f, 0.3f, 0.f); io->halo.radius = 45.f; } ARX_SOUND_RefreshPosition(m_snd_loop, entities[m_target]->pos); }
void MagicSightSpell::Update(float timeDelta) { ARX_UNUSED(timeDelta); if(m_caster == PlayerEntityHandle) { Vec3f pos; ARX_PLAYER_FrontPos(&pos); ARX_SOUND_RefreshPosition(m_snd_loop, pos); if(subj.focal > IMPROVED_FOCAL) subj.focal -= DEC_FOCAL; } }
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); } }
void LightningStrikeSpell::Update() { float fBeta = 0.f; float falpha = 0.f; Entity * caster = entities[m_caster]; ObjVertHandle idx = GetGroupOriginByName(caster->obj, "chest"); if(idx != ObjVertHandle()) { m_caster_pos = caster->obj->vertexWorldPositions[idx.handleData()].v; } else { m_caster_pos = caster->pos; } if(m_caster == EntityHandle_Player) { falpha = -player.angle.getPitch(); fBeta = player.angle.getYaw(); } else { fBeta = caster->angle.getYaw(); if(ValidIONum(caster->targetinfo) && caster->targetinfo != m_caster) { const Vec3f & p1 = m_caster_pos; Vec3f p2 = GetChestPos(caster->targetinfo); falpha = MAKEANGLE(glm::degrees(getAngle(p1.y, p1.z, p2.y, p2.z + glm::distance(Vec2f(p2.x, p2.z), Vec2f(p1.x, p1.z))))); } else if(ValidIONum(m_target)) { const Vec3f & p1 = m_caster_pos; Vec3f p2 = GetChestPos(m_target); falpha = MAKEANGLE(glm::degrees(getAngle(p1.y, p1.z, p2.y, p2.z + glm::distance(Vec2f(p2.x, p2.z), Vec2f(p1.x, p1.z))))); } } m_lightning.m_pos = m_caster_pos; m_lightning.m_beta = fBeta; m_lightning.m_alpha = falpha; m_lightning.m_caster = m_caster; m_lightning.m_level = m_level; m_lightning.Update(g_gameTime.lastFrameDuration()); m_lightning.Render(); ARX_SOUND_RefreshPosition(m_snd_loop, entities[m_caster]->pos); }
void LevitateSpell::Update(float timeDelta) { ulCurrentTime += timeDelta; Vec3f target; if(m_target == PlayerEntityHandle) { target = player.pos + Vec3f(0.f, 150.f, 0.f); player.levitate = true; } else { target = entities[m_caster]->pos; } m_pos = target; float coneScale = 0.f; int dustParticles = 0; if(ulCurrentTime < 1000) { coneScale = (float) ulCurrentTime / 1000.f; dustParticles = 3; } else { coneScale = 1.f; dustParticles = 10; } cone1.Update(timeDelta, m_pos, coneScale); cone2.Update(timeDelta, m_pos, coneScale); m_stones.Update(timeDelta, m_pos); for(int i = 0; i < dustParticles; i++) { createDustParticle(); } cone1.Render(); cone2.Render(); m_stones.DrawStone(); ARX_SOUND_RefreshPosition(m_snd_loop, entities[m_target]->pos); }
void LightningStrikeSpell::Update(float timeDelta) { float fBeta = 0.f; float falpha = 0.f; Entity * caster = entities[m_caster]; long idx = GetGroupOriginByName(caster->obj, "chest"); if(idx >= 0) { m_caster_pos = caster->obj->vertexlist3[idx].v; } else { m_caster_pos = caster->pos; } if(m_caster == PlayerEntityHandle) { falpha = -player.angle.getYaw(); fBeta = player.angle.getPitch(); } else { fBeta = caster->angle.getPitch(); if(ValidIONum(caster->targetinfo) && caster->targetinfo != m_caster) { const Vec3f & p1 = m_caster_pos; Vec3f p2 = GetChestPos(caster->targetinfo); falpha = MAKEANGLE(glm::degrees(getAngle(p1.y, p1.z, p2.y, p2.z + glm::distance(Vec2f(p2.x, p2.z), Vec2f(p1.x, p1.z))))); //alpha entre orgn et dest; } else if(ValidIONum(m_target)) { const Vec3f & p1 = m_caster_pos; Vec3f p2 = GetChestPos(m_target); falpha = MAKEANGLE(glm::degrees(getAngle(p1.y, p1.z, p2.y, p2.z + glm::distance(Vec2f(p2.x, p2.z), Vec2f(p1.x, p1.z))))); //alpha entre orgn et dest; } } m_lightning.m_pos = m_caster_pos; m_lightning.m_beta = fBeta; m_lightning.m_alpha = falpha; m_lightning.m_caster = m_caster; m_lightning.m_level = m_level; m_lightning.Update(timeDelta); m_lightning.Render(); ARX_SOUND_RefreshPosition(m_snd_loop, entities[m_caster]->pos); }
void LevitateSpell::Update(float timeDelta) { CLevitate *pLevitate=(CLevitate *)m_pSpellFx; Vec3f target; if(m_target == PlayerEntityHandle) { target = player.pos + Vec3f(0.f, 150.f, 0.f); player.levitate = true; } else { target = entities[m_caster]->pos; } pLevitate->ChangePos(&target); CSpellFx *pCSpellFX = m_pSpellFx; if(pCSpellFX) { pCSpellFX->Update(timeDelta); pCSpellFX->Render(); } ARX_SOUND_RefreshPosition(m_snd_loop, entities[m_target]->pos); }
void LevitateSpell::Update() { Vec3f target; if(m_target == EntityHandle_Player) { target = player.pos + Vec3f(0.f, 150.f, 0.f); player.levitate = true; } else { target = entities[m_caster]->pos; } m_pos = target; float coneScale = 0.f; int dustParticles = 0; if(m_elapsed < GameDurationMs(1000)) { coneScale = m_elapsed / GameDurationMs(1000); dustParticles = 3; } else { coneScale = 1.f; dustParticles = 10; } cone1.Update(g_gameTime.lastFrameDuration(), m_pos, coneScale); cone2.Update(g_gameTime.lastFrameDuration(), m_pos, coneScale); m_stones.Update(g_gameTime.lastFrameDuration(), m_pos); for(int i = 0; i < dustParticles; i++) { createDustParticle(); } cone1.Render(); cone2.Render(); m_stones.DrawStone(); ARX_SOUND_RefreshPosition(m_snd_loop, entities[m_target]->pos); }
void RepelUndeadSpell::Update(float timeDelta) { CRepelUndead * effect = static_cast<CRepelUndead *>(m_pSpellFx); if(effect) { Vec3f pos = entities[m_target]->pos; float rot; if(m_target == PlayerEntityHandle) { rot = player.angle.getPitch(); } else { rot = entities[m_target]->angle.getPitch(); } effect->SetPos(pos); effect->SetRotation(rot); effect->Update(timeDelta); effect->Render(); if (m_target == PlayerEntityHandle) ARX_SOUND_RefreshPosition(m_snd_loop, entities[m_target]->pos); } }
// 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; } } } } }
void RepelUndeadSpell::Update(float timeDelta) { ARX_UNUSED(timeDelta); Vec3f pos = entities[m_target]->pos; float rot; if(m_target == PlayerEntityHandle) { rot = player.angle.getPitch(); } else { rot = entities[m_target]->angle.getPitch(); } m_pos = pos; m_yaw = rot; 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, m_pos + 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 = m_pos + 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(m_light)) { m_light = GetFreeDynLight(); } if(lightHandleIsValid(m_light)) { EERIE_LIGHT * light = lightHandleGet(m_light); light->intensity = 2.3f; light->fallend = 350.f; light->fallstart = 150.f; light->rgb = Color3f(0.8f, 0.8f, 1.f); light->pos = m_pos + Vec3f(0.f, -50.f, 0.f); light->duration = 200; light->time_creation = (unsigned long)(arxtime); } if (m_target == PlayerEntityHandle) ARX_SOUND_RefreshPosition(m_snd_loop, entities[m_target]->pos); }
//----------------------------------------------------------------------------- void CMagicMissile::Update(unsigned long aulTime) { ARX_SOUND_RefreshPosition(snd_loop, &eCurPos); ulCurrentTime += aulTime; }
void IncinerateSpell::Update() { if(ValidIONum(m_target)) { ARX_SOUND_RefreshPosition(m_snd_loop, entities[m_target]->pos); } }
void RepelUndeadSpell::Update() { Vec3f pos = entities[m_target]->pos; float rot; if(m_target == EntityHandle_Player) { rot = player.angle.getYaw(); } else { rot = entities[m_target]->angle.getYaw(); } m_pos = pos; m_yaw = rot; RenderMaterial mat; mat.setDepthTest(true); mat.setBlendType(RenderMaterial::Additive); Anglef eObjAngle; eObjAngle.setYaw(m_yaw); eObjAngle.setPitch(0); eObjAngle.setRoll(0); float wave = timeWaveSin(g_gameTime.now(), GameDurationMsf(6283.185307f)); float vv = (1.f + wave) * 0.5f + 1.1f; Draw3DObject(ssol, eObjAngle, m_pos + 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; } // XXX was this supposed to be sphericalRand ? Vec2f d = arx::diskRand(vv); pd->ov = m_pos + Vec3f(d.x, 0.f, d.y); pd->move = arx::linearRand(Vec3f(-0.8f, -4.f, -0.8f), Vec3f(0.8f, 0.f, 0.8f)); pd->scale = Vec3f(-0.1f); pd->tolive = Random::getu(2600, 3200); pd->tc = tex_p2; pd->siz = 0.3f; pd->rgb = Color3f(.4f, .4f, .6f); } EERIE_LIGHT * light = dynLightCreate(m_light); if(light) { light->intensity = 2.3f; light->fallend = 350.f; light->fallstart = 150.f; light->rgb = Color3f(0.8f, 0.8f, 1.f); light->pos = m_pos + Vec3f(0.f, -50.f, 0.f); light->duration = GameDurationMs(200); light->creationTime = g_gameTime.now(); } if (m_target == EntityHandle_Player) ARX_SOUND_RefreshPosition(m_snd_loop, entities[m_target]->pos); }