1 /** @file p_lights.h Handle sector base lighting effects. 2 * 3 * @authors Copyright © 2003-2017 Jaakko Keränen <jaakko.keranen@iki.fi> 4 * @authors Copyright © 2005-2013 Daniel Swanson <danij@dengine.net> 5 * @authors Copyright © 2003-2005 Samuel Villarreal <svkaiser@gmail.com> 6 * @authors Copyright © 1993-1996 id Software, Inc. 7 * 8 * @par License 9 * GPL: http://www.gnu.org/licenses/gpl.html 10 * 11 * <small>This program is free software; you can redistribute it and/or modify 12 * it under the terms of the GNU General Public License as published by the 13 * Free Software Foundation; either version 2 of the License, or (at your 14 * option) any later version. This program is distributed in the hope that it 15 * will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty 16 * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General 17 * Public License for more details. You should have received a copy of the GNU 18 * General Public License along with this program; if not, write to the Free 19 * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 20 * 02110-1301 USA</small> 21 */ 22 23 #ifndef LIBDOOM64_PLAY_LIGHTS_H 24 #define LIBDOOM64_PLAY_LIGHTS_H 25 26 #ifndef __JDOOM64__ 27 # error "Using jDoom64 headers without __JDOOM64__" 28 #endif 29 30 #include "doomsday.h" 31 32 #ifdef __cplusplus 33 class MapStateReader; 34 class MapStateWriter; 35 #endif 36 37 #define GLOWSPEED (8) 38 #define STROBEBRIGHT (5) 39 #define FASTDARK (15) 40 #define SLOWDARK (35) 41 42 typedef struct fireflicker_s { 43 thinker_t thinker; 44 Sector *sector; 45 int count; 46 float maxLight; 47 float minLight; 48 49 #ifdef __cplusplus 50 void write(MapStateWriter *msw) const; 51 int read(MapStateReader *msr); 52 #endif 53 } fireflicker_t; 54 55 typedef struct lightflash_s { 56 thinker_t thinker; 57 Sector *sector; 58 int count; 59 float maxLight; 60 float minLight; 61 int maxTime; 62 int minTime; 63 64 #ifdef __cplusplus 65 void write(MapStateWriter *msw) const; 66 int read(MapStateReader *msr); 67 #endif 68 } lightflash_t; 69 70 typedef struct lightblink_s { 71 thinker_t thinker; 72 Sector *sector; 73 int count; 74 float maxLight; 75 float minLight; 76 int maxTime; 77 int minTime; 78 79 #ifdef __cplusplus 80 void write(MapStateWriter *msw) const; 81 int read(MapStateReader *msr); 82 #endif 83 } lightblink_t; 84 85 typedef struct strobe_s { 86 thinker_t thinker; 87 Sector *sector; 88 int count; 89 float minLight; 90 float maxLight; 91 int darkTime; 92 int brightTime; 93 94 #ifdef __cplusplus 95 void write(MapStateWriter *msw) const; 96 int read(MapStateReader *msr); 97 #endif 98 } strobe_t; 99 100 typedef struct glow_s { 101 thinker_t thinker; 102 Sector *sector; 103 float minLight; 104 float maxLight; 105 int direction; 106 107 #ifdef __cplusplus 108 void write(MapStateWriter *msw) const; 109 int read(MapStateReader *msr); 110 #endif 111 } glow_t; 112 113 #ifdef __cplusplus 114 extern "C" { 115 #endif 116 117 void T_FireFlicker(fireflicker_t *flick); 118 void P_SpawnFireFlicker(Sector *sector); 119 120 void T_LightFlash(lightflash_t *flash); 121 void P_SpawnLightFlash(Sector *sector); 122 123 void T_LightBlink(lightblink_t *flash); 124 void P_SpawnLightBlink(Sector *sector); 125 126 void T_StrobeFlash(strobe_t *flash); 127 void P_SpawnStrobeFlash(Sector *sector, int fastOrSlow, int inSync); 128 129 void T_Glow(glow_t *g); 130 void P_SpawnGlowingLight(Sector *sector); 131 132 void EV_StartLightStrobing(Line *line); 133 void EV_TurnTagLightsOff(Line *line); 134 void EV_LightTurnOn(Line *line, float max); 135 136 #ifdef __cplusplus 137 } // extern "C" 138 #endif 139 140 #endif // LIBDOOM64_PLAY_LIGHTS_H 141