mirror of
https://github.com/1dot13/source.git
synced 2026-07-29 13:52:17 +02:00
If the itemlist is huge and one uses New Inventory System, New Attachment System and a lot of MOLLE items, there is a noticable slowdown if inventory is open in tactical. I cleaned up code to ease that somewhat, but the problem will likely persist.
git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@7600 3b4a5df2-a311-0410-b5c6-a8a6f20db521
This commit is contained in:
+9
-9
@@ -15,9 +15,9 @@
|
||||
#ifdef JA2EDITOR
|
||||
|
||||
#ifdef JA2UB
|
||||
CHAR16 zVersionLabel[256] = { L"Unfinished Business - Map Editor v1.13.7529 (Development Build)" };
|
||||
CHAR16 zVersionLabel[256] = { L"Unfinished Business - Map Editor v1.13.7599 (Development Build)" };
|
||||
#else
|
||||
CHAR16 zVersionLabel[256] = { L"Map Editor v1.13.7529 (Development Build)" };
|
||||
CHAR16 zVersionLabel[256] = { L"Map Editor v1.13.7599 (Development Build)" };
|
||||
#endif
|
||||
|
||||
// ------------------------------
|
||||
@@ -27,11 +27,11 @@
|
||||
|
||||
//DEBUG BUILD VERSION
|
||||
#ifdef JA2UB
|
||||
CHAR16 zVersionLabel[256] = { L"Debug: Unfinished Business - v1.13.7529 (Development Build)" };
|
||||
CHAR16 zVersionLabel[256] = { L"Debug: Unfinished Business - v1.13.7599 (Development Build)" };
|
||||
#elif defined (JA113DEMO)
|
||||
CHAR16 zVersionLabel[256] = { L"Debug: JA2 Demo - v1.13.7529 (Development Build)" };
|
||||
CHAR16 zVersionLabel[256] = { L"Debug: JA2 Demo - v1.13.7599 (Development Build)" };
|
||||
#else
|
||||
CHAR16 zVersionLabel[256] = { L"Debug: v1.13.7529 (Development Build)" };
|
||||
CHAR16 zVersionLabel[256] = { L"Debug: v1.13.7599 (Development Build)" };
|
||||
#endif
|
||||
|
||||
#elif defined CRIPPLED_VERSION
|
||||
@@ -46,16 +46,16 @@
|
||||
|
||||
//RELEASE BUILD VERSION
|
||||
#ifdef JA2UB
|
||||
CHAR16 zVersionLabel[256] = { L"Release Unfinished Business - v1.13.7529 (Development Build)" };
|
||||
CHAR16 zVersionLabel[256] = { L"Release Unfinished Business - v1.13.7599 (Development Build)" };
|
||||
#elif defined (JA113DEMO)
|
||||
CHAR16 zVersionLabel[256] = { L"Release JA2 Demo - v1.13.7529 (Development Build)" };
|
||||
CHAR16 zVersionLabel[256] = { L"Release JA2 Demo - v1.13.7599 (Development Build)" };
|
||||
#else
|
||||
CHAR16 zVersionLabel[256] = { L"Release v1.13.7529 (Development Build)" };
|
||||
CHAR16 zVersionLabel[256] = { L"Release v1.13.7599 (Development Build)" };
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
CHAR8 czVersionNumber[16] = { "Build 14.09.24" }; //YY.MM.DD
|
||||
CHAR8 czVersionNumber[16] = { "Build 14.10.19" }; //YY.MM.DD
|
||||
CHAR16 zTrackingNumber[16] = { L"Z" };
|
||||
|
||||
// SAVE_GAME_VERSION is defined in header, change it there
|
||||
|
||||
+6
-20
@@ -620,19 +620,17 @@ void InitBobbyRayInventory()
|
||||
|
||||
BOOLEAN InitBobbyRayNewInventory()
|
||||
{
|
||||
UINT16 i;
|
||||
UINT16 usBobbyrIndex = 0;
|
||||
|
||||
|
||||
memset( LaptopSaveInfo.BobbyRayInventory, 0, sizeof(STORE_INVENTORY) * MAXITEMS);
|
||||
|
||||
// add all the NEW items he can ever sell into his possible inventory list, for now in order by item #
|
||||
for( i = 0; i < MAXITEMS; i++ )
|
||||
for( UINT16 i = 0; i < MAXITEMS; ++i )
|
||||
{
|
||||
//if Bobby Ray sells this, it can be sold, and it's allowed into this game (some depend on e.g. gun-nut option)
|
||||
// if( ( StoreInventory[ i ][ BOBBY_RAY_NEW ] != 0) && !( Item[ i ].fFlags & ITEM_NOT_BUYABLE ) && ItemIsLegal( i ) )
|
||||
LaptopSaveInfo.BobbyRayInventory[ usBobbyrIndex ].usItemIndex = i;
|
||||
usBobbyrIndex++;
|
||||
++usBobbyrIndex;
|
||||
}
|
||||
|
||||
if ( usBobbyrIndex > 1 )
|
||||
@@ -641,7 +639,6 @@ BOOLEAN InitBobbyRayNewInventory()
|
||||
qsort( LaptopSaveInfo.BobbyRayInventory, usBobbyrIndex, sizeof( STORE_INVENTORY ), BobbyRayItemQsortCompare );
|
||||
}
|
||||
|
||||
|
||||
// remember how many entries in the list are valid
|
||||
LaptopSaveInfo.usInventoryListLength[ BOBBY_RAY_NEW ] = usBobbyrIndex;
|
||||
// also mark the end of the list of valid item entries
|
||||
@@ -653,14 +650,13 @@ BOOLEAN InitBobbyRayNewInventory()
|
||||
|
||||
BOOLEAN InitBobbyRayUsedInventory()
|
||||
{
|
||||
UINT16 i;
|
||||
UINT16 usBobbyrIndex = 0;
|
||||
|
||||
|
||||
memset( LaptopSaveInfo.BobbyRayUsedInventory, 0, sizeof(STORE_INVENTORY) * MAXITEMS);
|
||||
|
||||
// add all the NEW items he can ever sell into his possible inventory list, for now in order by item #
|
||||
for( i = 0; i < MAXITEMS; i++ )
|
||||
for( UINT16 i = 0; i < MAXITEMS; ++i )
|
||||
{
|
||||
//if Bobby Ray sells this, it can be sold, and it's allowed into this game (some depend on e.g. gun-nut option)
|
||||
// if( ( StoreInventory[ i ][ BOBBY_RAY_USED ] != 0) && !( Item[ i ].fFlags & ITEM_NOT_BUYABLE ) && ItemIsLegal( i ) )
|
||||
@@ -668,7 +664,7 @@ BOOLEAN InitBobbyRayUsedInventory()
|
||||
if ( CanDealerItemBeSoldUsed( i ) )
|
||||
{
|
||||
LaptopSaveInfo.BobbyRayUsedInventory[ usBobbyrIndex ].usItemIndex = i;
|
||||
usBobbyrIndex++;
|
||||
++usBobbyrIndex;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -700,7 +696,7 @@ void DailyUpdateOfBobbyRaysNewInventory()
|
||||
SimulateBobbyRayCustomer(LaptopSaveInfo.BobbyRayInventory, BOBBY_RAY_NEW);
|
||||
|
||||
//loop through all items BR can stock to see what needs reordering
|
||||
for(i = 0; i < LaptopSaveInfo.usInventoryListLength[BOBBY_RAY_NEW]; i++)
|
||||
for(i = 0; i < LaptopSaveInfo.usInventoryListLength[BOBBY_RAY_NEW]; ++i)
|
||||
{
|
||||
// the index is NOT the item #, get that from the table
|
||||
usItemIndex = LaptopSaveInfo.BobbyRayInventory[ i ].usItemIndex;
|
||||
@@ -951,13 +947,11 @@ void SimulateBobbyRayCustomer(STORE_INVENTORY *pInventoryArray, BOOLEAN fUsed)
|
||||
|
||||
void CancelAllPendingBRPurchaseOrders(void)
|
||||
{
|
||||
INT16 i;
|
||||
|
||||
// remove all the BR-Order events off the event queue
|
||||
DeleteAllStrategicEventsOfType( EVENT_UPDATE_BOBBY_RAY_INVENTORY );
|
||||
|
||||
// zero out all the quantities on order
|
||||
for(i = 0; i < MAXITEMS; i++)
|
||||
for( UINT16 i = 0; i < MAXITEMS; ++i)
|
||||
{
|
||||
LaptopSaveInfo.BobbyRayInventory[ i ].ubQtyOnOrder = 0;
|
||||
LaptopSaveInfo.BobbyRayUsedInventory[ i ].ubQtyOnOrder = 0;
|
||||
@@ -967,11 +961,3 @@ void CancelAllPendingBRPurchaseOrders(void)
|
||||
DailyUpdateOfBobbyRaysNewInventory();
|
||||
DailyUpdateOfBobbyRaysUsedInventory();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
+5
-13
@@ -2519,7 +2519,7 @@ void SetFirstLastPagesForNew( UINT32 uiClassMask, INT32 iFilter, INT32 iSubFilte
|
||||
gubCurPage = 0;
|
||||
|
||||
//First loop through to get the first and last index indexs
|
||||
for(i=0; i<MAXITEMS; i++)
|
||||
for(i=0; i<MAXITEMS; ++i)
|
||||
{
|
||||
//If we have some of the inventory on hand
|
||||
if( LaptopSaveInfo.BobbyRayInventory[ i ].ubQtyOnHand != 0 )
|
||||
@@ -2614,7 +2614,7 @@ void SetFirstLastPagesForNew( UINT32 uiClassMask, INT32 iFilter, INT32 iSubFilte
|
||||
//Loops through Bobby Rays Used Inventory to find the first and last index
|
||||
void SetFirstLastPagesForUsed(INT32 iFilter)
|
||||
{
|
||||
UINT16 i;
|
||||
UINT16 i;
|
||||
INT16 sFirst = -1;
|
||||
INT16 sLast = -1;
|
||||
UINT16 ubNumItems=0;
|
||||
@@ -2623,9 +2623,8 @@ void SetFirstLastPagesForUsed(INT32 iFilter)
|
||||
gubCurPage = 0;
|
||||
BOOLEAN bCntNumItems = FALSE;
|
||||
|
||||
|
||||
//First loop through to get the first and last index indexs
|
||||
for(i=0; i<MAXITEMS; i++)
|
||||
for(i=0; i<MAXITEMS; ++i)
|
||||
{
|
||||
//If we have some of the inventory on hand
|
||||
if( LaptopSaveInfo.BobbyRayUsedInventory[ i ].ubQtyOnHand != 0 )
|
||||
@@ -3594,20 +3593,13 @@ void CalcFirstIndexForPage( STORE_INVENTORY *pInv, UINT32 uiItemClass )
|
||||
|
||||
BOOLEAN IsAmmoMatchinWeaponType(UINT16 usItemIndex, UINT8 ubWeaponType)
|
||||
{
|
||||
// usItemIndex == Ammo
|
||||
|
||||
BOOLEAN bRetValue = FALSE;
|
||||
|
||||
UINT32 i;
|
||||
|
||||
for (i = 0; i < MAXITEMS; i++)
|
||||
|
||||
for ( UINT32 i = 0; i < gMAXITEMS_READ; ++i )
|
||||
{
|
||||
if (Item[i].usItemClass != IC_GUN )
|
||||
continue;
|
||||
|
||||
if (Item[i].usItemClass == 0)
|
||||
break; // out of items
|
||||
|
||||
// We found the Weapon that uses this Ammo
|
||||
if (Magazine[ Item[ usItemIndex ].ubClassIndex ].ubCalibre == Weapon[i].ubCalibre)
|
||||
{
|
||||
|
||||
@@ -1166,9 +1166,6 @@ BOOLEAN LoadBriefingRoomFromLoadGameFile( HWFILE hFile )
|
||||
#ifdef ENABLE_BRIEFINGROOM
|
||||
UINT32 uiNumBytesRead;
|
||||
UINT32 i;
|
||||
#endif
|
||||
|
||||
#ifdef ENABLE_BRIEFINGROOM
|
||||
|
||||
// Flugente: compatibility fix
|
||||
BOOLEAN briefingroomreadingdone = FALSE;
|
||||
@@ -1189,7 +1186,7 @@ BOOLEAN LoadBriefingRoomFromLoadGameFile( HWFILE hFile )
|
||||
|
||||
if ( !briefingroomreadingdone )
|
||||
{
|
||||
for(i=0; i<NUM_MISSION; i++)
|
||||
for(i=0; i<NUM_MISSION; ++i)
|
||||
{
|
||||
gBriefingRoomData[ i ].Hidden = saveBriefingRoomData[i].Hidden;
|
||||
gBriefingRoomData[ i ].CheckMission = saveBriefingRoomData[i].CheckMission;
|
||||
@@ -1202,7 +1199,7 @@ BOOLEAN LoadBriefingRoomFromLoadGameFile( HWFILE hFile )
|
||||
return( FALSE );
|
||||
}
|
||||
|
||||
for(i=0; i<NUM_MISSION; i++)
|
||||
for(i=0; i<NUM_MISSION; ++i)
|
||||
{
|
||||
gBriefingRoomSpecialMissionData[ i ].Hidden = saveBriefingRoomSpecialMissionData[i].Hidden;
|
||||
gBriefingRoomSpecialMissionData[ i ].CheckMission = saveBriefingRoomSpecialMissionData[i].CheckMission;
|
||||
|
||||
@@ -1683,11 +1683,11 @@ void GiveIMPRandomItems( MERCPROFILESTRUCT *pProfile, UINT8 typeIndex )
|
||||
BOOLEAN ubItemsGiven[ 50 ]={FALSE};
|
||||
|
||||
// check how many legal items are in the choices list, this is to prevent infinite loop
|
||||
for ( UINT8 cnt=0; cnt < ubNumChoices; cnt++ )
|
||||
for ( UINT8 cnt=0; cnt < ubNumChoices; ++cnt )
|
||||
{
|
||||
usItem = gIMPItemChoices[ typeIndex ].bItemNo[ cnt ];
|
||||
if ( ItemIsLegal(usItem) )
|
||||
ubValidChoices++;
|
||||
++ubValidChoices;
|
||||
}
|
||||
|
||||
// if no valid items found, bail out
|
||||
@@ -1702,7 +1702,7 @@ void GiveIMPRandomItems( MERCPROFILESTRUCT *pProfile, UINT8 typeIndex )
|
||||
// give us the maximum possible
|
||||
ubNumItemsToGive = gIMPItemChoices[typeIndex].ubNumItems;
|
||||
|
||||
for ( int i=0; i < ubNumItemsToGive ;i++ )
|
||||
for ( int i=0; i < ubNumItemsToGive; ++i )
|
||||
{
|
||||
usItem = 0;
|
||||
while (usItem == 0 )
|
||||
@@ -1720,7 +1720,7 @@ void GiveIMPRandomItems( MERCPROFILESTRUCT *pProfile, UINT8 typeIndex )
|
||||
MakeProfileInvItemAnySlot(pProfile,usItem,100,1);
|
||||
|
||||
// give ammo for guns
|
||||
Assert(usItem<MAXITEMS);
|
||||
Assert( usItem < gMAXITEMS_READ );
|
||||
if ( Item[usItem].usItemClass == IC_GUN && !Item[usItem].rocketlauncher )
|
||||
{
|
||||
usItem = DefaultMagazine(usItem);
|
||||
@@ -1736,7 +1736,6 @@ void GiveIMPRandomItems( MERCPROFILESTRUCT *pProfile, UINT8 typeIndex )
|
||||
MakeProfileInvItemAnySlot(pProfile,usItem,100,(2+Random(2)));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void GiveIMPItems( MERCPROFILESTRUCT *pProfile, INT8 abilityValue, UINT8 typeIndex )
|
||||
|
||||
@@ -796,10 +796,10 @@ void SetupStoreInventory( STORE_INVENTORY *pInventoryArray, BOOLEAN fUsed )
|
||||
UINT8 ubNumBought;
|
||||
|
||||
//loop through all items BR can stock to init a starting quantity on hand
|
||||
for(i = 0; i < LaptopSaveInfo.usInventoryListLength[fUsed]; i++)
|
||||
for(i = 0; i < LaptopSaveInfo.usInventoryListLength[fUsed]; ++i)
|
||||
{
|
||||
usItemIndex = pInventoryArray[ i ].usItemIndex;
|
||||
Assert(usItemIndex < MAXITEMS);
|
||||
Assert( usItemIndex < MAXITEMS );
|
||||
|
||||
ubNumBought = DetermineInitialInvItems( -1, usItemIndex, StoreInventory[ usItemIndex ][ fUsed ], fUsed);
|
||||
if ( ubNumBought > 0)
|
||||
@@ -830,17 +830,14 @@ void SetupStoreInventory( STORE_INVENTORY *pInventoryArray, BOOLEAN fUsed )
|
||||
|
||||
BOOLEAN DoesGunOfSameClassExistInInventory( UINT8 ubItemIndex, UINT8 ubDealerID )
|
||||
{
|
||||
UINT16 i;
|
||||
|
||||
STORE_INVENTORY *pInventoryArray;
|
||||
|
||||
pInventoryArray = GetPtrToStoreInventory( ubDealerID );
|
||||
if( pInventoryArray == NULL )
|
||||
return( FALSE );
|
||||
|
||||
|
||||
|
||||
//go through all of the guns
|
||||
for(i=0; i<MAXITEMS; i++)
|
||||
for ( UINT16 i = 0; i<gMAXITEMS_READ; ++i )
|
||||
{
|
||||
//if it's the class we are looking for
|
||||
if( Weapon[ i ].ubWeaponClass == ubItemIndex )
|
||||
@@ -856,6 +853,7 @@ BOOLEAN DoesGunOfSameClassExistInInventory( UINT8 ubItemIndex, UINT8 ubDealerID
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return(FALSE);
|
||||
}
|
||||
|
||||
|
||||
+8
-8
@@ -849,22 +849,20 @@ BOOLEAN LoadArmsDealerInventoryFromSavedGameFile( HWFILE hFile )
|
||||
OLD_DEALER_SPECIAL_ITEM_101 oldSpecial;
|
||||
DEALER_SPECIAL_ITEM loadedSpecial;
|
||||
//loop through all the dealers inventories
|
||||
for( ubArmsDealer=0; ubArmsDealer<uiDealersSaved; ubArmsDealer++ )
|
||||
for( ubArmsDealer=0; ubArmsDealer<uiDealersSaved; ++ubArmsDealer )
|
||||
{
|
||||
gArmsDealerStatus[ubArmsDealer] = gOldArmsDealerStatus[ubArmsDealer];
|
||||
|
||||
//loop through this dealer's individual items
|
||||
for(usItemIndex = 1; usItemIndex < MAXITEMS; usItemIndex++ )
|
||||
for ( usItemIndex = 1; usItemIndex < gMAXITEMS_READ; ++usItemIndex )
|
||||
{
|
||||
if ( Item[usItemIndex].usItemClass == 0 )
|
||||
continue;
|
||||
|
||||
//some things are much much better stored in status now
|
||||
gArmsDealerStatus[ubArmsDealer].fPreviouslyEligible[usItemIndex] = (*pOldArmsDealersInventory)[ubArmsDealer][usItemIndex].fPreviouslyEligible;
|
||||
gArmsDealerStatus[ubArmsDealer].ubStrayAmmo[usItemIndex] = (*pOldArmsDealersInventory)[ubArmsDealer][usItemIndex].ubStrayAmmo;
|
||||
|
||||
//if there are any perfect items, insert them immediately
|
||||
if ((*pOldArmsDealersInventory)[ubArmsDealer][usItemIndex].ubPerfectItems) {
|
||||
if ((*pOldArmsDealersInventory)[ubArmsDealer][usItemIndex].ubPerfectItems)
|
||||
{
|
||||
gArmsDealersInventory[ubArmsDealer].push_back(DEALER_SPECIAL_ITEM());
|
||||
DEALER_SPECIAL_ITEM* pPerfectItem = &gArmsDealersInventory[ubArmsDealer].back();
|
||||
CreateObjectForDealer(usItemIndex, 100, (*pOldArmsDealersInventory)[ubArmsDealer][usItemIndex].ubPerfectItems, &pPerfectItem->object);
|
||||
@@ -873,14 +871,16 @@ BOOLEAN LoadArmsDealerInventoryFromSavedGameFile( HWFILE hFile )
|
||||
}
|
||||
|
||||
//if there are any items on order, order them
|
||||
if ((*pOldArmsDealersInventory)[ubArmsDealer][usItemIndex].ubQtyOnOrder) {
|
||||
if ((*pOldArmsDealersInventory)[ubArmsDealer][usItemIndex].ubQtyOnOrder)
|
||||
{
|
||||
OrderDealerItems(ubArmsDealer, usItemIndex,
|
||||
(*pOldArmsDealersInventory)[ubArmsDealer][usItemIndex].ubQtyOnOrder,
|
||||
(*pOldArmsDealersInventory)[ubArmsDealer][usItemIndex].uiOrderArrivalTime);
|
||||
}
|
||||
|
||||
//if there are any special elements allocated for this item, load them
|
||||
for ( int x = 0; x < (*pOldArmsDealersInventory)[ubArmsDealer][usItemIndex].ubElementsAlloced; ++x) {
|
||||
for ( int x = 0; x < (*pOldArmsDealersInventory)[ubArmsDealer][usItemIndex].ubElementsAlloced; ++x)
|
||||
{
|
||||
if (!FileRead( hFile, &oldSpecial, sizeof( OLD_DEALER_SPECIAL_ITEM_101 ), &uiNumBytesRead ))
|
||||
{
|
||||
return( FALSE );
|
||||
|
||||
@@ -2054,10 +2054,10 @@ void BuildStashForSelectedSector( INT16 sMapX, INT16 sMapY, INT16 sMapZ )
|
||||
// was temporay used to get #items in file, now count what actually is added
|
||||
fNumTotal = 0;
|
||||
// now run through list and copy reference
|
||||
for(UINT32 i = 0; i < fWorldItems.size(); i++ )
|
||||
for(UINT32 i = 0; i < fWorldItems.size(); ++i )
|
||||
{
|
||||
// TEST!! If the item exists, and is NOT VALID, report it
|
||||
if( fWorldItems[i].fExists && fWorldItems[ i ].object.usItem > MAXITEMS )
|
||||
if( fWorldItems[i].fExists && fWorldItems[ i ].object.usItem > gMAXITEMS_READ )
|
||||
{
|
||||
ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_BETAVERSION, L"The %d item in the list is NOT valid (ID%d). Please send save. DF 1.", i, fWorldItems[i].object.usItem );
|
||||
}
|
||||
@@ -4744,7 +4744,7 @@ void SortSectorInventoryAmmo(bool useBoxes)
|
||||
while (ammoPresent && loopCount <= 10 )
|
||||
{
|
||||
// Start scanning through the entire Sector Inventory pool.
|
||||
for(UINT32 iInvCounter = 0; iInvCounter < uiOrigInvSize; iInvCounter++)
|
||||
for(UINT32 iInvCounter = 0; iInvCounter < uiOrigInvSize; ++iInvCounter)
|
||||
{
|
||||
// Set values
|
||||
crateItem = 0;
|
||||
@@ -4770,7 +4770,7 @@ void SortSectorInventoryAmmo(bool useBoxes)
|
||||
// as possible into crates.
|
||||
|
||||
// Look through all items in the game to try and find an ammocrate that can contain this kind of ammo.
|
||||
for(int iCrateLoop = 0; iCrateLoop < MAXITEMS; iCrateLoop++)
|
||||
for ( int iCrateLoop = 0; iCrateLoop < gMAXITEMS_READ; ++iCrateLoop )
|
||||
{
|
||||
// Is it the right ammo crate?
|
||||
if( Item[iCrateLoop].usItemClass == IC_AMMO &&
|
||||
@@ -4788,7 +4788,7 @@ void SortSectorInventoryAmmo(bool useBoxes)
|
||||
if(crateItem != 0)
|
||||
{
|
||||
// Excellent. Let see if a crate like this already exists in the Sector Inventory.
|
||||
for(UINT32 iInvCounter2=0; iInvCounter2 < pInventoryPoolList.size(); iInvCounter2++)
|
||||
for(UINT32 iInvCounter2=0; iInvCounter2 < pInventoryPoolList.size(); ++iInvCounter2)
|
||||
{
|
||||
// Non-empty slots please...
|
||||
if(pInventoryPoolList[iInvCounter2].object.exists() == true)
|
||||
|
||||
@@ -197,8 +197,7 @@ void InitAllArmsDealers()
|
||||
void InitializeOneArmsDealer( UINT8 ubArmsDealer )
|
||||
{
|
||||
UINT16 usItemIndex;
|
||||
UINT8 ubNumItems=0;
|
||||
|
||||
UINT8 ubNumItems=0;
|
||||
|
||||
memset( &( gArmsDealerStatus[ ubArmsDealer ] ), 0, sizeof( ARMS_DEALER_STATUS ) );
|
||||
gArmsDealersInventory.resize(gArmsDealersInventory.size() + 1);
|
||||
@@ -212,9 +211,8 @@ void InitializeOneArmsDealer( UINT8 ubArmsDealer )
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
//loop through all the item types
|
||||
for( usItemIndex = 1; usItemIndex < MAXITEMS; usItemIndex++ )
|
||||
for ( usItemIndex = 1; usItemIndex < gMAXITEMS_READ; ++usItemIndex )
|
||||
{
|
||||
if ( Item[usItemIndex].usItemClass == 0 )
|
||||
break;
|
||||
@@ -332,14 +330,14 @@ void DailyUpdateOfArmsDealersInventory()
|
||||
// Once a day, loop through each dealer's inventory items and possibly sell some
|
||||
void SimulateArmsDealerCustomer()
|
||||
{
|
||||
UINT8 ubArmsDealer=0;
|
||||
UINT8 ubArmsDealer=0;
|
||||
UINT16 usItemIndex;
|
||||
UINT8 ubItemsSold=0;
|
||||
|
||||
static int numPerfectItems[MAXITEMS];
|
||||
|
||||
//loop through all the arms dealers
|
||||
for( ubArmsDealer=0;ubArmsDealer<NUM_ARMS_DEALERS;ubArmsDealer++ )
|
||||
for( ubArmsDealer=0;ubArmsDealer<NUM_ARMS_DEALERS; ++ubArmsDealer )
|
||||
{
|
||||
if( gArmsDealerStatus[ ubArmsDealer ].fOutOfBusiness )
|
||||
continue;
|
||||
@@ -350,15 +348,17 @@ void SimulateArmsDealerCustomer()
|
||||
|
||||
memset (&numPerfectItems, 0, sizeof(numPerfectItems));
|
||||
|
||||
for (DealerItemList::iterator iter = gArmsDealersInventory[ ubArmsDealer ].begin();
|
||||
iter != gArmsDealersInventory[ ubArmsDealer ].end(); ++iter) {
|
||||
if (iter->ItemIsInInventory() == true && iter->bItemCondition == 100) {
|
||||
DealerItemList::iterator iterend = gArmsDealersInventory[ubArmsDealer].end( );
|
||||
for (DealerItemList::iterator iter = gArmsDealersInventory[ ubArmsDealer ].begin(); iter != iterend; ++iter )
|
||||
{
|
||||
if (iter->ItemIsInInventory() == true && iter->bItemCondition == 100)
|
||||
{
|
||||
numPerfectItems[iter->object.usItem] += iter->object.ubNumberOfObjects;
|
||||
}
|
||||
}
|
||||
|
||||
//loop through all items of the same type
|
||||
for( usItemIndex = 1; usItemIndex < MAXITEMS; usItemIndex++ )
|
||||
for ( usItemIndex = 1; usItemIndex < gMAXITEMS_READ; ++usItemIndex )
|
||||
{
|
||||
if ( Item[usItemIndex].usItemClass == 0 )
|
||||
break;
|
||||
@@ -389,19 +389,21 @@ void SimulateArmsDealerCustomer()
|
||||
}
|
||||
}
|
||||
|
||||
for (DealerItemList::iterator iter = gArmsDealersInventory[ ubArmsDealer ].begin();
|
||||
iter != gArmsDealersInventory[ ubArmsDealer ].end(); ++iter) {
|
||||
iterend = gArmsDealersInventory[ubArmsDealer].end();
|
||||
for (DealerItemList::iterator iter = gArmsDealersInventory[ ubArmsDealer ].begin(); iter != iterend; ++iter )
|
||||
{
|
||||
// next, try to sell all the used ones, gotta do these one at a time so we can remove them by element
|
||||
// don't worry about negative condition, repairmen can't come this far, they don't sell!
|
||||
if (iter->bItemCondition < 100 && iter->bItemCondition > 0) {
|
||||
if ( iter->ItemIsInInventory() == true) {
|
||||
if (iter->bItemCondition < 100 && iter->bItemCondition > 0)
|
||||
{
|
||||
if ( iter->ItemIsInInventory() == true)
|
||||
{
|
||||
// try selling just this one
|
||||
if (HowManyItemsAreSold( ubArmsDealer, iter->object.usItem, 1, TRUE) > 0)
|
||||
{
|
||||
iter = gArmsDealersInventory[ ubArmsDealer ].erase(iter);
|
||||
if (iter == gArmsDealersInventory[ ubArmsDealer ].end()) {
|
||||
if (iter == gArmsDealersInventory[ ubArmsDealer ].end() )
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -424,7 +426,7 @@ void DailyCheckOnItemQuantities()
|
||||
|
||||
|
||||
//loop through all the arms dealers
|
||||
for( ubArmsDealer=0;ubArmsDealer<NUM_ARMS_DEALERS;ubArmsDealer++ )
|
||||
for( ubArmsDealer=0;ubArmsDealer<NUM_ARMS_DEALERS; ++ubArmsDealer )
|
||||
{
|
||||
if( gArmsDealerStatus[ ubArmsDealer ].fOutOfBusiness )
|
||||
continue;
|
||||
@@ -469,10 +471,8 @@ void DailyCheckOnItemQuantities()
|
||||
}
|
||||
|
||||
//loop through all items of the same type
|
||||
for( usItemIndex = 1; usItemIndex < MAXITEMS; usItemIndex++ )
|
||||
for ( usItemIndex = 1; usItemIndex < gMAXITEMS_READ; ++usItemIndex )
|
||||
{
|
||||
if ( Item[usItemIndex].usItemClass == 0 )
|
||||
break;
|
||||
//if the dealer can sell the item type
|
||||
if( CanDealerTransactItem( ubArmsDealer, usItemIndex, FALSE ) )
|
||||
{
|
||||
@@ -701,10 +701,8 @@ void LimitArmsDealersInventory( UINT8 ubArmsDealer, UINT32 uiDealerItemType, UIN
|
||||
std::vector<int> usAvailableItems;
|
||||
std::vector<UINT32> ubNumberOfAvailableItem;
|
||||
//loop through all items of the same class and count the number in stock
|
||||
for( usItemIndex = 1; usItemIndex < MAXITEMS; usItemIndex++ )
|
||||
for ( usItemIndex = 1; usItemIndex < gMAXITEMS_READ; ++usItemIndex )
|
||||
{
|
||||
if ( Item[usItemIndex].usItemClass == 0 )
|
||||
break;
|
||||
//if there is some items in stock
|
||||
if( numTotalItems[usItemIndex] > 0)
|
||||
{
|
||||
@@ -838,10 +836,8 @@ void GuaranteeAtLeastOneItemOfType( UINT8 ubArmsDealer, UINT32 uiDealerItemType
|
||||
std::vector<UINT16> usAvailableItems;
|
||||
std::vector<UINT8> ubChanceForAvailableItem;
|
||||
//loop through all items of the same type
|
||||
for( usItemIndex = 1; usItemIndex < MAXITEMS; usItemIndex++ )
|
||||
for ( usItemIndex = 1; usItemIndex < gMAXITEMS_READ; ++usItemIndex )
|
||||
{
|
||||
if ( Item[usItemIndex].usItemClass == 0 )
|
||||
break;
|
||||
//if the item is of the same dealer item type
|
||||
if( uiDealerItemType & GetArmsDealerItemTypeFromItemNumber( usItemIndex ) )
|
||||
{
|
||||
@@ -1447,7 +1443,6 @@ bool ItemIsSpecial(DEALER_SPECIAL_ITEM& item)
|
||||
|
||||
UINT16 CountTotalItemsRepairDealerHasInForRepairs( UINT8 ubArmsDealer )
|
||||
{
|
||||
UINT16 usItemIndex;
|
||||
UINT16 usHowManyInForRepairs = 0;
|
||||
|
||||
//if the dealer is not a repair dealer, no need to count, return 0
|
||||
@@ -1455,10 +1450,8 @@ UINT16 CountTotalItemsRepairDealerHasInForRepairs( UINT8 ubArmsDealer )
|
||||
return( 0 );
|
||||
|
||||
//loop through the dealers inventory and count the number of items in for repairs
|
||||
for( usItemIndex=0; usItemIndex < MAXITEMS; usItemIndex++ )
|
||||
for ( UINT16 usItemIndex = 0; usItemIndex < gMAXITEMS_READ; ++usItemIndex )
|
||||
{
|
||||
if ( Item[usItemIndex].usItemClass == 0 )
|
||||
break;
|
||||
usHowManyInForRepairs += CountSpecificItemsRepairDealerHasInForRepairs( ubArmsDealer, usItemIndex );
|
||||
}
|
||||
|
||||
@@ -1474,13 +1467,12 @@ UINT8 CountSpecificItemsRepairDealerHasInForRepairs( UINT8 ubArmsDealer, UINT16
|
||||
if( !DoesDealerDoRepairs( ubArmsDealer ) )
|
||||
return( 0 );
|
||||
|
||||
|
||||
for (DealerItemList::iterator iter = gArmsDealersInventory[ ubArmsDealer ].begin();
|
||||
iter != gArmsDealersInventory[ ubArmsDealer ].end(); ++iter) {
|
||||
if (iter->object.exists() == true && iter->object.usItem == usItemIndex) {
|
||||
if( iter->IsUnderRepair() == true )
|
||||
{
|
||||
ubHowManyInForRepairs++;
|
||||
++ubHowManyInForRepairs;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1697,11 +1689,13 @@ void RemoveItemFromArmsDealerInventory( UINT8 ubArmsDealer, UINT16 usItemIndex,
|
||||
{
|
||||
return;
|
||||
}
|
||||
for (DealerItemList::iterator iter = gArmsDealersInventory[ ubArmsDealer ].begin(); iter != gArmsDealersInventory[ ubArmsDealer ].end(); iter++){
|
||||
if (iter->ItemIsInInventory() == true && iter->object.usItem == usItemIndex) {
|
||||
for (DealerItemList::iterator iter = gArmsDealersInventory[ ubArmsDealer ].begin(); iter != gArmsDealersInventory[ ubArmsDealer ].end(); ++iter)
|
||||
{
|
||||
if (iter->ItemIsInInventory() == true && iter->object.usItem == usItemIndex)
|
||||
{
|
||||
if(pObj != 0)
|
||||
{
|
||||
for(unsigned int i = 0; i < ubHowMany; i++)
|
||||
for(unsigned int i = 0; i < ubHowMany; ++i)
|
||||
{
|
||||
if((*pObj)[i]->operator == (*iter->object[i]))
|
||||
match = TRUE;
|
||||
|
||||
@@ -1459,14 +1459,13 @@ int CompareItemsForSorting( UINT16 usItem1Index, UINT16 usItem2Index, UINT16 ubI
|
||||
|
||||
UINT8 GetDealerItemCategoryNumber( UINT16 usItemIndex )
|
||||
{
|
||||
UINT32 uiItemClass;
|
||||
UINT32 uiItemClass;
|
||||
UINT8 ubWeaponClass;
|
||||
UINT8 ubCategory = 0;
|
||||
|
||||
|
||||
uiItemClass = Item[ usItemIndex ].usItemClass;
|
||||
|
||||
if ( usItemIndex < MAXITEMS && IsWeapon(usItemIndex) )
|
||||
if ( usItemIndex < gMAXITEMS_READ && IsWeapon( usItemIndex ) )
|
||||
{
|
||||
ubWeaponClass = 0;// Madd: commented out so we can sort guns by name instead ... Weapon[ usItemIndex ].ubWeaponClass;
|
||||
}
|
||||
@@ -1476,7 +1475,6 @@ UINT8 GetDealerItemCategoryNumber( UINT16 usItemIndex )
|
||||
ubWeaponClass = 0;
|
||||
}
|
||||
|
||||
|
||||
ubCategory = 0;
|
||||
|
||||
// search table until end-of-list marker is encountered
|
||||
@@ -1502,7 +1500,7 @@ UINT8 GetDealerItemCategoryNumber( UINT16 usItemIndex )
|
||||
}
|
||||
|
||||
// check vs. next category in the list
|
||||
ubCategory++;
|
||||
++ubCategory;
|
||||
}
|
||||
|
||||
// WANNE: commented the assert out, because we always get the assertion in debug mode!
|
||||
|
||||
+195
-204
File diff suppressed because it is too large
Load Diff
@@ -3021,7 +3021,7 @@ void RenderSMPanel( BOOLEAN *pfDirty )
|
||||
|
||||
// lets rearrange our skills to a temp array
|
||||
// we also get the number of lines (skills) to be displayed
|
||||
for ( UINT8 ubCnt = 1; ubCnt < NUM_SKILLTRAITS_NT; ubCnt++ )
|
||||
for ( UINT8 ubCnt = 1; ubCnt < NUM_SKILLTRAITS_NT; ++ubCnt )
|
||||
{
|
||||
if ( ProfileHasSkillTrait( gpSMCurrentMerc->ubProfile, ubCnt ) == 2 )
|
||||
{
|
||||
@@ -3041,7 +3041,7 @@ void RenderSMPanel( BOOLEAN *pfDirty )
|
||||
}
|
||||
else
|
||||
{
|
||||
for ( UINT8 ubCnt = 0; ubCnt < bNumSkillTraits; ubCnt++ )
|
||||
for ( UINT8 ubCnt = 0; ubCnt < bNumSkillTraits; ++ubCnt )
|
||||
{
|
||||
swprintf( sTemp, L"%s\n", gzMercSkillTextNew[ ubTempSkillArray[ubCnt] ] );
|
||||
wcscat( pStr, sTemp );
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
#include "GameSettings.h"
|
||||
#endif
|
||||
|
||||
#define LIFE_BAR_SHADOW FROMRGB( 108, 12, 12 )
|
||||
#define LIFE_BAR_SHADOW FROMRGB( 108, 12, 12 )
|
||||
#define LIFE_BAR FROMRGB( 200, 0, 0 )
|
||||
#define BANDAGE_BAR_SHADOW FROMRGB( 156, 60, 60 )
|
||||
#define BANDAGE_BAR FROMRGB( 222, 132, 132 )
|
||||
@@ -81,7 +81,6 @@ STR pbCarPortraitFileNames[ ]={
|
||||
// load int he portraits for the car faces that will be use in mapscreen
|
||||
BOOLEAN LoadCarPortraitValues( void )
|
||||
{
|
||||
INT32 iCounter = 0;
|
||||
VOBJECT_DESC VObjectDesc;
|
||||
|
||||
/*
|
||||
@@ -91,15 +90,15 @@ BOOLEAN LoadCarPortraitValues( void )
|
||||
}
|
||||
*/
|
||||
|
||||
for( iCounter = 0; iCounter < NUM_PROFILES; iCounter++ )
|
||||
for ( INT32 iCounter = 0; iCounter < NUM_PROFILES; ++iCounter )
|
||||
{
|
||||
// silversurfer: fixed to make sure that we only create objects for vehicles that have a face defined
|
||||
// otherwise CHECKF will fail and return FALSE breaking the for loop and ignoring any further vehicles
|
||||
if ( gProfilesVehicle[ iCounter ].ProfilId == iCounter && gNewVehicle[ iCounter ].szIconFace[0] != 0 )
|
||||
{
|
||||
VObjectDesc.fCreateFlags = VOBJECT_CREATE_FROMFILE;
|
||||
strcpy( VObjectDesc.ImageFile, gNewVehicle[ iCounter ].szIconFace );
|
||||
CHECKF( AddVideoObject( &VObjectDesc, (UINT32 *)&giCarPortraits[ iCounter ] ) );
|
||||
VObjectDesc.fCreateFlags = VOBJECT_CREATE_FROMFILE;
|
||||
strcpy( VObjectDesc.ImageFile, gNewVehicle[ iCounter ].szIconFace );
|
||||
CHECKF( AddVideoObject( &VObjectDesc, (UINT32 *)&giCarPortraits[ iCounter ] ) );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -116,8 +115,6 @@ BOOLEAN LoadCarPortraitValues( void )
|
||||
// get rid of the images we loaded for the mapscreen car portraits
|
||||
void UnLoadCarPortraits( void )
|
||||
{
|
||||
INT32 iCounter = 0;
|
||||
|
||||
// car protraits loaded?
|
||||
/*
|
||||
if( giCarPortraits[ 0 ] == -1 )
|
||||
@@ -132,15 +129,13 @@ void UnLoadCarPortraits( void )
|
||||
}
|
||||
*/
|
||||
|
||||
for( iCounter = 0; iCounter < NUM_PROFILES; iCounter++ )
|
||||
for ( INT32 iCounter = 0; iCounter < NUM_PROFILES; ++iCounter )
|
||||
{
|
||||
if ( gProfilesVehicle[ iCounter ].ProfilId == iCounter )
|
||||
{
|
||||
DeleteVideoObjectFromIndex( giCarPortraits[ iCounter ] );
|
||||
}
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -281,19 +276,18 @@ void DrawLifeUIBarEx( SOLDIERTYPE *pSoldier, INT16 sXPos, INT16 sYPos, INT16 sWi
|
||||
}
|
||||
|
||||
UnLockVideoSurface( uiBuffer );
|
||||
|
||||
}
|
||||
|
||||
|
||||
void DrawBreathUIBarEx( SOLDIERTYPE *pSoldier, INT16 sXPos, INT16 sYPos, INT16 sWidth, INT16 sHeight, BOOLEAN fErase, UINT32 uiBuffer )
|
||||
{
|
||||
FLOAT dStart, dEnd, dPercentage;
|
||||
FLOAT dStart, dEnd, dPercentage;
|
||||
//UINT16 usLineColor;
|
||||
|
||||
UINT32 uiDestPitchBYTES;
|
||||
UINT8 *pDestBuf;
|
||||
UINT8 *pDestBuf;
|
||||
UINT16 usLineColor;
|
||||
HVOBJECT hHandle;
|
||||
HVOBJECT hHandle;
|
||||
|
||||
// Erase what was there
|
||||
if ( fErase )
|
||||
@@ -307,12 +301,10 @@ void DrawBreathUIBarEx( SOLDIERTYPE *pSoldier, INT16 sXPos, INT16 sYPos, INT16 s
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
|
||||
// DO MAX MAX BREATH
|
||||
dPercentage = 1.;
|
||||
dEnd = dPercentage * sHeight;
|
||||
dStart = sYPos;
|
||||
dEnd = dPercentage * sHeight;
|
||||
dStart = sYPos;
|
||||
|
||||
// brown guy
|
||||
GetVideoObject( &hHandle, guiBrownBackgroundForTeamPanel );
|
||||
@@ -323,21 +315,18 @@ void DrawBreathUIBarEx( SOLDIERTYPE *pSoldier, INT16 sXPos, INT16 sYPos, INT16 s
|
||||
if( gusSelectedSoldier == pSoldier->ubID && gTacticalStatus.ubCurrentTeam == OUR_TEAM && OK_INTERRUPT_MERC( pSoldier ) )
|
||||
{
|
||||
// gold, the second entry in the .sti
|
||||
BltVideoObject( uiBuffer , hHandle, 1, sXPos, ( INT16 )( sYPos - sHeight ), VO_BLT_SRCTRANSPARENCY, NULL );
|
||||
|
||||
BltVideoObject( uiBuffer , hHandle, 1, sXPos, ( INT16 )( sYPos - sHeight ), VO_BLT_SRCTRANSPARENCY, NULL );
|
||||
}
|
||||
else
|
||||
{
|
||||
// brown, first entry
|
||||
BltVideoObject( uiBuffer , hHandle, 0, sXPos, ( INT16 )( sYPos - sHeight ), VO_BLT_SRCTRANSPARENCY, NULL );
|
||||
|
||||
BltVideoObject( uiBuffer , hHandle, 0, sXPos, ( INT16 )( sYPos - sHeight ), VO_BLT_SRCTRANSPARENCY, NULL );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// brown, first entry
|
||||
BltVideoObject( uiBuffer , hHandle, 0, sXPos, ( INT16 )( sYPos - sHeight ), VO_BLT_SRCTRANSPARENCY, NULL );
|
||||
|
||||
BltVideoObject( uiBuffer , hHandle, 0, sXPos, ( INT16 )( sYPos - sHeight ), VO_BLT_SRCTRANSPARENCY, NULL );
|
||||
}
|
||||
|
||||
pDestBuf = LockVideoSurface( uiBuffer, &uiDestPitchBYTES );
|
||||
@@ -360,9 +349,6 @@ void DrawBreathUIBarEx( SOLDIERTYPE *pSoldier, INT16 sXPos, INT16 sYPos, INT16 s
|
||||
RectangleDraw( TRUE, sXPos+ 2, (INT32)dStart, sXPos + 2, (INT32)( dStart - dEnd ), usLineColor, pDestBuf );
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
dPercentage = (FLOAT)pSoldier->bBreathMax / (FLOAT)100;
|
||||
dEnd = dPercentage * sHeight;
|
||||
dStart = sYPos;
|
||||
@@ -376,7 +362,6 @@ void DrawBreathUIBarEx( SOLDIERTYPE *pSoldier, INT16 sXPos, INT16 sYPos, INT16 s
|
||||
usLineColor = Get16BPPColor( CURR_MAX_BREATH_SHADOW );
|
||||
RectangleDraw( TRUE, sXPos+ 2, (INT32)dStart, sXPos + 2, (INT32)( dStart - dEnd ), usLineColor, pDestBuf );
|
||||
|
||||
|
||||
// NOW DO BREATH
|
||||
dPercentage = (FLOAT)pSoldier->bBreath / (FLOAT)100;
|
||||
dEnd = dPercentage * sHeight;
|
||||
@@ -390,10 +375,8 @@ void DrawBreathUIBarEx( SOLDIERTYPE *pSoldier, INT16 sXPos, INT16 sYPos, INT16 s
|
||||
|
||||
usLineColor = Get16BPPColor( CURR_BREATH_BAR_SHADOW );
|
||||
RectangleDraw( TRUE, sXPos+ 2, (INT32)dStart, sXPos + 2, (INT32)( dStart - dEnd ), usLineColor, pDestBuf );
|
||||
|
||||
|
||||
|
||||
UnLockVideoSurface( uiBuffer );
|
||||
|
||||
}
|
||||
|
||||
void DrawMoraleUIBarEx( SOLDIERTYPE *pSoldier, INT16 sXPos, INT16 sYPos, INT16 sWidth, INT16 sHeight, BOOLEAN fErase, UINT32 uiBuffer )
|
||||
@@ -420,7 +403,6 @@ void DrawMoraleUIBarEx( SOLDIERTYPE *pSoldier, INT16 sXPos, INT16 sYPos, INT16 s
|
||||
pDestBuf = LockVideoSurface( uiBuffer, &uiDestPitchBYTES );
|
||||
SetClippingRegionAndImageWidth( uiDestPitchBYTES, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT );
|
||||
|
||||
|
||||
// FIRST DO BREATH
|
||||
dPercentage = (FLOAT)pSoldier->aiData.bMorale / (FLOAT)100;
|
||||
dEnd = dPercentage * sHeight;
|
||||
@@ -434,24 +416,21 @@ void DrawMoraleUIBarEx( SOLDIERTYPE *pSoldier, INT16 sXPos, INT16 sYPos, INT16 s
|
||||
|
||||
usLineColor = Get16BPPColor( MORALE_BAR_SHADOW );
|
||||
RectangleDraw( TRUE, sXPos+ 2, (INT32)dStart, sXPos + 2, (INT32)( dStart - dEnd ), usLineColor, pDestBuf );
|
||||
|
||||
|
||||
|
||||
UnLockVideoSurface( uiBuffer );
|
||||
|
||||
}
|
||||
|
||||
|
||||
void DrawItemUIBarEx( OBJECTTYPE *pObject, UINT8 ubStatus, INT16 sXPos, INT16 sYPos, INT16 sWidth, INT16 sHeight, INT16 sColor1, INT16 sColor2, BOOLEAN fErase, UINT32 uiBuffer, UINT8 iter )
|
||||
{
|
||||
FLOAT dStart, dEnd, dPercentage;
|
||||
FLOAT dStart, dEnd, dPercentage;
|
||||
//UINT16 usLineColor;
|
||||
|
||||
UINT32 uiDestPitchBYTES;
|
||||
UINT8 *pDestBuf;
|
||||
UINT8 *pDestBuf;
|
||||
UINT16 usLineColor;
|
||||
INT16 sValue;
|
||||
|
||||
|
||||
INT16 sValue;
|
||||
|
||||
if ( ubStatus >= DRAW_ITEM_STATUS_ATTACHMENT1 )
|
||||
{
|
||||
sValue = 0;
|
||||
@@ -469,18 +448,15 @@ void DrawItemUIBarEx( OBJECTTYPE *pObject, UINT8 ubStatus, INT16 sXPos, INT16 sY
|
||||
}
|
||||
else
|
||||
{
|
||||
if (ubStatus < pObject->ubNumberOfObjects) {
|
||||
if (ubStatus < pObject->ubNumberOfObjects)
|
||||
sValue = (*pObject)[ ubStatus ]->data.objectStatus;
|
||||
}
|
||||
else {
|
||||
else
|
||||
sValue = 0;
|
||||
}
|
||||
}
|
||||
|
||||
// Adjust for ammo, other thingys..
|
||||
if( Item[ pObject->usItem ].usItemClass & IC_AMMO )
|
||||
{
|
||||
|
||||
sValue = sValue * 100 / Magazine[ Item[ pObject->usItem ].ubClassIndex ].ubMagSize;
|
||||
|
||||
if ( sValue < 0 )
|
||||
@@ -488,17 +464,13 @@ void DrawItemUIBarEx( OBJECTTYPE *pObject, UINT8 ubStatus, INT16 sXPos, INT16 sY
|
||||
sValue = (*pObject)[iter]->data.ubShotsLeft * 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)[iter]->data.ubShotsLeft,Magazine[ Item[ pObject->usItem ].ubClassIndex ].ubMagSize,sValue ));
|
||||
}
|
||||
if ( sValue > 100 )
|
||||
{
|
||||
sValue = 100;
|
||||
}
|
||||
|
||||
if ( sValue > 100 )
|
||||
sValue = 100;
|
||||
}
|
||||
|
||||
if( Item[ pObject->usItem ].usItemClass & IC_KEY )
|
||||
{
|
||||
sValue =100;
|
||||
}
|
||||
|
||||
// Flugente
|
||||
if ( ubStatus == DRAW_ITEM_TEMPERATURE )
|
||||
@@ -531,14 +503,14 @@ void DrawItemUIBarEx( OBJECTTYPE *pObject, UINT8 ubStatus, INT16 sXPos, INT16 sY
|
||||
// ATE: Subtract 1 to exagerate bad status
|
||||
if ( sValue < 100 && sValue > 1 )
|
||||
{
|
||||
sValue--;
|
||||
--sValue;
|
||||
}
|
||||
|
||||
// Erase what was there
|
||||
if ( fErase )
|
||||
/*if ( fErase )
|
||||
{
|
||||
//RestoreExternBackgroundRect( sXPos, (INT16)(sYPos - sHeight), sWidth, (INT16)(sHeight + 1 ) );
|
||||
}
|
||||
RestoreExternBackgroundRect( sXPos, (INT16)(sYPos - sHeight), sWidth, (INT16)(sHeight + 1 ) );
|
||||
}*/
|
||||
|
||||
pDestBuf = LockVideoSurface( uiBuffer, &uiDestPitchBYTES );
|
||||
SetClippingRegionAndImageWidth( uiDestPitchBYTES, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT );
|
||||
@@ -560,14 +532,12 @@ void DrawItemUIBarEx( OBJECTTYPE *pObject, UINT8 ubStatus, INT16 sXPos, INT16 sY
|
||||
RectangleDraw( TRUE, sXPos + 1, (INT32)(dStart - repairthresholdend), sXPos + 1, (INT32)( dStart - sHeight ) , usLineColor, pDestBuf );
|
||||
}
|
||||
|
||||
//usLineColor = Get16BPPColor( STATUS_BAR );
|
||||
usLineColor = sColor1;
|
||||
RectangleDraw( TRUE, sXPos, (INT32)dStart, sXPos, (INT32)( dStart - dEnd ) , usLineColor, pDestBuf );
|
||||
|
||||
usLineColor = sColor2;
|
||||
RectangleDraw( TRUE, sXPos+ 1, (INT32)dStart, sXPos + 1, (INT32)( dStart - dEnd ), usLineColor, pDestBuf );
|
||||
|
||||
|
||||
UnLockVideoSurface( uiBuffer );
|
||||
|
||||
if ( uiBuffer == guiSAVEBUFFER )
|
||||
@@ -578,7 +548,6 @@ void DrawItemUIBarEx( OBJECTTYPE *pObject, UINT8 ubStatus, INT16 sXPos, INT16 sY
|
||||
{
|
||||
InvalidateRegion( sXPos, (INT16)(sYPos - sHeight), sXPos + sWidth, (INT16)(sYPos + 1 ) );
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void RenderSoldierFace( SOLDIERTYPE *pSoldier, INT16 sFaceX, INT16 sFaceY, BOOLEAN fAutoFace )
|
||||
@@ -586,10 +555,8 @@ void RenderSoldierFace( SOLDIERTYPE *pSoldier, INT16 sFaceX, INT16 sFaceY, BOOLE
|
||||
BOOLEAN fDoFace = FALSE;
|
||||
// UINT8 ubVehicleType = 0;
|
||||
|
||||
|
||||
if ( pSoldier->bActive )
|
||||
{
|
||||
|
||||
if( pSoldier->flags.uiStatusFlags & SOLDIER_VEHICLE )
|
||||
{
|
||||
// get the type of vehicle
|
||||
@@ -641,7 +608,6 @@ void RenderSoldierFace( SOLDIERTYPE *pSoldier, INT16 sFaceX, INT16 sFaceY, BOOLE
|
||||
//}
|
||||
RestoreExternBackgroundRect( sFaceX, sFaceY, FACE_WIDTH, FACE_HEIGHT );
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// HEADROCK HAM 5: This function draws a rectangle around the item image in the zoomed inventory
|
||||
|
||||
+19
-59
@@ -305,41 +305,35 @@ extern FLOAT Distance2D( FLOAT dDeltaX, FLOAT dDeltaY );
|
||||
// Flugente: toggle display of enemy role indicators
|
||||
BOOLEAN gDisplayEnemyRoles = TRUE;
|
||||
|
||||
#define SCSTI ".STI"
|
||||
#define SCSTI_IMP "_IMP.STI"
|
||||
|
||||
BOOLEAN InitializeFaceGearGraphics()
|
||||
{
|
||||
VOBJECT_DESC VObjectDesc;
|
||||
|
||||
char fileName[500];
|
||||
|
||||
for(UINT32 iCounter2 = 1; iCounter2 < MAXITEMS; iCounter2++ )
|
||||
{
|
||||
VObjectDesc.fCreateFlags = VSURFACE_CREATE_FROMFILE;
|
||||
|
||||
#define SCSTI ".STI"
|
||||
|
||||
for ( UINT32 iCounter2 = 1; iCounter2 < gMAXITEMS_READ; ++iCounter2 )
|
||||
{
|
||||
if ( zNewFaceGear[iCounter2].Type > 0 )
|
||||
{
|
||||
strcpy(fileName, zNewFaceGear[iCounter2].szFile);
|
||||
strcat(fileName, SCSTI);
|
||||
strcpy(VObjectDesc.ImageFile, fileName);
|
||||
CHECKF(AddVideoObject(&VObjectDesc,&zNewFaceGear[iCounter2].uiIndex));
|
||||
{
|
||||
VObjectDesc.fCreateFlags = VSURFACE_CREATE_FROMFILE;
|
||||
strcpy(fileName, zNewFaceGear[iCounter2].szFile);
|
||||
strcat(fileName, SCSTI);
|
||||
strcpy(VObjectDesc.ImageFile, fileName);
|
||||
CHECKF(AddVideoObject(&VObjectDesc,&zNewFaceGear[iCounter2].uiIndex));
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
for(UINT32 iCounter2 = 1; iCounter2 < MAXITEMS; iCounter2++ )
|
||||
{
|
||||
VObjectDesc.fCreateFlags = VSURFACE_CREATE_FROMFILE;
|
||||
|
||||
#define SCSTI_IMP "_IMP.STI"
|
||||
|
||||
if ( zNewFaceGear[iCounter2].Type > 0 )
|
||||
{
|
||||
//IMP
|
||||
strcpy(fileName, zNewFaceGear[iCounter2].szFile);
|
||||
strcat(fileName, SCSTI_IMP);
|
||||
strcpy(VObjectDesc.ImageFile, fileName);
|
||||
CHECKF(AddVideoObject(&VObjectDesc,&zNewFaceGearIMP[iCounter2].uiIndex));
|
||||
{
|
||||
VObjectDesc.fCreateFlags = VSURFACE_CREATE_FROMFILE;
|
||||
strcpy( fileName, zNewFaceGear[iCounter2].szFile );
|
||||
strcat( fileName, SCSTI_IMP );
|
||||
strcpy( VObjectDesc.ImageFile, fileName );
|
||||
CHECKF( AddVideoObject( &VObjectDesc, &zNewFaceGearIMP[iCounter2].uiIndex ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -562,40 +556,6 @@ BOOLEAN InitializeTacticalInterface( )
|
||||
|
||||
InitializeFaceGearGraphics();
|
||||
|
||||
/*
|
||||
for( iCounter2 = 1; iCounter2 < MAXITEMS; iCounter2++ )
|
||||
{
|
||||
VObjectDesc.fCreateFlags = VSURFACE_CREATE_FROMFILE;
|
||||
|
||||
#define SCSTI ".STI"
|
||||
|
||||
if ( zNewFaceGear[iCounter2].Type > 0 )
|
||||
{
|
||||
strcpy(fileName, zNewFaceGear[iCounter2].szFile);
|
||||
strcat(fileName, SCSTI);
|
||||
strcpy(VObjectDesc.ImageFile, fileName);
|
||||
CHECKF(AddVideoObject(&VObjectDesc,&zNewFaceGear[iCounter2].uiIndex));
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
for( iCounter2 = 1; iCounter2 < MAXITEMS; iCounter2++ )
|
||||
{
|
||||
VObjectDesc.fCreateFlags = VSURFACE_CREATE_FROMFILE;
|
||||
|
||||
#define SCSTI_IMP "_IMP.STI"
|
||||
|
||||
if ( zNewFaceGear[iCounter2].Type > 0 )
|
||||
{
|
||||
//IMP
|
||||
strcpy(fileName, zNewFaceGear[iCounter2].szFile);
|
||||
strcat(fileName, SCSTI_IMP);
|
||||
strcpy(VObjectDesc.ImageFile, fileName);
|
||||
CHECKF(AddVideoObject(&VObjectDesc,&zNewFaceGearIMP[iCounter2].uiIndex));
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
// LOAD RADIO
|
||||
VObjectDesc.fCreateFlags = VOBJECT_CREATE_FROMFILE;
|
||||
FilenameForBPP("INTERFACE\\radio.sti", VObjectDesc.ImageFile);
|
||||
|
||||
@@ -140,7 +140,7 @@ void InitArmyGunTypes(void)
|
||||
|
||||
DebugMsg (TOPIC_JA2,DBG_LEVEL_3,"InitArmyGunTypes mark weapons as not dropped");
|
||||
// set all flags that track whether this weapon type has been dropped before to FALSE
|
||||
for (ubWeapon = 0; ubWeapon < MAXITEMS; ubWeapon++)
|
||||
for (ubWeapon = 0; ubWeapon < MAXITEMS; ++ubWeapon)
|
||||
{
|
||||
DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("InitArmyGunTypes marking weapons %d", ubWeapon));
|
||||
gStrategicStatus.fWeaponDroppedAlready[ubWeapon] = FALSE;
|
||||
@@ -2627,7 +2627,7 @@ else
|
||||
if (gGameExternalOptions.ubEnemiesItemDrop == 0)
|
||||
{
|
||||
// if it's a weapon (monster parts included - they won't drop due to checks elsewhere!)
|
||||
if ((usItem > NONE) && (usItem < MAXITEMS )) // Madd -- this should be ok set to maxitems instead of max_Weapons
|
||||
if ( (usItem > NONE) && (usItem < gMAXITEMS_READ) ) // Madd -- this should be ok set to maxitems instead of max_Weapons
|
||||
{
|
||||
// and we're allowed to change its flags
|
||||
if(! (pp->Inv[ i ].fFlags & OBJECT_NO_OVERWRITE ))
|
||||
|
||||
@@ -1674,6 +1674,9 @@ typedef enum
|
||||
MAXITEMS = 16001
|
||||
} ITEMDEFINE;
|
||||
|
||||
// Flugente: in order not to loop over MAXITEMS items if we only have a few thousand, remember the actual number of items in the xml
|
||||
extern UINT32 gMAXITEMS_READ;
|
||||
|
||||
/* CHRISL: Arrays to track ic group information. These allow us to determine which LBE slots control which pockets and
|
||||
what LBE class the pockets are.*/
|
||||
// { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54}
|
||||
|
||||
+320
-218
File diff suppressed because it is too large
Load Diff
@@ -92,7 +92,7 @@ void InitRandomMercs()
|
||||
// HLT DEX AGI STR WIS MRK LDR MEC EXP MED
|
||||
|
||||
//populate random gear list
|
||||
for (int i = 0;i < MAXITEMS; i++)
|
||||
for ( int i = 0; i < gMAXITEMS_READ; ++i )
|
||||
{
|
||||
INVTYPE* item = &Item[i];
|
||||
|
||||
|
||||
@@ -1105,7 +1105,7 @@ void HandleAllReachAbleItemsInTheSector( INT16 sSectorX, INT16 sSectorY, INT8 bS
|
||||
{
|
||||
sGridNo2 = gMapInformation.sIsolatedGridNo;
|
||||
|
||||
for( uiCounter = gTacticalStatus.Team[ gbPlayerNum ].bFirstID; uiCounter < gTacticalStatus.Team[ gbPlayerNum ].bLastID; uiCounter++ )
|
||||
for( uiCounter = gTacticalStatus.Team[ gbPlayerNum ].bFirstID; uiCounter < gTacticalStatus.Team[ gbPlayerNum ].bLastID; ++uiCounter )
|
||||
{
|
||||
pSoldier = MercPtrs[ uiCounter ];
|
||||
if ( pSoldier && pSoldier->bActive && pSoldier->stats.bLife > 0 && pSoldier->sSectorX == sSectorX && pSoldier->sSectorY == sSectorY && pSoldier->bSectorZ == bSectorZ )
|
||||
@@ -1122,12 +1122,11 @@ void HandleAllReachAbleItemsInTheSector( INT16 sSectorX, INT16 sSectorY, INT8 bS
|
||||
{
|
||||
sGridNo2 = NOWHERE;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
GlobalItemsReachableTest( sGridNo, sGridNo2 );
|
||||
|
||||
for( uiCounter = 0; uiCounter < guiNumWorldItems; uiCounter++ )
|
||||
for( uiCounter = 0; uiCounter < guiNumWorldItems; ++uiCounter )
|
||||
{
|
||||
// reset reachablity
|
||||
fReachable = FALSE;
|
||||
|
||||
@@ -3457,10 +3457,11 @@ void GetKeyboardInput( UINT32 *puiNewEvent )
|
||||
{
|
||||
if(CHEATER_CHEAT_LEVEL())
|
||||
{
|
||||
for(UINT16 i=FIRST_WEAPON; i<MAXITEMS; i++)
|
||||
for ( UINT16 i = FIRST_WEAPON; i<gMAXITEMS_READ; ++i )
|
||||
{
|
||||
if(i == 1580 || Item[i].ubWeight == 0 && !(i == 257 || i == 1006 || i == 1026 || i == 1183))//dnl!!! items 257, 1006, 1026, 1183 had weight 0 which need to be changed in xml
|
||||
continue;
|
||||
|
||||
CreateItem(i, 100, &gTempObject);
|
||||
AddItemToPool(usMapPos, &gTempObject, VISIBLE , 0, WORLD_ITEM_REACHABLE, 0);
|
||||
}
|
||||
@@ -4904,7 +4905,6 @@ void CycleSelectedMercsItem()
|
||||
pSoldier->ReLoadSoldierAnimationDueToHandItemChange( usOldHandItem, pSoldier->inv[HANDPOS].usItem );
|
||||
|
||||
DirtyMercPanelInterface( pSoldier, DIRTYLEVEL2 );
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8039,11 +8039,8 @@ void HandleTacticalAmmoCrates( UINT8 magType )
|
||||
|
||||
//we have a valid, ammo item. Look through Items.xml and see if we have an ammo crate for
|
||||
// this ammo type
|
||||
for(int iLoop = 0; iLoop < MAXITEMS; iLoop++)
|
||||
for ( int iLoop = 0; iLoop < gMAXITEMS_READ; ++iLoop )
|
||||
{
|
||||
if (Item[iLoop].usItemClass == 0)
|
||||
break; //no more valid items after this point
|
||||
|
||||
//if ammo crate && calibers match && Ammo Types match
|
||||
if(Item[iLoop].usItemClass == IC_AMMO && Magazine[Item[iLoop].ubClassIndex].ubMagType == magType && Magazine[Item[iLoop].ubClassIndex].ubCalibre == Magazine[Item[worldItem].ubClassIndex].ubCalibre && Magazine[Item[iLoop].ubClassIndex].ubAmmoType == Magazine[Item[worldItem].ubClassIndex].ubAmmoType)
|
||||
{
|
||||
@@ -8056,7 +8053,7 @@ void HandleTacticalAmmoCrates( UINT8 magType )
|
||||
if(crateItem != 0)
|
||||
{
|
||||
//look through world items first
|
||||
for(unsigned int loop=0; loop < guiNumWorldItems; loop++)
|
||||
for(unsigned int loop=0; loop < guiNumWorldItems; ++loop)
|
||||
{
|
||||
if(gWorldItems[loop].object.usItem == crateItem)
|
||||
{
|
||||
@@ -8121,7 +8118,7 @@ void HandleTacticalAmmoCrates( UINT8 magType )
|
||||
|
||||
//MM: loop through ammo multiple times, as boxes and crates may take a few passes to fill
|
||||
ammoPresent = false;
|
||||
for(unsigned int wItem = 0; wItem < guiNumWorldItems; wItem++)
|
||||
for(unsigned int wItem = 0; wItem < guiNumWorldItems; ++wItem)
|
||||
{
|
||||
if(Item[gWorldItems[wItem].object.usItem].usItemClass == IC_AMMO && gWorldItems[wItem].bVisible == TRUE && gWorldItems[wItem].fExists && (gWorldItems[wItem].usFlags & WORLD_ITEM_REACHABLE) && !(gWorldItems[wItem].usFlags & WORLD_ITEM_ARMED_BOMB))
|
||||
{
|
||||
@@ -8142,7 +8139,7 @@ void HandleTacticalAmmoCrates( UINT8 magType )
|
||||
|
||||
void HandleTacticalInventoryMenu( void )
|
||||
{
|
||||
for( INT32 cnt = 0; cnt < TACTICAL_INVENTORY_DIALOG_NUM; cnt++)
|
||||
for( INT32 cnt = 0; cnt < TACTICAL_INVENTORY_DIALOG_NUM; ++cnt)
|
||||
{
|
||||
wcscpy( gzUserDefinedButton[cnt], szTacticalInventoryDialogString[cnt+1] );
|
||||
gzUserDefinedButtonColor[cnt] = 0;
|
||||
@@ -8218,7 +8215,7 @@ void TacticalInventoryMessageBoxCallBack( UINT8 ubExitValue )
|
||||
|
||||
void HandleTacticalCoverMenu( void )
|
||||
{
|
||||
for( INT32 cnt = 0; cnt < TACTICAL_COVER_DIALOG_NUM; cnt++)
|
||||
for( INT32 cnt = 0; cnt < TACTICAL_COVER_DIALOG_NUM; ++cnt)
|
||||
{
|
||||
wcscpy( gzUserDefinedButton[cnt], szTacticalCoverDialogString[cnt+1] );
|
||||
gzUserDefinedButtonColor[cnt] = 0;
|
||||
@@ -8363,7 +8360,7 @@ void HandleTacticalTransformItem( void )
|
||||
BOOLEAN FindTransformation( UINT16 usItem, TransformInfoStruct **pTransformation )
|
||||
{
|
||||
// find transformation
|
||||
for (INT32 x = 0; x < MAXITEMS; x++)
|
||||
for ( INT32 x = 0; x < gMAXITEMS_READ; ++x )
|
||||
{
|
||||
if ( Transform[x].usItem == (UINT16)-1 )
|
||||
{
|
||||
@@ -8389,7 +8386,7 @@ void HandleTacticalMoveItems( void )
|
||||
if ( GetSoldier( &pSoldier, gusSelectedSoldier ) )
|
||||
{
|
||||
|
||||
for ( UINT32 uiLoop = 0; uiLoop < guiNumWorldItems; uiLoop++ ) //for all items in sector
|
||||
for ( UINT32 uiLoop = 0; uiLoop < guiNumWorldItems; ++uiLoop ) //for all items in sector
|
||||
{
|
||||
if ( (gWorldItems[ uiLoop ].bVisible == TRUE) && (gWorldItems[ uiLoop ].fExists) && (gWorldItems[ uiLoop ].usFlags & WORLD_ITEM_REACHABLE) && !(gWorldItems[ uiLoop ].usFlags & WORLD_ITEM_ARMED_BOMB) && (gWorldItems[ uiLoop ].sGridNo != pSoldier->sGridNo) )//item exists and is reachable and is not already on soldiers tile
|
||||
{
|
||||
|
||||
@@ -816,7 +816,7 @@ BOOLEAN WriteWeaponStats()
|
||||
UINT32 cnt;
|
||||
|
||||
FilePrintf(hFile,"<WEAPONLIST>\r\n");
|
||||
for(cnt = 0;cnt < MAXITEMS;cnt++)
|
||||
for(cnt = 0;cnt < MAXITEMS; ++cnt)
|
||||
{
|
||||
CHAR8 * szRemainder = Weapon[cnt].szWeaponName; //the remaining string to be output (for making valid XML)
|
||||
|
||||
|
||||
@@ -1573,18 +1573,15 @@ void AIDecideRadioAnimation( SOLDIERTYPE *pSoldier )
|
||||
|
||||
UINT32 GetTankCannonIndex()
|
||||
{
|
||||
UINT32 tankCannonIndex = 0;
|
||||
|
||||
for (UINT32 i = 0; i < MAXITEMS; i++)
|
||||
for ( UINT32 i = 0; i < gMAXITEMS_READ; ++i )
|
||||
{
|
||||
if (Item[i].cannon)
|
||||
{
|
||||
tankCannonIndex = Item[i].uiIndex;
|
||||
break;
|
||||
return Item[i].uiIndex;
|
||||
}
|
||||
}
|
||||
|
||||
return tankCannonIndex;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -971,15 +971,12 @@ BOOLEAN LoadShortNameItemInfo(UINT16 ubIndex, STR16 pNameString )
|
||||
|
||||
void LoadAllItemNames( void )
|
||||
{
|
||||
UINT16 usLoop;
|
||||
|
||||
for (usLoop = 0; usLoop < MAXITEMS; usLoop++)
|
||||
for ( UINT16 usLoop = 0; usLoop < gMAXITEMS_READ; ++usLoop )
|
||||
{
|
||||
LoadItemInfo( usLoop, ItemNames[usLoop], NULL );
|
||||
|
||||
// Load short item info
|
||||
LoadShortNameItemInfo( usLoop, ShortItemNames[usLoop] );
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+12
-16
@@ -38,6 +38,9 @@
|
||||
#include "store inventory.h"
|
||||
#endif
|
||||
|
||||
// Flugente: in order not to loop over MAXITEMS items if we only have a few thousand, remember the actual number of items in the xml
|
||||
UINT32 gMAXITEMS_READ = 0;
|
||||
|
||||
struct
|
||||
{
|
||||
PARSE_STAGE curElement;
|
||||
@@ -381,6 +384,9 @@ itemEndElementHandle(void *userData, const XML_Char *name)
|
||||
InheritStanceModifiers( pData );
|
||||
|
||||
pData->curArray[pData->curItem.uiIndex] = pData->curItem; //write the item into the table
|
||||
|
||||
// Flugente: new item -> read items increase
|
||||
gMAXITEMS_READ = pData->curItem.uiIndex;
|
||||
}
|
||||
else if ( sizeof(pData->curItem.szItemName)>0 && localizedTextOnly )
|
||||
{
|
||||
@@ -1477,10 +1483,10 @@ itemEndElementHandle(void *userData, const XML_Char *name)
|
||||
pData->curItem.usItemFlag |= DISEASEPROTECTION_HAND;
|
||||
}
|
||||
|
||||
pData->maxReadDepth--;
|
||||
--pData->maxReadDepth;
|
||||
}
|
||||
|
||||
pData->currentDepth--;
|
||||
--pData->currentDepth;
|
||||
}
|
||||
|
||||
|
||||
@@ -1519,11 +1525,9 @@ BOOLEAN ReadInItemStats(STR fileName, BOOLEAN localizedVersion )
|
||||
lpcBuffer[uiFSize] = 0; //add a null terminator
|
||||
|
||||
FileClose( hFile );
|
||||
|
||||
|
||||
XML_SetElementHandler(parser, itemStartElementHandle, itemEndElementHandle);
|
||||
XML_SetCharacterDataHandler(parser, itemCharacterDataHandle);
|
||||
|
||||
|
||||
memset(&pData,0,sizeof(pData));
|
||||
pData.curArray = Item;
|
||||
@@ -1531,7 +1535,6 @@ BOOLEAN ReadInItemStats(STR fileName, BOOLEAN localizedVersion )
|
||||
|
||||
XML_SetUserData(parser, &pData);
|
||||
|
||||
|
||||
if(!XML_Parse(parser, lpcBuffer, uiFSize, TRUE))
|
||||
{
|
||||
CHAR8 errorBuf[511];
|
||||
@@ -1542,21 +1545,14 @@ BOOLEAN ReadInItemStats(STR fileName, BOOLEAN localizedVersion )
|
||||
MemFree(lpcBuffer);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
// item read was x -> x+1 items
|
||||
++gMAXITEMS_READ;
|
||||
|
||||
MemFree(lpcBuffer);
|
||||
|
||||
|
||||
XML_ParserFree(parser);
|
||||
|
||||
|
||||
//DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("done reading item stats"));
|
||||
//CHAR16 str[512];
|
||||
//for (int i = 0; i < MAXITEMS; i++)
|
||||
//{
|
||||
// swprintf(str, Item[i].szLongItemName);
|
||||
// DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("ReadInItemStats: long item name: %s", str));
|
||||
//}
|
||||
|
||||
return( TRUE );
|
||||
}
|
||||
BOOLEAN WriteItemStats()
|
||||
@@ -1576,7 +1572,7 @@ BOOLEAN WriteItemStats()
|
||||
CHAR16 strDesc[500];
|
||||
|
||||
FilePrintf(hFile,"<ITEMLIST>\r\n");
|
||||
for(cnt = 0;cnt < 351;cnt++)//just do the old limit for now
|
||||
for(cnt = 0;cnt < 351; ++cnt)//just do the old limit for now
|
||||
{
|
||||
LoadShortNameItemInfo( (UINT16)cnt, str );
|
||||
|
||||
|
||||
Reference in New Issue
Block a user