Skip to content

Commit 3fc220e

Browse files
committed
fix: Rivals 2 airdodge angle
1 parent ed921ce commit 3fc220e

File tree

1 file changed

+55
-46
lines changed

1 file changed

+55
-46
lines changed

src/modes/Rivals2.cpp

Lines changed: 55 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,8 @@ void Rivals2::UpdateDigitalOutputs(const InputState &inputs, OutputState &output
2929
outputs.select = inputs.mb3;
3030
outputs.home = inputs.mb2;
3131
outputs.leftStickClick = inputs.rf7;
32-
outputs.buttonL = inputs.rf8; //changed from rightStickClick to buttonL
33-
//only because buttonL is a default mapping in Rivals 2 (doesn't really matter)
32+
outputs.buttonL = inputs.rf8; // changed from rightStickClick to buttonL
33+
// only because buttonL is a default mapping in Rivals 2 (doesn't really matter)
3434

3535
// Activate D-Pad layer by holding Mod X + Mod Y.
3636
if (inputs.lt1 && inputs.lt2) {
@@ -60,19 +60,25 @@ void Rivals2::UpdateAnalogOutputs(const InputState &inputs, OutputState &outputs
6060

6161
bool shield_button_pressed = inputs.lf4 || inputs.rf5; // if L or R are pressed
6262

63-
if (directions.diagonal && !shield_button_pressed) { //added this conditional to give joystick accurate diagonals rather than (+/- 1.2, 1.2) should be (0.87~, 0.87~)
64-
outputs.leftStickX = 128 + (directions.x * 92); // 92 (0.78 in-game), reduced below 0.8 to allow crouch tilts/crouch turn-around tilts
65-
outputs.leftStickY = 128 + (directions.y * 96);//Y value 0.83. >0.8 allows fast fall
63+
// added this conditional to give joystick accurate diagonals
64+
// rather than (+/- 1.2, 1.2) should be (0.87~, 0.87~)
65+
if (directions.diagonal && !shield_button_pressed) {
66+
// 92 (0.78 in-game), reduced below 0.8 to allow crouch
67+
// tilts/crouch turn-around tilts
68+
outputs.leftStickX = 128 + (directions.x * 92);
69+
// Y value 0.83. >0.8 allows fast fall
70+
outputs.leftStickY = 128 + (directions.y * 96);
6671
}
6772

6873
if (directions.diagonal && shield_button_pressed) {
69-
outputs.leftStickX = 128 + (directions.x * 92); // (0.77~, 0.77~) to prevent spot dodging when pressing diagonal on the ground
70-
outputs.leftStickY = 128 + (directions.y * 92);
74+
// (0.77~, 0.77~) to prevent spot dodging when pressing diagonal on the ground
75+
outputs.leftStickX = 128 + (directions.x * 92);
76+
outputs.leftStickY = 128 + (directions.y * 92);
7177
}
7278

7379
// For MX Angled Tilts when input_persist is true
7480
//(x, y), (69, 53), (~0.506, ~0.31) [coords, code_values, in-game values]
75-
if (input_persist) { //input_persist becomes true if ModX + diagonal + A
81+
if (input_persist) { // input_persist becomes true if ModX + diagonal + A
7682
timer++;
7783
outputs.leftStickX = 128 + (directions.x * 69);
7884
outputs.leftStickY = 128 + (directions.y * 53);
@@ -83,20 +89,21 @@ void Rivals2::UpdateAnalogOutputs(const InputState &inputs, OutputState &outputs
8389
input_persist = false;
8490
}
8591

86-
87-
88-
if (inputs.lt1) { //if ModX is held
92+
if (inputs.lt1) { // if ModX is held
8993
if (directions.horizontal) {
90-
outputs.leftStickX = 128 + (directions.x * 76); //76 gives 0.58~ in-game for a medium speed walk. will also do tilts
94+
// 76 gives 0.58~ in-game for a medium speed walk. will also do tilts
95+
outputs.leftStickX = 128 + (directions.x * 76);
9196
}
92-
93-
if(directions.vertical) {
94-
outputs.leftStickY = 128 + (directions.y * 53); // 48 (0.31~ in-game), 0.3 allows tilts and shield drop
97+
98+
if (directions.vertical) {
99+
// 48 (0.31~ in-game), 0.3 allows tilts and shield drop
100+
outputs.leftStickY = 128 + (directions.y * 53);
95101
}
96102

97-
if (directions.diagonal && shield_button_pressed) { //for max-length diagonal wavedash while holding ModX
103+
// for max-length diagonal wavedash while holding ModX
104+
if (directions.diagonal && shield_button_pressed) {
98105
outputs.leftStickX = 128 + (directions.x * 120);
99-
outputs.leftStickY = 128 + (directions.y * 42);
106+
outputs.leftStickY = 128 + (directions.y * 42);
100107
}
101108

102109
if (directions.diagonal && !shield_button_pressed) {
@@ -106,59 +113,60 @@ void Rivals2::UpdateAnalogOutputs(const InputState &inputs, OutputState &outputs
106113
outputs.leftStickX = 128 + (directions.x * 123);
107114
outputs.leftStickY = 128 + (directions.y * 51);
108115
// (x, y), (120, 61), (1.1~, 0.41~) [coords, code_values, in-game values]
109-
if (inputs.rt2) { //C-Down
116+
if (inputs.rt2) { // C-Down
110117
outputs.leftStickX = 128 + (directions.x * 120);
111118
outputs.leftStickY = 128 + (directions.y * 61);
112119
}
113120
// (x, y), (115, 69), (1.04~, 0.51~) [coords, code_values, in-game values]
114-
if (inputs.rt3) { //C-Left
121+
if (inputs.rt3) { // C-Left
115122
outputs.leftStickX = 128 + (directions.x * 115);
116123
outputs.leftStickY = 128 + (directions.y * 69);
117124
}
118125
// (x, y), (110, 78), (0.98~, 0.61~) [coords, code_values, in-game values]
119-
if (inputs.rt4) { //C-Up
126+
if (inputs.rt4) { // C-Up
120127
outputs.leftStickX = 128 + (directions.x * 110);
121128
outputs.leftStickY = 128 + (directions.y * 78);
122129
}
123130
// (x, y), (103, 87), (0.9~, 0.71~) [coords, code_values, in-game values]
124-
if (inputs.rt5) { //C-Right
131+
if (inputs.rt5) { // C-Right
125132
outputs.leftStickX = 128 + (directions.x * 103);
126133
outputs.leftStickY = 128 + (directions.y * 87);
127134
}
128135
}
129-
/* 60% Magnitude UpB when not holding B nor Z*/
136+
/* 60% Magnitude UpB when not holding B nor Z */
130137
if (!inputs.rf3 && !inputs.rf1 && !input_persist) {
131138
// (x, y), (68, 42), (~0.49, ~0.188) [coords, code_values, in-game values]
132139
outputs.leftStickX = 128 + (directions.x * 68);
133140
outputs.leftStickY = 128 + (directions.y * 42);
134141
// (x, y), (71, 47), (~0.52, ~0.24) [coords, code_values, in-game values]
135-
if (inputs.rt2) { //C-Down
142+
if (inputs.rt2) { // C-Down
136143
outputs.leftStickX = 128 + (directions.x * 71);
137144
outputs.leftStickY = 128 + (directions.y * 47);
138145
}
139146
// (x, y), (71, 51), (~0.52, 0.29~) [coords, code_values, in-game values]
140-
if (inputs.rt3) { //C-Left
147+
if (inputs.rt3) { // C-Left
141148
outputs.leftStickX = 128 + (directions.x * 71);
142149
outputs.leftStickY = 128 + (directions.y * 51);
143150
}
144151
// (x, y), (69, 55), (~0.51, ~0.34) [coords, code_values, in-game values]
145-
if (inputs.rt4) { //C-Up
152+
if (inputs.rt4) { // C-Up
146153
outputs.leftStickX = 128 + (directions.x * 69);
147154
outputs.leftStickY = 128 + (directions.y * 55);
148155
}
149156
// (x, y), (64, 60), (, ~0.38) [coords, code_values, in-game values]
150-
if (inputs.rt5) { //C-Right
157+
if (inputs.rt5) { // C-Right
151158
outputs.leftStickX = 128 + (directions.x * 64);
152159
outputs.leftStickY = 128 + (directions.y * 60);
153160
}
154161
}
155-
/* Shortest UpB when holding Z*/
156-
if (inputs.rf3) {
157-
// (x, y), (53, 68), (~0.31, ~0.188) [coords, code_values, in-game values]
162+
/* Shortest UpB when holding Z */
163+
if (inputs.rf3) {
164+
// (x, y), (53, 68), (~0.31, ~0.188) [coords, code_values, in-game values]
158165
outputs.leftStickX = 128 + (directions.x * 53);
159166
outputs.leftStickY = 128 + (directions.y * 42);
160167
}
161-
/*ModX Angled Tilts*/
168+
/*
169+
ModX Angled Tilts */
162170
if (inputs.rt1) {
163171
input_persist = true;
164172
timer = 0;
@@ -167,73 +175,75 @@ void Rivals2::UpdateAnalogOutputs(const InputState &inputs, OutputState &outputs
167175
}
168176
}
169177
}
170-
171178

172179
if (inputs.lt2) { // if ModY is held
173180
if (directions.horizontal) {
174-
outputs.leftStickX = 128 + (directions.x * 53); //53 equates to 0.318~ in-game. 0.3 is min to achieve a walk
181+
// 53 equates to 0.318~ in-game. 0.3 is min to achieve a walk
182+
outputs.leftStickX = 128 + (directions.x * 53);
175183
}
176184

177-
if(directions.vertical) {
178-
outputs.leftStickY = 128 + (directions.y * 90); // 0.75~ in-game. will shield drop and tap jump; will not fast fall
185+
if (directions.vertical) {
186+
outputs.leftStickY =
187+
// 0.75~ in-game. will shield drop and tap jump; will not fast fall
188+
128 + directions.y * 90;
179189
}
180190

181191
if (directions.diagonal && !shield_button_pressed) {
182192
/* 100% Magnitude UpB when holding B*/
183193
if (inputs.rf1 && !inputs.rf3) {
184194
// (x, y), (51, 123), (~0.29, ~1.14) [coords, code_values, in-game values]
185-
outputs.leftStickX = 128 + (directions.x * 51);
195+
outputs.leftStickX = 128 + (directions.x * 51);
186196
outputs.leftStickY = 128 + (directions.y * 123);
187197
// (x, y), (61, 120), (~0.41, ~1.1) [coords, code_values, in-game values]
188-
if (inputs.rt2) { //C-Down
198+
if (inputs.rt2) { // C-Down
189199
outputs.leftStickX = 128 + (directions.x * 61);
190200
outputs.leftStickY = 128 + (directions.y * 120);
191201
}
192202
// (x, y), (69, 115), (~0.51, 1.04~) [coords, code_values, in-game values]
193-
if (inputs.rt3) { //C-Left
203+
if (inputs.rt3) { // C-Left
194204
outputs.leftStickX = 128 + (directions.x * 69);
195205
outputs.leftStickY = 128 + (directions.y * 115);
196206
}
197207
// (x, y), (78, 110), (~0.61, 0.98~) [coords, code_values, in-game values]
198-
if (inputs.rt4) { //C-Up
208+
if (inputs.rt4) { // C-Up
199209
outputs.leftStickX = 128 + (directions.x * 78);
200210
outputs.leftStickY = 128 + (directions.y * 110);
201211
}
202212
// (x, y), (87, 103), (~0.71, 0.9~) [coords, code_values, in-game values]
203-
if (inputs.rt5) { //C-Right
213+
if (inputs.rt5) { // C-Right
204214
outputs.leftStickX = 128 + (directions.x * 87);
205215
outputs.leftStickY = 128 + (directions.y * 103);
206216
}
207217
}
208218
/* 60% Magnitude UpB when not holding B nor Z*/
209219
if (!inputs.rf3 && !inputs.rf1) {
210-
// (x, y), (42, 68), (~0.188, ~0.49) [coords, code_values, in-game values]
220+
// (x, y), (42, 68), (~0.188, ~0.49) [coords, code_values, in-game values]
211221
outputs.leftStickX = 128 + (directions.x * 42);
212222
outputs.leftStickY = 128 + (directions.y * 68);
213223
// (x, y), (47, 71), (~0.24, ~0.52) [coords, code_values, in-game values]
214-
if (inputs.rt2) { //C-Down
224+
if (inputs.rt2) { // C-Down
215225
outputs.leftStickX = 128 + (directions.x * 47);
216226
outputs.leftStickY = 128 + (directions.y * 71);
217227
}
218228
// (x, y), (51, 71), (~0.29, ~0.52) [coords, code_values, in-game values]
219-
if (inputs.rt3) { //C-Left
229+
if (inputs.rt3) { // C-Left
220230
outputs.leftStickX = 128 + (directions.x * 51);
221231
outputs.leftStickY = 128 + (directions.y * 71);
222232
}
223233
// (x, y), (55, 69), (~0.34, ~0.51) [coords, code_values, in-game values]
224-
if (inputs.rt4) { //C-Up
234+
if (inputs.rt4) { // C-Up
225235
outputs.leftStickX = 128 + (directions.x * 55);
226236
outputs.leftStickY = 128 + (directions.y * 69);
227237
}
228238
// (x, y), (60, 64), (~0.38, ~0.) [coords, code_values, in-game values]
229-
if (inputs.rt5) { //C-Right
239+
if (inputs.rt5) { // C-Right
230240
outputs.leftStickX = 128 + (directions.x * 60);
231241
outputs.leftStickY = 128 + (directions.y * 64);
232242
}
233243
}
234244
/* Shortest UpB when holding Z*/
235245
if (inputs.rf3) {
236-
// (x, y), (42, 53), (~0.188, ~0.31) [coords, code_values, in-game values]
246+
// (x, y), (42, 53), (~0.188, ~0.31) [coords, code_values, in-game values]
237247
outputs.leftStickX = 128 + (directions.x * 42);
238248
outputs.leftStickY = 128 + (directions.y * 53);
239249
}
@@ -244,7 +254,6 @@ void Rivals2::UpdateAnalogOutputs(const InputState &inputs, OutputState &outputs
244254
}
245255
}
246256
}
247-
248257

249258
// Shut off C-stick when using D-Pad layer.
250259
if (inputs.lt1 && inputs.lt2) {

0 commit comments

Comments
 (0)