Update region system to current codebase due to PR rot

This commit is contained in:
mothbeanie
2024-07-05 14:59:15 -07:00
committed by Misa Elizabeth Kai
parent 94620d809e
commit dedf941b25
9 changed files with 366 additions and 115 deletions
+7 -35
View File
@@ -1682,35 +1682,7 @@ bool customlevelclass::save(const std::string& _path)
void customlevelclass::generatecustomminimap(void)
{
map.customzoom = 1;
if (mapwidth <= 10 && mapheight <= 10)
{
map.customzoom = 2;
}
if (mapwidth <= 5 && mapheight <= 5)
{
map.customzoom = 4;
}
// Set minimap offsets
switch (map.customzoom)
{
case 4:
map.custommmxoff = 24 * (5 - mapwidth);
map.custommmyoff = 18 * (5 - mapheight);
break;
case 2:
map.custommmxoff = 12 * (10 - mapwidth);
map.custommmyoff = 9 * (10 - mapheight);
break;
default:
map.custommmxoff = 6 * (20 - mapwidth);
map.custommmyoff = int(4.5 * (20 - mapheight));
break;
}
map.custommmxsize = 240 - (map.custommmxoff * 2);
map.custommmysize = 180 - (map.custommmyoff * 2);
const MapRenderData data = map.get_render_data();
// Start drawing the minimap
@@ -1719,9 +1691,9 @@ void customlevelclass::generatecustomminimap(void)
graphics.clear();
// Scan over the map size
for (int j2 = 0; j2 < mapheight; j2++)
for (int j2 = data.starty; j2 < data.starty + data.height; j2++)
{
for (int i2 = 0; i2 < mapwidth; i2++)
for (int i2 = data.startx; i2 < data.startx + data.width; i2++)
{
std::vector<SDL_Point> dark_points;
std::vector<SDL_Point> light_points;
@@ -1729,12 +1701,12 @@ void customlevelclass::generatecustomminimap(void)
bool dark = getroomprop(i2, j2)->tileset == 1;
// Ok, now scan over each square
for (int j = 0; j < 9 * map.customzoom; j++)
for (int j = 0; j < 9 * data.zoom; j++)
{
for (int i = 0; i < 12 * map.customzoom; i++)
for (int i = 0; i < 12 * data.zoom; i++)
{
int tile;
switch (map.customzoom)
switch (data.zoom)
{
case 4:
tile = absfree(
@@ -1759,7 +1731,7 @@ void customlevelclass::generatecustomminimap(void)
if (tile >= 1)
{
// Add this pixel
SDL_Point point = { (i2 * 12 * map.customzoom) + i, (j2 * 9 * map.customzoom) + j };
SDL_Point point = { ((i2 - data.startx) * 12 * data.zoom) + i, ((j2 - data.starty) * 9 * data.zoom) + j };
if (dark)
{
dark_points.push_back(point);