Advertisement
Guest User

Untitled

a guest
Mar 25th, 2017
406
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 18.50 KB | None | 0 0
  1. /* MenuClass.cpp */
  2.  
  3. #include "stdafx.h"
  4.  
  5. float menux = 0.2f;
  6. rgba titleText = { 0, 0, 0, 255 };
  7. rgba titleRect = { 255, 200, 0, 255 };
  8. rgba scroller = { 80, 80, 80, 200 };
  9. rgba options = { 0, 0, 0, 255 };
  10. rgba optionsrect = { 255, 220, 30, 60 };
  11.  
  12. int optioncount;
  13. int currentoption;
  14. bool optionpress = false;
  15. bool leftpress = false;
  16. bool rightpress = false;
  17. bool uppress = false;
  18. bool downpress = false;
  19.  
  20. char* currentmenu[100];
  21. char* actualmenu = "";
  22. int lastoption[100];
  23. int menulevel = 0;
  24. int infocount;
  25. int Delay = GetTickCount();
  26.  
  27. int Menu::getKeyPressed(int key) {
  28.     return GetAsyncKeyState(key);
  29. }
  30.  
  31. char* Menu::StringToChar(std::string string) {
  32.     return _strdup(string.c_str());
  33. }
  34.  
  35. bool Menu::currentMenu(char* menuname) {
  36.     if (menuname == actualmenu) return true;
  37.     else return false;
  38. }
  39.  
  40. void Menu::changeMenu(char* menuname) {
  41.     currentmenu[menulevel] = actualmenu;
  42.     lastoption[menulevel] = currentoption;
  43.     menulevel++;
  44.     actualmenu = menuname;
  45.     currentoption = 1;
  46. }
  47.  
  48. void Menu::backMenu() {
  49.     menulevel--;
  50.     actualmenu = currentmenu[menulevel];
  51.     currentoption = lastoption[menulevel];
  52. }
  53.  
  54. void Menu::drawText(char* text, int font, float x, float y, float scalex, float scaley, rgba rgba, bool center) {
  55.     UI::SET_TEXT_FONT(font);
  56.     UI::SET_TEXT_SCALE(scalex, scaley);
  57.     UI::SET_TEXT_COLOUR(rgba.r, rgba.g, rgba.b, rgba.a);
  58.     UI::SET_TEXT_CENTRE(center);
  59.     UI::_SET_TEXT_ENTRY("STRING");
  60.     UI::ADD_TEXT_COMPONENT_SUBSTRING_PLAYER_NAME(text);
  61.     UI::_DRAW_TEXT(x, y);
  62. };
  63.  
  64. void Menu::drawNotification(char* msg) {
  65.     UI::_SET_NOTIFICATION_TEXT_ENTRY("STRING");
  66.     UI::ADD_TEXT_COMPONENT_SUBSTRING_PLAYER_NAME(msg);
  67.     UI::_DRAW_NOTIFICATION(false , 1);
  68. };
  69.  
  70. void Menu::drawRect(float x, float y, float width, float height, rgba rgba) {
  71.     GRAPHICS::DRAW_RECT(x, y, width, height, rgba.r, rgba.g, rgba.b, rgba.a);
  72. };
  73.  
  74. void Menu::drawSprite(char* Streamedtexture, char* textureName, float x, float y, float width, float height, float rotation, rgba rgba)
  75. {
  76.     if (!GRAPHICS::HAS_STREAMED_TEXTURE_DICT_LOADED(Streamedtexture)) GRAPHICS::REQUEST_STREAMED_TEXTURE_DICT(Streamedtexture, false);
  77.     else GRAPHICS::DRAW_SPRITE(Streamedtexture, textureName, x, y, width, height, rotation, rgba.r, rgba.g, rgba.b, rgba.a);
  78. };
  79.  
  80. void Menu::Title(char* title) {
  81.     optioncount = 0;
  82.     drawText(title, 7, menux, 0.095f, 0.85f, 0.85f, titleText, true);
  83.     drawRect(menux, 0.1175f, 0.23f, 0.085f, titleRect);
  84. };
  85.  
  86. bool Menu::Option(char* option) {
  87.     optioncount++;
  88.  
  89.     bool thisOption = false;
  90.     if (currentoption == optioncount) thisOption = true;
  91.  
  92.     if (currentoption <= 16 && optioncount <= 16)
  93.     {
  94.         drawText(option, 6, menux - 0.1f, (optioncount * 0.035f + 0.125f), 0.5f, 0.5f, options, false);
  95.         drawRect(menux, ((optioncount * 0.035f) + 0.1415f), 0.23f, 0.035f, optionsrect);
  96.         if (thisOption) drawRect(menux, ((optioncount * 0.035f) + 0.1415f), 0.23f, 0.035f, scroller);
  97.     }
  98.  
  99.     else if ((optioncount > (currentoption - 16)) && optioncount <= currentoption)
  100.     {
  101.         drawText(option, 6, menux - 0.1f, ((optioncount - (currentoption - 16)) * 0.035f + 0.125f), 0.5f, 0.5f, options, false);
  102.         drawRect(menux, ((optioncount - (currentoption - 16)) * 0.035f + 0.1415f), 0.23f, 0.035f, optionsrect);
  103.         if (thisOption) drawRect(menux, ((optioncount - (currentoption - 16)) * 0.035f + 0.1415f), 0.23f, 0.035f, scroller);
  104.     }
  105.  
  106.     if (optionpress && currentoption == optioncount) return true;
  107.     else return false;
  108. };
  109.  
  110. bool Menu::MenuOption(char* option, char* menu) {
  111.     Option(option);
  112.  
  113.     if (currentoption <= 16 && optioncount <= 16)
  114.         drawText(">>", 6, menux + 0.068f, (optioncount * 0.035f + 0.125f), 0.5f, 0.5f, options, true);
  115.     else if ((optioncount > (currentoption - 16)) && optioncount <= currentoption)
  116.         drawText(">>", 6, menux + 0.068f, ((optioncount - (currentoption - 16)) * 0.035f + 0.125f), 0.5f, 0.5f, options, true);
  117.  
  118.     if (optionpress && currentoption == optioncount) {
  119.         optionpress = false;
  120.         changeMenu(menu);
  121.         return true;
  122.     }
  123.     else return false;
  124. }
  125.  
  126. bool Menu::IntOption(char* option, int *var, int min, int max, int step) {
  127.     Option(option);
  128.  
  129.     if (currentoption <= 16 && optioncount <= 16)
  130.         drawText(StringToChar("<" + std::to_string(*var) + ">"), 6, menux + 0.068f, (optioncount * 0.035f + 0.125f), 0.5f, 0.5f, options, true);
  131.     else if ((optioncount > (currentoption - 16)) && optioncount <= currentoption)
  132.         drawText(StringToChar("<" + std::to_string(*var) + ">"), 6, menux + 0.068f, ((optioncount - (currentoption - 16)) * 0.035f + 0.125f), 0.5f, 0.5f, options, true);
  133.  
  134.     if (currentoption == optioncount) {
  135.         if (leftpress) {
  136.             if (*var <= min) *var = max;
  137.             else *var -= step;
  138.             leftpress = false;
  139.             return true;
  140.         }
  141.         if (*var < min) *var = max;
  142.         if (rightpress) {
  143.             if (*var >= max) *var = min;
  144.             else *var += step;
  145.             rightpress = false;
  146.             return true;
  147.         }
  148.         if (*var > max) *var = min;
  149.     }
  150.  
  151.     if (optionpress && currentoption == optioncount)
  152.         return true;
  153.     else return false;
  154. }
  155.  
  156. bool Menu::FloatOption(char* option, float *var, float min, float max, float step) {
  157.     Option(option);
  158.  
  159.  
  160.  
  161.     char buf[100];
  162.     _snprintf_s(buf, sizeof(buf), "%.2f", *var);
  163.  
  164.     if (currentoption <= 16 && optioncount <= 16)
  165.         drawText(StringToChar("<" + (std::string)buf + ">"), 6, menux + 0.068f, (optioncount * 0.035f + 0.125f), 0.5f, 0.5f, options, true);
  166.     else if ((optioncount > (currentoption - 16)) && optioncount <= currentoption)
  167.         drawText(StringToChar("<" + (std::string)buf + ">"), 6, menux + 0.068f, ((optioncount - (currentoption - 16)) * 0.035f + 0.125f), 0.5f, 0.5f, options, true);
  168.  
  169.     if (currentoption == optioncount) {
  170.         if (leftpress) {
  171.             if (*var <= min) *var = max;
  172.             else *var -= step;
  173.             leftpress = false;
  174.             return true;
  175.         }
  176.         if (*var < min) *var = max;
  177.  
  178.         if (rightpress) {
  179.             if (*var >= max) *var = min;
  180.             else *var += step;
  181.             rightpress = false;
  182.             return true;
  183.         }
  184.         if (*var > max) *var = min;
  185.     }
  186.  
  187.     if (optionpress && currentoption == optioncount)
  188.         return true;
  189.     else return false;
  190. }
  191.  
  192. bool Menu::BoolOption(char* option, bool *b00l) {
  193.     Option(option);
  194.     if (currentoption <= 16 && optioncount <= 16)
  195.         drawSprite("commonmenu", *b00l ? "shop_box_tick" : "shop_box_blank",
  196.             menux + 0.068f, (optioncount * 0.035f + 0.141f), 0.03f, 0.05f, 0, options);
  197.     else if ((optioncount > (currentoption - 16)) && optioncount <= currentoption)
  198.         drawSprite("commonmenu", *b00l ? "shop_box_tick" : "shop_box_blank",
  199.             menux + 0.068f, ((optioncount - (currentoption - 16)) * 0.035f + 0.141f), 0.03f, 0.05f, 0, options);
  200.     if (optionpress && currentoption == optioncount) {
  201.         *b00l ^= 1;
  202.         return true;
  203.     }
  204.     else return false;
  205. }
  206.  
  207. bool Menu::BoolSpriteOption(char* option, bool b00l, char* category, char* spriteOn, char* spriteOff) {
  208.     Option(option);
  209.  
  210.     if (currentoption <= 16 && optioncount <= 16)
  211.         drawSprite(category, b00l ? spriteOn : spriteOff,
  212.             menux + 0.068f, (optioncount * 0.035f + 0.141f), 0.03f, 0.05f, 0, options);
  213.     else if ((optioncount > (currentoption - 16)) && optioncount <= currentoption)
  214.         drawSprite(category, b00l ? spriteOn : spriteOff,
  215.             menux + 0.068f, ((optioncount - (currentoption - 16)) * 0.035f + 0.141f), 0.03f, 0.05f, 0, options);
  216.  
  217.     if (optionpress && currentoption == optioncount) return true;
  218.     else return false;
  219. }
  220.  
  221. bool Menu::IntArray(char* option, int display[], int *PlaceHolderInt) {
  222.     Option(option);
  223.  
  224.     int min = 0;
  225.     int max = sizeof(display) / sizeof(*display);
  226.  
  227.     if (currentoption == optioncount) {
  228.         if (leftpress) {
  229.             if (*PlaceHolderInt <= min) *PlaceHolderInt = max;
  230.             else PlaceHolderInt -= 1;
  231.             leftpress = false;
  232.             return true;
  233.         }
  234.         if (*PlaceHolderInt < min) *PlaceHolderInt = max;
  235.         if (rightpress) {
  236.             if (*PlaceHolderInt >= max) *PlaceHolderInt = min;
  237.             else *PlaceHolderInt += 1;
  238.             rightpress = false;
  239.             return true;
  240.         }
  241.         if (*PlaceHolderInt > max) *PlaceHolderInt = min;
  242.     }
  243.     if (currentoption <= 16 && optioncount <= 16)
  244.         drawText(StringToChar("<" + std::to_string(display[*PlaceHolderInt]) + ">"), 6, menux + 0.068f, (optioncount * 0.035f + 0.125f), 0.5f, 0.5f, options, true);
  245.     else if ((optioncount > (currentoption - 16)) && optioncount <= currentoption)
  246.         drawText(StringToChar("<" + std::to_string(display[*PlaceHolderInt]) + ">"), 6, menux + 0.068f, ((optioncount - (currentoption - 16)) * 0.035f + 0.125f), 0.5f, 0.5f, options, true);
  247.  
  248.     if (optionpress && currentoption == optioncount)
  249.         return true;
  250.     else return false;
  251. }
  252.  
  253. bool Menu::FloatArray(char* option, float display[], int *PlaceHolderInt) {
  254.     Option(option);
  255.  
  256.     int min = 0;
  257.     int max = sizeof(display) / sizeof(*display);
  258.  
  259.     if (currentoption == optioncount) {
  260.         if (leftpress) {
  261.             if (*PlaceHolderInt <= min) *PlaceHolderInt = max;
  262.             else *PlaceHolderInt -= 1;
  263.             leftpress = false;
  264.             return true;
  265.         }
  266.         if (*PlaceHolderInt < min) *PlaceHolderInt = max;
  267.         if (rightpress) {
  268.             if (*PlaceHolderInt >= max) *PlaceHolderInt = min;
  269.             else *PlaceHolderInt += 1;
  270.             rightpress = false;
  271.             return true;
  272.         }
  273.         if (*PlaceHolderInt > max) *PlaceHolderInt = min;
  274.     }
  275.  
  276.     char buf[30];
  277.     _snprintf_s(buf, sizeof(buf), "%.2f", display[*PlaceHolderInt]);
  278.  
  279.     if (currentoption <= 16 && optioncount <= 16)
  280.         drawText(StringToChar("<" + (std::string)buf + ">"), 6, menux + 0.068f, (optioncount * 0.035f + 0.125f), 0.5f, 0.5f, options, true);
  281.     else if ((optioncount > (currentoption - 16)) && optioncount <= currentoption)
  282.         drawText(StringToChar("<" + (std::string)buf + ">"), 6, menux + 0.068f, ((optioncount - (currentoption - 16)) * 0.035f + 0.125f), 0.5f, 0.5f, options, true);
  283.  
  284.     if (optionpress && currentoption == optioncount)
  285.         return true;
  286.     else return false;
  287. }
  288.  
  289. bool Menu::CharArray(char* option, char* display[], int *PlaceHolderInt) {
  290.     Option(option);
  291.  
  292.     int min = 0;
  293.     int max = sizeof(display) / sizeof(*display) + 1;
  294.  
  295.     if (currentoption == optioncount) {
  296.         if (leftpress) {
  297.             if (*PlaceHolderInt <= min) *PlaceHolderInt = max;
  298.             else *PlaceHolderInt -= 1;
  299.             leftpress = false;
  300.         }
  301.         if (*PlaceHolderInt < min) *PlaceHolderInt = max;
  302.         if (rightpress) {
  303.             if (*PlaceHolderInt >= max) *PlaceHolderInt = min;
  304.             else *PlaceHolderInt += 1;
  305.             rightpress = false;
  306.         }
  307.         if (*PlaceHolderInt > max) *PlaceHolderInt = min;
  308.     }
  309.     if (currentoption <= 16 && optioncount <= 16)
  310.         drawText(StringToChar("<" + (std::string)display[*PlaceHolderInt] + ">"), 6, menux + 0.068f, (optioncount * 0.035f + 0.125f), 0.5f, 0.5f, options, true);
  311.     else if ((optioncount > (currentoption - 16)) && optioncount <= currentoption)
  312.         drawText(StringToChar("<" + (std::string)display[*PlaceHolderInt] + ">"), 6, menux + 0.068f, ((optioncount - (currentoption - 16)) * 0.035f + 0.125f), 0.5f, 0.5f, options, true);
  313.  
  314.     if (optionpress && currentoption == optioncount)
  315.         return true;
  316.     else return false;
  317. }
  318.  
  319. void Menu::TeleportOption(char* option, float x, float y, float z) {
  320.     Option(option);
  321.  
  322.     if (currentoption == optioncount && optionpress) {
  323.         Entity handle = PLAYER::PLAYER_PED_ID();
  324.         if (PED::IS_PED_IN_ANY_VEHICLE(PLAYER::PLAYER_PED_ID(), false)) handle = PED::GET_VEHICLE_PED_IS_USING(PLAYER::PLAYER_PED_ID());
  325.         ENTITY::SET_ENTITY_COORDS_NO_OFFSET(handle, x, y, z, false, false, false);
  326.     }
  327. }
  328.  
  329. void Menu::IniWriteInt(LPCWSTR file, LPCWSTR section, LPCWSTR key, int value)
  330. {
  331.     wchar_t newValue[256];
  332.     wsprintf(newValue, L"%d", value);
  333.     WritePrivateProfileString(section, key, newValue, file);
  334. }
  335.  
  336. int Menu::IniReadInt(LPCWSTR file, LPCWSTR section, LPCWSTR key)
  337. {
  338.     int returning = GetPrivateProfileInt(section, key, NULL, file);
  339.     return returning;
  340. }
  341.  
  342. void Menu::LoadMenuTheme(LPCWSTR file)
  343. {  
  344.     // Title Text
  345.     titleText.r = IniReadInt(file, L"Title Text", L"Red");
  346.     titleText.g = IniReadInt(file, L"Title Text", L"Green");
  347.     titleText.b = IniReadInt(file, L"Title Text", L"Blue");
  348.     titleText.a = IniReadInt(file, L"Title Text", L"Alpha");
  349.  
  350.     // Title Rect
  351.     titleRect.r = IniReadInt(file, L"Title Rect", L"Red");
  352.     titleRect.g = IniReadInt(file, L"Title Rect", L"Green");
  353.     titleRect.b = IniReadInt(file, L"Title Rect", L"Blue");
  354.     titleRect.a = IniReadInt(file, L"Title Rect", L"Alpha");
  355.  
  356.     // Scroller
  357.     scroller.r = IniReadInt(file, L"Scroller", L"Red");
  358.     scroller.g = IniReadInt(file, L"Scroller", L"Green");
  359.     scroller.b = IniReadInt(file, L"Scroller", L"Blue");
  360.     scroller.a = IniReadInt(file, L"Scroller", L"Alpha");
  361.  
  362.     // Option Text
  363.     options.r = IniReadInt(file, L"Options Text", L"Red");
  364.     options.g = IniReadInt(file, L"Options Text", L"Green");
  365.     options.b = IniReadInt(file, L"Options Text", L"Blue");
  366.     options.a = IniReadInt(file, L"Options Text", L"Alpha");
  367.  
  368.     // Option Rect
  369.     optionsrect.r = IniReadInt(file, L"Options Rect", L"Red");
  370.     optionsrect.g = IniReadInt(file, L"Options Rect", L"Green");
  371.     optionsrect.b = IniReadInt(file, L"Options Rect", L"Blue");
  372.     optionsrect.a = IniReadInt(file, L"Options Rect", L"Alpha");
  373. }
  374.  
  375. void Menu::SaveMenuTheme(LPCWSTR file)
  376. {  
  377.     // Title Text
  378.     IniWriteInt(file, L"Title Text", L"Red", titleText.r);
  379.     IniWriteInt(file, L"Title Text", L"Green", titleText.g);
  380.     IniWriteInt(file, L"Title Text", L"Blue", titleText.b);
  381.     IniWriteInt(file, L"Title Text", L"Alpha", titleText.a);
  382.  
  383.     // Title Rect
  384.     IniWriteInt(file, L"Title Rect", L"Red", titleRect.r);
  385.     IniWriteInt(file, L"Title Rect", L"Green", titleRect.g);
  386.     IniWriteInt(file, L"Title Rect", L"Blue", titleRect.b);
  387.     IniWriteInt(file, L"Title Rect", L"Alpha", titleRect.a);
  388.  
  389.     // Scroller
  390.     IniWriteInt(file, L"Scroller", L"Red", scroller.r);
  391.     IniWriteInt(file, L"Scroller", L"Green", scroller.g);
  392.     IniWriteInt(file, L"Scroller", L"Blue", scroller.b);
  393.     IniWriteInt(file, L"Scroller", L"Alpha", scroller.a);
  394.  
  395.     // Options Text
  396.     IniWriteInt(file, L"Options Text", L"Red", options.r);
  397.     IniWriteInt(file, L"Options Text", L"Green", options.g);
  398.     IniWriteInt(file, L"Options Text", L"Blue", options.b);
  399.     IniWriteInt(file, L"Options Text", L"Alpha", options.a);
  400.  
  401.     // Options Rect
  402.     IniWriteInt(file, L"Options Rect", L"Red", optionsrect.r);
  403.     IniWriteInt(file, L"Options Rect", L"Green", optionsrect.g);
  404.     IniWriteInt(file, L"Options Rect", L"Blue", optionsrect.b);
  405.     IniWriteInt(file, L"Options Rect", L"Alpha", optionsrect.a);
  406. }
  407.  
  408. void Menu::endMenu() {
  409.     if (menulevel > 0)
  410.     {
  411.         if (optioncount > 16)
  412.         {
  413.             drawText(StringToChar(std::to_string(currentoption) + "/" + std::to_string(optioncount)),
  414.                 6, menux - 0.1f, (17 * 0.035f + 0.125f), 0.5f, 0.5f, titleText, false);
  415.             drawRect(menux, (17 * 0.035f + 0.1415f), 0.23f, 0.035f, titleRect);
  416.  
  417.             if (currentoption == 1) {
  418.                 drawSprite("commonmenu", "arrowright", menux, ((16 + 1) * 0.035f + 0.145f), 0.02f, 0.02f, 90, titleText);
  419.             }
  420.             else if (currentoption == optioncount) {
  421.                 drawSprite("commonmenu", "arrowright", menux, ((16 + 1) * 0.035f + 0.145f), 0.02f, 0.02f, 270, titleText);
  422.             }
  423.             else {
  424.                 drawSprite("commonmenu", "arrowright", menux, ((16 + 1) * 0.035f + 0.14f), 0.02f, 0.02f, 270, titleText);
  425.                 drawSprite("commonmenu", "arrowright", menux, ((16 + 1) * 0.035f + 0.15f), 0.02f, 0.02f, 90, titleText);
  426.             }
  427.         }
  428.         else
  429.         {
  430.             drawText(StringToChar(std::to_string(currentoption) + "/" + std::to_string(optioncount)),
  431.                 6, menux - 0.1f, ((optioncount + 1) * 0.035f + 0.125f), 0.5f, 0.5f, titleText, false);
  432.             drawRect(menux, ((optioncount + 1) * 0.035f + 0.1415f), 0.23f, 0.035f, titleRect);
  433.  
  434.             if (currentoption == 1 && optioncount > 1) {
  435.                 drawSprite("commonmenu", "arrowright", menux, ((optioncount + 1) * 0.035f + 0.145f), 0.02f, 0.02f, 90, titleText);
  436.             }
  437.             else if (currentoption == optioncount && optioncount > 1) {
  438.                 drawSprite("commonmenu", "arrowright", menux, ((optioncount + 1) * 0.035f + 0.145f), 0.02f, 0.02f, 270, titleText);
  439.             }
  440.             else if (optioncount > 1) {
  441.                 drawSprite("commonmenu", "arrowright", menux, ((optioncount + 1) * 0.035f + 0.14f), 0.02f, 0.02f, 270, titleText);
  442.                 drawSprite("commonmenu", "arrowright", menux, ((optioncount + 1) * 0.035f + 0.15f), 0.02f, 0.02f, 90, titleText);
  443.             }
  444.         }
  445.  
  446.  
  447.         UI::HIDE_HELP_TEXT_THIS_FRAME();
  448.         CAM::SET_CINEMATIC_BUTTON_ACTIVE(0);
  449.         UI::HIDE_HUD_COMPONENT_THIS_FRAME(10);
  450.         UI::HIDE_HUD_COMPONENT_THIS_FRAME(6);
  451.         UI::HIDE_HUD_COMPONENT_THIS_FRAME(7);
  452.         UI::HIDE_HUD_COMPONENT_THIS_FRAME(9);
  453.         UI::HIDE_HUD_COMPONENT_THIS_FRAME(8);
  454.  
  455.         CONTROLS::DISABLE_CONTROL_ACTION(2, ControlNextCamera, true);
  456.  
  457.         CONTROLS::DISABLE_CONTROL_ACTION(2, ControlPhone, true);
  458.         CONTROLS::DISABLE_CONTROL_ACTION(2, ControlVehicleCinCam, true);
  459.  
  460.         CONTROLS::DISABLE_CONTROL_ACTION(2, ControlSelectCharacterMichael, true);
  461.         CONTROLS::DISABLE_CONTROL_ACTION(2, ControlSelectCharacterFranklin, true);
  462.         CONTROLS::DISABLE_CONTROL_ACTION(2, ControlSelectCharacterTrevor, true);
  463.         CONTROLS::DISABLE_CONTROL_ACTION(2, ControlSelectCharacterMultiplayer, true);
  464.         CONTROLS::DISABLE_CONTROL_ACTION(2, ControlCharacterWheel, true);
  465.  
  466.         CONTROLS::DISABLE_CONTROL_ACTION(2, ControlMeleeAttackLight, true);
  467.         CONTROLS::DISABLE_CONTROL_ACTION(2, ControlMeleeAttackHeavy, true);
  468.         CONTROLS::DISABLE_CONTROL_ACTION(2, ControlMeleeAttackAlternate, true);
  469.  
  470.         CONTROLS::DISABLE_CONTROL_ACTION(2, ControlMultiplayerInfo, true);
  471.         CONTROLS::DISABLE_CONTROL_ACTION(2, ControlMapPointOfInterest, true);
  472.  
  473.         if (currentoption > optioncount) currentoption = optioncount;
  474.         if (currentoption < 1) currentoption = 1;
  475.     }
  476. }
  477.  
  478. void Menu::checkKeys() {
  479.     optionpress = false;
  480.     if (GetTickCount() - Delay > 150) {
  481.         if (getKeyPressed(VK_MULTIPLY) || CONTROLS::IS_DISABLED_CONTROL_PRESSED(0, ControlFrontendLb) &&
  482.             CONTROLS::IS_DISABLED_CONTROL_PRESSED(0, ControlFrontendRb)) {
  483.             if (menulevel == 0) changeMenu("mainmenu");
  484.             else if (menulevel == 1) backMenu();
  485.             Delay = GetTickCount();
  486.         }
  487.         if (getKeyPressed(VK_NUMPAD0) || CONTROLS::IS_DISABLED_CONTROL_PRESSED(0, ControlFrontendCancel)) {
  488.             if (menulevel > 0)
  489.                 backMenu();
  490.             Delay = GetTickCount();
  491.         }
  492.         if (getKeyPressed(VK_NUMPAD5) || CONTROLS::IS_DISABLED_CONTROL_PRESSED(0, ControlFrontendAccept)) {
  493.             optionpress = true;
  494.             Delay = GetTickCount();
  495.         }
  496.         if (getKeyPressed(VK_NUMPAD2) || CONTROLS::IS_DISABLED_CONTROL_PRESSED(0, ControlFrontendDown)) {
  497.             if (currentoption < optioncount)
  498.                 currentoption++;
  499.             else
  500.                 currentoption = 1;
  501.             Delay = GetTickCount();
  502.             downpress = true;
  503.         }
  504.         if (getKeyPressed(VK_NUMPAD8) || CONTROLS::IS_DISABLED_CONTROL_PRESSED(0, ControlFrontendUp)) {
  505.             if (currentoption > 1)
  506.                 currentoption--;
  507.             else
  508.                 currentoption = optioncount;
  509.             Delay = GetTickCount();
  510.             uppress = true;
  511.         }
  512.         if (getKeyPressed(VK_NUMPAD4) || CONTROLS::IS_DISABLED_CONTROL_PRESSED(0, ControlPhoneLeft)) {
  513.             leftpress = true;
  514.             Delay = GetTickCount();
  515.         }
  516.         if (getKeyPressed(VK_NUMPAD6) || CONTROLS::IS_DISABLED_CONTROL_PRESSED(0, ControlPhoneRight)) {
  517.             rightpress = true;
  518.             Delay = GetTickCount();
  519.         }
  520.     }
  521. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement