Exemple #1
0
void CTerrainMap::AddNode(int x, int y)
{
	ConvertPos(x, y);

	CDraw32 draw;
	draw.DrawCircle(x,y,20, CPixel32(255,255,255), CPixel32(0,0,0,0));
}
void TerrainRenderable::MakeVertexBuffer()
{
	auto device = Globals::GetDevice()->GetDeviceD3D9();
	int n=GetVertexNum();
	HRESULT res = device->CreateVertexBuffer(n * sizeof(TerrainVertex), D3DUSAGE_WRITEONLY, 0, D3DPOOL_MANAGED, &m_pVB, 0);
	if (res != S_OK)
		ReportErr("Terrain CreateVB Failed");
	TerrainVertex* v = 0;
	int idx=0;
	m_pVB->Lock(0, 0, (void**)&v, 0);

	for (int y = 0; y < terrain_h; ++y)
	{
		for (int x = 0; x < terrain_w; ++x)
		{
			float posx=x;
			float posz=y;
			ConvertPos(posx,posz);
			m_VertexData.push_back(TerrainVertex(posx, m_pHeightField->GetHeight(x,y), posz, (float)x / terrain_w, (float)y / terrain_h));
			//v[idx++]=TerrainVertex(x*vertex_stride - orgX_Offset, GetTerrainHeight(x,y), y*vertex_stride - orgY_Offset, (float)x / terrain_w, (float)y / terrain_h);
		}
	}
	TerrainVertex* first=&(m_VertexData[0]);
	memcpy_s(v,n*sizeof(TerrainVertex),first,n*sizeof(TerrainVertex));
	m_pVB->Unlock();
}
Exemple #3
0
void CTerrainMap::AddBuilding(int x, int y, int side)
{
	ConvertPos(x, y);

	CDraw32 draw;
	draw.BlitColor(x-mSymBldWidth/2, y-mSymBldHeight/2, mSymBldWidth, mSymBldHeight, 
			  (CPixel32*)mSymBld, 0, 0, mSymBldWidth, SideColor(side));
}
Exemple #4
0
void CTerrainMap::AddObjective(int x, int y, int side)
{
	ConvertPos(x, y);

	CDraw32 draw;
	draw.BlitColor(x-mSymObjectiveWidth/2, y-mSymObjectiveHeight/2, mSymObjectiveWidth, mSymObjectiveHeight, 
			  (CPixel32*)mSymObjective, 0, 0, mSymObjectiveWidth, SideColor(side));
}
Exemple #5
0
void CTerrainMap::AddStart(int x, int y, int side)
{
	ConvertPos(x, y);

	CDraw32 draw;
	draw.BlitColor(x-mSymStartWidth/2, y-mSymStartHeight/2, mSymStartWidth, mSymStartHeight, 
			  (CPixel32*)mSymStart, 0, 0, mSymStartWidth, SideColor(side));
}
Exemple #6
0
void CTerrainMap::AddNPC(int x, int y, bool friendly)
{
	ConvertPos(x, y);

	CDraw32 draw;
	if (friendly)
		draw.DrawCircle(x,y,3, CPixel32(0,192,0), CPixel32(0,0,0,0));
	else
		draw.DrawCircle(x,y,3, CPixel32(192,0,0), CPixel32(0,0,0,0));
}
Exemple #7
0
void CTerrainMap::AddWallRect(int x, int y, int side)
{
	ConvertPos(x, y);

	CDraw32 draw;
	switch (side)
	{
		default:
			draw.DrawBox(x-1,y-1,3,3,CPixel32(192,192,192,128));
			break;
		case SIDE_BLUE:
			draw.DrawBox(x-1,y-1,3,3,CPixel32(0,0,192,128));
			break;
		case SIDE_RED:
			draw.DrawBox(x-1,y-1,3,3,CPixel32(192,0,0,128));
			break;
	}
}
Exemple #8
0
void CTerrainMap::AddPlayer(vec3_t origin, vec3_t angles)
{
	// draw player start on automap
	CDraw32 draw;

	vec3_t up;
	vec3_t pt[4] = {{0,0,0},{-5,-5,0},{10,0,0},{-5,5,0}};
	vec3_t p;
	int x,y,i;
	float facing;
	POINT poly[4];

	facing = angles[1];
	
	up[0] = 0;
	up[1] = 0;
	up[2] = 1;

	x = (int)origin[0];
	y = (int)origin[1];
	ConvertPos(x, y);
	x++; y++;

	for (i=0; i<4; i++)
	{
		RotatePointAroundVector( p, up, pt[i], facing );
		poly[i].x = (int)(-p[0] + x);
		poly[i].y = (int)(p[1] + y);
	}

	// draw arrowhead shadow
	draw.DrawPolygon(4, poly, CPixel32(0,0,0,128), CPixel32(0,0,0,128));

	// draw arrowhead
	for (i=0; i<4; i++)
	{
		poly[i].x--;
		poly[i].y--;
	}
	draw.DrawPolygon(4, poly, CPixel32(255,255,255), CPixel32(255,255,255));
}