flood-it: use scancodes, bigger font in help, minor fixes

git-svn-id: svn://kolibrios.org@6174 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
Kirill Lipatov (Leency) 2016-02-08 18:09:20 +00:00
parent 69caef0eaf
commit 51d197a035
4 changed files with 45 additions and 56 deletions

View File

@ -1,7 +1,9 @@
del lang.h-- @del lang.h--
echo #define LANG_ENG 1 >lang.h-- @echo #define LANG_ENG 1 >lang.h--
C-- flood-it.c C-- flood-it.c
del flood-it! @del flood-it
rename flood-it.com flood-it @rename flood-it.com flood-it
C--\kpack flood-it @kpack flood-it
pause @del lang.h--
@del warning.txt
@pause

View File

@ -1,7 +1,9 @@
del lang.h-- @del lang.h--
echo #define LANG_RUS 1 >lang.h-- @echo #define LANG_RUS 1 >lang.h--
C-- flood-it.c C-- flood-it.c
del flood-it @del flood-it
rename flood-it.com flood-it @rename flood-it.com flood-it
kpack flood-it @kpack flood-it
pause @del lang.h--
@del warning.txt
@pause

View File

@ -160,31 +160,31 @@ void main()
new_game(); 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; break;
case evKey: case evKey:
key = GetKey(); key = GetKeyScancode();
IF (key==027) //Escape IF (key==01) //Escape
ExitProcess(); ExitProcess();
IF (key==050) //F1 IF (key==59) //F1
{ {
_HELP_MARK: _HELP_MARK:
CreateThread(#help,#stak); CreateThread(#help,#stak);
} }
IF (key==051) //F2 IF (key==60) //F2
{ {
_NEW_GAME_MARK: _NEW_GAME_MARK:
new_game(); new_game();
draw_clicks_num(); draw_clicks_num();
draw_field(); draw_field();
} }
IF (key==113) make_turn(0); //Q IF (key==16) make_turn(0); //Q
IF (key==119) make_turn(1); //W IF (key==17) make_turn(1); //W
IF (key==101) make_turn(2); //E IF (key==18) make_turn(2); //E
IF (key==097) make_turn(3); //A IF (key==30) make_turn(3); //A
IF (key==115) make_turn(4); //S IF (key==31) make_turn(4); //S
IF (key==100) make_turn(5); //D IF (key==32) make_turn(5); //D
break; break;
case evReDraw: case evReDraw:
draw_window(); draw_window();
@ -214,7 +214,7 @@ void draw_window()
sc.get(); 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); GetProcessInfo(#Form, SelfInfo);
@ -390,7 +390,7 @@ void draw_clicks_num()
#define TEXT_X 21 #define TEXT_X 21
#define TEXT_Y 92 #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); WriteText(TEXT_X,TEXT_Y,0x80,sc.work_text,#CLICKS_TEXT,0);
@ -421,22 +421,18 @@ void help()
{ {
int i; int i;
loop() loop() switch (WaitEvent())
switch (WaitEvent())
{ {
CASE evButton: case evButton:
IF (GetButtonID()==1) ExitProcess(); ExitProcess();
case evKey:
IF (GetKeyScancode()==001) ExitProcess(); //Esc
break; break;
CASE evKey: case evReDraw:
IF (GetKey()==27) ExitProcess(); //Esc
break;
CASE evReDraw:
for (i=0; HELP_TEXT[i]<>0; i++;) {}; for (i=0; HELP_TEXT[i]<>0; i++;) {};
DefineAndDrawWindow(400,200,610,i*19+25+GetSkinHeight(),0x34,sc.work,0,0,#HELP_WINDOW_CAPTION);
DefineAndDrawWindow(500,200,450,i*13+44,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);
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);
} }
} }

View File

@ -67,26 +67,15 @@ inline fastcall dword WaitEvent(){
$int 0x40 $int 0x40
} }
inline fastcall int GetKeyScancode()
inline fastcall word GetKey() //+Gluk fix
{ {
$push edx
GETKEY:
$mov eax,2 $mov eax,2
$int 0x40 $int 0x40
$cmp eax,1 $shr eax,16
$jne GETKEYI return AL;
$mov ah,dh
$jmp GETKEYII //jz?
GETKEYI:
$mov dh,ah
$jmp GETKEY
GETKEYII:
$pop edx
$shr eax,8
} }
inline fastcall word GetButtonID(){ word GetButtonID(){
EAX = 17; EAX = 17;
$int 0x40 $int 0x40
EAX = EAX >> 8; EAX = EAX >> 8;
@ -168,7 +157,7 @@ inline fastcall dword CreateThread(dword ECX,EDX)
$int 0x40 $int 0x40
} }
inline fastcall dword GetSkinWidth() dword GetSkinHeight()
{ {
$push ebx $push ebx
$mov eax, 48 $mov eax, 48