2 ===========================================================================
5 Copyright (C) 1999-2011 id Software LLC, a ZeniMax Media company.
7 This file is part of the Doom 3 GPL Source Code (?Doom 3 Source Code?).
9 Doom 3 Source Code is free software: you can redistribute it and/or modify
10 it under the terms of the GNU General Public License as published by
11 the Free Software Foundation, either version 3 of the License, or
12 (at your option) any later version.
14 Doom 3 Source Code is distributed in the hope that it will be useful,
15 but WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 GNU General Public License for more details.
19 You should have received a copy of the GNU General Public License
20 along with Doom 3 Source Code. If not, see <http://www.gnu.org/licenses/>.
22 In addition, the Doom 3 Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 Source Code. If not, please request a copy in writing from id Software at the address below.
24 If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.
26 ===========================================================================
29 #ifndef __GAME_ITEM_H__
30 #define __GAME_ITEM_H__
34 ===============================================================================
36 Items the player can pick up or use.
38 ===============================================================================
41 class idItem : public idEntity {
43 CLASS_PROTOTYPE( idItem );
48 void Save( idSaveGame *savefile ) const;
49 void Restore( idRestoreGame *savefile );
52 void GetAttributes( idDict &attributes );
53 virtual bool GiveToPlayer( idPlayer *player );
54 virtual bool Pickup( idPlayer *player );
55 virtual void Think( void );
56 virtual void Present();
59 EVENT_PICKUP = idEntity::EVENT_MAXEVENTS,
71 virtual void ClientPredictionThink( void );
72 virtual bool ClientReceiveEvent( int event, int time, const idBitMsg &msg );
75 virtual void WriteToSnapshot( idBitMsgDelta &msg ) const;
76 virtual void ReadFromSnapshot( const idBitMsgDelta &msg );
84 // for item pulse effect
86 const idMaterial * shellMaterial;
88 // used to update the item pulse effect
90 mutable int inViewTime;
91 mutable int lastCycle;
92 mutable int lastRenderViewTime;
94 bool UpdateRenderEntity( renderEntity_s *renderEntity, const renderView_t *renderView ) const;
95 static bool ModelCallback( renderEntity_s *renderEntity, const renderView_t *renderView );
97 void Event_DropToFloor( void );
98 void Event_Touch( idEntity *other, trace_t *trace );
99 void Event_Trigger( idEntity *activator );
100 void Event_Respawn( void );
101 void Event_RespawnFx( void );
104 class idItemPowerup : public idItem {
106 CLASS_PROTOTYPE( idItemPowerup );
110 void Save( idSaveGame *savefile ) const;
111 void Restore( idRestoreGame *savefile );
114 virtual bool GiveToPlayer( idPlayer *player );
121 class idObjective : public idItem {
123 CLASS_PROTOTYPE( idObjective );
127 void Save( idSaveGame *savefile ) const;
128 void Restore( idRestoreGame *savefile );
135 void Event_Trigger( idEntity *activator );
136 void Event_HideObjective( idEntity *e );
137 void Event_GetPlayerPos();
138 void Event_CamShot();
141 class idVideoCDItem : public idItem {
143 CLASS_PROTOTYPE( idVideoCDItem );
146 virtual bool GiveToPlayer( idPlayer *player );
149 class idPDAItem : public idItem {
151 CLASS_PROTOTYPE( idPDAItem );
153 virtual bool GiveToPlayer( idPlayer *player );
156 class idMoveableItem : public idItem {
158 CLASS_PROTOTYPE( idMoveableItem );
161 virtual ~idMoveableItem();
163 void Save( idSaveGame *savefile ) const;
164 void Restore( idRestoreGame *savefile );
167 virtual void Think( void );
169 virtual bool Collide( const trace_t &collision, const idVec3 &velocity );
171 virtual bool Pickup( idPlayer *player );
173 static void DropItems( idAnimatedEntity *ent, const char *type, idList<idEntity *> *list );
174 static idEntity * DropItem( const char *classname, const idVec3 &origin, const idMat3 &axis, const idVec3 &velocity, int activateDelay, int removeDelay );
176 virtual void WriteToSnapshot( idBitMsgDelta &msg ) const;
177 virtual void ReadFromSnapshot( const idBitMsgDelta &msg );
184 idPhysics_RigidBody physicsObj;
185 idClipModel * trigger;
186 const idDeclParticle * smoke;
193 bool repeatSmoke; // never stop updating the particles
196 void Gib( const idVec3 &dir, const char *damageDefName );
198 void Event_DropToFloor( void );
199 void Event_Gib( const char *damageDefName );
204 class idItemTeam : public idMoveableItem {
206 CLASS_PROTOTYPE( idItemTeam );
209 virtual ~idItemTeam();
212 virtual bool Pickup( idPlayer *player );
213 virtual bool ClientReceiveEvent( int event, int time, const idBitMsg &msg );
214 virtual void Think(void );
216 void Drop( bool death = false ); // was the drop caused by death of carrier?
217 void Return( idPlayer * player = NULL );
218 void Capture( void );
220 virtual void FreeLightDef( void );
221 virtual void Present( void );
224 virtual void WriteToSnapshot( idBitMsgDelta &msg ) const;
225 virtual void ReadFromSnapshot( const idBitMsgDelta &msg );
229 // TODO : turn this into a state :
230 bool carried; // is it beeing carried by a player?
231 bool dropped; // was it dropped?
238 const idDeclSkin * skinDefault;
239 const idDeclSkin * skinCarried;
241 const function_t * scriptTaken;
242 const function_t * scriptDropped;
243 const function_t * scriptReturned;
244 const function_t * scriptCaptured;
246 renderLight_t itemGlow; // Used by flags when they are picked up
250 const char * nuggetName;
254 void Event_TakeFlag( idPlayer * player );
255 void Event_DropFlag( bool death );
256 void Event_FlagReturn( idPlayer * player = NULL );
257 void Event_FlagCapture( void );
259 void PrivateReturn( void );
260 function_t * LoadScript( char * script );
262 void SpawnNugget( idVec3 pos );
263 void UpdateGuis( void );
269 class idMoveablePDAItem : public idMoveableItem {
271 CLASS_PROTOTYPE( idMoveablePDAItem );
273 virtual bool GiveToPlayer( idPlayer *player );
277 ===============================================================================
281 ===============================================================================
284 class idItemRemover : public idEntity {
286 CLASS_PROTOTYPE( idItemRemover );
289 void RemoveItem( idPlayer *player );
292 void Event_Trigger( idEntity *activator );
295 class idObjectiveComplete : public idItemRemover {
297 CLASS_PROTOTYPE( idObjectiveComplete );
299 idObjectiveComplete();
301 void Save( idSaveGame *savefile ) const;
302 void Restore( idRestoreGame *savefile );
309 void Event_Trigger( idEntity *activator );
310 void Event_HideObjective( idEntity *e );
311 void Event_GetPlayerPos();
314 #endif /* !__GAME_ITEM_H__ */