diff --git a/code/fgame/actor.cpp b/code/fgame/actor.cpp index c1b83300..2c2fd6b6 100644 --- a/code/fgame/actor.cpp +++ b/code/fgame/actor.cpp @@ -2380,243 +2380,272 @@ Event EV_Actor_CuriousOn ); CLASS_DECLARATION(SimpleActor, Actor, "Actor") { - {&EV_Entity_Start, &Actor::EventStart }, - {&EV_Actor_MoveTo, &Actor::MoveTo }, - {&EV_Actor_WalkTo, &Actor::WalkTo }, - {&EV_Actor_RunTo, &Actor::RunTo }, - {&EV_Actor_CrouchTo, &Actor::CrouchTo }, - {&EV_Actor_CrawlTo, &Actor::CrawlTo }, - {&EV_Actor_AimAt, &Actor::AimAt }, - {&EV_Pain, &Actor::EventPain }, - {&EV_Killed, &Actor::EventKilled }, - {&EV_Actor_DeathEmbalm, &Actor::DeathEmbalm }, - {&EV_Actor_Anim, &Actor::PlayAnimation }, - {&EV_Actor_AnimLoop, &Actor::PlayAnimation }, - {&EV_Actor_Anim_Scripted, &Actor::PlayScriptedAnimation }, - {&EV_Actor_Anim_Noclip, &Actor::PlayNoclipAnimation }, - {&EV_Actor_AnimScript, &Actor::EventAnimScript }, - {&EV_Actor_AnimScript_Scripted, &Actor::EventAnimScript_Scripted }, - {&EV_Actor_AnimScript_Noclip, &Actor::EventAnimScript_Noclip }, - {&EV_Actor_Reload_mg42, &Actor::EventReload_mg42 }, - {&EV_Actor_Dumb, &Actor::Dumb }, - {&EV_Actor_Physics_On, &Actor::PhysicsOn }, - {&EV_Actor_Physics_Off, &Actor::PhysicsOff }, - {&EV_Actor_SetAnim, &Actor::EventSetAnim }, - {&EV_Actor_SetAnimLength, &SimpleActor::EventSetAnimLength }, - {&EV_Actor_EndActionAnim, &Actor::EventEndActionAnim }, - {&EV_Actor_SetMotionAnim, &Actor::EventSetMotionAnim }, - {&EV_Actor_SetAimMotionAnim, &Actor::EventSetAimMotionAnim }, - {&EV_Actor_SetActionAnim, &Actor::EventSetActionAnim }, - {&EV_Actor_UpperAnim, &Actor::EventUpperAnim }, - {&EV_Actor_SetUpperAnim, &Actor::EventSetUpperAnim }, - {&EV_Actor_SetCrossblendTime, &SimpleActor::EventSetCrossblendTime }, - {&EV_Actor_GetCrossblendTime, &SimpleActor::EventGetCrossblendTime }, - {&EV_Actor_GetPosition, &SimpleActor::EventGetPosition }, - {&EV_Actor_SetPosition, &SimpleActor::EventSetPosition }, - {&EV_Actor_SetEmotion, &SimpleActor::EventSetEmotion }, - {&EV_Actor_SetAnimFinal, &SimpleActor::EventSetAnimFinal }, - {&EV_Actor_GetWeaponType, &SimpleActor::EventGetWeaponType }, - {&EV_Actor_GetWeaponGroup, &SimpleActor::EventGetWeaponGroup }, - {&EV_Actor_LookAt, &Actor::EventLookAt }, - {&EV_Actor_EyesLookAt, &Actor::EventEyesLookAt }, - {&EV_Actor_PointAt, &Actor::EventPointAt }, - {&EV_Actor_TurnTo, &Actor::EventTurnTo }, - {&EV_Actor_SetTurnDoneError, &Actor::EventSetTurnDoneError }, - {&EV_Actor_SetTurnDoneError2, &Actor::EventSetTurnDoneError }, - {&EV_Actor_GetTurnDoneError, &Actor::EventGetTurnDoneError }, - {&EV_Actor_IdleSayAnim, &Actor::EventIdleSayAnim }, - {&EV_Actor_SayAnim, &Actor::EventSayAnim }, - {&EV_Actor_SetSayAnim, &Actor::EventSetSayAnim }, - {&EV_Sentient_UseItem, &Actor::EventGiveWeapon }, - {&EV_Sentient_GiveWeapon, &Actor::EventGiveWeapon }, - {&EV_Actor_SetWeapon, &Actor::EventGiveWeapon }, - {&EV_Actor_GetWeapon, &Actor::EventGetWeapon }, - {&EV_Actor_SetGun, &Actor::EventGiveWeapon }, - {&EV_Actor_SetGun2, &Actor::EventGiveWeapon }, - {&EV_Actor_GetGun, &Actor::EventGetWeapon }, - {&EV_Actor_WeaponInternal, &Actor::EventGiveWeaponInternal }, - {&EV_Actor_DamagePuff, &Actor::EventDamagePuff }, - {&EV_Actor_SetAngleYawSpeed, &Actor::EventSetAngleYawSpeed }, - {&EV_Actor_SetAngleYawSpeed2, &Actor::EventSetAngleYawSpeed }, - {&EV_Actor_GetAngleYawSpeed, &Actor::EventGetAngleYawSpeed }, - {&EV_Actor_SetAimTarget, &Actor::EventSetAimTarget }, - {&EV_Actor_ReadyToFire, &Actor::ReadyToFire }, - {&EV_Actor_AIOn, &SimpleActor::EventAIOn }, - {&EV_Actor_AIOff, &SimpleActor::EventAIOff }, - {&EV_DeathSinkStart, &Actor::DeathSinkStart }, - {&EV_Actor_GetSight, &Actor::EventGetSight }, - {&EV_Actor_SetSight, &Actor::EventSetSight }, - {&EV_Actor_SetSight2, &Actor::EventSetSight }, - {&EV_Actor_GetHearing, &Actor::EventGetHearing }, - {&EV_Actor_SetHearing, &Actor::EventSetHearing }, - {&EV_Actor_SetHearing2, &Actor::EventSetHearing }, - {&EV_Actor_SetFov, &Actor::EventSetFov }, - {&EV_Actor_SetFov2, &Actor::EventSetFov }, - {&EV_Actor_GetFov, &Actor::EventGetFov }, - {&EV_Actor_DistToEnemy, &Actor::EventDistToEnemy }, - {&EV_Actor_SetPatrolPath, &Actor::EventSetPatrolPath }, - {&EV_Actor_SetPatrolPath2, &Actor::EventSetPatrolPath }, - {&EV_Actor_GetPatrolPath, &Actor::EventGetPatrolPath }, - {&EV_Actor_SetPatrolWaitTrigger, &Actor::EventSetPatrolWaitTrigger }, - {&EV_Actor_SetPatrolWaitTrigger2, &Actor::EventSetPatrolWaitTrigger }, - {&EV_Actor_GetPatrolWaitTrigger, &Actor::EventGetPatrolWaitTrigger }, - {&EV_Actor_SetAccuracy, &Actor::EventSetAccuracy }, - {&EV_Actor_SetAccuracy2, &Actor::EventSetAccuracy }, - {&EV_Actor_GetAccuracy, &Actor::EventGetAccuracy }, - {&EV_Actor_SetTypeIdle, &Actor::EventSetTypeIdle }, - {&EV_Actor_SetTypeIdle2, &Actor::EventSetTypeIdle }, - {&EV_Actor_GetTypeIdle, &Actor::EventGetTypeIdle }, - {&EV_Actor_SetTypeAttack, &Actor::EventSetTypeAttack }, - {&EV_Actor_SetTypeAttack2, &Actor::EventSetTypeAttack }, - {&EV_Actor_GetTypeAttack, &Actor::EventGetTypeAttack }, - {&EV_Actor_SetTypeDisguise, &Actor::EventSetTypeDisguise }, - {&EV_Actor_SetTypeDisguise2, &Actor::EventSetTypeDisguise }, - {&EV_Actor_GetTypeDisguise, &Actor::EventGetTypeDisguise }, - {&EV_Actor_SetDisguiseLevel, &Actor::EventSetDisguiseLevel }, - {&EV_Actor_SetDisguiseLevel2, &Actor::EventSetDisguiseLevel }, - {&EV_Actor_GetDisguiseLevel, &Actor::EventGetDisguiseLevel }, - {&EV_Actor_SetTypeGrenade, &Actor::EventSetTypeGrenade }, - {&EV_Actor_SetTypeGrenade2, &Actor::EventSetTypeGrenade }, - {&EV_Actor_GetTypeGrenade, &Actor::EventGetTypeGrenade }, - {&EV_Actor_SetMinDistance, &Actor::EventSetMinDistance }, - {&EV_Actor_SetMinDistance2, &Actor::EventSetMinDistance }, - {&EV_Actor_GetMinDistance, &Actor::EventGetMinDistance }, - {&EV_Actor_SetMaxDistance, &Actor::EventSetMaxDistance }, - {&EV_Actor_SetMaxDistance2, &Actor::EventSetMaxDistance }, - {&EV_Actor_GetMaxDistance, &Actor::EventGetMaxDistance }, - {&EV_Actor_GetLeash, &Actor::EventGetLeash }, - {&EV_Actor_SetLeash, &Actor::EventSetLeash }, - {&EV_Actor_SetLeash2, &Actor::EventSetLeash }, - {&EV_Actor_GetInterval, &Actor::EventGetInterval }, - {&EV_Actor_SetInterval, &Actor::EventSetInterval }, - {&EV_Actor_SetInterval2, &Actor::EventSetInterval }, - {&EV_Actor_GetRunAnim, &Actor::EventGetRunAnim }, - {&EV_Actor_GetWalkAnim, &Actor::EventGetWalkAnim }, - {&EV_Actor_GetAnimName, &Actor::EventGetAnimName }, - {&EV_Actor_SetAnimName, &Actor::EventSetAnimName }, - {&EV_Actor_SetDisguiseRange, &Actor::EventSetDisguiseRange }, - {&EV_Actor_SetDisguiseRange2, &Actor::EventSetDisguiseRange }, - {&EV_Actor_GetDisguiseRange, &Actor::EventGetDisguiseRange }, - {&EV_Actor_SetDisguisePeriod, &Actor::EventSetDisguisePeriod }, - {&EV_Actor_SetDisguisePeriod2, &Actor::EventSetDisguisePeriod }, - {&EV_Actor_GetDisguisePeriod, &Actor::EventGetDisguisePeriod }, - {&EV_Actor_SetDisguiseAcceptThread, &Actor::EventSetDisguiseAcceptThread }, - {&EV_Actor_SetDisguiseAcceptThread2, &Actor::EventSetDisguiseAcceptThread }, - {&EV_Actor_GetDisguiseAcceptThread, &Actor::EventGetDisguiseAcceptThread }, - {&EV_Actor_AttackPlayer, &Actor::EventAttackPlayer }, - {&EV_Actor_SetAlarmNode, &Actor::EventSetAlarmNode }, - {&EV_Actor_SetAlarmNode2, &Actor::EventSetAlarmNode }, - {&EV_Actor_GetAlarmNode, &Actor::EventGetAlarmNode }, - {&EV_Actor_SetAlarmThread, &Actor::EventSetAlarmThread }, - {&EV_Actor_SetAlarmThread2, &Actor::EventSetAlarmThread }, - {&EV_Actor_GetAlarmThread, &Actor::EventGetAlarmThread }, - {&EV_Actor_SetSoundAwareness, &Actor::EventSetSoundAwareness }, - {&EV_Actor_SetSoundAwareness2, &Actor::EventSetSoundAwareness }, - {&EV_Actor_GetSoundAwareness, &Actor::EventGetSoundAwareness }, - {&EV_Actor_SetGrenadeAwareness, &Actor::EventSetGrenadeAwareness }, - {&EV_Actor_SetGrenadeAwareness2, &Actor::EventSetGrenadeAwareness }, - {&EV_Actor_GetGrenadeAwareness, &Actor::EventGetGrenadeAwareness }, - {&EV_Actor_SetTurret, &Actor::EventSetTurret }, - {&EV_Actor_SetTurret2, &Actor::EventSetTurret }, - {&EV_Actor_GetTurret, &Actor::EventGetTurret }, - {&EV_Actor_AttachGrenade, &Actor::Grenade_EventAttach }, - {&EV_Actor_DetachGrenade, &Actor::Grenade_EventDetach }, - {&EV_Actor_FireGrenade, &Actor::Grenade_EventFire }, - {&EV_Actor_EnableEnemy, &Actor::EventEnableEnemy }, - {&EV_Actor_EnablePain, &Actor::EventEnablePain }, - {&EV_Activate, &Actor::EventActivate }, - {&EV_Actor_GetAmmoGrenade, &Actor::EventGetAmmoGrenade }, - {&EV_Actor_SetAmmoGrenade, &Actor::EventSetAmmoGrenade }, - {&EV_Actor_SetAmmoGrenade2, &Actor::EventSetAmmoGrenade }, - {&EV_Actor_GetMood, &Actor::EventGetMood }, - {&EV_Actor_SetMood, &Actor::EventSetMood }, - {&EV_Actor_ShareEnemy, &Actor::EventShareEnemy }, - {&EV_Actor_ShareGrenade, &Actor::EventShareGrenade }, - {&EV_Actor_InterruptPoint, &Actor::EventInterruptPoint }, - {&EV_Actor_GetPainHandler, &SimpleActor::EventGetPainHandler }, - {&EV_Actor_SetPainHandler, &SimpleActor::EventSetPainHandler }, - {&EV_Actor_GetDeathHandler, &SimpleActor::EventGetDeathHandler }, - {&EV_Actor_SetDeathHandler, &SimpleActor::EventSetDeathHandler }, - {&EV_Actor_GetAttackHandler, &SimpleActor::EventGetAttackHandler }, - {&EV_Actor_SetAttackHandler, &SimpleActor::EventSetAttackHandler }, - {&EV_Actor_SetHeadModel, &Actor::EventSetHeadModel }, - {&EV_Actor_GetHeadModel, &Actor::EventGetHeadModel }, - {&EV_Actor_SetHeadSkin, &Actor::EventSetHeadSkin }, - {&EV_Actor_GetHeadSkin, &Actor::EventGetHeadSkin }, - {&EV_Actor_SetNoIdle, &Actor::EventSetNoIdle }, - {&EV_Actor_GetNoIdle, &Actor::EventGetNoIdle }, - {&EV_Actor_GetEnemy, &Actor::EventGetEnemy }, - {&EV_Actor_GetMaxNoticeTimeScale, &Actor::EventGetMaxNoticeTimeScale }, - {&EV_Actor_SetMaxNoticeTimeScale, &Actor::EventSetMaxNoticeTimeScale }, - {&EV_Actor_SetMaxNoticeTimeScale2, &Actor::EventSetMaxNoticeTimeScale }, - {&EV_Actor_GetFixedLeash, &Actor::EventGetFixedLeash }, - {&EV_Actor_SetFixedLeash, &Actor::EventSetFixedLeash }, - {&EV_Actor_SetFixedLeash2, &Actor::EventSetFixedLeash }, - {&EV_Actor_Holster, &Actor::EventHolster }, - {&EV_Actor_Unholster, &Actor::EventUnholster }, - {&EV_SoundDone, &Actor::EventSoundDone }, - {&EV_Sound, &Actor::EventSound }, - {&EV_Actor_IsEnemyVisible, &Actor::EventIsEnemyVisible }, - {&EV_Actor_GetEnemyVisibleChangeTime, &Actor::EventGetEnemyVisibleChangeTime}, - {&EV_Actor_GetLastEnemyVisibleTime, &Actor::EventGetLastEnemyVisibleTime }, - {&EV_Actor_SetFallHeight, &Actor::EventSetFallHeight }, - {&EV_Actor_GetFallHeight, &Actor::EventGetFallHeight }, - {&EV_Actor_CanMoveTo, &Actor::EventCanMoveTo }, - {&EV_Actor_MoveDir, &Actor::EventMoveDir }, - {&EV_Actor_IntervalDir, &Actor::EventIntervalDir }, - {&EV_Actor_ResetLeash, &Actor::EventResetLeash }, - {&EV_Actor_Tether, &Actor::EventTether }, - {&EV_Actor_GetThinkState, &Actor::EventGetThinkState }, - {&EV_Actor_GetEnemyShareRange, &Actor::EventGetEnemyShareRange }, - {&EV_Actor_SetEnemyShareRange, &Actor::EventSetEnemyShareRange }, - {&EV_Actor_SetEnemyShareRange2, &Actor::EventSetEnemyShareRange }, - {&EV_Actor_GetVoiceType, &Actor::GetVoiceType }, - {&EV_Actor_SetVoiceType, &Actor::SetVoiceType }, - {&EV_Actor_SetVoiceType2, &Actor::SetVoiceType }, - {&EV_Remove, &Actor::Remove }, - {&EV_Delete, &Actor::Remove }, - {&EV_ScriptRemove, &Actor::Remove }, - {&EV_Actor_KickDir, &Actor::EventGetKickDir }, - {&EV_Actor_GetNoLongPain, &Actor::EventGetNoLongPain }, - {&EV_Actor_SetNoLongPain, &Actor::EventSetNoLongPain }, - {&EV_Actor_SetNoLongPain2, &Actor::EventSetNoLongPain }, - {&EV_Actor_GetFavoriteEnemy, &Actor::EventGetFavoriteEnemy }, - {&EV_Actor_SetFavoriteEnemy, &Actor::EventSetFavoriteEnemy }, - {&EV_Actor_SetFavoriteEnemy2, &Actor::EventSetFavoriteEnemy }, - {&EV_Actor_GetMumble, &Actor::EventGetMumble }, - {&EV_Actor_SetMumble, &Actor::EventSetMumble }, - {&EV_Actor_SetMumble2, &Actor::EventSetMumble }, - {&EV_Actor_GetBreathSteam, &Actor::EventGetBreathSteam }, - {&EV_Actor_SetBreathSteam, &Actor::EventSetBreathSteam }, - {&EV_Actor_SetBreathSteam2, &Actor::EventSetBreathSteam }, - {&EV_Actor_CalcGrenadeToss, &Actor::EventCalcGrenadeToss }, - {&EV_Actor_GetNoSurprise, &Actor::EventGetNoSurprise }, - {&EV_Actor_SetNoSurprise, &Actor::EventSetNoSurprise }, - {&EV_Actor_SetNoSurprise2, &Actor::EventSetNoSurprise }, - {&EV_Actor_GetSilent, &Actor::EventGetSilent }, - {&EV_Actor_SetSilent, &Actor::EventSetSilent }, - {&EV_Actor_SetSilent2, &Actor::EventSetSilent }, - {&EV_Actor_GetAvoidPlayer, &Actor::EventGetAvoidPlayer }, - {&EV_Actor_SetAvoidPlayer, &Actor::EventSetAvoidPlayer }, - {&EV_Actor_SetAvoidPlayer2, &Actor::EventSetAvoidPlayer }, - {&EV_Actor_SetMoveDoneRadius, &Actor::EventSetMoveDoneRadius }, - {&EV_Actor_BeDead, &Actor::EventBeDead }, - {&EV_Actor_GetLookAroundAngle, &Actor::EventGetLookAroundAngle }, - {&EV_Actor_SetLookAroundAngle, &Actor::EventSetLookAroundAngle }, - {&EV_Actor_SetLookAroundAngle2, &Actor::EventSetLookAroundAngle }, - {&EV_Actor_HasCompleteLookahead, &Actor::EventHasCompleteLookahead }, - {&EV_Actor_PathDist, &Actor::EventPathDist }, - {&EV_Actor_CanShootEnemyFrom, &Actor::EventCanShootEnemyFrom }, - {&EV_Actor_CanShoot, &Actor::EventCanShoot }, - {&EV_Actor_GetInReload, &Actor::EventGetInReload }, - {&EV_Actor_SetInReload, &Actor::EventSetInReload }, - {&EV_Actor_SetReloadCover, &Actor::EventSetReloadCover }, - {&EV_Actor_BreakSpecial, &Actor::EventBreakSpecial }, - {&EV_Actor_SetBalconyHeight, &Actor::EventSetBalconyHeight }, - {&EV_Actor_SetBalconyHeight2, &Actor::EventSetBalconyHeight }, - {&EV_Actor_GetBalconyHeight, &Actor::EventGetBalconyHeight }, - {&EV_CanSee, &Actor::CanSee }, - {NULL, NULL } + {&EV_Entity_Start, &Actor::EventStart }, + {&EV_Actor_MoveTo, &Actor::MoveTo }, + {&EV_Actor_WalkTo, &Actor::WalkTo }, + {&EV_Actor_RunTo, &Actor::RunTo }, + {&EV_Actor_CrouchTo, &Actor::CrouchTo }, + {&EV_Actor_CrawlTo, &Actor::CrawlTo }, + {&EV_Actor_AimAt, &Actor::AimAt }, + {&EV_Pain, &Actor::EventPain }, + {&EV_Killed, &Actor::EventKilled }, + {&EV_Actor_DeathEmbalm, &Actor::DeathEmbalm }, + {&EV_Actor_Anim, &Actor::PlayAnimation }, + {&EV_Actor_AnimLoop, &Actor::PlayAnimation }, + {&EV_Actor_Anim_Scripted, &Actor::PlayScriptedAnimation }, + {&EV_Actor_Anim_Noclip, &Actor::PlayNoclipAnimation }, + {&EV_Actor_Anim_Attached, &Actor::PlayAttachedAnimation }, + {&EV_Actor_AnimScript, &Actor::EventAnimScript }, + {&EV_Actor_AnimScript_Scripted, &Actor::EventAnimScript_Scripted }, + {&EV_Actor_AnimScript_Noclip, &Actor::EventAnimScript_Noclip }, + {&EV_Actor_AnimScript_Attached, &Actor::EventAnimScript_Attached }, + {&EV_Actor_Reload_mg42, &Actor::EventReload_mg42 }, + {&EV_Actor_Dumb, &Actor::Dumb }, + {&EV_Actor_Physics_On, &Actor::PhysicsOn }, + {&EV_Actor_Physics_Off, &Actor::PhysicsOff }, + {&EV_Actor_SetAnim, &Actor::EventSetAnim }, + {&EV_Actor_SetAnimLength, &SimpleActor::EventSetAnimLength }, + {&EV_Actor_EndActionAnim, &Actor::EventEndActionAnim }, + {&EV_Actor_SetMotionAnim, &Actor::EventSetMotionAnim }, + {&EV_Actor_SetAimMotionAnim, &Actor::EventSetAimMotionAnim }, + {&EV_Actor_SetActionAnim, &Actor::EventSetActionAnim }, + {&EV_Actor_UpperAnim, &Actor::EventUpperAnim }, + {&EV_Actor_SetUpperAnim, &Actor::EventSetUpperAnim }, + {&EV_Actor_SetCrossblendTime, &SimpleActor::EventSetCrossblendTime }, + {&EV_Actor_GetCrossblendTime, &SimpleActor::EventGetCrossblendTime }, + {&EV_Actor_GetPosition, &SimpleActor::EventGetPosition }, + {&EV_Actor_SetPosition, &SimpleActor::EventSetPosition }, + {&EV_Actor_SetEmotion, &SimpleActor::EventSetEmotion }, + {&EV_Actor_SetAnimFinal, &SimpleActor::EventSetAnimFinal }, + {&EV_Actor_GetWeaponType, &SimpleActor::EventGetWeaponType }, + {&EV_Actor_GetWeaponGroup, &SimpleActor::EventGetWeaponGroup }, + {&EV_Actor_LookAt, &Actor::EventLookAt }, + {&EV_Actor_EyesLookAt, &Actor::EventEyesLookAt }, + {&EV_Actor_PointAt, &Actor::EventPointAt }, + {&EV_Actor_TurnTo, &Actor::EventTurnTo }, + {&EV_Actor_SetTurnDoneError, &Actor::EventSetTurnDoneError }, + {&EV_Actor_SetTurnDoneError2, &Actor::EventSetTurnDoneError }, + {&EV_Actor_GetTurnDoneError, &Actor::EventGetTurnDoneError }, + {&EV_Actor_IdleSayAnim, &Actor::EventIdleSayAnim }, + {&EV_Actor_SayAnim, &Actor::EventSayAnim }, + {&EV_Actor_SetSayAnim, &Actor::EventSetSayAnim }, + {&EV_Sentient_UseItem, &Actor::EventGiveWeapon }, + {&EV_Sentient_GiveWeapon, &Actor::EventGiveWeapon }, + {&EV_Actor_SetWeapon, &Actor::EventGiveWeapon }, + {&EV_Actor_GetWeapon, &Actor::EventGetWeapon }, + {&EV_Actor_SetGun, &Actor::EventGiveWeapon }, + {&EV_Actor_SetGun2, &Actor::EventGiveWeapon }, + {&EV_Actor_GetGun, &Actor::EventGetWeapon }, + {&EV_Actor_WeaponInternal, &Actor::EventGiveWeaponInternal }, + {&EV_Actor_DamagePuff, &Actor::EventDamagePuff }, + {&EV_Actor_SetAngleYawSpeed, &Actor::EventSetAngleYawSpeed }, + {&EV_Actor_SetAngleYawSpeed2, &Actor::EventSetAngleYawSpeed }, + {&EV_Actor_GetAngleYawSpeed, &Actor::EventGetAngleYawSpeed }, + {&EV_Actor_SetAimTarget, &Actor::EventSetAimTarget }, + {&EV_Actor_ReadyToFire, &Actor::ReadyToFire }, + {&EV_Actor_AIOn, &SimpleActor::EventAIOn }, + {&EV_Actor_AIOff, &SimpleActor::EventAIOff }, + {&EV_DeathSinkStart, &Actor::DeathSinkStart }, + {&EV_Actor_GetSight, &Actor::EventGetSight }, + {&EV_Actor_SetSight, &Actor::EventSetSight }, + {&EV_Actor_SetSight2, &Actor::EventSetSight }, + {&EV_Actor_GetHearing, &Actor::EventGetHearing }, + {&EV_Actor_SetHearing, &Actor::EventSetHearing }, + {&EV_Actor_SetHearing2, &Actor::EventSetHearing }, + {&EV_Actor_SetFov, &Actor::EventSetFov }, + {&EV_Actor_SetFov2, &Actor::EventSetFov }, + {&EV_Actor_GetFov, &Actor::EventGetFov }, + {&EV_Actor_DistToEnemy, &Actor::EventDistToEnemy }, + {&EV_Actor_SetPatrolPath, &Actor::EventSetPatrolPath }, + {&EV_Actor_SetPatrolPath2, &Actor::EventSetPatrolPath }, + {&EV_Actor_GetPatrolPath, &Actor::EventGetPatrolPath }, + {&EV_Actor_SetPatrolWaitTrigger, &Actor::EventSetPatrolWaitTrigger }, + {&EV_Actor_SetPatrolWaitTrigger2, &Actor::EventSetPatrolWaitTrigger }, + {&EV_Actor_GetPatrolWaitTrigger, &Actor::EventGetPatrolWaitTrigger }, + {&EV_Actor_SetAccuracy, &Actor::EventSetAccuracy }, + {&EV_Actor_SetAccuracy2, &Actor::EventSetAccuracy }, + {&EV_Actor_GetAccuracy, &Actor::EventGetAccuracy }, + {&EV_Actor_SetTypeIdle, &Actor::EventSetTypeIdle }, + {&EV_Actor_SetTypeIdle2, &Actor::EventSetTypeIdle }, + {&EV_Actor_GetTypeIdle, &Actor::EventGetTypeIdle }, + {&EV_Actor_SetTypeAttack, &Actor::EventSetTypeAttack }, + {&EV_Actor_SetTypeAttack2, &Actor::EventSetTypeAttack }, + {&EV_Actor_GetTypeAttack, &Actor::EventGetTypeAttack }, + {&EV_Actor_SetTypeDisguise, &Actor::EventSetTypeDisguise }, + {&EV_Actor_SetTypeDisguise2, &Actor::EventSetTypeDisguise }, + {&EV_Actor_GetTypeDisguise, &Actor::EventGetTypeDisguise }, + {&EV_Actor_SetDisguiseLevel, &Actor::EventSetDisguiseLevel }, + {&EV_Actor_SetDisguiseLevel2, &Actor::EventSetDisguiseLevel }, + {&EV_Actor_GetDisguiseLevel, &Actor::EventGetDisguiseLevel }, + {&EV_Actor_SetTypeGrenade, &Actor::EventSetTypeGrenade }, + {&EV_Actor_SetTypeGrenade2, &Actor::EventSetTypeGrenade }, + {&EV_Actor_GetTypeGrenade, &Actor::EventGetTypeGrenade }, + {&EV_Actor_SetMinDistance, &Actor::EventSetMinDistance }, + {&EV_Actor_SetMinDistance2, &Actor::EventSetMinDistance }, + {&EV_Actor_GetMinDistance, &Actor::EventGetMinDistance }, + {&EV_Actor_SetMaxDistance, &Actor::EventSetMaxDistance }, + {&EV_Actor_SetMaxDistance2, &Actor::EventSetMaxDistance }, + {&EV_Actor_GetMaxDistance, &Actor::EventGetMaxDistance }, + {&EV_Actor_GetLeash, &Actor::EventGetLeash }, + {&EV_Actor_SetLeash, &Actor::EventSetLeash }, + {&EV_Actor_SetLeash2, &Actor::EventSetLeash }, + {&EV_Actor_GetInterval, &Actor::EventGetInterval }, + {&EV_Actor_SetInterval, &Actor::EventSetInterval }, + {&EV_Actor_SetInterval2, &Actor::EventSetInterval }, + {&EV_Actor_GetRunAnim, &Actor::EventGetRunAnim }, + {&EV_Actor_GetWalkAnim, &Actor::EventGetWalkAnim }, + {&EV_Actor_GetAnimName, &Actor::EventGetAnimName }, + {&EV_Actor_SetAnimName, &Actor::EventSetAnimName }, + {&EV_Actor_SetDisguiseRange, &Actor::EventSetDisguiseRange }, + {&EV_Actor_SetDisguiseRange2, &Actor::EventSetDisguiseRange }, + {&EV_Actor_GetDisguiseRange, &Actor::EventGetDisguiseRange }, + {&EV_Actor_SetDisguisePeriod, &Actor::EventSetDisguisePeriod }, + {&EV_Actor_SetDisguisePeriod2, &Actor::EventSetDisguisePeriod }, + {&EV_Actor_GetDisguisePeriod, &Actor::EventGetDisguisePeriod }, + {&EV_Actor_SetDisguiseAcceptThread, &Actor::EventSetDisguiseAcceptThread }, + {&EV_Actor_SetDisguiseAcceptThread2, &Actor::EventSetDisguiseAcceptThread }, + {&EV_Actor_GetDisguiseAcceptThread, &Actor::EventGetDisguiseAcceptThread }, + {&EV_Actor_AttackPlayer, &Actor::EventAttackPlayer }, + {&EV_Actor_SetAlarmNode, &Actor::EventSetAlarmNode }, + {&EV_Actor_SetAlarmNode2, &Actor::EventSetAlarmNode }, + {&EV_Actor_GetAlarmNode, &Actor::EventGetAlarmNode }, + {&EV_Actor_SetPreAlarmThread, &Actor::EventSetPreAlarmThread }, + {&EV_Actor_SetPreAlarmThread2, &Actor::EventSetPreAlarmThread }, + {&EV_Actor_SetAlarmThread, &Actor::EventSetAlarmThread }, + {&EV_Actor_SetAlarmThread2, &Actor::EventSetAlarmThread }, + {&EV_Actor_GetAlarmThread, &Actor::EventGetAlarmThread }, + {&EV_Actor_SetSoundAwareness, &Actor::EventSetSoundAwareness }, + {&EV_Actor_SetSoundAwareness2, &Actor::EventSetSoundAwareness }, + {&EV_Actor_GetSoundAwareness, &Actor::EventGetSoundAwareness }, + {&EV_Actor_SetGrenadeAwareness, &Actor::EventSetGrenadeAwareness }, + {&EV_Actor_SetGrenadeAwareness2, &Actor::EventSetGrenadeAwareness }, + {&EV_Actor_GetGrenadeAwareness, &Actor::EventGetGrenadeAwareness }, + {&EV_Actor_SetTurret, &Actor::EventSetTurret }, + {&EV_Actor_SetTurret2, &Actor::EventSetTurret }, + {&EV_Actor_GetTurret, &Actor::EventGetTurret }, + {&EV_Actor_AttachGrenade, &Actor::Grenade_EventAttach }, + {&EV_Actor_DetachGrenade, &Actor::Grenade_EventDetach }, + {&EV_Actor_FireGrenade, &Actor::Grenade_EventFire }, + {&EV_Actor_EnableEnemy, &Actor::EventEnableEnemy }, + {&EV_Actor_EnablePain, &Actor::EventEnablePain }, + {&EV_Activate, &Actor::EventActivate }, + {&EV_Actor_GetAmmoGrenade, &Actor::EventGetAmmoGrenade }, + {&EV_Actor_SetAmmoGrenade, &Actor::EventSetAmmoGrenade }, + {&EV_Actor_SetAmmoGrenade2, &Actor::EventSetAmmoGrenade }, + {&EV_Actor_GetMood, &Actor::EventGetMood }, + {&EV_Actor_SetMood, &Actor::EventSetMood }, + {&EV_Actor_ShareEnemy, &Actor::EventShareEnemy }, + {&EV_Actor_ShareGrenade, &Actor::EventShareGrenade }, + {&EV_Actor_InterruptPoint, &Actor::EventInterruptPoint }, + {&EV_Actor_GetVisibilityThreshold, &Actor::EventGetVisibilityThreshold }, + {&EV_Actor_SetVisibilityThreshold, &Actor::EventSetVisibilityThreshold }, + {&EV_Actor_SetVisibilityThreshold2, &Actor::EventSetVisibilityThreshold }, + {&EV_Actor_SetDefaultVisibilityThreshold, &Actor::EventSetDefaultVisibilityThreshold }, + {&EV_Actor_GetSuppressChance, &Actor::EventGetSuppressChance }, + {&EV_Actor_SetSuppressChance, &Actor::EventSetSuppressChance }, + {&EV_Actor_SetSuppressChance2, &Actor::EventSetSuppressChance }, + {&EV_Actor_GetPainHandler, &Actor::EventGetPainHandler }, + {&EV_Actor_SetPainHandler, &Actor::EventSetPainHandler }, + {&EV_Actor_GetDeathHandler, &Actor::EventGetDeathHandler }, + {&EV_Actor_SetDeathHandler, &Actor::EventSetDeathHandler }, + {&EV_Actor_GetAttackHandler, &Actor::EventGetAttackHandler }, + {&EV_Actor_SetAttackHandler, &Actor::EventSetAttackHandler }, + {&EV_Actor_SetHeadModel, &Actor::EventSetHeadModel }, + {&EV_Actor_GetHeadModel, &Actor::EventGetHeadModel }, + {&EV_Actor_SetHeadSkin, &Actor::EventSetHeadSkin }, + {&EV_Actor_GetHeadSkin, &Actor::EventGetHeadSkin }, + {&EV_Actor_SetNoIdle, &Actor::EventSetNoIdle }, + {&EV_Actor_GetNoIdle, &Actor::EventGetNoIdle }, + {&EV_Actor_GetEnemy, &Actor::EventGetEnemy }, + {&EV_Actor_GetMaxNoticeTimeScale, &Actor::EventGetMaxNoticeTimeScale }, + {&EV_Actor_SetMaxNoticeTimeScale, &Actor::EventSetMaxNoticeTimeScale }, + {&EV_Actor_SetMaxNoticeTimeScale2, &Actor::EventSetMaxNoticeTimeScale }, + {&EV_Actor_GetFixedLeash, &Actor::EventGetFixedLeash }, + {&EV_Actor_SetFixedLeash, &Actor::EventSetFixedLeash }, + {&EV_Actor_SetFixedLeash2, &Actor::EventSetFixedLeash }, + {&EV_Actor_Holster, &Actor::EventHolster }, + {&EV_Actor_Unholster, &Actor::EventUnholster }, + {&EV_SoundDone, &Actor::EventSoundDone }, + {&EV_Sound, &Actor::EventSound }, + {&EV_Actor_IsEnemyVisible, &Actor::EventIsEnemyVisible }, + {&EV_Actor_GetEnemyVisibleChangeTime, &Actor::EventGetEnemyVisibleChangeTime }, + {&EV_Actor_GetLastEnemyVisibleTime, &Actor::EventGetLastEnemyVisibleTime }, + {&EV_Actor_SetFallHeight, &Actor::EventSetFallHeight }, + {&EV_Actor_GetFallHeight, &Actor::EventGetFallHeight }, + {&EV_Actor_CanMoveTo, &Actor::EventCanMoveTo }, + {&EV_Actor_MoveDir, &Actor::EventMoveDir }, + {&EV_Actor_IntervalDir, &Actor::EventIntervalDir }, + {&EV_Actor_ResetLeash, &Actor::EventResetLeash }, + {&EV_Actor_Tether, &Actor::EventTether }, + {&EV_Actor_GetThinkState, &Actor::EventGetThinkState }, + {&EV_Actor_GetEnemyShareRange, &Actor::EventGetEnemyShareRange }, + {&EV_Actor_SetEnemyShareRange, &Actor::EventSetEnemyShareRange }, + {&EV_Actor_SetEnemyShareRange2, &Actor::EventSetEnemyShareRange }, + {&EV_Actor_GetVoiceType, &Actor::GetVoiceType }, + {&EV_Actor_SetVoiceType, &Actor::SetVoiceType }, + {&EV_Actor_SetVoiceType2, &Actor::SetVoiceType }, + {&EV_Remove, &Actor::Remove }, + {&EV_Delete, &Actor::Remove }, + {&EV_ScriptRemove, &Actor::Remove }, + {&EV_Actor_KickDir, &Actor::EventGetKickDir }, + {&EV_Actor_GetNoLongPain, &Actor::EventGetNoLongPain }, + {&EV_Actor_SetNoLongPain, &Actor::EventSetNoLongPain }, + {&EV_Actor_SetNoLongPain2, &Actor::EventSetNoLongPain }, + {&EV_Actor_GetFavoriteEnemy, &Actor::EventGetFavoriteEnemy }, + {&EV_Actor_SetFavoriteEnemy, &Actor::EventSetFavoriteEnemy }, + {&EV_Actor_SetFavoriteEnemy2, &Actor::EventSetFavoriteEnemy }, + {&EV_Actor_GetMumble, &Actor::EventGetMumble }, + {&EV_Actor_SetMumble, &Actor::EventSetMumble }, + {&EV_Actor_SetMumble2, &Actor::EventSetMumble }, + // FIXME: removed since 2.0? + //{&EV_Actor_GetBreathSteam, &Actor::EventGetBreathSteam }, + //{&EV_Actor_SetBreathSteam, &Actor::EventSetBreathSteam }, + //{&EV_Actor_SetBreathSteam2, &Actor::EventSetBreathSteam }, + {&EV_Actor_CalcGrenadeToss, &Actor::EventCalcGrenadeToss }, + {&EV_Actor_CalcGrenadeToss2, &Actor::EventCalcGrenadeToss }, + {&EV_Actor_GetNoSurprise, &Actor::EventGetNoSurprise }, + {&EV_Actor_SetNoSurprise, &Actor::EventSetNoSurprise }, + {&EV_Actor_SetNoSurprise2, &Actor::EventSetNoSurprise }, + {&EV_Actor_GetSilent, &Actor::EventGetSilent }, + {&EV_Actor_SetSilent, &Actor::EventSetSilent }, + {&EV_Actor_SetSilent2, &Actor::EventSetSilent }, + {&EV_Actor_GetAvoidPlayer, &Actor::EventGetAvoidPlayer }, + {&EV_Actor_SetAvoidPlayer, &Actor::EventSetAvoidPlayer }, + {&EV_Actor_SetAvoidPlayer2, &Actor::EventSetAvoidPlayer }, + {&EV_Actor_SetMoveDoneRadius, &Actor::EventSetMoveDoneRadius }, + {&EV_Actor_GetMoveDoneRadius, &Actor::EventGetMoveDoneRadius }, + {&EV_Actor_BeDead, &Actor::EventBeDead }, + {&EV_Actor_GetLookAroundAngle, &Actor::EventGetLookAroundAngle }, + {&EV_Actor_SetLookAroundAngle, &Actor::EventSetLookAroundAngle }, + {&EV_Actor_SetLookAroundAngle2, &Actor::EventSetLookAroundAngle }, + {&EV_Actor_HasCompleteLookahead, &Actor::EventHasCompleteLookahead }, + {&EV_Actor_PathDist, &Actor::EventPathDist }, + {&EV_Actor_CanShootEnemyFrom, &Actor::EventCanShootEnemyFrom }, + {&EV_Actor_CanShoot, &Actor::EventCanShoot }, + {&EV_Actor_GetInReload, &Actor::EventGetInReload }, + {&EV_Actor_SetInReload, &Actor::EventSetInReload }, + {&EV_Actor_SetReloadCover, &Actor::EventSetReloadCover }, + {&EV_Actor_BreakSpecial, &Actor::EventBreakSpecial }, + {&EV_Actor_SetBalconyHeight, &Actor::EventSetBalconyHeight }, + {&EV_Actor_SetBalconyHeight2, &Actor::EventSetBalconyHeight }, + {&EV_Actor_GetBalconyHeight, &Actor::EventGetBalconyHeight }, + {&EV_Actor_SetIgnoreBadPlace, &Actor::EventSetIgnoreBadPlace }, + {&EV_Actor_SetIgnoreBadPlace2, &Actor::EventSetIgnoreBadPlace }, + {&EV_Actor_GetIgnoreBadPlace, &Actor::EventGetIgnoreBadPlace }, + {&EV_Actor_FindEnemy, &Actor::EventFindEnemy }, + {&EV_Actor_EnableEnemySwitch, &Actor::EventEnableEnemySwitch }, + {&EV_Actor_DisableEnemySwitch, &Actor::EventDisableEnemySwitch }, + {&EV_Actor_SetRunAnimRate, &Actor::EventSetRunAnimRate }, + {&EV_Actor_SetRunAnimRate2, &Actor::EventSetRunAnimRate }, + {&EV_Actor_GetRunAnimRate, &Actor::EventGetRunAnimRate }, + {&EV_Stop, &Actor::Landed }, + {&EV_Actor_SetNationality, &Actor::SetNationality }, + {&EV_Actor_SetNationality2, &Actor::SetNationality }, + {&EV_Actor_GetNationality, &Actor::GetNationality }, + {&EV_Actor_WriteStats, &Actor::EventWriteStats }, + {&EV_Actor_CuriousOff, &Actor::EventCuriousOff }, + {&EV_Actor_CuriousOn, &Actor::EventCuriousOn }, + {NULL, NULL } }; Actor::GlobalFuncs_t Actor::GlobalFuncs[NUM_THINKS]; @@ -4374,6 +4403,31 @@ bool Actor::CanSee(Entity *e1, float fov, float vision_distance, bool bNoEnts) return canSee; } +/* +=============== +Actor::InFOV + +Returns true if positin is within fov. +=============== +*/ +bool Actor::InFOV(Vector pos, float check_fov, float check_fovdot) +{ + bool bInFov = true; + if (check_fov != 360.0) { + Vector delta = pos - EyePosition(); + if (delta.x == 0 && delta.y == 0) { + return bInFov; + } + bInFov = false; + + float fDot = DotProduct2D(delta, orientation[0]); + if (fDot >= 0) { + bInFov = Square(fDot) > delta.lengthXYSquared() * Square(check_fovdot); + } + } + return bInFov; +} + /* =============== Actor::CanShoot @@ -4507,70 +4561,16 @@ bool Actor::CanShootEnemy(int iMaxDirtyTime) return m_bCanShootEnemy; } -/* -=============== -Actor::TransitionState - -=============== -*/ -void Actor::TransitionState(int iNewState, int iPadTime) +bool Actor::FriendlyInLineOfFire(Entity *other) { - //fixme: this is an inline function. - m_State = iNewState; - m_iStateTime = level.inttime + iPadTime; + // FIXME: unimplemented + return false; } -/* -=============== -Actor::CanSee - -Returns true to script if actor cansee entity. -=============== -*/ -void Actor::CanSee(Event *ev) +Vector Actor::VirtualEyePosition() { - float fov = 0; - float vision_distance = 0; - - if (m_Think[m_ThinkLevel] != THINK_MACHINEGUNNER || !m_pTurret) { - return Entity::CanSee(ev); - } - switch (ev->NumArgs()) { - case 1: - { - //do nothing - } - break; - case 2: - { - fov = ev->GetFloat(2); - if (fov < 0 || fov > 360) { - ScriptError("fov must be in range 0 <= fov <= 360"); - } - } - break; - case 3: - { - vision_distance = ev->GetFloat(3); - if (vision_distance < 0) { - ScriptError("vision distance must be >= 0"); - } - } - break; - default: - { - ScriptError("cansee should have 1, 2, or 3 arguments"); - } - break; - } - - Entity *ent = ev->GetEntity(1); - if (!ent) { - ScriptError("NULL entity in parameter 1"); - } else { - int cansee = MachineGunner_CanSee(ent, fov, vision_distance); - ev->AddInteger(cansee); - } + // FIXME: unimplemented + return Vector(); } /* @@ -4606,66 +4606,6 @@ bool Actor::IsDogState(int state) return true; } -/* -=============== -Actor::IgnoreSoundSet - -Make actor ignore iType sound. -=============== -*/ -void Actor::IgnoreSoundSet(int iType) -{ - m_iIgnoreSoundsMask |= 1 << iType; -} - -/* -=============== -Actor::IgnoreSoundSetAll - -Make actor ignore all types of sound. -=============== -*/ -void Actor::IgnoreSoundSetAll(void) -{ - m_iIgnoreSoundsMask = ~AI_EVENT_NONE; -} - -/* -=============== -Actor::IgnoreSoundClear - -Don't ignore iType of sound. -=============== -*/ -void Actor::IgnoreSoundClear(int iType) -{ - m_iIgnoreSoundsMask &= ~iType; -} - -/* -=============== -Actor::IgnoreSoundClearAll - -Make actor ignore no type of sound. -=============== -*/ -void Actor::IgnoreSoundClearAll(void) -{ - m_iIgnoreSoundsMask = 0; -} - -/* -=============== -Actor::IgnoreSoundClearAll - -returns true if actor should ignore iType of sound. -=============== -*/ -bool Actor::IgnoreSound(int iType) -{ - return (m_iIgnoreSoundsMask >> iType) & 1; -} - /* =============== Actor::WithinVisionDistance @@ -4693,91 +4633,6 @@ bool Actor::WithinVisionDistance(Entity *ent) const return false; } -/* -=============== -Actor::InFOV - -Returns true if positin is within fov. -=============== -*/ -bool Actor::InFOV(Vector pos, float check_fov, float check_fovdot) -{ - bool bInFov = true; - if (check_fov != 360.0) { - Vector delta = pos - EyePosition(); - if (delta.x == 0 && delta.y == 0) { - return bInFov; - } - bInFov = false; - - float fDot = DotProduct2D(delta, orientation[0]); - if (fDot >= 0) { - bInFov = Square(fDot) > delta.lengthXYSquared() * Square(check_fovdot); - } - } - return bInFov; -} - -/* -=============== -Actor::InFOV - -Returns true if pos is within fov. -=============== -*/ -bool Actor::InFOV(Vector pos) -{ - return InFOV(pos, m_fFov, m_fFovDot); -} - -/* -=============== -Actor::InFOV - -Returns true if ent is within fov. -=============== -*/ -bool Actor::InFOV(Entity *ent) -{ - if (ent == m_Enemy) { - return EnemyInFOV(0); - } else { - return InFOV(ent->centroid, m_fFov, m_fFovDot); - } -} - -bool Actor::CanSeeNoFOV(Entity *ent) -{ - if (ent == m_Enemy) { - return CanSeeEnemy(0); - } else { - bool bCanSee = false; - if (gi.AreasConnected(edict->r.areanum, ent->edict->r.areanum)) { - bCanSee = CanSeeFrom(EyePosition(), ent); - } - return bCanSee; - } -} - -bool Actor::CanSeeFOV(Entity *ent) -{ - //fixme: this is an inline function. - if (ent == m_Enemy) { - return CanSeeEnemyFOV(0, 0); - } else { - bool bCanSee = false; - if (InFOV(ent->centroid, m_fFov, m_fFovDot) && gi.AreasConnected(edict->r.areanum, ent->edict->r.areanum)) { - bCanSee = CanSeeFrom(EyePosition(), ent); - } - return bCanSee; - } -} - -bool Actor::CanSeeEnemyFOV(int iMaxFovDirtyTime, int iMaxSightDirtyTime) -{ - return EnemyInFOV(iMaxFovDirtyTime) && CanSeeEnemy(iMaxSightDirtyTime); -} - /* =============== Actor::CanTarget @@ -5906,6 +5761,21 @@ void Actor::PlayNoclipAnimation(Event *ev) ExecuteScript(&e1); } +/* +=============== +Actor::PlayAttachedAnimation + +Play attached animation +=============== +*/ +void Actor::PlayAttachedAnimation(Event *ev) +{ + Event e1(EV_Listener_ExecuteScript); + e1.AddConstString(STRING_GLOBAL_ANIM_ATTACHED_SCR); + e1.AddValue(ev->GetValue(1)); + ExecuteScript(&e1); +} + /* =============== Actor::MoveDest @@ -7115,6 +6985,16 @@ void Actor::UpdateEnemy(int iMaxDirtyTime) } } +/* +=============== +Actor::DetectSmokeGrenades +=============== +*/ +void Actor::DetectSmokeGrenades(void) +{ + // FIXME: unimplemented +} + /* =============== Actor::SetEnemy @@ -8341,6 +8221,15 @@ void Actor::EventGetAlarmNode(Event *ev) ev->AddListener(m_AlarmNode); } +void Actor::EventSetPreAlarmThread(Event *ev) +{ + if (ev->IsFromScript()) { + m_PreAlarmThread.SetThread(ev->GetValue()); + } else { + m_PreAlarmThread.Set(ev->GetString(1)); + } +} + void Actor::EventSetAlarmThread(Event *ev) { if (ev->IsFromScript()) { @@ -8965,6 +8854,22 @@ bool Actor::PassesTransitionConditions_Grenade(void) return false; } +/* +=============== +Actor::PassesTransitionConditions_BadPlace + +Should actor transition think state to bad place? +=============== +*/ +bool Actor::PassesTransitionConditions_BadPlace(void) +{ + if (m_bLockThinkState) { + return false; + } + + return m_iBadPlaceIndex != 0; +} + /* =============== Actor::PassesTransitionConditions_Attack @@ -9764,6 +9669,25 @@ void Actor::SetGrenade(Entity *pGrenade) m_vGrenadePos = pGrenade->origin; } +/* +=============== +Actor::UpdateBadPlaces + +Update bad places, with a new path +=============== +*/ +void Actor::UpdateBadPlaces(void) +{ + m_iBadPlaceIndex = 0; + if (!m_bIgnoreBadPlace) { + if (PathExists()) { + m_Path.ReFindPath(origin, this); + } + + m_iBadPlaceIndex = level.GetNearestBadPlace(origin, 64, 1 << m_Team); + } +} + /* =============== Actor::NotifySquadmateKilled @@ -10626,6 +10550,50 @@ void Actor::EventInterruptPoint(Event *ev) } } +void Actor::EventGetVisibilityThreshold(Event *ev) +{ + ev->AddFloat(m_fVisibilityThreshold); +} + +void Actor::EventSetVisibilityThreshold(Event *ev) +{ + float threshold; + + threshold = ev->GetFloat(1); + + if (threshold < 0 || threshold > 1) { + ScriptError("DefaultNonVisLevel must be in range 0-1"); + } + + m_bHasVisibilityThreshold = true; + m_fVisibilityThreshold = threshold; +} + +void Actor::EventSetDefaultVisibilityThreshold(Event *ev) +{ + float threshold; + + threshold = ev->GetFloat(1); + + if (threshold < 0 || threshold > 1) { + ScriptError("DefaultNonVisLevel must be in range 0-1"); + } + + if (!m_bHasVisibilityThreshold) { + m_fVisibilityThreshold = threshold; + } +} + +void Actor::EventGetSuppressChance(Event *ev) +{ + ev->AddInteger(m_iSuppressChance); +} + +void Actor::EventSetSuppressChance(Event *ev) +{ + // FIXME: unimplemented +} + void Actor::EventAnimScript(Event *ev) { m_bAnimScriptSet = true; @@ -10658,6 +10626,11 @@ void Actor::EventAnimScript_Noclip(Event *ev) SetThinkIdle(THINK_ANIM); } +void Actor::EventAnimScript_Attached(Event *ev) +{ + // FIXME: unimplemented +} + void Actor::EventReload_mg42(Event *ev) { //FIXME: macos/enum @@ -11094,11 +11067,18 @@ void Actor::Holster(void) } } +void Actor::HolsterOffHand(void) +{ + if (activeWeaponList[WEAPON_OFFHAND]) { + DeactivateWeapon(WEAPON_OFFHAND); + } +} + void Actor::Unholster(void) { Weapon *weap; - if (!activeWeaponList[0]) { + if (!activeWeaponList[WEAPON_MAIN]) { weap = GetWeapon(WEAPON_MAIN); if (weap) { useWeapon(weap, WEAPON_MAIN); @@ -11107,6 +11087,19 @@ void Actor::Unholster(void) } } +void Actor::UnholsterOffHand(void) +{ + Weapon *weap; + + if (!activeWeaponList[WEAPON_OFFHAND]) { + weap = GetWeapon(WEAPON_OFFHAND); + if (weap) { + useWeapon(weap, WEAPON_OFFHAND); + ActivateNewWeapon(); + } + } +} + void Actor::EventHolster(Event *ev) { if (activeWeaponList[WEAPON_MAIN]) { @@ -11581,6 +11574,11 @@ bool Actor::IsGrenadeState(int state) return state == THINKSTATE_GRENADE; } +bool Actor::IsBadPlaceState(int state) +{ + return state == THINKSTATE_BADPLACE; +} + bool Actor::IsPainState(int state) { return state == THINKSTATE_PAIN; @@ -11629,6 +11627,15 @@ void Actor::EventSetFavoriteEnemy(Event *ev) m_FavoriteEnemy = fEnemy; } +void Actor::EventFindEnemy(Event *ev) +{ + if (level.inttime > m_iEnemyCheckTime + 200) { + UpdateEnemyInternal(); + } + + ev->AddEntity(m_Enemy); +} + void Actor::EventGetMumble(Event *ev) { ev->AddInteger(m_bMumble); @@ -11639,6 +11646,11 @@ void Actor::EventSetMumble(Event *ev) m_bMumble = ev->GetInteger(1); } +void Actor::EventCalcGrenadeToss2(Event *ev) +{ + // FIXME: unimplemented +} + void Actor::EventCalcGrenadeToss(Event *ev) { //FIXME: macros @@ -11982,6 +11994,11 @@ void Actor::EventSetMoveDoneRadius(Event *ev) m_fMoveDoneRadiusSquared = Square(moveDoneR); } +void Actor::EventGetMoveDoneRadius(Event *ev) +{ + ev->AddFloat(sqrtf(m_fMoveDoneRadiusSquared)); +} + /* =============== Actor::StoppedWaitFor @@ -12063,6 +12080,22 @@ void Actor::EventSetBalconyHeight(Event *ev) m_fBalconyHeight = ev->GetFloat(1); } +void Actor::EventSetIgnoreBadPlace(Event *ev) +{ + if (m_bIgnoreBadPlace != ev->GetBoolean(1)) { + m_bIgnoreBadPlace = ev->GetBoolean(1); + + if (level.m_badPlaces.NumObjects() && m_bIgnoreBadPlace) { + UpdateBadPlaces(); + } + } +} + +void Actor::EventGetIgnoreBadPlace(Event *ev) +{ + ev->AddInteger(m_bIgnoreBadPlace); +} + void Actor::EventGetBalconyHeight(Event *ev) { ev->AddFloat(m_fBalconyHeight); @@ -12098,96 +12131,110 @@ void Actor::AimAtEnemyBehavior(void) /* =============== -Actor::ForwardLook - - +Actor::EventEnableEnemySwitch =============== */ -void Actor::ForwardLook(void) +void Actor::EventEnableEnemySwitch(Event *ev) { - //fixme: this is an inline function. - m_bHasDesiredLookAngles = false; + m_bEnemySwitch = true; } /* =============== -Actor::SetDesiredLookDir - -Change desired look direction. +Actor::EventDisableEnemySwitch =============== */ -void Actor::SetDesiredLookDir(vec3_t dir) +void Actor::EventDisableEnemySwitch(Event *ev) { - m_bHasDesiredLookAngles = true; - vectoangles(dir, m_DesiredLookAngles); - m_DesiredLookAngles[1] = m_DesiredLookAngles[1] - angles[1]; - m_DesiredLookAngles[1] = AngleNormalize180(m_DesiredLookAngles[1]); - m_DesiredLookAngles[0] = AngleNormalize180(m_DesiredLookAngles[0]); + m_bEnemySwitch = false; } /* =============== -Actor::SetDesiredLookAnglesRelative - -Change desired look angles relatively. +Actor::EventSetRunAnimRate =============== */ -void Actor::SetDesiredLookAnglesRelative(vec3_t ang) +void Actor::EventSetRunAnimRate(Event *ev) { - m_bHasDesiredLookAngles = true; - m_DesiredLookAngles[0] = AngleNormalize180(ang[0]); - m_DesiredLookAngles[1] = AngleNormalize180(ang[1]); - m_DesiredLookAngles[2] = AngleNormalize180(ang[2]); + m_fRunAnimRate = ev->GetFloat(1); } /* =============== -Actor::AimAtTargetPos - -Aim at mTargetPos. +Actor::EventGetRunAnimRate =============== */ -void Actor::AimAtTargetPos(void) +void Actor::EventGetRunAnimRate(Event *ev) { - Vector vDir = mTargetPos - EyePosition() + Vector(0, 0, 16); - SetDesiredLookDir(vDir); - m_DesiredGunDir[0] = 360.0f - vDir.toPitch(); - m_DesiredGunDir[1] = vDir.toYaw(); - m_DesiredGunDir[2] = 0; - - SetDesiredYawDir(vDir); + ev->AddFloat(m_fRunAnimRate); } /* =============== -Actor::AimAtAimNode - -Aim at m_aimNode. +Actor::Landed =============== */ -void Actor::AimAtAimNode(void) +void Actor::Landed(Event *ev) { - mTargetPos = m_aimNode->origin; + // FIXME: unimplemented +} - AimAtTargetPos(); +bool Actor::IsOnFloor(void) +{ + // FIXME: unimplemented + return false; } /* =============== -Actor::NextUpdateTime - -Returns next update time. +Actor::GetNationality =============== */ -int Actor::NextUpdateTime(int iLastUpdateTime, int iUpdatePeriod) +void Actor::GetNationality(Event *ev) { - int i = iLastUpdateTime; + // FIXME: unimplemented +} - do { - i += iUpdatePeriod; - } while (i < level.inttime); +/* +=============== +Actor::SetNationality +=============== +*/ +void Actor::SetNationality(Event *ev) +{ + // FIXME: unimplemented +} - return i; +/* +=============== +Actor::EventWriteStats +=============== +*/ +void Actor::EventWriteStats(Event *ev) +{ + if (g_aistats->integer) { + level.OpenActorStats(); + } +} + +/* +=============== +Actor::EventCuriousOff +=============== +*/ +void Actor::EventCuriousOff(Event *ev) +{ + m_bIsCurious = false; +} + +/* +=============== +Actor::EventCuriousOn +=============== +*/ +void Actor::EventCuriousOn(Event *ev) +{ + m_bIsCurious = true; } /* @@ -12589,30 +12636,6 @@ void Actor::UpdateBoneControllers() */ -/* -=============== -Actor::CurrentThink - -Current think. -=============== -*/ -int Actor::CurrentThink(void) const -{ - return m_Think[m_ThinkLevel]; -} - -/* -=============== -Actor::IsAttacking - -Returns true if actor is in attack state. -=============== -*/ -bool Actor::IsAttacking(void) const -{ - return m_ThinkStates[THINKLEVEL_NORMAL] == THINKSTATE_ATTACK; -} - void Actor::EventSetDestIdle(Event *ev) { // not found in ida @@ -12642,13 +12665,13 @@ void Actor::EventSetNextBreathTime(Event *ev) t->Execute(&sVar, 1); } -bool Actor::AvoidingFacingWall(void) const -{ - return m_eDontFaceWallMode <= 8; -} - bool Actor::EnemyIsDisguised(void) { return (m_bEnemyIsDisguised || (m_Enemy && m_Enemy->m_bIsDisguised)) && (!m_bForceAttackPlayer && m_ThinkState != THINKSTATE_ATTACK); } + +bool Actor::IsDisabled() const +{ + return !m_bDoAI; +} diff --git a/code/fgame/actor.h b/code/fgame/actor.h index d6f7b8aa..da39a0b0 100644 --- a/code/fgame/actor.h +++ b/code/fgame/actor.h @@ -329,6 +329,7 @@ enum eThinkState { THINKSTATE_CURIOUS, THINKSTATE_DISGUISE, THINKSTATE_GRENADE, + THINKSTATE_BADPLACE, // Added in 2.0 THINKSTATE_NOCLIP, NUM_THINKSTATES, }; @@ -382,6 +383,8 @@ enum eThinkNum { THINK_WEAPONLESS, THINK_NOCLIP, THINK_DEAD, + THINK_BADPLACE, // Added in 2.0 + THINK_RUN_AND_SHOOT, // Added in 2.30 NUM_THINKS, }; @@ -458,6 +461,10 @@ public: bool m_bAnimating; /* Am I a doggo ? */ bool m_bDog; + /* 2.0: ignore bad place? */ + bool m_bIgnoreBadPlace; + /* 2.0: bad place index? (0=none) */ + int m_iBadPlaceIndex; /* char refereing to voice type, chec gAmericanVoices and gGermanVoices */ int mVoiceType; /* check EV_Actor_GetSilent, EV_Actor_SetSilent and EV_Actor_SetSilent2 */ @@ -488,6 +495,10 @@ public: int m_iEnemyVisibleChangeTime; /* last time a visible(CanSee) enemy was seen */ int m_iLastEnemyVisibleTime; + /* 2.0: visibility alpha */ + float m_fVisibilityAlpha; + /* 2.0: max visibility threshold */ + float m_fVisibilityThreshold; /* last time a visible(CanSee + infov) enemy was checked */ int m_iEnemyFovCheckTime; /* last time a visible(CanSee + infov) enemy was changed */ @@ -500,6 +511,8 @@ public: float m_fMaxShareDistSquared; /* can actor shoot enemy ? */ bool m_bCanShootEnemy; + /* 2.0: does it has visibility threshold set? */ + bool m_bHasVisibilityThreshold; /* last time m_bCanShootEnemy was changed */ int m_iCanShootCheckTime; /* desired enable enemy(changed from script) */ @@ -530,6 +543,8 @@ public: const_str m_csAnimScript; /* anim mode */ int m_AnimMode; + /* 2.0: the run anim rate */ + float m_fRunAnimRate; /* Don't Face Wall request yaw. */ float m_fDfwRequestedYaw; /* Don't Face Wall derived yaw. */ @@ -594,6 +609,10 @@ public: SafePtr m_AlarmNode; /* alarm thread for actor */ ScriptThreadLabel m_AlarmThread; + /* 2.30: pre-alarm thread for actor */ + ScriptThreadLabel m_PreAlarmThread; + /* 2.0: Suppress chance */ + int m_iSuppressChance; /* used for turret actot to run back to home Turret_SelectState() */ int m_iRunHomeTime; /* no cover path for initial turret state */ @@ -612,6 +631,8 @@ public: bool m_bNeedReload; /* should break(stop) special attack ? */ bool mbBreakSpecialAttack; + /* 2.30: is the AI curious? */ + bool m_bIsCurious; /* grenade has bounced ? (usually means actor should flee) */ bool m_bGrenadeBounced; /* current grenade */ @@ -723,6 +744,10 @@ public: float m_fLeashSquared; /* if true, leash will not change. */ bool m_bFixedLeash; + /* 2.0: if true, enemy switch will be disabled. */ + bool m_bEnemySwitch; + /* 2.30: the nationality index. */ + int m_iNationality; public: CLASS_PROTOTYPE(Actor); @@ -751,6 +776,7 @@ public: bool RequireThink(void); void UpdateEnemy(int iMaxDirtyTime); void UpdateEnemyInternal(void); + void DetectSmokeGrenades(void); void SetEnemy(Sentient *pEnemy, bool bForceConfirmed); void SetEnemyPos(Vector vPos); static void ResetBodyQueue(void); @@ -764,6 +790,7 @@ public: void CheckForThinkStateTransition(void); bool CheckForTransition(eThinkState state, eThinkLevel level); bool PassesTransitionConditions_Grenade(void); + bool PassesTransitionConditions_BadPlace(void); // Added in 2.0 bool PassesTransitionConditions_Attack(void); bool PassesTransitionConditions_Disguise(void); bool PassesTransitionConditions_Curious(void); @@ -805,6 +832,8 @@ public: void State_Turret_Grenade(void); void State_Turret_FakeEnemy(void); void State_Turret_Wait(void); + void State_Turret_Retarget_Shoot(void); // Added in 2.0 + void State_Turret_Retarget_Suppress(void); // Added in 2.0 void State_Turret_Retarget_Sniper_Node(void); void State_Turret_Retarget_Step_Side_Small(void); void State_Turret_Retarget_Path_Exact(void); @@ -880,140 +909,159 @@ public: bool CanGetGrenadeFromAToB( const Vector &vFrom, const Vector &vTo, bool bDesperate, Vector *pvVel, eGrenadeTossMode *peMode ); - bool DecideToThrowGrenade(const Vector &vTo, Vector *pvVel, eGrenadeTossMode *peMode); - void Grenade_EventFire(Event *ev); - void GenericGrenadeTossThink(void); - static void InitGrenade(GlobalFuncs_t *func); - bool Grenade_Acquire(eGrenadeState eNextState, const_str csReturnAnim); - void Grenade_Flee(void); - void Grenade_ThrowAcquire(void); - void Grenade_Throw(void); - void Grenade_KickAcquire(void); - void Grenade_Kick(void); - void Grenade_MartyrAcquire(void); - void Grenade_Martyr(void); - void Grenade_Wait(void); - void Grenade_NextThinkState(void); - void Grenade_EventAttach(Event *ev); - void Grenade_EventDetach(Event *ev); - void Begin_Grenade(void); - void End_Grenade(void); - void Resume_Grenade(void); - void Think_Grenade(void); - void FinishedAnimation_Grenade(void); - static void InitCurious(GlobalFuncs_t *func); - void SetCuriousAnimHint(int iAnimHint); - void Begin_Curious(void); - void End_Curious(void); - void Resume_Curious(void); - void Suspend_Curious(void); - void Think_Curious(void); - void FinishedAnimation_Curious(void); - void LookAtCuriosity(void); - void TimeOutCurious(void); - void State_Disguise_Wait(void); - void State_Disguise_Papers(void); - void State_Disguise_Fake_Papers(void); - void State_Disguise_Enemy(void); - void State_Disguise_Halt(void); - void State_Disguise_Accept(void); - void State_Disguise_Deny(void); - static void InitDisguiseSalute(GlobalFuncs_t *func); - void Begin_DisguiseSalute(void); - void End_DisguiseSalute(void); - void Resume_DisguiseSalute(void); - void Suspend_DisguiseSalute(void); - void Think_DisguiseSalute(void); - void FinishedAnimation_DisguiseSalute(void); - static void InitDisguiseSentry(GlobalFuncs_t *func); - void Begin_DisguiseSentry(void); - void End_DisguiseSentry(void); - void Resume_DisguiseSentry(void); - void Suspend_DisguiseSentry(void); - void Think_DisguiseSentry(void); - static void InitDisguiseOfficer(GlobalFuncs_t *func); - void Begin_DisguiseOfficer(void); - void End_DisguiseOfficer(void); - void Resume_DisguiseOfficer(void); - void Suspend_DisguiseOfficer(void); - void Think_DisguiseOfficer(void); - static void InitDisguiseRover(GlobalFuncs_t *func); - void Begin_DisguiseRover(void); - void End_DisguiseRover(void); - void Resume_DisguiseRover(void); - void Suspend_DisguiseRover(void); - void Think_DisguiseRover(void); - static void InitDisguiseNone(GlobalFuncs_t *func); - static void InitIdle(GlobalFuncs_t *func); - void Begin_Idle(void); - void Think_Idle(void); - static void InitMachineGunner(GlobalFuncs_t *func); - void Begin_MachineGunner(void); - void End_MachineGunner(void); - void BecomeTurretGuy(void); - void Think_MachineGunner(void); - void ThinkHoldGun(void); - void FinishedAnimation_MachineGunner(void); - bool MachineGunner_CanSee(Entity *ent, float fov, float vision_distance); - void CanSee(Event *ev); - static void InitDogIdle(GlobalFuncs_t *func); - static void InitDogAttack(GlobalFuncs_t *func); - static void InitDogCurious(GlobalFuncs_t *func); - void Begin_Dog(void); - void End_Dog(void); - void Think_Dog_Idle(void); - void Think_Dog_Attack(void); - void Think_Dog_Curious(void); - static void InitAnim(GlobalFuncs_t *func); - void Begin_Anim(void); - void Think_Anim(void); - void FinishedAnimation_Anim(void); - void ShowInfo_Anim(void); - static void InitAnimCurious(GlobalFuncs_t *func); - void Begin_AnimCurious(void); - void Think_AnimCurious(void); - void FinishedAnimation_AnimCurious(void); - static void InitAim(GlobalFuncs_t *func); - void Begin_Aim(void); - void Think_Aim(void); - void ShowInfo_Aim(void); - static void InitBalconyIdle(GlobalFuncs_t *func); - static void InitBalconyCurious(GlobalFuncs_t *func); - static void InitBalconyAttack(GlobalFuncs_t *func); - static void InitBalconyDisguise(GlobalFuncs_t *func); - static void InitBalconyGrenade(GlobalFuncs_t *func); - static void InitBalconyPain(GlobalFuncs_t *func); - static void InitBalconyKilled(GlobalFuncs_t *func); - void Pain_Balcony(Event *ev); - void Killed_Balcony(Event *ev, bool bPlayDeathAnim); - void Think_BalconyAttack(void); - void Begin_BalconyAttack(void); - void FinishedAnimation_BalconyAttack(void); - void State_Balcony_PostShoot(void); - void State_Balcony_FindEnemy(void); - void State_Balcony_Target(void); - void State_Balcony_Shoot(void); - void Begin_BalconyKilled(void); - void End_BalconyKilled(void); - void Think_BalconyKilled(void); - void FinishedAnimation_BalconyKilled(void); - bool CalcFallPath(void); - static void InitPain(GlobalFuncs_t *func); - void Begin_Pain(void); - void Think_Pain(void); - void FinishedAnimation_Pain(void); - static void InitDead(GlobalFuncs_t *func); - static void InitKilled(GlobalFuncs_t *func); - void Begin_Killed(void); - void Think_Killed(void); - void FinishedAnimation_Killed(void); - static void InitWeaponless(GlobalFuncs_t *func); - void Begin_Weaponless(void); - void Suspend_Weaponless(void); - void Think_Weaponless(void); - void FinishedAnimation_Weaponless(void); - void State_Weaponless_Normal(void); - void State_Weaponless_Grenade(void); + bool DecideToThrowGrenade(const Vector &vTo, Vector *pvVel, eGrenadeTossMode *peMode); + void Grenade_EventFire(Event *ev); + void GenericGrenadeTossThink(void); + static void InitGrenade(GlobalFuncs_t *func); + bool Grenade_Acquire(eGrenadeState eNextState, const_str csReturnAnim); + void Grenade_Flee(void); + void Grenade_ThrowAcquire(void); + void Grenade_Throw(void); + void Grenade_KickAcquire(void); + void Grenade_Kick(void); + void Grenade_MartyrAcquire(void); + void Grenade_Martyr(void); + void Grenade_Wait(void); + void Grenade_NextThinkState(void); + void Grenade_EventAttach(Event *ev); + void Grenade_EventDetach(Event *ev); + void Begin_Grenade(void); + void End_Grenade(void); + void Resume_Grenade(void); + void Think_Grenade(void); + void FinishedAnimation_Grenade(void); + static void InitCurious(GlobalFuncs_t *func); + void SetCuriousAnimHint(int iAnimHint); + void Begin_Curious(void); + void End_Curious(void); + void Resume_Curious(void); + void Suspend_Curious(void); + void Think_Curious(void); + void FinishedAnimation_Curious(void); + void LookAtCuriosity(void); + void TimeOutCurious(void); + void State_Disguise_Wait(void); + void State_Disguise_Papers(void); + void State_Disguise_Fake_Papers(void); + void State_Disguise_Enemy(void); + void State_Disguise_Halt(void); + void State_Disguise_Accept(void); + void State_Disguise_Deny(void); + static void InitDisguiseSalute(GlobalFuncs_t *func); + void Begin_DisguiseSalute(void); + void End_DisguiseSalute(void); + void Resume_DisguiseSalute(void); + void Suspend_DisguiseSalute(void); + void Think_DisguiseSalute(void); + void FinishedAnimation_DisguiseSalute(void); + static void InitDisguiseSentry(GlobalFuncs_t *func); + void Begin_DisguiseSentry(void); + void End_DisguiseSentry(void); + void Resume_DisguiseSentry(void); + void Suspend_DisguiseSentry(void); + void Think_DisguiseSentry(void); + static void InitDisguiseOfficer(GlobalFuncs_t *func); + void Begin_DisguiseOfficer(void); + void End_DisguiseOfficer(void); + void Resume_DisguiseOfficer(void); + void Suspend_DisguiseOfficer(void); + void Think_DisguiseOfficer(void); + static void InitDisguiseRover(GlobalFuncs_t *func); + void Begin_DisguiseRover(void); + void End_DisguiseRover(void); + void Resume_DisguiseRover(void); + void Suspend_DisguiseRover(void); + void Think_DisguiseRover(void); + static void InitDisguiseNone(GlobalFuncs_t *func); + static void InitIdle(GlobalFuncs_t *func); + void Begin_Idle(void); + void Think_Idle(void); + static void InitMachineGunner(GlobalFuncs_t *func); + void Begin_MachineGunner(void); + void End_MachineGunner(void); + void BecomeTurretGuy(void); + void ThinkHoldGun_TurretGun(void); // Added in 2.0 + void Think_MachineGunner_TurretGun(void); // Added in 2.0 + void Think_MachineGunner(void); + void ThinkHoldGun(void); + void FinishedAnimation_MachineGunner(void); + bool MachineGunner_CanSee(Entity *ent, float fov, float vision_distance); + static void InitDogIdle(GlobalFuncs_t *func); + static void InitDogAttack(GlobalFuncs_t *func); + static void InitDogCurious(GlobalFuncs_t *func); + void Begin_Dog(void); + void End_Dog(void); + void Think_Dog_Idle(void); + void Think_Dog_Attack(void); + void Think_Dog_Curious(void); + static void InitAnim(GlobalFuncs_t *func); + void Begin_Anim(void); + void Think_Anim(void); + void FinishedAnimation_Anim(void); + void ShowInfo_Anim(void); + static void InitAnimCurious(GlobalFuncs_t *func); + void Begin_AnimCurious(void); + void Think_AnimCurious(void); + void FinishedAnimation_AnimCurious(void); + static void InitAim(GlobalFuncs_t *func); + void Begin_Aim(void); + void Think_Aim(void); + void ShowInfo_Aim(void); + static void InitBalconyIdle(GlobalFuncs_t *func); + static void InitBalconyCurious(GlobalFuncs_t *func); + static void InitBalconyAttack(GlobalFuncs_t *func); + static void InitBalconyDisguise(GlobalFuncs_t *func); + static void InitBalconyGrenade(GlobalFuncs_t *func); + static void InitBalconyPain(GlobalFuncs_t *func); + static void InitBalconyKilled(GlobalFuncs_t *func); + void Pain_Balcony(Event *ev); + void Killed_Balcony(Event *ev, bool bPlayDeathAnim); + void Think_BalconyAttack(void); + void Begin_BalconyAttack(void); + void FinishedAnimation_BalconyAttack(void); + void State_Balcony_PostShoot(void); + void State_Balcony_FindEnemy(void); + void State_Balcony_Target(void); + void State_Balcony_Shoot(void); + void Begin_BalconyKilled(void); + void End_BalconyKilled(void); + void Think_BalconyKilled(void); + void FinishedAnimation_BalconyKilled(void); + bool CalcFallPath(void); + static void InitPain(GlobalFuncs_t *func); + void Begin_Pain(void); + void Think_Pain(void); + void FinishedAnimation_Pain(void); + static void InitDead(GlobalFuncs_t *func); + static void InitKilled(GlobalFuncs_t *func); + void Begin_Killed(void); + void Think_Killed(void); + void FinishedAnimation_Killed(void); + static void InitWeaponless(GlobalFuncs_t *func); + void Begin_Weaponless(void); + void Suspend_Weaponless(void); + void Think_Weaponless(void); + void FinishedAnimation_Weaponless(void); + void State_Weaponless_Normal(void); + void State_Weaponless_Grenade(void); + static void InitBadPlace(GlobalFuncs_t *func); + // Added in 2.0 + //==== + void Begin_BadPlace(void); + void End_BadPlace(void); + void Think_BadPlace(void); + //==== + // Added in 2.30 + //==== + static void InitRunAndShot(GlobalFuncs_t *func); + void Begin_RunAndShoot(void); + void End_RunAndShoot(void); + void Resume_RunAndShoot(void); + void Think_RunAndShoot(void); + void ShowInfo_RunAndShoot(void); + void State_RunAndShoot_Running(void); + void RunAndShoot_MoveToPatrolCurrentNode(void); + //==== virtual void Think(void) override; void PostThink(bool bDontFaceWall); virtual void SetMoveInfo(mmove_t *mm) override; @@ -1025,6 +1073,8 @@ public: void EventGiveWeapon(Event *ev); void EventGetWeapon(Event *ev); void FireWeapon(Event *ev); + bool FriendlyInLineOfFire(Entity *other); // Added in 2.0 + Vector VirtualEyePosition(); // Added in 2.0 virtual bool CanTarget(void) override; virtual bool IsImmortal(void) override; static bool IsVoidState(int state); @@ -1033,6 +1083,7 @@ public: static bool IsDisguiseState(int state); static bool IsAttackState(int state); static bool IsGrenadeState(int state); + static bool IsBadPlaceState(int state); // Added in 2.0 static bool IsPainState(int state); static bool IsKilledState(int state); static bool IsMachineGunnerState(int state); @@ -1055,195 +1106,207 @@ public: void VoiceSound(int iType, vec3_t sound_origin, float fDistSquared, float fMaxDistSquared, Entity *originator); void GrenadeNotification(Entity *originator); void SetGrenade(Entity *pGrenade); + void UpdateBadPlaces(void); // Added in 2.0 void NotifySquadmateKilled(Sentient *pSquadMate, Sentient *pAttacker); void RaiseAlertnessForEventType(int iType); void RaiseAlertness(float fAmount); - virtual bool CanSee(Entity *e1, float fov, float vision_distance, bool bNoEnts) override; - virtual Vector GunPosition(void) override; - bool WithinVisionDistance(Entity *ent) const; - bool InFOV(Vector pos, float check_fov, float check_fovdot); - bool EnemyInFOV(int iMaxDirtyTime); - bool InFOV(Vector pos); - bool InFOV(Entity *ent); - bool CanSeeNoFOV(Entity *ent); - bool CanSeeFOV(Entity *ent); - bool CanSeeEnemyFOV(int iMaxFovDirtyTime, int iMaxSightDirtyTime); - bool CanShoot(Entity *ent); - virtual bool CanSeeFrom(vec3_t pos, Entity *ent); - bool CanSeeEnemy(int iMaxDirtyTime); - bool CanShootEnemy(int iMaxDirtyTime); - void ShowInfo(void); - virtual void ShowInfo(float fDot, float fDist) override; - void DefaultPain(Event *ev); - void HandlePain(Event *ev); - void EventPain(Event *ev); - void DefaultKilled(Event *ev, bool bPlayDeathAnim); - void HandleKilled(Event *ev, bool bPlayDeathAnim); - void DispatchEventKilled(Event *ev, bool bPlayDeathAnim); - void EventKilled(Event *ev); - void EventBeDead(Event *ev); - void DeathEmbalm(Event *ev); - void DeathSinkStart(Event *ev); - bool NoticeShot(Sentient *pShooter, Sentient *pTarget, float fDist); - bool NoticeFootstep(Sentient *pPedestrian); - bool NoticeVoice(Sentient *pVocallist); - void ClearLookEntity(void); - void LookAt(const Vector &vec); - void LookAt(Listener *l); - void ForwardLook(void); - void LookAtLookEntity(void); - void IdleLook(void); - void IdleLook(vec3_t dir); - void SetDesiredLookDir(vec3_t dir); - void SetDesiredLookAnglesRelative(vec3_t ang); - void EventLookAt(Event *ev); - void EventEyesLookAt(Event *ev); - void NoPoint(void); - void IdlePoint(void); - void ClearPointEntity(void); - void PointAt(const Vector &vec); - void PointAt(Listener *l); - void EventPointAt(Event *ev); - void ClearTurnEntity(void); - void TurnTo(const Vector &vec); - void TurnTo(Listener *l); - void IdleTurn(void); - void EventTurnTo(Event *ev); - void EventSetTurnDoneError(Event *ev); - void EventGetTurnDoneError(Event *ev); - void LookAround(float fFovAdd); - bool SoundSayAnim(const_str name, byte bLevelSayAnim); - void EventSetAnim(Event *ev); - void EventIdleSayAnim(Event *ev); - void EventSayAnim(Event *ev); - void EventSetSayAnim(Event *ev); - void EventSetMotionAnim(Event *ev); - void EventSetAimMotionAnim(Event *ev); - void EventSetActionAnim(Event *ev); - void EventUpperAnim(Event *ev); - void EventSetUpperAnim(Event *ev); - void EventEndActionAnim(Event *ev); - void EventDamagePuff(Event *ev); - void SafeSetOrigin(vec3_t newOrigin); - void DoMove(void); - void AnimFinished(int slot, bool stop); - virtual void AnimFinished(int slot) override; - void PlayAnimation(Event *ev); - void PlayScriptedAnimation(Event *ev); - void PlayNoclipAnimation(Event *ev); - void MoveDest(float fMoveSpeed); - void MovePath(float fMoveSpeed); - void MovePathGoal(float fMoveSpeed); - void Dumb(Event *ev); - void PhysicsOn(Event *ev); - void PhysicsOff(Event *ev); - void EventStart(Event *ev); - void EventGetMood(Event *ev); - void EventSetMood(Event *ev); - void EventGetAngleYawSpeed(Event *ev); - void EventSetAngleYawSpeed(Event *ev); - void EventSetAimTarget(Event *ev); - void UpdateAngles(void); - void SetLeashHome(Vector vHome); - void AimAtTargetPos(void); - void AimAtAimNode(void); - void AimAtEnemyBehavior(void); - void FaceMotion(void); - void FaceDirectionDuringMotion(vec3_t vLook); - float PathDistanceAlongVector(vec3_t vDir); - void FaceEnemyOrMotion(int iTimeIntoMove); - static int NextUpdateTime(int iLastUpdateTime, int iUpdatePeriod); - void ResetBoneControllers(void); - void UpdateBoneControllers(void); - void ReadyToFire(Event *ev); - void EventGetSight(Event *ev); - void EventSetSight(Event *ev); - void EventGetHearing(Event *ev); - void EventSetHearing(Event *ev); - void ClearPatrolCurrentNode(void); - void NextPatrolCurrentNode(void); - void SetPatrolCurrentNode(Vector &vec); - void SetPatrolCurrentNode(Listener *l); - void EventSetPatrolPath(Event *ev); - void EventGetPatrolPath(Event *ev); - void EventSetPatrolWaitTrigger(Event *ev); - void EventGetPatrolWaitTrigger(Event *ev); - void ShowInfo_PatrolCurrentNode(void); - bool MoveOnPathWithSquad(void); - bool MoveToWaypointWithPlayer(void); - bool PatrolNextNodeExists(void); - void UpdatePatrolCurrentNode(void); - bool MoveToPatrolCurrentNode(void); - void ClearAimNode(void); - void SetAimNode(Vector &vec); - void SetAimNode(Listener *l); - void ShowInfo_AimNode(void); - void EventSetAccuracy(Event *ev); - void EventGetAccuracy(Event *ev); - int GetThinkType(const_str csName); - void SetThink(eThinkState state, eThinkNum think); - void SetThinkIdle(eThinkNum think_idle); - void SetThinkState(eThinkState state, eThinkLevel level); - void EndCurrentThinkState(void); - void ClearThinkStates(void); - int CurrentThink(void) const; - bool IsAttacking(void) const; - void EventGetFov(Event *ev); - void EventSetFov(Event *ev); - void EventSetDestIdle(Event *ev); - void EventSetDestIdle2(Event *ev); - void EventSetTypeIdle(Event *ev); - void EventGetTypeIdle(Event *ev); - void EventSetTypeAttack(Event *ev); - void EventGetTypeAttack(Event *ev); - void EventSetTypeDisguise(Event *ev); - void EventGetTypeDisguise(Event *ev); - void EventSetDisguiseLevel(Event *ev); - void EventGetDisguiseLevel(Event *ev); - void EventSetTypeGrenade(Event *ev); - void EventGetTypeGrenade(Event *ev); - void EventSetMinDistance(Event *ev); - void EventGetMinDistance(Event *ev); - void EventSetMaxDistance(Event *ev); - void EventGetMaxDistance(Event *ev); - void EventGetLeash(Event *ev); - void EventSetLeash(Event *ev); - void EventGetInterval(Event *ev); - void EventSetInterval(Event *ev); - void EventDistToEnemy(Event *ev); - void EventGetRunAnim(Event *ev); - void EventGetWalkAnim(Event *ev); - void EventGetAnimName(Event *ev); - void EventSetAnimName(Event *ev); - void EventSetDisguiseRange(Event *ev); - void EventGetDisguiseRange(Event *ev); - void EventSetDisguisePeriod(Event *ev); - void EventGetDisguisePeriod(Event *ev); - void EventSetDisguiseAcceptThread(Event *ev); - void EventGetDisguiseAcceptThread(Event *ev); - void EventAttackPlayer(Event *ev); - void ForceAttackPlayer(void); - void EventSetAlarmNode(Event *ev); - void EventGetAlarmNode(Event *ev); - void EventSetAlarmThread(Event *ev); - void EventGetAlarmThread(Event *ev); - void EventSetSoundAwareness(Event *ev); - void EventGetSoundAwareness(Event *ev); - void EventSetGrenadeAwareness(Event *ev); - void EventGetGrenadeAwareness(Event *ev); - str ThinkName(void) const; - str ThinkStateName(void) const; - void EventSetTurret(Event *ev); - void EventGetTurret(Event *ev); - void EventEnableEnemy(Event *ev); - void EventEnablePain(Event *ev); - void EventActivate(Event *ev); - void EventGetAmmoGrenade(Event *ev); - void EventSetAmmoGrenade(Event *ev); - void EventInterruptPoint(Event *ev); + virtual bool CanSee(Entity *e1, float fov, float vision_distance, bool bNoEnts) override; + virtual Vector GunPosition(void) override; + bool WithinVisionDistance(Entity *ent) const; + bool InFOV(Vector pos, float check_fov, float check_fovdot); + bool EnemyInFOV(int iMaxDirtyTime); + bool InFOV(Vector pos); + bool InFOV(Entity *ent); + bool CanSeeNoFOV(Entity *ent); + bool CanSeeFOV(Entity *ent); + bool CanSeeEnemyFOV(int iMaxFovDirtyTime, int iMaxSightDirtyTime); + bool CanShoot(Entity *ent); + virtual bool CanSeeFrom(vec3_t pos, Entity *ent); + bool CanSeeEnemy(int iMaxDirtyTime); + bool CanShootEnemy(int iMaxDirtyTime); + void ShowInfo(void); + virtual void ShowInfo(float fDot, float fDist) override; + void DefaultPain(Event *ev); + void HandlePain(Event *ev); + void EventPain(Event *ev); + void DefaultKilled(Event *ev, bool bPlayDeathAnim); + void HandleKilled(Event *ev, bool bPlayDeathAnim); + void DispatchEventKilled(Event *ev, bool bPlayDeathAnim); + void EventKilled(Event *ev); + void EventBeDead(Event *ev); + void DeathEmbalm(Event *ev); + void DeathSinkStart(Event *ev); + bool NoticeShot(Sentient *pShooter, Sentient *pTarget, float fDist); + bool NoticeFootstep(Sentient *pPedestrian); + bool NoticeVoice(Sentient *pVocallist); + void ClearLookEntity(void); + void LookAt(const Vector &vec); + void LookAt(Listener *l); + void ForwardLook(void); + void LookAtLookEntity(void); + void IdleLook(void); + void IdleLook(vec3_t dir); + void SetDesiredLookDir(vec3_t dir); + void SetDesiredLookAnglesRelative(vec3_t ang); + void EventLookAt(Event *ev); + void EventEyesLookAt(Event *ev); + void NoPoint(void); + void IdlePoint(void); + void ClearPointEntity(void); + void PointAt(const Vector &vec); + void PointAt(Listener *l); + void EventPointAt(Event *ev); + void ClearTurnEntity(void); + void TurnTo(const Vector &vec); + void TurnTo(Listener *l); + void IdleTurn(void); + void EventTurnTo(Event *ev); + void EventSetTurnDoneError(Event *ev); + void EventGetTurnDoneError(Event *ev); + void LookAround(float fFovAdd); + bool SoundSayAnim(const_str name, byte bLevelSayAnim); + void EventSetAnim(Event *ev); + void EventIdleSayAnim(Event *ev); + void EventSayAnim(Event *ev); + void EventSetSayAnim(Event *ev); + void EventSetMotionAnim(Event *ev); + void EventSetAimMotionAnim(Event *ev); + void EventSetActionAnim(Event *ev); + void EventUpperAnim(Event *ev); + void EventSetUpperAnim(Event *ev); + void EventEndActionAnim(Event *ev); + void EventDamagePuff(Event *ev); + void SafeSetOrigin(vec3_t newOrigin); + void DoMove(void); + void AnimFinished(int slot, bool stop); + virtual void AnimFinished(int slot) override; + void PlayAnimation(Event *ev); + void PlayScriptedAnimation(Event *ev); + void PlayNoclipAnimation(Event *ev); + void PlayAttachedAnimation(Event *ev); // Added in 2.0 + void MoveDest(float fMoveSpeed); + void MovePath(float fMoveSpeed); + void MovePathGoal(float fMoveSpeed); + void Dumb(Event *ev); + void PhysicsOn(Event *ev); + void PhysicsOff(Event *ev); + void EventStart(Event *ev); + void EventGetMood(Event *ev); + void EventSetMood(Event *ev); + void EventGetAngleYawSpeed(Event *ev); + void EventSetAngleYawSpeed(Event *ev); + void EventSetAimTarget(Event *ev); + void UpdateAngles(void); + void SetLeashHome(Vector vHome); + void AimAtTargetPos(void); + void AimAtAimNode(void); + void AimAtEnemyBehavior(void); + void FaceMotion(void); + void FaceDirectionDuringMotion(vec3_t vLook); + float PathDistanceAlongVector(vec3_t vDir); + void FaceEnemyOrMotion(int iTimeIntoMove); + static int NextUpdateTime(int iLastUpdateTime, int iUpdatePeriod); + void ResetBoneControllers(void); + void UpdateBoneControllers(void); + void ReadyToFire(Event *ev); + void EventGetSight(Event *ev); + void EventSetSight(Event *ev); + void EventGetHearing(Event *ev); + void EventSetHearing(Event *ev); + void ClearPatrolCurrentNode(void); + void NextPatrolCurrentNode(void); + void SetPatrolCurrentNode(Vector &vec); + void SetPatrolCurrentNode(Listener *l); + void EventSetPatrolPath(Event *ev); + void EventGetPatrolPath(Event *ev); + void EventSetPatrolWaitTrigger(Event *ev); + void EventGetPatrolWaitTrigger(Event *ev); + void ShowInfo_PatrolCurrentNode(void); + bool MoveOnPathWithSquad(void); + bool MoveToWaypointWithPlayer(void); + bool PatrolNextNodeExists(void); + void UpdatePatrolCurrentNode(void); + bool MoveToPatrolCurrentNode(void); + void ClearAimNode(void); + void SetAimNode(Vector &vec); + void SetAimNode(Listener *l); + void ShowInfo_AimNode(void); + void EventSetAccuracy(Event *ev); + void EventGetAccuracy(Event *ev); + int GetThinkType(const_str csName); + void SetThink(eThinkState state, eThinkNum think); + void SetThinkIdle(eThinkNum think_idle); + void SetThinkState(eThinkState state, eThinkLevel level); + void EndCurrentThinkState(void); + void ClearThinkStates(void); + int CurrentThink(void) const; + bool IsAttacking(void) const; + void EventGetFov(Event *ev); + void EventSetFov(Event *ev); + void EventSetDestIdle(Event *ev); + void EventSetDestIdle2(Event *ev); + void EventSetTypeIdle(Event *ev); + void EventGetTypeIdle(Event *ev); + void EventSetTypeAttack(Event *ev); + void EventGetTypeAttack(Event *ev); + void EventSetTypeDisguise(Event *ev); + void EventGetTypeDisguise(Event *ev); + void EventSetDisguiseLevel(Event *ev); + void EventGetDisguiseLevel(Event *ev); + void EventSetTypeGrenade(Event *ev); + void EventGetTypeGrenade(Event *ev); + void EventSetMinDistance(Event *ev); + void EventGetMinDistance(Event *ev); + void EventSetMaxDistance(Event *ev); + void EventGetMaxDistance(Event *ev); + void EventGetLeash(Event *ev); + void EventSetLeash(Event *ev); + void EventGetInterval(Event *ev); + void EventSetInterval(Event *ev); + void EventDistToEnemy(Event *ev); + void EventGetRunAnim(Event *ev); + void EventGetWalkAnim(Event *ev); + void EventGetAnimName(Event *ev); + void EventSetAnimName(Event *ev); + void EventSetDisguiseRange(Event *ev); + void EventGetDisguiseRange(Event *ev); + void EventSetDisguisePeriod(Event *ev); + void EventGetDisguisePeriod(Event *ev); + void EventSetDisguiseAcceptThread(Event *ev); + void EventGetDisguiseAcceptThread(Event *ev); + void EventAttackPlayer(Event *ev); + void ForceAttackPlayer(void); + void EventSetAlarmNode(Event *ev); + void EventGetAlarmNode(Event *ev); + void EventSetPreAlarmThread(Event *ev); // Added in 2.30 + void EventSetAlarmThread(Event *ev); + void EventGetAlarmThread(Event *ev); + void EventSetSoundAwareness(Event *ev); + void EventGetSoundAwareness(Event *ev); + void EventSetGrenadeAwareness(Event *ev); + void EventGetGrenadeAwareness(Event *ev); + str ThinkName(void) const; + str ThinkStateName(void) const; + void EventSetTurret(Event *ev); + void EventGetTurret(Event *ev); + void EventEnableEnemy(Event *ev); + void EventEnablePain(Event *ev); + void EventActivate(Event *ev); + void EventGetAmmoGrenade(Event *ev); + void EventSetAmmoGrenade(Event *ev); + void EventInterruptPoint(Event *ev); + // Added in 2.0 + //==== + void EventGetVisibilityThreshold(Event *ev); + void EventSetVisibilityThreshold(Event *ev); + void EventSetDefaultVisibilityThreshold(Event *ev); + void EventGetSuppressChance(Event *ev); + void EventSetSuppressChance(Event *ev); + //==== void EventAnimScript(Event *ev); void EventAnimScript_Scripted(Event *ev); void EventAnimScript_Noclip(Event *ev); + void EventAnimScript_Attached(Event *ev); void EventReload_mg42(Event *ev); void SetPathWithLeash(Vector vDestPos, const char *description, int iMaxDirtyTime); void SetPathWithLeash(SimpleEntity *pDestNode, const char *description, int iMaxDirtyTime); @@ -1267,7 +1330,9 @@ public: void EventSetFixedLeash(Event *ev); void EventGetFixedLeash(Event *ev); void Holster(void); + void HolsterOffHand(void); // Added in 2.0 void Unholster(void); + void UnholsterOffHand(void); // Added in 2.0 void EventHolster(Event *ev); void EventUnholster(Event *ev); void EventSoundDone(Event *ev); @@ -1290,11 +1355,13 @@ public: void EventSetNoLongPain(Event *ev); void EventGetFavoriteEnemy(Event *ev); void EventSetFavoriteEnemy(Event *ev); + void EventFindEnemy(Event *ev); // Added in 2.0 void EventGetMumble(Event *ev); void EventSetMumble(Event *ev); void EventGetBreathSteam(Event *ev); void EventSetBreathSteam(Event *ev); void EventSetNextBreathTime(Event *ev); + void EventCalcGrenadeToss2(Event *ev); void EventCalcGrenadeToss(Event *ev); void EventGetNoSurprise(Event *ev); void EventSetNoSurprise(Event *ev); @@ -1317,24 +1384,45 @@ public: void ResolveVoiceType(void); void EventSetBalconyHeight(Event *ev); void EventGetBalconyHeight(Event *ev); - PathNode *FindSniperNodeAndSetPath(bool *pbTryAgain); - void Remove(Event *ev); - void DontFaceWall(void); - bool AvoidingFacingWall(void) const; - void EndStates(void); - void ClearStates(void); - void CheckUnregister(void); - void BecomeCorpse(void); - virtual void PathnodeClaimRevoked(PathNode *node) override; - void SetPathToNotBlockSentient(Sentient *pOther); - void EventSetMoveDoneRadius(Event *ev); - virtual void ClearEnemies(void) override; - bool EnemyIsDisguised(void); - virtual void setOriginEvent(Vector org) override; - virtual void DumpAnimInfo(void) override; - static void ArchiveStatic(Archiver &arc); - virtual void Archive(Archiver &arc) override; - virtual bool AutoArchiveModel(void) override; + // Added in 2.0 + //==== + void EventSetIgnoreBadPlace(Event *ev); + void EventGetIgnoreBadPlace(Event *ev); + void EventEnableEnemySwitch(Event *ev); + void EventDisableEnemySwitch(Event *ev); + void EventSetRunAnimRate(Event *ev); + void EventGetRunAnimRate(Event *ev); + void Landed(Event *ev); + bool IsOnFloor(void); + //==== + // Added in 2.30 + //==== + void GetNationality(Event *ev); + void SetNationality(Event *ev); + void EventWriteStats(Event *ev); + void EventCuriousOff(Event *ev); + void EventCuriousOn(Event *ev); + //==== + PathNode *FindSniperNodeAndSetPath(bool *pbTryAgain); + void Remove(Event *ev); + void DontFaceWall(void); + bool AvoidingFacingWall(void) const; + void EndStates(void); + void ClearStates(void); + void CheckUnregister(void); + void BecomeCorpse(void); + virtual void PathnodeClaimRevoked(PathNode *node) override; + void SetPathToNotBlockSentient(Sentient *pOther); + void EventSetMoveDoneRadius(Event *ev); + void EventGetMoveDoneRadius(Event *ev); // Added in 2.0 + virtual void ClearEnemies(void) override; + bool EnemyIsDisguised(void); + virtual void setOriginEvent(Vector org) override; + virtual void DumpAnimInfo(void) override; + static void ArchiveStatic(Archiver &arc); + virtual void Archive(Archiver& arc) override; + virtual bool AutoArchiveModel(void) override; + virtual bool IsDisabled() const override; // Added in 2.30 }; #define SAVE_FLAG_NEW_ANIM (1 << 0) @@ -1361,6 +1449,213 @@ public: #define SAVE_FLAG_PAIN (1 << 21) #define SAVE_FLAG_SPAWN_ITEMS (1 << 22) +/* +=============== +Actor::TransitionState + +=============== +*/ +inline void Actor::TransitionState(int iNewState, int iPadTime) +{ + //fixme: this is an inline function. + m_State = iNewState; + m_iStateTime = level.inttime + iPadTime; +} + +/* +=============== +Actor::NextUpdateTime + +Returns next update time. +=============== +*/ +inline int Actor::NextUpdateTime(int iLastUpdateTime, int iUpdatePeriod) +{ + int i = iLastUpdateTime; + + do { + i += iUpdatePeriod; + } while (i < level.inttime); + + return i; +} + +/* +=============== +Actor::InFOV + +Returns true if pos is within fov. +=============== +*/ +inline bool Actor::InFOV(Vector pos) +{ + return InFOV(pos, m_fFov, m_fFovDot); +} + +/* +=============== +Actor::InFOV + +Returns true if ent is within fov. +=============== +*/ +inline bool Actor::InFOV(Entity *ent) +{ + if (ent == m_Enemy) { + return EnemyInFOV(0); + } else { + return InFOV(ent->centroid, m_fFov, m_fFovDot); + } +} + +inline bool Actor::CanSeeNoFOV(Entity *ent) +{ + if (ent == m_Enemy) { + return CanSeeEnemy(0); + } else { + bool bCanSee = false; + if (gi.AreasConnected(edict->r.areanum, ent->edict->r.areanum)) { + bCanSee = CanSeeFrom(EyePosition(), ent); + } + return bCanSee; + } +} + +inline bool Actor::CanSeeFOV(Entity *ent) +{ + //fixme: this is an inline function. + if (ent == m_Enemy) { + return CanSeeEnemyFOV(0, 0); + } else { + bool bCanSee = false; + if (InFOV(ent->centroid, m_fFov, m_fFovDot) && gi.AreasConnected(edict->r.areanum, ent->edict->r.areanum)) { + bCanSee = CanSeeFrom(EyePosition(), ent); + } + return bCanSee; + } +} + +inline bool Actor::CanSeeEnemyFOV(int iMaxFovDirtyTime, int iMaxSightDirtyTime) +{ + return EnemyInFOV(iMaxFovDirtyTime) && CanSeeEnemy(iMaxSightDirtyTime); +} + +/* +=============== +Actor::AimAtTargetPos + +Aim at mTargetPos. +=============== +*/ +inline void Actor::AimAtTargetPos(void) +{ + Vector vDir = mTargetPos - EyePosition() + Vector(0, 0, 16); + SetDesiredLookDir(vDir); + m_DesiredGunDir[0] = 360.0f - vDir.toPitch(); + m_DesiredGunDir[1] = vDir.toYaw(); + m_DesiredGunDir[2] = 0; + + SetDesiredYawDir(vDir); +} + +/* +=============== +Actor::AimAtAimNode + +Aim at m_aimNode. +=============== +*/ +inline void Actor::AimAtAimNode(void) +{ + mTargetPos = m_aimNode->origin; + + AimAtTargetPos(); +} + +/* +=============== +Actor::IgnoreSoundSet + +Make actor ignore iType sound. +=============== +*/ +inline void Actor::IgnoreSoundSet(int iType) +{ + m_iIgnoreSoundsMask |= 1 << iType; +} + +/* +=============== +Actor::IgnoreSoundSetAll + +Make actor ignore all types of sound. +=============== +*/ +inline void Actor::IgnoreSoundSetAll(void) +{ + m_iIgnoreSoundsMask = ~AI_EVENT_NONE; +} + +/* +=============== +Actor::IgnoreSoundClear + +Don't ignore iType of sound. +=============== +*/ +inline void Actor::IgnoreSoundClear(int iType) +{ + m_iIgnoreSoundsMask &= ~iType; +} + +/* +=============== +Actor::IgnoreSoundClearAll + +Make actor ignore no type of sound. +=============== +*/ +inline void Actor::IgnoreSoundClearAll(void) +{ + m_iIgnoreSoundsMask = 0; +} + +/* +=============== +Actor::IgnoreSoundClearAll + +returns true if actor should ignore iType of sound. +=============== +*/ +inline bool Actor::IgnoreSound(int iType) +{ + return (m_iIgnoreSoundsMask >> iType) & 1; +} + +/* +=============== +Actor::CurrentThink + +Current think. +=============== +*/ +inline int Actor::CurrentThink(void) const +{ + return m_Think[m_ThinkLevel]; +} + +/* +=============== +Actor::IsAttacking + +Returns true if actor is in attack state. +=============== +*/ +inline bool Actor::IsAttacking(void) const +{ + return m_ThinkStates[THINKLEVEL_NORMAL] == THINKSTATE_ATTACK; +} + inline void Actor::ArchiveStatic(Archiver& arc) { for (int i = MAX_BODYQUEUE - 1; i >= 0; i--) { @@ -1569,6 +1864,54 @@ inline void Actor::Archive(Archiver& arc) setModel(); } +/* +=============== +Actor::SetDesiredLookDir + +Change desired look direction. +=============== +*/ +inline void Actor::SetDesiredLookDir(vec3_t dir) +{ + m_bHasDesiredLookAngles = true; + vectoangles(dir, m_DesiredLookAngles); + m_DesiredLookAngles[1] = m_DesiredLookAngles[1] - angles[1]; + m_DesiredLookAngles[1] = AngleNormalize180(m_DesiredLookAngles[1]); + m_DesiredLookAngles[0] = AngleNormalize180(m_DesiredLookAngles[0]); +} + +/* +=============== +Actor::SetDesiredLookAnglesRelative + +Change desired look angles relatively. +=============== +*/ +inline void Actor::SetDesiredLookAnglesRelative(vec3_t ang) +{ + m_bHasDesiredLookAngles = true; + m_DesiredLookAngles[0] = AngleNormalize180(ang[0]); + m_DesiredLookAngles[1] = AngleNormalize180(ang[1]); + m_DesiredLookAngles[2] = AngleNormalize180(ang[2]); +} + +/* +=============== +Actor::ForwardLook + + +=============== +*/ +inline void Actor::ForwardLook(void) +{ + m_bHasDesiredLookAngles = false; +} + +inline bool Actor::AvoidingFacingWall(void) const +{ + return m_eDontFaceWallMode <= 8; +} + #if 0 // Set destination to node with duck or cover set. Class will find a path to that node, or a closer one. diff --git a/code/fgame/actor_machinegunner.cpp b/code/fgame/actor_machinegunner.cpp index 4b7586d1..1da2ed10 100644 --- a/code/fgame/actor_machinegunner.cpp +++ b/code/fgame/actor_machinegunner.cpp @@ -91,6 +91,16 @@ void Actor::End_MachineGunner(void) } } +void Actor::ThinkHoldGun_TurretGun(void) +{ + // FIXME: unimplemented +} + +void Actor::Think_MachineGunner_TurretGun(void) +{ + // FIXME: unimplemented +} + void Actor::Think_MachineGunner(void) { if (RequireThink()) { diff --git a/code/fgame/actor_turret.cpp b/code/fgame/actor_turret.cpp index 94edba2c..5c7ae78b 100644 --- a/code/fgame/actor_turret.cpp +++ b/code/fgame/actor_turret.cpp @@ -726,6 +726,16 @@ void Actor::State_Turret_Wait(void) } } +void Actor::State_Turret_Retarget_Shoot(void) +{ + // FIXME: unimplemented +} + +void Actor::State_Turret_Retarget_Suppress(void) +{ + // FIXME: unimplemented +} + void Actor::State_Turret_Retarget_Sniper_Node(void) { PathNode *pSniperNode;