BOOLEAN FindAutobandageClimbPoint( INT32 sDesiredGridNo, BOOLEAN fClimbUp ) { // checks for existance of location to climb up to building, not occupied by a medic BUILDING * pBuilding; UINT8 ubNumClimbSpots; UINT8 ubLoop; UINT8 ubWhoIsThere; pBuilding = FindBuilding( sDesiredGridNo ); if (!pBuilding) { return( FALSE ); } ubNumClimbSpots = pBuilding->ubNumClimbSpots; for ( ubLoop = 0; ubLoop < ubNumClimbSpots; ubLoop++ ) { ubWhoIsThere = WhoIsThere2( pBuilding->sUpClimbSpots[ ubLoop ], 1 ); if ( ubWhoIsThere != NOBODY && !CanCharacterAutoBandageTeammate( MercPtrs[ ubWhoIsThere ] ) ) { continue; } ubWhoIsThere = WhoIsThere2( pBuilding->sDownClimbSpots[ ubLoop ], 0 ); if ( ubWhoIsThere != NOBODY && !CanCharacterAutoBandageTeammate( MercPtrs[ ubWhoIsThere ] ) ) { continue; } return( TRUE ); } return( FALSE ); }
BOOLEAN InBuilding( INT16 sGridNo ) { if ( FindBuilding( sGridNo ) == NULL ) { return( FALSE ); } return( TRUE ); }
INT16 FindClosestClimbPoint( INT16 sStartGridNo, INT16 sDesiredGridNo, BOOLEAN fClimbUp ) { BUILDING * pBuilding; UINT8 ubNumClimbSpots; INT16 * psClimbSpots; UINT8 ubLoop; INT16 sDistance, sClosestDistance = 1000, sClosestSpot= NOWHERE; pBuilding = FindBuilding( sDesiredGridNo ); if (!pBuilding) { return( NOWHERE ); } ubNumClimbSpots = pBuilding->ubNumClimbSpots; if (fClimbUp) { psClimbSpots = pBuilding->sUpClimbSpots; } else { psClimbSpots = pBuilding->sDownClimbSpots; } for ( ubLoop = 0; ubLoop < ubNumClimbSpots; ubLoop++ ) { if ( (WhoIsThere2( pBuilding->sUpClimbSpots[ ubLoop ], 0 ) == NOBODY) && (WhoIsThere2( pBuilding->sDownClimbSpots[ ubLoop ], 1 ) == NOBODY) ) { sDistance = PythSpacesAway( sStartGridNo, psClimbSpots[ ubLoop ] ); if (sDistance < sClosestDistance ) { sClosestDistance = sDistance; sClosestSpot = psClimbSpots[ ubLoop ]; } } } return( sClosestSpot ); }
void AddMissileTrail( BULLET *pBullet, FIXEDPT qCurrX, FIXEDPT qCurrY, FIXEDPT qCurrZ ) { ANITILE_PARAMS AniParams; // If we are a small missle, don't show if ( pBullet->usFlags & ( BULLET_FLAG_SMALL_MISSILE | BULLET_FLAG_FLAME | BULLET_FLAG_CREATURE_SPIT /*| BULLET_FLAG_TRACER*/ ) ) { if ( pBullet->iLoop < 5 ) { return; } } // HEADROCK HAM B2.5: Created new bullet flag that tells us whether this specific bullet is a tracer. // The condition now reads that flag and creates a lightshow only for tracer bullets. This flag is only // used if the new Tracer System is on. //if (fTracer == TRUE) if ((gGameExternalOptions.ubRealisticTracers > 0 && gGameExternalOptions.ubNumBulletsPerTracer > 0 && pBullet->fTracer == TRUE) || (gGameExternalOptions.ubRealisticTracers == 0 && fTracer == TRUE)) { if ( pBullet->iLoop < 5 ) { return; } } // If we are a small missle, don't show if ( pBullet->usFlags & ( BULLET_FLAG_TANK_CANNON ) ) { //if ( pBullet->iLoop < 40 ) //{ return; //} } memset( &AniParams, 0, sizeof( ANITILE_PARAMS ) ); AniParams.sGridNo = pBullet->sGridNo; AniParams.ubLevelID = ANI_STRUCT_LEVEL; AniParams.sDelay = (INT16)( 100 + Random( 100 ) ); AniParams.sStartFrame = 0; AniParams.uiFlags = ANITILE_CACHEDTILE | ANITILE_FORWARD | ANITILE_ALWAYS_TRANSLUCENT; AniParams.sX = FIXEDPT_TO_INT32( qCurrX ); AniParams.sY = FIXEDPT_TO_INT32( qCurrY ); AniParams.sZ = CONVERT_HEIGHTUNITS_TO_PIXELS( FIXEDPT_TO_INT32( qCurrZ ) ); if ( pBullet->usFlags & ( BULLET_FLAG_MISSILE | BULLET_FLAG_TANK_CANNON ) ) { strcpy( AniParams.zCachedFile, "TILECACHE\\MSLE_SMK.STI" ); } else if ( pBullet->usFlags & ( BULLET_FLAG_SMALL_MISSILE ) ) { strcpy( AniParams.zCachedFile, "TILECACHE\\MSLE_SMA.STI" ); } else if ( pBullet->usFlags & ( BULLET_FLAG_CREATURE_SPIT ) ) { strcpy( AniParams.zCachedFile, "TILECACHE\\MSLE_SPT.STI" ); } else if ( pBullet->usFlags & ( BULLET_FLAG_FLAME ) ) { strcpy( AniParams.zCachedFile, "TILECACHE\\FLMTHR2.STI" ); AniParams.sDelay = (INT16)( 100 ); } //else if ( pBullet->usFlags & ( BULLET_FLAG_TRACER ) ) // HEADROCK HAM B2.5: Created new bullet flag that tells us whether this specific bullet is a tracer. // The condition now reads that flag and creates a lightshow only for tracer bullets. This flag is only // used if the new Tracer System is on. // else if (fTracer == TRUE) else if ((gGameExternalOptions.ubRealisticTracers > 0 && gGameExternalOptions.ubNumBulletsPerTracer > 0 && pBullet->fTracer == TRUE) || (gGameExternalOptions.ubRealisticTracers == 0 && fTracer == TRUE)) { INT16 sXPos, sYPos; strcpy( AniParams.zCachedFile, "TILECACHE\\BULLET_TRACER.STI" ); AniParams.uiFlags |= ANITILE_LIGHT; AniParams.sDelay = 10000; // Test this out if (!pBullet->pAniTile) { pBullet->pAniTile = CreateAnimationTile( &AniParams ); } ConvertGridNoToCenterCellXY( pBullet->sGridNo, &sXPos, &sYPos ); LightSpritePosition( pBullet->pAniTile->lightSprite, (INT16)(sXPos/CELL_X_SIZE), (INT16)(sYPos/CELL_Y_SIZE)); #if 0 if ( pBullet->pFirer->pathing.bLevel > 0 ) // if firer on roof then { if ( FindBuilding(AniParams.sGridNo) != NULL ) // if this spot is still within the building's grid area { LightSpritePower( pBullet->pAniTile->lightSprite, FALSE); } } #endif return; } CreateAnimationTile( &AniParams ); }