For this tutorial, we are going to add a pink effect.
We are going to go into 4 files:
-Cl_Main.c
-server.h
-Video_Hardware_model.h
-Defs[QC]
To start off, Let's goto Cl_main.c and add add a Light effect.
Scroll down to this function:
Goto near the bottom and find this:/*
===============
CL_RelinkEntities
===============
*/
void CL_RelinkEntities (void)
Code: Select all
if (ent->effects & EF_BLUELIGHT)
{
dl = CL_AllocDlight (i);
VectorCopy (ent->origin, dl->origin);
dl->radius = 200 + (rand()&31);
dl->die = cl.time + 0.001;
dl->radius = 150 + (rand()&31);
dl->color[0] = 0.25;
dl->color[1] = 0.25;
dl->color[2] = 2;
}
//A new light effect is now added.
if (ent->effects & EF_PINKLIGHT)
{
dl = CL_AllocDlight (i);
VectorCopy (ent->origin, dl->origin);
dl->radius = 200 + (rand()&31);
dl->die = cl.time + 0.001;
dl->radius = 150 + (rand()&31);
dl->color[0] = 2; //Red
dl->color[1] = 1.4; //Green
dl->color[2] = 1.8; //Blue
}
Edit these 3 values to get the color that you want.
dl->color[0] = 2; //Red
dl->color[1] = 1.4; //Green
dl->color[2] = 1.8; //Blue
You can also rename the effect name if you like. It can be anything. Just look at the other colors, and you will see.
Now open up server.h
Scroll down until you find this:
// entity effects
#define EF_BRIGHTFIELD 1
#define EF_MUZZLEFLASH 2
#define EF_BRIGHTLIGHT 4
#define EF_DIMLIGHT 8
#ifdef SUPPORTS_KUROK_PROTOCOL
#define EF_REDLIGHT 16
#define EF_BLUELIGHT 32
Now right under EF_BLUELIGHT, Add a new Definition like this:
Notice that the number[64] is double the last number[32]#define EF_PINKLIGHT 64
If you follow this pattern, Then the next Effect number will be [128].
Save and close and open up Video_Hardware_model.h
Right off the bat, you will notice this:
Can you guess what you are going to do? That is right. Put your definition here too. A matter of fact, you should put it under EF_BLUELIGHT.// entity effects
#define EF_BRIGHTFIELD 1
#define EF_MUZZLEFLASH 2
#define EF_BRIGHTLIGHT 4
#define EF_DIMLIGHT 8
#define EF_REDLIGHT 16
#define EF_BLUELIGHT 32
#define EF_PINKLIGHT 64
Save and close. Now You might need to delete the normal folder so the .h files will be compiled.
Now we need to crack open the qc. Open up defs.qc. We need to make that transaction to the game-code.
Now about Midway, there should be something that looks like this:
// entity effects
//float EF_BRIGHTFIELD = 1;
float EF_MUZZLEFLASH = 2;
float EF_BRIGHTLIGHT = 4;
float EF_DIMLIGHT = 8;
float EF_FLAG1 = 16;
float EF_FLAG2 = 32;
Now add this Right under float EF_FLAG2 = 32;
Now compile and you are done!float EF_FLAG3 = 64; //Pink light effect
An example of this might look like...
Code: Select all
self.effects = EF_FLAG3;
-Mexicouger