/AstroMenaceSourceCode/AstroMenaceSource/Menu/Menu_Difficulty.cpp

# · C++ · 236 lines · 147 code · 57 blank · 32 comment · 39 complexity · 8699a997d8300a85f33cd6f5c6becbfb MD5 · raw file

  1. /******************************************************************************
  2. This source file is part of AstroMenace game
  3. (Hardcore 3D space shooter with spaceship upgrade possibilities.)
  4. For the latest info, see http://www.viewizard.com/
  5. File name: Menu_Difficulty.cpp
  6. Copyright (c) 2006-2007 Michael Kurinnoy, Viewizard
  7. All Rights Reserved.
  8. File Version: 1.2
  9. ******************************************************************************
  10. AstroMenace game source code available under "dual licensing" model.
  11. The licensing options available are:
  12. * Commercial Licensing. This is the appropriate option if you are
  13. creating proprietary applications and you are not prepared to
  14. distribute and share the source code of your application.
  15. Contact us for pricing at viewizard@viewizard.com
  16. * Open Source Licensing. This is the appropriate option if you want
  17. to share the source code of your application with everyone you
  18. distribute it to, and you also want to give them the right to share
  19. who uses it. You should have received a copy of the GNU General Public
  20. License version 3 with this source codes.
  21. If not, see <http://www.gnu.org/licenses/>.
  22. ******************************************************************************/
  23. #include "../Game.h"
  24. char *OnOff[2] =
  25. {"1_On",
  26. "1_Off"};
  27. char *ArcadeSim[2] =
  28. {"1_Sim",
  29. "1_Arcade"};
  30. void DifficultyMenu()
  31. {
  32. RECT SrcRest, DstRest;
  33. SetRect(&SrcRest,2,2,863-2,484-2);
  34. SetRect(&DstRest,Setup.iAspectRatioWidth/2-427,175-15,Setup.iAspectRatioWidth/2-427+863-4,175-15+484-4);
  35. vw_DrawTransparent(&DstRest, &SrcRest, vw_FindTextureByName("DATA/MENU/panel800_444_back.tga"), true, 0.9f*MenuContentTransp);
  36. int X1 = Setup.iAspectRatioWidth/2 - 372;
  37. int Y1 = 217;
  38. int Prir1 = 50;
  39. int Size;
  40. int SizeI;
  41. DrawFont(X1, Y1, 0, 0, 0, MenuContentTransp, GetText("3_Enemy_Weapon_Penalty"));
  42. bool ButOff = false;
  43. if (Setup.Profile[CurrentProfile].NPCWeaponPenalty == 1) ButOff = true;
  44. if (DrawButton128_2(X1+360, Y1-6, GetText("1_Decrease"), MenuContentTransp, ButOff))
  45. {
  46. Setup.Profile[CurrentProfile].NPCWeaponPenalty--;
  47. if (Setup.Profile[CurrentProfile].NPCWeaponPenalty < 1) Setup.Profile[CurrentProfile].NPCWeaponPenalty = 1;
  48. }
  49. ButOff = false;
  50. if (Setup.Profile[CurrentProfile].NPCWeaponPenalty == 3) ButOff = true;
  51. if (DrawButton128_2(X1+616, Y1-6, GetText("1_Increase"), MenuContentTransp, ButOff))
  52. {
  53. Setup.Profile[CurrentProfile].NPCWeaponPenalty++;
  54. if (Setup.Profile[CurrentProfile].NPCWeaponPenalty > 3) Setup.Profile[CurrentProfile].NPCWeaponPenalty = 3;
  55. }
  56. if (Setup.Profile[CurrentProfile].NPCWeaponPenalty == 1)
  57. {
  58. Size = FontSize(GetText("3_None"));
  59. SizeI = (110-Size)/2;
  60. DrawFont(X1+498+SizeI, Y1, 0, 0, 0, MenuContentTransp, GetText("3_None"));
  61. }
  62. else
  63. {
  64. Size = FontSize("x%i", Setup.Profile[CurrentProfile].NPCWeaponPenalty);
  65. SizeI = (110-Size)/2;
  66. DrawFont(X1+498+SizeI, Y1, 0, 0, 0, MenuContentTransp, "x%i", Setup.Profile[CurrentProfile].NPCWeaponPenalty);
  67. }
  68. Y1 += Prir1;
  69. DrawFont(X1, Y1, 0, 0, 0, MenuContentTransp, GetText("3_Enemy_Armor_Penalty"));
  70. ButOff = false;
  71. if (Setup.Profile[CurrentProfile].NPCArmorPenalty == 1) ButOff = true;
  72. if (DrawButton128_2(X1+360, Y1-6, GetText("1_Decrease"), MenuContentTransp, ButOff))
  73. {
  74. Setup.Profile[CurrentProfile].NPCArmorPenalty--;
  75. if (Setup.Profile[CurrentProfile].NPCArmorPenalty < 1) Setup.Profile[CurrentProfile].NPCArmorPenalty = 1;
  76. }
  77. ButOff = false;
  78. if (Setup.Profile[CurrentProfile].NPCArmorPenalty == 4) ButOff = true;
  79. if (DrawButton128_2(X1+616, Y1-6, GetText("1_Increase"), MenuContentTransp, ButOff))
  80. {
  81. Setup.Profile[CurrentProfile].NPCArmorPenalty++;
  82. if (Setup.Profile[CurrentProfile].NPCArmorPenalty > 4) Setup.Profile[CurrentProfile].NPCArmorPenalty = 4;
  83. }
  84. if (Setup.Profile[CurrentProfile].NPCArmorPenalty == 1)
  85. {
  86. Size = FontSize(GetText("3_None"));
  87. SizeI = (110-Size)/2;
  88. DrawFont(X1+498+SizeI, Y1, 0, 0, 0, MenuContentTransp, GetText("3_None"));
  89. }
  90. else
  91. {
  92. Size = FontSize("x%i", Setup.Profile[CurrentProfile].NPCArmorPenalty);
  93. SizeI = (110-Size)/2;
  94. DrawFont(X1+498+SizeI, Y1, 0, 0, 0, MenuContentTransp, "x%i", Setup.Profile[CurrentProfile].NPCArmorPenalty);
  95. }
  96. Y1 += Prir1;
  97. DrawFont(X1, Y1, 0, 0, 0, MenuContentTransp, GetText("3_Enemy_Targeting_Penalty"));
  98. ButOff = false;
  99. if (Setup.Profile[CurrentProfile].NPCTargetingSpeedPenalty == 1) ButOff = true;
  100. if (DrawButton128_2(X1+360, Y1-6, GetText("1_Decrease"), MenuContentTransp, ButOff))
  101. {
  102. Setup.Profile[CurrentProfile].NPCTargetingSpeedPenalty--;
  103. if (Setup.Profile[CurrentProfile].NPCTargetingSpeedPenalty < 1) Setup.Profile[CurrentProfile].NPCTargetingSpeedPenalty = 1;
  104. }
  105. ButOff = false;
  106. if (Setup.Profile[CurrentProfile].NPCTargetingSpeedPenalty == 4) ButOff = true;
  107. if (DrawButton128_2(X1+616, Y1-6, GetText("1_Increase"), MenuContentTransp, ButOff))
  108. {
  109. Setup.Profile[CurrentProfile].NPCTargetingSpeedPenalty++;
  110. if (Setup.Profile[CurrentProfile].NPCTargetingSpeedPenalty > 4) Setup.Profile[CurrentProfile].NPCTargetingSpeedPenalty = 4;
  111. }
  112. if (Setup.Profile[CurrentProfile].NPCTargetingSpeedPenalty == 1)
  113. {
  114. Size = FontSize(GetText("3_None"));
  115. SizeI = (110-Size)/2;
  116. DrawFont(X1+498+SizeI, Y1, 0, 0, 0, MenuContentTransp, GetText("3_None"));
  117. }
  118. else
  119. {
  120. Size = FontSize("x%i", Setup.Profile[CurrentProfile].NPCTargetingSpeedPenalty);
  121. SizeI = (110-Size)/2;
  122. DrawFont(X1+498+SizeI, Y1, 0, 0, 0, MenuContentTransp, "x%i", Setup.Profile[CurrentProfile].NPCTargetingSpeedPenalty);
  123. }
  124. Y1 += Prir1;
  125. DrawFont(X1, Y1, 0, 0, 0, MenuContentTransp, GetText("3_Limited_Ammo"));
  126. if (DrawButton128_2(X1+360+128, Y1-6, GetText(OnOff[Setup.Profile[CurrentProfile].LimitedAmmo]), MenuContentTransp, false))
  127. {
  128. Setup.Profile[CurrentProfile].LimitedAmmo++;
  129. if (Setup.Profile[CurrentProfile].LimitedAmmo > 1) Setup.Profile[CurrentProfile].LimitedAmmo = 0;
  130. }
  131. Y1 += Prir1;
  132. DrawFont(X1, Y1, 0, 0, 0, MenuContentTransp, GetText("3_Destroyable_Weapon"));
  133. if (DrawButton128_2(X1+360+128, Y1-6, GetText(OnOff[Setup.Profile[CurrentProfile].DestroyableWeapon]), MenuContentTransp, false))
  134. {
  135. Setup.Profile[CurrentProfile].DestroyableWeapon++;
  136. if (Setup.Profile[CurrentProfile].DestroyableWeapon > 1) Setup.Profile[CurrentProfile].DestroyableWeapon = 0;
  137. }
  138. Y1 += Prir1;
  139. DrawFont(X1, Y1, 0, 0, 0, MenuContentTransp, GetText("3_Weapon_Targeting_Mode"));
  140. if (DrawButton128_2(X1+360+128, Y1-6, GetText(ArcadeSim[Setup.Profile[CurrentProfile].WeaponTargetingMode]), MenuContentTransp, false))
  141. {
  142. Setup.Profile[CurrentProfile].WeaponTargetingMode++;
  143. if (Setup.Profile[CurrentProfile].WeaponTargetingMode > 1) Setup.Profile[CurrentProfile].WeaponTargetingMode = 0;
  144. }
  145. Y1 += Prir1;
  146. DrawFont(X1, Y1, 0, 0, 0, MenuContentTransp, GetText("3_SpaceShip_Control_Mode"));
  147. if (DrawButton128_2(X1+360+128, Y1-6, GetText(ArcadeSim[Setup.Profile[CurrentProfile].SpaceShipControlMode]), MenuContentTransp, false))
  148. {
  149. Setup.Profile[CurrentProfile].SpaceShipControlMode++;
  150. if (Setup.Profile[CurrentProfile].SpaceShipControlMode > 1) Setup.Profile[CurrentProfile].SpaceShipControlMode = 0;
  151. }
  152. // ??????? ????? ?????????
  153. Setup.Profile[CurrentProfile].Difficulty = 100-( (Setup.Profile[CurrentProfile].NPCWeaponPenalty-1)*6+
  154. (Setup.Profile[CurrentProfile].NPCArmorPenalty-1)*6+
  155. (Setup.Profile[CurrentProfile].NPCTargetingSpeedPenalty-1)*6+
  156. Setup.Profile[CurrentProfile].LimitedAmmo*14+
  157. Setup.Profile[CurrentProfile].DestroyableWeapon*11+
  158. Setup.Profile[CurrentProfile].WeaponTargetingMode*12+
  159. Setup.Profile[CurrentProfile].SpaceShipControlMode*15);
  160. Y1 += Prir1;
  161. Size = FontSize("%s: %i%%", GetText("3_Current_Profile_Difficulty"), Setup.Profile[CurrentProfile].Difficulty);
  162. SizeI = (Setup.iAspectRatioWidth-Size)/2;
  163. DrawFont(SizeI, Y1, 0, 0, 1, MenuContentTransp, "%s: %i%%", GetText("3_Current_Profile_Difficulty"), Setup.Profile[CurrentProfile].Difficulty);
  164. int X = Setup.iAspectRatioWidth/2 - 192;
  165. int Y = 175+95*5;
  166. if (DrawButton384(X,Y, GetText("1_BACK"), MenuContentTransp, &Button1Transp, &LastButton1UpdateTime))
  167. {
  168. ComBuffer = PROFILE;
  169. }
  170. }