How to avoid getting a lower weapon with a higher one
By Joe
First note, I've seen other guides on how to do this, but I found them far to complex. I found my own way to do it, even though it is really quite similar to the existing ones.
Let's get started: Open up "WL_DEF.H," and locate the following lines:
//---------------
//
// gamestate structure
//
//---------------
typedef struct
{
int difficulty;
int mapon;
long oldscore,score,nextextra;
int lives;
int health;
int ammo;
int keys;
Right here, you need to add the following lines:
int pistol;
int mp40;
int chaingun;
Add more int statements if you have more weapons. You can close this file, now. You need to oepn "WL_AGENT.C," now. Once opened, run a search for "CheckWeaponChange." Erase the entire function. Write in it's place, this:
//---------------
//
// CheckWeaponChange
//
// Number Keys Switch Weapons
//
//---------------
void CheckWeaponChange (void)
{
if (Keyboard[sc_1])
gamestate.weapon = gamestate.chosenweapon = wp_knife;
else if (Keyboard[sc_2] && gamestate.pistol = 1)
gamestate.weapon = gamestate.chosenweapon = wp_pistol;
else if (Keyboard[sc_3] && gamestate.mp40 = 1)
gamestate.weapon = gamestate.chosenweapon = wp_machinegun;
else if (Keyboard[sc_4} && gamestate.chaingun = wp_chaingun = 1)
gamestate.weapon = gamestate.chosenweapon = wp_chaingun;
}
We're not done just yet. Still in this file, fine the function "GiveWeapon." Modify it to look like the following:
//---------------
//
// GiveWeapon
//
//---------------
void GiveWeapon (void)
switch(gamestate.weapon)
{
case wp_pistol:
gamestate.pistol = 1;
GiveAmmo (4);
break;
case wp_machinegun:
gamestate.mp40 = 1;
GiveAmmo (6);
break;
case wp_chaingun:
gamestate.chaingun = 1;
GiveAmmo (8);
break;
// Add more case statements for additional weapons
}
We're almost done with WL_AGENT, but not just yet. Now we modify our bonus items. Search for "bo_clip." You'll find a line like this:
case bo_clip:
if (gamestate.ammo == 99)
return;
GiveAmmo (8);
break;
case bo_clip2:
if (gamestate.ammo == 99)
return;
GiveAmmo (4);
break;
Change those lines to this:
case bo_clip:
case bo_clip2:
if (gamestate.ammo == 99)
return;
GiveWeapon (wp_pistol);
break;
Scroll down to the line that reads like this:
case bo_machinegun:
SD_PlaySound (GETMACHINESND);
GiveWeapon (wp_machinegun);
break;
Change it into this:
case bo_machinegun:
if (gamestate.ammo == 99 && gametate.mp40 == 1)
return;
GiveWeapon (wp_machinegun)
SD_PlaySound (GETMACHINESND);
break;
Once again, scroll down. Look for the lines like these:
case bo_chaingun:
if (gamestate.ammo == 99 && gamestate.chaingun = 1) // #
return; // #
SD_PlaySound (GETGATLINGSND);
GiveWeapon (wp_chaingun);
StatusDrawPic (17,4,GOTGATLINGPIC)
facecount = 0;
gotgatgun = 1;
break;
Add in the lines marked with the # at the end. That's all for WL_AGENT. Now open "WL_MAIN.C." Search for "newgame." Scroll down to where it reads:
gamestate.ammo = STARTAMMO;
Add below this line, the following lines:
gamestate.pistol = 1;
gamestate.mp40 = 0;
gamestate.chaingun = 0;
// Add more 'gamestate.weapon = 0' statements if you have more weapons.
Save and close. Now open "WL_GAME.C," and search for "if (gamestate.lives > -1)" Scroll down just a bit to find the line "gamestate.ammo = STARTAMMO." Add under this line the lines you just added to "WL_MAIN.C." After you've done this, save and compile. You've now added a nifty new feature. Not to mention you no longer pick up machine guns and chainguns if you don't actually need them.