From 31844eabc6358f7bc5ecd93e5b56a75ac42b68d8 Mon Sep 17 00:00:00 2001 From: Misa Date: Fri, 3 Sep 2021 15:20:16 -0700 Subject: [PATCH] Axe drawcustompixeltextbox in favor of drawpixeltextbox I'm honestly not too sure why drawcustompixeltextbox ever existed? All it seemed to do was draw even more horizontal/vertical tiles to finish any gaps in the tiling... which was all completely unnecessary and wasteful, because even the previous drawpixeltextbox implementation covered all gaps in all custom level map sizes that I tried. Anyway, that at least gets rid of one copy-pasted function. --- desktop_version/src/Graphics.cpp | 35 -------------------------------- desktop_version/src/Graphics.h | 1 - desktop_version/src/Render.cpp | 2 +- 3 files changed, 1 insertion(+), 37 deletions(-) diff --git a/desktop_version/src/Graphics.cpp b/desktop_version/src/Graphics.cpp index af435973..f7acef0c 100644 --- a/desktop_version/src/Graphics.cpp +++ b/desktop_version/src/Graphics.cpp @@ -1326,41 +1326,6 @@ void Graphics::drawpixeltextbox( int x, int y, int w, int h, int w2, int h2, int drawcoloredtile(x + (w) - 8, y + (h) - 8, 47, r, g, b); } -void Graphics::drawcustompixeltextbox( int x, int y, int w, int h, int w2, int h2, int r, int g, int b, int xo, int yo ) -{ - //given these parameters, draw a textbox with a pixel width - - FillRect(backBuffer,x,y,w,h, r/6, g/6, b/6 ); - - for (int k = 0; k < w2-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+ (w) - 16, y, 41, r, g, b); - drawcoloredtile(x+ (w) - 16, y + (h) - 8, 46, r, g, b); - drawcoloredtile(x+ (w) - 24, y, 41, r, g, b); - drawcoloredtile(x+ (w) - 24, y + (h) - 8, 46, r, g, b); - - for (int k = 0; k < h2-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 + (h) - 16, 43, r, g, b); - drawcoloredtile(x + (w) - 8, y + (h) - 16, 44, r, g, b); - drawcoloredtile(x, y + (h) - 24, 43, r, g, b); - drawcoloredtile(x + (w) - 8, y + (h) - 24, 44, r, g, b); - - drawcoloredtile(x, y, 40, r, g, b); - drawcoloredtile(x + (w) - 8, y, 42, r, g, b); - drawcoloredtile(x, y + (h) - 8, 45, r, g, b); - drawcoloredtile(x + (w) - 8, y + (h) - 8, 47, r, g, b); -} - void Graphics::drawtextbox( int x, int y, int w, int h, int r, int g, int b ) { //given these parameters, draw a textbox diff --git a/desktop_version/src/Graphics.h b/desktop_version/src/Graphics.h index 1ec6818d..532b7b9f 100644 --- a/desktop_version/src/Graphics.h +++ b/desktop_version/src/Graphics.h @@ -100,7 +100,6 @@ public: void drawtextbox(int x, int y, int w, int h, int r, int g, int b); void drawpixeltextbox(int x, int y, int w, int h, int w2, int h2, int r, int g, int b, int xo, int yo); - void drawcustompixeltextbox(int x, int y, int w, int h, int w2, int h2, int r, int g, int b, int xo, int yo); void drawcrewman(int x, int y, int t, bool act, bool noshift =false); diff --git a/desktop_version/src/Render.cpp b/desktop_version/src/Render.cpp index b185b13c..7e77f2c3 100644 --- a/desktop_version/src/Render.cpp +++ b/desktop_version/src/Render.cpp @@ -2110,7 +2110,7 @@ void maprender(void) else if(map.custommode) { //draw the map image - graphics.drawcustompixeltextbox(35+map.custommmxoff, 16+map.custommmyoff, map.custommmxsize+10, map.custommmysize+10, (map.custommmxsize+10)/8, (map.custommmysize+10)/8, 65, 185, 207,4,0); + graphics.drawpixeltextbox(35+map.custommmxoff, 16+map.custommmyoff, map.custommmxsize+10, map.custommmysize+10, (map.custommmxsize+10)/8, (map.custommmysize+10)/8, 65, 185, 207,4,0); if (graphics.minimap_mounted) { graphics.drawpartimage(1, 40+map.custommmxoff, 21+map.custommmyoff, map.custommmxsize, map.custommmysize);