#include "Objects.h"

extern unsigned int counter;
unsigned int move = 0;

void DrawVetka()
{
	glBegin(GL_POLYGON);
	glColor4ub(126, 9, 24, 50);
	glVertex2f(-0.05f ,1.5f);
	glVertex2f(0.05f, 1.5f);
	glColor4ub(255, 112, 10, 200);
	glVertex2f(0.1f, 0.0f);
	glVertex2f(-0.1f, 0.0f);
	glEnd();

	glBegin(GL_POLYGON);
	glColor4ub(255, 112, 10, 200);
	glVertex2f(-0.1f, 0.0f);
	glVertex2f(0.1f, 0.0f);
	glVertex2f(0.1f, -0.5f);
	glVertex2f(-0.1f, -0.5f);
	glEnd();

	glBegin(GL_POLYGON);
	glColor4ub(255, 112, 10, 200);
	glVertex2f(-0.1f, -0.5f);
	glVertex2f(0.1f, -0.5f);
	glColor4ub(126, 9, 24, 50);
	glVertex2f(0.05f, -1.5f);
	glVertex2f(-0.05f, -1.5f);
	glEnd();
}

void ÂrawIGDCLogo()
{
	float scaling = counter/5.5;

	glPushMatrix();

	glRotatef(cos(scaling/10)*5.0,0.0f,0.0f,-1.0f);
	glTranslatef(-3.5f,-1.0f,-12.0f);

	glPushMatrix();
	scale(1.0-sin(scaling)/10);

	glPushMatrix();
	glRotatef(50.0f,0.0f,0.0f,-1.0f);
	DrawVetka();
	glPopMatrix();

	glPushMatrix();
	glTranslatef(0.7f,-0.2f,0.0f);
	glRotatef(40.0f,0.0f,0.0f,-1.0f);
	DrawVetka();
	glPopMatrix();
	glPopMatrix();

	glPushMatrix();
	glTranslatef(-0.5f,2.0f,0.0f);
	glRotatef(45.0f,0.0f,0.0f,-1.0f);
	scale(0.7+sin(scaling)/15);
	glPushMatrix();
	glRotatef(50.0f,0.0f,0.0f,-1.0f);
	DrawVetka();
	glPopMatrix();

	glPushMatrix();
	glTranslatef(0.7f,-0.2f,0.0f);
	glRotatef(40.0f,0.0f,0.0f,-1.0f);
	DrawVetka();
	glPopMatrix();
	glPopMatrix();

	glPushMatrix();
	glTranslatef(2.0f,-1.0f,0.0f);
	glRotatef(-45.0f,0.0f,0.0f,-1.0f);
	scale(0.9-sin(scaling)/10);
	glPushMatrix();
	glRotatef(50.0f,0.0f,0.0f,-1.0f);
	DrawVetka();
	glPopMatrix();

	glPushMatrix();
	glTranslatef(0.7f,-0.2f,0.0f);
	glRotatef(40.0f,0.0f,0.0f,-1.0f);
	DrawVetka();
	glPopMatrix();
	glPopMatrix();

	glPushMatrix();
	glTranslatef(-0.0f,3.5f,0.0f);
	glRotatef(75.0f,0.0f,0.0f,-1.0f);
	scale(0.8+sin(scaling)/12);
	glPushMatrix();
	glRotatef(50.0f,0.0f,0.0f,-1.0f);
	DrawVetka();
	glPopMatrix();

	glPushMatrix();
	glTranslatef(0.7f,-0.2f,0.0f);
	glRotatef(40.0f,0.0f,0.0f,-1.0f);
	DrawVetka();
	glPopMatrix();
	glPopMatrix();

	glPushMatrix();
	glTranslatef(1.4f,0.0f,0.0f);
	glRotatef(-23.0f,0.0f,0.0f,-1.0f);
	scale(0.5+sin(scaling)/20);
	glPushMatrix();
	glRotatef(50.0f,0.0f,0.0f,-1.0f);
	DrawVetka();
	glPopMatrix();

	glPushMatrix();
	glTranslatef(0.7f,-0.2f,0.0f);
	glRotatef(40.0f,0.0f,0.0f,-1.0f);
	DrawVetka();
	glPopMatrix();
	glPopMatrix();

	glPushMatrix();
	glTranslatef(3.4f,0.0f,0.0f);
	glRotatef(-80.0f,0.0f,0.0f,-1.0f);
	scale(0.7+sin(scaling)/15);
	glPushMatrix();
	glRotatef(50.0f,0.0f,0.0f,-1.0f);
	DrawVetka();
	glPopMatrix();

	glPushMatrix();
	glTranslatef(0.7f,-0.2f,0.0f);
	glRotatef(40.0f,0.0f,0.0f,-1.0f);
	DrawVetka();
	glPopMatrix();
	glPopMatrix();

	glColor3f(1.0f,1.0f,1.0f);

	glPushMatrix();
	glTranslatef(0.3f,4.2f,1.0f);
	glRotatef(-cos(scaling/10.f)*5,0.0f,0.0f,-1.0f);
	glRotatef(cos(scaling/10.f)*15,0.0f,-1.0f,0.0f);
	scale(0.25);
	DrawText("Special for",2);
	glPopMatrix();

	glPushMatrix();
	glTranslatef(3.f,-2.5f,1.0f);
	glRotatef(-cos(scaling/10.f)*5,0.0f,0.0f,-1.0f);
	glRotatef(cos(scaling/10.f)*15,0.0f,-1.0f,0.0f);
	scale(0.6);
	DrawText("by DRON",6);
	scale(0.2);
	glTranslatef(15.f,-2.5f,0.f);
	DrawText("http://dron.deeprosoft.com",1);
	glPopMatrix();

	glTranslatef(1.7f,1.8f,1.0f);
	glRotatef(-cos(scaling/10.f)*5,0.0f,0.0f,-1.0f);
	glRotatef(-cos(scaling/10.f)*15,0.0f,-1.0f,0.0f);
	scale(0.25);
	DrawText("programmer contest N72",4);
	glTranslatef(0.0f,-1.2f,0.0f);
	scale(0.7);
	DrawText("http://igdc.ru",4);
	glPopMatrix();
}

void DrawMoveingLogo()
{
	if(counter > 150 && counter < 510)
	{
		move = counter - 150;
	}

	glPushMatrix();
	glTranslatef(-0.55 + move/1000.f, 0.0, -1.f);

	if(counter < 500)
		glColor4ub(255 - counter/100, 250 - counter/2, 250 - counter/2, 255);
	else
		glColor4ub(250, 0, 0, 255);

	scale(0.05);
	DrawText("Vo", 3);
	glPopMatrix();

	if(counter < 500)
	{
		glColor4ub(255, 255, 255, 250 - counter/2);
		glPushMatrix();
		glTranslatef(-0.55, 0.0, -1.f);
		scale(0.05);
		DrawText("  xel", 3);
		glPopMatrix();

	}

	glPushMatrix();
	glTranslatef(-0.55 + move/3500.f, 0.0, -1.f);

	if(counter < 500)
		glColor4ub(255 - counter/100, 250 - counter/2, 250 - counter/2, 255);
	else
		glColor4ub(250, 0, 0, 255);

	scale(0.05);
	DrawText("      Pi", 3);
	glPopMatrix();

	if(counter < 500)
	{
		glColor4ub(255, 255, 255, 250 - counter/2);
		glPushMatrix();
		glTranslatef(-0.55, 0.0, -1.f);
		scale(0.05);
		DrawText("        xel", 3);
		glPopMatrix();
	}

	glPushMatrix();
	glTranslatef(-0.55 - move/2000.f, 0.0, -1.f);

	if(counter < 500)
		glColor4ub(255 - counter/100, 250 - counter/2, 250 - counter/2, 255);
	else
		glColor4ub(250, 0, 0, 255);

	scale(0.05);
	DrawText("            Te", 3);
	glPopMatrix();

	if(counter < 500)
	{
		glColor4ub(255, 255, 255, 250 - counter/2);

		glPushMatrix();
		glTranslatef(-0.55, 0.0, -1.f);
		scale(0.05);
		DrawText("              xel", 3);
		glPopMatrix();
	}

	glColor4f(1.f, 1.f, 1.f, 1.f);
}

void DrawCloud()
{
	glPushMatrix();
	glTranslatef(0.f, 0.02, 0.f);
	scale(0.05);
	DrawDisc();
	glPopMatrix();
	glPushMatrix();
	glTranslatef(-0.035, 0.f, 0.f);
	scale(0.05);
	DrawDisc();
	glPopMatrix();
	glPushMatrix();
	glTranslatef(0.03, 0.f, 0.f);
	scale(0.05);
	DrawDisc();
	glPopMatrix();
	glPushMatrix();
	glTranslatef(-0.0075, -0.01, 0.f);
	scale(0.05);
	DrawDisc();
	glPopMatrix();
}

void DrawHill(bool line)
{
	if(line)
		glBegin(GL_LINE_STRIP);
	else
		glBegin(GL_POLYGON);
	
	for(int i = 0; i < 32; i++)
		glVertex2f(i*0.04, sin(i/10.f));

	if(line)
		glVertex2f(0.f, 0.f);
	glEnd();
}

void DrawTree()
{
	glPushMatrix();

	glColor3ub(0, 255, 0);
	
	glPushMatrix();
	glTranslatef(0.f, 0.75, 0.01f);
	DrawDisc();
	glTranslatef(-0.2, 0.f, 0.01f);
	DrawDisc();
	glTranslatef(0.4, -0.1f, 0.01f);
	DrawDisc();
	glTranslatef(-0.2, 0.4f, 0.01f);
	DrawDisc();
	glPopMatrix();

	glColor3ub(115, 67, 67);
	glScalef(0.25, 1.f, 1.f);
	DrawQuad();
	glPopMatrix();

	glColor3ub(255, 255, 255);
}

void DrawRomashka(float a)
{
	glPushMatrix();
	glRotatef(a, 0.f, 0.f, 1.f);
	glColor3ub(234, 255, 0);
	glPushMatrix();
	glTranslatef(0.f, 0.f, 0.01f);
	scale(0.75);
	DrawDisc();
	glPopMatrix();
	glColor3ub(255, 255, 255);
	glPushMatrix();
	glTranslatef(-0.55, 0.f, 0.f);
	DrawDisc();
	glPopMatrix();
	glPushMatrix();
	glTranslatef(0.55, 0.f, 0.f);
	DrawDisc();
	glPopMatrix();
	glPushMatrix();
	glTranslatef(0.f, -0.55, 0.f);
	DrawDisc();
	glPopMatrix();
	glPushMatrix();
	glTranslatef(0.f, 0.55, 0.f);
	DrawDisc();
	glPopMatrix();
	glPopMatrix();
}

void DawSun()
{
	DrawDisc();

	float k = 360.f / 20;

	glBegin(GL_LINES);
	for(int i = 0; i <= 180; i++)
	{
		glVertex2f(0.5*cos(i*k*torad),0.5*sin(i*k*torad));
		glVertex2f(1.f*cos(i*k*torad),1.f*sin(i*k*torad));
	}
	glEnd();
}

void DrawBird()
{
	glBegin(GL_LINES);
	if(counter % 50 < 25)
	{
		glVertex2f(0.0, 0.3);
		glVertex2f(0.5, 0.0);

		glVertex2f(1.0, 0.3);
		glVertex2f(0.5, 0.0);
	}
	else
	{
		glVertex2f(0.0, 1.0);
		glVertex2f(0.5, 0.0);

		glVertex2f(1.0, 1.0);
		glVertex2f(0.5, 0.0);
	}
	glEnd();
}

void DrawPixel(bool angry)
{
	glPushMatrix();
	glColor3ub(40, 64, 250);
	DrawQuad();
	glColor3ub(0, 0, 0);
	glTranslatef(0.f, 0.f, 0.05);
	DrawQuad(true);

	glPushMatrix();
	glColor3ub(255, 255, 255);
	glTranslatef(0.f, 0.4f, 0.05);
	scale(0.5);
	DrawDisc();
	glColor3ub(0, 0, 0);
	glTranslatef(0.f, 0.f, 0.05);
	DrawDisc(true);
	glTranslatef(-0.1f, -0.2f, 0.05);
	scale(0.3);
	glColor3ub(5, 210, 255);
	DrawDisc();
	glPopMatrix();

	glPushMatrix();
	glColor3ub(255, 255, 255);
	glTranslatef(0.3f, 0.4f, 0.1);
	scale(0.5);
	DrawDisc();
	glColor3ub(0, 0, 0);
	glTranslatef(0.f, 0.f, 0.05);
	DrawDisc(true);
	glTranslatef(0.2f, -0.1f, 0.05);
	scale(0.3);
	glColor3ub(5, 210, 255);
	DrawDisc();
	glPopMatrix();

	glPushMatrix();
	glColor3ub(255, 255, 255);
	glTranslatef(0.2f, -0.2f, 0.05);
	if(angry)
		glScalef(0.5, 0.1, 1.f);
	else
		glScalef(0.5, 0.01, 1.f);
	DrawQuad();
	glColor3ub(0, 0, 0);
	glTranslatef(0.f, 0.f, 0.05);
	DrawQuad(true);
	glPopMatrix();

	glPopMatrix();

	glColor3ub(255, 255, 255);
}

void DrawVoxel()
{
	glBegin(GL_QUADS);
	glColor3f(0.0f,0.5,0.0f);
	glVertex3f( 0.5, 0.5,-0.5);
	glVertex3f(-0.5, 0.5,-0.5);
	glVertex3f(-0.5, 0.5, 0.5);
	glVertex3f( 0.5, 0.5, 0.5);
	glColor3f(0.5,0.5f,0.0f);
	glVertex3f( 0.5,-0.5, 0.5);
	glVertex3f(-0.5,-0.5, 0.5);
	glVertex3f(-0.5,-0.5,-0.5);
	glVertex3f( 0.5,-0.5,-0.5);
	glColor3f(0.5,0.0f,0.0f);
	glVertex3f( 0.5, 0.5, 0.5);
	glVertex3f(-0.5, 0.5, 0.5);
	glVertex3f(-0.5,-0.5, 0.5);
	glVertex3f( 0.5,-0.5, 0.5);
	glColor3f(0.5,0.5,0.0f);
	glVertex3f( 0.5,-0.5,-0.5);
	glVertex3f(-0.5,-0.5,-0.5);
	glVertex3f(-0.5, 0.5,-0.5);
	glVertex3f( 0.5, 0.5,-0.5);
	glColor3f(0.0f,0.0f,0.5);
	glVertex3f(-0.5, 0.5, 0.5);
	glVertex3f(-0.5, 0.5,-0.5);
	glVertex3f(-0.5,-0.5,-0.5);
	glVertex3f(-0.5,-0.5, 0.5);
	glColor3f(0.5,0.0f,0.5);
	glVertex3f( 0.5, 0.5,-0.5);
	glVertex3f( 0.5, 0.5, 0.5);
	glVertex3f( 0.5,-0.5, 0.5);
	glVertex3f( 0.5,-0.5,-0.5);
	glEnd();
	glColor3ub(0, 0 ,0);
	glPushMatrix();
	glTranslatef(0.f, -0.25, 0.1);
	glScalef(0.8, 0.2, 1.f);
	DrawCube();
	glPopMatrix();

	glPushMatrix();
	glTranslatef(0.25f, 0.5, 0.5);
	scale(0.3);
	glColor3ub(255, 255, 255);
	DrawCube();
	glColor3ub(255, 0, 0);
	glTranslatef(-0.2, 0.1f, 0.5);
	scale(0.3);
	DrawCube();
	glPopMatrix();

	glPushMatrix();
	glTranslatef(-0.25f, 0.5, 0.5);
	scale(0.3);
	glColor3ub(255, 255, 255);
	DrawCube();
	glColor3ub(255, 0, 0);
	glTranslatef(0.1f, 0.1f, 0.5);
	scale(0.3);
	DrawCube();
	glPopMatrix();
}

void DrawTexel()
{
	glPushMatrix();
	glColor3ub(250, 5, 220);
	DrawQuad();
	glColor3ub(0, 0, 0);
	glTranslatef(0.f, 0.f, 0.05);
	DrawQuad(true);

	glPushMatrix();
	glColor3ub(255, 255, 255);
	glTranslatef(-0.1, 0.45f, 0.05);
	glScalef(0.5, 0.4, 1.f);
	DrawDisc();
	glColor3ub(0, 0, 0);
	glTranslatef(0.f, 0.f, 0.05);
	DrawDisc(true);
	scale(0.3);
	glColor3ub(5, 250, 168);
	DrawDisc();
	glPopMatrix();

	glPushMatrix();
	glColor3ub(255, 255, 255);
	glTranslatef(-0.4f, 0.45f, 0.1);
	glScalef(0.5, 0.4, 1.f);
	DrawDisc();
	glColor3ub(0, 0, 0);
	glTranslatef(0.f, 0.f, 0.05);
	DrawDisc(true);
	glTranslatef(-0.1f, -0.1f, 0.05);
	scale(0.3);
	glColor3ub(5, 250, 168);
	DrawDisc();
	glPopMatrix();

	glPushMatrix();
	glColor3ub(255, 255, 255);
	glTranslatef(-0.2f, -0.2f, 0.05);
	glScalef(0.5, 0.1, 1.f);
	DrawQuad();
	glColor3ub(255, 5, 66);
	glTranslatef(0.f, 0.f, 0.05);
	DrawQuad(true);
	glPopMatrix();

	glPopMatrix();

	glColor3ub(255, 255, 255);
}

void DrawFlame()
{
	glColor3ub(255, 85, 20);
	glPushMatrix();
	glBegin(GL_TRIANGLES);
	glVertex2f(0.f, 0.5f);
	glVertex2f(-0.5f, 0.35f);
	glVertex2f(0.f, 0.f);

	glVertex2f(0.f, 0.35);
	glVertex2f(-1.0f, 0.0f);
	glVertex2f(0.f, -0.35);

	glVertex2f(0.f, 0.f);
	glVertex2f(-0.5f, -0.35);
	glVertex2f(0.f, -0.5);
	glEnd();
	
	glTranslatef(0.f, 0.f, 0.05);
	glColor3ub(255, 240, 90);
	glBegin(GL_TRIANGLES);
	glVertex2f(0.f, 0.15);
	glVertex2f(-0.4f, 0.0f);
	glVertex2f(0.f, -0.15);
	glEnd();
	glPopMatrix();
}

void DrawPlayer(bool angry, bool shot)
{
	glLineWidth(2.f);

	glColor3ub(158, 158, 158);

	glPushMatrix();
	glScalef(0.4, 1.f, 1.f);
	DrawQuad();
	glTranslatef(0.f, 0.f, 0.05);
	glColor3ub(20, 20, 20);
	DrawQuad(true);
	glPopMatrix();

	glColor3ub(158, 158, 158);
	glPushMatrix();
	glTranslatef(0.5f, -0.2f, 0.f);
	glScalef(1.4f, 0.6, 1.f);
	DrawQuad();
	glTranslatef(0.f, 0.f, 0.05);
	glColor3ub(20, 20, 20);
	DrawQuad(true);
	glPopMatrix();

	glColor3ub(158, 158, 158);
	glPushMatrix();
	glTranslatef(1.2, -0.0062, 0.f);
	glBegin(GL_TRIANGLES);
	glVertex2f(0.f, 0.25);
	glVertex2f(1.f, 0.f);
	glVertex2f(0.f, -0.5);
	glEnd();
	glColor3ub(20, 20, 20);
	glTranslatef(0.f, 0.f, 0.05);
	glBegin(GL_LINES);
	glVertex2f(0.f, 0.25);
	glVertex2f(1.f, 0.f);
	glVertex2f(1.f, 0.f);
	glVertex2f(0.f, -0.5);
	glVertex2f(0.f, -0.5);
	glVertex2f(0.f, 0.25);
	glEnd();
	glPopMatrix();

	glColor3ub(20, 20, 20);
	glPushMatrix();
	glTranslatef(1.65f, -0.35f, 0.05f);
	glScalef(0.8f, 0.1, 1.f);
	DrawQuad();
	glPopMatrix();

	glPushMatrix();
	glColor3ub(255, 5, 66);
	glTranslatef(1.35,0.f,0.05f);
	scale(0.1);
	glBegin(GL_POLYGON);
	glVertex2f(0.5, 0.0);
	glVertex2f(0.0, 0.5);
	glVertex2f(0.0, 1.0);
	glVertex2f(0.25, 1.0);
	glVertex2f(0.5, 0.8);
	glEnd();
	glBegin(GL_POLYGON);
	glVertex2f(0.5, 0.8);
	glVertex2f(0.75, 1.0);
	glVertex2f(1.0, 1.0);
	glVertex2f(1.0, 0.5);
	glVertex2f(0.5, 0.0);
	glEnd();
	glPopMatrix();

	glColor3ub(0, 0, 200);
	glPushMatrix();
	glTranslatef(0.f, -0.2, 0.05);
	glBegin(GL_TRIANGLES);
	glVertex3f(0.f, 0.0, 0.f);
	glVertex3f(1.f, 0.f, 0.f);
	glVertex3f(0.f, -0.25f, 2.f);
	glEnd();
	glColor3ub(0, 0, 0);
	glTranslatef(0.f, 0.f, 0.05);
	glBegin(GL_LINES);
	glVertex3f(0.f, 0.0, 0.f);
	glVertex3f(1.f, 0.f, 0.f);
	glVertex3f(1.f, 0.f, 0.f);
	glVertex3f(0.f, -0.25f, 2.f);
	glVertex3f(0.f, -0.25f, 2.f);
	glVertex3f(0.f, 0.0, 0.f);
	glEnd();
	glPopMatrix();

	glColor3ub(0, 0, 200);
	glPushMatrix();
	glTranslatef(0.f, -0.2, -0.05);
	glBegin(GL_TRIANGLES);
	glVertex3f(0.f, 0.0, 0.f);
	glVertex3f(1.f, 0.f, 0.f);
	glVertex3f(0.f, -0.25f, -2.f);
	glEnd();
	glColor3ub(0, 0, 0);
	glTranslatef(0.f, 0.f, -0.05);
	glBegin(GL_LINES);
	glVertex3f(0.f, 0.0, 0.f);
	glVertex3f(1.f, 0.f, 0.f);
	glVertex3f(1.f, 0.f, 0.f);
	glVertex3f(0.f, -0.25f, -2.f);
	glVertex3f(0.f, -0.25f, -2.f);
	glVertex3f(0.f, 0.0, 0.f);
	glEnd();
	glPopMatrix();

	glColor3ub(20, 20, 20);
	glPushMatrix();
	glTranslatef(-0.6, 0.f, -0.05);
	scale(0.75);
	glBegin(GL_TRIANGLES);
	glVertex2f(0.f, 0.5);
	glVertex2f(1.f, 0.f);
	glVertex2f(0.f, -0.5);
	glEnd();
	glPopMatrix();

	glPushMatrix();
	glTranslatef(-0.6, 0.f, -0.1);
	glScalef(1.f + sin(counter/2.f)*0.5, 0.6 + sin(counter/5.f)*0.1, 1.f);
	DrawFlame();
	glPopMatrix();
	
	if(shot)
	{
		glPushMatrix();
		glTranslatef(2.f, -0.37, 0.f);
		glScalef(-0.2, 0.2, 1.f);
		DrawFlame();
		glPopMatrix();
	}

	glLineWidth(1.f);

	glPushMatrix();
	glTranslatef(0.6f, 0.3 + sin(counter/5.f)*0.02, -0.15);
	scale(0.6);
	DrawPixel(angry);
	glPopMatrix();
}

void DrawMiniVoxel(int color)
{
	switch(color)
	{
	case 0: glColor3ub(128, 128, 128); break;
	case 1: glColor3ub(17, 79, 133); break;
	case 2: glColor3ub(181, 102, 18); break;
	case 3: glColor3ub(171, 46, 61); break;
	}
	DrawCube();

	glColor3ub(0, 0 ,0);
	glPushMatrix();
	glTranslatef(0.f, -0.25, 0.1);
	glScalef(0.8, 0.2, 1.f);
	DrawCube();
	glPopMatrix();

	glPushMatrix();
	glTranslatef(0.25f, 0.5, 0.5);
	scale(0.3);
	glColor3ub(255, 255, 255);
	DrawCube();
	glColor3ub(255, 0, 0);
	glTranslatef(-0.2, 0.1f, 0.5);
	scale(0.3);
	DrawCube();
	glPopMatrix();

	glPushMatrix();
	glTranslatef(-0.25f, 0.5, 0.5);
	scale(0.3);
	glColor3ub(255, 255, 255);
	DrawCube();
	glColor3ub(255, 0, 0);
	glTranslatef(0.1f, 0.1f, 0.5);
	scale(0.3);
	DrawCube();
	glPopMatrix();
}

void DrawEnemyFly(int color, bool pilot)
{
	glScalef(-1.f, -1.f, 1.f);
	glColor3ub(145, 78, 30);
	DrawQuad();

	glColor3ub(128, 0, 128);
	glPushMatrix();
	glTranslatef(0.7, -0.3f, 0.f);
	glScalef(1.f, 0.4, 1.f);
	DrawQuad();
	glPopMatrix();

	glPushMatrix();
	glTranslatef(1.3, 0.f, 0.f);
	glScalef(0.25, 1.f, 1.f);
	DrawQuad();
	glPopMatrix();

	glPushMatrix();
	glTranslatef(-0.5, 0.f, 0.f);
	glScalef(0.25, 2.f, 1.f);
	DrawQuad();
	glPopMatrix();

	glColor3ub(20, 20, 20);
	glPushMatrix();
	glTranslatef(2.f, 0.f, -0.05);
	glScalef(-0.75, 0.75, 1.f);
	glBegin(GL_TRIANGLES);
	glVertex2f(0.f, 0.5);
	glVertex2f(1.f, 0.f);
	glVertex2f(0.f, -0.5);
	glEnd();
	glPopMatrix();

	glPushMatrix();
	glTranslatef(-1.f, -0.6f, -0.05);
	glScalef(-0.75, 0.15, 1.f);
	DrawQuad();
	glPopMatrix();

	glPushMatrix();
	glTranslatef(-1.f, 0.6f, -0.05);
	glScalef(-0.75, 0.15, 1.f);
	DrawQuad();
	glPopMatrix();

	glColor3ub(8, 64, 8);
	glPushMatrix();
	glTranslatef(-0.2f, -0.2, 0.05);
	glBegin(GL_TRIANGLES);
	glVertex3f(0.f, 0.0, 0.f);
	glVertex3f(1.5, 0.f, 0.f);
	glVertex3f(1.5, -0.25f, 2.f);
	glEnd();
	glPopMatrix();

	glPushMatrix();
	glTranslatef(1.9, 0.f, -0.15);
	glScalef(-(1.f + cos(counter/2.f)*0.5), 0.6 + cos(counter/5.f)*0.1, 1.f);
	DrawFlame();
	glPopMatrix();

	if(pilot)
	{
		glPushMatrix();
		glTranslatef(0.85, 0.2 + cos(counter/7.f)*0.1, -0.6f);
		scale(0.7);
		DrawMiniVoxel(color);
		glPopMatrix();
	}

	glColor3f(1.f, 1.f, 1.f);
}

void DrawBoom()
{
	glBegin(GL_TRIANGLES);
	glVertex2f(-0.3, 0.0);
	glVertex2f(0.3, 0.0);
	glVertex2f(0.0, 1.0);

	glVertex2f(-0.3, 0.0);
	glVertex2f(0.3, 0.0);
	glVertex2f(0.2, 0.8);

	glVertex2f(-0.3, 0.0);
	glVertex2f(0.3, 0.0);
	glVertex2f(0.6, 0.5);

	glVertex2f(-0.3, 0.0);
	glVertex2f(0.3, 0.0);
	glVertex2f(0.7, 0.3);

	glVertex2f(-0.3, 0.0);
	glVertex2f(0.3, 0.0);
	glVertex2f(0.6, -0.4);

	glVertex2f(-0.3, 0.0);
	glVertex2f(0.3, 0.0);
	glVertex2f(0.2, -0.8);

	glVertex2f(-0.3, 0.0);
	glVertex2f(0.3, 0.0);
	glVertex2f(-0.2, -0.5);

	glVertex2f(-0.3, 0.3);
	glVertex2f(0.3, 0.0);
	glVertex2f(-0.8, -0.3);

	glVertex2f(-0.3, 0.0);
	glVertex2f(0.3, 0.0);
	glVertex2f(-0.4, 0.9);

	glVertex2f(-0.3, 0.3);
	glVertex2f(0.3, -0.4);
	glVertex2f(-0.9, 0.4);

	glEnd();

}

void DrawCupol()
{
	glColor3ub(255, 255, 255);
	DrawHill();
	glTranslatef(0.f, 0.f, 0.05);
	glLineWidth(3.f);
	glColor3ub(0, 0, 0);
	DrawHill(true);
	glBegin(GL_LINES);
	glVertex2f(0.f, 0.f);
	glVertex2f(0.7, -1.f);
	glVertex2f(1.23,  0.05);
	glVertex2f(0.7, -1.f);
	glEnd();
	glLineWidth(1.f);
	glColor3ub(255, 255, 255);
}

void VoxelShooter(float angle)
{
	glPushMatrix();
	glRotatef(-30.f, 0.f, 1.f, 0.f);
	DrawMiniVoxel(0);
	glPopMatrix();

	glPushMatrix();
	glColor3ub(94, 94, 94);
	glTranslatef(-0.8, 0.007, 0.6);	
	glRotatef(angle, 0.f, 0.f, 1.f);
	glScalef(0.8, 0.25, 0.3);
	DrawCube();
	glPopMatrix();
}

void DrawKater()
{
	glTranslatef(0.6, 0.f, -0.3);
	glColor3ub(40, 40, 40);
	glPushMatrix();
	glTranslatef(1.f, -1.f, 0.f);
	glScalef(5.f, 1.f, 1.f);
	DrawQuad();
	glPopMatrix();
	glPushMatrix();
	glTranslatef(-3.f, -1.5, 0.f);
	scale(1.5f);
	glBegin(GL_TRIANGLES);
	glVertex2f(0.f, 1.f);
	glVertex2f(1.f, 1.f);
	glVertex2f(1.f, 0.f);
	glEnd();
	glPopMatrix();
	glPushMatrix();
	glTranslatef(2.f, 0.f, 0.f);
	scale(1.5f);
	DrawQuad();
	glPopMatrix();
	glColor3ub(255, 255, 255);
	glPushMatrix();
	glTranslatef(2.f, -1.5, 0.f);
	glScalef(7.5f, 0.25, 1.f);
	DrawQuad();
	glPopMatrix();
}

void DrawRoket()
{
	glColor3ub(255, 255, 255);
	glPushMatrix();
	glScalef(0.25, 0.1, 1.f);
	DrawQuad();
	glPopMatrix();
	glColor3ub(255, 0, 0);
	glPushMatrix();
	glTranslatef(0.1, 0.f, 0.f);
	scale(0.15);
	glBegin(GL_TRIANGLES);
	glVertex2f(0.f, 0.5);
	glVertex2f(0.5, 0.f);
	glVertex2f(0.f, -0.5);
	glEnd();
	glPopMatrix();
	
	glColor3ub(20, 20, 20);
	glPushMatrix();
	glTranslatef(-0.18, 0.f, -0.005);
	scale(0.1);
	glBegin(GL_TRIANGLES);
	glVertex2f(0.f, 0.5);
	glVertex2f(1.f, 0.f);
	glVertex2f(0.f, -0.5);
	glEnd();
	glPopMatrix();
/*
	glPushMatrix();
	glTranslatef(-0.18, 0.f, -0.01);
	glScalef(0.12 + sin(counter/2.f)*0.01, 0.06 + sin(counter/5.f)*0.01, 0.1);
	DrawFlame();
	glPopMatrix();
*/
}