Wolf3d Haven Forum

Please log in or register. Smile

Join the forum, it's quick and easy

Wolf3d Haven Forum

Please log in or register. Smile

Wolf3d Haven Forum

Would you like to react to this message? Create an account in a few clicks or log in to continue.
Wolf3d Haven Forum

A friendly Wolfenstein 3D community, about Wolfenstein 3D, the game that gave birth to first person shooters...


    Wolf 3D source code help

    Officer-Michael John
    Officer-Michael John
    Seasoned Wolfer
    Seasoned Wolfer


    Male
    Number of posts : 332
    Age : 26
    Hobbie : Video and Wolf 3D mode making
    Registration date : 2014-08-04

    Wolf 3D source code help Empty Wolf 3D source code help

    Post by Officer-Michael John Mon Dec 07, 2015 4:06 am

    I probaly adding an ammostock routine (Like it Project:Verwüstung) and avoid getting a lower weapon with a higher one (Like it Project:TotenEisenritter) in Wolf4SDL.

    Ammostock routine:

    WL_AGENT.CPP:

    Code:
    case    bo_ammostock:
                switch(gamestate.ammo)
          {
          case 1:
             {
                if (gamestate.ammo == 100)
                   return;
                GiveAmmo (100);   
             }
             break;
          case 2:
             {
                if (gamestate.ammo == 200)
                   return;
                GiveAmmo (200);
             }
             break;
          case 3:
             {
                if (gamestate.ammo == 300)
                   return;
                GiveAmmo (300);
             }
             break;
          case 4:
             {
                if (gamestate.ammo == 400)
                   return;
                GiveAmmo (400);
             }
             break;
          case 5:
             {
                if (gamestate.ammo == 500)
                   return;               
                GiveAmmo (500);
             }
             break;   
           case 6:
             {
                if (gamestate.ammo == 600)
                   return;
                GiveAmmo (600);
             }
             break;   
          case 7:
             {
                if (gamestate.ammo == 700)
                   return;
                GiveAmmo (700);
             }
             break;
            case 8:
             {
                if (gamestate.ammo == 800)
                   return;
                GiveAmmo (800);
             }
             break;
              case 9:
             {
                if (gamestate.ammo == 900)
                   return;
                GiveAmmo (900);
             }
             break;   
              case 10:
             {
                if (gamestate.ammo == 1000)
                   return;
                GiveAmmo (1000);
             }
             break;            
          }   
           
                SD_PlaySound (BONUS4SND);
                break;

    avoid getting a lower weapon with a higher one routine:

    WL_AGENT.CPP:

    Code:
    void CheckWeaponChange (void)
    {
        int newWeapon = -1;

        if (!gamestate.ammo)            // must use knife with no ammo
            return;
           
    {
    if (Keyboard[sc_1])
    gamestate.weapon = gamestate.chosenweapon = wp_knife;

    else if (Keyboard[sc_2])
    gamestate.weapon = gamestate.chosenweapon = wp_pistol;

    else if (Keyboard[sc_3])
    gamestate.weapon = gamestate.chosenweapon = wp_machinegun;

    else if (Keyboard[sc_4] && gamestate.chaingun)
    gamestate.weapon = gamestate.chosenweapon = wp_chaingun;
    }       

    #ifdef _arch_dreamcast
        int joyx, joyy;
        IN_GetJoyFineDelta (&joyx, &joyy);
        if(joyx < -64)
            buttonstate[bt_prevweapon] = true;
        else if(joyx > 64)
            buttonstate[bt_nextweapon] = true;
    #endif

        if(buttonstate[bt_nextweapon] && !buttonheld[bt_nextweapon])
        {
            newWeapon = gamestate.weapon + 1;
            if(newWeapon > gamestate.bestweapon) newWeapon = 0;
        }
        else if(buttonstate[bt_prevweapon] && !buttonheld[bt_prevweapon])
        {
            newWeapon = gamestate.weapon - 1;
            if(newWeapon < 0) newWeapon = gamestate.bestweapon;
        }
        else
        {
            for(int i = wp_knife; i <= gamestate.bestweapon; i++)
            {
                if (buttonstate[bt_readyknife + i - wp_knife])
                {
                    newWeapon = i;
                    break;
                }
            }
        }

        if(newWeapon != -1)
        {
            gamestate.weapon = gamestate.chosenweapon = (weapontype) newWeapon;
            DrawWeapon();
        }
    }

    void GiveWeapon (int weapon)
    {
      switch(gamestate.weapon)

    {
    case wp_pistol:
    GiveAmmo (4);
    break;

    case wp_machinegun:
    GiveAmmo (6);
    break;

    case wp_chaingun:
    gamestate.chaingun = 1;
    GiveAmmo (8);
    break;
    }

        if (gamestate.bestweapon<weapon)
            gamestate.bestweapon = gamestate.weapon
            = gamestate.chosenweapon = (weapontype) weapon;

        DrawWeapon ();
    }

      Current date/time is Thu Nov 07, 2024 5:28 pm