
Posted by Rich B.
(209.102.125.*) on March 27, 1999 at 07:36:22:
Adding that cool Lithium
shell effect to items
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.effects |= EF_COLOR_SHELL;
ent->s.renderfx |= RF_SHELL_GREEN;
}
All this says is that if
the spawned entity is the shotgun then make it shine FULLBRIGHT, give it a
SHELL that it the color GREEN. "weapon_shotgun" is the classname for
the shotgun... you can find classnames for other items in gitem_t itemlist[]
jus 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.effects |= EF_COLOR_SHELL;
ent->s.renderfx |= RF_SHELL_GREEN;
}
This says if the spawned
item is a shotgun or a supershotgun then make it shine FULLBRIGHT, give it a
SHELL that it 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.effects |=
EF_COLOR_SHELL;
ent->s.renderfx |= RF_SHELL_GREEN;
Adding colored shells to CTF tech runes.
Open g_ctf.c and find the SpawnTech function.
Right after
ent->s.renderfx = RF_GLOW; put:
ent->s.renderfx =
RF_FULLBRIGHT;
ent->s.effects |= EF_COLOR_SHELL;
if
(strcmp(ent->classname, "item_tech1") == 0){
ent->s.renderfx |= RF_SHELL_GREEN;
}
if (strcmp(ent->classname, "item_tech2") == 0){
ent->s.renderfx |= RF_SHELL_BLUE;
}
if (strcmp(ent->classname, "item_tech3") == 0){
ent->s.renderfx |= RF_SHELL_RED;
}
if (strcmp(ent->classname, "item_tech4") == 0){
ent->s.renderfx |= RF_SHELL_DOUBLE;
}
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! Use RF_SHELL_DOUBLE
for yellow and RF_SHELL_HALF_DAM for white.
-Rich B.
Posted by Rich B. (209.102.125.*) on March 27, 1999 at
08:16:28:
In Reply to: Lithium
Shell Effects posted by Rich B. on March 27, 1999 at 07:36:22:
Ok... another Dhoooo!
I noticed that when you drop a ctf tech... it no longer has the shell effect!
So here is the fix!
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.
-Rich B.
Follow Ups
Posted by Rich B. (209.102.125.*) on March 27, 1999 at
07:48:34:
In Reply to: Lithium
Shell Effects posted by Rich B. on March 27, 1999 at 07:36:22:
I mentioned RF_FULLBRIGHT but forgot to add that into the
tutorial. Dhoooo!
In each example, just add ent->s.renderfx = RF_FULLBRIGHT
just above ent->s.effects |= EF_COLOR_SHELL;
ent->s.renderfx = RF_FULLBRIGHT is not nessesary but is
nice to have if for some reason the item or tech spawns into a dark area.
-Rich B.
Ohh, sorry about that
last post... was a frigin button fumble!
Follow Ups
Posted by Rich B. (209.102.125.*) on March 27, 1999 at
07:41:10:
In Reply to: Lithium
Shell Effects posted by Rich B. on March 27, 1999 at 07:36:22:
: Adding that cool Lithium shell effect to items
: 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.effects |= EF_COLOR_SHELL;
: ent->s.renderfx |= RF_SHELL_GREEN;
: }
: All this says is that if the spawned entity is the shotgun
then make it shine FULLBRIGHT, give it a SHELL that it the color GREEN.
"weapon_shotgun" is the classname for the shotgun... you can find
classnames for other items in gitem_t itemlist[] jus 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.effects |= EF_COLOR_SHELL;
: ent->s.renderfx |= RF_SHELL_GREEN;
: }
: This says if the spawned item is a shotgun or a
supershotgun then make it shine FULLBRIGHT, give it a SHELL that it 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.effects |= EF_COLOR_SHELL;
: ent->s.renderfx |= RF_SHELL_GREEN;
:
: Adding colored shells to CTF tech runes.
: Open g_ctf.c and find the SpawnTech function.
: Right after ent->s.renderfx = RF_GLOW; put:
: ent->s.renderfx = RF_FULLBRIGHT;
: ent->s.effects |= EF_COLOR_SHELL;
: if (strcmp(ent->classname, "item_tech1") ==
0){
: ent->s.renderfx |= RF_SHELL_GREEN;
: }
: if (strcmp(ent->classname, "item_tech2") == 0){
: ent->s.renderfx |= RF_SHELL_BLUE;
: }
: if (strcmp(ent->classname, "item_tech3") == 0){
: ent->s.renderfx |= RF_SHELL_RED;
: }
: if (strcmp(ent->classname, "item_tech4") == 0){
: ent->s.renderfx |= RF_SHELL_DOUBLE;
: }
: 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! Use RF_SHELL_DOUBLE for yellow and RF_SHELL_HALF_DAM
for white.
:
: -Rich B.