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->usItem == SWITCH )
{ {
if( pItem->bFrequency == PANIC_FREQUENCY ) if( pItem->ItemData.Trigger.BombTrigger.bFrequency == PANIC_FREQUENCY )
swprintf( szItemName, L"Panic Trigger1" ); 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" ); 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" ); swprintf( szItemName, L"Panic Trigger3" );
else else
swprintf( szItemName, L"Trigger%d", pItem->bFrequency - 50 ); swprintf( szItemName, L"Trigger%d", pItem->ItemData.Trigger.BombTrigger.bFrequency - 50 );
} }
else else
{ //action item { //action item
if( pItem->bDetonatorType == BOMB_PRESSURE ) if( pItem->ItemData.Trigger.bDetonatorType == BOMB_PRESSURE )
swprintf( szItemName, L"Pressure Action" ); 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" ); 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" ); 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" ); swprintf( szItemName, L"Panic Action3" );
else 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 ) 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 else
{ {
+37 -37
View File
@@ -844,11 +844,11 @@ void AddSelectedItemToWorld( INT16 sGridNo )
case MONEY: case MONEY:
case SILVER: case SILVER:
case GOLD: case GOLD:
tempObject.bStatus[0] = 100; tempObject.ItemData.Money.bMoneyStatus = 100;
tempObject.uiMoneyAmount = 100 + Random( 19901 ); tempObject.ItemData.Money.uiMoneyAmount = 100 + Random( 19901 );
break; break;
case OWNERSHIP: case OWNERSHIP:
tempObject.ubOwnerProfile = NO_PROFILE; tempObject.ItemData.Owner.ubOwnerProfile = NO_PROFILE;
bVisibility = BURIED; bVisibility = BURIED;
break; break;
case SWITCH: case SWITCH:
@@ -857,39 +857,39 @@ void AddSelectedItemToWorld( INT16 sGridNo )
return; return;
} }
bVisibility = BURIED; bVisibility = BURIED;
tempObject.bStatus[0] = 100; tempObject.ItemData.Trigger.bBombStatus = 100;
tempObject.ubBombOwner = 1; tempObject.ItemData.Trigger.ubBombOwner = 1;
if( eInfo.sSelItemIndex < 2 ) if( eInfo.sSelItemIndex < 2 )
tempObject.bFrequency = PANIC_FREQUENCY; tempObject.ItemData.Trigger.BombTrigger.bFrequency = PANIC_FREQUENCY;
else if( eInfo.sSelItemIndex < 4 ) else if( eInfo.sSelItemIndex < 4 )
tempObject.bFrequency = PANIC_FREQUENCY_2; tempObject.ItemData.Trigger.BombTrigger.bFrequency = PANIC_FREQUENCY_2;
else if( eInfo.sSelItemIndex < 6 ) else if( eInfo.sSelItemIndex < 6 )
tempObject.bFrequency = PANIC_FREQUENCY_3; tempObject.ItemData.Trigger.BombTrigger.bFrequency = PANIC_FREQUENCY_3;
else 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; usFlags |= WORLD_ITEM_ARMED_BOMB;
break; break;
case ACTION_ITEM: case ACTION_ITEM:
bVisibility = BURIED; bVisibility = BURIED;
tempObject.bStatus[0] = 100; tempObject.ItemData.Trigger.bBombStatus = 100;
tempObject.ubBombOwner = 1; tempObject.ItemData.Trigger.ubBombOwner = 1;
tempObject.bTrap = gbDefaultBombTrapLevel; tempObject.bTrap = gbDefaultBombTrapLevel;
if( eInfo.sSelItemIndex < PRESSURE_ACTION_ID ) if( eInfo.sSelItemIndex < PRESSURE_ACTION_ID )
{ {
tempObject.bDetonatorType = BOMB_REMOTE; tempObject.ItemData.Trigger.bDetonatorType = BOMB_REMOTE;
if( eInfo.sSelItemIndex < 2 ) if( eInfo.sSelItemIndex < 2 )
tempObject.bFrequency = PANIC_FREQUENCY; tempObject.ItemData.Trigger.BombTrigger.bFrequency = PANIC_FREQUENCY;
else if( eInfo.sSelItemIndex < 4 ) else if( eInfo.sSelItemIndex < 4 )
tempObject.bFrequency = PANIC_FREQUENCY_2; tempObject.ItemData.Trigger.BombTrigger.bFrequency = PANIC_FREQUENCY_2;
else if( eInfo.sSelItemIndex < 6 ) else if( eInfo.sSelItemIndex < 6 )
tempObject.bFrequency = PANIC_FREQUENCY_3; tempObject.ItemData.Trigger.BombTrigger.bFrequency = PANIC_FREQUENCY_3;
else 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 else
{ {
tempObject.bDetonatorType = BOMB_PRESSURE; tempObject.ItemData.Trigger.bDetonatorType = BOMB_PRESSURE;
tempObject.bDelay = 0; tempObject.ItemData.Trigger.BombTrigger.bDelay = 0;
} }
ChangeActionItem( &tempObject, gbActionItemIndex ); ChangeActionItem( &tempObject, gbActionItemIndex );
tempObject.fFlags |= OBJECT_ARMED_BOMB; tempObject.fFlags |= OBJECT_ARMED_BOMB;
@@ -916,26 +916,26 @@ void AddSelectedItemToWorld( INT16 sGridNo )
{ {
if (Random( 2 )) if (Random( 2 ))
{ {
pObject->ubShotsLeft[0] = Magazine[ pItem->ubClassIndex ].ubMagSize; pObject->ItemData.Ammo.ubShotsLeft[0] = Magazine[ pItem->ubClassIndex ].ubMagSize;
} }
else else
{ {
pObject->ubShotsLeft[0] = (UINT8) Random( Magazine[ pItem->ubClassIndex ].ubMagSize ); pObject->ItemData.Ammo.ubShotsLeft[0] = (UINT8) Random( Magazine[ pItem->ubClassIndex ].ubMagSize );
} }
} }
else else
{ {
pObject->bStatus[0] = (INT8)(70 + Random( 26 )); pObject->ItemData.Generic.bStatus[0] = (INT8)(70 + Random( 26 ));
} }
if( pItem->usItemClass & IC_GUN ) if( pItem->usItemClass & IC_GUN )
{ {
if ( pObject->usItem == ROCKET_LAUNCHER ) if ( pObject->usItem == ROCKET_LAUNCHER )
{ {
pObject->ubGunShotsLeft = 1; pObject->ItemData.Gun.ubGunShotsLeft = 1;
} }
else 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 //remove the item
if( gWorldItems[ gpItemPool->iItemIndex ].o.usItem == ACTION_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 ); 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 ); Remove5X5Pit( gWorldItems[ gpItemPool->iItemIndex ].sGridNo );
} }
if( gpEditingItemPool == gpItemPool ) if( gpEditingItemPool == gpItemPool )
@@ -1295,7 +1295,7 @@ void SelectNextKeyOfType( UINT8 ubKeyID )
while( gpItemPool ) while( gpItemPool )
{ {
pObject = &gWorldItems[ gpItemPool->iItemIndex ].o; 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 ); SpecifyItemToEdit( pObject, gWorldItems[ gpItemPool->iItemIndex ].sGridNo );
CenterScreenAtMapIndex( gsItemGridNo ); CenterScreenAtMapIndex( gsItemGridNo );
@@ -1314,7 +1314,7 @@ void SelectNextKeyOfType( UINT8 ubKeyID )
while( gpItemPool ) while( gpItemPool )
{ {
pObject = &gWorldItems[ gpItemPool->iItemIndex ].o; 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 ); SpecifyItemToEdit( pObject, gWorldItems[ gpItemPool->iItemIndex ].sGridNo );
CenterScreenAtMapIndex( gsItemGridNo ); CenterScreenAtMapIndex( gsItemGridNo );
@@ -1332,7 +1332,7 @@ void SelectNextKeyOfType( UINT8 ubKeyID )
while( gpItemPool ) while( gpItemPool )
{ {
pObject = &gWorldItems[ gpItemPool->iItemIndex ].o; 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 ); SpecifyItemToEdit( pObject, gWorldItems[ gpItemPool->iItemIndex ].sGridNo );
CenterScreenAtMapIndex( gsItemGridNo ); CenterScreenAtMapIndex( gsItemGridNo );
@@ -1359,7 +1359,7 @@ void SelectNextTriggerWithFrequency( UINT16 usItem, INT8 bFrequency )
while( gpItemPool ) while( gpItemPool )
{ {
pObject = &gWorldItems[ gpItemPool->iItemIndex ].o; 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 ); SpecifyItemToEdit( pObject, gWorldItems[ gpItemPool->iItemIndex ].sGridNo );
CenterScreenAtMapIndex( gsItemGridNo ); CenterScreenAtMapIndex( gsItemGridNo );
@@ -1378,7 +1378,7 @@ void SelectNextTriggerWithFrequency( UINT16 usItem, INT8 bFrequency )
while( gpItemPool ) while( gpItemPool )
{ {
pObject = &gWorldItems[ gpItemPool->iItemIndex ].o; 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 ); SpecifyItemToEdit( pObject, gWorldItems[ gpItemPool->iItemIndex ].sGridNo );
CenterScreenAtMapIndex( gsItemGridNo ); CenterScreenAtMapIndex( gsItemGridNo );
@@ -1396,7 +1396,7 @@ void SelectNextTriggerWithFrequency( UINT16 usItem, INT8 bFrequency )
while( gpItemPool ) while( gpItemPool )
{ {
pObject = &gWorldItems[ gpItemPool->iItemIndex ].o; 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 ); SpecifyItemToEdit( pObject, gWorldItems[ gpItemPool->iItemIndex ].sGridNo );
CenterScreenAtMapIndex( gsItemGridNo ); CenterScreenAtMapIndex( gsItemGridNo );
@@ -1423,7 +1423,7 @@ void SelectNextPressureAction()
while( gpItemPool ) while( gpItemPool )
{ {
pObject = &gWorldItems[ gpItemPool->iItemIndex ].o; 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 ); SpecifyItemToEdit( pObject, gWorldItems[ gpItemPool->iItemIndex ].sGridNo );
CenterScreenAtMapIndex( gsItemGridNo ); CenterScreenAtMapIndex( gsItemGridNo );
@@ -1442,7 +1442,7 @@ void SelectNextPressureAction()
while( gpItemPool ) while( gpItemPool )
{ {
pObject = &gWorldItems[ gpItemPool->iItemIndex ].o; 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 ); SpecifyItemToEdit( pObject, gWorldItems[ gpItemPool->iItemIndex ].sGridNo );
CenterScreenAtMapIndex( gsItemGridNo ); CenterScreenAtMapIndex( gsItemGridNo );
@@ -1460,7 +1460,7 @@ void SelectNextPressureAction()
while( gpItemPool ) while( gpItemPool )
{ {
pObject = &gWorldItems[ gpItemPool->iItemIndex ].o; 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 ); SpecifyItemToEdit( pObject, gWorldItems[ gpItemPool->iItemIndex ].sGridNo );
CenterScreenAtMapIndex( gsItemGridNo ); CenterScreenAtMapIndex( gsItemGridNo );
@@ -1508,7 +1508,7 @@ UINT16 CountNumberOfItemsWithFrequency( UINT16 usItem, INT8 bFrequency )
while( pItemPool ) while( pItemPool )
{ {
if( gWorldItems[ pItemPool->iItemIndex ].o.usItem == usItem && if( gWorldItems[ pItemPool->iItemIndex ].o.usItem == usItem &&
gWorldItems[ pItemPool->iItemIndex ].o.bFrequency == bFrequency ) gWorldItems[ pItemPool->iItemIndex ].o.ItemData.Trigger.BombTrigger.bFrequency == bFrequency )
{ {
num++; num++;
} }
@@ -1531,7 +1531,7 @@ UINT16 CountNumberOfPressureActionsInWorld()
while( pItemPool ) while( pItemPool )
{ {
if( gWorldItems[ pItemPool->iItemIndex ].o.usItem == ACTION_ITEM && 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++; num++;
} }
@@ -1592,7 +1592,7 @@ UINT16 CountNumberOfKeysOfTypeInWorld( UINT8 ubKeyID )
{ {
if( Item[ gWorldItems[ pItemPool->iItemIndex ].o.usItem ].usItemClass == IC_KEY ) 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++; num++;
} }
+1 -1
View File
@@ -2767,7 +2767,7 @@ void AddNewItemToSelectedMercsInventory( BOOLEAN fCreate )
//randomize the status on non-ammo items. //randomize the status on non-ammo items.
if( !(Item[ gpSelected->pDetailedPlacement->Inv[ gbMercSlotTypes[ gbCurrSelect ] ].usItem ].usItemClass & IC_AMMO) ) 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 ) if( gusMercsNewItemIndex )
{ {
+93 -93
View File
@@ -81,9 +81,9 @@ const STR16 GetActionItemName( OBJECTTYPE *pItem )
{ {
if( !pItem || pItem->usItem != ACTION_ITEM ) if( !pItem || pItem->usItem != ACTION_ITEM )
return NULL; 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_OPEN_DOOR: return gszActionItemDesc[ ACTIONITEM_OPEN ];
case ACTION_ITEM_CLOSE_DOOR: return gszActionItemDesc[ ACTIONITEM_CLOSE ]; case ACTION_ITEM_CLOSE_DOOR: return gszActionItemDesc[ ACTIONITEM_CLOSE ];
@@ -111,7 +111,7 @@ const STR16 GetActionItemName( OBJECTTYPE *pItem )
default: return NULL; default: return NULL;
} }
} }
else switch( pItem->usBombItem ) else switch( pItem->ItemData.Trigger.usBombItem )
{ {
case STUN_GRENADE: return gszActionItemDesc[ ACTIONITEM_STUN ]; case STUN_GRENADE: return gszActionItemDesc[ ACTIONITEM_STUN ];
case SMOKE_GRENADE: return gszActionItemDesc[ ACTIONITEM_SMOKE ]; case SMOKE_GRENADE: return gszActionItemDesc[ ACTIONITEM_SMOKE ];
@@ -535,7 +535,7 @@ void UpdateItemStatsPanel()
case EDITING_TRIGGERS: case EDITING_TRIGGERS:
mprintf( iScreenWidthOffset + 512, 2 * iScreenHeightOffset + 369, L"Trap Level"); mprintf( iScreenWidthOffset + 512, 2 * iScreenHeightOffset + 369, L"Trap Level");
mprintf( iScreenWidthOffset + 512, 2 * iScreenHeightOffset + 389, L"Tolerance" ); 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" ); mprintf( iScreenWidthOffset + 500, 2 * iScreenHeightOffset + 407, L"Alarm Trigger" );
break; break;
} }
@@ -644,9 +644,9 @@ void SetupGunGUI()
CHAR16 str[20]; CHAR16 str[20];
INT16 yp; INT16 yp;
memset( gfAttachment, 0, NUM_ATTACHMENT_BUTTONS ); 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 ); 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 ); AddTextInputField( iScreenWidthOffset + 485, 2 * iScreenHeightOffset + 400, 25, 15, MSYS_PRIORITY_NORMAL, str, 3, INPUTTYPE_NUMERICSTRICT );
swprintf( str, L"%d", gpItem->bTrap ); swprintf( str, L"%d", gpItem->bTrap );
AddTextInputField( iScreenWidthOffset + 485, 2 * iScreenHeightOffset + 420, 25, 15, MSYS_PRIORITY_NORMAL, str, 2, INPUTTYPE_NUMERICSTRICT ); 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 ); i = 20 + Random( 81 );
else else
i = min( i, 100 ); i = min( i, 100 );
gpItem->bGunStatus = (INT8)i; gpItem->ItemData.Gun.bGunStatus = (INT8)i;
SetInputFieldStringWithNumericStrictValue( 1, i ); SetInputFieldStringWithNumericStrictValue( 1, i );
//Update the ammo //Update the ammo
i = GetNumericStrictValueFromField( 2 ); i = GetNumericStrictValueFromField( 2 );
@@ -769,7 +769,7 @@ void ExtractAndUpdateGunGUI()
i = Random( 1 + Weapon[ gpItem->usItem ].ubMagSize ); i = Random( 1 + Weapon[ gpItem->usItem ].ubMagSize );
else else
i = min( i, Weapon[ gpItem->usItem ].ubMagSize ); i = min( i, Weapon[ gpItem->usItem ].ubMagSize );
gpItem->ubGunShotsLeft = (UINT8)i; gpItem->ItemData.Gun.ubGunShotsLeft = (UINT8)i;
SetInputFieldStringWithNumericStrictValue( 2, i ); SetInputFieldStringWithNumericStrictValue( 2, i );
//Update the trap level //Update the trap level
i = GetNumericStrictValueFromField( 3 ); i = GetNumericStrictValueFromField( 3 );
@@ -833,7 +833,7 @@ void ExtractAndUpdateAmmoGUI()
void SetupArmourGUI() void SetupArmourGUI()
{ {
CHAR16 str[20]; 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 ); AddTextInputField( iScreenWidthOffset + 485, 2 * iScreenHeightOffset + 380, 25, 15, MSYS_PRIORITY_NORMAL, str, 3, INPUTTYPE_NUMERICSTRICT );
swprintf( str, L"%d", gpItem->bTrap ); swprintf( str, L"%d", gpItem->bTrap );
AddTextInputField( iScreenWidthOffset + 485, 2 * iScreenHeightOffset + 400, 25, 15, MSYS_PRIORITY_NORMAL, str, 2, INPUTTYPE_NUMERICSTRICT ); 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 ); i = 20 + Random( 81 );
else else
i = min( i, 100 ); i = min( i, 100 );
gpItem->bStatus[0] = (INT8)i; gpItem->ItemData.Generic.bStatus[0] = (INT8)i;
SetInputFieldStringWithNumericStrictValue( 1, i ); SetInputFieldStringWithNumericStrictValue( 1, i );
//Update the trap level //Update the trap level
i = GetNumericStrictValueFromField( 2 ); i = GetNumericStrictValueFromField( 2 );
@@ -894,7 +894,7 @@ void ExtractAndUpdateArmourGUI()
void SetupEquipGUI() void SetupEquipGUI()
{ {
CHAR16 str[20]; 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 ); AddTextInputField( iScreenWidthOffset + 485, 2 * iScreenHeightOffset + 380, 25, 15, MSYS_PRIORITY_NORMAL, str, 3, INPUTTYPE_NUMERICSTRICT );
swprintf( str, L"%d", gpItem->bTrap ); swprintf( str, L"%d", gpItem->bTrap );
AddTextInputField( iScreenWidthOffset + 485, 2 * iScreenHeightOffset + 400, 25, 15, MSYS_PRIORITY_NORMAL, str, 2, INPUTTYPE_NUMERICSTRICT ); 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 ); i = 20 + Random( 81 );
else else
i = min( i, 100 ); i = min( i, 100 );
gpItem->bStatus[0] = (INT8)i; gpItem->ItemData.Generic.bStatus[0] = (INT8)i;
SetInputFieldStringWithNumericStrictValue( 1, i ); SetInputFieldStringWithNumericStrictValue( 1, i );
//Update the trap level //Update the trap level
i = GetNumericStrictValueFromField( 2 ); i = GetNumericStrictValueFromField( 2 );
@@ -939,7 +939,7 @@ void SetupExplosivesGUI()
{ {
CHAR16 str[20]; CHAR16 str[20];
INT16 yp; 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 ); AddTextInputField( iScreenWidthOffset + 485, 2 * iScreenHeightOffset + 380, 25, 15, MSYS_PRIORITY_NORMAL, str, 3, INPUTTYPE_NUMERICSTRICT );
swprintf( str, L"%d", gpItem->ubNumberOfObjects ); swprintf( str, L"%d", gpItem->ubNumberOfObjects );
AddTextInputField( iScreenWidthOffset + 485, 2 * iScreenHeightOffset + 400, 25, 15, MSYS_PRIORITY_NORMAL, str, 1, INPUTTYPE_NUMERICSTRICT ); 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 ); i = 20 + Random( 81 );
else else
i = min( i, 100 ); i = min( i, 100 );
gpItem->bStatus[0] = (INT8)i; gpItem->ItemData.Generic.bStatus[0] = (INT8)i;
SetInputFieldStringWithNumericStrictValue( 1, i ); SetInputFieldStringWithNumericStrictValue( 1, i );
//Update the quantity //Update the quantity
if( Item[ gpItem->usItem ].ubPerPocket > 1 ) if( Item[ gpItem->usItem ].ubPerPocket > 1 )
@@ -1001,7 +1001,7 @@ void ExtractAndUpdateExplosivesGUI()
i = max( 1, min( i, Item[ gpItem->usItem ].ubPerPocket ) ); i = max( 1, min( i, Item[ gpItem->usItem ].ubPerPocket ) );
gpItem->ubNumberOfObjects = (UINT8)i; gpItem->ubNumberOfObjects = (UINT8)i;
SetInputFieldStringWithNumericStrictValue( 2, 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 //Update the trap level
i = GetNumericStrictValueFromField( 3 ); i = GetNumericStrictValueFromField( 3 );
@@ -1020,7 +1020,7 @@ void ExtractAndUpdateExplosivesGUI()
void SetupMoneyGUI() void SetupMoneyGUI()
{ {
CHAR16 str[20]; 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 ); AddTextInputField( iScreenWidthOffset + 485, 2 * iScreenHeightOffset + 380, 45, 15, MSYS_PRIORITY_NORMAL, str, 5, INPUTTYPE_NUMERICSTRICT );
if( gpEditingItemPool ) if( gpEditingItemPool )
{ {
@@ -1038,8 +1038,8 @@ void ExtractAndUpdateMoneyGUI()
i = Random( 20000 ); i = Random( 20000 );
else else
i = max( 1, min( i, 20000 ) ); i = max( 1, min( i, 20000 ) );
gpItem->uiMoneyAmount = i; gpItem->ItemData.Money.uiMoneyAmount = i;
gpItem->bStatus[0] = 100; gpItem->ItemData.Money.bMoneyStatus = 100;
SetInputFieldStringWithNumericStrictValue( 1, i ); SetInputFieldStringWithNumericStrictValue( 1, i );
if( gpEditingItemPool ) if( gpEditingItemPool )
{ {
@@ -1058,10 +1058,10 @@ void RemoveMoneyGUI()
void SetupOwnershipGUI() void SetupOwnershipGUI()
{ {
CHAR16 str[20]; 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 ); AddTextInputField( iScreenWidthOffset + 485, 2 * iScreenHeightOffset + 380, 25, 15, MSYS_PRIORITY_NORMAL, str, 3, INPUTTYPE_NUMERICSTRICT );
giOwnershipGroupButton = 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 ); 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 ) void SetOwnershipGroup( UINT8 ubNewGroup )
{ {
gpItem->ubOwnerCivGroup = ubNewGroup; gpItem->ItemData.Owner.ubOwnerCivGroup = ubNewGroup;
SpecifyButtonText( giOwnershipGroupButton, gszCivGroupNames[ ubNewGroup ] ); SpecifyButtonText( giOwnershipGroupButton, gszCivGroupNames[ ubNewGroup ] );
} }
@@ -1088,7 +1088,7 @@ void ExtractAndUpdateOwnershipGUI()
i = Random( 0 ); i = Random( 0 );
else else
i = max( 0, min( i, 255 ) ); i = max( 0, min( i, 255 ) );
gpItem->ubOwnerProfile = (UINT8)i; gpItem->ItemData.Owner.ubOwnerProfile = (UINT8)i;
SetInputFieldStringWithNumericStrictValue( 1, i ); SetInputFieldStringWithNumericStrictValue( 1, i );
} }
@@ -1131,7 +1131,7 @@ void SetupActionItemsGUI()
{ {
CHAR16 str[4]; CHAR16 str[4];
STR16 pStr; 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 ); AddTextInputField( iScreenWidthOffset + 485, 2 * iScreenHeightOffset + 365, 25, 15, MSYS_PRIORITY_NORMAL, str, 3, INPUTTYPE_NUMERICSTRICT );
swprintf( str, L"%d", gpItem->bTrap ); swprintf( str, L"%d", gpItem->bTrap );
AddTextInputField( iScreenWidthOffset + 485, 2 * iScreenHeightOffset + 385, 25, 15, MSYS_PRIORITY_NORMAL, str, 2, INPUTTYPE_NUMERICSTRICT ); 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 ); i = 20 + Random( 81 );
else else
i = min( i, 100 ); i = min( i, 100 );
gpItem->bStatus[0] = (INT8)i; gpItem->ItemData.Generic.bStatus[0] = (INT8)i;
SetInputFieldStringWithNumericStrictValue( 1, i ); SetInputFieldStringWithNumericStrictValue( 1, i );
//Update the trap level //Update the trap level
i = GetNumericStrictValueFromField( 2 ); i = GetNumericStrictValueFromField( 2 );
@@ -1199,13 +1199,13 @@ void SetupTriggersGUI()
CHAR16 str[4]; CHAR16 str[4];
swprintf( str, L"%d", gpItem->bTrap ); swprintf( str, L"%d", gpItem->bTrap );
AddTextInputField( iScreenWidthOffset + 485, 2 * iScreenHeightOffset + 365, 25, 15, MSYS_PRIORITY_NORMAL, str, 3, INPUTTYPE_NUMERICSTRICT ); 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 ); AddTextInputField( iScreenWidthOffset + 485, 2 * iScreenHeightOffset + 385, 25, 15, MSYS_PRIORITY_NORMAL, str, 3, INPUTTYPE_NUMERICSTRICT );
if( gpEditingItemPool ) if( gpEditingItemPool )
{ {
swprintf( str, L"%d", 100 - gWorldItems[ gpEditingItemPool->iItemIndex ].ubNonExistChance ); swprintf( str, L"%d", 100 - gWorldItems[ gpEditingItemPool->iItemIndex ].ubNonExistChance );
AddTextInputField( iScreenWidthOffset + 485, 2 * iScreenHeightOffset + 440, 25, 15, MSYS_PRIORITY_NORMAL, str, 3, INPUTTYPE_NUMERICSTRICT ); 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 = giAlarmTriggerButton =
CreateCheckBoxButton( iScreenWidthOffset + 485, 2 * iScreenHeightOffset + 405, "EDITOR//smCheckBox.sti", MSYS_PRIORITY_NORMAL, AlarmTriggerCheckboxCallback ); CreateCheckBoxButton( iScreenWidthOffset + 485, 2 * iScreenHeightOffset + 405, "EDITOR//smCheckBox.sti", MSYS_PRIORITY_NORMAL, AlarmTriggerCheckboxCallback );
@@ -1227,7 +1227,7 @@ void ExtractAndUpdateTriggersGUI()
i = GetNumericStrictValueFromField( 2 ); i = GetNumericStrictValueFromField( 2 );
i = ( i == -1 ) ? 0 : max( 0, min( i, 99 ) ); i = ( i == -1 ) ? 0 : max( 0, min( i, 99 ) );
gpItem->ubTolerance = (UINT8)i; gpItem->ItemData.Trigger.Area.ubTolerance = (UINT8)i;
SetInputFieldStringWithNumericStrictValue( 2, i ); SetInputFieldStringWithNumericStrictValue( 2, i );
if( gpEditingItemPool ) if( gpEditingItemPool )
@@ -1241,7 +1241,7 @@ void ExtractAndUpdateTriggersGUI()
void RemoveTriggersGUI() 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 ) if( giAlarmTriggerButton != -1 )
{ {
@@ -1276,7 +1276,7 @@ void ToggleAttachment( GUI_BUTTON *btn, INT32 reason )
{ {
gfAttachment[ i ] = TRUE; gfAttachment[ i ] = TRUE;
btn->uiFlags |= BUTTON_CLICKED_ON; btn->uiFlags |= BUTTON_CLICKED_ON;
CreateItem( usAttachment, gpItem->bGunStatus, &temp ); CreateItem( usAttachment, gpItem->ItemData.Gun.bGunStatus, &temp );
AttachObject( NULL, gpItem, &temp ); AttachObject( NULL, gpItem, &temp );
} }
else else
@@ -1303,7 +1303,7 @@ void ToggleCeramicPlates( GUI_BUTTON *btn, INT32 reason )
if( gfCeramicPlates ) if( gfCeramicPlates )
{ {
btn->uiFlags |= BUTTON_CLICKED_ON; 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 ); AttachObject( NULL, gpItem, &temp );
} }
else else
@@ -1326,7 +1326,7 @@ void ToggleDetonator( GUI_BUTTON *btn, INT32 reason )
{ {
gfDetonator = TRUE; gfDetonator = TRUE;
btn->uiFlags |= BUTTON_CLICKED_ON; btn->uiFlags |= BUTTON_CLICKED_ON;
CreateItem( DETONATOR, gpItem->bStatus[0], &temp ); CreateItem( DETONATOR, gpItem->ItemData.Generic.bStatus[0], &temp );
AttachObject( NULL, gpItem, &temp ); AttachObject( NULL, gpItem, &temp );
} }
else else
@@ -1352,133 +1352,133 @@ void ActionItemCallback( GUI_BUTTON *btn, INT32 reason )
void ChangeActionItem( OBJECTTYPE *pItem, INT8 bActionItemIndex ) void ChangeActionItem( OBJECTTYPE *pItem, INT8 bActionItemIndex )
{ {
pItem->usItem = ACTION_ITEM; pItem->usItem = ACTION_ITEM;
pItem->bActionValue = ACTION_ITEM_BLOW_UP; pItem->ItemData.Trigger.bActionValue = ACTION_ITEM_BLOW_UP;
switch( bActionItemIndex ) switch( bActionItemIndex )
{ {
case ACTIONITEM_TRIP_KLAXON: case ACTIONITEM_TRIP_KLAXON:
pItem->usBombItem = TRIP_KLAXON; pItem->ItemData.Trigger.usBombItem = TRIP_KLAXON;
break; break;
case ACTIONITEM_FLARE: case ACTIONITEM_FLARE:
pItem->usBombItem = TRIP_FLARE; pItem->ItemData.Trigger.usBombItem = TRIP_FLARE;
break; break;
case ACTIONITEM_TEARGAS: case ACTIONITEM_TEARGAS:
pItem->usBombItem = TEARGAS_GRENADE; pItem->ItemData.Trigger.usBombItem = TEARGAS_GRENADE;
break; break;
case ACTIONITEM_STUN: case ACTIONITEM_STUN:
pItem->usBombItem = STUN_GRENADE; pItem->ItemData.Trigger.usBombItem = STUN_GRENADE;
break; break;
case ACTIONITEM_SMOKE: case ACTIONITEM_SMOKE:
pItem->usBombItem = SMOKE_GRENADE; pItem->ItemData.Trigger.usBombItem = SMOKE_GRENADE;
break; break;
case ACTIONITEM_MUSTARD: case ACTIONITEM_MUSTARD:
pItem->usBombItem = MUSTARD_GRENADE; pItem->ItemData.Trigger.usBombItem = MUSTARD_GRENADE;
break; break;
case ACTIONITEM_MINE: case ACTIONITEM_MINE:
pItem->usBombItem = MINE; pItem->ItemData.Trigger.usBombItem = MINE;
break; break;
case ACTIONITEM_OPEN: case ACTIONITEM_OPEN:
pItem->usBombItem = NOTHING; pItem->ItemData.Trigger.usBombItem = NOTHING;
pItem->bActionValue = ACTION_ITEM_OPEN_DOOR; pItem->ItemData.Trigger.bActionValue = ACTION_ITEM_OPEN_DOOR;
break; break;
case ACTIONITEM_CLOSE: case ACTIONITEM_CLOSE:
pItem->usBombItem = NOTHING; pItem->ItemData.Trigger.usBombItem = NOTHING;
pItem->bActionValue = ACTION_ITEM_CLOSE_DOOR; pItem->ItemData.Trigger.bActionValue = ACTION_ITEM_CLOSE_DOOR;
break; break;
case ACTIONITEM_UNLOCK_DOOR: case ACTIONITEM_UNLOCK_DOOR:
pItem->usBombItem = NOTHING; pItem->ItemData.Trigger.usBombItem = NOTHING;
pItem->bActionValue = ACTION_ITEM_UNLOCK_DOOR; pItem->ItemData.Trigger.bActionValue = ACTION_ITEM_UNLOCK_DOOR;
break; break;
case ACTIONITEM_TOGGLE_LOCK: case ACTIONITEM_TOGGLE_LOCK:
pItem->usBombItem = NOTHING; pItem->ItemData.Trigger.usBombItem = NOTHING;
pItem->bActionValue = ACTION_ITEM_TOGGLE_LOCK; pItem->ItemData.Trigger.bActionValue = ACTION_ITEM_TOGGLE_LOCK;
break; break;
case ACTIONITEM_UNTRAP_DOOR: case ACTIONITEM_UNTRAP_DOOR:
pItem->usBombItem = NOTHING; pItem->ItemData.Trigger.usBombItem = NOTHING;
pItem->bActionValue = ACTION_ITEM_UNTRAP_DOOR; pItem->ItemData.Trigger.bActionValue = ACTION_ITEM_UNTRAP_DOOR;
break; break;
case ACTIONITEM_TOGGLE_PRESSURE_ITEMS: case ACTIONITEM_TOGGLE_PRESSURE_ITEMS:
pItem->usBombItem = NOTHING; pItem->ItemData.Trigger.usBombItem = NOTHING;
pItem->bActionValue = ACTION_ITEM_TOGGLE_PRESSURE_ITEMS; pItem->ItemData.Trigger.bActionValue = ACTION_ITEM_TOGGLE_PRESSURE_ITEMS;
break; break;
case ACTIONITEM_SMPIT: case ACTIONITEM_SMPIT:
pItem->usBombItem = NOTHING; pItem->ItemData.Trigger.usBombItem = NOTHING;
pItem->bActionValue = ACTION_ITEM_SMALL_PIT; pItem->ItemData.Trigger.bActionValue = ACTION_ITEM_SMALL_PIT;
break; break;
case ACTIONITEM_LGPIT: case ACTIONITEM_LGPIT:
pItem->usBombItem = NOTHING; pItem->ItemData.Trigger.usBombItem = NOTHING;
pItem->bActionValue = ACTION_ITEM_LARGE_PIT; pItem->ItemData.Trigger.bActionValue = ACTION_ITEM_LARGE_PIT;
break; break;
case ACTIONITEM_TOGGLE_DOOR: case ACTIONITEM_TOGGLE_DOOR:
pItem->usBombItem = NOTHING; pItem->ItemData.Trigger.usBombItem = NOTHING;
pItem->bActionValue = ACTION_ITEM_TOGGLE_DOOR; pItem->ItemData.Trigger.bActionValue = ACTION_ITEM_TOGGLE_DOOR;
break; break;
case ACTIONITEM_TOGGLE_ACTION1: case ACTIONITEM_TOGGLE_ACTION1:
pItem->usBombItem = NOTHING; pItem->ItemData.Trigger.usBombItem = NOTHING;
pItem->bActionValue = ACTION_ITEM_TOGGLE_ACTION1; pItem->ItemData.Trigger.bActionValue = ACTION_ITEM_TOGGLE_ACTION1;
break; break;
case ACTIONITEM_TOGGLE_ACTION2: case ACTIONITEM_TOGGLE_ACTION2:
pItem->usBombItem = NOTHING; pItem->ItemData.Trigger.usBombItem = NOTHING;
pItem->bActionValue = ACTION_ITEM_TOGGLE_ACTION2; pItem->ItemData.Trigger.bActionValue = ACTION_ITEM_TOGGLE_ACTION2;
break; break;
case ACTIONITEM_TOGGLE_ACTION3: case ACTIONITEM_TOGGLE_ACTION3:
pItem->usBombItem = NOTHING; pItem->ItemData.Trigger.usBombItem = NOTHING;
pItem->bActionValue = ACTION_ITEM_TOGGLE_ACTION3; pItem->ItemData.Trigger.bActionValue = ACTION_ITEM_TOGGLE_ACTION3;
break; break;
case ACTIONITEM_TOGGLE_ACTION4: case ACTIONITEM_TOGGLE_ACTION4:
pItem->usBombItem = NOTHING; pItem->ItemData.Trigger.usBombItem = NOTHING;
pItem->bActionValue = ACTION_ITEM_TOGGLE_ACTION4; pItem->ItemData.Trigger.bActionValue = ACTION_ITEM_TOGGLE_ACTION4;
break; break;
case ACTIONITEM_ENTER_BROTHEL: case ACTIONITEM_ENTER_BROTHEL:
pItem->usBombItem = NOTHING; pItem->ItemData.Trigger.usBombItem = NOTHING;
pItem->bActionValue = ACTION_ITEM_ENTER_BROTHEL; pItem->ItemData.Trigger.bActionValue = ACTION_ITEM_ENTER_BROTHEL;
break; break;
case ACTIONITEM_EXIT_BROTHEL: case ACTIONITEM_EXIT_BROTHEL:
pItem->usBombItem = NOTHING; pItem->ItemData.Trigger.usBombItem = NOTHING;
pItem->bActionValue = ACTION_ITEM_EXIT_BROTHEL; pItem->ItemData.Trigger.bActionValue = ACTION_ITEM_EXIT_BROTHEL;
break; break;
case ACTIONITEM_KINGPIN_ALARM: case ACTIONITEM_KINGPIN_ALARM:
pItem->usBombItem = NOTHING; pItem->ItemData.Trigger.usBombItem = NOTHING;
pItem->bActionValue = ACTION_ITEM_KINGPIN_ALARM; pItem->ItemData.Trigger.bActionValue = ACTION_ITEM_KINGPIN_ALARM;
break; break;
case ACTIONITEM_SEX: case ACTIONITEM_SEX:
pItem->usBombItem = NOTHING; pItem->ItemData.Trigger.usBombItem = NOTHING;
pItem->bActionValue = ACTION_ITEM_SEX; pItem->ItemData.Trigger.bActionValue = ACTION_ITEM_SEX;
break; break;
case ACTIONITEM_REVEAL_ROOM: case ACTIONITEM_REVEAL_ROOM:
pItem->usBombItem = NOTHING; pItem->ItemData.Trigger.usBombItem = NOTHING;
pItem->bActionValue = ACTION_ITEM_REVEAL_ROOM; pItem->ItemData.Trigger.bActionValue = ACTION_ITEM_REVEAL_ROOM;
break; break;
case ACTIONITEM_LOCAL_ALARM: case ACTIONITEM_LOCAL_ALARM:
pItem->usBombItem = NOTHING; pItem->ItemData.Trigger.usBombItem = NOTHING;
pItem->bActionValue = ACTION_ITEM_LOCAL_ALARM; pItem->ItemData.Trigger.bActionValue = ACTION_ITEM_LOCAL_ALARM;
break; break;
case ACTIONITEM_GLOBAL_ALARM: case ACTIONITEM_GLOBAL_ALARM:
pItem->usBombItem = NOTHING; pItem->ItemData.Trigger.usBombItem = NOTHING;
pItem->bActionValue = ACTION_ITEM_GLOBAL_ALARM; pItem->ItemData.Trigger.bActionValue = ACTION_ITEM_GLOBAL_ALARM;
break; break;
case ACTIONITEM_KLAXON: case ACTIONITEM_KLAXON:
pItem->usBombItem = NOTHING; pItem->ItemData.Trigger.usBombItem = NOTHING;
pItem->bActionValue = ACTION_ITEM_KLAXON; pItem->ItemData.Trigger.bActionValue = ACTION_ITEM_KLAXON;
break; break;
case ACTIONITEM_SMALL: case ACTIONITEM_SMALL:
pItem->usBombItem = HAND_GRENADE; pItem->ItemData.Trigger.usBombItem = HAND_GRENADE;
break; break;
case ACTIONITEM_MEDIUM: case ACTIONITEM_MEDIUM:
pItem->usBombItem = TNT; pItem->ItemData.Trigger.usBombItem = TNT;
break; break;
case ACTIONITEM_LARGE: case ACTIONITEM_LARGE:
pItem->usBombItem = C4; pItem->ItemData.Trigger.usBombItem = C4;
break; break;
case ACTIONITEM_MUSEUM_ALARM: case ACTIONITEM_MUSEUM_ALARM:
pItem->usBombItem = NOTHING; pItem->ItemData.Trigger.usBombItem = NOTHING;
pItem->bActionValue = ACTION_ITEM_MUSEUM_ALARM; pItem->ItemData.Trigger.bActionValue = ACTION_ITEM_MUSEUM_ALARM;
break; break;
case ACTIONITEM_BLOODCAT_ALARM: case ACTIONITEM_BLOODCAT_ALARM:
pItem->usBombItem = NOTHING; pItem->ItemData.Trigger.usBombItem = NOTHING;
pItem->bActionValue = ACTION_ITEM_BLOODCAT_ALARM; pItem->ItemData.Trigger.bActionValue = ACTION_ITEM_BLOODCAT_ALARM;
break; break;
case ACTIONITEM_BIG_TEAR_GAS: case ACTIONITEM_BIG_TEAR_GAS:
pItem->usBombItem = BIG_TEAR_GAS; pItem->ItemData.Trigger.usBombItem = BIG_TEAR_GAS;
break; break;
} }
@@ -1494,9 +1494,9 @@ void UpdateActionItem( INT8 bActionItemIndex )
//If the previous item was a pit, remove it before changing it //If the previous item was a pit, remove it before changing it
if( gpItem->usItem == ACTION_ITEM ) 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 ); 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 ); 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 the new item is a pit, add it so we can see how it looks.
if( gpItem->usItem == ACTION_ITEM ) 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 ); 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 ); 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) ) gubSummaryItemMode == ITEMMODE_REAL && !(gpWorldItemsSummaryArray[ i ].usFlags & WORLD_ITEM_SCIFI_ONLY) )
{ {
pItem = &gpWorldItemsSummaryArray[ i ].o; pItem = &gpWorldItemsSummaryArray[ i ].o;
if( !pItem->bFrequency ) if( !pItem->ItemData.Trigger.BombTrigger.bFrequency )
bFreqIndex = 7; bFreqIndex = 7;
else if( pItem->bFrequency == PANIC_FREQUENCY ) else if( pItem->ItemData.Trigger.BombTrigger.bFrequency == PANIC_FREQUENCY )
bFreqIndex = 0; bFreqIndex = 0;
else if( pItem->bFrequency == PANIC_FREQUENCY_2 ) else if( pItem->ItemData.Trigger.BombTrigger.bFrequency == PANIC_FREQUENCY_2 )
bFreqIndex = 1; bFreqIndex = 1;
else if( pItem->bFrequency == PANIC_FREQUENCY_3 ) else if( pItem->ItemData.Trigger.BombTrigger.bFrequency == PANIC_FREQUENCY_3 )
bFreqIndex = 2; 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; 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; 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; 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; bFreqIndex = 6;
else else
continue; continue;
@@ -754,7 +754,7 @@ void RenderItemDetails()
{ {
pItem = &gpWorldItemsSummaryArray[ i ].o; pItem = &gpWorldItemsSummaryArray[ i ].o;
uiExistChance += (100 - gpWorldItemsSummaryArray[ i ].ubNonExistChance) * pItem->ubNumberOfObjects; uiExistChance += (100 - gpWorldItemsSummaryArray[ i ].ubNonExistChance) * pItem->ubNumberOfObjects;
uiStatus += pItem->bStatus[0]; uiStatus += pItem->ItemData.Generic.bStatus[0];
uiQuantity += pItem->ubNumberOfObjects; uiQuantity += pItem->ubNumberOfObjects;
} }
} }
@@ -862,7 +862,7 @@ void RenderItemDetails()
{ {
pItem = &gpPEnemyItemsSummaryArray[ i ]; pItem = &gpPEnemyItemsSummaryArray[ i ];
uiExistChance += 100 * pItem->ubNumberOfObjects; uiExistChance += 100 * pItem->ubNumberOfObjects;
uiStatus += pItem->bStatus[0]; uiStatus += pItem->ItemData.Generic.bStatus[0];
uiQuantity += pItem->ubNumberOfObjects; uiQuantity += pItem->ubNumberOfObjects;
} }
} }
@@ -934,7 +934,7 @@ void RenderItemDetails()
{ {
pItem = &gpNEnemyItemsSummaryArray[ i ]; pItem = &gpNEnemyItemsSummaryArray[ i ];
uiExistChance += 100 * pItem->ubNumberOfObjects; uiExistChance += 100 * pItem->ubNumberOfObjects;
uiStatus += pItem->bStatus[0]; uiStatus += pItem->ItemData.Generic.bStatus[0];
uiQuantity += pItem->ubNumberOfObjects; 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++ ) for( cnt = 0; cnt < pSoldier->inv[ ubCounter ].ubNumberOfObjects; cnt++ )
{ {
// get total ammo // get total ammo
iTotalAmmo+= pSoldier->inv[ ubCounter ].ubShotsLeft[cnt]; iTotalAmmo+= pSoldier->inv[ ubCounter ].ItemData.Ammo.ubShotsLeft[cnt];
} }
} }
else 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 ) ); 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 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 ), FindFontRightCoordinates( ( INT16 )( PosX + 65 ), ( INT16 ) ( PosY + 15 ), ( INT16 ) ( 171 - 75 ),
( INT16 )( GetFontHeight( FONT10ARIAL ) ), sString, FONT10ARIAL, &sX, &sY ); ( INT16 )( GetFontHeight( FONT10ARIAL ) ), sString, FONT10ARIAL, &sX, &sY );
@@ -6439,7 +6439,7 @@ INT32 GetFundsOnMerc( SOLDIERTYPE *pSoldier )
{ {
if ( Item[ pSoldier->inv[ iCurrentPocket ] .usItem ].usItemClass == IC_MONEY ) 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? // 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; iAmountLeftToTake = 0;
} }
else else
{ {
iAmountLeftToTake -= pSoldier->inv[ iCurrentPocket ].uiMoneyAmount; iAmountLeftToTake -= pSoldier->inv[ iCurrentPocket ].ItemData.Money.uiMoneyAmount;
pSoldier->inv[ iCurrentPocket ].uiMoneyAmount = 0; pSoldier->inv[ iCurrentPocket ].ItemData.Money.uiMoneyAmount = 0;
//Remove the item out off the merc //Remove the item out off the merc
RemoveObjectFromSlot( pSoldier, (INT8)iCurrentPocket, &ObjectToRemove ); RemoveObjectFromSlot( pSoldier, (INT8)iCurrentPocket, &ObjectToRemove );
@@ -6529,9 +6529,9 @@ BOOLEAN TransferFundsFromBankToMerc( SOLDIERTYPE *pSoldier, INT32 iCurrentBalanc
// set up money object // set up money object
pMoneyObject.usItem = MONEY; pMoneyObject.usItem = MONEY;
pMoneyObject.ubNumberOfObjects = 1; pMoneyObject.ubNumberOfObjects = 1;
pMoneyObject.bMoneyStatus = 100; pMoneyObject.ItemData.Money.bMoneyStatus = 100;
pMoneyObject. bStatus[0] = 100; //pMoneyObject.ItemData.Generic.bStatus[0] = 100; // Isn't this the same as the previous line?
pMoneyObject.uiMoneyAmount = iCurrentBalance; pMoneyObject.ItemData.Money.uiMoneyAmount = iCurrentBalance;
// now auto place money object // 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++ ) for( ubObjectInPocketCounter = 0; ubObjectInPocketCounter < ubItemsInPocket; ubObjectInPocketCounter++ )
{ {
// jammed gun? // 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 ); return( TRUE );
} }
@@ -782,7 +782,7 @@ BOOLEAN DoesCharacterHaveAnyItemsToRepair( SOLDIERTYPE *pSoldier, INT8 bHighestP
for( ubObjectInPocketCounter = 0; ubObjectInPocketCounter < ubItemsInPocket; ubObjectInPocketCounter++ ) for( ubObjectInPocketCounter = 0; ubObjectInPocketCounter < ubItemsInPocket; ubObjectInPocketCounter++ )
{ {
// if it's repairable and NEEDS repairing // 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 ); return( TRUE );
} }
@@ -818,7 +818,7 @@ BOOLEAN DoesCharacterHaveAnyItemsToRepair( SOLDIERTYPE *pSoldier, INT8 bHighestP
for ( bPocket = HANDPOS; bPocket <= SMALLPOCK8POS; bPocket++ ) for ( bPocket = HANDPOS; bPocket <= SMALLPOCK8POS; bPocket++ )
{ {
// the object a weapon? and jammed? // 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 ); return( TRUE );
} }
@@ -2981,7 +2981,7 @@ INT8 FindRepairableItemOnOtherSoldier( SOLDIERTYPE * pSoldier, UINT8 ubPassType
pObj = &( pSoldier->inv[ bSlotToCheck ] ); pObj = &( pSoldier->inv[ bSlotToCheck ] );
for ( bLoop2 = 0; bLoop2 < pSoldier->inv[ bSlotToCheck ].ubNumberOfObjects; bLoop2++ ) 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 ); return( bSlotToCheck );
} }
@@ -3074,16 +3074,16 @@ BOOLEAN RepairObject( SOLDIERTYPE * pSoldier, SOLDIERTYPE * pOwner, OBJECTTYPE *
for ( ubLoop = 0; ubLoop < ubItemsInPocket; ubLoop++ ) for ( ubLoop = 0; ubLoop < ubItemsInPocket; ubLoop++ )
{ {
// if it's repairable and NEEDS repairing // 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 // repairable, try to repair it
//void DoActualRepair( SOLDIERTYPE * pSoldier, UINT16 usItem, INT8 * pbStatus, UINT8 * pubRepairPtsLeft ) //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; fSomethingWasRepaired = TRUE;
if ( pObj->bStatus[ ubLoop ] == 100 ) if ( pObj->ItemData.Generic.bStatus[ ubLoop ] == 100 )
{ {
// report it as fixed // report it as fixed
if ( pSoldier == pOwner ) if ( pSoldier == pOwner )
@@ -11545,13 +11545,13 @@ BOOLEAN UnjamGunsOnSoldier( SOLDIERTYPE *pOwnerSoldier, SOLDIERTYPE *pRepairSold
for (bPocket = HANDPOS; bPocket <= SMALLPOCK8POS; bPocket++) for (bPocket = HANDPOS; bPocket <= SMALLPOCK8POS; bPocket++)
{ {
// the object a weapon? and jammed? // 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 ) if ( *pubRepairPtsLeft >= gGameExternalOptions.ubRepairCostPerJam )
{ {
*pubRepairPtsLeft -= gGameExternalOptions.ubRepairCostPerJam; *pubRepairPtsLeft -= gGameExternalOptions.ubRepairCostPerJam;
pOwnerSoldier->inv [ bPocket ].bGunAmmoStatus *= -1; pOwnerSoldier->inv [ bPocket ].ItemData.Gun.bGunAmmoStatus *= -1;
// MECHANICAL/DEXTERITY GAIN: Unjammed a gun // MECHANICAL/DEXTERITY GAIN: Unjammed a gun
StatChange( pRepairSoldier, MECHANAMT, 5, FALSE ); 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 ); PlayAutoResolveSample( Weapon[ pItem->usItem ].sSound, RATE_11025, 50, 1, MIDDLEPAN );
return TRUE; return TRUE;
} }
if( !pItem->ubGunShotsLeft ) if( !pItem->ItemData.Gun.ubGunShotsLeft )
{ {
AutoReload( pSoldier ); 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 ); 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 ); PlayAutoResolveSample( Weapon[ pItem->usItem ].sSound, RATE_11025, 50, 1, MIDDLEPAN );
if( pAttacker->uiFlags & CELL_MERC ) if( pAttacker->uiFlags & CELL_MERC )
@@ -3949,7 +3949,7 @@ BOOLEAN FireAShot( SOLDIERCELL *pAttacker )
StatChange( pAttacker->pSoldier, MARKAMT, 3, FALSE ); StatChange( pAttacker->pSoldier, MARKAMT, 3, FALSE );
} }
pItem->ubGunShotsLeft--; pItem->ItemData.Gun.ubGunShotsLeft--;
return TRUE; return TRUE;
} }
} }
@@ -3986,7 +3986,7 @@ BOOLEAN TargetHasLoadedGun( SOLDIERTYPE *pSoldier )
{ {
return TRUE; return TRUE;
} }
if( pItem->ubGunShotsLeft ) if( pItem->ItemData.Gun.ubGunShotsLeft )
{ {
return TRUE; return TRUE;
} }
@@ -1516,7 +1516,7 @@ BOOLEAN GetObjFromInventoryStashSlot( OBJECTTYPE *pInventorySlot, OBJECTTYPE *pI
pItemPtr->usItem = pInventorySlot->usItem; pItemPtr->usItem = pInventorySlot->usItem;
// find first unempty slot // find first unempty slot
pItemPtr->bStatus[0] = pInventorySlot->bStatus[0]; pItemPtr->ItemData.Generic.bStatus[0] = pInventorySlot->ItemData.Generic.bStatus[0];
pItemPtr->ubNumberOfObjects = 1; pItemPtr->ubNumberOfObjects = 1;
pItemPtr->ubWeight = CalculateObjectWeight( pItemPtr ); pItemPtr->ubWeight = CalculateObjectWeight( pItemPtr );
RemoveObjFrom( pInventorySlot, 0 ); 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 // in the InSlot copy, zero out all the objects we didn't drop
for (ubLoop = ubNumberToDrop; ubLoop < pItemPtr->ubNumberOfObjects; ubLoop++) for (ubLoop = ubNumberToDrop; ubLoop < pItemPtr->ubNumberOfObjects; ubLoop++)
{ {
pInventorySlot->bStatus[ubLoop] = 0; pInventorySlot->ItemData.Generic.bStatus[ubLoop] = 0;
} }
} }
pInventorySlot->ubNumberOfObjects = ubNumberToDrop; pInventorySlot->ubNumberOfObjects = ubNumberToDrop;
@@ -1594,8 +1594,8 @@ BOOLEAN PlaceObjectInInventoryStash( OBJECTTYPE *pInventorySlot, OBJECTTYPE *pIt
{ {
// always allow money to be combined! // always allow money to be combined!
// average out the status values using a weighted average... // 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->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->uiMoneyAmount += pItemPtr->uiMoneyAmount; pInventorySlot->ItemData.Money.uiMoneyAmount += pItemPtr->ItemData.Money.uiMoneyAmount;
DeleteObj( pItemPtr ); DeleteObj( pItemPtr );
} }
@@ -1654,7 +1654,7 @@ BOOLEAN AutoPlaceObjectInInventoryStash( OBJECTTYPE *pItemPtr )
// in the InSlot copy, zero out all the objects we didn't drop // in the InSlot copy, zero out all the objects we didn't drop
for (ubLoop = ubNumberToDrop; ubLoop < pItemPtr->ubNumberOfObjects; ubLoop++) for (ubLoop = ubNumberToDrop; ubLoop < pItemPtr->ubNumberOfObjects; ubLoop++)
{ {
pInventorySlot->bStatus[ubLoop] = 0; pInventorySlot->ItemData.Generic.bStatus[ubLoop] = 0;
} }
} }
pInventorySlot->ubNumberOfObjects = ubNumberToDrop; pInventorySlot->ubNumberOfObjects = ubNumberToDrop;
@@ -2238,8 +2238,8 @@ INT32 MapScreenSectorInventoryCompare( const void *pNum1, const void *pNum2)
usItem1Index = pFirst->o.usItem; usItem1Index = pFirst->o.usItem;
usItem2Index = pSecond->o.usItem; usItem2Index = pSecond->o.usItem;
ubItem1Quality = pFirst->o.bStatus[ 0 ]; ubItem1Quality = pFirst->o.ItemData.Generic.bStatus[ 0 ];
ubItem2Quality = pSecond->o.bStatus[ 0 ]; ubItem2Quality = pSecond->o.ItemData.Generic.bStatus[ 0 ];
return( CompareItemsForSorting( usItem1Index, usItem2Index, ubItem1Quality, ubItem2Quality ) ); return( CompareItemsForSorting( usItem1Index, usItem2Index, ubItem1Quality, ubItem2Quality ) );
} }
@@ -2282,6 +2282,10 @@ void DeleteAllItemsInInventoryPool()
ClearUpTempUnSeenList( ); ClearUpTempUnSeenList( );
SaveSeenAndUnseenItems(); SaveSeenAndUnseenItems();
iCurrentInventoryPoolPage = 0;
iLastInventoryPoolPage = 0;
DestroyStash(); DestroyStash();
BuildStashForSelectedSector( sSelMapX, sSelMapY, iCurrentMapSectorZ); BuildStashForSelectedSector( sSelMapX, sSelMapY, iCurrentMapSectorZ);
} }
@@ -2315,7 +2319,7 @@ INT32 SellItem( OBJECTTYPE& object )
UINT8 magSize = Magazine[ Item[ usItemType ].ubClassIndex ].ubMagSize; UINT8 magSize = Magazine[ Item[ usItemType ].ubClassIndex ].ubMagSize;
for (INT8 bLoop = 0; bLoop < object.ubNumberOfObjects; bLoop++) 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 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 //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++) 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++) 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 // Assume we added one since there are supposedly more available and room for them
ubSlots--; 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 ) 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 // 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. // 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; ubItemsDelivered = 0;
@@ -220,11 +220,11 @@ void BobbyRayPurchaseEventCallback( UINT8 ubOrderID )
if (usStandardMapPos == LOST_SHIPMENT_GRIDNO) if (usStandardMapPos == LOST_SHIPMENT_GRIDNO)
{ {
// damage the item a random amount! // 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 // 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 ); AddItemToPool( usMapPos, &Object, -1, 0, 0, 0 );
} }
@@ -254,11 +254,11 @@ void BobbyRayPurchaseEventCallback( UINT8 ubOrderID )
if (usStandardMapPos == LOST_SHIPMENT_GRIDNO) if (usStandardMapPos == LOST_SHIPMENT_GRIDNO)
{ {
// damage the item a random amount! // 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 // 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 ) ); memcpy( &pObject[ uiCount ], &Object, sizeof( OBJECTTYPE ) );
uiCount++; uiCount++;
@@ -559,7 +559,7 @@ void CheckForKingpinsMoneyMissing( BOOLEAN fFirstCheck )
// loop through all items, look for ownership // loop through all items, look for ownership
if ( gWorldItems[ uiLoop ].fExists && gWorldItems[ uiLoop ].o.usItem == MONEY ) 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++ ) for ( uiLoop = 0; uiLoop < guiNumWorldItems; uiLoop++ )
{ {
// loop through all items, look for ownership // 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 ) ; GetItemPool( gWorldItems[ uiLoop ].sGridNo, &pItemPool, 0 ) ;
while( pItemPool ) while( pItemPool )
{ {
pObj = &( gWorldItems[ pItemPool->iItemIndex ].o ); 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 ) 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? { //Message for vehicle full?
return; return;
} }
if( pItem->bStatus ) if( pItem->ItemData.Generic.bStatus )
{ //Fill 'er up. { //Fill 'er up.
sFuelNeeded = 10000 - pVehicle->sBreathRed; sFuelNeeded = 10000 - pVehicle->sBreathRed;
sFuelAvailable = pItem->bStatus[0] * 50; sFuelAvailable = pItem->ItemData.Generic.bStatus[0] * 50;
sFuelAdded = min( sFuelNeeded, sFuelAvailable ); sFuelAdded = min( sFuelNeeded, sFuelAvailable );
//Add to vehicle //Add to vehicle
pVehicle->sBreathRed += sFuelAdded; pVehicle->sBreathRed += sFuelAdded;
pVehicle->bBreath = (INT8)(pVehicle->sBreathRed / 100); pVehicle->bBreath = (INT8)(pVehicle->sBreathRed / 100);
//Subtract from item //Subtract from item
pItem->bStatus[0] = (INT8)(pItem->bStatus[0] - sFuelAdded / 50); pItem->ItemData.Generic.bStatus[0] = (INT8)(pItem->ItemData.Generic.bStatus[0] - sFuelAdded / 50);
if( !pItem->bStatus[0] ) if( !pItem->ItemData.Generic.bStatus[0] )
{ //Gas can is empty, so toast the item. { //Gas can is empty, so toast the item.
DeleteObj( pItem ); DeleteObj( pItem );
} }
+1 -1
View File
@@ -5230,7 +5230,7 @@ void GetMapKeyboardInput( UINT32 *puiNewEvent )
SOLDIERTYPE *pSoldier = MercPtrs[ gCharactersList[ bSelectedInfoChar ].usSolID ]; SOLDIERTYPE *pSoldier = MercPtrs[ gCharactersList[ bSelectedInfoChar ].usSolID ];
if ( pSoldier->inv[ HANDPOS ].usItem != 0 ) 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(); PrepareEnemyForSectorBattle();
} }
for (int i=0; i<TOTAL_SOLDIERS; i++)
{
Assert( !MercPtrs[i]->bActive || !MercPtrs[i]->bInSector || MercPtrs[i]->sGridNo != NOWHERE);
}
if( gubNumCreaturesAttackingTown && !gbWorldSectorZ && if( gubNumCreaturesAttackingTown && !gbWorldSectorZ &&
gubSectorIDOfCreatureAttack == SECTOR( gWorldSectorX, gWorldSectorY ) ) 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... // Check for helicopter being on the ground in this sector...
HandleHelicopterOnGroundGraphic( ); 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 // 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 // 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 // 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. // except for the case of training new militia. But that case can be handled each time militia training finishes.
// ResetMilitia(); // ResetMilitia();
AllTeamsLookForAll( TRUE ); AllTeamsLookForAll( TRUE );
for (int i=0; i<TOTAL_SOLDIERS; i++)
{
Assert( !MercPtrs[i]->bActive || !MercPtrs[i]->bInSector || MercPtrs[i]->sGridNo != NOWHERE);
}
return( TRUE ); return( TRUE );
} }
+16 -16
View File
@@ -1527,23 +1527,23 @@ void AddObjectToArmsDealerInventory( UINT8 ubArmsDealer, OBJECTTYPE *pObject )
AddItemToArmsDealerInventory( ubArmsDealer, pObject->usItem, &SpclItemInfo, 1 ); AddItemToArmsDealerInventory( ubArmsDealer, pObject->usItem, &SpclItemInfo, 1 );
// if any GunAmmoItem is specified // if any GunAmmoItem is specified
if( pObject->usGunAmmoItem != NONE) if( pObject->ItemData.Gun.usGunAmmoItem != NONE)
{ {
// if it's regular ammo // 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 // and there are some remaining
if ( pObject->ubGunShotsLeft > 0 ) if ( pObject->ItemData.Gun.ubGunShotsLeft > 0 )
{ {
// add the bullets of its remaining ammo // 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) else // assume it's attached ammo (mortar shells, grenades)
{ {
// add the launchable item (can't be imprinted, or have attachments!) // add the launchable item (can't be imprinted, or have attachments!)
SetSpecialItemInfoToDefaults( &SpclItemInfo ); 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 the gun it was in was jammed, get rid of the negative status now
if ( SpclItemInfo.bItemCondition < 0 ) if ( SpclItemInfo.bItemCondition < 0 )
@@ -1551,7 +1551,7 @@ void AddObjectToArmsDealerInventory( UINT8 ubArmsDealer, OBJECTTYPE *pObject )
SpclItemInfo.bItemCondition *= -1; SpclItemInfo.bItemCondition *= -1;
} }
AddItemToArmsDealerInventory( ubArmsDealer, pObject->usGunAmmoItem, &SpclItemInfo, 1 ); AddItemToArmsDealerInventory( ubArmsDealer, pObject->ItemData.Gun.usGunAmmoItem, &SpclItemInfo, 1 );
} }
} }
break; 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) // add the contents of each magazine (multiple mags may have vastly different #bullets left)
for ( ubCnt = 0; ubCnt < pObject->ubNumberOfObjects; ubCnt++ ) for ( ubCnt = 0; ubCnt < pObject->ubNumberOfObjects; ubCnt++ )
{ {
AddAmmoToArmsDealerInventory( ubArmsDealer, pObject->usItem, pObject->ubShotsLeft[ ubCnt ] ); AddAmmoToArmsDealerInventory( ubArmsDealer, pObject->usItem, pObject->ItemData.Ammo.ubShotsLeft[ ubCnt ] );
} }
break; 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) // add each object seperately (multiple objects may have vastly different statuses, keep any imprintID)
for ( ubCnt = 0; ubCnt < pObject->ubNumberOfObjects; ubCnt++ ) 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 ); AddItemToArmsDealerInventory( ubArmsDealer, pObject->usItem, &SpclItemInfo, 1 );
} }
break; 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 // 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 // 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. // 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 ) ); Assert( CanDealerRepairItem( ubArmsDealer, pObject->usItem ) );
// c) Actually damaged, or a rocket rifle (being reset) // 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... /* ARM: Can now repair with removeable attachments still attached...
// d) Already stripped of all *detachable* attachments // 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 (Item [ pObject->usItem ].usItemClass == IC_GUN )
{ {
// if any GunAmmoItem is specified // if any GunAmmoItem is specified
if( pObject->usGunAmmoItem != NONE) if( pObject->ItemData.Gun.usGunAmmoItem != NONE)
{ {
// it better be regular ammo, and empty // it better be regular ammo, and empty
Assert( Item[ pObject->usGunAmmoItem ].usItemClass == IC_AMMO ); Assert( Item[ pObject->ItemData.Gun.usGunAmmoItem ].usItemClass == IC_AMMO );
Assert( pObject->ubGunShotsLeft == 0 ); Assert( pObject->ItemData.Gun.ubGunShotsLeft == 0 );
} }
} }
@@ -2250,7 +2250,7 @@ UINT32 CalculateObjectItemRepairTime( UINT8 ubArmsDealer, OBJECTTYPE *pItemObjec
UINT32 uiRepairTime; UINT32 uiRepairTime;
UINT8 ubCnt; 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 // add time to repair any attachments on it
for ( ubCnt = 0; ubCnt < MAX_ATTACHMENTS; ubCnt++ ) for ( ubCnt = 0; ubCnt < MAX_ATTACHMENTS; ubCnt++ )
@@ -2334,7 +2334,7 @@ UINT32 CalculateObjectItemRepairCost( UINT8 ubArmsDealer, OBJECTTYPE *pItemObjec
UINT32 uiRepairCost; UINT32 uiRepairCost;
UINT8 ubCnt; 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 // add cost of repairing any attachments on it
for ( ubCnt = 0; ubCnt < MAX_ATTACHMENTS; ubCnt++ ) for ( ubCnt = 0; ubCnt < MAX_ATTACHMENTS; ubCnt++ )
@@ -2435,7 +2435,7 @@ void SetSpecialItemInfoFromObject( SPECIAL_ITEM_INFO *pSpclItemInfo, OBJECTTYPE
} }
else else
{ {
pSpclItemInfo->bItemCondition = pObject->bStatus[ 0 ]; pSpclItemInfo->bItemCondition = pObject->ItemData.Generic.bStatus[ 0 ];
} }
// only guns currently have imprintID properly initialized... // 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; usItem1Index = ( ( INVENTORY_IN_SLOT * ) pArg1 ) -> sItemIndex;
usItem2Index = ( ( INVENTORY_IN_SLOT * ) pArg2 ) -> sItemIndex; usItem2Index = ( ( INVENTORY_IN_SLOT * ) pArg2 ) -> sItemIndex;
ubItem1Quality = ( ( INVENTORY_IN_SLOT * ) pArg1 ) -> ItemObject.bStatus[ 0 ]; ubItem1Quality = ( ( INVENTORY_IN_SLOT * ) pArg1 ) -> ItemObject.ItemData.Generic.bStatus[ 0 ];
ubItem2Quality = ( ( INVENTORY_IN_SLOT * ) pArg2 ) -> ItemObject.bStatus[ 0 ]; ubItem2Quality = ( ( INVENTORY_IN_SLOT * ) pArg2 ) -> ItemObject.ItemData.Generic.bStatus[ 0 ];
return( CompareItemsForSorting( usItem1Index, usItem2Index, ubItem1Quality, ubItem2Quality ) ); 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 ) if ( ubDrugType == DRUG_TYPE_REGENERATION )
{ {
// each use of a regen booster over 1, each day, reduces the effect // 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? // 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 // 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++; bRegenPointsGained++;
} }
+37 -34
View File
@@ -213,13 +213,16 @@ INT32 HandleItem( SOLDIERTYPE *pSoldier, INT16 sGridNo, INT8 bLevel, UINT16 usHa
if ( fFromUI ) if ( fFromUI )
{ {
INT16 sInteractiveGridNo;
// ATE: Check if we are targeting an interactive tile, and adjust gridno accordingly... // 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 ) if ( pIntNode != NULL && pTargetSoldier == pSoldier )
{ {
// Truncate target sioldier // Truncate target soldier and update grid
pTargetSoldier = NULL; pTargetSoldier = NULL;
sGridNo = sInteractiveGridNo;
} }
} }
} }
@@ -502,7 +505,7 @@ INT32 HandleItem( SOLDIERTYPE *pSoldier, INT16 sGridNo, INT8 bLevel, UINT16 usHa
pSoldier->bDoAutofire += misfirePenalty; pSoldier->bDoAutofire += misfirePenalty;
sAPCost = CalcTotalAPsToAttack( pSoldier, sTargetGridNo, TRUE, 0 ); 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 //note that we could misfire more bullets than we have rounds
//this represents the soldier running out of ammo and not noticing //this represents the soldier running out of ammo and not noticing
//the max that can be lost this way is 1AP //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; pSoldier->bDoAutofire -= misfirePenalty;
sAPCost = CalcTotalAPsToAttack( pSoldier, sTargetGridNo, TRUE, 0 ); 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 // 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 // 1 round
else 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 ); StatChange( pSoldier, EXPLODEAMT, 25, FALSE );
pSoldier->inv[ HANDPOS ].bTrap = __min( 10, ( EffectiveExplosive( pSoldier ) / 20) + (EffectiveExpLevel( pSoldier ) / 3) ); 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 // we now know there is something nasty here
gpWorldLevelData[ sGridNo ].uiFlags |= MAPELEMENT_PLAYER_MINE_PRESENT; gpWorldLevelData[ sGridNo ].uiFlags |= MAPELEMENT_PLAYER_MINE_PRESENT;
@@ -1753,7 +1756,7 @@ void SoldierGetItemFromWorld( SOLDIERTYPE *pSoldier, INT32 iItemIndex, INT16 sGr
if (Object.usItem == SWITCH) if (Object.usItem == SWITCH)
{ {
// ask about activating the switch! // ask about activating the switch!
bTempFrequency = Object.bFrequency; bTempFrequency = Object.ItemData.Trigger.BombTrigger.bFrequency;
gpTempSoldier = pSoldier; gpTempSoldier = pSoldier;
DoMessageBox( MSG_BOX_BASIC_STYLE, TacticalStr[ ACTIVATE_SWITCH_PROMPT ] , GAME_SCREEN, ( UINT8 )MSG_BOX_FLAG_YESNO, SwitchMessageBoxCallBack, NULL ); DoMessageBox( MSG_BOX_BASIC_STYLE, TacticalStr[ ACTIVATE_SWITCH_PROMPT ] , GAME_SCREEN, ( UINT8 )MSG_BOX_FLAG_YESNO, SwitchMessageBoxCallBack, NULL );
pItemPool = pItemPool->pNext; pItemPool = pItemPool->pNext;
@@ -1846,7 +1849,7 @@ void SoldierGetItemFromWorld( SOLDIERTYPE *pSoldier, INT32 iItemIndex, INT16 sGr
if (Object.usItem == SWITCH) if (Object.usItem == SWITCH)
{ {
// handle switch // handle switch
bTempFrequency = Object.bFrequency; bTempFrequency = Object.ItemData.Trigger.BombTrigger.bFrequency;
gpTempSoldier = pSoldier; gpTempSoldier = pSoldier;
DoMessageBox( MSG_BOX_BASIC_STYLE, TacticalStr[ ACTIVATE_SWITCH_PROMPT ], GAME_SCREEN, ( UINT8 )MSG_BOX_FLAG_YESNO, SwitchMessageBoxCallBack, NULL ); 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 // and they are pressure-triggered unless there is a switch structure there
if (FindStructure( *psGridNo, STRUCTURE_SWITCH ) != NULL) if (FindStructure( *psGridNo, STRUCTURE_SWITCH ) != NULL)
{ {
pObject->bDetonatorType = BOMB_SWITCH; pObject->ItemData.Trigger.bDetonatorType = BOMB_SWITCH;
} }
else else
{ {
pObject->bDetonatorType = BOMB_PRESSURE; pObject->ItemData.Trigger.bDetonatorType = BOMB_PRESSURE;
} }
} }
else else
{ {
// else they are manually controlled // else they are manually controlled
pObject->bDetonatorType = BOMB_SWITCH; pObject->ItemData.Trigger.bDetonatorType = BOMB_SWITCH;
} }
} }
else if ( pObject->usItem == ACTION_ITEM ) else if ( pObject->usItem == ACTION_ITEM )
{ {
switch( pObject->bActionValue ) switch( pObject->ItemData.Trigger.bActionValue )
{ {
case ACTION_ITEM_SMALL_PIT: case ACTION_ITEM_SMALL_PIT:
case ACTION_ITEM_LARGE_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? // are we giving money to an NPC, to whom we owe money?
if (pTSoldier->ubProfile != NO_PROFILE && gMercProfiles[pTSoldier->ubProfile].iBalance < 0) 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) if (gMercProfiles[pTSoldier->ubProfile].iBalance >= 0)
{ {
// don't let the player accumulate credit (?) // don't let the player accumulate credit (?)
@@ -4276,7 +4279,7 @@ void BombMessageBoxCallBack( UINT8 ubExitValue )
// HACK IMMINENT! // HACK IMMINENT!
// value of 1 is stored in maps for SIDE of bomb owner... when we want to use IDs! // 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 // 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 ); AddItemToPool( gsTempGridno, &(gpTempSoldier->inv[HANDPOS]), 1, gpTempSoldier->bLevel, WORLD_ITEM_ARMED_BOMB, 0 );
DeleteObj( &(gpTempSoldier->inv[HANDPOS]) ); 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 ( (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 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 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; fItemJustBroke = TRUE;
fItemWorks = FALSE; fItemWorks = FALSE;
// item breaks, and becomes unusable... so its status is reduced // item breaks, and becomes unusable... so its status is reduced
// to somewhere between 1 and the 1 less than USABLE // 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 else // it's already unusable
@@ -4333,8 +4336,8 @@ BOOLEAN HandItemWorks( SOLDIERTYPE *pSoldier, INT8 bSlot )
{ {
// are we using two guns at once? // are we using two guns at once?
if ( Item[ pSoldier->inv[SECONDHANDPOS].usItem ].usItemClass == IC_GUN && if ( Item[ pSoldier->inv[SECONDHANDPOS].usItem ].usItemClass == IC_GUN &&
pSoldier->inv[SECONDHANDPOS].bGunStatus >= USABLE && pSoldier->inv[SECONDHANDPOS].ItemData.Gun.bGunStatus >= USABLE &&
pSoldier->inv[SECONDHANDPOS].ubGunShotsLeft > 0) pSoldier->inv[SECONDHANDPOS].ItemData.Gun.ubGunShotsLeft > 0)
{ {
// check the second gun for breakage, and if IT breaks, return false // check the second gun for breakage, and if IT breaks, return false
return( HandItemWorks( pSoldier, SECONDHANDPOS ) ); 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 // 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 // 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 // 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! // my own boobytrap!
iCheckResult = SkillCheck( gpBoobyTrapSoldier, DISARM_TRAP_CHECK, 40 ); iCheckResult = SkillCheck( gpBoobyTrapSoldier, DISARM_TRAP_CHECK, 40 );
@@ -4529,9 +4532,9 @@ void BoobyTrapMessageBoxCallBack( UINT8 ubExitValue )
if (iCheckResult >= 0) 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! // disarmed my own boobytrap!
StatChange( gpBoobyTrapSoldier, EXPLODEAMT, (UINT16) (2 * gbTrapDifficulty), FALSE ); StatChange( gpBoobyTrapSoldier, EXPLODEAMT, (UINT16) (2 * gbTrapDifficulty), FALSE );
@@ -4558,7 +4561,7 @@ void BoobyTrapMessageBoxCallBack( UINT8 ubExitValue )
// give the player a remote trigger instead // give the player a remote trigger instead
CreateItem( REMOTEBOMBTRIGGER, (INT8) (1 + Random( 9 )), &Object ); 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 // give the player a detonator instead
CreateItem( DETONATOR, (INT8) (1 + Random( 9 )), &Object ); CreateItem( DETONATOR, (INT8) (1 + Random( 9 )), &Object );
@@ -4566,7 +4569,7 @@ void BoobyTrapMessageBoxCallBack( UINT8 ubExitValue )
else else
{ {
// switch action item to the real item type // 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 // remove any blue flag graphic
@@ -4662,7 +4665,7 @@ void BoobyTrapInMapScreenMessageBoxCallBack( UINT8 ubExitValue )
// give the player a remote trigger instead // give the player a remote trigger instead
CreateItem( REMOTEBOMBTRIGGER, (INT8) (1 + Random( 9 )), &Object ); 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 // give the player a detonator instead
CreateItem( DETONATOR, (INT8) (1 + Random( 9 )), &Object ); CreateItem( DETONATOR, (INT8) (1 + Random( 9 )), &Object );
@@ -4670,7 +4673,7 @@ void BoobyTrapInMapScreenMessageBoxCallBack( UINT8 ubExitValue )
else else
{ {
// switch action item to the real item type // 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 else
@@ -4824,7 +4827,7 @@ BOOLEAN NearbyGroundSeemsWrong( SOLDIERTYPE * pSoldier, INT16 sGridNo, BOOLEAN f
if (gWorldBombs[uiWorldBombIndex].fExists && gWorldItems[ gWorldBombs[uiWorldBombIndex].iItemIndex ].sGridNo == sNextGridNo) if (gWorldBombs[uiWorldBombIndex].fExists && gWorldItems[ gWorldBombs[uiWorldBombIndex].iItemIndex ].sGridNo == sNextGridNo)
{ {
pObj = &( gWorldItems[ gWorldBombs[uiWorldBombIndex].iItemIndex ].o ); 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 ) if ( fMining && pObj->bTrap <= 10 )
{ {
@@ -5047,18 +5050,18 @@ void CheckForPickedOwnership( void )
{ {
if ( gWorldItems[ pItemPool->iItemIndex ].o.usItem == OWNERSHIP ) 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 ); pSoldier = FindSoldierByProfileID( ubProfile, FALSE );
if ( pSoldier ) if ( pSoldier )
{ {
TestPotentialOwner( 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 ) ) if ( ubCivGroup == HICKS_CIV_GROUP && CheckFact( FACT_HICKS_MARRIED_PLAYER_MERC, 0 ) )
{ {
// skip because hicks appeased // skip because hicks appeased
+2 -2
View File
@@ -2371,7 +2371,7 @@ void HandleNPCDoAction( UINT8 ubTargetNPC, UINT16 usActionCode, UINT8 ubQuoteNum
if (pSoldier) if (pSoldier)
{ {
CreateItem( MONEY, 1, &Object ); CreateItem( MONEY, 1, &Object );
Object.uiMoneyAmount = 10000; Object.ItemData.Money.uiMoneyAmount = 10000;
AddItemToPoolAndGetIndex( sGridNo, &Object, -1, pSoldier->bLevel, 0, 0, &iWorldItem ); AddItemToPoolAndGetIndex( sGridNo, &Object, -1, pSoldier->bLevel, 0, 0, &iWorldItem );
// shouldn't have any current action but make sure everything // 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) if (bMoneySlot != NO_SLOT && bEmptySlot != NO_SLOT)
{ {
CreateMoney( gMercProfiles[ ubTargetNPC ].iBalance * 2, &(pSoldier->inv[ bEmptySlot ] ) ); 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) if (bMoneySlot < bEmptySlot)
{ {
// move main stash to later in inventory! // 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; ubWeight = Item[ usItem ].ubWeight;
if (Item[ usItem ].usItemClass == IC_GUN) if (Item[ usItem ].usItemClass == IC_GUN)
{ {
ubWeight += Item[ pObject->usGunAmmoItem ].ubWeight; ubWeight += Item[ pObject->ItemData.Gun.usGunAmmoItem ].ubWeight;
} }
if (Weapon[usItem].bAccuracy >= EXCEPTIONAL_ACCURACY ) if (Weapon[usItem].bAccuracy >= EXCEPTIONAL_ACCURACY )
@@ -753,7 +753,7 @@ void GenerateConsString( STR16 zItemCons, OBJECTTYPE * pObject, UINT32 uiPixLimi
ubWeight = Item[ usItem ].ubWeight; ubWeight = Item[ usItem ].ubWeight;
if (Item[ usItem ].usItemClass == IC_GUN) if (Item[ usItem ].usItemClass == IC_GUN)
{ {
ubWeight += Item[ pObject->usGunAmmoItem ].ubWeight; ubWeight += Item[ pObject->ItemData.Gun.usGunAmmoItem ].ubWeight;
} }
if (ubWeight >= BAD_WEIGHT) if (ubWeight >= BAD_WEIGHT)
@@ -1079,7 +1079,7 @@ void HandleRenderInvSlots( SOLDIERTYPE *pSoldier, UINT8 fDirtyLevel )
if ( fDirtyLevel == DIRTYLEVEL2 ) if ( fDirtyLevel == DIRTYLEVEL2 )
{ {
# if defined( _DEBUG ) /* Sergeant_Kolja, to be removed later again */ # 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 : "???" )); 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 : "???" ); 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; sNewY = sY + sHeight - 10;
sNewX = sX + 1; sNewX = sX + 1;
SetFontForeground ( AmmoTypes[pObject->ubGunAmmoType].fontColour ); SetFontForeground ( AmmoTypes[pObject->ItemData.Gun.ubGunAmmoType].fontColour );
//switch (pObject->ubGunAmmoType) //switch (pObject->ubGunAmmoType)
//{ //{
// case AMMO_AP: // 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 ) if ( uiBuffer == guiSAVEBUFFER )
{ {
RestoreExternBackgroundRect( sNewX, sNewY, 20, 15 ); RestoreExternBackgroundRect( sNewX, sNewY, 20, 15 );
@@ -2119,7 +2119,7 @@ void INVRenderItem( UINT32 uiBuffer, SOLDIERTYPE * pSoldier, OBJECTTYPE *pObjec
SetFontForeground( FONT_MCOLOR_DKGRAY ); SetFontForeground( FONT_MCOLOR_DKGRAY );
// Display 'JAMMED' if we are jammed // Display 'JAMMED' if we are jammed
if ( pObject->bGunAmmoStatus < 0 ) if ( pObject->ItemData.Gun.bGunAmmoStatus < 0 )
{ {
SetFontForeground( FONT_MCOLOR_RED ); SetFontForeground( FONT_MCOLOR_RED );
@@ -2436,14 +2436,14 @@ BOOLEAN InternalInitItemDescriptionBox( OBJECTTYPE *pObject, INT16 sX, INT16 sY,
// if( guiCurrentScreen != MAP_SCREEN ) // if( guiCurrentScreen != MAP_SCREEN )
//if( guiCurrentItemDescriptionScreen != MAP_SCREEN ) //if( guiCurrentItemDescriptionScreen != MAP_SCREEN )
if ( GetMagSize(gpItemDescObject) <= 99 ) 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 else
swprintf( pStr, L"%d", gpItemDescObject->ubGunShotsLeft ); swprintf( pStr, L"%d", gpItemDescObject->ItemData.Gun.ubGunShotsLeft );
FilenameForBPP("INTERFACE\\infobox.sti", ubString); FilenameForBPP("INTERFACE\\infobox.sti", ubString);
sForeColour = ITEMDESC_AMMO_FORE; 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 ) //switch( pObject->ubGunAmmoType )
//{ //{
@@ -2630,8 +2630,8 @@ BOOLEAN InternalInitItemDescriptionBox( OBJECTTYPE *pObject, INT16 sX, INT16 sY,
else else
{ {
memset( &gRemoveMoney, 0, sizeof( REMOVE_MONEY ) ); memset( &gRemoveMoney, 0, sizeof( REMOVE_MONEY ) );
gRemoveMoney.uiTotalAmount = gpItemDescObject->uiMoneyAmount; gRemoveMoney.uiTotalAmount = gpItemDescObject->ItemData.Money.uiMoneyAmount;
gRemoveMoney.uiMoneyRemaining = gpItemDescObject->uiMoneyAmount; gRemoveMoney.uiMoneyRemaining = gpItemDescObject->ItemData.Money.uiMoneyAmount;
gRemoveMoney.uiMoneyRemoving = 0; gRemoveMoney.uiMoneyRemoving = 0;
// Load graphic // Load graphic
@@ -3281,12 +3281,12 @@ void RenderItemDescriptionBox( )
if( Item[gpItemDescObject->usItem].usItemClass == IC_AMMO && gpItemDescObject->ubNumberOfObjects > 1 && gubItemDescStatusIndex < gpItemDescObject->ubNumberOfObjects) if( Item[gpItemDescObject->usItem].usItemClass == IC_AMMO && gpItemDescObject->ubNumberOfObjects > 1 && gubItemDescStatusIndex < gpItemDescObject->ubNumberOfObjects)
{ {
//Get weight of one item in stack. //Get weight of one item in stack.
UINT8 ubShotsLeftFirst = gpItemDescObject->ubShotsLeft[0]; UINT8 ubShotsLeftFirst = gpItemDescObject->ItemData.Ammo.ubShotsLeft[0];
UINT8 ubNumberOfObjects = gpItemDescObject->ubNumberOfObjects; UINT8 ubNumberOfObjects = gpItemDescObject->ubNumberOfObjects;
gpItemDescObject->ubNumberOfObjects = 1; gpItemDescObject->ubNumberOfObjects = 1;
gpItemDescObject->ubShotsLeft[0] = gpItemDescObject->ubShotsLeft[gubItemDescStatusIndex]; gpItemDescObject->ItemData.Ammo.ubShotsLeft[0] = gpItemDescObject->ItemData.Ammo.ubShotsLeft[gubItemDescStatusIndex];
fWeight = (float)(CalculateObjectWeight( gpItemDescObject )) / 10; fWeight = (float)(CalculateObjectWeight( gpItemDescObject )) / 10;
gpItemDescObject->ubShotsLeft[0] = ubShotsLeftFirst; gpItemDescObject->ItemData.Ammo.ubShotsLeft[0] = ubShotsLeftFirst;
gpItemDescObject->ubNumberOfObjects = ubNumberOfObjects; gpItemDescObject->ubNumberOfObjects = ubNumberOfObjects;
} }
//Item does not exist //Item does not exist
@@ -3349,7 +3349,7 @@ void RenderItemDescriptionBox( )
SetFontForeground( 5 ); SetFontForeground( 5 );
//Status //Status
// This is gross, but to get the % to work out right... // 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); 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"%%" ); wcscat( pStr, L"%%" );
mprintf( usX, usY, pStr ); mprintf( usX, usY, pStr );
@@ -3521,7 +3521,7 @@ void RenderItemDescriptionBox( )
{ {
SetFontForeground( FONT_FCOLOR_WHITE ); SetFontForeground( FONT_FCOLOR_WHITE );
SetFontShadow( DEFAULT_SHADOW ); SetFontShadow( DEFAULT_SHADOW );
swprintf( pStr, L"%ld", gpItemDescObject->uiMoneyAmount ); swprintf( pStr, L"%ld", gpItemDescObject->ItemData.Money.uiMoneyAmount );
InsertCommasForDollarFigure( pStr ); InsertCommasForDollarFigure( pStr );
InsertDollarSignInToString( pStr ); InsertDollarSignInToString( pStr );
uiStringLength=StringPixLength(pStr, ITEMDESC_FONT ); uiStringLength=StringPixLength(pStr, ITEMDESC_FONT );
@@ -3554,7 +3554,7 @@ void RenderItemDescriptionBox( )
if ( Item[ gpItemDescObject->usItem ].usItemClass & IC_AMMO ) if ( Item[ gpItemDescObject->usItem ].usItemClass & IC_AMMO )
{ {
// 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 ); uiStringLength=StringPixLength(pStr, ITEMDESC_FONT );
// sStrX = gMapWeaponStats[ 0 ].sX + gsInvDescX + gMapWeaponStats[ 0 ].sValDx + ( uiRightLength - uiStringLength ); // 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); 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 else
{ {
//Status //Status
swprintf( pStr, L"%2d%%", gpItemDescObject->bStatus[ gubItemDescStatusIndex ] ); swprintf( pStr, L"%2d%%", gpItemDescObject->ItemData.Generic.bStatus[ gubItemDescStatusIndex ] );
uiStringLength=StringPixLength(pStr, ITEMDESC_FONT ); uiStringLength=StringPixLength(pStr, ITEMDESC_FONT );
// sStrX = gMapWeaponStats[ 1 ].sX + gsInvDescX + gMapWeaponStats[ 1 ].sValDx + ( uiRightLength - uiStringLength ); // 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); 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 ); 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 ); swprintf( pStr, L"%s", sTempString );
FindFontRightCoordinates( (INT16)(gMapWeaponStats[ 4 ].sX + gsInvDescX ), (INT16)(gMapWeaponStats[ 4 ].sY + gsInvDescY ), 110 ,ITEM_STATS_HEIGHT ,pStr, BLOCKFONT2, &usX, &usY); FindFontRightCoordinates( (INT16)(gMapWeaponStats[ 4 ].sX + gsInvDescX ), (INT16)(gMapWeaponStats[ 4 ].sY + gsInvDescY ), 110 ,ITEM_STATS_HEIGHT ,pStr, BLOCKFONT2, &usX, &usY);
mprintf( usX, usY, pStr ); 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); 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 ); mprintf( usX, usY, pStr );
} }
@@ -3775,12 +3775,12 @@ void RenderItemDescriptionBox( )
if( Item[gpItemDescObject->usItem].usItemClass == IC_AMMO && gpItemDescObject->ubNumberOfObjects > 1 && gubItemDescStatusIndex < gpItemDescObject->ubNumberOfObjects) if( Item[gpItemDescObject->usItem].usItemClass == IC_AMMO && gpItemDescObject->ubNumberOfObjects > 1 && gubItemDescStatusIndex < gpItemDescObject->ubNumberOfObjects)
{ {
//Get weight of one ammo clip in stack. //Get weight of one ammo clip in stack.
UINT8 ubShotsLeftFirst = gpItemDescObject->ubShotsLeft[0]; UINT8 ubShotsLeftFirst = gpItemDescObject->ItemData.Ammo.ubShotsLeft[0];
UINT8 ubNumberOfObjects = gpItemDescObject->ubNumberOfObjects; UINT8 ubNumberOfObjects = gpItemDescObject->ubNumberOfObjects;
gpItemDescObject->ubNumberOfObjects = 1; gpItemDescObject->ubNumberOfObjects = 1;
gpItemDescObject->ubShotsLeft[0] = gpItemDescObject->ubShotsLeft[gubItemDescStatusIndex]; gpItemDescObject->ItemData.Ammo.ubShotsLeft[0] = gpItemDescObject->ItemData.Ammo.ubShotsLeft[gubItemDescStatusIndex];
fWeight = (float)(CalculateObjectWeight( gpItemDescObject )) / 10; fWeight = (float)(CalculateObjectWeight( gpItemDescObject )) / 10;
gpItemDescObject->ubShotsLeft[0] = ubShotsLeftFirst; gpItemDescObject->ItemData.Ammo.ubShotsLeft[0] = ubShotsLeftFirst;
gpItemDescObject->ubNumberOfObjects = ubNumberOfObjects; gpItemDescObject->ubNumberOfObjects = ubNumberOfObjects;
} }
//Item does not exist //Item does not exist
@@ -3850,7 +3850,7 @@ void RenderItemDescriptionBox( )
} }
//Status //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); 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"%%" ); wcscat( pStr, L"%%" );
mprintf( usX, usY, pStr ); mprintf( usX, usY, pStr );
@@ -4018,7 +4018,7 @@ void RenderItemDescriptionBox( )
{ {
SetFontForeground( FONT_FCOLOR_WHITE ); SetFontForeground( FONT_FCOLOR_WHITE );
SetFontShadow( DEFAULT_SHADOW ); SetFontShadow( DEFAULT_SHADOW );
swprintf( pStr, L"%ld", gpItemDescObject->uiMoneyAmount ); swprintf( pStr, L"%ld", gpItemDescObject->ItemData.Money.uiMoneyAmount );
InsertCommasForDollarFigure( pStr ); InsertCommasForDollarFigure( pStr );
InsertDollarSignInToString( pStr ); InsertDollarSignInToString( pStr );
@@ -4054,14 +4054,14 @@ void RenderItemDescriptionBox( )
{ {
// Ammo - print amount // Ammo - print amount
//Status //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); 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 ); mprintf( usX, usY, pStr );
} }
else else
{ {
//Status //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); 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"%%" ); wcscat( pStr, L"%%" );
mprintf( usX, usY, pStr ); mprintf( usX, usY, pStr );
@@ -4079,12 +4079,12 @@ void RenderItemDescriptionBox( )
SetFontForeground( 5 ); 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 ); swprintf( pStr, L"%s", sTempString );
FindFontRightCoordinates( (INT16)(gWeaponStats[ 4 ].sX + gsInvDescX ), (INT16)(gWeaponStats[ 4 ].sY + gsInvDescY ), 110 ,ITEM_STATS_HEIGHT ,pStr, BLOCKFONT2, &usX, &usY); FindFontRightCoordinates( (INT16)(gWeaponStats[ 4 ].sX + gsInvDescX ), (INT16)(gWeaponStats[ 4 ].sY + gsInvDescY ), 110 ,ITEM_STATS_HEIGHT ,pStr, BLOCKFONT2, &usX, &usY);
mprintf( usX, usY, pStr ); 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); 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 ); mprintf( usX, usY, pStr );
} }
@@ -5673,7 +5673,7 @@ void RenderKeyRingPopup( BOOLEAN fFullRender )
memset( &pObject, 0, sizeof( OBJECTTYPE ) ); memset( &pObject, 0, sizeof( OBJECTTYPE ) );
pObject.usItem = KEY_1; 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! // TAKE A LOOK AT THE VIDEO OBJECT SIZE ( ONE OF TWO SIZES ) AND CENTER!
GetVideoObject( &hVObject, guiItemPopupBoxes ); GetVideoObject( &hVObject, guiItemPopupBoxes );
@@ -6517,7 +6517,7 @@ void SetupPickupPage( INT8 bPage )
pObject = (gfStealing)? &gpOpponent->inv[pTempItemPool->iItemIndex] pObject = (gfStealing)? &gpOpponent->inv[pTempItemPool->iItemIndex]
:&(gWorldItems[ pTempItemPool->iItemIndex ].o ); :&(gWorldItems[ pTempItemPool->iItemIndex ].o );
sValue = pObject->bStatus[ 0 ]; sValue = pObject->ItemData.Generic.bStatus[ 0 ];
// Adjust for ammo, other thingys.. // Adjust for ammo, other thingys..
if( Item[ pObject->usItem ].usItemClass & IC_AMMO || Item[ pObject->usItem ].usItemClass & IC_KEY ) 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 ) if ( Item[ pObject->usItem ].usItemClass == IC_MONEY )
{ {
CHAR16 pStr2[20]; CHAR16 pStr2[20];
swprintf( pStr2, L"%ld", pObject->uiMoneyAmount ); swprintf( pStr2, L"%ld", pObject->ItemData.Money.uiMoneyAmount );
InsertCommasForDollarFigure( pStr2 ); InsertCommasForDollarFigure( pStr2 );
InsertDollarSignInToString( pStr2 ); InsertDollarSignInToString( pStr2 );
@@ -7337,22 +7337,22 @@ void RemoveMoney()
InvSlot.bSlotIdInOtherLocation = -1; InvSlot.bSlotIdInOtherLocation = -1;
//Remove the money from the money in the pocket //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 //Create an item to get the money that is being removed
CreateItem( MONEY, 0, &InvSlot.ItemObject ); CreateItem( MONEY, 0, &InvSlot.ItemObject );
//Set the amount thast is being removed //Set the amount thast is being removed
InvSlot.ItemObject.uiMoneyAmount = gRemoveMoney.uiMoneyRemoving; InvSlot.ItemObject.ItemData.Money.uiMoneyAmount = gRemoveMoney.uiMoneyRemoving;
InvSlot.ubIdOfMercWhoOwnsTheItem = gpItemDescSoldier->ubProfile; InvSlot.ubIdOfMercWhoOwnsTheItem = gpItemDescSoldier->ubProfile;
//if we are removing money from the players account //if we are removing money from the players account
if( gfAddingMoneyToMercFromPlayersAccount ) if( gfAddingMoneyToMercFromPlayersAccount )
{ {
gpItemDescObject->uiMoneyAmount = gRemoveMoney.uiMoneyRemoving; gpItemDescObject->ItemData.Money.uiMoneyAmount = gRemoveMoney.uiMoneyRemoving;
//take the money from the player //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 ) ); memcpy( &gMoveingItem, &InvSlot, sizeof( INVENTORY_IN_SLOT ) );
@@ -7378,13 +7378,13 @@ void RemoveMoney()
//if we are removing money from the players account //if we are removing money from the players account
if( gfAddingMoneyToMercFromPlayersAccount ) if( gfAddingMoneyToMercFromPlayersAccount )
{ {
gpItemDescObject->uiMoneyAmount = gRemoveMoney.uiMoneyRemoving; gpItemDescObject->ItemData.Money.uiMoneyAmount = gRemoveMoney.uiMoneyRemoving;
//take the money from the player //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 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! Remove when fixed!
*/ */
# if defined( _DEBUG ) # 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 : "???" )); 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 // Retrieve the status of the items
// Find the minimum status value - not just the first one // 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++) 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: case MONEY:
//Money //Money
{ {
swprintf( pStr, L"%ld", pObject->uiMoneyAmount ); swprintf( pStr, L"%ld", pObject->ItemData.Money.uiMoneyAmount );
InsertCommasForDollarFigure( pStr ); InsertCommasForDollarFigure( pStr );
InsertDollarSignInToString( pStr ); InsertDollarSignInToString( pStr );
} }
@@ -7496,7 +7496,7 @@ void GetHelpTextForItem( STR16 pzStr, OBJECTTYPE *pObject, SOLDIERTYPE *pSoldier
//if ( Item[ usItem ].usItemClass == IC_MONEY ) //if ( Item[ usItem ].usItemClass == IC_MONEY )
{ {
CHAR16 pStr2[20]; CHAR16 pStr2[20];
swprintf( pStr2, L"%ld", pObject->uiMoneyAmount ); swprintf( pStr2, L"%ld", pObject->ItemData.Money.uiMoneyAmount );
InsertCommasForDollarFigure( pStr2 ); InsertCommasForDollarFigure( pStr2 );
InsertDollarSignInToString( 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' // The next is for ammunition which gets the measurement 'rnds'
swprintf( pStr, L"%s [%d rnds]\n%s %1.1f %s", swprintf( pStr, L"%s [%d rnds]\n%s %1.1f %s",
ItemNames[ usItem ], //Item long name ItemNames[ usItem ], //Item long name
pObject->ubShotsLeft[0], //Shots left pObject->ItemData.Ammo.ubShotsLeft[0], //Shots left
gWeaponStatsDesc[ 12 ], //Weight String gWeaponStatsDesc[ 12 ], //Weight String
fWeight, //Weight fWeight, //Weight
GetWeightUnitString() //Weight units GetWeightUnitString() //Weight units
+3 -3
View File
@@ -5661,7 +5661,7 @@ void KeyRingSlotInvClickCallback( MOUSE_REGION * pRegion, INT32 iReason )
//usOldItemIndex = gpSMCurrentMerc->inv[ uiHandPos ].usItem; //usOldItemIndex = gpSMCurrentMerc->inv[ uiHandPos ].usItem;
//usNewItemIndex = gpItemPointer->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 // Try to place here
if ( ( iNumberOfKeysTaken = AddKeysToSlot( gpItemPopupSoldier, ( INT8 )uiKeyRing, gpItemPointer ) ) ) if ( ( iNumberOfKeysTaken = AddKeysToSlot( gpItemPopupSoldier, ( INT8 )uiKeyRing, gpItemPointer ) ) )
@@ -5904,7 +5904,7 @@ void SMInvMoneyButtonCallback( MOUSE_REGION * pRegion, INT32 iReason )
guiPendingOverrideEvent = A_CHANGE_TO_MOVE; guiPendingOverrideEvent = A_CHANGE_TO_MOVE;
HandleTacticalUI( ); HandleTacticalUI( );
swprintf( zMoney, L"%d", gpItemPointer->uiMoneyAmount ); swprintf( zMoney, L"%d", gpItemPointer->ItemData.Money.uiMoneyAmount );
InsertCommasForDollarFigure( zMoney ); InsertCommasForDollarFigure( zMoney );
InsertDollarSignInToString( zMoney ); InsertDollarSignInToString( zMoney );
@@ -5949,7 +5949,7 @@ void ConfirmationToDepositMoneyToPlayersAccount( UINT8 ubExitValue )
if ( ubExitValue == MSG_BOX_RETURN_YES ) if ( ubExitValue == MSG_BOX_RETURN_YES )
{ {
//add the money to the players account //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 // dirty shopkeeper
gubSkiDirtyLevel = SKI_DIRTY_LEVEL2; gubSkiDirtyLevel = SKI_DIRTY_LEVEL2;
+2 -2
View File
@@ -364,7 +364,7 @@ void DrawItemUIBarEx( OBJECTTYPE *pObject, UINT8 ubStatus, INT16 sXPos, INT16 sY
} }
else else
{ {
sValue = pObject->bStatus[ ubStatus ]; sValue = pObject->ItemData.Generic.bStatus[ ubStatus ];
} }
// Adjust for ammo, other thingys.. // Adjust for ammo, other thingys..
@@ -375,7 +375,7 @@ void DrawItemUIBarEx( OBJECTTYPE *pObject, UINT8 ubStatus, INT16 sXPos, INT16 sY
if ( sValue < 0 ) 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 )); 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 ) if ( sValue > 100 )
+8 -8
View File
@@ -553,7 +553,7 @@ void GenerateRandomEquipment( SOLDIERCREATE_STRUCT *pp, INT8 bSoldierClass, INT8
{ {
fLAW = FALSE; fLAW = FALSE;
} }
pItem->ubGunState |= GS_CARTRIDGE_IN_CHAMBER; pItem->ItemData.Gun.ubGunState |= GS_CARTRIDGE_IN_CHAMBER;
break; break;
case IC_AMMO: case IC_AMMO:
bAmmoClips = 0; bAmmoClips = 0;
@@ -563,7 +563,7 @@ void GenerateRandomEquipment( SOLDIERCREATE_STRUCT *pp, INT8 bSoldierClass, INT8
bKnifeClass = 0; bKnifeClass = 0;
break; break;
case IC_LAUNCHER: case IC_LAUNCHER:
pItem->ubGunState |= GS_CARTRIDGE_IN_CHAMBER; pItem->ItemData.Gun.ubGunState |= GS_CARTRIDGE_IN_CHAMBER;
fGrenadeLauncher = FALSE; fGrenadeLauncher = FALSE;
if (fMortar || fRPG) if (fMortar || fRPG)
{ {
@@ -660,8 +660,8 @@ void ChooseWeaponForSoldierCreateStruct( SOLDIERCREATE_STRUCT *pp, INT8 bWeaponC
usGunIndex = pp->Inv[ i ].usItem; usGunIndex = pp->Inv[ i ].usItem;
ubChanceStandardAmmo = 100 - (bWeaponClass * -9); // weapon class is negative! ubChanceStandardAmmo = 100 - (bWeaponClass * -9); // weapon class is negative!
usAmmoIndex = RandomMagazine( usGunIndex, ubChanceStandardAmmo ); usAmmoIndex = RandomMagazine( usGunIndex, ubChanceStandardAmmo );
pp->Inv[ i ].ubGunAmmoType = Magazine[Item[usAmmoIndex].ubClassIndex].ubAmmoType; pp->Inv[ i ].ItemData.Gun.ubGunAmmoType = Magazine[Item[usAmmoIndex].ubClassIndex].ubAmmoType;
pp->Inv[ i ].usGunAmmoItem = usAmmoIndex; pp->Inv[ i ].ItemData.Gun.usGunAmmoItem = usAmmoIndex;
if ( Item[usGunIndex].fingerprintid ) 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")); DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("ChooseWeaponForSoldierCreateStruct: Set bullets"));
//set bullets = to magsize including any attachments (c-mag adapters, etc) //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")); DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("ChooseWeaponForSoldierCreateStruct: choose ammo"));
if( bAmmoClips ) if( bAmmoClips )
@@ -929,8 +929,8 @@ void ChooseWeaponForSoldierCreateStruct( SOLDIERCREATE_STRUCT *pp, INT8 bWeaponC
//} //}
usAmmoIndex = RandomMagazine( &pp->Inv[HANDPOS], ubChanceStandardAmmo ); usAmmoIndex = RandomMagazine( &pp->Inv[HANDPOS], ubChanceStandardAmmo );
pp->Inv[ HANDPOS ].ubGunAmmoType = Magazine[Item[usAmmoIndex].ubClassIndex].ubAmmoType; pp->Inv[ HANDPOS ].ItemData.Gun.ubGunAmmoType = Magazine[Item[usAmmoIndex].ubClassIndex].ubAmmoType;
pp->Inv[ HANDPOS ].usGunAmmoItem = usAmmoIndex; pp->Inv[ HANDPOS ].ItemData.Gun.usGunAmmoItem = usAmmoIndex;
} }
//Ammo //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) // have to replace! but first (ugh) must store backup (b/c of attachments)
CopyObj( &(pp->Inv[ uiLoop ]), &OldObj ); 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; pp->Inv[ uiLoop ].fFlags = OldObj.fFlags;
// copy any valid attachments; for others, just drop them... // 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 INT8 bGunAmmoStatus; // only for "attached ammo" - grenades, mortar shells
UINT8 ubGunState; // SB manual recharge UINT8 ubGunState; // SB manual recharge
UINT8 ubGunUnused[MAX_OBJECTS_PER_SLOT - 6]; UINT8 ubGunUnused[MAX_OBJECTS_PER_SLOT - 6];
}; } Gun;
struct struct
{ {
UINT8 ubShotsLeft[MAX_OBJECTS_PER_SLOT]; UINT8 ubShotsLeft[MAX_OBJECTS_PER_SLOT];
}; } Ammo;
struct struct
{ {
INT8 bStatus[MAX_OBJECTS_PER_SLOT]; INT8 bStatus[MAX_OBJECTS_PER_SLOT];
}; } Generic;
struct struct
{ {
INT8 bMoneyStatus; INT8 bMoneyStatus;
UINT32 uiMoneyAmount; UINT32 uiMoneyAmount;
UINT8 ubMoneyUnused[MAX_OBJECTS_PER_SLOT - 5]; UINT8 ubMoneyUnused[MAX_OBJECTS_PER_SLOT - 5];
}; } Money;
struct struct
{ // this is used by placed bombs, switches, and the action item { // this is used by placed bombs, switches, and the action item
INT8 bBombStatus; // % status INT8 bBombStatus; // % status
@@ -106,42 +106,42 @@ typedef struct
UINT16 usBombItem; // the usItem of the bomb. UINT16 usBombItem; // the usItem of the bomb.
union union
{ {
struct //struct
{ //{
INT8 bDelay; // >=0 values used only INT8 bDelay; // >=0 values used only
}; //};
struct //struct
{ //{
INT8 bFrequency; // >=0 values used only INT8 bFrequency; // >=0 values used only
}; //};
}; } BombTrigger;
UINT8 ubBombOwner; // side which placed the bomb UINT8 ubBombOwner; // side which placed the bomb
UINT8 bActionValue;// this is used by the ACTION_ITEM fake item UINT8 bActionValue;// this is used by the ACTION_ITEM fake item
union union
{ {
struct //struct
{ //{
UINT8 ubTolerance; // tolerance value for panic triggers UINT8 ubTolerance; // tolerance value for panic triggers
}; //};
struct //struct
{ //{
UINT8 ubLocationID; // location value for remote non-bomb (special!) triggers UINT8 ubLocationID; // location value for remote non-bomb (special!) triggers
}; //};
}; } Area;
}; } Trigger;
struct struct
{ {
INT8 bKeyStatus[ 6 ]; INT8 bKeyStatus[ 6 ];
UINT8 ubKeyID; UINT8 ubKeyID;
UINT8 ubKeyUnused[1]; UINT8 ubKeyUnused[1];
}; } Key;
struct struct
{ {
UINT8 ubOwnerProfile; UINT8 ubOwnerProfile;
UINT8 ubOwnerCivGroup; UINT8 ubOwnerCivGroup;
UINT8 ubOwnershipUnused[6]; UINT8 ubOwnershipUnused[6];
}; } Owner;
}; } ItemData;
// attached objects // attached objects
UINT16 usAttachItem[MAX_ATTACHMENTS]; UINT16 usAttachItem[MAX_ATTACHMENTS];
INT8 bAttachStatus[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( UINT16 usItem, UINT8 ubPercentStandard );
UINT16 RandomMagazine( OBJECTTYPE * pGun, UINT8 ubPercentStandard ); UINT16 RandomMagazine( OBJECTTYPE * pGun, UINT8 ubPercentStandard );
extern BOOLEAN ReloadGun( SOLDIERTYPE * pSoldier, OBJECTTYPE * pGun, OBJECTTYPE * pAmmo ); extern BOOLEAN ReloadGun( SOLDIERTYPE * pSoldier, OBJECTTYPE * pGun, OBJECTTYPE * pAmmo );
extern BOOLEAN UnloadGun( SOLDIERTYPE * pSoldier, OBJECTTYPE * pGun);
UINT8 ItemSlotLimit( UINT16 usItem, INT8 bSlot ); 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 (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! // there's the key we want!
return( TRUE ); return( TRUE );
+19 -19
View File
@@ -1998,7 +1998,7 @@ BOOLEAN BulletHitMerc( BULLET * pBullet, STRUCTURE * pStructure, BOOLEAN fIntend
} }
else 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 // 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! // 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 == 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 // lucky bastard was wearing protective stuff
bHeadSlot = HEAD1POS; 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 // lucky bastard was wearing protective stuff
bHeadSlot = HEAD2POS; bHeadSlot = HEAD2POS;
@@ -2204,10 +2204,10 @@ BOOLEAN BulletHitMerc( BULLET * pBullet, STRUCTURE * pStructure, BOOLEAN fIntend
{ {
if (bHeadSlot != NO_SLOT) if (bHeadSlot != NO_SLOT)
{ {
pTarget->inv[ bHeadSlot ].bStatus[ 0 ] -= (INT8) ( (iImpact / 2) + Random( (iImpact / 2) ) ); pTarget->inv[ bHeadSlot ].ItemData.Generic.bStatus[ 0 ] -= (INT8) ( (iImpact / 2) + Random( (iImpact / 2) ) );
if ( pTarget->inv[ bHeadSlot ].bStatus[ 0 ] <= USABLE ) 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 ]) ); DeleteObj( &(pTarget->inv[ bHeadSlot ]) );
DirtyMercPanelInterface( pTarget, DIRTYLEVEL2 ); DirtyMercPanelInterface( pTarget, DIRTYLEVEL2 );
@@ -2222,11 +2222,11 @@ BOOLEAN BulletHitMerc( BULLET * pBullet, STRUCTURE * pStructure, BOOLEAN fIntend
bHeadSlot = HEAD1POS + (INT8) Random( 2 ); bHeadSlot = HEAD1POS + (INT8) Random( 2 );
if ( pTarget->inv[ bHeadSlot ].usItem != NOTHING ) if ( pTarget->inv[ bHeadSlot ].usItem != NOTHING )
{ {
pTarget->inv[ bHeadSlot ].bStatus[ 0 ] -= (INT8) ( Random( iImpact / 2 ) ); pTarget->inv[ bHeadSlot ].ItemData.Generic.bStatus[ 0 ] -= (INT8) ( Random( iImpact / 2 ) );
if ( pTarget->inv[ bHeadSlot ].bStatus[ 0 ] < 0 ) if ( pTarget->inv[ bHeadSlot ].ItemData.Generic.bStatus[ 0 ] < 0 )
{ {
// just break it... // 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 ) //else if ( pBullet->usFlags & BULLET_FLAG_SMALL_MISSILE )
//{ //{
// stops if using HE ammo // 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; *pfHit = TRUE;
return( 0 ); return( 0 );
@@ -2481,7 +2481,7 @@ INT32 HandleBulletStructureInteraction( BULLET * pBullet, STRUCTURE * pStructure
pDoor = FindDoorInfoAtGridNo( pBullet->sGridNo ); pDoor = FindDoorInfoAtGridNo( pBullet->sGridNo );
// Does it have a lock? // 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! // WANNE: bugfix: No door returned, so the game crashes!
if (pDoor) if (pDoor)
@@ -2545,7 +2545,7 @@ INT32 HandleBulletStructureInteraction( BULLET * pBullet, STRUCTURE * pStructure
iImpactReduction = gubMaterialArmour[ pStructure->pDBStructureRef->pDBStructure->ubArmour ]; iImpactReduction = gubMaterialArmour[ pStructure->pDBStructureRef->pDBStructure->ubArmour ];
iImpactReduction = StructureResistanceIncreasedByRange( iImpactReduction, pBullet->iRange, pBullet->iLoop ); 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) //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 ) //else if ( pBullet->usFlags & BULLET_FLAG_SMALL_MISSILE )
//{ //{
// stops if using HE ammo // 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 ); 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 = gubMaterialArmour[ pStructure->pDBStructureRef->pDBStructure->ubArmour ] * pStructure->pDBStructureRef->pDBStructure->ubDensity / 100;
iImpactReduction = StructureResistanceIncreasedByRange( iImpactReduction, pBullet->iRange, pBullet->iLoop ); 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) //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; usBulletFlags |= BULLET_FLAG_FLAME;
ubSpreadIndex = 2; 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; //usBulletFlags |= BULLET_FLAG_TRACER;
fTracer = TRUE; 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 // shotgun pellets fire 9 bullets doing 1/4 damage each
if (!fFake) 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! // but you can't really aim the damn things very well!
if (sHitBy > 0) if (sHitBy > 0)
{ {
@@ -3640,7 +3640,7 @@ INT8 FireBulletGivenTarget( SOLDIERTYPE * pFirer, FLOAT dEndX, FLOAT dEndY, FLOA
} }
// ubImpact = AMMO_DAMAGE_ADJUSTMENT_BUCKSHOT( ubImpact ); // 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 ) 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 // 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 shotgun, shotgun would have to be in main hand
if ( pFirer->inv[ HANDPOS ].usItem == pFirer->usAttackingWeapon ) 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; fBuckShot = TRUE;
} }
+1 -1
View File
@@ -138,7 +138,7 @@ INT8 HireMerc( MERC_HIRE_STRUCT *pHireMerc)
memset( &Object, 0, sizeof( OBJECTTYPE ) ); memset( &Object, 0, sizeof( OBJECTTYPE ) );
Object.usItem = LETTER; Object.usItem = LETTER;
Object.ubNumberOfObjects = 1; Object.ubNumberOfObjects = 1;
Object.bStatus[0] = 100; Object.ItemData.Generic.bStatus[0] = 100;
// Give it // Give it
fReturn = AutoPlaceObject( MercPtrs[iNewIndex], &Object, FALSE ); fReturn = AutoPlaceObject( MercPtrs[iNewIndex], &Object, FALSE );
Assert( fReturn ); Assert( fReturn );
+12 -2
View File
@@ -222,6 +222,11 @@ void PrepareMilitiaForTactical( BOOLEAN fPrepareAll)
if ( gWorldSectorX ==0 && gWorldSectorY == 0 ) if ( gWorldSectorX ==0 && gWorldSectorY == 0 )
return; 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 ) ]; pSector = &SectorInfo[ SECTOR( gWorldSectorX, gWorldSectorY ) ];
ubGreen = pSector->ubNumberOfCivsAtLevel[ GREEN_MILITIA ]; ubGreen = pSector->ubNumberOfCivsAtLevel[ GREEN_MILITIA ];
ubRegs = pSector->ubNumberOfCivsAtLevel[ REGULAR_MILITIA ]; ubRegs = pSector->ubNumberOfCivsAtLevel[ REGULAR_MILITIA ];
@@ -248,8 +253,8 @@ void PrepareMilitiaForTactical( BOOLEAN fPrepareAll)
ubElites -= gpAttackDirs[ x ][2]; ubElites -= gpAttackDirs[ x ][2];
} }
} }
else //else
{ //{
#endif #endif
AddSoldierInitListMilitiaOnEdge( gpAttackDirs[ x ][ 3 ], gpAttackDirs[ x ][0], gpAttackDirs[ x ][1], gpAttackDirs[ x ][2] ); 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; //// 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 ) 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) 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 ) if ( fDisplay )
{ {
@@ -1638,7 +1638,7 @@ BOOLEAN EnoughAmmo( SOLDIERTYPE *pSoldier, BOOLEAN fDisplay, INT8 bInvPos )
//<SB> manual recharge //<SB> manual recharge
if( pSoldier->bTeam == OUR_TEAM ) 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 ); return( FALSE );
} }
@@ -1677,11 +1677,11 @@ void DeductAmmo( SOLDIERTYPE *pSoldier, INT8 bInvPos )
if ( pSoldier->usAttackingWeapon == pObj->usItem) if ( pSoldier->usAttackingWeapon == pObj->usItem)
{ {
// OK, let's see, don't overrun... // 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 //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])); pSoldier->inv[HANDPOS].ubWeight = CalculateObjectWeight( &(pSoldier->inv[HANDPOS]));
} }
@@ -1823,7 +1823,7 @@ INT8 GetAPsToAutoReload( SOLDIERTYPE * pSoldier )
pObj = &(pSoldier->inv[HANDPOS]); pObj = &(pSoldier->inv[HANDPOS]);
//<SB> manual recharge //<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; 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 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->ItemData.Generic.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] = 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 //Since money is always evaluated
PlayersOfferArea[ ubSelectedInvSlot ].uiFlags |= ARMS_INV_PLAYERS_ITEM_HAS_VALUE; 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 else // slot is empty
@@ -2759,7 +2759,7 @@ UINT32 DisplayInvSlot( UINT8 ubSlotNum, UINT16 usItemIndex, UINT16 usPosX, UINT1
} }
// Display 'JAMMED' if it's jammed // Display 'JAMMED' if it's jammed
if ( pItemObject->bGunAmmoStatus < 0 ) if ( pItemObject->ItemData.Gun.bGunAmmoStatus < 0 )
{ {
swprintf( zTemp, TacticalStr[ JAMMED_ITEM_STR ] ); swprintf( zTemp, TacticalStr[ JAMMED_ITEM_STR ] );
VarFindFontCenterCoordinates( usPosX, usPosY, SKI_INV_SLOT_WIDTH, SKI_INV_HEIGHT, TINYFONT1, &sCenX, &sCenY, zTemp ); 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 ) ) if ( CanDealerRepairItem( gbSelectedArmsDealerID, RepairItem.ItemObject.usItem ) )
{ {
// make its condition 100% // make its condition 100%
RepairItem.ItemObject.bStatus[ 0 ] = 100; RepairItem.ItemObject.ItemData.Generic.bStatus[ 0 ] = 100;
} }
// max condition of all permanent attachments on it // max condition of all permanent attachments on it
@@ -3096,25 +3096,25 @@ UINT32 CalcShopKeeperItemPrice( BOOLEAN fDealerSelling, BOOLEAN fUnitPriceOnly,
case IC_GUN: case IC_GUN:
// add value of the gun // add value of the gun
uiUnitPrice += (UINT32)( CalcValueOfItemToDealer( gbSelectedArmsDealerID, usItemID, fDealerSelling ) * uiUnitPrice += (UINT32)( CalcValueOfItemToDealer( gbSelectedArmsDealerID, usItemID, fDealerSelling ) *
ItemConditionModifier(usItemID, pItemObject->bGunStatus) * ItemConditionModifier(usItemID, pItemObject->ItemData.Gun.bGunStatus) *
dModifier ); dModifier );
// if any ammo is loaded // if any ammo is loaded
if( pItemObject->usGunAmmoItem != NONE) if( pItemObject->ItemData.Gun.usGunAmmoItem != NONE)
{ {
// if it's regular ammo // 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 // add value of its remaining ammo
uiUnitPrice += (UINT32)( CalcValueOfItemToDealer( gbSelectedArmsDealerID, pItemObject->usGunAmmoItem, fDealerSelling ) * uiUnitPrice += (UINT32)( CalcValueOfItemToDealer( gbSelectedArmsDealerID, pItemObject->ItemData.Gun.usGunAmmoItem, fDealerSelling ) *
ItemConditionModifier(pItemObject->usGunAmmoItem, pItemObject->ubGunShotsLeft) * ItemConditionModifier(pItemObject->ItemData.Gun.usGunAmmoItem, pItemObject->ItemData.Gun.ubGunShotsLeft) *
dModifier ); dModifier );
} }
else // assume it's attached ammo (mortar shells, grenades) else // assume it's attached ammo (mortar shells, grenades)
{ {
// add its value (uses normal status 0-100) // add its value (uses normal status 0-100)
uiUnitPrice += (UINT32)( CalcValueOfItemToDealer( gbSelectedArmsDealerID, pItemObject->usGunAmmoItem, fDealerSelling ) * uiUnitPrice += (UINT32)( CalcValueOfItemToDealer( gbSelectedArmsDealerID, pItemObject->ItemData.Gun.usGunAmmoItem, fDealerSelling ) *
ItemConditionModifier(pItemObject->usGunAmmoItem, pItemObject->bGunAmmoStatus) * ItemConditionModifier(pItemObject->ItemData.Gun.usGunAmmoItem, pItemObject->ItemData.Gun.bGunAmmoStatus) *
dModifier ); dModifier );
} }
} }
@@ -3145,7 +3145,7 @@ UINT32 CalcShopKeeperItemPrice( BOOLEAN fDealerSelling, BOOLEAN fUnitPriceOnly,
{ {
// for bullets, ItemConditionModifier will convert the #ShotsLeft into a percentage // for bullets, ItemConditionModifier will convert the #ShotsLeft into a percentage
uiUnitPrice += (UINT32)( CalcValueOfItemToDealer( gbSelectedArmsDealerID, usItemID, fDealerSelling ) * uiUnitPrice += (UINT32)( CalcValueOfItemToDealer( gbSelectedArmsDealerID, usItemID, fDealerSelling ) *
ItemConditionModifier(usItemID, pItemObject->ubShotsLeft[ubCnt]) * ItemConditionModifier(usItemID, pItemObject->ItemData.Ammo.ubShotsLeft[ubCnt]) *
dModifier ); dModifier );
if ( fUnitPriceOnly ) if ( fUnitPriceOnly )
@@ -3176,7 +3176,7 @@ UINT32 CalcShopKeeperItemPrice( BOOLEAN fDealerSelling, BOOLEAN fUnitPriceOnly,
{ {
// for bullets, ItemConditionModifier will convert the #ShotsLeft into a percentage // for bullets, ItemConditionModifier will convert the #ShotsLeft into a percentage
uiUnitPrice += (UINT32)( CalcValueOfItemToDealer( gbSelectedArmsDealerID, usItemID, fDealerSelling ) * uiUnitPrice += (UINT32)( CalcValueOfItemToDealer( gbSelectedArmsDealerID, usItemID, fDealerSelling ) *
ItemConditionModifier(usItemID, pItemObject->bStatus[ ubCnt ]) * ItemConditionModifier(usItemID, pItemObject->ItemData.Generic.bStatus[ ubCnt ]) *
dModifier ); dModifier );
if ( fUnitPriceOnly ) if ( fUnitPriceOnly )
@@ -3525,7 +3525,7 @@ INT8 AddItemToPlayersOfferArea( UINT8 ubProfileID, INVENTORY_IN_SLOT* pInvSlot,
{ {
//Since money is always evaluated //Since money is always evaluated
PlayersOfferArea[ bCnt ].uiFlags |= ARMS_INV_PLAYERS_ITEM_HAS_VALUE; 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; gubSkiDirtyLevel = SKI_DIRTY_LEVEL2;
@@ -3596,8 +3596,8 @@ void DisplayPlayersOfferArea()
sSoldierID = GetSoldierIDFromMercID( PlayersOfferArea[ sCnt ].ubIdOfMercWhoOwnsTheItem ); sSoldierID = GetSoldierIDFromMercID( PlayersOfferArea[ sCnt ].ubIdOfMercWhoOwnsTheItem );
Assert(sSoldierID != -1); Assert(sSoldierID != -1);
PlayersOfferArea[ sCnt ].ItemObject.uiMoneyAmount = Menptr[ sSoldierID ].inv[ PlayersOfferArea[ sCnt ].bSlotIdInOtherLocation ].uiMoneyAmount; PlayersOfferArea[ sCnt ].ItemObject.ItemData.Money.uiMoneyAmount = Menptr[ sSoldierID ].inv[ PlayersOfferArea[ sCnt ].bSlotIdInOtherLocation ].ItemData.Money.uiMoneyAmount;
PlayersOfferArea[ sCnt ].uiItemPrice = PlayersOfferArea[ sCnt ].ItemObject.uiMoneyAmount; PlayersOfferArea[ sCnt ].uiItemPrice = PlayersOfferArea[ sCnt ].ItemObject.ItemData.Money.uiMoneyAmount;
} }
} }
else // not money else // not money
@@ -3734,7 +3734,7 @@ UINT32 CalculateTotalPlayersValue()
{ {
//Calculate a price for the item //Calculate a price for the item
if( Item[ PlayersOfferArea[ ubCnt ].sItemIndex ].usItemClass == IC_MONEY ) if( Item[ PlayersOfferArea[ ubCnt ].sItemIndex ].usItemClass == IC_MONEY )
uiTotal += PlayersOfferArea[ ubCnt ].ItemObject.uiMoneyAmount; uiTotal += PlayersOfferArea[ ubCnt ].ItemObject.ItemData.Money.uiMoneyAmount;
else else
uiTotal += PlayersOfferArea[ ubCnt ].uiItemPrice; uiTotal += PlayersOfferArea[ ubCnt ].uiItemPrice;
} }
@@ -4058,7 +4058,7 @@ void MovePlayerOfferedItemsOfValueToArmsDealersInventory()
if( Item[ PlayersOfferArea[ uiCnt ].sItemIndex ].usItemClass == IC_MONEY ) if( Item[ PlayersOfferArea[ uiCnt ].sItemIndex ].usItemClass == IC_MONEY )
{ {
//add the money to the dealers 'cash' //add the money to the dealers 'cash'
gArmsDealerStatus[ gbSelectedArmsDealerID ].uiArmsDealersCash += PlayersOfferArea[ uiCnt ].ItemObject.uiMoneyAmount; gArmsDealerStatus[ gbSelectedArmsDealerID ].uiArmsDealersCash += PlayersOfferArea[ uiCnt ].ItemObject.ItemData.Money.uiMoneyAmount;
} }
else else
{ {
@@ -4457,7 +4457,7 @@ INT8 AddInventoryToSkiLocation( INVENTORY_IN_SLOT *pInv, UINT8 ubSpotLocation, U
{ {
//Since money is always evaluated //Since money is always evaluated
PlayersOfferArea[ ubSpotLocation ].uiFlags |= ARMS_INV_PLAYERS_ITEM_HAS_VALUE; 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 ); SetSkiRegionHelpText( &PlayersOfferArea[ ubSpotLocation ], &gPlayersOfferSlotsMouseRegions[ ubSpotLocation ], PLAYERS_OFFER_AREA );
@@ -5759,7 +5759,7 @@ UINT32 CalculateHowMuchMoneyIsInPlayersOfferArea( )
{ {
if( Item[ PlayersOfferArea[ ubCnt ].sItemIndex ].usItemClass == IC_MONEY ) 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++) for( ubCnt=0; ubCnt < NUM_INV_SLOTS; ubCnt++)
{ {
// Look for MONEY only, not Gold or Silver!!! And look for a slot not already full // 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 ); 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 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; INT8 bSlotAddedTo;
@@ -5960,7 +5960,7 @@ void EvaluateItemAddedToPlayersOfferArea( INT8 bSlotID, BOOLEAN fFirstOne )
// check if the item is really badly damaged // check if the item is really badly damaged
if( Item[ ArmsDealerOfferArea[ bSlotAddedTo ].sItemIndex ].usItemClass != IC_AMMO ) 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; 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! // 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 if ( !Item[pComplexObject->usItem].singleshotrocketlauncher ) // Madd rpg - still do this
{ {
pNextObj->ubGunShotsLeft = 0; pNextObj->ItemData.Gun.ubGunShotsLeft = 0;
pNextObj->usGunAmmoItem = NONE; 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 /* 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 ) if ( Item [ pComplexObject->usItem ].usItemClass == IC_GUN )
{ {
// and it has ammo/payload // and it has ammo/payload
if ( pComplexObject->usGunAmmoItem != NONE ) if ( pComplexObject->ItemData.Gun.usGunAmmoItem != NONE )
{ {
// if it's bullets // 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 // and there are some left
if ( pComplexObject->ubGunShotsLeft > 0 ) if ( pComplexObject->ItemData.Gun.ubGunShotsLeft > 0 )
{ {
// make the bullets into another subobject // make the bullets into another subobject
CreateItem( pComplexObject->usGunAmmoItem, 100, pNextObj ); CreateItem( pComplexObject->ItemData.Gun.usGunAmmoItem, 100, pNextObj );
// set how many are left // set how many are left
pNextObj->bStatus[ 0 ] = pComplexObject->ubGunShotsLeft; pNextObj->ItemData.Generic.bStatus[ 0 ] = pComplexObject->ItemData.Gun.ubGunShotsLeft;
pNextObj = &gSubObject[ ++ubNextFreeSlot ]; pNextObj = &gSubObject[ ++ubNextFreeSlot ];
} }
@@ -6733,12 +6733,12 @@ void SplitComplexObjectIntoSubObjects( OBJECTTYPE *pComplexObject )
else // non-ammo payload else // non-ammo payload
{ {
// make the payload into another subobject // 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 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 ]; pNextObj = &gSubObject[ ++ubNextFreeSlot ];
@@ -6777,7 +6777,7 @@ void SplitComplexObjectIntoSubObjects( OBJECTTYPE *pComplexObject )
// make each item in the stack into a separate subobject // make each item in the stack into a separate subobject
for( ubCnt = 0; ubCnt < pComplexObject->ubNumberOfObjects; ubCnt++ ) 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 // advance to next available subobject
pNextObj = &gSubObject[ ++ubNextFreeSlot ]; 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? // 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 // 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 ) ) CanDealerRepairItem( gbSelectedArmsDealerID, gSubObject[ ubSubObject ].usItem ) )
{ {
@@ -7040,7 +7040,7 @@ BOOLEAN SKITryToAddInvToMercsInventory( INVENTORY_IN_SLOT *pInv, SOLDIERTYPE *pS
PlaceObject( pSoldier, bMoneyInvPos, &( pInv->ItemObject ) ); PlaceObject( pSoldier, bMoneyInvPos, &( pInv->ItemObject ) );
// if the money is all gone // if the money is all gone
if ( pInv->ItemObject.uiMoneyAmount == 0 ) if ( pInv->ItemObject.ItemData.Money.uiMoneyAmount == 0 )
{ {
// we've been succesful! // we've been succesful!
return(TRUE); return(TRUE);
@@ -7635,7 +7635,7 @@ UINT32 EvaluateInvSlot( INVENTORY_IN_SLOT *pInvSlot )
// check if the item is really badly damaged // check if the item is really badly damaged
if( Item[ pInvSlot->sItemIndex ].usItemClass != IC_AMMO ) 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; 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... // this should never happen, but might as well check...
iSkill = 0; iSkill = 0;
} }
iSkill = iSkill * pSoldier->inv[bSlot].bStatus[0] / 100; iSkill = iSkill * pSoldier->inv[bSlot].ItemData.Generic.bStatus[0] / 100;
break; break;
case ATTACHING_DETONATOR_CHECK: case ATTACHING_DETONATOR_CHECK:
case ATTACHING_REMOTE_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 ) if( pSoldier->sInsertionGridNo == NOWHERE )
{ //Add the soldier to the respective entrypoint. This is an error condition. { //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 ) 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.. ) // 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 we have 2 pistols, donot go back!
if ( Item[ pSoldier->inv[ SECONDHANDPOS ].usItem ].usItemClass != IC_GUN ) 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; BOOLEAN fSetGassed = TRUE;
// If we have a functioning gas mask... // 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; fSetGassed = FALSE;
} }
@@ -4092,7 +4092,7 @@ void EVENT_SoldierGotHit( SOLDIERTYPE *pSoldier, UINT16 usWeaponIndex, INT16 sDa
} }
// callahan update end // 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 ) 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 // marke added one 'or' for explosive ammo. variation of: AmmoTypes[pSoldier->inv[pSoldier->ubAttackingHand ].ubGunAmmoType].explosionSize > 1
// extracting attacker´s ammo type // 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; INT8 bDeafValue;
@@ -11736,8 +11736,8 @@ BOOLEAN IsValidSecondHandShot( SOLDIERTYPE *pSoldier )
!pSoldier->bDoBurst && !pSoldier->bDoBurst &&
!Item[pSoldier->inv[ HANDPOS ].usItem].grenadelauncher && !Item[pSoldier->inv[ HANDPOS ].usItem].grenadelauncher &&
Item[ pSoldier->inv[HANDPOS].usItem ].usItemClass == IC_GUN && 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 ) pSoldier->inv[SECONDHANDPOS].ItemData.Gun.ubGunShotsLeft > 0 )
{ {
return( TRUE ); return( TRUE );
} }
@@ -11753,7 +11753,7 @@ BOOLEAN IsValidSecondHandShotForReloadingPurposes( SOLDIERTYPE *pSoldier )
!pSoldier->bDoBurst && !pSoldier->bDoBurst &&
!Item[pSoldier->inv[ HANDPOS ].usItem].grenadelauncher && !Item[pSoldier->inv[ HANDPOS ].usItem].grenadelauncher &&
Item[ pSoldier->inv[HANDPOS].usItem ].usItemClass == IC_GUN && 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 && // pSoldier->inv[SECONDHANDPOS].ubGunShotsLeft > 0 &&
// gAnimControl[ pSoldier->usAnimState ].ubEndHeight != ANIM_PRONE ) // 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 ) if ( pCreateStruct->ubProfile != NO_PROFILE )
CopyProfileItems( &Soldier, pCreateStruct ); CopyProfileItems( &Soldier, pCreateStruct );
@@ -2712,12 +2712,12 @@ void CopyProfileItems( SOLDIERTYPE *pSoldier, SOLDIERCREATE_STRUCT *pCreateStruc
if ( uiMoneyLeft > uiMoneyLimitInSlot ) if ( uiMoneyLeft > uiMoneyLimitInSlot )
{ {
// fill pocket with money // fill pocket with money
pSoldier->inv[ bSlot ].uiMoneyAmount = uiMoneyLimitInSlot; pSoldier->inv[ bSlot ].ItemData.Money.uiMoneyAmount = uiMoneyLimitInSlot;
uiMoneyLeft -= uiMoneyLimitInSlot; uiMoneyLeft -= uiMoneyLimitInSlot;
} }
else else
{ {
pSoldier->inv[ bSlot ].uiMoneyAmount = uiMoneyLeft; pSoldier->inv[ bSlot ].ItemData.Money.uiMoneyAmount = uiMoneyLeft;
// done! // done!
break; break;
} }
+9 -7
View File
@@ -541,19 +541,21 @@ BOOLEAN AddPlacementToWorld( SOLDIERINITNODE *curr, GROUP *pGroup = NULL )
if (curr->pBasicPlacement->bBodyType == TANK_NW || if (curr->pBasicPlacement->bBodyType == TANK_NW ||
curr->pBasicPlacement->bBodyType == TANK_NE) 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) if (pCorpse)
{ {
// Assume this is a dead tank and have the replacement tank haul it away // Assume this is a dead tank and have the replacement tank haul it away
RemoveCorpse( pCorpse->iID); RemoveCorpse( pCorpse->iID);
} }
else //else
{ //{
break; //break;
} //}
} } while (pCorpse);
} }
DebugMsg(TOPIC_JA2,DBG_LEVEL_3,String("AddPlacementToWorld: decide on placement")); DebugMsg(TOPIC_JA2,DBG_LEVEL_3,String("AddPlacementToWorld: decide on placement"));
+2 -2
View File
@@ -611,7 +611,7 @@ void MakeRemainingTerroristsTougher( void )
DeleteObj( &Object ); DeleteObj( &Object );
Object.usItem = usNewItem; Object.usItem = usNewItem;
Object.bStatus[ 0 ] = 100; Object.ItemData.Generic.bStatus[ 0 ] = 100;
for ( ubLoop = 0; ubLoop < NUM_TERRORISTS; ubLoop++ ) for ( ubLoop = 0; ubLoop < NUM_TERRORISTS; ubLoop++ )
{ {
@@ -745,7 +745,7 @@ void MakeRemainingAssassinsTougher( void )
DeleteObj( &Object ); DeleteObj( &Object );
Object.usItem = usNewItem; Object.usItem = usNewItem;
Object.bStatus[ 0 ] = 100; Object.ItemData.Generic.bStatus[ 0 ] = 100;
for ( ubLoop = 0; ubLoop < NUM_ASSASSINS; ubLoop++ ) for ( ubLoop = 0; ubLoop < NUM_ASSASSINS; ubLoop++ )
{ {
+1 -1
View File
@@ -144,7 +144,7 @@ void PickBurstLocations( SOLDIERTYPE *pSoldier )
pSoldier->bDoAutofire++; pSoldier->bDoAutofire++;
sAPCosts = CalcTotalAPsToAttack( pSoldier, gsBurstLocations[0].sGridNo, TRUE, 0); 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--; pSoldier->bDoAutofire--;
ubShotsPerBurst = __min(pSoldier->bDoAutofire,MAX_BURST_SPREAD_TARGETS); 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 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].ItemData.Generic.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] = 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++; 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 if (( Item[ gWorldItems[ uiLoop ].o.usItem ].usItemClass == IC_GUN ) && (gGameExternalOptions.gfShiftFUnloadWeapons == TRUE) )//item is a gun and unloading is allowed
{ {
//Remove magazine //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 OBJECTTYPE newObj; //Create object
CreateItem(gWorldItems[ uiLoop ].o.usGunAmmoItem, 100, &newObj); CreateItem(gWorldItems[ uiLoop ].o.ItemData.Gun.usGunAmmoItem, 100, &newObj);
newObj.ubShotsLeft[0] = gWorldItems[ uiLoop ].o.ubGunShotsLeft; newObj.ItemData.Ammo.ubShotsLeft[0] = gWorldItems[ uiLoop ].o.ItemData.Gun.ubGunShotsLeft;
gWorldItems[ uiLoop ].o.ubGunShotsLeft = 0; gWorldItems[ uiLoop ].o.ItemData.Gun.ubGunShotsLeft = 0;
gWorldItems[ uiLoop ].o.usGunAmmoItem = NONE; gWorldItems[ uiLoop ].o.ItemData.Gun.usGunAmmoItem = NONE;
// put it on the ground // put it on the ground
AddItemToPool( gWorldItems[ uiLoop ].sGridNo, &newObj, 1, gWorldItems[ uiLoop ].ubLevel, 0 , -1 ); AddItemToPool( gWorldItems[ uiLoop ].sGridNo, &newObj, 1, gWorldItems[ uiLoop ].ubLevel, 0 , -1 );
@@ -3103,10 +3103,10 @@ void GetKeyboardInput( UINT32 *puiNewEvent )
tempStatus = pObj->bAttachStatus[bSlot3]; tempStatus = pObj->bAttachStatus[bSlot3];
// Replace helmet attachment with face slot // Replace helmet attachment with face slot
pObj->usAttachItem[bSlot3] = pTeamSoldier->inv[bSlot1].usItem; 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 // Replace face slot with helmet attachment from temp
pTeamSoldier->inv[bSlot1].usItem = tempItem; 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 ) else if ( bSlot2 != ITEM_NOT_FOUND )
{ {
@@ -3146,10 +3146,10 @@ void GetKeyboardInput( UINT32 *puiNewEvent )
tempStatus = pObj->bAttachStatus[bSlot3]; tempStatus = pObj->bAttachStatus[bSlot3];
// Replace helmet attachment with face slot // Replace helmet attachment with face slot
pObj->usAttachItem[bSlot3] = pTeamSoldier->inv[bSlot1].usItem; 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 // Replace face slot with helmet attachment from temp
pTeamSoldier->inv[bSlot1].usItem = tempItem; 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 ) else if ( bSlot2 != ITEM_NOT_FOUND )
{ {
@@ -3302,7 +3302,7 @@ void GetKeyboardInput( UINT32 *puiNewEvent )
{ {
pGun = &(pTeamSoldier->inv[bLoop2]); pGun = &(pTeamSoldier->inv[bLoop2]);
//if magazine is not full //if magazine is not full
if ( pGun->ubGunShotsLeft < GetMagSize( pGun ) ) if ( pGun->ItemData.Gun.ubGunShotsLeft < GetMagSize( pGun ) )
{ {
// Search for ammo in sector // Search for ammo in sector
@@ -3317,12 +3317,12 @@ void GetKeyboardInput( UINT32 *puiNewEvent )
if ( CompatibleAmmoForGun( pAmmo, pGun ) ) // can use the ammo with this gun if ( CompatibleAmmoForGun( pAmmo, pGun ) ) // can use the ammo with this gun
{ {
// same ammo type in gun and magazine // 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 ); ReloadGun( pTeamSoldier, pGun, pAmmo );
} }
if (pAmmo->ubShotsLeft[0] == 0) if (pAmmo->ItemData.Ammo.ubShotsLeft[0] == 0)
{ {
RemoveItemFromPool( gWorldItems[ uiLoop ].sGridNo, uiLoop, gWorldItems[ uiLoop ].ubLevel ); RemoveItemFromPool( gWorldItems[ uiLoop ].sGridNo, uiLoop, gWorldItems[ uiLoop ].ubLevel );
} }
@@ -3353,7 +3353,7 @@ void GetKeyboardInput( UINT32 *puiNewEvent )
pGun = &(pTeamSoldier->inv[HANDPOS]); pGun = &(pTeamSoldier->inv[HANDPOS]);
//magazine is not full //magazine is not full
if ( pGun->ubGunShotsLeft < GetMagSize( pGun ) ) if ( pGun->ItemData.Gun.ubGunShotsLeft < GetMagSize( pGun ) )
{ {
AutoReload( pTeamSoldier ); AutoReload( pTeamSoldier );
} }
@@ -3367,7 +3367,7 @@ void GetKeyboardInput( UINT32 *puiNewEvent )
{ {
pGun = &(pTeamSoldier->inv[bLoop2]); pGun = &(pTeamSoldier->inv[bLoop2]);
//if magazine is not full //if magazine is not full
if ( pGun->ubGunShotsLeft < GetMagSize( pGun ) ) if ( pGun->ItemData.Gun.ubGunShotsLeft < GetMagSize( pGun ) )
{ {
// Search for ammo in soldier inventory // 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 if ( CompatibleAmmoForGun( pAmmo, pGun ) ) // can use the ammo with this gun
{ {
// same ammo type in gun and magazine // 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 ); ReloadGun( pTeamSoldier, pGun, pAmmo );
@@ -4689,7 +4689,7 @@ void GrenadeTest1()
{ {
OBJECTTYPE Object; OBJECTTYPE Object;
Object.usItem = MUSTARD_GRENADE; Object.usItem = MUSTARD_GRENADE;
Object.bStatus[ 0 ] = 100; Object.ItemData.Generic.bStatus[ 0 ] = 100;
Object.ubNumberOfObjects = 1; 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 ); 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; OBJECTTYPE Object;
Object.usItem = HAND_GRENADE; Object.usItem = HAND_GRENADE;
Object.bStatus[ 0 ] = 100; Object.ItemData.Generic.bStatus[ 0 ] = 100;
Object.ubNumberOfObjects = 1; 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 ); 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; OBJECTTYPE Object;
Object.usItem = HAND_GRENADE; Object.usItem = HAND_GRENADE;
Object.bStatus[ 0 ] = 100; Object.ItemData.Generic.bStatus[ 0 ] = 100;
Object.ubNumberOfObjects = 1; 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 ); 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++; pSoldier->bDoAutofire++;
sAPCosts = CalcTotalAPsToAttack( pSoldier, usMapPos, TRUE, 0); 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--; pSoldier->bDoAutofire--;
} }
gfUIAutofireBulletCount = TRUE; gfUIAutofireBulletCount = TRUE;
gsBulletCount = pSoldier->bDoAutofire; 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 if(pSoldier->autofireLastStep) //set the orange tint on the numbers if we at the last step
gTintBulletCounts = TRUE; gTintBulletCounts = TRUE;
@@ -536,7 +536,7 @@ UINT8 HandleActivatedTargetCursor( SOLDIERTYPE *pSoldier, UINT16 usMapPos, BOOLE
pSoldier->bDoAutofire++; pSoldier->bDoAutofire++;
sAPCosts = CalcTotalAPsToAttack( pSoldier, gsBurstLocations[0].sGridNo, TRUE, 0); 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--; pSoldier->bDoAutofire--;
gsCurrentActionPoints = CalcTotalAPsToAttack( pSoldier, gsBurstLocations[0].sGridNo, TRUE, 0 ); 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 //Calculate how many bullets we need to fire to add at least one more AP
sAPCosts = sCurAPCosts = CalcTotalAPsToAttack( pSoldier, usMapPos, TRUE, 0); 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++; pSoldier->bDoAutofire++;
sAPCosts = CalcTotalAPsToAttack( pSoldier, usMapPos, TRUE, 0); sAPCosts = CalcTotalAPsToAttack( pSoldier, usMapPos, TRUE, 0);
@@ -2084,7 +2084,7 @@ void HandleRightClickAdjustCursor( SOLDIERTYPE *pSoldier, INT16 usMapPos )
pSoldier->bDoAutofire++; pSoldier->bDoAutofire++;
sAPCosts = CalcTotalAPsToAttack( pSoldier, usMapPos, TRUE, 0); 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--; pSoldier->bDoAutofire--;
sAPCosts = CalcTotalAPsToAttack( pSoldier, usMapPos, TRUE, 0); sAPCosts = CalcTotalAPsToAttack( pSoldier, usMapPos, TRUE, 0);
+43 -43
View File
@@ -961,7 +961,7 @@ INT32 EffectiveArmour( OBJECTTYPE * pObj )
return( 0 ); return( 0 );
} }
iValue = Armour[ Item[pObj->usItem].ubClassIndex ].ubProtection; 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 = FindAttachment( pObj, CERAMIC_PLATES );
bPlate = FindFirstArmourAttachment( pObj ); bPlate = FindFirstArmourAttachment( pObj );
@@ -1057,7 +1057,7 @@ INT32 ExplosiveEffectiveArmour( OBJECTTYPE * pObj )
return( 0 ); return( 0 );
} }
iValue = Armour[ Item[pObj->usItem].ubClassIndex ].ubProtection; 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 ) if ( Item[pObj->usItem].flakjacket )
{ {
// increase value for flak jackets! // increase value for flak jackets!
@@ -1156,13 +1156,13 @@ BOOLEAN CheckForGunJam( SOLDIERTYPE * pSoldier )
if ( Item[pSoldier->usAttackingWeapon].usItemClass == IC_GUN && !EXPLOSIVE_GUN( pSoldier->usAttackingWeapon ) ) if ( Item[pSoldier->usAttackingWeapon].usItemClass == IC_GUN && !EXPLOSIVE_GUN( pSoldier->usAttackingWeapon ) )
{ {
pObj = &(pSoldier->inv[pSoldier->ubAttackingHand]); pObj = &(pSoldier->inv[pSoldier->ubAttackingHand]);
if (pObj->bGunAmmoStatus > 0) if (pObj->ItemData.Gun.bGunAmmoStatus > 0)
{ {
// gun might jam, figure out the chance // gun might jam, figure out the chance
//iChance = (80 - pObj->bGunStatus); //iChance = (80 - pObj->bGunStatus);
//rain //rain
iChance = (80 - pObj->bGunStatus) + gGameExternalOptions.ubWeaponReliabilityReductionPerRainIntensity * gbCurrentRainIntensity; iChance = (80 - pObj->ItemData.Gun.bGunStatus) + gGameExternalOptions.ubWeaponReliabilityReductionPerRainIntensity * gbCurrentRainIntensity;
//end rain //end rain
@@ -1198,7 +1198,7 @@ BOOLEAN CheckForGunJam( SOLDIERTYPE * pSoldier )
gfNextFireJam = FALSE; gfNextFireJam = FALSE;
// jam! negate the gun ammo status. // jam! negate the gun ammo status.
pObj->bGunAmmoStatus *= -1; pObj->ItemData.Gun.bGunAmmoStatus *= -1;
// Deduct AMMO! // Deduct AMMO!
DeductAmmo( pSoldier, pSoldier->ubAttackingHand ); DeductAmmo( pSoldier, pSoldier->ubAttackingHand );
@@ -1207,14 +1207,14 @@ BOOLEAN CheckForGunJam( SOLDIERTYPE * pSoldier )
return( TRUE ); return( TRUE );
} }
} }
else if (pObj->bGunAmmoStatus < 0) else if (pObj->ItemData.Gun.bGunAmmoStatus < 0)
{ {
// try to unjam gun // 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) if (iResult > 0)
{ {
// yay! unjammed the gun // yay! unjammed the gun
pObj->bGunAmmoStatus *= -1; pObj->ItemData.Gun.bGunAmmoStatus *= -1;
// MECHANICAL/DEXTERITY GAIN: Unjammed a gun // MECHANICAL/DEXTERITY GAIN: Unjammed a gun
StatChange( pSoldier, MECHANAMT, 5, FALSE ); StatChange( pSoldier, MECHANAMT, 5, FALSE );
@@ -1581,7 +1581,7 @@ BOOLEAN UseGun( SOLDIERTYPE *pSoldier , INT16 sTargetGridNo )
else else
{ {
// ONLY DEDUCT FOR THE FIRST HAND when doing two-pistol attacks // 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 // only deduct APs when the main gun fires
if ( pSoldier->ubAttackingHand == HANDPOS ) if ( pSoldier->ubAttackingHand == HANDPOS )
@@ -1746,7 +1746,7 @@ BOOLEAN UseGun( SOLDIERTYPE *pSoldier , INT16 sTargetGridNo )
DeductAmmo( pSoldier, pSoldier->ubAttackingHand ); DeductAmmo( pSoldier, pSoldier->ubAttackingHand );
// ATE: Check if we should say quote... // 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 ) 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 // add base pts for taking a shot, whether it hits or misses
usExpGain += 3; 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 // reduce exp gain for two pistol shooting since both shots give xp
usExpGain = (usExpGain * 2) / 3; 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)); 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; fBuckshot = TRUE;
//switch ( pSoldier->inv[ pSoldier->ubAttackingHand ].ubGunAmmoType ) //switch ( pSoldier->inv[ pSoldier->ubAttackingHand ].ubGunAmmoType )
@@ -1875,7 +1875,7 @@ BOOLEAN UseGun( SOLDIERTYPE *pSoldier , INT16 sTargetGridNo )
{ {
if ( Item[usItemNum].singleshotrocketlauncher ) 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 ); DirtyMercPanelInterface( pSoldier, DIRTYLEVEL2 );
IgniteExplosion( pSoldier->ubID, (INT16)CenterX( pSoldier->sGridNo ), (INT16)CenterY( pSoldier->sGridNo ), 0, pSoldier->sGridNo, C1, pSoldier->bLevel ); 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 ) ); 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 ); 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 ].usGunAmmoItem = NONE; pSoldier->inv[pSoldier->ubAttackingHand ].ItemData.Gun.usGunAmmoItem = NONE;
} }
// Reduce again for attack end 'cause it has been incremented for a normal attack // 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 ) 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 ); DirtyMercPanelInterface( pSoldier, DIRTYLEVEL2 );
} }
@@ -1964,14 +1964,14 @@ BOOLEAN UseGun( SOLDIERTYPE *pSoldier , INT16 sTargetGridNo )
if ( Item[usItemNum].usItemClass == IC_GUN ) if ( Item[usItemNum].usItemClass == IC_GUN )
{ {
OBJECTTYPE *pGun = &(pSoldier->inv[pSoldier->ubAttackingHand]); 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); 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) // reduce monster smell (gunpowder smell)
@@ -1982,7 +1982,7 @@ BOOLEAN UseGun( SOLDIERTYPE *pSoldier , INT16 sTargetGridNo )
//<SB> manual recharge //<SB> manual recharge
if (Weapon[Item[usItemNum].ubClassIndex].APsToReloadManually > 0) 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> //<SB>
DebugMsg(TOPIC_JA2,DBG_LEVEL_3,String("UseGun: done")); DebugMsg(TOPIC_JA2,DBG_LEVEL_3,String("UseGun: done"));
return( TRUE ); return( TRUE );
@@ -2046,7 +2046,7 @@ BOOLEAN UseBlade( SOLDIERTYPE *pSoldier , INT16 sTargetGridNo )
iImpact = HTHImpact( pSoldier, pTargetSoldier, (iHitChance - iDiceRoll), TRUE ); iImpact = HTHImpact( pSoldier, pTargetSoldier, (iHitChance - iDiceRoll), TRUE );
// modify this by the knife's condition (if it's dull, not much good) // 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 // modify by hit location
AdjustImpactByHitLocation( iImpact, pSoldier->bAimShotLocation, &iImpact, &iImpactForCrits ); AdjustImpactByHitLocation( iImpact, pSoldier->bAimShotLocation, &iImpact, &iImpactForCrits );
@@ -2063,17 +2063,17 @@ BOOLEAN UseBlade( SOLDIERTYPE *pSoldier , INT16 sTargetGridNo )
iImpact = 1; iImpact = 1;
} }
if ( pSoldier->inv[ pSoldier->ubAttackingHand ].bStatus[ 0 ] > USABLE ) if ( pSoldier->inv[ pSoldier->ubAttackingHand ].ItemData.Generic.bStatus[ 0 ] > USABLE )
{ {
bMaxDrop = (iImpact / 20); bMaxDrop = (iImpact / 20);
// the duller they get, the slower they get any worse... // 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 // as long as its still > USABLE, it drops another point 1/2 the time
bMaxDrop = __max( bMaxDrop, 2 ); 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 // Send event for getting hit
@@ -2775,7 +2775,7 @@ BOOLEAN DoSpecialEffectAmmoMiss( UINT8 ubAttackerID, INT16 sGridNo, INT16 sXPos,
UINT8 ubAmmoType; UINT8 ubAmmoType;
UINT16 usItem; 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; usItem = MercPtrs[ ubAttackerID ]->inv[ MercPtrs[ ubAttackerID ]->ubAttackingHand ].usItem;
memset( &AniParams, 0, sizeof( ANITILE_PARAMS ) ); 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 ); MakeNoise( ubAttackerID, pTargetSoldier->sGridNo, pTargetSoldier->bLevel, gpWorldLevelData[pTargetSoldier->sGridNo].ubTerrainID, Weapon[ usWeaponIndex ].ubHitVolume, NOISE_BULLET_IMPACT );
// CALLAHAN START BUGFIX // 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 // CALLAHAN END BUGFIX
{ {
// Reduce attacker count! // 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 //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 // marke test mag ammo type: pSoldier->inv[pSoldier->ubAttackingHand ].ubGunAmmoType
// 2cond 'or' added // 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 ) 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 ) ); 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 ); IgniteExplosion( ubAttackerID, sXPos, sYPos, 0, (INT16) (GETWORLDINDEXFROMWORLDCOORDS( sYPos, sXPos )), pSoldier->inv[pSoldier->ubAttackingHand ].ItemData.Gun.usGunAmmoItem, pTargetSoldier->bLevel );
pSoldier->inv[pSoldier->ubAttackingHand ].usGunAmmoItem = NONE; 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 // 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; // pSoldier->inv[pSoldier->ubAttackingHand ].usGunAmmoItem = NONE;
} }
} }
@@ -3064,7 +3064,7 @@ void StructureHit( INT32 iBullet, UINT16 usWeaponIndex, INT8 bWeaponStatus, UINT
// Get attacker // Get attacker
pSoldier = MercPtrs[ ubAttackerID ]; pSoldier = MercPtrs[ ubAttackerID ];
// marke added one 'or' to get this working with HE ammo // 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! // Reduce attacker count!
DebugMsg( TOPIC_JA2, DBG_LEVEL_3, String("@@@@@@@ Freeing up attacker - end of LAW fire") ); 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) 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 ) ); 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 ) ); 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 ].usGunAmmoItem = NONE; 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 // 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; // pSoldier->inv[pSoldier->ubAttackingHand ].usGunAmmoItem = NONE;
} }
@@ -3492,7 +3492,7 @@ UINT32 CalcChanceToHitGun(SOLDIERTYPE *pSoldier, UINT16 sGridNo, UINT8 ubAimTime
usInHand = pSoldier->usAttackingWeapon; usInHand = pSoldier->usAttackingWeapon;
// DETERMINE BASE CHANCE OF HITTING // DETERMINE BASE CHANCE OF HITTING
iGunCondition = WEAPON_STATUS_MOD( pInHand->bGunStatus ); iGunCondition = WEAPON_STATUS_MOD( pInHand->ItemData.Gun.bGunStatus );
if (Item[usInHand].rocketlauncher ) 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 the plate didn't stop the bullet...
if ( iImpact > iTotalProtection ) if ( iImpact > iTotalProtection )
{ {
iTotalProtection += ArmourProtection( pTarget, Item[pArmour->usItem].ubClassIndex, &(pArmour->bStatus[0]), iImpact, ubAmmoType, &plateHit ); iTotalProtection += ArmourProtection( pTarget, Item[pArmour->usItem].ubClassIndex, &(pArmour->ItemData.Generic.bStatus[0]), iImpact, ubAmmoType, &plateHit );
if ( pArmour->bStatus[ 0 ] < USABLE ) if ( pArmour->ItemData.Generic.bStatus[ 0 ] < USABLE )
{ {
//Madd: put any attachments that someone might have added to the armour in the merc's inventory //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++) for (int bLoop = 0; bLoop < MAX_ATTACHMENTS; bLoop++)
@@ -4348,7 +4348,7 @@ INT32 BulletImpact( SOLDIERTYPE *pFirer, SOLDIERTYPE * pTarget, UINT8 ubHitLocat
} }
else else
{ {
ubAmmoType = pFirer->inv[pFirer->ubAttackingHand].ubGunAmmoType; ubAmmoType = pFirer->inv[pFirer->ubAttackingHand].ItemData.Gun.ubGunAmmoType;
} }
if ( TANK( pTarget ) ) if ( TANK( pTarget ) )
@@ -5198,7 +5198,7 @@ void ReloadWeapon( SOLDIERTYPE *pSoldier, UINT8 ubHandPos )
if ( pSoldier->inv[ ubHandPos ].usItem != NOTHING ) 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 // Dirty Bars
DirtyMercPanelInterface( pSoldier, DIRTYLEVEL1 ); 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 exists, but it's a mechanical item being used
if ((iChance > 0) && (Item[ usHandItem ].usItemClass == IC_LAUNCHER )) if ((iChance > 0) && (Item[ usHandItem ].usItemClass == IC_LAUNCHER ))
// reduce iChance to hit DIRECTLY by the item's working condition // 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 // MAKE SURE CHANCE TO HIT IS WITHIN DEFINED LIMITS
if (iChance < MINCHANCETOHIT) if (iChance < MINCHANCETOHIT)
@@ -5659,7 +5659,7 @@ BOOLEAN WillExplosiveWeaponFail( SOLDIERTYPE *pSoldier, OBJECTTYPE *pObj )
{ {
if ( pSoldier->bTeam == gbPlayerNum || pSoldier->bVisible == 1 ) 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 // Do second dice roll
if ( PreRandom( 2 ) == 1 ) if ( PreRandom( 2 ) == 1 )
+9 -9
View File
@@ -162,12 +162,12 @@ void FindPanicBombsAndTriggers( void )
if (gWorldBombs[ uiBombIndex ].fExists) if (gWorldBombs[ uiBombIndex ].fExists)
{ {
pObj = &(gWorldItems[ gWorldBombs[ uiBombIndex ].iItemIndex ].o); 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) if (pObj->usItem == SWITCH)
{ {
sGridNo = gWorldItems[ gWorldBombs[ uiBombIndex ].iItemIndex ].sGridNo; sGridNo = gWorldItems[ gWorldBombs[ uiBombIndex ].iItemIndex ].sGridNo;
switch( pObj->bFrequency ) switch( pObj->ItemData.Trigger.BombTrigger.bFrequency )
{ {
case PANIC_FREQUENCY: case PANIC_FREQUENCY:
bPanicIndex = 0; bPanicIndex = 0;
@@ -205,7 +205,7 @@ void FindPanicBombsAndTriggers( void )
} }
gTacticalStatus.sPanicTriggerGridNo[ bPanicIndex ] = sGridNo; gTacticalStatus.sPanicTriggerGridNo[ bPanicIndex ] = sGridNo;
gTacticalStatus.ubPanicTolerance[ bPanicIndex ] = pObj->ubTolerance; gTacticalStatus.ubPanicTolerance[ bPanicIndex ] = pObj->ItemData.Trigger.Area.ubTolerance;
if (pObj->fFlags & OBJECT_ALARM_TRIGGER) if (pObj->fFlags & OBJECT_ALARM_TRIGGER)
{ {
gTacticalStatus.bPanicTriggerIsAlarm[ bPanicIndex ] = TRUE; gTacticalStatus.bPanicTriggerIsAlarm[ bPanicIndex ] = TRUE;
@@ -466,11 +466,11 @@ void LoadWorldItemsFromMap( INT8 **hBuffer )
} }
if( dummyItem.o.usItem == ACTION_ITEM && gfLoadPitsWithoutArming ) if( dummyItem.o.usItem == ACTION_ITEM && gfLoadPitsWithoutArming )
{ //if we are loading a pit, they are typically loaded without being armed. { //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.usFlags &= ~WORLD_ITEM_ARMED_BOMB;
dummyItem.bVisible = BURIED; 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 ( gWorldItems[ uiLoop ].fExists && gWorldItems[ uiLoop ].o.usItem == OWNERSHIP )
{ {
// if owner is a terrorist // 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 // and they were not set in the current sector
if ( gMercProfiles[ gWorldItems[ uiLoop ].o.ubOwnerProfile ].sSectorX != gWorldSectorX || if ( gMercProfiles[ gWorldItems[ uiLoop ].o.ItemData.Owner.ubOwnerProfile ].sSectorX != gWorldSectorX ||
gMercProfiles[ gWorldItems[ uiLoop ].o.ubOwnerProfile ].sSectorY != gWorldSectorY ) gMercProfiles[ gWorldItems[ uiLoop ].o.ItemData.Owner.ubOwnerProfile ].sSectorY != gWorldSectorY )
{ {
// then all items in this location should be deleted // then all items in this location should be deleted
sGridNo = gWorldItems[ uiLoop ].sGridNo; sGridNo = gWorldItems[ uiLoop ].sGridNo;
@@ -563,7 +563,7 @@ void DeleteWorldItemsBelongingToQueenIfThere( void )
if ( gWorldItems[ uiLoop ].fExists && gWorldItems[ uiLoop ].o.usItem == OWNERSHIP ) if ( gWorldItems[ uiLoop ].fExists && gWorldItems[ uiLoop ].o.usItem == OWNERSHIP )
{ {
// if owner is the Queen // 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 // then all items in this location should be deleted
sGridNo = gWorldItems[ uiLoop ].sGridNo; sGridNo = gWorldItems[ uiLoop ].sGridNo;
+1 -1
View File
@@ -142,7 +142,7 @@ void HandleBulletSpecialFlags( INT32 iBulletIndex )
else if ( pBullet->usFlags & ( BULLET_FLAG_KNIFE ) ) else if ( pBullet->usFlags & ( BULLET_FLAG_KNIFE ) )
{ {
strcpy( AniParams.zCachedFile, "TILECACHE\\KNIFING.STI" ); 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.... // 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 str[50];
CHAR16 temp[5]; CHAR16 temp[5];
UINT8 i; 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++ ) 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, temp );
} }
wcscat( str, L")" ); wcscat( str, L")" );
gprintf( 320, yp, str ); gprintf( 320, yp, str );
} }
else else
gprintf( 320, yp, L"%d rounds", pObject->bStatus[0] ); gprintf( 320, yp, L"%d rounds", pObject->ItemData.Generic.bStatus[0] );
return; return;
} }
if( pObject->ubNumberOfObjects > 1 && fAttachments ) if( pObject->ubNumberOfObjects > 1 && fAttachments )
{ //everything { //everything
gprintf( 320, yp, L"%d%% Qty: %d %s", 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 ) else if( pObject->ubNumberOfObjects > 1 )
{ //condition and quantity { //condition and quantity
gprintf( 320, yp, L"%d%% Qty: %d ", gprintf( 320, yp, L"%d%% Qty: %d ",
pObject->bStatus[0], pObject->ubNumberOfObjects ); pObject->ItemData.Generic.bStatus[0], pObject->ubNumberOfObjects );
} }
else if( fAttachments ) else if( fAttachments )
{ //condition and attachments { //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 else
{ //condition { //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); 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); 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... // 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 // 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 ) 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 // remove payload from its pocket, and add it as the hand weapon's first attachment
OBJECTTYPE Temp; 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); AttachObject ( pSoldier, &pSoldier->inv[HANDPOS],&Temp,FALSE);
//pSoldier->inv[HANDPOS].usAttachItem[0] = pSoldier->inv[bPayloadPocket].usItem; //pSoldier->inv[HANDPOS].usAttachItem[0] = pSoldier->inv[bPayloadPocket].usItem;
@@ -1590,7 +1590,7 @@ INT32 EstimateShotDamage(SOLDIERTYPE *pSoldier, SOLDIERTYPE *pOpponent, UINT8 ub
} }
else 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 // 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) if (pOpponent->inv[HELMETPOS].usItem)
{ {
iHeadProt += (INT32) Armour[Item[pOpponent->inv[HELMETPOS].usItem].ubClassIndex].ubProtection * 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 // if opponent is wearing a protective vest
@@ -1622,7 +1622,7 @@ INT32 EstimateShotDamage(SOLDIERTYPE *pSoldier, SOLDIERTYPE *pOpponent, UINT8 ub
if (pOpponent->inv[VESTPOS].usItem) if (pOpponent->inv[VESTPOS].usItem)
{ {
iTorsoProt += (INT32) Armour[Item[pOpponent->inv[VESTPOS].usItem].ubClassIndex].ubProtection * 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) if (pOpponent->inv[LEGPOS].usItem)
{ {
iLegProt += (INT32) Armour[Item[pOpponent->inv[LEGPOS].usItem].ubClassIndex].ubProtection * 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) if (bSlot == HEAD1POS || bSlot == HEAD2POS)
{ {
// take condition of the gas mask into account - it could be leaking // 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); //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) // 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! // 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) // 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 //<SB> manual recharge
pObj = &(pSoldier->inv[HANDPOS]); 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); DeductPoints(pSoldier, Weapon[Item[(pObj)->usItem].ubClassIndex].APsToReloadManually, 0);
@@ -1908,9 +1908,9 @@ INT8 TryToReload( SOLDIERTYPE * pSoldier )
{ {
pObj2 = &(pSoldier->inv[SECONDHANDPOS]); 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 ) ); 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]); 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); 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 ) ) || 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 // get the minimum cost to attack with this item
DebugMsg (TOPIC_JA2,DBG_LEVEL_3,"CheckIfShotPossible: getting min aps"); 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 (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; bSpitIn = bWeaponIn;
// if it's in another pocket, swap it into his hand temporarily // 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 ); pSoldier->usActionData = FindClosestClimbPoint(pSoldier, fUp );
// Added the check here because sniper militia who are locked inside of a building without keys // 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 // 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 && if ( pSoldier->usActionData != NOWHERE &&
LegalNPCDestination(pSoldier,pSoldier->usActionData,ENSURE_PATH,WATEROK, 0 )) LegalNPCDestination(pSoldier,pSoldier->usActionData,ENSURE_PATH,WATEROK, 0 ))
{ {
@@ -1525,8 +1525,11 @@ INT8 DecideActionYellow(SOLDIERTYPE *pSoldier)
return AI_ACTION_SEEK_NOISE ; return AI_ACTION_SEEK_NOISE ;
} }
// Hmmm, I don't think this check is doing what is intended. But then I see no comment about what is intended.
if ( !( pSoldier->bTeam == CIV_TEAM && pSoldier->ubProfile != NO_PROFILE && pSoldier->ubProfile != ELDIN ) ) // 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 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 ) 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 else
{ {
pSoldier->usActionData = FindClosestClimbPoint(pSoldier->sGridNo , sNoiseGridNo , fUp ); pSoldier->usActionData = FindClosestClimbPoint(pSoldier, pSoldier->sGridNo , sNoiseGridNo , fUp );
if ( pSoldier->usActionData != NOWHERE ) if ( pSoldier->usActionData != NOWHERE )
{ {
return( AI_ACTION_MOVE_TO_CLIMB ); return( AI_ACTION_MOVE_TO_CLIMB );
@@ -1759,7 +1762,7 @@ INT8 DecideActionYellow(SOLDIERTYPE *pSoldier)
} }
else else
{ {
pSoldier->usActionData = FindClosestClimbPoint(pSoldier->sGridNo , sClosestFriend , fUp ); pSoldier->usActionData = FindClosestClimbPoint(pSoldier, pSoldier->sGridNo , sClosestFriend , fUp );
if ( pSoldier->usActionData != NOWHERE ) if ( pSoldier->usActionData != NOWHERE )
{ {
return( AI_ACTION_MOVE_TO_CLIMB ); 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 ); ubBurstAPs = CalcAPsToAutofire( CalcActionPoints( pSoldier ), &(pSoldier->inv[BestShot.bWeaponIn]), pSoldier->bDoAutofire );
} }
while( pSoldier->bActionPoints >= BestShot.ubAPCost + ubBurstAPs && 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 ); 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 else
{ {
pSoldier->usActionData = FindClosestClimbPoint(pSoldier->sGridNo , sClosestDisturbance , fUp ); pSoldier->usActionData = FindClosestClimbPoint(pSoldier, pSoldier->sGridNo , sClosestDisturbance , fUp );
if ( pSoldier->usActionData != NOWHERE ) if ( pSoldier->usActionData != NOWHERE )
{ {
return( AI_ACTION_MOVE_TO_CLIMB ); return( AI_ACTION_MOVE_TO_CLIMB );
@@ -2993,7 +2996,7 @@ INT8 DecideActionRed(SOLDIERTYPE *pSoldier, UINT8 ubUnconsciousOK)
} }
else else
{ {
pSoldier->usActionData = FindClosestClimbPoint(pSoldier->sGridNo , sClosestFriend , fUp ); pSoldier->usActionData = FindClosestClimbPoint(pSoldier, pSoldier->sGridNo , sClosestFriend , fUp );
if ( pSoldier->usActionData != NOWHERE ) if ( pSoldier->usActionData != NOWHERE )
{ {
return( AI_ACTION_MOVE_TO_CLIMB ); 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)) // 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 // get the minimum cost to attack the same target with this gun
ubMinAPCost = MinAPsToAttack(pSoldier,pSoldier->sLastTarget,ADDTURNCOST); ubMinAPCost = MinAPsToAttack(pSoldier,pSoldier->sLastTarget,ADDTURNCOST);
@@ -4319,7 +4322,7 @@ INT8 DecideActionBlack(SOLDIERTYPE *pSoldier)
if (IsGunBurstCapable( pSoldier, BestAttack.bWeaponIn, FALSE ) && if (IsGunBurstCapable( pSoldier, BestAttack.bWeaponIn, FALSE ) &&
!(Menptr[BestShot.ubOpponent].bLife < OKLIFE) && // don't burst at downed targets !(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) ) (pSoldier->bTeam != gbPlayerNum || pSoldier->bRTPCombat == RTP_COMBAT_AGGRESSIVE) )
{ {
DebugMsg (TOPIC_JA2,DBG_LEVEL_3,"DecideActionBlack: ENOUGH APs TO BURST, RANDOM CHANCE OF DOING SO"); 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; case ATTACKSLAYONLY:iChance += 30; break;
} }
if ( pSoldier->inv[BestAttack.bWeaponIn].ubGunShotsLeft > 50 ) if ( pSoldier->inv[BestAttack.bWeaponIn].ItemData.Gun.ubGunShotsLeft > 50 )
iChance += 20; iChance += 20;
// increase chance based on proximity and difficulty of enemy // increase chance based on proximity and difficulty of enemy
@@ -4382,7 +4385,7 @@ INT8 DecideActionBlack(SOLDIERTYPE *pSoldier)
if (IsGunAutofireCapable( pSoldier, BestAttack.bWeaponIn ) && if (IsGunAutofireCapable( pSoldier, BestAttack.bWeaponIn ) &&
!(Menptr[BestShot.ubOpponent].bLife < OKLIFE) && // don't burst at downed targets !(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) ) 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"); 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 ); ubBurstAPs = CalcAPsToAutofire( CalcActionPoints( pSoldier ), &(pSoldier->inv[BestAttack.bWeaponIn]), pSoldier->bDoAutofire );
} }
while( pSoldier->bActionPoints >= BestAttack.ubAPCost + ubBurstAPs && 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); 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; iChance += 30;
if ( bInGas ) if ( bInGas )
+9 -9
View File
@@ -1769,16 +1769,16 @@ INT8 SearchForItems( SOLDIERTYPE * pSoldier, INT8 bReason, UINT16 usItem )
{ {
pObj = &(gWorldItems[ pItemPool->iItemIndex ].o); pObj = &(gWorldItems[ pItemPool->iItemIndex ].o);
pItem = &(Item[pObj->usItem]); 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!) // 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; iTempValue = 0;
} }
else 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 ) ) else if (ValidAmmoType( usItem, pObj->usItem ) )
@@ -1802,9 +1802,9 @@ INT8 SearchForItems( SOLDIERTYPE * pSoldier, INT8 bReason, UINT16 usItem )
{ {
pObj = &(gWorldItems[ pItemPool->iItemIndex ].o); pObj = &(gWorldItems[ pItemPool->iItemIndex ].o);
pItem = &(Item[pObj->usItem]); 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! // jammed or out of ammo, skip it!
iTempValue = 0; iTempValue = 0;
@@ -1842,9 +1842,9 @@ INT8 SearchForItems( SOLDIERTYPE * pSoldier, INT8 bReason, UINT16 usItem )
{ {
pObj = &(gWorldItems[ pItemPool->iItemIndex ].o); pObj = &(gWorldItems[ pItemPool->iItemIndex ].o);
pItem = &(Item[pObj->usItem]); 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! // jammed or out of ammo, skip it!
iTempValue = 0; iTempValue = 0;
@@ -1865,7 +1865,7 @@ INT8 SearchForItems( SOLDIERTYPE * pSoldier, INT8 bReason, UINT16 usItem )
iTempValue = 200 + Weapon[pObj->usItem].ubDeadliness; 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 ) switch( Armour[pItem->ubClassIndex].ubArmourClass )
{ {
@@ -2623,7 +2623,7 @@ INT16 FindClosestClimbPoint (SOLDIERTYPE *pSoldier, BOOLEAN fClimbUp )
if ( FindBuilding ( sGridNo ) != NULL ) if ( FindBuilding ( sGridNo ) != NULL )
{ {
// DebugMsg( TOPIC_JA2AI , DBG_LEVEL_3 , String("Building found at %d", sGridNo )); // 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 )); // DebugMsg( TOPIC_JA2AI , DBG_LEVEL_3 , String("Closest climb point is %d" , sClimbGridNo ));
if ( sClimbGridNo != NOWHERE ) if ( sClimbGridNo != NOWHERE )
+19 -19
View File
@@ -823,7 +823,7 @@ UINT8 NPCConsiderReceivingItemFromMerc( UINT8 ubNPC, UINT8 ubMerc, OBJECTTYPE *
case MONEY: case MONEY:
case SILVER: case SILVER:
case GOLD: case GOLD:
if (pObj->uiMoneyAmount < LARGE_AMOUNT_MONEY) if (pObj->ItemData.Money.uiMoneyAmount < LARGE_AMOUNT_MONEY)
{ {
SetFactTrue( FACT_SMALL_AMOUNT_OF_MONEY ); SetFactTrue( FACT_SMALL_AMOUNT_OF_MONEY );
} }
@@ -841,7 +841,7 @@ UINT8 NPCConsiderReceivingItemFromMerc( UINT8 ubNPC, UINT8 ubMerc, OBJECTTYPE *
break; break;
} }
if (pObj->bStatus[0] < 50) if (pObj->ItemData.Generic.bStatus[0] < 50)
{ {
SetFactTrue( FACT_ITEM_POOR_CONDITION ); SetFactTrue( FACT_ITEM_POOR_CONDITION );
} }
@@ -865,14 +865,14 @@ UINT8 NPCConsiderReceivingItemFromMerc( UINT8 ubNPC, UINT8 ubMerc, OBJECTTYPE *
case DARREN: case DARREN:
if (usItemToConsider == MONEY && pNPCQuoteInfo->sActionData == NPC_ACTION_DARREN_GIVEN_CASH) 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 // refuse, bet too low - record 15
(*ppResultQuoteInfo) = &pNPCQuoteInfoArray[15]; (*ppResultQuoteInfo) = &pNPCQuoteInfoArray[15];
(*pubQuoteNum) = 15; (*pubQuoteNum) = 15;
return( (*ppResultQuoteInfo)->ubOpinionRequired ); return( (*ppResultQuoteInfo)->ubOpinionRequired );
} }
else if (pObj->uiMoneyAmount > 5000) else if (pObj->ItemData.Money.uiMoneyAmount > 5000)
{ {
// refuse, bet too high - record 16 // refuse, bet too high - record 16
(*ppResultQuoteInfo) = &pNPCQuoteInfoArray[16]; (*ppResultQuoteInfo) = &pNPCQuoteInfoArray[16];
@@ -896,7 +896,7 @@ UINT8 NPCConsiderReceivingItemFromMerc( UINT8 ubNPC, UINT8 ubMerc, OBJECTTYPE *
*/ */
// record amount of bet // record amount of bet
gMercProfiles[ DARREN ].iBalance = pObj->uiMoneyAmount; gMercProfiles[ DARREN ].iBalance = pObj->ItemData.Money.uiMoneyAmount;
SetFactFalse( FACT_DARREN_EXPECTING_MONEY ); SetFactFalse( FACT_DARREN_EXPECTING_MONEY );
// if never fought before, use record 17 // if never fought before, use record 17
@@ -943,14 +943,14 @@ UINT8 NPCConsiderReceivingItemFromMerc( UINT8 ubNPC, UINT8 ubMerc, OBJECTTYPE *
case ANGEL: case ANGEL:
if (usItemToConsider == MONEY && pNPCQuoteInfo->sActionData == NPC_ACTION_ANGEL_GIVEN_CASH) 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 // refuse, bet too low - record 8
(*ppResultQuoteInfo) = &pNPCQuoteInfoArray[8]; (*ppResultQuoteInfo) = &pNPCQuoteInfoArray[8];
(*pubQuoteNum) = 8; (*pubQuoteNum) = 8;
return( (*ppResultQuoteInfo)->ubOpinionRequired ); 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 // refuse, bet too high - record 9
(*ppResultQuoteInfo) = &pNPCQuoteInfoArray[9]; (*ppResultQuoteInfo) = &pNPCQuoteInfoArray[9];
@@ -976,13 +976,13 @@ UINT8 NPCConsiderReceivingItemFromMerc( UINT8 ubNPC, UINT8 ubMerc, OBJECTTYPE *
(*pubQuoteNum) = 5; (*pubQuoteNum) = 5;
return( (*ppResultQuoteInfo)->ubOpinionRequired ); return( (*ppResultQuoteInfo)->ubOpinionRequired );
} }
switch( pObj->uiMoneyAmount ) switch( pObj->ItemData.Money.uiMoneyAmount )
{ {
case 100: case 100:
case 200: // Carla case 200: // Carla
if ( CheckFact( FACT_CARLA_AVAILABLE, 0 ) ) 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 ); TriggerNPCRecord( MADAME, 16 );
} }
else else
@@ -997,7 +997,7 @@ UINT8 NPCConsiderReceivingItemFromMerc( UINT8 ubNPC, UINT8 ubMerc, OBJECTTYPE *
case 1000: // Cindy case 1000: // Cindy
if ( CheckFact( FACT_CINDY_AVAILABLE, 0 ) ) 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 ); TriggerNPCRecord( MADAME, 17 );
} }
else else
@@ -1012,7 +1012,7 @@ UINT8 NPCConsiderReceivingItemFromMerc( UINT8 ubNPC, UINT8 ubMerc, OBJECTTYPE *
case 600: // Bambi case 600: // Bambi
if ( CheckFact( FACT_BAMBI_AVAILABLE, 0 ) ) 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 ); TriggerNPCRecord( MADAME, 18 );
} }
else else
@@ -1027,7 +1027,7 @@ UINT8 NPCConsiderReceivingItemFromMerc( UINT8 ubNPC, UINT8 ubMerc, OBJECTTYPE *
case 800: // Maria? case 800: // Maria?
if ( gubQuest[ QUEST_RESCUE_MARIA ] == QUESTINPROGRESS ) 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 ); TriggerNPCRecord( MADAME, 19 );
break; 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 ) if ( CheckFact( FACT_VINCE_EXPECTING_MONEY, ubNPC ) == FALSE && gMercProfiles[ ubNPC ].iBalance < 0 && pNPCQuoteInfo->sActionData != NPC_ACTION_DONT_ACCEPT_ITEM )
{ {
// increment balance // increment balance
gMercProfiles[ ubNPC ].iBalance += (INT32) pObj->uiMoneyAmount; gMercProfiles[ ubNPC ].iBalance += (INT32) pObj->ItemData.Money.uiMoneyAmount;
gMercProfiles[ ubNPC ].uiTotalCostToDate += pObj->uiMoneyAmount; gMercProfiles[ ubNPC ].uiTotalCostToDate += pObj->ItemData.Money.uiMoneyAmount;
if ( gMercProfiles[ ubNPC ].iBalance > 0 ) if ( gMercProfiles[ ubNPC ].iBalance > 0 )
{ {
gMercProfiles[ ubNPC ].iBalance = 0; gMercProfiles[ ubNPC ].iBalance = 0;
@@ -1096,7 +1096,7 @@ UINT8 NPCConsiderReceivingItemFromMerc( UINT8 ubNPC, UINT8 ubMerc, OBJECTTYPE *
else else
{ {
// handle the player giving NPC some money // handle the player giving NPC some money
HandleNPCBeingGivenMoneyByPlayer( ubNPC, pObj->uiMoneyAmount, pubQuoteNum ); HandleNPCBeingGivenMoneyByPlayer( ubNPC, pObj->ItemData.Money.uiMoneyAmount, pubQuoteNum );
(*ppResultQuoteInfo) = &pNPCQuoteInfoArray[ *pubQuoteNum ]; (*ppResultQuoteInfo) = &pNPCQuoteInfoArray[ *pubQuoteNum ];
return( (*ppResultQuoteInfo)->ubOpinionRequired ); return( (*ppResultQuoteInfo)->ubOpinionRequired );
} }
@@ -1104,7 +1104,7 @@ UINT8 NPCConsiderReceivingItemFromMerc( UINT8 ubNPC, UINT8 ubMerc, OBJECTTYPE *
else else
{ {
// handle the player giving NPC some money // handle the player giving NPC some money
HandleNPCBeingGivenMoneyByPlayer( ubNPC, pObj->uiMoneyAmount, pubQuoteNum ); HandleNPCBeingGivenMoneyByPlayer( ubNPC, pObj->ItemData.Money.uiMoneyAmount, pubQuoteNum );
(*ppResultQuoteInfo) = &pNPCQuoteInfoArray[ *pubQuoteNum ]; (*ppResultQuoteInfo) = &pNPCQuoteInfoArray[ *pubQuoteNum ];
return( (*ppResultQuoteInfo)->ubOpinionRequired ); return( (*ppResultQuoteInfo)->ubOpinionRequired );
} }
@@ -1113,7 +1113,7 @@ UINT8 NPCConsiderReceivingItemFromMerc( UINT8 ubNPC, UINT8 ubMerc, OBJECTTYPE *
case KINGPIN: case KINGPIN:
if ( usItemToConsider == MONEY && gubQuest[ QUEST_KINGPIN_MONEY ] == QUESTINPROGRESS ) if ( usItemToConsider == MONEY && gubQuest[ QUEST_KINGPIN_MONEY ] == QUESTINPROGRESS )
{ {
HandleNPCBeingGivenMoneyByPlayer( ubNPC, pObj->uiMoneyAmount, pubQuoteNum ); HandleNPCBeingGivenMoneyByPlayer( ubNPC, pObj->ItemData.Money.uiMoneyAmount, pubQuoteNum );
(*ppResultQuoteInfo) = &pNPCQuoteInfoArray[ *pubQuoteNum ]; (*ppResultQuoteInfo) = &pNPCQuoteInfoArray[ *pubQuoteNum ];
return( (*ppResultQuoteInfo)->ubOpinionRequired ); 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 ) if ( gMercProfiles[ ubNPC ].iBalance < 0 && pNPCQuoteInfo->sActionData != NPC_ACTION_DONT_ACCEPT_ITEM )
{ {
// increment balance // increment balance
gMercProfiles[ ubNPC ].iBalance += (INT32) pObj->uiMoneyAmount; gMercProfiles[ ubNPC ].iBalance += (INT32) pObj->ItemData.Money.uiMoneyAmount;
gMercProfiles[ ubNPC ].uiTotalCostToDate += pObj->uiMoneyAmount; gMercProfiles[ ubNPC ].uiTotalCostToDate += pObj->ItemData.Money.uiMoneyAmount;
if ( gMercProfiles[ ubNPC ].iBalance > 0 ) if ( gMercProfiles[ ubNPC ].iBalance > 0 )
{ {
gMercProfiles[ ubNPC ].iBalance = 0; gMercProfiles[ ubNPC ].iBalance = 0;
+5 -2
View File
@@ -14,6 +14,8 @@
#include "worldman.h" #include "worldman.h"
#endif #endif
#include "AIInternals.h"
#define ROOF_LOCATION_CHANCE 8 #define ROOF_LOCATION_CHANCE 8
UINT8 gubBuildingInfo[ WORLD_MAX ]; 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; BUILDING * pBuilding;
UINT8 ubNumClimbSpots; UINT8 ubNumClimbSpots;
@@ -468,7 +470,8 @@ INT16 FindClosestClimbPoint( INT16 sStartGridNo, INT16 sDesiredGridNo, BOOLEAN f
for ( ubLoop = 0; ubLoop < ubNumClimbSpots; ubLoop++ ) for ( ubLoop = 0; ubLoop < ubNumClimbSpots; ubLoop++ )
{ {
if ( (WhoIsThere2( pBuilding->sUpClimbSpots[ ubLoop ], 0 ) == NOBODY) 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 ] ); sDistance = PythSpacesAway( sStartGridNo, psClimbSpots[ ubLoop ] );
if (sDistance < sClosestDistance ) if (sDistance < sClosestDistance )
+1 -1
View File
@@ -26,7 +26,7 @@ BOOLEAN InBuilding( INT16 sGridNo );
BUILDING * GenerateBuilding( INT16 sDesiredSpot ); BUILDING * GenerateBuilding( INT16 sDesiredSpot );
BUILDING * FindBuilding( INT16 sGridNo ); BUILDING * FindBuilding( INT16 sGridNo );
void GenerateBuildings( void ); 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 ); BOOLEAN SameBuilding( INT16 sGridNo1, INT16 sGridNo2 );
#endif #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. // Let's check for the attacker first.
if ( ubOwner != NOBODY ) 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 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. // No explosive but an attacker with HE ammo.
if ( !( Item[ usItem ].usItemClass & IC_EXPLOSV ) && ubOwner != NOBODY) 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; // return;
} }
else // just normal explosives should get here else // just normal explosives should get here
@@ -1484,7 +1484,7 @@ BOOLEAN DishOutGasDamage( SOLDIERTYPE * pSoldier, EXPLOSIVETYPE * pExplosive, IN
} }
bPosOfMask = FindGasMask(pSoldier); 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; bPosOfMask = NO_SLOT;
} }
@@ -1499,10 +1499,10 @@ BOOLEAN DishOutGasDamage( SOLDIERTYPE * pSoldier, EXPLOSIVETYPE * pExplosive, IN
if ( bPosOfMask != NO_SLOT ) 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%) // 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 ( sBreathAmt > 500 )
{ {
// if at least 500 of breath damage got through // if at least 500 of breath damage got through
@@ -1516,12 +1516,12 @@ BOOLEAN DishOutGasDamage( SOLDIERTYPE * pSoldier, EXPLOSIVETYPE * pExplosive, IN
if ( sWoundAmt > 1 ) if ( sWoundAmt > 1 )
{ {
pSoldier->inv[ bPosOfMask ].bStatus[0] -= (INT8) Random( 4 ); pSoldier->inv[ bPosOfMask ].ItemData.Generic.bStatus[0] -= (INT8) Random( 4 );
sWoundAmt = ( sWoundAmt * ( 100 - pSoldier->inv[ bPosOfMask ].bStatus[0] ) ) / 100; sWoundAmt = ( sWoundAmt * ( 100 - pSoldier->inv[ bPosOfMask ].ItemData.Generic.bStatus[0] ) ) / 100;
} }
else if ( sWoundAmt == 1 ) 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 ) if ( sWoundAmt == 1 )
{ {
pSoldier->inv[ bPosOfMask ].bStatus[0] -= (INT8) Random( 2 ); pSoldier->inv[ bPosOfMask ].ItemData.Generic.bStatus[0] -= (INT8) Random( 2 );
} }
else else
{ {
// use up gas mask // use up gas mask
pSoldier->inv[ bPosOfMask ].bStatus[0] -= (INT8) Random( 4 ); pSoldier->inv[ bPosOfMask ].ItemData.Generic.bStatus[0] -= (INT8) Random( 4 );
} }
} }
sWoundAmt = 0; sWoundAmt = 0;
@@ -2468,10 +2468,10 @@ void ToggleActionItemsByFrequency( INT8 bFrequency )
if (gWorldBombs[uiWorldBombIndex].fExists) if (gWorldBombs[uiWorldBombIndex].fExists)
{ {
pObj = &( gWorldItems[ gWorldBombs[uiWorldBombIndex].iItemIndex ].o ); 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 // 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 // toggle its active flag
if (pObj->fFlags & OBJECT_DISABLED_BOMB) if (pObj->fFlags & OBJECT_DISABLED_BOMB)
@@ -2499,7 +2499,7 @@ void TogglePressureActionItemsInGridNo( INT16 sGridNo )
if ( gWorldBombs[uiWorldBombIndex].fExists && gWorldItems[ gWorldBombs[uiWorldBombIndex].iItemIndex ].sGridNo == sGridNo ) if ( gWorldBombs[uiWorldBombIndex].fExists && gWorldItems[ gWorldBombs[uiWorldBombIndex].iItemIndex ].sGridNo == sGridNo )
{ {
pObj = &( gWorldItems[ gWorldBombs[uiWorldBombIndex].iItemIndex ].o ); pObj = &( gWorldItems[ gWorldBombs[uiWorldBombIndex].iItemIndex ].o );
if ( pObj->bDetonatorType == BOMB_PRESSURE ) if ( pObj->ItemData.Trigger.bDetonatorType == BOMB_PRESSURE )
{ {
// Found a pressure item // Found a pressure item
// toggle its active flag // toggle its active flag
@@ -2560,7 +2560,7 @@ void PerformItemAction( INT16 sGridNo, OBJECTTYPE * pObj )
{ {
STRUCTURE * pStructure; STRUCTURE * pStructure;
switch( pObj->bActionValue ) switch( pObj->ItemData.Trigger.bActionValue )
{ {
case ACTION_ITEM_OPEN_DOOR: case ACTION_ITEM_OPEN_DOOR:
pStructure = FindStructure( sGridNo, STRUCTURE_ANYDOOR ); pStructure = FindStructure( sGridNo, STRUCTURE_ANYDOOR );
@@ -2890,7 +2890,7 @@ void PerformItemAction( INT16 sGridNo, OBJECTTYPE * pObj )
if ( sDoorSpot != NOWHERE && sTeleportSpot != NOWHERE ) if ( sDoorSpot != NOWHERE && sTeleportSpot != NOWHERE )
{ {
// close the door... // close the door...
DoorCloser.bActionValue = ACTION_ITEM_CLOSE_DOOR; DoorCloser.ItemData.Trigger.bActionValue = ACTION_ITEM_CLOSE_DOOR;
PerformItemAction( sDoorSpot, &DoorCloser ); PerformItemAction( sDoorSpot, &DoorCloser );
// have sex // have sex
@@ -2999,17 +2999,17 @@ void HandleExplosionQueue( void )
sGridNo = gWorldItems[ gWorldBombs[ uiWorldBombIndex ].iItemIndex ].sGridNo; sGridNo = gWorldItems[ gWorldBombs[ uiWorldBombIndex ].iItemIndex ].sGridNo;
ubLevel = gWorldItems[ gWorldBombs[ uiWorldBombIndex ].iItemIndex ].ubLevel; 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 ); 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 ) ); PlayJA2Sample( KLAXON_ALARM, RATE_11025, SoundVolume( MIDVOLUME, sGridNo ), 5, SoundDir( sGridNo ) );
CallAvailableEnemiesTo( sGridNo ); CallAvailableEnemiesTo( sGridNo );
//RemoveItemFromPool( sGridNo, gWorldBombs[ uiWorldBombIndex ].iItemIndex, 0 ); //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 ); NewLightEffect( sGridNo, (UINT8)Explosive[pObj->usItem].ubDuration, (UINT8)Explosive[pObj->usItem].ubStartRadius );
RemoveItemFromPool( sGridNo, gWorldBombs[ uiWorldBombIndex ].iItemIndex, ubLevel ); RemoveItemFromPool( sGridNo, gWorldBombs[ uiWorldBombIndex ].iItemIndex, ubLevel );
@@ -3032,14 +3032,14 @@ void HandleExplosionQueue( void )
// BOOM! // BOOM!
// bomb objects only store the SIDE who placed the bomb! :-( // 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 else
{ {
// pre-placed // 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) if (gWorldBombs[uiWorldBombIndex].fExists)
{ {
pObj = &( gWorldItems[ gWorldBombs[uiWorldBombIndex].iItemIndex ].o ); 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 // Found a timed bomb, so decay its delay value and see if it goes off
pObj->bDelay--; pObj->ItemData.Trigger.BombTrigger.bDelay--;
if (pObj->bDelay == 0) if (pObj->ItemData.Trigger.BombTrigger.bDelay == 0)
{ {
// put this bomb on the queue // put this bomb on the queue
AddBombToQueue( uiWorldBombIndex, uiTimeStamp ); AddBombToQueue( uiWorldBombIndex, uiTimeStamp );
// ATE: CC black magic.... // 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 else
{ {
gubPersonToSetOffExplosions = NOBODY; 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; uiTimeStamp += BOMB_QUEUE_DELAY;
} }
@@ -3159,17 +3159,17 @@ void SetOffBombsByFrequency( UINT8 ubID, INT8 bFrequency )
if (gWorldBombs[uiWorldBombIndex].fExists) if (gWorldBombs[uiWorldBombIndex].fExists)
{ {
pObj = &( gWorldItems[ gWorldBombs[uiWorldBombIndex].iItemIndex ].o ); 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 // 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; gubPersonToSetOffExplosions = ubID;
// put this bomb on the queue // put this bomb on the queue
AddBombToQueue( uiWorldBombIndex, uiTimeStamp ); 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; uiTimeStamp += BOMB_QUEUE_DELAY;
} }
@@ -3234,7 +3234,7 @@ BOOLEAN SetOffBombsInGridNo( UINT8 ubID, INT16 sGridNo, BOOLEAN fAllBombs, INT8
pObj = &( gWorldItems[ gWorldBombs[uiWorldBombIndex].iItemIndex ].o ); pObj = &( gWorldItems[ gWorldBombs[uiWorldBombIndex].iItemIndex ].o );
if (!(pObj->fFlags & OBJECT_DISABLED_BOMB)) 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! // Snap: if we do set off our own trap (e.g. by trying to disarm it), we pay!
/*if (!fAllBombs && MercPtrs[ ubID ]->bTeam != gbPlayerNum ) /*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 // send out a signal to detonate other bombs, rather than this which
// isn't a bomb but a trigger // isn't a bomb but a trigger
SetOffBombsByFrequency( ubID, pObj->bFrequency ); SetOffBombsByFrequency( ubID, pObj->ItemData.Trigger.BombTrigger.bFrequency );
} }
else else
{ {
@@ -3266,12 +3266,12 @@ BOOLEAN SetOffBombsInGridNo( UINT8 ubID, INT16 sGridNo, BOOLEAN fAllBombs, INT8
// put this bomb on the queue // put this bomb on the queue
AddBombToQueue( uiWorldBombIndex, uiTimeStamp ); 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; 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; fFoundMine = TRUE;
} }
@@ -3296,7 +3296,7 @@ void ActivateSwitchInGridNo( UINT8 ubID, INT16 sGridNo )
{ {
pObj = &( gWorldItems[ gWorldBombs[uiWorldBombIndex].iItemIndex ].o ); 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 // send out a signal to detonate other bombs, rather than this which
// isn't a bomb but a trigger // isn't a bomb but a trigger
@@ -3305,7 +3305,7 @@ void ActivateSwitchInGridNo( UINT8 ubID, INT16 sGridNo )
// No, not a good idea. // No, not a good idea.
// gTacticalStatus.ubAttackBusyCount = 0; // 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) if (gWorldBombs[uiWorldBombIndex].fExists)
{ {
pObj = &( gWorldItems[ gWorldBombs[uiWorldBombIndex].iItemIndex ].o ); 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 ); return( gWorldBombs[uiWorldBombIndex].iItemIndex );
} }
+4 -4
View File
@@ -2478,7 +2478,7 @@ void HandleArmedObjectImpact( REAL_OBJECT *pObject )
#ifdef TESTDUDEXPLOSIVES #ifdef TESTDUDEXPLOSIVES
if ( sZ != 0 || pObject->fInWater ) if ( sZ != 0 || pObject->fInWater )
#else #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 #endif
{ {
fDoImpact = TRUE; fDoImpact = TRUE;
@@ -2488,7 +2488,7 @@ void HandleArmedObjectImpact( REAL_OBJECT *pObject )
#ifdef TESTDUDEXPLOSIVES #ifdef TESTDUDEXPLOSIVES
if ( 1 ) if ( 1 )
#else #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 #endif
{ {
iTrapped = PreRandom( 4 ) + 2; iTrapped = PreRandom( 4 ) + 2;
@@ -2499,8 +2499,8 @@ void HandleArmedObjectImpact( REAL_OBJECT *pObject )
// Start timed bomb... // Start timed bomb...
usFlags |= WORLD_ITEM_ARMED_BOMB; usFlags |= WORLD_ITEM_ARMED_BOMB;
pObj->bDetonatorType = BOMB_TIMED; pObj->ItemData.Trigger.bDetonatorType = BOMB_TIMED;
pObj->bDelay = (INT8)( 1 + PreRandom( 2 ) ); pObj->ItemData.Trigger.BombTrigger.bDelay = (INT8)( 1 + PreRandom( 2 ) );
} }
// ATE: If we have collided with roof last... // 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.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 ); 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 ); Add5X5Pit( gWorldItems[ i ].sGridNo );
} }
} }
@@ -195,9 +195,9 @@ void RemoveAllPits()
{ {
if( gWorldItems[ i ].o.usItem == ACTION_ITEM ) 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 ); 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 ); Remove5X5Pit( gWorldItems[ i ].sGridNo );
} }
} }
+3 -1
View File
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="Windows-1252"?> <?xml version="1.0" encoding="Windows-1252"?>
<VisualStudioProject <VisualStudioProject
ProjectType="Visual C++" ProjectType="Visual C++"
Version="8,00" Version="8.00"
Name="ja2_2005Express" Name="ja2_2005Express"
ProjectGUID="{F44669E7-74AC-444B-B75F-F16F4B9F0265}" ProjectGUID="{F44669E7-74AC-444B-B75F-F16F4B9F0265}"
RootNamespace="ja2_2005Express" RootNamespace="ja2_2005Express"
@@ -146,6 +146,8 @@
OutputFile="$(OutDir)\ja2_rel_1202.exe" OutputFile="$(OutDir)\ja2_rel_1202.exe"
LinkIncremental="1" LinkIncremental="1"
GenerateDebugInformation="true" GenerateDebugInformation="true"
GenerateMapFile="true"
MapFileName="$(TargetDir)$(TargetName).map"
SubSystem="2" SubSystem="2"
OptimizeReferences="2" OptimizeReferences="2"
EnableCOMDATFolding="2" EnableCOMDATFolding="2"