自带的快捷反死区命令太粗糙了,粗暴的将死区数值加在了输出上,这会导致外圈随之变大,通过Ballistic Curves功能实现的反死区又会是方形死区,没有办法像tt2的脚本呢一样去调整死区吗?或者有人懂怎么把tt2的脚本转换到zen用吗,这是目前tt2在用的来自tt2社区的脚本:v 1.00
Hello everyone. This script should be able to counter square/axial deadzones,
add circular deadzones, allow control over the response curve and skip over or
add regions of restricted diagonal movement around the axes.
Additional huge CPU load reduction by mimicking code by ME.
Hope it’s useful for players. 😃
INITIAL NOTES
Use decimals for the deadzone values(20% = 0.2) and the axial restrict and use
positive numbers for the angularAnti(20 degrees = 20.0).
Circular anti-deadzone values are relative to the remaining range of the square
anti-deadzones when both are used together. For example, if antiCircle and
antiSquare are both set to 0.50, you’ll get an antideadzone of 0.75.
Uncap values is disabled by default to avoid acceleration ranges. This will
cause issues with movement in the diagonals if any square deadzones are left
uncountered. Either make sure to counter them, or set this value to TRUE.
This graph link shows how some of the the values function with some sample ranges
if the descriptions aren’t clear enough.
https://www.desmos.com/calculator/1twwnifmmg
Please refer to the documentation page for more detailed descriptions, examples
and recommended value ranges.
*/
//CHANGE BELOW VALUES
//RIGHT STICK SETTINGS
bool useRightStickSettings = TRUE; //TRUE启用对右摇杆的修改,FALSE为禁用
fix32 deadzone = 0.00; //设置死区
fix32 antiCircularDeadzone = 0.15; //设置反死区
fix32 antiSquareDeadzone = 0.00; //设置反十字死区
fix32 outerDeadzoneIn = 1.00; //设置外圈死区
fix32 outerDeadzoneOut = 1.0; //设置外圈输出大小
fix32 degree = 1.0; //设置曲线
bool uncapValues = TRUE; //屏蔽圈外输出。FALSE设置为启用
int8 useAlternate = 38; //Choose to use alternate settings when a button is held down.
int8 useAlternate2 = 39; //Please use values of ~42-60 to ignore buttons, or replace value of the button you'd
//like to use to switch to the alternate values below. The button values can be
//found in the leftmost column from Help > GPC Input Reference or by pressing F1.
//RIGHT STICK ALTERNATE SETTINGS
fix32 deadzoneA = 0.00;
fix32 antiCircularDeadzoneA = 0.03;
fix32 antiSquareDeadzoneA = 0.00;
fix32 outerDeadzoneInA = 1.00;
fix32 outerDeadzoneOutA = 1.00;
fix32 degreeA = 1.00;
bool uncapValuesA = FALSE;
//RIGHT STICK ALTERNATE 2 SETTINGS
fix32 deadzoneA2 = 0.00;
fix32 antiCircularDeadzoneA2 = 0.00;
fix32 antiSquareDeadzoneA2 = 0.00;
fix32 outerDeadzoneInA2 = 1.00;
fix32 outerDeadzoneOutA2 = 1.00;
fix32 degreeA2 = 1.00;
bool uncapValuesA2 = TRUE;
/*------------------------------------------------------------*/
//LEFT STICK SETTINGS
bool useLeftStickSettings = TRUE; //If FALSE, all settings calculations for the left stick will be ignored.
fix32 deadzoneL = 0.00; //Enter value of desired circular deadzone.
fix32 antiCircularDeadzoneL = 0.00; //Enter value of the game's circular deadzone. Common sizes are 0.2 to 0.25.
fix32 antiSquareDeadzoneL = 0.00; //Enter value of the game's square/axial deadzone. Common sizes are 0.2 to 0.25.
fix32 outerDeadzoneInL = 1.00; //Only useful if user's stick is unable to reach certain magnitudes. 1.00 is ideal normnally.
fix32 outerDeadzoneOutL = 1.00; //Enter value of the maximum range you want to limit stick input. Do not use values over 1.
fix32 degreeL = 1.30; //Enter value of the game's curve to cancel it into a linear curve. Larger values result in faster starting movement.
bool uncapValuesL = FALSE; //Choose if to uncap values beyond the outerDeadzone.
int8 useAlternateL = 50; //Choose to use alternate settings when a button is held down.
int8 useAlternateL2 = 50; //Please use values of ~42-60 to ignore buttons, or replace value of the button you'd
//like to use to switch to the alternate values below. The button values can be
//found in the leftmost column from Help > GPC Input Reference or by pressing F1.
//LEFT STICK ALTERNATE SETTINGS
fix32 deadzoneLA = 0.00;
fix32 antiCircularDeadzoneLA = 0.00;
fix32 antiSquareDeadzoneLA = 0.00;
fix32 outerDeadzoneInLA = 1.00;
fix32 outerDeadzoneOutLA = 1.00;
fix32 degreeLA = 1.00;
bool uncapValuesLA = FALSE;
//LEFT STICK ALTERNATE 2 SETTINGS
fix32 deadzoneLA2 = 0.00;
fix32 antiCircularDeadzoneLA2 = 0.00;
fix32 antiSquareDeadzoneLA2 = 0.00;
fix32 outerDeadzoneInLA2 = 1.00;
fix32 outerDeadzoneOutLA2 = 1.00;
fix32 degreeLA2 = 1.00;
bool uncapValuesLA2 = FALSE;
fix32 stickRX, stickRY;
fix32 stickLX, stickLY;
main {
//Apply right stick settings
if(useRightStickSettings){
static fix32 prevRX, prevRY; //Magic CPU reduction variables by ME.
fix32 currRX = get_val(STICK_1_X);
fix32 currRY = get_val(STICK_1_Y);
if(prevRX != currRX || prevRY != currRY){
if(get_val(useAlternate) > 0.00){
applyStick(deadzoneA, antiCircularDeadzoneA, antiSquareDeadzoneA, outerDeadzoneInA, outerDeadzoneOutA, degreeA, uncapValuesA, 1);
}
else if(get_val(useAlternate2) > 0.00){
applyStick(deadzoneA2, antiCircularDeadzoneA2, antiSquareDeadzoneA2, outerDeadzoneInA2, outerDeadzoneOutA2, degreeA2, uncapValuesA2, 1);
}
else{
applyStick(deadzone, antiCircularDeadzone, antiSquareDeadzone, outerDeadzoneIn, outerDeadzoneOut, degree, uncapValues, 1);
}
prevRX = currRX;
prevRY = currRY;
}
set_val(STICK_1_X, stickRX);
set_val(STICK_1_Y, stickRY);
}
//Apply left stick settings
if(useLeftStickSettings){
static fix32 prevLX, prevLY; //Magic CPU reduction variables by ME.
fix32 currLX = get_val(STICK_2_X);
fix32 currLY = get_val(STICK_2_Y);
if(prevLX != currLX || prevLY != currLY){
if(get_val(useAlternateL) > 0.00){
applyStick(deadzoneLA, antiCircularDeadzoneLA, antiSquareDeadzoneLA,outerDeadzoneInLA, outerDeadzoneOutLA, degreeLA, uncapValuesLA, 2);
}
else if(get_val(useAlternateL2) > 0.00){
applyStick(deadzoneLA2, antiCircularDeadzoneLA2, antiSquareDeadzoneLA2, outerDeadzoneInLA2, outerDeadzoneOutLA2, degreeLA2, uncapValuesLA2, 2);
}
else{
applyStick(deadzoneL, antiCircularDeadzoneL, antiSquareDeadzoneL,outerDeadzoneInL, outerDeadzoneOutL, degreeL, uncapValuesL, 2);
}
prevLX = currLX;
prevLY = currLY; //fixed typo(prevLX = currLY) replicating ME.'s code. Caught by Kevin M.
}
set_val(STICK_2_X, stickLX);
set_val(STICK_2_Y, stickLY);
}
}
void applyStick(fix32 dead, fix32 antiCDead, fix32 antiSDead, fix32 outerDeadIn, fix32 outerDeadOut, fix32 deg, bool uncap, int8 stick){
fix32 x;
fix32 y;
if(stick == 1){
x = get_val(STICK_1_X)/100.0;
y = get_val(STICK_1_Y)/100.0;
}
else{
x = get_val(STICK_2_X)/100.0;
y = get_val(STICK_2_Y)/100.0;
}
//True Reference Angle
fix32 rAngle = rad2deg(abs(atan(y/x)));
if(abs(x) < 0.0001){rAngle = 90.0;}
//Magnitude and Angle
fix32 inputMagnitude = sqrt(x*x + y*y);
fix32 outputMagnitude;
fix32 angle = rad2deg(abs(atan(y/x)));
//if(abs(x) < 0.0001){angle = 90.0;} //avoids angle change with Atan by avoiding dividing by 0
//printf("ratio = %f, angle = %f, cos = %f, sin = %f", abs(y)/abs(x), angle, cos(deg2rad(angle)), sin(deg2rad(angle)));
//Resizes circular antideadzone to output expected value(counters shrinkage when scaling for the square antideadzone below).
antiCDead = antiCDead/( (antiCDead*(1.0 - antiSDead/outerDeadOut) )/( antiCDead*(1.0 - antiSDead) ) );
fix32 refAngle = angle;
//~~~~~~~~~~Deadzone wrap~~~~~~~~~~~~~~~~~~//
if(inputMagnitude > dead){
outputMagnitude = (inputMagnitude - dead)/(outerDeadIn - dead);
//Circular antideadzone scaling
outputMagnitude = ((pow(outputMagnitude, (1.0/deg))*(outerDeadOut - antiCDead) + antiCDead));
//Capping max range
if(outputMagnitude > outerDeadOut && !uncap){
outputMagnitude = outerDeadOut;
}
//Scaling values for square antideadzone
fix32 newX = (x/inputMagnitude)*outputMagnitude;
fix32 newY = (y/inputMagnitude)*outputMagnitude;
//Square antideadzone scaling
fix32 outputX = abs(newX)*(1.0 - antiSDead/outerDeadOut) + antiSDead;
if(x < 0.0){outputX = outputX*(-1.0);}
if(refAngle == 90.0){outputX = 0.0;}
fix32 outputY = abs(newY)*(1.0 - antiSDead/outerDeadOut) + antiSDead;
if(y < -0.0){outputY = outputY*(-1.0);}
if(refAngle == 0.0){outputY = 0.0;}
//Output
if(stick == 1){
stickRX = clamp(outputX*100.0, -outerDeadOut*100.0, outerDeadOut*100.0);
stickRY = clamp(outputY*100.0, -outerDeadOut*100.0, outerDeadOut*100.0);
}
else{
stickLX = clamp(outputX*100.0, -outerDeadOut*100.0, outerDeadOut*100.0);
stickLY = clamp(outputY*100.0, -outerDeadOut*100.0, outerDeadOut*100.0);
}
}
else{
if(stick == 1){
stickRX = 0.0;
stickRY = 0.0;
}
else{
stickLX = 0.0;
stickLY = 0.0;
}
}
}