/* * $Header: /H3/game/hcode/light.hc 35 9/02/97 3:04p Mgummelt $ */ /* ========================================================== LIGHT.HC MG Lights can be toggled/faded, shot out, etc. ========================================================== */ float START_LOW = 1; void initialize_lightstyle (void) { if(self.spawnflags&START_LOW) if(self.lightvalue1=self.fadespeed) { //dprint("light timed out\n"); remove(self); } else if((self.cnt<0&&self.light_lev<=self.level)||(self.cnt>0&&self.light_lev>=self.level)) { //dprint("light fade done\n"); lightstylestatic(self.style, self.level); remove(self); } else { self.nextthink=time+0.05; self.think=fadelight; } } void lightstyle_change_think() { //dprint("initializing light change\n"); self.speed=self.lightvalue2 - self.lightvalue1; self.light_lev=lightstylevalue(self.style); if(self.light_lev==self.lightvalue1) self.level = self.lightvalue2; else if(self.light_lev==self.lightvalue2) self.level = self.lightvalue1; else if(self.speed>0) if(self.light_levself.fadespeed) self.nextthink=-1; else self.nextthink=time+0.05; self.think=torch_think; } void torch_use (void) { self.fadespeed=time+other.fadespeed+1; torch_think(); } /*QUAKED light (0 1 0) (-8 -8 -8) (8 8 8) START_LOW Non-displayed fading light. Default light value is 300 Default style is 0 ---------------------------------- If triggered, will toggle between lightvalue1 and lightvalue2 .lightvalue1 (default 0) .lightvalue2 (default 11, equivalent to 300 brightness) Two values the light will fade-toggle between, 0 is black, 25 is brightest, 11 is equivalent to a value of 300. .fadespeed (default 1) = How many seconds it will take to complete the desired lighting change The light will start on at a default of the higher light value unless you turn on the startlow flag. START_LOW = will make the light start at the lower of the lightvalues you specify (default uses brighter) NOTE: IF YOU DON'T PLAN ON USING THE DEFAULTS, ALL LIGHTS IN THE BANK OF LIGHTS NEED THIS INFO */ void light() { if (self.targetname == "") { remove(self); } else { if(!self.lightvalue2) self.lightvalue2=11; if(!self.fadespeed) self.fadespeed = 1; initialize_lightstyle(); } } /*QUAK-ED light_globe (0 1 0) (-8 -8 -8) (8 8 8) START_LOW Sphere globe light. Default light value is 300 Default style is 0 ---------------------------------- If triggered, will toggle between lightvalue1 and lightvalue2 .lightvalue1 (default 0) .lightvalue2 (default 11, equivalent to 300 brightness) Two values the light will fade-toggle between, 0 is black, 25 is brightest, 11 is equivalent to a value of 300. .fadespeed (default 1) = How many seconds it will take to complete the desired lighting change The light will start on at a default of the higher light value unless you turn on the startlow flag. START_LOW = will make the light start at the lower of the lightvalues you specify (default uses brighter) NOTE: IF YOU DON'T PLAN ON USING THE DEFAULTS, ALL LIGHTS IN THE BANK OF LIGHTS NEED THIS INFO */ /* void() light_globe = { precache_model ("models/s_light.spr"); setmodel (self, "models/s_light.spr"); if(self.targetname) self.use=torch_use; self.mdl = "models/null.spr"; self.weaponmodel = "models/s_light.spr"; if(self.style>=32) { if(!self.lightvalue2) self.lightvalue2=11; if(!self.fadespeed) self.fadespeed = 1; initialize_lightstyle(); self.think = torch_think; self.nextthink = time+1; } else { setmodel(self,self.weaponmodel); makestatic (self); } }; */ void() FireAmbient = { //FIXME: remove ambient sound if light is off, start it again if turned back on precache_sound ("raven/flame1.wav"); // attenuate fast ambientsound (self.origin, "raven/flame1.wav", 0.5, ATTN_STATIC); }; /*QUAK-ED light_torch_small_walltorch (0 .5 0) (-10 -10 -20) (10 10 20) START_LOW Short wall torch Default light value is 200 Default style is 0 ---------------------------------- If triggered, will toggle between lightvalue1 and lightvalue2 .lightvalue1 (default 0) .lightvalue2 (default 11, equivalent to 300 brightness) Two values the light will fade-toggle between, 0 is black, 25 is brightest, 11 is equivalent to a value of 300. .fadespeed (default 1) = How many seconds it will take to complete the desired lighting change The light will start on at a default of the higher light value unless you turn on the startlow flag. START_LOW = will make the light start at the lower of the lightvalues you specify (default uses brighter) NOTE: IF YOU DON'T PLAN ON USING THE DEFAULTS, ALL LIGHTS IN THE BANK OF LIGHTS NEED THIS INFO */ void() light_torch_small_walltorch = { precache_model ("models/flame.mdl"); FireAmbient (); if(self.targetname) self.use=torch_use; self.mdl = "models/null.spr"; self.weaponmodel = "models/flame.mdl"; self.abslight = .75; if(self.style>=32) { if(!self.lightvalue2) self.lightvalue2=11; if(!self.fadespeed) self.fadespeed = 1; initialize_lightstyle(); self.think = torch_think; self.nextthink = time+1; } else { self.drawflags(+)MLS_ABSLIGHT; setmodel(self,self.weaponmodel); makestatic (self); } }; /*QUAKED light_flame_large_yellow (0 1 0) (-10 -10 -12) (12 12 18) START_LOW Large yellow flame ---------------------------------- If triggered, will toggle between lightvalue1 and lightvalue2 .lightvalue1 (default 0) .lightvalue2 (default 11, equivalent to 300 brightness) Two values the light will fade-toggle between, 0 is black, 25 is brightest, 11 is equivalent to a value of 300. .fadespeed (default 1) = How many seconds it will take to complete the desired lighting change The light will start on at a default of the higher light value unless you turn on the startlow flag. START_LOW = will make the light start at the lower of the lightvalues you specify (default uses brighter) NOTE: IF YOU DON'T PLAN ON USING THE DEFAULTS, ALL LIGHTS IN THE BANK OF LIGHTS NEED THIS INFO */ void() light_flame_large_yellow = { precache_model ("models/flame1.mdl"); FireAmbient (); if(self.targetname) self.use=torch_use; self.abslight = .75; self.mdl = "models/null.spr"; self.weaponmodel = "models/flame1.mdl"; if(self.style>=32) { if(!self.lightvalue2) self.lightvalue2=11; if(!self.fadespeed) self.fadespeed = 1; initialize_lightstyle(); self.think = torch_think; self.nextthink = time+1; } else { self.drawflags(+)MLS_ABSLIGHT; setmodel(self,self.weaponmodel); makestatic (self); } }; /*QUAKED light_flame_small_yellow (0 1 0) (-8 -8 -8) (8 8 8) START_LOW Small yellow flame ball ---------------------------------- If triggered, will toggle between lightvalue1 and lightvalue2 .lightvalue1 (default 0) .lightvalue2 (default 11, equivalent to 300 brightness) Two values the light will fade-toggle between, 0 is black, 25 is brightest, 11 is equivalent to a value of 300. .fadespeed (default 1) = How many seconds it will take to complete the desired lighting change The light will start on at a default of the higher light value unless you turn on the startlow flag. START_LOW = will make the light start at the lower of the lightvalues you specify (default uses brighter) NOTE: IF YOU DON'T PLAN ON USING THE DEFAULTS, ALL LIGHTS IN THE BANK OF LIGHTS NEED THIS INFO */ void() light_flame_small_yellow = { precache_model ("models/flame2.mdl"); FireAmbient (); if(self.targetname) self.use=torch_use; self.abslight = .75; self.mdl = "models/null.spr"; self.weaponmodel = "models/flame2.mdl"; if(self.style>=32) { if(!self.lightvalue2) self.lightvalue2=11; if(!self.fadespeed) self.fadespeed = 1; initialize_lightstyle(); self.think = torch_think; self.nextthink = time+1; } else { self.drawflags(+)MLS_ABSLIGHT; setmodel(self,self.weaponmodel); makestatic (self); } }; /*QUAK-ED light_flame_small_white (0 1 0) (-10 -10 -40) (10 10 40) START_LOW Small white flame ball ---------------------------------- If triggered, will toggle between lightvalue1 and lightvalue2 .lightvalue1 (default 0) .lightvalue2 (default 11, equivalent to 300 brightness) Two values the light will fade-toggle between, 0 is black, 25 is brightest, 11 is equivalent to a value of 300. .fadespeed (default 1) = How many seconds it will take to complete the desired lighting change The light will start on at a default of the higher light value unless you turn on the startlow flag. START_LOW = will make the light start at the lower of the lightvalues you specify (default uses brighter) NOTE: IF YOU DON'T PLAN ON USING THE DEFAULTS, ALL LIGHTS IN THE BANK OF LIGHTS NEED THIS INFO */ /* void() light_flame_small_white = { precache_model ("models/flame2.mdl"); FireAmbient (); if(self.targetname) self.use=torch_use; self.abslight = .75; self.mdl = "models/null.spr"; self.weaponmodel = "models/flame2.mdl"; if(self.style>=32) { if(!self.lightvalue2) self.lightvalue2=11; if(!self.fadespeed) self.fadespeed = 1; initialize_lightstyle(); self.think = torch_think; self.nextthink = time+1; } else { self.drawflags(+)MLS_ABSLIGHT; setmodel(self,self.weaponmodel); makestatic (self); } }; */ /*QUAKED light_gem (0 1 0) (-8 -8 -8) (8 8 8) START_LOW A gem that displays light. Default light value is 300 Default style is 0 ---------------------------------- If triggered, will toggle between lightvalue1 and lightvalue2 .lightvalue1 (default 0) .lightvalue2 (default 11, equivalent to 300 brightness) Two values the light will fade-toggle between, 0 is black, 25 is brightest, 11 is equivalent to a value of 300. .fadespeed (default 1) = How many seconds it will take to complete the desired lighting change The light will start on at a default of the higher light value unless you turn on the startlow flag. START_LOW = will make the light start at the lower of the lightvalues you specify (default uses brighter) NOTE: IF YOU DON'T PLAN ON USING THE DEFAULTS, ALL LIGHTS IN THE BANK OF LIGHTS NEED THIS INFO */ void() light_gem = { precache_model ("models/gemlight.mdl"); if(self.targetname) self.use=torch_use; self.mdl = "models/null.spr"; self.weaponmodel = "models/gemlight.mdl"; self.abslight = .75; if(self.style>=32) { if(!self.lightvalue2) self.lightvalue2=11; if(!self.fadespeed) self.fadespeed = 1; initialize_lightstyle(); self.think = torch_think; self.nextthink = time+1; } else { self.drawflags(+)MLS_ABSLIGHT; setmodel(self,self.weaponmodel); makestatic (self); } };