Fix for AI seeking climb point in toxic gas

Fix for civilians trying to climb the roof to seek noise
Fix for punching and stabbing
Transparent change: Gave names to anonymous structs in OBJECTTYPE


git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@1225 3b4a5df2-a311-0410-b5c6-a8a6f20db521
This commit is contained in:
Overhaul
2007-08-18 19:03:20 +00:00
parent 29b883f59d
commit fccef1faea
60 changed files with 921 additions and 887 deletions
+10 -10
View File
@@ -704,27 +704,27 @@ void BuildTriggerName( OBJECTTYPE *pItem, STR16 szItemName )
{
if( pItem->usItem == SWITCH )
{
if( pItem->bFrequency == PANIC_FREQUENCY )
if( pItem->ItemData.Trigger.BombTrigger.bFrequency == PANIC_FREQUENCY )
swprintf( szItemName, L"Panic Trigger1" );
else if( pItem->bFrequency == PANIC_FREQUENCY_2 )
else if( pItem->ItemData.Trigger.BombTrigger.bFrequency == PANIC_FREQUENCY_2 )
swprintf( szItemName, L"Panic Trigger2" );
else if( pItem->bFrequency == PANIC_FREQUENCY_3 )
else if( pItem->ItemData.Trigger.BombTrigger.bFrequency == PANIC_FREQUENCY_3 )
swprintf( szItemName, L"Panic Trigger3" );
else
swprintf( szItemName, L"Trigger%d", pItem->bFrequency - 50 );
swprintf( szItemName, L"Trigger%d", pItem->ItemData.Trigger.BombTrigger.bFrequency - 50 );
}
else
{ //action item
if( pItem->bDetonatorType == BOMB_PRESSURE )
if( pItem->ItemData.Trigger.bDetonatorType == BOMB_PRESSURE )
swprintf( szItemName, L"Pressure Action" );
else if( pItem->bFrequency == PANIC_FREQUENCY )
else if( pItem->ItemData.Trigger.BombTrigger.bFrequency == PANIC_FREQUENCY )
swprintf( szItemName, L"Panic Action1" );
else if( pItem->bFrequency == PANIC_FREQUENCY_2 )
else if( pItem->ItemData.Trigger.BombTrigger.bFrequency == PANIC_FREQUENCY_2 )
swprintf( szItemName, L"Panic Action2" );
else if( pItem->bFrequency == PANIC_FREQUENCY_3 )
else if( pItem->ItemData.Trigger.BombTrigger.bFrequency == PANIC_FREQUENCY_3 )
swprintf( szItemName, L"Panic Action3" );
else
swprintf( szItemName, L"Action%d", pItem->bFrequency - 50 );
swprintf( szItemName, L"Action%d", pItem->ItemData.Trigger.BombTrigger.bFrequency - 50 );
}
}
@@ -818,7 +818,7 @@ void RenderSelectedItemBlownUp()
}
else if( Item[ gpItem->usItem ].usItemClass == IC_KEY )
{
swprintf( szItemName, L"%S", LockTable[ gpItem->ubKeyID ].ubEditorName );
swprintf( szItemName, L"%S", LockTable[ gpItem->ItemData.Key.ubKeyID ].ubEditorName );
}
else
{
+37 -37
View File
@@ -844,11 +844,11 @@ void AddSelectedItemToWorld( INT16 sGridNo )
case MONEY:
case SILVER:
case GOLD:
tempObject.bStatus[0] = 100;
tempObject.uiMoneyAmount = 100 + Random( 19901 );
tempObject.ItemData.Money.bMoneyStatus = 100;
tempObject.ItemData.Money.uiMoneyAmount = 100 + Random( 19901 );
break;
case OWNERSHIP:
tempObject.ubOwnerProfile = NO_PROFILE;
tempObject.ItemData.Owner.ubOwnerProfile = NO_PROFILE;
bVisibility = BURIED;
break;
case SWITCH:
@@ -857,39 +857,39 @@ void AddSelectedItemToWorld( INT16 sGridNo )
return;
}
bVisibility = BURIED;
tempObject.bStatus[0] = 100;
tempObject.ubBombOwner = 1;
tempObject.ItemData.Trigger.bBombStatus = 100;
tempObject.ItemData.Trigger.ubBombOwner = 1;
if( eInfo.sSelItemIndex < 2 )
tempObject.bFrequency = PANIC_FREQUENCY;
tempObject.ItemData.Trigger.BombTrigger.bFrequency = PANIC_FREQUENCY;
else if( eInfo.sSelItemIndex < 4 )
tempObject.bFrequency = PANIC_FREQUENCY_2;
tempObject.ItemData.Trigger.BombTrigger.bFrequency = PANIC_FREQUENCY_2;
else if( eInfo.sSelItemIndex < 6 )
tempObject.bFrequency = PANIC_FREQUENCY_3;
tempObject.ItemData.Trigger.BombTrigger.bFrequency = PANIC_FREQUENCY_3;
else
tempObject.bFrequency = (INT8)(FIRST_MAP_PLACED_FREQUENCY + (eInfo.sSelItemIndex-4) / 2);
tempObject.ItemData.Trigger.BombTrigger.bFrequency = (INT8)(FIRST_MAP_PLACED_FREQUENCY + (eInfo.sSelItemIndex-4) / 2);
usFlags |= WORLD_ITEM_ARMED_BOMB;
break;
case ACTION_ITEM:
bVisibility = BURIED;
tempObject.bStatus[0] = 100;
tempObject.ubBombOwner = 1;
tempObject.ItemData.Trigger.bBombStatus = 100;
tempObject.ItemData.Trigger.ubBombOwner = 1;
tempObject.bTrap = gbDefaultBombTrapLevel;
if( eInfo.sSelItemIndex < PRESSURE_ACTION_ID )
{
tempObject.bDetonatorType = BOMB_REMOTE;
tempObject.ItemData.Trigger.bDetonatorType = BOMB_REMOTE;
if( eInfo.sSelItemIndex < 2 )
tempObject.bFrequency = PANIC_FREQUENCY;
tempObject.ItemData.Trigger.BombTrigger.bFrequency = PANIC_FREQUENCY;
else if( eInfo.sSelItemIndex < 4 )
tempObject.bFrequency = PANIC_FREQUENCY_2;
tempObject.ItemData.Trigger.BombTrigger.bFrequency = PANIC_FREQUENCY_2;
else if( eInfo.sSelItemIndex < 6 )
tempObject.bFrequency = PANIC_FREQUENCY_3;
tempObject.ItemData.Trigger.BombTrigger.bFrequency = PANIC_FREQUENCY_3;
else
tempObject.bFrequency = (INT8)(FIRST_MAP_PLACED_FREQUENCY + (eInfo.sSelItemIndex-4) / 2);
tempObject.ItemData.Trigger.BombTrigger.bFrequency = (INT8)(FIRST_MAP_PLACED_FREQUENCY + (eInfo.sSelItemIndex-4) / 2);
}
else
{
tempObject.bDetonatorType = BOMB_PRESSURE;
tempObject.bDelay = 0;
tempObject.ItemData.Trigger.bDetonatorType = BOMB_PRESSURE;
tempObject.ItemData.Trigger.BombTrigger.bDelay = 0;
}
ChangeActionItem( &tempObject, gbActionItemIndex );
tempObject.fFlags |= OBJECT_ARMED_BOMB;
@@ -916,26 +916,26 @@ void AddSelectedItemToWorld( INT16 sGridNo )
{
if (Random( 2 ))
{
pObject->ubShotsLeft[0] = Magazine[ pItem->ubClassIndex ].ubMagSize;
pObject->ItemData.Ammo.ubShotsLeft[0] = Magazine[ pItem->ubClassIndex ].ubMagSize;
}
else
{
pObject->ubShotsLeft[0] = (UINT8) Random( Magazine[ pItem->ubClassIndex ].ubMagSize );
pObject->ItemData.Ammo.ubShotsLeft[0] = (UINT8) Random( Magazine[ pItem->ubClassIndex ].ubMagSize );
}
}
else
{
pObject->bStatus[0] = (INT8)(70 + Random( 26 ));
pObject->ItemData.Generic.bStatus[0] = (INT8)(70 + Random( 26 ));
}
if( pItem->usItemClass & IC_GUN )
{
if ( pObject->usItem == ROCKET_LAUNCHER )
{
pObject->ubGunShotsLeft = 1;
pObject->ItemData.Gun.ubGunShotsLeft = 1;
}
else
{
pObject->ubGunShotsLeft = (UINT8)(Random( Weapon[ pObject->usItem ].ubMagSize ));
pObject->ItemData.Gun.ubGunShotsLeft = (UINT8)(Random( Weapon[ pObject->usItem ].ubMagSize ));
}
}
@@ -1054,9 +1054,9 @@ void DeleteSelectedItem()
//remove the item
if( gWorldItems[ gpItemPool->iItemIndex ].o.usItem == ACTION_ITEM )
{
if( gWorldItems[ gpItemPool->iItemIndex ].o.bActionValue == ACTION_ITEM_SMALL_PIT )
if( gWorldItems[ gpItemPool->iItemIndex ].o.ItemData.Trigger.bActionValue == ACTION_ITEM_SMALL_PIT )
Remove3X3Pit( gWorldItems[ gpItemPool->iItemIndex ].sGridNo );
else if( gWorldItems[ gpItemPool->iItemIndex ].o.bActionValue == ACTION_ITEM_LARGE_PIT )
else if( gWorldItems[ gpItemPool->iItemIndex ].o.ItemData.Trigger.bActionValue == ACTION_ITEM_LARGE_PIT )
Remove5X5Pit( gWorldItems[ gpItemPool->iItemIndex ].sGridNo );
}
if( gpEditingItemPool == gpItemPool )
@@ -1295,7 +1295,7 @@ void SelectNextKeyOfType( UINT8 ubKeyID )
while( gpItemPool )
{
pObject = &gWorldItems[ gpItemPool->iItemIndex ].o;
if( Item[ pObject->usItem ].usItemClass == IC_KEY && pObject->ubKeyID == ubKeyID )
if( Item[ pObject->usItem ].usItemClass == IC_KEY && pObject->ItemData.Key.ubKeyID == ubKeyID )
{
SpecifyItemToEdit( pObject, gWorldItems[ gpItemPool->iItemIndex ].sGridNo );
CenterScreenAtMapIndex( gsItemGridNo );
@@ -1314,7 +1314,7 @@ void SelectNextKeyOfType( UINT8 ubKeyID )
while( gpItemPool )
{
pObject = &gWorldItems[ gpItemPool->iItemIndex ].o;
if( Item[ pObject->usItem ].usItemClass == IC_KEY && pObject->ubKeyID == ubKeyID )
if( Item[ pObject->usItem ].usItemClass == IC_KEY && pObject->ItemData.Key.ubKeyID == ubKeyID )
{
SpecifyItemToEdit( pObject, gWorldItems[ gpItemPool->iItemIndex ].sGridNo );
CenterScreenAtMapIndex( gsItemGridNo );
@@ -1332,7 +1332,7 @@ void SelectNextKeyOfType( UINT8 ubKeyID )
while( gpItemPool )
{
pObject = &gWorldItems[ gpItemPool->iItemIndex ].o;
if( Item[ pObject->usItem ].usItemClass == IC_KEY && pObject->ubKeyID == ubKeyID )
if( Item[ pObject->usItem ].usItemClass == IC_KEY && pObject->ItemData.Key.ubKeyID == ubKeyID )
{
SpecifyItemToEdit( pObject, gWorldItems[ gpItemPool->iItemIndex ].sGridNo );
CenterScreenAtMapIndex( gsItemGridNo );
@@ -1359,7 +1359,7 @@ void SelectNextTriggerWithFrequency( UINT16 usItem, INT8 bFrequency )
while( gpItemPool )
{
pObject = &gWorldItems[ gpItemPool->iItemIndex ].o;
if( pObject->usItem == usItem && pObject->bFrequency == bFrequency )
if( pObject->usItem == usItem && pObject->ItemData.Trigger.BombTrigger.bFrequency == bFrequency )
{
SpecifyItemToEdit( pObject, gWorldItems[ gpItemPool->iItemIndex ].sGridNo );
CenterScreenAtMapIndex( gsItemGridNo );
@@ -1378,7 +1378,7 @@ void SelectNextTriggerWithFrequency( UINT16 usItem, INT8 bFrequency )
while( gpItemPool )
{
pObject = &gWorldItems[ gpItemPool->iItemIndex ].o;
if( pObject->usItem == usItem && pObject->bFrequency == bFrequency )
if( pObject->usItem == usItem && pObject->ItemData.Trigger.BombTrigger.bFrequency == bFrequency )
{
SpecifyItemToEdit( pObject, gWorldItems[ gpItemPool->iItemIndex ].sGridNo );
CenterScreenAtMapIndex( gsItemGridNo );
@@ -1396,7 +1396,7 @@ void SelectNextTriggerWithFrequency( UINT16 usItem, INT8 bFrequency )
while( gpItemPool )
{
pObject = &gWorldItems[ gpItemPool->iItemIndex ].o;
if( pObject->usItem == usItem && pObject->bFrequency == bFrequency )
if( pObject->usItem == usItem && pObject->ItemData.Trigger.BombTrigger.bFrequency == bFrequency )
{
SpecifyItemToEdit( pObject, gWorldItems[ gpItemPool->iItemIndex ].sGridNo );
CenterScreenAtMapIndex( gsItemGridNo );
@@ -1423,7 +1423,7 @@ void SelectNextPressureAction()
while( gpItemPool )
{
pObject = &gWorldItems[ gpItemPool->iItemIndex ].o;
if( pObject->usItem == ACTION_ITEM && pObject->bDetonatorType == BOMB_PRESSURE )
if( pObject->usItem == ACTION_ITEM && pObject->ItemData.Trigger.bDetonatorType == BOMB_PRESSURE )
{
SpecifyItemToEdit( pObject, gWorldItems[ gpItemPool->iItemIndex ].sGridNo );
CenterScreenAtMapIndex( gsItemGridNo );
@@ -1442,7 +1442,7 @@ void SelectNextPressureAction()
while( gpItemPool )
{
pObject = &gWorldItems[ gpItemPool->iItemIndex ].o;
if( pObject->usItem == ACTION_ITEM && pObject->bDetonatorType == BOMB_PRESSURE )
if( pObject->usItem == ACTION_ITEM && pObject->ItemData.Trigger.bDetonatorType == BOMB_PRESSURE )
{
SpecifyItemToEdit( pObject, gWorldItems[ gpItemPool->iItemIndex ].sGridNo );
CenterScreenAtMapIndex( gsItemGridNo );
@@ -1460,7 +1460,7 @@ void SelectNextPressureAction()
while( gpItemPool )
{
pObject = &gWorldItems[ gpItemPool->iItemIndex ].o;
if( pObject->usItem == ACTION_ITEM && pObject->bDetonatorType == BOMB_PRESSURE )
if( pObject->usItem == ACTION_ITEM && pObject->ItemData.Trigger.bDetonatorType == BOMB_PRESSURE )
{
SpecifyItemToEdit( pObject, gWorldItems[ gpItemPool->iItemIndex ].sGridNo );
CenterScreenAtMapIndex( gsItemGridNo );
@@ -1508,7 +1508,7 @@ UINT16 CountNumberOfItemsWithFrequency( UINT16 usItem, INT8 bFrequency )
while( pItemPool )
{
if( gWorldItems[ pItemPool->iItemIndex ].o.usItem == usItem &&
gWorldItems[ pItemPool->iItemIndex ].o.bFrequency == bFrequency )
gWorldItems[ pItemPool->iItemIndex ].o.ItemData.Trigger.BombTrigger.bFrequency == bFrequency )
{
num++;
}
@@ -1531,7 +1531,7 @@ UINT16 CountNumberOfPressureActionsInWorld()
while( pItemPool )
{
if( gWorldItems[ pItemPool->iItemIndex ].o.usItem == ACTION_ITEM &&
gWorldItems[ pItemPool->iItemIndex ].o.bDetonatorType == BOMB_PRESSURE )
gWorldItems[ pItemPool->iItemIndex ].o.ItemData.Trigger.bDetonatorType == BOMB_PRESSURE )
{
num++;
}
@@ -1592,7 +1592,7 @@ UINT16 CountNumberOfKeysOfTypeInWorld( UINT8 ubKeyID )
{
if( Item[ gWorldItems[ pItemPool->iItemIndex ].o.usItem ].usItemClass == IC_KEY )
{
if( gWorldItems[ pItemPool->iItemIndex ].o.ubKeyID == ubKeyID )
if( gWorldItems[ pItemPool->iItemIndex ].o.ItemData.Key.ubKeyID == ubKeyID )
{
num++;
}
+1 -1
View File
@@ -2767,7 +2767,7 @@ void AddNewItemToSelectedMercsInventory( BOOLEAN fCreate )
//randomize the status on non-ammo items.
if( !(Item[ gpSelected->pDetailedPlacement->Inv[ gbMercSlotTypes[ gbCurrSelect ] ].usItem ].usItemClass & IC_AMMO) )
gpSelected->pDetailedPlacement->Inv[ gbMercSlotTypes[ gbCurrSelect ] ].bStatus[0] = (INT8)(80 + Random( 21 ));
gpSelected->pDetailedPlacement->Inv[ gbMercSlotTypes[ gbCurrSelect ] ].ItemData.Generic.bStatus[0] = (INT8)(80 + Random( 21 ));
if( gusMercsNewItemIndex )
{
+93 -93
View File
@@ -81,9 +81,9 @@ const STR16 GetActionItemName( OBJECTTYPE *pItem )
{
if( !pItem || pItem->usItem != ACTION_ITEM )
return NULL;
if( pItem->bActionValue != ACTION_ITEM_BLOW_UP )
if( pItem->ItemData.Trigger.bActionValue != ACTION_ITEM_BLOW_UP )
{
switch( pItem->bActionValue )
switch( pItem->ItemData.Trigger.bActionValue )
{
case ACTION_ITEM_OPEN_DOOR: return gszActionItemDesc[ ACTIONITEM_OPEN ];
case ACTION_ITEM_CLOSE_DOOR: return gszActionItemDesc[ ACTIONITEM_CLOSE ];
@@ -111,7 +111,7 @@ const STR16 GetActionItemName( OBJECTTYPE *pItem )
default: return NULL;
}
}
else switch( pItem->usBombItem )
else switch( pItem->ItemData.Trigger.usBombItem )
{
case STUN_GRENADE: return gszActionItemDesc[ ACTIONITEM_STUN ];
case SMOKE_GRENADE: return gszActionItemDesc[ ACTIONITEM_SMOKE ];
@@ -535,7 +535,7 @@ void UpdateItemStatsPanel()
case EDITING_TRIGGERS:
mprintf( iScreenWidthOffset + 512, 2 * iScreenHeightOffset + 369, L"Trap Level");
mprintf( iScreenWidthOffset + 512, 2 * iScreenHeightOffset + 389, L"Tolerance" );
if( gpEditingItemPool && gpItem->bFrequency >= PANIC_FREQUENCY_3 && gpItem->bFrequency <= PANIC_FREQUENCY )
if( gpEditingItemPool && gpItem->ItemData.Trigger.BombTrigger.bFrequency >= PANIC_FREQUENCY_3 && gpItem->ItemData.Trigger.BombTrigger.bFrequency <= PANIC_FREQUENCY )
mprintf( iScreenWidthOffset + 500, 2 * iScreenHeightOffset + 407, L"Alarm Trigger" );
break;
}
@@ -644,9 +644,9 @@ void SetupGunGUI()
CHAR16 str[20];
INT16 yp;
memset( gfAttachment, 0, NUM_ATTACHMENT_BUTTONS );
swprintf( str, L"%d", gpItem->bGunStatus );
swprintf( str, L"%d", gpItem->ItemData.Gun.bGunStatus );
AddTextInputField( iScreenWidthOffset + 485, 2 * iScreenHeightOffset + 380, 25, 15, MSYS_PRIORITY_NORMAL, str, 3, INPUTTYPE_NUMERICSTRICT );
swprintf( str, L"%d", gpItem->ubGunShotsLeft );
swprintf( str, L"%d", gpItem->ItemData.Gun.ubGunShotsLeft );
AddTextInputField( iScreenWidthOffset + 485, 2 * iScreenHeightOffset + 400, 25, 15, MSYS_PRIORITY_NORMAL, str, 3, INPUTTYPE_NUMERICSTRICT );
swprintf( str, L"%d", gpItem->bTrap );
AddTextInputField( iScreenWidthOffset + 485, 2 * iScreenHeightOffset + 420, 25, 15, MSYS_PRIORITY_NORMAL, str, 2, INPUTTYPE_NUMERICSTRICT );
@@ -761,7 +761,7 @@ void ExtractAndUpdateGunGUI()
i = 20 + Random( 81 );
else
i = min( i, 100 );
gpItem->bGunStatus = (INT8)i;
gpItem->ItemData.Gun.bGunStatus = (INT8)i;
SetInputFieldStringWithNumericStrictValue( 1, i );
//Update the ammo
i = GetNumericStrictValueFromField( 2 );
@@ -769,7 +769,7 @@ void ExtractAndUpdateGunGUI()
i = Random( 1 + Weapon[ gpItem->usItem ].ubMagSize );
else
i = min( i, Weapon[ gpItem->usItem ].ubMagSize );
gpItem->ubGunShotsLeft = (UINT8)i;
gpItem->ItemData.Gun.ubGunShotsLeft = (UINT8)i;
SetInputFieldStringWithNumericStrictValue( 2, i );
//Update the trap level
i = GetNumericStrictValueFromField( 3 );
@@ -833,7 +833,7 @@ void ExtractAndUpdateAmmoGUI()
void SetupArmourGUI()
{
CHAR16 str[20];
swprintf( str, L"%d", gpItem->bStatus[0] );
swprintf( str, L"%d", gpItem->ItemData.Generic.bStatus[0] );
AddTextInputField( iScreenWidthOffset + 485, 2 * iScreenHeightOffset + 380, 25, 15, MSYS_PRIORITY_NORMAL, str, 3, INPUTTYPE_NUMERICSTRICT );
swprintf( str, L"%d", gpItem->bTrap );
AddTextInputField( iScreenWidthOffset + 485, 2 * iScreenHeightOffset + 400, 25, 15, MSYS_PRIORITY_NORMAL, str, 2, INPUTTYPE_NUMERICSTRICT );
@@ -875,7 +875,7 @@ void ExtractAndUpdateArmourGUI()
i = 20 + Random( 81 );
else
i = min( i, 100 );
gpItem->bStatus[0] = (INT8)i;
gpItem->ItemData.Generic.bStatus[0] = (INT8)i;
SetInputFieldStringWithNumericStrictValue( 1, i );
//Update the trap level
i = GetNumericStrictValueFromField( 2 );
@@ -894,7 +894,7 @@ void ExtractAndUpdateArmourGUI()
void SetupEquipGUI()
{
CHAR16 str[20];
swprintf( str, L"%d", gpItem->bStatus[0] );
swprintf( str, L"%d", gpItem->ItemData.Generic.bStatus[0] );
AddTextInputField( iScreenWidthOffset + 485, 2 * iScreenHeightOffset + 380, 25, 15, MSYS_PRIORITY_NORMAL, str, 3, INPUTTYPE_NUMERICSTRICT );
swprintf( str, L"%d", gpItem->bTrap );
AddTextInputField( iScreenWidthOffset + 485, 2 * iScreenHeightOffset + 400, 25, 15, MSYS_PRIORITY_NORMAL, str, 2, INPUTTYPE_NUMERICSTRICT );
@@ -919,7 +919,7 @@ void ExtractAndUpdateEquipGUI()
i = 20 + Random( 81 );
else
i = min( i, 100 );
gpItem->bStatus[0] = (INT8)i;
gpItem->ItemData.Generic.bStatus[0] = (INT8)i;
SetInputFieldStringWithNumericStrictValue( 1, i );
//Update the trap level
i = GetNumericStrictValueFromField( 2 );
@@ -939,7 +939,7 @@ void SetupExplosivesGUI()
{
CHAR16 str[20];
INT16 yp;
swprintf( str, L"%d", gpItem->bStatus[0] );
swprintf( str, L"%d", gpItem->ItemData.Generic.bStatus[0] );
AddTextInputField( iScreenWidthOffset + 485, 2 * iScreenHeightOffset + 380, 25, 15, MSYS_PRIORITY_NORMAL, str, 3, INPUTTYPE_NUMERICSTRICT );
swprintf( str, L"%d", gpItem->ubNumberOfObjects );
AddTextInputField( iScreenWidthOffset + 485, 2 * iScreenHeightOffset + 400, 25, 15, MSYS_PRIORITY_NORMAL, str, 1, INPUTTYPE_NUMERICSTRICT );
@@ -989,7 +989,7 @@ void ExtractAndUpdateExplosivesGUI()
i = 20 + Random( 81 );
else
i = min( i, 100 );
gpItem->bStatus[0] = (INT8)i;
gpItem->ItemData.Generic.bStatus[0] = (INT8)i;
SetInputFieldStringWithNumericStrictValue( 1, i );
//Update the quantity
if( Item[ gpItem->usItem ].ubPerPocket > 1 )
@@ -1001,7 +1001,7 @@ void ExtractAndUpdateExplosivesGUI()
i = max( 1, min( i, Item[ gpItem->usItem ].ubPerPocket ) );
gpItem->ubNumberOfObjects = (UINT8)i;
SetInputFieldStringWithNumericStrictValue( 2, i );
CreateItems( gpItem->usItem, gpItem->bStatus[0], gpItem->ubNumberOfObjects, gpItem );
CreateItems( gpItem->usItem, gpItem->ItemData.Generic.bStatus[0], gpItem->ubNumberOfObjects, gpItem );
}
//Update the trap level
i = GetNumericStrictValueFromField( 3 );
@@ -1020,7 +1020,7 @@ void ExtractAndUpdateExplosivesGUI()
void SetupMoneyGUI()
{
CHAR16 str[20];
swprintf( str, L"%d", gpItem->uiMoneyAmount );
swprintf( str, L"%d", gpItem->ItemData.Money.uiMoneyAmount );
AddTextInputField( iScreenWidthOffset + 485, 2 * iScreenHeightOffset + 380, 45, 15, MSYS_PRIORITY_NORMAL, str, 5, INPUTTYPE_NUMERICSTRICT );
if( gpEditingItemPool )
{
@@ -1038,8 +1038,8 @@ void ExtractAndUpdateMoneyGUI()
i = Random( 20000 );
else
i = max( 1, min( i, 20000 ) );
gpItem->uiMoneyAmount = i;
gpItem->bStatus[0] = 100;
gpItem->ItemData.Money.uiMoneyAmount = i;
gpItem->ItemData.Money.bMoneyStatus = 100;
SetInputFieldStringWithNumericStrictValue( 1, i );
if( gpEditingItemPool )
{
@@ -1058,10 +1058,10 @@ void RemoveMoneyGUI()
void SetupOwnershipGUI()
{
CHAR16 str[20];
swprintf( str, L"%d", gpItem->ubOwnerProfile );
swprintf( str, L"%d", gpItem->ItemData.Owner.ubOwnerProfile );
AddTextInputField( iScreenWidthOffset + 485, 2 * iScreenHeightOffset + 380, 25, 15, MSYS_PRIORITY_NORMAL, str, 3, INPUTTYPE_NUMERICSTRICT );
giOwnershipGroupButton =
CreateTextButton( gszCivGroupNames[ gpItem->ubOwnerCivGroup ], SMALLCOMPFONT, FONT_YELLOW, FONT_BLACK, BUTTON_USE_DEFAULT,
CreateTextButton( gszCivGroupNames[ gpItem->ItemData.Owner.ubOwnerCivGroup ], SMALLCOMPFONT, FONT_YELLOW, FONT_BLACK, BUTTON_USE_DEFAULT,
iScreenWidthOffset + 485, 2 * iScreenHeightOffset + 415, 80, 25, BUTTON_TOGGLE, MSYS_PRIORITY_NORMAL, DEFAULT_MOVE_CALLBACK, OwnershipGroupButtonCallback );
}
@@ -1075,7 +1075,7 @@ void OwnershipGroupButtonCallback( GUI_BUTTON *btn, INT32 reason )
void SetOwnershipGroup( UINT8 ubNewGroup )
{
gpItem->ubOwnerCivGroup = ubNewGroup;
gpItem->ItemData.Owner.ubOwnerCivGroup = ubNewGroup;
SpecifyButtonText( giOwnershipGroupButton, gszCivGroupNames[ ubNewGroup ] );
}
@@ -1088,7 +1088,7 @@ void ExtractAndUpdateOwnershipGUI()
i = Random( 0 );
else
i = max( 0, min( i, 255 ) );
gpItem->ubOwnerProfile = (UINT8)i;
gpItem->ItemData.Owner.ubOwnerProfile = (UINT8)i;
SetInputFieldStringWithNumericStrictValue( 1, i );
}
@@ -1131,7 +1131,7 @@ void SetupActionItemsGUI()
{
CHAR16 str[4];
STR16 pStr;
swprintf( str, L"%d", gpItem->bStatus[0] );
swprintf( str, L"%d", gpItem->ItemData.Generic.bStatus[0] );
AddTextInputField( iScreenWidthOffset + 485, 2 * iScreenHeightOffset + 365, 25, 15, MSYS_PRIORITY_NORMAL, str, 3, INPUTTYPE_NUMERICSTRICT );
swprintf( str, L"%d", gpItem->bTrap );
AddTextInputField( iScreenWidthOffset + 485, 2 * iScreenHeightOffset + 385, 25, 15, MSYS_PRIORITY_NORMAL, str, 2, INPUTTYPE_NUMERICSTRICT );
@@ -1155,7 +1155,7 @@ void ExtractAndUpdateActionItemsGUI()
i = 20 + Random( 81 );
else
i = min( i, 100 );
gpItem->bStatus[0] = (INT8)i;
gpItem->ItemData.Generic.bStatus[0] = (INT8)i;
SetInputFieldStringWithNumericStrictValue( 1, i );
//Update the trap level
i = GetNumericStrictValueFromField( 2 );
@@ -1199,13 +1199,13 @@ void SetupTriggersGUI()
CHAR16 str[4];
swprintf( str, L"%d", gpItem->bTrap );
AddTextInputField( iScreenWidthOffset + 485, 2 * iScreenHeightOffset + 365, 25, 15, MSYS_PRIORITY_NORMAL, str, 3, INPUTTYPE_NUMERICSTRICT );
swprintf( str, L"%d", gpItem->ubTolerance );
swprintf( str, L"%d", gpItem->ItemData.Trigger.Area.ubTolerance );
AddTextInputField( iScreenWidthOffset + 485, 2 * iScreenHeightOffset + 385, 25, 15, MSYS_PRIORITY_NORMAL, str, 3, INPUTTYPE_NUMERICSTRICT );
if( gpEditingItemPool )
{
swprintf( str, L"%d", 100 - gWorldItems[ gpEditingItemPool->iItemIndex ].ubNonExistChance );
AddTextInputField( iScreenWidthOffset + 485, 2 * iScreenHeightOffset + 440, 25, 15, MSYS_PRIORITY_NORMAL, str, 3, INPUTTYPE_NUMERICSTRICT );
if( gpItem->bFrequency <= PANIC_FREQUENCY && gpItem->bFrequency >= PANIC_FREQUENCY_3 )
if( gpItem->ItemData.Trigger.BombTrigger.bFrequency <= PANIC_FREQUENCY && gpItem->ItemData.Trigger.BombTrigger.bFrequency >= PANIC_FREQUENCY_3 )
{
giAlarmTriggerButton =
CreateCheckBoxButton( iScreenWidthOffset + 485, 2 * iScreenHeightOffset + 405, "EDITOR//smCheckBox.sti", MSYS_PRIORITY_NORMAL, AlarmTriggerCheckboxCallback );
@@ -1227,7 +1227,7 @@ void ExtractAndUpdateTriggersGUI()
i = GetNumericStrictValueFromField( 2 );
i = ( i == -1 ) ? 0 : max( 0, min( i, 99 ) );
gpItem->ubTolerance = (UINT8)i;
gpItem->ItemData.Trigger.Area.ubTolerance = (UINT8)i;
SetInputFieldStringWithNumericStrictValue( 2, i );
if( gpEditingItemPool )
@@ -1241,7 +1241,7 @@ void ExtractAndUpdateTriggersGUI()
void RemoveTriggersGUI()
{
if( gpEditingItemPool && gpItem->bFrequency <= PANIC_FREQUENCY && gpItem->bFrequency >= PANIC_FREQUENCY_3 )
if( gpEditingItemPool && gpItem->ItemData.Trigger.BombTrigger.bFrequency <= PANIC_FREQUENCY && gpItem->ItemData.Trigger.BombTrigger.bFrequency >= PANIC_FREQUENCY_3 )
{
if( giAlarmTriggerButton != -1 )
{
@@ -1276,7 +1276,7 @@ void ToggleAttachment( GUI_BUTTON *btn, INT32 reason )
{
gfAttachment[ i ] = TRUE;
btn->uiFlags |= BUTTON_CLICKED_ON;
CreateItem( usAttachment, gpItem->bGunStatus, &temp );
CreateItem( usAttachment, gpItem->ItemData.Gun.bGunStatus, &temp );
AttachObject( NULL, gpItem, &temp );
}
else
@@ -1303,7 +1303,7 @@ void ToggleCeramicPlates( GUI_BUTTON *btn, INT32 reason )
if( gfCeramicPlates )
{
btn->uiFlags |= BUTTON_CLICKED_ON;
CreateItem( CERAMIC_PLATES, gpItem->bStatus[0], &temp );
CreateItem( CERAMIC_PLATES, gpItem->ItemData.Generic.bStatus[0], &temp );
AttachObject( NULL, gpItem, &temp );
}
else
@@ -1326,7 +1326,7 @@ void ToggleDetonator( GUI_BUTTON *btn, INT32 reason )
{
gfDetonator = TRUE;
btn->uiFlags |= BUTTON_CLICKED_ON;
CreateItem( DETONATOR, gpItem->bStatus[0], &temp );
CreateItem( DETONATOR, gpItem->ItemData.Generic.bStatus[0], &temp );
AttachObject( NULL, gpItem, &temp );
}
else
@@ -1352,133 +1352,133 @@ void ActionItemCallback( GUI_BUTTON *btn, INT32 reason )
void ChangeActionItem( OBJECTTYPE *pItem, INT8 bActionItemIndex )
{
pItem->usItem = ACTION_ITEM;
pItem->bActionValue = ACTION_ITEM_BLOW_UP;
pItem->ItemData.Trigger.bActionValue = ACTION_ITEM_BLOW_UP;
switch( bActionItemIndex )
{
case ACTIONITEM_TRIP_KLAXON:
pItem->usBombItem = TRIP_KLAXON;
pItem->ItemData.Trigger.usBombItem = TRIP_KLAXON;
break;
case ACTIONITEM_FLARE:
pItem->usBombItem = TRIP_FLARE;
pItem->ItemData.Trigger.usBombItem = TRIP_FLARE;
break;
case ACTIONITEM_TEARGAS:
pItem->usBombItem = TEARGAS_GRENADE;
pItem->ItemData.Trigger.usBombItem = TEARGAS_GRENADE;
break;
case ACTIONITEM_STUN:
pItem->usBombItem = STUN_GRENADE;
pItem->ItemData.Trigger.usBombItem = STUN_GRENADE;
break;
case ACTIONITEM_SMOKE:
pItem->usBombItem = SMOKE_GRENADE;
pItem->ItemData.Trigger.usBombItem = SMOKE_GRENADE;
break;
case ACTIONITEM_MUSTARD:
pItem->usBombItem = MUSTARD_GRENADE;
pItem->ItemData.Trigger.usBombItem = MUSTARD_GRENADE;
break;
case ACTIONITEM_MINE:
pItem->usBombItem = MINE;
pItem->ItemData.Trigger.usBombItem = MINE;
break;
case ACTIONITEM_OPEN:
pItem->usBombItem = NOTHING;
pItem->bActionValue = ACTION_ITEM_OPEN_DOOR;
pItem->ItemData.Trigger.usBombItem = NOTHING;
pItem->ItemData.Trigger.bActionValue = ACTION_ITEM_OPEN_DOOR;
break;
case ACTIONITEM_CLOSE:
pItem->usBombItem = NOTHING;
pItem->bActionValue = ACTION_ITEM_CLOSE_DOOR;
pItem->ItemData.Trigger.usBombItem = NOTHING;
pItem->ItemData.Trigger.bActionValue = ACTION_ITEM_CLOSE_DOOR;
break;
case ACTIONITEM_UNLOCK_DOOR:
pItem->usBombItem = NOTHING;
pItem->bActionValue = ACTION_ITEM_UNLOCK_DOOR;
pItem->ItemData.Trigger.usBombItem = NOTHING;
pItem->ItemData.Trigger.bActionValue = ACTION_ITEM_UNLOCK_DOOR;
break;
case ACTIONITEM_TOGGLE_LOCK:
pItem->usBombItem = NOTHING;
pItem->bActionValue = ACTION_ITEM_TOGGLE_LOCK;
pItem->ItemData.Trigger.usBombItem = NOTHING;
pItem->ItemData.Trigger.bActionValue = ACTION_ITEM_TOGGLE_LOCK;
break;
case ACTIONITEM_UNTRAP_DOOR:
pItem->usBombItem = NOTHING;
pItem->bActionValue = ACTION_ITEM_UNTRAP_DOOR;
pItem->ItemData.Trigger.usBombItem = NOTHING;
pItem->ItemData.Trigger.bActionValue = ACTION_ITEM_UNTRAP_DOOR;
break;
case ACTIONITEM_TOGGLE_PRESSURE_ITEMS:
pItem->usBombItem = NOTHING;
pItem->bActionValue = ACTION_ITEM_TOGGLE_PRESSURE_ITEMS;
pItem->ItemData.Trigger.usBombItem = NOTHING;
pItem->ItemData.Trigger.bActionValue = ACTION_ITEM_TOGGLE_PRESSURE_ITEMS;
break;
case ACTIONITEM_SMPIT:
pItem->usBombItem = NOTHING;
pItem->bActionValue = ACTION_ITEM_SMALL_PIT;
pItem->ItemData.Trigger.usBombItem = NOTHING;
pItem->ItemData.Trigger.bActionValue = ACTION_ITEM_SMALL_PIT;
break;
case ACTIONITEM_LGPIT:
pItem->usBombItem = NOTHING;
pItem->bActionValue = ACTION_ITEM_LARGE_PIT;
pItem->ItemData.Trigger.usBombItem = NOTHING;
pItem->ItemData.Trigger.bActionValue = ACTION_ITEM_LARGE_PIT;
break;
case ACTIONITEM_TOGGLE_DOOR:
pItem->usBombItem = NOTHING;
pItem->bActionValue = ACTION_ITEM_TOGGLE_DOOR;
pItem->ItemData.Trigger.usBombItem = NOTHING;
pItem->ItemData.Trigger.bActionValue = ACTION_ITEM_TOGGLE_DOOR;
break;
case ACTIONITEM_TOGGLE_ACTION1:
pItem->usBombItem = NOTHING;
pItem->bActionValue = ACTION_ITEM_TOGGLE_ACTION1;
pItem->ItemData.Trigger.usBombItem = NOTHING;
pItem->ItemData.Trigger.bActionValue = ACTION_ITEM_TOGGLE_ACTION1;
break;
case ACTIONITEM_TOGGLE_ACTION2:
pItem->usBombItem = NOTHING;
pItem->bActionValue = ACTION_ITEM_TOGGLE_ACTION2;
pItem->ItemData.Trigger.usBombItem = NOTHING;
pItem->ItemData.Trigger.bActionValue = ACTION_ITEM_TOGGLE_ACTION2;
break;
case ACTIONITEM_TOGGLE_ACTION3:
pItem->usBombItem = NOTHING;
pItem->bActionValue = ACTION_ITEM_TOGGLE_ACTION3;
pItem->ItemData.Trigger.usBombItem = NOTHING;
pItem->ItemData.Trigger.bActionValue = ACTION_ITEM_TOGGLE_ACTION3;
break;
case ACTIONITEM_TOGGLE_ACTION4:
pItem->usBombItem = NOTHING;
pItem->bActionValue = ACTION_ITEM_TOGGLE_ACTION4;
pItem->ItemData.Trigger.usBombItem = NOTHING;
pItem->ItemData.Trigger.bActionValue = ACTION_ITEM_TOGGLE_ACTION4;
break;
case ACTIONITEM_ENTER_BROTHEL:
pItem->usBombItem = NOTHING;
pItem->bActionValue = ACTION_ITEM_ENTER_BROTHEL;
pItem->ItemData.Trigger.usBombItem = NOTHING;
pItem->ItemData.Trigger.bActionValue = ACTION_ITEM_ENTER_BROTHEL;
break;
case ACTIONITEM_EXIT_BROTHEL:
pItem->usBombItem = NOTHING;
pItem->bActionValue = ACTION_ITEM_EXIT_BROTHEL;
pItem->ItemData.Trigger.usBombItem = NOTHING;
pItem->ItemData.Trigger.bActionValue = ACTION_ITEM_EXIT_BROTHEL;
break;
case ACTIONITEM_KINGPIN_ALARM:
pItem->usBombItem = NOTHING;
pItem->bActionValue = ACTION_ITEM_KINGPIN_ALARM;
pItem->ItemData.Trigger.usBombItem = NOTHING;
pItem->ItemData.Trigger.bActionValue = ACTION_ITEM_KINGPIN_ALARM;
break;
case ACTIONITEM_SEX:
pItem->usBombItem = NOTHING;
pItem->bActionValue = ACTION_ITEM_SEX;
pItem->ItemData.Trigger.usBombItem = NOTHING;
pItem->ItemData.Trigger.bActionValue = ACTION_ITEM_SEX;
break;
case ACTIONITEM_REVEAL_ROOM:
pItem->usBombItem = NOTHING;
pItem->bActionValue = ACTION_ITEM_REVEAL_ROOM;
pItem->ItemData.Trigger.usBombItem = NOTHING;
pItem->ItemData.Trigger.bActionValue = ACTION_ITEM_REVEAL_ROOM;
break;
case ACTIONITEM_LOCAL_ALARM:
pItem->usBombItem = NOTHING;
pItem->bActionValue = ACTION_ITEM_LOCAL_ALARM;
pItem->ItemData.Trigger.usBombItem = NOTHING;
pItem->ItemData.Trigger.bActionValue = ACTION_ITEM_LOCAL_ALARM;
break;
case ACTIONITEM_GLOBAL_ALARM:
pItem->usBombItem = NOTHING;
pItem->bActionValue = ACTION_ITEM_GLOBAL_ALARM;
pItem->ItemData.Trigger.usBombItem = NOTHING;
pItem->ItemData.Trigger.bActionValue = ACTION_ITEM_GLOBAL_ALARM;
break;
case ACTIONITEM_KLAXON:
pItem->usBombItem = NOTHING;
pItem->bActionValue = ACTION_ITEM_KLAXON;
pItem->ItemData.Trigger.usBombItem = NOTHING;
pItem->ItemData.Trigger.bActionValue = ACTION_ITEM_KLAXON;
break;
case ACTIONITEM_SMALL:
pItem->usBombItem = HAND_GRENADE;
pItem->ItemData.Trigger.usBombItem = HAND_GRENADE;
break;
case ACTIONITEM_MEDIUM:
pItem->usBombItem = TNT;
pItem->ItemData.Trigger.usBombItem = TNT;
break;
case ACTIONITEM_LARGE:
pItem->usBombItem = C4;
pItem->ItemData.Trigger.usBombItem = C4;
break;
case ACTIONITEM_MUSEUM_ALARM:
pItem->usBombItem = NOTHING;
pItem->bActionValue = ACTION_ITEM_MUSEUM_ALARM;
pItem->ItemData.Trigger.usBombItem = NOTHING;
pItem->ItemData.Trigger.bActionValue = ACTION_ITEM_MUSEUM_ALARM;
break;
case ACTIONITEM_BLOODCAT_ALARM:
pItem->usBombItem = NOTHING;
pItem->bActionValue = ACTION_ITEM_BLOODCAT_ALARM;
pItem->ItemData.Trigger.usBombItem = NOTHING;
pItem->ItemData.Trigger.bActionValue = ACTION_ITEM_BLOODCAT_ALARM;
break;
case ACTIONITEM_BIG_TEAR_GAS:
pItem->usBombItem = BIG_TEAR_GAS;
pItem->ItemData.Trigger.usBombItem = BIG_TEAR_GAS;
break;
}
@@ -1494,9 +1494,9 @@ void UpdateActionItem( INT8 bActionItemIndex )
//If the previous item was a pit, remove it before changing it
if( gpItem->usItem == ACTION_ITEM )
{
if( gpItem->bActionValue == ACTION_ITEM_SMALL_PIT )
if( gpItem->ItemData.Trigger.bActionValue == ACTION_ITEM_SMALL_PIT )
Remove3X3Pit( gWorldItems[ gpItemPool->iItemIndex ].sGridNo );
else if( gpItem->bActionValue == ACTION_ITEM_LARGE_PIT )
else if( gpItem->ItemData.Trigger.bActionValue == ACTION_ITEM_LARGE_PIT )
Remove5X5Pit( gWorldItems[ gpItemPool->iItemIndex ].sGridNo );
}
@@ -1506,9 +1506,9 @@ void UpdateActionItem( INT8 bActionItemIndex )
//If the new item is a pit, add it so we can see how it looks.
if( gpItem->usItem == ACTION_ITEM )
{
if( gpItem->bActionValue == ACTION_ITEM_SMALL_PIT )
if( gpItem->ItemData.Trigger.bActionValue == ACTION_ITEM_SMALL_PIT )
Add3X3Pit( gWorldItems[ gpItemPool->iItemIndex ].sGridNo );
else if( gpItem->bActionValue == ACTION_ITEM_LARGE_PIT )
else if( gpItem->ItemData.Trigger.bActionValue == ACTION_ITEM_LARGE_PIT )
Add5X5Pit( gWorldItems[ gpItemPool->iItemIndex ].sGridNo );
}
}
+11 -11
View File
@@ -715,21 +715,21 @@ void RenderItemDetails()
gubSummaryItemMode == ITEMMODE_REAL && !(gpWorldItemsSummaryArray[ i ].usFlags & WORLD_ITEM_SCIFI_ONLY) )
{
pItem = &gpWorldItemsSummaryArray[ i ].o;
if( !pItem->bFrequency )
if( !pItem->ItemData.Trigger.BombTrigger.bFrequency )
bFreqIndex = 7;
else if( pItem->bFrequency == PANIC_FREQUENCY )
else if( pItem->ItemData.Trigger.BombTrigger.bFrequency == PANIC_FREQUENCY )
bFreqIndex = 0;
else if( pItem->bFrequency == PANIC_FREQUENCY_2 )
else if( pItem->ItemData.Trigger.BombTrigger.bFrequency == PANIC_FREQUENCY_2 )
bFreqIndex = 1;
else if( pItem->bFrequency == PANIC_FREQUENCY_3 )
else if( pItem->ItemData.Trigger.BombTrigger.bFrequency == PANIC_FREQUENCY_3 )
bFreqIndex = 2;
else if( pItem->bFrequency == FIRST_MAP_PLACED_FREQUENCY + 1 )
else if( pItem->ItemData.Trigger.BombTrigger.bFrequency == FIRST_MAP_PLACED_FREQUENCY + 1 )
bFreqIndex = 3;
else if( pItem->bFrequency == FIRST_MAP_PLACED_FREQUENCY + 2 )
else if( pItem->ItemData.Trigger.BombTrigger.bFrequency == FIRST_MAP_PLACED_FREQUENCY + 2 )
bFreqIndex = 4;
else if( pItem->bFrequency == FIRST_MAP_PLACED_FREQUENCY + 3 )
else if( pItem->ItemData.Trigger.BombTrigger.bFrequency == FIRST_MAP_PLACED_FREQUENCY + 3 )
bFreqIndex = 5;
else if( pItem->bFrequency == FIRST_MAP_PLACED_FREQUENCY + 4 )
else if( pItem->ItemData.Trigger.BombTrigger.bFrequency == FIRST_MAP_PLACED_FREQUENCY + 4 )
bFreqIndex = 6;
else
continue;
@@ -754,7 +754,7 @@ void RenderItemDetails()
{
pItem = &gpWorldItemsSummaryArray[ i ].o;
uiExistChance += (100 - gpWorldItemsSummaryArray[ i ].ubNonExistChance) * pItem->ubNumberOfObjects;
uiStatus += pItem->bStatus[0];
uiStatus += pItem->ItemData.Generic.bStatus[0];
uiQuantity += pItem->ubNumberOfObjects;
}
}
@@ -862,7 +862,7 @@ void RenderItemDetails()
{
pItem = &gpPEnemyItemsSummaryArray[ i ];
uiExistChance += 100 * pItem->ubNumberOfObjects;
uiStatus += pItem->bStatus[0];
uiStatus += pItem->ItemData.Generic.bStatus[0];
uiQuantity += pItem->ubNumberOfObjects;
}
}
@@ -934,7 +934,7 @@ void RenderItemDetails()
{
pItem = &gpNEnemyItemsSummaryArray[ i ];
uiExistChance += 100 * pItem->ubNumberOfObjects;
uiStatus += pItem->bStatus[0];
uiStatus += pItem->ItemData.Generic.bStatus[0];
uiQuantity += pItem->ubNumberOfObjects;
}
}
+11 -11
View File
@@ -2543,12 +2543,12 @@ void RenderInventoryForCharacter( INT32 iId, INT32 iSlot )
for( cnt = 0; cnt < pSoldier->inv[ ubCounter ].ubNumberOfObjects; cnt++ )
{
// get total ammo
iTotalAmmo+= pSoldier->inv[ ubCounter ].ubShotsLeft[cnt];
iTotalAmmo+= pSoldier->inv[ ubCounter ].ItemData.Ammo.ubShotsLeft[cnt];
}
}
else
{
iTotalAmmo= pSoldier->inv[ ubCounter ].ubShotsLeft[ 0 ];
iTotalAmmo= pSoldier->inv[ ubCounter ].ItemData.Ammo.ubShotsLeft[ 0 ];
}
swprintf( sString, L"%d/%d", iTotalAmmo, ( pSoldier->inv[ ubCounter ].ubNumberOfObjects * Magazine[ Item[pSoldier->inv[ ubCounter ].usItem ].ubClassIndex ].ubMagSize ) );
@@ -2557,7 +2557,7 @@ void RenderInventoryForCharacter( INT32 iId, INT32 iSlot )
}
else
{
swprintf( sString, L"%2d%%%%", pSoldier->inv[ ubCounter ].bStatus[0] );
swprintf( sString, L"%2d%%%%", pSoldier->inv[ ubCounter ].ItemData.Generic.bStatus[0] );
FindFontRightCoordinates( ( INT16 )( PosX + 65 ), ( INT16 ) ( PosY + 15 ), ( INT16 ) ( 171 - 75 ),
( INT16 )( GetFontHeight( FONT10ARIAL ) ), sString, FONT10ARIAL, &sX, &sY );
@@ -6439,7 +6439,7 @@ INT32 GetFundsOnMerc( SOLDIERTYPE *pSoldier )
{
if ( Item[ pSoldier->inv[ iCurrentPocket ] .usItem ].usItemClass == IC_MONEY )
{
iCurrentAmount += pSoldier->inv[ iCurrentPocket ].uiMoneyAmount;
iCurrentAmount += pSoldier->inv[ iCurrentPocket ].ItemData.Money.uiMoneyAmount;
}
}
@@ -6468,15 +6468,15 @@ BOOLEAN TransferFundsFromMercToBank( SOLDIERTYPE *pSoldier, INT32 iCurrentBalanc
{
// is there more left to go, or does this pocket finish it off?
if( pSoldier->inv[ iCurrentPocket ].uiMoneyAmount > ( UINT32 )iAmountLeftToTake )
if( pSoldier->inv[ iCurrentPocket ].ItemData.Money.uiMoneyAmount > ( UINT32 )iAmountLeftToTake )
{
pSoldier->inv[ iCurrentPocket ].uiMoneyAmount -= iAmountLeftToTake;
pSoldier->inv[ iCurrentPocket ].ItemData.Money.uiMoneyAmount -= iAmountLeftToTake;
iAmountLeftToTake = 0;
}
else
{
iAmountLeftToTake -= pSoldier->inv[ iCurrentPocket ].uiMoneyAmount;
pSoldier->inv[ iCurrentPocket ].uiMoneyAmount = 0;
iAmountLeftToTake -= pSoldier->inv[ iCurrentPocket ].ItemData.Money.uiMoneyAmount;
pSoldier->inv[ iCurrentPocket ].ItemData.Money.uiMoneyAmount = 0;
//Remove the item out off the merc
RemoveObjectFromSlot( pSoldier, (INT8)iCurrentPocket, &ObjectToRemove );
@@ -6529,9 +6529,9 @@ BOOLEAN TransferFundsFromBankToMerc( SOLDIERTYPE *pSoldier, INT32 iCurrentBalanc
// set up money object
pMoneyObject.usItem = MONEY;
pMoneyObject.ubNumberOfObjects = 1;
pMoneyObject.bMoneyStatus = 100;
pMoneyObject. bStatus[0] = 100;
pMoneyObject.uiMoneyAmount = iCurrentBalance;
pMoneyObject.ItemData.Money.bMoneyStatus = 100;
//pMoneyObject.ItemData.Generic.bStatus[0] = 100; // Isn't this the same as the previous line?
pMoneyObject.ItemData.Money.uiMoneyAmount = iCurrentBalance;
// now auto place money object
+9 -9
View File
@@ -764,7 +764,7 @@ BOOLEAN DoesCharacterHaveAnyItemsToRepair( SOLDIERTYPE *pSoldier, INT8 bHighestP
for( ubObjectInPocketCounter = 0; ubObjectInPocketCounter < ubItemsInPocket; ubObjectInPocketCounter++ )
{
// jammed gun?
if ( ( Item[ pSoldier -> inv[ bPocket ].usItem ].usItemClass == IC_GUN ) && ( pSoldier -> inv[ bPocket ].bGunAmmoStatus < 0 ) )
if ( ( Item[ pSoldier -> inv[ bPocket ].usItem ].usItemClass == IC_GUN ) && ( pSoldier -> inv[ bPocket ].ItemData.Gun.bGunAmmoStatus < 0 ) )
{
return( TRUE );
}
@@ -782,7 +782,7 @@ BOOLEAN DoesCharacterHaveAnyItemsToRepair( SOLDIERTYPE *pSoldier, INT8 bHighestP
for( ubObjectInPocketCounter = 0; ubObjectInPocketCounter < ubItemsInPocket; ubObjectInPocketCounter++ )
{
// if it's repairable and NEEDS repairing
if ( IsItemRepairable( pObj->usItem, pObj->bStatus[ubObjectInPocketCounter] ) )
if ( IsItemRepairable( pObj->usItem, pObj->ItemData.Generic.bStatus[ubObjectInPocketCounter] ) )
{
return( TRUE );
}
@@ -818,7 +818,7 @@ BOOLEAN DoesCharacterHaveAnyItemsToRepair( SOLDIERTYPE *pSoldier, INT8 bHighestP
for ( bPocket = HANDPOS; bPocket <= SMALLPOCK8POS; bPocket++ )
{
// the object a weapon? and jammed?
if ( ( Item[ pOtherSoldier->inv[ bPocket ].usItem ].usItemClass == IC_GUN ) && ( pOtherSoldier->inv[ bPocket ].bGunAmmoStatus < 0 ) )
if ( ( Item[ pOtherSoldier->inv[ bPocket ].usItem ].usItemClass == IC_GUN ) && ( pOtherSoldier->inv[ bPocket ].ItemData.Gun.bGunAmmoStatus < 0 ) )
{
return( TRUE );
}
@@ -2981,7 +2981,7 @@ INT8 FindRepairableItemOnOtherSoldier( SOLDIERTYPE * pSoldier, UINT8 ubPassType
pObj = &( pSoldier->inv[ bSlotToCheck ] );
for ( bLoop2 = 0; bLoop2 < pSoldier->inv[ bSlotToCheck ].ubNumberOfObjects; bLoop2++ )
{
if ( IsItemRepairable( pObj->usItem, pObj->bStatus[bLoop2] ) )
if ( IsItemRepairable( pObj->usItem, pObj->ItemData.Generic.bStatus[bLoop2] ) )
{
return( bSlotToCheck );
}
@@ -3074,16 +3074,16 @@ BOOLEAN RepairObject( SOLDIERTYPE * pSoldier, SOLDIERTYPE * pOwner, OBJECTTYPE *
for ( ubLoop = 0; ubLoop < ubItemsInPocket; ubLoop++ )
{
// if it's repairable and NEEDS repairing
if ( IsItemRepairable( pObj->usItem, pObj->bStatus[ubLoop] ) )
if ( IsItemRepairable( pObj->usItem, pObj->ItemData.Generic.bStatus[ubLoop] ) )
{
// repairable, try to repair it
//void DoActualRepair( SOLDIERTYPE * pSoldier, UINT16 usItem, INT8 * pbStatus, UINT8 * pubRepairPtsLeft )
DoActualRepair( pSoldier, pObj->usItem, &(pObj->bStatus[ ubLoop ]), pubRepairPtsLeft );
DoActualRepair( pSoldier, pObj->usItem, &(pObj->ItemData.Generic.bStatus[ ubLoop ]), pubRepairPtsLeft );
fSomethingWasRepaired = TRUE;
if ( pObj->bStatus[ ubLoop ] == 100 )
if ( pObj->ItemData.Generic.bStatus[ ubLoop ] == 100 )
{
// report it as fixed
if ( pSoldier == pOwner )
@@ -11545,13 +11545,13 @@ BOOLEAN UnjamGunsOnSoldier( SOLDIERTYPE *pOwnerSoldier, SOLDIERTYPE *pRepairSold
for (bPocket = HANDPOS; bPocket <= SMALLPOCK8POS; bPocket++)
{
// the object a weapon? and jammed?
if ( ( Item[ pOwnerSoldier->inv[ bPocket ].usItem ].usItemClass == IC_GUN ) && ( pOwnerSoldier->inv[ bPocket ].bGunAmmoStatus < 0 ) )
if ( ( Item[ pOwnerSoldier->inv[ bPocket ].usItem ].usItemClass == IC_GUN ) && ( pOwnerSoldier->inv[ bPocket ].ItemData.Gun.bGunAmmoStatus < 0 ) )
{
if ( *pubRepairPtsLeft >= gGameExternalOptions.ubRepairCostPerJam )
{
*pubRepairPtsLeft -= gGameExternalOptions.ubRepairCostPerJam;
pOwnerSoldier->inv [ bPocket ].bGunAmmoStatus *= -1;
pOwnerSoldier->inv [ bPocket ].ItemData.Gun.bGunAmmoStatus *= -1;
// MECHANICAL/DEXTERITY GAIN: Unjammed a gun
StatChange( pRepairSoldier, MECHANAMT, 5, FALSE );
+5 -5
View File
@@ -3931,15 +3931,15 @@ BOOLEAN FireAShot( SOLDIERCELL *pAttacker )
PlayAutoResolveSample( Weapon[ pItem->usItem ].sSound, RATE_11025, 50, 1, MIDDLEPAN );
return TRUE;
}
if( !pItem->ubGunShotsLeft )
if( !pItem->ItemData.Gun.ubGunShotsLeft )
{
AutoReload( pSoldier );
if ( pItem->ubGunShotsLeft && Weapon[ pItem->usItem ].sLocknLoadSound )
if ( pItem->ItemData.Gun.ubGunShotsLeft && Weapon[ pItem->usItem ].sLocknLoadSound )
{
PlayAutoResolveSample( Weapon[ pItem->usItem ].sLocknLoadSound, RATE_11025, 50, 1, MIDDLEPAN );
}
}
if( pItem->ubGunShotsLeft )
if( pItem->ItemData.Gun.ubGunShotsLeft )
{
PlayAutoResolveSample( Weapon[ pItem->usItem ].sSound, RATE_11025, 50, 1, MIDDLEPAN );
if( pAttacker->uiFlags & CELL_MERC )
@@ -3949,7 +3949,7 @@ BOOLEAN FireAShot( SOLDIERCELL *pAttacker )
StatChange( pAttacker->pSoldier, MARKAMT, 3, FALSE );
}
pItem->ubGunShotsLeft--;
pItem->ItemData.Gun.ubGunShotsLeft--;
return TRUE;
}
}
@@ -3986,7 +3986,7 @@ BOOLEAN TargetHasLoadedGun( SOLDIERTYPE *pSoldier )
{
return TRUE;
}
if( pItem->ubGunShotsLeft )
if( pItem->ItemData.Gun.ubGunShotsLeft )
{
return TRUE;
}
@@ -1516,7 +1516,7 @@ BOOLEAN GetObjFromInventoryStashSlot( OBJECTTYPE *pInventorySlot, OBJECTTYPE *pI
pItemPtr->usItem = pInventorySlot->usItem;
// find first unempty slot
pItemPtr->bStatus[0] = pInventorySlot->bStatus[0];
pItemPtr->ItemData.Generic.bStatus[0] = pInventorySlot->ItemData.Generic.bStatus[0];
pItemPtr->ubNumberOfObjects = 1;
pItemPtr->ubWeight = CalculateObjectWeight( pItemPtr );
RemoveObjFrom( pInventorySlot, 0 );
@@ -1573,7 +1573,7 @@ BOOLEAN PlaceObjectInInventoryStash( OBJECTTYPE *pInventorySlot, OBJECTTYPE *pIt
// in the InSlot copy, zero out all the objects we didn't drop
for (ubLoop = ubNumberToDrop; ubLoop < pItemPtr->ubNumberOfObjects; ubLoop++)
{
pInventorySlot->bStatus[ubLoop] = 0;
pInventorySlot->ItemData.Generic.bStatus[ubLoop] = 0;
}
}
pInventorySlot->ubNumberOfObjects = ubNumberToDrop;
@@ -1594,8 +1594,8 @@ BOOLEAN PlaceObjectInInventoryStash( OBJECTTYPE *pInventorySlot, OBJECTTYPE *pIt
{
// always allow money to be combined!
// average out the status values using a weighted average...
pInventorySlot->bStatus[0] = (INT8) ( ( (UINT32)pInventorySlot->bMoneyStatus * pInventorySlot->uiMoneyAmount + (UINT32)pItemPtr->bMoneyStatus * pItemPtr->uiMoneyAmount )/ (pInventorySlot->uiMoneyAmount + pItemPtr->uiMoneyAmount) );
pInventorySlot->uiMoneyAmount += pItemPtr->uiMoneyAmount;
pInventorySlot->ItemData.Generic.bStatus[0] = (INT8) ( ( (UINT32)pInventorySlot->ItemData.Money.bMoneyStatus * pInventorySlot->ItemData.Money.uiMoneyAmount + (UINT32)pItemPtr->ItemData.Money.bMoneyStatus * pItemPtr->ItemData.Money.uiMoneyAmount )/ (pInventorySlot->ItemData.Money.uiMoneyAmount + pItemPtr->ItemData.Money.uiMoneyAmount) );
pInventorySlot->ItemData.Money.uiMoneyAmount += pItemPtr->ItemData.Money.uiMoneyAmount;
DeleteObj( pItemPtr );
}
@@ -1654,7 +1654,7 @@ BOOLEAN AutoPlaceObjectInInventoryStash( OBJECTTYPE *pItemPtr )
// in the InSlot copy, zero out all the objects we didn't drop
for (ubLoop = ubNumberToDrop; ubLoop < pItemPtr->ubNumberOfObjects; ubLoop++)
{
pInventorySlot->bStatus[ubLoop] = 0;
pInventorySlot->ItemData.Generic.bStatus[ubLoop] = 0;
}
}
pInventorySlot->ubNumberOfObjects = ubNumberToDrop;
@@ -2238,8 +2238,8 @@ INT32 MapScreenSectorInventoryCompare( const void *pNum1, const void *pNum2)
usItem1Index = pFirst->o.usItem;
usItem2Index = pSecond->o.usItem;
ubItem1Quality = pFirst->o.bStatus[ 0 ];
ubItem2Quality = pSecond->o.bStatus[ 0 ];
ubItem1Quality = pFirst->o.ItemData.Generic.bStatus[ 0 ];
ubItem2Quality = pSecond->o.ItemData.Generic.bStatus[ 0 ];
return( CompareItemsForSorting( usItem1Index, usItem2Index, ubItem1Quality, ubItem2Quality ) );
}
@@ -2282,6 +2282,10 @@ void DeleteAllItemsInInventoryPool()
ClearUpTempUnSeenList( );
SaveSeenAndUnseenItems();
iCurrentInventoryPoolPage = 0;
iLastInventoryPoolPage = 0;
DestroyStash();
BuildStashForSelectedSector( sSelMapX, sSelMapY, iCurrentMapSectorZ);
}
@@ -2315,7 +2319,7 @@ INT32 SellItem( OBJECTTYPE& object )
UINT8 magSize = Magazine[ Item[ usItemType ].ubClassIndex ].ubMagSize;
for (INT8 bLoop = 0; bLoop < object.ubNumberOfObjects; bLoop++)
{
iPrice += (INT32)( itemPrice * (float) object.ubShotsLeft[bLoop] / magSize );
iPrice += (INT32)( itemPrice * (float) object.ItemData.Ammo.ubShotsLeft[bLoop] / magSize );
}
}
else
@@ -2323,7 +2327,7 @@ INT32 SellItem( OBJECTTYPE& object )
//we are selling a gun or something - it could be stacked or single, and each one could have attachments
for (INT8 bLoop = 0; bLoop < object.ubNumberOfObjects; bLoop++)
{
iPrice += ( itemPrice * object.bStatus[bLoop] / 100 );
iPrice += ( itemPrice * object.ItemData.Generic.bStatus[bLoop] / 100 );
for (INT8 numAttachments = 0; numAttachments < MAX_ATTACHMENTS; numAttachments++)
{
+4 -1
View File
@@ -1218,7 +1218,10 @@ void AddPossiblePendingEnemiesToBattle()
// Assume we added one since there are supposedly more available and room for them
ubSlots--;
}
return;
// It's probable that the "pending enemies" flag isn't working right. So we'll go ahead and continue into
// the group insertion code from here.
//return;
}
if( pSector->ubNumElites + pSector->ubNumTroops + pSector->ubNumAdmins )
+10 -10
View File
@@ -189,7 +189,7 @@ void BobbyRayPurchaseEventCallback( UINT8 ubOrderID )
{
// Empty out the bullets put in by CreateItem(). We now sell all guns empty of bullets. This is done for BobbyR
// simply to be consistent with the dealers in Arulco, who must sell guns empty to prevent ammo cheats by players.
Object.ubGunShotsLeft = 0;
Object.ItemData.Gun.ubGunShotsLeft = 0;
}
ubItemsDelivered = 0;
@@ -220,11 +220,11 @@ void BobbyRayPurchaseEventCallback( UINT8 ubOrderID )
if (usStandardMapPos == LOST_SHIPMENT_GRIDNO)
{
// damage the item a random amount!
Object.bStatus[0] = (INT8) ( ( (70 + Random( 11 )) * (INT32) Object.bStatus[0] ) / 100 );
Object.ItemData.Generic.bStatus[0] = (INT8) ( ( (70 + Random( 11 )) * (INT32) Object.ItemData.Generic.bStatus[0] ) / 100 );
// make damn sure it can't hit 0
if (Object.bStatus[0] == 0)
if (Object.ItemData.Generic.bStatus[0] == 0)
{
Object.bStatus[0] = 1;
Object.ItemData.Generic.bStatus[0] = 1;
}
AddItemToPool( usMapPos, &Object, -1, 0, 0, 0 );
}
@@ -254,11 +254,11 @@ void BobbyRayPurchaseEventCallback( UINT8 ubOrderID )
if (usStandardMapPos == LOST_SHIPMENT_GRIDNO)
{
// damage the item a random amount!
Object.bStatus[0] = (INT8) ( ( (70 + Random( 11 )) * (INT32) Object.bStatus[0] ) / 100 );
Object.ItemData.Generic.bStatus[0] = (INT8) ( ( (70 + Random( 11 )) * (INT32) Object.ItemData.Generic.bStatus[0] ) / 100 );
// make damn sure it can't hit 0
if (Object.bStatus[0] == 0)
if (Object.ItemData.Generic.bStatus[0] == 0)
{
Object.bStatus[0] = 1;
Object.ItemData.Generic.bStatus[0] = 1;
}
memcpy( &pObject[ uiCount ], &Object, sizeof( OBJECTTYPE ) );
uiCount++;
@@ -559,7 +559,7 @@ void CheckForKingpinsMoneyMissing( BOOLEAN fFirstCheck )
// loop through all items, look for ownership
if ( gWorldItems[ uiLoop ].fExists && gWorldItems[ uiLoop ].o.usItem == MONEY )
{
uiTotalCash += gWorldItems[uiLoop].o.uiMoneyAmount;
uiTotalCash += gWorldItems[uiLoop].o.ItemData.Money.uiMoneyAmount;
}
}
@@ -1043,14 +1043,14 @@ void CheckForMissingHospitalSupplies( void )
for ( uiLoop = 0; uiLoop < guiNumWorldItems; uiLoop++ )
{
// loop through all items, look for ownership
if ( gWorldItems[ uiLoop ].fExists && gWorldItems[ uiLoop ].o.usItem == OWNERSHIP && gWorldItems[ uiLoop ].o.ubOwnerCivGroup == DOCTORS_CIV_GROUP )
if ( gWorldItems[ uiLoop ].fExists && gWorldItems[ uiLoop ].o.usItem == OWNERSHIP && gWorldItems[ uiLoop ].o.ItemData.Owner.ubOwnerCivGroup == DOCTORS_CIV_GROUP )
{
GetItemPool( gWorldItems[ uiLoop ].sGridNo, &pItemPool, 0 ) ;
while( pItemPool )
{
pObj = &( gWorldItems[ pItemPool->iItemIndex ].o );
if ( pObj->bStatus[ 0 ] > 60 )
if ( pObj->ItemData.Generic.bStatus[ 0 ] > 60 )
{
if ( Item[pObj->usItem].firstaidkit || Item[pObj->usItem].medicalkit || pObj->usItem == REGEN_BOOSTER || pObj->usItem == ADRENALINE_BOOSTER )
{
+4 -4
View File
@@ -4543,17 +4543,17 @@ void AddFuelToVehicle( SOLDIERTYPE *pSoldier, SOLDIERTYPE *pVehicle )
{ //Message for vehicle full?
return;
}
if( pItem->bStatus )
if( pItem->ItemData.Generic.bStatus )
{ //Fill 'er up.
sFuelNeeded = 10000 - pVehicle->sBreathRed;
sFuelAvailable = pItem->bStatus[0] * 50;
sFuelAvailable = pItem->ItemData.Generic.bStatus[0] * 50;
sFuelAdded = min( sFuelNeeded, sFuelAvailable );
//Add to vehicle
pVehicle->sBreathRed += sFuelAdded;
pVehicle->bBreath = (INT8)(pVehicle->sBreathRed / 100);
//Subtract from item
pItem->bStatus[0] = (INT8)(pItem->bStatus[0] - sFuelAdded / 50);
if( !pItem->bStatus[0] )
pItem->ItemData.Generic.bStatus[0] = (INT8)(pItem->ItemData.Generic.bStatus[0] - sFuelAdded / 50);
if( !pItem->ItemData.Generic.bStatus[0] )
{ //Gas can is empty, so toast the item.
DeleteObj( pItem );
}
+1 -1
View File
@@ -5230,7 +5230,7 @@ void GetMapKeyboardInput( UINT32 *puiNewEvent )
SOLDIERTYPE *pSoldier = MercPtrs[ gCharactersList[ bSelectedInfoChar ].usSolID ];
if ( pSoldier->inv[ HANDPOS ].usItem != 0 )
{
pSoldier->inv[ HANDPOS ].bStatus[ 0 ] = 2;
pSoldier->inv[ HANDPOS ].ItemData.Generic.bStatus[ 0 ] = 2;
}
}
}
+12 -1
View File
@@ -1741,6 +1741,11 @@ BOOLEAN SetCurrentWorldSector( INT16 sMapX, INT16 sMapY, INT8 bMapZ )
PrepareEnemyForSectorBattle();
}
for (int i=0; i<TOTAL_SOLDIERS; i++)
{
Assert( !MercPtrs[i]->bActive || !MercPtrs[i]->bInSector || MercPtrs[i]->sGridNo != NOWHERE);
}
if( gubNumCreaturesAttackingTown && !gbWorldSectorZ &&
gubSectorIDOfCreatureAttack == SECTOR( gWorldSectorX, gWorldSectorY ) )
{
@@ -1755,7 +1760,7 @@ BOOLEAN SetCurrentWorldSector( INT16 sMapX, INT16 sMapY, INT8 bMapZ )
// Check for helicopter being on the ground in this sector...
HandleHelicopterOnGroundGraphic( );
// 0verhaul: Okay, it is apparent that the enemies are not reset incorrectly. So I will now try to add symmetry
// 0verhaul: Okay, it is apparent that the enemies are not reset correctly. So I will now try to add symmetry
// between enemy placement and militia placement. The enemies do have one advantage here, though: If a sector
// is in enemy hands, then their sector is not actually loaded. At least not normally. Perhaps it would be useful
// to lose a battle with one group of mercs, then bring in another group without changing to another sector to see
@@ -1766,6 +1771,12 @@ BOOLEAN SetCurrentWorldSector( INT16 sMapX, INT16 sMapY, INT8 bMapZ )
// except for the case of training new militia. But that case can be handled each time militia training finishes.
// ResetMilitia();
AllTeamsLookForAll( TRUE );
for (int i=0; i<TOTAL_SOLDIERS; i++)
{
Assert( !MercPtrs[i]->bActive || !MercPtrs[i]->bInSector || MercPtrs[i]->sGridNo != NOWHERE);
}
return( TRUE );
}
+16 -16
View File
@@ -1527,23 +1527,23 @@ void AddObjectToArmsDealerInventory( UINT8 ubArmsDealer, OBJECTTYPE *pObject )
AddItemToArmsDealerInventory( ubArmsDealer, pObject->usItem, &SpclItemInfo, 1 );
// if any GunAmmoItem is specified
if( pObject->usGunAmmoItem != NONE)
if( pObject->ItemData.Gun.usGunAmmoItem != NONE)
{
// if it's regular ammo
if( Item[ pObject->usGunAmmoItem ].usItemClass == IC_AMMO )
if( Item[ pObject->ItemData.Gun.usGunAmmoItem ].usItemClass == IC_AMMO )
{
// and there are some remaining
if ( pObject->ubGunShotsLeft > 0 )
if ( pObject->ItemData.Gun.ubGunShotsLeft > 0 )
{
// add the bullets of its remaining ammo
AddAmmoToArmsDealerInventory( ubArmsDealer, pObject->usGunAmmoItem, pObject->ubGunShotsLeft );
AddAmmoToArmsDealerInventory( ubArmsDealer, pObject->ItemData.Gun.usGunAmmoItem, pObject->ItemData.Gun.ubGunShotsLeft );
}
}
else // assume it's attached ammo (mortar shells, grenades)
{
// add the launchable item (can't be imprinted, or have attachments!)
SetSpecialItemInfoToDefaults( &SpclItemInfo );
SpclItemInfo.bItemCondition = pObject->bGunAmmoStatus;
SpclItemInfo.bItemCondition = pObject->ItemData.Gun.bGunAmmoStatus;
// if the gun it was in was jammed, get rid of the negative status now
if ( SpclItemInfo.bItemCondition < 0 )
@@ -1551,7 +1551,7 @@ void AddObjectToArmsDealerInventory( UINT8 ubArmsDealer, OBJECTTYPE *pObject )
SpclItemInfo.bItemCondition *= -1;
}
AddItemToArmsDealerInventory( ubArmsDealer, pObject->usGunAmmoItem, &SpclItemInfo, 1 );
AddItemToArmsDealerInventory( ubArmsDealer, pObject->ItemData.Gun.usGunAmmoItem, &SpclItemInfo, 1 );
}
}
break;
@@ -1560,7 +1560,7 @@ void AddObjectToArmsDealerInventory( UINT8 ubArmsDealer, OBJECTTYPE *pObject )
// add the contents of each magazine (multiple mags may have vastly different #bullets left)
for ( ubCnt = 0; ubCnt < pObject->ubNumberOfObjects; ubCnt++ )
{
AddAmmoToArmsDealerInventory( ubArmsDealer, pObject->usItem, pObject->ubShotsLeft[ ubCnt ] );
AddAmmoToArmsDealerInventory( ubArmsDealer, pObject->usItem, pObject->ItemData.Ammo.ubShotsLeft[ ubCnt ] );
}
break;
@@ -1568,7 +1568,7 @@ void AddObjectToArmsDealerInventory( UINT8 ubArmsDealer, OBJECTTYPE *pObject )
// add each object seperately (multiple objects may have vastly different statuses, keep any imprintID)
for ( ubCnt = 0; ubCnt < pObject->ubNumberOfObjects; ubCnt++ )
{
SpclItemInfo.bItemCondition = pObject->bStatus[ ubCnt ];
SpclItemInfo.bItemCondition = pObject->ItemData.Generic.bStatus[ ubCnt ];
AddItemToArmsDealerInventory( ubArmsDealer, pObject->usItem, &SpclItemInfo, 1 );
}
break;
@@ -2080,7 +2080,7 @@ void MakeObjectOutOfDealerItems( UINT16 usItemIndex, SPECIAL_ITEM_INFO *pSpclIte
// have to keep track of #bullets in a gun throughout dealer inventory. Without this, players could "reload" guns
// they don't have ammo for by selling them to Tony & buying them right back fully loaded! One could repeat this
// ad nauseum (empty the gun between visits) as a (really expensive) way to get unlimited special ammo like rockets.
pObject->ubGunShotsLeft = 0;
pObject->ItemData.Gun.ubGunShotsLeft = 0;
}
}
@@ -2102,7 +2102,7 @@ void GiveObjectToArmsDealerForRepair( UINT8 ubArmsDealer, OBJECTTYPE *pObject, U
Assert( CanDealerRepairItem( ubArmsDealer, pObject->usItem ) );
// c) Actually damaged, or a rocket rifle (being reset)
Assert( ( pObject->bStatus[ 0 ] < 100 ) || ItemIsARocketRifle( pObject->usItem ) );
Assert( ( pObject->ItemData.Generic.bStatus[ 0 ] < 100 ) || ItemIsARocketRifle( pObject->usItem ) );
/* ARM: Can now repair with removeable attachments still attached...
// d) Already stripped of all *detachable* attachments
@@ -2123,11 +2123,11 @@ void GiveObjectToArmsDealerForRepair( UINT8 ubArmsDealer, OBJECTTYPE *pObject, U
if (Item [ pObject->usItem ].usItemClass == IC_GUN )
{
// if any GunAmmoItem is specified
if( pObject->usGunAmmoItem != NONE)
if( pObject->ItemData.Gun.usGunAmmoItem != NONE)
{
// it better be regular ammo, and empty
Assert( Item[ pObject->usGunAmmoItem ].usItemClass == IC_AMMO );
Assert( pObject->ubGunShotsLeft == 0 );
Assert( Item[ pObject->ItemData.Gun.usGunAmmoItem ].usItemClass == IC_AMMO );
Assert( pObject->ItemData.Gun.ubGunShotsLeft == 0 );
}
}
@@ -2250,7 +2250,7 @@ UINT32 CalculateObjectItemRepairTime( UINT8 ubArmsDealer, OBJECTTYPE *pItemObjec
UINT32 uiRepairTime;
UINT8 ubCnt;
uiRepairTime = CalculateSimpleItemRepairTime( ubArmsDealer, pItemObject->usItem, pItemObject->bStatus[ 0 ] );
uiRepairTime = CalculateSimpleItemRepairTime( ubArmsDealer, pItemObject->usItem, pItemObject->ItemData.Generic.bStatus[ 0 ] );
// add time to repair any attachments on it
for ( ubCnt = 0; ubCnt < MAX_ATTACHMENTS; ubCnt++ )
@@ -2334,7 +2334,7 @@ UINT32 CalculateObjectItemRepairCost( UINT8 ubArmsDealer, OBJECTTYPE *pItemObjec
UINT32 uiRepairCost;
UINT8 ubCnt;
uiRepairCost = CalculateSimpleItemRepairCost( ubArmsDealer, pItemObject->usItem, pItemObject->bStatus[ 0 ] );
uiRepairCost = CalculateSimpleItemRepairCost( ubArmsDealer, pItemObject->usItem, pItemObject->ItemData.Generic.bStatus[ 0 ] );
// add cost of repairing any attachments on it
for ( ubCnt = 0; ubCnt < MAX_ATTACHMENTS; ubCnt++ )
@@ -2435,7 +2435,7 @@ void SetSpecialItemInfoFromObject( SPECIAL_ITEM_INFO *pSpclItemInfo, OBJECTTYPE
}
else
{
pSpclItemInfo->bItemCondition = pObject->bStatus[ 0 ];
pSpclItemInfo->bItemCondition = pObject->ItemData.Generic.bStatus[ 0 ];
}
// only guns currently have imprintID properly initialized...
+2 -2
View File
@@ -1240,8 +1240,8 @@ int ArmsDealerItemQsortCompare(const void *pArg1, const void *pArg2)
usItem1Index = ( ( INVENTORY_IN_SLOT * ) pArg1 ) -> sItemIndex;
usItem2Index = ( ( INVENTORY_IN_SLOT * ) pArg2 ) -> sItemIndex;
ubItem1Quality = ( ( INVENTORY_IN_SLOT * ) pArg1 ) -> ItemObject.bStatus[ 0 ];
ubItem2Quality = ( ( INVENTORY_IN_SLOT * ) pArg2 ) -> ItemObject.bStatus[ 0 ];
ubItem1Quality = ( ( INVENTORY_IN_SLOT * ) pArg1 ) -> ItemObject.ItemData.Generic.bStatus[ 0 ];
ubItem2Quality = ( ( INVENTORY_IN_SLOT * ) pArg2 ) -> ItemObject.ItemData.Generic.bStatus[ 0 ];
return( CompareItemsForSorting( usItem1Index, usItem2Index, ubItem1Quality, ubItem2Quality ) );
}
+3 -3
View File
@@ -178,12 +178,12 @@ BOOLEAN ApplyDrugs( SOLDIERTYPE *pSoldier, OBJECTTYPE *pObject )
if ( ubDrugType == DRUG_TYPE_REGENERATION )
{
// each use of a regen booster over 1, each day, reduces the effect
bRegenPointsGained = REGEN_POINTS_PER_BOOSTER * pObject->bStatus[0] / 100;
bRegenPointsGained = REGEN_POINTS_PER_BOOSTER * pObject->ItemData.Generic.bStatus[0] / 100;
// are there fractional %s left over?
if ( ( pObject->bStatus[0] % (100 / REGEN_POINTS_PER_BOOSTER ) ) != 0 )
if ( ( pObject->ItemData.Generic.bStatus[0] % (100 / REGEN_POINTS_PER_BOOSTER ) ) != 0 )
{
// chance of an extra point
if ( PreRandom( 100 / REGEN_POINTS_PER_BOOSTER ) < (UINT32) ( pObject->bStatus[0] % (100 / REGEN_POINTS_PER_BOOSTER ) ) )
if ( PreRandom( 100 / REGEN_POINTS_PER_BOOSTER ) < (UINT32) ( pObject->ItemData.Generic.bStatus[0] % (100 / REGEN_POINTS_PER_BOOSTER ) ) )
{
bRegenPointsGained++;
}
+37 -34
View File
@@ -213,13 +213,16 @@ INT32 HandleItem( SOLDIERTYPE *pSoldier, INT16 sGridNo, INT8 bLevel, UINT16 usHa
if ( fFromUI )
{
INT16 sInteractiveGridNo;
// ATE: Check if we are targeting an interactive tile, and adjust gridno accordingly...
pIntNode = GetCurInteractiveTileGridNoAndStructure( &sGridNo, &pStructure );
pIntNode = GetCurInteractiveTileGridNoAndStructure( &sInteractiveGridNo, &pStructure );
if ( pIntNode != NULL && pTargetSoldier == pSoldier )
{
// Truncate target sioldier
// Truncate target soldier and update grid
pTargetSoldier = NULL;
sGridNo = sInteractiveGridNo;
}
}
}
@@ -502,7 +505,7 @@ INT32 HandleItem( SOLDIERTYPE *pSoldier, INT16 sGridNo, INT8 bLevel, UINT16 usHa
pSoldier->bDoAutofire += misfirePenalty;
sAPCost = CalcTotalAPsToAttack( pSoldier, sTargetGridNo, TRUE, 0 );
}
while(EnoughPoints( pSoldier, sAPCost, 0, FALSE ) && roll < ((pSoldier->inv[ pSoldier->ubAttackingHand ].ubGunShotsLeft >= pSoldier->bDoAutofire)?chanceToMisfire:chanceToMisfireDry));
while(EnoughPoints( pSoldier, sAPCost, 0, FALSE ) && roll < ((pSoldier->inv[ pSoldier->ubAttackingHand ].ItemData.Gun.ubGunShotsLeft >= pSoldier->bDoAutofire)?chanceToMisfire:chanceToMisfireDry));
//note that we could misfire more bullets than we have rounds
//this represents the soldier running out of ammo and not noticing
//the max that can be lost this way is 1AP
@@ -510,17 +513,17 @@ INT32 HandleItem( SOLDIERTYPE *pSoldier, INT16 sGridNo, INT8 bLevel, UINT16 usHa
pSoldier->bDoAutofire -= misfirePenalty;
sAPCost = CalcTotalAPsToAttack( pSoldier, sTargetGridNo, TRUE, 0 );
if((__min(pSoldier->bDoAutofire,pSoldier->inv[ pSoldier->ubAttackingHand ].ubGunShotsLeft) - startAuto) > 0 && pSoldier->bTeam == OUR_TEAM)
if((__min(pSoldier->bDoAutofire,pSoldier->inv[ pSoldier->ubAttackingHand ].ItemData.Gun.ubGunShotsLeft) - startAuto) > 0 && pSoldier->bTeam == OUR_TEAM)
{
// More than 1 round
if (__min(pSoldier->bDoAutofire,pSoldier->inv[ pSoldier->ubAttackingHand ].ubGunShotsLeft) - startAuto > 1)
if (__min(pSoldier->bDoAutofire,pSoldier->inv[ pSoldier->ubAttackingHand ].ItemData.Gun.ubGunShotsLeft) - startAuto > 1)
{
ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, gzLateLocalizedString[ 62 ], pSoldier->name, __min(pSoldier->bDoAutofire,pSoldier->inv[ pSoldier->ubAttackingHand ].ubGunShotsLeft) - startAuto );
ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, gzLateLocalizedString[ 62 ], pSoldier->name, __min(pSoldier->bDoAutofire,pSoldier->inv[ pSoldier->ubAttackingHand ].ItemData.Gun.ubGunShotsLeft) - startAuto );
}
// 1 round
else
{
ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, gzLateLocalizedString[ 63 ], pSoldier->name, __min(pSoldier->bDoAutofire,pSoldier->inv[ pSoldier->ubAttackingHand ].ubGunShotsLeft) - startAuto );
ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, gzLateLocalizedString[ 63 ], pSoldier->name, __min(pSoldier->bDoAutofire,pSoldier->inv[ pSoldier->ubAttackingHand ].ItemData.Gun.ubGunShotsLeft) - startAuto );
}
}
@@ -1421,7 +1424,7 @@ void HandleSoldierDropBomb( SOLDIERTYPE *pSoldier, INT16 sGridNo )
StatChange( pSoldier, EXPLODEAMT, 25, FALSE );
pSoldier->inv[ HANDPOS ].bTrap = __min( 10, ( EffectiveExplosive( pSoldier ) / 20) + (EffectiveExpLevel( pSoldier ) / 3) );
pSoldier->inv[ HANDPOS ].ubBombOwner = pSoldier->ubID + 2;
pSoldier->inv[ HANDPOS ].ItemData.Trigger.ubBombOwner = pSoldier->ubID + 2;
// we now know there is something nasty here
gpWorldLevelData[ sGridNo ].uiFlags |= MAPELEMENT_PLAYER_MINE_PRESENT;
@@ -1753,7 +1756,7 @@ void SoldierGetItemFromWorld( SOLDIERTYPE *pSoldier, INT32 iItemIndex, INT16 sGr
if (Object.usItem == SWITCH)
{
// ask about activating the switch!
bTempFrequency = Object.bFrequency;
bTempFrequency = Object.ItemData.Trigger.BombTrigger.bFrequency;
gpTempSoldier = pSoldier;
DoMessageBox( MSG_BOX_BASIC_STYLE, TacticalStr[ ACTIVATE_SWITCH_PROMPT ] , GAME_SCREEN, ( UINT8 )MSG_BOX_FLAG_YESNO, SwitchMessageBoxCallBack, NULL );
pItemPool = pItemPool->pNext;
@@ -1846,7 +1849,7 @@ void SoldierGetItemFromWorld( SOLDIERTYPE *pSoldier, INT32 iItemIndex, INT16 sGr
if (Object.usItem == SWITCH)
{
// handle switch
bTempFrequency = Object.bFrequency;
bTempFrequency = Object.ItemData.Trigger.BombTrigger.bFrequency;
gpTempSoldier = pSoldier;
DoMessageBox( MSG_BOX_BASIC_STYLE, TacticalStr[ ACTIVATE_SWITCH_PROMPT ], GAME_SCREEN, ( UINT8 )MSG_BOX_FLAG_YESNO, SwitchMessageBoxCallBack, NULL );
}
@@ -2274,22 +2277,22 @@ OBJECTTYPE* InternalAddItemToPool( INT16 *psGridNo, OBJECTTYPE *pObject, INT8 bV
// and they are pressure-triggered unless there is a switch structure there
if (FindStructure( *psGridNo, STRUCTURE_SWITCH ) != NULL)
{
pObject->bDetonatorType = BOMB_SWITCH;
pObject->ItemData.Trigger.bDetonatorType = BOMB_SWITCH;
}
else
{
pObject->bDetonatorType = BOMB_PRESSURE;
pObject->ItemData.Trigger.bDetonatorType = BOMB_PRESSURE;
}
}
else
{
// else they are manually controlled
pObject->bDetonatorType = BOMB_SWITCH;
pObject->ItemData.Trigger.bDetonatorType = BOMB_SWITCH;
}
}
else if ( pObject->usItem == ACTION_ITEM )
{
switch( pObject->bActionValue )
switch( pObject->ItemData.Trigger.bActionValue )
{
case ACTION_ITEM_SMALL_PIT:
case ACTION_ITEM_LARGE_PIT:
@@ -4068,7 +4071,7 @@ void SoldierGiveItemFromAnimation( SOLDIERTYPE *pSoldier )
// are we giving money to an NPC, to whom we owe money?
if (pTSoldier->ubProfile != NO_PROFILE && gMercProfiles[pTSoldier->ubProfile].iBalance < 0)
{
gMercProfiles[pTSoldier->ubProfile].iBalance += TempObject.uiMoneyAmount;
gMercProfiles[pTSoldier->ubProfile].iBalance += TempObject.ItemData.Money.uiMoneyAmount;
if (gMercProfiles[pTSoldier->ubProfile].iBalance >= 0)
{
// don't let the player accumulate credit (?)
@@ -4276,7 +4279,7 @@ void BombMessageBoxCallBack( UINT8 ubExitValue )
// HACK IMMINENT!
// value of 1 is stored in maps for SIDE of bomb owner... when we want to use IDs!
// so we add 2 to all owner IDs passed through here and subtract 2 later
gpTempSoldier->inv[HANDPOS].ubBombOwner = gpTempSoldier->ubID + 2;
gpTempSoldier->inv[HANDPOS].ItemData.Trigger.ubBombOwner = gpTempSoldier->ubID + 2;
AddItemToPool( gsTempGridno, &(gpTempSoldier->inv[HANDPOS]), 1, gpTempSoldier->bLevel, WORLD_ITEM_ARMED_BOMB, 0 );
DeleteObj( &(gpTempSoldier->inv[HANDPOS]) );
}
@@ -4300,17 +4303,17 @@ BOOLEAN HandItemWorks( SOLDIERTYPE *pSoldier, INT8 bSlot )
if ( (Item[ pObj->usItem ].damageable ) && (!Item[pObj->usItem].mine ) && (Item[ pObj->usItem ].usItemClass != IC_MEDKIT) && !Item[pObj->usItem].gascan )
{
// if it's still usable, check whether it breaks
if ( pObj->bStatus[0] >= USABLE)
if ( pObj->ItemData.Generic.bStatus[0] >= USABLE)
{
// if a dice roll is greater than the item's status
if ( (Random(80) + 20) >= (UINT32) (pObj->bStatus[0] + 50) )
if ( (Random(80) + 20) >= (UINT32) (pObj->ItemData.Generic.bStatus[0] + 50) )
{
fItemJustBroke = TRUE;
fItemWorks = FALSE;
// item breaks, and becomes unusable... so its status is reduced
// to somewhere between 1 and the 1 less than USABLE
pObj->bStatus[0] = (INT8) ( 1 + Random( USABLE - 1 ) );
pObj->ItemData.Generic.bStatus[0] = (INT8) ( 1 + Random( USABLE - 1 ) );
}
}
else // it's already unusable
@@ -4333,8 +4336,8 @@ BOOLEAN HandItemWorks( SOLDIERTYPE *pSoldier, INT8 bSlot )
{
// are we using two guns at once?
if ( Item[ pSoldier->inv[SECONDHANDPOS].usItem ].usItemClass == IC_GUN &&
pSoldier->inv[SECONDHANDPOS].bGunStatus >= USABLE &&
pSoldier->inv[SECONDHANDPOS].ubGunShotsLeft > 0)
pSoldier->inv[SECONDHANDPOS].ItemData.Gun.bGunStatus >= USABLE &&
pSoldier->inv[SECONDHANDPOS].ItemData.Gun.ubGunShotsLeft > 0)
{
// check the second gun for breakage, and if IT breaks, return false
return( HandItemWorks( pSoldier, SECONDHANDPOS ) );
@@ -4508,9 +4511,9 @@ void BoobyTrapMessageBoxCallBack( UINT8 ubExitValue )
// NB owner grossness... bombs 'owned' by the enemy are stored with side value 1 in
// the map. So if we want to detect a bomb placed by the player, owner is > 1, and
// owner - 2 gives the ID of the character who planted it
if ( Object.ubBombOwner > 1 && ( (INT32)Object.ubBombOwner - 2 >= gTacticalStatus.Team[ OUR_TEAM ].bFirstID && Object.ubBombOwner - 2 <= gTacticalStatus.Team[ OUR_TEAM ].bLastID ) )
if ( Object.ItemData.Trigger.ubBombOwner > 1 && ( (INT32)Object.ItemData.Trigger.ubBombOwner - 2 >= gTacticalStatus.Team[ OUR_TEAM ].bFirstID && Object.ItemData.Trigger.ubBombOwner - 2 <= gTacticalStatus.Team[ OUR_TEAM ].bLastID ) )
{
if ( Object.ubBombOwner - 2 == gpBoobyTrapSoldier->ubID )
if ( Object.ItemData.Trigger.ubBombOwner - 2 == gpBoobyTrapSoldier->ubID )
{
// my own boobytrap!
iCheckResult = SkillCheck( gpBoobyTrapSoldier, DISARM_TRAP_CHECK, 40 );
@@ -4529,9 +4532,9 @@ void BoobyTrapMessageBoxCallBack( UINT8 ubExitValue )
if (iCheckResult >= 0)
{
if ( Object.ubBombOwner > 1 && ( (INT32)Object.ubBombOwner - 2 >= gTacticalStatus.Team[ OUR_TEAM ].bFirstID && Object.ubBombOwner - 2 <= gTacticalStatus.Team[ OUR_TEAM ].bLastID ) )
if ( Object.ItemData.Trigger.ubBombOwner > 1 && ( (INT32)Object.ItemData.Trigger.ubBombOwner - 2 >= gTacticalStatus.Team[ OUR_TEAM ].bFirstID && Object.ItemData.Trigger.ubBombOwner - 2 <= gTacticalStatus.Team[ OUR_TEAM ].bLastID ) )
{
if ( Object.ubBombOwner - 2 == gpBoobyTrapSoldier->ubID )
if ( Object.ItemData.Trigger.ubBombOwner - 2 == gpBoobyTrapSoldier->ubID )
{
// disarmed my own boobytrap!
StatChange( gpBoobyTrapSoldier, EXPLODEAMT, (UINT16) (2 * gbTrapDifficulty), FALSE );
@@ -4558,7 +4561,7 @@ void BoobyTrapMessageBoxCallBack( UINT8 ubExitValue )
// give the player a remote trigger instead
CreateItem( REMOTEBOMBTRIGGER, (INT8) (1 + Random( 9 )), &Object );
}
else if (Object.usItem == ACTION_ITEM && Object.bActionValue != ACTION_ITEM_BLOW_UP )
else if (Object.usItem == ACTION_ITEM && Object.ItemData.Trigger.bActionValue != ACTION_ITEM_BLOW_UP )
{
// give the player a detonator instead
CreateItem( DETONATOR, (INT8) (1 + Random( 9 )), &Object );
@@ -4566,7 +4569,7 @@ void BoobyTrapMessageBoxCallBack( UINT8 ubExitValue )
else
{
// switch action item to the real item type
CreateItem( Object.usBombItem, Object.bBombStatus, &Object );
CreateItem( Object.ItemData.Trigger.usBombItem, Object.ItemData.Trigger.bBombStatus, &Object );
}
// remove any blue flag graphic
@@ -4662,7 +4665,7 @@ void BoobyTrapInMapScreenMessageBoxCallBack( UINT8 ubExitValue )
// give the player a remote trigger instead
CreateItem( REMOTEBOMBTRIGGER, (INT8) (1 + Random( 9 )), &Object );
}
else if (Object.usItem == ACTION_ITEM && Object.bActionValue != ACTION_ITEM_BLOW_UP )
else if (Object.usItem == ACTION_ITEM && Object.ItemData.Trigger.bActionValue != ACTION_ITEM_BLOW_UP )
{
// give the player a detonator instead
CreateItem( DETONATOR, (INT8) (1 + Random( 9 )), &Object );
@@ -4670,7 +4673,7 @@ void BoobyTrapInMapScreenMessageBoxCallBack( UINT8 ubExitValue )
else
{
// switch action item to the real item type
CreateItem( Object.usBombItem, Object.bBombStatus, &Object );
CreateItem( Object.ItemData.Trigger.usBombItem, Object.ItemData.Trigger.bBombStatus, &Object );
}
}
else
@@ -4824,7 +4827,7 @@ BOOLEAN NearbyGroundSeemsWrong( SOLDIERTYPE * pSoldier, INT16 sGridNo, BOOLEAN f
if (gWorldBombs[uiWorldBombIndex].fExists && gWorldItems[ gWorldBombs[uiWorldBombIndex].iItemIndex ].sGridNo == sNextGridNo)
{
pObj = &( gWorldItems[ gWorldBombs[uiWorldBombIndex].iItemIndex ].o );
if ( pObj->bDetonatorType == BOMB_PRESSURE && !(pObj->fFlags & OBJECT_KNOWN_TO_BE_TRAPPED) && (!(pObj->fFlags & OBJECT_DISABLED_BOMB)) )
if ( pObj->ItemData.Trigger.bDetonatorType == BOMB_PRESSURE && !(pObj->fFlags & OBJECT_KNOWN_TO_BE_TRAPPED) && (!(pObj->fFlags & OBJECT_DISABLED_BOMB)) )
{
if ( fMining && pObj->bTrap <= 10 )
{
@@ -5047,18 +5050,18 @@ void CheckForPickedOwnership( void )
{
if ( gWorldItems[ pItemPool->iItemIndex ].o.usItem == OWNERSHIP )
{
if ( gWorldItems[ pItemPool->iItemIndex ].o.ubOwnerProfile != NO_PROFILE )
if ( gWorldItems[ pItemPool->iItemIndex ].o.ItemData.Owner.ubOwnerProfile != NO_PROFILE )
{
ubProfile = gWorldItems[ pItemPool->iItemIndex ].o.ubOwnerProfile;
ubProfile = gWorldItems[ pItemPool->iItemIndex ].o.ItemData.Owner.ubOwnerProfile;
pSoldier = FindSoldierByProfileID( ubProfile, FALSE );
if ( pSoldier )
{
TestPotentialOwner( pSoldier );
}
}
if ( gWorldItems[ pItemPool->iItemIndex ].o.ubOwnerCivGroup != NON_CIV_GROUP )
if ( gWorldItems[ pItemPool->iItemIndex ].o.ItemData.Owner.ubOwnerCivGroup != NON_CIV_GROUP )
{
ubCivGroup = gWorldItems[ pItemPool->iItemIndex ].o.ubOwnerCivGroup;
ubCivGroup = gWorldItems[ pItemPool->iItemIndex ].o.ItemData.Owner.ubOwnerCivGroup;
if ( ubCivGroup == HICKS_CIV_GROUP && CheckFact( FACT_HICKS_MARRIED_PLAYER_MERC, 0 ) )
{
// skip because hicks appeased
+2 -2
View File
@@ -2371,7 +2371,7 @@ void HandleNPCDoAction( UINT8 ubTargetNPC, UINT16 usActionCode, UINT8 ubQuoteNum
if (pSoldier)
{
CreateItem( MONEY, 1, &Object );
Object.uiMoneyAmount = 10000;
Object.ItemData.Money.uiMoneyAmount = 10000;
AddItemToPoolAndGetIndex( sGridNo, &Object, -1, pSoldier->bLevel, 0, 0, &iWorldItem );
// shouldn't have any current action but make sure everything
@@ -3110,7 +3110,7 @@ void HandleNPCDoAction( UINT8 ubTargetNPC, UINT16 usActionCode, UINT8 ubQuoteNum
if (bMoneySlot != NO_SLOT && bEmptySlot != NO_SLOT)
{
CreateMoney( gMercProfiles[ ubTargetNPC ].iBalance * 2, &(pSoldier->inv[ bEmptySlot ] ) );
pSoldier->inv[ bMoneySlot ].uiMoneyAmount -= gMercProfiles[ ubTargetNPC ].iBalance * 2;
pSoldier->inv[ bMoneySlot ].ItemData.Money.uiMoneyAmount -= gMercProfiles[ ubTargetNPC ].iBalance * 2;
if (bMoneySlot < bEmptySlot)
{
// move main stash to later in inventory!
+46 -46
View File
@@ -610,7 +610,7 @@ void GenerateProsString( STR16 zItemPros, OBJECTTYPE * pObject, UINT32 uiPixLimi
ubWeight = Item[ usItem ].ubWeight;
if (Item[ usItem ].usItemClass == IC_GUN)
{
ubWeight += Item[ pObject->usGunAmmoItem ].ubWeight;
ubWeight += Item[ pObject->ItemData.Gun.usGunAmmoItem ].ubWeight;
}
if (Weapon[usItem].bAccuracy >= EXCEPTIONAL_ACCURACY )
@@ -753,7 +753,7 @@ void GenerateConsString( STR16 zItemCons, OBJECTTYPE * pObject, UINT32 uiPixLimi
ubWeight = Item[ usItem ].ubWeight;
if (Item[ usItem ].usItemClass == IC_GUN)
{
ubWeight += Item[ pObject->usGunAmmoItem ].ubWeight;
ubWeight += Item[ pObject->ItemData.Gun.usGunAmmoItem ].ubWeight;
}
if (ubWeight >= BAD_WEIGHT)
@@ -1079,7 +1079,7 @@ void HandleRenderInvSlots( SOLDIERTYPE *pSoldier, UINT8 fDirtyLevel )
if ( fDirtyLevel == DIRTYLEVEL2 )
{
# if defined( _DEBUG ) /* Sergeant_Kolja, to be removed later again */
if( pSoldier->inv[ cnt ].ubGunAmmoType >= MAXITEMS )
if( pSoldier->inv[ cnt ].ItemData.Gun.ubGunAmmoType >= MAXITEMS )
{
DebugMsg(TOPIC_JA2, DBG_LEVEL_1, String("pObject (%s) corrupted! GetHelpTextForItem() can crash.", (pSoldier->inv[ cnt ].usItem<MAXITEMS) ? Item[pSoldier->inv[ cnt ].usItem].szItemName : "???" ));
ScreenMsg( MSG_FONT_RED, MSG_DEBUG, L"pObject (%S) corrupted! GetHelpTextForItem() can crash.", (pSoldier->inv[ cnt ].usItem<MAXITEMS) ? Item[pSoldier->inv[ cnt ].usItem].szItemName : "???" );
@@ -2082,7 +2082,7 @@ void INVRenderItem( UINT32 uiBuffer, SOLDIERTYPE * pSoldier, OBJECTTYPE *pObjec
sNewY = sY + sHeight - 10;
sNewX = sX + 1;
SetFontForeground ( AmmoTypes[pObject->ubGunAmmoType].fontColour );
SetFontForeground ( AmmoTypes[pObject->ItemData.Gun.ubGunAmmoType].fontColour );
//switch (pObject->ubGunAmmoType)
//{
// case AMMO_AP:
@@ -2108,7 +2108,7 @@ void INVRenderItem( UINT32 uiBuffer, SOLDIERTYPE * pSoldier, OBJECTTYPE *pObjec
//}
swprintf( pStr, L"%d", pObject->ubGunShotsLeft );
swprintf( pStr, L"%d", pObject->ItemData.Gun.ubGunShotsLeft );
if ( uiBuffer == guiSAVEBUFFER )
{
RestoreExternBackgroundRect( sNewX, sNewY, 20, 15 );
@@ -2119,7 +2119,7 @@ void INVRenderItem( UINT32 uiBuffer, SOLDIERTYPE * pSoldier, OBJECTTYPE *pObjec
SetFontForeground( FONT_MCOLOR_DKGRAY );
// Display 'JAMMED' if we are jammed
if ( pObject->bGunAmmoStatus < 0 )
if ( pObject->ItemData.Gun.bGunAmmoStatus < 0 )
{
SetFontForeground( FONT_MCOLOR_RED );
@@ -2436,14 +2436,14 @@ BOOLEAN InternalInitItemDescriptionBox( OBJECTTYPE *pObject, INT16 sX, INT16 sY,
// if( guiCurrentScreen != MAP_SCREEN )
//if( guiCurrentItemDescriptionScreen != MAP_SCREEN )
if ( GetMagSize(gpItemDescObject) <= 99 )
swprintf( pStr, L"%d/%d", gpItemDescObject->ubGunShotsLeft, GetMagSize(gpItemDescObject));
swprintf( pStr, L"%d/%d", gpItemDescObject->ItemData.Gun.ubGunShotsLeft, GetMagSize(gpItemDescObject));
else
swprintf( pStr, L"%d", gpItemDescObject->ubGunShotsLeft );
swprintf( pStr, L"%d", gpItemDescObject->ItemData.Gun.ubGunShotsLeft );
FilenameForBPP("INTERFACE\\infobox.sti", ubString);
sForeColour = ITEMDESC_AMMO_FORE;
giItemDescAmmoButtonImages = LoadButtonImage(ubString,AmmoTypes[pObject->ubGunAmmoType].grayed,AmmoTypes[pObject->ubGunAmmoType].offNormal,-1,AmmoTypes[pObject->ubGunAmmoType].onNormal,-1 );
giItemDescAmmoButtonImages = LoadButtonImage(ubString,AmmoTypes[pObject->ItemData.Gun.ubGunAmmoType].grayed,AmmoTypes[pObject->ItemData.Gun.ubGunAmmoType].offNormal,-1,AmmoTypes[pObject->ItemData.Gun.ubGunAmmoType].onNormal,-1 );
//switch( pObject->ubGunAmmoType )
//{
@@ -2630,8 +2630,8 @@ BOOLEAN InternalInitItemDescriptionBox( OBJECTTYPE *pObject, INT16 sX, INT16 sY,
else
{
memset( &gRemoveMoney, 0, sizeof( REMOVE_MONEY ) );
gRemoveMoney.uiTotalAmount = gpItemDescObject->uiMoneyAmount;
gRemoveMoney.uiMoneyRemaining = gpItemDescObject->uiMoneyAmount;
gRemoveMoney.uiTotalAmount = gpItemDescObject->ItemData.Money.uiMoneyAmount;
gRemoveMoney.uiMoneyRemaining = gpItemDescObject->ItemData.Money.uiMoneyAmount;
gRemoveMoney.uiMoneyRemoving = 0;
// Load graphic
@@ -3281,12 +3281,12 @@ void RenderItemDescriptionBox( )
if( Item[gpItemDescObject->usItem].usItemClass == IC_AMMO && gpItemDescObject->ubNumberOfObjects > 1 && gubItemDescStatusIndex < gpItemDescObject->ubNumberOfObjects)
{
//Get weight of one item in stack.
UINT8 ubShotsLeftFirst = gpItemDescObject->ubShotsLeft[0];
UINT8 ubShotsLeftFirst = gpItemDescObject->ItemData.Ammo.ubShotsLeft[0];
UINT8 ubNumberOfObjects = gpItemDescObject->ubNumberOfObjects;
gpItemDescObject->ubNumberOfObjects = 1;
gpItemDescObject->ubShotsLeft[0] = gpItemDescObject->ubShotsLeft[gubItemDescStatusIndex];
gpItemDescObject->ItemData.Ammo.ubShotsLeft[0] = gpItemDescObject->ItemData.Ammo.ubShotsLeft[gubItemDescStatusIndex];
fWeight = (float)(CalculateObjectWeight( gpItemDescObject )) / 10;
gpItemDescObject->ubShotsLeft[0] = ubShotsLeftFirst;
gpItemDescObject->ItemData.Ammo.ubShotsLeft[0] = ubShotsLeftFirst;
gpItemDescObject->ubNumberOfObjects = ubNumberOfObjects;
}
//Item does not exist
@@ -3349,7 +3349,7 @@ void RenderItemDescriptionBox( )
SetFontForeground( 5 );
//Status
// This is gross, but to get the % to work out right...
swprintf( pStr, L"%2d%%", gpItemDescObject->bStatus[ gubItemDescStatusIndex ] );
swprintf( pStr, L"%2d%%", gpItemDescObject->ItemData.Generic.bStatus[ gubItemDescStatusIndex ] );
FindFontRightCoordinates( (INT16)(gMapWeaponStats[ 1 ].sX + gsInvDescX + gMapWeaponStats[ 1 ].sValDx + 6), (INT16)(gMapWeaponStats[ 1 ].sY + gsInvDescY ), ITEM_STATS_WIDTH ,ITEM_STATS_HEIGHT ,pStr, BLOCKFONT2, &usX, &usY);
wcscat( pStr, L"%%" );
mprintf( usX, usY, pStr );
@@ -3521,7 +3521,7 @@ void RenderItemDescriptionBox( )
{
SetFontForeground( FONT_FCOLOR_WHITE );
SetFontShadow( DEFAULT_SHADOW );
swprintf( pStr, L"%ld", gpItemDescObject->uiMoneyAmount );
swprintf( pStr, L"%ld", gpItemDescObject->ItemData.Money.uiMoneyAmount );
InsertCommasForDollarFigure( pStr );
InsertDollarSignInToString( pStr );
uiStringLength=StringPixLength(pStr, ITEMDESC_FONT );
@@ -3554,7 +3554,7 @@ void RenderItemDescriptionBox( )
if ( Item[ gpItemDescObject->usItem ].usItemClass & IC_AMMO )
{
// Ammo
swprintf( pStr, L"%d/%d", gpItemDescObject->ubShotsLeft[gubItemDescStatusIndex], Magazine[ Item[ gpItemDescObject->usItem ].ubClassIndex ].ubMagSize ); //Pulmu: Correct # of rounds for stacked ammo.
swprintf( pStr, L"%d/%d", gpItemDescObject->ItemData.Ammo.ubShotsLeft[gubItemDescStatusIndex], Magazine[ Item[ gpItemDescObject->usItem ].ubClassIndex ].ubMagSize ); //Pulmu: Correct # of rounds for stacked ammo.
uiStringLength=StringPixLength(pStr, ITEMDESC_FONT );
// sStrX = gMapWeaponStats[ 0 ].sX + gsInvDescX + gMapWeaponStats[ 0 ].sValDx + ( uiRightLength - uiStringLength );
FindFontRightCoordinates( (INT16)(gMapWeaponStats[ 2 ].sX + gsInvDescX + gMapWeaponStats[ 2 ].sValDx+6), (INT16)(gMapWeaponStats[ 2 ].sY + gsInvDescY ), ITEM_STATS_WIDTH ,ITEM_STATS_HEIGHT ,pStr, BLOCKFONT2, &sStrX, &usY);
@@ -3563,7 +3563,7 @@ void RenderItemDescriptionBox( )
else
{
//Status
swprintf( pStr, L"%2d%%", gpItemDescObject->bStatus[ gubItemDescStatusIndex ] );
swprintf( pStr, L"%2d%%", gpItemDescObject->ItemData.Generic.bStatus[ gubItemDescStatusIndex ] );
uiStringLength=StringPixLength(pStr, ITEMDESC_FONT );
// sStrX = gMapWeaponStats[ 1 ].sX + gsInvDescX + gMapWeaponStats[ 1 ].sValDx + ( uiRightLength - uiStringLength );
FindFontRightCoordinates( (INT16)(gMapWeaponStats[ 1 ].sX + gsInvDescX + gMapWeaponStats[ 1 ].sValDx + 6), (INT16)(gMapWeaponStats[ 1 ].sY + gsInvDescY ), ITEM_STATS_WIDTH ,ITEM_STATS_HEIGHT ,pStr, BLOCKFONT2, &sStrX, &usY);
@@ -3590,12 +3590,12 @@ void RenderItemDescriptionBox( )
SetFontForeground( 5 );
GetShortSectorString( ( INT16 ) SECTORX( KeyTable[ gpItemDescObject->ubKeyID ].usSectorFound ), ( INT16 ) SECTORY( KeyTable[ gpItemDescObject->ubKeyID ].usSectorFound ), sTempString );
GetShortSectorString( ( INT16 ) SECTORX( KeyTable[ gpItemDescObject->ItemData.Key.ubKeyID ].usSectorFound ), ( INT16 ) SECTORY( KeyTable[ gpItemDescObject->ItemData.Key.ubKeyID ].usSectorFound ), sTempString );
swprintf( pStr, L"%s", sTempString );
FindFontRightCoordinates( (INT16)(gMapWeaponStats[ 4 ].sX + gsInvDescX ), (INT16)(gMapWeaponStats[ 4 ].sY + gsInvDescY ), 110 ,ITEM_STATS_HEIGHT ,pStr, BLOCKFONT2, &usX, &usY);
mprintf( usX, usY, pStr );
swprintf( pStr, L"%d", KeyTable[ gpItemDescObject->ubKeyID ].usDateFound );
swprintf( pStr, L"%d", KeyTable[ gpItemDescObject->ItemData.Key.ubKeyID ].usDateFound );
FindFontRightCoordinates( (INT16)(gMapWeaponStats[ 4 ].sX + gsInvDescX ), (INT16)(gMapWeaponStats[ 4 ].sY + gsInvDescY + GetFontHeight( BLOCKFONT ) + 2 ), 110 ,ITEM_STATS_HEIGHT ,pStr, BLOCKFONT2, &usX, &usY);
mprintf( usX, usY, pStr );
}
@@ -3775,12 +3775,12 @@ void RenderItemDescriptionBox( )
if( Item[gpItemDescObject->usItem].usItemClass == IC_AMMO && gpItemDescObject->ubNumberOfObjects > 1 && gubItemDescStatusIndex < gpItemDescObject->ubNumberOfObjects)
{
//Get weight of one ammo clip in stack.
UINT8 ubShotsLeftFirst = gpItemDescObject->ubShotsLeft[0];
UINT8 ubShotsLeftFirst = gpItemDescObject->ItemData.Ammo.ubShotsLeft[0];
UINT8 ubNumberOfObjects = gpItemDescObject->ubNumberOfObjects;
gpItemDescObject->ubNumberOfObjects = 1;
gpItemDescObject->ubShotsLeft[0] = gpItemDescObject->ubShotsLeft[gubItemDescStatusIndex];
gpItemDescObject->ItemData.Ammo.ubShotsLeft[0] = gpItemDescObject->ItemData.Ammo.ubShotsLeft[gubItemDescStatusIndex];
fWeight = (float)(CalculateObjectWeight( gpItemDescObject )) / 10;
gpItemDescObject->ubShotsLeft[0] = ubShotsLeftFirst;
gpItemDescObject->ItemData.Ammo.ubShotsLeft[0] = ubShotsLeftFirst;
gpItemDescObject->ubNumberOfObjects = ubNumberOfObjects;
}
//Item does not exist
@@ -3850,7 +3850,7 @@ void RenderItemDescriptionBox( )
}
//Status
swprintf( pStr, L"%2d%%", gpItemDescObject->bGunStatus );
swprintf( pStr, L"%2d%%", gpItemDescObject->ItemData.Gun.bGunStatus );
FindFontRightCoordinates( (INT16)(gWeaponStats[ 1 ].sX + gsInvDescX + gWeaponStats[ 1 ].sValDx), (INT16)(gWeaponStats[ 1 ].sY + gsInvDescY ), ITEM_STATS_WIDTH ,ITEM_STATS_HEIGHT ,pStr, BLOCKFONT2, &usX, &usY);
wcscat( pStr, L"%%" );
mprintf( usX, usY, pStr );
@@ -4018,7 +4018,7 @@ void RenderItemDescriptionBox( )
{
SetFontForeground( FONT_FCOLOR_WHITE );
SetFontShadow( DEFAULT_SHADOW );
swprintf( pStr, L"%ld", gpItemDescObject->uiMoneyAmount );
swprintf( pStr, L"%ld", gpItemDescObject->ItemData.Money.uiMoneyAmount );
InsertCommasForDollarFigure( pStr );
InsertDollarSignInToString( pStr );
@@ -4054,14 +4054,14 @@ void RenderItemDescriptionBox( )
{
// Ammo - print amount
//Status
swprintf( pStr, L"%d/%d", gpItemDescObject->ubShotsLeft[gubItemDescStatusIndex], Magazine[ Item[ gpItemDescObject->usItem ].ubClassIndex ].ubMagSize ); //Pulmu: Correct # of rounds for stacked ammo
swprintf( pStr, L"%d/%d", gpItemDescObject->ItemData.Ammo.ubShotsLeft[gubItemDescStatusIndex], Magazine[ Item[ gpItemDescObject->usItem ].ubClassIndex ].ubMagSize ); //Pulmu: Correct # of rounds for stacked ammo
FindFontRightCoordinates( (INT16)(gWeaponStats[ 2 ].sX + gsInvDescX + gWeaponStats[ 2 ].sValDx), (INT16)(gWeaponStats[ 2 ].sY + gsInvDescY ), ITEM_STATS_WIDTH ,ITEM_STATS_HEIGHT ,pStr, BLOCKFONT2, &usX, &usY);
mprintf( usX, usY, pStr );
}
else
{
//Status
swprintf( pStr, L"%2d%%", gpItemDescObject->bStatus[ gubItemDescStatusIndex ] );
swprintf( pStr, L"%2d%%", gpItemDescObject->ItemData.Generic.bStatus[ gubItemDescStatusIndex ] );
FindFontRightCoordinates( (INT16)(gWeaponStats[ 1 ].sX + gsInvDescX + gWeaponStats[ 1 ].sValDx), (INT16)(gWeaponStats[ 1 ].sY + gsInvDescY ), ITEM_STATS_WIDTH ,ITEM_STATS_HEIGHT ,pStr, BLOCKFONT2, &usX, &usY);
wcscat( pStr, L"%%" );
mprintf( usX, usY, pStr );
@@ -4079,12 +4079,12 @@ void RenderItemDescriptionBox( )
SetFontForeground( 5 );
GetShortSectorString( ( INT16 ) SECTORX( KeyTable[ gpItemDescObject->ubKeyID ].usSectorFound ), ( INT16 ) SECTORY( KeyTable[ gpItemDescObject->ubKeyID ].usSectorFound ), sTempString );
GetShortSectorString( ( INT16 ) SECTORX( KeyTable[ gpItemDescObject->ItemData.Key.ubKeyID ].usSectorFound ), ( INT16 ) SECTORY( KeyTable[ gpItemDescObject->ItemData.Key.ubKeyID ].usSectorFound ), sTempString );
swprintf( pStr, L"%s", sTempString );
FindFontRightCoordinates( (INT16)(gWeaponStats[ 4 ].sX + gsInvDescX ), (INT16)(gWeaponStats[ 4 ].sY + gsInvDescY ), 110 ,ITEM_STATS_HEIGHT ,pStr, BLOCKFONT2, &usX, &usY);
mprintf( usX, usY, pStr );
swprintf( pStr, L"%d", KeyTable[ gpItemDescObject->ubKeyID ].usDateFound );
swprintf( pStr, L"%d", KeyTable[ gpItemDescObject->ItemData.Key.ubKeyID ].usDateFound );
FindFontRightCoordinates( (INT16)(gWeaponStats[ 4 ].sX + gsInvDescX ), (INT16)(gWeaponStats[ 4 ].sY + gsInvDescY + GetFontHeight( BLOCKFONT ) + 2 ), 110 ,ITEM_STATS_HEIGHT ,pStr, BLOCKFONT2, &usX, &usY);
mprintf( usX, usY, pStr );
}
@@ -5673,7 +5673,7 @@ void RenderKeyRingPopup( BOOLEAN fFullRender )
memset( &pObject, 0, sizeof( OBJECTTYPE ) );
pObject.usItem = KEY_1;
pObject.bStatus[ 0 ] = 100;
pObject.ItemData.Generic.bStatus[ 0 ] = 100;
// TAKE A LOOK AT THE VIDEO OBJECT SIZE ( ONE OF TWO SIZES ) AND CENTER!
GetVideoObject( &hVObject, guiItemPopupBoxes );
@@ -6517,7 +6517,7 @@ void SetupPickupPage( INT8 bPage )
pObject = (gfStealing)? &gpOpponent->inv[pTempItemPool->iItemIndex]
:&(gWorldItems[ pTempItemPool->iItemIndex ].o );
sValue = pObject->bStatus[ 0 ];
sValue = pObject->ItemData.Generic.bStatus[ 0 ];
// Adjust for ammo, other thingys..
if( Item[ pObject->usItem ].usItemClass & IC_AMMO || Item[ pObject->usItem ].usItemClass & IC_KEY )
@@ -6789,7 +6789,7 @@ void RenderItemPickupMenu( )
if ( Item[ pObject->usItem ].usItemClass == IC_MONEY )
{
CHAR16 pStr2[20];
swprintf( pStr2, L"%ld", pObject->uiMoneyAmount );
swprintf( pStr2, L"%ld", pObject->ItemData.Money.uiMoneyAmount );
InsertCommasForDollarFigure( pStr2 );
InsertDollarSignInToString( pStr2 );
@@ -7337,22 +7337,22 @@ void RemoveMoney()
InvSlot.bSlotIdInOtherLocation = -1;
//Remove the money from the money in the pocket
gpItemDescObject->uiMoneyAmount = gRemoveMoney.uiMoneyRemaining;
gpItemDescObject->ItemData.Money.uiMoneyAmount = gRemoveMoney.uiMoneyRemaining;
//Create an item to get the money that is being removed
CreateItem( MONEY, 0, &InvSlot.ItemObject );
//Set the amount thast is being removed
InvSlot.ItemObject.uiMoneyAmount = gRemoveMoney.uiMoneyRemoving;
InvSlot.ItemObject.ItemData.Money.uiMoneyAmount = gRemoveMoney.uiMoneyRemoving;
InvSlot.ubIdOfMercWhoOwnsTheItem = gpItemDescSoldier->ubProfile;
//if we are removing money from the players account
if( gfAddingMoneyToMercFromPlayersAccount )
{
gpItemDescObject->uiMoneyAmount = gRemoveMoney.uiMoneyRemoving;
gpItemDescObject->ItemData.Money.uiMoneyAmount = gRemoveMoney.uiMoneyRemoving;
//take the money from the player
AddTransactionToPlayersBook ( TRANSFER_FUNDS_TO_MERC, gpSMCurrentMerc->ubProfile, GetWorldTotalMin() , -(INT32)( gpItemDescObject->uiMoneyAmount ) );
AddTransactionToPlayersBook ( TRANSFER_FUNDS_TO_MERC, gpSMCurrentMerc->ubProfile, GetWorldTotalMin() , -(INT32)( gpItemDescObject->ItemData.Money.uiMoneyAmount ) );
}
memcpy( &gMoveingItem, &InvSlot, sizeof( INVENTORY_IN_SLOT ) );
@@ -7378,13 +7378,13 @@ void RemoveMoney()
//if we are removing money from the players account
if( gfAddingMoneyToMercFromPlayersAccount )
{
gpItemDescObject->uiMoneyAmount = gRemoveMoney.uiMoneyRemoving;
gpItemDescObject->ItemData.Money.uiMoneyAmount = gRemoveMoney.uiMoneyRemoving;
//take the money from the player
AddTransactionToPlayersBook ( TRANSFER_FUNDS_TO_MERC, gpSMCurrentMerc->ubProfile, GetWorldTotalMin() , -(INT32)( gpItemDescObject->uiMoneyAmount ) );
AddTransactionToPlayersBook ( TRANSFER_FUNDS_TO_MERC, gpSMCurrentMerc->ubProfile, GetWorldTotalMin() , -(INT32)( gpItemDescObject->ItemData.Money.uiMoneyAmount ) );
}
else
gpItemDescObject->uiMoneyAmount = gRemoveMoney.uiMoneyRemaining;
gpItemDescObject->ItemData.Money.uiMoneyAmount = gRemoveMoney.uiMoneyRemaining;
@@ -7438,7 +7438,7 @@ void GetHelpTextForItem( STR16 pzStr, OBJECTTYPE *pObject, SOLDIERTYPE *pSoldier
Remove when fixed!
*/
# if defined( _DEBUG )
if ( (pObject->ubGunAmmoType >= MAXITEMS)
if ( (pObject->ItemData.Gun.ubGunAmmoType >= MAXITEMS)
)
{
DebugMsg(TOPIC_JA2, DBG_LEVEL_1, String( "corrupted pObject (%s) found in GetHelpTextForItem()", (usItem<MAXITEMS) ? Item[usItem].szItemName : "???" ));
@@ -7453,13 +7453,13 @@ void GetHelpTextForItem( STR16 pzStr, OBJECTTYPE *pObject, SOLDIERTYPE *pSoldier
{
// Retrieve the status of the items
// Find the minimum status value - not just the first one
INT16 sValue = pObject->bStatus[ 0 ];
INT16 sValue = pObject->ItemData.Generic.bStatus[ 0 ];
for(INT16 i = 1; i < pObject->ubNumberOfObjects; i++)
{
if(pObject->bStatus[ i ] < sValue)
if(pObject->ItemData.Generic.bStatus[ i ] < sValue)
{
sValue = pObject->bStatus[ i ];
sValue = pObject->ItemData.Generic.bStatus[ i ];
}
}
@@ -7485,7 +7485,7 @@ void GetHelpTextForItem( STR16 pzStr, OBJECTTYPE *pObject, SOLDIERTYPE *pSoldier
case MONEY:
//Money
{
swprintf( pStr, L"%ld", pObject->uiMoneyAmount );
swprintf( pStr, L"%ld", pObject->ItemData.Money.uiMoneyAmount );
InsertCommasForDollarFigure( pStr );
InsertDollarSignInToString( pStr );
}
@@ -7496,7 +7496,7 @@ void GetHelpTextForItem( STR16 pzStr, OBJECTTYPE *pObject, SOLDIERTYPE *pSoldier
//if ( Item[ usItem ].usItemClass == IC_MONEY )
{
CHAR16 pStr2[20];
swprintf( pStr2, L"%ld", pObject->uiMoneyAmount );
swprintf( pStr2, L"%ld", pObject->ItemData.Money.uiMoneyAmount );
InsertCommasForDollarFigure( pStr2 );
InsertDollarSignInToString( pStr2 );
@@ -7633,7 +7633,7 @@ void GetHelpTextForItem( STR16 pzStr, OBJECTTYPE *pObject, SOLDIERTYPE *pSoldier
// The next is for ammunition which gets the measurement 'rnds'
swprintf( pStr, L"%s [%d rnds]\n%s %1.1f %s",
ItemNames[ usItem ], //Item long name
pObject->ubShotsLeft[0], //Shots left
pObject->ItemData.Ammo.ubShotsLeft[0], //Shots left
gWeaponStatsDesc[ 12 ], //Weight String
fWeight, //Weight
GetWeightUnitString() //Weight units
+3 -3
View File
@@ -5661,7 +5661,7 @@ void KeyRingSlotInvClickCallback( MOUSE_REGION * pRegion, INT32 iReason )
//usOldItemIndex = gpSMCurrentMerc->inv[ uiHandPos ].usItem;
//usNewItemIndex = gpItemPointer->usItem;
if ( gpItemPopupSoldier->pKeyRing[ uiKeyRing ].ubKeyID == INVALID_KEY_NUMBER || gpItemPopupSoldier->pKeyRing[ uiKeyRing ].ubKeyID == gpItemPointer->ubKeyID)
if ( gpItemPopupSoldier->pKeyRing[ uiKeyRing ].ubKeyID == INVALID_KEY_NUMBER || gpItemPopupSoldier->pKeyRing[ uiKeyRing ].ubKeyID == gpItemPointer->ItemData.Key.ubKeyID)
{
// Try to place here
if ( ( iNumberOfKeysTaken = AddKeysToSlot( gpItemPopupSoldier, ( INT8 )uiKeyRing, gpItemPointer ) ) )
@@ -5904,7 +5904,7 @@ void SMInvMoneyButtonCallback( MOUSE_REGION * pRegion, INT32 iReason )
guiPendingOverrideEvent = A_CHANGE_TO_MOVE;
HandleTacticalUI( );
swprintf( zMoney, L"%d", gpItemPointer->uiMoneyAmount );
swprintf( zMoney, L"%d", gpItemPointer->ItemData.Money.uiMoneyAmount );
InsertCommasForDollarFigure( zMoney );
InsertDollarSignInToString( zMoney );
@@ -5949,7 +5949,7 @@ void ConfirmationToDepositMoneyToPlayersAccount( UINT8 ubExitValue )
if ( ubExitValue == MSG_BOX_RETURN_YES )
{
//add the money to the players account
AddTransactionToPlayersBook( MERC_DEPOSITED_MONEY_TO_PLAYER_ACCOUNT, gpSMCurrentMerc->ubProfile, GetWorldTotalMin(), gpItemPointer->uiMoneyAmount );
AddTransactionToPlayersBook( MERC_DEPOSITED_MONEY_TO_PLAYER_ACCOUNT, gpSMCurrentMerc->ubProfile, GetWorldTotalMin(), gpItemPointer->ItemData.Money.uiMoneyAmount );
// dirty shopkeeper
gubSkiDirtyLevel = SKI_DIRTY_LEVEL2;
+2 -2
View File
@@ -364,7 +364,7 @@ void DrawItemUIBarEx( OBJECTTYPE *pObject, UINT8 ubStatus, INT16 sXPos, INT16 sY
}
else
{
sValue = pObject->bStatus[ ubStatus ];
sValue = pObject->ItemData.Generic.bStatus[ ubStatus ];
}
// Adjust for ammo, other thingys..
@@ -375,7 +375,7 @@ void DrawItemUIBarEx( OBJECTTYPE *pObject, UINT8 ubStatus, INT16 sXPos, INT16 sY
if ( sValue < 0 )
{
sValue = pObject->ubShotsLeft[0] * 100 / Magazine[ Item[ pObject->usItem ].ubClassIndex ].ubMagSize;
sValue = pObject->ItemData.Ammo.ubShotsLeft[0] * 100 / Magazine[ Item[ pObject->usItem ].ubClassIndex ].ubMagSize;
DebugMsg ( TOPIC_JA2, DBG_LEVEL_3, String("Ammo status: shots left %d * 100 / Mag Size %d = value %d",pObject->ubShotsLeft[0],Magazine[ Item[ pObject->usItem ].ubClassIndex ].ubMagSize,sValue ));
}
if ( sValue > 100 )
+8 -8
View File
@@ -553,7 +553,7 @@ void GenerateRandomEquipment( SOLDIERCREATE_STRUCT *pp, INT8 bSoldierClass, INT8
{
fLAW = FALSE;
}
pItem->ubGunState |= GS_CARTRIDGE_IN_CHAMBER;
pItem->ItemData.Gun.ubGunState |= GS_CARTRIDGE_IN_CHAMBER;
break;
case IC_AMMO:
bAmmoClips = 0;
@@ -563,7 +563,7 @@ void GenerateRandomEquipment( SOLDIERCREATE_STRUCT *pp, INT8 bSoldierClass, INT8
bKnifeClass = 0;
break;
case IC_LAUNCHER:
pItem->ubGunState |= GS_CARTRIDGE_IN_CHAMBER;
pItem->ItemData.Gun.ubGunState |= GS_CARTRIDGE_IN_CHAMBER;
fGrenadeLauncher = FALSE;
if (fMortar || fRPG)
{
@@ -660,8 +660,8 @@ void ChooseWeaponForSoldierCreateStruct( SOLDIERCREATE_STRUCT *pp, INT8 bWeaponC
usGunIndex = pp->Inv[ i ].usItem;
ubChanceStandardAmmo = 100 - (bWeaponClass * -9); // weapon class is negative!
usAmmoIndex = RandomMagazine( usGunIndex, ubChanceStandardAmmo );
pp->Inv[ i ].ubGunAmmoType = Magazine[Item[usAmmoIndex].ubClassIndex].ubAmmoType;
pp->Inv[ i ].usGunAmmoItem = usAmmoIndex;
pp->Inv[ i ].ItemData.Gun.ubGunAmmoType = Magazine[Item[usAmmoIndex].ubClassIndex].ubAmmoType;
pp->Inv[ i ].ItemData.Gun.usGunAmmoItem = usAmmoIndex;
if ( Item[usGunIndex].fingerprintid )
{
@@ -903,7 +903,7 @@ void ChooseWeaponForSoldierCreateStruct( SOLDIERCREATE_STRUCT *pp, INT8 bWeaponC
DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("ChooseWeaponForSoldierCreateStruct: Set bullets"));
//set bullets = to magsize including any attachments (c-mag adapters, etc)
pp->Inv[ HANDPOS ].ubGunShotsLeft = GetMagSize(&pp->Inv[ HANDPOS ]);
pp->Inv[ HANDPOS ].ItemData.Gun.ubGunShotsLeft = GetMagSize(&pp->Inv[ HANDPOS ]);
DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("ChooseWeaponForSoldierCreateStruct: choose ammo"));
if( bAmmoClips )
@@ -929,8 +929,8 @@ void ChooseWeaponForSoldierCreateStruct( SOLDIERCREATE_STRUCT *pp, INT8 bWeaponC
//}
usAmmoIndex = RandomMagazine( &pp->Inv[HANDPOS], ubChanceStandardAmmo );
pp->Inv[ HANDPOS ].ubGunAmmoType = Magazine[Item[usAmmoIndex].ubClassIndex].ubAmmoType;
pp->Inv[ HANDPOS ].usGunAmmoItem = usAmmoIndex;
pp->Inv[ HANDPOS ].ItemData.Gun.ubGunAmmoType = Magazine[Item[usAmmoIndex].ubClassIndex].ubAmmoType;
pp->Inv[ HANDPOS ].ItemData.Gun.usGunAmmoItem = usAmmoIndex;
}
//Ammo
@@ -2845,7 +2845,7 @@ void ReplaceExtendedGuns( SOLDIERCREATE_STRUCT *pp, INT8 bSoldierClass )
{
// have to replace! but first (ugh) must store backup (b/c of attachments)
CopyObj( &(pp->Inv[ uiLoop ]), &OldObj );
CreateItem( usNewGun, OldObj.bGunStatus, &(pp->Inv[ uiLoop ]) );
CreateItem( usNewGun, OldObj.ItemData.Gun.bGunStatus, &(pp->Inv[ uiLoop ]) );
pp->Inv[ uiLoop ].fFlags = OldObj.fFlags;
// copy any valid attachments; for others, just drop them...
+22 -22
View File
@@ -84,21 +84,21 @@ typedef struct
INT8 bGunAmmoStatus; // only for "attached ammo" - grenades, mortar shells
UINT8 ubGunState; // SB manual recharge
UINT8 ubGunUnused[MAX_OBJECTS_PER_SLOT - 6];
};
} Gun;
struct
{
UINT8 ubShotsLeft[MAX_OBJECTS_PER_SLOT];
};
} Ammo;
struct
{
INT8 bStatus[MAX_OBJECTS_PER_SLOT];
};
} Generic;
struct
{
INT8 bMoneyStatus;
UINT32 uiMoneyAmount;
UINT8 ubMoneyUnused[MAX_OBJECTS_PER_SLOT - 5];
};
} Money;
struct
{ // this is used by placed bombs, switches, and the action item
INT8 bBombStatus; // % status
@@ -106,42 +106,42 @@ typedef struct
UINT16 usBombItem; // the usItem of the bomb.
union
{
struct
{
//struct
//{
INT8 bDelay; // >=0 values used only
};
struct
{
//};
//struct
//{
INT8 bFrequency; // >=0 values used only
};
};
//};
} BombTrigger;
UINT8 ubBombOwner; // side which placed the bomb
UINT8 bActionValue;// this is used by the ACTION_ITEM fake item
union
{
struct
{
//struct
//{
UINT8 ubTolerance; // tolerance value for panic triggers
};
struct
{
//};
//struct
//{
UINT8 ubLocationID; // location value for remote non-bomb (special!) triggers
};
};
};
//};
} Area;
} Trigger;
struct
{
INT8 bKeyStatus[ 6 ];
UINT8 ubKeyID;
UINT8 ubKeyUnused[1];
};
} Key;
struct
{
UINT8 ubOwnerProfile;
UINT8 ubOwnerCivGroup;
UINT8 ubOwnershipUnused[6];
};
};
} Owner;
} ItemData;
// attached objects
UINT16 usAttachItem[MAX_ATTACHMENTS];
INT8 bAttachStatus[MAX_ATTACHMENTS];
+252 -260
View File
File diff suppressed because it is too large Load Diff
+1
View File
@@ -60,6 +60,7 @@ extern UINT16 DefaultMagazine( UINT16 usItem );
UINT16 RandomMagazine( UINT16 usItem, UINT8 ubPercentStandard );
UINT16 RandomMagazine( OBJECTTYPE * pGun, UINT8 ubPercentStandard );
extern BOOLEAN ReloadGun( SOLDIERTYPE * pSoldier, OBJECTTYPE * pGun, OBJECTTYPE * pAmmo );
extern BOOLEAN UnloadGun( SOLDIERTYPE * pSoldier, OBJECTTYPE * pGun);
UINT8 ItemSlotLimit( UINT16 usItem, INT8 bSlot );
+1 -1
View File
@@ -199,7 +199,7 @@ BOOLEAN KeyExistsInInventory( SOLDIERTYPE *pSoldier, UINT8 ubKeyID )
{
if (Item[pSoldier->inv[ubLoop].usItem].usItemClass == IC_KEY)
{
if ( (pSoldier->inv[ubLoop].ubKeyID == ubKeyID) || (ubKeyID == ANYKEY) )
if ( (pSoldier->inv[ubLoop].ItemData.Key.ubKeyID == ubKeyID) || (ubKeyID == ANYKEY) )
{
// there's the key we want!
return( TRUE );
+19 -19
View File
@@ -1998,7 +1998,7 @@ BOOLEAN BulletHitMerc( BULLET * pBullet, STRUCTURE * pStructure, BOOLEAN fIntend
}
else
{
ubAmmoType = pFirer->inv[pFirer->ubAttackingHand].ubGunAmmoType;
ubAmmoType = pFirer->inv[pFirer->ubAttackingHand].ItemData.Gun.ubGunAmmoType;
}
// at least partly compensate for "near miss" increases for this guy, after all, the bullet
@@ -2119,12 +2119,12 @@ BOOLEAN BulletHitMerc( BULLET * pBullet, STRUCTURE * pStructure, BOOLEAN fIntend
// lucky bastard was facing away!
}
// else if ( ( (pTarget->inv[HEAD1POS].usItem == NIGHTGOGGLES) || (pTarget->inv[HEAD1POS].usItem == SUNGOGGLES) || (pTarget->inv[HEAD1POS].usItem == GASMASK) ) && ( PreRandom( 100 ) < (UINT32) (pTarget->inv[HEAD1POS].bStatus[ 0 ]) ) )
else if ( ( (pTarget->inv[HEAD1POS].usItem != NONE) ) && ( PreRandom( 100 ) < (UINT32) (pTarget->inv[HEAD1POS].bStatus[ 0 ]) ) )
else if ( ( (pTarget->inv[HEAD1POS].usItem != NONE) ) && ( PreRandom( 100 ) < (UINT32) (pTarget->inv[HEAD1POS].ItemData.Generic.bStatus[ 0 ]) ) )
{
// lucky bastard was wearing protective stuff
bHeadSlot = HEAD1POS;
}
else if ( ( (pTarget->inv[HEAD2POS].usItem != NONE) ) && ( PreRandom( 100 ) < (UINT32) (pTarget->inv[HEAD2POS].bStatus[ 0 ]) ) )
else if ( ( (pTarget->inv[HEAD2POS].usItem != NONE) ) && ( PreRandom( 100 ) < (UINT32) (pTarget->inv[HEAD2POS].ItemData.Generic.bStatus[ 0 ]) ) )
{
// lucky bastard was wearing protective stuff
bHeadSlot = HEAD2POS;
@@ -2204,10 +2204,10 @@ BOOLEAN BulletHitMerc( BULLET * pBullet, STRUCTURE * pStructure, BOOLEAN fIntend
{
if (bHeadSlot != NO_SLOT)
{
pTarget->inv[ bHeadSlot ].bStatus[ 0 ] -= (INT8) ( (iImpact / 2) + Random( (iImpact / 2) ) );
if ( pTarget->inv[ bHeadSlot ].bStatus[ 0 ] <= USABLE )
pTarget->inv[ bHeadSlot ].ItemData.Generic.bStatus[ 0 ] -= (INT8) ( (iImpact / 2) + Random( (iImpact / 2) ) );
if ( pTarget->inv[ bHeadSlot ].ItemData.Generic.bStatus[ 0 ] <= USABLE )
{
if ( pTarget->inv[ bHeadSlot ].bStatus[ 0 ] <= 0 )
if ( pTarget->inv[ bHeadSlot ].ItemData.Generic.bStatus[ 0 ] <= 0 )
{
DeleteObj( &(pTarget->inv[ bHeadSlot ]) );
DirtyMercPanelInterface( pTarget, DIRTYLEVEL2 );
@@ -2222,11 +2222,11 @@ BOOLEAN BulletHitMerc( BULLET * pBullet, STRUCTURE * pStructure, BOOLEAN fIntend
bHeadSlot = HEAD1POS + (INT8) Random( 2 );
if ( pTarget->inv[ bHeadSlot ].usItem != NOTHING )
{
pTarget->inv[ bHeadSlot ].bStatus[ 0 ] -= (INT8) ( Random( iImpact / 2 ) );
if ( pTarget->inv[ bHeadSlot ].bStatus[ 0 ] < 0 )
pTarget->inv[ bHeadSlot ].ItemData.Generic.bStatus[ 0 ] -= (INT8) ( Random( iImpact / 2 ) );
if ( pTarget->inv[ bHeadSlot ].ItemData.Generic.bStatus[ 0 ] < 0 )
{
// just break it...
pTarget->inv[ bHeadSlot ].bStatus[ 0 ] = 1;
pTarget->inv[ bHeadSlot ].ItemData.Generic.bStatus[ 0 ] = 1;
}
}
}
@@ -2465,7 +2465,7 @@ INT32 HandleBulletStructureInteraction( BULLET * pBullet, STRUCTURE * pStructure
//else if ( pBullet->usFlags & BULLET_FLAG_SMALL_MISSILE )
//{
// stops if using HE ammo
else if ( AmmoTypes[pBullet->pFirer->inv[ pBullet->pFirer->ubAttackingHand ].ubGunAmmoType].highExplosive && !AmmoTypes[pBullet->pFirer->inv[ pBullet->pFirer->ubAttackingHand ].ubGunAmmoType].antiTank )
else if ( AmmoTypes[pBullet->pFirer->inv[ pBullet->pFirer->ubAttackingHand ].ItemData.Gun.ubGunAmmoType].highExplosive && !AmmoTypes[pBullet->pFirer->inv[ pBullet->pFirer->ubAttackingHand ].ItemData.Gun.ubGunAmmoType].antiTank )
{
*pfHit = TRUE;
return( 0 );
@@ -2481,7 +2481,7 @@ INT32 HandleBulletStructureInteraction( BULLET * pBullet, STRUCTURE * pStructure
pDoor = FindDoorInfoAtGridNo( pBullet->sGridNo );
// Does it have a lock?
INT16 lockBustingPower = AmmoTypes[pBullet->pFirer->inv[ pBullet->pFirer->ubAttackingHand ].ubGunAmmoType].lockBustingPower;
INT16 lockBustingPower = AmmoTypes[pBullet->pFirer->inv[ pBullet->pFirer->ubAttackingHand ].ItemData.Gun.ubGunAmmoType].lockBustingPower;
// WANNE: bugfix: No door returned, so the game crashes!
if (pDoor)
@@ -2545,7 +2545,7 @@ INT32 HandleBulletStructureInteraction( BULLET * pBullet, STRUCTURE * pStructure
iImpactReduction = gubMaterialArmour[ pStructure->pDBStructureRef->pDBStructure->ubArmour ];
iImpactReduction = StructureResistanceIncreasedByRange( iImpactReduction, pBullet->iRange, pBullet->iLoop );
iImpactReduction = (INT32) (iImpactReduction * AmmoTypes[pBullet->pFirer->inv[ pBullet->pFirer->ubAttackingHand ].ubGunAmmoType].structureImpactReductionMultiplier / max(1,AmmoTypes[pBullet->pFirer->inv[ pBullet->pFirer->ubAttackingHand ].ubGunAmmoType].structureImpactReductionDivisor));
iImpactReduction = (INT32) (iImpactReduction * AmmoTypes[pBullet->pFirer->inv[ pBullet->pFirer->ubAttackingHand ].ItemData.Gun.ubGunAmmoType].structureImpactReductionMultiplier / max(1,AmmoTypes[pBullet->pFirer->inv[ pBullet->pFirer->ubAttackingHand ].ItemData.Gun.ubGunAmmoType].structureImpactReductionDivisor));
//switch (pBullet->pFirer->inv[ pBullet->pFirer->ubAttackingHand ].ubGunAmmoType)
//{
@@ -2599,7 +2599,7 @@ INT32 CTGTHandleBulletStructureInteraction( BULLET * pBullet, STRUCTURE * pStruc
//else if ( pBullet->usFlags & BULLET_FLAG_SMALL_MISSILE )
//{
// stops if using HE ammo
else if ( AmmoTypes[pBullet->pFirer->inv[ pBullet->pFirer->ubAttackingHand ].ubGunAmmoType].highExplosive && !AmmoTypes[pBullet->pFirer->inv[ pBullet->pFirer->ubAttackingHand ].ubGunAmmoType].antiTank )
else if ( AmmoTypes[pBullet->pFirer->inv[ pBullet->pFirer->ubAttackingHand ].ItemData.Gun.ubGunAmmoType].highExplosive && !AmmoTypes[pBullet->pFirer->inv[ pBullet->pFirer->ubAttackingHand ].ItemData.Gun.ubGunAmmoType].antiTank )
{
return( pBullet->iImpact );
}
@@ -2626,7 +2626,7 @@ INT32 CTGTHandleBulletStructureInteraction( BULLET * pBullet, STRUCTURE * pStruc
iImpactReduction = gubMaterialArmour[ pStructure->pDBStructureRef->pDBStructure->ubArmour ] * pStructure->pDBStructureRef->pDBStructure->ubDensity / 100;
iImpactReduction = StructureResistanceIncreasedByRange( iImpactReduction, pBullet->iRange, pBullet->iLoop );
iImpactReduction = (INT32)(iImpactReduction * AmmoTypes[pBullet->pFirer->inv[ pBullet->pFirer->ubAttackingHand ].ubGunAmmoType].structureImpactReductionMultiplier / max(1,AmmoTypes[pBullet->pFirer->inv[ pBullet->pFirer->ubAttackingHand ].ubGunAmmoType].structureImpactReductionDivisor));
iImpactReduction = (INT32)(iImpactReduction * AmmoTypes[pBullet->pFirer->inv[ pBullet->pFirer->ubAttackingHand ].ItemData.Gun.ubGunAmmoType].structureImpactReductionMultiplier / max(1,AmmoTypes[pBullet->pFirer->inv[ pBullet->pFirer->ubAttackingHand ].ItemData.Gun.ubGunAmmoType].structureImpactReductionDivisor));
//switch (pBullet->pFirer->inv[ pBullet->pFirer->ubAttackingHand ].ubGunAmmoType)
//{
@@ -3608,7 +3608,7 @@ INT8 FireBulletGivenTarget( SOLDIERTYPE * pFirer, FLOAT dEndX, FLOAT dEndY, FLOA
usBulletFlags |= BULLET_FLAG_FLAME;
ubSpreadIndex = 2;
}
else if ( AmmoTypes[ pFirer->inv[pFirer->ubAttackingHand].ubGunAmmoType ].tracerEffect && (pFirer->bDoBurst || gGameSettings.fOptions[ TOPTION_TRACERS_FOR_SINGLE_FIRE ]) )
else if ( AmmoTypes[ pFirer->inv[pFirer->ubAttackingHand].ItemData.Gun.ubGunAmmoType ].tracerEffect && (pFirer->bDoBurst || gGameSettings.fOptions[ TOPTION_TRACERS_FOR_SINGLE_FIRE ]) )
{
//usBulletFlags |= BULLET_FLAG_TRACER;
fTracer = TRUE;
@@ -3622,7 +3622,7 @@ INT8 FireBulletGivenTarget( SOLDIERTYPE * pFirer, FLOAT dEndX, FLOAT dEndY, FLOA
// shotgun pellets fire 9 bullets doing 1/4 damage each
if (!fFake)
{
ubShots = AmmoTypes[pFirer->inv[pFirer->ubAttackingHand].ubGunAmmoType].numberOfBullets;
ubShots = AmmoTypes[pFirer->inv[pFirer->ubAttackingHand].ItemData.Gun.ubGunAmmoType].numberOfBullets;
// but you can't really aim the damn things very well!
if (sHitBy > 0)
{
@@ -3640,7 +3640,7 @@ INT8 FireBulletGivenTarget( SOLDIERTYPE * pFirer, FLOAT dEndX, FLOAT dEndY, FLOA
}
// ubImpact = AMMO_DAMAGE_ADJUSTMENT_BUCKSHOT( ubImpact );
ubImpact = (UINT8) (ubImpact * AmmoTypes[pFirer->inv[pFirer->ubAttackingHand].ubGunAmmoType].multipleBulletDamageMultiplier / max(1,AmmoTypes[pFirer->inv[pFirer->ubAttackingHand].ubGunAmmoType].multipleBulletDamageDivisor) );
ubImpact = (UINT8) (ubImpact * AmmoTypes[pFirer->inv[pFirer->ubAttackingHand].ItemData.Gun.ubGunAmmoType].multipleBulletDamageMultiplier / max(1,AmmoTypes[pFirer->inv[pFirer->ubAttackingHand].ItemData.Gun.ubGunAmmoType].multipleBulletDamageDivisor) );
}
}
@@ -3727,7 +3727,7 @@ INT8 FireBulletGivenTarget( SOLDIERTYPE * pFirer, FLOAT dEndX, FLOAT dEndY, FLOA
if ( pBullet->usFlags & BULLET_FLAG_KNIFE )
{
pBullet->ubItemStatus = pFirer->inv[pFirer->ubAttackingHand].bStatus[0];
pBullet->ubItemStatus = pFirer->inv[pFirer->ubAttackingHand].ItemData.Generic.bStatus[0];
}
// apply increments for first move
@@ -3787,7 +3787,7 @@ INT8 ChanceToGetThrough( SOLDIERTYPE * pFirer, FLOAT dEndX, FLOAT dEndY, FLOAT d
// if shotgun, shotgun would have to be in main hand
if ( pFirer->inv[ HANDPOS ].usItem == pFirer->usAttackingWeapon )
{
if ( AmmoTypes[pFirer->inv[ HANDPOS ].ubGunAmmoType].numberOfBullets > 1 )
if ( AmmoTypes[pFirer->inv[ HANDPOS ].ItemData.Gun.ubGunAmmoType].numberOfBullets > 1 )
{
fBuckShot = TRUE;
}
+1 -1
View File
@@ -138,7 +138,7 @@ INT8 HireMerc( MERC_HIRE_STRUCT *pHireMerc)
memset( &Object, 0, sizeof( OBJECTTYPE ) );
Object.usItem = LETTER;
Object.ubNumberOfObjects = 1;
Object.bStatus[0] = 100;
Object.ItemData.Generic.bStatus[0] = 100;
// Give it
fReturn = AutoPlaceObject( MercPtrs[iNewIndex], &Object, FALSE );
Assert( fReturn );
+12 -2
View File
@@ -222,6 +222,11 @@ void PrepareMilitiaForTactical( BOOLEAN fPrepareAll)
if ( gWorldSectorX ==0 && gWorldSectorY == 0 )
return;
for (int i=0; i<TOTAL_SOLDIERS; i++)
{
Assert( !MercPtrs[i]->bActive || !MercPtrs[i]->bInSector || MercPtrs[i]->sGridNo != NOWHERE);
}
pSector = &SectorInfo[ SECTOR( gWorldSectorX, gWorldSectorY ) ];
ubGreen = pSector->ubNumberOfCivsAtLevel[ GREEN_MILITIA ];
ubRegs = pSector->ubNumberOfCivsAtLevel[ REGULAR_MILITIA ];
@@ -248,8 +253,8 @@ void PrepareMilitiaForTactical( BOOLEAN fPrepareAll)
ubElites -= gpAttackDirs[ x ][2];
}
}
else
{
//else
//{
#endif
AddSoldierInitListMilitiaOnEdge( gpAttackDirs[ x ][ 3 ], gpAttackDirs[ x ][0], gpAttackDirs[ x ][1], gpAttackDirs[ x ][2] );
}
@@ -269,6 +274,11 @@ void PrepareMilitiaForTactical( BOOLEAN fPrepareAll)
//// MercPtrs[ i ]->bAttitude = AGGRESSIVE;
// }
// }
for (int i=0; i<TOTAL_SOLDIERS; i++)
{
Assert( !MercPtrs[i]->bActive || !MercPtrs[i]->bInSector || MercPtrs[i]->sGridNo != NOWHERE);
}
}
void HandleMilitiaPromotions( void )
+6 -6
View File
@@ -1626,7 +1626,7 @@ BOOLEAN EnoughAmmo( SOLDIERTYPE *pSoldier, BOOLEAN fDisplay, INT8 bInvPos )
}
else if (Item[ pSoldier->inv[ bInvPos ].usItem ].usItemClass == IC_GUN)
{
if ( pSoldier->inv[ bInvPos ].ubGunShotsLeft == 0 )
if ( pSoldier->inv[ bInvPos ].ItemData.Gun.ubGunShotsLeft == 0 )
{
if ( fDisplay )
{
@@ -1638,7 +1638,7 @@ BOOLEAN EnoughAmmo( SOLDIERTYPE *pSoldier, BOOLEAN fDisplay, INT8 bInvPos )
//<SB> manual recharge
if( pSoldier->bTeam == OUR_TEAM )
{
if ( !( pSoldier->inv[ bInvPos ].ubGunState & GS_CARTRIDGE_IN_CHAMBER ) )
if ( !( pSoldier->inv[ bInvPos ].ItemData.Gun.ubGunState & GS_CARTRIDGE_IN_CHAMBER ) )
{
return( FALSE );
}
@@ -1677,11 +1677,11 @@ void DeductAmmo( SOLDIERTYPE *pSoldier, INT8 bInvPos )
if ( pSoldier->usAttackingWeapon == pObj->usItem)
{
// OK, let's see, don't overrun...
if ( pObj->ubGunShotsLeft != 0 )
if ( pObj->ItemData.Gun.ubGunShotsLeft != 0 )
{
pObj->ubGunShotsLeft--;
pObj->ItemData.Gun.ubGunShotsLeft--;
//Pulmu: Update weight after firing gun to account for bullets fired
if( gGameExternalOptions.fAmmoDynamicWeight == TRUE && pObj->ubGunShotsLeft > 0)
if( gGameExternalOptions.fAmmoDynamicWeight == TRUE && pObj->ItemData.Gun.ubGunShotsLeft > 0)
{
pSoldier->inv[HANDPOS].ubWeight = CalculateObjectWeight( &(pSoldier->inv[HANDPOS]));
}
@@ -1823,7 +1823,7 @@ INT8 GetAPsToAutoReload( SOLDIERTYPE * pSoldier )
pObj = &(pSoldier->inv[HANDPOS]);
//<SB> manual recharge
if (pObj->ubGunShotsLeft && !(pObj->ubGunState & GS_CARTRIDGE_IN_CHAMBER) )
if (pObj->ItemData.Gun.ubGunShotsLeft && !(pObj->ItemData.Gun.ubGunState & GS_CARTRIDGE_IN_CHAMBER) )
{
return Weapon[Item[(pObj)->usItem].ubClassIndex].APsToReloadManually;
}
+2 -2
View File
@@ -939,8 +939,8 @@ BOOLEAN TurnSoldierIntoCorpse( SOLDIERTYPE *pSoldier, BOOLEAN fRemoveMerc, BOOLE
if ( Item[pObj->usItem].damageable && Item[pObj->usItem].usItemClass != IC_THROWING_KNIFE ) // Madd: drop crappier items from enemies on higher difficulty levels - note the quick fix for throwing knives
{
pObj->bStatus[0] -= (gGameOptions.ubDifficultyLevel - 1) * Random(20);
pObj->bStatus[0] = min(max(pObj->bStatus[0],1),100); // never below 1% or above 100%
pObj->ItemData.Generic.bStatus[0] -= (gGameOptions.ubDifficultyLevel - 1) * Random(20);
pObj->ItemData.Generic.bStatus[0] = min(max(pObj->ItemData.Generic.bStatus[0],1),100); // never below 1% or above 100%
}
}
+36 -36
View File
@@ -2287,7 +2287,7 @@ void SelectPlayersOfferSlotsRegionCallBack(MOUSE_REGION * pRegion, INT32 iReason
{
//Since money is always evaluated
PlayersOfferArea[ ubSelectedInvSlot ].uiFlags |= ARMS_INV_PLAYERS_ITEM_HAS_VALUE;
PlayersOfferArea[ ubSelectedInvSlot ].uiItemPrice = PlayersOfferArea[ ubSelectedInvSlot ].ItemObject.bMoneyStatus;
PlayersOfferArea[ ubSelectedInvSlot ].uiItemPrice = PlayersOfferArea[ ubSelectedInvSlot ].ItemObject.ItemData.Money.bMoneyStatus;
}
}
else // slot is empty
@@ -2759,7 +2759,7 @@ UINT32 DisplayInvSlot( UINT8 ubSlotNum, UINT16 usItemIndex, UINT16 usPosX, UINT1
}
// Display 'JAMMED' if it's jammed
if ( pItemObject->bGunAmmoStatus < 0 )
if ( pItemObject->ItemData.Gun.bGunAmmoStatus < 0 )
{
swprintf( zTemp, TacticalStr[ JAMMED_ITEM_STR ] );
VarFindFontCenterCoordinates( usPosX, usPosY, SKI_INV_SLOT_WIDTH, SKI_INV_HEIGHT, TINYFONT1, &sCenX, &sCenY, zTemp );
@@ -3002,7 +3002,7 @@ BOOLEAN RepairIsDone(UINT16 usItemIndex, UINT8 ubElement)
if ( CanDealerRepairItem( gbSelectedArmsDealerID, RepairItem.ItemObject.usItem ) )
{
// make its condition 100%
RepairItem.ItemObject.bStatus[ 0 ] = 100;
RepairItem.ItemObject.ItemData.Generic.bStatus[ 0 ] = 100;
}
// max condition of all permanent attachments on it
@@ -3096,25 +3096,25 @@ UINT32 CalcShopKeeperItemPrice( BOOLEAN fDealerSelling, BOOLEAN fUnitPriceOnly,
case IC_GUN:
// add value of the gun
uiUnitPrice += (UINT32)( CalcValueOfItemToDealer( gbSelectedArmsDealerID, usItemID, fDealerSelling ) *
ItemConditionModifier(usItemID, pItemObject->bGunStatus) *
ItemConditionModifier(usItemID, pItemObject->ItemData.Gun.bGunStatus) *
dModifier );
// if any ammo is loaded
if( pItemObject->usGunAmmoItem != NONE)
if( pItemObject->ItemData.Gun.usGunAmmoItem != NONE)
{
// if it's regular ammo
if( Item[ pItemObject->usGunAmmoItem ].usItemClass == IC_AMMO )
if( Item[ pItemObject->ItemData.Gun.usGunAmmoItem ].usItemClass == IC_AMMO )
{
// add value of its remaining ammo
uiUnitPrice += (UINT32)( CalcValueOfItemToDealer( gbSelectedArmsDealerID, pItemObject->usGunAmmoItem, fDealerSelling ) *
ItemConditionModifier(pItemObject->usGunAmmoItem, pItemObject->ubGunShotsLeft) *
uiUnitPrice += (UINT32)( CalcValueOfItemToDealer( gbSelectedArmsDealerID, pItemObject->ItemData.Gun.usGunAmmoItem, fDealerSelling ) *
ItemConditionModifier(pItemObject->ItemData.Gun.usGunAmmoItem, pItemObject->ItemData.Gun.ubGunShotsLeft) *
dModifier );
}
else // assume it's attached ammo (mortar shells, grenades)
{
// add its value (uses normal status 0-100)
uiUnitPrice += (UINT32)( CalcValueOfItemToDealer( gbSelectedArmsDealerID, pItemObject->usGunAmmoItem, fDealerSelling ) *
ItemConditionModifier(pItemObject->usGunAmmoItem, pItemObject->bGunAmmoStatus) *
uiUnitPrice += (UINT32)( CalcValueOfItemToDealer( gbSelectedArmsDealerID, pItemObject->ItemData.Gun.usGunAmmoItem, fDealerSelling ) *
ItemConditionModifier(pItemObject->ItemData.Gun.usGunAmmoItem, pItemObject->ItemData.Gun.bGunAmmoStatus) *
dModifier );
}
}
@@ -3145,7 +3145,7 @@ UINT32 CalcShopKeeperItemPrice( BOOLEAN fDealerSelling, BOOLEAN fUnitPriceOnly,
{
// for bullets, ItemConditionModifier will convert the #ShotsLeft into a percentage
uiUnitPrice += (UINT32)( CalcValueOfItemToDealer( gbSelectedArmsDealerID, usItemID, fDealerSelling ) *
ItemConditionModifier(usItemID, pItemObject->ubShotsLeft[ubCnt]) *
ItemConditionModifier(usItemID, pItemObject->ItemData.Ammo.ubShotsLeft[ubCnt]) *
dModifier );
if ( fUnitPriceOnly )
@@ -3176,7 +3176,7 @@ UINT32 CalcShopKeeperItemPrice( BOOLEAN fDealerSelling, BOOLEAN fUnitPriceOnly,
{
// for bullets, ItemConditionModifier will convert the #ShotsLeft into a percentage
uiUnitPrice += (UINT32)( CalcValueOfItemToDealer( gbSelectedArmsDealerID, usItemID, fDealerSelling ) *
ItemConditionModifier(usItemID, pItemObject->bStatus[ ubCnt ]) *
ItemConditionModifier(usItemID, pItemObject->ItemData.Generic.bStatus[ ubCnt ]) *
dModifier );
if ( fUnitPriceOnly )
@@ -3525,7 +3525,7 @@ INT8 AddItemToPlayersOfferArea( UINT8 ubProfileID, INVENTORY_IN_SLOT* pInvSlot,
{
//Since money is always evaluated
PlayersOfferArea[ bCnt ].uiFlags |= ARMS_INV_PLAYERS_ITEM_HAS_VALUE;
PlayersOfferArea[ bCnt ].uiItemPrice = PlayersOfferArea[ bCnt ].ItemObject.uiMoneyAmount;
PlayersOfferArea[ bCnt ].uiItemPrice = PlayersOfferArea[ bCnt ].ItemObject.ItemData.Money.uiMoneyAmount;
}
gubSkiDirtyLevel = SKI_DIRTY_LEVEL2;
@@ -3596,8 +3596,8 @@ void DisplayPlayersOfferArea()
sSoldierID = GetSoldierIDFromMercID( PlayersOfferArea[ sCnt ].ubIdOfMercWhoOwnsTheItem );
Assert(sSoldierID != -1);
PlayersOfferArea[ sCnt ].ItemObject.uiMoneyAmount = Menptr[ sSoldierID ].inv[ PlayersOfferArea[ sCnt ].bSlotIdInOtherLocation ].uiMoneyAmount;
PlayersOfferArea[ sCnt ].uiItemPrice = PlayersOfferArea[ sCnt ].ItemObject.uiMoneyAmount;
PlayersOfferArea[ sCnt ].ItemObject.ItemData.Money.uiMoneyAmount = Menptr[ sSoldierID ].inv[ PlayersOfferArea[ sCnt ].bSlotIdInOtherLocation ].ItemData.Money.uiMoneyAmount;
PlayersOfferArea[ sCnt ].uiItemPrice = PlayersOfferArea[ sCnt ].ItemObject.ItemData.Money.uiMoneyAmount;
}
}
else // not money
@@ -3734,7 +3734,7 @@ UINT32 CalculateTotalPlayersValue()
{
//Calculate a price for the item
if( Item[ PlayersOfferArea[ ubCnt ].sItemIndex ].usItemClass == IC_MONEY )
uiTotal += PlayersOfferArea[ ubCnt ].ItemObject.uiMoneyAmount;
uiTotal += PlayersOfferArea[ ubCnt ].ItemObject.ItemData.Money.uiMoneyAmount;
else
uiTotal += PlayersOfferArea[ ubCnt ].uiItemPrice;
}
@@ -4058,7 +4058,7 @@ void MovePlayerOfferedItemsOfValueToArmsDealersInventory()
if( Item[ PlayersOfferArea[ uiCnt ].sItemIndex ].usItemClass == IC_MONEY )
{
//add the money to the dealers 'cash'
gArmsDealerStatus[ gbSelectedArmsDealerID ].uiArmsDealersCash += PlayersOfferArea[ uiCnt ].ItemObject.uiMoneyAmount;
gArmsDealerStatus[ gbSelectedArmsDealerID ].uiArmsDealersCash += PlayersOfferArea[ uiCnt ].ItemObject.ItemData.Money.uiMoneyAmount;
}
else
{
@@ -4457,7 +4457,7 @@ INT8 AddInventoryToSkiLocation( INVENTORY_IN_SLOT *pInv, UINT8 ubSpotLocation, U
{
//Since money is always evaluated
PlayersOfferArea[ ubSpotLocation ].uiFlags |= ARMS_INV_PLAYERS_ITEM_HAS_VALUE;
PlayersOfferArea[ ubSpotLocation ].uiItemPrice = PlayersOfferArea[ ubSpotLocation ].ItemObject.uiMoneyAmount;
PlayersOfferArea[ ubSpotLocation ].uiItemPrice = PlayersOfferArea[ ubSpotLocation ].ItemObject.ItemData.Money.uiMoneyAmount;
}
SetSkiRegionHelpText( &PlayersOfferArea[ ubSpotLocation ], &gPlayersOfferSlotsMouseRegions[ ubSpotLocation ], PLAYERS_OFFER_AREA );
@@ -5759,7 +5759,7 @@ UINT32 CalculateHowMuchMoneyIsInPlayersOfferArea( )
{
if( Item[ PlayersOfferArea[ ubCnt ].sItemIndex ].usItemClass == IC_MONEY )
{
uiTotalMoneyValue += PlayersOfferArea[ ubCnt ].ItemObject.uiMoneyAmount;
uiTotalMoneyValue += PlayersOfferArea[ ubCnt ].ItemObject.ItemData.Money.uiMoneyAmount;
}
}
}
@@ -5832,7 +5832,7 @@ INT8 GetInvSlotOfUnfullMoneyInMercInventory( SOLDIERTYPE *pSoldier )
for( ubCnt=0; ubCnt < NUM_INV_SLOTS; ubCnt++)
{
// Look for MONEY only, not Gold or Silver!!! And look for a slot not already full
if( ( pSoldier->inv[ ubCnt ].usItem == MONEY ) && ( pSoldier->inv[ ubCnt ].uiMoneyAmount < MoneySlotLimit( ubCnt ) ) )
if( ( pSoldier->inv[ ubCnt ].usItem == MONEY ) && ( pSoldier->inv[ ubCnt ].ItemData.Money.uiMoneyAmount < MoneySlotLimit( ubCnt ) ) )
{
return( ubCnt );
}
@@ -5934,7 +5934,7 @@ void EvaluateItemAddedToPlayersOfferArea( INT8 bSlotID, BOOLEAN fFirstOne )
//if the item is damaged, or is a rocket rifle (which always "need repairing" even at 100%, to reset imprinting)
if( ( PlayersOfferArea[ bSlotID ].ItemObject.bStatus[ 0 ] < 100 ) || fRocketRifleWasEvaluated )
if( ( PlayersOfferArea[ bSlotID ].ItemObject.ItemData.Generic.bStatus[ 0 ] < 100 ) || fRocketRifleWasEvaluated )
{
INT8 bSlotAddedTo;
@@ -5960,7 +5960,7 @@ void EvaluateItemAddedToPlayersOfferArea( INT8 bSlotID, BOOLEAN fFirstOne )
// check if the item is really badly damaged
if( Item[ ArmsDealerOfferArea[ bSlotAddedTo ].sItemIndex ].usItemClass != IC_AMMO )
{
if( ArmsDealerOfferArea[ bSlotAddedTo ].ItemObject.bStatus[ 0 ] < REALLY_BADLY_DAMAGED_THRESHOLD )
if( ArmsDealerOfferArea[ bSlotAddedTo ].ItemObject.ItemData.Generic.bStatus[ 0 ] < REALLY_BADLY_DAMAGED_THRESHOLD )
{
uiEvalResult = EVAL_RESULT_OK_BUT_REALLY_DAMAGED;
}
@@ -6676,8 +6676,8 @@ void SplitComplexObjectIntoSubObjects( OBJECTTYPE *pComplexObject )
// Exception: don't do this with rocket launchers, their "shots left" are fake and this screws 'em up!
if ( !Item[pComplexObject->usItem].singleshotrocketlauncher ) // Madd rpg - still do this
{
pNextObj->ubGunShotsLeft = 0;
pNextObj->usGunAmmoItem = NONE;
pNextObj->ItemData.Gun.ubGunShotsLeft = 0;
pNextObj->ItemData.Gun.usGunAmmoItem = NONE;
}
/* gunAmmoStatus is currently not being used that way, it's strictly used as a jammed/unjammed, and so should never be 0
@@ -6713,18 +6713,18 @@ void SplitComplexObjectIntoSubObjects( OBJECTTYPE *pComplexObject )
if ( Item [ pComplexObject->usItem ].usItemClass == IC_GUN )
{
// and it has ammo/payload
if ( pComplexObject->usGunAmmoItem != NONE )
if ( pComplexObject->ItemData.Gun.usGunAmmoItem != NONE )
{
// if it's bullets
if ( Item[ pComplexObject->usGunAmmoItem ].usItemClass == IC_AMMO )
if ( Item[ pComplexObject->ItemData.Gun.usGunAmmoItem ].usItemClass == IC_AMMO )
{
// and there are some left
if ( pComplexObject->ubGunShotsLeft > 0 )
if ( pComplexObject->ItemData.Gun.ubGunShotsLeft > 0 )
{
// make the bullets into another subobject
CreateItem( pComplexObject->usGunAmmoItem, 100, pNextObj );
CreateItem( pComplexObject->ItemData.Gun.usGunAmmoItem, 100, pNextObj );
// set how many are left
pNextObj->bStatus[ 0 ] = pComplexObject->ubGunShotsLeft;
pNextObj->ItemData.Generic.bStatus[ 0 ] = pComplexObject->ItemData.Gun.ubGunShotsLeft;
pNextObj = &gSubObject[ ++ubNextFreeSlot ];
}
@@ -6733,12 +6733,12 @@ void SplitComplexObjectIntoSubObjects( OBJECTTYPE *pComplexObject )
else // non-ammo payload
{
// make the payload into another subobject
CreateItem( pComplexObject->usGunAmmoItem, pComplexObject->bGunAmmoStatus, pNextObj );
CreateItem( pComplexObject->ItemData.Gun.usGunAmmoItem, pComplexObject->ItemData.Gun.bGunAmmoStatus, pNextObj );
// if the gun was jammed, fix up the payload's status
if ( pNextObj->bStatus[ 0 ] < 0 )
if ( pNextObj->ItemData.Generic.bStatus[ 0 ] < 0 )
{
pNextObj->bStatus[ 0 ] *= -1;
pNextObj->ItemData.Generic.bStatus[ 0 ] *= -1;
}
pNextObj = &gSubObject[ ++ubNextFreeSlot ];
@@ -6777,7 +6777,7 @@ void SplitComplexObjectIntoSubObjects( OBJECTTYPE *pComplexObject )
// make each item in the stack into a separate subobject
for( ubCnt = 0; ubCnt < pComplexObject->ubNumberOfObjects; ubCnt++ )
{
CreateItem( pComplexObject->usItem, pComplexObject->bStatus[ ubCnt ], pNextObj );
CreateItem( pComplexObject->usItem, pComplexObject->ItemData.Generic.bStatus[ ubCnt ], pNextObj );
// advance to next available subobject
pNextObj = &gSubObject[ ++ubNextFreeSlot ];
@@ -6807,7 +6807,7 @@ void CountSubObjectsInObject( OBJECTTYPE *pComplexObject, UINT8 *pubTotalSubObje
// is it in need of fixing, and also repairable by this dealer?
// A jammed gun with a 100% status is NOT repairable - shouldn't ever happen
if ( ( gSubObject[ ubSubObject ].bStatus[ 0 ] != 100 ) &&
if ( ( gSubObject[ ubSubObject ].ItemData.Generic.bStatus[ 0 ] != 100 ) &&
CanDealerRepairItem( gbSelectedArmsDealerID, gSubObject[ ubSubObject ].usItem ) )
{
@@ -7040,7 +7040,7 @@ BOOLEAN SKITryToAddInvToMercsInventory( INVENTORY_IN_SLOT *pInv, SOLDIERTYPE *pS
PlaceObject( pSoldier, bMoneyInvPos, &( pInv->ItemObject ) );
// if the money is all gone
if ( pInv->ItemObject.uiMoneyAmount == 0 )
if ( pInv->ItemObject.ItemData.Money.uiMoneyAmount == 0 )
{
// we've been succesful!
return(TRUE);
@@ -7635,7 +7635,7 @@ UINT32 EvaluateInvSlot( INVENTORY_IN_SLOT *pInvSlot )
// check if the item is really badly damaged
if( Item[ pInvSlot->sItemIndex ].usItemClass != IC_AMMO )
{
if( pInvSlot->ItemObject.bStatus[ 0 ] < REALLY_BADLY_DAMAGED_THRESHOLD )
if( pInvSlot->ItemObject.ItemData.Generic.bStatus[ 0 ] < REALLY_BADLY_DAMAGED_THRESHOLD )
{
uiEvalResult = EVAL_RESULT_OK_BUT_REALLY_DAMAGED;
}
+1 -1
View File
@@ -258,7 +258,7 @@ INT32 SkillCheck( SOLDIERTYPE * pSoldier, INT8 bReason, INT8 bChanceMod )
// this should never happen, but might as well check...
iSkill = 0;
}
iSkill = iSkill * pSoldier->inv[bSlot].bStatus[0] / 100;
iSkill = iSkill * pSoldier->inv[bSlot].ItemData.Generic.bStatus[0] / 100;
break;
case ATTACHING_DETONATOR_CHECK:
case ATTACHING_REMOTE_DETONATOR_CHECK:
+2 -2
View File
@@ -1156,8 +1156,8 @@ BOOLEAN InternalAddSoldierToSector( UINT8 ubID, BOOLEAN fCalculateDirection, BOO
{
if( pSoldier->sInsertionGridNo == NOWHERE )
{ //Add the soldier to the respective entrypoint. This is an error condition.
// So treat it like an error already then!
Assert(0);
}
if( pSoldier->uiStatusFlags & SOLDIER_VEHICLE )
{
+1 -1
View File
@@ -3749,7 +3749,7 @@ BOOLEAN CheckForImproperFireGunEnd( SOLDIERTYPE *pSoldier )
}
// Check single hand for jammed status, ( or ammo is out.. )
if ( pSoldier->inv[ HANDPOS ].bGunAmmoStatus < 0 || pSoldier->inv[ HANDPOS ].ubGunShotsLeft == 0 )
if ( pSoldier->inv[ HANDPOS ].ItemData.Gun.bGunAmmoStatus < 0 || pSoldier->inv[ HANDPOS ].ItemData.Gun.ubGunShotsLeft == 0 )
{
// If we have 2 pistols, donot go back!
if ( Item[ pSoldier->inv[ SECONDHANDPOS ].usItem ].usItemClass != IC_GUN )
+6 -6
View File
@@ -3283,7 +3283,7 @@ void SetSoldierGridNo( SOLDIERTYPE *pSoldier, INT16 sNewGridNo, BOOLEAN fForceRe
BOOLEAN fSetGassed = TRUE;
// If we have a functioning gas mask...
if ( FindGasMask ( pSoldier ) != NO_SLOT && pSoldier->inv[ HEAD1POS ].bStatus[ 0 ] >= GASMASK_MIN_STATUS )
if ( FindGasMask ( pSoldier ) != NO_SLOT && pSoldier->inv[ HEAD1POS ].ItemData.Generic.bStatus[ 0 ] >= GASMASK_MIN_STATUS )
{
fSetGassed = FALSE;
}
@@ -4092,7 +4092,7 @@ void EVENT_SoldierGotHit( SOLDIERTYPE *pSoldier, UINT16 usWeaponIndex, INT16 sDa
}
// callahan update end
else if ( Item[ usWeaponIndex ].usItemClass & ( IC_GUN | IC_THROWING_KNIFE ) && AmmoTypes[MercPtrs[ubAttackerID]->inv[MercPtrs[ubAttackerID]->ubAttackingHand ].ubGunAmmoType].explosionSize <= 1)
else if ( Item[ usWeaponIndex ].usItemClass & ( IC_GUN | IC_THROWING_KNIFE ) && AmmoTypes[MercPtrs[ubAttackerID]->inv[MercPtrs[ubAttackerID]->ubAttackingHand ].ItemData.Gun.ubGunAmmoType].explosionSize <= 1)
{
if ( ubSpecial == FIRE_WEAPON_SLEEP_DART_SPECIAL )
{
@@ -4151,7 +4151,7 @@ void EVENT_SoldierGotHit( SOLDIERTYPE *pSoldier, UINT16 usWeaponIndex, INT16 sDa
}
// marke added one 'or' for explosive ammo. variation of: AmmoTypes[pSoldier->inv[pSoldier->ubAttackingHand ].ubGunAmmoType].explosionSize > 1
// extracting attacker´s ammo type
else if ( Item[ usWeaponIndex ].usItemClass & IC_EXPLOSV || AmmoTypes[MercPtrs[ubAttackerID]->inv[MercPtrs[ubAttackerID]->ubAttackingHand ].ubGunAmmoType].explosionSize > 1)
else if ( Item[ usWeaponIndex ].usItemClass & IC_EXPLOSV || AmmoTypes[MercPtrs[ubAttackerID]->inv[MercPtrs[ubAttackerID]->ubAttackingHand ].ItemData.Gun.ubGunAmmoType].explosionSize > 1)
{
INT8 bDeafValue;
@@ -11736,8 +11736,8 @@ BOOLEAN IsValidSecondHandShot( SOLDIERTYPE *pSoldier )
!pSoldier->bDoBurst &&
!Item[pSoldier->inv[ HANDPOS ].usItem].grenadelauncher &&
Item[ pSoldier->inv[HANDPOS].usItem ].usItemClass == IC_GUN &&
pSoldier->inv[SECONDHANDPOS].bGunStatus >= USABLE &&
pSoldier->inv[SECONDHANDPOS].ubGunShotsLeft > 0 )
pSoldier->inv[SECONDHANDPOS].ItemData.Gun.bGunStatus >= USABLE &&
pSoldier->inv[SECONDHANDPOS].ItemData.Gun.ubGunShotsLeft > 0 )
{
return( TRUE );
}
@@ -11753,7 +11753,7 @@ BOOLEAN IsValidSecondHandShotForReloadingPurposes( SOLDIERTYPE *pSoldier )
!pSoldier->bDoBurst &&
!Item[pSoldier->inv[ HANDPOS ].usItem].grenadelauncher &&
Item[ pSoldier->inv[HANDPOS].usItem ].usItemClass == IC_GUN &&
pSoldier->inv[SECONDHANDPOS].bGunStatus >= USABLE //&&
pSoldier->inv[SECONDHANDPOS].ItemData.Gun.bGunStatus >= USABLE //&&
// pSoldier->inv[SECONDHANDPOS].ubGunShotsLeft > 0 &&
// gAnimControl[ pSoldier->usAnimState ].ubEndHeight != ANIM_PRONE )
)
+3 -3
View File
@@ -354,7 +354,7 @@ SOLDIERTYPE* TacticalCreateSoldier( SOLDIERCREATE_STRUCT *pCreateStruct, UINT8 *
}
}
// Copy the items over for thew soldier, only if we have a valid profile id!
// Copy the items over for the soldier, only if we have a valid profile id!
if ( pCreateStruct->ubProfile != NO_PROFILE )
CopyProfileItems( &Soldier, pCreateStruct );
@@ -2712,12 +2712,12 @@ void CopyProfileItems( SOLDIERTYPE *pSoldier, SOLDIERCREATE_STRUCT *pCreateStruc
if ( uiMoneyLeft > uiMoneyLimitInSlot )
{
// fill pocket with money
pSoldier->inv[ bSlot ].uiMoneyAmount = uiMoneyLimitInSlot;
pSoldier->inv[ bSlot ].ItemData.Money.uiMoneyAmount = uiMoneyLimitInSlot;
uiMoneyLeft -= uiMoneyLimitInSlot;
}
else
{
pSoldier->inv[ bSlot ].uiMoneyAmount = uiMoneyLeft;
pSoldier->inv[ bSlot ].ItemData.Money.uiMoneyAmount = uiMoneyLeft;
// done!
break;
}
+9 -7
View File
@@ -541,19 +541,21 @@ BOOLEAN AddPlacementToWorld( SOLDIERINITNODE *curr, GROUP *pGroup = NULL )
if (curr->pBasicPlacement->bBodyType == TANK_NW ||
curr->pBasicPlacement->bBodyType == TANK_NE)
{
while (1)
ROTTING_CORPSE *pCorpse;
//while (1)
do
{
ROTTING_CORPSE *pCorpse = GetCorpseAtGridNo( curr->pBasicPlacement->usStartingGridNo, 0); // I assume we don't find tanks on the roof
pCorpse = GetCorpseAtGridNo( curr->pBasicPlacement->usStartingGridNo, 0); // I assume we don't find tanks on the roof
if (pCorpse)
{
// Assume this is a dead tank and have the replacement tank haul it away
RemoveCorpse( pCorpse->iID);
}
else
{
break;
}
}
//else
//{
//break;
//}
} while (pCorpse);
}
DebugMsg(TOPIC_JA2,DBG_LEVEL_3,String("AddPlacementToWorld: decide on placement"));
+2 -2
View File
@@ -611,7 +611,7 @@ void MakeRemainingTerroristsTougher( void )
DeleteObj( &Object );
Object.usItem = usNewItem;
Object.bStatus[ 0 ] = 100;
Object.ItemData.Generic.bStatus[ 0 ] = 100;
for ( ubLoop = 0; ubLoop < NUM_TERRORISTS; ubLoop++ )
{
@@ -745,7 +745,7 @@ void MakeRemainingAssassinsTougher( void )
DeleteObj( &Object );
Object.usItem = usNewItem;
Object.bStatus[ 0 ] = 100;
Object.ItemData.Generic.bStatus[ 0 ] = 100;
for ( ubLoop = 0; ubLoop < NUM_ASSASSINS; ubLoop++ )
{
+1 -1
View File
@@ -144,7 +144,7 @@ void PickBurstLocations( SOLDIERTYPE *pSoldier )
pSoldier->bDoAutofire++;
sAPCosts = CalcTotalAPsToAttack( pSoldier, gsBurstLocations[0].sGridNo, TRUE, 0);
}
while(EnoughPoints( pSoldier, sAPCosts, 0, FALSE ) && pSoldier->inv[ pSoldier->ubAttackingHand ].ubGunShotsLeft >= pSoldier->bDoAutofire && gbNumBurstLocations >= pSoldier->bDoAutofire);
while(EnoughPoints( pSoldier, sAPCosts, 0, FALSE ) && pSoldier->inv[ pSoldier->ubAttackingHand ].ItemData.Gun.ubGunShotsLeft >= pSoldier->bDoAutofire && gbNumBurstLocations >= pSoldier->bDoAutofire);
pSoldier->bDoAutofire--;
ubShotsPerBurst = __min(pSoldier->bDoAutofire,MAX_BURST_SPREAD_TARGETS);
+3 -3
View File
@@ -2742,10 +2742,10 @@ BOOLEAN AddDeadSoldierToUnLoadedSector( INT16 sMapX, INT16 sMapY, UINT8 bMapZ, S
if ( Item[pSoldier->inv[i].usItem].damageable ) // Madd: drop crappier items on higher difficulty levels
{
pSoldier->inv[i].bStatus[0] -= (gGameOptions.ubDifficultyLevel - 1) * Random(20);
pSoldier->inv[i].bStatus[0] = max(pSoldier->inv[i].bStatus[0],1); // never below 1%
pSoldier->inv[i].ItemData.Generic.bStatus[0] -= (gGameOptions.ubDifficultyLevel - 1) * Random(20);
pSoldier->inv[i].ItemData.Generic.bStatus[0] = max(pSoldier->inv[i].ItemData.Generic.bStatus[0],1); // never below 1%
}
memcpy( &(pWorldItems[ bCount ].o), &pSoldier->inv[i], sizeof( OBJECTTYPE ) );
pWorldItems[ bCount ].o = pSoldier->inv[i];
bCount++;
}
}
+18 -18
View File
@@ -2587,13 +2587,13 @@ void GetKeyboardInput( UINT32 *puiNewEvent )
if (( Item[ gWorldItems[ uiLoop ].o.usItem ].usItemClass == IC_GUN ) && (gGameExternalOptions.gfShiftFUnloadWeapons == TRUE) )//item is a gun and unloading is allowed
{
//Remove magazine
if ( (gWorldItems[ uiLoop ].o.usGunAmmoItem != NONE) && (gWorldItems[ uiLoop ].o.ubGunShotsLeft > 0) )
if ( (gWorldItems[ uiLoop ].o.ItemData.Gun.usGunAmmoItem != NONE) && (gWorldItems[ uiLoop ].o.ItemData.Gun.ubGunShotsLeft > 0) )
{
OBJECTTYPE newObj; //Create object
CreateItem(gWorldItems[ uiLoop ].o.usGunAmmoItem, 100, &newObj);
newObj.ubShotsLeft[0] = gWorldItems[ uiLoop ].o.ubGunShotsLeft;
gWorldItems[ uiLoop ].o.ubGunShotsLeft = 0;
gWorldItems[ uiLoop ].o.usGunAmmoItem = NONE;
CreateItem(gWorldItems[ uiLoop ].o.ItemData.Gun.usGunAmmoItem, 100, &newObj);
newObj.ItemData.Ammo.ubShotsLeft[0] = gWorldItems[ uiLoop ].o.ItemData.Gun.ubGunShotsLeft;
gWorldItems[ uiLoop ].o.ItemData.Gun.ubGunShotsLeft = 0;
gWorldItems[ uiLoop ].o.ItemData.Gun.usGunAmmoItem = NONE;
// put it on the ground
AddItemToPool( gWorldItems[ uiLoop ].sGridNo, &newObj, 1, gWorldItems[ uiLoop ].ubLevel, 0 , -1 );
@@ -3103,10 +3103,10 @@ void GetKeyboardInput( UINT32 *puiNewEvent )
tempStatus = pObj->bAttachStatus[bSlot3];
// Replace helmet attachment with face slot
pObj->usAttachItem[bSlot3] = pTeamSoldier->inv[bSlot1].usItem;
pObj->bAttachStatus[bSlot3] = pTeamSoldier->inv[bSlot1].bStatus[0];
pObj->bAttachStatus[bSlot3] = pTeamSoldier->inv[bSlot1].ItemData.Generic.bStatus[0];
// Replace face slot with helmet attachment from temp
pTeamSoldier->inv[bSlot1].usItem = tempItem;
pTeamSoldier->inv[bSlot1].bStatus[0] = tempStatus;
pTeamSoldier->inv[bSlot1].ItemData.Generic.bStatus[0] = tempStatus;
}
else if ( bSlot2 != ITEM_NOT_FOUND )
{
@@ -3146,10 +3146,10 @@ void GetKeyboardInput( UINT32 *puiNewEvent )
tempStatus = pObj->bAttachStatus[bSlot3];
// Replace helmet attachment with face slot
pObj->usAttachItem[bSlot3] = pTeamSoldier->inv[bSlot1].usItem;
pObj->bAttachStatus[bSlot3] = pTeamSoldier->inv[bSlot1].bStatus[0];
pObj->bAttachStatus[bSlot3] = pTeamSoldier->inv[bSlot1].ItemData.Generic.bStatus[0];
// Replace face slot with helmet attachment from temp
pTeamSoldier->inv[bSlot1].usItem = tempItem;
pTeamSoldier->inv[bSlot1].bStatus[0] = tempStatus;
pTeamSoldier->inv[bSlot1].ItemData.Generic.bStatus[0] = tempStatus;
}
else if ( bSlot2 != ITEM_NOT_FOUND )
{
@@ -3302,7 +3302,7 @@ void GetKeyboardInput( UINT32 *puiNewEvent )
{
pGun = &(pTeamSoldier->inv[bLoop2]);
//if magazine is not full
if ( pGun->ubGunShotsLeft < GetMagSize( pGun ) )
if ( pGun->ItemData.Gun.ubGunShotsLeft < GetMagSize( pGun ) )
{
// Search for ammo in sector
@@ -3317,12 +3317,12 @@ void GetKeyboardInput( UINT32 *puiNewEvent )
if ( CompatibleAmmoForGun( pAmmo, pGun ) ) // can use the ammo with this gun
{
// same ammo type in gun and magazine
if ( Magazine[Item[pGun->usGunAmmoItem].ubClassIndex].ubAmmoType == Magazine[Item[pAmmo->usItem].ubClassIndex].ubAmmoType )
if ( Magazine[Item[pGun->ItemData.Gun.usGunAmmoItem].ubClassIndex].ubAmmoType == Magazine[Item[pAmmo->usItem].ubClassIndex].ubAmmoType )
{
ReloadGun( pTeamSoldier, pGun, pAmmo );
}
if (pAmmo->ubShotsLeft[0] == 0)
if (pAmmo->ItemData.Ammo.ubShotsLeft[0] == 0)
{
RemoveItemFromPool( gWorldItems[ uiLoop ].sGridNo, uiLoop, gWorldItems[ uiLoop ].ubLevel );
}
@@ -3353,7 +3353,7 @@ void GetKeyboardInput( UINT32 *puiNewEvent )
pGun = &(pTeamSoldier->inv[HANDPOS]);
//magazine is not full
if ( pGun->ubGunShotsLeft < GetMagSize( pGun ) )
if ( pGun->ItemData.Gun.ubGunShotsLeft < GetMagSize( pGun ) )
{
AutoReload( pTeamSoldier );
}
@@ -3367,7 +3367,7 @@ void GetKeyboardInput( UINT32 *puiNewEvent )
{
pGun = &(pTeamSoldier->inv[bLoop2]);
//if magazine is not full
if ( pGun->ubGunShotsLeft < GetMagSize( pGun ) )
if ( pGun->ItemData.Gun.ubGunShotsLeft < GetMagSize( pGun ) )
{
// Search for ammo in soldier inventory
@@ -3380,7 +3380,7 @@ void GetKeyboardInput( UINT32 *puiNewEvent )
if ( CompatibleAmmoForGun( pAmmo, pGun ) ) // can use the ammo with this gun
{
// same ammo type in gun and magazine
if ( Magazine[Item[pGun->usGunAmmoItem].ubClassIndex].ubAmmoType == Magazine[Item[pAmmo->usItem].ubClassIndex].ubAmmoType )
if ( Magazine[Item[pGun->ItemData.Gun.usGunAmmoItem].ubClassIndex].ubAmmoType == Magazine[Item[pAmmo->usItem].ubClassIndex].ubAmmoType )
{
ReloadGun( pTeamSoldier, pGun, pAmmo );
@@ -4689,7 +4689,7 @@ void GrenadeTest1()
{
OBJECTTYPE Object;
Object.usItem = MUSTARD_GRENADE;
Object.bStatus[ 0 ] = 100;
Object.ItemData.Generic.bStatus[ 0 ] = 100;
Object.ubNumberOfObjects = 1;
CreatePhysicalObject( &Object, 60, (FLOAT)(sX * CELL_X_SIZE), (FLOAT)(sY * CELL_Y_SIZE ), 256, -20, 20, 158, NOBODY, THROW_ARM_ITEM, 0, FALSE );
}
@@ -4703,7 +4703,7 @@ void GrenadeTest2()
{
OBJECTTYPE Object;
Object.usItem = HAND_GRENADE;
Object.bStatus[ 0 ] = 100;
Object.ItemData.Generic.bStatus[ 0 ] = 100;
Object.ubNumberOfObjects = 1;
CreatePhysicalObject( &Object, 60, (FLOAT)(sX * CELL_X_SIZE), (FLOAT)(sY * CELL_Y_SIZE ), 256, 0, -30, 158, NOBODY, THROW_ARM_ITEM, 0, FALSE );
}
@@ -4717,7 +4717,7 @@ void GrenadeTest3()
{
OBJECTTYPE Object;
Object.usItem = HAND_GRENADE;
Object.bStatus[ 0 ] = 100;
Object.ItemData.Generic.bStatus[ 0 ] = 100;
Object.ubNumberOfObjects = 1;
CreatePhysicalObject( &Object, 60, (FLOAT)(sX * CELL_X_SIZE), (FLOAT)(sY * CELL_Y_SIZE ), 256, -10, 10, 158, NOBODY, THROW_ARM_ITEM, 0, FALSE );
}
+6 -6
View File
@@ -381,13 +381,13 @@ UINT8 HandleActivatedTargetCursor( SOLDIERTYPE *pSoldier, UINT16 usMapPos, BOOLE
pSoldier->bDoAutofire++;
sAPCosts = CalcTotalAPsToAttack( pSoldier, usMapPos, TRUE, 0);
}
while(EnoughPoints( pSoldier, sAPCosts, 0, FALSE ) && sAPCosts == sCurAPCosts && pSoldier->inv[ pSoldier->ubAttackingHand ].ubGunShotsLeft >= pSoldier->bDoAutofire);
while(EnoughPoints( pSoldier, sAPCosts, 0, FALSE ) && sAPCosts == sCurAPCosts && pSoldier->inv[ pSoldier->ubAttackingHand ].ItemData.Gun.ubGunShotsLeft >= pSoldier->bDoAutofire);
pSoldier->bDoAutofire--;
}
gfUIAutofireBulletCount = TRUE;
gsBulletCount = pSoldier->bDoAutofire;
gsTotalBulletCount = pSoldier->inv[ pSoldier->ubAttackingHand ].ubGunShotsLeft;
gsTotalBulletCount = pSoldier->inv[ pSoldier->ubAttackingHand ].ItemData.Gun.ubGunShotsLeft;
if(pSoldier->autofireLastStep) //set the orange tint on the numbers if we at the last step
gTintBulletCounts = TRUE;
@@ -536,7 +536,7 @@ UINT8 HandleActivatedTargetCursor( SOLDIERTYPE *pSoldier, UINT16 usMapPos, BOOLE
pSoldier->bDoAutofire++;
sAPCosts = CalcTotalAPsToAttack( pSoldier, gsBurstLocations[0].sGridNo, TRUE, 0);
}
while(EnoughPoints( pSoldier, sAPCosts, 0, FALSE ) && pSoldier->inv[ pSoldier->ubAttackingHand ].ubGunShotsLeft >= pSoldier->bDoAutofire && gbNumBurstLocations >= pSoldier->bDoAutofire);
while(EnoughPoints( pSoldier, sAPCosts, 0, FALSE ) && pSoldier->inv[ pSoldier->ubAttackingHand ].ItemData.Gun.ubGunShotsLeft >= pSoldier->bDoAutofire && gbNumBurstLocations >= pSoldier->bDoAutofire);
pSoldier->bDoAutofire--;
gsCurrentActionPoints = CalcTotalAPsToAttack( pSoldier, gsBurstLocations[0].sGridNo, TRUE, 0 );
@@ -2065,11 +2065,11 @@ void HandleRightClickAdjustCursor( SOLDIERTYPE *pSoldier, INT16 usMapPos )
}
if(pSoldier->inv[ pSoldier->ubAttackingHand ].ubGunShotsLeft > pSoldier->bDoAutofire )
if(pSoldier->inv[ pSoldier->ubAttackingHand ].ItemData.Gun.ubGunShotsLeft > pSoldier->bDoAutofire )
{
//Calculate how many bullets we need to fire to add at least one more AP
sAPCosts = sCurAPCosts = CalcTotalAPsToAttack( pSoldier, usMapPos, TRUE, 0);
while(EnoughPoints( pSoldier, sAPCosts, 0, FALSE ) && sAPCosts <= sCurAPCosts && pSoldier->inv[ pSoldier->ubAttackingHand ].ubGunShotsLeft > pSoldier->bDoAutofire) //Increment the bullet count until we run out of APs or we spend the whole AP
while(EnoughPoints( pSoldier, sAPCosts, 0, FALSE ) && sAPCosts <= sCurAPCosts && pSoldier->inv[ pSoldier->ubAttackingHand ].ItemData.Gun.ubGunShotsLeft > pSoldier->bDoAutofire) //Increment the bullet count until we run out of APs or we spend the whole AP
{
pSoldier->bDoAutofire++;
sAPCosts = CalcTotalAPsToAttack( pSoldier, usMapPos, TRUE, 0);
@@ -2084,7 +2084,7 @@ void HandleRightClickAdjustCursor( SOLDIERTYPE *pSoldier, INT16 usMapPos )
pSoldier->bDoAutofire++;
sAPCosts = CalcTotalAPsToAttack( pSoldier, usMapPos, TRUE, 0);
}
while(EnoughPoints( pSoldier, sAPCosts, 0, FALSE ) && sAPCosts == sCurAPCosts && pSoldier->inv[ pSoldier->ubAttackingHand ].ubGunShotsLeft >= pSoldier->bDoAutofire);
while(EnoughPoints( pSoldier, sAPCosts, 0, FALSE ) && sAPCosts == sCurAPCosts && pSoldier->inv[ pSoldier->ubAttackingHand ].ItemData.Gun.ubGunShotsLeft >= pSoldier->bDoAutofire);
pSoldier->bDoAutofire--;
sAPCosts = CalcTotalAPsToAttack( pSoldier, usMapPos, TRUE, 0);
+43 -43
View File
@@ -961,7 +961,7 @@ INT32 EffectiveArmour( OBJECTTYPE * pObj )
return( 0 );
}
iValue = Armour[ Item[pObj->usItem].ubClassIndex ].ubProtection;
iValue = iValue * pObj->bStatus[0] * Armour[ Item[pObj->usItem].ubClassIndex ].ubCoverage / 10000;
iValue = iValue * pObj->ItemData.Generic.bStatus[0] * Armour[ Item[pObj->usItem].ubClassIndex ].ubCoverage / 10000;
// bPlate = FindAttachment( pObj, CERAMIC_PLATES );
bPlate = FindFirstArmourAttachment( pObj );
@@ -1057,7 +1057,7 @@ INT32 ExplosiveEffectiveArmour( OBJECTTYPE * pObj )
return( 0 );
}
iValue = Armour[ Item[pObj->usItem].ubClassIndex ].ubProtection;
iValue = iValue * pObj->bStatus[0] * Armour[ Item[pObj->usItem].ubClassIndex ].ubCoverage / 10000;
iValue = iValue * pObj->ItemData.Generic.bStatus[0] * Armour[ Item[pObj->usItem].ubClassIndex ].ubCoverage / 10000;
if ( Item[pObj->usItem].flakjacket )
{
// increase value for flak jackets!
@@ -1156,13 +1156,13 @@ BOOLEAN CheckForGunJam( SOLDIERTYPE * pSoldier )
if ( Item[pSoldier->usAttackingWeapon].usItemClass == IC_GUN && !EXPLOSIVE_GUN( pSoldier->usAttackingWeapon ) )
{
pObj = &(pSoldier->inv[pSoldier->ubAttackingHand]);
if (pObj->bGunAmmoStatus > 0)
if (pObj->ItemData.Gun.bGunAmmoStatus > 0)
{
// gun might jam, figure out the chance
//iChance = (80 - pObj->bGunStatus);
//rain
iChance = (80 - pObj->bGunStatus) + gGameExternalOptions.ubWeaponReliabilityReductionPerRainIntensity * gbCurrentRainIntensity;
iChance = (80 - pObj->ItemData.Gun.bGunStatus) + gGameExternalOptions.ubWeaponReliabilityReductionPerRainIntensity * gbCurrentRainIntensity;
//end rain
@@ -1198,7 +1198,7 @@ BOOLEAN CheckForGunJam( SOLDIERTYPE * pSoldier )
gfNextFireJam = FALSE;
// jam! negate the gun ammo status.
pObj->bGunAmmoStatus *= -1;
pObj->ItemData.Gun.bGunAmmoStatus *= -1;
// Deduct AMMO!
DeductAmmo( pSoldier, pSoldier->ubAttackingHand );
@@ -1207,14 +1207,14 @@ BOOLEAN CheckForGunJam( SOLDIERTYPE * pSoldier )
return( TRUE );
}
}
else if (pObj->bGunAmmoStatus < 0)
else if (pObj->ItemData.Gun.bGunAmmoStatus < 0)
{
// try to unjam gun
iResult = SkillCheck( pSoldier, UNJAM_GUN_CHECK, (INT8) ((Item[pObj->usItem].bReliability + Item[pObj->usGunAmmoItem].bReliability)* 4) );
iResult = SkillCheck( pSoldier, UNJAM_GUN_CHECK, (INT8) ((Item[pObj->usItem].bReliability + Item[pObj->ItemData.Gun.usGunAmmoItem].bReliability)* 4) );
if (iResult > 0)
{
// yay! unjammed the gun
pObj->bGunAmmoStatus *= -1;
pObj->ItemData.Gun.bGunAmmoStatus *= -1;
// MECHANICAL/DEXTERITY GAIN: Unjammed a gun
StatChange( pSoldier, MECHANAMT, 5, FALSE );
@@ -1581,7 +1581,7 @@ BOOLEAN UseGun( SOLDIERTYPE *pSoldier , INT16 sTargetGridNo )
else
{
// ONLY DEDUCT FOR THE FIRST HAND when doing two-pistol attacks
if ( IsValidSecondHandShot( pSoldier ) && pSoldier->inv[ HANDPOS ].bGunStatus >= USABLE && pSoldier->inv[HANDPOS].bGunAmmoStatus > 0 )
if ( IsValidSecondHandShot( pSoldier ) && pSoldier->inv[ HANDPOS ].ItemData.Gun.bGunStatus >= USABLE && pSoldier->inv[HANDPOS].ItemData.Gun.bGunAmmoStatus > 0 )
{
// only deduct APs when the main gun fires
if ( pSoldier->ubAttackingHand == HANDPOS )
@@ -1746,7 +1746,7 @@ BOOLEAN UseGun( SOLDIERTYPE *pSoldier , INT16 sTargetGridNo )
DeductAmmo( pSoldier, pSoldier->ubAttackingHand );
// ATE: Check if we should say quote...
if ( pSoldier->inv[ pSoldier->ubAttackingHand ].ubGunShotsLeft == 0 && !Item[pSoldier->usAttackingWeapon].rocketlauncher )
if ( pSoldier->inv[ pSoldier->ubAttackingHand ].ItemData.Gun.ubGunShotsLeft == 0 && !Item[pSoldier->usAttackingWeapon].rocketlauncher )
{
if ( pSoldier->bTeam == gbPlayerNum )
{
@@ -1777,7 +1777,7 @@ BOOLEAN UseGun( SOLDIERTYPE *pSoldier , INT16 sTargetGridNo )
// add base pts for taking a shot, whether it hits or misses
usExpGain += 3;
if ( IsValidSecondHandShot( pSoldier ) && pSoldier->inv[ HANDPOS ].bGunStatus >= USABLE && pSoldier->inv[HANDPOS].bGunAmmoStatus > 0 )
if ( IsValidSecondHandShot( pSoldier ) && pSoldier->inv[ HANDPOS ].ItemData.Gun.bGunStatus >= USABLE && pSoldier->inv[HANDPOS].ItemData.Gun.bGunAmmoStatus > 0 )
{
// reduce exp gain for two pistol shooting since both shots give xp
usExpGain = (usExpGain * 2) / 3;
@@ -1808,7 +1808,7 @@ BOOLEAN UseGun( SOLDIERTYPE *pSoldier , INT16 sTargetGridNo )
DebugMsg(TOPIC_JA2,DBG_LEVEL_3,String("UseGun: Muzzle flash = %d",pSoldier->fMuzzleFlash));
if ( AmmoTypes[pSoldier->inv[ pSoldier->ubAttackingHand ].ubGunAmmoType].numberOfBullets > 1 )
if ( AmmoTypes[pSoldier->inv[ pSoldier->ubAttackingHand ].ItemData.Gun.ubGunAmmoType].numberOfBullets > 1 )
fBuckshot = TRUE;
//switch ( pSoldier->inv[ pSoldier->ubAttackingHand ].ubGunAmmoType )
@@ -1875,7 +1875,7 @@ BOOLEAN UseGun( SOLDIERTYPE *pSoldier , INT16 sTargetGridNo )
{
if ( Item[usItemNum].singleshotrocketlauncher )
{
CreateItem( Item[usItemNum].discardedlauncheritem , pSoldier->inv[ HANDPOS ].bStatus[ 0 ],&(pSoldier->inv[ HANDPOS ] ) );
CreateItem( Item[usItemNum].discardedlauncheritem , pSoldier->inv[ HANDPOS ].ItemData.Generic.bStatus[ 0 ],&(pSoldier->inv[ HANDPOS ] ) );
DirtyMercPanelInterface( pSoldier, DIRTYLEVEL2 );
IgniteExplosion( pSoldier->ubID, (INT16)CenterX( pSoldier->sGridNo ), (INT16)CenterY( pSoldier->sGridNo ), 0, pSoldier->sGridNo, C1, pSoldier->bLevel );
}
@@ -1883,8 +1883,8 @@ BOOLEAN UseGun( SOLDIERTYPE *pSoldier , INT16 sTargetGridNo )
{
DebugMsg( TOPIC_JA2, DBG_LEVEL_3, String("StructureHit: RPG7 item: %d, Ammo: %d",pSoldier->inv[HANDPOS].usItem , pSoldier->inv[HANDPOS].usGunAmmoItem ) );
IgniteExplosion( pSoldier->ubID, (INT16)CenterX( pSoldier->sGridNo ), (INT16)CenterY( pSoldier->sGridNo ), 0, pSoldier->sGridNo, pSoldier->inv[pSoldier->ubAttackingHand ].usGunAmmoItem, pSoldier->bLevel );
pSoldier->inv[pSoldier->ubAttackingHand ].usGunAmmoItem = NONE;
IgniteExplosion( pSoldier->ubID, (INT16)CenterX( pSoldier->sGridNo ), (INT16)CenterY( pSoldier->sGridNo ), 0, pSoldier->sGridNo, pSoldier->inv[pSoldier->ubAttackingHand ].ItemData.Gun.usGunAmmoItem, pSoldier->bLevel );
pSoldier->inv[pSoldier->ubAttackingHand ].ItemData.Gun.usGunAmmoItem = NONE;
}
// Reduce again for attack end 'cause it has been incremented for a normal attack
//
@@ -1912,7 +1912,7 @@ BOOLEAN UseGun( SOLDIERTYPE *pSoldier , INT16 sTargetGridNo )
{
if ( Item[usItemNum].singleshotrocketlauncher )
{
CreateItem( Item[usItemNum].discardedlauncheritem, pSoldier->inv[ HANDPOS ].bStatus[ 0 ], &(pSoldier->inv[ HANDPOS ] ) );
CreateItem( Item[usItemNum].discardedlauncheritem, pSoldier->inv[ HANDPOS ].ItemData.Generic.bStatus[ 0 ], &(pSoldier->inv[ HANDPOS ] ) );
DirtyMercPanelInterface( pSoldier, DIRTYLEVEL2 );
}
@@ -1964,14 +1964,14 @@ BOOLEAN UseGun( SOLDIERTYPE *pSoldier , INT16 sTargetGridNo )
if ( Item[usItemNum].usItemClass == IC_GUN )
{
OBJECTTYPE *pGun = &(pSoldier->inv[pSoldier->ubAttackingHand]);
ammoReliability = Item[pGun->usGunAmmoItem].bReliability;
ammoReliability = Item[pGun->ItemData.Gun.usGunAmmoItem].bReliability;
}
uiDepreciateTest = BASIC_DEPRECIATE_CHANCE + 3 * (Item[ usItemNum ].bReliability + ammoReliability);
if ( !PreRandom( uiDepreciateTest ) && ( pSoldier->inv[ pSoldier->ubAttackingHand ].bStatus[0] > 1) )
if ( !PreRandom( uiDepreciateTest ) && ( pSoldier->inv[ pSoldier->ubAttackingHand ].ItemData.Generic.bStatus[0] > 1) )
{
pSoldier->inv[ pSoldier->ubAttackingHand ].bStatus[ 0 ]--;
pSoldier->inv[ pSoldier->ubAttackingHand ].ItemData.Generic.bStatus[ 0 ]--;
}
// reduce monster smell (gunpowder smell)
@@ -1982,7 +1982,7 @@ BOOLEAN UseGun( SOLDIERTYPE *pSoldier , INT16 sTargetGridNo )
//<SB> manual recharge
if (Weapon[Item[usItemNum].ubClassIndex].APsToReloadManually > 0)
pSoldier->inv[ pSoldier->ubAttackingHand ].ubGunState &= ~GS_CARTRIDGE_IN_CHAMBER;
pSoldier->inv[ pSoldier->ubAttackingHand ].ItemData.Gun.ubGunState &= ~GS_CARTRIDGE_IN_CHAMBER;
//<SB>
DebugMsg(TOPIC_JA2,DBG_LEVEL_3,String("UseGun: done"));
return( TRUE );
@@ -2046,7 +2046,7 @@ BOOLEAN UseBlade( SOLDIERTYPE *pSoldier , INT16 sTargetGridNo )
iImpact = HTHImpact( pSoldier, pTargetSoldier, (iHitChance - iDiceRoll), TRUE );
// modify this by the knife's condition (if it's dull, not much good)
iImpact = ( iImpact * WEAPON_STATUS_MOD(pSoldier->inv[pSoldier->ubAttackingHand].bStatus[0]) ) / 100;
iImpact = ( iImpact * WEAPON_STATUS_MOD(pSoldier->inv[pSoldier->ubAttackingHand].ItemData.Generic.bStatus[0]) ) / 100;
// modify by hit location
AdjustImpactByHitLocation( iImpact, pSoldier->bAimShotLocation, &iImpact, &iImpactForCrits );
@@ -2063,17 +2063,17 @@ BOOLEAN UseBlade( SOLDIERTYPE *pSoldier , INT16 sTargetGridNo )
iImpact = 1;
}
if ( pSoldier->inv[ pSoldier->ubAttackingHand ].bStatus[ 0 ] > USABLE )
if ( pSoldier->inv[ pSoldier->ubAttackingHand ].ItemData.Generic.bStatus[ 0 ] > USABLE )
{
bMaxDrop = (iImpact / 20);
// the duller they get, the slower they get any worse...
bMaxDrop = __min( bMaxDrop, pSoldier->inv[ pSoldier->ubAttackingHand ].bStatus[ 0 ] / 10 );
bMaxDrop = __min( bMaxDrop, pSoldier->inv[ pSoldier->ubAttackingHand ].ItemData.Generic.bStatus[ 0 ] / 10 );
// as long as its still > USABLE, it drops another point 1/2 the time
bMaxDrop = __max( bMaxDrop, 2 );
pSoldier->inv[ pSoldier->ubAttackingHand ].bStatus[ 0 ] -= (INT8) Random( bMaxDrop ); // 0 to (maxDrop - 1)
pSoldier->inv[ pSoldier->ubAttackingHand ].ItemData.Generic.bStatus[ 0 ] -= (INT8) Random( bMaxDrop ); // 0 to (maxDrop - 1)
}
// Send event for getting hit
@@ -2775,7 +2775,7 @@ BOOLEAN DoSpecialEffectAmmoMiss( UINT8 ubAttackerID, INT16 sGridNo, INT16 sXPos,
UINT8 ubAmmoType;
UINT16 usItem;
ubAmmoType = MercPtrs[ ubAttackerID ]->inv[ MercPtrs[ ubAttackerID ]->ubAttackingHand ].ubGunAmmoType;
ubAmmoType = MercPtrs[ ubAttackerID ]->inv[ MercPtrs[ ubAttackerID ]->ubAttackingHand ].ItemData.Gun.ubGunAmmoType;
usItem = MercPtrs[ ubAttackerID ]->inv[ MercPtrs[ ubAttackerID ]->ubAttackingHand ].usItem;
memset( &AniParams, 0, sizeof( ANITILE_PARAMS ) );
@@ -2938,14 +2938,14 @@ void WeaponHit( UINT16 usSoldierID, UINT16 usWeaponIndex, INT16 sDamage, INT16 s
MakeNoise( ubAttackerID, pTargetSoldier->sGridNo, pTargetSoldier->bLevel, gpWorldLevelData[pTargetSoldier->sGridNo].ubTerrainID, Weapon[ usWeaponIndex ].ubHitVolume, NOISE_BULLET_IMPACT );
// CALLAHAN START BUGFIX
if ( EXPLOSIVE_GUN( usWeaponIndex ) || AmmoTypes[pSoldier->inv[pSoldier->ubAttackingHand ].ubGunAmmoType].explosionSize > 1)
if ( EXPLOSIVE_GUN( usWeaponIndex ) || AmmoTypes[pSoldier->inv[pSoldier->ubAttackingHand ].ItemData.Gun.ubGunAmmoType].explosionSize > 1)
// CALLAHAN END BUGFIX
{
// Reduce attacker count!
//TODO: Madd --- I don't think this code will ever get called for the HE ammo -- the EXPLOSIVE_GUN check filters out regular guns
// marke test mag ammo type: pSoldier->inv[pSoldier->ubAttackingHand ].ubGunAmmoType
// 2cond 'or' added
if ( Item[usWeaponIndex].rocketlauncher || AmmoTypes[pSoldier->inv[pSoldier->ubAttackingHand ].ubGunAmmoType].explosionSize > 1 )
if ( Item[usWeaponIndex].rocketlauncher || AmmoTypes[pSoldier->inv[pSoldier->ubAttackingHand ].ItemData.Gun.ubGunAmmoType].explosionSize > 1 )
{
if ( Item[usWeaponIndex].singleshotrocketlauncher )
{
@@ -2956,13 +2956,13 @@ void WeaponHit( UINT16 usSoldierID, UINT16 usWeaponIndex, INT16 sDamage, INT16 s
{
DebugMsg( TOPIC_JA2, DBG_LEVEL_3, String("WeaponHit: RPG7 item: %d, Ammo: %d",pSoldier->inv[HANDPOS].usItem , pSoldier->inv[HANDPOS].usGunAmmoItem ) );
IgniteExplosion( ubAttackerID, sXPos, sYPos, 0, (INT16) (GETWORLDINDEXFROMWORLDCOORDS( sYPos, sXPos )), pSoldier->inv[pSoldier->ubAttackingHand ].usGunAmmoItem, pTargetSoldier->bLevel );
pSoldier->inv[pSoldier->ubAttackingHand ].usGunAmmoItem = NONE;
IgniteExplosion( ubAttackerID, sXPos, sYPos, 0, (INT16) (GETWORLDINDEXFROMWORLDCOORDS( sYPos, sXPos )), pSoldier->inv[pSoldier->ubAttackingHand ].ItemData.Gun.usGunAmmoItem, pTargetSoldier->bLevel );
pSoldier->inv[pSoldier->ubAttackingHand ].ItemData.Gun.usGunAmmoItem = NONE;
}
else if ( AmmoTypes[pSoldier->inv[pSoldier->ubAttackingHand ].ubGunAmmoType].explosionSize > 1)
else if ( AmmoTypes[pSoldier->inv[pSoldier->ubAttackingHand ].ItemData.Gun.ubGunAmmoType].explosionSize > 1)
{
// re-routed the Highexplosive value to define exposion type
IgniteExplosion( ubAttackerID, sXPos, sYPos, 0, (INT16) (GETWORLDINDEXFROMWORLDCOORDS( sYPos, sXPos )), AmmoTypes[pSoldier->inv[pSoldier->ubAttackingHand ].ubGunAmmoType].highExplosive , pTargetSoldier->bLevel );
IgniteExplosion( ubAttackerID, sXPos, sYPos, 0, (INT16) (GETWORLDINDEXFROMWORLDCOORDS( sYPos, sXPos )), AmmoTypes[pSoldier->inv[pSoldier->ubAttackingHand ].ItemData.Gun.ubGunAmmoType].highExplosive , pTargetSoldier->bLevel );
// pSoldier->inv[pSoldier->ubAttackingHand ].usGunAmmoItem = NONE;
}
}
@@ -3064,7 +3064,7 @@ void StructureHit( INT32 iBullet, UINT16 usWeaponIndex, INT8 bWeaponStatus, UINT
// Get attacker
pSoldier = MercPtrs[ ubAttackerID ];
// marke added one 'or' to get this working with HE ammo
if ( Item[usWeaponIndex].rocketlauncher || AmmoTypes[pSoldier->inv[pSoldier->ubAttackingHand ].ubGunAmmoType].explosionSize > 1)
if ( Item[usWeaponIndex].rocketlauncher || AmmoTypes[pSoldier->inv[pSoldier->ubAttackingHand ].ItemData.Gun.ubGunAmmoType].explosionSize > 1)
{
// Reduce attacker count!
DebugMsg( TOPIC_JA2, DBG_LEVEL_3, String("@@@@@@@ Freeing up attacker - end of LAW fire") );
@@ -3077,13 +3077,13 @@ void StructureHit( INT32 iBullet, UINT16 usWeaponIndex, INT8 bWeaponStatus, UINT
else if ( !Item[usWeaponIndex].singleshotrocketlauncher && Item[usWeaponIndex].rocketlauncher)
{
DebugMsg( TOPIC_JA2, DBG_LEVEL_3, String("StructureHit: RPG7 item: %d, Ammo: %d",pAttacker->inv[HANDPOS].usItem , pAttacker->inv[HANDPOS].usGunAmmoItem ) );
IgniteExplosion( ubAttackerID, (INT16)CenterX( sGridNo ), (INT16)CenterY( sGridNo ), 0, sGridNo, pAttacker->inv[pAttacker->ubAttackingHand ].usGunAmmoItem , (INT8)( sZPos >= WALL_HEIGHT ) );
pAttacker->inv[pAttacker->ubAttackingHand ].usGunAmmoItem = NONE;
IgniteExplosion( ubAttackerID, (INT16)CenterX( sGridNo ), (INT16)CenterY( sGridNo ), 0, sGridNo, pAttacker->inv[pAttacker->ubAttackingHand ].ItemData.Gun.usGunAmmoItem , (INT8)( sZPos >= WALL_HEIGHT ) );
pAttacker->inv[pAttacker->ubAttackingHand ].ItemData.Gun.usGunAmmoItem = NONE;
}
else if ( AmmoTypes[pSoldier->inv[pSoldier->ubAttackingHand ].ubGunAmmoType].explosionSize > 1)
else if ( AmmoTypes[pSoldier->inv[pSoldier->ubAttackingHand ].ItemData.Gun.ubGunAmmoType].explosionSize > 1)
{
// re-routed the Highexplosive value to define exposion type
IgniteExplosion( ubAttackerID, (INT16)CenterX( sGridNo ), (INT16)CenterY( sGridNo ), 0, sGridNo, AmmoTypes[pSoldier->inv[pSoldier->ubAttackingHand ].ubGunAmmoType].highExplosive , (INT8)( sZPos >= WALL_HEIGHT ) );
IgniteExplosion( ubAttackerID, (INT16)CenterX( sGridNo ), (INT16)CenterY( sGridNo ), 0, sGridNo, AmmoTypes[pSoldier->inv[pSoldier->ubAttackingHand ].ItemData.Gun.ubGunAmmoType].highExplosive , (INT8)( sZPos >= WALL_HEIGHT ) );
// pSoldier->inv[pSoldier->ubAttackingHand ].usGunAmmoItem = NONE;
}
@@ -3492,7 +3492,7 @@ UINT32 CalcChanceToHitGun(SOLDIERTYPE *pSoldier, UINT16 sGridNo, UINT8 ubAimTime
usInHand = pSoldier->usAttackingWeapon;
// DETERMINE BASE CHANCE OF HITTING
iGunCondition = WEAPON_STATUS_MOD( pInHand->bGunStatus );
iGunCondition = WEAPON_STATUS_MOD( pInHand->ItemData.Gun.bGunStatus );
if (Item[usInHand].rocketlauncher )
{
@@ -4309,8 +4309,8 @@ INT32 TotalArmourProtection( SOLDIERTYPE *pFirer, SOLDIERTYPE * pTarget, UINT8 u
// if the plate didn't stop the bullet...
if ( iImpact > iTotalProtection )
{
iTotalProtection += ArmourProtection( pTarget, Item[pArmour->usItem].ubClassIndex, &(pArmour->bStatus[0]), iImpact, ubAmmoType, &plateHit );
if ( pArmour->bStatus[ 0 ] < USABLE )
iTotalProtection += ArmourProtection( pTarget, Item[pArmour->usItem].ubClassIndex, &(pArmour->ItemData.Generic.bStatus[0]), iImpact, ubAmmoType, &plateHit );
if ( pArmour->ItemData.Generic.bStatus[ 0 ] < USABLE )
{
//Madd: put any attachments that someone might have added to the armour in the merc's inventory
for (int bLoop = 0; bLoop < MAX_ATTACHMENTS; bLoop++)
@@ -4348,7 +4348,7 @@ INT32 BulletImpact( SOLDIERTYPE *pFirer, SOLDIERTYPE * pTarget, UINT8 ubHitLocat
}
else
{
ubAmmoType = pFirer->inv[pFirer->ubAttackingHand].ubGunAmmoType;
ubAmmoType = pFirer->inv[pFirer->ubAttackingHand].ItemData.Gun.ubGunAmmoType;
}
if ( TANK( pTarget ) )
@@ -5198,7 +5198,7 @@ void ReloadWeapon( SOLDIERTYPE *pSoldier, UINT8 ubHandPos )
if ( pSoldier->inv[ ubHandPos ].usItem != NOTHING )
{
pSoldier->inv[ ubHandPos ].ubGunShotsLeft = GetMagSize(&pSoldier->inv[ ubHandPos ]);
pSoldier->inv[ ubHandPos ].ItemData.Gun.ubGunShotsLeft = GetMagSize(&pSoldier->inv[ ubHandPos ]);
// Dirty Bars
DirtyMercPanelInterface( pSoldier, DIRTYLEVEL1 );
}
@@ -5536,7 +5536,7 @@ UINT32 CalcThrownChanceToHit(SOLDIERTYPE *pSoldier, INT16 sGridNo, UINT8 ubAimTi
// if iChance exists, but it's a mechanical item being used
if ((iChance > 0) && (Item[ usHandItem ].usItemClass == IC_LAUNCHER ))
// reduce iChance to hit DIRECTLY by the item's working condition
iChance = (iChance * WEAPON_STATUS_MOD(pSoldier->inv[HANDPOS].bStatus[0])) / 100;
iChance = (iChance * WEAPON_STATUS_MOD(pSoldier->inv[HANDPOS].ItemData.Generic.bStatus[0])) / 100;
// MAKE SURE CHANCE TO HIT IS WITHIN DEFINED LIMITS
if (iChance < MINCHANCETOHIT)
@@ -5659,7 +5659,7 @@ BOOLEAN WillExplosiveWeaponFail( SOLDIERTYPE *pSoldier, OBJECTTYPE *pObj )
{
if ( pSoldier->bTeam == gbPlayerNum || pSoldier->bVisible == 1 )
{
if ( (INT8)(PreRandom( 40 ) + PreRandom( 40 ) ) > pObj->bStatus[0] )
if ( (INT8)(PreRandom( 40 ) + PreRandom( 40 ) ) > pObj->ItemData.Generic.bStatus[0] )
{
// Do second dice roll
if ( PreRandom( 2 ) == 1 )
+9 -9
View File
@@ -162,12 +162,12 @@ void FindPanicBombsAndTriggers( void )
if (gWorldBombs[ uiBombIndex ].fExists)
{
pObj = &(gWorldItems[ gWorldBombs[ uiBombIndex ].iItemIndex ].o);
if (pObj->bFrequency == PANIC_FREQUENCY || pObj->bFrequency == PANIC_FREQUENCY_2 || pObj->bFrequency == PANIC_FREQUENCY_3 )
if (pObj->ItemData.Trigger.BombTrigger.bFrequency == PANIC_FREQUENCY || pObj->ItemData.Trigger.BombTrigger.bFrequency == PANIC_FREQUENCY_2 || pObj->ItemData.Trigger.BombTrigger.bFrequency == PANIC_FREQUENCY_3 )
{
if (pObj->usItem == SWITCH)
{
sGridNo = gWorldItems[ gWorldBombs[ uiBombIndex ].iItemIndex ].sGridNo;
switch( pObj->bFrequency )
switch( pObj->ItemData.Trigger.BombTrigger.bFrequency )
{
case PANIC_FREQUENCY:
bPanicIndex = 0;
@@ -205,7 +205,7 @@ void FindPanicBombsAndTriggers( void )
}
gTacticalStatus.sPanicTriggerGridNo[ bPanicIndex ] = sGridNo;
gTacticalStatus.ubPanicTolerance[ bPanicIndex ] = pObj->ubTolerance;
gTacticalStatus.ubPanicTolerance[ bPanicIndex ] = pObj->ItemData.Trigger.Area.ubTolerance;
if (pObj->fFlags & OBJECT_ALARM_TRIGGER)
{
gTacticalStatus.bPanicTriggerIsAlarm[ bPanicIndex ] = TRUE;
@@ -466,11 +466,11 @@ void LoadWorldItemsFromMap( INT8 **hBuffer )
}
if( dummyItem.o.usItem == ACTION_ITEM && gfLoadPitsWithoutArming )
{ //if we are loading a pit, they are typically loaded without being armed.
if( dummyItem.o.bActionValue == ACTION_ITEM_SMALL_PIT || dummyItem.o.bActionValue == ACTION_ITEM_LARGE_PIT )
if( dummyItem.o.ItemData.Trigger.bActionValue == ACTION_ITEM_SMALL_PIT || dummyItem.o.ItemData.Trigger.bActionValue == ACTION_ITEM_LARGE_PIT )
{
dummyItem.usFlags &= ~WORLD_ITEM_ARMED_BOMB;
dummyItem.bVisible = BURIED;
dummyItem.o.bDetonatorType = 0;
dummyItem.o.ItemData.Trigger.bDetonatorType = 0;
}
}
@@ -519,11 +519,11 @@ void DeleteWorldItemsBelongingToTerroristsWhoAreNotThere( void )
if ( gWorldItems[ uiLoop ].fExists && gWorldItems[ uiLoop ].o.usItem == OWNERSHIP )
{
// if owner is a terrorist
if ( IsProfileATerrorist( gWorldItems[ uiLoop ].o.ubOwnerProfile ) )
if ( IsProfileATerrorist( gWorldItems[ uiLoop ].o.ItemData.Owner.ubOwnerProfile ) )
{
// and they were not set in the current sector
if ( gMercProfiles[ gWorldItems[ uiLoop ].o.ubOwnerProfile ].sSectorX != gWorldSectorX ||
gMercProfiles[ gWorldItems[ uiLoop ].o.ubOwnerProfile ].sSectorY != gWorldSectorY )
if ( gMercProfiles[ gWorldItems[ uiLoop ].o.ItemData.Owner.ubOwnerProfile ].sSectorX != gWorldSectorX ||
gMercProfiles[ gWorldItems[ uiLoop ].o.ItemData.Owner.ubOwnerProfile ].sSectorY != gWorldSectorY )
{
// then all items in this location should be deleted
sGridNo = gWorldItems[ uiLoop ].sGridNo;
@@ -563,7 +563,7 @@ void DeleteWorldItemsBelongingToQueenIfThere( void )
if ( gWorldItems[ uiLoop ].fExists && gWorldItems[ uiLoop ].o.usItem == OWNERSHIP )
{
// if owner is the Queen
if ( gWorldItems[ uiLoop ].o.ubOwnerProfile == QUEEN )
if ( gWorldItems[ uiLoop ].o.ItemData.Owner.ubOwnerProfile == QUEEN )
{
// then all items in this location should be deleted
sGridNo = gWorldItems[ uiLoop ].sGridNo;
+1 -1
View File
@@ -142,7 +142,7 @@ void HandleBulletSpecialFlags( INT32 iBulletIndex )
else if ( pBullet->usFlags & ( BULLET_FLAG_KNIFE ) )
{
strcpy( AniParams.zCachedFile, "TILECACHE\\KNIFING.STI" );
pBullet->ubItemStatus = pBullet->pFirer->inv[ HANDPOS ].bStatus[0];
pBullet->ubItemStatus = pBullet->pFirer->inv[ HANDPOS ].ItemData.Generic.bStatus[0];
}
// Get direction to use for this guy....
+7 -7
View File
@@ -4392,36 +4392,36 @@ void WriteQuantityAndAttachments( OBJECTTYPE *pObject, INT32 yp )
CHAR16 str[50];
CHAR16 temp[5];
UINT8 i;
swprintf( str, L"Clips: %d (%d", pObject->ubNumberOfObjects, pObject->bStatus[0] );
swprintf( str, L"Clips: %d (%d", pObject->ubNumberOfObjects, pObject->ItemData.Generic.bStatus[0] );
for( i = 1; i < pObject->ubNumberOfObjects; i++ )
{
swprintf( temp, L", %d", pObject->bStatus[0] );
swprintf( temp, L", %d", pObject->ItemData.Generic.bStatus[0] );
wcscat( str, temp );
}
wcscat( str, L")" );
gprintf( 320, yp, str );
}
else
gprintf( 320, yp, L"%d rounds", pObject->bStatus[0] );
gprintf( 320, yp, L"%d rounds", pObject->ItemData.Generic.bStatus[0] );
return;
}
if( pObject->ubNumberOfObjects > 1 && fAttachments )
{ //everything
gprintf( 320, yp, L"%d%% Qty: %d %s",
pObject->bStatus[0], pObject->ubNumberOfObjects, szAttach );
pObject->ItemData.Generic.bStatus[0], pObject->ubNumberOfObjects, szAttach );
}
else if( pObject->ubNumberOfObjects > 1 )
{ //condition and quantity
gprintf( 320, yp, L"%d%% Qty: %d ",
pObject->bStatus[0], pObject->ubNumberOfObjects );
pObject->ItemData.Generic.bStatus[0], pObject->ubNumberOfObjects );
}
else if( fAttachments )
{ //condition and attachments
gprintf( 320, yp, L"%d%% %s", pObject->bStatus[0], szAttach );
gprintf( 320, yp, L"%d%% %s", pObject->ItemData.Generic.bStatus[0], szAttach );
}
else
{ //condition
gprintf( 320, yp, L"%d%%", pObject->bStatus[0] );
gprintf( 320, yp, L"%d%%", pObject->ItemData.Generic.bStatus[0] );
}
}
+2 -2
View File
@@ -101,7 +101,7 @@ INT8 OKToAttack(SOLDIERTYPE * pSoldier, int target)
return(NOSHOOT_NOLOAD);
}
}
else if (pSoldier->inv[HANDPOS].ubGunShotsLeft == 0 /*SB*/ || !(pSoldier->inv[HANDPOS].ubGunState & GS_CARTRIDGE_IN_CHAMBER))
else if (pSoldier->inv[HANDPOS].ItemData.Gun.ubGunShotsLeft == 0 /*SB*/ || !(pSoldier->inv[HANDPOS].ItemData.Gun.ubGunState & GS_CARTRIDGE_IN_CHAMBER))
{
return(NOSHOOT_NOAMMO);
}
@@ -1354,7 +1354,7 @@ INT16 FindClosestClimbPointAvailableToAI( SOLDIERTYPE * pSoldier, INT16 sStartGr
// since climbing necessary involves going an extra tile, we compare against 1 less than the roam range...
// or add 1 to the distance to the climb point
sGridNo = FindClosestClimbPoint( sStartGridNo, sDesiredGridNo, fClimbUp );
sGridNo = FindClosestClimbPoint( pSoldier, sStartGridNo, sDesiredGridNo, fClimbUp );
if ( PythSpacesAway( sRoamingOrigin, sGridNo ) + 1 > sRoamingRange )
+14 -14
View File
@@ -102,7 +102,7 @@ void LoadWeaponIfNeeded(SOLDIERTYPE *pSoldier)
// remove payload from its pocket, and add it as the hand weapon's first attachment
OBJECTTYPE Temp;
CreateItem(pSoldier->inv[bPayloadPocket].usItem,pSoldier->inv[bPayloadPocket].bStatus[0],&Temp);
CreateItem(pSoldier->inv[bPayloadPocket].usItem,pSoldier->inv[bPayloadPocket].ItemData.Generic.bStatus[0],&Temp);
AttachObject ( pSoldier, &pSoldier->inv[HANDPOS],&Temp,FALSE);
//pSoldier->inv[HANDPOS].usAttachItem[0] = pSoldier->inv[bPayloadPocket].usItem;
@@ -1590,7 +1590,7 @@ INT32 EstimateShotDamage(SOLDIERTYPE *pSoldier, SOLDIERTYPE *pOpponent, UINT8 ub
}
else
{
ubAmmoType = pSoldier->inv[pSoldier->ubAttackingHand].ubGunAmmoType;
ubAmmoType = pSoldier->inv[pSoldier->ubAttackingHand].ItemData.Gun.ubGunAmmoType;
}
// calculate distance to target, obtain his gun's maximum range rating
@@ -1612,7 +1612,7 @@ INT32 EstimateShotDamage(SOLDIERTYPE *pSoldier, SOLDIERTYPE *pOpponent, UINT8 ub
if (pOpponent->inv[HELMETPOS].usItem)
{
iHeadProt += (INT32) Armour[Item[pOpponent->inv[HELMETPOS].usItem].ubClassIndex].ubProtection *
(INT32) pOpponent->inv[HELMETPOS].bStatus[0] / 100;
(INT32) pOpponent->inv[HELMETPOS].ItemData.Generic.bStatus[0] / 100;
}
// if opponent is wearing a protective vest
@@ -1622,7 +1622,7 @@ INT32 EstimateShotDamage(SOLDIERTYPE *pSoldier, SOLDIERTYPE *pOpponent, UINT8 ub
if (pOpponent->inv[VESTPOS].usItem)
{
iTorsoProt += (INT32) Armour[Item[pOpponent->inv[VESTPOS].usItem].ubClassIndex].ubProtection *
(INT32) pOpponent->inv[VESTPOS].bStatus[0] / 100;
(INT32) pOpponent->inv[VESTPOS].ItemData.Generic.bStatus[0] / 100;
}
}
@@ -1641,7 +1641,7 @@ INT32 EstimateShotDamage(SOLDIERTYPE *pSoldier, SOLDIERTYPE *pOpponent, UINT8 ub
if (pOpponent->inv[LEGPOS].usItem)
{
iLegProt += (INT32) Armour[Item[pOpponent->inv[LEGPOS].usItem].ubClassIndex].ubProtection *
(INT32) pOpponent->inv[LEGPOS].bStatus[0] / 100;
(INT32) pOpponent->inv[LEGPOS].ItemData.Generic.bStatus[0] / 100;
}
}
@@ -1764,7 +1764,7 @@ INT32 EstimateThrowDamage( SOLDIERTYPE *pSoldier, UINT8 ubItemPos, SOLDIERTYPE *
if (bSlot == HEAD1POS || bSlot == HEAD2POS)
{
// take condition of the gas mask into account - it could be leaking
iBreathDamage = (iBreathDamage * (100 - pOpponent->inv[bSlot].bStatus[0])) / 100;
iBreathDamage = (iBreathDamage * (100 - pOpponent->inv[bSlot].ItemData.Generic.bStatus[0])) / 100;
//NumMessage("damage after GAS MASK: ",iBreathDamage);
}
@@ -1803,7 +1803,7 @@ INT32 EstimateThrowDamage( SOLDIERTYPE *pSoldier, UINT8 ubItemPos, SOLDIERTYPE *
// approximate chance of the grenade going off (Ian's formulas are too funky)
// then use that to reduce the expected damage because thing may not blow!
iDamage = (iDamage * pSoldier->inv[ubItemPos].bStatus[0]) / 100;
iDamage = (iDamage * pSoldier->inv[ubItemPos].ItemData.Generic.bStatus[0]) / 100;
// if the target gridno is in water, grenade may not blow (guess 50% of time)
/*
@@ -1895,9 +1895,9 @@ INT8 TryToReload( SOLDIERTYPE * pSoldier )
//<SB> manual recharge
pObj = &(pSoldier->inv[HANDPOS]);
if (pObj->ubGunShotsLeft && !(pObj->ubGunState & GS_CARTRIDGE_IN_CHAMBER) )
if (pObj->ItemData.Gun.ubGunShotsLeft && !(pObj->ItemData.Gun.ubGunState & GS_CARTRIDGE_IN_CHAMBER) )
{
pObj->ubGunState |= GS_CARTRIDGE_IN_CHAMBER;
pObj->ItemData.Gun.ubGunState |= GS_CARTRIDGE_IN_CHAMBER;
DeductPoints(pSoldier, Weapon[Item[(pObj)->usItem].ubClassIndex].APsToReloadManually, 0);
@@ -1908,9 +1908,9 @@ INT8 TryToReload( SOLDIERTYPE * pSoldier )
{
pObj2 = &(pSoldier->inv[SECONDHANDPOS]);
if (pObj2->ubGunShotsLeft && !(pObj2->ubGunState & GS_CARTRIDGE_IN_CHAMBER) )
if (pObj2->ItemData.Gun.ubGunShotsLeft && !(pObj2->ItemData.Gun.ubGunState & GS_CARTRIDGE_IN_CHAMBER) )
{
pObj2->ubGunState |= GS_CARTRIDGE_IN_CHAMBER;
pObj2->ItemData.Gun.ubGunState |= GS_CARTRIDGE_IN_CHAMBER;
PlayJA2Sample( Weapon[ Item[pObj2->usItem].ubClassIndex ].ManualReloadSound, RATE_11025, SoundVolume( HIGHVOLUME, pSoldier->sGridNo ), 1, SoundDir( pSoldier->sGridNo ) );
}
}
@@ -1923,9 +1923,9 @@ INT8 TryToReload( SOLDIERTYPE * pSoldier )
{
pObj2 = &(pSoldier->inv[SECONDHANDPOS]);
if (pObj2->ubGunShotsLeft && !(pObj2->ubGunState & GS_CARTRIDGE_IN_CHAMBER) )
if (pObj2->ItemData.Gun.ubGunShotsLeft && !(pObj2->ItemData.Gun.ubGunState & GS_CARTRIDGE_IN_CHAMBER) )
{
pObj2->ubGunState |= GS_CARTRIDGE_IN_CHAMBER;
pObj2->ItemData.Gun.ubGunState |= GS_CARTRIDGE_IN_CHAMBER;
DeductPoints(pSoldier, Weapon[Item[(pObj2)->usItem].ubClassIndex].APsToReloadManually, 0);
@@ -2470,7 +2470,7 @@ void CheckIfShotPossible(SOLDIERTYPE *pSoldier, ATTACKTYPE *pBestShot, BOOLEAN s
}
if ( (!suppressionFire && ( (IsScoped(pObj) && GunRange(pObj) > MaxDistanceVisible() ) || pSoldier->bOrders == SNIPER ) ) ||
(suppressionFire && IsGunAutofireCapable(pSoldier,pBestShot->bWeaponIn ) && GetMagSize(pObj) > 30 && pObj->ubGunShotsLeft > 20 ))
(suppressionFire && IsGunAutofireCapable(pSoldier,pBestShot->bWeaponIn ) && GetMagSize(pObj) > 30 && pObj->ItemData.Gun.ubGunShotsLeft > 20 ))
{
// get the minimum cost to attack with this item
DebugMsg (TOPIC_JA2,DBG_LEVEL_3,"CheckIfShotPossible: getting min aps");
+2 -2
View File
@@ -1117,9 +1117,9 @@ INT8 CreatureDecideActionBlack( SOLDIERTYPE * pSoldier )
if (bWeaponIn != NO_SLOT)
{
if (Item[pSoldier->inv[bWeaponIn].usItem].usItemClass == IC_GUN && pSoldier->inv[bWeaponIn].bGunStatus >= USABLE)
if (Item[pSoldier->inv[bWeaponIn].usItem].usItemClass == IC_GUN && pSoldier->inv[bWeaponIn].ItemData.Gun.bGunStatus >= USABLE)
{
if (pSoldier->inv[bWeaponIn].ubGunShotsLeft > 0)
if (pSoldier->inv[bWeaponIn].ItemData.Gun.ubGunShotsLeft > 0)
{
bSpitIn = bWeaponIn;
// if it's in another pocket, swap it into his hand temporarily
+17 -14
View File
@@ -984,7 +984,7 @@ INT8 DecideActionGreen(SOLDIERTYPE *pSoldier)
pSoldier->usActionData = FindClosestClimbPoint(pSoldier, fUp );
// Added the check here because sniper militia who are locked inside of a building without keys
// will still have a >100% chance to want to climb, which means an infinite loop. In fact, any
// time a move is desired, there is also probably be a need to check for a path.
// time a move is desired, there probably also will be a need to check for a path.
if ( pSoldier->usActionData != NOWHERE &&
LegalNPCDestination(pSoldier,pSoldier->usActionData,ENSURE_PATH,WATEROK, 0 ))
{
@@ -1525,8 +1525,11 @@ INT8 DecideActionYellow(SOLDIERTYPE *pSoldier)
return AI_ACTION_SEEK_NOISE ;
}
if ( !( pSoldier->bTeam == CIV_TEAM && pSoldier->ubProfile != NO_PROFILE && pSoldier->ubProfile != ELDIN ) )
// Hmmm, I don't think this check is doing what is intended. But then I see no comment about what is intended.
// However, civilians with no profile (and likely no weapons) do not need to be seeking out noises. Most don't
// even have the body type for it (can't climb or jump).
//if ( !( pSoldier->bTeam == CIV_TEAM && pSoldier->ubProfile != NO_PROFILE && pSoldier->ubProfile != ELDIN ) )
if ( pSoldier->bTeam != CIV_TEAM || ( pSoldier->ubProfile != NO_PROFILE && pSoldier->ubProfile != ELDIN ) )
{
// IF WE ARE MILITIA/CIV IN REALTIME, CLOSE TO NOISE, AND CAN SEE THE SPOT WHERE THE NOISE CAME FROM, FORGET IT
if ( fReachable && !fClimb && !gfTurnBasedAI && (pSoldier->bTeam == MILITIA_TEAM || pSoldier->bTeam == CIV_TEAM )&& PythSpacesAway( pSoldier->sGridNo, sNoiseGridNo ) < 5 )
@@ -1619,7 +1622,7 @@ INT8 DecideActionYellow(SOLDIERTYPE *pSoldier)
}
else
{
pSoldier->usActionData = FindClosestClimbPoint(pSoldier->sGridNo , sNoiseGridNo , fUp );
pSoldier->usActionData = FindClosestClimbPoint(pSoldier, pSoldier->sGridNo , sNoiseGridNo , fUp );
if ( pSoldier->usActionData != NOWHERE )
{
return( AI_ACTION_MOVE_TO_CLIMB );
@@ -1759,7 +1762,7 @@ INT8 DecideActionYellow(SOLDIERTYPE *pSoldier)
}
else
{
pSoldier->usActionData = FindClosestClimbPoint(pSoldier->sGridNo , sClosestFriend , fUp );
pSoldier->usActionData = FindClosestClimbPoint(pSoldier, pSoldier->sGridNo , sClosestFriend , fUp );
if ( pSoldier->usActionData != NOWHERE )
{
return( AI_ACTION_MOVE_TO_CLIMB );
@@ -2293,7 +2296,7 @@ INT8 DecideActionRed(SOLDIERTYPE *pSoldier, UINT8 ubUnconsciousOK)
ubBurstAPs = CalcAPsToAutofire( CalcActionPoints( pSoldier ), &(pSoldier->inv[BestShot.bWeaponIn]), pSoldier->bDoAutofire );
}
while( pSoldier->bActionPoints >= BestShot.ubAPCost + ubBurstAPs &&
pSoldier->inv[ pSoldier->ubAttackingHand ].ubGunShotsLeft >= pSoldier->bDoAutofire &&
pSoldier->inv[ pSoldier->ubAttackingHand ].ItemData.Gun.ubGunShotsLeft >= pSoldier->bDoAutofire &&
GetAutoPenalty(&pSoldier->inv[ pSoldier->ubAttackingHand ], gAnimControl[ pSoldier->usAnimState ].ubEndHeight == ANIM_PRONE)*pSoldier->bDoAutofire <= 80 );
@@ -2779,7 +2782,7 @@ INT8 DecideActionRed(SOLDIERTYPE *pSoldier, UINT8 ubUnconsciousOK)
}
else
{
pSoldier->usActionData = FindClosestClimbPoint(pSoldier->sGridNo , sClosestDisturbance , fUp );
pSoldier->usActionData = FindClosestClimbPoint(pSoldier, pSoldier->sGridNo , sClosestDisturbance , fUp );
if ( pSoldier->usActionData != NOWHERE )
{
return( AI_ACTION_MOVE_TO_CLIMB );
@@ -2993,7 +2996,7 @@ INT8 DecideActionRed(SOLDIERTYPE *pSoldier, UINT8 ubUnconsciousOK)
}
else
{
pSoldier->usActionData = FindClosestClimbPoint(pSoldier->sGridNo , sClosestFriend , fUp );
pSoldier->usActionData = FindClosestClimbPoint(pSoldier, pSoldier->sGridNo , sClosestFriend , fUp );
if ( pSoldier->usActionData != NOWHERE )
{
return( AI_ACTION_MOVE_TO_CLIMB );
@@ -3796,7 +3799,7 @@ INT8 DecideActionBlack(SOLDIERTYPE *pSoldier)
}
// now it better be a gun, or the guy can't shoot (but has other attack(s))
if (Item[pSoldier->inv[HANDPOS].usItem].usItemClass == IC_GUN && pSoldier->inv[HANDPOS].bGunStatus >= USABLE)
if (Item[pSoldier->inv[HANDPOS].usItem].usItemClass == IC_GUN && pSoldier->inv[HANDPOS].ItemData.Gun.bGunStatus >= USABLE)
{
// get the minimum cost to attack the same target with this gun
ubMinAPCost = MinAPsToAttack(pSoldier,pSoldier->sLastTarget,ADDTURNCOST);
@@ -4319,7 +4322,7 @@ INT8 DecideActionBlack(SOLDIERTYPE *pSoldier)
if (IsGunBurstCapable( pSoldier, BestAttack.bWeaponIn, FALSE ) &&
!(Menptr[BestShot.ubOpponent].bLife < OKLIFE) && // don't burst at downed targets
pSoldier->inv[BestAttack.bWeaponIn].ubGunShotsLeft > 1 &&
pSoldier->inv[BestAttack.bWeaponIn].ItemData.Gun.ubGunShotsLeft > 1 &&
(pSoldier->bTeam != gbPlayerNum || pSoldier->bRTPCombat == RTP_COMBAT_AGGRESSIVE) )
{
DebugMsg (TOPIC_JA2,DBG_LEVEL_3,"DecideActionBlack: ENOUGH APs TO BURST, RANDOM CHANCE OF DOING SO");
@@ -4347,7 +4350,7 @@ INT8 DecideActionBlack(SOLDIERTYPE *pSoldier)
case ATTACKSLAYONLY:iChance += 30; break;
}
if ( pSoldier->inv[BestAttack.bWeaponIn].ubGunShotsLeft > 50 )
if ( pSoldier->inv[BestAttack.bWeaponIn].ItemData.Gun.ubGunShotsLeft > 50 )
iChance += 20;
// increase chance based on proximity and difficulty of enemy
@@ -4382,7 +4385,7 @@ INT8 DecideActionBlack(SOLDIERTYPE *pSoldier)
if (IsGunAutofireCapable( pSoldier, BestAttack.bWeaponIn ) &&
!(Menptr[BestShot.ubOpponent].bLife < OKLIFE) && // don't burst at downed targets
(( pSoldier->inv[BestAttack.bWeaponIn].ubGunShotsLeft > 1 &&
(( pSoldier->inv[BestAttack.bWeaponIn].ItemData.Gun.ubGunShotsLeft > 1 &&
BestAttack.ubAimTime != BURSTING ) || Weapon[pSoldier->inv[BestAttack.bWeaponIn].usItem].NoSemiAuto) )
{
DebugMsg (TOPIC_JA2,DBG_LEVEL_3,"DecideActionBlack: ENOUGH APs TO AUTOFIRE, RANDOM CHANCE OF DOING SO");
@@ -4393,7 +4396,7 @@ INT8 DecideActionBlack(SOLDIERTYPE *pSoldier)
ubBurstAPs = CalcAPsToAutofire( CalcActionPoints( pSoldier ), &(pSoldier->inv[BestAttack.bWeaponIn]), pSoldier->bDoAutofire );
}
while( pSoldier->bActionPoints >= BestAttack.ubAPCost + ubBurstAPs &&
pSoldier->inv[ pSoldier->ubAttackingHand ].ubGunShotsLeft >= pSoldier->bDoAutofire &&
pSoldier->inv[ pSoldier->ubAttackingHand ].ItemData.Gun.ubGunShotsLeft >= pSoldier->bDoAutofire &&
GetAutoPenalty(&pSoldier->inv[ BestAttack.bWeaponIn ], gAnimControl[ pSoldier->usAnimState ].ubEndHeight == ANIM_PRONE)*pSoldier->bDoAutofire <= 80);
@@ -4425,7 +4428,7 @@ INT8 DecideActionBlack(SOLDIERTYPE *pSoldier)
}
if ( pSoldier->inv[BestAttack.bWeaponIn].ubGunShotsLeft > 50 )
if ( pSoldier->inv[BestAttack.bWeaponIn].ItemData.Gun.ubGunShotsLeft > 50 )
iChance += 30;
if ( bInGas )
+9 -9
View File
@@ -1769,16 +1769,16 @@ INT8 SearchForItems( SOLDIERTYPE * pSoldier, INT8 bReason, UINT16 usItem )
{
pObj = &(gWorldItems[ pItemPool->iItemIndex ].o);
pItem = &(Item[pObj->usItem]);
if ( pItem->usItemClass == IC_GUN && pObj->bStatus[0] >= MINIMUM_REQUIRED_STATUS )
if ( pItem->usItemClass == IC_GUN && pObj->ItemData.Generic.bStatus[0] >= MINIMUM_REQUIRED_STATUS )
{
// maybe this gun has ammo (adjust for whether it is better than ours!)
if ( pObj->bGunAmmoStatus < 0 || pObj->ubGunShotsLeft == 0 || (Item[pObj->usItem].fingerprintid && pObj->ubImprintID != NOBODY && pObj->ubImprintID != pSoldier->ubID) )
if ( pObj->ItemData.Gun.bGunAmmoStatus < 0 || pObj->ItemData.Gun.ubGunShotsLeft == 0 || (Item[pObj->usItem].fingerprintid && pObj->ubImprintID != NOBODY && pObj->ubImprintID != pSoldier->ubID) )
{
iTempValue = 0;
}
else
{
iTempValue = pObj->ubGunShotsLeft * Weapon[pObj->usItem].ubDeadliness / Weapon[usItem].ubDeadliness;
iTempValue = pObj->ItemData.Gun.ubGunShotsLeft * Weapon[pObj->usItem].ubDeadliness / Weapon[usItem].ubDeadliness;
}
}
else if (ValidAmmoType( usItem, pObj->usItem ) )
@@ -1802,9 +1802,9 @@ INT8 SearchForItems( SOLDIERTYPE * pSoldier, INT8 bReason, UINT16 usItem )
{
pObj = &(gWorldItems[ pItemPool->iItemIndex ].o);
pItem = &(Item[pObj->usItem]);
if (pItem->usItemClass & IC_WEAPON && pObj->bStatus[0] >= MINIMUM_REQUIRED_STATUS )
if (pItem->usItemClass & IC_WEAPON && pObj->ItemData.Generic.bStatus[0] >= MINIMUM_REQUIRED_STATUS )
{
if ( (pItem->usItemClass & IC_GUN) && (pObj->bGunAmmoStatus < 0 || pObj->ubGunShotsLeft == 0 || (( Item[pObj->usItem].fingerprintid ) && pObj->ubImprintID != NOBODY && pObj->ubImprintID != pSoldier->ubID) ) )
if ( (pItem->usItemClass & IC_GUN) && (pObj->ItemData.Gun.bGunAmmoStatus < 0 || pObj->ItemData.Gun.ubGunShotsLeft == 0 || (( Item[pObj->usItem].fingerprintid ) && pObj->ubImprintID != NOBODY && pObj->ubImprintID != pSoldier->ubID) ) )
{
// jammed or out of ammo, skip it!
iTempValue = 0;
@@ -1842,9 +1842,9 @@ INT8 SearchForItems( SOLDIERTYPE * pSoldier, INT8 bReason, UINT16 usItem )
{
pObj = &(gWorldItems[ pItemPool->iItemIndex ].o);
pItem = &(Item[pObj->usItem]);
if ( pItem->usItemClass & IC_WEAPON && pObj->bStatus[0] >= MINIMUM_REQUIRED_STATUS )
if ( pItem->usItemClass & IC_WEAPON && pObj->ItemData.Generic.bStatus[0] >= MINIMUM_REQUIRED_STATUS )
{
if ( (pItem->usItemClass & IC_GUN) && (pObj->bGunAmmoStatus < 0 || pObj->ubGunShotsLeft == 0 || (( Item[pObj->usItem].fingerprintid ) && pObj->ubImprintID != NOBODY && pObj->ubImprintID != pSoldier->ubID) ) )
if ( (pItem->usItemClass & IC_GUN) && (pObj->ItemData.Gun.bGunAmmoStatus < 0 || pObj->ItemData.Gun.ubGunShotsLeft == 0 || (( Item[pObj->usItem].fingerprintid ) && pObj->ubImprintID != NOBODY && pObj->ubImprintID != pSoldier->ubID) ) )
{
// jammed or out of ammo, skip it!
iTempValue = 0;
@@ -1865,7 +1865,7 @@ INT8 SearchForItems( SOLDIERTYPE * pSoldier, INT8 bReason, UINT16 usItem )
iTempValue = 200 + Weapon[pObj->usItem].ubDeadliness;
}
}
else if (pItem->usItemClass == IC_ARMOUR && pObj->bStatus[0] >= MINIMUM_REQUIRED_STATUS )
else if (pItem->usItemClass == IC_ARMOUR && pObj->ItemData.Generic.bStatus[0] >= MINIMUM_REQUIRED_STATUS )
{
switch( Armour[pItem->ubClassIndex].ubArmourClass )
{
@@ -2623,7 +2623,7 @@ INT16 FindClosestClimbPoint (SOLDIERTYPE *pSoldier, BOOLEAN fClimbUp )
if ( FindBuilding ( sGridNo ) != NULL )
{
// DebugMsg( TOPIC_JA2AI , DBG_LEVEL_3 , String("Building found at %d", sGridNo ));
sClimbGridNo = FindClosestClimbPoint( pSoldier->sGridNo, sGridNo, fClimbUp);
sClimbGridNo = FindClosestClimbPoint( pSoldier, pSoldier->sGridNo, sGridNo, fClimbUp);
// DebugMsg( TOPIC_JA2AI , DBG_LEVEL_3 , String("Closest climb point is %d" , sClimbGridNo ));
if ( sClimbGridNo != NOWHERE )
+19 -19
View File
@@ -823,7 +823,7 @@ UINT8 NPCConsiderReceivingItemFromMerc( UINT8 ubNPC, UINT8 ubMerc, OBJECTTYPE *
case MONEY:
case SILVER:
case GOLD:
if (pObj->uiMoneyAmount < LARGE_AMOUNT_MONEY)
if (pObj->ItemData.Money.uiMoneyAmount < LARGE_AMOUNT_MONEY)
{
SetFactTrue( FACT_SMALL_AMOUNT_OF_MONEY );
}
@@ -841,7 +841,7 @@ UINT8 NPCConsiderReceivingItemFromMerc( UINT8 ubNPC, UINT8 ubMerc, OBJECTTYPE *
break;
}
if (pObj->bStatus[0] < 50)
if (pObj->ItemData.Generic.bStatus[0] < 50)
{
SetFactTrue( FACT_ITEM_POOR_CONDITION );
}
@@ -865,14 +865,14 @@ UINT8 NPCConsiderReceivingItemFromMerc( UINT8 ubNPC, UINT8 ubMerc, OBJECTTYPE *
case DARREN:
if (usItemToConsider == MONEY && pNPCQuoteInfo->sActionData == NPC_ACTION_DARREN_GIVEN_CASH)
{
if (pObj->uiMoneyAmount < 1000)
if (pObj->ItemData.Money.uiMoneyAmount < 1000)
{
// refuse, bet too low - record 15
(*ppResultQuoteInfo) = &pNPCQuoteInfoArray[15];
(*pubQuoteNum) = 15;
return( (*ppResultQuoteInfo)->ubOpinionRequired );
}
else if (pObj->uiMoneyAmount > 5000)
else if (pObj->ItemData.Money.uiMoneyAmount > 5000)
{
// refuse, bet too high - record 16
(*ppResultQuoteInfo) = &pNPCQuoteInfoArray[16];
@@ -896,7 +896,7 @@ UINT8 NPCConsiderReceivingItemFromMerc( UINT8 ubNPC, UINT8 ubMerc, OBJECTTYPE *
*/
// record amount of bet
gMercProfiles[ DARREN ].iBalance = pObj->uiMoneyAmount;
gMercProfiles[ DARREN ].iBalance = pObj->ItemData.Money.uiMoneyAmount;
SetFactFalse( FACT_DARREN_EXPECTING_MONEY );
// if never fought before, use record 17
@@ -943,14 +943,14 @@ UINT8 NPCConsiderReceivingItemFromMerc( UINT8 ubNPC, UINT8 ubMerc, OBJECTTYPE *
case ANGEL:
if (usItemToConsider == MONEY && pNPCQuoteInfo->sActionData == NPC_ACTION_ANGEL_GIVEN_CASH)
{
if (pObj->uiMoneyAmount < Item[LEATHER_JACKET_W_KEVLAR].usPrice)
if (pObj->ItemData.Money.uiMoneyAmount < Item[LEATHER_JACKET_W_KEVLAR].usPrice)
{
// refuse, bet too low - record 8
(*ppResultQuoteInfo) = &pNPCQuoteInfoArray[8];
(*pubQuoteNum) = 8;
return( (*ppResultQuoteInfo)->ubOpinionRequired );
}
else if (pObj->uiMoneyAmount > Item[LEATHER_JACKET_W_KEVLAR].usPrice)
else if (pObj->ItemData.Money.uiMoneyAmount > Item[LEATHER_JACKET_W_KEVLAR].usPrice)
{
// refuse, bet too high - record 9
(*ppResultQuoteInfo) = &pNPCQuoteInfoArray[9];
@@ -976,13 +976,13 @@ UINT8 NPCConsiderReceivingItemFromMerc( UINT8 ubNPC, UINT8 ubMerc, OBJECTTYPE *
(*pubQuoteNum) = 5;
return( (*ppResultQuoteInfo)->ubOpinionRequired );
}
switch( pObj->uiMoneyAmount )
switch( pObj->ItemData.Money.uiMoneyAmount )
{
case 100:
case 200: // Carla
if ( CheckFact( FACT_CARLA_AVAILABLE, 0 ) )
{
gMercProfiles[ MADAME ].bNPCData += (INT8) (pObj->uiMoneyAmount / 100);
gMercProfiles[ MADAME ].bNPCData += (INT8) (pObj->ItemData.Money.uiMoneyAmount / 100);
TriggerNPCRecord( MADAME, 16 );
}
else
@@ -997,7 +997,7 @@ UINT8 NPCConsiderReceivingItemFromMerc( UINT8 ubNPC, UINT8 ubMerc, OBJECTTYPE *
case 1000: // Cindy
if ( CheckFact( FACT_CINDY_AVAILABLE, 0 ) )
{
gMercProfiles[ MADAME ].bNPCData += (INT8) (pObj->uiMoneyAmount / 500);
gMercProfiles[ MADAME ].bNPCData += (INT8) (pObj->ItemData.Money.uiMoneyAmount / 500);
TriggerNPCRecord( MADAME, 17 );
}
else
@@ -1012,7 +1012,7 @@ UINT8 NPCConsiderReceivingItemFromMerc( UINT8 ubNPC, UINT8 ubMerc, OBJECTTYPE *
case 600: // Bambi
if ( CheckFact( FACT_BAMBI_AVAILABLE, 0 ) )
{
gMercProfiles[ MADAME ].bNPCData += (INT8) (pObj->uiMoneyAmount / 300);
gMercProfiles[ MADAME ].bNPCData += (INT8) (pObj->ItemData.Money.uiMoneyAmount / 300);
TriggerNPCRecord( MADAME, 18 );
}
else
@@ -1027,7 +1027,7 @@ UINT8 NPCConsiderReceivingItemFromMerc( UINT8 ubNPC, UINT8 ubMerc, OBJECTTYPE *
case 800: // Maria?
if ( gubQuest[ QUEST_RESCUE_MARIA ] == QUESTINPROGRESS )
{
gMercProfiles[ MADAME ].bNPCData += (INT8) (pObj->uiMoneyAmount / 400);
gMercProfiles[ MADAME ].bNPCData += (INT8) (pObj->ItemData.Money.uiMoneyAmount / 400);
TriggerNPCRecord( MADAME, 19 );
break;
}
@@ -1072,8 +1072,8 @@ UINT8 NPCConsiderReceivingItemFromMerc( UINT8 ubNPC, UINT8 ubMerc, OBJECTTYPE *
if ( CheckFact( FACT_VINCE_EXPECTING_MONEY, ubNPC ) == FALSE && gMercProfiles[ ubNPC ].iBalance < 0 && pNPCQuoteInfo->sActionData != NPC_ACTION_DONT_ACCEPT_ITEM )
{
// increment balance
gMercProfiles[ ubNPC ].iBalance += (INT32) pObj->uiMoneyAmount;
gMercProfiles[ ubNPC ].uiTotalCostToDate += pObj->uiMoneyAmount;
gMercProfiles[ ubNPC ].iBalance += (INT32) pObj->ItemData.Money.uiMoneyAmount;
gMercProfiles[ ubNPC ].uiTotalCostToDate += pObj->ItemData.Money.uiMoneyAmount;
if ( gMercProfiles[ ubNPC ].iBalance > 0 )
{
gMercProfiles[ ubNPC ].iBalance = 0;
@@ -1096,7 +1096,7 @@ UINT8 NPCConsiderReceivingItemFromMerc( UINT8 ubNPC, UINT8 ubMerc, OBJECTTYPE *
else
{
// handle the player giving NPC some money
HandleNPCBeingGivenMoneyByPlayer( ubNPC, pObj->uiMoneyAmount, pubQuoteNum );
HandleNPCBeingGivenMoneyByPlayer( ubNPC, pObj->ItemData.Money.uiMoneyAmount, pubQuoteNum );
(*ppResultQuoteInfo) = &pNPCQuoteInfoArray[ *pubQuoteNum ];
return( (*ppResultQuoteInfo)->ubOpinionRequired );
}
@@ -1104,7 +1104,7 @@ UINT8 NPCConsiderReceivingItemFromMerc( UINT8 ubNPC, UINT8 ubMerc, OBJECTTYPE *
else
{
// handle the player giving NPC some money
HandleNPCBeingGivenMoneyByPlayer( ubNPC, pObj->uiMoneyAmount, pubQuoteNum );
HandleNPCBeingGivenMoneyByPlayer( ubNPC, pObj->ItemData.Money.uiMoneyAmount, pubQuoteNum );
(*ppResultQuoteInfo) = &pNPCQuoteInfoArray[ *pubQuoteNum ];
return( (*ppResultQuoteInfo)->ubOpinionRequired );
}
@@ -1113,7 +1113,7 @@ UINT8 NPCConsiderReceivingItemFromMerc( UINT8 ubNPC, UINT8 ubMerc, OBJECTTYPE *
case KINGPIN:
if ( usItemToConsider == MONEY && gubQuest[ QUEST_KINGPIN_MONEY ] == QUESTINPROGRESS )
{
HandleNPCBeingGivenMoneyByPlayer( ubNPC, pObj->uiMoneyAmount, pubQuoteNum );
HandleNPCBeingGivenMoneyByPlayer( ubNPC, pObj->ItemData.Money.uiMoneyAmount, pubQuoteNum );
(*ppResultQuoteInfo) = &pNPCQuoteInfoArray[ *pubQuoteNum ];
return( (*ppResultQuoteInfo)->ubOpinionRequired );
}
@@ -1124,8 +1124,8 @@ UINT8 NPCConsiderReceivingItemFromMerc( UINT8 ubNPC, UINT8 ubMerc, OBJECTTYPE *
if ( gMercProfiles[ ubNPC ].iBalance < 0 && pNPCQuoteInfo->sActionData != NPC_ACTION_DONT_ACCEPT_ITEM )
{
// increment balance
gMercProfiles[ ubNPC ].iBalance += (INT32) pObj->uiMoneyAmount;
gMercProfiles[ ubNPC ].uiTotalCostToDate += pObj->uiMoneyAmount;
gMercProfiles[ ubNPC ].iBalance += (INT32) pObj->ItemData.Money.uiMoneyAmount;
gMercProfiles[ ubNPC ].uiTotalCostToDate += pObj->ItemData.Money.uiMoneyAmount;
if ( gMercProfiles[ ubNPC ].iBalance > 0 )
{
gMercProfiles[ ubNPC ].iBalance = 0;
+5 -2
View File
@@ -14,6 +14,8 @@
#include "worldman.h"
#endif
#include "AIInternals.h"
#define ROOF_LOCATION_CHANCE 8
UINT8 gubBuildingInfo[ WORLD_MAX ];
@@ -440,7 +442,7 @@ void GenerateBuildings( void )
}
}
INT16 FindClosestClimbPoint( INT16 sStartGridNo, INT16 sDesiredGridNo, BOOLEAN fClimbUp )
INT16 FindClosestClimbPoint( SOLDIERTYPE *pSoldier, INT16 sStartGridNo, INT16 sDesiredGridNo, BOOLEAN fClimbUp )
{
BUILDING * pBuilding;
UINT8 ubNumClimbSpots;
@@ -468,7 +470,8 @@ INT16 FindClosestClimbPoint( INT16 sStartGridNo, INT16 sDesiredGridNo, BOOLEAN f
for ( ubLoop = 0; ubLoop < ubNumClimbSpots; ubLoop++ )
{
if ( (WhoIsThere2( pBuilding->sUpClimbSpots[ ubLoop ], 0 ) == NOBODY)
&& (WhoIsThere2( pBuilding->sDownClimbSpots[ ubLoop ], 1 ) == NOBODY) )
&& (WhoIsThere2( pBuilding->sDownClimbSpots[ ubLoop ], 1 ) == NOBODY) &&
(!pSoldier || !InGas( pSoldier, psClimbSpots[ ubLoop] ) ) )
{
sDistance = PythSpacesAway( sStartGridNo, psClimbSpots[ ubLoop ] );
if (sDistance < sClosestDistance )
+1 -1
View File
@@ -26,7 +26,7 @@ BOOLEAN InBuilding( INT16 sGridNo );
BUILDING * GenerateBuilding( INT16 sDesiredSpot );
BUILDING * FindBuilding( INT16 sGridNo );
void GenerateBuildings( void );
INT16 FindClosestClimbPoint( INT16 sStartGridNo, INT16 sDesiredGridNo, BOOLEAN fClimbUp );
INT16 FindClosestClimbPoint( SOLDIERTYPE *pSoldier, INT16 sStartGridNo, INT16 sDesiredGridNo, BOOLEAN fClimbUp );
BOOLEAN SameBuilding( INT16 sGridNo1, INT16 sGridNo2 );
#endif
+37 -37
View File
@@ -247,7 +247,7 @@ void InternalIgniteExplosion( UINT8 ubOwner, INT16 sX, INT16 sY, INT16 sZ, INT16
// Let's check for the attacker first.
if ( ubOwner != NOBODY )
{
if ( !( Item[ usItem ].usItemClass & IC_EXPLOSV ) && AmmoTypes[MercPtrs[ubOwner]->inv[MercPtrs[ubOwner]->ubAttackingHand ].ubGunAmmoType].explosionSize < 2 )
if ( !( Item[ usItem ].usItemClass & IC_EXPLOSV ) && AmmoTypes[MercPtrs[ubOwner]->inv[MercPtrs[ubOwner]->ubAttackingHand ].ItemData.Gun.ubGunAmmoType].explosionSize < 2 )
{
return; // no explosive and attackers gun is not fireing HE
}
@@ -274,7 +274,7 @@ void InternalIgniteExplosion( UINT8 ubOwner, INT16 sX, INT16 sY, INT16 sZ, INT16
// No explosive but an attacker with HE ammo.
if ( !( Item[ usItem ].usItemClass & IC_EXPLOSV ) && ubOwner != NOBODY)
{
ExpParams.ubTypeID = (INT8)Explosive[AmmoTypes[MercPtrs[ubOwner]->inv[MercPtrs[ubOwner]->ubAttackingHand ].ubGunAmmoType].highExplosive].ubAnimationID;
ExpParams.ubTypeID = (INT8)Explosive[AmmoTypes[MercPtrs[ubOwner]->inv[MercPtrs[ubOwner]->ubAttackingHand ].ItemData.Gun.ubGunAmmoType].highExplosive].ubAnimationID;
// return;
}
else // just normal explosives should get here
@@ -1484,7 +1484,7 @@ BOOLEAN DishOutGasDamage( SOLDIERTYPE * pSoldier, EXPLOSIVETYPE * pExplosive, IN
}
bPosOfMask = FindGasMask(pSoldier);
if ( bPosOfMask == NO_SLOT || pSoldier->inv[ bPosOfMask ].bStatus[0] < USABLE )
if ( bPosOfMask == NO_SLOT || pSoldier->inv[ bPosOfMask ].ItemData.Generic.bStatus[0] < USABLE )
{
bPosOfMask = NO_SLOT;
}
@@ -1499,10 +1499,10 @@ BOOLEAN DishOutGasDamage( SOLDIERTYPE * pSoldier, EXPLOSIVETYPE * pExplosive, IN
if ( bPosOfMask != NO_SLOT )
{
if ( pSoldier->inv[ bPosOfMask ].bStatus[0] < GASMASK_MIN_STATUS )
if ( pSoldier->inv[ bPosOfMask ].ItemData.Generic.bStatus[0] < GASMASK_MIN_STATUS )
{
// GAS MASK reduces breath loss by its work% (it leaks if not at least 70%)
sBreathAmt = ( sBreathAmt * ( 100 - pSoldier->inv[ bPosOfMask ].bStatus[0] ) ) / 100;
sBreathAmt = ( sBreathAmt * ( 100 - pSoldier->inv[ bPosOfMask ].ItemData.Generic.bStatus[0] ) ) / 100;
if ( sBreathAmt > 500 )
{
// if at least 500 of breath damage got through
@@ -1516,12 +1516,12 @@ BOOLEAN DishOutGasDamage( SOLDIERTYPE * pSoldier, EXPLOSIVETYPE * pExplosive, IN
if ( sWoundAmt > 1 )
{
pSoldier->inv[ bPosOfMask ].bStatus[0] -= (INT8) Random( 4 );
sWoundAmt = ( sWoundAmt * ( 100 - pSoldier->inv[ bPosOfMask ].bStatus[0] ) ) / 100;
pSoldier->inv[ bPosOfMask ].ItemData.Generic.bStatus[0] -= (INT8) Random( 4 );
sWoundAmt = ( sWoundAmt * ( 100 - pSoldier->inv[ bPosOfMask ].ItemData.Generic.bStatus[0] ) ) / 100;
}
else if ( sWoundAmt == 1 )
{
pSoldier->inv[ bPosOfMask ].bStatus[0] -= (INT8) Random( 2 );
pSoldier->inv[ bPosOfMask ].ItemData.Generic.bStatus[0] -= (INT8) Random( 2 );
}
}
}
@@ -1532,12 +1532,12 @@ BOOLEAN DishOutGasDamage( SOLDIERTYPE * pSoldier, EXPLOSIVETYPE * pExplosive, IN
{
if ( sWoundAmt == 1 )
{
pSoldier->inv[ bPosOfMask ].bStatus[0] -= (INT8) Random( 2 );
pSoldier->inv[ bPosOfMask ].ItemData.Generic.bStatus[0] -= (INT8) Random( 2 );
}
else
{
// use up gas mask
pSoldier->inv[ bPosOfMask ].bStatus[0] -= (INT8) Random( 4 );
pSoldier->inv[ bPosOfMask ].ItemData.Generic.bStatus[0] -= (INT8) Random( 4 );
}
}
sWoundAmt = 0;
@@ -2468,10 +2468,10 @@ void ToggleActionItemsByFrequency( INT8 bFrequency )
if (gWorldBombs[uiWorldBombIndex].fExists)
{
pObj = &( gWorldItems[ gWorldBombs[uiWorldBombIndex].iItemIndex ].o );
if ( pObj->bDetonatorType == BOMB_REMOTE )
if ( pObj->ItemData.Trigger.bDetonatorType == BOMB_REMOTE )
{
// Found a remote bomb, so check to see if it has the same frequency
if (pObj->bFrequency == bFrequency)
if (pObj->ItemData.Trigger.BombTrigger.bFrequency == bFrequency)
{
// toggle its active flag
if (pObj->fFlags & OBJECT_DISABLED_BOMB)
@@ -2499,7 +2499,7 @@ void TogglePressureActionItemsInGridNo( INT16 sGridNo )
if ( gWorldBombs[uiWorldBombIndex].fExists && gWorldItems[ gWorldBombs[uiWorldBombIndex].iItemIndex ].sGridNo == sGridNo )
{
pObj = &( gWorldItems[ gWorldBombs[uiWorldBombIndex].iItemIndex ].o );
if ( pObj->bDetonatorType == BOMB_PRESSURE )
if ( pObj->ItemData.Trigger.bDetonatorType == BOMB_PRESSURE )
{
// Found a pressure item
// toggle its active flag
@@ -2560,7 +2560,7 @@ void PerformItemAction( INT16 sGridNo, OBJECTTYPE * pObj )
{
STRUCTURE * pStructure;
switch( pObj->bActionValue )
switch( pObj->ItemData.Trigger.bActionValue )
{
case ACTION_ITEM_OPEN_DOOR:
pStructure = FindStructure( sGridNo, STRUCTURE_ANYDOOR );
@@ -2890,7 +2890,7 @@ void PerformItemAction( INT16 sGridNo, OBJECTTYPE * pObj )
if ( sDoorSpot != NOWHERE && sTeleportSpot != NOWHERE )
{
// close the door...
DoorCloser.bActionValue = ACTION_ITEM_CLOSE_DOOR;
DoorCloser.ItemData.Trigger.bActionValue = ACTION_ITEM_CLOSE_DOOR;
PerformItemAction( sDoorSpot, &DoorCloser );
// have sex
@@ -2999,17 +2999,17 @@ void HandleExplosionQueue( void )
sGridNo = gWorldItems[ gWorldBombs[ uiWorldBombIndex ].iItemIndex ].sGridNo;
ubLevel = gWorldItems[ gWorldBombs[ uiWorldBombIndex ].iItemIndex ].ubLevel;
if (pObj->usItem == ACTION_ITEM && pObj->bActionValue != ACTION_ITEM_BLOW_UP)
if (pObj->usItem == ACTION_ITEM && pObj->ItemData.Trigger.bActionValue != ACTION_ITEM_BLOW_UP)
{
PerformItemAction( sGridNo, pObj );
}
else if ( pObj->usBombItem == TRIP_KLAXON )
else if ( pObj->ItemData.Trigger.usBombItem == TRIP_KLAXON )
{
PlayJA2Sample( KLAXON_ALARM, RATE_11025, SoundVolume( MIDVOLUME, sGridNo ), 5, SoundDir( sGridNo ) );
CallAvailableEnemiesTo( sGridNo );
//RemoveItemFromPool( sGridNo, gWorldBombs[ uiWorldBombIndex ].iItemIndex, 0 );
}
else if ( pObj->usBombItem == TRIP_FLARE )
else if ( pObj->ItemData.Trigger.usBombItem == TRIP_FLARE )
{
NewLightEffect( sGridNo, (UINT8)Explosive[pObj->usItem].ubDuration, (UINT8)Explosive[pObj->usItem].ubStartRadius );
RemoveItemFromPool( sGridNo, gWorldBombs[ uiWorldBombIndex ].iItemIndex, ubLevel );
@@ -3032,14 +3032,14 @@ void HandleExplosionQueue( void )
// BOOM!
// bomb objects only store the SIDE who placed the bomb! :-(
if ( pObj->ubBombOwner > 1 )
if ( pObj->ItemData.Trigger.ubBombOwner > 1 )
{
IgniteExplosion( (UINT8) (pObj->ubBombOwner - 2), CenterX( sGridNo ), CenterY( sGridNo ), 0, sGridNo, pObj->usBombItem, ubLevel );
IgniteExplosion( (UINT8) (pObj->ItemData.Trigger.ubBombOwner - 2), CenterX( sGridNo ), CenterY( sGridNo ), 0, sGridNo, pObj->ItemData.Trigger.usBombItem, ubLevel );
}
else
{
// pre-placed
IgniteExplosion( NOBODY, CenterX( sGridNo ), CenterY( sGridNo ), 0, sGridNo, pObj->usBombItem, ubLevel );
IgniteExplosion( NOBODY, CenterX( sGridNo ), CenterY( sGridNo ), 0, sGridNo, pObj->ItemData.Trigger.usBombItem, ubLevel );
}
}
@@ -3117,25 +3117,25 @@ void DecayBombTimers( void )
if (gWorldBombs[uiWorldBombIndex].fExists)
{
pObj = &( gWorldItems[ gWorldBombs[uiWorldBombIndex].iItemIndex ].o );
if ( pObj->bDetonatorType == BOMB_TIMED && !(pObj->fFlags & OBJECT_DISABLED_BOMB) )
if ( pObj->ItemData.Trigger.bDetonatorType == BOMB_TIMED && !(pObj->fFlags & OBJECT_DISABLED_BOMB) )
{
// Found a timed bomb, so decay its delay value and see if it goes off
pObj->bDelay--;
if (pObj->bDelay == 0)
pObj->ItemData.Trigger.BombTrigger.bDelay--;
if (pObj->ItemData.Trigger.BombTrigger.bDelay == 0)
{
// put this bomb on the queue
AddBombToQueue( uiWorldBombIndex, uiTimeStamp );
// ATE: CC black magic....
if ( pObj->ubBombOwner > 1 )
if ( pObj->ItemData.Trigger.ubBombOwner > 1 )
{
gubPersonToSetOffExplosions = (UINT8) (pObj->ubBombOwner - 2);
gubPersonToSetOffExplosions = (UINT8) (pObj->ItemData.Trigger.ubBombOwner - 2);
}
else
{
gubPersonToSetOffExplosions = NOBODY;
}
if (pObj->usItem != ACTION_ITEM || pObj->bActionValue == ACTION_ITEM_BLOW_UP)
if (pObj->usItem != ACTION_ITEM || pObj->ItemData.Trigger.bActionValue == ACTION_ITEM_BLOW_UP)
{
uiTimeStamp += BOMB_QUEUE_DELAY;
}
@@ -3159,17 +3159,17 @@ void SetOffBombsByFrequency( UINT8 ubID, INT8 bFrequency )
if (gWorldBombs[uiWorldBombIndex].fExists)
{
pObj = &( gWorldItems[ gWorldBombs[uiWorldBombIndex].iItemIndex ].o );
if ( pObj->bDetonatorType == BOMB_REMOTE && !(pObj->fFlags & OBJECT_DISABLED_BOMB) )
if ( pObj->ItemData.Trigger.bDetonatorType == BOMB_REMOTE && !(pObj->fFlags & OBJECT_DISABLED_BOMB) )
{
// Found a remote bomb, so check to see if it has the same frequency
if (pObj->bFrequency == bFrequency)
if (pObj->ItemData.Trigger.BombTrigger.bFrequency == bFrequency)
{
gubPersonToSetOffExplosions = ubID;
// put this bomb on the queue
AddBombToQueue( uiWorldBombIndex, uiTimeStamp );
if (pObj->usItem != ACTION_ITEM || pObj->bActionValue == ACTION_ITEM_BLOW_UP)
if (pObj->usItem != ACTION_ITEM || pObj->ItemData.Trigger.bActionValue == ACTION_ITEM_BLOW_UP)
{
uiTimeStamp += BOMB_QUEUE_DELAY;
}
@@ -3234,7 +3234,7 @@ BOOLEAN SetOffBombsInGridNo( UINT8 ubID, INT16 sGridNo, BOOLEAN fAllBombs, INT8
pObj = &( gWorldItems[ gWorldBombs[uiWorldBombIndex].iItemIndex ].o );
if (!(pObj->fFlags & OBJECT_DISABLED_BOMB))
{
if (fAllBombs || pObj->bDetonatorType == BOMB_PRESSURE)
if (fAllBombs || pObj->ItemData.Trigger.bDetonatorType == BOMB_PRESSURE)
{
// Snap: if we do set off our own trap (e.g. by trying to disarm it), we pay!
/*if (!fAllBombs && MercPtrs[ ubID ]->bTeam != gbPlayerNum )
@@ -3258,7 +3258,7 @@ BOOLEAN SetOffBombsInGridNo( UINT8 ubID, INT16 sGridNo, BOOLEAN fAllBombs, INT8
{
// send out a signal to detonate other bombs, rather than this which
// isn't a bomb but a trigger
SetOffBombsByFrequency( ubID, pObj->bFrequency );
SetOffBombsByFrequency( ubID, pObj->ItemData.Trigger.BombTrigger.bFrequency );
}
else
{
@@ -3266,12 +3266,12 @@ BOOLEAN SetOffBombsInGridNo( UINT8 ubID, INT16 sGridNo, BOOLEAN fAllBombs, INT8
// put this bomb on the queue
AddBombToQueue( uiWorldBombIndex, uiTimeStamp );
if (pObj->usItem != ACTION_ITEM || pObj->bActionValue == ACTION_ITEM_BLOW_UP)
if (pObj->usItem != ACTION_ITEM || pObj->ItemData.Trigger.bActionValue == ACTION_ITEM_BLOW_UP)
{
uiTimeStamp += BOMB_QUEUE_DELAY;
}
if ( pObj->usBombItem != NOTHING && Item[ pObj->usBombItem ].usItemClass & IC_EXPLOSV )
if ( pObj->ItemData.Trigger.usBombItem != NOTHING && Item[ pObj->ItemData.Trigger.usBombItem ].usItemClass & IC_EXPLOSV )
{
fFoundMine = TRUE;
}
@@ -3296,7 +3296,7 @@ void ActivateSwitchInGridNo( UINT8 ubID, INT16 sGridNo )
{
pObj = &( gWorldItems[ gWorldBombs[uiWorldBombIndex].iItemIndex ].o );
if ( pObj->usItem == SWITCH && ( !(pObj->fFlags & OBJECT_DISABLED_BOMB) ) && pObj->bDetonatorType == BOMB_SWITCH)
if ( pObj->usItem == SWITCH && ( !(pObj->fFlags & OBJECT_DISABLED_BOMB) ) && pObj->ItemData.Trigger.bDetonatorType == BOMB_SWITCH)
{
// send out a signal to detonate other bombs, rather than this which
// isn't a bomb but a trigger
@@ -3305,7 +3305,7 @@ void ActivateSwitchInGridNo( UINT8 ubID, INT16 sGridNo )
// No, not a good idea.
// gTacticalStatus.ubAttackBusyCount = 0;
SetOffBombsByFrequency( ubID, pObj->bFrequency );
SetOffBombsByFrequency( ubID, pObj->ItemData.Trigger.BombTrigger.bFrequency );
}
}
}
@@ -3631,7 +3631,7 @@ INT32 FindActiveTimedBomb( void )
if (gWorldBombs[uiWorldBombIndex].fExists)
{
pObj = &( gWorldItems[ gWorldBombs[uiWorldBombIndex].iItemIndex ].o );
if ( pObj->bDetonatorType == BOMB_TIMED && !(pObj->fFlags & OBJECT_DISABLED_BOMB) )
if ( pObj->ItemData.Trigger.bDetonatorType == BOMB_TIMED && !(pObj->fFlags & OBJECT_DISABLED_BOMB) )
{
return( gWorldBombs[uiWorldBombIndex].iItemIndex );
}
+4 -4
View File
@@ -2478,7 +2478,7 @@ void HandleArmedObjectImpact( REAL_OBJECT *pObject )
#ifdef TESTDUDEXPLOSIVES
if ( sZ != 0 || pObject->fInWater )
#else
if ( sZ != 0 || pObject->fInWater || ( pObj->bStatus[0] >= USABLE && ( PreRandom( 100 ) < (UINT32) pObj->bStatus[0] + PreRandom( 50 ) ) ) )
if ( sZ != 0 || pObject->fInWater || ( pObj->ItemData.Generic.bStatus[0] >= USABLE && ( PreRandom( 100 ) < (UINT32) pObj->ItemData.Generic.bStatus[0] + PreRandom( 50 ) ) ) )
#endif
{
fDoImpact = TRUE;
@@ -2488,7 +2488,7 @@ void HandleArmedObjectImpact( REAL_OBJECT *pObject )
#ifdef TESTDUDEXPLOSIVES
if ( 1 )
#else
if ( pObj->bStatus[0] >= USABLE && PreRandom(100) < (UINT32) pObj->bStatus[0] + PreRandom( 50 ) )
if ( pObj->ItemData.Generic.bStatus[0] >= USABLE && PreRandom(100) < (UINT32) pObj->ItemData.Generic.bStatus[0] + PreRandom( 50 ) )
#endif
{
iTrapped = PreRandom( 4 ) + 2;
@@ -2499,8 +2499,8 @@ void HandleArmedObjectImpact( REAL_OBJECT *pObject )
// Start timed bomb...
usFlags |= WORLD_ITEM_ARMED_BOMB;
pObj->bDetonatorType = BOMB_TIMED;
pObj->bDelay = (INT8)( 1 + PreRandom( 2 ) );
pObj->ItemData.Trigger.bDetonatorType = BOMB_TIMED;
pObj->ItemData.Trigger.BombTrigger.bDelay = (INT8)( 1 + PreRandom( 2 ) );
}
// ATE: If we have collided with roof last...
+4 -4
View File
@@ -180,9 +180,9 @@ void AddAllPits()
{
if( gWorldItems[ i ].o.usItem == ACTION_ITEM )
{
if( gWorldItems[ i ].o.bActionValue == ACTION_ITEM_SMALL_PIT )
if( gWorldItems[ i ].o.ItemData.Trigger.bActionValue == ACTION_ITEM_SMALL_PIT )
Add3X3Pit( gWorldItems[ i ].sGridNo );
else if( gWorldItems[ i ].o.bActionValue == ACTION_ITEM_LARGE_PIT )
else if( gWorldItems[ i ].o.ItemData.Trigger.bActionValue == ACTION_ITEM_LARGE_PIT )
Add5X5Pit( gWorldItems[ i ].sGridNo );
}
}
@@ -195,9 +195,9 @@ void RemoveAllPits()
{
if( gWorldItems[ i ].o.usItem == ACTION_ITEM )
{
if( gWorldItems[ i ].o.bActionValue == ACTION_ITEM_SMALL_PIT )
if( gWorldItems[ i ].o.ItemData.Trigger.bActionValue == ACTION_ITEM_SMALL_PIT )
Remove3X3Pit( gWorldItems[ i ].sGridNo );
else if( gWorldItems[ i ].o.bActionValue == ACTION_ITEM_LARGE_PIT )
else if( gWorldItems[ i ].o.ItemData.Trigger.bActionValue == ACTION_ITEM_LARGE_PIT )
Remove5X5Pit( gWorldItems[ i ].sGridNo );
}
}
+3 -1
View File
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="Windows-1252"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="8,00"
Version="8.00"
Name="ja2_2005Express"
ProjectGUID="{F44669E7-74AC-444B-B75F-F16F4B9F0265}"
RootNamespace="ja2_2005Express"
@@ -146,6 +146,8 @@
OutputFile="$(OutDir)\ja2_rel_1202.exe"
LinkIncremental="1"
GenerateDebugInformation="true"
GenerateMapFile="true"
MapFileName="$(TargetDir)$(TargetName).map"
SubSystem="2"
OptimizeReferences="2"
EnableCOMDATFolding="2"