Titan one GPC header Broken i cant use stickzize and deadzon
10 posts
• Page 1 of 1
Titan one GPC header Broken i cant use stickzize and deadzon
- Code: Select all
#pragma METAINFO("Titan One", 1, 0, "teddy18")
#include <titanone.gph>
#define NOT_USE 0
#define DZ_CIRCLE 101
#define XB1_RX 9
#define XB1_RY 10
main {
stickize(STICK_1_X, STICK_1_Y, 142);
deadzone(XB1_RX, XB1_RY, DZ_CIRCLE, 20);
}
#ifndef DISABLE_DEADZONE
void deadzone(int idx, int idy, int xdc, int ydr) {
int val_x = get_val(idx);
int val_y = get_val(idy);
if(xdc == DZ_CIRCLE) {
if(val_x || val_y) {
int H = (int) round(sqrt((fix32)(pow(val_x, 2) * pow(val_y, 2))));
xdc = abs((ydr * val_x) / H);
ydr = abs((ydr * val_y) / H);
} else {
xdc = 0;
ydr = 0;
}
}
if(val_x) {
if(val_x > 0) {
val_x += xdc;
} else {
val_x -= xdc;
}
set_val(idx, clamp(val_x, -100, 100));
}
if(val_y) {
if(val_y > 0) {
val_y += ydr;
} else {
val_y -= ydr;
}
set_val(idy, clamp(val_y, -100, 100));
}
return;
}
#endif /* DISABLE_DEADZONE */
#ifndef DISABLE_STICKIZE
void stickize(int idx, int idy, int rad) {
int val_x = get_val(idx);
int val_y = 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;
}
#endif /* DISABLE_STICKIZE */
-
teddy18 - Lieutenant
- Posts: 346
- Joined: Sun Jul 19, 2015 4:18 pm
Re: Titan one GPC header Broken i cant use stickzize and dea
Its not broken...
Don't mix gpc1 functions and GPC2 designator names like BUTTON_ or STICK_
Titanone header needs to use the T1 names / numbers, for some inputs the T1 uses different index numbers than the t2 , example:
number for stick 1 x on T2: 21
number for stick 1 x on T1: 9
Don't mix gpc1 functions and GPC2 designator names like BUTTON_ or STICK_
Titanone header needs to use the T1 names / numbers, for some inputs the T1 uses different index numbers than the t2 , example:
number for stick 1 x on T2: 21
number for stick 1 x on T1: 9
-
Scachi - Brigadier General
- Posts: 3044
- Joined: Wed May 11, 2016 6:25 am
- Location: Germany
Re: Titan one GPC header Broken i cant use stickzize and dea
Scachi wrote:Its not broken...
Don't mix gpc1 functions and GPC2 designator names like BUTTON_ or STICK_
Titanone header needs to use the T1 names / numbers, for some inputs the T1 uses different index numbers than the t2 , example:
number for stick 1 x on T2: 21
number for stick 1 x on T1: 9
ps i get a Error
- Code: Select all
#ifndef DISABLE_DEADZONE
void deadzone(int idx, int idy, int xdc, int ydr) {
int val_x = get_val(idx);
int val_y = get_val(idy);
if(xdc == DZ_CIRCLE) {
if(val_x || val_y) {
int H = (int) round(sqrt((fix32)(pow(val_x, 2) * pow(val_y, 2))));
xdc = abs((ydr * val_x) / H);
ydr = abs((ydr * val_y) / H);
} else {
xdc = 0;
ydr = 0;
}
}
if(val_x) {
if(val_x > 0) {
val_x += xdc;
} else {
val_x -= xdc;
}
set_val(idx, clamp(val_x, -100, 100));
}
if(val_y) {
if(val_y > 0) {
val_y += ydr;
} else {
val_y -= ydr;
}
set_val(idy, clamp(val_y, -100, 100));
}
return;
}
#endif /* DISABLE_DEADZONE */
Invalid Parameter
Last edited by teddy18 on Thu Apr 29, 2021 8:10 pm, edited 1 time in total.
-
teddy18 - Lieutenant
- Posts: 346
- Joined: Sun Jul 19, 2015 4:18 pm
Re: Titan one GPC header Broken i cant use stickzize and dea
Scachi wrote:Its not broken...
Don't mix gpc1 functions and GPC2 designator names like BUTTON_ or STICK_
Titanone header needs to use the T1 names / numbers, for some inputs the T1 uses different index numbers than the t2 , example:
number for stick 1 x on T2: 21
number for stick 1 x on T1: 9
i get a Error Invalid Symbol Redefintion Val_X VAL_Y H
Invalid Parameter )
- Code: Select all
#pragma METAINFO("Titan One", 1, 0, "teddy18")
#include <titanone.gph>
#define NOT_USE 0
#define DZ_CIRCLE 101
#define XB1_RX 9
#define XB1_RY 10
main {
stickize(9, 10, 142);
deadzone(9, 10, DZ_CIRCLE, 20);
}
#ifndef DISABLE_DEADZONE
void deadzone(int idx, int idy, int xdc, int ydr) {
int val_x = get_val(idx);
int val_y = get_val(idy);
if(xdc == DZ_CIRCLE) {
if(val_x || val_y) {
int H = (int) round(sqrt((fix32)(pow(val_x, 2) * pow(val_y, 2))));
xdc = abs((ydr * val_x) / H);
ydr = abs((ydr * val_y) / H);
} else {
xdc = 0;
ydr = 0;
}
}
if(val_x) {
if(val_x > 0) {
val_x += xdc;
} else {
val_x -= xdc;
}
set_val(idx, clamp(val_x, -100, 100));
}
if(val_y) {
if(val_y > 0) {
val_y += ydr;
} else {
val_y -= ydr;
}
set_val(idy, clamp(val_y, -100, 100));
}
return;
}
#endif /* DISABLE_DEADZONE */
#ifndef DISABLE_STICKIZE
void stickize(int idx, int idy, int rad) {
int val_x = get_val(idx);
int val_y = 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;
}
#endif /* DISABLE_STICKIZE */
- Code: Select all
#pragma METAINFO("Titan One", 1, 0, "teddy18")
#include <titanone.gph>
#define NOT_USE 0
#define DZ_CIRCLE 101
#define XB1_RX 9
#define XB1_RY 10
main {
stickize(9, 10, 142);
deadzone(9, 10, DZ_CIRCLE, 20);
}
void deadzone(int idx, int idy, int xdc, int ydr) {
int val_x = get_val(idx);
int val_y = get_val(idy);
if(xdc == DZ_CIRCLE) {
if(val_x || val_y) {
int H = (int) round(sqrt((fix32)(pow(val_x, 2) * pow(val_y, 2))));
xdc = abs((ydr * val_x) / H);
ydr = abs((ydr * val_y) / H);
} else {
xdc = 0;
ydr = 0;
}
}
if(val_x) {
if(val_x > 0) {
val_x += xdc;
} else {
val_x -= xdc;
}
set_val(idx, clamp(val_x, -100, 100));
}
if(val_y) {
if(val_y > 0) {
val_y += ydr;
} else {
val_y -= ydr;
}
set_val(idy, clamp(val_y, -100, 100));
}
return;
}
void stickize(int idx, int idy, int rad) {
int val_x = get_val(idx);
int val_y = 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;
}
12 Erros
-
teddy18 - Lieutenant
- Posts: 346
- Joined: Sun Jul 19, 2015 4:18 pm
Re: Titan one GPC header Broken i cant use stickzize and dea
I am sorry. I guess I am totally wrong and didn't understand your problem correctly.
-
Scachi - Brigadier General
- Posts: 3044
- Joined: Wed May 11, 2016 6:25 am
- Location: Germany
Re: Titan one GPC header Broken i cant use stickzize and dea
You are using the T1 header file.
It already has the stickize and deadzone functions in it.
why defining it new again when still using the include titanone header file line ?
It already has the stickize and deadzone functions in it.
why defining it new again when still using the include titanone header file line ?
-
Scachi - Brigadier General
- Posts: 3044
- Joined: Wed May 11, 2016 6:25 am
- Location: Germany
Re: Titan one GPC header Broken i cant use stickzize and dea
Ahh ok so I need only to put the deadzone but does it work like on the Titan one
I will to adjust the Deadzone like on the Titan one for controller
I will to adjust the Deadzone like on the Titan one for controller
-
teddy18 - Lieutenant
- Posts: 346
- Joined: Sun Jul 19, 2015 4:18 pm
Re: Titan one GPC header Broken i cant use stickzize and dea
So i Got the Code Working but the Deadzone code is not like on the Titan one is different
- Code: Select all
#pragma METAINFO("Titan One", 1, 0, "teddy18")
#include <titanone.gph>
#define DeadzoneAdjust_Stick1 0//
#define DeadzoneAdjust_Stick2 0//
#define sticksizeAdjust_Stick1 142//142 is Standert
#define sticksizeAdjust_Stick2 142//142 is Standert
#define sensitivityAdjust_Stick1 100//100 is Standert
#define sensitivityAdjust_Stick2 100//100 is Standert
main {
dz(9, 10, DZ_CIRCLE, DeadzoneAdjust_Stick1);//STICK_1_X is 9 STICK_1_Y is 10
dz(11, 12, DZ_CIRCLE, DeadzoneAdjust_Stick2);//STICK_2_X is 11 STICK_2_Y is 12
sz(9, 10, sticksizeAdjust_Stick1);//STICK_1_X is 9 STICK_1_Y is 10
sz(11, 12, sticksizeAdjust_Stick1);//STICK_2_X is 11 STICK_2_Y is 12
sens(9, NOT_USE, sensitivityAdjust_Stick1);//STICK_1_X is 9
sens(10, NOT_USE, sensitivityAdjust_Stick1);//STICK_1_Y is 10
sens(11, NOT_USE, sensitivityAdjust_Stick2);//STICK_2_X is 11
sens(12, NOT_USE, sensitivityAdjust_Stick2);//STICK_2_Y is 12
}
void dz(int idx, int idy, int xdc, int ydr) {
int val_x = get_val(idx);
int val_y = get_val(idy);
if(xdc == DZ_CIRCLE) {
if(val_x || val_y) {
int H = (int) round(sqrt((fix32)(pow(val_x, 2) * pow(val_y, 2))));
xdc = abs((ydr * val_x) / H);
ydr = abs((ydr * val_y) / H);
} else {
xdc = 0;
ydr = 0;
}
}
if(val_x) {
if(val_x > 0) {
val_x += xdc;
} else {
val_x -= xdc;
}
set_val(idx, clamp(val_x, -100, 100));
}
if(val_y) {
if(val_y > 0) {
val_y += ydr;
} else {
val_y -= ydr;
}
set_val(idy, clamp(val_y, -100, 100));
}
return;
}
void sz(int idx, int idy, int rad) {
int val_x = get_val(idx);
int val_y = 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;
}
void sens(int id, int mid, int sen) {
int val = get_val(id);
if(mid != NOT_USE) {
int val_s = (val >= 0) ? 1 : -1;
val *= val_s;
if(val <= mid) val = (val * 50) / mid;
else val = ((50 * (val - mid)) / (100 - mid)) + 50;
val *= val_s;
}
if(sen != NOT_USE) {
val = (val * sen) / 100;
}
set_val(id, clamp(val, -100, 100));
return;
}
-
teddy18 - Lieutenant
- Posts: 346
- Joined: Sun Jul 19, 2015 4:18 pm
Re: Titan one GPC header Broken i cant use stickzize and dea
When you #include a header file all content of that file is available to your script already.
You only need to call the function directly. Not sure why you still copy the functions into your script under a different name.
Are you doing this just to show the code or being able to edit the code of those functions ?
This is how to use functions from the header file, you probably want to use different values than the default ones:
I have no experience with those functions.
For different results compared to the T1 you have to wait for someone else to respond. Perhaps only J2kbr knows.
You only need to call the function directly. Not sure why you still copy the functions into your script under a different name.
Are you doing this just to show the code or being able to edit the code of those functions ?
This is how to use functions from the header file, you probably want to use different values than the default ones:
- Code: Select all
#include <titanone.gph>
#define DeadzoneAdjust_Stick1 0//
#define DeadzoneAdjust_Stick2 0//
#define sticksizeAdjust_Stick1 142//142 is Standert
#define sticksizeAdjust_Stick2 142//142 is Standert
#define sensitivityAdjust_Stick1 100//100 is Standert
#define sensitivityAdjust_Stick2 100//100 is Standert
main {
deadzone(9, 10, DZ_CIRCLE, DeadzoneAdjust_Stick1);//STICK_1_X is 9 STICK_1_Y is 10
deadzone(11, 12, DZ_CIRCLE, DeadzoneAdjust_Stick2);//STICK_2_X is 11 STICK_2_Y is 12
stickize(9, 10, sticksizeAdjust_Stick1);//STICK_1_X is 9 STICK_1_Y is 10
stickize(11, 12, sticksizeAdjust_Stick1);//STICK_2_X is 11 STICK_2_Y is 12
sensitivity(9, NOT_USE, sensitivityAdjust_Stick1);//STICK_1_X is 9
sensitivity(10, NOT_USE, sensitivityAdjust_Stick1);//STICK_1_Y is 10
sensitivity(11, NOT_USE, sensitivityAdjust_Stick2);//STICK_2_X is 11
sensitivity(12, NOT_USE, sensitivityAdjust_Stick2);//STICK_2_Y is 12
}
I have no experience with those functions.
For different results compared to the T1 you have to wait for someone else to respond. Perhaps only J2kbr knows.
-
Scachi - Brigadier General
- Posts: 3044
- Joined: Wed May 11, 2016 6:25 am
- Location: Germany
Re: Titan one GPC header Broken i cant use stickzize and dea
Thank you
Question can you make a Deadzone script
One with Circe Shape (Ellipse)
One with Rectangle
The Deadzone should be like on Titan one if you don't move is the value zero
If you move the stick the Deadzone jumps to the value you you set
Is this possible ?
Question can you make a Deadzone script
One with Circe Shape (Ellipse)
One with Rectangle
The Deadzone should be like on Titan one if you don't move is the value zero
If you move the stick the Deadzone jumps to the value you you set
Is this possible ?
-
teddy18 - Lieutenant
- Posts: 346
- Joined: Sun Jul 19, 2015 4:18 pm
10 posts
• Page 1 of 1
Return to GPC2 Script Programming
Who is online
Users browsing this forum: No registered users and 117 guests