Wolf3d Haven Forum

Please log in or register. Smile
Wolf3d Haven Forum

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


    Need to add a second customization menu for the Controls

    Share

    Metalor
    Bring em' On!
    Bring em' On!

    Number of posts : 157
    Age : 26
    Registration date : 2012-04-05

    Need to add a second customization menu for the Controls

    Post by Metalor on Tue Apr 17, 2012 9:17 pm

    I'm currently in the process of trying to add a way to customize the Arrow Keys and the Crosshair and Medkit function keys.

    I had replaced the original movement routine with one that allows the usage of the WASD keys in tandom with the Mouse, and those keys have replaced the Arrow Keys in the customization menu. The arrow keys still function as always, only now the player can't customize them to their liking. This is fine on its own, but I would still like to be able to customize these keys anyway, so I want to add a second customization menu (adding the tab that would lead to the menu I can easily do, it's adding the menu itself that's confusing me to no end).

    Anyone mind helping me out with this? I'm slowly piecing the stuff together, but I need someone's assistance or aid to fully understand what I'm doing.

    linuxwolf
    Bring em' On!
    Bring em' On!

    Male
    Number of posts : 159
    Age : 34
    Location : Australia
    Hobbie : Games
    Registration date : 2011-12-25

    Re: Need to add a second customization menu for the Controls

    Post by linuxwolf on Tue Apr 17, 2012 11:41 pm

    In Split Wolf I added a new settings page by creating new input handling and draw routines, and hooking them into the god-awful wolf3d menu framework. You should be able to use this idea as well. Feel free to hack away at this code until it meets your requirements.

    Code:
    diff a/wl_menu.cpp b/wl_menu.cpp
    index 407f545..9f2d2f4 100755
    --- a/wl_menu.cpp
    +++ b/wl_menu.cpp
    @@ -123,19 +119,21 @@ CP_itemtype SndMenu[] = {
     #endif
     };
     
    -enum { CTL_MOUSEENABLE, CTL_MOUSESENS, CTL_JOYENABLE, CTL_CUSTOMIZE };
    +enum { CTL_MOUSEENABLE, CTL_MOUSESENS, CTL_JOYENABLE, CTL_CUSTOMIZE, CTL_SPLITSCREEN };
     
     CP_itemtype CtlMenu[] = {
     #ifdef JAPAN
        {0, "", 0},
        {0, "", MouseSensitivity},
        {0, "", 0},
    -    {1, "", CustomControls}
    +    {1, "", CustomControls},
    +    {1, "", SplitScreenSettings}
     #else
        {0, STR_MOUSEEN, 0},
        {0, STR_SENS, MouseSensitivity},
        {0, STR_JOYEN, 0},
    -    {1, STR_CUSTOM, CustomControls}
    +    {1, STR_CUSTOM, CustomControls},
    +    {1, STR_SPLITSCREEN, SplitScreenSettings}
     #endif
     };
     
    @@ -1938,6 +1904,7 @@ CP_Control (int)
     
                case CTL_MOUSESENS:
                case CTL_CUSTOMIZE:
    +            case CTL_SPLITSCREEN:
                    DrawCtlScreen ();
                    MenuFadeIn ();
                    WaitKeyUp ();
    @@ -2902,6 +2869,254 @@ DrawCustKeys (int hilight)
            PrintCustKeys (i);
     }
     
    +////////////////////////////////////////////////////////////////////
    +//
    +// SPLIT SCREEN SETTINGS
    +//
    +////////////////////////////////////////////////////////////////////
    +//
    +
    +enum
    +{
    +    MP_ITEM_PLAYERS,
    +    MP_ITEM_LAYOUT,
    +    MP_ITEM_MINIMAP_ROTATED,
    +    MP_NUMITEMS,
    +};
    +
    +#define MP_ITEM_X          50
    +#define MP_ITEM_X2        130
    +#define MP_ITEM_LINESPACE  14
    +#define MP_CURSOR_X        15
    +#define MP_TOPGAP          6
    +#define MP_ITEM_SELECT_GAP 30
    +
    +#define MP_X              30
    +#define MP_W              (MaxX - (MP_X * 2))
    +
    +#define MP_H              ((MP_NUMITEMS * MP_ITEM_LINESPACE) + MP_TOPGAP * 2)
    +#define MP_Y              ((MaxY - MP_H) / 2)
    +
    +#define MP_ITEM_Y(i)      (MP_Y + MP_TOPGAP + (MP_ITEM_LINESPACE * (i)))
    +#define MP_ITEM_HALFSTEP  (MP_ITEM_LINESPACE / 2)
    +
    +#define MP_HALFSTEP_TIME  6
    +#define MP_INPUT_FREQ      18
    +
    +static int mpCurItem = 0;
    +static int mpNextItem = 0;
    +static int mpCursorShape = C_CURSOR1PIC;
    +
    +void MpDrawText (int x, int y, byte textColor, const char *str)
    +{
    +    SETFONTCOLOR (textColor, BKGDCOLOR);
    +    PrintX = x, PrintY = y;
    +    US_Print (str);
    +}
    +
    +void MpDrawTextCentered (int y, byte textColor, const char *str)
    +{
    +    SETFONTCOLOR (textColor, BKGDCOLOR);
    +    PrintX = 0, PrintY = y;
    +    US_CPrint (str);
    +}
    +
    +void
    +DrawSplitScreenSettings (void)
    +{
    +    int x, y;
    +    byte textColor;
    +
    +    ClearMScreen ();
    +    WindowX = 0;
    +    WindowW = MaxX;
    +    DrawStripes (10);
    +    VWB_DrawPic (80, 0, C_CUSTOMIZEPIC);
    +    VWB_DrawPic (112, 184, C_MOUSELBACKPIC);
    +
    +    WindowX = 0;
    +    WindowW = MaxX;
    +    DrawWindow (MP_X, MP_Y, MP_W, MP_H, BKGDCOLOR);
    +
    +    y = MP_Y - MP_ITEM_LINESPACE;
    +    MpDrawTextCentered(y, READCOLOR, STR_SPLITSCREEN);
    +
    +    // draw items
    +    {
    +        x = MP_X + MP_ITEM_X;
    +
    +        y = MP_ITEM_Y(MP_ITEM_PLAYERS);
    +        textColor = mpCurItem == MP_ITEM_PLAYERS ? HIGHLIGHT : TEXTCOLOR;
    +        MpDrawText(x, y, textColor, "Players (1-4)");
    +        MpDrawText(x + MP_ITEM_X2, y, textColor, LWMP_Va("%d", LWMP_NUM_PLAYERS));
    +       
    +        y = MP_ITEM_Y(MP_ITEM_LAYOUT);
    +        textColor = mpCurItem == MP_ITEM_LAYOUT ? HIGHLIGHT : TEXTCOLOR;
    +        MpDrawText(x, y, textColor, "Layout");
    +        MpDrawText(x + MP_ITEM_X2, y, textColor, LWMP_GetLayoutString());
    +
    +        y = MP_ITEM_Y(MP_ITEM_MINIMAP_ROTATED);
    +        textColor = mpCurItem == MP_ITEM_MINIMAP_ROTATED ? HIGHLIGHT : TEXTCOLOR;
    +        MpDrawText(x + MP_ITEM_SELECT_GAP, y, textColor, "Minimap Rotated");
    +        if (LWMP_GetMinimapRotated())
    +        {
    +            VWB_DrawPic(x, y + 3, C_SELECTEDPIC);
    +        }
    +        else
    +        {
    +            VWB_DrawPic(x, y + 3, C_NOTSELECTEDPIC);
    +        }
    +    }
    +
    +    // draw cursor
    +    {
    +        x = MP_X + MP_CURSOR_X;
    +
    +        y = MP_ITEM_Y(mpCurItem);
    +        if (mpNextItem < mpCurItem)
    +        {
    +            y -= MP_ITEM_HALFSTEP;
    +        }
    +        else if (mpNextItem > mpCurItem)
    +        {
    +            y += MP_ITEM_HALFSTEP;
    +        }
    +
    +        VWB_Bar (x - 1, y, 25, 16, BKGDCOLOR);
    +        VWB_DrawPic (x, y, mpCursorShape);
    +    }
    +
    +    VW_UpdateScreen ();
    +}
    +
    +int
    +SplitScreenSettings (int)
    +{
    +    int which;
    +    ControlInfo ci;
    +    int32_t cursorLastBlinkTime, cursorBlinkTimer;
    +    int32_t cursorStepTimer;
    +    int32_t inputTimer;
    +    int32_t timer;
    +
    +    cursorBlinkTimer = 8;
    +    cursorLastBlinkTime = GetTimeCount();
    +    inputTimer = GetTimeCount();
    +
    +    DrawSplitScreenSettings ();
    +    MenuFadeIn ();
    +
    +    do
    +    {
    +        timer = GetTimeCount ();
    +
    +        if (timer - cursorLastBlinkTime > cursorBlinkTimer)
    +        {
    +            cursorLastBlinkTime = timer;
    +            if (mpCursorShape == C_CURSOR1PIC)
    +            {
    +                mpCursorShape = C_CURSOR2PIC;
    +                cursorBlinkTimer = 8;
    +            }
    +            else
    +            {
    +                mpCursorShape = C_CURSOR1PIC;
    +                cursorBlinkTimer = 70;
    +            }
    +        }
    +
    +        if (mpNextItem != mpCurItem)
    +        {
    +            if (timer - cursorStepTimer > MP_HALFSTEP_TIME)
    +            {
    +                mpCurItem = mpNextItem;
    +                SD_PlaySound (MOVEGUN2SND);
    +            }
    +        }
    +
    +        ReadAnyControl (&ci);
    +        if (Keyboard[sc_Escape])
    +        {
    +            SD_PlaySound (ESCPRESSEDSND);
    +            break;
    +        }
    +        else if (Keyboard[sc_Enter])
    +        {
    +            ShootSnd ();
    +            break;
    +        }
    +        else if (Keyboard[sc_Space])
    +        {
    +            ci.dir = dir_East;
    +        }
    +
    +        if (ci.dir != dir_None)
    +        {
    +            if (timer - inputTimer > MP_INPUT_FREQ)
    +            {
    +                inputTimer = GetTimeCount();
    +                switch (ci.dir)
    +                {
    +                case dir_North:
    +                    mpNextItem = (mpCurItem + MP_NUMITEMS - 1) % MP_NUMITEMS;
    +                    cursorStepTimer = GetTimeCount();
    +                    if (mpCurItem == 0)
    +                    {
    +                        cursorStepTimer -= MP_HALFSTEP_TIME;
    +                    }
    +                    else
    +                    {
    +                        SD_PlaySound (MOVEGUN1SND);
    +                    }
    +                    break;
    +                case dir_South:
    +                    mpNextItem = (mpCurItem + 1) % MP_NUMITEMS;
    +                    cursorStepTimer = GetTimeCount();
    +                    if (mpCurItem == MP_NUMITEMS - 1)
    +                    {
    +                        cursorStepTimer -= MP_HALFSTEP_TIME;
    +                    }
    +                    else
    +                    {
    +                        SD_PlaySound (MOVEGUN1SND);
    +                    }
    +                    break;
    +                case dir_East:
    +                case dir_West:
    +                    switch (mpCurItem)
    +                    {
    +                    case MP_ITEM_PLAYERS:
    +                        LWMP_ChangeNumPlayers(ci.dir == dir_East ? 1 : -1);
    +                        SD_PlaySound (MOVEGUN2SND);
    +                        break;
    +                    case MP_ITEM_LAYOUT:
    +                        LWMP_ChangeLayout(ci.dir == dir_East ? 1 : -1);
    +                        SD_PlaySound (MOVEGUN2SND);
    +                        break;
    +                    case MP_ITEM_MINIMAP_ROTATED:
    +                        LWMP_SetMinimapRotated(!LWMP_GetMinimapRotated());
    +                        SD_PlaySound (MOVEGUN2SND);
    +                        break;
    +                    }
    +                    break;
    +                }
    +            }
    +        }
    +        else
    +        {
    +            inputTimer = GetTimeCount() - MP_INPUT_FREQ;
    +        }
    +
    +        DrawSplitScreenSettings ();
    +        SDL_Delay(5);
    +    }
    +    while (1);
    +
    +    MenuFadeOut ();
    +
    +    return 0;
    +}
    +
     
     ////////////////////////////////////////////////////////////////////
     //
    diff a/wl_menu.h b/wl_menu.h
    index 4355b36..f3e98cc 100755
    --- a/wl_menu.h
    +++ b/wl_menu.h
    @@ -73,7 +69,7 @@
     #define CTL_X  24
     #define CTL_Y  86
     #define CTL_W  284
    -#define CTL_H  60
    +#define CTL_H  74
     
     #define LSM_X  85
     #define LSM_Y  55
    @@ -95,7 +91,6 @@
     #define CST_START      60
     #define CST_SPC 60
     
    -
     //
     // TYPEDEFS
     //
    @@ -202,6 +197,7 @@ int CP_ViewScores(int);
     int  CP_EndGame(int);
     int  CP_CheckQuick(ScanCode scancode);
     int CustomControls(int);
    +int SplitScreenSettings(int);
     int MouseSensitivity(int);

    Metalor
    Bring em' On!
    Bring em' On!

    Number of posts : 157
    Age : 26
    Registration date : 2012-04-05

    Re: Need to add a second customization menu for the Controls

    Post by Metalor on Wed Apr 18, 2012 11:59 am

    Um, a few questions:

    First, you sure it's alright to be posting that piece of code from SplitWolf? I'd assume you'd want to at least hold onto it in secrecy until the mod was released.

    Second, I'm not quite sure how that string can be modified into a controls customization screen.

    I guess what I'm really saying is that I need an explanation or two regarding some of the pieces of code. This is the first time I've actually really dug into the menu code, so there's ALOT of stuff I don't understand. If you'll give me a while to do so, I'll post the code I'm trying to piece together, and I'll detail my concerns regarding the code in question.

    Metalor
    Bring em' On!
    Bring em' On!

    Number of posts : 157
    Age : 26
    Registration date : 2012-04-05

    Re: Need to add a second customization menu for the Controls

    Post by Metalor on Wed Apr 18, 2012 1:33 pm

    Alright, sorry I didn't post this when I should, and I could go on about the excuses, but that won't be productive in any way or form. Anyways, I copied and modified a huge segment from the WL_MENU.cpp from the original Wolf4SDL code as it was before I made any modifications and then came up with this code string by modifying bits and pieces. Anyways, I'd like someone to look through this mess and tell me if everything looks good, or if I should make any modifications and where:

    Code:
    ////////////////////////////////////////////////////////////////////
    //
    // CUSTOMIZE CONTROLS
    //
    ////////////////////////////////////////////////////////////////////
    enum
    { MEDKIT, CROSSHAIR };
    char mbarray[2][1] = { "b4", "b5" };
    int8_t order[2] = { MEDKIT, CROSSHAIR };


    int
    CustomControls (int)
    {
        int which;

        DrawCustomScreen ();
        do
        {
            which = HandleMenu (&CusItems, &CusMenu[0], FixupCustom);
            switch (which)
            {
                case 0:
                    DefineKeyMoveTwo ();
                    DrawCustKeysTwo (0);
                    break;
                case 3:
                    DefineKeyFunction ();
                    DrawCustKeyFn (0);
            }
        }
        while (which >= 0);

        MenuFadeOut ();

        return 0;
    }

    ////////////////////////
    //
    // DEFINE THE KEYBOARD BUTTONS
    //
    void
    DefineKeyMoveTwo (void)
    {
        CustomCtrls keyallowed = { 1, 1, 1, 1 };
        EnterCtrlData (2, &keyallowed, DrawCustKeysTwo, PrintCustKeysTwo, KEYBOARDMOVETWO);
    }


    ////////////////////////
    //
    // DEFINE THE KEYBOARD BUTTONS
    //
    void
    DefineKeyFunction (void)
    {
        CustomCtrls keyallowed = { 1, 1, 0, 0 };
        EnterCtrlData (5, &keyallowed, DrawCustKeyFn, PrintCustKeyFn, KEYBOARDFUNCTION);
    }


    ////////////////////////
    //
    // ENTER CONTROL DATA FOR ANY TYPE OF CONTROL
    //
    enum
    { FWRD, TURNR, BKWD, TURNL };
    int moveorder[4] = { TURNL, TURNR, FWRD, BKWD };

    void
    EnterCtrlData (int index, CustomCtrls * cust, void (*DrawRtn) (int), void (*PrintRtn) (int),
                  int type)
    {
        int j, exit, tick, redraw, which, x, picked, lastFlashTime;
        ControlInfo ci;


        ShootSnd ();
        PrintY = CST_Y + 13 * index;
        IN_ClearKeysDown ();
        exit = 0;
        redraw = 1;
        //
        // FIND FIRST SPOT IN ALLOWED ARRAY
        //
        for (j = 0; j < 4; j++)
            if (cust->allowed[j])
            {
                which = j;
                break;
            }

        do
        {
            if (redraw)
            {
                x = CST_START + CST_SPC * which;
                DrawWindow (5, PrintY - 1, 310, 13, BKGDCOLOR);

                DrawRtn (1);
                DrawWindow (x - 2, PrintY, CST_SPC, 11, TEXTCOLOR);
                DrawOutline (x - 2, PrintY, CST_SPC, 11, 0, HIGHLIGHT);
                SETFONTCOLOR (0, TEXTCOLOR);
                PrintRtn (which);
                PrintX = x;
                SETFONTCOLOR (TEXTCOLOR, BKGDCOLOR);
                VW_UpdateScreen ();
                WaitKeyUp ();
                redraw = 0;
            }

            SDL_Delay(5);
            ReadAnyControl (&ci);

            //
            // CHANGE BUTTON VALUE?
            //
            if ((type != KEYBOARDMOVETWO && type != KEYBOARDFUNCTION) && (ci.button0 | ci.button1 | ci.button2 | ci.button3) ||
                ((type == KEYBOARDMOVETWO || type == KEYBOARDFUNCTION) && LastScan == sc_Enter))
            {
                lastFlashTime = GetTimeCount();
                tick = picked = 0;
                SETFONTCOLOR (0, TEXTCOLOR);

                if (type == KEYBOARDMOVETWO || type == KEYBOARDFUNCTION)
                    IN_ClearKeysDown ();

                while(1)
                {
                    int button, result = 0;

                    //
                    // FLASH CURSOR
                    //
                    if (GetTimeCount() - lastFlashTime > 10)
                    {
                        switch (tick)
                        {
                            case 0:
                                VWB_Bar (x, PrintY + 1, CST_SPC - 2, 10, TEXTCOLOR);
                                break;
                            case 1:
                                PrintX = x;
                                US_Print ("?");
                                SD_PlaySound (HITWALLSND);
                        }
                        tick ^= 1;
                        lastFlashTime = GetTimeCount();
                        VW_UpdateScreen ();
                    }
                    else SDL_Delay(5);

                    //
                    // WHICH TYPE OF INPUT DO WE PROCESS?
                    //
                    switch (type)
                    {
                        case KEYBOARDMOVETWO:
                            if (LastScan && LastScan != sc_Escape)
                            {
                                buttonscan[order[which]] = LastScan;
                                picked = 1;
                                ShootSnd ();
                                IN_ClearKeysDown ();
                            }
                            break;

                        case KEYBOARDFUNCTION:
                            if (LastScan && LastScan != sc_Escape)
                            {
                                dirscan[moveorder[which]] = LastScan;
                                picked = 1;
                                ShootSnd ();
                                IN_ClearKeysDown ();
                            }
                            break;
                    }

                    //
                    // EXIT INPUT?
                    //
                    if (IN_KeyDown (sc_Escape) || type != JOYSTICK && ci.button1)
                    {
                        picked = 1;
                        SD_PlaySound (ESCPRESSEDSND);
                    }

                    if(picked) break;

                    ReadAnyControl (&ci);
                }

                SETFONTCOLOR (TEXTCOLOR, BKGDCOLOR);
                redraw = 1;
                WaitKeyUp ();
                continue;
            }

            if (ci.button1 || IN_KeyDown (sc_Escape))
                exit = 1;

            //
            // MOVE TO ANOTHER SPOT?
            //
            switch (ci.dir)
            {
                case dir_West:
                    do
                    {
                        which--;
                        if (which < 0)
                            which = 3;
                    }
                    while (!cust->allowed[which]);
                    redraw = 1;
                    SD_PlaySound (MOVEGUN1SND);
                    while (ReadAnyControl (&ci), ci.dir != dir_None) SDL_Delay(5);
                    IN_ClearKeysDown ();
                    break;

                case dir_East:
                    do
                    {
                        which++;
                        if (which > 3)
                            which = 0;
                    }
                    while (!cust->allowed[which]);
                    redraw = 1;
                    SD_PlaySound (MOVEGUN1SND);
                    while (ReadAnyControl (&ci), ci.dir != dir_None) SDL_Delay(5);
                    IN_ClearKeysDown ();
                    break;
                case dir_North:
                case dir_South:
                    exit = 1;
            }
        }
        while (!exit);

        SD_PlaySound (ESCPRESSEDSND);
        WaitKeyUp ();
        DrawWindow (5, PrintY - 1, 310, 13, BKGDCOLOR);
    }


    ////////////////////////
    //
    // FIXUP GUN CURSOR OVERDRAW ****
    //
    void
    FixupCustom (int w)
    {
        static int lastwhich = -1;
        int y = CST_Y + 26 + w * 13;


        VWB_Hlin (7, 32, y - 1, DEACTIVE);
        VWB_Hlin (7, 32, y + 12, BORD2COLOR);
    #ifndef SPEAR
        VWB_Hlin (7, 32, y - 2, BORDCOLOR);
        VWB_Hlin (7, 32, y + 13, BORDCOLOR);
    #else
        VWB_Hlin (7, 32, y - 2, BORD2COLOR);
        VWB_Hlin (7, 32, y + 13, BORD2COLOR);
    #endif

        switch (w)
        {
            case 0:
                DrawCustKeysTwo (1);
                break;
            case 3:
                DrawCustKeyFn (1);
        }


        if (lastwhich >= 0)
        {
            y = CST_Y + 26 + lastwhich * 13;
            VWB_Hlin (7, 32, y - 1, DEACTIVE);
            VWB_Hlin (7, 32, y + 12, BORD2COLOR);
    #ifndef SPEAR
            VWB_Hlin (7, 32, y - 2, BORDCOLOR);
            VWB_Hlin (7, 32, y + 13, BORDCOLOR);
    #else
            VWB_Hlin (7, 32, y - 2, BORD2COLOR);
            VWB_Hlin (7, 32, y + 13, BORD2COLOR);
    #endif

            if (lastwhich != w)
                switch (lastwhich)
                {
                    case 6:
                        DrawCustKeysTwo (0);
                        break;
                    case 8:
                        DrawCustKeyFn (0);
                }
        }

        lastwhich = w;
    }


    ////////////////////////
    //
    // DRAW CUSTOMIZE SCREEN
    //
    void
    DrawCustomScreen (void)
    {
        int i;


    #ifdef JAPAN
        CA_CacheScreen (S_CUSTOMPIC);
        fontnumber = 1;

        PrintX = CST_START;
        PrintY = CST_Y + 26;
        DrawCustKeysTwo (0);

        PrintX = CST_START;
        US_Print ("\n\n\n");
        DrawCustKeyFn (0);
    #else
        ClearMScreen ();
        WindowX = 0;
        WindowW = 320;
        VWB_DrawPic (112, 184, C_MOUSELBACKPIC);
        DrawStripes (10);
        VWB_DrawPic (80, 0, C_CUSTOMIZEPIC);

        //
        // KEYBOARD (CONT'D)
        //
        SETFONTCOLOR (READCOLOR, BKGDCOLOR);
        WindowX = 0;
        WindowW = 320;

    #ifndef SPEAR
        SETFONTCOLOR (READCOLOR, BKGDCOLOR);
        US_CPrint ("Keyboard (cont'd)\n");
    #else
        PrintY += 13;
    #endif
        SETFONTCOLOR (TEXTCOLOR, BKGDCOLOR);
    #ifdef SPANISH
        PrintX = 4;
        US_Print (STR_TURNL);
        US_Print ("/");
        US_Print (STR_TURNR);
        US_Print ("/");
        US_Print (STR_FRWD);
        US_Print ("/");
        US_Print (STR_BKWD "\n");
    #else
        PrintX = CST_START;
        US_Print (STR_TURNL);
        PrintX = CST_START + CST_SPC * 1;
        US_Print (STR_TURNR);
        PrintX = CST_START + CST_SPC * 2;
        US_Print (STR_FRWD);
        PrintX = CST_START + CST_SPC * 3;
        US_Print (STR_BKWD "\n");
    #endif
        DrawWindow (5, PrintY - 1, 310, 13, BKGDCOLOR);
        DrawCustKeysTwo (0);
    #endif
        DrawWindow (5, PrintY - 1, 310, 13, BKGDCOLOR);
        DrawCustKeyFn (0);
        US_Print ("\n");

        //
        // KEYBOARD FUNCTION KEYS
        //
        SETFONTCOLOR (TEXTCOLOR, BKGDCOLOR);
    #ifdef SPANISH
        PrintX = CST_START - 16;
        US_Print (STR_MEDKIT);
        PrintX = CST_START - 16 + CST_SPC * 1;
        US_Print (STR_CROSSH "\n");
    #else
        PrintX = CST_START;
        US_Print (STR_MEDKIT);
        PrintX = CST_START + CST_SPC * 1;
        US_Print (STR_CROSSH "\n");
    #endif
        //
        // PICK STARTING POINT IN MENU
        //
        if (CusItems.curpos < 0)
            for (i = 0; i < CusItems.amount; i++)
                if (CusMenu[i].active)
                {
                    CusItems.curpos = i;
                    break;
                }


        VW_UpdateScreen ();
        MenuFadeIn ();
    }

    void
    PrintCustKeysTwo (int i)
    {
        PrintX = CST_START + CST_SPC * i;
        US_Print ((const char *) IN_GetScanName (buttonscan[order[i]]));
    }

    void
    DrawCustKeysTwo (int hilight)
    {
        int i, color;


        color = TEXTCOLOR;
        if (hilight)
            color = HIGHLIGHT;
        SETFONTCOLOR (color, BKGDCOLOR);

        PrintY = CST_Y + 13 * 8;
        for (i = 0; i < 4; i++)
            PrintCustKeysTwo (i);
    }

    void
    PrintCustKeyFn (int i)
    {
        PrintX = CST_START + CST_SPC * i;
        US_Print ((const char *) IN_GetScanName (dirscan[moveorder[i]]));
    }

    void
    DrawCustKeyFn (int hilight)
    {
        int i, color;


        color = TEXTCOLOR;
        if (hilight)
            color = HIGHLIGHT;
        SETFONTCOLOR (color, BKGDCOLOR);

        PrintY = CST_Y + 13 * 10;
        for (i = 0; i < 2; i++)
            PrintCustKeyFn (i);
    }

    That's alot to look through, which is why I didn't get around to doing something with it until now. But if anyone can, please give me some feedback on the bits and pieces above (this code is not currently in my game yet, I'm waiting for a second opinion or two before I stitch it in there).

    linuxwolf
    Bring em' On!
    Bring em' On!

    Male
    Number of posts : 159
    Age : 34
    Location : Australia
    Hobbie : Games
    Registration date : 2011-12-25

    Re: Need to add a second customization menu for the Controls

    Post by linuxwolf on Wed Apr 18, 2012 10:42 pm

    I prefer to leave the customize controls menu in Wolf3D unmodified. I suggest you write a new menu to replace it. This is something I wanted to do in Split Wolf final by the way.

    Metalor
    Bring em' On!
    Bring em' On!

    Number of posts : 157
    Age : 26
    Registration date : 2012-04-05

    Re: Need to add a second customization menu for the Controls

    Post by Metalor on Wed Apr 18, 2012 10:51 pm

    Oh, I'm going to leave the original in there, I was just planning on pasting this in there alongside it (of course, renaming some of the functions and routines firt). I just wanted to know if the function I posted was feasible.

    linuxwolf
    Bring em' On!
    Bring em' On!

    Male
    Number of posts : 159
    Age : 34
    Location : Australia
    Hobbie : Games
    Registration date : 2011-12-25

    Re: Need to add a second customization menu for the Controls

    Post by linuxwolf on Thu Apr 19, 2012 5:24 am

    I've done all I can for you my friend. Embarassed

    Metalor
    Bring em' On!
    Bring em' On!

    Number of posts : 157
    Age : 26
    Registration date : 2012-04-05

    Re: Need to add a second customization menu for the Controls

    Post by Metalor on Thu Apr 19, 2012 10:50 am

    If that's the case, then let's just cross our fingers and hope for the best. I'm goin' in! Firing a Gun

    Metalor
    Bring em' On!
    Bring em' On!

    Number of posts : 157
    Age : 26
    Registration date : 2012-04-05

    Re: Need to add a second customization menu for the Controls

    Post by Metalor on Thu Apr 19, 2012 12:21 pm

    Well, my efforts seemed to have created a monster, rather than a controls screen. I'm starting to care about this less and less. I would like the player to be able to customize any key and function they desire, but all this trouble with the controls screens has really deteriorated my enthusiasm for trying to do so.

    I think perhaps I just need to figure out how to switch the WASD keys for the arrow keys in the customization screen and that'll be good enough. Here's a link to the tutorial I used to enable WASD support, so that might help so that we can figure out how to allocate the customization screen for the Arrow Keys instead. I doubt anyone will have to change the WASD keys.

    Link:
    http://diehardwolfers.areyep.com/viewtopic.php?t=5326

    Guest
    Guest

    Re: Need to add a second customization menu for the Controls

    Post by Guest on Thu Apr 19, 2012 9:09 pm

    Hi Vincent!


    Last edited by Chokster37 on Sat Feb 08, 2014 12:00 pm; edited 1 time in total

    Metalor
    Bring em' On!
    Bring em' On!

    Number of posts : 157
    Age : 26
    Registration date : 2012-04-05

    Re: Need to add a second customization menu for the Controls

    Post by Metalor on Thu Apr 19, 2012 9:30 pm

    Well, there's no harm in at least trying it. If all else fails, it would certainly be a learning experience.

    -EDIT-

    I just tried it and it worked like a charm, except that when you press the WA, AS, WD, or SD keys at the same time the game crashes. It seems the game doesn't like it when the player uses those in tandom. Any ideas why?

    Otherwise, the code worked great.

    Guest
    Guest

    Re: Need to add a second customization menu for the Controls

    Post by Guest on Thu Apr 19, 2012 9:53 pm

    Hi Glenn!


    Last edited by Chokster37 on Sat Feb 08, 2014 12:00 pm; edited 1 time in total

    Metalor
    Bring em' On!
    Bring em' On!

    Number of posts : 157
    Age : 26
    Registration date : 2012-04-05

    Re: Need to add a second customization menu for the Controls

    Post by Metalor on Thu Apr 19, 2012 9:56 pm

    I deleted the config file, and it seems I over exaggerated. The game only seems to crash when the A and S keys are pressed at the same time. The other key cominations don't seem to crash the game. Just A and S.

    Guest
    Guest

    Re: Need to add a second customization menu for the Controls

    Post by Guest on Thu Apr 19, 2012 10:03 pm

    Hi Jeffrey!


    Last edited by Chokster37 on Sat Feb 08, 2014 12:00 pm; edited 1 time in total

    Metalor
    Bring em' On!
    Bring em' On!

    Number of posts : 157
    Age : 26
    Registration date : 2012-04-05

    Re: Need to add a second customization menu for the Controls

    Post by Metalor on Thu Apr 19, 2012 10:11 pm

    Odd that the compiler didn't notice that...

    Anyways, the fix did the trick!

    Thanks for the assist!

    Sponsored content

    Re: Need to add a second customization menu for the Controls

    Post by Sponsored content Today at 10:39 am


      Current date/time is Mon Dec 05, 2016 10:39 am