• View unanswered postsView active topics

  • [Tutorial] Animating menu cursor & End Level BJ w/ 3+ frames

    Discuss Wolf3D and Wolf3D modding/ports

    Postby Tricob1974 31 Mar 2011, 05:39

    Until the New Topic feature in DHWs is working again, here's the tutorial for anyone interested. :)

    The tutorial enhances the animation of the menu cursor and/or the BJ pics in the LevelCompleted screen, so now it can use as many frames as you like.

    First off, go into VERSION.H, and add in these lines somewhere:
    Code: Select all
    #define VGAGRANIM               // Enable new animation code for the menu cursor

    #define FRAMES4MENU          8  // # of animation frames for menu pointer
    #define ANIMSPEED4MENU       6  // Animation speed for menu pointer

    #define FRAMES4LVLEND        8  // # of animation frames for Level Complete pics
    #define ANIMSPEED4LVLEND     16 // Animation speed for Level Complete pics

    FRAMES4MENU tells the code how many frames of animation to use for the menu cursor. ANIMSPEED4MENU sets the speed for the animation (Zero is the fastest).

    FRAMES4LVLEND sets the number of frames to use for BJ's animation in the Level Complete screen. ANIMSPEED4LVLEND sets the speed of the animation.

    Now, you'll need to go into GFXV_WL6.H (or GFXV_APO.H) to add in the new frames for the VGAGRAPH. Below this code ...
    Code: Select all
        C_CURSOR1PIC,                // 23
        C_CURSOR2PIC,                // 24

    ... insert this:
    Code: Select all
    #if defined(VGAGRANIM)
        C_CURSOR3PIC,                //
        C_CURSOR4PIC,                //
        C_CURSOR5PIC,                //
        C_CURSOR6PIC,                //
        C_CURSOR7PIC,                //
        C_CURSOR8PIC,                //
    #endif

    And below this:
    Code: Select all
        // Lump Start
        L_GUYPIC,                    // 55

    Insert this:
    Code: Select all
    #if defined(VGAGRANIM)
        L_GUY2PIC,                    // 55
        L_GUY3PIC,                    // 55
        L_GUY4PIC,                    // 55
        L_GUY5PIC,                    // 55
        L_GUY6PIC,                    // 55
        L_GUY7PIC,                    // 55
        L_GUY8PIC,                    // 55
    #endif

    Search for "GUY2PIC", just below this code. You should see this:
    Code: Select all
        L_GUY2PIC,                   // 96

    Change it to:
    Code: Select all
    #if !defined(VGAGRANIM)
        L_GUY2PIC,                   // 96
    #endif

    When you add the animation frames in the VGAGRAPH with WDC or ChaosEdit, you'll need to delete the second BJ pic between the apostrophe and the BJ Wins pic. All BJ animation frames should be put where the first BJ pic is for the Level Complete screen.

    Now, in WL_INTER.CPP, search for "Breathe Mr". You should see this:
    Code: Select all
    //
    // Breathe Mr. BJ!!!
    //
    void
    BJ_Breathe (void)
    {

    Change the routine to read like this:
    Code: Select all
    //
    // Breathe Mr. BJ!!!
    //
    void
    BJ_Breathe (void)
    {
    #ifndef VGAGRANIM
        static int which = 0, max = 10;
        int pics[2] = { L_GUYPIC, L_GUY2PIC };
    #else
        static int which = 0, max = 0;
    #endif

        SDL_Delay(5);

        if ((int32_t) GetTimeCount () - lastBreathTime > max)
        {
    #ifdef VGAGRANIM
            which ++;
            if (which >= FRAMES4LVLEND) which = 0;
            VWB_DrawPic (0, 16, L_GUYPIC+which);
            max = ANIMSPEED4LVLEND;
    #else
            which ^= 1;
            VWB_DrawPic (0, 16, pics[which]);
            max = 35;
    #endif
            VW_UpdateScreen ();
            lastBreathTime = GetTimeCount();
        }
    }

    This is all the code you need to get the animation running, *but* the animation will "freeze" for a moment whenever a 100% or 0% is displayed in the ratios. This is because it uses the "VW_WaitVBL" command. So, let's fix that.

    Do a search for "VBLWAIT". You should see this line:
    Code: Select all
    #define VBLWAIT 30

    Insert this line just below it:
    Code: Select all
    #define BREATHCOUNT     (VBLWAIT/2)

    Now, for every set of code in the LevelCompleted routine that has this:
    Code: Select all
                VW_WaitVBL (VBLWAIT);
                SD_StopSound ();

    Change it to this:
    Code: Select all
    #ifdef VGAGRANIM
            for (i = 0; i <= BREATHCOUNT; i++)
            {
                VW_WaitVBL (2);
                BJ_Breathe ();
                }                 
    #else
                VW_WaitVBL (VBLWAIT);
    #endif
                SD_StopSound ();

    That should do it. :)
    Tricob1974
    Team RayCast member
    Team RayCast member
     
    Posts: 1384
    Location: Huntsville, Alabama

        

    The following user would like to thank Tricob1974 for this post
    Andy, DoomJedi

    Return to General Wolf3D/modding Discussion and tutorials


    Who is online

    Users browsing this forum: No registered users and 2 guests

    cron