예제 #1
0
void CultistAI::AI_STATE_AttackFar()
{
	DFLOAT fHeight = (DFLOAT)fabs(m_vTargetPos.y - m_MoveObj.GetPos().y);

	//SCHLEGZ 4/22/98 4:51:21 PM: sanity check
	if(m_hTarget == DNULL)
	{
		if(fHeight <= m_vDims.y)
			SetNewState(STATE_SearchVisualTarget);
		else
			ComputeState();

		return;
	}

	m_fStimuli[SIGHT] = VEC_DIST(m_MoveObj.GetPos(),m_vTargetPos);
	DBOOL bAbove = (m_vTargetPos.y - m_MoveObj.GetPos().y) > 0;

	switch(Metacmd)
	{
		case 1:		MC_FaceTarget();	break;
		case 2:		MC_BestWeapon();	break;
		case 3:		if(m_fStimuli[SIGHT] <= (m_fSeeingDist * 0.75) || m_nCurMetacmd == MC_FIRE_STAND || fHeight > m_vDims.y)
					{
						MC_Fire_Stand();
					}
					else
						Metacmd++;

					break;
		case 4:		if(m_fStimuli[SIGHT] > (m_fSeeingDist * 0.75))
					{
						MC_FaceTarget();
						Metacmd--;

						if(!IsLedge(m_MoveObj.GetForwardVector()) && fHeight <= m_vDims.y
							&& m_nCurMetacmd != MC_FIRE_STAND
							)
						{
							if(m_nInjuredLeg)
								MC_Walk();
							else
								MC_Fire_Run();
						}
						else
						{
							MC_Fire_Stand();
						}
					}
					else
						Metacmd++;

					break;
		case 5:		ComputeState();		break;
	}

	return;
}
예제 #2
0
void Prophet::AI_STATE_Escape_RunAway()
{
    DFLOAT fHeight = (DFLOAT)fabs(m_vTargetPos.y - m_MoveObj.GetPos().y);

    //SCHLEGZ 4/22/98 4:51:21 PM: sanity check
    if(m_hTarget == DNULL && m_nCurMetacmd != MC_FIRE_STAND)
    {
        if(fHeight <= m_vDims.y)
            SetNewState(STATE_SearchVisualTarget);
        else
            ComputeState();

        return;
    }

    switch(Metacmd)
    {
    case 1:
        MC_FaceTarget();
        m_InventoryMgr.ChangeWeapon(WEAP_MELEE);

        break;
    case 2:
        m_fStimuli[SIGHT] = VEC_DIST(m_MoveObj.GetPos(),m_vTargetPos);

        if(m_fStimuli[SIGHT] <= 75.0f)
            MC_Fire_Stand();
        else
        {
            MC_FaceTarget();
            Metacmd--;

            if(!IsLedge(m_MoveObj.GetForwardVector()) && fHeight <= m_vDims.y)
            {
                MC_Run();
            }
            else
            {
                MC_Idle();
            }
        }

        break;
    case 3:
        ComputeState();
        break;
    }

    return;
}
예제 #3
0
파일: bug.cpp 프로젝트: Arc0re/lithtech
void BugAI::AI_STATE_Escape_RunAway()
{
	//SCHLEGZ 4/22/98 4:51:21 PM: sanity check
	if(m_hTarget == DNULL)
	{
		SetNewState(STATE_Idle);
		return;
	}

	switch(Metacmd)
	{
		case 1:		char szSound[256];
					_mbscpy((unsigned char*)szSound, (const unsigned char*)SOUND_FEAR);
					m_pAnim_Sound->GetSoundPath(szSound,m_pServerDE->IntRandom(1,NUM_BUG_FEAR));

					PlayAISound(szSound, 1000.0f);					

					Metacmd++;			break;
		case 2:		MC_FaceTarget();							break;
		case 3:		m_fRadsLeft = 3.14f;	Metacmd++;			break;
		case 4:		MC_Turn();									break;
		case 5:		MC_Run();									break;
		case 6:		ComputeState();								break;
	}

	return;
}
예제 #4
0
void GremlinAI::AI_STATE_GuardLocation()
{
	int nStimType = ComputeStimuli();

	MC_FaceTarget();
	Metacmd--;

	switch(Metacmd)
	{
		case 1:		if(nStimType != STIM_SMELL && nStimType > 0)
						Metacmd++;

					break;
		case 2:		MC_Taunt_Bold();		break;
		case 3:		if(m_fStimuli[SIGHT] <= m_fSeeingDist || m_nCurMetacmd == MC_FIRE_STAND)
					{
						MC_Fire_Stand();
					}
					else
						Metacmd++;

					break;
		case 4:		if(m_fStimuli[HEALTH] <= 0.50f)
						ComputeState();
					else
						Metacmd = 1;			
					
					break;
	}

	return;
}
예제 #5
0
void UndeadGideon::AI_STATE_AttackFar()
{
	DFLOAT fHeight = (DFLOAT)fabs(m_vTargetPos.y - m_MoveObj.GetPos().y);

	//SCHLEGZ 4/22/98 4:51:21 PM: sanity check
	if(m_hTarget == DNULL && m_nCurMetacmd != MC_FIRE_STAND && m_nCurMetacmd != MC_JUMP)
	{
		if(fHeight <= m_vDims.y)
			SetNewState(STATE_SearchVisualTarget);
		else
			ComputeState();

		return;
	}

	m_fStimuli[SIGHT] = VEC_DIST(m_MoveObj.GetPos(),m_vTargetPos);
	DBOOL bAbove = (m_vTargetPos.y - m_MoveObj.GetPos().y) > 0;
	
	MC_FaceTarget();
	Metacmd--;
					
	switch(Metacmd)
	{
		case 1:		if(m_fStimuli[SIGHT] <= (m_fSeeingDist * 0.75) || m_nCurMetacmd == MC_FIRE_STAND 
						|| (bAbove && fHeight > m_vDims.y))
					{
						MC_Fire_Stand();
					}
					else
					{
						if(m_fStimuli[SIGHT] < (m_fSeeingDist * 0.20))
							ComputeState();
						else
							MC_Walk();		
					}
					
					break;
		case 2:		if((m_fStimuli[SIGHT] < (m_fSeeingDist * 0.20)) && m_nCurMetacmd != MC_JUMP
						|| (bAbove && fHeight > m_vDims.y))
					{
						ComputeState();
					}
					else if(m_fStimuli[SIGHT] < (m_fSeeingDist * 0.30) || m_nCurMetacmd == MC_JUMP
							|| IsLedge(m_MoveObj.GetForwardVector()))
					{
						MC_Jump();
					}
					else
						MC_Walk();		

					break;
		case 3:		ComputeState();					break;
	}

	return;
}
예제 #6
0
void GremlinAI::AI_STATE_AttackClose()
{
	DFLOAT fHeight = (DFLOAT)fabs(m_vTargetPos.y - m_MoveObj.GetPos().y);

	//SCHLEGZ 4/22/98 4:51:21 PM: sanity check
	if(m_hTarget == DNULL)
	{
		ComputeState();

		return;
	}

	m_fStimuli[SIGHT] = VEC_DIST(m_MoveObj.GetPos(),m_vTargetPos);
	
	MC_FaceTarget();
	Metacmd--;

	DBOOL bAbove = (m_vTargetPos.y - m_MoveObj.GetPos().y) > 0;

	switch(Metacmd)
	{
		case 1:		MC_FaceTarget();	break;
		case 2:		if(m_fStimuli[SIGHT] <= 75.0f || m_nCurMetacmd == MC_FIRE_STAND 
						|| (bAbove && fHeight > m_vDims.y))
					{
						MC_Fire_Stand();
					}
					else
					{
						if(m_fStimuli[SIGHT] > (m_fSeeingDist * 0.33))
							ComputeState();
						else
							MC_Run();		
					} 
					
					break;
		case 3:		ComputeState();									break;
	}

	return;
}
예제 #7
0
void CivilianAI::AI_STATE_Special1()
{
	MC_FaceTarget();
	Metacmd--;

	switch(Metacmd)
	{
		case 1:		MC_Talk();			break;
		case 2:		ComputeState();		break;
	}

	return;
}
예제 #8
0
void DeathShroud::AI_STATE_AttackFar()
{
	DFLOAT fHeight = (DFLOAT)fabs(m_vTargetPos.y - m_MoveObj.GetPos().y);

	//SCHLEGZ 4/22/98 4:51:21 PM: sanity check
	if(m_hTarget == DNULL && m_nCurMetacmd != MC_FIRE_STAND)
	{
		if(fHeight <= m_vDims.y)
			SetNewState(STATE_SearchVisualTarget);
		else
			ComputeState();

		return;
	}

	m_fStimuli[SIGHT] = VEC_DIST(m_MoveObj.GetPos(),m_vTargetPos);
	
	MC_FaceTarget();
	Metacmd--;

	switch(Metacmd)
	{
		case 1:		MC_Fade(DFALSE);	break;	
		case 2:		if(m_fStimuli[SIGHT] <= (m_fSeeingDist * 0.66) || m_nCurMetacmd == MC_FIRE_STAND
						|| fHeight > m_vDims.y)
					{
						MC_Fire_Stand();
					}
					else
					{
						Metacmd++;
					}

					break;
		case 3:		MC_Fade(DTRUE);		break;
		case 4:		if(m_fStimuli[SIGHT] <= (m_fSeeingDist * 0.33) || fHeight > m_vDims.y)
						Metacmd++;
					else
						MC_Walk();

					break;
		case 5:		ComputeState();		break;
	}

	return;
}
예제 #9
0
파일: Naga.cpp 프로젝트: Arc0re/lithtech
void Naga::AI_STATE_AttackFar()
{
	//SCHLEGZ 4/22/98 4:51:21 PM: sanity check
	if(m_hTarget == DNULL && m_nCurMetacmd != MC_FIRE_STAND)
	{
		SetNewState(STATE_SearchVisualTarget);
		return;
	}

	switch(Metacmd)
	{
		case 1:		MC_FaceTarget();	break;
		case 2:		MC_Fire_Stand();	break;
		case 3:		ComputeState();		break;
	}

	return;
}
예제 #10
0
void CivilianAI::AI_STATE_Escape_Hide()
{
	if(m_hTarget == DNULL)
	{
		ComputeState();
		return;
	}

	MC_FaceTarget();
	Metacmd--;

	switch(Metacmd)
	{
		case 1:		MC_Taunt_Beg();		break;
		case 2:		ComputeState();		break;
	}

	return;
}
예제 #11
0
void OpheliaREV::AI_STATE_AttackFar()
{
	DFLOAT fHeight = (DFLOAT)fabs(m_vTargetPos.y - m_MoveObj.GetPos().y);

	//SCHLEGZ 4/22/98 4:51:21 PM: sanity check
	if(m_hTarget == DNULL)
	{
		if(fHeight <= m_vDims.y)
			SetNewState(STATE_SearchVisualTarget);
		else
			ComputeState();

		return;
	}

	m_fStimuli[SIGHT] = VEC_DIST(m_MoveObj.GetPos(),m_vTargetPos);
	DBOOL bAbove = (m_vTargetPos.y - m_MoveObj.GetPos().y) > 0;
	
	CWeapon* pW = m_InventoryMgr.GetCurrentWeapon();

	if(pW == DNULL)
	{
		SetNewState(STATE_Idle);
		return;
	}

	switch(Metacmd)
	{
		case 1:		MC_FaceTarget();	break;
		case 2:		MC_BestWeapon();	break;
		case 3:		if(m_fStimuli[SIGHT] <= (m_fSeeingDist * 0.75) || m_nCurMetacmd == MC_FIRE_STAND
						|| m_nCurMetacmd == MC_FIRE_CROUCH || fHeight > m_vDims.y)
					{
						if((fHeight > m_vDims.y && !bAbove) || m_nCurMetacmd == MC_FIRE_CROUCH
							|| m_fStimuli[HEALTH] < 0.5f || pW->GetType() == WEAP_SNIPERRIFLE)
						{
							MC_Fire_Crouch();
						}
						else
						{
							MC_Fire_Stand();
						}
					}
					else
						Metacmd++;

					break;
		case 4:		if(m_fStimuli[SIGHT] > (m_fSeeingDist * 0.75))
					{
						MC_FaceTarget();
						Metacmd--;

						if(!IsLedge(m_MoveObj.GetForwardVector()) && fHeight <= m_vDims.y
							&& m_nCurMetacmd != MC_FIRE_CROUCH && pW->GetType() != WEAP_SNIPERRIFLE)
						{
							if(m_nInjuredLeg)
								MC_Walk();
							else
								MC_Fire_Run();
						}
						else
						{
							MC_Fire_Crouch();
						}
					}
					else
						Metacmd++;

					break;
		case 5:		ComputeState();		break;
	}

	return;
}
예제 #12
0
void Prophet::AI_STATE_AttackClose()
{
    DFLOAT fHeight = (DFLOAT)fabs(m_vTargetPos.y - m_MoveObj.GetPos().y);

    //SCHLEGZ 4/22/98 4:51:21 PM: sanity check
    if(m_hTarget == DNULL)
    {
        if(fHeight <= m_vDims.y)
            SetNewState(STATE_SearchVisualTarget);
        else
            ComputeState();

        return;
    }

    m_fStimuli[SIGHT] = VEC_DIST(m_MoveObj.GetPos(),m_vTargetPos);
    DBOOL bAbove = (m_vTargetPos.y - m_MoveObj.GetPos().y) > 0;

    switch(Metacmd)
    {
    case 1:
        MC_FaceTarget();
        break;
    case 2:
        MC_BestWeapon();
        break;
    case 3:
        if(m_fStimuli[SIGHT] <= (m_fSeeingDist * 0.33) || m_nCurMetacmd == MC_FIRE_STAND
                || m_nCurMetacmd == MC_FIRE_CROUCH)
        {
            if(m_nDodgeFlags & FORWARD || m_nDodgeFlags & BACKWARD || m_fStimuli[HEALTH] < 0.5f
                    || m_nCurMetacmd == MC_FIRE_CROUCH || (fHeight > m_vDims.y && !bAbove))
            {
                MC_Fire_Crouch();
            }
            else
            {
                MC_Fire_Stand();
            }
        }
        else
            Metacmd++;

        break;
    case 4:
        if(m_fStimuli[SIGHT] > (m_fSeeingDist * 0.33) && m_fStimuli[SIGHT] < (m_fSeeingDist * 0.5))
        {
            MC_FaceTarget();
            Metacmd--;

            if(!IsLedge(m_MoveObj.GetForwardVector()) && fHeight <= m_vDims.y
                    && m_nCurMetacmd != MC_FIRE_CROUCH)
            {
                if(m_nInjuredLeg)
                    MC_Walk();
                else
                {
                    if(m_nDodgeFlags & FORWARD || m_nDodgeFlags & BACKWARD
                            || m_fStimuli[HEALTH] < 0.5f)
                        MC_Fire_Crawl();
                    else
                        MC_Fire_Run();
                }
            }
            else
            {
                MC_Fire_Crouch();
            }
        }
        else
            Metacmd++;

        break;
    case 5:
        ComputeState();
        break;
    }

    return;
}
예제 #13
0
void GremlinAI::AI_STATE_AttackFar()
{
	//SCHLEGZ 4/22/98 4:51:21 PM: sanity check
	if(m_hTarget == DNULL)
	{
		ComputeState();

		return;
	}

	DFLOAT fHeight = (DFLOAT)fabs(m_vTargetPos.y - m_MoveObj.GetPos().y);
	m_fStimuli[SIGHT] = VEC_DIST(m_MoveObj.GetPos(),m_vTargetPos);
	DBOOL bAbove = (m_vTargetPos.y - m_MoveObj.GetPos().y) > 0;
	
	MC_FaceTarget();
	Metacmd--;
					
	switch(Metacmd)
	{
		case 1:		{
						if (m_nCurMetacmd != MC_TAUNT_BOLD) {
							if (IsRandomChance(40))
							{
								MC_Taunt_Bold();
								Metacmd--;
							}
							else
								Metacmd++;
						}
						else
						{
							if(m_pServerDE->GetModelPlaybackState(m_hObject) & MS_PLAYDONE)	
								Metacmd++;
						}

						break;
					}
		case 2:		if(m_fStimuli[SIGHT] <= (m_fSeeingDist * 0.75) || m_nCurMetacmd == MC_FIRE_STAND 
						|| (bAbove && fHeight > m_vDims.y))
					{
						MC_Fire_Stand();
					}
					else
					{
						if(m_fStimuli[SIGHT] < (m_fSeeingDist * 0.33))
							ComputeState();
						else
							MC_Walk();		
					}
					
					break;
		case 3:		if((m_fStimuli[SIGHT] < (m_fSeeingDist * 0.33)) && m_nCurMetacmd != MC_JUMP)
					{
						ComputeState();
					}
					else if(m_fStimuli[SIGHT] < (m_fSeeingDist * 0.4) || m_nCurMetacmd == MC_JUMP
							|| IsLedge(m_MoveObj.GetForwardVector()))
					{
						MC_Jump();
					} else Metacmd++;

					break;
		default:	ComputeState();					break;
	}

	return;
}