From d828cdd25f8c3b8ab1c6f01155127625cb01b09f Mon Sep 17 00:00:00 2001 From: Wanne Date: Mon, 31 Oct 2011 11:28:24 +0000 Subject: [PATCH] - New Hotkeys for Bobby Ray (by Buggler) Hotkey LEFT ARROW: Previous Items Hotkey 'Shift + LEFT ARROW': Jump 5 pages Back Hotkey RIGHT ARROW: More Items Hotkey 'Shift + RIGHT ARROW': Jump 5 pages Forward Hotkey ENTER: Order Form Hotkey '1' - '4': Purchase 1 item ('1' for first item, '2' for second item, ...) Hotkey 'Shift + 1' - 'Shift + 4': Purchase all items Hotkey 'Ctrl + 1' - 'Ctrl + 4': Unpurchase 1 item Hotkey 'Shift + Ctrl + 1' - 'Shift + Ctrl + 4': Unpurchase all items git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@4777 3b4a5df2-a311-0410-b5c6-a8a6f20db521 --- Laptop/BobbyRAmmo.cpp | 1 + Laptop/BobbyRArmour.cpp | 1 + Laptop/BobbyRGuns.cpp | 213 ++++++++++++++++++++++++++++++++++++--- Laptop/BobbyRMisc.cpp | 1 + Laptop/BobbyRUsed.cpp | 1 + Laptop/mercs Files.cpp | Bin 61594 -> 66834 bytes Utils/_EnglishText.cpp | 2 +- Utils/_TaiwaneseText.cpp | 2 +- 8 files changed, 207 insertions(+), 14 deletions(-) diff --git a/Laptop/BobbyRAmmo.cpp b/Laptop/BobbyRAmmo.cpp index 050b3912..338ad4b1 100644 --- a/Laptop/BobbyRAmmo.cpp +++ b/Laptop/BobbyRAmmo.cpp @@ -73,6 +73,7 @@ void ExitBobbyRAmmo() void HandleBobbyRAmmo() { + HandleBobbyRGuns(); } void RenderBobbyRAmmo() diff --git a/Laptop/BobbyRArmour.cpp b/Laptop/BobbyRArmour.cpp index 2a44a7bc..61034b74 100644 --- a/Laptop/BobbyRArmour.cpp +++ b/Laptop/BobbyRArmour.cpp @@ -71,6 +71,7 @@ void ExitBobbyRArmour() void HandleBobbyRArmour() { + HandleBobbyRGuns(); } void RenderBobbyRArmour() diff --git a/Laptop/BobbyRGuns.cpp b/Laptop/BobbyRGuns.cpp index 482bedd7..bb5db0d8 100644 --- a/Laptop/BobbyRGuns.cpp +++ b/Laptop/BobbyRGuns.cpp @@ -16,11 +16,11 @@ #include "Finances.h" #include "AimMembers.h" #include "Overhead.h" - #include "Text.h" #include "Weapons.h" #include "GameSettings.h" #include "Points.h" #include "Multi Language Graphic Utils.h" + #include "english.h" // HEADROCK HAM 4 #include "input.h" #endif @@ -245,6 +245,8 @@ UINT16 gusLastItemIndex=0; UINT16 gusFirstItemIndex=0; UINT8 gubNumItemsOnScreen; UINT8 gubNumPages; +UINT8 gubNumPagesMod; + BOOLEAN gfBigImageMouseRegionCreated; UINT16 gusItemNumberForItemsOnScreen[ BOBBYR_NUM_WEAPONS_ON_PAGE ]; @@ -326,6 +328,8 @@ void BobbyrRGunsHelpTextDoneCallBack( void ); void ReportBobbyROrderError( UINT16 usItemNumber, UINT8 ubPurchaseNum, UINT8 ubQtyOnHand, UINT8 ubNumPurchasing ); #endif +//Hotkey Assignment +void HandleBobbyRGunsKeyBoardInput(); void GameInitBobbyRGuns() { @@ -406,6 +410,8 @@ void ExitBobbyRGuns() void HandleBobbyRGuns() { + //Hotkey Assignment + HandleBobbyRGunsKeyBoardInput(); } void RenderBobbyRGuns() @@ -1306,11 +1312,11 @@ void BtnBobbyRNextPreviousPageCallback(GUI_BUTTON *btn,INT32 reason) //else next screen else { - if( gubCurPage < gubNumPages-1 ) + if( gubCurPage < gubNumPages - 1 ) { if (_KeyDown( 16 ) ) // SHIFT { - gubCurPage = __min(gubNumPages, gubCurPage+5); + gubCurPage = __min(gubNumPages - 1, gubCurPage + 5); } else { @@ -2283,7 +2289,8 @@ void SetFirstLastPagesForNew( UINT32 uiClassMask, INT32 iFilter ) gusFirstItemIndex = (UINT16)sFirst; gusLastItemIndex = (UINT16)sLast; gubNumPages = (UINT8)( ubNumItems / (FLOAT)BOBBYR_NUM_WEAPONS_ON_PAGE ); - if( (ubNumItems % BOBBYR_NUM_WEAPONS_ON_PAGE ) != 0 ) + gubNumPagesMod = ubNumItems % BOBBYR_NUM_WEAPONS_ON_PAGE; + if( gubNumPagesMod != 0 ) gubNumPages += 1; } @@ -2383,7 +2390,8 @@ void SetFirstLastPagesForUsed(INT32 iFilter) gusFirstItemIndex = (UINT16)sFirst; gusLastItemIndex = (UINT16)sLast; gubNumPages = (UINT8)( ubNumItems / (FLOAT)BOBBYR_NUM_WEAPONS_ON_PAGE ); - if( (ubNumItems % BOBBYR_NUM_WEAPONS_ON_PAGE ) != 0 ) + gubNumPagesMod = ubNumItems % BOBBYR_NUM_WEAPONS_ON_PAGE; + if( gubNumPagesMod != 0 ) gubNumPages += 1; } @@ -3719,14 +3727,195 @@ void ReportBobbyROrderError( UINT16 usItemNumber, UINT8 ubPurchaseNum, UINT8 ubQ } #endif +void HandleBobbyRGunsKeyBoardInput() +{ + InputAtom InputEvent; + BOOLEAN fCtrl, fAlt; + fCtrl = _KeyDown( CTRL ); + fAlt = _KeyDown( ALT ); + while (DequeueEvent(&InputEvent) == TRUE) + { + if( InputEvent.usEvent == KEY_DOWN ) + { + switch (InputEvent.usParam) + { + case LEFTARROW: + // previous page + if( gubCurPage > 0 ) + gubCurPage--; + fReDrawScreenFlag = TRUE; + fPausedReDrawScreenFlag = TRUE; + break; + case RIGHTARROW: + // next page + if( gubCurPage < gubNumPages - 1 ) + gubCurPage++; - - - - - - - + fReDrawScreenFlag = TRUE; + fPausedReDrawScreenFlag = TRUE; + break; + case SHIFT_LEFTARROW: + // jump to 5 pages back + if( gubCurPage > 0 ) + gubCurPage = __max(gubCurPage - 5, 0); + + fReDrawScreenFlag = TRUE; + fPausedReDrawScreenFlag = TRUE; + break; + case SHIFT_RIGHTARROW: + // jump to 5 pages forward + if( gubCurPage < gubNumPages - 1 ) + gubCurPage = __min(gubNumPages - 1, gubCurPage + 5); + + fReDrawScreenFlag = TRUE; + fPausedReDrawScreenFlag = TRUE; + break; + case ENTER: + // order form + guiCurrentLaptopMode = LAPTOP_MODE_BOBBY_R_MAILORDER; + break; + case '1': + // 1st item on screen + if( ( ( gubNumPages > 0 ) && ( gubCurPage != gubNumPages - 1 ) ) || + ( ( gubCurPage == gubNumPages - 1 ) ) ) + { + if( fCtrl ) + UnPurchaseBobbyRayItem(gusItemNumberForItemsOnScreen[ 0 ], FALSE); + else + PurchaseBobbyRayItem(gusItemNumberForItemsOnScreen[ 0 ], FALSE); + } + break; + case '2': + // 2nd item on screen + if( ( ( gubNumPages > 0 ) && ( gubCurPage != gubNumPages - 1 ) ) || + ( ( gubCurPage == gubNumPages - 1 ) && ( ( gubNumPagesMod == 0 ) || ( gubNumPagesMod >= 2 ) ) ) ) + { + if( fCtrl ) + UnPurchaseBobbyRayItem(gusItemNumberForItemsOnScreen[ 1 ], FALSE); + else + PurchaseBobbyRayItem(gusItemNumberForItemsOnScreen[ 1 ], FALSE); + } + break; + case '3': + // 3rd item on screen + if( ( ( gubNumPages > 0 ) && ( gubCurPage != gubNumPages - 1 ) ) || + ( ( gubCurPage == gubNumPages - 1 ) && ( ( gubNumPagesMod == 0 ) || ( gubNumPagesMod >= 3 ) ) ) ) { + if( fCtrl ) + UnPurchaseBobbyRayItem(gusItemNumberForItemsOnScreen[ 2 ], FALSE); + else + PurchaseBobbyRayItem(gusItemNumberForItemsOnScreen[ 2 ], FALSE); + } + break; + case '4': + // 4th item on screen + if( ( ( gubNumPages > 0 ) && ( gubCurPage != gubNumPages - 1 ) ) || + ( ( gubCurPage == gubNumPages -1 ) && ( gubNumPagesMod == 0 ) ) ) + { + if( fCtrl ) + UnPurchaseBobbyRayItem(gusItemNumberForItemsOnScreen[ 3 ], FALSE); + else + PurchaseBobbyRayItem(gusItemNumberForItemsOnScreen[ 3 ], FALSE); + } + break; + case '!': + // 1st item on screen all at once + if( ( ( gubNumPages > 0 ) && ( gubCurPage != gubNumPages - 1 ) ) || + ( ( gubCurPage == gubNumPages - 1 ) ) ) + { + if( fCtrl ) + UnPurchaseBobbyRayItem(gusItemNumberForItemsOnScreen[ 0 ], TRUE); + else + PurchaseBobbyRayItem(gusItemNumberForItemsOnScreen[ 0 ], TRUE); + } + break; + case '@': + // 2nd item on screen all at once + if( ( ( gubNumPages > 0 ) && ( gubCurPage != gubNumPages - 1 ) ) || + ( ( gubCurPage == gubNumPages - 1 ) && ( ( gubNumPagesMod == 0 ) || ( gubNumPagesMod >= 2 ) ) ) ) + { + if( fCtrl ) + UnPurchaseBobbyRayItem(gusItemNumberForItemsOnScreen[ 1 ], TRUE); + else + PurchaseBobbyRayItem(gusItemNumberForItemsOnScreen[ 1 ], TRUE); + } + break; + case '#': + // 3rd item on screen all at once + if( ( ( gubNumPages > 0 ) && ( gubCurPage != gubNumPages - 1 ) ) || + ( ( gubCurPage == gubNumPages - 1 ) && ( ( gubNumPagesMod == 0 ) || ( gubNumPagesMod >= 3 ) ) ) ) { + if( fCtrl ) + UnPurchaseBobbyRayItem(gusItemNumberForItemsOnScreen[ 2 ], TRUE); + else + PurchaseBobbyRayItem(gusItemNumberForItemsOnScreen[ 2 ], TRUE); + } + break; + case '$': + // 4th item on screen all at once + if( ( ( gubNumPages > 0 ) && ( gubCurPage != gubNumPages - 1 ) ) || + ( ( gubCurPage == gubNumPages -1 ) && ( gubNumPagesMod == 0 ) ) ) + { + if( fCtrl ) + UnPurchaseBobbyRayItem(gusItemNumberForItemsOnScreen[ 3 ], TRUE); + else + PurchaseBobbyRayItem(gusItemNumberForItemsOnScreen[ 3 ], TRUE); + } + break; + default: + HandleKeyBoardShortCutsForLapTop( InputEvent.usEvent, InputEvent.usParam, InputEvent.usKeyState ); + break; + } + } + else if( InputEvent.usEvent == KEY_REPEAT ) + { + switch( InputEvent.usParam ) + { + case '1': + // 1st item on screen + if( ( ( gubNumPages > 0 ) && ( gubCurPage != gubNumPages - 1 ) ) || + ( ( gubCurPage == gubNumPages - 1 ) ) ) + { + if( fCtrl ) + UnPurchaseBobbyRayItem(gusItemNumberForItemsOnScreen[ 0 ], FALSE); + else + PurchaseBobbyRayItem(gusItemNumberForItemsOnScreen[ 0 ], FALSE); + } + break; + case '2': + // 2nd item on screen + if( ( ( gubNumPages > 0 ) && ( gubCurPage != gubNumPages - 1 ) ) || + ( ( gubCurPage == gubNumPages - 1 ) && ( ( gubNumPagesMod == 0 ) || ( gubNumPagesMod >= 2 ) ) ) ) + { + if( fCtrl ) + UnPurchaseBobbyRayItem(gusItemNumberForItemsOnScreen[ 1 ], FALSE); + else + PurchaseBobbyRayItem(gusItemNumberForItemsOnScreen[ 1 ], FALSE); + } + break; + case '3': + // 3rd item on screen + if( ( ( gubNumPages > 0 ) && ( gubCurPage != gubNumPages - 1 ) ) || + ( ( gubCurPage == gubNumPages - 1 ) && ( ( gubNumPagesMod == 0 ) || ( gubNumPagesMod >= 3 ) ) ) ) { + if( fCtrl ) + UnPurchaseBobbyRayItem(gusItemNumberForItemsOnScreen[ 2 ], FALSE); + else + PurchaseBobbyRayItem(gusItemNumberForItemsOnScreen[ 2 ], FALSE); + } + break; + case '4': + // 4th item on screen + if( ( ( gubNumPages > 0 ) && ( gubCurPage != gubNumPages - 1 ) ) || + ( ( gubCurPage == gubNumPages -1 ) && ( gubNumPagesMod == 0 ) ) ) + { + if( fCtrl ) + UnPurchaseBobbyRayItem(gusItemNumberForItemsOnScreen[ 3 ], FALSE); + else + PurchaseBobbyRayItem(gusItemNumberForItemsOnScreen[ 3 ], FALSE); + } + break; + } + } + } +} \ No newline at end of file diff --git a/Laptop/BobbyRMisc.cpp b/Laptop/BobbyRMisc.cpp index b79e4db4..aecee5cb 100644 --- a/Laptop/BobbyRMisc.cpp +++ b/Laptop/BobbyRMisc.cpp @@ -73,6 +73,7 @@ void ExitBobbyRMisc() void HandleBobbyRMisc() { + HandleBobbyRGuns(); } void RenderBobbyRMisc() diff --git a/Laptop/BobbyRUsed.cpp b/Laptop/BobbyRUsed.cpp index cbea1785..e495b9d1 100644 --- a/Laptop/BobbyRUsed.cpp +++ b/Laptop/BobbyRUsed.cpp @@ -71,6 +71,7 @@ void ExitBobbyRUsed() void HandleBobbyRUsed() { + HandleBobbyRGuns(); } void RenderBobbyRUsed() diff --git a/Laptop/mercs Files.cpp b/Laptop/mercs Files.cpp index 3f7e096bc87a8d3d6a1ffaf80d9baaa34081fef0..5f4d0326237a12c375c180f7fc063e960cb6c4dc 100644 GIT binary patch delta 1304 zcmai!Ur1AN6vvNlJxq|uHl+5@9ZXRWhZP}O(8@WNqsH7Yu^7AiL!sN$T{q`81`<6; zPaX)2i0mn%BG_95t@ohx$sT>F2Skh>u#gA$%Xs7zdz@k&pE&ExepEuTbssL z_YCEVVbXTYK@OUt6lt_TG0Ks`Z|__9y=T}qE$5f87p4`8l82JCM5{PCKne}gIRE-= zEh~Lr?Hwlm;fKz0_3M4 zxp?RLajq;FouV4ef)B%Uy1}zJ}VQUHn)* z$9w8eu0+=OZ1fpFQb%#siHSZo#?AQpeZzf3`ex_NP*9JeO8;T#sak%0y-w;!c5bNd zaMmQ-PMt8o19%*~|0BQ;)qXyiFoWw3zf8m%*z97xHQ$`haX6m~w-P`#{nWgILP(;9 zRbiRV~b1%E2Rl-rE5QltL(G}W% zsZL=hiMAIV^KXyNK%^;@K%>i2I%x<`%)JyYL01A$Hhaw-8dOM5s2b`D*Z~y=R delta 49 zcmV-10M7rCiUgYB1F(z(lkx&Ivy1~qA(K!g2$ObS60>3@=p>T@Mi{fEO42Notox+1 H9(V+K@8%Rr diff --git a/Utils/_EnglishText.cpp b/Utils/_EnglishText.cpp index 0568aed9..a0287e73 100644 --- a/Utils/_EnglishText.cpp +++ b/Utils/_EnglishText.cpp @@ -4230,7 +4230,7 @@ STR16 BobbyRText[] = //Popup that tells the player that they can only order 10 items at a time - L"Darn! This here on-line order form will only accept 10 items per order. If you're looking to order more stuff (and we hope you are), kindly make a separate order and accept our apologies.", + L"Darn! This on-line order form will only accept 10 items per order. If you're looking to order more stuff (and we hope you are), kindly make a separate order and accept our apologies.", // A popup that tells the user that they are trying to order more items then the store has in stock diff --git a/Utils/_TaiwaneseText.cpp b/Utils/_TaiwaneseText.cpp index aab0b52c..eee887a3 100644 --- a/Utils/_TaiwaneseText.cpp +++ b/Utils/_TaiwaneseText.cpp @@ -4231,7 +4231,7 @@ STR16 BobbyRText[] = //Popup that tells the player that they can only order 10 items at a time - L"Darn! This here on-line order form will only accept 10 items per order. If you're looking to order more stuff (and we hope you are), kindly make a separate order and accept our apologies.", + L"Darn! This on-line order form will only accept 10 items per order. If you're looking to order more stuff (and we hope you are), kindly make a separate order and accept our apologies.", // A popup that tells the user that they are trying to order more items then the store has in stock