Created By: carnage
eMail: carnage@xprt.net
Difficulty Scale: Easy


Adding RF_SHELL effects to items: Part 1

This will show you how to add a colored shell to any spawned item. In this
example we will first give the shotgun a green shell then we will add a
colored shell to the ctf tech runes.


Open g_items.c and find the SpawnItem function.
Right after ent->s.renderfx = RF_GLOW; put:

        if (strcmp(ent->classname, "weapon_shotgun") == 0){
                ent->s.renderfx = RF_FULLBRIGHT;
                ent->s.effects |= EF_COLOR_SHELL;
                ent->s.renderfx |= RF_SHELL_GREEN;
        }

All this says is that if the spawned entity is the shotgun then give it a
SHELL that is the color GREEN. "weapon_shotgun" is the classname for the
shotgun... you can find classnames for other items in gitem_t itemlist[]
just below the SpawnItem function. 


If you want other items to have the same effect you could do this:

        if ((strcmp(ent->classname, "weapon_shotgun") == 0) || 
           (strcmp(ent->classname, "weapon_supershotgun") == 0)){
                ent->s.renderfx = RF_FULLBRIGHT;
                ent->s.effects |= EF_COLOR_SHELL;
                ent->s.renderfx |= RF_SHELL_GREEN;
        }

This says if the spawned item is a shotgun or or a supershotgun then give it
a SHELL that is the color GREEN.


If you want everything to have the above effect, then just get rid of the if
statement so that it looks like this:

        ent->s.renderfx = RF_FULLBRIGHT;
        ent->s.effects |= EF_COLOR_SHELL;
        ent->s.renderfx |= RF_SHELL_GREEN;


 
Adding colored shells to CTF tech runes: Part 2 (Requires CTF code)

Open g_ctf.c and find the SpawnTech function.
Right after ent->s.renderfx = RF_GLOW; put:

        ent->s.effects |= EF_COLOR_SHELL;
        if (strcmp(ent->classname, "item_tech1") == 0){
                ent->s.renderfx |= RF_SHELL_BLUE;
        }
        if (strcmp(ent->classname, "item_tech2") == 0){
                ent->s.renderfx |= RF_SHELL_RED;
        }
        if (strcmp(ent->classname, "item_tech3") == 0){
                ent->s.renderfx |= RF_SHELL_DOUBLE;
        }
        if (strcmp(ent->classname, "item_tech4") == 0){
               ent->s.renderfx |= RF_SHELL_GREEN;
        }

This does the same thing as the shotgun example with one exception... the
RF_FULLBRIGHT and EF_COLOR_SHELL are not in each if statement. Why...
because we plan on giving all etches a colored shell and we don't have to
repeat it four times!


Open g_items.c and find *Drop_Item function.
Right after dropped->s.renderfx = RF_GLOW; put:

        dropped->s.effects |= EF_COLOR_SHELL;
        if (strcmp(dropped->classname, "item_tech1") == 0){
                dropped->s.renderfx |= RF_SHELL_BLUE;
        }
        if (strcmp(dropped->classname, "item_tech2") == 0){
                dropped->s.renderfx |= RF_SHELL_RED;
        }
        if (strcmp(dropped->classname, "item_tech3") == 0){
                dropped->s.renderfx |= RF_SHELL_DOUBLE;
        }
        if (strcmp(dropped->classname, "item_tech4") == 0){
               dropped->s.renderfx |= RF_SHELL_GREEN;
        }

This will make sure the tech will have a colored shell after it has been
droped.

Here are the RF_SHELL colors:
RF_SHELL_BLUE
RF_SHELL_RED
RF_SHELL_GREEN
RF_SHELL_DOUBLE
RF_SHELL_HALF_DAM


-Carnage