ObjVertGroup GetActionPointGroup(const EERIE_3DOBJ * eobj, ActionPoint idx) { if(!eobj) return ObjVertGroup(); for(long i = eobj->grouplist.size() - 1; i >= 0; i--) { const std::vector<size_t> & indices = eobj->grouplist[i].indexes; for(size_t j = 0; j < indices.size(); j++){ if(long(indices[j]) == idx.handleData()) { return ObjVertGroup(i); } } } return ObjVertGroup(); }
void FlyingEyeSpell::Update(float timeDelta) { ARX_UNUSED(timeDelta); const unsigned long tim = (unsigned long)(arxtime); const long framediff3 = tim - m_lastupdate; eyeball.floating = std::sin(m_lastupdate-m_timcreation * 0.001f); eyeball.floating *= 10.f; if(m_lastupdate-m_timcreation <= 3000) { eyeball.exist = m_lastupdate - m_timcreation * (1.0f / 30); eyeball.size = Vec3f(1.f - float(eyeball.exist) * 0.01f); eyeball.angle.setPitch(eyeball.angle.getPitch() + framediff3 * 0.6f); } else { eyeball.exist = 2; } m_lastupdate=tim; Entity * io = entities.player(); EERIE_3DOBJ * eobj = io->obj; long pouet = 2; while(pouet) { ActionPoint id; if(pouet == 2) id = io->obj->fastaccess.primary_attach; else id = GetActionPointIdx(io->obj, "left_attach"); pouet--; if(id != ActionPoint()) { if(!lightHandleIsValid(special[pouet])) { special[pouet] = GetFreeDynLight(); } if(lightHandleIsValid(special[pouet])) { EERIE_LIGHT * el = lightHandleGet(special[pouet]); el->intensity = 1.3f; el->fallend = 180.f; el->fallstart = 50.f; el->rgb = Color3f(0.7f, 0.3f, 1.f); el->pos = actionPointPosition(eobj, id); } for(long kk = 0; kk < 2; kk++) { PARTICLE_DEF * pd = createParticle(); if(!pd) { break; } pd->ov = actionPointPosition(eobj, id) + randomVec(-1.f, 1.f); pd->move = Vec3f(0.1f, 0.f, 0.1f) + Vec3f(-0.2f, -2.2f, -0.2f) * randomVec3f(); pd->siz = 5.f; pd->tolive = Random::get(1500, 3500); pd->scale = Vec3f(0.2f); pd->tc = TC_smoke; pd->special = FADE_IN_AND_OUT | ROTATING | MODULATE_ROTATION | DISSIPATING; pd->sourceionum = PlayerEntityHandle; pd->source = &eobj->vertexlist3[id.handleData()].v; // FIXME passing of pointer to vertex position pd->fparam = 0.0000001f; pd->rgb = Color3f(.7f, .3f, 1.f) + Color3f(-.1f, -.1f, -.1f) * randomColor3f(); } } } }