Page 1 of 1

T2:How can I substitute DD for Stickize() on the Wiimote?

PostPosted: Tue Jul 17, 2018 12:28 am
by TopSteer
I am working on converting a Wiimote script by Robsterman02 (which uses some code written by Wimot3) into the base for an IRpointer aiming script for Sleeping Dogs.

The original script uses the Stickize() function, which has been deprecated in Titan Two.
I cannot find any scripts previously written for T2 which use the new DD feature for the Wiimote IR pointer, and I am afraid I do not know how to script that from scratch, myself.

Does anyone have a script which uses Diagonal Dampening functions with the WiiMote?

Thank you!

-TopSteer

ps. I saw someone mentioned in another post that J2Kbr might be willing to send the original, non-supported code for Stickize() if someone wanted to use it on the T2. Is that a possibility?

Re: T2:How can I substitute DD for Stickize() on the Wiimote

PostPosted: Tue Jul 17, 2018 6:44 am
by J2Kbr
TopSteer wrote:ps. I saw someone mentioned in another post that J2Kbr might be willing to send the original, non-supported code for Stickize() if someone wanted to use it on the T2. Is that a possibility?

Sure. :) Here it is:
Code: Select all
void stickize(int idx, int idy, int rad) {
    int val_x = (int) get_val(idx);
    int val_y = (int) get_val(idy);
 
    int abs_val_x = abs(val_x);
    int abs_val_y = abs(val_y);
 
    int h = (((abs_val_x > abs_val_y) ? abs_val_x : abs_val_y) * rad) / 100;
    int H = (int) round(sqrt((fix32)(pow(abs_val_x, 2) * pow(abs_val_y, 2))));
 
    if(H > h) {
        set_val(idx, (val_x * h) / H);
        set_val(idy, (val_y * h) / H);
    }
    return;
}

Re: T2:How can I substitute DD for Stickize() on the Wiimote

PostPosted: Wed Jul 18, 2018 9:06 pm
by TopSteer
Thanks a lot!
I will implement this tonight.

Re: T2:How can I substitute DD for Stickize() on the Wiimote

PostPosted: Sun Aug 05, 2018 3:24 am
by WorldBreaker78
TopSteer wrote:Thanks a lot!
I will implement this tonight.


Hello Topsteer did you the stickize script work? I am using the wiimote on T2 and cant get a script that gets the wiimote to move ir could you help me

Re: T2:How can I substitute DD for Stickize() on the Wiimote

PostPosted: Sun Oct 07, 2018 7:27 pm
by teddy18
J2Kbr wrote:
TopSteer wrote:ps. I saw someone mentioned in another post that J2Kbr might be willing to send the original, non-supported code for Stickize() if someone wanted to use it on the T2. Is that a possibility?

Sure. :) Here it is:
Code: Select all
void stickize(int idx, int idy, int rad) {
    int val_x = (int) get_val(idx);
    int val_y = (int) get_val(idy);
 
    int abs_val_x = abs(val_x);
    int abs_val_y = abs(val_y);
 
    int h = (((abs_val_x > abs_val_y) ? abs_val_x : abs_val_y) * rad) / 100;
    int H = (int) round(sqrt((fix32)(pow(abs_val_x, 2) * pow(abs_val_y, 2))));
 
    if(H > h) {
        set_val(idx, (val_x * h) / H);
        set_val(idy, (val_y * h) / H);
    }
    return;
}



I Copy the Script but it dont work is broken script

Re: T2:How can I substitute DD for Stickize() on the Wiimote

PostPosted: Tue Oct 09, 2018 3:19 pm
by J2Kbr
the above code is just the function, copy-paste it to your main script and call the function within the main block:
Code: Select all
stickize(STICK_1_X, STICK_1_Y, 142);