Adding a Back Pack Type Item (Like in Doom):

By Joe

 

Note that this requires adding a new bonus item. You will need to do that yourself, though the details of the item's code are defined.

 

First, open the file "WL_DEF.H", then run a search for "gamestate".

You should find several lines like this:

 

int ammo;

int health;

 

Add a new line that looks like this:

 

int backpack;

 

 

Save and close WL_DEF.H, and open "WL_MAIN.C". In this file, run a search for "newgame". Scroll down to just before the closing bracket and add in this line:

 

gamestate.backpack = 0;

 

Close "WL_PLAY.C" and then open "WL_GAME.C". Once opened, search for "gamestate.lives--;". Scroll down and add below "DrawLives ();" the following:

 

gamestate.backpack = 0;;

 

Save and close, then, lastly, open "WL_AGENT.C". Run a search for GiveAmmo. Scroll down to the line that reads:

 

if (gamestate.ammo >= 99)

gamestate.ammo == 99;

 

Modify it to read like this:

 

if (gamestate.backpack = 1)

{

if (gamestate.ammo >= 200) // change 200 to your liking

gamestate.ammo = 200;

}

else

{

if (gamestate.ammo >=99)

gamestate.ammo = 99;

}

 

Still in "WL_AGENT.C", search for the place where you added the bonus item to the code. Mine is called "bo_backpack" in this example. Write the case as follows:

 

case bo_backpack:

if (gamestate.backpack = 1)

return;

else

gamestate.backpack++;

break;

 

And that's it! Compile and link up. Enjoy your new backpack item.