1 /*-----------------Patrick 15/1/97---------------------
2   This header file supports	both the object visibility
3   management source, and pickup/inanimate objects....
4   -----------------------------------------------------*/
5 
6 #ifndef _pvisible_h_
7 	#define _pvisible_h_ 1
8 
9 	#ifdef __cplusplus
10 		extern "C" {
11 	#endif
12 
13   	/* this enum defines the different inanimate object types ... */
14 	typedef enum inanimateobject_type
15 	{
16 		IOT_Non=-1,
17 		IOT_Static=0,
18 		IOT_Furniture,
19 		IOT_Weapon,
20 		IOT_Ammo,
21 		IOT_Health,
22 		IOT_Armour,
23 		IOT_Key,
24 		IOT_BoxedSentryGun,
25 		IOT_IRGoggles,
26 		IOT_ReservedForJohn,
27 		IOT_DataTape,
28 	    IOT_MTrackerUpgrade,
29 		IOT_PheromonePod,
30 		IOT_SpecialPickupObject,
31 		IOT_HitMeAndIllDestroyBase,
32 		IOT_FieldCharge,
33 	} INANIMATEOBJECT_TYPE;
34 
35 
36 	/* this structure defines the datablock for pickup objects:
37 	weapons, armour, etc, and is also used for inanimate objects
38 	such as chairs, which are functionally quite similar
39 	(except that they can't be picked up, obviously) */
40 
41 	typedef struct inan_frag
42 	{
43 		int ShapeIndex;
44 		int NumFrags;
45 	} INAN_FRAG;
46 
47 	#define ObjectEventFlag_Destroyed 0x00000001
48 	#define ObjectEventFlag_PickedUp  0x00000002
49 
50 	typedef struct object_event_target
51 	{
52 		int triggering_event;
53 		int request;
54 		char event_target_ID[SB_NAME_LENGTH];
55 		STRATEGYBLOCK* event_target_sbptr;
56  	}OBJECT_EVENT_TARGET;
57 
58 	typedef struct inanimateobjectstatusblock
59 	{
60 		INANIMATEOBJECT_TYPE typeId;
61 		int subType; /* weapon id, security level or other relevant enumerated type... */
62 		BOOL Indestructable;
63 		int respawnTimer;
64 		int lifespanTimer;//for dropped weapons in multiplayer that time out
65 		int startingHealth;
66 		int startingArmour;
67 
68 		TXACTRLBLK *inan_tac;//for objects with anims on them
69 
70 		OBJECT_EVENT_TARGET* event_target;//another strategy can be notified when this object is destroyed or picked up
71 
72 		int explosionType;//non zero for explosive objects
73 		int explosionTimer; //slight time delay after destruction for explosion
74 		int explosionStartFrame; //frame that explosion started
75 
76 		INAN_FRAG * fragments;
77 		int num_frags;
78 		unsigned int ghosted_object:1;
79 
80 	} INANIMATEOBJECT_STATUSBLOCK;
81 
82 	/* tools interface */
83 	typedef struct tools_data_inanimateobject
84 	{
85 		struct vectorch position;
86 		struct euler orientation;
87 		INANIMATEOBJECT_TYPE typeId;
88 		int subType; /* weapon id, security level or other relevant enumerated type... */
89 		int shapeIndex;	/* for john */
90 		char nameID[SB_NAME_LENGTH];
91 
92 		int mass; // Kilos??
93 		int integrity; // 0-20 (>20 = indestructable)
94 
95 		int triggering_event;
96 		int event_request;
97 		char event_target_ID[SB_NAME_LENGTH];
98 
99 		int explosionType;
100 
101 		INAN_FRAG * fragments;
102 		int num_frags;
103 	} TOOLS_DATA_INANIMATEOBJECT;
104 
105 	#define DEFAULT_OBJECT_INTEGRITY (100)
106 	#define NO_OF_FRAGMENTS_FROM_OBJECT (6)
107 	#define OBJECT_RESPAWN_TIME (ONE_FIXED*40)
108 
109 	#define OBJECT_RESPAWN_NO_RESPAWN 0x7fffffff
110 
111 
112 	/*--------------------------------------------
113 	  Prototypes
114 	  --------------------------------------------*/
115 	void InitObjectVisibilities(void);
116 	void DoObjectVisibilities(void);
117 	MODULE* ModuleFromPosition(VECTORCH *position, MODULE* startingModule);
118 	void DoObjectVisibility(STRATEGYBLOCK *sbPtr);
119  	void InitInanimateObject(void* bhdata, STRATEGYBLOCK *sbPtr);
120 	void InanimateObjectBehaviour(STRATEGYBLOCK *sbPtr);
121 	void InanimateObjectIsDamaged(STRATEGYBLOCK *sbPtr, DAMAGE_PROFILE *damage, int multiple);
122 	void KillInanimateObjectForRespawn(STRATEGYBLOCK *sbPtr);
123 	void SendRequestToInanimateObject(STRATEGYBLOCK* sbptr,BOOL state,int extended_data);
124 
125 	void MakeObjectNear(STRATEGYBLOCK *sbPtr);
126 	void MakeObjectFar(STRATEGYBLOCK *sbPtr);
127 	/* KJL 14:34:25 24/05/98 - does what it says */
128 	void RespawnAllObjects(void);
129 
130 	void RespawnAllPickups(void);
131 	/*--------------------------------------------------
132 	  An external global that I need to make gun flashes
133 	  --------------------------------------------------*/
134 	extern MODULEMAPBLOCK VisibilityDefaultObjectMap;
135 
136 	STRATEGYBLOCK* CreateMultiplayerWeaponPickup(VECTORCH* location,int type,char* name);
137 	void MakePlayersWeaponPickupVisible();
138 	#ifdef __cplusplus
139 		}
140 	#endif
141 #endif
142