Ya sube las rampas. Aun queda por acabar

This commit is contained in:
2022-09-10 18:26:24 +02:00
parent 2ccb02258c
commit edaa59af7d
10 changed files with 386 additions and 11 deletions

View File

@@ -488,7 +488,7 @@ void Room::fillMapTexture()
}
// LeftSlopes
if (true)
if (false)
{
for (auto l : leftSlopes)
{
@@ -907,7 +907,7 @@ void Room::setLeftSlopes()
while (found.size() > 0)
{
line_t line;
d_line_t line;
line.x1 = (found[0] % mapWidth) * tileSize;
line.y1 = (found[0] / mapWidth) * tileSize;
int lookingFor = found[0] + mapWidth + 1;
@@ -948,7 +948,7 @@ void Room::setRightSlopes()
while (found.size() > 0)
{
line_t line;
d_line_t line;
line.x1 = ((found[0] % mapWidth) * tileSize) + tileSize - 1;
line.y1 = (found[0] / mapWidth) * tileSize;
int lookingFor = found[0] + mapWidth - 1;
@@ -966,7 +966,7 @@ void Room::setRightSlopes()
}
line.x2 = (lastOneFound % mapWidth) * tileSize;
line.y2 = ((lastOneFound / mapWidth) * tileSize) + tileSize - 1;
leftSlopes.push_back(line);
rightSlopes.push_back(line);
}
}
@@ -1037,5 +1037,63 @@ bool Room::checkTopSurfaces(SDL_Point *p)
}
}
return false;
}
// Comprueba las colisiones
int Room::checkLeftSlopes(v_line_t *line)
{
for (auto s : leftSlopes)
{
const SDL_Point p = checkCollision(s, *line);
if (p.x != -1)
{
return p.y;
}
}
return -1;
}
// Comprueba las colisiones
bool Room::checkLeftSlopes(SDL_Point *p)
{
for (auto s : leftSlopes)
{
if (checkCollision(*p, s))
{
return true;
}
}
return false;
}
// Comprueba las colisiones
int Room::checkRightSlopes(v_line_t *line)
{
for (auto s : rightSlopes)
{
const SDL_Point p = checkCollision(s, *line);
if (p.x != -1)
{
return p.y;
}
}
return -1;
}
// Comprueba las colisiones
bool Room::checkRightSlopes(SDL_Point *p)
{
for (auto s : rightSlopes)
{
if (checkCollision(*p, s))
{
return true;
}
}
return false;
}