- price and militia resource points display in sector inventory was incorrect and didn't take Shift key into account
- display of militia resource below the map didn't work if MILITIA_VOLUNTEER_POOL was FALSE

Enhancements:
- militia resource points display below map now better organized
- militia resource points display below map now available when in sector inventory and pressing ALT key
- conversion of items to militia resource points now available with ALT + RMB, ALT + Shift + RMB and ALT + Shift + Y + RMB just like quick sell feature works


git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@8275 3b4a5df2-a311-0410-b5c6-a8a6f20db521
This commit is contained in:
silversurfer
2016-07-17 13:44:58 +00:00
parent 6acbd72c89
commit ab554b937c
4 changed files with 97 additions and 87 deletions
+9 -9
View File
@@ -15,9 +15,9 @@
#ifdef JA2EDITOR
#ifdef JA2UB
CHAR16 zVersionLabel[256] = { L"Unfinished Business - Map Editor v1.13.8270 (Development Build)" };
CHAR16 zVersionLabel[256] = { L"Unfinished Business - Map Editor v1.13.8275 (Development Build)" };
#else
CHAR16 zVersionLabel[256] = { L"Map Editor v1.13.8270 (Development Build)" };
CHAR16 zVersionLabel[256] = { L"Map Editor v1.13.8275 (Development Build)" };
#endif
// ------------------------------
@@ -27,11 +27,11 @@
//DEBUG BUILD VERSION
#ifdef JA2UB
CHAR16 zVersionLabel[256] = { L"Debug: Unfinished Business - v1.13.8270 (Development Build)" };
CHAR16 zVersionLabel[256] = { L"Debug: Unfinished Business - v1.13.8275 (Development Build)" };
#elif defined (JA113DEMO)
CHAR16 zVersionLabel[256] = { L"Debug: JA2 Demo - v1.13.8270 (Development Build)" };
CHAR16 zVersionLabel[256] = { L"Debug: JA2 Demo - v1.13.8275 (Development Build)" };
#else
CHAR16 zVersionLabel[256] = { L"Debug: v1.13.8270 (Development Build)" };
CHAR16 zVersionLabel[256] = { L"Debug: v1.13.8275 (Development Build)" };
#endif
#elif defined CRIPPLED_VERSION
@@ -46,16 +46,16 @@
//RELEASE BUILD VERSION
#ifdef JA2UB
CHAR16 zVersionLabel[256] = { L"Release Unfinished Business - v1.13.8270 (Development Build)" };
CHAR16 zVersionLabel[256] = { L"Release Unfinished Business - v1.13.8275 (Development Build)" };
#elif defined (JA113DEMO)
CHAR16 zVersionLabel[256] = { L"Release JA2 Demo - v1.13.8270 (Development Build)" };
CHAR16 zVersionLabel[256] = { L"Release JA2 Demo - v1.13.8275 (Development Build)" };
#else
CHAR16 zVersionLabel[256] = { L"Release v1.13.8270 (Development Build)" };
CHAR16 zVersionLabel[256] = { L"Release v1.13.8275 (Development Build)" };
#endif
#endif
CHAR8 czVersionNumber[16] = { "Build 16.07.15" }; //YY.MM.DD
CHAR8 czVersionNumber[16] = { "Build 16.07.17" }; //YY.MM.DD
CHAR16 zTrackingNumber[16] = { L"Z" };
// SAVE_GAME_VERSION is defined in header, change it there
@@ -1350,8 +1350,63 @@ void MapInvenPoolSlots(MOUSE_REGION * pRegion, INT32 iReason )
if(ValidAmmoType(twItem->object.usItem, gpItemPointer->usItem) == TRUE)
fValidPointer = true;
}
// Flugente: convert gear to resources
if ( _KeyDown( ALT ) && gGameExternalOptions.fMilitiaResources && !gGameExternalOptions.fMilitiaUseSectorInventory )
{
FLOAT dvalue_Gun = 0;
FLOAT dvalue_Armour = 0;
FLOAT dvalue_Misc = 0;
if (_KeyDown( SHIFT ))
{
// convert all items in slot
twItem->object.MoveThisObjectTo(gItemPointer,-1,0,NUM_INV_SLOTS,MAX_OBJECTS_PER_SLOT);
}
else
{
twItem->object.MoveThisObjectTo(gItemPointer, 1);
}
fMapPanelDirty = TRUE;
UINT16 usItem = gItemPointer.usItem;
if ( ConvertItemToResources( gItemPointer, _KeyDown( SHIFT ), dvalue_Gun, dvalue_Armour, dvalue_Misc ) )
{
AddResources( dvalue_Gun, dvalue_Armour, dvalue_Misc );
dvalue_Gun = dvalue_Armour = dvalue_Misc = 0;
PlayJA2Sample( COMPUTER_BEEP2_IN, RATE_11025, 15, 1, MIDDLEPAN );
gpItemPointer = NULL;
fMapInventoryItem = FALSE;
ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, szSMilitiaResourceText[0], Item[usItem].szItemName );
}
if ( _KeyDown( 89 ) )
{
for ( UINT32 iNumber = 0; iNumber < pInventoryPoolList.size( ); ++iNumber )
{
if ( pInventoryPoolList[iNumber].object.usItem == usItem && pInventoryPoolList[iNumber].usFlags & WORLD_ITEM_REACHABLE )
{
if ( ConvertItemToResources( pInventoryPoolList[iNumber].object, TRUE, dvalue_Gun, dvalue_Armour, dvalue_Misc ) )
{
AddResources( dvalue_Gun, dvalue_Armour, dvalue_Misc );
dvalue_Gun = dvalue_Armour = dvalue_Misc = 0;
DeleteObj( &pInventoryPoolList[iNumber].object );
}
}
}
}
if ( fShowMapInventoryPool )
HandleButtonStatesWhileMapInventoryActive( );
}
// access description box directly if CTRL is pressed for stack items
if((twItem->object.ubNumberOfObjects == 1 || _KeyDown( CTRL )) && fValidPointer)
else if((twItem->object.ubNumberOfObjects == 1 || _KeyDown( CTRL )) && fValidPointer)
{
fShowInventoryFlag = TRUE;
@@ -2459,49 +2514,6 @@ void BeginInventoryPoolPtr( OBJECTTYPE *pInventorySlot )
if ( fShowMapInventoryPool )
HandleButtonStatesWhileMapInventoryActive();
}
// Flugente: convert gear to resources
else if ( _KeyDown( ALT ) && _KeyDown( SHIFT ) && gGameExternalOptions.fMilitiaResources && !gGameExternalOptions.fMilitiaUseSectorInventory )
{
FLOAT dvalue_Gun = 0;
FLOAT dvalue_Armour = 0;
FLOAT dvalue_Misc = 0;
UINT16 usItem = gItemPointer.usItem;
if ( ConvertItemToResources( gItemPointer, TRUE, dvalue_Gun, dvalue_Armour, dvalue_Misc ) )
{
AddResources( dvalue_Gun, dvalue_Armour, dvalue_Misc );
dvalue_Gun = dvalue_Armour = dvalue_Misc = 0;
PlayJA2Sample( COMPUTER_BEEP2_IN, RATE_11025, 15, 1, MIDDLEPAN );
gpItemPointer = NULL;
fMapInventoryItem = FALSE;
ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, szSMilitiaResourceText[0], Item[usItem].szItemName );
}
if ( _KeyDown( 89 ) )
{
for ( UINT32 iNumber = 0; iNumber < pInventoryPoolList.size( ); ++iNumber )
{
if ( pInventoryPoolList[iNumber].object.usItem == usItem && pInventoryPoolList[iNumber].usFlags & WORLD_ITEM_REACHABLE )
{
if ( ConvertItemToResources( pInventoryPoolList[iNumber].object, TRUE, dvalue_Gun, dvalue_Armour, dvalue_Misc ) )
{
AddResources( dvalue_Gun, dvalue_Armour, dvalue_Misc );
dvalue_Gun = dvalue_Armour = dvalue_Misc = 0;
DeleteObj( &pInventoryPoolList[iNumber].object );
}
}
}
}
if ( fShowMapInventoryPool )
HandleButtonStatesWhileMapInventoryActive( );
}
else if ( _KeyDown( ALT ) && gGameExternalOptions.fSellAll )//Sell Item
{
// HEADROCK HAM 5: Added argument
@@ -4241,7 +4253,7 @@ INT32 SellItem( OBJECTTYPE& object, BOOLEAN fAll, BOOLEAN useModifier )
{
//we are selling ammo
UINT16 magSize = Magazine[ Item[ usItemType ].ubClassIndex ].ubMagSize;
for (UINT8 ubLoop = 0; ubLoop < object.ubNumberOfObjects; ubLoop++)
for (UINT8 ubLoop = 0; ubLoop < ubNumberOfObjects; ubLoop++)
{
iPrice += (INT32)( itemPrice * (float) object[ubLoop]->data.ubShotsLeft / magSize );
}
@@ -4249,7 +4261,7 @@ INT32 SellItem( OBJECTTYPE& object, BOOLEAN fAll, BOOLEAN useModifier )
//CHRISL: If we're dealing with money, we want to use the money's amount and just return that value with no modification
else if(Item[usItemType].usItemClass == IC_MONEY)
{
for (UINT8 ubLoop = 0; ubLoop < object.ubNumberOfObjects; ubLoop++)
for (UINT8 ubLoop = 0; ubLoop < ubNumberOfObjects; ubLoop++)
{
iPrice += (INT32)(object[ubLoop]->data.money.uiMoneyAmount);
}
@@ -4259,7 +4271,7 @@ INT32 SellItem( OBJECTTYPE& object, BOOLEAN fAll, BOOLEAN useModifier )
{
//CHRISL: If we're selling an LBE Item, we need to verify if it's an LBENODE, first. If it is, we need to sell
// everything stored in the LBENODE before we sell teh LBE Item itself.
for(UINT8 ubLoop = 0; ubLoop < object.ubNumberOfObjects; ++ubLoop)
for(UINT8 ubLoop = 0; ubLoop < ubNumberOfObjects; ++ubLoop)
{
if(object.IsActiveLBE(ubLoop) == true)
{
@@ -4290,7 +4302,7 @@ INT32 SellItem( OBJECTTYPE& object, BOOLEAN fAll, BOOLEAN useModifier )
else
{
//we are selling a gun or something - it could be stacked or single, and if single it could have attachments
for (UINT8 ubLoop = 0; ubLoop < object.ubNumberOfObjects; ubLoop++)
for (UINT8 ubLoop = 0; ubLoop < ubNumberOfObjects; ubLoop++)
{
iPrice += ( itemPrice * object[ubLoop]->data.objectStatus / 100 );
for (attachmentList::iterator iter = object[ubLoop]->attachments.begin(); iter != object[ubLoop]->attachments.end(); ++iter) {
+26 -28
View File
@@ -709,10 +709,10 @@ UINT32 DrawMap( void )
//MAP_VIEW_START_X = (SCREEN_WIDTH - 370);
//MAP_VIEW_START_Y = 10;
MapScreenRect.iLeft = MAP_VIEW_START_X+MAP_GRID_X - 2;
MapScreenRect.iTop = MAP_VIEW_START_Y+MAP_GRID_Y - 1;
MapScreenRect.iLeft = MAP_VIEW_START_X + MAP_GRID_X - 2;
MapScreenRect.iTop = MAP_VIEW_START_Y + MAP_GRID_Y - 1;
MapScreenRect.iRight = MAP_VIEW_START_X + MAP_VIEW_WIDTH - 1 + MAP_GRID_X;
MapScreenRect.iBottom = MAP_VIEW_START_Y+MAP_VIEW_HEIGHT-10+MAP_GRID_Y;
MapScreenRect.iBottom = MAP_VIEW_START_Y + MAP_VIEW_HEIGHT - 10 + MAP_GRID_Y;
//MapScreenRect={ (MAP_VIEW_START_X+MAP_GRID_X - 2), ( MAP_VIEW_START_Y+MAP_GRID_Y - 1), MAP_VIEW_START_X + MAP_VIEW_WIDTH - 1 + MAP_GRID_X , MAP_VIEW_START_Y+MAP_VIEW_HEIGHT-10+MAP_GRID_Y};
@@ -7816,14 +7816,14 @@ void MilitiaGroupBoxButtonCallback( GUI_BUTTON *btn, INT32 reason )
void DisplayMilitiaGroupBox()
{
// if we play with a limited militia pool, show us how many we have
if ( fShowMilitia && gGameExternalOptions.fMilitiaVolunteerPool )
if ( (fShowMilitia || (_KeyDown( ALT ) && fShowMapInventoryPool)) && (gGameExternalOptions.fMilitiaVolunteerPool || (gGameExternalOptions.fMilitiaResources && !gGameExternalOptions.fMilitiaUseSectorInventory)) )
{
SetFont( FONT12ARIAL );
INT32 x = MapScreenRect.iLeft + 20;
INT32 y = MapScreenRect.iBottom - 10;
INT32 y = MapScreenRect.iBottom + 10;
// if we play with a limited militia pool, show us how many we have
if ( gGameExternalOptions.fMilitiaVolunteerPool )
{
CHAR16 sString[200];
@@ -7839,11 +7839,10 @@ void DisplayMilitiaGroupBox()
swprintf( sString, szMilitiaStrategicMovementText[8], volunteers, CalcHourlyVolunteerGain( ) );
mprintf( x, y, sString );
x += StringPixLength( sString, FONT12ARIAL );
y -= 10;
}
y -= GetFontHeight( FONT12ARIAL ) + 2;
if ( gGameExternalOptions.fMilitiaResources && !gGameExternalOptions.fMilitiaUseSectorInventory )
{
x = MapScreenRect.iLeft + 20;
@@ -7853,6 +7852,24 @@ void DisplayMilitiaGroupBox()
FLOAT val_gun, val_armour, val_misc;
GetResources( val_gun, val_armour, val_misc );
SetFontForeground( FONT_LTBLUE );
swprintf( sString, szSMilitiaResourceText[3] );
mprintf( x, y, sString );
x += 5 + StringPixLength( sString, FONT12ARIAL );
if ( val_misc > 20.0 )
SetFontForeground( FONT_FCOLOR_GREEN );
else if ( val_misc > 10.0 )
SetFontForeground( FONT_FCOLOR_YELLOW );
else
SetFontForeground( FONT_FCOLOR_RED );
swprintf( sString, L"%5.2f", val_misc );
mprintf( x, y, sString );
x = MapScreenRect.iLeft + 20;
y -= GetFontHeight( FONT12ARIAL ) + 2;
SetFontForeground( FONT_ORANGE );
swprintf( sString, szSMilitiaResourceText[1] );
mprintf( x, y, sString );
@@ -7883,25 +7900,6 @@ void DisplayMilitiaGroupBox()
swprintf( sString, L"%5.2f", val_armour );
mprintf( x, y, sString );
x += 5 + StringPixLength( sString, FONT12ARIAL );
SetFontForeground( FONT_LTBLUE );
swprintf( sString, szSMilitiaResourceText[3] );
mprintf( x, y, sString );
x += 5 + StringPixLength( sString, FONT12ARIAL );
if ( val_misc > 20.0 )
SetFontForeground( FONT_FCOLOR_GREEN );
else if ( val_misc > 10.0 )
SetFontForeground( FONT_FCOLOR_YELLOW );
else
SetFontForeground( FONT_FCOLOR_RED );
swprintf( sString, L"%5.2f", val_misc );
mprintf( x, y, sString );
x += 5 + StringPixLength( sString, FONT12ARIAL );
y -= 10;
}
}
+2 -2
View File
@@ -2645,7 +2645,7 @@ BOOLEAN ConvertItemToResources( OBJECTTYPE& object, BOOLEAN fAll, FLOAT& arValue
}
UINT32 bullets = 0;
for ( UINT8 ubLoop = 0; ubLoop < object.ubNumberOfObjects; ++ubLoop )
for ( UINT8 ubLoop = 0; ubLoop < ubNumberOfObjects; ++ubLoop )
{
bullets += object[ubLoop]->data.ubShotsLeft;
}
@@ -2654,7 +2654,7 @@ BOOLEAN ConvertItemToResources( OBJECTTYPE& object, BOOLEAN fAll, FLOAT& arValue
}
else
{
for ( UINT8 ubLoop = 0; ubLoop < object.ubNumberOfObjects; ++ubLoop )
for ( UINT8 ubLoop = 0; ubLoop < ubNumberOfObjects; ++ubLoop )
{
if ( Item[usItemType].usItemClass & IC_GUN )
{