From 51d197a0353dfb695bf25bdbfe955cd99ecbf737 Mon Sep 17 00:00:00 2001 From: "Kirill Lipatov (Leency)" Date: Mon, 8 Feb 2016 18:09:20 +0000 Subject: [PATCH] flood-it: use scancodes, bigger font in help, minor fixes git-svn-id: svn://kolibrios.org@6174 a494cfbc-eb01-0410-851d-a64ba20cac60 --- programs/games/flood-it/trunk/compile_eng.bat | 14 +++--- programs/games/flood-it/trunk/compile_rus.bat | 14 +++--- programs/games/flood-it/trunk/flood-it.c | 48 +++++++++---------- programs/games/flood-it/trunk/lib/kolibri.h | 25 +++------- 4 files changed, 45 insertions(+), 56 deletions(-) diff --git a/programs/games/flood-it/trunk/compile_eng.bat b/programs/games/flood-it/trunk/compile_eng.bat index 805fac4f5e..947b137f80 100644 --- a/programs/games/flood-it/trunk/compile_eng.bat +++ b/programs/games/flood-it/trunk/compile_eng.bat @@ -1,7 +1,9 @@ -del lang.h-- -echo #define LANG_ENG 1 >lang.h-- +@del lang.h-- +@echo #define LANG_ENG 1 >lang.h-- C-- flood-it.c -del flood-it! -rename flood-it.com flood-it -C--\kpack flood-it -pause \ No newline at end of file +@del flood-it +@rename flood-it.com flood-it +@kpack flood-it +@del lang.h-- +@del warning.txt +@pause \ No newline at end of file diff --git a/programs/games/flood-it/trunk/compile_rus.bat b/programs/games/flood-it/trunk/compile_rus.bat index 0d3ea03512..bcd55f9b4e 100644 --- a/programs/games/flood-it/trunk/compile_rus.bat +++ b/programs/games/flood-it/trunk/compile_rus.bat @@ -1,7 +1,9 @@ -del lang.h-- -echo #define LANG_RUS 1 >lang.h-- +@del lang.h-- +@echo #define LANG_RUS 1 >lang.h-- C-- flood-it.c -del flood-it -rename flood-it.com flood-it -kpack flood-it -pause \ No newline at end of file +@del flood-it +@rename flood-it.com flood-it +@kpack flood-it +@del lang.h-- +@del warning.txt +@pause \ No newline at end of file diff --git a/programs/games/flood-it/trunk/flood-it.c b/programs/games/flood-it/trunk/flood-it.c index f06d3ddd46..fe458d8c27 100644 --- a/programs/games/flood-it/trunk/flood-it.c +++ b/programs/games/flood-it/trunk/flood-it.c @@ -160,31 +160,31 @@ void main() new_game(); - MoveSize(-1, -1, BLOCK_SIZE*BLOCKS_NUM +14+USER_PANEL_WIDTH, BLOCK_SIZE*BLOCKS_NUM +GetSkinWidth()+14); + MoveSize(-1, -1, BLOCK_SIZE*BLOCKS_NUM +14+USER_PANEL_WIDTH, BLOCK_SIZE*BLOCKS_NUM +GetSkinHeight()+14); } break; case evKey: - key = GetKey(); - IF (key==027) //Escape + key = GetKeyScancode(); + IF (key==01) //Escape ExitProcess(); - IF (key==050) //F1 + IF (key==59) //F1 { _HELP_MARK: CreateThread(#help,#stak); } - IF (key==051) //F2 + IF (key==60) //F2 { _NEW_GAME_MARK: new_game(); draw_clicks_num(); draw_field(); } - IF (key==113) make_turn(0); //Q - IF (key==119) make_turn(1); //W - IF (key==101) make_turn(2); //E - IF (key==097) make_turn(3); //A - IF (key==115) make_turn(4); //S - IF (key==100) make_turn(5); //D + IF (key==16) make_turn(0); //Q + IF (key==17) make_turn(1); //W + IF (key==18) make_turn(2); //E + IF (key==30) make_turn(3); //A + IF (key==31) make_turn(4); //S + IF (key==32) make_turn(5); //D break; case evReDraw: draw_window(); @@ -214,7 +214,7 @@ void draw_window() sc.get(); - DefineAndDrawWindow(300,176, BLOCK_SIZE*BLOCKS_NUM +14+USER_PANEL_WIDTH, BLOCK_SIZE*BLOCKS_NUM +GetSkinWidth()+14, 0x74,sc.work,0,0,"Flood-it!"); + DefineAndDrawWindow(300,176, BLOCK_SIZE*BLOCKS_NUM +14+USER_PANEL_WIDTH, BLOCK_SIZE*BLOCKS_NUM +GetSkinHeight()+14, 0x74,sc.work,0,0,"Flood-it!"); //проверяем не схлопнуто ли окно в заголовок GetProcessInfo(#Form, SelfInfo); @@ -390,7 +390,7 @@ void draw_clicks_num() #define TEXT_X 21 #define TEXT_Y 92 - DrawBar(8*6+TEXT_X, TEXT_Y, 6*2,9, sc.work); + DrawBar(TEXT_X, TEXT_Y, USER_PANEL_WIDTH-TEXT_X-3,9, sc.work); WriteText(TEXT_X,TEXT_Y,0x80,sc.work_text,#CLICKS_TEXT,0); @@ -421,22 +421,18 @@ void help() { int i; - loop() - switch (WaitEvent()) + loop() switch (WaitEvent()) { - CASE evButton: - IF (GetButtonID()==1) ExitProcess(); + case evButton: + ExitProcess(); + case evKey: + IF (GetKeyScancode()==001) ExitProcess(); //Esc break; - CASE evKey: - IF (GetKey()==27) ExitProcess(); //Esc - break; - CASE evReDraw: + case evReDraw: for (i=0; HELP_TEXT[i]<>0; i++;) {}; - - DefineAndDrawWindow(500,200,450,i*13+44,0x34,sc.work,0,0,#HELP_WINDOW_CAPTION); - - WriteText(6,12,0x80,sc.work_text,HELP_TEXT[0],0); //это для жирного шрифта - for (i=0; HELP_TEXT[i]<>0; i++;) WriteText(5,i*13+12,0x80,sc.work_text,HELP_TEXT[i],0); + DefineAndDrawWindow(400,200,610,i*19+25+GetSkinHeight(),0x34,sc.work,0,0,#HELP_WINDOW_CAPTION); + WriteText(6,12,0x90,sc.work_text,HELP_TEXT[0],0); //это для жирного шрифта + for (i=0; HELP_TEXT[i]<>0; i++;) WriteText(5,i*19+12,0x90,sc.work_text,HELP_TEXT[i],0); } } diff --git a/programs/games/flood-it/trunk/lib/kolibri.h b/programs/games/flood-it/trunk/lib/kolibri.h index 9e1150792f..495e164baa 100644 --- a/programs/games/flood-it/trunk/lib/kolibri.h +++ b/programs/games/flood-it/trunk/lib/kolibri.h @@ -67,26 +67,15 @@ inline fastcall dword WaitEvent(){ $int 0x40 } - -inline fastcall word GetKey() //+Gluk fix +inline fastcall int GetKeyScancode() { - $push edx -GETKEY: - $mov eax,2 - $int 0x40 - $cmp eax,1 - $jne GETKEYI - $mov ah,dh - $jmp GETKEYII //jz? -GETKEYI: - $mov dh,ah - $jmp GETKEY -GETKEYII: - $pop edx - $shr eax,8 + $mov eax,2 + $int 0x40 + $shr eax,16 + return AL; } -inline fastcall word GetButtonID(){ +word GetButtonID(){ EAX = 17; $int 0x40 EAX = EAX >> 8; @@ -168,7 +157,7 @@ inline fastcall dword CreateThread(dword ECX,EDX) $int 0x40 } -inline fastcall dword GetSkinWidth() +dword GetSkinHeight() { $push ebx $mov eax, 48