TA: Kingdoms Forums
Would you like to react to this message? Create an account in a few clicks or log in to continue.


Welcome to TA: Kingdoms
 
HomePortalGallerySearchLatest imagesRegisterLog in

 

 Wqaopl's tnt maker

Go down 
4 posters
Go to page : Previous  1, 2
AuthorMessage
Wqaopl

Wqaopl


Posts : 216
Reputation : 2
Join date : 2008-08-14

Wqaopl's tnt maker - Page 2 Empty
PostSubject: Re: Wqaopl's tnt maker   Wqaopl's tnt maker - Page 2 EmptyFri 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.
Back to top Go down
$_Spagg

$_Spagg


Posts : 385
Reputation : 14
Join date : 2010-10-31
Age : 111
Location : Brazil

Wqaopl's tnt maker - Page 2 Empty
PostSubject: Re: Wqaopl's tnt maker   Wqaopl's tnt maker - Page 2 EmptyFri 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
Back to top Go down
 
Wqaopl's tnt maker
Back to top 
Page 2 of 2Go to page : Previous  1, 2
 Similar topics
-
» tnt maker

Permissions in this forum:You cannot reply to topics in this forum
TA: Kingdoms Forums :: GENERAL :: General Chat-
Jump to: