mirror of
https://github.com/TerryCavanagh/VVVVVV.git
synced 2026-01-29 17:38:16 +03:00
Region system PR review changes
Fixes errors or oversights with the region system for the PR review
This commit is contained in:
committed by
Misa Elizabeth Kai
parent
1fb0afb99d
commit
54b2aaae96
@@ -87,6 +87,9 @@ mapclass::mapclass(void)
|
||||
roomtexton = false;
|
||||
|
||||
nexttowercolour_set = false;
|
||||
|
||||
currentregion = 0;
|
||||
SDL_zeroa(region);
|
||||
}
|
||||
|
||||
static char roomname_static[SCREEN_WIDTH_CHARS];
|
||||
@@ -2301,21 +2304,31 @@ MapRenderData mapclass::get_render_data(void)
|
||||
|
||||
void mapclass::setregion(int id, int rx, int ry, int rx2, int ry2)
|
||||
{
|
||||
if (INBOUNDS_ARR(id, region))
|
||||
if (INBOUNDS_ARR(id, region) && id > 0)
|
||||
{
|
||||
region[id].isvalid = true;
|
||||
region[id].rx = SDL_clamp(rx, 0, cl.mapwidth - 1);
|
||||
region[id].ry = SDL_clamp(ry, 0, cl.mapheight - 1);
|
||||
region[id].rx2 = SDL_clamp(rx2, 0, cl.mapwidth - 1);
|
||||
region[id].ry2 = SDL_clamp(ry2, 0, cl.mapheight - 1);
|
||||
|
||||
if (id == currentregion)
|
||||
{
|
||||
cl.generatecustomminimap();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void mapclass::removeregion(int id)
|
||||
{
|
||||
if (INBOUNDS_ARR(id, region))
|
||||
if (INBOUNDS_ARR(id, region) && id > 0)
|
||||
{
|
||||
SDL_zero(region[id]);
|
||||
|
||||
if (id == currentregion)
|
||||
{
|
||||
cl.generatecustomminimap();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2326,4 +2339,4 @@ void mapclass::changeregion(int id)
|
||||
currentregion = id;
|
||||
cl.generatecustomminimap();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user