home *** CD-ROM | disk | FTP | other *** search
/ GameStar 2006 March / Gamestar_82_2006-03_dvd.iso / DVDStar / Editace / quake4_sdkv10.exe / source / game / Light.h < prev    next >
C/C++ Source or Header  |  2005-11-14  |  5KB  |  147 lines

  1. #ifndef __GAME_LIGHT_H__
  2. #define __GAME_LIGHT_H__
  3.  
  4. /*
  5. ===============================================================================
  6.  
  7.   Generic light.
  8.  
  9. ===============================================================================
  10. */
  11.  
  12. extern const idEventDef EV_Light_GetLightParm;
  13. extern const idEventDef EV_Light_SetLightParm;
  14. extern const idEventDef EV_Light_SetLightParms;
  15.  
  16. class idLight : public idEntity {
  17. public:
  18.     CLASS_PROTOTYPE( idLight );
  19.  
  20.                     idLight();
  21.                     ~idLight();
  22.  
  23.     void            Spawn( void );
  24.  
  25.     void            Save( idSaveGame *savefile ) const;                    // archives object for save game file
  26.     void            Restore( idRestoreGame *savefile );                    // unarchives object from save game file
  27.  
  28.     virtual void    UpdateChangeableSpawnArgs( const idDict *source );
  29.     virtual void    Think( void );
  30.     virtual void    FreeLightDef( void );
  31.     virtual bool    GetPhysicsToSoundTransform( idVec3 &origin, idMat3 &axis );
  32.     void            Present( void );
  33.  
  34.     void            SaveState( idDict *args );
  35.     virtual void    SetColor( float red, float green, float blue );
  36.     virtual void    SetColor( const idVec4 &color );
  37.     virtual void    GetColor( idVec3 &out ) const;
  38.     virtual void    GetColor( idVec4 &out ) const;
  39.     const idVec3 &    GetBaseColor( void ) const { return baseColor; }
  40.     void            SetShader( const char *shadername );
  41.     void            SetLightParm( int parmnum, float value );
  42.     void            SetLightParms( float parm0, float parm1, float parm2, float parm3 );
  43.     void            SetRadiusXYZ( float x, float y, float z );
  44.     void            SetRadius( float radius );
  45.     void            On( void );
  46.     void            Off( void );
  47.     void            Fade( const idVec4 &to, float fadeTime );
  48.     void            FadeOut( float time );
  49.     void            FadeIn( float time );
  50.     void            Killed( idEntity *inflictor, idEntity *attacker, int damage, const idVec3 &dir, int location );
  51.     void            BecomeBroken( idEntity *activator );
  52.     qhandle_t        GetLightDefHandle( void ) const { return lightDefHandle; }
  53.     void            SetLightParent( idEntity *lparent ) { lightParent = lparent; }
  54.     void            SetLightLevel( void );
  55.  
  56. // RAVEN BEGIN
  57. // jshepard: other entities (speakers) need access to the refSound of a light object
  58.     void            SetRefSound( int rSound ) { refSound.referenceSoundHandle = rSound;}
  59. // ddynerman: sometimes the game needs to know if this light is ambient
  60.     bool            IsAmbient( void ) { return renderLight.shader->IsAmbientLight(); }
  61. // RAVEN END
  62.     virtual void    ShowEditingDialog( void );
  63.  
  64.     enum {
  65.         EVENT_BECOMEBROKEN = idEntity::EVENT_MAXEVENTS,
  66.         EVENT_MAXEVENTS
  67.     };
  68.  
  69.     virtual void    ClientPredictionThink( void );
  70.     virtual void    WriteToSnapshot( idBitMsgDelta &msg ) const;
  71.     virtual void    ReadFromSnapshot( const idBitMsgDelta &msg );
  72.     virtual bool    ClientReceiveEvent( int event, int time, const idBitMsg &msg );
  73.  
  74. private:
  75.     renderLight_t    renderLight;                // light presented to the renderer
  76.     idVec3            localLightOrigin;            // light origin relative to the physics origin
  77.     idMat3            localLightAxis;                // light axis relative to physics axis
  78.     qhandle_t        lightDefHandle;                // handle to renderer light def
  79.     idStr            brokenModel;
  80.     int                levels;
  81.     int                currentLevel;
  82.     idVec3            baseColor;
  83.     bool            breakOnTrigger;
  84.     int                count;
  85.     int                triggercount;
  86.     idEntity *        lightParent;
  87.     idVec4            fadeFrom;
  88.     idVec4            fadeTo;
  89.     int                fadeStart;
  90.     int                fadeEnd;
  91. // RAVEN BEGIN
  92. // bdube: light gui
  93.     idEntityPtr<idEntity>    lightGUI;
  94. // abahr:
  95.     float            wait;
  96.     float            random;    
  97. // RAVEN END
  98.  
  99. private:
  100.     bool            soundWasPlaying;
  101.  
  102.     void            PresentLightDefChange( void );
  103.     void            PresentModelDefChange( void );
  104.  
  105. // RAVEN BEGIN
  106. // jscott: added events for light level
  107. private:
  108.     void            Event_SetCurrentLightLevel ( int in );
  109.     void            Event_SetMaxLightLevel ( int in );
  110.     void            Event_IsOn ( void );
  111.     void            Event_Break (idEntity *activator, float turnOff);
  112.     void            Event_DoneBlinking ( void );
  113.     void            Event_DoneBlinkingOff ( void );
  114.     void            Event_EarthQuake                (float requiresLOS);
  115.     void            Event_Timer( void );
  116. // RAVEN END
  117.  
  118. private:
  119.     void            Event_SetShader( const char *shadername );
  120.     void            Event_GetLightParm( int parmnum );
  121.     void            Event_SetLightParm( int parmnum, float value );
  122.     void            Event_SetLightParms( float parm0, float parm1, float parm2, float parm3 );
  123.     void            Event_SetRadiusXYZ( float x, float y, float z );
  124.     void            Event_SetRadius( float radius );
  125.     void            Event_Hide( void );
  126.     void            Event_Show( void );
  127.     void            Event_On( void );
  128.     void            Event_Off( void );
  129.     void            Event_ToggleOnOff( idEntity *activator );
  130.     void            Event_SetSoundHandles( void );
  131.     void            Event_FadeOut( float time );
  132.     void            Event_FadeIn( float time );
  133. // RAVEN BEGIN
  134. // bdube: set light gui
  135.     void            Event_SetLightGUI ( const char* gui );
  136. // RAVEN END    
  137. };
  138.  
  139. // RAVEN BEGIN
  140. // bdube: externed events
  141. extern const idEventDef EV_Light_SetCurrentLightLevel;
  142. extern const idEventDef EV_Light_SetMaxLightLevel;
  143. extern const idEventDef EV_Light_SetRadius;
  144. // RAVEN END
  145.  
  146. #endif /* !__GAME_LIGHT_H__ */
  147.