float CCurse::Render() { GRenderer->SetCulling(Renderer::CullCW); GRenderer->SetRenderState(Renderer::DepthWrite, true); GRenderer->SetRenderState(Renderer::AlphaBlending, false); if(svoodoo) { Anglef stiteangle = Anglef(fRot, 0, 0); Vec3f stitepos = eTarget; Vec3f stitescale = Vec3f::ONE; Color3f stitecolor = Color3f::white; DrawEERIEObjEx(svoodoo , &stiteangle, &stitepos, &stitescale, &stitecolor); } for(int i = 0; i < 4; i++) { PARTICLE_DEF * pd = createParticle(); if(!pd) { break; } pd->ov = eTarget; pd->move = Vec3f(2.f * frand2(), rnd() * -10.f - 10.f, 2.f * frand2()); pd->siz = 0.015f; pd->tolive = Random::get(1000, 1600); pd->tc = tex_p1; pd->special = ROTATING | MODULATE_ROTATION | DISSIPATING | SUBSTRACT | GRAVITY; pd->fparam = 0.0000001f; } return 1; }
float CTelekinesis::Render() { if(ulCurrentTime >= ulDuration) { return 0.f; } GRenderer->SetRenderState(Renderer::DepthWrite, false); GRenderer->SetRenderState(Renderer::AlphaBlending, true); GRenderer->SetTexture(0, tex_p2); Anglef stiteangle(0.f, float(ulCurrentTime) * fOneOnDuration * 180.f, 0.f); Vec3f stitepos = player.pos + Vec3f(0.f, 80.f, 0.f); Color3f stitecolor = Color3f::white; Vec3f stitescale = Vec3f::repeat(2.f); DrawEERIEObjEx(ssol, &stiteangle, &stitepos, &stitescale, &stitecolor); stitepos.y = player.pos.y + 20; stitecolor = Color3f::white; stitescale = Vec3f::repeat(1.8f); DrawEERIEObjEx(srune, &stiteangle, &stitepos, &stitescale, &stitecolor); return 1; }
//************************************************************************************* //************************************************************************************* void ARXDRAW_DrawEyeBall(LPDIRECT3DDEVICE7 pd3dDevice) { EERIE_3D angle; EERIE_3D pos; EERIE_3D scale; EERIE_RGB rgb; float d; if (eyeball.exist<0) { d=(float)(-eyeball.exist)*DIV100; eyeball.exist++; } else if (eyeball.exist>2) { d=(float)(eyeball.exist)*DIV100; } else return; angle.a = eyeball.angle.a; angle.b=MAKEANGLE(180.f-eyeball.angle.b); angle.g=eyeball.angle.g; pos.x=eyeball.pos.x; pos.y=eyeball.pos.y+eyeball.floating; pos.z=eyeball.pos.z; scale.x=d; scale.y=d; scale.z=d; rgb.r=d; rgb.g=d; rgb.b=d; SETBLENDMODE(pd3dDevice,D3DBLEND_ONE,D3DBLEND_ONE); SETALPHABLEND(pd3dDevice,TRUE); DrawEERIEObjEx(pd3dDevice,eyeballobj,&angle,&pos,&scale,&rgb); }
void ARXDRAW_DrawEyeBall() { float d; if(eyeball.exist < 0) { d = (float)(-eyeball.exist)*( 1.0f / 100 ); eyeball.exist++; } else if(eyeball.exist > 2) { d = (float)(eyeball.exist)*( 1.0f / 100 ); } else return; Anglef angle = eyeball.angle; angle.b = MAKEANGLE(180.f - angle.b); Vec3f pos = eyeball.pos; pos.y += eyeball.floating; Vec3f scale = Vec3f::repeat(d); Color3f rgb = Color3f::gray(d); GRenderer->SetBlendFunc(Renderer::BlendOne, Renderer::BlendOne); GRenderer->SetRenderState(Renderer::AlphaBlending, true); DrawEERIEObjEx(eyeballobj, &angle, &pos, &scale, rgb); }
//--------------------------------------------------------------------- float CCurse::Render(LPDIRECT3DDEVICE7 m_pd3dDevice, EERIE_3D * pos) { int i = 0; float x = eSrc.x; float y = eSrc.y;// + 200.0f; float z = eSrc.z; if (ulCurrentTime >= ulDuration) { /* if (bDone) { EERIE_3D target,source; target.x=player.pos.x;// - EEsin(DEG2RAD(MAKEANGLE(player.angle.b)))*1000.f; target.y=player.pos.y;//+30.f; target.z=player.pos.z;// + EEcos(DEG2RAD(MAKEANGLE(player.angle.b)))*1000.f; source.x = x; source.y = y; source.z = z; if (pIncinerate) { pIncinerate->Create(source, MAKEANGLE(player.angle.b)); pIncinerate->SetDuration(2000); } //DebugSphere(source.x,source.y,source.z,20,8000,0xFFFF0000); //DebugSphere(target.x,target.y,target.z,20,8000,0xFFFF0000); bDone = false; } else { return 0.f; } */ } SETCULL(m_pd3dDevice, D3DCULL_CW); SETZWRITE(m_pd3dDevice, true); x = pos->x; y = pos->y; z = pos->z; //---------------------------- EERIE_3D stiteangle; EERIE_3D stitepos; EERIE_3D stitescale; EERIE_RGB stitecolor; SETALPHABLEND(m_pd3dDevice, false); stiteangle.b = fRot; stiteangle.a = 0; stiteangle.g = 0; stitepos.x = x; stitepos.y = y; stitepos.z = z; stitecolor.r = 1; stitecolor.g = 1; stitecolor.b = 1; stitescale.x = 1; stitescale.y = 1; stitescale.z = 1; if (svoodoo) DrawEERIEObjEx(m_pd3dDevice, svoodoo , &stiteangle, &stitepos, &stitescale, &stitecolor); for (i = 0; i < 4; i++) { int j = ARX_PARTICLES_GetFree(); if ((j != -1) && (!ARXPausedTimer)) { ParticleCount++; PARTICLE_DEF * pd = &particle[j]; pd->exist = 1; pd->zdec = 0; pd->ov.x = x; pd->ov.y = y; pd->ov.z = z; pd->move.x = 2.f * frand2(); pd->move.y = rnd() * -10.f - 10.f; pd->move.z = 2.f * frand2(); pd->siz = 0.015f; pd->tolive = 1000 + (unsigned long)(float)(rnd() * 600.f); pd->scale.x = 1.f; pd->scale.y = 1.f; pd->scale.z = 1.f; pd->timcreation = lARXTime; pd->tc = tex_p1; pd->special = ROTATING | MODULATE_ROTATION | DISSIPATING | SUBSTRACT | GRAVITY; pd->fparam = 0.0000001f; pd->r = 1.f; pd->g = 1.f; pd->b = 1.f; } } return 1; }
//--------------------------------------------------------------------- float CTelekinesis::Render(LPDIRECT3DDEVICE7 m_pd3dDevice) { int i = 0; float x = eSrc.x; float y = eSrc.y + 100.0f; float z = eSrc.z; if (ulCurrentTime >= ulDuration) { return 0.f; /* if (bDone) { EERIE_3D target,source; target.x=player.pos.x;// - EEsin(DEG2RAD(MAKEANGLE(player.angle.b)))*1000.f; target.y=player.pos.y;//+30.f; target.z=player.pos.z;// + EEcos(DEG2RAD(MAKEANGLE(player.angle.b)))*1000.f; source.x = x; source.y = y; source.z = z; if (pIncinerate) { pIncinerate->Create(source, MAKEANGLE(player.angle.b)); pIncinerate->SetDuration(2000); } //DebugSphere(source.x,source.y,source.z,20,8000,0xFFFF0000); //DebugSphere(target.x,target.y,target.z,20,8000,0xFFFF0000); bDone = false; } else { return 0.f; } */ } //DumpMap(); //SETTC(m_pd3dDevice,NULL); //SETCULL(m_pd3dDevice,D3DCULL_NONE); SETZWRITE(m_pd3dDevice, false); //SETALPHABLEND(m_pd3dDevice, false); SETALPHABLEND(m_pd3dDevice, true); // register INTERACTIVE_OBJ * io; for (i = 0; i < inter.nbmax; i++) { if (inter.iobj[i] != NULL) { x = inter.iobj[i]->pos.x; y = inter.iobj[i]->pos.y; z = inter.iobj[i]->pos.z; } } //---------------- // if (tex_p2 && tex_p2->m_pddsSurface) { // SETTC(m_pd3dDevice, tex_p2->m_pddsSurface); } //for (long n=0; n<12; n++) /* if (bGo) for (i=0; i<360; i++) { x = eSrc.x; y = eSrc.y; z = eSrc.z; float t = rnd(); if (t<0.01f) { t = rnd(); //if (t>0.5f) //y -= 240; int j=ARX_PARTICLES_GetFree(); if ((j!=-1) && (!ARXPausedTimer)) { ParticleCount++; particle[j].exist=1; particle[j].zdec=0; //float randd=DEG2RAD((float)j*10.f); particle[j].ov.x = x + 5.f - rnd()*10.f; particle[j].ov.y = y + 5.f - rnd()*10.f; particle[j].ov.z = z + 5.f - rnd()*10.f; particle[j].move.x = 2.f - 4.f*rnd(); particle[j].move.y = 2.f - 4.f*rnd(); particle[j].move.z = 2.f - 4.f*rnd(); particle[j].siz = 20.f; particle[j].tolive=2000+(unsigned long)(float)(rnd()*4000.f); particle[j].scale.x=1.f; particle[j].scale.y=1.f; particle[j].scale.z=1.f; particle[j].timcreation=ARXTime;//spells[i].lastupdate; particle[j].tc = tex_p2; particle[j].special = FADE_IN_AND_OUT | ROTATING | MODULATE_ROTATION | DISSIPATING; particle[j].fparam=0.0000001f; particle[j].r=0.7f; particle[j].g=0.3f; particle[j].b=0.f; } } } */ y -= 40; y = eSrc.y + 140; //---------------------------- if (tex_p2 && tex_p2->m_pddsSurface) { SETTC(m_pd3dDevice, tex_p2); } //SETTC(m_pd3dDevice, NULL); //---------------------------- y -= 40; /* DrawBillBoardPoly(m_pd3dDevice, x+frand2()*10, y+frand2()*10, z+frand2()*10, 40, tex_p2, D3DRGB(1,1,1)); DrawBillBoardPoly(m_pd3dDevice, x+frand2()*10, y+frand2()*10, z+frand2()*10, 40, tex_p2, D3DRGB(1,1,1)); DrawBillBoardPoly(m_pd3dDevice, x+frand2()*10, y+frand2()*10, z+frand2()*10, 40, tex_p2, D3DRGB(1,1,1)); DrawBillBoardPoly(m_pd3dDevice, x+frand2()*10, y+frand2()*10, z+frand2()*10, 40, tex_p2, D3DRGB(1,1,1)); DrawBillBoardPoly(m_pd3dDevice, x+frand2()*10, y+frand2()*10, z+frand2()*10, 40, tex_p2, D3DRGB(1,1,1)); DrawBillBoardPoly(m_pd3dDevice, x+frand2()*20, y+frand2()*20, z+frand2()*20, 60, tex_p2, D3DRGB(1,1,1)); DrawBillBoardPoly(m_pd3dDevice, x+frand2()*20, y+frand2()*20, z+frand2()*20, 60, tex_p2, D3DRGB(1,1,1)); */ EERIE_3D stiteangle; EERIE_3D stitepos; EERIE_3D stitescale; EERIE_RGB stitecolor; x = player.pos.x; y = player.pos.y + 80; z = player.pos.z; stiteangle.b = (float) ulCurrentTime * fOneOnDuration * 120; //+=(float)FrameDiff*0.1f; stiteangle.a = 0;//abs(cos (DEG2RAD(tPos[i].x)))*10; stiteangle.g = 0;//cos (DEG2RAD(tPos[i].x))*360; stitepos.x = x;//tPos[i].x;//player.pos.x;//-(float)EEsin(DEG2RAD(player.angle.b))*(100.f) ; stitepos.y = y;//player.pos.y+60.f-mov; stitepos.z = z;//tPos[i].z;//player.pos.z;//+(float)EEcos(DEG2RAD(player.angle.b))*(100.f) ; SETALPHABLEND(m_pd3dDevice, true); stiteangle.b = -stiteangle.b * 1.5f; stitecolor.r = 0.7f; stitecolor.g = 0.7f; stitecolor.b = 0.7f; stitescale.x = 1; stitescale.y = -0.1f; stitescale.z = 1; // DrawEERIEObjEx(m_pd3dDevice,slight,&stiteangle,&stitepos,&stitescale,&stitecolor); stiteangle.b = -stiteangle.b; stitecolor.r = 1; stitecolor.g = 1; stitecolor.b = 1; stitescale.x = 2; stitescale.y = 2; stitescale.z = 2; SETALPHABLEND(m_pd3dDevice, true); DrawEERIEObjEx(m_pd3dDevice, ssol, &stiteangle, &stitepos, &stitescale, &stitecolor); y = player.pos.y + 20; stitepos.y = y;//player.pos.y+60.f-mov; stitecolor.r = 1; stitecolor.g = 1; stitecolor.b = 1; stitescale.z = 1.8f; stitescale.y = 1.8f; stitescale.x = 1.8f; DrawEERIEObjEx(m_pd3dDevice, srune, &stiteangle, &stitepos, &stitescale, &stitecolor); return 1; }
//--------------------------------------------------------------------- float CDispellField::Render(LPDIRECT3DDEVICE7 m_pd3dDevice) { int i = 0; float x = eSrc.x; float y = eSrc.y + 100.0f; float z = eSrc.z; if (ulCurrentTime >= ulDuration) { return 0.f; } SETZWRITE(m_pd3dDevice, false); SETALPHABLEND(m_pd3dDevice, true); for (i = 0; i < inter.nbmax; i++) { if (inter.iobj[i] != NULL) { x = inter.iobj[i]->pos.x; y = inter.iobj[i]->pos.y; z = inter.iobj[i]->pos.z; } } y -= 40; y = eSrc.y + 140; if (tex_p2 && tex_p2->m_pddsSurface) { SETTC(m_pd3dDevice, tex_p2); } //---------------------------- y -= 40; EERIE_3D stiteangle; EERIE_3D stitepos; EERIE_3D stitescale; EERIE_RGB stitecolor; x = player.pos.x; y = player.pos.y + 80; z = player.pos.z; stiteangle.b = (float) ulCurrentTime * fOneOnDuration * 120; stiteangle.a = 0; stiteangle.g = 0; stitepos.x = x; stitepos.y = y; stitepos.z = z; SETALPHABLEND(m_pd3dDevice, true); stiteangle.b = -stiteangle.b * 1.5f; stitecolor.r = 0.7f; stitecolor.g = 0.7f; stitecolor.b = 0.7f; stitescale.x = 1; stitescale.y = -0.1f; stitescale.z = 1; stiteangle.b = -stiteangle.b; stitecolor.r = 1; stitecolor.g = 1; stitecolor.b = 1; stitescale.x = 2; stitescale.y = 2; stitescale.z = 2; SETALPHABLEND(m_pd3dDevice, true); DrawEERIEObjEx(m_pd3dDevice, ssol, &stiteangle, &stitepos, &stitescale, &stitecolor); y = player.pos.y + 20; stitepos.y = y; stitecolor.r = 1; stitecolor.g = 1; stitecolor.b = 1; stitescale.z = 1.8f; stitescale.y = 1.8f; stitescale.x = 1.8f; DrawEERIEObjEx(m_pd3dDevice, srune, &stiteangle, &stitepos, &stitescale, &stitecolor); return 1; }
//--------------------------------------------------------------------- float CRuneOfGuarding::Render(LPDIRECT3DDEVICE7 m_pd3dDevice) { float x = eSrc.x; float y = eSrc.y - 20; float z = eSrc.z; SETZWRITE(m_pd3dDevice, FALSE); m_pd3dDevice->SetRenderState(D3DRENDERSTATE_SRCBLEND, D3DBLEND_ONE); m_pd3dDevice->SetRenderState(D3DRENDERSTATE_DESTBLEND, D3DBLEND_ONE); SETALPHABLEND(m_pd3dDevice, TRUE); //---------------------------- // long color = D3DRGB(1,1,1); // int size = 100; //---------------------------- EERIE_3D stiteangle; EERIE_3D stitepos; EERIE_3D stitescale; EERIE_RGB stitecolor; float stiteangleb = (float) ulCurrentTime * fOneOnDuration * 120; stiteangle.a = 0; stiteangle.g = 0; stitepos.x = x; stitepos.y = y; stitepos.z = z; float gtc = (float)ARX_TIME_Get(); float v = EEsin(gtc * DIV1000) * DIV10; stiteangle.b = MAKEANGLE(gtc * DIV1000); stitecolor.r = 0.4f - v; stitecolor.g = 0.4f - v; stitecolor.b = 0.6f - v; stitescale.x = 1; stitescale.y = -0.1f; stitescale.z = 1; if (slight) DrawEERIEObjEx(m_pd3dDevice, slight, &stiteangle, &stitepos, &stitescale, &stitecolor); stiteangle.b = stiteangleb; stitecolor.r = 0.6f; stitecolor.g = 0.f; stitecolor.b = 0.f; stitescale.x = 2; stitescale.y = 2; stitescale.z = 2; if (ssol) DrawEERIEObjEx(m_pd3dDevice, ssol, &stiteangle, &stitepos, &stitescale, &stitecolor); stitecolor.r = 0.6f; stitecolor.g = 0.3f; stitecolor.b = 0.45f; stitescale.z = 1.8f; stitescale.y = 1.8f; stitescale.x = 1.8f; if (srune) DrawEERIEObjEx(m_pd3dDevice, srune, &stiteangle, &stitepos, &stitescale, &stitecolor); for (int n = 0; n < 4; n++) { int j = ARX_PARTICLES_GetFree(); if ((j != -1) && (!ARXPausedTimer)) { ParticleCount++; particle[j].exist = 1; particle[j].zdec = 0; particle[j].ov.x = x + frand2() * 40; particle[j].ov.y = y; particle[j].ov.z = z + frand2() * 40; particle[j].move.x = 0.8f * frand2(); particle[j].move.y = -4.f * rnd(); particle[j].move.z = 0.8f * frand2(); particle[j].scale.x = -0.1f; particle[j].scale.y = -0.1f; particle[j].scale.z = -0.1f; particle[j].timcreation = lARXTime; particle[j].tolive = 2600 + (unsigned long)(rnd() * 600.f); particle[j].tc = tex_p2; particle[j].siz = 0.3f; particle[j].r = 0.4f; particle[j].g = 0.4f; particle[j].b = 0.6f; } } return 1.0f - rnd() * 0.3f; }
//--------------------------------------------------------------------- float CRepelUndead::Render(LPDIRECT3DDEVICE7 m_pd3dDevice) { if (ulCurrentTime >= ulDuration) { return 0.f; } SETZWRITE(m_pd3dDevice, FALSE); m_pd3dDevice->SetRenderState(D3DRENDERSTATE_SRCBLEND, D3DBLEND_ONE); m_pd3dDevice->SetRenderState(D3DRENDERSTATE_DESTBLEND, D3DBLEND_ONE); SETALPHABLEND(m_pd3dDevice, TRUE); //---------------------------- EERIE_3D eObjAngle; EERIE_3D eObjPos; EERIE_3D eObjScale; EERIE_RGB rgbObjColor; eObjAngle.b = fBeta; eObjAngle.a = 0; eObjAngle.g = 0; eObjPos.x = eSrc.x; eObjPos.y = eSrc.y - 5.f; eObjPos.z = eSrc.z; rgbObjColor.r = 0.6f; rgbObjColor.g = 0.6f; rgbObjColor.b = 0.8f; float vv = 1.f + (EEsin(ARX_TIME_Get() * DIV1000)); vv *= DIV2; vv += 1.1f; eObjScale.z = vv; eObjScale.y = vv; eObjScale.x = vv; if (ssol) DrawEERIEObjEx(m_pd3dDevice, ssol, &eObjAngle, &eObjPos, &eObjScale, &rgbObjColor); vv *= 100.f; for (int n = 0; n < 4; n++) { int j = ARX_PARTICLES_GetFree(); if ((j != -1) && (!ARXPausedTimer)) { ParticleCount++; particle[j].exist = 1; particle[j].zdec = 0; particle[j].ov.x = eSrc.x - EEsin(frand2() * 360.f) * vv; particle[j].ov.y = eSrc.y; particle[j].ov.z = eSrc.z + EEcos(frand2() * 360.f) * vv; particle[j].move.x = 0.8f * frand2(); particle[j].move.y = -4.f * rnd(); particle[j].move.z = 0.8f * frand2(); particle[j].scale.x = -0.1f; particle[j].scale.y = -0.1f; particle[j].scale.z = -0.1f; particle[j].timcreation = lARXTime; particle[j].tolive = 2600 + (unsigned long)(rnd() * 600.f); particle[j].tc = tex_p2; particle[j].siz = 0.3f; particle[j].r = 0.4f; particle[j].g = 0.4f; particle[j].b = 0.6f; } } if (this->lLightId == -1) this->lLightId = GetFreeDynLight(); if (this->lLightId != -1) { long id = this->lLightId; DynLight[id].exist = 1; DynLight[id].intensity = 2.3f; DynLight[id].fallend = 350.f; DynLight[id].fallstart = 150.f; DynLight[id].rgb.r = 0.8f; DynLight[id].rgb.g = 0.8f; DynLight[id].rgb.b = 1; DynLight[id].pos.x = eSrc.x; DynLight[id].pos.y = eSrc.y - 50.f; DynLight[id].pos.z = eSrc.z; DynLight[id].duration = 200; DynLight[id].time_creation = ARXTimeUL(); } return 1; }
//--------------------------------------------------------------------- float CRuneOfGuarding::Render() { float x = eSrc.x; float y = eSrc.y - 20; float z = eSrc.z; GRenderer->SetRenderState(Renderer::DepthWrite, false); GRenderer->SetBlendFunc(Renderer::BlendOne, Renderer::BlendOne); GRenderer->SetRenderState(Renderer::AlphaBlending, true); Anglef stiteangle; Color3f stitecolor; float stiteangleb = (float) ulCurrentTime * fOneOnDuration * 120; stiteangle.a = 0; stiteangle.g = 0; Vec3f stitepos = Vec3f(x, y, z); float gtc = arxtime.get_updated(); float v = EEsin(gtc * ( 1.0f / 1000 )) * ( 1.0f / 10 ); stiteangle.b = MAKEANGLE(gtc * ( 1.0f / 1000 )); stitecolor.r = 0.4f - v; stitecolor.g = 0.4f - v; stitecolor.b = 0.6f - v; Vec3f stitescale = Vec3f(1.f, -0.1f, 1.f); if(slight) { DrawEERIEObjEx(slight, &stiteangle, &stitepos, &stitescale, &stitecolor); } stiteangle.b = stiteangleb; stitecolor.r = 0.6f; stitecolor.g = 0.f; stitecolor.b = 0.f; stitescale = Vec3f::repeat(2.f); if(ssol) { DrawEERIEObjEx(ssol, &stiteangle, &stitepos, &stitescale, &stitecolor); } stitecolor.r = 0.6f; stitecolor.g = 0.3f; stitecolor.b = 0.45f; stitescale = Vec3f::repeat(1.8f); if(srune) { DrawEERIEObjEx(srune, &stiteangle, &stitepos, &stitescale, &stitecolor); } for(int n = 0; n < 4; n++) { PARTICLE_DEF * pd = createParticle(); if(!pd) { break; } pd->ov = Vec3f(x + frand2() * 40.f, y, z + frand2() * 40.f); pd->move = Vec3f(0.8f * frand2(), -4.f * rnd(), 0.8f * frand2()); pd->scale = Vec3f::repeat(-0.1f); pd->tolive = Random::get(2600, 3200); pd->tc = tex_p2; pd->siz = 0.3f; pd->rgb = Color3f(.4f, .4f, .6f); } return 1.0f - rnd() * 0.3f; }
float CRepelUndead::Render() { if(ulCurrentTime >= ulDuration) { return 0.f; } GRenderer->SetRenderState(Renderer::DepthWrite, false); GRenderer->SetBlendFunc(Renderer::BlendOne, Renderer::BlendOne); GRenderer->SetRenderState(Renderer::AlphaBlending, true); Anglef eObjAngle; Vec3f eObjPos; Vec3f eObjScale; Color3f rgbObjColor; eObjAngle.b = fBeta; eObjAngle.a = 0; eObjAngle.g = 0; eObjPos.x = eSrc.x; eObjPos.y = eSrc.y - 5.f; eObjPos.z = eSrc.z; rgbObjColor.r = 0.6f; rgbObjColor.g = 0.6f; rgbObjColor.b = 0.8f; float vv = 1.f + (EEsin(arxtime.get_updated() * ( 1.0f / 1000 ))); vv *= ( 1.0f / 2 ); vv += 1.1f; eObjScale.z = vv; eObjScale.y = vv; eObjScale.x = vv; if(ssol) { DrawEERIEObjEx(ssol, &eObjAngle, &eObjPos, &eObjScale, &rgbObjColor); } vv *= 100.f; for(int n = 0; n < 4; n++) { PARTICLE_DEF * pd = createParticle(); if(!pd) { break; } float dx = -EEsin(frand2() * 360.f) * vv; float dz = EEcos(frand2() * 360.f) * vv; pd->ov = eSrc + Vec3f(dx, 0.f, dz); pd->move = Vec3f(0.8f * frand2(), -4.f * rnd(), 0.8f * frand2()); pd->scale = Vec3f::repeat(-0.1f); pd->tolive = Random::get(2600, 3200); pd->tc = tex_p2; pd->siz = 0.3f; pd->rgb = Color3f(.4f, .4f, .6f); } if(lLightId == -1) { lLightId = GetFreeDynLight(); } if(lLightId != -1) { long id = lLightId; DynLight[id].exist = 1; DynLight[id].intensity = 2.3f; DynLight[id].fallend = 350.f; DynLight[id].fallstart = 150.f; DynLight[id].rgb = Color3f(0.8f, 0.8f, 1.f); DynLight[id].pos = eSrc + Vec3f(0.f, -50.f, 0.f); DynLight[id].duration = 200; DynLight[id].time_creation = (unsigned long)(arxtime); } return 1; }
//--------------------------------------------------------------------- float CNegateMagic::Render() { int i = 0; if (spells[spellinstance].caster == 0) { eSrc.x = player.pos.x; eSrc.y = player.pos.y + 170.f; eSrc.z = player.pos.z; } else { eSrc.x = inter.iobj[spells[spellinstance].caster]->pos.x; eSrc.y = inter.iobj[spells[spellinstance].caster]->pos.y; eSrc.z = inter.iobj[spells[spellinstance].caster]->pos.z; } float x = eSrc.x; float y = eSrc.y - 10.f; float z = eSrc.z; if (ulCurrentTime >= ulDuration) { return 0.f; } GRenderer->SetRenderState(Renderer::DepthWrite, false); GRenderer->SetRenderState(Renderer::AlphaBlending, true); GRenderer->SetTexture(0, tex_sol); GRenderer->SetBlendFunc(Renderer::BlendOne, Renderer::BlendOne); GRenderer->SetRenderState(Renderer::AlphaBlending, true); fSize = ulCurrentTime * fOneOnDuration * 200; for (i = 0; i < 360; i++) { float t = rnd(); if (t < 0.04f) { int j = ARX_PARTICLES_GetFree(); if ((j != -1) && (!arxtime.is_paused())) { ParticleCount++; particle[j].exist = 1; particle[j].zdec = 0; particle[j].ov.x = x + frand2() * 150.f; particle[j].ov.y = y; particle[j].ov.z = z + frand2() * 150.f; particle[j].move.x = 0; particle[j].move.y = - 3.0f * rnd(); particle[j].move.z = 0; particle[j].siz = 0.3f; particle[j].tolive = Random::get(2000, 4000); particle[j].scale.x = 1.f; particle[j].scale.y = 1.f; particle[j].scale.z = 1.f; particle[j].timcreation = (long)arxtime; particle[j].tc = tex_p2; particle[j].special = FADE_IN_AND_OUT | ROTATING | MODULATE_ROTATION | DISSIPATING | SUBSTRACT; particle[j].fparam = 0.0000001f; particle[j].rgb = Color3f::white; } } } GRenderer->SetRenderState(Renderer::AlphaBlending, true); Anglef stiteangle(0.f, -(float) ulCurrentTime * fOneOnDuration * 120, 0.f); Vec3f stitepos(x, y, z); Color3f stitecolor(.4f, .4f, .4f); Vec3f stitescale(3.f, 3.f, 3.f); DrawEERIEObjEx(ssol, &stiteangle, &stitepos, &stitescale, &stitecolor); GRenderer->SetBlendFunc(Renderer::BlendOne, Renderer::BlendOne); stitecolor = Color3f(.5f, 0.f, .5f); stitescale = Vec3f(3.1f, 3.1f, 3.1f); DrawEERIEObjEx(ssol, &stiteangle, &stitepos, &stitescale, &stitecolor); return 1; }
//--------------------------------------------------------------------- float CIceProjectile::Render() { int i = 0; if (ulCurrentTime >= ulDuration) return 0.f; GRenderer->SetCulling(Renderer::CullCW); GRenderer->SetRenderState(Renderer::DepthWrite, false); GRenderer->SetBlendFunc(Renderer::BlendInvDstColor, Renderer::BlendOne); GRenderer->SetRenderState(Renderer::AlphaBlending, true); iMax = (int)((iNumber * 2) * fOneOnDuration * ulCurrentTime); if (iMax > iNumber) iMax = iNumber; for (i = 0; i < iMax; i++) { if (tSize[i].x < tSizeMax[i].x) tSize[i].x += 0.1f; if (tSize[i].x > tSizeMax[i].x) tSize[i].x = tSizeMax[i].x; if (tSize[i].y < tSizeMax[i].y) tSize[i].y += 0.1f; if (tSize[i].y < 0) tSize[i].y = 0; if (tSize[i].y > tSizeMax[i].y) tSize[i].y = tSizeMax[i].y; if (tSize[i].z < tSizeMax[i].z) tSize[i].z += 0.1f; if (tSize[i].z > tSizeMax[i].z) tSize[i].z = tSizeMax[i].z; Anglef stiteangle; Vec3f stitepos; Vec3f stitescale; Color3f stitecolor; stiteangle.b = (float) cos(radians(tPos[i].x)) * 360; stiteangle.a = 0; stiteangle.g = 0; stitepos = tPos[i]; float tt; tt = tSizeMax[i].y * fColor; stitecolor.g = stitecolor.r = tt * 0.7f; stitecolor.b = tt * 0.9f; if (stitecolor.r > 1) stitecolor.r = 1; if (stitecolor.g > 1) stitecolor.g = 1; if (stitecolor.b > 1) stitecolor.b = 1; stitescale = tSize[i]; if (tType[i] == 0) DrawEERIEObjEx(smotte, &stiteangle, &stitepos, &stitescale, &stitecolor); else DrawEERIEObjEx(stite, &stiteangle, &stitepos, &stitescale, &stitecolor); } for(i = 0; i < min(iNumber, iMax + 1); i++) { float t = rnd(); if(t < 0.01f) { PARTICLE_DEF * pd = createParticle(); if(pd) { pd->ov = tPos[i] + randomVec(-5.f, 5.f); pd->move = randomVec(-2.f, 2.f); pd->siz = 20.f; float t = min(2000.f + rnd() * 2000.f, ulDuration - ulCurrentTime + 500.0f * rnd()); pd->tolive = checked_range_cast<unsigned long>(t); pd->tc = tex_p2; pd->special = FADE_IN_AND_OUT | ROTATING | MODULATE_ROTATION | DISSIPATING; pd->fparam = 0.0000001f; pd->rgb = Color3f(0.7f, 0.7f, 1.f); } } else if(t > 0.095f) { PARTICLE_DEF * pd = createParticle(); if(pd) { pd->ov = tPos[i] + randomVec(-5.f, 5.f) - Vec3f(0.f, 50.f, 0.f); pd->move = Vec3f(0.f, 2.f - 4.f * rnd(), 0.f); pd->siz = 0.5f; float t = min(2000.f + rnd() * 1000.f, ulDuration - ulCurrentTime + 500.0f * rnd()); pd->tolive = checked_range_cast<unsigned long>(t); pd->tc = tex_p1; pd->special = FADE_IN_AND_OUT | ROTATING | MODULATE_ROTATION | DISSIPATING; pd->fparam = 0.0000001f; pd->rgb = Color3f(0.7f, 0.7f, 1.f); } } } return 1; }
//----------------------------------------------------------------------------- float CMagicMissile::Render(LPDIRECT3DDEVICE7 m_pd3dDevice) { int i = 0; EERIE_3D lastpos, newpos; EERIE_3D v; EERIE_3D stiteangle; EERIE_3D stitepos; EERIE_3D stitescale; EERIE_RGB stitecolor; EERIE_3D av; if (ulCurrentTime >= ulDuration) { return 0.f; } // Set Appropriate Renderstates ------------------------------------------- SETCULL(m_pd3dDevice, D3DCULL_NONE); SETZWRITE(m_pd3dDevice, FALSE); m_pd3dDevice->SetRenderState(D3DRENDERSTATE_SRCBLEND, D3DBLEND_ONE); m_pd3dDevice->SetRenderState(D3DRENDERSTATE_DESTBLEND, D3DBLEND_ONE); SETALPHABLEND(m_pd3dDevice, TRUE); // Set Texture ------------------------------------------------------------ if (tex_mm && tex_mm->m_pddsSurface) { if ((spells[spellinstance].caster == 0) && (cur_mr == 3)) SETTC(m_pd3dDevice, NULL); else SETTC(m_pd3dDevice, tex_mm); } // ------------------------------------------------------------------------ if (bMove) { fTrail = (ulCurrentTime * fOneOnDuration) * (iBezierPrecision + 2) * 5; } lastpos.x = pathways[0].sx; lastpos.y = pathways[0].sy; lastpos.z = pathways[0].sz; Vector_Copy(&newpos, &lastpos); for (i = 0; i < 5; i++) { int kp = i; int kpprec = (i > 0) ? kp - 1 : kp ; int kpsuiv = kp + 1 ; int kpsuivsuiv = (i < (5 - 2)) ? kpsuiv + 1 : kpsuiv; for (int toto = 1; toto < iBezierPrecision; toto++) { if (fTrail < i * iBezierPrecision + toto) break; float t = toto * fOneOnBezierPrecision; float t1 = t; float t2 = t1 * t1 ; float t3 = t2 * t1 ; float f0 = 2.f * t3 - 3.f * t2 + 1.f ; float f1 = -2.f * t3 + 3.f * t2 ; float f2 = t3 - 2.f * t2 + t1 ; float f3 = t3 - t2 ; float val = pathways[kpsuiv].sx; float p0 = 0.5f * (val - pathways[kpprec].sx) ; float p1 = 0.5f * (pathways[kpsuivsuiv].sx - pathways[kp].sx) ; v.x = f0 * pathways[kp].sx + f1 * val + f2 * p0 + f3 * p1 ; val = pathways[kpsuiv].sy ; p0 = 0.5f * (val - pathways[kpprec].sy) ; p1 = 0.5f * (pathways[kpsuivsuiv].sy - pathways[kp].sy) ; v.y = f0 * pathways[kp].sy + f1 * val + f2 * p0 + f3 * p1 ; val = pathways[kpsuiv].sz ; p0 = 0.5f * (val - pathways[kpprec].sz) ; p1 = 0.5f * (pathways[kpsuivsuiv].sz - pathways[kp].sz) ; v.z = f0 * pathways[kp].sz + f1 * val + f2 * p0 + f3 * p1 ; Vector_Copy(&newpos, &v); if (!((fTrail - (i * iBezierPrecision + toto)) > iLength)) { float c; if (fTrail < iLength) { c = 1.0f - ((fTrail - (i * iBezierPrecision + toto)) / fTrail); } else { c = 1.0f - ((fTrail - (i * iBezierPrecision + toto)) / (float)iLength); } float fsize = c; float alpha = c - 0.2f; if (alpha < 0.2f) alpha = 0.2f; c += frand2() * 0.1f; if (c < 0) c = 0; else if (c > 1) c = 1; int color = D3DRGB(c * fColor[0] * alpha, c * fColor[1] * alpha, c * fColor[2] * alpha); if (fsize < 0.5f) fsize = fsize * 2 * 3; else fsize = (1.0f - fsize + 0.5f) * 2 * (3 * 0.5f); float fs = fsize * 6 + rnd() * 0.3f; float fe = fsize * 6 + rnd() * 0.3f; Draw3DLineTex(m_pd3dDevice, lastpos, newpos, color, fs, fe); } EERIE_3D temp_vector; Vector_Copy(&temp_vector, &lastpos); Vector_Copy(&lastpos, &newpos); Vector_Copy(&newpos, &temp_vector); } } av.x = newpos.x - lastpos.x; av.y = newpos.y - lastpos.y; av.z = newpos.z - lastpos.z; float bubu = GetAngle(av.x, av.z, 0, 0); float bubu1 = GetAngle(av.x, av.y, 0, 0); Vector_Copy(&stitepos, &lastpos); stiteangle.b = -RAD2DEG(bubu); stiteangle.a = 0; stiteangle.g = -(RAD2DEG(bubu1)); if (av.x < 0) stiteangle.g -= 90; if (av.x > 0) stiteangle.g += 90; if (stiteangle.g < 0) stiteangle.g += 360.0f; if ((spells[spellinstance].caster == 0) && (cur_mr == 3)) { stitecolor.r = 1.f; stitecolor.g = 0.f; stitecolor.b = 0.2f; } else { stitecolor.r = 0.3f; stitecolor.g = 0.3f; stitecolor.b = 0.5f; } Vector_Init(&stitescale, 1, 1, 1); { if ((smissile)) DrawEERIEObjEx(m_pd3dDevice, smissile, &stiteangle, &stitepos, &stitescale, &stitecolor); } Vector_Copy(&eCurPos, &lastpos); return 1 - 0.5f * rnd(); }
void CMagicMissile::Render() { Vec3f lastpos, newpos; Vec3f v; if(ulCurrentTime >= ulDuration) return; // Set Appropriate Renderstates GRenderer->SetCulling(Renderer::CullNone); GRenderer->SetRenderState(Renderer::DepthWrite, false); GRenderer->SetBlendFunc(Renderer::BlendOne, Renderer::BlendOne); GRenderer->SetRenderState(Renderer::AlphaBlending, true); // Set Texture if(tex_mm) { if(spells[spellinstance].caster == 0 && cur_mr == 3) GRenderer->ResetTexture(0); else GRenderer->SetTexture(0, tex_mm); } if(bMove) fTrail = (ulCurrentTime * fOneOnDuration) * (iBezierPrecision + 2) * 5; newpos = lastpos = pathways[0].p; for(int i = 0; i < 5; i++) { int kp = i; int kpprec = (i > 0) ? kp - 1 : kp ; int kpsuiv = kp + 1 ; int kpsuivsuiv = (i < (5 - 2)) ? kpsuiv + 1 : kpsuiv; for(int toto = 1; toto < iBezierPrecision; toto++) { if(fTrail < i * iBezierPrecision + toto) break; float t = toto * fOneOnBezierPrecision; float t1 = t; float t2 = t1 * t1 ; float t3 = t2 * t1 ; float f0 = 2.f * t3 - 3.f * t2 + 1.f ; float f1 = -2.f * t3 + 3.f * t2 ; float f2 = t3 - 2.f * t2 + t1 ; float f3 = t3 - t2 ; float val = pathways[kpsuiv].p.x; float p0 = 0.5f * (val - pathways[kpprec].p.x) ; float p1 = 0.5f * (pathways[kpsuivsuiv].p.x - pathways[kp].p.x) ; v.x = f0 * pathways[kp].p.x + f1 * val + f2 * p0 + f3 * p1 ; val = pathways[kpsuiv].p.y ; p0 = 0.5f * (val - pathways[kpprec].p.y) ; p1 = 0.5f * (pathways[kpsuivsuiv].p.y - pathways[kp].p.y) ; v.y = f0 * pathways[kp].p.y + f1 * val + f2 * p0 + f3 * p1 ; val = pathways[kpsuiv].p.z ; p0 = 0.5f * (val - pathways[kpprec].p.z) ; p1 = 0.5f * (pathways[kpsuivsuiv].p.z - pathways[kp].p.z) ; v.z = f0 * pathways[kp].p.z + f1 * val + f2 * p0 + f3 * p1 ; newpos = v; if(!((fTrail - (i * iBezierPrecision + toto)) > iLength)) { float c; if(fTrail < iLength) { c = 1.0f - ((fTrail - (i * iBezierPrecision + toto)) / fTrail); } else { c = 1.0f - ((fTrail - (i * iBezierPrecision + toto)) / (float)iLength); } float fsize = c; float alpha = c - 0.2f; if(alpha < 0.2f) alpha = 0.2f; c += frand2() * 0.1f; if (c < 0) c = 0; else if (c > 1) c = 1; Color color = (fColor * (c * alpha)).to<u8>(); if(fsize < 0.5f) fsize = fsize * 2 * 3; else fsize = (1.0f - fsize + 0.5f) * 2 * (3 * 0.5f); float fs = fsize * 6 + rnd() * 0.3f; float fe = fsize * 6 + rnd() * 0.3f; Draw3DLineTex(lastpos, newpos, color, fs, fe); } Vec3f temp_vector = lastpos; lastpos = newpos; newpos = temp_vector; } } Vec3f av = newpos - lastpos; float bubu = getAngle(av.x, av.z, 0, 0); float bubu1 = getAngle(av.x, av.y, 0, 0); Vec3f stitepos = lastpos; Anglef stiteangle; stiteangle.setPitch(-degrees(bubu)); stiteangle.setYaw(0); stiteangle.setRoll(-(degrees(bubu1))); if(av.x < 0) stiteangle.setRoll(stiteangle.getRoll() - 90); if(av.x > 0) stiteangle.setRoll(stiteangle.getRoll() + 90); if(stiteangle.getRoll() < 0) stiteangle.setRoll(stiteangle.getRoll() + 360.0f); Color3f stitecolor; if(spells[spellinstance].caster == 0 && cur_mr == 3) { stitecolor.r = 1.f; stitecolor.g = 0.f; stitecolor.b = 0.2f; } else { stitecolor.r = 0.3f; stitecolor.g = 0.3f; stitecolor.b = 0.5f; } Vec3f stitescale = Vec3f_ONE; if(smissile) DrawEERIEObjEx(smissile, &stiteangle, &stitepos, &stitescale, stitecolor); eCurPos = lastpos; }
//--------------------------------------------------------------------- float CNegateMagic::Render(LPDIRECT3DDEVICE7 m_pd3dDevice) { int i = 0; if (spells[spellinstance].caster == 0) { eSrc.x = player.pos.x; eSrc.y = player.pos.y + 170.f; eSrc.z = player.pos.z; } else { eSrc.x = inter.iobj[spells[spellinstance].caster]->pos.x; eSrc.y = inter.iobj[spells[spellinstance].caster]->pos.y; eSrc.z = inter.iobj[spells[spellinstance].caster]->pos.z; } float x = eSrc.x; float y = eSrc.y - 10.f; float z = eSrc.z; if (ulCurrentTime >= ulDuration) { return 0.f; } SETZWRITE(m_pd3dDevice, false); SETALPHABLEND(m_pd3dDevice, true); if (tex_sol && tex_sol->m_pddsSurface) { SETTC(m_pd3dDevice, tex_sol); } m_pd3dDevice->SetRenderState(D3DRENDERSTATE_SRCBLEND, D3DBLEND_ONE); m_pd3dDevice->SetRenderState(D3DRENDERSTATE_DESTBLEND, D3DBLEND_ONE); SETALPHABLEND(m_pd3dDevice, true); fSize = ulCurrentTime * fOneOnDuration * 200; float size = 50; for (i = 0; i < 360; i++) { float t = rnd(); if (t < 0.04f) { t = rnd(); int j = ARX_PARTICLES_GetFree(); if ((j != -1) && (!ARXPausedTimer)) { ParticleCount++; particle[j].exist = 1; particle[j].zdec = 0; particle[j].ov.x = x + frand2() * 150.f; particle[j].ov.y = y; particle[j].ov.z = z + frand2() * 150.f; particle[j].move.x = 0; particle[j].move.y = - 3.0f * rnd(); particle[j].move.z = 0; particle[j].siz = 0.3f; particle[j].tolive = 2000 + (unsigned long)(float)(rnd() * 2000.f); particle[j].scale.x = 1.f; particle[j].scale.y = 1.f; particle[j].scale.z = 1.f; particle[j].timcreation = lARXTime; particle[j].tc = tex_p2; particle[j].special = FADE_IN_AND_OUT | ROTATING | MODULATE_ROTATION | DISSIPATING | SUBSTRACT; particle[j].fparam = 0.0000001f; particle[j].r = 1.0f; particle[j].g = 1.0f; particle[j].b = 1.0f; } } } //---------------------------- size = 100; EERIE_3D stiteangle; EERIE_3D stitepos; EERIE_3D stitescale; EERIE_RGB stitecolor; stiteangle.b = (float) ulCurrentTime * fOneOnDuration * 120; stiteangle.a = 0; stiteangle.g = 0; stitepos.x = x; stitepos.y = y; stitepos.z = z; SETALPHABLEND(m_pd3dDevice, true); stiteangle.b = -stiteangle.b; stitecolor.r = 0.4f; stitecolor.g = 0.4f; stitecolor.b = 0.4f; stitescale.x = 3.f; stitescale.y = 3.f; stitescale.z = 3.f; DrawEERIEObjEx(m_pd3dDevice, ssol, &stiteangle, &stitepos, &stitescale, &stitecolor); m_pd3dDevice->SetRenderState(D3DRENDERSTATE_SRCBLEND, D3DBLEND_ONE); m_pd3dDevice->SetRenderState(D3DRENDERSTATE_DESTBLEND, D3DBLEND_ONE); stitecolor.r = 0.5f; stitecolor.g = 0.f; stitecolor.b = 0.5f; stitescale.x = 3.1f; stitescale.y = 3.1f; stitescale.z = 3.1f; DrawEERIEObjEx(m_pd3dDevice, ssol, &stiteangle, &stitepos, &stitescale, &stitecolor); return 1; }