Quake DeveLS - Lights Out!

Author: John Rittenhouse
Difficulty: damn Easy !

Bed Time...

SumFuka : Okay you want to know how to turn off the lights. Are you lucky I looked at the bottom of the news and saw the question for that before it gets chopped off.

I just recently found where you define that stuff. It is in one of the most unlooked files(I think the file is probable the most unlooked file). THat file is g_spawn.c look at the very bottom. Here is the code for lights.

//
// Setup light animation tables. 'a' is total darkness, 'z' is doublebright.
//

        // 0 normal
        gi.configstring(CS_LIGHTS+0, "m");
        
        // 1 FLICKER (first variety)
        gi.configstring(CS_LIGHTS+1, "mmnmmommommnonmmonqnmmo");
        
        // 2 SLOW STRONG PULSE
        gi.configstring(CS_LIGHTS+2, "abcdefghijklmnopqrstuvwxyzyxwvutsrqponmlkjihgfedcba");
        
        // 3 CANDLE (first variety)
        gi.configstring(CS_LIGHTS+3, "mmmmmaaaaammmmmaaaaaabcdefgabcdefg");
        
        // 4 FAST STROBE
        gi.configstring(CS_LIGHTS+4, "mamamamamama");
        
        // 5 GENTLE PULSE 1
        gi.configstring(CS_LIGHTS+5,"jklmnopqrstuvwxyzyxwvutsrqponmlkj");
        
        // 6 FLICKER (second variety)
        gi.configstring(CS_LIGHTS+6, "nmonqnmomnmomomno");
        
        // 7 CANDLE (second variety)
        gi.configstring(CS_LIGHTS+7, "mmmaaaabcdefgmmmmaaaammmaamm");
        
        // 8 CANDLE (third variety)
        gi.configstring(CS_LIGHTS+8, "mmmaaammmaaammmabcdefaaaammmmabcdefmmmaaaa");
        
        // 9 SLOW STROBE (fourth variety)
        gi.configstring(CS_LIGHTS+9, "aaaaaaaazzzzzzzz");
        
        // 10 FLUORESCENT FLICKER
        gi.configstring(CS_LIGHTS+10, "mmamammmmammamamaaamammma");

        // 11 SLOW PULSE NOT FADE TO BLACK
        gi.configstring(CS_LIGHTS+11, "abcdefghijklmnopqrrqponmlkjihgfedcba");
        
        //JR 3/26/98
        //12 Wierd flashing
        gi.configstring(CS_LIGHTS+12, "ahsbexcbkxerswaibldcwersxa");

        // styles 32-62 are assigned by the light program for switchable lights

        // 63 testing
        gi.configstring(CS_LIGHTS+63, "a");
I added in that 12th light config. So you can make your own light configs. Now to turn off lights all you have to do is set them all like this.
//
// Setup light animation tables. 'a' is total darkness, 'z' is doublebright.
//

        // 0 normal
        gi.configstring(CS_LIGHTS+0, "a");
        
        // 1 FLICKER (first variety)
        gi.configstring(CS_LIGHTS+1, "a");
        
        // 2 SLOW STRONG PULSE
        gi.configstring(CS_LIGHTS+2, "a");
        
        // 3 CANDLE (first variety)
        gi.configstring(CS_LIGHTS+3, "a");
        
        // 4 FAST STROBE
        gi.configstring(CS_LIGHTS+4, "a");
        
        // 5 GENTLE PULSE 1
        gi.configstring(CS_LIGHTS+5,"a");
        
        // 6 FLICKER (second variety)
        gi.configstring(CS_LIGHTS+6, "a");
        
        // 7 CANDLE (second variety)
        gi.configstring(CS_LIGHTS+7, "a");
        
        // 8 CANDLE (third variety)
        gi.configstring(CS_LIGHTS+8, "a");
        
        // 9 SLOW STROBE (fourth variety)
        gi.configstring(CS_LIGHTS+9, "a");
        
        // 10 FLUORESCENT FLICKER
        gi.configstring(CS_LIGHTS+10, "a");

        // 11 SLOW PULSE NOT FADE TO BLACK
        gi.configstring(CS_LIGHTS+11, "a");
        
        //JR 3/26/98
        //12 Wierd flashing
        gi.configstring(CS_LIGHTS+12, "a");

        // styles 32-62 are assigned by the light program for switchable lights

        // 63 testing
        gi.configstring(CS_LIGHTS+63, "a");
Now lets say you want a command to turn lights on and off. I went ahead and made the code for that. THe command will be "cmd lights" Add at the top of g_cmds.c "int LIGHTS=0;" and then put at the bottom inside of the ClientCommand code at the bottom this code.
else if(Q_stricmp (cmd, "lights") == 0)
        {
                if (LIGHTS)
                {
                        // 0 normal
                        gi.configstring(CS_LIGHTS+0, "m");
        
                        // 1 FLICKER (first variety)
                        gi.configstring(CS_LIGHTS+1, "mmnmmommommnonmmonqnmmo");
        
                        // 2 SLOW STRONG PULSE
                        gi.configstring(CS_LIGHTS+2, "abcdefghijklmnopqrstuvwxyzyxwvutsrqponmlkjihgfedcba");
        
                        // 3 CANDLE (first variety)
                        gi.configstring(CS_LIGHTS+3, "mmmmmaaaaammmmmaaaaaabcdefgabcdefg");
        
                        // 4 FAST STROBE
                        gi.configstring(CS_LIGHTS+4, "mamamamamama");
        
                        // 5 GENTLE PULSE 1
                        gi.configstring(CS_LIGHTS+5,"jklmnopqrstuvwxyzyxwvutsrqponmlkj");
        
                        // 6 FLICKER (second variety)
                        gi.configstring(CS_LIGHTS+6, "nmonqnmomnmomomno");
        
                        // 7 CANDLE (second variety)
                        gi.configstring(CS_LIGHTS+7, "mmmaaaabcdefgmmmmaaaammmaamm");
        
                        // 8 CANDLE (third variety)
                        gi.configstring(CS_LIGHTS+8, "mmmaaammmaaammmabcdefaaaammmmabcdefmmmaaaa");
        
                        // 9 SLOW STROBE (fourth variety)
                        gi.configstring(CS_LIGHTS+9, "aaaaaaaazzzzzzzz");
        
                        // 10 FLUORESCENT FLICKER
                        gi.configstring(CS_LIGHTS+10, "mmamammmmammamamaaamammma");

                        // 11 SLOW PULSE NOT FADE TO BLACK
                        gi.configstring(CS_LIGHTS+11, "abcdefghijklmnopqrrqponmlkjihgfedcba");
        
                        //JR 3/26/98
                        //12 Wierd flashing
                        gi.configstring(CS_LIGHTS+12, "ahsbexcbkxerswaibldcwersxa");
                        LIGHTS =0;
                }
                else
                {
                        // 0 normal
                        gi.configstring(CS_LIGHTS+0, "a");
        
                        // 1 FLICKER (first variety)
                        gi.configstring(CS_LIGHTS+1, "a");
        
                        // 2 SLOW STRONG PULSE
                        gi.configstring(CS_LIGHTS+2, "a");
        
                        // 3 CANDLE (first variety)
                        gi.configstring(CS_LIGHTS+3, "a");
        
                        // 4 FAST STROBE
                        gi.configstring(CS_LIGHTS+4, "a");
        
                        // 5 GENTLE PULSE 1
                        gi.configstring(CS_LIGHTS+5,"a");
        
                        // 6 FLICKER (second variety)
                        gi.configstring(CS_LIGHTS+6, "a");
        
                        // 7 CANDLE (second variety)
                        gi.configstring(CS_LIGHTS+7, "a");
        
                        // 8 CANDLE (third variety)
                        gi.configstring(CS_LIGHTS+8, "a");
        
                        // 9 SLOW STROBE (fourth variety)
                        gi.configstring(CS_LIGHTS+9, "a");
        
                        // 10 FLUORESCENT FLICKER
                        gi.configstring(CS_LIGHTS+10, "a");

                        // 11 SLOW PULSE NOT FADE TO BLACK
                        gi.configstring(CS_LIGHTS+11, "a");
        
                        //JR 3/26/98
                        //12 Wierd flashing
                        gi.configstring(CS_LIGHTS+12, "a");
                        LIGHTS = 1;
                }
        }
Also if you want to define new light types you can it is quite simple in fact you can assign up to 22 more ones. The light value seems to change every 0.1 second to the next value specified and then loops to the front at the end. By the way I never knew how much fun it is to play in the dark intil I wrote this code. Its quite fun fighting by the light your gun, the lights of your enemies, and a few other objects that seem to glow.

John Rittenhouse .

This site, and all content and graphics displayed on it,
are ©opyrighted to the Quake DeveLS team. All rights received.
Got a suggestion? Comment? Question? Hate mail? Send it to us!
Oh yeah, this site is best viewed in 16 Bit or higher, with the resolution on 800*600.
Thanks to Planet Quake for their great help and support with hosting.
Best viewed with Netscape 4