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:
Flugente
2014-10-19 21:53:05 +00:00
parent 5dbcf2a1e8
commit 499ff2db06
24 changed files with 674 additions and 702 deletions
+29 -35
View File
@@ -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;
+3 -5
View File
@@ -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!
File diff suppressed because it is too large Load Diff
+2 -2
View File
@@ -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 );
+28 -62
View File
@@ -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
View File
@@ -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);
+2 -2
View File
@@ -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 ))
+3
View File
@@ -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
View File
File diff suppressed because it is too large Load Diff
+1 -1
View File
@@ -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];
+2 -3
View File
@@ -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;
+9 -12
View File
@@ -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
{
+1 -1
View File
@@ -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)