mirror of
https://github.com/1dot13/source.git
synced 2026-08-12 14:10:23 +02:00
Merge branch 'master' into ExtraMercs
This commit is contained in:
@@ -699,8 +699,7 @@ INT8 ExplosiveDamageStructureAtGridNo( STRUCTURE * pCurrent, STRUCTURE **ppNextC
|
||||
#endif
|
||||
|
||||
// Get xy
|
||||
sX = CenterX( sGridNo );
|
||||
sY = CenterY( sGridNo );
|
||||
ConvertGridNoToCenterCellXY(sGridNo, &sX, &sY);
|
||||
|
||||
// ATE: Continue if we are only looking for walls
|
||||
if ( fOnlyWalls && !( pCurrent->fFlags & STRUCTURE_WALLSTUFF ) )
|
||||
@@ -1306,7 +1305,9 @@ INT8 ExplosiveDamageStructureAtGridNo( STRUCTURE * pCurrent, STRUCTURE **ppNextC
|
||||
// Make secondary explosion if eplosive....
|
||||
if ( fExplosive )
|
||||
{
|
||||
InternalIgniteExplosion( ubOwner, CenterX( sBaseGridNo ), CenterY( sBaseGridNo ), 0, sBaseGridNo, STRUCTURE_EXPLOSION, FALSE, bLevel );
|
||||
INT16 sX, sY;
|
||||
ConvertGridNoToCenterCellXY(sBaseGridNo, &sX, &sY);
|
||||
InternalIgniteExplosion( ubOwner, sX, sY, 0, sBaseGridNo, STRUCTURE_EXPLOSION, FALSE, bLevel );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1480,7 +1481,9 @@ void ExplosiveDamageGridNo( INT32 sGridNo, INT16 sWoundAmt, UINT32 uiDist,
|
||||
}
|
||||
|
||||
{
|
||||
InternalIgniteExplosion( ubOwner, CenterX( sNewGridNo2 ), CenterY( sNewGridNo2 ), 0, sNewGridNo2, RDX, FALSE, bLevel );
|
||||
INT16 sX, sY;
|
||||
ConvertGridNoToCenterCellXY(sNewGridNo2, &sX, &sY);
|
||||
InternalIgniteExplosion( ubOwner, sX, sY, 0, sNewGridNo2, RDX, FALSE, bLevel );
|
||||
}
|
||||
|
||||
fToBreak = TRUE;
|
||||
@@ -1614,7 +1617,7 @@ BOOLEAN DamageSoldierFromBlast( UINT16 ubPerson, UINT16 ubOwner, INT32 sBombGrid
|
||||
// Demolitions damage bonus with bombs and mines
|
||||
if ( HAS_SKILL_TRAIT( MercPtrs[ ubOwner ], DEMOLITIONS_NT ) &&
|
||||
Explosive[Item[usItem].ubClassIndex].ubType == EXPLOSV_NORMAL && Item[usItem].usItemClass == IC_BOMB &&
|
||||
(!Item[usItem].attachment || Item[usItem].mine ))
|
||||
(!ItemIsAttachment(usItem) || ItemIsMine(usItem)))
|
||||
{
|
||||
sNewWoundAmt = (INT16)(sNewWoundAmt * (100 + gSkillTraitValues.ubDEDamageOfBombsAndMines) / 100.0f + 0.5f);
|
||||
}
|
||||
@@ -1627,9 +1630,9 @@ BOOLEAN DamageSoldierFromBlast( UINT16 ubPerson, UINT16 ubOwner, INT32 sBombGrid
|
||||
// Heavy Weapons trait bonus damage with rocket, grenade launchers and mortar
|
||||
else if ( HAS_SKILL_TRAIT( MercPtrs[ ubOwner ], HEAVY_WEAPONS_NT ) &&
|
||||
Explosive[Item[usItem].ubClassIndex].ubType == EXPLOSV_NORMAL &&
|
||||
((Item[usItem].usItemClass == IC_BOMB && Item[usItem].attachment && !Item[usItem].mine ) || // mortar shells
|
||||
(Item[usItem].usItemClass == IC_GRENADE && (Item[usItem].glgrenade || Item[usItem].electronic) ) || // rockets for rocketlaunchers (I haven't found any other way)
|
||||
(Item[usItem].usItemClass == IC_LAUNCHER ) || Item[usItem].rocketlauncher || Item[usItem].singleshotrocketlauncher ) )
|
||||
((Item[usItem].usItemClass == IC_BOMB && ItemIsAttachment(usItem) && !ItemIsMine(usItem) ) || // mortar shells
|
||||
(Item[usItem].usItemClass == IC_GRENADE && (ItemIsGLgrenade(usItem) || ItemIsElectronic(usItem)) ) || // rockets for rocketlaunchers (I haven't found any other way)
|
||||
(Item[usItem].usItemClass == IC_LAUNCHER ) || ItemIsRocketLauncher(usItem) || ItemIsSingleShotRocketLauncher(usItem) ) )
|
||||
{
|
||||
sNewWoundAmt = (INT16)(sNewWoundAmt * (100 + gSkillTraitValues.ubHWDamageBonusPercentForHW * NUM_SKILL_TRAITS( MercPtrs[ ubOwner ], HEAVY_WEAPONS_NT )) / 100.0f + 0.5f); // +15%
|
||||
}
|
||||
@@ -1640,7 +1643,7 @@ BOOLEAN DamageSoldierFromBlast( UINT16 ubPerson, UINT16 ubOwner, INT32 sBombGrid
|
||||
{
|
||||
sNewWoundAmt = (INT16)(sNewWoundAmt * (100 - gSkillTraitValues.bTanksDamageResistanceModifier) / 100);
|
||||
// another half of this for ordinary grenades
|
||||
if ( (( Item[usItem].usItemClass == IC_GRENADE ) || Item[usItem].glgrenade ) && !Item[usItem].electronic )
|
||||
if ( (( Item[usItem].usItemClass == IC_GRENADE ) || ItemIsGLgrenade(usItem) ) && !ItemIsElectronic(usItem))
|
||||
sNewWoundAmt = (INT16)(sNewWoundAmt * (100 - (gSkillTraitValues.bTanksDamageResistanceModifier / 2)) / 100);
|
||||
}
|
||||
|
||||
@@ -3858,10 +3861,10 @@ BOOLEAN ActivateSurroundingTripwire( UINT16 ubID, INT32 sGridNo, INT8 bLevel, UI
|
||||
usBombItem = (*pObj)[0]->data.misc.usBombItem;
|
||||
|
||||
// if item can be activated by tripwire, detonate it
|
||||
if ( Item[usBombItem].tripwireactivation == 1 )
|
||||
if (ItemHasTripwireActivation(usBombItem))
|
||||
{
|
||||
// tripwire just gets activated
|
||||
if ( Item[usBombItem].tripwire == 1 )
|
||||
if (ItemIsTripwire(usBombItem))
|
||||
{
|
||||
// this is important - we have to check wether the wire has already been activated
|
||||
if ( ( (*pObj)[0]->data.sObjectFlag & TRIPWIRE_ACTIVATED ) == 0 )
|
||||
@@ -4029,7 +4032,7 @@ void HandleExplosionQueue( void )
|
||||
CallAvailableEnemiesTo( sGridNo );
|
||||
//RemoveItemFromPool( sGridNo, gWorldBombs[ uiWorldBombIndex ].iItemIndex, 0 );
|
||||
}
|
||||
else if ( (*pObj)[0]->data.misc.usBombItem == TRIP_FLARE || Item[pObj->usItem].flare)
|
||||
else if ( (*pObj)[0]->data.misc.usBombItem == TRIP_FLARE || ItemIsFlare(pObj->usItem))
|
||||
{
|
||||
// sevenfm: changed pObj->usItem to Item[pObj->usItem].ubClassIndex as it should be correct explosives index
|
||||
// NewLightEffect( sGridNo, (UINT8)Explosive[pObj->usItem].ubDuration, (UINT8)Explosive[pObj->usItem].ubStartRadius );
|
||||
@@ -4128,7 +4131,7 @@ void HandleExplosionQueue( void )
|
||||
}
|
||||
// Flugente: handle tripwire gun traps here...
|
||||
// tripwire gets called and activated in ActivateSurroundingTripwire
|
||||
else if ( Item[pObj->usItem].tripwire == 1 )
|
||||
else if (ItemIsTripwire(pObj->usItem))
|
||||
{
|
||||
OBJECTTYPE newtripwireObject;
|
||||
CreateItem( pObj->usItem, (*pObj)[0]->data.objectStatus, &newtripwireObject );
|
||||
@@ -4166,7 +4169,10 @@ void HandleExplosionQueue( void )
|
||||
// no preplaced (owner=NOBODY) tripwire with explosive attachments allowed
|
||||
if ( gGameExternalOptions.bAllowExplosiveAttachments && (*pObj)[0]->data.misc.ubBombOwner > 1 )
|
||||
{
|
||||
fAttFound=HandleAttachedExplosions( (UINT8) ((*pObj)[0]->data.misc.ubBombOwner - 2), CenterX( sGridNo ), CenterY( sGridNo ), 0,
|
||||
INT16 sX, sY;
|
||||
ConvertGridNoToCenterCellXY(sGridNo, &sX, &sY);
|
||||
|
||||
fAttFound=HandleAttachedExplosions( (UINT8) ((*pObj)[0]->data.misc.ubBombOwner - 2), sX, sY, 0,
|
||||
sGridNo, (*pObj)[0]->data.misc.usBombItem, FALSE, ubLevel, (*pObj)[0]->data.ubDirection, pObj);
|
||||
}
|
||||
}
|
||||
@@ -4186,7 +4192,7 @@ void HandleExplosionQueue( void )
|
||||
// Flugente: handle tripwire gun traps here...
|
||||
// tripwire gets called and activated in ActivateSurroundingTripwire
|
||||
// now for action item tripwire
|
||||
else if ( pObj->usItem == ACTION_ITEM && (*pObj)[0]->data.misc.bActionValue == ACTION_ITEM_BLOW_UP && Item[(*pObj)[0]->data.misc.usBombItem].tripwire == 1 )
|
||||
else if ( pObj->usItem == ACTION_ITEM && (*pObj)[0]->data.misc.bActionValue == ACTION_ITEM_BLOW_UP && ItemIsTripwire((*pObj)[0]->data.misc.usBombItem) )
|
||||
{
|
||||
OBJECTTYPE newtripwireObject;
|
||||
CreateItem( (*pObj)[0]->data.misc.usBombItem, (*pObj)[0]->data.objectStatus, &newtripwireObject );
|
||||
@@ -4239,15 +4245,18 @@ void HandleExplosionQueue( void )
|
||||
CheckForBuriedBombsAndRemoveFlags( sGridNo, ubLevel);
|
||||
// BOOM!
|
||||
|
||||
INT16 sX, sY;
|
||||
ConvertGridNoToCenterCellXY(sGridNo, &sX, &sY);
|
||||
|
||||
// bomb objects only store the SIDE who placed the bomb! :-(
|
||||
if ( (*pObj)[0]->data.misc.ubBombOwner > 1 )
|
||||
{
|
||||
IgniteExplosion( (UINT8) ((*pObj)[0]->data.misc.ubBombOwner - 2), CenterX( sGridNo ), CenterY( sGridNo ), 0, sGridNo, (*pObj)[0]->data.misc.usBombItem, ubLevel, (*pObj)[0]->data.ubDirection, pObj);
|
||||
IgniteExplosion( (UINT8) ((*pObj)[0]->data.misc.ubBombOwner - 2), sX, sY, 0, sGridNo, (*pObj)[0]->data.misc.usBombItem, ubLevel, (*pObj)[0]->data.ubDirection, pObj);
|
||||
}
|
||||
else
|
||||
{
|
||||
// pre-placed
|
||||
IgniteExplosion( NOBODY, CenterX( sGridNo ), CenterY( sGridNo ), 0, sGridNo, (*pObj)[0]->data.misc.usBombItem, ubLevel, (*pObj)[0]->data.ubDirection );
|
||||
IgniteExplosion( NOBODY, sX, sY, 0, sGridNo, (*pObj)[0]->data.misc.usBombItem, ubLevel, (*pObj)[0]->data.ubDirection );
|
||||
}
|
||||
}
|
||||
/* if ( FindWorldItemForBuriedBombInGridNo(sGridNo, ubLevel) != -1 )
|
||||
@@ -4904,7 +4913,7 @@ BOOLEAN SetOffBombsInGridNo( UINT16 ubID, INT32 sGridNo, BOOLEAN fAllBombs, INT8
|
||||
if (fAllBombs || (*pObj)[0]->data.misc.bDetonatorType == BOMB_PRESSURE)
|
||||
{
|
||||
// Flugente: if this is a anti-tank mine, only detonate it if the person triggering it is (in) a vehicle, or if we detonate everything unconditional
|
||||
if ( !fAllBombs && ubID != NOBODY && Item[pObj->usItem].antitankmine )
|
||||
if ( !fAllBombs && ubID != NOBODY && ItemIsATMine(pObj->usItem))
|
||||
{
|
||||
// if this is not a vehicle, not a robot and not a tank, don't activate
|
||||
if ( !(MercPtrs[ubID]->flags.uiStatusFlags & SOLDIER_VEHICLE) && !AM_A_ROBOT( MercPtrs[ubID] ) && !ARMED_VEHICLE( MercPtrs[ubID] ) && !ENEMYROBOT( MercPtrs[ubID] ) )
|
||||
@@ -4936,7 +4945,7 @@ BOOLEAN SetOffBombsInGridNo( UINT16 ubID, INT32 sGridNo, BOOLEAN fAllBombs, INT8
|
||||
SetOffBombsByFrequency( ubID, (*pObj)[0]->data.misc.bFrequency );
|
||||
}
|
||||
// Flugente: a tripwire activates all other tripwires in connection, and detonates all bombs in connection that are tripwire-activated
|
||||
else if ( Item[pObj->usItem].tripwire == 1 || (pObj->usItem == ACTION_ITEM && (*pObj)[0]->data.misc.bActionValue == ACTION_ITEM_BLOW_UP && Item[(*pObj)[0]->data.misc.usBombItem].tripwire == 1 ) )
|
||||
else if (ItemIsTripwire(pObj->usItem) || (pObj->usItem == ACTION_ITEM && (*pObj)[0]->data.misc.bActionValue == ACTION_ITEM_BLOW_UP && ItemIsTripwire((*pObj)[0]->data.misc.usBombItem) ) )
|
||||
{
|
||||
gubPersonToSetOffExplosions = ubID;
|
||||
|
||||
@@ -5443,7 +5452,7 @@ void FireFragments( UINT16 ubOwner, INT16 sX, INT16 sY, INT16 sZ, UINT16 usItem,
|
||||
FLOAT dRandomZ = 0;
|
||||
|
||||
// if explosive is directional, calculation of frags is different
|
||||
if ( Item[usItem].directional == TRUE )
|
||||
if (ItemIsDirectional(usItem))
|
||||
{
|
||||
// Flugente: if item is a directional explosive, determine in what direction the frags should fly
|
||||
INT16 degree = (45 + ubDirection * 45) % 360; // modulo 360 to prevent nonsense from nonsensical input
|
||||
@@ -5533,8 +5542,8 @@ void FireFragmentsTrapGun( SOLDIERTYPE* pThrower, INT32 gridno, INT16 sZ, OBJECT
|
||||
INT16 horizontalarc = 5;
|
||||
INT16 verticalarc = 0;
|
||||
|
||||
INT16 sX = CenterX(gridno);
|
||||
INT16 sY = CenterY(gridno);
|
||||
INT16 sX, sY;
|
||||
ConvertGridNoToCenterCellXY(gridno, &sX, &sY);
|
||||
|
||||
AssertMsg( ubFragRange > 0 , "Fragmentation data lacks range property!" );
|
||||
|
||||
@@ -5885,7 +5894,7 @@ void HandleBuddyExplosions(UINT8 ubOwner, INT16 sX, INT16 sY, INT16 sZ, INT32 sG
|
||||
// Flugente: Items can have secondary explosions
|
||||
if ( Item[usItem].usBuddyItem )
|
||||
{
|
||||
if ( Item[Item[usItem].usBuddyItem].flare )
|
||||
if (ItemIsFlare(Item[usItem].usBuddyItem))
|
||||
{
|
||||
if( !sZ || !FindBuilding(sGridNo) )
|
||||
{
|
||||
@@ -5923,10 +5932,10 @@ BOOLEAN HandleAttachedExplosions(UINT8 ubOwner, INT16 sX, INT16 sY, INT16 sZ, IN
|
||||
if ( iter->exists() && Item[iter->usItem].usItemClass & (IC_GRENADE|IC_BOMB) )
|
||||
{
|
||||
// no need for binder if both item and attachment are tripwire-activated
|
||||
if( ( Item[pObj->usItem].tripwireactivation && Item[iter->usItem].tripwireactivation ) ||
|
||||
if( (ItemHasTripwireActivation(pObj->usItem) && ItemHasTripwireActivation(iter->usItem)) ||
|
||||
( binderFound && detonator && Explosive[Item[iter->usItem].ubClassIndex].ubVolatility > 0 ) )
|
||||
{
|
||||
if(Item[iter->usItem].directional && ubDirection == DIRECTION_IRRELEVANT)
|
||||
if(ItemIsDirectional(iter->usItem) && ubDirection == DIRECTION_IRRELEVANT)
|
||||
direction=Random(8);
|
||||
else
|
||||
direction=ubDirection;
|
||||
@@ -5947,7 +5956,7 @@ BOOLEAN HandleAttachedExplosions(UINT8 ubOwner, INT16 sX, INT16 sY, INT16 sZ, IN
|
||||
}
|
||||
if ( binderFound && detonator && gGameExternalOptions.bAllowSpecialExplosiveAttachments && iter->exists() && Item[iter->usItem].usItemClass & IC_MISC )
|
||||
{
|
||||
if(Item[iter->usItem].gascan)
|
||||
if(ItemIsGascan(iter->usItem))
|
||||
{
|
||||
IgniteExplosion( ubOwner, sX, sY, sZ, sGridNo, GAS_EXPLOSION, bLevel, DIRECTION_IRRELEVANT, NULL );
|
||||
fAttFound = TRUE;
|
||||
@@ -5957,7 +5966,7 @@ BOOLEAN HandleAttachedExplosions(UINT8 ubOwner, INT16 sX, INT16 sY, INT16 sZ, IN
|
||||
IgniteExplosion( ubOwner, sX, sY, sZ, sGridNo, MOLOTOV_EXPLOSION, bLevel, DIRECTION_IRRELEVANT, NULL );
|
||||
fAttFound = TRUE;
|
||||
}
|
||||
if(Item[iter->usItem].marbles)
|
||||
if(ItemIsMarbles(iter->usItem))
|
||||
{
|
||||
IgniteExplosion( ubOwner, sX, sY, sZ, sGridNo, FRAG_EXPLOSION, bLevel, DIRECTION_IRRELEVANT, NULL );
|
||||
fAttFound = TRUE;
|
||||
@@ -6011,7 +6020,7 @@ UINT16 CalcTotalVolatility(OBJECTTYPE * pObj)
|
||||
if ( iter->exists() && Item[iter->usItem].usItemClass & (IC_GRENADE|IC_BOMB) )
|
||||
{
|
||||
// no need for binder if both item and attachment are tripwire-activated
|
||||
if( ( Item[usItem].tripwireactivation && Item[iter->usItem].tripwireactivation ) ||
|
||||
if( (ItemHasTripwireActivation(usItem) && ItemHasTripwireActivation(iter->usItem)) ||
|
||||
( binderFound && detonator && Explosive[Item[iter->usItem].ubClassIndex].ubVolatility > 0 ) )
|
||||
{
|
||||
totalVolatility += Explosive[Item[iter->usItem].ubClassIndex].ubVolatility;
|
||||
@@ -6334,7 +6343,9 @@ void RoofDestruction( INT32 sGridNo, BOOLEAN fWithExplosion )
|
||||
static UINT16 usRoofCollapseExplosionIndex = 1727;
|
||||
if ( HasItemFlag( usRoofCollapseExplosionIndex, ROOF_COLLAPSE_ITEM ) || GetFirstItemWithFlag( &usRoofCollapseExplosionIndex, ROOF_COLLAPSE_ITEM ) )
|
||||
{
|
||||
InternalIgniteExplosion( NOBODY, CenterX( sGridNo ), CenterY( sGridNo ), 0, sGridNo, usRoofCollapseExplosionIndex, FALSE, 0 );
|
||||
INT16 sX, sY;
|
||||
ConvertGridNoToCenterCellXY(sGridNo, &sX, &sY);
|
||||
InternalIgniteExplosion( NOBODY, sX, sY, 0, sGridNo, usRoofCollapseExplosionIndex, FALSE, 0 );
|
||||
}
|
||||
|
||||
if ( Chance( 15 ) )
|
||||
@@ -6343,7 +6354,9 @@ void RoofDestruction( INT32 sGridNo, BOOLEAN fWithExplosion )
|
||||
|
||||
if ( debrissmokeitem )
|
||||
{
|
||||
InternalIgniteExplosion( NOBODY, CenterX( sGridNo ), CenterY( sGridNo ), 0, sGridNo, debrissmokeitem, FALSE, 0 );
|
||||
INT16 sX, sY;
|
||||
ConvertGridNoToCenterCellXY(sGridNo, &sX, &sY);
|
||||
InternalIgniteExplosion( NOBODY, sX, sY, 0, sGridNo, debrissmokeitem, FALSE, 0 );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -708,27 +708,6 @@ BOOLEAN GetMouseMapPos( INT32 *psMapPos )
|
||||
}
|
||||
|
||||
|
||||
|
||||
BOOLEAN ConvertMapPosToWorldTileCenter( INT32 usMapPos, INT16 *psXPos, INT16 *psYPos )
|
||||
{
|
||||
INT16 sWorldX, sWorldY;
|
||||
INT16 sCellX, sCellY;
|
||||
|
||||
// Get X, Y world GRID Coordinates
|
||||
sWorldY = ( usMapPos / WORLD_COLS );
|
||||
sWorldX = usMapPos - ( sWorldY * WORLD_COLS );
|
||||
|
||||
// Convert into cell coords
|
||||
sCellY = sWorldY * CELL_Y_SIZE;
|
||||
sCellX = sWorldX * CELL_X_SIZE;
|
||||
|
||||
// Add center tile positions
|
||||
*psXPos = sCellX + ( CELL_X_SIZE / 2 );
|
||||
*psYPos = sCellY + ( CELL_Y_SIZE / 2 );
|
||||
|
||||
return( TRUE );
|
||||
}
|
||||
|
||||
void GetScreenXYWorldCoords( INT16 sScreenX, INT16 sScreenY, INT16 *psWorldX, INT16 *psWorldY )
|
||||
{
|
||||
INT16 sOffsetX, sOffsetY;
|
||||
@@ -931,7 +910,7 @@ void ConvertGridNoToCellXY( INT32 sGridNo, INT16 *sXPos, INT16 *sYPos )
|
||||
*sXPos = ( *sXPos * CELL_X_SIZE );
|
||||
}
|
||||
|
||||
void ConvertGridNoToCenterCellXY( INT32 sGridNo, INT16 *sXPos, INT16 *sYPos )
|
||||
void ConvertGridNoToCenterCellXY( const INT32 sGridNo, INT16 *sXPos, INT16 *sYPos )
|
||||
{
|
||||
*sYPos = ( sGridNo / WORLD_COLS );
|
||||
*sXPos = ( sGridNo - ( *sYPos * WORLD_COLS ) );
|
||||
@@ -940,22 +919,6 @@ void ConvertGridNoToCenterCellXY( INT32 sGridNo, INT16 *sXPos, INT16 *sYPos )
|
||||
*sXPos = ( *sXPos * CELL_X_SIZE ) + ( CELL_X_SIZE / 2 );
|
||||
}
|
||||
|
||||
INT32 GetRangeFromGridNoDiff( INT32 sGridNo1, INT32 sGridNo2 )
|
||||
{
|
||||
INT32 uiDist;
|
||||
INT16 sXPos, sYPos, sXPos2, sYPos2;
|
||||
|
||||
// Convert our grid-not into an XY
|
||||
ConvertGridNoToXY( sGridNo1, &sXPos, &sYPos );
|
||||
|
||||
// Convert our grid-not into an XY
|
||||
ConvertGridNoToXY( sGridNo2, &sXPos2, &sYPos2 );
|
||||
|
||||
uiDist = (INT32)(sqrt((double) ( sXPos2 - sXPos )*( sXPos2 - sXPos ) + ( sYPos2 - sYPos ) * ( sYPos2 - sYPos ) ));
|
||||
|
||||
return( uiDist );
|
||||
}
|
||||
|
||||
INT32 GetRangeInCellCoordsFromGridNoDiff( INT32 sGridNo1, INT32 sGridNo2 )
|
||||
{
|
||||
INT16 sXPos, sYPos, sXPos2, sYPos2;
|
||||
@@ -1002,8 +965,8 @@ INT16 PythSpacesAway(INT32 sOrigin, INT32 sDest)
|
||||
{
|
||||
INT16 sRows,sCols,sResult;
|
||||
|
||||
sRows = abs((sOrigin / MAXCOL) - (sDest / MAXCOL));
|
||||
sCols = abs((sOrigin % MAXROW) - (sDest % MAXROW));
|
||||
sRows = (sOrigin / MAXCOL) - (sDest / MAXCOL);
|
||||
sCols = (sOrigin % MAXROW) - (sDest % MAXROW);
|
||||
|
||||
|
||||
// apply Pythagoras's theorem for right-handed triangle:
|
||||
@@ -1234,30 +1197,6 @@ INT16 ExtQuickestDirection(INT16 origin, INT16 dest)
|
||||
}
|
||||
|
||||
|
||||
// Returns the (center ) cell coordinates in X
|
||||
INT16 CenterX( INT32 sGridNo )
|
||||
{
|
||||
INT32 sYPos, sXPos;
|
||||
|
||||
sYPos = sGridNo / WORLD_COLS;
|
||||
sXPos = ( sGridNo - ( sYPos * WORLD_COLS ) );
|
||||
|
||||
return( ( sXPos * CELL_X_SIZE ) + ( CELL_X_SIZE / 2 ) );
|
||||
}
|
||||
|
||||
|
||||
// Returns the (center ) cell coordinates in Y
|
||||
INT16 CenterY( INT32 sGridNo )
|
||||
{
|
||||
INT32 sYPos, sXPos;
|
||||
|
||||
sYPos = sGridNo / WORLD_COLS;
|
||||
sXPos = ( sGridNo - ( sYPos * WORLD_COLS ) );
|
||||
|
||||
return( ( sYPos * CELL_Y_SIZE ) + ( CELL_Y_SIZE / 2 ) );
|
||||
}
|
||||
|
||||
|
||||
INT16 MapX( INT32 sGridNo )
|
||||
{
|
||||
INT32 sYPos, sXPos;
|
||||
|
||||
@@ -45,7 +45,7 @@ extern UINT8 gPurpendicularDirection[ NUM_WORLD_DIRECTIONS ][ NUM_WORLD_DIRECTIO
|
||||
void ConvertDirectionToVectorInXY(UINT8 ubDirection, INT16* sXDir, INT16* sYDir);
|
||||
void ConvertGridNoToXY( INT32 sGridNo, INT16 *sXPos, INT16 *sYPos );
|
||||
void ConvertGridNoToCellXY( INT32 sGridNo, INT16 *sXPos, INT16 *sYPos );
|
||||
void ConvertGridNoToCenterCellXY( INT32 sGridNo, INT16 *sXPos, INT16 *sYPos );
|
||||
void ConvertGridNoToCenterCellXY( const INT32 sGridNo, INT16 *sXPos, INT16 *sYPos );
|
||||
|
||||
|
||||
// GRID NO MANIPULATION FUNCTIONS
|
||||
@@ -88,11 +88,8 @@ BOOLEAN GridNoOnVisibleWorldTile( INT32 sGridNo );
|
||||
BOOLEAN GridNoOnVisibleWorldTileGivenYLimits( INT32 sGridNo );
|
||||
BOOLEAN GridNoOnEdgeOfMap( INT32 sGridNo, INT8 * pbDirection );
|
||||
|
||||
BOOLEAN ConvertMapPosToWorldTileCenter( INT32 usMapPos, INT16 *psXPos, INT16 *psYPos );
|
||||
|
||||
BOOLEAN CellXYToScreenXY(INT16 sCellX, INT16 sCellY, INT16 *sScreenX, INT16 *sScreenY);
|
||||
|
||||
INT32 GetRangeFromGridNoDiff( INT32 sGridNo1, INT32 sGridNo2 );
|
||||
INT32 GetRangeInCellCoordsFromGridNoDiff( INT32 sGridNo1, INT32 sGridNo2 );
|
||||
|
||||
BOOLEAN IsPointInScreenRect( INT16 sXPos, INT16 sYPos, SGPRect *pRect );
|
||||
@@ -110,12 +107,6 @@ INT16 QuickestDirection(INT16 origin, INT16 dest);
|
||||
INT16 ExtQuickestDirection(INT16 origin, INT16 dest);
|
||||
|
||||
|
||||
// Returns the (center ) cell coordinates in X
|
||||
INT16 CenterX( INT32 sGridNo );
|
||||
|
||||
// Returns the (center ) cell coordinates in Y
|
||||
INT16 CenterY( INT32 sGridNo );
|
||||
|
||||
INT16 MapX( INT32 sGridNo );
|
||||
INT16 MapY( INT32 sGridNo );
|
||||
BOOLEAN FindFenceJumpDirection( SOLDIERTYPE *pSoldier, INT32 sGridNo, INT8 bStartingDir, INT8 *pbDirection );
|
||||
@@ -157,4 +148,4 @@ BOOLEAN FindWindowJumpDirection( SOLDIERTYPE *pSoldier, INT32 sGridNo, INT8 bSta
|
||||
// Flugente: is this gridno near a player merc?
|
||||
BOOLEAN GridNoNearPlayerMercs( INT32 sGridNo, INT16 sRadius );
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
||||
@@ -84,7 +84,10 @@ void UpdateLightingSprite( LIGHTEFFECT *pLight )
|
||||
|
||||
LightSpritePower( pLight->iLight, TRUE );
|
||||
// LightSpriteFake( pLight->iLight );
|
||||
LightSpritePosition( pLight->iLight, (INT16)( CenterX( pLight->sGridNo ) / CELL_X_SIZE ), (INT16)( CenterY( pLight->sGridNo ) / CELL_Y_SIZE ) );
|
||||
INT16 sX, sY;
|
||||
ConvertGridNoToCenterCellXY(pLight->sGridNo, &sX, &sY);
|
||||
|
||||
LightSpritePosition( pLight->iLight, (INT16)( sX / CELL_X_SIZE ), (INT16)( sY / CELL_Y_SIZE ) );
|
||||
}
|
||||
|
||||
// Flugente: create a pure light, worry about updating sight in other functions
|
||||
|
||||
@@ -167,9 +167,35 @@ BOOLEAN LoadRadarScreenBitmap(CHAR8 * aFilename )
|
||||
|
||||
if( GetVideoObject( &hVObject, gusRadarImage ) )
|
||||
{
|
||||
// ATE: Add a shade table!
|
||||
hVObject->pShades[ 0 ] = Create16BPPPaletteShaded( hVObject->pPaletteEntry, 255, 255, 255, FALSE );
|
||||
hVObject->pShades[ 1 ] = Create16BPPPaletteShaded( hVObject->pPaletteEntry, 100, 100, 100, FALSE );
|
||||
// ATE: Add a shade table!
|
||||
// anv: pShades[ 0 ] is a day radar map, pShades[ 1 ] is a night radar map
|
||||
switch( gGameExternalOptions.ubRadarMapModeDay )
|
||||
{
|
||||
case 0:
|
||||
hVObject->pShades[0] = Create16BPPPaletteShaded(hVObject->pPaletteEntry, 255, 255, 255, FALSE);
|
||||
break;
|
||||
case 1:
|
||||
hVObject->pShades[0] = Create16BPPPaletteShaded(hVObject->pPaletteEntry, 352, 352, 352, TRUE);
|
||||
break;
|
||||
case 2:
|
||||
hVObject->pShades[0] = Create16BPPPaletteShaded(hVObject->pPaletteEntry, 160, 255, 160, TRUE);
|
||||
break;
|
||||
}
|
||||
switch( gGameExternalOptions.ubRadarMapModeNight )
|
||||
{
|
||||
case 0:
|
||||
hVObject->pShades[1] = Create16BPPPaletteShaded(hVObject->pPaletteEntry, 255, 255, 255, FALSE);
|
||||
break;
|
||||
case 1:
|
||||
hVObject->pShades[1] = Create16BPPPaletteShaded(hVObject->pPaletteEntry, 352, 352, 352, TRUE);
|
||||
break;
|
||||
case 2:
|
||||
hVObject->pShades[1] = Create16BPPPaletteShaded(hVObject->pPaletteEntry, 160, 255, 160, TRUE);
|
||||
break;
|
||||
case 3:
|
||||
hVObject->pShades[1] = Create16BPPPaletteShaded(hVObject->pPaletteEntry, 100, 100, 100, FALSE);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1009,6 +1009,12 @@ BOOLEAN UpdateVideoOverlay( VIDEO_OVERLAY_DESC *pTopmostDesc, UINT32 iBlitterInd
|
||||
}
|
||||
}
|
||||
|
||||
if ( uiFlags & VOVERLAY_DESC_FONT )
|
||||
{
|
||||
gVideoOverlays[iBlitterIndex].uiFontID = pTopmostDesc->uiFontID;
|
||||
gVideoOverlays[iBlitterIndex].ubFontBack = pTopmostDesc->ubFontBack;
|
||||
gVideoOverlays[iBlitterIndex].ubFontFore = pTopmostDesc->ubFontFore;
|
||||
}
|
||||
|
||||
if ( uiFlags & VOVERLAY_DESC_DISABLED )
|
||||
{
|
||||
|
||||
@@ -15,9 +15,10 @@
|
||||
#define VOVERLAY_STARTDISABLED 0x00000002
|
||||
|
||||
|
||||
#define VOVERLAY_DESC_TEXT 0x00001000
|
||||
#define VOVERLAY_DESC_TEXT 0x00001000
|
||||
#define VOVERLAY_DESC_DISABLED 0x00002000
|
||||
#define VOVERLAY_DESC_POSITION 0x00004000
|
||||
#define VOVERLAY_DESC_FONT 0x00008000
|
||||
|
||||
// STRUCTURES
|
||||
|
||||
|
||||
@@ -557,12 +557,6 @@ BOOLEAN LoadAllMapChangesFromMapTempFileAndApplyThem( )
|
||||
{
|
||||
ReSetSectorFlag( gWorldSectorX, gWorldSectorY, gbWorldSectorZ, SF_MAP_MODIFICATIONS_TEMP_FILE_EXISTS );
|
||||
}
|
||||
#ifndef USE_VFS
|
||||
FileClose( hFile );
|
||||
#else
|
||||
// FileClose( hFile );
|
||||
// file already deleted. can't close it anymore (handle is invalid)
|
||||
#endif
|
||||
|
||||
//Free the memory used for the temp array
|
||||
MemFree( pTempArrayOfMaps );
|
||||
|
||||
@@ -24,10 +24,6 @@ BOOLEAN gfForceBuildShadeTables = FALSE;
|
||||
|
||||
void DetermineRGBDistributionSettings()
|
||||
{
|
||||
#ifndef USE_VFS
|
||||
STRING512 DataDir;
|
||||
STRING512 ExecDir;
|
||||
#endif
|
||||
STRING512 ShadeTableDir;
|
||||
UINT32 uiRBitMask, uiGBitMask, uiBBitMask;
|
||||
UINT32 uiPrevRBitMask, uiPrevGBitMask, uiPrevBBitMask;
|
||||
@@ -37,36 +33,9 @@ void DetermineRGBDistributionSettings()
|
||||
BOOLEAN fCleanShadeTable = FALSE;
|
||||
BOOLEAN fLoadedPrevRGBDist = FALSE;
|
||||
|
||||
#ifndef USE_VFS
|
||||
// Snap: save current directory
|
||||
GetFileManCurrentDirectory( DataDir );
|
||||
|
||||
//First, determine if we have a file saved. If not, then this is the first time, and
|
||||
//all shade tables will have to be built and saved to disk. This can be time consuming, adding up to
|
||||
//3-4 seconds to the time of a map load.
|
||||
GetExecutableDirectory( ExecDir );
|
||||
sprintf( ShadeTableDir, "%s\\%s", DataDir, SHADE_TABLE_DIR );
|
||||
|
||||
//Check to make sure we have a ShadeTable directory. If we don't create one!
|
||||
if( !SetFileManCurrentDirectory( ShadeTableDir ) )
|
||||
{
|
||||
if( !MakeFileManDirectory( ShadeTableDir ) )
|
||||
{
|
||||
AssertMsg( 0, "ShadeTable directory doesn't exist, and couldn't create one!" );
|
||||
}
|
||||
if( !SetFileManCurrentDirectory( ShadeTableDir ) )
|
||||
{
|
||||
AssertMsg( 0, "Couldn't access the newly created ShadeTable directory." );
|
||||
}
|
||||
fSaveRGBDist = TRUE;
|
||||
}
|
||||
// directory existed or was created.
|
||||
SetFileManCurrentDirectory( DataDir );
|
||||
#else
|
||||
// changing the current directory can screw up the VFS; don't do it
|
||||
// the creation of the SHADE_TABLE_DIR directory is done by the VFS
|
||||
sprintf( ShadeTableDir, "%s", SHADE_TABLE_DIR );
|
||||
#endif
|
||||
|
||||
CHAR8 sRGBDist[50];
|
||||
sprintf( sRGBDist, "%s\\%s", SHADE_TABLE_DIR, "RGBDist.dat");
|
||||
|
||||
@@ -534,9 +534,11 @@ void AddSmokeEffectToTile( INT32 iSmokeEffectID, INT8 bType, INT32 sGridNo, INT8
|
||||
AniParams.uiFlags = ANITILE_CACHEDTILE | ANITILE_FORWARD | ANITILE_SMOKE_EFFECT | ANITILE_LOOPING | ANITILE_ALWAYS_TRANSLUCENT;
|
||||
}
|
||||
|
||||
AniParams.sX = CenterX( sGridNo );
|
||||
AniParams.sY = CenterY( sGridNo );
|
||||
AniParams.sZ = (INT16)0;
|
||||
INT16 sX, sY;
|
||||
ConvertGridNoToCenterCellXY(sGridNo, &sX, &sY);
|
||||
AniParams.sX = sX;
|
||||
AniParams.sY = sY;
|
||||
AniParams.sZ = (INT16)0;
|
||||
|
||||
// Use the right graphic based on type..
|
||||
switch( bType )
|
||||
|
||||
@@ -138,7 +138,6 @@ void InitEngineTilesets( )
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifdef USE_VFS
|
||||
void ExportTilesets(vfs::Path const& filename)
|
||||
{
|
||||
UINT32 uiNumBytesRead = 0;
|
||||
@@ -217,7 +216,6 @@ void ExportTilesets(vfs::Path const& filename)
|
||||
xmlw.closeNode();
|
||||
xmlw.writeToFile(filename);
|
||||
}
|
||||
#endif
|
||||
|
||||
void SetTilesetOneTerrainValues( )
|
||||
{
|
||||
|
||||
@@ -1093,7 +1093,6 @@ void AddSnakeAmim( INT32 sGridno, UINT8 usDirection )
|
||||
if ( !TileIsOutOfBounds( sGridno ) )
|
||||
{
|
||||
ANITILE_PARAMS AniParams;
|
||||
|
||||
memset( &AniParams, 0, sizeof(ANITILE_PARAMS) );
|
||||
|
||||
AniParams.sGridNo = sGridno;
|
||||
@@ -1101,8 +1100,7 @@ void AddSnakeAmim( INT32 sGridno, UINT8 usDirection )
|
||||
AniParams.sDelay = 100;
|
||||
AniParams.sStartFrame = 0;
|
||||
AniParams.uiFlags = ANITILE_CACHEDTILE | ANITILE_FORWARD | ANITILE_USE_DIRECTION_FOR_START_FRAME;//| ANITILE_LOOPING;
|
||||
AniParams.sX = CenterX( sGridno );
|
||||
AniParams.sY = CenterY( sGridno );
|
||||
ConvertGridNoToCenterCellXY(sGridno, &AniParams.sX, &AniParams.sY);
|
||||
AniParams.sZ = 0;
|
||||
strcpy( AniParams.zCachedFile, "TILECACHE\\WATERSNAKE_MOVE.sti" );
|
||||
|
||||
|
||||
@@ -2299,6 +2299,68 @@ void CopyOverheadDBShadetablesFromTileset( )
|
||||
}
|
||||
}
|
||||
|
||||
// anv: map color variants
|
||||
if (NightTime())
|
||||
{
|
||||
switch (gGameExternalOptions.ubOverheadMapModeNight)
|
||||
{
|
||||
case 0:
|
||||
break;
|
||||
case 1:
|
||||
for (uiLoop = 0; uiLoop < (UINT32)giNumberOfTileTypes; uiLoop++)
|
||||
{
|
||||
for (uiLoop2 = 0; uiLoop2 < HVOBJECT_SHADE_TABLES; uiLoop2++)
|
||||
{
|
||||
gSmTileSurf[uiLoop].vo->pShades[uiLoop2] = Create16BPPPaletteShaded(gSmTileSurf[uiLoop].vo->pPaletteEntry, 352, 352, 352, TRUE);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
for (uiLoop = 0; uiLoop < (UINT32)giNumberOfTileTypes; uiLoop++)
|
||||
{
|
||||
for (uiLoop2 = 0; uiLoop2 < HVOBJECT_SHADE_TABLES; uiLoop2++)
|
||||
{
|
||||
gSmTileSurf[uiLoop].vo->pShades[uiLoop2] = Create16BPPPaletteShaded(gSmTileSurf[uiLoop].vo->pPaletteEntry, 160, 255, 160, TRUE);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 3:
|
||||
for (uiLoop = 0; uiLoop < (UINT32)giNumberOfTileTypes; uiLoop++)
|
||||
{
|
||||
for (uiLoop2 = 0; uiLoop2 < HVOBJECT_SHADE_TABLES; uiLoop2++)
|
||||
{
|
||||
gSmTileSurf[uiLoop].vo->pShades[uiLoop2] = Create16BPPPaletteShaded(gSmTileSurf[uiLoop].vo->pPaletteEntry, 100, 100, 100, FALSE);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
switch (gGameExternalOptions.ubOverheadMapModeDay)
|
||||
{
|
||||
case 0:
|
||||
break;
|
||||
case 1:
|
||||
for (uiLoop = 0; uiLoop < (UINT32)giNumberOfTileTypes; uiLoop++)
|
||||
{
|
||||
for (uiLoop2 = 0; uiLoop2 < HVOBJECT_SHADE_TABLES; uiLoop2++)
|
||||
{
|
||||
gSmTileSurf[uiLoop].vo->pShades[uiLoop2] = Create16BPPPaletteShaded(gSmTileSurf[uiLoop].vo->pPaletteEntry, 352, 352, 352, TRUE);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
for (uiLoop = 0; uiLoop < (UINT32)giNumberOfTileTypes; uiLoop++)
|
||||
{
|
||||
for (uiLoop2 = 0; uiLoop2 < HVOBJECT_SHADE_TABLES; uiLoop2++)
|
||||
{
|
||||
gSmTileSurf[uiLoop].vo->pShades[uiLoop2] = Create16BPPPaletteShaded(gSmTileSurf[uiLoop].vo->pPaletteEntry, 160, 255, 160, TRUE);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void TrashOverheadMap( )
|
||||
|
||||
+14
-14
@@ -531,8 +531,7 @@ BOOLEAN PhysicsUpdateLife( REAL_OBJECT *pObject, real DeltaTime )
|
||||
else
|
||||
{
|
||||
// If we are in water, and we are a sinkable item...
|
||||
// if ( !pObject->fInWater || !( Item[ pObject->Obj.usItem ].fFlags & ITEM_SINKS ) )
|
||||
if ( !pObject->fInWater || !( Item[ pObject->Obj.usItem ].sinks ) )
|
||||
if ( !pObject->fInWater || !ItemSinks(pObject->Obj.usItem) )
|
||||
{
|
||||
if ( pObject->fDropItem )
|
||||
{
|
||||
@@ -562,7 +561,7 @@ BOOLEAN PhysicsUpdateLife( REAL_OBJECT *pObject, real DeltaTime )
|
||||
}
|
||||
|
||||
// Make impact noise....
|
||||
if ( Item[pObject->Obj.usItem].rock )
|
||||
if (ItemIsRock(pObject->Obj.usItem))
|
||||
{
|
||||
MakeNoise( pObject->ubOwner, pObject->sGridNo, 0, gpWorldLevelData[ pObject->sGridNo ].ubTerrainID, (UINT8) (9 + PreRandom( 9 ) ), NOISE_ROCK_IMPACT );
|
||||
}
|
||||
@@ -1013,10 +1012,11 @@ BOOLEAN PhysicsCheckForCollisions( REAL_OBJECT *pObject, INT32 *piCollisionID )
|
||||
if ( iCollisionCode == COLLISION_WINDOW_NORTHWEST || iCollisionCode == COLLISION_WINDOW_NORTHEAST || iCollisionCode == COLLISION_WINDOW_SOUTHWEST || iCollisionCode == COLLISION_WINDOW_SOUTHEAST )
|
||||
{
|
||||
// sevenfm: added requirements for object to break window
|
||||
if (Item[pObject->Obj.usItem].ubWeight >= 4 &&
|
||||
Item[pObject->Obj.usItem].sinks &&
|
||||
!Item[pObject->Obj.usItem].unaerodynamic &&
|
||||
(Item[pObject->Obj.usItem].metal || Item[pObject->Obj.usItem].rock))
|
||||
UINT16 usItem = pObject->Obj.usItem;
|
||||
if (Item[usItem].ubWeight >= 4 &&
|
||||
ItemSinks(usItem) &&
|
||||
!ItemIsUnaerodynamic(usItem) &&
|
||||
(ItemIsMetal(usItem) || ItemIsRock(usItem)))
|
||||
{
|
||||
if (!pObject->fTestObject)
|
||||
{
|
||||
@@ -1927,7 +1927,7 @@ void CalculateLaunchItemBasicParams( SOLDIERTYPE *pSoldier, OBJECTTYPE *pItem, I
|
||||
|
||||
|
||||
DebugMsg(TOPIC_JA2,DBG_LEVEL_3,String("physics.cpp line 1741"));
|
||||
if ( fArmed && ( Item[usLauncher].mortar || Item[pItem->usItem].mortar ) )
|
||||
if ( fArmed && (ItemIsMortar(usLauncher) || ItemIsMortar(pItem->usItem)) )
|
||||
{
|
||||
// Start at 0....
|
||||
sStartZ = ( pSoldier->pathing.bLevel * 256 );
|
||||
@@ -1937,7 +1937,7 @@ void CalculateLaunchItemBasicParams( SOLDIERTYPE *pSoldier, OBJECTTYPE *pItem, I
|
||||
}
|
||||
DebugMsg(TOPIC_JA2,DBG_LEVEL_3,String("physics.cpp line 1750"));
|
||||
|
||||
if ( fArmed && ( Item[usLauncher].grenadelauncher || Item[pItem->usItem].grenadelauncher ) )
|
||||
if ( fArmed && (ItemIsGrenadeLauncher(usLauncher) || ItemIsGrenadeLauncher(pItem->usItem)) )
|
||||
{
|
||||
// OK, look at target level and decide angle to use...
|
||||
if ( ubLevel == 1 )
|
||||
@@ -1995,7 +1995,7 @@ void CalculateLaunchItemBasicParams( SOLDIERTYPE *pSoldier, OBJECTTYPE *pItem, I
|
||||
{
|
||||
// bad news - i can't throw item at myself
|
||||
// so use dir incrementer
|
||||
UINT8 ubDir = atan8( CenterX(pSoldier->sGridNo), CenterY(pSoldier->sGridNo), CenterX(sGridNo), CenterY(sGridNo) );
|
||||
UINT8 ubDir = GetDirectionFromCenterCellXYGridNo(pSoldier->sGridNo, sGridNo);
|
||||
sInterGridNo += DirIncrementer[ubDir];
|
||||
}
|
||||
}
|
||||
@@ -2327,7 +2327,7 @@ void CalculateLaunchItemParamsForThrow( SOLDIERTYPE *pSoldier, INT32 sGridNo, UI
|
||||
}
|
||||
|
||||
// set the max miss radius
|
||||
if ( Item[usItemNum].mortar )
|
||||
if (ItemIsMortar(usItemNum))
|
||||
{
|
||||
bMaxRadius = gItemSettings.usMissMaxRadiusMortar;
|
||||
}
|
||||
@@ -2413,7 +2413,7 @@ void CalculateLaunchItemParamsForThrow( SOLDIERTYPE *pSoldier, INT32 sGridNo, UI
|
||||
|
||||
DebugMsg(TOPIC_JA2,DBG_LEVEL_3,String("physics.cpp line 2103"));
|
||||
|
||||
if ( fArmed && Item[usLauncher].mortar )
|
||||
if ( fArmed && ItemIsMortar(usLauncher))
|
||||
{
|
||||
// Start at 0....
|
||||
sStartZ = ( pSoldier->pathing.bLevel * 256 ) + 50;
|
||||
@@ -2665,7 +2665,7 @@ void HandleArmedObjectImpact( REAL_OBJECT *pObject )
|
||||
{
|
||||
fCheckForDuds = TRUE;
|
||||
|
||||
if (CanDelayGrenadeExplosion(pObj->usItem) && (Item[pObj->usItem].ubCursor == TOSSCURS || Item[pObj->usItem].glgrenade))
|
||||
if (CanDelayGrenadeExplosion(pObj->usItem) && (Item[pObj->usItem].ubCursor == TOSSCURS || ItemIsGLgrenade(pObj->usItem)))
|
||||
{
|
||||
fCanDelayExplosion = TRUE;
|
||||
}
|
||||
@@ -2780,7 +2780,7 @@ void HandleArmedObjectImpact( REAL_OBJECT *pObject )
|
||||
|
||||
if ( fDoImpact )
|
||||
{
|
||||
if ( Item[pObject->Obj.usItem].flare )
|
||||
if (ItemIsFlare(pObject->Obj.usItem))
|
||||
{
|
||||
//if the light object will be created OFF the ground
|
||||
if( pObject->Position.z > 0 && FindBuilding(pObject->sGridNo) )
|
||||
|
||||
@@ -614,7 +614,7 @@ void ShowRiotShield( SOLDIERTYPE* pSoldier, UINT16 *pBuffer, UINT32 uiDestPitchB
|
||||
// try to keep the shield 'moving' alongside the soldier. This won't work perfectly, but it's better than nothing
|
||||
INT16 base_x = 0;
|
||||
INT16 base_y = 0;
|
||||
ConvertMapPosToWorldTileCenter( pSoldier->sGridNo, &base_x, &base_y );
|
||||
ConvertGridNoToCenterCellXY( pSoldier->sGridNo, &base_x, &base_y );
|
||||
|
||||
INT16 dx = pSoldier->sX - base_x;
|
||||
INT16 dy = pSoldier->sY - base_y;
|
||||
|
||||
+32
-10
@@ -1914,10 +1914,10 @@ INT8 DamageStructure( STRUCTURE * pStructure, UINT8 ubDamage, UINT8 ubReason, IN
|
||||
//Since the structure is being damaged, set the map element that a structure is damaged
|
||||
gpWorldLevelData[ tmpgridno ].uiFlags |= MAPELEMENT_STRUCTURE_DAMAGED;
|
||||
|
||||
// handle structure revenge - damage to vehicle
|
||||
// handle structure revenge - damage to vehicle - to be resolved after movement
|
||||
if ( ubOwner != NOBODY && MercPtrs[ubOwner] && !ARMED_VEHICLE( MercPtrs[ubOwner] ) )
|
||||
{
|
||||
MercPtrs[ ubOwner ]->SoldierTakeDamage( 0, Random(max(0,(ubBaseArmour-10)/5))+max(0,(ubBaseArmour-10)/5), 0, TAKE_DAMAGE_STRUCTURE_EXPLOSION, NOBODY, MercPtrs[ ubOwner ]->sGridNo, 0, TRUE );
|
||||
MercPtrs[ubOwner]->SoldierTakeDelayedDamage(0, Random(max(0,(ubBaseArmour-10)/5)) + max(0,(ubBaseArmour-10)/5), 0, TAKE_DAMAGE_STRUCTURE_EXPLOSION, NOBODY, MercPtrs[ ubOwner ]->sGridNo, 0, TRUE);
|
||||
}
|
||||
|
||||
// recompile = TRUE means that we destroyed something
|
||||
@@ -2440,10 +2440,14 @@ BOOLEAN AddZStripInfoToVObject( HVOBJECT hVObject, STRUCTURE_FILE_REF * pStructu
|
||||
// MemAlloc returns a NULL pointer which the code would interpret as
|
||||
// allocation failing because of no memory.
|
||||
// I hope this is OK, I don't entirely understand what is done here...
|
||||
// (ASDOW): Commented out the added conditional, because with an unlucky combination of sti image width and offset, eg 9x16 with x offset of -15
|
||||
// pCurr->pbZChange would be null, which then crashes the game inside the blitting functions when dereferencing a nullptr
|
||||
// With Bio experiencing crashes causing him to add the check, I don't know if this is just kicking the can down the road.
|
||||
// if (pCurr->ubNumberOfZChanges > 0)
|
||||
// (ASDOW): Adjusted the else branch to prevent DEBUG build hitting an assertion error due to this function returning false and
|
||||
// preventing crashes in blitter functions due to nullptr dereference as what happened with bio's original solution.
|
||||
// Allocating one INT8 and setting it to 0 means the Z-value is not adjusted in blitters.
|
||||
// So far it seems to just work, albeit we're getting a screenmessage of structure not added to the world properly, when
|
||||
// the game tries to add one in AddMercStructureInfoFromAnimSurface() for said anim when we're missing the actual structureinfo.
|
||||
// As the game then doesn't do anything besides returning false, it seems to not cause any issues besides the screenmessage in debug build.
|
||||
// So now we should not suffer from the constant assertion errors in debug build when LOBOT is active. Though this could still use a proper solution..
|
||||
if (pCurr->ubNumberOfZChanges > 0)
|
||||
{
|
||||
pCurr->pbZChange = (INT8 *)MemAlloc(pCurr->ubNumberOfZChanges);
|
||||
if (pCurr->pbZChange == NULL)
|
||||
@@ -2485,10 +2489,28 @@ BOOLEAN AddZStripInfoToVObject( HVOBJECT hVObject, STRUCTURE_FILE_REF * pStructu
|
||||
pCurr->bInitialZChange = -(ubNumDecreasing);
|
||||
}
|
||||
}
|
||||
// else
|
||||
// {
|
||||
// pCurr->pbZChange = NULL;
|
||||
// }
|
||||
else
|
||||
{
|
||||
pCurr->pbZChange = (INT8*)MemAlloc(1);
|
||||
|
||||
// Abort if MemAlloc fails
|
||||
if (pCurr->pbZChange == NULL)
|
||||
{
|
||||
// augh!
|
||||
for (ubLoop2 = 0; ubLoop2 < uiLoop; ubLoop2++)
|
||||
{
|
||||
if (hVObject->ppZStripInfo[ubLoop2] != NULL)
|
||||
{
|
||||
MemFree(hVObject->ppZStripInfo[uiLoop]);
|
||||
}
|
||||
}
|
||||
MemFree(hVObject->ppZStripInfo);
|
||||
hVObject->ppZStripInfo = NULL;
|
||||
return(FALSE);
|
||||
}
|
||||
|
||||
pCurr->pbZChange[0] = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2437,14 +2437,10 @@ BOOLEAN EvaluateWorld(STR8 pSector, UINT8 ubLevel)
|
||||
if(ValidMapFileName(szFileName))
|
||||
strcpy(szFilename, pSector);
|
||||
sprintf(szDirFilename, "MAPS\\%s", szFilename);
|
||||
#ifdef USE_VFS//dnl ch81 021213
|
||||
if(guiCurrentScreen == LOADSAVE_SCREEN)
|
||||
hfile = FileOpen(szDirFilename, FILE_ACCESS_READ, FALSE, gzProfileName);
|
||||
else
|
||||
hfile = FileOpen(szDirFilename, FILE_ACCESS_READ);
|
||||
#else
|
||||
hfile = FileOpen(szDirFilename, FILE_ACCESS_READ, FALSE);
|
||||
#endif
|
||||
if(!hfile)
|
||||
return(FALSE);
|
||||
uiFileSize = FileGetSize(hfile);
|
||||
@@ -2851,7 +2847,6 @@ BOOLEAN LoadWorld(const STR8 puiFilename, FLOAT* pMajorMapVersion, UINT8* pMinor
|
||||
else
|
||||
sprintf(aFilename, "MAPS\\%s", puiFilename);
|
||||
// Open file
|
||||
#ifdef USE_VFS//dnl ch81 021213
|
||||
#ifdef JA2EDITOR
|
||||
if(guiCurrentScreen == LOADSAVE_SCREEN)
|
||||
hfile = FileOpen(aFilename, FILE_ACCESS_READ, FALSE, gzProfileName);
|
||||
@@ -2859,9 +2854,6 @@ BOOLEAN LoadWorld(const STR8 puiFilename, FLOAT* pMajorMapVersion, UINT8* pMinor
|
||||
hfile = FileOpen(aFilename, FILE_ACCESS_READ);
|
||||
#else
|
||||
hfile = FileOpen(aFilename, FILE_ACCESS_READ);
|
||||
#endif
|
||||
#else
|
||||
hfile = FileOpen(aFilename, FILE_ACCESS_READ, FALSE);
|
||||
#endif
|
||||
if(!hfile)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user