Today we are
going to look at a simple Poison implementation. How it came about, and
what we have done with it. Basically we are going to work in the following
SIDE NOTE: Pay attention to the coma usage towards the end of a typedef. If you forget to add a coma, or use an extra, you will get many-a-errors(TM).
Somewhere around line 222 there is a powerup typedef enum. looks like this:
We are going to
add PW_POISON to the bottom of this. Inside the } bracket
We add it this way to ensure that the current functionality of all
Also in bg_public.h look for a typedef named meansOfDeath_t (about line 446). Should read as follows:
Now, this is the place the game defines what means of death there are... Obviously we are going to be able to die from poison, so we must add our own means of death. Should now read like this....
For our MOD, we chose to have it use standard maps. Meaning, no special maps were needed. The MOD plays on every standard map out there. No one has to sit and change entities, or create all new maps to enjoy it. Thus we will be removing, and or changing quake 3's original items.
We are going to change the sound, model, icon, pickup name,
giType, and giTag... For the sound we are going to use the holdable items
.wav. Notice on our 5th line of code below. You can obviously choose any
sound you like, but we liked that sound, and it was discrete Didn't let
anyone know what you picked up. We obviously used our own model on line 6
and 7. The 0,0,0), on line 7 just tells the game there is only one model.
No outer sphere or ring. etc.etc.etc. Line 8 of a definition in bg_misc.c
is where it gets the icon for items. This first checks the known shaders
to see if there is a reference to this icon. If not it looks in the named
directory for the file. Line 9 defines the pickup name. This is shown to
players when they pick up items, as well as bot AI. Line 10 determines the
amount given. Here, since powerups are given for a length of time, the 30
has no meaning... Line 11 tells the game what type of item it is. We
changed it from IT_WEAPON to IT_POWERUP because if you remember we defined
PW_POISON inside the powerup_t earlier.
Towards the bottom of the "gitem_t bg_itemlist"... after all the items but before (NULL)...
We need to add the PW_POISONED info here as well as re-adding the rocket launcher item...just to ensure that quake 3's original coding still works. This way, if something references the rocket launcher...the game will not crash. This also takes care of the poisoned icon so you have a neat little HUD display for your ass getting damaged....So it should look like the following:
Model and sound do not matter for the Poisoned powerup as all we care about is the icon when you get poisoned and are taking damage......
That is about all for actually getting the powerup into the game. No lets continue on for what it should DO!!!
|news | projects | FoF | tactics | download | tutorials | team|