diff --git a/Tactical/Turn Based Input.cpp b/Tactical/Turn Based Input.cpp index 760731ce..29acce24 100644 --- a/Tactical/Turn Based Input.cpp +++ b/Tactical/Turn Based Input.cpp @@ -3278,20 +3278,51 @@ void GetKeyboardInput( UINT32 *puiNewEvent ) BOOLEAN slingFit = (CanItemFitInPosition(pSoldier, &pSoldier->inv[GUNSLINGPOCKPOS], HANDPOS, FALSE) || pSoldier->inv[GUNSLINGPOCKPOS].exists() == false); if(Item[pSoldier->inv[GUNSLINGPOCKPOS].usItem].twohanded && pSoldier->inv[SECONDHANDPOS].exists() == true) handFit = FALSE; + if( handFit == TRUE && slingFit == TRUE) { - SwapObjs(&pSoldier->inv[HANDPOS], &pSoldier->inv[GUNSLINGPOCKPOS]); - HandleTacticalEffectsOfEquipmentChange(pSoldier, HANDPOS, pSoldier->inv[GUNSLINGPOCKPOS].usItem, pSoldier->inv[HANDPOS].usItem); + if (gGameOptions.fInventoryCostsAP) + { + UINT8 APCost = 0; + if (pSoldier->inv[GUNSLINGPOCKPOS].exists()) + { + APCost += ( APBPConstants [ AP_INV_FROM_SLING ] + APBPConstants [ AP_INV_TO_HANDS ] ); + if (gGameExternalOptions.uWeightDivisor != 0) + APCost += DynamicAdjustAPConstants((int)((Item[pSoldier->inv[GUNSLINGPOCKPOS].usItem].ubWeight) / gGameExternalOptions.uWeightDivisor),(int)((Item[pSoldier->inv[GUNSLINGPOCKPOS].usItem].ubWeight) / gGameExternalOptions.uWeightDivisor)); + } + if (pSoldier->inv[HANDPOS].exists()) + { + APCost += ( APBPConstants [ AP_INV_TO_SLING ] + APBPConstants [ AP_INV_FROM_HANDS ] ); + if (gGameExternalOptions.uWeightDivisor != 0) + APCost += DynamicAdjustAPConstants((int)((Item[pSoldier->inv[HANDPOS].usItem].ubWeight) / gGameExternalOptions.uWeightDivisor),(int)((Item[pSoldier->inv[HANDPOS].usItem].ubWeight) / gGameExternalOptions.uWeightDivisor)); + } + APCost = __min(APCost, APBPConstants[AP_INV_MAX_COST]); + if (pSoldier->bActionPoints >= APCost) + { + pSoldier->bActionPoints -= APCost; + SwapObjs(&pSoldier->inv[HANDPOS], &pSoldier->inv[GUNSLINGPOCKPOS]); + HandleTacticalEffectsOfEquipmentChange(pSoldier, HANDPOS, pSoldier->inv[GUNSLINGPOCKPOS].usItem, pSoldier->inv[HANDPOS].usItem); + } + else + { + CHAR16 zOutputString[512]; + swprintf( zOutputString, New113Message[MSG113_INVENTORY_APS_INSUFFICIENT], APCost, pSoldier->bActionPoints); + ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, zOutputString ); + } + } + else + { + SwapObjs(&pSoldier->inv[HANDPOS], &pSoldier->inv[GUNSLINGPOCKPOS]); + HandleTacticalEffectsOfEquipmentChange(pSoldier, HANDPOS, pSoldier->inv[GUNSLINGPOCKPOS].usItem, pSoldier->inv[HANDPOS].usItem); + } } fCharacterInfoPanelDirty = TRUE; fInterfacePanelDirty = DIRTYLEVEL2; } break; - case INSERT: - // WANNE: Commented this out, because the interface panel is not correctly redrawn! - // I do not know the bug ;( + case INSERT: GoIntoOverheadMap(); break; diff --git a/Utils/Text.h b/Utils/Text.h index fc654f55..1a8d07bd 100644 --- a/Utils/Text.h +++ b/Utils/Text.h @@ -2077,6 +2077,8 @@ enum MSG113_ENEMY_FOUND_DEAD_BODY, MSG113_AMMO_SPEC_STRING, + MSG113_INVENTORY_APS_INSUFFICIENT, + TEXT_NUM_MSG113, }; diff --git a/Utils/_ChineseText.cpp b/Utils/_ChineseText.cpp index 1f68f308..788b78d2 100644 --- a/Utils/_ChineseText.cpp +++ b/Utils/_ChineseText.cpp @@ -6068,6 +6068,7 @@ STR16 New113Message[] = ////////////////////////////////////////////////////////////////////////////////////// L"注意: 敌人尸体被发现!!!", L"%s [%d rnds]\n%s %1.1f %s", + L"AP不够!需要%d,你只有%d。", //L"Insufficient AP Points! Cost %d, you have %d.", }; STR16 New113HAMMessage[] = diff --git a/Utils/_DutchText.cpp b/Utils/_DutchText.cpp index 68967b1f..488fb256 100644 --- a/Utils/_DutchText.cpp +++ b/Utils/_DutchText.cpp @@ -6067,7 +6067,7 @@ STR16 New113Message[] = ////////////////////////////////////////////////////////////////////////////////////// L"Warning: enemy corpse found!!!", L"%s [%d rnds]\n%s %1.1f %s", - + L"Insufficient AP Points! Cost %d, you have %d.", // TODO.Translate }; // TODO.Translate diff --git a/Utils/_EnglishText.cpp b/Utils/_EnglishText.cpp index 8771613a..ab8cd578 100644 --- a/Utils/_EnglishText.cpp +++ b/Utils/_EnglishText.cpp @@ -6066,6 +6066,7 @@ STR16 New113Message[] = ////////////////////////////////////////////////////////////////////////////////////// L"Warning: enemy corpse found!!!", L"%s [%d rnds]\n%s %1.1f %s", + L"Insufficient AP Points! Cost %d, you have %d.", }; STR16 New113HAMMessage[] = diff --git a/Utils/_FrenchText.cpp b/Utils/_FrenchText.cpp index bbb5d22b..1d1b8313 100644 --- a/Utils/_FrenchText.cpp +++ b/Utils/_FrenchText.cpp @@ -6049,7 +6049,7 @@ STR16 New113Message[] = ////////////////////////////////////////////////////////////////////////////////////// L"Attention: Cadavre ennemi trouvé !!!", L"%s [%d rnds]\n%s %1.1f %s", - + L"Insufficient AP Points! Cost %d, you have %d.", // TODO.Translate }; STR16 New113HAMMessage[] = diff --git a/Utils/_GermanText.cpp b/Utils/_GermanText.cpp index e727ed15..fc37552e 100644 --- a/Utils/_GermanText.cpp +++ b/Utils/_GermanText.cpp @@ -5897,7 +5897,7 @@ STR16 New113Message[] = ////////////////////////////////////////////////////////////////////////////////////// L"Warning: enemy corpse found!!!", L"%s [%d rnds]\n%s %1.1f %s", - + L"Zu wenig APs! Es werden %d APs benötigt, Sie haben aber nur %d APs.", // TODO.Translate }; STR16 New113HAMMessage[] = diff --git a/Utils/_ItalianText.cpp b/Utils/_ItalianText.cpp index 4306e8ab..efc5297d 100644 --- a/Utils/_ItalianText.cpp +++ b/Utils/_ItalianText.cpp @@ -6057,7 +6057,7 @@ STR16 New113Message[] = ////////////////////////////////////////////////////////////////////////////////////// L"Warning: enemy corpse found!!!", L"%s [%d rnds]\n%s %1.1f %s", - + L"Insufficient AP Points! Cost %d, you have %d.", // TODO.Translate }; // TODO.Translate diff --git a/Utils/_PolishText.cpp b/Utils/_PolishText.cpp index 0235d155..e9bd8ede 100644 --- a/Utils/_PolishText.cpp +++ b/Utils/_PolishText.cpp @@ -6063,7 +6063,7 @@ STR16 New113Message[] = ////////////////////////////////////////////////////////////////////////////// L"Warning: enemy corpse found!!!", L"%s [%d rnds]\n%s %1.1f %s", - + L"Insufficient AP Points! Cost %d, you have %d.", // TODO.Translate }; STR16 New113HAMMessage[] = diff --git a/Utils/_RussianText.cpp b/Utils/_RussianText.cpp index aa9505e0..e35e732a 100644 --- a/Utils/_RussianText.cpp +++ b/Utils/_RussianText.cpp @@ -6040,7 +6040,7 @@ STR16 New113Message[] = ///// L"Внимание: враг обнаружил труп!!!", L"%s [%d патр.]\n%s %1.1f %s", - + L"Insufficient AP Points! Cost %d, you have %d.", // TODO.Translate }; STR16 New113HAMMessage[] = diff --git a/Utils/_TaiwaneseText.cpp b/Utils/_TaiwaneseText.cpp index 23bae4ae..833c1851 100644 --- a/Utils/_TaiwaneseText.cpp +++ b/Utils/_TaiwaneseText.cpp @@ -6070,7 +6070,7 @@ STR16 New113Message[] = ////////////////////////////////////////////////////////////////////////////////////// L"Warning: enemy corpse found!!!", L"%s [%d rnds]\n%s %1.1f %s", - + L"Insufficient AP Points! Cost %d, you have %d.", // TODO.Translate }; // TODO.Translate