Wqaopl
Posts : 216 Reputation : 2 Join date : 2008-08-14
| Subject: Re: Wqaopl's tnt maker Fri Aug 12, 2016 8:58 am | |
| ok i found out the sizing of the tab its to fit in the battle screan as states by the game GUI (431 512) and will scale to fit in.
| |
|
$_Spagg
Posts : 385 Reputation : 14 Join date : 2010-10-31 Age : 111 Location : Brazil
| Subject: Re: Wqaopl's tnt maker Fri Aug 12, 2016 10:30 am | |
| Thanks your post I think I got it, the final formula is along the lines of: - Code:
-
const int w = 511; const int h = 431;
// these are the size inputs in cartographer int x = 10; int y = 10;
// 64 and 16 come from the red areas that are cut for the tab map double px = (x * 256) - 16; double py = (y * 256) - 64;
double scale = (py < h) ? (w / px) : (h / py); int resultX = (py < h) ? 0 : 1; int resultY = (py < h) ? 1 : 0;
resultX += (px * scale); resultY += (py * scale);
printf("x: %d\ny: %d\n", resultX, resultY); Some of the conditions (py < h) were put deliberately and I still need to test other dimensions I only tested from the dimensions 1x1 ... 10x10 (only same sized dimensions, still need to test uneven dimensions like 3x4 etc) and they were all correct | |
|