Legacy/Control Scheme Script

GPC2 script programming for Titan Two. Code examples, questions, requests.

Legacy/Control Scheme Script

Postby claw » Wed Sep 12, 2018 12:39 am

Longtime Legacy player here and I've grown increasingly frustrated with it's lack of inclusion in most games these days. So, I made a stick select script that you can cycle between control schemes on the fly. This is useful for parts of games where Legacy is cumbersome, such as driving or parachuting on PUBG. I know, I should adapt and play Default, which I have to a degree, but even playing Default since the first Gears of War, I've never been as good as when I had Legacy. I realize this is probably of no use to most people, but hopefully it helps few rare remaining Legacy players.

Code: Select all
#pragma METAINFO("claw's stick select", 1, 9, "")
 
//------------------------------------------------------------------------------
// This script allows you to switch between control schemes on the fly in game
// by pressing in the Right stick, and pressing a direction on your D-Pad.  When
// changing control schemes, controller will rumble and the Titan Two will flash
// purple.
 
// When either Legacy controls are selected, the forward movement stick has 
// added forward/backward movement to compensate for looking left/right.   
// Without the compensation, a character can't walk fullspeed while turning.  It
// currently has a bit of a greedy implementation and I want to update it to use
// the angle of the sticks in combination with the forward movement velocity,
// but haven't quite figured it out yet.
 
// D-Pad Directions:
// UP: Default
// Down: Legacy
// Left: Southpaw
// Right: Legacy Southpaw
 
/*** interactive configuration ***
 
<cfgdesc>
 
[Defaul Control Scheme]
group        = true
byteoffset    = 0
bitsize        = 8
bitoffset    = 0
control        = combobox
default        = 2
shortdesc    = Default Control Scheme
item            = Default
item            = Southpaw
item            = Legacy
item            = Legacy Southpaw
 </cfgdesc>
 
*/

 
#define STICKS_DEFAULT             0
#define STICKS_SOUTHPAW            1
#define STICKS_LEGACY            2
#define STICKS_LEGACY_SOUTHPAW    3
 
// Hold selected control value for use in Legacy compensation
int8 currentControls = 0;
 
init{
    pmem_load();
    changeSticks(pmem_read(0));
}
 
main{
    if (get_val(BUTTON_6) && event_active(BUTTON_10)) {            //Up
        changeSticks(STICKS_DEFAULT);
    } else if (get_val(BUTTON_6) && event_active(BUTTON_11)) {    //Down
        changeSticks(STICKS_LEGACY);
    } else if (get_val(BUTTON_6) && event_active(BUTTON_12)) {     //Left
        changeSticks(STICKS_SOUTHPAW);
    } else if (get_val(BUTTON_6) && event_active(BUTTON_13)) {     //Right
        changeSticks(STICKS_LEGACY_SOUTHPAW);
    }
 
    // Movement compensation for Legacy.  There's probably a better way to do
    // it, but it seems to work well enough.
    if(currentControls == STICKS_LEGACY){
        if((abs(get_actual(STICK_2_Y)) > 50.0)){
            if(get_actual(STICK_2_Y) < 0.0){
                set_val(STICK_2_Y, -100.0);
            } else {
                set_val(STICK_2_Y, 100.0);
            }
        }
    // Movement compensation for Legacy Southpaw. 
    } else if(currentControls == STICKS_LEGACY_SOUTHPAW){
        if((abs(get_actual(STICK_1_Y)) > 50.0)){
            if(get_actual(STICK_1_Y) < 0.0){
                set_val(STICK_1_Y, -100.0);
            } else {
                set_val(STICK_1_Y, 100.0);
            }
        }
    }
}
 
void changeSticks(int8 sticksLayout) {
    currentControls = sticksLayout;
    remapper_reset();
    switch(sticksLayout){
        case(STICKS_DEFAULT):
            break;
        case STICKS_SOUTHPAW:
            remapper_swap(STICK_1_X, STICK_2_X);
            remapper_swap(STICK_1_Y, STICK_2_Y);
            break;
        case STICKS_LEGACY:
            remapper_swap(STICK_1_X, STICK_2_X);
            break;
        case STICKS_LEGACY_SOUTHPAW:
            remapper_swap(STICK_1_Y, STICK_2_Y);
            break;
    }
    combo_run(rumbleAndFlashColor);
    return;
}
 
// Rumble controller and flash color on Titan Two
combo rumbleAndFlashColor {
    ffb_set(FFB_1, 100.0, 500);
    setRgb(100.0, 0.0, 100.0);
    wait(500);
    ffb_reset();
    led_reset();
}
 
void setRgb(fix32 r, fix32 g, fix32 b) {
    led_set(LED_1, b, 0);
    led_set(LED_2, r, 0);
    led_set(LED_3, g, 0);
    led_set(LED_4, 0.0, 0);
    return;
}
 
Attachments
claw-controls.gpc
(3.19 KiB) Downloaded 211 times
Last edited by claw on Wed Sep 12, 2018 1:59 pm, edited 2 times in total.
XBL Gamertag: CLAWESOME
User avatar
claw
Sergeant
Sergeant
 
Posts: 7
Joined: Wed Sep 05, 2018 9:14 am

Re: Legacy/Control Scheme Script

Postby J2Kbr » Wed Sep 12, 2018 9:24 am

Nice Script! Thank you for sharing with us. Please also consider publish it on Gtuner's Online Resources (tools menu -> Publish).
ConsoleTuner Support Team
User avatar
J2Kbr
General of the Army
General of the Army
 
Posts: 20323
Joined: Tue Mar 18, 2014 1:39 pm

Re: Legacy/Control Scheme Script

Postby claw » Wed Sep 12, 2018 1:45 pm

Thanks! Just published it and also added configuration UI, really cool what the device is capable of, great work!
XBL Gamertag: CLAWESOME
User avatar
claw
Sergeant
Sergeant
 
Posts: 7
Joined: Wed Sep 05, 2018 9:14 am

Re: Legacy/Control Scheme Script

Postby J2Kbr » Thu Sep 13, 2018 10:06 am

claw wrote:Thanks! Just published it and also added configuration UI, really cool what the device is capable of, great work!

Awesome!! :) thank you for that and also for your support. :smile0517:
ConsoleTuner Support Team
User avatar
J2Kbr
General of the Army
General of the Army
 
Posts: 20323
Joined: Tue Mar 18, 2014 1:39 pm

Re: Legacy/Control Scheme Script

Postby Dustinthawind » Wed Jan 23, 2019 4:29 pm

Can you make one for the titan one please
Dustinthawind
Private
Private
 
Posts: 1
Joined: Wed Jan 23, 2019 3:26 pm

Re: Legacy/Control Scheme Script

Postby crainbo » Mon Aug 09, 2021 4:07 pm

Any update on whether this script works on the Titan One? Would like legacy stick layout for fortnite and splitgate.
User avatar
crainbo
Private First Class
Private First Class
 
Posts: 2
Joined: Mon Aug 09, 2021 4:07 pm


Return to GPC2 Script Programming

Who is online

Users browsing this forum: No registered users and 151 guests