Ejemplo n.º 1
0
void CallAvailableTeamEnemiesTo( INT16 sGridno, INT8 bTeam )
{
	INT32	iLoop2;
	SOLDIERTYPE * pSoldier;

	// All enemy teams become aware of a very important "noise" coming from here!
	// if this team is active
	if (gTacticalStatus.Team[bTeam].bTeamActive)
	{
		// if this team is computer-controlled, and isn't the CIVILIAN "team"
		if (!(gTacticalStatus.Team[bTeam].bHuman) && (bTeam != CIV_TEAM))
		{
			// make this team (publicly) aware of the "noise"
			gsPublicNoiseGridno[bTeam] = sGridno;
			gubPublicNoiseVolume[bTeam] = MAX_MISC_NOISE_DURATION;

			// new situation for everyone;
			iLoop2 = gTacticalStatus.Team[ bTeam ].bFirstID;
			for ( pSoldier = MercPtrs[iLoop2]; iLoop2 <= gTacticalStatus.Team[ bTeam ].bLastID; iLoop2++, pSoldier++ )
			{
				if (pSoldier->bActive && pSoldier->bInSector && pSoldier->bLife >= OKLIFE)
				{
					SetNewSituation( pSoldier );
					WearGasMaskIfAvailable( pSoldier );
				}
			}

		}
	}
}
Ejemplo n.º 2
0
void CallAvailableKingpinMenTo( INT16 sGridNo )
{
	// like call all enemies, but only affects civgroup KINGPIN guys with 
	// NO PROFILE

	INT32	iLoop2;
	SOLDIERTYPE * pSoldier;

	// All enemy teams become aware of a very important "noise" coming from here!
	// if this team is active
	if (gTacticalStatus.Team[CIV_TEAM].bTeamActive)
	{
		// make this team (publicly) aware of the "noise"
		gsPublicNoiseGridno[CIV_TEAM] = sGridNo;
		gubPublicNoiseVolume[CIV_TEAM] = MAX_MISC_NOISE_DURATION;

		// new situation for everyone...

		iLoop2 = gTacticalStatus.Team[ CIV_TEAM ].bFirstID;
		for ( pSoldier = MercPtrs[iLoop2]; iLoop2 <= gTacticalStatus.Team[ CIV_TEAM ].bLastID; iLoop2++, pSoldier++ )
		{
			if (pSoldier->bActive && pSoldier->bInSector && pSoldier->bLife >= OKLIFE && pSoldier->ubCivilianGroup == KINGPIN_CIV_GROUP && pSoldier->ubProfile == NO_PROFILE)
			{
				SetNewSituation( pSoldier );
			}
		}
	}
}
Ejemplo n.º 3
0
void CallEldinTo( INT16 sGridNo )
{
	// like call all enemies, but only affects Eldin
	SOLDIERTYPE * pSoldier;

	// Eldin becomes aware of a very important "noise" coming from here!
	// So long as he hasn't already heard a noise a sec ago...
	if (gTacticalStatus.Team[CIV_TEAM].bTeamActive)
	{
		// new situation for Eldin
		pSoldier = FindSoldierByProfileID( ELDIN, FALSE );
		if ( pSoldier && pSoldier->bActive && pSoldier->bInSector && pSoldier->bLife >= OKLIFE && (pSoldier->bAlertStatus == STATUS_GREEN || pSoldier->ubNoiseVolume < (MAX_MISC_NOISE_DURATION / 2) ) )
		{
			if ( SoldierToLocationLineOfSightTest( pSoldier, sGridNo, (UINT8) MaxDistanceVisible(), TRUE ) )
			{
				// sees the player now!
				TriggerNPCWithIHateYouQuote( ELDIN );
				SetNewSituation( pSoldier );
			}
			else
			{
				pSoldier->sNoiseGridno = sGridNo;
				pSoldier->ubNoiseVolume = MAX_MISC_NOISE_DURATION;
				pSoldier->bAlertStatus = STATUS_RED;
				if ( (pSoldier->bAction != AI_ACTION_GET_CLOSER) || CheckFact( FACT_MUSEUM_ALARM_WENT_OFF, 0 ) == FALSE )
				{
					CancelAIAction( pSoldier, TRUE );
					pSoldier->bNextAction = AI_ACTION_GET_CLOSER;
					pSoldier->usNextActionData = sGridNo;
					RESETTIMECOUNTER( pSoldier->AICounter, 100 );
				}
				// otherwise let AI handle this normally
//				SetNewSituation( pSoldier );
				// reduce any delay to minimal
			}
			SetFactTrue( FACT_MUSEUM_ALARM_WENT_OFF );
		}
	}
}
Ejemplo n.º 4
0
void MakeClosestEnemyChosenOne()
{
	UINT32				cnt;
	INT16					sPathCost, sShortestPath = 1000;
	INT8					bOldKeys = -1;
	UINT8					ubClosestEnemy = NOBODY;
	SOLDIERTYPE *	pSoldier;
	INT8					bPanicTrigger;
	INT16					sPanicTriggerGridNo;

	if ( ! (gTacticalStatus.fPanicFlags & PANIC_TRIGGERS_HERE) )
	{
#ifdef BETAVERSION
		PopMessage("MakeClosestEnemyChosenOne: ERROR - Panic Trigger is NOWHERE");
#endif

		return;
	}

	if (!NeedToRadioAboutPanicTrigger() )
	{
		// no active panic triggers
		return;
	}

	// consider every enemy, looking for the closest capable, unbusy one
	for (cnt = 0; cnt < guiNumMercSlots; cnt++)
	{
		pSoldier = MercSlots[cnt];

		if (!pSoldier)	// if this merc is inactive, or not here
		{
			continue;
		}

		// if this merc is unconscious, or dead
		if (pSoldier->bLife < OKLIFE)
		{
			continue;  // next soldier
		}

		// if this guy's too tired to go
		if (pSoldier->bBreath < OKBREATH)
		{
			continue;  // next soldier
		}

		if ( gWorldSectorX == TIXA_SECTOR_X && gWorldSectorY == TIXA_SECTOR_Y )
		{
			if ( pSoldier->ubProfile != WARDEN )
			{
				continue;
			}
		}
		else
		{
			// only consider for army guys
			if (pSoldier->bTeam != ENEMY_TEAM )
			{
				continue;
			}
		}

		// if this guy is in battle with opponent(s)
		if (pSoldier->bOppCnt > 0)
		{
			continue;  // next soldier
		}

		// if this guy is still in serious shock
		if (pSoldier->bShock > 2)
		{
			continue;  // next soldier
		}

		if ( pSoldier->bLevel != 0 )
		{
			// screw having guys on the roof go for panic triggers!
			continue;  // next soldier
		}

		bPanicTrigger = ClosestPanicTrigger( pSoldier );
		if (bPanicTrigger == -1)
		{
			continue; // next soldier
		}

		sPanicTriggerGridNo = gTacticalStatus.sPanicTriggerGridNo[ bPanicTrigger ];
		if (sPanicTriggerGridNo == NOWHERE)
		{
			// this should never happen!
			continue;
		}

		// remember whether this guy had keys before
		//bOldKeys = pSoldier->bHasKeys;

		// give him keys to see if with them he can get to the panic trigger
		pSoldier->bHasKeys = (pSoldier->bHasKeys << 1) | 1;

		// we now path directly to the panic trigger

		
			// if he can't get to a spot where he could get at the panic trigger
			/*
			if ( FindAdjacentGridEx( pSoldier, gTacticalStatus.sPanicTriggerGridno, &ubDirection, &sAdjSpot, FALSE, FALSE ) == -1 )
			{
				pSoldier->bHasKeys = bOldKeys;
				continue;          // next merc
			}
			*/


		// ok, this enemy appears to be eligible

		// FindAdjacentGrid set HandGrid for us.  If we aren't at that spot already
		if (pSoldier->sGridNo != sPanicTriggerGridNo)
		{
			// get the AP cost for this enemy to go to target position
			sPathCost = PlotPath( pSoldier, sPanicTriggerGridNo, FALSE, FALSE, FALSE, WALKING, FALSE, FALSE, 0);
		}
		else
		{
			sPathCost = 0;
		}

		// set his keys value back to what it was before this hack
		pSoldier->bHasKeys = (pSoldier->bHasKeys >> 1 );

		// if he can get there (or is already there!)
		if (sPathCost || (pSoldier->sGridNo == sPanicTriggerGridNo))
		{
			if (sPathCost < sShortestPath)
			{
				sShortestPath = sPathCost;
				ubClosestEnemy = pSoldier->ubID;
			}
		}
		//else
		//NameMessage(pSoldier,"can't get there...");
	}

	// if we found have an eligible enemy, make him our "chosen one"
	if (ubClosestEnemy < NOBODY)
	{
		gTacticalStatus.ubTheChosenOne = ubClosestEnemy;       // flag him as the chosen one

#ifdef TESTVERSION
		NumMessage("TEST MSG: The chosen one is ",TheChosenOne);
#endif

		pSoldier = MercPtrs[gTacticalStatus.ubTheChosenOne];
		if ( pSoldier->bAlertStatus < STATUS_RED )
		{
			pSoldier->bAlertStatus = STATUS_RED;
			CheckForChangingOrders( pSoldier );
		}
		SetNewSituation( pSoldier );    // set new situation for the chosen one
		pSoldier->bHasKeys = (pSoldier->bHasKeys << 1) | 1; // cheat and give him keys to every door
		//pSoldier->bHasKeys = TRUE;         
	}
#ifdef TESTVERSION
	else
		PopMessage("TEST MSG: Couldn't find anyone eligible to become TheChosenOne!");
#endif
}