1
0
Fork 0
mirror of https://github.com/TerryCavanagh/VVVVVV.git synced 2024-12-23 01:59:43 +01:00

drawpixeltextbox: Don't use unneeded variables

`w` and `h` are provided alongside `w2` and `h2`. `w2` and `h2` are in
blocks of 8, while `w` and `h` are in pixels. Therefore, `w2` and `h2`
can just be figured out by diving `w` and `h` by 8.

Also, `xo` and `yo` were used to slide the horizontal/vertical tiling of
the text box a bit into one set of corners, so the horizontal/vertical
tiling wouldn't visibly overlap with the other corners, if using default
textures. This requires hardcoding it for each width/height of text box,
which isn't something that's generalizable. Also, it results in corners
that look weird if the corners have custom textures that don't adhere to
the same shape as default textures.

In the next commit I'll fix the non-multiple-of-8 text box dimensions
differently. Can't do it in this commit or the diff looks weird (at
least with my diff algorithm).
This commit is contained in:
Misa 2021-09-03 14:59:00 -07:00
parent 651cd4b674
commit 1eb3e73c00

View file

@ -1296,16 +1296,16 @@ void Graphics::drawpixeltextbox( int x, int y, int w, int h, int w2, int h2, int
//madrect.x = x; madrect.y = y; madrect.w = w; madrect.h = h;
FillRect(backBuffer,x,y,w,h, r/6, g/6, b/6 );
for (int k = 0; k < w2-2; k++)
for (int k = 0; k < w/8-2; k++)
{
drawcoloredtile(x + 8-xo + (k * 8), y, 41, r, g, b);
drawcoloredtile(x + 8-xo + (k * 8), y + (h) - 8, 46, r, g, b);
drawcoloredtile(x + 8 + (k * 8), y, 41, r, g, b);
drawcoloredtile(x + 8 + (k * 8), y + (h) - 8, 46, r, g, b);
}
for (int k = 0; k < h2-2; k++)
for (int k = 0; k < h/8-2; k++)
{
drawcoloredtile(x, y + 8-yo + (k * 8), 43, r, g, b);
drawcoloredtile(x + (w) - 8, y + 8-yo + (k * 8), 44, r, g, b);
drawcoloredtile(x, y + 8 + (k * 8), 43, r, g, b);
drawcoloredtile(x + (w) - 8, y + 8 + (k * 8), 44, r, g, b);
}
drawcoloredtile(x, y, 40, r, g, b);