convert line ends
[canaan.git] / prj / cam / src / ai / aigunact.h
blobf8597df045140bd2d5bf9419e4a0155cb443282c
1 /*
2 @Copyright Looking Glass Studios, Inc.
3 1996,1997,1998,1999,2000 Unpublished Work.
4 */
6 //
7 // AI Action - gun attack
8 //
10 #ifndef __AIGUNACT_H
11 #define __AIGUNACT_H
13 #include <aiapiiai.h>
14 #include <aibasact.h>
15 #include <aicblink.h>
16 #include <aiactlch.h>
17 #include <relation.h>
18 #include <simtime.h>
19 #include <gunbase.h>
21 #pragma once
22 #pragma pack(4)
24 ///////////////////////////////////////////////////////////////////////////////
26 // CLASS: cAIGunAction
28 // Attack a target with a gun
31 typedef int eAIGunActionState;
32 enum eAIGunActionState_ {kAIGunActionStart, kAIGunActionBurst, kAIGunActionEnd,};
34 class cAIGunAction : public cAIAction
36 public:
37 cAIGunAction(IAIAbility * pOwner, DWORD data = 0);
39 // Set up action parameters
40 void Set(ObjID target, int subModel = 0, int gunJointID = -1);
42 // One time gun shoot for a proxy in a network game.
43 // Called by cAIShockProxyBehaviorSet
44 static void EnactProxyShootGun(IAI *pAI, void *netmsg);
46 // Update the action
47 STDMETHOD_(eAIResult, Update)();
49 // Start the action
50 STDMETHOD_(eAIResult, Enact)(ulong deltaTime);
52 private:
53 eAIGunActionState m_state;
54 ObjID m_gunID;
55 int m_shotsTaken; // no of shots we have fired
56 sAIGunDesc *m_pAIGunDesc;
57 sBaseGunDesc *m_pBaseGunDesc;
58 tSimTime m_startTime;
59 ObjID m_targetObj;
60 int m_subModel;
61 int m_gunJointID;
63 cAIGunAction(IAI *pAI); // A constructor that is used only internally.
64 void Initialize(); // Initialization used by both constructors
65 void SetState(eAIGunActionState state);
66 void Shoot(void);
67 void BroadcastShoot();
68 BOOL CheckTarget(void);
71 ////////////////////////////////////////
73 inline BOOL cAIGunAction::CheckTarget(void)
75 return (g_pAIAttackLinks->GetSingleLink(m_pAIState->GetID(), m_targetObj) != LINKID_NULL);
78 ////////////////////////////////////////
80 #pragma pack()
82 #endif /* !__AIGUNACT_H */