/* =========================================================================== IceTech GPL Source Code Copyright (C) 2026 Justin Marshall This file is part of the IceTech GPL Source Code (?IceTech Source Code?). IceTech Source Code is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. IceTech Source Code is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with IceTech Source Code. If not, see . In addition, the IceTech 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 IceTech Source Code. If not, please request a copy in writing from id Software at the address below. If you have questions concerning this license or the applicable additional terms, you may contact in writing Justin Marshall, justinmarshall20@gmail.com =========================================================================== */ #ifndef __GAME_LIGHT_H__ #define __GAME_LIGHT_H__ /* =============================================================================== Generic light. =============================================================================== */ class idLight : public idEntity { public: CLASS_PROTOTYPE( idLight ); idLight(); ~idLight(); void Spawn( void ); void Save( idSaveGame *savefile ) const; // archives object for save game file void Restore( idRestoreGame *savefile ); // unarchives object from save game file virtual void UpdateChangeableSpawnArgs( const idDict *source ); virtual void Think( void ); virtual void FreeLightDef( void ); virtual bool GetPhysicsToSoundTransform( idVec3 &origin, idMat3 &axis ); void Present( void ); void SaveState( idDict *args ); virtual void SetColor( float red, float green, float blue ); virtual void SetColor( const idVec4 &color ); virtual void GetColor( idVec3 &out ) const; virtual void GetColor( idVec4 &out ) const; const idVec3 & GetBaseColor( void ) const { return baseColor; } void SetShader( const char *shadername ); void SetLightParm( int parmnum, float value ); void SetLightParms( float parm0, float parm1, float parm2, float parm3 ); void SetRadiusXYZ( float x, float y, float z ); void SetRadius( float radius ); void On( void ); void Off( void ); void Fade( const idVec4 &to, float fadeTime ); void FadeOut( float time ); void FadeIn( float time ); void Killed( idEntity *inflictor, idEntity *attacker, int damage, const idVec3 &dir, int location ); void BecomeBroken( idEntity *activator ); qhandle_t GetLightDefHandle( void ) const { return lightDefHandle; } void SetLightParent( idEntity *lparent ) { lightParent = lparent; } void SetLightLevel( void ); virtual void ShowEditingDialog( void ); enum { EVENT_BECOMEBROKEN = idEntity::EVENT_MAXEVENTS, EVENT_MAXEVENTS }; virtual void ClientPredictionThink( void ); virtual void WriteToSnapshot( idBitMsgDelta &msg ) const; virtual void ReadFromSnapshot( const idBitMsgDelta &msg ); virtual bool ClientReceiveEvent( int event, int time, const idBitMsg &msg ); private: renderLight_t renderLight; // light presented to the renderer idVec3 localLightOrigin; // light origin relative to the physics origin idMat3 localLightAxis; // light axis relative to physics axis qhandle_t lightDefHandle; // handle to renderer light def idStr brokenModel; int levels; int currentLevel; idVec3 baseColor; bool breakOnTrigger; int count; int triggercount; idEntity * lightParent; idVec4 fadeFrom; idVec4 fadeTo; int fadeStart; int fadeEnd; bool soundWasPlaying; private: void PresentLightDefChange( void ); void PresentModelDefChange( void ); ID_SCRIPT_EVENT( "setShader", 0 ) void Event_SetShader( const char *shadername ); ID_SCRIPT_EVENT( "getLightParm", 'f' ) void Event_GetLightParm( int parmnum ); ID_SCRIPT_EVENT( "setLightParm", 0 ) void Event_SetLightParm( int parmnum, float value ); ID_SCRIPT_EVENT( "setLightParms", 0 ) void Event_SetLightParms( float parm0, float parm1, float parm2, float parm3 ); ID_SCRIPT_EVENT( "setRadiusXYZ", 0 ) void Event_SetRadiusXYZ( float x, float y, float z ); ID_SCRIPT_EVENT( "setRadius", 0 ) void Event_SetRadius( float radius ); ID_SCRIPT_EVENT( "hide", 0 ) void Event_Hide( void ); ID_SCRIPT_EVENT( "show", 0 ) void Event_Show( void ); ID_SCRIPT_EVENT( "On", 0 ) void Event_On( void ); ID_SCRIPT_EVENT( "Off", 0 ) void Event_Off( void ); ID_SCRIPT_EVENT( "activate", 0 ) void Event_ToggleOnOff( idEntity *activator ); ID_SCRIPT_EVENT( "", 0 ) void Event_SetSoundHandles( void ); ID_SCRIPT_EVENT( "fadeOutLight", 0 ) void Event_FadeOut( float time ); ID_SCRIPT_EVENT( "fadeInLight", 0 ) void Event_FadeIn( float time ); }; #endif /* !__GAME_LIGHT_H__ */