Something went wrong. Try again.
Forked pico-rectangle to make it compliant with https://github.com/CarVac/MeleeConchRuleset/blob/main/ruleset.md
Something went wrong. Try again.
4.6 kB · 145 lines
C++
at master
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146#include "dac_algorithms/ultimate_F1.hpp"#include "communication_protocols/joybus/gcReport.hpp"
namespace DACAlgorithms {namespace UltimateF1 {
#define coord(x) ((uint8_t)(128. + 80.*x + 0.5))#define oppositeCoord(x) -((uint8_t)x)
struct Coords { uint8_t x; uint8_t y;};
Coords coords(float xFloat, float yFloat) { Coords r; r.x = coord(xFloat); r.y = coord(yFloat); return r;}
GCReport getGCReport(GpioToButtonSets::F1::ButtonSet buttonSet) { GpioToButtonSets::F1::ButtonSet bs = buttonSet; // Alterable copy
GCReport gcReport = defaultGcReport;
// Neutral SOCD. if (bs.left && bs.right) { bs.left = false; bs.right = false; }
if (bs.down && bs.up) { bs.down = false; bs.up = false; } /* Stick */
bool vertical = bs.up || bs.down; bool readUp = bs.up;
bool horizontal = bs.left || bs.right; bool readRight = bs.right;
Coords xy;
if (vertical && horizontal) { if (bs.l || bs.r) { if (bs.mx == bs.my) xy = coords(0.7, 0.7); // Changed to 0.7, 0.7 else if (bs.mx) xy = coords(0.6375, 0.375); // Untouched else xy = coords(0.85, 0.5); // Changed to 0.85, 0.5 (no parasol dashing) } // Removed extended up b coords else if (bs.mx != bs.my) { // All of these changed to match Crane's values if (bs.mx) { if (bs.cDown) xy = coords(0.7625, 0.6125); else if (bs.cLeft) xy = coords(0.825, 0.525); else if (bs.cUp) xy = coords(0.8875, 0.4375); else if (bs.cRight) xy = coords(0.9, 0.3375); else xy = coords(0.5, 0.325); } else { if (bs.cDown) xy = coords(0.6125, 0.7625); else if (bs.cLeft) xy = coords(0.525, 0.825); else if (bs.cUp) xy = coords(0.4375, 0.8875); else if (bs.cRight) xy = coords(0.3375, 0.9375); else xy = coords(0.475, 0.6125); } } else xy = coords(0.7,0.7); } // Tweaked the effect of modifiers on horizontal movement else if (horizontal) { if (bs.mx == bs.my) xy = coords(1.0, 0.0); else if (bs.mx) xy = coords(0.6625, 0.0); // matched other rectangles walk speed on Ultimate (fastest walk possible without ledgeslip) // now pressing L/R + MX + B enables tilt input for side B (Palutena close Explosive Flame, Samus homing missiles, etc) else xy = coords(0.325, 0.0); } else if (vertical) { if (bs.mx == bs.my) xy = coords(0.0, 1.0); else if (bs.mx) xy=coords(0.0, 0.5375); else xy = coords(0.0, 0.6375); // 0.7375 -> 0.6375 <- very weird. To test. } else { xy = coords(0.0, 0.0); }
if (horizontal && !readRight) xy.x = oppositeCoord(xy.x); if (vertical && !readUp) xy.y = oppositeCoord(xy.y);
gcReport.xStick = xy.x; gcReport.yStick = xy.y;
/* C-Stick */ bool cVertical = bs.cUp != bs.cDown; bool cHorizontal = bs.cLeft != bs.cRight;
Coords cxy; if (bs.mx && bs.my) cxy = coords(0.0, 0.0); else if (cVertical && cHorizontal) cxy = coords(0.7, 0.7); else if (cHorizontal) cxy = bs.mx ? coords(0.7, 0.7) : bs.my ? coords(0.7, -0.7) : coords(1.0, 0.0); // angled up side tilt/aerial activated by mx + CLeft/CRight. Angled down side tilt/aerial activated by my + CLeft/CRight // the previous angles didn't work and angled down side tilt was activated with MX + UP + L/RCstick // having MY for angled down side tilt is more intuitive but also avoids messing up fast falled aerials for character that can angle side aerials (MinMin, Richter) else if (cVertical) cxy = coords(0.0, 1.0); else cxy = coords(0.0, 0.0);
if (cHorizontal && bs.cLeft) cxy.x = oppositeCoord(cxy.x); if (cVertical && bs.cDown) cxy.y = oppositeCoord(cxy.y);
gcReport.cxStick = cxy.x; gcReport.cyStick = cxy.y;
/* Dpad */ if (bs.mx && bs.my) { gcReport.dDown = bs.cDown; gcReport.dLeft = bs.cLeft; gcReport.dUp = bs.cUp; gcReport.dRight = bs.cRight; }
/* Triggers */ gcReport.analogL = bs.l ? 140 : bs.ms ? 94 : bs.ls ? 49 : 0; gcReport.analogR = bs.r ? 140 : 0;
/* Buttons */ gcReport.a = bs.a; gcReport.b = bs.b; gcReport.x = bs.x; gcReport.y = bs.y; gcReport.z = bs.z; gcReport.l = bs.l; gcReport.r = bs.r; gcReport.start = bs.start;
return gcReport;}
}}