TheBus v1.0, fix Eolite properties dialog crash

git-svn-id: svn://kolibrios.org@6995 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
Kirill Lipatov (Leency) 2017-09-19 12:21:07 +00:00
parent 4765b12e72
commit cd1a41c60e
5 changed files with 67 additions and 20 deletions

View File

@ -386,7 +386,7 @@ void DrawPropertiesWindow()
DrawIconByExtension(NULL, NULL, 18, 49, system.color.work); DrawIconByExtension(NULL, NULL, 18, 49, system.color.work);
sprintf(#folder_info,"%s%d%s%d",SET_6,file_count,SET_7,dir_count); sprintf(#folder_info,"%s%d%s%d",SET_6,file_count,SET_7,dir_count);
WriteText(50, 49, 0x90, system.color.work_text, #folder_info); WriteText(50, 49, 0x90, system.color.work_text, #folder_info);
sprintf(#element_size_label,"%s (%d %s)",ConvertSize64(size_dir),size_dir,SET_BYTE_LANG); sprintf(#element_size_label,"%s (%d %s)",ConvertSize64(size_dir, NULL),size_dir,SET_BYTE_LANG);
WriteText(120, 97, 0x90, system.color.work_text, #element_size_label); WriteText(120, 97, 0x90, system.color.work_text, #element_size_label);
} }
else else
@ -416,7 +416,7 @@ void DrawPropertiesWindow()
DrawDate(120, 156, system.color.work, #file_info_general.datelastaccess); DrawDate(120, 156, system.color.work, #file_info_general.datelastaccess);
DrawDate(120, 176, system.color.work, #file_info_general.datelastedit); DrawDate(120, 176, system.color.work, #file_info_general.datelastedit);
sprintf(#element_size_label,"%s (%d %s)",ConvertSize64(element_size),element_size,SET_BYTE_LANG); sprintf(#element_size_label,"%s (%d %s)",ConvertSize64(element_size, NULL),element_size,SET_BYTE_LANG);
WriteText(120, 99, 0x90, system.color.work_text, #element_size_label); WriteText(120, 99, 0x90, system.color.work_text, #element_size_label);
} }
flags_frame.size_x = - flags_frame.start_x * 2 + settings_form.cwidth - 2; flags_frame.size_x = - flags_frame.start_x * 2 + settings_form.cwidth - 2;

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.7 KiB

After

Width:  |  Height:  |  Size: 5.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 9.9 KiB

After

Width:  |  Height:  |  Size: 4.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.6 KiB

After

Width:  |  Height:  |  Size: 4.7 KiB

View File

@ -23,6 +23,8 @@ libimg_image menu;
libimg_image road; libimg_image road;
libimg_image objects; libimg_image objects;
int frame_timeout = 1;
int lives=0, level=0, score=0; int lives=0, level=0, score=0;
int don_x, don_y, don_h, don_w=68, don_type, don_image_y, don_step_y, don_step_y_default=3; int don_x, don_y, don_h, don_w=68, don_type, don_image_y, don_step_y, don_step_y_default=3;
int don_h_mas[8] = { 36,72,36,74,24,64,48,74 }; int don_h_mas[8] = { 36,72,36,74,24,64,48,74 };
@ -43,12 +45,57 @@ int screen_type=SCR_MENU_MAIN;
int active_menu_item=0; int active_menu_item=0;
#ifdef LANG_RUS
#define THE_BUS_TEXT "Œ àèàã⪠"
#define CONTROLS_TEXT "'Œ àèàã⪠
¯à ¢«¥­¨¥:
«¥¢®/¯à ¢® ¨«¨ <EFBFBD>஡¥«
Š« ¢¨è  P áâ ¢¨â ­  ¯ ã§ã'tI"
#define ABOUT_TEXT "'Œ àèàã⪠
¥àá¨ï v1.0
ë£à ©â¥ §  ¤¥à᪮£® ¬ àèàãâ稪 ,
ª®â®àë© ­¥á¥âáï ¤®¬®© ¯®á«¥ ᬥ­ë.
Ž­ 㦥 ¢ê¥¡ « àåã á ¬ã¦¨ª ¬¨
¨ ⥯¥àì ¥£® ­¨çâ® ­¥ ®áâ ­®¢¨â!
¢â®à Leency
Š à⨭ª  ¢ ¬¥­î Freepik.com'tI"
#define PAUSE_TEXT "<22>€“‡€"
#define GAME_OVER_TEXT "ˆ£à  ®ª®­ç¥­ "
#define FINAL_SCORE_TEXT "”¨­ «ì­ë© áç¥â"
#define LIVES_TEXT "†¨§­¨"
#define LEVEL_TEXT "“஢¥­ì"
#define SCORE_TEXT "‘ç¥â"
char *MENU_LIST[]={
"<EFBFBD>®¢ ï ¨£à ",
"“¯à ¢«¥­¨¥",
"Ž¡ ¨£à¥",
"‚ë室",
0};
#else
#define THE_BUS_TEXT "THE BUS"
#define CONTROLS_TEXT "'The Bus
Control keys:
Left, Right, Space
Press P key for pause'tI"
#define ABOUT_TEXT "'The Bus
Version v1.0
Author: Leency
Menu image from Freepik.com'tI"
#define PAUSE_TEXT "PAUSE"
#define GAME_OVER_TEXT "GAME OVER"
#define FINAL_SCORE_TEXT "Final Score"
#define LIVES_TEXT "Lives"
#define LEVEL_TEXT "Level"
#define SCORE_TEXT "Score"
char *MENU_LIST[]={ char *MENU_LIST[]={
"New game", "New game",
"Control keys", "Control keys",
"About", "About",
"Exit", "Exit",
0}; 0};
#endif
void DrawObstacle(signed int x, y) { void DrawObstacle(signed int x, y) {
@ -64,7 +111,8 @@ void DrawObstacle(signed int x, y) {
don_offset_y = don_image_y - y; don_offset_y = don_image_y - y;
y = 0; y = 0;
} }
if (y>=don_step_y) DrawBar(x, y-don_step_y, don_w, don_step_y, COLOR_ROAD); //Fill donkey old parts DrawBar(x, y-don_step_y, don_w, don_step_y, COLOR_ROAD);
if (y>0) && (y<don_step_y) DrawBar(x, 0, don_w, y, COLOR_ROAD);
if (image_h>0) DrawLibImage(objects.image, x, y, don_w, image_h, 0, don_offset_y); if (image_h>0) DrawLibImage(objects.image, x, y, don_w, image_h, 0, don_offset_y);
} }
void DrawBus(dword x, y) { DrawLibImage(objects.image, x, y, bus_w, bus_h, 0, 444); } void DrawBus(dword x, y) { DrawLibImage(objects.image, x, y, bus_w, bus_h, 0, 444); }
@ -79,13 +127,13 @@ void main()
load_dll(libio, #libio_init,1); load_dll(libio, #libio_init,1);
load_dll(libimg, #libimg_init,1); load_dll(libimg, #libimg_init,1);
Libimg_LoadImage(#menu, "menu.png"); Libimg_LoadImage(#menu, abspath("menu.png"));
Libimg_LoadImage(#road, "road.png"); Libimg_LoadImage(#road, abspath("road.png"));
Libimg_LoadImage(#objects, "objects.png"); Libimg_LoadImage(#objects, abspath("objects.png"));
loop() loop()
{ {
WaitEventTimeout(1); WaitEventTimeout(frame_timeout);
switch(EAX & 0xFF) switch(EAX & 0xFF)
{ {
@ -113,8 +161,8 @@ void main()
StartNewGame(); StartNewGame();
SetScreen(SCR_GAME); SetScreen(SCR_GAME);
} }
if (active_menu_item==1) notify("'The Bus\nControl keys:\nLeft, Right, Space\nPress P key for pause'tI"); if (active_menu_item==1) notify(CONTROLS_TEXT);
if (active_menu_item==2) notify("'The Bus\nVersion v0.9\nAuthor: Leency\nMenu image from Freepik.com'tI"); if (active_menu_item==2) notify(ABOUT_TEXT);
if (active_menu_item==3) ExitProcess(); if (active_menu_item==3) ExitProcess();
} }
if (key_scancode == SCAN_CODE_SPACE) && (screen_type==SCR_GAME) if (key_scancode == SCAN_CODE_SPACE) && (screen_type==SCR_GAME)
@ -143,7 +191,7 @@ void main()
break; break;
case evReDraw: case evReDraw:
DefineAndDrawWindow(250,150,WIN_X-1,WIN_Y-1,0x01,0,"The Bus",0); //0x74 is also possible if you fix bottom border DefineAndDrawWindow(250,150,WIN_X-1,WIN_Y-1,0x01,0,THE_BUS_TEXT,0); //0x74 is also possible if you fix bottom border
DrawScreen(); DrawScreen();
break; break;
@ -154,7 +202,7 @@ void main()
default: default:
if (screen_type==SCR_GAME) if (screen_type==SCR_GAME)
{ {
if ((don_x == bus_x)&&(don_y + don_h > bus_y )&&(don_y < bus_y + don_h )) { if ((don_x == bus_x)&&(don_y + don_h > bus_y )&&(don_y < bus_y + don_h ) {
lives--; lives--;
DrawBus(bus_x*80+200,bus_y); DrawBus(bus_x*80+200,bus_y);
DrawBoom(bus_x*80+180,302); DrawBoom(bus_x*80+180,302);
@ -175,7 +223,7 @@ void main()
GetNewObstacle(RAND); GetNewObstacle(RAND);
score++; score++;
bus_y -= don_step_y+1; bus_y -= don_step_y+1;
DrawBar(bus_x*80+200, bus_y+bus_h, bus_w, don_step_y, COLOR_ROAD); DrawBar(bus_x*80+200, bus_y+bus_h, bus_w, don_step_y+1, COLOR_ROAD);
WriteScore(); WriteScore();
} }
@ -211,7 +259,7 @@ void StartNewGame()
void WriteScore() { void WriteScore() {
DrawLibImage(road.image, 20, 166, 120, 24, 20, 164); DrawLibImage(road.image, 20, 166, 120, 24, 20, 164);
WriteText(20, 140, 0x81, 0xFFFFFF, "Score"); WriteText(20, 140, 0x81, 0xFFFFFF, SCORE_TEXT);
WriteText(20, 166, 0x81, 0xFFFFFF, itoa(score)); WriteText(20, 166, 0x81, 0xFFFFFF, itoa(score));
} }
@ -226,21 +274,21 @@ void DrawScreen()
if (screen_type==SCR_MENU_MAIN) if (screen_type==SCR_MENU_MAIN)
{ {
DrawMenuBackground(); DrawMenuBackground();
WriteTextB(20, 20, 0x82, 0xE8783F, "THE BUS"); WriteTextB(20, 20, 0x83, 0xE8783F, THE_BUS_TEXT);
DrawMenuList(); DrawMenuList();
} }
if (screen_type==SCR_GAME) || (screen_type==SCR_PAUSE) if (screen_type==SCR_GAME) || (screen_type==SCR_PAUSE)
{ {
DrawHighway(); DrawHighway();
WriteText(20, 20, 0x81, 0xFFFFFF, "Lives"); WriteText(20, 20, 0x81, 0xFFFFFF, LIVES_TEXT);
WriteText(20, 46, 0x81, 0xFFFFFF, itoa(lives)); WriteText(20, 46, 0x81, 0xFFFFFF, itoa(lives));
WriteText(20, 80, 0x81, 0xFFFFFF, "Level"); WriteText(20, 80, 0x81, 0xFFFFFF, LEVEL_TEXT);
WriteText(20, 106, 0x81, 0xFFFFFF, itoa(level)); WriteText(20, 106, 0x81, 0xFFFFFF, itoa(level));
WriteScore(); WriteScore();
DrawRoad(); DrawRoad();
if (screen_type==SCR_PAUSE) { if (screen_type==SCR_PAUSE) {
DrawBar(0,0,140,60,0xFF0000); DrawBar(0,0,140,60,0xFF0000);
WriteText(10,14,0x83,0xFFFfff,"PAUSE"); WriteText(10,14,0x83,0xFFFfff,PAUSE_TEXT);
} }
} }
} }
@ -260,12 +308,11 @@ void DrawMenuItem(int item_n, text_n)
WriteText(20, item_n*56+116, 0x81, color, MENU_LIST[text_n]); WriteText(20, item_n*56+116, 0x81, color, MENU_LIST[text_n]);
} }
void DrawGameOverMessage() void DrawGameOverMessage()
{ {
DrawBar(0, 0, WIN_X, WIN_Y, 0xF3E1BD); DrawBar(0, 0, WIN_X, WIN_Y, 0xF3E1BD);
WriteText(40, 40, 0x81, 0xA48C74, "GAME OVER"); WriteText(40, 40, 0x81, 0xA48C74, GAME_OVER_TEXT);
WriteText(40, 75, 0x81, 0xA48C74, "FINAL SCORE"); WriteText(40, 75, 0x81, 0xA48C74, FINAL_SCORE_TEXT);
WriteTextB(40, 140, 0x85, 0xA48C74, itoa(score)); WriteTextB(40, 140, 0x85, 0xA48C74, itoa(score));
pause(350); pause(350);
active_menu_item=0; active_menu_item=0;