Esempio n. 1
0
//-----------------------------------------------------------------------------
// rendu de la d�chirure spatio temporelle
float CSummonCreature::Render(LPDIRECT3DDEVICE7 m_pd3dDevice)
{
    if (ulCurrentTime >= (ulDurationIntro + ulDurationRender + ulDurationOuttro)) return 0.f;

    SETTC(m_pd3dDevice, NULL);
    SETCULL(m_pd3dDevice, D3DCULL_NONE);
    SETZWRITE(m_pd3dDevice, false);

    SETTEXTUREWRAPMODE(m_pd3dDevice, D3DTADDRESS_CLAMP);
    m_pd3dDevice->SetRenderState(D3DRENDERSTATE_SRCBLEND,  D3DBLEND_ONE);
    m_pd3dDevice->SetRenderState(D3DRENDERSTATE_DESTBLEND, D3DBLEND_ONE);
    SETALPHABLEND(m_pd3dDevice, true);

    //-------------------------------------------------------------------------
    fTexWrap += 0.02f;

    if (fTexWrap >= 1.0f)
    {
        fTexWrap -= 1.0f;
    }

    //-------------------------------------------------------------------------
    // render intro (opening + rays)
    if (ulCurrentTime < ulDurationIntro)
    {
        if (ulCurrentTime < ulDurationIntro * 0.666f)
        {
            fSizeIntro = (end + 2) * fOneOnDurationIntro * (1.5f) * ulCurrentTime;
            sizeF = 1;
        }
        else
        {
            if (bIntro != false)
                bIntro = false;

            sizeF = (iSize) * (fOneOnDurationIntro * 3) * (ulCurrentTime - ulDurationIntro * 0.666f);
        }
    }
    // do nothing just render
    else if (ulCurrentTime < (ulDurationIntro + ulDurationRender))
    {
    }
    // close it all
    else if (ulCurrentTime < (ulDurationIntro + ulDurationRender + ulDurationOuttro))
    {
        //if (sizeF > 0)
        {
            sizeF = iSize - (iSize) * fOneOnDurationOuttro * (ulCurrentTime - (ulDurationIntro + ulDurationRender));
        }
    }

    SETALPHABLEND(m_pd3dDevice, false);
    RenderFissure(m_pd3dDevice);

    SETZWRITE(m_pd3dDevice, true);
    SETALPHABLEND(m_pd3dDevice, false);
    SETTEXTUREWRAPMODE(m_pd3dDevice, D3DTADDRESS_WRAP);

    return (fSizeIntro / end);
}
Esempio n. 2
0
void ARXDRAW_DrawAllInterTransPolyPos(LPDIRECT3DDEVICE7 pd3dDevice)
{
	SETALPHABLEND(pd3dDevice,TRUE);
	EERIEDrawnPolys+=INTERTRANSPOLYSPOS;

	for (long i=0;i<INTERTRANSPOLYSPOS;i++) 
	{
		if (!InterTransFace[i]) continue; // Object was destroyed after sending faces...

		if (InterTransFace[i]->texid<0) continue;

		if (InterTransFace[i]->facetype & POLY_DOUBLESIDED) 
				SETCULL(pd3dDevice,D3DCULL_NONE);
		else	SETCULL(pd3dDevice,D3DCULL_CW);

		SETTC(pd3dDevice,InterTransTC[i]);
		EERIE_FACE * ef=InterTransFace[i];
		float ttt=ef->transval;

		if (ttt>=2.f)  //MULTIPLICATIVE
		{
			SETBLENDMODE(pd3dDevice,D3DBLEND_ONE,D3DBLEND_ONE);
			ttt*=DIV2;
			ttt+=0.5f;
			InterTransPol[i][2].color=InterTransPol[i][1].color=InterTransPol[i][0].color=_EERIERGB(ttt);
		}
		else if (ttt>=1.f) //ADDITIVE
		{	
			ttt-=1.f;
			SETBLENDMODE(pd3dDevice,D3DBLEND_ONE,D3DBLEND_ONE);
			InterTransPol[i][2].color=InterTransPol[i][1].color=InterTransPol[i][0].color=_EERIERGB(ttt);
		}
		else if (ttt>0.f)  //NORMAL TRANS
		{
			ttt=1.f-ttt;
			SETBLENDMODE(pd3dDevice,D3DBLEND_DESTCOLOR,D3DBLEND_SRCCOLOR);
			InterTransPol[i][2].color=InterTransPol[i][1].color=InterTransPol[i][0].color=_EERIERGBA(ttt);//ttt);
		}
		else  //SUBTRACTIVE
		{
			SETBLENDMODE(pd3dDevice,D3DBLEND_ZERO,D3DBLEND_INVSRCCOLOR);
			ttt=1.f-ttt;
			InterTransPol[i][2].color=InterTransPol[i][1].color=InterTransPol[i][0].color=_EERIERGB(ttt);
		}

		EERIEDRAWPRIM(pd3dDevice, D3DPT_TRIANGLESTRIP, D3DFVF_TLVERTEX| D3DFVF_DIFFUSE , InterTransPol[i], 3,  0, EERIE_NOCOUNT | (bSoftRender?EERIE_USEVB:0) );
	}

	INTERTRANSPOLYSPOS=0;
}
Esempio n. 3
0
//---------------------------------------------------------------------
float CControlTarget::Render(LPDIRECT3DDEVICE7 m_pd3dDevice)
{
	int i = 0;

	SETCULL(m_pd3dDevice, D3DCULL_NONE);
	SETZWRITE(m_pd3dDevice, FALSE);
	SETALPHABLEND(m_pd3dDevice, TRUE);

	//----------------------------
	m_pd3dDevice->SetRenderState(D3DRENDERSTATE_SRCBLEND,  D3DBLEND_ONE);
	m_pd3dDevice->SetRenderState(D3DRENDERSTATE_DESTBLEND, D3DBLEND_ONE);
	SETALPHABLEND(m_pd3dDevice, TRUE);

	if (tex_mm && tex_mm->m_pddsSurface)
	{
		SETTC(m_pd3dDevice, tex_mm);
	}

	// -------------------
	fTrail += 1;

	if (fTrail >= 300) fTrail = 0;

	int n = BEZIERPrecision;
	float delta = 1.0f / n;

	fTrail = (ulCurrentTime * fOneOnDuration) * 9 * (n + 2);

	EERIE_3D lastpos, newpos;
	EERIE_3D v;

	int arx_check_init = -1;
	newpos.x = 0;
	newpos.y = 0;
	newpos.z = 0;


	lastpos.x = pathways[0].sx;
	lastpos.y = pathways[0].sy;
	lastpos.z = pathways[0].sz;

	for (i = 0; i < 9; i++)
	{
		int kp		= i;
		int kpprec	= (i > 0) ? kp - 1 : kp ;
		int kpsuiv	= kp + 1 ;
		int kpsuivsuiv = (i < (9 - 2)) ? kpsuiv + 1 : kpsuiv;

		for (int toto = 1; toto < n; toto++)
		{
			if (fTrail < i * n + toto) break;

			float t = toto * delta;

			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 ;

			newpos.x = v.x;
			newpos.y = v.y;
			newpos.z = v.z;

			if (!((fTrail - (i * n + toto)) > 70))
			{
				float c = 1.0f - ((fTrail - (i * n + toto)) / 70.0f);

				int j = ARX_PARTICLES_GetFree();

				if ((j != -1) && (!ARXPausedTimer))
				{
					ParticleCount++;
					particle[j].exist = 1;
					particle[j].zdec = 0;

					particle[j].ov.x		= lastpos.x;
					particle[j].ov.y		= lastpos.y;
					particle[j].ov.z		= lastpos.z;
					particle[j].move.x		= 0;
					particle[j].move.y		= 0;
					particle[j].move.z		= 0;
					particle[j].siz			= 5 * c;
					particle[j].tolive		= 10 + (unsigned long)(float)(rnd() * 100.f);
					particle[j].scale.x 	= 1;
					particle[j].scale.y 	= 1;
					particle[j].scale.z 	= 1;
					particle[j].timcreation = lARXTime;
					particle[j].tc			= tex_mm;
					particle[j].special 	= FADE_IN_AND_OUT | ROTATING | MODULATE_ROTATION | DISSIPATING;
					particle[j].fparam		= 0.0000001f;
					particle[j].r			= c;
					particle[j].g			= c;
					particle[j].b			= c;
				}
			}

			float nx = lastpos.x;
			float ny = lastpos.y;
			float nz = lastpos.z;

			lastpos.x = newpos.x;
			lastpos.y = newpos.y;
			lastpos.z = newpos.z;

			newpos.x = nx;
			newpos.y = ny;
			newpos.z = nz;
			++arx_check_init;

			int j = ARX_PARTICLES_GetFree();

			if ((j != -1) && (!ARXPausedTimer))
			{
				ParticleCount++;
				particle[j].exist	= 1;
				particle[j].zdec	= 0;

				particle[j].ov.x	= lastpos.x;
				particle[j].ov.y	= lastpos.y;
				particle[j].ov.z	= lastpos.z;
				particle[j].move.x	= 0;
				particle[j].move.y	= 0;
				particle[j].move.z	= 0;
				particle[j].siz		= 5;
				particle[j].tolive	= 10 + (unsigned long)(float)(rnd() * 100.f);
				particle[j].scale.x = 1;
				particle[j].scale.y = 1;
				particle[j].scale.z = 1;
				particle[j].timcreation = lARXTime;
				particle[j].tc		= tex_mm;
				particle[j].special = FADE_IN_AND_OUT | ROTATING | MODULATE_ROTATION | DISSIPATING;
				particle[j].fparam	= 0.0000001f;
				particle[j].r		= 0.1f;
				particle[j].g		= 0.1f;
				particle[j].b		= 0.1f;
			}
		}
	}

	EERIE_3D stiteangle;
	EERIE_3D stitepos;
	EERIE_3D stitescale;
	EERIE_RGB stitecolor;

	EERIE_3D av;
	ARX_CHECK_NOT_NEG(arx_check_init);
	av.x = lastpos.x - newpos.x;
	av.y = lastpos.y - newpos.y;
	av.z = lastpos.z - newpos.z;

	TRUEVector_Normalize(&av);

	float bubu = GetAngle(av.x, av.z, 0, 0);
	float bubu1 = GetAngle(av.x, av.y, 0, 0);

	stitepos.x = lastpos.x;
	stitepos.y = lastpos.y;
	stitepos.z = lastpos.z;
	stiteangle.b = 180 - RAD2DEG(bubu);
	stiteangle.a = 0;
	stiteangle.g = 90 - RAD2DEG(bubu1);
	stitecolor.r = 0.7f;
	stitecolor.g = 0.7f;
	stitecolor.b = 0.7f;
	stitescale.x = 1;
	stitescale.y = 1;
	stitescale.z = 1;

	eCurPos.x = lastpos.x;
	eCurPos.y = lastpos.y;
	eCurPos.z = lastpos.z;

	return 1;
}
Esempio n. 4
0
//---------------------------------------------------------------------
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;
}
Esempio n. 5
0
//---------------------------------------------------------------------
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;
}
Esempio n. 6
0
//---------------------------------------------------------------------
float CBless::Render(LPDIRECT3DDEVICE7 _pD3DDevice)
{
	int i = 0;

	float x = eSrc.x;
	float y = eSrc.y - 5;
	float z = eSrc.z;

	if (ulCurrentTime >= ulDuration)
	{
		return 0.f;
	}

	SETCULL(_pD3DDevice, D3DCULL_NONE);
	SETZWRITE(_pD3DDevice, false);
	SETALPHABLEND(_pD3DDevice, true);

	D3DTLVERTEX v[4];
	D3DTLVERTEX v3[4];

	float ff = ((float)spells[spellinstance].caster_level + 10) * 6.f;
	float fBetaRadCos = (float) cos(DEG2RAD(MAKEANGLE(player.angle.b))) * ff;
	float fBetaRadSin = (float) sin(DEG2RAD(MAKEANGLE(player.angle.b))) * ff;

	unsigned long color = D3DRGB(1, 1, 1);

	v[0].sx = x - fBetaRadCos - fBetaRadSin;
	v[0].sy = y;
	v[0].sz = z - fBetaRadSin + fBetaRadCos;
	v[1].sx = x + fBetaRadCos - fBetaRadSin;
	v[1].sy = y;
	v[1].sz = z + fBetaRadSin + fBetaRadCos;
	v[2].sx = x - fBetaRadCos + fBetaRadSin;
	v[2].sy = y;
	v[2].sz = z - fBetaRadSin - fBetaRadCos;
	v[3].sx = x + fBetaRadCos + fBetaRadSin;
	v[3].sy = y;
	v[3].sz = z + fBetaRadSin - fBetaRadCos;

	v3[0].color = color;
	v3[1].color = color;
	v3[2].color = color;
	v3[3].color = color;

	if (tex_sol && tex_sol->m_pddsSurface)
	{
		SETTC(_pD3DDevice, tex_sol);
	}

	v3[0].tu = 0;
	v3[0].tv = 0;
	v3[1].tu = 1.f;
	v3[1].tv = 0;
	v3[2].tu = 0;
	v3[2].tv = 1.f;
	v3[3].tu = 1.f;
	v3[3].tv = 1.f;

	EE_RT2(&v[0], &v3[0]);
	EE_RT2(&v[1], &v3[1]);
	EE_RT2(&v[2], &v3[2]);
	EE_RT2(&v[3], &v3[3]);
	ARX_DrawPrimitive_SoftClippZ(&v3[0],
	                             &v3[1],
	                             &v3[2]);
	ARX_DrawPrimitive_SoftClippZ(&v3[1],
	                             &v3[2],
	                             &v3[3]);
	
	//----------------------------
	SETALPHABLEND(_pD3DDevice, false);

	for (i = 0; i < 12; i++)
	{
		int j = ARX_PARTICLES_GetFree();

		if ((j != -1) && (!ARXPausedTimer))
		{
			ParticleCount++;
			particle[j].exist = 1;
			particle[j].zdec = 0;

			particle[j].ov.x		=	eSrc.x;
			particle[j].ov.y		=	eSrc.y - 20;
			particle[j].ov.z		=	eSrc.z;
			particle[j].move.x		=	3.f * frand2();
			particle[j].move.y		=	rnd() * 0.5f;
			particle[j].move.z		=	3.f * frand2();
			particle[j].siz			=	0.005f;
			particle[j].tolive		=	1000 + (unsigned long)(float)(rnd() * 1000.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_p1;
			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.6f;
			particle[j].b			=	0.2f;
		}
	}

	SETCULL(_pD3DDevice, D3DCULL_NONE);
	SETZWRITE(_pD3DDevice, false);
	SETALPHABLEND(_pD3DDevice, true);

	return 1;
}
Esempio n. 7
0
//-----------------------------------------------------------------------------
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();
}
Esempio n. 8
0
//-----------------------------------------------------------------------------
void DrawArcElectrique(LPDIRECT3DDEVICE7 m_pd3dDevice, EERIE_3D * tabdef, int nbseg, TextureContainer * tex, float fBeta, int tsp)
{
	D3DTLVERTEX v[4];
	D3DTLVERTEX v2[4];

	long i;

	//-------------------------------------------------------------------------
	// rendu
	//	SETTC(m_pd3dDevice,NULL);
	SETCULL(m_pd3dDevice, D3DCULL_NONE);

	if (tex && tex->m_pddsSurface)
	{
		SETTC(m_pd3dDevice, tex);
	}

	v2[0].color = v2[1].color = v2[2].color = v2[3].color = RGBA_MAKE(tsp, tsp, tsp, 255);

	float xx;
	float zz;

	for (i = 0; i < nbseg - 2; i++)
	{
		EERIE_3D astart;

		astart.x = tabdef[i].x;
		astart.y = tabdef[i].y;
		astart.z = tabdef[i].z;

		zz = 5; // size
		xx = (float)(5 * cos(DEG2RAD(fBeta)));

		float ax = tabdef[i+1].x;
		float ay = tabdef[i+1].y;
		float az = tabdef[i+1].z;

		// version 2 faces
		v2[0].tu = 0;
		v2[0].tv = 0;
		v2[1].tu = 1;
		v2[1].tv = 0;
		v2[2].tu = 1;
		v2[2].tv = 1;
		v2[3].tu = 0;
		v2[3].tv = 1;

		v[0].sx = astart.x;
		v[0].sy = astart.y + zz;
		v[0].sz = astart.z;

		v[1].sx = astart.x;
		v[1].sy = astart.y - zz;
		v[1].sz = astart.z;

		v[2].sx = ax;
		v[2].sy = ay - zz;
		v[2].sz = az;

		v[3].sx = ax;
		v[3].sy = ay + zz;
		v[3].sz = az;

		EE_RT2(&v[0], &v2[0]);
		EE_RT2(&v[1], &v2[1]);
		EE_RT2(&v[2], &v2[2]);
		EE_RT2(&v[3], &v2[3]);
		ARX_DrawPrimitive_SoftClippZ(&v2[0],
		                             &v2[1],
		                             &v2[2]);
		ARX_DrawPrimitive_SoftClippZ(&v2[0],
		                             &v2[2],
		                             &v2[3]);

		zz *= (float) sin(DEG2RAD(fBeta));

		v[0].sx = astart.x + xx;
		v[0].sy = astart.y;
		v[0].sz = astart.z + zz;

		v[1].sx = astart.x - xx;
		v[1].sy = astart.y;
		v[1].sz = astart.z - zz;

		v[2].sx = ax - xx;
		v[2].sy = ay;
		v[2].sz = az - zz;

		v[3].sx = ax + xx;
		v[3].sy = ay;
		v[3].sz = az + zz;

		EE_RT2(&v[0], &v2[0]);
		EE_RT2(&v[1], &v2[1]);
		EE_RT2(&v[2], &v2[2]);
		EE_RT2(&v[3], &v2[3]);
		ARX_DrawPrimitive_SoftClippZ(&v2[0],
		                             &v2[1],
		                             &v2[2]);
		ARX_DrawPrimitive_SoftClippZ(&v2[0],
		                             &v2[2],
		                             &v2[3]);
	}
}
Esempio n. 9
0
void ARXDRAW_DrawAllTransPolysPos( LPDIRECT3DDEVICE7 pd3dDevice, long MODIF )
{
	int flg_NOCOUNT_USEVB = EERIE_NOCOUNT | (bSoftRender?EERIE_USEVB:0);
	SetZBias( pd3dDevice, 1 );

	SETALPHABLEND( pd3dDevice, TRUE );

	long i, to = 0; 

	register EERIEPOLY * ep;

	for ( i = 0 ; i < TRANSPOLYSPOS ; i++ ) 
	{
		ep = TransPol[i];

		if ( ( !( Project.hide & HIDE_BACKGROUND ) ) )
		{
			if ( ep->type & POLY_DOUBLESIDED ) SETCULL( pd3dDevice, D3DCULL_NONE );
			else SETCULL( pd3dDevice, D3DCULL_CW );
		
			if ( ViewMode & VIEWMODE_FLAT ) SETTC( pd3dDevice, NULL );
			else	SETTC( pd3dDevice, ep->tex );

			if ( ep->type & POLY_QUAD ) to = 4;
			else to = 3;

			float ttt = ep->transval;

			if ( ttt >= 2.f )  //MULTIPLICATIVE
			{
				SETBLENDMODE( pd3dDevice, D3DBLEND_ONE, D3DBLEND_ONE );
				ttt	*= DIV2;
				ttt	+= 0.5f;
				ep->tv[3].color = ep->tv[2].color = ep->tv[1].color = ep->tv[0].color = _EERIERGB( ttt );
			}
			else if ( ttt >= 1.f ) //ADDITIVE
			{	
				ttt -= 1.f;
				SETBLENDMODE( pd3dDevice, D3DBLEND_ONE, D3DBLEND_ONE );
				ep->tv[3].color = ep->tv[2].color = ep->tv[1].color = ep->tv[0].color = _EERIERGB( ttt );
			}
			else if ( ttt > 0.f )  //NORMAL TRANS
			{
				ttt = 1.f - ttt;
				SETBLENDMODE( pd3dDevice, D3DBLEND_DESTCOLOR, D3DBLEND_SRCCOLOR );
				ep->tv[3].color = ep->tv[2].color = ep->tv[1].color = ep->tv[0].color = _EERIERGBA(ttt);  
			}
			else  //SUBTRACTIVE
			{
				SETBLENDMODE( pd3dDevice, D3DBLEND_ZERO, D3DBLEND_INVSRCCOLOR );
				ttt = 1.f - ttt;
				ep->tv[3].color = ep->tv[2].color = ep->tv[1].color = ep->tv[0].color = _EERIERGB( ttt );
			}

			EERIEDRAWPRIM( pd3dDevice, D3DPT_TRIANGLESTRIP, D3DFVF_TLVERTEX | D3DFVF_DIFFUSE , ep->tv, to,  0, bSoftRender?EERIE_USEVB:0  );

				if (ep->type & POLY_LAVA)
				{
					pd3dDevice->SetRenderState( D3DRENDERSTATE_SRCBLEND,  D3DBLEND_DESTCOLOR );
					pd3dDevice->SetRenderState( D3DRENDERSTATE_DESTBLEND, D3DBLEND_ONE );	
					SETALPHABLEND( pd3dDevice, TRUE );	
					D3DTLVERTEX verts[4];
					SETTC( pd3dDevice, enviro );

				ARX_CHECK(to > 0);

					for ( long j = 0 ; j < to ; j++ )
					{
						verts[j].sx		= ep->tv[j].sx;
						verts[j].sy		= ep->tv[j].sy;
						verts[j].sz		= ep->tv[j].sz;
						verts[j].rhw	= ep->tv[j].rhw;
						verts[j].color	= 0xFFFFFFFF;
						verts[j].tu		= ep->v[j].sx * DIV1000 + EEsin( ( ep->v[j].sx ) * DIV200 + (float) FrameTime * DIV2000 ) * DIV20;
						verts[j].tv		= ep->v[j].sz * DIV1000 + EEcos( (ep->v[j].sz) * DIV200 + (float) FrameTime * DIV2000 ) * DIV20;
					}	

					EERIEDRAWPRIM(pd3dDevice, D3DPT_TRIANGLESTRIP, D3DFVF_TLVERTEX | D3DFVF_DIFFUSE, verts, to, 0, flg_NOCOUNT_USEVB );

					for ( i = 0 ; i < to ; i++ )
					{
						verts[i].tu = ep->v[i].sx * DIV1000 + EEsin( ( ep->v[i].sx ) * DIV100 + (float)FrameTime * DIV2000 ) * DIV10;
						verts[i].tv = ep->v[i].sz * DIV1000 + EEcos( ( ep->v[i].sz ) * DIV100 + (float)FrameTime * DIV2000 ) * DIV10;
					}	
					EERIEDRAWPRIM(pd3dDevice, D3DPT_TRIANGLESTRIP, D3DFVF_TLVERTEX | D3DFVF_DIFFUSE, verts, to, 0, flg_NOCOUNT_USEVB );
					
					for ( i = 0 ; i < to ; i++ )
					{
							verts[i].tu		= ep->v[i].sx * DIV600 + EEsin ( ( ep->v[i].sx ) * DIV160 + (float)FrameTime * DIV2000 ) * DIV11;
							verts[i].tv		= ep->v[i].sz * DIV600 + EEcos ( ( ep->v[i].sz ) * DIV160 + (float)FrameTime * DIV2000 ) * DIV11;
							verts[i].color	= 0xFF666666;
					}	

					pd3dDevice->SetRenderState( D3DRENDERSTATE_SRCBLEND,  D3DBLEND_ZERO );
					pd3dDevice->SetRenderState( D3DRENDERSTATE_DESTBLEND, D3DBLEND_INVSRCCOLOR );
					EERIEDRAWPRIM(pd3dDevice, D3DPT_TRIANGLESTRIP, D3DFVF_TLVERTEX | D3DFVF_DIFFUSE, verts, to, 0, flg_NOCOUNT_USEVB );
				}
			}


		if ( ep->type & POLY_WATER )
		{
				pd3dDevice->SetRenderState( D3DRENDERSTATE_SRCBLEND,  D3DBLEND_DESTCOLOR );
				pd3dDevice->SetRenderState( D3DRENDERSTATE_DESTBLEND, D3DBLEND_ONE );	

				SETALPHABLEND( pd3dDevice, TRUE );	
				
				D3DTLVERTEX verts[4];

				SETTC( pd3dDevice, enviro );

			ARX_CHECK(to > 0);

				for ( long j = 0 ; j < to ; j++ )
				{
					verts[j].sx		= ep->tv[j].sx;
					verts[j].sy		= ep->tv[j].sy;
					verts[j].sz		= ep->tv[j].sz;
					verts[j].rhw	= ep->tv[j].rhw;
					verts[j].color	= 0xFF505050;
					verts[j].tu		= ep->v[j].sx * DIV1000 + EEsin( ( ep->v[j].sx ) * DIV200 + (float)FrameTime * DIV1000 ) * DIV32;
					verts[j].tv		= ep->v[j].sz * DIV1000 + EEcos( ( ep->v[j].sz ) * DIV200 + (float)FrameTime * DIV1000 ) * DIV32;

					if ( ep->type & POLY_FALL ) verts[j].tv += (float)FrameTime * DIV4000;
				}

				EERIEDRAWPRIM(pd3dDevice, D3DPT_TRIANGLESTRIP, D3DFVF_TLVERTEX | D3DFVF_DIFFUSE, verts, to, 0, flg_NOCOUNT_USEVB );

				for ( i = 0 ; i < to ; i++ )
				{
					verts[i].tu = ( ep->v[i].sx + 30.f ) * DIV1000 + EEsin( ( ep->v[i].sx + 30 ) * DIV200 + (float)FrameTime * DIV1000 ) * DIV28;
					verts[i].tv = ( ep->v[i].sz + 30.f ) * DIV1000 - EEcos( ( ep->v[i].sz + 30 ) * DIV200 + (float)FrameTime * DIV1000 ) * DIV28;

					if ( ep->type & POLY_FALL ) verts[i].tv += (float)FrameTime * DIV4000;
				}

				EERIEDRAWPRIM(pd3dDevice, D3DPT_TRIANGLESTRIP, D3DFVF_TLVERTEX | D3DFVF_DIFFUSE, verts, to, 0, flg_NOCOUNT_USEVB );

				for ( i = 0 ; i < to ; i++ )
				{
					verts[i].tu = ( ep->v[i].sx + 60.f ) * DIV1000 - EEsin( ( ep->v[i].sx + 60 ) * DIV200 + (float)FrameTime * DIV1000 ) * DIV40;
					verts[i].tv = ( ep->v[i].sz + 60.f ) * DIV1000 - EEcos( ( ep->v[i].sz + 60 ) * DIV200 + (float)FrameTime * DIV1000 ) * DIV40;

					if ( ep->type & POLY_FALL ) verts[i].tv += (float)FrameTime * DIV4000;
				}	
				EERIEDRAWPRIM(pd3dDevice, D3DPT_TRIANGLESTRIP, D3DFVF_TLVERTEX | D3DFVF_DIFFUSE, verts, to, 0, flg_NOCOUNT_USEVB );
		}
	}

	SetZBias( pd3dDevice, 0 );
}
Esempio n. 10
0
void ARXDRAW_DrawPolyBoom(LPDIRECT3DDEVICE7 pd3dDevice)
{
	D3DTLVERTEX ltv[4];

	long i,k;
	float tt;

	SetZBias(pd3dDevice,8);
	GDevice->SetRenderState(D3DRENDERSTATE_FOGCOLOR,0);
	unsigned long tim = ARXTimeUL(); 	
	SETALPHABLEND(pd3dDevice,TRUE);

	for ( i = 0 ; i < MAX_POLYBOOM ; i++ )
	{
		if ( polyboom[i].exist )
		{
			if ( polyboom[i].type & 128 )
			{	
				if (polyboom[i].timecreation - FrameDiff > 0)
				{
					float fCalc	=	polyboom[i].timecreation - FrameDiff;	
					ARX_CHECK_ULONG( fCalc );
					polyboom[i].timecreation	=	ARX_CLEAN_WARN_CAST_ULONG( fCalc );
				}

				if (polyboom[i].timecreation - FrameDiff > 0)
				{
					float fCalc	= 	polyboom[i].timecreation - FrameDiff;	
					ARX_CHECK_ULONG( fCalc );
					polyboom[i].timecreation	=	ARX_CLEAN_WARN_CAST_ULONG( fCalc );
				}

			}

			float t	=	(float)polyboom[i].timecreation + (float)polyboom[i].tolive - (float)tim;

			if ( t <= 0 ) 
			{
				polyboom[i].exist=0;
				BoomCount--;
				continue;
			}
			
			if (Project.hide & HIDE_BACKGROUND) continue;
			else
			{
				long typp	=	polyboom[i].type;
				typp		&=	~128;

				switch (typp) 
				{
					case 0:	
					tt	=	(float)t / (float)polyboom[i].tolive * 0.8f;

					IncrementPolyWithNormalOutput(polyboom[i].ep,2.f,ltv);
					EE_RT2(&ltv[0],&ltv[0]);
					EE_RT2(&ltv[1],&ltv[1]);
					EE_RT2(&ltv[2],&ltv[2]);

					for (k=0;k<polyboom[i].nbvert;k++) 
					{
						ltv[k].tu=polyboom[i].u[k];
						ltv[k].tv=polyboom[i].v[k];

						if (Project.improve) ltv[k].color=EERIERGB(tt*DIV2,0.f,0.f);
						else ltv[k].color=_EERIERGB(tt);

						ltv[k].specular=0xFF000000;
					}				

						if (Project.improve) 
						{
							SETBLENDMODE(pd3dDevice,D3DBLEND_ONE,D3DBLEND_ONE);
						}
						else  
						{
							SETBLENDMODE(pd3dDevice,D3DBLEND_ZERO,D3DBLEND_INVSRCCOLOR);
						}

						SETTC(pd3dDevice,Boom);
						ARX_DrawPrimitive_SoftClippZ(	&ltv[0],
														&ltv[1],
														&ltv[2]);

						if(polyboom[i].nbvert&4)
						{
							EE_RT2(&ltv[3],&ltv[3]);
							ARX_DrawPrimitive_SoftClippZ(	&ltv[1],
															&ltv[2],
															&ltv[3]);
						}
					break;
					case 1:	// Blood
					{
						float div=1.f/(float)polyboom[i].tolive;
						tt=(float)t*div;
						float tr = tt * 2 - 0.5f; 

						if (tr<1.f) tr=1.f;

						D3DCOLOR col=EERIERGB(polyboom[i].rgb.r*tt,polyboom[i].rgb.g*tt,polyboom[i].rgb.b*tt);

						for (k=0;k<polyboom[i].nbvert;k++) 
						{
							ltv[k].tu=(polyboom[i].u[k]-0.5f)*(tr)+0.5f;
							ltv[k].tv=(polyboom[i].v[k]-0.5f)*(tr)+0.5f;
							ltv[k].color=col;
							ltv[k].specular=0xFF000000;
						}	


							IncrementPolyWithNormalOutput(polyboom[i].ep,2.f,ltv);
							EE_RT2(&ltv[0],&ltv[0]);							
							EE_RT2(&ltv[1],&ltv[1]);							
							EE_RT2(&ltv[2],&ltv[2]);

							if(polyboom[i].nbvert&4)
							{
								EE_RT2(&ltv[3],&ltv[3]);							
							}							

								
							{
								
								SETTEXTUREWRAPMODE(pd3dDevice,D3DTADDRESS_CLAMP);
								SETBLENDMODE(pd3dDevice,D3DBLEND_ONE,D3DBLEND_ONE);
							SETTC(pd3dDevice, polyboom[i].tc); 

 									ARX_DrawPrimitive_SoftClippZ(		&ltv[0],
 																		&ltv[1],
 																		&ltv[2]);

 									if(polyboom[i].nbvert&4)
 									{
  										ARX_DrawPrimitive_SoftClippZ(	&ltv[1],
  																		&ltv[2],
 																		&ltv[3]);
									}


								col=_EERIERGB(tt);
								ltv[0].color=ltv[1].color=ltv[2].color=ltv[3].color=col;								
								
								SETBLENDMODE(pd3dDevice,D3DBLEND_ZERO,D3DBLEND_INVSRCCOLOR);

									ARX_DrawPrimitive_SoftClippZ(	&ltv[0],
																	&ltv[1],
																	&ltv[2]);

									if(polyboom[i].nbvert&4)
									{
										ARX_DrawPrimitive_SoftClippZ(	&ltv[1],
																		&ltv[2],
																		&ltv[3]);
									}
								
								SETTEXTUREWRAPMODE(pd3dDevice,D3DTADDRESS_WRAP);
							}
						}
					break;				
					case 2: // WATER
					{
						float div=1.f/(float)polyboom[i].tolive;
						tt=(float)t*div;
						float tr = (tt * 2 - 0.5f); 

						if (tr<1.f) tr=1.f;			

						float ttt=tt*0.5f;
						D3DCOLOR col=EERIERGB(	polyboom[i].rgb.r*ttt,
												polyboom[i].rgb.g*ttt,
												polyboom[i].rgb.b*ttt);

						for (k=0;k<polyboom[i].nbvert;k++) 
						{
							ltv[k].tu=(polyboom[i].u[k]-0.5f)*(tr)+0.5f;
							ltv[k].tv=(polyboom[i].v[k]-0.5f)*(tr)+0.5f;
							ltv[k].color=col;
							ltv[k].specular=0xFF000000;
						}	

						if (	(ltv[0].tu<0.f)
							&&	(ltv[1].tu<0.f)
							&&	(ltv[2].tu<0.f)
							&&	(ltv[3].tu<0.f) )
							break;

						if (	(ltv[0].tv<0.f)
							&&	(ltv[1].tv<0.f)
							&&	(ltv[2].tv<0.f)
							&&	(ltv[3].tv<0.f) )
							break;

						if (	(ltv[0].tu>1.f)
							&&	(ltv[1].tu>1.f)
							&&	(ltv[2].tu>1.f)
							&&	(ltv[3].tu>1.f) )
							break;

						if (	(ltv[0].tv>1.f)
							&&	(ltv[1].tv>1.f)
							&&	(ltv[2].tv>1.f)
							&&	(ltv[3].tv>1.f) )
							break;

							IncrementPolyWithNormalOutput(polyboom[i].ep,2.f,ltv);
							EE_RT2(&ltv[0],&ltv[0]);
							EE_RT2(&ltv[1],&ltv[1]);
							EE_RT2(&ltv[2],&ltv[2]);
								
								SETTEXTUREWRAPMODE(pd3dDevice,D3DTADDRESS_CLAMP);
								SETBLENDMODE(pd3dDevice,D3DBLEND_INVDESTCOLOR,D3DBLEND_ONE);
						SETTC(pd3dDevice, polyboom[i].tc); 
				
								ARX_DrawPrimitive_SoftClippZ(	&ltv[0],
																&ltv[1],
																&ltv[2]);

								if(polyboom[i].nbvert&4)
								{
									EE_RT2(&ltv[3],&ltv[3]);
									ARX_DrawPrimitive_SoftClippZ(	&ltv[1],
																	&ltv[2],
																	&ltv[3]);
								}

						SETTEXTUREWRAPMODE(pd3dDevice, D3DTADDRESS_WRAP);
								
							}
					break;
				}
			}			
		}	
	}

	SetZBias(pd3dDevice,0);
	GDevice->SetRenderState(D3DRENDERSTATE_FOGCOLOR,ulBKGColor);
}
Esempio n. 11
0
//***********************************************************************************************
// hum... to be checked again for performance and result quality.
//-----------------------------------------------------------------------------------------------
// VERIFIED (Cyril 2001/10/15)
//***********************************************************************************************
void ARXDRAW_DrawInterShadows(LPDIRECT3DDEVICE7 pd3dDevice)
{	
	bool bNoVB						=	false;
	if( bSoftRender )
	{
		bNoVB						=	GET_FORCE_NO_VB();
		SET_FORCE_NO_VB( true );
	}

	GDevice->SetRenderState(D3DRENDERSTATE_FOGCOLOR,0);
	SetZBias(pd3dDevice,1);

	long k;
	long first=1;
	
	for (long i=0;i<TREATZONE_CUR;i++) 
	{
		if ((treatio[i].show!=1) || (treatio[i].io==NULL)) continue;

		INTERACTIVE_OBJ * io=treatio[i].io;

		if (	(!io->obj) 
			||	(io->ioflags & IO_JUST_COLLIDE)	)
		{
			continue;
		}

			if ((Project.hide & HIDE_NPC) &&  (io->ioflags & IO_NPC)) continue;

			if ((Project.hide & HIDE_ITEMS) &&  (io->ioflags & IO_ITEM)) continue;

			if ((Project.hide & HIDE_FIXINTER) && (io->ioflags & IO_FIX)) continue;

			long xx,yy;
			F2L((io->pos.x)*ACTIVEBKG->Xmul,&xx);
			F2L((io->pos.z)*ACTIVEBKG->Zmul,&yy);

			if ( (xx>=1) && (yy>=1) && (xx<ACTIVEBKG->Xsize-1) && (yy<ACTIVEBKG->Zsize-1) )
			{
				FAST_BKG_DATA * feg=(FAST_BKG_DATA *)&ACTIVEBKG->fastdata[xx][yy];

				if(!feg->treat) continue;
			}

			if (!( io->ioflags & IO_NOSHADOW ) )
			if ( io->show==SHOW_FLAG_IN_SCENE ) 
			if ( !(io->ioflags & IO_GOLD) ) 
			{
				register EERIEPOLY * ep;
				D3DTLVERTEX in;			
				
				D3DTLVERTEX ltv[4];
				ltv[0]=	D3DTLVERTEX( D3DVECTOR( 0, 0, 0.001f ), 1.f, 0, 1, 0.3f, 0.3f) ;
				ltv[1]=	D3DTLVERTEX( D3DVECTOR( 0, 0, 0.001f ), 1.f, 0, 1, 0.7f, 0.3f) ;
				ltv[2]=	D3DTLVERTEX( D3DVECTOR( 0, 0, 0.001f ), 1.f, 0, 1, 0.7f, 0.7f) ;		
				ltv[3]=	D3DTLVERTEX( D3DVECTOR( 0, 0, 0.001f ), 1.f, 0, 1, 0.3f, 0.7f) ;
				
				float s1=16.f*io->scale;
				float s2=s1 * DIV2;	

				if (io->obj->nbgroups<=1)
				{
					for (k=0;k<io->obj->nbvertex;k+=9)
					{
						ep=EECheckInPoly(&io->obj->vertexlist3[k].v);

						if (ep!=NULL)
						{
							in.sy=ep->min.y-3.f;
							float r=0.5f-((float)EEfabs(io->obj->vertexlist3[k].v.y-in.sy))*DIV500;
							r-=io->invisibility;
							r*=io->scale;

							if (r<=0.f) continue;
							
							in.sx=io->obj->vertexlist3[k].v.x-s2;						
							in.sz=io->obj->vertexlist3[k].v.z-s2;

							long lv;
							r*=255.f;
							F2L(r,&lv);
							ltv[0].color=ltv[1].color=ltv[2].color=ltv[3].color=0xFF000000 | lv<<16 | lv<<8 | lv;
							
							if (first)
							{
								first=0;
								SETZWRITE(pd3dDevice, FALSE );
								SETBLENDMODE(pd3dDevice,D3DBLEND_ZERO,D3DBLEND_INVSRCCOLOR);
								SETALPHABLEND(pd3dDevice,TRUE);
								SETTC(pd3dDevice,Boom);
							}

							EE_RT2(&in,&ltv[0]);
							in.sx+=s1;
							EE_RT2(&in,&ltv[1]);
							in.sz+=s1;
							EE_RT2(&in,&ltv[2]);
							in.sx-=s1;
							EE_RT2(&in,&ltv[3]);

							if ((ltv[0].sz>0.f) && (ltv[1].sz>0.f) && (ltv[2].sz>0.f))
							{
								ARX_DrawPrimitive_SoftClippZ(	&ltv[0],
															&ltv[1],
															&ltv[2],
															50.f);
								ARX_DrawPrimitive_SoftClippZ(	&ltv[0],
															&ltv[2],
															&ltv[3],
															50.f);
							}
						}
					}	
				}
				else 
				{
					for (k=0;k<io->obj->nbgroups;k++)
					{
						long origin=io->obj->grouplist[k].origin;
						ep=EECheckInPoly(	&io->obj->vertexlist3[origin].v );

						if (ep!=NULL)
						{
							in.sy=ep->min.y-3.f;
							float r=0.8f-((float)EEfabs(io->obj->vertexlist3[origin].v.y-in.sy))*DIV500;
							r*=io->obj->grouplist[k].siz;
							r-=io->invisibility;

							if (r<=0.f) continue;

							float s1=io->obj->grouplist[k].siz*44.f;
							float s2=s1*DIV2;
							in.sx=io->obj->vertexlist3[origin].v.x-s2;						
							in.sz=io->obj->vertexlist3[origin].v.z-s2;

							long lv;
							r*=255.f;
							F2L(r,&lv);						
							ltv[0].color=	ltv[1].color	=	ltv[2].color	=	ltv[3].color	=	0xFF000000 | lv<<16 | lv<<8 | lv;

							if (first)
							{
								first=0;
								SETZWRITE(pd3dDevice, FALSE );
								SETBLENDMODE(pd3dDevice,D3DBLEND_ZERO,D3DBLEND_INVSRCCOLOR);
								SETALPHABLEND(pd3dDevice,TRUE);
								SETTC(pd3dDevice,Boom);
							}

							EE_RT2(&in,&ltv[0]);
							in.sx+=s1;
							EE_RT2(&in,&ltv[1]);
							in.sz+=s1;
							EE_RT2(&in,&ltv[2]);
							in.sx-=s1;
							EE_RT2(&in,&ltv[3]);
							ARX_DrawPrimitive_SoftClippZ(	&ltv[0],
															&ltv[1],
															&ltv[2],
															50.f);
							ARX_DrawPrimitive_SoftClippZ(	&ltv[0],
															&ltv[2],
															&ltv[3],
															50.f);
						}
					}
				}
			}
		
		}

	SETALPHABLEND(pd3dDevice,FALSE);
	SETZWRITE(pd3dDevice, TRUE );
	SetZBias(pd3dDevice,0);
	GDevice->SetRenderState(D3DRENDERSTATE_FOGCOLOR,ulBKGColor);
	
	if( bSoftRender ) SET_FORCE_NO_VB( bNoVB );
}
Esempio n. 12
0
//---------------------------------------------------------------------
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;
}
Esempio n. 13
0
//-----------------------------------------------------------------------------
void CSummonCreature::RenderFissure(LPDIRECT3DDEVICE7 m_pd3dDevice)
{
    int i;
    float ff;
    D3DTLVERTEX vt[4];
    D3DTLVERTEX vr[4];
    D3DTLVERTEX target;

    EERIE_3D etarget;
    etarget.x = fBetaRadCos;
    etarget.y = 0;
    etarget.z = fBetaRadSin;

    //-------------------------------------------------------------------------
    // computation des sommets
    float fTempCos, fTempSin;

    for (i = 0; i <= min(end, int(fSizeIntro)); i++)
    {
        if (i <= end * 0.5f)
        {
            ff = i / (end * 0.5f);
        }
        else
        {
            ff = 1.0f - ((i - (end + 1) * 0.5f) / (end * 0.5f));
        }

        fTempCos = ff * fBetaRadCos;
        fTempSin = ff * fBetaRadSin;

        va[i].sx   = v1a[i].sx   + sizeF * fTempCos;
        va[i].sy   = v1a[i].sy;
        va[i].sz   = v1a[i].sz   + sizeF * fTempSin;

        vb[i].sx   = v1b[i].sx   - sizeF * fTempCos;
        vb[i].sy   = v1b[i].sy;
        vb[i].sz   = v1b[i].sz   - sizeF * fTempSin;

        va[i].sx += rnd() * 0.5f * fTempCos;
        va[i].sz += rnd() * 0.5f * fTempSin;
        vb[i].sx -= rnd() * 0.5f * fTempCos;
        vb[i].sz -= rnd() * 0.5f * fTempSin;
    }

    //-------------------------------------------------------------------------
    // rendu de la fissure
    SETALPHABLEND(m_pd3dDevice, false);
    vr[0].color = vr[1].color = vr[2].color = vr[3].color = D3DRGB(0, 0, 0);

    if (bIntro)
    {
        for (i = 0; i < min(end, (int)fSizeIntro); i++)
        {
            EE_RT2(&v1a[i], &vr[0]);
            EE_RT2(&v1b[i], &vr[1]);
            EE_RT2(&v1a[i+1], &vr[2]);
            EE_RT2(&v1b[i+1], &vr[3]);
            ARX_DrawPrimitive_SoftClippZ(&vr[0],
                                         &vr[1],
                                         &vr[2]);
            ARX_DrawPrimitive_SoftClippZ(&vr[1],
                                         &vr[2],
                                         &vr[3]);
        }
    }
    else
    {
        for (i = 0; i < min(end, (int)fSizeIntro); i++)
        {
            EE_RT2(&va[i], &vr[0]);
            EE_RT2(&vb[i], &vr[1]);
            EE_RT2(&va[i+1], &vr[2]);
            EE_RT2(&vb[i+1], &vr[3]);
            ARX_DrawPrimitive_SoftClippZ(&vr[0],
                                         &vr[1],
                                         &vr[2]);
            ARX_DrawPrimitive_SoftClippZ(&vr[1],
                                         &vr[2],
                                         &vr[3]);
        }
    }

    //-------------------------------------------------------------------------
    // rendu de la bordure
    SETALPHABLEND(m_pd3dDevice, true);
    vr[0].color = vr[1].color = D3DRGB(0, 0, 0);
    vr[2].color = vr[3].color = D3DRGB(fColorBorder[0], fColorBorder[1], fColorBorder[2]);

    for (i = 0; i < min(end, (int)fSizeIntro); i++)
    {
        vt[2].sx = va[i].sx   - (va[i].sx - eSrc.x) * 0.2f;
        vt[2].sy = va[i].sy   - (va[i].sy - eSrc.y) * 0.2f;
        vt[2].sz = va[i].sz   - (va[i].sz - eSrc.z) * 0.2f;
        vt[3].sx = va[i+1].sx - (va[i+1].sx - eSrc.x) * 0.2f;
        vt[3].sy = va[i+1].sy - (va[i+1].sy - eSrc.y) * 0.2f;
        vt[3].sz = va[i+1].sz - (va[i+1].sz - eSrc.z) * 0.2f;

        EE_RT2(&vt[3], &vr[0]);
        EE_RT2(&vt[2], &vr[1]);
        EE_RT2(&va[i+1], &vr[2]);
        EE_RT2(&va[i], &vr[3]);
        ARX_DrawPrimitive_SoftClippZ(&vr[0],
                                     &vr[1],
                                     &vr[2]);
        ARX_DrawPrimitive_SoftClippZ(&vr[1],
                                     &vr[2],
                                     &vr[3]);

        vt[2].sx = vb[i].sx   - (vb[i].sx - eSrc.x) * 0.2f;
        vt[2].sy = vb[i].sy   - (vb[i].sy - eSrc.y) * 0.2f;
        vt[2].sz = vb[i].sz   - (vb[i].sz - eSrc.z) * 0.2f;
        vt[3].sx = vb[i+1].sx - (vb[i+1].sx - eSrc.x) * 0.2f;
        vt[3].sy = vb[i+1].sy - (vb[i+1].sy - eSrc.y) * 0.2f;
        vt[3].sz = vb[i+1].sz - (vb[i+1].sz - eSrc.z) * 0.2f;

        EE_RT2(&vb[i], &vr[3]);
        EE_RT2(&vb[i+1], &vr[2]);
        EE_RT2(&vt[2], &vr[1]);
        EE_RT2(&vt[3], &vr[0]);
        ARX_DrawPrimitive_SoftClippZ(&vr[0],
                                     &vr[1],
                                     &vr[2]);
        ARX_DrawPrimitive_SoftClippZ(&vr[1],
                                     &vr[2],
                                     &vr[3]);

    }

    //-------------------------------------------------------------------------
    // rendu des faisceaux
    // blend additif ou mul
    // smooth sur les cot�s ou pas ..
    // texture sympa avec glow au milieu ou uv wrap
    SETALPHABLEND(m_pd3dDevice, true);

    if (tex_light && tex_light->m_pddsSurface)
    {
        SETTEXTUREWRAPMODE(m_pd3dDevice, D3DTADDRESS_MIRROR);
        SETTC(m_pd3dDevice, tex_light);
    }

    target.sx = eSrc.x + -fBetaRadSin * (1.5f * sizeF);
    target.sy = eSrc.y;
    target.sz = eSrc.z + fBetaRadCos * (1.5f * sizeF);

    EE_RTP(&vt[1], &vr[0]);
    vr[0].color = D3DRGB(fColorRays1[0], fColorRays1[1], fColorRays1[2]);
    vr[1].color = D3DRGB(fColorRays1[0], fColorRays1[1], fColorRays1[2]);
    vr[2].color = D3DRGB(fColorRays2[0], fColorRays2[1], fColorRays2[2]);
    vr[3].color = D3DRGB(fColorRays2[0], fColorRays2[1], fColorRays2[2]);

    vr[0].tu = fTexWrap;
    vr[0].tv = 1;
    vr[1].tu = 1.0f + fTexWrap;
    vr[1].tv = 1;
    vr[2].tu = fTexWrap;
    vr[2].tv = 0;
    vr[3].tu = 1.0f + fTexWrap;
    vr[3].tv = 0;

    for (i = 0; i < end - 1; i++)
    {
        if (i < fSizeIntro)
        {
            vt[0].sx = va[i].sx;
            vt[0].sy = va[i].sy;
            vt[0].sz = va[i].sz;
            vt[1].sx = va[i+1].sx;
            vt[1].sy = va[i+1].sy;
            vt[1].sz = va[i+1].sz;
            vt[2].sx = va[i].sx + (va[i].sx - target.sx) * 2;
            vt[2].sy = va[i].sy + (va[i].sy - target.sy) * 2;
            vt[2].sz = va[i].sz + (va[i].sz - target.sz) * 2;
            vt[3].sx = va[i+1].sx + (va[i+1].sx - target.sx) * 2;
            vt[3].sy = va[i+1].sy + (va[i+1].sy - target.sy) * 2;
            vt[3].sz = va[i+1].sz + (va[i+1].sz - target.sz) * 2;

            vr[0].color = D3DRGB(tfRaysa[i] * fColorRays1[0],   tfRaysa[i] * fColorRays1[1],   tfRaysa[i] * fColorRays1[2]);
            vr[1].color = D3DRGB(tfRaysa[i+1] * fColorRays1[0], tfRaysa[i+1] * fColorRays1[1], tfRaysa[i+1] * fColorRays1[2]);
            vr[2].color = D3DRGB(tfRaysa[i] * fColorRays2[0],   tfRaysa[i] * fColorRays2[1],   tfRaysa[i] * fColorRays2[2]);
            vr[3].color = D3DRGB(tfRaysa[i+1] * fColorRays2[0], tfRaysa[i+1] * fColorRays2[1], tfRaysa[i+1] * fColorRays2[2]);

            EE_RT2(&vt[0], &vr[3]);
            EE_RT2(&vt[1], &vr[2]);
            EE_RT2(&vt[2], &vr[1]);
            EE_RT2(&vt[3], &vr[0]);
            ARX_DrawPrimitive_SoftClippZ(&vr[0],
                                         &vr[1],
                                         &vr[2]);
            ARX_DrawPrimitive_SoftClippZ(&vr[1],
                                         &vr[2],
                                         &vr[3]);
        }

        if (i < fSizeIntro)
        {
            vt[0].sx = vb[i+1].sx;
            vt[0].sy = vb[i+1].sy;
            vt[0].sz = vb[i+1].sz;
            vt[1].sx = vb[i].sx;
            vt[1].sy = vb[i].sy;
            vt[1].sz = vb[i].sz;
            vt[2].sx = vb[i+1].sx + (vb[i+1].sx - target.sx) * 2;
            vt[2].sy = vb[i+1].sy + (vb[i+1].sy - target.sy) * 2;
            vt[2].sz = vb[i+1].sz + (vb[i+1].sz - target.sz) * 2;
            vt[3].sx = vb[i].sx + (vb[i].sx - target.sx) * 2;
            vt[3].sy = vb[i].sy + (vb[i].sy - target.sy) * 2;
            vt[3].sz = vb[i].sz + (vb[i].sz - target.sz) * 2;

            vr[0].color = D3DRGB(tfRaysb[i] * fColorRays1[0],   tfRaysb[i] * fColorRays1[1],   tfRaysb[i] * fColorRays1[2]);
            vr[1].color = D3DRGB(tfRaysb[i+1] * fColorRays1[0], tfRaysb[i+1] * fColorRays1[1], tfRaysb[i+1] * fColorRays1[2]);
            vr[2].color = D3DRGB(tfRaysb[i] * fColorRays2[0],   tfRaysb[i] * fColorRays2[1],   tfRaysb[i] * fColorRays2[2]);
            vr[3].color = D3DRGB(tfRaysb[i+1] * fColorRays2[0], tfRaysb[i+1] * fColorRays2[1], tfRaysb[i+1] * fColorRays2[2]);

            EE_RT2(&vt[0], &vr[3]);
            EE_RT2(&vt[1], &vr[2]);
            EE_RT2(&vt[2], &vr[1]);
            EE_RT2(&vt[3], &vr[0]);
            ARX_DrawPrimitive_SoftClippZ(&vr[0],
                                         &vr[1],
                                         &vr[2]);
            ARX_DrawPrimitive_SoftClippZ(&vr[1],
                                         &vr[2],
                                         &vr[3]);
        }

    }
}
Esempio n. 14
0
//-----------------------------------------------------------------------------
void ARX_MINIMAP_Show(LPDIRECT3DDEVICE7 m_pd3dDevice, long SHOWLEVEL, long flag, long fl2)
{
	float sstartx, sstarty;

	if (!pTexDetect)
	{
		GetTextureFile("Graph\\particles\\flare.bmp");
		char temp[256];
		MakeDir(temp, "Graph\\particles\\flare.bmp");
		pTexDetect = D3DTextr_GetSurfaceContainer(temp);
	}

	//	SHOWLEVEL=8;
	// First Load Minimap TC & DATA if needed
	if (minimap[SHOWLEVEL].tc == NULL)
	{
		ARX_MINIMAP_GetData(SHOWLEVEL);
	}

	if ((minimap[SHOWLEVEL].tc) && (minimap[SHOWLEVEL].tc->m_pddsSurface))
	{
		float startx, starty, casex, casey, ratiooo;
		float mod_x = (float)MAX_BKGX / (float)MINIMAP_MAX_X;
		float mod_z = (float)MAX_BKGZ / (float)MINIMAP_MAX_Z;

		if (flag == 1)
		{


			startx = 0;
			starty = 0;
			casex = (900) / ((float)MINIMAP_MAX_X);
			casey = (900) / ((float)MINIMAP_MAX_Z);
			ratiooo = 900.f / 250.f;

			if (fl2)
			{
				casex = (600) / ((float)MINIMAP_MAX_X);
				casey = (600) / ((float)MINIMAP_MAX_Z);
				ratiooo = 600.f / 250.f;
			}

		}
		else
		{
			startx = (140); 
			starty = (120);
			casex = (250) / ((float)MINIMAP_MAX_X);
			casey = (250) / ((float)MINIMAP_MAX_Z);
			ratiooo = 1.f;
		}

		sstartx = startx;
		sstarty = starty;


		float ofx, ofx2, ofy, ofy2, px, py;
		px = py = 0.f;

		ofx		= mini_offset_x[CURRENTLEVEL];
		ofx2	= minimap[SHOWLEVEL].xratio;
		ofy		= mini_offset_y[CURRENTLEVEL];
		ofy2	= minimap[SHOWLEVEL].yratio;

		if ((SHOWLEVEL == ARX_LEVELS_GetRealNum(CURRENTLEVEL)) || (flag == 2))
		{
			// Computes playerpos
			ofx = mini_offset_x[CURRENTLEVEL];
			ofx2 = minimap[SHOWLEVEL].xratio;
			ofy = mini_offset_y[CURRENTLEVEL];
			ofy2 = minimap[SHOWLEVEL].yratio;
		
			px = startx + ((player.pos.x + ofx - ofx2) * DIV100 * casex
			               + mini_offset_x[CURRENTLEVEL] * ratiooo * mod_x) / mod_x ; //DIV100*2;
			py = starty + ((mapmaxy[SHOWLEVEL] - ofy - ofy2) * DIV100 * casey
			               - (player.pos.z + ofy - ofy2) * DIV100 * casey + mini_offset_y[CURRENTLEVEL] * ratiooo * mod_z) / mod_z ;    //DIV100*2;

			if (flag == 1)
			{
				sstartx = startx;
				sstarty = starty;

				startx = 490.f - px;
				starty = 220.f - py;
				px += startx;
				py += starty;
			}
		}


		D3DTLVERTEX verts[4];
		SETTC(m_pd3dDevice, minimap[SHOWLEVEL].tc);

		for (long k = 0; k < 4; k++)
		{
			verts[k].color = 0xFFFFFFFF;
			verts[k].rhw = 1;
			verts[k].sz = 0.00001f;
		}

		float div = DIV25;
		TextureContainer * tc = minimap[SHOWLEVEL].tc;
		float dw = 1.f / (float)max(tc->m_dwDeviceWidth, tc->m_dwOriginalWidth); 
		float dh = 1.f / (float)max(tc->m_dwDeviceHeight, tc->m_dwOriginalHeight);
		
		float vx2 = 4.f * dw * mod_x;
		float vy2 = 4.f * dh * mod_z;

		float _px;
		RECT boundaries;
		float MOD20, MOD20DIV, divXratio, divYratio;

		boundaries.bottom = boundaries.left = boundaries.right = boundaries.top = 0;
		MOD20 = MOD20DIV = divXratio = divYratio = 0.f;

		if (flag != 2)
		{

			if (flag == 1)
			{
				MOD20 = 20.f * Xratio;
				MOD20DIV = 1.f / (MOD20);
				//@PERF do if(fl2){}else{} to make 4 and not 8 flot op if fl2.

				ARX_CHECK_LONG((360 + MOD20)*Xratio);
				ARX_CHECK_LONG((555 - MOD20)*Xratio);
				ARX_CHECK_LONG((85 + MOD20)*Yratio);
				ARX_CHECK_LONG((355 - MOD20)*Yratio);

				//CAST
				boundaries.left		=	ARX_CLEAN_WARN_CAST_LONG((360 + MOD20) * Xratio);
				boundaries.right	=	ARX_CLEAN_WARN_CAST_LONG((555 - MOD20) * Xratio);
				boundaries.top		=	ARX_CLEAN_WARN_CAST_LONG((85 + MOD20) * Yratio);
				boundaries.bottom	=	ARX_CLEAN_WARN_CAST_LONG((355 - MOD20) * Yratio);

				if (fl2)
				{
					//CHECK (DEBUG)
					ARX_CHECK_LONG((390 + MOD20)*Xratio);
					ARX_CHECK_LONG((590 - MOD20)*Xratio);
					ARX_CHECK_LONG((135 + MOD20)*Yratio);
					ARX_CHECK_LONG((295 - MOD20)*Yratio);

					//CAST
					boundaries.left		=	ARX_CLEAN_WARN_CAST_LONG((390 + MOD20) * Xratio);
					boundaries.right	=	ARX_CLEAN_WARN_CAST_LONG((590 - MOD20) * Xratio);
					boundaries.top		=	ARX_CLEAN_WARN_CAST_LONG((135 + MOD20) * Yratio);
					boundaries.bottom	=	ARX_CLEAN_WARN_CAST_LONG((295 - MOD20) * Yratio);
				}
			}

			SETALPHABLEND(m_pd3dDevice, TRUE);
			m_pd3dDevice->SetRenderState(D3DRENDERSTATE_SRCBLEND,  D3DBLEND_ZERO);
			m_pd3dDevice->SetRenderState(D3DRENDERSTATE_DESTBLEND, D3DBLEND_INVSRCCOLOR);
			m_pd3dDevice->SetRenderState(D3DRENDERSTATE_ZFUNC, D3DCMP_ALWAYS);
			SETTEXTUREWRAPMODE(m_pd3dDevice, D3DTADDRESS_CLAMP);

			if (fl2)
			{
				m_pd3dDevice->SetRenderState(D3DRENDERSTATE_SRCBLEND,  D3DBLEND_ONE);
				m_pd3dDevice->SetRenderState(D3DRENDERSTATE_DESTBLEND, D3DBLEND_INVSRCCOLOR);
			}
		}
		else
		{
			divXratio = 1.f / Xratio;
			divYratio = 1.f / Yratio;
		}

		for (long j = -2; j < MINIMAP_MAX_Z + 2; j++)
		{
			for (long i = -2; i < MINIMAP_MAX_X + 2; i++)
			{
				float vx, vy, vxx, vyy;
				vxx = ((float)i * (float)ACTIVEBKG->Xdiv * mod_x);
				vyy = ((float)j * (float)ACTIVEBKG->Zdiv * mod_z);
				vx = (vxx * div) * dw;
				vy = (vyy * div) * dh;

				long okay = 1;
				float posx = (startx + i * casex) * Xratio;
				float posy = (starty + j * casey) * Yratio;

				if (flag == 1)
				{

					if	((posx < 360 * Xratio)
					        ||	(posx > 555 * Xratio)
					        ||	(posy < 85 * Yratio)
					        ||	(posy > 355 * Yratio))
						okay = 0;

					if (fl2)
					{
						okay = 1;

						if	((posx < 390 * Xratio)
						        ||	(posx > 590 * Xratio)
						        ||	(posy < 135 * Yratio)
						        ||	(posy > 295 * Yratio))
							okay = 0;
					}

				}
				else
				{
					if ((posx > 345 * Xratio)
					        ||	(posy > 290 * Yratio))
						okay = 0;
				}

				if (okay)
				{
					if ((flag == 2)
					        && (i >= 0) && (i < MINIMAP_MAX_X)
					        && (j >= 0) && (j < MINIMAP_MAX_Z))
					{
						float d = Distance2D(posx * divXratio + casex * DIV2, posy * divYratio /*-casey * 2 * Yratio*/, px, py);

						if (d <= 6.f)
						{
							long r;
							float vv = (6 - d) * DIV6;

							if (vv >= 0.5f)
								vv = 1.f;
							else if (vv > 0.f)
								vv = vv * 2.f;
							else
								vv = 0.f;

							F2L((float)(vv * 255.f), &r);


							long ucLevel =  __max(r, minimap[SHOWLEVEL].revealed[i][j]);
							ARX_CHECK_UCHAR(ucLevel);

							minimap[SHOWLEVEL].revealed[i][j] = ARX_CLEAN_WARN_CAST_UCHAR(ucLevel);


						}
					}

					if (!FOR_EXTERNAL_PEOPLE)
					{
						if ((i >= 0) && (i < MINIMAP_MAX_X)
						        &&	(j >= 0) && (j < MINIMAP_MAX_Z))
						{
							minimap[SHOWLEVEL].revealed[i][j] = 255;
						}
					}

					verts[3].sx = verts[0].sx = (posx);
					verts[1].sy = verts[0].sy = (posy);
					verts[2].sx = verts[1].sx = posx + (casex * Xratio);
					verts[3].sy = verts[2].sy = posy + (casey * Yratio);

					verts[3].tu = verts[0].tu = vx;
					verts[1].tv = verts[0].tv = vy;
					verts[2].tu = verts[1].tu = vx + vx2;
					verts[3].tv = verts[2].tv = vy + vy2;

					if (flag != 2)
					{
						float v;
						float oo = 0.f;

						if ((i < 0) || (i >= MINIMAP_MAX_X) || (j < 0) || (j >= MINIMAP_MAX_Z)) v = 0;
						else v = ((float)minimap[SHOWLEVEL].revealed[i][j]) * DIV255;

						if (flag == 1)
						{
							long vert = 0;
							_px = verts[vert].sx - boundaries.left;

							if (_px < 0.f) v = 0.f;
							else if (_px < MOD20) v *= _px * MOD20DIV;

							_px = boundaries.right - verts[vert].sx;

							if (_px < 0.f) v = 0.f;
							else if (_px < MOD20) v *= _px * MOD20DIV;

							_px = verts[vert].sy - boundaries.top;

							if (_px < 0.f) v = 0.f;
							else if (_px < MOD20) v *= _px * MOD20DIV;

							_px = boundaries.bottom - verts[vert].sy;

							if (_px < 0.f) v = 0.f;
							else if (_px < MOD20) v *= _px * MOD20DIV;
						}

						if (fl2) verts[0].color = D3DRGB(v * DIV2, v * DIV2, v * DIV2);
						else
							verts[0].color = D3DRGB(v, v, v);

						oo += v;

						if ((i + 1 < 0) || (i + 1 >= MINIMAP_MAX_X) || (j < 0) || (j >= MINIMAP_MAX_Z)) v = 0;
						else v = ((float)minimap[SHOWLEVEL].revealed[__min(i+1, MINIMAP_MAX_X-1)][j]) * DIV255;

						if (flag == 1)
						{
							long vert = 1;
							_px = verts[vert].sx - boundaries.left;

							if (_px < 0.f) v = 0.f;
							else if (_px < MOD20) v *= _px * MOD20DIV;

							_px = boundaries.right - verts[vert].sx;

							if (_px < 0.f) v = 0.f;
							else if (_px < MOD20) v *= _px * MOD20DIV;

							_px = verts[vert].sy - boundaries.top;

							if (_px < 0.f) v = 0.f;
							else if (_px < MOD20) v *= _px * MOD20DIV;

							_px = boundaries.bottom - verts[vert].sy;

							if (_px < 0.f) v = 0.f;
							else if (_px < MOD20) v *= _px * MOD20DIV;
						}

						if (fl2) verts[1].color = D3DRGB(v * DIV2, v * DIV2, v * DIV2);
						else
							verts[1].color = D3DRGB(v, v, v);

						oo += v;

						if ((i + 1 < 0) || (i + 1 >= MINIMAP_MAX_X) || (j + 1 < 0) || (j + 1 >= MINIMAP_MAX_Z)) v = 0;
						else v = ((float)minimap[SHOWLEVEL].revealed[__min(i+1, MINIMAP_MAX_X-1)][__min(j+1, MINIMAP_MAX_Z-1)]) * DIV255;

						if (flag == 1)
						{
							long vert = 2;
							_px = verts[vert].sx - boundaries.left;

							if (_px < 0.f) v = 0.f;
							else if (_px < MOD20) v *= _px * MOD20DIV;

							_px = boundaries.right - verts[vert].sx;

							if (_px < 0.f) v = 0.f;
							else if (_px < MOD20) v *= _px * MOD20DIV;

							_px = verts[vert].sy - boundaries.top;

							if (_px < 0.f) v = 0.f;
							else if (_px < MOD20) v *= _px * MOD20DIV;

							_px = boundaries.bottom - verts[vert].sy;

							if (_px < 0.f) v = 0.f;
							else if (_px < MOD20) v *= _px * MOD20DIV;
						}
						

						if (fl2) verts[2].color = D3DRGB(v * DIV2, v * DIV2, v * DIV2);
						else
							verts[2].color = D3DRGB(v, v, v);

						oo += v;

						if ((i < 0) || (i >= MINIMAP_MAX_X) || (j + 1 < 0) || (j + 1 >= MINIMAP_MAX_Z)) v = 0;
						else v = ((float)minimap[SHOWLEVEL].revealed[i][__min(j+1, MINIMAP_MAX_Z-1)]) * DIV255;

						if (flag == 1)
						{
							long vert = 3;
							_px = verts[vert].sx - boundaries.left;

							if (_px < 0.f) v = 0.f;
							else if (_px < MOD20) v *= _px * MOD20DIV;

							_px = boundaries.right - verts[vert].sx;

							if (_px < 0.f) v = 0.f;
							else if (_px < MOD20) v *= _px * MOD20DIV;

							_px = verts[vert].sy - boundaries.top;

							if (_px < 0.f) v = 0.f;
							else if (_px < MOD20) v *= _px * MOD20DIV;

							_px = boundaries.bottom - verts[vert].sy;

							if (_px < 0.f) v = 0.f;
							else if (_px < MOD20) v *= _px * MOD20DIV;
						}

						if (fl2) verts[3].color = D3DRGB(v * DIV2, v * DIV2, v * DIV2);
						else
							verts[3].color = D3DRGB(v, v, v);

						oo += v;

						if (oo > 0.f)
						{
							if (fl2)
							{
								verts[0].sx += DECALX * Xratio;
								verts[0].sy += DECALY * Yratio;
								verts[1].sx += DECALX * Xratio;
								verts[1].sy += DECALY * Yratio;
								verts[2].sx += DECALX * Xratio;
								verts[2].sy += DECALY * Yratio;
								verts[3].sx += DECALX * Xratio;
								verts[3].sy += DECALY * Yratio;
							}

							EERIEDRAWPRIM(GDevice, D3DPT_TRIANGLEFAN, D3DFVF_TLVERTEX | D3DFVF_DIFFUSE, verts, 4, 0);
						}
					}
				}
			}
		}

		if (flag != 2)
		{
			m_pd3dDevice->SetTextureStageState(0, D3DTSS_ADDRESS , D3DTADDRESS_WRAP);
			m_pd3dDevice->SetRenderState(D3DRENDERSTATE_ZFUNC, D3DCMP_LESSEQUAL);

			SETALPHABLEND(m_pd3dDevice, FALSE);

			if ((SHOWLEVEL == ARX_LEVELS_GetRealNum(CURRENTLEVEL)))
			{
				// Now Draws Playerpos/angle
				verts[0].color = 0xFFFF0000;
				verts[1].color = 0xFFFF0000;
				verts[2].color = 0xFFFF0000;
				float val;

				if (flag == 1) val = 6.f;
				else val = 3.f;

				float rx = 0.f;
				float ry = -val * 1.8f;
				float rx2 = -val * DIV2;
				float ry2 = val;
				float rx3 = val * DIV2;
				float ry3 = val;

				float angle = DEG2RAD(player.angle.b);
				float ca = EEcos(angle);
				float sa = EEsin(angle);

				verts[0].sx = (px + rx2 * ca + ry2 * sa) * Xratio;
				verts[0].sy = (py + ry2 * ca - rx2 * sa) * Yratio;
				verts[1].sx = (px + rx * ca + ry * sa) * Xratio;
				verts[1].sy = (py + ry * ca - rx * sa) * Yratio;
				verts[2].sx = (px + rx3 * ca + ry3 * sa) * Xratio;
				verts[2].sy = (py + ry3 * ca - rx3 * sa) * Yratio;

				SETTC(GDevice, NULL);

				if (fl2)
				{
					SETALPHABLEND(m_pd3dDevice, TRUE);
					verts[0].sx += DECALX * Xratio;
					verts[0].sy += DECALY * Yratio;
					verts[1].sx += DECALX * Xratio;
					verts[1].sy += DECALY * Yratio;
					verts[2].sx += DECALX * Xratio;
					verts[2].sy += DECALY * Yratio;
				}

				EERIEDRAWPRIM(GDevice, D3DPT_TRIANGLEFAN, D3DFVF_TLVERTEX | D3DFVF_DIFFUSE, verts, 3, 0);

				if (fl2) SETALPHABLEND(m_pd3dDevice, FALSE);
			}
		}

		// tsu
		for (long lnpc = 1; lnpc < inter.nbmax; lnpc++)
		{
			if ((inter.iobj[lnpc] != NULL) && (inter.iobj[lnpc]->ioflags & IO_NPC))
			{
				if (inter.iobj[lnpc]->_npcdata->life > 0.f)
					if (!((inter.iobj[lnpc]->GameFlags & GFLAG_MEGAHIDE) ||
					        (inter.iobj[lnpc]->show == SHOW_FLAG_MEGAHIDE))
					        && (inter.iobj[lnpc]->show == SHOW_FLAG_IN_SCENE))
						if (!(inter.iobj[lnpc]->show == SHOW_FLAG_HIDDEN))
							if (inter.iobj[lnpc]->_npcdata->fDetect >= 0)
							{
								if (player.Full_Skill_Etheral_Link >= inter.iobj[lnpc]->_npcdata->fDetect)
								{
									float fpx;
									float fpy;
								
									fpx = sstartx + ((inter.iobj[lnpc]->pos.x - 100 + ofx - ofx2) * DIV100 * casex
									                 + mini_offset_x[CURRENTLEVEL] * ratiooo * mod_x) / mod_x; 
									fpy = sstarty + ((mapmaxy[SHOWLEVEL] - ofy - ofy2) * DIV100 * casey
									                 - (inter.iobj[lnpc]->pos.z + 200 + ofy - ofy2) * DIV100 * casey + mini_offset_y[CURRENTLEVEL] * ratiooo * mod_z) / mod_z; 

									if (flag == 1)
									{

										fpx = startx + ((inter.iobj[lnpc]->pos.x - 100 + ofx - ofx2) * DIV100 * casex
										                + mini_offset_x[CURRENTLEVEL] * ratiooo * mod_x) / mod_x; 
										fpy = starty + ((mapmaxy[SHOWLEVEL] - ofy - ofy2) * DIV100 * casey
										                - (inter.iobj[lnpc]->pos.z + 200 + ofy - ofy2) * DIV100 * casey + mini_offset_y[CURRENTLEVEL] * ratiooo * mod_z) / mod_z; 


									}

									float d = Distance2D(player.pos.x, player.pos.z, inter.iobj[lnpc]->pos.x, inter.iobj[lnpc]->pos.z);

		
									if ((d <= 800) && (fabs(inter.iobj[0]->pos.y - inter.iobj[lnpc]->pos.y) < 250.f))
									{
										float col = 1.f;

										if (d > 600.f)
										{
											col = 1.f - (d - 600.f) * DIV200;
										}

										if (!fl2)
										{
											SETALPHABLEND(m_pd3dDevice, true);
											m_pd3dDevice->SetRenderState(D3DRENDERSTATE_SRCBLEND,  D3DBLEND_ONE);
											m_pd3dDevice->SetRenderState(D3DRENDERSTATE_DESTBLEND, D3DBLEND_ONE);
										}
										else
											SETALPHABLEND(m_pd3dDevice, true);

										if (fl2)
										{
											fpx += DECALX * Xratio;
											fpy += (DECALY + 15) * Yratio;
										}

										fpx *= Xratio;
										fpy *= Yratio;
										EERIEDrawBitmap(GDevice, fpx, fpy,
										                5.f * ratiooo, 5.f * ratiooo, 0, pTexDetect, D3DRGB(col, 0, 0));

										if (!fl2)
											SETALPHABLEND(m_pd3dDevice, false);
									}
								}
							}
			}
		}

		if (flag == 0)
			for (long i = 0; i < Nb_Mapmarkers; i++)
			{
				if (Mapmarkers[i].lvl == SHOWLEVEL + 1)
				{
					float pos_x = Mapmarkers[i].x * 8 * ratiooo * ACTIVEBKG->Xmul * casex + startx;
					float pos_y = Mapmarkers[i].y * 8 * ratiooo * ACTIVEBKG->Zmul * casey + starty;
					float size = 5.f * ratiooo;
					verts[0].color = 0xFFFF0000;
					verts[1].color = 0xFFFF0000;
					verts[2].color = 0xFFFF0000;
					verts[3].color = 0xFFFF0000;
					verts[0].sx = (pos_x - size) * Xratio;
					verts[0].sy = (pos_y - size) * Yratio;
					verts[1].sx = (pos_x + size) * Xratio;
					verts[1].sy = (pos_y - size) * Yratio;
					verts[2].sx = (pos_x + size) * Xratio;
					verts[2].sy = (pos_y + size) * Yratio;
					verts[3].sx = (pos_x - size) * Xratio;
					verts[3].sy = (pos_y + size) * Yratio;
					verts[0].tu = 0.f;
					verts[0].tv = 0.f;
					verts[1].tu = 1.f;
					verts[1].tv = 0.f;
					verts[2].tu = 1.f;
					verts[2].tv = 1.f;
					verts[3].tu = 0.f;
					verts[3].tv = 1.f;

					if ((!fl2)
					        && (MouseInRect(verts[0].sx, verts[0].sy, verts[2].sx, verts[2].sy)))
					{
						if (!Mapmarkers[i].tstring)
						{
							_TCHAR output[4096];
							MakeLocalised(Mapmarkers[i].string, output, 4096, 0);
							Mapmarkers[i].tstring = (_TCHAR *)malloc((_tcslen(output) + 1) * sizeof(_TCHAR));
							ZeroMemory(Mapmarkers[i].tstring, (_tcslen(output) + 1)*sizeof(_TCHAR));
							_tcscpy(Mapmarkers[i].tstring, output);
						}

						if (Mapmarkers[i].tstring)
						{
							RECT rRect, bRect;
							SetRect(&bRect	, (140),	(290)
							        , (140 + 205),	(358));

							float fLeft		= (bRect.left) * Xratio ;
							float fRight	= (bRect.right) * Xratio ;
							float fTop		= (bRect.top) * Yratio ;
							float fBottom	= (bRect.bottom) * Yratio ;
							ARX_CHECK_INT(fLeft);
							ARX_CHECK_INT(fRight);
							ARX_CHECK_INT(fTop);
							ARX_CHECK_INT(fBottom);

							SetRect(&rRect
							        , ARX_CLEAN_WARN_CAST_INT(fLeft)
							        , ARX_CLEAN_WARN_CAST_INT(fTop)
							        , ARX_CLEAN_WARN_CAST_INT(fRight)
							        , ARX_CLEAN_WARN_CAST_INT(fBottom));


							long lLengthDraw = ARX_UNICODE_ForceFormattingInRect(
							                       hFontInGameNote, Mapmarkers[i].tstring, 0, rRect);

							danaeApp.DANAEEndRender();
							_TCHAR	Page_Buffer[256];
							_tcsncpy(Page_Buffer, Mapmarkers[i].tstring, lLengthDraw);
							Page_Buffer[lLengthDraw] = _T('\0');

							DrawBookTextInRect(ARX_CLEAN_WARN_CAST_FLOAT(bRect.left), ARX_CLEAN_WARN_CAST_FLOAT(bRect.top),
							                   ARX_CLEAN_WARN_CAST_FLOAT(bRect.right), ARX_CLEAN_WARN_CAST_FLOAT(bRect.bottom),
							                   Page_Buffer, 0, 0x00FF00FF,
							                   hFontInGameNote);


							danaeApp.DANAEStartRender();
						}
					}

					if (MapMarkerTc == NULL)
					{
						MapMarkerTc = MakeTCFromFile("Graph\\interface\\icons\\mapmarker.bmp");
					}

					SETTC(GDevice, MapMarkerTc);

					if (fl2)
					{
						verts[0].sx += DECALX * Xratio;
						verts[0].sy += DECALY * Yratio;
						verts[1].sx += DECALX * Xratio;
						verts[1].sy += DECALY * Yratio;
						verts[2].sx += DECALX * Xratio;
						verts[2].sy += DECALY * Yratio;
						verts[3].sx += DECALX * Xratio;
						verts[3].sy += DECALY * Yratio;
					}

					EERIEDRAWPRIM(GDevice, D3DPT_TRIANGLEFAN, D3DFVF_TLVERTEX | D3DFVF_DIFFUSE, verts, 4, 0);
				}
			}

	}
}