void ConfuseSpell::Update() { Vec3f pos = entities[m_target]->pos; if(m_target != EntityHandle_Player) { pos.y += entities[m_target]->physics.cyl.height - 30.f; } ObjVertHandle idx = entities[m_target]->obj->fastaccess.head_group_origin; if(idx != ObjVertHandle()) { pos = entities[m_target]->obj->vertexlist3[idx.handleData()].v; pos.y -= 50.f; } eCurPos = pos; RenderMaterial mat; mat.setDepthTest(false); mat.setBlendType(RenderMaterial::Additive); mat.setTexture(tex_trail); Anglef stiteangle = Anglef(0.f, -glm::degrees(arxtime.now_f() * ( 1.0f / 500 )), 0.f); { AnimationDuration delta = AnimationDurationUs(s64(g_framedelay * 1000.f)); EERIEDrawAnimQuatUpdate(spapi, animlayer, stiteangle, eCurPos, delta, NULL, false); EERIEDrawAnimQuatRender(spapi, eCurPos, NULL, 0.f); } for(int i = 0; i < 6; i++) { PARTICLE_DEF * pd = createParticle(); if(!pd) { break; } Vec2f p = glm::diskRand(15.f); pd->ov = eCurPos + Vec3f(p.x, 0.f, p.y); pd->move = Vec3f(0.f, Random::getf(1.f, 4.f), 0.f); pd->siz = 0.25f; pd->tolive = Random::getu(2300, 3300); pd->tc = tex_p1; pd->m_flags = PARTICLE_GOLDRAIN | FADE_IN_AND_OUT | ROTATING | DISSIPATING; pd->m_rotation = 0.0000001f; Color3f baseColor = Color3f(0.4f, 0.2f, 0.4f); Color3f randomFactor = Color3f(0.4f, 0.6f, 0.4f); Color3f c = baseColor + randomColor3f() * randomFactor; while(glm::abs(c.r - c.g) > 0.3f && glm::abs(c.g - c.b) > 0.3f) { c = baseColor + randomColor3f() * randomFactor; } pd->rgb = c * Color3f(0.8f, 0.8f, 0.8f); } EERIE_LIGHT * light = dynLightCreate(m_light); if(light) { light->intensity = 1.3f; light->fallstart = 180.f; light->fallend = 420.f; light->rgb = Color3f(0.3f, 0.3f, 0.5f) + Color3f(0.2f, 0.f, 0.2f) * randomColor3f(); light->pos = eCurPos; light->duration = ArxDurationMs(200); light->extras = 0; } }
void ConfuseSpell::Update() { Vec3f pos = entities[m_target]->pos; if(m_target != PlayerEntityHandle) { pos.y += entities[m_target]->physics.cyl.height - 30.f; } long idx = entities[m_target]->obj->fastaccess.head_group_origin; if(idx >= 0) { pos = entities[m_target]->obj->vertexlist3[idx].v; pos.y -= 50.f; } eCurPos = pos; RenderMaterial mat; mat.setDepthTest(false); mat.setBlendType(RenderMaterial::Additive); mat.setTexture(tex_trail); arxtime.update(); Anglef stiteangle = Anglef(0.f, -glm::degrees(arxtime.now_f() * ( 1.0f / 500 )), 0.f); { EERIEDrawAnimQuatUpdate(spapi, animlayer, stiteangle, eCurPos, g_framedelay, NULL, false); EERIEDrawAnimQuatRender(spapi, eCurPos, NULL, 0.f); } for(int i = 0; i < 6; i++) { PARTICLE_DEF * pd = createParticle(); if(!pd) { break; } Vec2f p = glm::diskRand(15.f); pd->ov = eCurPos + Vec3f(p.x, 0.f, p.y); pd->move = Vec3f(0.f, Random::getf(1.f, 4.f), 0.f); pd->siz = 0.25f; pd->tolive = Random::getu(2300, 3300); pd->tc = tex_p1; pd->special = PARTICLE_GOLDRAIN | FADE_IN_AND_OUT | ROTATING | MODULATE_ROTATION | DISSIPATING; pd->fparam = 0.0000001f; Color3f baseColor = Color3f(0.4f, 0.2f, 0.4f); Color3f randomFactor = Color3f(0.4f, 0.6f, 0.4f); Color3f c = baseColor + randomColor3f() * randomFactor; while(glm::abs(c.r - c.g) > 0.3f && glm::abs(c.g - c.b) > 0.3f) { c = baseColor + randomColor3f() * randomFactor; } pd->rgb = c * Color3f(0.8f, 0.8f, 0.8f); } if(!lightHandleIsValid(m_light)) m_light = GetFreeDynLight(); if(lightHandleIsValid(m_light)) { EERIE_LIGHT * light = lightHandleGet(m_light); light->intensity = 1.3f; light->fallstart = 180.f; light->fallend = 420.f; light->rgb = Color3f(0.3f, 0.3f, 0.5f) + Color3f(0.2f, 0.f, 0.2f) * randomColor3f(); light->pos = eCurPos; light->duration = 200; light->extras = 0; } }