From 2f1fab6ff3547b0320abd882016a85f51b0bc635 Mon Sep 17 00:00:00 2001 From: ZblCoder Date: Tue, 30 Dec 2014 16:48:31 +0000 Subject: [PATCH] LaserTank pause menu added git-svn-id: svn://kolibrios.org@5297 a494cfbc-eb01-0410-851d-a64ba20cac60 --- data/common/games/LaserTank/data.lvl | Bin 4612 -> 4612 bytes data/common/games/LaserTank/data02.pak | 2 +- programs/games/LaserTank/trunk/LaserTank.cpp | 104 ++++++++++++++----- programs/games/LaserTank/trunk/render.cpp | 2 +- 4 files changed, 82 insertions(+), 26 deletions(-) diff --git a/data/common/games/LaserTank/data.lvl b/data/common/games/LaserTank/data.lvl index a1b7d1e93abb0fef6f224c4a807587f557822947..945613fe9ddab570c1f0d6049a02d992b40a1ff2 100644 GIT binary patch delta 183 zcmZosX;IlA$Xd?=2Ml1q!o_  '!4$>`$>a'Dh(Dm2U„2W…0R(Gs2V†5X‹1U‚-Nv#>a%Ad)?("6$:#`'=1  +A'";[$;\&Ae+Lt/Q~)Hp5Y‡,P}-P~.R0R€)Ht1U„,Ly+Js&Bh7W$=^.I 8Y'=+7T-E!7W&Ag3Uƒ-N{.O{3T„5X‰,M|2V†2V†2U†(Ep4Xˆ7^/P~.O{'Be!8W)Ei'Af5R,D1M!<^&Bh*Kv-Nz5Yˆ3V…/Q‚.Q€,M{1U…5ZŠ0Sƒ4XŠ5Y5Z‹1Tƒ*Js%?d!8Z!;_$?c$?a&Bh%Af'@c";] :\)Hs-O{1U„1T„.Q€4Y‰3Xˆ0R0Sƒ,P3Y‰,My2[‰+Lv0Q~+Mx-P|&Af&Af/P|*Fn%Ah$Ci,Js0S€5[-My4Y‰+Kx4Y‰-Nx%@h6[Œ1U„1V†0P€.P~3Y‰-N{-O|+My'Em/Q~ 9\+Lx%?a(Fp*Jr.O}+My:b—.P~0Tƒ.R€7_-P2W‡+Kv%@h6\Ž :`4YŠ%Ai+Iv.N|-Q~%@h-O{(Eq!8Z'Dl0R0U„)Fo'Fp5YŠ-P/R‚1T…1S„,O}7\Ž,Ly7]/P$Ai2T„0P3V….P~1Tƒ1S*Kw9`“.R1U…2V†2U…3U†6[Œ,P~.R(Hs7[Š-N}-P}5W/Q€/T‚0R‚0T‚.P}*Jv.Q2V†2U†*Jv1T…7\!;b2W‡`'=1  +A'";[$;\&Ae+Lt/Q~)Hp5Y‡,P}-P~.R0R€)Ht1U„,Ly+Js&Bh7W$=^.I 8Y'=+7T-E!7W&Ag3Uƒ-N{.O{3T„5X‰,M|2V†2V†2U†(Ep4Xˆ7^/P~.O{'Be!8W)Ei'Af5R,D1M!<^&Bh*Kv-Nz5Yˆ3V…/Q‚.Q€,M{1U…5ZŠ0Sƒ4XŠ5Y5Z‹1Tƒ*Js%?d!8Z!;_$?c$?a&Bh%Af'@c";] :\)Hs-O{1U„1T„.Q€4Y‰3Xˆ0R0Sƒ,P3Y‰,My2[‰+Lv0Q~+Mx-P|&Af&Af/P|*Fn%Ah$Ci,Js0S€5[-My4Y‰+Kx4Y‰-Nx%@h6[Œ1U„1V†0P€.P~3Y‰-N{-O|+My'Em/Q~ 9\+Lx%?a(Fp*Jr.O}+My:b—.P~0Tƒ.R€7_-P2W‡+Kv%@h6\Ž :`4YŠ%Ai+Iv.N|-Q~%@h-O{(Eq!8Z'Dl0R0U„)Fo'Fp5YŠ-P/R‚1T…1S„,O}7\Ž,Ly7]/P$Ai2T„0P3V….P~1Tƒ1S*Kw9`“.R1U…2V†2U…3U†6[Œ,P~.R(Hs7[Š-N}-P}5W/Q€/T‚0R‚0T‚.P}*Jv.Q2V†2U†*Jv1T…7\!;b2W‡Draw(Point(0, 0)); + //kos_PutImage((RGB*)img_ground, 24, 24, 100, 100); + break; + case MODE_PAUSE: + for (int y = 0; y < 4; y++) + for (int x = 0; x < 4; x++) + renderLevels->RenderImg((RGB*)img_gamebg, Point(96 * x, 96 * y), 96, 96); - //kos_PutImage((RGB*)img_ground, 24, 24, 100, 100); - + for (int y = 0; y < 16; y++) + for (int x = 0; x < 16; x++) + if (level[y][x].s != FIELD_NONE) + renderLevels->RenderImg(GetImg(Point(x, y), true), Point(24 * x, 24 * y), 24, 24); + + switch (gameStatus) + { + case GAME_NONE: + objPlayer1->Draw(player.position * 24, player.angle); + break; + case GAME_VICTORY: + kos_WriteTextToWindow(30, 10, 0x80, 0xFFFFFF, "VICTORY", 0); + break; + case GAME_DEFEAT: + kos_WriteTextToWindow(30, 10, 0x80, 0xFFFFFF, "DEFEAT", 0); + break; + } + + for (int y = 0; y < 16; y++) + for (int x = 0; x < 16; x++) + objblack->Draw(Point(24 * x, 24 * y), 0); + + if (gameStatus != GAME_DEFEAT) + renderLevels->RenderImg((RGB*)img_buttons[1], Point(77, 192), 229, 57); + renderLevels->RenderImg((RGB*)img_buttons[2], Point(77, 255), 229, 57); + renderLevels->RenderImg((RGB*)img_buttons[0], Point(77, 318), 229, 57); + + renderLevels->Draw(Point(0, 0)); break; case MODE_GAME: for (int y = 0; y < 4; y++) for (int x = 0; x < 4; x++) kos_PutImage((RGB*)img_gamebg, 96, 96, 96 * x, 96 * y); - for (int y = 0; y < 16; y++) for (int x = 0; x < 16; x++) - { if (level[y][x].s != FIELD_NONE) - kos_PutImage(GetImg(Point(x, y), true), 24, 24, 24 * x, 24 * y); - } + kos_PutImage(GetImg(Point(x, y), true), 24, 24, 24 * x, 24 * y); - switch (gameStatus) + if(gameStatus != GAME_DEFEAT) { - case GAME_NONE: renderPlayer->RenderImg(GetImg(player.position, false), Point(0, 0), 24, 24); objPlayer->Draw(Point(0, 0), player.angle); renderPlayer->Draw(player.position * 24); - break; - case GAME_VICTORY: - kos_WriteTextToWindow(30, 10, 0x80, 0xFFFFFF, "VICTORY", 0); - break; - case GAME_DEFEAT: - kos_WriteTextToWindow(30, 10, 0x80, 0xFFFFFF, "DEFEAT", 0); - break; } break; } @@ -1187,7 +1234,12 @@ void kos_Main() file->LoadTex((Byte*)img_wall_x, 3, 24, 24); file->LoadTex((Byte*)img_crater, 3, 24, 24); - + + file->LoadTex((Byte*)img_black, 4, 24, 24); + + for (int i = 0; i < 3; ++i) + file->LoadTex((Byte*)img_buttons[i], 3, 229, 57); + delete file; renderPlayer = new CKosRender(24, 24); @@ -1212,12 +1264,16 @@ void kos_Main() objExplosion->SetFrameSize(24, 24); renderLevels = new CKosRender(384, 384); + + objPlayer1 = new CKosImage(renderLevels, (RGBA*)img_tank, 24, 24); objnumber_box = new CKosImage(renderLevels, (RGBA*)img_number_box, 51, 50); objnumbers = new CKosImage(renderLevels, (RGBA*)img_numbers, 14, 25); objnumbers->SetFrameSize(14, 25); objbutton1 = new CKosImage(renderLevels, (RGBA*)img_button1, 57, 57); objbutton_arrow = new CKosImage(renderLevels, (RGBA*)img_button_arrow, 25, 15); + + objblack = new CKosImage(renderLevels, (RGBA*)img_black, 24, 24); LevelsLoad(); diff --git a/programs/games/LaserTank/trunk/render.cpp b/programs/games/LaserTank/trunk/render.cpp index 9d5f9beed2..9d20c4df0e 100644 --- a/programs/games/LaserTank/trunk/render.cpp +++ b/programs/games/LaserTank/trunk/render.cpp @@ -25,7 +25,7 @@ void CKosRender::RenderImg(RGB *img, Point position, int width, int height) for (int y = position.Y; y < position.Y + height; y++) for (int x = position.X; x < position.X + width; x++) if (x >= 0 && y >= 0 && x < this->width && y < this->height) - this->buffer[y * width + x] = img[(y - position.Y) * width + (x - position.X)]; + this->buffer[y * this->width + x] = img[(y - position.Y) * width + (x - position.X)]; } int CKosRender::getPixel(int x, int y)