Making a fifth weapon jam
Select messages from
# through # FAQ
[/[Print]\]

DieHard Wolfers -> SDL Code Crackers

#1: Making a fifth weapon jam Author: ronwolf1705 PostPosted: Fri Dec 29, 2017 6:28 am
    —
http://www.wolfenstein3d.co.uk/coding-jamming.htm

This tutorial makes your chaingun jam at random times, losing it in the process. But say that I wanted to add this jamming feature to a different, new fifth weapon. Where would I add this? Since the fifth weapon doesn't have a case like the chaingun.

#2: Re: Making a fifth weapon jam Author: TricobLocation: Neo-traditions, Inc. PostPosted: Fri Dec 29, 2017 11:28 am
    —
The "4" that you see appear in the updated code first shows up in WL_AGENT.CPP ... almost at the very top. You should see an array of numbers for the weapons, and it looks something like this:
::: CODE :::
} attackinfo[4][14] =
{
    { {6,0,1},{6,2,2},{6,0,3},{6,-1,4} },
    { {6,0,1},{6,1,2},{6,0,3},{6,-1,4} },
    { {6,0,1},{6,1,2},{6,3,3},{6,-1,4} },
    { {6,0,1},{6,1,2},{6,4,3},{6,-1,4} },
    { {6,0,1},{6,1,2},{6,5,3},{6,-1,4} },
};

Note how each set of numbers is grouped together into three numbers. The "4" in question is the middle number. Whenever that number is called up, that's when the "jamming" code is called up.

#3: Re: Making a fifth weapon jam Author: ronwolf1705 PostPosted: Fri Dec 29, 2017 1:26 pm
    —
Thanks, Tricob! For those interested, in T_Attack add a case like this (if your new weapon isn't chaingun-like):

::: CODE :::
            case 5:
                if (!gamestate.ammo)
                    break;
                if (US_RndT()<63)    // Approximately 1 in 4 chance of it jamming
                {
                    if (US_RndT()<65)
                    {
                        SD_PlaySound(TAKEDAMAGESND);// choose a sound
                        buttonstate[bt_attack] = false;
// IN_ClearKeysDown ();
                        gamestate.attackframe = gamestate.weaponframe = 0;
                        gamestate.bestweapon = gamestate.chosenweapon = gamestate.weapon = wp_chaingun;     // Switch to chaingun
                        DrawWeapon ();
                        break;
                    }
                }



DieHard Wolfers -> SDL Code Crackers


output generated using printer-friendly topic mod. All times are GMT

Page 1 of 1

Powered by phpBB © 2001, 2005 phpBB Group