Commit c0abe050 authored by nanahira's avatar nanahira

unfinished

parent b37451f5
......@@ -748,7 +748,7 @@ void Game::DrawSpec() {
if(showcard) {
switch(showcard) {
case 1: {
driver->draw2DImage(imageManager.GetTexture(showcardcode, true), Resize(574, 150));
driver->draw2DImage(imageManager.GetTexture(showcardcode, true, true), ResizeCardHint(574, 150));
driver->draw2DImage(imageManager.tMask, Resize(574, 150, 574 + (showcarddif > CARD_IMG_WIDTH ? CARD_IMG_WIDTH : showcarddif), 150 + CARD_IMG_HEIGHT),
recti(CARD_IMG_HEIGHT - showcarddif, 0, CARD_IMG_HEIGHT - (showcarddif > CARD_IMG_WIDTH ? showcarddif - CARD_IMG_WIDTH : 0), CARD_IMG_HEIGHT), 0, 0, true);
showcarddif += 15;
......@@ -759,7 +759,7 @@ void Game::DrawSpec() {
break;
}
case 2: {
driver->draw2DImage(imageManager.GetTexture(showcardcode, true), Resize(574, 150));
driver->draw2DImage(imageManager.GetTexture(showcardcode, true, true), ResizeCardHint(574, 150));
driver->draw2DImage(imageManager.tMask, Resize(574 + showcarddif, 150, 574 + CARD_IMG_WIDTH, 150 + CARD_IMG_HEIGHT),
recti(0, 0, CARD_IMG_WIDTH - showcarddif, CARD_IMG_HEIGHT), 0, 0, true);
showcarddif += 15;
......@@ -769,8 +769,8 @@ void Game::DrawSpec() {
break;
}
case 3: {
driver->draw2DImage(imageManager.GetTexture(showcardcode, true), Resize(574, 150));
driver->draw2DImage(imageManager.tNegated, Resize(536 + showcarddif, 141 + showcarddif, 792 - showcarddif, 397 - showcarddif), recti(0, 0, 128, 128), 0, 0, true);
driver->draw2DImage(imageManager.GetTexture(showcardcode, true, true), ResizeCardHint(574, 150));
driver->draw2DImage(imageManager.tNegated, ResizeCardHint(536 + showcarddif, 141 + showcarddif, 792 - showcarddif, 397 - showcarddif), recti(0, 0, 128, 128), 0, 0, true);
if(showcarddif < 64)
showcarddif += 4;
break;
......@@ -780,8 +780,8 @@ void Game::DrawSpec() {
matManager.c2d[1] = (showcarddif << 24) | 0xffffff;
matManager.c2d[2] = (showcarddif << 24) | 0xffffff;
matManager.c2d[3] = (showcarddif << 24) | 0xffffff;
driver->draw2DImage(imageManager.GetTexture(showcardcode, true), Resize(574, 150, 574 + CARD_IMG_WIDTH, 150 + CARD_IMG_HEIGHT),
Resize(0, 0, CARD_IMG_WIDTH, CARD_IMG_HEIGHT), 0, matManager.c2d, true);
driver->draw2DImage(imageManager.GetTexture(showcardcode, true, true), ResizeCardHint(574, 150, 574 + CARD_IMG_WIDTH, 150 + CARD_IMG_HEIGHT),
ResizeForced(0, 0, CARD_IMG_WIDTH, CARD_IMG_HEIGHT), 0, matManager.c2d, true);
if(showcarddif < 255)
showcarddif += 17;
break;
......@@ -791,15 +791,15 @@ void Game::DrawSpec() {
matManager.c2d[1] = (showcarddif << 25) | 0xffffff;
matManager.c2d[2] = (showcarddif << 25) | 0xffffff;
matManager.c2d[3] = (showcarddif << 25) | 0xffffff;
driver->draw2DImage(imageManager.GetTexture(showcardcode, true), Resize(662 - showcarddif * 0.69685f, 277 - showcarddif, 662 + showcarddif * 0.69685f, 277 + showcarddif),
Resize(0, 0, CARD_IMG_WIDTH, CARD_IMG_HEIGHT), 0, matManager.c2d, true);
driver->draw2DImage(imageManager.GetTexture(showcardcode, true, true), ResizeCardHint(662 - showcarddif * 0.69685f, 277 - showcarddif, 662 + showcarddif * 0.69685f, 277 + showcarddif),
ResizeForced(0, 0, CARD_IMG_WIDTH, CARD_IMG_HEIGHT), 0, matManager.c2d, true);
if(showcarddif < 127)
showcarddif += 9;
break;
}
case 6: {
driver->draw2DImage(imageManager.GetTexture(showcardcode, true), Resize(574, 150));
driver->draw2DImage(imageManager.tNumber, Resize(536 + showcarddif, 141 + showcarddif, 792 - showcarddif, 397 - showcarddif),
driver->draw2DImage(imageManager.GetTexture(showcardcode, true, true), ResizeCardHint(574, 150));
driver->draw2DImage(imageManager.tNumber, ResizeCardHint(536 + showcarddif, 141 + showcarddif, 792 - showcarddif, 397 - showcarddif),
recti((showcardp % 5) * 64, (showcardp / 5) * 64, (showcardp % 5 + 1) * 64, (showcardp / 5 + 1) * 64), 0, 0, true);
if(showcarddif < 64)
showcarddif += 4;
......@@ -812,7 +812,7 @@ void Game::DrawSpec() {
corner[1] = core::position2d<s32>(751 * xScale + (CARD_IMG_HEIGHT * yScale - y) * 0.3f, 404 * yScale - y);
corner[2] = core::position2d<s32>(574 * xScale, 404 * yScale);
corner[3] = core::position2d<s32>(751 * xScale, 404 * yScale);
irr::gui::Draw2DImageQuad(driver, imageManager.GetTexture(showcardcode, true), Resize(0, 0, CARD_IMG_WIDTH, CARD_IMG_HEIGHT), corner);
irr::gui::Draw2DImageQuad(driver, imageManager.GetTexture(showcardcode, true, true), ResizeForced(0, 0, CARD_IMG_WIDTH, CARD_IMG_HEIGHT), corner);
showcardp++;
showcarddif += 9;
if(showcarddif >= 90)
......
......@@ -1656,6 +1656,30 @@ recti Game::ResizeCardHint(s32 x, s32 y, s32 x2, s32 y2) {
y2 = cy + ly;
return recti(x, y, x2, y2);
}
position2di Game::ResizeCardHint(s32 x, s32 y) {
s32 x2 = x + CARD_IMG_WIDTH;
s32 y2 = y + CARD_IMG_HEIGHT;
float mul = xScale;
if(xScale > yScale)
mul = yScale;
s32 cx = (x2 + x) * xScale * 0.5;
s32 cy = (y2 + y) * yScale * 0.5;
s32 lx = (x2 - x) * mul * 0.5;
s32 ly = (y2 - y) * mul * 0.5;
x = cx - lx;
y = cy - ly;
return position2di(x, y);
}
recti Game::ResizeForced(s32 x, s32 y, s32 x2, s32 y2) {
float mul = xScale;
if(xScale > yScale)
mul = yScale;
x = x * mul;
y = y * mul;
x2 = x2 * mul;
y2 = y2 * mul;
return recti(x, y, x2, y2);
}
void Game::SetWindowsIcon() {
#ifdef _WIN32
HINSTANCE hInstance = (HINSTANCE)GetModuleHandleW(NULL);
......
......@@ -157,6 +157,8 @@ public:
recti ResizeWin(s32 x, s32 y, s32 x2, s32 y2, bool chat = false);
recti ResizeCard(s32 x, s32 y, s32 x2, s32 y2);
recti ResizeCardHint(s32 x, s32 y, s32 x2, s32 y2);
position2di ResizeCardHint(s32 x, s32 y);
recti ResizeForced(s32 x, s32 y, s32 x2, s32 y2);
void SetWindowsIcon();
void FlashWindow();
......
......@@ -168,12 +168,18 @@ irr::video::ITexture* ImageManager::GetTextureFromFile(char* file, s32 width, s3
return driver->getTexture(file);
}
}
irr::video::ITexture* ImageManager::GetTexture(int code, bool fit) {
irr::video::ITexture* ImageManager::GetTexture(int code, bool fit, bool forced_fit) {
if(code == 0)
return tUnknown;
int width = CARD_IMG_WIDTH;
int height = CARD_IMG_HEIGHT;
if(fit) {
if(forced_fit) {
float mul = mainGame->xScale;
if(mainGame->xScale > mainGame->yScale)
mul = mainGame->yScale;
width = width * mul;
height = height * mul;
} else if(fit) {
width = width * mainGame->xScale;
height = height * mainGame->yScale;
}
......
......@@ -14,7 +14,7 @@ public:
void ClearTexture();
void RemoveTexture(int code);
irr::video::ITexture* GetTextureFromFile(char* file, s32 width, s32 height);
irr::video::ITexture* GetTexture(int code, bool fit = false);
irr::video::ITexture* GetTexture(int code, bool fit = false, bool forced_fit = false);
irr::video::ITexture* GetTextureThumb(int code);
irr::video::ITexture* GetTextureField(int code);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment