Beispiel #1
0
//
// Change a keybinding option
//
boolean FE_SetKeybinding(femenuitem_t *item, int key)
{
    const char *keyname;
    boolean res = false;
    boolean cleared = false;
    int curkey = M_GetIntVariable(item->verb);

    if(!key)
        return false;

    if(curkey && key == curkey) // clear binding
    {
        res = M_SetVariable(item->verb, "");
        cleared = true;
    }
    else
    {
        // try to find name for key
        keyname = GetNameForKey(key);
        if(!keyname)
            return false;

        res = M_SetVariable(item->verb, keyname);
    }

    if(res)
    {
        S_StartSound(NULL, sfx_swtchn);
        if(merchantOn)
            FE_MerchantSetState(!cleared ? S_MRYS_00 : S_MRNO_00);
    }

    return res;
}
Beispiel #2
0
// Load a configuration set.
static void LoadConfigurationSet(const joystick_config_t *configs)
{
    const joystick_config_t *config;
    char buf[10];
    int button;
    int i;

    button = 0;

    for (i = 0; configs[i].name != NULL; ++i)
    {
        config = &configs[i];

        // Don't overwrite autorun if it is set.
        if (!strcmp(config->name, "joyb_speed") && joybspeed >= 20)
        {
            continue;
        }

        // For buttons, set the virtual button mapping as well.
        if (M_StringStartsWith(config->name, "joyb_") && config->value >= 0)
        {
            joystick_physical_buttons[button] = config->value;
            M_snprintf(buf, sizeof(buf), "%i", button);
            M_SetVariable(config->name, buf);
            ++button;
        }
        else
        {
            M_snprintf(buf, sizeof(buf), "%i", config->value);
            M_SetVariable(config->name, buf);
        }
    }
}
Beispiel #3
0
//
// Clear mouse binding
//
void FE_ClearMouseButton(femenuitem_t *item)
{
    int feMVarNum = item->data;

    M_SetVariable(feMVarNames[feMVarNum], "-1");

    S_StartSound(NULL, sfx_mtalht);
    if(merchantOn)
        FE_MerchantSetState(S_MRNO_00);
    frontend_state = FE_STATE_MAINMENU;
}
Beispiel #4
0
//
// Change a mouse button binding option
//
void FE_SetMouseButton(femenuitem_t *item, SDL_Event *ev)
{
    char buf[33];
    int feMVarNum = item->data;
    int cfgMBNum  = FE_CfgNumForSDLMouseButton(ev);

    // set this variable
    M_SetVariable(feMVarNames[feMVarNum], M_Itoa(cfgMBNum, buf, 10));

    // clear any other variables of the same mouse button
    FE_ClearMVarsOfButton(cfgMBNum, feMVarNum);

    S_StartSound(NULL, sfx_swtchn);
    if(merchantOn)
        FE_MerchantSetState(cfgMBNum > 0 ? S_MRYS_00: S_MRNO_00);
    frontend_state = FE_STATE_MAINMENU;
}
Beispiel #5
0
static void CheckSteamGUSPatches(void)
{
    const char *current_path;
    char *install_path;
    char *patch_path;
    int len;

    // Already configured? Don't stomp on the user's choices.
    current_path = M_GetStringVariable("gus_patch_path");
    if (current_path != NULL && strlen(current_path) > 0)
    {
        return;
    }

    install_path = GetRegistryString(&steam_install_location);

    if (install_path == NULL)
    {
        return;
    }

    len = strlen(install_path) + strlen(STEAM_BFG_GUS_PATCHES) + 20;
    patch_path = malloc(len);
    M_snprintf(patch_path, len, "%s\\%s\\ACBASS.PAT",
               install_path, STEAM_BFG_GUS_PATCHES);

    // Does acbass.pat exist? If so, then set gus_patch_path.
    if (M_FileExists(patch_path))
    {
        M_snprintf(patch_path, len, "%s\\%s",
                   install_path, STEAM_BFG_GUS_PATCHES);
        M_SetVariable("gus_patch_path", patch_path);
    }

    free(patch_path);
    free(install_path);
}