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...


2 posters

    [SDL code]More "doomish" gun bobbing.

    avatar
    WLHack
    Senior Member
    Senior Member


    Male
    Number of posts : 800
    Age : 35
    Location : Finland
    Registration date : 2007-03-26

    [SDL code]More "doomish" gun bobbing. Empty [SDL code]More "doomish" gun bobbing.

    Post by WLHack Thu Jan 21, 2010 1:54 am

    I got this idea from Tricobs thread for creating more Doom-like movement...
    First use this gun bobbing-routine by BrotherTank as a base (if you haven't
    installed gun bobbing yet)...

    Now in wl_agent.c go to Thrust() and change the values to these:
    Code:

      if (gamestate.bobdir != 1) gamestate.bobber++; else gamestate.bobber--;

      if (gamestate.bobber == 20 || gamestate.bobber == 0) gamestate.bobdir ^= 1;

      if (gamestate.bobdir2 != 1) gamestate.bobber2++; else gamestate.bobber2--;

      if (gamestate.bobber2 == 40 || gamestate.bobber2 == 0) gamestate.bobdir2 ^= 1;


    Now open up wl_draw.c and search for SimpleScaleShape... Change it to this form:
    Code:

    void SimpleScaleShape (int xcenter, int shapenum, unsigned height,int spc);

    Now add '0' as spcs value in every single reference to SimpleScaleShape except
    in the one found in DrawPlayerWeapon(). After you have done this - go to the
    DrawPlayerWeapon() look for a line looking like this:
    Code:
     SimpleScaleShape((viewwidth/2)-10+gamestate.bobber2,shapenum,viewheight+1+gamestate.bobber);
    And replace it with this:
    Code:

            SimpleScaleShape((viewwidth/2)-10+gamestate.bobber2,shapenum,viewheight+1,1);

        //  SimpleScaleShape((viewwidth/2)-10+gamestate.bobber2,shapenum,viewheight+1+(gamestate.bobber*2),0);

    Now you might wonder what does the line commented out do - it is only for comparasion...
    Then we have to go to the SimpleScaleShape() and edit it a bit to make this code work...

    Search for this line in SimpleScaleShape():
    Code:
    upperedge=viewheight/2-scale;

    And replace it with this:
    Code:
        if(spc==1)

          upperedge=viewheight/2-scale+(gamestate.bobber*2);

        else

          upperedge=viewheight/2-scale;

    Now when you recompile your source - instead of weapon scaling
    smaller / larger while moving - it actually "bobs" up and down.

    NOTE: This code should work with the original DOS-side of code aswell...





    Hammer: I can see it now: you and the moon - wear a necktie so I'll know you.
    Building a new webpage...
    jayngo26
    jayngo26
    Spear of Destiny
    Spear of Destiny


    Male
    Number of posts : 643
    Age : 144
    Location : Random
    Job : Partime Evil Semi-Genius Plotting To Take Over Half The World. Partime Undead Charged With Keeping the Darkness Dark
    Hobbie : Staying Out Of Sunlight
    Message : Wolfenstein:Umbrella Beginnings Episode 2 released! Download now!

    Registration date : 2008-08-09

    [SDL code]More "doomish" gun bobbing. Empty Re: [SDL code]More "doomish" gun bobbing.

    Post by jayngo26 Thu Jan 21, 2010 12:48 pm

    Nice code WLHack! I am looking to getting into the SDL for my Episode 3 mod, but that won't be for a while still. I love that you are doing SDL code tutorials on this forum. But what we really need is a tutorial explaining SDL, what program is needed to compile (like code blocks) and exactly how to start working with SDL and compiling it. I have absolutely no idea how to start up any of that. I would also like to "convert" my first two episodes to SDL, just not sure what is all involved.



    http://jayngoware.com/
    avatar
    WLHack
    Senior Member
    Senior Member


    Male
    Number of posts : 800
    Age : 35
    Location : Finland
    Registration date : 2007-03-26

    [SDL code]More "doomish" gun bobbing. Empty Re: [SDL code]More "doomish" gun bobbing.

    Post by WLHack Thu Jan 21, 2010 2:24 pm

    Okay... I will write a general tutorial for SDL during the weekend.



    Hammer: I can see it now: you and the moon - wear a necktie so I'll know you.
    Building a new webpage...
    jayngo26
    jayngo26
    Spear of Destiny
    Spear of Destiny


    Male
    Number of posts : 643
    Age : 144
    Location : Random
    Job : Partime Evil Semi-Genius Plotting To Take Over Half The World. Partime Undead Charged With Keeping the Darkness Dark
    Hobbie : Staying Out Of Sunlight
    Message : Wolfenstein:Umbrella Beginnings Episode 2 released! Download now!

    Registration date : 2008-08-09

    [SDL code]More "doomish" gun bobbing. Empty Re: [SDL code]More "doomish" gun bobbing.

    Post by jayngo26 Thu Jan 21, 2010 4:55 pm

    You da' man Hack' [SDL code]More "doomish" gun bobbing. Icon_cool



    http://jayngoware.com/

    Sponsored content


    [SDL code]More "doomish" gun bobbing. Empty Re: [SDL code]More "doomish" gun bobbing.

    Post by Sponsored content


      Current date/time is Thu Nov 21, 2024 4:04 am