diff --git a/data/common/games/LaserTank/data.lvl b/data/common/games/LaserTank/data.lvl index 175bc9ca66..a118dadec7 100644 Binary files a/data/common/games/LaserTank/data.lvl and b/data/common/games/LaserTank/data.lvl differ diff --git a/programs/games/LaserTank/trunk/LaserTank.cpp b/programs/games/LaserTank/trunk/LaserTank.cpp index dc0b9c56ae..d9ee653849 100644 --- a/programs/games/LaserTank/trunk/LaserTank.cpp +++ b/programs/games/LaserTank/trunk/LaserTank.cpp @@ -44,6 +44,7 @@ #define FIELD_CRATER 25 char* header = "Laser Tank"; +bool w_redraw = true; struct Level { @@ -54,14 +55,20 @@ void pause(int time) { kos_Pause(time); Byte keyCode; + Dword buttons; + int mX, mY; for (int i = 0; i < 10; ++i) + { kos_GetKey(keyCode); + kos_GetMouseState(buttons, mX, mY); + } } Level *levels; int levelCount = 0; int levelIndex = 0; int levelPage = 0; +float clickTime = 0; RGBA img_tank[576]; RGB img_water[576]; @@ -176,6 +183,8 @@ void SetMode(int mode) { gameMode = mode; draw_window(); + + pause(40); } bool IsWater(Point pos) @@ -928,8 +937,12 @@ void player_move(Point vector, float angle) void key_press(int key) { + sProcessInfo sPI; + kos_ProcessInfo(&sPI); + if (sPI.rawData[70] & 0x04) + return; //rtlDebugOutString(ftoa(key)); - + switch (gameMode) { case MODE_MENU: @@ -992,19 +1005,19 @@ void key_press(int key) case MODE_PAUSE: if (key == 27) SetMode(MODE_LEVELS); - - if ((key == 32 || key == 13) && (gameStatus == GAME_NONE || (gameStatus == GAME_VICTORY && levelIndex < (levelCount - 1)))) - { - if (gameStatus == GAME_VICTORY) - openLevel(levelIndex + 1); - SetMode(MODE_GAME); - } - - if (key == 114 || (gameStatus == GAME_DEFEAT && (key == 32 || key == 13))) - { - openLevel(levelIndex); - SetMode(MODE_GAME); - } + else + if ((key == 32 || key == 13) && (gameStatus == GAME_NONE || (gameStatus == GAME_VICTORY && levelIndex < (levelCount - 1)))) + { + if (gameStatus == GAME_VICTORY) + openLevel(levelIndex + 1); + SetMode(MODE_GAME); + } + else + if (key == 114) + { + openLevel(levelIndex); + SetMode(MODE_GAME); + } break; case MODE_GAME: switch (key) @@ -1147,8 +1160,17 @@ void draw_level_number(Point position, int number, RGB color) // 0x252317 void draw_window(void) { - kos_WindowRedrawStatus(1); - kos_DefineAndDrawWindow(10, 40, 384 + 9, 384 + 25, 0x33, 0x444444, 0, 0, (Dword)header); + if (w_redraw) + { + kos_WindowRedrawStatus(1); + + //kos_DefineAndDrawWindow(50, 50, 640, 506 - 22 + kos_GetSkinHeight(), 0x74, 0xEEEEEE, 0, 0, (Dword)windowTitle); + + kos_DefineAndDrawWindow(10, 40, 384 + 9, 384 + 25, 0x74, 0x444444, 0, 0, (Dword)header); + kos_WindowRedrawStatus(2); + w_redraw = false; + } + Point level_pos = Point(0, 0); switch (gameMode) { @@ -1251,7 +1273,6 @@ void draw_window(void) } break; } - kos_WindowRedrawStatus(2); } void LevelsLoad() @@ -1449,6 +1470,7 @@ void kos_Main() switch (kos_WaitForEvent()) { case 1: + w_redraw = true; draw_window(); break; case 2: diff --git a/programs/games/LaserTank/trunk/image.cpp b/programs/games/LaserTank/trunk/image.cpp index 4f99b286a9..3e799e5280 100644 --- a/programs/games/LaserTank/trunk/image.cpp +++ b/programs/games/LaserTank/trunk/image.cpp @@ -115,14 +115,14 @@ void CKosImage::Draw(Point position, float angle) alpha = (float)addPixel.a / 255.0f; - if (this->mode = DRAW_ALPHA) + if (this->mode == DRAW_ALPHA) { newPixel.r = di((double)(pixel.r * (1 - alpha) + addPixel.r * alpha)); newPixel.g = di((double)(pixel.g * (1 - alpha) + addPixel.g * alpha)); newPixel.b = di((double)(pixel.b * (1 - alpha) + addPixel.b * alpha)); } else - if (this->mode = DRAW_ALPHA_ADD) + if (this->mode == DRAW_ALPHA_ADD) { newPixel.r = di(min(255, (double)(pixel.r * (1 - alpha) + addPixel.r * alpha))); newPixel.g = di(min(255, (double)(pixel.g * (1 - alpha) + addPixel.g * alpha))); diff --git a/programs/games/LaserTank/trunk/smalllibc/func.h b/programs/games/LaserTank/trunk/smalllibc/func.h index 3ab4fe6c6b..8bc186b8aa 100644 --- a/programs/games/LaserTank/trunk/smalllibc/func.h +++ b/programs/games/LaserTank/trunk/smalllibc/func.h @@ -3,7 +3,7 @@ #include "kosSyst.h" #include "kosFile.h" -#include "mcsmemm.H" +#include "mcsmemm.h" #include diff --git a/programs/games/LaserTank/trunk/smalllibc/kosSyst.cpp b/programs/games/LaserTank/trunk/smalllibc/kosSyst.cpp index d81634ef92..ba4d969803 100644 --- a/programs/games/LaserTank/trunk/smalllibc/kosSyst.cpp +++ b/programs/games/LaserTank/trunk/smalllibc/kosSyst.cpp @@ -315,7 +315,6 @@ void kos_WriteTextToWindow( kos_sysfunc4(arg2, textPtr, arg1, textLen); } - // функция 5 пауза, в сотых долях секунды void kos_Pause( Dword value ) { @@ -328,7 +327,6 @@ void kos_Pause( Dword value ) } } - // функция 7 нарисовать изображение void kos_PutImage( RGB * imagePtr, Word sizeX, Word sizeY, Word x, Word y ) { @@ -517,9 +515,11 @@ void kos_GetMouseState( Dword & buttons, int & cursorX, int & cursorY ) // kos_ProcessInfo( &sPI ); // + int left = (int)((sPI.processInfo.x_size - 384) / 2); + int top = sPI.processInfo.y_size - 384 - left; buttons = mB; - cursorX = curX - sPI.processInfo.x_start; - cursorY = curY - sPI.processInfo.y_start; + cursorX = curX - sPI.processInfo.x_start - left; + cursorY = curY - sPI.processInfo.y_start - top; }