Exemple #1
0
int main( int argc, TEXTCHAR **argv )
{
	POPTION_TREE_NODE id_root = NULL;
	pvtSection = VarTextCreate();
	if( argc > 1 )
	{
		if( strcmp( argv[1], WIDE("-s") ) == 0 )
		{
			static TEXTCHAR tmp[256];
			if( argc > 2 )
			{
				SystemPrefix = argv[2];
			}
			else
			{
#ifdef __NO_NETWORK__
				snprintf( tmp, sizeof( tmp ), WIDE("/INI Store/localhost") );
#else
				snprintf( tmp, sizeof( tmp ), WIDE("/INI Store/%s"), GetSystemName() );
#endif
				SystemPrefix = tmp;
			}
			id_root = GetOptionIndex( id_root, WIDE("DEFAULT"), SystemPrefix, NULL );
			if( !id_root )
				return 0;
		}
	}

	{
		LISTFILL lf;
      MemSet( &lf, 0, sizeof( lf ) );
		EnumOptions( id_root, FillList, (uintptr_t)&lf );
	}
	{
		PTEXT pINI = VarTextGet( pvtIni );
		CRYPTOEncryptMemory( GetText( pINI ), GetTextSize( pINI ) );
		if( output )
		{
			fwrite( GetText(pINI), 1, GetTextSize( pINI ), output );
			LineRelease( pINI );
			fclose( output );
			output = NULL;
		}
	}
   return 0;
}
Exemple #2
0
ICCItem *CTopologyNode::GetProperty (const CString &sName)

//	GetProperty
//
//	Get topology node property

	{
	CCodeChain &CC = g_pUniverse->GetCC();

	if (strEquals(sName, PROPERTY_LEVEL))
		return CC.CreateInteger(GetLevel());
	else if (strEquals(sName, PROPERTY_NAME))
		return CC.CreateString(GetSystemName());
	else if (strEquals(sName, PROPERTY_POS))
		{
		//	If no map, then no position

		if (m_pMap == NULL)
			return CC.CreateNil();

		//	Create a list

		ICCItem *pResult = CC.CreateLinkedList();
		if (pResult->IsError())
			return pResult;

		CCLinkedList *pList = (CCLinkedList *)pResult;

		pList->AppendInteger(CC, m_xPos);
		pList->AppendInteger(CC, m_yPos);

		return pResult;
		}
	else
		return CC.CreateNil();
	}
//------------------------------------------------------------------------------------
// покупка-установка систем корабля
//------------------------------------------------------------------------------------
void Workshop_Workshop()
{
	RECT SrcRect, DstRect;


	SetRect(&SrcRect,0,0,256,256);
	SetRect(&DstRect,Setup.iAspectRatioWidth/2-256,0,Setup.iAspectRatioWidth/2-256+512,412);
	vw_DrawTransparent(&DstRect, &SrcRect, vw_FindTextureByName("DATA/MENU/back_spot.tga"), true, 0.35f*MenuContentTransp);



	vw_End2DMode();
	WorkshopDrawShip(WorkshopFighterGame, 1);
	vw_Start2DMode(-1,1);


	SetRect(&SrcRect,0,0,210,600);
	SetRect(&DstRect,Setup.iAspectRatioWidth/2-492,50-10,Setup.iAspectRatioWidth/2-492+210,50+600-10);
	vw_DrawTransparent(&DstRect, &SrcRect, vw_FindTextureByName("DATA/MENU/workshop_panel2.tga"), true, MenuContentTransp);



	// стрелки

	SetRect(&SrcRect,0,0,74,120);
	SetRect(&DstRect,Setup.iAspectRatioWidth/2-461,494,Setup.iAspectRatioWidth/2-461+74,494+120);
	int MouseX, MouseY;
	vw_GetMousePos(&MouseX, &MouseY);
	if  (((DstRect.right-8  >= MouseX)&
		(DstRect.left+8<= MouseX)&
		(DstRect.bottom-10 >= MouseY)&
		(DstRect.top+10<= MouseY))  && !isDialogBoxDrawing())
	{
		if (NeedPlayWorkshopOnButtonSoundX != DstRect.left || NeedPlayWorkshopOnButtonSoundY != DstRect.top)
		{
			Audio_PlaySound2D(1,1.0f);
			NeedPlayWorkshopOnButtonSoundX = DstRect.left;
			NeedPlayWorkshopOnButtonSoundY = DstRect.top;
		}

		CurrentCursorStatus = 1;
		if (vw_GetWindowLBMouse(true))
		{
			Audio_PlaySound2D(2,1.0f);
			CurrentSystemStockNum = GetPrevSystemStockNum();
		}

		vw_DrawTransparent(&DstRect, &SrcRect, vw_FindTextureByName("DATA/MENU/arrows_on.tga"), true, MenuContentTransp);
	}
	else
	{
		if (NeedPlayWorkshopOnButtonSoundX == DstRect.left && NeedPlayWorkshopOnButtonSoundY == DstRect.top)
		{
			NeedPlayWorkshopOnButtonSoundX = 0;
			NeedPlayWorkshopOnButtonSoundY = 0;
		}

		vw_DrawTransparent(&DstRect, &SrcRect, vw_FindTextureByName("DATA/MENU/arrows_off.tga"), true, MenuContentTransp);
	}

	SetRect(&SrcRect,74,0,148,120);
	SetRect(&DstRect,Setup.iAspectRatioWidth/2-461+74,494,Setup.iAspectRatioWidth/2-461+148,494+120);
	if  (((DstRect.right-8  >= MouseX)&
		(DstRect.left+8<= MouseX)&
		(DstRect.bottom-10 >= MouseY)&
		(DstRect.top+10<= MouseY))  && !isDialogBoxDrawing())
	{
		if (NeedPlayWorkshopOnButtonSoundX != DstRect.left || NeedPlayWorkshopOnButtonSoundY != DstRect.top)
		{
			Audio_PlaySound2D(1,1.0f);
			NeedPlayWorkshopOnButtonSoundX = DstRect.left;
			NeedPlayWorkshopOnButtonSoundY = DstRect.top;
		}

		CurrentCursorStatus = 1;
		if (vw_GetWindowLBMouse(true))
		{
			Audio_PlaySound2D(2,1.0f);
			CurrentSystemStockNum = GetNextSystemStockNum();
		}

		vw_DrawTransparent(&DstRect, &SrcRect, vw_FindTextureByName("DATA/MENU/arrows_on.tga"), true, MenuContentTransp);
	}
	else
	{
		if (NeedPlayWorkshopOnButtonSoundX == DstRect.left && NeedPlayWorkshopOnButtonSoundY == DstRect.top)
		{
			NeedPlayWorkshopOnButtonSoundX = 0;
			NeedPlayWorkshopOnButtonSoundY = 0;
		}

		vw_DrawTransparent(&DstRect, &SrcRect, vw_FindTextureByName("DATA/MENU/arrows_off.tga"), true, MenuContentTransp);
	}





	// выводим иконки систем в магазине, по которым тоже можно кликать

	SetRect(&SrcRect,0,0,128,128);
	SetRect(&DstRect,Setup.iAspectRatioWidth/2-436,50+20+5-5,Setup.iAspectRatioWidth/2-338,50+128-20+5+5);
	if (vw_OnRect(&DstRect) && !isDialogBoxDrawing())
	{
		if (NeedPlayWorkshopOnButtonSoundX != DstRect.left || NeedPlayWorkshopOnButtonSoundY != DstRect.top)
		{
			Audio_PlaySound2D(1,1.0f);
			NeedPlayWorkshopOnButtonSoundX = DstRect.left;
			NeedPlayWorkshopOnButtonSoundY = DstRect.top;
		}

		CurrentCursorStatus = 1;
		if (vw_GetWindowLBMouse(true))
		{
			CurrentSystemStockNum = GetPrevSystemStockNum();
			Audio_PlaySound2D(2,1.0f);
		}
		vw_DrawTransparent(&DstRect, &SrcRect, GetSystemIcon(GetPrevSystemStockNum()), true, MenuContentTransp);

		int Size = vw_FontSize(vw_GetText(GetSystemName(GetPrevSystemStockNum())));
		float WScale = 0;
		if (Size > 128)
		{
			Size = 128;
			WScale = -128;
		}
		vw_DrawFont(DstRect.left+(DstRect.right-DstRect.left-Size)/2, DstRect.bottom-20, WScale, 0, 1.0f, 1.0f,1.0f,1.0f, MenuContentTransp, vw_GetText(GetSystemName(GetPrevSystemStockNum())));
	}
	else
	{
		if (NeedPlayWorkshopOnButtonSoundX == DstRect.left && NeedPlayWorkshopOnButtonSoundY == DstRect.top)
		{
			NeedPlayWorkshopOnButtonSoundX = 0;
			NeedPlayWorkshopOnButtonSoundY = 0;
		}

		vw_DrawTransparent(&DstRect, &SrcRect, GetSystemIcon(GetPrevSystemStockNum()), true, 0.35f*MenuContentTransp);

		int Size = vw_FontSize(vw_GetText(GetSystemName(GetPrevSystemStockNum())));
		float WScale = 0;
		if (Size > 128)
		{
			Size = 128;
			WScale = -128;
		}
		vw_DrawFont(DstRect.left+(DstRect.right-DstRect.left-Size)/2, DstRect.bottom-20, WScale, 0, 1.0f, 1.0f,1.0f,1.0f, 0.35f*MenuContentTransp, vw_GetText(GetSystemName(GetPrevSystemStockNum())));
	}



	SetRect(&SrcRect,0,0,128,128);
	SetRect(&DstRect,Setup.iAspectRatioWidth/2-451,55+128+20,Setup.iAspectRatioWidth/2-451+128,55+128+128+20);
	vw_DrawTransparent(&DstRect, &SrcRect, GetSystemIcon(CurrentSystemStockNum), true, MenuContentTransp);
		int Size = vw_FontSize(vw_GetText(GetSystemName(CurrentSystemStockNum)));
		float WScale = 0;
		if (Size > 128)
		{
			Size = 128;
			WScale = -128;
		}
		vw_DrawFont(DstRect.left+(DstRect.right-DstRect.left-Size)/2, DstRect.bottom-20, WScale, 0, 1.0f, 1.0f,1.0f,1.0f, MenuContentTransp, vw_GetText(GetSystemName(CurrentSystemStockNum)));
	if (vw_OnRect(&DstRect) && !isDialogBoxDrawing()) CurrentCursorStatus = 1;




	SetRect(&SrcRect,0,0,128,128);
	SetRect(&DstRect,Setup.iAspectRatioWidth/2-451+20-5,60+20+256+40-5-5,Setup.iAspectRatioWidth/2-451+128-20+5,60-20+128+256+40-5 +5);
	if (vw_OnRect(&DstRect) && !isDialogBoxDrawing())
	{
		if (NeedPlayWorkshopOnButtonSoundX != DstRect.left || NeedPlayWorkshopOnButtonSoundY != DstRect.top)
		{
			Audio_PlaySound2D(1,1.0f);
			NeedPlayWorkshopOnButtonSoundX = DstRect.left;
			NeedPlayWorkshopOnButtonSoundY = DstRect.top;
		}

		CurrentCursorStatus = 1;
		if (vw_GetWindowLBMouse(true))
		{
			Audio_PlaySound2D(2,1.0f);
			CurrentSystemStockNum = GetNextSystemStockNum();
		}
		vw_DrawTransparent(&DstRect, &SrcRect, GetSystemIcon(GetNextSystemStockNum()), true, MenuContentTransp);

		int Size = vw_FontSize(vw_GetText(GetSystemName(GetNextSystemStockNum())));
		float WScale = 0;
		if (Size > 128)
		{
			Size = 128;
			WScale = -128;
		}
		vw_DrawFont(DstRect.left+(DstRect.right-DstRect.left-Size)/2, DstRect.bottom-20, WScale, 0, 1.0f, 1.0f,1.0f,1.0f, MenuContentTransp, vw_GetText(GetSystemName(GetNextSystemStockNum())));
	}
	else
	{
		if (NeedPlayWorkshopOnButtonSoundX == DstRect.left && NeedPlayWorkshopOnButtonSoundY == DstRect.top)
		{
			NeedPlayWorkshopOnButtonSoundX = 0;
			NeedPlayWorkshopOnButtonSoundY = 0;
		}

		vw_DrawTransparent(&DstRect, &SrcRect, GetSystemIcon(GetNextSystemStockNum()), true, 0.35f*MenuContentTransp);

		int Size = vw_FontSize(vw_GetText(GetSystemName(GetNextSystemStockNum())));
		float WScale = 0;
		if (Size > 128)
		{
			Size = 128;
			WScale = -128;
		}
		vw_DrawFont(DstRect.left+(DstRect.right-DstRect.left-Size)/2, DstRect.bottom-20, WScale, 0, 1.0f, 1.0f,1.0f,1.0f, 0.35f*MenuContentTransp, vw_GetText(GetSystemName(GetNextSystemStockNum())));
	}

	vw_DrawFont(Setup.iAspectRatioWidth/2-475, 630, 0, 0, 1.5f, 1.0f,1.0f,1.0f, MenuContentTransp, vw_GetText("7_System_Stock"));













	SetRect(&SrcRect,0,0,210,600);
	SetRect(&DstRect,Setup.iAspectRatioWidth/2+282,50-10,Setup.iAspectRatioWidth/2+492,50+600-10);
	vw_DrawTransparent(&DstRect, &SrcRect, vw_FindTextureByName("DATA/MENU/workshop_panel2+.tga"), true, MenuContentTransp);



	// проверяем, а все ли нормально с энергией... если не нормально, будем моргать и выведем соотв. надпись
	bool NeedMoreEnergy = false;

	if (Setup.Profile[CurrentProfile].PowerSystem != 0)
	{

		float Have = GetShipRechargeEnergy(Setup.Profile[CurrentProfile].PowerSystem);

		float Need = 0.0f;

		// если это не аркадный режим, нужно учитывать двигатель
		if (Setup.Profile[CurrentProfile].SpaceShipControlMode != 1)
			if (Setup.Profile[CurrentProfile].EngineSystem != 0)
				Need += GetShipEngineSystemEnergyUse(Setup.Profile[CurrentProfile].EngineSystem);
		// если есть спец система, ее нужно тоже учитывать
		if (Setup.Profile[CurrentProfile].AdvancedProtectionSystem != 0)
			Need += GetShipProtectionSystemEnergyUse(Setup.Profile[CurrentProfile].AdvancedProtectionSystem);

		// слабый реактор
		if (Need >= Have) NeedMoreEnergy = true;

	}
	else
	{
		// у нас вообще нет реактора... караул!!!
		NeedMoreEnergy = true;
	}

	// выводим информационную надпись + голосовое сообщение
	if (NeedMoreEnergy)
	{
		// запускаем голос...
		if (vw_FindSoundByNum(VoiceNeedMoreEnergy) == 0)
		{
			// уже не играем, нужно запустить опять
			VoiceNeedMoreEnergy = Audio_PlayVoice(6, 1.0f);
		}

		// вывод текста
		int SizeI = (Setup.iAspectRatioWidth-vw_FontSize(vw_GetText("9_14Line1")))/2;
		vw_DrawFont(SizeI, 60, 0, 0, 1.0f, 1.0f,0.0f,0.0f, CurrentAlert3*MenuContentTransp, vw_GetText("9_14Line1"));

		SizeI = (Setup.iAspectRatioWidth-vw_FontSize(vw_GetText("9_14Line2")))/2;
		vw_DrawFont(SizeI, 80, 0, 0, 1.0f, 1.0f,0.0f,0.0f, CurrentAlert3*MenuContentTransp, vw_GetText("9_14Line2"));

		SizeI = (Setup.iAspectRatioWidth-vw_FontSize(vw_GetText("9_14Line3")))/2;
		vw_DrawFont(SizeI, 100, 0, 0, 1.0f, 1.0f,0.0f,0.0f, CurrentAlert3*MenuContentTransp, vw_GetText("9_14Line3"));
	}




	// сбор данных
	float Current = 0.5f;
	int Cost = 0;
	bool CanSell = false;
	bool CanBuy = true;

	// Engine
	SetRect(&DstRect,Setup.iAspectRatioWidth/2+337,70,Setup.iAspectRatioWidth/2+437,70+100);

	if (CurrentSystemStockNum>=1 && CurrentSystemStockNum<=4)
	{
		if (Setup.Profile[CurrentProfile].EngineSystem != 0)
		{
			CanSell = true;
			Cost = GetSystemCost(Setup.Profile[CurrentProfile].EngineSystem);
			if (Cost + Setup.Profile[CurrentProfile].Money < GetSystemCost(CurrentSystemStockNum))
				CanBuy = false;
		}
		else
		{
			if (Setup.Profile[CurrentProfile].Money < GetSystemCost(CurrentSystemStockNum))
				CanBuy = false;
		}
	}


	// Power
	SetRect(&DstRect,Setup.iAspectRatioWidth/2+337,180,Setup.iAspectRatioWidth/2+437,180+100);

	if (CurrentSystemStockNum>=5 && CurrentSystemStockNum<=8)
	{
		if (Setup.Profile[CurrentProfile].PowerSystem != 0)
		{
			CanSell = true;
			Cost = GetSystemCost(Setup.Profile[CurrentProfile].PowerSystem+4);
			if (Cost + Setup.Profile[CurrentProfile].Money < GetSystemCost(CurrentSystemStockNum))
				CanBuy = false;
		}
		else
		{
			if (Setup.Profile[CurrentProfile].Money < GetSystemCost(CurrentSystemStockNum))
				CanBuy = false;
		}
	}

	// Target
	SetRect(&DstRect,Setup.iAspectRatioWidth/2+337,290,Setup.iAspectRatioWidth/2+437,290+100);

	if (CurrentSystemStockNum>=9 && CurrentSystemStockNum<=12)
	{
		if (Setup.Profile[CurrentProfile].TargetingSystem != 0)
		{
			CanSell = true;
			Cost = GetSystemCost(Setup.Profile[CurrentProfile].TargetingSystem+8);
			if (Cost + Setup.Profile[CurrentProfile].Money < GetSystemCost(CurrentSystemStockNum))
				CanBuy = false;
		}
		else
		{
			if (Setup.Profile[CurrentProfile].Money < GetSystemCost(CurrentSystemStockNum))
				CanBuy = false;
		}
	}


	// Mech
	SetRect(&DstRect,Setup.iAspectRatioWidth/2+337,400,Setup.iAspectRatioWidth/2+437,400+100);
	if (CurrentSystemStockNum>=13 && CurrentSystemStockNum<=16)
	{
		if (Setup.Profile[CurrentProfile].TargetingMechanicSystem != 0)
		{
			CanSell = true;
			Cost = GetSystemCost(Setup.Profile[CurrentProfile].TargetingMechanicSystem+12);
			if (Cost + Setup.Profile[CurrentProfile].Money < GetSystemCost(CurrentSystemStockNum))
				CanBuy = false;
		}
		else
		{
			if (Setup.Profile[CurrentProfile].Money < GetSystemCost(CurrentSystemStockNum))
				CanBuy = false;
		}
	}

	// Protect
	SetRect(&DstRect,Setup.iAspectRatioWidth/2+337,510,Setup.iAspectRatioWidth/2+437,510+100);
	if (CurrentSystemStockNum>=17 && CurrentSystemStockNum<=20)
	{
		if (Setup.Profile[CurrentProfile].AdvancedProtectionSystem != 0)
		{
			CanSell = true;
			Cost = GetSystemCost(Setup.Profile[CurrentProfile].AdvancedProtectionSystem+16);
			if (Cost + Setup.Profile[CurrentProfile].Money < GetSystemCost(CurrentSystemStockNum))
				CanBuy = false;
		}
		else
		{
			if (Setup.Profile[CurrentProfile].Money < GetSystemCost(CurrentSystemStockNum))
				CanBuy = false;
		}
	}



	// прорисовка


	// Engine
	SetRect(&SrcRect,0,0,128,128);
	SetRect(&DstRect,Setup.iAspectRatioWidth/2+337,70,Setup.iAspectRatioWidth/2+437,70+100);
	Current = 0.5f;
	float ColorR, ColorG, ColorB;
	ColorR = ColorG = ColorB = 1.0f;

	if (NeedMoreEnergy &&
			Setup.Profile[CurrentProfile].EngineSystem != 0 &&
			Setup.Profile[CurrentProfile].SpaceShipControlMode != 1)
	{
		ColorR = 1.0f; ColorG = 0.0f; ColorB = 0.0f;
	}


	if (CurrentSystemStockNum>=1 && CurrentSystemStockNum<=4)
	{
		if (!NeedMoreEnergy || Setup.Profile[CurrentProfile].EngineSystem == 0 ||
			Setup.Profile[CurrentProfile].SpaceShipControlMode == 1)
		{
			if (CanBuy)
				{ColorR = 0.0f; ColorG = 0.8f; ColorB = 0.0f;}
			else
				{ColorR = 1.0f; ColorG = 0.5f; ColorB = 0.0f;}
		}
		Current = 1.0f;
	}

	if (vw_OnRect(&DstRect) && !isDialogBoxDrawing())
	{
		if (NeedPlayWorkshopOnButtonSoundX != DstRect.left || NeedPlayWorkshopOnButtonSoundY != DstRect.top)
		{
			Audio_PlaySound2D(1,1.0f);
			NeedPlayWorkshopOnButtonSoundX = DstRect.left;
			NeedPlayWorkshopOnButtonSoundY = DstRect.top;
		}

		Current = 1.0f;
		CurrentCursorStatus = 1;
		if (vw_GetWindowLBMouse(true))
		{
			CurrentSystemStockNum = 1;
			Audio_PlaySound2D(2,1.0f);
		}
	}
	else
	{
		if (NeedPlayWorkshopOnButtonSoundX == DstRect.left && NeedPlayWorkshopOnButtonSoundY == DstRect.top)
		{
			NeedPlayWorkshopOnButtonSoundX = 0;
			NeedPlayWorkshopOnButtonSoundY = 0;
		}
	}
	if (Setup.Profile[CurrentProfile].EngineSystem <= 0)
	{
		vw_DrawTransparent(&DstRect, &SrcRect, GetSystemIcon(-4), true, Current*MenuContentTransp);

		int Size = vw_FontSize(vw_GetText("3_empty"));
		float WScale = 0;
		if (Size > 128)
		{
			Size = 128;
			WScale = -128;
		}
		vw_DrawFont(DstRect.left+(DstRect.right-DstRect.left-Size)/2, DstRect.top-4, WScale, 0, 1.0f, ColorR,ColorG,ColorB, Current*MenuContentTransp, vw_GetText("3_empty"));

		Size = vw_FontSize(vw_GetText("4_Spaceship_Engine"));
		WScale = 0;
		if (Size > 128)
		{
			Size = 128;
			WScale = -128;
		}
		vw_DrawFont(DstRect.left+(DstRect.right-DstRect.left-Size)/2, DstRect.bottom-20, WScale, 0, 1.0f, ColorR,ColorG,ColorB, Current*MenuContentTransp, vw_GetText("4_Spaceship_Engine"));
	}
	else
	{
		vw_DrawTransparent(&DstRect, &SrcRect, GetSystemIcon(Setup.Profile[CurrentProfile].EngineSystem), true, Current*MenuContentTransp);

		int Size = vw_FontSize(vw_GetText(GetSystemName(Setup.Profile[CurrentProfile].EngineSystem)));
		float WScale = 0;
		if (Size > 128)
		{
			Size = 128;
			WScale = -128;
		}
		vw_DrawFont(DstRect.left+(DstRect.right-DstRect.left-Size)/2, DstRect.bottom-70, WScale, 0, 1.0f, ColorR,ColorG,ColorB, Current*MenuContentTransp, vw_GetText(GetSystemName(Setup.Profile[CurrentProfile].EngineSystem)));
	}


	// Power
	SetRect(&DstRect,Setup.iAspectRatioWidth/2+337,180,Setup.iAspectRatioWidth/2+437,180+100);
	ColorR = ColorG = ColorB = 1.0f;

	if (NeedMoreEnergy)
	{
		ColorR = 1.0f; ColorG = 0.0f; ColorB = 0.0f;
	}

	Current = 0.5f;
	if (CurrentSystemStockNum>=5 && CurrentSystemStockNum<=8)
	{
		if (!NeedMoreEnergy)
		{
			if (CanBuy)
				{ColorR = 0.0f; ColorG = 0.8f; ColorB = 0.0f;}
			else
				{ColorR = 1.0f; ColorG = 0.5f; ColorB = 0.0f;}
		}
		Current = 1.0f;
	}

	if (vw_OnRect(&DstRect) && !isDialogBoxDrawing())
	{
		if (NeedPlayWorkshopOnButtonSoundX != DstRect.left || NeedPlayWorkshopOnButtonSoundY != DstRect.top)
		{
			Audio_PlaySound2D(1,1.0f);
			NeedPlayWorkshopOnButtonSoundX = DstRect.left;
			NeedPlayWorkshopOnButtonSoundY = DstRect.top;
		}

		Current = 1.0f;
		CurrentCursorStatus = 1;
		if (vw_GetWindowLBMouse(true))
		{
			CurrentSystemStockNum = 5;
			Audio_PlaySound2D(2,1.0f);
		}
	}
	else
	{
		if (NeedPlayWorkshopOnButtonSoundX == DstRect.left && NeedPlayWorkshopOnButtonSoundY == DstRect.top)
		{
			NeedPlayWorkshopOnButtonSoundX = 0;
			NeedPlayWorkshopOnButtonSoundY = 0;
		}
	}

	if (Setup.Profile[CurrentProfile].PowerSystem <= 0)
	{
		vw_DrawTransparent(&DstRect, &SrcRect, GetSystemIcon(-2), true, Current*MenuContentTransp);

		int Size = vw_FontSize(vw_GetText("3_empty"));
		float WScale = 0;
		if (Size > 128)
		{
			Size = 128;
			WScale = -128;
		}
		vw_DrawFont(DstRect.left+(DstRect.right-DstRect.left-Size)/2, DstRect.top-4, WScale, 0, 1.0f, ColorR,ColorG,ColorB, Current*MenuContentTransp, vw_GetText("3_empty"));

		Size = vw_FontSize(vw_GetText("4_Power_Source"));
		WScale = 0;
		if (Size > 128)
		{
			Size = 128;
			WScale = -128;
		}
		vw_DrawFont(DstRect.left+(DstRect.right-DstRect.left-Size)/2, DstRect.bottom-20, WScale, 0, 1.0f, ColorR,ColorG,ColorB, Current*MenuContentTransp, vw_GetText("4_Power_Source"));
	}
	else
	{
		vw_DrawTransparent(&DstRect, &SrcRect, GetSystemIcon(Setup.Profile[CurrentProfile].PowerSystem+4), true, Current*MenuContentTransp);

		int Size = vw_FontSize(vw_GetText(GetSystemName(Setup.Profile[CurrentProfile].PowerSystem+4)));
		float WScale = 0;
		if (Size > 128)
		{
			Size = 128;
			WScale = -128;
		}
		vw_DrawFont(DstRect.left+(DstRect.right-DstRect.left-Size)/2, DstRect.bottom-70, WScale, 0, 1.0f, ColorR,ColorG,ColorB, Current*MenuContentTransp, vw_GetText(GetSystemName(Setup.Profile[CurrentProfile].PowerSystem+4)));
	}



	// Target
	SetRect(&DstRect,Setup.iAspectRatioWidth/2+337,290,Setup.iAspectRatioWidth/2+437,290+100);
	ColorR = ColorG = ColorB = 1.0f;

	Current = 0.5f;
	if (CurrentSystemStockNum>=9 && CurrentSystemStockNum<=12)
	{
		if (CanBuy)
				{ColorR = 0.0f; ColorG = 0.8f; ColorB = 0.0f;}
			else
				{ColorR = 1.0f; ColorG = 0.5f; ColorB = 0.0f;}
		Current = 1.0f;
	}

	if (vw_OnRect(&DstRect) && !isDialogBoxDrawing())
	{
		if (NeedPlayWorkshopOnButtonSoundX != DstRect.left || NeedPlayWorkshopOnButtonSoundY != DstRect.top)
		{
			Audio_PlaySound2D(1,1.0f);
			NeedPlayWorkshopOnButtonSoundX = DstRect.left;
			NeedPlayWorkshopOnButtonSoundY = DstRect.top;
		}

		Current = 1.0f;
		CurrentCursorStatus = 1;
		if (vw_GetWindowLBMouse(true))
		{
			CurrentSystemStockNum = 9;
			Audio_PlaySound2D(2,1.0f);
		}
	}
	else
	{
		if (NeedPlayWorkshopOnButtonSoundX == DstRect.left && NeedPlayWorkshopOnButtonSoundY == DstRect.top)
		{
			NeedPlayWorkshopOnButtonSoundX = 0;
			NeedPlayWorkshopOnButtonSoundY = 0;
		}
	}

	if (Setup.Profile[CurrentProfile].TargetingSystem <= 0)
	{
		vw_DrawTransparent(&DstRect, &SrcRect, GetSystemIcon(-1), true, Current*MenuContentTransp);

		int Size = vw_FontSize(vw_GetText("3_empty"));
		float WScale = 0;
		if (Size > 128)
		{
			Size = 128;
			WScale = -128;
		}
		vw_DrawFont(DstRect.left+(DstRect.right-DstRect.left-Size)/2, DstRect.top-4, WScale, 0, 1.0f, ColorR,ColorG,ColorB, Current*MenuContentTransp, vw_GetText("3_empty"));

		Size = vw_FontSize(vw_GetText("4_Optical_Computer"));
		WScale = 0;
		if (Size > 128)
		{
			Size = 128;
			WScale = -128;
		}
		vw_DrawFont(DstRect.left+(DstRect.right-DstRect.left-Size)/2, DstRect.bottom-20, WScale, 0, 1.0f, ColorR,ColorG,ColorB, Current*MenuContentTransp, vw_GetText("4_Optical_Computer"));
	}
	else
	{
		vw_DrawTransparent(&DstRect, &SrcRect, GetSystemIcon(Setup.Profile[CurrentProfile].TargetingSystem+8), true, Current*MenuContentTransp);

		int Size = vw_FontSize(vw_GetText(GetSystemName(Setup.Profile[CurrentProfile].TargetingSystem+8)));
		float WScale = 0;
		if (Size > 128)
		{
			Size = 128;
			WScale = -128;
		}
		vw_DrawFont(DstRect.left+(DstRect.right-DstRect.left-Size)/2, DstRect.bottom-70, WScale, 0, 1.0f, ColorR,ColorG,ColorB, Current*MenuContentTransp, vw_GetText(GetSystemName(Setup.Profile[CurrentProfile].TargetingSystem+8)));
	}



	// Mech
	SetRect(&DstRect,Setup.iAspectRatioWidth/2+337,400,Setup.iAspectRatioWidth/2+437,400+100);
	ColorR = ColorG = ColorB = 1.0f;

	Current = 0.5f;
	if (CurrentSystemStockNum>=13 && CurrentSystemStockNum<=16)
	{
		if (CanBuy)
			{ColorR = 0.0f; ColorG = 0.8f; ColorB = 0.0f;}
		else
			{ColorR = 1.0f; ColorG = 0.5f; ColorB = 0.0f;}
		Current = 1.0f;
	}

	if (vw_OnRect(&DstRect) && !isDialogBoxDrawing())
	{
		if (NeedPlayWorkshopOnButtonSoundX != DstRect.left || NeedPlayWorkshopOnButtonSoundY != DstRect.top)
		{
			Audio_PlaySound2D(1,1.0f);
			NeedPlayWorkshopOnButtonSoundX = DstRect.left;
			NeedPlayWorkshopOnButtonSoundY = DstRect.top;
		}

		Current = 1.0f;
		CurrentCursorStatus = 1;
		if (vw_GetWindowLBMouse(true))
		{
			Audio_PlaySound2D(2,1.0f);
			CurrentSystemStockNum = 13;
		}
	}
	else
	{
		if (NeedPlayWorkshopOnButtonSoundX == DstRect.left && NeedPlayWorkshopOnButtonSoundY == DstRect.top)
		{
			NeedPlayWorkshopOnButtonSoundX = 0;
			NeedPlayWorkshopOnButtonSoundY = 0;
		}
	}

	if (Setup.Profile[CurrentProfile].TargetingMechanicSystem <= 0)
	{
		vw_DrawTransparent(&DstRect, &SrcRect, GetSystemIcon(-3), true, Current*MenuContentTransp);

		int Size = vw_FontSize(vw_GetText("3_empty"));
		float WScale = 0;
		if (Size > 128)
		{
			Size = 128;
			WScale = -128;
		}
		vw_DrawFont(DstRect.left+(DstRect.right-DstRect.left-Size)/2, DstRect.top-4, WScale, 0, 1.0f, ColorR,ColorG,ColorB, Current*MenuContentTransp, vw_GetText("3_empty"));

		Size = vw_FontSize(vw_GetText("4_Targeting_System"));
		WScale = 0;
		if (Size > 128)
		{
			Size = 128;
			WScale = -128;
		}
		vw_DrawFont(DstRect.left+(DstRect.right-DstRect.left-Size)/2, DstRect.bottom-20, WScale, 0, 1.0f, ColorR,ColorG,ColorB, Current*MenuContentTransp, vw_GetText("4_Targeting_System"));
	}
	else
	{
		vw_DrawTransparent(&DstRect, &SrcRect, GetSystemIcon(Setup.Profile[CurrentProfile].TargetingMechanicSystem+12), true, Current*MenuContentTransp);

		int Size = vw_FontSize(vw_GetText(GetSystemName(Setup.Profile[CurrentProfile].TargetingMechanicSystem+12)));
		float WScale = 0;
		if (Size > 128)
		{
			Size = 128;
			WScale = -128;
		}
		vw_DrawFont(DstRect.left+(DstRect.right-DstRect.left-Size)/2, DstRect.bottom-70, WScale, 0, 1.0f, ColorR,ColorG,ColorB, Current*MenuContentTransp, vw_GetText(GetSystemName(Setup.Profile[CurrentProfile].TargetingMechanicSystem+12)));
	}



	// Protect
	SetRect(&DstRect,Setup.iAspectRatioWidth/2+337,510,Setup.iAspectRatioWidth/2+437,510+100);
	ColorR = ColorG = ColorB = 1.0f;

	if (NeedMoreEnergy && Setup.Profile[CurrentProfile].AdvancedProtectionSystem != 0)
	{
		ColorR = 1.0f; ColorG = 0.0f; ColorB = 0.0f;
	}

	Current = 0.5f;
	if (CurrentSystemStockNum>=17 && CurrentSystemStockNum<=20)
	{
		if (!NeedMoreEnergy || Setup.Profile[CurrentProfile].AdvancedProtectionSystem == 0)
		{
			if (CanBuy)
				{ColorR = 0.0f; ColorG = 0.8f; ColorB = 0.0f;}
			else
				{ColorR = 1.0f; ColorG = 0.5f; ColorB = 0.0f;}
		}
		Current = 1.0f;
	}

	if (vw_OnRect(&DstRect) && !isDialogBoxDrawing())
	{
		if (NeedPlayWorkshopOnButtonSoundX != DstRect.left || NeedPlayWorkshopOnButtonSoundY != DstRect.top)
		{
			Audio_PlaySound2D(1,1.0f);
			NeedPlayWorkshopOnButtonSoundX = DstRect.left;
			NeedPlayWorkshopOnButtonSoundY = DstRect.top;
		}

		Current = 1.0f;
		CurrentCursorStatus = 1;
		if (vw_GetWindowLBMouse(true))
		{
			Audio_PlaySound2D(2,1.0f);
			CurrentSystemStockNum = 17;
		}
	}
	else
	{
		if (NeedPlayWorkshopOnButtonSoundX == DstRect.left && NeedPlayWorkshopOnButtonSoundY == DstRect.top)
		{
			NeedPlayWorkshopOnButtonSoundX = 0;
			NeedPlayWorkshopOnButtonSoundY = 0;
		}
	}

	if (Setup.Profile[CurrentProfile].AdvancedProtectionSystem <= 0)
	{
		vw_DrawTransparent(&DstRect, &SrcRect, GetSystemIcon(0), true, Current*MenuContentTransp);

		int Size = vw_FontSize(vw_GetText("3_empty"));
		float WScale = 0;
		if (Size > 128)
		{
			Size = 128;
			WScale = -128;
		}
		vw_DrawFont(DstRect.left+(DstRect.right-DstRect.left-Size)/2, DstRect.top-4, WScale, 0, 1.0f, ColorR,ColorG,ColorB, Current*MenuContentTransp, vw_GetText("3_empty"));

		Size = vw_FontSize(vw_GetText("4_Advanced_System"));
		WScale = 0;
		if (Size > 128)
		{
			Size = 128;
			WScale = -128;
		}
		vw_DrawFont(DstRect.left+(DstRect.right-DstRect.left-Size)/2, DstRect.bottom-20, WScale, 0, 1.0f, ColorR,ColorG,ColorB, Current*MenuContentTransp, vw_GetText("4_Advanced_System"));

	}
	else
	{
		vw_DrawTransparent(&DstRect, &SrcRect, GetSystemIcon(Setup.Profile[CurrentProfile].AdvancedProtectionSystem+16), true, Current*MenuContentTransp);

		int Size = vw_FontSize(vw_GetText(GetSystemName(Setup.Profile[CurrentProfile].AdvancedProtectionSystem+16)));
		float WScale = 0;
		if (Size > 128)
		{
			Size = 128;
			WScale = -128;
		}
		vw_DrawFont(DstRect.left+(DstRect.right-DstRect.left-Size)/2, DstRect.bottom-70, WScale, 0, 1.0f, ColorR,ColorG,ColorB, Current*MenuContentTransp, vw_GetText(GetSystemName(Setup.Profile[CurrentProfile].AdvancedProtectionSystem+16)));
	}




	vw_DrawFont(Setup.iAspectRatioWidth/2+475-vw_FontSize(vw_GetText("7_Installed_Systems"))*1.5f, 630, 0, 0, 1.5f, 1.0f,1.0f,1.0f, MenuContentTransp, vw_GetText("7_Installed_Systems"));

	// текущая система
	vw_DrawFont(Setup.iAspectRatioWidth/2-250, 430, 0, 0, 1.0f, 1.0f,1.0f,0.0f, MenuContentTransp, vw_GetText("7_Selected_System"));
	vw_DrawFont(Setup.iAspectRatioWidth/2+250-vw_FontSize(vw_GetText("7_Installed_System")), 430, 0, 0, 1.0f, 1.0f,1.0f,0.0f, MenuContentTransp, vw_GetText("7_Installed_System"));

	if (CanBuy)
		vw_DrawFont(Setup.iAspectRatioWidth/2-250, 485, 0, 0, 1.0f, 1.0f,1.0f,1.0f, MenuContentTransp, "%s: %i", vw_GetText("7_Cost"), GetSystemCost(CurrentSystemStockNum));
	else
		vw_DrawFont(Setup.iAspectRatioWidth/2-250, 485, 0, 0, 1.0f, 1.0f,0.5f,0.0f, CurrentAlert3*MenuContentTransp, "%s: %i", vw_GetText("7_Cost"), GetSystemCost(CurrentSystemStockNum));

	vw_DrawFont(Setup.iAspectRatioWidth/2+250-vw_FontSize("%s: %i", vw_GetText("7_Cost"), Cost), 485, 0, 0, 1.0f, 1.0f,1.0f,1.0f, MenuContentTransp, "%s: %i", vw_GetText("7_Cost"), Cost);


	if (DrawButton128_2(Setup.iAspectRatioWidth/2-250,580-55, vw_GetText("1_Info"), MenuContentTransp, false))
	{
		SetCurrentDialogBox(8);
		DialogSystem = CurrentSystemStockNum;
	}

	if (DrawButton128_2(Setup.iAspectRatioWidth/2+250-128,580-55, vw_GetText("1_Info"), MenuContentTransp, !CanSell))
	{
		SetCurrentDialogBox(8);

		NeedMoreEnergyDialog = NeedMoreEnergy;

		if (CurrentSystemStockNum>=1 && CurrentSystemStockNum<=4)
			DialogSystem = Setup.Profile[CurrentProfile].EngineSystem;
		if (CurrentSystemStockNum>=5 && CurrentSystemStockNum<=8)
			DialogSystem = Setup.Profile[CurrentProfile].PowerSystem+4;
		if (CurrentSystemStockNum>=9 && CurrentSystemStockNum<=12)
			DialogSystem = Setup.Profile[CurrentProfile].TargetingSystem+8;
		if (CurrentSystemStockNum>=13 && CurrentSystemStockNum<=16)
			DialogSystem = Setup.Profile[CurrentProfile].TargetingMechanicSystem+12;
		if (CurrentSystemStockNum>=17 && CurrentSystemStockNum<=20)
			DialogSystem = Setup.Profile[CurrentProfile].AdvancedProtectionSystem+16;
	}


	if (DrawButton128_2(Setup.iAspectRatioWidth/2-250,50+580-55, vw_GetText("1_Buy"), MenuContentTransp, !CanBuy))
	{
		BuyCurrentSystem();
	}
	// покупка, если 2 раза кликнули на иконку текущей системы
	SetRect(&DstRect,Setup.iAspectRatioWidth/2-451,55+128+20,Setup.iAspectRatioWidth/2-451+128,55+128+128+20);
	if (vw_OnRect(&DstRect) && !isDialogBoxDrawing() && CanBuy)
		if (vw_GetWindowLBDoubleMouse(true))
			BuyCurrentSystem();



	if (DrawButton128_2(Setup.iAspectRatioWidth/2+250-128,50+580-55, vw_GetText("1_Sell"), MenuContentTransp, !CanSell))
	{
		SellCurrentSystem();
	}


	// вывод информации
	int SizeI = (Setup.iAspectRatioWidth-vw_FontSize("%s: %i", vw_GetText("3_Money"), Setup.Profile[CurrentProfile].Money)*1.25f)/2;
	if (CanBuy)
		vw_DrawFont(SizeI, 630, 0, 0, 1.25f, 1.0f,1.0f,0.0f, MenuContentTransp, "%s: %i", vw_GetText("3_Money"), Setup.Profile[CurrentProfile].Money);
	else
		vw_DrawFont(SizeI, 630, 0, 0, 1.25f, 1.0f,0.5f,0.0f, CurrentAlert3*MenuContentTransp, "%s: %i", vw_GetText("3_Money"), Setup.Profile[CurrentProfile].Money);

}