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_MISC_H__
30 #define __GAME_MISC_H__
34 ===============================================================================
38 A simple, spawnable entity with a model and no functionable ability of it's own.
39 For example, it can be used as a placeholder during development, for marking
40 locations on maps for script, or for simple placed models without any behavior
41 that can be bound to other entities. Should not be subclassed.
42 ===============================================================================
45 class idSpawnableEntity : public idEntity {
47 CLASS_PROTOTYPE( idSpawnableEntity );
55 ===============================================================================
57 Potential spawning position for players.
58 The first time a player enters the game, they will be at an 'initial' spot.
59 Targets will be fired when someone spawns in on them.
61 When triggered, will cause player to be teleported to spawn spot.
63 ===============================================================================
66 class idPlayerStart : public idEntity {
68 CLASS_PROTOTYPE( idPlayerStart );
71 EVENT_TELEPORTPLAYER = idEntity::EVENT_MAXEVENTS,
75 idPlayerStart( void );
79 void Save( idSaveGame *savefile ) const;
80 void Restore( idRestoreGame *savefile );
82 virtual bool ClientReceiveEvent( int event, int time, const idBitMsg &msg );
87 void Event_TeleportPlayer( idEntity *activator );
88 void Event_TeleportStage( idEntity *player );
89 void TeleportPlayer( idPlayer *player );
94 ===============================================================================
96 Non-displayed entity used to activate triggers when it touches them.
97 Bind to a mover to have the mover activate a trigger as it moves.
98 When target by triggers, activating the trigger will toggle the
99 activator on and off. Check "start_off" to have it spawn disabled.
101 ===============================================================================
104 class idActivator : public idEntity {
106 CLASS_PROTOTYPE( idActivator );
110 void Save( idSaveGame *savefile ) const;
111 void Restore( idRestoreGame *savefile );
113 virtual void Think( void );
118 void Event_Activate( idEntity *activator );
123 ===============================================================================
125 Path entities for monsters to follow.
127 ===============================================================================
129 class idPathCorner : public idEntity {
131 CLASS_PROTOTYPE( idPathCorner );
135 static void DrawDebugInfo( void );
137 static idPathCorner *RandomPath( const idEntity *source, const idEntity *ignore );
140 void Event_RandomPath( void );
145 ===============================================================================
147 Object that fires targets and changes shader parms when damaged.
149 ===============================================================================
152 class idDamagable : public idEntity {
154 CLASS_PROTOTYPE( idDamagable );
158 void Save( idSaveGame *savefile ) const;
159 void Restore( idRestoreGame *savefile );
162 void Killed( idEntity *inflictor, idEntity *attacker, int damage, const idVec3 &dir, int location );
165 virtual void Hide( void );
166 virtual void Show( void );
173 void BecomeBroken( idEntity *activator );
174 void Event_BecomeBroken( idEntity *activator );
175 void Event_RestoreDamagable( void );
180 ===============================================================================
182 Hidden object that explodes when activated
184 ===============================================================================
187 class idExplodable : public idEntity {
189 CLASS_PROTOTYPE( idExplodable );
194 void Event_Explode( idEntity *activator );
199 ===============================================================================
203 ===============================================================================
206 class idSpring : public idEntity {
208 CLASS_PROTOTYPE( idSpring );
212 virtual void Think( void );
221 idForce_Spring spring;
223 void Event_LinkSpring( void );
228 ===============================================================================
232 ===============================================================================
235 class idForceField : public idEntity {
237 CLASS_PROTOTYPE( idForceField );
239 void Save( idSaveGame *savefile ) const;
240 void Restore( idRestoreGame *savefile );
244 virtual void Think( void );
247 idForce_Field forceField;
251 void Event_Activate( idEntity *activator );
252 void Event_Toggle( void );
253 void Event_FindTargets( void );
258 ===============================================================================
262 ===============================================================================
265 class idAnimated : public idAFEntity_Gibbable {
267 CLASS_PROTOTYPE( idAnimated );
272 void Save( idSaveGame *savefile ) const;
273 void Restore( idRestoreGame *savefile );
276 virtual bool LoadAF( void );
277 bool StartRagdoll( void );
278 virtual bool GetPhysicsToSoundTransform( idVec3 &origin, idMat3 &axis );
282 int current_anim_index;
285 jointHandle_t soundJoint;
286 idEntityPtr<idEntity> activator;
289 void PlayNextAnim( void );
291 void Event_Activate( idEntity *activator );
292 void Event_Start( void );
293 void Event_StartRagdoll( void );
294 void Event_AnimDone( int animIndex );
295 void Event_Footstep( void );
296 void Event_LaunchMissiles( const char *projectilename, const char *sound, const char *launchjoint, const char *targetjoint, int numshots, int framedelay );
297 void Event_LaunchMissilesUpdate( int launchjoint, int targetjoint, int numshots, int framedelay );
299 void Event_SetAnimation( const char *animName );
300 void Event_GetAnimationLength();
306 ===============================================================================
310 ===============================================================================
313 class idStaticEntity : public idEntity {
315 CLASS_PROTOTYPE( idStaticEntity );
317 idStaticEntity( void );
319 void Save( idSaveGame *savefile ) const;
320 void Restore( idRestoreGame *savefile );
323 void ShowEditingDialog( void );
324 virtual void Hide( void );
325 virtual void Show( void );
326 void Fade( const idVec4 &to, float fadeTime );
327 virtual void Think( void );
329 virtual void WriteToSnapshot( idBitMsgDelta &msg ) const;
330 virtual void ReadFromSnapshot( const idBitMsgDelta &msg );
333 void Event_Activate( idEntity *activator );
346 ===============================================================================
350 ===============================================================================
353 class idFuncEmitter : public idStaticEntity {
355 CLASS_PROTOTYPE( idFuncEmitter );
357 idFuncEmitter( void );
359 void Save( idSaveGame *savefile ) const;
360 void Restore( idRestoreGame *savefile );
363 void Event_Activate( idEntity *activator );
365 virtual void WriteToSnapshot( idBitMsgDelta &msg ) const;
366 virtual void ReadFromSnapshot( const idBitMsgDelta &msg );
375 ===============================================================================
379 ===============================================================================
382 class idFuncSmoke : public idEntity {
384 CLASS_PROTOTYPE( idFuncSmoke );
390 void Save( idSaveGame *savefile ) const;
391 void Restore( idRestoreGame *savefile );
393 virtual void Think( void );
394 void Event_Activate( idEntity *activator );
398 const idDeclParticle * smoke;
404 ===============================================================================
408 ===============================================================================
411 class idFuncSplat : public idFuncEmitter {
413 CLASS_PROTOTYPE( idFuncSplat );
420 void Event_Activate( idEntity *activator );
426 ===============================================================================
430 ===============================================================================
433 class idTextEntity : public idEntity {
435 CLASS_PROTOTYPE( idTextEntity );
439 void Save( idSaveGame *savefile ) const;
440 void Restore( idRestoreGame *savefile );
442 virtual void Think( void );
451 ===============================================================================
455 ===============================================================================
458 class idLocationEntity : public idEntity {
460 CLASS_PROTOTYPE( idLocationEntity );
464 const char * GetLocation( void ) const;
469 class idLocationSeparatorEntity : public idEntity {
471 CLASS_PROTOTYPE( idLocationSeparatorEntity );
478 class idVacuumSeparatorEntity : public idEntity {
480 CLASS_PROTOTYPE( idVacuumSeparatorEntity );
482 idVacuumSeparatorEntity( void );
486 void Save( idSaveGame *savefile ) const;
487 void Restore( idRestoreGame *savefile );
489 void Event_Activate( idEntity *activator );
495 class idVacuumEntity : public idEntity {
497 CLASS_PROTOTYPE( idVacuumEntity );
506 ===============================================================================
510 ===============================================================================
513 class idBeam : public idEntity {
515 CLASS_PROTOTYPE( idBeam );
521 void Save( idSaveGame *savefile ) const;
522 void Restore( idRestoreGame *savefile );
524 virtual void Think( void );
526 void SetMaster( idBeam *masterbeam );
527 void SetBeamTarget( const idVec3 &origin );
529 virtual void Show( void );
531 virtual void WriteToSnapshot( idBitMsgDelta &msg ) const;
532 virtual void ReadFromSnapshot( const idBitMsgDelta &msg );
535 void Event_MatchTarget( void );
536 void Event_Activate( idEntity *activator );
538 idEntityPtr<idBeam> target;
539 idEntityPtr<idBeam> master;
544 ===============================================================================
548 ===============================================================================
551 class idRenderModelLiquid;
553 class idLiquid : public idEntity {
555 CLASS_PROTOTYPE( idLiquid );
559 void Save( idSaveGame *savefile ) const;
560 void Restore( idRestoreGame *savefile );
563 void Event_Touch( idEntity *other, trace_t *trace );
566 idRenderModelLiquid *model;
571 ===============================================================================
575 ===============================================================================
578 class idShaking : public idEntity {
580 CLASS_PROTOTYPE( idShaking );
586 void Save( idSaveGame *savefile ) const;
587 void Restore( idRestoreGame *savefile );
590 idPhysics_Parametric physicsObj;
593 void BeginShaking( void );
594 void Event_Activate( idEntity *activator );
599 ===============================================================================
603 ===============================================================================
606 class idEarthQuake : public idEntity {
608 CLASS_PROTOTYPE( idEarthQuake );
614 void Save( idSaveGame *savefile ) const;
615 void Restore( idRestoreGame *savefile );
617 virtual void Think( void );
629 void Event_Activate( idEntity *activator );
634 ===============================================================================
638 ===============================================================================
641 class idFuncPortal : public idEntity {
643 CLASS_PROTOTYPE( idFuncPortal );
649 void Save( idSaveGame *savefile ) const;
650 void Restore( idRestoreGame *savefile );
656 void Event_Activate( idEntity *activator );
660 ===============================================================================
664 ===============================================================================
667 class idFuncAASPortal : public idEntity {
669 CLASS_PROTOTYPE( idFuncAASPortal );
675 void Save( idSaveGame *savefile ) const;
676 void Restore( idRestoreGame *savefile );
681 void Event_Activate( idEntity *activator );
685 ===============================================================================
689 ===============================================================================
692 class idFuncAASObstacle : public idEntity {
694 CLASS_PROTOTYPE( idFuncAASObstacle );
700 void Save( idSaveGame *savefile ) const;
701 void Restore( idRestoreGame *savefile );
706 void Event_Activate( idEntity *activator );
711 ===============================================================================
715 ===============================================================================
718 class idFuncRadioChatter : public idEntity {
720 CLASS_PROTOTYPE( idFuncRadioChatter );
722 idFuncRadioChatter();
726 void Save( idSaveGame *savefile ) const;
727 void Restore( idRestoreGame *savefile );
731 void Event_Activate( idEntity *activator );
732 void Event_ResetRadioHud( idEntity *activator );
737 ===============================================================================
741 ===============================================================================
744 class idPhantomObjects : public idEntity {
746 CLASS_PROTOTYPE( idPhantomObjects );
752 void Save( idSaveGame *savefile ) const;
753 void Restore( idRestoreGame *savefile );
755 virtual void Think( void );
758 void Event_Activate( idEntity *activator );
759 void Event_Throw( void );
760 void Event_ShakeObject( idEntity *object, int starttime );
769 idEntityPtr<idActor>target;
770 idList<int> targetTime;
771 idList<idVec3> lastTargetPos;
776 ===============================================================================
780 ===============================================================================
782 class idShockwave : public idEntity {
784 CLASS_PROTOTYPE( idShockwave );
792 void Save( idSaveGame *savefile ) const;
793 void Restore( idRestoreGame *savefile );
796 void Event_Activate( idEntity *activator );
810 float playerDamageSize;
815 ===============================================================================
819 ===============================================================================
821 class idFuncMountedObject : public idEntity {
823 CLASS_PROTOTYPE( idFuncMountedObject );
825 idFuncMountedObject();
826 ~idFuncMountedObject();
831 void GetAngleRestrictions( int &yaw_min, int &yaw_max, int &pitch );
837 void Event_Touch( idEntity *other, trace_t *trace );
838 void Event_Activate( idEntity *activator );
842 function_t * scriptFunction;
843 idPlayer * mountedPlayer;
847 class idFuncMountedWeapon : public idFuncMountedObject {
849 CLASS_PROTOTYPE( idFuncMountedWeapon );
851 idFuncMountedWeapon();
852 ~idFuncMountedWeapon();
859 // The actual turret that moves with the player's view
862 // the muzzle bone's position, used for launching projectiles and trailing smoke
866 float weaponLastFireTime;
867 float weaponFireDelay;
869 const idDict * projectile;
871 const idSoundShader *soundFireWeapon;
873 void Event_PostSpawn( void );
877 ===============================================================================
881 ===============================================================================
883 class idPortalSky : public idEntity {
885 CLASS_PROTOTYPE( idPortalSky );
891 void Event_PostSpawn();
892 void Event_Activate( idEntity *activator );
897 #endif /* !__GAME_MISC_H__ */