void CLevitate::DrawStone() { GRenderer->SetBlendFunc(Renderer::BlendInvDstColor, Renderer::BlendOne); GRenderer->SetRenderState(Renderer::AlphaBlending, true); int nb = 256; while (nb--) { if (this->tstone[nb].actif) { float a = (float)this->tstone[nb].currtime / (float)this->tstone[nb].time; if (a > 1.f) { a = 1.f; this->tstone[nb].actif = 0; } int col = Color4f(Color3f::white, 1.f - a).toBGRA(); if (this->stone[this->tstone[nb].numstone]) DrawEERIEObjExEx(this->stone[this->tstone[nb].numstone], &this->tstone[nb].ang, &this->tstone[nb].pos, &this->tstone[nb].scale, col); PARTICLE_DEF * pd = createParticle(); if(pd) { pd->ov = tstone[nb].pos; pd->move = Vec3f(0.f, 3.f * rnd(), 0.f); pd->siz = 3.f + 3.f * rnd(); pd->tolive = 1000; pd->timcreation = -(long(arxtime) + 1000l); // TODO WTF? pd->special = FIRE_TO_SMOKE | FADE_IN_AND_OUT | ROTATING | MODULATE_ROTATION | DISSIPATING; pd->fparam = 0.0000001f; } //update mvt if (!arxtime.is_paused()) { a = (((float)this->currframetime) * 100.f) / (float)this->tstone[nb].time; tstone[nb].pos.y += tstone[nb].yvel * a; tstone[nb].ang += tstone[nb].angvel * a; this->tstone[nb].yvel *= 1.f - (1.f / 100.f); this->tstone[nb].currtime += this->currframetime; } } } GRenderer->SetRenderState(Renderer::AlphaBlending, false); }
/*--------------------------------------------------------------------------*/ void CLevitate::DrawStone(LPDIRECT3DDEVICE7 device) { device->SetRenderState(D3DRENDERSTATE_SRCBLEND, D3DBLEND_INVDESTCOLOR); device->SetRenderState(D3DRENDERSTATE_DESTBLEND, D3DBLEND_ONE); SETALPHABLEND(device, TRUE); int nb = 256; while (nb--) { if (this->tstone[nb].actif) { float a = (float)this->tstone[nb].currtime / (float)this->tstone[nb].time; if (a > 1.f) { a = 1.f; this->tstone[nb].actif = 0; } int col = RGBA_MAKE(255, 255, 255, (int)(255.f * (1.f - a))); if (this->stone[this->tstone[nb].numstone]) DrawEERIEObjExEx(device, this->stone[this->tstone[nb].numstone], &this->tstone[nb].ang, &this->tstone[nb].pos, &this->tstone[nb].scale, col); int j = ARX_PARTICLES_GetFree(); if ((j != -1) && (!ARXPausedTimer)) { ParticleCount++; particle[j].exist = 1; particle[j].zdec = 0; particle[j].ov = this->tstone[nb].pos; particle[j].move.x = 0.f; particle[j].move.y = 3.f * rnd(); particle[j].move.z = 0.f; particle[j].siz = 3.f + 3.f * rnd(); particle[j].tolive = 1000; particle[j].scale.x = 1.f; particle[j].scale.y = 1.f; particle[j].scale.z = 1.f; particle[j].timcreation = -(long)(ARXTime + 1000); particle[j].tc = NULL; particle[j].special = FIRE_TO_SMOKE | FADE_IN_AND_OUT | ROTATING | MODULATE_ROTATION | DISSIPATING; particle[j].fparam = 0.0000001f; particle[j].r = 1.f; particle[j].g = 1.f; particle[j].b = 1.f; } //update mvt if (!ARXPausedTimer) { a = (((float)this->currframetime) * 100.f) / (float)this->tstone[nb].time; this->tstone[nb].pos.y += this->tstone[nb].yvel * a; this->tstone[nb].ang.a += this->tstone[nb].angvel.a * a; this->tstone[nb].ang.b += this->tstone[nb].angvel.b * a; this->tstone[nb].ang.g += this->tstone[nb].angvel.g * a; this->tstone[nb].yvel *= 1.f - (1.f / 100.f); this->tstone[nb].currtime += this->currframetime; } } } SETALPHABLEND(device, FALSE); }