From 47b7315fd58e095823ec5172dda67f5000fc9299 Mon Sep 17 00:00:00 2001 From: "Marat Zakiyanov (Mario79)" Date: Fri, 26 Dec 2014 08:36:21 +0000 Subject: [PATCH] Rusty Earth - font Russo for main menu and fix crash of background music git-svn-id: svn://kolibrios.org@5264 a494cfbc-eb01-0410-851d-a64ba20cac60 --- programs/games/rstearth/build_en.bat | 1 + programs/games/rstearth/build_ru.bat | 1 + programs/games/rstearth/font.inc | 34 ++++++++++++++++++ programs/games/rstearth/i_data.inc | 1 + programs/games/rstearth/load.inc | 22 +++++++----- programs/games/rstearth/localization_eng.inc | 2 +- programs/games/rstearth/localization_rus.inc | 8 ++--- programs/games/rstearth/menu.inc | 18 ++++++++-- .../rstearth/resources/font_russo_1bpp.png | Bin 0 -> 3726 bytes programs/games/rstearth/rstearth.asm | 5 +++ programs/games/rstearth/sound.inc | 7 ++-- programs/games/rstearth/u_data.inc | 2 ++ 12 files changed, 82 insertions(+), 19 deletions(-) create mode 100644 programs/games/rstearth/font.inc create mode 100644 programs/games/rstearth/resources/font_russo_1bpp.png diff --git a/programs/games/rstearth/build_en.bat b/programs/games/rstearth/build_en.bat index 7aae0cad65..47f7459482 100644 --- a/programs/games/rstearth/build_en.bat +++ b/programs/games/rstearth/build_en.bat @@ -4,6 +4,7 @@ if not exist bin mkdir rstearth_eng_bin @fasm -m 16384 rstearth.asm rstearth_eng_bin\rstearth.kex @erase lang.inc @kpack rstearth_eng_bin\rstearth.kex +@copy resources\font_russo_1bpp.png rstearth_eng_bin\font_russo_1bpp.png @copy resources\base_8bpp.png rstearth_eng_bin\base_8bpp.png @copy resources\red_brick_8bpp.png rstearth_eng_bin\red_brick_8bpp.png @copy resources\white_brick_8bpp.png rstearth_eng_bin\white_brick_8bpp.png diff --git a/programs/games/rstearth/build_ru.bat b/programs/games/rstearth/build_ru.bat index b4ea8e2192..d53edd1326 100644 --- a/programs/games/rstearth/build_ru.bat +++ b/programs/games/rstearth/build_ru.bat @@ -4,6 +4,7 @@ if not exist bin mkdir rstearth_rus_bin @fasm -m 16384 rstearth.asm rstearth_rus_bin\rstearth.kex @erase lang.inc @kpack rstearth_rus_bin\rstearth.kex +@copy resources\font_russo_1bpp.png rstearth_rus_bin\font_russo_1bpp.png @copy resources\base_8bpp.png rstearth_rus_bin\base_8bpp.png @copy resources\red_brick_8bpp.png rstearth_rus_bin\red_brick_8bpp.png @copy resources\white_brick_8bpp.png rstearth_rus_bin\white_brick_8bpp.png diff --git a/programs/games/rstearth/font.inc b/programs/games/rstearth/font.inc new file mode 100644 index 0000000000..3ada448f0e --- /dev/null +++ b/programs/games/rstearth/font.inc @@ -0,0 +1,34 @@ +;--------------------------------------------------------------------- +draw_font: + pusha + xor ebp,ebp + mov esi,edx + mov edx,ebx + cld +;-------------------------------------- +@@: + lodsb + test al,al + jz .exit + + movzx ebx,al + imul ebx, FONT_SIZE_X * FONT_SIZE_Y /8 + mov eax,[font_icons] + add ebx,[eax+28] + add ebx,eax + mov ecx,FONT_SIZE_X shl 16 + FONT_SIZE_Y + mov edi,[eax+20] ; palette + add edi,eax + + push esi + mov esi,1 + mcall 65 + pop esi + + add edx,FONT_REAL_SIZE_X shl 16 ; font size x + jmp @b +;-------------------------------------- +.exit: + popa + ret +;--------------------------------------------------------------------- \ No newline at end of file diff --git a/programs/games/rstearth/i_data.inc b/programs/games/rstearth/i_data.inc index 30d0cd3d90..a105d1b9ae 100644 --- a/programs/games/rstearth/i_data.inc +++ b/programs/games/rstearth/i_data.inc @@ -243,6 +243,7 @@ error_fs_text_9: db '9 - FAT table is destroyed',0 error_fs_text_10: db '10 - Access denied',0 error_fs_text_11: db '11 - Device error',0 ;--------------------------------------------------------------------- +font_icons_file_name db 'font_russo_1bpp.png',0 base_icons_file_name db 'base_8bpp.png',0 red_brick_icons_file_name db 'red_brick_8bpp.png',0 white_brick_icons_file_name db 'white_brick_8bpp.png',0 diff --git a/programs/games/rstearth/load.inc b/programs/games/rstearth/load.inc index e42a218a9f..a3a3dc39f3 100644 --- a/programs/games/rstearth/load.inc +++ b/programs/games/rstearth/load.inc @@ -65,14 +65,7 @@ load_and_convert_current_icon_set: mov eax,[raw_pointer] ret ;--------------------------------------------------------------------- -load_and_convert_all_icons: -; load and convert base icons - mov ebx,base_icons_file_name - call load_and_convert_current_icon_set - mov [base_icons],eax -; DEBUGF 1, "base_icons: %x\n",eax - -; load and convert base icons +; load and convert icons ; mov ebx,npc_miku_kick_icons_file_name ; call load_and_convert_current_icon_set ; mov [npc_miku_kick_icons],eax @@ -88,6 +81,19 @@ load_and_convert_all_icons: ; DEBUGF 1, "data size: %x\n",[eax+32] ; DEBUGF 1, "transparency offset: %x\n",[eax+36] ; DEBUGF 1, "transparency size: %x\n",[eax+40] +;--------------------------------------------------------------------- +load_and_convert_all_icons: +; load and convert font icons + mov ebx,font_icons_file_name + call load_and_convert_current_icon_set + mov [font_icons],eax +; DEBUGF 1, "font_icons: %x\n",eax + +; load and convert base icons + mov ebx,base_icons_file_name + call load_and_convert_current_icon_set + mov [base_icons],eax +; DEBUGF 1, "base_icons: %x\n",eax ; load and convert red brick mov ebx,red_brick_icons_file_name diff --git a/programs/games/rstearth/localization_eng.inc b/programs/games/rstearth/localization_eng.inc index 112e35c2eb..9e7de60d78 100644 --- a/programs/games/rstearth/localization_eng.inc +++ b/programs/games/rstearth/localization_eng.inc @@ -1,6 +1,6 @@ ;--------------------------------------------------------------------- title: - db 'Rusty Earth (Prototype 1.6) 24.12.2014',0 + db 'Rusty Earth (Prototype 1.7) 26.12.2014',0 ;--------------------------------------------------------------------- menu_game_label: db 'GAME',0 diff --git a/programs/games/rstearth/localization_rus.inc b/programs/games/rstearth/localization_rus.inc index dda174370f..e96591a5c2 100644 --- a/programs/games/rstearth/localization_rus.inc +++ b/programs/games/rstearth/localization_rus.inc @@ -2,7 +2,7 @@ ; Code page - Cyrillic OEM866 ;--------------------------------------------------------------------- title: - db 'Ржавая Земля (Прототип 1.6) 24.12.2014',0 + db 'Ржавая Земля (Прототип 1.7) 26.12.2014',0 ;--------------------------------------------------------------------- menu_game_label: db 'ИГРА',0 @@ -11,7 +11,7 @@ menu_settings_label: db 'НАСТРОЙКИ',0 ;-------------------------------------- menu_credits_label: - db 'БЛАГОДАРНОСТЬ',0 + db 'ПРИВЕТЫ',0 ;-------------------------------------- menu_help_label: db 'ПОМОЩЬ',0 @@ -36,8 +36,8 @@ menu_setting_exit: ;--------------------------------------------------------------------- menu_credits_text: .1: db 'Привет участникам команды KolibriOS Team!',0 -.2: db 'В игре использованы графические и звуковые материалы',0 -.3: db 'под свободными лицензиями, позаимствованные с сайтов:',0 +.2: db 'Графические и звуковые материалы под',0 +.3: db 'свободными лицензиями, взяты с сайтов:',0 .4: db 'http://untamed.wild-refuge.net/',0 .5: db 'http://opengameart.org',0 .6: db 'https://wiki.themanaworld.org',0 diff --git a/programs/games/rstearth/menu.inc b/programs/games/rstearth/menu.inc index 4f37d5fbee..621fa91280 100644 --- a/programs/games/rstearth/menu.inc +++ b/programs/games/rstearth/menu.inc @@ -5,6 +5,7 @@ main_menu_start: .red: mov [menu_text_pointers],main_menu_text_pointers mov [text_step_Y],SPRITE_SIZE_Y + mov [use_separate_draw_text],1 call draw_menu_window call draw_new_pointer ;--------------------------------------------------------------------- @@ -116,7 +117,7 @@ main_menu_start: clear_old_pointer: movzx ecx,byte [main_menu_pointer] imul ecx,SPRITE_SIZE_Y - add ecx,SPRITE_SIZE_Y*2 + 32 + add ecx,SPRITE_SIZE_Y*3 - 16 shl ecx,16 mov cx,SPRITE_SIZE_Y mcall 13,,,0 @@ -132,7 +133,7 @@ draw_new_pointer: movzx edx,byte [main_menu_pointer] imul edx,SPRITE_SIZE_Y - add edx,SPRITE_SIZE_Y*2 + 32 + add edx,SPRITE_SIZE_Y*3 - 16 add edx,SPRITE_SIZE_X*2 shl 16 mov eax,[npc_miku_icons] @@ -162,7 +163,16 @@ draw_menu_window: test edx,edx jz .end + cmp [use_separate_draw_text],1 + je .use_separate_draw_text + mcall + jmp .continue +;-------------------------------------- +.use_separate_draw_text: + call draw_font +;-------------------------------------- +.continue: add ebx,[text_step_Y] add esi,4 jmp @b @@ -186,10 +196,11 @@ menu_help: call snd_kick_action mov [menu_text_pointers],menu_help_text_pointers ;-------------------------------------- -.1: +.1: mov [text_step_Y],20 ;-------------------------------------- .red: + mov [use_separate_draw_text],0 call draw_menu_window ;--------------------------------------------------------------------- .still: @@ -253,6 +264,7 @@ settings_menu_start: mov [menu_text_pointers],settings_menu_text_pointers mov [text_step_Y],SPRITE_SIZE_Y call prepare_settings_text + mov [use_separate_draw_text],1 call draw_menu_window call draw_new_pointer ;--------------------------------------------------------------------- diff --git a/programs/games/rstearth/resources/font_russo_1bpp.png b/programs/games/rstearth/resources/font_russo_1bpp.png new file mode 100644 index 0000000000000000000000000000000000000000..e2a8105ee2652ef0e0f77cbf6803dcf5ecfc7172 GIT binary patch literal 3726 zcmV;94sr2`P)hPTIM}KP!r}=>{xINpz^@7n;Q#P!P(0ya&p5J@BgtJP zCB}mBF$T|g97tInc4TP;l4nC95Hke29~h{aMC-($aF1?VAmBm2gw(wE7rGJa7k8{nZhftSF=;x>q2Y&H%KA!KxjsZr;E3b2)jmAvHc!UI{RVnEFi z)pRHd+XD}e{RIIlL=1`WtK2v-1sD}Zx-d_S41Xy0;xmQ32d(&~1Smt1iN&_+ATkjG zf|Ch2AY`(|3>8#Uutn*qN@9gzCaQ{R3X}20_;88lY(>u~ebwK(+K1zX;dN$rHAu^O zS7$FtclT|{*zmAvnz6Fu;atLR0jMBSV}ys|#8E>y8ON>D;<@)g8Hu>w1v)wc4@05* z1$WrUsOpSJ3JGjH5E(Vnm~@`gPd!6DSIMH}i_Kblw^jEpgGz`&SeWRIYI1l|N_+|V z_JVbBr{QENu{>=M)m(dTAy}{Y*;UnGff|{K;2Lz5>r&!vIX**Gq0VH5(DV{!4!=M> z673qQ_SuF8lLkUK+kmt$HC`Q;-3zvcLFEcmI3DTAibs0#yp;Hw=Xnf}s@NXwP5VKo^%04f3j)d-rY zF?p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uRgSVB~vf$NMDgWrzMqxU|E0e zNNrD&QLrvZas2^Iiz7%qMV-z7VT&7&@$A_`#sT5zF27vsIJybYud*uT!^D~<~) zDha&qkno&!q3J5K+}~oS%(L>pKVW^bwyP-NSnHEV=+CzAH%`%?U$8DTS!VuyE3x^J z2_bmig%|z)Nhx7j3oz&P-OpQkaZdWFWq(4ZwkBley=BnZ+E(pPn3ytecM7id>qD$8 zc+yScnT9wph8b<-@{+lTd!)f_pCIA2c07*qoM6N<$f<#_Ka{vGU literal 0 HcmV?d00001 diff --git a/programs/games/rstearth/rstearth.asm b/programs/games/rstearth/rstearth.asm index 2b171e089f..91d52c1cf0 100644 --- a/programs/games/rstearth/rstearth.asm +++ b/programs/games/rstearth/rstearth.asm @@ -47,6 +47,10 @@ include '../../develop/libraries/box_lib/load_lib.mac' ;include '../../develop/libraries/box_lib/trunk/box_lib.mac' @use_library ;--------------------------------------------------------------------- +FONT_SIZE_X = 32 +FONT_REAL_SIZE_X = 32 +FONT_SIZE_Y = 32 +;--------------------------------------------------------------------- LEVEL_MAP_SIZE_X = 10 LEVEL_MAP_SIZE_Y = 10 SPRITE_SIZE_X = 64 @@ -207,6 +211,7 @@ include 'random.inc' include 'snd_api.inc' include 'sound.inc' include 'menu.inc' +include 'font.inc' ;--------------------------------------------------------------------- if lang eq ru include 'localization_rus.inc' diff --git a/programs/games/rstearth/sound.inc b/programs/games/rstearth/sound.inc index f26c6113ef..1c7bbf6d9f 100644 --- a/programs/games/rstearth/sound.inc +++ b/programs/games/rstearth/sound.inc @@ -180,12 +180,13 @@ snd_background_music_thread_start: mov ebx,[eax] add eax,4 mov ebp,eax -; DEBUGF 1, "src EAX: %x size EBX: %x\n",eax,ebx + add ebx,eax +; DEBUGF 1, "start EAX: %x\n",eax ;-------------------------------------- .loop: cmp [music_flag],0 je snd_background_music_thread_start -; DEBUGF 1, "src EAX: %x size EBX: %x\n",eax,ebx +; DEBUGF 1, "src EBP: %x size EBX: %x\n",ebp,ebx ; stdcall _WaveOut@12,[hBuff],eax,ebx stdcall _WaveOut@12,[hBuff1],ebp,8192 ; DEBUGF 1, "return EAX: %x\n",eax @@ -195,7 +196,7 @@ snd_background_music_thread_start: add ebp,8192*2 cmp ebx,ebp - jae .start + jbe .start sub ebp,8192 jmp .loop diff --git a/programs/games/rstearth/u_data.inc b/programs/games/rstearth/u_data.inc index 02502f7c01..ef4bf543d0 100644 --- a/programs/games/rstearth/u_data.inc +++ b/programs/games/rstearth/u_data.inc @@ -12,12 +12,14 @@ music_flag rb 1 snd_kick_flag rb 1 main_menu_pointer rb 1 settings_menu_pointer rb 1 +use_separate_draw_text rb 1 ;--------------------------------------------------------------------- align 4 N_error rd 1 error_type rd 1 error_path rd 1 ;--------------------------------------------------------------------- +font_icons rd 1 base_icons rd 1 red_brick_icons rd 1 white_brick_icons rd 1