Skip to content

Commit cf64468

Browse files
author
Jeremy Vercillo
committed
Fighter: Fixed more ledge recovery problems.
1 parent 6012206 commit cf64468

File tree

1 file changed

+37
-6
lines changed

1 file changed

+37
-6
lines changed

SSBDS/source/fighter.cpp

+37-6
Original file line numberDiff line numberDiff line change
@@ -800,9 +800,18 @@ void Fighter::act() {
800800
fall();
801801
}
802802
else if(Pad.Newpress.Right && direction == RIGHT) {
803-
y = y+hangy-bottomside;
804803
myledge = -1;
805-
x = x + 64 - hangx - leftside;
804+
x = x + 80 - hangx - leftside;
805+
vector<Floor> floors = stage->getFloors();
806+
for (uint8 n = 0; n < floors.size(); n++) {
807+
Floor currfloor = floors[n];
808+
double centerx = x + rightside/2.0;
809+
double slope = currfloor.rise*1.0/currfloor.length;
810+
double rise = (centerx-currfloor.x)*slope;
811+
if(centerx > currfloor.x && centerx < currfloor.x + currfloor.length) {
812+
y = currfloor.y - bottomside - rise;
813+
}
814+
}
806815
idle();
807816
}
808817
else if(Pad.Newpress.Right && direction == LEFT) {
@@ -1142,23 +1151,45 @@ void Fighter::tech() {
11421151
void Fighter::rollUp() {
11431152
if (action == HANG) {
11441153
myledge = -1;
1145-
y = y + hangy - bottomside;
11461154
if (direction == LEFT) {
11471155
x = x + hangx - rightside;
1156+
}
1157+
else {
1158+
x = x + 80 - hangx - leftside;
1159+
}
1160+
vector<Floor> floors = stage->getFloors();
1161+
for (uint8 n = 0; n < floors.size(); n++) {
1162+
Floor currfloor = floors[n];
1163+
double centerx = x + rightside/2.0;
1164+
double slope = currfloor.rise*1.0/currfloor.length;
1165+
double rise = (centerx-currfloor.x)*slope;
1166+
if(centerx > currfloor.x && centerx < currfloor.x + currfloor.length) {
1167+
y = currfloor.y - bottomside - rise;
1168+
}
1169+
}
1170+
if(direction == LEFT) {
11481171
roll(LEFT);
11491172
}
11501173
else {
1151-
x = x + 64 - hangx - leftside;
11521174
roll(RIGHT);
11531175
}
11541176
}
11551177
}
11561178
void Fighter::attackUp() {
11571179
if (action == HANG) {
11581180
myledge = -1;
1159-
y = y + hangy - bottomside;
11601181
if (direction == LEFT) x = x + hangx - rightside;
1161-
else x = x + 64 - hangx - leftside;
1182+
else x = x + 80 - hangx - leftside;
1183+
vector<Floor> floors = stage->getFloors();
1184+
for (uint8 n = 0; n < floors.size(); n++) {
1185+
Floor currfloor = floors[n];
1186+
double centerx = x + rightside/2.0;
1187+
double slope = currfloor.rise*1.0/currfloor.length;
1188+
double rise = (centerx-currfloor.x)*slope;
1189+
if(centerx > currfloor.x && centerx < currfloor.x + currfloor.length) {
1190+
y = currfloor.y - bottomside - rise;
1191+
}
1192+
}
11621193
ftilt();
11631194
}
11641195
}

0 commit comments

Comments
 (0)