mirror of
https://github.com/1dot13/source.git
synced 2026-09-02 14:36:06 +02:00
Merged from revision: 7138
Bugfixes (by anv) - autofeeding bug, - drop items on dismiss optimization, - effectiveness of suppression was increased/decreased with every influenced soldier if set to other than default 100, - item status changed to INT16 on item create - item status is also used to specify amount of money (*50), if NPC had a lot of money in his starting gear, its amount would be incorrect. git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@7139 3b4a5df2-a311-0410-b5c6-a8a6f20db521
This commit is contained in:
@@ -1642,18 +1642,31 @@ void HandleLeavingOfEquipmentInCurrentSector( UINT32 uiMercId )
|
|||||||
}
|
}
|
||||||
|
|
||||||
UINT32 invsize = Menptr[ uiMercId ].inv.size();
|
UINT32 invsize = Menptr[ uiMercId ].inv.size();
|
||||||
for( UINT32 iCounter = 0; iCounter < invsize; ++iCounter )
|
UINT32 uiFoundItems = 0;
|
||||||
|
Inventory invTemporaryBeforeDrop;
|
||||||
|
|
||||||
|
if( Menptr[ uiMercId ].sSectorX != gWorldSectorX || Menptr[ uiMercId ].sSectorY != gWorldSectorY || Menptr[ uiMercId ].bSectorZ != gbWorldSectorZ )
|
||||||
{
|
{
|
||||||
// slot found,
|
for( UINT32 iCounter = 0; iCounter < invsize; ++iCounter )
|
||||||
// check if actual item
|
|
||||||
if( Menptr[ uiMercId ].inv[ iCounter ].exists() == true )
|
|
||||||
{
|
{
|
||||||
if( Menptr[ uiMercId ].sSectorX != gWorldSectorX || Menptr[ uiMercId ].sSectorY != gWorldSectorY || Menptr[ uiMercId ].bSectorZ != gbWorldSectorZ )
|
// slot found,
|
||||||
|
// check if actual item
|
||||||
|
if( Menptr[ uiMercId ].inv[ iCounter ].exists() == true )
|
||||||
{
|
{
|
||||||
// Set flag for item...
|
invTemporaryBeforeDrop[uiFoundItems] = Menptr[ uiMercId ].inv[ iCounter ];
|
||||||
AddItemsToUnLoadedSector( Menptr[ uiMercId ].sSectorX, Menptr[ uiMercId ].sSectorY, Menptr[ uiMercId ].bSectorZ , sGridNo, 1, &( Menptr[ uiMercId ].inv[ iCounter ]) , Menptr[ uiMercId ].pathing.bLevel, WOLRD_ITEM_FIND_SWEETSPOT_FROM_GRIDNO | WORLD_ITEM_REACHABLE, 0, 1, FALSE );
|
uiFoundItems++;
|
||||||
}
|
}
|
||||||
else
|
}
|
||||||
|
// anv: add all items at once (less file operations = less lag)
|
||||||
|
AddItemsToUnLoadedSector( Menptr[ uiMercId ].sSectorX, Menptr[ uiMercId ].sSectorY, Menptr[ uiMercId ].bSectorZ , sGridNo, uiFoundItems, &(invTemporaryBeforeDrop[0]) , Menptr[ uiMercId ].pathing.bLevel, WOLRD_ITEM_FIND_SWEETSPOT_FROM_GRIDNO | WORLD_ITEM_REACHABLE, 0, 1, FALSE );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
for( UINT32 iCounter = 0; iCounter < invsize; ++iCounter )
|
||||||
|
{
|
||||||
|
// slot found,
|
||||||
|
// check if actual item
|
||||||
|
if( Menptr[ uiMercId ].inv[ iCounter ].exists() == true )
|
||||||
{
|
{
|
||||||
AddItemToPool( sGridNo, &( Menptr[ uiMercId ].inv[ iCounter ] ) , 1, Menptr[ uiMercId ].pathing.bLevel, WORLD_ITEM_REACHABLE, 0 );
|
AddItemToPool( sGridNo, &( Menptr[ uiMercId ].inv[ iCounter ] ) , 1, Menptr[ uiMercId ].pathing.bLevel, WORLD_ITEM_REACHABLE, 0 );
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
@@ -716,7 +716,7 @@ void EatFromInventory( SOLDIERTYPE *pSoldier, BOOLEAN fcanteensonly )
|
|||||||
ApplyFood( pSoldier, pObj, TRUE, FALSE ); // cannot reject to eat this, we chose to eat this ourself!
|
ApplyFood( pSoldier, pObj, TRUE, FALSE ); // cannot reject to eat this, we chose to eat this ourself!
|
||||||
|
|
||||||
// if we're full, finish
|
// if we're full, finish
|
||||||
if ( pSoldier->bFoodLevel > FoodMoraleMods[FOOD_MERC_START_CONSUME].bThreshold && pSoldier->bDrinkLevel > FoodMoraleMods[FOOD_MERC_START_CONSUME].bThreshold )
|
if ( ( pSoldier->bFoodLevel > FoodMoraleMods[FOOD_MERC_START_CONSUME].bThreshold || Food[foodtype].bFoodPoints == 0 ) && ( pSoldier->bDrinkLevel > FoodMoraleMods[FOOD_MERC_START_CONSUME].bThreshold|| Food[foodtype].bDrinkPoints == 0 ) )
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
@@ -7935,7 +7935,7 @@ BOOLEAN CreateItem( UINT16 usItem, INT16 bStatus, OBJECTTYPE * pObj )
|
|||||||
return( fRet );
|
return( fRet );
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOLEAN CreateItems( UINT16 usItem, INT8 bStatus, UINT8 ubNumber, OBJECTTYPE * pObj )
|
BOOLEAN CreateItems( UINT16 usItem, INT16 bStatus, UINT8 ubNumber, OBJECTTYPE * pObj )
|
||||||
{
|
{
|
||||||
BOOLEAN fOk;
|
BOOLEAN fOk;
|
||||||
fOk = CreateItem( usItem, bStatus, pObj );
|
fOk = CreateItem( usItem, bStatus, pObj );
|
||||||
|
|||||||
+1
-1
@@ -62,7 +62,7 @@ extern UINT16 UseKitPoints( OBJECTTYPE * pObj, UINT16 usPoints, SOLDIERTYPE *pSo
|
|||||||
extern BOOLEAN EmptyWeaponMagazine( OBJECTTYPE * pWeapon, OBJECTTYPE *pAmmo, UINT32 subObject = 0 );
|
extern BOOLEAN EmptyWeaponMagazine( OBJECTTYPE * pWeapon, OBJECTTYPE *pAmmo, UINT32 subObject = 0 );
|
||||||
BOOLEAN CreateItem( UINT16 usItem, INT16 bStatus, OBJECTTYPE * pObj );
|
BOOLEAN CreateItem( UINT16 usItem, INT16 bStatus, OBJECTTYPE * pObj );
|
||||||
BOOLEAN CreateAmmo( UINT16 usItem, OBJECTTYPE * pObj, UINT16 ubShotsLeft = 0);
|
BOOLEAN CreateAmmo( UINT16 usItem, OBJECTTYPE * pObj, UINT16 ubShotsLeft = 0);
|
||||||
BOOLEAN CreateItems( UINT16 usItem, INT8 bStatus, UINT8 ubNumber, OBJECTTYPE * pObj );
|
BOOLEAN CreateItems( UINT16 usItem, INT16 bStatus, UINT8 ubNumber, OBJECTTYPE * pObj );
|
||||||
BOOLEAN CreateMoney( UINT32 uiMoney, OBJECTTYPE * pObj );
|
BOOLEAN CreateMoney( UINT32 uiMoney, OBJECTTYPE * pObj );
|
||||||
extern UINT16 DefaultMagazine( UINT16 usItem );
|
extern UINT16 DefaultMagazine( UINT16 usItem );
|
||||||
UINT16 RandomMagazine( UINT16 usItem, UINT8 ubPercentStandard, UINT8 maxCoolness, INT8 bSoldierClass );
|
UINT16 RandomMagazine( UINT16 usItem, UINT8 ubPercentStandard, UINT8 maxCoolness, INT8 bSoldierClass );
|
||||||
|
|||||||
@@ -8207,6 +8207,10 @@ void HandleSuppressionFire( UINT8 ubTargetedMerc, UINT8 ubCausedAttacker )
|
|||||||
sFinalSuppressionEffectiveness += (10 + (ubGunVolume - 85));
|
sFinalSuppressionEffectiveness += (10 + (ubGunVolume - 85));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// remember effectiveness at this point before modyfing it depending on target's team
|
||||||
|
INT16 sFinalShooterDependentEffectiveness = sFinalSuppressionEffectiveness;
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
// Loop through every character.
|
// Loop through every character.
|
||||||
@@ -8243,9 +8247,9 @@ void HandleSuppressionFire( UINT8 ubTargetedMerc, UINT8 ubCausedAttacker )
|
|||||||
|
|
||||||
// Flugente: added ini options for suppression effectiveness for player team and everybody else
|
// Flugente: added ini options for suppression effectiveness for player team and everybody else
|
||||||
if ( pSoldier->bTeam == gbPlayerNum )
|
if ( pSoldier->bTeam == gbPlayerNum )
|
||||||
sFinalSuppressionEffectiveness = sFinalSuppressionEffectiveness * gGameExternalOptions.usSuppressionEffectivenessPlayer / 100;
|
sFinalSuppressionEffectiveness = sFinalShooterDependentEffectiveness * gGameExternalOptions.usSuppressionEffectivenessPlayer / 100;
|
||||||
else
|
else
|
||||||
sFinalSuppressionEffectiveness = sFinalSuppressionEffectiveness * gGameExternalOptions.usSuppressionEffectivenessAI / 100;
|
sFinalSuppressionEffectiveness = sFinalShooterDependentEffectiveness * gGameExternalOptions.usSuppressionEffectivenessAI / 100;
|
||||||
|
|
||||||
// INI-Controlled intensity. SuppressionEffectiveness acts as a percentage applied to the number of lost APs.
|
// INI-Controlled intensity. SuppressionEffectiveness acts as a percentage applied to the number of lost APs.
|
||||||
// To turn off the entire Suppression system, simply set the INI value to 0. (0% AP Loss)
|
// To turn off the entire Suppression system, simply set the INI value to 0. (0% AP Loss)
|
||||||
|
|||||||
@@ -847,18 +847,20 @@ BOOLEAN AddItemsToUnLoadedSector( INT16 sMapX, INT16 sMapY, INT8 bMapZ, INT32 sG
|
|||||||
DeleteTempItemMapFile( sMapX, sMapY, bMapZ );
|
DeleteTempItemMapFile( sMapX, sMapY, bMapZ );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
UINT16 uiLastFoundSpot = 0;
|
||||||
//loop through all the objects to add
|
//loop through all the objects to add
|
||||||
for( uiLoop1=0; uiLoop1 < uiNumberOfItemsToAdd; uiLoop1++)
|
for( uiLoop1=0; uiLoop1 < uiNumberOfItemsToAdd; uiLoop1++)
|
||||||
{
|
{
|
||||||
//Loop through the array to see if there is a free spot to add an item to it
|
//Loop through the array to see if there is a free spot to add an item to it
|
||||||
for( cnt=0; cnt < uiNumberOfItems; cnt++)
|
for( cnt=uiLastFoundSpot; cnt < uiNumberOfItems; cnt++)
|
||||||
{
|
{
|
||||||
if( pWorldItems[ cnt ].fExists == FALSE )
|
if( pWorldItems[ cnt ].fExists == FALSE )
|
||||||
{
|
{
|
||||||
|
// anv: remember first found free spot to not loop through entire inventory again for next added items
|
||||||
|
uiLastFoundSpot = cnt;
|
||||||
//We have found a free spot, break
|
//We have found a free spot, break
|
||||||
break;
|
break;
|
||||||
}
|
} }
|
||||||
}
|
|
||||||
|
|
||||||
if( cnt == ( uiNumberOfItems ) )
|
if( cnt == ( uiNumberOfItems ) )
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user