This tutorial will show you how to enable new entity effects. These effects are already coded, you just need to
enable them for your Quake executable. In the source code you may have already found places where more effects
or other things are coded, just not enabled. To enable a lot of these you need to define QUAKE2. But the problem
with that is you will break compatibility with all older QuakeC modifications. This is not an option if you want
anyone to use your modified Quake executable. This tutorial will show you what you need to do to
enable new effects.Again, this will not break compatability with older mods. These effects are EF_DARKLIGHT, EF_DARKFIELD, EF_LIGHT, and EF_NODRAW. EF_DARKLIGHT is a lighting effect that is a lot like EF_DIMLIGHT, except it subtracts all light instead of adding light. EF_DARKFIELD is exactly like TE_TELEPORT except its purple and is not a temporary effect. EF_LIGHT is EF_DIMLIGHT except for one thing, the radius on EF_DIMLIGHT is '200 + (rand()&31)', while EF_LIGHT is constant at 200. EF_NODRAW just skips drawing, you should use this on anything you don't want the model to show up for. In every step all you will really do is find the line and comment out '#ifdef QUAKE2' and '#endif'. So this is really very easy. Step 1: Open server.h and go down to about line 174. There you will find this: #ifdef QUAKE2 #define EF_DARKLIGHT 16 #define EF_DARKFIELD 32 #define EF_LIGHT 64 #define EF_NODRAW 128 #endif Step 2: Next open the render.h and go down to about line 134. and comment out #ifdef and #endif in these lines: #ifdef QUAKE2 void R_DarkFieldParticles (entity_t *ent); #endif Now open the client.h and go down to line 80. And simply comment out #ifdef and #endif in these lines: #ifdef QUAKE2 qboolean dark; // subtracts light instead of adding #endif Step 4: Goto line 536 in your cl_main.c. There in CL_RelinkEntities you need to comment out all cases of #ifdef QUAKE2 and #endif. These are all the cases you will find in that function: At line 536: #ifdef QUAKE2 if (ent->effects & EF_DARKFIELD) R_DarkFieldParticles (ent); #endif #ifdef QUAKE2 if (ent->effects & EF_DARKLIGHT) { dl = CL_AllocDlight (i); VectorCopy (ent->origin, dl->origin); dl->radius = 200.0 + (rand()&31); dl->die = cl.time + 0.001; dl->dark = true; } if (ent->effects & EF_LIGHT) { dl = CL_AllocDlight (i); VectorCopy (ent->origin, dl->origin); dl->radius = 200; dl->die = cl.time + 0.001; } #endif #ifdef QUAKE2 if ( ent->effects & EF_NODRAW ) continue; #endif In r_part.c you need to go to line 68. There you will find the function R_DarkFieldParticles. You need to comment out #ifdef QUAKE2 just above this function, and #endif just after it. Step 6: Now go to line 119 in the r_surf.c file. There you will find this: #ifdef QUAKE2 { unsigned temp; temp = (rad - dist)*256; i = t*smax + s; if (!cl_dlights[lnum].dark) blocklights[i] += temp; else { if (blocklights[i] > temp) blocklights[i] -= temp; else blocklights[i] = 0; } } #else blocklights[t*smax + s] += (rad - dist)*256; #endif Step 7: Next open the sv_main.c at line 444 you need to comment out #ifdef and #endif: #ifdef QUAKE2 // don't send if flagged for NODRAW and there are no lighting effects if (ent->v.effects == EF_NODRAW) continue; #endif Step 8: This step is only for GLQuake, if you do not entend to compile GLQuake then you can go to Step 9. Open gl_rsurf.c and go down until you find this line in the R_AddDynamicLights function: if (dist < minlight) blocklights[t*smax + s] += (rad - dist)*256; if (dist < minlight) { unsigned temp; temp = (rad - dist)*256; i = t*smax + s; if (!cl_dlights[lnum].dark) blocklights[i] += temp; else { if (blocklights[i] > temp) blocklights[i] -= temp; else blocklights[i] = 0; } } Step 9: QuakeC time! In the defs.qc at about line 383 add these lines after your other EF_ declarations: float EF_DARKLIGHT = 16; // EF_DIMLIGHT but subtracts all light float EF_DARKFIELD = 32; // purple particles that act like teleport particles float EF_LIGHT = 64; // EF_DIMLIGHT but stays constant radius float EF_NODRAW = 128; // skips drawing |