1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718
|
/************************************************************************************
AstroMenace (Hardcore 3D space shooter with spaceship upgrade possibilities)
Copyright © 2006-2013 Michael Kurinnoy, Viewizard
AstroMenace is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
AstroMenace is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with AstroMenace. If not, see <http://www.gnu.org/licenses/>.
Web Site: http://www.viewizard.com/
Project: http://sourceforge.net/projects/openastromenace/
E-mail: viewizard@viewizard.com
*************************************************************************************/
#include "../Game.h"
extern CEarthSpaceFighter *WorkshopFighterGame;
extern CEarthSpaceFighter *WorkshopNewFighter;
extern int CurrentWorkshopNewFighter;
extern int CurrentWorkshopNewWeapon;
extern float CurrentAlert2;
extern float CurrentAlert3;
void WorkshopDrawShip(CEarthSpaceFighter *SpaceFighter, int Mode);
void WorkshopCreateNewShip();
int GetSystemCost(int Num);
int GetWeaponCost(int Num, int Ammo, int AmmoStart);
int GetWeaponBaseCost(int Num);
// что рисовать в диалоге 6,7,8
extern CSpaceShip *DialogSpaceShip;
//------------------------------------------------------------------------------------
// название корабля
//------------------------------------------------------------------------------------
const char *GetWorkshopShipName(int Num)
{
switch (Num)
{
case 1: return "7_ship1";
case 2: return "7_ship2";
case 3: return "7_ship3";
case 4: return "7_ship4";
case 5: return "7_ship5";
case 6: return "7_ship6";
case 7: return "7_ship7";
case 8: return "7_ship8";
case 9: return "7_ship9";
case 10: return "7_ship10";
case 11: return "7_ship11";
case 12: return "7_ship12";
case 13: return "7_ship13";
case 14: return "7_ship14";
case 15: return "7_ship15";
case 16: return "7_ship16";
case 17: return "7_ship17";
case 18: return "7_ship18";
case 19: return "7_ship19";
case 20: return "7_ship20";
case 21: return "7_ship21";
case 22: return "7_ship22";
default: fprintf(stderr, "Error in GetWorkshopShipName function call, wrong Num.\n"); break;
}
return 0;
}
//------------------------------------------------------------------------------------
// тип корабля
//------------------------------------------------------------------------------------
const char *GetShipGroupTitle(int Num)
{
switch (Num)
{
case 1:
case 4:
case 6:
case 10:
case 12:
case 14:
case 15:
case 17:
case 20:
return "4_Fighter";
case 2:
case 5:
case 19:
return "4_Interceptor";
case 3:
case 16:
case 18:
return "4_Bomber";
case 7:
case 13:
return "4_Attack_Ship";
case 8:
case 9:
case 11:
case 21:
case 22:
return "4_Scout";
default: fprintf(stderr, "Error in GetShipGroupTitle function call, wrong Num.\n"); break;
}
return 0;
}
//------------------------------------------------------------------------------------
// стоимость корпуса
//------------------------------------------------------------------------------------
int GetWorkshopShipCost(int Num)
{
switch (Num)
{
case 1: return 1100;
case 2: return 900;
case 3: return 1500;
case 4: return 1300;
case 5: return 1350;
case 6: return 2400;
case 7: return 3000;
case 8: return 3500;
case 9: return 4000;
case 10: return 6000;
case 11: return 4500;
case 12: return 5000;
case 13: return 9000;
case 14: return 7500;
case 15: return 7000;
case 16: return 9000;
case 17: return 10000;
case 18: return 12000;
case 19: return 5000;
case 20: return 9000;
case 21: return 10000;
case 22: return 8000;
default: fprintf(stderr, "Error in GetWorkshopShipCost function call, wrong Num.\n"); break;
}
return 0;
}
int GetWorkshopShipRepairCost(int Num, CEarthSpaceFighter *Fighter)
{
int ShipCost = GetWorkshopShipCost(Num)*Setup.Profile[CurrentProfile].ShipHullUpgrade;
// расчет стоимости ремонта корабля
return ShipCost - (int)(ShipCost*(Fighter->Strength/Fighter->StrengthStart));
}
int GetWorkshopShipFullCost(int Num, CEarthSpaceFighter *Fighter)
{
// полная стоимость корпуса корабля с повреждениями корабля
int ShipCost = GetWorkshopShipCost(Num)* Setup.Profile[CurrentProfile].ShipHullUpgrade -
GetWorkshopShipRepairCost(Num, Fighter);
// прибавить стоимость оружия
for (int i=0; i<WorkshopFighterGame->WeaponQuantity; i++)
if (WorkshopFighterGame->Weapon[i] != 0)
{
ShipCost += GetWeaponCost(WorkshopFighterGame->Weapon[i]->ObjectCreationType,
WorkshopFighterGame->Weapon[i]->Ammo,
WorkshopFighterGame->Weapon[i]->AmmoStart);
}
// прибавить стоимость систем
if (Setup.Profile[CurrentProfile].EngineSystem != 0)
ShipCost += GetSystemCost(Setup.Profile[CurrentProfile].EngineSystem);
if (Setup.Profile[CurrentProfile].PowerSystem != 0)
ShipCost += GetSystemCost(Setup.Profile[CurrentProfile].PowerSystem+4);
if (Setup.Profile[CurrentProfile].TargetingSystem != 0)
ShipCost += GetSystemCost(Setup.Profile[CurrentProfile].TargetingSystem+8);
if (Setup.Profile[CurrentProfile].TargetingMechanicSystem != 0)
ShipCost += GetSystemCost(Setup.Profile[CurrentProfile].TargetingMechanicSystem+12);
if (Setup.Profile[CurrentProfile].AdvancedProtectionSystem != 0)
ShipCost += GetSystemCost(Setup.Profile[CurrentProfile].AdvancedProtectionSystem+16);
return ShipCost;
}
//------------------------------------------------------------------------------------
// создание корабля игрока при покупке нового корпуса
//------------------------------------------------------------------------------------
void WorkshopCreateBuyShip()
{
// продаем все оружие и все системы
// 1 - Системы
int EngineSystem = Setup.Profile[CurrentProfile].EngineSystem;
if (Setup.Profile[CurrentProfile].EngineSystem != 0)
Setup.Profile[CurrentProfile].Money += GetSystemCost(Setup.Profile[CurrentProfile].EngineSystem);
Setup.Profile[CurrentProfile].EngineSystem = 0;
int PowerSystem = Setup.Profile[CurrentProfile].PowerSystem;
if (Setup.Profile[CurrentProfile].PowerSystem != 0)
Setup.Profile[CurrentProfile].Money += GetSystemCost(Setup.Profile[CurrentProfile].PowerSystem+4);
Setup.Profile[CurrentProfile].PowerSystem = 0;
int TargetingSystem = Setup.Profile[CurrentProfile].TargetingSystem;
if (Setup.Profile[CurrentProfile].TargetingSystem != 0)
Setup.Profile[CurrentProfile].Money += GetSystemCost(Setup.Profile[CurrentProfile].TargetingSystem+8);
Setup.Profile[CurrentProfile].TargetingSystem = 0;
int TargetingMechanicSystem = Setup.Profile[CurrentProfile].TargetingMechanicSystem;
if (Setup.Profile[CurrentProfile].TargetingMechanicSystem != 0)
Setup.Profile[CurrentProfile].Money += GetSystemCost(Setup.Profile[CurrentProfile].TargetingMechanicSystem+12);
Setup.Profile[CurrentProfile].TargetingMechanicSystem = 0;
int AdvancedProtectionSystem = Setup.Profile[CurrentProfile].AdvancedProtectionSystem;
if (Setup.Profile[CurrentProfile].AdvancedProtectionSystem != 0)
Setup.Profile[CurrentProfile].Money += GetSystemCost(Setup.Profile[CurrentProfile].AdvancedProtectionSystem+16);
Setup.Profile[CurrentProfile].AdvancedProtectionSystem = 0;
// 2 - Оружие
int OldWeaponQuantity = WorkshopFighterGame->WeaponQuantity;
for (int i=0; i<WorkshopFighterGame->WeaponQuantity; i++)
if (WorkshopFighterGame->Weapon[i] != 0)
{
Setup.Profile[CurrentProfile].Money += GetWeaponCost(WorkshopFighterGame->Weapon[i]->ObjectCreationType,
WorkshopFighterGame->Weapon[i]->Ammo,
WorkshopFighterGame->Weapon[i]->AmmoStart);
delete WorkshopFighterGame->Weapon[i]; WorkshopFighterGame->Weapon[i] = 0;
}
// 3 - корпус
Setup.Profile[CurrentProfile].Money +=
GetWorkshopShipCost(Setup.Profile[CurrentProfile].Ship)*Setup.Profile[CurrentProfile].ShipHullUpgrade -
GetWorkshopShipRepairCost(Setup.Profile[CurrentProfile].Ship, WorkshopFighterGame);
// сейчас у нас все в "деньгах", покупаем корпус
Setup.Profile[CurrentProfile].Ship = CurrentWorkshopNewFighter;
Setup.Profile[CurrentProfile].Money -= GetWorkshopShipCost(Setup.Profile[CurrentProfile].Ship);
// создаем объект
if (WorkshopFighterGame != 0){delete WorkshopFighterGame; WorkshopFighterGame = 0;}
int TMPGameNPCArmorPenalty = GameNPCArmorPenalty;
GameNPCArmorPenalty = 1;
WorkshopFighterGame = new CEarthSpaceFighter;
WorkshopFighterGame->Create(Setup.Profile[CurrentProfile].Ship);
WorkshopFighterGame->ID = 1000;
WorkshopFighterGame->EngineDestroyType = true;
WorkshopFighterGame->ShowStrength = false;
Setup.Profile[CurrentProfile].ShipHullCurrentStrength = WorkshopFighterGame->Strength;
Setup.Profile[CurrentProfile].ShipHullUpgrade = 1;
// пытаемся купить
// 1 - Системы
if (EngineSystem != 0)
if (Setup.Profile[CurrentProfile].Money >= GetSystemCost(EngineSystem))
{
Setup.Profile[CurrentProfile].Money -= GetSystemCost(EngineSystem);
Setup.Profile[CurrentProfile].EngineSystem = EngineSystem;
}
if (PowerSystem != 0)
if (Setup.Profile[CurrentProfile].Money >= GetSystemCost(PowerSystem+4))
{
Setup.Profile[CurrentProfile].Money -= GetSystemCost(PowerSystem+4);
Setup.Profile[CurrentProfile].PowerSystem = PowerSystem;
}
if (TargetingSystem != 0)
if (Setup.Profile[CurrentProfile].Money >= GetSystemCost(TargetingSystem+8))
{
Setup.Profile[CurrentProfile].Money -= GetSystemCost(TargetingSystem+8);
Setup.Profile[CurrentProfile].TargetingSystem = TargetingSystem;
}
if (TargetingMechanicSystem != 0)
if (Setup.Profile[CurrentProfile].Money >= GetSystemCost(TargetingMechanicSystem+12))
{
Setup.Profile[CurrentProfile].Money -= GetSystemCost(TargetingMechanicSystem+12);
Setup.Profile[CurrentProfile].TargetingMechanicSystem = TargetingMechanicSystem;
}
if (AdvancedProtectionSystem != 0)
if (Setup.Profile[CurrentProfile].Money >= GetSystemCost(AdvancedProtectionSystem+16))
{
Setup.Profile[CurrentProfile].Money -= GetSystemCost(AdvancedProtectionSystem+16);
Setup.Profile[CurrentProfile].AdvancedProtectionSystem = AdvancedProtectionSystem;
}
// покупаем оружие, если можем... нет - ставим что продали его (это сделали ранее)
// всегда покупаем новое, т.е. с полным боекомплектом!
for (int i=0; i<WorkshopFighterGame->WeaponQuantity; i++)
{
if (Setup.Profile[CurrentProfile].Weapon[i] != 0)
{
if (Setup.Profile[CurrentProfile].Money >= GetWeaponBaseCost(Setup.Profile[CurrentProfile].Weapon[i]))
{
if (SetEarthSpaceFighterWeapon(WorkshopFighterGame, i+1, Setup.Profile[CurrentProfile].Weapon[i]))
{
if (WorkshopFighterGame->Weapon[i]->Fire != 0)
if (WorkshopFighterGame->Weapon[i]->Fire->Light != 0){vw_ReleaseLight(WorkshopFighterGame->Weapon[i]->Fire->Light); WorkshopFighterGame->Weapon[i]->Fire->Light = 0;}
Setup.Profile[CurrentProfile].Money -= GetWeaponBaseCost(Setup.Profile[CurrentProfile].Weapon[i]);
Setup.Profile[CurrentProfile].WeaponAmmo[i] = WorkshopFighterGame->Weapon[i]->AmmoStart;
Setup.Profile[CurrentProfile].WeaponSlotYAngle[i] = 0.0f;
}
else
// если поставить не смогли - не такой слот
{
Setup.Profile[CurrentProfile].Weapon[i] = 0;
Setup.Profile[CurrentProfile].WeaponAmmo[i] = 0;
}
}// если не хватило денег снова купить
else
{
Setup.Profile[CurrentProfile].Weapon[i] = 0;
Setup.Profile[CurrentProfile].WeaponAmmo[i] = 0;
}
}
}
// если было больше слотов чем есть сейчас
if (OldWeaponQuantity > WorkshopFighterGame->WeaponQuantity)
for (int i=0; i<OldWeaponQuantity; i++)
if (WorkshopFighterGame->WeaponQuantity <= i) Setup.Profile[CurrentProfile].Weapon[i] = 0;
// создаем системы (визуальные)
SetEarthSpaceFighterEngine(WorkshopFighterGame, Setup.Profile[CurrentProfile].EngineSystem);
if (Setup.Profile[CurrentProfile].AdvancedProtectionSystem == 2)
SetEarthSpaceFighterArmour(WorkshopFighterGame, 7);
else
SetEarthSpaceFighterArmour(WorkshopFighterGame, Setup.Profile[CurrentProfile].ShipHullUpgrade-1);
GameNPCArmorPenalty = TMPGameNPCArmorPenalty;
WorkshopFighterGame->SetLocation(VECTOR3D(1000,-1000-(WorkshopFighterGame->Height/2.0f + WorkshopFighterGame->AABB[6].y), -(WorkshopFighterGame->Length/2.0f + WorkshopFighterGame->AABB[6].z)));
// чтобы оружие заняло свое место...
WorkshopFighterGame->Update(vw_GetTime());
WorkshopFighterGame->SetRotation(VECTOR3D(0.0f,150.0f,0.0f));
}
void BuyShip()
{
// сбрасываем особенные настройки слотов оружия
for (int i=0; i<WorkshopFighterGame->WeaponQuantity; i++)
{
Setup.Profile[CurrentProfile].WeaponSlotYAngle[i] = 0;
}
// создаем новый корабль
WorkshopCreateBuyShip();
// переводим на другой корабль
CurrentWorkshopNewFighter ++;
if (CurrentWorkshopNewFighter == Setup.Profile[CurrentProfile].Ship) CurrentWorkshopNewFighter ++;
if (CurrentWorkshopNewFighter > 22) CurrentWorkshopNewFighter = 1;
// если это 1-й, переводим на 2-й
if (CurrentWorkshopNewFighter == Setup.Profile[CurrentProfile].Ship) CurrentWorkshopNewFighter ++;
WorkshopCreateNewShip();
}
void RepairShip()
{
// смотрим, если денег достаточно для полного ремонта - делаем его
if (Setup.Profile[CurrentProfile].Money >= GetWorkshopShipRepairCost(Setup.Profile[CurrentProfile].Ship, WorkshopFighterGame))
{
Setup.Profile[CurrentProfile].Money -= GetWorkshopShipRepairCost(Setup.Profile[CurrentProfile].Ship, WorkshopFighterGame);
Setup.Profile[CurrentProfile].ShipHullCurrentStrength = WorkshopFighterGame->StrengthStart;
WorkshopFighterGame->Strength = Setup.Profile[CurrentProfile].ShipHullCurrentStrength;
return;
}
// вычисляем, сколько можем отремонтировать
float StrengtRepair = WorkshopFighterGame->StrengthStart - WorkshopFighterGame->Strength;
float MoneyRepair = 1.0f*GetWorkshopShipRepairCost(Setup.Profile[CurrentProfile].Ship, WorkshopFighterGame);
// сколько можем отремонтировать
float CanRepair = StrengtRepair * (Setup.Profile[CurrentProfile].Money/MoneyRepair);
// ремонтируем сколько можем
WorkshopFighterGame->Strength += CanRepair;
Setup.Profile[CurrentProfile].ShipHullCurrentStrength = WorkshopFighterGame->Strength;
// это будет стоить все имеющиеся деньги
Setup.Profile[CurrentProfile].Money = 0;
// выводим диалог с надписью, что не достаточно денег для полного ремонта
SetCurrentDialogBox(3);
}
void UpgradeShip()
{
// ув. данные о базовой прочности корабля
float OldStr = WorkshopFighterGame->StrengthStart;
WorkshopFighterGame->StrengthStart /= Setup.Profile[CurrentProfile].ShipHullUpgrade;
// ув. данные о номере апгрейда
Setup.Profile[CurrentProfile].ShipHullUpgrade ++;
WorkshopFighterGame->StrengthStart *= Setup.Profile[CurrentProfile].ShipHullUpgrade;
WorkshopFighterGame->Strength = WorkshopFighterGame->StrengthStart - OldStr +
Setup.Profile[CurrentProfile].ShipHullCurrentStrength;
Setup.Profile[CurrentProfile].ShipHullCurrentStrength = WorkshopFighterGame->Strength;
// вычитаем деньги за апгрейд
Setup.Profile[CurrentProfile].Money -= GetWorkshopShipCost(Setup.Profile[CurrentProfile].Ship);
// сообщаем о новых возможностях и т.п. которые дает этот апгрейд
SetEarthSpaceFighterArmour(WorkshopFighterGame, Setup.Profile[CurrentProfile].ShipHullUpgrade-1);
}
//------------------------------------------------------------------------------------
// покупка-апгрейд корпуса
//------------------------------------------------------------------------------------
void Workshop_Shipyard()
{
// затемнение при выводе
int SizeI;
RECT SrcRect, DstRect;
// затемнение
SetRect(&SrcRect,0,0,256,256 );
SetRect(&DstRect,Setup.iAspectRatioWidth/2-480,100-32,Setup.iAspectRatioWidth/2-32,450+32);
vw_DrawTransparent(&DstRect, &SrcRect, vw_FindTextureByName("DATA/MENU/back_spot2.tga"), true, 0.45f*MenuContentTransp);
SetRect(&DstRect,Setup.iAspectRatioWidth/2+32,100-32,Setup.iAspectRatioWidth/2+480,450+32);
vw_DrawTransparent(&DstRect, &SrcRect, vw_FindTextureByName("DATA/MENU/back_spot2.tga"), true, 0.45f*MenuContentTransp);
vw_End2DMode();
WorkshopDrawShip(WorkshopFighterGame, 3);
WorkshopDrawShip(WorkshopNewFighter, 2);
vw_Start2DMode(-1,1);
// условия, при которых корабль купить можно
bool CanBuy = false;
if (GetWorkshopShipFullCost(Setup.Profile[CurrentProfile].Ship, WorkshopFighterGame) +
Setup.Profile[CurrentProfile].Money >= GetWorkshopShipCost(CurrentWorkshopNewFighter))
CanBuy = true;
// на новом корабле
vw_SetFontSize(24);
vw_SetFontOffsetY(2);
vw_DrawFont(Setup.iAspectRatioWidth/2-445, 600, 0, 0, 1.0f, 1.0f,1.0f,1.0f, MenuContentTransp, vw_GetText("7_Ships_Stock"));
vw_SetFontSize(Setup.FontSize);
vw_SetFontOffsetY(8 - ceil(Setup.FontSize/2.0f) + 2);
// вывод названия корабля
vw_DrawFont(Setup.iAspectRatioWidth/2-448, 50+6, 0, 0, 1.0f, 1.0f,1.0f,0.0f, MenuContentTransp, vw_GetText("7_shipfullname"), vw_GetText(GetWorkshopShipName(CurrentWorkshopNewFighter)), 1);
if (DrawButton128_2(Setup.iAspectRatioWidth/2-197,50, vw_GetText("1_Info"), MenuContentTransp, false))
{
SetCurrentDialogBox(6);
DialogSpaceShip = WorkshopNewFighter;
}
// находим смещение, чтобы было красиво
int SmSizeI = vw_FontSize(vw_GetText("4_Armor:"));
int SmSizeI2 = vw_FontSize(vw_GetText("4_Weapons"));
if (SmSizeI < SmSizeI2) SmSizeI = SmSizeI2;
vw_DrawFont(Setup.iAspectRatioWidth/2-78-40-SmSizeI, 110, 0, 0, 1.0f, 1.0f,1.0f,1.0f, 0.5f*MenuContentTransp, vw_GetText("4_Armor:"));
vw_DrawFont(Setup.iAspectRatioWidth/2-78-vw_FontSize("%i", (int)WorkshopNewFighter->StrengthStart), 110, 0, 0, 1.0f, 1.0f,1.0f,1.0f, 0.5f*MenuContentTransp, "%i", (int)WorkshopNewFighter->StrengthStart);
vw_DrawFont(Setup.iAspectRatioWidth/2-78-40-SmSizeI, 130, 0, 0, 1.0f, 1.0f,1.0f,1.0f, 0.5f*MenuContentTransp, "%s:", vw_GetText("4_Weapons"));
vw_DrawFont(Setup.iAspectRatioWidth/2-78-vw_FontSize("%i", WorkshopNewFighter->WeaponQuantity), 130, 0, 0, 1.0f, 1.0f,1.0f,1.0f, 0.5f*MenuContentTransp, "%i", WorkshopNewFighter->WeaponQuantity);
// вывод стоимости корабля
if (CanBuy)
vw_DrawFont(Setup.iAspectRatioWidth/2-438, 420, 0, 0, 1.0f, 1.0f,1.0f,1.0f, MenuContentTransp, "%s: %i", vw_GetText("7_Ship_Hull_Cost"), GetWorkshopShipCost(CurrentWorkshopNewFighter));
else
vw_DrawFont(Setup.iAspectRatioWidth/2-438, 420, 0, 0, 1.0f, 1.0f,0.5f,0.0f, CurrentAlert3*MenuContentTransp, "%s: %i", vw_GetText("7_Ship_Hull_Cost"), GetWorkshopShipCost(CurrentWorkshopNewFighter));
// рамки
SetRect(&SrcRect,0,0,400,35 );
SetRect(&DstRect,Setup.iAspectRatioWidth/2-457,100-11,Setup.iAspectRatioWidth/2-57,100+35-11);
vw_DrawTransparent(&DstRect, &SrcRect, vw_FindTextureByName("DATA/MENU/workshop_panel4.tga"), true, MenuContentTransp);
SetRect(&SrcRect,0,0,400,173 );
SetRect(&DstRect,Setup.iAspectRatioWidth/2-457,450-13,Setup.iAspectRatioWidth/2-57,450+173-13);
vw_DrawTransparent(&DstRect, &SrcRect, vw_FindTextureByName("DATA/MENU/workshop_panel1.tga"), true, MenuContentTransp);
// проверяем колесо мышки
SetRect(&DstRect,Setup.iAspectRatioWidth/2-457,100+35-11,Setup.iAspectRatioWidth/2-57,450-13);
if (vw_OnRect(&DstRect))
{
if (vw_GetWheelStatus() != 0 && !isDialogBoxDrawing())
{
CurrentWorkshopNewFighter += vw_GetWheelStatus();
if (CurrentWorkshopNewFighter < 1) CurrentWorkshopNewFighter = 22;
if (CurrentWorkshopNewFighter > 22) CurrentWorkshopNewFighter = 1;
WorkshopCreateNewShip();
vw_ResetWheelStatus();
}
}
else if (vw_GetWheelStatus() != 0)
{
vw_ResetWheelStatus();
}
if (DrawButton128_2(Setup.iAspectRatioWidth/2-395,482, vw_GetText("1_Prev"), MenuContentTransp, false))
{
CurrentWorkshopNewFighter --;
if (CurrentWorkshopNewFighter < 1) CurrentWorkshopNewFighter = 22;
WorkshopCreateNewShip();
}
if (DrawButton128_2(Setup.iAspectRatioWidth/2-247,482, vw_GetText("1_Next"), MenuContentTransp, false))
{
CurrentWorkshopNewFighter ++;
if (CurrentWorkshopNewFighter > 22) CurrentWorkshopNewFighter = 1;
WorkshopCreateNewShip();
}
if (DrawButton200_2(Setup.iAspectRatioWidth/2-357,533, vw_GetText("1_Buy_Ship"), MenuContentTransp, !CanBuy))
{
BuyShip();
}
// на корабле игрока
vw_SetFontSize(24);
vw_SetFontOffsetY(2);
vw_DrawFont(Setup.iAspectRatioWidth/2+445-vw_FontSize(vw_GetText("7_Player_Ship")), 600, 0, 0, 1.0f, 1.0f,1.0f,1.0f, MenuContentTransp, vw_GetText("7_Player_Ship"));
vw_SetFontSize(Setup.FontSize);
vw_SetFontOffsetY(8 - ceil(Setup.FontSize/2.0f) + 2);
// вывод названия корабля
vw_DrawFont(Setup.iAspectRatioWidth/2+64, 56, 0, 0, 1.0f, 1.0f,1.0f,0.0f, MenuContentTransp, vw_GetText("7_shipfullname"), vw_GetText(GetWorkshopShipName(Setup.Profile[CurrentProfile].Ship)), Setup.Profile[CurrentProfile].ShipHullUpgrade);
if (DrawButton128_2(Setup.iAspectRatioWidth/2+315, 50, vw_GetText("1_Info"), MenuContentTransp, false))
{
SetCurrentDialogBox(6);
DialogSpaceShip = WorkshopFighterGame;
}
int LinePos = 420;
// вывод стомости модернизации
// модернизация корпуса
bool CanUpgrade = false;
if (Setup.Profile[CurrentProfile].ShipHullUpgrade<4) CanUpgrade = true;
if (CanUpgrade)
{
if (Setup.Profile[CurrentProfile].Money < GetWorkshopShipCost(Setup.Profile[CurrentProfile].Ship)) CanUpgrade = false;
if (CanUpgrade)
vw_DrawFont(Setup.iAspectRatioWidth/2+438-vw_FontSize("%s: %i", vw_GetText("7_Upgrade_Hull_Cost"), GetWorkshopShipCost(Setup.Profile[CurrentProfile].Ship)), LinePos, 0, 0, 1.0f, 1.0f,1.0f,1.0f, MenuContentTransp, "%s: %i", vw_GetText("7_Upgrade_Hull_Cost"), GetWorkshopShipCost(Setup.Profile[CurrentProfile].Ship));
else
vw_DrawFont(Setup.iAspectRatioWidth/2+438-vw_FontSize("%s: %i", vw_GetText("7_Upgrade_Hull_Cost"), GetWorkshopShipCost(Setup.Profile[CurrentProfile].Ship)), LinePos, 0, 0, 1.0f, 1.0f,0.5f,0.0f, CurrentAlert3*MenuContentTransp, "%s: %i", vw_GetText("7_Upgrade_Hull_Cost"), GetWorkshopShipCost(Setup.Profile[CurrentProfile].Ship));
LinePos -= 20;
}
// вывод стомости ремонта, если нужно
bool NeedRepair = false;
if (GetWorkshopShipRepairCost(Setup.Profile[CurrentProfile].Ship, WorkshopFighterGame) > 0)
{
SizeI = vw_FontSize("%s: %i", vw_GetText("7_Repair_Hull_Cost"), GetWorkshopShipRepairCost(Setup.Profile[CurrentProfile].Ship, WorkshopFighterGame));
vw_DrawFont(Setup.iAspectRatioWidth/2+438-SizeI, LinePos, 0, 0, 1.0f, 1.0f,0.0f,0.0f, CurrentAlert3*MenuContentTransp, "%s: %i", vw_GetText("7_Repair_Hull_Cost"), GetWorkshopShipRepairCost(Setup.Profile[CurrentProfile].Ship, WorkshopFighterGame));
LinePos -= 20;
NeedRepair = true;
// надпись Armor, красная
vw_DrawFont(Setup.iAspectRatioWidth/2+74, 110, 0, 0, 1.0f, 1.0f,1.0f,1.0f, 0.5f*MenuContentTransp, vw_GetText("4_Armor:"));
SizeI = vw_FontSize("%i/%i", (int)WorkshopFighterGame->Strength, (int)WorkshopFighterGame->StrengthStart);
vw_DrawFont(Setup.iAspectRatioWidth/2+74+14+SmSizeI, 110, 0, 0, 1.0f, 1.0f,0.0f,0.0f, CurrentAlert3*MenuContentTransp, "%i/%i", (int)WorkshopFighterGame->Strength, (int)WorkshopFighterGame->StrengthStart);
}
else
{ // надпись Armor, нормальная
vw_DrawFont(Setup.iAspectRatioWidth/2+74, 110, 0, 0, 1.0f, 1.0f,1.0f,1.0f, 0.5f*MenuContentTransp, vw_GetText("4_Armor:"));
SizeI = vw_FontSize("%i/%i", (int)WorkshopFighterGame->Strength, (int)WorkshopFighterGame->StrengthStart);
vw_DrawFont(Setup.iAspectRatioWidth/2+74+14+SmSizeI, 110, 0, 0,1.0f, 1.0f,1.0f,1.0f, 0.5f*MenuContentTransp, "%i/%i", (int)WorkshopFighterGame->Strength, (int)WorkshopFighterGame->StrengthStart);
}
SizeI = SizeI - vw_FontSize("%i", WorkshopFighterGame->WeaponQuantity);
vw_DrawFont(Setup.iAspectRatioWidth/2+74, 130, 0, 0, 1.0f, 1.0f,1.0f,1.0f, 0.5f*MenuContentTransp, "%s:", vw_GetText("4_Weapons"));
vw_DrawFont(Setup.iAspectRatioWidth/2+74+14+SmSizeI+SizeI, 130, 0, 0, 1.0f, 1.0f,1.0f,1.0f, 0.5f*MenuContentTransp, "%i", WorkshopFighterGame->WeaponQuantity);
// вывод стоимости корабля (со всеми системами)
SizeI = vw_FontSize("%s: %i", vw_GetText("7_Ship_Cost"), GetWorkshopShipFullCost(Setup.Profile[CurrentProfile].Ship, WorkshopFighterGame));
vw_DrawFont(Setup.iAspectRatioWidth/2+438-SizeI, LinePos, 0, 0, 1.0f, 1.0f,1.0f,1.0f, MenuContentTransp, "%s: %i", vw_GetText("7_Ship_Cost"), GetWorkshopShipFullCost(Setup.Profile[CurrentProfile].Ship, WorkshopFighterGame));
// рамки
SetRect(&SrcRect,0,0,400,35 );
SetRect(&DstRect,Setup.iAspectRatioWidth/2+57,100-11,Setup.iAspectRatioWidth/2+457,100+35-11);
vw_DrawTransparent(&DstRect, &SrcRect, vw_FindTextureByName("DATA/MENU/workshop_panel4.tga"), true, MenuContentTransp);
SetRect(&SrcRect,0,0,400,173 );
SetRect(&DstRect,Setup.iAspectRatioWidth/2+57,450-13,Setup.iAspectRatioWidth/2+457,450+173-13);
vw_DrawTransparent(&DstRect, &SrcRect, vw_FindTextureByName("DATA/MENU/workshop_panel1+.tga"), true, MenuContentTransp);
if (DrawButton200_2(Setup.iAspectRatioWidth/2+153, 482, vw_GetText("1_Repair_Hull"), MenuContentTransp, !NeedRepair))
{
RepairShip();
}
if (DrawButton200_2(Setup.iAspectRatioWidth/2+153, 533, vw_GetText("1_Upgrade_Hull"), MenuContentTransp, !CanUpgrade))
{
UpgradeShip();
}
// вывод информации
vw_SetFontSize(20);
vw_SetFontOffsetY(2);
SizeI = (Setup.iAspectRatioWidth-vw_FontSize("%s: %i", vw_GetText("3_Money"), Setup.Profile[CurrentProfile].Money))/2;
if (CanBuy)
vw_DrawFont(SizeI, 630, 0, 0, 1.0f, 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.0f, 1.0f,0.5f,0.0f, CurrentAlert3*MenuContentTransp, "%s: %i", vw_GetText("3_Money"), Setup.Profile[CurrentProfile].Money);
vw_SetFontSize(Setup.FontSize);
vw_SetFontOffsetY(8 - ceil(Setup.FontSize/2.0f) + 2);
}
|